PageSourceSearch

https://www.santiagooo.com/assets/application-1aedf064.js

js santiagooo.com collected 2026-10-02 22:02:33 UTC 1,636,046 bytes, 951 lines download raw bytes

1var VI=Object.create;var Xx=Object.defineProperty;var $I=Object.getOwnPropertyDescriptor;var UI=Object.getOwnPropertyNames;var jI=Object.getPrototypeOf,qI=Object.prototype.hasOwnProperty;var Cl=(t,e)=>()=>(t&&(e=t(t=0)),e);var Yx=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),W2=(t,e)=>{for(var i in e)Xx(t,i,{get:e[i],enumerable:!0})},HI=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of UI(e))!qI.call(t,a)&&a!==i&&Xx(t,a,{get:()=>e[a],enumerable:!(n=$I(e,a))||n.enumerable});return t};var n0=(t,e,i)=>(i=t!=null?VI(jI(t)):{},HI(e||!t||!t.__esModule?Xx(i,"default",{value:t,enumerable:!0}):i,t));var Au,v0=Cl(()=>{Au={logger:typeof console<"u"?console:void 0,WebSocket:typeof WebSocket<"u"?WebSocket:void 0}});var tn,zp=Cl(()=>{v0();tn={log(...t){this.enabled&&(t.push(Date.now()),Au.logger.log("[ActionCable]",...t))}}});var Am,b0,Em,x0,T1=Cl(()=>{zp();Am=()=>new Date().getTime(),b0=t=>(Am()-t)/1e3,Em=class{constructor(e){this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=e,this.reconnectAttempts=0}start(){this.isRunning()||(this.startedAt=Am(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),tn.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`))}stop(){this.isRunning()&&(this.stoppedAt=Am(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),tn.log("ConnectionMonitor stopped"))}isRunning(){return this.startedAt&&!this.stoppedAt}recordMessage(){this.pingedAt=Am()}recordConnect(){this.reconnectAttempts=0,delete this.disconnectedAt,tn.log("ConnectionMonitor recorded connect")}recordDisconnect(){this.disconnectedAt=Am(),tn.log("ConnectionMonitor recorded disconnect")}startPolling(){this.stopPolling(),this.poll()}stopPolling(){clearTimeout(this.pollTimeout)}poll(){this.pollTimeout=setTimeout(()=>{this.reconnectIfStale(),this.poll()},this.getPollInterval())}getPollInterval(){let{staleThreshold:e,reconnectionBackoffRate:i}=this.constructor,n=Math.pow(1+i,Math.min(this.reconnectAttempts,10)),r=(this.reconnectAttempts===0?1:i)*Math.random();return e*1e3*n*(1+r)}reconnectIfStale(){this.connectionIsStale()&&(tn.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${b0(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`),this.reconnectAttempts++,this.disconnectedRecently()?tn.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${b0(this.disconnectedAt)} s`):(tn.log("ConnectionMonitor reopening"),this.connection.reopen()))}get refreshedAt(){return this.pingedAt?this.pingedAt:this.startedAt}connectionIsStale(){return b0(this.refreshedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&b0(this.disconnectedAt)<this.constructor.staleThreshold}visibilityDidChange(){document.visibilityState==="visible"&&setTimeout(()=>{(this.connectionIsStale()||!this.connection.isOpen())&&(tn.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`),this.connection.reopen())},200)}};Em.staleThreshold=6;Em.reconnectionBackoffRate=.15;x0=Em});var Im,k1=Cl(()=>{Im={message_types:{welcome:"welcome",disconnect:"disconnect",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},disconnect_reasons:{unauthorized:"unauthorized",invalid_request:"invalid_request",server_restart:"server_restart",remote:"remote"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]}});var Lm,C1,NL,pT,Pm,w0,M1=Cl(()=>{v0();T1();k1();zp();({message_types:Lm,protocols:C1}=Im),NL=C1.slice(0,C1.length-1),pT=[].indexOf,Pm=class{constructor(e){this.open=this.open.bind(this),this.consumer=e,this.subscriptions=this.consumer.subscriptions,this.monitor=new x0(this),this.disconnected=!0}send(e){return this.isOpen()?(this.webSocket.send(JSON.stringify(e)),!0):!1}open(){if(this.isActive())return tn.log(`Attempted to open WebSocket, but existing socket is ${this.get
1State()}`),!1;{let e=[...C1,...this.consumer.subprotocols||[]];return tn.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${e}`),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new Au.WebSocket(this.consumer.url,e),this.installEventHandlers(),this.monitor.start(),!0}}close({allowReconnect:e}={allowReconnect:!0}){if(e||this.monitor.stop(),this.isOpen())return this.webSocket.close()}reopen(){if(tn.log(`Reopening WebSocket, current state is ${this.getState()}`),this.isActive())try{return this.close()}catch(e){tn.log("Failed to reopen WebSocket",e)}finally{tn.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`),setTimeout(this.open,this.constructor.reopenDelay)}else return this.open()}getProtocol(){if(this.webSocket)return this.webSocket.protocol}isOpen(){return this.isState("open")}isActive(){return this.isState("open","connecting")}triedToReconnect(){return this.monitor.reconnectAttempts>0}isProtocolSupported(){return pT.call(NL,this.getProtocol())>=0}isState(...e){return pT.call(e,this.getState())>=0}getState(){if(this.webSocket){for(let e in Au.WebSocket)if(Au.WebSocket[e]===this.webSocket.readyState)return e.toLowerCase()}return null}installEventHandlers(){for(let e in this.events){let i=this.events[e].bind(this);this.webSocket[`on${e}`]=i}}uninstallEventHandlers(){for(let e in this.events)this.webSocket[`on${e}`]=function(){}}};Pm.reopenDelay=500;Pm.prototype.events={message(t){if(!this.isProtocolSupported())return;let{identifier:e,message:i,reason:n,reconnect:a,type:r}=JSON.parse(t.data);switch(this.monitor.recordMessage(),r){case Lm.welcome:return this.triedToReconnect()&&(this.reconnectAttempted=!0),this.monitor.recordConnect(),this.subscriptions.reload();case Lm.disconnect:return tn.log(`Disconnecting. Reason: ${n}`),this.close({allowReconnect:a});case Lm.ping:return null;case Lm.confirmation:return this.subscriptions.confirmSubscription(e),this.reconnectAttempted?(this.reconnectAttempted=!1,this.subscriptions.notify(e,"connected",{reconnected:!0})):this.subscriptions.notify(e,"connected",{reconnected:!1});case Lm.rejection:return this.subscriptions.reject(e);default:return this.subscriptions.notify(e,"received",i)}},open(){if(tn.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`),this.disconnected=!1,!this.isProtocolSupported())return tn.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close(t){if(tn.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error(){tn.log("WebSocket onerror event")}};w0=Pm});var VL,Gh,A1=Cl(()=>{VL=function(t,e){if(e!=null)for(let i in e){let n=e[i];t[i]=n}return t},Gh=class{constructor(e,i={},n){this.consumer=e,this.identifier=JSON.stringify(i),VL(this,n)}perform(e,i={}){return i.action=e,this.send(i)}send(e){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(e)})}unsubscribe(){return this.consumer.subscriptions.remove(this)}}});var E1,S0,I1=Cl(()=>{zp();E1=class{constructor(e){this.subscriptions=e,this.pendingSubscriptions=[]}guarantee(e){this.pendingSubscriptions.indexOf(e)==-1?(tn.log(`SubscriptionGuarantor guaranteeing ${e.identifier}`),this.pendingSubscriptions.push(e)):tn.log(`SubscriptionGuarantor already guaranteeing ${e.identifier}`),this.startGuaranteeing()}forget(e){tn.log(`SubscriptionGuarantor forgetting ${e.identifier}`),this.pendingSubscriptions=this.pendingSubscriptions.filter(i=>i!==e)}startGuaranteeing(){this.stopGuaranteeing(),this.retrySubscribing()}stopGuaranteeing(){clearTimeout(this.retryTimeout)}retrySubscribing(){this.retryTimeout=setTimeout(()=>{this.subscriptions&&typeof this.subscriptions.subscribe=="function"&&this.pendingSubscriptions.map(e=>{tn.log(`SubscriptionGuarantor resubscribing ${e.identifier}`),this.subscriptions.subscribe(e)})},500)}},S0=E1});var Zh,L1=Cl(()=>{A1();I1();zp();Zh=class{constructor(e){this.consumer=e,this.guarantor=new S0(this),this.subscriptions=[]}create(e,i){let n=e,a=typeof n=="object"?n:{channel:n},r=new Gh(this.consumer,a,i);return this.add(r)}add(e){return this.subscriptions.push(e),this.consumer.ensureActiveConnection(),this.notify(e,"initialized"),this.subscribe(e),e}remove(e){return this.forget(e),this.findAll(e.identifier).length||this.sendCommand(e,"unsubscribe"),e}reject(e){return this.findAll(e).map(i=>(this.forget(i),this.notify(i,"rejected"),i))}forget(e){return this.guarantor.forget(e),this.subscriptions=this.subscriptions.filter(i=>i!==e),e}findAll(e){return this.subscriptions.filter(i=>i.identifier===e)}reload(){return this.subscriptions.map(e=>this.subscribe(e))}notifyAll(e,...i){return this.subscriptions.map(n=>this.notify(n,e,...i))}notify(e,i,...n){let a;return typeof e=="string"?a=this.findAll(e):a=[e],a.map(r=>typeof r[i]=="function"?r[i](...n):void 0)}subscribe(e){this.sendCommand(e,"subscribe")&&this.guarantor.guarantee(e)}confirmSubscription(e){tn.log(`Subscription confirmed ${e}`),this.findAll(e).map(i=>this.guarantor.forget(i))}sendCommand(e,i){let{identifier:n}=e;return this.consumer.send({command:i,identifier:n})}}});function P1(t){if(typeof t=="function"&&(t=t()),t&&!/^wss?:/i.test(t)){let e=document.createElement("a");return e.href=t,e.href=e.href,e.protocol=e.protocol.replace("http","ws"),e.href}else return t}var Op,fT=Cl(()=>{M1();L1();Op=class{constructor(e){this._url=e,this.subscriptions=new Zh(this),this.connection=new w0(this),this.subprotocols=[]}get url(){return P1(this._url)}send(e){return this.connection.send(e)}connect(){return this.connection.open()}disconnect(){return this.connection.close({allowReconnect:!1})}ensureActiveConnection(){if(!this.connection.isActive())return this.connection.open()}addSubProtocol(e){this.subprotocols=[...this.subprotocols,e]}}});var gT={};W2(gT,{Connection:()=>w0,ConnectionMonitor:()=>x0,Consumer:()=>Op,INTERNAL:()=>Im,Subscription:()=>Gh,SubscriptionGuarantor:()=>S0,Subscriptions:()=>Zh,adapters:()=>Au,createConsumer:()=>$L,createWebSocketURL:()=>P1,getConfig:()=>mT,logger:()=>tn});function $L(t=mT("url")||Im.default_mount_path){return new Op(t)}function mT(t){let e=document.head.querySelector(`meta[name='action-cable-${t}']`);if(e)return e.getAttribute("content")}var yT=Cl(()=>{M1();T1();fT();k1();A1();L1();I1();v0();zp()});var rw=Yx((Fp,Fm)=>{(function(){var t,e="4.17.21",i=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",r="Invalid `variable` option passed into `_.template`",h="__lodash_hash_undefined__",m=500,b="__lodash_placeholder__",T=1,k=2,P=4,F=1,U=2,X=1,Y=2,te=4,le=8,we=16,Le=32,Oe=64,ze=128,Xe=256,Ke=512,rt=30,at="...",$t=800,Tt=16,Lt=1,Di=2,mn=3,Bt=1/0,oi=9007199254740991,Si=17976931348623157e292,Gi=NaN,Jt=4294967295,Fn=Jt-1,Ms=Jt>>>1,mr=[["ary",ze],["bind",X],["bindKey",Y],["curry",le],["curryRight",we],["flip",Ke],["partial",Le],["partialRight",Oe],["rearg",Xe]],vn="[object Arguments]",Wn="[object Array]",In="[object AsyncFunction]",ln="[object Boolean]",As="[object Date]",oa="[object DOMException]",Io="[object Error]",Qr="[object Function]",oo="[object GeneratorFunction]",Bn="[object Map]",Hs="[object Number]",Ie="[object Null]",gr="[object Object]",Ha="[object Promise]",bi="[object Proxy]",Ui="[object RegExp]",yr="[object Set]",es="[object String]",ts="[object Symbol]",Wa="[object Undef
1ined]",ir="[object WeakMap]",Vl="[object WeakSet]",ao="[object ArrayBuffer]",Ge="[object DataView]",is="[object Float32Array]",Gn="[object Float64Array]",ns="[object Int8Array]",Ws="[object Int16Array]",et="[object Int32Array]",Wt="[object Uint8Array]",Et="[object Uint8ClampedArray]",nr="[object Uint16Array]",Fr="[object Uint32Array]",Ft=/\b__p \+= '';/g,Gs=/\b(__p \+=) '' \+/g,lo=/(__e\(.*?\)|\b__t\)) \+\n'';/g,co=/&(?:amp|lt|gt|quot|#39);/g,Es=/[&<>"']/g,ue=RegExp(co.source),q=RegExp(Es.source),j=/<%-([\s\S]+?)%>/g,ee=/<%([\s\S]+?)%>/g,oe=/<%=([\s\S]+?)%>/g,_e=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Se=/^\w*$/,ke=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,fe=/[\\^$.*+?()[\]{}|]/g,Re=RegExp(fe.source),$e=/^\s+/,Ee=/\s/,Ye=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,xt=/\{\n\/\* \[wrapped with (.+)\] \*/,wt=/,? & /,hi=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Nt=/[()=,{}\[\]\/\s]/,di=/\\(\\)?/g,ei=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,bn=/\w*$/,cn=/^[-+]0x[0-9a-f]+$/i,Gt=/^0b[01]+$/i,Ei=/^\[object .+?Constructor\]$/,Ji=/^0o[0-7]+$/i,Nn=/^(?:0|[1-9]\d*)$/,Zn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u01
vendor: 4,957 bytes, line 1
17f]/g,Vn=/($^)/,Ga=/['\n\r\u2028\u2029\\]/g,xi="\\ud800-\\udfff",Gu="\\u0300-\\u036f",Zu="\\ufe20-\\ufe2f",Br="\\u20d0-\\u20ff",Cr=Gu+Zu+Br,Id="\\u2700-\\u27bf",Nr="a-z\\xdf-\\xf6\\xf8-\\xff",Vr="\\xac\\xb1\\xd7\\xf7",Za="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",aa="\\u2000-\\u206f",Tn=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ka="A-Z\\xc0-\\xd6\\xd8-\\xde",rs="\\ufe0e\\ufe0f",gn=Vr+Za+aa+Tn,Xa="['\u2019]",Is="["+xi+"]",Nc="["+gn+"]",Mr="["+Cr+"]",Ld="\\d+",Vc="["+Id+"]",Lo="["+Nr+"]",uo="[^"+xi+gn+Ld+Id+Nr+Ka+"]",pi="\\ud83c[\\udffb-\\udfff]",Ku="(?:"+Mr+"|"+pi+")",$c="[^"+xi+"]",Po="(?:\\ud83c[\\udde6-\\uddff]){2}",$l="[\\ud800-\\udbff][\\udc00-\\udfff]",ho="["+Ka+"]",Ya="\\u200d",Ul="(?:"+Lo+"|"+uo+")",Ja="(?:"+ho+"|"+uo+")",Xu="(?:"+Xa+"(?:d|ll|m|re|s|t|ve))?",Pd="(?:"+Xa+"(?:D|LL|M|RE|S|T|VE))?",Yu=Ku+"?",Dd="["+rs+"]?",la="(?:"+Ya+"(?:"+[$c,Po,$l].join("|")+")"+Dd+Yu+")*",jl="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ar="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",_r=Dd+Yu+la,Uc="(?:"+[Vc,Po,$l].join("|")+")"+_r,jc="(?:"+[$c+Mr+"?",Mr,Po,$l,Is].join("|")+")",qc=RegExp(Xa,"g"),Rd=RegExp(Mr,"g"),Do=RegExp(pi+"(?="+pi+")|"+jc+_r,"g"),_f=RegExp([ho+"?"+Lo+"+"+Xu+"(?="+[Nc,ho,"$"].join("|")+")",Ja+"+"+Pd+"(?="+[Nc,ho+Ul,"$"].join("|")+")",ho+"?"+Ul+"+"+Xu,ho+"+"+Pd,Ar,jl,Ld,Uc].join("|"),"g"),zd=RegExp("["+Ya+xi+Cr+rs+"]"),Od=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,vf=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],bf=-1,Zi={};Zi[is]=Zi[Gn]=Zi[ns]=Zi[Ws]=Zi[et]=Zi[Wt]=Zi[Et]=Zi[nr]=Zi[Fr]=!0,Zi[vn]=Zi[Wn]=Zi[ao]=Zi[ln]=Zi[Ge]=Zi[As]=Zi[Io]=Zi[Qr]=Zi[Bn]=Zi[Hs]=Zi[gr]=Zi[Ui]=Zi[yr]=Zi[es]=Zi[ir]=!1;var Ii={};Ii[vn]=Ii[Wn]=Ii[ao]=Ii[Ge]=Ii[ln]=Ii[As]=Ii[is]=Ii[Gn]=Ii[ns]=Ii[Ws]=Ii[et]=Ii[Bn]=Ii[Hs]=Ii[gr]=Ii[Ui]=Ii[yr]=Ii[es]=Ii[ts]=Ii[Wt]=Ii[Et]=Ii[nr]=Ii[Fr]=!0,Ii[Io]=Ii[Qr]=Ii[ir]=!1;var Ju={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Hc={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Qu={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},eh={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Zs=parseFloat,xf=parseInt,Wc=typeof global=="object"&&global&&global.Object===Object&&global,ca=typeof self=="object"&&self&&self.Object===Object&&self,Qi=Wc||ca||Function("return this")(),_i=typeof Fp=="object"&&Fp&&!Fp.nodeType&&Fp,Ks=_i&&typeof Fm=="object"&&Fm&&!Fm.nodeType&&Fm,Fd=Ks&&Ks.exports===_i,Ro=Fd&&Wc.process,ss=function(){try{var Te=Ks&&Ks.require&&Ks.require("util").t
vendor: 4,757 bytes, line 1
1ypes;return Te||Ro&&Ro.binding&&Ro.binding("util")}catch{}}(),th=ss&&ss.isArrayBuffer,Bd=ss&&ss.isDate,ih=ss&&ss.isMap,Gc=ss&&ss.isRegExp,nh=ss&&ss.isSet,rh=ss&&ss.isTypedArray;function Er(Te,Be,De){switch(De.length){case 0:return Te.call(Be);case 1:return Te.call(Be,De[0]);case 2:return Te.call(Be,De[0],De[1]);case 3:return Te.call(Be,De[0],De[1],De[2])}return Te.apply(Be,De)}function Nd(Te,Be,De,gt){for(var Ot=-1,ci=Te==null?0:Te.length;++Ot<ci;){var rn=Te[Ot];Be(gt,rn,De(rn),Te)}return gt}function $n(Te,Be){for(var De=-1,gt=Te==null?0:Te.length;++De<gt&&Be(Te[De],De,Te)!==!1;);return Te}function Vd(Te,Be){for(var De=Te==null?0:Te.length;De--&&Be(Te[De],De,Te)!==!1;);return Te}function $d(Te,Be){for(var De=-1,gt=Te==null?0:Te.length;++De<gt;)if(!Be(Te[De],De,Te))return!1;return!0}function po(Te,Be){for(var De=-1,gt=Te==null?0:Te.length,Ot=0,ci=[];++De<gt;){var rn=Te[De];Be(rn,De,Te)&&(ci[Ot++]=rn)}return ci}function zo(Te,Be){var De=Te==null?0:Te.length;return!!De&&Fo(Te,Be,0)>-1}function sh(Te,Be,De){for(var gt=-1,Ot=Te==null?0:Te.length;++gt<Ot;)if(De(Be,Te[gt]))return!0;return!1}function ji(Te,Be){for(var De=-1,gt=Te==null?0:Te.length,Ot=Array(gt);++De<gt;)Ot[De]=Be(Te[De],De,Te);return Ot}function Oo(Te,Be){for(var De=-1,gt=Be.length,Ot=Te.length;++De<gt;)Te[Ot+De]=Be[De];return Te}function oh(Te,Be,De,gt){var Ot=-1,ci=Te==null?0:Te.length;for(gt&&ci&&(De=Te[++Ot]);++Ot<ci;)De=Be(De,Te[Ot],Ot,Te);return De}function Ud(Te,Be,De,gt){var Ot=Te==null?0:Te.length;for(gt&&Ot&&(De=Te[--Ot]);Ot--;)De=Be(De,Te[Ot],Ot,Te);return De}function Zc(Te,Be){for(var De=-1,gt=Te==null?0:Te.length;++De<gt;)if(Be(Te[De],De,Te))return!0;return!1}var jd=Wl("length");function ah(Te){return Te.split("")}function qd(Te){return Te.match(hi)||[]}function ql(Te,Be,De){var gt;return De(Te,function(Ot,ci,rn){if(Be(Ot,ci,rn))return gt=ci,!1}),gt}function os(Te,Be,De,gt){for(var Ot=Te.length,ci=De+(gt?1:-1);gt?ci--:++ci<Ot;)if(Be(Te[ci],ci,Te))return ci;return-1}function Fo(Te,Be,De){return Be===Be?nl(Te,Be,De):os(Te,Kc,De)}function lh(Te,Be,De,gt){for(var Ot=De-1,ci=Te.length;++Ot<ci;)if(gt(Te[Ot],Be))return Ot;return-1}function Kc(Te){return Te!==Te}function Hl(Te,Be){var De=Te==null?0:Te.length;return De?nn(Te,Be)/De:Gi}function Wl(Te){return function(Be){return Be==null?t:Be[Te]}}function fo(Te){return function(Be){return Te==null?t:Te[Be]}}function Xc(Te,Be,De,gt,Ot){return Ot(Te,function(ci,rn,Ri){De=gt?(gt=!1,ci):Be(De,ci,rn,Ri)}),De}function wf(Te,Be){var De=Te.length;for(Te.sort(Be);De--;)Te[De]=Te[De].value;return Te}function nn(Te,Be){for(var De,gt=-1,Ot=Te.length;++gt<Ot;){var ci=Be(Te[gt]);ci!==t&&(De=De===t?ci:De+ci)}return De}function ch(Te,Be){for(var De=-1,gt=Array(Te);++De<Te;)gt[De]=Be(De);return gt}function Zt(Te,Be){return ji(Be,function(De){return[De,Te[De]]})}function Gl(Te){return Te&&Te.slice(0,fi(Te)+1).replace($e,"")}function ti(Te){return function(Be){return Te(Be)}}function Ti(Te,Be){return ji(Be,function(De){return Te[De]})}function Ls(Te,Be){return Te.has(Be)}function Qa(Te,Be){for(var De=-1,gt=Te.length;++De<gt&&Fo(Be,Te[De],0)>-1;);return De}function el(Te,Be){for(var De=Te.length;De--&&Fo(Be,Te[De],0)>-1;);return De}function uh(Te,Be){for(var De=Te.length,gt=0;De--;)Te[De]===Be&&++gt;return gt}var ua=fo(Ju),tl=fo(Hc);function as(Te){return"\\"+eh[Te]}function hh(Te,Be){return Te==null?t:Te[Be]}function Bo(Te){return zd.test(Te)}function dh(Te){return Od.test(Te)}function ha(Te){for(var Be,De=[];!(Be=Te.next()).done;)De.push(Be.value);return De}function da(Te){var Be=-1,De=Array(Te.size);return Te.forEach(function(gt,Ot){De[++Be]=[Ot,gt]}),De}function il(Te,Be){return function(De){return Te(Be(De))}}function $r(Te,Be){for(var De=-1,gt=Te.length,Ot=0,ci=[];++De<gt;){var rn=Te[De];(rn===Be||rn===b)&&(Te[De]=b,ci[Ot++]=De)}return ci}function No(Te){var Be=-1,De=Array(Te.size);return Te.forEach(function(gt){De[++Be]=gt}),De}function Yc(Te){var Be=-1,De=Array(Te.size);return Te.forEach(function(gt){De[++Be]=[gt,gt]}),De}function nl(Te,Be,De){for(var gt=De-1,Ot=Te.length;++gt<Ot;)if(Te[gt]===Be)return gt;return-1}function rl(Te,Be,De){for(var gt=De+1;gt--;)if(Te[gt]===Be)return gt;return gt}function pa(Te){return Bo(Te)?Sf(Te):jd(Te)}function Ur(Te){return Bo(Te)?Hd(Te):ah(Te)}function fi(Te){for(var Be=Te.length;Be--&&Ee.test(Te.charAt(Be)););return Be}var Jc=fo(Qu);function Sf(Te){for(var Be=Do.lastIndex=0;Do.test(Te);)++Be;return Be}function Hd(Te){return Te.match(Do)||[]}function sl(Te){return Te.match(_f)||[]}var Wd=function Te(Be){Be=Be==null?Qi:Ps.defaults(Qi.Object(),Be,Ps.pick(Qi,vf));var De=Be.Array,gt=Be.Date,Ot=Be.Error,ci=Be.Function,rn=Be.Math,Ri=Be.Object,Vo=Be.RegExp,Zl=Be.String,vr=Be.TypeError,fa=De.prototype,ph=ci.prototype,ol=Ri.prototype,Kl=Be["__c
1ore-js_shared__"],ma=ph.toString,ki=ol.hasOwnProperty,Xl=0,al=function(){var p=/[^.]+$/.exec(Kl&&Kl.keys&&Kl.keys.IE_PROTO||"");return p?"Symbol(src)_1."+p:""}(),Ln=ol.toString,ga=ma.call(Ri),Gd=Qi._,Zd=Vo("^"+ma.call(ki).replace(fe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),en=Fd?Be.Buffer:t,Un=Be.Symbol,rr=Be.Uint8Array,ll=en?en.allocUnsafe:t,cl=il(Ri.getPrototypeOf,Ri),Yl=Ri.create,ya=ol.propertyIsEnumerable,ls=fa.splice,Qc=Un?Un.isConcatSpreadable:t,$o=Un?Un.iterator:t,mo=Un?Un.toStringTag:t,_a=function(){try{var p=bl(Ri,"defineProperty");return p({},"",{}),p}catch{}}(),fh=Be.clearTimeout!==Qi.clearTimeout&&Be.clearTimeout,mh=gt&&gt.now!==Qi.Date.now&&gt.now,va=Be.setTimeout!==Qi.setTimeout&&Be.setTimeout,ba=rn.ceil,Uo=rn.floor,Jl=Ri.getOwnPropertySymbols,gh=en?en.isBuffer:t,eu=Be.isFinite,yh=fa.join,tu=il(Ri.keys,Ri),sn=rn.max,Kn=rn.min,cs=gt.now,Xs=Be.parseInt,iu=rn.random,Ds=fa.reverse,go=bl(Be,"DataView"),Ql=bl(Be,"Map"),_h=bl(Be,"Promise"),xa=bl(Be,"Set"),ul=bl(Be,"WeakMap"),wa=bl(Ri,"create"),yo=ul&&new ul,Xn={},dt=gc(go),nu=gc(Ql),vh=gc(_h),Kd=gc(xa),hl=gc(ul),_o=Un?Un.prototype:t,Sa=_o?_o.valueOf:t,ii=_o?_o.toString:t;function J(p){if(wn(p)&&!Ut(p)&&!(p instanceof Kt)){if(p instanceof us)return p;if(ki.call(p,"__wrapped__"))return ay(p)}return new us(p)}var dl=function(){function p(){}return function(_){if(!hn(_))return{};if(Yl)return Yl(_);p.prototype=_;var M=new p;return p.prototype=t,M}}();function pl(){}function us(p,_){this.__wrapped__=p,this.__actions__=[],this.__chain__=!!_,this.__index__=0,this.__values__=t}J.templateSettings={escape:j,evaluate:ee,interpolate:oe,variable:"",imports:{_:J}},J.prototype=pl.prototype,J.prototype.constructor=J,us.prototype=dl(pl.prototype),us.prototype.constructor=us;function Kt(p){this.__wrapped__=p,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Jt,this.__views__=[]}function Xd(){var p=new Kt(this.__wrapped__);return p.__actions__=Hr(this.__actions__),p.__dir__=this.__dir__,p.__filtered__=this.__filtered__,p.__iteratees__=Hr(this.__iteratees__),p.__takeCount__=this.__takeCount__,p.__views__=Hr(this.__views__),p}function bh(){if(this.__filtered__){var p=new Kt(this);p.__dir__=-1,p.__filtered__=!0}else p=this.clone(),p.__dir__*=-1;return p}function Yd(){var p=this.__wrapped__.value(),_=this.__dir__,M=Ut(p),R=_<0,W=M?p.length:0,ie=Ff(0,W,this.__views__),pe=ie.start,be=ie.end,Me=be-pe,Ue=R?be:pe-1,je=this.__iteratees__,We=je.length,mt=0,At=Kn(Me,this.__takeCount__);if(!M||!R&&W==Me&&At==Me)return Ug(p,this.__actions__);var jt=[];e:for(;Me--&&mt<At;){Ue+=_;for(var ui=-1,qt=p[Ue];++ui<We;){var wi=je[ui],Mi=wi.iteratee,ko=wi.type,Vs=Mi(qt);if(ko==Di)qt=Vs;else if(!Vs){if(ko==Lt)continue e;break e}}jt[mt++]=qt}return jt}Kt.prototype=dl(pl.prototype),Kt.prototype.constructor=Kt;function Ta(p){var _=-1,M=p==null?0:p.length;for(this.clear();++_<M;){var R=p[_];this.set(R[0],R[1])}}function xh(){this.__data__=wa?wa(null):{},this.size=0}function Tf(p){var _=this.has(p)&&delete this.__data__[p];return this.size-=_?1:0,_}function kf(p){var _=this.__data__;if(wa){var M=_[p];return M===h?t:M}return ki.call(_,p)?_[p]:t}function jr(p){var _=this.__data__;return wa?_[p]!==t:ki.call(_,p)}function Ki(p,_){var M=this.__data__;return this.size+=this.has(p)?0:1,M[p]=wa&&_===t?h:_,this}Ta.prototype.clear=xh,Ta.prototype.delete=Tf,Ta.prototype.get=kf,Ta.prototype.has=jr,Ta.prototype.set=Ki;function Ir(p){var _=-1,M=p==null?0:p.length;for(this.clear();++_<M;){var R=p[_];this.set(R[0],R[1])}}function ru(){this.__data__=[],this.size=0}function su(p){var _=this.__data__,M=ne(_,p);if(M<0)return!1;var R=_.length-1;return M==R?_.pop():ls.call(_,M,1),--this.size,!0}function Jd(p){var _=this.__data__,M=ne(_,p);return M<0?t:_[M][1]}function ec(p){return ne(this.__data__,p)>-1}function tc(p,_){var M=this.__data__,R=ne(M,p);return R<0?(++this.size,M.push([p,_])):M[R][1]=_,this}Ir.prototype.clear=ru,Ir.prototype.delete=su,Ir.prototype.get=Jd,Ir.prototype.has=ec,Ir.prototype.set=tc;function jn(p){var _=-1,M=p==null?0:p.length;for(this.clear();++_<M;){var R=p[_];this.set(R[0],R[1])}}function ic(){this.size=0,this.__data__={hash:new Ta,map:new(Ql||Ir),string:new Ta}}function yt(p){var _=pc(this,p).delete(p);return this.size-=_?1:0,_}function Mt(p){return pc(this,p).get(p)}
vendor: 10,660 bytes, line 1
1function ou(p){return pc(this,p).has(p)}function au(p,_){var M=pc(this,p),R=M.size;return M.set(p,_),this.size+=M.size==R?0:1,this}jn.prototype.clear=ic,jn.prototype.delete=yt,jn.prototype.get=Mt,jn.prototype.has=ou,jn.prototype.set=au;function vo(p){var _=-1,M=p==null?0:p.length;for(this.__data__=new jn;++_<M;)this.add(p[_])}function x(p){return this.__data__.set(p,h),this}function s(p){return this.__data__.has(p)}vo.prototype.add=vo.prototype.push=x,vo.prototype.has=s;function u(p){var _=this.__data__=new Ir(p);this.size=_.size}function f(){this.__data__=new Ir,this.size=0}function g(p){var _=this.__data__,M=_.delete(p);return this.size=_.size,M}function v(p){return this.__data__.get(p)}function A(p){return this.__data__.has(p)}function I(p,_){var M=this.__data__;if(M instanceof Ir){var R=M.__data__;if(!Ql||R.length<i-1)return R.push([p,_]),this.size=++M.size,this;M=this.__data__=new jn(R)}return M.set(p,_),this.size=M.size,this}u.prototype.clear=f,u.prototype.delete=g,u.prototype.get=v,u.prototype.has=A,u.prototype.set=I;function L(p,_){var M=Ut(p),R=!M&&yc(p),W=!M&&!R&&Ra(p),ie=!M&&!R&&!W&&C(p),pe=M||R||W||ie,be=pe?ch(p.length,Zl):[],Me=be.length;for(var Ue in p)(_||ki.call(p,Ue))&&!(pe&&(Ue=="length"||W&&(Ue=="offset"||Ue=="parent")||ie&&(Ue=="buffer"||Ue=="byteLength"||Ue=="byteOffset")||Pa(Ue,Me)))&&be.push(Ue);return be}function O(p){var _=p.length;return _?p[tp(0,_-1)]:t}function N(p,_){return Rh(Hr(p),ve(_,0,p.length))}function V(p){return Rh(Hr(p))}function G(p,_,M){(M!==t&&!xs(p[_],M)||M===t&&!(_ in p))&&me(p,_,M)}function Q(p,_,M){var R=p[_];(!(ki.call(p,_)&&xs(R,M))||M===t&&!(_ in p))&&me(p,_,M)}function ne(p,_){for(var M=p.length;M--;)if(xs(p[M][0],_))return M;return-1}function ae(p,_,M,R){return st(p,function(W,ie,pe){_(R,W,M(W),pe)}),R}function he(p,_){return p&&_s(_,si(_),p)}function de(p,_){return p&&_s(_,Ci(_),p)}function me(p,_,M){_=="__proto__"&&_a?_a(p,_,{configurable:!0,enumerable:!0,value:M,writable:!0}):p[_]=M}function re(p,_){for(var M=-1,R=_.length,W=De(R),ie=p==null;++M<R;)W[M]=ie?t:ws(p,_[M]);return W}function ve(p,_,M){return p===p&&(M!==t&&(p=p<=M?p:M),_!==t&&(p=p>=_?p:_)),p}function xe(p,_,M,R,W,ie){var pe,be=_&T,Me=_&k,Ue=_&P;if(M&&(pe=W?M(p,R,W,ie):M(p)),pe!==t)return pe;if(!hn(p))return p;var je=Ut(p);if(je){if(pe=ty(p),!be)return Hr(p,pe)}else{var We=cr(p),mt=We==Qr||We==oo;if(Ra(p))return Hg(p,be);if(We==gr||We==vn||mt&&!W){if(pe=Me||mt?{}:iy(p),!be)return Me?lp(p,de(pe,p)):zb(p,he(pe,p))}else{if(!Ii[We])return W?p:{};pe=Vb(p,We,be)}}ie||(ie=new u);var At=ie.get(p);if(At)return At;ie.set(p,pe),y(p)?p.forEach(function(qt){pe.add(xe(qt,_,M,qt,p,ie))}):Cp(p)&&p.forEach(function(qt,wi){pe.set(wi,xe(qt,_,M,wi,p,ie))});var jt=Ue?Me?Of:vl:Me?Ci:si,ui=je?t:jt(p);return $n(ui||p,function(qt,wi){ui&&(wi=qt,qt=p[wi]),Q(pe,wi,xe(qt,_,M,wi,p,ie))}),pe}function Ae(p){var _=si(p);return function(M){return Ne(M,p,_)}}function Ne(p,_,M){var R=M.length;if(p==null)return!R;for(p=Ri(p);R--;){var W=M[R],ie=_[W],pe=p[W];if(pe===t&&!(W in p)||!ie(pe))return!1}return!0}function He(p,_,M){if(typeof p!="function")throw new vr(a);return fu(function(){p.apply(t,M)},_)}function tt(p,_,M,R){var W=-1,ie=zo,pe=!0,be=p.length,Me=[],Ue=_.length;if(!be)return Me;M&&(_=ji(_,ti(M))),R?(ie=sh,pe=!1):_.length>=i&&(ie=Ls,pe=!1,_=new vo(_));e:for(;++W<be;){var je=p[W],We=M==null?je:M(je);if(je=R||je!==0?je:0,pe&&We===We){for(var mt=Ue;mt--;)if(_[mt]===We)continue e;Me.push(je)}else ie(_,We,R)||Me.push(je)}return Me}var st=If(Pt),Je=If(Xt,!0);function Qe(p,_){var M=!0;return st(p,function(R,W,ie){return M=!!_(R,W,ie),M}),M}function ft(p,_,M){for(var R=-1,W=p.length;++R<W;){var ie=p[R],pe=_(ie);if(pe!=null&&(be===t?pe===pe&&!S(pe):M(pe,be)))var be=pe,Me=ie}return Me}function zt(p,_,M,R){var W=p.length;for(M=Z(M),M<0&&(M=-M>W?0:W+M),R=R===t||R>W?W:Z(R),R<0&&(R+=W),R=M>R?0:se(R);M<R;)p[M++]=_;return p}function it(p,_){var M=[];return st(p,function(R,W,ie){_(R,W,ie)&&M.push(R)}),M}function Ze(p,_,M,R,W){var ie=-1,pe=p.length;for(M||(M=Ub),W||(W=[]);++ie<pe;){var be=p[ie];_>0&&M(be)?_>1?Ze(be,_-1,M,R,W):Oo(W,be):R||(W[W.length]=be)}return W}var It=Lf(),qi=Lf(!0);function Pt(p,_){return p&&It(p,_,si)}function Xt(p,_){return p&&qi(p,_,si)}function zi(p,_){return po(_,function(M){return xo(p[M])})}function yn(p,_){_=Ho(_,p);for(var M=0,R=_.length;p!=null&&M<R;)p=p[Wo(_[M++])];return M&&M==R?p:t}function hs(p,_,M){var R=_(p);return Ut(p)?R:Oo(R,M(p))}function Qt(p){return p==null?p===t?Wa:Ie:mo&&mo in Ri(p)?ey(p):Zb(p)}function sr(p,_){return p>_}function br(p,_){return p!=null&&ki.call(p,_)}function or(p,_){return p!=null&&_ in Ri(p)}function xr(p,_,M){return p>=Kn(_,M)&&p<sn(_,M)}function ds(p,_,M){for(var R=M?sh:zo,W=p[0].length,ie=p.length,pe=ie,be=De(ie),Me=1/0,Ue=[];pe--;){var je=p[pe];pe&&_&&(je=ji(je,ti(_))),Me=Kn(je.length,Me),be[pe]=!M&&(_||W>=120&&je.length>=120)?new vo(pe&&je):t}je=p[0];var We=-1,mt=be[0];e:for(;++We<W&&Ue.length<Me;){var At=je[We],jt=_?_(At):At;if(At=M||At!==0?At:0,!(mt?Ls(mt,jt):R(Ue,jt,M))){for(pe=ie;--pe;){var ui=be[pe];if(!(ui?Ls(ui,jt):R(p[pe],jt,M)))continue e}mt&&mt.push(jt),Ue.push(At)}}return Ue}function fl(p,_,M,R){return Pt(p,function(W,ie,pe){_(R,M(W),ie,pe)}),R}function jo(p,_,M){_=Ho(_,p),p=pu(p,_);var R=p==null?p:p[Wo(Os(_))];return R==null?t:Er(R,p,M)}function ka(p){return wn(p)&&Qt(p)==vn}function ps(p){return wn(p)&&Qt(p)==ao}function lu(p){return wn(p)&&Qt(p)==As}function Ca(p,_,M,R,W){return p===_?!0:p==null||_==null||!wn(p)&&!wn(_)?p!==p&&_!==_:fs(p,_,M,R,Ca,W)}function fs(p,_,M,R,W,ie){var pe=Ut(p),be=Ut(_),Me=pe?Wn:cr(p),Ue=be?Wn:cr(_);Me=Me==vn?gr:Me,Ue=Ue==vn?gr:Ue;var je=Me==gr,We=Ue==gr,mt=Me==Ue;if(mt&&Ra(p)){if(!Ra(_))return!1;pe=!0,je=!1}if(mt&&!je)return ie||(ie=new u),pe||C(p)?Qg(p,_,M,R,W,ie):Nb(p,_,Me,M,R,W,ie);if(!(M&F)){var At=je&&ki.call(p,"__wrapped__"),jt=We&&ki.call(_,"__wrapped__");if(At||jt){var ui=At?p.value():p,qt=jt?_.value():_;return ie||(ie=new u),W(ui,qt,M,R,ie)}}return mt?(ie||(ie=new u),zf(p,_,M,R,W,ie)):!1}function ms(p){return wn(p)&&cr(p)==Bn}function Ys(p,_,M,R){var W=M.length,ie=W,pe=!R;if(p==null)return!ie;for(p=Ri(p);W--;){var be=M[W];if(pe&&be[2]?be[1]!==p[be[0]]:!(be[0]in p))return!1}for(;++W<ie;){be=M[W];var Me=be[0],Ue=p[Me],je=be[1];if(pe&&be[2]){if(Ue===t&&!(Me in p))return!1}else{var We=new u;if(R)var mt=R(Ue,je,Me,p,_,We);if(!(mt===t?Ca(je,Ue,F|U,R,We):mt))return!1}}return!0}function gs(p){if(!hn(p)||jb(p))return!1;var _=xo(p)?Zd:Ei;return _.test(gc(p))}function Yn(p){return wn(p)&&Qt(p)==Ui}function ar(p){return wn(p)&&cr(p)==yr}function qr(p){return wn(p)&&kl(p.length)&&!!Zi[Qt(p)]}function ni(p){return typeof p=="function"?p:p==null?eo:typeof p=="object"?Ut(p)?Sh(p[0],p[1]):Qd(p):q2(p)}function bo(p){if(!Dh(p))return tu(p);var _=[];for(var M in Ri(p))ki.call(p,M)&&M!="constructor"&&_.push(M);return _}function ml(p){if(!hn(p))return Gb(p);var _=Dh(p),M=[];for(var R in p)R=="constructor"&&(_||!ki.call(p,R))||M.push(R);return M}function qo(p,_){return p<_}function wh(p,_){var M=-1,R=Pn(p)?De(p.length):[];return st(p,function(W,ie,pe){R[++M]=_(W,ie,pe)}),R}function Qd(p){var _=fc(p);return _.length==1&&_[0][2]?Uf(_[0][0],_[0][1]):function(M){return M===p||Ys(M,p,_)}}function Sh(p,_){return Vf(p)&&$f(_)?Uf(Wo(p),_):function(M){var R=ws(M,p);return R===t&&R===_?Mn(M,p):Ca(_,R,F|U)}}function Rs(p,_,M,R,W){p!==_&&It(_,function(ie,pe){if(W||(W=new u),hn(ie))ep(p,_,pe,M,Rs,R,W);else{var be=R?R(qf(p,pe),ie,pe+"",p,_,W):t;be===t&&(be=ie),G(p,pe,be)}},Ci)}function ep(p,_,M,R,W,ie,pe){var be=qf(p,M),Me=qf(_,M),Ue=pe.get(Me);if(Ue){G(p,M,Ue);return}var je=ie?ie(be,Me,M+"",p,_,pe):t,We=je===t;if(We){var mt=Ut(Me),At=!mt&&Ra(Me),jt=!mt&&!At&&C(Me);je=Me,mt||At||jt?Ut(be)?je=be:xn(be)?je=Hr(be):At?(We=!1,je=Hg(Me,!0)):jt?(We=!1,je=Ef(Me,!0)):je=[]:o(Me)||yc(Me)?(je=be,yc(be)?je=Ce(be):(!hn(be)||xo(be))&&(je=iy(Me))):We=!1}We&&(pe.set(Me,je),W(je,Me,R,ie,pe),pe.delete(Me)),G(p,M,je)}function nc(p,_){var M=p.length;if(M)return _+=_<0?M:0,Pa(_,M)?p[_]:t}function gl(p,_,M){_.length?_=ji(_,function(ie){return Ut(ie)?function(pe){return yn(pe,ie.length===1?ie[0]:ie)}:ie}):_=[eo];var R=-1;_=ji(_,ti(Dt()));var W=wh(p,function(ie,pe,be){var Me=ji(_,function(Ue){return Ue(ie)});return{criteria:Me,index:++R,value:ie}});return wf(W,function(ie,pe){return Lr(ie,pe,M)})}function cu(p,_){return rc(p,_,function(M,R){return Mn(p,R)})}function rc(p,_,M){for(var R=-1,W=_.length,ie={};++R<W;){var pe=_[R],be=yn(p,pe);M(be,pe)&&zs(ie,Ho(pe,p),be)}return ie}function yl(p){return function(_){return yn(_,p)}}function Ma(p,_,M,R){var W=R?lh:Fo,ie=-1,pe=_.length,be=p;for(p===_&&(_=Hr(_)),M&&(be=ji(p,ti(M)));++ie<pe;)for(var Me=0,Ue=_[ie],je=M?M(Ue):Ue;(Me=W(be,je,Me,R))>-1;)be!==p&&ls.call(be,Me,1),ls.call(p,Me,1);return p}function Th(p,_){for(var M=p?_.length:0,R=M-1;M--;){var W=_[M];if(M==R||W!==ie){var ie=W;Pa(W)?ls.call(p,W,1):hu(p,W)}}return p}function tp(p,_){return p+Uo(iu()*(_-p+1))}function Vg(p,_,M,R){for(var W=-1,ie=sn(ba((_-p)/(M||1)),0),pe=De(ie);ie--;)pe[R?ie:++W]=p,p+=M;return pe}function Cf(p,_){var M="";if(!p||_<1||_>oi)return M;do _%2&&(M+=p),_=Uo(_/2),_&&(p+=p);while(_);return M}function ri(p,_){return Hf(pp(p,_,eo),p+"")}function kh(p){return O(Ts(p))}function uu(p,_){var M=Ts(p);return Rh(M,ve(_,0,M.length))}function zs(p,_,M,R){if(!hn(p))return p;_=Ho(_,p);for(var W=-1,ie=_.length,pe=ie-1,be=p;be!=null&&++W<ie;){var Me=Wo(_[W]),Ue=M;if(Me==="__proto__"||Me==="constructor"||Me==="prototype")return p;if(W!=pe){var je=be[Me];Ue=R?R(je,Me,be):t,Ue===t&&(Ue=hn(je)?je:Pa(_[W+1])?[]:{})}Q(be,Me,Ue),be=be[Me]}return p}var Js=yo?function(p,_){return yo.set(p,_),p}:eo,_l=_a?function(p,_){return _a(p,"toString",{configurable:!0,enumerable:!1,value:qx(_),writable:!0})}:eo;function $g(p){return Rh(Ts(p))}function lr(p,_,M){var R=-1,W=p.length;_<0&&(_=-_>W?0:W+_),M=M>W?W:M,M<0&&(M+=W),W=_>M?0:M-_>>>0,_>>>=0;for(var ie=De(W);++R<W;)ie[R]=p[R+_];return ie}function Rb(p,_){var M;return st(p,function(R,W,ie){return M=_(R,W,ie),!M}),!!M}function Ch(p,_,M){var R=0,W=p==null?R:p.length;if(typeof _=="number"&&_===_&&W<=Ms){for(;R<W;){var ie=R+W>>>1,pe=p[ie];pe!==null&&!S(pe)&&(M?pe<=_:pe<_)?R=ie+1:W=ie}return W}return _n(p,_,eo,M)}function _n(p,_,M,R){var W=0,ie=p==null?0:p.length;if(ie===0)return 0;_=M(_);for(var pe=_!==_,be=_===null,Me=S(_),Ue=_===t;W<ie;){var je=Uo((W+ie)/2),We=M(p[je]),mt=We!==t,At=We===null,jt=We===We,ui=S(We);if(pe)var qt=R||jt;else Ue?qt=jt&&(R||mt):be?qt=jt&&mt&&(R||!At):Me?qt=jt&&mt&&!At&&(R||!ui):At||ui?qt=!1:qt=R?We<=_:We<_;qt?W=je+1:ie=je}return Kn(ie,Fn)}function ip(p,_){for(var M=-1,R=p.length,W=0,ie=[];++M<R;){var pe=p[M],be=_?_(pe):pe;if(!M||!xs(be,Me)){var Me=be;ie[W++]=pe===0?0:pe}}
vendor: 19,505 bytes, lines 1-3
1return ie}function Mf(p){return typeof p=="number"?p:S(p)?Gi:+p}function Jn(p){if(typeof p=="string")return p;if(Ut(p))return ji(p,Jn)+"";if(S(p))return ii?ii.call(p):"";var _=p+"";return _=="0"&&1/p==-Bt?"-0":_}function ys(p,_,M){var R=-1,W=zo,ie=p.length,pe=!0,be=[],Me=be;if(M)pe=!1,W=sh;else if(ie>=i){var Ue=_?null:Ph(p);if(Ue)return No(Ue);pe=!1,W=Ls,Me=new vo}else Me=_?[]:be;e:for(;++R<ie;){var je=p[R],We=_?_(je):je;if(je=M||je!==0?je:0,pe&&We===We){for(var mt=Me.length;mt--;)if(Me[mt]===We)continue e;_&&Me.push(We),be.push(je)}else W(Me,We,M)||(Me!==be&&Me.push(We),be.push(je))}return be}function hu(p,_){return _=Ho(_,p),p=pu(p,_),p==null||delete p[Wo(Os(_))]}function np(p,_,M,R){return zs(p,_,M(yn(p,_)),R)}function Mh(p,_,M,R){for(var W=p.length,ie=R?W:-1;(R?ie--:++ie<W)&&_(p[ie],ie,p););return M?lr(p,R?0:ie,R?ie+1:W):lr(p,R?ie+1:0,R?W:ie)}function Ug(p,_){var M=p;return M instanceof Kt&&(M=M.value()),oh(_,function(R,W){return W.func.apply(W.thisArg,Oo([R],W.args))},M)}function rp(p,_,M){var R=p.length;if(R<2)return R?ys(p[0]):[];for(var W=-1,ie=De(R);++W<R;)for(var pe=p[W],be=-1;++be<R;)be!=W&&(ie[W]=tt(ie[W]||pe,p[be],_,M));return ys(Ze(ie,1),_,M)}function jg(p,_,M){for(var R=-1,W=p.length,ie=_.length,pe={};++R<W;){var be=R<ie?_[R]:t;M(pe,p[R],be)}return pe}function Ah(p){return xn(p)?p:[]}function Af(p){return typeof p=="function"?p:eo}function Ho(p,_){return Ut(p)?p:Vf(p,_)?[p]:oy(ye(p))}var qg=ri;function Aa(p,_,M){var R=p.length;return M=M===t?R:M,!_&&M>=R?p:lr(p,_,M)}var sc=fh||function(p){return Qi.clearTimeout(p)};function Hg(p,_){if(_)return p.slice();var M=p.length,R=ll?ll(M):new p.constructor(M);return p.copy(R),R}function oc(p){var _=new p.constructor(p.byteLength);return new rr(_).set(new rr(p)),_}function sp(p,_){var M=_?oc(p.buffer):p.buffer;return new p.constructor(M,p.byteOffset,p.byteLength)}function op(p){var _=new p.constructor(p.source,bn.exec(p));return _.lastIndex=p.lastIndex,_}function Wg(p){return Sa?Ri(Sa.call(p)):{}}function Ef(p,_){var M=_?oc(p.buffer):p.buffer;return new p.constructor(M,p.byteOffset,p.length)}function Gg(p,_){if(p!==_){var M=p!==t,R=p===null,W=p===p,ie=S(p),pe=_!==t,be=_===null,Me=_===_,Ue=S(_);if(!be&&!Ue&&!ie&&p>_||ie&&pe&&Me&&!be&&!Ue||R&&pe&&Me||!M&&Me||!W)return 1;if(!R&&!ie&&!Ue&&p<_||Ue&&M&&W&&!R&&!ie||be&&M&&W||!pe&&W||!Me)return-1}return 0}function Lr(p,_,M){for(var R=-1,W=p.criteria,ie=_.criteria,pe=W.length,be=M.length;++R<pe;){var Me=Gg(W[R],ie[R]);if(Me){if(R>=be)return Me;var Ue=M[R];return Me*(Ue=="desc"?-1:1)}}return p.index-_.index}function ac(p,_,M,R){for(var W=-1,ie=p.length,pe=M.length,be=-1,Me=_.length,Ue=sn(ie-pe,0),je=De(Me+Ue),We=!R;++be<Me;)je[be]=_[be];for(;++W<pe;)(We||W<ie)&&(je[M[W]]=p[W]);for(;Ue--;)je[be++]=p[W++];return je}function ap(p,_,M,R){for(var W=-1,ie=p.length,pe=-1,be=M.length,Me=-1,Ue=_.length,je=sn(ie-be,0),We=De(je+Ue),mt=!R;++W<je;)We[W]=p[W];for(var At=W;++Me<Ue;)We[At+Me]=_[Me];for(;++pe<be;)(mt||W<ie)&&(We[At+M[pe]]=p[W++]);return We}function Hr(p,_){var M=-1,R=p.length;for(_||(_=De(R));++M<R;)_[M]=p[M];return _}function _s(p,_,M,R){var W=!M;M||(M={});for(var ie=-1,pe=_.length;++ie<pe;){var be=_[ie],Me=R?R(M[be],p[be],be,M,p):t;Me===t&&(Me=p[be]),W?me(M,be,Me):Q(M,be,Me)}return M}function zb(p,_){return _s(p,mc(p),_)}function lp(p,_){return _s(p,dp(p),_)}function cp(p,_){return function(M,R){var W=Ut(M)?Nd:ae,ie=_?_():{};return W(M,p,Dt(R,2),ie)}}function lc(p){return ri(function(_,M){var R=-1,W=M.length,ie=W>1?M[W-1]:t,pe=W>2?M[2]:t;for(ie=p.length>3&&typeof ie=="function"?(W--,ie):t,pe&&kn(M[0],M[1],pe)&&(ie=W<3?t:ie,W=1),_=Ri(_);++R<W;){var be=M[R];be&&p(_,be,R,ie)}return _})}function If(p,_){return function(M,R){if(M==null)return M;if(!Pn(M))return p(M,R);for(var W=M.length,ie=_?W:-1,pe=Ri(M);(_?ie--:++ie<W)&&R(pe[ie],ie,pe)!==!1;);return M}}function Lf(p){return function(_,M,R){for(var W=-1,ie=Ri(_),pe=R(_),be=pe.length;be--;){var Me=pe[p?be:++W];if(M(ie[Me],Me,ie)===!1)break}return _}}function Ob(p,_,M){var R=_&X,W=uc(p);function ie(){var pe=this&&this!==Qi&&this instanceof ie?W:p;return pe.apply(R?M:this,arguments)}return ie}function up(p){return function(_){_=ye(_);var M=Bo(_)?Ur(_):t,R=M?M[0]:_.charAt(0),W=M?Aa(M,1).join(""):_.slice(1);return R[p]()+W}}function cc(p){return function(_){return oh(U2(vm(_).replace(qc,"")),p,"")}}function uc(p){return function(){var _=arguments;switch(_.length){case 0:return new p;case 1:return new p(_[0]);case 2:return new p(_[0],_[1]);case 3:return new p(_[0],_[1],_[2]);case 4:return new p(_[0],_[1],_[2],_[3]);case 5:return new p(_[0],_[1],_[2],_[3],_[4]);case 6:return new p(_[0],_[1],_[2],_[3],_[4],_[5]);case 7:return new p(_[0],_[1],_[2],_[3],_[4],_[5],_[6])}var M=dl(p.prototype),R=p.apply(M,_);return hn(R)?R:M}}function Eh(p,_,M){var R=uc(p);function W(){for(var ie=arguments.length,pe=De(ie),be=ie,Me=dc(W);be--;)pe[be]=arguments[be];var Ue=ie<3&&pe[0]!==Me&&pe[ie-1]!==Me?[]:$r(pe,Me);if(ie-=Ue.length,ie<M)return Rf(p,_,du,W.placeholder,t,pe,Ue,t,t,M-ie);var je=this&&this!==Qi&&this instanceof W?R:p;return Er(je,this,pe)}return W}function vs(p){return function(_,M,R){var W=Ri(_);if(!Pn(_)){var ie=Dt(M,3);_=si(_),M=function(be){return ie(W[be],be,W)}}var pe=p(_,M,R);return pe>-1?W[ie?_[pe]:pe]:t}}function Pf(p){return La(function(_){var M=_.length,R=M,W=us.prototype.thru;for(p&&_.reverse();R--;){var ie=_[R];if(typeof ie!="function")throw new vr(a);if(W&&!pe&&hc(ie)=="wrapper")var pe=new us([],!0)}for(R=pe?R:M;++R<M;){ie=_[R];var be=hc(ie),Me=be=="wrapper"?un(ie):t;Me&&xl(Me[0])&&Me[1]==(ze|le|Le|Xe)&&!Me[4].length&&Me[9]==1?pe=pe[hc(Me[0])].apply(pe,Me[3]):pe=ie.length==1&&xl(ie)?pe[be]():pe.thru(ie)}return function(){var Ue=arguments,je=Ue[0];if(pe&&Ue.length==1&&Ut(je))return pe.plant(je).value();for(var We=0,mt=M?_[We].apply(this,Ue):je;++We<M;)mt=_[We].call(this,mt);return mt}})}function du(p,_,M,R,W,ie,pe,be,Me,Ue){var je=_&ze,We=_&X,mt=_&Y,At=_&(le|we),jt=_&Ke,ui=mt?t:uc(p);function qt(){for(var wi=arguments.length,Mi=De(wi),ko=wi;ko--;)Mi[ko]=arguments[ko];if(At)var Vs=dc(qt),Co=uh(Mi,Vs);if(R&&(Mi=ac(Mi,R,W,At)),ie&&(Mi=ap(Mi,ie,pe,At)),wi-=Co,At&&wi<Ue){var tr=$r(Mi,Vs);return Rf(p,_,du,qt.placeholder,M,Mi,tr,be,Me,Ue-wi)}var za=We?M:this,xc=mt?za[p]:p;return wi=Mi.length,be?Mi=jf(Mi,be):jt&&wi>1&&Mi.reverse(),je&&Me<wi&&(Mi.length=Me),this&&this!==Qi&&this instanceof qt&&(xc=ui||uc(xc)),xc.apply(za,Mi)}return qt}function Zg(p,_){return function(M,R){return fl(M,p,_(R),{})}}function Ih(p,_){return function(M,R){var W;if(M===t&&R===t)return _;if(M!==t&&(W=M),R!==t){if(W===t)return R;typeof M=="string"||typeof R=="string"?(M=Jn(M),R=Jn(R)):(M=Mf(M),R=Mf(R)),W=p(M,R)}return W}}function Df(p){return La(function(_){return _=ji(_,ti(Dt())),ri(function(M){var R=this;return p(_,function(W){return Er(W,R,M)})})})}function hp(p,_){_=_===t?" ":Jn(_);var M=_.length;if(M<2)return M?Cf(_,p):_;var R=Cf(_,ba(p/pa(_)));return Bo(_)?Aa(Ur(R),0,p).join(""):R.slice(0,p)}function Fb(p,_,M,R){var W=_&X,ie=uc(p);function pe(){for(var be=-1,Me=arguments.length,Ue=-1,je=R.length,We=De(je+Me),mt=this&&this!==Qi&&this instanceof pe?ie:p;++Ue<je;)We[Ue]=R[Ue];for(;Me--;)We[Ue++]=arguments[++be];return Er(mt,W?M:this,We)}return pe}function Kg(p){return function(_,M,R){return R&&typeof R!="number"&&kn(_,M,R)&&(M=R=t),_=K(_),M===t?(M=_,_=0):M=K(M),R=R===t?_<M?1:-1:K(R),Vg(_,M,R,p)}}function Lh(p){return function(_,M){return typeof _=="string"&&typeof M=="string"||(_=ce(_),M=ce(M)),p(_,M)}}function Rf(p,_,M,R,W,ie,pe,be,Me,Ue){var je=_&le,We=je?pe:t,mt=je?t:pe,At=je?ie:t,jt=je?t:ie;_|=je?Le:Oe,_&=~(je?Oe:Le),_&te||(_&=~(X|Y));var ui=[p,_,W,At,We,jt,mt,be,Me,Ue],qt=M.apply(t,ui);return xl(p)&&ry(qt,ui),qt.placeholder=R,sy(qt,p,_)}function Ea(p){var _=rn[p];return function(M,R){if(M=ce(M),R=R==null?0:Kn(Z(R),292),R&&eu(M)){var W=(ye(M)+"e").split("e"),ie=_(W[0]+"e"+(+W[1]+R));return W=(ye(ie)+"e").split("e"),+(W[0]+"e"+(+W[1]-R))}return _(M)}}var Ph=xa&&1/No(new xa([,-0]))[1]==Bt?function(p){return new xa(p)}:Gx;function Xg(p){return function(_){var M=cr(_);return M==Bn?da(_):M==yr?Yc(_):Zt(_,p(_))}}function Ia(p,_,M,R,W,ie,pe,be){var Me=_&Y;if(!Me&&typeof p!="function")throw new vr(a);var Ue=R?R.length:0;if(Ue||(_&=~(Le|Oe),R=W=t),pe=pe===t?pe:sn(Z(pe),0),be=be===t?be:Z(be),Ue-=W?W.length:0,_&Oe){var je=R,We=W;R=W=t}var mt=Me?t:un(p),At=[p,_,M,R,W,je,We,ie,pe,be];if(mt&&Wb(At,mt),p=At[0],_=At[1],M=At[2],R=At[3],W=At[4],be=At[9]=At[9]===t?Me?0:p.length:sn(At[9]-Ue,0),!be&&_&(le|we)&&(_&=~(le|we)),!_||_==X)var jt=Ob(p,_,M);else _==le||_==we?jt=Eh(p,_,be):(_==Le||_==(X|Le))&&!W.length?jt=Fb(p,_,M,R):jt=du.apply(t,At);var ui=mt?Js:ry;return sy(ui(jt,At),p,_)}function Yg(p,_,M,R){return p===t||xs(p,ol[M])&&!ki.call(R,M)?_:p}function Jg(p,_,M,R,W,ie){return hn(p)&&hn(_)&&(ie.set(_,p),Rs(p,_,t,Jg,ie),ie.delete(_)),p}function Bb(p){return o(p)?t:p}function Qg(p,_,M,R,W,ie){var pe=M&F,be=p.length,Me=_.length;if(be!=Me&&!(pe&&Me>be))return!1;var Ue=ie.get(p),je=ie.get(_);if(Ue&&je)return Ue==_&&je==p;var We=-1,mt=!0,At=M&U?new vo:t;for(ie.set(p,_),ie.set(_,p);++We<be;){var jt=p[We],ui=_[We];if(R)var qt=pe?R(ui,jt,We,_,p,ie):R(jt,ui,We,p,_,ie);if(qt!==t){if(qt)continue;mt=!1;break}if(At){if(!Zc(_,function(wi,Mi){if(!Ls(At,Mi)&&(jt===wi||W(jt,wi,M,R,ie)))return At.push(Mi)})){mt=!1;break}}else if(!(jt===ui||W(jt,ui,M,R,ie))){mt=!1;break}}return ie.delete(p),ie.delete(_),mt}function Nb(p,_,M,R,W,ie,pe){switch(M){case Ge:if(p.byteLength!=_.byteLength||p.byteOffset!=_.byteOffset)return!1;p=p.buffer,_=_.buffer;case ao:return!(p.byteLength!=_.byteLength||!ie(new rr(p),new rr(_)));case ln:case As:case Hs:return xs(+p,+_);case Io:return p.name==_.name&&p.message==_.message;case Ui:case es:return p==_+"";case Bn:var be=da;case yr:var Me=R&F;if(be||(be=No),p.size!=_.size&&!Me)return!1;var Ue=pe.get(p);if(Ue)return Ue==_;R|=U,pe.set(p,_);var je=Qg(be(p),be(_),R,W,ie,pe);return pe.delete(p),je;case ts:if(Sa)return Sa.call(p)==Sa.call(_)}return!1}function zf(p,_,M,R,W,ie){var pe=M&F,be=vl(p),Me=be.length,Ue=vl(_),je=Ue.length;if(Me!=je&&!pe)return!1;for(var We=Me;We--;){var mt=be[We];if(!(pe?mt in _:ki.call(_,mt)))return!1}var At=ie.get(p),jt=ie.get(_);if(At&&jt)return At==_&&jt==p;var ui=!0;ie.set(p,_),ie.set(_,p);for(var qt=pe;++We<Me;){mt=be[We];var wi=p[mt],Mi=_[mt];if(R)var ko=pe?R(Mi,wi,mt,_,p,ie):R(wi,Mi,mt,p,_,ie);if(!(ko===t?wi===Mi||W(wi,Mi,M,R,ie):ko)){ui=!1;break}qt||(qt=mt=="constructor")}if(ui&&!qt){var Vs=p.constructor,Co=_.constructor;Vs!=Co&&"constructor"in p&&"constructor"in _&&!(typeof Vs=="function"&&Vs instanceof Vs&&typeof Co=="function"&&Co instanceof Co)&&(ui=!1)}return ie.delete(p),ie.delete(_),ui}function La(p){return Hf(pp(p,t,Gf),p+"")}function vl(p){return hs(p,si,mc)}function Of(p){return hs(p,Ci,dp)}var un=yo?function(p){return yo.get(p)}:Gx;function hc(p){for(var _=p.name+"",M=Xn[_],R=ki.call(Xn,_)?M.length:0;R--;){var W=M[R],ie=W.func;if(ie==null||ie==p)return W.name}return _}function dc(p){var _=ki.call(J,"placeholder")?J:p;return _.placeholder}function Dt(){var p=J.iteratee||Hx;return p=p===Hx?ni:p,arguments.length?p(arguments[0],arguments[1]):p}function pc(p,_){var M=p.__data__;return ny(_)?M[typeof _=="string"?"string":"hash"]:M.map}function fc(p){for(var _=si(p),M=_.length;M--;){var R=_[M],W=p[R];_[M]=[R,W,$f(W)]}return _}function bl(p,_){var M=hh(p,_);return gs(M)?M:t}function ey(p){var _=ki.call(p,mo),M=p[mo];try{p[mo]=t;var R=!0}catch{}var W=Ln.call(p);return R&&(_?p[mo]=M:delete p[mo]),W}var mc=Jl?function(p){return p==null?[]:(p=Ri(p),po(Jl(p),function(_){return ya.call(p,_)}))}:Zx,dp=Jl?function(p){for(var _=[];p;)Oo(_,mc(p)),p=cl(p);return _}:Zx,cr=Qt;(go&&cr(new go(new ArrayBuffer(1)))!=Ge||Ql&&cr(new Ql)!=Bn||_h&&cr(_h.resolve())!=Ha||xa&&cr(new xa)!=yr||ul&&cr(new ul)!=ir)&&(cr=function(p){var _=Qt(p),M=_==gr?p.constructor:t,R=M?gc(M):"";if(R)switch(R){case dt:return Ge;case nu:return Bn;case vh:return Ha;case Kd:return yr;case hl:return ir}return _});function Ff(p,_,M){for(var R=-1,W=M.length;++R<W;){var ie=M[R],pe=ie.size;switch(ie.type){case"drop":p+=pe;break;case"dropRight":_-=pe;break;case"take":_=Kn(_,p+pe);break;case"takeRight":p=sn(p,_-pe);break}}return{start:p,end:_}}function Bf(p){var _=p.match(xt);return _?_[1].split(wt):[]}function Nf(p,_,M){_=Ho(_,p);for(var R=-1,W=_.length,ie=!1;++R<W;){var pe=Wo(_[R]);if(!(ie=p!=null&&M(p,pe)))break;p=p[pe]}return ie||++R!=W?ie:(W=p==null?0:p.length,!!W&&kl(W)&&Pa(pe,W)&&(Ut(p)||yc(p)))}function ty(p){var _=p.length,M=new p.constructor(_);return _&&typeof p[0]=="string"&&ki.call(p,"index")&&(M.index=p.index,M.input=p.input),M}function iy(p){return typeof p.constructor=="function"&&!Dh(p)?dl(cl(p)):{}}function Vb(p,_,M){var R=p.constructor;switch(_){case ao:return oc(p);case ln:case As:return new R(+p);case Ge:return sp(p,M);case is:case Gn:case ns:case Ws:case et:case Wt:case Et:case nr:case Fr:return Ef(p,M);case Bn:return new R;case Hs:case es:return new R(p);case Ui:return op(p);case yr:return new R;case ts:return Wg(p)}}function $b(p,_){var M=_.length;if(!M)return p;var R=M-1;return _[R]=(M>1?"& ":"")+_[R],_=_.join(M>2?", ":" "),p.replace(Ye,`{
2/* [wrapped with `+_+`] */
3`)}function Ub(p){return Ut(p)||yc(p)||!!(Qc&&p&&p[Qc])}function Pa(p,_){var M=typeof p;return _=_??oi,!!_&&(M=="number"||M!="symbol"&&Nn.test(p))&&p>-1&&p%1==0&&p<_}function kn(p,_,M){if(!hn(M))return!1;var R=typeof _;return(R=="number"?Pn(M)&&Pa(_,M.length):R=="string"&&_ in M)?xs(M[_],p):!1}function Vf(p,_){if(Ut(p))return!1;var M=typeof p;return M=="number"||M=="symbol"||M=="boolean"||p==null||S(p)?!0:Se.test(p)||!_e.test(p)||_!=null&&p in Ri(_)}function ny(p){var _=typeof p;return _=="string"||_=="number"||_=="symbol"||_=="boolean"?p!=="__proto__":p===null}function xl(p){var _=hc(p),M=J[_];if(typeof M!="function"||!(_ in Kt.prototype))return!1;if(p===M)return!0;var R=un(M);return!!R&&p===R[0]}function jb(p){return!!al&&al in p}var qb=Kl?xo:Kx;function Dh(p){var _=p&&p.constructor,M=typeof _=="function"&&_.prototype||ol;return p===M}function $f(p){return p===p&&!hn(p)}function Uf(p,_){return function(M){return M==null?!1:M[p]===_&&(_!==t||p in Ri(M))}}function Hb(p){var _=Uh(p,function(R){return M.size===m&&M.clear(),R}),M=_.cache;return _}function Wb(p,_){var M=p[1],R=_[1],W=M|R,ie=W<(X|Y|ze),pe=R==ze&&M==le||R==ze&&M==Xe&&p[7].length<=_[8]||R==(ze|Xe)&&_[7].length<=_[8]&&M==le;if(!(ie||pe))return p;R&X&&(p[2]=_[2],W|=M&X?0:te);var be=_[3];if(be){var Me=p[3];p[3]=Me?ac(Me,be,_[4]):be,p[4]=Me?$r(p[3],b):_[4]}return be=_[5],be&&(Me=p[5],p[5]=Me?ap(Me,be,_[6]):be,p[6]=Me?$r(p[5],b):_[6]),be=_[7],be&&(p[7]=be),R&ze&&(p[8]=p[8]==null?_[8]:Kn(p[8],_[8])),p[9]==null&&(p[9]=_[9]),p[0]=_[0],p[1]=W,p}function Gb(p){var _=[];if(p!=null)for(var M in Ri(p))_.push(M);return _}function Zb(p){return Ln.call(p)}function pp(p,_,M){return _=sn(_===t?p.length-1:_,0),function(){for(var R=arguments,W=-1,ie=sn(R.length-_,0),pe=De(ie);++W<ie;)pe[W]=R[_+W];W=-1;for(var be=De(_+1);++W<_;)be[W]=R[W];return be[_]=M(pe),Er(p,this,be)}}function pu(p,_){return _.length<2?p:yn(p,lr(_,0,-1))}function jf(p,_){for(var M=p.length,R=Kn(_.length,M),W=Hr(p);R--;){var ie=_[R];p[R]=Pa(ie,M)?W[ie]:t}return p}function qf(p,_){if(!(_==="constructor"&&typeof p[_]=="function")&&_!="__proto__")return p[_]}var ry=mu(Js),fu=va||function(p,_){return Qi.setTimeout(p,_)},Hf=mu(_l);function sy(p,_,M){var R=_+"";return Hf(p,$b(R,Kb(Bf(R),M)))}function mu(p){var _=0,M=0;return function(){var R=cs(),W=Tt-(R-M);if(M=R,W>0){if(++_>=$t)return arguments[0]}else _=0;return p.apply(t,arguments)}}function Rh(p,_){var M=-1,R=p.length,W=R-1;for(_=_===t?R:_;++M<_;){var ie=tp(M,W),pe=p[ie];p[ie]=p[M],p[M]=pe}return p.length=_,p}var oy=Hb(function(p){var _=[];return p.charCodeAt(0)===46&&_.push(""),p.replace(ke,function(M,R,W,ie){_.push(W?ie.replace(di,"$1"):R||M)}),_});function Wo(p){if(typeof p=="string"||S(p))return p;var _=p+"";return _=="0"&&1/p==-Bt?"-0":_}function gc(p){if(p!=null){try{return ma.call(p)}catch{}try{return p+""}catch{}}return""}function Kb(p,_){return $n(mr,function(M){var R="_."+M[0];_&M[1]&&!zo(p,R)&&p.push(R)}),p.sort()}function ay(p){if(p instanceof Kt)return p.clone();var _=new us(p.__wrapped__,p.__chain__);return _.__actions__=Hr(p.__actions__),_.__index__=p.__index__,_.__values__=p.__values__,_}function Xb(p,_,M){(M?kn(p,_,M):_===t)?_=1:_=sn(Z(_),0);var R=p==null?0:p.length;if(!R||_<1)return[];for(var W=0,ie=0,pe=De(ba(R/_));W<R;)pe[ie++]=lr(p,W,W+=_);return pe}function ly(p){for(var _=-1,M=p==null?0:p.length,R=0,W=[];++_<M;){var ie=p[_];ie&&(W[R++]=ie)}return W}function Wf(){var p=arguments.length;if(!p)return[];for(var _=De(p-1),M=arguments[0],R=p;R--;)_[R-1]=arguments[R];return Oo(Ut(M)?Hr(M):[M],Ze(_,1))}var cy=ri(function(p,_){return xn(p)?tt(p,Ze(_,1,xn,!0)):[]}),uy=ri(function(p,_){var M=Os(_);return xn(M)&&(M=t),xn(p)?tt(p,Ze(_,1,xn,!0),Dt(M,2)):[]}),hy=ri(function(p,_){var M=Os(_);return xn(M)&&(M=t),xn(p)?tt(p,Ze(_,1,xn,!0),t,M):[]});function Yb(p,_,M){var R=p==null?0:p.length;return R?(_=M||_===t?1:Z(_),lr(p,_<0?0:_,R)):[]}function fp(p,_,M){var R=p==null?0:p.length;return R?(_=M||_===t?1:Z(_),_=R-_,lr(p,0,_<0?0:_)):[]}function Jb(p,_){return p&&p.length?Mh(p,Dt(_,3),!0,!0):[]}function dy(p,_){return p&&p.length?Mh(p,Dt(_,3),!0):[]}function Qb(p,_,M,R){var W=p==null?0:p.length;return W?(M&&typeof M!="number"&&kn(p,_,M)&&(M=0,R=W),zt(p,_,M,R)):[]}function py(p,_,M){var R=p==null?0:p.length;if(!R)return-1;var W=M==null?0:Z(M);return W<0&&(W=sn(R+W,0)),os(p,Dt(_,3),W)}function fy(p,_,M){var R=p==null?0:p.length;if(!R)return-1;var W=R-1;return M!==t&&(W=Z(M),W=M<0?sn(R+W,0):Kn(W,R-1)),os(p,Dt(_,3),W,!0)}function Gf(p){var _=p==null?0:p.length;return _?Ze(p,1):[]}function ex(p){var _=p==null?0:p.length;return _?Ze(p,Bt):[]}function tx(p,_){var M=p==null?0:p.length;return M?(_=_===t?1:Z(_),Ze(p,_)):[]}function zh(p){for(var _=-1,M=p==null?0:p.length,R={};++_<M;){var W=p[_];R[W[0]]=W[1]}return R}function Cn(p){return p&&p.length?p[0]:t}function my(p,_,M){var R=p==null?0:p.length;if(!R)return-1;var W=M==null?0:Z(M);return W<0&&(W=sn(R+W,0)),Fo(p,_,W)}function gy(p){var _=p==null?0:p.length;return _?lr(p,0,-1):[]}var yy=ri(function(p){var _=ji(p,Ah);return _.length&&_[0]===p[0]?ds(_):[]}),Oi=ri(function(p){var _=Os(p),M=ji(p,Ah);return _===Os(M)?_=t:M.pop(),M.length&&M[0]===p[0]?ds(M,Dt(_,2)):[]}),Zf=ri(function(p){var _=Os(p),M=ji(p,Ah);return _=typeof _=="function"?_:t,_&&M.pop(),M.length&&M[0]===p[0]?ds(M,t,_):[]});function _y(p,_){return p==null?"":yh.call(p,_)}function Os(p){var _=p==null?0:p.length;return _?p[_-1]:t}function Da(p,_,M){var R=p==null?0:p.length;if(!R)return-1;var W=R;return M!==t&&(W=Z(M),W=W<0?sn(R+W,0):Kn(W,R-1)),_===_?rl(p,_,W):os(p,Kc,W,!0)}function gu(p,_){return p&&p.length?nc(p,Z(_)):t}var vy=ri(by);function by(p,_){return p&&p.length&&_&&_.length?Ma(p,_):p}function ix(p,_,M){return p&&p.length&&_&&_.length?Ma(p,_,Dt(M,2)):p}function nx(p,_,M){return p&&p.length&&_&&_.length?Ma(p,_,t,M):p}var rx=La(function(p,_){var M=p==null?0:p.length,R=re(p,_);return Th(p,ji(_,function(W){return Pa(W,M)?+W:W}).sort(Gg)),R});function sx(p,_){var M=[];if(!(p&&p.length))return M;var R=-1,W=[],ie=p.length;for(_=Dt(_,3);++R<ie;){var pe=p[R];_(pe,R,p)&&(M.push(pe),W.push(R))}return Th(p,W),M}function Kf(p){return p==null?p:Ds.call(p)}function ox(p,_,M){var R=p==null?0:p.length;return R?(M&&typeof M!="number"&&kn(p,_,M)?(_=0,M=R):(_=_==null?0:Z(_),M=M===t?R:Z(M)),lr(p,_,M)):[]}function ax(p,_){return Ch(p,_)}function lx(p,_,M){return _n(p,_,Dt(M,2))}function mp(p,_){var M=p==null?0:p.length;
vendor: 9,844 bytes, line 3
3if(M){var R=Ch(p,_);if(R<M&&xs(p[R],_))return R}return-1}function yu(p,_){return Ch(p,_,!0)}function xy(p,_,M){return _n(p,_,Dt(M,2),!0)}function Xf(p,_){var M=p==null?0:p.length;if(M){var R=Ch(p,_,!0)-1;if(xs(p[R],_))return R}return-1}function Yf(p){return p&&p.length?ip(p):[]}function cx(p,_){return p&&p.length?ip(p,Dt(_,2)):[]}function ux(p){var _=p==null?0:p.length;return _?lr(p,1,_):[]}function hx(p,_,M){return p&&p.length?(_=M||_===t?1:Z(_),lr(p,0,_<0?0:_)):[]}function wy(p,_,M){var R=p==null?0:p.length;return R?(_=M||_===t?1:Z(_),_=R-_,lr(p,_<0?0:_,R)):[]}function Sy(p,_){return p&&p.length?Mh(p,Dt(_,3),!1,!0):[]}function Wr(p,_){return p&&p.length?Mh(p,Dt(_,3)):[]}var Jf=ri(function(p){return ys(Ze(p,1,xn,!0))}),Ty=ri(function(p){var _=Os(p);return xn(_)&&(_=t),ys(Ze(p,1,xn,!0),Dt(_,2))}),wl=ri(function(p){var _=Os(p);return _=typeof _=="function"?_:t,ys(Ze(p,1,xn,!0),t,_)});function Oh(p){return p&&p.length?ys(p):[]}function Fh(p,_){return p&&p.length?ys(p,Dt(_,2)):[]}function _u(p,_){return _=typeof _=="function"?_:t,p&&p.length?ys(p,t,_):[]}function vu(p){if(!(p&&p.length))return[];var _=0;return p=po(p,function(M){if(xn(M))return _=sn(M.length,_),!0}),ch(_,function(M){return ji(p,Wl(M))})}function Bh(p,_){if(!(p&&p.length))return[];var M=vu(p);return _==null?M:ji(M,function(R){return Er(_,t,R)})}var dx=ri(function(p,_){return xn(p)?tt(p,_):[]}),px=ri(function(p){return rp(po(p,xn))}),ky=ri(function(p){var _=Os(p);return xn(_)&&(_=t),rp(po(p,xn),Dt(_,2))}),Cy=ri(function(p){var _=Os(p);return _=typeof _=="function"?_:t,rp(po(p,xn),t,_)}),fx=ri(vu);function My(p,_){return jg(p||[],_||[],Q)}function Ay(p,_){return jg(p||[],_||[],zs)}var Qf=ri(function(p){var _=p.length,M=_>1?p[_-1]:t;return M=typeof M=="function"?(p.pop(),M):t,Bh(p,M)});function gp(p){var _=J(p);return _.__chain__=!0,_}function mx(p,_){return _(p),p}function yp(p,_){return _(p)}var Ey=La(function(p){var _=p.length,M=_?p[0]:0,R=this.__wrapped__,W=function(ie){return re(ie,p)};return _>1||this.__actions__.length||!(R instanceof Kt)||!Pa(M)?this.thru(W):(R=R.slice(M,+M+(_?1:0)),R.__actions__.push({func:yp,args:[W],thisArg:t}),new us(R,this.__chain__).thru(function(ie){return _&&!ie.length&&ie.push(t),ie}))});function Iy(){return gp(this)}function Nh(){return new us(this.value(),this.__chain__)}function Go(){this.__values__===t&&(this.__values__=H(this.value()));var p=this.__index__>=this.__values__.length,_=p?t:this.__values__[this.__index__++];return{done:p,value:_}}function Sl(){return this}function Ly(p){for(var _,M=this;M instanceof pl;){var R=ay(M);R.__index__=0,R.__values__=t,_?W.__wrapped__=R:_=R;var W=R;M=M.__wrapped__}return W.__wrapped__=p,_}function em(){var p=this.__wrapped__;if(p instanceof Kt){var _=p;return this.__actions__.length&&(_=new Kt(this)),_=_.reverse(),_.__actions__.push({func:yp,args:[Kf],thisArg:t}),new us(_,this.__chain__)}return this.thru(Kf)}function gx(){return Ug(this.__wrapped__,this.__actions__)}var yx=cp(function(p,_,M){ki.call(p,M)?++p[M]:me(p,M,1)});function _p(p,_,M){var R=Ut(p)?$d:Qe;return M&&kn(p,_,M)&&(_=t),R(p,Dt(_,3))}function tm(p,_){var M=Ut(p)?po:it;return M(p,Dt(_,3))}var _x=vs(py),im=vs(fy);function nm(p,_){return Ze(xp(p,_),1)}function bu(p,_){return Ze(xp(p,_),Bt)}function Py(p,_,M){return M=M===t?1:Z(M),Ze(xp(p,_),M)}function rm(p,_){var M=Ut(p)?$n:st;return M(p,Dt(_,3))}function vp(p,_){var M=Ut(p)?Vd:Je;return M(p,Dt(_,3))}var Dy=cp(function(p,_,M){ki.call(p,M)?p[M].push(_):me(p,M,[_])});function bp(p,_,M,R){p=Pn(p)?p:Ts(p),M=M&&!R?Z(M):0;var W=p.length;return M<0&&(M=sn(W+M,0)),w(p)?M<=W&&p.indexOf(_,M)>-1:!!W&&Fo(p,_,M)>-1}var Ry=ri(function(p,_,M){var R=-1,W=typeof _=="function",ie=Pn(p)?De(p.length):[];return st(p,function(pe){ie[++R]=W?Er(_,pe,M):jo(pe,_,M)}),ie}),vx=cp(function(p,_,M){me(p,M,_)});function xp(p,_){var M=Ut(p)?ji:wh;return M(p,Dt(_,3))}function zy(p,_,M,R){return p==null?[]:(Ut(_)||(_=_==null?[]:[_]),M=R?t:M,Ut(M)||(M=M==null?[]:[M]),gl(p,_,M))}var bx=cp(function(p,_,M){p[M?0:1].push(_)},function(){return[[],[]]});function xx(p,_,M){var R=Ut(p)?oh:Xc,W=arguments.length<3;return R(p,Dt(_,4),M,W,st)}function wx(p,_,M){var R=Ut(p)?Ud:Xc,W=arguments.length<3;return R(p,Dt(_,4),M,W,Je)}function Sx(p,_){var M=Ut(p)?po:it;return M(p,jh(Dt(_,3)))}function sm(p){var _=Ut(p)?O:kh;return _(p)}function Tl(p,_,M){(M?kn(p,_,M):_===t)?_=1:_=Z(_);var R=Ut(p)?N:uu;return R(p,_)}function Oy(p){var _=Ut(p)?V:$g;return _(p)}function Fy(p){if(p==null)return 0;if(Pn(p))return w(p)?pa(p):p.length;var _=cr(p);return _==Bn||_==yr?p.size:bo(p).length}function By(p,_,M){var R=Ut(p)?Zc:Rb;return M&&kn(p,_,M)&&(_=t),R(p,Dt(_,3))}var Ny=ri(function(p,_){if(p==null)return[];var M=_.length;return M>1&&kn(p,_[0],_[1])?_=[]:M>2&&kn(_[0],_[1],_[2])&&(_=[_[0]]),gl(p,Ze(_,1),[])}),Vh=mh||function(){return Qi.Date.now()};function om(p,_){if(typeof _!="function")throw new vr(a);return p=Z(p),function(){if(--p<1)return _.apply(this,arguments)}}function xu(p,_,M){return _=M?t:_,_=p&&_==null?p.length:_,Ia(p,ze,t,t,t,t,_)}function am(p,_){var M;if(typeof _!="function")throw new vr(a);return p=Z(p),function(){return--p>0&&(M=_.apply(this,arguments)),p<=1&&(_=t),M}}var $h=ri(function(p,_,M){var R=X;if(M.length){var W=$r(M,dc($h));R|=Le}return Ia(p,R,_,M,W)}),lm=ri(function(p,_,M){var R=X|Y;if(M.length){var W=$r(M,dc(lm));R|=Le}return Ia(_,R,p,M,W)});function bs(p,_,M){_=M?t:_;var R=Ia(p,le,t,t,t,t,t,_);return R.placeholder=bs.placeholder,R}function wu(p,_,M){_=M?t:_;var R=Ia(p,we,t,t,t,t,t,_);return R.placeholder=wu.placeholder,R}function cm(p,_,M){var R,W,ie,pe,be,Me,Ue=0,je=!1,We=!1,mt=!0;if(typeof p!="function")throw new vr(a);_=ce(_)||0,hn(M)&&(je=!!M.leading,We="maxWait"in M,ie=We?sn(ce(M.maxWait)||0,_):ie,mt="trailing"in M?!!M.trailing:mt);function At(tr){var za=R,xc=W;return R=W=t,Ue=tr,pe=p.apply(xc,za),pe}function jt(tr){return Ue=tr,be=fu(wi,_),je?At(tr):pe}function ui(tr){var za=tr-Me,xc=tr-Ue,H2=_-za;return We?Kn(H2,ie-xc):H2}function qt(tr){var za=tr-Me,xc=tr-Ue;return Me===t||za>=_||za<0||We&&xc>=ie}function wi(){var tr=Vh();if(qt(tr))return Mi(tr);be=fu(wi,ui(tr))}function Mi(tr){return be=t,mt&&R?At(tr):(R=W=t,pe)}function ko(){be!==t&&sc(be),Ue=0,R=Me=W=be=t}function Vs(){return be===t?pe:Mi(Vh())}function Co(){var tr=Vh(),za=qt(tr);if(R=arguments,W=this,Me=tr,za){if(be===t)return jt(Me);if(We)return sc(be),be=fu(wi,_),At(Me)}return be===t&&(be=fu(wi,_)),pe}return Co.cancel=ko,Co.flush=Vs,Co}var Vy=ri(function(p,_){return He(p,1,_)}),$y=ri(function(p,_,M){return He(p,ce(_)||0,M)});function Uy(p){return Ia(p,Ke)}function Uh(p,_){if(typeof p!="function"||_!=null&&typeof _!="function")throw new vr(a);var M=function(){var R=arguments,W=_?_.apply(this,R):R[0],ie=M.cache;if(ie.has(W))return ie.get(W);var pe=p.apply(this,R);return M.cache=ie.set(W,pe)||ie,pe};return M.cache=new(Uh.Cache||jn),M}Uh.Cache=jn;function jh(p){if(typeof p!="function")throw new vr(a);return function(){var _=arguments;switch(_.length){case 0:return!p.call(this);case 1:return!p.call(this,_[0]);case 2:return!p.call(this,_[0],_[1]);case 3:return!p.call(this,_[0],_[1],_[2])}return!p.apply(this,_)}}function Tx(p){return am(2,p)}var jy=qg(function(p,_){_=_.length==1&&Ut(_[0])?ji(_[0],ti(Dt())):ji(Ze(_,1),ti(Dt()));var M=_.length;return ri(function(R){for(var W=-1,ie=Kn(R.length,M);++W<ie;)R[W]=_[W].call(this,R[W]);return Er(p,this,R)})}),Zo=ri(function(p,_){var M=$r(_,dc(Zo));return Ia(p,Le,t,_,M)}),um=ri(function(p,_){var M=$r(_,dc(um));return Ia(p,Oe,t,_,M)}),qy=La(function(p,_){return Ia(p,Xe,t,t,t,_)});function Hy(p,_){if(typeof p!="function")throw new vr(a);return _=_===t?_:Z(_),ri(p,_)}function Wy(p,_){if(typeof p!="function")throw new vr(a);return _=_==null?0:sn(Z(_),0),ri(function(M){var R=M[_],W=Aa(M,0,_);return R&&Oo(W,R),Er(p,this,W)})}function kx(p,_,M){var R=!0,W=!0;if(typeof p!="function")throw new vr(a);return hn(M)&&(R="leading"in M?!!M.leading:R,W="trailing"in M?!!M.trailing:W),cm(p,_,{leading:R,maxWait:_,trailing:W})}function Cx(p){return xu(p,1)}function Gy(p,_){return Zo(Af(_),p)}function Su(){if(!arguments.length)return[];var p=arguments[0];return Ut(p)?p:[p]}function Zy(p){return xe(p,P)}function wp(p,_){return _=typeof _=="function"?_:t,xe(p,P,_)}function Ky(p){return xe(p,T|P)}function Sp(p,_){return _=typeof _=="function"?_:t,xe(p,T|P,_)}function Tp(p,_){return _==null||Ne(p,_,si(_))}function xs(p,_){return p===_||p!==p&&_!==_}var Mx=Lh(sr),Ax=Lh(function(p,_){return p>=_}),yc=ka(function(){return arguments}())?ka:function(p){return wn(p)&&ki.call(p,"callee")&&!ya.call(p,"callee")},Ut=De.isArray,ur=th?ti(th):ps;function Pn(p){return p!=null&&kl(p.length)&&!xo(p)}function xn(p){return wn(p)&&Pn(p)}function Xy(p){return p===!0||p===!1||wn(p)&&Qt(p)==ln}var Ra=gh||Kx,hm=Bd?ti(Bd):lu;function Ex(p){return wn(p)&&p.nodeType===1&&!o(p)}function Yy(p){if(p==null)return!0;if(Pn(p)&&(Ut(p)||typeof p=="string"||typeof p.splice=="function"||Ra(p)||C(p)||yc(p)))return!p.length;var _=cr(p);if(_==Bn||_==yr)return!p.size;if(Dh(p))return!bo(p).length;for(var M in p)if(ki.call(p,M))return!1;return!0}function Jy(p,_){return Ca(p,_)}function Ix(p,_,M){M=typeof M=="function"?M:t;var R=M?M(p,_):t;return R===t?Ca(p,_,t,M):!!R}function kp(p){if(!wn(p))return!1;var _=Qt(p);return _==Io||_==oa||typeof p.message=="string"&&typeof p.name=="string"&&!o(p)}function dm(p){return typeof p=="number"&&eu(p)}function xo(p){if(!hn(p))return!1;var _=Qt(p);return _==Qr||_==oo||_==In||_==bi}function pm(p){return typeof p=="number"&&p==Z(p)}function kl(p){return typeof p=="number"&&p>-1&&p%1==0&&p<=oi}function hn(p){var _=typeof p;return p!=null&&(_=="object"||_=="function")}function wn(p){return p!=null&&typeof p=="object"}var Cp=ih?ti(ih):ms;function Mp(p,_){return p===_||Ys(p,_,fc(_))}function qh(p,_,M){return M=typeof M=="function"?M:t,Ys(p,_,fc(_),M)}function fm(p){return l(p)&&p!=+p}
vendor: 3,473 bytes, line 3
3function mm(p){if(qb(p))throw new Ot(n);return gs(p)}function gm(p){return p===null}function Lx(p){return p==null}function l(p){return typeof p=="number"||wn(p)&&Qt(p)==Hs}function o(p){if(!wn(p)||Qt(p)!=gr)return!1;var _=cl(p);if(_===null)return!0;var M=ki.call(_,"constructor")&&_.constructor;return typeof M=="function"&&M instanceof M&&ma.call(M)==ga}var c=Gc?ti(Gc):Yn;function d(p){return pm(p)&&p>=-oi&&p<=oi}var y=nh?ti(nh):ar;function w(p){return typeof p=="string"||!Ut(p)&&wn(p)&&Qt(p)==es}function S(p){return typeof p=="symbol"||wn(p)&&Qt(p)==ts}var C=rh?ti(rh):qr;function E(p){return p===t}function D(p){return wn(p)&&cr(p)==ir}function z(p){return wn(p)&&Qt(p)==Vl}var B=Lh(qo),$=Lh(function(p,_){return p<=_});function H(p){if(!p)return[];if(Pn(p))return w(p)?Ur(p):Hr(p);if($o&&p[$o])return ha(p[$o]());var _=cr(p),M=_==Bn?da:_==yr?No:Ts;return M(p)}function K(p){if(!p)return p===0?p:0;if(p=ce(p),p===Bt||p===-Bt){var _=p<0?-1:1;return _*Si}return p===p?p:0}function Z(p){var _=K(p),M=_%1;return _===_?M?_-M:_:0}function se(p){return p?ve(Z(p),0,Jt):0}function ce(p){if(typeof p=="number")return p;if(S(p))return Gi;if(hn(p)){var _=typeof p.valueOf=="function"?p.valueOf():p;p=hn(_)?_+"":_}if(typeof p!="string")return p===0?p:+p;p=Gl(p);var M=Gt.test(p);return M||Ji.test(p)?xf(p.slice(2),M?2:8):cn.test(p)?Gi:+p}function Ce(p){return _s(p,Ci(p))}function ge(p){return p?ve(Z(p),-oi,oi):p===0?p:0}function ye(p){return p==null?"":Jn(p)}var Pe=lc(function(p,_){if(Dh(_)||Pn(_)){_s(_,si(_),p);return}for(var M in _)ki.call(_,M)&&Q(p,M,_[M])}),qe=lc(function(p,_){_s(_,Ci(_),p)}),lt=lc(function(p,_,M,R){_s(_,Ci(_),p,R)}),kt=lc(function(p,_,M,R){_s(_,si(_),p,R)}),ct=La(re);function nt(p,_){var M=dl(p);return _==null?M:he(M,_)}var vt=ri(function(p,_){p=Ri(p);var M=-1,R=_.length,W=R>2?_[2]:t;for(W&&kn(_[0],_[1],W)&&(R=1);++M<R;)for(var ie=_[M],pe=Ci(ie),be=-1,Me=pe.length;++be<Me;){var Ue=pe[be],je=p[Ue];(je===t||xs(je,ol[Ue])&&!ki.call(p,Ue))&&(p[Ue]=ie[Ue])}return p}),pt=ri(function(p){return p.push(t,Jg),Er(Qn,t,p)});function ht(p,_){return ql(p,Dt(_,3),Pt)}function Fe(p,_){return ql(p,Dt(_,3),Xt)}function bt(p,_){return p==null?p:It(p,Dt(_,3),Ci)}function _t(p,_){return p==null?p:qi(p,Dt(_,3),Ci)}function Rt(p,_){return p&&Pt(p,Dt(_,3))}function Ni(p,_){return p&&Xt(p,Dt(_,3))}function Fi(p){return p==null?[]:zi(p,si(p))}function qn(p){return p==null?[]:zi(p,Ci(p))}function ws(p,_,M){var R=p==null?t:yn(p,_);return R===t?M:R}function hr(p,_){return p!=null&&Nf(p,_,br)}function Mn(p,_){return p!=null&&Nf(p,_,or)}var Pr=Zg(function(p,_,M){_!=null&&typeof _.toString!="function"&&(_=Ln.call(_)),p[_]=M},qx(eo)),Dr=Zg(function(p,_,M){_!=null&&typeof _.toString!="function"&&(_=Ln.call(_)),ki.call(p,_)?p[_].push(M):p[_]=[M]},Dt),Rr=ri(jo);function si(p){return Pn(p)?L(p):bo(p)}function Ci(p){return Pn(p)?L(p,!0):ml(p)}function wr(p,_){var M={};return _=Dt(_,3),Pt(p,function(R,W,ie){me(M,_(R,W,ie),R)}),M}function dr(p,_){var M={};return _=Dt(_,3),Pt(p,function(R,W,ie){me(M,W,_(R,W,ie))}),M}var zr=lc(function(p,_,M){Rs(p,_,M)}),Qn=lc(function(p,_,M,R){Rs(p,_,M,R)}),Fs=La(function(p,_){var M={};if(p==null)return M;var R=!1;_=ji(_,function(ie){return ie=Ho(ie,p),R||(R=ie.length>1),ie}),_s(p,Of(p),M),R&&(M=xe(M,T|k|P,Bb));for(var W=_.length;W--;)hu(M,_[W]);return M});function Gr(p,_){return Vi(p,jh(Dt(_)))}var vi=La(function(p,_){return p==null?{}:cu(p,_)});function Vi(p,_){if(p==null)return{};var M=ji(Of(p),function(R){return[R]});
vendor: 12,625 bytes, lines 3-20
3return _=Dt(_),rc(p,M,function(R,W){return _(R,W[0])})}function Xi(p,_,M){_=Ho(_,p);var R=-1,W=_.length;for(W||(W=1,p=t);++R<W;){var ie=p==null?t:p[Wo(_[R])];ie===t&&(R=W,ie=M),p=xo(ie)?ie.call(p):ie}return p}function Ss(p,_,M){return p==null?p:zs(p,_,M)}function dn(p,_,M,R){return R=typeof R=="function"?R:t,p==null?p:zs(p,_,M,R)}var _c=Xg(si),wo=Xg(Ci);function Ko(p,_,M){var R=Ut(p),W=R||Ra(p)||C(p);if(_=Dt(_,4),M==null){var ie=p&&p.constructor;W?M=R?new ie:[]:hn(p)?M=xo(ie)?dl(cl(p)):{}:M={}}return(W?$n:Pt)(p,function(pe,be,Me){return _(M,pe,be,Me)}),M}function Qs(p,_){return p==null?!0:hu(p,_)}function Bs(p,_,M){return p==null?p:np(p,_,Af(M))}function er(p,_,M,R){return R=typeof R=="function"?R:t,p==null?p:np(p,_,Af(M),R)}function Ts(p){return p==null?[]:Ti(p,si(p))}function Hh(p){return p==null?[]:Ti(p,Ci(p))}function Qy(p,_,M){return M===t&&(M=_,_=t),M!==t&&(M=ce(M),M=M===M?M:0),_!==t&&(_=ce(_),_=_===_?_:0),ve(ce(p),_,M)}function e0(p,_,M){return _=K(_),M===t?(M=_,_=0):M=K(M),p=ce(p),xr(p,_,M)}function ym(p,_,M){if(M&&typeof M!="boolean"&&kn(p,_,M)&&(_=M=t),M===t&&(typeof _=="boolean"?(M=_,_=t):typeof p=="boolean"&&(M=p,p=t)),p===t&&_===t?(p=0,_=1):(p=K(p),_===t?(_=p,p=0):_=K(_)),p>_){var R=p;p=_,_=R}if(M||p%1||_%1){var W=iu();return Kn(p+W*(_-p+Zs("1e-"+((W+"").length-1))),_)}return tp(p,_)}var _m=cc(function(p,_,M){return _=_.toLowerCase(),p+(M?Xo(_):_)});function Xo(p){return jx(ye(p).toLowerCase())}function vm(p){return p=ye(p),p&&p.replace(Zn,ua).replace(Rd,"")}function t0(p,_,M){p=ye(p),_=Jn(_);var R=p.length;M=M===t?R:ve(Z(M),0,R);var W=M;return M-=_.length,M>=0&&p.slice(M,W)==_}function Px(p){return p=ye(p),p&&q.test(p)?p.replace(Es,tl):p}function Dx(p){return p=ye(p),p&&Re.test(p)?p.replace(fe,"\\$&"):p}var Rx=cc(function(p,_,M){return p+(M?"-":"")+_.toLowerCase()}),zx=cc(function(p,_,M){return p+(M?" ":"")+_.toLowerCase()}),Ox=up("toLowerCase");function Fx(p,_,M){p=ye(p),_=Z(_);var R=_?pa(p):0;if(!_||R>=_)return p;var W=(_-R)/2;return hp(Uo(W),M)+p+hp(ba(W),M)}function Bx(p,_,M){p=ye(p),_=Z(_);var R=_?pa(p):0;return _&&R<_?p+hp(_-R,M):p}function Nx(p,_,M){p=ye(p),_=Z(_);var R=_?pa(p):0;return _&&R<_?hp(_-R,M)+p:p}function So(p,_,M){return M||_==null?_=0:_&&(_=+_),Xs(ye(p).replace($e,""),_||0)}function Ap(p,_,M){return(M?kn(p,_,M):_===t)?_=1:_=Z(_),Cf(ye(p),_)}function i0(){var p=arguments,_=ye(p[0]);return p.length<3?_:_.replace(p[1],p[2])}var Vx=cc(function(p,_,M){return p+(M?"_":"")+_.toLowerCase()});function $x(p,_,M){return M&&typeof M!="number"&&kn(p,_,M)&&(_=M=t),M=M===t?Jt:M>>>0,M?(p=ye(p),p&&(typeof _=="string"||_!=null&&!c(_))&&(_=Jn(_),!_&&Bo(p))?Aa(Ur(p),0,M):p.split(_,M)):[]}var Ux=cc(function(p,_,M){return p+(M?" ":"")+jx(_)});function Sr(p,_,M){return p=ye(p),M=M==null?0:ve(Z(M),0,p.length),_=Jn(_),p.slice(M,M+_.length)==_}function Ns(p,_,M){var R=J.templateSettings;M&&kn(p,_,M)&&(_=t),p=ye(p),_=lt({},_,R,Yg);var W=lt({},_.imports,R.imports,Yg),ie=si(W),pe=Ti(W,ie),be,Me,Ue=0,je=_.interpolate||Vn,We="__p += '",mt=Vo((_.escape||Vn).source+"|"+je.source+"|"+(je===oe?ei:Vn).source+"|"+(_.evaluate||Vn).source+"|$","g"),At="//# sourceURL="+(ki.call(_,"sourceURL")?(_.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++bf+"]")+`
4`;p.replace(mt,function(qt,wi,Mi,ko,Vs,Co){return Mi||(Mi=ko),We+=p.slice(Ue,Co).replace(Ga,as),wi&&(be=!0,We+=`' +
5__e(`+wi+`) +
6'`),Vs&&(Me=!0,We+=`';
7`+Vs+`;
8__p += '`),Mi&&(We+=`' +
9((__t = (`+Mi+`)) == null ? '' : __t) +
10'`),Ue=Co+qt.length,qt}),We+=`';
11`;var jt=ki.call(_,"variable")&&_.variable;if(!jt)We=`with (obj) {
12`+We+`
13}
14`;else if(Nt.test(jt))throw new Ot(r);We=(Me?We.replace(Ft,""):We).replace(Gs,"$1").replace(lo,"$1;"),We="function("+(jt||"obj")+`) {
15`+(jt?"":`obj || (obj = {});
16`)+"var __t, __p = ''"+(be?", __e = _.escape":"")+(Me?`, __j = Array.prototype.join;
17function print() { __p += __j.call(arguments, '') }
18`:`;
19`)+We+`return __p
20}`;var ui=j2(function(){return ci(ie,At+"return "+We).apply(t,pe)});if(ui.source=We,kp(ui))throw ui;return ui}function vc(p){return ye(p).toLowerCase()}function To(p){return ye(p).toUpperCase()}function bc(p,_,M){if(p=ye(p),p&&(M||_===t))return Gl(p);if(!p||!(_=Jn(_)))return p;var R=Ur(p),W=Ur(_),ie=Qa(R,W),pe=el(R,W)+1;return Aa(R,ie,pe).join("")}function Yo(p,_,M){if(p=ye(p),p&&(M||_===t))return p.slice(0,fi(p)+1);if(!p||!(_=Jn(_)))return p;var R=Ur(p),W=el(R,Ur(_))+1;return Aa(R,0,W).join("")}function YE(p,_,M){if(p=ye(p),p&&(M||_===t))return p.replace($e,"");if(!p||!(_=Jn(_)))return p;var R=Ur(p),W=Qa(R,Ur(_));return Aa(R,W).join("")}function JE(p,_){var M=rt,R=at;if(hn(_)){var W="separator"in _?_.separator:W;M="length"in _?Z(_.length):M,R="omission"in _?Jn(_.omission):R}p=ye(p);var ie=p.length;if(Bo(p)){var pe=Ur(p);ie=pe.length}if(M>=ie)return p;var be=M-pa(R);if(be<1)return R;var Me=pe?Aa(pe,0,be).join(""):p.slice(0,be);if(W===t)return Me+R;if(pe&&(be+=Me.length-be),c(W)){if(p.slice(be).search(W)){var Ue,je=Me;for(W.global||(W=Vo(W.source,ye(bn.exec(W))+"g")),W.lastIndex=0;Ue=W.exec(je);)var We=Ue.index;Me=Me.slice(0,We===t?be:We)}}else if(p.indexOf(Jn(W),be)!=be){var mt=Me.lastIndexOf(W);mt>-1&&(Me=Me.slice(0,mt))}return Me+R}function QE(p){return p=ye(p),p&&ue.test(p)?p.replace(co,Jc):p}var eI=cc(function(p,_,M){return p+(M?" ":"")+_.toUpperCase()}),jx=up("toUpperCase");function U2(p,_,M){return p=ye(p),_=M?t:_,_===t?dh(p)?sl(p):qd(p):p.match(_)||[]}var j2=ri(function(p,_){try{return Er(p,t,_)}catch(M){return kp(M)?M:new Ot(M)}}),tI=La(function(p,_){return $n(_,function(M){M=Wo(M),me(p,M,$h(p[M],p))}),p});function iI(p){var _=p==null?0:p.length,M=Dt();return p=_?ji(p,function(R){if(typeof R[1]!="function")throw new vr(a);return[M(R[0]),R[1]]}):[],ri(function(R){for(var W=-1;++W<_;){var ie=p[W];if(Er(ie[0],this,R))return Er(ie[1],this,R)}})}function nI(p){return Ae(xe(p,T))}function qx(p){return function(){return p}}function rI(p,_){return p==null||p!==p?_:p}var sI=Pf(),oI=Pf(!0);function eo(p){return p}function Hx(p){return ni(typeof p=="function"?p:xe(p,T))}function aI(p){return Qd(xe(p,T))}function lI(p,_){return Sh(p,xe(_,T))}var cI=ri(function(p,_){return function(M){return jo(M,p,_)}}),uI=ri(function(p,_){return function(M){return jo(p,M,_)}});function Wx(p,_,M){var R=si(_),W=zi(_,R);M==null&&!(hn(_)&&(W.length||!R.length))&&(M=_,_=p,p=this,W=zi(_,si(_)));var ie=!(hn(M)&&"chain"in M)||!!M.chain,pe=xo(p);return $n(W,function(be){var Me=_[be];p[be]=Me,pe&&(p.prototype[be]=function(){var Ue=this.__chain__;if(ie||Ue){var je=p(this.__wrapped__),We=je.__actions__=Hr(this.__actions__);return We.push({func:Me,args:arguments,thisArg:p}),je.__chain__=Ue,je}return Me.apply(p,Oo([this.value()],arguments))})}),p}function hI(){return Qi._===this&&(Qi._=Gd),this}function Gx(){}function dI(p){return p=Z(p),ri(function(_){return nc(_,p)})}var pI=Df(ji),fI=Df($d),mI=Df(Zc);function q2(p){return Vf(p)?Wl(Wo(p)):yl(p)}function gI(p){return function(_){return p==null?t:yn(p,_)}}var yI=Kg(),_I=Kg(!0);function Zx(){return[]}function Kx(){return!1}function vI(){return{}}function bI(){return""}function xI(){return!0}function wI(p,_){if(p=Z(p),p<1||p>oi)return[];var M=Jt,R=Kn(p,Jt);_=Dt(_),p-=Jt;for(var W=ch(R,_);++M<p;)_(M);return W}function SI(p){return Ut(p)?ji(p,Wo):S(p)?[p]:Hr(oy(ye(p)))}function TI(p){var _=++Xl;return ye(p)+_}var kI=Ih(function(p,_){return p+_},0),CI=Ea("ceil"),MI=Ih(function(p,_){return p/_},1),AI=Ea("floor");function EI(p){return p&&p.length?ft(p,eo,sr):t}function II(p,_){return p&&p.length?ft(p,Dt(_,2),sr):t}function LI(p){return Hl(p,eo)}function PI(p,_){return Hl(p,Dt(_,2))}function DI(p){return p&&p.length?ft(p,eo,qo):t}function RI(p,_){return p&&p.length?ft(p,Dt(_,2),qo):t}var zI=Ih(function(p,_){return p*_},1),OI=Ea("round"),FI=Ih(function(p,_){return p-_},0);function BI(p){return p&&p.length?nn(p,eo):0}function NI(p,_){return p&&p.length?nn(p,Dt(_,2)):0}return J.after=om,J.ary=xu,J.assign=Pe,J.assignIn=qe,J.assignInWith=lt,J.assignWith=kt,J.at=ct,J.before=am,J.bind=$h,J.bindAll=tI,J.bindKey=lm,J.castArray=Su,J.chain=gp,J.chunk=Xb,J.compact=ly,J.concat=Wf,J.cond=iI,J.conforms=nI,J.constant=qx,J.countBy=yx,J.create=nt,J.curry=bs,J.curryRight=wu,J.debounce=cm,J.defaults=vt,J.defaultsDeep=pt,J.defer=Vy,J.delay=$y,J.difference=cy,J.differenceBy=uy,J.differenceWith=hy,J.drop=Yb,J.dropRight=fp,J.dropRightWhile=Jb,J.dropWhile=dy,J.fill=Qb,J.filter=tm,J.flatMap=nm,J.flatMapDeep=bu,J.flatMapDepth=Py,J.flatten=Gf,J.flattenDeep=ex,J.flattenDepth=tx,J.flip=Uy,J.flow=sI,J.flowRight=oI,J.fromPairs=zh,J.functions=Fi,J.functionsIn=qn,J.groupBy=Dy,J.initial=gy,J.intersection=yy,J.intersectionBy=Oi,J.intersectionWith=Zf,J.invert=Pr,J.invertBy=Dr,J.invokeMap=Ry,J.iteratee=Hx,J.keyBy=vx,J.keys=si,J.keysIn=Ci,J.map=xp,J.mapKeys=wr,J.mapValues=dr,J.matches=aI,J.matchesProperty=lI,J.memoize=Uh,J.merge=zr,J.mergeWith=Qn,J.method=cI,J.methodOf=uI,J.mixin=Wx,J.negate=jh,J.nthArg=dI,J.omit=Fs,J.omitBy=Gr,J.once=Tx,J.orderBy=zy,J.over=pI,J.overArgs=jy,J.overEvery=fI,J.overSome=mI,J.partial=Zo,J.partialRight=um,J.partition=bx,J.pick=vi,J.pickBy=Vi,J.property=q2,J.propertyOf=gI,J.pull=vy,J.pullAll=by,J.pullAllBy=ix,J.pullAllWith=nx,J.pullAt=rx,J.range=yI,J.rangeRight=_I,J.rearg=qy,J.reject=Sx,J.remove=sx,J.rest=Hy,J.reverse=Kf,J.sampleSize=Tl,J.set=Ss,J.setWith=dn,J.shuffle=Oy,J.slice=ox,J.sortBy=Ny,J.sortedUniq=Yf,J.sortedUniqBy=cx,J.split=$x,J.spread=Wy,J.tail=ux,J.take=hx,J.takeRight=wy,J.takeRightWhile=Sy,J.takeWhile=Wr,J.tap=mx,J.throttle=kx,J.thru=yp,J.toArray=H,J.toPairs=_c,J.toPairsIn=wo,J.toPath=SI,J.toPlainObject=Ce,J.transform=Ko,J.unary=Cx,J.union=Jf,J.unionBy=Ty,J.unionWith=wl,J.uniq=Oh,J.uniqBy=Fh,J.uniqWith=_u,J.unset=Qs,J.unzip=vu,J.unzipWith=Bh,J.update=Bs,J.updateWith=er,J.values=Ts,J.valuesIn=Hh,J.without=dx,J.words=U2,J.wrap=Gy,J.xor=px,J.xorBy=ky,J.xorWith=Cy,J.zip=fx,J.zipObject=My,J.zipObjectDeep=Ay,J.zipWith=Qf,J.entries=_c,J.entriesIn=wo,J.extend=qe,J.extendWith=lt,Wx(J,J),J.add=kI,J.attempt=j2,J.camelCase=_m,J.capitalize=Xo,J.ceil=CI,J.clamp=Qy,J.clone=Zy,J.cloneDeep=Ky,J.cloneDeepWith=Sp,J.cloneWith=wp,J.conformsTo=Tp,J.deburr=vm,J.defaultTo=rI,J.divide=MI,J.endsWith=t0,J.eq=xs,J.escape=Px,J.escapeRegExp=Dx,J.every=_p,J.find=_x,J.findIndex=py,J.findKey=ht,J.findLast=im,J.findLastIndex=fy,J.findLastKey=Fe,J.floor=AI,J.forEach=rm,J.forEachRight=vp,J.forIn=bt,J.forInRight=_t,J.forOwn=Rt,J.forOwnRight=Ni,J.get=ws,J.gt=Mx,J.gte=Ax,J.has=hr,J.hasIn=Mn,J.head=Cn,J.identity=eo,J.includes=bp,J.indexOf=my,J.inRange=e0,J.invoke=Rr,J.isArguments=yc,J.isArray=Ut,J.isArrayBuffer=ur,J.isArrayLike=Pn,J.isArrayLikeObject=xn,J.isBoolean=Xy,J.isBuffer=Ra,J.isDate=hm,J.isElement=Ex,J.isEmpty=Yy,J.isEqual=Jy,J.isEqualWith=Ix,J.isError=kp,J.isFinite=dm,J.isFunction=xo,J.isInteger=pm,J.isLength=kl,J.isMap=Cp,J.isMatch=Mp,J.isMatchWith=qh,J.isNaN=fm,J.isNative=mm,J.isNil=Lx,J.isNull=gm,J.isNumber=l,J.isObject=hn,J.isObjectLike=wn,J.isPlainObject=o,J.isRegExp=c,J.isSafeInteger=d,J.isSet=y,J.isString=w,J.isSymbol=S,J.isTypedArray=C,J.isUndefined=E,J.isWeakMap=D,J.isWeakSet=z,J.join=_y,J.kebabCase=Rx,J.last=Os,J.lastIndexOf=Da,J.lowerCase=zx,J.lowerFirst=Ox,J.lt=B,J.lte=$,J.max=EI,J.maxBy=II,J.mean=LI,J.meanBy=PI,J.min=DI,J.minBy=RI,J.stubArray=Zx,J.stubFalse=Kx,J.stubObject=vI,J.stubString=bI,J.stubTrue=xI,J.multiply=zI,J.nth=gu,J.noConflict=hI,J.noop=Gx,J.now=Vh,J.pad=Fx,J.padEnd=Bx,J.padStart=Nx,J.parseInt=So,J.random=ym,J.reduce=xx,J.reduceRight=wx,J.repeat=Ap,J.replace=i0,J.result=Xi,J.round=OI,J.runInContext=Te,J.sample=sm,J.size=Fy,J.snakeCase=Vx,J.some=By,J.sortedIndex=ax,J.sortedIndexBy=lx,J.sortedIndexOf=mp,J.sortedLastIndex=yu,J.sortedLastIndexBy=xy,J.sortedLastIndexOf=Xf,J.startCase=Ux,J.startsWith=Sr,J.subtract=FI,J.sum=BI,J.sumBy=NI,J.template=Ns,J.times=wI,J.toFinite=K,J.toInteger=Z,J.toLength=se,J.toLower=vc,J.toNumber=ce,J.toSafeInteger=ge,J.toString=ye,J.toUpper=To,J.trim=bc,J.trimEnd=Yo,J.trimStart=YE,J.truncate=JE,J.unescape=QE,J.uniqueId=TI,J.upperCase=eI,J.upperFirst=jx,J.each=rm,J.eachRight=vp,J.first=Cn,Wx(J,function(){var p={};return Pt(J,function(_,M){ki.call(J.prototype,M)||(p[M]=_)}),p}(),{chain:!1}),J.VERSION=e,$n(["bind","bindKey","curry","curryRight","partial","partialRight"],function(p){J[p].placeholder=J}),$n(["drop","take"],function(p,_){Kt.prototype[p]=function(M){M=M===t?1:sn(Z(M),0);var R=this.__filtered__&&!_?new Kt(this):this.clone();return R.__filtered__?R.__takeCount__=Kn(M,R.__takeCount__):R.__views__.push({size:Kn(M,Jt),type:p+(R.__dir__<0?"Right":"")}),R},Kt.prototype[p+"Right"]=function(M){return this.reverse()[p](M).reverse()}}),$n(["filter","map","takeWhile"],function(p,_){var M=_+1,R=M==Lt||M==mn;Kt.prototype[p]=function(W){var ie=this.clone();
20return ie.__iteratees__.push({iteratee:Dt(W,3),type:M}),ie.__filtered__=ie.__filtered__||R,ie}}),$n(["head","last"],function(p,_){var M="take"+(_?"Right":"");Kt.prototype[p]=function(){return this[M](1).value()[0]}}),$n(["initial","tail"],function(p,_){var M="drop"+(_?"":"Right");Kt.prototype[p]=function(){return this.__filtered__?new Kt(this):this[M](1)}}),Kt.prototype.compact=function(){return this.filter(eo)},Kt.prototype.find=function(p){return this.filter(p).head()},Kt.prototype.findLast=function(p){return this.reverse().find(p)},Kt.prototype.invokeMap=ri(function(p,_){return typeof p=="function"?new Kt(this):this.map(function(M){return jo(M,p,_)})}),Kt.prototype.reject=function(p){return this.filter(jh(Dt(p)))},Kt.prototype.slice=function(p,_){p=Z(p);var M=this;return M.__filtered__&&(p>0||_<0)?new Kt(M):(p<0?M=M.takeRight(-p):p&&(M=M.drop(p)),_!==t&&(_=Z(_),M=_<0?M.dropRight(-_):M.take(_-p)),M)},Kt.prototype.takeRightWhile=function(p){return this.reverse().takeWhile(p).reverse()},Kt.prototype.toArray=function(){return this.take(Jt)},Pt(Kt.prototype,function(p,_){var M=/^(?:filter|find|map|reject)|While$/.test(_),R=/^(?:head|last)$/.test(_),W=J[R?"take"+(_=="last"?"Right":""):_],ie=R||/^find/.test(_);W&&(J.prototype[_]=function(){var pe=this.__wrapped__,be=R?[1]:arguments,Me=pe instanceof Kt,Ue=be[0],je=Me||Ut(pe),We=function(wi){var Mi=W.apply(J,Oo([wi],be));return R&&mt?Mi[0]:Mi};je&&M&&typeof Ue=="function"&&Ue.length!=1&&(Me=je=!1);var mt=this.__chain__,At=!!this.__actions__.length,jt=ie&&!mt,ui=Me&&!At;if(!ie&&je){pe=ui?pe:new Kt(this);var qt=p.apply(pe,be);return qt.__actions__.push({func:yp,args:[We],thisArg:t}),new us(qt,mt)}return jt&&ui?p.apply(this,be):(qt=this.thru(We),jt?R?qt.value()[0]:qt.value():qt)})}),$n(["pop","push","shift","sort","splice","unshift"],function(p){var _=fa[p],M=/^(?:push|sort|unshift)$/.test(p)?"tap":"thru",R=/^(?:pop|shift)$/.test(p);J.prototype[p]=function(){var W=arguments;if(R&&!this.__chain__){var ie=this.value();return _.apply(Ut(ie)?ie:[],W)}return this[M](function(pe){return _.apply(Ut(pe)?pe:[],W)})}}),Pt(Kt.prototype,function(p,_){var M=J[_];if(M){var R=M.name+"";ki.call(Xn,R)||(Xn[R]=[]),Xn[R].push({name:_,func:M})}}),Xn[du(t,Y).name]=[{name:"wrapper",func:t}],Kt.prototype.clone=Xd,Kt.prototype.reverse=bh,Kt.prototype.value=Yd,J.prototype.at=Ey,J.prototype.chain=Iy,J.prototype.commit=Nh,J.prototype.next=Go,J.prototype.plant=Ly,J.prototype.reverse=em,J.prototype.toJSON=J.prototype.valueOf=J.prototype.value=gx,J.prototype.first=J.prototype.head,$o&&(J.prototype[$o]=Sl),J},Ps=Wd();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Qi._=Ps,define(function(){return Ps})):Ks?((Ks.exports=Ps)._=Ps,_i._=Ps):Qi._=Ps}).call(Fp)});var FT=Yx((ow,aw)=>{(function(t,e){typeof ow=="object"&&typeof aw<"u"?aw.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self,t.maplibregl=e())})(ow,function(){"use strict";var t={},e={};function i(a,r,h){if(e[a]=h,a==="index"){var m="var sharedModule = {}; ("+e.shared+")(sharedModule); ("+e.worker+")(sharedModule);",b={};return e.shared(b),e.index(t,b),typeof window<"u"&&t.setWorkerUrl(window.URL.createObjectURL(new Blob([m],{type:"text/javascript"}))),t}}i("shared",["exports"],function(a){"use strict";function r(l,o,c,d){return new(c||(c=Promise))(function(y,w){function S(D){try{E(d.next(D))}catch(z){w(z)}}function C(D){try{E(d.throw(D))}catch(z){w(z)}}function E(D){var z;D.done?y(D.value):(z=D.value,z instanceof c?z:new c(function(B){B(z)})).then(S,C)}E((d=d.apply(l,o||[])).next())})}function h(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}typeof SuppressedError=="function"&&SuppressedError;var m=b;function b(l,o){this.x=l,this.y=o}b.prototype={clone:function(){return new b(this.x,this.y)},add:function(l){return this.clone()._add(l)},sub:function(l){return this.clone()._sub(l)},multByPoint:function(l){return this.clone()._multByPoint(l)},divByPoint:function(l){return this.clone()._divByPoint(l)},mult:function(l){return this.clone()._mult(l)},div:function(l){return this.clone()._div(l)},rotate:function(l){return this.clone()._rotate(l)}
20,rotateAround:function(l,o){return this.clone()._rotateAround(l,o)},matMult:function(l){return this.clone()._matMult(l)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(l){return this.x===l.x&&this.y===l.y},dist:function(l){return Math.sqrt(this.distSqr(l))},distSqr:function(l){var o=l.x-this.x,c=l.y-this.y;return o*o+c*c},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(l){return Math.atan2(this.y-l.y,this.x-l.x)},angleWith:function(l){return this.angleWithSep(l.x,l.y)},angleWithSep:function(l,o){return Math.atan2(this.x*o-this.y*l,this.x*l+this.y*o)},_matMult:function(l){var o=l[2]*this.x+l[3]*this.y;return this.x=l[0]*this.x+l[1]*this.y,this.y=o,this},_add:function(l){return this.x+=l.x,this.y+=l.y,this},_sub:function(l){return this.x-=l.x,this.y-=l.y,this},_mult:function(l){return this.x*=l,this.y*=l,this},_div:function(l){return this.x/=l,this.y/=l,this},_multByPoint:function(l){return this.x*=l.x,this.y*=l.y,this},_divByPoint:function(l){return this.x/=l.x,this.y/=l.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var l=this.y;return this.y=this.x,this.x=-l,this},_rotate:function(l){var o=Math.cos(l),c=Math.sin(l),d=c*this.x+o*this.y;return this.x=o*this.x-c*this.y,this.y=d,this},_rotateAround:function(l,o){var c=Math.cos(l),d=Math.sin(l),y=o.y+d*(this.x-o.x)+c*(this.y-o.y);return this.x=o.x+c*(this.x-o.x)-d*(this.y-o.y),this.y=y,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},b.convert=function(l){return l instanceof b?l:Array.isArray(l)?new b(l[0],l[1]):l};var T=h(m),k=P;function P(l,o,c,d){this.cx=3*l,this.bx=3*(c-l)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(d-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=l,this.p1y=o,this.p2x=c,this.p2y=d}P.prototype={sampleCurveX:function(l){return((this.ax*l+this.bx)*l+this.cx)*l},sampleCurveY:function(l){return((this.ay*l+this.by)*l+this.cy)*l},sampleCurveDerivativeX:function(l){return(3*this.ax*l+2*this.bx)*l+this.cx},solveCurveX:function(l,o){if(o===void 0&&(o=1e-6),l<0)return 0;if(l>1)return 1;for(var c=l,d=0;d<8;d++){var y=this.sampleCurveX(c)-l;if(Math.abs(y)<o)return c;var w=this.sampleCurveDerivativeX(c);if(Math.abs(w)<1e-6)break;c-=y/w}var S=0,C=1;for(c=l,d=0;d<20&&(y=this.sampleCurveX(c),!(Math.abs(y-l)<o));d++)l>y?S=c:C=c,c=.5*(C-S)+S;return c},solve:function(l,o){return this.sampleCurveY(this.solveCurveX(l,o))}};var F=h(k);let U,X;function Y(){return U==null&&(U=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),U}function te(){if(X==null&&(X=!1,Y())){let o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let d=0;d<5*5;d++){let y=4*d;o.fillStyle=`rgb(${y},${y+1},${y+2})`,o.fillRect(d%5,Math.floor(d/5),1,1)}let c=o.getImageData(0,0,5,5).data;for(let d=0;d<5*5*4;d++)if(d%4!=3&&c[d]!==d){X=!0;break}}}return X||!1}function le(l,o,c,d){let y=new F(l,o,c,d);return w=>y.solve(w)}let we=le(.25,.1,.25,1);function Le(l,o,c){return Math.min(c,Math.max(o,l))}function Oe(l,o,c){let d=c-o,y=((l-o)%d+d)%d+o;return y===o?c:y}function ze(l,...o){for(let c of o)for(let d in c)l[d]=c[d];return l}let Xe=1;function Ke(l,o,c){let d={};for(let y in l)d[y]=o.call(this,l[y],y,l);return d}function rt(l,o,c){let d={};for(let y in l)o.call(this,l[y],y,l)&&(d[y]=l[y]);return d}function at(l){return Array.isArray(l)?l.map(at):typeof l=="object"&&l?Ke(l,at):l}let $t={};function Tt(l){$t[l]||(typeof console<"u"&&console.warn(l),$t[l]=!0)}function Lt(l,o,c){return(c.y-l.y)*(o.x-l.x)>(o.y-l.y)*(c.x-l.x)}function Di(l){return typeof WorkerGlobalScope<"u"&&l!==void 0&&l instanceof WorkerGlobalScope}let mn=null;function Bt(l){return typeof ImageBitmap<"u"&&l instanceof ImageBitmap}let oi="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Si(l,o,c,d,y){return r(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let w=new VideoFrame(l,{timestamp:0});try{let S=w?.format;if(!S||!S.startsWith("BGR")&&!S.startsWith("RGB"))throw new Error(`Unrecognized format ${S}`);let C=S.startsWith("BGR"),E=new Uint8ClampedArray(d*y*4);if(yield w.copyTo(E,function(D,z,B,$,H){let K=4*Math.max(-z,0),Z=(Math.max(0,B)-B)*$*4+K,se=4*$,ce=Math.max(0,z),Ce=Math.max(0,B);return{rect:{x:ce,y:Ce,width:Math.min(D.width,z+$)-ce,height:Math.min(D.height,B+H)-Ce},layout:[{offset:Z,stride:se}]}}(l,o,c,d,y)),C)for(let D=0;D<E.length;D+=4){let z=E[D];E[D]=E[D+2],E[D+2]=z}return E}finally{w.close()}})}let Gi,Jt,Fn="AbortError";function Ms(){return new Error(Fn)}let mr={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function vn(l){return mr.REGISTERED_PROTOCOLS[l.substring(0,l.indexOf("://"))]}
20let Wn="global-dispatcher";class In extends Error{constructor(o,c,d,y){super(`AJAXError: ${c} (${o}): ${d}`),this.status=o,this.statusText=c,this.url=d,this.body=y}}let ln=()=>Di(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,As=function(l,o){if(/:\/\//.test(l.url)&&!/^https?:|^file:/.test(l.url)){let d=vn(l.url);if(d)return d(l,o);if(Di(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:l,targetMapId:Wn},o)}if(!(/^file:/.test(c=l.url)||/^file:/.test(ln())&&!/^\w+:/.test(c))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(d,y){return r(this,void 0,void 0,function*(){let w=new Request(d.url,{method:d.method||"GET",body:d.body,credentials:d.credentials,headers:d.headers,cache:d.cache,referrer:ln(),signal:y.signal});d.type!=="json"||w.headers.has("Accept")||w.headers.set("Accept","application/json");let S=yield fetch(w);if(!S.ok){let D=yield S.blob();throw new In(S.status,S.statusText,d.url,D)}let C;C=d.type==="arrayBuffer"||d.type==="image"?S.arrayBuffer():d.type==="json"?S.json():S.text();let E=yield C;if(y.signal.aborted)throw Ms();return{data:E,cacheControl:S.headers.get("Cache-Control"),expires:S.headers.get("Expires")}})}(l,o);if(Di(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:l,mustQueue:!0,targetMapId:Wn},o)}var c;return function(d,y){return new Promise((w,S)=>{var C;let E=new XMLHttpRequest;E.open(d.method||"GET",d.url,!0),d.type!=="arrayBuffer"&&d.type!=="image"||(E.responseType="arraybuffer");for(let D in d.headers)E.setRequestHeader(D,d.headers[D]);d.type==="json"&&(E.responseType="text",!((C=d.headers)===null||C===void 0)&&C.Accept||E.setRequestHeader("Accept","application/json")),E.withCredentials=d.credentials==="include",E.onerror=()=>{S(new Error(E.statusText))},E.onload=()=>{if(!y.signal.aborted)if((E.status>=200&&E.status<300||E.status===0)&&E.response!==null){let D=E.response;if(d.type==="json")try{D=JSON.parse(E.response)}catch(z){return void S(z)}w({data:D,cacheControl:E.getResponseHeader("Cache-Control"),expires:E.getResponseHeader("Expires")})}else{let D=new Blob([E.response],{type:E.getResponseHeader("Content-Type")});S(new In(E.status,E.statusText,d.url,D))}},y.signal.addEventListener("abort",()=>{E.abort(),S(Ms())}),E.send(d.body)})}(l,o)};function oa(l){if(!l||l.indexOf("://")<=0||l.indexOf("data:image/")===0||l.indexOf("blob:")===0)return!0;let o=new URL(l),c=window.location;return o.protocol===c.protocol&&o.host===c.host}function Io(l,o,c){c[l]&&c[l].indexOf(o)!==-1||(c[l]=c[l]||[],c[l].push(o))}function Qr(l,o,c){if(c&&c[l]){let d=c[l].indexOf(o);d!==-1&&c[l].splice(d,1)}}class oo{constructor(o,c={}){ze(this,c),this.type=o}}class Bn extends oo{constructor(o,c={}){super("error",ze({error:o},c))}}class Hs{on(o,c){return this._listeners=this._listeners||{},Io(o,c,this._listeners),this}off(o,c){return Qr(o,c,this._listeners),Qr(o,c,this._oneTimeListeners),this}once(o,c){return c?(this._oneTimeListeners=this._oneTimeListeners||{},Io(o,c,this._oneTimeListeners),this):new Promise(d=>this.once(o,d))}fire(o,c){typeof o=="string"&&(o=new oo(o,c||{}));let d=o.type;if(this.listens(d)){o.target=this;let y=this._listeners&&this._listeners[d]?this._listeners[d].slice():[];for(let C of y)C.call(this,o);let w=this._oneTimeListeners&&this._oneTimeListeners[d]?this._oneTimeListeners[d].slice():[];for(let C of w)Qr(d,C,this._oneTimeListeners),C.call(this,o);let S=this._eventedParent;S&&(ze(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),S.fire(o))}else o instanceof Bn&&console.error(o.error);return this}listens(o){return this._listeners&&this._listeners[o]&&this._listeners[o].length>0||this._oneTimeListeners&&this._oneTimeListeners[o]&&this._oneTimeListeners[o].length>0||this._eventedParent&&this._eventedParent.listens(o)}setEventedParent(o,c){return this._eventedParent=o,this._eventedParentData=c,this}}var Ie={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"}
vendor: 3,574 bytes, line 20
20,bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade
vendor: 8,509 bytes, line 20
20","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}
vendor: 8,873 bytes, line 20
20,"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}
vendor: 9,824 bytes, line 20
20,"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};
vendor: 1,006 bytes, line 20
20let gr=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Ha(l,o){let c={};for(let d in l)d!=="ref"&&(c[d]=l[d]);return gr.forEach(d=>{d in o&&(c[d]=o[d])}),c}function bi(l,o){if(Array.isArray(l)){if(!Array.isArray(o)||l.length!==o.length)return!1;for(let c=0;c<l.length;c++)if(!bi(l[c],o[c]))return!1;return!0}if(typeof l=="object"&&l!==null&&o!==null){if(typeof o!="object"||Object.keys(l).length!==Object.keys(o).length)return!1;for(let c in l)if(!bi(l[c],o[c]))return!1;return!0}return l===o}function Ui(l,o){l.push(o)}function yr(l,o,c){Ui(c,{command:"addSource",args:[l,o[l]]})}function es(l,o,c){Ui(o,{command:"removeSource",args:[l]}),c[l]=!0}function ts(l,o,c,d){es(l,c,d),yr(l,o,c)}function Wa(l,o,c){let d;for(d in l[c])if(Object.prototype.hasOwnProperty.call(l[c],d)&&d!=="data"&&!bi(l[c][d],o[c][d]))return!1;for(d in o[c])if(Object.prototype.hasOwnProperty.call(o[c],d)&&d!=="data"&&!bi(l[c][d],o[c][d]))return!1;return!0}function ir(l,o,c,d,y,w){l=l||{},o=o||{};
vendor: 15,590 bytes, line 20
20for(let S in l)Object.prototype.hasOwnProperty.call(l,S)&&(bi(l[S],o[S])||c.push({command:w,args:[d,S,o[S],y]}));for(let S in o)Object.prototype.hasOwnProperty.call(o,S)&&!Object.prototype.hasOwnProperty.call(l,S)&&(bi(l[S],o[S])||c.push({command:w,args:[d,S,o[S],y]}))}function Vl(l){return l.id}function ao(l,o){return l[o.id]=o,l}class Ge{constructor(o,c,d,y){this.message=(o?`${o}: `:"")+d,y&&(this.identifier=y),c!=null&&c.__line__&&(this.line=c.__line__)}}function is(l,...o){for(let c of o)for(let d in c)l[d]=c[d];return l}class Gn extends Error{constructor(o,c){super(c),this.message=c,this.key=o}}class ns{constructor(o,c=[]){this.parent=o,this.bindings={};for(let[d,y]of c)this.bindings[d]=y}concat(o){return new ns(this,o)}get(o){if(this.bindings[o])return this.bindings[o];if(this.parent)return this.parent.get(o);throw new Error(`${o} not found in scope.`)}has(o){return!!this.bindings[o]||!!this.parent&&this.parent.has(o)}}let Ws={kind:"null"},et={kind:"number"},Wt={kind:"string"},Et={kind:"boolean"},nr={kind:"color"},Fr={kind:"object"},Ft={kind:"value"},Gs={kind:"collator"},lo={kind:"formatted"},co={kind:"padding"},Es={kind:"resolvedImage"},ue={kind:"variableAnchorOffsetCollection"};function q(l,o){return{kind:"array",itemType:l,N:o}}function j(l){if(l.kind==="array"){let o=j(l.itemType);return typeof l.N=="number"?`array<${o}, ${l.N}>`:l.itemType.kind==="value"?"array":`array<${o}>`}return l.kind}let ee=[Ws,et,Wt,Et,nr,lo,Fr,q(Ft),co,Es,ue];function oe(l,o){if(o.kind==="error")return null;if(l.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!oe(l.itemType,o.itemType))&&(typeof l.N!="number"||l.N===o.N))return null}else{if(l.kind===o.kind)return null;if(l.kind==="value"){for(let c of ee)if(!oe(c,o))return null}}return`Expected ${j(l)} but found ${j(o)} instead.`}function _e(l,o){return o.some(c=>c.kind===l.kind)}function Se(l,o){return o.some(c=>c==="null"?l===null:c==="array"?Array.isArray(l):c==="object"?l&&!Array.isArray(l)&&typeof l=="object":c===typeof l)}function ke(l,o){return l.kind==="array"&&o.kind==="array"?l.itemType.kind===o.itemType.kind&&typeof l.N=="number":l.kind===o.kind}let fe=.96422,Re=.82521,$e=4/29,Ee=6/29,Ye=3*Ee*Ee,xt=Ee*Ee*Ee,wt=Math.PI/180,hi=180/Math.PI;function Nt(l){return(l%=360)<0&&(l+=360),l}function di([l,o,c,d]){let y,w,S=bn((.2225045*(l=ei(l))+.7168786*(o=ei(o))+.0606169*(c=ei(c)))/1);l===o&&o===c?y=w=S:(y=bn((.4360747*l+.3850649*o+.1430804*c)/fe),w=bn((.0139322*l+.0971045*o+.7141733*c)/Re));let C=116*S-16;return[C<0?0:C,500*(y-S),200*(S-w),d]}function ei(l){return l<=.04045?l/12.92:Math.pow((l+.055)/1.055,2.4)}function bn(l){return l>xt?Math.pow(l,1/3):l/Ye+$e}function cn([l,o,c,d]){let y=(l+16)/116,w=isNaN(o)?y:y+o/500,S=isNaN(c)?y:y-c/200;return y=1*Ei(y),w=fe*Ei(w),S=Re*Ei(S),[Gt(3.1338561*w-1.6168667*y-.4906146*S),Gt(-.9787684*w+1.9161415*y+.033454*S),Gt(.0719453*w-.2289914*y+1.4052427*S),d]}function Gt(l){return(l=l<=.00304?12.92*l:1.055*Math.pow(l,1/2.4)-.055)<0?0:l>1?1:l}function Ei(l){return l>Ee?l*l*l:Ye*(l-$e)}function Ji(l){return parseInt(l.padEnd(2,l),16)/255}function Nn(l,o){return Zn(o?l/100:l,0,1)}function Zn(l,o,c){return Math.min(Math.max(o,l),c)}function Vn(l){return!l.some(Number.isNaN)}let Ga={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class xi{constructor(o,c,d,y=1,w=!0){this.r=o,this.g=c,this.b=d,this.a=y,w||(this.r*=y,this.g*=y,this.b*=y,y||this.overwriteGetter("rgb",[o,c,d,y]))}static parse(o){if(o instanceof xi)return o;if(typeof o!="string")return;let c=function(d){if((d=d.toLowerCase().trim())==="transparent")return[0,0,0,0];let y=Ga[d];if(y){let[S,C,E]=y;return[S/255,C/255,E/255,1]}if(d.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(d)){let S=d.length<6?1:2,C=1;return[Ji(d.slice(C,C+=S)),Ji(d.slice(C,C+=S)),Ji(d.slice(C,C+=S)),Ji(d.slice(C,C+S)||"ff")]}if(d.startsWith("rgb")){let S=d.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(S){let[C,E,D,z,B,$,H,K,Z,se,ce,Ce]=S,ge=[z||" ",H||" ",se].join("");if(ge==="  "||ge==="  /"||ge===",,"||ge===",,,"){let ye=[D,$,Z].join(""),Pe=ye==="%%%"?100:ye===""?255:0;if(Pe){let qe=[Zn(+E/Pe,0,1),Zn(+B/Pe,0,1),Zn(+K/Pe,0,1),ce?Nn(+ce,Ce):1];if(Vn(qe))return qe}}return}}let w=d.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(w){let[S,C,E,D,z,B,$,H,K]=w,Z=[E||" ",z||" ",$].join("");if(Z==="  "||Z==="  /"||Z===",,"||Z===",,,"){let se=[+C,Zn(+D,0,100),Zn(+B,0,100),H?Nn(+H,K):1];if(Vn(se))return function([ce,Ce,ge,ye]){function Pe(qe){let lt=(qe+ce/30)%12,kt=Ce*Math.min(ge,1-ge);return ge-kt*Math.max(-1,Math.min(lt-3,9-lt,1))}return ce=Nt(ce),Ce/=100,ge/=100,[Pe(0),Pe(8),Pe(4),ye]}(se)}}}(o);return c?new xi(...c,!1):void 0}get rgb(){let{r:o,g:c,b:d,a:y}=this,w=y||1/0;return this.overwriteGetter("rgb",[o/w,c/w,d/w,y])}get hcl(){return this.overwriteGetter("hcl",function(o){let[c,d,y,w]=di(o),S=Math.sqrt(d*d+y*y);return[Math.round(1e4*S)?Nt(Math.atan2(y,d)*hi):NaN,S,c,w]}(this.rgb))}get lab(){return this.overwriteGetter("lab",di(this.rgb))}overwriteGetter(o,c){return Object.defineProperty(this,o,{value:c}),c}toString(){let[o,c,d,y]=this.rgb;return`rgba(${[o,c,d].map(w=>Math.round(255*w)).join(",")},${y})`}}xi.black=new xi(0,0,0,1),xi.white=new xi(1,1,1,1),xi.transparent=new xi(0,0,0,0),xi.red=new xi(1,0,0,1);class Gu{constructor(o,c,d){this.sensitivity=o?c?"variant":"case":c?"accent":"base",this.locale=d,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(o,c){return this.collator.compare(o,c)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Zu{constructor(o,c,d,y,w){this.text=o,this.image=c,this.scale=d,this.fontStack=y,this.textColor=w}}class Br{constructor(o){this.sections=o}static fromString(o){return new Br([new Zu(o,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(o=>o.text.length!==0||o.image&&o.image.name.length!==0)}static factory(o){return o instanceof Br?o:Br.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class Cr{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof Cr)return o;if(typeof o=="number")return new Cr([o,o,o,o]);if(Array.isArray(o)&&!(o.length<1||o.length>4)){for(let c of o)if(typeof c!="number")return;switch(o.length){case 1:o=[o[0],o[0],o[0],o[0]];break;case 2:o=[o[0],o[1],o[0],o[1]];break;case 3:o=[o[0],o[1],o[2],o[1]]}return new Cr(o)}}toString(){return JSON.stringify(this.values)}}let Id=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Nr{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof Nr)return o;if(Array.isArray(o)&&!(o.length<1)&&o.length%2==0){for(let c=0;c<o.length;c+=2){let d=o[c],y=o[c+1];if(typeof d!="string"||!Id.has(d)||!Array.isArray(y)||y.length!==2||typeof y[0]!="number"||typeof y[1]!="number")return}return new Nr(o)}}toString(){return JSON.stringify(this.values)}}class Vr{constructor(o){this.name=o.name,this.available=o.available}toString(){return this.name}static fromString(o){return o?new Vr({name:o,available:!1}):null}}function Za(l,o,c,d){return typeof l=="number"&&l>=0&&l<=255&&typeof o=="number"&&o>=0&&o<=255&&typeof c=="number"&&c>=0&&c<=255?d===void 0||typeof d=="number"&&d>=0&&d<=1?null:`Invalid rgba value [${[l,o,c,d].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof d=="number"?[l,o,c,d]:[l,o,c]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function aa(l){if(l===null||typeof l=="string"||typeof l=="boolean"||typeof l=="number"||l instanceof xi||l instanceof Gu||l instanceof Br||l instanceof Cr||l instanceof Nr||l instanceof Vr)return!0;if(Array.isArray(l)){for(let o of l)if(!aa(o))return!1;return!0}if(typeof l=="object"){for(let o in l)if(!aa(l[o]))return!1;return!0}return!1}function Tn(l){if(l===null)return Ws;if(typeof l=="string")return Wt;if(typeof l=="boolean")return Et;if(typeof l=="number")return et;if(l instanceof xi)return nr;if(l instanceof Gu)return Gs;if(l instanceof Br)return lo;if(l instanceof Cr)return co;if(l instanceof Nr)return ue;if(l instanceof Vr)return Es;if(Array.isArray(l)){let o=l.length,c;for(let d of l){let y=Tn(d);if(c){if(c===y)continue;c=Ft;break}c=y}return q(c||Ft,o)}return Fr}function Ka(l){let o=typeof l;return l===null?"":o==="string"||o==="number"||o==="boolean"?String(l):l instanceof xi||l instanceof Br||l instanceof Cr||l instanceof Nr||l instanceof Vr?l.toString():JSON.stringify(l)}class rs{constructor(o,c){this.type=o,this.value=c}static parse(o,c){if(o.length!==2)return c.error(`'literal' expression requires exactly one argument, but found ${o.length-1} instead.`);if(!aa(o[1]))return c.error("invalid value");let d=o[1],y=Tn(d),w=c.expectedType;return y.kind!=="array"||y.N!==0||!w||w.kind!=="array"||typeof w.N=="number"&&w.N!==0||(y=w),new rs(y,d)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class gn{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}let Xa={string:Wt,number:et,boolean:Et,object:Fr};class Is{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");let d,y=1,w=o[0];if(w==="array"){let C,E;if(o.length>2){let D=o[1];if(typeof D!="string"||!(D in Xa)||D==="object")return c.error('The item type argument of "array" must be one of string, number, boolean',1);C=Xa[D],y++}else C=Ft;if(o.length>3){if(o[2]!==null&&(typeof o[2]!="number"||o[2]<0||o[2]!==Math.floor(o[2])))return c.error('The length argument to "array" must be a positive integer literal',2);E=o[2],y++}d=q(C,E)}else{if(!Xa[w])throw new Error(`Types doesn't contain name = ${w}`);d=Xa[w]}let S=[];for(;y<o.length;y++){let C=c.parse(o[y],y,Ft);if(!C)return null;S.push(C)}return new Is(d,S)}evaluate(o){for(let c=0;c<this.args.length;c++){let d=this.args[c].evaluate(o);if(!oe(this.type,Tn(d)))return d;if(c===this.args.length-1)throw new gn(`Expected value to be of type ${j(this.type)}, but found ${j(Tn(d))} instead.`)}throw new Error}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}let Nc={"to-boolean":Et,"to-color":nr,"to-number":et,"to-string":Wt};class Mr{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");let d=o[0];if(!Nc[d])throw new Error(`Can't parse ${d} as it is not part of the known types`);if((d==="to-boolean"||d==="to-string")&&o.length!==2)return c.error("Expected one argument.");let y=Nc[d],w=[];for(let S=1;S<o.length;S++){let C=c.parse(o[S],S,Ft);if(!C)return null;w.push(C)}return new Mr(y,w)}evaluate(o){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(o);case"color":{let c,d;for(let y of this.args){if(c=y.evaluate(o),d=null,c instanceof xi)return c;if(typeof c=="string"){let w=o.parseColor(c);if(w)return w}else if(Array.isArray(c)&&(d=c.length<3||c.length>4?`Invalid rbga value ${JSON.stringify(c)}: expected an array containing either three or four numeric values.`:Za(c[0],c[1],c[2],c[3]),!d))return new xi(c[0]/255,c[1]/255,c[2]/255,c[3])}throw new gn(d||`Could not parse color from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"padding":{let c;for(let d of this.args){c=d.evaluate(o);let y=Cr.parse(c);if(y)return y}throw new gn(`Could not parse padding from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"variableAnchorOffsetCollection":{let c;for(let d of this.args){c=d.evaluate(o);let y=Nr.parse(c);if(y)return y}throw new gn(`Could not parse variableAnchorOffsetCollection from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"number":{let c=null;for(let d of this.args){if(c=d.evaluate(o),c===null)return 0;let y=Number(c);if(!isNaN(y))return y}throw new gn(`Could not convert ${JSON.stringify(c)} to number.`)}case"formatted":return Br.fromString(Ka(this.args[0].evaluate(o)));case"resolvedImage":return Vr.fromString(Ka(this.args[0].evaluate(o)));default:return Ka(this.args[0].evaluate(o))}}
20eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}let Ld=["Unknown","Point","LineString","Polygon"];class Vc{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Ld[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(o){let c=this._parseColorCache[o];return c||(c=this._parseColorCache[o]=xi.parse(o)),c}}class Lo{constructor(o,c,d=[],y,w=new ns,S=[]){this.registry=o,this.path=d,this.key=d.map(C=>`[${C}]`).join(""),this.scope=w,this.errors=S,this.expectedType=y,this._isConstant=c}parse(o,c,d,y,w={}){return c?this.concat(c,d,y)._parse(o,w):this._parse(o,w)}_parse(o,c){function d(y,w,S){return S==="assert"?new Is(w,[y]):S==="coerce"?new Mr(w,[y]):y}if(o!==null&&typeof o!="string"&&typeof o!="boolean"&&typeof o!="number"||(o=["literal",o]),Array.isArray(o)){if(o.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let y=o[0];if(typeof y!="string")return this.error(`Expression name must be a string, but found ${typeof y} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let w=this.registry[y];if(w){let S=w.parse(o,this);if(!S)return null;if(this.expectedType){let C=this.expectedType,E=S.type;if(C.kind!=="string"&&C.kind!=="number"&&C.kind!=="boolean"&&C.kind!=="object"&&C.kind!=="array"||E.kind!=="value")if(C.kind!=="color"&&C.kind!=="formatted"&&C.kind!=="resolvedImage"||E.kind!=="value"&&E.kind!=="string")if(C.kind!=="padding"||E.kind!=="value"&&E.kind!=="number"&&E.kind!=="array")if(C.kind!=="variableAnchorOffsetCollection"||E.kind!=="value"&&E.kind!=="array"){if(this.checkSubtype(C,E))return null}else S=d(S,C,c.typeAnnotation||"coerce");else S=d(S,C,c.typeAnnotation||"coerce");else S=d(S,C,c.typeAnnotation||"coerce");else S=d(S,C,c.typeAnnotation||"assert")}if(!(S instanceof rs)&&S.type.kind!=="resolvedImage"&&this._isConstant(S)){let C=new Vc;try{S=new rs(S.type,S.evaluate(C))}catch(E){return this.error(E.message),null}}return S}return this.error(`Unknown expression "${y}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(o===void 0?"'undefined' value invalid. Use null instead.":typeof o=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof o} instead.`)}concat(o,c,d){let y=typeof o=="number"?this.path.concat(o):this.path,w=d?this.scope.concat(d):this.scope;return new Lo(this.registry,this._isConstant,y,c||null,w,this.errors)}error(o,...c){let d=`${this.key}${c.map(y=>`[${y}]`).join("")}`;this.errors.push(new Gn(d,o))}checkSubtype(o,c){let d=oe(o,c);return d&&this.error(d),d}}class uo{constructor(o,c){this.type=c.type,this.bindings=[].concat(o),this.result=c}evaluate(o){return this.result.evaluate(o)}eachChild(o){for(let c of this.bindings)o(c[1]);o(this.result)}static parse(o,c){if(o.length<4)return c.error(`Expected at least 3 arguments, but found ${o.length-1} instead.`);let d=[];for(let w=1;w<o.length-1;w+=2){let S=o[w];if(typeof S!="string")return c.error(`Expected string, but found ${typeof S} instead.`,w);if(/[^a-zA-Z0-9_]/.test(S))return c.error("Variable names must contain only alphanumeric characters or '_'.",w);let C=c.parse(o[w+1],w+1);if(!C)return null;d.push([S,C])}let y=c.parse(o[o.length-1],o.length-1,c.expectedType,d);return y?new uo(d,y):null}outputDefined(){return this.result.outputDefined()}}class pi{constructor(o,c){this.type=c.type,this.name=o,this.boundExpression=c}
vendor: 8,899 bytes, line 20
20static parse(o,c){if(o.length!==2||typeof o[1]!="string")return c.error("'var' expression requires exactly one string literal argument.");let d=o[1];return c.scope.has(d)?new pi(d,c.scope.get(d)):c.error(`Unknown variable "${d}". Make sure "${d}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(o){return this.boundExpression.evaluate(o)}eachChild(){}outputDefined(){return!1}}class Ku{constructor(o,c,d){this.type=o,this.index=c,this.input=d}static parse(o,c){if(o.length!==3)return c.error(`Expected 2 arguments, but found ${o.length-1} instead.`);let d=c.parse(o[1],1,et),y=c.parse(o[2],2,q(c.expectedType||Ft));return d&&y?new Ku(y.type.itemType,d,y):null}evaluate(o){let c=this.index.evaluate(o),d=this.input.evaluate(o);if(c<0)throw new gn(`Array index out of bounds: ${c} < 0.`);if(c>=d.length)throw new gn(`Array index out of bounds: ${c} > ${d.length-1}.`);if(c!==Math.floor(c))throw new gn(`Array index must be an integer, but found ${c} instead.`);return d[c]}eachChild(o){o(this.index),o(this.input)}outputDefined(){return!1}}class $c{constructor(o,c){this.type=Et,this.needle=o,this.haystack=c}static parse(o,c){if(o.length!==3)return c.error(`Expected 2 arguments, but found ${o.length-1} instead.`);let d=c.parse(o[1],1,Ft),y=c.parse(o[2],2,Ft);return d&&y?_e(d.type,[Et,Wt,et,Ws,Ft])?new $c(d,y):c.error(`Expected first argument to be of type boolean, string, number or null, but found ${j(d.type)} instead`):null}evaluate(o){let c=this.needle.evaluate(o),d=this.haystack.evaluate(o);if(!d)return!1;if(!Se(c,["boolean","string","number","null"]))throw new gn(`Expected first argument to be of type boolean, string, number or null, but found ${j(Tn(c))} instead.`);if(!Se(d,["string","array"]))throw new gn(`Expected second argument to be of type array or string, but found ${j(Tn(d))} instead.`);return d.indexOf(c)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class Po{constructor(o,c,d){this.type=et,this.needle=o,this.haystack=c,this.fromIndex=d}static parse(o,c){if(o.length<=2||o.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);let d=c.parse(o[1],1,Ft),y=c.parse(o[2],2,Ft);if(!d||!y)return null;if(!_e(d.type,[Et,Wt,et,Ws,Ft]))return c.error(`Expected first argument to be of type boolean, string, number or null, but found ${j(d.type)} instead`);if(o.length===4){let w=c.parse(o[3],3,et);return w?new Po(d,y,w):null}return new Po(d,y)}evaluate(o){let c=this.needle.evaluate(o),d=this.haystack.evaluate(o);if(!Se(c,["boolean","string","number","null"]))throw new gn(`Expected first argument to be of type boolean, string, number or null, but found ${j(Tn(c))} instead.`);let y;if(this.fromIndex&&(y=this.fromIndex.evaluate(o)),Se(d,["string"])){let w=d.indexOf(c,y);return w===-1?-1:[...d.slice(0,w)].length}if(Se(d,["array"]))return d.indexOf(c,y);throw new gn(`Expected second argument to be of type array or string, but found ${j(Tn(d))} instead.`)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class $l{constructor(o,c,d,y,w,S){this.inputType=o,this.type=c,this.input=d,this.cases=y,this.outputs=w,this.otherwise=S}static parse(o,c){if(o.length<5)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if(o.length%2!=1)return c.error("Expected an even number of arguments.");let d,y;c.expectedType&&c.expectedType.kind!=="value"&&(y=c.expectedType);let w={},S=[];for(let D=2;D<o.length-1;D+=2){let z=o[D],B=o[D+1];Array.isArray(z)||(z=[z]);let $=c.concat(D);if(z.length===0)return $.error("Expected at least one branch label.");for(let K of z){if(typeof K!="number"&&typeof K!="string")return $.error("Branch labels must be numbers or strings.");if(typeof K=="number"&&Math.abs(K)>Number.MAX_SAFE_INTEGER)return $.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof K=="number"&&Math.floor(K)!==K)return $.error("Numeric branch labels must be integer values.");if(d){if($.checkSubtype(d,Tn(K)))return null}else d=Tn(K);if(w[String(K)]!==void 0)return $.error("Branch labels must be unique.");w[String(K)]=S.length}let H=c.parse(B,D,y);if(!H)return null;y=y||H.type,S.push(H)}let C=c.parse(o[1],1,Ft);if(!C)return null;let E=c.parse(o[o.length-1],o.length-1,y);return E?C.type.kind!=="value"&&c.concat(1).checkSubtype(d,C.type)?null:new $l(d,y,C,w,S,E):null}evaluate(o){let c=this.input.evaluate(o);return(Tn(c)===this.inputType&&this.outputs[this.cases[c]]||this.otherwise).evaluate(o)}eachChild(o){o(this.input),this.outputs.forEach(o),o(this.otherwise)}outputDefined(){return this.outputs.every(o=>o.outputDefined())&&this.otherwise.outputDefined()}}class ho{constructor(o,c,d){this.type=o,this.branches=c,this.otherwise=d}static parse(o,c){if(o.length<4)return c.error(`Expected at least 3 arguments, but found only ${o.length-1}.`);if(o.length%2!=0)return c.error("Expected an odd number of arguments.");let d;c.expectedType&&c.expectedType.kind!=="value"&&(d=c.expectedType);let y=[];for(let S=1;S<o.length-1;S+=2){let C=c.parse(o[S],S,Et);if(!C)return null;let E=c.parse(o[S+1],S+1,d);if(!E)return null;y.push([C,E]),d=d||E.type}let w=c.parse(o[o.length-1],o.length-1,d);if(!w)return null;if(!d)throw new Error("Can't infer output type");return new ho(d,y,w)}evaluate(o){for(let[c,d]of this.branches)if(c.evaluate(o))return d.evaluate(o);return this.otherwise.evaluate(o)}eachChild(o){for(let[c,d]of this.branches)o(c),o(d);o(this.otherwise)}outputDefined(){return this.branches.every(([o,c])=>c.outputDefined())&&this.otherwise.outputDefined()}}class Ya{constructor(o,c,d,y){this.type=o,this.input=c,this.beginIndex=d,this.endIndex=y}static parse(o,c){if(o.length<=2||o.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);let d=c.parse(o[1],1,Ft),y=c.parse(o[2],2,et);if(!d||!y)return null;if(!_e(d.type,[q(Ft),Wt,Ft]))return c.error(`Expected first argument to be of type array or string, but found ${j(d.type)} instead`);if(o.length===4){let w=c.parse(o[3],3,et);return w?new Ya(d.type,d,y,w):null}return new Ya(d.type,d,y)}evaluate(o){let c=this.input.evaluate(o),d=this.beginIndex.evaluate(o),y;if(this.endIndex&&(y=this.endIndex.evaluate(o)),Se(c,["string"]))return[...c].slice(d,y).join("");if(Se(c,["array"]))return c.slice(d,y);throw new gn(`Expected first argument to be of type array or string, but found ${j(Tn(c))} instead.`)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function Ul(l,o){let c=l.length-1,d,y,w=0,S=c,C=0;for(;w<=S;)if(C=Math.floor((w+S)/2),d=l[C],y=l[C+1],d<=o){if(C===c||o<y)return C;w=C+1}else{if(!(d>o))throw new gn("Input is not a number.");S=C-1}return 0}class Ja{constructor(o,c,d){this.type=o,this.input=c,this.labels=[],this.outputs=[];for(let[y,w]of d)this.labels.push(y),this.outputs.push(w)}static parse(o,c){if(o.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return c.error("Expected an even number of arguments.");let d=c.parse(o[1],1,et);if(!d)return null;let y=[],w=null;c.expectedType&&c.expectedType.kind!=="value"&&(w=c.expectedType);for(let S=1;S<o.length;S+=2){let C=S===1?-1/0:o[S],E=o[S+1],D=S,z=S+1;if(typeof C!="number")return c.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',D);if(y.length&&y[y.length-1][0]>=C)return c.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',D);let B=c.parse(E,z,w);if(!B)return null;w=w||B.type,y.push([C,B])}return new Ja(w,d,y)}evaluate(o){let c=this.labels,d=this.outputs;if(c.length===1)return d[0].evaluate(o);let y=this.input.evaluate(o);if(y<=c[0])return d[0].evaluate(o);let w=c.length;return y>=c[w-1]?d[w-1].evaluate(o):d[Ul(c,y)].evaluate(o)}eachChild(o){o(this.input);for(let c of this.outputs)o(c)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Xu(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Pd=Yu;function Yu(l,o,c,d){this.cx=3*l,this.bx=3*(c-l)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(d-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=l,this.p1y=o,this.p2x=c,this.p2y=d}Yu.prototype={sampleCurveX:function(l){return((this.ax*l+this.bx)*l+this.cx)*l},sampleCurveY:function(l){return((this.ay*l+this.by)*l+this.cy)*l},sampleCurveDerivativeX:function(l){return(3*this.ax*l+2*this.bx)*l+this.cx},solveCurveX:function(l,o){if(o===void 0&&(o=1e-6),l<0)return 0;if(l>1)return 1;for(var c=l,d=0;d<8;d++){var y=this.sampleCurveX(c)-l;if(Math.abs(y)<o)return c;var w=this.sampleCurveDerivativeX(c);if(Math.abs(w)<1e-6)break;c-=y/w}var S=0,C=1;for(c=l,d=0;d<20&&(y=this.sampleCurveX(c),!(Math.abs(y-l)<o));d++)l>y?S=c:C=c,c=.5*(C-S)+S;return c}
20,solve:function(l,o){return this.sampleCurveY(this.solveCurveX(l,o))}};var Dd=Xu(Pd);function la(l,o,c){return l+c*(o-l)}function jl(l,o,c){return l.map((d,y)=>la(d,o[y],c))}let Ar={number:la,color:function(l,o,c,d="rgb"){switch(d){case"rgb":{let[y,w,S,C]=jl(l.rgb,o.rgb,c);return new xi(y,w,S,C,!1)}case"hcl":{let[y,w,S,C]=l.hcl,[E,D,z,B]=o.hcl,$,H;if(isNaN(y)||isNaN(E))isNaN(y)?isNaN(E)?$=NaN:($=E,S!==1&&S!==0||(H=D)):($=y,z!==1&&z!==0||(H=w));else{let Ce=E-y;E>y&&Ce>180?Ce-=360:E<y&&y-E>180&&(Ce+=360),$=y+c*Ce}let[K,Z,se,ce]=function([Ce,ge,ye,Pe]){return Ce=isNaN(Ce)?0:Ce*wt,cn([ye,Math.cos(Ce)*ge,Math.sin(Ce)*ge,Pe])}([$,H??la(w,D,c),la(S,z,c),la(C,B,c)]);return new xi(K,Z,se,ce,!1)}case"lab":{let[y,w,S,C]=cn(jl(l.lab,o.lab,c));return new xi(y,w,S,C,!1)}}},array:jl,padding:function(l,o,c){return new Cr(jl(l.values,o.values,c))},variableAnchorOffsetCollection:function(l,o,c){let d=l.values,y=o.values;if(d.length!==y.length)throw new gn(`Cannot interpolate values of different length. from: ${l.toString()}, to: ${o.toString()}`);let w=[];for(let S=0;S<d.length;S+=2){if(d[S]!==y[S])throw new gn(`Cannot interpolate values containing mismatched anchors. from[${S}]: ${d[S]}, to[${S}]: ${y[S]}`);w.push(d[S]);let[C,E]=d[S+1],[D,z]=y[S+1];w.push([la(C,D,c),la(E,z,c)])}return new Nr(w)}};class _r{constructor(o,c,d,y,w){this.type=o,this.operator=c,this.interpolation=d,this.input=y,this.labels=[],this.outputs=[];for(let[S,C]of w)this.labels.push(S),this.outputs.push(C)}static interpolationFactor(o,c,d,y){let w=0;if(o.name==="exponential")w=Uc(c,o.base,d,y);else if(o.name==="linear")w=Uc(c,1,d,y);else if(o.name==="cubic-bezier"){let S=o.controlPoints;w=new Dd(S[0],S[1],S[2],S[3]).solve(Uc(c,1,d,y))}return w}static parse(o,c){let[d,y,w,...S]=o;if(!Array.isArray(y)||y.length===0)return c.error("Expected an interpolation type expression.",1);if(y[0]==="linear")y={name:"linear"};else if(y[0]==="exponential"){let D=y[1];if(typeof D!="number")return c.error("Exponential interpolation requires a numeric base.",1,1);y={name:"exponential",base:D}}else{if(y[0]!=="cubic-bezier")return c.error(`Unknown interpolation type ${String(y[0])}`,1,0);{let D=y.slice(1);if(D.length!==4||D.some(z=>typeof z!="number"||z<0||z>1))return c.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);y={name:"cubic-bezier",controlPoints:D}}}if(o.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return c.error("Expected an even number of arguments.");if(w=c.parse(w,2,et),!w)return null;let C=[],E=null;d==="interpolate-hcl"||d==="interpolate-lab"?E=nr:c.expectedType&&c.expectedType.kind!=="value"&&(E=c.expectedType);for(let D=0;D<S.length;D+=2){let z=S[D],B=S[D+1],$=D+3,H=D+4;if(typeof z!="number")return c.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',$);if(C.length&&C[C.length-1][0]>=z)return c.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',$);let K=c.parse(B,H,E);if(!K)return null;E=E||K.type,C.push([z,K])}return ke(E,et)||ke(E,nr)||ke(E,co)||ke(E,ue)||ke(E,q(et))?new _r(E,d,y,w,C):c.error(`Type ${j(E)} is not interpolatable.`)}evaluate(o){let c=this.labels,d=this.outputs;if(c.length===1)return d[0].evaluate(o);let y=this.input.evaluate(o);if(y<=c[0])return d[0].evaluate(o);let w=c.length;if(y>=c[w-1])return d[w-1].evaluate(o);let S=Ul(c,y),C=_r.interpolationFactor(this.interpolation,y,c[S],c[S+1]),E=d[S].evaluate(o),D=d[S+1].evaluate(o);switch(this.operator){case"interpolate":return Ar[this.type.kind](E,D,C);case"interpolate-hcl":return Ar.color(E,D,C,"hcl");case"interpolate-lab":return Ar.color(E,D,C,"lab")}}eachChild(o){o(this.input);for(let c of this.outputs)o(c)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Uc(l,o,c,d){let y=d-c,w=l-c;return y===0?0:o===1?w/y:(Math.pow(o,w)-1)/(Math.pow(o,y)-1)}class jc{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expectected at least one argument.");let d=null,y=c.expectedType;y&&y.kind!=="value"&&(d=y);let w=[];for(let C of o.slice(1)){let E=c.parse(C,1+w.length,d,void 0,{typeAnnotation:"omit"});if(!E)return null;d=d||E.type,w.push(E)}if(!d)throw new Error("No output type");let S=y&&w.some(C=>oe(y,C.type));return new jc(S?Ft:d,w)}evaluate(o){let c,d=null,y=0;for(let w of this.args)if(y++,d=w.evaluate(o),d&&d instanceof Vr&&!d.available&&(c||(c=d.name),d=null,y===this.args.length&&(d=c)),d!==null)break;return d}
vendor: 15,942 bytes, line 20
20eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}function qc(l,o){return l==="=="||l==="!="?o.kind==="boolean"||o.kind==="string"||o.kind==="number"||o.kind==="null"||o.kind==="value":o.kind==="string"||o.kind==="number"||o.kind==="value"}function Rd(l,o,c,d){return d.compare(o,c)===0}function Do(l,o,c){let d=l!=="=="&&l!=="!=";return class OT{constructor(w,S,C){this.type=Et,this.lhs=w,this.rhs=S,this.collator=C,this.hasUntypedArgument=w.type.kind==="value"||S.type.kind==="value"}static parse(w,S){if(w.length!==3&&w.length!==4)return S.error("Expected two or three arguments.");let C=w[0],E=S.parse(w[1],1,Ft);if(!E)return null;if(!qc(C,E.type))return S.concat(1).error(`"${C}" comparisons are not supported for type '${j(E.type)}'.`);let D=S.parse(w[2],2,Ft);if(!D)return null;if(!qc(C,D.type))return S.concat(2).error(`"${C}" comparisons are not supported for type '${j(D.type)}'.`);if(E.type.kind!==D.type.kind&&E.type.kind!=="value"&&D.type.kind!=="value")return S.error(`Cannot compare types '${j(E.type)}' and '${j(D.type)}'.`);d&&(E.type.kind==="value"&&D.type.kind!=="value"?E=new Is(D.type,[E]):E.type.kind!=="value"&&D.type.kind==="value"&&(D=new Is(E.type,[D])));let z=null;if(w.length===4){if(E.type.kind!=="string"&&D.type.kind!=="string"&&E.type.kind!=="value"&&D.type.kind!=="value")return S.error("Cannot use collator to compare non-string types.");if(z=S.parse(w[3],3,Gs),!z)return null}return new OT(E,D,z)}evaluate(w){let S=this.lhs.evaluate(w),C=this.rhs.evaluate(w);if(d&&this.hasUntypedArgument){let E=Tn(S),D=Tn(C);if(E.kind!==D.kind||E.kind!=="string"&&E.kind!=="number")throw new gn(`Expected arguments for "${l}" to be (string, string) or (number, number), but found (${E.kind}, ${D.kind}) instead.`)}if(this.collator&&!d&&this.hasUntypedArgument){let E=Tn(S),D=Tn(C);if(E.kind!=="string"||D.kind!=="string")return o(w,S,C)}return this.collator?c(w,S,C,this.collator.evaluate(w)):o(w,S,C)}eachChild(w){w(this.lhs),w(this.rhs),this.collator&&w(this.collator)}outputDefined(){return!0}}}let _f=Do("==",function(l,o,c){return o===c},Rd),zd=Do("!=",function(l,o,c){return o!==c},function(l,o,c,d){return!Rd(0,o,c,d)}),Od=Do("<",function(l,o,c){return o<c},function(l,o,c,d){return d.compare(o,c)<0}),vf=Do(">",function(l,o,c){return o>c},function(l,o,c,d){return d.compare(o,c)>0}),bf=Do("<=",function(l,o,c){return o<=c},function(l,o,c,d){return d.compare(o,c)<=0}),Zi=Do(">=",function(l,o,c){return o>=c},function(l,o,c,d){return d.compare(o,c)>=0});class Ii{constructor(o,c,d){this.type=Gs,this.locale=d,this.caseSensitive=o,this.diacriticSensitive=c}static parse(o,c){if(o.length!==2)return c.error("Expected one argument.");let d=o[1];if(typeof d!="object"||Array.isArray(d))return c.error("Collator options argument must be an object.");let y=c.parse(d["case-sensitive"]!==void 0&&d["case-sensitive"],1,Et);if(!y)return null;let w=c.parse(d["diacritic-sensitive"]!==void 0&&d["diacritic-sensitive"],1,Et);if(!w)return null;let S=null;return d.locale&&(S=c.parse(d.locale,1,Wt),!S)?null:new Ii(y,w,S)}evaluate(o){return new Gu(this.caseSensitive.evaluate(o),this.diacriticSensitive.evaluate(o),this.locale?this.locale.evaluate(o):null)}eachChild(o){o(this.caseSensitive),o(this.diacriticSensitive),this.locale&&o(this.locale)}outputDefined(){return!1}}class Ju{constructor(o,c,d,y,w){this.type=Wt,this.number=o,this.locale=c,this.currency=d,this.minFractionDigits=y,this.maxFractionDigits=w}static parse(o,c){if(o.length!==3)return c.error("Expected two arguments.");let d=c.parse(o[1],1,et);if(!d)return null;let y=o[2];if(typeof y!="object"||Array.isArray(y))return c.error("NumberFormat options argument must be an object.");let w=null;if(y.locale&&(w=c.parse(y.locale,1,Wt),!w))return null;let S=null;if(y.currency&&(S=c.parse(y.currency,1,Wt),!S))return null;let C=null;if(y["min-fraction-digits"]&&(C=c.parse(y["min-fraction-digits"],1,et),!C))return null;let E=null;return y["max-fraction-digits"]&&(E=c.parse(y["max-fraction-digits"],1,et),!E)?null:new Ju(d,w,S,C,E)}evaluate(o){return new Intl.NumberFormat(this.locale?this.locale.evaluate(o):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(o):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(o):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(o):void 0}).format(this.number.evaluate(o))}eachChild(o){o(this.number),this.locale&&o(this.locale),this.currency&&o(this.currency),this.minFractionDigits&&o(this.minFractionDigits),this.maxFractionDigits&&o(this.maxFractionDigits)}outputDefined(){return!1}}class Hc{constructor(o){this.type=lo,this.sections=o}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");let d=o[1];if(!Array.isArray(d)&&typeof d=="object")return c.error("First argument must be an image or text section.");let y=[],w=!1;for(let S=1;S<=o.length-1;++S){let C=o[S];if(w&&typeof C=="object"&&!Array.isArray(C)){w=!1;let E=null;if(C["font-scale"]&&(E=c.parse(C["font-scale"],1,et),!E))return null;let D=null;if(C["text-font"]&&(D=c.parse(C["text-font"],1,q(Wt)),!D))return null;let z=null;if(C["text-color"]&&(z=c.parse(C["text-color"],1,nr),!z))return null;let B=y[y.length-1];B.scale=E,B.font=D,B.textColor=z}else{let E=c.parse(o[S],1,Ft);if(!E)return null;let D=E.type.kind;if(D!=="string"&&D!=="value"&&D!=="null"&&D!=="resolvedImage")return c.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");w=!0,y.push({content:E,scale:null,font:null,textColor:null})}}return new Hc(y)}evaluate(o){return new Br(this.sections.map(c=>{let d=c.content.evaluate(o);return Tn(d)===Es?new Zu("",d,null,null,null):new Zu(Ka(d),null,c.scale?c.scale.evaluate(o):null,c.font?c.font.evaluate(o).join(","):null,c.textColor?c.textColor.evaluate(o):null)}))}eachChild(o){for(let c of this.sections)o(c.content),c.scale&&o(c.scale),c.font&&o(c.font),c.textColor&&o(c.textColor)}outputDefined(){return!1}}class Qu{constructor(o){this.type=Es,this.input=o}static parse(o,c){if(o.length!==2)return c.error("Expected two arguments.");let d=c.parse(o[1],1,Wt);return d?new Qu(d):c.error("No image name provided.")}evaluate(o){let c=this.input.evaluate(o),d=Vr.fromString(c);return d&&o.availableImages&&(d.available=o.availableImages.indexOf(c)>-1),d}eachChild(o){o(this.input)}outputDefined(){return!1}}class eh{constructor(o){this.type=et,this.input=o}static parse(o,c){if(o.length!==2)return c.error(`Expected 1 argument, but found ${o.length-1} instead.`);let d=c.parse(o[1],1);return d?d.type.kind!=="array"&&d.type.kind!=="string"&&d.type.kind!=="value"?c.error(`Expected argument of type string or array, but found ${j(d.type)} instead.`):new eh(d):null}evaluate(o){let c=this.input.evaluate(o);if(typeof c=="string")return[...c].length;if(Array.isArray(c))return c.length;throw new gn(`Expected value to be of type string or array, but found ${j(Tn(c))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}let Zs=8192;function xf(l,o){let c=(180+l[0])/360,d=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l[1]*Math.PI/360)))/360,y=Math.pow(2,o.z);return[Math.round(c*y*Zs),Math.round(d*y*Zs)]}function Wc(l,o){let c=Math.pow(2,o.z);return[(y=(l[0]/Zs+o.x)/c,360*y-180),(d=(l[1]/Zs+o.y)/c,360/Math.PI*Math.atan(Math.exp((180-360*d)*Math.PI/180))-90)];var d,y}function ca(l,o){l[0]=Math.min(l[0],o[0]),l[1]=Math.min(l[1],o[1]),l[2]=Math.max(l[2],o[0]),l[3]=Math.max(l[3],o[1])}function Qi(l,o){return!(l[0]<=o[0]||l[2]>=o[2]||l[1]<=o[1]||l[3]>=o[3])}function _i(l,o,c){let d=l[0]-o[0],y=l[1]-o[1],w=l[0]-c[0],S=l[1]-c[1];return d*S-w*y==0&&d*w<=0&&y*S<=0}function Ks(l,o,c,d){return(y=[d[0]-c[0],d[1]-c[1]])[0]*(w=[o[0]-l[0],o[1]-l[1]])[1]-y[1]*w[0]!=0&&!(!ih(l,o,c,d)||!ih(c,d,l,o));var y,w}function Fd(l,o,c){for(let d of c)for(let y=0;y<d.length-1;++y)if(Ks(l,o,d[y],d[y+1]))return!0;return!1}function Ro(l,o,c=!1){let d=!1;for(let C of o)for(let E=0;E<C.length-1;E++){if(_i(l,C[E],C[E+1]))return c;(w=C[E])[1]>(y=l)[1]!=(S=C[E+1])[1]>y[1]&&y[0]<(S[0]-w[0])*(y[1]-w[1])/(S[1]-w[1])+w[0]&&(d=!d)}var y,w,S;return d}function ss(l,o){for(let c of o)if(Ro(l,c))return!0;return!1}function th(l,o){for(let c of l)if(!Ro(c,o))return!1;for(let c=0;c<l.length-1;++c)if(Fd(l[c],l[c+1],o))return!1;return!0}function Bd(l,o){for(let c of o)if(th(l,c))return!0;return!1}function ih(l,o,c,d){let y=d[0]-c[0],w=d[1]-c[1],S=(l[0]-c[0])*w-y*(l[1]-c[1]),C=(o[0]-c[0])*w-y*(o[1]-c[1]);return S>0&&C<0||S<0&&C>0}function Gc(l,o,c){let d=[];for(let y=0;y<l.length;y++){let w=[];for(let S=0;S<l[y].length;S++){let C=xf(l[y][S],c);ca(o,C),w.push(C)}d.push(w)}return d}function nh(l,o,c){let d=[];for(let y=0;y<l.length;y++){let w=Gc(l[y],o,c);d.push(w)}return d}function rh(l,o,c,d){if(l[0]<c[0]||l[0]>c[2]){let y=.5*d,w=l[0]-c[0]>y?-d:c[0]-l[0]>y?d:0;w===0&&(w=l[0]-c[2]>y?-d:c[2]-l[0]>y?d:0),l[0]+=w}ca(o,l)}function Er(l,o,c,d){let y=Math.pow(2,d.z)*Zs,w=[d.x*Zs,d.y*Zs],S=[];for(let C of l)for(let E of C){let D=[E.x+w[0],E.y+w[1]];rh(D,o,c,y),S.push(D)}return S}function Nd(l,o,c,d){let y=Math.pow(2,d.z)*Zs,w=[d.x*Zs,d.y*Zs],S=[];for(let E of l){let D=[];for(let z of E){let B=[z.x+w[0],z.y+w[1]];ca(o,B),D.push(B)}S.push(D)}if(o[2]-o[0]<=y/2){(C=o)[0]=C[1]=1/0,C[2]=C[3]=-1/0;for(let E of S)for(let D of E)rh(D,o,c,y)}var C;return S}class $n{constructor(o,c){this.type=Et,this.geojson=o,this.geometries=c}static parse(o,c){if(o.length!==2)return c.error(`'within' expression requires exactly one argument, but found ${o.length-1} instead.`);if(aa(o[1])){let d=o[1];if(d.type==="FeatureCollection"){let y=[];for(let w of d.features){let{type:S,coordinates:C}=w.geometry;S==="Polygon"&&y.push(C),S==="MultiPolygon"&&y.push(...C)}if(y.length)return new $n(d,{type:"MultiPolygon",coordinates:y})}else if(d.type==="Feature"){let y=d.geometry.type;if(y==="Polygon"||y==="MultiPolygon")return new $n(d,d.geometry)}else if(d.type==="Polygon"||d.type==="MultiPolygon")return new $n(d,d)}return c.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(o){if(o.geometry()!=null&&o.canonicalID()!=null){if(o.geometryType()==="Point")return function(c,d){let y=[1/0,1/0,-1/0,-1/0],w=[1/0,1/0,-1/0,-1/0],S=c.canonicalID();if(d.type==="Polygon"){let C=Gc(d.coordinates,w,S),E=Er(c.geometry(),y,w,S);if(!Qi(y,w))return!1;for(let D of E)if(!Ro(D,C))return!1}if(d.type==="MultiPolygon"){let C=nh(d.coordinates,w,S),E=Er(c.geometry(),y,w,S);if(!Qi(y,w))return!1;for(let D of E)if(!ss(D,C))return!1}return!0}(o,this.geometries);if(o.geometryType()==="LineString")return function(c,d){let y=[1/0,1/0,-1/0,-1/0],w=[1/0,1/0,-1/0,-1/0],S=c.canonicalID();if(d.type==="Polygon"){let C=Gc(d.coordinates,w,S),E=Nd(c.geometry(),y,w,S);if(!Qi(y,w))return!1;for(let D of E)if(!th(D,C))return!1}if(d.type==="MultiPolygon"){let C=nh(d.coordinates,w,S),E=Nd(c.geometry(),y,w,S);if(!Qi(y,w))return!1;for(let D of E)if(!Bd(D,C))return!1}return!0}(o,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Vd=class{constructor(l=[],o=(c,d)=>c<d?-1:c>d?1:0){if(this.data=l,this.length=this.data.length,this.compare=o,this.length>0)for(let c=(this.length>>1)-1;c>=0;c--)this._down(c)}push(l){this.data.push(l),this._up(this.length++)}pop(){if(this.length===0)return;let l=this.data[0],o=this.data.pop();return--this.length>0&&(this.data[0]=o,this._down(0)),l}peek(){return this.data[0]}_up(l){let{data:o,compare:c}=this,d=o[l];for(;l>0;){let y=l-1>>1,w=o[y];if(c(d,w)>=0)break;o[l]=w,l=y}o[l]=d}_down(l){let{data:o,compare:c}=this,d=this.length>>1,y=o[l];for(;l<d;){let w=1+(l<<1),S=w+1;if(S<this.length&&c(o[S],o[w])<0&&(w=S),c(o[w],y)>=0)break;o[l]=o[w],l=w}o[l]=y}};function $d(l,o,c,d,y){po(l,o,c,d||l.length-1,y||sh)}function po(l,o,c,d,y){for(;d>c;){if(d-c>600){var w=d-c+1,S=o-c+1,C=Math.log(w),E=.5*Math.exp(2*C/3),D=.5*Math.sqrt(C*E*(w-E)/w)*(S-w/2<0?-1:1);po(l,o,Math.max(c,Math.floor(o-S*E/w+D)),Math.min(d,Math.floor(o+(w-S)*E/w+D)),y)}var z=l[o],B=c,$=d;for(zo(l,c,o),y(l[d],z)>0&&zo(l,c,d);B<$;){for(zo(l,B,$),B++,$--;y(l[B],z)<0;)B++;for(;y(l[$],z)>0;)$--}y(l[c],z)===0?zo(l,c,$):zo(l,++$,d),$<=o&&(c=$+1),o<=$&&(d=$-1)}}function zo(l,o,c){var d=l[o];l[o]=l[c],l[c]=d}function sh(l,o){return l<o?-1:l>o?1:0}function ji(l,o){if(l.length<=1)return[l];let c=[],d,y;for(let w of l){let S=oh(w);S!==0&&(w.area=Math.abs(S),y===void 0&&(y=S<0),y===S<0?(d&&c.push(d),d=[w]):d.push(w))}if(d&&c.push(d),o>1)for(let w=0;w<c.length;w++)c[w].length<=o||($d(c[w],o,1,c[w].length-1,Oo),c[w]=c[w].slice(0,o));return c}function Oo(l,o){return o.area-l.area}function oh(l){let o=0;for(let c,d,y=0,w=l.length,S=w-1;y<w;S=y++)c=l[y],d=l[S],o+=(d.x-c.x)*(c.y+d.y);return o}let Ud=1/298.257223563,Zc=Ud*(2-Ud),jd=Math.PI/180;class ah{constructor(o){let c=6378.137*jd*1e3,d=Math.cos(o*jd),y=1/(1-Zc*(1-d*d)),w=Math.sqrt(y);this.kx=c*w*d,this.ky=c*w*y*(1-Zc)}distance(o,c){let d=this.wrap(o[0]-c[0])*this.kx,y=(o[1]-c[1])*this.ky;return Math.sqrt(d*d+y*y)}pointOnLine(o,c){let d,y,w,S,C=1/0;for(let E=0;E<o.length-1;E++){let D=o[E][0],z=o[E][1],B=this.wrap(o[E+1][0]-D)*this.kx,$=(o[E+1][1]-z)*this.ky,H=0;B===0&&$===0||(H=(this.wrap(c[0]-D)*this.kx*B+(c[1]-z)*this.ky*$)/(B*B+$*$),H>1?(D=o[E+1][0],z=o[E+1][1]):H>0&&(D+=B/this.kx*H,z+=$/this.ky*H)),B=this.wrap(c[0]-D)*this.kx,$=(c[1]-z)*this.ky;let K=B*B+$*$;K<C&&(C=K,d=D,y=z,w=E,S=H)}return{point:[d,y],index:w,t:Math.max(0,Math.min(1,S))}}wrap(o){for(;o<-180;)o+=360;for(;o>180;)o-=360;return o}}function qd(l,o){return o[0]-l[0]}function ql(l){return l[1]-l[0]+1}function os(l,o){return l[1]>=l[0]&&l[1]<o}function Fo(l,o){if(l[0]>l[1])return[null,null];let c=ql(l);if(o){if(c===2)return[l,null];let y=Math.floor(c/2);return[[l[0],l[0]+y],[l[0]+y,l[1]]]}if(c===1)return[l,null];let d=Math.floor(c/2)-1;return[[l[0],l[0]+d],[l[0]+d+1,l[1]]]}function lh(l,o){if(!os(o,l.length))return[1/0,1/0,-1/0,-1/0];let c=[1/0,1/0,-1/0,-1/0];for(let d=o[0];d<=o[1];++d)ca(c,l[d]);return c}function Kc(l){let o=[1/0,1/0,-1/0,-1/0];for(let c of l)for(let d of c)ca(o,d);return o}function Hl(l){return l[0]!==-1/0&&l[1]!==-1/0&&l[2]!==1/0&&l[3]!==1/0}function Wl(l,o,c){if(!Hl(l)||!Hl(o))return NaN;let d=0,y=0;return l[2]<o[0]&&(d=o[0]-l[2]),l[0]>o[2]&&(d=l[0]-o[2]),l[1]>o[3]&&(y=l[1]-o[3]),l[3]<o[1]&&(y=o[1]-l[3]),c.distance([0,0],[d,y])}function fo(l,o,c){let d=c.pointOnLine(o,l);return c.distance(l,d.point)}function Xc(l,o,c,d,y){let w=Math.min(fo(l,[c,d],y),fo(o,[c,d],y)),S=Math.min(fo(c,[l,o],y),fo(d,[l,o],y));return Math.min(w,S)}function wf(l,o,c,d,y){if(!os(o,l.length)||!os(d,c.length))return 1/0;let w=1/0;for(let S=o[0];S<o[1];++S){let C=l[S],E=l[S+1];for(let D=d[0];D<d[1];++D){let z=c[D],B=c[D+1];if(Ks(C,E,z,B))return 0;w=Math.min(w,Xc(C,E,z,B,y))}}return w}function nn(l,o,c,d,y){if(!os(o,l.length)||!os(d,c.length))return NaN;let w=1/0;for(let S=o[0];S<=o[1];++S)for(let C=d[0];C<=d[1];++C)if(w=Math.min(w,y.distance(l[S],c[C])),w===0)return w;return w}function ch(l,o,c){if(Ro(l,o,!0))return 0;let d=1/0;for(let y of o){let w=y[0],S=y[y.length-1];if(w!==S&&(d=Math.min(d,fo(l,[S,w],c)),d===0))return d;let C=c.pointOnLine(y,l);if(d=Math.min(d,c.distance(l,C.point)),d===0)return d}return d}function Zt(l,o,c,d){if(!os(o,l.length))return NaN;for(let w=o[0];w<=o[1];++w)if(Ro(l[w],c,!0))return 0;let y=1/0;for(let w=o[0];w<o[1];++w){let S=l[w],C=l[w+1];for(let E of c)for(let D=0,z=E.length,B=z-1;D<z;B=D++){let $=E[B],H=E[D];if(Ks(S,C,$,H))return 0;y=Math.min(y,Xc(S,C,$,H,d))}}return y}function Gl(l,o){for(let c of l)for(let d of c)if(Ro(d,o,!0))return!0;return!1}function ti(l,o,c,d=1/0){let y=Kc(l),w=Kc(o);if(d!==1/0&&Wl(y,w,c)>=d)return d;if(Qi(y,w)){if(Gl(l,o))return 0}else if(Gl(o,l))return 0;let S=1/0;for(let C of l)for(let E=0,D=C.length,z=D-1;E<D;z=E++){let B=C[z],$=C[E];for(let H of o)for(let K=0,Z=H.length,se=Z-1;K<Z;se=K++){let ce=H[se],Ce=H[K];if(Ks(B,$,ce,Ce))return 0;S=Math.min(S,Xc(B,$,ce,Ce,c))}}return S}function Ti(l,o,c,d,y,w){if(!w)return;
vendor: 4,176 bytes, line 20
20let S=Wl(lh(d,w),y,c);S<o&&l.push([S,w,[0,0]])}function Ls(l,o,c,d,y,w,S){if(!w||!S)return;let C=Wl(lh(d,w),lh(y,S),c);C<o&&l.push([C,w,S])}function Qa(l,o,c,d,y=1/0){let w=Math.min(d.distance(l[0],c[0][0]),y);if(w===0)return w;let S=new Vd([[0,[0,l.length-1],[0,0]]],qd),C=Kc(c);for(;S.length>0;){let E=S.pop();if(E[0]>=w)continue;let D=E[1],z=o?50:100;if(ql(D)<=z){if(!os(D,l.length))return NaN;if(o){let B=Zt(l,D,c,d);if(isNaN(B)||B===0)return B;w=Math.min(w,B)}else for(let B=D[0];B<=D[1];++B){let $=ch(l[B],c,d);if(w=Math.min(w,$),w===0)return 0}}else{let B=Fo(D,o);Ti(S,w,d,l,C,B[0]),Ti(S,w,d,l,C,B[1])}}return w}function el(l,o,c,d,y,w=1/0){let S=Math.min(w,y.distance(l[0],c[0]));if(S===0)return S;let C=new Vd([[0,[0,l.length-1],[0,c.length-1]]],qd);for(;C.length>0;){let E=C.pop();if(E[0]>=S)continue;let D=E[1],z=E[2],B=o?50:100,$=d?50:100;if(ql(D)<=B&&ql(z)<=$){if(!os(D,l.length)&&os(z,c.length))return NaN;let H;if(o&&d)H=wf(l,D,c,z,y),S=Math.min(S,H);else if(o&&!d){let K=l.slice(D[0],D[1]+1);for(let Z=z[0];Z<=z[1];++Z)if(H=fo(c[Z],K,y),S=Math.min(S,H),S===0)return S}else if(!o&&d){let K=c.slice(z[0],z[1]+1);for(let Z=D[0];Z<=D[1];++Z)if(H=fo(l[Z],K,y),S=Math.min(S,H),S===0)return S}else H=nn(l,D,c,z,y),S=Math.min(S,H)}else{let H=Fo(D,o),K=Fo(z,d);Ls(C,S,y,l,c,H[0],K[0]),Ls(C,S,y,l,c,H[0],K[1]),Ls(C,S,y,l,c,H[1],K[0]),Ls(C,S,y,l,c,H[1],K[1])}}return S}function uh(l){return l.type==="MultiPolygon"?l.coordinates.map(o=>({type:"Polygon",coordinates:o})):l.type==="MultiLineString"?l.coordinates.map(o=>({type:"LineString",coordinates:o})):l.type==="MultiPoint"?l.coordinates.map(o=>({type:"Point",coordinates:o})):[l]}class ua{constructor(o,c){this.type=et,this.geojson=o,this.geometries=c}static parse(o,c){if(o.length!==2)return c.error(`'distance' expression requires exactly one argument, but found ${o.length-1} instead.`);if(aa(o[1])){let d=o[1];if(d.type==="FeatureCollection")return new ua(d,d.features.map(y=>uh(y.geometry)).flat());if(d.type==="Feature")return new ua(d,uh(d.geometry));if("type"in d&&"coordinates"in d)return new ua(d,uh(d))}return c.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(o){if(o.geometry()!=null&&o.canonicalID()!=null){if(o.geometryType()==="Point")return function(c,d){let y=c.geometry(),w=y.flat().map(E=>Wc([E.x,E.y],c.canonical));if(y.length===0)return NaN;let S=new ah(w[0][1]),C=1/0;for(let E of d){switch(E.type){case"Point":C=Math.min(C,el(w,!1,[E.coordinates],!1,S,C));break;case"LineString":C=Math.min(C,el(w,!1,E.coordinates,!0,S,C));break;case"Polygon":C=Math.min(C,Qa(w,!1,E.coordinates,S,C))}if(C===0)return C}return C}(o,this.geometries);if(o.geometryType()==="LineString")return function(c,d){let y=c.geometry(),w=y.flat().map(E=>Wc([E.x,E.y],c.canonical));if(y.length===0)return NaN;let S=new ah(w[0][1]),C=1/0;for(let E of d){switch(E.type){case"Point":C=Math.min(C,el(w,!0,[E.coordinates],!1,S,C));break;case"LineString":C=Math.min(C,el(w,!0,E.coordinates,!0,S,C));break;case"Polygon":C=Math.min(C,Qa(w,!0,E.coordinates,S,C))}if(C===0)return C}return C}(o,this.geometries);if(o.geometryType()==="Polygon")return function(c,d){let y=c.geometry();if(y.length===0||y[0].length===0)return NaN;let w=ji(y,0).map(E=>E.map(D=>D.map(z=>Wc([z.x,z.y],c.canonical)))),S=new ah(w[0][0][0][1]),C=1/0;for(let E of d)for(let D of w){switch(E.type){case"Point":C=Math.min(C,Qa([E.coordinates],!1,D,S,C));break;case"LineString":C=Math.min(C,Qa(E.coordinates,!0,D,S,C));break;case"Polygon":C=Math.min(C,ti(D,E.coordinates,S,C))}if(C===0)return C}return C}(o,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}let tl={"==":_f,"!=":zd,">":vf,"<":Od,">=":Zi,"<=":bf,array:Is,at:Ku,boolean:Is,case:ho,coalesce:jc,collator:Ii,format:Hc,image:Qu,in:$c,"index-of":Po,interpolate:_r,"interpolate-hcl":_r,"interpolate-lab":_r,length:eh,let:uo,literal:rs,match:$l,number:Is,"number-format":Ju,object:Is,slice:Ya,step:Ja,string:Is,"to-boolean":Mr,"to-color":Mr,"to-number":Mr,"to-string":Mr,var:pi,within:$n,distance:ua};class as{constructor(o,c,d,y){this.name=o,this.type=c,this._evaluate=d,this.args=y}evaluate(o){return this._evaluate(o,this.args)}
20eachChild(o){this.args.forEach(o)}outputDefined(){return!1}static parse(o,c){let d=o[0],y=as.definitions[d];if(!y)return c.error(`Unknown expression "${d}". If you wanted a literal array, use ["literal", [...]].`,0);let w=Array.isArray(y)?y[0]:y.type,S=Array.isArray(y)?[[y[1],y[2]]]:y.overloads,C=S.filter(([D])=>!Array.isArray(D)||D.length===o.length-1),E=null;for(let[D,z]of C){E=new Lo(c.registry,da,c.path,null,c.scope);let B=[],$=!1;for(let H=1;H<o.length;H++){let K=o[H],Z=Array.isArray(D)?D[H-1]:D.type,se=E.parse(K,1+B.length,Z);if(!se){$=!0;break}B.push(se)}if(!$)if(Array.isArray(D)&&D.length!==B.length)E.error(`Expected ${D.length} arguments, but found ${B.length} instead.`);else{for(let H=0;H<B.length;H++){let K=Array.isArray(D)?D[H]:D.type,Z=B[H];E.concat(H+1).checkSubtype(K,Z.type)}if(E.errors.length===0)return new as(d,w,z,B)}}if(C.length===1)c.errors.push(...E.errors);else{let D=(C.length?C:S).map(([B])=>{return $=B,Array.isArray($)?`(${$.map(j).join(", ")})`:`(${j($.type)}...)`;var $}).join(" | "),z=[];for(let B=1;B<o.length;B++){let $=c.parse(o[B],1+z.length);if(!$)return null;z.push(j($.type))}c.error(`Expected arguments of type ${D}, but found (${z.join(", ")}) instead.`)}return null}static register(o,c){as.definitions=c;for(let d in c)o[d]=as}}function hh(l,[o,c,d,y]){o=o.evaluate(l),c=c.evaluate(l),d=d.evaluate(l);let w=y?y.evaluate(l):1,S=Za(o,c,d,w);if(S)throw new gn(S);return new xi(o/255,c/255,d/255,w,!1)}function Bo(l,o){return l in o}function dh(l,o){let c=o[l];return c===void 0?null:c}function ha(l){return{type:l}}function da(l){if(l instanceof pi)return da(l.boundExpression);if(l instanceof as&&l.name==="error"||l instanceof Ii||l instanceof $n||l instanceof ua)return!1;let o=l instanceof Mr||l instanceof Is,c=!0;return l.eachChild(d=>{c=o?c&&da(d):c&&d instanceof rs}),!!c&&il(l)&&No(l,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function il(l){if(l instanceof as&&(l.name==="get"&&l.args.length===1||l.name==="feature-state"||l.name==="has"&&l.args.length===1||l.name==="properties"||l.name==="geometry-type"||l.name==="id"||/^filter-/.test(l.name))||l instanceof $n||l instanceof ua)return!1;let o=!0;return l.eachChild(c=>{o&&!il(c)&&(o=!1)}),o}function $r(l){if(l instanceof as&&l.name==="feature-state")return!1;let o=!0;return l.eachChild(c=>{o&&!$r(c)&&(o=!1)}),o}function No(l,o){if(l instanceof as&&o.indexOf(l.name)>=0)return!1;let c=!0;return l.eachChild(d=>{c&&!No(d,o)&&(c=!1)}),c}function Yc(l){return{result:"success",value:l}}function nl(l){return{result:"error",value:l}}function rl(l){return l["property-type"]==="data-driven"||l["property-type"]==="cross-faded-data-driven"}function pa(l){return!!l.expression&&l.expression.parameters.indexOf("zoom")>-1}function Ur(l){return!!l.expression&&l.expression.interpolated}function fi(l){return l instanceof Number?"number":l instanceof String?"string":l instanceof Boolean?"boolean":Array.isArray(l)?"array":l===null?"null":typeof l}function Jc(l){return typeof l=="object"&&l!==null&&!Array.isArray(l)}function Sf(l){return l}function Hd(l,o){let c=o.type==="color",d=l.stops&&typeof l.stops[0][0]=="object",y=d||!(d||l.property!==void 0),w=l.type||(Ur(o)?"exponential":"interval");if(c||o.type==="padding"){let z=c?xi.parse:Cr.parse;(l=is({},l)).stops&&(l.stops=l.stops.map(B=>[B[0],z(B[1])])),l.default=z(l.default?l.default:o.default)}if(l.colorSpace&&(S=l.colorSpace)!=="rgb"&&S!=="hcl"&&S!=="lab")throw new Error(`Unknown color space: "${l.colorSpace}"`);var S;let C,E,D;if(w==="exponential")C=Te;else if(w==="interval")C=Ps;else if(w==="categorical"){C=Wd,E=Object.create(null);for(let z of l.stops)E[z[0]]=z[1];D=typeof l.stops[0][0]}else{if(w!=="identity")throw new Error(`Unknown function type "${w}"`);C=Be}if(d){let z={},B=[];for(let K=0;K<l.stops.length;K++){let Z=l.stops[K],se=Z[0].zoom;z[se]===void 0&&(z[se]={zoom:se,type:l.type,property:l.property,default:l.default,stops:[]},B.push(se)),z[se].stops.push([Z[0].value,Z[1]])}let $=[];for(let K of B)$.push([z[K].zoom,Hd(z[K],o)]);let H={name:"linear"};return{kind:"composite",interpolationType:H,interpolationFactor:_r.interpolationFactor.bind(void 0,H),zoomStops:$.map(K=>K[0]),evaluate:({zoom:K},Z)=>Te({stops:$,base:l.base},o,K).evaluate(K,Z)}}if(y){let z=w==="exponential"?{name:"exponential",base:l.base!==void 0?l.base:1}:null;return{kind:"camera",interpolationType:z,interpolationFactor:_r.interpolationFactor.bind(void 0,z),zoomStops:l.stops.map(B=>B[0]),evaluate:({zoom:B})=>C(l,o,B,E,D)}}return{kind:"source",evaluate(z,B){let $=B&&B.properties?B.properties[l.property]:void 0;return $===void 0?sl(l.default,o.default):C(l,o,$,E,D)}}}function sl(l,o,c){return l!==void 0?l:o!==void 0?o:c!==void 0?c:void 0}function Wd(l,o,c,d,y){return sl(typeof c===y?d[c]:void 0,l.default,o.default)}function Ps(l,o,c){if(fi(c)!=="number")return sl(l.default,o.default);let d=l.stops.length;if(d===1||c<=l.stops[0][0])return l.stops[0][1];if(c>=l.stops[d-1][0])return l.stops[d-1][1];let y=Ul(l.stops.map(w=>w[0]),c);return l.stops[y][1]}function Te(l,o,c){let d=l.base!==void 0?l.base:1;if(fi(c)!=="number")return sl(l.default,o.default);let y=l.stops.length;if(y===1||c<=l.stops[0][0])return l.stops[0][1];if(c>=l.stops[y-1][0])return l.stops[y-1][1];let w=Ul(l.stops.map(z=>z[0]),c),S=function(z,B,$,H){let K=H-$,Z=z-$;return K===0?0:B===1?Z/K:(Math.pow(B,Z)-1)/(Math.pow(B,K)-1)}(c,d,l.stops[w][0],l.stops[w+1][0]),C=l.stops[w][1],E=l.stops[w+1][
vendor: 4,214 bytes, line 20
201],D=Ar[o.type]||Sf;return typeof C.evaluate=="function"?{evaluate(...z){let B=C.evaluate.apply(void 0,z),$=E.evaluate.apply(void 0,z);if(B!==void 0&&$!==void 0)return D(B,$,S,l.colorSpace)}}:D(C,E,S,l.colorSpace)}function Be(l,o,c){switch(o.type){case"color":c=xi.parse(c);break;case"formatted":c=Br.fromString(c.toString());break;case"resolvedImage":c=Vr.fromString(c.toString());break;case"padding":c=Cr.parse(c);break;default:fi(c)===o.type||o.type==="enum"&&o.values[c]||(c=void 0)}return sl(c,l.default,o.default)}as.register(tl,{error:[{kind:"error"},[Wt],(l,[o])=>{throw new gn(o.evaluate(l))}],typeof:[Wt,[Ft],(l,[o])=>j(Tn(o.evaluate(l)))],"to-rgba":[q(et,4),[nr],(l,[o])=>{let[c,d,y,w]=o.evaluate(l).rgb;return[255*c,255*d,255*y,w]}],rgb:[nr,[et,et,et],hh],rgba:[nr,[et,et,et,et],hh],has:{type:Et,overloads:[[[Wt],(l,[o])=>Bo(o.evaluate(l),l.properties())],[[Wt,Fr],(l,[o,c])=>Bo(o.evaluate(l),c.evaluate(l))]]},get:{type:Ft,overloads:[[[Wt],(l,[o])=>dh(o.evaluate(l),l.properties())],[[Wt,Fr],(l,[o,c])=>dh(o.evaluate(l),c.evaluate(l))]]},"feature-state":[Ft,[Wt],(l,[o])=>dh(o.evaluate(l),l.featureState||{})],properties:[Fr,[],l=>l.properties()],"geometry-type":[Wt,[],l=>l.geometryType()],id:[Ft,[],l=>l.id()],zoom:[et,[],l=>l.globals.zoom],"heatmap-density":[et,[],l=>l.globals.heatmapDensity||0],"line-progress":[et,[],l=>l.globals.lineProgress||0],accumulated:[Ft,[],l=>l.globals.accumulated===void 0?null:l.globals.accumulated],"+":[et,ha(et),(l,o)=>{let c=0;for(let d of o)c+=d.evaluate(l);return c}],"*":[et,ha(et),(l,o)=>{let c=1;for(let d of o)c*=d.evaluate(l);return c}],"-":{type:et,overloads:[[[et,et],(l,[o,c])=>o.evaluate(l)-c.evaluate(l)],[[et],(l,[o])=>-o.evaluate(l)]]},"/":[et,[et,et],(l,[o,c])=>o.evaluate(l)/c.evaluate(l)],"%":[et,[et,et],(l,[o,c])=>o.evaluate(l)%c.evaluate(l)],ln2:[et,[],()=>Math.LN2],pi:[et,[],()=>Math.PI],e:[et,[],()=>Math.E],"^":[et,[et,et],(l,[o,c])=>Math.pow(o.evaluate(l),c.evaluate(l))],sqrt:[et,[et],(l,[o])=>Math.sqrt(o.evaluate(l))],log10:[et,[et],(l,[o])=>Math.log(o.evaluate(l))/Math.LN10],ln:[et,[et],(l,[o])=>Math.log(o.evaluate(l))],log2:[et,[et],(l,[o])=>Math.log(o.evaluate(l))/Math.LN2],sin:[et,[et],(l,[o])=>Math.sin(o.evaluate(l))],cos:[et,[et],(l,[o])=>Math.cos(o.evaluate(l))],tan:[et,[et],(l,[o])=>Math.tan(o.evaluate(l))],asin:[et,[et],(l,[o])=>Math.asin(o.evaluate(l))],acos:[et,[et],(l,[o])=>Math.acos(o.evaluate(l))],atan:[et,[et],(l,[o])=>Math.atan(o.evaluate(l))],min:[et,ha(et),(l,o)=>Math.min(...o.map(c=>c.evaluate(l)))],max:[et,ha(et),(l,o)=>Math.max(...o.map(c=>c.evaluate(l)))],abs:[et,[et],(l,[o])=>Math.abs(o.evaluate(l))],round:[et,[et],(l,[o])=>{let c=o.evaluate(l);return c<0?-Math.round(-c):Math.round(c)}],floor:[et,[et],(l,[o])=>Math.floor(o.evaluate(l))],ceil:[et,[et],(l,[o])=>Math.ceil(o.evaluate(l))],"filter-==":[Et,[Wt,Ft],(l,[o,c])=>l.properties()[o.value]===c.value],"filter-id-==":[Et,[Ft],(l,[o])=>l.id()===o.value],"filter-type-==":[Et,[Wt],(l,[o])=>l.geometryType()===o.value],"filter-<":[Et,[Wt,Ft],(l,[o,c])=>{let d=l.properties()[o.value],y=c.value;return typeof d==typeof y&&d<y}],"filter-id-<":[Et,[Ft],(l,[o])=>{let c=l.id(),d=o.value;return typeof c==typeof d&&c<d}],"filter->":[Et,[Wt,Ft],(l,[o,c])=>{let d=l.properties()[o.value],y=c.value;return typeof d==typeof y&&d>y}],"filter-id->":[Et,[Ft],(l,[o])=>{let c=l.id(),d=o.value;return typeof c==typeof d&&c>d}],"filter-<=":[Et,[Wt,Ft],(l,[o,c])=>{let d=l.properties()[o.value],y=c.value;return typeof d==typeof y&&d<=y}],"filter-id-<=":[Et,[Ft],(l,[o])=>{let c=l.id(),d=o.value;return typeof c==typeof d&&c<=d}],"filter->=":[Et,[Wt,Ft],(l,[o,c])=>{let d=l.properties()[o.value],y=c.value;return typeof d==typeof y&&d>=y}],"filter-id->=":[Et,[Ft],(l,[o])=>{let c=l.id(),d=o.value;return typeof c==typeof d&&c>=d}],"filter-has":[Et,[Ft],(l,[o])=>o.value in l.properties()],"filter-has-id":[Et,[],l=>l.id()!==null&&l.id()!==void 0],"filter-type-in":[Et,[q(Wt)],(l,[o])=>o.value.indexOf(l.geometryType())>=0],"filter-id-in":[Et,[q(Ft)],(l,[o])=>o.value.indexOf(l.id())>=0],"filter-in-small":[Et,[Wt,q(Ft)],(l,[o,c])=>c.value.indexOf(l.properties()[o.value])>=0],"filter-in-large":[Et,[Wt,q(Ft)],(l,[o,c])=>function(d,y,w,S){for(;w<=S;){let C=w+S>>1;
20if(y[C]===d)return!0;y[C]>d?S=C-1:w=C+1}return!1}(l.properties()[o.value],c.value,0,c.value.length-1)],all:{type:Et,overloads:[[[Et,Et],(l,[o,c])=>o.evaluate(l)&&c.evaluate(l)],[ha(Et),(l,o)=>{for(let c of o)if(!c.evaluate(l))return!1;return!0}]]},any:{type:Et,overloads:[[[Et,Et],(l,[o,c])=>o.evaluate(l)||c.evaluate(l)],[ha(Et),(l,o)=>{for(let c of o)if(c.evaluate(l))return!0;return!1}]]},"!":[Et,[Et],(l,[o])=>!o.evaluate(l)],"is-supported-script":[Et,[Wt],(l,[o])=>{let c=l.globals&&l.globals.isSupportedScript;return!c||c(o.evaluate(l))}],upcase:[Wt,[Wt],(l,[o])=>o.evaluate(l).toUpperCase()],downcase:[Wt,[Wt],(l,[o])=>o.evaluate(l).toLowerCase()],concat:[Wt,ha(Ft),(l,o)=>o.map(c=>Ka(c.evaluate(l))).join("")],"resolved-locale":[Wt,[Gs],(l,[o])=>o.evaluate(l).resolvedLocale()]});class De{constructor(o,c){var d;this.expression=o,this._warningHistory={},this._evaluator=new Vc,this._defaultValue=c?(d=c).type==="color"&&Jc(d.default)?new xi(0,0,0,0):d.type==="color"?xi.parse(d.default)||null:d.type==="padding"?Cr.parse(d.default)||null:d.type==="variableAnchorOffsetCollection"?Nr.parse(d.default)||null:d.default===void 0?null:d.default:null,this._enumValues=c&&c.type==="enum"?c.values:null}evaluateWithoutErrorHandling(o,c,d,y,w,S){return this._evaluator.globals=o,this._evaluator.feature=c,this._evaluator.featureState=d,this._evaluator.canonical=y,this._evaluator.availableImages=w||null,this._evaluator.formattedSection=S,this.expression.evaluate(this._evaluator)}evaluate(o,c,d,y,w,S){this._evaluator.globals=o,this._evaluator.feature=c||null,this._evaluator.featureState=d||null,this._evaluator.canonical=y,this._evaluator.availableImages=w||null,this._evaluator.formattedSection=S||null;try{let C=this.expression.evaluate(this._evaluator);if(C==null||typeof C=="number"&&C!=C)return this._defaultValue;if(this._enumValues&&!(C in this._enumValues))throw new gn(`Expected value to be one of ${Object.keys(this._enumValues).map(E=>JSON.stringify(E)).join(", ")}, but found ${JSON.stringify(C)} instead.`);return C}catch(C){return this._warningHistory[C.message]||(this._warningHistory[C.message]=!0,typeof console<"u"&&console.warn(C.message)),this._defaultValue}}}function gt(l){return Array.isArray(l)&&l.length>0&&typeof l[0]=="string"&&l[0]in tl}function Ot(l,o){let c=new Lo(tl,da,[],o?function(y){let w={color:nr,string:Wt,number:et,enum:Wt,boolean:Et,formatted:lo,padding:co,resolvedImage:Es,variableAnchorOffsetCollection:ue};return y.type==="array"?q(w[y.value]||Ft,y.length):w[y.type]}(o):void 0),d=c.parse(l,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return d?Yc(new De(d,o)):nl(c.errors)}class ci{constructor(o,c){this.kind=o,this._styleExpression=c,this.isStateDependent=o!=="constant"&&!$r(c.expression)}evaluateWithoutErrorHandling(o,c,d,y,w,S){return this._styleExpression.evaluateWithoutErrorHandling(o,c,d,y,w,S)}evaluate(o,c,d,y,w,S){return this._styleExpression.evaluate(o,c,d,y,w,S)}}class rn{constructor(o,c,d,y){this.kind=o,this.zoomStops=d,this._styleExpression=c,this.isStateDependent=o!=="camera"&&!$r(c.expression),this.interpolationType=y}evaluateWithoutErrorHandling(o,c,d,y,w,S){return this._styleExpression.evaluateWithoutErrorHandling(o,c,d,y,w,S)}evaluate(o,c,d,y,w,S){return this._styleExpression.evaluate(o,c,d,y,w,S)}interpolationFactor(o,c,d){return this.interpolationType?_r.interpolationFactor(this.interpolationType,o,c,d):0}}function Ri(l,o){let c=Ot(l,o);if(c.result==="error")return c;let d=c.value.expression,y=il(d);if(!y&&!rl(o))return nl([new Gn("","data expressions not supported")]);let w=No(d,["zoom"]);if(!w&&!pa(o))return nl([new Gn("","zoom expressions not supported")]);let S=Zl(d);return S||w?S instanceof Gn?nl([S]):S instanceof _r&&!Ur(o)?nl([new Gn("",'"interpolate" expressions cannot be used with this property')]):Yc(S?new rn(y?"camera":"composite",c.value,S.labels,S instanceof _r?S.interpolation:void 0):new ci(y?"constant":"source",c.value)):nl([new Gn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Vo{constructor(o,c){this._parameters=o,this._specification=c,is(this,Hd(this._parameters,this._specification))}static deserialize(o){return new Vo(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function Zl(l){let o=null;if(l instanceof uo)o=Zl(l.result);else if(l instanceof jc){for(let c of l.args)if(o=Zl(c),o)break}else(l instanceof Ja||l instanceof _r)&&l.input instanceof as&&l.input.name==="zoom"&&(o=l);return o instanceof Gn||l.eachChild(c=>{let d=Zl(c);d instanceof Gn?o=d:!o&&d?o=new Gn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&d&&o!==d&&(o=new Gn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function vr(l){if(l===!0||l===!1)return!0;
vendor: 11,483 bytes, line 20
20if(!Array.isArray(l)||l.length===0)return!1;switch(l[0]){case"has":return l.length>=2&&l[1]!=="$id"&&l[1]!=="$type";case"in":return l.length>=3&&(typeof l[1]!="string"||Array.isArray(l[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return l.length!==3||Array.isArray(l[1])||Array.isArray(l[2]);case"any":case"all":for(let o of l.slice(1))if(!vr(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}let fa={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ph(l){if(l==null)return{filter:()=>!0,needGeometry:!1};vr(l)||(l=ma(l));let o=Ot(l,fa);if(o.result==="error")throw new Error(o.value.map(c=>`${c.key}: ${c.message}`).join(", "));return{filter:(c,d,y)=>o.value.evaluate(c,d,{},y),needGeometry:Kl(l)}}function ol(l,o){return l<o?-1:l>o?1:0}function Kl(l){if(!Array.isArray(l))return!1;if(l[0]==="within"||l[0]==="distance")return!0;for(let o=1;o<l.length;o++)if(Kl(l[o]))return!0;return!1}function ma(l){if(!l)return!0;let o=l[0];return l.length<=1?o!=="any":o==="=="?ki(l[1],l[2],"=="):o==="!="?Ln(ki(l[1],l[2],"==")):o==="<"||o===">"||o==="<="||o===">="?ki(l[1],l[2],o):o==="any"?(c=l.slice(1),["any"].concat(c.map(ma))):o==="all"?["all"].concat(l.slice(1).map(ma)):o==="none"?["all"].concat(l.slice(1).map(ma).map(Ln)):o==="in"?Xl(l[1],l.slice(2)):o==="!in"?Ln(Xl(l[1],l.slice(2))):o==="has"?al(l[1]):o!=="!has"||Ln(al(l[1]));var c}function ki(l,o,c){switch(l){case"$type":return[`filter-type-${c}`,o];case"$id":return[`filter-id-${c}`,o];default:return[`filter-${c}`,l,o]}}function Xl(l,o){if(o.length===0)return!1;switch(l){case"$type":return["filter-type-in",["literal",o]];case"$id":return["filter-id-in",["literal",o]];default:return o.length>200&&!o.some(c=>typeof c!=typeof o[0])?["filter-in-large",l,["literal",o.sort(ol)]]:["filter-in-small",l,["literal",o]]}}function al(l){switch(l){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",l]}}function Ln(l){return["!",l]}function ga(l){let o=typeof l;if(o==="number"||o==="boolean"||o==="string"||l==null)return JSON.stringify(l);if(Array.isArray(l)){let y="[";for(let w of l)y+=`${ga(w)},`;return`${y}]`}let c=Object.keys(l).sort(),d="{";for(let y=0;y<c.length;y++)d+=`${JSON.stringify(c[y])}:${ga(l[c[y]])},`;return`${d}}`}function Gd(l){let o="";for(let c of gr)o+=`/${ga(l[c])}`;return o}function Zd(l){let o=l.value;return o?[new Ge(l.key,o,"constants have been deprecated as of v8")]:[]}function en(l){return l instanceof Number||l instanceof String||l instanceof Boolean?l.valueOf():l}function Un(l){if(Array.isArray(l))return l.map(Un);if(l instanceof Object&&!(l instanceof Number||l instanceof String||l instanceof Boolean)){let o={};for(let c in l)o[c]=Un(l[c]);return o}return en(l)}function rr(l){let o=l.key,c=l.value,d=l.valueSpec||{},y=l.objectElementValidators||{},w=l.style,S=l.styleSpec,C=l.validateSpec,E=[],D=fi(c);if(D!=="object")return[new Ge(o,c,`object expected, ${D} found`)];for(let z in c){let B=z.split(".")[0],$=d[B]||d["*"],H;if(y[B])H=y[B];else if(d[B])H=C;else if(y["*"])H=y["*"];else{if(!d["*"]){E.push(new Ge(o,c[z],`unknown property "${z}"`));continue}H=C}E=E.concat(H({key:(o&&`${o}.`)+z,value:c[z],valueSpec:$,style:w,styleSpec:S,object:c,objectKey:z,validateSpec:C},c))}for(let z in d)y[z]||d[z].required&&d[z].default===void 0&&c[z]===void 0&&E.push(new Ge(o,c,`missing required property "${z}"`));return E}function ll(l){let o=l.value,c=l.valueSpec,d=l.style,y=l.styleSpec,w=l.key,S=l.arrayElementValidator||l.validateSpec;if(fi(o)!=="array")return[new Ge(w,o,`array expected, ${fi(o)} found`)];if(c.length&&o.length!==c.length)return[new Ge(w,o,`array length ${c.length} expected, length ${o.length} found`)];if(c["min-length"]&&o.length<c["min-length"])return[new Ge(w,o,`array length at least ${c["min-length"]} expected, length ${o.length} found`)];let C={type:c.value,values:c.values};y.$version<7&&(C.function=c.function),fi(c.value)==="object"&&(C=c.value);let E=[];for(let D=0;D<o.length;D++)E=E.concat(S({array:o,arrayIndex:D,value:o[D],valueSpec:C,validateSpec:l.validateSpec,style:d,styleSpec:y,key:`${w}[${D}]`}));return E}function cl(l){let o=l.key,c=l.value,d=l.valueSpec,y=fi(c);return y==="number"&&c!=c&&(y="NaN"),y!=="number"?[new Ge(o,c,`number expected, ${y} found`)]:"minimum"in d&&c<d.minimum?[new Ge(o,c,`${c} is less than the minimum value ${d.minimum}`)]:"maximum"in d&&c>d.maximum?[new Ge(o,c,`${c} is greater than the maximum value ${d.maximum}`)]:[]}function Yl(l){let o=l.valueSpec,c=en(l.value.type),d,y,w,S={},C=c!=="categorical"&&l.value.property===void 0,E=!C,D=fi(l.value.stops)==="array"&&fi(l.value.stops[0])==="array"&&fi(l.value.stops[0][0])==="object",z=rr({key:l.key,value:l.value,valueSpec:l.styleSpec.function,validateSpec:l.validateSpec,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(H){if(c==="identity")return[new Ge(H.key,H.value,'identity function may not have a "stops" property')];let K=[],Z=H.value;return K=K.concat(ll({key:H.key,value:Z,valueSpec:H.valueSpec,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec,arrayElementValidator:B})),fi(Z)==="array"&&Z.length===0&&K.push(new Ge(H.key,Z,"array must have at least one stop")),K},default:function(H){return H.validateSpec({key:H.key,value:H.value,valueSpec:o,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec})}}});return c==="identity"&&C&&z.push(new Ge(l.key,l.value,'missing required property "property"')),c==="identity"||l.value.stops||z.push(new Ge(l.key,l.value,'missing required property "stops"')),c==="exponential"&&l.valueSpec.expression&&!Ur(l.valueSpec)&&z.push(new Ge(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(E&&!rl(l.valueSpec)?z.push(new Ge(l.key,l.value,"property functions not supported")):C&&!pa(l.valueSpec)&&z.push(new Ge(l.key,l.value,"zoom functions not supported"))),c!=="categorical"&&!D||l.value.property!==void 0||z.push(new Ge(l.key,l.value,'"property" property is required')),z;function B(H){let K=[],Z=H.value,se=H.key;if(fi(Z)!=="array")return[new Ge(se,Z,`array expected, ${fi(Z)} found`)];if(Z.length!==2)return[new Ge(se,Z,`array length 2 expected, length ${Z.length} found`)];if(D){if(fi(Z[0])!=="object")return[new Ge(se,Z,`object expected, ${fi(Z[0])} found`)];if(Z[0].zoom===void 0)return[new Ge(se,Z,"object stop key must have zoom")];if(Z[0].value===void 0)return[new Ge(se,Z,"object stop key must have value")];if(w&&w>en(Z[0].zoom))return[new Ge(se,Z[0].zoom,"stop zoom values must appear in ascending order")];en(Z[0].zoom)!==w&&(w=en(Z[0].zoom),y=void 0,S={}),K=K.concat(rr({key:`${se}[0]`,value:Z[0],valueSpec:{zoom:{}},validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec,objectElementValidators:{zoom:cl,value:$}}))}else K=K.concat($({key:`${se}[0]`,value:Z[0],valueSpec:{},validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec},Z));return gt(Un(Z[1]))?K.concat([new Ge(`${se}[1]`,Z[1],"expressions are not allowed in function stops.")]):K.concat(H.validateSpec({key:`${se}[1]`,value:Z[1],valueSpec:o,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec}))}function $(H,K){let Z=fi(H.value),se=en(H.value),ce=H.value!==null?H.value:K;if(d){if(Z!==d)return[new Ge(H.key,ce,`${Z} stop domain type must match previous stop domain type ${d}`)]}else d=Z;if(Z!=="number"&&Z!=="string"&&Z!=="boolean")return[new Ge(H.key,ce,"stop domain value must be a number, string, or boolean")];if(Z!=="number"&&c!=="categorical"){let Ce=`number expected, ${Z} found`;return rl(o)&&c===void 0&&(Ce+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ge(H.key,ce,Ce)]}return c!=="categorical"||Z!=="number"||isFinite(se)&&Math.floor(se)===se?c!=="categorical"&&Z==="number"&&y!==void 0&&se<y?[new Ge(H.key,ce,"stop domain values must appear in ascending order")]:(y=se,c==="categorical"&&se in S?[new Ge(H.key,ce,"stop domain values must be unique")]:(S[se]=!0,[])):[new Ge(H.key,ce,`integer expected, found ${se}`)]}}function ya(l){let o=(l.expressionContext==="property"?Ri:Ot)(Un(l.value),l.valueSpec);if(o.result==="error")return o.value.map(d=>new Ge(`${l.key}${d.key}`,l.value,d.message));let c=o.value.expression||o.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!c.outputDefined())return[new Ge(l.key,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!$r(c))return[new Ge(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter"&&!$r(c))return[new Ge(l.key,l.value,'"feature-state" data expressions are not supported with filters.')];if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!No(c,["zoom","feature-state"]))return[new Ge(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!il(c))return[new Ge(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ls(l){let o=l.key,c=l.value,d=l.valueSpec,y=[];return Array.isArray(d.values)?d.values.indexOf(en(c))===-1&&y.push(new Ge(o,c,`expected one of [${d.values.join(", ")}], ${JSON.stringify(c)} found`)):Object.keys(d.values).indexOf(en(c))===-1&&y.push(new Ge(o,c,`expected one of [${Object.keys(d.values).join(", ")}], ${JSON.stringify(c)} found`)),y}function Qc(l){return vr(Un(l.value))?ya(is({},l,{expressionContext:"filter",valueSpec:{value:"boolean"}})):$o(l)}function $o(l){let o=l.value,c=l.key;if(fi(o)!=="array")return[new Ge(c,o,`array expected, ${fi(o)} found`)];let d=l.styleSpec,y,w=[];if(o.length<1)return[new Ge(c,o,"filter array must have at least 1 element")];switch(w=w.concat(ls({key:`${c}[0]`,value:o[0],valueSpec:d.filter_operator,style:l.style,styleSpec:l.styleSpec})),en(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&en(o[1])==="$type"&&w.push(new Ge(c,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&w.push(new Ge(c,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(y=fi(o[1]),y!=="string"&&w.push(new Ge(`${c}[1]`,o[1],`string expected, ${y} found`)));for(let S=2;S<o.length;S++)y=fi(o[S]),en(o[1])==="$type"?w=w.concat(ls({key:`${c}[${S}]`,value:o[S],valueSpec:d.geometry_type,style:l.style,styleSpec:l.styleSpec})):y!=="string"&&y!=="number"&&y!=="boolean"&&w.push(new Ge(`${c}[${S}]`,o[S],`string, number, or boolean expected, ${y} found`));break;case"any":case"all":case"none":for(let S=1;S<o.length;S++)w=w.concat($o({key:`${c}[${S}]`,value:o[S],style:l.style,styleSpec:l.styleSpec}));break;case"has":case"!has":y=fi(o[1]),o.length!==2?w.push(new Ge(c,o,`filter array for "${o[0]}" operator must have 2 elements`)):y!=="string"&&w.push(new Ge(`${c}[1]`,o[1],`string expected, ${y} found`))}return w}function mo(l,o){let c=l.key,d=l.validateSpec,y=l.style,w=l.styleSpec,S=l.value,C=l.objectKey,E=w[`${o}_${l.layerType}`];if(!E)return[];let D=C.match(/^(.*)-transition$/);if(o==="paint"&&D&&E[D[1]]&&E[D[1]].transition)return d({key:c,value:S,valueSpec:w.transition,style:y,styleSpec:w});let z=l.valueSpec||E[C];if(!z)return[new Ge(c,S,`unknown property "${C}"`)];let B;
20if(fi(S)==="string"&&rl(z)&&!z.tokens&&(B=/^{([^}]+)}$/.exec(S)))return[new Ge(c,S,`"${C}" does not support interpolation syntax
21Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(B[1])} }\`.`)];let $=[];return l.layerType==="symbol"&&(C==="text-field"&&y&&!y.glyphs&&$.push(new Ge(c,S,'use of "text-field" requires a style "glyphs" property')),C==="text-font"&&Jc(Un(S))&&en(S.type)==="identity"&&$.push(new Ge(c,S,'"text-font" does not support identity functions'))),$.concat(d({key:l.key,value:S,valueSpec:z,style:y,styleSpec:w,expressionContext:"property",propertyType:o,propertyKey:C}))}function _a(l){return mo(l,"paint")}function fh(l){return mo(l,"layout")}function mh(l){let o=[],c=l.value,d=l.key,y=l.style,w=l.styleSpec;c.type||c.ref||o.push(new Ge(d,c,'either "type" or "ref" is required'));let S=en(c.type),C=en(c.ref);if(c.id){let E=en(c.id);for(let D=0;D<l.arrayIndex;D++){let z=y.layers[D];en(z.id)===E&&o.push(new Ge(d,c.id,`duplicate layer id "${c.id}", previously used at line ${z.id.__line__}`))}}if("ref"in c){let E;["type","source","source-layer","filter","layout"].forEach(D=>{D in c&&o.push(new Ge(d,c[D],`"${D}" is prohibited for ref layers`))}),y.layers.forEach(D=>{en(D.id)===C&&(E=D)}),E?E.ref?o.push(new Ge(d,c.ref,"ref cannot reference another ref layer")):S=en(E.type):o.push(new Ge(d,c.ref,`ref layer "${C}" not found`))}else if(S!=="background")if(c.source){let E=y.sources&&y.sources[c.source],D=E&&en(E.type);E?D==="vector"&&S==="raster"?o.push(new Ge(d,c.source,`layer "${c.id}" requires a raster source`)):D!=="raster-dem"&&S==="hillshade"?o.push(new Ge(d,c.source,`layer "${c.id}" requires a raster-dem source`)):D==="raster"&&S!=="raster"?o.push(new Ge(d,c.source,`layer "${c.id}" requires a vector source`)):D!=="vector"||c["source-layer"]?D==="raster-dem"&&S!=="hillshade"?o.push(new Ge(d,c.source,"raster-dem source can only be used with layer type 'hillshade'.")):S!=="line"||!c.paint||!c.paint["line-gradient"]||D==="geojson"&&E.lineMetrics||o.push(new Ge(d,c,`layer "${c.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new Ge(d,c,`layer "${c.id}" must specify a "source-layer"`)):o.push(new Ge(d,c.source,`source "${c.source}" not found`))}else o.push(new Ge(d,c,'missing required property "source"'));return o=o.concat(rr({key:d,value:c,valueSpec:w.layer,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*":()=>[],type:()=>l.validateSpec({key:`${d}.type`,value:c.type,valueSpec:w.layer.type,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,object:c,objectKey:"type"}),filter:Qc,layout:E=>rr({layer:c,key:E.key,value:E.value,style:E.style,styleSpec:E.styleSpec,validateSpec:E.validateSpec,objectElementValidators:{"*":D=>fh(is({layerType:S},D))}}),paint:E=>rr({layer:c,key:E.key,value:E.value,style:E.style,styleSpec:E.styleSpec,validateSpec:E.validateSpec,objectElementValidators:{"*":D=>_a(is({layerType:S},D))}})}})),o}function va(l){let o=l.value,c=l.key,d=fi(o);return d!=="string"?[new Ge(c,o,`string expected, ${d} found`)]:[]}let ba={promoteId:function({key:l,value:o}
21){if(fi(o)==="string")return va({key:l,value:o});{let c=[];for(let d in o)c.push(...va({key:`${l}.${d}`,value:o[d]}));return c}}};function Uo(l){let o=l.value,c=l.key,d=l.styleSpec,y=l.style,w=l.validateSpec;if(!o.type)return[new Ge(c,o,'"type" is required')];let S=en(o.type),C;switch(S){case"vector":case"raster":return C=rr({key:c,value:o,valueSpec:d[`source_${S.replace("-","_")}`],style:l.style,styleSpec:d,objectElementValidators:ba,validateSpec:w}),C;case"raster-dem":return C=function(E){var D;let z=(D=E.sourceName)!==null&&D!==void 0?D:"",B=E.value,$=E.styleSpec,H=$.source_raster_dem,K=E.style,Z=[],se=fi(B);if(B===void 0)return Z;if(se!=="object")return Z.push(new Ge("source_raster_dem",B,`object expected, ${se} found`)),Z;let ce=en(B.encoding)==="custom",Ce=["redFactor","greenFactor","blueFactor","baseShift"],ge=E.value.encoding?`"${E.value.encoding}"`:"Default";for(let ye in B)!ce&&Ce.includes(ye)?Z.push(new Ge(ye,B[ye],`In "${z}": "${ye}" is only valid when "encoding" is set to "custom". ${ge} encoding found`)):H[ye]?Z=Z.concat(E.validateSpec({key:ye,value:B[ye],valueSpec:H[ye],validateSpec:E.validateSpec,style:K,styleSpec:$})):Z.push(new Ge(ye,B[ye],`unknown property "${ye}"`));return Z}({sourceName:c,value:o,style:l.style,styleSpec:d,validateSpec:w}),C;case"geojson":if(C=rr({key:c,value:o,valueSpec:d.source_geojson,style:y,styleSpec:d,validateSpec:w,objectElementValidators:ba}),o.cluster)for(let E in o.clusterProperties){let[D,z]=o.clusterProperties[E],B=typeof D=="str
21ing"?[D,["accumulated"],["get",E]]:D;C.push(...ya({key:`${c}.${E}.map`,value:z,validateSpec:w,expressionContext:"cluster-map"})),C.push(...ya({key:`${c}.${E}.reduce`,value:B,validateSpec:w,expressionContext:"cluster-reduce"}))}return C;case"video":return rr({key:c,value:o,valueSpec:d.source_video,style:y,validateSpec:w,styleSpec:d});case"image":return rr({key:c,value:o,valueSpec:d.source_image,style:y,validateSpec:w,styleSpec:d});case"canvas":return[new Ge(c,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ls({key:`${c}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:y,validateSpec:w,styleSpec:d})}}function Jl(l){let o=l.value,c=l.styleSpec,d=c.light,y=l.style,w=[],S=fi(o);if(o===void 0)return w;if(S!=="object")return w=w.concat([new Ge("light",o,`object expected, ${S} found`)]),w;for(let C in o){let E=C.match(/^(.*)-transition$/);w=w.concat(E&&d[E[1]]&&d[E[1]].transition?l.validateSpec({key:C,value:o[C],valueSpec:c.transition,validateSpec:l.validateSpec,style:y,styleSpec:c}):d[C]?l.validateSpec({key:C,value:o[C],valueSpec:d[C],validateSpec:l.validateSpec,style:y,styleSpec:c}):[new Ge(C,o[C],`unknown property "${C}"`)])}return w}function gh(l){let o=l.value,c=l.styleSpec,d=c.sky,y=l.style,w=fi(o);if(o===void 0)return[];if(w!=="object")return[new Ge("sky",o,`object expected, ${w} found`)];let S=[];for(let C in o)S=S.concat(d[C]?l.validateSpec({key:C,value:o[C],valueSpec:d[C],style:y,styleSpec:c}):[new Ge(C,o[C],`unknown property "${C}"`)]);return S}function eu(l){let o=l.value,c=l.styleSpec,d=c.terrain,y=l.style,w=[],S=fi(o);if(o===void 0)return w;if(S!=="object")return w=w.concat([new Ge("terrain",o,`object expected, ${S} found`)]),w;for(let C in o)w=w.concat(d[C]?l.validateSpec({key:C,value:o[C],valueSpec:d[C],validateSpec:l.validateSpec,style:y,styleSpec:c}):[new Ge(C,o[C],`unknown property "${C}"`)]);return w}function yh(l){let o=[],c=l.value,d=l.key;if(Array.isArray(c)){let y=[],w=[];for(let S in c)c[S].id&&y.includes(c[S].id)&&o.push(new Ge(d,c,`all the sprites' ids must be unique, but ${c[S].id} is duplicated`)),y.push(c[S].id),c[S].url&&w.includes(c[S].url)&&o.push(new Ge(d,c,`all the sprites' URLs must be unique, but ${c[S].url} is duplicated`)),w.push(c[S].url),o=o.concat(rr({key:`${d}[${S}]`,value:c[S],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:l.validateSpec}));return o}return va({key:d,value:c})}let tu={"*":()=>[],array:ll,boolean:function(l){let o=l.value,c=l.key,d=fi(o);return d!=="boolean"?[new Ge(c,o,`boolean expected, ${d} found`)]:[]},number:cl,color:function(l){let o=l.key,c=l.value,d=fi(c);return d!=="string"?[new Ge(o,c,`color expected, ${d} found`)]:xi.parse(String(c))?[]:[new Ge(o,c,`color expected, "${c}" found`)]},constants:Zd,enum:ls,filter:Qc,function:Yl,layer:mh,object:rr,source:Uo,light:Jl,sky:gh,terrain:eu,projection:function(l){let o=l.value,c=l.styleSpec,d=c.projection,y=l.style,w=fi(o);if(o===void 0)return[];if(w!=="object")return[new Ge("projection",o,`object expected, ${w} found`)];let S=[];for(let C in o)S=S.concat(d[C]?l.validateSpec({key:C,value:o[C],valueSpec:d[C],style:y,styleSpec:c}):[new Ge(C,o[C],`unknown property "${C}"`)]);return S},string:va,formatted:function(l){return va(l).length===0?[]:ya(l)},resolvedImage:function(l){return va(l).length===0?[]:ya(l)},padding:function(l){let o=l.key,c=l.value;if(fi(c)==="array"){if(c.length<1||c.length>4)return[new Ge(o,c,`padding requires 1 to 4 values; ${c.length} values found`)];let d={type:"number"},y=[];for(let w=0;w<c.length;w++)y=y.concat(l.validateSpec({key:`${o}[${w}]`,value:c[w],validateSpec:l.validateSpec,valueSpec:d}));return y}return cl({key:o,value:c,valueSpec:{}})},variableAnchorOffsetCollection:function(l){let o=l.key,c=l.value,d=fi(c),y=l.styleSpec;if(d!=="array"||c.length<1||c.length%2!=0)return[new Ge(o,c,"variableAnchorOffsetCollection requires a non-empty array of even length")];let w=[];for(let S=0;S<c.length;S+=2)w=w.concat(ls({key:`${o}[${S}]`,value:c[S],valueSpec:y.layout_symbol["text-anchor"]})),w=w.concat(ll({key:`${o}[${S+1}]`,value:c[S+1],valueSpec:{length:2,value:"number"},validateSpec:l.validateSpec,style:l.style,styleSpec:y}));return w},sprite:yh};function sn(l){let o=l.value,c=l.valueSpec,d=l.styleSpec;return l.validateSpec=sn,c.expression&&Jc(en(o))?Yl(l):c.expression&&gt(Un(o))?ya(l):c.type&&tu[c.type]?tu[c.type](l):rr(is({},l,{valueSpec:c.type?d[c.type]:c}))}function Kn(l){let o=l.value,c=l.key,d=va(l);return d.length||(o.indexOf("{fontstack}")===-1&&d.push(new Ge(c,o,'"glyphs" url must include a "{fontstack}" token')),o.indexOf("{range}")===-1&&d.push(new Ge(c,o,'"glyphs" url must include a "{range}" token'))),d}function cs(l,o=Ie){let c=[];return c=c.concat(sn({key:"",value:l,valueSpec:o.$root,styleSpec:o,style:l,validateSpec:sn,objectElementValidators:{glyphs:Kn,"*":()=>[]}})),l.constants&&(c=c.concat(Zd({key:"constants",value:l.constants,style:l,styleSpec:o,validateSpec:sn}))),iu(c)}function Xs(l){return function(o){return l({...o,validateSpec:sn})}}function iu(l){return[].concat(l).sort((o,c)=>o.line-c.line)}function Ds(l){return function(...o){return iu(l.apply(this,o))}}cs.source=Ds(Xs(Uo)),cs.sprite=Ds(Xs(yh)),cs.glyphs=Ds(Xs(Kn)),cs.light=Ds(Xs(Jl)),cs.sky=Ds(Xs(gh)),cs.terrain=Ds(Xs(eu)),cs.layer=Ds(Xs(mh)),cs.filter=Ds(Xs(Qc)),cs.paintProperty=Ds(Xs(_a)),cs.layoutProperty=Ds(Xs(fh));let go=cs,Ql=go.light,_h=go.sky,xa=go.paintProperty,ul=go.layoutProperty;function wa(l,o){let c=!1;if(o&&o.length)for(let d of o)l.fire(new Bn(new Error(d.message))),c=!0;return c}class yo{constructor(o,c,d){let y=this.cells=[];if(o instanceof ArrayBuffer){this.arrayBuffer=o;let S=new Int32Array(this.arrayBuffer);o=S[0],this.d=(c=S[1])+2*(d=S[2]);for(let E=0;E<this.d*this.d;E++){let D=S[3+E],z=S[3+E+1];y.push(D===z?null:S.subarray(D,z))}let C=S[3+y.length+1];this.keys=S.subarray(S[3+y.length],C),this.bboxes=S.subarray(C),this.insert=this._insertReadonly}else{this.d=c+2*d;for(let S=0;S<this.d*this.d;S++)y.push([]);this.keys=[],this.bboxes=[]}this.n=c,this.extent=o,this.padding=d,this.scale=c/o,this.uid=0;let w=d/c*o;this.min=-w,this.max=o+w}
21insert(o,c,d,y,w){this._forEachCell(c,d,y,w,this._insertCell,this.uid++,void 0,void 0),this.keys.push(o),this.bboxes.push(c),this.bboxes.push(d),this.bboxes.push(y),this.bboxes.push(w)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(o,c,d,y,w,S){this.cells[w].push(S)}query(o,c,d,y,w){let S=this.min,C=this.max;if(o<=S&&c<=S&&C<=d&&C<=y&&!w)return Array.prototype.slice.call(this.keys);{let E=[];return this._forEachCell(o,c,d,y,this._queryCell,E,{},w),E}}_queryCell(o,c,d,y,w,S,C,E){let D=this.cells[w];if(D!==null){let z=this.keys,B=this.bboxes;for(let $=0;$<D.length;$++){let H=D[$];if(C[H]===void 0){let K=4*H;(E?E(B[K+0],B[K+1],B[K+2],B[K+3]):o<=B[K+2]&&c<=B[K+3]&&d>=B[K+0]&&y>=B[K+1])?(C[H]=!0,S.push(z[H])):C[H]=!1}}}}_forEachCell(o,c,d,y,w,S,C,E){let D=this._convertToCellCoord(o),z=this._convertToCellCoord(c),B=this._convertToCellCoord(d),$=this._convertToCellCoord(y);for(let H=D;H<=B;H++)for(let K=z;K<=$;K++){let Z=this.d*K+H;if((!E||E(this._convertFromCellCoord(H),this._convertFromCellCoord(K),this._convertFromCellCoord(H+1),this._convertFromCellCoord(K+1)))&&w.call(this,o,c,d,y,Z,S,C,E))return}}_convertFromCellCoord(o){return(o-this.padding)/this.scale}_convertToCellCoord(o){return Math.max(0,Math.min(this.d-1,Math.floor(o*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let o=this.cells,c=3+this.cells.length+1+1,d=0;for(let S=0;S<this.cells.length;S++)d+=this.cells[S].length;let y=new Int32Array(c+d+this.keys.length+this.bboxes.length);y[0]=this.extent,y[1]=this.n,y[2]=this.padding;let w=c;for(let S=0;S<o.length;S++){let C=o[S];y[3+S]=w,y.set(C,w),w+=C.length}return y[3+o.length]=w,y.set(this.keys,w),w+=this.keys.length,y[3+o.length+1]=w,y.set(this.bboxes,w),w+=this.bboxes.length,y.buffer}static serialize(o,c){let d=o.toArrayBuffer();return c&&c.push(d),{buffer:d}}static deserialize(o){return new yo(o.buffer)}}let Xn={};function dt(l,o,c={}){if(Xn[l])throw new Error(`${l} is already registered.`);Object.defineProperty(o,"_classRegistryKey",{value:l,writeable:!1}),Xn[l]={klass:o,omit:c.omit||[],shallow:c.shallow||[]}}dt("Object",Object),dt("TransferableGridIndex",yo),dt("Color",xi),dt("Error",Error),dt("AJAXError",In),dt("ResolvedImage",Vr),dt("StylePropertyFunction",Vo),dt("StyleExpression",De,{omit:["_evaluator"]}),dt("ZoomDependentExpression",rn),dt("ZoomConstantExpression",ci),dt("CompoundExpression",as,{omit:["_evaluate"]});for(let l in tl)tl[l]._classRegistryKey||dt(`Expression_${l}`,tl[l]);function nu(l){return l&&typeof ArrayBuffer<"u"&&(l instanceof ArrayBuffer||l.constructor&&l.constructor.name==="ArrayBuffer")}function vh(l){return l.$name||l.constructor._classRegistryKey}function Kd(l){return!function(o){if(o===null||typeof o!="object")return!1;let c=vh(o);return!(!c||c==="Object")}(l)&&(l==null||typeof l=="boolean"||typeof l=="number"||typeof l=="string"||l instanceof Boolean||l instanceof Number||l instanceof String||l instanceof Date||l instanceof RegExp||l instanceof Blob||l instanceof Error||nu(l)||Bt(l)||ArrayBuffer.isView(l)||l instanceof ImageData)}function hl(l,o){if(Kd(l))return(nu(l)||Bt(l))&&o&&o.push(l),ArrayBuffer.isView(l)&&o&&o.push(l.buffer),l instanceof ImageData&&o&&o.push(l.data.buffer),l;if(Array.isArray(l)){let w=[];for(let S of l)w.push(hl(S,o));return w}if(typeof l!="object")throw new Error("can't serialize object of type "+typeof l);let c=vh(l);if(!c)throw new Error(`can't serialize object of unregistered class ${l.constructor.name}`);if(!Xn[c])throw new Error(`${c} is not registered.`);let{klass:d}=Xn[c],y=d.serialize?d.serialize(l,o):{};if(d.serialize){if(o&&y===o[o.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let w in l){if(!l.hasOwnProperty(w)||Xn[c].omit.indexOf(w)>=0)continue;let S=l[w];y[w]=Xn[c].shallow.indexOf(w)>=0?S:hl(S,o)}l instanceof Error&&(y.message=l.message)}if(y.$name)throw new Error("$name property is reserved for worker serialization logic.");return c!=="Object"&&(y.$name=c),y}function _o(l){if(Kd(l))return l;if(Array.isArray(l))return l.map(_o);if(typeof l!="object")throw new Error("can't deserialize object of type "+typeof l);let o=vh(l)||"Object";if(!Xn[o])throw new Error(`can't deserialize unregistered class ${o}`);let{klass:c}=Xn[o];if(!c)throw new Error(`can't deserialize unregistered class ${o}`);if(c.deserialize)return c.deserialize(l);let d=Object.create(c.prototype);
21for(let y of Object.keys(l)){if(y==="$name")continue;let w=l[y];d[y]=Xn[o].shallow.indexOf(y)>=0?w:_o(w)}return d}class Sa{constructor(){this.first=!0}update(o,c){let d=Math.floor(o);return this.first?(this.first=!1,this.lastIntegerZoom=d,this.lastIntegerZoomTime=0,this.lastZoom=o,this.lastFloorZoom=d,!0):(this.lastFloorZoom>d?(this.lastIntegerZoom=d+1,this.lastIntegerZoomTime=c):this.lastFloorZoom<d&&(this.lastIntegerZoom=d,this.lastIntegerZoomTime=c),o!==this.lastZoom&&(this.lastZoom=o,this.lastFloorZoom=d,!0))}}let ii={"Latin-1 Supplement":l=>l>=128&&l<=255,"Hangul Jamo":l=>l>=4352&&l<=4607,Khmer:l=>l>=6016&&l<=6143,"General Punctuation":l=>l>=8192&&l<=8303,"Letterlike Symbols":l=>l>=8448&&l<=8527,"Number Forms":l=>l>=8528&&l<=8591,"Miscellaneous Technical":l=>l>=8960&&l<=9215,"Control Pictures":l=>l>=9216&&l<=9279,"Optical Character Recognition":l=>l>=9280&&l<=9311,"Enclosed Alphanumerics":l=>l>=9312&&l<=9471,"Geometric Shapes":l=>l>=9632&&l<=9727,"Miscellaneous Symbols":l=>l>=9728&&l<=9983,"Miscellaneous Symbols and Arrows":l=>l>=11008&&l<=11263,"Ideographic Description Characters":l=>l>=12272&&l<=12287,"CJK Symbols and Punctuation":l=>l>=12288&&l<=12351,Katakana:l=>l>=12448&&l<=12543,Kanbun:l=>l>=12688&&l<=12703,"CJK Strokes":l=>l>=12736&&l<=12783,"Enclosed CJK Letters and Months":l=>l>=12800&&l<=13055,"CJK Compatibility":l=>l>=13056&&l<=13311,"Yijing Hexagram Symbols":l=>l>=19904&&l<=19967,"Private Use Area":l=>l>=57344&&l<=63743,"Vertical Forms":l=>l>=65040&&l<=65055,"CJK Compatibility Forms":l=>l>=65072&&l<=65103,"Small Form Variants":l=>l>=65104&&l<=65135,"Halfwidth and Fullwidth Forms":l=>l>=65280&&l<=65519};function J(l){for(let o of l)if(bh(o.charCodeAt(0)))return!0;return!1}function dl(l){for(let o of l)if(!Kt(o.charCodeAt(0)))return!1;return!0}function pl(l){let o=l.map(c=>{try{return new RegExp(`\\p{sc=${c}}`,"u").source}catch{return null}}).filter(c=>c);return new RegExp(o.join("|"),"u")}let us=pl(["Arab","Dupl","Mong","Ougr","Syrc"]);function Kt(l){return!us.test(String.fromCodePoint(l))}let Xd=pl(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function bh(l){return!(l!==746&&l!==747&&(l<4352||!(ii["CJK Compatibility Forms"](l)&&!(l>=65097&&l<=65103)||ii["CJK Compatibility"](l)||ii["CJK Strokes"](l)||!(!ii["CJK Symbols and Punctuation"](l)||l>=12296&&l<=12305||l>=12308&&l<=12319||l===12336)||ii["Enclosed CJK Letters and Months"](l)||ii["Ideographic Description Characters"](l)||ii.Kanbun(l)||ii.Katakana(l)&&l!==12540||!(!ii["Halfwidth and Fullwidth Forms"](l)||l===65288||l===65289||l===65293||l>=65306&&l<=65310||l===65339||l===65341||l===65343||l>=65371&&l<=65503||l===65507||l>=65512&&l<=65519)||!(!ii["Small Form Variants"](l)||l>=65112&&l<=65118||l>=65123&&l<=65126)||ii["Vertical Forms"](l)||ii["Yijing Hexagram Symbols"](l)||/\p{sc=Cans}/u.test(String.fromCodePoint(l))||/\p{sc=Hang}/u.test(String.fromCodePoint(l))||Xd.test(String.fromCodePoint(l)))))}function Yd(l){return!(bh(l)||function(o){return!!(ii["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||ii["General Punctuation"](o)&&(o===8214||o===8224||o===8225||o===8240||o===8241||o===8251||o===8252||o===8258||o===8263||o===8264||o===8265||o===8273)||ii["Letterlike Symbols"](o)||ii["Number Forms"](o)||ii["Miscellaneous Technical"](o)&&(o>=8960&&o<=8967||o>=8972&&o<=8991||o>=8996&&o<=9e3||o===9003||o>=9085&&o<=9114||o>=9150&&o<=9165||o===9167||o>=9169&&o<=9179||o>=9186&&o<=9215)||ii["Control Pictures"](o)&&o!==9251||ii["Optical Character Recognition"](o)||ii["Enclosed Alphanumerics"](o)||ii["Geometric Shapes"](o)||ii["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||ii["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||ii["CJK Symbols and Punctuation"](o)||ii.Katakana(o)||ii["Private Use Area"](o)||ii["CJK Compatibility Forms"](o)||ii["Small Form Variants"](o)||ii["Halfwidth and Fullwidth Forms"](o)||o===8734||o===8756||o===8757||o>=9984&&o<=10087||o>=10102&&o<=10131||o===65532||o===65533)}(l))}
21let Ta=pl(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function xh(l){return Ta.test(String.fromCodePoint(l))}function Tf(l,o){return!(!o&&xh(l)||l>=2304&&l<=3583||l>=3840&&l<=4255||ii.Khmer(l))}function kf(l){for(let o of l)if(xh(o.charCodeAt(0)))return!0;return!1}let jr=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(l){this.pluginStatus=l.pluginStatus,this.pluginURL=l.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(l){this.applyArabicShaping=l.applyArabicShaping,this.processBidirectionalText=l.processBidirectionalText,this.processStyledBidirectionalText=l.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Ki{constructor(o,c){this.zoom=o,c?(this.now=c.now,this.fadeDuration=c.fadeDuration,this.zoomHistory=c.zoomHistory,this.transition=c.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Sa,this.transition={})}isSupportedScript(o){return function(c,d){for(let y of c)if(!Tf(y.charCodeAt(0),d))return!1;return!0}(o,jr.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let o=this.zoom,c=o-Math.floor(o),d=this.crossFadingFactor();return o>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:c+(1-c)*d}:{fromScale:.5,toScale:1,t:1-(1-d)*c}}}class Ir{constructor(o,c){this.property=o,this.value=c,this.expression=function(d,y){if(Jc(d))return new Vo(d,y);if(gt(d)){let w=Ri(d,y);if(w.result==="error")throw new Error(w.value.map(S=>`${S.key}: ${S.message}`).join(", "));return w.value}{let w=d;return y.type==="color"&&typeof d=="string"?w=xi.parse(d):y.type!=="padding"||typeof d!="number"&&!Array.isArray(d)?y.type==="variableAnchorOffsetCollection"&&Array.isArray(d)&&(w=Nr.parse(d)):w=Cr.parse(d),{kind:"constant",evaluate:()=>w}}}(c===void 0?o.specification.default:c,o.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(o,c,d){return this.property.possiblyEvaluate(this,o,c,d)}}class ru{constructor(o){this.property=o,this.value=new Ir(o,void 0)}transitioned(o,c){return new Jd(this.property,this.value,c,ze({},o.transition,this.transition),o.now)}untransitioned(){return new Jd(this.property,this.value,null,{},0)}}class su{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitionablePropertyValues)}getValue(o){return at(this._values[o].value.value)}setValue(o,c){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new ru(this._values[o].property)),this._values[o].value=new Ir(this._values[o].property,c===null?void 0:at(c))}getTransition(o){return at(this._values[o].transition)}setTransition(o,c){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new ru(this._values[o].property)),this._values[o].transition=at(c)||void 0}serialize(){let o={};for(let c of Object.keys(this._values)){let d=this.getValue(c);d!==void 0&&(o[c]=d);let y=this.getTransition(c);y!==void 0&&(o[`${c}-transition`]=y)}return o}transitioned(o,c){let d=new ec(this._properties);for(let y of Object.keys(this._values))d._values[y]=this._values[y].transitioned(o,c._values[y]);return d}untransitioned(){let o=new ec(this._properties);for(let c of Object.keys(this._values))o._values[c]=this._values[c].untransitioned();return o}}class Jd{constructor(o,c,d,y,w){this.property=o,this.value=c,this.begin=w+y.delay||0,this.end=this.begin+y.duration||0,o.specification.transition&&(y.delay||y.duration)&&(this.prior=d)}possiblyEvaluate(o,c,d){let y=o.now||0,w=this.value.possiblyEvaluate(o,c,d),S=this.prior;if(S){if(y>this.end)return this.prior=null,w;if(this.value.isDataDriven())return this.prior=null,w;if(y<this.begin)return S.possiblyEvaluate(o,c,d);{let C=(y-this.begin)/(this.end-this.begin);return this.property.interpolate(S.possiblyEvaluate(o,c,d),w,function(E){if(E<=0)return 0;if(E>=1)return 1;let D=E*E,z=D*E;return 4*(E<.5?z:3*(E-D)+z-.75)}(C))}}return w}}class ec{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,c,d){let y=new ic(this._properties);for(let w of Object.keys(this._values))y._values[w]=this._values[w].possiblyEvaluate(o,c,d);return y}hasTransition(){for(let o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class tc{constructor(o){this._properties=o,this._values=Object.create(o.defaultPropertyValues)}hasValue(o){return this._values[o].value!==void 0}getValue(o){return at(this._values[o].value)}setValue(o,c){this._values[o]=new Ir(this._values[o].property,c===null?void 0:at(c))}serialize(){let o={};for(let c of Object.keys(this._values)){let d=this.getValue(c);d!==void 0&&(o[c]=d)}return o}possiblyEvaluate(o,c,d){let y=new ic(this._properties);for(let w of Object.keys(this._values))y._values[w]=this._values[w].possiblyEvaluate(o,c,d);return y}}class jn{constructor(o,c,d){this.property=o,this.value=c,this.parameters=d}isConstant(){return this.value.kind==="constant"}constantOr(o){return this.value.kind==="constant"?this.value.value:o}evaluate(o,c,d,y){return this.property.evaluate(this.value,this.parameters,o,c,d,y)}}class ic{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class yt{constructor(o){this.specification=o}possiblyEvaluate(o,c){if(o.isDataDriven())throw new Error("Value should not be data driven");return o.expression.evaluate(c)}interpolate(o,c,d){let y=Ar[this.specification.type];return y?y(o,c,d):o}}class Mt{constructor(o,c){this.specification=o,this.overrides=c}possiblyEvaluate(o,c,d,y){return new jn(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(c,null,{},d,y)}:o.expression,c)}interpolate(o,c,d){if(o.value.kind!=="constant"||c.value.kind!=="constant")return o;if(o.value.value===void 0||c.value.value===void 0)return new jn(this,{kind:"constant",value:void 0},o.parameters);let y=Ar[this.specification.type];if(y){let w=y(o.value.value,c.value.value,d);return new jn(this,{kind:"constant",value:w},o.parameters)}return o}evaluate(o,c,d,y,w,S){return o.kind==="constant"?o.value:o.evaluate(c,d,y,w,S)}}class ou extends Mt{possiblyEvaluate(o,c,d,y){if(o.value===void 0)return new jn(this,{kind:"constant",value:void 0},c);if(o.expression.kind==="constant"){let w=o.expression.evaluate(c,null,{},d,y),S=o.property.specification.type==="resolvedImage"&&typeof w!="str
21ing"?w.name:w,C=this._calculate(S,S,S,c);return new jn(this,{kind:"constant",value:C},c)}if(o.expression.kind==="camera"){let w=this._calculate(o.expression.evaluate({zoom:c.zoom-1}),o.expression.evaluate({zoom:c.zoom}),o.expression.evaluate({zoom:c.zoom+1}),c);return new jn(this,{kind:"constant",value:w},c)}return new jn(this,o.expression,c)}evaluate(o,c,d,y,w,S){if(o.kind==="source"){let C=o.evaluate(c,d,y,w,S);return this._calculate(C,C,C,c)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(c.zoom)-1},d,y),o.evaluate({zoom:Math.floor(c.zoom)},d,y),o.evaluate({zoom:Math.floor(c.zoom)+1},d,y),c):o.value}_calculate(o,c,d,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:o,to:c}:{from:d,to:c}}interpolate(o){return o}}class au{constructor(o){this.specification=o}possiblyEvaluate(o,c,d,y){if(o.value!==void 0){if(o.expression.kind==="constant"){let w=o.expression.evaluate(c,null,{},d,y);return this._calculate(w,w,w,c)}return this._calculate(o.expression.evaluate(new Ki(Math.floor(c.zoom-1),c)),o.expression.evaluate(new Ki(Math.floor(c.zoom),c)),o.expression.evaluate(new Ki(Math.floor(c.zoom+1),c)),c)}}_calculate(o,c,d,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:o,to:c}:{from:d,to:c}}interpolate(o){return o}}class vo{constructor(o){this.specification=o}possiblyEvaluate(o,c,d,y){return!!o.expression.evaluate(c,null,{},d,y)}interpolate(){return!1}}class x{constructor(o){this.properties=o,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let c in o){let d=o[c];d.specification.overridable&&this.overridableProperties.push(c);let y=this.defaultPropertyValues[c]=new Ir(d,void 0),w=this.defaultTransitionablePropertyValues[c]=new ru(d);this.defaultTransitioningPropertyValues[c]=w.untransitioned(),this.defaultPossiblyEvaluatedValues[c]=y.possiblyEvaluate({})}}}dt("DataDrivenProperty",Mt),dt("DataConstantProperty",yt),dt("CrossFadedDataDrivenProperty",ou),dt("CrossFadedProperty",au),dt("ColorRampProperty",vo);let s="-transition";class u extends Hs{constructor(o,c){if(super(),this.id=o.id,this.type=o.type,this._featureFilter={filter:()=>!0,needGeometry:!1},o.type!=="custom"&&(this.metadata=o.metadata,this.minzoom=o.minzoom,this.maxzoom=o.maxzoom,o.type!=="background"&&(this.source=o.source,this.sourceLayer=o["source-layer"],this.filter=o.filter),c.layout&&(this._unevaluatedLayout=new tc(c.layout)),c.paint)){this._transitionablePaint=new su(c.paint);for(let d in o.paint)this.setPaintProperty(d,o.paint[d],{validate:!1});for(let d in o.layout)this.setLayoutProperty(d,o.layout[d],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ic(c.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(o){return o==="visibility"?this.visibility:this._unevaluatedLayout.getValue(o)}setLayoutProperty(o,c,d={}){c!=null&&this._validate(ul,`layers.${this.id}.layout.${o}`,o,c,d)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,c):this.visibility=c)}getPaintProperty(o){return o.endsWith(s)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,c,d={}){if(c!=null&&this._validate(xa,`layers.${this.id}.paint.${o}`,o,c,d))return!1;if(o.endsWith(s))return this._transitionablePaint.setTransition(o.slice(0,-11),c||void 0),!1;{let y=this._transitionablePaint._values[o],w=y.property.specification["property-type"]==="cross-faded-data-driven",S=y.value.isDataDriven(),C=y.value;this._transitionablePaint.setValue(o,c),this._handleSpecialPaintPropertyUpdate(o);let E=this._transitionablePaint._values[o].value;return E.isDataDriven()||S||w||this._handleOverridablePaintPropertyUpdate(o,C,E)}}_handleSpecialPaintPropertyUpdate(o){}_handleOverridablePaintPropertyUpdate(o,c,d){return!1}isHidden(o){return!!(this.minzoom&&o<this.minzoom)||!!(this.maxzoom&&o>=this.maxzoom)||this.visibility==="none"}updateTransitions(o){this._transitioningPaint=this._transitionablePaint.transitioned(o,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(o,c){o.getCrossfadeParameters&&(this._crossfadeParameters=o.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(o,void 0,c)),this.paint=this._transitioningPaint.possiblyEvaluate(o,void 0,c)}
21serialize(){let o={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(o.layout=o.layout||{},o.layout.visibility=this.visibility),rt(o,(c,d)=>!(c===void 0||d==="layout"&&!Object.keys(c).length||d==="paint"&&!Object.keys(c).length))}_validate(o,c,d,y,w={}){return(!w||w.validate!==!1)&&wa(this,o.call(go,{key:c,layerType:this.type,objectKey:d,value:y,styleSpec:Ie,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let o in this.paint._values){let c=this.paint.get(o);if(c instanceof jn&&rl(c.property.specification)&&(c.value.kind==="source"||c.value.kind==="composite")&&c.value.isStateDependent)return!0}return!1}}let f={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class g{constructor(o,c){this._structArray=o,this._pos1=c*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class v{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(o,c){return o._trim(),c&&(o.isTransferred=!0,c.push(o.arrayBuffer)),{length:o.length,arrayBuffer:o.arrayBuffer}}static deserialize(o){let c=Object.create(this.prototype);return c.arrayBuffer=o.arrayBuffer,c.length=o.length,c.capacity=o.arrayBuffer.byteLength/c.bytesPerElement,c._refreshViews(),c}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(o){this.reserve(o),this.length=o}reserve(o){if(o>this.capacity){this.capacity=Math.max(o,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let c=this.uint8;this._refreshViews(),c&&this.uint8.set(c)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function A(l,o=1){let c=0,d=0;return{members:l.map(y=>{let w=f[y.type].BYTES_PER_ELEMENT,S=c=I(c,Math.max(o,w)),C=y.components||1;return d=Math.max(d,w),c+=w*C,{name:y.name,type:y.type,components:C,offset:S}}),size:I(c,Math.max(d,o)),alignment:o}}function I(l,o){return Math.ceil(l/o)*o}class L extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c){let d=this.length;return this.resize(d+1),this.emplace(d,o,c)}emplace(o,c,d){let y=2*o;return this.int16[y+0]=c,this.int16[y+1]=d,o}}L.prototype.bytesPerElement=4,dt("StructArrayLayout2i4",L);class O extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,d){let y=this.length;return this.resize(y+1),this.emplace(y,o,c,d)}emplace(o,c,d,y){let w=3*o;return this.int16[w+0]=c,this.int16[w+1]=d,this.int16[w+2]=y,o}}O.prototype.bytesPerElement=6,dt("StructArrayLayout3i6",O);class N extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,d,y){let w=this.length;return this.resize(w+1),this.emplace(w,o,c,d,y)}emplace(o,c,d,y,w){let S=4*o;return this.int16[S+0]=c,this.int16[S+1]=d,this.int16[S+2]=y,this.int16[S+3]=w,o}}N.prototype.bytesPerElement=8,dt("StructArrayLayout4i8",N);class V extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,d,y,w,S){let C=this.length;return this.resize(C+1),this.emplace(C,o,c,d,y,w,S)}emplace(o,c,d,y,w,S,C){let E=6*o;return this.int16[E+0]=c,this.int16[E+1]=d,this.int16[E+2]=y,this.int16[E+3]=w,this.int16[E+4]=S,this.int16[E+5]=C,o}}V.prototype.bytesPerElement=12,dt("StructArrayLayout2i4i12",V);class G extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,d,y,w,S){let C=this.length;return this.resize(C+1),this.emplace(C,o,c,d,y,w,S)}emplace(o,c,d,y,w,S,C){let E=4*o,D=8*o;return this.int16[E+0]=c,this.int16[E+1]=d,this.uint8[D+4]=y,this.uint8[D+5]=w,this.uint8[D+6]=S,this.uint8[D+7]=C,o}}G.prototype.bytesPerElement=8,dt("StructArrayLayout2i4ub8",G);class Q extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c){let d=this.length;return this.resize(d+1),this.emplace(d,o,c)}emplace(o,c,d){let y=2*o;return this.float32[y+0]=c,this.float32[y+1]=d,o}}Q.prototype.bytesPerElement=8,dt("StructArrayLayout2f8",Q);
vendor: 9,155 bytes, line 21
21class ne extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,d,y,w,S,C,E,D,z){let B=this.length;return this.resize(B+1),this.emplace(B,o,c,d,y,w,S,C,E,D,z)}emplace(o,c,d,y,w,S,C,E,D,z,B){let $=10*o;return this.uint16[$+0]=c,this.uint16[$+1]=d,this.uint16[$+2]=y,this.uint16[$+3]=w,this.uint16[$+4]=S,this.uint16[$+5]=C,this.uint16[$+6]=E,this.uint16[$+7]=D,this.uint16[$+8]=z,this.uint16[$+9]=B,o}}ne.prototype.bytesPerElement=20,dt("StructArrayLayout10ui20",ne);class ae extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,d,y,w,S,C,E,D,z,B,$){let H=this.length;return this.resize(H+1),this.emplace(H,o,c,d,y,w,S,C,E,D,z,B,$)}emplace(o,c,d,y,w,S,C,E,D,z,B,$,H){let K=12*o;return this.int16[K+0]=c,this.int16[K+1]=d,this.int16[K+2]=y,this.int16[K+3]=w,this.uint16[K+4]=S,this.uint16[K+5]=C,this.uint16[K+6]=E,this.uint16[K+7]=D,this.int16[K+8]=z,this.int16[K+9]=B,this.int16[K+10]=$,this.int16[K+11]=H,o}}ae.prototype.bytesPerElement=24,dt("StructArrayLayout4i4ui4i24",ae);class he extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,d){let y=this.length;return this.resize(y+1),this.emplace(y,o,c,d)}emplace(o,c,d,y){let w=3*o;return this.float32[w+0]=c,this.float32[w+1]=d,this.float32[w+2]=y,o}}he.prototype.bytesPerElement=12,dt("StructArrayLayout3f12",he);class de extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(o){let c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.uint32[1*o+0]=c,o}}de.prototype.bytesPerElement=4,dt("StructArrayLayout1ul4",de);class me extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,d,y,w,S,C,E,D){let z=this.length;return this.resize(z+1),this.emplace(z,o,c,d,y,w,S,C,E,D)}emplace(o,c,d,y,w,S,C,E,D,z){let B=10*o,$=5*o;return this.int16[B+0]=c,this.int16[B+1]=d,this.int16[B+2]=y,this.int16[B+3]=w,this.int16[B+4]=S,this.int16[B+5]=C,this.uint32[$+3]=E,this.uint16[B+8]=D,this.uint16[B+9]=z,o}}me.prototype.bytesPerElement=20,dt("StructArrayLayout6i1ul2ui20",me);class re extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,d,y,w,S){let C=this.length;return this.resize(C+1),this.emplace(C,o,c,d,y,w,S)}emplace(o,c,d,y,w,S,C){let E=6*o;return this.int16[E+0]=c,this.int16[E+1]=d,this.int16[E+2]=y,this.int16[E+3]=w,this.int16[E+4]=S,this.int16[E+5]=C,o}}re.prototype.bytesPerElement=12,dt("StructArrayLayout2i2i2i12",re);class ve extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,d,y,w){let S=this.length;return this.resize(S+1),this.emplace(S,o,c,d,y,w)}emplace(o,c,d,y,w,S){let C=4*o,E=8*o;return this.float32[C+0]=c,this.float32[C+1]=d,this.float32[C+2]=y,this.int16[E+6]=w,this.int16[E+7]=S,o}}ve.prototype.bytesPerElement=16,dt("StructArrayLayout2f1f2i16",ve);class xe extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,d,y,w,S){let C=this.length;return this.resize(C+1),this.emplace(C,o,c,d,y,w,S)}emplace(o,c,d,y,w,S,C){let E=16*o,D=4*o,z=8*o;return this.uint8[E+0]=c,this.uint8[E+1]=d,this.float32[D+1]=y,this.float32[D+2]=w,this.int16[z+6]=S,this.int16[z+7]=C,o}}xe.prototype.bytesPerElement=16,dt("StructArrayLayout2ub2f2i16",xe);class Ae extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,d){let y=this.length;return this.resize(y+1),this.emplace(y,o,c,d)}emplace(o,c,d,y){let w=3*o;return this.uint16[w+0]=c,this.uint16[w+1]=d,this.uint16[w+2]=y,o}}Ae.prototype.bytesPerElement=6,dt("StructArrayLayout3ui6",Ae);class Ne extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,d,y,w,S,C,E,D,z,B,$,H,K,Z,se,ce){let Ce=this.length;return this.resize(Ce+1),this.emplace(Ce,o,c,d,y,w,S,C,E,D,z,B,$,H,K,Z,se,ce)}emplace(o,c,d,y,w,S,C,E,D,z,B,$,H,K,Z,se,ce,Ce){let ge=24*o,ye=12*o,Pe=48*o;return this.int16[ge+0]=c,this.int16[ge+1]=d,this.uint16[ge+2]=y,this.uint16[ge+3]=w,this.uint32[ye+2]=S,this.uint32[ye+3]=C,this.uint32[ye+4]=E,this.uint16[ge+10]=D,this.uint16[ge+11]=z,this.uint16[ge+12]=B,this.float32[ye+7]=$,this.float32[ye+8]=H,this.uint8[Pe+36]=K,this.uint8[Pe+37]=Z,this.uint8[Pe+38]=se,this.uint32[ye+10]=ce,this.int16[ge+22]=Ce,o}}Ne.prototype.bytesPerElement=48,dt("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ne);class He extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,d,y,w,S,C,E,D,z,B,$,H,K,Z,se,ce,Ce,ge,ye,Pe,qe,lt,kt,ct,nt,vt,pt){let ht=this.length;return this.resize(ht+1),this.emplace(ht,o,c,d,y,w,S,C,E,D,z,B,$,H,K,Z,se,ce,Ce,ge,ye,Pe,qe,lt,kt,ct,nt,vt,pt)}emplace(o,c,d,y,w,S,C,E,D,z,B,$,H,K,Z,se,ce,Ce,ge,ye,Pe,qe,lt,kt,ct,nt,vt,pt,ht){let Fe=32*o,bt=16*o;return this.int16[Fe+0]=c,this.int16[Fe+1]=d,this.int16[Fe+2]=y,this.int16[Fe+3]=w,this.int16[Fe+4]=S,this.int16[Fe+5]=C,this.int16[Fe+6]=E,this.int16[Fe+7]=D,this.uint16[Fe+8]=z,this.uint16[Fe+9]=B,this.uint16[Fe+10]=$,this.uint16[Fe+11]=H,this.uint16[Fe+12]=K,this.uint16[Fe+13]=Z,this.uint16[Fe+14]=se,this.uint16[Fe+15]=ce,this.uint16[Fe+16]=Ce,this.uint16[Fe+17]=ge,this.uint16[Fe+18]=ye,this.uint16[Fe+19]=Pe,this.uint16[Fe+20]=qe,this.uint16[Fe+21]=lt,this.uint16[Fe+22]=kt,this.uint32[bt+12]=ct,this.float32[bt+13]=nt,this.float32[bt+14]=vt,this.uint16[Fe+30]=pt,this.uint16[Fe+31]=ht,o}}He.prototype.bytesPerElement=64,dt("StructArrayLayout8i15ui1ul2f2ui64",He);class tt extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o){let c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.float32[1*o+0]=c,o}}tt.prototype.bytesPerElement=4,dt("StructArrayLayout1f4",tt);class st extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,d){let y=this.length;return this.resize(y+1),this.emplace(y,o,c,d)}emplace(o,c,d,y){let w=3*o;return this.uint16[6*o+0]=c,this.float32[w+1]=d,this.float32[w+2]=y,o}}st.prototype.bytesPerElement=12,dt("StructArrayLayout1ui2f12",st);class Je extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,d){let y=this.length;return this.resize(y+1),this.emplace(y,o,c,d)}emplace(o,c,d,y){let w=4*o;return this.uint32[2*o+0]=c,this.uint16[w+2]=d,this.uint16[w+3]=y,o}}Je.prototype.bytesPerElement=8,dt("StructArrayLayout1ul2ui8",Je);class Qe extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c){let d=this.length;return this.resize(d+1),this.emplace(d,o,c)}emplace(o,c,d){let y=2*o;return this.uint16[y+0]=c,this.uint16[y+1]=d,o}}Qe.prototype.bytesPerElement=4,dt("StructArrayLayout2ui4",Qe);class ft extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o){let c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.uint16[1*o+0]=c,o}}ft.prototype.bytesPerElement=2,dt("StructArrayLayout1ui2",ft);class zt extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,d,y){let w=this.length;return this.resize(w+1),this.emplace(w,o,c,d,y)}emplace(o,c,d,y,w){let S=4*o;return this.float32[S+0]=c,this.float32[S+1]=d,this.float32[S+2]=y,this.float32[S+3]=w,o}}zt.prototype.bytesPerElement=16,dt("StructArrayLayout4f16",zt);class it extends g{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}
vendor: 4,942 bytes, line 21
21get anchorPoint(){return new T(this.anchorPointX,this.anchorPointY)}}it.prototype.size=20;class Ze extends me{get(o){return new it(this,o)}}dt("CollisionBoxArray",Ze);class It extends g{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(o){this._structArray.uint8[this._pos1+37]=o}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(o){this._structArray.uint8[this._pos1+38]=o}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(o){this._structArray.uint32[this._pos4+10]=o}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}It.prototype.size=48;class qi extends Ne{get(o){return new It(this,o)}}dt("PlacedSymbolArray",qi);class Pt extends g{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(o){this._structArray.uint32[this._pos4+12]=o}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Pt.prototype.size=64;class Xt extends He{get(o){return new Pt(this,o)}}dt("SymbolInstanceArray",Xt);class zi extends tt{getoffsetX(o){return this.float32[1*o+0]}}dt("GlyphOffsetArray",zi);class yn extends O{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}dt("SymbolLineVertexArray",yn);class hs extends g{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}hs.prototype.size=12;class Qt extends st{get(o){return new hs(this,o)}}dt("TextAnchorOffsetArray",Qt);class sr extends g{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}sr.prototype.size=8;class br extends Je{get(o){return new sr(this,o)}}dt("FeatureIndexArray",br);class or extends L{}class xr extends L{}class ds extends L{}class fl extends V{}class jo extends G{}class ka extends Q{}class ps extends ne{}class lu extends ae{}class Ca extends he{}class fs extends de{}class ms extends re{}class Ys extends xe{}
21class gs extends Ae{}class Yn extends Qe{}let ar=A([{name:"a_pos",components:2,type:"Int16"}],4),{members:qr}=ar;class ni{constructor(o=[]){this.segments=o}prepareSegment(o,c,d,y){let w=this.segments[this.segments.length-1];return o>ni.MAX_VERTEX_ARRAY_LENGTH&&Tt(`Max vertices per segment is ${ni.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!w||w.vertexLength+o>ni.MAX_VERTEX_ARRAY_LENGTH||w.sortKey!==y)&&(w={vertexOffset:c.length,primitiveOffset:d.length,vertexLength:0,primitiveLength:0},y!==void 0&&(w.sortKey=y),this.segments.push(w)),w}get(){return this.segments}destroy(){for(let o of this.segments)for(let c in o.vaos)o.vaos[c].destroy()}static simpleSegment(o,c,d,y){return new ni([{vertexOffset:o,primitiveOffset:c,vertexLength:d,primitiveLength:y,vaos:{},sortKey:0}])}}function bo(l,o){return 256*(l=Le(Math.floor(l),0,255))+Le(Math.floor(o),0,255)}ni.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,dt("SegmentVector",ni);let ml=A([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var qo={exports:{}},wh={exports:{}};wh.exports=function(l,o){var c,d,y,w,S,C,E,D;for(d=l.length-(c=3&l.length),y=o,S=3432918353,C=461845907,D=0;D<d;)E=255&l.charCodeAt(D)|(255&l.charCodeAt(++D))<<8|(255&l.charCodeAt(++D))<<16|(255&l.charCodeAt(++D))<<24,++D,y=27492+(65535&(w=5*(65535&(y=(y^=E=(65535&(E=(E=(65535&E)*S+(((E>>>16)*S&65535)<<16)&4294967295)<<15|E>>>17))*C+(((E>>>16)*C&65535)<<16)&4294967295)<<13|y>>>19))+((5*(y>>>16)&65535)<<16)&4294967295))+((58964+(w>>>16)&65535)<<16);switch(E=0,c){case 3:E^=(255&l.charCodeAt(D+2))<<16;case 2:E^=(255&l.charCodeAt(D+1))<<8;case 1:y^=E=(65535&(E=(E=(65535&(E^=255&l.charCodeAt(D)))*S+(((E>>>16)*S&65535)<<16)&4294967295)<<15|E>>>17))*C+(((E>>>16)*C&65535)<<16)&4294967295}return y^=l.length,y=2246822507*(65535&(y^=y>>>16))+((2246822507*(y>>>16)&65535)<<16)&4294967295,y=3266489909*(65535&(y^=y>>>13))+((3266489909*(y>
21>>16)&65535)<<16)&4294967295,(y^=y>>>16)>>>0};var Qd=wh.exports,Sh={exports:{}};Sh.exports=function(l,o){for(var c,d=l.length,y=o^d,w=0;d>=4;)c=1540483477*(65535&(c=255&l.charCodeAt(w)|(255&l.charCodeAt(++w))<<8|(255&l.charCodeAt(++w))<<16|(255&l.charCodeAt(++w))<<24))+((1540483477*(c>>>16)&65535)<<16),y=1540483477*(65535&y)+((1540483477*(y>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),d-=4,++w;switch(d){case 3:y^=(255&l.charCodeAt(w+2))<<16;case 2:y^=(255&l.charCodeAt(w+1))<<8;case 1:y=1540483477*(65535&(y^=255&l.charCodeAt(w)))+((1540483477*(y>>>16)&65535)<<16)}return y=1540483477*(65535&(y^=y>>>13))+((1540483477*(y>>>16)&65535)<<16),(y^=y>>>15)>>>0};var Rs=Qd,ep=Sh.exports;qo.exports=Rs,qo.exports.murmur3=Rs,qo.exports.murmur2=ep;var nc=h(qo.exports);class gl{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,c,d,y){this.ids.push(cu(o)),this.positions.push(c,d,y)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let c=cu(o),d=0,y=this.ids.length-1;for(;d<y;){let S=d+y>>1;this.ids[S]>=c?y=S:d=S+1}let w=[];for(;this.ids[d]===c;)w.push({index:this.positions[3*d],start:this.positions[3*d+1],end:this.positions[3*d+2]}),d++;return w}static serialize(o,c){let d=new Float64Array(o.ids),y=new Uint32Array(o.positions);return rc(d,y,0,d.length-1),c&&c.push(d.buffer,y.buffer),{ids:d,positions:y}}static deserialize(o){let c=new gl;return c.ids=o.ids,c.positions=o.positions,c.indexed=!0,c}}function cu(l){let o=+l;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:nc(String(l))}function rc(l,o,c,d){for(;c<d;){let y=l[c+d>>1],w=c-1,S=d+1;for(;;){do w++;while(l[w]<y);do S--;while(l[S]>y);if(w>=S)break;yl(l,w,S),yl(o,3*w,3*S),yl(o,3*w+1,3*S+1),yl(o,3*w+2,3*S+2)}S-c<d-S?(rc(l,o,c,S),c=S+1):(rc(l,o,S+1,d),d=S)}}function yl(l,o,c){let d=l[o];l[o]=l[c],l[c]=d}dt("FeaturePositionMap",gl);class Ma{constructor(o,c){this.gl=o.gl,this.location=c}}class Th extends Ma{constructor(o,c){super(o,c),this.current=0}set(o){this.current!==o&&(this.current=o,this.gl.uniform1f(this.location,o))}}class tp extends Ma{constructor(o,c){super(o,c),this.current=[0,0,0,0]}set(o){o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]&&o[3]===this.current[3]||(this.current=o,this.gl.uniform4f(this.location,o[0],o[1],o[2],o[3]))}}class Vg extends Ma{constructor(o,c){super(o,c),this.current=xi.transparent}set(o){o.r===this.current.r&&o.g===this.current.g&&o.b===this.current.b&&o.a===this.current.a||(this.current=o,this.gl.uniform4f(this.location,o.r,o.g,o.b,o.a))}}let Cf=new Float32Array(16);function ri(l){return[bo(255*l.r,255*l.g),bo(255*l.b,255*l.a)]}class kh{constructor(o,c,d){this.value=o,this.uniformNames=c.map(y=>`u_${y}`),this.type=d}setUniform(o,c,d){o.set(d.constantOr(this.value))}getBinding(o,c,d){return this.type==="color"?new Vg(o,c):new Th(o,c)}}class uu{constructor(o,c){this.uniformNames=c.map(d=>`u_${d}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(o,c){this.pixelRatioFrom=c.pixelRatio,this.pixelRatioTo=o.pixelRatio,this.patternFrom=c.tlbr,this.patternTo=o.tlbr}setUniform(o,c,d,y){let w=y==="u_pattern_to"?this.patternTo:y==="u_pattern_from"?this.patternFrom:y==="u_pixel_ratio_to"?this.pixelRatioTo:y==="u_pixel_ratio_from"?this.pixelRatioFrom:null;w&&o.set(w)}getBinding(o,c,d){return d.substr(0,9)==="u_pattern"?new tp(o,c):new Th(o,c)}}class zs{constructor(o,c,d,y){this.expression=o,this.type=d,this.maxValue=0,this.paintVertexAttributes=c.map(w=>({name:`a_${w}`,type:"Float32",components:d==="color"?2:1,offset:0})),this.paintVertexArray=new y}populatePaintArray(o,c,d,y,w){let S=this.paintVertexArray.length,C=this.expression.evaluate(new Ki(0),c,{},y,[],w);this.paintVertexArray.resize(o),this._setPaintValue(S,o,C)}updatePaintArray(o,c,d,y){let w=this.expression.evaluate({zoom:0},d,y);this._setPaintValue(o,c,w)}_setPaintValue(o,c,d){if(this.type==="color"){let y=ri(d);for(let w=o;w<c;w++)this.paintVertexArray.emplace(w,y[0],y[1])}else{for(let y=o;y<c;y++)this.paintVertexArray.emplace(y,d);this.maxValue=Math.max(this.maxValue,Math.abs(d))}}upload(o){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=o.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Js{constructor(o,c,d,y,w,S){this.expression=o,this.uniformNames=c.map(C=>`u_${C}_t`),this.type=d,this.useIntegerZoom=y,this.zoom=w,this.maxValue=0,this.paintVertexAttributes=c.map(C=>({name:`a_${C}
21`,type:"Float32",components:d==="color"?4:2,offset:0})),this.paintVertexArray=new S}populatePaintArray(o,c,d,y,w){let S=this.expression.evaluate(new Ki(this.zoom),c,{},y,[],w),C=this.expression.evaluate(new Ki(this.zoom+1),c,{},y,[],w),E=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(E,o,S,C)}updatePaintArray(o,c,d,y){let w=this.expression.evaluate({zoom:this.zoom},d,y),S=this.expression.evaluate({zoom:this.zoom+1},d,y);this._setPaintValue(o,c,w,S)}_setPaintValue(o,c,d,y){if(this.type==="color"){let w=ri(d),S=ri(y);for(let C=o;C<c;C++)this.paintVertexArray.emplace(C,w[0],w[1],S[0],S[1])}else{for(let w=o;w<c;w++)this.paintVertexArray.emplace(w,d,y);this.maxValue=Math.max(this.maxValue,Math.abs(d),Math.abs(y))}}upload(o){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=o.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(o,c){let d=this.useIntegerZoom?Math.floor(c.zoom):c.zoom,y=Le(this.expression.interpolationFactor(d,this.zoom,this.zoom+1),0,1);o.set(y)}getBinding(o,c,d){return new Th(o,c)}}class _l{constructor(o,c,d,y,w,S){this.expression=o,this.type=c,this.useIntegerZoom=d,this.zoom=y,this.layerId=S,this.zoomInPaintVertexArray=new w,this.zoomOutPaintVertexArray=new w}populatePaintArray(o,c,d){let y=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(o),this.zoomOutPaintVertexArray.resize(o),this._setPaintValues(y,o,c.patterns&&c.patterns[this.layerId],d)}updatePaintArray(o,c,d,y,w){this._setPaintValues(o,c,d.patterns&&d.patterns[this.layerId],w)}_setPaintValues(o,c,d,y){if(!y||!d)return;let{min:w,mid:S,max:C}=d,E=y[w],D=y[S],z=y[C];if(E&&D&&z)for(let B=o;B<c;B++)this.zoomInPaintVertexArray.emplace(B,D.tl[0],D.tl[1],D.br[0],D.br[1],E.tl[0],E.tl[1],E.br[0],E.br[1],D.pixelRatio,E.pixelRatio),this.zoomOutPaintVertexArray.emplace(B,D.tl[0],D.tl[1],D.br[0],D.br[1],z.tl[0],z.tl[1],z.br[0],z.br[1],D.pixelRatio,z.pixelRatio)}upload(o){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=o.createVertexBuffer(this.zoomInPaintVertexArray,ml.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=o.createVertexBuffer(this.zoomOutPaintVertexArray,ml.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class $g{constructor(o,c,d){this.binders={},this._buffers=[];let y=[];for(let w in o.paint._values){if(!d(w))continue;let S=o.paint.get(w);if(!(S instanceof jn&&rl(S.property.specification)))continue;let C=Rb(w,o.type),E=S.value,D=S.property.specification.type,z=S.property.useIntegerZoom,B=S.property.specification["property-type"],$=B==="cross-faded"||B==="cross-faded-data-driven";if(E.kind==="constant")this.binders[w]=$?new uu(E.value,C):new kh(E.value,C,D),y.push(`/u_${w}`);else if(E.kind==="source"||$){let H=Ch(w,D,"source");this.binders[w]=$?new _l(E,D,z,c,H,o.id):new zs(E,C,D,H),y.push(`/a_${w}`)}else{let H=Ch(w,D,"composite");this.binders[w]=new Js(E,C,D,z,c,H),y.push(`/z_${w}`)}}this.cacheKey=y.sort().join("")}getMaxValue(o){let c=this.binders[o];return c instanceof zs||c instanceof Js?c.maxValue:0}populatePaintArrays(o,c,d,y,w){for(let S in this.binders){let C=this.binders[S];(C instanceof zs||C instanceof Js||C instanceof _l)&&C.populatePaintArray(o,c,d,y,w)}}setConstantPatternPositions(o,c){for(let d in this.binders){let y=this.binders[d];y instanceof uu&&y.setConstantPatternPositions(o,c)}}updatePaintArrays(o,c,d,y,w){let S=!1;for(let C in o){let E=c.getPositions(C);for(let D of E){let z=d.feature(D.index);for(let B in this.binders){let $=this.binders[B];if(($ instanceof zs||$ instanceof Js||$ instanceof _l)&&$.expression.isStateDependent===!0){let H=y.paint.get(B);$.expression=H.value,$.updatePaintArray(D.start,D.end,z,o[C],w),S=!0}}}}return S}defines(){let o=[];for(let c in this.binders){let d=this.binders[c];(d instanceof kh||d instanceof uu)&&o.push(...d.uniformNames.map(y=>`#define HAS_UNIFORM_${y}`))}return o}getBinderAttributes(){let o=[];for(let c in this.binders){let d=this.binders[c];if(d instanceof zs||d instanceof Js)for(let y=0;y<d.paintVertexAttributes.length;y++)o.push(d.paintVertexAttributes[y].name);else if(d instanceof _l)for(let y=0;y<ml.members.length;y++)o.push(ml.members[y].name)}return o}getBinderUniforms(){let o=[];for(let c in this.binders){let d=this.binders[c];if(d instanceof kh||d instanceof uu||d instanceof Js)for(let y of d.uniformNames)o.push(y)}return o}getPaintVertexBuffers(){return this._buffers}getUniforms(o,c){let d=[];for(let y in this.binders){let w=this.binders[y];if(w instanceof kh||w instanceof uu||w instanceof Js){for(let S of w.uniformNames)if(c[S]){let C=w.getBinding(o,c[S],S);d.push({name:S,property:y,binding:C})}}}return d}setUniforms(o,c,d,y){for(let{name:w,property:S,binding:C}of c)this.binders[S].setUniform(C,y,d.get(S),w)}updatePaintBuffers(o){this._buffers=[];for(let c in this.binders){let d=this.binders[c];if(o&&d instanceof _l){let y=o.fromScale===2?d.zoomInPaintVertexBuffer:d.zoomOutPaintVertexBuffer;y&&this._buffers.push(y)}else(d instanceof zs||d instanceof Js)&&d.paintVertexBuffer&&this._buffers.push(d.paintVertexBuffer)}}upload(o){for(let c in this.binders){let d=this.binders[c];(d instanceof zs||d instanceof Js||d instanceof _l)&&d.upload(o)}this.updatePaintBuffers()}destroy(){for(let o in this.binders){let c=this.binders[o];(c instanceof zs||c instanceof Js||c instanceof _l)&&c.destroy()}}}class lr{constructor(o,c,d=()=>!0){this.programConfigurations={};for(let y of o)this.programConfigurations[y.id]=new $g(y,c,d);this.needsUpload=!1,this._featureMap=new gl,this._bufferOffset=0}populatePaintArrays(o,c,d,y,w,S){for(let C in this.programConfigurations)this.programConfigurations[C].populatePaintArrays(o,c,y,w,S);c.id!==void 0&&this._featureMap.add(c.id,d,this._bufferOffset,o),this._bufferOffset=o,this.needsUpload=!0}updatePaintArrays(o,c,d,y){for(let w of d)this.needsUpload=this.programConfigurations[w.id].updatePaintArrays(o,this._featureMap,c,w,y)||this.needsUpload}get(o){return this.programConfigurations[o]}upload(o){if(this.needsUpload){for(let c in this.programConfigurations)this.programConfigurations[c].upload(o);this.needsUpload=!1}}destroy(){for(let o in this.programConfigurations)this.programConfigurations[o].destroy()}}function Rb(l,o){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["ga
21pwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[l]||[l.replace(`${o}-`,"").replace(/-/g,"_")]}function Ch(l,o,c){let d={color:{source:Q,composite:zt},number:{source:tt,composite:Q}},y=function(w){return{"line-pattern":{source:ps,composite:ps},"fill-pattern":{source:ps,composite:ps},"fill-extrusion-pattern":{source:ps,composite:ps}}[w]}(l);return y&&y[c]||d[o][c]}dt("ConstantBinder",kh),dt("CrossFadedConstantBinder",uu),dt("SourceExpressionBinder",zs),dt("CrossFadedCompositeBinder",_l),dt("CompositeExpressionBinder",Js),dt("ProgramConfiguration",$g,{omit:["_buffers"]}),dt("ProgramConfigurationSet",lr);let _n=8192,ip=Math.pow(2,14)-1,Mf=-ip-1;function Jn(l){let o=_n/l.extent,c=l.loadGeometry();for(let d=0;d<c.length;d++){let y=c[d];for(let w=0;w<y.length;w++){let S=y[w],C=Math.round(S.x*o),E=Math.round(S.y*o);S.x=Le(C,Mf,ip),S.y=Le(E,Mf,ip),(C<S.x||C>S.x+1||E<S.y||E>S.y+1)&&Tt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return c}function ys(l,o){return{type:l.type,id:l.id,properties:l.properties,geometry:o?Jn(l):[]}}function hu(l,o,c,d,y){l.emplaceBack(2*o+(d+1)/2,2*c+(y+1)/2)}class np{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(c=>c.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new xr,this.indexArray=new gs,this.segments=new ni,this.programConfigurations=new lr(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,d){let y=this.layers[0],w=[],S=null,C=!1;y.type==="circle"&&(S=y.layout.get("circle-sort-key"),C=!S.isConstant());for(let{feature:E,id:D,index:z,sourceLayerIndex:B}of o){let $=this.layers[0]._featureFilter.needGeometry,H=ys(E,$);if(!this.layers[0]._featureFilter.filter(new Ki(this.zoom),H,d))continue;let K=C?S.evaluate(H,{},d):void 0,Z={id:D,properties:E.properties,type:E.type,sourceLayerIndex:B,index:z,geometry:$?H.geometry:Jn(E),patterns:{},sortKey:K};w.push(Z)}C&&w.sort((E,D)=>E.sortKey-D.sortKey);for(let E of w){let{geometry:D,index:z,sourceLayerIndex:B}=E,$=o[z].feature;this.addFeature(E,D,z,d),c.featureIndex.insert($,D,z,B,this.index)}}update(o,c,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,d)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,qr),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(o,c,d,y){for(let w of c)for(let S of w){let C=S.x,E=S.y;if(C<0||C>=_n||E<0||E>=_n)continue;let D=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),z=D.vertexLength;hu(this.layoutVertexArray,C,E,-1,-1),hu(this.layoutVertexArray,C,E,1,-1),hu(this.layoutVertexArray,C,E,1,1),hu(this.layoutVertexArray,C,E,-1,1),this.indexArray.emplaceBack(z,z+1,z+2),this.indexArray.emplaceBack(z,z+3,z+2),D.vertexLength+=4,D.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,d,{},y)}}function Mh(l,o){for(let c=0;c<l.length;c++)if(sc(o,l[c]))return!0;for(let c=0;c<o.length;c++)if(sc(l,o[c]))return!0;return!!Ah(l,o)}function Ug(l,o,c){return!!sc(l,o)||!!Ho(o,l,c)}function rp(l,o){if(l.length===1)return Aa(o,l[0]);for(let c=0;c<o.length;c++){let d=o[c];for(let y=0;y<d.length;y++)if(sc(l,d[y]))return!0}for(let c=0;c<l.length;c++)if(Aa(o,l[c]))return!0;for(let c=0;c<o.length;c++)if(Ah(l,o[c]))return!0;return!1}function jg(l,o,c){if(l.length>1){if(Ah(l,o))return!0;for(let d=0;d<o.length;d++)if(Ho(o[d],l,c))return!0}for(let d=0;d<l.length;d++)if(Ho(l[d],o,c))return!0;return!1}function Ah(l,o){if(l.length===0||o.length===0)return!1;for(let c=0;c<l.length-1;c++){let d=l[c],y=l[c+1];for(let w=0;w<o.length-1;w++)if(Af(d,y,o[w],o[w+1]))return!0}return!1}function Af(l,o,c,d){return Lt(l,c,d)!==Lt(o,c,d)&&Lt(l,o,c)!==Lt(l,o,d)}function Ho(l,o,c){let d=c*c;if(o.length===1)return l.distSqr(o[0])<d;for(let y=1;y<o.length;y++)if(qg(l,o[y-1],o[y])<d)return!0;return!1}function qg(l,o,c){let d=o.distSqr(c);if(d===0)return l.distSqr(o);let y=((l.x-o.x)*(c.x-o.x)+(l.y-o.y)*(c.y-o.y))/d;return l.distSqr(y<0?o:y>1?c:c.sub(o)._mult(y)._add(o))}function Aa(l,o){let c,d,y,w=!1;for(let S=0;S<l.length;S++){c=l[S];for(let C=0,E=c.length-1;C<c.length;E=C++)d=c[C],y=c[E],d.y>o.y!=y.y>o.y&&o.x<(y.x-d.x)*(o.y-d.y)/(y.y-d.y)+d.x&&(w=!w)}return w}function sc(l,o){let c=!1;for(let d=0,y=l.length-1;d<l.length;y=d++){let w=l[d],S=l[y];w.y>o.y!=S.y>o.y&&o.x<(S.x-w.x)*(o.y-w.y)/(S.y-w.y)+w.x&&(c=!c)}return c}function Hg(l,o,c){let d=c[0],y=c[2];if(l.x<d.x&&o.x<d.x||l.x>y.x&&o.x>y.x||l.y<d.y&&o.y<d.y||l.y>y.y&&o.y>y.y)return!1;let w=Lt(l,o,c[0]);return w!==Lt(l,o,c[1])||w!==Lt(l,o,c[2])||w!==Lt(l,o,c[3])}function oc(l,o,c){let d=o.paint.get(l).value;return d.kind==="constant"?d.value:c.programConfigurations.get(o.id).getMaxValue(l)}function sp(l){return Math.sqrt(l[0]*l[0]+l[1]*l[1])}
21function op(l,o,c,d,y){if(!o[0]&&!o[1])return l;let w=T.convert(o)._mult(y);c==="viewport"&&w._rotate(-d);let S=[];for(let C=0;C<l.length;C++)S.push(l[C].sub(w));return S}let Wg,Ef;dt("CircleBucket",np,{omit:["layers"]});var Gg={get paint(){return Ef=Ef||new x({"circle-radius":new Mt(Ie.paint_circle["circle-radius"]),"circle-color":new Mt(Ie.paint_circle["circle-color"]),"circle-blur":new Mt(Ie.paint_circle["circle-blur"]),"circle-opacity":new Mt(Ie.paint_circle["circle-opacity"]),"circle-translate":new yt(Ie.paint_circle["circle-translate"]),"circle-translate-anchor":new yt(Ie.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new yt(Ie.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new yt(Ie.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Mt(Ie.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Mt(Ie.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Mt(Ie.paint_circle["circle-stroke-opacity"])})},get layout(){return Wg=Wg||new x({"circle-sort-key":new Mt(Ie.layout_circle["circle-sort-key"])})}},Lr=1e-6,ac=typeof Float32Array<"u"?Float32Array:Array;function ap(l){return l[0]=1,l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=1,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[10]=1,l[11]=0,l[12]=0,l[13]=0,l[14]=0,l[15]=1,l}function Hr(l,o,c){var d=o[0],y=o[1],w=o[2],S=o[3],C=o[4],E=o[5],D=o[6],z=o[7],B=o[8],$=o[9],H=o[10],K=o[11],Z=o[12],se=o[13],ce=o[14],Ce=o[15],ge=c[0],ye=c[1],Pe=c[2],qe=c[3];return l[0]=ge*d+ye*C+Pe*B+qe*Z,l[1]=ge*y+ye*E+Pe*$+qe*se,l[2]=ge*w+ye*D+Pe*H+qe*ce,l[3]=ge*S+ye*z+Pe*K+qe*Ce,l[4]=(ge=c[4])*d+(ye=c[5])*C+(Pe=c[6])*B+(qe=c[7])*Z,l[5]=ge*y+ye*E+Pe*$+qe*se,l[6]=ge*w+ye*D+Pe*H+qe*ce,l[7]=ge*S+ye*z+Pe*K+qe*Ce,l[8]=(ge=c[8])*d+(ye=c[9])*C+(Pe=c[10])*B+(qe=c[11])*Z,l[9]=ge*y+ye*E+Pe*$+qe*se,l[10]=ge*w+ye*D+Pe*H+qe*ce,l[11]=ge*S+ye*z+Pe*K+qe*Ce,l[12]=(ge=c[12])*d+(ye=c[13])*C+(Pe=c[14])*B+(qe=c[15])*Z,l[13]=ge*y+ye*E+Pe*$+qe*se,l[14]=ge*w+ye*D+Pe*H+qe*ce,l[15]=ge*S+ye*z+Pe*K+qe*Ce,l}Math.hypot||(Math.hypot=function(){for(var l=0,o=arguments.length;o--;)l+=arguments[o]*arguments[o];return Math.sqrt(l)});var _s,zb=Hr;function lp(l,o,c){var d=o[0],y=o[1],w=o[2],S=o[3];return l[0]=c[0]*d+c[4]*y+c[8]*w+c[12]*S,l[1]=c[1]*d+c[5]*y+c[9]*w+c[13]*S,l[2]=c[2]*d+c[6]*y+c[10]*w+c[14]*S,l[3]=c[3]*d+c[7]*y+c[11]*w+c[15]*S,l}_s=new ac(4),ac!=Float32Array&&(_s[0]=0,_s[1]=0,_s[2]=0,_s[3]=0);class cp extends u{constructor(o){super(o,Gg)}createBucket(o){return new np(o)}queryRadius(o){let c=o;return oc("circle-radius",this,c)+oc("circle-stroke-width",this,c)+sp(this.paint.get("circle-translate"))}queryIntersectsFeature(o,c,d,y,w,S,C,E){let D=op(o,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),S.angle,C),z=this.paint.get("circle-radius").evaluate(c,d)+this.paint.get("circle-stroke-width").evaluate(c,d),B=this.paint.get("circle-pitch-alignment")==="map",$=B?D:function(K,Z){return K.map(se=>lc(se,Z))}(D,E),H=B?z*C:z;for(let K of y)for(let Z of K){let se=B?Z:lc(Z,E),ce=H,Ce=lp([],[Z.x,Z.y,0,1],E);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?ce*=Ce[3]/S.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(ce*=S.cameraToCenterDistance/Ce[3]),Ug($,se,ce))return!0}return!1}}function lc(l,o){let c=lp([],[l.x,l.y,0,1],o);return new T(c[0]/c[3],c[1]/c[3])}class If extends np{}let Lf;dt("HeatmapBucket",If,{omit:["layers"]});var Ob={get paint(){return Lf=Lf||new x({"heatmap-radius":new Mt(Ie.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Mt(Ie.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new yt(Ie.paint_heatmap["heatmap-intensity"]),"heatmap-color":new vo(Ie.paint_heatmap["heatmap-color"]),"heatmap-opacity":new yt(Ie.paint_heatmap["heatmap-opacity"])})}};function up(l,{width:o,height:c},d,y){if(y){if(y instanceof Uint8ClampedArray)y=new Uint8Array(y.buffer);else if(y.length!==o*c*d)throw new RangeError(`mismatched image size. expected: ${y.length} but got: ${o*c*d}`)}else y=new Uint8Array(o*c*d);return l.width=o,l.height=c,l.data=y,l}function cc(l,{width:o,height:c},d){if(o===l.width&&c===l.height)return;let y=up({},{width:o,height:c},d);uc(l,y,{x:0,y:0},{x:0,y:0},{width:Math.min(l.width,o),height:Math.min(l.height,c)},d),l.width=o,l.height=c,l.data=y.data}function uc(l,o,c,d,y,w){if(y.width===0||y.height===0)return o;if(y.width>l.width||y.height>l.height||c.x>l.width-y.width||c.y>l.height-y.height)throw new RangeError("out of range source coordinates for image copy");if(y.width>o.width||y.height>o.height||d.x>o.width-y.width||d.y>o.height-y.height)throw new RangeError("out of range destination coordinates for image copy");let S=l.data,C=o.data;if(S===C)throw new Error("srcData equals dstData, so image is already copied");for(let E=0;E<y.height;E++){let D=((c.y+E)*l.width+c.x)*w,z=((d.y+E)*o.width+d.x)*w;for(let B=0;B<y.width*w;B++)C[z+B]=S[D+B]}return o}class Eh{constructor(o,c){up(this,o,1,c)}resize(o){cc(this,o,1)}clone(){return new Eh({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(o,c,d,y,w){uc(o,c,d,y,w,1)}}class vs{constructor(o,c){up(this,o,4,c)}resize(o){cc(this,o,4)}replace(o,c){c?this.data.set(o):this.data=o instanceof Uint8ClampedArray?new Uint8Array(o.buffer):o}clone(){return new vs({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(o,c,d,y,w){uc(o,c,d,y,w,4)}}function Pf(l){let o={},c=l.resolution||256,d=l.clips?l.clips.length:1,y=l.image||new vs({width:c,height:d});if(Math.log(c)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${c}`);let w=(S,C,E)=>{o[l.evaluationKey]=E;let D=l.expression.evaluate(o);y.data[S+C+0]=Math.floor(255*D.r/D.a),y.data[S+C+1]=Math.floor(255*D.g/D.a),y.data[S+C+2]=Math.floor(255*D.b/D.a),y.data[S+C+3]=Math.floor(255*D.a)};if(l.clips)for(let S=0,C=0;S<d;++S,C+=4*c)for(let E=0,D=0;E<c;E++,D+=4){let z=E/(c-1),{start:B,end:$}=l.clips[S];w(C,D,B*(1-z)+$*z)}else for(let S=0,C=0;S<c;S++,C+=4)w(0,C,S/(c-1));return y}dt("AlphaImage",Eh),dt("RGBAImage",vs);let du="big-fb";class Zg extends u{createBucket(o){return new If(o)}constructor(o){super(o,Ob),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(o){o==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Pf({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}
21resize(){this.heatmapFbos.has(du)&&this.heatmapFbos.delete(du)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let Ih;var Df={get paint(){return Ih=Ih||new x({"hillshade-illumination-direction":new yt(Ie.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new yt(Ie.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new yt(Ie.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new yt(Ie.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new yt(Ie.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new yt(Ie.paint_hillshade["hillshade-accent-color"])})}};class hp extends u{constructor(o){super(o,Df)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}let Fb=A([{name:"a_pos",components:2,type:"Int16"}],4),{members:Kg}=Fb;function Lh(l,o,c=2){let d=o&&o.length,y=d?o[0]*c:l.length,w=Rf(l,0,y,c,!0),S=[];if(!w||w.next===w.prev)return S;let C,E,D;if(d&&(w=function(z,B,$,H){let K=[];for(let Z=0,se=B.length;Z<se;Z++){let ce=Rf(z,B[Z]*H,Z<se-1?B[Z+1]*H:z.length,H,!1);ce===ce.next&&(ce.steiner=!0),K.push(La(ce))}K.sort(Bb);for(let Z=0;Z<K.length;Z++)$=Qg(K[Z],$);return $}(l,o,w,c)),l.length>80*c){C=1/0,E=1/0;let z=-1/0,B=-1/0;for(let $=c;$<y;$+=c){let H=l[$],K=l[$+1];H<C&&(C=H),K<E&&(E=K),H>z&&(z=H),K>B&&(B=K)}D=Math.max(z-C,B-E),D=D!==0?32767/D:0}return Ph(w,S,c,C,E,D,0),S}function Rf(l,o,c,d,y){let w;if(y===function(S,C,E,D){let z=0;for(let B=C,$=E-D;B<E;B+=D)z+=(S[$]-S[B])*(S[B+1]+S[$+1]),$=B;return z}(l,o,c,d)>0)for(let S=o;S<c;S+=d)w=ey(S/d|0,l[S],l[S+1],w);else for(let S=c-d;S>=o;S-=d)w=ey(S/d|0,l[S],l[S+1],w);return w&&hc(w,w.next)&&(mc(w),w=w.next),w}function Ea(l,o){if(!l)return l;o||(o=l);let c,d=l;do if(c=!1,d.steiner||!hc(d,d.next)&&un(d.prev,d,d.next)!==0)d=d.next;else{if(mc(d),d=o=d.prev,d===d.next)break;c=!0}while(c||d!==o);return o}function Ph(l,o,c,d,y,w,S){if(!l)return;!S&&w&&function(E,D,z,B){let $=E;do $.z===0&&($.z=zf($.x,$.y,D,z,B)),$.prevZ=$.prev,$.nextZ=$.next,$=$.next;while($!==E);$.prevZ.nextZ=null,$.prevZ=null,function(H){let K,Z=1;do{let se,ce=H;H=null;let Ce=null;for(K=0;ce;){K++;let ge=ce,ye=0;for(let qe=0;qe<Z&&(ye++,ge=ge.nextZ,ge);qe++);let Pe=Z;for(;ye>0||Pe>0&&ge;)ye!==0&&(Pe===0||!ge||ce.z<=ge.z)?(se=ce,ce=ce.nextZ,ye--):(se=ge,ge=ge.nextZ,Pe--),Ce?Ce.nextZ=se:H=se,se.prevZ=Ce,Ce=se;ce=ge}Ce.nextZ=null,Z*=2}while(K>1)}($)}(l,d,y,w);let C=l;for(;l.prev!==l.next;){let E=l.prev,D=l.next;if(w?Ia(l,d,y,w):Xg(l))o.push(E.i,l.i,D.i),mc(l),l=D.next,C=D.next;else if((l=D)===C){S?S===1?Ph(l=Yg(Ea(l),o),o,c,d,y,w,2):S===2&&Jg(l,o,c,d,y,w):Ph(Ea(l),o,c,d,y,w,1);break}}}function Xg(l){let o=l.prev,c=l,d=l.next;if(un(o,c,d)>=0)return!1;let y=o.x,w=c.x,S=d.x,C=o.y,E=c.y,D=d.y,z=y<w?y<S?y:S:w<S?w:S,B=C<E?C<D?C:D:E<D?E:D,$=y>w?y>S?y:S:w>S?w:S,H=C>E?C>D?C:D:E>D?E:D,K=d.next;for(;K!==o;){if(K.x>=z&&K.x<=$&&K.y>=B&&K.y<=H&&vl(y,C,w,E,S,D,K.x,K.y)&&un(K.prev,K,K.next)>=0)return!1;K=K.next}return!0}function Ia(l,o,c,d){let y=l.prev,w=l,S=l.next;if(un(y,w,S)>=0)return!1;let C=y.x,E=w.x,D=S.x,z=y.y,B=w.y,$=S.y,H=C<E?C<D?C:D:E<D?E:D,K=z<B?z<$?z:$:B<$?B:$,Z=C>E?C>D?C:D:E>D?E:D,se=z>B?z>$?z:$:B>$?B:$,ce=zf(H,K,o,c,d),Ce=zf(Z,se,o,c,d),ge=l.prevZ,ye=l.nextZ;for(;ge&&ge.z>=ce&&ye&&ye.z<=Ce;){if(ge.x>=H&&ge.x<=Z&&ge.y>=K&&ge.y<=se&&ge!==y&&ge!==S&&vl(C,z,E,B,D,$,ge.x,ge.y)&&un(ge.prev,ge,ge.next)>=0||(ge=ge.prevZ,ye.x>=H&&ye.x<=Z&&ye.y>=K&&ye.y<=se&&ye!==y&&ye!==S&&vl(C,z,E,B,D,$,ye.x,ye.y)&&un(ye.prev,ye,ye.next)>=0))return!1;ye=ye.nextZ}for(;ge&&ge.z>=ce;){if(ge.x>=H&&ge.x<=Z&&ge.y>=K&&ge.y<=se&&ge!==y&&ge!==S&&vl(C,z,E,B,D,$,ge.x,ge.y)&&un(ge.prev,ge,ge.next)>=0)return!1;ge=ge.prevZ}for(;ye&&ye.z<=Ce;){if(ye.x>=H&&ye.x<=Z&&ye.y>=K&&ye.y<=se&&ye!==y&&ye!==S&&vl(C,z,E,B,D,$,ye.x,ye.y)&&un(ye.prev,ye,ye.next)>=0)return!1;ye=ye.nextZ}return!0}function Yg(l,o){let c=l;do{let d=c.prev,y=c.next.next;!hc(d,y)&&dc(d,c,c.next,y)&&fc(d,y)&&fc(y,d)&&(o.push(d.i,c.i,y.i),mc(c),mc(c.next),c=l=y),c=c.next}while(c!==l);return Ea(c)}function Jg(l,o,c,d,y,w){let S=l;do{let C=S.next.next;for(;C!==S.prev;){if(S.i!==C.i&&Of(S,C)){let E=bl(S,C);
vendor: 4,722 bytes, line 21
21return S=Ea(S,S.next),E=Ea(E,E.next),Ph(S,o,c,d,y,w,0),void Ph(E,o,c,d,y,w,0)}C=C.next}S=S.next}while(S!==l)}function Bb(l,o){return l.x-o.x}function Qg(l,o){let c=function(y,w){let S=w,C=y.x,E=y.y,D,z=-1/0;do{if(E<=S.y&&E>=S.next.y&&S.next.y!==S.y){let Z=S.x+(E-S.y)*(S.next.x-S.x)/(S.next.y-S.y);if(Z<=C&&Z>z&&(z=Z,D=S.x<S.next.x?S:S.next,Z===C))return D}S=S.next}while(S!==w);if(!D)return null;let B=D,$=D.x,H=D.y,K=1/0;S=D;do{if(C>=S.x&&S.x>=$&&C!==S.x&&vl(E<H?C:z,E,$,H,E<H?z:C,E,S.x,S.y)){let Z=Math.abs(E-S.y)/(C-S.x);fc(S,y)&&(Z<K||Z===K&&(S.x>D.x||S.x===D.x&&Nb(D,S)))&&(D=S,K=Z)}S=S.next}while(S!==B);return D}(l,o);if(!c)return o;let d=bl(c,l);return Ea(d,d.next),Ea(c,c.next)}function Nb(l,o){return un(l.prev,l,o.prev)<0&&un(o.next,l,l.next)<0}function zf(l,o,c,d,y){return(l=1431655765&((l=858993459&((l=252645135&((l=16711935&((l=(l-c)*y|0)|l<<8))|l<<4))|l<<2))|l<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-d)*y|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function La(l){let o=l,c=l;do(o.x<c.x||o.x===c.x&&o.y<c.y)&&(c=o),o=o.next;while(o!==l);return c}function vl(l,o,c,d,y,w,S,C){return(y-S)*(o-C)>=(l-S)*(w-C)&&(l-S)*(d-C)>=(c-S)*(o-C)&&(c-S)*(w-C)>=(y-S)*(d-C)}function Of(l,o){return l.next.i!==o.i&&l.prev.i!==o.i&&!function(c,d){let y=c;do{if(y.i!==c.i&&y.next.i!==c.i&&y.i!==d.i&&y.next.i!==d.i&&dc(y,y.next,c,d))return!0;y=y.next}while(y!==c);return!1}(l,o)&&(fc(l,o)&&fc(o,l)&&function(c,d){let y=c,w=!1,S=(c.x+d.x)/2,C=(c.y+d.y)/2;do y.y>C!=y.next.y>C&&y.next.y!==y.y&&S<(y.next.x-y.x)*(C-y.y)/(y.next.y-y.y)+y.x&&(w=!w),y=y.next;while(y!==c);return w}(l,o)&&(un(l.prev,l,o.prev)||un(l,o.prev,o))||hc(l,o)&&un(l.prev,l,l.next)>0&&un(o.prev,o,o.next)>0)}function un(l,o,c){return(o.y-l.y)*(c.x-o.x)-(o.x-l.x)*(c.y-o.y)}function hc(l,o){return l.x===o.x&&l.y===o.y}function dc(l,o,c,d){let y=pc(un(l,o,c)),w=pc(un(l,o,d)),S=pc(un(c,d,l)),C=pc(un(c,d,o));return y!==w&&S!==C||!(y!==0||!Dt(l,c,o))||!(w!==0||!Dt(l,d,o))||!(S!==0||!Dt(c,l,d))||!(C!==0||!Dt(c,o,d))}function Dt(l,o,c){return o.x<=Math.max(l.x,c.x)&&o.x>=Math.min(l.x,c.x)&&o.y<=Math.max(l.y,c.y)&&o.y>=Math.min(l.y,c.y)}function pc(l){return l>0?1:l<0?-1:0}function fc(l,o){return un(l.prev,l,l.next)<0?un(l,o,l.next)>=0&&un(l,l.prev,o)>=0:un(l,o,l.prev)<0||un(l,l.next,o)<0}function bl(l,o){let c=dp(l.i,l.x,l.y),d=dp(o.i,o.x,o.y),y=l.next,w=o.prev;return l.next=o,o.prev=l,c.next=y,y.prev=c,d.next=c,c.prev=d,w.next=d,d.prev=w,d}function ey(l,o,c,d){let y=dp(l,o,c);return d?(y.next=d.next,y.prev=d,d.next.prev=y,d.next=y):(y.prev=y,y.next=y),y}function mc(l){l.next.prev=l.prev,l.prev.next=l.next,l.prevZ&&(l.prevZ.nextZ=l.nextZ),l.nextZ&&(l.nextZ.prevZ=l.prevZ)}function dp(l,o,c){return{i:l,x:o,y:c,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function cr(l,o,c){let d=c.patternDependencies,y=!1;for(let w of o){let S=w.paint.get(`${l}-pattern`);S.isConstant()||(y=!0);let C=S.constantOr(null);C&&(y=!0,d[C.to]=!0,d[C.from]=!0)}return y}function Ff(l,o,c,d,y){let w=y.patternDependencies;for(let S of o){let C=S.paint.get(`${l}-pattern`).value;if(C.kind!=="constant"){let E=C.evaluate({zoom:d-1},c,{},y.availableImages),D=C.evaluate({zoom:d},c,{},y.availableImages),z=C.evaluate({zoom:d+1},c,{},y.availableImages);E=E&&E.name?E.name:E,D=D&&D.name?D.name:D,z=z&&z.name?z.name:z,w[E]=!0,w[D]=!0,w[z]=!0,c.patterns[S.id]={min:E,mid:D,max:z}}}return c}class Bf{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(c=>c.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ds,this.indexArray=new gs,this.indexArray2=new Yn,this.programConfigurations=new lr(o.layers,o.zoom),this.segments=new ni,this.segments2=new ni,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,d){this.hasPattern=cr("fill",this.layers,c);let y=this.layers[0].layout.get("fill-sort-key"),w=!y.isConstant(),S=[];for(let{feature:C,id:E,index:D,sourceLayerIndex:z}of o){let B=this.layers[0]._featureFilter.needGeometry,$=ys(C,B);if(!this.layers[0]._featureFilter.filter(new Ki(this.zoom),$,d))continue;let H=w?y.evaluate($,{},d,c.availableImages):void 0,K={id:E,properties:C.properties,type:C.type,sourceLayerIndex:z,index:D,geometry:B?$.geometry:Jn(C),patterns:{},sortKey:H};S.push(K)}w&&S.sort((C,E)=>C.sortKey-E.sortKey);for(let C of S){let{geometry:E,index:D,sourceLayerIndex:z}=C;if(this.hasPattern){let B=Ff("fill",this.layers,C,this.zoom,c);this.patternFeatures.push(B)}else this.addFeature(C,E,D,d,{});c.featureIndex.insert(o[D].feature,E,D,z,this.index)}}update(o,c,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,d)}
21addFeatures(o,c,d){for(let y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,c,d)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,Kg),this.indexBuffer=o.createIndexBuffer(this.indexArray),this.indexBuffer2=o.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(o,c,d,y,w){for(let S of ji(c,500)){let C=0;for(let H of S)C+=H.length;let E=this.segments.prepareSegment(C,this.layoutVertexArray,this.indexArray),D=E.vertexLength,z=[],B=[];for(let H of S){if(H.length===0)continue;H!==S[0]&&B.push(z.length/2);let K=this.segments2.prepareSegment(H.length,this.layoutVertexArray,this.indexArray2),Z=K.vertexLength;this.layoutVertexArray.emplaceBack(H[0].x,H[0].y),this.indexArray2.emplaceBack(Z+H.length-1,Z),z.push(H[0].x),z.push(H[0].y);for(let se=1;se<H.length;se++)this.layoutVertexArray.emplaceBack(H[se].x,H[se].y),this.indexArray2.emplaceBack(Z+se-1,Z+se),z.push(H[se].x),z.push(H[se].y);K.vertexLength+=H.length,K.primitiveLength+=H.length}let $=Lh(z,B);for(let H=0;H<$.length;H+=3)this.indexArray.emplaceBack(D+$[H],D+$[H+1],D+$[H+2]);E.vertexLength+=C,E.primitiveLength+=$.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,d,w,y)}}let Nf,ty;dt("FillBucket",Bf,{omit:["layers","patternFeatures"]});var iy={get paint(){return ty=ty||new x({"fill-antialias":new yt(Ie.paint_fill["fill-antialias"]),"fill-opacity":new Mt(Ie.paint_fill["fill-opacity"]),"fill-color":new Mt(Ie.paint_fill["fill-color"]),"fill-outline-color":new Mt(Ie.paint_fill["fill-outline-color"]),"fill-translate":new yt(Ie.paint_fill["fill-translate"]),"fill-translate-anchor":new yt(Ie.paint_fill["fill-translate-anchor"]),"fill-pattern":new ou(Ie.paint_fill["fill-pattern"])})},get layout(){return Nf=Nf||new x({"fill-sort-key":new Mt(Ie.layout_fill["fill-sort-key"])})}};class Vb extends u{constructor(o){super(o,iy)}recalculate(o,c){super.recalculate(o,c);let d=this.paint._values["fill-outline-color"];d.value.kind==="constant"&&d.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(o){return new Bf(o)}queryRadius(){return sp(this.paint.get("fill-translate"))}queryIntersectsFeature(o,c,d,y,w,S,C){return rp(op(o,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),S.angle,C),y)}isTileClipped(){return!0}}let $b=A([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Ub=A([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Pa}=$b;var kn={},Vf=m,ny=xl;function xl(l,o,c,d,y){this.properties={},this.extent=c,this.type=0,this._pbf=l,this._geometry=-1,this._keys=d,this._values=y,l.readFields(jb,this,o)}function jb(l,o,c){l==1?o.id=c.readVarint():l==2?function(d,y){for(var w=d.readVarint()+d.pos;d.pos<w;){var S=y._keys[d.readVarint()],C=y._values[d.readVarint()];y.properties[S]=C}}(c,o):l==3?o.type=c.readVarint():l==4&&(o._geometry=c.pos)}function qb(l){for(var o,c,d=0,y=0,w=l.length,S=w-1;y<w;S=y++)d+=((c=l[S]).x-(o=l[y]).x)*(o.y+c.y);return d}xl.types=["Unknown","Point","LineString","Polygon"],xl.prototype.loadGeometry=function(){var l=this._pbf;l.pos=this._geometry;for(var o,c=l.readVarint()+l.pos,d=1,y=0,w=0,S=0,C=[];l.pos<c;){if(y<=0){var E=l.readVarint();d=7&E,y=E>>3}if(y--,d===1||d===2)w+=l.readSVarint(),S+=l.readSVarint(),d===1&&(o&&C.push(o),o=[]),o.push(new Vf(w,S));else{if(d!==7)throw new Error("unknown command "+d);o&&o.push(o[0].clone())}}return o&&C.push(o),C},xl.prototype.bbox=function(){var l=this._pbf;l.pos=this._geometry;for(var o=l.readVarint()+l.pos,c=1,d=0,y=0,w=0,S=1/0,C=-1/0,E=1/0,D=-1/0;l.pos<o;){if(d<=0){var z=l.readVarint();c=7&z,d=z>>3}if(d--,c===1||c===2)(y+=l.readSVarint())<S&&(S=y),y>C&&(C=y),(w+=l.readSVarint())<E&&(E=w),w>D&&(D=w);else if(c!==7)throw new Error("unknown command "+c)}return[S,E,C,D]},xl.prototype.toGeoJSON=function(l,o,c){var d,y,w=this.extent*Math.pow(2,c),S=this.extent*l,C=this.extent*o,E=this.loadGeometry(),D=xl.types[this.type];function z(H){for(var K=0;K<H.length;K++){var Z=H[K];H[K]=[360*(Z.x+S)/w-180,360/Math.PI*Math.atan(Math.exp((180-360*(Z.y+C)/w)*Math.PI/180)
21)-90]}}switch(this.type){case 1:var B=[];for(d=0;d<E.length;d++)B[d]=E[d][0];z(E=B);break;case 2:for(d=0;d<E.length;d++)z(E[d]);break;case 3:for(E=function(H){var K=H.length;if(K<=1)return[H];for(var Z,se,ce=[],Ce=0;Ce<K;Ce++){var ge=qb(H[Ce]);ge!==0&&(se===void 0&&(se=ge<0),se===ge<0?(Z&&ce.push(Z),Z=[H[Ce]]):Z.push(H[Ce]))}return Z&&ce.push(Z),ce}(E),d=0;d<E.length;d++)for(y=0;y<E[d].length;y++)z(E[d][y])}E.length===1?E=E[0]:D="Multi"+D;var $={type:"Feature",geometry:{type:D,coordinates:E},properties:this.properties};return"id"in this&&($.id=this.id),$};var Dh=ny,$f=Uf;function Uf(l,o){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=l,this._keys=[],this._values=[],this._features=[],l.readFields(Hb,this,o),this.length=this._features.length}function Hb(l,o,c){l===15?o.version=c.readVarint():l===1?o.name=c.readString():l===5?o.extent=c.readVarint():l===2?o._features.push(c.pos):l===3?o._keys.push(c.readString()):l===4&&o._values.push(function(d){for(var y=null,w=d.readVarint()+d.pos;d.pos<w;){var S=d.readVarint()>>3;y=S===1?d.readString():S===2?d.readFloat():S===3?d.readDouble():S===4?d.readVarint64():S===5?d.readVarint():S===6?d.readSVarint():S===7?d.readBoolean():null}return y}(c))}Uf.prototype.feature=function(l){if(l<0||l>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[l];var o=this._pbf.readVarint()+this._pbf.pos;return new Dh(this._pbf,o,this.extent,this._keys,this._values)};var Wb=$f;function Gb(l,o,c){if(l===3){var d=new Wb(c,c.readVarint()+c.pos);d.length&&(o[d.name]=d)}}kn.VectorTile=function(l,o){this.layers=l.readFields(Gb,{},o)},kn.VectorTileFeature=ny,kn.VectorTileLayer=$f;let Zb=kn.VectorTileFeature.types,pp=Math.pow(2,13);function pu(l,o,c,d,y,w,S,C){l.emplaceBack(o,c,2*Math.floor(d*pp)+S,y*pp*2,w*pp*2,Math.round(C))}class jf{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(c=>c.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new fl,this.centroidVertexArray=new or,this.indexArray=new gs,this.programConfigurations=new lr(o.layers,o.zoom),this.segments=new ni,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,d){this.features=[],this.hasPattern=cr("fill-extrusion",this.layers,c);for(let{feature:y,id:w,index:S,sourceLayerIndex:C}of o){let E=this.layers[0]._featureFilter.needGeometry,D=ys(y,E);if(!this.layers[0]._featureFilter.filter(new Ki(this.zoom),D,d))continue;let z={id:w,sourceLayerIndex:C,index:S,geometry:E?D.geometry:Jn(y),properties:y.properties,type:y.type,patterns:{}};this.hasPattern?this.features.push(Ff("fill-extrusion",this.layers,z,this.zoom,c)):this.addFeature(z,z.geometry,S,d,{}),c.featureIndex.insert(y,z.geometry,S,C,this.index,!0)}}addFeatures(o,c,d){for(let y of this.features){let{geometry:w}=y;this.addFeature(y,w,y.index,c,d)}}update(o,c,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,d)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,Pa),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,Ub.members,!0),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(o,c,d,y,w){for(let S of ji(c,500)){let C={x:0,y:0,vertexCount:0},E=0;for(let K of S)E+=K.length;let D=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let K of S){if(K.length===0||ry(K))continue;let Z=0;for(let se=0;se<K.length;se++){let ce=K[se];if(se>=1){let Ce=K[se-1];if(!qf(ce,Ce)){D.vertexLength+4>ni.MAX_VERTEX_ARRAY_LENGTH&&(D=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let ge=ce.sub(Ce)._perp()._unit(),ye=Ce.dist(ce);Z+ye>32768&&(Z=0),pu(this.layoutVertexArray,ce.x,ce.y,ge.x,ge.y,0,0,Z),pu(this.layoutVertexArray,ce.x,ce.y,ge.x,ge.y,0,1,Z),C.x+=2*ce.x,C.y+=2*ce.y,C.vertexCount+=2,Z+=ye,pu(this.layoutVertexArray,Ce.x,Ce.y,ge.x,ge.y,0,0,Z),pu(this.layoutVertexArray,Ce.x,Ce.y,ge.x,ge.y,0,1,Z),C.x+=2*Ce.x,C.y+=2*Ce.y,C.vertexCount+=2;let Pe=D.vertexLength;this.indexArray.emplaceBack(Pe,Pe+2,Pe+1),this.indexArray.emplaceBack(Pe+1,Pe+2,Pe+3),D.vertexLength+=4,D.primitiveLength+=2}}}}if(D.vertexLength+E>ni.MAX_VERTEX_ARRAY_LENGTH&&(D=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray)),Zb[o.type]!=="Polygon")continue;let z=[],B=[],$=D.vertexLength;for(let K of S)if(K.length!==0){K!==S[0]&&B.push(z.length/2);for(let Z=0;Z<K.length;Z++){let se=K[Z];pu(this.layoutVertexArray,se.x,se.y,0,0,1,1,0),C.x+=se.x,C.y+=se.y,C.vertexCount+=1,z.push(se.x),z.push(se.y)}}let H=Lh(z,B);for(let K=0;K<H.length;K+=3)this.indexArray.emplaceBack($+H[K],$+H[K+2],$+H[K+1]);D.primitiveLength+=H.length/3,D.vertexLength+=E;for(let K=0;K<C.vertexCount;K++){let Z=Math.floor(C.x/C.vertexCount),se=Math.floor(C.y/C.vertexCount);this.centroidVertexArray.emplaceBack(Z,se)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,d,w,y)}}function qf(l,o){return l.x===o.x&&(l.x<0||l.x>_n)||l.y===o.y&&(l.y<0||l.y>_n)}function ry(l){return l.every(o=>o.x<0)||l.every(o=>o.x>_n)||l.every(o=>o.y<0)||l.every(o=>o.y>_n)}let fu;dt("FillExtrusionBucket",jf,{omit:["layers","features"]});var Hf={get paint(){return fu=fu||new x({"fill-extrusion-opacity":new yt(Ie["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Mt(Ie["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new yt(Ie["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new yt(Ie["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ou(Ie["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Mt(Ie["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Mt(Ie["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new yt(Ie["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class sy extends u{constructor(o){super(o,Hf)}createBucket(o){return new jf(o)}queryRadius(){return sp(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,c,d,y,w,S,C,E){let D=op(o,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),S.angle,C),z=this.paint.get("fill-extrusion-height").evaluate(c,d),B=this.paint.get("fill-extrusion-base").evaluate(c,d),$=function(K,Z,se,ce){let Ce=[];for(let ge of K){let ye=[ge.x,ge.y,0,1];lp(ye,ye,Z),Ce.push(new T(ye[0]/ye[3],ye[1]/ye[3]))}return Ce}(D,E),H=function(K,Z,se,ce){let Ce=[],ge=[],ye=ce[8]*Z,Pe=ce[9]*Z,qe=ce[10]*Z,lt=ce[11]*Z,kt=ce[8]*se,ct=ce[9]*se,nt=ce[10]*se,vt=ce[11]*se;
21for(let pt of K){let ht=[],Fe=[];for(let bt of pt){let _t=bt.x,Rt=bt.y,Ni=ce[0]*_t+ce[4]*Rt+ce[12],Fi=ce[1]*_t+ce[5]*Rt+ce[13],qn=ce[2]*_t+ce[6]*Rt+ce[14],ws=ce[3]*_t+ce[7]*Rt+ce[15],hr=qn+qe,Mn=ws+lt,Pr=Ni+kt,Dr=Fi+ct,Rr=qn+nt,si=ws+vt,Ci=new T((Ni+ye)/Mn,(Fi+Pe)/Mn);Ci.z=hr/Mn,ht.push(Ci);let wr=new T(Pr/si,Dr/si);wr.z=Rr/si,Fe.push(wr)}Ce.push(ht),ge.push(Fe)}return[Ce,ge]}(y,B,z,E);return function(K,Z,se){let ce=1/0;rp(se,Z)&&(ce=Rh(se,Z[0]));for(let Ce=0;Ce<Z.length;Ce++){let ge=Z[Ce],ye=K[Ce];for(let Pe=0;Pe<ge.length-1;Pe++){let qe=ge[Pe],lt=[qe,ge[Pe+1],ye[Pe+1],ye[Pe],qe];Mh(se,lt)&&(ce=Math.min(ce,Rh(se,lt)))}}return ce!==1/0&&ce}(H[0],H[1],$)}}function mu(l,o){return l.x*o.x+l.y*o.y}function Rh(l,o){if(l.length===1){let c=0,d=o[c++],y;for(;!y||d.equals(y);)if(y=o[c++],!y)return 1/0;for(;c<o.length;c++){let w=o[c],S=l[0],C=y.sub(d),E=w.sub(d),D=S.sub(d),z=mu(C,C),B=mu(C,E),$=mu(E,E),H=mu(D,C),K=mu(D,E),Z=z*$-B*B,se=($*H-B*K)/Z,ce=(z*K-B*H)/Z,Ce=d.z*(1-se-ce)+y.z*se+w.z*ce;if(isFinite(Ce))return Ce}return 1/0}{let c=1/0;for(let d of o)c=Math.min(c,d.z);return c}}let oy=A([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Wo}=oy,gc=A([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Kb}=gc,ay=kn.VectorTileFeature.types,Xb=Math.cos(Math.PI/180*37.5),ly=Math.pow(2,14)/.5;class Wf{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(c=>c.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(c=>{this.gradients[c.id]={}}),this.layoutVertexArray=new jo,this.layoutVertexArray2=new ka,this.indexArray=new gs,this.programConfigurations=new lr(o.layers,o.zoom),this.segments=new ni,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,d){this.hasPattern=cr("line",this.layers,c);let y=this.layers[0].layout.get("line-sort-key"),w=!y.isConstant(),S=[];for(let{feature:C,id:E,index:D,sourceLayerIndex:z}of o){let B=this.layers[0]._featureFilter.needGeometry,$=ys(C,B);if(!this.layers[0]._featureFilter.filter(new Ki(this.zoom),$,d))continue;let H=w?y.evaluate($,{},d):void 0,K={id:E,properties:C.properties,type:C.type,sourceLayerIndex:z,index:D,geometry:B?$.geometry:Jn(C),patterns:{},sortKey:H};S.push(K)}w&&S.sort((C,E)=>C.sortKey-E.sortKey);for(let C of S){let{geometry:E,index:D,sourceLayerIndex:z}=C;if(this.hasPattern){let B=Ff("line",this.layers,C,this.zoom,c);this.patternFeatures.push(B)}else this.addFeature(C,E,D,d,{});c.featureIndex.insert(o[D].feature,E,D,z,this.index)}}update(o,c,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,d)}addFeatures(o,c,d){for(let y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,c,d)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=o.createVertexBuffer(this.layoutVertexArray2,Kb)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,Wo),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(o){if(o.properties&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_end"))return{start:+o.properties.mapbox_clip_start,end:+o.properties.mapbox_clip_end}}addFeature(o,c,d,y,w){let S=this.layers[0].layout,C=S.get("line-join").evaluate(o,{}),E=S.get("line-cap"),D=S.get("line-miter-limit"),z=S.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(let B of c)this.addLine(B,o,C,E,D,z);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,d,w,y)}addLine(o,c,d,y,w,S){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ce=0;ce<o.length-1;ce++)this.totalDistance+=o[ce].dist(o[ce+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let C=ay[c.type]==="Polygon",E=o.length;for(;E>=2&&o[E-1].equals(o[E-2]);)E--;let D=0;for(;D<E-1&&o[D].equals(o[D+1]);)D++;if(E<(C?3:2))return;d==="bevel"&&(w=1.05);let z=this.overscaling<=16?15*_n/(512*this.overscaling):0,B=this.segments.prepareSegment(10*E,this.layoutVertexArray,this.indexArray),$,H,K,Z,se;this.e1=this.e2=-1,C&&($=o[E-2],se=o[D].sub($)._unit()._perp());for(let ce=D;ce<E;ce++){if(K=ce===E-1?C?o[D+1]:void 0:o[ce+1],K&&o[ce].equals(K))continue;se&&(Z=se),$&&(H=$),$=o[ce],se=K?K.sub($)._unit()._perp():Z,Z=Z||se;let Ce=Z.add(se);Ce.x===0&&Ce.y===0||Ce._unit();let ge=Z.x*se.x+Z.y*se.y,ye=Ce.x*se.x+Ce.y*se.y,Pe=ye!==0?1/ye:1/0,qe=2*Math.sqrt(2-2*ye),lt=ye<Xb&&H&&K,kt=Z.x*se.y-Z.y*se.x>0;if(lt&&ce>D){let vt=$.dist(H);if(vt>2*z){let pt=$.sub($.sub(H)._mult(z/vt)._round());this.updateDistance(H,pt),this.addCurrentVertex(pt,Z,0,0,B),H=pt}}let ct=H&&K,nt=ct?d:C?"butt":y;if(ct&&nt==="round"&&(Pe<S?nt="miter":Pe<=2&&(nt="fakeround")),nt==="miter"&&Pe>w&&(nt="bevel"),nt==="bevel"&&(Pe>2&&(nt="flipbevel"),Pe<w&&(nt="miter")),H&&this.updateDistance(H,$),nt==="miter")Ce._mult(Pe),this.addCurrentVertex($,Ce,0,0,B);else if(nt==="flipbevel"){if(Pe>
vendor: 10,002 bytes, line 21
21100)Ce=se.mult(-1);else{let vt=Pe*Z.add(se).mag()/Z.sub(se).mag();Ce._perp()._mult(vt*(kt?-1:1))}this.addCurrentVertex($,Ce,0,0,B),this.addCurrentVertex($,Ce.mult(-1),0,0,B)}else if(nt==="bevel"||nt==="fakeround"){let vt=-Math.sqrt(Pe*Pe-1),pt=kt?vt:0,ht=kt?0:vt;if(H&&this.addCurrentVertex($,Z,pt,ht,B),nt==="fakeround"){let Fe=Math.round(180*qe/Math.PI/20);for(let bt=1;bt<Fe;bt++){let _t=bt/Fe;if(_t!==.5){let Ni=_t-.5;_t+=_t*Ni*(_t-1)*((1.0904+ge*(ge*(3.55645-1.43519*ge)-3.2452))*Ni*Ni+(.848013+ge*(.215638*ge-1.06021)))}let Rt=se.sub(Z)._mult(_t)._add(Z)._unit()._mult(kt?-1:1);this.addHalfVertex($,Rt.x,Rt.y,!1,kt,0,B)}}K&&this.addCurrentVertex($,se,-pt,-ht,B)}else if(nt==="butt")this.addCurrentVertex($,Ce,0,0,B);else if(nt==="square"){let vt=H?1:-1;this.addCurrentVertex($,Ce,vt,vt,B)}else nt==="round"&&(H&&(this.addCurrentVertex($,Z,0,0,B),this.addCurrentVertex($,Z,1,1,B,!0)),K&&(this.addCurrentVertex($,se,-1,-1,B,!0),this.addCurrentVertex($,se,0,0,B)));if(lt&&ce<E-1){let vt=$.dist(K);if(vt>2*z){let pt=$.add(K.sub($)._mult(z/vt)._round());this.updateDistance($,pt),this.addCurrentVertex(pt,se,0,0,B),$=pt}}}}addCurrentVertex(o,c,d,y,w,S=!1){let C=c.y*y-c.x,E=-c.y-c.x*y;this.addHalfVertex(o,c.x+c.y*d,c.y-c.x*d,S,!1,d,w),this.addHalfVertex(o,C,E,S,!0,-y,w),this.distance>ly/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,c,d,y,w,S))}addHalfVertex({x:o,y:c},d,y,w,S,C,E){let D=.5*(this.lineClips?this.scaledDistance*(ly-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(w?1:0),(c<<1)+(S?1:0),Math.round(63*d)+128,Math.round(63*y)+128,1+(C===0?0:C<0?-1:1)|(63&D)<<2,D>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let z=E.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,z),E.primitiveLength++),S?this.e2=z:this.e1=z}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(o,c){this.distance+=o.dist(c),this.updateScaledDistance()}}let cy,uy;dt("LineBucket",Wf,{omit:["layers","patternFeatures"]});var hy={get paint(){return uy=uy||new x({"line-opacity":new Mt(Ie.paint_line["line-opacity"]),"line-color":new Mt(Ie.paint_line["line-color"]),"line-translate":new yt(Ie.paint_line["line-translate"]),"line-translate-anchor":new yt(Ie.paint_line["line-translate-anchor"]),"line-width":new Mt(Ie.paint_line["line-width"]),"line-gap-width":new Mt(Ie.paint_line["line-gap-width"]),"line-offset":new Mt(Ie.paint_line["line-offset"]),"line-blur":new Mt(Ie.paint_line["line-blur"]),"line-dasharray":new au(Ie.paint_line["line-dasharray"]),"line-pattern":new ou(Ie.paint_line["line-pattern"]),"line-gradient":new vo(Ie.paint_line["line-gradient"])})},get layout(){return cy=cy||new x({"line-cap":new yt(Ie.layout_line["line-cap"]),"line-join":new Mt(Ie.layout_line["line-join"]),"line-miter-limit":new yt(Ie.layout_line["line-miter-limit"]),"line-round-limit":new yt(Ie.layout_line["line-round-limit"]),"line-sort-key":new Mt(Ie.layout_line["line-sort-key"])})}};class Yb extends Mt{possiblyEvaluate(o,c){return c=new Ki(Math.floor(c.zoom),{now:c.now,fadeDuration:c.fadeDuration,zoomHistory:c.zoomHistory,transition:c.transition}),super.possiblyEvaluate(o,c)}evaluate(o,c,d,y){return c=ze({},c,{zoom:Math.floor(c.zoom)}),super.evaluate(o,c,d,y)}}let fp;class Jb extends u{constructor(o){super(o,hy),this.gradientVersion=0,fp||(fp=new Yb(hy.paint.properties["line-width"].specification),fp.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(o){if(o==="line-gradient"){let c=this.gradientExpression();this.stepInterpolant=!!function(d){return d._styleExpression!==void 0}(c)&&c._styleExpression.expression instanceof Ja,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(o,c){super.recalculate(o,c),this.paint._values["line-floorwidth"]=fp.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new Wf(o)}queryRadius(o){let c=o,d=dy(oc("line-width",this,c),oc("line-gap-width",this,c)),y=oc("line-offset",this,c);return d/2+Math.abs(y)+sp(this.paint.get("line-translate"))}queryIntersectsFeature(o,c,d,y,w,S,C){let E=op(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),S.angle,C),D=C/2*dy(this.paint.get("line-width").evaluate(c,d),this.paint.get("line-gap-width").evaluate(c,d)),z=this.paint.get("line-offset").evaluate(c,d);return z&&(y=function(B,$){let H=[];for(let K=0;K<B.length;K++){let Z=B[K],se=[];for(let ce=0;ce<Z.length;ce++){let Ce=Z[ce-1],ge=Z[ce],ye=Z[ce+1],Pe=ce===0?new T(0,0):ge.sub(Ce)._unit()._perp(),qe=ce===Z.length-1?new T(0,0):ye.sub(ge)._unit()._perp(),lt=Pe._add(qe)._unit(),kt=lt.x*qe.x+lt.y*qe.y;kt!==0&&lt._mult(1/kt),se.push(lt._mult($)._add(ge))}H.push(se)}return H}(y,z*C)),function(B,$,H){for(let K=0;K<$.length;K++){let Z=$[K];if(B.length>=3){for(let se=0;se<Z.length;se++)if(sc(B,Z[se]))return!0}if(jg(B,Z,H))return!0}return!1}(E,y,D)}isTileClipped(){return!0}}function dy(l,o){return o>0?o+2*l:l}let Qb=A([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),py=A([{name:"a_projected_pos",components:3,type:"Float32"}],4);A([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let fy=A([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);A([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);let Gf=A([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),ex=A([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function tx(l,o,c){return l.sections.forEach(d=>{d.text=function(y,w,S){let C=w.layout.get("text-transform").evaluate(S,{});return C==="uppercase"?y=y.toLocaleUpperCase():C==="lowercase"&&(y=y.toLocaleLowerCase()),jr.applyArabicShaping&&(y=jr.applyArabicShaping(y)),y}(d.text,o,c)}),l}A([{name:"triangle",components:3,type:"Uint16"}]),A([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),A([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),A([{type:"Float32",name:"offsetX"}]),A([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),A([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);let zh={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63"
vendor: 4,671 bytes, line 21
21:"\uFE42"};var Cn=24,my=Oi,gy=function(l,o,c,d,y){var w,S,C=8*y-d-1,E=(1<<C)-1,D=E>>1,z=-7,B=c?y-1:0,$=c?-1:1,H=l[o+B];for(B+=$,w=H&(1<<-z)-1,H>>=-z,z+=C;z>0;w=256*w+l[o+B],B+=$,z-=8);for(S=w&(1<<-z)-1,w>>=-z,z+=d;z>0;S=256*S+l[o+B],B+=$,z-=8);if(w===0)w=1-D;else{if(w===E)return S?NaN:1/0*(H?-1:1);S+=Math.pow(2,d),w-=D}return(H?-1:1)*S*Math.pow(2,w-d)},yy=function(l,o,c,d,y,w){var S,C,E,D=8*w-y-1,z=(1<<D)-1,B=z>>1,$=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,H=d?0:w-1,K=d?1:-1,Z=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(C=isNaN(o)?1:0,S=z):(S=Math.floor(Math.log(o)/Math.LN2),o*(E=Math.pow(2,-S))<1&&(S--,E*=2),(o+=S+B>=1?$/E:$*Math.pow(2,1-B))*E>=2&&(S++,E/=2),S+B>=z?(C=0,S=z):S+B>=1?(C=(o*E-1)*Math.pow(2,y),S+=B):(C=o*Math.pow(2,B-1)*Math.pow(2,y),S=0));y>=8;l[c+H]=255&C,H+=K,C/=256,y-=8);for(S=S<<y|C,D+=y;D>0;l[c+H]=255&S,H+=K,S/=256,D-=8);l[c+H-K]|=128*Z};function Oi(l){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(l)?l:new Uint8Array(l||0),this.pos=0,this.type=0,this.length=this.buf.length}Oi.Varint=0,Oi.Fixed64=1,Oi.Bytes=2,Oi.Fixed32=5;var Zf=4294967296,_y=1/Zf,Os=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Da(l){return l.type===Oi.Bytes?l.readVarint()+l.pos:l.pos+1}function gu(l,o,c){return c?4294967296*o+(l>>>0):4294967296*(o>>>0)+(l>>>0)}function vy(l,o,c){var d=o<=16383?1:o<=2097151?2:o<=268435455?3:Math.floor(Math.log(o)/(7*Math.LN2));c.realloc(d);for(var y=c.pos-1;y>=l;y--)c.buf[y+d]=c.buf[y]}function by(l,o){for(var c=0;c<l.length;c++)o.writeVarint(l[c])}function ix(l,o){for(var c=0;c<l.length;c++)o.writeSVarint(l[c])}function nx(l,o){for(var c=0;c<l.length;c++)o.writeFloat(l[c])}function rx(l,o){for(var c=0;c<l.length;c++)o.writeDouble(l[c])}function sx(l,o){for(var c=0;c<l.length;c++)o.writeBoolean(l[c])}function Kf(l,o){for(var c=0;c<l.length;c++)o.writeFixed32(l[c])}function ox(l,o){for(var c=0;c<l.length;c++)o.writeSFixed32(l[c])}function ax(l,o){for(var c=0;c<l.length;c++)o.writeFixed64(l[c])}function lx(l,o){for(var c=0;c<l.length;c++)o.writeSFixed64(l[c])}function mp(l,o){return(l[o]|l[o+1]<<8|l[o+2]<<16)+16777216*l[o+3]}function yu(l,o,c){l[c]=o,l[c+1]=o>>>8,l[c+2]=o>>>16,l[c+3]=o>>>24}function xy(l,o){return(l[o]|l[o+1]<<8|l[o+2]<<16)+(l[o+3]<<24)}Oi.prototype={destroy:function(){this.buf=null},readFields:function(l,o,c){for(c=c||this.length;this.pos<c;){var d=this.readVarint(),y=d>>3,w=this.pos;this.type=7&d,l(y,o,this),this.pos===w&&this.skip(d)}return o},readMessage:function(l,o){return this.readFields(l,o,this.readVarint()+this.pos)},readFixed32:function(){var l=mp(this.buf,this.pos);return this.pos+=4,l},readSFixed32:function(){var l=xy(this.buf,this.pos);return this.pos+=4,l},readFixed64:function(){var l=mp(this.buf,this.pos)+mp(this.buf,this.pos+4)*Zf;return this.pos+=8,l},readSFixed64:function(){var l=mp(this.buf,this.pos)+xy(this.buf,this.pos+4)*Zf;return this.pos+=8,l},readFloat:function(){var l=gy(this.buf,this.pos,!0,23,4);return this.pos+=4,l},readDouble:function(){var l=gy(this.buf,this.pos,!0,52,8);return this.pos+=8,l},readVarint:function(l){var o,c,d=this.buf;return o=127&(c=d[this.pos++]),c<128?o:(o|=(127&(c=d[this.pos++]))<<7,c<128?o:(o|=(127&(c=d[this.pos++]))<<14,c<128?o:(o|=(127&(c=d[this.pos++]))<<21,c<128?o:function(y,w,S){var C,E,D=S.buf;if(C=(112&(E=D[S.pos++]))>>4,E<128||(C|=(127&(E=D[S.pos++]))<<3,E<128)||(C|=(127&(E=D[S.pos++]))<<10,E<128)||(C|=(127&(E=D[S.pos++]))<<17,E<128)||(C|=(127&(E=D[S.pos++]))<<24,E<128)||(C|=(1&(E=D[S.pos++]))<<31,E<128))return gu(y,C,w);throw new Error("Expected varint not more than 10 bytes")}(o|=(15&(c=d[this.pos]))<<28,l,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var l=this.readVarint();return l%2==1?(l+1)/-2:l/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var l=this.readVarint()+this.pos,o=this.pos;return this.pos=l,l-o>=12&&Os?function(c,d,y){return Os.decode(c.subarray(d,y))}(this.buf,o,l):function(c,d,y){for(var w="",S=d;S<y;){var C,E,D,z=c[S],B=null,$=z>239?4:z>223?3:z>191?2:1;if(S+$>y)break;$===1?z<128&&(B=z):$===2?(192&(C=c[S+1]))==128&&(B=(31&z)<<6|63&C)<=127&&(B=null):$===3?(E=c[S+2],(192&(C=c[S+1]))==128&&(192&E)==128&&((B=(15&z)<<12|(63&C)<<6|63&E)<=2047||B>=55296&&B<=57343)&&(B=null)):$===4&&(E=c[S+2],D=c[S+3],(192&(C=c[S+1]))==128&&(192&E)==128&&(192&D)==128&&((B=(15&z)<<18|(63&C)<<12|(63&E)<<6|63&D)<=65535||B>=1114112)&&(B=null)),B===null?(B=65533,$=1):B>65535&&(B-=65536,w+=String.fromCharCode(B>>>10&1023|55296),B=56320|1023&B),w+=String.fromCharCode(B),S+=$}return w}(this.buf,o,l)},readBytes:function(){var l=this.readVarint()+this.pos,o=this.buf.subarray(this.pos,l);return this.pos=l,o}
vendor: 5,627 bytes, line 21
21,readPackedVarint:function(l,o){if(this.type!==Oi.Bytes)return l.push(this.readVarint(o));var c=Da(this);for(l=l||[];this.pos<c;)l.push(this.readVarint(o));return l},readPackedSVarint:function(l){if(this.type!==Oi.Bytes)return l.push(this.readSVarint());var o=Da(this);for(l=l||[];this.pos<o;)l.push(this.readSVarint());return l},readPackedBoolean:function(l){if(this.type!==Oi.Bytes)return l.push(this.readBoolean());var o=Da(this);for(l=l||[];this.pos<o;)l.push(this.readBoolean());return l},readPackedFloat:function(l){if(this.type!==Oi.Bytes)return l.push(this.readFloat());var o=Da(this);for(l=l||[];this.pos<o;)l.push(this.readFloat());return l},readPackedDouble:function(l){if(this.type!==Oi.Bytes)return l.push(this.readDouble());var o=Da(this);for(l=l||[];this.pos<o;)l.push(this.readDouble());return l},readPackedFixed32:function(l){if(this.type!==Oi.Bytes)return l.push(this.readFixed32());var o=Da(this);for(l=l||[];this.pos<o;)l.push(this.readFixed32());return l},readPackedSFixed32:function(l){if(this.type!==Oi.Bytes)return l.push(this.readSFixed32());var o=Da(this);for(l=l||[];this.pos<o;)l.push(this.readSFixed32());return l},readPackedFixed64:function(l){if(this.type!==Oi.Bytes)return l.push(this.readFixed64());var o=Da(this);for(l=l||[];this.pos<o;)l.push(this.readFixed64());return l},readPackedSFixed64:function(l){if(this.type!==Oi.Bytes)return l.push(this.readSFixed64());var o=Da(this);for(l=l||[];this.pos<o;)l.push(this.readSFixed64());return l},skip:function(l){var o=7&l;if(o===Oi.Varint)for(;this.buf[this.pos++]>127;);else if(o===Oi.Bytes)this.pos=this.readVarint()+this.pos;else if(o===Oi.Fixed32)this.pos+=4;else{if(o!==Oi.Fixed64)throw new Error("Unimplemented type: "+o);this.pos+=8}},writeTag:function(l,o){this.writeVarint(l<<3|o)},realloc:function(l){for(var o=this.length||16;o<this.pos+l;)o*=2;if(o!==this.length){var c=new Uint8Array(o);c.set(this.buf),this.buf=c,this.length=o}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(l){this.realloc(4),yu(this.buf,l,this.pos),this.pos+=4},writeSFixed32:function(l){this.realloc(4),yu(this.buf,l,this.pos),this.pos+=4},writeFixed64:function(l){this.realloc(8),yu(this.buf,-1&l,this.pos),yu(this.buf,Math.floor(l*_y),this.pos+4),this.pos+=8},writeSFixed64:function(l){this.realloc(8),yu(this.buf,-1&l,this.pos),yu(this.buf,Math.floor(l*_y),this.pos+4),this.pos+=8},writeVarint:function(l){(l=+l||0)>268435455||l<0?function(o,c){var d,y;if(o>=0?(d=o%4294967296|0,y=o/4294967296|0):(y=~(-o/4294967296),4294967295^(d=~(-o%4294967296))?d=d+1|0:(d=0,y=y+1|0)),o>=18446744073709552e3||o<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");c.realloc(10),function(w,S,C){C.buf[C.pos++]=127&w|128,w>>>=7,C.buf[C.pos++]=127&w|128,w>>>=7,C.buf[C.pos++]=127&w|128,w>>>=7,C.buf[C.pos++]=127&w|128,C.buf[C.pos]=127&(w>>>=7)}(d,0,c),function(w,S){var C=(7&w)<<4;S.buf[S.pos++]|=C|((w>>>=3)?128:0),w&&(S.buf[S.pos++]=127&w|((w>>>=7)?128:0),w&&(S.buf[S.pos++]=127&w|((w>>>=7)?128:0),w&&(S.buf[S.pos++]=127&w|((w>>>=7)?128:0),w&&(S.buf[S.pos++]=127&w|((w>>>=7)?128:0),w&&(S.buf[S.pos++]=127&w)))))}(y,c)}(l,this):(this.realloc(4),this.buf[this.pos++]=127&l|(l>127?128:0),l<=127||(this.buf[this.pos++]=127&(l>>>=7)|(l>127?128:0),l<=127||(this.buf[this.pos++]=127&(l>>>=7)|(l>127?128:0),l<=127||(this.buf[this.pos++]=l>>>7&127))))},writeSVarint:function(l){this.writeVarint(l<0?2*-l-1:2*l)},writeBoolean:function(l){this.writeVarint(!!l)},writeString:function(l){l=String(l),this.realloc(4*l.length),this.pos++;var o=this.pos;this.pos=function(d,y,w){for(var S,C,E=0;E<y.length;E++){if((S=y.charCodeAt(E))>55295&&S<57344){if(!C){S>56319||E+1===y.length?(d[w++]=239,d[w++]=191,d[w++]=189):C=S;continue}if(S<56320){d[w++]=239,d[w++]=191,d[w++]=189,C=S;continue}S=C-55296<<10|S-56320|65536,C=null}else C&&(d[w++]=239,d[w++]=191,d[w++]=189,C=null);S<128?d[w++]=S:(S<2048?d[w++]=S>>6|192:(S<65536?d[w++]=S>>12|224:(d[w++]=S>>18|240,d[w++]=S>>12&63|128),d[w++]=S>>6&63|128),d[w++]=63&S|128)}return w}(this.buf,l,this.pos);var c=this.pos-o;c>=128&&vy(o,c,this),this.pos=o-1,this.writeVarint(c),this.pos+=c},writeFloat:function(l){this.realloc(4),yy(this.buf,l,this.pos,!0,23,4),this.pos+=4},writeDouble:function(l){this.realloc(8),yy(this.buf,l,this.pos,!0,52,8),this.pos+=8},writeBytes:function(l){var o=l.length;this.writeVarint(o),this.realloc(o);for(var c=0;c<o;c++)this.buf[this.pos++]=l[c]},writeRawMessage:function(l,o){this.pos++;var c=this.pos;l(o,this);var d=this.pos-c;d>=128&&vy(c,d,this),this.pos=c-1,this.writeVarint(d),this.pos+=d},writeMessage:function(l,o,c){this.writeTag(l,Oi.Bytes),this.writeRawMessage(o,c)},writePackedVarint:function(l,o){o.length&&this.writeMessage(l,by,o)},writePackedSVarint:function(l,o){o.length&&this.writeMessage(l,ix,o)},writePackedBoolean:function(l,o){o.length&&this.writeMessage(l,sx,o)},writePackedFloat:function(l,o){o.length&&this.writeMessage(l,nx,o)},writePackedDouble:function(l,o){o.length&&this.writeMessage(l,rx,o)},writePackedFixed32:function(l,o){o.length&&this.writeMessage(l,Kf,o)},writePackedSFixed32:function(l,o){o.length&&this.writeMessage(l,ox,o)},writePackedFixed64:function(l,o){o.length&&this.writeMessage(l,ax,o)},writePackedSFixed64:function(l,o){o.length&&this.writeMessage(l,lx,o)},writeBytesField:function(l,o){this.writeTag(l,Oi.Bytes),this.writeBytes(o)},writeFixed32Field:function(l,o){this.writeTag(l,Oi.Fixed32),this.writeFixed32(o)},writeSFixed32Field:function(l,o){this.writeTag(l,Oi.Fixed32),this.writeSFixed32(o)},writeFixed64Field:function(l,o){this.writeTag(l,Oi.Fixed64),this.writeFixed64
21(o)},writeSFixed64Field:function(l,o){this.writeTag(l,Oi.Fixed64),this.writeSFixed64(o)},writeVarintField:function(l,o){this.writeTag(l,Oi.Varint),this.writeVarint(o)},writeSVarintField:function(l,o){this.writeTag(l,Oi.Varint),this.writeSVarint(o)},writeStringField:function(l,o){this.writeTag(l,Oi.Bytes),this.writeString(o)},writeFloatField:function(l,o){this.writeTag(l,Oi.Fixed32),this.writeFloat(o)},writeDoubleField:function(l,o){this.writeTag(l,Oi.Fixed64),this.writeDouble(o)},writeBooleanField:function(l,o){this.writeVarintField(l,!!o)}};var Xf=h(my);let Yf=3;function cx(l,o,c){l===1&&c.readMessage(ux,o)}function ux(l,o,c){if(l===3){let{id:d,bitmap:y,width:w,height:S,left:C,top:E,advance:D}=c.readMessage(hx,{});o.push({id:d,bitmap:new Eh({width:w+2*Yf,height:S+2*Yf},y),metrics:{width:w,height:S,left:C,top:E,advance:D}})}}function hx(l,o,c){l===1?o.id=c.readVarint():l===2?o.bitmap=c.readBytes():l===3?o.width=c.readVarint():l===4?o.height=c.readVarint():l===5?o.left=c.readSVarint():l===6?o.top=c.readSVarint():l===7&&(o.advance=c.readVarint())}let wy=Yf;function Sy(l){let o=0,c=0;for(let S of l)o+=S.w*S.h,c=Math.max(c,S.w);l.sort((S,C)=>C.h-S.h);let d=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(o/.95)),c),h:1/0}],y=0,w=0;for(let S of l)for(let C=d.length-1;C>=0;C--){let E=d[C];if(!(S.w>E.w||S.h>E.h)){if(S.x=E.x,S.y=E.y,w=Math.max(w,S.y+S.h),y=Math.max(y,S.x+S.w),S.w===E.w&&S.h===E.h){let D=d.pop();C<d.length&&(d[C]=D)}else S.h===E.h?(E.x+=S.w,E.w-=S.w):S.w===E.w?(E.y+=S.h,E.h-=S.h):(d.push({x:E.x+S.w,y:E.y,w:E.w-S.w,h:S.h}),E.y+=S.h,E.h-=S.h);break}}return{w:y,h:w,fill:o/(y*w)||0}}let Wr=1;class Jf{constructor(o,{pixelRatio:c,version:d,stretchX:y,stretchY:w,content:S,textFitWidth:C,textFitHeight:E}){this.paddedRect=o,this.pixelRatio=c,this.stretchX=y,this.stretchY=w,this.content=S,this.version=d,this.textFitWidth=C,this.textFitHeight=E}get tl(){return[this.paddedRect.x+Wr,this.paddedRect.y+Wr]}get br(){return[this.paddedRect.x+this.paddedRect.w-Wr,this.paddedRect.y+this.paddedRect.h-Wr]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Wr)/this.pixelRatio,(this.paddedRect.h-2*Wr)/this.pixelRatio]}}class Ty{constructor(o,c){let d={},y={};this.haveRenderCallbacks=[];let w=[];this.addImages(o,d,w),this.addImages(c,y,w);let{w:S,h:C}=Sy(w),E=new vs({width:S||1,height:C||1});for(let D in o){let z=o[D],B=d[D].paddedRect;vs.copy(z.data,E,{x:0,y:0},{x:B.x+Wr,y:B.y+Wr},z.data)}for(let D in c){let z=c[D],B=y[D].paddedRect,$=B.x+Wr,H=B.y+Wr,K=z.data.width,Z=z.data.height;vs.copy(z.data,E,{x:0,y:0},{x:$,y:H},z.data),vs.copy(z.data,E,{x:0,y:Z-1},{x:$,y:H-1},{width:K,height:1}),vs.copy(z.data,E,{x:0,y:0},{x:$,y:H+Z},{width:K,height:1}),vs.copy(z.data,E,{x:K-1,y:0},{x:$-1,y:H},{width:1,height:Z}),vs.copy(z.data,E,{x:0,y:0},{x:$+K,y:H},{width:1,height:Z})}this.image=E,this.iconPositions=d,this.patternPositions=y}addImages(o,c,d){for(let y in o){let w=o[y],S={x:0,y:0,w:w.data.width+2*Wr,h:w.data.height+2*Wr};d.push(S),c[y]=new Jf(S,w),w.hasRenderCallback&&this.haveRenderCallbacks.push(y)}}patchUpdatedImages(o,c){o.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let d in o.updatedImages)this.patchUpdatedImage(this.iconPositions[d],o.getImage(d),c),this.patchUpdatedImage(this.patternPositions[d],o.getImage(d),c)}patchUpdatedImage(o,c,d){if(!o||!c||o.version===c.version)return;o.version=c.version;let[y,w]=o.tl;d.update(c.data,void 0,{x:y,y:w})}}var wl;dt("ImagePosition",Jf),dt("ImageAtlas",Ty),a.ah=void 0,(wl=a.ah||(a.ah={}))[wl.none=0]="none",wl[wl.horizontal=1]="horizontal",wl[wl.vertical=2]="vertical",wl[wl.horizontalOnly=3]="horizontalOnly";let Oh=-17;class Fh{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(o,c){let d=new Fh;return d.scale=o||1,d.fontStack=c,d}static forImage(o){let c=new Fh;return c.imageName=o,c}}class _u{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(o,c){let d=new _u;for(let y=0;y<o.sections.length;y++){let w=o.sections[y];w.image?d.addImageSection(w):d.addTextSection(w,c)}return d}length(){return this.text.length}getSection(o){return this.sections[this.sectionIndex[o]]}getSectionIndex(o){return this.sectionIndex[o]}getCharCode(o){return this.text.charCodeAt(o)}verticalizePunctuation(){this.text=function(o){let c="";for(let d=0;d<o.length;
21d++){let y=o.charCodeAt(d+1)||null,w=o.charCodeAt(d-1)||null;c+=y&&Yd(y)&&!zh[o[d+1]]||w&&Yd(w)&&!zh[o[d-1]]||!zh[o[d]]?o[d]:zh[o[d]]}return c}(this.text)}trim(){let o=0;for(let d=0;d<this.text.length&&Bh[this.text.charCodeAt(d)];d++)o++;let c=this.text.length;for(let d=this.text.length-1;d>=0&&d>=o&&Bh[this.text.charCodeAt(d)];d--)c--;this.text=this.text.substring(o,c),this.sectionIndex=this.sectionIndex.slice(o,c)}substring(o,c){let d=new _u;return d.text=this.text.substring(o,c),d.sectionIndex=this.sectionIndex.slice(o,c),d.sections=this.sections,d}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((o,c)=>Math.max(o,this.sections[c].scale),0)}addTextSection(o,c){this.text+=o.text,this.sections.push(Fh.forText(o.scale,o.fontStack||c));let d=this.sections.length-1;for(let y=0;y<o.text.length;++y)this.sectionIndex.push(d)}addImageSection(o){let c=o.image?o.image.name:"";if(c.length===0)return void Tt("Can't add FormattedSection with an empty image.");let d=this.getNextImageSectionCharCode();d?(this.text+=String.fromCharCode(d),this.sections.push(Fh.forImage(c)),this.sectionIndex.push(this.sections.length-1)):Tt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function vu(l,o,c,d,y,w,S,C,E,D,z,B,$,H,K){let Z=_u.fromFeature(l,y),se;B===a.ah.vertical&&Z.verticalizePunctuation();let{processBidirectionalText:ce,processStyledBidirectionalText:Ce}=jr;if(ce&&Z.sections.length===1){se=[];let Pe=ce(Z.toString(),Qf(Z,D,w,o,d,H));for(let qe of Pe){let lt=new _u;lt.text=qe,lt.sections=Z.sections;for(let kt=0;kt<qe.length;kt++)lt.sectionIndex.push(0);se.push(lt)}}else if(Ce){se=[];let Pe=Ce(Z.text,Z.sectionIndex,Qf(Z,D,w,o,d,H));for(let qe of Pe){let lt=new _u;lt.text=qe[0],lt.sectionIndex=qe[1],lt.sections=Z.sections,se.push(lt)}}else se=function(Pe,qe){let lt=[],kt=Pe.text,ct=0;for(let nt of qe)lt.push(Pe.substring(ct,nt)),ct=nt;return ct<kt.length&&lt.push(Pe.substring(ct,kt.length)),lt}(Z,Qf(Z,D,w,o,d,H));let ge=[],ye={positionedLines:ge,text:Z.toString(),top:z[1],bottom:z[1],left:z[0],right:z[0],writingMode:B,iconsInText:!1,verticalizable:!1};return function(Pe,qe,lt,kt,ct,nt,vt,pt,ht,Fe,bt,_t){let Rt=0,Ni=Oh,Fi=0,qn=0,ws=pt==="right"?1:pt==="left"?0:.5,hr=0;for(let si of ct){si.trim();let Ci=si.getMaxScale(),wr=(Ci-1)*Cn,dr={positionedGlyphs:[],lineOffset:0};Pe.positionedLines[hr]=dr;let zr=dr.positionedGlyphs,Qn=0;if(!si.length()){Ni+=nt,++hr;continue}for(let Gr=0;Gr<si.length();Gr++){let vi=si.getSection(Gr),Vi=si.getSectionIndex(Gr),Xi=si.getCharCode(Gr),Ss=0,dn=null,_c=null,wo=null,Ko=Cn,Qs=!(ht===a.ah.horizontal||!bt&&!bh(Xi)||bt&&(Bh[Xi]||(Mn=Xi,/\p{sc=Arab}/u.test(String.fromCodePoint(Mn)))));if(vi.imageName){let Bs=kt[vi.imageName];if(!Bs)continue;wo=vi.imageName,Pe.iconsInText=Pe.iconsInText||!0,_c=Bs.paddedRect;let er=Bs.displaySize;vi.scale=vi.scale*Cn/_t,dn={width:er[0],height:er[1],left:Wr,top:-wy,advance:Qs?er[1]:er[0]},Ss=wr+(Cn-er[1]*vi.scale),Ko=dn.advance;let Ts=Qs?er[0]*vi.scale-Cn*Ci:er[1]*vi.scale-Cn*Ci;Ts>0&&Ts>Qn&&(Qn=Ts)}else{let Bs=lt[vi.fontStack],er=Bs&&Bs[Xi];if(er&&er.rect)_c=er.rect,dn=er.metrics;else{let Ts=qe[vi.fontStack],Hh=Ts&&Ts[Xi];if(!Hh)continue;dn=Hh.metrics}Ss=(Ci-vi.scale)*Cn}Qs?(Pe.verticalizable=!0,zr.push({glyph:Xi,imageName:wo,x:Rt,y:Ni+Ss,vertical:Qs,scale:vi.scale,fontStack:vi.fontStack,sectionIndex:Vi,metrics:dn,rect:_c}),Rt+=Ko*vi.scale+Fe):(zr.push({glyph:Xi,imageName:wo,x:Rt,y:Ni+Ss,vertical:Qs,scale:vi.scale,fontStack:vi.fontStack,sectionIndex:Vi,metrics:dn,rect:_c}),Rt+=dn.advance*vi.scale+Fe)}zr.length!==0&&(Fi=Math.max(Rt-Fe,Fi),mx(zr,0,zr.length-1,ws,Qn)),Rt=0;let Fs=nt*Ci+Qn;dr.lineOffset=Math.max(Qn,wr),Ni+=Fs,qn=Math.max(Fs,qn),++hr}var Mn;let Pr=Ni-Oh,{horizontalAlign:Dr,verticalAlign:Rr}=gp(vt);(function(si,Ci,wr,dr,zr,Qn,Fs,Gr,vi){let Vi=(Ci-wr)*zr,Xi=0;Xi=Qn!==Fs?-Gr*dr-Oh:(-dr*vi+.5)*Fs;for(let Ss of si)for(let dn of Ss.positionedGlyphs)dn.x+=Vi,dn.y+=Xi})(Pe.positionedLines,ws,Dr,Rr,Fi,qn,nt,Pr,ct.length),Pe.top+=-Rr*Pr,Pe.bottom=Pe.top+Pr,Pe.left+=-Dr*Fi,Pe.right=Pe.left+Fi}(ye,o,c,d,se,S,C,E,B,D,$,K),!function(Pe){for(let qe of Pe)if(qe.positionedGlyphs.length!==0)return!1;return!0}(ge)&&ye}let Bh={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},dx={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},px={40:!0};function ky(l,o,c,d,y,w){if(o.imageName){let S=d[o.imageName];return S?S.displaySize[0]*o.scale*Cn/w+y:0}{let S=c[o.fontStack],C=S&&S[l];return C?C.metrics.advance*o.scale+y:0}}function Cy(l,o,c,d){let y=Math.pow(l-o,2);return d?l<o?y/2:2*y:y+Math.abs(c)*c}function fx(l,o,c){let d=0;
21return l===10&&(d-=1e4),c&&(d+=150),l!==40&&l!==65288||(d+=50),o!==41&&o!==65289||(d+=50),d}function My(l,o,c,d,y,w){let S=null,C=Cy(o,c,y,w);for(let E of d){let D=Cy(o-E.x,c,y,w)+E.badness;D<=C&&(S=E,C=D)}return{index:l,x:o,priorBreak:S,badness:C}}function Ay(l){return l?Ay(l.priorBreak).concat(l.index):[]}function Qf(l,o,c,d,y,w){if(!l)return[];let S=[],C=function(B,$,H,K,Z,se){let ce=0;for(let Ce=0;Ce<B.length();Ce++){let ge=B.getSection(Ce);ce+=ky(B.getCharCode(Ce),ge,K,Z,$,se)}return ce/Math.max(1,Math.ceil(ce/H))}(l,o,c,d,y,w),E=l.text.indexOf("\u200B")>=0,D=0;for(let B=0;B<l.length();B++){let $=l.getSection(B),H=l.getCharCode(B);if(Bh[H]||(D+=ky(H,$,d,y,o,w)),B<l.length()-1){let K=!((z=H)<11904)&&(!!ii["CJK Compatibility Forms"](z)||!!ii["CJK Compatibility"](z)||!!ii["CJK Strokes"](z)||!!ii["CJK Symbols and Punctuation"](z)||!!ii["Enclosed CJK Letters and Months"](z)||!!ii["Halfwidth and Fullwidth Forms"](z)||!!ii["Ideographic Description Characters"](z)||!!ii["Vertical Forms"](z)||Xd.test(String.fromCodePoint(z)));(dx[H]||K||$.imageName||B!==l.length()-2&&px[l.getCharCode(B+1)])&&S.push(My(B+1,D,C,S,fx(H,l.getCharCode(B+1),K&&E),!1))}}var z;return Ay(My(l.length(),D,C,S,0,!0))}function gp(l){let o=.5,c=.5;switch(l){case"right":case"top-right":case"bottom-right":o=1;break;case"left":case"top-left":case"bottom-left":o=0}switch(l){case"bottom":case"bottom-right":case"bottom-left":c=1;break;case"top":case"top-right":case"top-left":c=0}return{horizontalAlign:o,verticalAlign:c}}function mx(l,o,c,d,y){if(!d&&!y)return;let w=l[c],S=(l[c].x+w.metrics.advance*w.scale)*d;for(let C=o;C<=c;C++)l[C].x-=S,l[C].y+=y}function yp(l,o,c){let{horizontalAlign:d,verticalAlign:y}=gp(c),w=o[0]-l.displaySize[0]*d,S=o[1]-l.displaySize[1]*y;return{image:l,top:S,bottom:S+l.displaySize[1],left:w,right:w+l.displaySize[0]}}function Ey(l){var o,c;let d=l.left,y=l.top,w=l.right-d,S=l.bottom-y,C=(o=l.image.textFitWidth)!==null&&o!==void 0?o:"stretchOrShrink",E=(c=l.image.textFitHeight)!==null&&c!==void 0?c:"stretchOrShrink",D=(l.image.content[2]-l.image.content[0])/(l.image.content[3]-l.image.content[1]);if(E==="proportional"){if(C==="stretchOnly"&&w/S<D||C==="proportional"){let z=Math.ceil(S*D);d*=z/w,w=z}}else if(C==="proportional"&&E==="stretchOnly"&&D!==0&&w/S>D){let z=Math.ceil(w/D);y*=z/S,S=z}return{x1:d,y1:y,x2:d+w,y2:y+S}}function Iy(l,o,c,d,y,w){let S=l.image,C;if(S.content){let se=S.content,ce=S.pixelRatio||1;C=[se[0]/ce,se[1]/ce,S.displaySize[0]-se[2]/ce,S.displaySize[1]-se[3]/ce]}let E=o.left*w,D=o.right*w,z,B,$,H;c==="width"||c==="both"?(H=y[0]+E-d[3],B=y[0]+D+d[1]):(H=y[0]+(E+D-S.displaySize[0])/2,B=H+S.displaySize[0]);let K=o.top*w,Z=o.bottom*w;return c==="height"||c==="both"?(z=y[1]+K-d[0],$=y[1]+Z+d[2]):(z=y[1]+(K+Z-S.displaySize[1])/2,$=z+S.displaySize[1]),{image:S,top:z,right:B,bottom:$,left:H,collisionPadding:C}}let Nh=255,Go=128,Sl=Nh*Go;function Ly(l,o){let{expression:c}=o;if(c.kind==="constant")return{kind:"constant",layoutSize:c.evaluate(new Ki(l+1))};if(c.kind==="source")return{kind:"source"};{let{zoomStops:d,interpolationType:y}=c,w=0;for(;w<d.length&&d[w]<=l;)w++;w=Math.max(0,w-1);let S=w;for(;S<d.length&&d[S]<l+1;)S++;S=Math.min(d.length-1,S);let C=d[w],E=d[S];return c.kind==="composite"?{kind:"composite",minZoom:C,maxZoom:E,interpolationType:y}:{kind:"camera",minZoom:C,maxZoom:E,minSize:c.evaluate(new Ki(C)),maxSize:c.evaluate(new Ki(E)),interpolationType:y}}}function em(l,o,c){let d="never",y=l.get(o);return y?d=y:l.get(c)&&(d="always"),d}let gx=kn.VectorTileFeature.types,yx=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function _p(l,o,c,d,y,w,S,C,E,D,z,B,$){let H=C?Math.min(Sl,Math.round(C[0])):0,K=C?Math.min(Sl,Math.round(C[1])):0;l.emplaceBack(o,c,Math.round(32*d),Math.round(32*y),w,S,(H<<1)+(E?1:0),K,16*D,16*z,256*B,256*$)}function tm(l,o,c){l.emplaceBack(o.x,o.y,c),l.emplaceBack(o.x,o.y,c),l.emplaceBack(o.x,o.y,c),l.emplaceBack(o.x,o.y,c)}function _x(l){for(let o of l.sections)if(kf(o.text))return!0;return!1}class im{constructor(o){this.layoutVertexArray=new lu,this.indexArray=new gs,this.programConfigurations=o,this.segments=new ni,this.dynamicLayoutVertexArray=new Ca,this.opacityVertexArray=new fs,this.hasVisibleVertices=!1,this.placedSymbolArray=new qi}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(o,c,d,y){this.isEmpty()||(d&&(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,Qb.members),this.indexBuffer=o.createIndexBuffer(this.indexArray,c),this.dynamicLayoutVertexBuffer=o.createVertexBuffer(this.dynamicLayoutVertexArray,py.members,!0),this.opacityVertexBuffer=o.createVertexBuffer(this.opacityVertexArray,yx,!0),this.opacityVertexBuffer.itemSize=1),(d||y)&&this.programConfigurations.upload(o))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}dt("SymbolBuffers",im);class nm{constructor(o,c,d){this.layoutVertexArray=new o,this.layoutAttributes=c,this.indexArray=new d,this.segments=new ni,this.collisionVertexArray=new Ys}upload(o){this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=o.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=o.createVertexBuffer(this.collisionVertexArray,fy.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}dt("CollisionBuffers",nm);class bu{constructor(o){this.collisionBoxArray=o.collisionBoxArray,this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(S=>S.id),this.index=o.index,this.pixelRatio=o.pixelRatio,this.sourceLayerIndex=o.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ap([]),this.placementViewportMatrix=ap([]);let c=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Ly(this.zoom,c["text-size"]),this.iconSizeData=Ly(this.zoom,c["icon-size"]);let d=this.layers[0].layout,y=d.get("symbol-sort-key"),w=d.get("symbol-z-order");this.canOverlap=em(d,"text-overlap","text-allow-overlap")!=="never"||em(d,"icon-overlap","icon-allow-overlap")!=="never"||d.get("text-ignore-placement")||d.get("icon-ignore-placement"),this.sortFeaturesByKey=w!=="viewport-y"&&!y.isConstant(),this.sortFeaturesByY=(w==="viewport-y"||w==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,d.get("symbol-placement")==="point"&&(this.writingModes=d.get("text-writing-mode").map(S=>a.ah[S])),this.stateDependentLayerIds=this.layers.filter(S=>S.isStateDependent()).map(S=>S.id),this.sourceID=o.sourceID}createArrays(){this.text=new im(new lr(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new im(new lr(this.layers,this.zoom,o=>/^icon/.test(o))),this.glyphOffsetArray=new zi,this.lineVertexArray=new yn,this.symbolInstances=new Xt,this.textAnchorOffsets=new Qt}calculateGlyphDependencies(o,c,d,y,w){for(let S=0;S<o.length;S++)if(c[o.charCodeAt(S)]=!0,(d||y)&&w){let C=zh[o.charAt(S)];
vendor: 9,727 bytes, line 21
21C&&(c[C.charCodeAt(0)]=!0)}}populate(o,c,d){let y=this.layers[0],w=y.layout,S=w.get("text-font"),C=w.get("text-field"),E=w.get("icon-image"),D=(C.value.kind!=="constant"||C.value.value instanceof Br&&!C.value.value.isEmpty()||C.value.value.toString().length>0)&&(S.value.kind!=="constant"||S.value.value.length>0),z=E.value.kind!=="constant"||!!E.value.value||Object.keys(E.parameters).length>0,B=w.get("symbol-sort-key");if(this.features=[],!D&&!z)return;let $=c.iconDependencies,H=c.glyphDependencies,K=c.availableImages,Z=new Ki(this.zoom);for(let{feature:se,id:ce,index:Ce,sourceLayerIndex:ge}of o){let ye=y._featureFilter.needGeometry,Pe=ys(se,ye);if(!y._featureFilter.filter(Z,Pe,d))continue;let qe,lt;if(ye||(Pe.geometry=Jn(se)),D){let ct=y.getValueAndResolveTokens("text-field",Pe,d,K),nt=Br.factory(ct),vt=this.hasRTLText=this.hasRTLText||_x(nt);(!vt||jr.getRTLTextPluginStatus()==="unavailable"||vt&&jr.isParsed())&&(qe=tx(nt,y,Pe))}if(z){let ct=y.getValueAndResolveTokens("icon-image",Pe,d,K);lt=ct instanceof Vr?ct:Vr.fromString(ct)}if(!qe&&!lt)continue;let kt=this.sortFeaturesByKey?B.evaluate(Pe,{},d):void 0;if(this.features.push({id:ce,text:qe,icon:lt,index:Ce,sourceLayerIndex:ge,geometry:Pe.geometry,properties:se.properties,type:gx[se.type],sortKey:kt}),lt&&($[lt.name]=!0),qe){let ct=S.evaluate(Pe,{},d).join(","),nt=w.get("text-rotation-alignment")!=="viewport"&&w.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a.ah.vertical)>=0;for(let vt of qe.sections)if(vt.image)$[vt.image.name]=!0;else{let pt=J(qe.toString()),ht=vt.fontStack||ct,Fe=H[ht]=H[ht]||{};this.calculateGlyphDependencies(vt.text,Fe,nt,this.allowVerticalPlacement,pt)}}}w.get("symbol-placement")==="line"&&(this.features=function(se){let ce={},Ce={},ge=[],ye=0;function Pe(ct){ge.push(se[ct]),ye++}function qe(ct,nt,vt){let pt=Ce[ct];return delete Ce[ct],Ce[nt]=pt,ge[pt].geometry[0].pop(),ge[pt].geometry[0]=ge[pt].geometry[0].concat(vt[0]),pt}function lt(ct,nt,vt){let pt=ce[nt];return delete ce[nt],ce[ct]=pt,ge[pt].geometry[0].shift(),ge[pt].geometry[0]=vt[0].concat(ge[pt].geometry[0]),pt}function kt(ct,nt,vt){let pt=vt?nt[0][nt[0].length-1]:nt[0][0];return`${ct}:${pt.x}:${pt.y}`}for(let ct=0;ct<se.length;ct++){let nt=se[ct],vt=nt.geometry,pt=nt.text?nt.text.toString():null;if(!pt){Pe(ct);continue}let ht=kt(pt,vt),Fe=kt(pt,vt,!0);if(ht in Ce&&Fe in ce&&Ce[ht]!==ce[Fe]){let bt=lt(ht,Fe,vt),_t=qe(ht,Fe,ge[bt].geometry);delete ce[ht],delete Ce[Fe],Ce[kt(pt,ge[_t].geometry,!0)]=_t,ge[bt].geometry=null}else ht in Ce?qe(ht,Fe,vt):Fe in ce?lt(ht,Fe,vt):(Pe(ct),ce[ht]=ye-1,Ce[Fe]=ye-1)}return ge.filter(ct=>ct.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((se,ce)=>se.sortKey-ce.sortKey)}update(o,c,d){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(o,c,this.layers,d),this.icon.programConfigurations.updatePaintArrays(o,c,this.layers,d))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(o){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(o),this.iconCollisionBox.upload(o)),this.text.upload(o,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(o,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(o,c){let d=this.lineVertexArray.length;if(o.segment!==void 0){let y=o.dist(c[o.segment+1]),w=o.dist(c[o.segment]),S={};for(let C=o.segment+1;C<c.length;C++)S[C]={x:c[C].x,y:c[C].y,tileUnitDistanceFromAnchor:y},C<c.length-1&&(y+=c[C+1].dist(c[C]));for(let C=o.segment||0;C>=0;C--)S[C]={x:c[C].x,y:c[C].y,tileUnitDistanceFromAnchor:w},C>0&&(w+=c[C-1].dist(c[C]));for(let C=0;C<c.length;C++){let E=S[C];this.lineVertexArray.emplaceBack(E.x,E.y,E.tileUnitDistanceFromAnchor)}}return{lineStartIndex:d,lineLength:this.lineVertexArray.length-d}}addSymbols(o,c,d,y,w,S,C,E,D,z,B,$){let H=o.indexArray,K=o.layoutVertexArray,Z=o.segments.prepareSegment(4*c.length,K,H,this.canOverlap?S.sortKey:void 0),se=this.glyphOffsetArray.length,ce=Z.vertexLength,Ce=this.allowVerticalPlacement&&C===a.ah.vertical?Math.PI/2:0,ge=S.text&&S.text.sections;for(let ye=0;ye<c.length;ye++){let{tl:Pe,tr:qe,bl:lt,br:kt,tex:ct,pixelOffsetTL:nt,pixelOffsetBR:vt,minFontScaleX:pt,minFontScaleY:ht,glyphOffset:Fe,isSDF:bt,sectionIndex:_t}=c[ye],Rt=Z.vertexLength,Ni=Fe[1];_p(K,E.x,E.y,Pe.x,Ni+Pe.y,ct.x,ct.y,d,bt,nt.x,nt.y,pt,ht),_p(K,E.x,E.y,qe.x,Ni+qe.y,ct.x+ct.w,ct.y,d,bt,vt.x,nt.y,pt,ht),_p(K,E.x,E.y,lt.x,Ni+lt.y,ct.x,ct.y+ct.h,d,bt,nt.x,vt.y,pt,ht),_p(K,E.x,E.y,kt.x,Ni+kt.y,ct.x+ct.w,ct.y+ct.h,d,bt,vt.x,vt.y,pt,ht),tm(o.dynamicLayoutVertexArray,E,Ce),H.emplaceBack(Rt,Rt+1,Rt+2),H.emplaceBack(Rt+1,Rt+2,Rt+3),Z.vertexLength+=4,Z.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Fe[0]),ye!==c.length-1&&_t===c[ye+1].sectionIndex||o.programConfigurations.populatePaintArrays(K.length,S,S.index,{},$,ge&&ge[_t])}o.placedSymbolArray.emplaceBack(E.x,E.y,se,this.glyphOffsetArray.length-se,ce,D,z,E.segment,d?d[0]:0,d?d[1]:0,y[0],y[1],C,0,!1,0,B)}_addCollisionDebugVertex(o,c,d,y,w,S){return c.emplaceBack(0,0),o.emplaceBack(d.x,d.y,y,w,Math.round(S.x),Math.round(S.y))}addCollisionDebugVertices(o,c,d,y,w,S,C){let E=w.segments.prepareSegment(4,w.layoutVertexArray,w.indexArray),D=E.vertexLength,z=w.layoutVertexArray,B=w.collisionVertexArray,$=C.anchorX,H=C.anchorY;this._addCollisionDebugVertex(z,B,S,$,H,new T(o,c)),this._addCollisionDebugVertex(z,B,S,$,H,new T(d,c)),this._addCollisionDebugVertex(z,B,S,$,H,new T(d,y)),this._addCollisionDebugVertex(z,B,S,$,H,new T(o,y)),E.vertexLength+=4;let K=w.indexArray;K.emplaceBack(D,D+1),K.emplaceBack(D+1,D+2),K.emplaceBack(D+2,D+3),K.emplaceBack(D+3,D),E.primitiveLength+=4}addDebugCollisionBoxes(o,c,d,y){for(let w=o;w<c;w++){let S=this.collisionBoxArray.get(w);this.addCollisionDebugVertices(S.x1,S.y1,S.x2,S.y2,y?this.textCollisionBox:this.iconCollisionBox,S.anchorPoint,d)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new nm(ms,Gf.members,Yn),this.iconCollisionBox=new nm(ms,Gf.members,Yn);for(let o=0;o<this.symbolInstances.length;o++){let c=this.symbolInstances.get(o);this.addDebugCollisionBoxes(c.textBoxStartIndex,c.textBoxEndIndex,c,!0),this.addDebugCollisionBoxes(c.verticalTextBoxStartIndex,c.verticalTextBoxEndIndex,c,!0),this.addDebugCollisionBoxes(c.iconBoxStartIndex,c.iconBoxEndIndex,c,!1),this.addDebugCollisionBoxes(c.verticalIconBoxStartIndex,c.verticalIconBoxEndIndex,c,!1)}}_deserializeCollisionBoxesForSymbol(o,c,d,y,w,S,C,E,D){let z={};for(let B=c;B<d;B++){let $=o.get(B);z.textBox={x1:$.x1,y1:$.y1,x2:$.x2,y2:$.y2,anchorPointX:$.anchorPointX,anchorPointY:$.anchorPointY},z.textFeatureIndex=$.featureIndex;break}for(let B=y;B<w;B++){let $=o.get(B);z.verticalTextBox={x1:$.x1,y1:$.y1,x2:$.x2,y2:$.y2,anchorPointX:$.anchorPointX,anchorPointY:$.anchorPointY},z.verticalTextFeatureIndex=$.featureIndex;break}for(let B=S;B<C;B++){let $=o.get(B);z.iconBox={x1:$.x1,y1:$.y1,x2:$.x2,y2:$.y2,anchorPointX:$.anchorPointX,anchorPointY:$.anchorPointY},z.iconFeatureIndex=$.featureIndex;break}for(let B=E;B<D;B++){let $=o.get(B);z.verticalIconBox={x1:$.x1,y1:$.y1,x2:$.x2,y2:$.y2,anchorPointX:$.anchorPointX,anchorPointY:$.anchorPointY},z.verticalIconFeatureIndex=$.featureIndex;break}return z}deserializeCollisionBoxes(o){this.collisionArrays=[];for(let c=0;c<this.symbolInstances.length;c++){let d=this.symbolInstances.get(c);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(o,d.textBoxStartIndex,d.textBoxEndIndex,d.verticalTextBoxStartIndex,d.verticalTextBoxEndIndex,d.iconBoxStartIndex,d.iconBoxEndIndex,d.verticalIconBoxStartIndex,d.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(o,c){let d=o.placedSymbolArray.get(c),y=d.vertexStartIndex+4*d.numGlyphs;for(let w=d.vertexStartIndex;w<y;w+=4)o.indexArray.emplaceBack(w,w+1,w+2),o.indexArray.emplaceBack(w+1,w+2,w+3)}getSortedSymbolIndexes(o){if(this.sortedAngle===o&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let c=Math.sin(o),d=Math.cos(o),y=[],w=[],S=[];for(let C=0;C<this.symbolInstances.length;++C){S.push(C);let E=this.symbolInstances.get(C);y.push(0|Math.round(c*E.anchorX+d*E.anchorY)),w.push(E.featureIndex)}return S.sort((C,E)=>y[C]-y[E]||w[E]-w[C]),S}addToSortKeyRanges(o,c){let d=this.sortKeyRanges[this.sortKeyRanges.length-1];d&&d.sortKey===c?d.symbolInstanceEnd=o+1:this.sortKeyRanges.push({sortKey:c,symbolInstanceStart:o,symbolInstanceEnd:o+1})}sortFeatures(o){if(this.sortFeaturesByY&&this.sortedAngle!==o&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(o),this.sortedAngle=o,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let c of this.symbolInstanceIndexes){let d=this.symbolInstances.get(c);this.featureSortOrder.push(d.featureIndex),[d.rightJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.leftJustifiedTextSymbolIndex].forEac
vendor: 5,209 bytes, line 21
21h((y,w,S)=>{y>=0&&S.indexOf(y)===w&&this.addIndicesForPlacedSymbol(this.text,y)}),d.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,d.verticalPlacedTextSymbolIndex),d.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,d.placedIconSymbolIndex),d.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,d.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Py,rm;dt("SymbolBucket",bu,{omit:["layers","collisionBoxArray","features","compareText"]}),bu.MAX_GLYPHS=65535,bu.addDynamicAttributes=tm;var vp={get paint(){return rm=rm||new x({"icon-opacity":new Mt(Ie.paint_symbol["icon-opacity"]),"icon-color":new Mt(Ie.paint_symbol["icon-color"]),"icon-halo-color":new Mt(Ie.paint_symbol["icon-halo-color"]),"icon-halo-width":new Mt(Ie.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Mt(Ie.paint_symbol["icon-halo-blur"]),"icon-translate":new yt(Ie.paint_symbol["icon-translate"]),"icon-translate-anchor":new yt(Ie.paint_symbol["icon-translate-anchor"]),"text-opacity":new Mt(Ie.paint_symbol["text-opacity"]),"text-color":new Mt(Ie.paint_symbol["text-color"],{runtimeType:nr,getOverride:l=>l.textColor,hasOverride:l=>!!l.textColor}),"text-halo-color":new Mt(Ie.paint_symbol["text-halo-color"]),"text-halo-width":new Mt(Ie.paint_symbol["text-halo-width"]),"text-halo-blur":new Mt(Ie.paint_symbol["text-halo-blur"]),"text-translate":new yt(Ie.paint_symbol["text-translate"]),"text-translate-anchor":new yt(Ie.paint_symbol["text-translate-anchor"])})},get layout(){return Py=Py||new x({"symbol-placement":new yt(Ie.layout_symbol["symbol-placement"]),"symbol-spacing":new yt(Ie.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new yt(Ie.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Mt(Ie.layout_symbol["symbol-sort-key"]),"symbol-z-order":new yt(Ie.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new yt(Ie.layout_symbol["icon-allow-overlap"]),"icon-overlap":new yt(Ie.layout_symbol["icon-overlap"]),"icon-ignore-placement":new yt(Ie.layout_symbol["icon-ignore-placement"]),"icon-optional":new yt(Ie.layout_symbol["icon-optional"]),"icon-rotation-alignment":new yt(Ie.layout_symbol["icon-rotation-alignment"]),"icon-size":new Mt(Ie.layout_symbol["icon-size"]),"icon-text-fit":new yt(Ie.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new yt(Ie.layout_symbol["icon-text-fit-padding"]),"icon-image":new Mt(Ie.layout_symbol["icon-image"]),"icon-rotate":new Mt(Ie.layout_symbol["icon-rotate"]),"icon-padding":new Mt(Ie.layout_symbol["icon-padding"]),"icon-keep-upright":new yt(Ie.layout_symbol["icon-keep-upright"]),"icon-offset":new Mt(Ie.layout_symbol["icon-offset"]),"icon-anchor":new Mt(Ie.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new yt(Ie.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new yt(Ie.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new yt(Ie.layout_symbol["text-rotation-alignment"]),"text-field":new Mt(Ie.layout_symbol["text-field"]),"text-font":new Mt(Ie.layout_symbol["text-font"]),"text-size":new Mt(Ie.layout_symbol["text-size"]),"text-max-width":new Mt(Ie.layout_symbol["text-max-width"]),"text-line-height":new yt(Ie.layout_symbol["text-line-height"]),"text-letter-spacing":new Mt(Ie.layout_symbol["text-letter-spacing"]),"text-justify":new Mt(Ie.layout_symbol["text-justify"]),"text-radial-offset":new Mt(Ie.layout_symbol["text-radial-offset"]),"text-variable-anchor":new yt(Ie.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Mt(Ie.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Mt(Ie.layout_symbol["text-anchor"]),"text-max-angle":new yt(Ie.layout_symbol["text-max-angle"]),"text-writing-mode":new yt(Ie.layout_symbol["text-writing-mode"]),"text-rotate":new Mt(Ie.layout_symbol["text-rotate"]),"text-padding":new yt(Ie.layout_symbol["text-padding"]),"text-keep-upright":new yt(Ie.layout_symbol["text-keep-upright"]),"text-transform":new Mt(Ie.layout_symbol["text-transform"]),"text-offset":new Mt(Ie.layout_symbol["text-offset"]),"text-allow-overlap":new yt(Ie.layout_symbol["text-allow-overlap"]),"text-overlap":new yt(Ie.layout_symbol["text-overlap"]),"text-ignore-placement":new yt(Ie.layout_symbol["text-ignore-placement"]),"text-optional":new yt(Ie.layout_symbol["text-optional"])})}};class Dy{constructor(o){if(o.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=o.property.overrides?o.property.overrides.runtimeType:Ws,this.defaultValue=o}evaluate(o){if(o.formattedSection){let c=this.defaultValue.property.overrides;if(c&&c.hasOverride(o.formattedSection))return c.getOverride(o.formattedSection)}return o.feature&&o.featureState?this.defaultValue.evaluate(o.feature,o.featureState):this.defaultValue.property.specification.default}eachChild(o){this.defaultValue.isConstant()||o(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}dt("FormatSectionOverride",Dy,{omit:["defaultValue"]});class bp extends u{constructor(o){super(o,vp)}
21recalculate(o,c){if(super.recalculate(o,c),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let d=this.layout.get("text-writing-mode");if(d){let y=[];for(let w of d)y.indexOf(w)<0&&y.push(w);this.layout._values["text-writing-mode"]=y}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,c,d,y){let w=this.layout.get(o).evaluate(c,{},d,y),S=this._unevaluatedLayout._values[o];return S.isDataDriven()||gt(S.value)||!w?w:function(C,E){return E.replace(/{([^{}]+)}/g,(D,z)=>C&&z in C?String(C[z]):"")}(c.properties,w)}createBucket(o){return new bu(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let o of vp.paint.overridableProperties){if(!bp.hasPaintOverride(this.layout,o))continue;let c=this.paint.get(o),d=new Dy(c),y=new De(d,c.property.specification),w=null;w=c.value.kind==="constant"||c.value.kind==="source"?new ci("source",y):new rn("composite",y,c.value.zoomStops),this.paint._values[o]=new jn(c.property,w,c.parameters)}}_handleOverridablePaintPropertyUpdate(o,c,d){return!(!this.layout||c.isDataDriven()||d.isDataDriven())&&bp.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,c){let d=o.get("text-field"),y=vp.paint.properties[c],w=!1,S=C=>{for(let E of C)if(y.overrides&&y.overrides.hasOverride(E))return void(w=!0)};if(d.value.kind==="constant"&&d.value.value instanceof Br)S(d.value.value.sections);else if(d.value.kind==="source"){let C=D=>{w||(D instanceof rs&&Tn(D.value)===lo?S(D.value.sections):D instanceof Hc?S(D.sections):D.eachChild(C))},E=d.value;E._styleExpression&&C(E._styleExpression.expression)}return w}}let Ry;var vx={get paint(){return Ry=Ry||new x({"background-color":new yt(Ie.paint_background["background-color"]),"background-pattern":new au(Ie.paint_background["background-pattern"]),"background-opacity":new yt(Ie.paint_background["background-opacity"])})}};class xp extends u{constructor(o){super(o,vx)}}let zy;var bx={get paint(){return zy=zy||new x({"raster-opacity":new yt(Ie.paint_raster["raster-opacity"]),"raster-hue-rotate":new yt(Ie.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new yt(Ie.paint_raster["raster-brightness-min"]),"raster-brightness-max":new yt(Ie.paint_raster["raster-brightness-max"]),"raster-saturation":new yt(Ie.paint_raster["raster-saturation"]),"raster-contrast":new yt(Ie.paint_raster["raster-contrast"]),"raster-resampling":new yt(Ie.paint_raster["raster-resampling"]),"raster-fade-duration":new yt(Ie.paint_raster["raster-fade-duration"])})}};class xx extends u{constructor(o){super(o,bx)}}class wx extends u{constructor(o){super(o,{}),this.onAdd=c=>{this.implementation.onAdd&&this.implementation.onAdd(c,c.painter.context.gl)},this.onRemove=c=>{this.implementation.onRemove&&this.implementation.onRemove(c,c.painter.context.gl)},this.implementation=o}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Sx{constructor(o){this._methodToThrottle=o,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let sm=63710088e-1;class Tl{constructor(o,c){if(isNaN(o)||isNaN(c))throw new Error(`Invalid LngLat object: (${o}, ${c})`);
21if(this.lng=+o,this.lat=+c,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Tl(Oe(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(o){let c=Math.PI/180,d=this.lat*c,y=o.lat*c,w=Math.sin(d)*Math.sin(y)+Math.cos(d)*Math.cos(y)*Math.cos((o.lng-this.lng)*c);return sm*Math.acos(Math.min(w,1))}static convert(o){if(o instanceof Tl)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new Tl(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new Tl(Number("lng"in o?o.lng:o.lon),Number(o.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}let Oy=2*Math.PI*sm;function Fy(l){return Oy*Math.cos(l*Math.PI/180)}function By(l){return(180+l)/360}function Ny(l){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l*Math.PI/360)))/360}function Vh(l,o){return l/Fy(o)}function om(l){return 360/Math.PI*Math.atan(Math.exp((180-360*l)*Math.PI/180))-90}class xu{constructor(o,c,d=0){this.x=+o,this.y=+c,this.z=+d}static fromLngLat(o,c=0){let d=Tl.convert(o);return new xu(By(d.lng),Ny(d.lat),Vh(c,d.lat))}toLngLat(){return new Tl(360*this.x-180,om(this.y))}toAltitude(){return this.z*Fy(om(this.y))}meterInMercatorCoordinateUnits(){return 1/Oy*(o=om(this.y),1/Math.cos(o*Math.PI/180));var o}}function am(l,o,c){var d=2*Math.PI*6378137/256/Math.pow(2,c);return[l*d-2*Math.PI*6378137/2,o*d-2*Math.PI*6378137/2]}class $h{constructor(o,c,d){if(!function(y,w,S){return!(y<0||y>25||S<0||S>=Math.pow(2,y)||w<0||w>=Math.pow(2,y))}(o,c,d))throw new Error(`x=${c}, y=${d}, z=${o} outside of bounds. 0<=x<${Math.pow(2,o)}, 0<=y<${Math.pow(2,o)} 0<=z<=25 `);this.z=o,this.x=c,this.y=d,this.key=wu(0,o,o,c,d)}equals(o){return this.z===o.z&&this.x===o.x&&this.y===o.y}url(o,c,d){let y=(S=this.y,C=this.z,E=am(256*(w=this.x),256*(S=Math.pow(2,C)-S-1),C),D=am(256*(w+1),256*(S+1),C),E[0]+","+E[1]+","+D[0]+","+D[1]);var w,S,C,E,D;let z=function(B,$,H){let K,Z="";for(let se=B;se>0;se--)K=1<<se-1,Z+=($&K?1:0)+(H&K?2:0);return Z}(this.z,this.x,this.y);return o[(this.x+this.y)%o.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(d==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,c>1?"@2x":"").replace(/{quadkey}/g,z).replace(/{bbox-epsg-3857}/g,y)}isChildOf(o){let c=this.z-o.z;return c>0&&o.x===this.x>>c&&o.y===this.y>>c}getTilePoint(o){let c=Math.pow(2,this.z);return new T((o.x*c-this.x)*_n,(o.y*c-this.y)*_n)}toString(){return`${this.z}/${this.x}/${this.y}`}}class lm{constructor(o,c){this.wrap=o,this.canonical=c,this.key=wu(o,c.z,c.z,c.x,c.y)}}class bs{constructor(o,c,d,y,w){if(o<d)throw new Error(`overscaledZ should be >= z; overscaledZ = ${o}; z = ${d}`);this.overscaledZ=o,this.wrap=c,this.canonical=new $h(d,+y,+w),this.key=wu(c,o,d,y,w)}clone(){return new bs(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(o){return this.overscaledZ===o.overscaledZ&&this.wrap===o.wrap&&this.canonical.equals(o.canonical)}scaledTo(o){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);let c=this.canonical.z-o;return o>this.canonical.z?new bs(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new bs(o,this.wrap,o,this.canonical.x>>c,this.canonical.y>>c)}calculateScaledKey(o,c){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);let d=this.canonical.z-o;return o>this.canonical.z?wu(this.wrap*+c,o,this.canonical.z,this.canonical.x,this.canonical.y):wu(this.wrap*+c,o,o,this.canonical.x>>d,this.canonical.y>>d)}isChildOf(o){if(o.wrap!==this.wrap)return!1;let c=this.canonical.z-o.canonical.z;return o.overscaledZ===0||o.overscaledZ<this.overscaledZ&&o.canonical.x===this.canonical.x>>c&&o.canonical.y===this.canonical.y>>c}children(o){if(this.overscaledZ>=o)return[new bs(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let c=this.canonical.z+1,d=2*this.canonical.x,y=2*this.canonical.y;return[new bs(c,this.wrap,c,d,y),new bs(c,this.wrap,c,d+1,y),new bs(c,this.wrap,c,d,y+1),new bs(c,this.wrap,c,d+1,y+1)]}isLessThan(o){return this.wrap<o.wrap||!(this.wrap>o.wrap)&&(this.overscaledZ<o.overscaledZ||!(this.overscaledZ>
21o.overscaledZ)&&(this.canonical.x<o.canonical.x||!(this.canonical.x>o.canonical.x)&&this.canonical.y<o.canonical.y))}wrapped(){return new bs(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(o){return new bs(this.overscaledZ,o,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new lm(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(o){return this.canonical.getTilePoint(new xu(o.x-this.wrap,o.y))}}function wu(l,o,c,d,y){(l*=2)<0&&(l=-1*l-1);let w=1<<c;return(w*w*l+w*y+d).toString(36)+c.toString(36)+o.toString(36)}dt("CanonicalTileID",$h),dt("OverscaledTileID",bs,{omit:["posMatrix"]});class cm{constructor(o,c,d,y=1,w=1,S=1,C=0){if(this.uid=o,c.height!==c.width)throw new RangeError("DEM tiles must be square");if(d&&!["mapbox","terrarium","custom"].includes(d))return void Tt(`"${d}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=c.height;let E=this.dim=c.height-2;switch(this.data=new Uint32Array(c.data.buffer),d){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=y,this.greenFactor=w,this.blueFactor=S,this.baseShift=C;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let D=0;D<E;D++)this.data[this._idx(-1,D)]=this.data[this._idx(0,D)],this.data[this._idx(E,D)]=this.data[this._idx(E-1,D)],this.data[this._idx(D,-1)]=this.data[this._idx(D,0)],this.data[this._idx(D,E)]=this.data[this._idx(D,E-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(E,-1)]=this.data[this._idx(E-1,0)],this.data[this._idx(-1,E)]=this.data[this._idx(0,E-1)],this.data[this._idx(E,E)]=this.data[this._idx(E-1,E-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let D=0;D<E;D++)for(let z=0;z<E;z++){let B=this.get(D,z);B>this.max&&(this.max=B),B<this.min&&(this.min=B)}}get(o,c){let d=new Uint8Array(this.data.buffer),y=4*this._idx(o,c);return this.unpack(d[y],d[y+1],d[y+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(o,c){if(o<-1||o>=this.dim+1||c<-1||c>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(c+1)*this.stride+(o+1)}unpack(o,c,d){return o*this.redFactor+c*this.greenFactor+d*this.blueFactor-this.baseShift}getPixels(){return new vs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(o,c,d){if(this.dim!==o.dim)throw new Error("dem dimension mismatch");let y=c*this.dim,w=c*this.dim+this.dim,S=d*this.dim,C=d*this.dim+this.dim;switch(c){case-1:y=w-1;break;case 1:w=y+1}switch(d){case-1:S=C-1;break;case 1:C=S+1}let E=-c*this.dim,D=-d*this.dim;for(let z=S;z<C;z++)for(let B=y;B<w;B++)this.data[this._idx(B,z)]=o.data[this._idx(B+E,z+D)]}}dt("DEMData",cm);class Vy{constructor(o){this._stringToNumber={},this._numberToString=[];for(let c=0;c<o.length;c++){let d=o[c];this._stringToNumber[d]=c,this._numberToString[c]=d}}encode(o){return this._stringToNumber[o]}decode(o){if(o>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${o} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[o]}}class $y{constructor(o,c,d,y,w){this.type="Feature",this._vectorTileFeature=o,o._z=c,o._x=d,o._y=y,this.properties=o.properties,this.id=w}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(o){this._geometry=o}toJSON(){let o={geometry:this.geometry};for(let c in this)c!=="_geometry"&&c!=="_vectorTileFeature"&&(o[c]=this[c]);return o}}class Uy{constructor(o,c){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new yo(_n,16,0),this.grid3D=new yo(_n,16,0),this.featureIndexArray=new br,this.promoteId=c}insert(o,c,d,y,w,S){let C=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(d,y,w);let E=S?this.grid3D:this.grid;for(let D=0;D<c.length;D++){let z=c[D],B=[1/0,1/0,-1/0,-1/0];for(let $=0;$<z.length;$++){let H=z[$];B[0]=Math.min(B[0],H.x),B[1]=Math.min(B[1],H.y),B[2]=Math.max(B[2],H.x),B[3]=Math.max(B[3],H.y)}B[0]<_n&&B[1]<_n&&B[2]>=0&&B[3]>=0&&E.insert(C,B[0],B[1],B[2],B[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new kn.VectorTile(new Xf(this.rawTileData)).layers,this.sourceLayerCoder=new Vy(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,c,d,y){this.loadVTLayers();let w=o.params||{},S=_n/o.tileSize/o.scale,C=ph(w.filter),E=o.queryGeometry,D=o.queryPadding*S,z=jh(E),B=this.grid.query(z.minX-D,z.minY-D,z.maxX+D,z.maxY+D),$=jh(o.cameraQueryGeometry),H=this.grid3D.query($.minX-D,$.minY-D,$.maxX+D,$.maxY+D,(se,ce,Ce,ge)=>function(ye,Pe,qe,lt,kt){for(let nt of ye)if(Pe<=nt.x&&qe<=nt.y&&lt>=nt.x&&kt>=nt.y)return!0;let ct=[new T(Pe,qe),new T(Pe,kt),new T(lt,kt),new T(lt,qe)];if(ye.length>2){for(let nt of ct)if(sc(ye,nt))return!0}for(let nt=0;nt<ye.length-1;nt++)if(Hg(ye[nt],ye[nt+1],ct))return!0;return!1}(o.cameraQueryGeometry,se-D,ce-D,Ce+D,ge+D));for(let se of H)B.push(se);B.sort(Tx);let K={},Z;for(let se=0;se<B.length;se++){let ce=B[se];if(ce===Z)continue;Z=ce;let Ce=this.featureIndexArray.get(ce),ge=null;
vendor: 6,269 bytes, line 21
21this.loadMatchingFeature(K,Ce.bucketIndex,Ce.sourceLayerIndex,Ce.featureIndex,C,w.layers,w.availableImages,c,d,y,(ye,Pe,qe)=>(ge||(ge=Jn(ye)),Pe.queryIntersectsFeature(E,ye,qe,ge,this.z,o.transform,S,o.pixelPosMatrix)))}return K}loadMatchingFeature(o,c,d,y,w,S,C,E,D,z,B){let $=this.bucketLayerIDs[c];if(S&&!function(se,ce){for(let Ce=0;Ce<se.length;Ce++)if(ce.indexOf(se[Ce])>=0)return!0;return!1}(S,$))return;let H=this.sourceLayerCoder.decode(d),K=this.vtLayers[H].feature(y);if(w.needGeometry){let se=ys(K,!0);if(!w.filter(new Ki(this.tileID.overscaledZ),se,this.tileID.canonical))return}else if(!w.filter(new Ki(this.tileID.overscaledZ),K))return;let Z=this.getId(K,H);for(let se=0;se<$.length;se++){let ce=$[se];if(S&&S.indexOf(ce)<0)continue;let Ce=E[ce];if(!Ce)continue;let ge={};Z&&z&&(ge=z.getState(Ce.sourceLayer||"_geojsonTileLayer",Z));let ye=ze({},D[ce]);ye.paint=Uh(ye.paint,Ce.paint,K,ge,C),ye.layout=Uh(ye.layout,Ce.layout,K,ge,C);let Pe=!B||B(K,Ce,ge);if(!Pe)continue;let qe=new $y(K,this.z,this.x,this.y,Z);qe.layer=ye;let lt=o[ce];lt===void 0&&(lt=o[ce]=[]),lt.push({featureIndex:y,feature:qe,intersectionZ:Pe})}}lookupSymbolFeatures(o,c,d,y,w,S,C,E){let D={};this.loadVTLayers();let z=ph(w);for(let B of o)this.loadMatchingFeature(D,d,y,B,z,S,C,E,c);return D}hasLayer(o){for(let c of this.bucketLayerIDs)for(let d of c)if(o===d)return!0;return!1}getId(o,c){let d=o.id;return this.promoteId&&(d=o.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[c]],typeof d=="boolean"&&(d=Number(d))),d}}function Uh(l,o,c,d,y){return Ke(l,(w,S)=>{let C=o instanceof ic?o.get(S):null;return C&&C.evaluate?C.evaluate(c,d,y):C})}function jh(l){let o=1/0,c=1/0,d=-1/0,y=-1/0;for(let w of l)o=Math.min(o,w.x),c=Math.min(c,w.y),d=Math.max(d,w.x),y=Math.max(y,w.y);return{minX:o,minY:c,maxX:d,maxY:y}}function Tx(l,o){return o-l}function jy(l,o,c,d,y){let w=[];for(let S=0;S<l.length;S++){let C=l[S],E;for(let D=0;D<C.length-1;D++){let z=C[D],B=C[D+1];z.x<o&&B.x<o||(z.x<o?z=new T(o,z.y+(o-z.x)/(B.x-z.x)*(B.y-z.y))._round():B.x<o&&(B=new T(o,z.y+(o-z.x)/(B.x-z.x)*(B.y-z.y))._round()),z.y<c&&B.y<c||(z.y<c?z=new T(z.x+(c-z.y)/(B.y-z.y)*(B.x-z.x),c)._round():B.y<c&&(B=new T(z.x+(c-z.y)/(B.y-z.y)*(B.x-z.x),c)._round()),z.x>=d&&B.x>=d||(z.x>=d?z=new T(d,z.y+(d-z.x)/(B.x-z.x)*(B.y-z.y))._round():B.x>=d&&(B=new T(d,z.y+(d-z.x)/(B.x-z.x)*(B.y-z.y))._round()),z.y>=y&&B.y>=y||(z.y>=y?z=new T(z.x+(y-z.y)/(B.y-z.y)*(B.x-z.x),y)._round():B.y>=y&&(B=new T(z.x+(y-z.y)/(B.y-z.y)*(B.x-z.x),y)._round()),E&&z.equals(E[E.length-1])||(E=[z],w.push(E)),E.push(B)))))}}return w}dt("FeatureIndex",Uy,{omit:["rawTileData","sourceLayerCoder"]});class Zo extends T{constructor(o,c,d,y){super(o,c),this.angle=d,y!==void 0&&(this.segment=y)}clone(){return new Zo(this.x,this.y,this.angle,this.segment)}}function um(l,o,c,d,y){if(o.segment===void 0||c===0)return!0;let w=o,S=o.segment+1,C=0;for(;C>-c/2;){if(S--,S<0)return!1;C-=l[S].dist(w),w=l[S]}C+=l[S].dist(l[S+1]),S++;let E=[],D=0;for(;C<c/2;){let z=l[S],B=l[S+1];if(!B)return!1;let $=l[S-1].angleTo(z)-z.angleTo(B);for($=Math.abs(($+3*Math.PI)%(2*Math.PI)-Math.PI),E.push({distance:C,angleDelta:$}),D+=$;C-E[0].distance>d;)D-=E.shift().angleDelta;if(D>y)return!1;S++,C+=z.dist(B)}return!0}function qy(l){let o=0;for(let c=0;c<l.length-1;c++)o+=l[c].dist(l[c+1]);return o}function Hy(l,o,c){return l?.6*o*c:0}function Wy(l,o){return Math.max(l?l.right-l.left:0,o?o.right-o.left:0)}function kx(l,o,c,d,y,w){let S=Hy(c,y,w),C=Wy(c,d)*w,E=0,D=qy(l)/2;for(let z=0;z<l.length-1;z++){let B=l[z],$=l[z+1],H=B.dist($);if(E+H>D){let K=(D-E)/H,Z=Ar.number(B.x,$.x,K),se=Ar.number(B.y,$.y,K),ce=new Zo(Z,se,$.angleTo(B),z);return ce._round(),!S||um(l,ce,C,S,o)?ce:void 0}E+=H}}function Cx(l,o,c,d,y,w,S,C,E){let D=Hy(d,w,S),z=Wy(d,y),B=z*S,$=l[0].x===0||l[0].x===E||l[0].y===0||l[0].y===E;return o-B<o/4&&(o=B+o/4),Gy(l,$?o/2*C%o:(z/2+2*w)*S*C%o,o,D,c,B,$,!1,E)}function Gy(l,o,c,d,y,w,S,C,E){let D=w/2,z=qy(l),B=0,$=o-c,H=[];for(let K=0;K<l.length-1;K++){let Z=l[K],se=l[K+1],ce=Z.dist(se),Ce=se.angleTo(Z);for(;$+c<B+ce;){$+=c;let ge=($-B)/ce,ye=Ar.number(Z.x,se.x,ge),Pe=Ar.number(Z.y,se.y,ge);if(ye>=0&&ye<E&&Pe>=0&&Pe<E&&$-D>=0&&$+D<=z){let qe=new Zo(ye,Pe,Ce,K);qe._round(),d&&!um(l,qe,w,d,y)||H.push(qe)}}B+=ce}return C||H.length||S||(H=Gy(l,B/2,c,d,y,w,S,!0,E)),H}dt("Anchor",Zo);let Su=Wr;function Zy(l,o,c,d){let y=[],w=l.image,S=w.pixelRatio,C=w.paddedRect.w-2*Su,E=w.paddedRect.h-2*Su,D={x1:l.left,y1:l.top,x2:l.right,y2:l.bottom},z=w.stretchX||[[0,C]],B=w.stretchY||[[0,E]],$=(Fe,bt)=>Fe+bt[1]-bt[0],H=z.reduce($,0),K=B.reduce($,0),Z=C-H,se=E-K,ce=0,Ce=H,ge=0,ye=K,Pe=0,qe=Z,lt=0,kt=se;if(w.content&&d){let Fe=w.content,bt=Fe[2]-Fe[0],_t=Fe[3]-Fe[1];(w.textFitWidth||w.textFitHeight)&&(D=Ey(l)),ce=wp(z,0,Fe[0]),ge=wp(B,0,Fe[1]),Ce=wp(z,Fe[0],Fe[2]),ye=wp(B,Fe[1],Fe[3]),Pe=Fe[0]-ce,lt=Fe[1]-ge,qe=bt-Ce,kt=_t-ye}let ct=D.x1,nt=D.y1,vt=D.x2-ct,pt=D.y2-nt,ht=(Fe,bt,_t,Rt)=>{let Ni=Sp(Fe.stretch-ce,Ce,vt,ct),Fi=Tp(Fe.fixed-Pe,qe,Fe.stretch,H),qn=Sp(bt.stretch-ge,ye,pt,nt),ws=Tp(bt.fixed-lt,kt,bt.stretch,K),hr=Sp(_t.stretch-ce,Ce,vt,ct),Mn=Tp(_t.fixed-Pe,qe,_t.stretch,H),Pr=Sp(Rt.stretch-ge,ye,pt,nt),Dr=Tp(Rt.fixed-lt,kt,Rt.stretch,K),Rr=new T(Ni,qn),si=new T(hr,qn),Ci=new T(hr,Pr),wr=new T(Ni,Pr),dr=new T(Fi/S,ws/S),zr=new T(Mn/S,Dr/S),Qn=o*Math.PI/180;if(Qn){let vi=Math.sin(Qn),Vi=Math.cos(Qn),Xi=[Vi,-vi,vi,Vi];Rr._matMult(Xi),si._matMult(Xi),wr._matMult(Xi),Ci._matMult(Xi)}let Fs=Fe.stretch+Fe.fixed,Gr=bt.stretch+bt.fixed;return{tl:Rr,tr:si,bl:wr,br:Ci,tex:{x:w.paddedRect.x+Su+Fs,y:w.paddedRect.y+Su+Gr,w:_t.stretch+_t.fixed-Fs,h:Rt.stretch+Rt.fixed-Gr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:dr,pixelOffsetBR:zr,minFontScaleX:qe/S/vt,minFontScaleY:kt/S/pt,isSDF:c}};if(d&&(w.stretchX||w.stretchY)){let Fe=Ky(z,Z,H),bt=Ky(B,se,K);for(let _t=0;_t<Fe.length-1;_t++){let Rt=Fe[_t],Ni=Fe[_t+1];for(let Fi=0;Fi<bt.length-1;Fi++)y.push(ht(Rt,bt[Fi],Ni,bt[Fi+1]))}}else y.push(ht({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:C+1},{fixed:0,stretch:E+1}));return y}function wp(l,o,c){let d=0;for(let y of l)d+=Math.max(o,Math.min(c,y[1]))-Math.max(o,Math.min(c,y[0]));return d}function Ky(l,o,c){let d=[{fixed:-Su,stretch:0}];for(let[y,w]of l){let S=d[d.length-1];
21d.push({fixed:y-S.stretch,stretch:S.stretch}),d.push({fixed:y-S.stretch,stretch:S.stretch+(w-y)})}return d.push({fixed:o+Su,stretch:c}),d}function Sp(l,o,c,d){return l/o*c+d}function Tp(l,o,c,d){return l-o*c/d}class xs{constructor(o,c,d,y,w,S,C,E,D,z){var B;if(this.boxStartIndex=o.length,D){let $=S.top,H=S.bottom,K=S.collisionPadding;K&&($-=K[1],H+=K[3]);let Z=H-$;Z>0&&(Z=Math.max(10,Z),this.circleDiameter=Z)}else{let $=!((B=S.image)===null||B===void 0)&&B.content&&(S.image.textFitWidth||S.image.textFitHeight)?Ey(S):{x1:S.left,y1:S.top,x2:S.right,y2:S.bottom};$.y1=$.y1*C-E[0],$.y2=$.y2*C+E[2],$.x1=$.x1*C-E[3],$.x2=$.x2*C+E[1];let H=S.collisionPadding;if(H&&($.x1-=H[0]*C,$.y1-=H[1]*C,$.x2+=H[2]*C,$.y2+=H[3]*C),z){let K=new T($.x1,$.y1),Z=new T($.x2,$.y1),se=new T($.x1,$.y2),ce=new T($.x2,$.y2),Ce=z*Math.PI/180;K._rotate(Ce),Z._rotate(Ce),se._rotate(Ce),ce._rotate(Ce),$.x1=Math.min(K.x,Z.x,se.x,ce.x),$.x2=Math.max(K.x,Z.x,se.x,ce.x),$.y1=Math.min(K.y,Z.y,se.y,ce.y),$.y2=Math.max(K.y,Z.y,se.y,ce.y)}o.emplaceBack(c.x,c.y,$.x1,$.y1,$.x2,$.y2,d,y,w)}this.boxEndIndex=o.length}}class Mx{constructor(o=[],c=(d,y)=>d<y?-1:d>y?1:0){if(this.data=o,this.length=this.data.length,this.compare=c,this.length>0)for(let d=(this.length>>1)-1;d>=0;d--)this._down(d)}push(o){this.data.push(o),this._up(this.length++)}pop(){if(this.length===0)return;let o=this.data[0],c=this.data.pop();return--this.length>0&&(this.data[0]=c,this._down(0)),o}peek(){return this.data[0]}_up(o){let{data:c,compare:d}=this,y=c[o];for(;o>0;){let w=o-1>>1,S=c[w];if(d(y,S)>=0)break;c[o]=S,o=w}c[o]=y}_down(o){let{data:c,compare:d}=this,y=this.length>>1,w=c[o];for(;o<y;){let S=1+(o<<1),C=S+1;if(C<this.length&&d(c[C],c[S])<0&&(S=C),d(c[S],w)>=0)break;c[o]=c[S],o=S}c[o]=w}}function Ax(l,o=1,c=!1){let d=1/0,y=1/0,w=-1/0,S=-1/0,C=l[0];for(let H=0;H<C.length;H++){let K=C[H];(!H||K.x<d)&&(d=K.x),(!H||K.y<y)&&(y=K.y),(!H||K.x>w)&&(w=K.x),(!H||K.y>S)&&(S=K.y)}let E=Math.min(w-d,S-y),D=E/2,z=new Mx([],yc);if(E===0)return new T(d,y);for(let H=d;H<w;H+=E)for(let K=y;K<S;K+=E)z.push(new Ut(H+D,K+D,D,l));let B=function(H){let K=0,Z=0,se=0,ce=H[0];for(let Ce=0,ge=ce.length,ye=ge-1;Ce<ge;ye=Ce++){let Pe=ce[Ce],qe=ce[ye],lt=Pe.x*qe.y-qe.x*Pe.y;Z+=(Pe.x+qe.x)*lt,se+=(Pe.y+qe.y)*lt,K+=3*lt}return new Ut(Z/K,se/K,0,H)}(l),$=z.length;for(;z.length;){let H=z.pop();(H.d>B.d||!B.d)&&(B=H,c&&console.log("found best %d after %d probes",Math.round(1e4*H.d)/1e4,$)),H.max-B.d<=o||(D=H.h/2,z.push(new Ut(H.p.x-D,H.p.y-D,D,l)),z.push(new Ut(H.p.x+D,H.p.y-D,D,l)),z.push(new Ut(H.p.x-D,H.p.y+D,D,l)),z.push(new Ut(H.p.x+D,H.p.y+D,D,l)),$+=4)}return c&&(console.log(`num probes: ${$}`),console.log(`best distance: ${B.d}`)),B.p}function yc(l,o){return o.max-l.max}function Ut(l,o,c,d){this.p=new T(l,o),this.h=c,this.d=function(y,w){let S=!1,C=1/0;for(let E=0;E<w.length;E++){let D=w[E];for(let z=0,B=D.length,$=B-1;z<B;$=z++){let H=D[z],K=D[$];H.y>y.y!=K.y>y.y&&y.x<(K.x-H.x)*(y.y-H.y)/(K.y-H.y)+H.x&&(S=!S),C=Math.min(C,qg(y,H,K))}}return(S?1:-1)*Math.sqrt(C)}(this.p,d),this.max=this.d+this.h*Math.SQRT2}var ur;a.aq=void 0,(ur=a.aq||(a.aq={}))[ur.center=1]="center",ur[ur.left=2]="left",ur[ur.right=3]="right",ur[ur.top=4]="top",ur[ur.bottom=5]="bottom",ur[ur["top-left"]=6]="top-left",ur[ur["top-right"]=7]="top-right",ur[ur["bottom-left"]=8]="bottom-left",ur[ur["bottom-right"]=9]="bottom-right";let Pn=7,xn=Number.POSITIVE_INFINITY;function Xy(l,o){return o[1]!==xn?function(c,d,y){let w=0,S=0;switch(d=Math.abs(d),y=Math.abs(y),c){case"top-right":case"top-left":case"top":S=y-Pn;break;case"bottom-right":case"bottom-left":case"bottom":S=-y+Pn}switch(c){case"top-right":case"bottom-right":case"right":w=-d;break;case"top-left":case"bottom-left":case"left":w=d}return[w,S]}(l,o[0],o[1]):function(c,d){let y=0,w=0;d<0&&(d=0);let S=d/Math.SQRT2;switch(c){case"top-right":case"top-left":w=S-Pn;break;case"bottom-right":case"bottom-left":w=-S+Pn;break;case"bottom":w=-d+Pn;break;case"top":w=d-Pn}switch(c){case"top-right":case"bottom-right":y=-S;break;case"top-left":case"bottom-left":y=S;break;case"left":y=d;break;case"right":y=-d}return[y,w]}(l,o[0])}function Ra(l,o,c){var d;let y=l.layout,w=(d=y.get("text-variable-anchor-offset"))===null||d===void 0?void 0:d.evaluate(o,{},c);if(w){let C=w.values,E=[];for(let D=0;D<C.length;D+=2){let z=E[D]=C[D],B=C[D+1].map($=>$*Cn);z.startsWith("top")?B[1]-=Pn:z.startsWith("bottom")&&(B[1]+=Pn),E[D+1]=B}return new Nr(E)}let S=y.get("text-variable-anchor");if(S){let C;C=l._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[y.get("text-radial-offset").evaluate(o,{},c)*Cn,xn]:y.get("text-offset").evaluate(o,{},c).map(D=>D*Cn);let E=[];for(let D of S)E.push(D,Xy(D,C));return new Nr(E)}return null}function hm(l){switch(l){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Ex(l,o,c,d,y,w,S,C,E,D,z){let B=w.textMaxSize.evaluate(o,{});B===void 0&&(B=S);let $=l.layers[0].layout,H=$.get("icon-offset").evaluate(o,{},z),K=Jy(c.horizontal),Z=S/24,se=l.tilePixelRatio*Z,ce=l.tilePixelRatio*B/24,Ce=l.tilePixelRatio*C,ge=l.tilePixelRatio*$.get("symbol-spacing"),ye=$.get("text-padding")*l.tilePixelRatio,Pe=function(Fe,bt,_t,Rt=1){let Ni=Fe.get("icon-padding").evaluate(bt,{},_t),Fi=Ni&&Ni.values;return[Fi[0]*Rt,Fi[1]*Rt,Fi[2]*Rt,Fi[3]*Rt]}($,o,z,l.tilePixelRatio),qe=$.get("text-max-angle")/180*Math.PI,lt=$.get("text-rotation-alignment")!=="viewport"&&$.get("symbol-placement")!=="point",kt=$.get("icon-rotation-alignment")==="map"&&$.get("symbol-placement")!=="point",ct=$.get("symbol-placement"),nt=ge/2,vt=$.get("icon-text-fit"),pt;d&&vt!=="none"&&(l.allowVerticalPlacement&&c.vertical&&(pt=Iy(d,c.vertical,vt,$.get("icon-text-fit-padding"),H,Z)),K&&(d=Iy(d,K,vt,$.get("icon-text-fit-padding"),H,Z)));let ht=(Fe,bt)=>{bt.x<0||bt.x>=_n||bt.y<0||bt.y>=_n||function(_t,Rt,Ni,Fi,qn,ws,hr,Mn,Pr,Dr,Rr,si,Ci,wr,dr,zr,Qn,Fs,Gr,vi,Vi,Xi,Ss,dn,_c){let wo=_t.addToLineVertexArray(Rt,Ni),Ko,Qs,Bs,er,Ts=0,Hh=0,Qy=0,e0=0,ym=-1,_m=-1,Xo={},vm=nc("");if(_t.allowVerticalPlacement&&Fi.vertical){let Sr=Mn.layout.get("text-rotate").evaluate(Vi,{},dn)+90;Bs=new xs(Pr,Rt,Dr,Rr,si,Fi.vertical,Ci,wr,dr,Sr),hr&&(er=new xs(Pr,Rt,Dr,Rr,si,hr,Qn,Fs,dr,Sr))}if(qn){let Sr=Mn.layout.get("icon-rotate").evaluate(Vi,{}),Ns=Mn.layout.get("icon-text-fit")!=="none",vc=Zy(qn,Sr,Ss,Ns),To=hr?Zy(hr,Sr,Ss,Ns):void 0;Qs=new xs(Pr,Rt,Dr,Rr,si,qn,Qn,Fs,!1,Sr),Ts=4*vc.length;let bc=_t.iconSizeData,Yo=null;bc.kind==="source"?(Yo=[Go*Mn.layout.get("icon-size").evaluate(Vi,{})],Yo[0]>Sl&&Tt(`${_t.layerIds[0]}: Value for "icon-size" is >= ${Nh}. Reduce your "icon-size".`)):bc.kind==="composite"&&(Yo=[Go*Xi.compositeIconSizes[0].evaluate(Vi,{},dn),Go*Xi.compositeIconSizes[1].evaluate(Vi,{},dn)],(Yo[0]>Sl||Yo[1]>Sl)&&Tt(`${_t.layerIds[0]}: Value for "icon-size" is >= ${Nh}. Reduce your "icon-size".`)),_t.addSymbols(_t.icon,vc,Yo,vi,Gr,Vi,a.ah.none,Rt,wo.lineStartIndex,wo.lineLength,-1,dn),ym=_t.icon.placedSymbolArray.length-1,To&&(Hh=4*To.length,_t.addSymbols(_t.icon,To,Yo,vi,Gr,Vi,a.ah.vertical,Rt,wo.lineStartIndex,wo.lineLength,-1,dn),_m=_t.icon.placedSymbolArray.length-1)}let t0=Object.keys(Fi.horizontal);for(let Sr of t0){let Ns=Fi.horizontal[Sr];if(!Ko){vm=nc(Ns.text);let To=Mn.layout.get("text-rotate").evaluate(Vi,{},dn);Ko=new xs(Pr,Rt,Dr,Rr,si,Ns,Ci,wr,dr,To)}let vc=Ns.positionedLines.length===1;if(Qy+=Yy(_t,Rt,Ns,ws,Mn,dr,Vi,zr,wo,Fi.vertical?a.ah.horizontal:a.ah.horizontalOnly,vc?t0:[Sr],Xo,ym,Xi,dn),vc)break}Fi.vertical&&(e0+=Yy(_t,Rt,Fi.vertical,ws,Mn,dr,Vi,zr,wo,a.ah.vertical,["vertical"],Xo,_m,Xi,dn));let Px=Ko?Ko.boxStartIndex:_t.collisionBoxArray.length,Dx=Ko?Ko.boxEndIndex:_t.collisionBoxArray.length,Rx=Bs?Bs.boxStartIndex:_t.collisionBoxArray.length,zx=Bs?Bs.boxEndIndex:_t.collisionBoxArray.length,Ox=Qs?Qs.boxStartIndex:_t.collisionBoxArray.length,Fx=Qs?Qs.boxEndIndex:_t.collisionBoxArray.length,Bx=er?er.boxStartIndex:_t.collisionBoxArray.length,Nx=er?er.boxEndIndex:_t.collisionBoxArray.length,So=-1,Ap=(Sr,Ns)=>Sr&&Sr.circleDiameter?Math.max(Sr.circleDiameter,Ns):Ns;So=Ap(Ko,So),So=Ap(Bs,So),So=Ap(Qs,So),So=Ap(er,So);let i0=So>-1?1:0;i0&&(So*=_c/Cn),_t.glyphOffsetArray.length>=bu.MAX_GLYPHS&&Tt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Vi.sortKey!==void 0&&_t.addToSortKey
21Ranges(_t.symbolInstances.length,Vi.sortKey);let Vx=Ra(Mn,Vi,dn),[$x,Ux]=function(Sr,Ns){let vc=Sr.length,To=Ns?.values;if(To?.length>0)for(let bc=0;bc<To.length;bc+=2){let Yo=To[bc+1];Sr.emplaceBack(a.aq[To[bc]],Yo[0],Yo[1])}return[vc,Sr.length]}(_t.textAnchorOffsets,Vx);_t.symbolInstances.emplaceBack(Rt.x,Rt.y,Xo.right>=0?Xo.right:-1,Xo.center>=0?Xo.center:-1,Xo.left>=0?Xo.left:-1,Xo.vertical||-1,ym,_m,vm,Px,Dx,Rx,zx,Ox,Fx,Bx,Nx,Dr,Qy,e0,Ts,Hh,i0,0,Ci,So,$x,Ux)}(l,bt,Fe,c,d,y,pt,l.layers[0],l.collisionBoxArray,o.index,o.sourceLayerIndex,l.index,se,[ye,ye,ye,ye],lt,E,Ce,Pe,kt,H,o,w,D,z,S)};if(ct==="line")for(let Fe of jy(o.geometry,0,0,_n,_n)){let bt=Cx(Fe,ge,qe,c.vertical||K,d,24,ce,l.overscaling,_n);for(let _t of bt)K&&Ix(l,K.text,nt,_t)||ht(Fe,_t)}else if(ct==="line-center"){for(let Fe of o.geometry)if(Fe.length>1){let bt=kx(Fe,qe,c.vertical||K,d,24,ce);bt&&ht(Fe,bt)}}else if(o.type==="Polygon")for(let Fe of ji(o.geometry,0)){let bt=Ax(Fe,16);ht(Fe[0],new Zo(bt.x,bt.y,0))}else if(o.type==="LineString")for(let Fe of o.geometry)ht(Fe,new Zo(Fe[0].x,Fe[0].y,0));else if(o.type==="Point")for(let Fe of o.geometry)for(let bt of Fe)ht([bt],new Zo(bt.x,bt.y,0))}function Yy(l,o,c,d,y,w,S,C,E,D,z,B,$,H,K){let Z=function(Ce,ge,ye,Pe,qe,lt,kt,ct){let nt=Pe.layout.get("text-rotate").evaluate(lt,{})*Math.PI/180,vt=[];for(let pt of ge.positionedLines)for(let ht of pt.positionedGlyphs){if(!ht.rect)continue;let Fe=ht.rect||{},bt=wy+1,_t=!0,Rt=1,Ni=0,Fi=(qe||ct)&&ht.vertical,qn=ht.metrics.advance*ht.scale/2;if(ct&&ge.verticalizable&&(Ni=pt.lineOffset/2-(ht.imageName?-(Cn-ht.metrics.width*ht.scale)/2:(ht.scale-1)*Cn)),ht.imageName){let vi=kt[ht.imageName];_t=vi.sdf,Rt=vi.pixelRatio,bt=Wr/Rt}let ws=qe?[ht.x+qn,ht.y]:[0,0],hr=qe?[0,0]:[ht.x+qn+ye[0],ht.y+ye[1]-Ni],Mn=[0,0];Fi&&(Mn=hr,hr=[0,0]);let Pr=ht.metrics.isDoubleResolution?2:1,Dr=(ht.metrics.left-bt)*ht.scale-qn+hr[0],Rr=(-ht.metrics.top-bt)*ht.scale+hr[1],si=Dr+Fe.w/Pr*ht.scale/Rt,Ci=Rr+Fe.h/Pr*ht.scale/Rt,wr=new T(Dr,Rr),dr=new T(si,Rr),zr=new T(Dr,Ci),Qn=new T(si,Ci);if(Fi){let vi=new T(-qn,qn-Oh),Vi=-Math.PI/2,Xi=Cn/2-qn,Ss=new T(5-Oh-Xi,-(ht.imageName?Xi:0)),dn=new T(...Mn);wr._rotateAround(Vi,vi)._add(Ss)._add(dn),dr._rotateAround(Vi,vi)._add(Ss)._add(dn),zr._rotateAround(Vi,vi)._add(Ss)._add(dn),Qn._rotateAround(Vi,vi)._add(Ss)._add(dn)}if(nt){let vi=Math.sin(nt),Vi=Math.cos(nt),Xi=[Vi,-vi,vi,Vi];wr._matMult(Xi),dr._matMult(Xi),zr._matMult(Xi),Qn._matMult(Xi)}let Fs=new T(0,0),Gr=new T(0,0);vt.push({tl:wr,tr:dr,bl:zr,br:Qn,tex:Fe,writingMode:ge.writingMode,glyphOffset:ws,sectionIndex:ht.sectionIndex,isSDF:_t,pixelOffsetTL:Fs,pixelOffsetBR:Gr,minFontScaleX:0,minFontScaleY:0})}return vt}(0,c,C,y,w,S,d,l.allowVerticalPlacement),se=l.textSizeData,ce=null;se.kind==="source"?(ce=[Go*y.layout.get("text-size").evaluate(S,{})],ce[0]>Sl&&Tt(`${l.layerIds[0]}: Value for "text-size" is >= ${Nh}. Reduce your "text-size".`)):se.kind==="composite"&&(ce=[Go*H.compositeTextSizes[0].evaluate(S,{},K),Go*H.compositeTextSizes[1].evaluate(S,{},K)],(ce[0]>Sl||ce[1]>Sl)&&Tt(`${l.layerIds[0]}: Value for "text-size" is >= ${Nh}. Reduce your "text-size".`)),l.addSymbols(l.text,Z,ce,C,w,S,D,o,E.lineStartIndex,E.lineLength,$,K);for(let Ce of z)B[Ce]=l.text.placedSymbolArray.length-1;return 4*Z.length}function Jy(l){for(let o in l)return l[o];return null}function Ix(l,o,c,d){let y=l.compareText;if(o in y){let w=y[o];for(let S=w.length-1;S>=0;S--)if(d.dist(w[S])<c)return!0}else y[o]=[];return y[o].push(d),!1}let kp=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class dm{static from(o){if(!(o instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[c,d]=new Uint8Array(o,0,2);if(c!==219)throw new Error("Data does not appear to be in a KDBush format.");let y=d>>4;if(y!==1)throw new Error(`Got v${y} data when expected v1.`);let w=kp[15&d];if(!w)throw new Error("Unrecognized array type.");let[S]=new Uint16Array(o,2,1),[C]=new Uint32Array(o,4,1);return new dm(C,S,w,o)}constructor(o,c=64,d=Float64Array,y){if(isNaN(o)||o<0)throw new Error(`Unpexpected numItems value: ${o}.`);this.numItems=+o,this.nodeSize=Math.min(Math.max(+c,2),65535),this.ArrayType=d,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;
21let w=kp.indexOf(this.ArrayType),S=2*o*this.ArrayType.BYTES_PER_ELEMENT,C=o*this.IndexArrayType.BYTES_PER_ELEMENT,E=(8-C%8)%8;if(w<0)throw new Error(`Unexpected typed array class: ${d}.`);y&&y instanceof ArrayBuffer?(this.data=y,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+C+E,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+S+C+E),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+C+E,2*o),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+w]),new Uint16Array(this.data,2,1)[0]=c,new Uint32Array(this.data,4,1)[0]=o)}add(o,c){let d=this._pos>>1;return this.ids[d]=d,this.coords[this._pos++]=o,this.coords[this._pos++]=c,d}finish(){let o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return xo(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,c,d,y){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:w,coords:S,nodeSize:C}=this,E=[0,w.length-1,0],D=[];for(;E.length;){let z=E.pop()||0,B=E.pop()||0,$=E.pop()||0;if(B-$<=C){for(let se=$;se<=B;se++){let ce=S[2*se],Ce=S[2*se+1];ce>=o&&ce<=d&&Ce>=c&&Ce<=y&&D.push(w[se])}continue}let H=$+B>>1,K=S[2*H],Z=S[2*H+1];K>=o&&K<=d&&Z>=c&&Z<=y&&D.push(w[H]),(z===0?o<=K:c<=Z)&&(E.push($),E.push(H-1),E.push(1-z)),(z===0?d>=K:y>=Z)&&(E.push(H+1),E.push(B),E.push(1-z))}return D}within(o,c,d){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:y,coords:w,nodeSize:S}=this,C=[0,y.length-1,0],E=[],D=d*d;for(;C.length;){let z=C.pop()||0,B=C.pop()||0,$=C.pop()||0;if(B-$<=S){for(let se=$;se<=B;se++)wn(w[2*se],w[2*se+1],o,c)<=D&&E.push(y[se]);continue}let H=$+B>>1,K=w[2*H],Z=w[2*H+1];wn(K,Z,o,c)<=D&&E.push(y[H]),(z===0?o-d<=K:c-d<=Z)&&(C.push($),C.push(H-1),C.push(1-z)),(z===0?o+d>=K:c+d>=Z)&&(C.push(H+1),C.push(B),C.push(1-z))}return E}}function xo(l,o,c,d,y,w){if(y-d<=c)return;let S=d+y>>1;pm(l,o,S,d,y,w),xo(l,o,c,d,S-1,1-w),xo(l,o,c,S+1,y,1-w)}function pm(l,o,c,d,y,w){for(;y>d;){if(y-d>600){let D=y-d+1,z=c-d+1,B=Math.log(D),$=.5*Math.exp(2*B/3),H=.5*Math.sqrt(B*$*(D-$)/D)*(z-D/2<0?-1:1);pm(l,o,c,Math.max(d,Math.floor(c-z*$/D+H)),Math.min(y,Math.floor(c+(D-z)*$/D+H)),w)}let S=o[2*c+w],C=d,E=y;for(kl(l,o,d,c),o[2*y+w]>S&&kl(l,o,d,y);C<E;){for(kl(l,o,C,E),C++,E--;o[2*C+w]<S;)C++;for(;o[2*E+w]>S;)E--}o[2*d+w]===S?kl(l,o,d,E):(E++,kl(l,o,E,y)),E<=c&&(d=E+1),c<=E&&(y=E-1)}}function kl(l,o,c,d){hn(l,c,d),hn(o,2*c,2*d),hn(o,2*c+1,2*d+1)}function hn(l,o,c){let d=l[o];l[o]=l[c],l[c]=d}function wn(l,o,c,d){let y=l-c,w=o-d;return y*y+w*w}var Cp;a.bg=void 0,(Cp=a.bg||(a.bg={})).create="create",Cp.load="load",Cp.fullLoad="fullLoad";let Mp=null,qh=[],fm=1e3/60,mm="loadTime",gm="fullLoadTime",Lx={mark(l){performance.mark(l)},frame(l){let o=l;Mp!=null&&qh.push(o-Mp),Mp=o},clearMetrics(){Mp=null,qh=[],performance.clearMeasures(mm),performance.clearMeasures(gm);for(let l in a.bg)performance.clearMarks(a.bg[l])},getPerformanceMetrics(){performance.measure(mm,a.bg.create,a.bg.load),performance.measure(gm,a.bg.create,a.bg.fullLoad);let l=performance.getEntriesByName(mm)[0].duration,o=performance.getEntriesByName(gm)[0].duration,c=qh.length,d=1/(qh.reduce((w,S)=>w+S,0)/c/1e3),y=qh.filter(w=>w>fm).reduce((w,S)=>w+(S-fm)/fm,0);return{loadTime:l,fullLoadTime:o,fps:d,percentDroppedFrames:y/(c+y)*100,totalFrames:c}}};a.$=class extends N{},a.A=ac,a.B=_h,a.C=function(l){if(mn==null){let o=l.navigator?l.navigator.userAgent:null;mn=!!l.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return mn},a.D=yt,a.E=Hs,a.F=class{constructor(l,o){this.target=l,this.mapId=o,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Sx(()=>this.process()),this.subscription=function(c,d,y,w){return c.addEventListener(d,y,!1),{unsubscribe:()=>{c.removeEventListener(d,y,!1)}}}(this.target,"message",c=>this.receive(c)),this.globalScope=Di(self)?l:window}registerMessageHandler(l,o){this.messageHandlers[l]=o}sendAsync(l,o){return new Promise((c,d)=>{let y=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[y]={resolve:c,reject:d},o&&o.signal.addEventListener("abort",()=>{delete this.resolveRejects[y];let C={id:y,type:"<cancel>",origin:location.origin,targetMapId:l.targetMapId,sourceMapId:this.mapId};this.target.postMessage(C)},{once:!0});let w=[],S=Object.assign(Object.assign({},l),{id:y,sourceMapId:this.mapId,origin:location.origin,data:hl(l.data,w)});this.target.postMessage(S,{transfer:w})})}receive(l){let o=l.data,c=o.id;if(!(o.origin!=="file://"&&location.origin!=="file://"&&o.origin!=="resource://android"&&location.origin!=="resource://android"&&o.origin!==location.origin||o.targetMapId&&this.mapId!==o.targetMapId)){if(o.type==="<cancel>"){delete this.tasks[c];let d=this.abortControllers[c];return delete this.abortControllers[c],void(d&&d.abort())}if(Di(self)||o.mustQueue)return this.tasks[c]=o,this.taskQueue.push(c),void this.invoker.trigger();this.processTask(c,o)}}process(){if(this.taskQueue.length===0)return;let l=this.taskQueue.shift(),o=this.tasks[l];delete this.tasks[l],this.taskQueue.length>0&&this.invoker.trigger(),o&&this.processTask(l,o)}processTask(l,o){return r(this,void 0,void 0,function*(){if(o.type==="<response>"){let y=this.resolveRejects[l];return delete this.resolveRejects[l],y?void(o.error?y.reject(_o(o.error)):y.resolve(_o(o.data))):void 0}if(!this.messageHandlers[o.type])return void this.completeTask(l,new Error(`Could not find a registered handler for ${o.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let c=_o(o.data),d=new AbortController;this.abortControllers[l]=d;try{let y=yield this.messageHandlers[o.type](o.sourceMapId,c,d);this.completeTask(l,null,y)}catch(y){this.completeTask(l,y)}})}completeTask(l,o,c){let d=[];delete this.abortControllers[l];let y={id:l,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:o?hl(o):null,data:hl(c,d)};this.target.postMessage(y,{transfer:d})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},a.G=Wn,a.H=function(){var l=new ac(16);return ac!=Float32Array&&(l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[11]=0,l[12]=0,l[13]=0,l[14]=0),l[0]=1,l[5]=1,l[10
21]=1,l[15]=1,l},a.I=Jf,a.J=function(l,o,c){var d,y,w,S,C,E,D,z,B,$,H,K,Z=c[0],se=c[1],ce=c[2];return o===l?(l[12]=o[0]*Z+o[4]*se+o[8]*ce+o[12],l[13]=o[1]*Z+o[5]*se+o[9]*ce+o[13],l[14]=o[2]*Z+o[6]*se+o[10]*ce+o[14],l[15]=o[3]*Z+o[7]*se+o[11]*ce+o[15]):(y=o[1],w=o[2],S=o[3],C=o[4],E=o[5],D=o[6],z=o[7],B=o[8],$=o[9],H=o[10],K=o[11],l[0]=d=o[0],l[1]=y,l[2]=w,l[3]=S,l[4]=C,l[5]=E,l[6]=D,l[7]=z,l[8]=B,l[9]=$,l[10]=H,l[11]=K,l[12]=d*Z+C*se+B*ce+o[12],l[13]=y*Z+E*se+$*ce+o[13],l[14]=w*Z+D*se+H*ce+o[14],l[15]=S*Z+z*se+K*ce+o[15]),l},a.K=function(l,o,c){var d=c[0],y=c[1],w=c[2];return l[0]=o[0]*d,l[1]=o[1]*d,l[2]=o[2]*d,l[3]=o[3]*d,l[4]=o[4]*y,l[5]=o[5]*y,l[6]=o[6]*y,l[7]=o[7]*y,l[8]=o[8]*w,l[9]=o[9]*w,l[10]=o[10]*w,l[11]=o[11]*w,l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15],l},a.L=Hr,a.M=function(l,o){let c={};for(let d=0;d<o.length;d++){let y=o[d];y in l&&(c[y]=l[y])}return c},a.N=Tl,a.O=By,a.P=T,a.Q=Ny,a.R=vs,a.S=bs,a.T=su,a.U=Y,a.V=te,a.W=Si,a.X=_n,a.Y=A,a.Z=xu,a._=r,a.a=mr,a.a$=function(l,o){var c=l[0],d=l[1],y=l[2],w=l[3],S=l[4],C=l[5],E=l[6],D=l[7],z=l[8],B=l[9],$=l[10],H=l[11],K=l[12],Z=l[13],se=l[14],ce=l[15],Ce=o[0],ge=o[1],ye=o[2],Pe=o[3],qe=o[4],lt=o[5],kt=o[6],ct=o[7],nt=o[8],vt=o[9],pt=o[10],ht=o[11],Fe=o[12],bt=o[13],_t=o[14],Rt=o[15];return Math.abs(c-Ce)<=Lr*Math.max(1,Math.abs(c),Math.abs(Ce))&&Math.abs(d-ge)<=Lr*Math.max(1,Math.abs(d),Math.abs(ge))&&Math.abs(y-ye)<=Lr*Math.max(1,Math.abs(y),Math.abs(ye))&&Math.abs(w-Pe)<=Lr*Math.max(1,Math.abs(w),Math.abs(Pe))&&Math.abs(S-qe)<=Lr*Math.max(1,Math.abs(S),Math.abs(qe))&&Math.abs(C-lt)<=Lr*Math.max(1,Math.abs(C),Math.abs(lt))&&Math.abs(E-kt)<=Lr*Math.max(1,Math.abs(E),Math.abs(kt))&&Math.abs(D-ct)<=Lr*Math.max(1,Math.abs(D),Math.abs(ct))&&Math.abs(z-nt)<=Lr*Math.max(1,Math.abs(z),Math.abs(nt))&&Math.abs(B-vt)<=Lr*Math.max(1,Math.abs(B),Math.abs(vt))&&Math.abs($-pt)<=Lr*Math.max(1,Math.abs($),Math.abs(pt))&&Math.abs(H-ht)<=Lr*Math.max(1,Math.abs(H),Math.abs(ht))&&Math.abs(K-Fe)<=Lr*Math.max(1,Math.abs(K),Math.abs(Fe))&&Math.abs(Z-bt)<=Lr*Math.max(1,Math.abs(Z),Math.abs(bt))&&Math.abs(se-_t)<=Lr*Math.max(1,Math.abs(se),Math.abs(_t))&&Math.abs(ce-Rt)<=Lr*Math.max(1,Math.abs(ce),Math.abs(Rt))},a.a0=ni,a.a1=$h,a.a2=Ge,a.a3=l=>{let o=window.document.createElement("video");return o.muted=!0,new Promise(c=>{o.onloadstart=()=>{c(o)};for(let d of l){let y=window.document.createElement("source");oa(d)||(o.crossOrigin="Anonymous"),y.src=d,o.appendChild(y)}})},a.a4=function(){return Xe++},a.a5=Ze,a.a6=bu,a.a7=ph,a.a8=ys,a.a9=$y,a.aA=function(l){if(l.type==="custom")return new wx(l);switch(l.type){case"background":return new xp(l);case"circle":return new cp(l);case"fill":return new Vb(l);case"fill-extrusion":return new sy(l);case"heatmap":return new Zg(l);case"hillshade":return new hp(l);case"line":return new Jb(l);case"raster":return new xx(l);case"symbol":return new bp(l)}},a.aB=at,a.aC=function(l,o){if(!l)return[{command:"setStyle",args:[o]}];let c=[];try{if(!bi(l.version,o.version))return[{command:"setStyle",args:[o]}];bi(l.center,o.center)||c.push({command:"setCenter",args:[o.center]}),bi(l.zoom,o.zoom)||c.push({command:"setZoom",args:[o.zoom]}),bi(l.bearing,o.bearing)||c.push({command:"setBearing",args:[o.bearing]}),bi(l.pitch,o.pitch)||c.push({command:"setPitch",args:[o.pitch]}),bi(l.sprite,o.sprite)||c.push({command:"setSprite",args:[o.sprite]}),bi(l.glyphs,o.glyphs)||c.push({command:"setGlyphs",args:[o.glyphs]}),bi(l.transition,o.transition)||c.push({command:"setTransition",args:[o.transition]}),bi(l.light,o.light)||c.push({command:"setLight",args:[o.light]}),bi(l.terrain,o.terrain)||c.push({command:"setTerrain",args:[o.terrain]}),bi(l.sky,o.sky)||c.push({command:"setSky",args:[o.sky]}),bi(l.projection,o.projection)||c.push({command:"setProjection",args:[o.projection]});let d={},y=[];(function(S,C,E,D){let z;for(z in C=C||{},S=S||{})Object.prototype.hasOwnProperty.call(S,z)&&(Object.prototype.hasOwnProperty.call(C,z)||es(z,E,D));for(z in C)Object.prototype.hasOwnProperty.call(C,z)&&(Object.prototype.hasOwnProperty.call(S,z)?bi(S[z],C[z])||(S[z].type==="geojson"&&C[z].type==="geojson"&&Wa(S,C,z)?Ui(E,{command:"setGeoJSONSourceData",args:[z,C[z].data]}):ts(z,C,E,D)):yr(z,C,E))})(l.sources,o.sources,y,d);let w=[];
vendor: 4,250 bytes, line 21
21l.layers&&l.layers.forEach(S=>{"source"in S&&d[S.source]?c.push({command:"removeLayer",args:[S.id]}):w.push(S)}),c=c.concat(y),function(S,C,E){C=C||[];let D=(S=S||[]).map(Vl),z=C.map(Vl),B=S.reduce(ao,{}),$=C.reduce(ao,{}),H=D.slice(),K=Object.create(null),Z,se,ce,Ce,ge;for(let ye=0,Pe=0;ye<D.length;ye++)Z=D[ye],Object.prototype.hasOwnProperty.call($,Z)?Pe++:(Ui(E,{command:"removeLayer",args:[Z]}),H.splice(H.indexOf(Z,Pe),1));for(let ye=0,Pe=0;ye<z.length;ye++)Z=z[z.length-1-ye],H[H.length-1-ye]!==Z&&(Object.prototype.hasOwnProperty.call(B,Z)?(Ui(E,{command:"removeLayer",args:[Z]}),H.splice(H.lastIndexOf(Z,H.length-Pe),1)):Pe++,Ce=H[H.length-ye],Ui(E,{command:"addLayer",args:[$[Z],Ce]}),H.splice(H.length-ye,0,Z),K[Z]=!0);for(let ye=0;ye<z.length;ye++)if(Z=z[ye],se=B[Z],ce=$[Z],!K[Z]&&!bi(se,ce))if(bi(se.source,ce.source)&&bi(se["source-layer"],ce["source-layer"])&&bi(se.type,ce.type)){for(ge in ir(se.layout,ce.layout,E,Z,null,"setLayoutProperty"),ir(se.paint,ce.paint,E,Z,null,"setPaintProperty"),bi(se.filter,ce.filter)||Ui(E,{command:"setFilter",args:[Z,ce.filter]}),bi(se.minzoom,ce.minzoom)&&bi(se.maxzoom,ce.maxzoom)||Ui(E,{command:"setLayerZoomRange",args:[Z,ce.minzoom,ce.maxzoom]}),se)Object.prototype.hasOwnProperty.call(se,ge)&&ge!=="layout"&&ge!=="paint"&&ge!=="filter"&&ge!=="metadata"&&ge!=="minzoom"&&ge!=="maxzoom"&&(ge.indexOf("paint.")===0?ir(se[ge],ce[ge],E,Z,ge.slice(6),"setPaintProperty"):bi(se[ge],ce[ge])||Ui(E,{command:"setLayerProperty",args:[Z,ge,ce[ge]]}));for(ge in ce)Object.prototype.hasOwnProperty.call(ce,ge)&&!Object.prototype.hasOwnProperty.call(se,ge)&&ge!=="layout"&&ge!=="paint"&&ge!=="filter"&&ge!=="metadata"&&ge!=="minzoom"&&ge!=="maxzoom"&&(ge.indexOf("paint.")===0?ir(se[ge],ce[ge],E,Z,ge.slice(6),"setPaintProperty"):bi(se[ge],ce[ge])||Ui(E,{command:"setLayerProperty",args:[Z,ge,ce[ge]]}))}else Ui(E,{command:"removeLayer",args:[Z]}),Ce=H[H.lastIndexOf(Z)+1],Ui(E,{command:"addLayer",args:[ce,Ce]})}(w,o.layers,c)}catch(d){console.warn("Unable to compute style diff:",d),c=[{command:"setStyle",args:[o]}]}return c},a.aD=function(l){let o=[],c=l.id;return c===void 0&&o.push({message:`layers.${c}: missing required property "id"`}),l.render===void 0&&o.push({message:`layers.${c}: missing required method "render"`}),l.renderingMode&&l.renderingMode!=="2d"&&l.renderingMode!=="3d"&&o.push({message:`layers.${c}: property "renderingMode" must be either "2d" or "3d"`}),o},a.aE=function l(o,c){if(Array.isArray(o)){if(!Array.isArray(c)||o.length!==c.length)return!1;for(let d=0;d<o.length;d++)if(!l(o[d],c[d]))return!1;return!0}if(typeof o=="object"&&o!==null&&c!==null){if(typeof c!="object"||Object.keys(o).length!==Object.keys(c).length)return!1;for(let d in o)if(!l(o[d],c[d]))return!1;return!0}return o===c},a.aF=Ke,a.aG=rt,a.aH=class extends Ma{constructor(l,o){super(l,o),this.current=0}set(l){this.current!==l&&(this.current=l,this.gl.uniform1i(this.location,l))}},a.aI=Th,a.aJ=class extends Ma{constructor(l,o){super(l,o),this.current=Cf}set(l){if(l[12]!==this.current[12]||l[0]!==this.current[0])return this.current=l,void this.gl.uniformMatrix4fv(this.location,!1,l);for(let o=1;o<16;o++)if(l[o]!==this.current[o]){this.current=l,this.gl.uniformMatrix4fv(this.location,!1,l);break}}},a.aK=tp,a.aL=Vg,a.aM=xi,a.aN=class extends Ma{constructor(l,o){super(l,o),this.current=[0,0,0]}set(l){l[0]===this.current[0]&&l[1]===this.current[1]&&l[2]===this.current[2]||(this.current=l,this.gl.uniform3f(this.location,l[0],l[1],l[2]))}},a.aO=class extends Ma{constructor(l,o){super(l,o),this.current=[0,0]}set(l){l[0]===this.current[0]&&l[1]===this.current[1]||(this.current=l,this.gl.uniform2f(this.location,l[0],l[1]))}},a.aP=function(l,o,c,d,y,w,S){var C=1/(o-c),E=1/(d-y),D=1/(w-S);return l[0]=-2*C,l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=-2*E,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[10]=2*D,l[11]=0,l[12]=(o+c)*C,l[13]=(y+d)*E,l[14]=(S+w)*D,l[15]=1,l},a.aQ=zb,a.aR=class extends ve{},a.aS=ex,a.aT=class extends Ae{},a.aU=du,a.aV=function(l){return l<=1?1:Math.pow(2,Math.ceil(Math.log(l)/Math.LN2))},a.aW=Pf,a.aX=or,a.aY=gs,a.aZ=class extends ft{},a.a_=function(l,o){return l[0]===o[0]&&l[1]===o[1]&&l[2]===o[2]&&l[3]===o[3]&&l[4]===o[4]&&l[5]===o[5]&&l[6]===o[6]&&l[7]===o[7]&&l[8]===o[8]&&l[9]===o[9]&&l[10
21]===o[10]&&l[11]===o[11]&&l[12]===o[12]&&l[13]===o[13]&&l[14]===o[14]&&l[15]===o[15]},a.aa=function(l){let o={};if(l.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(c,d,y,w)=>{let S=y||w;return o[d]=!S||S.toLowerCase(),""}),o["max-age"]){let c=parseInt(o["max-age"],10);isNaN(c)?delete o["max-age"]:o["max-age"]=c}return o},a.ab=function(l,o){let c=[];for(let d in l)d in o||c.push(d);return c},a.ac=Le,a.ad=function(l,o,c){var d=Math.sin(c),y=Math.cos(c),w=o[0],S=o[1],C=o[2],E=o[3],D=o[4],z=o[5],B=o[6],$=o[7];return o!==l&&(l[8]=o[8],l[9]=o[9],l[10]=o[10],l[11]=o[11],l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15]),l[0]=w*y+D*d,l[1]=S*y+z*d,l[2]=C*y+B*d,l[3]=E*y+$*d,l[4]=D*y-w*d,l[5]=z*y-S*d,l[6]=B*y-C*d,l[7]=$*y-E*d,l},a.ae=function(l){var o=new ac(16);return o[0]=l[0],o[1]=l[1],o[2]=l[2],o[3]=l[3],o[4]=l[4],o[5]=l[5],o[6]=l[6],o[7]=l[7],o[8]=l[8],o[9]=l[9],o[10]=l[10],o[11]=l[11],o[12]=l[12],o[13]=l[13],o[14]=l[14],o[15]=l[15],o},a.af=lp,a.ag=function(l,o){let c=0,d=0;if(l.kind==="constant")d=l.layoutSize;else if(l.kind!=="source"){let{interpolationType:y,minZoom:w,maxZoom:S}=l,C=y?Le(_r.interpolationFactor(y,o,w,S),0,1):0;l.kind==="camera"?d=Ar.number(l.minSize,l.maxSize,C):c=C}return{uSizeT:c,uSize:d}},a.ai=function(l,{uSize:o,uSizeT:c},{lowerSize:d,upperSize:y}){return l.kind==="source"?d/Go:l.kind==="composite"?Ar.number(d/Go,y/Go,c):o},a.aj=tm,a.ak=function(l,o,c,d){let y=o.y-l.y,w=o.x-l.x,S=d.y-c.y,C=d.x-c.x,E=S*w-C*y;if(E===0)return null;let D=(C*(l.y-c.y)-S*(l.x-c.x))/E;return new T(l.x+D*w,l.y+D*y)},a.al=jy,a.am=Mh,a.an=ap,a.ao=function(l){let o=1/0,c=1/0,d=-1/0,y=-1/0;for(let w of l)o=Math.min(o,w.x),c=Math.min(c,w.y),d=Math.max(d,w.x),y=Math.max(y,w.y);return[o,c,d,y]},a.ap=Cn,a.ar=em,a.as=function(l,o){var c=o[0],d=o[1],y=o[2],w=o[3],S=o[4],C=o[5],E=o[6],D=o[7],z=o[8],B=o[9],$=o[10],H=o[11],K=o[12],Z=o[13],se=o[14],ce=o[15],Ce=c*C-d*S,ge=c*E-y*S,ye=c*D-w*S,Pe=d*E-y*C,qe=d*D-w*C,lt=y*D-w*E,kt=z*Z-B*K,ct=z*se-$*K,nt=z*ce-H*K,vt=B*se-$*Z,pt=B*ce-H*Z,ht=$*ce-H*se,Fe=Ce*ht-ge*pt+ye*vt+Pe*nt-qe*ct+lt*kt;return Fe?(l[0]=(C*ht-E*pt+D*vt)*(Fe=1/Fe),l[1]=(y*pt-d*ht-w*vt)*Fe,l[2]=(Z*lt-se*qe+ce*Pe)*Fe,l[3]=($*qe-B*lt-H*Pe)*Fe,l[4]=(E*nt-S*ht-D*ct)*Fe,l[5]=(c*ht-y*nt+w*ct)*Fe,l[6]=(se*ye-K*lt-ce*ge)*Fe,l[7]=(z*lt-$*ye+H*ge)*Fe,l[8]=(S*pt-C*nt+D*kt)*Fe,l[9]=(d*nt-c*pt-w*kt)*Fe,l[10]=(K*qe-Z*ye+ce*Ce)*Fe,l[11]=(B*ye-z*qe-H*Ce)*Fe,l[12]=(C*ct-S*vt-E*kt)*Fe,l[13]=(c*vt-d*ct+y*kt)*Fe,l[14]=(Z*ge-K*Pe-se*Ce)*Fe,l[15]=(z*Pe-B*ge+$*Ce)*Fe,l):null},a.at=hm,a.au=gp,a.av=dm,a.aw=function(){let l={},o=Ie.$version;for(let c in Ie.$root){let d=Ie.$root[c];if(d.required){let y=null;y=c==="version"?o:d.type==="array"?[]:{},y!=null&&(l[c]=y)}}return l},a.ax=Sa,a.ay=ln,a.az=function(l){l=l.slice();let o=Object.create(null);for(let c=0;c<l.length;c++)o[l[c].id]=l[c];for(let c=0;c<l.length;c++)"ref"in l[c]&&(l[c]=Ha(l[c],o[l[c].ref]));return l},a.b=Bt,a.b0=function(l,o){return l[0]=o[0],l[1]=o[1],l[2]=o[2],l[3]=o[3],l[4]=o[4],l[5]=o[5],l[6]=o[6],l[7]=o[7],l[8]=o[8],l[9]=o[9],l[10]=o[10],l[11]=o[11],l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15],l},a.b1=function(l,o,c){return l[0]=o[0]*c[0],l[1]=o[1]*c[1],l[2]=o[2]*c[2],l[3]=o[3]*c[3],l},a.b2=function(l,o){return l[0]*o[0]+l[1]*o[1]+l[2]*o[2]+l[3]*o[3]},a.b3=Oe,a.b4=lm,a.b5=Vh,a.b6=function(l,o,c,d,y){var w,S=1/Math.tan(o/2);return l[0]=S/c,l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=S,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[11]=-1,l[12]=0,l[13]=0,l[15]=0,y!=null&&y!==1/0?(l[10]=(y+d)*(w=1/(d-y)),l[14]=2*y*d*w):(l[10]=-1,l[14]=-2*d),l},a.b7=function(l,o,c){var d=Math.sin(c),y=Math.cos(c),w=o[4],S=o[5],C=o[6],E=o[7],D=o[8],z=o[9],B=o[10],$=o[11];return o!==l&&(l[0]=o[0],l[1]=o[1],l[2]=o[2],l[3]=o[3],l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15]),l[4]=w*y+D*d,l[5]=S*y+z*d,l[6]=C*y+B*d,l[7]=E*y+$*d,l[8]=D*y-w*d,l[9]=z*y-S*d,l[10]=B*y-C*d,l[11]=$*y-E*d,l},a.b8=le,a.b9=we,a.bA=my,a.bB=function(l){return l.message===Fn},a.bC=Ot,a.bD=jr,a.ba=function(l){return l*Math.PI/180},a.bb=function(l,o){let{x:c,y:d}=xu.fromLngLat(o);return!(l<0||l>25||d<0||d>=1||c<0||c>=1)},a.bc=function(l,o){return l[0]=o[0],l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=o[1],l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[10]=o[2],l[11]=0,l[12]=0,l[13]=0,l[14]=0,l[15]=1,l},a.bd=class extends O{},a.be=sm,a.bf=Lx,a.bh=In,a.bi=function(l,o){mr.REGISTERED_PROTOCOLS[l]=o},a.bj=function(l){delete mr.REGISTERED_PROTOCOLS[l]},a.bk=function(l,o){let c={};for(let y=0;y<l.length;y++){let w=o&&o[l[y].id]||Gd(l[y]);o&&(o[l[y].id]=w);let S=c[w];S||(S=c[w]=[]),S.push(l[y])}let d=[];for(let y in c)d.push(c[y]);return d},a.bl=dt,a.bm=Vy,a.bn=Uy,a.bo=Ty,a.bp=function(l){l.bucket.createArrays(),l.bucket.tilePixelRatio=_n/(512*l.bucket.overscaling),l.bucket.compareText={},l.bucket.iconsNeedLinear=!1;let o=l.bucket.layers[0],c=o.layout,d=o._unevaluatedLayout._values,y={layoutIconSize:d["icon-size"].possiblyEvaluate(new Ki(l.bucket.zoom+1),l.canonical),layoutTextSize:d["text-size"].possiblyEvaluate(new Ki(l.bucket.zoom+1),l.canonical),textMaxSize:d["text-size"].possiblyEvaluate(new Ki(18))};
21if(l.bucket.textSizeData.kind==="composite"){let{minZoom:D,maxZoom:z}=l.bucket.textSizeData;y.compositeTextSizes=[d["text-size"].possiblyEvaluate(new Ki(D),l.canonical),d["text-size"].possiblyEvaluate(new Ki(z),l.canonical)]}if(l.bucket.iconSizeData.kind==="composite"){let{minZoom:D,maxZoom:z}=l.bucket.iconSizeData;y.compositeIconSizes=[d["icon-size"].possiblyEvaluate(new Ki(D),l.canonical),d["icon-size"].possiblyEvaluate(new Ki(z),l.canonical)]}let w=c.get("text-line-height")*Cn,S=c.get("text-rotation-alignment")!=="viewport"&&c.get("symbol-placement")!=="point",C=c.get("text-keep-upright"),E=c.get("text-size");for(let D of l.bucket.features){let z=c.get("text-font").evaluate(D,{},l.canonical).join(","),B=E.evaluate(D,{},l.canonical),$=y.layoutTextSize.evaluate(D,{},l.canonical),H=y.layoutIconSize.evaluate(D,{},l.canonical),K={horizontal:{},vertical:void 0},Z=D.text,se,ce=[0,0];if(Z){let ye=Z.toString(),Pe=c.get("text-letter-spacing").evaluate(D,{},l.canonical)*Cn,qe=dl(ye)?Pe:0,lt=c.get("text-anchor").evaluate(D,{},l.canonical),kt=Ra(o,D,l.canonical);if(!kt){let pt=c.get("text-radial-offset").evaluate(D,{},l.canonical);ce=pt?Xy(lt,[pt*Cn,xn]):c.get("text-offset").evaluate(D,{},l.canonical).map(ht=>ht*Cn)}let ct=S?"center":c.get("text-justify").evaluate(D,{},l.canonical),nt=c.get("symbol-placement")==="point"?c.get("text-max-width").evaluate(D,{},l.canonical)*Cn:1/0,vt=()=>{l.bucket.allowVerticalPlacement&&J(ye)&&(K.vertical=vu(Z,l.glyphMap,l.glyphPositions,l.imagePositions,z,nt,w,lt,"left",qe,ce,a.ah.vertical,!0,$,B))};if(!S&&kt){let pt=new Set;if(ct==="auto")for(let Fe=0;Fe<kt.values.length;Fe+=2)pt.add(hm(kt.values[Fe]));else pt.add(ct);let ht=!1;for(let Fe of pt)if(!K.horizontal[Fe])if(ht)K.horizontal[Fe]=K.horizontal[0];else{let bt=vu(Z,l.glyphMap,l.glyphPositions,l.imagePositions,z,nt,w,"center",Fe,qe,ce,a.ah.horizontal,!1,$,B);bt&&(K.horizontal[Fe]=bt,ht=bt.positionedLines.length===1)}vt()}else{ct==="auto"&&(ct=hm(lt));let pt=vu(Z,l.glyphMap,l.glyphPositions,l.imagePositions,z,nt,w,lt,ct,qe,ce,a.ah.horizontal,!1,$,B);pt&&(K.horizontal[ct]=pt),vt(),J(ye)&&S&&C&&(K.vertical=vu(Z,l.glyphMap,l.glyphPositions,l.imagePositions,z,nt,w,lt,ct,qe,ce,a.ah.vertical,!1,$,B))}}let Ce=!1;if(D.icon&&D.icon.name){let ye=l.imageMap[D.icon.name];ye&&(se=yp(l.imagePositions[D.icon.name],c.get("icon-offset").evaluate(D,{},l.canonical),c.get("icon-anchor").evaluate(D,{},l.canonical)),Ce=!!ye.sdf,l.bucket.sdfIcons===void 0?l.bucket.sdfIcons=Ce:l.bucket.sdfIcons!==Ce&&Tt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ye.pixelRatio!==l.bucket.pixelRatio||c.get("icon-rotate").constantOr(1)!==0)&&(l.bucket.iconsNeedLinear=!0))}let ge=Jy(K.horizontal)||K.vertical;l.bucket.iconsInText=!!ge&&ge.iconsInText,(ge||se)&&Ex(l.bucket,D,K,se,l.imageMap,y,$,H,ce,Ce,l.canonical)}l.showCollisionBoxes&&l.bucket.generateCollisionDebugBuffers()},a.bq=Wf,a.br=Bf,a.bs=jf,a.bt=kn,a.bu=Xf,a.bv=class{constructor(l){this._marks={start:[l.url,"start"].join("#"),end:[l.url,"end"].join("#"),measure:l.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let l=performance.getEntriesByName(this._marks.measure);return l.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),l=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),l}},a.bw=function(l,o,c,d,y){return r(this,void 0,void 0,function*(){if(te())try{return yield Si(l,o,c,d,y)}catch{}return function(w,S,C,E,D){let z=w.width,B=w.height;Gi&&Jt||(Gi=new OffscreenCanvas(z,B),Jt=Gi.getContext("2d",{willReadFrequently:!0})),Gi.width=z,Gi.height=B,Jt.drawImage(w,0,0,z,B);let $=Jt.getImageData(S,C,E,D);return Jt.clearRect(0,0,z,B),$.data}(l,o,c,d,y)})},a.bx=cm,a.by=h,a.bz=m,a.c=Ms,a.d=l=>r(void 0,void 0,void 0,function*(){if(l.byteLength===0)return createImageBitmap(new ImageData(1,1));let o=new Blob([new Uint8Array(l)],{type:"image/png"});try{return createImageBitmap(o)}catch(c){throw new Error(`Could not load image because of ${c.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),a.e=ze,a.f=l=>new Promise((o,c)=>{let d=new Image;d.onload=()=>{o(d),URL.revokeObjectURL(d.src),d.onload=null,window.requestAnimationFrame(()=>{d.src=oi})},d.onerror=()=>c(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let y=new Blob([new Uint8Array(l)],{type:"image/png"});d.src=l.byteLength?URL.createObjectURL(y):oi}),a.g=vn,a.h=(l,o)=>As(ze(l,{type:"json"}),o),a.i=Di,a.j=Bn,a.k=oo,a.l=(l,o)=>As(ze(l,{type:"arrayBuffer"}),o),a.m=As,a.n=function(l){return new Xf(l).readFields(cx,[])},a.o=Eh,a.p=Sy,a.q=x,a.r=Ql,a.s=oa,a.t=wa,a.u=go,a.v=Ie,a.w=Tt,a.x=function([l,o,c]){return o+=90,o*=Math.PI/180,c*=Math.PI/180,{x:l*Math.cos(o)*Math.sin(c),y:l*Math.sin(o)*Math.sin(c),z:l*Math.cos(c)}},a.y=Ar,a.z=Ki}),i("worker",["./shared"],function(a){"use strict";
21class r{constructor(q){this.keyCache={},q&&this.replace(q)}replace(q){this._layerConfigs={},this._layers={},this.update(q,[])}update(q,j){for(let oe of q){this._layerConfigs[oe.id]=oe;let _e=this._layers[oe.id]=a.aA(oe);_e._featureFilter=a.a7(_e.filter),this.keyCache[oe.id]&&delete this.keyCache[oe.id]}for(let oe of j)delete this.keyCache[oe],delete this._layerConfigs[oe],delete this._layers[oe];this.familiesBySource={};let ee=a.bk(Object.values(this._layerConfigs),this.keyCache);for(let oe of ee){let _e=oe.map(Ee=>this._layers[Ee.id]),Se=_e[0];if(Se.visibility==="none")continue;let ke=Se.source||"",fe=this.familiesBySource[ke];fe||(fe=this.familiesBySource[ke]={});let Re=Se.sourceLayer||"_geojsonTileLayer",$e=fe[Re];$e||($e=fe[Re]=[]),$e.push(_e)}}}class h{constructor(q){let j={},ee=[];for(let ke in q){let fe=q[ke],Re=j[ke]={};for(let $e in fe){let Ee=fe[+$e];if(!Ee||Ee.bitmap.width===0||Ee.bitmap.height===0)continue;let Ye={x:0,y:0,w:Ee.bitmap.width+2,h:Ee.bitmap.height+2};ee.push(Ye),Re[$e]={rect:Ye,metrics:Ee.metrics}}}let{w:oe,h:_e}=a.p(ee),Se=new a.o({width:oe||1,height:_e||1});for(let ke in q){let fe=q[ke];for(let Re in fe){let $e=fe[+Re];if(!$e||$e.bitmap.width===0||$e.bitmap.height===0)continue;let Ee=j[ke][Re].rect;a.o.copy($e.bitmap,Se,{x:0,y:0},{x:Ee.x+1,y:Ee.y+1},$e.bitmap)}}this.image=Se,this.positions=j}}a.bl("GlyphAtlas",h);class m{constructor(q){this.tileID=new a.S(q.tileID.overscaledZ,q.tileID.wrap,q.tileID.canonical.z,q.tileID.canonical.x,q.tileID.canonical.y),this.uid=q.uid,this.zoom=q.zoom,this.pixelRatio=q.pixelRatio,this.tileSize=q.tileSize,this.source=q.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=q.showCollisionBoxes,this.collectResourceTiming=!!q.collectResourceTiming,this.returnDependencies=!!q.returnDependencies,this.promoteId=q.promoteId,this.inFlightDependencies=[]}parse(q,j,ee,oe){return a._(this,void 0,void 0,function*(){this.status="parsing",this.data=q,this.collisionBoxArray=new a.a5;let _e=new a.bm(Object.keys(q.layers).sort()),Se=new a.bn(this.tileID,this.promoteId);Se.bucketLayerIDs=[];let ke={},fe={featureIndex:Se,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:ee},Re=j.familiesBySource[this.source];for(let Gt in Re){let Ei=q.layers[Gt];if(!Ei)continue;Ei.version===1&&a.w(`Vector tile source "${this.source}" layer "${Gt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let Ji=_e.encode(Gt),Nn=[];for(let Zn=0;Zn<Ei.length;Zn++){let Vn=Ei.feature(Zn),Ga=Se.getId(Vn,Gt);Nn.push({feature:Vn,id:Ga,index:Zn,sourceLayerIndex:Ji})}for(let Zn of Re[Gt]){let Vn=Zn[0];Vn.source!==this.source&&a.w(`layer.source = ${Vn.source} does not equal this.source = ${this.source}`),Vn.minzoom&&this.zoom<Math.floor(Vn.minzoom)||Vn.maxzoom&&this.zoom>=Vn.maxzoom||Vn.visibility!=="none"&&(b(Zn,this.zoom,ee),(ke[Vn.id]=Vn.createBucket({index:Se.bucketLayerIDs.length,layers:Zn,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ji,sourceID:this.source})).populate(Nn,fe,this.tileID.canonical),Se.bucketLayerIDs.push(Zn.map(Ga=>Ga.id)))}}let $e=a.aF(fe.glyphDependencies,Gt=>Object.keys(Gt).map(Number));this.inFlightDependencies.forEach(Gt=>Gt?.abort()),this.inFlightDependencies=[];let Ee=Promise.resolve({});if(Object.keys($e).length){let Gt=new AbortController;this.inFlightDependencies.push(Gt),Ee=oe.sendAsync({type:"GG",data:{stacks:$e,source:this.source,tileID:this.tileID,type:"glyphs"}},Gt)}let Ye=Object.keys(fe.iconDependencies),xt=Promise.resolve({});if(Ye.length){let Gt=new AbortController;this.inFlightDependencies.push(Gt),xt=oe.sendAsync({type:"GI",data:{icons:Ye,source:this.source,tileID:this.tileID,type:"icons"}},Gt)}let wt=Object.keys(fe.patternDependencies),hi=Promise.resolve({});if(wt.length){let Gt=new AbortController;this.inFlightDependencies.push(Gt),hi=oe.sendAsync({type:"GI",data:{icons:wt,source:this.source,tileID:this.tileID,type:"patterns"}},Gt)}let[Nt,di,ei]=yield Promise.all([Ee,xt,hi]),bn=new h(Nt),cn=new a.bo(di,ei);for(let Gt in ke){let Ei=ke[Gt];Ei instanceof a.a6?(b(Ei.layers,this.zoom,ee),a.bp({bucket:Ei,glyphMap:Nt,glyphPositions:bn.positions,imageMap:di,imagePositions:cn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Ei.hasPattern&&(Ei instanceof a.bq||Ei instanceof a.br||Ei instanceof a.bs)&&(b(Ei.layers,this.zoom,ee),Ei.addFeatures(fe,this.tileID.canonical,cn.patternPositions))}return this.status="done",{buckets:Object.values(ke).filter(Gt=>!Gt.isEmpty()),featureIndex:Se,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:bn.image,imageAtlas:cn,glyphMap:this.returnDependencies?Nt:null,iconMap:this.returnDependencies?di:null,glyphPositions:this.returnDependencies?bn.positions:null}})}}function b(ue,q,j){let ee=new a.z(q);for(let oe of ue)oe.recalculate(ee,j)}class T{constructor(q,j,ee){this.actor=q,this.layerIndex=j,this.availableImages=ee,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(q,j){return a._(this,void 0,void 0,function*(){let ee=yield a.l(q.request,j);try{return{vectorTile:new a.bt.VectorTile(new a.bu(ee.data)),rawData:ee.data,cacheControl:ee.cacheControl,expires:ee.expires}}catch(oe){let _e=new Uint8Array(ee.data),Se=`Unable to parse the tile at ${q.request.url}, `;throw Se+=_e[0]===31&&_e[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${oe.message}`,new Error(Se)}})}loadTile(q){return a._(this,void 0,void 0,function*(){let j=q.uid,ee=!!(q&&q.request&&q.request.collectResourceTiming)&&new a.bv(q.request),oe=new m(q);this.loading[j]=oe;let _e=new AbortController;oe.abort=_e;try{let Se=yield this.loadVectorTile(q,_e);if(delete this.loading[j],!Se)return null;let ke=Se.rawData,fe={};Se.expires&&(fe.expires=Se.expires),Se.cacheControl&&(fe.cacheControl=Se.cacheControl);let Re={};if(ee){let Ee=ee.finish();Ee&&(Re.resourceTiming=JSON.parse(JSON.stringify(Ee)))}oe.vectorTile=Se.vectorTile;let $e=oe.parse(Se.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[j]=oe,this.fetching[j]={rawTileData:ke,cacheControl:fe,resourceTiming:Re};try{let Ee=yield $e;return a.e({rawTileData:ke.slice(0)},Ee,fe,Re)}finally{delete this.fetching[j]}}catch(Se){throw delete this.loading[j],oe.status="done",this.loaded[j]=oe,Se}})}reloadTile(q){return a._(this,void 0,void 0,function*(){let j=q.uid;if(!this.loaded||!this.loaded[j])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");let ee=this.loaded[j];if(ee.showCollisionBoxes=q.showCollisionBoxes,ee.status==="parsing"){let oe=yield ee.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor),_e;if(this.fetching[j]){let{rawTileData:Se,cacheControl:ke,resourceTiming:fe}=this.fetching[j];delete this.fetching[j],_e=a.e({rawTileData:Se.slice(0)},oe,ke,fe)}else _e=oe;return _e}if(ee.status==="done"&&ee.vectorTile)return ee.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(q){return a._(this,void 0,void 0,function*(){let j=this.loading,ee=q.uid;j&&j[ee]&&j[ee].abort&&(j[ee].abort.abort(),delete j[ee])})}removeTile(q){return a._(this,void 0,void 0,function*(){this.loaded&&this.loaded[q.uid]&&delete this.loaded[q.uid]})}}class k{constructor(){this.loaded={}}loadTile(q){return a._(this,void 0,void 0,function*(){let{uid:j,encoding:ee,rawImageData:oe,redFactor:_e,greenFactor:Se,blueFactor:ke,baseShift:fe}=q,Re=oe.width+2,$e=oe.height+2,Ee=a.b(oe)?new a.R({width:Re,height:$e},yield a.bw(oe,-1,-1,Re,$e)):oe,Ye=new a.bx(j,Ee,ee,_e,Se,ke,fe);return this.loaded=this.loaded||{},this.loaded[j]=Ye,Ye})}removeTile(q){let j=this.loaded,ee=q.uid;j&&j[ee]&&delete j[ee]}}function P(ue,q){if(ue.length!==0){F(ue[0],q);for(var j=1;j<ue.length;j++)F(ue[j],!q)}}function F(ue,q){for(var j=0,ee=0,oe=0,_e=ue.length,Se=_e-1;oe<_e;
21Se=oe++){var ke=(ue[oe][0]-ue[Se][0])*(ue[Se][1]+ue[oe][1]),fe=j+ke;ee+=Math.abs(j)>=Math.abs(ke)?j-fe+ke:ke-fe+j,j=fe}j+ee>=0!=!!q&&ue.reverse()}var U=a.by(function ue(q,j){var ee,oe=q&&q.type;if(oe==="FeatureCollection")for(ee=0;ee<q.features.length;ee++)ue(q.features[ee],j);else if(oe==="GeometryCollection")for(ee=0;ee<q.geometries.length;ee++)ue(q.geometries[ee],j);else if(oe==="Feature")ue(q.geometry,j);else if(oe==="Polygon")P(q.coordinates,j);else if(oe==="MultiPolygon")for(ee=0;ee<q.coordinates.length;ee++)P(q.coordinates[ee],j);return q});let X=a.bt.VectorTileFeature.prototype.toGeoJSON;var Y={exports:{}},te=a.bz,le=a.bt.VectorTileFeature,we=Le;function Le(ue,q){this.options=q||{},this.features=ue,this.length=ue.length}function Oe(ue,q){this.id=typeof ue.id=="number"?ue.id:void 0,this.type=ue.type,this.rawGeometry=ue.type===1?[ue.geometry]:ue.geometry,this.properties=ue.tags,this.extent=q||4096}Le.prototype.feature=function(ue){return new Oe(this.features[ue],this.options.extent)},Oe.prototype.loadGeometry=function(){var ue=this.rawGeometry;this.geometry=[];for(var q=0;q<ue.length;q++){for(var j=ue[q],ee=[],oe=0;oe<j.length;oe++)ee.push(new te(j[oe][0],j[oe][1]));this.geometry.push(ee)}return this.geometry},Oe.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var ue=this.geometry,q=1/0,j=-1/0,ee=1/0,oe=-1/0,_e=0;_e<ue.length;_e++)for(var Se=ue[_e],ke=0;ke<Se.length;ke++){var fe=Se[ke];q=Math.min(q,fe.x),j=Math.max(j,fe.x),ee=Math.min(ee,fe.y),oe=Math.max(oe,fe.y)}return[q,ee,j,oe]},Oe.prototype.toGeoJSON=le.prototype.toGeoJSON;var ze=a.bA,Xe=we;function Ke(ue){var q=new ze;return function(j,ee){for(var oe in j.layers)ee.writeMessage(3,rt,j.layers[oe])}(ue,q),q.finish()}function rt(ue,q){var j;q.writeVarintField(15,ue.version||1),q.writeStringField(1,ue.name||""),q.writeVarintField(5,ue.extent||4096);var ee={keys:[],values:[],keycache:{},valuecache:{}};for(j=0;j<ue.length;j++)ee.feature=ue.feature(j),q.writeMessage(2,at,ee);var oe=ee.keys;for(j=0;j<oe.length;j++)q.writeStringField(3,oe[j]);var _e=ee.values;for(j=0;j<_e.length;j++)q.writeMessage(4,mn,_e[j])}function at(ue,q){var j=ue.feature;j.id!==void 0&&q.writeVarintField(1,j.id),q.writeMessage(2,$t,ue),q.writeVarintField(3,j.type),q.writeMessage(4,Di,j)}function $t(ue,q){var j=ue.feature,ee=ue.keys,oe=ue.values,_e=ue.keycache,Se=ue.valuecache;for(var ke in j.properties){var fe=j.properties[ke],Re=_e[ke];if(fe!==null){Re===void 0&&(ee.push(ke),_e[ke]=Re=ee.length-1),q.writeVarint(Re);var $e=typeof fe;$e!=="string"&&$e!=="boolean"&&$e!=="number"&&(fe=JSON.stringify(fe));var Ee=$e+":"+fe,Ye=Se[Ee];Ye===void 0&&(oe.push(fe),Se[Ee]=Ye=oe.length-1),q.writeVarint(Ye)}}}function Tt(ue,q){return(q<<3)+(7&ue)}function Lt(ue){return ue<<1^ue>>31}function Di(ue,q){for(var j=ue.loadGeometry(),ee=ue.type,oe=0,_e=0,Se=j.length,ke=0;ke<Se;ke++){var fe=j[ke],Re=1;ee===1&&(Re=fe.length),q.writeVarint(Tt(1,Re));for(var $e=ee===3?fe.length-1:fe.length,Ee=0;Ee<$e;Ee++){Ee===1&&ee!==1&&q.writeVarint(Tt(2,$e-1));var Ye=fe[Ee].x-oe,xt=fe[Ee].y-_e;q.writeVarint(Lt(Ye)),q.writeVarint(Lt(xt)),oe+=Ye,_e+=xt}ee===3&&q.writeVarint(Tt(7,1))}}function mn(ue,q){var j=typeof ue;j==="string"?q.writeStringField(1,ue):j==="boolean"?q.writeBooleanField(7,ue):j==="number"&&(ue%1!=0?q.writeDoubleField(3,ue):ue<0?q.writeSVarintField(6,ue):q.writeVarintField(5,ue))}Y.exports=Ke,Y.exports.fromVectorTileJs=Ke,Y.exports.fromGeojsonVt=function(ue,q){q=q||{};var j={};for(var ee in ue)j[ee]=new Xe(ue[ee].features,q),j[ee].name=ee,j[ee].version=q.version,j[ee].extent=q.extent;return Ke({layers:j})},Y.exports.GeoJSONWrapper=Xe;var Bt=a.by(Y.exports);let oi={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ue=>ue},Si=Math.fround||(Gi=new Float32Array(1),ue=>(Gi[0]=+ue,Gi[0]));var Gi;let Jt=3,Fn=5,Ms=6;class mr{constructor(q){this.options=Object.assign(Object.create(oi),q),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}
21load(q){let{log:j,minZoom:ee,maxZoom:oe}=this.options;j&&console.time("total time");let _e=`prepare ${q.length} points`;j&&console.time(_e),this.points=q;let Se=[];for(let fe=0;fe<q.length;fe++){let Re=q[fe];if(!Re.geometry)continue;let[$e,Ee]=Re.geometry.coordinates,Ye=Si(In($e)),xt=Si(ln(Ee));Se.push(Ye,xt,1/0,fe,-1,1),this.options.reduce&&Se.push(0)}let ke=this.trees[oe+1]=this._createTree(Se);j&&console.timeEnd(_e);for(let fe=oe;fe>=ee;fe--){let Re=+Date.now();ke=this.trees[fe]=this._createTree(this._cluster(ke,fe)),j&&console.log("z%d: %d clusters in %dms",fe,ke.numItems,+Date.now()-Re)}return j&&console.timeEnd("total time"),this}getClusters(q,j){let ee=((q[0]+180)%360+360)%360-180,oe=Math.max(-90,Math.min(90,q[1])),_e=q[2]===180?180:((q[2]+180)%360+360)%360-180,Se=Math.max(-90,Math.min(90,q[3]));if(q[2]-q[0]>=360)ee=-180,_e=180;else if(ee>_e){let Ee=this.getClusters([ee,oe,180,Se],j),Ye=this.getClusters([-180,oe,_e,Se],j);return Ee.concat(Ye)}let ke=this.trees[this._limitZoom(j)],fe=ke.range(In(ee),ln(Se),In(_e),ln(oe)),Re=ke.data,$e=[];for(let Ee of fe){let Ye=this.stride*Ee;$e.push(Re[Ye+Fn]>1?vn(Re,Ye,this.clusterProps):this.points[Re[Ye+Jt]])}return $e}getChildren(q){let j=this._getOriginId(q),ee=this._getOriginZoom(q),oe="No cluster with the specified id.",_e=this.trees[ee];if(!_e)throw new Error(oe);let Se=_e.data;if(j*this.stride>=Se.length)throw new Error(oe);let ke=this.options.radius/(this.options.extent*Math.pow(2,ee-1)),fe=_e.within(Se[j*this.stride],Se[j*this.stride+1],ke),Re=[];for(let $e of fe){let Ee=$e*this.stride;Se[Ee+4]===q&&Re.push(Se[Ee+Fn]>1?vn(Se,Ee,this.clusterProps):this.points[Se[Ee+Jt]])}if(Re.length===0)throw new Error(oe);return Re}getLeaves(q,j,ee){let oe=[];return this._appendLeaves(oe,q,j=j||10,ee=ee||0,0),oe}getTile(q,j,ee){let oe=this.trees[this._limitZoom(q)],_e=Math.pow(2,q),{extent:Se,radiu
21s:ke}=this.options,fe=ke/Se,Re=(ee-fe)/_e,$e=(ee+1+fe)/_e,Ee={features:[]};return this._addTileFeatures(oe.range((j-fe)/_e,Re,(j+1+fe)/_e,$e),oe.data,j,ee,_e,Ee),j===0&&this._addTileFeatures(oe.range(1-fe/_e,Re,1,$e),oe.data,_e,ee,_e,Ee),j===_e-1&&this._addTileFeatures(oe.range(0,Re,fe/_e,$e),oe.data,-1,ee,_e,Ee),Ee.features.length?Ee:null}getClusterExpansionZoom(q){let j=this._getOriginZoom(q)-1;for(;j<=this.options.maxZoom;){let ee=this.getChildren(q);if(j++,ee.length!==1)break;q=ee[0].properties.cluster_id}return j}_appendLeaves(q,j,ee,oe,_e){let Se=this.getChildren(j);for(let ke of Se){let fe=ke.properties;if(fe&&fe.cluster?_e+fe.point_count<=oe?_e+=fe.point_count:_e=this._appendLeaves(q,fe.cluster_id,ee,oe,_e):_e<oe?_e++:q.push(ke),q.length===ee)break}return _e}_createTree(q){let j=new a.av(q.length/this.stride|0,this.options.nodeSize,Float32Array);for(let ee=0;ee<q.length;ee+=this.stride)j.add(q[ee],q[ee+1]);return j.finish(),j.data=q,j}_addTileFeatures(q,j,ee,oe,_e,Se){for(let ke of q){let fe=ke*this.stride,Re=j[fe+Fn]>1,$e,Ee,Ye;if(Re)$e=Wn(j,fe,this.clusterProps),Ee=j[fe],Ye=j[fe+1];else{let hi=this.points[j[fe+Jt]];$e=hi.properties;let[Nt,di]=hi.geometry.coordinates;Ee=In(Nt),Ye=ln(di)}let xt={type:1,geometry:[[Math.round(this.options.extent*(Ee*_e-ee)),Math.round(this.options.extent*(Ye*_e-oe))]],tags:$e},wt;wt=Re||this.options.generateId?j[fe+Jt]:this.points[j[fe+Jt]].id,wt!==void 0&&(xt.id=wt),Se.features.push(xt)}}_limitZoom(q){return Math.max(this.options.minZoom,Math.min(Math.floor(+q),this.options.maxZoom+1))}_cluster(q,j){let{radius:ee,extent:oe,reduce:_e,minPoints:Se}=this.options,ke=ee/(oe*Math.pow(2,j)),fe=q.data,Re=[],$e=this.stride;for(let Ee=0;Ee<fe.length;Ee+=$e){if(fe[Ee+2]<=j)continue;fe[Ee+2]=j;let Ye=fe[Ee],xt=fe[Ee+1],wt=q.within(fe[Ee],fe[Ee+1],ke),hi=fe[Ee+Fn],Nt=hi;for(let di of wt){let ei=di*$e;fe[ei+2]>j&&(Nt+=fe[ei+Fn])}if(Nt>hi&&Nt>=Se){let di,ei=Ye*hi,bn=xt*hi,cn=-1,Gt=((Ee/$e|0)<<5)+(j+1)+this.points.length;for(let Ei of wt){let Ji=Ei*$e;if(fe[Ji+2]<=j)continue;fe[Ji+2]=j;let Nn=fe[Ji+Fn];ei+=fe[Ji]*Nn,bn+=fe[Ji+1]*Nn,fe[Ji+4]=Gt,_e&&(di||(di=this._map(fe,Ee,!0),cn=this.clusterProps.length,this.clusterProps.push(di)),_e(di,this._map(fe,Ji)))}fe[Ee+4]=Gt,Re.push(ei/Nt,bn/Nt,1/0,Gt,-1,Nt),_e&&Re.push(cn)}else{for(let di=0;di<$e;di++)Re.push(fe[Ee+di]);if(Nt>1)for(let di of wt){let ei=di*$e;if(!(fe[ei+2]<=j)){fe[ei+2]=j;for(let bn=0;bn<$e;bn++)Re.push(fe[ei+bn])}}}}return Re}_getOriginId(q){return q-this.points.length>>5}_getOriginZoom(q){return(q-this.points.length)%32}_map(q,j,ee){if(q[j+Fn]>1){let Se=this.clusterProps[q[j+Ms]];return ee?Object.assign({},Se):Se}let oe=this.points[q[j+Jt]].properties,_e=this.options.map(oe);return ee&&_e===oe?Object.assign({},_e):_e}}function vn(ue,q,j){return{type:"Feature",id:ue[q+Jt],properties:Wn(ue,q,j),geometry:{type:"Point",coordinates:[(ee=ue[q],360*(ee-.5)),As(ue[q+1])]}};var ee}function Wn(ue,q,j){let ee=ue[q+Fn],oe=ee>=1e4?`${Math.round(ee/1e3)}k`:ee>=1e3?Math.round(ee/100)/10+"k":ee,_e=ue[q+Ms],Se=_e===-1?{}:Object.assign({},j[_e]);return Object.assign(Se,{cluster:!0,cluster_id:ue[q+Jt],point_count:ee,point_count_abbreviated:oe})}function In(ue){return ue/360+.5}function ln(ue){let q=Math.sin(ue*Math.PI/180),j=.5-.25*Math.log((1+q)/(1-q))/Math.PI;return j<0?0:j>1?1:j}function As(ue){let q=(180-360*ue)*Math.PI/180;return 360*Math.atan(Math.exp(q))/Math.PI-90}function oa(ue,q,j,ee){let oe=ee,_e=q+(j-q>>1),Se,ke=j-q,fe=ue[q],Re=ue[q+1],$e=ue[j],Ee=ue[j+1];for(let Ye=q+3;Ye<j;Ye+=3){let xt=Io(ue[Ye],ue[Ye+1],fe,Re,$e,Ee);if(xt>oe)Se=Ye,oe=xt;else if(xt===oe){let wt=Math.abs(Ye-_e);wt<ke&&(Se=Ye,ke=wt)}}oe>ee&&(Se-q>3&&oa(ue,q,Se,ee),ue[Se+2]=oe,j-Se>3&&oa(ue,Se,j,ee))}function Io(ue,q,j,ee,oe,_e){let Se=oe-j,ke=_e-ee;if(Se!==0||ke!==0){let fe=((ue-j)*Se+(q-ee)*ke)/(Se*Se+ke*ke);fe>1?(j=oe,ee=_e):fe>0&&(j+=Se*fe,ee+=ke*fe)}return Se=ue-j,ke=q-ee,Se*Se+ke*ke}function Qr(ue,q,j,ee){let oe={id:ue??null,type:q,geometry:j,tags:ee,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(q==="Point"||q==="MultiPoint"||q==="LineString")oo(oe,j);else if(q==="Polygon")oo(oe,j[0]);else if(q==="MultiLineString")for(let _e of j)oo(oe,_e);else if(q==="MultiPolygon")for(let _e of j)oo(oe,_e[0]);return oe}function oo(ue,q){for(let j=0;j<q.length;j+=3)ue.minX=Math.min(ue.minX,q[j]),ue.minY=Math.min(ue.minY,q[j+1]),ue.maxX=Math.max(ue.maxX,q[j]),ue.maxY=Math.max(ue.maxY,q[j+1])}function Bn(ue,q,j,ee){if(!q.geometry)return;let oe=q.geometry.coordinates;if(oe&&oe.length===0)return;let _e=q.geometry.type,Se=Math.pow(j.tolerance/((1<<j.maxZoom)*j.extent),2),ke=[],fe=q.id;if(j.promoteId?fe=q.properties[j.promoteId]:j.generateId&&(fe=ee||0),_e==="Point")Hs(oe,ke);else if(_e==="MultiPoint")for(let Re of oe)Hs(Re,ke);else if(_e==="LineString")Ie(oe,ke,Se,!1);else if(_e==="MultiLineString"){if(j.lineMetrics){for(let Re of oe)ke=[],Ie(Re,ke,Se,!1),ue.push(Qr(fe,"
21LineString",ke,q.properties));return}gr(oe,ke,Se,!1)}else if(_e==="Polygon")gr(oe,ke,Se,!0);else{if(_e!=="MultiPolygon"){if(_e==="GeometryCollection"){for(let Re of q.geometry.geometries)Bn(ue,{id:fe,geometry:Re,properties:q.properties},j,ee);return}throw new Error("Input data is not a valid GeoJSON object.")}for(let Re of oe){let $e=[];gr(Re,$e,Se,!0),ke.push($e)}}ue.push(Qr(fe,_e,ke,q.properties))}function Hs(ue,q){q.push(Ha(ue[0]),bi(ue[1]),0)}function Ie(ue,q,j,ee){let oe,_e,Se=0;for(let fe=0;fe<ue.length;fe++){let Re=Ha(ue[fe][0]),$e=bi(ue[fe][1]);q.push(Re,$e,0),fe>0&&(Se+=ee?(oe*$e-Re*_e)/2:Math.sqrt(Math.pow(Re-oe,2)+Math.pow($e-_e,2))),oe=Re,_e=$e}let ke=q.length-3;q[2]=1,oa(q,0,ke,j),q[ke+2]=1,q.size=Math.abs(Se),q.start=0,q.end=q.size}function gr(ue,q,j,ee){for(let oe=0;oe<ue.length;oe++){let _e=[];Ie(ue[oe],_e,j,ee),q.push(_e)}}function Ha(ue){return ue/360+.5}function bi(ue){let q=Math.sin(ue*Math.PI/180),j=.5-.25*Math.log((1+q)/(1-q))/Math.PI;return j<0?0:j>1?1:j}function Ui(ue,q,j,ee,oe,_e,Se,ke){if(ee/=q,_e>=(j/=q)&&Se<ee)return ue;if(Se<j||_e>=ee)return null;let fe=[];for(let Re of ue){let $e=Re.geometry,Ee=Re.type,Ye=oe===0?Re.minX:Re.minY,xt=oe===0?Re.maxX:Re.maxY;if(Ye>=j&&xt<ee){fe.push(Re);continue}if(xt<j||Ye>=ee)continue;let wt=[];if(Ee==="Point"||Ee==="MultiPoint")yr($e,wt,j,ee,oe);else if(Ee==="LineString")es($e,wt,j,ee,oe,!1,ke.lineMetrics);else if(Ee==="MultiLineString")Wa($e,wt,j,ee,oe,!1);else if(Ee==="Polygon")Wa($e,wt,j,ee,oe,!0);else if(Ee==="MultiPolygon")for(let hi of $e){let Nt=[];Wa(hi,Nt,j,ee,oe,!0),Nt.length&&wt.push(Nt)}if(wt.length){if(ke.lineMetrics&&Ee==="LineString"){for(let hi of wt)fe.push(Qr(Re.id,Ee,hi,Re.tags));continue}Ee!=="LineString"&&Ee!=="MultiLineString"||(wt.length===1?(Ee="LineString",wt=wt[0]):Ee="MultiLineString"),Ee!=="Point"&&Ee!=="MultiPoint"||(Ee=wt.length===3?"Point":"MultiPoint"),fe.push(Qr(Re.id,Ee,wt,Re.tags))}}return fe.length?fe:null}function yr(ue,q,j,ee,oe){for(let _e=0;_e<ue.length;_e+=3){let Se=ue[_e+oe];Se>=j&&Se<=ee&&ir(q,ue[_e],ue[_e+1],ue[_e+2])}}function es(ue,q,j,ee,oe,_e,Se){let ke=ts(ue),fe=oe===0?Vl:ao,Re,$e,Ee=ue.start;for(let Nt=0;Nt<ue.length-3;Nt+=3){let di=ue[Nt],ei=ue[Nt+1],bn=ue[Nt+2],cn=ue[Nt+3],Gt=ue[Nt+4],Ei=oe===0?di:ei,Ji=oe===0?cn:Gt,Nn=!1;Se&&(Re=Math.sqrt(Math.pow(di-cn,2)+Math.pow(ei-Gt,2))),Ei<j?Ji>j&&($e=fe(ke,di,ei,cn,Gt,j),Se&&(ke.start=Ee+Re*$e)):Ei>ee?Ji<ee&&($e=fe(ke,di,ei,cn,Gt,ee),Se&&(ke.start=Ee+Re*$e)):ir(ke,di,ei,bn),Ji<j&&Ei>=j&&($e=fe(ke,di,ei,cn,Gt,j),Nn=!0),Ji>ee&&Ei<=ee&&($e=fe(ke,di,ei,cn,Gt,ee),Nn=!0),!_e&&Nn&&(Se&&(ke.end=Ee+Re*$e),q.push(ke),ke=ts(ue)),Se&&(Ee+=Re)}let Ye=ue.length-3,xt=ue[Ye],wt=ue[Ye+1],hi=oe===0?xt:wt;hi>=j&&hi<=ee&&ir(ke,xt,wt,ue[Ye+2]),Ye=ke.length-3,_e&&Ye>=3&&(ke[Ye]!==ke[0]||ke[Ye+1]!==ke[1])&&ir(ke,ke[0],ke[1],ke[2]),ke.length&&q.push(ke)}function ts(ue){let q=[];return q.size=ue.size,q.start=ue.start,q.end=ue.end,q}function Wa(ue,q,j,ee,oe,_e){for(let Se of ue)es(Se,q,j,ee,oe,_e,!1)}function ir(ue,q,j,ee){ue.push(q,j,ee)}function Vl(ue,q,j,ee,oe,_e){let Se=(_e-q)/(ee-q);return ir(ue,_e,j+(oe-j)*Se,1),Se}function ao(ue,q,j,ee,oe,_e){let Se=(_e-j)/(oe-j);return ir(ue,q+(ee-q)*Se,_e,1),Se}function Ge(ue,q){let j=[];for(let ee=0;ee<ue.length;ee++){let oe=ue[ee],_e=oe.type,Se;if(_e==="Point"||_e==="MultiPoint"||_e==="LineString")Se=is(oe.geometry,q);else if(_e==="MultiLineString"||_e==="Polygon"){Se=[];for(let ke of oe.geometry)Se.push(is(ke,q))}else if(_e==="MultiPolygon"){Se=[];for(let ke of oe.geometry){let fe=[];for(let Re of ke)fe.push(is(Re,q));Se.push(fe)}}j.push(Qr(oe.id,_e,Se,oe.tags))}return j}function is(ue,q){let j=[];j.size=ue.size,ue.start!==void 0&&(j.start=ue.start,j.end=ue.end);for(let ee=0;ee<ue.length;ee+=3)j.push(ue[ee]+q,ue[ee+1],ue[ee+2]);return j}function Gn(ue,q){if(ue.transformed)return ue;let j=1<<ue.z,ee=ue.x,oe=ue.y;for(let _e of ue.features){let Se=_e.geometry,ke=_e.type;if(_e.geometry=[],ke===1)for(let fe=0;fe<Se.length;fe+=2)_e.geometry.push(ns(Se[fe],Se[fe+1],q,j,ee,oe));else for(let fe=0;fe<Se.length;fe++){let Re=[];for(let $e=0;$e<Se[fe].length;$e+=2)Re.push(ns(Se[fe][$e],Se[fe][$e+1],q,j,ee,oe));_e.geometry.push(Re)}}return ue.transformed=!0,ue}function ns(ue,q,j,ee,oe,_e){return[Math.round(j*(ue*ee-oe)),Math.round(j*(q*ee-_e))]}function Ws(ue,q,j,ee,oe){let _e=q===oe.maxZoom?0:oe.tolerance/((1<<q)*oe.extent),Se={features:[],numPoints:0,numSimplified:0,numFeatures:ue.length,source:null,x:j,y:ee,z:q,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let ke of ue)et(Se,ke,_e,oe);return Se}function et(ue,q,j,ee){let oe=q.geometry,_e=q.type,Se=[];if(ue.minX=Math.min(ue.minX,q.minX),ue.minY=Math.min(ue.minY,q.minY),ue.maxX=Math.max(ue.maxX,q.maxX),ue.maxY=Math.max(ue.maxY,q.maxY),_e==="Point"||_e==="MultiPoint")for(let ke=0;ke<oe.length;ke+=3)Se.push(oe[ke],oe[ke+1]),ue.numPoints++,ue.numSimplified++;else if(_e==="LineString")Wt(Se,oe,ue,j,!1,!1);else if(_e==="MultiLineString"||_e==="Polygon")for(let ke=0;ke<oe.length;ke++)Wt(Se,oe[ke],ue,j,_e==="Polygon",ke===0);else if(_e==="MultiPolygon")for(let ke=0;ke<oe.length;ke++){let fe=oe[ke];for(let Re=0;Re<fe.length;Re++)Wt(Se,fe[Re],ue,j,!0,Re===0)}if(Se.length){let ke=q.tags||null;if(_e==="LineString"&&ee.lineMetrics){ke={};for(let Re in q.tags)ke[Re]=q.tags[Re];ke.mapbox_clip_start=oe.start/oe.size,ke.mapbox_clip_end=oe.end/oe.size}let fe={geometry:Se,type:_e==="Polygon"||_e==="MultiPolygon"?3:_e==="LineString"||_e==="MultiLineString"?2:1,tags:ke};q.id!==null&&(fe.id=q.id),ue.features.push(fe)}}function Wt(ue,q,j,ee,oe,_e){let Se=ee*ee;if(ee>0&&q.size<(oe?Se:ee))return void(j.numPoints+=q.length/3);let ke=[];for(let fe=0;fe<q.length;fe+=3)(ee===0||q[fe+2]>Se)&&(j.numSimplified++,ke.push(q[fe],q[fe+1])),j.numPoints++;oe&&function(fe,Re){let $e=0;for(let Ee=0,Ye=fe.length,xt=Ye-2;Ee<Ye;xt=Ee,Ee+=2)$e+=(fe[Ee]-fe[xt])*(fe[Ee+1]+fe[xt+1]);if($e>0===Re)for(let Ee=0,Ye=fe.length;Ee<Ye/2;Ee+=2){let xt=fe[Ee],wt=fe[Ee+1];fe[Ee]=fe[Ye-2-Ee],fe[Ee+1]=fe[Ye-1-Ee],fe[Ye-2-Ee]=xt,fe[Ye-1-Ee]=wt}}(ke,_e),ue.push(ke)}let Et={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};
21class nr{constructor(q,j){let ee=(j=this.options=function(_e,Se){for(let ke in Se)_e[ke]=Se[ke];return _e}(Object.create(Et),j)).debug;if(ee&&console.time("preprocess data"),j.maxZoom<0||j.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(j.promoteId&&j.generateId)throw new Error("promoteId and generateId cannot be used together.");let oe=function(_e,Se){let ke=[];if(_e.type==="FeatureCollection")for(let fe=0;fe<_e.features.length;fe++)Bn(ke,_e.features[fe],Se,fe);else Bn(ke,_e.type==="Feature"?_e:{geometry:_e},Se);return ke}(q,j);this.tiles={},this.tileCoords=[],ee&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",j.indexMaxZoom,j.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),oe=function(_e,Se){let ke=Se.buffer/Se.extent,fe=_e,Re=Ui(_e,1,-1-ke,ke,0,-1,2,Se),$e=Ui(_e,1,1-ke,2+ke,0,-1,2,Se);return(Re||$e)&&(fe=Ui(_e,1,-ke,1+ke,0,-1,2,Se)||[],Re&&(fe=Ge(Re,1).concat(fe)),$e&&(fe=fe.concat(Ge($e,-1)))),fe}(oe,j),oe.length&&this.splitTile(oe,0,0,0),ee&&(oe.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(q,j,ee,oe,_e,Se,ke){let fe=[q,j,ee,oe],Re=this.options,$e=Re.debug;for(;fe.length;){oe=fe.pop(),ee=fe.pop(),j=fe.pop(),q=fe.pop();let Ee=1<<j,Ye=Fr(j,ee,oe),xt=this.tiles[Ye];if(!xt&&($e>1&&console.time("creation"),xt=this.tiles[Ye]=Ws(q,j,ee,oe,Re),this.tileCoords.push({z:j,x:ee,y:oe}),$e)){$e>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",j,ee,oe,xt.numFeatures,xt.numPoints,xt.numSimplified),console.timeEnd("creation"));let Nn=`z${j}`;this.stats[Nn]=(this.stats[Nn]||0)+1,this.total++}if(xt.source=q,_e==null){if(j===Re.indexMaxZoom||xt.numPoints<=Re.indexMaxPoints)continue}else{if(j===Re.maxZoom||j===_e)continue;if(_e!=null){let Nn=_e-j;if(ee!==Se>>Nn||oe!==ke>>Nn)continue}}if(xt.source=null,q.length===0)continue;$e>1&&console.time("clipping");let wt=.5*Re.buffer/Re.extent,hi=.5-wt,Nt=.5+wt,di=1+wt,ei=null,bn=null,cn=null,Gt=null,Ei=Ui(q,Ee,ee-wt,ee+Nt,0,xt.minX,xt.maxX,Re),Ji=Ui(q,Ee,ee+hi,ee+di,0,xt.minX,xt.maxX,Re);q=null,Ei&&(ei=Ui(Ei,Ee,oe-wt,oe+Nt,1,xt.minY,xt.maxY,Re),bn=Ui(Ei,Ee,oe+hi,oe+di,1,xt.minY,xt.maxY,Re),Ei=null),Ji&&(cn=Ui(Ji,Ee,oe-wt,oe+Nt,1,xt.minY,xt.maxY,Re),Gt=Ui(Ji,Ee,oe+hi,oe+di,1,xt.minY,xt.maxY,Re),Ji=null),$e>1&&console.timeEnd("clipping"),fe.push(ei||[],j+1,2*ee,2*oe),fe.push(bn||[],j+1,2*ee,2*oe+1),fe.push(cn||[],j+1,2*ee+1,2*oe),fe.push(Gt||[],j+1,2*ee+1,2*oe+1)}}getTile(q,j,ee){q=+q,j=+j,ee=+ee;let oe=this.options,{extent:_e,debug:Se}=oe;if(q<0||q>24)return null;let ke=1<<q,fe=Fr(q,j=j+ke&ke-1,ee);if(this.tiles[fe])return Gn(this.tiles[fe],_e);Se>1&&console.log("drilling down to z%d-%d-%d",q,j,ee);let Re,$e=q,Ee=j,Ye=ee;for(;!Re&&$e>0;)$e--,Ee>>=1,Ye>>=1,Re=this.tiles[Fr($e,Ee,Ye)];return Re&&Re.source?(Se>1&&(console.log("found parent tile z%d-%d-%d",$e,Ee,Ye),console.time("drilling down")),this.splitTile(Re.source,$e,Ee,Ye,q,j,ee),Se>1&&console.timeEnd("drilling down"),this.tiles[fe]?Gn(this.tiles[fe],_e):null):null}}function Fr(ue,q,j){return 32*((1<<ue)*j+q)+ue}function Ft(ue,q){return q?ue.properties[q]:ue.id}function Gs(ue,q){if(ue==null)return!0;if(ue.type==="Feature")return Ft(ue,q)!=null;if(ue.type==="FeatureCollection"){let j=new Set;for(let ee of ue.features){let oe=Ft(ee,q);if(oe==null||j.has(oe))return!1;j.add(oe)}return!0}return!1}function lo(ue,q){let j=new Map;if(ue!=null)if(ue.type==="Feature")j.set(Ft(ue,q),ue);else for(let ee of ue.features)j.set(Ft(ee,q),ee);return j}class co extends T{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(q,j){return a._(this,void 0,void 0,function*(){let ee=q.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");let oe=this._geoJSONIndex.getTile(ee.z,ee.x,ee.y);if(!oe)return null;let _e=new class{constructor(ke){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.X,this.length=ke.length,this._features=ke}feature(ke){return new class{constructor(fe){this._feature=fe,this.extent=a.X,this.type=fe.type,this.properties=fe.tags,"id"in fe&&!isNaN(fe.id)&&(this.id=p
21arseInt(fe.id,10))}loadGeometry(){if(this._feature.type===1){let fe=[];for(let Re of this._feature.geometry)fe.push([new a.P(Re[0],Re[1])]);return fe}{let fe=[];for(let Re of this._feature.geometry){let $e=[];for(let Ee of Re)$e.push(new a.P(Ee[0],Ee[1]));fe.push($e)}return fe}}toGeoJSON(fe,Re,$e){return X.call(this,fe,Re,$e)}}(this._features[ke])}}(oe.features),Se=Bt(_e);return Se.byteOffset===0&&Se.byteLength===Se.buffer.byteLength||(Se=new Uint8Array(Se)),{vectorTile:_e,rawData:Se.buffer}})}loadData(q){return a._(this,void 0,void 0,function*(){var j;(j=this._pendingRequest)===null||j===void 0||j.abort();let ee=!!(q&&q.request&&q.request.collectResourceTiming)&&new a.bv(q.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(q,this._pendingRequest),this._geoJSONIndex=q.cluster?new mr(function({superclusterOptions:Se,clusterProperties:ke}){if(!ke||!Se)return Se;let fe={},Re={},$e={accumulated:null,zoom:0},Ee={properties:null},Ye=Object.keys(ke);for(let xt of Ye){let[wt,hi]=ke[xt],Nt=a.bC(hi),di=a.bC(typeof wt=="string"?[wt,["accumulated"],["get",xt]]:wt);fe[xt]=Nt.value,Re[xt]=di.value}return Se.map=xt=>{Ee.properties=xt;let wt={};for(let hi of Ye)wt[hi]=fe[hi].evaluate($e,Ee);return wt},Se.reduce=(xt,wt)=>{Ee.properties=wt;for(let hi of Ye)$e.accumulated=xt[hi],xt[hi]=Re[hi].evaluate($e,Ee)},Se}(q)).load((yield this._pendingData).features):(oe=yield this._pendingData,new nr(oe,q.geojsonVtOptions)),this.loaded={};let _e={};if(ee){let Se=ee.finish();Se&&(_e.resourceTiming={},_e.resourceTiming[q.source]=JSON.parse(JSON.stringify(Se)))}return _e}catch(_e){if(delete this._pendingRequest,a.bB(_e))return{abandoned:!0};throw _e}var oe})}getData(){return a._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(q){let j=this.loaded;return j&&j[q.uid]?super.reloadTile(q):this.loadTile(q)}loadAndProcessGeoJSON(q,j){return a._(this,void 0,void 0,function*(){let ee=yield this.loadGeoJSON(q,j);if(delete this._pendingRequest,typeof ee!="object")throw new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`);if(U(ee,!0),q.filter){let oe=a.bC(q.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(oe.result==="error")throw new Error(oe.value.map(Se=>`${Se.key}: ${Se.message}`).join(", "));ee={type:"FeatureCollection",features:ee.features.filter(Se=>oe.value.evaluate({zoom:0},Se))}}return ee})}loadGeoJSON(q,j){return a._(this,void 0,void 0,function*(){let{promoteId:ee}=q;if(q.request){let oe=yield a.h(q.request,j);return this._dataUpdateable=Gs(oe.data,ee)?lo(oe.data,ee):void 0,oe.data}if(typeof q.data=="string")try{let oe=JSON.parse(q.data);return this._dataUpdateable=Gs(oe,ee)?lo(oe,ee):void 0,oe}catch{throw new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`)}if(!q.dataDiff)throw new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${q.source}`);return function(oe,_e,Se){var ke,fe,Re,$e;if(_e.removeAll&&oe.clear(),_e.remove)for(let Ee of _e.remove)oe.delete(Ee);if(_e.add)for(let Ee of _e.add){let Ye=Ft(Ee,Se);Ye!=null&&oe.set(Ye,Ee)}if(_e.update)for(let Ee of _e.update){let Ye=oe.get(Ee.id);if(Ye==null)continue;let xt=!Ee.removeAllProperties&&(((ke=Ee.removeProperties)===null||ke===void 0?void 0:ke.length)>0||((fe=Ee.addOrUpdateProperties)===null||fe===void 0?void 0:fe.length)>0);if((Ee.newGeometry||Ee.removeAllProperties||xt)&&(Ye=Object.assign({},Ye),oe.set(Ee.id,Ye),xt&&(Ye.properties=Object.assign({},Ye.properties))),Ee.newGeometry&&(Ye.geometry=Ee.newGeometry),Ee.removeAllProperties)Ye.properties={};else if(((Re=Ee.removeProperties)===null||Re===void 0?void 0:Re.length)>0)for(let wt of Ee.removeProperties)Object.prototype.hasOwnProperty.call(Ye.properties,wt)&&delete Ye.properties[wt];if((($e=Ee.addOrUpdateProperties)===null||$e===void 0?void 0:$e.length)>0)for(let{key:wt,value:hi}of Ee.addOrUpdateProperties)Ye.properties[wt]=hi}}(this._dataUpdateable,q.dataDiff,ee),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(q){return a._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(q){return this._geoJSONIndex.getClusterExpansionZoom(q.clusterId)}getClusterChildren(q){return this._geoJSONIndex.getChildren(q.clusterId)}getClusterLeaves(q){return this._geoJSONIndex.getLeaves(q.clusterId,q.limit,q.offset)}}class Es{constructor(q){this.self=q,this.actor=new a.F(q),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={}
21,this.self.registerWorkerSource=(j,ee)=>{if(this.externalWorkerSourceTypes[j])throw new Error(`Worker source with name "${j}" already registered.`);this.externalWorkerSourceTypes[j]=ee},this.self.addProtocol=a.bi,this.self.removeProtocol=a.bj,this.self.registerRTLTextPlugin=j=>{if(a.bD.isParsed())throw new Error("RTL text plugin already registered.");a.bD.setMethods(j)},this.actor.registerMessageHandler("LDT",(j,ee)=>this._getDEMWorkerSource(j,ee.source).loadTile(ee)),this.actor.registerMessageHandler("RDT",(j,ee)=>a._(this,void 0,void 0,function*(){this._getDEMWorkerSource(j,ee.source).removeTile(ee)})),this.actor.registerMessageHandler("GCEZ",(j,ee)=>a._(this,void 0,void 0,function*(){return this._getWorkerSource(j,ee.type,ee.source).getClusterExpansionZoom(ee)})),this.actor.registerMessageHandler("GCC",(j,ee)=>a._(this,void 0,void 0,function*(){return this._getWorkerSource(j,ee.type,ee.source).getClusterChildren(ee)})),this.actor.registerMessageHandler("GCL",(j,ee)=>a._(this,void 0,void 0,function*(){return this._getWorkerSource(j,ee.type,ee.source).getClusterLeaves(ee)})),this.actor.registerMessageHandler("LD",(j,ee)=>this._getWorkerSource(j,ee.type,ee.source).loadData(ee)),this.actor.registerMessageHandler("GD",(j,ee)=>this._getWorkerSource(j,ee.type,ee.source).getData()),this.actor.registerMessageHandler("LT",(j,ee)=>this._getWorkerSource(j,ee.type,ee.source).loadTile(ee)),this.actor.registerMessageHandler("RT",(j,ee)=>this._getWorkerSource(j,ee.type,ee.source).reloadTile(ee)),this.actor.registerMessageHandler("AT",(j,ee)=>this._getWorkerSource(j,ee.type,ee.source).abortTile(ee)),this.actor.registerMessageHandler("RMT",(j,ee)=>this._getWorkerSource(j,ee.type,ee.source).removeTile(ee)),this.actor.registerMessageHandler("RS",(j,ee)=>a._(this,void 0,void 0,function*(){if(!this.workerSources[j]||!this.workerSources[j][ee.type]||!this.workerSources[j][ee.type][ee.source])return;let oe=this.workerSources[j][ee.type][ee.source];delete this.workerSources[j][ee.type][ee.source],oe.removeSource!==void 0&&oe.removeSource(ee)})),this.actor.registerMessageHandler("RM",j=>a._(this,void 0,void 0,function*(){delete this.layerIndexes[j],delete this.availableImages[j],delete this.workerSources[j],delete this.demWorkerSources[j]})),this.actor.registerMessageHandler("SR",(j,ee)=>a._(this,void 0,void 0,function*(){this.referrer=ee})),this.actor.registerMessageHandler("SRPS",(j,ee)=>this._syncRTLPluginState(j,ee)),this.actor.registerMessageHandler("IS",(j,ee)=>a._(this,void 0,void 0,function*(){this.self.importScripts(ee)})),this.actor.registerMessageHandler("SI",(j,ee)=>this._setImages(j,ee)),this.actor.registerMessageHandler("UL",(j,ee)=>a._(this,void 0,void 0,function*(){this._getLayerIndex(j).update(ee.layers,ee.removedIds)})),this.actor.registerMessageHandler("SL",(j,ee)=>a._(this,void 0,void 0,function*(){this._getLayerIndex(j).replace(ee)}))}_setImages(q,j){return a._(this,void 0,void 0,function*(){this.availableImages[q]=j;for(let ee in this.workerSources[q]){let oe=this.workerSources[q][ee];for(let _e in oe)oe[_e].availableImages=j}})}_syncRTLPluginState(q,j){return a._(this,void 0,void 0,function*(){if(a.bD.isParsed())return a.bD.getState();if(j.pluginStatus!=="loading")return a.bD.setState(j),j;let ee=j.pluginURL;if(this.self.importScripts(ee),a.bD.isParsed()){let oe={pluginStatus:"loaded",pluginURL:ee};return a.bD.setState(oe),oe}throw a.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${ee}`)})}_getAvailableImages(q){let j=this.availableImages[q];return j||(j=[]),j}_getLayerIndex(q){let j=this.layerIndexes[q];return j||(j=this.layerIndexes[q]=new r),j}_getWorkerSource(q,j,ee){if(this.workerSources[q]||(this.workerSources[q]={}),this.workerSources[q][j]||(this.workerSources[q][j]={}),!this.workerSources[q][j][ee]){let oe={sendAsync:(_e,Se)=>(_e.targetMapId=q,this.actor.sendAsync(_e,Se))};switch(j){case"vector":this.workerSources[q][j][ee]=new T(oe,this._getLayerIndex(q),this._getAvailableImages(q));break;case"geojson":this.workerSources[q][j][ee]=new co(oe,this._getLayerIndex(q),this._getAvailableImages(q));break;default:this.workerSources[q][j][ee]=new this.externalWorkerSourceTypes[j](oe,this._getLayerIndex(q),this._getAvailableImages(q))}}return this.workerSources[q][j][ee]}_getDEMWorkerSource(q,j){return this.demWorkerSources[q]||(this.demWorkerSources[q]={}),this.demWorkerSources[q][j]||(this.demWorkerSources[q][j]=new k),this.demWorkerSources[q][j]}}return a.i(self)&&(self.worker=new Es(self)),Es}),i("index",["exports","./shared"],function(a,r){"use strict";var h="4.7.1";let m,b,T={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:x=>new Promise((s,u)=>{let f=requestAnimationFrame(s);x.signal.addEventListener("abort",()=>{cancelAnimationFrame(f),u(r.c())})}),getImageData(x,s=0){return this.getImageCanvasContext(x).getImageData(-s,-s,x.width+2*s,x.height+2*s)},getImageCanvasContext(x){let s=window.document.createElement("canvas"),u=s.getContext("2d",{willReadFrequently:!0});if(!u)throw new Error("failed to create canvas 2d context");return s.width=x.width,s.height=x.height,u.drawImage(x,0,0,x.width,x.height),u},resolveURL:x=>(m||(m=document.createElement("a")),m.href=x,m.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(b==null&&(b=matchMedia("(prefers-reduced-motion: reduce)")),b.matches)}};class k{static testProp(s){if(!k.docStyle)return s[0];for(let u=0;u<s.length;u++)if(s[u]in k.docStyle)return s[u];return s[0]}static create(s,u,f){let g=window.document.createElement(s);return u!==void 0&&(g.className=u),f&&f.appendChild(g),g}static createNS(s,u){return window.document.createElementNS(s,u)}static disableDrag(){k.docStyle&&k.selectProp&&(k.userSelect=k.docStyle[k.selectProp],k.docStyle[k.selectProp]="none")}static enableDrag(){k.docStyle&&k.selectProp&&(k.docStyle[k.selectProp]=k.userSelect)}static setTransform(s,u){s.style[k.transformProp]=u}static addEventListener(s,u,f,g={}){s.addEventListener(u,f,"passive"in g?g:g.capture)}static removeEventListener(s,u,f,g={}){s.removeEventListener(u,f,"passive"in g?g:g.capture)}static suppressClickInternal(s){s.preventDefault(),s.stopPropagation(),window.removeEventListener("click",k.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",k.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",k.suppressClickInternal,!0)},0)}static getScale(s){let u=s.getBoundingClientRect();return{x:u.width/s.offsetWidth||1,y:u.height/s.offsetHeight||1,boundingClientRect:u}}static getPoint(s,u,f){let g=u.boundingClientRect;return new r.P((f.clientX-g.left)/u.x-s.clientLeft,(f.clientY-g.top)/u.y-s.clientTop)}static mousePos(s,u){let f=k.getScale(s);return k.getPoint(s,f,u)}static touchPos(s,u){let f=[],g=k.getScale(s);for(let v=0;v<u.length;v++)f.push(k.getPoint(s,g,u[v]));return f}static mouseButton(s){return s.button}static remove(s){s.parentNode&&s.parentNode.removeChild(s)}}k.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,k.selectProp=k.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),k.transformProp=k.testProp(["transform","WebkitTransform"]);
21let P={supported:!1,testSupport:function(x){!X&&U&&(Y?te(x):F=x)}},F,U,X=!1,Y=!1;function te(x){let s=x.createTexture();x.bindTexture(x.TEXTURE_2D,s);try{if(x.texImage2D(x.TEXTURE_2D,0,x.RGBA,x.RGBA,x.UNSIGNED_BYTE,U),x.isContextLost())return;P.supported=!0}catch{}x.deleteTexture(s),X=!0}var le;typeof document<"u"&&(U=document.createElement("img"),U.onload=()=>{F&&te(F),F=null,Y=!0},U.onerror=()=>{X=!0,F=null},U.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(x){let s,u,f,g;x.resetRequestQueue=()=>{s=[],u=0,f=0,g={}},x.addThrottleControl=L=>{let O=f++;return g[O]=L,O},x.removeThrottleControl=L=>{delete g[L],A()},x.getImage=(L,O,N=!0)=>new Promise((V,G)=>{P.supported&&(L.headers||(L.headers={}),L.headers.accept="image/webp,*/*"),r.e(L,{type:"image"}),s.push({abortController:O,requestParameters:L,supportImageRefresh:N,state:"queued",onError:Q=>{G(Q)},onSuccess:Q=>{V(Q)}}),A()});let v=L=>r._(this,void 0,void 0,function*(){L.state="running";let{requestParameters:O,supportImageRefresh:N,onError:V,onSuccess:G,abortController:Q}=L,ne=N===!1&&!r.i(self)&&!r.g(O.url)&&(!O.headers||Object.keys(O.headers).reduce((de,me)=>de&&me==="accept",!0));u++;let ae=ne?I(O,Q):r.m(O,Q);try{let de=yield ae;delete L.abortController,L.state="completed",de.data instanceof HTMLImageElement||r.b(de.data)?G(de):de.data&&G({data:yield(he=de.data,typeof createImageBitmap=="function"?r.d(he):r.f(he)),cacheControl:de.cacheControl,expires:de.expires})}catch(de){delete L.abortController,V(de)}finally{u--,A()}var he}),A=()=>{let L=(()=>{for(let O of Object.keys(g))if(g[O]())return!0;return!1})()?r.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:r.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let O=u;O<L&&s.length>0;O++){let N=s.shift();N.abortController.signal.aborted?O--:v(N)}},I=(L,O)=>new Promise((N,V)=>{let G=new Image,Q=L.url,ne=L.credentials;ne&&ne==="include"?G.crossOrigin="use-credentials":(ne&&ne==="same-origin"||!r.s(Q))&&(G.crossOrigin="anonymous"),O.signal.addEventListener("abort",()=>{G.src="",V(r.c())}),G.fetchPriority="high",G.onload=()=>{G.onerror=G.onload=null,N({data:G})},G.onerror=()=>{G.onerror=G.onload=null,O.signal.aborted||V(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},G.src=Q})}(le||(le={})),le.resetRequestQueue();class we{constructor(s){this._transformRequestFn=s}transformRequest(s,u){return this._transformRequestFn&&this._transformRequestFn(s,u)||{url:s}}setTransformRequest(s){this._transformRequestFn=s}}function Le(x){var s=new r.A(3);return s[0]=x[0],s[1]=x[1],s[2]=x[2],s}var Oe,ze=function(x,s,u){return x[0]=s[0]-u[0],x[1]=s[1]-u[1],x[2]=s[2]-u[2],x};Oe=new r.A(3),r.A!=Float32Array&&(Oe[0]=0,Oe[1]=0,Oe[2]=0);var Xe=function(x){var s=x[0],u=x[1];return s*s+u*u};function Ke(x){let s=[];if(typeof x=="string")s.push({id:"default",url:x});else if(x&&x.length>0){let u=[];for(let{id:f,url:g}of x){let v=`${f}${g}`;u.indexOf(v)===-1&&(u.push(v),s.push({id:f,url:g}))}}return s}function rt(x,s,u){let f=x.split("?");return f[0]+=`${s}${u}`,f.join("?")}(function(){var x=new r.A(2);r.A!=Float32Array&&(x[0]=0,x[1]=0)})();class at{constructor(s,u,f,g){this.context=s,this.format=f,this.texture=s.gl.createTexture(),this.update(u,g)}update(s,u,f){let{width:g,height:v}=s,A=!(this.size&&this.size[0]===g&&this.size[1]===v||f),{context:I}=this,{gl:L}=I;if(this.useMipmap=!!(u&&u.useMipmap),L.bindTexture(L.TEXTURE_2D,this.texture),I.pixelStoreUnpackFlipY.set(!1),I.pixelStoreUnpack.set(1),I.pixelStoreUnpackPremultiplyAlpha.set(this.format===L.RGBA&&(!u||u.premultiply!==!1)),A)this.size=[g,v],s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||r.b(s)?L.texImage2D(L.TEXTURE_2D,0,this.format,this.format,L.UNSIGNED_BYTE,s):L.texImage2D(L.TEXTURE_2D,0,this.format,g,v,0,this.format,L.UNSIGNED_BYTE,s.data);else{let{x:O,y:N}=f||{x:0,y:0};s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||r.b(s)?L.texSubImage2D(L.TEXTURE_2D,0,O,N,L.RGBA,L.UNSIGNED_BYTE,s):L.texSubImage2D(L.TEXTURE_2D,0,O,N,g,v,L.RGBA,L.UNSIGNED_BYTE,s.data)}this.useMipmap&&this.isSizePowerOfTwo()&&L.generateMipmap(L.TEXTURE_2D)}
21bind(s,u,f){let{context:g}=this,{gl:v}=g;v.bindTexture(v.TEXTURE_2D,this.texture),f!==v.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(f=v.LINEAR),s!==this.filter&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,s),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,f||s),this.filter=s),u!==this.wrap&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,u),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,u),this.wrap=u)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:s}=this.context;s.deleteTexture(this.texture),this.texture=null}}function $t(x){let{userImage:s}=x;return!!(s&&s.render&&s.render())&&(x.data.replace(new Uint8Array(s.data.buffer)),!0)}class Tt extends r.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new r.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(s){if(this.loaded!==s&&(this.loaded=s,s)){for(let{ids:u,promiseResolve:f}of this.requestors)f(this._getImagesForIds(u));this.requestors=[]}}getImage(s){let u=this.images[s];if(u&&!u.data&&u.spriteData){let f=u.spriteData;u.data=new r.R({width:f.width,height:f.height},f.context.getImageData(f.x,f.y,f.width,f.height).data),u.spriteData=null}return u}addImage(s,u){if(this.images[s])throw new Error(`Image id ${s} already exist, use updateImage instead`);this._validate(s,u)&&(this.images[s]=u)}_validate(s,u){let f=!0,g=u.data||u.spriteData;return this._validateStretch(u.stretchX,g&&g.width)||(this.fire(new r.j(new Error(`Image "${s}" has invalid "stretchX" value`))),f=!1),this._validateStretch(u.stretchY,g&&g.height)||(this.fire(new r.j(new Error(`Image "${s}" has invalid "stretchY" value`))),f=!1),this._validateContent(u.content,u)||(this.fire(new r.j(new Error(`Image "${s}" has invalid "content" value`))),f=!1),f}_validateStretch(s,u){if(!s)return!0;let f=0;for(let g of s){if(g[0]<f||g[1]<g[0]||u<g[1])return!1;f=g[1]}return!0}_validateContent(s,u){if(!s)return!0;if(s.length!==4)return!1;let f=u.spriteData,g=f&&f.width||u.data.width,v=f&&f.height||u.data.height;return!(s[0]<0||g<s[0]||s[1]<0||v<s[1]||s[2]<0||g<s[2]||s[3]<0||v<s[3]||s[2]<s[0]||s[3]<s[1])}updateImage(s,u,f=!0){let g=this.getImage(s);if(f&&(g.data.width!==u.data.width||g.data.height!==u.data.height))throw new Error(`size mismatch between old image (${g.data.width}x${g.data.height}) and new image (${u.data.width}x${u.data.height}).`);u.version=g.version+1,this.images[s]=u,this.updatedImages[s]=!0}removeImage(s){let u=this.images[s];delete this.images[s],delete this.patterns[s],u.userImage&&u.userImage.onRemove&&u.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(s){return new Promise((u,f)=>{let g=!0;if(!this.isLoaded())for(let v of s)this.images[v]||(g=!1);this.isLoaded()||g?u(this._getImagesForIds(s)):this.requestors.push({ids:s,promiseResolve:u})})}_getImagesForIds(s){let u={};for(let f of s){let g=this.getImage(f);g||(this.fire(new r.k("styleimagemissing",{id:f})),g=this.getImage(f)),g?u[f]={data:g.data.clone(),pixelRatio:g.pixelRatio,sdf:g.sdf,version:g.version,stretchX:g.stretchX,stretchY:g.stretchY,content:g.content,textFitWidth:g.textFitWidth,textFitHeight:g.textFitHeight,hasRenderCallback:!!(g.userImage&&g.userImage.render)}:r.w(`Image "${f}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return u}getPixelSize(){let{width:s,height:u}=this.atlasImage;return{width:s,height:u}}getPattern(s){let u=this.patterns[s],f=this.getImage(s);if(!f)return null;if(u&&u.position.version===f.version)return u.position;if(u)u.position.version=f.version;else{let g={w:f.data.width+2,h:f.data.height+2,x:0,y:0},v=new r.I(g,f);this.patterns[s]={bin:g,position:v}}return this._updatePatternAtlas(),this.patterns[s].position}bind(s){let u=s.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new at(s,this.atlasImage,u.RGBA),this.atlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE)}_updatePatternAtlas(){let s=[];for(let v in this.patterns)s.push(this.patterns[v].bin);let{w:u,h:f}=r.p(s),g=this.atlasImage;g.resize({width:u||1,height:f||1});for(let v in this.patterns){let{bin:A}=this.patterns[v],I=A.x+1,L=A.y+1,O=this.getImage(v).data,N=O.width,V=O.height;r.R.copy(O,g,{x:0,y:0},{x:I,y:L},{width:N,height:V}),r.R.copy(O,g,{x:0,y:V-1},{x:I,y:L-1},{width:N,height:1}),r.R.copy(O,g,{x:0,y:0},{x:I,y:L+V},{width:N,height:1}),r.R.copy(O,g,{x:N-1,y:0},{x:I-1,y:L},{width:1,height:V}),r.R.copy(O,g,{x:0,y:0},{x:I+N,y:L},{width:1,height:V})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}
21dispatchRenderCallbacks(s){for(let u of s){if(this.callbackDispatchedThisFrame[u])continue;this.callbackDispatchedThisFrame[u]=!0;let f=this.getImage(u);f||r.w(`Image with ID: "${u}" was not found`),$t(f)&&this.updateImage(u,f)}}}let Lt=1e20;function Di(x,s,u,f,g,v,A,I,L){for(let O=s;O<s+f;O++)mn(x,u*v+O,v,g,A,I,L);for(let O=u;O<u+g;O++)mn(x,O*v+s,1,f,A,I,L)}function mn(x,s,u,f,g,v,A){v[0]=0,A[0]=-Lt,A[1]=Lt,g[0]=x[s];for(let I=1,L=0,O=0;I<f;I++){g[I]=x[s+I*u];let N=I*I;do{let V=v[L];O=(g[I]-g[V]+N-V*V)/(I-V)/2}while(O<=A[L]&&--L>-1);L++,v[L]=I,A[L]=O,A[L+1]=Lt}for(let I=0,L=0;I<f;I++){for(;A[L+1]<I;)L++;let O=v[L],N=I-O;x[s+I*u]=g[O]+N*N}}class Bt{constructor(s,u){this.requestManager=s,this.localIdeographFontFamily=u,this.entries={}}setURL(s){this.url=s}getGlyphs(s){return r._(this,void 0,void 0,function*(){let u=[];for(let v in s)for(let A of s[v])u.push(this._getAndCacheGlyphsPromise(v,A));let f=yield Promise.all(u),g={};for(let{stack:v,id:A,glyph:I}of f)g[v]||(g[v]={}),g[v][A]=I&&{id:I.id,bitmap:I.bitmap.clone(),metrics:I.metrics};return g})}_getAndCacheGlyphsPromise(s,u){return r._(this,void 0,void 0,function*(){let f=this.entries[s];f||(f=this.entries[s]={glyphs:{},requests:{},ranges:{}});let g=f.glyphs[u];if(g!==void 0)return{stack:s,id:u,glyph:g};if(g=this._tinySDF(f,s,u),g)return f.glyphs[u]=g,{stack:s,id:u,glyph:g};let v=Math.floor(u/256);if(256*v>65535)throw new Error("glyphs > 65535 not supported");if(f.ranges[v])return{stack:s,id:u,glyph:g};if(!this.url)throw new Error("glyphsUrl is not set");if(!f.requests[v]){let I=Bt.loadGlyphRange(s,v,this.url,this.requestManager);f.requests[v]=I}let A=yield f.requests[v];for(let I in A)this._doesCharSupportLocalGlyph(+I)||(f.glyphs[+I]=A[+I]);return f.ranges[v]=!0,{stack:s,id:u,glyph:A[u]||null}})}_doesCharSupportLocalGlyph(s){return!!this.localIdeographFontFamily&&/\p{Ideo}|\p{sc=Hang}|\p{sc=Hira}|\p{sc=Kana}/u.test(String.fromCodePoint(s))}_tinySDF(s,u,f){let g=this.localIdeographFontFamily;if(!g||!this._doesCharSupportLocalGlyph(f))return;let v=s.tinySDF;if(!v){let I="400";/bold/i.test(u)?I="900":/medium/i.test(u)?I="500":/light/i.test(u)&&(I="200"),v=s.tinySDF=new Bt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:g,fontWeight:I})}let A=v.draw(String.fromCharCode(f));return{id:f,bitmap:new r.o({width:A.width||60,height:A.height||60},A.data),metrics:{width:A.glyphWidth/2||24,height:A.glyphHeight/2||24,left:A.glyphLeft/2+.5||0,top:A.glyphTop/2-27.5||-8,advance:A.glyphAdvance/2||24,isDoubleResolution:!0}}}}Bt.loadGlyphRange=function(x,s,u,f){return r._(this,void 0,void 0,function*(){let g=256*s,v=g+255,A=f.transformRequest(u.replace("{fontstack}",x).replace("{range}",`${g}-${v}`),"Glyphs"),I=yield r.l(A,new AbortController);if(!I||!I.data)throw new Error(`Could not load glyph range. range: ${s}, ${g}-${v}`);let L={};for(let O of r.n(I.data))L[O.id]=O;return L})},Bt.TinySDF=class{constructor({fontSize:x=24,buffer:s=3,radius:u=8,cutoff:f=.25,fontFamily:g="sans-serif",fontWeight:v="normal",fontStyle:A="normal"}={}){this.buffer=s,this.cutoff=f,this.radius=u;let I=this.size=x+4*s,L=this._createCanvas(I),O=this.ctx=L.getContext("2d",{willReadFrequently:!0});O.font=`${A} ${v} ${x}px ${g}`,O.textBaseline="alphabetic",O.textAlign="left",O.fillStyle="black",this.gridOuter=new Float64Array(I*I),this.gridInner=new Float64Array(I*I),this.f=new Float64Array(I),this.z=new Float64Array(I+1),this.v=new Uint16Array(I)}_createCanvas(x){let s=document.createElement("canvas");return s.width=s.height=x,s}draw(x){let{width:s,actualBoundingBoxAscent:u,actualBoundingBoxDescent:f,actualBoundingBoxLeft:g,actualBoundingBoxRight:v}=this.ctx.measureText(x),A=Math.ceil(u),I=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(v-g))),L=Math.min(this.size-this.buffer,A+Math.ceil(f)),O=I+2*this.buffer,N=L+2*this.buffer,V=Math.max(O*N,0),G=new Uint8ClampedArray(V),Q={data:G,width:O,height:N,glyphWidth:I,glyphHeight:L,glyphTop:A,glyphLeft:0,glyphAdvance:s};if(I===0||L===0)return Q;let{ctx:ne,buffer:ae,gridInner:he,gridOuter:de}=this;ne.clearRect(ae,ae,I,L),ne.fillText(x,ae,ae+A);let me=ne.getImageData(ae,ae,I,L);de.fill(Lt,0,V),he.fill(0,0,V);for(let re=0;re<L;re++)for(let ve=0;ve<I;ve++){let xe=me.data[4*(re*I+ve)+3]/255;if(xe===0)continue;let Ae=(re+ae)*O+ve+ae;if(xe===1)de[Ae]=0,he[Ae]=Lt;else{let Ne=.5-xe;de[Ae]=Ne>0?Ne*Ne:0,he[Ae]=Ne<0?Ne*Ne:0}}Di(de,0,0,O,N,O,this.f,this.v,this.z),Di(he,ae,ae,I,L,O,this.f,this.v,this.z);for(let re=0;re<V;re++){let ve=Math.sqrt(de[re])-Math.sqrt(he[re]);G[re]=Math.round(255-255*(ve/this.radius+this.cutoff))}return Q}};class oi{constructor(){this.specification=r.v.light.position}possiblyEvaluate(s,u){return r.x(s.expression.evaluate(u))}interpolate(s,u,f){return{x:r.y.number(s.x,u.x,f),y:r.y.number(s.y,u.y,f),z:r.y.number(s.z,u.z,f)}}}let Si;class Gi extends r.E{constructor(s){super(),Si=Si||new r.q({anchor:new r.D(r.v.light.anchor),position:new oi,color:new r.D(r.v.light.color),intensity:new r.D(r.v.light.intensity)}),this._transitionable=new r.T(Si),this.setLight(s),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(s,u={}
21){if(!this._validate(r.r,s,u))for(let f in s){let g=s[f];f.endsWith("-transition")?this._transitionable.setTransition(f.slice(0,-11),g):this._transitionable.setValue(f,g)}}updateTransitions(s){this._transitioning=this._transitionable.transitioned(s,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(s){this.properties=this._transitioning.possiblyEvaluate(s)}_validate(s,u,f){return(!f||f.validate!==!1)&&r.t(this,s.call(r.u,{value:u,style:{glyphs:!0,sprite:!0},styleSpec:r.v}))}}let Jt=new r.q({"sky-color":new r.D(r.v.sky["sky-color"]),"horizon-color":new r.D(r.v.sky["horizon-color"]),"fog-color":new r.D(r.v.sky["fog-color"]),"fog-ground-blend":new r.D(r.v.sky["fog-ground-blend"]),"horizon-fog-blend":new r.D(r.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new r.D(r.v.sky["sky-horizon-blend"]),"atmosphere-blend":new r.D(r.v.sky["atmosphere-blend"])});class Fn extends r.E{constructor(s){super(),this._transitionable=new r.T(Jt),this.setSky(s),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new r.z(0))}setSky(s,u={}){if(!this._validate(r.B,s,u)){s||(s={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(let f in s){let g=s[f];f.endsWith("-transition")?this._transitionable.setTransition(f.slice(0,-11),g):this._transitionable.setValue(f,g)}}}getSky(){return this._transitionable.serialize()}updateTransitions(s){this._transitioning=this._transitionable.transitioned(s,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(s){this.properties=this._transitioning.possiblyEvaluate(s)}_validate(s,u,f={}){return f?.validate!==!1&&r.t(this,s.call(r.u,r.e({value:u,style:{glyphs:!0,sprite:!0},styleSpec:r.v})))}calculateFogBlendOpacity(s){return s<60?0:s<70?(s-60)/10:1}}class Ms{constructor(s,u){this.width=s,this.height=u,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(s,u){let f=s.join(",")+String(u);return this.dashEntry[f]||(this.dashEntry[f]=this.addDash(s,u)),this.dashEntry[f]}getDashRanges(s,u,f){let g=[],v=s.length%2==1?-s[s.length-1]*f:0,A=s[0]*f,I=!0;g.push({left:v,right:A,isDash:I,zeroLength:s[0]===0});let L=s[0];for(let O=1;O<s.length;O++){I=!I;let N=s[O];v=L*f,L+=N,A=L*f,g.push({left:v,right:A,isDash:I,zeroLength:N===0})}return g}addRoundDash(s,u,f){let g=u/2;for(let v=-f;v<=f;v++){let A=this.width*(this.nextRow+f+v),I=0,L=s[I];for(let O=0;O<this.width;O++){O/L.right>1&&(L=s[++I]);let N=Math.abs(O-L.left),V=Math.abs(O-L.right),G=Math.min(N,V),Q,ne=v/f*(g+1);if(L.isDash){let ae=g-Math.abs(ne);Q=Math.sqrt(G*G+ae*ae)}else Q=g-Math.sqrt(G*G+ne*ne);this.data[A+O]=Math.max(0,Math.min(255,Q+128))}}}addRegularDash(s){for(let I=s.length-1;I>=0;--I){let L=s[I],O=s[I+1];L.zeroLength?s.splice(I,1):O&&O.isDash===L.isDash&&(O.left=L.left,s.splice(I,1))}let u=s[0],f=s[s.length-1];u.isDash===f.isDash&&(u.left=f.left-this.width,f.right=u.right+this.width);let g=this.width*this.nextRow,v=0,A=s[v];for(let I=0;I<this.width;I++){I/A.right>1&&(A=s[++v]);let L=Math.abs(I-A.left),O=Math.abs(I-A.right),N=Math.min(L,O);this.data[g+I]=Math.max(0,Math.min(255,(A.isDash?N:-N)+128))}}addDash(s,u){let f=u?7:0,g=2*f+1;if(this.nextRow+g>this.height)return r.w("LineAtlas out of space"),null;let v=0;for(let I=0;I<s.length;I++)v+=s[I];if(v!==0){let I=this.width/v,L=this.getDashRanges(s,this.width,I);u?this.addRoundDash(L,I,f):this.addRegularDash(L)}let A={y:(this.nextRow+f+.5)/this.height,height:2*f/this.height,width:v};return this.nextRow+=g,this.dirty=!0,A}bind(s){let u=s.gl;this.texture?(u.bindTexture(u.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,u.texSubImage2D(u.TEXTURE_2D,0,0,0,this.width,this.height,u.ALPHA,u.UNSIGNED_BYTE,this.data))):(this.texture=u.createTexture(),u.bindTexture(u.TEXTURE_2D,this.texture),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.REPEAT),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.REPEAT),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,u.LINEAR),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,u.LINEAR),u.texImage2D(u.TEXTURE_2D,0,u.ALPHA,this.width,this.height,0,u.ALPHA,u.UNSIGNED_BYTE,this.data))}}let mr="maplibre_preloaded_worker_pool";class vn{constructor(){this.active={}}acquire(s){if(!this.workers)for(this.workers=[];this.workers.length<vn.workerCount;)this.workers.push(new Worker(r.a.WORKER_URL));return this.active[s]=!0,this.workers.slice()}release(s){delete this.active[s],this.numActive()===0&&(this.workers.forEac
21h(u=>{u.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[mr]}numActive(){return Object.keys(this.active).length}}let Wn=Math.floor(T.hardwareConcurrency/2),In,ln;function As(){return In||(In=new vn),In}vn.workerCount=r.C(globalThis)?Math.max(Math.min(Wn,3),1):1;class oa{constructor(s,u){this.workerPool=s,this.actors=[],this.currentActor=0,this.id=u;let f=this.workerPool.acquire(u);for(let g=0;g<f.length;g++){let v=new r.F(f[g],u);v.name=`Worker ${g}`,this.actors.push(v)}if(!this.actors.length)throw new Error("No actors found")}broadcast(s,u){let f=[];for(let g of this.actors)f.push(g.sendAsync({type:s,data:u}));return Promise.all(f)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(s=!0){this.actors.forEach(u=>{u.remove()}),this.actors=[],s&&this.workerPool.release(this.id)}registerMessageHandler(s,u){for(let f of this.actors)f.registerMessageHandler(s,u)}}function Io(){return ln||(ln=new oa(As(),r.G),ln.registerMessageHandler("GR",(x,s,u)=>r.m(s,u))),ln}function Qr(x,s){let u=r.H();return r.J(u,u,[1,1,0]),r.K(u,u,[.5*x.width,.5*x.height,1]),r.L(u,u,x.calculatePosMatrix(s.toUnwrapped()))}function oo(x,s,u,f,g,v){let A=function(V,G,Q){if(V)for(let ne of V){let ae=G[ne];if(ae&&ae.source===Q&&ae.type==="fill-extrusion")return!0}else for(let ne in G){let ae=G[ne];if(ae.source===Q&&ae.type==="fill-extrusion")return!0}return!1}(g&&g.layers,s,x.id),I=v.maxPitchScaleFactor(),L=x.tilesIn(f,I,A);L.sort(Bn);let O=[];for(let V of L)O.push({wrappedTileID:V.tileID.wrapped().key,queryResults:V.tile.queryRenderedFeatures(s,u,x._state,V.queryGeometry,V.cameraQueryGeometry,V.scale,g,v,I,Qr(x.transform,V.tileID))});let N=function(V){let G={},Q={};for(let ne of V){let ae=ne.queryResults,he=ne.wrappedTileID,de=Q[he]=Q[he]||{};for(let me in ae){let re=ae[me],ve=de[me]=de[me]||{},xe=G[me]=G[me]||[];for(let Ae of re)ve[Ae.featureIndex]||(ve[Ae.featureIndex]=!0,xe.push(Ae))}}return G}(O);for(let V in N)N[V].forEach(G=>{let Q=G.feature,ne=x.getFeatureState(Q.layer["source-layer"],Q.id);Q.source=Q.layer.source,Q.layer["source-layer"]&&(Q.sourceLayer=Q.layer["source-layer"]),Q.state=ne});return N}function Bn(x,s){let u=x.tileID,f=s.tileID;return u.overscaledZ-f.overscaledZ||u.canonical.y-f.canonical.y||u.wrap-f.wrap||u.canonical.x-f.canonical.x}function Hs(x,s,u){return r._(this,void 0,void 0,function*(){let f=x;if(x.url?f=(yield r.h(s.transformRequest(x.url,"Source"),u)).data:yield T.frameAsync(u),!f)return null;let g=r.M(r.e(f,x),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in f&&f.vector_layers&&(g.vectorLayerIds=f.vector_layers.map(v=>v.id)),g})}class Ie{constructor(s,u){s&&(u?this.setSouthWest(s).setNorthEast(u):Array.isArray(s)&&(s.length===4?this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]]):this.setSouthWest(s[0]).setNorthEast(s[1])))}setNorthEast(s){return this._ne=s instanceof r.N?new r.N(s.lng,s.lat):r.N.convert(s),this}setSouthWest(s){return this._sw=s instanceof r.N?new r.N(s.lng,s.lat):r.N.convert(s),this}extend(s){let u=this._sw,f=this._ne,g,v;if(s instanceof r.N)g=s,v=s;else{if(!(s instanceof Ie))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(Ie.convert(s)):this.extend(r.N.convert(s)):s&&("lng"in s||"lon"in s)&&"lat"in s?this.extend(r.N.convert(s)):this;if(g=s._sw,v=s._ne,!g||!v)return this}return u||f?(u.lng=Math.min(g.lng,u.lng),u.lat=Math.min(g.lat,u.lat),f.lng=Math.max(v.lng,f.lng),f.lat=Math.max(v.lat,f.lat)):(this._sw=new r.N(g.lng,g.lat),this._ne=new r.N(v.lng,v.lat)),this}getCenter(){return new r.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new r.N(this.getWest(),this.getNorth())}getSouthEast(){return new r.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(s){let{lng:u,lat:f}=r.N.convert(s),g=this._sw.lng<=u&&u<=this._ne.lng;return this._sw.lng>this._ne.lng&&(g=this._sw.lng>=u&&u>=this._ne.lng),this._sw.lat<=f&&f<=this._ne.lat&&g}static convert(s){return s instanceof Ie?s:s&&new Ie(s)}static fromLngLat(s,u=0){let f=360*u/40075017,g=f/Math.cos(Math.PI/180*s.lat);
21return new Ie(new r.N(s.lng-g,s.lat-f),new r.N(s.lng+g,s.lat+f))}adjustAntiMeridian(){let s=new r.N(this._sw.lng,this._sw.lat),u=new r.N(this._ne.lng,this._ne.lat);return new Ie(s,s.lng>u.lng?new r.N(u.lng+360,u.lat):u)}}class gr{constructor(s,u,f){this.bounds=Ie.convert(this.validateBounds(s)),this.minzoom=u||0,this.maxzoom=f||24}validateBounds(s){return Array.isArray(s)&&s.length===4?[Math.max(-180,s[0]),Math.max(-90,s[1]),Math.min(180,s[2]),Math.min(90,s[3])]:[-180,-90,180,90]}contains(s){let u=Math.pow(2,s.z),f=Math.floor(r.O(this.bounds.getWest())*u),g=Math.floor(r.Q(this.bounds.getNorth())*u),v=Math.ceil(r.O(this.bounds.getEast())*u),A=Math.ceil(r.Q(this.bounds.getSouth())*u);return s.x>=f&&s.x<v&&s.y>=g&&s.y<A}}class Ha extends r.E{constructor(s,u,f,g){if(super(),this.id=s,this.dispatcher=f,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,r.e(this,r.M(u,["url","scheme","tileSize","promoteId"])),this._options=r.e({type:"vector"},u),this._collectResourceTiming=u.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(g)}load(){return r._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new r.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let s=yield Hs(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),s&&(r.e(this,s),s.bounds&&(this.tileBounds=new gr(s.bounds,this.minzoom,this.maxzoom)),this.fire(new r.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new r.k("data",{dataType:"source",sourceDataType:"content"})))}catch(s){this._tileJSONRequest=null,this.fire(new r.j(s))}})}loaded(){return this._loaded}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}onAdd(s){this.map=s,this.load()}setSourceProperty(s){this._tileJSONRequest&&this._tileJSONRequest.abort(),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return r.e({},this._options)}loadTile(s){return r._(this,void 0,void 0,function*(){let u=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),f={request:this.map._requestManager.transformRequest(u,"Tile"),uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,tileSize:this.tileSize*s.tileID.overscaleFactor(),type:this.t
21ype,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};f.request.collectResourceTiming=this._collectResourceTiming;let g="RT";if(s.actor&&s.state!=="expired"){if(s.state==="loading")return new Promise((v,A)=>{s.reloadPromise={resolve:v,reject:A}})}else s.actor=this.dispatcher.getActor(),g="LT";s.abortController=new AbortController;try{let v=yield s.actor.sendAsync({type:g,data:f},s.abortController);if(delete s.abortController,s.aborted)return;this._afterTileLoadWorkerResponse(s,v)}catch(v){if(delete s.abortController,s.aborted)return;if(v&&v.status!==404)throw v;this._afterTileLoadWorkerResponse(s,null)}})}_afterTileLoadWorkerResponse(s,u){if(u&&u.resourceTiming&&(s.resourceTiming=u.resourceTiming),u&&this.map._refreshExpiredTiles&&s.setExpiryData(u),s.loadVectorData(u,this.map.painter),s.reloadPromise){let f=s.reloadPromise;s.reloadPromise=null,this.loadTile(s).then(f.resolve).catch(f.reject)}}abortTile(s){return r._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.actor&&(yield s.actor.sendAsync({type:"AT",data:{uid:s.uid,type:this.t
21ype,source:this.id}}))})}unloadTile(s){return r._(this,void 0,void 0,function*(){s.unloadVectorData(),s.actor&&(yield s.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class bi extends r.E{constructor(s,u,f,g){super(),this.id=s,this.dispatcher=f,this.setEventedParent(g),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=r.e({type:"raster"},u),r.e(this,r.M(u,["url","scheme","tileSize"]))}load(){return r._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new r.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let s=yield Hs(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,s&&(r.e(this,s),s.bounds&&(this.tileBounds=new gr(s.bounds,this.minzoom,this.maxzoom)),this.fire(new r.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new r.k("data",{dataType:"source",sourceDataType:"content"})))}catch(s){this._tileJSONRequest=null,this.fire(new r.j(s))}})}loaded(){return this._loaded}onAdd(s){this.map=s,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(s){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}serialize(){return r.e({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s){return r._(this,void 0,void 0,function*(){let u=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);s.abortController=new AbortController;try{let f=yield le.getImage(this.map._requestManager.transformRequest(u,"Tile"),s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(f&&f.data){this.map._refreshExpiredTiles&&f.cacheControl&&f.expires&&s.setExpiryData({cacheControl:f.cacheControl,expires:f.expires});let g=this.map.painter.context,v=g.gl,A=f.data;s.texture=this.map.painter.getTileTexture(A.width),s.texture?s.texture.update(A,{useMipmap:!0}):(s.texture=new at(g,A,v.RGBA,{useMipmap:!0}),s.texture.bind(v.LINEAR,v.CLAMP_TO_EDGE,v.LINEAR_MIPMAP_NEAREST)),s.state="loaded"}}catch(f){if(delete s.abortController,s.aborted)s.state="unloaded";else if(f)throw s.state="errored",f}})}abortTile(s){return r._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController)})}unloadTile(s){return r._(this,void 0,void 0,function*(){s.texture&&this.map.painter.saveTileTexture(s.texture)})}hasTransition(){return!1}}class Ui extends bi{constructor(s,u,f,g){super(s,u,f,g),this.type="raster-dem",this.maxzoom=22,this._options=r.e({type:"raster-dem"},u),this.encoding=u.encoding||"mapbox",this.redFactor=u.redFactor,this.greenFactor=u.greenFactor,this.blueFactor=u.blueFactor,this.baseShift=u.baseShift}loadTile(s){return r._(this,void 0,void 0,function*(){let u=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),f=this.map._requestManager.transformRequest(u,"Tile");s.neighboringTiles=this._getNeighboringTiles(s.tileID),s.abortController=new AbortController;try{let g=yield le.getImage(f,s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(g&&g.data){let v=g.data;this.map._refreshExpiredTiles&&g.cacheControl&&g.expires&&s.setExpiryData({cacheControl:g.cacheControl,expires:g.expires});let A=r.b(v)&&r.U()?v:yield this.readImageNow(v),I={type:this.type,uid:s.uid,source:this.id,rawImageData:A,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!s.actor||s.state==="expired"){s.actor=this.dispatcher.getActor();let L=yield s.actor.sendAsync({type:"LDT",data:I});s.dem=L,s.needsHillshadePrepare=!0,s.needsTerrainPrepare=!0,s.state="loaded"}}}catch(g){if(delete s.abortController,s.aborted)s.state="unloaded";else if(g)throw s.state="errored",g}})}readImageNow(s){return r._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&r.V()){let u=s.width+2,f=s.height+2;try{return new r.R({width:u,height:f},yield r.W(s,-1,-1,u,f))}catch{}}return T.getImageData(s,1)})}_getNeighboringTiles(s){let u=s.canonical,f=Math.pow(2,u.z),g=(u.x-1+f)%f,v=u.x===0?s.wrap-1:s.wrap,A=(u.x+1+f)%f,I=u.x+1===f?s.wrap+1:s.wrap,L={};return L[new r.S(s.overscaledZ,v,u.z,g,u.y).key]={backfilled:!1},L[new r.S(s.overscaledZ,I,u.z,A,u.y).key]={backfilled:!1},u.y>0&&(L[new r.S(s.overscaledZ,v,u.z,g,u.y-1).key]={backfilled:!1},L[new r.S(s.overscaledZ,s.wrap,u.z,u.x,u.y-1).key]={backfilled:!1},L[new r.S(s.overscaledZ,I,u.z,A,u.y-1).key]={backfilled:!1}),u.y+1<f&&(L[new r.S(s.overscaledZ,v,u.z,g,u.y+1).key]={backfilled:!1},L[new r.S(s.overscaledZ,s.wrap,u.z,u.x,u.y+1).key]={backfilled:!1},L[new r.S(s.overscaledZ,I,u.z,A,u.y+1).key]={backfilled:!1}),L}unloadTile(s){return r._(this,void 0,void 0,function*(){s.demTexture&&this.map.painter.saveTileTexture(s.demTexture),s.fbo&&(s.fbo.destroy(),delete s.fbo),s.dem&&delete s.dem,delete s.neighboringTiles,s.state="unloaded",s.actor&&(yield s.actor.sendAsync({type:"RDT",data:{type:this.t
21ype,uid:s.uid,source:this.id}}))})}}class yr extends r.E{constructor(s,u,f,g){super(),this.id=s,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=f.getActor(),this.setEventedParent(g),this._data=u.data,this._options=r.e({},u),this._collectResourceTiming=u.collectResourceTiming,u.maxzoom!==void 0&&(this.maxzoom=u.maxzoom),u.type&&(this.type=u.type),u.attribution&&(this.attribution=u.attribution),this.promoteId=u.promoteId;let v=r.X/this.tileSize;u.clusterMaxZoom!==void 0&&this.maxzoom<=u.clusterMaxZoom&&r.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${u.clusterMaxZoom}".`),this.workerOptions=r.e({source:this.id,cluster:u.cluster||!1,geojsonVtOptions:{buffer:(u.buffer!==void 0?u.buffer:128)*v,tolerance:(u.tolerance!==void 0?u.tolerance:.375)*v,extent:r.X,maxZoom:this.maxzoom,lineMetrics:u.lineMetrics||!1,generateId:u.generateId||!1},superclusterOptions:{maxZoom:u.clusterMa
21xZoom!==void 0?u.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,u.clusterMinPoints||2),extent:r.X,radius:(u.clusterRadius||50)*v,log:!1,generateId:u.generateId||!1},clusterProperties:u.clusterProperties,filter:u.filter},u.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return r._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(s){this.map=s,this.load()}setData(s){return this._data=s,this._updateWorkerData(),this}updateData(s){return this._updateWorkerData(s),this}getData(){return r._(this,void 0,void 0,function*(){let s=r.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:s})})}setClusterOptions(s){return this.workerOptions.cluster=s.cluster,s&&(s.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=s.clusterRadius),s.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=s.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(s){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:s,source:this.id}})}getClusterChildren(s){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:s,source:this.id}})}getClusterLeaves(s,u,f){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:s,limit:u,offset:f}})}_updateWorkerData(s){return r._(this,void 0,void 0,function*(){let u=r.e({type:this.type},this.workerOptions);
21s?u.dataDiff=s:typeof this._data=="string"?(u.request=this.map._requestManager.transformRequest(T.resolveURL(this._data),"Source"),u.request.collectResourceTiming=this._collectResourceTiming):u.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new r.k("dataloading",{dataType:"source"}));try{let f=yield this.actor.sendAsync({type:"LD",data:u});if(this._pendingLoads--,this._removed||f.abandoned)return void this.fire(new r.k("dataabort",{dataType:"source"}));let g=null;f.resourceTiming&&f.resourceTiming[this.id]&&(g=f.resourceTiming[this.id].slice(0));let v={dataType:"source"};this._collectResourceTiming&&g&&g.length>0&&r.e(v,{resourceTiming:g}),this.fire(new r.k("data",Object.assign(Object.assign({},v),{sourceDataType:"metadata"}))),this.fire(new r.k("data",Object.assign(Object.assign({},v),{sourceDataType:"content"})))}catch(f){if(this._pendingLoads--,this._removed)return void this.fire(new r.k("dataabort",{dataType:"source"}));this.fire(new r.j(f))}})}loaded(){return this._pendingLoads===0}loadTile(s){return r._(this,void 0,void 0,function*(){let u=s.actor?"RT":"LT";s.actor=this.actor;let f={type:this.type,uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};s.abortController=new AbortController;let g=yield this.actor.sendAsync({type:u,data:f},s.abortController);delete s.abortController,s.unloadVectorData(),s.aborted||s.loadVectorData(g,this.map.painter,u==="RT")})}abortTile(s){return r._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.aborted=!0})}unloadTile(s){return r._(this,void 0,void 0,function*(){s.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.t
21ype,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return r.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var es=r.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class ts extends r.E{constructor(s,u,f,g){super(),this.id=s,this.dispatcher=f,this.coordinates=u.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(g),this.options=u}load(s){return r._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new r.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let u=yield le.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,u&&u.data&&(this.image=u.data,s&&(this.coordinates=s),this._finishLoading())}catch(u){this._request=null,this._loaded=!0,this.fire(new r.j(u))}})}loaded(){return this._loaded}updateImage(s){return s.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=s.url,this.load(s.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new r.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(s){this.map=s,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(s){this.coordinates=s;let u=s.map(r.Z.fromLngLat);this.tileID=function(g){let v=1/0,A=1/0,I=-1/0,L=-1/0;for(let G of g)v=Math.min(v,G.x),A=Math.min(A,G.y),I=Math.max(I,G.x),L=Math.max(L,G.y);let O=Math.max(I-v,L-A),N=Math.max(0,Math.floor(-Math.log(O)/Math.LN2)),V=Math.pow(2,N);return new r.a1(N,Math.floor((v+I)/2*V),Math.floor((A+L)/2*V))}(u),this.minzoom=this.maxzoom=this.tileID.z;let f=u.map(g=>this.tileID.getTilePoint(g)._round());return this._boundsArray=new r.$,this._boundsArray.emplaceBack(f[0].x,f[0].y,0,0),this._boundsArray.emplaceBack(f[1].x,f[1].y,r.X,0),this._boundsArray.emplaceBack(f[3].x,f[3].y,0,r.X),this._boundsArray.emplaceBack(f[2].x,f[2].y,r.X,r.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new r.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let s=this.map.painter.context,u=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,es.members)),this.boundsSegments||(this.boundsSegments=r.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new at(s,this.image,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));let f=!1;for(let g in this.tiles){let v=this.tiles[g];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,f=!0)}f&&this.fire(new r.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(s){return r._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(s.tileID.canonical)?(this.tiles[String(s.tileID.wrap)]=s,s.buckets={}):s.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Wa extends ts{constructor(s,u,f,g){super(s,u,f,g),this.roundZoom=!0,this.type="video",this.options=u}load(){return r._(this,void 0,void 0,function*(){this._loaded=!1;let s=this.options;this.urls=[];for(let u of s.urls)this.urls.push(this.map._requestManager.transformRequest(u,"Source").url);try{let u=yield r.a3(this.urls);if(this._loaded=!0,!u)return;this.video=u,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(u){this.fire(new r.j(u))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(s){if(this.video){let u=this.video.seekable;s<u.start(0)||s>u.end(0)?this.fire(new r.j(new r.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${u.start(0)} and ${u.end(0)}-second mark.`))):this.video.currentTime=s}}getVideo(){return this.video}
21onAdd(s){this.map||(this.map=s,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let s=this.map.painter.context,u=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,es.members)),this.boundsSegments||(this.boundsSegments=r.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE),u.texSubImage2D(u.TEXTURE_2D,0,0,0,u.RGBA,u.UNSIGNED_BYTE,this.video)):(this.texture=new at(s,this.video,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));let f=!1;for(let g in this.tiles){let v=this.tiles[g];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,f=!0)}f&&this.fire(new r.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class ir extends ts{constructor(s,u,f,g){super(s,u,f,g),u.coordinates?Array.isArray(u.coordinates)&&u.coordinates.length===4&&!u.coordinates.some(v=>!Array.isArray(v)||v.length!==2||v.some(A=>typeof A!="number"))||this.fire(new r.j(new r.a2(`sources.${s}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new r.j(new r.a2(`sources.${s}`,null,'missing required property "coordinates"'))),u.animate&&typeof u.animate!="boolean"&&this.fire(new r.j(new r.a2(`sources.${s}`,null,'optional "animate" property must be a boolean value'))),u.canvas?typeof u.canvas=="string"||u.canvas instanceof HTMLCanvasElement||this.fire(new r.j(new r.a2(`sources.${s}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new r.j(new r.a2(`sources.${s}`,null,'missing required property "canvas"'))),this.options=u,this.animate=u.animate===void 0||u.animate}load(){return r._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new r.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(s){this.map=s,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let s=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,s=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,s=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let u=this.map.painter.context,f=u.gl;this.boundsBuffer||(this.boundsBuffer=u.createVertexBuffer(this._boundsArray,es.members)),this.boundsSegments||(this.boundsSegments=r.a0.simpleSegment(0,0,4,2)),this.texture?(s||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new at(u,this.canvas,f.RGBA,{premultiply:!0});let g=!1;for(let v in this.tiles){let A=this.tiles[v];A.state!=="loaded"&&(A.state="loaded",A.texture=this.texture,g=!0)}g&&this.fire(new r.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let s of[this.canvas.width,this.canvas.height])if(isNaN(s)||s<=0)return!0;return!1}}let Vl={},ao=x=>{switch(x){case"geojson":return yr;case"image":return ts;case"raster":return bi;case"raster-dem":return Ui;case"vector":return Ha;case"video":return Wa;case"canvas":return ir}return Vl[x]},Ge="RTLPluginLoaded";class is extends r.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Io()}_syncState(s){return this.status=s,this.dispatcher.broadcast("SRPS",{pluginStatus:s,pluginURL:this.url}).catch(u=>{throw this.status="error",u})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(s){return r._(this,arguments,void 0,function*(u,f=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=T.resolveURL(u),!this.url)throw new Error(`requested url ${u}
21 is invalid`);if(this.status==="unavailable"){if(!f)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return r._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new r.k(Ge))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Gn=null;function ns(){return Gn||(Gn=new is),Gn}class Ws{constructor(s,u){this.timeAdded=0,this.fadeEndTime=0,this.tileID=s,this.uid=r.a4(),this.uses=0,this.tileSize=u,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(s){let u=s+this.timeAdded;u<this.fadeEndTime||(this.fadeEndTime=u)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(s){this.demTexture&&s.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(s,u,f){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",s){s.featureIndex&&(this.latestFeatureIndex=s.featureIndex,s.rawTileData?(this.latestRawTileData=s.rawTileData,this.latestFeatureIndex.rawTileData=s.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=s.collisionBoxArray,this.buckets=function(g,v){let A={};if(!v)return A;for(let I of g){let L=I.layerIds.map(O=>v.getLayer(O)).filter(Boolean);if(L.length!==0){I.layers=L,I.stateDependentLayerIds&&(I.stateDependentLayers=I.stateDependentLayerIds.map(O=>L.filter(N=>N.id===O)[0]));for(let O of L)A[O.id]=I}}return A}(s.buckets,u.style),this.hasSymbolBuckets=!1;for(let g in this.buckets){let v=this.buckets[g];if(v instanceof r.a6){if(this.hasSymbolBuckets=!0,!f)break;v.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let g in this.buckets){let v=this.buckets[g];if(v instanceof r.a6&&v.hasRTLText){this.hasRTLText=!0,ns().lazyLoad();break}}this.queryPadding=0;for(let g in this.buckets){let v=this.buckets[g];this.queryPadding=Math.max(this.queryPadding,u.style.getLayer(g).queryRadius(v))}s.imageAtlas&&(this.imageAtlas=s.imageAtlas),s.glyphAtlasImage&&(this.glyphAtlasImage=s.glyphAtlasImage)}else this.collisionBoxArray=new r.a5}unloadVectorData(){for(let s in this.buckets)this.buckets[s].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(s){return this.buckets[s.id]}upload(s){for(let f in this.buckets){let g=this.buckets[f];g.uploadPending()&&g.upload(s)}let u=s.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new at(s,this.imageAtlas.image,u.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new at(s,this.glyphAtlasImage,u.ALPHA),this.glyphAtlasImage=null)}prepare(s){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(s,this.imageAtlasTexture)}queryRenderedFeatures(s,u,f,g,v,A,I,L,O,N){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:g,cameraQueryGeometry:v,scale:A,tileSize:this.tileSize,pixelPosMatrix:N,transform:L,params:I,queryPadding:this.queryPadding*O},s,u,f):{}}querySourceFeatures(s,u){let f=this.latestFeatureIndex;if(!f||!f.rawTileData)return;let g=f.loadVTLayers(),v=u&&u.sourceLayer?u.sourceLayer:"",A=g._geojsonTileLayer||g[v];if(!A)return;let I=r.a7(u&&u.filter),{z:L,x:O,y:N}=this.tileID.canonical,V={z:L,x:O,y:N};for(let G=0;G<A.length;G++){let Q=A.feature(G);if(I.needGeometry){let he=r.a8(Q,!0);if(!I.filter(new r.z(this.tileID.overscaledZ),he,this.tileID.canonical))continue}else if(!I.filter(new r.z(this.tileID.overscaledZ),Q))continue;let ne=f.getId(Q,v),ae=new r.a9(Q,L,O,N,ne);ae.tile=V,s.push(ae)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(s){let u=this.expirationTime;if(s.cacheControl){let f=r.aa(s.cacheControl);f["max-age"]&&(this.expirationTime=Date.now()+1e3*f["max-age"])}else s.expires&&(this.expirationTime=new Date(s.expires).getTime());
21if(this.expirationTime){let f=Date.now(),g=!1;if(this.expirationTime>f)g=!1;else if(u)if(this.expirationTime<u)g=!0;else{let v=this.expirationTime-u;v?this.expirationTime=f+Math.max(v,3e4):g=!0}else g=!0;g?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(s,u){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(s).length===0)return;let f=this.latestFeatureIndex.loadVTLayers();for(let g in this.buckets){if(!u.style.hasLayer(g))continue;let v=this.buckets[g],A=v.layers[0].sourceLayer||"_geojsonTileLayer",I=f[A],L=s[A];if(!I||!L||Object.keys(L).length===0)continue;v.update(L,I,this.imageAtlas&&this.imageAtlas.patternPositions||{});let O=u&&u.style&&u.style.getLayer(g);O&&(this.queryPadding=Math.max(this.queryPadding,O.queryRadius(v)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<T.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(s){this.symbolFadeHoldUntil=T.now()+s}
21setDependencies(s,u){let f={};for(let g of u)f[g]=!0;this.dependencies[s]=f}hasDependency(s,u){for(let f of s){let g=this.dependencies[f];if(g){for(let v of u)if(g[v])return!0}}return!1}}class et{constructor(s,u){this.max=s,this.onRemove=u,this.reset()}reset(){for(let s in this.data)for(let u of this.data[s])u.timeout&&clearTimeout(u.timeout),this.onRemove(u.value);return this.data={},this.order=[],this}add(s,u,f){let g=s.wrapped().key;this.data[g]===void 0&&(this.data[g]=[]);let v={value:u,timeout:void 0};if(f!==void 0&&(v.timeout=setTimeout(()=>{this.remove(s,v)},f)),this.data[g].push(v),this.order.push(g),this.order.length>this.max){let A=this._getAndRemoveByKey(this.order[0]);A&&this.onRemove(A)}return this}has(s){return s.wrapped().key in this.data}getAndRemove(s){return this.has(s)?this._getAndRemoveByKey(s.wrapped().key):null}_getAndRemoveByKey(s){let u=this.data[s].shift();return u.timeout&&clearTimeout(u.timeout),this.data[s].length===0&&delete this.data[s],this.order.splice(this.order.indexOf(s),1),u.value}getByKey(s){let u=this.data[s];return u?u[0].value:null}get(s){return this.has(s)?this.data[s.wrapped().key][0].value:null}remove(s,u){if(!this.has(s))return this;let f=s.wrapped().key,g=u===void 0?0:this.data[f].indexOf(u),v=this.data[f][g];return this.data[f].splice(g,1),v.timeout&&clearTimeout(v.timeout),this.data[f].length===0&&delete this.data[f],this.onRemove(v.value),this.order.splice(this.order.indexOf(f),1),this}setMaxSize(s){for(this.max=s;this.order.length>this.max;){let u=this._getAndRemoveByKey(this.order[0]);u&&this.onRemove(u)}return this}filter(s){let u=[];for(let f in this.data)for(let g of this.data[f])s(g.value)||u.push(g);for(let f of u)this.remove(f.value.tileID,f)}}class Wt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(s,u,f){let g=String(u);if(this.stateChanges[s]=this.stateChanges[s]||{},this.stateChanges[s][g]=this.stateChanges[s][g]||{},r.e(this.stateChanges[s][g],f),this.deletedStates[s]===null){this.deletedStates[s]={};for(let v in this.state[s])v!==g&&(this.deletedStates[s][v]=null)}else if(this.deletedStates[s]&&this.deletedStates[s][g]===null){this.deletedStates[s][g]={};for(let v in this.state[s][g])f[v]||(this.deletedStates[s][g][v]=null)}else for(let v in f)this.deletedStates[s]&&this.deletedStates[s][g]&&this.deletedStates[s][g][v]===null&&delete this.deletedStates[s][g][v]}removeFeatureState(s,u,f){if(this.deletedStates[s]===null)return;let g=String(u);if(this.deletedStates[s]=this.deletedStates[s]||{},f&&u!==void 0)this.deletedStates[s][g]!==null&&(this.deletedStates[s][g]=this.deletedStates[s][g]||{},this.deletedStates[s][g][f]=null);else if(u!==void 0)if(this.stateChanges[s]&&this.stateChanges[s][g])for(f in this.deletedStates[s][g]={},this.stateChanges[s][g])this.deletedStates[s][g][f]=null;else this.deletedStates[s][g]=null;else this.deletedStates[s]=null}getState(s,u){let f=String(u),g=r.e({},(this.state[s]||{})[f],(this.stateChanges[s]||{})[f]);if(this.deletedStates[s]===null)return{};if(this.deletedStates[s]){let v=this.deletedStates[s][u];if(v===null)return{};for(let A in v)delete g[A]}return g}initializeTileState(s,u){s.setFeatureState(this.state,u)}coalesceChanges(s,u){let f={};for(let g in this.stateChanges){this.state[g]=this.state[g]||{};let v={};for(let A in this.stateChanges[g])this.state[g][A]||(this.state[g][A]={}),r.e(this.state[g][A],this.stateChanges[g][A]),v[A]=this.state[g][A];f[g]=v}for(let g in this.deletedStates){this.state[g]=this.state[g]||{};let v={};if(this.deletedStates[g]===null)for(let A in this.state[g])v[A]={},this.state[g][A]={};else for(let A in this.deletedStates[g]){if(this.deletedStates[g][A]===null)this.state[g][A]={};else for(let I of Object.keys(this.deletedStates[g][A]))delete this.state[g][A][I];v[A]=this.state[g][A]}f[g]=f[g]||{},r.e(f[g],v)}if(this.stateChanges={},this.deletedStates={},Object.keys(f).length!==0)for(let g in s)s[g].setFeatureState(f,u)}}class Et extends r.E{constructor(s,u,f){super(),this.id=s,this.dispatcher=f,this.on("data",g=>this._dataHandler(g)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((g,v,A,I)=>{let L=new(ao(v.type))(g,v,A,I);if(L.id!==g)throw new Error(`Expected Source id to be ${g} instead of ${L.id}`);return L})(s,u,f,this),this._tiles={},this._cache=new et(0,g=>this._unloadTile(g)),this._timers={},this._cacheTimers={}
21,this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Wt,this._didEmitContent=!1,this._updated=!1}onAdd(s){this.map=s,this._maxTileCacheSize=s?s._maxTileCacheSize:null,this._maxTileCacheZoomLevels=s?s._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(s)}onRemove(s){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(s)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let s in this._tiles){let u=this._tiles[s];if(u.state!=="loaded"&&u.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let s=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,s&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(s,u,f){return r._(this,void 0,void 0,function*(){try{yield this._source.loadTile(s),this._tileLoaded(s,u,f)}catch(g){s.state="errored",g.status!==404?this._source.fire(new r.j(g,{tile:s})):this.update(this.transform,this.terrain)}})}_unloadTile(s){this._source.unloadTile&&this._source.unloadTile(s)}_abortTile(s){this._source.abortTile&&this._source.abortTile(s),this._source.fire(new r.k("dataabort",{tile:s,coord:s.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(s){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let u in this._tiles){let f=this._tiles[u];f.upload(s),f.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(s=>s.tileID).sort(nr).map(s=>s.key)}getRenderableIds(s){let u=[];for(let f in this._tiles)this._isIdRenderable(f,s)&&u.push(this._tiles[f]);return s?u.sort((f,g)=>{let v=f.tileID,A=g.tileID,I=new r.P(v.canonical.x,v.canonical.y)._rotate(this.transform.angle),L=new r.P(A.canonical.x,A.canonical.y)._rotate(this.transform.angle);return v.overscaledZ-A.overscaledZ||L.y-I.y||L.x-I.x}).map(f=>f.tileID.key):u.map(f=>f.tileID).sort(nr).map(f=>f.key)}hasRenderableParent(s){let u=this.findLoadedParent(s,0);return!!u&&this._isIdRenderable(u.tileID.key)}_isIdRenderable(s,u){return this._tiles[s]&&this._tiles[s].hasData()&&!this._coveredTiles[s]&&(u||!this._tiles[s].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let s in this._tiles)this._tiles[s].state!=="errored"&&this._reloadTile(s,"reloading")}}_reloadTile(s,u){return r._(this,void 0,void 0,function*(){let f=this._tiles[s];f&&(f.state!=="loading"&&(f.state=u),yield this._loadTile(f,s,u))})}_tileLoaded(s,u,f){s.timeAdded=T.now(),f==="expired"&&(s.refreshedUponExpiration=!0),this._setTileReloadTimer(u,s),this.getSource().type==="raster-dem"&&s.dem&&this._backfillDEM(s),this._state.initializeTileState(s,this.map?this.map.painter:null),s.aborted||this._source.fire(new r.k("data",{dataType:"source",tile:s,coord:s.tileID}))}_backfillDEM(s){let u=this.getRenderableIds();for(let g=0;g<u.length;g++){let v=u[g];if(s.neighboringTiles&&s.neighboringTiles[v]){let A=this.getTileByID(v);f(s,A),f(A,s)}}function f(g,v){g.needsHillshadePrepare=!0,g.needsTerrainPrepare=!0;let A=v.tileID.canonical.x-g.tileID.canonical.x,I=v.tileID.canonical.y-g.tileID.canonical.y,L=Math.pow(2,g.tileID.canonical.z),O=v.tileID.key;A===0&&I===0||Math.abs(I)>1||(Math.abs(A)>1&&(Math.abs(A+L)===1?A+=L:Math.abs(A-L)===1&&(A-=L)),v.dem&&g.dem&&(g.dem.backfillBorder(v.dem,A,I),g.neighboringTiles&&g.neighboringTiles[O]&&(g.neighboringTiles[O].backfilled=!0)))}}getTile(s){return this.getTileByID(s.key)}getTileByID(s){return this._tiles[s]}_retainLoadedChildren(s,u,f,g){for(let v in this._tiles){let A=this._tiles[v];if(g[v]||!A.hasData()||A.tileID.overscaledZ<=u||A.tileID.overscaledZ>f)continue;let I=A.tileID;for(;A&&A.tileID.overscaledZ>u+1;){let O=A.tileID.scaledTo(A.tileID.overscaledZ-1);A=this._tiles[O.key],A&&A.hasData()&&(I=O)}let L=I;for(;L.overscaledZ>u;)if(L=L.scaledTo(L.overscaledZ-1),s[L.key]){g[I.key]=I;break}}}findLoadedParent(s,u){if(s.key in this._loadedParentTiles){let f=this._loadedParentTiles[s.key];return f&&f.tileID.overscaledZ>=u?f:null}for(let f=s.overscaledZ-1;f>=u;f--){let g=s.scaledTo(f),v=this._getLoadedTile(g);if(v)return v}}findLoadedSibling(s){return this._getLoadedTile(s)}_getLoadedTile(s){let u=this._tiles[s.key];return u&&u.hasData()?u:this._cache.getByKey(s.wrapped().key)}updateCacheSize(s){let u=Math.ceil(s.width/this._source.tileSize)+1,f=Math.ceil(s.height/this._source.tileSize)+1,g=Math.floor(u*f*(this._maxTileC
21acheZoomLevels===null?r.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),v=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,g):g;this._cache.setMaxSize(v)}handleWrapJump(s){let u=Math.round((s-(this._prevLng===void 0?s:this._prevLng))/360);if(this._prevLng=s,u){let f={};for(let g in this._tiles){let v=this._tiles[g];v.tileID=v.tileID.unwrapTo(v.tileID.wrap+u),f[v.tileID.key]=v}this._tiles=f;for(let g in this._timers)clearTimeout(this._timers[g]),delete this._timers[g];for(let g in this._tiles)this._setTileReloadTimer(g,this._tiles[g])}}_updateCoveredAndRetainedTiles(s,u,f,g,v,A){let I={},L={},O=Object.keys(s),N=T.now();for(let V of O){let G=s[V],Q=this._tiles[V];if(!Q||Q.fadeEndTime!==0&&Q.fadeEndTime<=N)continue;let ne=this.findLoadedParent(G,u),ae=this.findLoadedSibling(G),he=ne||ae||null;he&&(this._addTile(he.tileID),I[he.tileID.key]=he.tileID),L[V]=G}this._retainLoadedChildren(L,g,f,s);for(let V in I)s[V]||(this._coveredTiles[V]=!0,s[V]=I[V]);if(A){let V={},G={};for(let Q of v)this._tiles[Q.key].hasData()?V[Q.key]=Q:G[Q.key]=Q;for(let Q in G){let ne=G[Q].children(this._source.maxzoom);this._tiles[ne[0].key]&&this._tiles[ne[1].key]&&this._tiles[ne[2].key]&&this._tiles[ne[3].key]&&(V[ne[0].key]=s[ne[0].key]=ne[0],V[ne[1].key]=s[ne[1].key]=ne[1],V[ne[2].key]=s[ne[2].key]=ne[2],V[ne[3].key]=s[ne[3].key]=ne[3],delete G[Q])}for(let Q in G){let ne=G[Q],ae=this.findLoadedParent(ne,this._source.minzoom),he=this.findLoadedSibling(ne),de=ae||he||null;if(de){V[de.tileID.key]=s[de.tileID.key]=de.tileID;for(let me in V)V[me].isChildOf(de.tileID)&&delete V[me]}}for(let Q in this._tiles)V[Q]||(this._coveredTiles[Q]=!0)}}update(s,u){if(!this._sourceLoaded||this._paused)return;let f;this.transform=s,this.terrain=u,this.updateCacheSize(s),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?f=s.getVisibleUnwrappedCoordinates(this._source.tileID).map(N=>new r.S(N.canonical.z,N.wrap,N.canonical.z,N.canonical.x,N.canonical.y)):(f=s.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:u}),this._source.hasTile&&(f=f.filter(N=>this._source.hasTile(N)))):f=[];let g=s.coveringZoomLevel(this._source),v=Math.max(g-Et.maxOverzooming,this._source.minzoom),A=Math.max(g+Et.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let N={};for(let V of f)if(V.canonical.z>this._source.minzoom){let G=V.scaledTo(V.canonical.z-1);N[G.key]=G;let Q=V.scaledTo(Math.max(this._source.minzoom,Math.min(V.canonical.z,5)));N[Q.key]=Q}f=f.concat(Object.values(N))}let I=f.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,I&&this.fire(new r.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let L=this._updateRetainedTiles(f,g);Fr(this._source.type)&&this._updateCoveredAndRetainedTiles(L,v,A,g,f,u);for(let N in L)this._tiles[N].clearFadeHold();let O=r.ab(this._tiles,L);for(let N of O){let V=this._tiles[N];V.hasSymbolBuckets&&!V.holdingForFade()?V.setHoldDuration(this.map._fadeDuration):V.hasSymbolBuckets&&!V.symbolFadeFinished()||this._removeTile(N)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let s in this._tiles)this._tiles[s].holdingForFade()&&this._removeTile(s)}_updateRetainedTiles(s,u){var f;let g={},v={},A=Math.max(u-Et.maxOverzooming,this._source.minzoom),I=Math.max(u+Et.maxUnderzooming,this._source.minzoom),L={};for(let O of s){let N=this._addTile(O);g[O.key]=O,N.hasData()||u<this._source.maxzoom&&(L[O.key]=O)}this._retainLoadedChildren(L,u,I,g);for(let O of s){let N=this._tiles[O.key];if(N.hasData())continue;if(u+1>this._source.maxzoom){let G=O.children(this._source.maxzoom)[0],Q=this.getTile(G);if(Q&&Q.hasData()){g[G.key]=G;continue}}else{let G=O.children(this._source.maxzoom);if(g[G[0].key]&&g[G[1].key]&&g[G[2].key]&&g[G[3].key])continue}let V=N.wasRequested();for(let G=O.overscaledZ-1;G>=A;--G){let Q=O.scaledTo(G);if(v[Q.key])break;if(v[Q.key]=!0,N=this.getTile(Q),!N&&V&&(N=this._addTile(Q)),N){let ne=N.hasData();if((ne||!(!((f=this.map)===null||f===void 0)&&f.cancelPendingTileRequestsWhileZooming)||V)&&(g[Q.key]=Q),V=N.wasRequested(),ne)break}}}return g}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let s in this._tiles){let u=[],f,g=this._tiles[s].tileID;for(;g.overscaledZ>0;
21){if(g.key in this._loadedParentTiles){f=this._loadedParentTiles[g.key];break}u.push(g.key);let v=g.scaledTo(g.overscaledZ-1);if(f=this._getLoadedTile(v),f)break;g=v}for(let v of u)this._loadedParentTiles[v]=f}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(let s in this._tiles){let u=this._tiles[s].tileID,f=this._getLoadedTile(u);this._loadedSiblingTiles[u.key]=f}}_addTile(s){let u=this._tiles[s.key];if(u)return u;u=this._cache.getAndRemove(s),u&&(this._setTileReloadTimer(s.key,u),u.tileID=s,this._state.initializeTileState(u,this.map?this.map.painter:null),this._cacheTimers[s.key]&&(clearTimeout(this._cacheTimers[s.key]),delete this._cacheTimers[s.key],this._setTileReloadTimer(s.key,u)));let f=u;return u||(u=new Ws(s,this._source.tileSize*s.overscaleFactor()),this._loadTile(u,s.key,u.state)),u.uses++,this._tiles[s.key]=u,f||this._source.fire(new r.k("dataloading",{tile:u,coord:u.tileID,dataType:"source"})),u}_setTileReloadTimer(s,u){s in this._timers&&(clearTimeout(this._timers[s]),delete this._timers[s]);let f=u.getExpiryTimeout();f&&(this._timers[s]=setTimeout(()=>{this._reloadTile(s,"expired"),delete this._timers[s]},f))}_removeTile(s){let u=this._tiles[s];u&&(u.uses--,delete this._tiles[s],this._timers[s]&&(clearTimeout(this._timers[s]),delete this._timers[s]),u.uses>0||(u.hasData()&&u.state!=="reloading"?this._cache.add(u.tileID,u,u.getExpiryTimeout()):(u.aborted=!0,this._abortTile(u),this._unloadTile(u))))}_dataHandler(s){let u=s.sourceDataType;s.dataType==="source"&&u==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&s.dataType==="source"&&u==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let s in this._tiles)this._removeTile(s);this._cache.reset()}tilesIn(s,u,f){let g=[],v=this.transform;if(!v)return g;let A=f?v.getCameraQueryGeometry(s):s,I=s.map(ne=>v.pointCoordinate(ne,this.terrain)),L=A.map(ne=>v.pointCoordinate(ne,this.terrain)),O=this.getIds(),N=1/0,V=1/0,G=-1/0,Q=-1/0;for(let ne of L)N=Math.min(N,ne.x),V=Math.min(V,ne.y),G=Math.max(G,ne.x),Q=Math.max(Q,ne.y);for(let ne=0;ne<O.length;ne++){let ae=this._tiles[O[ne]];if(ae.holdingForFade())continue;let he=ae.tileID,de=Math.pow(2,v.zoom-ae.tileID.overscaledZ),me=u*ae.queryPadding*r.X/ae.tileSize/de,re=[he.getTilePoint(new r.Z(N,V)),he.getTilePoint(new r.Z(G,Q))];if(re[0].x-me<r.X&&re[0].y-me<r.X&&re[1].x+me>=0&&re[1].y+me>=0){let ve=I.map(Ae=>he.getTilePoint(Ae)),xe=L.map(Ae=>he.getTilePoint(Ae));g.push({tile:ae,tileID:he,queryGeometry:ve,cameraQueryGeometry:xe,scale:de})}}return g}getVisibleCoordinates(s){let u=this.getRenderableIds(s).map(f=>this._tiles[f].tileID);for(let f of u)f.posMatrix=this.transform.calculatePosMatrix(f.toUnwrapped());return u}hasTransition(){if(this._source.hasTransition())return!0;if(Fr(this._source.type)){let s=T.now();for(let u in this._tiles)if(this._tiles[u].fadeEndTime>=s)return!0}return!1}setFeatureState(s,u,f){this._state.updateState(s=s||"_geojsonTileLayer",u,f)}removeFeatureState(s,u,f){this._state.removeFeatureState(s=s||"_geojsonTileLayer",u,f)}getFeatureState(s,u){return this._state.getState(s=s||"_geojsonTileLayer",u)}setDependencies(s,u,f){let g=this._tiles[s];g&&g.setDependencies(u,f)}reloadTilesForDependencies(s,u){for(let f in this._tiles)this._tiles[f].hasDependency(s,u)&&this._reloadTile(f,"reloading");this._cache.filter(f=>!f.hasDependency(s,u))}}function nr(x,s){let u=Math.abs(2*x.wrap)-+(x.wrap<0),f=Math.abs(2*s.wrap)-+(s.wrap<0);return x.overscaledZ-s.overscaledZ||f-u||s.canonical.y-x.canonical.y||s.canonical.x-x.canonical.x}function Fr(x){return x==="raster"||x==="image"||x==="video"}Et.maxOverzooming=10,Et.maxUnderzooming=3;class Ft{constructor(s,u){this.reset(s,u)}reset(s,u){this.points=s||[],this._distances=[0];for(let f=1;f<this.points.length;f++)this._distances[f]=this._distances[f-1]+this.points[f].dist(this.points[f-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(u||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(s){if(this.points.length===1)return this.points[0];s=r.ac(s,0,1);let u=1,f=this._distances[u],g=s*this.paddedLength+this.padding;
vendor: 4,365 bytes, line 21
21for(;f<g&&u<this._distances.length;)f=this._distances[++u];let v=u-1,A=this._distances[v],I=f-A,L=I>0?(g-A)/I:0;return this.points[v].mult(1-L).add(this.points[u].mult(L))}}function Gs(x,s){let u=!0;return x==="always"||x!=="never"&&s!=="never"||(u=!1),u}class lo{constructor(s,u,f){let g=this.boxCells=[],v=this.circleCells=[];this.xCellCount=Math.ceil(s/f),this.yCellCount=Math.ceil(u/f);for(let A=0;A<this.xCellCount*this.yCellCount;A++)g.push([]),v.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=s,this.height=u,this.xScale=this.xCellCount/s,this.yScale=this.yCellCount/u,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(s,u,f,g,v){this._forEachCell(u,f,g,v,this._insertBoxCell,this.boxUid++),this.boxKeys.push(s),this.bboxes.push(u),this.bboxes.push(f),this.bboxes.push(g),this.bboxes.push(v)}insertCircle(s,u,f,g){this._forEachCell(u-g,f-g,u+g,f+g,this._insertCircleCell,this.circleUid++),this.circleKeys.push(s),this.circles.push(u),this.circles.push(f),this.circles.push(g)}_insertBoxCell(s,u,f,g,v,A){this.boxCells[v].push(A)}_insertCircleCell(s,u,f,g,v,A){this.circleCells[v].push(A)}_query(s,u,f,g,v,A,I){if(f<0||s>this.width||g<0||u>this.height)return[];let L=[];if(s<=0&&u<=0&&this.width<=f&&this.height<=g){if(v)return[{key:null,x1:s,y1:u,x2:f,y2:g}];for(let O=0;O<this.boxKeys.length;O++)L.push({key:this.boxKeys[O],x1:this.bboxes[4*O],y1:this.bboxes[4*O+1],x2:this.bboxes[4*O+2],y2:this.bboxes[4*O+3]});for(let O=0;O<this.circleKeys.length;O++){let N=this.circles[3*O],V=this.circles[3*O+1],G=this.circles[3*O+2];L.push({key:this.circleKeys[O],x1:N-G,y1:V-G,x2:N+G,y2:V+G})}}else this._forEachCell(s,u,f,g,this._queryCell,L,{hitTest:v,overlapMode:A,seenUids:{box:{},circle:{}}},I);return L}query(s,u,f,g){return this._query(s,u,f,g,!1,null)}hitTest(s,u,f,g,v,A){return this._query(s,u,f,g,!0,v,A).length>0}hitTestCircle(s,u,f,g,v){let A=s-f,I=s+f,L=u-f,O=u+f;if(I<0||A>this.width||O<0||L>this.height)return!1;let N=[];return this._forEachCell(A,L,I,O,this._queryCellCircle,N,{hitTest:!0,overlapMode:g,circle:{x:s,y:u,radius:f},seenUids:{box:{},circle:{}}},v),N.length>0}_queryCell(s,u,f,g,v,A,I,L){let{seenUids:O,hitTest:N,overlapMode:V}=I,G=this.boxCells[v];if(G!==null){let ne=this.bboxes;for(let ae of G)if(!O.box[ae]){O.box[ae]=!0;let he=4*ae,de=this.boxKeys[ae];if(s<=ne[he+2]&&u<=ne[he+3]&&f>=ne[he+0]&&g>=ne[he+1]&&(!L||L(de))&&(!N||!Gs(V,de.overlapMode))&&(A.push({key:de,x1:ne[he],y1:ne[he+1],x2:ne[he+2],y2:ne[he+3]}),N))return!0}}let Q=this.circleCells[v];if(Q!==null){let ne=this.circles;for(let ae of Q)if(!O.circle[ae]){O.circle[ae]=!0;let he=3*ae,de=this.circleKeys[ae];if(this._circleAndRectCollide(ne[he],ne[he+1],ne[he+2],s,u,f,g)&&(!L||L(de))&&(!N||!Gs(V,de.overlapMode))){let me=ne[he],re=ne[he+1],ve=ne[he+2];if(A.push({key:de,x1:me-ve,y1:re-ve,x2:me+ve,y2:re+ve}),N)return!0}}}return!1}_queryCellCircle(s,u,f,g,v,A,I,L){let{circle:O,seenUids:N,overlapMode:V}=I,G=this.boxCells[v];if(G!==null){let ne=this.bboxes;for(let ae of G)if(!N.box[ae]){N.box[ae]=!0;let he=4*ae,de=this.boxKeys[ae];if(this._circleAndRectCollide(O.x,O.y,O.radius,ne[he+0],ne[he+1],ne[he+2],ne[he+3])&&(!L||L(de))&&!Gs(V,de.overlapMode))return A.push(!0),!0}}let Q=this.circleCells[v];if(Q!==null){let ne=this.circles;for(let ae of Q)if(!N.circle[ae]){N.circle[ae]=!0;let he=3*ae,de=this.circleKeys[ae];if(this._circlesCollide(ne[he],ne[he+1],ne[he+2],O.x,O.y,O.radius)&&(!L||L(de))&&!Gs(V,de.overlapMode))return A.push(!0),!0}}}_forEachCell(s,u,f,g,v,A,I,L){let O=this._convertToXCellCoord(s),N=this._convertToYCellCoord(u),V=this._convertToXCellCoord(f),G=this._convertToYCellCoord(g);for(let Q=O;Q<=V;Q++)for(let ne=N;ne<=G;ne++)if(v.call(this,s,u,f,g,this.xCellCount*ne+Q,A,I,L))return}_convertToXCellCoord(s){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(s*this.xScale)))}_convertToYCellCoord(s){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(s*this.yScale)))}_circlesCollide(s,u,f,g,v,A){let I=g-s,L=v-u,O=f+A;return O*O>I*I+L*L}_circleAndRectCollide(s,u,f,g,v,A,I){let L=(A-g)/2,O=Math.abs(s-(g+L));if(O>L+f)return!1;let N=(I-v)/2,V=Math.abs(u-(v+N));if(V>N+f)return!1;if(O<=L||V<=N)return!0;let G=O-L,Q=V-N;return G*G+Q*Q<=f*f}}function co(x,s,u,f,g){let v=r.H();return s?(r.K(v,v,[1/g,1/g,1]),u||r.ad(v,v,f.angle)):r.L(v,f.labelPlaneMatr
21ix,x),v}function Es(x,s,u,f,g){if(s){let v=r.ae(x);return r.K(v,v,[g,g,1]),u||r.ad(v,v,-f.angle),v}return f.glCoordMatrix}function ue(x,s,u,f){let g;f?(g=[x,s,f(x,s),1],r.af(g,g,u)):(g=[x,s,0,1],hi(g,g,u));let v=g[3];return{point:new r.P(g[0]/v,g[1]/v),signedDistanceFromCamera:v,isOccluded:!1}}function q(x,s){return .5+x/s*.5}function j(x,s){return x.x>=-s[0]&&x.x<=s[0]&&x.y>=-s[1]&&x.y<=s[1]}function ee(x,s,u,f,g,v,A,I,L,O,N,V,G,Q,ne){let ae=f?x.textSizeData:x.iconSizeData,he=r.ag(ae,u.transform.zoom),de=[256/u.width*2+1,256/u.height*2+1],me=f?x.text.dynamicLayoutVertexArray:x.icon.dynamicLayoutVertexArray;me.clear();let re=x.lineVertexArray,ve=f?x.text.placedSymbolArray:x.icon.placedSymbolArray,xe=u.transform.width/u.transform.height,Ae=!1;for(let Ne=0;Ne<ve.length;Ne++){let He=ve.get(Ne);if(He.hidden||He.writingMode===r.ah.vertical&&!Ae){wt(He.numGlyphs,me);continue}Ae=!1;let tt=ue(He.anchorX,He.anchorY,s,ne);if(!j(tt.point,de)){wt(He.numGlyphs,me);continue}let st=q(u.transform.cameraToCenterDistance,tt.signedDistanceFromCamera),Je=r.ai(ae,he,He),Qe=A?Je/st:Je*st,ft={getElevation:ne,labelPlaneMatrix:g,lineVertexArray:re,pitchWithMap:A,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:O,tileAnchorPoint:new r.P(He.anchorX,He.anchorY),unwrappedTileID:N,width:V,height:G,translation:Q},zt=Se(ft,He,Qe,!1,I,s,v,x.glyphOffsetArray,me,xe,L);Ae=zt.useVertical,(zt.notEnoughRoom||Ae||zt.needsFlipping&&Se(ft,He,Qe,!0,I,s,v,x.glyphOffsetArray,me,xe,L).notEnoughRoom)&&wt(He.numGlyphs,me)}f?x.text.dynamicLayoutVertexBuffer.updateData(me):x.icon.dynamicLayoutVertexBuffer.updateData(me)}function oe(x,s,u,f,g,v,A,I){let L=v.glyphStartIndex+v.numGlyphs,O=v.lineStartIndex,N=v.lineStartIndex+v.lineLength,V=s.getoffsetX(v.glyphStartIndex),G=s.getoffsetX(L-1),Q=Ye(x*V,u,f,g,v.segment,O,N,I,A);if(!Q)return null;let ne=Ye(x*G,u,f,g,v.segment,O,N,I,A);return ne?I.projectionCache.anyProjectionOccluded?null:{first:Q,last:ne}:null}function _e(x,s,u,f){return x===r.ah.horizontal&&Math.abs(u.y-s.y)>Math.abs(u.x-s.x)*f?{useVertical:!0}:(x===r.ah.vertical?s.y<u.y:s.x>u.x)?{needsFlipping:!0}:null}function Se(x,s,u,f,g,v,A,I,L,O,N){let V=u/24,G=s.lineOffsetX*V,Q=s.lineOffsetY*V,ne;if(s.numGlyphs>1){let ae=s.glyphStartIndex+s.numGlyphs,he=s.lineStartIndex,de=s.lineStartIndex+s.lineLength,me=oe(V,I,G,Q,f,s,N,x);if(!me)return{notEnoughRoom:!0};let re=ue(me.first.point.x,me.first.point.y,A,x.getElevation).point,ve=ue(me.last.point.x,me.last.point.y,A,x.getElevation).point;if(g&&!f){let xe=_e(s.writingMode,re,ve,O);
21if(xe)return xe}ne=[me.first];for(let xe=s.glyphStartIndex+1;xe<ae-1;xe++)ne.push(Ye(V*I.getoffsetX(xe),G,Q,f,s.segment,he,de,x,N));ne.push(me.last)}else{if(g&&!f){let he=ue(x.tileAnchorPoint.x,x.tileAnchorPoint.y,v,x.getElevation).point,de=s.lineStartIndex+s.segment+1,me=new r.P(x.lineVertexArray.getx(de),x.lineVertexArray.gety(de)),re=ue(me.x,me.y,v,x.getElevation),ve=re.signedDistanceFromCamera>0?re.point:function(Ae,Ne,He,tt,st,Je){return ke(Ae,Ne,He,1,st,Je)}(x.tileAnchorPoint,me,he,0,v,x),xe=_e(s.writingMode,he,ve,O);if(xe)return xe}let ae=Ye(V*I.getoffsetX(s.glyphStartIndex),G,Q,f,s.segment,s.lineStartIndex,s.lineStartIndex+s.lineLength,x,N);if(!ae||x.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};ne=[ae]}for(let ae of ne)r.aj(L,ae.point,ae.angle);return{}}function ke(x,s,u,f,g,v){let A=x.add(x.sub(s)._unit()),I=g!==void 0?ue(A.x,A.y,g,v.getElevation).point:Re(A.x,A.y,v).point,L=u.sub(I);return u.add(L._mult(f/L.mag()))}function fe(x,s,u){let f=s.projectionCache;if(f.projections[x])return f.projections[x];let g=new r.P(s.lineVertexArray.getx(x),s.lineVertexArray.gety(x)),v=Re(g.x,g.y,s);if(v.signedDistanceFromCamera>0)return f.projections[x]=v.point,f.anyProjectionOccluded=f.anyProjectionOccluded||v.isOccluded,v.point;let A=x-u.direction;return function(I,L,O,N,V){return ke(I,L,O,N,void 0,V)}(u.distanceFromAnchor===0?s.tileAnchorPoint:new r.P(s.lineVertexArray.getx(A),s.lineVertexArray.gety(A)),g,u.previousVertex,u.absOffsetX-u.distanceFromAnchor+1,s)}function Re(x,s,u){let f=x+u.translation[0],g=s+u.translation[1],v;return!u.pitchWithMap&&u.projection.useSpecialProjectionForSymbols?(v=u.projection.projectTileCoordinates(f,g,u.unwrappedTileID,u.getElevation),v.point.x=(.5*v.point.x+.5)*u.width,v.point.y=(.5*-v.point.y+.5)*u.height):(v=ue(f,g,u.labelPlaneMatrix,u.getElevation),v.isOccluded=!1),v}function $e(x,s,u){return x._unit()._perp()._mult(s*u)}function Ee(x,s,u,f,g,v,A,I,L){if(I.projectionCache.offsets[x])return I.projectionCache.offsets[x];let O=u.add(s);if(x+L.direction<f||x+L.direction>=g)return I.projectionCache.offsets[x]=O,O;let N=fe(x+L.direction,I,L),V=$e(N.sub(u),A,L.direction),G=u.add(V),Q=N.add(V);return I.projectionCache.offsets[x]=r.ak(v,O,G,Q)||O,I.projectionCache.offsets[x]}function Ye(x,s,u,f,g,v,A,I,L){let O=f?x-s:x+s,N=O>0?1:-1,V=0;f&&(N*=-1,V=Math.PI),N<0&&(V+=Math.PI);let G,Q=N>0?v+g:v+g+1;I.projectionCache.cachedAnchorPoint?G=I.projectionCache.cachedAnchorPoint:(G=Re(I.tileAnchorPoint.x,I.tileAnchorPoint.y,I).point,I.projectionCache.cachedAnchorPoint=G);let ne,ae,he=G,de=G,me=0,re=0,ve=Math.abs(O),xe=[],Ae;for(;me+re<=ve;){if(Q+=N,Q<v||Q>=A)return null;me+=re,de=he,ae=ne;let tt={absOffsetX:ve,direction:N,distanceFromAnchor:me,previousVertex:de};if(he=fe(Q,I,tt),u===0)xe.push(de),Ae=he.sub(de);else{let st,Je=he.sub(de);st=Je.mag()===0?$e(fe(Q+N,I,tt).sub(he),u,N):$e(Je,u,N),ae||(ae=de.add(st)),ne=Ee(Q,st,he,v,A,ae,u,I,tt),xe.push(ae),Ae=ne.sub(ae)}re=Ae.mag()}let Ne=Ae._mult((ve-me)/re)._add(ae||de),He=V+Math.atan2(he.y-de.y,he.x-de.x);return xe.push(Ne),{point:Ne,angle:L?He:0,path:xe}}let xt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function wt(x,s){for(let u=0;u<x;u++){let f=s.length;s.resize(f+4),s.float32.set(xt,3*f)}}function hi(x,s,u){let f=s[0],g=s[1];return x[0]=u[0]*f+u[4]*g+u[12],x[1]=u[1]*f+u[5]*g+u[13],x[3]=u[3]*f+u[7]*g+u[15],x}let Nt=100;class di{constructor(s,u,f=new lo(s.width+200,s.height+200,25),g=new lo(s.width+200,s.height+200,25)){this.transform=s,this.mapProjection=u,this.grid=f,this.ignoredGrid=g,this.pitchFactor=Math.cos(s._pitch)*s.cameraToCenterDistance,this.screenRightBoundary=s.width+Nt,this.screenBottomBoundary=s.height+Nt,this.gridRightBoundary=s.width+200,this.gridBottomBoundary=s.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(s,u,f,g,v,A,I,L,O,N,V){let G=s.anchorPointX+L[0],Q=s.anchorPointY+L[1],ne=this.projectAndGetPerspectiveRatio(g,G,Q,v,N),ae=f*ne.perspectiveRatio,he;if(A||I)he=this._projectCollisionBox(s,ae,g,v,A,I,L,ne,N,V);else{let xe=ne.point.x+(V?V.x*ae:0),Ae=ne.point.y+(V?V.y*ae:0);he={allPointsOccluded:!1,box:[xe+s.x1*ae,Ae+s.y1*ae,xe+s.x2*ae,Ae+s.y2*ae]}}let[de,me,re,ve]=he.box;return this.mapProjection.useSpecialProjectionForSymbols&&(A?he.allPointsOccluded:this.mapProjection.isOccluded(G,Q,v))||ne.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(de,me,re,ve)||u!=="always"&&this.grid.hitTest(de,me,re,ve,u,O)?{box:[de,me,re,ve],placeable:!1,offscreen:!1}:{box:[de,me,re,ve],placeable:!0,offscreen:this.isOffscreen(de,me,re,ve)}}placeCollisionCircles(s,u,f,g,v,A,I,L,O,N,V,G,Q,ne,ae,he){let de=[],me=new r.P(u.anchorX,u.anchorY),re=this.getPerspectiveRatio(A,me.x,me.y,I,he),ve=(V?v/re:v*re)/r.ap,xe={getElevation:he,labelPlaneMatr
21ix:L,lineVertexArray:f,pitchWithMap:V,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:me,unwrappedTileID:I,width:this.transform.width,height:this.transform.height,translation:ae},Ae=oe(ve,g,u.lineOffsetX*ve,u.lineOffsetY*ve,!1,u,!1,xe),Ne=!1,He=!1,tt=!0;if(Ae){let st=.5*Q*re+ne,Je=new r.P(-100,-100),Qe=new r.P(this.screenRightBoundary,this.screenBottomBoundary),ft=new Ft,zt=Ae.first,it=Ae.last,Ze=[];for(let Pt=zt.path.length-1;Pt>=1;Pt--)Ze.push(zt.path[Pt]);for(let Pt=1;Pt<it.path.length;Pt++)Ze.push(it.path[Pt]);let It=2.5*st;if(O){let Pt=this.projectPathToScreenSpace(Ze,xe,O);Ze=Pt.some(Xt=>Xt.signedDistanceFromCamera<=0)?[]:Pt.map(Xt=>Xt.point)}let qi=[];if(Ze.length>0){let Pt=Ze[0].clone(),Xt=Ze[0].clone();for(let zi=1;zi<Ze.length;zi++)Pt.x=Math.min(Pt.x,Ze[zi].x),Pt.y=Math.min(Pt.y,Ze[zi].y),Xt.x=Math.max(Xt.x,Ze[zi].x),Xt.y=Math.max(Xt.y,Ze[zi].y);qi=Pt.x>=Je.x&&Xt.x<=Qe.x&&Pt.y>=Je.y&&Xt.y<=Qe.y?[Ze]:Xt.x<Je.x||Pt.x>Qe.x||Xt.y<Je.y||Pt.y>Qe.y?[]:r.al([Ze],Je.x,Je.y,Qe.x,Qe.y)}for(let Pt of qi){ft.reset(Pt,.25*st);let Xt=0;Xt=ft.length<=.5*st?1:Math.ceil(ft.paddedLength/It)+1;for(let zi=0;zi<Xt;zi++){let yn=zi/Math.max(Xt-1,1),hs=ft.lerp(yn),Qt=hs.x+Nt,sr=hs.y+Nt;de.push(Qt,sr,st,0);let br=Qt-st,or=sr-st,xr=Qt+st,ds=sr+st;if(tt=tt&&this.isOffscreen(br,or,xr,ds),He=He||this.isInsideGrid(br,or,xr,ds),s!=="always"&&this.grid.hitTestCircle(Qt,sr,st,s,G)&&(Ne=!0,!N))return{circles:[],offscreen:!1,collisionDetected:Ne}}}}return{circles:!N&&Ne||!He||re<this.perspectiveRatioCutoff?[]:de,offscreen:tt,collisionDetected:Ne}}projectPathToScreenSpace(s,u,f){return s.map(g=>ue(g.x,g.y,f,u.getElevation))}queryRenderedSymbols(s){if(s.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let u=[],f=1/0,g=1/0,v=-1/0,A=-1/0;for(let N of s){let V=new r.P(N.x+Nt,N.y+Nt);f=Math.min(f,V.x),g=Math.min(g,V.y),v=Math.max(v,V.x),A=Math.max(A,V.y),u.push(V)}let I=this.grid.query(f,g,v,A).concat(this.ignoredGrid.query(f,g,v,A)),L={},O={};for(let N of I){let V=N.key;if(L[V.bucketInstanceId]===void 0&&(L[V.bucketInstanceId]={}),L[V.bucketInstanceId][V.featureIndex])continue;let G=[new r.P(N.x1,N.y1),new r.P(N.x2,N.y1),new r.P(N.x2,N.y2),new r.P(N.x1,N.y2)];r.am(u,G)&&(L[V.bucketInstanceId][V.featureIndex]=!0,O[V.bucketInstanceId]===void 0&&(O[V.bucketInstanceId]=[]),O[V.bucketInstanceId].push(V.featureIndex))}return O}insertCollisionBox(s,u,f,g,v,A){(f?this.ignoredGrid:this.grid).insert({bucketInstanceId:g,featureIndex:v,collisionGroupID:A,overlapMode:u},s[0],s[1],s[2],s[3])}insertCollisionCircles(s,u,f,g,v,A){let I=f?this.ignoredGrid:this.grid,L={bucketInstanceId:g,featureIndex:v,collisionGroupID:A,overlapMode:u};for(let O=0;O<s.length;O+=4)I.insertCircle(L,s[O],s[O+1],s[O+2])}projectAndGetPerspectiveRatio(s,u,f,g,v){let A;v?(A=[u,f,v(u,f),1],r.af(A,A,s)):(A=[u,f,0,1],hi(A,A,s));let I=A[3];return{point:new r.P((A[0]/I+1)/2*this.transform.width+Nt,(-A[1]/I+1)/2*this.transform.height+Nt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/I*.5,isOccluded:!1,signedDistanceFromCamera:I}}getPerspectiveRatio(s,u,f,g,v){let A=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(u,f,g,v):ue(u,f,s,v);return .5+this.transform.cameraToCenterDistance/A.signedDistanceFromCamera*.5}isOffscreen(s,u,f,g){return f<Nt||s>=this.screenRightBoundary||g<Nt||u>this.screenBottomBoundary}isInsideGrid(s,u,f,g){return f>=0&&s<this.gridRightBoundary&&g>=0&&u<this.gridBottomBoundary}getViewportMatrix(){let s=r.an([]);return r.J(s,s,[-100,-100,0]),s}_projectCollisionBox(s,u,f,g,v,A,I,L,O,N){let V=new r.P(1,0),G=new r.P(0,1),Q=new r.P(s.anchorPointX+I[0],s.anchorPointY+I[1]);if(A&&!v){let tt=this.projectAndGetPerspectiveRatio(f,Q.x+1,Q.y,g,O).point.sub(L.point).unit(),st=Math.atan(tt.y/tt.x)+(tt.x<0?Math.PI:0),Je=Math.sin(st),Qe=Math.cos(st);V=new r.P(Qe,Je),G=new r.P(-Je,Qe)}else if(!A&&v){let tt=-this.transform.angle,st=Math.sin(tt),Je=Math.cos(tt);V=new r.P(Je,st),G=new r.P(-st,Je)}let ne=L.point,ae=u;if(v){ne=Q;let tt=this.transform.zoom-Math.floor(this.transform.zoom);ae=Math.pow(2,-tt),ae*=this.mapProjection.getPitchedTextCorrection(this.transform,Q,g),N||(ae*=r.ac(.5+L.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}N&&(ne=ne.add(V.mult(N.x*ae)).add(G.mult(N.y*ae)));let he=s.x1*ae,de=s.x2*ae,me=(he+de)/2,re=s.y1*ae,ve=s.y2*ae,xe=(re+ve)/2,Ae=[{offsetX:he,offsetY:re},{offsetX:me,offsetY:re},{offsetX:de,offsetY:re},{offsetX:de,offsetY:xe},{offsetX:de,offsetY:ve},{offsetX:me,offsetY:ve},{offsetX:he,offsetY:ve},{offsetX:he,offsetY:xe}],Ne=[];for(let{offsetX:tt,offsetY:st}of Ae)Ne.push(new r.P(ne.x+V.x*tt+G.x*st,ne.y+V.y*tt+G.y*st));let He=!1;if(v){let tt=Ne.map(st=>this.projectAndGetPerspectiveRatio(f,st.x,st.y,g,O));He=tt.some(st=>!st.isOccluded),Ne=tt.map(st=>st.point)}else He=!0;return{box:r.ao(Ne),allPointsOccluded:!He}}}function ei(x,s,u){return s*(r.X/(x.tileSize*Math.pow(2,u-x.tileID.overscaledZ
21)))}class bn{constructor(s,u,f,g){this.opacity=s?Math.max(0,Math.min(1,s.opacity+(s.placed?u:-u))):g&&f?1:0,this.placed=f}isHidden(){return this.opacity===0&&!this.placed}}class cn{constructor(s,u,f,g,v){this.text=new bn(s?s.text:null,u,f,v),this.icon=new bn(s?s.icon:null,u,g,v)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Gt{constructor(s,u,f){this.text=s,this.icon=u,this.skipFade=f}}class Ei{constructor(){this.invProjMatrix=r.H(),this.viewportMatrix=r.H(),this.circles=[]}}class Ji{constructor(s,u,f,g,v){this.bucketInstanceId=s,this.featureIndex=u,this.sourceLayerIndex=f,this.bucketIndex=g,this.tileID=v}}class Nn{constructor(s){this.crossSourceCollisions=s,this.maxGroupID=0,this.collisionGroups={}}get(s){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[s]){let u=++this.maxGroupID;this.collisionGroups[s]={ID:u,predicate:f=>f.collisionGroupID===u}}return this.collisionGroups[s]}}function Zn(x,s,u,f,g){let{horizontalAlign:v,verticalAlign:A}=r.au(x);return new r.P(-(v-.5)*s+f[0]*g,-(A-.5)*u+f[1]*g)}class Vn{constructor(s,u,f,g,v,A){this.transform=s.clone(),this.terrain=f,this.collisionIndex=new di(this.transform,u),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=g,this.retainedQueryData={},this.collisionGroups=new Nn(v),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=A,A&&(A.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(s){let u=this.terrain;return u?(f,g)=>u.getElevation(s,f,g):null}getBucketParts(s,u,f,g){let v=f.getBucket(u),A=f.latestFeatureIndex;if(!v||!A||u.id!==v.layerIds[0])return;let I=f.collisionBoxArray,L=v.layers[0].layout,O=v.layers[0].paint,N=Math.pow(2,this.transform.zoom-f.tileID.overscaledZ),V=f.tileSize/r.X,G=f.tileID.toUnwrapped(),Q=this.transform.calculatePosMatrix(G),ne=L.get("text-pitch-alignment")==="map",ae=L.get("text-rotation-alignment")==="map",he=ei(f,1,this.transform.zoom),de=this.collisionIndex.mapProjection.translatePosition(this.transform,f,O.get("text-translate"),O.get("text-translate-anchor")),me=this.collisionIndex.mapProjection.translatePosition(this.transform,f,O.get("icon-translate"),O.get("icon-translate-anchor")),re=co(Q,ne,ae,this.transform,he),ve=null;if(ne){let Ae=Es(Q,ne,ae,this.transform,he);ve=r.L([],this.transform.labelPlaneMatrix,Ae)}this.retainedQueryData[v.bucketInstanceId]=new Ji(v.bucketInstanceId,A,v.sourceLayerIndex,v.index,f.tileID);let xe={bucket:v,layout:L,translationText:de,translationIcon:me,posMatrix:Q,unwrappedTileID:G,textLabelPlaneMatrix:re,labelToScreenMatrix:ve,scale:N,textPixelRatio:V,holdingForFade:f.holdingForFade(),collisionBoxArray:I,partiallyEvaluatedTextSize:r.ag(v.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(v.sourceID)};if(g)for(let Ae of v.sortKeyRanges){let{sortKey:Ne,symbolInstanceStart:He,symbolInstanceEnd:tt}=Ae;s.push({sortKey:Ne,symbolInstanceStart:He,symbolInstanceEnd:tt,parameters:xe})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:v.symbolInstances.length,parameters:xe})}attemptAnchorPlacement(s,u,f,g,v,A,I,L,O,N,V,G,Q,ne,ae,he,de,me,re){let ve=r.aq[s.textAnchor],xe=[s.textOffset0,s.textOffset1],Ae=Zn(ve,f,g,xe,v),Ne=this.collisionIndex.placeCollisionBox(u,G,L,O,N,I,A,he,V.predicate,re,Ae);if((!me||this.collisionIndex.placeCollisionBox(me,G,L,O,N,I,A,de,V.predicate,re,Ae).placeable)&&Ne.placeable){let He;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Q.crossTileID]&&this.prevPlacement.placements[Q.crossTileID]&&this.prevPlacement.placements[Q.crossTileID].text&&(He=this.prevPlacement.variableOffsets[Q.crossTileID].anchor),Q.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Q.crossTileID]={textOffset:xe,width:f,height:g,anchor:ve,textBoxScale:v,prevAnchor:He},this.markUsedJustification(ne,ve,Q,ae),ne.allowVerticalPlacement&&(this.markUsedOrientation(ne,ae,Q),this.placedOrientations[Q.crossTileID]=ae),{shift:Ae,placedGlyphBoxes:Ne}}}placeLayerBucketPart(s,u,f){let{bucket:g,layout:v,translationText:A,translationIcon:I,posMatrix:L,unwrappedTileID:O,textLabelPlaneMatr
21ix:N,labelToScreenMatrix:V,textPixelRatio:G,holdingForFade:Q,collisionBoxArray:ne,partiallyEvaluatedTextSize:ae,collisionGroup:he}=s.parameters,de=v.get("text-optional"),me=v.get("icon-optional"),re=r.ar(v,"text-overlap","text-allow-overlap"),ve=re==="always",xe=r.ar(v,"icon-overlap","icon-allow-overlap"),Ae=xe==="always",Ne=v.get("text-rotation-alignment")==="map",He=v.get("text-pitch-alignment")==="map",tt=v.get("icon-text-fit")!=="none",st=v.get("symbol-z-order")==="viewport-y",Je=ve&&(Ae||!g.hasIconData()||me),Qe=Ae&&(ve||!g.hasTextData()||de);!g.collisionArrays&&ne&&g.deserializeCollisionBoxes(ne);let ft=this._getTerrainElevationFunc(this.retainedQueryData[g.bucketInstanceId].tileID),zt=(it,Ze,It)=>{var qi,Pt;if(u[it.crossTileID])return;if(Q)return void(this.placements[it.crossTileID]=new Gt(!1,!1,!1));let Xt=!1,zi=!1,yn=!0,hs=null,Qt={box:null,placeable:!1,offscreen:null},sr={box:null,placeable:!1,offscreen:null},br=null,or=null,xr=null,ds=0,fl=0,jo=0;Ze.textFeatureIndex?ds=Ze.textFeatureIndex:it.useRuntimeCollisionCircles&&(ds=it.featureIndex),Ze.verticalTextFeatureIndex&&(fl=Ze.verticalTextFeatureIndex);let ka=Ze.textBox;if(ka){let fs=Yn=>{let ar=r.ah.horizontal;if(g.allowVerticalPlacement&&!Yn&&this.prevPlacement){let qr=this.prevPlacement.placedOrientations[it.crossTileID];qr&&(this.placedOrientations[it.crossTileID]=qr,ar=qr,this.markUsedOrientation(g,ar,it))}return ar},ms=(Yn,ar)=>{if(g.allowVerticalPlacement&&it.numVerticalGlyphVertices>0&&Ze.verticalTextBox){for(let qr of g.writingModes)if(qr===r.ah.vertical?(Qt=ar(),sr=Qt):Qt=Yn(),Qt&&Qt.placeable)break}else Qt=Yn()},Ys=it.textAnchorOffsetStartIndex,gs=it.textAnchorOffsetEndIndex;if(gs===Ys){let Yn=(ar,qr)=>{let ni=this.collisionIndex.placeCollisionBox(ar,re,G,L,O,He,Ne,A,he.predicate,ft);return ni&&ni.placeable&&(this.markUsedOrientation(g,qr,it),this.placedOrientations[it.crossTileID]=qr),ni};ms(()=>Yn(ka,r.ah.horizontal),()=>{let ar=Ze.verticalTextBox;return g.allowVerticalPlacement&&it.numVerticalGlyphVertices>0&&ar?Yn(ar,r.ah.vertical):{box:null,offscreen:null}}),fs(Qt&&Qt.placeable)}else{let Yn=r.aq[(Pt=(qi=this.prevPlacement)===null||qi===void 0?void 0:qi.variableOffsets[it.crossTileID])===null||Pt===void 0?void 0:Pt.anchor],ar=(ni,bo,ml)=>{let qo=ni.x2-ni.x1,wh=ni.y2-ni.y1,Qd=it.textBoxScale,Sh=tt&&xe==="never"?bo:null,Rs=null,ep=re==="never"?1:2,nc="never";Yn&&ep++;for(let gl=0;gl<ep;gl++){for(let cu=Ys;cu<gs;cu++){let rc=g.textAnchorOffsets.get(cu);if(Yn&&rc.textAnchor!==Yn)continue;let yl=this.attemptAnchorPlacement(rc,ni,qo,wh,Qd,Ne,He,G,L,O,he,nc,it,g,ml,A,I,Sh,ft);if(yl&&(Rs=yl.placedGlyphBoxes,Rs&&Rs.placeable))return Xt=!0,hs=yl.shift,Rs}Yn?Yn=null:nc=re}return f&&!Rs&&(Rs={box:this.collisionIndex.placeCollisionBox(ka,"always",G,L,O,He,Ne,A,he.predicate,ft,new r.P(0,0)).box,offscreen:!1,placeable:!1}),Rs};ms(()=>ar(ka,Ze.iconBox,r.ah.horizontal),()=>{let ni=Ze.verticalTextBox;return g.allowVerticalPlacement&&(!Qt||!Qt.placeable)&&it.numVerticalGlyphVertices>0&&ni?ar(ni,Ze.verticalIconBox,r.ah.vertical):{box:null,occluded:!0,offscreen:null}}),Qt&&(Xt=Qt.placeable,yn=Qt.offscreen);let qr=fs(Qt&&Qt.placeable);if(!Xt&&this.prevPlacement){let ni=this.prevPlacement.variableOffsets[it.crossTileID];ni&&(this.variableOffsets[it.crossTileID]=ni,this.markUsedJustification(g,ni.anchor,it,qr))}}}if(br=Qt,Xt=br&&br.placeable,yn=br&&br.offscreen,it.useRuntimeCollisionCircles){let fs=g.text.placedSymbolArray.get(it.centerJustifiedTextSymbolIndex),ms=r.ai(g.textSizeData,ae,fs),Ys=v.get("text-padding");or=this.collisionIndex.placeCollisionCircles(re,fs,g.lineVertexArray,g.glyphOffsetArray,ms,L,O,N,V,f,He,he.predicate,it.collisionCircleDiameter,Ys,A,ft),or.circles.length&&or.collisionDetected&&!f&&r.w("Collisions detected, but collision boxes are not shown"),Xt=ve||or.circles.length>0&&!or.collisionDetected,yn=yn&&or.offscreen}if(Ze.iconFeatureIndex&&(jo=Ze.iconFeatureIndex),Ze.iconBox){let fs=ms=>this.collisionIndex.placeCollisionBox(ms,xe,G,L,O,He,Ne,I,he.predicate,ft,tt&&hs?hs:void 0);sr&&sr.placeable&&Ze.verticalIconBox?(xr=fs(Ze.verticalIconBox),zi=xr.placeable):(xr=fs(Ze.iconBox),zi=xr.placeable),yn=yn&&xr.offscreen}let ps=de||it.numHorizontalGlyphVertices===0&&it.numVerticalGlyphVertices===0,lu=me||it.numIconVertices===0;ps||lu?lu?ps||(zi=zi&&Xt):Xt=zi&&Xt:zi=Xt=zi&&Xt;let Ca=zi&&xr.placeable;if(Xt&&br.placeable&&this.collisionIndex.insertCollisionBox(br.box,re,v.get("text-ignore-placement"),g.bucketInstanceId,sr&&sr.placeable&&fl?fl:ds,he.ID),Ca&&this.collisionIndex.insertCollisionBox(xr.box,xe,v.get("icon-ignore-placement"),g.bucketInstanceId,jo,he.ID),or&&Xt&&this.collisionIndex.insertCollisionCircles(or.circles,re,v.get("text-ignore-placement"),g.bucketInstanceId,ds,he.ID),f&&this.storeCollisionData(g.bucketInstanceId,It,Ze,br,xr,or),it.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(g.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[it.crossTileID]=new Gt(Xt||Je,zi||Qe,yn||g.justReloaded),u[it.crossTileID]=!0};if(st){if(s.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");
21let it=g.getSortedSymbolIndexes(this.transform.angle);for(let Ze=it.length-1;Ze>=0;--Ze){let It=it[Ze];zt(g.symbolInstances.get(It),g.collisionArrays[It],It)}}else for(let it=s.symbolInstanceStart;it<s.symbolInstanceEnd;it++)zt(g.symbolInstances.get(it),g.collisionArrays[it],it);if(f&&g.bucketInstanceId in this.collisionCircleArrays){let it=this.collisionCircleArrays[g.bucketInstanceId];r.as(it.invProjMatrix,L),it.viewportMatrix=this.collisionIndex.getViewportMatrix()}g.justReloaded=!1}storeCollisionData(s,u,f,g,v,A){if(f.textBox||f.iconBox){let I,L;this.collisionBoxArrays.has(s)?I=this.collisionBoxArrays.get(s):(I=new Map,this.collisionBoxArrays.set(s,I)),I.has(u)?L=I.get(u):(L={text:null,icon:null},I.set(u,L)),f.textBox&&(L.text=g.box),f.iconBox&&(L.icon=v.box)}if(A){let I=this.collisionCircleArrays[s];I===void 0&&(I=this.collisionCircleArrays[s]=new Ei);for(let L=0;L<A.circles.length;L+=4)I.circles.push(A.circles[L+0]),I.circles.push(A.circles[L+1]),I.circles.push(A.circles[L+2]),I.circles.push(A.collisionDetected?1:0)}}markUsedJustification(s,u,f,g){let v;v=g===r.ah.vertical?f.verticalPlacedTextSymbolIndex:{left:f.leftJustifiedTextSymbolIndex,center:f.centerJustifiedTextSymbolIndex,right:f.rightJustifiedTextSymbolIndex}[r.at(u)];let A=[f.leftJustifiedTextSymbolIndex,f.centerJustifiedTextSymbolIndex,f.rightJustifiedTextSymbolIndex,f.verticalPlacedTextSymbolIndex];for(let I of A)I>=0&&(s.text.placedSymbolArray.get(I).crossTileID=v>=0&&I!==v?0:f.crossTileID)}markUsedOrientation(s,u,f){let g=u===r.ah.horizontal||u===r.ah.horizontalOnly?u:0,v=u===r.ah.vertical?u:0,A=[f.leftJustifiedTextSymbolIndex,f.centerJustifiedTextSymbolIndex,f.rightJustifiedTextSymbolIndex];for(let I of A)s.text.placedSymbolArray.get(I).placedOrientation=g;f.verticalPlacedTextSymbolIndex&&(s.text.placedSymbolArray.get(f.verticalPlacedTextSymbolIndex).placedOrientation=v)}commit(s){this.commitTime=s,this.zoomAtLastRecencyCheck=this.transform.zoom;let u=this.prevPlacement,f=!1;this.prevZoomAdjustment=u?u.zoomAdjustment(this.transform.zoom):0;let g=u?u.symbolFadeChange(s):1,v=u?u.opacities:{},A=u?u.variableOffsets:{},I=u?u.placedOrientations:{};for(let L in this.placements){let O=this.placements[L],N=v[L];N?(this.opacities[L]=new cn(N,g,O.text,O.icon),f=f||O.text!==N.text.placed||O.icon!==N.icon.placed):(this.opacities[L]=new cn(null,g,O.text,O.icon,O.skipFade),f=f||O.text||O.icon)}for(let L in v){let O=v[L];if(!this.opacities[L]){let N=new cn(O,g,!1,!1);N.isHidden()||(this.opacities[L]=N,f=f||O.text.placed||O.icon.placed)}}for(let L in A)this.variableOffsets[L]||!this.opacities[L]||this.opacities[L].isHidden()||(this.variableOffsets[L]=A[L]);for(let L in I)this.placedOrientations[L]||!this.opacities[L]||this.opacities[L].isHidden()||(this.placedOrientations[L]=I[L]);if(u&&u.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");f?this.lastPlacementChangeTime=s:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=u?u.lastPlacementChangeTime:s)}updateLayerOpacities(s,u){let f={};for(let g of u){let v=g.getBucket(s);v&&g.latestFeatureIndex&&s.id===v.layerIds[0]&&this.updateBucketOpacities(v,g.tileID,f,g.collisionBoxArray)}}updateBucketOpacities(s,u,f,g){s.hasTextData()&&(s.text.opacityVertexArray.clear(),s.text.hasVisibleVertices=!1),s.hasIconData()&&(s.icon.opacityVertexArray.clear(),s.icon.hasVisibleVertices=!1),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexArray.clear(),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexArray.clear();let v=s.layers[0],A=v.layout,I=new cn(null,0,!1,!1,!0),L=A.get("text-allow-overlap"),O=A.get("icon-allow-overlap"),N=v._unevaluatedLayout.hasValue("text-variable-anchor")||v._unevaluatedLayout.hasValue("text-variable-anchor-offset"),V=A.get("text-rotation-alignment")==="map",G=A.get("text-pitch-alignment")==="map",Q=A.get("icon-text-fit")!=="none",ne=new cn(null,0,L&&(O||!s.hasIconData()||A.get("icon-optional")),O&&(L||!s.hasTextData()||A.get("text-optional")),!0);!s.collisionArrays&&g&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(g);let ae=(de,me,re)=>{for(let ve=0;ve<me/4;ve++)de.opacityVertexArray.emplaceBack(re);de.hasVisibleVertices=de.hasVisibleVertices||re!==Za},he=this.collisionBoxArrays.get(s.bucketInstanceId);for(let de=0;de<s.symbolInstances.length;de++){let me=s.symbolInstances.get(de),{numHorizontalGlyphVertices:re,numVerticalGlyphVertices:ve,crossTileID:xe}=me,Ae=this.opacities[xe];f[xe]?Ae=I:Ae||(Ae=ne,this.opacities[xe]=Ae),f[xe]=!0;let Ne=me.numIconVertices>0,He=this.placedOrientations[me.crossTileID],tt=He===r.ah.vertical,st=He===r.ah.horizontal||He===r.ah.horizontalOnly;if(re>0||ve>0){let Qe=Vr(Ae.text);ae(s.text,re,tt?Za:Qe),ae(s.text,ve,st?Za:Qe);let ft=Ae.text.isHidden();[me.rightJustifiedTextSymbolIndex,me.centerJustifiedTextSymbolIndex,me.leftJustifiedTextSymbolIndex].forEac
21h(Ze=>{Ze>=0&&(s.text.placedSymbolArray.get(Ze).hidden=ft||tt?1:0)}),me.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get(me.verticalPlacedTextSymbolIndex).hidden=ft||st?1:0);let zt=this.variableOffsets[me.crossTileID];zt&&this.markUsedJustification(s,zt.anchor,me,He);let it=this.placedOrientations[me.crossTileID];it&&(this.markUsedJustification(s,"left",me,it),this.markUsedOrientation(s,it,me))}if(Ne){let Qe=Vr(Ae.icon),ft=!(Q&&me.verticalPlacedIconSymbolIndex&&tt);me.placedIconSymbolIndex>=0&&(ae(s.icon,me.numIconVertices,ft?Qe:Za),s.icon.placedSymbolArray.get(me.placedIconSymbolIndex).hidden=Ae.icon.isHidden()),me.verticalPlacedIconSymbolIndex>=0&&(ae(s.icon,me.numVerticalIconVertices,ft?Za:Qe),s.icon.placedSymbolArray.get(me.verticalPlacedIconSymbolIndex).hidden=Ae.icon.isHidden())}let Je=he&&he.has(de)?he.get(de):{text:null,icon:null};if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){let Qe=s.collisionArrays[de];if(Qe){let ft=new r.P(0,0);if(Qe.textBox||Qe.verticalTextBox){let zt=!0;if(N){let it=this.variableOffsets[xe];it?(ft=Zn(it.anchor,it.width,it.height,it.textOffset,it.textBoxScale),V&&ft._rotate(G?this.transform.angle:-this.transform.angle)):zt=!1}if(Qe.textBox||Qe.verticalTextBox){let it;Qe.textBox&&(it=tt),Qe.verticalTextBox&&(it=st),Ga(s.textCollisionBox.collisionVertexArray,Ae.text.placed,!zt||it,Je.text,ft.x,ft.y)}}if(Qe.iconBox||Qe.verticalIconBox){let zt=!!(!st&&Qe.verticalIconBox),it;Qe.iconBox&&(it=zt),Qe.verticalIconBox&&(it=!zt),Ga(s.iconCollisionBox.collisionVertexArray,Ae.icon.placed,it,Je.icon,Q?ft.x:0,Q?ft.y:0)}}}}if(s.sortFeatures(this.transform.angle),this.retainedQueryData[s.bucketInstanceId]&&(this.retainedQueryData[s.bucketInstanceId].featureSortOrder=s.featureSortOrder),s.hasTextData()&&s.text.opacityVertexBuffer&&s.text.opacityVertexBuffer.updateData(s.text.opacityVertexArray),s.hasIconData()&&s.icon.opacityVertexBuffer&&s.icon.opacityVertexBuffer.updateData(s.icon.opacityVertexArray),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexBuffer&&s.iconCollisionBox.collisionVertexBuffer.updateData(s.iconCollisionBox.collisionVertexArray),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexBuffer&&s.textCollisionBox.collisionVertexBuffer.updateData(s.textCollisionBox.collisionVertexArray),s.text.opacityVertexArray.length!==s.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${s.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${s.text.layoutVertexArray.length}) / 4`);if(s.icon.opacityVertexArray.length!==s.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${s.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${s.icon.layoutVertexArray.length}) / 4`);if(s.bucketInstanceId in this.collisionCircleArrays){let de=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=de.invProjMatrix,s.placementViewportMatrix=de.viewportMatrix,s.collisionCircleArray=de.circles,delete this.collisionCircleArrays[s.bucketInstanceId]}}symbolFadeChange(s){return this.fadeDuration===0?1:(s-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(s){return Math.max(0,(this.transform.zoom-s)/1.5)}hasTransitions(s){return this.stale||s-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(s,u){let f=this.zoomAtLastRecencyCheck===u?1-this.zoomAdjustment(u):1;return this.zoomAtLastRecencyCheck=u,this.commitTime+this.fadeDuration*f>s}setStale(){this.stale=!0}}function Ga(x,s,u,f,g,v){f&&f.length!==0||(f=[0,0,0,0]);let A=f[0]-Nt,I=f[1]-Nt,L=f[2]-Nt,O=f[3]-Nt;x.emplaceBack(s?1:0,u?1:0,g||0,v||0,A,I),x.emplaceBack(s?1:0,u?1:0,g||0,v||0,L,I),x.emplaceBack(s?1:0,u?1:0,g||0,v||0,L,O),x.emplaceBack(s?1:0,u?1:0,g||0,v||0,A,O)}let xi=Math.pow(2,25),Gu=Math.pow(2,24),Zu=Math.pow(2,17),Br=Math.pow(2,16),Cr=Math.pow(2,9),Id=Math.pow(2,8),Nr=Math.pow(2,1);function Vr(x){if(x.opacity===0&&!x.placed)return 0;if(x.opacity===1&&x.placed)return 4294967295;let s=x.placed?1:0,u=Math.floor(127*x.opacity);return u*xi+s*Gu+u*Zu+s*Br+u*Cr+s*Id+u*Nr+s}let Za=0;function aa(){return{isOccluded:(x,s,u)=>!1,getPitchedTextCorrection:(x,s,u)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(x,s,u,f){throw new Error("Not implemented.")},translatePosition:(x,s,u,f)=>function(g,v,A,I,L=!1){if(!A[0]&&!A[1])return[0,0];let O=L?I==="map"?g.angle:0:I==="viewport"?-g.angle:0;if(O){let N=Math.sin(O),V=Math.cos(O);A=[A[0]*V-A[1]*N,A[0]*N+A[1]*V]}return[L?A[0]:ei(v,A[0],g.zoom),L?A[1]:ei(v,A[1],g.zoom)]}(x,s,u,f),getCircleRadiusCorrection:x=>1}}class Tn{constructor(s){this._sortAcrossTiles=s.layout.get("symbol-z-order")!=="viewport-y"&&!s.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(s,u,f,g,v){let A=this._bucketParts;for(;this._currentTileIndex<s.length;)if(u.getBucketParts(A,g,s[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,v())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,A.sort((I,L)=>I.sortKey-L.sortKey));this._currentPartIndex<A.length;)if(u.placeLayerBucketPart(A[this._currentPartIndex],this._seenCrossTileIDs,f),this._currentPartIndex++,v())return!0;return!1}}class Ka{constructor(s,u,f,g,v,A,I,L){this.placement=new Vn(s,aa(),u,A,I,L),this._currentPlacementIndex=f.length-1,this._forceFullPlacement=g,this._showCollisionBoxes=v,this._done=!1}isDone(){return this._done}continuePlacement(s,u,f){let g=T.now(),v=()=>!this._forceFullPlacement&&T.now()-g>2;for(;this._currentPlacementIndex>=0;
21){let A=u[s[this._currentPlacementIndex]],I=this.placement.collisionIndex.transform.zoom;if(A.type==="symbol"&&(!A.minzoom||A.minzoom<=I)&&(!A.maxzoom||A.maxzoom>I)){if(this._inProgressLayer||(this._inProgressLayer=new Tn(A)),this._inProgressLayer.continuePlacement(f[A.source],this.placement,this._showCollisionBoxes,A,v))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(s){return this.placement.commit(s),this.placement}}let rs=512/r.X/2;class gn{constructor(s,u,f){this.tileID=s,this.bucketInstanceId=f,this._symbolsByKey={};let g=new Map;for(let v=0;v<u.length;v++){let A=u.get(v),I=A.key,L=g.get(I);L?L.push(A):g.set(I,[A])}for(let[v,A]of g){let I={positions:A.map(L=>({x:Math.floor(L.anchorX*rs),y:Math.floor(L.anchorY*rs)})),crossTileIDs:A.map(L=>L.crossTileID)};if(I.positions.length>128){let L=new r.av(I.positions.length,16,Uint16Array);for(let{x:O,y:N}of I.positions)L.add(O,N);L.finish(),delete I.positions,I.index=L}this._symbolsByKey[v]=I}}getScaledCoordinates(s,u){let{x:f,y:g,z:v}=this.tileID.canonical,{x:A,y:I,z:L}=u.canonical,O=rs/Math.pow(2,L-v),N=(I*r.X+s.anchorY)*O,V=g*r.X*rs;return{x:Math.floor((A*r.X+s.anchorX)*O-f*r.X*rs),y:Math.floor(N-V)}}findMatches(s,u,f){let g=this.tileID.canonical.z<u.canonical.z?1:Math.pow(2,this.tileID.canonical.z-u.canonical.z);for(let v=0;v<s.length;v++){let A=s.get(v);if(A.crossTileID)continue;let I=this._symbolsByKey[A.key];if(!I)continue;let L=this.getScaledCoordinates(A,u);if(I.index){let O=I.index.range(L.x-g,L.y-g,L.x+g,L.y+g).sort();for(let N of O){let V=I.crossTileIDs[N];if(!f[V]){f[V]=!0,A.crossTileID=V;break}}}else if(I.positions)for(let O=0;O<I.positions.length;O++){let N=I.positions[O],V=I.crossTileIDs[O];if(Math.abs(N.x-L.x)<=g&&Math.abs(N.y-L.y)<=g&&!f[V]){f[V]=!0,A.crossTileID=V;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:s})=>s)}}class Xa{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Is{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(s){let u=Math.round((s-this.lng)/360);if(u!==0)for(let f in this.indexes){let g=this.indexes[f],v={};for(let A in g){let I=g[A];I.tileID=I.tileID.unwrapTo(I.tileID.wrap+u),v[I.tileID.key]=I}this.indexes[f]=v}this.lng=s}addBucket(s,u,f){if(this.indexes[s.overscaledZ]&&this.indexes[s.overscaledZ][s.key]){if(this.indexes[s.overscaledZ][s.key].bucketInstanceId===u.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(s.overscaledZ,this.indexes[s.overscaledZ][s.key])}for(let v=0;v<u.symbolInstances.length;v++)u.symbolInstances.get(v).crossTileID=0;this.usedCrossTileIDs[s.overscaledZ]||(this.usedCrossTileIDs[s.overscaledZ]={});let g=this.usedCrossTileIDs[s.overscaledZ];for(let v in this.indexes){let A=this.indexes[v];if(Number(v)>s.overscaledZ)for(let I in A){let L=A[I];L.tileID.isChildOf(s)&&L.findMatches(u.symbolInstances,s,g)}else{let I=A[s.scaledTo(Number(v)).key];I&&I.findMatches(u.symbolInstances,s,g)}}for(let v=0;v<u.symbolInstances.length;v++){let A=u.symbolInstances.get(v);A.crossTileID||(A.crossTileID=f.generate(),g[A.crossTileID]=!0)}return this.indexes[s.overscaledZ]===void 0&&(this.indexes[s.overscaledZ]={}),this.indexes[s.overscaledZ][s.key]=new gn(s,u.symbolInstances,u.bucketInstanceId),!0}removeBucketCrossTileIDs(s,u){for(let f of u.getCrossTileIDsLists())for(let g of f)delete this.usedCrossTileIDs[s][g]}removeStaleBuckets(s){let u=!1;for(let f in this.indexes){let g=this.indexes[f];for(let v in g)s[g[v].bucketInstanceId]||(this.removeBucketCrossTileIDs(f,g[v]),delete g[v],u=!0)}return u}}class Nc{constructor(){this.layerIndexes={},this.crossTileIDs=new Xa,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(s,u,f){let g=this.layerIndexes[s.id];g===void 0&&(g=this.layerIndexes[s.id]=new Is);let v=!1,A={};g.handleWrapJump(f);for(let I of u){let L=I.getBucket(s);L&&s.id===L.layerIds[0]&&(L.bucketInstanceId||(L.bucketInstanceId=++this.maxBucketInstanceId),g.addBucket(I.tileID,L,this.crossTileIDs)&&(v=!0),A[L.bucketInstanceId]=!0)}return g.removeStaleBuckets(A)&&(v=!0),v}pruneUnusedLayers(s){let u={};
21s.forEach(f=>{u[f]=!0});for(let f in this.layerIndexes)u[f]||delete this.layerIndexes[f]}}let Mr=(x,s)=>r.t(x,s&&s.filter(u=>u.identifier!=="source.canvas")),Ld=r.aw();class Vc extends r.E{constructor(s,u={}){super(),this._rtlPluginLoaded=()=>{for(let f in this.sourceCaches){let g=this.sourceCaches[f].getSource().type;g!=="vector"&&g!=="geojson"||this.sourceCaches[f].reload()}},this.map=s,this.dispatcher=new oa(As(),s._getMapId()),this.dispatcher.registerMessageHandler("GG",(f,g)=>this.getGlyphs(f,g)),this.dispatcher.registerMessageHandler("GI",(f,g)=>this.getImages(f,g)),this.imageManager=new Tt,this.imageManager.setEventedParent(this),this.glyphManager=new Bt(s._requestManager,u.localIdeographFontFamily),this.lineAtlas=new Ms(256,512),this.crossTileSymbolIndex=new Nc,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new r.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",r.ay()),ns().on(Ge,this._rtlPluginLoaded),this.on("data",f=>{if(f.dataType!=="source"||f.sourceDataType!=="metadata")return;let g=this.sourceCaches[f.sourceId];if(!g)return;let v=g.getSource();if(v&&v.vectorLayerIds)for(let A in this._layers){let I=this._layers[A];I.source===v.id&&this._validateLayer(I)}})}loadURL(s,u={},f){this.fire(new r.k("dataloading",{dataType:"style"})),u.validate=typeof u.validate!="boolean"||u.validate;let g=this.map._requestManager.transformRequest(s,"Style");this._loadStyleRequest=new AbortController;let v=this._loadStyleRequest;r.h(g,this._loadStyleRequest).then(A=>{this._loadStyleRequest=null,this._load(A.data,u,f)}).catch(A=>{this._loadStyleRequest=null,A&&!v.signal.aborted&&this.fire(new r.j(A))})}loadJSON(s,u={},f){this.fire(new r.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,T.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,u.validate=u.validate!==!1,this._load(s,u,f)}).catch(()=>{})}loadEmpty(){this.fire(new r.k("dataloading",{dataType:"style"})),this._load(Ld,{validate:!1})}_load(s,u,f){var g;let v=u.transformStyle?u.transformStyle(f,s):s;if(!u.validate||!Mr(this,r.u(v))){this._loaded=!0,this.stylesheet=v;for(let A in v.sources)this.addSource(A,v.sources[A],{validate:!1});v.sprite?this._loadSprite(v.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(v.glyphs),this._createLayers(),this.light=new Gi(this.stylesheet.light),this.sky=new Fn(this.stylesheet.sky),this.map.setTerrain((g=this.stylesheet.terrain)!==null&&g!==void 0?g:null),this.fire(new r.k("data",{dataType:"style"})),this.fire(new r.k("style.load"))}}_createLayers(){let s=r.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",s),this._order=s.map(u=>u.id),this._layers={},this._serializedLayers=null;for(let u of s){let f=r.aA(u);f.setEventedParent(this,{layer:{id:u.id}}),this._layers[u.id]=f}}_loadSprite(s,u=!1,f=void 0){let g;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(v,A,I,L){return r._(this,void 0,void 0,function*(){let O=Ke(v),N=I>1?"@2x":"",V={},G={};for(let{id:Q,url:ne}of O){let ae=A.transformRequest(rt(ne,N,".json"),"SpriteJSON");V[Q]=r.h(ae,L);let he=A.transformRequest(rt(ne,N,".png"),"SpriteImage");G[Q]=le.getImage(he,L)}return yield Promise.all([...Object.values(V),...Object.values(G)]),function(Q,ne){return r._(this,void 0,void 0,function*(){let ae={};for(let he in Q){ae[he]={};let de=T.getImageCanvasContext((yield ne[he]).data),me=(yield Q[he]).data;for(let re in me){let{width:ve,height:xe,x:Ae,y:Ne,sdf:He,pixelRatio:tt,stretchX:st,stretchY:Je,content:Qe,textFitWidth:ft,textFitHeight:zt}=me[re];ae[he][re]={data:null,pixelRatio:tt,sdf:He,stretchX:st,stretchY:Je,content:Qe,textFitWidth:ft,textFitHeight:zt,spriteData:{width:ve,height:xe,x:Ae,y:Ne,context:de}}}}return ae})}(V,G)})}(s,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(v=>{if(this._spriteRequest=null,v)for(let A in v){this._spritesImagesIds[A]=[];let I=this._spritesImagesIds[A]?this._spritesImagesIds[A].filter(L=>!(L in v)):[];for(let L of I)this.imageManager.removeImage(L),this._changedImages[L]=!0;for(let L in v[A]){let O=A==="default"?L:`${A}:${L}`;this._spritesImagesIds[A].push(O),O in this.imageManager.images?this.imageManager.updateImage(O,v[A][L],!1):this.imageManager.addImage(O,v[A][L]),u&&(this._changedImages[O]=!0)}}}).catch(v=>{this._spriteRequest=null,g=v,this.fire(new r.j(g))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),u&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new r.k("data",{dataType:"style"})),f&&f(g)})}_unloadSprite(){for(let s of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(s),this._changedImages[s]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new r.k("data",{dataType:"style"}))}_validateLayer(s){let u=this.sourceCaches[s.source];if(!u)return;let f=s.sourceLayer;if(!f)return;let g=u.getSource();(g.type==="geojson"||g.vectorLayerIds&&g.vectorLayerIds.indexOf(f)===-1)&&this.fire(new r.j(new Error(`Source layer "${f}" does not exist on source "${g.id}" as specified by style layer "${s.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let s in this.sourceCaches)if(!this.sourceCaches[s].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(s,u=!1){let f=this._serializedAllLayers();if(!s||s.length===0)return Object.values(u?r.aB(f):f);let g=[];for(let v of s)if(f[v]){let A=u?r.aB(f[v]):f[v];g.push(A)}return g}_serializedAllLayers(){let s=this._serializedLayers;if(s)return s;s=this._serializedLayers={};let u=Object.keys(this._layers);for(let f of u){let g=this._layers[f];g.type!=="custom"&&(s[f]=g.serialize())}return s}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(let s in this.sourceCaches)if(this.sourceCaches[s].hasTransition())return!0;for(let s in this._layers)if(this._layers[s].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(s){if(!this._loaded)return;let u=this._changed;if(u){let g=Object.keys(this._updatedLayers),v=Object.keys(this._removedLayers);(g.length||v.length)&&this._updateWorkerLayers(g,v);for(let A in this._updatedSources){let I=this._updatedSources[A];if(I==="reload")this._reloadSource(A);else{if(I!=="clear")throw new Error(`Invalid action ${I}`);this._clearSource(A)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let A in this._updatedPaintProps)this._layers[A].updateTransitions(s);this.light.updateTransitions(s),this.sky.updateTransitions(s),this._resetUpdates()}let f={};for(let g in this.sourceCaches){let v=this.sourceCaches[g];f[g]=v.used,v.used=!1}for(let g of this._order){let v=this._layers[g];v.recalculate(s,this._availableImages),!v.isHidden(s.zoom)&&v.source&&(this.sourceCaches[v.source].used=!0)}for(let g in f){let v=this.sourceCaches[g];!!f[g]!=!!v.used&&v.fire(new r.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:g}))}this.light.recalculate(s),this.sky.recalculate(s),this.z=s.zoom,u&&this.fire(new r.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){let s=Object.keys(this._changedImages);if(s.length){for(let u in this.sourceCaches)this.sourceCaches[u].reloadTilesForDependencies(["icons","patterns"],s);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(s,u){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(s,!1),removedIds:u})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(s,u={}){var f;this._checkLoaded();let g=this.serialize();if(s=u.transformStyle?u.transformStyle(g,s):s,((f=u.validate)===null||f===void 0||f)&&Mr(this,r.u(s)))return!1;(s=r.aB(s)).layers=r.az(s.layers);let v=r.aC(g,s),A=this._getOperationsToPerform(v);if(A.unimplemented.length>0)throw new Error(`Unimplemented: ${A.unimplemented.join(", ")}.`);
21if(A.operations.length===0)return!1;for(let I of A.operations)I();return this.stylesheet=s,this._serializedLayers=null,!0}_getOperationsToPerform(s){let u=[],f=[];for(let g of s)switch(g.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":u.push(()=>this.addLayer.apply(this,g.args));break;case"removeLayer":u.push(()=>this.removeLayer.apply(this,g.args));break;case"setPaintProperty":u.push(()=>this.setPaintProperty.apply(this,g.args));break;case"setLayoutProperty":u.push(()=>this.setLayoutProperty.apply(this,g.args));break;case"setFilter":u.push(()=>this.setFilter.apply(this,g.args));break;case"addSource":u.push(()=>this.addSource.apply(this,g.args));break;case"removeSource":u.push(()=>this.removeSource.apply(this,g.args));break;case"setLayerZoomRange":u.push(()=>this.setLayerZoomRange.apply(this,g.args));break;case"setLight":u.push(()=>this.setLight.apply(this,g.args));break;case"setGeoJSONSourceData":u.push(()=>this.setGeoJSONSourceData.apply(this,g.args));break;case"setGlyphs":u.push(()=>this.setGlyphs.apply(this,g.args));break;case"setSprite":u.push(()=>this.setSprite.apply(this,g.args));break;case"setSky":u.push(()=>this.setSky.apply(this,g.args));break;case"setTerrain":u.push(()=>this.map.setTerrain.apply(this,g.args));break;case"setTransition":u.push(()=>{});break;default:f.push(g.command)}return{operations:u,unimplemented:f}}addImage(s,u){if(this.getImage(s))return this.fire(new r.j(new Error(`An image named "${s}" already exists.`)));this.imageManager.addImage(s,u),this._afterImageUpdated(s)}updateImage(s,u){this.imageManager.updateImage(s,u)}getImage(s){return this.imageManager.getImage(s)}removeImage(s){if(!this.getImage(s))return this.fire(new r.j(new Error(`An image named "${s}" does not exist.`)));this.imageManager.removeImage(s),this._afterImageUpdated(s)}_afterImageUpdated(s){this._availableImages=this.imageManager.listImages(),this._changedImages[s]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new r.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(s,u,f={}){if(this._checkLoaded(),this.sourceCaches[s]!==void 0)throw new Error(`Source "${s}" already exists.`);if(!u.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(u).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(u.type)>=0&&this._validate(r.u.source,`sources.${s}`,u,null,f))return;this.map&&this.map._collectResourceTiming&&(u.collectResourceTiming=!0);let g=this.sourceCaches[s]=new Et(s,u,this.dispatcher);g.style=this,g.setEventedParent(this,()=>({isSourceLoaded:g.loaded(),source:g.serialize(),sourceId:s})),g.onAdd(this.map),this._changed=!0}removeSource(s){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error("There is no source with this ID");for(let f in this._layers)if(this._layers[f].source===s)return this.fire(new r.j(new Error(`Source "${s}" cannot be removed while layer "${f}" is using it.`)));let u=this.sourceCaches[s];delete this.sourceCaches[s],delete this._updatedSources[s],u.fire(new r.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:s})),u.setEventedParent(null),u.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(s,u){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error(`There is no source with this ID=${s}`);let f=this.sourceCaches[s].getSource();if(f.type!=="geojson")throw new Error(`geojsonSource.type is ${f.type}, which is !== 'geojson`);f.setData(u),this._changed=!0}getSource(s){return this.sourceCaches[s]&&this.sourceCaches[s].getSource()}addLayer(s,u,f={}){this._checkLoaded();let g=s.id;if(this.getLayer(g))return void this.fire(new r.j(new Error(`Layer "${g}" already exists on this map.`)));let v;if(s.type==="custom"){if(Mr(this,r.aD(s)))return;v=r.aA(s)}else{if("source"in s&&typeof s.source=="object"&&(this.addSource(g,s.source),s=r.aB(s),s=r.e(s,{source:g})),this._validate(r.u.layer,`layers.${g}`,s,{arrayIndex:-1},f))return;v=r.aA(s),this._validateLayer(v),v.setEventedParent(this,{layer:{id:g}})}let A=u?this._order.indexOf(u):this._order.length;if(u&&A===-1)this.fire(new r.j(new Error(`Cannot add layer "${g}" before non-existing layer "${u}".`)));else{if(this._order.splice(A,0,g),this._layerOrderChanged=!0,this._layers[g]=v,this._removedLayers[g]&&v.source&&v.type!=="custom"){let I=this._removedLayers[g];delete this._removedLayers[g],I.type!==v.type?this._updatedSources[v.source]="clear":(this._updatedSources[v.source]="reload",this.sourceCaches[v.source].pause())}this._updateLayer(v),v.onAdd&&v.onAdd(this.map)}}moveLayer(s,u){if(this._checkLoaded(),this._changed=!0,!this._layers[s])return void this.fire(new r.j(new Error(`The layer '${s}' does not exist in the map's style and cannot be moved.`)));if(s===u)return;let f=this._order.indexOf(s);this._order.splice(f,1);let g=u?this._order.indexOf(u):this._order.length;u&&g===-1?this.fire(new r.j(new Error(`Cannot move layer "${s}" before non-existing layer "${u}".`))):(this._order.splice(g,0,s),this._layerOrderChanged=!0)}removeLayer(s){this._checkLoaded();let u=this._layers[s];if(!u)return void this.fire(new r.j(new Error(`Cannot remove non-existing layer "${s}".`)));u.setEventedParent(null);let f=this._order.indexOf(s);this._order.splice(f,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[s]=u,delete this._layers[s],this._serializedLayers&&delete this._serializedLayers[s],delete this._updatedLayers[s],delete this._updatedPaintProps[s],u.onRemove&&u.onRemove(this.map)}getLayer(s){return this._layers[s]}getLayersOrder(){return[...this._order]}hasLayer(s){return s in this._layers}setLayerZoomRange(s,u,f){this._checkLoaded();let g=this.getLayer(s);g?g.minzoom===u&&g.maxzoom===f||(u!=null&&(g.minzoom=u),f!=null&&(g.maxzoom=f),this._updateLayer(g)):this.fire(new r.j(new Error(`Cannot set the zoom range of non-existing layer "${s}".`)))}setFilter(s,u,f={}){this._checkLoaded();let g=this.getLayer(s);if(g){if(!r.aE(g.filter,u))return u==null?(g.filter=void 0,void this._updateLayer(g)):void(this._val
21idate(r.u.filter,`layers.${g.id}.filter`,u,null,f)||(g.filter=r.aB(u),this._updateLayer(g)))}else this.fire(new r.j(new Error(`Cannot filter non-existing layer "${s}".`)))}getFilter(s){return r.aB(this.getLayer(s).filter)}setLayoutProperty(s,u,f,g={}){this._checkLoaded();let v=this.getLayer(s);v?r.aE(v.getLayoutProperty(u),f)||(v.setLayoutProperty(u,f,g),this._updateLayer(v)):this.fire(new r.j(new Error(`Cannot style non-existing layer "${s}".`)))}getLayoutProperty(s,u){let f=this.getLayer(s);if(f)return f.getLayoutProperty(u);this.fire(new r.j(new Error(`Cannot get style of non-existing layer "${s}".`)))}setPaintProperty(s,u,f,g={}){this._checkLoaded();let v=this.getLayer(s);v?r.aE(v.getPaintProperty(u),f)||(v.setPaintProperty(u,f,g)&&this._updateLayer(v),this._changed=!0,this._updatedPaintProps[s]=!0,this._serializedLayers=null):this.fire(new r.j(new Error(`Cannot style non-existing layer "${s}".`)))}getPaintProperty(s,u){return this.getLayer(s).getPaintProperty(u)}setFeatureState(s,u){this._checkLoaded();let f=s.source,g=s.sourceLayer,v=this.sourceCaches[f];if(v===void 0)return void this.fire(new r.j(new Error(`The source '${f}' does not exist in the map's style.`)));let A=v.getSource().type;A==="geojson"&&g?this.fire(new r.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):A!=="vector"||g?(s.id===void 0&&this.fire(new r.j(new Error("The feature id parameter must be provided."))),v.setFeatureState(g,s.id,u)):this.fire(new r.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(s,u){this._checkLoaded();let f=s.source,g=this.sourceCaches[f];if(g===void 0)return void this.fire(new r.j(new Error(`The source '${f}' does not exist in the map's style.`)));let v=g.getSource().type,A=v==="vector"?s.sourceLayer:void 0;v!=="vector"||A?u&&typeof s.id!="string"&&typeof s.id!="number"?this.fire(new r.j(new Error("A feature id is required to remove its specific state property."))):g.removeFeatureState(A,s.id,u):this.fire(new r.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(s){this._checkLoaded();let u=s.source,f=s.sourceLayer,g=this.sourceCaches[u];if(g!==void 0)return g.getSource().type!=="vector"||f?(s.id===void 0&&this.fire(new r.j(new Error("The feature id parameter must be provided."))),g.getFeatureState(f,s.id)):void this.fire(new r.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new r.j(new Error(`The source '${u}' does not exist in the map's style.`)))}getTransition(){return r.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let s=r.aF(this.sourceCaches,v=>v.serialize()),u=this._serializeByIds(this._order,!0),f=this.map.getTerrain()||void 0,g=this.stylesheet;return r.aG({version:g.version,name:g.name,metadata:g.metadata,light:g.light,sky:g.sky,center:g.center,zoom:g.zoom,bearing:g.bearing,pitch:g.pitch,sprite:g.sprite,glyphs:g.glyphs,transition:g.transition,sources:s,layers:u,terrain:f},v=>v!==void 0)}_updateLayer(s){this._updatedLayers[s.id]=!0,s.source&&!this._updatedSources[s.source]&&this.sourceCaches[s.source].getSource().type!=="raster"&&(this._updatedSources[s.source]="reload",this.sourceCaches[s.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(s){let u=A=>this._layers[A].type==="fill-extrusion",f={},g=[];for(let A=this._order.length-1;A>=0;A--){let I=this._order[A];if(u(I)){f[I]=A;for(let L of s){let O=L[I];if(O)for(let N of O)g.push(N)}}}g.sort((A,I)=>I.intersectionZ-A.intersectionZ);let v=[];for(let A=this._order.length-1;A>=0;A--){let I=this._order[A];if(u(I))for(let L=g.length-1;L>=0;L--){let O=g[L].feature;if(f[O.layer.id]<A)break;v.push(O),g.pop()}else for(let L of s){let O=L[I];if(O)for(let N of O)v.push(N.feature)}}return v}queryRenderedFeatures(s,u,f){u&&u.filter&&this._validate(r.u.filter,"queryRenderedFeatures.filter",u.filter,null,u);let g={};if(u&&u.layers){if(!Array.isArray(u.layers))return this.fire(new r.j(new Error("parameters.layers must be an Array."))),[];for(let I of u.layers){let L=this._layers[I];if(!L)return this.fire(new r.j(new Error(`The layer '${I}' does not exist in the map's style and cannot be queried for features.`))),[];g[L.source]=!0}}let v=[];u.availableImages=this._availableImages;let A=this._serializedAllLayers();for(let I in this.sourceCaches)u.layers&&!g[I]||v.push(oo(this.sourceCaches[I],this._layers,A,s,u,f));return this.placement&&v.push(function(I,L,O,N,V,G,Q){let ne={},ae=G.queryRenderedSymbols(N),he=[];for(let de of Object.keys(ae).map(Number))he.push(Q[de]);he.sort(Bn);for(let de of he){let me=de.featureIndex.lookupSymbolFeatures(ae[de.bucketInstanceId],L,de.bucketIndex,de.sourceLayerIndex,V.filter,V.layers,V.availableImages,I);for(let re in me){let ve=ne[re]=ne[re]||[],xe=me[re];xe.sort((Ae,Ne)=>{let He=de.featureSortOrder;if(He){let tt=He.indexOf(Ae.featureIndex);return He.indexOf(Ne.featureIndex)-tt}return Ne.featureIndex-Ae.featureIndex});for(let Ae of xe)ve.push(Ae)}}for(let de in ne)ne[de].forEach(me=>{let re=me.feature,ve=O[I[de].source].getFeatureState(re.layer["source-layer"],re.id);re.source=re.layer.source,re.layer["source-layer"]&&(re.sourceLayer=re.layer["source-layer"]),re.state=ve});return ne}(this._layers,A,this.sourceCaches,s,u,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(v)}
21querySourceFeatures(s,u){u&&u.filter&&this._validate(r.u.filter,"querySourceFeatures.filter",u.filter,null,u);let f=this.sourceCaches[s];return f?function(g,v){let A=g.getRenderableIds().map(O=>g.getTileByID(O)),I=[],L={};for(let O=0;O<A.length;O++){let N=A[O],V=N.tileID.canonical.key;L[V]||(L[V]=!0,N.querySourceFeatures(I,v))}return I}(f,u):[]}getLight(){return this.light.getLight()}setLight(s,u={}){this._checkLoaded();let f=this.light.getLight(),g=!1;for(let A in s)if(!r.aE(s[A],f[A])){g=!0;break}if(!g)return;let v={now:T.now(),transition:r.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(s,u),this.light.updateTransitions(v)}getSky(){var s;return(s=this.stylesheet)===null||s===void 0?void 0:s.sky}setSky(s,u={}){let f=this.getSky(),g=!1;if(!s&&!f)return;if(s&&!f)g=!0;else if(!s&&f)g=!0;else for(let A in s)if(!r.aE(s[A],f[A])){g=!0;break}if(!g)return;let v={now:T.now(),transition:r.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=s,this.sky.setSky(s,u),this.sky.updateTransitions(v)}_validate(s,u,f,g,v={}){return(!v||v.validate!==!1)&&Mr(this,s.call(r.u,r.e({key:u,style:this.serialize(),value:f,styleSpec:r.v},g)))}_remove(s=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),ns().off(Ge,this._rtlPluginLoaded);for(let u in this._layers)this._layers[u].setEventedParent(null);for(let u in this.sourceCaches){let f=this.sourceCaches[u];f.setEventedParent(null),f.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),s&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(s)}_clearSource(s){this.sourceCaches[s].clearTiles()}_reloadSource(s){this.sourceCaches[s].resume(),this.sourceCaches[s].reload()}_updateSources(s){for(let u in this.sourceCaches)this.sourceCaches[u].update(s,this.map.terrain)}_generateCollisionBoxes(){for(let s in this.sourceCaches)this._reloadSource(s)}_updatePlacement(s,u,f,g,v=!1){let A=!1,I=!1,L={};for(let O of this._order){let N=this._layers[O];if(N.type!=="symbol")continue;if(!L[N.source]){let G=this.sourceCaches[N.source];L[N.source]=G.getRenderableIds(!0).map(Q=>G.getTileByID(Q)).sort((Q,ne)=>ne.tileID.overscaledZ-Q.tileID.overscaledZ||(Q.tileID.isLessThan(ne.tileID)?-1:1))}let V=this.crossTileSymbolIndex.addLayer(N,L[N.source],s.center.lng);A=A||V}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((v=v||this._layerOrderChanged||f===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(T.now(),s.zoom))&&(this.pauseablePlacement=new Ka(s,this.map.terrain,this._order,v,u,f,g,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,L),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(T.now()),I=!0),A&&this.pauseablePlacement.placement.setStale()),I||A)for(let O of this._order){let N=this._layers[O];N.type==="symbol"&&this.placement.updateLayerOpacities(N,L[N.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(T.now())}_releaseSymbolFadeTiles(){for(let s in this.sourceCaches)this.sourceCaches[s].releaseSymbolFadeTiles()}getImages(s,u){return r._(this,void 0,void 0,function*(){let f=yield this.imageManager.getImages(u.icons);this._updateTilesForChangedImages();let g=this.sourceCaches[u.source];return g&&g.setDependencies(u.tileID.key,u.type,u.icons),f})}getGlyphs(s,u){return r._(this,void 0,void 0,function*(){let f=yield this.glyphManager.getGlyphs(u.stacks),g=this.sourceCaches[u.source];return g&&g.setDependencies(u.tileID.key,u.type,[""]),f})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(s,u={}){this._checkLoaded(),s&&this._validate(r.u.glyphs,"glyphs",s,null,u)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=s,this.glyphManager.entries={},this.glyphManager.setURL(s))}addSprite(s,u,f={},g){this._checkLoaded();let v=[{id:s,url:u}],A=[...Ke(this.stylesheet.sprite),...v];
21this._validate(r.u.sprite,"sprite",A,null,f)||(this.stylesheet.sprite=A,this._loadSprite(v,!0,g))}removeSprite(s){this._checkLoaded();let u=Ke(this.stylesheet.sprite);if(u.find(f=>f.id===s)){if(this._spritesImagesIds[s])for(let f of this._spritesImagesIds[s])this.imageManager.removeImage(f),this._changedImages[f]=!0;u.splice(u.findIndex(f=>f.id===s),1),this.stylesheet.sprite=u.length>0?u:void 0,delete this._spritesImagesIds[s],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new r.k("data",{dataType:"style"}))}else this.fire(new r.j(new Error(`Sprite "${s}" doesn't exists on this map.`)))}getSprite(){return Ke(this.stylesheet.sprite)}setSprite(s,u={},f){this._checkLoaded(),s&&this._validate(r.u.sprite,"sprite",s,null,u)||(this.stylesheet.sprite=s,s?this._loadSprite(s,!0,f):(this._unloadSprite(),f&&f(null)))}}var Lo=r.Y([{name:"a_pos",type:"Int16",components:2}]);let uo={prelude:pi(`#ifdef GL_ES
22precision mediump float;
23#else
24#if !defined(lowp)
25#define lowp
26#endif
27#if !defined(mediump)
28#define mediump
29#endif
30#if !defined(highp)
31#define highp
32#endif
33#endif
34`,`#ifdef GL_ES
35precision highp float;
36#else
37#if !defined(lowp)
38#define lowp
39#endif
40#if !defined(mediump)
41#define mediump
42#endif
43#if !defined(highp)
44#define highp
45#endif
46#endif
47vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
48);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}
49#ifdef TERRAIN3D
50uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
51#endif
52const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
53#ifdef TERRAIN3D
54highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
55#else
56return 1.0;
57#endif
58}float calculate_visibility(vec4 pos) {
59#ifdef TERRAIN3D
60vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
61#else
62return 1.0;
63#endif
64}float ele(vec2 pos) {
65#ifdef TERRAIN3D
66vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
67#else
68return 0.0;
69#endif
70}float get_elevation(vec2 pos) {
71#ifdef TERRAIN3D
72vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
73#else
74return 0.0;
75#endif
76}`),background:pi(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
77#ifdef OVERDRAW_INSPECTOR
78gl_FragColor=vec4(1.0);
79#endif
80}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:pi(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;
80uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
81#ifdef OVERDRAW_INSPECTOR
82gl_FragColor=vec4(1.0);
83#endif
84}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:pi(`varying vec3 v_data;varying float v_visibility;
85#pragma mapbox: define highp vec4 color
86#pragma mapbox: define mediump float radius
87#pragma mapbox: define lowp float blur
88#pragma mapbox: define lowp float opacity
89#pragma mapbox: define highp vec4 stroke_color
90#pragma mapbox: define mediump float stroke_width
91#pragma mapbox: define lowp float stroke_opacity
92void main() {
93#pragma mapbox: initialize highp vec4 color
94#pragma mapbox: initialize mediump float radius
95#pragma mapbox: initialize lowp float blur
96#pragma mapbox: initialize lowp float opacity
97#pragma mapbox: initialize highp vec4 stroke_color
98#pragma mapbox: initialize mediump float stroke_width
99#pragma mapbox: initialize lowp float stroke_opacity
100vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
101#ifdef OVERDRAW_INSPECTOR
102gl_FragColor=vec4(1.0);
103#endif
104}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;
105#pragma mapbox: define highp vec4 color
106#pragma mapbox: define mediump float radius
107#pragma mapbox: define lowp float blur
108#pragma mapbox: define lowp float opacity
109#pragma mapbox: define highp vec4 stroke_color
110#pragma mapbox: define mediump float stroke_width
111#pragma mapbox: define lowp float stroke_opacity
112void main(void) {
113#pragma mapbox: initialize highp vec4 color
114#pragma mapbox: initialize mediump float radius
115#pragma mapbox: initialize lowp float blur
116#pragma mapbox: initialize lowp float opacity
117#pragma mapbox: initialize highp vec4 stroke_color
118#pragma mapbox: initialize mediump float stroke_width
119#pragma mapbox: initialize lowp float stroke_opacity
120vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:pi("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:pi(`uniform highp float u_intensity;varying vec2 v_extrude;
121#pragma mapbox: define highp float weight
122#define GAUSS_COEF 0.3989422804014327
123void main() {
124#pragma mapbox: initialize highp float weight
125float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
126#ifdef OVERDRAW_INSPECTOR
127gl_FragColor=vec4(1.0);
128#endif
129}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
130#pragma mapbox: define highp float weight
131#pragma mapbox: define mediump float radius
132const highp float ZERO=1.0/255.0/16.0;
133#define GAUSS_COEF 0.3989422804014327
134void main(void) {
135#pragma mapbox: initialize highp float weight
136#pragma mapbox: initialize mediump float radius
137vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,get_elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}`),heatmapTexture:pi(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
138#ifdef OVERDRAW_INSPECTOR
139gl_FragColor=vec4(0.0);
140#endif
141}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:pi("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:pi("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd  =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz  /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:pi("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:pi(`#pragma mapbox: define highp vec4 color
142#pragma mapbox: define lowp float opacity
143void main() {
144#pragma mapbox: initialize highp vec4 color
145#pragma mapbox: initialize lowp float opacity
146gl_FragColor=color*opacity;
147#ifdef OVERDRAW_INSPECTOR
148gl_FragColor=vec4(1.0);
149#endif
150}`,`attribute vec2 a_pos;uniform mat4 u_matrix;
151#pragma mapbox: define highp vec4 color
152#pragma mapbox: define lowp float opacity
153void main() {
154#pragma mapbox: initialize highp vec4 color
155#pragma mapbox: initialize lowp float opacity
156gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:pi(`varying vec2 v_pos;
157#pragma mapbox: define highp vec4 outline_color
158#pragma mapbox: define lowp float opacity
159void main() {
160#pragma mapbox: initialize highp vec4 outline_color
161#pragma mapbox: initialize lowp float opacity
162float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
163#ifdef OVERDRAW_INSPECTOR
164gl_FragColor=vec4(1.0);
165#endif
166}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
167#pragma mapbox: define highp vec4 outline_color
168#pragma mapbox: define lowp float opacity
169void main() {
170#pragma mapbox: initialize highp vec4 outline_color
171#pragma mapbox: initialize lowp float opacity
172gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:pi(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
173#pragma mapbox: define lowp float opacity
174#pragma mapbox: define lowp vec4 pattern_from
175#pragma mapbox: define lowp vec4 pattern_to
176void main() {
177#pragma mapbox: initialize lowp float opacity
178#pragma mapbox: initialize mediump vec4 pattern_from
179#pragma mapbox: initialize mediump vec4 pattern_to
180vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
181#ifdef OVERDRAW_INSPECTOR
182gl_FragColor=vec4(1.0);
183#endif
184}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
185#pragma mapbox: define lowp float opacity
186#pragma mapbox: define lowp vec4 pattern_from
187#pragma mapbox: define lowp vec4 pattern_to
188#pragma mapbox: define lowp float pixel_ratio_from
189#pragma mapbox: define lowp float pixel_ratio_to
190void main() {
191#pragma mapbox: initialize lowp float opacity
192#pragma mapbox: initialize mediump vec4 pattern_from
193#pragma mapbox: initialize mediump vec4 pattern_to
194#pragma mapbox: initialize lowp float pixel_ratio_from
195#pragma mapbox: initialize lowp float pixel_ratio_to
196vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:pi(`#ifdef GL_ES
197precision highp float;
198#endif
199uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
200#pragma mapbox: define lowp float opacity
201#pragma mapbox: define lowp vec4 pattern_from
202#pragma mapbox: define lowp vec4 pattern_to
203void main() {
204#pragma mapbox: initialize lowp float opacity
205#pragma mapbox: initialize mediump vec4 pattern_from
206#pragma mapbox: initialize mediump vec4 pattern_to
207vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
208#ifdef OVERDRAW_INSPECTOR
209gl_FragColor=vec4(1.0);
210#endif
211}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
212#pragma mapbox: define lowp float opacity
213#pragma mapbox: define lowp vec4 pattern_from
214#pragma mapbox: define lowp vec4 pattern_to
215#pragma mapbox: define lowp float pixel_ratio_from
216#pragma mapbox: define lowp float pixel_ratio_to
217void main() {
218#pragma mapbox: initialize lowp float opacity
219#pragma mapbox: initialize mediump vec4 pattern_from
220#pragma mapbox: initialize mediump vec4 pattern_to
221#pragma mapbox: initialize lowp float pixel_ratio_from
222#pragma mapbox: initialize lowp float pixel_ratio_to
223vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:pi(`varying vec4 v_color;void main() {gl_FragColor=v_color;
224#ifdef OVERDRAW_INSPECTOR
225gl_FragColor=vec4(1.0);
226#endif
227}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
228#ifdef TERRAIN3D
229attribute vec2 a_centroid;
230#endif
231varying vec4 v_color;
232#pragma mapbox: define highp float base
233#pragma mapbox: define highp float height
234#pragma mapbox: define highp vec4 color
235void main() {
236#pragma mapbox: initialize highp float base
237#pragma mapbox: initialize highp float height
238#pragma mapbox: initialize highp vec4 color
239vec3 normal=a_normal_ed.xyz;
240#ifdef TERRAIN3D
241float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
242#else
243float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
244#endif
245base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/
24516384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:pi(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
246#pragma mapbox: define lowp float base
247#pragma mapbox: define lowp float height
248#pragma mapbox: define lowp vec4 pattern_from
249#pragma mapbox: define lowp vec4 pattern_to
250#pragma mapbox: define lowp float pixel_ratio_from
251#pragma mapbox: define lowp float pixel_ratio_to
252void main() {
253#pragma mapbox: initialize lowp float base
254#pragma mapbox: initialize lowp float height
255#pragma mapbox: initialize mediump vec4 pattern_from
256#pragma mapbox: initialize mediump vec4 pattern_to
257#pragma mapbox: initialize lowp float pixel_ratio_from
258#pragma mapbox: initialize lowp float pixel_ratio_to
259vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
260#ifdef OVERDRAW_INSPECTOR
261gl_FragColor=vec4(1.0);
262#endif
263}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
264#ifdef TERRAIN3D
265attribute vec2 a_centroid;
266#endif
267varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
268#pragma mapbox: define lowp float base
269#pragma mapbox: define lowp float height
270#pragma mapbox: define lowp vec4 pattern_from
271#pragma mapbox: define lowp vec4 pattern_to
272#pragma mapbox: define lowp float pixel_ratio_from
273#pragma mapbox: define lowp float pixel_ratio_to
274void main() {
275#pragma mapbox: initialize lowp float base
276#pragma mapbox: initialize lowp float height
277#pragma mapbox: initialize mediump vec4 pattern_from
278#pragma mapbox: initialize mediump vec4 pattern_to
279#pragma mapbox: initialize lowp float pixel_ratio_from
280#pragma mapbox: initialize lowp float pixel_ratio_to
281vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
282#ifdef TERRAIN3D
283float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
284#else
285float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
286#endif
287base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
288? a_pos
289: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:pi(`#ifdef GL_ES
290precision highp float;
291#endif
292uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
293#ifdef OVERDRAW_INSPECTOR
294gl_FragColor=vec4(1.0);
295#endif
296}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:pi(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
297#define PI 3.141592653589793
298void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;
298float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
299#ifdef OVERDRAW_INSPECTOR
300gl_FragColor=vec4(1.0);
301#endif
302}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:pi(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
303#pragma mapbox: define highp vec4 color
304#pragma mapbox: define lowp float blur
305#pragma mapbox: define lowp float opacity
306void main() {
307#pragma mapbox: initialize highp vec4 color
308#pragma mapbox: initialize lowp float blur
309#pragma mapbox: initialize lowp float opacity
310float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);
311#ifdef OVERDRAW_INSPECTOR
312gl_FragColor=vec4(1.0);
313#endif
314}`,`
315#define scale 0.015873016
316attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
317#pragma mapbox: define highp vec4 color
318#pragma mapbox: define lowp float blur
319#pragma mapbox: define lowp float opacity
320#pragma mapbox: define mediump float gapwidth
321#pragma mapbox: define lowp float offset
322#pragma mapbox: define mediump float width
323void main() {
324#pragma mapbox: initialize highp vec4 color
325#pragma mapbox: initialize lowp float blur
326#pragma mapbox: initialize lowp float opacity
327#pragma mapbox: initialize mediump float gapwidth
328#pragma mapbox: initialize lowp float offset
329#pragma mapbox: initialize mediump float width
330float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
331#ifdef TERRAIN3D
332v_gamma_scale=1.0;
333#else
334float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
335#endif
336v_width2=vec2(outset,inset);}`),lineGradient:pi(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
337#pragma mapbox: define lowp float blur
338#pragma mapbox: define lowp float opacity
339void main() {
340#pragma mapbox: initialize lowp float blur
341#pragma mapbox: initialize lowp float opacity
342float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
343#ifdef OVERDRAW_INSPECTOR
344gl_FragColor=vec4(1.0);
345#endif
346}`,`
347#define scale 0.015873016
348attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
349#pragma mapbox: define lowp float blur
350#pragma mapbox: define lowp float opacity
351#pragma mapbox: define mediump float gapwidth
352#pragma mapbox: define lowp float offset
353#pragma mapbox: define mediump float width
354void main() {
355#pragma mapbox: initialize lowp float blur
356#pragma mapbox: initialize lowp float opacity
357#pragma mapbox: initialize mediump float gapwidth
358#pragma mapbox: initialize lowp float offset
359#pragma mapbox: initialize mediump float width
360float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
361#ifdef TERRAIN3D
362v_gamma_scale=1.0;
363#else
364float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
365#endif
366v_width2=vec2(outset,inset);}`),linePattern:pi(`#ifdef GL_ES
367precision highp float;
368#endif
369uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
370#pragma mapbox: define lowp vec4 pattern_from
371#pragma mapbox: define lowp vec4 pattern_to
372#pragma mapbox: define lowp float pixel_ratio_from
373#pragma mapbox: define lowp float pixel_ratio_to
374#pragma mapbox: define lowp float blur
375#pragma mapbox: define lowp float opacity
376void main() {
377#pragma mapbox: initialize mediump vec4 pattern_from
378#pragma mapbox: initialize mediump vec4 pattern_to
379#pragma mapbox: initialize lowp float pixel_ratio_from
380#pragma mapbox: initialize lowp float pixel_ratio_to
381#pragma mapbox: initialize lowp float blur
382#pragma mapbox: initialize lowp float opacity
383vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
384#ifdef OVERDRAW_INSPECTOR
385gl_FragColor=vec4(1.0);
386#endif
387}`,`
388#define scale 0.015873016
389#define LINE_DISTANCE_SCALE 2.0
390attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
391#pragma mapbox: define lowp float blur
392#pragma mapbox: define lowp float opacity
393#pragma mapbox: define lowp float offset
394#pragma mapbox: define mediump float gapwidth
395#pragma mapbox: define mediump float width
396#pragma mapbox: define lowp float floorwidth
397#pragma mapbox: define lowp vec4 pattern_from
398#pragma mapbox: define lowp vec4 pattern_to
399#pragma mapbox: define lowp float pixel_ratio_from
400#pragma mapbox: define lowp float pixel_ratio_to
401void main() {
402#pragma mapbox: initialize lowp float blur
403#pragma mapbox: initialize lowp float opacity
404#pragma mapbox: initialize lowp float offset
405#pragma mapbox: initialize mediump float gapwidth
406#pragma mapbox: initialize mediump float width
407#pragma mapbox: initialize lowp float floorwidth
408#pragma mapbox: initialize mediump vec4 pattern_from
409#pragma mapbox: initialize mediump vec4 pattern_to
410#pragma mapbox: initialize lowp float pixel_ratio_from
411#pragma mapbox: initialize lowp float pixel_ratio_to
412float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
413#ifdef TERRAIN3D
414v_gamma_scale=1.0;
415#else
416float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
417#endif
418v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:pi(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;
418uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
419#pragma mapbox: define highp vec4 color
420#pragma mapbox: define lowp float blur
421#pragma mapbox: define lowp float opacity
422#pragma mapbox: define mediump float width
423#pragma mapbox: define lowp float floorwidth
424void main() {
425#pragma mapbox: initialize highp vec4 color
426#pragma mapbox: initialize lowp float blur
427#pragma mapbox: initialize lowp float opacity
428#pragma mapbox: initialize mediump float width
429#pragma mapbox: initialize lowp float floorwidth
430float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
431#ifdef OVERDRAW_INSPECTOR
432gl_FragColor=vec4(1.0);
433#endif
434}`,`
435#define scale 0.015873016
436#define LINE_DISTANCE_SCALE 2.0
437attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
438#pragma mapbox: define highp vec4 color
439#pragma mapbox: define lowp float blur
440#pragma mapbox: define lowp float opacity
441#pragma mapbox: define mediump float gapwidth
442#pragma mapbox: define lowp float offset
443#pragma mapbox: define mediump float width
444#pragma mapbox: define lowp float floorwidth
445void main() {
446#pragma mapbox: initialize highp vec4 color
447#pragma mapbox: initialize lowp float blur
448#pragma mapbox: initialize lowp float opacity
449#pragma mapbox: initialize mediump float gapwidth
450#pragma mapbox: initialize lowp float offset
451#pragma mapbox: initialize mediump float width
452#pragma mapbox: initialize lowp float floorwidth
453float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
454#ifdef TERRAIN3D
455v_gamma_scale=1.0;
456#else
457float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
458#endif
459v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:pi(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
460#ifdef OVERDRAW_INSPECTOR
461gl_FragColor=vec4(1.0);
462#endif
463}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:pi(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
464#pragma mapbox: define lowp float opacity
465void main() {
466#pragma mapbox: initialize lowp float opacity
467lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
468#ifdef OVERDRAW_INSPECTOR
469gl_FragColor=vec4(1.0);
470#endif
471}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
472#pragma mapbox: define lowp float opacity
473void main() {
474#pragma mapbox: initialize lowp float opacity
475vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
476camera_to_anchor_distance/u_camera_to_center_distance :
477u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:pi(`#define SDF_PX 8.0
478uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
479#pragma mapbox: define highp vec4 fill_color
480#pragma mapbox: define highp vec4 halo_color
481#pragma mapbox: define lowp float opacity
482#pragma mapbox: define lowp float halo_width
483#pragma mapbox: define lowp float halo_blur
484void main() {
485#pragma mapbox: initialize highp vec4 fill_color
486#pragma mapbox: initialize highp vec4 halo_color
487#pragma mapbox: initialize lowp float opacity
488#pragma mapbox: initialize lowp float halo_width
489#pragma mapbox: initialize lowp float halo_blur
490float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);
491#ifdef OVERDRAW_INSPECTOR
492gl_FragColor=vec4(1.0);
493#endif
494}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
495#pragma mapbox: define highp vec4 fill_color
496#pragma mapbox: define highp vec4 halo_color
497#pragma mapbox: define lowp float opacity
498#pragma mapbox: define lowp float halo_width
499#pragma mapbox: define lowp float halo_blur
500void main() {
501#pragma mapbox: initialize highp vec4 fill_color
502#pragma mapbox: initialize highp vec4 halo_color
503#pragma mapbox: initialize lowp float opacity
504#pragma mapbox: initialize lowp float halo_width
505#pragma mapbox: initialize lowp float halo_blur
506vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
507camera_to_anchor_distance/u_camera_to_center_distance :
508u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:pi(`#define SDF_PX 8.0
509#define SDF 1.0
510#define ICON 0.0
511uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
512#pragma mapbox: define highp vec4 fill_color
513#pragma mapbox: define highp vec4 halo_color
514#pragma mapbox: define lowp float opacity
515#pragma mapbox: define lowp float halo_width
516#pragma mapbox: define lowp float halo_blur
517void main() {
518#pragma mapbox: initialize highp vec4 fill_color
519#pragma mapbox: initialize highp vec4 halo_color
520#pragma mapbox: initialize lowp float opacity
521#pragma mapbox: initialize lowp float halo_width
522#pragma mapbox: initialize lowp float halo_blur
523float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;
523gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
524#ifdef OVERDRAW_INSPECTOR
525gl_FragColor=vec4(1.0);
526#endif
527return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
528#ifdef OVERDRAW_INSPECTOR
529gl_FragColor=vec4(1.0);
530#endif
531}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
532#pragma mapbox: define highp vec4 fill_color
533#pragma mapbox: define highp vec4 halo_color
534#pragma mapbox: define lowp float opacity
535#pragma mapbox: define lowp float halo_width
536#pragma mapbox: define lowp float halo_blur
537void main() {
538#pragma mapbox: initialize highp vec4 fill_color
539#pragma mapbox: initialize highp vec4 halo_color
540#pragma mapbox: initialize lowp float opacity
541#pragma mapbox: initialize lowp float halo_width
542#pragma mapbox: initialize lowp float halo_blur
543vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
544camera_to_anchor_distance/u_camera_to_center_distance :
545u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:pi("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);
545float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:pi("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:pi("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}"),sky:pi("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}","attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function pi(x,s){let u=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,f=s.match(/attribute ([\w]+) ([\w]+)/g),g=x.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),v=s.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),A=v?v.concat(g):g,I={};return{fragmentSource:x=x.replace(u,(L,O,N,V,G)=>(I[G]=!0,O==="define"?`
546#ifndef HAS_UNIFORM_u_${G}
547varying ${N} ${V} ${G};
548#else
549uniform ${N} ${V} u_${G};
550#endif
551`:`
552#ifdef HAS_UNIFORM_u_${G}
553    ${N} ${V} ${G} = u_${G};
554#endif
555`)),vertexSource:s=s.replace(u,(L,O,N,V,G)=>{let Q=V==="float"?"vec2":"vec4",ne=G.match(/color/)?"color":Q;return I[G]?O==="define"?`
556#ifndef HAS_UNIFORM_u_${G}
557uniform lowp float u_${G}_t;
558attribute ${N} ${Q} a_${G};
559varying ${N} ${V} ${G};
560#else
561uniform ${N} ${V} u_${G};
562#endif
563`:ne==="vec4"?`
564#ifndef HAS_UNIFORM_u_${G}
565    ${G} = a_${G};
566#else
567    ${N} ${V} ${G} = u_${G};
568#endif
569`:`
570#ifndef HAS_UNIFORM_u_${G}
571    ${G} = unpack_mix_${ne}(a_${G}, u_${G}_t);
572#else
573    ${N} ${V} ${G} = u_${G};
574#endif
575`:O==="define"?`
576#ifndef HAS_UNIFORM_u_${G}
577uniform lowp float u_${G}_t;
578attribute ${N} ${Q} a_${G};
579#else
580uniform ${N} ${V} u_${G};
581#endif
582`:ne==="vec4"?`
583#ifndef HAS_UNIFORM_u_${G}
584    ${N} ${V} ${G} = a_${G};
585#else
586    ${N} ${V} ${G} = u_${G};
587#endif
588`:`
589#ifndef HAS_UNIFORM_u_${G}
590    ${N} ${V} ${G} = unpack_mix_${ne}(a_${G}, u_${G}_t);
591#else
592    ${N} ${V} ${G} = u_${G};
593#endif
594`}),staticAttributes:f,staticUniforms:A}}class Ku{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(s,u,f,g,v,A,I,L,O){this.context=s;let N=this.boundPaintVertexBuffers.length!==g.length;for(let V=0;!N&&V<g.length;V++)this.boundPaintVertexBuffers[V]!==g[V]&&(N=!0);!this.vao||this.boundProgram!==u||this.boundLayoutVertexBuffer!==f||N||this.boundIndexBuffer!==v||this.boundVertexOffset!==A||this.boundDynamicVertexBuffer!==I||this.boundDynamicVertexBuffer2!==L||this.boundDynamicVertexBuffer3!==O?this.freshBind(u,f,g,v,A,I,L,O):(s.bindVertexArray.set(this.vao),I&&I.bind(),v&&v.dynamicDraw&&v.bind(),L&&L.bind(),O&&O.bind())}freshBind(s,u,f,g,v,A,I,L){let O=s.numAttributes,N=this.context,V=N.gl;this.vao&&this.destroy(),this.vao=N.createVertexArray(),N.bindVertexArray.set(this.vao),this.boundProgram=s,this.boundLayoutVertexBuffer=u,this.boundPaintVertexBuffers=f,this.boundIndexBuffer=g,this.boundVertexOffset=v,this.boundDynamicVertexBuffer=A,this.boundDynamicVertexBuffer2=I,this.boundDynamicVertexBuffer3=L,u.enableAttributes(V,s);for(let G of f)G.enableAttributes(V,s);A&&A.enableAttributes(V,s),I&&I.enableAttributes(V,s),L&&L.enableAttributes(V,s),u.bind(),u.setVertexAttribPointers(V,s,v);for(let G of f)G.bind(),G.setVertexAttribPointers(V,s,v);A&&(A.bind(),A.setVertexAttribPointers(V,s,v)),g&&g.bind(),I&&(I.bind(),I.setVertexAttribPointers(V,s,v)),L&&(L.bind(),L.setVertexAttribPointers(V,s,v)),N.currentNumAttributes=O}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}let $c=(x,s,u,f,g)=>({u_matrix:x,u_texture:0,u_ele_delta:s,u_fog_matrix:u,u_fog_color:f?f.properties.get("fog-color"):r.aM.white,u_fog_ground_blend:f?f.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:f?f.calculateFogBlendOpacity(g):0,u_horizon_color:f?f.properties.get("horizon-color"):r.aM.white,u_horizon_fog_blend:f?f.properties.get("horizon-fog-blend"):1});function Po(x){let s=[];for(let u=0;u<x.length;u++){if(x[u]===null)continue;let f=x[u].split(" ");s.push(f.pop())}return s}class $l{constructor(s,u,f,g,v,A){let I=s.gl;this.program=I.createProgram();let L=Po(u.staticAttributes),O=f?f.getBinderAttributes():[],N=L.concat(O),V=uo.prelude.staticUniforms?Po(uo.prelude.staticUniforms):[],G=u.staticUniforms?Po(u.staticUniforms):[],Q=f?f.getBinderUniforms():[],ne=V.concat(G).concat(Q),ae=[];for(let Ae of ne)ae.indexOf(Ae)<0&&ae.push(Ae);let he=f?f.defines():[];v&&he.push("#define OVERDRAW_INSPECTOR;"),A&&he.push("#define TERRAIN3D;");let de=he.concat(uo.prelude.fragmentSource,u.fragmentSource).join(`
595`),me=he.concat(uo.prelude.vertexSource,u.vertexSource).join(`
596`),re=I.createShader(I.FRAGMENT_SHADER);if(I.isContextLost())return void(this.failedToCreate=!0);if(I.shaderSource(re,de),I.compileShader(re),!I.getShaderParameter(re,I.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${I.getShaderInfoLog(re)}`);I.attachShader(this.program,re);let ve=I.createShader(I.VERTEX_SHADER);if(I.isContextLost())return void(this.failedToCreate=!0);if(I.shaderSource(ve,me),I.compileShader(ve),!I.getShaderParameter(ve,I.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${I.getShaderInfoLog(ve)}`);I.attachShader(this.program,ve),this.attributes={};let xe={};this.numAttributes=N.length;for(let Ae=0;Ae<this.numAttributes;Ae++)N[Ae]&&(I.bindAttribLocation(this.program,Ae,N[Ae]),this.attributes[N[Ae]]=Ae);if(I.linkProgram(this.program),!I.getProgramParameter(this.program,I.LINK_STATUS))throw new Error(`Program failed to link: ${I.getProgramInfoLog(this.program)}`);I.deleteShader(ve),I.deleteShader(re);for(let Ae=0;Ae<ae.length;Ae++){let Ne=ae[Ae];if(Ne&&!xe[Ne]){let He=I.getUniformLocation(this.program,Ne);He&&(xe[Ne]=He)}}this.fixedUniforms=g(s,xe),this.terrainUniforms=((Ae,Ne)=>({u_depth:new r.aH(Ae,Ne.u_depth),u_terrain:new r.aH(Ae,Ne.u_terrain),u_terrain_dim:new r.aI(Ae,Ne.u_terrain_dim),u_terrain_matrix:new r.aJ(Ae,Ne.u_terrain_matrix),u_terrain_unpack:new r.aK(Ae,Ne.u_terrain_unpack),u_terrain_exaggeration:new r.aI(Ae,Ne.u_terrain_exaggeration)}))(s,xe),this.binderUniforms=f?f.getUniforms(s,xe):[]}draw(s,u,f,g,v,A,I,L,O,N,V,G,Q,ne,ae,he,de,me){let re=s.gl;if(this.failedToCreate)return;if(s.program.set(this.program),s.setDepthMode(f),s.setStencilMode(g),s.setColorMode(v),s.setCullFace(A),L){s.activeTexture.set(re.TEXTURE2),re.bindTexture(re.TEXTURE_2D,L.depthTexture),s.activeTexture.set(re.TEXTURE3),re.bindTexture(re.TEXTURE_2D,L.texture);for(let xe in this.terrainUniforms)this.terrainUniforms[xe].set(L[xe])}for(let xe in this.fixedUniforms)this.fixedUniforms[xe].set(I[xe]);ae&&ae.setUniforms(s,this.binderUniforms,Q,{zoom:ne});let ve=0;switch(u){case re.LINES:ve=2;break;case re.TRIANGLES:ve=3;break;case re.LINE_STRIP:ve=1}for(let xe of G.get()){let Ae=xe.vaos||(xe.vaos={});(Ae[O]||(Ae[O]=new Ku)).bind(s,this,N,ae?ae.getPaintVertexBuffers():[],V,xe.vertexOffset,he,de,me),re.drawElements(u,xe.primitiveLength*ve,re.UNSIGNED_SHORT,xe.primitiveOffset*ve*2)}}}function ho(x,s,u){let f=1/ei(u,1,s.transform.tileZoom),g=Math.pow(2,u.tileID.overscaledZ
596),v=u.tileSize*Math.pow(2,s.transform.tileZoom)/g,A=v*(u.tileID.canonical.x+u.tileID.wrap*g),I=v*u.tileID.canonical.y;return{u_image:0,u_texsize:u.imageAtlasTexture.size,u_scale:[f,x.fromScale,x.toScale],u_fade:x.t,u_pixel_coord_upper:[A>>16,I>>16],u_pixel_coord_lower:[65535&A,65535&I]}}let Ya=(x,s,u,f)=>{let g=s.style.light,v=g.properties.get("position"),A=[v.x,v.y,v.z],I=function(){var O=new r.A(9);return r.A!=Float32Array&&(O[1]=0,O[2]=0,O[3]=0,O[5]=0,O[6]=0,O[7]=0),O[0]=1,O[4]=1,O[8]=1,O}();g.properties.get("anchor")==="viewport"&&function(O,N){var V=Math.sin(N),G=Math.cos(N);O[0]=G,O[1]=V,O[2]=0,O[3]=-V,O[4]=G,O[5]=0,O[6]=0,O[7]=0,O[8]=1}(I,-s.transform.angle),function(O,N,V){var G=N[0],Q=N[1],ne=N[2];O[0]=G*V[0]+Q*V[3]+ne*V[6],O[1]=G*V[1]+Q*V[4]+ne*V[7],O[2]=G*V[2]+Q*V[5]+ne*V[8]}(A,A,I);let L=g.properties.get("color");return{u_matrix:x,u_lightpos:A,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[L.r,L.g,L.b],u_vertical_gradient:+u,u_opacity:f}},Ul=(x,s,u,f,g,v,A)=>r.e(Ya(x,s,u,f),ho(v,s,A),{u_height_factor:-Math.pow(2,g.overscaledZ)/A.tileSize/8}),Ja=x=>({u_matrix:x}),Xu=(x,s,u,f)=>r.e(Ja(x),ho(u,s,f)),Pd=(x,s)=>({u_matrix:x,u_world:s}),Yu=(x,s,u,f,g)=>r.e(Xu(x,s,u,f),{u_world:g}),Dd=(x,s,u,f)=>{let g=x.transform,v,A;if(f.paint.get("circle-pitch-alignment")==="map"){let I=ei(u,1,g.zoom);v=!0,A=[I,I]}else v=!1,A=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(f.paint.get("circle-pitch-scale")==="map"),u_matrix:x.translatePosMatrix(s.posMatrix,u,f.paint.get("circle-translate"),f.paint.get("circle-translate-anchor")),u_pitch_with_map:+v,u_device_pixel_ratio:x.pixelRatio,u_extrude_scale:A}},la=(x,s,u)=>({u_matrix:x,u_inv_matrix:s,u_camera_to_center_distance:u.cameraToCenterDistance,u_viewport_size:[u.width,u.height]}),jl=(x,s,u=1)=>({u_matrix:x,u_color:s,u_overlay:0,u_overlay_scale:u}),Ar=x=>({u_matrix:x}),_r=(x,s,u,f)=>({u_matrix:x,u_extrude_scale:ei(s,1,u),u_intensity:f}),Uc=(x,s,u,f)=>{let g=r.H();r.aP(g,0,x.width,x.height,0,0,1);let v=x.context.gl;return{u_matrix:g,u_world:[v.drawingBufferWidth,v.drawingBufferHeight],u_image:u,u_color_ramp:f,u_opacity:s.paint.get("heatmap-opacity")}};function jc(x,s){let u=Math.pow(2,s.canonical.z),f=s.canonical.y;return[new r.Z(0,f/u).toLngLat().lat,new r.Z(0,(f+1)/u).toLngLat().lat]}let qc=(x,s,u,f)=>{let g=x.transform;return{u_matrix:Od(x,s,u,f),u_ratio:1/ei(s,1,g.zoom),u_device_pixel_ratio:x.pixelRatio,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},Rd=(x,s,u,f,g)=>r.e(qc(x,s,u,g),{u_image:0,u_image_height:f}),Do=(x,s,u,f,g)=>{let v=x.transform,A=zd(s,v);return{u_matrix:Od(x,s,u,g),u_texsize:s.imageAtlasTexture.size,u_ratio:1/ei(s,1,v.zoom),u_device_pixel_ratio:x.pixelRatio,u_image:0,u_scale:[A,f.fromScale,f.toScale],u_fade:f.t,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]]}},_f=(x,s,u,f,g,v)=>{let A=x.lineAtlas,I=zd(s,x.transform),L=u.layout.get("line-cap")==="round",O=A.getDash(f.from,L),N=A.getDash(f.to,L),V=O.width*g.fromScale,G=N.width*g.toScale;return r.e(qc(x,s,u,v),{u_patternscale_a:[I/V,-O.height/2],u_patternscale_b:[I/G,-N.height/2],u_sdfgamma:A.width/(256*Math.min(V,G)*x.pixelRatio)/2,u_image:0,u_tex_y_a:O.y,u_tex_y_b:N.y,u_mix:g.t})};function zd(x,s){return 1/ei(x,1,s.tileZoom)}function Od(x,s,u,f){return x.translatePosMatrix(f?f.posMatrix:s.tileID.posMatrix,s,u.paint.get("line-translate"),u.paint.get("line-translate-anchor"))}let vf=(x,s,u,f,g)=>{return{u_matrix:x,u_tl_parent:s,u_scale_parent:u,u_buffer_scale:1,u_fade_t:f.mix,u_opacity:f.opacity*g.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:g.paint.get("raster-brightness-min"),u_brightness_high:g.paint.get("raster-brightness-max"),u_saturation_factor:(A=g.paint.get("raster-saturation"),A>0?1-1/(1.001-A):-A),u_contrast_factor:(v=g.paint.get("raster-contrast"),v>0?1/(1-v):1+v),u_spin_weights:bf(g.paint.get("raster-hue-rotate"))};var v,A};function bf(x){x*=Math.PI/180;let s=Math.sin(x),u=Math.cos(x);return[(2*u+1)/3,(-Math.sqrt(3)*s-u+1)/3,(Math.sqrt(3)*s-u+1)/3]}let Zi=(x,s,u,f,g,v,A,I,L,O,N,V,G,Q)=>{let ne=A.transform;return{u_is_size_zoom_constant:+(x==="constant"||x==="source"),u_is_size_feature_constant:+(x==="constant"||x==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:ne.cameraToCenterDistance,u_pitch:ne.pitch/360*2*Math.PI,u_rotate_symbol:+u,u_aspect_ratio:ne.width/ne.height,u_fade_change:A.options.fadeDuration?A.symbolFadeChange:1,u_matrix:I,u_label_plane_matrix:L,u_coord_matrix:O,u_is_text:+V,u_pitch_with_map:+f,u_is_along_line:g,u_is_variable_anchor:v,u_texsize:G,u_texture:0,u_translation:N,u_pitched_scale:Q}},Ii=(x,s,u,f,g,v,A,I,L,O,N,V,G,Q,ne)=>{let ae=A.transform;return r.e(Zi(x,s,u,f,g,v,A,I,L,O,N,V,G,ne),{u_gamma_scale:f?Math.cos(ae._pitch)*ae.cameraToCenterDistance:1,u_device_pixel_ratio:A.pixelRatio,u_is_halo:+Q})},Ju=(x,s,u,f,g,v,A,I,L,O,N,V,G,Q)=>r.e(Ii(x,s,u,f,g,v,A,I,L,O,N,!0,V,!0,Q),{u_texsize_icon:G,u_texture_icon:1}),Hc=(x,s,u)=>({u_matrix:x,u_opacity:s,u_color:u}),Qu=(x,s,u,f,g,v)=>r.e(function(A,I,L,O){let N=L.imageManager.getPattern(A.from.toString()),V=L.imageManager.getPattern(A.to.toString()),{width:G,height:Q}=L.imageManager.getPixelSize(),ne=Math.pow(2,O.tileID.overscaledZ
vendor: 5,998 bytes, line 596
596),ae=O.tileSize*Math.pow(2,L.transform.tileZoom)/ne,he=ae*(O.tileID.canonical.x+O.tileID.wrap*ne),de=ae*O.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:N.tl,u_pattern_br_a:N.br,u_pattern_tl_b:V.tl,u_pattern_br_b:V.br,u_texsize:[G,Q],u_mix:I.t,u_pattern_size_a:N.displaySize,u_pattern_size_b:V.displaySize,u_scale_a:I.fromScale,u_scale_b:I.toScale,u_tile_units_to_pixels:1/ei(O,1,L.transform.tileZoom),u_pixel_coord_upper:[he>>16,de>>16],u_pixel_coord_lower:[65535&he,65535&de]}}(f,v,u,g),{u_matrix:x,u_opacity:s}),eh={fillExtrusion:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_lightpos:new r.aN(x,s.u_lightpos),u_lightintensity:new r.aI(x,s.u_lightintensity),u_lightcolor:new r.aN(x,s.u_lightcolor),u_vertical_gradient:new r.aI(x,s.u_vertical_gradient),u_opacity:new r.aI(x,s.u_opacity)}),fillExtrusionPattern:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_lightpos:new r.aN(x,s.u_lightpos),u_lightintensity:new r.aI(x,s.u_lightintensity),u_lightcolor:new r.aN(x,s.u_lightcolor),u_vertical_gradient:new r.aI(x,s.u_vertical_gradient),u_height_factor:new r.aI(x,s.u_height_factor),u_image:new r.aH(x,s.u_image),u_texsize:new r.aO(x,s.u_texsize),u_pixel_coord_upper:new r.aO(x,s.u_pixel_coord_upper),u_pixel_coord_lower:new r.aO(x,s.u_pixel_coord_lower),u_scale:new r.aN(x,s.u_scale),u_fade:new r.aI(x,s.u_fade),u_opacity:new r.aI(x,s.u_opacity)}),fill:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix)}),fillPattern:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_image:new r.aH(x,s.u_image),u_texsize:new r.aO(x,s.u_texsize),u_pixel_coord_upper:new r.aO(x,s.u_pixel_coord_upper),u_pixel_coord_lower:new r.aO(x,s.u_pixel_coord_lower),u_scale:new r.aN(x,s.u_scale),u_fade:new r.aI(x,s.u_fade)}),fillOutline:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_world:new r.aO(x,s.u_world)}),fillOutlinePattern:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_world:new r.aO(x,s.u_world),u_image:new r.aH(x,s.u_image),u_texsize:new r.aO(x,s.u_texsize),u_pixel_coord_upper:new r.aO(x,s.u_pixel_coord_upper),u_pixel_coord_lower:new r.aO(x,s.u_pixel_coord_lower),u_scale:new r.aN(x,s.u_scale),u_fade:new r.aI(x,s.u_fade)}),circle:(x,s)=>({u_camera_to_center_distance:new r.aI(x,s.u_camera_to_center_distance),u_scale_with_map:new r.aH(x,s.u_scale_with_map),u_pitch_with_map:new r.aH(x,s.u_pitch_with_map),u_extrude_scale:new r.aO(x,s.u_extrude_scale),u_device_pixel_ratio:new r.aI(x,s.u_device_pixel_ratio),u_matrix:new r.aJ(x,s.u_matrix)}),collisionBox:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_pixel_extrude_scale:new r.aO(x,s.u_pixel_extrude_scale)}),collisionCircle:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_inv_matrix:new r.aJ(x,s.u_inv_matrix),u_camera_to_center_distance:new r.aI(x,s.u_camera_to_center_distance),u_viewport_size:new r.aO(x,s.u_viewport_size)}),debug:(x,s)=>({u_color:new r.aL(x,s.u_color),u_matrix:new r.aJ(x,s.u_matrix),u_overlay:new r.aH(x,s.u_overlay),u_overlay_scale:new r.aI(x,s.u_overlay_scale)}),clippingMask:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix)}),heatmap:(x,s)=>({u_extrude_scale:new r.aI(x,s.u_extrude_scale),u_intensity:new r.aI(x,s.u_intensity),u_matrix:new r.aJ(x,s.u_matrix)}),heatmapTexture:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_world:new r.aO(x,s.u_world),u_image:new r.aH(x,s.u_image),u_color_ramp:new r.aH(x,s.u_color_ramp),u_opacity:new r.aI(x,s.u_opacity)}),hillshade:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_image:new r.aH(x,s.u_image),u_latrange:new r.aO(x,s.u_latrange),u_light:new r.aO(x,s.u_light),u_shadow:new r.aL(x,s.u_shadow),u_highlight:new r.aL(x,s.u_highlight),u_accent:new r.aL(x,s.u_accent)}),hillshadePrepare:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_image:new r.aH(x,s.u_image),u_dimension:new r.aO(x,s.u_dimension),u_zoom:new r.aI(x,s.u_zoom),u_unpack:new r.aK(x,s.u_unpack)}),line:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_ratio:new r.aI(x,s.u_ratio),u_device_pixel_ratio:new r.aI(x,s.u_device_pixel_ratio),u_units_to_pixels:new r.aO(x,s.u_units_to_pixels)}),lineGradient:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_ratio:new r.aI(x,s.u_ratio),u_device_pixel_ratio:new r.aI(x,s.u_device_pixel_ratio),u_units_to_pixels:new r.aO(x,s.u_units_to_pixels),u_image:new r.aH(x,s.u_image),u_image_height:new r.aI(x,s.u_image_height)}),linePattern:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_texsize:new r.aO(x,s.u_texsize),u_ratio:new r.aI(x,s.u_ratio),u_device_pixel_ratio:new r.aI(x,s.u_device_pixel_ratio),u_image:new r.aH(x,s.u_image),u_units_to_pixels:new r.aO(x,s.u_units_to_pixels),u_scale:new r.aN(x,s.u_scale),u_fade:new r.aI(x,s.u_fade)}),lineSDF:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_ratio:new r.aI(x,s.u_ratio),u_device_pixel_ratio:new r.aI(x,s.u_device_pixel_ratio),u_units_to_pixels:new r.aO(x,s.u_units_to_pixels),u_patternscale_a:new r.aO(x,s.u_patternscale_a),u_patternscale_b:new r.aO(x,s.u_patternscale_b),u_sdfgamma:new r.aI(x,s.u_sdfgamma),u_image:new r.aH(x,s.u_image),u_tex_y_a:new r.aI(x,s.u_tex_y_a),u_tex_y_b:new r.aI(x,s.u_tex_y_b),u_mix:new r.aI(x,s.u_mix)}),raster:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_tl_parent:new r.aO(x,s.u_tl_parent),u_scale_parent:new r.aI(x,s.u_scale_parent),u_buffer_scale:new r.aI(x,s.u_buffer_scale),u_fade_t:new r.aI(x,s.u_fade_t),u_opacity:new r.aI(x,s.u_opacity),u_image0:new r.aH(x,s.u_image0),u_image1:new r.aH(x,s.u_image1),u_brightness_low:new r.aI(x,s.u_brightness_low),u_brightness_high:new r.aI(x,s.u_brightness_high),u_saturation_factor:new r.aI(x,s.u_saturation_factor),u_contrast_factor:new r.aI(x,s.u_contrast_factor),u_spin_weights:new r.aN(x,s.u_spin_weights)}),symbolIcon:(x,s)=>({u_is_size_zoom_constant:new r.aH(x,s.u_is_size_zoom_constant),u_is_size_feature_constant:new r.aH(x,s.u_is_size_feature_constant),u_size_t:new r.aI(x,s.u_size_t),u_size:new r.aI(x,s.u_size),u_camera_to_center_distance:new r.aI(x,s.u_camera_to_center_distance),u_pitch:new r.aI(x,s.u_pitch),u_rotate_symbol:new r.aH(x,s.u_rotate_symbol),u_aspect_ratio:new r.aI(x,s.u_aspect_ratio),u_fade_change:new r.aI(x,s.u_fade_change),u_matrix:new r.aJ(x,s.u_matrix),u_label_plane_matrix:new r.aJ(x,s.u_label_plane_matrix
596),u_coord_matrix:new r.aJ(x,s.u_coord_matrix),u_is_text:new r.aH(x,s.u_is_text),u_pitch_with_map:new r.aH(x,s.u_pitch_with_map),u_is_along_line:new r.aH(x,s.u_is_along_line),u_is_variable_anchor:new r.aH(x,s.u_is_variable_anchor),u_texsize:new r.aO(x,s.u_texsize),u_texture:new r.aH(x,s.u_texture),u_translation:new r.aO(x,s.u_translation),u_pitched_scale:new r.aI(x,s.u_pitched_scale)}),symbolSDF:(x,s)=>({u_is_size_zoom_constant:new r.aH(x,s.u_is_size_zoom_constant),u_is_size_feature_constant:new r.aH(x,s.u_is_size_feature_constant),u_size_t:new r.aI(x,s.u_size_t),u_size:new r.aI(x,s.u_size),u_camera_to_center_distance:new r.aI(x,s.u_camera_to_center_distance),u_pitch:new r.aI(x,s.u_pitch),u_rotate_symbol:new r.aH(x,s.u_rotate_symbol),u_aspect_ratio:new r.aI(x,s.u_aspect_ratio),u_fade_change:new r.aI(x,s.u_fade_change),u_matrix:new r.aJ(x,s.u_matrix),u_label_plane_matrix:new r.aJ(x,s.u_label_plane_matrix),u_coord_matrix:new r.aJ(x,s.u_coord_matrix),u_is_text:new r.aH(x,s.u_is_text),u_pitch_with_map:new r.aH(x,s.u_pitch_with_map),u_is_along_line:new r.aH(x,s.u_is_along_line),u_is_variable_anchor:new r.aH(x,s.u_is_variable_anchor),u_texsize:new r.aO(x,s.u_texsize),u_texture:new r.aH(x,s.u_texture),u_gamma_scale:new r.aI(x,s.u_gamma_scale),u_device_pixel_ratio:new r.aI(x,s.u_device_pixel_ratio),u_is_halo:new r.aH(x,s.u_is_halo),u_translation:new r.aO(x,s.u_translation),u_pitched_scale:new r.aI(x,s.u_pitched_scale)}),symbolTextAndIcon:(x,s)=>({u_is_size_zoom_constant:new r.aH(x,s.u_is_size_zoom_constant),u_is_size_feature_constant:new r.aH(x,s.u_is_size_feature_constant),u_size_t:new r.aI(x,s.u_size_t),u_size:new r.aI(x,s.u_size),u_camera_to_center_distance:new r.aI(x,s.u_camera_to_center_distance),u_pitch:new r.aI(x,s.u_pitch),u_rotate_symbol:new r.aH(x,s.u_rotate_symbol),u_aspect_ratio:new r.aI(x,s.u_aspect_ratio),u_fade_change:new r.aI(x,s.u_fade_change),u_matrix:new r.aJ(x,s.u_matrix),u_label_plane_matrix:new r.aJ(x,s.u_label_plane_matrix),u_coord_matrix:new r.aJ(x,s.u_coord_matrix),u_is_text:new r.aH(x,s.u_is_text),u_pitch_with_map:new r.aH(x,s.u_pitch_with_map),u_is_along_line:new r.aH(x,s.u_is_along_line),u_is_variable_anchor:new r.aH(x,s.u_is_variable_anchor),u_texsize:new r.aO(x,s.u_texsize),u_texsize_icon:new r.aO(x,s.u_texsize_icon),u_texture:new r.aH(x,s.u_texture),u_texture_icon:new r.aH(x,s.u_texture_icon),u_gamma_scale:new r.aI(x,s.u_gamma_scale),u_device_pixel_ratio:new r.aI(x,s.u_device_pixel_ratio),u_is_halo:new r.aH(x,s.u_is_halo),u_translation:new r.aO(x,s.u_translation),u_pitched_scale:new r.aI(x,s.u_pitched_scale)}),background:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_opacity:new r.aI(x,s.u_opacity),u_color:new r.aL(x,s.u_color)}),backgroundPattern:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_opacity:new r.aI(x,s.u_opacity),u_image:new r.aH(x,s.u_image),u_pattern_tl_a:new r.aO(x,s.u_pattern_tl_a),u_pattern_br_a:new r.aO(x,s.u_pattern_br_a),u_pattern_tl_b:new r.aO(x,s.u_pattern_tl_b),u_pattern_br_b:new r.aO(x,s.u_pattern_br_b),u_texsize:new r.aO(x,s.u_texsize),u_mix:new r.aI(x,s.u_mix),u_pattern_size_a:new r.aO(x,s.u_pattern_size_a),u_pattern_size_b:new r.aO(x,s.u_pattern_size_b),u_scale_a:new r.aI(x,s.u_scale_a),u_scale_b:new r.aI(x,s.u_scale_b),u_pixel_coord_upper:new r.aO(x,s.u_pixel_coord_upper),u_pixel_coord_lower:new r.aO(x,s.u_pixel_coord_lower),u_tile_units_to_pixels:new r.aI(x,s.u_tile_units_to_pixels)}),terrain:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_texture:new r.aH(x,s.u_texture),u_ele_delta:new r.aI(x,s.u_ele_delta),u_fog_matrix:new r.aJ(x,s.u_fog_matrix),u_fog_color:new r.aL(x,s.u_fog_color),u_fog_ground_blend:new r.aI(x,s.u_fog_ground_blend),u_fog_ground_blend_opacity:new r.aI(x,s.u_fog_ground_blend_opacity),u_horizon_color:new r.aL(x,s.u_horizon_color),u_horizon_fog_blend:new r.aI(x,s.u_horizon_fog_blend)}),terrainDepth:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_ele_delta:new r.aI(x,s.u_ele_delta)}),terrainCoords:(x,s)=>({u_matrix:new r.aJ(x,s.u_matrix),u_texture:new r.aH(x,s.u_texture),u_terrain_coords_id:new r.aI(x,s.u_terrain_coords_id),u_ele_delta:new r.aI(x,s.u_ele_delta)}),sky:(x,s)=>({u_sky_color:new r.aL(x,s.u_sky_color),u_horizon_color:new r.aL(x,s.u_horizon_color),u_horizon:new r.aI(x,s.u_horizon),u_sky_horizon_blend:new r.aI(x,s.u_sky_horizon_blend)})};class Zs{constructor(s,u,f){this.context=s;let g=s.gl;this.buffer=g.createBuffer(),this.dynamicDraw=!!f,this.context.unbindVAO(),s.bindElementBuffer.set(this.buffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(s){let 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,s.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let xf={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Wc{constructor(s,u,f,g){this.length=u.length,this.attributes=f,this.itemSize=u.bytesPerElement,this.dynamicDraw=g,this.context=s;let v=s.gl;this.buffer=v.createBuffer(),s.bindVertexBuffer.set(this.buffer),v.bufferData(v.ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?v.DYNAMIC_DRAW:v.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(s){if(s.length!==this.length)throw new Error(`Length of new data is ${s.length}, which doesn't match current length of ${this.length}`);let u=this.context.gl;this.bind(),u.bufferSubData(u.ARRAY_BUFFER,0,s.arrayBuffer)}
596enableAttributes(s,u){for(let f=0;f<this.attributes.length;f++){let g=u.attributes[this.attributes[f].name];g!==void 0&&s.enableVertexAttribArray(g)}}setVertexAttribPointers(s,u,f){for(let g=0;g<this.attributes.length;g++){let v=this.attributes[g],A=u.attributes[v.name];A!==void 0&&s.vertexAttribPointer(A,v.components,s[xf[v.type]],!1,this.itemSize,v.offset+this.itemSize*(f||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let ca=new WeakMap;function Qi(x){var s;if(ca.has(x))return ca.get(x);{let u=(s=x.getParameter(x.VERSION))===null||s===void 0?void 0:s.startsWith("WebGL 2.0");return ca.set(x,u),u}}class _i{constructor(s){this.gl=s.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(s){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Ks extends _i{getDefault(){return r.aM.transparent}set(s){let u=this.current;(s.r!==u.r||s.g!==u.g||s.b!==u.b||s.a!==u.a||this.dirty)&&(this.gl.clearColor(s.r,s.g,s.b,s.a),this.current=s,this.dirty=!1)}}class Fd extends _i{getDefault(){return 1}set(s){(s!==this.current||this.dirty)&&(this.gl.clearDepth(s),this.current=s,this.dirty=!1)}}class Ro extends _i{getDefault(){return 0}set(s){(s!==this.current||this.dirty)&&(this.gl.clearStencil(s),this.current=s,this.dirty=!1)}}class ss extends _i{getDefault(){return[!0,!0,!0,!0]}set(s){let u=this.current;(s[0]!==u[0]||s[1]!==u[1]||s[2]!==u[2]||s[3]!==u[3]||this.dirty)&&(this.gl.colorMask(s[0],s[1],s[2],s[3]),this.current=s,this.dirty=!1)}}class th extends _i{getDefault(){return!0}set(s){(s!==this.current||this.dirty)&&(this.gl.depthMask(s),this.current=s,this.dirty=!1)}}class Bd extends _i{getDefault(){return 255}set(s){(s!==this.current||this.dirty)&&(this.gl.stencilMask(s),this.current=s,this.dirty=!1)}}class ih extends _i{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(s){let u=this.current;(s.func!==u.func||s.ref!==u.ref||s.mask!==u.mask||this.dirty)&&(this.gl.stencilFunc(s.func,s.ref,s.mask),this.current=s,this.dirty=!1)}}class Gc extends _i{getDefault(){let s=this.gl;return[s.KEEP,s.KEEP,s.KEEP]}set(s){let u=this.current;(s[0]!==u[0]||s[1]!==u[1]||s[2]!==u[2]||this.dirty)&&(this.gl.stencilOp(s[0],s[1],s[2]),this.current=s,this.dirty=!1)}}class nh extends _i{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;let u=this.gl;s?u.enable(u.STENCIL_TEST):u.disable(u.STENCIL_TEST),this.current=s,this.dirty=!1}}class rh extends _i{getDefault(){return[0,1]}set(s){let u=this.current;(s[0]!==u[0]||s[1]!==u[1]||this.dirty)&&(this.gl.depthRange(s[0],s[1]),this.current=s,this.dirty=!1)}}class Er extends _i{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;let u=this.gl;s?u.enable(u.DEPTH_TEST):u.disable(u.DEPTH_TEST),this.current=s,this.dirty=!1}}class Nd extends _i{getDefault(){return this.gl.LESS}set(s){(s!==this.current||this.dirty)&&(this.gl.depthFunc(s),this.current=s,this.dirty=!1)}}class $n extends _i{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;let u=this.gl;s?u.enable(u.BLEND):u.disable(u.BLEND),this.current=s,this.dirty=!1}}class Vd extends _i{getDefault(){let s=this.gl;return[s.ONE,s.ZERO]}set(s){let u=this.current;(s[0]!==u[0]||s[1]!==u[1]||this.dirty)&&(this.gl.blendFunc(s[0],s[1]),this.current=s,this.dirty=!1)}}class $d extends _i{getDefault(){return r.aM.transparent}set(s){let u=this.current;(s.r!==u.r||s.g!==u.g||s.b!==u.b||s.a!==u.a||this.dirty)&&(this.gl.blendColor(s.r,s.g,s.b,s.a),this.current=s,this.dirty=!1)}}class po extends _i{getDefault(){return this.gl.FUNC_ADD}set(s){(s!==this.current||this.dirty)&&(this.gl.blendEquation(s),this.current=s,this.dirty=!1)}}class zo extends _i{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;let u=this.gl;s?u.enable(u.CULL_FACE):u.disable(u.CULL_FACE),this.current=s,this.dirty=!1}}class sh extends _i{getDefault(){return this.gl.BACK}set(s){(s!==this.current||this.dirty)&&(this.gl.cullFace(s),this.current=s,this.dirty=!1)}}class ji extends _i{getDefault(){return this.gl.CCW}set(s){(s!==this.current||this.dirty)&&(this.gl.frontFace(s),this.current=s,this.dirty=!1)}}class Oo extends _i{getDefault(){return null}set(s){(s!==this.current||this.dirty)&&(this.gl.useProgram(s),this.current=s,this.dirty=!1)}}class oh extends _i{getDefault(){return this.gl.TEXTURE0}set(s){(s!==this.current||this.dirty)&&(this.gl.activeTexture(s),this.current=s,this.dirty=!1)}}class Ud extends _i{getDefault(){let s=this.gl;return[0,0,s.drawingBufferWidth,s.drawingBufferHeight]}set(s){let u=this.current;(s[0]!==u[0]||s[1]!==u[1]||s[2]!==u[2]||s[3]!==u[3]||this.dirty)&&(this.gl.viewport(s[0],s[1],s[2],s[3]),this.current=s,this.dirty=!1)}}class Zc extends _i{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;let u=this.gl;u.bindFramebuffer(u.FRAMEBUFFER,s),this.current=s,this.dirty=!1}}class jd extends _i{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;let u=this.gl;u.bindRenderbuffer(u.RENDERBUFFER,s),this.current=s,this.dirty=!1}}class ah extends _i{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;let u=this.gl;u.bindTexture(u.TEXTURE_2D,s),this.current=s,this.dirty=!1}}class qd extends _i{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;let u=this.gl;u.bindBuffer(u.ARRAY_BUFFER,s),this.current=s,this.dirty=!1}}class ql extends _i{getDefault(){return null}set(s){let u=this.gl;u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,s),this.current=s,this.dirty=!1}}class os extends _i{getDefault(){return null}set(s){var u;if(s===this.current&&!this.dirty)return;let f=this.gl;Qi(f)?f.bindVertexArray(s):(u=f.getExtension("OES_vertex_array_object"))===null||u===void 0||u.bindVertexArrayOES(s),this.current=s,this.dirty=!1}}class Fo extends _i{getDefault(){return 4}set(s){if(s===this.current&&!this.dirty)return;let u=this.gl;u.pixelStorei(u.UNPACK_ALIGNMENT,s),this.current=s,this.dirty=!1}}class lh extends _i{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;let u=this.gl;u.pixelStorei(u.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s),this.current=s,this.dirty=!1}}class Kc extends _i{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;let u=this.gl;u.pixelStorei(u.UNPACK_FLIP_Y_WEBGL,s),this.current=s,this.dirty=!1}}class Hl extends _i{constructor(s,u){super(s),this.context=s,this.parent=u}getDefault(){return null}}class Wl extends Hl{setDirty(){this.dirty=!0}set(s){if(s===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let u=this.gl;u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_2D,s,0),this.current=s,this.dirty=!1}}class fo extends Hl{set(s){if(s===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let u=this.gl;u.framebufferRenderbuffer(u.FRAMEBUFFER,u.DEPTH_ATTACHMENT,u.RENDERBUFFER,s),this.current=s,this.dirty=!1}}class Xc extends Hl{set(s){if(s===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let u=this.gl;u.framebufferRenderbuffer(u.FRAMEBUFFER,u.DEPTH_STENCIL_ATTACHMENT,u.RENDERBUFFER,s),this.current=s,this.dirty=!1}}class wf{constructor(s,u,f,g,v){this.context=s,this.width=u,this.height=f;let A=s.gl,I=this.framebuffer=A.createFramebuffer();
vendor: 5,391 bytes, line 596
596if(this.colorAttachment=new Wl(s,I),g)this.depthAttachment=v?new Xc(s,I):new fo(s,I);else if(v)throw new Error("Stencil cannot be set without depth");if(A.checkFramebufferStatus(A.FRAMEBUFFER)!==A.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){let s=this.context.gl,u=this.colorAttachment.get();if(u&&s.deleteTexture(u),this.depthAttachment){let f=this.depthAttachment.get();f&&s.deleteRenderbuffer(f)}s.deleteFramebuffer(this.framebuffer)}}class nn{constructor(s,u,f){this.blendFunction=s,this.blendColor=u,this.mask=f}}nn.Replace=[1,0],nn.disabled=new nn(nn.Replace,r.aM.transparent,[!1,!1,!1,!1]),nn.unblended=new nn(nn.Replace,r.aM.transparent,[!0,!0,!0,!0]),nn.alphaBlended=new nn([1,771],r.aM.transparent,[!0,!0,!0,!0]);class ch{constructor(s){var u,f;if(this.gl=s,this.clearColor=new Ks(this),this.clearDepth=new Fd(this),this.clearStencil=new Ro(this),this.colorMask=new ss(this),this.depthMask=new th(this),this.stencilMask=new Bd(this),this.stencilFunc=new ih(this),this.stencilOp=new Gc(this),this.stencilTest=new nh(this),this.depthRange=new rh(this),this.depthTest=new Er(this),this.depthFunc=new Nd(this),this.blend=new $n(this),this.blendFunc=new Vd(this),this.blendColor=new $d(this),this.blendEquation=new po(this),this.cullFace=new zo(this),this.cullFaceSide=new sh(this),this.frontFace=new ji(this),this.program=new Oo(this),this.activeTexture=new oh(this),this.viewport=new Ud(this),this.bindFramebuffer=new Zc(this),this.bindRenderbuffer=new jd(this),this.bindTexture=new ah(this),this.bindVertexBuffer=new qd(this),this.bindElementBuffer=new ql(this),this.bindVertexArray=new os(this),this.pixelStoreUnpack=new Fo(this),this.pixelStoreUnpackPremultiplyAlpha=new lh(this),this.pixelStoreUnpackFlipY=new Kc(this),this.extTextureFilterAnisotropic=s.getExtension("EXT_texture_filter_anisotropic")||s.getExtension("MOZ_EXT_texture_filter_anisotropic")||s.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=s.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=s.getParameter(s.MAX_TEXTURE_SIZE),Qi(s)){this.HALF_FLOAT=s.HALF_FLOAT;let g=s.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(u=s.RGBA16F)!==null&&u!==void 0?u:g?.RGBA16F_EXT,this.RGB16F=(f=s.RGB16F)!==null&&f!==void 0?f:g?.RGB16F_EXT,s.getExtension("EXT_color_buffer_float")}else{s.getExtension("EXT_color_buffer_half_float"),s.getExtension("OES_texture_half_float_linear");let g=s.getExtension("OES_texture_half_float");this.HALF_FLOAT=g?.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(s,u){return new Zs(this,s,u)}createVertexBuffer(s,u,f){return new Wc(this,s,u,f)}createRenderbuffer(s,u,f){let g=this.gl,v=g.createRenderbuffer();return this.bindRenderbuffer.set(v),g.renderbufferStorage(g.RENDERBUFFER,s,u,f),this.bindRenderbuffer.set(null),v}createFramebuffer(s,u,f,g){return new wf(this,s,u,f,g)}clear({color:s,depth:u,stencil:f}){let g=this.gl,v=0;s&&(v|=g.COLOR_BUFFER_BIT,this.clearColor.set(s),this.colorMask.set([!0,!0,!0,!0])),u!==void 0&&(v|=g.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(u),this.depthMask.set(!0)),f!==void 0&&(v|=g.STENCIL_BUFFER_BIT,this.clearStencil.set(f),this.stencilMask.set(255)),g.clear(v)}setCullFace(s){s.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(s.mode),this.frontFace.set(s.frontFace))}setDepthMode(s){s.func!==this.gl.ALWAYS||s.mask?(this.depthTest.set(!0),this.depthFunc.set(s.func),this.depthMask.set(s.mask),this.depthRange.set(s.range)):this.depthTest.set(!1)}setStencilMode(s){s.test.func!==this.gl.ALWAYS||s.mask?(this.stencilTest.set(!0),this.stencilMask.set(s.mask),this.stencilOp.set([s.fail,s.depthFail,s.pass
596]),this.stencilFunc.set({func:s.test.func,ref:s.ref,mask:s.test.mask})):this.stencilTest.set(!1)}setColorMode(s){r.aE(s.blendFunction,nn.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(s.blendFunction),this.blendColor.set(s.blendColor)),this.colorMask.set(s.mask)}createVertexArray(){var s;return Qi(this.gl)?this.gl.createVertexArray():(s=this.gl.getExtension("OES_vertex_array_object"))===null||s===void 0?void 0:s.createVertexArrayOES()}deleteVertexArray(s){var u;return Qi(this.gl)?this.gl.deleteVertexArray(s):(u=this.gl.getExtension("OES_vertex_array_object"))===null||u===void 0?void 0:u.deleteVertexArrayOES(s)}unbindVAO(){this.bindVertexArray.set(null)}}class Zt{constructor(s,u,f){this.func=s,this.mask=u,this.range=f}}Zt.ReadOnly=!1,Zt.ReadWrite=!0,Zt.disabled=new Zt(519,Zt.ReadOnly,[0,1]);let Gl=7680;class ti{constructor(s,u,f,g,v,A){this.test=s,this.ref=u,this.mask=f,this.fail=g,this.depthFail=v,this.pass=A}}ti.disabled=new ti({func:519,mask:0},0,0,Gl,Gl,Gl);class Ti{constructor(s,u,f){this.enable=s,this.mode=u,this.frontFace=f}}let Ls;function Qa(x,s,u,f,g){let v=x.context,A=v.gl,I=x.useProgram("collisionBox"),L=[],O=0,N=0;for(let de=0;de<f.length;de++){let me=f[de],re=s.getTile(me).getBucket(u);if(!re)continue;let ve=g?re.textCollisionBox:re.iconCollisionBox,xe=re.collisionCircleArray;if(xe.length>0){let Ae=r.H();r.aQ(Ae,re.placementInvProjMatrix,x.transform.glCoordMatrix),r.aQ(Ae,Ae,re.placementViewportMatrix),L.push({circleArray:xe,circleOffset:N,transform:me.posMatrix,invTransform:Ae,coord:me}),O+=xe.length/4,N=O}ve&&I.draw(v,A.LINES,Zt.disabled,ti.disabled,x.colorModeForRenderPass(),Ti.disabled,{u_matrix:me.posMatrix,u_pixel_extrude_scale:[1/(V=x.transform).width,1/V.height]},x.style.map.terrain&&x.style.map.terrain.getTerrainData(me),u.id,ve.layoutVertexBuffer,ve.indexBuffer,ve.segments,null,x.transform.zoom,null,null,ve.collisionVertexBuffer)}var V;if(!g||!L.length)return;let G=x.useProgram("collisionCircle"),Q=new r.aR;Q.resize(4*O),Q._trim();let ne=0;for(let de of L)for(let me=0;me<de.circleArray.length/4;me++){let re=4*me,ve=de.circleArray[re+0],xe=de.circleArray[re+1],Ae=de.circleArray[re+2],Ne=de.circleArray[re+3];Q.emplace(ne++,ve,xe,Ae,Ne,0),Q.emplace(ne++,ve,xe,Ae,Ne,1),Q.emplace(ne++,ve,xe,Ae,Ne,2),Q.emplace(ne++,ve,xe,Ae,Ne,3)}(!Ls||Ls.length<2*O)&&(Ls=function(de){let me=2*de,re=new r.aT;re.resize(me),re._trim();for(let ve=0;ve<me;ve++){let xe=6*ve;re.uint16[xe+0]=4*ve+0,re.uint16[xe+1]=4*ve+1,re.uint16[xe+2]=4*ve+2,re.uint16[xe+3]=4*ve+2,re.uint16[xe+4]=4*ve+3,re.uint16[xe+5]=4*ve+0}return re}(O));let ae=v.createIndexBuffer(Ls,!0),he=v.createVertexBuffer(Q,r.aS.members,!0);for(let de of L){let me=la(de.transform,de.invTransform,x.transform);G.draw(v,A.TRIANGLES,Zt.disabled,ti.disabled,x.colorModeForRenderPass(),Ti.disabled,me,x.style.map.terrain&&x.style.map.terrain.getTerrainData(de.coord),u.id,he,ae,r.a0.simpleSegment(0,2*de.circleOffset,de.circleArray.length,de.circleArray.length/2),null,x.transform.zoom,null,null,null)}he.destroy(),ae.destroy()}Ti.disabled=new Ti(!1,1029,2305),Ti.backCCW=new Ti(!0,1029,2305);let el=r.an(new Float32Array(16));function uh(x,s,u,f,g,v){let{horizontalAlign:A,verticalAlign:I}=r.au(x);return new r.P((-(A-.5)*s/g+f[0])*v,(-(I-.5)*u/g+f[1])*v)}function ua(x,s,u,f,g,v){let A=s.tileAnchorPoint.add(new r.P(s.translation[0],s.translation[1]));if(s.pitchWithMap){let I=f.mult(v);u||(I=I.rotate(-g));let L=A.add(I);return ue(L.x,L.y,s.labelPlaneMatrix,s.getElevation).point}if(u){let I=Re(s.tileAnchorPoint.x+1,s.tileAnchorPoint.y,s).point.sub(x),L=Math.atan(I.y/I.x)+(I.x<0?Math.PI:0);return x.add(f.rotate(L))}return x.add(f)}function tl(x,s,u,f,g,v,A,I,L,O,N,V,G,Q){let ne=x.text.placedSymbolArray,ae=x.text.dynamicLayoutVertexArray,he=x.icon.dynamicLayoutVertexArray,de={};ae.clear();for(let me=0;me<ne.length;me++){let re=ne.get(me),ve=re.hidden||!re.crossTileID||x.allowVerticalPlacement&&!re.placedOrientation?null:f[re.crossTileID];if(ve){let xe=new r.P(re.anchorX,re.anchorY),Ae={getElevation:Q,width:g.width,height:g.height,labelPlaneMatrix:v,lineVertexArray:null,pitchWithMap:u,projection:N,projectionCache:null,tileAnchorPoint:xe,translation:V,unwrappedTileID:G},Ne=u?ue(xe.x,xe.y,A,Q):Re(xe.x,xe.y,Ae),He=q(g.cameraToCenterDistance,Ne.signedDistanceFromCamera),tt=r.ai(x.textSizeData,L,re)*He/r.ap;u&&(tt*=x.tilePixelRatio/I);let{width:st,height:Je,anchor:Qe,textOffset:ft,textBoxScale:zt}
596=ve,it=uh(Qe,st,Je,ft,zt,tt),Ze=N.getPitchedTextCorrection(g,xe.add(new r.P(V[0],V[1])),G),It=ua(Ne.point,Ae,s,it,g.angle,Ze),qi=x.allowVerticalPlacement&&re.placedOrientation===r.ah.vertical?Math.PI/2:0;for(let Pt=0;Pt<re.numGlyphs;Pt++)r.aj(ae,It,qi);O&&re.associatedIconIndex>=0&&(de[re.associatedIconIndex]={shiftedAnchor:It,angle:qi})}else wt(re.numGlyphs,ae)}if(O){he.clear();let me=x.icon.placedSymbolArray;for(let re=0;re<me.length;re++){let ve=me.get(re);if(ve.hidden)wt(ve.numGlyphs,he);else{let xe=de[re];if(xe)for(let Ae=0;Ae<ve.numGlyphs;Ae++)r.aj(he,xe.shiftedAnchor,xe.angle);else wt(ve.numGlyphs,he)}}x.icon.dynamicLayoutVertexBuffer.updateData(he)}x.text.dynamicLayoutVertexBuffer.updateData(ae)}function as(x,s,u){return u.iconsInText&&s?"symbolTextAndIcon":x?"symbolSDF":"symbolIcon"}function hh(x,s,u,f,g,v,A,I,L,O,N,V){let G=x.context,Q=G.gl,ne=x.transform,ae=aa(),he=I==="map",de=L==="map",me=I!=="viewport"&&u.layout.get("symbol-placement")!=="point",re=he&&!de&&!me,ve=!de&&me,xe=!u.layout.get("symbol-sort-key").isConstant(),Ae=!1,Ne=x.depthModeForSublayer(0,Zt.ReadOnly),He=u._unevaluatedLayout.hasValue("text-variable-anchor")||u._unevaluatedLayout.hasValue("text-variable-anchor-offset"),tt=[],st=ae.getCircleRadiusCorrection(ne);for(let Je of f){let Qe=s.getTile(Je),ft=Qe.getBucket(u);if(!ft)continue;let zt=g?ft.text:ft.icon;if(!zt||!zt.segments.get().length||!zt.hasVisibleVertices)continue;let it=zt.programConfigurations.get(u.id),Ze=g||ft.sdfIcons,It=g?ft.textSizeData:ft.iconSizeData,qi=de||ne.pitch!==0,Pt=x.useProgram(as(Ze,g,ft),it),Xt=r.ag(It,ne.zoom),zi=x.style.map.terrain&&x.style.map.terrain.getTerrainData(Je),yn,hs,Qt,sr,br=[0,0],or=null;if(g)hs=Qe.glyphAtlasTexture,Qt=Q.LINEAR,yn=Qe.glyphAtlasTexture.size,ft.iconsInText&&(br=Qe.imageAtlasTexture.size,or=Qe.imageAtlasTexture,sr=qi||x.options.rotating||x.options.zooming||It.kind==="composite"||It.kind==="camera"?Q.LINEAR:Q.NEAREST);else{let ni=u.layout.get("icon-size").constantOr(0)!==1||ft.iconsNeedLinear;hs=Qe.imageAtlasTexture,Qt=Ze||x.options.rotating||x.options.zooming||ni||qi?Q.LINEAR:Q.NEAREST,yn=Qe.imageAtlasTexture.size}let xr=ei(Qe,1,x.transform.zoom),ds=ve?Je.posMatrix:el,fl=co(ds,de,he,x.transform,xr),jo=Es(ds,de,he,x.transform,xr),ka=Es(Je.posMatrix,de,he,x.transform,xr),ps=ae.translatePosition(x.transform,Qe,v,A),lu=He&&ft.hasTextData(),Ca=u.layout.get("icon-text-fit")!=="none"&&lu&&ft.hasIconData();if(me){let ni=x.style.map.terrain?(ml,qo)=>x.style.map.terrain.getElevation(Je,ml,qo):null,bo=u.layout.get("text-rotation-alignment")==="map";ee(ft,Je.posMatrix,x,g,fl,ka,de,O,bo,ae,Je.toUnwrapped(),ne.width,ne.height,ps,ni)}let fs=Je.posMatrix,ms=g&&He||Ca,Ys=me||ms?el:fl,gs=jo,Yn=Ze&&u.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0,ar;ar=Ze?ft.iconsInText?Ju(It.kind,Xt,re,de,me,ms,x,fs,Ys,gs,ps,yn,br,st):Ii(It.kind,Xt,re,de,me,ms,x,fs,Ys,gs,ps,g,yn,!0,st):Zi(It.kind,Xt,re,de,me,ms,x,fs,Ys,gs,ps,g,yn,st);let qr={program:Pt,buffers:zt,uniformValues:ar,atlasTexture:hs,atlasTextureIcon:or,atlasInterpolation:Qt,atlasInterpolationIcon:sr,isSDF:Ze,hasHalo:Yn};if(xe&&ft.canOverlap){Ae=!0;let ni=zt.segments.get();for(let bo of ni)tt.push({segments:new r.a0([bo]),sortKey:bo.sortKey,state:qr,terrainData:zi})}else tt.push({segments:zt.segments,sortKey:0,state:qr,terrainData:zi})}Ae&&tt.sort((Je,Qe)=>Je.sortKey-Qe.sortKey);for(let Je of tt){let Qe=Je.state;if(G.activeTexture.set(Q.TEXTURE0),Qe.atlasTexture.bind(Qe.atlasInterpolation,Q.CLAMP_TO_EDGE),Qe.atlasTextureIcon&&(G.activeTexture.set(Q.TEXTURE1),Qe.atlasTextureIcon&&Qe.atlasTextureIcon.bind(Qe.atlasInterpolationIcon,Q.CLAMP_TO_EDGE)),Qe.isSDF){let ft=Qe.uniformValues;Qe.hasHalo&&(ft.u_is_halo=1,Bo(Qe.buffers,Je.segments,u,x,Qe.program,Ne,N,V,ft,Je.terrainData)),ft.u_is_halo=0}Bo(Qe.buffers,Je.segments,u,x,Qe.program,Ne,N,V,Qe.uniformValues,Je.terrainData)}}function Bo(x,s,u,f,g,v,A,I,L,O){let N=f.context;g.draw(N,N.gl.TRIANGLES,v,A,I,Ti.disabled,L,O,u.id,x.layoutVertexBuffer,x.indexBuffer,s,u.paint,f.transform.zoom,x.programConfigurations.get(u.id),x.dynamicLayoutVertexBuffer,x.opacityVertexBuffer)}function dh(x,s,u,f){let g=x.context,v=g.gl,A=ti.disabled,I=new nn([v.ONE,v.ONE],r.aM.transparent,[!0,!0,!0,!0]),L=s.getBucket(u);
596if(!L)return;let O=f.key,N=u.heatmapFbos.get(O);N||(N=da(g,s.tileSize,s.tileSize),u.heatmapFbos.set(O,N)),g.bindFramebuffer.set(N.framebuffer),g.viewport.set([0,0,s.tileSize,s.tileSize]),g.clear({color:r.aM.transparent});let V=L.programConfigurations.get(u.id),G=x.useProgram("heatmap",V),Q=x.style.map.terrain.getTerrainData(f);G.draw(g,v.TRIANGLES,Zt.disabled,A,I,Ti.disabled,_r(f.posMatrix,s,x.transform.zoom,u.paint.get("heatmap-intensity")),Q,u.id,L.layoutVertexBuffer,L.indexBuffer,L.segments,u.paint,x.transform.zoom,V)}function ha(x,s,u){let f=x.context,g=f.gl;f.setColorMode(x.colorModeForRenderPass());let v=il(f,s),A=u.key,I=s.heatmapFbos.get(A);I&&(f.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,I.colorAttachment.get()),f.activeTexture.set(g.TEXTURE1),v.bind(g.LINEAR,g.CLAMP_TO_EDGE),x.useProgram("heatmapTexture").draw(f,g.TRIANGLES,Zt.disabled,ti.disabled,x.colorModeForRenderPass(),Ti.disabled,Uc(x,s,0,1),null,s.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments,s.paint,x.transform.zoom),I.destroy(),s.heatmapFbos.delete(A))}function da(x,s,u){var f,g;let v=x.gl,A=v.createTexture();v.bindTexture(v.TEXTURE_2D,A),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,v.CLAMP_TO_EDGE),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,v.CLAMP_TO_EDGE),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,v.LINEAR),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,v.LINEAR);let I=(f=x.HALF_FLOAT)!==null&&f!==void 0?f:v.UNSIGNED_BYTE,L=(g=x.RGBA16F)!==null&&g!==void 0?g:v.RGBA;v.texImage2D(v.TEXTURE_2D,0,L,s,u,0,v.RGBA,I,null);let O=x.createFramebuffer(s,u,!1,!1);return O.colorAttachment.set(A),O}function il(x,s){return s.colorRampTexture||(s.colorRampTexture=new at(x,s.colorRamp,x.gl.RGBA)),s.colorRampTexture}function $r(x,s,u,f,g){if(!u||!f||!f.imageAtlas)return;let v=f.imageAtlas.patternPositions,A=v[u.to.toString()],I=v[u.from.toString()];if(!A&&I&&(A=I),!I&&A&&(I=A),!A||!I){let L=g.getPaintProperty(s);A=v[L],I=v[L]}A&&I&&x.setConstantPatternPositions(A,I)}function No(x,s,u,f,g,v,A){let I=x.context.gl,L="fill-pattern",O=u.paint.get(L),N=O&&O.constantOr(1),V=u.getCrossfadeParameters(),G,Q,ne,ae,he;A?(Q=N&&!u.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",G=I.LINES):(Q=N?"fillPattern":"fill",G=I.TRIANGLES);let de=O.constantOr(null);for(let me of f){let re=s.getTile(me);if(N&&!re.patternsLoaded())continue;let ve=re.getBucket(u);if(!ve)continue;let xe=ve.programConfigurations.get(u.id),Ae=x.useProgram(Q,xe),Ne=x.style.map.terrain&&x.style.map.terrain.getTerrainData(me);N&&(x.context.activeTexture.set(I.TEXTURE0),re.imageAtlasTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),xe.updatePaintBuffers(V)),$r(xe,L,de,re,u);let He=Ne?me:null,tt=x.translatePosMatrix(He?He.posMatrix:me.posMatrix,re,u.paint.get("fill-translate"),u.paint.get("fill-translate-anchor"));if(A){ae=ve.indexBuffer2,he=ve.segments2;let st=[I.drawingBufferWidth,I.drawingBufferHeight];ne=Q==="fillOutlinePattern"&&N?Yu(tt,x,V,re,st):Pd(tt,st)}else ae=ve.indexBuffer,he=ve.segments,ne=N?Xu(tt,x,V,re):Ja(tt);Ae.draw(x.context,G,g,x.stencilModeForClipping(me),v,Ti.disabled,ne,Ne,u.id,ve.layoutVertexBuffer,ae,he,u.paint,x.transform.zoom,xe)}}function Yc(x,s,u,f,g,v,A){let I=x.context,L=I.gl,O="fill-extrusion-pattern",N=u.paint.get(O),V=N.constantOr(1),G=u.getCrossfadeParameters(),Q=u.paint.get("fill-extrusion-opacity"),ne=N.constantOr(null);for(let ae of f){let he=s.getTile(ae),de=he.getBucket(u);if(!de)continue;let me=x.style.map.terrain&&x.style.map.terrain.getTerrainData(ae),re=de.programConfigurations.get(u.id),ve=x.useProgram(V?"fillExtrusionPattern":"fillExtrusion",re);V&&(x.context.activeTexture.set(L.TEXTURE0),he.imageAtlasTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),re.updatePaintBuffers(G)),$r(re,O,ne,he,u);let xe=x.translatePosMatrix(ae.posMatrix,he,u.paint.get("fill-extrusion-translate"),u.paint.get("fill-extrusion-translate-anchor")),Ae=u.paint.get("fill-extrusion-vertical-gradient"),Ne=V?Ul(xe,x,Ae,Q,ae,G,he):Ya(xe,x,Ae,Q);ve.draw(I,I.gl.TRIANGLES,g,v,A,Ti.backCCW,Ne,me,u.id,de.layoutVertexBuffer,de.indexBuffer,de.segments,u.paint,x.transform.zoom,re,x.style.map.terrain&&de.centroidVertexBuffer)}}function nl(x,s,u,f,g,v,A){let I=x.context,L=I.gl,O=u.fbo;if(!O)return;let N=x.useProgram("hillshade"),V=x.style.map.terrain&&x.style.map.terrain.getTerrainData(s);I.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,O.colorAttachment.get()),N.draw(I,L.TRIANGLES,g,v,A,Ti.disabled,((G,Q,ne,ae)=>{let he=ne.paint.get("hillshade-shadow-color"),de=ne.paint.get("hillshade-highlight-color"),me=ne.paint.get("hillshade-accent-color"),re=ne.paint.get("hillshade-illumination-direction")*(Math.PI/180);ne.paint.get("hillshade-illumination-anchor")==="viewport"&&(re-=G.transform.angle);let ve=!G.options.moving;return{u_matrix:ae?ae.posMatrix:G.transform.calculatePosMatrix(Q.tileID.toUnwrapped(),ve),u_image:0,u_latrange:jc(0,Q.tileID),u_light:[ne.paint.get("hillshade-exaggeration"),re],u_shadow:he,u_highlight:de,u_accent:me}})(x,u,f,V?s:null),V,f.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments)}function rl(x,s,u,f,g,v){let A=x.context,I=A.gl,L=s.dem;if(L&&L.data){let O=L.dim,N=L.stride,V=L.getPixels();if(A.activeTexture.set(I.TEXTURE1),A.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||x.getTileTexture(N),s.demTexture){let Q=s.demTexture;Q.update(V,{premultiply:!1}),Q.bind(I.NEAREST,I.CLAMP_TO_EDGE)}else s.demTexture=new at(A,V,I.RGBA,{premultiply:!1}),s.demTexture.bind(I.NEAREST,I.CLAMP_TO_EDGE);A.activeTexture.set(I.TEXTURE0);let G=s.fbo;if(!G){let Q=new at(A,{width:O,height:O,data:null},I.RGBA);Q.bind(I.LINEAR,I.CLAMP_TO_EDGE),G=s.fbo=A.createFramebuffer(O,O,!0,!1),G.colorAttachment.set(Q.texture)}A.bindFramebuffer.set(G.framebuffer),A.viewport.set([0,0,O,O]),x.useProgram("hillshadePrepare").draw(A,I.TRIANGLES,f,g,v,Ti.disabled,((Q,ne)=>{let ae=ne.stride,he=r.H();return r.aP(he,0,r.X,-r.X,0,0,1),r.J(he,he,[0,-r.X,0]),{u_matrix:he,u_image:1,u_dimension:[ae,ae],u_zoom:Q.overscaledZ,u_unpack:ne.getUnpackVector()}})(s.tileID,L),null,u.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function pa(x,s,u,f,g,v){let A=f.paint.get("raster-fade-duration");if(!v&&A>0){let I=T.now(),L=(I-x.timeAdded)/A,O=s?(I-s.timeAdded)/A:-1,N=u.getSource(),V=g.coveringZoomLevel({tileSize:N.tileSize,roundZoom:N.roundZoom}),G=!s||Math.abs(s.tileID.overscaledZ-V)>Math.abs(x.tileID.overscaledZ-V),Q=G&&x.refreshedUponExpiration?1:r.ac(G?L:1-O,0,1);return x.refreshedUponExpiration&&L>=1&&(x.refreshedUponExpiration=!1),s?{opacity:1,mix:1-Q}:{opacity:Q,mix:0}}return{opacity:1,mix:0}}let Ur=new r.aM(1,0,0,1),fi=new r.aM(0,1,0,1),Jc=new r.aM(0,0,1,1),Sf=new r.aM(1,0,1,1),Hd=new r.aM(0,1,1,1);function sl(x,s,u,f){Ps(x,0,s+u/2,x.transform.width,u,f)}function Wd(x,s,u,f){Ps(x,s-u/2,0,u,x.transform.height,f)}function Ps(x,s,u,f,g,v){let A=x.context,I=A.gl;
596I.enable(I.SCISSOR_TEST),I.scissor(s*x.pixelRatio,u*x.pixelRatio,f*x.pixelRatio,g*x.pixelRatio),A.clear({color:v}),I.disable(I.SCISSOR_TEST)}function Te(x,s,u){let f=x.context,g=f.gl,v=u.posMatrix,A=x.useProgram("debug"),I=Zt.disabled,L=ti.disabled,O=x.colorModeForRenderPass(),N="$debug",V=x.style.map.terrain&&x.style.map.terrain.getTerrainData(u);f.activeTexture.set(g.TEXTURE0);let G=s.getTileByID(u.key).latestRawTileData,Q=Math.floor((G&&G.byteLength||0)/1024),ne=s.getTile(u).tileSize,ae=512/Math.min(ne,512)*(u.overscaledZ/x.transform.zoom)*.5,he=u.canonical.toString();u.overscaledZ!==u.canonical.z&&(he+=` => ${u.overscaledZ}`),function(de,me){de.initDebugOverlayCanvas();let re=de.debugOverlayCanvas,ve=de.context.gl,xe=de.debugOverlayCanvas.getContext("2d");xe.clearRect(0,0,re.width,re.height),xe.shadowColor="white",xe.shadowBlur=2,xe.lineWidth=1.5,xe.strokeStyle="white",xe.textBaseline="top",xe.font="bold 36px Open Sans, sans-serif",xe.fillText(me,5,5),xe.strokeText(me,5,5),de.debugOverlayTexture.update(re),de.debugOverlayTexture.bind(ve.LINEAR,ve.CLAMP_TO_EDGE)}(x,`${he} ${Q}kB`),A.draw(f,g.TRIANGLES,I,L,nn.alphaBlended,Ti.disabled,jl(v,r.aM.transparent,ae),null,N,x.debugBuffer,x.quadTriangleIndexBuffer,x.debugSegments),A.draw(f,g.LINE_STRIP,I,L,O,Ti.disabled,jl(v,r.aM.red),V,N,x.debugBuffer,x.tileBorderIndexBuffer,x.debugSegments)}function Be(x,s,u){let f=x.context,g=f.gl,v=x.colorModeForRenderPass(),A=new Zt(g.LEQUAL,Zt.ReadWrite,x.depthRangeFor3D),I=x.useProgram("terrain"),L=s.getTerrainMesh();f.bindFramebuffer.set(null),f.viewport.set([0,0,x.width,x.height]);for(let O of u){let N=x.renderToTexture.getTexture(O),V=s.getTerrainData(O.tileID);f.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,N.texture);let G=x.transform.calculatePosMatrix(O.tileID.toUnwrapped()),Q=s.getMeshFrameDelta(x.transform.zoom),ne=x.transform.calculateFogMatrix(O.tileID.toUnwrapped()),ae=$c(G,Q,ne,x.style.sky,x.transform.pitch);I.draw(f,g.TRIANGLES,A,ti.disabled,v,Ti.backCCW,ae,V,"terrain",L.vertexBuffer,L.indexBuffer,L.segments)}}class De{constructor(s,u,f){this.vertexBuffer=s,this.indexBuffer=u,this.segments=f}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class gt{constructor(s,u){this.context=new ch(s),this.transform=u,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:r.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Et.maxUnderzooming+Et.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Nc}resize(s,u,f){if(this.width=Math.floor(s*f),this.height=Math.floor(u*f),this.pixelRatio=f,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let g of this.style._order)this.style._layers[g].resize()}setup(){let s=this.context,u=new r.aX;u.emplaceBack(0,0),u.emplaceBack(r.X,0),u.emplaceBack(0,r.X),u.emplaceBack(r.X,r.X),this.tileExtentBuffer=s.createVertexBuffer(u,Lo.members),this.tileExtentSegments=r.a0.simpleSegment(0,0,4,2);let f=new r.aX;f.emplaceBack(0,0),f.emplaceBack(r.X,0),f.emplaceBack(0,r.X),f.emplaceBack(r.X,r.X),this.debugBuffer=s.createVertexBuffer(f,Lo.members),this.debugSegments=r.a0.simpleSegment(0,0,4,5);let g=new r.$;g.emplaceBack(0,0,0,0),g.emplaceBack(r.X,0,r.X,0),g.emplaceBack(0,r.X,0,r.X),g.emplaceBack(r.X,r.X,r.X,r.X),this.rasterBoundsBuffer=s.createVertexBuffer(g,es.members),this.rasterBoundsSegments=r.a0.simpleSegment(0,0,4,2);let v=new r.aX;v.emplaceBack(0,0),v.emplaceBack(1,0),v.emplaceBack(0,1),v.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(v,Lo.members),this.viewportSegments=r.a0.simpleSegment(0,0,4,2);let A=new r.aZ;A.emplaceBack(0),A.emplaceBack(1),A.emplaceBack(3),A.emplaceBack(2),A.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(A);let I=new r.aY;I.emplaceBack(0,1,2),I.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(I);let L=this.context.gl;this.stencilClearMode=new ti({func:L.ALWAYS,mask:0},0,255,L.ZERO,L.ZERO,L.ZERO)}clearStencil(){let s=this.context,u=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let f=r.H();r.aP(f,0,this.width,this.height,0,0,1),r.K(f,f,[u.drawingBufferWidth,u.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,u.TRIANGLES,Zt.disabled,this.stencilClearMode,nn.disabled,Ti.disabled,Ar(f),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(s,u){if(this.currentStencilSource===s.source||!s.isTileClipped()||!u||!u.length)return;this.currentStencilSource=s.source;let f=this.context,g=f.gl;this.nextStencilID+u.length>256&&this.clearStencil(),f.setColorMode(nn.disabled),f.setDepthMode(Zt.disabled);let v=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let A of u){let I=this._tileClippingMaskIDs[A.key]=this.nextStencilID++,L=this.style.map.terrain&&this.style.map.terrain.getTerrainData(A);v.draw(f,g.TRIANGLES,Zt.disabled,new ti({func:g.ALWAYS,mask:0},I,255,g.KEEP,g.KEEP,g.REPLACE),nn.disabled,Ti.disabled,Ar(A.posMatrix),L,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let s=this.nextStencilID++,u=this.context.gl;return new ti({func:u.NOTEQUAL,mask:255},s,255,u.KEEP,u.KEEP,u.REPLACE)}stencilModeForClipping(s){let u=this.context.gl;return new ti({func:u.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,u.KEEP,u.KEEP,u.REPLACE)}stencilConfigForOverlap(s){let u=this.context.gl,f=s.sort((A,I)=>
596I.overscaledZ-A.overscaledZ),g=f[f.length-1].overscaledZ,v=f[0].overscaledZ-g+1;if(v>1){this.currentStencilSource=void 0,this.nextStencilID+v>256&&this.clearStencil();let A={};for(let I=0;I<v;I++)A[I+g]=new ti({func:u.GEQUAL,mask:255},I+this.nextStencilID,255,u.KEEP,u.KEEP,u.REPLACE);return this.nextStencilID+=v,[A,f]}return[{[g]:ti.disabled},f]}colorModeForRenderPass(){let s=this.context.gl;return this._showOverdrawInspector?new nn([s.CONSTANT_COLOR,s.ONE],new r.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?nn.unblended:nn.alphaBlended}depthModeForSublayer(s,u,f){if(!this.opaquePassEnabledForLayer())return Zt.disabled;let g=1-((1+this.currentLayer)*this.numSublayers+s)*this.depthEpsilon;return new Zt(f||this.context.gl.LEQUAL,u,[g,g])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(s,u){this.style=s,this.options=u,this.lineAtlas=s.lineAtlas,this.imageManager=s.imageManager,this.glyphManager=s.glyphManager,this.symbolFadeChange=s.placement.symbolFadeChange(T.now()),this.imageManager.beginFrame();let f=this.style._order,g=this.style.sourceCaches,v={},A={},I={};for(let L in g){let O=g[L];O.used&&O.prepare(this.context),v[L]=O.getVisibleCoordinates(),A[L]=v[L].slice().reverse(),I[L]=O.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let L=0;L<f.length;L++)if(this.style._layers[f[L]].is3D()){this.opaquePassCutoff=L;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let L of f){let O=this.style._layers[L];if(!O.hasOffscreenPass()||O.isHidden(this.transform.zoom))continue;let N=A[O.source];(O.type==="custom"||N.length)&&this.renderLayer(this,g[O.source],O,N)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:u.showOverdrawInspector?r.aM.black:r.aM.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(L,O){let N=L.context,V=N.gl,G=((de,me,re)=>({u_sky_color:de.properties.get("sky-color"),u_horizon_color:de.properties.get("horizon-color"),u_horizon:(me.height/2+me.getHorizon())*re,u_sky_horizon_blend:de.properties.get("sky-horizon-blend")*me.height/2*re}))(O,L.style.map.transform,L.pixelRatio),Q=new Zt(V.LEQUAL,Zt.ReadWrite,[0,1]),ne=ti.disabled,ae=L.colorModeForRenderPass(),he=L.useProgram("sky");if(!O.mesh){let de=new r.aX;de.emplaceBack(-1,-1),de.emplaceBack(1,-1),de.emplaceBack(1,1),de.emplaceBack(-1,1);let me=new r.aY;me.emplaceBack(0,1,2),me.emplaceBack(0,2,3),O.mesh=new De(N.createVertexBuffer(de,Lo.members),N.createIndexBuffer(me),r.a0.simpleSegment(0,0,de.length,me.length))}he.draw(N,V.TRIANGLES,Q,ne,ae,Ti.disabled,G,void 0,"sky",O.mesh.vertexBuffer,O.mesh.indexBuffer,O.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=u.showOverdrawInspector,this.depthRangeFor3D=[0,1-(s._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=f.length-1;this.currentLayer>=0;this.currentLayer--){let L=this.style._layers[f[this.currentLayer]],O=g[L.source],N=v[L.source];this._renderTileClippingMasks(L,N),this.renderLayer(this,O,L,N)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<f.length;this.currentLayer++){let L=this.style._layers[f[this.currentLayer]],O=g[L.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(L))continue;let N=(L.type==="symbol"?I:A)[L.source];this._renderTileClippingMasks(L,v[L.source]),this.renderLayer(this,O,L,N)}if(this.options.showTileBoundaries){let L=function(O,N){let V=null,G=Object.values(O._layers).flatMap(he=>he.source&&!he.isHidden(N)?[O.sourceCaches[he.source]]:[]),Q=G.filter(he=>he.getSource().type==="vector"),ne=G.filter(he=>he.getSource().type!=="vector"),ae=he=>{(!V||V.getSource().maxzoom<he.getSource().maxzoom)&&(V=he)};return Q.forEach(he=>ae(he)),V||ne.forEach(he=>ae(he)),V}(this.style,this.transform.zoom);L&&function(O,N,V){for(let G=0;G<V.length;G++)Te(O,N,V[G])}(this,L,L.getVisibleCoordinates())}this.options.showPadding&&function(L){let O=L.transform.padding;sl(L,L.transform.height-(O.top||0),3,Ur),sl(L,O.bottom||0,3,fi),Wd(L,O.left||0,3,Jc),Wd(L,L.transform.width-(O.right||0),3,Sf);let N=L.transform.centerPoint;(function(V,G,Q,ne){Ps(V,G-1,Q-10,2,20,ne),Ps(V,G-10,Q-1,20,2,ne)})(L,N.x,L.transform.height-N.y,Hd)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(s){if(!this.style||!this.style.map||!this.style.map.terrain)return;let u=this.terrainFacilitator.matrix,f=this.transform.modelViewProjectionMatrix,g=this.terrainFacilitator.dirty;g||(g=s?!r.a_(u,f):!r.a$(u,f)),g||(g=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),g&&(r.b0(u,f),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,A){let I=v.context,L=I.gl,O=nn.unblended,N=new Zt(L.LEQUAL,Zt.ReadWrite,[0,1]),V=A.getTerrainMesh(),G=A.sourceCache.getRenderableTiles(),Q=v.useProgram("terrainDepth");I.bindFramebuffer.set(A.getFramebuffer("depth").framebuffer),I.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),I.clear({color:r.aM.transparent,depth:1});for(let ne of G){let ae=A.getTerrainData(ne.tileID),he={u_matrix:v.transform.calculatePosMatrix(ne.tileID.toUnwrapped()),u_ele_delta:A.getMeshFrameDelta(v.transform.zoom)};Q.draw(I,L.TRIANGLES,N,ti.disabled,O,Ti.backCCW,he,ae,"terrain",V.vertexBuffer,V.indexBuffer,V.segments)}I.bindFramebuffer.set(null),I.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,A){let I=v.context,L=I.gl,O=nn.unblended,N=new Zt(L.LEQUAL,Zt.ReadWrite,[0,1]),V=A.getTerrainMesh(),G=A.getCoordsTexture(),Q=A.sourceCache.getRenderableTiles(),ne=v.useProgram("terrainCoords");I.bindFramebuffer.set(A.getFramebuffer("coords").framebuffer),I.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),I.clear({color:r.aM.transparent,depth:1}),A.coordsIndex=[];for(let ae of Q){let he=A.getTerrainData(ae.tileID);I.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,G.texture);let de={u_matrix:v.transform.calculatePosMatrix(ae.tileID.toUnwrapped()),u_terrain_coords_id:(255-A.coordsIndex.length)/255,u_texture:0,u_ele_delta:A.getMeshFrameDelta(v.transform.zoom)};ne.draw(I,L.TRIANGLES,N,ti.disabled,O,Ti.backCCW,de,he,"terrain",V.vertexBuffer,V.indexBuffer,V.segments),A.coordsIndex.push(ae.tileID.key)}I.bindFramebuffer.set(null),I.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain))}renderLayer(s,u,f,g){if(!f.isHidden(this.transform.zoom)&&(f.type==="background"||f.type==="custom"||(g||[]).length))switch(this.id=f.id,f.type){case"symbol":(function(v,A,I,L,O){if(v.renderPass!=="translucent")return;let N=ti.disabled,V=v.colorModeForRenderPass();(I._unevaluatedLayout.hasValue("text-variable-anchor")||I._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(G,Q,ne,ae,he,de,me,re,ve){let xe=Q.transform,Ae=aa(),Ne=he==="map",He=de==="map";for(let tt of G){let st=ae.getTile(tt),Je=st.getBucket(ne);if(!Je||!Je.text||!Je.text.segments.get().length)continue;let Qe=r.ag(Je.textSizeData,xe.zoom),ft=ei(st,1,Q.transform.zoom),zt=co(tt.posMatrix,He,Ne,Q.transform,ft),it=ne.layout.get("icon-text-fit")!=="none"&&Je.hasIconData();
596if(Qe){let Ze=Math.pow(2,xe.zoom-st.tileID.overscaledZ),It=Q.style.map.terrain?(Pt,Xt)=>Q.style.map.terrain.getElevation(tt,Pt,Xt):null,qi=Ae.translatePosition(xe,st,me,re);tl(Je,Ne,He,ve,xe,zt,tt.posMatrix,Ze,Qe,it,Ae,qi,tt.toUnwrapped(),It)}}}(L,v,I,A,I.layout.get("text-rotation-alignment"),I.layout.get("text-pitch-alignment"),I.paint.get("text-translate"),I.paint.get("text-translate-anchor"),O),I.paint.get("icon-opacity").constantOr(1)!==0&&hh(v,A,I,L,!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"),N,V),I.paint.get("text-opacity").constantOr(1)!==0&&hh(v,A,I,L,!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"),N,V),A.map.showCollisionBoxes&&(Qa(v,A,I,L,!0),Qa(v,A,I,L,!1))})(s,u,f,g,this.style.placement.variableOffsets);break;case"circle":(function(v,A,I,L){if(v.renderPass!=="translucent")return;let O=I.paint.get("circle-opacity"),N=I.paint.get("circle-stroke-width"),V=I.paint.get("circle-stroke-opacity"),G=!I.layout.get("circle-sort-key").isConstant();if(O.constantOr(1)===0&&(N.constantOr(1)===0||V.constantOr(1)===0))return;let Q=v.context,ne=Q.gl,ae=v.depthModeForSublayer(0,Zt.ReadOnly),he=ti.disabled,de=v.colorModeForRenderPass(),me=[];for(let re=0;re<L.length;re++){let ve=L[re],xe=A.getTile(ve),Ae=xe.getBucket(I);if(!Ae)continue;let Ne=Ae.programConfigurations.get(I.id),He=v.useProgram("circle",Ne),tt=Ae.layoutVertexBuffer,st=Ae.indexBuffer,Je=v.style.map.terrain&&v.style.map.terrain.getTerrainData(ve),Qe={programConfiguration:Ne,program:He,layoutVertexBuffer:tt,indexBuffer:st,uniformValues:Dd(v,ve,xe,I),terrainData:Je};if(G){let ft=Ae.segments.get();for(let zt of ft)me.push({segments:new r.a0([zt]),sortKey:zt.sortKey,state:Qe})}else me.push({segments:Ae.segments,sortKey:0,state:Qe})}G&&me.sort((re,ve)=>re.sortKey-ve.sortKey);for(let re of me){let{programConfiguration:ve,program:xe,layoutVertexBuffer:Ae,indexBuffer:Ne,uniformValues:He,terrainData:tt}=re.state;xe.draw(Q,ne.TRIANGLES,ae,he,de,Ti.disabled,He,tt,I.id,Ae,Ne,re.segments,I.paint,v.transform.zoom,ve)}})(s,u,f,g);break;case"heatmap":(function(v,A,I,L){if(I.paint.get("heatmap-opacity")===0)return;let O=v.context;if(v.style.map.terrain){for(let N of L){let V=A.getTile(N);A.hasRenderableParent(N)||(v.renderPass==="offscreen"?dh(v,V,I,N):v.renderPass==="translucent"&&ha(v,I,N))}O.viewport.set([0,0,v.width,v.height])}else v.renderPass==="offscreen"?function(N,V,G,Q){let ne=N.context,ae=ne.gl,he=ti.disabled,de=new nn([ae.ONE,ae.ONE],r.aM.transparent,[!0,!0,!0,!0]);(function(me,re,ve){let xe=me.gl;me.activeTexture.set(xe.TEXTURE1),me.viewport.set([0,0,re.width/4,re.height/4]);let Ae=ve.heatmapFbos.get(r.aU);Ae?(xe.bindTexture(xe.TEXTURE_2D,Ae.colorAttachment.get()),me.bindFramebuffer.set(Ae.framebuffer)):(Ae=da(me,re.width/4,re.height/4),ve.heatmapFbos.set(r.aU,Ae))})(ne,N,G),ne.clear({color:r.aM.transparent});for(let me=0;me<Q.length;me++){let re=Q[me];if(V.hasRenderableParent(re))continue;let ve=V.getTile(re),xe=ve.getBucket(G);if(!xe)continue;let Ae=xe.programConfigurations.get(G.id),Ne=N.useProgram("heatmap",Ae),{zoom:He}=N.transform;Ne.draw(ne,ae.TRIANGLES,Zt.disabled,he,de,Ti.disabled,_r(re.posMatrix,ve,He,G.paint.get("heatmap-intensity")),null,G.id,xe.layoutVertexBuffer,xe.indexBuffer,xe.segments,G.paint,N.transform.zoom,Ae)}ne.viewport.set([0,0,N.width,N.height])}(v,A,I,L):v.renderPass==="translucent"&&function(N,V){let G=N.context,Q=G.gl;G.setColorMode(N.colorModeForRenderPass());let ne=V.heatmapFbos.get(r.aU);ne&&(G.activeTexture.set(Q.TEXTURE0),Q.bindTexture(Q.TEXTURE_2D,ne.colorAttachment.get()),G.activeTexture.set(Q.TEXTURE1),il(G,V).bind(Q.LINEAR,Q.CLAMP_TO_EDGE),N.useProgram("heatmapTexture").draw(G,Q.TRIANGLES,Zt.disabled,ti.disabled,N.colorModeForRenderPass(),Ti.disabled,Uc(N,V,0,1),null,V.id,N.viewportBuffer,N.quadTriangleIndexBuffer,N.viewportSegments,V.paint,N.transform.zoom))}(v,I)})(s,u,f,g);break;case"line":(function(v,A,I,L){if(v.renderPass!=="translucent")return;let O=I.paint.get("line-opacity"),N=I.paint.get("line-width");if(O.constantOr(1)===0||N.constantOr(1)===0)return;let V=v.depthModeForSublayer(0,Zt.ReadOnly),G=v.colorModeForRenderPass(),Q=I.paint.get("line-dasharray"),ne=I.paint.get("line-pattern"),ae=ne.constantOr(1),he=I.paint.get("line-gradient"),de=I.getCrossfadeParameters(),me=ae?"linePattern":Q?"lineSDF":he?"lineGradient":"line",re=v.context,ve=re.gl,xe=!0;for(let Ae of L){let Ne=A.getTile(Ae);if(ae&&!Ne.patternsLoaded())continue;let He=Ne.getBucket(I);if(!He)continue;let tt=He.programConfigurations.get(I.id),st=v.context.program.get(),Je=v.useProgram(me,tt),Qe=xe||Je.program!==st,ft=v.style.map.terrain&&v.style.map.terrain.getTerrainData(Ae),zt=ne.constantOr(null);if(zt&&Ne.imageAtlas){let It=Ne.imageAtlas,qi=It.patternPositions[zt.to.toString()],Pt=It.patternPositions[zt.from.toString()];qi&&Pt&&tt.setConstantPatternPositions(qi,Pt)}let it=ft?Ae:null,Ze=ae?Do(v,Ne,I,de,it):Q?_f(v,Ne,I,Q,de,it):he?Rd(v,Ne,I,He.lineClipsArray.length,it):qc(v,Ne,I,it);if(ae)re.activeTexture.set(ve.TEXTURE0),Ne.imageAtlasTexture.bind(ve.LINEAR,ve.CLAMP_TO_EDGE),tt.updatePaintBuffers(de);else if(Q&&(Qe||v.lineAtlas.dirty))re.activeTexture.set(ve.TEXTURE0),v.lineAtlas.bind(re);else if(he){let It=He.gradients[I.id],qi=It.texture;if(I.gradientVersion!==It.version){let Pt=256;if(I.stepInterpolant){let Xt=A.getSource().maxzoom,zi=Ae.canonical.z===Xt?Math.ceil(1<<v.transform.maxZoom-Ae.canonical.z):1;Pt=r.ac(r.aV(He.maxLineLength/r.X*1024*zi),256,re.maxTextureSize)}It.gradient=r.aW({expression:I.gradientExpression(),evaluationKey:"lineProgress",resolution:Pt,image:It.gradient||void 0,clips:He.lineClipsArray}),It.texture?It.texture.update(It.gradient):It.texture=new at(re,It.gradient,ve.RGBA),It.ver
596sion=I.gradientVersion,qi=It.texture}re.activeTexture.set(ve.TEXTURE0),qi.bind(I.stepInterpolant?ve.NEAREST:ve.LINEAR,ve.CLAMP_TO_EDGE)}Je.draw(re,ve.TRIANGLES,V,v.stencilModeForClipping(Ae),G,Ti.disabled,Ze,ft,I.id,He.layoutVertexBuffer,He.indexBuffer,He.segments,I.paint,v.transform.zoom,tt,He.layoutVertexBuffer2),xe=!1}})(s,u,f,g);break;case"fill":(function(v,A,I,L){let O=I.paint.get("fill-color"),N=I.paint.get("fill-opacity");if(N.constantOr(1)===0)return;let V=v.colorModeForRenderPass(),G=I.paint.get("fill-pattern"),Q=v.opaquePassEnabledForLayer()&&!G.constantOr(1)&&O.constantOr(r.aM.transparent).a===1&&N.constantOr(0)===1?"opaque":"translucent";if(v.renderPass===Q){let ne=v.depthModeForSublayer(1,v.renderPass==="opaque"?Zt.ReadWrite:Zt.ReadOnly);No(v,A,I,L,ne,V,!1)}if(v.renderPass==="translucent"&&I.paint.get("fill-antialias")){let ne=v.depthModeForSublayer(I.getPaintProperty("fill-outline-color")?2:0,Zt.ReadOnly);No(v,A,I,L,ne,V,!0)}})(s,u,f,g);break;case"fill-extrusion":(function(v,A,I,L){let O=I.paint.get("fill-extrusion-opacity");if(O!==0&&v.renderPass==="translucent"){let N=new Zt(v.context.gl.LEQUAL,Zt.ReadWrite,v.depthRangeFor3D);if(O!==1||I.paint.get("fill-extrusion-pattern").constantOr(1))Yc(v,A,I,L,N,ti.disabled,nn.disabled),Yc(v,A,I,L,N,v.stencilModeFor3D(),v.colorModeForRenderPass());else{let V=v.colorModeForRenderPass();Yc(v,A,I,L,N,ti.disabled,V)}}})(s,u,f,g);break;case"hillshade":(function(v,A,I,L){if(v.renderPass!=="offscreen"&&v.renderPass!=="translucent")return;let O=v.context,N=v.depthModeForSublayer(0,Zt.ReadOnly),V=v.colorModeForRenderPass(),[G,Q]=v.renderPass==="translucent"?v.stencilConfigForOverlap(L):[{},L];for(let ne of Q){let ae=A.getTile(ne);ae.needsHillshadePrepare!==void 0&&ae.needsHillshadePrepare&&v.renderPass==="offscreen"?rl(v,ae,I,N,ti.disabled,V):v.renderPass==="translucent"&&nl(v,ne,ae,I,N,G[ne.overscaledZ],V)}O.viewport.set([0,0,v.width,v.height])})(s,u,f,g);break;case"raster":(function(v,A,I,L){if(v.renderPass!=="translucent"||I.paint.get("raster-opacity")===0||!L.length)return;let O=v.context,N=O.gl,V=A.getSource(),G=v.useProgram("raster"),Q=v.colorModeForRenderPass(),[ne,ae]=V instanceof ts?[{},L]:v.stencilConfigForOverlap(L),he=ae[ae.length-1].overscaledZ,de=!v.options.moving;for(let me of ae){let re=v.depthModeForSublayer(me.overscaledZ-he,I.paint.get("raster-opacity")===1?Zt.ReadWrite:Zt.ReadOnly,N.LESS),ve=A.getTile(me);ve.registerFadeDuration(I.paint.get("raster-fade-duration"));let xe=A.findLoadedParent(me,0),Ae=A.findLoadedSibling(me),Ne=pa(ve,xe||Ae||null,A,I,v.transform,v.style.map.terrain),He,tt,st=I.paint.get("raster-resampling")==="nearest"?N.NEAREST:N.LINEAR;O.activeTexture.set(N.TEXTURE0),ve.texture.bind(st,N.CLAMP_TO_EDGE,N.LINEAR_MIPMAP_NEAREST),O.activeTexture.set(N.TEXTURE1),xe?(xe.texture.bind(st,N.CLAMP_TO_EDGE,N.LINEAR_MIPMAP_NEAREST),He=Math.pow(2,xe.tileID.overscaledZ-ve.tileID.overscaledZ),tt=[ve.tileID.canonical.x*He%1,ve.tileID.canonical.y*He%1]):ve.texture.bind(st,N.CLAMP_TO_EDGE,N.LINEAR_MIPMAP_NEAREST),ve.texture.useMipmap&&O.extTextureFilterAnisotropic&&v.transform.pitch>20&&N.texParameterf(N.TEXTURE_2D,O.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,O.extTextureFilterAnisotropicMax);let Je=v.style.map.terrain&&v.style.map.terrain.getTerrainData(me),Qe=Je?me:null,ft=Qe?Qe.posMatrix:v.transform.calculatePosMatrix(me.toUnwrapped(),de),zt=vf(ft,tt||[0,0],He||1,Ne,I);V instanceof ts?G.draw(O,N.TRIANGLES,re,ti.disabled,Q,Ti.disabled,zt,Je,I.id,V.boundsBuffer,v.quadTriangleIndexBuffer,V.boundsSegments):G.draw(O,N.TRIANGLES,re,ne[me.overscaledZ],Q,Ti.disabled,zt,Je,I.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments)}})(s,u,f,g);break;case"background":(function(v,A,I,L){let O=I.paint.get("background-color"),N=I.paint.get("background-opacity");if(N===0)return;let V=v.context,G=V.gl,Q=v.transform,ne=Q.tileSize,ae=I.paint.get("background-pattern");if(v.isPatternMissing(ae))return;let he=!ae&&O.a===1&&N===1&&v.opaquePassEnabledForLayer()?"opaque":"translucent";if(v.renderPass!==he)return;let de=ti.disabled,me=v.depthModeForSublayer(0,he==="opaque"?Zt.ReadWrite:Zt.ReadOnly),re=v.colorModeForRenderPass(),ve=v.useProgram(ae?"backgroundPattern":"background"),xe=L||Q.coveringTiles({tileSize:ne,terrain:v.style.map.terrain});ae&&(V.activeTexture.set(G.TEXTURE0),v.imageManager.bind(v.context));let Ae=I.getCrossfadeParameters();for(let Ne of xe){let He=L?Ne.posMatrix:v.transform.calculatePosMatrix(Ne.toUnwrapped()),tt=ae?Qu(He,N,v,ae,{tileID:Ne,tileSize:ne},Ae):Hc(He,N,O),st=v.style.map.terrain&&v.style.map.terrain.getTerrainData(Ne);ve.draw(V,G.TRIANGLES,me,de,re,Ti.disabled,tt,st,I.id,v.tileExtentBuffer,v.quadTriangleIndexBuffer,v.tileExtentSegments)}})(s,0,f,g);break;
596case"custom":(function(v,A,I){let L=v.context,O=I.implementation;if(v.renderPass==="offscreen"){let N=O.prerender;N&&(v.setCustomLayerDefaults(),L.setColorMode(v.colorModeForRenderPass()),N.call(O,L.gl,v.transform.customLayerMatrix()),L.setDirty(),v.setBaseState())}else if(v.renderPass==="translucent"){v.setCustomLayerDefaults(),L.setColorMode(v.colorModeForRenderPass()),L.setStencilMode(ti.disabled);let N=O.renderingMode==="3d"?new Zt(v.context.gl.LEQUAL,Zt.ReadWrite,v.depthRangeFor3D):v.depthModeForSublayer(0,Zt.ReadOnly);L.setDepthMode(N),O.render(L.gl,v.transform.customLayerMatrix(),{farZ:v.transform.farZ,nearZ:v.transform.nearZ,fov:v.transform._fov,modelViewProjectionMatrix:v.transform.modelViewProjectionMatrix,projectionMatrix:v.transform.projectionMatrix}),L.setDirty(),v.setBaseState(),L.bindFramebuffer.set(null)}})(s,0,f)}}translatePosMatrix(s,u,f,g,v){if(!f[0]&&!f[1])return s;let A=v?g==="map"?this.transform.angle:0:g==="viewport"?-this.transform.angle:0;if(A){let O=Math.sin(A),N=Math.cos(A);f=[f[0]*N-f[1]*O,f[0]*O+f[1]*N]}let I=[v?f[0]:ei(u,f[0],this.transform.zoom),v?f[1]:ei(u,f[1],this.transform.zoom),0],L=new Float32Array(16);return r.J(L,s,I),L}saveTileTexture(s){let u=this._tileTextures[s.size[0]];u?u.push(s):this._tileTextures[s.size[0]]=[s]}getTileTexture(s){let u=this._tileTextures[s];return u&&u.length>0?u.pop():null}isPatternMissing(s){if(!s)return!1;if(!s.from||!s.to)return!0;let u=this.imageManager.getPattern(s.from.toString()),f=this.imageManager.getPattern(s.to.toString());return!u||!f}useProgram(s,u){this.cache=this.cache||{};let f=s+(u?u.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[f]||(this.cache[f]=new $l(this.context,uo[s],u,eh[s],this._showOverdrawInspector,this.style.map.terrain)),this.cache[f]}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(){let s=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(s.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new at(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:s,drawingBufferHeight:u}=this.context.gl;return this.width!==s||this.height!==u}}class Ot{constructor(s,u){this.points=s,this.planes=u}static fromInvProjectionMatrix(s,u,f){let g=Math.pow(2,f),v=[[-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=>{let L=1/(I=r.af([],I,s))[3]/u*g;return r.b1(I,I,[L,L,1/I[3],L])}),A=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(I=>{let L=function(G,Q){var ne=Q[0],ae=Q[1],he=Q[2],de=ne*ne+ae*ae+he*he;return de>0&&(de=1/Math.sqrt(de)),G[0]=Q[0]*de,G[1]=Q[1]*de,G[2]=Q[2]*de,G}([],function(G,Q,ne){var ae=Q[0],he=Q[1],de=Q[2],me=ne[0],re=ne[1],ve=ne[2];return G[0]=he*ve-de*re,G[1]=de*me-ae*ve,G[2]=ae*re-he*me,G}([],ze([],v[I[0]],v[I[1]]),ze([],v[I[2]],v[I[1]]))),O=-((N=L)[0]*(V=v[I[1]])[0]+N[1]*V[1]+N[2]*V[2]);var N,V;return L.concat(O)});return new Ot(v,A)}}class ci{constructor(s,u){this.min=s,this.max=u,this.center=function(f,g,v){return f[0]=.5*g[0],f[1]=.5*g[1],f[2]=.5*g[2],f}([],function(f,g,v){return f[0]=g[0]+v[0],f[1]=g[1]+v[1],f[2]=g[2]+v[2],f}([],this.min,this.max))}quadrant(s){let u=[s%2==0,s<2],f=Le(this.min),g=Le(this.max);for(let v=0;v<u.length;v++)f[v]=u[v]?this.min[v]:this.center[v],g[v]=u[v]?this.center[v]:this.max[v];return g[2]=this.max[2],new ci(f,g)}distanceX(s){return Math.max(Math.min(this.max[0],s[0]),this.min[0])-s[0]}distanceY(s){return Math.max(Math.min(this.max[1],s[1]),this.min[1])-s[1]}intersects(s){let u=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],
5961],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]],f=!0;for(let g=0;g<s.planes.length;g++){let v=s.planes[g],A=0;for(let I=0;I<u.length;I++)r.b2(v,u[I])>=0&&A++;if(A===0)return 0;A!==u.length&&(f=!1)}if(f)return 2;for(let g=0;g<3;g++){let v=Number.MAX_VALUE,A=-Number.MAX_VALUE;for(let I=0;I<s.points.length;I++){let L=s.points[I][g]-this.min[g];v=Math.min(v,L),A=Math.max(A,L)}if(A<0||v>this.max[g]-this.min[g])return 0}return 1}}class rn{constructor(s=0,u=0,f=0,g=0){if(isNaN(s)||s<0||isNaN(u)||u<0||isNaN(f)||f<0||isNaN(g)||g<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=u,this.left=f,this.right=g}interpolate(s,u,f){return u.top!=null&&s.top!=null&&(this.top=r.y.number(s.top,u.top,f)),u.bottom!=null&&s.bottom!=null&&(this.bottom=r.y.number(s.bottom,u.bottom,f)),u.left!=null&&s.left!=null&&(this.left=r.y.number(s.left,u.left,f)),u.right!=null&&s.right!=null&&(this.right=r.y.number(s.right,u.right,f)),this}getCenter(s,u){let f=r.ac((this.left+s-this.right)/2,0,s),g=r.ac((this.top+u-this.bottom)/2,0,u);return new r.P(f,g)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new rn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}let Ri=85.051129;class Vo{constructor(s,u,f,g,v){this.tileSize=512,this._renderWorldCopies=v===void 0||!!v,this._minZoom=s||0,this._maxZoom=u||22,this._minPitch=f??0,this._maxPitch=g??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new r.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new rn,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){let s=new Vo(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return s.apply(this),s}apply(s){this.tileSize=s.tileSize,this.latRange=s.latRange,this.lngRange=s.lngRange,this.width=s.width,this.height=s.height,this._center=s._center,this._elevation=s._elevation,this.minElevationForCurrentTile=s.minElevationForCurrentTile,this.zoom=s.zoom,this.angle=s.angle,this._fov=s._fov,this._pitch=s._pitch,this._unmodified=s._unmodified,this._edgeInsets=s._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(s){this._minZoom!==s&&(this._minZoom=s,this.zoom=Math.max(this.zoom,s))}get maxZoom(){return this._maxZoom}set maxZoom(s){this._maxZoom!==s&&(this._maxZoom=s,this.zoom=Math.min(this.zoom,s))}get minPitch(){return this._minPitch}set minPitch(s){this._minPitch!==s&&(this._minPitch=s,this.pitch=Math.max(this.pitch,s))}get maxPitch(){return this._maxPitch}set maxPitch(s){this._maxPitch!==s&&(this._maxPitch=s,this.pitch=Math.min(this.pitch,s))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(s){s===void 0?s=!0:s===null&&(s=!1),this._renderWorldCopies=s}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new r.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(s){let u=-r.b3(s,-180,180)*Math.PI/180;this.angle!==u&&(this._unmodified=!1,this.angle=u,this._calcMatrices(),this.rotationMatrix=function(){var f=new r.A(4);return r.A!=Float32Array&&(f[1]=0,f[2]=0),f[0]=1,f[3]=1,f}(),function(f,g,v){var A=g[0],I=g[1],L=g[2],O=g[3],N=Math.sin(v),V=Math.cos(v);f[0]=A*V+L*N,f[1]=I*V+O*N,f[2]=A*-N+L*V,f[3]=I*-N+O*V}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){let u=r.ac(s,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(s){s=Math.max(.01,Math.min(60,s)),this._fov!==s&&(this._unmodified=!1,this._fov=s/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(s){let u=Math.min(Math.max(s,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(s){s.lat===this._center.lat&&s.lng===this._center.lng||(this._unmodified=!1,this._center=s,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(s){s!==this._elevation&&(this._elevation=s,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(s){this._edgeInsets.equals(s)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,s,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(s){return this._edgeInsets.equals(s)}interpolatePadding(s,u,f){this._unmodified=!1,this._edgeInsets.interpolate(s,u,f),this._constrain(),this._calcMatrices()}coveringZoomLevel(s){let u=(s.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/s.tileSize));return Math.max(0,u)}getVisibleUnwrappedCoordinates(s){let u=[new r.b4(0,s)];if(this._renderWorldCopies){let f=this.pointCoordinate(new r.P(0,0)),g=this.pointCoordinate(new r.P(this.width,0)),v=this.pointCoordinate(new r.P(this.width,this.height)),A=this.pointCoordinate(new r.P(0,this.height)),I=Math.floor(Math.min(f.x,g.x,v.x,A.x)),L=Math.floor(Math.max(f.x,g.x,v.x,A.x)),O=1;for(let N=I-O;N<=L+O;N++)N!==0&&u.push(new r.b4(N,s))}return u}coveringTiles(s){var u,f;let g=this.coveringZoomLevel(s),v=g;if(s.minzoom!==void 0&&g<s.minzoom)return[];s.maxzoom!==void 0&&g>s.maxzoom&&(g=s.maxzoom);let A=this.pointCoordinate(this.getCameraPoint()),I=r.Z.fromLngLat(this.center),L=Math.pow(2,g),O=[L*A.x,L*A.y,0],N=[L*I.x,L*I.y,0],V=Ot.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,g),G=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(G=g);let Q=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,ne=re=>({aabb:new ci([re*L,0,0],[(re+1)*L,L,0]),zoom:0,x:0,y:0,wrap:re,fullyVisible:!1}),ae=[],he=[],de=g,me=s.reparseOverscaled?v:g;if(this._renderWorldCopies)for(let re=1;re<=3;re++)ae.push(ne(-re)),ae.push(ne(re));for(ae.push(ne(0));ae.length>0;){let re=ae.pop(),ve=re.x,xe=re.y,Ae=re.fullyVisible;if(!Ae){let Je=re.aabb.intersects(V);if(Je===0)continue;Ae=Je===2}let Ne=s.terrain?O:N,He=re.aabb.distanceX(Ne),tt=re.aabb.distanceY(Ne),st=Math.max(Math.abs(He),Math.abs(tt));if(re.zoom===de||st>Q+(1<<de-re.zoom)-2&&re.zoom>=G){let Je=de-re.zoom,Qe=O[0]-.5-(ve<<Je),ft=O[1]-.5-(xe<<Je);he.push({tileID:new r.S(re.zoom===de?me:re.zoom,re.wrap,re.zoom,ve,xe),distanceSq:Xe([N[0]-.5-ve,N[1]-.5-xe]),tileDistanceToCamera:Math.sqrt(Qe*Qe+ft*ft)})}else for(let Je=0;Je<4;Je++){let Qe=(ve<<1)+Je%2,ft=(xe<<1)+(Je>>1),zt=re.zoom+1,it=re.aabb.quadrant(Je);if(s.terrain){let Ze=new r.S(zt,re.wrap,zt,Qe,ft),It=s.terrain.getMinMaxElevation(Ze),qi=(u=It.minElevation)!==null&&u!==void 0?u:this.elevation,Pt=(f=It.maxElevation)!==null&&f!==void 0?f:this.elevation;it=new ci([it.min[0],it.min[1],qi],[it.max[0],it.max[1],Pt])}ae.push({aabb:it,zoom:zt,x:Qe,y:ft,wrap:re.wrap,fullyVisible:Ae})}}return he.sort((re,ve)=>re.distanceSq-ve.distanceSq).map(re=>re.tileID)}resize(s,u){this.width=s,this.height=u,this.pixelsToGLUnits=[2/s,-2/u],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(s){return Math.pow(2,s)}scaleZoom(s){return Math.log(s)/Math.LN2}project(s){let u=r.ac(s.lat,-85.051129,Ri);return new r.P(r.O(s.lng)*this.worldSize,r.Q(u)*this.worldSize)}unproject(s){return new r.Z(s.x/this.worldSize,s.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),alt
596itude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(s){let u=this.elevation,f=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,g=this.pointLocation(this.centerPoint,s),v=s.getElevationForLngLatZoom(g,this.tileZoom);if(!(this.elevation-v))return;let A=f+u-v,I=Math.cos(this._pitch)*this.cameraToCenterDistance/A/r.b5(1,g.lat),L=this.scaleZoom(I/this.tileSize);this._elevation=v,this._center=g,this.zoom=L}setLocationAtPoint(s,u){let f=this.pointCoordinate(u),g=this.pointCoordinate(this.centerPoint),v=this.locationCoordinate(s),A=new r.Z(v.x-(f.x-g.x),v.y-(f.y-g.y));this.center=this.coordinateLocation(A),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(s,u){return u?this.coordinatePoint(this.locationCoordinate(s),u.getElevationForLngLatZoom(s,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(s))}pointLocation(s,u){return this.coordinateLocation(this.pointCoordinate(s,u))}locationCoordinate(s){return r.Z.fromLngLat(s)}coordinateLocation(s){return s&&s.toLngLat()}pointCoordinate(s,u){if(u){let G=u.pointCoordinate(s);if(G!=null)return G}let f=[s.x,s.y,0,1],g=[s.x,s.y,1,1];r.af(f,f,this.pixelMatrixInverse),r.af(g,g,this.pixelMatrixInverse);let v=f[3],A=g[3],I=f[1]/v,L=g[1]/A,O=f[2]/v,N=g[2]/A,V=O===N?0:(0-O)/(N-O);return new r.Z(r.y.number(f[0]/v,g[0]/A,V)/this.worldSize,r.y.number(I,L,V)/this.worldSize)}coordinatePoint(s,u=0,f=this.pixelMatrix){let g=[s.x*this.worldSize,s.y*this.worldSize,u,1];return r.af(g,g,f),new r.P(g[0]/g[3],g[1]/g[3])}getBounds(){let s=Math.max(0,this.height/2-this.getHorizon());return new Ie().extend(this.pointLocation(new r.P(0,s))).extend(this.pointLocation(new r.P(this.width,s))).extend(this.pointLocation(new r.P(this.width,this.height))).extend(this.pointLocation(new r.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Ie([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(s){s?(this.lngRange=[s.getWest(),s.getEast()],this.latRange=[s.getSouth(),s.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Ri])}calculateTileMatrix(s){let u=s.canonical,f=this.worldSize/this.zoomScale(u.z),g=u.x+Math.pow(2,u.z)*s.wrap,v=r.an(new Float64Array(16));return r.J(v,v,[g*f,u.y*f,0]),r.K(v,v,[f/r.X,f/r.X,1]),v}calculatePosMatrix(s,u=!1){let f=s.key,g=u?this._alignedPosMatrixCache:this._posMatrixCache;if(g[f])return g[f];let v=this.calculateTileMatrix(s);return r.L(v,u?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,v),g[f]=new Float32Array(v),g[f]}calculateFogMatrix(s){let u=s.key,f=this._fogMatrixCache;if(f[u])return f[u];let g=this.calculateTileMatrix(s);return r.L(g,this.fogMatrix,g),f[u]=new Float32Array(g),f[u]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(s,u){u=r.ac(+u,this.minZoom,this.maxZoom);let f={center:new r.N(s.lng,s.lat),zoom:u},g=this.lngRange;if(!this._renderWorldCopies&&g===null){let re=179.9999999999;g=[-re,re]}let v=this.tileSize*this.zoomScale(f.zoom),A=0,I=v,L=0,O=v,N=0,V=0,{x:G,y:Q}=this.size;if(this.latRange){let re=this.latRange;A=r.Q(re[1])*v,I=r.Q(re[0])*v,I-A<Q&&(N=Q/(I-A))}g&&(L=r.b3(r.O(g[0])*v,0,v),O=r.b3(r.O(g[1])*v,0,v),O<L&&(O+=v),O-L<G&&(V=G/(O-L)));let{x:ne,y:ae}=this.project.call({worldSize:v},s),he,de,me=Math.max(V||0,N||0);if(me){let re=new r.P(V?(O+L)/2:ne,N?(I+A)/2:ae);return f.center=this.unproject.call({worldSize:v},re).wrap(),f.zoom+=this.scaleZoom(me),f}if(this.latRange){let re=Q/2;ae-re<A&&(de=A+re),ae+re>I&&(de=I-re)}if(g){let re=(L+O)/2,ve=ne;
596this._renderWorldCopies&&(ve=r.b3(ne,re-v/2,re+v/2));let xe=G/2;ve-xe<L&&(he=L+xe),ve+xe>O&&(he=O-xe)}if(he!==void 0||de!==void 0){let re=new r.P(he??ne,de??ae);f.center=this.unproject.call({worldSize:v},re).wrap()}return f}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let s=this._unmodified,{center:u,zoom:f}=this.getConstrained(this.center,this.zoom);this.center=u,this.zoom=f,this._unmodified=s,this._constraining=!1}_calcMatrices(){if(!this.height)return;let s=this.centerOffset,u=this.point.x,f=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=r.b5(1,this.center.lat)*this.worldSize;let g=r.an(new Float64Array(16));r.K(g,g,[this.width/2,-this.height/2,1]),r.J(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=r.an(new Float64Array(16)),r.K(g,g,[1,-1,1]),r.J(g,g,[-1,-1,0]),r.K(g,g,[2/this.width,2/this.height,1]),this.glCoordMatrix=g;let v=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),A=Math.min(this.elevation,this.minElevationForCurrentTile),I=v-A*this._pixelPerMeter/Math.cos(this._pitch),L=A<0?I:v,O=Math.PI/2+this._pitch,N=this._fov*(.5+s.y/this.height),V=Math.sin(N)*L/Math.sin(r.ac(Math.PI-O-N,.01,Math.PI-.01)),G=this.getHorizon(),Q=2*Math.atan(G/this.cameraToCenterDistance)*(.5+s.y/(2*G)),ne=Math.sin(Q)*L/Math.sin(r.ac(Math.PI-O-Q,.01,Math.PI-.01)),ae=Math.min(V,ne);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*ae+L),this.nearZ=this.height/50,g=new Float64Array(16),r.b6(g,this._fov,this.width/this.height,this.nearZ,this.farZ),g[8]=2*-s.x/this.width,g[9]=2*s.y/this.height,this.projectionMatrix=r.ae(g),r.K(g,g,[1,-1,1]),r.J(g,g,[0,0,-this.cameraToCenterDistance]),r.b7(g,g,this._pitch),r.ad(g,g,this.angle),r.J(g,g,[-u,-f,0]),this.mercatorMatrix=r.K([],g,[this.worldSize,this.worldSize,this.worldSize]),r.K(g,g,[1,1,this._pixelPerMeter]),this.pixelMatrix=r.L(new Float64Array(16),this.labelPlaneMatrix,g),r.J(g,g,[0,0,-this.elevation]),this.modelViewProjectionMatrix=g,this.invModelViewProjectionMatrix=r.as([],g),this.fogMatrix=new Float64Array(16),r.b6(this.fogMatrix,this._fov,this.width/this.height,v,this.farZ),this.fogMatrix[8]=2*-s.x/this.width,this.fogMatrix[9]=2*s.y/this.height,r.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),r.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),r.b7(this.fogMatrix,this.fogMatrix,this._pitch),r.ad(this.fogMatrix,this.fogMatrix,this.angle),r.J(this.fogMatrix,this.fogMatrix,[-u,-f,0]),r.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),r.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=r.L(new Float64Array(16),this.labelPlaneMatrix,g);let he=this.width%2/2,de=this.height%2/2,me=Math.cos(this.angle),re=Math.sin(this.angle),ve=u-Math.round(u)+me*he+re*de,xe=f-Math.round(f)+me*de+re*he,Ae=new Float64Array(g);if(r.J(Ae,Ae,[ve>.5?ve-1:ve,xe>.5?xe-1:xe,0]),this.alignedModelViewProjectionMatrix=Ae,g=r.as(new Float64Array(16),this.pixelMatrix),!g)throw new Error("failed to invert matrix");this.pixelMatrixInverse=g,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let s=this.pointCoordinate(new r.P(0,0)),u=[s.x*this.worldSize,s.y*this.worldSize,0,1];return r.af(u,u,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new r.P(0,s))}getCameraQueryGeometry(s){let u=this.getCameraPoint();if(s.length===1)return[s[0],u];{let f=u.x,g=u.y,v=u.x,A=u.y;for(let I of s)f=Math.min(f,I.x),g=Math.min(g,I.y),v=Math.max(v,I.x),A=Math.max(A,I.y);return[new r.P(f,g),new r.P(v,g),new r.P(v,A),new r.P(f,A),new r.P(f,g)]}}lngLatToCameraDepth(s,u){let f=this.locationCoordinate(s),g=[f.x*this.worldSize,f.y*this.worldSize,u,1];return r.af(g,g,this.modelViewProjectionMatrix),g[2]/g[3]}}function Zl(x,s){let u,f=!1,g=null,v=null,A=()=>{g=null,f&&(x.apply(v,u),g=setTimeout(A,s),f=!1)};return(...I)=>(f=!0,v=this,u=I,g||A(),g)}class vr{constructor(s){this._getCurrentHash=()=>{let u=window.location.hash.replace("#","");if(this._hashName){let f;return u.split("&").map(g=>
596g.split("=")).forEach(g=>{g[0]===this._hashName&&(f=g)}),(f&&f[1]||"").split("/")}return u.split("/")},this._onHashChange=()=>{let u=this._getCurrentHash();if(u.length>=3&&!u.some(f=>isNaN(f))){let f=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:f,pitch:+(u[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{let u=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,u)},this._removeHash=()=>{let u=this._getCurrentHash();if(u.length===0)return;let f=u.join("/"),g=f;g.split("&").length>0&&(g=g.split("&")[0]),this._hashName&&(g=`${this._hashName}=${f}`);let v=window.location.hash.replace(g,"");v.startsWith("#&")?v=v.slice(0,1)+v.slice(2):v==="#"&&(v="");let A=window.location.href.replace(/(#.+)?$/,v);A=A.replace("&&","&"),window.history.replaceState(window.history.state,null,A)},this._updateHash=Zl(this._updateHashUnthrottled,300),this._hashName=s&&encodeURIComponent(s)}addTo(s){return this._map=s,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()),this._removeHash(),delete this._map,this}getHashString(s){let u=this._map.getCenter(),f=Math.round(100*this._map.getZoom())/100,g=Math.ceil((f*Math.LN2+Math.log(512/360/.5))/Math.LN10),v=Math.pow(10,g),A=Math.round(u.lng*v)/v,I=Math.round(u.lat*v)/v,L=this._map.getBearing(),O=this._map.getPitch(),N="";if(N+=s?`/${A}/${I}/${f}`:`${f}/${I}/${A}`,(L||O)&&(N+="/"+Math.round(10*L)/10),O&&(N+=`/${Math.round(O)}`),this._hashName){let V=this._hashName,G=!1,Q=window.location.hash.slice(1).split("&").map(ne=>{let ae=ne.split("=")[0];return ae===V?(G=!0,`${ae}=${N}`):ne}).filter(ne=>ne);return G||Q.push(`${V}=${N}`),`#${Q.join("&")}`}return`#${N}`}}let fa={linearity:.3,easing:r.b8(0,0,.3,1)},ph=r.e({deceleration:2500,maxSpeed:1400},fa),ol=r.e({deceleration:20,maxSpeed:1400},fa),Kl=r.e({deceleration:1e3,maxSpeed:360},fa),ma=r.e({deceleration:1e3,maxSpeed:90},fa);class ki{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:T.now(),settings:s})}_drainInertiaBuffer(){let s=this._inertiaBuffer,u=T.now();for(;s.length>0&&u-s[0].time>160;)s.shift()}_onMoveEnd(s){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let u={zoom:0,bearing:0,pitch:0,pan:new r.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:v}of this._inertiaBuffer)u.zoom+=v.zoomDelta||0,u.bearing+=v.bearingDelta||0,u.pitch+=v.pitchDelta||0,v.panDelta&&u.pan._add(v.panDelta),v.around&&(u.around=v.around),v.pinchAround&&(u.pinchAround=v.pinchAround);let f=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,g={};if(u.pan.mag()){let v=al(u.pan.mag(),f,r.e({},ph,s||{}));g.offset=u.pan.mult(v.amount/u.pan.mag()),g.center=this._map.transform.center,Xl(g,v)}if(u.zoom){let v=al(u.zoom,f,ol);g.zoom=this._map.transform.zoom+v.amount,Xl(g,v)}if(u.bearing){let v=al(u.bearing,f,Kl);g.bearing=this._map.transform.bearing+r.ac(v.amount,-179,179),Xl(g,v)}if(u.pitch){let v=al(u.pitch,f,ma);g.pitch=this._map.transform.pitch+v.amount,Xl(g,v)}if(g.zoom||g.bearing){let v=u.pinchAround===void 0?u.around:u.pinchAround;g.around=v?this._map.unproject(v):this._map.getCenter()}return this.clear(),r.e(g,{noMoveStart:!0})}}function Xl(x,s){(!x.duration||x.duration<s.duration)&&(x.duration=s.duration,x.easing=s.easing)}function al(x,s,u){let{maxSpeed:f,linearity:g,deceleration:v}=u,A=r.ac(x*g/(s/1e3),-f,f),I=Math.abs(A)/(v*g);return{easing:u.easing,duration:1e3*I,amount:A*(I/2)}}class Ln extends r.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,u,f,g={}){let v=k.mousePos(u.getCanvas(),f),A=u.unproject(v);super(s,r.e({point:v,lngLat:A,originalEvent:f},g)),this._defaultPrevented=!1,this.target=u}}class ga extends r.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,u,f){let g=s==="touchend"?f.changedTouches:f.touches,v=k.touchPos(u.getCanvasContainer(),g),A=v.map(L=>u.unproject(L)),I=v.reduce((L,O,N,V)=>L.add(O.div(V.length)),new r.P(0,0));super(s,{points:v,point:I,lngLats:A,lngLat:u.unproject(I),originalEvent:f}),this._defaultPrevented=!1}}class Gd extends r.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,u,f){super(s,{originalEvent:f}),this._defaultPrevented=!1}}class Zd{constructor(s,u){this._map=s,this._clickTolerance=u.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new Gd(s.type,this._map,s))}mousedown(s,u){return this._mousedownPos=u,this._firePreventable(new Ln(s.type,this._map,s))}mouseup(s){this._map.fire(new Ln(s.type,this._map,s))}click(s,u){this._mousedownPos&&this._mousedownPos.dist(u)>=this._clickTolerance||this._map.fire(new Ln(s.type,this._map,s))}dblclick(s){return this._firePreventable(new Ln(s.type,this._map,s))}mouseover(s){this._map.fire(new Ln(s.type,this._map,s))}mouseout(s){this._map.fire(new Ln(s.type,this._map,s))}touchstart(s){return this._firePreventable(new ga(s.type,this._map,s))}touchmove(s){this._map.fire(new ga(s.type,this._map,s))}touchend(s){this._map.fire(new ga(s.type,this._map,s))}touchcancel(s){this._map.fire(new ga(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class en{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new Ln(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ln("c
596ontextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new Ln(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Un{constructor(s){this._map=s}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(s){return this.transform.pointLocation(r.P.convert(s),this._map.terrain)}}class rr{constructor(s,u){this._map=s,this._tr=new Un(s),this._el=s.getCanvasContainer(),this._container=s.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(s,u){this.isEnabled()&&s.shiftKey&&s.button===0&&(k.disableDrag(),this._startPos=this._lastPos=u,this._active=!0)}mousemoveWindow(s,u){if(!this._active)return;let f=u;if(this._lastPos.equals(f)||!this._box&&f.dist(this._startPos)<this._clickTolerance)return;let g=this._startPos;this._lastPos=f,this._box||(this._box=k.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",s));let v=Math.min(g.x,f.x),A=Math.max(g.x,f.x),I=Math.min(g.y,f.y),L=Math.max(g.y,f.y);k.setTransform(this._box,`translate(${v}px,${I}px)`),this._box.style.width=A-v+"px",this._box.style.height=L-I+"px"}mouseupWindow(s,u){if(!this._active||s.button!==0)return;let f=this._startPos,g=u;if(this.reset(),k.suppressClick(),f.x!==g.x||f.y!==g.y)return this._map.fire(new r.k("boxzoomend",{originalEvent:s})),{cameraAnimation:v=>v.fitScreenCoordinates(f,g,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",s)}keydown(s){this._active&&s.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",s))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(k.remove(this._box),this._box=null),k.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,u){return this._map.fire(new r.k(s,{originalEvent:u}))}}function ll(x,s){if(x.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${x.length}, points ${s.length}`);let u={};for(let f=0;f<x.length;f++)u[x[f].identifier]=s[f];return u}class cl{constructor(s){this.reset(),this.numTouches=s.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(s,u,f){(this.centroid||f.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),f.length===this.numTouches&&(this.centroid=function(g){let v=new r.P(0,0);for(let A of g)v._add(A);return v.div(g.length)}(u),this.touches=ll(f,u)))}touchmove(s,u,f){if(this.aborted||!this.centroid)return;let g=ll(f,u);for(let v in this.touches){let A=g[v];(!A||A.dist(this.touches[v])>30)&&(this.aborted=!0)}}touchend(s,u,f){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),f.length===0){let g=!this.aborted&&this.centroid;if(this.reset(),g)return g}}}class Yl{constructor(s){this.singleTap=new cl(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(s,u,f){this.singleTap.touchstart(s,u,f)}touchmove(s,u,f){this.singleTap.touchmove(s,u,f)}touchend(s,u,f){let g=this.singleTap.touchend(s,u,f);if(g){let v=s.timeStamp-this.lastTime<500,A=!this.lastTap||this.lastTap.dist(g)<30;if(v&&A||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=g,this.count===this.numTaps)return this.reset(),g}}}class ya{constructor(s){this._tr=new Un(s),this._zoomIn=new Yl({numTouches:1,numTaps:2}),this._zoomOut=new Yl({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,u,f){this._zoomIn.touchstart(s,u,f),this._zoomOut.touchstart(s,u,f)}touchmove(s,u,f){this._zoomIn.touchmove(s,u,f),this._zoomOut.touchmove(s,u,f)}touchend(s,u,f){let g=this._zoomIn.touchend(s,u,f),v=this._zoomOut.touchend(s,u,f),A=this._tr;return g?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:A.zoom+1,around:A.unproject(g)},{originalEvent:s})}):v?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:A.zoom-1,around:A.unproject(v)},{originalEvent:s})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ls{constructor(s){this._enabled=!!s.enable,this._moveStateManager=s.moveStateManager,this._clickTolerance=s.clickTolerance||1,this._moveFunction=s.move,this._activateOnStart=!!s.activateOnStart,s.assignEvents(this),this.reset()}reset(s){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(s)}_move(...s){let u=this._moveFunction(...s);if(u.bearingDelta||u.pitchDelta||u.around||u.panDelta)return this._active=!0,u}dragStart(s,u){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(s)&&(this._moveStateManager.startMove(s),this._lastPoint=u.length?u[0]:u,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(s,u){if(!this.isEnabled())return;let f=this._lastPoint;if(!f)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);let g=u.length?u[0]:u;return!this._moved&&g.dist(f)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=g,this._move(f,g))}dragEnd(s){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(s)&&(this._moved&&k.suppressClick(),this.reset(s))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}let Qc={0:1,2:2};class $o{constructor(s){this._correctEvent=s.checkCorrectEvent}startMove(s){let u=k.mouseButton(s);this._eventButton=u}endMove(s){delete this._eventButton}isValidStartEvent(s){return this._correctEvent(s)}isValidMoveEvent(s){return!function(u,f){let g=Qc[f];return u.buttons===void 0||(u.buttons&g)!==g}(s,this._eventButton)}isValidEndEvent(s){return k.mouseButton(s)===this._eventButton}}class mo{constructor(){this._firstTouch=void 0}_isOneFingerTouch(s){return s.targetTouches.length===1}_isSameTouchEvent(s){return s.targetTouches[0].identifier===this._firstTouch}startMove(s){this._firstTouch=s.targetTouches[0].identifier}endMove(s){delete this._firstTouch}isValidStartEvent(s){return this._isOneFingerTouch(s)}isValidMoveEvent(s){return this._isOneFingerTouch(s)&&this._isSameTouchEvent(s)}isValidEndEvent(s){return this._isOneFingerTouch(s)&&this._isSameTouchEvent(s)}}let _a=x=>
vendor: 4,207 bytes, line 596
596{x.mousedown=x.dragStart,x.mousemoveWindow=x.dragMove,x.mouseup=x.dragEnd,x.contextmenu=s=>{s.preventDefault()}},fh=({enable:x,clickTolerance:s,bearingDegreesPerPixelMoved:u=.8})=>{let f=new $o({checkCorrectEvent:g=>k.mouseButton(g)===0&&g.ctrlKey||k.mouseButton(g)===2});return new ls({clickTolerance:s,move:(g,v)=>({bearingDelta:(v.x-g.x)*u}),moveStateManager:f,enable:x,assignEvents:_a})},mh=({enable:x,clickTolerance:s,pitchDegreesPerPixelMoved:u=-.5})=>{let f=new $o({checkCorrectEvent:g=>k.mouseButton(g)===0&&g.ctrlKey||k.mouseButton(g)===2});return new ls({clickTolerance:s,move:(g,v)=>({pitchDelta:(v.y-g.y)*u}),moveStateManager:f,enable:x,assignEvents:_a})};class va{constructor(s,u){this._clickTolerance=s.clickTolerance||1,this._map=u,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new r.P(0,0)}_shouldBePrevented(s){return s<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(s,u,f){return this._calculateTransform(s,u,f)}touchmove(s,u,f){if(this._active){if(!this._shouldBePrevented(f.length))return s.preventDefault(),this._calculateTransform(s,u,f);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",s)}}touchend(s,u,f){this._calculateTransform(s,u,f),this._active&&this._shouldBePrevented(f.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(s,u,f){f.length>0&&(this._active=!0);let g=ll(f,u),v=new r.P(0,0),A=new r.P(0,0),I=0;for(let O in g){let N=g[O],V=this._touches[O];V&&(v._add(N),A._add(N.sub(V)),I++,g[O]=N)}if(this._touches=g,this._shouldBePrevented(I)||!A.mag())return;let L=A.div(I);return this._sum._add(L),this._sum.mag()<this._clickTolerance?void 0:{around:v.div(I),panDelta:L}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ba{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(s,u,f){this._firstTwoTouches||f.length<2||(this._firstTwoTouches=[f[0].identifier,f[1].identifier],this._start([u[0],u[1]]))}touchmove(s,u,f){if(!this._firstTwoTouches)return;s.preventDefault();let[g,v]=this._firstTwoTouches,A=Uo(f,u,g),I=Uo(f,u,v);if(!A||!I)return;let L=this._aroundCenter?null:A.add(I).div(2);return this._move([A,I],L,s)}touchend(s,u,f){if(!this._firstTwoTouches)return;let[g,v]=this._firstTwoTouches,A=Uo(f,u,g),I=Uo(f,u,v);A&&I||(this._active&&k.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(s){this._enabled=!0,this._aroundCenter=!!s&&s.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Uo(x,s,u){for(let f=0;f<x.length;f++)if(x[f].identifier===u)return s[f]}function Jl(x,s){return Math.log(x/s)/Math.LN2}class gh extends ba{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(s){this._startDistance=this._distance=s[0].dist(s[1])}_move(s,u){let f=this._distance;if(this._distance=s[0].dist(s[1]),this._active||!(Math.abs(Jl(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Jl(this._distance,f),pinchAround:u}}}function eu(x,s){return 180*x.angleWith(s)/Math.PI}class yh extends ba{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(s){this._startVector=this._vector=s[0].sub(s[1]),this._minDiameter=s[0].dist(s[1])}_move(s,u,f){let g=this._vector;if(this._vector=s[0].sub(s[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:eu(this._vector,g),pinchAround:u}}_isBelowThreshold(s){this._minDiameter=Math.min(this._minDiameter,s.mag());let u=25/(Math.PI*this._minDiameter)*360,f=eu(s,this._startVector);return Math.abs(f)<u}}function tu(x){return Math.abs(x.y)>Math.abs(x.x)}class sn extends ba{constructor(s){super(),this._currentTouchCount=0,this._map=s}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(s,u,f){super.touchstart(s,u,f),this._currentTouchCount=f.length}_start(s){this._lastPoints=s,tu(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,u,f){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let g=s[0].sub(this._lastPoints[0]),v=s[1].sub(this._lastPoints[1]);
596return this._valid=this.gestureBeginsVertically(g,v,f.timeStamp),this._valid?(this._lastPoints=s,this._active=!0,{pitchDelta:(g.y+v.y)/2*-.5}):void 0}gestureBeginsVertically(s,u,f){if(this._valid!==void 0)return this._valid;let g=s.mag()>=2,v=u.mag()>=2;if(!g&&!v)return;if(!g||!v)return this._firstMove===void 0&&(this._firstMove=f),f-this._firstMove<100&&void 0;let A=s.y>0==u.y>0;return tu(s)&&tu(u)&&A}}let Kn={panStep:100,bearingStep:15,pitchStep:10};class cs{constructor(s){this._tr=new Un(s);let u=Kn;this._panStep=u.panStep,this._bearingStep=u.bearingStep,this._pitchStep=u.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(s){if(s.altKey||s.ctrlKey||s.metaKey)return;let u=0,f=0,g=0,v=0,A=0;switch(s.keyCode){case 61:case 107:case 171:case 187:u=1;break;case 189:case 109:case 173:u=-1;break;case 37:s.shiftKey?f=-1:(s.preventDefault(),v=-1);break;case 39:s.shiftKey?f=1:(s.preventDefault(),v=1);break;case 38:s.shiftKey?g=1:(s.preventDefault(),A=-1);break;case 40:s.shiftKey?g=-1:(s.preventDefault(),A=1);break;default:return}return this._rotationDisabled&&(f=0,g=0),{cameraAnimation:I=>{let L=this._tr;I.easeTo({duration:300,easeId:"keyboardHandler",easing:Xs,zoom:u?Math.round(L.zoom)+u*(s.shiftKey?2:1):L.zoom,bearing:L.bearing+f*this._bearingStep,pitch:L.pitch+g*this._pitchStep,offset:[-v*this._panStep,-A*this._panStep],center:L.center},{originalEvent:s})}}}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 Xs(x){return x*(2-x)}let iu=4.000244140625;class Ds{constructor(s,u){this._onTimeout=f=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(f)},this._map=s,this._tr=new Un(s),this._triggerRenderFrame=u,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(s){this._defaultZoomRate=s}setWheelZoomRate(s){this._wheelZoomRate=s}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(s){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!s&&s.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(s){return!!this._map.cooperativeGestures.isEnabled()&&!(s.ctrlKey||this._map.cooperativeGestures.isBypassed(s))}wheel(s){if(!this.isEnabled())return;if(this._shouldBePrevented(s))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",s);let u=s.deltaMode===WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY,f=T.now(),g=f-(this._lastWheelEventTime||0);this._lastWheelEventTime=f,u!==0&&u%iu==0?this._type="wheel":u!==0&&Math.abs(u)<4?this._type="trackpad":g>400?(this._type=null,this._lastValue=u,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(g*u)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,u+=this._lastValue)),s.shiftKey&&u&&(u/=4),this._type&&(this._lastWheelEvent=s,this._delta-=u,this._active||this._start(s)),s.preventDefault()}_start(s){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);let u=k.mousePos(this._map.getCanvas(),s),f=this._tr;this._around=u.y>f.transform.height/2-f.transform.getHorizon()?r.N.convert(this._aroundCenter?f.center:f.unproject(u)):r.N.convert(f.center),this._aroundPoint=f.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let s=this._tr.transform;if(this._delta!==0){let L=this._type==="wheel"&&Math.abs(this._delta)>iu?this._wheelZoomRate:this._defaultZoomRate,O=2/(1+Math.exp(-Math.abs(this._delta*L)));this._delta<0&&O!==0&&(O=1/O);let N=typeof this._targetZoom=="number"?s.zoomScale(this._targetZoom):s.scale;this._targetZoom=Math.min(s.maxZoom,Math.max(s.minZoom,s.scaleZoom(N*O))),this._type==="wheel"&&(this._startZoom=s.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let u=typeof this._targetZoom=="number"?this._targetZoom:s.zoom,f=this._startZoom,g=this._easing,v,A=!1,I=T.now()-this._lastWheelEventTime;if(this._type==="wheel"&&f&&g&&I){let L=Math.min(I/200,1),O=g(L);v=r.y.number(f,u,O),L<1?this._frameId||(this._frameId=!0):A=!0}else v=u,A=!0;return this._active=!0,A&&(this._active=!1,this._finishTimeout=setTimeout(()=>
596{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!A,zoomDelta:v-s.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let u=r.b9;if(this._prevEase){let f=this._prevEase,g=(T.now()-f.start)/f.duration,v=f.easing(g+.01)-f.easing(g),A=.27/Math.sqrt(v*v+1e-4)*.01,I=Math.sqrt(.0729-A*A);u=r.b8(A,I,.25,1)}return this._prevEase={start:T.now(),duration:s,easing:u},u}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class go{constructor(s,u){this._clickZoom=s,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 Ql{constructor(s){this._tr=new Un(s),this.reset()}reset(){this._active=!1}dblclick(s,u){return s.preventDefault(),{cameraAnimation:f=>{f.easeTo({duration:300,zoom:this._tr.zoom+(s.shiftKey?-1:1),around:this._tr.unproject(u)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class _h{constructor(){this._tap=new Yl({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(s,u,f){if(!this._swipePoint)if(this._tapTime){let g=u[0],v=s.timeStamp-this._tapTime<500,A=this._tapPoint.dist(g)<30;v&&A?f.length>0&&(this._swipePoint=g,this._swipeTouch=f[0].identifier):this.reset()}else this._tap.touchstart(s,u,f)}touchmove(s,u,f){if(this._tapTime){if(this._swipePoint){if(f[0].identifier!==this._swipeTouch)return;let g=u[0],v=g.y-this._swipePoint.y;return this._swipePoint=g,s.preventDefault(),this._active=!0,{zoomDelta:v/128}}}else this._tap.touchmove(s,u,f)}touchend(s,u,f){if(this._tapTime)this._swipePoint&&f.length===0&&this.reset();else{let g=this._tap.touchend(s,u,f);g&&(this._tapTime=s.timeStamp,this._tapPoint=g)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class xa{constructor(s,u,f){this._el=s,this._mousePan=u,this._touchPan=f}enable(s){this._inertiaOptions=s||{},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 ul{constructor(s,u,f){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=u,this._mousePitch=f}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 wa{constructor(s,u,f,g){this._el=s,this._touchZoom=u,this._touchRotate=f,this._tapDragZoom=g,this._rotationDisabled=!1,this._enabled=!0}enable(s){this._touchZoom.enable(s),this._rotationDisabled||this._touchRotate.enable(s),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 yo{constructor(s,u){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=s,this._options=u,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let s=this._map.getCanvasContainer();s.classList.add("maplibregl-cooperative-gestures"),this._container=k.create("div","maplibregl-cooperative-gesture-screen",s);let u=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(u=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let f=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),g=document.createElement("div");g.className="maplibregl-desktop-message",g.textContent=u,this._container.appendChild(g);
596let v=document.createElement("div");v.className="maplibregl-mobile-message",v.textContent=f,this._container.appendChild(v),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(k.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._destroyUI()}isEnabled(){return this._enabled}isBypassed(s){return s[this._bypassKey]}notifyGestureBlocked(s,u){this._enabled&&(this._map.fire(new r.k("cooperativegestureprevented",{gestureType:s,originalEvent:u})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}let Xn=x=>x.zoom||x.drag||x.pitch||x.rotate;class dt extends r.k{}function nu(x){return x.panDelta&&x.panDelta.mag()||x.zoomDelta||x.bearingDelta||x.pitchDelta}class vh{constructor(s,u){this.handleWindowEvent=g=>{this.handleEvent(g,`${g.type}Window`)},this.handleEvent=(g,v)=>{if(g.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let A=g.type==="renderFrame"?void 0:g,I={needsRenderFrame:!1},L={},O={},N=g.touches,V=N?this._getMapTouches(N):void 0,G=V?k.touchPos(this._map.getCanvas(),V):k.mousePos(this._map.getCanvas(),g);for(let{handlerName:ae,handler:he,allowed:de}of this._handlers){if(!he.isEnabled())continue;let me;this._blockedByActive(O,de,ae)?he.reset():he[v||g.type]&&(me=he[v||g.type](g,G,V),this.mergeHandlerResult(I,L,me,ae,A),me&&me.needsRenderFrame&&this._triggerRenderFrame()),(me||he.isActive())&&(O[ae]=he)}let Q={};for(let ae in this._previousActiveHandlers)O[ae]||(Q[ae]=A);this._previousActiveHandlers=O,(Object.keys(Q).length||nu(I))&&(this._changes.push([I,L,Q]),this._triggerRenderFrame()),(Object.keys(O).length||nu(I))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:ne}=I;ne&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ne(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ki(s),this._bearingSnap=u.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(u);let f=this._el;this._listeners=[[f,"touchstart",{passive:!0}],[f,"touchmove",{passive:!1}],[f,"touchend",void 0],[f,"touchcancel",void 0],[f,"mousedown",void 0],[f,"mousemove",void 0],[f,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[f,"mouseover",void 0],[f,"mouseout",void 0],[f,"dblclick",void 0],[f,"click",void 0],[f,"keydown",{capture:!1}],[f,"keyup",void 0],[f,"wheel",{passive:!1}],[f,"contextmenu",void 0],[window,"blur",void 0]];for(let[g,v,A]of this._listeners)k.addEventListener(g,v,g===document?this.handleWindowEvent:this.handleEvent,A)}destroy(){for(let[s,u,f]of this._listeners)k.removeEventListener(s,u,s===document?this.handleWindowEvent:this.handleEvent,f)}_addDefaultHandlers(s){let u=this._map,f=u.getCanvasContainer();this._add("mapEvent",new Zd(u,s));let g=u.boxZoom=new rr(u,s);this._add("boxZoom",g),s.interactive&&s.boxZoom&&g.enable();let v=u.cooperativeGestures=new yo(u,s.cooperativeGestures);this._add("cooperativeGestures",v),s.cooperativeGestures&&v.enable();let A=new ya(u),I=new Ql(u);u.doubleClickZoom=new go(I,A),this._add("tapZoom",A),this._add("clickZoom",I),s.interactive&&s.doubleClickZoom&&u.doubleClickZoom.enable();let L=new _h;this._add("tapDragZoom",L);let O=u.touchPitch=new sn(u);this._add("touchPitch",O),s.interactive&&s.touchPitch&&u.touchPitch.enable(s.touchPitch);let N=fh(s),V=mh(s);u.dragRotate=new ul(s,N,V),this._add("mouseRotate",N,["mousePitch"]),this._add("mousePitch",V,["mouseRotate"]),s.interactive&&s.dragRotate&&u.dragRotate.enable();let G=(({enable:me,clickTolerance:re})=>{let ve=new $o({checkCorrectEvent:xe=>k.mouseButton(xe)===0&&!xe.ctrlKey});return new ls({clickTolerance:re,move:(xe,Ae)=>({around:Ae,panDelta:Ae.sub(xe)}),activateOnStart:!0,moveStateManager:ve,enable:me,assignEvents:_a})})(s),Q=new va(s,u);u.dragPan=new xa(f,G,Q),this._add("mousePan",G),this._add("touchPan",Q,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&u.dragPan.enable(s.dragPan);let ne=new yh,ae=new gh;u.touchZoomRotate=new wa(f,ae,ne,L),this._add("touchRotate",ne,["touchPan","touchZoom"]),this._add("touchZoom",ae,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&u.touchZoomRotate.enable(s.touchZoomRotate);let he=u.scrollZoom=new Ds(u,()=>
596this._triggerRenderFrame());this._add("scrollZoom",he,["mousePan"]),s.interactive&&s.scrollZoom&&u.scrollZoom.enable(s.scrollZoom);let de=u.keyboard=new cs(u);this._add("keyboard",de),s.interactive&&s.keyboard&&u.keyboard.enable(),this._add("blockableMapEvent",new en(u))}_add(s,u,f){this._handlers.push({handlerName:s,handler:u,allowed:f}),this._handlersById[s]=u}stop(s){if(!this._updatingCamera){for(let{handler:u}of this._handlers)u.reset();this._inertia.clear(),this._fireEvents({},{},s),this._changes=[]}}isActive(){for(let{handler:s}of this._handlers)if(s.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Xn(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,u,f){for(let g in s)if(g!==f&&(!u||u.indexOf(g)<0))return!0;return!1}_getMapTouches(s){let u=[];for(let f of s)this._el.contains(f.target)&&u.push(f);return u}mergeHandlerResult(s,u,f,g,v){if(!f)return;r.e(s,f);let A={handlerName:g,originalEvent:f.originalEvent||v};f.zoomDelta!==void 0&&(u.zoom=A),f.panDelta!==void 0&&(u.drag=A),f.pitchDelta!==void 0&&(u.pitch=A),f.bearingDelta!==void 0&&(u.rotate=A)}_applyChanges(){let s={},u={},f={};for(let[g,v,A]of this._changes)g.panDelta&&(s.panDelta=(s.panDelta||new r.P(0,0))._add(g.panDelta)),g.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+g.zoomDelta),g.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+g.bearingDelta),g.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+g.pitchDelta),g.around!==void 0&&(s.around=g.around),g.pinchAround!==void 0&&(s.pinchAround=g.pinchAround),g.noInertia&&(s.noInertia=g.noInertia),r.e(u,v),r.e(f,A);this._updateMapTransform(s,u,f),this._changes=[]}_updateMapTransform(s,u,f){let g=this._map,v=g._getTransformForUpdate(),A=g.terrain;if(!(nu(s)||A&&this._terrainMovement))return this._fireEvents(u,f,!0);let{panDelta:I,zoomDelta:L,bearingDelta:O,pitchDelta:N,around:V,pinchAround:G}=s;G!==void 0&&(V=G),g._stop(!0),V=V||g.transform.centerPoint;let Q=v.pointLocation(I?V.sub(I):V);O&&(v.bearing+=O),N&&(v.pitch+=N),L&&(v.zoom+=L),A?this._terrainMovement||!u.drag&&!u.zoom?u.drag&&this._terrainMovement?v.center=v.pointLocation(v.centerPoint.sub(I)):v.setLocationAtPoint(Q,V):(this._terrainMovement=!0,this._map._elevationFreeze=!0,v.setLocationAtPoint(Q,V)):v.setLocationAtPoint(Q,V),g._applyUpdatedTransform(v),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(u,f,!0)}_fireEvents(s,u,f){let g=Xn(this._eventsInProgress),v=Xn(s),A={};for(let V in s){let{originalEvent:G}=s[V];this._eventsInProgress[V]||(A[`${V}start`]=G),this._eventsInProgress[V]=s[V]}!g&&v&&this._fireEvent("movestart",v.originalEvent);for(let V in A)this._fireEvent(V,A[V]);v&&this._fireEvent("move",v.originalEvent);for(let V in s){let{originalEvent:G}=s[V];this._fireEvent(V,G)}let I={},L;for(let V in this._eventsInProgress){let{handlerName:G,originalEvent:Q}=this._eventsInProgress[V];this._handlersById[G].isActive()||(delete this._eventsInProgress[V],L=u[G]||Q,I[`${V}end`]=L)}for(let V in I)this._fireEvent(V,I[V]);let O=Xn(this._eventsInProgress),N=(g||v)&&!O;if(N&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let V=this._map._getTransformForUpdate();V.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(V)}if(f&&N){this._updatingCamera=!0;let V=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),G=Q=>Q!==0&&-this._bearingSnap<Q&&Q<this._bearingSnap;!V||!V.essential&&T.prefersReducedMotion?(this._map.fire(new r.k("moveend",{originalEvent:L})),G(this._map.getBearing())&&this._map.resetNorth()):(G(V.bearing||this._map.getBearing())&&(V.bearing=0),V.freezeElevation=!0,this._map.easeTo(V,{originalEvent:L})),this._updatingCamera=!1}}_fireEvent(s,u){this._map.fire(new r.k(s,u?{originalEvent:u}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(s=>{delete this._frameId,this.handleEvent(new dt("renderFrame",{timeStamp:s})),this._applyChanges()})}
596_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Kd extends r.E{constructor(s,u){super(),this._renderFrameCallback=()=>{let f=Math.min((T.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(f)),f<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=s,this._bearingSnap=u.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new r.N(this.transform.center.lng,this.transform.center.lat)}setCenter(s,u){return this.jumpTo({center:s},u)}panBy(s,u,f){return s=r.P.convert(s).mult(-1),this.panTo(this.transform.center,r.e({offset:s},u),f)}panTo(s,u,f){return this.easeTo(r.e({center:s},u),f)}getZoom(){return this.transform.zoom}setZoom(s,u){return this.jumpTo({zoom:s},u),this}zoomTo(s,u,f){return this.easeTo(r.e({zoom:s},u),f)}zoomIn(s,u){return this.zoomTo(this.getZoom()+1,s,u),this}zoomOut(s,u){return this.zoomTo(this.getZoom()-1,s,u),this}getBearing(){return this.transform.bearing}setBearing(s,u){return this.jumpTo({bearing:s},u),this}getPadding(){return this.transform.padding}setPadding(s,u){return this.jumpTo({padding:s},u),this}rotateTo(s,u,f){return this.easeTo(r.e({bearing:s},u),f)}resetNorth(s,u){return this.rotateTo(0,r.e({duration:1e3},s),u),this}resetNorthPitch(s,u){return this.easeTo(r.e({bearing:0,pitch:0,duration:1e3},s),u),this}snapToNorth(s,u){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(s,u):this}getPitch(){return this.transform.pitch}setPitch(s,u){return this.jumpTo({pitch:s},u),this}cameraForBounds(s,u){s=Ie.convert(s).adjustAntiMeridian();let f=u&&u.bearing||0;return this._cameraForBoxAndBearing(s.getNorthWest(),s.getSouthEast(),f,u)}_cameraForBoxAndBearing(s,u,f,g){let v={top:0,bottom:0,right:0,left:0};if(typeof(g=r.e({padding:v,offset:[0,0],maxZoom:this.transform.maxZoom},g)).padding=="number"){let Je=g.padding;g.padding={top:Je,bottom:Je,right:Je,left:Je}}g.padding=r.e(v,g.padding);let A=this.transform,I=A.padding,L=new Ie(s,u),O=A.project(L.getNorthWest()),N=A.project(L.getNorthEast()),V=A.project(L.getSouthEast()),G=A.project(L.getSouthWest
596()),Q=r.ba(-f),ne=O.rotate(Q),ae=N.rotate(Q),he=V.rotate(Q),de=G.rotate(Q),me=new r.P(Math.max(ne.x,ae.x,de.x,he.x),Math.max(ne.y,ae.y,de.y,he.y)),re=new r.P(Math.min(ne.x,ae.x,de.x,he.x),Math.min(ne.y,ae.y,de.y,he.y)),ve=me.sub(re),xe=(A.width-(I.left+I.right+g.padding.left+g.padding.right))/ve.x,Ae=(A.height-(I.top+I.bottom+g.padding.top+g.padding.bottom))/ve.y;if(Ae<0||xe<0)return void r.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");let Ne=Math.min(A.scaleZoom(A.scale*Math.min(xe,Ae)),g.maxZoom),He=r.P.convert(g.offset),tt=new r.P((g.padding.left-g.padding.right)/2,(g.padding.top-g.padding.bottom)/2).rotate(r.ba(f)),st=He.add(tt).mult(A.scale/A.zoomScale(Ne));return{center:A.unproject(O.add(V).div(2).sub(st)),zoom:Ne,bearing:f}}fitBounds(s,u,f){return this._fitInternal(this.cameraForBounds(s,u),u,f)}fitScreenCoordinates(s,u,f,g,v){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(r.P.convert(s)),this.transform.pointLocation(r.P.convert(u)),f,g),g,v)}_fitInternal(s,u,f){return s?(delete(u=r.e(s,u)).padding,u.linear?this.easeTo(u,f):this.flyTo(u,f)):this}jumpTo(s,u){this.stop();let f=this._getTransformForUpdate(),g=!1,v=!1,A=!1;return"zoom"in s&&f.zoom!==+s.zoom&&(g=!0,f.zoom=+s.zoom),s.center!==void 0&&(f.center=r.N.convert(s.center)),"bearing"in s&&f.bearing!==+s.bearing&&(v=!0,f.bearing=+s.bearing),"pitch"in s&&f.pitch!==+s.pitch&&(A=!0,f.pitch=+s.pitch),s.padding==null||f.isPaddingEqual(s.padding)||(f.padding=s.padding),this._applyUpdatedTransform(f),this.fire(new r.k("movestart",u)).fire(new r.k("move",u)),g&&this.fire(new r.k("zoomstart",u)).fire(new r.k("zoom",u)).fire(new r.k("zoomend",u)),v&&this.fire(new r.k("rotatestart",u)).fire(new r.k("rotate",u)).fire(new r.k("rotateend",u)),A&&this.fire(new r.k("pitchstart",u)).fire(new r.k("pitch",u)).fire(new r.k("pitchend",u)),this.fire(new r.k("moveend",u))}calculateCameraOptionsFromTo(s,u,f,g=0){let v=r.Z.fromLngLat(s,u),A=r.Z.fromLngLat(f,g),I=A.x-v.x,L=A.y-v.y,O=A.z-v.z,N=Math.hypot(I,L,O);if(N===0)throw new Error("Can't calculate camera options with same From and To");let V=Math.hypot(I,L),G=this.transform.scaleZoom(this.transform.cameraToCenterDistance/N/this.transform.tileSize),Q=180*Math.atan2(I,-L)/Math.PI,ne=180*Math.acos(V/N)/Math.PI;return ne=O<0?90-ne:90+ne,{center:A.toLngLat(),zoom:G,pitch:ne,bearing:Q}}easeTo(s,u){var f;this._stop(!1,s.easeId),((s=r.e({offset:[0,0],duration:500,easing:r.b9},s)).animate===!1||!s.essential&&T.prefersReducedMotion)&&(s.duration=0);let g=this._getTransformForUpdate(),v=g.zoom,A=g.bearing,I=g.pitch,L=g.padding,O="bearing"in s?this._normalizeBearing(s.bearing,A):A,N="pitch"in s?+s.pitch:I,V="padding"in s?s.padding:g.padding,G=r.P.convert(s.offset),Q=g.centerPoint.add(G),ne=g.pointLocation(Q),{center:ae,zoom:he}=g.getConstrained(r.N.convert(s.center||ne),(f=s.zoom)!==null&&f!==void 0?f:v);this._normalizeCenter(ae,g);let de=g.project(ne),me=g.project(ae).sub(de),re=g.zoomScale(he-v),ve,xe;s.around&&(ve=r.N.convert(s.around),xe=g.locationPoint(ve));let Ae={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||he!==v,this._rotating=this._rotating||A!==O,this._pitching=this._pitching||N!==I,this._padding=!g.isPaddingEqual(V),this._easeId=s.easeId,this._prepareEase(u,s.noMoveStart,Ae),this.terrain&&this._prepareElevation(ae),this._ease(Ne=>{if(this._zooming&&(g.zoom=r.y.number(v,he,Ne)),this._rotating&&(g.bearing=r.y.number(A,O,Ne)),this._pitching&&(g.pitch=r.y.number(I,N,Ne)),this._padding&&(g.interpolatePadding(L,V,Ne),Q=g.centerPoint.add(G)),this.terrain&&!s.freezeElevation&&this._updateElevation(Ne),ve)g.setLocationAtPoint(ve,xe);else{let He=g.zoomScale(g.zoom-v),tt=he>v?Math.min(2,re):Math.max(.5,re),st=Math.pow(tt,1-Ne),Je=g.unproject(de.add(me.mult(Ne*st)).mult(He));g.setLocationAtPoint(g.renderWorldCopies?Je.wrap():Je,Q)}this._applyUpdatedTransform(g),this._fireMoveEvents(u)},Ne=>{this.terrain&&s.freezeElevation&&this._finalizeElevation(),this._afterEase(u,Ne)},s),this}_prepareEase(s,u,f={}){this._moving=!0,u||f.moving||this.fire(new r.k("movestart",s)),this._zooming&&!f.zooming&&this.fire(new r.k("zoomstart",s)),this._rotating&&!f.rotating&&this.fire(new r.k("rotatestart",s)),this._pitching&&!f.pitching&&this.fire(new r.k("pitchstart",s))}_prepareElevation(s){this._elevationCenter=s,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(s){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);let u=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(s<1&&u!==this._elevationTarget){let f=this._elevationTarget-this._elevationStart;this._elevationStart+=s*(f-(u-(f*s+this._elevationStart))/(1-s)),this._elevationTarget=u}this.transform.elevation=r.y.number(this._elevationStart,this._elevationTarget,s)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(s){let u=s.getCameraPosition(),f=this.terrain.getElevationForLngLatZoom(u.lngLat,s.zoom);if(u.altitude<f){let g=this.calculateCameraOptionsFromTo(u.lngLat,f,s.center,s.elevation);return{pitch:g.pitch,zoom:g.zoom}}
596return{}}_applyUpdatedTransform(s){let u=[];if(this.terrain&&u.push(g=>this._elevateCameraIfInsideTerrain(g)),this.transformCameraUpdate&&u.push(g=>this.transformCameraUpdate(g)),!u.length)return;let f=s.clone();for(let g of u){let v=f.clone(),{center:A,zoom:I,pitch:L,bearing:O,elevation:N}=g(v);A&&(v.center=A),I!==void 0&&(v.zoom=I),L!==void 0&&(v.pitch=L),O!==void 0&&(v.bearing=O),N!==void 0&&(v.elevation=N),f.apply(v)}this.transform.apply(f)}_fireMoveEvents(s){this.fire(new r.k("move",s)),this._zooming&&this.fire(new r.k("zoom",s)),this._rotating&&this.fire(new r.k("rotate",s)),this._pitching&&this.fire(new r.k("pitch",s))}_afterEase(s,u){if(this._easeId&&u&&this._easeId===u)return;delete this._easeId;let f=this._zooming,g=this._rotating,v=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,f&&this.fire(new r.k("zoomend",s)),g&&this.fire(new r.k("rotateend",s)),v&&this.fire(new r.k("pitchend",s)),this.fire(new r.k("moveend",s))}flyTo(s,u){var f;if(!s.essential&&T.prefersReducedMotion){let Ze=r.M(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Ze,u)}this.stop(),s=r.e({offset:[0,0],speed:1.2,curve:1.42,easing:r.b9},s);let g=this._getTransformForUpdate(),v=g.zoom,A=g.bearing,I=g.pitch,L=g.padding,O="bearing"in s?this._normalizeBearing(s.bearing,A):A,N="pitch"in s?+s.pitch:I,V="padding"in s?s.padding:g.padding,G=r.P.convert(s.offset),Q=g.centerPoint.add(G),ne=g.pointLocation(Q),{center:ae,zoom:he}=g.getConstrained(r.N.convert(s.center||ne),(f=s.zoom)!==null&&f!==void 0?f:v);this._normalizeCenter(ae,g);let de=g.zoomScale(he-v),me=g.project(ne),re=g.project(ae).sub(me),ve=s.curve,xe=Math.max(g.width,g.height),Ae=xe/de,Ne=re.mag();if("minZoom"in s){let Ze=r.ac(Math.min(s.minZoom,v,he),g.minZoom,g.maxZoom),It=xe/g.zoomScale(Ze-v);ve=Math.sqrt(It/Ne*2)}let He=ve*ve;function tt(Ze){let It=(Ae*Ae-xe*xe+(Ze?-1:1)*He*He*Ne*Ne)/(2*(Ze?Ae:xe)*He*Ne);return Math.log(Math.sqrt(It*It+1)-It)}function st(Ze){return(Math.exp(Ze)-Math.exp(-Ze))/2}function Je(Ze){return(Math.exp(Ze)+Math.exp(-Ze))/2}let Qe=tt(!1),ft=function(Ze){return Je(Qe)/Je(Qe+ve*Ze)},zt=function(Ze){return xe*((Je(Qe)*(st(It=Qe+ve*Ze)/Je(It))-st(Qe))/He)/Ne;var It},it=(tt(!0)-Qe)/ve;if(Math.abs(Ne)<1e-6||!isFinite(it)){if(Math.abs(xe-Ae)<1e-6)return this.easeTo(s,u);let Ze=Ae<xe?-1:1;it=Math.abs(Math.log(Ae/xe))/ve,zt=()=>0,ft=It=>Math.exp(Ze*ve*It)}return s.duration="duration"in s?+s.duration:1e3*it/("screenSpeed"in s?+s.screenSpeed/ve:+s.speed),s.maxDuration&&s.duration>s.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=A!==O,this._pitching=N!==I,this._padding=!g.isPaddingEqual(V),this._prepareEase(u,!1),this.terrain&&this._prepareElevation(ae),this._ease(Ze=>{let It=Ze*it,qi=1/ft(It);g.zoom=Ze===1?he:v+g.scaleZoom(qi),this._rotating&&(g.bearing=r.y.number(A,O,Ze)),this._pitching&&(g.pitch=r.y.number(I,N,Ze)),this._padding&&(g.interpolatePadding(L,V,Ze),Q=g.centerPoint.add(G)),this.terrain&&!s.freezeElevation&&this._updateElevation(Ze);let Pt=Ze===1?ae:g.unproject(me.add(re.mult(zt(It))).mult(qi));g.setLocationAtPoint(g.renderWorldCopies?Pt.wrap():Pt,Q),this._applyUpdatedTransform(g),this._fireMoveEvents(u)},()=>{this.terrain&&s.freezeElevation&&this._finalizeElevation(),this._afterEase(u)},s),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(s,u){var f;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let g=this._onEaseEnd;delete this._onEaseEnd,g.call(this,u)}return s||(f=this.handlers)===null||f===void 0||f.stop(!1),this}_ease(s,u,f){f.animate===!1||f.duration===0?(s(1),u()):(this._easeStart=T.now(),this._easeOptions=f,this._onEaseFrame=s,this._onEaseEnd=u,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(s,u){s=r.b3(s,-180,180);let f=Math.abs(s-u);return Math.abs(s-360-u)<f&&(s-=360),Math.abs(s+360-u)<f&&(s+=360),s}_normalizeCenter(s,u){if(!u.renderWorldCopies||u.lngRange)return;let f=s.lng-u.center.lng;s.lng+=f>180?-360:f<-180?360:0}queryTerrainElevation(s){return this.terrain?this.terrain.getElevationForLngLatZoom(r.N.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}let hl={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class _o{constructor(s=hl){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=s}getDefaultPosition(){return"bottom-right"}onAdd(s){return this._map=s,this._compact=this.options.compact,this._container=k.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=k.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=k.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(){k.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(s,u){let f=this._map._getUIString(`AttributionControl.${u}`);s.title=f,s.setAttribute("aria-label",f)}_updateAttributions(){if(!this._map.style)return;let s=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=s.concat(this.options.customAttribution.map(g=>typeof g!="string"?"":g)):typeof this.options.customAttribution=="str
596ing"&&s.push(this.options.customAttribution)),this._map.style.stylesheet){let g=this._map.style.stylesheet;this.styleOwner=g.owner,this.styleId=g.id}let u=this._map.style.sourceCaches;for(let g in u){let v=u[g];if(v.used||v.usedForTerrain){let A=v.getSource();A.attribution&&s.indexOf(A.attribution)<0&&s.push(A.attribution)}}s=s.filter(g=>String(g).trim()),s.sort((g,v)=>g.length-v.length),s=s.filter((g,v)=>{for(let A=v+1;A<s.length;A++)if(s[A].indexOf(g)>=0)return!1;return!0});let f=s.join(" | ");f!==this._attribHTML&&(this._attribHTML=f,s.length?(this._innerContainer.innerHTML=f,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Sa{constructor(s={}){this._updateCompact=()=>{let u=this._container.children;if(u.length){let f=u[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&f.classList.add("maplibregl-compact"):f.classList.remove("maplibregl-compact")}},this.options=s}getDefaultPosition(){return"bottom-left"}onAdd(s){this._map=s,this._compact=this.options&&this.options.compact,this._container=k.create("div","maplibregl-ctrl");let u=k.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(){k.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ii{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(s){let u=++this._id;return this._queue.push({callback:s,id:u,cancelled:!1}),u}remove(s){let u=this._currentlyRunning,f=u?this._queue.concat(u):this._queue;for(let g of f)if(g.id===s)return void(g.cancelled=!0)}run(s=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let u=this._currentlyRunning=this._queue;this._queue=[];for(let f of u)if(!f.cancelled&&(f.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var J=r.Y([{name:"a_pos3d",type:"Int16",components:3}]);class dl extends r.E{constructor(s){super(),this.sourceCache=s,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,s.usedForTerrain=!0,s.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(s,u){this.sourceCache.update(s,u),this._renderableTilesKeys=[];let f={};for(let g of s.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:u}))f[g.key]=!0,this._renderableTilesKeys.push(g.key),this._tiles[g.key]||(g.posMatrix=new Float64Array(16),r.aP(g.posMatrix,0,r.X,0,r.X,0,1),this._tiles[g.key]=new Ws(g,this.tileSize));for(let g in this._tiles)f[g]||delete this._tiles[g]}freeRtt(s){for(let u in this._tiles){let f=this._tiles[u];(!s||f.tileID.equals(s)||f.tileID.isChildOf(s)||s.isChildOf(f.tileID))&&(f.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(s=>this.getTileByID(s))}getTileByID(s){return this._tiles[s]}getTerrainCoords(s){let u={};for(let f of this._renderableTilesKeys){let g=this._tiles[f].tileID;if(g.canonical.equals(s.canonical)){let v=s.clone();v.posMatrix=new Float64Array(16),r.aP(v.posMatrix,0,r.X,0,r.X,0,1),u[f]=v}else if(g.canonical.isChildOf(s.canonical)){let v=s.clone();v.posMatrix=new Float64Array(16);let A=g.canonical.z-s.canonical.z,I=g.canonical.x-(g.canonical.x>>A<<A),L=g.canonical.y-(g.canonical.y>>A<<A),O=r.X>>A;r.aP(v.posMatrix,0,O,0,O,0,1),r.J(v.posMatrix,v.posMatrix,[-I*O,-L*O,0]),u[f]=v}else if(s.canonical.isChildOf(g.canonical)){let v=s.clone();v.posMatrix=new Float64Array(16);let A=s.canonical.z-g.canonical.z,I=s.canonical.x-(s.canonical.x>>A<<A),L=s.canonical.y-(s.canonical.y>>A<<A),O=r.X>>A;r.aP(v.posMatrix,0,r.X,0,r.X,0,1),r.J(v.posMatrix,v.posMatrix,[I*O,L*O,0]),r.K(v.posMatrix,v.posMatrix,[1/2**A,1/2**A,0]),u[f]=v}}return u}getSourceTile(s,u){let f=this.sourceCache._source,g=s.overscaledZ-this.deltaZoom;if(g>f.maxzoom&&(g=f.maxzoom),g<f.minzoom)return null;this._sourceTileCache[s.key]||(this._sourceTileCache[s.key]=s.scaledTo(g).key);let v=this.sourceCache.getTileByID(this._sourceTileCache[s.key]);if((!v||!v.dem)&&u)for(;g>=f.minzoom&&(!v||!v.dem);)v=this.sourceCache.getTileByID(s.scaledTo(g--).key);return v}tilesAfterTime(s=Date.now()){return Object.values(this._tiles).filter(u=>u.timeAdded>=s)}}class pl{constructor(s,u,f){this.painter=s,this.sourceCache=new dl(u),this.options=f,this.exaggeration=typeof f.exaggeration=="number"?f.exaggeration:1,this.qual
596ityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(s,u,f,g=r.X){var v;if(!(u>=0&&u<g&&f>=0&&f<g))return 0;let A=this.getTerrainData(s),I=(v=A.tile)===null||v===void 0?void 0:v.dem;if(!I)return 0;let L=function(ne,ae,he){var de=ae[0],me=ae[1];return ne[0]=he[0]*de+he[4]*me+he[12],ne[1]=he[1]*de+he[5]*me+he[13],ne}([],[u/g*r.X,f/g*r.X],A.u_terrain_matrix),O=[L[0]*I.dim,L[1]*I.dim],N=Math.floor(O[0]),V=Math.floor(O[1]),G=O[0]-N,Q=O[1]-V;return I.get(N,V)*(1-G)*(1-Q)+I.get(N+1,V)*G*(1-Q)+I.get(N,V+1)*(1-G)*Q+I.get(N+1,V+1)*G*Q}getElevationForLngLatZoom(s,u){if(!r.bb(u,s.wrap()))return 0;let{tileID:f,mercatorX:g,mercatorY:v}=this._getOverscaledTileIDFromLngLatZoom(s,u);return this.getElevation(f,g%r.X,v%r.X,r.X)}getElevation(s,u,f,g=r.X){return this.getDEMElevation(s,u,f,g)*this.exaggeration}getTerrainData(s){if(!this._emptyDemTexture){let g=this.painter.context,v=new r.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new at(g,v,g.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new at(g,new r.R({width:1,height:1}),g.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(g.gl.NEAREST,g.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=r.an([])}let u=this.sourceCache.getSourceTile(s,!0);if(u&&u.dem&&(!u.demTexture||u.needsTerrainPrepare)){let g=this.painter.context;u.demTexture=this.painter.getTileTexture(u.dem.stride),u.demTexture?u.demTexture.update(u.dem.getPixels(),{premultiply:!1}):u.demTexture=new at(g,u.dem.getPixels(),g.gl.RGBA,{premultiply:!1}),u.demTexture.bind(g.gl.NEAREST,g.gl.CLAMP_TO_EDGE),u.needsTerrainPrepare=!1}let f=u&&u+u.tileID.key+s.key;if(f&&!this._demMatrixCache[f]){let g=this.sourceCache.sourceCache._source.maxzoom,v=s.canonical.z-u.tileID.canonical.z;s.overscaledZ>s.canonical.z&&(s.canonical.z>=g?v=s.canonical.z-g:r.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let A=s.canonical.x-(s.canonical.x>>v<<v),I=s.canonical.y-(s.canonical.y>>v<<v),L=r.bc(new Float64Array(16),[1/(r.X<<v),1/(r.X<<v),0]);r.J(L,L,[A*r.X,I*r.X,0]),this._demMatrixCache[s.key]={matrix:L,coord:s}}return{u_depth:2,u_terrain:3,u_terrain_dim:u&&u.dem&&u.dem.dim||1,u_terrain_matrix:f?this._demMatrixCache[s.key].matrix:this._emptyDemMatrix,u_terrain_unpack:u&&u.dem&&u.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(u&&u.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:u}}getFramebuffer(s){let u=this.painter,f=u.width/devicePixelRatio,g=u.height/devicePixelRatio;return!this._fbo||this._fbo.width===f&&this._fbo.height===g||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new at(u.context,{width:f,height:g,data:null},u.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(u.context.gl.NEAREST,u.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new at(u.context,{width:f,height:g,data:null},u.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(u.context.gl.NEAREST,u.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=u.context.createFramebuffer(f,g,!0,!1),this._fbo.depthAttachment.set(u.context.createRenderbuffer(u.context.gl.DEPTH_COMPONENT16,f,g))),this._fbo.colorAttachment.set(s==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let s=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let u=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let v=0,A=0;v<this._coordsTextureSize;v++)for(let I=0;I<this._coordsTextureSize;I++,A+=4)u[A+0]=255&I,u[A+1]=255&v,u[A+2]=I>>8<<4|v>>8,u[A+3]=0;let f=new r.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(u.buffer)),g=new at(s,f,s.gl.RGBA,{premultiply:!1});return g.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._coordsTexture=g,g}pointCoordinate(s){this.painter.maybeDrawDepthAndCoords(!0);let u=new Uint8Array(4),f=this.painter.context,g=f.gl,v=Math.round(s.x*this.painter.pixelRatio/devicePixelRatio),A=Math.round(s.y*this.painter.pixelRatio/devicePixelRatio),I=Math.round(this.painter.height/devicePixelRatio);f.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),g.readPixels(v,I-A-1,1,1,g.RGBA,g.UNSIGNED_BYTE,u),f.bindFramebuffer.set(null);let L=u[0]+(u[2]>>4<<8),O=u[1]+((15&u[2])<<8),N=this.coordsIndex[255-u[3]],V=N&&this.sourceCache.getTileByID(N);if(!V)return null;let G=this._coordsTextureSize,Q=(1<<V.tileID.canonical.z)*G;return new r.Z((V.tileID.canonical.x*G+L)/Q+V.tileID.wrap,(V.tileID.canonical.y*G+O)/Q,this.getElevation(V.tileID,L,O,G))}depthAtPoint(s){let u=new Uint8Array(4),f=this.painter.context,g=f.gl;return f.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),g.readPixels(s.x,this.painter.height/devicePixelRatio-s.y-1,1,1,g.RGBA,g.UNSIGNED_BYTE,u),f.bindFramebuffer.set(null),(u[0]/16777216+u[1]/65536+u[2]/256+u[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;let s=this.painter.context,u=new r.bd,f=new r.aY,g=this.meshSize,v=r.X/g,A=g*g;for(let V=0;V<=g;V++)for(let G=0;G<=g;G++)u.emplaceBack(G*v,V*v,0);for(let V=0;V<A;V+=g+1)for(let G=0;G<g;G++)f.emplaceBack(G+V,g+G+V+1,g+G+V+2),f.emplaceBack(G+V,g+G+V+2,G+V+1);let I=u.length,L=I+2*(g+1);for(let V of[0,1])for(let G=0;G<=g;G++)for(let Q of[0,1])u.emplaceBack(G*v,V*r.X,Q);for(let V=0;V<2*g;V+=2)f.emplaceBack(L+V,L+V+1,L+V+3),f.emplaceBack(L+V,L+V+3,L+V+2),f.emplaceBack(I+V,I+V+3,I+V+1),f.emplaceBack(I+V,I+V+2,I+V+3);let O=u.length,N=O+2*(g+1);for(let V of[0,1])for(let G=0;G<=g;G++)for(let Q of[0,1])u.emplaceBack(V*r.X,G*v,Q);for(let V=0;V<2*g;V+=2)f.emplaceBack(O+V,O+V+1,O+V+3),f.emplaceBack(O+V,O+V+3,O+V+2),f.emplaceBack(N+V,N+V+3,N+V+1),f.emplaceBack(N+V,N+V+2,N+V+3);return this._mesh=new De(s.createVertexBuffer(u,J.members),s.createIndexBuffer(f),r.a0.simpleSegment(0,0,u.length,f.length)),this._mesh}getMeshFrameDelta(s){return 2*Math.PI*r.be/Math.pow(2,s)/5}getMinTileElevationForLngLatZoom(s,u){var f;let{tileID:g}=this._getOverscaledTileIDFromLngLatZoom(s,u);return(f=this.getMinMaxElevation(g).minElevation)!==null&&f!==void 0?f:0}getMinMaxElevation(s){let u=this.getTerrainData(s).tile,f={minElevation:null,maxElevation:null};return u&&u.dem&&(f.minElevation=u.dem.min*this.exaggeration,f.maxElevation=u.dem.max*this.exaggeration),f}_getOverscaledTileIDFromLngLatZoom(s,u){let f=r.Z.fromLngLat(s.wrap()),g=(1<<u)*r.X,v=f.x*g,A=f.y*g,I=Math.floor(v/r.X),L=Math.floor(A/r.X);return{tileID:new r.S(u,0,u,I,L),mercatorX:v,mercatorY:A}}}class us{constructor(s,u,f){this._context=s,this._size=u,this._tileSize=f,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let s of this._objects)s.texture.destroy(),s.fbo.destroy()}_createObject(s){let u=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),f=new at(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return f.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),u.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),u.colorAttachment.set(f.texture),{id:s,fbo:u,texture:f,stamp:-1,inUse:!1}}getObjectForId(s){return this._objects[s]}useObject(s){s.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(u=>s.id!==u),this._recentlyUsed.push(s.id)}stampObject(s){s.stamp=++this._stamp}getOrCreateFreeObject(){for(let 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!");let s=this._createObject(this._objects.length);return this._objects.push(s),s}freeObject(s){s.inUse=!1}freeAllObjects(){for(let s of this._objects)this.freeObject(s)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(s=>!s.inUse)===!1}}let Kt={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Xd{constructor(s,u){this.painter=s,this.terrain=u,this.pool=new us(s.context,30,u.sourceCache.tileSize*u.qualityFactor)}destruct(){this.pool.destruct()}getTexture(s){return this.pool.getObjectForId(s.rtt[this._stacks.length-1].id).texture}
596prepareForRender(s,u){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=s._order.filter(f=>!s._layers[f].isHidden(u)),this._coordsDescendingInv={};for(let f in s.sourceCaches){this._coordsDescendingInv[f]={};let g=s.sourceCaches[f].getVisibleCoordinates();for(let v of g){let A=this.terrain.sourceCache.getTerrainCoords(v);for(let I in A)this._coordsDescendingInv[f][I]||(this._coordsDescendingInv[f][I]=[]),this._coordsDescendingInv[f][I].push(A[I])}}this._coordsDescendingInvStr={};for(let f of s._order){let g=s._layers[f],v=g.source;if(Kt[g.type]&&!this._coordsDescendingInvStr[v]){this._coordsDescendingInvStr[v]={};for(let A in this._coordsDescendingInv[v])this._coordsDescendingInvStr[v][A]=this._coordsDescendingInv[v][A].map(I=>I.key).sort().join()}}for(let f of this._renderableTiles)for(let g in this._coordsDescendingInvStr){let v=this._coordsDescendingInvStr[g][f.tileID.key];v&&v!==f.rttCoords[g]&&(f.rtt=[])}}renderLayer(s){if(s.isHidden(this.painter.transform.zoom))return!1;let u=s.type,f=this.painter,g=this._renderableLayerIds[this._renderableLayerIds.length-1]===s.id;if(Kt[u]&&(this._prevType&&Kt[this._prevType]||this._stacks.push([]),this._prevType=u,this._stacks[this._stacks.length-1].push(s.id),!g))return!0;if(Kt[this._prevType]||Kt[u]&&g){this._prevType=u;let v=this._stacks.length-1,A=this._stacks[v]||[];for(let I of this._renderableTiles){if(this.pool.isFull()&&(Be(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(I),I.rtt[v]){let O=this.pool.getObjectForId(I.rtt[v].id);if(O.stamp===I.rtt[v].stamp){this.pool.useObject(O);continue}}let L=this.pool.getOrCreateFreeObject();this.pool.useObject(L),this.pool.stampObject(L),I.rtt[v]={id:L.id,stamp:L.stamp},f.context.bindFramebuffer.set(L.fbo.framebuffer),f.context.clear({color:r.aM.transparent,stencil:0}),f.currentStencilSource=void 0;for(let O=0;O<A.length;O++){let N=f.style._layers[A[O]],V=N.source?this._coordsDescendingInv[N.source][I.tileID.key]:[I.tileID];f.context.viewport.set([0,0,L.fbo.width,L.fbo.height]),f._renderTileClippingMasks(N,V),f.renderLayer(f,f.style.sourceCaches[N.source],N,V),N.source&&(I.rttCoords[N.source]=this._coordsDescendingInvStr[N.source][I.tileID.key])}}return Be(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Kt[u]}return!1}}let bh={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use \u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},Yd=h,Ta={hash:!1,interactive:!0,bearingSnap:7,attributionControl:hl,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,refreshExpiredTiles:!0,scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],zoom:0,bearing:0,pitch:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:r.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0},xh=x=>{x.touchstart=x.dragStart,x.touchmoveWindow=x.dragMove,x.touchend=x.dragEnd},Tf={showCompass:!0,showZoom:!0,visualizePitch:!1};class kf{constructor(s,u,f=!1){this.mousedown=A=>{this.startMouse(r.e({},A,{ctrlKey:!0,preventDefault:()=>A.preventDefault()}),k.mousePos(this.element,A)),k.addEventListener(window,"mousemove",this.mousemove),k.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=A=>{this.moveMouse(A,k.mousePos(this.element,A))},this.mouseup=A=>{this.mouseRotate.dragEnd(A),this.mousePitch&&this.mousePitch.dragEnd(A),this.offTemp()},this.touchstart=A=>{A.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=k.touchPos(this.element,A.targetTouches)[0],this.startTouch(A,this._startPos),k.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),k.addEventListener(window,"touchend",this.touchend))},this.touchmove=A=>{A.targetTouches.length!==1?this.reset():(this._lastPos=k.touchPos(this.element,A.targetTouches)[0],this.moveTouch(A,this._lastPos))},this.touchend=A=>{A.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{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;let g=s.dragRotate._mouseRotate.getClickTolerance(),v=s.dragRotate._mousePitch.getClickTolerance();this.element=u,this.mouseRotate=fh({clickTolerance:g,enable:!0}),this.touchRotate=(({enable:A,clickTolerance:I,bearingDegreesPerPixelMoved:L=.8})=>{let O=new mo;return new ls({clickTolerance:I,move:(N,V)=>({bearingDelta:(V.x-N.x)*L}),moveStateManager:O,enable:A,assignEvents:xh})})({clickTolerance:g,enable:!0}),this.map=s,f&&(this.mousePitch=mh({clickTolerance:v,enable:!0}),this.touchPitch=(({enable:A,clickTolerance:I,pitchDegreesPerPixelMoved:L=-.5})=>{let O=new mo;return new ls({clickTolerance:I,move:(N,V)=>({pitchDelta:(V.y-N.y)*L}),moveStateManager:O,enable:A,assignEvents:xh})})({clickTolerance:v,enable:!0})),k.addEventListener(u,"mousedown",this.mousedown),k.addEventListener(u,"touchstart",this.touchstart,{passive:!1}),k.addEventListener(u,"touchcancel",this.reset)}startMouse(s,u){this.mouseRotate.dragStart(s,u),this.mousePitch&&this.mousePitch.dragStart(s,u),k.disableDrag()}startTouch(s,u){this.touchRotate.dragStart(s,u),this.touchPitch&&this.touchPitch.dragStart(s,u),k.disableDrag()}moveMouse(s,u){let f=this.map,{bearingDelta:g}=this.mouseRotate.dragMove(s,u)||{};if(g&&f.setBearing(f.getBearing()+g),this.mousePitch){let{pitchDelta:v}=this.mousePitch.dragMove(s,u)||{};v&&f.setPitch(f.getPitch()+v)}}moveTouch(s,u){let f=this.map,{bearingDelta:g}=this.touchRotate.dragMove(s,u)||{};if(g&&f.setBearing(f.getBearing()+g),this.touchPitch){let{pitchDelta:v}=this.touchPitch.dragMove(s,u)||{};v&&f.setPitch(f.getPitch()+v)}}off(){let s=this.element;k.removeEventListener(s,"mousedown",this.mousedown),k.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),k.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),k.removeEventListener(window,"touchend",this.touchend),k.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){k.enableDrag(),k.removeEventListener(window,"mousemove",this.mousemove),k.removeEventListener(window,"mouseup",this.mouseup),k.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),k.removeEventListener(window,"touchend",this.touchend)}}let jr;function Ki(x,s,u){let f=new r.N(x.lng,x.lat);
596if(x=new r.N(x.lng,x.lat),s){let g=new r.N(x.lng-360,x.lat),v=new r.N(x.lng+360,x.lat),A=u.locationPoint(x).distSqr(s);u.locationPoint(g).distSqr(s)<A?x=g:u.locationPoint(v).distSqr(s)<A&&(x=v)}for(;Math.abs(x.lng-u.center.lng)>180;){let g=u.locationPoint(x);if(g.x>=0&&g.y>=0&&g.x<=u.width&&g.y<=u.height)break;x.lng>u.center.lng?x.lng-=360:x.lng+=360}return x.lng!==f.lng&&u.locationPoint(x).y>u.height/2-u.getHorizon()?x:f}let Ir={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 ru(x,s,u){let f=x.classList;for(let g in Ir)f.remove(`maplibregl-${u}-anchor-${g}`);f.add(`maplibregl-${u}-anchor-${s}`)}class su extends r.E{constructor(s){if(super(),this._onKeyPress=u=>{let f=u.code,g=u.charCode||u.keyCode;f!=="Space"&&f!=="Enter"&&g!==32&&g!==13||this.togglePopup()},this._onMapClick=u=>{let f=u.originalEvent.target,g=this._element;this._popup&&(f===g||g.contains(f))&&this.togglePopup()},this._update=u=>{var f;if(!this._map)return;let g=this._map.loaded()&&!this._map.isMoving();(u?.type==="terrain"||u?.type==="render"&&!g)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Ki(this._lngLat,this._flatPos,this._map.transform):(f=this._lngLat)===null||f===void 0?void 0:f.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 v="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?v=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(v=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let A="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?A="rotateX(0deg)":this._pitchAlignment==="map"&&(A=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||u&&u.type!=="moveend"||(this._pos=this._pos.round()),k.setTransform(this._element,`${Ir[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${A} ${v}`),T.frameAsync(new AbortController).then(()=>{this._updateOpacity(u&&u.type==="moveend")}).catch(()=>{})},this._onMove=u=>{if(!this._isDragging){let f=this._clickTolerance||this._map._clickTolerance;this._isDragging=u.point.dist(this._pointerdownPos)>=f}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 r.k("dragstart"))),this.fire(new r.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 r.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=s&&s.anchor||"center",this._color=s&&s.color||"#3FB1CE",this._scale=s&&s.scale||1,this._draggable=s&&s.draggable||!1,this._clickTolerance=s&&s.clickTolerance||0,this._subpixelPositioning=s&&s.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=s&&s.rotation||0,this._rotationAlignment=s&&s.rotationAlignment||"auto",this._pitchAlignment=s&&s.pitchAlignment&&s.pitchAlignment!=="auto"?s.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(s?.opacity,s?.opacityWhenCovered),s&&s.element)this._element=s.element,this._offset=r.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=k.create("div");let u=k.createNS("http://www.w3.org/2000/svg","svg"),f=41,g=27;u.setAttributeNS(null,"display","block"),u.setAttributeNS(null,"height",`${f}px`),u.setAttributeNS(null,"width",`${g}px`),u.setAttributeNS(null,"viewBox",`0 0 ${g} ${f}`);let v=k.createNS("http://www.w3.org/2000/svg","g");
596v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"stroke-width","1"),v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"fill-rule","evenodd");let A=k.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"fill-rule","nonzero");let I=k.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"transform","translate(3.0, 29.0)"),I.setAttributeNS(null,"fill","#000000");let L=[{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(let de of L){let me=k.createNS("http://www.w3.org/2000/svg","ellipse");me.setAttributeNS(null,"opacity","0.04"),me.setAttributeNS(null,"cx","10.5"),me.setAttributeNS(null,"cy","5.80029008"),me.setAttributeNS(null,"rx",de.rx),me.setAttributeNS(null,"ry",de.ry),I.appendChild(me)}let O=k.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"fill",this._color);let N=k.createNS("http://www.w3.org/2000/svg","path");N.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"),O.appendChild(N);let V=k.createNS("http://www.w3.org/2000/svg","g");V.setAttributeNS(null,"opacity","0.25"),V.setAttributeNS(null,"fill","#000000");let G=k.createNS("http://www.w3.org/2000/svg","path");G.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"),V.appendChild(G);let Q=k.createNS("http://www.w3.org/2000/svg","g");Q.setAttributeNS(null,"transform","translate(6.0, 7.0)"),Q.setAttributeNS(null,"fill","#FFFFFF");let ne=k.createNS("http://www.w3.org/2000/svg","g");ne.setAttributeNS(null,"transform","translate(8.0, 8.0)");let ae=k.createNS("http://www.w3.org/2000/svg","circle");ae.setAttributeNS(null,"fill","#000000"),ae.setAttributeNS(null,"opacity","0.25"),ae.setAttributeNS(null,"cx","5.5"),ae.setAttributeNS(null,"cy","5.5"),ae.setAttributeNS(null,"r","5.4999962");let he=k.createNS("http://www.w3.org/2000/svg","circle");he.setAttributeNS(null,"fill","#FFFFFF"),he.setAttributeNS(null,"cx","5.5"),he.setAttributeNS(null,"cy","5.5"),he.setAttributeNS(null,"r","5.4999962"),ne.appendChild(ae),ne.appendChild(he),A.appendChild(I),A.appendChild(O),A.appendChild(V),A.appendChild(Q),A.appendChild(ne),u.appendChild(A),u.setAttributeNS(null,"height",f*this._scale+"px"),u.setAttributeNS(null,"width",g*this._scale+"px"),this._element.appendChild(u),this._offset=r.P.convert(s&&s.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",u=>{u.preventDefault()}),this._element.addEventListener("mousedown",u=>{u.preventDefault()}),ru(this._element,this._anchor,"marker"),s&&s.className)for(let u of s.className.split(" "))this._element.classList.add(u);this._popup=null}addTo(s){return this.remove(),this._map=s,this._element.setAttribute("aria-label",s._getUIString("Marker.Title")),s.getCanvasContainer().appendChild(this._element),s.on("move",this._update),s.on("moveend",this._update),s.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("terrain",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),k.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=r.N.convert(s),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(s){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),s){if(!("offset"in s.options)){let g=Math.abs(13.5)/Math.SQRT2;s.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
5960,-38.1],"bottom-left":[g,-1*(38.1-13.5+g)],"bottom-right":[-g,-1*(38.1-13.5+g)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(s){return this._subpixelPositioning=s,this}getPopup(){return this._popup}togglePopup(){let s=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:s?(s.isOpen()?s.remove():(s.setLngLat(this._lngLat),s.addTo(this._map)),this):this}_updateOpacity(s=!1){var u,f;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(s)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let g=this._map,v=g.terrain.depthAtPoint(this._pos),A=g.terrain.getElevationForLngLatZoom(this._lngLat,g.transform.tileZoom);if(g.transform.lngLatToCameraDepth(this._lngLat,A)-v<.006)return void(this._element.style.opacity=this._opacity);let I=-this._offset.y/g.transform._pixelPerMeter,L=Math.sin(g.getPitch()*Math.PI/180)*I,O=g.terrain.depthAtPoint(new r.P(this._pos.x,this._pos.y-this._offset.y)),N=g.transform.lngLatToCameraDepth(this._lngLat,A+L)-O>.006;!((f=this._popup)===null||f===void 0)&&f.isOpen()&&N&&this._popup.remove(),this._element.style.opacity=N?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(s){return this._offset=r.P.convert(s),this._update(),this}addClassName(s){this._element.classList.add(s)}removeClassName(s){this._element.classList.remove(s)}toggleClassName(s){return this._element.classList.toggle(s)}setDraggable(s){return this._draggable=!!s,this._map&&(s?(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(s){return this._rotation=s||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(s){return this._rotationAlignment=s||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(s){return this._pitchAlignment=s&&s!=="auto"?s:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(s,u){return s===void 0&&u===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),s!==void 0&&(this._opacity=s),u!==void 0&&(this._opacityWhenCovered=u),this._map&&this._updateOpacity(!0),this}}let Jd={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},ec=0,tc=!1,jn={maxWidth:100,unit:"metric"};function ic(x,s,u){let f=u&&u.maxWidth||100,g=x._container.clientHeight/2,v=x.unproject([0,g]),A=x.unproject([f,g]),I=v.distanceTo(A);if(u&&u.unit==="imperial"){let L=3.2808*I;L>5280?yt(s,f,L/5280,x._getUIString("ScaleControl.Miles")):yt(s,f,L,x._getUIString("ScaleControl.Feet"))}else u&&u.unit==="nautical"?yt(s,f,I/1852,x._getUIString("ScaleControl.NauticalMiles")):I>=1e3?yt(s,f,I/1e3,x._getUIString("ScaleControl.Kilometers")):yt(s,f,I,x._getUIString("ScaleControl.Meters"))}function yt(x,s,u,f){let g=function(v){let A=Math.pow(10,`${Math.floor(v)}`.length-1),I=v/A;return I=I>=10?10:I>=5?5:I>=3?3:I>=2?2:I>=1?1:function(L){let O=Math.pow(10,Math.ceil(-Math.log(L)/Math.LN10));return Math.round(L*O)/O}(I),A*I}(u);x.style.width=s*(g/u)+"px",x.innerHTML=`${g}&nbsp;${f}`}let Mt={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},ou=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function au(x){if(x){if(typeof x=="number"){let s=Math.round(Math.abs(x)/Math.SQRT2);return{center:new r.P(0,0),top:new r.P(0,x),"top-left":new r.P(s,s),"top-right":new r.P(-s,s),bottom:new r.P(0,-x),"bottom-left":new r.P(s,-s),"bottom-right":new r.P(-s,-s),left:new r.P(x,0),right:new r.P(-x,0
vendor: 4,317 bytes, line 596
596)}}if(x instanceof r.P||Array.isArray(x)){let s=r.P.convert(x);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}return{center:r.P.convert(x.center||[0,0]),top:r.P.convert(x.top||[0,0]),"top-left":r.P.convert(x["top-left"]||[0,0]),"top-right":r.P.convert(x["top-right"]||[0,0]),bottom:r.P.convert(x.bottom||[0,0]),"bottom-left":r.P.convert(x["bottom-left"]||[0,0]),"bottom-right":r.P.convert(x["bottom-right"]||[0,0]),left:r.P.convert(x.left||[0,0]),right:r.P.convert(x.right||[0,0])}}return au(new r.P(0,0))}let vo=h;a.AJAXError=r.bh,a.Evented=r.E,a.LngLat=r.N,a.MercatorCoordinate=r.Z,a.Point=r.P,a.addProtocol=r.bi,a.config=r.a,a.removeProtocol=r.bj,a.AttributionControl=_o,a.BoxZoomHandler=rr,a.CanvasSource=ir,a.CooperativeGesturesHandler=yo,a.DoubleClickZoomHandler=go,a.DragPanHandler=xa,a.DragRotateHandler=ul,a.EdgeInsets=rn,a.FullscreenControl=class extends r.E{constructor(x={}){super(),this._onFullscreenChange=()=>{var s;let u=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((s=u?.shadowRoot)===null||s===void 0)&&s.fullscreenElement;)u=u.shadowRoot.fullscreenElement;u===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,x&&x.container&&(x.container instanceof HTMLElement?this._container=x.container:r.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(x){return this._map=x,this._container||(this._container=this._map.getContainer()),this._controlContainer=k.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){k.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let x=this._fullscreenButton=k.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);k.create("span","maplibregl-ctrl-icon",x).setAttribute("aria-hidden","true"),x.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let x=this._getTitle();this._fullscreenButton.setAttribute("aria-label",x),this._fullscreenButton.title=x}_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 r.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new r.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()}},a.GeoJSONSource=yr,a.GeolocateControl=class extends r.E{constructor(x
596){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new r.k("outofmaxbounds",s)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=s,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(s),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(s),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new r.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{let u=new r.N(s.coords.longitude,s.coords.latitude),f=s.coords.accuracy,g=this._map.getBearing(),v=r.e({bearing:g},this.options.fitBoundsOptions),A=Ie.fromLngLat(u,f);this._map.fitBounds(A,v,{geolocateSource:!0})},this._updateMarker=s=>{if(s){let u=new r.N(s.coords.longitude,s.coords.latitude);this._accuracyCircleMarker.setLngLat(u).addTo(this._map),this._userLocationDotMarker.setLngLat(u).addTo(this._map),this._accuracy=s.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=s=>{if(this._map){if(this.options.trackUserLocation)if(s.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;let u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(s.code===3&&tc)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new r.k("error",s)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",s=>s.preventDefault()),this._geolocateButton=k.create("button","maplibregl-ctrl-geolocate",this._container),k.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=s=>{if(this._map){if(s===!1){r.w("Geolocation support is not available so the GeolocateControl will be disabled.");let u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u)}else{let u=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,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=k.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new su({element:this._dotElement}),this._circleElement=k.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new su({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 r.k("trackuserlocationend")),this.fire(new r.k("userlocationlostfocus")))})}},this.options=r.e({},Jd,x)}onAdd(x){return this._map=x,this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return r._(this,arguments,void 0,function*(s=!1){if(jr!==void 0&&!s)return jr;if(window.navigator.permissions===void 0)return jr=!!window.navigator.geolocation,jr;try{jr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{jr=!!window.navigator.geolocation}return jr})}().then(s=>this._finishSetupUI(s)),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(),k.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ec=0,tc=!1}_isOutOfMapMaxBounds(x){let s=this._map.getMaxBounds(),u=x.coords;return s&&(u.longitude<s.getWest()||u.longitude>s.getEast()||u.latitude<s.getSouth()||u.latitude>s.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_E
596RROR",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(){let x=this._map.getBounds(),s=x.getSouthEast(),u=x.getNorthEast(),f=s.distanceTo(u),g=Math.ceil(this._accuracy/(f/this._map._container.clientHeight)*2);this._circleElement.style.width=`${g}px`,this._circleElement.style.height=`${g}px`}trigger(){if(!this._setup)return r.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 r.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ec--,tc=!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 r.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 r.k("trackuserlocationstart")),this.fire(new r.k("userlocationfocus"));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 x;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ec++,ec>1?(x={maximumAge:6e5,timeout:0},tc=!0):(x=this.options.positionOptions,tc=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,x)}}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)}},a.Hash=vr,a.ImageSource=ts,a.KeyboardHandler=cs,a.LngLatBounds=Ie,a.LogoControl=Sa,a.Map=class extends Kd{constructor(x){r.bf.mark(r.bg.create);let s=Object.assign(Object.assign({},Ta),x);if(s.minZoom!=null&&s.maxZoom!=null&&s.minZoom>s.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(s.minPitch!=null&&s.maxPitch!=null&&s.minPitch>s.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(s.minPitch!=null&&s.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(s.maxPitch!=null&&s.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Vo(s.minZoom,s.maxZoom,s.minPitch,s.maxPitch,s.renderWorldCopies),{bearingSnap:s.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new ii,this._controls=[],this._mapId=r.a4(),this._contextLost=u=>{u.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new r.k("webglcontextlost",{originalEvent:u}))},this._contextRestored=u=>{this._setupPainter(),this.resize(),this._update(),this.fire(new r.k("webglcontextrestored",{originalEvent:u}))},this._onMapScroll=u=>{if(u.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()}
596,this._interactive=s.interactive,this._maxTileCacheSize=s.maxTileCacheSize,this._maxTileCacheZoomLevels=s.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=s.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=s.preserveDrawingBuffer===!0,this._antialias=s.antialias===!0,this._trackResize=s.trackResize===!0,this._bearingSnap=s.bearingSnap,this._refreshExpiredTiles=s.refreshExpiredTiles===!0,this._fadeDuration=s.fadeDuration,this._crossSourceCollisions=s.crossSourceCollisions===!0,this._collectResourceTiming=s.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},bh),s.locale),this._clickTolerance=s.clickTolerance,this._overridePixelRatio=s.pixelRatio,this._maxCanvasSize=s.maxCanvasSize,this.transformCameraUpdate=s.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=s.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=le.addThrottleControl(()=>this.isMoving()),this._requestManager=new we(s.transformRequest),typeof s.container=="string"){if(this._container=document.getElementById(s.container),!this._container)throw new Error(`Container '${s.container}' not found.`)}else{if(!(s.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=s.container}if(s.maxBounds&&this.setMaxBounds(s.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let u=!1,f=Zl(g=>{this._trackResize&&!this._removed&&(this.resize(g),this.redraw())},50);this._resizeObserver=new ResizeObserver(g=>{u?f(g):u=!0}),this._resizeObserver.observe(this._container)}this.handlers=new vh(this,s),this._hash=s.hash&&new vr(typeof s.hash=="string"&&s.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:s.center,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch}),s.bounds&&(this.resize(),this.fitBounds(s.bounds,r.e({},s.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=s.localIdeographFontFamily,this._validateStyle=s.validateStyle,s.style&&this.setStyle(s.style,{localIdeographFontFamily:s.localIdeographFontFamily}),s.attributionControl&&this.addControl(new _o(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new Sa,s.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",u=>{this._update(u.dataType==="style"),this.fire(new r.k(`${u.dataType}data`,u))}),this.on("dataloading",u=>{this.fire(new r.k(`${u.dataType}dataloading`,u))}),this.on("dataabort",u=>{this.fire(new r.k("sourcedataabort",u))})}_getMapId(){return this._mapId}addControl(x,s){if(s===void 0&&(s=x.getDefaultPosition?x.getDefaultPosition():"top-right"),!x||!x.onAdd)return this.fire(new r.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let u=x.onAdd(this);this._controls.push(x);let f=this._controlPositions[s];return s.indexOf("bottom")!==-1?f.insertBefore(u,f.firstChild):f.appendChild(u),this}removeControl(x){if(!x||!x.onRemove)return this.fire(new r.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let s=this._controls.indexOf(x);return s>-1&&this._controls.splice(s,1),x.onRemove(this),this}hasControl(x){return this._controls.indexOf(x)>-1}calculateCameraOptionsFromTo(x,s,u,f){return f==null&&this.terrain&&(f=this.terrain.getElevationForLngLatZoom(u,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(x,s,u,f)}resize(x){var s;let u=this._containerDimensions(),f=u[0],g=u[1],v=this._getClampedPixelRatio(f,g);if(this._resizeCanvas(f,g,v),this.painter.resize(f,g,v),this.painter.overLimit()){let I=this.painter.context.gl;this._maxCanvasSize=[I.drawingBufferWidth,I.drawingBufferHeight];let L=this._getClampedPixelRatio(f,g);
596this._resizeCanvas(f,g,L),this.painter.resize(f,g,L)}this.transform.resize(f,g),(s=this._requestedCameraState)===null||s===void 0||s.resize(f,g);let A=!this._moving;return A&&(this.stop(),this.fire(new r.k("movestart",x)).fire(new r.k("move",x))),this.fire(new r.k("resize",x)),A&&this.fire(new r.k("moveend",x)),this}_getClampedPixelRatio(x,s){let{0:u,1:f}=this._maxCanvasSize,g=this.getPixelRatio(),v=x*g,A=s*g;return Math.min(v>u?u/v:1,A>f?f/A:1)*g}getPixelRatio(){var x;return(x=this._overridePixelRatio)!==null&&x!==void 0?x:devicePixelRatio}setPixelRatio(x){this._overridePixelRatio=x,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(x){return this.transform.setMaxBounds(Ie.convert(x)),this._update()}setMinZoom(x){if((x=x??-2)>=-2&&x<=this.transform.maxZoom)return this.transform.minZoom=x,this._update(),this.getZoom()<x&&this.setZoom(x),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(x){if((x=x??22)>=this.transform.minZoom)return this.transform.maxZoom=x,this._update(),this.getZoom()>x&&this.setZoom(x),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(x){if((x=x??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(x>=0&&x<=this.transform.maxPitch)return this.transform.minPitch=x,this._update(),this.getPitch()<x&&this.setPitch(x),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(x){if((x=x??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(x>=this.transform.minPitch)return this.transform.maxPitch=x,this._update(),this.getPitch()>x&&this.setPitch(x),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(x){return this.transform.renderWorldCopies=x,this._update()}project(x){return this.transform.locationPoint(r.N.convert(x),this.style&&this.terrain)}unproject(x){return this.transform.pointLocation(r.P.convert(x),this.terrain)}isMoving(){var x;return this._moving||((x=this.handlers)===null||x===void 0?void 0:x.isMoving())}isZooming(){var x;return this._zooming||((x=this.handlers)===null||x===void 0?void 0:x.isZooming())}isRotating(){var x;return this._rotating||((x=this.handlers)===null||x===void 0?void 0:x.isRotating())}_createDelegatedListener(x,s,u){if(x==="mouseenter"||x==="mouseover"){let f=!1;return{layers:s,listener:u,delegates:{mousemove:v=>{let A=s.filter(L=>this.getLayer(L)),I=A.length!==0?this.queryRenderedFeatures(v.point,{layers:A}):[];I.length?f||(f=!0,u.call(this,new Ln(x,this,v.originalEvent,{features:I}))):f=!1},mouseout:()=>{f=!1}}}}if(x==="mouseleave"||x==="mouseout"){let f=!1;return{layers:s,listener:u,delegates:{mousemove:A=>{let I=s.filter(L=>this.getLayer(L));(I.length!==0?this.queryRenderedFeatures(A.point,{layers:I}):[]).length?f=!0:f&&(f=!1,u.call(this,new Ln(x,this,A.originalEvent)))},mouseout:A=>{f&&(f=!1,u.call(this,new Ln(x,this,A.originalEvent)))}}}}{let f=g=>{let v=s.filter(I=>this.getLayer(I)),A=v.length!==0?this.queryRenderedFeatures(g.point,{layers:v}):[];A.length&&(g.features=A,u.call(this,g),delete g.features)};return{layers:s,listener:u,delegates:{[x]:f}}}}_saveDelegatedListener(x,s){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[x]=this._delegatedListeners[x]||[],this._delegatedListeners[x].push(s)}_removeDelegatedListener(x,s,u){if(!this._delegatedListeners||!this._delegatedListeners[x])return;let f=this._delegatedListeners[x];for(let g=0;g<f.length;g++){let v=f[g];if(v.listener===u&&v.layers.length===s.length&&v.layers.every(A=>s.includes(A))){for(let A in v.delegates)this.off(A,v.delegates[A]);return void f.splice(g,1)}}}on(x,s,u){if(u===void 0)return super.on(x,s);let f=this._createDelegatedListener(x,typeof s=="string"?[s]:s,u);this._saveDelegatedListener(x,f);for(let g in f.delegates)this.on(g,f.delegates[g]);return this}once(x,s,u){if(u===void 0)return super.once(x,s);let f=typeof s=="string"?[s]:s,g=this._createDelegatedListener(x,f,u);for(let v in g.delegates){let A=g.delegates[v];g.delegates[v]=(...I)=>{this._removeDelegatedListener(x,f,u),A(...I)}}this._saveDelegatedListener(x,g);for(let v in g.delegates)this.once(v,g.delegates[v]);return this}off(x,s,u){return u===void 0?super.off(x,s):(this._removeDelegatedListener(x,typeof s=="string"?[s]:s,u),this)}queryRenderedFeatures(x,s){if(!this.style)return[];let u,f=x instanceof r.P||Array.isArray(x),g=f?x:[[0,0],[this.transform.width,this.transform.height]];if(s=s||(f?{}:x)||{},g instanceof r.P||typeof g[0]=="number")u=[r.P.convert(g)];else{let v=r.P.convert(g[0]),A=r.P.convert(g[1]);u=[v,new r.P(A.x,v.y),A,new r.P(v.x,A.y),v]}return this.style.queryRenderedFeatures(u,s,this.transform)}querySourceFeatures(x,s){return this.style.querySourceFeatures(x,s)}setStyle(x,s){return(s=r.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._val
596idateStyle},s)).diff!==!1&&s.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&x?(this._diffStyle(x,s),this):(this._localIdeographFontFamily=s.localIdeographFontFamily,this._updateStyle(x,s))}setTransformRequest(x){return this._requestManager.setTransformRequest(x),this}_getUIString(x){let s=this._locale[x];if(s==null)throw new Error(`Missing UI string '${x}'`);return s}_updateStyle(x,s){if(s.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(x,s));let u=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!x)),x?(this.style=new Vc(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof x=="string"?this.style.loadURL(x,s,u):this.style.loadJSON(x,s,u),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Vc(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(x,s){if(typeof x=="string"){let u=this._requestManager.transformRequest(x,"Style");r.h(u,new AbortController).then(f=>{this._updateDiff(f.data,s)}).catch(f=>{f&&this.fire(new r.j(f))})}else typeof x=="object"&&this._updateDiff(x,s)}_updateDiff(x,s){try{this.style.setState(x,s)&&this._update(!0)}catch(u){r.w(`Unable to perform style diff: ${u.message||u.error||u}.  Rebuilding the style from scratch.`),this._updateStyle(x,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():r.w("There is no style added to the map.")}addSource(x,s){return this._lazyInitEmptyStyle(),this.style.addSource(x,s),this._update(!0)}isSourceLoaded(x){let s=this.style&&this.style.sourceCaches[x];if(s!==void 0)return s.loaded();this.fire(new r.j(new Error(`There is no source with ID '${x}'`)))}setTerrain(x){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),x){let s=this.style.sourceCaches[x.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${x.source}`);this.terrain===null&&s.reload();for(let u in this.style._layers){let f=this.style._layers[u];f.type==="hillshade"&&f.source===x.source&&r.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 pl(this.painter,s,x),this.painter.renderToTexture=new Xd(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!==x.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 r.k("terrain",{terrain:x})),this}getTerrain(){var x,s;return(s=(x=this.terrain)===null||x===void 0?void 0:x.options)!==null&&s!==void 0?s:null}areTilesLoaded(){let x=this.style&&this.style.sourceCaches;for(let s in x){let u=x[s]._tiles;for(let f in u){let g=u[f];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}removeSource(x){return this.style.removeSource(x),this._update(!0)}getSource(x){return this.style.getSource(x)}addImage(x,s,u={}){let{pixelRatio:f=1,sdf:g=!1,stretchX:v,stretchY:A,content:I,textFitWidth:L,textFitHeight:O}=u;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||r.b(s))){if(s.width===void 0||s.height===void 0)return this.fire(new r.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`")));{let{width:N,height:V,data:G}=s,Q=s;return this.style.addImage(x,{data:new r.R({width:N,height:V},new Uint8Array(G)),pixelRatio:f,stretchX:v,stretchY:A,content:I,textFitWidth:L,textFitHeight:O,sdf:g,version:0,userImage:Q}),Q.onAdd&&Q.onAdd(this,x),this}}{let{width:N,height:V,data:G}=T.getImageData(s);this.style.addImage(x,{data:new r.R({width:N,height:V},G),pixelRatio:f,stretchX:v,stretchY:A,content:I,textFitWidth:L,textFitHeight:O,sdf:g,version:0})}}updateImage(x,s){let u=this.style.getImage(x);if(!u)return this.fire(new r.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let f=s instanceof HTMLImageElement||r.b(s)?T.getImageData(s):s,{width:g,height:v,data:A}=f;if(g===void 0||v===void 0)return this.fire(new r.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(g!==u.data.width||v!==u.data.height)return this.fire(new r.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));let I=!(s instanceof HTMLImageElement||r.b(s));return u.data.replace(A,I),this.style.updateImage(x,u),this}getImage(x){return this.style.getImage(x)}hasImage(x){return x?!!this.style.getImage(x):(this.fire(new r.j(new Error("Missing required image id"))),!1)}removeImage(x){this.style.removeImage(x)}loadImage(x){return le.getImage(this._requestManager.transformRequest(x,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(x,s){return this._lazyInitEmptyStyle(),this.style.addLayer(x,s),this._update(!0)}moveLayer(x,s){return this.style.moveLayer(x,s),this._update(!0)}removeLayer(x){return this.style.removeLayer(x),this._update(!0)}getLayer(x){return this.style.getLayer(x)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(x,s,u){return this.style.setLayerZoomRange(x,s,u),this._update(!0)}setFilter(x,s,u={}){return this.style.setFilter(x,s,u),this._update(!0)}getFilter(x){return this.style.getFilter(x)}setPaintProperty(x,s,u,f={}){return this.style.setPaintProperty(x,s,u,f),this._update(!0)}getPaintProperty(x,s){return this.style.getPaintProperty(x,s)}setLayoutProperty(x,s,u,f={}){return this.style.setLayoutProperty(x,s,u,f),this._update(!0)}getLayoutProperty(x,s){return this.style.getLayoutProperty(x,s)}setGlyphs(x,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(x,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(x,s,u={}){return this._lazyInitEmptyStyle(),this.style.addSprite(x,s,u,f=>{f||this._update(!0)}),this}removeSprite(x){return this._lazyInitEmptyStyle(),this.style.removeSprite(x),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(x,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(x,s,u=>{u||this._update(!0)}),this}setLight(x,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(x,s),this._update(!0)}getLight(){return this.style.getLight()}setSky(x){return this._lazyInitEmptyStyle(),this.style.setSky(x),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(x,s){return this.style.setFeatureState(x,s),this._update()}removeFeatureState(x,s){return this.style.removeFeatureState(x,s),this._update()}getFeatureState(x){return this.style.getFeatureState(x)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let x=0,s=0;return this._container&&(x=this._container.clientWidth||400,s=this._container.clientHeight||300),[x,s]}_setupContainer(){let x=this._container;x.classList.add("maplibregl-map");let s=this._canvasContainer=k.create("div","maplibregl-canvas-container",x);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=k.create("canvas","maplibregl-canvas",s),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","regi
596on");let u=this._containerDimensions(),f=this._getClampedPixelRatio(u[0],u[1]);this._resizeCanvas(u[0],u[1],f);let g=this._controlContainer=k.create("div","maplibregl-control-container",x),v=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(A=>{v[A]=k.create("div",`maplibregl-ctrl-${A} `,g)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(x,s,u){this._canvas.width=Math.floor(u*x),this._canvas.height=Math.floor(u*s),this._canvas.style.width=`${x}px`,this._canvas.style.height=`${s}px`}_setupPainter(){let x={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},s=null;this._canvas.addEventListener("webglcontextcreationerror",f=>{s={requestedAttributes:x},f&&(s.statusMessage=f.statusMessage,s.type=f.type)},{once:!0});let u=this._canvas.getContext("webgl2",x)||this._canvas.getContext("webgl",x);if(!u){let f="Failed to initialize WebGL";throw s?(s.message=f,new Error(JSON.stringify(s))):new Error(f)}this.painter=new gt(u,this.transform),P.testSupport(u)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(x){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||x,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(x){return this._update(),this._renderTaskQueue.add(x)}_cancelRenderFrame(x){this._renderTaskQueue.remove(x)}_render(x){let s=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(x),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let g=this.transform.zoom,v=T.now();this.style.zoomHistory.update(g,v);let A=new r.z(g,{now:v,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),I=A.crossFadingFactor();I===1&&I===this._crossFadingFactor||(u=!0,this._crossFadingFactor=I),this.style.update(A)}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,s,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new r.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,r.bf.mark(r.bg.load),this.fire(new r.k("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let f=this._sourcesDirty||this._styleDirty||this._placementDirty;return f||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new r.k("idle")),!this._loaded||this._fullyLoaded||f||(this._fullyLoaded=!0,r.bf.mark(r.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var x;this._hash&&this._hash.remove();for(let 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),le.removeThrottleControl(this._imageQueueHandle),(x=this._resizeObserver)===null||x===void 0||x.disconnect();let s=this.painter.context.gl.getExtension("WEBGL_lose_context");s?.loseContext&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),k.remove(this._canvasContainer),k.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),r.bf.clearMetrics(),this._removed=!0,this.fire(new r.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,T.frameAsync(this._frameRequest).then(x=>{r.bf.frame(x),this._frameRequest=null,this._render(x)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(x){this._showTileBoundaries!==x&&(this._showTileBoundaries=x,this._update())}get showPadding(){return!!this._showPadding}set showPadding(x){this._showPadding!==x&&(this._showPadding=x,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(x){this._showCollisionBoxes!==x&&(this._showCollisionBoxes=x,x?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(x){this._showOverdrawInspector!==x&&(this._showOverdrawInspector=x,this._update())}get repaint(){return!!this._repaint}set repaint(x){this._repaint!==x&&(this._repaint=x,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(x){this._vertices=x,this._update()}get version(){return Yd}getCameraTargetElevation(){return this.transform.elevation}},a.MapMouseEvent=Ln,a.MapTouchEvent=ga,a.MapWheelEvent=Gd,a.Marker=su,a.NavigationControl
596=class{constructor(x){this._updateZoomButtons=()=>{let s=this._map.getZoom(),u=s===this._map.getMaxZoom(),f=s===this._map.getMinZoom();this._zoomInButton.disabled=u,this._zoomOutButton.disabled=f,this._zoomInButton.setAttribute("aria-disabled",u.toString()),this._zoomOutButton.setAttribute("aria-disabled",f.toString())},this._rotateCompassArrow=()=>{let s=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=s},this._setButtonTitle=(s,u)=>{let f=this._map._getUIString(`NavigationControl.${u}`);s.title=f,s.setAttribute("aria-label",f)},this.options=r.e({},Tf,x),this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",s=>s.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",s=>this._map.zoomIn({},{originalEvent:s})),k.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",s=>this._map.zoomOut({},{originalEvent:s})),k.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",s=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:s}):this._map.resetNorth({},{originalEvent:s})}),this._compassIcon=k.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(x){return this._map=x,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 kf(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){k.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(x,s){let u=k.create("button",x,this._container);return u.type="button",u.addEventListener("click",s),u}},a.Popup=class extends r.E{constructor(x){super(),this.remove=()=>(this._content&&k.remove(this._content),this._container&&(k.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 r.k("close"))),this),this._onMouseUp=s=>{this._update(s.point)},this._onMouseMove=s=>{this._update(s.point)},this._onDrag=s=>{this._update(s.point)},this._update=s=>{var u;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=k.create("div","maplibregl-popup",this._map.getContainer()),this._tip=k.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let I of this.options.className.split(" "))this._container.classList.add(I);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),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?Ki(this._lngLat,this._flatPos,this._map.transform):(u=this._lngLat)===null||u===void 0?void 0:u.wrap(),this._trackPointer&&!s)return;let f=this._flatPos=this._pos=this._trackPointer&&s?s:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&s?s:this._map.transform.locationPoint(this._lngLat));let g=this.options.anchor,v=au(this.options.offset);if(!g){let I=this._container.offsetWidth,L=this._container.offsetHeight,O;O=f.y+v.bottom.y<L?["top"]:f.y>this._map.transform.height-L?["bottom"]:[],f.x<I/2?O.push("left"):f.x>this._map.transform.width-I/2&&O.push("right"),g=O.length===0?"bottom":O.join("-")}let A=f.add(v[g]);this.options.subpixelPositioning||(A=A.round()),k.setTransform(this._container,`${Ir[g]} translate(${A.x}px,${A.y}px)`),ru(this._container,g,"popup")},this._onClose=()=>{this.remove()},this.options=r.e(Object.create(Mt),x)}addTo(x){return this._map&&this.remove(),this._map=x,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 r.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(x){return this._lngLat=r.N.convert(x),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(x){return this.setDOMContent(document.createTextNode(x))}setHTML(x){let s=document.createDocumentFragment(),u=document.createElement("body"),f;for(u.innerHTML=x;f=u.firstChild,f;)s.appendChild(f);return this.setDOMContent(s)}getMaxWidth(){var x;return(x=this._container)===null||x===void 0?void 0:x.style.maxWidth}setMaxWidth(x){return this.options.maxWidth=x,this._update(),this}setDOMContent(x){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=k.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(x),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(x){return this._container&&this._container.classList.add(x),this}removeClassName(x){return this._container&&this._container.classList.remove(x),this}setOffset(x){return this.options.offset=x,this._update(),this}toggleClassName(x){if(this._container)return this._container.classList.toggle(x)}setSubpixelPositioning(x){this.options.subpixelPositioning=x}_createCloseButton(){this.options.closeButton&&(this._closeButton=k.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let x=this._container.querySelector(ou);x&&x.focus()}},a.RasterDEMTileSource=Ui,a.RasterTileSource=bi,a.ScaleControl=class{constructor(x
596){this._onMove=()=>{ic(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,ic(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},jn),x)}getDefaultPosition(){return"bottom-left"}onAdd(x){return this._map=x,this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-scale",x.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){k.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},a.ScrollZoomHandler=Ds,a.Style=Vc,a.TerrainControl=class{constructor(x){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=x}onAdd(x){return this._map=x,this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=k.create("button","maplibregl-ctrl-terrain",this._container),k.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(){k.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},a.TwoFingersTouchPitchHandler=sn,a.TwoFingersTouchRotateHandler=yh,a.TwoFingersTouchZoomHandler=gh,a.TwoFingersTouchZoomRotateHandler=wa,a.VectorTileSource=Ha,a.VideoSource=Wa,a.addSourceType=(x,s)=>r._(void 0,void 0,void 0,function*(){if(ao(x))throw new Error(`A source type called "${x}" already exists.`);((u,f)=>{Vl[u]=f})(x,s)}),a.clearPrewarmedResources=function(){let x=In;x&&(x.isPreloaded()&&x.numActive()===1?(x.release(mr),In=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()"))},a.getMaxParallelImageRequests=function(){return r.a.MAX_PARALLEL_IMAGE_REQUESTS},a.getRTLTextPluginStatus=function(){return ns().getRTLTextPluginStatus()},a.getVersion=function(){return vo},a.getWorkerCount=function(){return vn.workerCount},a.getWorkerUrl=function(){return r.a.WORKER_URL},a.importScriptInWorkers=function(x){return Io().broadcast("IS",x)},a.prewarm=function(){As().acquire(mr)},a.setMaxParallelImageRequests=function(x){r.a.MAX_PARALLEL_IMAGE_REQUESTS=x},a.setRTLTextPlugin=function(x,s){return ns().setRTLTextPlugin(x,s)},a.setWorkerCount=function(x){vn.workerCount=x},a.setWorkerUrl=function(x){r.a.WORKER_URL=x}});var n=t;return n})});var JT=Yx(($6,cw)=>{"use strict";var Up=typeof Reflect=="object"?Reflect:null,UT=Up&&typeof Up.apply=="function"?Up.apply:function(e,i,n){return Function.prototype.apply.call(e,i,n)},q0;Up&&typeof Up.ownKeys=="function"?q0=Up.ownKeys:Object.getOwnPropertySymbols?q0=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:q0=function(e){return Object.getOwnPropertyNames(e)};function KP(t){console&&console.warn&&console.warn(t)}var qT=Number.isNaN||function(e){return e!==e};function on(){on.init.call(this)}cw.exports=on;cw.exports.once=QP;on.EventEmitter=on;on.prototype._events=void 0;on.prototype._eventsCount=0;on.prototype._maxListeners=void 0;var jT=10;function H0(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(on,"defaultMaxListeners",{enumerable:!0,get:function(){return jT},set:function(t){if(typeof t!="number"||t<0||qT(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");jT=t}});on.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};on.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||qT(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function HT(t){return t._maxListeners===void 0?on.defaultMaxListeners:t._maxListeners}on.prototype.getMaxListeners=function(){return HT(this)};on.prototype.emit=function(e){for(var i=[],n=1;n<arguments.length;n++)i.push(arguments[n]);var a=e==="error",r=this._events;if(r!==void 0)a=a&&r.error===void 0;else if(!a)return!1;if(a){var h;if(i.length>0&&(h=i[0]),h instanceof Error)throw h;var m=new Error("Unhandled error."+(h?" ("+h.message+")":""));throw m.context=h,m}var b=r[e];if(b===void 0)return!1;if(typeof b=="function")UT(b,this,i);else for(var T=b.length,k=XT(b,T),n=0;n<T;++n)UT(k[n],this,i);return!0};function WT(t,e,i,n){var a,r,h;if(H0(i),r=t._events,r===void 0?(r=t._events=Object.create(null),t._eventsCount=0):(r.newListener!==void 0&&(t.emit("newListener",e,i.listener?i.listener:i),r=t._events),h=r[e]),h===void 0)h=r[e]=i,++t._eventsCount;
vendor: 4,078 bytes, line 596
596else if(typeof h=="function"?h=r[e]=n?[i,h]:[h,i]:n?h.unshift(i):h.push(i),a=HT(t),a>0&&h.length>a&&!h.warned){h.warned=!0;var m=new Error("Possible EventEmitter memory leak detected. "+h.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");m.name="MaxListenersExceededWarning",m.emitter=t,m.type=e,m.count=h.length,KP(m)}return t}on.prototype.addListener=function(e,i){return WT(this,e,i,!1)};on.prototype.on=on.prototype.addListener;on.prototype.prependListener=function(e,i){return WT(this,e,i,!0)};function XP(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function GT(t,e,i){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:i},a=XP.bind(n);return a.listener=i,n.wrapFn=a,a}on.prototype.once=function(e,i){return H0(i),this.on(e,GT(this,e,i)),this};on.prototype.prependOnceListener=function(e,i){return H0(i),this.prependListener(e,GT(this,e,i)),this};on.prototype.removeListener=function(e,i){var n,a,r,h,m;if(H0(i),a=this._events,a===void 0)return this;if(n=a[e],n===void 0)return this;if(n===i||n.listener===i)--this._eventsCount===0?this._events=Object.create(null):(delete a[e],a.removeListener&&this.emit("removeListener",e,n.listener||i));else if(typeof n!="function"){for(r=-1,h=n.length-1;h>=0;h--)if(n[h]===i||n[h].listener===i){m=n[h].listener,r=h;break}if(r<0)return this;r===0?n.shift():YP(n,r),n.length===1&&(a[e]=n[0]),a.removeListener!==void 0&&this.emit("removeListener",e,m||i)}return this};on.prototype.off=on.prototype.removeListener;on.prototype.removeAllListeners=function(e){var i,n,a;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var r=Object.keys(n),h;for(a=0;a<r.length;++a)h=r[a],h!=="removeListener"&&this.removeAllListeners(h);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(i=n[e],typeof i=="function")this.removeListener(e,i);else if(i!==void 0)for(a=i.length-1;a>=0;a--)this.removeListener(e,i[a]);return this};function ZT(t,e,i){var n=t._events;if(n===void 0)return[];var a=n[e];return a===void 0?[]:typeof a=="function"?i?[a.listener||a]:[a]:i?JP(a):XT(a,a.length)}on.prototype.listeners=function(e){return ZT(this,e,!0)};on.prototype.rawListeners=function(e){return ZT(this,e,!1)};on.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):KT.call(t,e)};on.prototype.listenerCount=KT;function KT(t){var e=this._events;if(e!==void 0){var i=e[t];if(typeof i=="function")return 1;if(i!==void 0)return i.length}return 0}on.prototype.eventNames=function(){return this._eventsCount>0?q0(this._events):[]};function XT(t,e){for(var i=new Array(e),n=0;n<e;++n)i[n]=t[n];return i}function YP(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function JP(t){for(var e=new Array(t.length),i=0;i<e.length;++i)e[i]=t[i].listener||t[i];return e}function QP(t,e){return new Promise(function(i,n){function a(h){t.removeListener(e,r),n(h)}function r(){typeof t.removeListener=="function"&&t.removeListener("error",a),i([].slice.call(arguments))}YT(t,e,r,{once:!0}),e!=="error"&&eD(t,a,{once:!0})})}function eD(t,e,i){typeof t.on=="function"&&YT(t,"error",e,i)}function YT(t,e,i,n){if(typeof t.on=="function")n.once?t.once(e,i):t.on(e,i);else if(typeof t.addEventListener=="function")t.addEventListener(e,function a(r){n.once&&t.removeEventListener(e,a),i(r)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var Mu={};W2(Mu,{FrameElement:()=>Ml,FrameLoadingStyle:()=>Sc,FrameRenderer:()=>Dp,PageRenderer:()=>Rp,PageSnapshot:()=>Jo,StreamActions:()=>w1,StreamElement:()=>g0,StreamSourceElement:()=>y0,cache:()=>rT,clearCache:()=>cT,connectStreamSource:()=>Cm,disconnectStreamSource:()=>Mm,navigator:()=>
596sT,registerAdapter:()=>oT,renderStreamMessage:()=>lT,session:()=>An,setConfirmMethod:()=>hT,setFormMode:()=>dT,setProgressBarDelay:()=>uT,start:()=>S1,visit:()=>aT});(function(){if(window.Reflect===void 0||window.customElements===void 0||window.customElements.polyfillWrapFlushCallback)return;let t=HTMLElement,e={HTMLElement:function(){return Reflect.construct(t,[],this.constructor)}};window.HTMLElement=e.HTMLElement,HTMLElement.prototype=t.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,t)})();(function(t){if(typeof t.requestSubmit=="function")return;t.requestSubmit=function(n){n?(e(n,this),n.click()):(n=document.createElement("input"),n.type="submit",n.hidden=!0,this.appendChild(n),n.click(),this.removeChild(n))};function e(n,a){n instanceof HTMLElement||i(TypeError,"parameter 1 is not of type 'HTMLElement'"),n.type=="submit"||i(TypeError,"The specified element is not a submit button"),n.form==a||i(DOMException,"The specified element is not owned by this form element","NotFoundError")}function i(n,a,r){throw new n("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+a+".",r)}})(HTMLFormElement.prototype);var Y2=new WeakMap;function WI(t){let e=t instanceof Element?t:t instanceof Node?t.parentElement:null,i=e?e.closest("input, button"):null;return i?.type=="submit"?i:null}function GI(t){let e=WI(t.target);e&&e.form&&Y2.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let t=window.Event.prototype;if("SubmitEvent"in window&&/Apple Computer/.test(navigator.vendor))t=window.SubmitEvent.prototype;else if("SubmitEvent"in window)return;addEventListener("click",GI,!0),Object.defineProperty(t,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return Y2.get(this.target)}})})();var Sc;(function(t){t.eager="eager",t.lazy="lazy"})(Sc||(Sc={}));var Ml=class t extends HTMLElement{static get observedAttributes(){return["disabled","complete","loading","src"]}constructor(){super(),this.loaded=Promise.resolve(),this.delegate=new t.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="complete"?this.delegate.completeChanged():e=="src"?this.delegate.sourceURLChanged():this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get loading(){return ZI(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){var e,i;return(i=(e=this.ownerDocument)===null||e===void 0?void 0:e.documentElement)===null||i===void 0?void 0:i.hasAttribute("data-turbo-preview")}};function ZI(t){switch(t.toLowerCase()){case"lazy":return Sc.lazy;default:return Sc.eager}}function ks(t){return new URL(t.toString(),document.baseURI)}function Wh(t){let e;if(t.hash)return t.hash.slice(1);if(e=t.href.match(/#(.*)$/))return e[1]}function x1(t,e){let i=e?.getAttribute("formaction")||t.getAttribute("action")||t.action;return ks(i)}function KI(t){return(eL(t).match(/\.[^.]*$/)||[])[0]||""}function XI(t){return!!KI(t).match(/^(?:|\.(?:htm|html|xhtml|php))$/)}function YI(t,e){let i=tL(e);return t.href===ks(i).href||t.href.startsWith(i)}function Ip(t,e){return YI(t,e)&&XI(t)}function Jx(t){let e=Wh(t);return e!=null?t.href.slice(0,-(e.length+1)):t.href}function r0(t){return Jx(t)}function JI(t,e){return ks(t).href==ks(e).href}function QI(t){return t.pathname.split("/").slice(1)}function eL(t){return QI(t).slice(-1)[0]}function tL(t){return iL(t.origin+t.pathname)}function iL(t){return t.endsWith("/")?t:t+"/"}var bm=class{constructor(e){this.response=e}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return ks(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}};function xm(t){if(t.getAttribute("data-turbo-eval")=="false")return t;{let e=document.createElement("script"),i=a0("csp-nonce");return i&&(e.nonce=i),e.textContent=t.textContent,e.async=!1,nL(e,t),e}}function nL(t,e){for(let{name:i,value:n}of e.attributes)t.setAttribute(i,n)}function rL(t){let e=document.createElement("template");return e.innerHTML=t,e.content}function Zr(t,{target:e,cancelable:i,detail:n}={}){let a=new CustomEvent(t,{cancelable:i,bubbles:!0,composed:!0,detail:n});return e&&e.isConnected?e.dispatchEvent(a):document.documentElement.dispatchEvent(a),a}function s0(){return new Promise(t=>requestAnimationFrame(()=>t()))}function sL(){return new Promise(t=>setTimeout(()=>t(),0))}function oL(){return Promise.resolve()}function J2(t=""){return new DOMParser().parseFromString(t,"text/html")}function Q2(t,...e){let i=aL(t,e).replace(/^\n/,"").split(`
597`),n=i[0].match(/^\s+/),a=n?n[0].length:0;return i.map(r=>r.slice(a)).join(`
598`)}function aL(t,e){return t.reduce((i,n,a)=>{let r=e[a]==null?"":e[a];return i+n+r},"")}function Lp(){return Array.from({length:36}).map((t,e)=>e==8||e==13||e==18||e==23?"-":e==14?"4":e==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*15).toString(16)).join("")}function o0(t,...e){for(let i of e.map(n=>n?.getAttribute(t)))if(typeof i=="string")return i;return null}function lL(t,...e){return e.some(i=>i&&i.hasAttribute(t))}function Qx(...t){for(let e of t)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function e1(...t){for(let e of t)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function cL(t,e=2e3){return new Promise(i=>{let n=()=>{t.removeEventListener("error",n),t.removeEventListener("load",n),i()};t.addEventListener("load",n,{once:!0}),t.addEventListener("error",n,{once:!0}),setTimeout(i,e)})}function eT(t){switch(t){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function uL(t){return t=="advance"||t=="replace"||t=="restore"}function _0(...t){let e=o0("data-turbo-action",...t);return uL(e)?e:null}function tT(t){return document.querySelector(`meta[name="${t}"]`)}function a0(t){let e=tT(t);return e&&e.content}function hL(t,e){let i=tT(t);
598return i||(i=document.createElement("meta"),i.setAttribute("name",t),document.head.appendChild(i)),i.setAttribute("content",e),i}function l0(t,e){var i;if(t instanceof Element)return t.closest(e)||l0(t.assignedSlot||((i=t.getRootNode())===null||i===void 0?void 0:i.host),e)}var to;(function(t){t[t.get=0]="get",t[t.post=1]="post",t[t.put=2]="put",t[t.patch=3]="patch",t[t.delete=4]="delete"})(to||(to={}));function dL(t){switch(t.toLowerCase()){case"get":return to.get;case"post":return to.post;case"put":return to.put;case"patch":return to.patch;case"delete":return to.delete}}var wm=class{constructor(e,i,n,a=new URLSearchParams,r=null){this.abortController=new AbortController,this.resolveRequestPromise=h=>{},this.delegate=e,this.method=i,this.headers=this.defaultHeaders,this.body=a,this.url=n,this.target=r}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){let{fetchOptions:e}=this;this.delegate.prepareRequest(this),await this.allowRequestToBeIntercepted(e);try{this.delegate.requestStarted(this);let i=await fetch(this.url.href,e);return await this.receive(i)}catch(i){if(i.name!=="AbortError")throw this.willDelegateErrorHandling(i)&&this.delegate.requestErrored(this,i),i}finally{this.delegate.requestFinished(this)}}async receive(e){let i=new bm(e);return Zr("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:i},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,i):i.succeeded?this.delegate.requestSucceededWithResponse(this,i):this.delegate.requestFailedWithResponse(this,i),i}get fetchOptions(){var e;return{method:to[this.method].toUpperCase(),credentials:"same-origin",headers:this.headers,redirect:"follow",body:this.isSafe?null:this.body,signal:this.abortSignal,referrer:(e=this.delegate.referrer)===null||e===void 0?void 0:e.href}}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return this.method===to.get}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async allowRequestToBeIntercepted(e){let i=new Promise(a=>this.resolveRequestPromise=a);Zr("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.resolveRequestPromise},target:this.target}).defaultPrevented&&await i}willDelegateErrorHandling(e){return!Zr("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}},t1=class{constructor(e,i){this.started=!1,this.intersect=n=>{let a=n.slice(-1)[0];a?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)},this.delegate=e,this.element=i,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}},Tc=class{static wrap(e){return typeof e=="string"?new this(rL(e)):e}constructor(e){this.fragment=pL(e)}};Tc.contentType="text/vnd.turbo-stream.html";function pL(t){for(let e of t.querySelectorAll("turbo-stream")){let i=document.importNode(e,!0);for(let n of i.templateElement.content.querySelectorAll("script"))n.replaceWith(xm(n));e.replaceWith(i)}return t}var Tu;(function(t){t[t.initialized=0]="initialized",t[t.requesting=1]="requesting",t[t.waiting=2]="waiting",t[t.receiving=3]="receiving",t[t.stopping=4]="stopping",t[t.stopped=5]="stopped"})(Tu||(Tu={}));var ku;(function(t){t.urlEncoded="application/x-www-form-urlencoded",t.multipart="multipart/form-data",t.plain="text/plain"})(ku||(ku={}));function fL(t){switch(t.toLowerCase()){case ku.multipart:return ku.multipart;case ku.plain:return ku.plain;default:return ku.urlEncoded}}var Sm=class t{static confirmMethod(e,i,n){return Promise.resolve(confirm(e))}constructor(e,i,n,a=!1){this.state=Tu.initialized,this.delegate=e,this.formElement=i,this.submitter=n,this.formData=mL(i,n),this.location=ks(this.action),this.method==to.get&&_L(this.location,[...this.body.entries()]),this.fetchRequest=new wm(this,this.method,this.location,this.body,this.formElement),this.mustRedirect=a}get method(){var e;let i=((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formmethod"))||this.formElement.getAttribute("method")||"";return dL(i.toLowerCase())||to.get}get action(){var e;
598let i=typeof this.formElement.action=="string"?this.formElement.action:null;return!((e=this.submitter)===null||e===void 0)&&e.hasAttribute("formaction")?this.submitter.getAttribute("formaction")||"":this.formElement.getAttribute("action")||i||""}get body(){return this.enctype==ku.urlEncoded||this.method==to.get?new URLSearchParams(this.stringFormData):this.formData}get enctype(){var e;return fL(((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formenctype"))||this.formElement.enctype)}get isSafe(){return this.fetchRequest.isSafe}get stringFormData(){return[...this.formData].reduce((e,[i,n])=>e.concat(typeof n=="string"?[[i,n]]:[]),[])}async start(){let{initialized:e,requesting:i}=Tu,n=o0("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof n=="string"&&!await t.confirmMethod(n,this.formElement,this.submitter))&&this.state==e)return this.state=i,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:i}=Tu;if(this.state!=e&&this.state!=i)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let i=gL(a0("csrf-param"))||a0("csrf-token");i&&(e.headers["X-CSRF-Token"]=i)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(Tc.contentType)}requestStarted(e){var i;this.state=Tu.waiting,(i=this.submitter)===null||i===void 0||i.setAttribute("disabled",""),this.setSubmitsWith(),Zr("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,i){this.result={success:i.succeeded,fetchResponse:i}}requestSucceededWithResponse(e,i){if(i.clientError||i.serverError)this.delegate.formSubmissionFailedWithResponse(this,i);else if(this.requestMustRedirect(e)&&yL(i)){let n=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,n)}else this.state=Tu.receiving,this.result={success:!0,fetchResponse:i},this.delegate.formSubmissionSucceededWithResponse(this,i)}requestFailedWithResponse(e,i){this.result={success:!1,fetchResponse:i},this.delegate.formSubmissionFailedWithResponse(this,i)}requestErrored(e,i){this.result={success:!1,error:i},this.delegate.formSubmissionErrored(this,i)}requestFinished(e){var i;this.state=Tu.stopped,(i=this.submitter)===null||i===void 0||i.removeAttribute("disabled"),this.resetSubmitterText(),Zr("turbo:submit-end",{target:this.formElement,detail:Object.assign({formSubmission:this},this.result)}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(!(!this.submitter||!this.submitsWith)){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){let e=this.submitter;this.originalSubmitText=e.value,e.value=this.submitsWith}}}resetSubmitterText(){if(!(!this.submitter||!this.originalSubmitText)){if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){let e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||lL("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){var e;return(e=this.submitter)===null||e===void 0?void 0:e.getAttribute("data-turbo-submits-with")}};function mL(t,e){let i=new FormData(t),n=e?.getAttribute("name"),a=e?.getAttribute("value");return n&&i.append(n,a||""),i}function gL(t){if(t!=null){let i=(document.cookie?document.cookie.split("; "):[]).find(n=>n.startsWith(t));if(i){let n=i.split("=").slice(1).join("=");return n?decodeURIComponent(n):void 0}}}function yL(t){return t.statusCode==200&&!t.redirected}function _L(t,e){let i=new URLSearchParams;for(let[n,a]of e)a instanceof File||i.append(n,a);return t.search=i.toString(),t}var Pp=class{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){let e="[inert], :disabled, [hidden], details:not([open]), dialog:not([open])";for(let i of this.element.querySelectorAll("[autofocus]"))if(i.closest(e)==null)return i;return null}get permanentElements(){return nT(this.element)}getPermanentElementById(e){return iT(this.element,e)}getPermanentElementMapForSnapshot(e){let i={};for(let n of this.permanentElements){let{id:a}=n,r=e.getPermanentElementById(a);r&&(i[a]=[n,r])}return i}};function iT(t,e){return t.querySelector(`#${e}[data-turbo-permanent]`)}function nT(t){return t.querySelectorAll("[id][data-turbo-permanent]")}var Tm=class{constructor(e,i){this.started=!1,this.submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)},this.submitBubbled=n=>{if(!n.defaultPrevented){let a=n.target instanceof HTMLFormElement?n.target:void 0,r=n.submitter||void 0;a&&vL(a,r)&&bL(a,r)&&this.delegate.willSubmitForm(a,r)&&(n.preventDefault(),n.stopImmediatePropagation(),this.delegate.formSubmitted(a,r))}},this.delegate=e,this.eventTarget=i}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}};function vL(t,e){return(e?.getAttribute("formmethod")||t.getAttribute("method"))!="dialog"}function bL(t,e){if(e?.hasAttribute("formtarget")||t.hasAttribute("target")){let i=e?.getAttribute("formtarget")||t.target;for(let n of document.getElementsByName(i))if(n instanceof HTMLIFrameElement)return!1;return!0}else return!0}var c0=class{constructor(e,i){this.resolveRenderPromise=n=>{},this.resolveInterceptionPromise=n=>{},this.delegate=e,this.element=i}scrollToAnchor(e){let i=this.snapshot.getElementForAnchor(e);i?(this.scrollToElement(i),this.focusElement(i)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(Wh(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:i}){this.scrollRoot.scrollTo(e,i)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}
598async render(e){let{isPreview:i,shouldRender:n,newSnapshot:a}=e;if(n)try{this.renderPromise=new Promise(b=>this.resolveRenderPromise=b),this.renderer=e,await this.prepareToRenderSnapshot(e);let r=new Promise(b=>this.resolveInterceptionPromise=b),h={resume:this.resolveInterceptionPromise,render:this.renderer.renderElement};this.delegate.allowsImmediateRender(a,h)||await r,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(a,i),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.resolveRenderPromise(void 0),delete this.renderPromise}else this.invalidate(e.reloadReason)}invalidate(e){this.delegate.viewInvalidated(e)}async prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),await e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}},i1=class extends c0{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new Pp(this.element)}},u0=class{constructor(e,i){this.clickBubbled=n=>{this.respondsToEventTarget(n.target)?this.clickEvent=n:delete this.clickEvent},this.linkClicked=n=>{this.clickEvent&&this.respondsToEventTarget(n.target)&&n.target instanceof Element&&this.delegate.shouldInterceptLinkClick(n.target,n.detail.url,n.detail.originalEvent)&&(this.clickEvent.preventDefault(),n.preventDefault(),this.delegate.linkClickIntercepted(n.target,n.detail.url,n.detail.originalEvent)),delete this.clickEvent},this.willVisit=n=>{delete this.clickEvent},this.delegate=e,this.element=i}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}respondsToEventTarget(e){let i=e instanceof Element?e:e instanceof Node?e.parentElement:null;return i&&i.closest("turbo-frame, html")==this.element}},h0=class{constructor(e,i){this.started=!1,this.clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)},this.clickBubbled=n=>{if(n instanceof MouseEvent&&this.clickEventIsSignificant(n)){let a=n.composedPath&&n.composedPath()[0]||n.target,r=this.findLinkFromClickTarget(a);if(r&&xL(r)){let h=this.getLocationForLink(r);this.delegate.willFollowLinkToLocation(r,h,n)&&(n.preventDefault(),this.delegate.followedLinkToLocation(r,h))}}},this.delegate=e,this.eventTarget=i}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}findLinkFromClickTarget(e){return l0(e,"a[href]:not([target^=_]):not([download])")}getLocationForLink(e){return ks(e.getAttribute("href")||"")}};function xL(t){if(t.hasAttribute("target")){for(let e of document.getElementsByName(t.target))if(e instanceof HTMLIFrameElement)return!1;return!0}else return!0}var d0=class{constructor(e,i){this.delegate=e,this.linkInterceptor=new h0(this,i)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}willFollowLinkToLocation(e,i,n){return this.delegate.willSubmitFormLinkToLocation(e,i,n)&&e.hasAttribute("data-turbo-method")}followedLinkToLocation(e,i){let n=document.createElement("form"),a="hidden";for(let[P,F]of i.searchParams)n.append(Object.assign(document.createElement("input"),{type:a,name:P,value:F}));let r=Object.assign(i,{search:""});n.setAttribute("data-turbo","true"),n.setAttribute("action",r.href),n.setAttribute("hidden","");let h=e.getAttribute("data-turbo-method");h&&n.setAttribute("method",h);let m=e.getAttribute("data-turbo-frame");m&&n.setAttribute("data-turbo-frame",m);let b=_0(e);b&&n.setAttribute("data-turbo-action",b);let T=e.getAttribute("data-turbo-confirm");T&&n.setAttribute("data-turbo-confirm",T),e.hasAttribute("data-turbo-stream")&&n.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,i,n),document.body.appendChild(n),n.addEventListener("turbo:submit-end",()=>n.remove(),{once:!0}),requestAnimationFrame(()=>n.requestSubmit())}},p0=class{static async preservingPermanentElements(e,i,n){let a=new this(e,i);a.enter(),await n(),a.leave()}constructor(e,i){this.delegate=e,this.permanentElementMap=i}enter(){for(let e in this.permanentElementMap){let[i,n]=this.permanentElementMap[e];this.delegate.enteringBardo(i,n),this.replaceNewPermanentElementWithPlaceholder(n)}}leave(){for(let e in this.permanentElementMap){let[i]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(i),this.replacePlaceholderWithPermanentElement(i),this.delegate.leavingBardo(i)}}replaceNewPermanentElementWithPlaceholder(e){let i=wL(e);e.replaceWith(i)}replaceCurrentPermanentElementWithClone(e){let i=e.cloneNode(!0);e.replaceWith(i)}replacePlaceholderWithPermanentElement(e){let i=this.getPlaceholderById(e.id);i?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(i=>i.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function wL(t){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",t.id),e}var km=class{constructor(e,i,n,a,r=!0){this.activeElement=null,this.currentSnapshot=e,this.newSnapsh
598ot=i,this.isPreview=a,this.willRender=r,this.renderElement=n,this.promise=new Promise((h,m)=>this.resolvingFunctions={resolve:h,reject:m})}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await p0.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){let e=this.connectedSnapshot.firstAutofocusableElement;SL(e)&&e.focus()}enteringBardo(e){this.activeElement||e.contains(this.currentSnapshot.activeElement)&&(this.activeElement=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.activeElement)&&this.activeElement instanceof HTMLElement&&(this.activeElement.focus(),this.activeElement=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}};function SL(t){return t&&typeof t.focus=="function"}var Dp=class extends km{static renderElement(e,i){var n;let a=document.createRange();a.selectNodeContents(e),a.deleteContents();let r=i,h=(n=r.ownerDocument)===null||n===void 0?void 0:n.createRange();h&&(h.selectNodeContents(r),e.appendChild(h.extractContents()))}constructor(e,i,n,a,r,h=!0){super(i,n,a,r,h),this.delegate=e}get shouldRender(){return!0}async render(){await s0(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await s0(),this.focusFirstAutofocusableElement(),await s0(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,i=T
598L(this.currentElement.getAttribute("data-autoscroll-block"),"end"),n=kL(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:i,behavior:n}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let i=xm(e);e.replaceWith(i)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function TL(t,e){return t=="end"||t=="start"||t=="center"||t=="nearest"?t:e}function kL(t,e){return t=="auto"||t=="smooth"?t:e}var f0=class t{static get defaultCSS(){return Q2`
599      .turbo-progress-bar {
600        position: fixed;
601        display: block;
602        top: 0;
603        left: 0;
604        height: 3px;
605        background: #0076ff;
606        z-index: 2147483647;
607        transition:
608          width ${t.animationDuration}ms ease-out,
609          opacity ${t.animationDuration/2}ms ${t.animationDuration/2}ms ease-in;
610        transform: translate3d(0, 0, 0);
611      }
612    `}constructor(){this.hiding=!1,this.value=0,this.visible=!1,this.trickle=()=>{this.setValue(this.value+Math.random()/100)},this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(e){this.value=e,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(e){this.progressElement.style.opacity="0",setTimeout(e,t.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,t.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");return e.type="text/css",e.textContent=t.defaultCSS,this.cspNonce&&(e.nonce=this.cspNonce),e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}get cspNonce(){return a0("csp-nonce")}};f0.animationDuration=300;var n1=class extends Pp{constructor(){super(...arguments),this.detailsByOuterHTML=this.children.filter(e=>!EL(e)).map(e=>PL(e)).reduce((e,i)=>{let{outerHTML:n}=i,a=n in e?e[n]:{type:CL(i),tracked:ML(i),elements:[]};return Object.assign(Object.assign({},e),{[n]:Object.assign(Object.assign({},a),{elements:[...a.elements,i]})})},{})}get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,i){return Object.keys(this.detailsByOuterHTML).filter(n=>!(n in i.detailsByOuterHTML)).map(n=>this.detailsByOuterHTML[n]).filter(({type:n})=>n==e).map(({elements:[n]})=>n)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,i)=>{let{type:n,tracked:a,elements:r}=this.detailsByOuterHTML[i];return n==null&&!a?[...e,...r]:r.length>1?[...e,...r.slice(1)]:e},[])}getMetaValue(e){let i=this.findMetaElementByName(e);return i?i.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((i,n)=>{let{elements:[a]}=this.detailsByOuterHTML[n];return LL(a,e)?a:i},void 0)}};function CL(t){if(AL(t))return"script";if(IL(t))return"stylesheet"}function ML(t){return t.getAttribute("data-turbo-track")=="reload"}function AL(t){return t.localName=="script"}function EL(t){return t.localName=="noscript"}function IL(t){let e=t.localName;return e=="style"||e=="link"&&t.getAttribute("rel")=="stylesheet"}function LL(t,e){return t.localName=="meta"&&t.getAttribute("name")==e}function PL(t){return t.hasAttribute("nonce")&&t.setAttribute("nonce",""),t}var Jo=class t extends Pp{static fromHTMLString(e=""){return this.fromDocument(J2(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({head:e,body:i}){return new this(i,new n1(e))}constructor(e,i){super(e),this.headSnapshot=i}clone(){let e=this.element.cloneNode(!0),i=this.element.querySelectorAll("select"),n=e.querySelectorAll("select");for(let[a,r]of i.entries()){let h=n[a];for(let m of h.selectedOptions)m.selected=!1;for(let m of r.selectedOptions)h.options[m.index].selected=!0}for(let a of e.querySelectorAll('input[type="password"]'))a.value="";return new t(e,this.headSnapshot)}get headElement(){return this.headSnapshot.element}get rootLocation(){var e;let i=(e=this.getSetting("root"))!==null&&e!==void 0?e:"/";return ks(i)}
612get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},Ep;(function(t){t.visitStart="visitStart",t.requestStart="requestStart",t.requestEnd="requestEnd",t.visitEnd="visitEnd"})(Ep||(Ep={}));var Oa;(function(t){t.initialized="initialized",t.started="started",t.canceled="canceled",t.failed="failed",t.completed="completed"})(Oa||(Oa={}));var DL={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},Cu;(function(t){t[t.networkFailure=0]="networkFailure",t[t.timeoutFailure=-1]="timeoutFailure",t[t.contentTypeMismatch=-2]="contentTypeMismatch"})(Cu||(Cu={}));var r1=class{constructor(e,i,n,a={}){this.identifier=Lp(),this.timingMetrics={},this.followedRedirect=!1,this.historyChanged=!1,this.scrolled=!1,this.shouldCacheSnapshot=!0,this.acceptsStreamResponse=!1,this.snapshotCached=!1,this.state=Oa.initialized,this.delegate=e,this.location=i,this.restorationIdentifier=n||Lp();let{action:r,historyChanged:h,referrer:m,snapshot:b,snapshotHTML:T,response:k,visitCachedSnapshot:P,willRender:F,updateHistory:U,shouldCacheSnapshot:X,acceptsStreamResponse:Y}=Object.assign(Object.assign({},DL),a);this.action=r,this.historyChanged=h,this.referrer=m,this.snapshot=b,this.snapshotHTML=T,this.response=k,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.visitCachedSnapshot=P,this.willRender=F,this.updateHistory=U,this.scrolled=!F,this.shouldCacheSnapshot=X,this.acceptsStreamResponse=Y}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}get silent(){return this.isSamePage}start(){this.state==Oa.initialized&&(this.recordTimingMetric(Ep.visitStart),this.state=Oa.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==Oa.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=Oa.canceled)}complete(){this.state==Oa.started&&(this.recordTimingMetric(Ep.visitEnd),this.state=Oa.completed,this.followRedirect(),this.followedRedirect||(this.adapter.visitCompleted(this),this.delegate.visitCompleted(this)))}fail(){this.state==Oa.started&&(this.state=Oa.failed,this.adapter.visitFailed(this))}changeHistory(){var e;if(!this.historyChanged&&this.updateHistory){let i=this.location.href===((e=this.referrer)===null||e===void 0?void 0:e.href)?"replace":this.action,n=eT(i);this.history.update(n,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new wm(this,to.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(Ep.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:i}=e;G2(i)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,i)}}finishRequest(){this.recordTimingMetric(Ep.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:i}=this.response;this.render(async()=>{this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,G2(e)&&i!=null?(await this.view.renderPage(Jo.fromHTMLString(i),!1,this.willRender,this),this.performScroll(),this.adapter.visitRendered(this),this.complete()):(await this.view.renderError(Jo.fromHTMLString(i),this),this.adapter.visitRendered(this),this.fail())})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!Wh(this.location)||e.hasAnchor(Wh(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return Jo.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let i=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isSamePage?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.view.renderPage(e,i,this.willRender,this),this.performScroll(),this.adapter.visitRendered(this),i||this.complete())})}}followRedirect(){var e;this.redirectedToLocation&&!this.followedRedirect&&(!((e=this.response)===null||e===void 0)&&e.redirected)&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render(async()=>{this.cacheSnapshot(),this.performScroll(),this.changeHistory(),this.adapter.visitRendered(this)})}prepareRequest(e){this.acceptsStreamResponse&&e.acceptResponseType(Tc.c
612ontentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,i){}async requestSucceededWithResponse(e,i){let n=await i.responseHTML,{redirected:a,statusCode:r}=i;n==null?this.recordResponse({statusCode:Cu.contentTypeMismatch,redirected:a}):(this.redirectedToLocation=i.redirected?i.location:void 0,this.recordResponse({statusCode:r,responseHTML:n,redirected:a}))}async requestFailedWithResponse(e,i){let n=await i.responseHTML,{redirected:a,statusCode:r}=i;n==null?this.recordResponse({statusCode:Cu.contentTypeMismatch,redirected:a}):this.recordResponse({statusCode:r,responseHTML:n,redirected:a})}requestErrored(e,i){this.recordResponse({statusCode:Cu.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.isSamePage&&this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation,this.location),this.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=Wh(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return Object.assign({},this.timingMetrics)}getHistoryMethodForAction(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise(i=>{this.frame=requestAnimationFrame(()=>i())}),await e(),delete this.frame}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function G2(t){return t>=200&&t<300}var s1=class{constructor(e){this.progressBar=new f0,this.showProgressBar=()=>{this.progressBar.show()},this.session=e}visitProposedToLocation(e,i){this.navigator.startVisit(e,i?.restorationIdentifier||Lp(),i)}visitStarted(e){this.location=e.location,e.loadCachedSnapshot(),e.issueRequest(),e.goToSamePageAnchor()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse()}visitRequestFailedWithStatusCode(e,i){switch(i){case Cu.networkFailure:case Cu.timeoutFailure:case Cu.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:i}});default:return e.loadResponse()}}visitRequestFinished(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitCompleted(e){}pageInvalidated(e){this.reload(e)}visitFailed(e){}visitRendered(e){}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}reload(e){var i;Zr("turbo:reload",{detail:e}),window.location.href=((i=this.location)===null||i===void 0?void 0:i.toString())||window.location.href}get navigator(){return this.session.navigator}},o1=class{constructor(){this.selector="[data-turbo-temporary]",this.deprecatedSelector="[data-turbo-cache=false]",this.started=!1,this.removeTemporaryElements=e=>{for(let i of this.temporaryElements)i.remove()}}start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}get temporaryElements(){return[...document.querySelectorAll(this.selector),...this.temporaryElementsWithDeprecation]}get temporaryElementsWithDeprecation(){let e=document.querySelectorAll(this.deprecatedSelector);return e.length&&console.warn(`The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.`),[...e]}},a1=class{constructor(e,i){this.session=e,this.element=i,this.linkInterceptor=new u0(this,i),this.formSubmitObserver=new Tm(this,i)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,i,n){return this.shouldRedirect(e)}linkClickIntercepted(e,i,n){let a=this.findFrameElement(e);a&&a.delegate.linkClickIntercepted(e,i,n)}willSubmitForm(e,i){return e.closest("turbo-frame")==null&&this.shouldSubmit(e,i)&&this.shouldRedirect(e,i)}formSubmitted(e,i){let n=this.findFrameElement(e,i);n&&n.delegate.formSubmitted(e,i)}shouldSubmit(e,i){var n;let a=x1(e,i),r=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),h=ks((n=r?.content)!==null&&n!==void 0?n:"/");return this.shouldRedirect(e,i)&&Ip(a,h)}shouldRedirect(e,i){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,i):this.session.elementIsNavigatable(e)){let a=this.findFrameElement(e,i);return a?a!=e.closest("turbo-frame"):!1}else return!1}findFrameElement(e,i){let n=i?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");
612if(n&&n!="_top"){let a=this.element.querySelector(`#${n}:not([disabled])`);if(a instanceof Ml)return a}}},l1=class{constructor(e){this.restorationIdentifier=Lp(),this.restorationData={},this.started=!1,this.pageLoaded=!1,this.onPopState=i=>{if(this.shouldHandlePopState()){let{turbo:n}=i.state||{};if(n){this.location=new URL(window.location.href);let{restorationIdentifier:a}=n;this.restorationIdentifier=a,this.delegate.historyPoppedToLocationWithRestorationIdentifier(this.location,a)}}},this.onPageLoad=async i=>{await oL(),this.pageLoaded=!0},this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1)}push(e,i){this.update(history.pushState,e,i)}replace(e,i){this.update(history.replaceState,e,i)}update(e,i,n=Lp()){let a={turbo:{restorationIdentifier:n}};e.call(history,a,"",i.href),this.location=i,this.restorationIdentifier=n}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:i}=this,n=this.restorationData[i];this.restorationData[i]=Object.assign(Object.assign({},n),e)}assumeControlOfScrollRestoration(){var e;this.previousScrollRestoration||(this.previousScrollRestoration=(e=history.scrollRestoration)!==null&&e!==void 0?e:"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}},c1=class{constructor(e){this.delegate=e}proposeVisit(e,i={}){this.delegate.allowsVisitingLocationWithAction(e,i.action)&&(Ip(e,this.view.snapshot.rootLocation)?this.delegate.visitProposedToLocation(e,i):window.location.href=e.toString())}startVisit(e,i,n={}){this.stop(),this.currentVisit=new r1(this,ks(e),i,Object.assign({referrer:this.location},n)),this.currentVisit.start()}submitForm(e,i){this.stop(),this.formSubmission=new Sm(this,e,i,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,i){if(e==this.formSubmission){let n=await i.responseHTML;if(n){let a=e.isSafe;a||this.view.clearSnapshotCache();let{statusCode:r,redirected:h}=i,b={action:this.getActionForFormSubmission(e),shouldCacheSnapshot:a,response:{statusCode:r,responseHTML:n,redirected:h}};this.proposeVisit(i.location,b)}}}async formSubmissionFailedWithResponse(e,i){let n=await i.responseHTML;if(n){let a=Jo.fromHTMLString(n);i.serverError?await this.view.renderError(a,this.currentVisit):await this.view.renderPage(a,!1,!0,this.currentVisit),this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,i){console.error(i)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e)}locationWithActionIsSamePage(e,i){let n=Wh(e),a=Wh(this.view.lastRenderedLocation),r=i==="restore"&&typeof n>"u";return i!=="replace"&&Jx(e)===Jx(this.view.lastRenderedLocation)&&(r||n!=null&&n!==a)}visitScrolledToSamePageLocation(e,i){this.delegate.visitScrolledToSamePageLocation(e,i)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}getActionForFormSubmission({submitter:e,formElement:i}){return _0(e,i)||"advance"}},wc;(function(t){t[t.initial=0]="initial",t[t.loading=1]="loading",t[t.interactive=2]="interactive",t[t.complete=3]="complete"})(wc||(wc={}));var u1=class{constructor(e){this.stage=wc.initial,this.started=!1,this.interpretReadyState=()=>{let{readyState:i}=this;i=="interactive"?this.pageIsInteractive():i=="complete"&&this.pageIsComplete()},this.pageWillUnload=()=>{this.delegate.pageWillUnload()},this.delegate=e}start(){this.started||(this.stage==wc.initial&&(this.stage=wc.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}pageIsInteractive(){this.stage==wc.loading&&(this.stage=wc.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==wc.interactive&&(this.stage=wc.complete,this.delegate.pageLoaded())}get readyState(){return document.readyState}},h1=class{constructor(e){this.started=!1,this.onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})},this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}updatePosition(e){this.delegate.scrollPositionChanged(e)}},d1=class{render({fragment:e}){p0.preservingPermanentElements(this,RL(e),()=>document.documentElement.appendChild(e))}enteringBardo(e,i){i.replaceWith(e.cloneNode(!0))}leavingBardo(){}};function RL(t){let e=nT(document.documentElement),i={};for(let n of e){let{id:a}=n;for(let r of t.querySelectorAll("turbo-stream")){let h=iT(r.templateElement.content,a);h&&(i[a]=[n,h])}}return i}var p1=class{constructor(e){this.sources=new Set,this.started=!1,this.inspectFetchResponse=i=>{let n=zL(i);n&&OL(n)&&(i.preventDefault(),this.receiveMessageResponse(n))},this.receiveMessageEvent=i=>
612{this.started&&typeof i.data=="string"&&this.receiveMessageHTML(i.data)},this.delegate=e}start(){this.started||(this.started=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}async receiveMessageResponse(e){let i=await e.responseHTML;i&&this.receiveMessageHTML(i)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(Tc.wrap(e))}};function zL(t){var e;let i=(e=t.detail)===null||e===void 0?void 0:e.fetchResponse;if(i instanceof bm)return i}function OL(t){var e;return((e=t.contentType)!==null&&e!==void 0?e:"").startsWith(Tc.contentType)}var m0=class extends km{static renderElement(e,i){let{documentElement:n,body:a}=document;n.replaceChild(i,a)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:i}=document;e.replaceChild(this.newHead,i),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let e of this.scriptElements){let i=e.parentNode;if(i){let n=xm(e);i.replaceChild(n,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},Rp=class extends km{static renderElement(e,i){document.body&&i instanceof HTMLBodyElement?document.body.replaceWith(i):document.documentElement.appendChild(i)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}async mergeHead(){let e=this.mergeProvisionalElements(),i=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await i}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){let e=[];for(let i of this.newHeadStylesheetElements)e.push(cL(i)),document.head.appendChild(i);await Promise.all(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(xm(e))}async mergeProvisionalElements(){let e=[...this.newHeadProvisionalElements];for(let i of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(i,e)||document.head.removeChild(i);for(let i of e)document.head.appendChild(i)}isCurrentElementInElementList(e,i){for(let[n,a]of i.entries()){if(e.tagName=="TITLE"){if(a.tagName!="TITLE")continue;if(e.innerHTML==a.innerHTML)return i.splice(n,1),!0}if(a.isEqualNode(e))return i.splice(n,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let i=xm(e);e.replaceWith(i)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}},f1=class{constructor(e){this.keys=[],this.snapshots={},this.size=e}has(e){return r0(e)in this.snapshots}get(e){if(this.has(e)){let i=this.read(e);return this.touch(e),i}}put(e,i){return this.write(e,i),this.touch(e),i}clear(){this.snapshots={}}read(e){return this.snapshots[r0(e)]}write(e,i){this.snapshots[r0(e)]=i}touch(e){let i=r0(e),n=this.keys.indexOf(i);n>-1&&this.keys.splice(n,1),this.keys.unshift(i),this.trim()}trim(){for(let e of this.keys.splice(this.size))delete this.snapshots[e]}},m1=class extends c0{constructor(){super(...arguments),this.snapshotCache=new f1(10),this.lastRenderedLocation=new URL(location.href),this.forceReloaded=!1}renderPage(e,i=!1,n=!0,a){let r=new Rp(this.snapshot,e,Rp.renderElement,i,n);return r.shouldRender?a?.changeHistory():this.forceReloaded=!0,this.render(r)}renderError(e,i){i?.changeHistory();let n=new m0(this.snapshot,e,m0.renderElement,!1);return this.render(n)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:i}=this;await sL();let n=e.clone();return this.snapshotCache.put(i,n),n}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}get snapshot(){return Jo.fromElement(this.element)}},g1=class{constructor(e){this.selector="a[data-turbo-preload]",this.delegate=e}get snapshotCache(){return this.delegate.navigator.view.snapshotCache}
612start(){if(document.readyState==="loading")return document.addEventListener("DOMContentLoaded",()=>{this.preloadOnLoadLinksForView(document.body)});this.preloadOnLoadLinksForView(document.body)}preloadOnLoadLinksForView(e){for(let i of e.querySelectorAll(this.selector))this.preloadURL(i)}async preloadURL(e){let i=new URL(e.href);if(!this.snapshotCache.has(i))try{let a=await(await fetch(i.toString(),{headers:{"VND.PREFETCH":"true",Accept:"text/html"}})).text(),r=Jo.fromHTMLString(a);this.snapshotCache.put(i,r)}catch{}}},y1=class{constructor(){this.navigator=new c1(this),this.history=new l1(this),this.preloader=new g1(this),this.view=new m1(this,document.documentElement),this.adapter=new s1(this),this.pageObserver=new u1(this),this.cacheObserver=new o1,this.linkClickObserver=new h0(this,window),this.formSubmitObserver=new Tm(this,document),this.scrollObserver=new h1(this),this.streamObserver=new p1(this),this.formLinkClickObserver=new d0(this,document.documentElement),this.frameRedirector=new a1(this,document.documentElement),this.streamMessageRenderer=new d1,this.drive=!0,this.enabled=!0,this.progressBarDelay=500,this.started=!1,this.formMode="on"}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,i={}){let n=i.frame?document.getElementById(i.frame):null;n instanceof Ml?(n.src=e.toString(),n.loaded):this.navigator.proposeVisit(ks(e),i)}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(Tc.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){this.progressBarDelay=e}setFormMode(e){this.formMode=e}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}historyPoppedToLocationWithRestorationIdentifier(e,i){this.enabled?this.navigator.startVisit(e,i,{action:"restore",historyChanged:!0}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,i){return this.elementIsNavigatable(e)&&Ip(i,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}willFollowLinkToLocation(e,i,n){return this.elementIsNavigatable(e)&&Ip(i,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,i,n)}followedLinkToLocation(e,i){let n=this.getActionForLink(e),a=e.hasAttribute("data-turbo-stream");this.visit(i.href,{action:n,acceptsStreamResponse:a})}allowsVisitingLocationWithAction(e,i){return this.locationWithActionIsSamePage(e,i)||this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,i){Z2(e),this.adapter.visitProposedToLocation(e,i)}visitStarted(e){e.acceptsStreamResponse||Qx(document.documentElement),Z2(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){e1(document.documentElement),this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}locationWithActionIsSamePage(e,i){return this.navigator.locationWithActionIsSamePage(e,i)}visitScrolledToSamePageLocation(e,i){this.notifyApplicationAfterVisitingSamePageLocation(e,i)}willSubmitForm(e,i){let n=x1(e,i);return this.submissionIsNavigatable(e,i)&&Ip(ks(n),this.snapshot.rootLocation)}formSubmitted(e,i){this.navigator.submitForm(e,i)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){var e;!((e=this.navigator.currentVisit)===null||e===void 0)&&e.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},i){let n=this.notifyApplicationBeforeRender(e,i),{defaultPrevented:a,detail:{render:r}}=n;return this.view.renderer&&r&&(this.view.renderer.renderElement=r),!a}viewRenderedSnapshot(e,i){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender()}preloadOnLoadLinksForView(e){this.preloader.preloadOnLoadLinksForView(e)}viewInvalidated(e){this.adapter.pageInvalidated(e)}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,i){this.notifyApplicationAfterFrameRender(e,i)}applicationAllowsFollowingLinkToLocation(e,i,n){return!this.notifyApplicationAfterClickingLinkToLocation(e,i,n).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,i,n){return Zr("turbo:click",{target:e,detail:{url:i.href,originalEvent:n},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return Zr("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,i){return Zr("turbo:visit",{detail:{url:e.href,action:i}})}notifyApplicationBeforeCachingSnapshot(){return Zr("turbo:before-cache")}notifyApplicationBeforeRender(e,i){return Zr("turbo:before-render",{detail:Object.assign({newBody:e},i),cancelable:!0})}notifyApplicationAfterRender(){return Zr("turbo:render")}notifyApplicationAfterPageLoad(e={}){return Zr("turbo:load",{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterVisitingSamePageLocation(e,i){dispatchEvent(new HashChangeEvent("hashchange",{oldURL:e.toString(),newURL:i.toString()}))}notifyApplicationAfterFrameLoad(e){return Zr("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,i){return Zr("turbo:frame-render",{detail:{fetchResponse:e},target:i,cancelable:!0})}submissionIsNavigatable(e,i){if(this.formMode=="off")return!1;{let n=i?this.elementIsNavigatable(i):!0;return this.formMode=="optin"?n&&e.closest('[data-turbo="true"]')!=null:n&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){let i=l0(e,"[data-turbo]"),n=l0(e,"turbo-frame");return this.drive||n?i?i.getAttribute("data-turbo")!="false":!0:i?i.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return _0(e)||"advance"}get snapshot(){return this.view.snapshot}};function Z2(t){Object.defineProperties(t,FL)}var FL={absoluteURL:{get(){return this.toString()}}},_1=class{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.setCacheControl("")}exemptPageFromCache(){this.setCacheControl("no-cache")}exemptPageFromPreview(){this.setCacheControl("no-preview")}setCacheControl(e){hL("turbo-cache-control",e)}}
612,w1={after(){this.targetElements.forEach(t=>{var e;return(e=t.parentElement)===null||e===void 0?void 0:e.insertBefore(this.templateContent,t.nextSibling)})},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(t=>t.append(this.templateContent))},before(){this.targetElements.forEach(t=>{var e;return(e=t.parentElement)===null||e===void 0?void 0:e.insertBefore(this.templateContent,t)})},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(t=>t.prepend(this.templateContent))},remove(){this.targetElements.forEach(t=>t.remove())},replace(){this.targetElements.forEach(t=>t.replaceWith(this.templateContent))},update(){this.targetElements.forEach(t=>{t.innerHTML="",t.append(this.templateContent)})}},An=new y1,rT=new _1(An),{navigator:sT}=An;function S1(){An.start()}function oT(t){An.registerAdapter(t)}function aT(t,e){An.visit(t,e)}function Cm(t){An.connectStreamSource(t)}function Mm(t){An.disconnectStreamSource(t)}function lT(t){An.renderStreamMessage(t)}function cT(){console.warn("Please replace `Turbo.clearCache()` with `Turbo.cache.clear()`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),An.clearCache()}function uT(t){An.setProgressBarDelay(t)}function hT(t){Sm.confirmMethod=t}function dT(t){An.setFormMode(t)}var BL=Object.freeze({__proto__:null,navigator:sT,session:An,cache:rT,PageRenderer:Rp,PageSnapshot:Jo,FrameRenderer:Dp,start:S1,registerAdapter:oT,visit:aT,connectStreamSource:Cm,disconnectStreamSource:Mm,renderStreamMessage:lT,clearCache:cT,setProgressBarDelay:uT,setConfirmMethod:hT,setFormMode:dT,StreamActions:w1}),v1=class extends Error{},b1=class{constructor(e){this.fetchResponseLoaded=i=>{},this.currentFetchRequest=null,this.resolveVisitPromise=()=>{},this.connected=!1,this.hasBeenLoaded=!1,this.ignoredAttributes=new Set,this.action=null,this.visitCachedSnapshot=({element:i})=>{let n=i.querySelector("#"+this.element.id);n&&this.previousFrameElement&&n.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement},this.element=e,this.view=new i1(this,this.element),this.appearanceObserver=new t1(this,this.element),this.formLinkClickObserver=new d0(this,this.element),this.linkInterceptor=new u0(this,this.element),this.restorationIdentifier=Lp(),this.formSubmitObserver=new Tm(this,this.element)}connect(){this.connected||(this.connected=!0,this.loadingStyle==Sc.lazy?this.appearanceObserver.start():this.loadSourceURL(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.connected&&(this.connected=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==Sc.eager&&this.loadSourceURL()}sourceURLChanged(){this.isIgnoringChangesTo("src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==Sc.eager||this.hasBeenLoaded)&&this.loadSourceURL())}sourceURLReloaded(){let{src:e}=this.element;return this.ignoringChangesToAttribute("complete",()=>{this.element.removeAttribute("complete")}),this.element.src=null,this.element.src=e,this.element.loaded}completeChanged(){this.isIgnoringChangesTo("complete")||this.loadSourceURL()}loadingStyleChanged(){this.loadingStyle==Sc.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.loadSourceURL())}async loadSourceURL(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.visit(ks(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.hasBeenLoaded=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let i=await e.responseHTML;if(i){let n=J2(i);Jo.fromDocument(n).isVisitable?await this.loadFrameResponse(e,n):await this.handleUnvisitableFrameResponse(e)}}finally{this.fetchResponseLoaded=()=>{}}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,e),this.loadSourceURL()}willSubmitFormLinkToLocation(e){return this.shouldInterceptNavigation(e)}submittedFormLinkToLocation(e,i,n){let a=this.findFrameElement(e);a&&n.setAttribute("data-turbo-frame",a.id)}
612shouldInterceptLinkClick(e,i,n){return this.shouldInterceptNavigation(e)}linkClickIntercepted(e,i){this.navigateFrame(e,i)}willSubmitForm(e,i){return e.closest("turbo-frame")==this.element&&this.shouldInterceptNavigation(e,i)}formSubmitted(e,i){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new Sm(this,e,i);let{fetchRequest:n}=this.formSubmission;this.prepareRequest(n),this.formSubmission.start()}prepareRequest(e){var i;e.headers["Turbo-Frame"]=this.id,!((i=this.currentNavigationElement)===null||i===void 0)&&i.hasAttribute("data-turbo-stream")&&e.acceptResponseType(Tc.contentType)}requestStarted(e){Qx(this.element)}requestPreventedHandlingResponse(e,i){this.resolveVisitPromise()}async requestSucceededWithResponse(e,i){await this.loadResponse(i),this.resolveVisitPromise()}async requestFailedWithResponse(e,i){await this.loadResponse(i),this.resolveVisitPromise()}requestErrored(e,i){console.error(i),this.resolveVisitPromise()}requestFinished(e){e1(this.element)}formSubmissionStarted({formElement:e}){Qx(e,this.findFrameElement(e))}formSubmissionSucceededWithResponse(e,i){let n=this.findFrameElement(e.formElement,e.submitter);n.delegate.proposeVisitIfNavigatedWithAction(n,e.formElement,e.submitter),n.delegate.loadResponse(i),e.isSafe||An.clearCache()}formSubmissionFailedWithResponse(e,i){this.element.delegate.loadResponse(i),An.clearCache()}formSubmissionErrored(e,i){console.error(i)}formSubmissionFinished({formElement:e}){e1(e,this.findFrameElement(e))}allowsImmediateRender({element:e},i){let n=Zr("turbo:before-frame-render",{target:this.element,detail:Object.assign({newFrame:e},i),cancelable:!0}),{defaultPrevented:a,detail:{render:r}}=n;return this.view.renderer&&r&&(this.view.renderer.renderElement=r),!a}viewRenderedSnapshot(e,i){}preloadOnLoadLinksForView(e){An.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,i){this.previousFrameElement=e.cloneNode(!0)}async loadFrameResponse(e,i){let n=await this.extractForeignFrameElement(i.body);if(n){let a=new Pp(n),r=new Dp(this,this.view.snapshot,a,Dp.renderElement,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(r),this.complete=!0,An.frameRendered(e,this.element),An.frameLoaded(this.element),this.fetchResponseLoaded(e)}else this.willHandleFrameMissingFromResponse(e)&&this.handleFrameMissingFromResponse(e)}async visit(e){var i;let n=new wm(this,to.get,e,new URLSearchParams,this.element);return(i=this.currentFetchRequest)===null||i===void 0||i.cancel(),this.currentFetchRequest=n,new Promise(a=>{this.resolveVisitPromise=()=>{this.resolveVisitPromise=()=>{},this.currentFetchRequest=null,a()},n.perform()})}navigateFrame(e,i,n){let a=this.findFrameElement(e,n);a.delegate.proposeVisitIfNavigatedWithAction(a,e,n),this.withCurrentNavigationElement(e,()=>{a.src=i})}proposeVisitIfNavigatedWithAction(e,i,n){if(this.action=_0(n,i,e),this.action){let a=Jo.fromElement(e).clone(),{visitCachedSnapshot:r}=e.delegate;e.delegate.fetchResponseLoaded=h=>{if(e.src){let{statusCode:m,redirected:b}=h,T=e.ownerDocument.documentElement.outerHTML,P={response:{statusCode:m,redirected:b,responseHTML:T},visitCachedSnapshot:r,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:a};this.action&&(P.action=this.action),An.visit(e.src,P)}}}}changeHistory(){if(this.action){let e=eT(this.action);An.history.update(e,ks(this.element.src||""),this.restorationIdentifier)}}async handleUnvisitableFrameResponse(e){console.warn(`The response (${e.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.visitResponse(e.response)}willHandleFrameMissingFromResponse(e){this.element.setAttribute("complete","");let i=e.response,n=async(r,h={})=>{r instanceof Response?this.visitResponse(r):An.visit(r,h)};return!Zr("turbo:frame-missing",{target:this.element,detail:{response:i,visit:n},cancelable:!0}).defaultPrevented}handleFrameMissingFromResponse(e){this.view.missing(),this.throwFrameMissingError(e)}
612throwFrameMissingError(e){let i=`The response (${e.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new v1(i)}async visitResponse(e){let i=new bm(e),n=await i.responseHTML,{location:a,redirected:r,statusCode:h}=i;return An.visit(a,{response:{redirected:r,statusCode:h,responseHTML:n}})}findFrameElement(e,i){var n;let a=o0("data-turbo-frame",i,e)||this.element.getAttribute("target");return(n=K2(a))!==null&&n!==void 0?n:this.element}async extractForeignFrameElement(e){let i,n=CSS.escape(this.id);try{if(i=X2(e.querySelector(`turbo-frame#${n}`),this.sourceURL),i)return i;if(i=X2(e.querySelector(`turbo-frame[src][recurse~=${n}]`),this.sourceURL),i)return await i.loaded,await this.extractForeignFrameElement(i)}catch(a){return console.error(a),new Ml}return null}formActionIsVisitable(e,i){let n=x1(e,i);return Ip(ks(n),this.rootLocation)}shouldInterceptNavigation(e,i){let n=o0("data-turbo-frame",i,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.formActionIsVisitable(e,i)||!this.enabled||n=="_top")return!1;if(n){let a=K2(n);if(a)return!a.disabled}return!(!An.elementIsNavigatable(e)||i&&!An.elementIsNavigatable(i))}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){this.ignoringChangesToAttribute("src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.resolveVisitPromise()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){this.ignoringChangesToAttribute("complete",()=>{e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")})}get isActive(){return this.element.isActive&&this.connected}get rootLocation(){var e;let i=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),n=(e=i?.content)!==null&&e!==void 0?e:"/";return ks(n)}isIgnoringChangesTo(e){return this.ignoredAttributes.has(e)}ignoringChangesToAttribute(e,i){this.ignoredAttributes.add(e),i(),this.ignoredAttributes.delete(e)}withCurrentNavigationElement(e,i){this.currentNavigationElement=e,i(),delete this.currentNavigationElement}};function K2(t){if(t!=null){let e=document.getElementById(t);if(e instanceof Ml)return e}}function X2(t,e){if(t){let i=t.getAttribute("src");if(i!=null&&e!=null&&JI(i,e))throw new Error(`Matching <turbo-frame id="${t.id}"> element has a source URL which references itself`);if(t.ownerDocument!==document&&(t=document.importNode(t,!0)),t instanceof Ml)return t.connectedCallback(),t.disconnectedCallback(),t}}var g0=class t extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){var e;return(e=this.renderPromise)!==null&&e!==void 0?e:this.renderPromise=(async()=>{let i=this.beforeRenderEvent;this.dispatchEvent(i)&&(await s0(),await i.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){var e;let i=this.targetElements.flatMap(a=>[...a.children]).filter(a=>!!a.id),n=[...((e=this.templateContent)===null||e===void 0?void 0:e.children)||[]].filter(a=>!!a.id).map(a=>a.id);return i.filter(a=>n.includes(a.id))}get performAction(){if(this.action){let e=w1[this.action];if(e)return e;this.raise("unknown action")}this.raise("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.raise("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let e=this.ownerDocument.createElement("template");return this.appendChild(e),e}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.raise("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}raise(e){throw new Error(`${this.description}: ${e}`)}get description(){var e,i;return(i=((e=this.outerHTML.match(/<[^>]+>/))!==null&&e!==void 0?e:[])[0])!==null&&i!==void 0?i:"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:t.renderElement}})}get targetElementsById(){var e;let i=(e=this.ownerDocument)===null||e===void 0?void 0:e.getElementById(this.target);return i!==null?[i]:[]}get targetElementsByQuery(){var e;let i=(e=this.ownerDocument)===null||e===void 0?void 0:e.querySelectorAll(this.targets);return i.length!==0?Array.prototype.slice.call(i):[]}},y0=class extends HTMLElement{constructor(){super(...arguments),this.streamSource=null}connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),Cm(this.streamSource)}disconnectedCallback(){this.streamSource&&Mm(this.streamSource)}get src(){return this.getAttribute("src")||""}};Ml.delegateConstructor=b1;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",Ml);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",g0);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",y0);(()=>{let t=document.currentScript;if(t&&!t.hasAttribute("data-turbo-suppress-warning"))for(t=t.parentElement;t;){if(t==document.body)return console.warn(Q2`
613        You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do!
614
615        Load your application’s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change.
616
617        For more information, see: https://turbo.hotwired.dev/handbook/building#working-with-script-elements
618
619        ——
620        Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s
621      `,t.outerHTML);t=t.parentElement}})();window.Turbo=BL;S1();var vT;async function UL(){return vT||_T(jL().then(_T))}function _T(t){return vT=t}async function jL(){let{createConsumer:t}=await Promise.resolve().then(()=>(yT(),gT));return t()}async function bT(t,e){let{subscriptions:i}=await UL();return i.create(t,e)}function Dm(t){return!t||typeof t!="object"||t instanceof Date||t instanceof RegExp?t:Array.isArray(t)?t.map(Dm):Object.keys(t).reduce(function(e,i){var n=i[0].toLowerCase()+i.slice(1).replace(/([A-Z]+)/g,function(a,r){return"_"+r.toLowerCase()});return e[n]=Dm(t[i]),e},{})}var D1=class extends HTMLElement{async connectedCallback(){Cm(this),this.subscription=await bT(this.channel,{received:this.dispatchMessageEvent.bind(this),connected:this.subscriptionConnected.bind(this),disconnected:this.subscriptionDisconnected.bind(this)})}disconnectedCallback(){Mm(this),this.subscription&&this.subscription.unsubscribe()}dispatchMessageEvent(e){let i=new MessageEvent("message",{data:e});return this.dispatchEvent(i)}subscriptionConnected(){this.setAttribute("connected","")}subscriptionDisconnected(){this.removeAttribute("connected")}get channel(){let e=this.getAttribute("channel"),i=this.getAttribute("signed-stream-name");return{channel:e,signed_stream_name:i,...Dm({...this.dataset})}}};customElements.get("turbo-cable-stream-source")===void 0&&customElements.define("turbo-cable-stream-source",D1);function xT(t){if(t.target instanceof HTMLFormElement){let{target:e,detail:{fetchOptions:i}}=t;
621e.addEventListener("turbo:submit-start",({detail:{formSubmission:{submitter:n}}})=>{let a=GL(i.body)?i.body:new URLSearchParams,r=HL(n,a,e);/get/i.test(r)||(/post/i.test(r)?a.delete("_method"):a.set("_method",r),i.method="post")},{once:!0})}}function HL(t,e,i){let n=WL(t),a=e.get("_method"),r=i.getAttribute("method")||"get";return typeof n=="string"?n:typeof a=="string"?a:r}function WL(t){return(t instanceof HTMLButtonElement||t instanceof HTMLInputElement)&&t.hasAttribute("formmethod")?t.formMethod:null}function GL(t){return t instanceof FormData||t instanceof URLSearchParams}addEventListener("turbo:before-fetch-request",xT);var R1=class{constructor(e,i,n){this.eventTarget=e,this.eventName=i,this.eventOptions=n,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){let i=ZL(e);for(let n of this.bindings){if(i.immediatePropagationStopped)break;n.handleEvent(i)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((e,i)=>{let n=e.index,a=i.index;return n<a?-1:n>a?1:0})}};function ZL(t){if("immediatePropagationStopped"in t)return t;{let{stopImmediatePropagation:e}=t;return Object.assign(t,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}var z1=class{constructor(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach(e=>e.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(e=>e.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((e,i)=>e.concat(Array.from(i.values())),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e,i=!1){this.fetchEventListenerForBinding(e).bindingDisconnected(e),i&&this.clearEventListenersForBinding(e)}handleError(e,i,n={}){this.application.handleError(e,`Error ${i}`,n)}clearEventListenersForBinding(e){let i=this.fetchEventListenerForBinding(e);i.hasBindings()||(i.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){let{eventTarget:i,eventName:n,eventOptions:a}=e,r=this.fetchEventListenerMapForEventTarget(i),h=this.cacheKey(n,a);r.delete(h),r.size==0&&this.eventListenerMaps.delete(i)}fetchEventListenerForBinding(e){let{eventTarget:i,eventName:n,eventOptions:a}=e;return this.fetchEventListener(i,n,a)}fetchEventListener(e,i,n){let a=this.fetchEventListenerMapForEventTarget(e),r=this.cacheKey(i,n),h=a.get(r);return h||(h=this.createEventListener(e,i,n),a.set(r,h)),h}createEventListener(e,i,n){let a=new R1(e,i,n);return this.started&&a.connect(),a}fetchEventListenerMapForEventTarget(e){let i=this.eventListenerMaps.get(e);return i||(i=new Map,this.eventListenerMaps.set(e,i)),i}cacheKey(e,i){let n=[e];return Object.keys(i).sort().forEach(a=>{n.push(`${i[a]?"":"!"}${a}`)}),n.join(":")}},KL={stop({event:t,value:e}){return e&&t.stopPropagation(),!0},prevent({event:t,value:e}){return e&&t.preventDefault(),!0},self({event:t,value:e,element:i}){return e?i===t.target:!0}},XL=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function YL(t){let i=t.trim().match(XL)||[],n=i[2],a=i[3];return a&&!["keydown","keyup","keypress"].includes(n)&&(n+=`.${a}`,a=""),{eventTarget:JL(i[4]),eventName:n,eventOptions:i[7]?QL(i[7]):{},identifier:i[5],methodName:i[6],keyFilter:i[1]||a}}function JL(t){if(t=="window")return window;if(t=="document")return document}function QL(t){return t.split(":").reduce((e,i)=>Object.assign(e,{[i.replace(/^!/,"")]:!/^!/.test(i)}),{})}function eP(t){if(t==window)return"window";if(t==document)return"document"}function nw(t){return t.replace(/(?:[_-])([a-z0-9])/g,(e,i)=>i.toUpperCase())}function O1(t){return nw(t.replace(/--/g,"-").replace(/__/g,"_"))}function zm(t){return t.charAt(0).toUpperCase()+t.slice(1)}function LT(t){return t.replace(/([A-Z])/g,(e,i)=>`-${i.toLowerCase()}`)}function tP(t){return t.match(/[^\s]+/g)||[]}function wT(t){return t!=null}function F1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var ST=["meta","ctrl","alt","shift"],B1=class{constructor(e,i,n,a){this.element=e,this.index=i,this.eventTarget=n.eventTarget||e,this.eventName=n.eventName||iP(e)||T0("missing event name"),this.eventOptions=n.eventOptions||{},this.identifier=n.identifier||T0("missing identifier"),this.methodName=n.methodName||T0("missing method n
621ame"),this.keyFilter=n.keyFilter||"",this.schema=a}static forToken(e,i){return new this(e.element,e.index,YL(e.content),i)}toString(){let e=this.keyFilter?`.${this.keyFilter}`:"",i=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${i}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(e){if(!this.keyFilter)return!1;let i=this.keyFilter.split("+");if(this.keyFilterDissatisfied(e,i))return!0;let n=i.filter(a=>!ST.includes(a))[0];return n?(F1(this.keyMappings,n)||T0(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[n].toLowerCase()!==e.key.toLowerCase()):!1}shouldIgnoreMouseEvent(e){if(!this.keyFilter)return!1;let i=[this.keyFilter];return!!this.keyFilterDissatisfied(e,i)}get params(){let e={},i=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(let{name:n,value:a}of Array.from(this.element.attributes)){let r=n.match(i),h=r&&r[1];h&&(e[nw(h)]=nP(a))}return e}get eventTargetName(){return eP(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,i){let[n,a,r,h]=ST.map(m=>i.includes(m));return e.metaKey!==n||e.ctrlKey!==a||e.altKey!==r||e.shiftKey!==h}},TT={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:t=>t.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function iP(t){let e=t.tagName.toLowerCase();if(e in TT)return TT[e](t)}function T0(t){throw new Error(t)}function nP(t){try{return JSON.parse(t)}catch{return t}}var N1=class{constructor(e,i){this.context=e,this.action=i}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(e){let i=this.prepareActionEvent(e);this.willBeInvokedByEvent(e)&&this.applyEventModifiers(i)&&this.invokeWithEvent(i)}get eventName(){return this.action.eventName}get method(){let e=this.controller[this.methodName];if(typeof e=="function")return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){let{element:i}=this.action,{actionDescriptorFilters:n}=this.context.application,{controller:a}=this.context,r=!0;for(let[h,m]of Object.entries(this.eventOptions))if(h in n){let b=n[h];r=r&&b({name:h,value:m,event:e,element:i,controller:a})}else continue;return r}prepareActionEvent(e){return Object.assign(e,{params:this.action.params})}invokeWithEvent(e){let{target:i,currentTarget:n}=e;try{this.method.call(this.controller,e),this.context.logDebugActivity(this.methodName,{event:e,target:i,currentTarget:n,action:this.methodName})}catch(a){let{identifier:r,controller:h,element:m,index:b}=this,T={identifier:r,controller:h,element:m,index:b,event:e};this.context.handleError(a,`invoking action "${this.action}"`,T)}}willBeInvokedByEvent(e){let i=e.target;return e instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(e)||e instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(e)?!1:this.element===i?!0:i instanceof Element&&this.element.contains(i)?this.scope.containsElement(i):this.scope.containsElement(this.action.element)}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}},k0=class{constructor(e,i){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=e,this.started=!1,this.delegate=i,this.elements=new Set,this.mutationObserver=new MutationObserver(n=>this.processMutations(n))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(e){this.started&&(this.mutationObserver.disconnect(),this.started=!1),e(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){let e=new Set(this.matchElementsInTree());for(let i of Array.from(this.elements))e.has(i)||this.removeElement(i);for(let i of Array.from(e))this.addElement(i)}}processMutations(e){if(this.started)for(let i of e)this.processMutation(i)}processMutation(e){e.type=="attributes"?this.processAttributeChange(e.target,e.attributeName):e.type=="childList"&&(this.processRemovedNodes(e.removedNodes
621),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,i){this.elements.has(e)?this.delegate.elementAttributeChanged&&this.matchElement(e)?this.delegate.elementAttributeChanged(e,i):this.removeElement(e):this.matchElement(e)&&this.addElement(e)}processRemovedNodes(e){for(let i of Array.from(e)){let n=this.elementFromNode(i);n&&this.processTree(n,this.removeElement)}}processAddedNodes(e){for(let i of Array.from(e)){let n=this.elementFromNode(i);n&&this.elementIsActive(n)&&this.processTree(n,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,i){for(let n of this.matchElementsInTree(e))i.call(this,n)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected!=this.element.isConnected?!1:this.element.contains(e)}addElement(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))}removeElement(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))}},C0=class{constructor(e,i,n){this.attributeName=i,this.delegate=n,this.elementObserver=new k0(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){let i=this.matchElement(e)?[e]:[],n=Array.from(e.querySelectorAll(this.selector));return i.concat(n)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,i){this.delegate.elementAttributeValueChanged&&this.attributeName==i&&this.delegate.elementAttributeValueChanged(e,i)}};function rP(t,e,i){PT(t,e).add(i)}function sP(t,e,i){PT(t,e).delete(i),oP(t,e)}function PT(t,e){let i=t.get(e);return i||(i=new Set,t.set(e,i)),i}function oP(t,e){let i=t.get(e);i!=null&&i.size==0&&t.delete(e)}var kc=class{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((i,n)=>i.concat(Array.from(n)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((i,n)=>i+n.size,0)}add(e,i){rP(this.valuesByKey,e,i)}delete(e,i){sP(this.valuesByKey,e,i)}has(e,i){let n=this.valuesByKey.get(e);return n!=null&&n.has(i)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some(n=>n.has(e))}getValuesForKey(e){let i=this.valuesByKey.get(e);return i?Array.from(i):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter(([i,n])=>n.has(e)).map(([i,n])=>i)}};var V1=class{constructor(e,i,n,a){this._selector=i,this.details=a,this.elementObserver=new k0(e,this),this.delegate=n,this.matchesByElement=new kc}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(e){this._selector=e,this.refresh()}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(e){let{selector:i}=this;if(i){let n=e.matches(i);return this.delegate.selectorMatchElement?n&&this.delegate.selectorMatchElement(e,this.details):n}else return!1}matchElementsInTree(e){let{selector:i}=this;if(i){let n=this.matchElement(e)?[e]:[],a=Array.from(e.querySelectorAll(i)).filter(r=>this.matchElement(r));return n.concat(a)}else return[]}elementMatched(e){let{selector:i}=this;i&&this.selectorMatched(e,i)}elementUnmatched(e){let i=this.matchesByElement.getKeysForValue(e);for(let n of i)this.selectorUnmatched(e,n)}elementAttributeChanged(e,i){let{selector:n}=this;if(n){let a=this.matchElement(e),r=this.matchesByElement.has(n,e);a&&!r?this.selectorMatched(e,n):!a&&r&&this.selectorUnmatched(e,n)}}selectorMatched(e,i){this.delegate.selectorMatched(e,i,this.details),this.matchesByElement.add(i,e)}selectorUnmatched(e,i){this.delegate.selectorUnmatched(e,i,this.details),this.matchesByElement.delete(i,e)}},$1=class{constructor(e,i){this.element=e,this.delegate=i,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(n=>this.processMutations(n))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(let e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(let i of e)this.processMutation(i)}processMutation(e){let i=e.attributeName;i&&this.refreshAttribute(i,e.oldValue)}refreshAttribute(e,i){let n=this.delegate.getStringMapKeyForAttribute(e);
621if(n!=null){this.stringMap.has(e)||this.stringMapKeyAdded(n,e);let a=this.element.getAttribute(e);if(this.stringMap.get(e)!=a&&this.stringMapValueChanged(a,n,i),a==null){let r=this.stringMap.get(e);this.stringMap.delete(e),r&&this.stringMapKeyRemoved(n,e,r)}else this.stringMap.set(e,a)}}stringMapKeyAdded(e,i){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,i)}stringMapValueChanged(e,i,n){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,i,n)}stringMapKeyRemoved(e,i,n){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,i,n)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(e=>e.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}},M0=class{constructor(e,i,n){this.attributeObserver=new C0(e,i,this),this.delegate=n,this.tokensByElement=new kc}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){let[i,n]=this.refreshTokensForElement(e);this.tokensUnmatched(i),this.tokensMatched(n)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach(i=>this.tokenMatched(i))}tokensUnmatched(e){e.forEach(i=>this.tokenUnmatched(i))}tokenMatched(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){let i=this.tokensByElement.getValuesForKey(e),n=this.readTokensForElement(e),a=lP(i,n).findIndex(([r,h])=>!cP(r,h));return a==-1?[[],[]]:[i.slice(a),n.slice(a)]}readTokensForElement(e){let i=this.attributeName,n=e.getAttribute(i)||"";return aP(n,e,i)}};function aP(t,e,i){return t.trim().split(/\s+/).filter(n=>n.length).map((n,a)=>({element:e,attributeName:i,content:n,index:a}))}function lP(t,e){let i=Math.max(t.length,e.length);return Array.from({length:i},(n,a)=>[t[a],e[a]])}function cP(t,e){return t&&e&&t.index==e.index&&t.content==e.content}var A0=class{constructor(e,i,n){this.tokenListObserver=new M0(e,i,this),this.delegate=n,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(e){let{element:i}=e,{value:n}=this.fetchParseResultForToken(e);n&&(this.fetchValuesByTokenForElement(i).set(e,n),this.delegate.elementMatchedValue(i,n))}tokenUnmatched(e){let{element:i}=e,{value:n}=this.fetchParseResultForToken(e);n&&(this.fetchValuesByTokenForElement(i).delete(e),this.delegate.elementUnmatchedValue(i,n))}fetchParseResultForToken(e){let i=this.parseResultsByToken.get(e);return i||(i=this.parseToken(e),this.parseResultsByToken.set(e,i)),i}fetchValuesByTokenForElement(e){let i=this.valuesByTokenByElement.get(e);return i||(i=new Map,this.valuesByTokenByElement.set(e,i)),i}parseToken(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(i){return{error:i}}}},U1=class{constructor(e,i){this.context=e,this.delegate=i,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new A0(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(e){let i=new N1(this.context,e);this.bindingsByAction.set(e,i),this.delegate.bindingConnected(i)}disconnectAction(e){let i=this.bindingsByAction.get(e);i&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(i))}
621disconnectAllActions(){this.bindings.forEach(e=>this.delegate.bindingDisconnected(e,!0)),this.bindingsByAction.clear()}parseValueForToken(e){let i=B1.forToken(e,this.schema);if(i.identifier==this.identifier)return i}elementMatchedValue(e,i){this.connectAction(i)}elementUnmatchedValue(e,i){this.disconnectAction(i)}},j1=class{constructor(e,i){this.context=e,this.receiver=i,this.stringMapObserver=new $1(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,i){let n=this.valueDescriptorMap[i];this.hasValue(e)||this.invokeChangedCallback(e,n.writer(this.receiver[e]),n.writer(n.defaultValue))}stringMapValueChanged(e,i,n){let a=this.valueDescriptorNameMap[i];e!==null&&(n===null&&(n=a.writer(a.defaultValue)),this.invokeChangedCallback(i,e,n))}stringMapKeyRemoved(e,i,n){let a=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,a.writer(this.receiver[e]),n):this.invokeChangedCallback(e,a.writer(a.defaultValue),n)}invokeChangedCallbacksForDefaultValues(){for(let{key:e,name:i,defaultValue:n,writer:a}of this.valueDescriptors)n!=null&&!this.controller.data.has(e)&&this.invokeChangedCallback(i,a(n),void 0)}invokeChangedCallback(e,i,n){let a=`${e}Changed`,r=this.receiver[a];if(typeof r=="function"){let h=this.valueDescriptorNameMap[e];try{let m=h.reader(i),b=n;n&&(b=h.reader(n)),r.call(this.receiver,m,b)}catch(m){throw m instanceof TypeError&&(m.message=`Stimulus Value "${this.context.identifier}.${h.name}" - ${m.message}`),m}}}get valueDescriptors(){let{valueDescriptorMap:e}=this;return Object.keys(e).map(i=>e[i])}get valueDescriptorNameMap(){let e={};return Object.keys(this.valueDescriptorMap).forEach(i=>{let n=this.valueDescriptorMap[i];e[n.name]=n}),e}hasValue(e){let i=this.valueDescriptorNameMap[e],n=`has${zm(i.name)}`;return this.receiver[n]}},q1=class{constructor(e,i){this.context=e,this.delegate=i,this.targetsByName=new kc}start(){this.tokenListObserver||(this.tokenListObserver=new M0(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:e,content:i}){this.scope.containsElement(e)&&this.connectTarget(e,i)}tokenUnmatched({element:e,content:i}){this.disconnectTarget(e,i)}connectTarget(e,i){var n;this.targetsByName.has(i,e)||(this.targetsByName.add(i,e),(n=this.tokenListObserver)===null||n===void 0||n.pause(()=>this.delegate.targetConnected(e,i)))}disconnectTarget(e,i){var n;this.targetsByName.has(i,e)&&(this.targetsByName.delete(i,e),(n=this.tokenListObserver)===null||n===void 0||n.pause(()=>this.delegate.targetDisconnected(e,i)))}disconnectAllTargets(){for(let e of this.targetsByName.keys)for(let i of this.targetsByName.getValuesForKey(e))this.disconnectTarget(i,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}};function Om(t,e){let i=DT(t);return Array.from(i.reduce((n,a)=>(hP(a,e).forEach(r=>n.add(r)),n),new Set))}function uP(t,e){return DT(t).reduce((n,a)=>(n.push(...dP(a,e)),n),[])}function DT(t){let e=[];for(;t;)e.push(t),t=Object.getPrototypeOf(t);return e.reverse()}function hP(t,e){let i=t[e];return Array.isArray(i)?i:[]}function dP(t,e){let i=t[e];return i?Object.keys(i).map(n=>[n,i[n]]):[]}var H1=class{constructor(e,i){this.started=!1,this.context=e,this.delegate=i,this.outletsByName=new kc,this.outletElementsByName=new kc,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(e=>{this.setupSelectorObserverForOutlet(e),this.setupAttributeObserverForOutlet(e)}
621),this.started=!0,this.dependentContexts.forEach(e=>e.refresh()))}refresh(){this.selectorObserverMap.forEach(e=>e.refresh()),this.attributeObserverMap.forEach(e=>e.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(e=>e.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(e=>e.stop()),this.attributeObserverMap.clear())}selectorMatched(e,i,{outletName:n}){let a=this.getOutlet(e,n);a&&this.connectOutlet(a,e,n)}selectorUnmatched(e,i,{outletName:n}){let a=this.getOutletFromMap(e,n);a&&this.disconnectOutlet(a,e,n)}selectorMatchElement(e,{outletName:i}){let n=this.selector(i),a=this.hasOutlet(e,i),r=e.matches(`[${this.schema.controllerAttribute}~=${i}]`);return n?a&&r&&e.matches(n):!1}elementMatchedAttribute(e,i){let n=this.getOutletNameFromOutletAttributeName(i);n&&this.updateSelectorObserverForOutlet(n)}elementAttributeValueChanged(e,i){let n=this.getOutletNameFromOutletAttributeName(i);n&&this.updateSelectorObserverForOutlet(n)}elementUnmatchedAttribute(e,i){let n=this.getOutletNameFromOutletAttributeName(i);n&&this.updateSelectorObserverForOutlet(n)}connectOutlet(e,i,n){var a;this.outletElementsByName.has(n,i)||(this.outletsByName.add(n,e),this.outletElementsByName.add(n,i),(a=this.selectorObserverMap.get(n))===null||a===void 0||a.pause(()=>this.delegate.outletConnected(e,i,n)))}disconnectOutlet(e,i,n){var a;this.outletElementsByName.has(n,i)&&(this.outletsByName.delete(n,e),this.outletElementsByName.delete(n,i),(a=this.selectorObserverMap.get(n))===null||a===void 0||a.pause(()=>this.delegate.outletDisconnected(e,i,n)))}disconnectAllOutlets(){for(let e of this.outletElementsByName.keys)for(let i of this.outletElementsByName.getValuesForKey(e))for(let n of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(n,i,e)}updateSelectorObserverForOutlet(e){let i=this.selectorObserverMap.get(e);i&&(i.selector=this.selector(e))}setupSelectorObserverForOutlet(e){let i=this.selector(e),n=new V1(document.body,i,this,{outletName:e});this.selectorObserverMap.set(e,n),n.start()}setupAttributeObserverForOutlet(e){let i=this.attributeNameForOutletName(e),n=new C0(this.scope.element,i,this);this.attributeObserverMap.set(e,n),n.start()}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}attributeNameForOutletName(e){return this.scope.schema.outletAttributeForScope(this.identifier,e)}getOutletNameFromOutletAttributeName(e){return this.outletDefinitions.find(i=>this.attributeNameForOutletName(i)===e)}get outletDependencies(){let e=new kc;return this.router.modules.forEach(i=>{let n=i.definition.controllerConstructor;Om(n,"outlets").forEach(r=>e.add(r,i.identifier))}),e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){let e=this.dependentControllerIdentifiers;return this.router.contexts.filter(i=>e.includes(i.identifier))}hasOutlet(e,i){return!!this.getOutlet(e,i)||!!this.getOutletFromMap(e,i)}getOutlet(e,i){return this.application.getControllerForElementAndIdentifier(e,i)}getOutletFromMap(e,i){return this.outletsByName.getValuesForKey(i).find(n=>n.element===e)}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}},W1=class{constructor(e,i){this.logDebugActivity=(n,a={})=>{let{identifier:r,controller:h,element:m}=this;a=Object.assign({identifier:r,controller:h,element:m},a),this.application.logDebugActivity(this.identifier,n,a)},this.module=e,this.scope=i,this.controller=new e.controllerConstructor(this),this.bindingObserver=new U1(this,this.dispatcher),this.valueObserver=new j1(this,this.controller),this.targetObserver=new q1(this,this),this.outletObserver=new H1(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(n){this.handleError(n,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}
621get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(e,i,n={}){let{identifier:a,controller:r,element:h}=this;n=Object.assign({identifier:a,controller:r,element:h},n),this.application.handleError(e,`Error ${i}`,n)}targetConnected(e,i){this.invokeControllerMethod(`${i}TargetConnected`,e)}targetDisconnected(e,i){this.invokeControllerMethod(`${i}TargetDisconnected`,e)}outletConnected(e,i,n){this.invokeControllerMethod(`${O1(n)}OutletConnected`,e,i)}outletDisconnected(e,i,n){this.invokeControllerMethod(`${O1(n)}OutletDisconnected`,e,i)}invokeControllerMethod(e,...i){let n=this.controller;typeof n[e]=="function"&&n[e](...i)}};function pP(t){return fP(t,mP(t))}function fP(t,e){let i=vP(t),n=gP(t.prototype,e);return Object.defineProperties(i.prototype,n),i}function mP(t){return Om(t,"blessings").reduce((i,n)=>{let a=n(t);for(let r in a){let h=i[r]||{};i[r]=Object.assign(h,a[r])}return i},{})}function gP(t,e){return _P(e).reduce((i,n)=>{let a=yP(t,e,n);return a&&Object.assign(i,{[n]:a}),i},{})}function yP(t,e,i){let n=Object.getOwnPropertyDescriptor(t,i);if(!(n&&"value"in n)){let r=Object.getOwnPropertyDescriptor(e,i).value;return n&&(r.get=n.get||r.get,r.set=n.set||r.set),r}}var _P=typeof Object.getOwnPropertySymbols=="function"?t=>[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)]:Object.getOwnPropertyNames,vP=(()=>{function t(i){function n(){return Reflect.construct(i,arguments,new.target)}return n.prototype=Object.create(i.prototype,{constructor:{value:n}}),Reflect.setPrototypeOf(n,i),n}function e(){let n=t(function(){this.a.call(this)});return n.prototype.a=function(){},new n}try{return e(),t}catch{return n=>class extends n{}}})();function bP(t){return{identifier:t.identifier,controllerConstructor:pP(t.controllerConstructor)}}var G1=class{constructor(e,i){this.application=e,this.definition=bP(i),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(e){let i=this.fetchContextForScope(e);this.connectedContexts.add(i),i.connect()}disconnectContextForScope(e){let i=this.contextsByScope.get(e);i&&(this.connectedContexts.delete(i),i.disconnect())}fetchContextForScope(e){let i=this.contextsByScope.get(e);return i||(i=new W1(this,e),this.contextsByScope.set(e,i)),i}},Z1=class{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){let i=this.data.get(this.getDataKey(e))||"";return tP(i)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}},K1=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){let i=this.getAttributeNameForKey(e);return this.element.getAttribute(i)}set(e,i){let n=this.getAttributeNameForKey(e);return this.element.setAttribute(n,i),this.get(e)}has(e){let i=this.getAttributeNameForKey(e);return this.element.hasAttribute(i)}delete(e){if(this.has(e)){let i=this.getAttributeNameForKey(e);return this.element.removeAttribute(i),!0}else return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${LT(e)}`}},X1=class{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,i,n){let a=this.warnedKeysByObject.get(e);a||(a=new Set,this.warnedKeysByObject.set(e,a)),a.has(i)||(a.add(i),this.logger.warn(n,e))}};function Y1(t,e){return`[${t}~="${e}"]`}var J1=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((i,n)=>i||this.findTarget(n)||this.findLegacyTarget(n),void 0)}findAll(...e){return e.reduce((i,n)=>[...i,...this.findAllTargets(n),...this.findAllLegacyTargets(n)],[])}findTarget(e){let i=this.getSelectorForTargetName(e);return this.scope.findElement(i)}findAllTargets(e){let i=this.getSelectorForTargetName(e);return this.scope.findAllElements(i)}getSelectorForTargetName(e){let i=this.schema.targetAttributeForScope(this.identifier);return Y1(i,e)}findLegacyTarget(e){let i=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(i),e)}findAllLegacyTargets(e){let i=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(i).map(n=>this.deprecate(n,e))}getLegacySelectorForTargetName(e){let i=`${this.identifier}.${e}`;return Y1(this.schema.targetAttribute,i)}deprecate(e,i){if(e){let{identifier:n}=this,a=this.schema.targetAttribute,r=this.schema.targetAttributeForScope(n);this.guide.warn(e,`target:${i}`,`Please replace ${a}="${n}.${i}" with ${r}="${i}". The ${a} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}},Q1=class{constructor(e,i){this.scope=e,this.controllerElement=i}
621get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((i,n)=>i||this.findOutlet(n),void 0)}findAll(...e){return e.reduce((i,n)=>[...i,...this.findAllOutlets(n)],[])}getSelectorForOutletName(e){let i=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(i)}findOutlet(e){let i=this.getSelectorForOutletName(e);if(i)return this.findElement(i,e)}findAllOutlets(e){let i=this.getSelectorForOutletName(e);return i?this.findAllElements(i,e):[]}findElement(e,i){return this.scope.queryElements(e).filter(a=>this.matchesElement(a,e,i))[0]}findAllElements(e,i){return this.scope.queryElements(e).filter(a=>this.matchesElement(a,e,i))}matchesElement(e,i,n){let a=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(i)&&a.split(" ").includes(n)}},ew=class t{constructor(e,i,n,a){this.targets=new J1(this),this.classes=new Z1(this),this.data=new K1(this),this.containsElement=r=>r.closest(this.controllerSelector)===this.element,this.schema=e,this.element=i,this.identifier=n,this.guide=new X1(a),this.outlets=new Q1(this.documentScope,i)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return Y1(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new t(this.schema,document.documentElement,this.identifier,this.guide.logger)}},tw=class{constructor(e,i,n){this.element=e,this.schema=i,this.delegate=n,this.valueListObserver=new A0(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(e){let{element:i,content:n}=e;return this.parseValueForElementAndIdentifier(i,n)}parseValueForElementAndIdentifier(e,i){let n=this.fetchScopesByIdentifierForElement(e),a=n.get(i);return a||(a=this.delegate.createScopeForElementAndIdentifier(e,i),n.set(i,a)),a}elementMatchedValue(e,i){let n=(this.scopeReferenceCounts.get(i)||0)+1;this.scopeReferenceCounts.set(i,n),n==1&&this.delegate.scopeConnected(i)}elementUnmatchedValue(e,i){let n=this.scopeReferenceCounts.get(i);n&&(this.scopeReferenceCounts.set(i,n-1),n==1&&this.delegate.scopeDisconnected(i))}fetchScopesByIdentifierForElement(e){let i=this.scopesByIdentifierByElement.get(e);return i||(i=new Map,this.scopesByIdentifierByElement.set(e,i)),i}},iw=class{constructor(e){this.application=e,this.scopeObserver=new tw(this.element,this.schema,this),this.scopesByIdentifier=new kc,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce((e,i)=>e.concat(i.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);let i=new G1(this.application,e);this.connectModule(i);let n=e.controllerConstructor.afterLoad;n&&n.call(e.controllerConstructor,e.identifier,this.application)}unloadIdentifier(e){let i=this.modulesByIdentifier.get(e);i&&this.disconnectModule(i)}getContextForElementAndIdentifier(e,i){let n=this.modulesByIdentifier.get(i);if(n)return n.contexts.find(a=>a.element==e)}proposeToConnectScopeForElementAndIdentifier(e,i){let n=this.scopeObserver.parseValueForElementAndIdentifier(e,i);n?this.scopeObserver.elementMatchedValue(n.element,n):console.error(`Couldn't find or create scope for identifier: "${i}" and element:`,e)}handleError(e,i,n){this.application.handleError(e,i,n)}createScopeForElementAndIdentifier(e,i){return new ew(this.schema,e,i,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);let i=this.modulesByIdentifier.get(e.identifier);i&&i.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);let i=this.modulesByIdentifier.get(e.identifier);i&&i.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(n=>e.connectContextForScope(n))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(n=>e.disconnectContextForScope(n))}},xP={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:t=>`data-${t}-target`,outletAttributeForScope:(t,e)=>`data-${t}-${e}
621-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},kT("abcdefghijklmnopqrstuvwxyz".split("").map(t=>[t,t]))),kT("0123456789".split("").map(t=>[t,t])))};function kT(t){return t.reduce((e,[i,n])=>Object.assign(Object.assign({},e),{[i]:n}),{})}var E0=class{constructor(e=document.documentElement,i=xP){this.logger=console,this.debug=!1,this.logDebugActivity=(n,a,r={})=>{this.debug&&this.logFormattedMessage(n,a,r)},this.element=e,this.schema=i,this.dispatcher=new z1(this),this.router=new iw(this),this.actionDescriptorFilters=Object.assign({},KL)}static start(e,i){let n=new this(e,i);return n.start(),n}async start(){await wP(),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(e,i){this.load({identifier:e,controllerConstructor:i})}registerActionOption(e,i){this.actionDescriptorFilters[e]=i}load(e,...i){(Array.isArray(e)?e:[e,...i]).forEach(a=>{a.controllerConstructor.shouldLoad&&this.router.loadDefinition(a)})}unload(e,...i){(Array.isArray(e)?e:[e,...i]).forEach(a=>this.router.unloadIdentifier(a))}get controllers(){return this.router.contexts.map(e=>e.controller)}getControllerForElementAndIdentifier(e,i){let n=this.router.getContextForElementAndIdentifier(e,i);return n?n.controller:null}handleError(e,i,n){var a;this.logger.error(`%s
622
623%o
624
625%o`,i,e,n),(a=window.onerror)===null||a===void 0||a.call(window,i,"",0,0,e)}logFormattedMessage(e,i,n={}){n=Object.assign({application:this},n),this.logger.groupCollapsed(`${e} #${i}`),this.logger.log("details:",Object.assign({},n)),this.logger.groupEnd()}};function wP(){return new Promise(t=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>t()):t()})}function SP(t){return Om(t,"classes").reduce((i,n)=>Object.assign(i,TP(n)),{})}function TP(t){return{[`${t}Class`]:{get(){let{classes:e}=this;if(e.has(t))return e.get(t);{let i=e.getAttributeName(t);throw new Error(`Missing attribute "${i}"`)}}},[`${t}Classes`]:{get(){return this.classes.getAll(t)}},[`has${zm(t)}Class`]:{get(){return this.classes.has(t)}}}}function kP(t){return Om(t,"outlets").reduce((i,n)=>Object.assign(i,CP(n)),{})}function CT(t,e,i){return t.application.getControllerForElementAndIdentifier(e,i)}function MT(t,e,i){let n=CT(t,e,i);if(n||(t.application.router.proposeToConnectScopeForElementAndIdentifier(e,i),n=CT(t,e,i),n))return n}function CP(t){let e=O1(t);return{[`${e}Outlet`]:{get(){let i=this.outlets.find(t),n=this.outlets.getSelectorForOutletName(t);if(i){let a=MT(this,i,t);if(a)return a;throw new Error(`The provided outlet element is missing an outlet controller "${t}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${t}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${n}".`)}},[`${e}Outlets`]:{get(){let i=this.outlets.findAll(t);return i.length>0?i.map(n=>{let a=MT(this,n,t);if(a)return a;console.warn(`The provided outlet element is missing an outlet controller "${t}" instance for host controller "${this.identifier}"`,n)}).filter(n=>n):[]}},[`${e}OutletElement`]:{get(){let i=this.outlets.find(t),n=this.outlets.getSelectorForOutletName(t);if(i)return i;throw new Error(`Missing outlet element "${t}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${n}".`)}},[`${e}OutletElements`]:{get(){return this.outlets.findAll(t)}},[`has${zm(e)}Outlet`]:{get(){return this.outlets.has(t)}}}}function MP(t){return Om(t,"targets").reduce((i,n)=>Object.assign(i,AP(n)),{})}function AP(t){return{[`${t}Target`]:{get(){let e=this.targets.find(t);if(e)return e;throw new Error(`Missing target element "${t}" for "${this.identifier}" controller`)}},[`${t}Targets`]:{get(){return this.targets.findAll(t)}},[`has${zm(t)}Target`]:{get(){return this.targets.has(t)}}}}function EP(t){let e=uP(t,"values"),i={valueDescriptorMap:{get(){return e.reduce((n,a)=>{let r=RT(a,this.identifier),h=this.data.getAttributeNameForKey(r.key);return Object.assign(n,{[h]:r})},{})}}};return e.reduce((n,a)=>Object.assign(n,IP(a)),i)}function IP(t,e){let i=RT(t,e),{key:n,name:a,reader:r,writer:h}=i;return{[a]:{get(){let m=this.data.get(n);return m!==null?r(m):i.defaultValue},set(m){m===void 0?this.data.delete(n):this.data.set(n,h(m))}},[`has${zm(a)}`]:{get(){return this.data.has(n)||i.hasCustomDefaultValue}}}}function RT([t,e],i){return RP({controller:i,token:t,typeDefinition:e})}function I0(t){switch(t){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function Rm(t){switch(typeof t){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(t))return"array";if(Object.prototype.toString.call(t)==="[object Object]")return"object"}function LP(t){let{controller:e,token:i,typeObject:n}=t,a=wT(n.type),r=wT(n.default),h=a&&r,m=a&&!r,b=!a&&r,T=I0(n.type),k=Rm(t.typeObject.default);if(m)return T;if(b)return k;if(T!==k){let P=e?`${e}.${i}`:i;throw new Error(`The specified default value for the Stimulus Value "${P}" must match the defined type "${T}". The provided default value of "${n.default}" is of type "${k}".`)}if(h)return T}function PP(t){let{controller:e,token:i,typeDefinition:n}=t,r=LP({controller:e,token:i,typeObject:n}),h=Rm(n),m=I0(n),b=r||h||m;if(b)return b;let T=e?`${e}.${n}`:i;throw new Error(`Unknown value type "${T}" for "${i}" value`)}function DP(t){let e=I0(t);if(e)return AT[e];let i=F1(t,"default"),n=F1(t,"type"),a=t;if(i)return a.default;if(n){let{type:r}=a,h=I0(r);if(h)return AT[h]}return t}function RP(t){let{token:e,typeDefinition:i}=t,n=`${LT(e)}-value`,a=PP(t);return{type:a,key:n,name:nw(n),get defaultValue(){return DP(i)},get hasCustomDefaultValue(){return Rm(i)!==void 0}
625,reader:zP[a],writer:ET[a]||ET.default}}var AT={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},zP={array(t){let e=JSON.parse(t);if(!Array.isArray(e))throw new TypeError(`expected value of type "array" but instead got value "${t}" of type "${Rm(e)}"`);return e},boolean(t){return!(t=="0"||String(t).toLowerCase()=="false")},number(t){return Number(t.replace(/_/g,""))},object(t){let e=JSON.parse(t);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`expected value of type "object" but instead got value "${t}" of type "${Rm(e)}"`);return e},string(t){return t}},ET={default:OP,array:IT,object:IT};function IT(t){return JSON.stringify(t)}function OP(t){return`${t}`}var Ve=class{constructor(e){this.context=e}static get shouldLoad(){return!0}static afterLoad(e,i){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:i=this.element,detail:n={},prefix:a=this.identifier,bubbles:r=!0,cancelable:h=!0}={}){let m=a?`${a}:${e}`:e,b=new CustomEvent(m,{detail:n,bubbles:r,cancelable:h});return i.dispatchEvent(b),b}};Ve.blessings=[SP,MP,EP,kP];Ve.targets=[];Ve.outlets=[];Ve.values={};var Ct=E0.start();Ct.debug=!0;window.Stimulus=Ct;var L0=class extends Ve{static targets=["item","content"];connect(){let t=window.location.hash;if(t.length<2)return;let i=this.element.querySelector(t)?.querySelector('[data-accordion-target="item"]'),n=i?this.itemTargets.indexOf(i):-1;n>=0&&this.openAt(n)}toggle(t){let e=this.itemTargets.indexOf(t.currentTarget),i=this.contentTargets[e].classList.contains("hidden");this.openAt(i?e:-1)}openAt(t){this.itemTargets.forEach((e,i)=>{let n=i===t;this.contentTargets[i].classList.toggle("hidden",!n),this.contentTargets[i].setAttribute("aria-hidden",String(!n)),e.setAttribute("aria-expanded",String(n))}),t>=0&&this.itemTargets[t].scrollIntoView({behavior:"smooth",block:"start"})}};var P0=class extends Ve{submit(){this.element.requestSubmit()}};var D0=class extends Ve{static targets=["modal","wrapper","content","closeButton","countdownNumber"];static values={url:String,isPartner:Boolean,bookingId:String,userId:String,countdown:Number};connect(){this.countdownValue=15,this.isCountdownActive=!1,this.handleEscape=this.handleEscape.bind(this),this.preloadedContent=null}handleEscape(t){t.key==="Escape"&&this.isCountdownActive&&(t.preventDefault(),t.stopPropagation(),console.log("Fermeture par Escape bloqu\xE9e : countdown en cours"))}showDetails(t){t.preventDefault();let e=t.currentTarget.dataset.bookingDetailsUrlValue;this.urlValue=e,this.bookingIdValue=t.currentTarget.dataset.bookingId,this.userIdValue=t.currentTarget.dataset.userId,document.body.classList.add("overflow-hidden"),document.addEventListener("keydown",this.handleEscape),this.modalTarget.classList.remove("hidden"),setTimeout(()=>{this.wrapperTarget.classList.remove("scale-95","opacity-0"),this.wrapperTarget.classList.add("scale-100","opacity-100")},10),this.updateBookingStatus(),this.isPartnerValue?this.loadBookingDetails():(this.showPartnershipPrompt(),this.preloadBookingDetails(),this.startCountdown())}startCountdown(){this.isCountdownActive=!0,this.closeButtonTarget.style.visibility="hidden",this.countdownNumberTargets.forEach(e=>{e.textContent=this.countdownValue});let t=setInterval(()=>{this.countdownValue>0?(this.countdownValue--,this.countdownNumberTargets.forEach(e=>{e.textContent=this.countdownValue})):(clearInterval(t),this.hideCountdown())},1e3);this.modalTarget.addEventListener("close",()=>{clearInterval(t),this.countdownValue=15,this.hideCountdown()},{once:!0})}hideCountdown(){this.isCountdownActive=!1,this.closeButtonTarget.style.visibility="visible",this.preloadedContent?(this.contentTarget.innerHTML=this.preloadedContent,this.preloadedContent=null):this.loadBookingDetails()}showPartnershipPrompt(){this.contentTarget.innerHTML=`
626      <div class="p-4 text-center bg-blue-50 rounded-lg">
627        <!-- Grand countdown central tr\xE8s visible -->
628        <div class="mb-6 flex flex-col items-center justify-center">
629          <div class="relative mb-3">
630            <div class="h-24 w-24 rounded-full border-4 border-yellow bg-blue text-yellow flex items-center justify-center animate-pulse shadow-lg">
631              <span data-booking-details-target="countdownNumber" class="text-4xl font-bold"></span>
632            </div>
633          </div>
634          <p class="text-lg font-semibold text-gray-700 mb-1">D\xE9tails disponibles dans <span data-booking-details-target="countdownNumber" class="text-blue font-bold"></span> secondes...</p>
635          <p class="text-sm text-gray-500 italic">Merci de patienter</p>
636        </div>
637
638        <h2 class="text-xl font-bold mb-2">Booste ton activit\xE9 !</h2>
639        <p class="mb-2">En tant que partenaire, tu profites d'avantages <span class="font-bold">rien que pour toi</span> :</p>
640        <ul class="mb-3 text-left space-y-2">
641          <li class="flex items-start">
642            <span class="mr-2 mt-1">\u{1F4E7}</span>
643            <div>
644              <span class="font-medium">Gagne du temps</span><br>
645              <span class="text-sm">Re\xE7ois le d\xE9tail de tes demandes de r\xE9servation <span class="font-bold">directement</span> dans ta bo\xEEte mail.</span>
646            </div>
647          </li>
648          <li class="flex items-start">
649            <span class="mr-2 mt-1">\u2B50</span>
650            <div>
651              <span class="font-medium">Mets ton h\xE9bergement en avant</span><br>
652              <span class="text-sm">On t'aide \xE0 te <span class="font-bold">d\xE9marquer</span> et \xE0 attirer <span class="font-bold">plus de monde</span>.</span>
653            </div>
654          </li>
655        </ul>
656        <div class="flex flex-col justify-center items-center space-y-2">
657          <a href="/adhesion/professionnels#pricing"
658             class="bg-blue text-yellow hover:bg-yellow hover:text-blue px-6 py-2 rounded-lg font-medium">
659            Souscrire maintenant
660          </a>
661          <a href="/adhesion/professionnels"
662             class="text-blue hover:text-blue-600 underline text-sm">
663            D\xE9couvrir les offres partenaires
664          </a>
665        </div>
666      </div>
667    `}async preloadBookingDetails(){try{let t=await fetch(this.urlValue);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);let e=await t.text();this.preloadedContent=e,console.log("D\xE9tails de r\xE9servation pr\xE9charg\xE9s avec succ\xE8s")}catch(t){console.error("Erreur lors du pr\xE9chargement des d\xE9tails:",t),this.preloadedContent=`
668        <div class="p-4 text-red-500">
669          Une erreur est survenue lors du chargement des d\xE9tails.
670        </div>
671      `}}async updateBookingStatus(){try{(await fetch(`/reservations/${this.bookingIdValue}/mark_as_seen`,{method:"PATCH",headers:{"X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content,Accept:"application/json"},credentials:"same-origin"})).ok&&document.querySelectorAll(`[data-booking-id="${this.bookingIdValue}"] .status-badge`).forEach(i=>{i.classList.remove("bg-yellow-100","text-yellow-800"),i.classList.add("bg-green-100","text-green-800"),i.innerHTML="\u2705 Trait\xE9e"})}catch(t){console.error("Erreur lors de la mise \xE0 jour du statut:",t)}}async loadBookingDetails(){try{let t=await fetch(this.urlValue);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);let e=await t.text();this.contentTarget.innerHTML=e}catch(t){console.error("Erreur lors du chargement des d\xE9tails:",t),this.contentTarget.innerHTML=`
672        <div class="p-4 text-red-500">
673          Une erreur est survenue lors du chargement des d\xE9tails.
674        </div>
675      `}}closeDialog(t){if(t.preventDefault(),this.isCountdownActive){console.log("Fermeture bloqu\xE9e : countdown en cours");return}document.body.classList.remove("overflow-hidden"),document.removeEventListener("keydown",this.handleEscape),this.wrapperTarget.classList.add("scale-95","opacity-0"),this.wrapperTarget.classList.remove("scale-100","opacity-100"),setTimeout(()=>{this.modalTarget.classList.add("hidden"),this.contentTarget.innerHTML="",this.countdownValue=15,this.preloadedContent=null},300)}disconnect(){document.removeEventListener("keydown",this.handleEscape),this.dialogTarget&&this.dialogTarget.open&&this.dialogTarget.close()}};var R0=class extends Ve{static targets=["checkbox","submit"];submit(t){return this.checkboxTargets.filter(i=>i.checked&&!i.disabled).length===0?(t.preventDefault(),alert("Veuillez s\xE9lectionner au moins une \xE9tape pour envoyer vos emails."),!1):!0}};var zT=n0(rw());var Bp=/(Turbo|Hotwire) Native/.test(navigator.userAgent);function z0(t){let e=new URL(t,location.origin);return e.pathname+e.search}function sw(t){let e=new URL(t,location.origin),i=n=>(e.pathname.match(new RegExp(`/${n}/(\\d+)`))||[])[1]||e.searchParams.get(n);return`${i("from")??"__depart__"}|${i("distance")??""}|${i("track")??""}`}addEventListener("popstate",t=>{t.state&&"carteDepth"in t.state&&(document.querySelector('[data-controller~="carte"]')||Mu.visit(location.href,{action:"replace"}))});var O0=class{constructor(e){this.delegate=e,this._replay={frame:!1,vue:!1,sheet:!1}}start(){this._abort=new AbortController,addEventListener("popstate",e=>this.onPopState(e),{signal:this._abort.signal}),this._levelUrl=location.pathname+location.search,Bp&&(history.replaceState({carteDepth:0,carteLevel:this._levelUrl,carteVue:"fond"},""),window.carteBack=()=>this.depth>0?(history.back(),!0):!1)}stop(){this._abort?.abort(),window.carteBack&&delete window.carteBack}get depth(){return history.state?.carteDepth??0}loadLevel(e){this._levelUrl=z0(e),this.delegate.loadFrame(e)}push(e,i="fond"){"carteDepth"in(history.state||{})||history.replaceState({carteDepth:0,carteLevel:location.pathname+location.search,c
675arteVue:"fond"},""),history.pushState({carteDepth:history.state.carteDepth+1,carteLevel:e,carteVue:i},"",e)}replaceLevel(e){this._replay.frame=!0,history.replaceState({carteDepth:this.depth,carteLevel:z0(e),carteVue:history.state?.carteVue??"fond"},"",e),this.loadLevel(e)}recordFrameLoad(e){if(!Bp||this._replay.frame){this._replay.frame=!1;return}let i=e.src&&z0(e.src);!i||i===history.state?.carteLevel&&history.state?.carteVue!=="carte"||(this._levelUrl=i,this.push(i))}recordCarteView(){if(this._replay.vue){this._replay.vue=!1;return}this.delegate.isDesktop||history.state?.carteVue==="carte"||this.push(history.state?.carteLevel??location.pathname+location.search,"carte")}consumeSheetLock(){let e=this._replay.sheet;return this._replay.sheet=!1,e}onPopState(e){if(!("carteDepth"in(e.state||{})))return;let i=e.state.carteLevel,n=i&&z0(i)!==this._levelUrl;n&&(this._replay.frame=!0,this.loadLevel(i)),!this.delegate.isDesktop&&(e.state.carteVue==="carte"?(this._replay.vue=!0,n&&(this._replay.sheet=!0),this.delegate.applyCarteVue()):this.delegate.mapHidden||this.delegate.applyFondVue(i?.includes("/roadbook/")?"roadbook":"liste"))}popLevel(e){this.depth>0&&(e.preventDefault(),e.stopPropagation(),history.back())}goBack(e){(this.depth>0||history.length>1&&document.referrer.startsWith(location.origin))&&(e.preventDefault(),e.stopPropagation(),history.back())}};var FP=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" class="size-5 fill-blue-700 motion-safe:animate-spin dark:fill-blue-600">
676    <path d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z" opacity=".25" />
677    <path d="M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z" />
678</svg>`,BP=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
679  <path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path>
680  <line x1="12" y1="9" x2="12" y2="13"></line>
681  <line x1="12" y1="17" x2="12.01" y2="17"></line>
682</svg>`,NP=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
683  <circle cx="12" cy="12" r="10"></circle>
684  <line x1="12" y1="16" x2="12" y2="12"></line>
685  <line x1="12" y1="8" x2="12.01" y2="8"></line>
686</svg>`,VP=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 256 256" class="inline-block align-text-bottom h-6 w-6">
687  <path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm45.66,109.66-32,32a8,8,0,0,1-11.32-11.32L148.69,136H88a8,8,0,0,1,0-16h60.69l-18.35-18.34a8,8,0,0,1,11.32-11.32l32,32A8,8,0,0,1,173.66,133.66Z"></path>
688</svg>`,F0=class extends Ve{static targets=["form","suggestions","wayid","name","from","distance","kmLabel"];static values={poisCache:{type:Object,default:{}}};connect(){this.initializeKmLabel(),this.debouncedDistanceSearch=(0,zT.debounce)(()=>this.performDistanceSearch(),1e3),this.initializeFromUrl();let t=document.querySelector("#location-input");t&&t.addEventListener("focus",()=>{window.matchMedia("(max-width: 768px)").matches&&(console.log("Input focused on mobile, scrolling to view"),t.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"}))}),this.hasNameTarget&&this.nameTarget.addEventListener("focus",()=>{window.matchMedia("(max-width: 768px)").matches&&setTimeout(()=>{let a=this.nameTarget.getBoundingClientRect().top+window.pageYOffset-20;window.scrollTo({top:a,behavior:"smooth"})},100)})}initializeFromUrl(){let t=window.location.pathname,e=t.match(/\/from\/(\d+)/);e&&this.hasFromTarget&&(this.fromTarget.value=e[1]);let i=t.match(/\/distance\/(\d+)/);i&&this.hasDistanceTarget&&(this.distanceTarget.value=i[1],this.toggleKmLabel());let n=t.match(/\/track\/(\d+)/);n&&(this.track=n[1]);let a=t.match(/\/trace\/(\d+)/);a&&(this.trace=a[1])}initializeKmLabel(){this.hasDistanceTarget&&this.hasKmLabelTarget&&this.toggleKmLabel()}onDistanceFocus(t){t.target.value="",this.toggleKmLabel()}toggleKmLabel(){if(this.hasDistanceTarget&&this.hasKmLabelTarget){let t=this.distanceTarget.value!=="";this.kmLabelTarget.classList.toggle("hidden",!t)}}distanceChanged(t){this.toggleKmLabel();let e=t.target.value,i=parseInt(e);if(e===""){this.clearSuggestions();return}i>40?(this.showMessage("La distance de recherche est limt\xE9e \xE0 40 km","warning"),this.validateDistance(t.target),this.debouncedDistanceSearch()):i>=0?(this.showLoadingIndicator(),this.debouncedDistanceSearch()):this.clearSuggestions()}validateDistance(t){t.value=Math.min(parseInt(t.value)||0,40)}buildUrl(t,e){let i=this.formTarget.dataset.listeBase||this.formTarget.action.split("/hebergements")[0]+"/hebergements",n=[];return t&&n.push(`from/${t}`),e&&parseInt(e)>0&&n.push(`distance/${e}`),this.track&&n.push(`track/${this.track}`),this.trace&&n.push(`trace/${this.trace}`),n.length>0?`${i}/${n.join("/")}`:i}selectPoi(t){t.preventDefault();let e=t.currentTarget.dataset.poiId,i=t.currentTarget.dataset.poiName;this.suggestionsTarget.innerHTML="",this.nameTarget.value=i,this.fromTarget.value=e;let n=this.buildUrl(e,this.distanceTarget?.value);this.navigate(n)}performDistanceSearch=()=>{let t=parseInt(this.distanceTarget.value);if(t>=0&&t<=40){let e=this.buildUrl(this.fromTarget.value,t);this.navigate(e,"replace")}};formChanged(t){t.preventDefault();let e=this.buildUrl(this.fromTarget.value,this.distanceTarget?.value);this.navigate(e)}navigate(t,e=null){Bp?this.dispatch("navigate",{detail:{url:t,action:e}}):e?Turbo.visit(t,{action:e}):Turbo.visit(t)}suggestions(t){this.hasDistanceTarget&&(this.distanceTarget.value="",this.toggleKmLabel());let e=t.target.value;this.lastQuery=e,e.length>2?this.searchSuggestions(e):this.suggestionsTarget.innerHTML=""}normalize(t){return(t||"").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[-'’./]/g," ").replace(/\bst\b/g,"saint").replace(/\bste\b/g,"sainte").replace(/\s+/g," ").trim()}filterPois(t,e){let i=this.normalize(e);return t.filter(n=>this.normalize(n.name).includes(i)||this.normalize(n.city).includes(i)).slice(0,5)}async searchSuggestions(t){let e=this.wayidTarget.value;if(this.poisCacheValue[e]){console.log("\u{1F50D} Using cached POIs"),this.showSuggestions(this.filterPois(this.poisCacheValue[e],t));return}this.showLoadingIndicator();try{let i=await fetch(`/api/pois_cached.json?way_id=${e}`,{headers:{Accept:"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content}});if(!i.ok){let a=await i.json();throw new Error(a.error||"Erreur r\xE9seau")}let n=await i.json();if(this.poisCacheValue[e]=n.results,t!==this.lastQuery)return;this.showSuggestions(this.filterPois(n.results,t))}catch(i){if(t!==this.lastQuery)return;this.showErrorMessage(i.message)}}showSuggestions(t){if(t.length===0)this.showMessage("Aucun r\xE9sultat trouv\xE9. Essayez de modifier votre recherche.");else{let e=t.map(i=>{let{name:n,zip_code:a,city:r,id:h}=i;return`
689            <li class="cursor-pointer group bg-white px-6 py-4 results w-full hover:bg-yellow-300 border-b-2 font-semibold text-blue flex justify-between"
690                data-poi-name="${n}" 
691                data-poi-id="${h}" 
692                data-action="pointerdown->cached-search#selectPoi">
693                <div>
694                    ${n}<br>
695                    <span class="font-normal text-blue-500">${a} ${r}</span>
696                </div>
697                <div class="text-xs font-light hidden md:group-hover:flex md:group-hover:items-center md:group-hover:space-x-1 group-hover:underline">
698                    <span>S\xE9lectionner</span>
699                    ${VP}
700                </div>
701            </li>`}).join("");this.suggestionsTarget.innerHTML=e}}clearSuggestions(){this.suggestionsTarget.innerHTML=""}showLoadingIndicator(){this.suggestionsTarget.innerHTML=`
702      <li class="bg-white px-6 py-4 text-blue flex items-center">
703        ${FP}
704        <span class="ml-2">Recherche en cours...</span>
705      </li>
706    `}hideLoadingIndicator(){}showErrorMessage(t="Une erreur s'est produite. Veuillez r\xE9essayer ult\xE9rieurement."){this.showMessage(t,"warning")}showMessage(t,e="info"){let i=NP,n="text-blue-500";e==="warning"&&(i=BP,n="text-red-600"),this.suggestionsTarget.innerHTML=`
707      <li class="bg-white px-6 py-4 flex items-center">
708        ${i}
709        <p class="font-semibold ${n} ml-2">${t}</p>
710      </li>
711    `}};var B0=class extends Ve{static targets=["slide","indicator","previous","next","indicators"];static values={currentIndex:Number,type:{type:String,default:"photos"}};connect(){this.carouselId=this.element.id||`carousel-${Math.random().toString(36).substring(2,9)}`,console.log(`Carousel connected: ${this.carouselId}`),this.currentIndexValue=this.currentIndexValue||0,this.touchStartX=0,this.touchEndX=0,this.slideTargets.length<=1&&(this.hasPreviousTarget&&this.previousTarget.classList.add("hidden"),this.hasNextTarget&&this.nextTarget.classList.add("hidden"),this.hasIndicatorsTarget&&this.indicatorsTarget.classList.add("hidden")),this.updateSlider(),this.setupTouchEvents()}setupTouchEvents(){this.typeValue==="sleeps"&&(this.handleTouchStartBound=this.handleTouchStart.bind(this),this.handleTouchMoveBound=this.handleTouchMove.bind(this),this.handleTouchEndBound=this.handleTouchEnd.bind(this),this.element.addEventListener("touchstart",this.handleTouchStartBound,{passive:!0}),this.element.addEventListener("touchmove",this.handleTouchMoveBound,{passive:!0}),this.element.addEventListener("touchend",this.handleTouchEndBound,{passive:!0}))}handleTouchStart(t){this.touchStartX=t.touches[0].clientX,this.touchMoveX=this.touchStartX,this.slideStartTime=new Date}handleTouchMove(t){if(this.typeValue!=="sleeps")return;this.touchMoveX=t.touches[0].clientX;let e=this.touchMoveX-this.touchStartX;this.moveSlides(e)}handleTouchEnd(){let t=this.touchMoveX-this.touchStartX,e=new Date-this.slideStartTime,i=Math.abs(t)/e;Math.abs(t)>50||i>.5?t>0?this.previous():this.next():this.updateSlider()}moveSlides(t){if(this.typeValue!=="sleeps")return;let e=this.slideTargets[0].parentElement,i=-100*this.currentIndexValue,n=t/e.offsetWidth*100;e.style.transform=`translateX(${i+n}%)`}next(){this.currentIndexValue<this.slideTargets.length-1&&(this.currentIndexValue++,this.updateSlider())}previous(){this.currentIndexValue>0&&(this.currentIndexValue--,this.updateSlider())}goToSlide(t){let e=parseInt(t.currentTarget.dataset.index);e>=0&&e<this.slideTargets.length&&(this.currentIndexValue=e,this.updateSlider())}updateSlider(){if(console.log(`Updating slider to index ${this.currentIndexValue} in carousel: ${this.carouselId}`),this.typeValue==="photos")this.slideTargets.forEach((t,e)=>{e===this.currentIndexValue?(t.classList.remove("opacity-0","absolute"),t.classList.add("opacity-100")):(t.classList.add("opacity-0","absolute"),t.classList.remove("opacity-100"))});else{let t=this.slideTargets[0].parentElement;t.style.transition="transform 300ms ease-in-out",t.style.transform=`translateX(-${this.currentIndexValue*100}%)`,setTimeout(()=>{t.style.transition=""},300)}if(this.hasIndicatorsTarget){this.indicatorsTarget.innerHTML="";let t=this.slideTargets.length;if(this.typeValue==="photos")for(let e=0;e<t;e++)this.createIndicator(e,"w-3 h-3");else{let i=window.innerWidth<768?5:t;if(t<=i)for(let n=0;n<t;n++)this.createIndicator(n,"w-2 h-2");else{let n=this.currentIndexValue,a=t-1;this.createIndicator(0,"w-2 h-2"),n>1&&this.createEllipsis();for(let r=Math.max(1,n-1);r<=Math.min(a-1,n+1);r++)this.createIndicator(r,"w-2 h-2");n<a-2&&this.createEllipsis(),a>0&&this.createIndicator(a,"w-2 h-2")}}}}createIndicator(t,e){let i=document.createElement("button");i.type="button",i.dataset.carouselTarget="indicator",i.dataset.action="click->
711carousel#goToSlide",i.dataset.index=t,i.className=`${e} rounded-full mx-1`,i.style.backgroundColor=t===this.currentIndexValue?"#FAB313":"rgba(250,179,19,0.4)",this.indicatorsTarget.appendChild(i)}createEllipsis(){let t=document.createElement("span");t.className="mx-1 text-gray-400 text-sm leading-none",t.textContent="...",this.indicatorsTarget.appendChild(t)}disconnect(){this.handleTouchStartBound&&this.element.removeEventListener("touchstart",this.handleTouchStartBound),this.handleTouchMoveBound&&this.element.removeEventListener("touchmove",this.handleTouchMoveBound),this.handleTouchEndBound&&this.element.removeEventListener("touchend",this.handleTouchEndBound)}};var Eu=null,N0=class extends Ve{static targets=["map","sheet","fiche","zoom","profil","limite","kmMin","kmMax","kmMinLabel","kmMaxLabel","kmFill","kmChip","countChip","showAll","showBefore","continueHere","continueTown","voile","ficheFrame","geolocStatus","sleepTypeBox","openOnlyBox","filterBtn","reliefBtn"];static values={styleUrl:String,workerUrl:String,bundleJsUrl:String,bundleCssUrl:String,wayId:Number,waySlug:String,activeTraceId:Number,latitude:Number,longitude:Number,zoom:{type:Number,default:12},minZoom:{type:Number,default:10},maxZoom:{type:Number,default:16},listZoom:{type:Number,default:14},gated:{type:Boolean,default:!1},inApp:{type:Boolean,default:!1},courseKmMin:{type:Number,default:0},courseKmMax:{type:Number,default:0},stepDays:{type:Object,default:{}},pickStates:{type:Object,default:{}}};connect(){this.observer=new IntersectionObserver(t=>{t[0].isIntersecting&&(this.observer.disconnect(),this.boot())},{rootMargin:"300px"}),this.observer.observe(this.element),this.restoreSleepTypes(),this.restoreRelief(),this.initHistory()}initHistory(){this.hist=new O0(this),this.hist.start(),this._segmentKey=sw(location.href)}loadFrame(t){let e=this.ficheFrameTarget;e.delegate&&(e.delegate.action=null,e.delegate.fetchResponseLoaded=()=>{}),e.src=t}applyCarteVue(){this.element.querySelector('[data-shell-fond="carte"]')?.click()}applyFondVue(t){this.applySheet(.94),this.dispatch("vue-fond",{detail:{fond:t}})}popLevel(t){this.hist.popLevel(t)}recordCarteView(){this.hist.recordCarteView()}onFicheFrameRender(t){if(!this.isNativeApp)return;let e=t.target.src;if(!e)return;let i=new URL(e,location.origin).pathname;if(!/\/hebergements(\/|$)/.test(i)&&!i.startsWith("/roadbook/"))return;let n=sw(e);n!==this._segmentKey&&t.detail.fetchResponse?.responseHTML?.then(a=>this.refreshSegment(a,n))}navigateSegment(t){let{url:e,action:i}=t.detail;this.moteurEl?.removeAttribute("open"),i==="replace"?this.hist.replaceLevel(e):this.hist.loadLevel(e)}async refreshSegment(t,e){let i=new DOMParser().parseFromString(t,"text/html"),n=i.querySelector('[data-controller~="carte"]');if(!n)return;this._segmentKey=e,window.ahoy?.track("segment_view",{path:location.pathname});let a=this.activeTraceIdValue;for(let{name:b,value:T}of[...n.attributes])b.startsWith("data-carte-")&&b.endsWith("-value")&&this.element.setAttribute(b,T);this.core&&this.activeTraceIdValue!==a&&this.loadTrace();let r=i.querySelector("[data-carte-data]"),h=this.element.querySelector("[data-carte-data]");r&&h?h.textContent=r.textContent:h&&h.remove();let m=i.querySelector("[data-carte-moteur]");m&&this.moteurEl&&(this.moteurEl.innerHTML=m.innerHTML),i.querySelectorAll("[data-shell-fond][href]").forEach(b=>{this.element.querySelectorAll(`[data-shell-fond="${b.dataset.shellFond}"][href]`).forEach(T=>T.setAttribute("href",b.getAttribute("href")))}),this.core&&await this.loadPois()}get reliefKey(){return"carte:relief"}restoreRelief(){this.reliefOn=localStorage.getItem(this.reliefKey)==="1"}get sleepTypesKey(){return"carte:sleep-types-off"}restoreSleepTypes(){let t=[];try{t=JSON.parse(localStorage.getItem(this.sleepTypesKey)||"[]")}catch{}this.sleepTypesOff=new Set(t),this.sleepTypeBoxTargets.forEach(e=>{e.checked=!this.sleepTypesOff.has(e.value)}),this.openOnly=this.hasOpenOnlyBoxTarget&&localStorage.getItem("carte:open-only")==="1",this.hasOpenOnlyBoxTarget&&(this.openOnlyBoxTarget.checked=!this.openOnly),this.paintSleepFilterBtn()}sleepTypeChanged(){this.sleepTypesOff=new Set(this.sleepTypeBoxTargets.filter(t=>!t.checked).map(t=>t.value)),this.openOnly=this.hasOpenOnlyBoxTarget&&!this.openOnlyBoxTarget.checked;try{localStorage.setItem(this.sleepTypesKey,JSON.stringify([...this.sleepTypesOff])),localStorage.setItem("carte:open-only",this.openOnly?"1":"")}catch{}this.paintSleepFilterBtn(),this.hasKmMinTarget&&this.kmRangeChanged()}sleepTypeVisible(t){if(t.type!=="sleep"&&t.type!=="partner")return!0;
711if(this.openOnly&&t.ferme)return!1;let e=this.sleepTypesOff;return!e?.size||!e.has(t.poiType)?!0:!!t.tentes&&!e.has("__tentes__")}paintSleepFilterBtn(){let t=this.sleepTypesOff?.size>0||!!this.openOnly||!!this.kmFiltered;this.filterBtnTargets.forEach(e=>{e.dataset.sleepsActive=t?"1":""})}disconnect(){this.hist?.stop(),this.observer?.disconnect(),clearTimeout(this.syncT),clearTimeout(this.scrollT),this.scrollHandler&&this.scroller?.removeEventListener("scroll",this.scrollHandler),this.escHandler&&document.removeEventListener("keydown",this.escHandler),this.overHandler&&document.removeEventListener("mouseover",this.overHandler),this.outHandler&&document.removeEventListener("mouseout",this.outHandler),this.unsubscribe?.(),this.coreWiring?.abort(),this.core&&this._mapEl?.isConnected?Eu={core:this.core,el:this._mapEl}:(this.core?.destroy(),Eu=null),this.core=null}async boot(){this._booted||(this._booted=!0,this.isDesktop=window.matchMedia("(min-width: 1280px)").matches,this.sheetFrac=.42,this.hasFicheTarget&&this.ficheTarget.classList.add("hidden"),this.moteurEl=this.element.querySelector("[data-carte-moteur]"),this.hasVoileTarget&&this.moteurEl?.addEventListener("toggle",()=>{this.voileTarget.classList.toggle("hidden",!this.moteurEl.open)}),this.escHandler=t=>{t.key==="Escape"&&this.moteurEl?.removeAttribute("open")},document.addEventListener("keydown",this.escHandler),this.scroller=this.sheetTarget?.querySelector(".overflow-y-auto"),this.restoreKmRange(),!this.gatedValue&&(this.isDesktop?this.ensureMap():this.applySheet(.94)))}async resolveStyle(){let t=window.OfflineBridge?.tilesUrl?.(this.wayIdValue);if(!t)return this.styleUrlValue;try{let e=await(await fetch(this.styleUrlValue)).json();return Object.values(e.sources||{}).forEach(i=>{typeof i.url=="string"&&i.url.startsWith("pmtiles://")&&(i.url=`pmtiles://${t}`)}),e}catch(e){return console.warn("carte offline: style local KO, fallback online",e),this.styleUrlValue}}async ensureMap(){if(!(this.gatedValue||this.core||this._mapLoading)){if(Eu?.el===this.mapTarget){this.core=Eu.core,Eu=null;let t=this.urlView()||(this.isNativeApp?null:this.savedView());this.core.setView({center:t?.center||[this.longitudeValue,this.latitudeValue],zoom:t?.zoom||this.zoomValue,padding:0})}else{if(Eu&&(Eu.core.destroy(),Eu=null),this._mapLoading=!0,window.MapCore||(this.injectBundle(),await this.waitForBundle()),this._mapLoading=!1,!window.MapCore){let i=document.querySelector('script[type="module"][src*="carte"]');console.warn(`carte: MapCore absent apr\xE8s attente (script carte.js ${i?"pr\xE9sent mais non ex\xE9cut\xE9":"ABSENT du DOM"})`);return}let t=this.urlView()||(this.isNativeApp?null:this.savedView()),e=await this.resolveStyle();try{this.core=new window.MapCore(this.mapTarget,{styleUrl:e,workerUrl:this.workerUrlValue,center:t?.center||[this.longitudeValue,this.latitudeValue],zoom:t?.zoom||this.zoomValue,fit:null,minZoom:this.isDesktop?12:this.minZoomValue,maxZoom:this.maxZoomValue,limitTo:"markers"})}catch(i){console.error("carte: \xE9chec d'init MapCore",i);return}}this._mapEl=this.mapTarget,this.store=new window.SelectionStore,this.isDesktop?this.core.setPadding({left:448}):this.applySheet(this.sheetFrac??.1),this.wireCoreToStore(),this.wireStoreToUi(),this.wireListToStore(),this.inAppValue&&this.core.enableGeolocate(),this.scroller=this.sheetTarget?.querySelector(".overflow-y-auto"),this.scroller&&(this.scrollHandler=()=>this.onListScroll(),this.scroller.addEventListener("scroll",this.scrollHandler,{passive:!0})),this.loadPois(),this.loadTrace(),this.centerOnSelection()}}injectBundle(){if(document.getElementById("carte-bundle"))return;let t=document.createElement("link");t.rel="stylesheet",t.href=this.bundleCssUrlValue,document.head.appendChild(t);let e=document.createElement("script");e.id="carte-bundle",e.type="module",e.src=this.bundleJsUrlValue,document.head.appendChild(e)}get mapHidden(){return!this.isDesktop&&(this.sheetFrac??0)>=.9}onListScroll(){if(!this.core||this.mapHidden||Date.now()-(this.listProgAt||0)<1200)return;let t=Date.now();if(t-(this.lastListPan||0)<250){clearTimeout(this.scrollT),this.scrollT=setTimeout(()=>this.onListScroll(),260);return}this.lastListPan=t;let e=this.scroller.getBoundingClientRect(),i=e.top+e.height/2,n=null,a=1/0;this.scroller.querySelectorAll("[data-poi-id]").forEach(h=>{let m=h.getBoundingClientRect(),b=Math.abs(m.top+m.height/2-i);b<a&&(a=b,n=h)});let r=n&&this.pois?.get(n.getAttribute("data-poi-id"));!r||r.id===this.lastListAnchor||(this.lastListAnchor=r.id,this.core.panTo(r.id,{zoom:this.listZoomValue,duration:450,linear:!0}))}waitForBundle(){return new Promise(t=>{window.addEventListener("carte:bundle-ready",t,{once:!0});let e=0,i=setInterval(()=>{(window.MapCore||++e>300)&&(clearInterval(i),t())},100)})}async loadPois(){try{let t,e=this.element.querySelector("[data-carte-data]");if(e)t=JSON.parse(e.textContent);else{let n=new URLSearchParams(window.location.search);n.set("full","1");let a=`${window.location.pathname.replace(/\/$/,"")}.json?${n}`;t=await(await fetch(a,{headers:{Accept:"application/json"}})).json()}let i=(t.features||[]).map(n=>({id:String(n.properties.id),type:n.properties.type,lng:n.geometry.coordinates[0],lat:n.geometry.coordinates[1],name:n.properties.name,price:n.properties.price!=null?parseFloat(n.properties.price):null,kms:n.properties.kms??n.properties.distance_from_start??null,url:n.properties.url??null,imageUrl:n.properties.image_url??null,imageSrcset:n.properties.image_srcset??null,poiType:n.properties.poi_type??null,tentes:n.properties.tentes??!1,ferme:n.properties.ferme??!1,dPlusCum:n.properties.d_plus_cum??null,dMinusCum:n.properties.d_minus_cum??null,trackId:n.properties.track_id??null,stepDay:this.stepDaysValue[String(n.properties.id)]??null,pickState:this.pickStatesValue[String(n.properties.id)]??null}));this.pois=new Map(i.map(n=>[n.id,n])),this.core.setMarkers(i),this.drawProfile(t.properties?.elevation),this.restoreKmRange(),this.pendingSelectPoiId||this.arrivalCamera()}catch(t){console.warn("carte: POIs indisponibles",t)}}arrivalCamera(){if(!this.core)return;let t=this.urlView();if(t)return this.core.setView({center:t.center,zoom:t.zoom});let e=this.hasKmMinTarget?+this.kmMinTarget.value:0,i=this.hasKmMaxTarget?+this.kmMaxTarget.value:1/0,n=this.pois?.size?[...this.pois.values()].filter(r=>(r.kms==null||(e<=0||r.kms>=e)&&r.kms<=i)&&this.sleepTypeVisible(r)):[],a=this.savedView();if(a&&this.viewShowsSome(a,n))return this.core.setView({center:a.center,zoom:a.zoom});if(e>0&&n.length)return this.core.fit("markers",{poiIds:n.map(r=>r.id)});this.core.setView({center:[this.longitudeValue,this.latitudeValue],zoom:this.zoomValue})}viewShowsSome(t,e){if(!e.length)return!1;let i=200/Math.pow(2,t.zoom),[n,a]=t.center;return e.some(r=>Math.abs(r.lng-n)<i&&Math.abs(r.lat-a)<i)}async loadTrace(){if(this.hasWayIdValue){try{let t=fetch(`/json_ways/${this.wayIdValue}.json`).then(n=>n.json()),e=this.reliefOn?this.fetchDifficulty():null,i=await t;this.traceGeo=i,this.core.setTrace(i,{activeTraceId:this.activeTraceIdValue||null}),await e}catch(t){console.warn("carte: trac\xE9 indisponible",t)}this.paintReliefBtn()}}async fetchDifficulty(){if(this.hasWayIdValue)try{let t=await fetch(`/json_ways/${this.wayIdValue}/difficulty.json`).then(e=>e.json());this.core.setTraceDifficulty(t),this.reliefLoaded=!0}catch(t){console.warn("carte: difficult\xE9 indisponible",t)}}toggleRelief(){this.reliefOn=!this.reliefOn;try{localStorage.setItem(this.reliefKey,this.reliefOn?"1":"0")}catch{}this.applyRelief()}applyRelief(){this.reliefOn?this.reliefLoaded?this.core.showTraceDifficulty():this.fetchDifficulty():this.core.hideTraceDifficulty(),this.hasProfilTarget&&this.profilTarget.classList.toggle("hidden",!this.reliefOn||!this.profilPts),this.paintReliefBtn()}paintReliefBtn(){this.hasReliefBtnTarget&&(this.reliefBtnTarget.dataset.reliefActive=this.reliefOn?"1":"")}wireCoreToStore(){let t=this.mapTarget;this.coreWiring=new AbortController;let{signal:e}=this.coreWiring;t.addEventListener("poi:hovered",i=>this.store.set({hoveredPoiId:i.detail.poiId}),{signal:e}),t.addEventListener("poi:selected",i=>this.store.set({selectedPoiId:i.detail.poiId,hoveredPoiId:null}),{signal:e}),t.addEventListener("poi:deselected",()=>this.store.set({selectedPoiId:null}),{signal:e}),t.addEventListener("trace:clicked",i=>this.visitTrack(i.detail.trackId),{signal:e}),t.addEventListener("map:moved",i=>{this.saveView(i.detail),this.syncListToMap(i.detail),this.updateBadges(i.detail),i.detail.user&&this.checkRangeVoid(i.detail)},{signal:e}),t.addEventListener("map:moving",i=>this.updateBadges(i.detail),{signal:e}),t.addEventListener("map:limit",i=>{let n=i.detail.edges||[];this.limitePrompt(n.includes("ouest"))},{signal:e}),t.addEventListener("map:geolocated",i=>this.onGeolocated(i.detail),{signal:e})}onGeolocated({onTrack:t,distanceToTrace:e,inWindow:i}){if(this.hasGeolocStatusTarget){if(i===!1){this.geolocStatusTarget.textContent="Tu es hors de la portion affich\xE9e",this.geolocStatusTarget.classList.remove("hidden"),clearTimeout(this.geolocT),this.geolocT=setTimeout(()=>this.geolocStatusTarget.classList.add("hidden"),4e3);return}if(t||e==null){this.geolocStatusTarget.classList.add("hidden");return}this.geolocStatusTarget.textContent=`Tu sembles \xE0 ~${Math.round(e)} m du chemin`,this.geolocStatusTarget.classList.remove("hidden"),clearTimeout(this.geolocT),this.geolocT=setTimeout(()=>this.geolocStatusTarget.classList.add("hidden"),5e3)}}kmRangeChanged(t){let e=+this.kmMinTarget.value,i=+this.kmMaxTarget.value;e>i&&(t?.target===this.kmMinTarget?(e=i,this.kmMinTarget.value=e):(i=e,this.kmMaxTarget.value=i)),this.kmMinLabelTarget.textContent=e,this.kmMaxLabelTarget.textContent=i;let n=+this.kmMaxTarget.max||1;this.kmFillTarget.style.left=`${e/n*100}%`,this.kmFillTarget.style.right=`${100-i/n*100}%`,clearTimeout(this.kmFilterT),this.kmFilterT=setTimeout(()=>this.applyKmFilter(e,i),250)}get kmRangeKey(){return`carte:kmrange:${this.wayIdValue}`}restoreKmRange(){if(!this.hasKmMinTarget)return;let t=+this.kmMaxTarget.max;if(this.courseKmMaxValue>0){this.kmMinTarget.value=Math.min(this.courseKmMinValue,t),this.kmMaxTarget.value=Math.min(this.courseKmMaxValue,t),this._restoringRange=!0,this.kmRangeChanged();return}let e=null;try{e=JSON.parse(localStorage.getItem(this.kmRangeKey))}catch{}e&&(e.min>0||e.max<t)&&(this.kmMinTarget.value=Math.min(e.min??0,t),this.kmMaxTarget.value=Math.min(e.max??t,t),this._restoringRange=!0,this.kmRangeChanged())}updateKmChip(t,e){if(!this.hasKmChipTarget)return;let i=t<=0&&e>=+(this.kmMaxTarget?.max||e);this.kmChipTarget.textContent=i?"toutes distances":`${t}-${e} km`}filterListByKm(t,e){let i=+(this.kmMaxTarget?.max||e),n=t<=0&&e>=i,a=t<=0?-1/0:t;document.querySelectorAll("#poi-list-container [data-poi-km]").forEach(r=>{let h=parseFloat(r.dataset.poiKm),m=!n&&!isNaN(h)&&(h<a||h>e),b=this.pois?.get(r.dataset.poiId),T=b?!this.sleepTypeVisible(b):!1;r.style.display=m||T?"none":""})}applyKmFilter(t,e){localStorage.setItem(this.kmRangeKey,JSON.stringify({min:t,max:e})),this.updateKmChip(t,e),this.filterListByKm(t,e);let i=t<=0?-1/0:t;if(this.pois?.size&&this.core){let T=[...this.pois.values()].filter(F=>
711(F.kms==null||F.kms>=i&&F.kms<=e)&&this.sleepTypeVisible(F));this.core.setMarkers(T,{relimit:!1});let k=this._restoringRange;this._restoringRange=!1;let P=T.length&&!k?()=>this.core.fit("markers",{poiIds:T.map(F=>F.id),animate:!0}):null;this.mapHidden?this.pendingMapFit=P:P&&P()}let n=t>0||e<+(this.kmMaxTarget?.max||e),a=this.sleepTypesOff?.size>0||!!this.openOnly;this.kmFiltered=n,this.paintSleepFilterBtn();let r=0,h=0,m=0,b=null;if(this.pois?.size){let T=P=>P.type==="sleep"||P.type==="partner",k=P=>P.kms==null||P.kms>=i&&P.kms<=e;r=[...this.pois.values()].filter(T).length,h=[...this.pois.values()].filter(P=>T(P)&&k(P)&&this.sleepTypeVisible(P)).length,m=[...this.pois.values()].filter(P=>T(P)&&P.kms!=null&&P.kms<i).length,b=[...this.pois.values()].filter(P=>P.kms!=null&&k(P)).at(-1)?.id}else{let T=[...document.querySelectorAll('#poi-list-container [data-poi-km][data-poi-type="Sleep"]')];if(!T.length)return;let k=F=>parseFloat(F.dataset.poiKm);r=T.length,h=T.filter(F=>F.style.display!=="none").length,m=T.filter(F=>!Number.isNaN(k(F))&&k(F)<i).length,b=[...document.querySelectorAll("#poi-list-container [data-poi-km]")].filter(F=>F.style.display!=="none"&&!Number.isNaN(parseFloat(F.dataset.poiKm))).at(-1)?.dataset.poiId}if(this.hasCountChipTarget&&(this.countChipTarget.textContent=n||a?`${h} affich\xE9s \xB7 ${r} sur cette section`:`${r} sur cette section`),this.hasShowAllTarget){let T=r-h;this.showAllTarget.classList.toggle("hidden",!n||!T),T>0&&(this.showAllTarget.textContent=`${T} h\xE9bergement${T>1?"s":""} au-del\xE0 de ${e} km \xB7 Les afficher`)}if(this.hasShowBeforeTarget&&(this.showBeforeTarget.classList.toggle("hidden",!m),m&&(this.showBeforeTarget.textContent=m===1?"Voir l'h\xE9bergement avant":`Voir les ${m} h\xE9bergements avant`)),this.hasContinueHereTarget&&(this.continueHereTarget.classList.toggle("hidden",!n||!b),b)){this.continueHereTarget.href=this.fromUrl(b);let T=document.querySelector(`#poi-list-container [data-poi-id="${b}"]`)?.dataset.poiCity;this.continueHereTarget.textContent=T?`Repartir de ${T}`:"Repartir d'ici"}this.hasContinueTownTarget&&this.continueTownTarget.classList.toggle("hidden",n)}rangeTrackDown(t){if(t.target instanceof HTMLInputElement)return;let e=t.currentTarget.getBoundingClientRect(),i=Math.min(1,Math.max(0,(t.clientX-e.left)/e.width)),n=Math.round(i*(+this.kmMaxTarget.max||1)),a=Math.abs(n-+this.kmMinTarget.value)<=Math.abs(n-+this.kmMaxTarget.value)?this.kmMinTarget:this.kmMaxTarget;a.value=n,this.kmRangeChanged()}clearKmFilter(){this.hasKmMinTarget&&(this.kmMinTarget.value=0,this.kmMaxTarget.value=this.kmMaxTarget.max,this.kmRangeChanged())}clearKmMin(){this.hasKmMinTarget&&(this.kmMinTarget.value=0,this.kmRangeChanged())}checkRangeVoid({bounds:t,center:e}){if(!this.hasKmMinTarget||!this.pois?.size)return;let[[i,n],[a,r]]=t,h=+this.kmMinTarget.value,m=+this.kmMaxTarget.value,b=h<=0?-1/0:h,T=[...this.pois.values()].filter(k=>(k.type==="sleep"||k.type==="partner")&&k.kms!=null&&this.sleepTypeVisible(k)&&k.lng>=i&&k.lng<=a&&k.lat>=n&&k.lat<=r);if(!T.length)return this.proposeContinuation(e);T.some(k=>k.kms>=b&&k.kms<=m)||(T.some(k=>k.kms>m)?this.kmMaxTarget.value=this.kmMaxTarget.max:this.kmMinTarget.value=0,this._restoringRange=!0,this.kmRangeChanged(),clearTimeout(this.kmFilterT),this.applyKmFilter(+this.kmMinTarget.value,+this.kmMaxTarget.value))}proposeContinuation(t){let e=[...this.pois.values()].filter(h=>(h.type==="sleep"||h.type==="partner")&&h.kms!=null);if(!e.length||!t)return;let i=h=>(h.lng-t[0])**2+(h.lat-t[1])**2,n=e.reduce((h,m)=>i(h)<=i(m)?h:m),a=e.map(h=>h.kms),r=Math.abs(n.kms-Math.max(...a))<=Math.abs(n.kms-Math.min(...a));this.limitePrompt(r)}limitePrompt(t){if(!this.hasLimiteTarget)return;let e=this.limiteTarget.querySelector("[data-limite-continue]"),i=this.limiteTarget.querySelector("[data-limite-moteur]");e?.classList.toggle("hidden",!t),i?.classList.toggle("hidden",t),this.limiteTarget.classList.remove("hidden"),clearTimeout(this.limiteT),this.limiteT=setTimeout(()=>this.limiteTarget.classList.add("hidden"),4e3)}openMoteur(){this.limiteTarget.classList.add("hidden"),this.element.querySelector("[data-carte-moteur]")?.setAttribute("open","")}closeMoteur(){this.moteurEl?.removeAttribute("open")}updateBadges(t){this.hasZoomTarget&&(this.zoomTarget.textContent=`z ${t.zoom.toFixed(1)}`),this.lastMapDetail=t,this.updateProfilCursor(t)}kmAtCenter({center:t}){if(!t)return null;let e=(this.profilRaw||[]).filter(T=>T.lng!=null);if(e.length<2)return null;let[i,n]=t,a=Math.cos(n*Math.PI/180),r=this.lastCursorKm,h=null;for(let T=0;T<e.length-1;T++){let k=e[T],P=e[T+1],F=(k.lng-i)*a,U=k.lat-n,X=(P.lng-k.lng)*a,Y=P.lat-k.lat,te=X*X+Y*Y,le=te?-(F*X+U*Y)/te:0,we=T===0?-5:0,Le=T===e.length-2?5:1;le=Math.max(we,Math.min(Le,le));let Oe=F+X*le,ze=U+Y*le,Xe=k.km+(P.km-k.km)*le,rt=Math.sqrt(Oe*Oe+ze*ze)*111.32+(r!=null?.35*Math.abs(Xe-r):0);(!h||rt<h.score)&&(h={score:rt,km:Xe})}let m=(this.segKmMax??1/0)+5,b=h?Math.max(-5,Math.min(m,h.km)):null;return this.lastCursorKm=b,b}
711axisAnchor({bounds:t,center:e}){if(!t||!this.pois?.size)return null;let[[i,n],[a,r]]=t,h=[...this.pois.values()].filter(k=>k.lng>=i&&k.lng<=a&&k.lat>=n&&k.lat<=r);if(!h.length)return null;let m=Math.cos(e[1]*Math.PI/180),b=k=>((k.lng-e[0])*m)**2+(k.lat-e[1])**2;return{anchor:h.reduce((k,P)=>b(P)<b(k)?P:k),count:h.length}}slopeColor(t){let e=Math.abs(t);return e<5?"#22c55e":e<14?"#f97316":e<20?"#dc2626":"#7f1d1d"}drawProfile(t){if(!this.hasProfilTarget)return;if(!t||t.length<2){this.profilTarget.classList.add("hidden");return}this.profilRaw=t,this.lastCursorKm=null,this.segKmMax=Math.max(...[...this.pois?.values()||[]].map(te=>te.kms??0),.1);let e=this.segKmMax;this.profilX=te=>100-Math.max(0,Math.min(te,e))/e*100,this.profilKmAtX=te=>(100-te)/100*e,this.profilDom=[0,e];let i=t.filter(te=>te.km>=-.001&&te.km<=e+.001);if(i.length<2){this.profilTarget.classList.add("hidden");return}let n=i.map(te=>te.z),a=Math.min(...n),r=Math.max(Math.max(...n)-a,1),h=te=>28-(te-a)/r*26,m=i.map(te=>({x:this.profilX(te.km),y:h(te.z),km:te.km,z:te.z}));this.profilPts=m;let b="";for(let te=1;te<m.length;
711te++){let le=m[te-1],we=m[te],Le=we.km-le.km,Oe=Le>0?(we.z-le.z)/(Le*1e3)*100:0;b+=`<polygon points="${le.x.toFixed(2)},30 ${le.x.toFixed(2)},${le.y.toFixed(2)} ${we.x.toFixed(2)},${we.y.toFixed(2)} ${we.x.toFixed(2)},30" fill="${this.slopeColor(Oe)}" fill-opacity=".45"></polygon>`}let T=m.map(te=>`${te.x.toFixed(2)},${te.y.toFixed(2)}`).join(" "),k=[100,200,500,1e3].find(te=>r/te<=3.5)||1e3,P=[];for(let te=Math.ceil(a/k)*k;te<=a+r;te+=k)P.push(te);let F=P.map(te=>`<line x1="0" x2="100" y1="${h(te).toFixed(2)}" y2="${h(te).toFixed(2)}" stroke="#E2E8F0" stroke-width="1" vector-effect="non-scaling-stroke"></line>`).join(""),U=P.map(te=>`<div class="absolute left-1 -translate-y-1/2 text-[9px] leading-none text-white bg-slate-700/80 px-1 rounded pointer-events-none" style="top:${(h(te)/30*100).toFixed(1)}%">${te} m</div>`).join(""),X=e>25?10:5,Y="";for(let te=0;te<=e+.01;te+=X)Y+=`<div class="absolute bottom-0 -translate-x-1/2 text-[9px] leading-none text-white bg-slate-700/80 px-1 rounded pointer-events-none" style="left:${this.profilX(te).toFixed(1)}%">${te}${te+X>e?" km":""}</div>`;this.profilTarget.innerHTML=`<div class="absolute inset-0 overflow-hidden rounded-lg bg-white shadow">
712        <svg data-profil-svg viewBox="0 0 100 30" preserveAspectRatio="none" class="w-full h-full">
713          ${F}
714          ${b}
715          <polyline points="${T}" fill="none" stroke="#1f2937" stroke-width="1" vector-effect="non-scaling-stroke"></polyline>
716        </svg>
717        ${U}
718        ${Y}
719        <div data-profil-cursor class="hidden absolute inset-y-0 w-0.5 -ml-px bg-blue pointer-events-none"></div>
720        <div data-profil-needle class="hidden absolute inset-y-0 w-0.5 -ml-px bg-yellow pointer-events-none"></div>
721      </div>
722      <div data-profil-cursor-chip class="hidden absolute -top-6 -translate-x-1/2 whitespace-nowrap bg-slate-700/90 text-white text-[11px] font-semibold px-2 py-0.5 rounded-full shadow pointer-events-none"></div>`,this.profilSvg=this.profilTarget.querySelector("[data-profil-svg]"),this.profilCursor=this.profilTarget.querySelector("[data-profil-cursor]"),this.profilCursorChip=this.profilTarget.querySelector("[data-profil-cursor-chip]"),this.profilNeedle=this.profilTarget.querySelector("[data-profil-needle]"),this.updateProfilCursor(this.lastMapDetail),this.profilTarget.classList.toggle("hidden",!this.reliefOn)}slideProfil(t){if(this.profilNeedle){if(t==null||!this.profilX){this.profilNeedle.classList.add("hidden");return}this.profilNeedle.style.left=`${Math.max(0,Math.min(100,this.profilX(t)))}%`,this.profilNeedle.classList.remove("hidden")}}updateProfilCursor(t){if(!this.profilCursor||!this.profilX||!t)return;let e=this.kmAtCenter(t);if(e==null){this.profilCursor.classList.add("hidden"),this.profilCursorChip?.classList.add("hidden"),this.core?.setCursorPoint?.(null);return}let i=Math.max(0,Math.min(this.segKmMax??e,e)),n=Math.max(0,Math.min(100,this.profilX(i)));if(this.profilCursor.style.left=`${n}%`,this.profilCursor.classList.remove("hidden"),this.core?.setCursorPoint?.(this.lngLatAtKm(i)),this.profilCursorChip){let a=this.zAtKm(i),r=h=>Math.max(0,h).toFixed(1).replace(".",",");this.profilCursorChip.textContent=`km ${r(i)}${a!=null?` \xB7 ${Math.round(a)} m`:""}`,this.profilCursorChip.style.left=`${Math.max(8,Math.min(92,n))}%`,this.profilCursorChip.classList.remove("hidden")}}zAtKm(t){let e=this.profilRaw;if(!e||e.length<2||t<e[0].km||t>e[e.length-1].km)return null;let i=e.findIndex(r=>r.km>=t);if(i<=0)return e[0].z;let n=e[i-1],a=e[i];return a.km===n.km?n.z:n.z+(a.z-n.z)*((t-n.km)/(a.km-n.km))}profilDragStart(t){this.mapHidden||(this.profilDrag={x:t.clientX,moved:!1},this.profilTarget.setPointerCapture(t.pointerId))}profilDragMove(t){let e=this.profilDrag;if(!e||!e.moved&&Math.abs(t.clientX-e.x)<5)return;e.moved=!0;let i=t.clientX;e.raf||(e.raf=requestAnimationFrame(()=>{e.raf=null;let n=this.profilTarget.getBoundingClientRect(),a=this.profilKmAtX((i-n.left)/n.width*100),r=this.lngLatAtKm(Math.max(0,Math.min(this.segKmMax??0,a)));r&&this.core.panTo(null,{duration:120,linear:!0,fallbackCenter:r})}))}profilDragEnd(){let t=this.profilDrag;t?.raf&&cancelAnimationFrame(t.raf),this.profilDrag=null,this.profilDragged=t?.moved||!1,setTimeout(()=>{this.profilDragged=!1},0)}lngLatAtKm(t){let e=(this.profilRaw||[]).filter(h=>h.lng!=null);if(e.length<2)return null;let i=e.findIndex(h=>h.km>=t);if(i===-1){let h=e[e.length-1];return[h.lng,h.lat]}if(i===0)return[e[0].lng,e[0].lat];
722let n=e[i-1],a=e[i],r=a.km===n.km?0:(t-n.km)/(a.km-n.km);return[n.lng+(a.lng-n.lng)*r,n.lat+(a.lat-n.lat)*r]}profilClick(t){if(this.profilDragged||this.mapHidden||!this.profilSvg||!this.pois?.size)return;let e=this.profilTarget.getBoundingClientRect(),i=this.profilSvg.viewBox.baseVal,n=this.profilKmAtX(i.x+(t.clientX-e.left)/e.width*i.width),a=[...this.pois.values()].reduce((r,h)=>Math.abs((h.kms??1e9)-n)<Math.abs((r.kms??1e9)-n)?h:r);this.core.panTo(a.id,{zoom:this.listZoomValue})}syncListToMap({bounds:t,center:e,user:i}){!i||!t||!this.pois?.size||(clearTimeout(this.syncT),this.syncT=setTimeout(()=>{let n=this.axisAnchor({bounds:t,center:e});n&&n.count!==this.pois.size&&(this.listProgAt=Date.now(),document.querySelector(`[data-poi-id="${CSS.escape(n.anchor.id)}"]`)?.scrollIntoView({block:"center",behavior:"smooth"}))},600))}wireStoreToUi(){let t=this.store.state;this.unsubscribe=this.store.subscribe(e=>{if(e.hoveredPoiId!==t.hoveredPoiId){this.core.highlight(e.hoveredPoiId),this.isDesktop&&!this.mapHidden&&e.hoveredPoiId!=null&&this.core.panTo(e.hoveredPoiId,{duration:300});let n=e.hoveredPoiId!=null?this.pois?.get(e.hoveredPoiId):null;this.slideProfil(n?.kms??null)}e.selectedPoiId!==t.selectedPoiId&&(this.core.select(e.selectedPoiId,{pan:!this.mapHidden}),this.presentFiche(e.selectedPoiId)),document.querySelectorAll("[data-poi-id]").forEach(n=>{let a=n.getAttribute("data-poi-id"),r=a===e.selectedPoiId?"selected":a===e.hoveredPoiId?"hovered":null;r?n.setAttribute("data-carte-state",r):n.removeAttribute("data-carte-state")});let i=e.hoveredPoiId!==t.hoveredPoiId?e.hoveredPoiId:e.selectedPoiId!==t.selectedPoiId?e.selectedPoiId:null;
722i!=null&&document.querySelector(`[data-poi-id="${CSS.escape(i)}"]`)?.scrollIntoView({block:"nearest",behavior:"smooth"}),t=e})}wireListToStore(){this.overHandler=t=>{let e=t.target.closest?.("[data-poi-id]");e&&!e.contains(t.relatedTarget)&&this.store.set({hoveredPoiId:e.getAttribute("data-poi-id")})},this.outHandler=t=>{let e=t.target.closest?.("[data-poi-id]");e&&!e.contains(t.relatedTarget)&&this.store.set({hoveredPoiId:null})},document.addEventListener("mouseover",this.overHandler),document.addEventListener("mouseout",this.outHandler)}updateFiche(t){if(!this.hasFicheTarget)return;let e=t!=null?this.pois?.get(t):null;if(this.ficheTarget.classList.toggle("hidden",!e),!e)return;let i=this.ficheTarget.querySelector("[data-fiche-photo]");i.classList.toggle("hidden",!e.imageUrl),e.imageUrl&&(i.src=e.imageUrl,i.srcset=e.imageSrcset||"",i.sizes="320px",i.alt=e.name),this.ficheTarget.querySelector("[data-fiche-name]").textContent=e.name,this.ficheTarget.querySelector("[data-fiche-meta]").textContent=[e.type,e.kms!=null?`\xE0 ${e.kms} km`:null].filter(Boolean).join(" \xB7 "),this.ficheTarget.querySelector("[data-fiche-price]").textContent=e.price!=null?`\xC0 partir de ${e.price} \u20AC`:"";let n=this.ficheTarget.querySelector("[data-fiche-link]");e.type==="road"?(n.textContent="Basculer sur ce parcours",n.classList.toggle("hidden",e.trackId==null),e.trackId!=null&&(n.href=this.trackPath(e.trackId)+location.hash)):(n.textContent="Voir la fiche",n.classList.toggle("hidden",!e.url),e.url&&(n.href=e.url));let a=this.ficheTarget.querySelector("[data-fiche-depart]");if(a){let h=e.type==="town";a.classList.toggle("hidden",!h),h&&(a.href=this.fromUrl(e.id))}let r=this.ficheTarget.querySelector("[data-fiche-step]");if(r){let h=e.type!=="road"&&e.stepDay==null;r.classList.toggle("hidden",!h),h&&(r.querySelector("[data-fiche-step-poi]").value=e.id,r.querySelector("[data-fiche-step-label]").textContent=e.type==="town"?"Faire \xE9tape ici (sans g\xEEte)":"Dormir ici")}}segmentPath(t={}){let e=window.location.pathname.split("/"),i=a=>{let r=e.indexOf(a);return r>-1&&e[r+1]?e[r+1]:null},n=[];for(let a of["from","distance","track"]){let r=a in t?t[a]:i(a);r!=null&&n.push(`${a}/${r}`)}return`/${this.waySlugValue}/hebergements${n.length?`/${n.join("/")}`:""}`}fromUrl(t){return this.segmentPath({from:t})}deselect(){this.hasFicheTarget&&this.ficheTarget.classList.add("hidden"),this.store?.set({selectedPoiId:null})}onFicheFrameLoad(t){this.hist.recordFrameLoad(t.target);let e=this.hist.consumeSheetLock(),i=t.target.querySelector("[data-pick-states]");if(i)try{this.applyPickStates(JSON.parse(i.dataset.pickStates))}catch{}let n=t.target.querySelector("[data-fiche]");if(n){if(this.currentFichePoiId=n.dataset.fichePoiId||null,this.scroller?.scrollTo({top:0}),!this.isDesktop&&!e){let a=this.sheetTarget.getBoundingClientRect().height/window.innerHeight;a<.9&&(this.prevSheetFrac=a,this.applySheet(.94))}}else{let a=this.currentFichePoiId;this.currentFichePoiId=null,!this.isDesktop&&!e&&(this.prevSheetFrac!=null?(this.applySheet(this.prevSheetFrac),this.prevSheetFrac=null):this.applySheet(.94)),this.hasKmMinTarget&&this.applyKmFilter(+this.kmMinTarget.value,+this.kmMaxTarget.value),a&&document.querySelector(`[data-
722poi-id="${CSS.escape(a)}"]`)?.scrollIntoView({block:"center"})}}applyPickStates(t){if(!this.pois?.size)return;this.pickStatesValue=t;let e=!1;this.pois.forEach(i=>{let n=t[i.id]??null;i.pickState!==n&&(i.pickState=n,e=!0)}),!(!e||!this.core)&&(this.hasKmMinTarget?(this._restoringRange=!0,this.applyKmFilter(+this.kmMinTarget.value,+this.kmMaxTarget.value)):this.core.setMarkers([...this.pois.values()],{relimit:!1}))}presentFiche(t){let e=t!=null?this.pois?.get(t):null;if(e&&(e.type==="sleep"||e.type==="partner"||e.type==="town")&&this.hasFicheFrameTarget){if(this.hasFicheTarget&&this.ficheTarget.classList.add("hidden"),this._linkNavPoiId===String(t))this._linkNavPoiId=null;else if(this.currentFichePoiId!==String(t)){let n=this.fichePath(t);this.isNativeApp||this.hist.push(n),this.hist.loadLevel(n)}}else this.updateFiche(t)}fichePath(t){let e=location.pathname+location.search;return`/pois/${t}/fiche?back=${encodeURIComponent(e)}`}openFiche(t){let e=t.params.poiId;if(e==null)return;this.pendingSelectPoiId=String(e);let i=t.currentTarget;i.href=this.fichePath(e),i.dataset.turboFrame="poi_fiche",this.isNativeApp||(i.dataset.turboAction="advance"),this._linkNavPoiId=String(e),this.store?.set({selectedPoiId:String(e)})}get isNativeApp(){return Bp}goBack(t){this.hist.goBack(t)}centerOnSelection(){let t=this.pendingSelectPoiId??this.store?.state.selectedPoiId;t==null||!this.core||(this.store.set({selectedPoiId:String(t)}),this.core.panTo(t,{zoom:this.listZoomValue}),this.pendingSelectPoiId=null)}applySheet(t){let e=(this.sheetFrac??0)>=.9,i=this.mapHidden;this.sheetFrac=t,this.sheetTarget.style.height=`${t*100}vh`,this.sheetTarget.style.height=`${t*100}dvh`,!this.isDesktop&&(this.element.classList.toggle("carte-list-mode",this.mapHidden),i&&!this.mapHidden&&this.core?.resize(),this.hasProfilTarget&&(this.profilTarget.style.bottom=`calc(${t*100}vh + 4.25rem)`,this.profilTarget.style.bottom=`calc(${t*100}dvh + 4.25rem)`),this.core?.setPadding({bottom:Math.round(Math.min(.5,t)*window.innerHeight)}),e&&t<.9&&(this.lastListAnchor=null,this.pendingMapFit?(this.pendingMapFit(),this.pendingMapFit=null):this.onListScroll()))}collapseSheet(){this.isDesktop||(this.ensureMap(),this.applySheet(0),this.centerOnSelection())}visitTrack(t){let e=this.trackPath(t);if(!this.isNativeApp)return Mu.visit(e+location.hash);this.hist.push(e),history.replaceState(history.state,"",e+location.hash),this.hist.loadLevel(e)}trackPath(t){return this.segmentPath({track:t})}get viewKey(){return`carte:view:v4:${this.wayIdValue}:${this.longitudeValue.toFixed(3)},${this.latitudeValue.toFixed(3)}`}savedView(){try{let t=JSON.parse(localStorage.getItem(this.viewKey));return Array.isArray(t?.center)&&t.center.every(Number.isFinite)&&Number.isFinite(t.zoom)?t:null}catch{return null}}saveView({center:t,zoom:e}){localStorage.setItem(this.viewKey,JSON.stringify({center:t,zoom:e})),this.writeUrlView({center:t,zoom:e})}writeUrlView({center:t,zoom:e}){if(!t)return;let i=`#map=${(+e).toFixed(1)}/${(+t[1]).toFixed(4)}/${(+t[0]).toFixed(4)}`;history.replaceState(history.state,"",location.pathname+location.search+i)}urlView(){let t=location.hash.match(/^#map=([\d.]+)\/(-?[\d.]+)\/(-?[\d.]+)$/);if(!t)return null;let[e,i,n]=[+t[1],+t[2],+t[3]];return Number.isFinite(e)&&Number.isFinite(i)&&Number.isFinite(n)?{center:[n,i],zoom:e}:null}};var St=n0(FT(),1);function $P(){return typeof self<"u"?fetch.bind(self):typeof global<"u"&&global.fetch?global.fetch:null}var lw=class{constructor(){this._apiKey="",this._fetch=$P(),this.tileCacheSize=200}set apiKey(e){this._apiKey=e}get apiKey(){return this._apiKey}set fetch(e){this._fetch=e}get fetch(){return this._fetch}},Kh=new lw,UP={AUTO:{code:null,flag:"auto",name:"Auto",latin:!1,isMode:!0,geocoding:!0},LATIN:{code:"latin",flag:"name:latin",name:"Latin",latin:!0,isMode:!1,geocoding:!1},NON_LATIN:{code:"nonlatin",flag:"name:nonlatin",name:"Non Latin",latin:!1,isMode:!1,geocoding:!1},LOCAL:{code:null,flag:"name",name:"Local",latin:!0,isMode:!1,geocoding:!1}},jP={ALBANIAN:{code:"sq",flag:"name:sq",name:"Albanian",latin:!0,isMode:!1,geocoding:!0},AMHARIC:{code:"am",flag:"name:am",name:"Amharic",latin:!1,isMode:!1,geocoding:!1},ARABIC:{code:"ar",flag:"name:ar",name:"Arabic",latin:!1,isMode:!1,geocoding:!0},ARMENIAN:{code:"hy",flag:"name:hy",name:"Armenian",latin:!1,isMode:!1,geocoding:!0},AZERBAIJANI:{code:"az",flag:"name:az",name:"Azerbaijani",latin:!0,isMode:!1,geocoding:!0},BASQUE:{code:"eu",flag:"name:eu",name:"Basque",latin:!0,isMode:!1,geocoding:!1},BELARUSIAN:{code:"be",flag:"name:be",name:"Belarusian",latin:!1,isMode:!1,geocoding:!0},BENGALI:{code:"bn",flag:"name:bn",name:"Bengali",latin:!0,isMode:!1,geocoding:!1},BOSNIAN:{code:"bs",flag:"name:bs",name:"Bosnian",latin:!0,isMode:!1,geocoding:!0},BRETON:{code:"br",flag:"name:br",name:"Breton",latin:!0,isMode:!1,geocoding:!0},BULGARIAN:{code:"bg",flag:"bg",name:"Bulgarian",latin:!1,isMode:!1,geocoding:!0},CATALAN:{code:"ca",flag:"name:ca",name:"Catalan",latin:!0,isMode:!1,geocoding:!0},CHINESE:{code:"zh",flag:"name:zh",name:"Chinese",latin:!1,isMode:!1,geocoding:!0},TRADITIONAL_CHINESE:{code:"zh-Hant",flag:"name:zh-Hant",name:"Chinese (traditional)",latin:!1,isMode:!1,geocoding:!1},SIMPLIFIED_CHINESE:{code:"zh-Hans",flag:"name:zh-Hans",name:"Chinese (simplified)",latin:!1,isMode:!1,geocoding:!1},CORSICAN:{code:"co",flag:"name:co",name:"Corsican",latin:!0,isMode:!1,geocoding:!1},CROATIAN:{code:"hr",flag:"name:hr",name:"Croatian",latin:!0,isMode:!1,geocoding:!0},CZECH:{code:"cs",flag:"name:cs",name:"Czech",latin:!0,isMode:!1,geocoding:!0},DANISH:{code:"da",flag:"name:da",name:"Danish",latin:!0,isMode:!1,geocoding:!0},DUTCH:{code:"nl",flag:"name:nl",name:"Dutch",latin:!0,isMode:!1,geocoding:!0},GERMAN:{code:"de",flag:"name:de",name:"German",latin:!0,isMode:!1,geocoding:!0},GREEK:{code:"el",flag:"name:el",name:"Greek",latin:!1,isMode:!1,geocoding:!0},ENGLISH:{code:"en",flag:"name:en",name:"English",latin:!0,isMode:!1,geocoding:!0},ESPERANTO:{code:"eo",flag:"name:eo",name:"Esperanto",latin:!0,isMode:!1,geocoding:!0}
722,ESTONIAN:{code:"et",flag:"name:et",name:"Estonian",latin:!0,isMode:!1,geocoding:!0},FINNISH:{code:"fi",flag:"name:fi",name:"Finnish",latin:!0,isMode:!1,geocoding:!0},FRENCH:{code:"fr",flag:"name:fr",name:"French",latin:!0,isMode:!1,geocoding:!0},FRISIAN:{code:"fy",flag:"name:fy",name:"Frisian (West)",latin:!0,isMode:!1,geocoding:!0},GEORGIAN:{code:"ka",flag:"name:ka",name:"Georgian",latin:!1,isMode:!1,geocoding:!0},HEBREW:{code:"he",flag:"name:he",name:"Hebrew",latin:!1,isMode:!1,geocoding:!0},HINDI:{code:"hi",flag:"name:hi",name:"Hindi",latin:!1,isMode:!1,geocoding:!1},HUNGARIAN:{code:"hu",flag:"name:hu",name:"Hungarian",latin:!0,isMode:!1,geocoding:!0},ICELANDIC:{code:"is",flag:"name:is",name:"Icelandic",latin:!0,isMode:!1,geocoding:!0},INDONESIAN:{code:"id",flag:"name:id",name:"Indonesian",latin:!0,isMode:!1,geocoding:!1},IRISH:{code:"ga",flag:"name:ga",name:"Irish",latin:!0,isMode:!1,geocoding:!0},ITALIAN:{code:"it",flag:"name:it",name:"Italian",latin:!0,isMode:!1,geocoding:!0},JAPANESE:{code:"ja",flag:"name:ja",name:"Japanese",latin:!1,isMode:!1,geocoding:!0},JAPANESE_HIRAGANA:{code:"ja-Hira",flag:"name:ja-Hira",name:"Japanese Hiragana form",latin:!1,isMode:!1,geocoding:!1},JAPANESE_2018:{code:"ja-Latn",flag:"name:ja-Latn",name:"Japanese (Latin 2018)",latin:!0,isMode:!1,geocoding:!1},JAPANESE_KANA:{code:"ja_kana",flag:"name:ja_kana",name:"Japanese (Kana)",latin:!1,isMode:!1,geocoding:!1},JAPANESE_LATIN:{code:"ja_rm",flag:"name:ja_rm",name:"Japanese (Latin script)",latin:!0,isMode:!1,geocoding:!1},KANNADA:{code:"kn",flag:"name:kn",name:"Kannada",latin:!0,isMode:!1,geocoding:!0},KAZAKH:{code:"kk",flag:"name:kk",name:"Kazakh",latin:!1,isMode:!1,geocoding:!0},KOREAN:{code:"ko",flag:"name:ko",name:"Korean",latin:!1,isMode:!1,geocoding:!0},KOREAN_LATIN:{code:"ko-Latn",flag:"name:ko-Latn",name:"Korean (Latin script)",latin:!0,isMode:!1,geocoding:!1},KURDISH:{code:"ku",flag:"name:ku",name:"Kurdish",latin:!0,isMode:!1,geocoding:!1},CLASSICAL_LATIN:{code:"la",flag:"name:la",name:"Latin",latin:!0,isMode:!1,geocoding:!0},LATVIAN:{code:"lv",flag:"name:lv",name:"Latvian",latin:!0,isMode:!1,geocoding:!0},LITHUANIAN:{code:"lt",flag:"name:lt",name:"Lithuanian",latin:!0,isMode:!1,geocoding:!0},LUXEMBOURGISH:{code:"lb",flag:"name:lb",name:"Luxembourgish",latin:!0,isMode:!1,geocoding:!0},MACEDONIAN:{code:"mk",flag:"name:mk",name:"Macedonian",latin:!1,isMode:!1,geocoding:!0},MALAYALAM:{code:"ml",flag:"name:ml",name:"Malayalam",latin:!1,isMode:!1,geocoding:!1},MALTESE:{code:"mt",flag:"name:mt",name:"Maltese",latin:!0,isMode:!1,geocoding:!0},NORWEGIAN:{code:"no",flag:"name:no",name:"Norwegian",latin:!0,isMode:!1,geocoding:!0},OCCITAN:{code:"oc",flag:"name:oc",name:"Occitan",latin:!0,isMode:!1,geocoding:!1},PERSIAN:{code:"fa",flag:"name:fa",name:"Persian",latin:!1,isMode:!1,geocoding:!1},POLISH:{code:"pl",flag:"name:pl",name:"Polish",latin:!0,isMode:!1,geocoding:!0},PORTUGUESE:{code:"pt",flag:"name:pt",name:"Portuguese",latin:!0,isMode:!1,geocoding:!0},PUNJABI:{code:"pa",flag:"name:pa",name:"Punjabi",latin:!1,isMode:!1,geocoding:!1},WESTERN_PUNJABI:{code:"pnb",flag:"name:pnb",name:"Western Punjabi",latin:!1,isMode:!1,geocoding:!1},ROMANIAN:{code:"ro",flag:"name:ro",name:"Romanian",latin:!0,isMode:!1,geocoding:!0},ROMANSH:{code:"rm",flag:"name:rm",name:"Romansh",latin:!0,isMode:!1,geocoding:!0},RUSSIAN:{code:"ru",flag:"name:ru",name:"Russian",latin:!1,isMode:!1,geocoding:!0},SERBIAN_CYRILLIC:{code:"sr",flag:"name:sr",name:"Serbian (Cyrillic script)",latin:!1,isMode:!1,geocoding:!0},SERBIAN_LATIN:{code:"sr-Latn",flag:"name:sr-Latn",name:"Serbian (Latin script)",latin:!0,isMode:!1,geocoding:!1},SCOTTISH_GAELIC:{code:"gd",flag:"name:gd",name:"Scottish Gaelic",latin:!0,isMode:!1,geocoding:!0},SLOVAK:{code:"sk",flag:"name:sk",name:"Slovak",latin:!0,isMode:!1,geocoding:!0},SLOVENE:{code:"sl",flag:"name:sl",name:"Slovene",latin:!0,isMode:!1,geocoding:!0},SPANISH:{code:"es",flag:"name:es",name:"Spanish",latin:!0,isMode:!1,geocoding:!0},SWEDISH:{code:"sv",flag:"name:sv",name:"Swedish",latin:!0,isMode:!1,geocoding:!0},TAMIL:{code:"ta",flag:"name:ta",name:"Tamil",latin:!1,isMode:!1,geocoding:!1},TELUGU:{code:"te",flag:"name:te",name:"Telugu",latin:!1,isMode:!1,geocoding:!1},THAI:{code:"th",flag:"name:th",name:"Thai",latin:!1,isMode:!1,geocoding:!0},TURKISH:{code:"tr",flag:"name:tr",name:"Turkish",latin:!0,isMode:!1,geocoding:!0},UKRAINIAN:{code:"uk",flag:"name:uk",name:"Ukrainian",latin:!1,isMode:!1,geocoding:!0},VIETNAMESE:{code:"vi",flag:"name:vi",name:"Vietnamese (Latin script)",latin:!0,isMode:!1,geocoding:!1},WELSH:{code:"cy",flag:"name:cy",name:"Welsh",latin:!0,isMode:!1,geocoding:!0}},$p={...UP,...jP};function NT(t,e=$p){return t in e?t[t]:null}function Nm(t,e=$p){for(let i of Object.values(e))if(i.code===t)return i;return null}function Bm(t,e=$p){for(let i of Object.values(e))if(i.flag===t)return i;return null}function VT(t){return t!==null&&typeof t=="object"&&"code"in t&&"flag"in t&&"name"in t&&"latin"in t&&"isMode"in t&&"geocoding"in t&&(typeof t.code=="string"||t.code===null)&&typeof t.flag=="string"&&typeof t.name=="string"&&typeof t.latin=="boolean"&&typeof t.isMode=="boolean"&&typeof t.geocoding=="boolean"}function $0(t,e=$p){return VT(t)?Bm(t.flag,e):typeof t!="string"?null:NT(t,e)||Nm(t,e)||Bm(t,e)||null}async function qP(t,e={}){if(Kh.fetch===null)throw new Error("The fetch function was not found. If on NodeJS < 18 please specify the fetch function with config.fetch");
722if(new URL(t).searchParams.get("key").trim()==="")throw new Error("The MapTiler Cloud API key is missing. Set it in `config.apiKey` or get one for free at https://maptiler.com");return Kh.fetch(t,e)}var $T={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze($T);var V0=class extends Error{constructor(e,i=""){super(`Call to enpoint ${e.url} failed with the status code ${e.status}. ${i}`),this.res=e}};var BT={403:"Key is missing, invalid or restricted"};async function HP(t={}){let e=new URL("geolocation/ip.json",$T.maptilerApiURL);e.searchParams.set("key",t.apiKey??Kh.apiKey);let i=e.toString(),n=await qP(i);if(!n.ok)throw new V0(n,n.status in BT?BT[n.status]:"");return await n.json()}var U0={info:HP};function j0(t){let e=/^maptiler:\/\/(.*)/,i,n=t.trim(),a;return n.startsWith("http://")||n.startsWith("https://")?a=n:(i=e.exec(n))!==null?a=`https://api.maptiler.com/maps/${i[1]}/style.json`:a=`https://api.maptiler.com/maps/${n}/style.json`,a}var Np=class{constructor(e,i,n,a,r,h){this.name=e,this.variantType=i,this.id=n,this.referenceStyle=a,this.description=r,this.imageURL=h}getName(){return this.name}getFullName(){return`${this.referenceStyle.getName()} ${this.name}`}getType(){return this.variantType}getId(){return this.id}getDescription(){return this.description}getReferenceStyle(){return this.referenceStyle}hasVariant(e){return this.referenceStyle.hasVariant(e)}getVariant(e){return this.referenceStyle.getVariant(e)}getVariants(){return this.referenceStyle.getVariants().filter(e=>e!==this)}getImageURL(){return this.imageURL}getExpandedStyleURL(){return j0(this.getId())}},Vp=class{constructor(e,i){this.name=e,this.id=i,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(e){this.variants[e.getType()]=e,this.orderedVariants.push(e)}hasVariant(e){return e in this.variants}getVariant(e){return e in this.variants?this.variants[e]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0]}},Xh=[{referenceStyleID:"STREETS",name:"Streets",description:"",variants:[{id:"streets-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"streets-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"streets-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"streets-v2-night",name:"Night",variantType:"NIGHT",description:"",imageURL:""},{id:"streets-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"outdoor-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"WINTER",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"winter-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE",name:"Satellite",description:"",variants:[{id:"satellite",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"HYBRID",name:"Hybrid",description:"",variants:[{id:"hybrid",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"BASIC",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"basic-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"basic-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BRIGHT",name:"Bright",description:"",variants:[{id:"bright-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"bright-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"bright-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"bright-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OPENSTREETMAP",name:"OpenStreetMap",description:"",variants:[{id:"openstreetmap",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"TOPO",name:"Topo",description:"",variants:[{id:"topo-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}
722,{id:"topo-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"topo-v2-shiny",name:"Shiny",variantType:"SHINY",description:"",imageURL:""},{id:"topo-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"topo-v2-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:""}]},{referenceStyleID:"VOYAGER",name:"Voyager",description:"",variants:[{id:"voyager-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"voyager-v2-darkmatter",name:"Darkmatter",variantType:"DARK",description:"",imageURL:""},{id:"voyager-v2-positron",name:"Positron",variantType:"LIGHT",description:"",imageURL:""},{id:"voyager-v2-vintage",name:"Vintage",variantType:"VINTAGE",description:"",imageURL:""}]},{referenceStyleID:"TONER",name:"Toner",description:"",variants:[{id:"toner-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"toner-v2-background",name:"Background",variantType:"BACKGROUND",description:"",imageURL:""},{id:"toner-v2-lite",name:"Lite",variantType:"LITE",description:"",imageURL:""},{id:"toner-v2-lines",name:"Lines",variantType:"LINES",description:"",imageURL:""}]},{referenceStyleID:"DATAVIZ",name:"Dataviz",description:"",variants:[{id:"dataviz",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"dataviz-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"dataviz-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BACKDROP",name:"Backdrop",description:"",variants:[{id:"backdrop",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"backdrop-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"backdrop-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OCEAN",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]}];function WP(t){return new Proxy(t,{get(e,i,n){return e.hasVariant(i)?e.getVariant(i):i.toString().toUpperCase()===i?t.getDefaultVariant():Reflect.get(e,i,n)}})}function GP(){let t={};for(let e=0;e<Xh.length;e+=1){let i=Xh[e],n=WP(new Vp(i.name,i.referenceStyleID));for(let a=0;a<i.variants.length;a+=1){let r=i.variants[a],h=new Np(r.name,r.variantType,r.id,n,r.description,r.imageURL);n.addVariant(h)}t[i.referenceStyleID]=n}return t}var Yh=GP();var ZP=63710088e-1,N6=2*Math.PI*ZP;var uC=n0(JT(),1);var W0,tD=new Uint8Array(16);function uw(){if(!W0&&(W0=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!W0))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return W0(tD)}var Kr=[];for(let t=0;t<256;++t)Kr.push((t+256).toString(16).slice(1));function QT(t,e=0){return Kr[t[e+0]]+Kr[t[e+1]]+Kr[t[e+2]]+Kr[t[e+3]]+"-"+Kr[t[e+4]]+Kr[t[e+5]]+"-"+Kr[t[e+6]]+Kr[t[e+7]]+"-"+Kr[t[e+8]]+Kr[t[e+9]]+"-"+Kr[t[e+10]]+Kr[t[e+11]]+Kr[t[e+12]]+Kr[t[e+13]]+Kr[t[e+14]]+Kr[t[e+15]]}var iD=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),hw={randomUUID:iD};function nD(t,e,i){if(hw.randomUUID&&!e&&!t)return hw.randomUUID();t=t||{};let n=t.random||(t.rng||uw)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){i=i||0;for(let a=0;a<16;++a)e[i+a]=n[a];return e}return QT(n)}var dw=nD;var sk="3.7.7",rD=sk,qp=typeof Buffer=="function",ek=typeof TextDecoder=="function"?new TextDecoder:void 0,tk=typeof TextEncoder=="function"?new TextEncoder:void 0,sD="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Vm=Array.prototype.slice.call(sD),G0=(t=>{let e={};return t.forEach((i,n)=>e[i]=n),e})(Vm),oD=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Xr=String.fromCharCode.bind(String),ik=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),ok=t=>t.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),ak=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),lk=t=>{let e,i,n,a,r="",h=t.length%3;for(let m=0;m<t.length;){if((i=t.charCodeAt(m++))>255||(n=t.charCodeAt(m++))>255||(a=t.charCodeAt(m++))>255)throw new TypeError("invalid character found");e=i<<16|n<<8|a,r+=Vm[e>>18&63]+Vm[e>>12&63]+Vm[e>>6&63]+Vm[e&63]}return h?r.slice(0,h-3)+"===".substring(h):r},mw=typeof btoa=="function"?t=>btoa(t):qp?t=>Buffer.from(t,"binary").toString("base64"):lk,pw=qp?t=>Buffer.from(t).toString("base64"):t=>{let i=[];for(let n=0,a=t.length;n<a;n+=4096)i.push(Xr.apply(null,t.subarray(n,n+4096)));return mw(i.join(""))},Z0=(t,e=!1)=>e?ok(pw(t)):pw(t),aD=t=>{if(t.length<2){var e=t.charCodeAt(0);return e<128?t:e<2048?Xr(192|e>>>6)+Xr(128|e&63):Xr(224|e>>>12&15)+Xr(128|e>>>6&63)+Xr(128|e&63)}else{var e=65536+(t.charCodeAt(0)-55296)*1024+(t.charCodeAt(1)-56320);return Xr(240|e>>>18&7)+Xr(128|e>>>12&63)+Xr(128|e>>>6&63)+Xr(128|e&63)}},lD=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,ck=t=>t.replace(lD,aD),nk=qp?t=>Buffer.from(t,"utf8").toString("base64"):tk?t=>pw(tk.encode(t)):t=>mw(ck(t)),jp=(t,e=!1)=>e?ok(nk(t)):nk(t),rk=t=>jp(t,!0),cD=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,uD=t=>{switch(t.length){case 4:var e=(7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3),i=e-65536;return Xr((i>>>10)+55296)+Xr((i&1023)+56320);case 3:return Xr((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return Xr((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},uk=t=>t.replace(cD,uD),hk=t=>
722{if(t=t.replace(/\s+/g,""),!oD.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(t.length&3));let e,i="",n,a;for(let r=0;r<t.length;)e=G0[t.charAt(r++)]<<18|G0[t.charAt(r++)]<<12|(n=G0[t.charAt(r++)])<<6|(a=G0[t.charAt(r++)]),i+=n===64?Xr(e>>16&255):a===64?Xr(e>>16&255,e>>8&255):Xr(e>>16&255,e>>8&255,e&255);return i},gw=typeof atob=="function"?t=>atob(ak(t)):qp?t=>Buffer.from(t,"base64").toString("binary"):hk,dk=qp?t=>ik(Buffer.from(t,"base64")):t=>ik(gw(t).split("").map(e=>e.charCodeAt(0))),pk=t=>dk(fk(t)),hD=qp?t=>Buffer.from(t,"base64").toString("utf8"):ek?t=>ek.decode(dk(t)):t=>uk(gw(t)),fk=t=>ak(t.replace(/[-_]/g,e=>e=="-"?"+":"/")),fw=t=>hD(fk(t)),dD=t=>{if(typeof t!="string")return!1;let e=t.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},mk=t=>({value:t,enumerable:!1,writable:!0,configurable:!0}),gk=function(){let t=(e,i)=>Object.defineProperty(String.prototype,e,mk(i));t("fromBase64",function(){return fw(this)}),t("toBase64",function(e){return jp(this,e)}),t("toBase64URI",function(){return jp(this,!0)}),t("toBase64URL",function(){return jp(this,!0)}),t("toUint8Array",function(){return pk(this)})},yk=function(){let t=(e,i)=>Object.defineProperty(Uint8Array.prototype,e,mk(i));t("toBase64",function(e){return Z0(this,e)}),t("toBase64URI",function(){return Z0(this,!0)}),t("toBase64URL",function(){return Z0(this,!0)})},pD=()=>{gk(),yk()},_k={version:sk,VERSION:rD,atob:gw,atobPolyfill:hk,btoa:mw,btoaPolyfill:lk,fromBase64:fw,toBase64:jp,encode:jp,encodeURI:rk,encodeURL:rk,utob:ck,btou:uk,decode:fw,isValid:dD,fromUint8Array:Z0,toUint8Array:pk,extendString:gk,extendUint8Array:yk,extendBuiltins:pD};var fD=Object.defineProperty,cC=t=>{throw TypeError(t)},mD=(t,e,i)=>e in t?fD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Bi=(t,e,i)=>mD(t,typeof e!="symbol"?e+"":e,i),eS=(t,e,i)=>e.has(t)||cC("Cannot "+i),Ai=(t,e,i)=>(eS(t,e,"read from private field"),i?i.call(t):e.get(t)),Jh=(t,e,i)=>e.has(t)?cC("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),Hp=(t,e,i,n)=>(eS(t,e,"write to private field"),n?n.call(t,i):e.set(t,i),i),Mo=(t,e,i)=>(eS(t,e,"access private method"),i);var Li={VISITOR:{code:null,flag:"visitor",name:"Visitor",latin:!0,isMode:!0,geocoding:!1},VISITOR_ENGLISH:{code:null,flag:"visitor_en",name:"Visitor English",latin:!0,isMode:!0,geocoding:!1},STYLE:{code:null,flag:"style",name:"Style",latin:!1,isMode:!0,geocoding:!1},STYLE_LOCK:{code:null,flag:"style_lock",name:"Style Lock",latin:!1,isMode:!0,geocoding:!1},...$p};function vk(){if(typeof navigator>"u"){let t=Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];return Nm(t)||Li.ENGLISH}return Array.from(new Set(navigator.languages.map(t=>t.split("-")[0]))).map(t=>Nm(t)).filter(t=>t)[0]??Li.LOCAL}var io={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:Li.STYLE,secondaryLanguage:Li.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(io);var hC=dw(),Cw=class extends uC.default{constructor(){super(...arguments),Bi(this,"primaryLanguage",io.primaryLanguage),Bi(this,"secondaryLanguage"),Bi(this,"session",!0),Bi(this,"caching",!0),Bi(this,"_unit","metric"),Bi(this,"_apiKey","")}set unit(e){this._unit=e,this.emit("unit",e)}get unit(){return this._unit}set apiKey(e){this._apiKey=e,Kh.apiKey=e,this.emit("apiKey",e)}get apiKey(){return this._apiKey}set fetch(e){Kh.fetch=e}get fetch(){return Kh.fetch}},pr=new Cw,{addProtocol:bk}=St.default,Mw="localcache_source",Aw="localcache",gD="maptiler_sdk",yD=1e3,_D=100,Ew=typeof caches<"u";function vD(t,e){if(Ew&&pr.caching&&pr.session&&t.host===io.maptilerApiHost){if(e==="Source"&&t.href.includes("tiles.json"))return t.href.replace("https://",`${Mw}://`);if(e==="Tile"||e==="Glyphs")return t.href.replace("https://",`${Aw}://`)}return t.href}var yw;async function dC(){return yw||(yw=await caches.open(gD)),yw}var xk=0;async function bD(){let t=await dC(),e=await t.keys(),i=e.slice(0,Math.max(e.length-yD,0));for(let n of i)t.delete(n)}function xD(){bk(Mw,async(t,e)=>{if(!t.url)throw new Error("");t.url=t.url.replace(`${Mw}://`,"https://");let i=t;i.signal=e.signal;let n=await fetch(t.url,i),a=await n.json();return a.tiles&&a.tiles.length>0&&(a.tiles[0]+=`&last-modified=${n.headers.get("Last-Modified")}`),{data:a,cacheControl:n.headers.get("Cache-Control"),expires:n.headers.get("Expires")}}),bk(Aw,async(t,e)=>{if(!t.url)throw new Error("");t.url=t.url.replace(`${Aw}://`,"https://");let i=new URL(t.url),n=new URL(i);n.searchParams.delete("mtsid"),n.searchParams.delete("key");
722let a=n.toString(),r=new URL(i);r.searchParams.delete("last-modified");let h=r.toString(),m=async F=>({data:await F.arrayBuffer(),cacheControl:F.headers.get("Cache-Control"),expires:F.headers.get("Expires")}),b=await dC(),T=await b.match(a);if(T)return m(T);let k=t;k.signal=e.signal;let P=await fetch(h,k);return P.status>=200&&P.status<300&&(b.put(a,P.clone()).catch(()=>{}),++xk>_D&&(bD(),xk=0)),m(P)})}function wD(){if(typeof window>"u")return;let t=St.default.getRTLTextPluginStatus();if(t==="unavailable"||t==="requested")try{St.default.setRTLTextPlugin(io.rtlPluginURL,!0)}catch{}}function SD(t,e){for(let i of t)typeof e[i]=="function"&&(e[i]=e[i].bind(e))}function Zp(t,e,i){let n=window.document.createElement(t);return e!==void 0&&(n.className=e),i&&i.appendChild(n),n}function pC(t){t.parentNode&&t.parentNode.removeChild(t)}function wk(t,e){let i=null;try{i=new URL(t)}catch{return{url:t}}return i.host===io.maptilerApiHost&&(i.searchParams.has("key")||i.searchParams.append("key",pr.apiKey),pr.session&&i.searchParams.append("mtsid",hC)),{url:vD(i,e)}}function Sk(t){return(e,i)=>{if(t!=null){let n=t(e,i),a=wk(n?.url??"",i);return{...n,...a}}return wk(e,i)}}function TD(){return document.createElement("canvas").getContext("webgl2")?null:typeof WebGL2RenderingContext<"u"?"Graphic rendering with WebGL2 has been disabled or is not supported by your graphic card. The map cannot be displayed.":"Your browser does not support graphic rendering with WebGL2. The map cannot be displayed."}function kD(t){let e=TD();if(!e)return;let i=null;if(typeof t=="string"?i=document.getElementById(t):t instanceof HTMLElement&&(i=t),!i)throw new Error("The Map container must be provided.");let n=document.createElement("div");throw n.innerHTML=e,n.classList.add("webgl-warning-div"),i.appendChild(n),new Error(e)}function CD(t){let e="The WebGL context was lost.",i=null;if(typeof t=="string"?i=document.getElementById(t):t instanceof HTMLElement&&(i=t),!i)throw new Error("The Map container must be provided.");let n=document.createElement("div");n.innerHTML=e,n.classList.add("webgl-warning-div"),i.appendChild(n)}function Tk(t,e){return!(!Array.isArray(t)||t.length!==2||t[0]!=="get"||typeof t[1]!="string"||e&&!t[1].startsWith("name:")||!e&&t[1]!=="name")}function MD(t,e,i){let n=structuredClone(t),a=r=>{if(typeof r!="string")for(let h=0;h<r.length;h+=1)Tk(r[h],i)?r[h]=structuredClone(e):a(r[h])};return Tk(n,i)?e:(a(n),n)}function AD(t,e){let i=e?/\{name:\S+\}/:/\{name\}/;return{contains:i.test(t),exactMatch:new RegExp(`^${i.source}$`).test(t)}}function ED(t,e,i){let n=i?/\{name:\S+\}/:/\{name\}/,a=t.split(n);return["concat",...a.flatMap((r,h)=>h===a.length-1?[r]:[r,e])]}function ID(t){var e;let i=/\{name(?:\:(?<language>\S+))?\}/g,n=[];for(;;){let a=i.exec(t);if(!a)break;let r=((e=a.groups)==null?void 0:e.language)??null;n.push(r)}return n}function LD(t){return!Array.isArray(t)||t.length!==2||t[0]!=="get"||typeof t[1]!="string"?null:t[1].trim()==="name"?{isLanguage:!0,localization:null}:t[1].trim().startsWith("name:")?{isLanguage:!0,localization:t[1].trim().split(":").pop()}:null}function PD(t){let e=[],i=structuredClone(t),n=a=>{if(typeof a!="string")for(let r=0;r<a.length;r+=1){let h=LD(a[r]);h?e.push(h.localization):n(a[r])}};return n([i]),e}function DD(t,e){let i=[];for(let r of t){if(r.type!=="symbol")continue;let h=r,{id:m,layout:b}=h;if(!b||!("text-field"in b))continue;let T=e.getLayoutProperty(m,"text-field");if(T)if(typeof T=="string"){let k=ID(T);i.push(k)}else{let k=PD(T);i.push(k)}}let n=i.flat(),a={unlocalized:0,localized:{}};for(let r of n)r===null?a.unlocalized+=1:(r in a.localized||(a.localized[r]=0),a.localized[r]+=1);return a}var ld=class extends St.default.Marker{addTo(t){return super.addTo(t)}},t_=class extends St.default.Popup{addTo(e){return super.addTo(e)}},kk=class extends St.default.Style{constructor(e,i={}){super(e,i)}},Ck=class extends St.default.CanvasSource{onAdd(e){super.onAdd(e)}},Mk=class extends St.default.GeoJSONSource{onAdd(e){super.onAdd(e)}},Ak=class extends St.default.ImageSource{onAdd(e){super.onAdd(e)}},Ek=class extends St.default.RasterTileSource{onAdd(e){super.onAdd(e)}},Ik=class extends St.default.RasterDEMTileSource{onAdd(e){super.onAdd(e)}},Lk=class extends St.default.VectorTileSource{onAdd(e){super.onAdd(e)}},Pk=class extends St.default.VideoSource{onAdd(e){super.onAdd(e)}},Hm=class extends St.default.NavigationControl{onAdd(e){return super.onAdd(e)}},Wm=class extends St.default.GeolocateControl{onAdd(e){return super.onAdd(e)}},Dk=class extends St.default.AttributionControl{onAdd(e){return super.onAdd(e)}},Iw=class extends St.default.LogoControl{onAdd(e){return super.onAdd(e)}},Lw=class extends St.default.ScaleControl{onAdd(e){return super.onAdd(e)}},Pw=class extends St.default.FullscreenControl{onAdd(e){return super.onAdd(e)}},Rk=class extends St.default.TerrainControl{onAdd(e){return super.onAdd(e)}},zk=class extends St.default.BoxZoomHandler{constructor(e,i){super(e,i)}},Ok=class extends St.default.ScrollZoomHandler{constructor(e,i){super(e,i)}},Fk=class extends St.default.CooperativeGesturesHandler{constructor(e,i){super(e,i)}},Bk=class extends St.default.KeyboardHandler{constructor(e){super(e)}},Nk=class extends St.default.TwoFingersTouchPitchHandler{constructor(e){super(e)}},Vk=class extends St.default.MapWheelEvent{constructor(e,i,n){super(e,i,n)}},$k=class extends St.default.MapTouchEvent{constructor(e,i,n){super(e,i,n)}},Uk=class extends St.default.MapMouseEvent{constructor(e,i,n,a={}){super(e,i,n,a)}},i_=class extends Iw{constructor(e={}){super(e),Bi(this,"logoURL",""),Bi(this,"linkURL",""),this.logoURL=e.logoURL??io.maptilerLogoURL,this.linkURL=e.linkURL??io.maptilerURL}onAdd(e){this._map=e,this._compact=this.options.compact??!1,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";let i=window.document.createElement("a");return i.style.backgroundRepeat="no-repeat",i.style.cursor="pointer",i.style.display="block",i.style.height="23px",i.style.margin="0 0 -4px -4px",i.style.overflow="hidden",i.style.width="88px",i.style.backgroundImage=`url(${this.logoURL}
722)`,i.style.backgroundSize="100px 30px",i.style.width="100px",i.style.height="30px",i.target="_blank",i.rel="noopener",i.href=this.linkURL,i.setAttribute("aria-label","MapTiler logo"),i.setAttribute("rel","noopener"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}},RD=8,zD={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},OD={"*":{type:"source"}},FD=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],BD={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},ND={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},VD={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},$D={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},UD={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},jD={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},qD={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},HD=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],WD={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},GD={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ZD={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},KD={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},XD={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{}
vendor: 20,966 bytes, line 722
722,miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},YD={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},JD={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},QD={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},eR={type:"array",value:"*"},tR={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},iR={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},nR={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},rR={type:"array",value:"*",minimum:1},sR={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},oR={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},aR={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},lR={type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},cR=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],uR={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},hR={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},dR={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},pR={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},fR={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},mR={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}
722,"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},gR={"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},yR={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},_R={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},vR={"*":{type:"string"}},bR={$version:RD,$root:zD,sources:OD,source:FD,source_vector:BD,source_raster:ND,source_raster_dem:VD,source_geojson:$D,source_video:UD,source_image:jD,layer:qD,layout:HD,layout_background:WD,layout_fill:GD,layout_circle:ZD,layout_heatmap:KD,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:XD,layout_symbol:YD,layout_raster:JD,layout_hillshade:QD,filter:eR,filter_operator:tR,geometry_type:iR,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:nR,expression:rR,light:sR,sky:oR,terrain:aR,projection:lR,paint:cR,paint_fill:uR,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:hR,paint_circle:dR,paint_heatmap:pR,paint_symbol:fR,paint_raster:mR,paint_hillshade:gR,paint_background:yR,transition:_R,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:vR},ot=class{constructor(e,i,n,a){this.message=(e?`${e}: `:"")+n,a&&(this.identifier=a),i!=null&&i.__line__&&(this.line=i.__line__)}};function n_(t,...e){for(let i of e)for(let n in i)t[n]=i[n];return t}
722var ta=class extends Error{constructor(e,i){super(i),this.message=i,this.key=e}},Dw=class t{constructor(e,i=[]){this.parent=e,this.bindings={};for(let[n,a]of i)this.bindings[n]=a}concat(e){return new t(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},b_={kind:"null"},ut={kind:"number"},mi={kind:"string"},ai={kind:"boolean"},El={kind:"color"},Kp={kind:"object"},li={kind:"value"},xR={kind:"error"},x_={kind:"collator"},w_={kind:"formatted"},S_={kind:"padding"},ng={kind:"resolvedImage"},T_={kind:"variableAnchorOffsetCollection"};function Eo(t,e){return{kind:"array",itemType:t,N:e}}function En(t){if(t.kind==="array"){let e=En(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}else return t.kind}var wR=[b_,ut,mi,ai,El,w_,Kp,Eo(li),S_,ng,T_];function Gm(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Gm(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(let i of wR)if(!Gm(i,e))return null}}return`Expected ${En(t)} but found ${En(e)} instead.`}function tS(t,e){return e.some(i=>i.kind===t.kind)}function nd(t,e){return e.some(i=>i==="null"?t===null:i==="array"?Array.isArray(t):i==="object"?t&&!Array.isArray(t)&&typeof t=="object":i===typeof t)}function $m(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}var fC=.96422,mC=1,gC=.82521,yC=4/29,Xp=6/29,_C=3*Xp*Xp,SR=Xp*Xp*Xp,TR=Math.PI/180,kR=180/Math.PI;function vC(t){return t=t%360,t<0&&(t+=360),t}function bC([t,e,i,n]){t=_w(t),e=_w(e),i=_w(i);let a,r,h=vw((.2225045*t+.7168786*e+.0606169*i)/mC);t===e&&e===i?a=r=h:(a=vw((.4360747*t+.3850649*e+.1430804*i)/fC),r=vw((.0139322*t+.0971045*e+.7141733*i)/gC));let m=116*h-16;return[m<0?0:m,500*(a-h),200*(h-r),n]}function _w(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function vw(t){return t>SR?Math.pow(t,1/3):t/_C+yC}function xC([t,e,i,n]){let a=(t+16)/116,r=isNaN(e)?a:a+e/500,h=isNaN(i)?a:a-i/200;return a=mC*xw(a),r=fC*xw(r),h=gC*xw(h),[bw(3.1338561*r-1.6168667*a-.4906146*h),bw(-.9787684*r+1.9161415*a+.033454*h),bw(.0719453*r-.2289914*a+1.4052427*h),n]}
vendor: 4,212 bytes, line 722
722function bw(t){return t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055,t<0?0:t>1?1:t}function xw(t){return t>Xp?t*t*t:_C*(t-yC)}function CR(t){let[e,i,n,a]=bC(t),r=Math.sqrt(i*i+n*n);return[Math.round(r*1e4)?vC(Math.atan2(n,i)*kR):NaN,r,e,a]}function MR([t,e,i,n]){return t=isNaN(t)?0:t*TR,xC([i,Math.cos(t)*e,Math.sin(t)*e,n])}function AR([t,e,i,n]){t=vC(t),e/=100,i/=100;function a(r){let h=(r+t/30)%12,m=e*Math.min(i,1-i);return i-m*Math.max(-1,Math.min(h-3,9-h,1))}return[a(0),a(8),a(4),n]}function ER(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=IR[t];if(e){let[a,r,h]=e;return[a/255,r/255,h/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let a=t.length<6?1:2,r=1;return[K0(t.slice(r,r+=a)),K0(t.slice(r,r+=a)),K0(t.slice(r,r+=a)),K0(t.slice(r,r+a)||"ff")]}if(t.startsWith("rgb")){let a=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,r=t.match(a);if(r){let[h,m,b,T,k,P,F,U,X,Y,te,le]=r,we=[T||" ",F||" ",Y].join("");if(we==="  "||we==="  /"||we===",,"||we===",,,"){let Le=[b,P,X].join(""),Oe=Le==="%%%"?100:Le===""?255:0;if(Oe){let ze=[Wp(+m/Oe,0,1),Wp(+k/Oe,0,1),Wp(+U/Oe,0,1),te?jk(+te,le):1];if(qk(ze))return ze}}return}}let i=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,n=t.match(i);if(n){let[a,r,h,m,b,T,k,P,F]=n,U=[h||" ",b||" ",k].join("");if(U==="  "||U==="  /"||U===",,"||U===",,,"){let X=[+r,Wp(+m,0,100),Wp(+T,0,100),P?jk(+P,F):1];if(qk(X))return AR(X)}}}function K0(t){return parseInt(t.padEnd(2,t),16)/255}function jk(t,e){return Wp(e?t/100:t,0,1)}function Wp(t,e,i){return Math.min(Math.max(e,t),i)}function qk(t){return!t.some(Number.isNaN)}var IR={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],ol
722ive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Rn=class t{constructor(e,i,n,a=1,r=!0){this.r=e,this.g=i,this.b=n,this.a=a,r||(this.r*=a,this.g*=a,this.b*=a,a||this.overwriteGetter("rgb",[e,i,n,a]))}static parse(e){if(e instanceof t)return e;if(typeof e!="string")return;let i=ER(e);if(i)return new t(...i,!1)}get rgb(){let{r:e,g:i,b:n,a}=this,r=a||1/0;return this.overwriteGetter("rgb",[e/r,i/r,n/r,a])}get hcl(){return this.overwriteGetter("hcl",CR(this.rgb))}get lab(){return this.overwriteGetter("lab",bC(this.rgb))}overwriteGetter(e,i){return Object.defineProperty(this,e,{value:i}),i}toString(){let[e,i,n,a]=this.rgb;return`rgba(${[e,i,n].map(r=>Math.round(r*255)).join(",")},${a})`}};Rn.black=new Rn(0,0,0,1);Rn.white=new Rn(1,1,1,1);Rn.transparent=new Rn(0,0,0,0);Rn.red=new Rn(1,0,0,1);var Zm=class{constructor(e,i,n){e?this.sensitivity=i?"variant":"case":this.sensitivity=i?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}},Km=class{constructor(e,i,n,a,r){this.text=e,this.image=i,this.scale=n,this.fontStack=a,this.textColor=r}},sd=class t{constructor(e){this.sections=e}static fromString(e){return new t([new Km(e,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof t?e:t.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},Lu=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="number")return new t([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let i of e)if(typeof i!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]];break}return new t(e)}}toString(){return JSON.stringify(this.values)}},LR=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Pu=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let i=0;i<e.length;i+=2){let n=e[i],a=e[i+1];if(typeof n!="string"||!LR.has(n)||!Array.isArray(a)||a.length!==2||typeof a[0]!="number"||typeof a[1]!="number")return}return new t(e)}}toString(){return JSON.stringify(this.values)}},Du=class t{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new t({name:e,available:!1}):null}};function wC(t,e,i,n){return typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Xm(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof Rn||t instanceof Zm||t instanceof sd||t instanceof Lu||t instanceof Pu||t instanceof Du)return!0;
722if(Array.isArray(t)){for(let e of t)if(!Xm(e))return!1;return!0}else if(typeof t=="object"){for(let e in t)if(!Xm(t[e]))return!1;return!0}else return!1}function Tr(t){if(t===null)return b_;if(typeof t=="string")return mi;if(typeof t=="boolean")return ai;if(typeof t=="number")return ut;if(t instanceof Rn)return El;if(t instanceof Zm)return x_;if(t instanceof sd)return w_;if(t instanceof Lu)return S_;if(t instanceof Pu)return T_;if(t instanceof Du)return ng;if(Array.isArray(t)){let e=t.length,i;for(let n of t){let a=Tr(n);if(!i)i=a;else{if(i===a)continue;i=li;break}}return Eo(i||li,e)}else return Kp}function Um(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof Rn||t instanceof sd||t instanceof Lu||t instanceof Pu||t instanceof Du?t.toString():JSON.stringify(t)}var Yp=class t{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Xm(e[1]))return i.error("invalid value");let n=e[1],a=Tr(n),r=i.expectedType;return a.kind==="array"&&a.N===0&&r&&r.kind==="array"&&(typeof r.N!="number"||r.N===0)&&(a=r),new t(a,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},Dn=class{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}},X0={string:mi,number:ut,boolean:ai,object:Kp},Fa=class t{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let n=1,a,r=e[0];if(r==="array"){let m;if(e.length>2){let T=e[1];if(typeof T!="string"||!(T in X0)||T==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);m=X0[T],n++}else m=li;let b;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);b=e[2],n++}a=Eo(m,b)}else{if(!X0[r])throw new Error(`Types doesn't contain name = ${r}`);a=X0[r]}let h=[];for(;n<e.length;n++){let m=i.parse(e[n],n,li);if(!m)return null;h.push(m)}return new t(a,h)}evaluate(e){for(let i=0;i<this.args.length;i++){let n=this.args[i].evaluate(e);if(Gm(this.type,Tr(n))){if(i===this.args.length-1)throw new Dn(`Expected value to be of type ${En(this.type)}, but found ${En(Tr(n))} instead.`)}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Hk={"to-boolean":ai,"to-color":El,"to-number":ut,"to-string":mi},Iu=class t{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let n=e[0];if(!Hk[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return i.error("Expected one argument.");let a=Hk[n],r=[];for(let h=1;h<e.length;h++){let m=i.parse(e[h],h,li);if(!m)return null;r.push(m)}return new t(a,r)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let i,n;for(let a of this.args){if(i=a.evaluate(e),n=null,i instanceof Rn)return i;if(typeof i=="string"){let r=e.parseColor(i);if(r)return r}else if(Array.isArray(i)&&(i.length<3||i.length>4?n=`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:n=wC(i[0],i[1],i[2],i[3]),!n))return new Rn(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new Dn(n||`Could not parse color from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"padding":{let i;for(let n of this.args){i=n.evaluate(e);let a=Lu.parse(i);if(a)return a}throw new Dn(`Could not parse padding from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"variableAnchorOffsetCollection":{let i;for(let n of this.args){i=n.evaluate(e);let a=Pu.parse(i);if(a)return a}throw new Dn(`Could not parse variableAnchorOffsetCollection from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"number":{let i=null;for(let n of this.args){if(i=n.evaluate(e),i===null)return 0;let a=Number(i);if(!isNaN(a))return a}throw new Dn(`Could not convert ${JSON.stringify(i)} to number.`)}case"formatted":return sd.fromString(Um(this.args[0].evaluate(e)));case"resolvedImage":return Du.fromString(Um(this.args[0].evaluate(e)));default:return Um(this.args[0].evaluate(e))}}
722eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},PR=["Unknown","Point","LineString","Polygon"],r_=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?PR[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=Rn.parse(e)),i}},s_=class t{constructor(e,i,n=[],a,r=new Dw,h=[]){this.registry=e,this.path=n,this.key=n.map(m=>`[${m}]`).join(""),this.scope=r,this.errors=h,this.expectedType=a,this._isConstant=i}parse(e,i,n,a,r={}){return i?this.concat(i,n,a)._parse(e,r):this._parse(e,r)}_parse(e,i){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function n(a,r,h){return h==="assert"?new Fa(r,[a]):h==="coerce"?new Iu(r,[a]):a}if(Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let a=e[0];if(typeof a!="string")return this.error(`Expression name must be a string, but found ${typeof a} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let r=this.registry[a];if(r){let h=r.parse(e,this);if(!h)return null;if(this.expectedType){let m=this.expectedType,b=h.type;if((m.kind==="string"||m.kind==="number"||m.kind==="boolean"||m.kind==="object"||m.kind==="array")&&b.kind==="value")h=n(h,m,i.typeAnnotation||"assert");else if((m.kind==="color"||m.kind==="formatted"||m.kind==="resolvedImage")&&(b.kind==="value"||b.kind==="string"))h=n(h,m,i.typeAnnotation||"coerce");else if(m.kind==="padding"&&(b.kind==="value"||b.kind==="number"||b.kind==="array"))h=n(h,m,i.typeAnnotation||"coerce");else if(m.kind==="variableAnchorOffsetCollection"&&(b.kind==="value"||b.kind==="array"))h=n(h,m,i.typeAnnotation||"coerce");else if(this.checkSubtype(m,b))return null}if(!(h instanceof Yp)&&h.type.kind!=="resolvedImage"&&this._isConstant(h)){let m=new r_;try{h=new Yp(h.type,h.evaluate(m))}catch(b){return this.error(b.message),null}}return h}return this.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof e>"u"?this.error("'undefined' value invalid. Use null instead."):typeof e=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,i,n){let a=typeof e=="number"?this.path.concat(e):this.path,r=n?this.scope.concat(n):this.scope;return new t(this.registry,this._isConstant,a,i||null,r,this.errors)}error(e,...i){let n=`${this.key}${i.map(a=>`[${a}]`).join("")}`;this.errors.push(new ta(n,e))}checkSubtype(e,i){let n=Gm(e,i);return n&&this.error(n),n}},o_=class t{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let n=[];for(let r=1;r<e.length-1;r+=2){let h=e[r];if(typeof h!="string")return i.error(`Expected string, but found ${typeof h} instead.`,r);if(/[^a-zA-Z0-9_]/.test(h))return i.error("Variable names must contain only alphanumeric characters or '_'.",r);let m=i.parse(e[r+1],r+1);if(!m)return null;n.push([h,m])}let a=i.parse(e[e.length-1],e.length-1,i.expectedType,n);return a?new t(n,a):null}outputDefined(){return this.result.outputDefined()}},a_=class t{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");let n=e[1];return i.scope.has(n)?new t(n,i.scope.get(n)):i.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},Rw=class t{constructor(e,i,n){this.type=e,this.index=i,this.input=n}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=i.parse(e[1],1,ut),a=i.parse(e[2],2,Eo(i.expectedType||li));if(!n||!a)return null;let r=a.type;return new t(r.itemType,n,a)}evaluate(e){let i=this.index.evaluate(e),n=this.input.evaluate(e);if(i<0)throw new Dn(`Array index out of bounds: ${i} < 0.`);if(i>=n.length)throw new Dn(`Array index out of bounds: ${i} > ${n.length-1}.`);if(i!==Math.floor(i))throw new Dn(`Array index must be an integer, but found ${i} instead.`);return n[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},zw=class t{constructor(e,i){this.type=ai,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=i.parse(e[1],1,li),a=i.parse(e[2],2,li);return!n||!a?null:tS(n.type,[ai,mi,ut,b_,li])?new t(n,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${En(n.type)} instead`)}evaluate(e){let i=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!nd(i,["boolean","string","number","null"]))throw new Dn(`Expected first argument to be of type boolean, string, number or null, but found ${En(Tr(i))} instead.`);if(!nd(n,["string","array"]))throw new Dn(`Expected second argument to be of type array or string, but found ${En(Tr(n))} instead.`);return n.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},Ow=class t{constructor(e,i,n){this.type=ut,this.needle=e,this.haystack=i,this.fromIndex=n}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=i.parse(e[1],1,li),a=i.parse(e[2],2,li);if(!n||!a)return null;if(!tS(n.type,[ai,mi,ut,b_,li]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${En(n.type)} instead`);if(e.length===4){let r=i.parse(e[3],3,ut);return r?new t(n,a,r):null}else return new t(n,a)}evaluate(e){let i=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!nd(i,["boolean","string","number","null"]))throw new Dn(`Expected first argument to be of type boolean, string, number or null, but found ${En(Tr(i))} instead.`);let a;if(this.fromIndex&&(a=this.fromIndex.evaluate(e)),nd(n,["string"])){let r=n.indexOf(i,a);return r===-1?-1:[...n.slice(0,r)].length}else{if(nd(n,["array"]))return n.indexOf(i,a);throw new Dn(`Expected second argument to be of type array or string, but found ${En(Tr(n))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},Fw=class t{constructor(e,i,n,a,r,h){this.inputType=e,this.type=i,this.input=n,this.cases=a,this.outputs=r,this.otherwise=h}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!==1)return i.error("Expected an even number of arguments.");let n,a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);let r={},h=[];for(let T=2;T<e.length-1;T+=2){let k=e[T],P=e[T+1];Array.isArray(k)||(k=[k]);let F=i.concat(T);if(k.length===0)return F.error("Expected at least one branch label.");for(let X of k){if(typeof X!="number"&&typeof X!="string")return F.error("Branch labels must be numbers or strings.");if(typeof X=="number"&&Math.abs(X)>Number.MAX_SAFE_INTEGER)return F.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof X=="number"&&Math.floor(X)!==X)return F.error("Numeric branch labels must be integer values.");if(!n)n=Tr(X);else if(F.checkSubtype(n,Tr(X)))return null;if(typeof r[String(X)]<"u")return F.error("Branch labels must be unique.");r[String(X)]=h.length}let U=i.parse(P,T,a);if(!U)return null;a=a||U.type,h.push(U)}let m=i.parse(e[1],1,li);if(!m)return null;let b=i.parse(e[e.length-1],e.length-1,a);return!b||m.type.kind!=="value"&&i.concat(1).checkSubtype(n,m.type)?null:new t(n,a,m,r,h,b)}evaluate(e){let i=this.input.evaluate(e);return(Tr(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}
722eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},Bw=class t{constructor(e,i,n){this.type=e,this.branches=i,this.otherwise=n}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!==0)return i.error("Expected an odd number of arguments.");let n;i.expectedType&&i.expectedType.kind!=="value"&&(n=i.expectedType);let a=[];for(let h=1;h<e.length-1;h+=2){let m=i.parse(e[h],h,ai);if(!m)return null;let b=i.parse(e[h+1],h+1,n);if(!b)return null;a.push([m,b]),n=n||b.type}let r=i.parse(e[e.length-1],e.length-1,n);if(!r)return null;if(!n)throw new Error("Can't infer output type");return new t(n,a,r)}evaluate(e){for(let[i,n]of this.branches)if(i.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[i,n]of this.branches)e(i),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,i])=>i.outputDefined())&&this.otherwise.outputDefined()}},Nw=class t{constructor(e,i,n,a){this.type=e,this.input=i,this.beginIndex=n,this.endIndex=a}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=i.parse(e[1],1,li),a=i.parse(e[2],2,ut);if(!n||!a)return null;if(!tS(n.type,[Eo(li),mi,li]))return i.error(`Expected first argument to be of type array or string, but found ${En(n.type)} instead`);if(e.length===4){let r=i.parse(e[3],3,ut);return r?new t(n.type,n,a,r):null}else return new t(n.type,n,a)}evaluate(e){let i=this.input.evaluate(e),n=this.beginIndex.evaluate(e),a;if(this.endIndex&&(a=this.endIndex.evaluate(e)),nd(i,["string"]))return[...i].slice(n,a).join("");if(nd(i,["array"]))return i.slice(n,a);throw new Dn(`Expected first argument to be of type array or string, but found ${En(Tr(i))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function SC(t,e){let i=t.length-1,n=0,a=i,r=0,h,m;for(;n<=a;)if(r=Math.floor((n+a)/2),h=t[r],m=t[r+1],h<=e){if(r===i||e<m)return r;n=r+1}else if(h>e)a=r-1;else throw new Dn("Input is not a number.");return 0}var l_=class t{constructor(e,i,n){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(let[a,r]of n)this.labels.push(a),this.outputs.push(r)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return i.error("Expected an even number of arguments.");let n=i.parse(e[1],1,ut);if(!n)return null;let a=[],r=null;i.expectedType&&i.expectedType.kind!=="value"&&(r=i.expectedType);for(let h=1;h<e.length;h+=2){let m=h===1?-1/0:e[h],b=e[h+1],T=h,k=h+1;if(typeof m!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',T);if(a.length&&a[a.length-1][0]>=m)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',T);let P=i.parse(b,k,r);if(!P)return null;r=r||P.type,a.push([m,P])}return new t(r,n,a)}evaluate(e){let i=this.labels,n=this.outputs;if(i.length===1)return n[0].evaluate(e);let a=this.input.evaluate(e);if(a<=i[0])return n[0].evaluate(e);let r=i.length;if(a>=i[r-1])return n[r-1].evaluate(e);let h=SC(i,a);return n[h].evaluate(e)}eachChild(e){e(this.input);for(let i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function DR(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var RR=TC;function TC(t,e,i,n){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=n}TC.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(e===void 0&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,n=0;n<8;n++){var a=this.sampleCurveX(i)-t;if(Math.abs(a)<e)return i;var r=this.sampleCurveDerivativeX(i);
722if(Math.abs(r)<1e-6)break;i=i-a/r}var h=0,m=1;for(i=t,n=0;n<20&&(a=this.sampleCurveX(i),!(Math.abs(a-t)<e));n++)t>a?h=i:m=i,i=(m-h)*.5+h;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var zR=DR(RR);function rd(t,e,i){return t+i*(e-t)}function OR(t,e,i,n="rgb"){switch(n){case"rgb":{let[a,r,h,m]=c_(t.rgb,e.rgb,i);return new Rn(a,r,h,m,!1)}case"hcl":{let[a,r,h,m]=t.hcl,[b,T,k,P]=e.hcl,F,U;if(!isNaN(a)&&!isNaN(b)){let we=b-a;b>a&&we>180?we-=360:b<a&&a-b>180&&(we+=360),F=a+i*we}else isNaN(a)?isNaN(b)?F=NaN:(F=b,(h===1||h===0)&&(U=T)):(F=a,(k===1||k===0)&&(U=r));let[X,Y,te,le]=MR([F,U??rd(r,T,i),rd(h,k,i),rd(m,P,i)]);return new Rn(X,Y,te,le,!1)}case"lab":{let[a,r,h,m]=xC(c_(t.lab,e.lab,i));return new Rn(a,r,h,m,!1)}}}function c_(t,e,i){return t.map((n,a)=>rd(n,e[a],i))}function FR(t,e,i){return new Lu(c_(t.values,e.values,i))}function BR(t,e,i){let n=t.values,a=e.values;if(n.length!==a.length)throw new Dn(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);let r=[];for(let h=0;h<n.length;h+=2){if(n[h]!==a[h])throw new Dn(`Cannot interpolate values containing mismatched anchors. from[${h}]: ${n[h]}, to[${h}]: ${a[h]}`);r.push(n[h]);let[m,b]=n[h+1],[T,k]=a[h+1];r.push([rd(m,T,i),rd(b,k,i)])}return new Pu(r)}var ww={number:rd,color:OR,array:c_,padding:FR,variableAnchorOffsetCollection:BR},Cc=class t{constructor(e,i,n,a,r){this.type=e,this.operator=i,this.interpolation=n,this.input=a,this.labels=[],this.outputs=[];for(let[h,m]of r)this.labels.push(h),this.outputs.push(m)}static interpolationFactor(e,i,n,a){let r=0;if(e.name==="exponential")r=Sw(i,e.base,n,a);else if(e.name==="linear")r=Sw(i,1,n,a);else if(e.name==="cubic-bezier"){let h=e.controlPoints;r=new zR(h[0],h[1],h[2],h[3]).solve(Sw(i,1,n,a))}return r}static parse(e,i){let[n,a,r,...h]=e;if(!Array.isArray(a)||a.length===0)return i.error("Expected an interpolation type expression.",1);if(a[0]==="linear")a={name:"linear"};else if(a[0]==="exponential"){let T=a[1];if(typeof T!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:T}}else if(a[0]==="cubic-bezier"){let T=a.slice(1);if(T.length!==4||T.some(k=>typeof k!="number"||k<0||k>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:T}}else return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return i.error("Expected an even number of arguments.");if(r=i.parse(r,2,ut),!r)return null;let m=[],b=null;n==="interpolate-hcl"||n==="interpolate-lab"?b=El:i.expectedType&&i.expectedType.kind!=="value"&&(b=i.expectedType);for(let T=0;T<h.length;T+=2){let k=h[T],P=h[T+1],F=T+3,U=T+4;if(typeof k!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',F);if(m.length&&m[m.length-1][0]>=k)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',F);let X=i.parse(P,U,b);if(!X)return null;b=b||X.type,m.push([k,X])}return!$m(b,ut)&&!$m(b,El)&&!$m(b,S_)&&!$m(b,T_)&&!$m(b,Eo(ut))?i.error(`Type ${En(b)} is not interpolatable.`):new t(b,n,a,r,m)}evaluate(e){let i=this.labels,n=this.outputs;if(i.length===1)return n[0].evaluate(e);let a=this.input.evaluate(e);if(a<=i[0])return n[0].evaluate(e);let r=i.length;if(a>=i[r-1])return n[r-1].evaluate(e);let h=SC(i,a),m=i[h],b=i[h+1],T=t.interpolationFactor(this.interpolation,a,m,b),k=n[h].evaluate(e),P=n[h+1].evaluate(e);switch(this.operator){case"interpolate":return ww[this.type.kind](k,P,T);case"interpolate-hcl":return ww.color(k,P,T,"hcl");case"interpolate-lab":return ww.color(k,P,T,"lab")}}eachChild(e){e(this.input);for(let i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function Sw(t,e,i,n){let a=n-i,r=t-i;return a===0?0:e===1?r/a:(Math.pow(e,r)-1)/(Math.pow(e,a)-1)}var u_=class t{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expectected at least one argument.");let n=null,a=i.expectedType;a&&a.kind!=="value"&&(n=a);let r=[];for(let h of e.slice(1)){let m=i.parse(h,1+r.length,n,void 0,{typeAnnotation:"omit"});if(!m)return null;
vendor: 18,515 bytes, line 722
722n=n||m.type,r.push(m)}if(!n)throw new Error("No output type");return a&&r.some(h=>Gm(a,h.type))?new t(li,r):new t(n,r)}evaluate(e){let i=null,n=0,a;for(let r of this.args)if(n++,i=r.evaluate(e),i&&i instanceof Du&&!i.available&&(a||(a=i.name),i=null,n===this.args.length&&(i=a)),i!==null)break;return i}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function Wk(t,e){return t==="=="||t==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function NR(t,e,i){return e===i}function VR(t,e,i){return e!==i}function $R(t,e,i){return e<i}function UR(t,e,i){return e>i}function jR(t,e,i){return e<=i}function qR(t,e,i){return e>=i}function kC(t,e,i,n){return n.compare(e,i)===0}function HR(t,e,i,n){return!kC(t,e,i,n)}function WR(t,e,i,n){return n.compare(e,i)<0}function GR(t,e,i,n){return n.compare(e,i)>0}function ZR(t,e,i,n){return n.compare(e,i)<=0}function KR(t,e,i,n){return n.compare(e,i)>=0}function Qp(t,e,i){let n=t!=="=="&&t!=="!=";return class CC{constructor(r,h,m){this.type=ai,this.lhs=r,this.rhs=h,this.collator=m,this.hasUntypedArgument=r.type.kind==="value"||h.type.kind==="value"}static parse(r,h){if(r.length!==3&&r.length!==4)return h.error("Expected two or three arguments.");let m=r[0],b=h.parse(r[1],1,li);if(!b)return null;if(!Wk(m,b.type))return h.concat(1).error(`"${m}" comparisons are not supported for type '${En(b.type)}'.`);let T=h.parse(r[2],2,li);if(!T)return null;if(!Wk(m,T.type))return h.concat(2).error(`"${m}" comparisons are not supported for type '${En(T.type)}'.`);if(b.type.kind!==T.type.kind&&b.type.kind!=="value"&&T.type.kind!=="value")return h.error(`Cannot compare types '${En(b.type)}' and '${En(T.type)}'.`);n&&(b.type.kind==="value"&&T.type.kind!=="value"?b=new Fa(T.type,[b]):b.type.kind!=="value"&&T.type.kind==="value"&&(T=new Fa(b.type,[T])));let k=null;if(r.length===4){if(b.type.kind!=="string"&&T.type.kind!=="string"&&b.type.kind!=="value"&&T.type.kind!=="value")return h.error("Cannot use collator to compare non-string types.");if(k=h.parse(r[3],3,x_),!k)return null}return new CC(b,T,k)}evaluate(r){let h=this.lhs.evaluate(r),m=this.rhs.evaluate(r);if(n&&this.hasUntypedArgument){let b=Tr(h),T=Tr(m);if(b.kind!==T.kind||!(b.kind==="string"||b.kind==="number"))throw new Dn(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${b.kind}, ${T.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){let b=Tr(h),T=Tr(m);if(b.kind!=="string"||T.kind!=="string")return e(r,h,m)}return this.collator?i(r,h,m,this.collator.evaluate(r)):e(r,h,m)}eachChild(r){r(this.lhs),r(this.rhs),this.collator&&r(this.collator)}outputDefined(){return!0}}}var XR=Qp("==",NR,kC),YR=Qp("!=",VR,HR),JR=Qp("<",$R,WR),QR=Qp(">",UR,GR),ez=Qp("<=",jR,ZR),tz=Qp(">=",qR,KR),h_=class t{constructor(e,i,n){this.type=x_,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");let n=e[1];if(typeof n!="object"||Array.isArray(n))return i.error("Collator options argument must be an object.");let a=i.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,ai);if(!a)return null;let r=i.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,ai);if(!r)return null;let h=null;return n.locale&&(h=i.parse(n.locale,1,mi),!h)?null:new t(a,r,h)}evaluate(e){return new Zm(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},Vw=class t{constructor(e,i,n,a,r){this.type=mi,this.number=e,this.locale=i,this.currency=n,this.minFractionDigits=a,this.maxFractionDigits=r}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");let n=i.parse(e[1],1,ut);if(!n)return null;let a=e[2];if(typeof a!="object"||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let r=null;if(a.locale&&(r=i.parse(a.locale,1,mi),!r))return null;let h=null;if(a.currency&&(h=i.parse(a.currency,1,mi),!h))return null;let m=null;if(a["min-fraction-digits"]&&(m=i.parse(a["min-fraction-digits"],1,ut),!m))return null;let b=null;return a["max-fraction-digits"]&&(b=i.parse(a["max-fraction-digits"],1,ut),!b)?null:new t(n,r,h,m,b)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},$w=class t{constructor(e){this.type=w_,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let n=e[1];if(!Array.isArray(n)&&typeof n=="object")return i.error("First argument must be an image or text section.");let a=[],r=!1;for(let h=1;h<=e.length-1;++h){let m=e[h];if(r&&typeof m=="object"&&!Array.isArray(m)){r=!1;let b=null;if(m["font-scale"]&&(b=i.parse(m["font-scale"],1,ut),!b))return null;let T=null;if(m["text-font"]&&(T=i.parse(m["text-font"],1,Eo(mi)),!T))return null;let k=null;if(m["text-color"]&&(k=i.parse(m["text-color"],1,El),!k))return null;let P=a[a.length-1];P.scale=b,P.font=T,P.textColor=k}else{let b=i.parse(e[h],1,li);if(!b)return null;let T=b.type.kind;if(T!=="string"&&T!=="value"&&T!=="null"&&T!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,a.push({content:b,scale:null,font:null,textColor:null})}}return new t(a)}evaluate(e){let i=n=>{let a=n.content.evaluate(e);return Tr(a)===ng?new Km("",a,null,null,null):new Km(Um(a),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null)};return new sd(this.sections.map(i))}eachChild(e){for(let i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor)}outputDefined(){return!1}},Uw=class t{constructor(e){this.type=ng,this.input=e}static parse(e,i){if(e.length!==2)return i.error("Expected two arguments.");let n=i.parse(e[1],1,mi);return n?new t(n):i.error("No image name provided.")}evaluate(e){let i=this.input.evaluate(e),n=Du.fromString(i);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(i)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},jw=class t{constructor(e){this.type=ut,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=i.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${En(n.type)} instead.`):new t(n):null}evaluate(e){let i=this.input.evaluate(e);if(typeof i=="string")return[...i].length;if(Array.isArray(i))return i.length;throw new Dn(`Expected value to be of type string or array, but found ${En(Tr(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}},Il=8192;function iz(t,e){let i=nz(t[0]),n=sz(t[1]),a=Math.pow(2,e.z);return[Math.round(i*a*Il),Math.round(n*a*Il)]}function iS(t,e){let i=Math.pow(2,e.z),n=(t[0]/Il+e.x)/i,a=(t[1]/Il+e.y)/i;return[rz(n),oz(a)]}function nz(t){return(180+t)/360}function rz(t){return t*360-180}function sz(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function oz(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function rg(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Ym(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function az(t,e,i){return e[1]>t[1]!=i[1]>t[1]&&t[0]<(i[0]-e[0])*(t[1]-e[1])/(i[1]-e[1])+e[0]}function lz(t,e,i){let n=t[0]-e[0],a=t[1]-e[1],r=t[0]-i[0],h=t[1]-i[1];return n*h-r*a===0&&n*r<=0&&a*h<=0}function k_(t,e,i,n){let a=[e[0]-t[0],e[1]-t[1]],r=[n[0]-i[0],n[1]-i[1]];return dz(r,a)===0?!1:!!(Gk(t,e,i,n)&&Gk(i,n,t,e))}function cz(t,e,i){for(let n of i)for(let a=0;a<n.length-1;++a)if(k_(t,e,n[a],n[a+1]))return!0;return!1}function ef(t,e,i=!1){let n=!1;for(let a of e)for(let r=0;r<a.length-1;r++){if(lz(t,a[r],a[r+1]))return i;az(t,a[r],a[r+1])&&(n=!n)}return n}function uz(t,e){for(let i of e)if(ef(t,i))return!0;return!1}function MC(t,e){for(let i of t)if(!ef(i,e))return!1;for(let i=0;i<t.length-1;++i)if(cz(t[i],t[i+1],e))return!1;return!0}function hz(t,e){for(let i of e)if(MC(t,i))return!0;return!1}function dz(t,e){return t[0]*e[1]-t[1]*e[0]}function Gk(t,e,i,n){let a=t[0]-i[0],r=t[1]-i[1],h=e[0]-i[0],m=e[1]-i[1],b=n[0]-i[0],T=n[1]-i[1],k=a*T-b*r,P=h*T-b*m;return k>0&&P<0||k<0&&P>0}function nS(t,e,i){let n=[];for(let a=0;a<t.length;a++){let r=[];for(let h=0;h<t[a].length;h++){let m=iz(t[a][h],i);rg(e,m),r.push(m)}n.push(r)}return n}function AC(t,e,i){let n=[];for(let a=0;a<t.length;a++){let r=nS(t[a],e,i);n.push(r)}return n}function EC(t,e,i,n){if(t[0]<i[0]||t[0]>i[2]){let a=n*.5,r=t[0]-i[0]>a?-n:i[0]-t[0]>a?n:0;r===0&&(r=t[0]-i[2]>a?-n:i[2]-t[0]>a?n:0),t[0]+=r}rg(e,t)}function pz(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function Zk(t,e,i,n){let a=Math.pow(2,n.z)*Il,r=[n.x*Il,n.y*Il],h=[];for(let m of t)for(let b of m){let T=[b.x+r[0],b.y+r[1]];EC(T,e,i,a),h.push(T)}return h}function Kk(t,e,i,n){let a=Math.pow(2,n.z)*Il,r=[n.x*Il,n.y*Il],h=[];for(let m of t){let b=[];for(let T of m){let k=[T.x+r[0],T.y+r[1]];rg(e,k),b.push(k)}h.push(b)}if(e[2]-e[0]<=a/2){pz(e);for(let m of h)for(let b of m)EC(b,e,i,a)}return h}function fz(t,e){let i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],a=t.canonicalID();if(e.type==="Polygon"){let r=nS(e.coordinates,n,a),h=Zk(t.geometry(),i,n,a);if(!Ym(i,n))return!1;for(let m of h)if(!ef(m,r))return!1}if(e.type==="MultiPolygon"){let r=AC(e.coordinates,n,a),h=Zk(t.geometry(),i,n,a);if(!Ym(i,n))return!1;for(let m of h)if(!uz(m,r))return!1}return!0}function mz(t,e){let i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],a=t.canonicalID();if(e.type==="Polygon"){let r=nS(e.coordinates,n,a),h=Kk(t.geometry(),i,n,a);if(!Ym(i,n))return!1;for(let m of h)if(!MC(m,r))return!1}if(e.type==="MultiPolygon"){let r=AC(e.coordinates,n,a),h=Kk(t.geometry(),i,n,a);if(!Ym(i,n))return!1;for(let m of h)if(!hz(m,r))return!1}return!0}var Jm=class t{constructor(e,i){this.type=ai,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Xm(e[1])){let n=e[1];if(n.type==="FeatureCollection"){let a=[];for(let r of n.features){let{type:h,coordinates:m}=r.geometry;h==="Polygon"&&a.push(m),h==="MultiPolygon"&&a.push(...m)}if(a.length){let r={type:"MultiPolygon",coordinates:a};return new t(n,r)}}else if(n.type==="Feature"){let a=n.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new t(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new t(n,n)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return fz(e,this.geometries);if(e.geometryType()==="LineString")return mz(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},d_=class{constructor(e=[],i=(n,a)=>n<a?-1:n>a?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:i,compare:n}=this,a=i[e];for(;e>0;){let r=e-1>>1,h=i[r];if(n(a,h)>=0)break;i[e]=h,e=r}i[e]=a}_down(e){let{data:i,compare:n}=this,a=this.length>>1,r=i[e];for(;e<a;){let h=(e<<1)+1,m=h+1;if(m<this.length&&n(i[m],i[h])<0&&(h=m),n(i[h],r)>=0)break;i[e]=i[h],e=h}i[e]=r}};function gz(t,e){if(t.length<=1)return[t];let i=[],n,a;for(let r of t){let h=yz(r);h!==0&&(r.area=Math.abs(h),a===void 0&&(a=h<0),a===h<0?(n&&i.push(n),n=[r]):n.push(r))}return n&&i.push(n),i}function yz(t){let e=0;for(let i=0,n=t.length,a=n-1,r,h;i<n;a=i++)r=t[i],h=t[a],e+=(h.x-r.x)*(r.y+h.y);return e}var _z=6378.137,Xk=1/298.257223563,Yk=Xk*(2-Xk),Jk=Math.PI/180,Qm=class{constructor(e){let i=Jk*_z*1e3,n=Math.cos(e*Jk),a=1/(1-Yk*(1-n*n)),r=Math.sqrt(a);this.kx=i*r*n,this.ky=i*r*a*(1-Yk)}distance(e,i){let n=this.wrap(e[0]-i[0])*this.kx,a=(e[1]-i[1])*this.ky;return Math.sqrt(n*n+a*a)}pointOnLine(e,i){let n=1/0,a,r,h,m;for(let b=0;b<e.length-1;b++){let T=e[b][0],k=e[b][1],P=this.wrap(e[b+1][0]-T)*this.kx,F=(e[b+1][1]-k)*this.ky,U=0;(P!==0||F!==0)&&(U=(this.wrap(i[0]-T)*this.kx*P+(i[1]-k)*this.ky*F)/(P*P+F*F),U>1?(T=e[b+1][0],k=e[b+1][1]):U>0&&(T+=P/this.kx*U,k+=F/this.ky*U)),P=this.wrap(i[0]-T)*this.kx,F=(i[1]-k)*this.ky;let X=P*P+F*F;X<n&&(n=X,a=T,r=k,h=b,m=U)}return{point:[a,r],index:h,t:Math.max(0,Math.min(1,m))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}},qw=100,Hw=50;function IC(t,e){return e[0]-t[0]}function p_(t){return t[1]-t[0]+1}function Mc(t,e){return t[1]>=t[0]&&t[1]<e}function Ww(t,e){if(t[0]>t[1])return[null,null];let i=p_(t);if(e){if(i===2)return[t,null];let a=Math.floor(i/2);return[[t[0],t[0]+a],[t[0]+a,t[1]]]}if(i===1)return[t,null];let n=Math.floor(i/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}function Gw(t,e){if(!Mc(e,t.length))return[1/0,1/0,-1/0,-1/0];let i=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)rg(i,t[n]);return i}function Zw(t){let e=[1/0,1/0,-1/0,-1/0];for(let i of t)for(let n of i)rg(e,n);return e}function Qk(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function rS(t,e,i){if(!Qk(t)||!Qk(e))return NaN;let n=0,a=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(a=t[1]-e[3]),t[3]<e[1]&&(a=e[1]-t[3]),i.distance([0,0],[n,a])}function id(t,e,i){let n=i.pointOnLine(e,t);return i.distance(t,n.point)}function sS(t,e,i,n,a){let r=Math.min(id(t,[i,n],a),id(e,[i,n],a)),h=Math.min(id(i,[t,e],a),id(n,[t,e],a));return Math.min(r,h)}function vz(t,e,i,n,a){if(!(Mc(e,t.length)&&Mc(n,i.length)))return 1/0;let r=1/0;for(let h=e[0];h<e[1];++h){let m=t[h],b=t[h+1];for(let T=n[0];T<n[1];++T){let k=i[T],P=i[T+1];if(k_(m,b,k,P))return 0;r=Math.min(r,sS(m,b,k,P,a))}}return r}function bz(t,e,i,n,a){if(!(Mc(e,t.length)&&Mc(n,i.length)))return NaN;let r=1/0;for(let h=e[0];h<=e[1];++h)for(let m=n[0];m<=n[1];++m)if(r=Math.min(r,a.distance(t[h],i[m])),r===0)return r;return r}function xz(t,e,i){if(ef(t,e,!0))return 0;let n=1/0;for(let a of e){let r=a[0],h=a[a.length-1];if(r!==h&&(n=Math.min(n,id(t,[h,r],i)),n===0))return n;let m=i.pointOnLine(a,t);if(n=Math.min(n,i.distance(t,m.point)),n===0)return n}return n}function wz(t,e,i,n){if(!Mc(e,t.length))return NaN;for(let r=e[0];r<=e[1];++r)if(ef(t[r],i,!0))return 0;let a=1/0;for(let r=e[0];r<e[1];++r){let h=t[r],m=t[r+1];for(let b of i)for(let T=0,k=b.length,P=k-1;T<k;P=T++){let F=b[P],U=b[T];if(k_(h,m,F,U))return 0;a=Math.min(a,sS(h,m,F,U,n))}}return a}function eC(t,e){for(let i of t)for(let n of i)if(ef(n,e,!0))return!0;return!1}function Sz(t,e,i,n=1/0){let a=Zw(t),r=Zw(e);if(n!==1/0&&rS(a,r,i)>=n)return n;if(Ym(a,r)){if(eC(t,e))return 0}else if(eC(e,t))return 0;let h=1/0;for(let m of t)for(let b=0,T=m.length,k=T-1;b<T;k=b++){let P=m[k],F=m[b];for(let U of e)for(let X=0,Y=U.length,te=Y-1;X<Y;te=X++){let le=U[te],we=U[X];if(k_(P,F,le,we))return 0;h=Math.min(h,sS(P,F,le,we,i))}}return h}function tC(t,e,i,n,a,r){if(!r)return;let h=rS(Gw(n,r),a,i);h<e&&t.push([h,r,[0,0]])}function Y0(t,e,i,n,a,r,h){if(!r||!h)return;let m=rS(Gw(n,r),Gw(a,h),i);m<e&&t.push([m,r,h])}function f_(t,e,i,n,a=1/0){let r=Math.min(n.distance(t[0],i[0][0]),a);if(r===0)return r;let h=new d_([[0,[0,t.length-1],[0,0]]],IC),m=Zw(i);for(;h.length>0;){let b=h.pop();if(b[0]>=r)continue;let T=b[1],k=e?Hw:qw;if(p_(T)<=k){if(!Mc(T,t.length))return NaN;if(e){let P=wz(t,T,i,n);if(isNaN(P)||P===0)return P;r=Math.min(r,P)}else for(let P=T[0];P<=T[1];++P){let F=xz(t[P],i,n);if(r=Math.min(r,F),r===0)return 0}}else{let P=Ww(T,e);tC(h,r,n,t,m,P[0]),tC(h,r,n,t,m,P[1])}}return r}function m_(t,e,i,n,a,r=1/0){let h=Math.min(r,a.distance(t[0],i[0]));if(h===0)return h;let m=new d_([[0,[0,t.length-1],[0,i.length-1]]],IC);for(;m.length>0;){let b=m.pop();if(b[0]>=h)continue;let T=b[1],k=b[2],P=e?Hw:qw,F=n?Hw:qw;if(p_(T)<=P&&p_(k)<=F){if(!Mc(T,t.length)&&Mc(k,i.length))return NaN;let U;if(e&&n)U=vz(t,T,i,k,a),h=Math.min(h,U);else if(e&&!n){let X=t.slice(T[0],T[1]+1);for(let Y=k[0];Y<=k[1];++Y)if(U=id(i[Y],X,a),h=Math.min(h,U),h===0)return h}else if(!e&&n){let X=i.slice(k[0],k[1]+1);for(let Y=T[0];Y<=T[1];++Y)if(U=id(t[Y],X,a),h=Math.min(h,U),h===0)return h}else U=bz(t,T,i,k,a),h=Math.min(h,U)}else{let U=Ww(T,e),X=Ww(k,n);Y0(m,h,a,t,i,U[0],X[0]),Y0(m,h,a,t,i,U[0],X[1]),Y0(m,h,a,t,i,U[1],X[0]),Y0(m,h,a,t,i,U[1],X[1])}}return h}function Tz(t,e){let i=t.geometry(),n=i.flat().map(h=>iS([h.x,h.y],t.canonical));if(i.length===0)return NaN;let a=new Qm(n[0][1]),r=1/0;for(let h of e){switch(h.type){case"Point":r=Math.min(r,m_(n,!1,[h.coordinates],!1,a,r));break;case"LineString":r=Math.min(r,m_(n,!1,h.coordinates,!0,a,r));break;case"Polygon":r=Math.min(r,f_(n,!1,h.coordinates,a,r));break}if(r===0)return r}return r}function kz(t,e){let i=t.geometry(),n=i.flat().map(h=>iS([h.x,h.y],t.canonical));if(i.length===0)return NaN;let a=new Qm(n[0][1]),r=1/0;for(let h of e){switch(h.type){case"Point":r=Math.min(r,m_(n,!0,[h.coordinates],!1,a,r));break;case"LineString":r=Math.min(r,m_(n,!0,h.coordinates,!0,a,r));break;case"Polygon":r=Math.min(r,f_(n,!0,h.coordinates,a,r));break}if(r===0)return r}return r}function Cz(t,e){let i=t.geometry();if(i.length===0||i[0].length===0)return NaN;let n=gz(i).map(h=>h.map(m=>m.map(b=>iS([b.x,b.y],t.canonical)))),a=new Qm(n[0][0][0][1]),r=1/0;for(let h of e)for(let m of n){switch(h.type){case"Point":r=Math.min(r,f_([h.coordinates],!1,m,a,r));break;case"LineString":r=Math.min(r,f_(h.coordinates,!0,m,a,r));break;case"Polygon":r=Math.min(r,Sz(m,h.coordinates,a,r));break}if(r===0)return r}return r}function Tw(t){return t.type==="MultiPolygon"?t.coordinates.map(e=>({type:"Polygon",coordinates:e}
vendor: 7,596 bytes, line 722
722)):t.type==="MultiLineString"?t.coordinates.map(e=>({type:"LineString",coordinates:e})):t.type==="MultiPoint"?t.coordinates.map(e=>({type:"Point",coordinates:e})):[t]}var eg=class t{constructor(e,i){this.type=ut,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Xm(e[1])){let n=e[1];if(n.type==="FeatureCollection")return new t(n,n.features.map(a=>Tw(a.geometry)).flat());if(n.type==="Feature")return new t(n,Tw(n.geometry));if("type"in n&&"coordinates"in n)return new t(n,Tw(n))}return i.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return Tz(e,this.geometries);if(e.geometryType()==="LineString")return kz(e,this.geometries);if(e.geometryType()==="Polygon")return Cz(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},oS={"==":XR,"!=":YR,">":QR,"<":JR,">=":tz,"<=":ez,array:Fa,at:Rw,boolean:Fa,case:Bw,coalesce:u_,collator:h_,format:$w,image:Uw,in:zw,"index-of":Ow,interpolate:Cc,"interpolate-hcl":Cc,"interpolate-lab":Cc,length:jw,let:o_,literal:Yp,match:Fw,number:Fa,"number-format":Vw,object:Fa,slice:Nw,step:l_,string:Fa,"to-boolean":Iu,"to-color":Iu,"to-number":Iu,"to-string":Iu,var:a_,within:Jm,distance:eg},Ru=class t{constructor(e,i,n,a){this.name=e,this.type=i,this._evaluate=n,this.args=a}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,i){let n=e[0],a=t.definitions[n];if(!a)return i.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);let r=Array.isArray(a)?a[0]:a.type,h=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,m=h.filter(([T])=>!Array.isArray(T)||T.length===e.length-1),b=null;for(let[T,k]of m){b=new s_(i.registry,g_,i.path,null,i.scope);let P=[],F=!1;for(let U=1;U<e.length;U++){let X=e[U],Y=Array.isArray(T)?T[U-1]:T.type,te=b.parse(X,1+P.length,Y);if(!te){F=!0;break}P.push(te)}if(!F){if(Array.isArray(T)&&T.length!==P.length){b.error(`Expected ${T.length} arguments, but found ${P.length} instead.`);continue}for(let U=0;U<P.length;U++){let X=Array.isArray(T)?T[U]:T.type,Y=P[U];b.concat(U+1).checkSubtype(X,Y.type)}if(b.errors.length===0)return new t(n,r,k,P)}}if(m.length===1)i.errors.push(...b.errors);else{let T=(m.length?m:h).map(([P])=>Az(P)).join(" | "),k=[];for(let P=1;P<e.length;P++){let F=i.parse(e[P],1+k.length);if(!F)return null;k.push(En(F.type))}i.error(`Expected arguments of type ${T}, but found (${k.join(", ")}) instead.`)}return null}static register(e,i){t.definitions=i;for(let n in i)e[n]=t}};function iC(t,[e,i,n,a]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);let r=a?a.evaluate(t):1,h=wC(e,i,n,r);if(h)throw new Dn(h);return new Rn(e/255,i/255,n/255,r,!1)}function nC(t,e){return t in e}function kw(t,e){let i=e[t];return typeof i>"u"?null:i}function Mz(t,e,i,n){for(;i<=n;){let a=i+n>>1;if(e[a]===t)return!0;e[a]>t?n=a-1:i=a+1}return!1}function Qh(t){return{type:t}}Ru.register(oS,{error:[xR,[mi],(t,[e])=>{throw new Dn(e.evaluate(t))}],typeof:[mi,[li],(t,[e])=>En(Tr(e.evaluate(t)))],"to-rgba":[Eo(ut,4),[El],(t,[e])=>{let[i,n,a,r]=e.evaluate(t).rgb;return[i*255,n*255,a*255,r]}],rgb:[El,[ut,ut,ut],iC],rgba:[El,[ut,ut,ut,ut],iC],has:{type:ai,overloads:[[[mi],(t,[e])=>nC(e.evaluate(t),t.properties())],[[mi,Kp],(t,[e,i])=>nC(e.evaluate(t),i.evaluate(t))]]},get:{type:li,overloads:[[[mi],(t,[e])=>kw(e.evaluate(t),t.properties())],[[mi,Kp],(t,[e,i])=>kw(e.evaluate(t),i.evaluate(t))]]},"feature-state":[li,[mi],(t,[e])=>kw(e.evaluate(t),t.featureState||{})],properties:[Kp,[],t=>t.properties()],"geometry-type":[mi,[],t=>t.geometryType()],id:[li,[],t=>t.id()],zoom:[ut,[],t=>t.globals.zoom],"heatmap-density":[ut,[],t=>t.globals.heatmapDensity||0],"line-progress":[ut,[],t=>t.globals.lineProgress||0],accumulated:[li,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[ut,Qh(ut),(t,e)=>{let i=0;for(let n of e)i+=n.evaluate(t);return i}],"*":[ut,Qh(ut),(t,e)=>{let i=1;for(let n of e)i*=n.evaluate(t);return i}],"-":{type:ut,overloads:[[[ut,ut],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[ut],(t,[e])=>-e.evaluate(t)]]},"/":[ut,[ut,ut],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[ut,[ut,ut],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[ut,[],()=>Math.LN2],pi:[ut,[],()=>Math.PI],e:[ut,[],()=>Math.E],"^":[ut,[ut,ut],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[ut,[ut],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[ut,[ut],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[ut,[ut],(t,[e])=>Math.log(e.evaluate(t))],log2:[ut,[ut],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[ut,[ut],(t,[e])=>Math.sin(e.evaluate(t))],cos:[ut,[ut],(t,[e])=>Math.cos(e.evaluate(t))],tan:[ut,[ut],(t,[e])=>Math.tan(e.evaluate(t))],asin:[ut,[ut],(t,[e])=>Math.asin(e.evaluate(t))],acos:[ut,[ut],(t,[e])=>Math.acos(e.evaluate(t))],atan:[ut,[ut],(t,[e])=>Math.atan(e.evaluate(t))],min:[ut,Qh(ut),(t,e)=>Math.min(...e.map(i=>i.evaluate(t)))],max:[ut,Qh(ut),(t,e)=>Math.max(...e.map(i=>i.evaluate(t)))],abs:[ut,[ut],(t,[e])=>Math.abs(e.evaluate(t))],round:[ut,[ut],(t,[e])=>{let i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[ut,[ut],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[ut,[ut],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[ai,[mi,li],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[ai,[li],(t,[e])=>t.id()===e.value],"filter-type-==":[ai,[mi],(t,[e])=>t.geometryType()===e.value],"filter-<":[ai,[mi,li],(t,[e,i])=>{let n=t.properties()[e.value],a=i.value;return typeof n==typeof a&&n<a}],"filter-id-<":[ai,[li],(t,[e])=>{let i=t.id(),n=e.value;return typeof i==typeof n&&i<n}],"filter->":[ai,[mi,li],(t,[e,i])=>{let n=t.properties()[e.value],a=i.value;return typeof n==typeof a&&n>a}],"filter-id->":[ai,[li],(t,[e])=>{let i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[ai,[mi,li],(t,[e,i])=>{let n=t.properties()[e.value],a=i.value;return typeof n==typeof a&&n<=a}],"filter-id-<=":[ai,[li],(t,[e])=>{let i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[ai,[mi,li],(t,[e,i])=>{let n=t.properties()[e.value],a=i.value;return typeof n==typeof a&&n>=a}],"filter-id->=":[ai,[li],(t,[e])=>{let i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[ai,[li],(t,[e])=>e.value in t.properties()],"filter-has-id":[ai,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[ai,[Eo(mi)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[ai,[Eo(li)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[ai,[mi,Eo(li)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[ai,[mi,Eo(li)],(t,[e,i])=>Mz(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:ai,overloads:[[[ai,ai],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[Qh(ai),(t,e)=>{for(let i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:ai,overloads:[[[ai,ai],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[Qh(ai),(t,e)=>{for(let i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[ai,[ai],(t,[e])=>!e.evaluate(t)],"is-supported-script":[ai,[mi],(t,[e])=>{let i=t.globals&&t.globals.isSupportedScript;return i?i(e.evaluate(t)):!0}],upcase:[mi,[mi],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[mi,[mi],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[mi,Qh(li),(t,e)=>e.map(i=>Um(i.evaluate(t))).join("")],"resolved-locale":[mi,[x_],(t,[e])=>e.evaluate(t).resolvedLocale()]});function Az(t){return Array.isArray(t)?`(${t.map(En).join(", ")})`:`(${En(t.type)}...)`}
722function g_(t){if(t instanceof a_)return g_(t.boundExpression);if(t instanceof Ru&&t.name==="error"||t instanceof h_||t instanceof Jm||t instanceof eg)return!1;let e=t instanceof Iu||t instanceof Fa,i=!0;return t.eachChild(n=>{e?i=i&&g_(n):i=i&&n instanceof Yp}),i?C_(t)&&M_(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]):!1}function C_(t){if(t instanceof Ru&&(t.name==="get"&&t.args.length===1||t.name==="feature-state"||t.name==="has"&&t.args.length===1||t.name==="properties"||t.name==="geometry-type"||t.name==="id"||/^filter-/.test(t.name))||t instanceof Jm||t instanceof eg)return!1;let e=!0;return t.eachChild(i=>{e&&!C_(i)&&(e=!1)}),e}function tg(t){if(t instanceof Ru&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(i=>{e&&!tg(i)&&(e=!1)}),e}function M_(t,e){if(t instanceof Ru&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild(n=>{i&&!M_(n,e)&&(i=!1)}),i}function Kw(t){return{result:"success",value:t}}function Gp(t){return{result:"error",value:t}}function y_(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function LC(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function PC(t){return!!t.expression&&t.expression.interpolated}function Hi(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}function aS(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Xw=class{constructor(e,i){this.expression=e,this._warningHistory={},this._evaluator=new r_,this._defaultValue=i?Lz(i):null,this._enumValues=i&&i.type==="enum"?i.values:null}evaluateWithoutErrorHandling(e,i,n,a,r,h){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=n,this._evaluator.canonical=a,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=h,this.expression.evaluate(this._evaluator)}evaluate(e,i,n,a,r,h){this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=n||null,this._evaluator.canonical=a,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=h||null;try{let m=this.expression.evaluate(this._evaluator);if(m==null||typeof m=="number"&&m!==m)return this._defaultValue;if(this._enumValues&&!(m in this._enumValues))throw new Dn(`Expected value to be one of ${Object.keys(this._enumValues).map(b=>JSON.stringify(b)).join(", ")}, but found ${JSON.stringify(m)} instead.`);return m}catch(m){return this._warningHistory[m.message]||(this._warningHistory[m.message]=!0,typeof console<"u"&&console.warn(m.message)),this._defaultValue}}};function DC(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in oS}function RC(t,e){let i=new s_(oS,g_,[],e?Iz(e):void 0),n=i.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?Kw(new Xw(n,e)):Gp(i.errors)}var __=class{constructor(e,i){this.kind=e,this._styleExpression=i,this.isStateDependent=e!=="constant"&&!tg(i.expression)}evaluateWithoutErrorHandling(e,i,n,a,r,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,n,a,r,h)}evaluate(e,i,n,a,r,h){return this._styleExpression.evaluate(e,i,n,a,r,h)}},v_=class{constructor(e,i,n,a){this.kind=e,this.zoomStops=n,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!tg(i.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,i,n,a,r,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,n,a,r,h)}evaluate(e,i,n,a,r,h){return this._styleExpression.evaluate(e,i,n,a,r,h)}interpolationFactor(e,i,n){return this.interpolationType?Cc.interpolationFactor(this.interpolationType,e,i,n):0}};function Ez(t,e){let i=RC(t,e);if(i.result==="error")return i;let n=i.value.expression,a=C_(n);if(!a&&!y_(e))return Gp([new ta("","data expressions not supported")]);let r=M_(n,["zoom"]);if(!r&&!LC(e))return Gp([new ta("","zoom expressions not supported")]);let h=Q0(n);if(!h&&!r)return Gp([new ta("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(h instanceof ta)return Gp([h]);if(h instanceof Cc&&!PC(e))return Gp([new ta("",'"interpolate" expressions cannot be used with this property')]);if(!h)return Kw(a?new __("constant",i.value):new __("source",i.value));let m=h instanceof Cc?h.interpolation:void 0;return Kw(a?new v_("camera",i.value,h.labels,m):new v_("composite",i.value,h.labels,m))}function Q0(t){let e=null;if(t instanceof o_)e=Q0(t.result);else if(t instanceof u_){for(let i of t.args)if(e=Q0(i),e)break}else(t instanceof l_||t instanceof Cc)&&t.input instanceof Ru&&t.input.name==="zoom"&&(e=t);return e instanceof ta||t.eachChild(i=>{let n=Q0(i);n instanceof ta?e=n:!e&&n?e=new ta("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new ta("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Iz(t){let e={color:El,string:mi,number:ut,enum:mi,boolean:ai,formatted:w_,padding:S_,resolvedImage:ng,variableAnchorOffsetCollection:T_};return t.type==="array"?Eo(e[t.value]||li,t.length):e[t.type]}function Lz(t){return t.type==="color"&&aS(t.default)?new Rn(0,0,0,0):t.type==="color"?Rn.parse(t.default)||null:t.type==="padding"?Lu.parse(t.default)||null:t.type==="variableAnchorOffsetCollection"?Pu.parse(t.default)||null:t.default===void 0?null:t.default}function zC(t){if(t===!0||t===!1)return!0;
722if(!Array.isArray(t)||t.length===0)return!1;switch(t[0]){case"has":return t.length>=2&&t[1]!=="$id"&&t[1]!=="$type";case"in":return t.length>=3&&(typeof t[1]!="string"||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(let e of t.slice(1))if(!zC(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function OC(t){let e=t.key,i=t.value;return i?[new ot(e,i,"constants have been deprecated as of v8")]:[]}function Hn(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function od(t){if(Array.isArray(t))return t.map(od);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let i in t)e[i]=od(t[i]);return e}return Hn(t)}function ia(t){let e=t.key,i=t.value,n=t.valueSpec||{},a=t.objectElementValidators||{},r=t.style,h=t.styleSpec,m=t.validateSpec,b=[],T=Hi(i);if(T!=="object")return[new ot(e,i,`object expected, ${T} found`)];for(let k in i){let P=k.split(".")[0],F=n[P]||n["*"],U;if(a[P])U=a[P];else if(n[P])U=m;else if(a["*"])U=a["*"];else if(n["*"])U=m;else{b.push(new ot(e,i[k],`unknown property "${k}"`));continue}b=b.concat(U({key:(e&&`${e}.`)+k,value:i[k],valueSpec:F,style:r,styleSpec:h,object:i,objectKey:k,validateSpec:m},i))}for(let k in n)a[k]||n[k].required&&n[k].default===void 0&&i[k]===void 0&&b.push(new ot(e,i,`missing required property "${k}"`));return b}function lS(t){let e=t.value,i=t.valueSpec,n=t.validateSpec,a=t.style,r=t.styleSpec,h=t.key,m=t.arrayElementValidator||n;if(Hi(e)!=="array")return[new ot(h,e,`array expected, ${Hi(e)} found`)];if(i.length&&e.length!==i.length)return[new ot(h,e,`array length ${i.length} expected, length ${e.length} found`)];if(i["min-length"]&&e.length<i["min-length"])return[new ot(h,e,`array length at least ${i["min-length"]} expected, length ${e.length} found`)];let b={type:i.value,values:i.values};r.$version<7&&(b.function=i.function),Hi(i.value)==="object"&&(b=i.value);let T=[];for(let k=0;k<e.length;k++)T=T.concat(m({array:e,arrayIndex:k,value:e[k],valueSpec:b,validateSpec:t.validateSpec,style:a,styleSpec:r,key:`${h}[${k}]`}));return T}function cS(t){let e=t.key,i=t.value,n=t.valueSpec,a=Hi(i);return a==="number"&&i!==i&&(a="NaN"),a!=="number"?[new ot(e,i,`number expected, ${a} found`)]:"minimum"in n&&i<n.minimum?[new ot(e,i,`${i} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&i>n.maximum?[new ot(e,i,`${i} is greater than the maximum value ${n.maximum}`)]:[]}function FC(t){let e=t.valueSpec,i=Hn(t.value.type),n,a={},r,h,m=i!=="categorical"&&t.value.property===void 0,b=!m,T=Hi(t.value.stops)==="array"&&Hi(t.value.stops[0])==="array"&&Hi(t.value.stops[0][0])==="object",k=ia({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:P,default:X}});return i==="identity"&&m&&k.push(new ot(t.key,t.value,'missing required property "property"')),i!=="identity"&&!t.value.stops&&k.push(new ot(t.key,t.value,'missing required property "stops"')),i==="exponential"&&t.valueSpec.expression&&!PC(t.valueSpec)&&k.push(new ot(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(b&&!y_(t.valueSpec)?k.push(new ot(t.key,t.value,"property functions not supported")):m&&!LC(t.valueSpec)&&k.push(new ot(t.key,t.value,"zoom functions not supported"))),(i==="categorical"||T)&&t.value.property===void 0&&k.push(new ot(t.key,t.value,'"property" property is required')),k;function P(Y){if(i==="identity")return[new ot(Y.key,Y.value,'identity function may not have a "stops" property')];let te=[],le=Y.value;return te=te.concat(lS({key:Y.key,value:le,valueSpec:Y.valueSpec,validateSpec:Y.validateSpec,style:Y.style,styleSpec:Y.styleSpec,arrayElementValidator:F})),Hi(le)==="array"&&le.length===0&&te.push(new ot(Y.key,le,"array must have at least one stop")),te}function F(Y){let te=[],le=Y.value,we=Y.key;if(Hi(le)!=="array")return[new ot(we,le,`array expected, ${Hi(le)} found`)];if(le.length!==2)return[new ot(we,le,`array length 2 expected, length ${le.length} found`)];if(T){if(Hi(le[0])!=="object")return[new ot(we,le,`object expected, ${Hi(le[0])} found`)];if(le[0].zoom===void 0)return[new ot(we,le,"object stop key must have zoom")];if(le[0].value===void 0)return[new ot(we,le,"object stop key must have value")];if(h&&h>Hn(le[0].zoom))return[new ot(we,le[0].zoom,"stop zoom values must appear in ascending order")];Hn(le[0].zoom)!==h&&(h=Hn(le[0].zoom),r=void 0,a={}),te=te.concat(ia({key:`${we}[0]`,value:le[0],valueSpec:{zoom:{}},validateSpec:Y.validateSpec,style:Y.style,styleSpec:Y.styleSpec,objectElementValidators:{zoom:cS,value:U}}))}else te=te.concat(U({key:`${we}[0]`,value:le[0],valueSpec:{},validateSpec:Y.validateSpec,style:Y.style,styleSpec:Y.styleSpec},le));return DC(od(le[1]))?te.concat([new ot(`${we}[1]`,le[1],"expressions are not allowed in function stops.")]):te.concat(Y.validateSpec({key:`${we}[1]`,value:le[1],valueSpec:e,validateSpec:Y.validateSpec,style:Y.style,styleSpec:Y.styleSpec}))}function U(Y,te){let le=Hi(Y.value),we=Hn(Y.value),Le=Y.value!==null?Y.value:te;if(!n)n=le;else if(le!==n)return[new ot(Y.key,Le,`${le} stop domain type must match previous stop domain type ${n}`)];if(le!=="number"&&le!=="string"&&le!=="boolean")return[new ot(Y.key,Le,"stop domain value must be a number, string, or boolean")];
vendor: 3,270 bytes, line 722
722if(le!=="number"&&i!=="categorical"){let Oe=`number expected, ${le} found`;return y_(e)&&i===void 0&&(Oe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ot(Y.key,Le,Oe)]}return i==="categorical"&&le==="number"&&(!isFinite(we)||Math.floor(we)!==we)?[new ot(Y.key,Le,`integer expected, found ${we}`)]:i!=="categorical"&&le==="number"&&r!==void 0&&we<r?[new ot(Y.key,Le,"stop domain values must appear in ascending order")]:(r=we,i==="categorical"&&we in a?[new ot(Y.key,Le,"stop domain values must be unique")]:(a[we]=!0,[]))}function X(Y){return Y.validateSpec({key:Y.key,value:Y.value,valueSpec:e,validateSpec:Y.validateSpec,style:Y.style,styleSpec:Y.styleSpec})}}function Jp(t){let e=(t.expressionContext==="property"?Ez:RC)(od(t.value),t.valueSpec);if(e.result==="error")return e.value.map(n=>new ot(`${t.key}${n.key}`,t.value,n.message));let i=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext==="property"&&t.propertyKey==="text-font"&&!i.outputDefined())return[new ot(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!tg(i))return[new ot(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if(t.expressionContext==="filter"&&!tg(i))return[new ot(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!M_(i,["zoom","feature-state"]))return[new ot(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(t.expressionContext==="cluster-initial"&&!C_(i))return[new ot(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Pz(t){let e=t.value,i=t.key,n=Hi(e);return n!=="boolean"?[new ot(i,e,`boolean expected, ${n} found`)]:[]}function Dz(t){let e=t.key,i=t.value,n=Hi(i);return n!=="string"?[new ot(e,i,`color expected, ${n} found`)]:Rn.parse(String(i))?[]:[new ot(e,i,`color expected, "${i}" found`)]}function ig(t){let e=t.key,i=t.value,n=t.valueSpec,a=[];return Array.isArray(n.values)?n.values.indexOf(Hn(i))===-1&&a.push(new ot(e,i,`expected one of [${n.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(n.values).indexOf(Hn(i))===-1&&a.push(new ot(e,i,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(i)} found`)),a}function uS(t){return zC(od(t.value))?Jp(n_({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):BC(t)}function BC(t){let e=t.value,i=t.key;if(Hi(e)!=="array")return[new ot(i,e,`array expected, ${Hi(e)} found`)];let n=t.styleSpec,a,r=[];if(e.length<1)return[new ot(i,e,"filter array must have at least 1 element")];switch(r=r.concat(ig({key:`${i}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),Hn(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Hn(e[1])==="$type"&&r.push(new ot(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&r.push(new ot(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>
vendor: 6,208 bytes, lines 722-723
722=2&&(a=Hi(e[1]),a!=="string"&&r.push(new ot(`${i}[1]`,e[1],`string expected, ${a} found`)));for(let h=2;h<e.length;h++)a=Hi(e[h]),Hn(e[1])==="$type"?r=r.concat(ig({key:`${i}[${h}]`,value:e[h],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):a!=="string"&&a!=="number"&&a!=="boolean"&&r.push(new ot(`${i}[${h}]`,e[h],`string, number, or boolean expected, ${a} found`));break;case"any":case"all":case"none":for(let h=1;h<e.length;h++)r=r.concat(BC({key:`${i}[${h}]`,value:e[h],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":a=Hi(e[1]),e.length!==2?r.push(new ot(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):a!=="string"&&r.push(new ot(`${i}[1]`,e[1],`string expected, ${a} found`));break}return r}function NC(t,e){let i=t.key,n=t.validateSpec,a=t.style,r=t.styleSpec,h=t.value,m=t.objectKey,b=r[`${e}_${t.layerType}`];if(!b)return[];let T=m.match(/^(.*)-transition$/);if(e==="paint"&&T&&b[T[1]]&&b[T[1]].transition)return n({key:i,value:h,valueSpec:r.transition,style:a,styleSpec:r});let k=t.valueSpec||b[m];if(!k)return[new ot(i,h,`unknown property "${m}"`)];let P;if(Hi(h)==="string"&&y_(k)&&!k.tokens&&(P=/^{([^}]+)}$/.exec(h)))return[new ot(i,h,`"${m}" does not support interpolation syntax
723Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(P[1])} }\`.`)];let F=[];return t.layerType==="symbol"&&(m==="text-field"&&a&&!a.glyphs&&F.push(new ot(i,h,'use of "text-field" requires a style "glyphs" property')),m==="text-font"&&aS(od(h))&&Hn(h.type)==="identity"&&F.push(new ot(i,h,'"text-font" does not support identity functions'))),F.concat(n({key:t.key,value:h,valueSpec:k,style:a,styleSpec:r,expressionContext:"property",propertyType:e,propertyKey:m}))}function VC(t){return NC(t,"paint")}function $C(t){return NC(t,"layout")}function UC(t){let e=[],i=t.value,n=t.key,a=t.style,r=t.styleSpec;!i.type&&!i.ref&&e.push(new ot(n,i,'either "type" or "ref" is required'));let h=Hn(i.type),m=Hn(i.ref);if(i.id){let b=Hn(i.id);for(let T=0;T<t.arrayIndex;T++){let k=a.layers[T];Hn(k.id)===b&&e.push(new ot(n,i.id,`duplicate layer id "${i.id}", previously used at line ${k.id.__line__}`))}}if("ref"in i){["type","source","source-layer","filter","layout"].forEach(T=>{T in i&&e.push(new ot(n,i[T],`"${T}" is prohibited for ref layers`))});let b;a.layers.forEach(T=>{Hn(T.id)===m&&(b=T)}),b?b.ref?e.push(new ot(n,i.ref,"ref cannot reference another ref layer")):h=Hn(b.type):e.push(new ot(n,i.ref,`ref layer "${m}" not found`))}else if(h!=="background")if(!i.source)e.push(new ot(n,i,'missing required property "source"'));else{let b=a.sources&&a.sources[i.source],T=b&&Hn(b.type);b?T==="vector"&&h==="raster"?e.push(new ot(n,i.source,`layer "${i.id}" requires a raster source`)):T!=="raster-dem"&&h==="hillshade"?e.push(new ot(n,i.source,`layer "${i.id}" requires a raster-dem source`)):T==="raster"&&h!=="raster"?e.push(new ot(n,i.source,`layer "${i.id}" requires a vector source`)):T==="vector"&&!i["source-layer"]?e.push(new ot(n,i,`layer "${i.id}" must specify a "source-layer"`)):T==="raster-dem"&&h!=="hillshade"?e.push(new ot(n,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):h==="line"&&i.paint&&i.paint["line-gradient"]&&(T!=="geojson"||!b.lineMetrics)&&e.push(new ot(n,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new ot(n,i.source,`source "${i.source}" not found`))}return e=e.concat(ia({key:n,value:i,valueSpec:r.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*"(){return[]},type(){return t.validateSpec({key:`${n}.type`,value:i.type,valueSpec:r.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:i,objectKey:"type"})},filter:uS,layout(b){return ia({layer:i,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,validateSpec:b.validateSpec,objectElementValidators:{"*"(T){return $C(n_({layerType:h},T))}}})},paint(b){return ia({layer:i,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,validateSpec:b.validateSpec,objectElementValidators:{"*"(T){return VC(n_({layerType:h},T))}}})}}})),e}function ad(t){let e=t.value,i=t.key,n=Hi(e);return n!=="string"?[new ot(i,e,`string expected, ${n} found`)]:[]}function Rz(t){var e;let i=(e=t.sourceName)!==null&&e!==void 0?e:"",n=t.value,a=t.styleSpec,r=a.source_raster_dem,h=t.style,m=[],b=Hi(n);if(n===void 0)return m;if(b!=="object")return m.push(new ot("source_raster_dem",n,`object expected, ${b} found`)),m;let T=Hn(n.encoding)==="custom",k=["redFactor","greenFactor","blueFactor","baseShift"],P=t.value.encoding?`"${t.value.encoding}"`:"Default";for(let F in n)!T&&k.includes(F)?m.push(new ot(F,n[F],`In "${i}": "${F}" is only valid when "encoding" is set to "custom". ${P} encoding found`)):r[F]?m=m.concat(t.validateSpec({key:F,value:n[F],valueSpec:r[F],validateSpec:t.validateSpec,style:h,styleSpec:a})):m.push(new ot(F,n[F],`unknown property "${F}"`));return m}var rC={promoteId:zz};function jC(t){let e=t.value,i=t.key,n=t.styleSpec,a=t.style,r=t.validateSpec;if(!e.type)return[new ot(i,e,'"type" is required')];let h=Hn(e.type),m;switch(h){case"vector":case"raster":return m=ia({key:i,value:e,valueSpec:n[`source_${h.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:rC,validateSpec:r}),m;case"raster-dem":return m=Rz({sourceName:i,value:e,style:t.style,styleSpec:n,validateSpec:r}),m;case"geojson":if(m=ia({key:i,value:e,valueSpec:n.source_geojson,style:a,styleSpec:n,validateSpec:r,objectElementValidators:rC}),e.cluster)for(let b in e.clusterProperties){let[T,k]=e.clusterProperties[b],P=typeof T=="string"?[T,["accumulated"],["get",b]]:T;m.push(...Jp({key:`${i}.${b}.map`,value:k,validateSpec:r,expressionContext:"cluster-map"})),m.push(...Jp({key:`${i}.${b}.reduce`,value:P,validateSpec:r,expressionContext:"cluster-reduce"}))}return m;case"video":return ia({key:i,value:e,valueSpec:n.source_video,style:a,validateSpec:r,styleSpec:n});case"image":return ia({key:i,value:e,valueSpec:n.source_image,style:a,validateSpec:r,styleSpec:n});case"canvas":return[new ot(i,null,"Please use runtime APIs to add canvas sources, rather than 
723including them in stylesheets.","source.canvas")];default:return ig({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:a,validateSpec:r,styleSpec:n})}}function zz({key:t,value:e}){if(Hi(e)==="string")return ad({key:t,value:e});{let i=[];for(let n in e)i.push(...ad({key:`${t}.${n}`,value:e[n]}));return i}}function qC(t){let e=t.value,i=t.styleSpec,n=i.light,a=t.style,r=[],h=Hi(e);if(e===void 0)return r;if(h!=="object")return r=r.concat([new ot("light",e,`object expected, ${h} found`)]),r;for(let m in e){let b=m.match(/^(.*)-transition$/);b&&n[b[1]]&&n[b[1]].transition?r=r.concat(t.validateSpec({key:m,value:e[m],valueSpec:i.transition,validateSpec:t.validateSpec,style:a,styleSpec:i})):n[m]?r=r.concat(t.validateSpec({key:m,value:e[m],valueSpec:n[m],validateSpec:t.validateSpec,style:a,styleSpec:i})):r=r.concat([new ot(m,e[m],`unknown property "${m}"`)])}return r}function HC(t){let e=t.value,i=t.styleSpec,n=i.sky,a=t.style,r=Hi(e);if(e===void 0)return[];if(r!=="object")return[new ot("sky",e,`object expected, ${r} found`)];let h=[];for(let m in e)n[m]?h=h.concat(t.validateSpec({key:m,value:e[m],valueSpec:n[m],style:a,styleSpec:i})):h=h.concat([new ot(m,e[m],`unknown property "${m}"`)]);return h}function WC(t){let e=t.value,i=t.styleSpec,n=i.terrain,a=t.style,r=[],h=Hi(e);if(e===void 0)return r;if(h!=="object")return r=r.concat([new ot("terrain",e,`object expected, ${h} found`)]),r;for(let m in e)n[m]?r=r.concat(t.validateSpec({key:m,value:e[m],valueSpec:n[m],validateSpec:t.validateSpec,style:a,styleSpec:i})):r=r.concat([new ot(m,e[m],`unknown property "${m}"`)]);return r}function Oz(t){return ad(t).length===0?[]:Jp(t)}function Fz(t){return ad(t).length===0?[]:Jp(t)}function Bz(t){let e=t.key,i=t.value;if(Hi(i)==="array"){if(i.length<1||i.length>4)return[new ot(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];let n={type:"number"},a=[];for(let r=0;r<i.length;r++)a=a.concat(t.validateSpec({key:`${e}[${r}]`,value:i[r],validateSpec:t.validateSpec,valueSpec:n}));return a}else return cS({key:e,value:i,valueSpec:{}})}function Nz(t){let e=t.key,i=t.value,n=Hi(i),a=t.styleSpec;if(n!=="array"||i.length<1||i.length%2!==0)return[new ot(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let r=[];for(let h=0;h<i.length;h+=2)r=r.concat(ig({key:`${e}[${h}]`,value:i[h],valueSpec:a.layout_symbol["text-anchor"]})),r=r.concat(lS({key:`${e}[${h+1}]`,value:i[h+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:a}));return r}function GC(t){let e=[],i=t.value,n=t.key;if(Array.isArray(i)){let a=[],r=[];for(let h in i){i[h].id&&a.includes(i[h].id)&&e.push(new ot(n,i,`all the sprites' ids must be unique, but ${i[h].id} is duplicated`)),a.push(i[h].id),i[h].url&&r.includes(i[h].url)&&e.push(new ot(n,i,`all the sprites' URLs must be unique, but ${i[h].url} is duplicated`)),r.push(i[h].url);let m={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(ia({key:`${n}[${h}]`,value:i[h],valueSpec:m,validateSpec:t.validateSpec}))}return e}else return ad({key:n,value:i})}function Vz(t){let e=t.value,i=t.styleSpec,n=i.projection,a=t.style,r=Hi(e);if(e===void 0)return[];if(r!=="object")return[new ot("projection",e,`object expected, ${r} found`)];let h=[];for(let m in e)n[m]?h=h.concat(t.validateSpec({key:m,value:e[m],valueSpec:n[m],style:a,styleSpec:i})):h=h.concat([new ot(m,e[m],`unknown property "${m}"`)]);return h}var sC={"*"(){return[]},array:lS,boolean:Pz,number:cS,color:Dz,constants:OC,enum:ig,filter:uS,function:FC,layer:UC,object:ia,source:jC,light:qC,sky:HC,terrain:WC,projection:Vz,string:ad,formatted:Oz,resolvedImage:Fz,padding:Bz,variableAnchorOffsetCollection:Nz,sprite:GC};function jm(t){let e=t.value,i=t.valueSpec,n=t.styleSpec;return t.validateSpec=jm,i.expression&&aS(Hn(e))?FC(t):i.expression&&DC(od(e))?Jp(t):i.type&&sC[i.type]?sC[i.type](t):ia(n_({},t,{valueSpec:i.type?n[i.type]:i}))}function ZC(t){let e=t.value,i=t.key,n=ad(t);return n.length||(e.indexOf("{fontstack}")===-1&&n.push(new ot(i,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&n.push(new ot(i,e,'"glyphs" url must include a "{range}" token'))),n}function na(t,e=bR){let i=[];return i=i.concat(jm({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:jm,objectElementValidators:{glyphs:ZC,"*"(){return[]}}})),t.constants&&(i=i.concat(OC({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:jm}))),KC(i)}na.source=Pl(Ll(jC));na.sprite=Pl(Ll(GC));na.glyphs=Pl(Ll(ZC));na.light=Pl(Ll(qC));na.sky=Pl(Ll(HC));na.terrain=Pl(Ll(WC));na.layer=Pl(Ll(UC));na.filter=Pl(Ll(uS));na.paintProperty=Pl(Ll(VC));na.layoutProperty=Pl(Ll($C));function Ll(t){return function(e){return t({...e,validateSpec:jm})}}function KC(t){return[].concat(t).sort((e,i)=>e.line-i.line)}function Pl(t){return function(...e){return KC(t.apply(this,e))}}function oC(t){if(!t)return{style:Yh[Xh[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!0};if(typeof t=="string"){let e=Uz(t);return e.isValidStyle?{style:e.styleObject,requiresUrlMonitoring:!1,isFallback:!1}:e.isValidJSON?{style:Yh[Xh[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!0}:t.startsWith("http")?{style:t,requiresUrlMonitoring:!0,isFallback:!1}:t.toLowerCase().includes(".json")?{style:$z(t),requiresUrlMonitoring:!0,isFallback:!1}:{style:j0(t),requiresUrlMonitoring:!0,isFallback:!1}}return t instanceof Np?{style:t.getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!1}:t instanceof Vp?{style:t.getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!1}:na(t).length===0?{style:t,requiresUrlMonitoring:!1,isFallback:!1}:{style:Yh[Xh[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!0}}function $z(t){try{return new URL(t).href}catch{}return new URL(t,location.origin).href}function Uz(t){try{let e=JSON.parse(t),i=na(e);return{isValidJSON:!0,isValidStyle:i.length===0,styleObject:i.length===0?e:null}}catch{return{isValidJSON:!1,isValidStyle:!1,styleObject:null}}}var Yw=class{constructor(){Bi(this,"_map"),Bi(this,"_container"),Bi(this,"_terrainButton"),SD(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(e){return this._map=e,this._container=Zp("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=Zp("button","maplibregl-ctrl-terrain",this._container),Zp("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.t
723ype="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){pC(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.hasTerrain()?this._map.disableTerrain():this._map.enableTerrain(),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.hasTerrain()?(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"))}},Jw=class extends Hm{constructor(e={}){super({showCompass:e.showCompass??!0,showZoom:e.showZoom??!0,visualizePitch:e.visualizePitch??!0}),Bi(this,"_rotateCompassArrow",()=>{let i=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.cos(this._map.transform.pitch*(Math.PI/180))**.5)}) rotateX(${Math.min(70,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._compass&&(this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",i=>{this._map.getPitch()===0?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:i}):this._map.resetNorth({},{originalEvent:i})}))}_createButton(e,i){let n=super._createButton(e,i);return n.clickFunction=i,n}},aC=St.default.Marker,lC=St.default.LngLat,jz=St.default.LngLatBounds,Qw=class extends Wm{constructor(){super(...arguments),Bi(this,"lastUpdatedCenter",new lC(0,0)),Bi(this,"_updateCamera",e=>{var i,n;let a=new lC(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,h={bearing:this._map.getBearing(),...this.options.fitBoundsOptions,linear:!0},m=this._map.getZoom();m>(((n=(i=this.options)==null?void 0:i.fitBoundsOptions)==null?void 0:n.maxZoom)??30)&&(h.zoom=m),this._map.fitBounds(jz.fromLngLat(a,r),h,{geolocateSource:!0});let b=!1,T=()=>{b=!0};this._map.once("click",T),this._map.once("dblclick",T),this._map.once("dragstart",T),this._map.once("mousedown",T),this._map.once("touchstart",T),this._map.once("wheel",T),this._map.once("moveend",()=>{this._map.off("click",T),this._map.off("dblclick",T),this._map.off("dragstart",T),this._map.off("mousedown",T),this._map.off("touchstart",T),this._map.off("wheel",T),!b&&(this.lastUpdatedCenter=this._map.getCenter())})}),Bi(this,"_finishSetupUI",e=>{if(this._map){if(e===!1){let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{let i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Zp("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new aC({element:this._dotElement}),this._circleElement=Zp("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new aC({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",i=>{let n=i.originalEvent&&i.originalEvent.type==="resize",a=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!i.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!n&&a>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))})}}),Bi(this,"_onZoom",()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()})}_updateCircleRadius(){if(this._watchState!=="BACKGROUND"&&this._watchState!=="ACTIVE_LOCK")return;let e=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],i=this._map.project(e),n=this._map.unproject([i.x,i.y]),a=this._map.unproject([i.x+20,i.y]),r=n.distanceTo(a)/20,h=Math.ceil(2*this._accuracy/r);this._circleElement.style.width=`${h}px`,this._circleElement.style.height=`${h}px`}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_E
723RROR",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;case"BACKGROUND_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}},Ao,Al,ed,td,Qo,e_,$s,XC,ea,YC,qm=class{constructor(e,i){Jh(this,$s),Jh(this,Ao),Bi(this,"map"),Jh(this,Al),Jh(this,ed),Jh(this,td),Jh(this,Qo,!1),Jh(this,e_),e.style!==void 0&&Hp(this,Qo,!0),Hp(this,Ao,{zoomAdjust:-4,position:"top-right",...i,forceNoAttributionControl:!0,attributionControl:!1,navigationControl:!1,geolocateControl:!1,maptilerLogo:!1,minimap:!1,hash:!1,pitchAdjust:!1,...e,containerStyle:{border:"1px solid #000",width:"400px",height:"300px",...e.containerStyle??{}}}),e.lockZoom!==void 0&&(Ai(this,Ao).minZoom=e.lockZoom,Ai(this,Ao).maxZoom=e.lockZoom)}setStyle(e,i){Ai(this,Qo)||this.map.setStyle(e,i),Mo(this,$s,ea).call(this)}addLayer(e,i){return Ai(this,Qo)||this.map.addLayer(e,i),Mo(this,$s,ea).call(this),this.map}moveLayer(e,i){return Ai(this,Qo)||this.map.moveLayer(e,i),Mo(this,$s,ea).call(this),this.map}removeLayer(e){return Ai(this,Qo)||this.map.removeLayer(e),Mo(this,$s,ea).call(this),this}setLayerZoomRange(e,i,n){return Ai(this,Qo)||this.map.setLayerZoomRange(e,i,n),Mo(this,$s,ea).call(this),this}setFilter(e,i,n){return Ai(this,Qo)||this.map.setFilter(e,i,n),Mo(this,$s,ea).call(this),this}setPaintProperty(e,i,n,a){return Ai(this,Qo)||this.map.setPaintProperty(e,i,n,a),Mo(this,$s,ea).call(this),this}setLayoutProperty(e,i,n,a){return Ai(this,Qo)||this.map.setLayoutProperty(e,i,n,a),Mo(this,$s,ea).call(this),this}setGlyphs(e,i){return Ai(this,Qo)||this.map.setGlyphs(e,i),Mo(this,$s,ea).call(this),this}onAdd(e){Hp(this,Al,e),Hp(this,ed,Zp("div","maplibregl-ctrl maplibregl-ctrl-group"));for(let[i,n]of Object.entries(Ai(this,Ao).containerStyle))Ai(this,ed).style.setProperty(i,n);return Ai(this,Ao).container=Ai(this,ed),Ai(this,Ao).zoom=e.getZoom()+Ai(this,Ao).zoomAdjust,this.map=new Ac(Ai(this,Ao)),this.map.once("style.load",()=>{this.map.resize()}),this.map.once("load",()=>{Mo(this,$s,XC).call(this,Ai(this,Ao).parentRect),Hp(this,e_,Mo(this,$s,YC).call(this))}),Ai(this,ed)}onRemove(){var e;(e=Ai(this,e_))==null||e.call(this),pC(Ai(this,ed))}};Ao=new WeakMap,Al=new WeakMap,ed=new WeakMap,td=new WeakMap,Qo=new WeakMap,e_=new WeakMap,$s=new WeakSet,XC=function(t){t===void 0||t.linePaint===void 0&&t.fillPaint===void 0||(Hp(this,td,{type:"Feature",properties:{name:"parentRect"},geometry:{type:"Polygon",coordinates:[[[],[],[],[],[]]]}}),this.map.addSource("parentRect",{type:"geojson",data:Ai(this,td)}),(t.lineLayout!==void 0||t.linePaint!==void 0)&&this.map.addLayer({id:"parentRectOutline",type:"line",source:"parentRect",layout:{...t.lineLayout},paint:{"line-color":"#FFF","line-width":1,"line-opacity":.85,...t.linePaint}}),t.fillPaint!==void 0&&this.map.addLayer({id:"parentRectFill",type:"fill",source:"parentRect",layout:{},paint:{"fill-color":"#08F","fill-opacity":.135,...t.fillPaint}}),Mo(this,$s,ea).call(this))},ea=function(){if(Ai(this,td)===void 0)return;let{devicePixelRatio:t}=window,e=Ai(this,Al).getCanvas(),i=e.width/t,n=e.height/t,a=Ai(this,Al).unproject.bind(Ai(this,Al)),r=a([0,0]),h=a([i,0]),m=a([0,n]),b=a([i,n]);Ai(this,td).geometry.coordinates=[[m.toArray(),b.toArray(),h.toArray(),r.toArray(),m.toArray()]],this.map.getSource("parentRect").setData(Ai(this,td))},YC=function(){let{pitchAdjust:t}=Ai(this,Ao),e=()=>{r("parent")},i=()=>{r("minimap")},n=()=>{Ai(this,Al).on("move",e),this.map.on("move",i)},a=()=>{Ai(this,Al).off("move",e),this.map.off("move",i)},r=h=>{a();let m=h==="parent"?Ai(this,Al):this.map,b=h==="parent"?this.map:Ai(this,Al),T=m.getCenter(),k=m.getZoom()+Ai(this,Ao).zoomAdjust*(h==="parent"?1:-1),P=m.getBearing(),F=m.getPitch();b.jumpTo({center:T,zoom:k,bearing:P,pitch:t?F:0}),Mo(this,$s,ea).call(this),n()};return n(),()=>{a()}};var qz={POINT:"POINT",COUNTRY:"COUNTRY"},Ac=class extends St.default.Map{constructor(e){kD(e.container),e.apiKey&&(pr.apiKey=e.apiKey);let{style:i,requiresUrlMonitoring:n,isFallback:a}=oC(e.style);a&&console.warn("Invalid style. A style must be a valid URL to a style.json, a JSON string representing a valid StyleSpecification or a valid StyleSpecification object. Fallback to default MapTiler style."),pr.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!");let r=location.hash,h={compact:!1};e.customAttribution?h.customAttribution=e.customAttribution:e.attributionControl&&typeof e.attributionControl
723=="object"&&(h={...h,...e.attributionControl});let m={...e,style:i,maplibreLogo:!1,transformRequest:Sk(e.transformRequest),attributionControl:e.forceNoAttributionControl===!0?!1:h};delete m.style,super(m),Bi(this,"isTerrainEnabled",!1),Bi(this,"terrainExaggeration",1),Bi(this,"primaryLanguage"),Bi(this,"terrainGrowing",!1),Bi(this,"terrainFlattening",!1),Bi(this,"minimap"),Bi(this,"forceLanguageUpdate"),Bi(this,"languageAlwaysBeenStyle"),Bi(this,"isReady",!1),Bi(this,"terrainAnimationDuration",1e3),Bi(this,"monitoredStyleUrls"),Bi(this,"styleInProcess",!1),Bi(this,"originalLabelStyle",new window.Map),Bi(this,"isStyleLocalized",!1),this.setStyle(i),n&&this.monitorStyleUrl(i);let b=()=>{let U="The distant style could not be loaded.";this.getStyle()?U+="Leaving the style as is.":(this.setStyle(Yh.STREETS),U+=`Loading default MapTiler Cloud style "${Yh.STREETS.getDefaultVariant().getId()}" as a fallback.`),console.warn(U)};if(this.on("style.load",()=>{this.styleInProcess=!1}),this.on("error",U=>{if(U.error instanceof St.default.AJAXError){let X=U.error.url,Y=new URL(X);Y.search="";let te=Y.href;this.monitoredStyleUrls&&this.monitoredStyleUrls.has(te)&&(this.monitoredStyleUrls.delete(te),b());return}if(this.styleInProcess)return b()}),pr.caching&&!Ew&&console.warn("The cache API is only available in secure contexts. More info at https://developer.mozilla.org/en-US/docs/Web/API/Cache"),pr.caching&&Ew&&xD(),typeof e.language>"u")this.primaryLanguage=pr.primaryLanguage;else{let U=$0(e.language,Li);this.primaryLanguage=U??pr.primaryLanguage}this.forceLanguageUpdate=!(this.primaryLanguage===Li.STYLE||this.primaryLanguage===Li.STYLE_LOCK),this.languageAlwaysBeenStyle=this.primaryLanguage===Li.STYLE,this.terrainExaggeration=e.terrainExaggeration??this.terrainExaggeration,this.once("styledata",async()=>{if(!e.geolocate||e.center||e.hash&&r)return;try{if(e.geolocate===qz.COUNTRY){await this.fitToIpBounds();return}}catch(X){console.warn(X.message)}let U;try{await this.centerOnIpPoint(e.zoom),U=this.getCameraHash()}catch(X){console.warn(X.message)}(await navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(X=>{U===this.getCameraHash()&&(this.terrain?this.easeTo({center:[X.coords.longitude,X.coords.latitude],zoom:e.zoom||12,duration:2e3}):this.once("terrain",()=>{this.easeTo({center:[X.coords.longitude,X.coords.latitude],zoom:e.zoom||12,duration:2e3})}))},null,{maximumAge:24*3600*1e3,timeout:5e3,enableHighAccuracy:!1})}),this.on("styledata",()=>{this.setPrimaryLanguage(this.primaryLanguage)}),this.on("styledata",()=>{this.getTerrain()===null&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)}),this.once("load",async()=>{let U={logo:null};try{let X=Object.keys(this.style.sourceCaches).map(te=>this.getSource(te)).filter(te=>te&&"url"in te&&typeof te.url=="string"&&te?.url.includes("tiles.json")),Y=new URL(X[0].url);Y.searchParams.has("key")||Y.searchParams.append("key",pr.apiKey),U=await(await fetch(Y.href)).json()}catch{}if(e.forceNoAttributionControl!==!0)if("logo"in U&&U.logo){let X=U.logo;this.addControl(new i_({logoURL:X}),e.logoPosition)}else e.maptilerLogo&&this.addControl(new i_,e.logoPosition);if(e.scaleControl){let X=e.scaleControl===!0||e.scaleControl===void 0?"bottom-right":e.scaleControl,Y=new Lw({unit:pr.unit});this.addControl(Y,X),pr.on("unit",te=>{Y.setUnit(te)})}if(e.navigationControl!==!1){let X=e.navigationControl===!0||e.navigationControl===void 0?"top-right":e.navigationControl;this.addControl(new Jw,X)}if(e.geolocateControl!==!1){let X=e.geolocateControl===!0||e.geolocateControl===void 0?"top-right":e.geolocateControl;this.addControl(new Qw({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),X)}if(e.terrainControl){let X=e.terrainControl===!0||e.terrainControl===void 0?"top-right":e.terrainControl;this.addControl(new Yw,X)}if(e.fullscreenControl){let X=e.fullscreenControl===!0||e.fullscreenControl===void 0?"top-right":e.fullscreenControl;this.addControl(new Pw({}),X)}this.isReady=!0,this.fire("ready",{target:this})});let T=!1,k=!1,P;this.once("ready",()=>{T=!0,k&&this.fire("loadWithTerrain",P)}),this.once("style.load",()=>{let{minimap:U}=e;if(typeof U=="object"){let{zoom:X,center:Y,style:te,language:le,apiKey:we,maptilerLogo:Le,antialias:Oe,refreshExpiredTiles:ze,maxBounds:Xe,scrollZoom:Ke,minZoom:rt,maxZoom:at,boxZoom:$t,locale:Tt,fadeDuration:Lt,crossSourceCollisions:Di,clickTolerance:mn,bounds:Bt,fitBoundsOptions:oi,pixelRatio:Si,validateStyle:Gi}=e;this.minimap=new qm(U,{zoom:X,center:Y,style:te,language:le,apiKey:we,container:"null",maptilerLogo:Le,antialias:Oe,refreshExpiredTiles:ze,maxBounds:Xe,scrollZoom:Ke,minZoom:rt,maxZoom:at,boxZoom:$t,locale:Tt,fadeDuration:Lt,crossSourceCollisions:Di,clickTolerance:mn,bounds:Bt,fitBoundsOptions:oi,pixelRatio:Si,validateStyle:Gi}),this.addControl(this.minimap,U.position??"bottom-left")}else U===!0?(this.minimap=new qm({},e),this.addControl(this.minimap,"bottom-left")):U!==void 0&&U!==!1&&(this.minimap=new qm({},e),this.addControl(this.minimap,U))});let F=U=>{U.terrain&&(k=!0,P={type:"loadWithTerrain",target:this,terrain:U.terrain},this.off("terrain",F),T&&this.fire("loadWithTerrain",P))};this.on("terrain",F),e.terrain&&this.enableTerrain(e.terrainExaggeration??this.terrainExaggeration),this.once("load",()=>{this.getCanvas().addEventListener("webglcontextlost",U=>{console.warn(U),CD(e.container),this.fire("webglContextLost",{error:U})})})}setTerrainAnimationDuration(e){this.terrainAnimationDuration=Math.max(e,0)}async onLoadAsync(){return new Promise(e=>{if(this.loaded())return e(this);this.once("load",()=>{e(this)})})}async onReadyAsync(){return new Promise(e=>{if(this.isReady)return e(this);this.once("ready",()=>{e(this)})})}async onLoadWithTerrainAsync(){return new Promise(e=>{if(this.isReady&&this.terrain)return e(this);this.once("loadWithTerrain",()=>{e(this)})})}monitorStyleUrl(e){typeof this.monitoredStyleUrls>"u"&&(this.monitoredStyleUrls=new Set);let i=new URL(e);i.search="",this.monitoredStyleUrls.add(i.href)}setStyle(e,i){var n;this.originalLabelStyle.clear(),(n=this.minimap)==null||n.setStyle(e),this.forceLanguageUpdate=!0,this.once("idle",()=>{this.forceLanguageUpdate=!1});let a=oC(e);if(a.requiresUrlMonitoring&&this.monitorStyleUrl(a.style),a.isFallback){if(this.getStyle())return console.warn("Invalid style. A style must be a valid URL to a style.json, a JSON string representing a valid StyleSpecification or a valid StyleSpecification object. Keeping the curent style instead."),this;console.warn("Invalid style. A style must be a valid URL to a style.json, a JSON string representing a valid StyleSpecification or a valid StyleSpecification object. Fallback to default MapTiler style.")}return this.styleInProcess=!0,super.setStyle(a.style,i),this}addLayer(e,i){var n;return(n=this.minimap)==null||n.addLayer(e,i),super.addLayer(e,i)}moveLayer(e,i){var n;return(n=this.minimap)==null||n.moveLayer(e,i),super.moveLayer(e,i)}removeLayer(e){var i;return(i=this.minimap)==null||i.removeLayer(e),super.removeLayer(e)}setLayerZoomRange(e,i,n){var a;return(a=this.minimap)==null||a.setLayerZoomRange(e,i,n),super.setLayerZoomRange(e,i,n)}setFilter(e,i,n){var a;return(a=this.minimap)==null||a.setFilter(e,i,n),super.setFilter(e,i,n)}setPaintProperty(e,i,n,a){var r;return(r=this.minimap)==null||r.setPaintProperty(e,i,n,a),super.setPaintProperty(e,i,n,a)}setLayoutProperty(e,i,n,a){var r;return(r=this.minimap)==null||r.setLayoutProperty(e,i,n,a),super.setLayoutProperty(e,i,n,a)}setGlyphs(e,i){var n;return(n=this.minimap)==null||n.setGlyphs(e,i),super.setGlyphs(e,i)}getStyleLanguage(){return!this.style||!this.style.stylesheet||!this.style.stylesheet.metadata||typeof this.style.stylesheet.metadata!="object"?null:"maptiler:language"in this.style.stylesheet.metadata&&typeof this.style.stylesheet.metadata["maptiler:language"]=="str
723ing"?Bm(this.style.stylesheet.metadata["maptiler:language"]):null}setLanguage(e){var i,n;(n=(i=this.minimap)==null?void 0:i.map)==null||n.setLanguage(e),this.onStyleReady(()=>{this.setPrimaryLanguage(e)})}setPrimaryLanguage(e){let i=this.getStyleLanguage(),n=$0(e,Li);if(!n){console.warn(`The language "${n}" is not supported.`);return}if(!(n.flag===Li.STYLE.flag&&i&&(i.flag===Li.AUTO.flag||i.flag===Li.VISITOR.flag))&&(n.flag!==Li.STYLE.flag&&(this.languageAlwaysBeenStyle=!1),this.languageAlwaysBeenStyle||this.primaryLanguage===n&&!this.forceLanguageUpdate))return;if(this.primaryLanguage.flag===Li.STYLE_LOCK.flag){console.warn("The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag.");return}this.primaryLanguage=n;let a=n;if(n.flag===Li.STYLE.flag){if(!i){console.warn("The style has no default languages or has an invalid one.");return}a=i}let r=Li.LOCAL.flag,h=["get",r];a.flag===Li.VISITOR.flag?(r=vk().flag,h=["case",["all",["has",r],["has",Li.LOCAL.flag]],["case",["==",["get",r],["get",Li.LOCAL.flag]],["get",Li.LOCAL.flag],["format",["get",r],{"font-scale":.8},`
724`,["get",Li.LOCAL.flag],{"font-scale":1.1}]],["get",Li.LOCAL.flag]]):a.flag===Li.VISITOR_ENGLISH.flag?(r=Li.ENGLISH.flag,h=["case",["all",["has",r],["has",Li.LOCAL.flag]],["case",["==",["get",r],["get",Li.LOCAL.flag]],["get",Li.LOCAL.flag],["format",["get",r],{"font-scale":.8},`
725`,["get",Li.LOCAL.flag],{"font-scale":1.1}]],["get",Li.LOCAL.flag]]):a.flag===Li.AUTO.flag?(r=vk().flag,h=["coalesce",["get",r],["get",Li.LOCAL.flag]]):a===Li.LOCAL?(r=Li.LOCAL.flag,h=["get",r]):(r=a.flag,h=["coalesce",["get",r],["get",Li.LOCAL.flag]]);let{layers:m}=this.getStyle(),b=this.originalLabelStyle.size===0;if(b){let T=DD(m,this);this.isStyleLocalized=Object.keys(T.localized).length>0}for(let T of m){if(T.type!=="symbol")continue;let k=T,P=this.getSource(k.source);if(!P||!("url"in P&&typeof P.url=="string")||new URL(P.url).host!==io.maptilerApiHost)continue;let{id:F,layout:U}=k;if(!U||!("text-field"in U))continue;let X;if(b?(X=this.getLayoutProperty(F,"text-field"),this.originalLabelStyle.set(F,X)):X=this.originalLabelStyle.get(F),typeof X=="string"){let{contains:Y,exactMatch:te}=AD(X,this.isStyleLocalized);if(!Y)continue;if(te)this.setLayoutProperty(F,"text-field",h);else{let le=ED(X,h,this.isStyleLocalized);this.setLayoutProperty(F,"text-field",le)}}else{let Y=MD(X,h,this.isStyleLocalized);this.setLayoutProperty(F,"text-field",Y)}}}getPrimaryLanguage(){return this.primaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}growTerrain(e){if(!this.terrain)return;let i=performance.now(),n=this.terrain.exaggeration,a=e-n,r=()=>{if(!this.terrain||this.terrainFlattening)return;let h=(performance.now()-i)/this.terrainAnimationDuration;if(h<.99){let m=1-(1-h)**4,b=n+m*a;this.terrain.exaggeration=b,requestAnimationFrame(r)}else this.terrainGrowing=!1,this.terrainFlattening=!1,this.terrain.exaggeration=e,this.fire("terrainAnimationStop",{terrain:this.terrain});this._elevationFreeze=!1,this.triggerRepaint()};!this.terrainGrowing&&!this.terrainFlattening&&this.fire("terrainAnimationStart",{terrain:this.terrain}),this.terrainGrowing=!0,this.terrainFlattening=!1,requestAnimationFrame(r)}enableTerrain(e=this.terrainExaggeration){if(e<0){console.warn("Terrain exaggeration cannot be negative.");return}let i=async a=>{!this.terrain||a.type!=="data"||a.dataType!=="source"||!("source"in a)||a.sourceId!=="maptiler-terrain"||a.source.type!=="raster-dem"||a.isSourceLoaded&&(this.off("data",i),this.growTerrain(e))},n=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=e,this.on("data",i),this.addSource(io.terrainSourceId,{type:"raster-dem",url:io.terrainSourceURL}),this.setTerrain({source:io.terrainSourceId,exaggeration:0})};if(this.getTerrain()){this.isTerrainEnabled=!0,this.growTerrain(e);return}this.loaded()||this.isTerrainEnabled?n():this.once("load",()=>{this.getTerrain()&&this.getSource(io.terrainSourceId)||n()})}disableTerrain(){if(!this.terrain)return;this.isTerrainEnabled=!1;let e=performance.now(),i=this.terrain.exaggeration,n=()=>
725{if(!this.terrain||this.terrainGrowing)return;let a=(performance.now()-e)/this.terrainAnimationDuration;if(this._elevationFreeze=!1,a<.99){let r=(1-a)**4,h=i*r;this.terrain.exaggeration=h,requestAnimationFrame(n)}else this.terrain.exaggeration=0,this.terrainGrowing=!1,this.terrainFlattening=!1,this.setTerrain(),this.getSource(io.terrainSourceId)&&this.removeSource(io.terrainSourceId),this.fire("terrainAnimationStop",{terrain:null});this.triggerRepaint()};!this.terrainGrowing&&!this.terrainFlattening&&this.fire("terrainAnimationStart",{terrain:this.terrain}),this.terrainGrowing=!1,this.terrainFlattening=!0,requestAnimationFrame(n)}setTerrainExaggeration(e,i=!0){!i&&this.terrain?(this.terrainExaggeration=e,this.terrain.exaggeration=e,this.triggerRepaint()):this.enableTerrain(e)}onStyleReady(e){this.isStyleLoaded()?e():this.once("styledata",()=>{e()})}async fitToIpBounds(){let e=await U0.info();this.fitBounds(e.country_bounds,{duration:0,padding:100})}async centerOnIpPoint(e){let i=await U0.info();this.jumpTo({center:[i?.longitude??0,i?.latitude??0],zoom:e||11})}getCameraHash(){let e=new Float32Array(5),i=this.getCenter();return e[0]=i.lng,e[1]=i.lat,e[2]=this.getZoom(),e[3]=this.getPitch(),e[4]=this.getBearing(),_k.fromUint8Array(new Uint8Array(e.buffer))}getSdkConfig(){return pr}getMaptilerSessionId(){return hC}setTransformRequest(e){return super.setTransformRequest(Sk(e)),this}};function J0(t){let e=t.toString(16);return e.length===1?`0${e}`:e}function Hz(t){return`#${J0(t[0])}${J0(t[1])}${J0(t[2])}${t.length===4?J0(t[3]):""}`}var Vt=class t extends Array{constructor(e={}){super(),Bi(this,"min",0),Bi(this,"max",1),"min"in e&&(this.min=e.min),"max"in e&&(this.max=e.max),"stops"in e&&this.setStops(e.stops,{clone:!1})}static fromArrayDefinition(e){return new t({stops:e.map(i=>({value:i[0],color:i[1]}))})}setStops(e,i={clone:!0}){let n=i.clone?this.clone():this;n.length=0;let a=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(let h=0;h<e.length;h+=1)a=Math.min(a,e[h].value),r=Math.max(r,e[h].value),n.push({value:e[h].value,color:e[h].color.slice()});return n.sort((h,m)=>h.value<m.value?-1:1),this.min=a,this.max=r,n}scale(e,i,n={clone:!0}){let a=n.clone,r=this[0].value,h=this.at(-1).value-r,m=i-e,b=[];for(let T=0;T<this.length;T+=1){let k=(this[T].value-r)/h*m+e;a?b.push({value:k,color:this[T].color.slice()}):this[T].value=k}return a?new t({stops:b}):this}at(e){return e<0?this[this.length+e]:this[e]}clone(){return new t({stops:this.getRawColorStops()})}getRawColorStops(){let e=[];for(let i=0;i<this.length;
725i+=1)e.push({value:this[i].value,color:this[i].color});return e}reverse(e={clone:!0}){let i=e.clone?this.clone():this;for(let n=0;n<~~(i.length/2);n+=1){let a=i[n].color;i[n].color=i.at(-(n+1)).color,i.at(-(n+1)).color=a}return i}getBounds(){return{min:this.min,max:this.max}}getColor(e,i={smooth:!0}){if(e<=this[0].value)return this[0].color;if(e>=this.at(-1).value)return this.at(-1).color;for(let n=0;n<this.length-1;n+=1){if(e>this[n+1].value)continue;let a=this[n].color;if(!i.smooth)return a.slice();let r=this[n].value,h=this[n+1].value,m=this[n+1].color,b=(h-e)/(h-r);return a.map((T,k)=>Math.round(T*b+m[k]*(1-b)))}return[0,0,0]}getColorHex(e,i={smooth:!0,withAlpha:!1}){return Hz(this.getColor(e,i))}getColorRelative(e,i={smooth:!0}){let n=this.getBounds();return this.getColor(n.min+e*(n.max-n.min),i)}getCanvasStrip(e={horizontal:!0,size:512,smooth:!0}){let i=document.createElement("canvas");i.width=e.horizontal?e.size:1,i.height=e.horizontal?1:e.size;let n=i.getContext("2d");if(!n)throw new Error("Canvs context is missing");let a=n.getImageData(0,0,i.width,i.height),r=a.data,h=e.size,m=this[0].value,b=(this.at(-1).value-m)/h;for(let T=0;T<h;T+=1){let k=this.getColor(m+T*b,{smooth:e.smooth});r[T*4]=k[0],r[T*4+1]=k[1],r[T*4+2]=k[2],r[T*4+3]=k.length>3?k[3]:255}return n.putImageData(a,0,0),i}resample(e,i=15){let n=this.getBounds(),a=this.scale(0,1),r=1/(i-1),h;if(e==="ease-in-square")h=Array.from({length:i},(m,b)=>{let T=b*r,k=T**2,P=a.getColor(k);return{value:T,color:P}});else if(e==="ease-out-square")h=Array.from({length:i},(m,b)=>{let T=b*r,k=1-(1-T)**2,P=a.getColor(k);return{value:T,color:P}});else if(e==="ease-out-sqrt")h=Array.from({length:i},(m,b)=>{let T=b*r,k=T**.5,P=a.getColor(k);return{value:T,color:P}});else if(e==="ease-in-sqrt")h=Array.from({length:i},(m,b)=>{let T=b*r,k=1-(1-T)**.5,P=a.getColor(k);return{value:T,color:P}});else if(e==="ease-out-exp")h=Array.from({length:i},(m,b)=>{let T=b*r,k=1-2**(-10*T),P=a.getColor(k);return{value:T,color:P}});else if(e==="ease-in-exp")h=Array.from({length:i},(m,b)=>{let T=b*r,k=2**(10*T-10),P=a.getColor(k);return{value:T,color:P}});else throw new Error("Invalid ressampling method.");return new t({stops:h}).scale(n.min,n.max)}transparentStart(){let e=this.getRawColorStops();e.unshift({value:e[0].value,color:e[0].color.slice()}),e[1].value+=.001;for(let i of e)i.color.length===3&&i.color.push(255);return e[0].color[3]=0,new t({stops:e})}hasTransparentStart(){return this[0].color.length===4&&this[0].color[3]===0}},gV={NULL:new Vt({stops:[{value:0,color:[0,0,0,0]},{value:1,color:[0,0,0,0]}]}),GRAY:new Vt({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),JET:new Vt({stops:[{value:0,color:[0,0,131]},{value:.125,color:[0,60,170]},{value:.375,color:[5,255,255]},{value:.625,color:[255,255,0]},{value:.875,color:[250,0,0]},{value:1,color:[128,0,0]}]}),HSV:new Vt({stops:[{value:0,color:[255,0,0]},{value:.169,color:[253,255,2]},{value:.173,color:[247,255,2]},{value:.337,color:[0,252,4]},{value:.341,color:[0,252,10]},{value:.506,color:[1,249,255]},{value:.671,color:[2,0,253]},{value:.675,color:[8,0,253]},{value:.839,color:[255,0,251]},{value:.843,color:[255,0,245]},{value:1,color:[255,0,6]}]}),HOT:new Vt({stops:[{value:0,color:[0,0,0]},{value:.3,color:[230,0,0]},{value:.6,color:[255,210,0]},{value:1,color:[255,255,255]}]}),SPRING:new Vt({stops:[{value:0,color:[255,0,255]},{value:1,color:[255,255,0]}]}),SUMMER:new Vt({stops:[{value:0,color:[0,128,102]},{value:1,color:[255,255,102]}]}),AUTOMN:new Vt({stops:[{value:0,color:[255,0,0]},{value:1,color:[255,255,0]}]}),WINTER:new Vt({stops:[{value:0,color:[0,0,255]},{value:1,color:[0,255,128]}]}),BONE:new Vt({stops:[{value:0,color:[0,0,0]},{value:.376,color:[84,84,116]},{value:.753,color:[169,200,200]},{value:1,color:[255,255,255]}]}),COPPER:new Vt({stops:[{value:0,color:[0,0,0]},{value:.804,color:[255,160,102]},{value:1,color:[255,199,127]}]}),GREYS:new Vt({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),YIGNBU:new Vt({stops:[{value:0,color:[8,29,88]},{value:.125,color:[37,52,148]},{value:.25,color:[34,94,168]},{value:.375,color:[29,145,192]},{value:.5,color:[65,182,196]},{value:.625,color:[127,205,187]}
725,{value:.75,color:[199,233,180]},{value:.875,color:[237,248,217]},{value:1,color:[255,255,217]}]}),GREENS:new Vt({stops:[{value:0,color:[0,68,27]},{value:.125,color:[0,109,44]},{value:.25,color:[35,139,69]},{value:.375,color:[65,171,93]},{value:.5,color:[116,196,118]},{value:.625,color:[161,217,155]},{value:.75,color:[199,233,192]},{value:.875,color:[229,245,224]},{value:1,color:[247,252,245]}]}),YIORRD:new Vt({stops:[{value:0,color:[128,0,38]},{value:.125,color:[189,0,38]},{value:.25,color:[227,26,28]},{value:.375,color:[252,78,42]},{value:.5,color:[253,141,60]},{value:.625,color:[254,178,76]},{value:.75,color:[254,217,118]},{value:.875,color:[255,237,160]},{value:1,color:[255,255,204]}]}),BLUERED:new Vt({stops:[{value:0,color:[0,0,255]},{value:1,color:[255,0,0]}]}),RDBU:new Vt({stops:[{value:0,color:[5,10,172]},{value:.35,color:[106,137,247]},{value:.5,color:[190,190,190]},{value:.6,color:[220,170,132]},{value:.7,color:[230,145,90]},{value:1,color:[178,10,28]}]}),PICNIC:new Vt({stops:[{value:0,color:[0,0,255]},{value:.1,color:[51,153,255]},{value:.2,color:[102,204,255]},{value:.3,color:[153,204,255]},{value:.4,color:[204,204,255]},{value:.5,color:[255,255,255]},{value:.6,color:[255,204,255]},{value:.7,color:[255,153,255]},{value:.8,color:[255,102,204]},{value:.9,color:[255,102,102]},{value:1,color:[255,0,0]}]}),RAINBOW:new Vt({stops:[{value:0,color:[150,0,90]},{value:.125,color:[0,0,200]},{value:.25,color:[0,25,255]},{value:.375,color:[0,152,255]},{value:.5,color:[44,255,150]},{value:.625,color:[151,255,0]},{value:.75,color:[255,234,0]},{value:.875,color:[255,111,0]},{value:1,color:[255,0,0]}]}),PORTLAND:new Vt({stops:[{value:0,color:[12,51,131]},{value:.25,color:[10,136,186]},{value:.5,color:[242,211,56]},{value:.75,color:[242,143,56]},{value:1,color:[217,30,30]}]}),BLACKBODY:new Vt({stops:[{value:0,color:[0,0,0]},{value:.2,color:[230,0,0]},{value:.4,color:[230,210,0]},{value:.7,color:[255,255,255]},{value:1,color:[160,200,255]}]}),EARTH:new Vt({stops:[{value:0,color:[0,0,130]},{value:.1,color:[0,180,180]},{value:.2,color:[40,210,40]},{value:.4,color:[230,230,50]},{value:.6,color:[120,70,20]},{value:1,color:[255,255,255]}]}),ELECTRIC:new Vt({stops:[{value:0,color:[0,0,0]},{value:.15,color:[30,0,100]},{value:.4,color:[120,0,100]},{value:.6,color:[160,90,0]},{value:.8,color:[230,200,0]},{value:1,color:[255,250,220]}]}),VIRIDIS:new Vt({stops:[{value:0,color:[68,1,84]},{value:.13,color:[71,44,122]},{value:.25,color:[59,81,139]},{value:.38,color:[44,113,142]},{value:.5,color:[33,144,141]},{value:.63,color:[39,173,129]},{value:.75,color:[92,200,99]},{value:.88,color:[170,220,50]},{value:1,color:[253,231,37]}]}),INFERNO:new Vt({stops:[{value:0,color:[0,0,4]},{value:.13,color:[31,12,72]},{value:.25,color:[85,15,109]},{value:.38,color:[136,34,106]},{value:.5,color:[186,54,85]},{value:.63,color:[227,89,51]},{value:.75,color:[249,140,10]},{value:.88,color:[249,201,50]},{value:1,color:[252,255,164]}]}),MAGMA:new Vt({stops:[{value:0,color:[0,0,4]},{value:.13,color:[28,16,68]},{value:.25,color:[79,18,123]},{value:.38,color:[129,37,129]},{value:.5,color:[181,54,122]},{value:.63,color:[229,80,100]},{value:.75,color:[251,135,97]},{value:.88,color:[254,194,135]},{value:1,color:[252,253,191]}]}),PLASMA:new Vt({stops:[{value:0,color:[13,8,135]},{value:.13,color:[75,3,161]},{value:.25,color:[125,3,168]},{value:.38,color:[168,34,150]},{value:.5,color:[203,70,121]},{value:.63,color:[229,107,93]},{value:.75,color:[248,148,65]},{value:.88,color:[253,195,40]},{value:1,color:[240,249,33]}]}),WARM:new Vt({stops:[{value:0,color:[125,0,179]},{value:.13,color:[172,0,187]},{value:.25,color:[219,0,170]},{value:.38,color:[255,0,130]},{value:.5,color:[255,63,74]},{value:.63,color:[255,123,0]},{value:.75,color:[234,176,0]},{value:.88,color:[190,228,0]},{value:1,color:[147,255,0]}]}),COOL:new Vt({stops:[{value:0,color:[125,0,179]},{value:.13,color:[116,0,218]},{value:.25,color:[98,74,237]},{value:.38,color:[68,146,231]},{value:.5,color:[0,204,197]},{value:.63,color:[0,247,146]},{value:.75,color:[0,255,88]},{value:.88,color:[40,255,8]},{value:1,color:[147,255,0]}]}),RAINBOW_SOFT:new Vt({stops:[{value:0,color:[125,0,179]},{value:.1,color:[199,0,180]},{value:.2,color:[255,0,121]},{value:.3,color:[255,108,0]},{value:.4,color:[222,194,0]},{value:.5,color:[150,255,0]},{value:.6,color:[0,255,55]},{value:.7,color:[0,246,150]},{value:.8,color:[50,167,222]},{value:.9,color:[103,51,235]},{value:1,color:[124,0,186]}]}),BATHYMETRY:new Vt({stops:[{value:0,color:[40,26,44]},{value:.13,color:[59,49,90]},{value:.25,color:[64,76,139]},{value:.38,color:[63,110,151]},{value:.5,color:[72,142,158]},{value:.63,color:[85,174,163]}
725,{value:.75,color:[120,206,163]},{value:.88,color:[187,230,172]},{value:1,color:[253,254,204]}]}),CDOM:new Vt({stops:[{value:0,color:[47,15,62]},{value:.13,color:[87,23,86]},{value:.25,color:[130,28,99]},{value:.38,color:[171,41,96]},{value:.5,color:[206,67,86]},{value:.63,color:[230,106,84]},{value:.75,color:[242,149,103]},{value:.88,color:[249,193,135]},{value:1,color:[254,237,176]}]}),CHLOROPHYLL:new Vt({stops:[{value:0,color:[18,36,20]},{value:.13,color:[25,63,41]},{value:.25,color:[24,91,59]},{value:.38,color:[13,119,72]},{value:.5,color:[18,148,80]},{value:.63,color:[80,173,89]},{value:.75,color:[132,196,122]},{value:.88,color:[175,221,162]},{value:1,color:[215,249,208]}]}),DENSITY:new Vt({stops:[{value:0,color:[54,14,36]},{value:.13,color:[89,23,80]},{value:.25,color:[110,45,132]},{value:.38,color:[120,77,178]},{value:.5,color:[120,113,213]},{value:.63,color:[115,151,228]},{value:.75,color:[134,185,227]},{value:.88,color:[177,214,227]},{value:1,color:[230,241,241]}]}),FREESURFACE_BLUE:new Vt({stops:[{value:0,color:[30,4,110]},{value:.13,color:[47,14,176]},{value:.25,color:[41,45,236]},{value:.38,color:[25,99,212]},{value:.5,color:[68,131,200]},{value:.63,color:[114,156,197]},{value:.75,color:[157,181,203]},{value:.88,color:[200,208,216]},{value:1,color:[241,237,236]}]}),FREESURFACE_RED:new Vt({stops:[{value:0,color:[60,9,18]},{value:.13,color:[100,17,27]},{value:.25,color:[142,20,29]},{value:.38,color:[177,43,27]},{value:.5,color:[192,87,63]},{value:.63,color:[205,125,105]},{value:.75,color:[216,162,148]},{value:.88,color:[227,199,193]},{value:1,color:[241,237,236]}]}),OXYGEN:new Vt({stops:[{value:0,color:[64,5,5]},{value:.13,color:[106,6,15]},{value:.25,color:[144,26,7]},{value:.38,color:[168,64,3]},{value:.5,color:[188,100,4]},{value:.63,color:[206,136,11]},{value:.75,color:[220,174,25]},{value:.88,color:[231,215,44]},{value:1,color:[248,254,105]}]}),PAR:new Vt({stops:[{value:0,color:[51,20,24]},{value:.13,color:[90,32,35]},{value:.25,color:[129,44,34]},{value:.38,color:[159,68,25]},{value:.5,color:[182,99,19]},{value:.63,color:[199,134,22]},{value:.75,color:[212,171,35]},{value:.88,color:[221,210,54]},{value:1,color:[225,253,75]}]}),PHASE:new Vt({stops:[{value:0,color:[145,105,18]},{value:.13,color:[184,71,38]},{value:.25,color:[186,58,115]},{value:.38,color:[160,71,185]},{value:.5,color:[110,97,218]},{value:.63,color:[50,123,164]},{value:.75,color:[31,131,110]},{value:.88,color:[77,129,34]},{value:1,color:[145,105,18]}]}),SALINITY:new Vt({stops:[{value:0,color:[42,24,108]},{value:.13,color:[33,50,162]},{value:.25,color:[15,90,145]},{value:.38,color:[40,118,137]},{value:.5,color:[59,146,135]},{value:.63,color:[79,175,126]},{value:.75,color:[120,203,104]},{value:.88,color:[193,221,100]},{value:1,color:[253,239,154]}]}),TEMPERATURE:new Vt({stops:[{value:0,color:[4,35,51]},{value:.13,color:[23,51,122]},{value:.25,color:[85,59,157]},{value:.38,color:[129,79,143]},{value:.5,color:[175,95,130]},{value:.63,color:[222,112,101]},{value:.75,color:[249,146,66]},{value:.88,color:[249,196,65]},{value:1,color:[232,250,91]}]}),TURBIDITY:new Vt({stops:[{value:0,color:[34,31,27]},{value:.13,color:[65,50,41]},{value:.25,color:[98,69,52]},{value:.38,color:[131,89,57]},{value:.5,color:[161,112,59]},{value:.63,color:[185,140,66]},{value:.75,color:[202,174,88]},{value:.88,color:[216,209,126]},{value:1,color:[233,246,171]}]}),VELOCITY_BLUE:new Vt({stops:[{value:0,color:[17,32,64]},{value:.13,color:[35,52,116]},{value:.25,color:[29,81,156]},{value:.38,color:[31,113,162]},{value:.5,color:[50,144,169]},{value:.63,color:[87,173,176]},{value:.75,color:[149,196,189]},{value:.88,color:[203,221,211]},{value:1,color:[254,251,230]}]}),VELOCITY_GREEN:new Vt({stops:[{value:0,color:[23,35,19]},{value:.13,color:[24,64,38]},{value:.25,color:[11,95,45]},{value:.38,color:[39,123,35]},{value:.5,color:[95,146,12]},{value:.63,color:[152,165,18]},{value:.75,color:[201,186,69]},{value:.88,color:[233,216,137]},{value:1,color:[255,253,205]}]}),CUBEHELIX:new Vt({stops:[{value:0,color:[0,0,0]},{value:.07,color:[22,5,59]},{value:.13,color:[60,4,105]},{value:.2,color:[109,1,135]},{value:.27,color:[161,0,147]},{value:.33,color:[210,2,142]},{value:.4,color:[251,11,123]},{value:.47,color:[255,29,97]},{value:.53,color:[255,54,69]},{value:.6,color:[255,85,46]},{value:.67,color:[255,120,34]},{value:.73,color:[255,157,37]},{value:.8,color:[241,191,57]},{value:.87,color:[224,220,93]},{value:.93,color:[218,241,142]},{value:1,color:[227,253,198]}]}),CIVIDIS:new Vt({stops:[{value:0,color:[0,32,77,255]},{value:.125,color:[5,54,110,255]},{value:.25,color:[65,77,108,255]},{value:.375,color:[97,100,111,255]},{value:.5,color:[125,124,121,255]},{value:.625,color:[156,149,120,255]}
725,{value:.75,color:[190,175,111,255]},{value:.875,color:[225,204,94,255]},{value:1,color:[255,235,70,255]}]}),TURBO:new Vt({stops:[{value:0,color:[48,18,59,255]},{value:.125,color:[70,107,227,255]},{value:.25,color:[40,187,236,255]},{value:.375,color:[49,242,153,255]},{value:.5,color:[162,252,60,255]},{value:.625,color:[237,208,58,255]},{value:.75,color:[251,128,34,255]},{value:.875,color:[210,49,5,255]},{value:1,color:[122,4,3,255]}]}),ROCKET:new Vt({stops:[{value:0,color:[250,235,221,0]},{value:.133,color:[250,235,221,255]},{value:.266,color:[246,170,130,255]},{value:.4,color:[240,96,67,255]},{value:.533,color:[203,27,79,255]},{value:.666,color:[132,30,90,255]},{value:.8,color:[63,27,68,255]},{value:1,color:[3,5,26,255]}]}),MAKO:new Vt({stops:[{value:0,color:[11,4,5,255]},{value:.125,color:[43,28,53,255]},{value:.25,color:[62,53,107,255]},{value:.375,color:[59,86,152,255]},{value:.5,color:[53,123,162,255]},{value:.625,color:[53,158,170,255]},{value:.75,color:[73,193,173,255]},{value:.875,color:[150,221,181,255]},{value:1,color:[222,245,229,255]}]})};wD();var yV=St.default.Map,_V=St.default.Marker,vV=St.default.Popup,bV=St.default.Style,xV=St.default.CanvasSource,wV=St.default.GeoJSONSource,SV=St.default.ImageSource,TV=St.default.RasterTileSource,kV=St.default.RasterDEMTileSource,CV=St.default.VectorTileSource,MV=St.default.VideoSource,AV=St.default.NavigationControl,EV=St.default.GeolocateControl,IV=St.default.AttributionControl,LV=St.default.LogoControl,PV=St.default.ScaleControl,DV=St.default.FullscreenControl,RV=St.default.TerrainControl,zV=St.default.BoxZoomHandler,OV=St.default.ScrollZoomHandler,FV=St.default.CooperativeGesturesHandler,BV=St.default.KeyboardHandler,NV=St.default.TwoFingersTouchPitchHandler,VV=St.default.MapWheelEvent,$V=St.default.MapTouchEvent,UV=St.default.MapMouseEvent,jV=St.default.config,qV=St.default.getVersion,{setRTLTextPlugin:HV,getRTLTextPluginStatus:WV,LngLat:GV,LngLatBounds:sg,MercatorCoordinate:ZV,Evented:KV,AJAXError:XV,prewarm:YV,clearPrewarmedResources:JV,Hash:QV,Point:e$,EdgeInsets:t$,DragRotateHandler:i$,DragPanHandler:n$,TwoFingersTouchZoomRotateHandler:r$,DoubleClickZoomHandler:s$,TwoFingersTouchZoomHandler:o$,TwoFingersTouchRotateHandler:a$,getWorkerCount:l$,setWorkerCount:c$,getMaxParallelImageRequests:u$,setMaxParallelImageRequests:h$,getWorkerUrl:d$,setWorkerUrl:p$,addSourceType:f$,importScriptInWorkers:m$,addProtocol:g$,removeProtocol:y$}=St.default;var Wz="https://api.maptiler.com/maps/dde387fc-1237-42da-8767-a16e8c6d4304/style.json",A_=class extends Ve{static values={key:String,geojsonUrl:String,traceId:Number};connect(){!this.hasKeyValue||!this.keyValue||(this.observer=new IntersectionObserver(t=>{t[0].isIntersecting&&(this.observer.disconnect(),this.build())},{rootMargin:"300px"}),this.observer.observe(this.element))}disconnect(){this.observer?.disconnect(),this.map?.remove()}build(){pr.apiKey=this.keyValue,this.map=new Ac({container:this.element,style:`${Wz}?key=${this.keyValue}`,minZoom:5,maxZoom:10,attributionControl:!0,navigationControl:!1}),this.map.on("load",()=>this.addRoute())}async addRoute(){try{let t=await(await fetch(this.geojsonUrlValue)).json(),e=(t.features||[]).filter(n=>n.properties?.trace_id===this.traceIdValue),i={type:"FeatureCollection",features:e.length?e:t.features||[]};this.map.addSource("route",{type:"geojson",data:i}),this.map.addLayer({id:"route-casing",type:"line",source:"route",layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#1F2648","line-width":6}}),this.map.addLayer({id:"route-line",type:"line",source:"route",layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#FAB313","line-width":3}}),e[0]&&this.addEndpoints(e[0].properties),this.fitTo(i)}catch(t){console.warn("carte-map: geojson indisponible",t)}}addEndpoints(t){[["D\xE9part",t.city_start,"#1F2648"],["Arriv\xE9e",t.city_end,"#FAB313"]].forEach(([e,i,n])=>{if(!i||i.longitude==null||i.latitude==null)return;let a=document.createElement("div");a.style.cssText=`width:14px;height:14px;border-radius:50%;background:${n};border:2px solid #fff;box-shadow:0 0 0 1px rgba(0,0,0,.2)`,new ld({element:a}
725).setLngLat([i.longitude,i.latitude]).setPopup(new t_({offset:14}).setText(`${e} : ${i.name}`)).addTo(this.map)})}fitTo(t){let e=180,i=90,n=-180,a=-90,r=h=>{typeof h[0]=="number"?(e=Math.min(e,h[0]),n=Math.max(n,h[0]),i=Math.min(i,h[1]),a=Math.max(a,h[1])):h.forEach(r)};(t.features||[]).forEach(h=>h.geometry&&r(h.geometry.coordinates)),e<=n&&this.map.fitBounds([[e,i],[n,a]],{padding:24,duration:0})}};var E_=class extends Ve{static targets=["source","button","icon"];copy(t){t.preventDefault(),navigator.clipboard.writeText(this.sourceTarget.value);let e=this.buttonTarget,i=e.innerHTML;e.innerHTML=`
726    Lien copi\xE9 dans le presse-papier
727    <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
728      <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
729    </svg>
730  `,setTimeout(()=>{e.innerHTML=i},2e3)}};var I_=class extends Ve{static values={key:String};connect(){this.keyValue&&localStorage.getItem(this.storageKey)&&this.element.remove()}dismiss(){this.dispatch("dismissed"),this.keyValue&&localStorage.setItem(this.storageKey,"1"),this.element.remove()}get storageKey(){return`dismissed:${this.keyValue}`}};function lg(t){return t+.5|0}var zu=(t,e,i)=>Math.max(Math.min(t,i),e);function og(t){return zu(lg(t*2.55),0,255)}function Ou(t){return zu(lg(t*255),0,255)}function Ec(t){return zu(lg(t/2.55)/100,0,1)}function JC(t){return zu(lg(t*100),0,100)}var ra={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},pS=[..."0123456789ABCDEF"],Gz=t=>pS[t&15],Zz=t=>pS[(t&240)>>4]+pS[t&15],L_=t=>(t&240)>>4===(t&15),Kz=t=>L_(t.r)&&L_(t.g)&&L_(t.b)&&L_(t.a);function Xz(t){var e=t.length,i;return t[0]==="#"&&(e===4||e===5?i={r:255&ra[t[1]]*17,g:255&ra[t[2]]*17,b:255&ra[t[3]]*17,a:e===5?ra[t[4]]*17:255}:(e===7||e===9)&&(i={r:ra[t[1]]<<4|ra[t[2]],g:ra[t[3]]<<4|ra[t[4]],b:ra[t[5]]<<4|ra[t[6]],a:e===9?ra[t[7]]<<4|ra[t[8]]:255})),i}var Yz=(t,e)=>t<255?e(t):"";function Jz(t){var e=Kz(t)?Gz:Zz;return t?"#"+e(t.r)+e(t.g)+e(t.b)+Yz(t.a,e):void 0}var Qz=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function iM(t,e,i){let n=e*Math.min(i,1-i),a=(r,h=(r+t/30)%12)=>i-n*Math.max(Math.min(h-3,9-h,1),-1);return[a(0),a(8),a(4)]}function e5(t,e,i){let n=(a,r=(a+t/60)%6)=>i-i*e*Math.max(Math.min(r,4-r,1),0);return[n(5),n(3),n(1)]}function t5(t,e,i){let n=iM(t,1,.5),a;for(e+i>1&&(a=1/(e+i),e*=a,i*=a),a=0;a<3;a++)n[a]*=1-e-i,n[a]+=e;return n}function i5(t,e,i,n,a){return t===a?(e-i)/n+(e<i?6:0):e===a?(i-t)/n+2:(t-e)/n+4}function fS(t){let i=t.r/255,n=t.g/255,a=t.b/255,r=Math.max(i,n,a),h=Math.min(i,n,a),m=(r+h)/2,b,T,k;return r!==h&&(k=r-h,T=m>.5?k/(2-r-h):k/(r+h),b=i5(i,n,a,k,r),b=b*60+.5),[b|0,T||0,m]}function mS(t,e,i,n){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,n)).map(Ou)}function gS(t,e,i){return mS(iM,t,e,i)}function n5(t,e,i){return mS(t5,t,e,i)}function r5(t,e,i){return mS(e5,t,e,i)}function nM(t){return(t%360+360)%360}function s5(t){let e=Qz.exec(t),i=255,n;if(!e)return;e[5]!==n&&(i=e[6]?og(+e[5]):Ou(+e[5]));let a=nM(+e[2]),r=+e[3]/100,h=+e[4]/100;return e[1]==="hwb"?n=n5(a,r,h):e[1]==="hsv"?n=r5(a,r,h):n=gS(a,r,h),{r:n[0],g:n[1],b:n[2],a:i}}function o5(t,e){var i=fS(t);i[0]=nM(i[0]+e),i=gS(i),t.r=i[0],t.g=i[1],t.b=i[2]}function a5(t){if(!t)return;let e=fS(t),i=e[0],n=JC(e[1]),a=JC(e[2]);return t.a<255?`hsla(${i}, ${n}%, ${a}%, ${Ec(t.a)})`:`hsl(${i}, ${n}%, ${a}%)`}var QC={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"},eM={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 l5(){let t={},e=Object.keys(eM),i=Object.keys(QC),n,a,r,h,m;
vendor: 4,510 bytes, line 730
730for(n=0;n<e.length;n++){for(h=m=e[n],a=0;a<i.length;a++)r=i[a],m=m.replace(r,QC[r]);r=parseInt(eM[h],16),t[m]=[r>>16&255,r>>8&255,r&255]}return t}var P_;function c5(t){P_||(P_=l5(),P_.transparent=[0,0,0,0]);let e=P_[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}var u5=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function h5(t){let e=u5.exec(t),i=255,n,a,r;if(e){if(e[7]!==n){let h=+e[7];i=e[8]?og(h):zu(h*255,0,255)}return n=+e[1],a=+e[3],r=+e[5],n=255&(e[2]?og(n):zu(n,0,255)),a=255&(e[4]?og(a):zu(a,0,255)),r=255&(e[6]?og(r):zu(r,0,255)),{r:n,g:a,b:r,a:i}}}function d5(t){return t&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${Ec(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`)}var dS=t=>t<=.0031308?t*12.92:Math.pow(t,1/2.4)*1.055-.055,tf=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function p5(t,e,i){let n=tf(Ec(t.r)),a=tf(Ec(t.g)),r=tf(Ec(t.b));return{r:Ou(dS(n+i*(tf(Ec(e.r))-n))),g:Ou(dS(a+i*(tf(Ec(e.g))-a))),b:Ou(dS(r+i*(tf(Ec(e.b))-r))),a:t.a+i*(e.a-t.a)}}function D_(t,e,i){if(t){let n=fS(t);n[e]=Math.max(0,Math.min(n[e]+n[e]*i,e===0?360:1)),n=gS(n),t.r=n[0],t.g=n[1],t.b=n[2]}}function rM(t,e){return t&&Object.assign(e||{},t)}function tM(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=Ou(t[3]))):(e=rM(t,{r:0,g:0,b:0,a:1}),e.a=Ou(e.a)),e}function f5(t){return t.charAt(0)==="r"?h5(t):s5(t)}var ag=class t{constructor(e){if(e instanceof t)return e;let i=typeof e,n;i==="object"?n=tM(e):i==="string"&&(n=Xz(e)||c5(e)||f5(e)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var e=rM(this._rgb);return e&&(e.a=Ec(e.a)),e}set rgb(e){this._rgb=tM(e)}rgbString(){return this._valid?d5(this._rgb):void 0}hexString(){return this._valid?Jz(this._rgb):void 0}hslString(){return this._valid?a5(this._rgb):void 0}mix(e,i){if(e){let n=this.rgb,a=e.rgb,r,h=i===r?.5:i,m=2*h-1,b=n.a-a.a,T=((m*b===-1?m:(m+b)/(1+m*b))+1)/2;r=1-T,n.r=255&T*n.r+r*a.r+.5,n.g=255&T*n.g+r*a.g+.5,n.b=255&T*n.b+r*a.b+.5,n.a=h*n.a+(1-h)*a.a,this.rgb=n}return this}interpolate(e,i){return e&&(this._rgb=p5(this._rgb,e._rgb,i)),this}clone(){return new t(this.rgb)}alpha(e){return this._rgb.a=Ou(e),this}clearer(e){let i=this._rgb;return i.a*=1-e,this}greyscale(){let e=this._rgb,i=lg(e.r*.3+e.g*.59+e.b*.11);return e.r=e.g=e.b=i,this}opaquer(e){let i=this._rgb;return i.a*=1+e,this}negate(){let e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return D_(this._rgb,2,e),this}darken(e){return D_(this._rgb,2,-e),this}saturate(e){return D_(this._rgb,1,e),this}desaturate(e){return D_(this._rgb,1,-e),this}rotate(e){return o5(this._rgb,e),this}};function Va(){}var vS=(()=>{let t=0;return()=>t++})();function yi(t){return t==null}function Pi(t){if(Array.isArray&&Array.isArray(t))return!0;let e=Object.prototype.toString.call(t);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function Yt(t){return t!==null&&Object.prototype.toString.call(t)==="[object Object]"}function pn(t){return(typeof t=="number"||t instanceof Number)&&isFinite(+t)}function js(t,e){return pn(t)?t:e}function Ht(t,e){return typeof t>"u"?e:t}var bS=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100:+t/e,N_=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100*e:+t;function $i(t,e,i){if(t&&typeof t.call=="function")return t.apply(i,e)}function Wi(t,e,i,n){let a,r,h;if(Pi(t))if(r=t.length,n)for(a=r-1;a>=0;a--)e.call(i,t[a],a);else for(a=0;a<r;a++)e.call(i,t[a],a);else if(Yt(t))for(h=Object.keys(t),r=h.length,a=0;a<r;a++)e.call(i,t[h[a]],h[a])}function of(t,e){let i,n,a,r;if(!t||!e||t.length!==e.length)return!1;for(i=0,n=t.length;i<n;++i)if(a=t[i],r=e[i],a.datasetIndex!==r.datasetIndex||a.index!==r.index)return!1;return!0}function ug(t){if(Pi(t))return t.map(ug);if(Yt(t)){let e=Object.create(null),i=Object.keys(t),n=i.length,a=0;for(;a<n;++a)e[i[a]]=ug(t[i[a]]);return e}return t}function fM(t){return["__proto__","prototype","constructor"].indexOf(t)===-1}function mM(t,e,i,n){if(!fM(t))return;let a=e[t],r=i[t];Yt(a)&&Yt(r)?hd(a,r,n):e[t]=ug(r)}function hd(t,e,i){let n=Pi(e)?e:[e],a=n.length;if(!Yt(t))return t;i=i||{};let r=i.merger||mM,h;for(let m=0;m<a;++m){if(h=n[m],!Yt(h))continue;let b=Object.keys(h);for(let T=0,k=b.length;T<k;++T)r(b[T],t,h,i)}return t}function dd(t,e){return hd(t,e,{merger:gM})}function gM(t,e,i){if(!fM(t))return;let n=e[t],a=i[t];Yt(n)&&Yt(a)?dd(n,a):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=ug(a))}
vendor: 5,257 bytes, line 730
730var sM={"":t=>t,x:t=>t.x,y:t=>t.y};function yM(t){let e=t.split("."),i=[],n="";for(let a of e)n+=a,n.endsWith("\\")?n=n.slice(0,-1)+".":(i.push(n),n="");return i}function m5(t){let e=yM(t);return i=>{for(let n of e){if(n==="")break;i=i&&i[n]}return i}}function Rl(t,e){return(sM[e]||(sM[e]=m5(e)))(t)}function dg(t){return t.charAt(0).toUpperCase()+t.slice(1)}var Jr=t=>typeof t<"u",Yr=t=>typeof t=="function",V_=(t,e)=>{if(t.size!==e.size)return!1;for(let i of t)if(!e.has(i))return!1;return!0};function xS(t){return t.type==="mouseup"||t.type==="click"||t.type==="contextmenu"}var gi=Math.PI,Yi=2*gi,_M=Yi+gi,hg=Number.POSITIVE_INFINITY,pg=gi/180,an=gi/2,no=gi/4,nf=gi*2/3,Dl=Math.log10,sa=Math.sign;function pd(t,e,i){return Math.abs(t-e)<i}function $_(t){let e=Math.round(t);t=pd(t,e,t/1e3)?e:t;let i=Math.pow(10,Math.floor(Dl(t))),n=t/i;return(n<=1?1:n<=2?2:n<=5?5:10)*i}function wS(t){let e=[],i=Math.sqrt(t),n;for(n=1;n<i;n++)t%n===0&&(e.push(n),e.push(t/n));return i===(i|0)&&e.push(i),e.sort((a,r)=>a-r).pop(),e}function g5(t){return typeof t=="symbol"||typeof t=="object"&&t!==null&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}function $a(t){return!g5(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function SS(t,e){let i=Math.round(t);return i-e<=t&&i+e>=t}function U_(t,e,i){let n,a,r;for(n=0,a=t.length;n<a;n++)r=t[n][i],isNaN(r)||(e.min=Math.min(e.min,r),e.max=Math.max(e.max,r))}function zn(t){return t*(gi/180)}function fd(t){return t*(180/gi)}function j_(t){if(!pn(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function md(t,e){let i=e.x-t.x,n=e.y-t.y,a=Math.sqrt(i*i+n*n),r=Math.atan2(n,i);return r<-.5*gi&&(r+=Yi),{angle:r,distance:a}}function Lc(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function vM(t,e){return(t-e+_M)%Yi-gi}function Us(t){return(t%Yi+Yi)%Yi}function gd(t,e,i,n){let a=Us(t),r=Us(e),h=Us(i),m=Us(r-a),b=Us(h-a),T=Us(a-r),k=Us(a-h);return a===r||a===h||n&&r===h||m>b&&T<k}function fr(t,e,i){return Math.max(e,Math.min(i,t))}function TS(t){return fr(t,-32768,32767)}function Ua(t,e,i,n=1e-6){return t>=Math.min(e,i)-n&&t<=Math.max(e,i)+n}function fg(t,e,i){i=i||(h=>t[h]<e);let n=t.length-1,a=0,r;for(;n-a>1;)r=a+n>>1,i(r)?a=r:n=r;return{lo:a,hi:n}}var Ba=(t,e,i,n)=>fg(t,i,n?a=>{let r=t[a][e];return r<i||r===i&&t[a+1][e]===i}:a=>t[a][e]<i),kS=(t,e,i)=>fg(t,i,n=>t[n][e]>=i);function CS(t,e,i){let n=0,a=t.length;for(;n<a&&t[n]<e;)n++;for(;a>n&&t[a-1]>i;)a--;return n>0||a<t.length?t.slice(n,a):t}var bM=["push","pop","shift","splice","unshift"];function MS(t,e){if(t._chartjs){t._chartjs.listeners.push(e);return}Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),bM.forEach(i=>{let n="_onData"+dg(i),a=t[i];Object.defineProperty(t,i,{configurable:!0,enumerable:!1,value(...r){let h=a.apply(this,r);return t._chartjs.listeners.forEach(m=>{typeof m[n]=="function"&&m[n](...r)}),h}})})}function q_(t,e){let i=t._chartjs;if(!i)return;let n=i.listeners,a=n.indexOf(e);a!==-1&&n.splice(a,1),!(n.length>0)&&(bM.forEach(r=>{delete t[r]}),delete t._chartjs)}function H_(t){let e=new Set(t);return e.size===t.length?t:Array.from(e)}var W_=function(){return typeof window>"u"?function(t){return t()}:window.requestAnimationFrame}();function G_(t,e){let i=[],n=!1;return function(...a){i=a,n||(n=!0,W_.call(window,()=>{n=!1,t.apply(e,i)}))}}function AS(t,e){let i;return function(...n){return e?(clearTimeout(i),i=setTimeout(t,e,n)):t.apply(this,n),e}}var mg=t=>t==="start"?"left":t==="end"?"right":"center",Or=(t,e,i)=>t==="start"?e:t==="end"?i:(e+i)/2,ES=(t,e,i,n)=>t===(n?"left":"right")?i:t==="center"?(e+i)/2:e;function Z_(t,e,i){let n=e.length,a=0,r=n;if(t._sorted){let{iScale:h,vScale:m,_parsed:b}=t,T=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,k=h.axis,{min:P,max:F,minDefined:U,maxDefined:X}=h.getUserBounds();if(U){if(a=Math.min(Ba(b,k,P).lo,i?n:Ba(e,k,h.getPixelForValue(P)).lo),T){let Y=b.slice(0,a+1).reverse().findIndex(te=>!yi(te[m.axis]));a-=Math.max(0,Y)}a=fr(a,0,n-1)}if(X){let Y=Math.max(Ba(b,h.axis,F,!0).hi+1,i?0:Ba(e,k,h.getPixelForValue(F),!0).hi+1);if(T){let te=b.slice(Y-1).findIndex(le=>!yi(le[m.axis]));Y+=Math.max(0,te)}r=fr(Y,a,n)-a}else r=n-a}return{start:a,count:r}}function K_(t){let{xScale:e,yScale:i,_scaleRanges:n}=t,a={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!n)return t._scaleRanges=a,!0;let r=n.xmin!==e.min||n.xmax!==e.max||n.ymin!==i.min||n.ymax!==i.max;return Object.assign(n,a),r}var R_=t=>t===0||t===1,oM=(t,e,i)=>-(Math.pow(2,10*(t-=1))*Math.sin((t-e)*Yi/i)),aM=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*Yi/i)+1,cd={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>-Math.cos(t*an)+1,easeOutSine:t=>Math.sin(t*an),easeInOutSine:t=>-.5*(Math.cos(gi*t)-1),easeInExpo:t=>t===0?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>t===1?1:-Math.pow(2,-10*t)+1,easeInOutExpo:t=>
vendor: 4,857 bytes, line 730
730R_(t)?t:t<.5?.5*Math.pow(2,10*(t*2-1)):.5*(-Math.pow(2,-10*(t*2-1))+2),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>R_(t)?t:oM(t,.075,.3),easeOutElastic:t=>R_(t)?t:aM(t,.075,.3),easeInOutElastic(t){return R_(t)?t:t<.5?.5*oM(t*2,.1125,.45):.5+.5*aM(t*2-1,.1125,.45)},easeInBack(t){return t*t*((1.70158+1)*t-1.70158)},easeOutBack(t){return(t-=1)*t*((1.70158+1)*t+1.70158)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?.5*(t*t*(((e*=1.525)+1)*t-e)):.5*((t-=2)*t*(((e*=1.525)+1)*t+e)+2)},easeInBounce:t=>1-cd.easeOutBounce(1-t),easeOutBounce(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:t=>t<.5?cd.easeInBounce(t*2)*.5:cd.easeOutBounce(t*2-1)*.5+.5};function X_(t){if(t&&typeof t=="object"){let e=t.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function Y_(t){return X_(t)?t:new ag(t)}function F_(t){return X_(t)?t:new ag(t).saturate(.5).darken(.1).hexString()}var y5=["x","y","borderWidth","radius","tension"],_5=["color","borderColor","backgroundColor"];function v5(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:e=>e!=="onProgress"&&e!=="onComplete"&&e!=="fn"}),t.set("animations",{colors:{type:"color",properties:_5},numbers:{type:"number",properties:y5}}),t.describe("animations",{_fallback:"animation"}),t.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:e=>e|0}}}})}function b5(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var lM=new Map;function x5(t,e){e=e||{};let i=t+JSON.stringify(e),n=lM.get(i);return n||(n=new Intl.NumberFormat(t,e),lM.set(i,n)),n}function yd(t,e,i){return x5(e,i).format(t)}var xM={values(t){return Pi(t)?t:""+t},numeric(t,e,i){if(t===0)return"0";let n=this.chart.options.locale,a,r=t;if(i.length>1){let T=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(T<1e-4||T>1e15)&&(a="scientific"),r=w5(t,i)}let h=Dl(Math.abs(r)),m=isNaN(h)?1:Math.max(Math.min(-1*Math.floor(h),20),0),b={notation:a,minimumFractionDigits:m,maximumFractionDigits:m};return Object.assign(b,this.options.ticks.format),yd(t,n,b)},logarithmic(t,e,i){if(t===0)return"0";let n=i[e].significand||t/Math.pow(10,Math.floor(Dl(t)));return[1,2,3,5,10,15].includes(n)||e>.8*i.length?xM.numeric.call(this,t,e,i):""}};function w5(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t)),i}var gg={formatters:xM};function S5(t){t.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:(e,i)=>i.lineWidth,tickColor:(e,i)=>i.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:gg.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:e=>!e.startsWith("before")&&!e.startsWith("after")&&e!=="callback"&&e!=="parser",_indexable:e=>e!=="borderDash"&&e!=="tickBorderDash"&&e!=="dash"}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:e=>e!=="backdropPadding"&&e!=="callback",_indexable:e=>e!=="backdropPadding"})}var Bu=Object.create(null),J_=Object.create(null);function cg(t,e){if(!e)return t;let i=e.split(".");for(let n=0,a=i.length;n<a;++n){let r=i[n];t=t[r]||(t[r]=Object.create(null))}return t}function yS(t,e,i){return typeof e=="string"?hd(cg(t,e),i):hd(cg(t,""),e)}var _S=class{constructor(e,i){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=n=>n.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={}
vendor: 5,480 bytes, line 730
730,this.hoverBackgroundColor=(n,a)=>F_(a.backgroundColor),this.hoverBorderColor=(n,a)=>F_(a.borderColor),this.hoverColor=(n,a)=>F_(a.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(e),this.apply(i)}set(e,i){return yS(this,e,i)}get(e){return cg(this,e)}describe(e,i){return yS(J_,e,i)}override(e,i){return yS(Bu,e,i)}route(e,i,n,a){let r=cg(this,e),h=cg(this,n),m="_"+i;Object.defineProperties(r,{[m]:{value:r[i],writable:!0},[i]:{enumerable:!0,get(){let b=this[m],T=h[a];return Yt(b)?Object.assign({},T,b):Ht(b,T)},set(b){this[m]=b}}})}apply(e){e.forEach(i=>i(this))}},fn=new _S({_scriptable:t=>!t.startsWith("on"),_indexable:t=>t!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[v5,b5,S5]);function wM(t){return!t||yi(t.size)||yi(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function rf(t,e,i,n,a){let r=e[a];return r||(r=e[a]=t.measureText(a).width,i.push(a)),r>n&&(n=r),n}function IS(t,e,i,n){n=n||{};let a=n.data=n.data||{},r=n.garbageCollect=n.garbageCollect||[];n.font!==e&&(a=n.data={},r=n.garbageCollect=[],n.font=e),t.save(),t.font=e;let h=0,m=i.length,b,T,k,P,F;for(b=0;b<m;b++)if(P=i[b],P!=null&&!Pi(P))h=rf(t,a,r,h,P);else if(Pi(P))for(T=0,k=P.length;T<k;T++)F=P[T],F!=null&&!Pi(F)&&(h=rf(t,a,r,h,F));t.restore();let U=r.length/2;if(U>i.length){for(b=0;b<U;b++)delete a[r[b]];r.splice(0,U)}return h}function Pc(t,e,i){let n=t.currentDevicePixelRatio,a=i!==0?Math.max(i/2,.5):0;return Math.round((e-a)*n)/n+a}function Q_(t,e){!e&&!t||(e=e||t.getContext("2d"),e.save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function yg(t,e,i,n){ev(t,e,i,n,null)}function ev(t,e,i,n,a){let r,h,m,b,T,k,P,F,U=e.pointStyle,X=e.rotation,Y=e.radius,te=(X||0)*pg;if(U&&typeof U=="object"&&(r=U.toString(),r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]")){t.save(),t.translate(i,n),t.rotate(te),t.drawImage(U,-U.width/2,-U.height/2,U.width,U.height),t.restore();return}if(!(isNaN(Y)||Y<=0)){switch(t.beginPath(),U){default:a?t.ellipse(i,n,a/2,Y,0,0,Yi):t.arc(i,n,Y,0,Yi),t.closePath();break;case"triangle":k=a?a/2:Y,t.moveTo(i+Math.sin(te)*k,n-Math.cos(te)*Y),te+=nf,t.lineTo(i+Math.sin(te)*k,n-Math.cos(te)*Y),te+=nf,t.lineTo(i+Math.sin(te)*k,n-Math.cos(te)*Y),t.closePath();break;case"rectRounded":T=Y*.516,b=Y-T,h=Math.cos(te+no)*b,P=Math.cos(te+no)*(a?a/2-T:b),m=Math.sin(te+no)*b,F=Math.sin(te+no)*(a?a/2-T:b),t.arc(i-P,n-m,T,te-gi,te-an),t.arc(i+F,n-h,T,te-an,te),t.arc(i+P,n+m,T,te,te+an),t.arc(i-F,n+h,T,te+an,te+gi),t.closePath();break;case"rect":if(!X){b=Math.SQRT1_2*Y,k=a?a/2:b,t.rect(i-k,n-b,2*k,2*b);break}te+=no;case"rectRot":P=Math.cos(te)*(a?a/2:Y),h=Math.cos(te)*Y,m=Math.sin(te)*Y,F=Math.sin(te)*(a?a/2:Y),t.moveTo(i-P,n-m),t.lineTo(i+F,n-h),t.lineTo(i+P,n+m),t.lineTo(i-F,n+h),t.closePath();break;case"crossRot":te+=no;case"cross":P=Math.cos(te)*(a?a/2:Y),h=Math.cos(te)*Y,m=Math.sin(te)*Y,F=Math.sin(te)*(a?a/2:Y),t.moveTo(i-P,n-m),t.lineTo(i+P,n+m),t.moveTo(i+F,n-h),t.lineTo(i-F,n+h);break;case"star":P=Math.cos(te)*(a?a/2:Y),h=Math.cos(te)*Y,m=Math.sin(te)*Y,F=Math.sin(te)*(a?a/2:Y),t.moveTo(i-P,n-m),t.lineTo(i+P,n+m),t.moveTo(i+F,n-h),t.lineTo(i-F,n+h),te+=no,P=Math.cos(te)*(a?a/2:Y),h=Math.cos(te)*Y,m=Math.sin(te)*Y,F=Math.sin(te)*(a?a/2:Y),t.moveTo(i-P,n-m),t.lineTo(i+P,n+m),t.moveTo(i+F,n-h),t.lineTo(i-F,n+h);break;case"line":h=a?a/2:Math.cos(te)*Y,m=Math.sin(te)*Y,t.moveTo(i-h,n-m),t.lineTo(i+h,n+m);break;case"dash":t.moveTo(i,n),t.lineTo(i+Math.cos(te)*(a?a/2:Y),n+Math.sin(te)*Y);break;case!1:t.closePath();break}t.fill(),e.borderWidth>0&&t.stroke()}}function Na(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function Nu(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function Vu(t){t.restore()}function LS(t,e,i,n,a){if(!e)return t.lineTo(i.x,i.y);if(a==="middle"){let r=(e.x+i.x)/2;t.lineTo(r,e.y),t.lineTo(r,i.y)}else a==="after"!=!!n?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function PS(t,e,i,n){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(n?e.cp1x:e.cp2x,n?e.cp1y:e.cp2y,n?i.cp2x:i.cp1x,n?i.cp2y:i.cp1y,i.x,i.y)}function T5(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),yi(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}function k5(t,e,i,n,a){if(a.strikethrough||a.underline){let r=t.measureText(n),h=e-r.actualBoundingBoxLeft,m=e+r.actualBoundingBoxRight,b=i-r.actualBoundingBoxAscent,T=i+r.actualBoundingBoxDescent,k=a.strikethrough?(b+T)/2:T;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=a.decorationWidth||2,t.moveTo(h,k),t.lineTo(m,k),t.stroke()}}function C5(t,e){let i=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=i}function Dc(t,e,i,n,a,r={}){let h=Pi(e)?e:[e],m=r.strokeWidth>0&&r.strokeColor!=="",b,T;for(t.save(),t.font=a.string,T5(t,r),b=0;b<h.length;++b)T=h[b],r.backdrop&&C5(t,r.backdrop),m&&(r.strokeColor&&(t.strokeStyle=r.strokeColor),yi(r.strokeWidth)||(t.lineWidth=r.strokeWidth),t.strokeText(T,i,n,r.maxWidth)),t.fillText(T,i,n,r.maxWidth),k5(t,i,n,T,r),n+=Number(a.lineHeight);
vendor: 4,804 bytes, line 730
730t.restore()}function Rc(t,e){let{x:i,y:n,w:a,h:r,radius:h}=e;t.arc(i+h.topLeft,n+h.topLeft,h.topLeft,1.5*gi,gi,!0),t.lineTo(i,n+r-h.bottomLeft),t.arc(i+h.bottomLeft,n+r-h.bottomLeft,h.bottomLeft,gi,an,!0),t.lineTo(i+a-h.bottomRight,n+r),t.arc(i+a-h.bottomRight,n+r-h.bottomRight,h.bottomRight,an,0,!0),t.lineTo(i+a,n+h.topRight),t.arc(i+a-h.topRight,n+h.topRight,h.topRight,0,-an,!0),t.lineTo(i+h.topLeft,n)}var M5=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,A5=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function SM(t,e){let i=(""+t).match(M5);if(!i||i[1]==="normal")return e*1.2;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100;break}return e*t}var E5=t=>+t||0;function _g(t,e){let i={},n=Yt(e),a=n?Object.keys(e):e,r=Yt(t)?n?h=>Ht(t[h],t[e[h]]):h=>t[h]:()=>t;for(let h of a)i[h]=E5(r(h));return i}function tv(t){return _g(t,{top:"y",right:"x",bottom:"y",left:"x"})}function ja(t){return _g(t,["topLeft","topRight","bottomLeft","bottomRight"])}function On(t){let e=tv(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Sn(t,e){t=t||{},e=e||fn.font;let i=Ht(t.size,e.size);typeof i=="string"&&(i=parseInt(i,10));let n=Ht(t.style,e.style);n&&!(""+n).match(A5)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);let a={family:Ht(t.family,e.family),lineHeight:SM(Ht(t.lineHeight,e.lineHeight),i),size:i,style:n,weight:Ht(t.weight,e.weight),string:""};return a.string=wM(a),a}function _d(t,e,i,n){let a=!0,r,h,m;for(r=0,h=t.length;r<h;++r)if(m=t[r],m!==void 0&&(e!==void 0&&typeof m=="function"&&(m=m(e),a=!1),i!==void 0&&Pi(m)&&(m=m[i%m.length],a=!1),m!==void 0))return n&&!a&&(n.cacheable=!1),m}function DS(t,e,i){let{min:n,max:a}=t,r=N_(e,(a-n)/2),h=(m,b)=>i&&m===0?0:m+b;return{min:h(n,-Math.abs(r)),max:h(a,r)}}function zl(t,e){return Object.assign(Object.create(t),e)}function vg(t,e=[""],i,n,a=()=>t[0]){let r=i||t;typeof n>"u"&&(n=CM("_fallback",t));let h={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:r,_fallback:n,_getTarget:a,override:m=>vg([m,...t],e,r,n)};return new Proxy(h,{deleteProperty(m,b){return delete m[b],delete m._keys,delete t[0][b],!0},get(m,b){return TM(m,b,()=>F5(b,e,t,m))},getOwnPropertyDescriptor(m,b){return Reflect.getOwnPropertyDescriptor(m._scopes[0],b)},getPrototypeOf(){return Reflect.getPrototypeOf(t[0])},has(m,b){return uM(m).includes(b)},ownKeys(m){return uM(m)},set(m,b,T){let k=m._storage||(m._storage=a());return m[b]=k[b]=T,delete m._keys,!0}})}function Fu(t,e,i,n){let a={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:iv(t,n),setContext:r=>Fu(t,r,i,n),override:r=>Fu(t.override(r),e,i,n)};return new Proxy(a,{deleteProperty(r,h){return delete r[h],delete t[h],!0},get(r,h,m){return TM(r,h,()=>L5(r,h,m))},getOwnPropertyDescriptor(r,h){return r._descriptors.allKeys?Reflect.has(t,h)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,h)},getPrototypeOf(){return Reflect.getPrototypeOf(t)},has(r,h){return Reflect.has(t,h)},ownKeys(){return Reflect.ownKeys(t)},set(r,h,m){return t[h]=m,delete r[h],!0}})}function iv(t,e={scriptable:!0,indexable:!0}){let{_scriptable:i=e.scriptable,_indexable:n=e.indexable,_allKeys:a=e.allKeys}=t;return{allKeys:a,scriptable:i,indexable:n,isScriptable:Yr(i)?i:()=>i,isIndexable:Yr(n)?n:()=>n}}var I5=(t,e)=>t?t+dg(e):e,RS=(t,e)=>Yt(e)&&t!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function TM(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||e==="constructor")return t[e];let n=i();return t[e]=n,n}function L5(t,e,i){let{_proxy:n,_context:a,_subProxy:r,_descriptors:h}=t,m=n[e];return Yr(m)&&h.isScriptable(e)&&(m=P5(e,m,t,i)),Pi(m)&&m.length&&(m=D5(e,m,t,h.isIndexable)),RS(e,m)&&(m=Fu(m,a,r&&r[e],h)),m}function P5(t,e,i,n){let{_proxy:a,_context:r,_subProxy:h,_stack:m}=i;if(m.has(t))throw new Error("Recursion detected: "+Array.from(m).join("->")+"->"+t);m.add(t);let b=e(r,h||n);return m.delete(t),RS(t,b)&&(b=zS(a._scopes,a,t,b)),b}function D5(t,e,i,n){let{_proxy:a,_context:r,_subProxy:h,_descriptors:m}=i;if(typeof r.index<"u"&&n(t))return e[r.index%e.length];if(Yt(e[0])){let b=e,T=a._scopes.filter(k=>k!==b);e=[];for(let k of b){let P=zS(T,a,t,k);e.push(Fu(P,r,h&&h[t],m))}}return e}function kM(t,e,i){return Yr(t)?t(e,i):t}var R5=(t,e)=>t===!0?e:typeof t=="string"?Rl(e,t):void 0;function z5(t,e,i,n,a){for(let r of e){let h=R5(i,r);if(h){t.add(h);let m=kM(h._fallback,i,a);if(typeof m<"u"&&m!==i&&m!==n)return m}else if(h===!1&&typeof n<"u"&&i!==n)return null}return!1}function zS(t,e,i,n){let a=e._rootScopes,r=kM(e._fallback,i,n),h=[...t,...a],m=new Set;m.add(n);let b=cM(m,h,i,r||i,n);return b===null||typeof r<"u"&&r!==i&&(b=cM(m,h,r,b,n),b===null)?!1:vg(Array.from(m),[""],a,r,()=>O5(e,i,n))}function cM(t,e,i,n,a){for(;i;)i=z5(t,e,i,n,a);return i}
vendor: 4,991 bytes, line 730
730function O5(t,e,i){let n=t._getTarget();e in n||(n[e]={});let a=n[e];return Pi(a)&&Yt(i)?i:a||{}}function F5(t,e,i,n){let a;for(let r of e)if(a=CM(I5(r,t),i),typeof a<"u")return RS(t,a)?zS(i,n,t,a):a}function CM(t,e){for(let i of e){if(!i)continue;let n=i[t];if(typeof n<"u")return n}}function uM(t){let e=t._keys;return e||(e=t._keys=B5(t._scopes)),e}function B5(t){let e=new Set;for(let i of t)for(let n of Object.keys(i).filter(a=>!a.startsWith("_")))e.add(n);return Array.from(e)}function nv(t,e,i,n){let{iScale:a}=t,{key:r="r"}=this._parsing,h=new Array(n),m,b,T,k;for(m=0,b=n;m<b;++m)T=m+i,k=e[T],h[m]={r:a.parse(Rl(k,r),T)};return h}var N5=Number.EPSILON||1e-14,sf=(t,e)=>e<t.length&&!t[e].skip&&t[e],MM=t=>t==="x"?"y":"x";function AM(t,e,i,n){let a=t.skip?e:t,r=e,h=i.skip?e:i,m=Lc(r,a),b=Lc(h,r),T=m/(m+b),k=b/(m+b);T=isNaN(T)?0:T,k=isNaN(k)?0:k;let P=n*T,F=n*k;return{previous:{x:r.x-P*(h.x-a.x),y:r.y-P*(h.y-a.y)},next:{x:r.x+F*(h.x-a.x),y:r.y+F*(h.y-a.y)}}}function V5(t,e,i){let n=t.length,a,r,h,m,b,T=sf(t,0);for(let k=0;k<n-1;++k)if(b=T,T=sf(t,k+1),!(!b||!T)){if(pd(e[k],0,N5)){i[k]=i[k+1]=0;continue}a=i[k]/e[k],r=i[k+1]/e[k],m=Math.pow(a,2)+Math.pow(r,2),!(m<=9)&&(h=3/Math.sqrt(m),i[k]=a*h*e[k],i[k+1]=r*h*e[k])}}function $5(t,e,i="x"){let n=MM(i),a=t.length,r,h,m,b=sf(t,0);for(let T=0;T<a;++T){if(h=m,m=b,b=sf(t,T+1),!m)continue;let k=m[i],P=m[n];h&&(r=(k-h[i])/3,m[`cp1${i}`]=k-r,m[`cp1${n}`]=P-r*e[T]),b&&(r=(b[i]-k)/3,m[`cp2${i}`]=k+r,m[`cp2${n}`]=P+r*e[T])}}function EM(t,e="x"){let i=MM(e),n=t.length,a=Array(n).fill(0),r=Array(n),h,m,b,T=sf(t,0);for(h=0;h<n;++h)if(m=b,b=T,T=sf(t,h+1),!!b){if(T){let k=T[e]-b[e];a[h]=k!==0?(T[i]-b[i])/k:0}r[h]=m?T?sa(a[h-1])!==sa(a[h])?0:(a[h-1]+a[h])/2:a[h-1]:a[h]}V5(t,a,r),$5(t,r,e)}function z_(t,e,i){return Math.max(Math.min(t,i),e)}function U5(t,e){let i,n,a,r,h,m=Na(t[0],e);for(i=0,n=t.length;i<n;++i)h=r,r=m,m=i<n-1&&Na(t[i+1],e),r&&(a=t[i],h&&(a.cp1x=z_(a.cp1x,e.left,e.right),a.cp1y=z_(a.cp1y,e.top,e.bottom)),m&&(a.cp2x=z_(a.cp2x,e.left,e.right),a.cp2y=z_(a.cp2y,e.top,e.bottom)))}function OS(t,e,i,n,a){let r,h,m,b;if(e.spanGaps&&(t=t.filter(T=>!T.skip)),e.cubicInterpolationMode==="monotone")EM(t,a);else{let T=n?t[t.length-1]:t[0];for(r=0,h=t.length;r<h;++r)m=t[r],b=AM(T,m,t[Math.min(r+1,h-(n?0:1))%h],e.tension),m.cp1x=b.previous.x,m.cp1y=b.previous.y,m.cp2x=b.next.x,m.cp2y=b.next.y,T=m}e.capBezierPoints&&U5(t,i)}function bg(){return typeof window<"u"&&typeof document<"u"}function xg(t){let e=t.parentNode;return e&&e.toString()==="[object ShadowRoot]"&&(e=e.host),e}function B_(t,e,i){let n;return typeof t=="string"?(n=parseInt(t,10),t.indexOf("%")!==-1&&(n=n/100*e.parentNode[i])):n=t,n}var rv=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);function IM(t,e){return rv(t).getPropertyValue(e)}var j5=["top","right","bottom","left"];function ud(t,e,i){let n={};i=i?"-"+i:"";for(let a=0;a<4;a++){let r=j5[a];n[r]=parseFloat(t[e+"-"+r+i])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}var q5=(t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot);function H5(t,e){let i=t.touches,n=i&&i.length?i[0]:t,{offsetX:a,offsetY:r}=n,h=!1,m,b;if(q5(a,r,t.target))m=a,b=r;else{let T=e.getBoundingClientRect();m=n.clientX-T.left,b=n.clientY-T.top,h=!0}return{x:m,y:b,box:h}}function zc(t,e){if("native"in t)return t;let{canvas:i,currentDevicePixelRatio:n}=e,a=rv(i),r=a.boxSizing==="border-box",h=ud(a,"padding"),m=ud(a,"border","width"),{x:b,y:T,box:k}=H5(t,i),P=h.left+(k&&m.left),F=h.top+(k&&m.top),{width:U,height:X}=e;return r&&(U-=h.width+m.width,X-=h.height+m.height),{x:Math.round((b-P)/U*i.width/n),y:Math.round((T-F)/X*i.height/n)}}function W5(t,e,i){let n,a;if(e===void 0||i===void 0){let r=t&&xg(t);if(!r)e=t.clientWidth,i=t.clientHeight;else{let h=r.getBoundingClientRect(),m=rv(r),b=ud(m,"border","width"),T=ud(m,"padding");e=h.width-T.width-b.width,i=h.height-T.height-b.height,n=B_(m.maxWidth,r,"clientWidth"),a=B_(m.maxHeight,r,"clientHeight")}}return{width:e,height:i,maxWidth:n||hg,maxHeight:a||hg}}var O_=t=>Math.round(t*10)/10;function FS(t,e,i,n){let a=rv(t),r=ud(a,"margin"),h=B_(a.maxWidth,t,"clientWidth")||hg,m=B_(a.maxHeight,t,"clientHeight")||hg,b=W5(t,e,i),{width:T,height:k}=b;if(a.boxSizing==="content-box"){let F=ud(a,"border","width"),U=ud(a,"padding");T-=U.width+F.width,k-=U.height+F.height}return T=Math.max(0,T-r.width),k=Math.max(0,n?T/n:k-r.height),T=O_(Math.min(T,h,b.maxWidth)),k=O_(Math.min(k,m,b.maxHeight)),T&&!k&&(k=O_(T/2)),(e!==void 0||i!==void 0)&&n&&b.height&&k>b.height&&(k=b.height,T=O_(Math.floor(k*n))),{width:T,height:k}}function sv(t,e,i){let n=e||1,a=Math.floor(t.height*n),r=Math.floor(t.width*n);t.height=Math.floor(t.height),t.width=Math.floor(t.width);let h=t.canvas;return h.style&&(i||!h.style.height&&!h.style.width)&&(h.style.height=`${t.height}px`,h.style.width=`${t.width}px`),t.currentDevicePixelRatio!==n||h.height!==a||h.width!==r?(t.currentDevicePixelRatio=n,h.height=a,h.width=r,t.ctx.setTransform(n,0,0,n,0,0),!0):!1}var BS=function(){let t=!1;
vendor: 4,513 bytes, line 730
730try{let e={get passive(){return t=!0,!1}};bg()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch{}return t}();function ov(t,e){let i=IM(t,e),n=i&&i.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function Ic(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function NS(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:n==="middle"?i<.5?t.y:e.y:n==="after"?i<1?t.y:e.y:i>0?e.y:t.y}}function VS(t,e,i,n){let a={x:t.cp2x,y:t.cp2y},r={x:e.cp1x,y:e.cp1y},h=Ic(t,a,i),m=Ic(a,r,i),b=Ic(r,e,i),T=Ic(h,m,i),k=Ic(m,b,i);return Ic(T,k,i)}var G5=function(t,e){return{x(i){return t+t+e-i},setWidth(i){e=i},textAlign(i){return i==="center"?i:i==="right"?"left":"right"},xPlus(i,n){return i-n},leftForLtr(i,n){return i-n}}},Z5=function(){return{x(t){return t},setWidth(t){},textAlign(t){return t},xPlus(t,e){return t+e},leftForLtr(t,e){return t}}};function $u(t,e,i){return t?G5(e,i):Z5()}function av(t,e){let i,n;(e==="ltr"||e==="rtl")&&(i=t.canvas.style,n=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=n)}function lv(t,e){e!==void 0&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function LM(t){return t==="angle"?{between:gd,compare:vM,normalize:Us}:{between:Ua,compare:(e,i)=>e-i,normalize:e=>e}}function hM({start:t,end:e,count:i,loop:n,style:a}){return{start:t%i,end:e%i,loop:n&&(e-t+1)%i===0,style:a}}function K5(t,e,i){let{property:n,start:a,end:r}=i,{between:h,normalize:m}=LM(n),b=e.length,{start:T,end:k,loop:P}=t,F,U;if(P){for(T+=b,k+=b,F=0,U=b;F<U&&h(m(e[T%b][n]),a,r);++F)T--,k--;T%=b,k%=b}return k<T&&(k+=b),{start:T,end:k,loop:P,style:t.style}}function cv(t,e,i){if(!i)return[t];let{property:n,start:a,end:r}=i,h=e.length,{compare:m,between:b,normalize:T}=LM(n),{start:k,end:P,loop:F,style:U}=K5(t,e,i),X=[],Y=!1,te=null,le,we,Le,Oe=()=>b(a,Le,le)&&m(a,Le)!==0,ze=()=>m(r,le)===0||b(r,Le,le),Xe=()=>Y||Oe(),Ke=()=>!Y||ze();for(let rt=k,at=k;rt<=P;++rt)we=e[rt%h],!we.skip&&(le=T(we[n]),le!==Le&&(Y=b(le,a,r),te===null&&Xe()&&(te=m(le,a)===0?rt:at),te!==null&&Ke()&&(X.push(hM({start:te,end:rt,loop:F,count:h,style:U})),te=null),at=rt,Le=le));return te!==null&&X.push(hM({start:te,end:P,loop:F,count:h,style:U})),X}function uv(t,e){let i=[],n=t.segments;for(let a=0;a<n.length;a++){let r=cv(n[a],t.points,e);r.length&&i.push(...r)}return i}function X5(t,e,i,n){let a=0,r=e-1;if(i&&!n)for(;a<e&&!t[a].skip;)a++;for(;a<e&&t[a].skip;)a++;for(a%=e,i&&(r+=a);r>a&&t[r%e].skip;)r--;return r%=e,{start:a,end:r}}function Y5(t,e,i,n){let a=t.length,r=[],h=e,m=t[e],b;for(b=e+1;b<=i;++b){let T=t[b%a];T.skip||T.stop?m.skip||(n=!1,r.push({start:e%a,end:(b-1)%a,loop:n}),e=h=T.stop?b:null):(h=b,m.skip&&(e=b)),m=T}return h!==null&&r.push({start:e%a,end:h%a,loop:n}),r}function $S(t,e){let i=t.points,n=t.options.spanGaps,a=i.length;if(!a)return[];let r=!!t._loop,{start:h,end:m}=X5(i,a,r,n);if(n===!0)return dM(t,[{start:h,end:m,loop:r}],i,e);let b=m<h?m+a:m,T=!!t._fullLoop&&h===0&&m===a-1;return dM(t,Y5(i,h,b,T),i,e)}function dM(t,e,i,n){return!n||!n.setContext||!i?e:J5(t,e,i,n)}function J5(t,e,i,n){let a=t._chart.getContext(),r=pM(t.options),{_datasetIndex:h,options:{spanGaps:m}}=t,b=i.length,T=[],k=r,P=e[0].start,F=P;function U(X,Y,te,le){let we=m?-1:1;if(X!==Y){for(X+=b;i[X%b].skip;)X-=we;for(;i[Y%b].skip;)Y+=we;X%b!==Y%b&&(T.push({start:X%b,end:Y%b,loop:te,style:le}),k=le,P=Y%b)}}for(let X of e){P=m?P:X.start;let Y=i[P%b],te;for(F=P+1;F<=X.end;F++){let le=i[F%b];te=pM(n.setContext(zl(a,{type:"segment",p0:Y,p1:le,p0DataIndex:(F-1)%b,p1DataIndex:F%b,datasetIndex:h}))),Q5(te,k)&&U(P,F-1,X.loop,k),Y=le,k=te}P<F-1&&U(P,F-1,X.loop,k)}return T}function pM(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function Q5(t,e){if(!e)return!1;let i=[],n=function(a,r){return X_(r)?(i.includes(r)||i.push(r),i.indexOf(r)):r};return JSON.stringify(t,n)!==JSON.stringify(e,n)}var JS=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,i,n,a){let r=i.listeners[a],h=i.duration;r.forEach(m=>m({chart:e,initial:i.initial,numSteps:h,currentStep:Math.min(n-i.start,h)}))}_refresh(){this._request||(this._running=!0,this._request=W_.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let i=0;
vendor: 5,049 bytes, line 730
730this._charts.forEach((n,a)=>{if(!n.running||!n.items.length)return;let r=n.items,h=r.length-1,m=!1,b;for(;h>=0;--h)b=r[h],b._active?(b._total>n.duration&&(n.duration=b._total),b.tick(e),m=!0):(r[h]=r[r.length-1],r.pop());m&&(a.draw(),this._notify(a,n,e,"progress")),r.length||(n.running=!1,this._notify(a,n,e,"complete"),n.initial=!1),i+=r.length}),this._lastDate=e,i===0&&(this._running=!1)}_getAnims(e){let i=this._charts,n=i.get(e);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},i.set(e,n)),n}listen(e,i,n){this._getAnims(e).listeners[i].push(n)}add(e,i){!i||!i.length||this._getAnims(e).items.push(...i)}has(e){return this._getAnims(e).items.length>0}start(e){let i=this._charts.get(e);i&&(i.running=!0,i.start=Date.now(),i.duration=i.items.reduce((n,a)=>Math.max(n,a._duration),0),this._refresh())}running(e){if(!this._running)return!1;let i=this._charts.get(e);return!(!i||!i.running||!i.items.length)}stop(e){let i=this._charts.get(e);if(!i||!i.items.length)return;let n=i.items,a=n.length-1;for(;a>=0;--a)n[a].cancel();i.items=[],this._notify(e,i,Date.now(),"complete")}remove(e){return this._charts.delete(e)}},Oc=new JS,PM="transparent",eO={boolean(t,e,i){return i>.5?e:t},color(t,e,i){let n=Y_(t||PM),a=n.valid&&Y_(e||PM);return a&&a.valid?a.mix(n,i).hexString():e},number(t,e,i){return t+(e-t)*i}},QS=class{constructor(e,i,n,a){let r=i[n];a=_d([e.to,a,r,e.from]);let h=_d([e.from,r,a]);this._active=!0,this._fn=e.fn||eO[e.type||typeof h],this._easing=cd[e.easing]||cd.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=i,this._prop=n,this._from=h,this._to=a,this._promises=void 0}active(){return this._active}update(e,i,n){if(this._active){this._notify(!1);let a=this._target[this._prop],r=n-this._start,h=this._duration-r;this._start=n,this._duration=Math.floor(Math.max(h,e.duration)),this._total+=r,this._loop=!!e.loop,this._to=_d([e.to,i,a,e.from]),this._from=_d([e.from,a,i])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){let i=e-this._start,n=this._duration,a=this._prop,r=this._from,h=this._loop,m=this._to,b;if(this._active=r!==m&&(h||i<n),!this._active){this._target[a]=m,this._notify(!0);return}if(i<0){this._target[a]=r;return}b=i/n%2,b=h&&b>1?2-b:b,b=this._easing(Math.min(1,Math.max(0,b))),this._target[a]=this._fn(r,m,b)}wait(){let e=this._promises||(this._promises=[]);return new Promise((i,n)=>{e.push({res:i,rej:n})})}_notify(e){let i=e?"res":"rej",n=this._promises||[];for(let a=0;a<n.length;a++)n[a][i]()}},cf=class{constructor(e,i){this._chart=e,this._properties=new Map,this.configure(i)}configure(e){if(!Yt(e))return;let i=Object.keys(fn.animation),n=this._properties;Object.getOwnPropertyNames(e).forEach(a=>{let r=e[a];if(!Yt(r))return;let h={};for(let m of i)h[m]=r[m];(Pi(r.properties)&&r.properties||[a]).forEach(m=>{(m===a||!n.has(m))&&n.set(m,h)})})}_animateOptions(e,i){let n=i.options,a=iO(e,n);if(!a)return[];let r=this._createAnimations(a,n);return n.$shared&&tO(e.options.$animations,n).then(()=>{e.options=n},()=>{}),r}_createAnimations(e,i){let n=this._properties,a=[],r=e.$animations||(e.$animations={}),h=Object.keys(i),m=Date.now(),b;for(b=h.length-1;b>=0;--b){let T=h[b];if(T.charAt(0)==="$")continue;if(T==="options"){a.push(...this._animateOptions(e,i));continue}let k=i[T],P=r[T],F=n.get(T);if(P)if(F&&P.active()){P.update(F,k,m);continue}else P.cancel();if(!F||!F.duration){e[T]=k;continue}r[T]=P=new QS(F,e,T,k),a.push(P)}return a}update(e,i){if(this._properties.size===0){Object.assign(e,i);return}let n=this._createAnimations(e,i);if(n.length)return Oc.add(this._chart,n),!0}};function tO(t,e){let i=[],n=Object.keys(e);for(let a=0;a<n.length;a++){let r=t[n[a]];r&&r.active()&&i.push(r.wait())}return Promise.all(i)}function iO(t,e){if(!e)return;let i=t.options;if(!i){t.options=e;return}return i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}})),i}function DM(t,e){let i=t&&t.options||{},n=i.reverse,a=i.min===void 0?e:0,r=i.max===void 0?e:0;return{start:n?r:a,end:n?a:r}}function nO(t,e,i){if(i===!1)return!1;let n=DM(t,i),a=DM(e,i);return{top:a.end,right:n.end,bottom:a.start,left:n.start}}function rO(t){let e,i,n,a;return Yt(t)?(e=t.top,i=t.right,n=t.bottom,a=t.left):e=i=n=a=t,{top:e,right:i,bottom:n,left:a,disabled:t===!1}}function LA(t,e){let i=[],n=t._getSortedDatasetMetas(e),a,r;for(a=0,r=n.length;a<r;++a)i.push(n[a].index);return i}function RM(t,e,i,n={}){let a=t.keys,r=n.mode==="single",h,m,b,T;if(e===null)return;let k=!1;for(h=0,m=a.length;h<m;++h){if(b=+a[h],b===i){if(k=!0,n.all)continue;break}T=t.values[b],pn(T)&&(r||e===0||sa(e)===sa(T))&&(e+=T)}return!k&&!n.all?0:e}function sO(t,e){let{iScale:i,vScale:n}=e,a=i.axis==="x"?"x":"y",r=n.axis==="x"?"x":"y",h=Object.keys(t),m=new Array(h.length),b,T,k;for(b=0,T=h.length;b<T;++b)k=h[b],m[b]={[a]:k,[r]:t[k]};return m}function US(t,e){let i=t&&t.options.stacked;return i||i===void 0&&e.stack!==void 0}function oO(t,e,i){return`${t.id}
730.${e.id}.${i.stack||i.type}`}function aO(t){let{min:e,max:i,minDefined:n,maxDefined:a}=t.getUserBounds();return{min:n?e:Number.NEGATIVE_INFINITY,max:a?i:Number.POSITIVE_INFINITY}}function lO(t,e,i){let n=t[e]||(t[e]={});return n[i]||(n[i]={})}function zM(t,e,i,n){for(let a of e.getMatchingVisibleMetas(n).reverse()){let r=t[a.index];if(i&&r>0||!i&&r<0)return a.index}return null}function OM(t,e){let{chart:i,_cachedMeta:n}=t,a=i._stacks||(i._stacks={}),{iScale:r,vScale:h,index:m}=n,b=r.axis,T=h.axis,k=oO(r,h,n),P=e.length,F;for(let U=0;U<P;++U){let X=e[U],{[b]:Y,[T]:te}=X,le=X._stacks||(X._stacks={});F=le[T]=lO(a,k,Y),F[m]=te,F._top=zM(F,h,!0,n.type),F._bottom=zM(F,h,!1,n.type);let we=F._visualValues||(F._visualValues={});we[m]=te}}function jS(t,e){let i=t.scales;return Object.keys(i).filter(n=>i[n].axis===e).shift()}function cO(t,e){return zl(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function uO(t,e,i){return zl(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}function wg(t,e){let i=t.controller.index,n=t.vScale&&t.vScale.axis;if(n){e=e||t._parsed;for(let a of e){let r=a._stacks;if(!r||r[n]===void 0||r[n][i]===void 0)return;delete r[n][i],r[n]._visualValues!==void 0&&r[n]._visualValues[i]!==void 0&&delete r[n]._visualValues[i]}}}var qS=t=>t==="reset"||t==="none",FM=(t,e)=>e?t:Object.assign({},t),hO=(t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:LA(i,!0),values:null},Bl=class{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(e,i){this.chart=e,this._ctx=e.ctx,this.index=i,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(){let e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=US(e.vScale,e),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(e){this.index!==e&&wg(this._cachedMeta),this.index=e}linkScales(){let e=this.chart,i=this._cachedMeta,n=this.getDataset(),a=(P,F,U,X)=>P==="x"?F:P==="r"?X:U,r=i.xAxisID=Ht(n.xAxisID,jS(e,"x")),h=i.yAxisID=Ht(n.yAxisID,jS(e,"y")),m=i.rAxisID=Ht(n.rAxisID,jS(e,"r")),b=i.indexAxis,T=i.iAxisID=a(b,r,h,m),k=i.vAxisID=a(b,h,r,m);i.xScale=this.getScaleForId(r),i.yScale=this.getScaleForId(h),i.rScale=this.getScaleForId(m),i.iScale=this.getScaleForId(T),i.vScale=this.getScaleForId(k)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){let i=this._cachedMeta;return e===i.iScale?i.vScale:i.iScale}reset(){this._update("reset")}_destroy(){let e=this._cachedMeta;this._data&&q_(this._data,this),e._stacked&&wg(e)}_dataCheck(){let e=this.getDataset(),i=e.data||(e.data=[]),n=this._data;if(Yt(i)){let a=this._cachedMeta;this._data=sO(i,a)}else if(n!==i){if(n){q_(n,this);let a=this._cachedMeta;wg(a),a._parsed=[]}i&&Object.isExtensible(i)&&MS(i,this),this._syncList=[],this._data=i}}addElements(){let e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){let i=this._cachedMeta,n=this.getDataset(),a=!1;this._dataCheck();let r=i._stacked;i._stacked=US(i.vScale,i),i.stack!==n.stack&&(a=!0,wg(i),i.stack=n.stack),this._resyncElements(e),(a||r!==i._stacked)&&(OM(this,i._parsed),i._stacked=US(i.vScale,i))}configure(){let e=this.chart.config,i=e.datasetScopeKeys(this._type),n=e.getOptionScopes(this.getDataset(),i,!0);this.options=e.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,i){let{_cachedMeta:n,_data:a}=this,{iScale:r,_stacked:h}=n,m=r.axis,b=e===0&&i===a.length?!0:n._sorted,T=e>0&&n._parsed[e-1],k,P,F;if(this._parsing===!1)n._parsed=a,n._sorted=!0,F=a;else{Pi(a[e])?F=this.parseArrayData(n,a,e,i):Yt(a[e])?F=this.parseObjectData(n,a,e,i):F=this.parsePrimitiveData(n,a,e,i);let U=()=>P[m]===null||T&&P[m]<T[m];for(k=0;k<i;++k)n._parsed[k+e]=P=F[k],b&&(U()&&(b=!1),T=P);n._sorted=b}h&&OM(this,F)}parsePrimitiveData(e,i,n,a){let{iScale:r,vScale:h}=e,m=r.axis,b=h.axis,T=r.getLabels(),k=r===h,P=new Array(a),F,U,X;for(F=0,U=a;F<U;++F)X=F+n,P[F]={[m]:k||r.parse(T[X],X),[b]:h.parse(i[X],X)};return P}parseArrayData(e,i,n,a){let{xScale:r,yScale:h}=e,m=new Array(a),b,T,k,P;for(b=0,T=a;b<T;++b)k=b+n,P=i[k],m[b]={x:r.parse(P[0],k),y:h.parse(P[1],k)};return m}parseObjectData(e,i,n,a){let{xScale:r,yScale:h}=e,{xAxisKey:m="x",yAxisKey:b="y"}=this._parsing,T=new Array(a),k,P,F,U;for(k=0,P=a;k<P;++k)F=k+n,U=i[F],T[k]={x:r.parse(Rl(U,m),F),y:h.parse(Rl(U,b),F)};return T}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,i,n){let a=this.chart,r=this._cachedMeta,h=i[e.axis],m={keys:LA(a,!0),values:i._stacks[e.axis]._visualValues};return RM(m,h,r.index,{mode:n})}updateRangeFromParsed(e,i,n,a){let r=n[i.axis],h=r===null?NaN:r,m=a&&n._stacks[i.axis];a&&m&&(a.values=m,h=RM(a,r,this._cachedMeta.index)),e.min=Math.min(e.min,h),e.max=Math.max(e.max,h)}getMinMax(e,i){let n=this._cachedMeta,a=n._parsed,r=n._sorted&&e===n.iScale,h=a.length,m=this._getOtherScale(e),b=hO(i,n,this.chart),T={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:k,max:P}=aO(m),F,U;function X(){U=a[F];let Y=U[m.axis];return!pn(U[e.axis])||k>Y||P<Y}for(F=0;F<h&&!(!X()&&(this.updateRangeFromParsed(T,e,U,b),r));++F);if(r){for(F=h-1;F>=0;--F)if(!X()){this.updateRangeFromParsed(T,e,U,b);break}}return T}getAllParsedValues(e){let i=this._cachedMeta._parsed,n=[],a,r,h;for(a=0,r=i.length;a<r;++a)h=i[a][e.axis],pn(h)&&n.push(h);return n}getMaxOverflow(){return!1}
vendor: 4,827 bytes, line 730
730getLabelAndValue(e){let i=this._cachedMeta,n=i.iScale,a=i.vScale,r=this.getParsed(e);return{label:n?""+n.getLabelForValue(r[n.axis]):"",value:a?""+a.getLabelForValue(r[a.axis]):""}}_update(e){let i=this._cachedMeta;this.update(e||"default"),i._clip=rO(Ht(this.options.clip,nO(i.xScale,i.yScale,this.getMaxOverflow())))}update(e){}draw(){let e=this._ctx,i=this.chart,n=this._cachedMeta,a=n.data||[],r=i.chartArea,h=[],m=this._drawStart||0,b=this._drawCount||a.length-m,T=this.options.drawActiveElementsOnTop,k;for(n.dataset&&n.dataset.draw(e,r,m,b),k=m;k<m+b;++k){let P=a[k];P.hidden||(P.active&&T?h.push(P):P.draw(e,r))}for(k=0;k<h.length;++k)h[k].draw(e,r)}getStyle(e,i){let n=i?"active":"default";return e===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(e||0,n)}getContext(e,i,n){let a=this.getDataset(),r;if(e>=0&&e<this._cachedMeta.data.length){let h=this._cachedMeta.data[e];r=h.$context||(h.$context=uO(this.getContext(),e,h)),r.parsed=this.getParsed(e),r.raw=a.data[e],r.index=r.dataIndex=e}else r=this.$context||(this.$context=cO(this.chart.getContext(),this.index)),r.dataset=a,r.index=r.datasetIndex=this.index;return r.active=!!i,r.mode=n,r}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,i){return this._resolveElementOptions(this.dataElementType.id,i,e)}_resolveElementOptions(e,i="default",n){let a=i==="active",r=this._cachedDataOpts,h=e+"-"+i,m=r[h],b=this.enableOptionSharing&&Jr(n);if(m)return FM(m,b);let T=this.chart.config,k=T.datasetElementScopeKeys(this._type,e),P=a?[`${e}Hover`,"hover",e,""]:[e,""],F=T.getOptionScopes(this.getDataset(),k),U=Object.keys(fn.elements[e]),X=()=>this.getContext(n,a,i),Y=T.resolveNamedOptions(F,U,X,P);return Y.$shared&&(Y.$shared=b,r[h]=Object.freeze(FM(Y,b))),Y}_resolveAnimations(e,i,n){let a=this.chart,r=this._cachedDataOpts,h=`animation-${i}`,m=r[h];if(m)return m;let b;if(a.options.animation!==!1){let k=this.chart.config,P=k.datasetAnimationScopeKeys(this._type,i),F=k.getOptionScopes(this.getDataset(),P);b=k.createResolver(F,this.getContext(e,n,i))}let T=new cf(a,b&&b.animations);return b&&b._cacheable&&(r[h]=Object.freeze(T)),T}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,i){return!i||qS(e)||this.chart._animationsDisabled}_getSharedOptions(e,i){let n=this.resolveDataElementOptions(e,i),a=this._sharedOptions,r=this.getSharedOptions(n),h=this.includeOptions(i,r)||r!==a;return this.updateSharedOptions(r,i,n),{sharedOptions:r,includeOptions:h}}updateElement(e,i,n,a){qS(a)?Object.assign(e,n):this._resolveAnimations(i,a).update(e,n)}updateSharedOptions(e,i,n){e&&!qS(i)&&this._resolveAnimations(void 0,i).update(e,n)}_setStyle(e,i,n,a){e.active=a;let r=this.getStyle(i,a);this._resolveAnimations(i,n,a).update(e,{options:!a&&this.getSharedOptions(r)||r})}removeHoverStyle(e,i,n){this._setStyle(e,n,"active",!1)}setHoverStyle(e,i,n){this._setStyle(e,n,"active",!0)}_removeDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){let i=this._data,n=this._cachedMeta.data;for(let[m,b,T]of this._syncList)this[m](b,T);this._syncList=[];let a=n.length,r=i.length,h=Math.min(r,a);h&&this.parse(0,h),r>a?this._insertElements(a,r-a,e):r<a&&this._removeElements(r,a-r)}_insertElements(e,i,n=!0){let a=this._cachedMeta,r=a.data,h=e+i,m,b=T=>{for(T.length+=i,m=T.length-1;m>=h;m--)T[m]=T[m-i]};for(b(r),m=e;m<h;++m)r[m]=new this.dataElementType;this._parsing&&b(a._parsed),this.parse(e,i),n&&this.updateElements(r,e,i,"reset")}updateElements(e,i,n,a){}_removeElements(e,i){let n=this._cachedMeta;if(this._parsing){let a=n._parsed.splice(e,i);n._stacked&&wg(n,a)}n.data.splice(e,i)}_sync(e){if(this._parsing)this._syncList.push(e);else{let[i,n,a]=e;this[i](n,a)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){let e=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-e,e])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(e,i){i&&this._sync(["_removeElements",e,i]);let n=arguments.length-2;n&&this._sync(["_insertElements",e,n])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}};function dO(t,e){if(!t._cache.$bar){let i=t.getMatchingVisibleMetas(e),n=[];for(let a=0,r=i.length;a<r;a++)n=n.concat(i[a].controller.getAllParsedValues(t));t._cache.$bar=H_(n.sort((a,r)=>a-r))}return t._cache.$bar}function pO(t){let e=t.iScale,i=dO(e,t.type),n=e._length,a,r,h,m,b=()=>{h===32767||h===-32768||(Jr(m)&&(n=Math.min(n,Math.abs(h-m)||n)),m=h)};for(a=0,r=i.length;a<r;
vendor: 4,233 bytes, line 730
730++a)h=e.getPixelForValue(i[a]),b();for(m=void 0,a=0,r=e.ticks.length;a<r;++a)h=e.getPixelForTick(a),b();return n}function fO(t,e,i,n){let a=i.barThickness,r,h;return yi(a)?(r=e.min*i.categoryPercentage,h=i.barPercentage):(r=a*n,h=1),{chunk:r/n,ratio:h,start:e.pixels[t]-r/2}}function mO(t,e,i,n){let a=e.pixels,r=a[t],h=t>0?a[t-1]:null,m=t<a.length-1?a[t+1]:null,b=i.categoryPercentage;h===null&&(h=r-(m===null?e.end-e.start:m-r)),m===null&&(m=r+r-h);let T=r-(r-Math.min(h,m))/2*b;return{chunk:Math.abs(m-h)/2*b/n,ratio:i.barPercentage,start:T}}function gO(t,e,i,n){let a=i.parse(t[0],n),r=i.parse(t[1],n),h=Math.min(a,r),m=Math.max(a,r),b=h,T=m;Math.abs(h)>Math.abs(m)&&(b=m,T=h),e[i.axis]=T,e._custom={barStart:b,barEnd:T,start:a,end:r,min:h,max:m}}function PA(t,e,i,n){return Pi(t)?gO(t,e,i,n):e[i.axis]=i.parse(t,n),e}function BM(t,e,i,n){let a=t.iScale,r=t.vScale,h=a.getLabels(),m=a===r,b=[],T,k,P,F;for(T=i,k=i+n;T<k;++T)F=e[T],P={},P[a.axis]=m||a.parse(h[T],T),b.push(PA(F,P,r,T));return b}function HS(t){return t&&t.barStart!==void 0&&t.barEnd!==void 0}function yO(t,e,i){return t!==0?sa(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}function _O(t){let e,i,n,a,r;return t.horizontal?(e=t.base>t.x,i="left",n="right"):(e=t.base<t.y,i="bottom",n="top"),e?(a="end",r="start"):(a="start",r="end"),{start:i,end:n,reverse:e,top:a,bottom:r}}function vO(t,e,i,n){let a=e.borderSkipped,r={};if(!a){t.borderSkipped=r;return}if(a===!0){t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:h,end:m,reverse:b,top:T,bottom:k}=_O(t);a==="middle"&&i&&(t.enableBorderRadius=!0,(i._top||0)===n?a=T:(i._bottom||0)===n?a=k:(r[NM(k,h,m,b)]=!0,a=T)),r[NM(a,h,m,b)]=!0,t.borderSkipped=r}function NM(t,e,i,n){return n?(t=bO(t,e,i),t=VM(t,i,e)):t=VM(t,e,i),t}function bO(t,e,i){return t===e?i:t===i?e:t}function VM(t,e,i){return t==="start"?e:t==="end"?i:t}function xO(t,{inflateAmount:e},i){t.inflateAmount=e==="auto"?i===1?.33:0:e}var e2=class extends Bl{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(e,i,n,a){return BM(e,i,n,a)}parseArrayData(e,i,n,a){return BM(e,i,n,a)}parseObjectData(e,i,n,a){let{iScale:r,vScale:h}=e,{xAxisKey:m="x",yAxisKey:b="y"}=this._parsing,T=r.axis==="x"?m:b,k=h.axis==="x"?m:b,P=[],F,U,X,Y;for(F=n,U=n+a;F<U;++F)Y=i[F],X={},X[r.axis]=r.parse(Rl(Y,T),F),P.push(PA(Rl(Y,k),X,h,F));return P}updateRangeFromParsed(e,i,n,a){super.updateRangeFromParsed(e,i,n,a);let r=n._custom;r&&i===this._cachedMeta.vScale&&(e.min=Math.min(e.min,r.min),e.max=Math.max(e.max,r.max))}getMaxOverflow(){return 0}getLabelAndValue(e){let i=this._cachedMeta,{iScale:n,vScale:a}=i,r=this.getParsed(e),h=r._custom,m=HS(h)?"["+h.start+", "+h.end+"]":""+a.getLabelForValue(r[a.axis]);return{label:""+n.getLabelForValue(r[n.axis]),value:m}}initialize(){this.enableOptionSharing=!0,super.initialize();let e=this._cachedMeta;e.stack=this.getDataset().stack}update(e){let i=this._cachedMeta;this.updateElements(i.data,0,i.data.length,e)}updateElements(e,i,n,a){let r=a==="reset",{index:h,_cachedMeta:{vScale:m}}=this,b=m.getBasePixel(),T=m.isHorizontal(),k=this._getRuler(),{sharedOptions:P,includeOptions:F}=this._getSharedOptions(i,a);for(let U=i;U<i+n;U++){let X=this.getParsed(U),Y=r||yi(X[m.axis])?{base:b,head:b}:this._calculateBarValuePixels(U),te=this._calculateBarIndexPixels(U,k),le=(X._stacks||{})[m.axis],we={horizontal:T,base:Y.base,enableBorderRadius:!le||HS(X._custom)||h===le._top||h===le._bottom,x:T?Y.head:te.center,y:T?te.center:Y.head,height:T?te.size:Math.abs(Y.size),width:T?Math.abs(Y.size):te.size};F&&(we.options=P||this.resolveDataElementOptions(U,e[U].active?"active":a));let Le=we.options||e[U].options;vO(we,Le,le,h),xO(we,Le,k.ratio),this.updateElement(e[U],U,we,a)}}_getStacks(e,i){let{iScale:n}=this._cachedMeta,a=n.getMatchingVisibleMetas(this._type).filter(k=>k.controller.options.grouped),r=n.options.stacked,h=[],m=this._cachedMeta.controller.getParsed(i),b=m&&m[n.axis],T=k=>{let P=k._parsed.find(U=>
730U[n.axis]===b),F=P&&P[k.vScale.axis];if(yi(F)||isNaN(F))return!0};for(let k of a)if(!(i!==void 0&&T(k))&&((r===!1||h.indexOf(k.stack)===-1||r===void 0&&k.stack===void 0)&&h.push(k.stack),k.index===e))break;return h.length||h.push(void 0),h}_getStackCount(e){return this._getStacks(void 0,e).length}_getStackIndex(e,i,n){let a=this._getStacks(e,n),r=i!==void 0?a.indexOf(i):-1;return r===-1?a.length-1:r}_getRuler(){let e=this.options,i=this._cachedMeta,n=i.iScale,a=[],r,h;for(r=0,h=i.data.length;r<h;++r)a.push(n.getPixelForValue(this.getParsed(r)[n.axis],r));let m=e.barThickness;return{min:m||pO(i),pixels:a,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:e.grouped,ratio:m?1:e.categoryPercentage*e.barPercentage}}_calculateBarValuePixels(e){let{_cachedMeta:{vScale:i,_stacked:n,index:a},options:{base:r,minBarLength:h}}=this,m=r||0,b=this.getParsed(e),T=b._custom,k=HS(T),P=b[i.axis],F=0,U=n?this.applyStack(i,b,n):P,X,Y;U!==P&&(F=U-P,U=P),k&&(P=T.barStart,U=T.barEnd-T.barStart,P!==0&&sa(P)!==sa(T.barEnd)&&(F=0),F+=P);let te=!yi(r)&&!k?r:F,le=i.getPixelForValue(te);if(this.chart.getDataVisibility(e)?X=i.getPixelForValue(F+U):X=le,Y=X-le,Math.abs(Y)<h){Y=yO(Y,i,m)*h,P===m&&(le-=Y/2);let we=i.getPixelForDecimal(0),Le=i.getPixelForDecimal(1),Oe=Math.min(we,Le),ze=Math.max(we,Le);le=Math.max(Math.min(le,ze),Oe),X=le+Y,n&&!k&&(b._stacks[i.axis]._visualValues[a]=i.getValueForPixel(X)-i.getValueForPixel(le))}if(le===i.getPixelForValue(m)){let we=sa(Y)*i.getLineWidthForValue(m)/2;le+=we,Y-=we}return{size:Y,base:le,head:X,center:X+Y/2}}_calculateBarIndexPixels(e,i){let n=i.scale,a=this.options,r=a.skipNull,h=Ht(a.maxBarThickness,1/0),m,b;if(i.grouped){let T=r?this._getStackCount(e):i.stackCount,k=a.barThickness==="flex"?mO(e,i,a,T):fO(e,i,a,T),P=this._getStackIndex(this.index,this._cachedMeta.stack,r?e:void 0);m=k.start+k.chunk*P+k.chunk/2,b=Math.min(h,k.chunk*k.ratio)}else m=n.getPixelForValue(this.getParsed(e)[n.axis],e),b=Math.min(h,i.min*i.ratio);return{base:m-b/2,head:m+b/2,center:m,size:b}}draw(){let e=this._cachedMeta,i=e.vScale,n=e.data,a=n.length,r=0;for(;r<a;++r)this.getParsed(r)[i.axis]!==null&&!n[r].hidden&&n[r].draw(this._ctx)}},t2=class extends Bl{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(e,i,n,a){let r=super.parsePrimitiveData(e,i,n,a);for(let h=0;h<r.length;h++)r[h]._custom=this.resolveDataElementOptions(h+n).radius;return r}parseArrayData(e,i,n,a){let r=super.parseArrayData(e,i,n,a);for(let h=0;h<r.length;h++){let m=i[n+h];r[h]._custom=Ht(m[2],this.resolveDataElementOptions(h+n).radius)}return r}parseObjectData(e,i,n,a){let r=super.parseObjectData(e,i,n,a);for(let h=0;h<r.length;h++){let m=i[n+h];r[h]._custom=Ht(m&&m.r&&+m.r,this.resolveDataElementOptions(h+n).radius)}return r}getMaxOverflow(){let e=this._cachedMeta.data,i=0;for(let n=e.length-1;n>=0;--n)i=Math.max(i,e[n].size(this.resolveDataElementOptions(n))/2);return i>0&&i}getLabelAndValue(e){let i=this._cachedMeta,n=this.chart.data.labels||[],{xScale:a,yScale:r}=i,h=this.getParsed(e),m=a.getLabelForValue(h.x),b=r.getLabelForValue(h.y),T=h._custom;return{label:n[e]||"",value:"("+m+", "+b+(T?", "+T:"")+")"}}update(e){let i=this._cachedMeta.data;this.updateElements(i,0,i.length,e)}updateElements(e,i,n,a){let r=a==="reset",{iScale:h,vScale:m}=this._cachedMeta,{sharedOptions:b,includeOptions:T}=this._getSharedOptions(i,a),k=h.axis,P=m.axis;for(let F=i;F<i+n;F++){let U=e[F],X=!r&&this.getParsed(F),Y={},te=Y[k]=r?h.getPixelForDecimal(.5):h.getPixelForValue(X[k]),le=Y[P]=r?m.getBasePixel():m.getPixelForValue(X[P]);Y.skip=isNaN(te)||isNaN(le),T&&(Y.options=b||this.resolveDataElementOptions(F,U.active?"active":a),r&&(Y.options.radius=0)),this.updateElement(U,F,Y,a)}}resolveDataElementOptions(e,i){let n=this.getParsed(e),a=super.resolveDataElementOptions(e,i);a.$shared&&(a=Object.assign({},a,{$shared:!1}));let r=a.radius;return i!=="active"&&(a.radius=0),a.radius+=Ht(n&&n._custom,r),a}};function wO(t,e,i){let n=1,a=1,r=0,h=0;if(e<Yi){let m=t,b=m+e,T=Math.cos(m),k=Math.sin(m),P=Math.cos(b),F=Math.sin(b),U=(Le,Oe,ze)=>gd(Le,m,b,!0)?1:Math.max(Oe,Oe*i,ze,ze*i),X=(Le,Oe,ze)=>gd(Le,m,b,!0)?-1:Math.min(Oe,Oe*i,ze,ze*i),Y=U(0,T,P),te=U(an,k,F),le=X(gi,T,P),we=X(gi+an,k,F);n=(Y-le)/2,a=(te-we)/2,r=-(Y+le)/2,h=-(te+we)/2}return{ratioX:n,ratioY:a,offsetX:r,offsetY:h}}var xd=class extends Bl{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}}
vendor: 7,120 bytes, line 730
730,cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:e=>e!=="spacing",_indexable:e=>e!=="spacing"&&!e.startsWith("borderDash")&&!e.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){let i=e.data;if(i.labels.length&&i.datasets.length){let{labels:{pointStyle:n,color:a}}=e.legend.options;return i.labels.map((r,h)=>{let b=e.getDatasetMeta(0).controller.getStyle(h);return{text:r,fillStyle:b.backgroundColor,strokeStyle:b.borderColor,fontColor:a,lineWidth:b.borderWidth,pointStyle:n,hidden:!e.getDataVisibility(h),index:h}})}return[]}},onClick(e,i,n){n.chart.toggleDataVisibility(i.index),n.chart.update()}}}};constructor(e,i){super(e,i),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,i){let n=this.getDataset().data,a=this._cachedMeta;if(this._parsing===!1)a._parsed=n;else{let r=b=>+n[b];if(Yt(n[e])){let{key:b="value"}=this._parsing;r=T=>+Rl(n[T],b)}let h,m;for(h=e,m=e+i;h<m;++h)a._parsed[h]=r(h)}}_getRotation(){return zn(this.options.rotation-90)}_getCircumference(){return zn(this.options.circumference)}_getRotationExtents(){let e=Yi,i=-Yi;for(let n=0;n<this.chart.data.datasets.length;++n)if(this.chart.isDatasetVisible(n)&&this.chart.getDatasetMeta(n).type===this._type){let a=this.chart.getDatasetMeta(n).controller,r=a._getRotation(),h=a._getCircumference();e=Math.min(e,r),i=Math.max(i,r+h)}return{rotation:e,circumference:i-e}}update(e){let i=this.chart,{chartArea:n}=i,a=this._cachedMeta,r=a.data,h=this.getMaxBorderWidth()+this.getMaxOffset(r)+this.options.spacing,m=Math.max((Math.min(n.width,n.height)-h)/2,0),b=Math.min(bS(this.options.cutout,m),1),T=this._getRingWeight(this.index),{circumference:k,rotation:P}=this._getRotationExtents(),{ratioX:F,ratioY:U,offsetX:X,offsetY:Y}=wO(P,k,b),te=(n.width-h)/F,le=(n.height-h)/U,we=Math.max(Math.min(te,le)/2,0),Le=N_(this.options.radius,we),Oe=Math.max(Le*b,0),ze=(Le-Oe)/this._getVisibleDatasetWeightTotal();this.offsetX=X*Le,this.offsetY=Y*Le,a.total=this.calculateTotal(),this.outerRadius=Le-ze*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-ze*T,0),this.updateElements(r,0,r.length,e)}_circumference(e,i){let n=this.options,a=this._cachedMeta,r=this._getCircumference();return i&&n.animation.animateRotate||!this.chart.getDataVisibility(e)||a._parsed[e]===null||a.data[e].hidden?0:this.calculateCircumference(a._parsed[e]*r/Yi)}updateElements(e,i,n,a){let r=a==="reset",h=this.chart,m=h.chartArea,T=h.options.animation,k=(m.left+m.right)/2,P=(m.top+m.bottom)/2,F=r&&T.animateScale,U=F?0:this.innerRadius,X=F?0:this.outerRadius,{sharedOptions:Y,includeOptions:te}=this._getSharedOptions(i,a),le=this._getRotation(),we;for(we=0;we<i;++we)le+=this._circumference(we,r);for(we=i;we<i+n;++we){let Le=this._circumference(we,r),Oe=e[we],ze={x:k+this.offsetX,y:P+this.offsetY,startAngle:le,endAngle:le+Le,circumference:Le,outerRadius:X,innerRadius:U};te&&(ze.options=Y||this.resolveDataElementOptions(we,Oe.active?"active":a)),le+=Le,this.updateElement(Oe,we,ze,a)}}calculateTotal(){let e=this._cachedMeta,i=e.data,n=0,a;for(a=0;a<i.length;a++){let r=e._parsed[a];r!==null&&!isNaN(r)&&this.chart.getDataVisibility(a)&&!i[a].hidden&&(n+=Math.abs(r))}return n}calculateCircumference(e){let i=this._cachedMeta.total;return i>0&&!isNaN(e)?Yi*(Math.abs(e)/i):0}getLabelAndValue(e){let i=this._cachedMeta,n=this.chart,a=n.data.labels||[],r=yd(i._parsed[e],n.options.locale);return{label:a[e]||"",value:r}}getMaxBorderWidth(e){let i=0,n=this.chart,a,r,h,m,b;if(!e){for(a=0,r=n.data.datasets.length;a<r;++a)if(n.isDatasetVisible(a)){h=n.getDatasetMeta(a),e=h.data,m=h.controller;break}}if(!e)return 0;for(a=0,r=e.length;a<r;++a)b=m.resolveDataElementOptions(a),b.borderAlign!=="inner"&&(i=Math.max(i,b.borderWidth||0,b.hoverBorderWidth||0));return i}getMaxOffset(e){let i=0;for(let n=0,a=e.length;n<a;++n){let r=this.resolveDataElementOptions(n);i=Math.max(i,r.offset||0,r.hoverOffset||0)}return i}_getRingWeightOffset(e){let i=0;for(let n=0;n<e;++n)this.chart.isDatasetVisible(n)&&(i+=this._getRingWeight(n));return i}_getRingWeight(e){return Math.max(Ht(this.chart.data.datasets[e].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}},i2=class extends Bl{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){let i=this._cachedMeta,{dataset:n,data:a=[],_dataset:r}=i,h=this.chart._animationsDisabled,{start:m,count:b}=Z_(i,a,h);this._drawStart=m,this._drawCount=b,K_(i)&&(m=0,b=a.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!r._decimated,n.points=a;let T=this.resolveDatasetElementOptions(e);this.options.showLine||(T.borderWidth=0),T.segment=this.options.segment,this.updateElement(n,void 0,{animated:!h,options:T},e),this.updateElements(a,m,b,e)}updateElements(e,i,n,a){let r=a==="reset",{iScale:h,vScale:m,_stacked:b,_dataset:T}=this._cachedMeta,{sharedOptions:k,includeOptions:P}=this._getSharedOptions(i,a),F=h.axis,U=m.axis,{spanGaps:X,segment:Y}=this.options,te=$a(X)?X:Number.POSITIVE_INFINITY,le=this.chart._animationsDisabled||r||a==="none",we=i+n,Le=e.length,Oe=i>0&&this.getParsed(i-1);for(let ze=0;ze<Le;++ze){let Xe=e[ze],Ke=le?Xe:{};if(ze<i||ze>=we){Ke.skip=!0;continue}let rt=this.getParsed(ze),at=yi(rt[U]),$t=Ke[F]=h.getPixelForValue(rt[F],ze),Tt=Ke[U]=r||at?m.getBasePixel():m.getPixelForValue(b?this.applyStack(m,rt,b):rt[U],ze);Ke.skip=isNaN($t)||isNaN(Tt)||at,Ke.stop=ze>0&&Math.abs(rt[F]-Oe[F])>te,Y&&(Ke.parsed=rt,Ke.raw=T.data[ze]),P&&(Ke.options=k||this.resolveDataElementOptions(ze,Xe.active?"active":a)),le||this.updateElement(Xe,ze,Ke,a),Oe=rt}}getMaxOverflow(){let e=this._cachedMeta,i=e.dataset,n=i.options&&i.options.borderWidth||0,a=e.data||[];if(!a.length)return n;let r=a[0].size(this.resolveDataElementOptions(0)),h=a[a.length-1].size(this.resolveDataElementOptions(a.length-1));return Math.max(n,r,h)/2}draw(){let e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}},bv=class extends Bl{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){let i=e.data;if(i.labels.length&&i.datasets.length){let{labels:{pointStyle:n,color:a}}=e.legend.options;return i.labels.map((r,h)=>{let b=e.getDatasetMeta(0).controller.getStyle(h);return{text:r,fillStyle:b.backgroundColor,strokeStyle:b.borderColor,fontColor:a,lineWidth:b.borderWidth,pointStyle:n,hidden:!e.getDataVisibility(h),index:h}})}return[]}},onClick(e,i,n){n.chart.toggleDataVisibility(i.index),n.chart.update(
730)}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(e,i){super(e,i),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(e){let i=this._cachedMeta,n=this.chart,a=n.data.labels||[],r=yd(i._parsed[e].r,n.options.locale);return{label:a[e]||"",value:r}}parseObjectData(e,i,n,a){return nv.bind(this)(e,i,n,a)}update(e){let i=this._cachedMeta.data;this._updateRadius(),this.updateElements(i,0,i.length,e)}getMinMax(){let e=this._cachedMeta,i={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return e.data.forEach((n,a)=>{let r=this.getParsed(a).r;!isNaN(r)&&this.chart.getDataVisibility(a)&&(r<i.min&&(i.min=r),r>i.max&&(i.max=r))}),i}_updateRadius(){let e=this.chart,i=e.chartArea,n=e.options,a=Math.min(i.right-i.left,i.bottom-i.top),r=Math.max(a/2,0),h=Math.max(n.cutoutPercentage?r/100*n.cutoutPercentage:1,0),m=(r-h)/e.getVisibleDatasetCount();this.outerRadius=r-m*this.index,this.innerRadius=this.outerRadius-m}updateElements(e,i,n,a){let r=a==="reset",h=this.chart,b=h.options.animation,T=this._cachedMeta.rScale,k=T.xCenter,P=T.yCenter,F=T.getIndexAngle(0)-.5*gi,U=F,X,Y=360/this.countVisibleElements();for(X=0;X<i;++X)U+=this._computeAngle(X,a,Y);for(X=i;X<i+n;X++){let te=e[X],le=U,we=U+this._computeAngle(X,a,Y),Le=h.getDataVisibility(X)?T.getDistanceFromCenterForValue(this.getParsed(X).r):0;U=we,r&&(b.animateScale&&(Le=0),b.animateRotate&&(le=we=F));let Oe={x:k,y:P,innerRadius:0,outerRadius:Le,startAngle:le,endAngle:we,options:this.resolveDataElementOptions(X,te.active?"active":a)};this.updateElement(te,X,Oe,a)}}countVisibleElements(){let e=this._cachedMeta,i=0;return e.data.forEach((n,a)=>{!isNaN(this.getParsed(a).r)&&this.chart.getDataVisibility(a)&&i++}),i}_computeAngle(e,i,n){return this.chart.getDataVisibility(e)?zn(this.resolveDataElementOptions(e,i).angle||n):0}},n2=class extends xd{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},r2=class extends Bl{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(e){let i=this._cachedMeta.vScale,n=this.getParsed(e);return{label:i.getLabels()[e],value:""+i.getLabelForValue(n[i.axis])}}parseObjectData(e,i,n,a){return nv.bind(this)(e,i,n,a)}update(e){let i=this._cachedMeta,n=i.dataset,a=i.data||[],r=i.iScale.getLabels();if(n.points=a,e!=="resize"){let h=this.resolveDatasetElementOptions(e);this.options.showLine||(h.borderWidth=0);let m={_loop:!0,_fullLoop:r.length===a.length,options:h};this.updateElement(n,void 0,m,e)}this.updateElements(a,0,a.length,e)}updateElements(e,i,n,a){let r=this._cachedMeta.rScale,h=a==="reset";for(let m=i;m<i+n;m++){let b=e[m],T=this.resolveDataElementOptions(m,b.active?"active":a),k=r.getPointPositionForValue(m,this.getParsed(m).r),P=h?r.xCenter:k.x,F=h?r.yCenter:k.y,U={x:P,y:F,angle:k.angle,skip:isNaN(P)||isNaN(F),options:T};this.updateElement(b,m,U,a)}}},s2=class extends Bl{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(e){let i=this._cachedMeta,n=this.chart.data.labels||[],{xScale:a,yScale:r}=i,h=this.getParsed(e),m=a.getLabelForValue(h.x),b=r.getLabelForValue(h.y);return{label:n[e]||"",value:"("+m+", "+b+")"}}update(e){let i=this._cachedMeta,{data:n=[]}=i,a=this.chart._animationsDisabled,{start:r,count:h}=Z_(i,n,a);if(this._drawStart=r,this._drawCount=h,K_(i)&&(r=0,h=n.length),this.options.showLine){this.datasetElementType||this.addElements();let{dataset:m,_dataset:b}=i;m._chart=this.chart,m._datasetIndex=this.index,m._decimated=!!b._decimated,m.points=n;let T=this.resolveDatasetElementOptions(e);T.segment=this.options.segment,this.updateElement(m,void 0,{animated:!a,options:T},e)}else this.datasetElementType&&(delete i.dataset,this.datasetElementType=!1);this.updateElements(n,r,h,e)}addElements(){let{showLine:e}=this.options;!this.datasetElementType&&e&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(e,i,n,a){let r=a==="reset",{iScale:h,vScale:m,_stacked:b,_dataset:T}=this._cachedMeta,k=this.resolveDataElementOptions(i,a),P=this.getSharedOptions(k),F=this.includeOptions(a,P),U=h.axis,X=m.axis,{spanGaps:Y,segment:te}=this.options,le=$a(Y)?Y:Number.POSITIVE_INFINITY,we=this.chart._animationsDisabled||r||a==="none",Le=i>0&&this.getParsed(i-1);for(let Oe=i;Oe<i+n;++Oe){let ze=e[Oe],Xe=this.getParsed(Oe),Ke=we?ze:{},rt=yi(Xe[X]),at=Ke[U]=h.getPixelForValue(Xe[U],Oe),$t=Ke[X]=r||rt?m.getBasePixel():m.getPixelForValue(b?this.applyStack(m,Xe,b):Xe[X],Oe);Ke.skip=isNaN(at)||isNaN($t)||rt,Ke.stop=Oe>0&&Math.abs(Xe[U]-Le[U])>le,te&&(Ke.parsed=Xe,Ke.raw=T.data[Oe]),F&&(Ke.options=P||this.resolveDataElementOptions(Oe,ze.active?"active":a)),we||this.updateElement(ze,Oe,Ke,a),Le=Xe}this.updateSharedOptions(P,a,k)}getMaxOverflow(){let e=this._cachedMeta,i=e.data||[];if(!this.options.showLine){let m=0;for(let b=i.length-1;b>=0;--b)m=Math.max(m,i[b].size(this.resolveDataElementOptions(b))/2);return m>0&&m}let n=e.dataset,a=n.options&&n.options.borderWidth||0;if(!i.length)return a;let r=i[0].size(this.resolveDataElementOptions(0)),h=i[i.length-1].size(this.resolveDataElementOptions(i.length-1));return Math.max(a,r,h)/2}},SO=Object.freeze({__proto__:null,BarController:e2,BubbleController:t2,DoughnutController:xd,LineController:i2,PieController:n2,PolarAreaController:bv,RadarController:r2,ScatterController:s2});function vd(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var o2=class t{static override(e){Object.assign(t.prototype,e)}options;constructor(e){this.options=e||{}}init(){}formats(){return vd()}parse(){return vd()}format(){return vd()}add(){return vd()}diff(){return vd()}startOf(){return vd()}endOf(){return vd()}},TO={_date:o2};function kO(t,e,i,n){let{controller:a,data:r,_sorted:h}=t,m=a._cachedMeta.iScale,b=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(m&&e===m.axis&&e!=="r"&&h&&r.length){let T=m._reversePixels?kS:Ba;if(n){if(a._sharedOptions){let k=r[0],P=typeof k.getRange=="function"&&k.getRange(e);
vendor: 58,353 bytes, line 730
730if(P){let F=T(r,e,i-P),U=T(r,e,i+P);return{lo:F.lo,hi:U.hi}}}}else{let k=T(r,e,i);if(b){let{vScale:P}=a._cachedMeta,{_parsed:F}=t,U=F.slice(0,k.lo+1).reverse().findIndex(Y=>!yi(Y[P.axis]));k.lo-=Math.max(0,U);let X=F.slice(k.hi).findIndex(Y=>!yi(Y[P.axis]));k.hi+=Math.max(0,X)}return k}}return{lo:0,hi:r.length-1}}function Dg(t,e,i,n,a){let r=t.getSortedVisibleDatasetMetas(),h=i[e];for(let m=0,b=r.length;m<b;++m){let{index:T,data:k}=r[m],{lo:P,hi:F}=kO(r[m],e,h,a);for(let U=P;U<=F;++U){let X=k[U];X.skip||n(X,T,U)}}}function CO(t){let e=t.indexOf("x")!==-1,i=t.indexOf("y")!==-1;return function(n,a){let r=e?Math.abs(n.x-a.x):0,h=i?Math.abs(n.y-a.y):0;return Math.sqrt(Math.pow(r,2)+Math.pow(h,2))}}function WS(t,e,i,n,a){let r=[];return!a&&!t.isPointInArea(e)||Dg(t,i,e,function(m,b,T){!a&&!Na(m,t.chartArea,0)||m.inRange(e.x,e.y,n)&&r.push({element:m,datasetIndex:b,index:T})},!0),r}function MO(t,e,i,n){let a=[];function r(h,m,b){let{startAngle:T,endAngle:k}=h.getProps(["startAngle","endAngle"],n),{angle:P}=md(h,{x:e.x,y:e.y});gd(P,T,k)&&a.push({element:h,datasetIndex:m,index:b})}return Dg(t,i,e,r),a}function AO(t,e,i,n,a,r){let h=[],m=CO(i),b=Number.POSITIVE_INFINITY;function T(k,P,F){let U=k.inRange(e.x,e.y,a);if(n&&!U)return;let X=k.getCenterPoint(a);if(!(!!r||t.isPointInArea(X))&&!U)return;let te=m(e,X);te<b?(h=[{element:k,datasetIndex:P,index:F}],b=te):te===b&&h.push({element:k,datasetIndex:P,index:F})}return Dg(t,i,e,T),h}function GS(t,e,i,n,a,r){return!r&&!t.isPointInArea(e)?[]:i==="r"&&!n?MO(t,e,i,a):AO(t,e,i,n,a,r)}function $M(t,e,i,n,a){let r=[],h=i==="x"?"inXRange":"inYRange",m=!1;return Dg(t,i,e,(b,T,k)=>{b[h]&&b[h](e[i],a)&&(r.push({element:b,datasetIndex:T,index:k}),m=m||b.inRange(e.x,e.y,a))}),n&&!m?[]:r}var EO={evaluateInteractionItems:Dg,modes:{index(t,e,i,n){let a=zc(e,t),r=i.axis||"x",h=i.includeInvisible||!1,m=i.intersect?WS(t,a,r,n,h):GS(t,a,r,!1,n,h),b=[];return m.length?(t.getSortedVisibleDatasetMetas().forEach(T=>{let k=m[0].index,P=T.data[k];P&&!P.skip&&b.push({element:P,datasetIndex:T.index,index:k})}),b):[]},dataset(t,e,i,n){let a=zc(e,t),r=i.axis||"xy",h=i.includeInvisible||!1,m=i.intersect?WS(t,a,r,n,h):GS(t,a,r,!1,n,h);if(m.length>0){let b=m[0].datasetIndex,T=t.getDatasetMeta(b).data;m=[];for(let k=0;k<T.length;++k)m.push({element:T[k],datasetIndex:b,index:k})}return m},point(t,e,i,n){let a=zc(e,t),r=i.axis||"xy",h=i.includeInvisible||!1;return WS(t,a,r,n,h)},nearest(t,e,i,n){let a=zc(e,t),r=i.axis||"xy",h=i.includeInvisible||!1;return GS(t,a,r,i.intersect,n,h)},x(t,e,i,n){let a=zc(e,t);return $M(t,a,"x",i.intersect,n)},y(t,e,i,n){let a=zc(e,t);return $M(t,a,"y",i.intersect,n)}}},DA=["left","top","right","bottom"];function Sg(t,e){return t.filter(i=>i.pos===e)}function UM(t,e){return t.filter(i=>DA.indexOf(i.pos)===-1&&i.box.axis===e)}function Tg(t,e){return t.sort((i,n)=>{let a=e?n:i,r=e?i:n;return a.weight===r.weight?a.index-r.index:a.weight-r.weight})}function IO(t){let e=[],i,n,a,r,h,m;for(i=0,n=(t||[]).length;i<n;++i)a=t[i],{position:r,options:{stack:h,stackWeight:m=1}}=a,e.push({index:i,box:a,pos:r,horizontal:a.isHorizontal(),weight:a.weight,stack:h&&r+h,stackWeight:m});return e}function LO(t){let e={};for(let i of t){let{stack:n,pos:a,stackWeight:r}=i;if(!n||!DA.includes(a))continue;let h=e[n]||(e[n]={count:0,placed:0,weight:0,size:0});h.count++,h.weight+=r}return e}function PO(t,e){let i=LO(t),{vBoxMaxWidth:n,hBoxMaxHeight:a}=e,r,h,m;for(r=0,h=t.length;r<h;++r){m=t[r];let{fullSize:b}=m.box,T=i[m.stack],k=T&&m.stackWeight/T.weight;m.horizontal?(m.width=k?k*n:b&&e.availableWidth,m.height=a):(m.width=n,m.height=k?k*a:b&&e.availableHeight)}return i}function DO(t){let e=IO(t),i=Tg(e.filter(T=>T.box.fullSize),!0),n=Tg(Sg(e,"left"),!0),a=Tg(Sg(e,"right")),r=Tg(Sg(e,"top"),!0),h=Tg(Sg(e,"bottom")),m=UM(e,"x"),b=UM(e,"y");return{fullSize:i,leftAndTop:n.concat(r),rightAndBottom:a.concat(b).concat(h).concat(m),chartArea:Sg(e,"chartArea"),vertical:n.concat(a).concat(b),horizontal:r.concat(h).concat(m)}}function jM(t,e,i,n){return Math.max(t[i],e[i])+Math.max(t[n],e[n])}function RA(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function RO(t,e,i,n){let{pos:a,box:r}=i,h=t.maxPadding;if(!Yt(a)){i.size&&(t[a]-=i.size);let P=n[i.stack]||{size:0,count:1};P.size=Math.max(P.size,i.horizontal?r.height:r.width),i.size=P.size/P.count,t[a]+=i.size}r.getPadding&&RA(h,r.getPadding());let m=Math.max(0,e.outerWidth-jM(h,t,"left","right")),b=Math.max(0,e.outerHeight-jM(h,t,"top","bottom")),T=m!==t.w,k=b!==t.h;return t.w=m,t.h=b,i.horizontal?{same:T,other:k}:{same:k,other:T}}function zO(t){let e=t.maxPadding;function i(n){let a=Math.max(e[n]-t[n],0);return t[n]+=a,a}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}function OO(t,e){let i=e.maxPadding;function n(a){let r={left:0,top:0,right:0,bottom:0};return a.forEach(h=>{r[h]=Math.max(e[h],i[h])}),r}return n(t?["left","right"]:["top","bottom"])}function Mg(t,e,i,n){let a=[],r,h,m,b,T,k;for(r=0,h=t.length,T=0;r<h;++r){m=t[r],b=m.box,b.update(m.width||e.w,m.height||e.h,OO(m.horizontal,e));let{same:P,other:F}=RO(e,i,m,n);T|=P&&a.length,k=k||F,b.fullSize||a.push(m)}return T&&Mg(a,e,i,n)||k}function hv(t,e,i,n,a){t.top=i,t.left=e,t.right=e+n,t.bottom=i+a,t.width=n,t.height=a}function qM(t,e,i,n){let a=i.padding,{x:r,y:h}=e;for(let m of t){let b=m.box,T=n[m.stack]||{count:1,placed:0,weight:1},k=m.stackWeight/T.weight||1;if(m.horizontal){let P=e.w*k,F=T.size||b.height;Jr(T.start)&&(h=T.start),b.fullSize?hv(b,a.left,h,i.outerWidth-a.right-a.left,F):hv(b,e.left+T.placed,h,P,F),T.start=h,T.placed+=P,h=b.bottom}else{let P=e.h*k,F=T.size||b.width;Jr(T.start)&&(r=T.start),b.fullSize?hv(b,r,a.top,F,i.outerHeight-a.bottom-a.top):hv(b,r,e.top+T.placed,F,P),T.start=r,T.placed+=P,r=b.right}}e.x=r,e.y=h}var Cs={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(i){e.draw(i)}}]},t.boxes.push(e)},removeBox(t,e){let i=t.boxes?t.boxes.indexOf(e):-1;i!==-1&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,n){if(!t)return;let a=On(t.options.layout.padding),r=Math.max(e-a.width,0),h=Math.max(i-a.height,0),m=DO(t.boxes),b=m.vertical,T=m.horizontal;Wi(t.boxes,Y=>{typeof Y.beforeLayout=="function"&&Y.beforeLayout()});let k=b.reduce((Y,te)=>te.box.options&&te.box.options.display===!1?Y:Y+1,0)||1,P=Object.freeze({outerWidth:e,outerHeight:i,padding:a,availableWidth:r,availableHeight:h,vBoxMaxWidth:r/2/k,hBoxMaxHeight:h/2}),F=Object.assign({},a);RA(F,On(n));let U=Object.assign({maxPadding:F,w:r,h,x:a.left,y:a.top},a),X=PO(b.concat(T),P);Mg(m.fullSize,U,P,X),Mg(b,U,P,X),Mg(T,U,P,X)&&Mg(b,U,P,X),zO(U),qM(m.leftAndTop,U,P,X),U.x+=U.w,U.y+=U.h,qM(m.rightAndBottom,U,P,X),t.chartArea={left:U.left,top:U.top,right:U.left+U.w,bottom:U.top+U.h,height:U.h,width:U.w},Wi(m.chartArea,Y=>{let te=Y.box;Object.assign(te,t.chartArea),te.update(U.w,U.h,{left:0,top:0,right:0,bottom:0})})}},xv=class{acquireContext(e,i){}releaseContext(e){return!1}addEventListener(e,i,n){}removeEventListener(e,i,n){}getDevicePixelRatio(){return 1}getMaximumSize(e,i,n,a){return i=Math.max(0,i||e.width),n=n||e.height,{width:i,height:Math.max(0,a?Math.floor(i/a):n)}}isAttached(e){return!0}updateConfig(e){}},a2=class extends xv{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}},_v="$chartjs",FO={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},HM=t=>t===null||t==="";function BO(t,e){let i=t.style,n=t.getAttribute("height"),a=t.getAttribute("width");if(t[_v]={initial:{height:n,width:a,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",HM(a)){let r=ov(t,"width");r!==void 0&&(t.width=r)}if(HM(n))if(t.style.height==="")t.height=t.width/(e||2);else{let r=ov(t,"height");r!==void 0&&(t.height=r)}return t}var zA=BS?{passive:!0}:!1;function NO(t,e,i){t&&t.addEventListener(e,i,zA)}function VO(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,zA)}function $O(t,e){let i=FO[t.type]||t.type,{x:n,y:a}=zc(t,e);return{type:i,chart:e,native:t,x:n!==void 0?n:null,y:a!==void 0?a:null}}function wv(t,e){for(let i of t)if(i===e||i.contains(e))return!0}function UO(t,e,i){let n=t.canvas,a=new MutationObserver(r=>{let h=!1;for(let m of r)h=h||wv(m.addedNodes,n),h=h&&!wv(m.removedNodes,n);h&&i()});return a.observe(document,{childList:!0,subtree:!0}),a}function jO(t,e,i){let n=t.canvas,a=new MutationObserver(r=>{let h=!1;for(let m of r)h=h||wv(m.removedNodes,n),h=h&&!wv(m.addedNodes,n);h&&i()});return a.observe(document,{childList:!0,subtree:!0}),a}var Eg=new Map,WM=0;function OA(){let t=window.devicePixelRatio;t!==WM&&(WM=t,Eg.forEach((e,i)=>{i.currentDevicePixelRatio!==t&&e()}))}function qO(t,e){Eg.size||window.addEventListener("resize",OA),Eg.set(t,e)}function HO(t){Eg.delete(t),Eg.size||window.removeEventListener("resize",OA)}function WO(t,e,i){let n=t.canvas,a=n&&xg(n);if(!a)return;let r=G_((m,b)=>{let T=a.clientWidth;i(m,b),T<a.clientWidth&&i()},window),h=new ResizeObserver(m=>{let b=m[0],T=b.contentRect.width,k=b.contentRect.height;T===0&&k===0||r(T,k)});return h.observe(a),qO(t,r),h}function ZS(t,e,i){i&&i.disconnect(),e==="resize"&&HO(t)}function GO(t,e,i){let n=t.canvas,a=G_(r=>{t.ctx!==null&&i($O(r,t))},t);return NO(n,e,a),a}var l2=class extends xv{acquireContext(e,i){let n=e&&e.getContext&&e.getContext("2d");return n&&n.canvas===e?(BO(e,i),n):null}releaseContext(e){let i=e.canvas;if(!i[_v])return!1;let n=i[_v].initial;["height","width"].forEach(r=>{let h=n[r];yi(h)?i.removeAttribute(r):i.setAttribute(r,h)});let a=n.style||{};return Object.keys(a).forEach(r=>{i.style[r]=a[r]}),i.width=i.width,delete i[_v],!0}addEventListener(e,i,n){this.removeEventListener(e,i);let a=e.$proxies||(e.$proxies={}),h={attach:UO,detach:jO,resize:WO}[i]||GO;a[i]=h(e,i,n)}removeEventListener(e,i){let n=e.$proxies||(e.$proxies={}),a=n[i];if(!a)return;({attach:ZS,detach:ZS,resize:ZS}[i]||VO)(e,i,a),n[i]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,i,n,a){return FS(e,i,n,a)}isAttached(e){let i=e&&xg(e);return!!(i&&i.isConnected)}};function ZO(t){return!bg()||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas?a2:l2}var kr=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(e){let{x:i,y:n}=this.getProps(["x","y"],e);return{x:i,y:n}}hasValue(){return $a(this.x)&&$a(this.y)}getProps(e,i){let n=this.$animations;if(!i||!n)return this;let a={};return e.forEach(r=>{a[r]=n[r]&&n[r].active()?n[r]._to:this[r]}),a}};function KO(t,e){let i=t.options.ticks,n=XO(t),a=Math.min(i.maxTicksLimit||n,n),r=i.major.enabled?JO(e):[],h=r.length,m=r[0],b=r[h-1],T=[];if(h>a)return QO(e,T,r,h/a),T;let k=YO(r,e,a);if(h>0){let P,F,U=h>1?Math.round((b-m)/(h-1)):null;for(dv(e,T,k,yi(U)?0:m-U,m),P=0,F=h-1;P<F;P++)dv(e,T,k,r[P],r[P+1]);return dv(e,T,k,b,yi(U)?e.length:b+U),T}return dv(e,T,k),T}function XO(t){let e=t.options.offset,i=t._tickSize(),n=t._length/i+(e?0:1),a=t._maxLength/i;return Math.floor(Math.min(n,a))}function YO(t,e,i){let n=eF(t),a=e.length/i;if(!n)return Math.max(a,1);let r=wS(n);for(let h=0,m=r.length-1;h<m;h++){let b=r[h];if(b>a)return b}return Math.max(a,1)}function JO(t){let e=[],i,n;for(i=0,n=t.length;i<n;i++)t[i].major&&e.push(i);return e}function QO(t,e,i,n){let a=0,r=i[0],h;for(n=Math.ceil(n),h=0;h<t.length;h++)h===r&&(e.push(t[h]),a++,r=i[a*n])}function dv(t,e,i,n,a){let r=Ht(n,0),h=Math.min(Ht(a,t.length),t.length),m=0,b,T,k;for(i=Math.ceil(i),a&&(b=a-n,i=b/Math.floor(b/i)),k=r;k<0;)m++,k=Math.round(r+m*i);for(T=Math.max(r,0);T<h;T++)T===k&&(e.push(t[T]),m++,k=Math.round(r+m*i))}function eF(t){let e=t.length,i,n;if(e<2)return!1;for(n=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==n)return!1;return n}var tF=t=>t==="left"?"right":t==="right"?"left":t,GM=(t,e,i)=>e==="top"||e==="left"?t[e]+i:t[e]-i,ZM=(t,e)=>Math.min(e||t,t);function KM(t,e){let i=[],n=t.length/e,a=t.length,r=0;for(;r<a;r+=n)i.push(t[Math.floor(r)]);return i}function iF(t,e,i){let n=t.ticks.length,a=Math.min(e,n-1),r=t._startPixel,h=t._endPixel,m=1e-6,b=t.getPixelForTick(a),T;if(!(i&&(n===1?T=Math.max(b-r,h-b):e===0?T=(t.getPixelForTick(1)-b)/2:T=(b-t.getPixelForTick(a-1))/2,b+=a<e?T:-T,b<r-m||b>h+m)))return b}function nF(t,e){Wi(t,i=>{let n=i.gc,a=n.length/2,r;if(a>e){for(r=0;r<a;++r)delete i.data[n[r]];n.splice(0,a)}})}function kg(t){return t.drawTicks?t.tickLength:0}function XM(t,e){if(!t.display)return 0;let i=Sn(t.font,e),n=On(t.padding);return(Pi(t.text)?t.text.length:1)*i.lineHeight+n.height}function rF(t,e){return zl(t,{scale:e,type:"scale"})}function sF(t,e,i){return zl(t,{tick:i,index:e,type:"tick"})}function oF(t,e,i){let n=mg(t);return(i&&e!=="right"||!i&&e==="right")&&(n=tF(n)),n}function aF(t,e,i,n){let{top:a,left:r,bottom:h,right:m,chart:b}=t,{chartArea:T,scales:k}=b,P=0,F,U,X,Y=h-a,te=m-r;if(t.isHorizontal()){if(U=Or(n,r,m),Yt(i)){let le=Object.keys(i)[0],we=i[le];X=k[le].getPixelForValue(we)+Y-e}else i==="center"?X=(T.bottom+T.top)/2+Y-e:X=GM(t,i,e);F=m-r}else{if(Yt(i)){let le=Object.keys(i)[0],we=i[le];U=k[le].getPixelForValue(we)-te+e}else i==="center"?U=(T.left+T.right)/2-te+e:U=GM(t,i,e);X=Or(n,h,a),P=i==="left"?-an:an}return{titleX:U,titleY:X,maxWidth:F,rotation:P}}var wd=class t extends kr{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.chart,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._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,i){return e}getUserBounds(){let{_userMin:e,_userMax:i,_suggestedMin:n,_suggestedMax:a}=this;return e=js(e,Number.POSITIVE_INFINITY),i=js(i,Number.NEGATIVE_INFINITY),n=js(n,Number.POSITIVE_INFINITY),a=js(a,Number.NEGATIVE_INFINITY),{min:js(e,n),max:js(i,a),minDefined:pn(e),maxDefined:pn(i)}}getMinMax(e){let{min:i,max:n,minDefined:a,maxDefined:r}=this.getUserBounds(),h;if(a&&r)return{min:i,max:n};let m=this.getMatchingVisibleMetas();for(let b=0,T=m.length;b<T;++b)h=m[b].controller.getMinMax(this,e),a||(i=Math.min(i,h.min)),r||(n=Math.max(n,h.max));return i=r&&i>n?n:i,n=a&&i>n?i:n,{min:js(i,js(n,i)),max:js(n,js(i,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){$i(this.options.beforeUpdate,[this])}update(e,i,n){let{beginAtZero:a,grace:r,ticks:h}=this.options,m=h.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=i,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=DS(this,r,a),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let b=m<this.ticks.length;this._convertTicksToLabels(b?KM(this.ticks,m):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),h.display&&(h.autoSkip||h.source==="auto")&&(this.ticks=KO(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),b&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,i,n;this.isHorizontal()?(i=this.left,n=this.right):(i=this.top,n=this.bottom,e=!e),this._startPixel=i,this._endPixel=n,this._reversePixels=e,this._length=n-i,this._alignToPixels=this.options.alignToPixels}afterUpdate(){$i(this.options.afterUpdate,[this])}beforeSetDimensions(){$i(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){$i(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),$i(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){$i(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){let i=this.options.ticks,n,a,r;for(n=0,a=e.length;n<a;n++)r=e[n],r.label=$i(i.callback,[r.value,n,e],this)}afterTickToLabelConversion(){$i(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){$i(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let e=this.options,i=e.ticks,n=ZM(this.ticks.length,e.ticks.maxTicksLimit),a=i.minRotation||0,r=i.maxRotation,h=a,m,b,T;if(!this._isVisible()||!i.display||a>=r||n<=1||!this.isHorizontal()){this.labelRotation=a;return}let k=this._getLabelSizes(),P=k.widest.width,F=k.highest.height,U=fr(this.chart.width-P,0,this.maxWidth);m=e.offset?this.maxWidth/n:U/(n-1),P+6>m&&(m=U/(n-(e.offset?.5:1)),b=this.maxHeight-kg(e.grid)-i.padding-XM(e.title,this.chart.options.font),T=Math.sqrt(P*P+F*F),h=fd(Math.min(Math.asin(fr((k.highest.height+6)/m,-1,1)),Math.asin(fr(b/T,-1,1))-Math.asin(fr(F/T,-1,1)))),h=Math.max(a,Math.min(r,h))),this.labelRotation=h}afterCalculateLabelRotation(){$i(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){$i(this.options.beforeFit,[this])}fit(){let e={width:0,height:0},{chart:i,options:{ticks:n,title:a,grid:r}}=this,h=this._isVisible(),m=this.isHorizontal();if(h){let b=XM(a,i.options.font);if(m?(e.width=this.maxWidth,e.height=kg(r)+b):(e.height=this.maxHeight,e.width=kg(r)+b),n.display&&this.ticks.length){let{first:T,last:k,widest:P,highest:F}=this._getLabelSizes(),U=n.padding*2,X=zn(this.labelRotation),Y=Math.cos(X),te=Math.sin(X);if(m){let le=n.mirror?0:te*P.width+Y*F.height;e.height=Math.min(this.maxHeight,e.height+le+U)}else{let le=n.mirror?0:Y*P.width+te*F.height;e.width=Math.min(this.maxWidth,e.width+le+U)}this._calculatePadding(T,k,te,Y)}}this._handleMargins(),m?(this.width=this._length=i.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=i.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,i,n,a){let{ticks:{align:r,padding:h},position:m}=this.options,b=this.labelRotation!==0,T=m!=="top"&&this.axis==="x";if(this.isHorizontal()){let k=this.getPixelForTick(0)-this.left,P=this.right-this.getPixelForTick(this.ticks.length-1),F=0,U=0;b?T?(F=a*e.width,U=n*i.height):(F=n*e.height,U=a*i.width):r==="start"?U=i.width:r==="end"?F=e.width:r!=="inner"&&(F=e.width/2,U=i.width/2),this.paddingLeft=Math.max((F-k+h)*this.width/(this.width-k),0),this.paddingRight=Math.max((U-P+h)*this.width/(this.width-P),0)}else{let k=i.height/2,P=e.height/2;r==="start"?(k=0,P=e.height):r==="end"&&(k=i.height,P=0),this.paddingTop=k+h,this.paddingBottom=P+h}}_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(){$i(this.options.afterFit,[this])}isHorizontal(){let{axis:e,position:i}=this.options;return i==="top"||i==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let i,n;for(i=0,n=e.length;i<n;i++)yi(e[i].label)&&(e.splice(i,1),n--,i--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){let i=this.options.ticks.sampleSize,n=this.ticks;i<n.length&&(n=KM(n,i)),this._labelSizes=e=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,i,n){let{ctx:a,_longestTextCache:r}=this,h=[],m=[],b=Math.floor(i/ZM(i,n)),T=0,k=0,P,F,U,X,Y,te,le,we,Le,Oe,ze;for(P=0;P<i;P+=b){if(X=e[P].label,Y=this._resolveTickFontOptions(P),a.font=te=Y.string,le=r[te]=r[te]||{data:{},gc:[]},we=Y.lineHeight,Le=Oe=0,!yi(X)&&!Pi(X))Le=rf(a,le.data,le.gc,Le,X),Oe=we;else if(Pi(X))for(F=0,U=X.length;F<U;++F)ze=X[F],!yi(ze)&&!Pi(ze)&&(Le=rf(a,le.data,le.gc,Le,ze),Oe+=we);h.push(Le),m.push(Oe),T=Math.max(Le,T),k=Math.max(Oe,k)}nF(r,i);let Xe=h.indexOf(T),Ke=m.indexOf(k),rt=at=>({width:h[at]||0,height:m[at]||0});return{first:rt(0),last:rt(i-1),widest:rt(Xe),highest:rt(Ke),widths:h,heights:m}}getLabelForValue(e){return e}getPixelForValue(e,i){return NaN}getValueForPixel(e){}getPixelForTick(e){let i=this.ticks;return e<0||e>i.length-1?null:this.getPixelForValue(i[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);let i=this._startPixel+e*this._length;return TS(this._alignToPixels?Pc(this.chart,i,0):i)}getDecimalForPixel(e){let i=(e-this._startPixel)/this._length;return this._reversePixels?1-i:i}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:e,max:i}=this;return e<0&&i<0?i:e>0&&i>0?e:0}getContext(e){let i=this.ticks||[];if(e>=0&&e<i.length){let n=i[e];return n.$context||(n.$context=sF(this.getContext(),e,n))}return this.$context||(this.$context=rF(this.chart.getContext(),this))}_tickSize(){let e=this.options.ticks,i=zn(this.labelRotation),n=Math.abs(Math.cos(i)),a=Math.abs(Math.sin(i)),r=this._getLabelSizes(),h=e.autoSkipPadding||0,m=r?r.widest.width+h:0,b=r?r.highest.height+h:0;return this.isHorizontal()?b*n>m*a?m/n:b/a:b*a<m*n?b/n:m/a}_isVisible(){let e=this.options.display;return e!=="auto"?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){let i=this.axis,n=this.chart,a=this.options,{grid:r,position:h,border:m}=a,b=r.offset,T=this.isHorizontal(),P=this.ticks.length+(b?1:0),F=kg(r),U=[],X=m.setContext(this.getContext()),Y=X.display?X.width:0,te=Y/2,le=function(oi){return Pc(n,oi,Y)},we,Le,Oe,ze,Xe,Ke,rt,at,$t,Tt,Lt,Di;if(h==="top")we=le(this.bottom),Ke=this.bottom-F,at=we-te,Tt=le(e.top)+te,Di=e.bottom;else if(h==="bottom")we=le(this.top),Tt=e.top,Di=le(e.bottom)-te,Ke=we+te,at=this.top+F;else if(h==="left")we=le(this.right),Xe=this.right-F,rt=we-te,$t=le(e.left)+te,Lt=e.right;else if(h==="right")we=le(this.left),$t=e.left,Lt=le(e.right)-te,Xe=we+te,rt=this.left+F;else if(i==="x"){if(h==="center")we=le((e.top+e.bottom)/2+.5);else if(Yt(h)){let oi=Object.keys(h)[0],Si=h[oi];we=le(this.chart.scales[oi].getPixelForValue(Si))}Tt=e.top,Di=e.bottom,Ke=we+te,at=Ke+F}else if(i==="y"){if(h==="center")we=le((e.left+e.right)/2);else if(Yt(h)){let oi=Object.keys(h)[0],Si=h[oi];we=le(this.chart.scales[oi].getPixelForValue(Si))}Xe=we-te,rt=Xe-F,$t=e.left,Lt=e.right}let mn=Ht(a.ticks.maxTicksLimit,P),Bt=Math.max(1,Math.ceil(P/mn));for(Le=0;Le<P;Le+=Bt){let oi=this.getContext(Le),Si=r.setContext(oi),Gi=m.setContext(oi),Jt=Si.lineWidth,Fn=Si.color,Ms=Gi.dash||[],mr=Gi.dashOffset,vn=Si.tickWidth,Wn=Si.tickColor,In=Si.tickBorderDash||[],ln=Si.tickBorderDashOffset;Oe=iF(this,Le,b),Oe!==void 0&&(ze=Pc(n,Oe,Jt),T?Xe=rt=$t=Lt=ze:Ke=at=Tt=Di=ze,U.push({tx1:Xe,ty1:Ke,tx2:rt,ty2:at,x1:$t,y1:Tt,x2:Lt,y2:Di,width:Jt,color:Fn,borderDash:Ms,borderDashOffset:mr,tickWidth:vn,tickColor:Wn,tickBorderDash:In,tickBorderDashOffset:ln}))}return this._ticksLength=P,this._borderValue=we,U}_computeLabelItems(e){let i=this.axis,n=this.options,{position:a,ticks:r}=n,h=this.isHorizontal(),m=this.ticks,{align:b,crossAlign:T,padding:k,mirror:P}=r,F=kg(n.grid),U=F+k,X=P?-k:U,Y=-zn(this.labelRotation),te=[],le,we,Le,Oe,ze,Xe,Ke,rt,at,$t,Tt,Lt,Di="middle";if(a==="top")Xe=this.bottom-X,Ke=this._getXAxisLabelAlignment();else if(a==="bottom")Xe=this.top+X,Ke=this._getXAxisLabelAlignment();else if(a==="left"){let Bt=this._getYAxisLabelAlignment(F);Ke=Bt.textAlign,ze=Bt.x}else if(a==="right"){let Bt=this._getYAxisLabelAlignment(F);Ke=Bt.textAlign,ze=Bt.x}else if(i==="x"){if(a==="center")Xe=(e.top+e.bottom)/2+U;else if(Yt(a)){let Bt=Object.keys(a)[0],oi=a[Bt];Xe=this.chart.scales[Bt].getPixelForValue(oi)+U}Ke=this._getXAxisLabelAlignment()}else if(i==="y"){if(a==="center")ze=(e.left+e.right)/2-U;else if(Yt(a)){let Bt=Object.keys(a)[0],oi=a[Bt];ze=this.chart.scales[Bt].getPixelForValue(oi)}Ke=this._getYAxisLabelAlignment(F).textAlign}i==="y"&&(b==="start"?Di="top":b==="end"&&(Di="bottom"));let mn=this._getLabelSizes();for(le=0,we=m.length;le<we;++le){Le=m[le],Oe=Le.label;let Bt=r.setContext(this.getContext(le));rt=this.getPixelForTick(le)+r.labelOffset,at=this._resolveTickFontOptions(le),$t=at.lineHeight,Tt=Pi(Oe)?Oe.length:1;let oi=Tt/2,Si=Bt.color,Gi=Bt.textStrokeColor,Jt=Bt.textStrokeWidth,Fn=Ke;h?(ze=rt,Ke==="inner"&&(le===we-1?Fn=this.options.reverse?"left":"right":le===0?Fn=this.options.reverse?"right":"left":Fn="center"),a==="top"?T==="near"||Y!==0?Lt=-Tt*$t+$t/2:T==="center"?Lt=-mn.highest.height/2-oi*$t+$t:Lt=-mn.highest.height+$t/2:T==="near"||Y!==0?Lt=$t/2:T==="center"?Lt=mn.highest.height/2-oi*$t:Lt=mn.highest.height-Tt*$t,P&&(Lt*=-1),Y!==0&&!Bt.showLabelBackdrop&&(ze+=$t/2*Math.sin(Y))):(Xe=rt,Lt=(1-Tt)*$t/2);let Ms;if(Bt.showLabelBackdrop){let mr=On(Bt.backdropPadding),vn=mn.heights[le],Wn=mn.widths[le],In=Lt-mr.top,ln=0-mr.left;switch(Di){case"middle":In-=vn/2;break;case"bottom":In-=vn;break}switch(Ke){case"center":ln-=Wn/2;break;case"right":ln-=Wn;break;case"inner":le===we-1?ln-=Wn:le>0&&(ln-=Wn/2);break}Ms={left:ln,top:In,width:Wn+mr.width,height:vn+mr.height,color:Bt.backdropColor}}te.push({label:Oe,font:at,textOffset:Lt,options:{rotation:Y,color:Si,strokeColor:Gi,strokeWidth:Jt,textAlign:Fn,textBaseline:Di,translation:[ze,Xe],backdrop:Ms}})}return te}_getXAxisLabelAlignment(){let{position:e,ticks:i}=this.options;if(-zn(this.labelRotation))return e==="top"?"left":"right";let a="center";return i.align==="start"?a="left":i.align==="end"?a="right":i.align==="inner"&&(a="inner"),a}_getYAxisLabelAlignment(e){let{position:i,ticks:{crossAlign:n,mirror:a,padding:r}}=this.options,h=this._getLabelSizes(),m=e+r,b=h.widest.width,T,k;return i==="left"?a?(k=this.right+r,n==="near"?T="left":n==="center"?(T="center",k+=b/2):(T="right",k+=b)):(k=this.right-m,n==="near"?T="right":n==="center"?(T="center",k-=b/2):(T="left",k=this.left)):i==="right"?a?(k=this.left+r,n==="near"?T="right":n==="center"?(T="center",k-=b/2):(T="left",k-=b)):(k=this.left+m,n==="near"?T="left":n==="center"?(T="center",k+=b/2):(T="right",k=this.right)):T="right",{textAlign:T,x:k}}_computeLabelArea(){if(this.options.ticks.mirror)return;let e=this.chart,i=this.options.position;if(i==="left"||i==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(i==="top"||i==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){let{ctx:e,options:{backgroundColor:i},left:n,top:a,width:r,height:h}=this;i&&(e.save(),e.fillStyle=i,e.fillRect(n,a,r,h),e.restore())}getLineWidthForValue(e){let i=this.options.grid;if(!this._isVisible()||!i.display)return 0;let a=this.ticks.findIndex(r=>r.value===e);return a>=0?i.setContext(this.getContext(a)).lineWidth:0}drawGrid(e){let i=this.options.grid,n=this.ctx,a=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e)),r,h,m=(b,T,k)=>{!k.width||!k.color||(n.save(),n.lineWidth=k.width,n.strokeStyle=k.color,n.setLineDash(k.borderDash||[]),n.lineDashOffset=k.borderDashOffset,n.beginPath(),n.moveTo(b.x,b.y),n.lineTo(T.x,T.y),n.stroke(),n.restore())};if(i.display)for(r=0,h=a.length;r<h;++r){let b=a[r];i.drawOnChartArea&&m({x:b.x1,y:b.y1},{x:b.x2,y:b.y2},b),i.drawTicks&&m({x:b.tx1,y:b.ty1},{x:b.tx2,y:b.ty2},{color:b.tickColor,width:b.tickWidth,borderDash:b.tickBorderDash,borderDashOffset:b.tickBorderDashOffset})}}drawBorder(){let{chart:e,ctx:i,options:{border:n,grid:a}}=this,r=n.setContext(this.getContext()),h=n.display?r.width:0;if(!h)return;let m=a.setContext(this.getContext(0)).lineWidth,b=this._borderValue,T,k,P,F;this.isHorizontal()?(T=Pc(e,this.left,h)-h/2,k=Pc(e,this.right,m)+m/2,P=F=b):(P=Pc(e,this.top,h)-h/2,F=Pc(e,this.bottom,m)+m/2,T=k=b),i.save(),i.lineWidth=r.width,i.strokeStyle=r.color,i.beginPath(),i.moveTo(T,P),i.lineTo(k,F),i.stroke(),i.restore()}drawLabels(e){if(!this.options.ticks.display)return;let n=this.ctx,a=this._computeLabelArea();a&&Nu(n,a);let r=this.getLabelItems(e);for(let h of r){let m=h.options,b=h.font,T=h.label,k=h.textOffset;Dc(n,T,0,k,b,m)}a&&Vu(n)}drawTitle(){let{ctx:e,options:{position:i,title:n,reverse:a}}=this;if(!n.display)return;let r=Sn(n.font),h=On(n.padding),m=n.align,b=r.lineHeight/2;i==="bottom"||i==="center"||Yt(i)?(b+=h.bottom,Pi(n.text)&&(b+=r.lineHeight*(n.text.length-1))):b+=h.top;let{titleX:T,titleY:k,maxWidth:P,rotation:F}=aF(this,b,i,m);Dc(e,n.text,0,0,r,{color:n.color,maxWidth:P,rotation:F,textAlign:oF(m,i,a),textBaseline:"middle",translation:[T,k]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){let e=this.options,i=e.ticks&&e.ticks.z||0,n=Ht(e.grid&&e.grid.z,-1),a=Ht(e.border&&e.border.z,0);return!this._isVisible()||this.draw!==t.prototype.draw?[{z:i,draw:r=>{this.draw(r)}}]:[{z:n,draw:r=>{this.drawBackground(),this.drawGrid(r),this.drawTitle()}},{z:a,draw:()=>{this.drawBorder()}},{z:i,draw:r=>{this.drawLabels(r)}}]}getMatchingVisibleMetas(e){let i=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",a=[],r,h;for(r=0,h=i.length;r<h;++r){let m=i[r];m[n]===this.id&&(!e||m.type===e)&&a.push(m)}return a}_resolveTickFontOptions(e){let i=this.options.ticks.setContext(this.getContext(e));return Sn(i.font)}_maxDigits(){let e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}},lf=class{constructor(e,i,n){this.type=e,this.scope=i,this.override=n,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){let i=Object.getPrototypeOf(e),n;uF(i)&&(n=this.register(i));let a=this.items,r=e.id,h=this.scope+"."+r;if(!r)throw new Error("class does not have id: "+e);return r in a||(a[r]=e,lF(e,h,n),this.override&&fn.override(e.id,e.overrides)),h}get(e){return this.items[e]}unregister(e){let i=this.items,n=e.id,a=this.scope;n in i&&delete i[n],a&&n in fn[a]&&(delete fn[a][n],this.override&&delete Bu[n])}};function lF(t,e,i){let n=hd(Object.create(null),[i?fn.get(i):{},fn.get(e),t.defaults]);fn.set(e,n),t.defaultRoutes&&cF(e,t.defaultRoutes),t.descriptors&&fn.describe(e,t.descriptors)}function cF(t,e){Object.keys(e).forEach(i=>{let n=i.split("."),a=n.pop(),r=[t].concat(n).join("."),h=e[i].split("."),m=h.pop(),b=h.join(".");fn.route(r,a,b,m)})}function uF(t){return"id"in t&&"defaults"in t}var c2=class{constructor(){this.controllers=new lf(Bl,"datasets",!0),this.elements=new lf(kr,"elements"),this.plugins=new lf(Object,"plugins"),this.scales=new lf(wd,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,i,n){[...i].forEach(a=>{let r=n||this._getRegistryForType(a);n||r.isForType(a)||r===this.plugins&&a.id?this._exec(e,r,a):Wi(a,h=>{let m=n||this._getRegistryForType(h);this._exec(e,m,h)})})}_exec(e,i,n){let a=dg(e);$i(n["before"+a],[],n),i[e](n),$i(n["after"+a],[],n)}_getRegistryForType(e){for(let i=0;i<this._typedRegistries.length;i++){let n=this._typedRegistries[i];if(n.isForType(e))return n}return this.plugins}_get(e,i,n){let a=i.get(e);if(a===void 0)throw new Error('"'+e+'" is not a registered '+n+".");return a}},Fl=new c2,u2=class{constructor(){this._init=[]}notify(e,i,n,a){i==="beforeInit"&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install"));let r=a?this._descriptors(e).filter(a):this._descriptors(e),h=this._notify(r,e,i,n);return i==="afterDestroy"&&(this._notify(r,e,"stop"),this._notify(this._init,e,"uninstall")),h}_notify(e,i,n,a){a=a||{};for(let r of e){let h=r.plugin,m=h[n],b=[i,a,r.options];if($i(m,b,h)===!1&&a.cancelable)return!1}return!0}invalidate(){yi(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;let i=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),i}_createDescriptors(e,i){let n=e&&e.config,a=Ht(n.options&&n.options.plugins,{}),r=hF(n);return a===!1&&!i?[]:pF(e,r,a,i)}_notifyStateChanges(e){let i=this._oldCache||[],n=this._cache,a=(r,h)=>r.filter(m=>!h.some(b=>m.plugin.id===b.plugin.id));this._notify(a(i,n),e,"stop"),this._notify(a(n,i),e,"start")}};function hF(t){let e={},i=[],n=Object.keys(Fl.plugins.items);for(let r=0;r<n.length;r++)i.push(Fl.getPlugin(n[r]));let a=t.plugins||[];for(let r=0;r<a.length;r++){let h=a[r];i.indexOf(h)===-1&&(i.push(h),e[h.id]=!0)}return{plugins:i,localIds:e}}function dF(t,e){return!e&&t===!1?null:t===!0?{}:t}function pF(t,{plugins:e,localIds:i},n,a){let r=[],h=t.getContext();for(let m of e){let b=m.id,T=dF(n[b],a);T!==null&&r.push({plugin:m,options:fF(t.config,{plugin:m,local:i[b]},T,h)})}return r}function fF(t,{plugin:e,local:i},n,a){let r=t.pluginScopeKeys(e),h=t.getOptionScopes(n,r);return i&&e.defaults&&h.push(e.defaults),t.createResolver(h,a,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function h2(t,e){let i=fn.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function mF(t,e){let i=t;return t==="_index_"?i=e:t==="_value_"&&(i=e==="x"?"y":"x"),i}function gF(t,e){return t===e?"_index_":"_value_"}function YM(t){if(t==="x"||t==="y"||t==="r")return t}function yF(t){if(t==="top"||t==="bottom")return"x";if(t==="left"||t==="right")return"y"}function d2(t,...e){if(YM(t))return t;for(let i of e){let n=i.axis||yF(i.position)||t.length>1&&YM(t[0].toLowerCase());if(n)return n}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function JM(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function _F(t,e){if(e.data&&e.data.datasets){let i=e.data.datasets.filter(n=>n.xAxisID===t||n.yAxisID===t);if(i.length)return JM(t,"x",i[0])||JM(t,"y",i[0])}return{}}function vF(t,e){let i=Bu[t.type]||{scales:{}},n=e.scales||{},a=h2(t.type,e),r=Object.create(null);return Object.keys(n).forEach(h=>{let m=n[h];if(!Yt(m))return console.error(`Invalid scale configuration for scale: ${h}`);if(m._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${h}`);let b=d2(h,m,_F(h,t),fn.scales[m.type]),T=gF(b,a),k=i.scales||{};r[h]=dd(Object.create(null),[{axis:b},m,k[b],k[T]])}),t.data.datasets.forEach(h=>{let m=h.type||t.type,b=h.indexAxis||h2(m,e),k=(Bu[m]||{}).scales||{};Object.keys(k).forEach(P=>{let F=mF(P,b),U=h[F+"AxisID"]||F;r[U]=r[U]||Object.create(null),dd(r[U],[{axis:F},n[U],k[P]])})}),Object.keys(r).forEach(h=>{let m=r[h];dd(m,[fn.scales[m.type],fn.scale])}),r}function FA(t){let e=t.options||(t.options={});e.plugins=Ht(e.plugins,{}),e.scales=vF(t,e)}function BA(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function bF(t){return t=t||{},t.data=BA(t.data),FA(t),t}var QM=new Map,NA=new Set;function pv(t,e){let i=QM.get(t);return i||(i=e(),QM.set(t,i),NA.add(i)),i}var Cg=(t,e,i)=>{let n=Rl(e,i);n!==void 0&&t.add(n)},p2=class{constructor(e){this._config=bF(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=BA(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){let e=this._config;this.clearCache(),FA(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return pv(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,i){return pv(`${e}.transition.${i}`,()=>[[`datasets.${e}.transitions.${i}`,`transitions.${i}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,i){return pv(`${e}-${i}`,()=>[[`datasets.${e}.elements.${i}`,`datasets.${e}`,`elements.${i}`,""]])}pluginScopeKeys(e){let i=e.id,n=this.type;return pv(`${n}-plugin-${i}`,()=>[[`plugins.${i}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,i){let n=this._scopeCache,a=n.get(e);return(!a||i)&&(a=new Map,n.set(e,a)),a}getOptionScopes(e,i,n){let{options:a,type:r}=this,h=this._cachedScopes(e,n),m=h.get(i);if(m)return m;let b=new Set;i.forEach(k=>{e&&(b.add(e),k.forEach(P=>Cg(b,e,P))),k.forEach(P=>Cg(b,a,P)),k.forEach(P=>Cg(b,Bu[r]||{},P)),k.forEach(P=>Cg(b,fn,P)),k.forEach(P=>Cg(b,J_,P))});let T=Array.from(b);return T.length===0&&T.push(Object.create(null)),NA.has(i)&&h.set(i,T),T}chartOptionScopes(){let{options:e,type:i}=this;return[e,Bu[i]||{},fn.datasets[i]||{},{type:i},fn,J_]}resolveNamedOptions(e,i,n,a=[""]){let r={$shared:!0},{resolver:h,subPrefixes:m}=eA(this._resolverCache,e,a),b=h;if(wF(h,i)){r.$shared=!1,n=Yr(n)?n():n;let T=this.createResolver(e,n,m);b=Fu(h,n,T)}for(let T of i)r[T]=b[T];return r}createResolver(e,i,n=[""],a){let{resolver:r}=eA(this._resolverCache,e,n);return Yt(i)?Fu(r,i,void 0,a):r}};function eA(t,e,i){let n=t.get(e);n||(n=new Map,t.set(e,n));let a=i.join(),r=n.get(a);return r||(r={resolver:vg(e,i),subPrefixes:i.filter(m=>!m.toLowerCase().includes("hover"))},n.set(a,r)),r}var xF=t=>Yt(t)&&Object.getOwnPropertyNames(t).some(e=>Yr(t[e]));function wF(t,e){let{isScriptable:i,isIndexable:n}=iv(t);for(let a of e){let r=i(a),h=n(a),m=(h||r)&&t[a];if(r&&(Yr(m)||xF(m))||h&&Pi(m))return!0}return!1}var SF="4.4.8",TF=["top","bottom","left","right","chartArea"];function tA(t,e){return t==="top"||t==="bottom"||TF.indexOf(t)===-1&&e==="x"}function iA(t,e){return function(i,n){return i[t]===n[t]?i[e]-n[e]:i[t]-n[t]}}function nA(t){let e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),$i(i&&i.onComplete,[t],e)}function kF(t){let e=t.chart,i=e.options.animation;$i(i&&i.onProgress,[t],e)}function VA(t){return bg()&&typeof t=="string"?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}var vv={},rA=t=>{let e=VA(t);return Object.values(vv).filter(i=>i.canvas===e).pop()};function CF(t,e,i){let n=Object.keys(t);for(let a of n){let r=+a;if(r>=e){let h=t[a];delete t[a],(i>0||r>e)&&(t[r+i]=h)}}}function MF(t,e,i,n){return!i||t.type==="mouseout"?null:n?e:t}function fv(t,e,i){return t.options.clip?t[i]:e[i]}function AF(t,e){let{xScale:i,yScale:n}=t;return i&&n?{left:fv(i,e,"left"),right:fv(i,e,"right"),top:fv(n,e,"top"),bottom:fv(n,e,"bottom")}:e}var Nl=class{static defaults=fn;static instances=vv;static overrides=Bu;static registry=Fl;static version=SF;static getChart=rA;static register(...e){Fl.add(...e),sA()}static unregister(...e){Fl.remove(...e),sA()}constructor(e,i){let n=this.config=new p2(i),a=VA(e),r=rA(a);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.");let h=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||ZO(a)),this.platform.updateConfig(n);let m=this.platform.acquireContext(a,h.aspectRatio),b=m&&m.canvas,T=b&&b.height,k=b&&b.width;if(this.id=vS(),this.ctx=m,this.canvas=b,this.width=k,this.height=T,this._options=h,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 u2,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=AS(P=>this.update(P),h.resizeDelay||0),this._dataChanges=[],vv[this.id]=this,!m||!b){console.error("Failed to create chart: can't acquire context from the given item");return}Oc.listen(this,"complete",nA),Oc.listen(this,"progress",kF),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:e,maintainAspectRatio:i},width:n,height:a,_aspectRatio:r}=this;return yi(e)?i&&r?r:a?n/a:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return Fl}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():sv(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Q_(this.canvas,this.ctx),this}stop(){return Oc.stop(this),this}resize(e,i){Oc.running(this)?this._resizeBeforeDraw={width:e,height:i}:this._resize(e,i)}_resize(e,i){let n=this.options,a=this.canvas,r=n.maintainAspectRatio&&this.aspectRatio,h=this.platform.getMaximumSize(a,e,i,r),m=n.devicePixelRatio||this.platform.getDevicePixelRatio(),b=this.width?"resize":"attach";this.width=h.width,this.height=h.height,this._aspectRatio=this.aspectRatio,sv(this,m,!0)&&(this.notifyPlugins("resize",{size:h}),$i(n.onResize,[this,h],this),this.attached&&this._doResize(b)&&this.render())}ensureScalesHaveIDs(){let i=this.options.scales||{};Wi(i,(n,a)=>{n.id=a})}buildOrUpdateScales(){let e=this.options,i=e.scales,n=this.scales,a=Object.keys(n).reduce((h,m)=>(h[m]=!1,h),{}),r=[];i&&(r=r.concat(Object.keys(i).map(h=>{let m=i[h],b=d2(h,m),T=b==="r",k=b==="x";return{options:m,dposition:T?"chartArea":k?"bottom":"left",dtype:T?"radialLinear":k?"category":"linear"}}))),Wi(r,h=>{let m=h.options,b=m.id,T=d2(b,m),k=Ht(m.type,h.dtype);(m.position===void 0||tA(m.position,T)!==tA(h.dposition))&&(m.position=h.dposition),a[b]=!0;let P=null;if(b in n&&n[b].type===k)P=n[b];else{let F=Fl.getScale(k);P=new F({id:b,type:k,ctx:this.ctx,chart:this}),n[P.id]=P}P.init(m,e)}),Wi(a,(h,m)=>{h||delete n[m]}),Wi(n,h=>{Cs.configure(this,h,h.options),Cs.addBox(this,h)})}_updateMetasets(){let e=this._metasets,i=this.data.datasets.length,n=e.length;if(e.sort((a,r)=>a.index-r.index),n>i){for(let a=i;a<n;++a)this._destroyDatasetMeta(a);e.splice(i,n-i)}this._sortedMetasets=e.slice(0).sort(iA("order","index"))}_removeUnreferencedMetasets(){let{_metasets:e,data:{datasets:i}}=this;e.length>i.length&&delete this._stacks,e.forEach((n,a)=>{i.filter(r=>r===n._dataset).length===0&&this._destroyDatasetMeta(a)})}buildOrUpdateControllers(){let e=[],i=this.data.datasets,n,a;for(this._removeUnreferencedMetasets(),n=0,a=i.length;n<a;n++){let r=i[n],h=this.getDatasetMeta(n),m=r.type||this.config.type;if(h.type&&h.type!==m&&(this._destroyDatasetMeta(n),h=this.getDatasetMeta(n)),h.type=m,h.indexAxis=r.indexAxis||h2(m,this.options),h.order=r.order||0,h.index=n,h.label=""+r.label,h.visible=this.isDatasetVisible(n),h.controller)h.controller.updateIndex(n),h.controller.linkScales();else{let b=Fl.getController(m),{datasetElementType:T,dataElementType:k}=fn.datasets[m];Object.assign(b,{dataElementType:Fl.getElement(k),datasetElementType:T&&Fl.getElement(T)}),h.controller=new b(this,n),e.push(h.controller)}}return this._updateMetasets(),e}_resetElements(){Wi(this.data.datasets,(e,i)=>{this.getDatasetMeta(i).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){let i=this.config;i.update();let n=this._options=i.createResolver(i.chartOptionScopes(),this.getContext()),a=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;let r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let h=0;for(let T=0,k=this.data.datasets.length;T<k;T++){let{controller:P}=this.getDatasetMeta(T),F=!a&&r.indexOf(P)===-1;P.buildOrUpdateElements(F),h=Math.max(+P.getMaxOverflow(),h)}h=this._minPadding=n.layout.autoPadding?h:0,this._updateLayout(h),a||Wi(r,T=>{T.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(iA("z","_idx"));let{_active:m,_lastEvent:b}=this;b?this._eventHandler(b,!0):m.length&&this._updateHoverStyles(m,m,!0),this.render()}_updateScales(){Wi(this.scales,e=>{Cs.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let e=this.options,i=new Set(Object.keys(this._listeners)),n=new Set(e.events);(!V_(i,n)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:e}=this,i=this._getUniformDataChanges()||[];for(let{method:n,start:a,count:r}of i){let h=n==="_removeElements"?-r:r;CF(e,a,h)}}_getUniformDataChanges(){let e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];let i=this.data.datasets.length,n=r=>new Set(e.filter(h=>h[0]===r).map((h,m)=>m+","+h.splice(1).join(","))),a=n(0);for(let r=1;r<i;r++)if(!V_(a,n(r)))return;return Array.from(a).map(r=>r.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Cs.update(this,this.width,this.height,e);let i=this.chartArea,n=i.width<=0||i.height<=0;this._layers=[],Wi(this.boxes,a=>{n&&a.position==="chartArea"||(a.configure&&a.configure(),this._layers.push(...a._layers()))},this),this._layers.forEach((a,r)=>{a._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let i=0,n=this.data.datasets.length;i<n;++i)this.getDatasetMeta(i).controller.configure();for(let i=0,n=this.data.datasets.length;i<n;++i)this._updateDataset(i,Yr(e)?e({datasetIndex:i}):e);this.notifyPlugins("afterDatasetsUpdate",{mode:e})}}_updateDataset(e,i){let n=this.getDatasetMeta(e),a={meta:n,index:e,mode:i,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",a)!==!1&&(n.controller._update(i),a.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",a))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Oc.has(this)?this.attached&&!Oc.running(this)&&Oc.start(this):(this.draw(),nA({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){let{width:n,height:a}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(n,a)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;let i=this._layers;for(e=0;e<i.length&&i[e].z<=0;++e)i[e].draw(this.chartArea);for(this._drawDatasets();e<i.length;++e)i[e].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(e){let i=this._sortedMetasets,n=[],a,r;for(a=0,r=i.length;a<r;++a){let h=i[a];(!e||h.visible)&&n.push(h)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;let e=this.getSortedVisibleDatasetMetas();for(let i=e.length-1;i>=0;--i)this._drawDataset(e[i]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){let i=this.ctx,n=e._clip,a=!n.disabled,r=AF(e,this.chartArea),h={meta:e,index:e.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",h)!==!1&&(a&&Nu(i,{left:n.left===!1?0:r.left-n.left,right:n.right===!1?this.width:r.right+n.right,top:n.top===!1?0:r.top-n.top,bottom:n.bottom===!1?this.height:r.bottom+n.bottom}),e.controller.draw(),a&&Vu(i),h.cancelable=!1,this.notifyPlugins("afterDatasetDraw",h))}isPointInArea(e){return Na(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,i,n,a){let r=EO.modes[i];return typeof r=="function"?r(this,e,n,a):[]}getDatasetMeta(e){let i=this.data.datasets[e],n=this._metasets,a=n.filter(r=>r&&r._dataset===i).pop();return a||(a={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:i&&i.order||0,index:e,_dataset:i,_parsed:[],_sorted:!1},n.push(a)),a}getContext(){return this.$context||(this.$context=zl(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){let i=this.data.datasets[e];if(!i)return!1;let n=this.getDatasetMeta(e);return typeof n.hidden=="boolean"?!n.hidden:!i.hidden}setDatasetVisibility(e,i){let n=this.getDatasetMeta(e);n.hidden=!i}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,i,n){let a=n?"show":"hide",r=this.getDatasetMeta(e),h=r.controller._resolveAnimations(void 0,a);Jr(i)?(r.data[i].hidden=!n,this.update()):(this.setDatasetVisibility(e,n),h.update(r,{visible:n}),this.update(m=>m.datasetIndex===e?a:void 0))}hide(e,i){this._updateVisibility(e,i,!1)}show(e,i){this._updateVisibility(e,i,!0)}_destroyDatasetMeta(e){let i=this._metasets[e];i&&i.controller&&i.controller._destroy(),delete this._metasets[e]}_stop(){let e,i;for(this.stop(),Oc.remove(this),e=0,i=this.data.datasets.length;e<i;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:e,ctx:i}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),Q_(e,i),this.platform.releaseContext(i),this.canvas=null,this.ctx=null),delete vv[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let e=this._listeners,i=this.platform,n=(r,h)=>{i.addEventListener(this,r,h),e[r]=h},a=(r,h,m)=>{r.offsetX=h,r.offsetY=m,this._eventHandler(r)};Wi(this.options.events,r=>n(r,a))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let e=this._responsiveListeners,i=this.platform,n=(b,T)=>{i.addEventListener(this,b,T),e[b]=T},a=(b,T)=>{e[b]&&(i.removeEventListener(this,b,T),delete e[b])},r=(b,T)=>{this.canvas&&this.resize(b,T)},h,m=()=>{a("attach",m),this.attached=!0,this.resize(),n("resize",r),n("detach",h)};h=()=>{this.attached=!1,a("resize",r),this._stop(),this._resize(0,0),n("attach",m)},i.isAttached(this.canvas)?m():h()}unbindEvents(){Wi(this._listeners,(e,i)=>{this.platform.removeEventListener(this,i,e)}),this._listeners={},Wi(this._responsiveListeners,(e,i)=>{this.platform.removeEventListener(this,i,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,i,n){let a=n?"set":"remove",r,h,m,b;for(i==="dataset"&&(r=this.getDatasetMeta(e[0].datasetIndex),r.controller["_"+a+"DatasetHoverStyle"]()),m=0,b=e.length;m<b;++m){h=e[m];let T=h&&this.getDatasetMeta(h.datasetIndex).controller;T&&T[a+"HoverStyle"](h.element,h.datasetIndex,h.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){let i=this._active||[],n=e.map(({datasetIndex:r,index:h})=>{let m=this.getDatasetMeta(r);if(!m)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:m.data[h],index:h}});!of(n,i)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,i))}notifyPlugins(e,i,n){return this._plugins.notify(this,e,i,n)}isPluginEnabled(e){return this._plugins._cache.filter(i=>i.plugin.id===e).length===1}_updateHoverStyles(e,i,n){let a=this.options.hover,r=(b,T)=>b.filter(k=>!T.some(P=>k.datasetIndex===P.datasetIndex&&k.index===P.index)),h=r(i,e),m=n?e:r(e,i);h.length&&this.updateHoverStyle(h,a.mode,!1),m.length&&a.mode&&this.updateHoverStyle(m,a.mode,!0)}_eventHandler(e,i){let n={event:e,replay:i,cancelable:!0,inChartArea:this.isPointInArea(e)},a=h=>(h.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",n,a)===!1)return;let r=this._handleEvent(e,i,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,a),(r||n.changed)&&this.render(),this}_handleEvent(e,i,n){let{_active:a=[],options:r}=this,h=i,m=this._getActiveElements(e,a,n,h),b=xS(e),T=MF(e,this._lastEvent,n,b);n&&(this._lastEvent=null,$i(r.onHover,[e,m,this],this),b&&$i(r.onClick,[e,m,this],this));let k=!of(m,a);return(k||i)&&(this._active=m,this._updateHoverStyles(m,a,i)),this._lastEvent=T,k}_getActiveElements(e,i,n,a){if(e.type==="mouseout")return[];if(!n)return i;let r=this.options.hover;return this.getElementsAtEventForMode(e,r.mode,r,a)}};function sA(){return Wi(Nl.instances,t=>t._plugins.invalidate())}function EF(t,e,i){let{startAngle:n,pixelMargin:a,x:r,y:h,outerRadius:m,innerRadius:b}=e,T=a/m;t.beginPath(),t.arc(r,h,m,n-T,i+T),b>a?(T=a/b,t.arc(r,h,b,i+T,n-T,!0)):t.arc(r,h,a,i+an,n-an),t.closePath(),t.clip()}function IF(t){return _g(t,["outerStart","outerEnd","innerStart","innerEnd"])}function LF(t,e,i,n){let a=IF(t.options.borderRadius),r=(i-e)/2,h=Math.min(r,n*e/2),m=b=>{let T=(i-Math.min(r,b))*n/2;return fr(b,0,Math.min(r,T))};return{outerStart:m(a.outerStart),outerEnd:m(a.outerEnd),innerStart:fr(a.innerStart,0,h),innerEnd:fr(a.innerEnd,0,h)}}function af(t,e,i,n){return{x:i+t*Math.cos(e),y:n+t*Math.sin(e)}}function Sv(t,e,i,n,a,r){let{x:h,y:m,startAngle:b,pixelMargin:T,innerRadius:k}=e,P=Math.max(e.outerRadius+n+i-T,0),F=k>0?k+n+i+T:0,U=0,X=a-b;if(n){let Bt=k>0?k-n:0,oi=P>0?P-n:0,Si=(Bt+oi)/2,Gi=Si!==0?X*Si/(Si+n):X;U=(X-Gi)/2}let Y=Math.max(.001,X*P-i/gi)/P,te=(X-Y)/2,le=b+te+U,we=a-te-U,{outerStart:Le,outerEnd:Oe,innerStart:ze,innerEnd:Xe}=LF(e,F,P,we-le),Ke=P-Le,rt=P-Oe,at=le+Le/Ke,$t=we-Oe/rt,Tt=F+ze,Lt=F+Xe,Di=le+ze/Tt,mn=we-Xe/Lt;if(t.beginPath(),r){let Bt=(at+$t)/2;if(t.arc(h,m,P,at,Bt),t.arc(h,m,P,Bt,$t),Oe>0){let Jt=af(rt,$t,h,m);t.arc(Jt.x,Jt.y,Oe,$t,we+an)}let oi=af(Lt,we,h,m);if(t.lineTo(oi.x,oi.y),Xe>0){let Jt=af(Lt,mn,h,m);t.arc(Jt.x,Jt.y,Xe,we+an,mn+Math.PI)}let Si=(we-Xe/F+(le+ze/F))/2;if(t.arc(h,m,F,we-Xe/F,Si,!0),t.arc(h,m,F,Si,le+ze/F,!0),ze>0){let Jt=af(Tt,Di,h,m);t.arc(Jt.x,Jt.y,ze,Di+Math.PI,le-an)}let Gi=af(Ke,le,h,m);if(t.lineTo(Gi.x,Gi.y),Le>0){let Jt=af(Ke,at,h,m);t.arc(Jt.x,Jt.y,Le,le-an,at)}}else{t.moveTo(h,m);let Bt=Math.cos(at)*P+h,oi=Math.sin(at)*P+m;t.lineTo(Bt,oi);let Si=Math.cos($t)*P+h,Gi=Math.sin($t)*P+m;t.lineTo(Si,Gi)}t.closePath()}function PF(t,e,i,n,a){let{fullCircles:r,startAngle:h,circumference:m}=e,b=e.endAngle;if(r){Sv(t,e,i,n,b,a);for(let T=0;T<r;++T)t.fill();isNaN(m)||(b=h+(m%Yi||Yi))}return Sv(t,e,i,n,b,a),t.fill(),b}function DF(t,e,i,n,a){let{fullCircles:r,startAngle:h,circumference:m,options:b}=e,{borderWidth:T,borderJoinStyle:k,borderDash:P,borderDashOffset:F}=b,U=b.borderAlign==="inner";if(!T)return;t.setLineDash(P||[]),t.lineDashOffset=F,U?(t.lineWidth=T*2,t.lineJoin=k||"round"):(t.lineWidth=T,t.lineJoin=k||"bevel");let X=e.endAngle;if(r){Sv(t,e,i,n,X,a);for(let Y=0;Y<r;++Y)t.stroke();isNaN(m)||(X=h+(m%Yi||Yi))}U&&EF(t,e,X),r||(Sv(t,e,i,n,X,a),t.stroke())}var f2=class extends kr{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:e=>e!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(e){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,i,n){let a=this.getProps(["x","y"],n),{angle:r,distance:h}=md(a,{x:e,y:i}),{startAngle:m,endAngle:b,innerRadius:T,outerRadius:k,circumference:P}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],n),F=(this.options.spacing+this.options.borderWidth)/2,U=Ht(P,b-m),X=gd(r,m,b)&&m!==b,Y=U>=Yi||X,te=Ua(h,T+F,k+F);return Y&&te}getCenterPoint(e){let{x:i,y:n,startAngle:a,endAngle:r,innerRadius:h,outerRadius:m}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:b,spacing:T}=this.options,k=(a+r)/2,P=(h+m+T+b)/2;return{x:i+Math.cos(k)*P,y:n+Math.sin(k)*P}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:i,circumference:n}=this,a=(i.offset||0)/4,r=(i.spacing||0)/2,h=i.circular;if(this.pixelMargin=i.borderAlign==="inner"?.33:0,this.fullCircles=n>Yi?Math.floor(n/Yi):0,n===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let m=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(m)*a,Math.sin(m)*a);let b=1-Math.sin(Math.min(gi,n||0)),T=a*b;e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor,PF(e,this,T,r,h),DF(e,this,T,r,h),e.restore(
vendor: 6,624 bytes, line 730
730)}};function $A(t,e,i=e){t.lineCap=Ht(i.borderCapStyle,e.borderCapStyle),t.setLineDash(Ht(i.borderDash,e.borderDash)),t.lineDashOffset=Ht(i.borderDashOffset,e.borderDashOffset),t.lineJoin=Ht(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=Ht(i.borderWidth,e.borderWidth),t.strokeStyle=Ht(i.borderColor,e.borderColor)}function RF(t,e,i){t.lineTo(i.x,i.y)}function zF(t){return t.stepped?LS:t.tension||t.cubicInterpolationMode==="monotone"?PS:RF}function UA(t,e,i={}){let n=t.length,{start:a=0,end:r=n-1}=i,{start:h,end:m}=e,b=Math.max(a,h),T=Math.min(r,m),k=a<h&&r<h||a>m&&r>m;return{count:n,start:b,loop:e.loop,ilen:T<b&&!k?n+T-b:T-b}}function OF(t,e,i,n){let{points:a,options:r}=e,{count:h,start:m,loop:b,ilen:T}=UA(a,i,n),k=zF(r),{move:P=!0,reverse:F}=n||{},U,X,Y;for(U=0;U<=T;++U)X=a[(m+(F?T-U:U))%h],!X.skip&&(P?(t.moveTo(X.x,X.y),P=!1):k(t,Y,X,F,r.stepped),Y=X);return b&&(X=a[(m+(F?T:0))%h],k(t,Y,X,F,r.stepped)),!!b}function FF(t,e,i,n){let a=e.points,{count:r,start:h,ilen:m}=UA(a,i,n),{move:b=!0,reverse:T}=n||{},k=0,P=0,F,U,X,Y,te,le,we=Oe=>(h+(T?m-Oe:Oe))%r,Le=()=>{Y!==te&&(t.lineTo(k,te),t.lineTo(k,Y),t.lineTo(k,le))};for(b&&(U=a[we(0)],t.moveTo(U.x,U.y)),F=0;F<=m;++F){if(U=a[we(F)],U.skip)continue;let Oe=U.x,ze=U.y,Xe=Oe|0;Xe===X?(ze<Y?Y=ze:ze>te&&(te=ze),k=(P*k+Oe)/++P):(Le(),t.lineTo(Oe,ze),X=Xe,P=0,Y=te=ze),le=ze}Le()}function m2(t){let e=t.options,i=e.borderDash&&e.borderDash.length;return!t._decimated&&!t._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!i?FF:OF}function BF(t){return t.stepped?NS:t.tension||t.cubicInterpolationMode==="monotone"?VS:Ic}function NF(t,e,i,n){let a=e._path;a||(a=e._path=new Path2D,e.path(a,i,n)&&a.closePath()),$A(t,e.options),t.stroke(a)}function VF(t,e,i,n){let{segments:a,options:r}=e,h=m2(e);for(let m of a)$A(t,r,m.style),t.beginPath(),h(t,e,m,{start:i,end:i+n-1})&&t.closePath(),t.stroke()}var $F=typeof Path2D=="function";function UF(t,e,i,n){$F&&!e.options.segment?NF(t,e,i,n):VF(t,e,i,n)}var uf=class extends kr{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:e=>e!=="borderDash"&&e!=="fill"};constructor(e){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,e&&Object.assign(this,e)}updateControlPoints(e,i){let n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){let a=n.spanGaps?this._loop:this._fullLoop;OS(this._points,n,e,a,i),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=$S(this,this.options.segment))}first(){let e=this.segments,i=this.points;return e.length&&i[e[0].start]}last(){let e=this.segments,i=this.points,n=e.length;return n&&i[e[n-1].end]}interpolate(e,i){let n=this.options,a=e[i],r=this.points,h=uv(this,{property:i,start:a,end:a});if(!h.length)return;let m=[],b=BF(n),T,k;for(T=0,k=h.length;T<k;++T){let{start:P,end:F}=h[T],U=r[P],X=r[F];if(U===X){m.push(U);continue}let Y=Math.abs((a-U[i])/(X[i]-U[i])),te=b(U,X,Y,n.stepped);te[i]=e[i],m.push(te)}return m.length===1?m[0]:m}pathSegment(e,i,n){return m2(this)(e,this,i,n)}path(e,i,n){let a=this.segments,r=m2(this),h=this._loop;i=i||0,n=n||this.points.length-i;for(let m of a)h&=r(e,this,m,{start:i,end:i+n-1});return!!h}draw(e,i,n,a){let r=this.options||{};(this.points||[]).length&&r.borderWidth&&(e.save(),UF(e,this,n,a),e.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}};function oA(t,e,i,n){let a=t.options,{[i]:r}=t.getProps([i],n);return Math.abs(e-r)<a.radius+a.hitRadius}var g2=class extends kr{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(e){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,i,n){let a=this.options,{x:r,y:h}=this.getProps(["x","y"],n);return Math.pow(e-r,2)+Math.pow(i-h,2)<Math.pow(a.hitRadius+a.radius,2)}inXRange(e,i){return oA(this,e,"x",i)}inYRange(e,i){return oA(this,e,"y",i)}getCenterPoint(e){let{x:i,y:n}=this.getProps(["x","y"],e);return{x:i,y:n}}size(e){e=e||this.options||{};let i=e.radius||0;i=Math.max(i,i&&e.hoverRadius||0);let n=i&&e.borderWidth||0;return(i+n)*2}draw(e,i){let n=this.options;this.skip||n.radius<.1||!Na(this,i,this.size(n)/2)||(e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.fillStyle=n.backgroundColor,yg(e,n,this.x,this.y))}getRange(){let e=this.options||{};return e.radius+e.hitRadius}};function jA(t,e){let{x:i,y:n,base:a,width:r,height:h}=t.getProps(["x","y","base","width","height"],e),m,b,T,k,P;return t.horizontal?(P=h/2,m=Math.min(i,a),b=Math.max(i,a),T=n-P,k=n+P):(P=r/2,m=i-P,b=i+P,T=Math.min(n,a),k=Math.max(n,a)),{left:m,top:T,right:b,bottom:k}}function Uu(t,e,i,n){return t?0:fr(e,i,n)}function jF(t,e,i){let n=t.options.borderWidth,a=t.borderSkipped,r=tv(n);return{t:Uu(a.top,r.top,0,i),r:Uu(a.right,r.right,0,e),b:Uu(a.bottom,r.bottom,0,i),l:Uu(a.left,r.left,0,e)}}function qF(t,e,i){let{enableBorderRadius:n}=t.getProps(["enableBorderRadius"]),a=t.options.borderRadius,r=ja(a),h=Math.min(e,i),m=t.borderSkipped,b=n||Yt(a);return{topLeft:Uu(!b||m.top||m.left,r.topLeft,0,h),topRight:Uu(!b||m.top||m.right,r.topRight,0,h),bottomLeft:Uu(!b||m.bottom||m.left,r.bottomLeft,0,h),bottomRight:Uu(!b||m.bottom||m.right,r.bottomRight,0,h)}}function HF(t){let e=jA(t),i=e.right-e.left,n=e.bottom-e.top,a=jF(t,i/2,n/2),r=qF(t,i/2,n/2);return{outer:{x:e.left,y:e.top,w:i,h:n,radius:r},inner:{x:e.left+a.l,y:e.top+a.t,w:i-a.l-a.r,h:n-a.t-a.b,radius:{topLeft:Math.max(0,r.topLeft-Math.max(a.t,a.l)),topRight:Math.max(0,r.topRight-Math.max(a.t,a.r)),bottomLeft:Math.max(0,r.bottomLeft-Math.max(a.b,a.l)),bottomRight:Math.max(0,r.bottomRight-Math.max(a.b,a.r))}}}}function KS(t,e,i,n){let a=e===null,r=i===null,m=t&&!(a&&r)&&jA(t,n);return m&&(a||Ua(e,m.left,m.right))&&(r||Ua(i,m.top,m.bottom))}function WF(t){return t.topLeft||t.topRight||t.bottomLeft||t.bottomRight}function GF(t,e){t.rect(e.x,e.y,e.w,e.h)}
730function XS(t,e,i={}){let n=t.x!==i.x?-e:0,a=t.y!==i.y?-e:0,r=(t.x+t.w!==i.x+i.w?e:0)-n,h=(t.y+t.h!==i.y+i.h?e:0)-a;return{x:t.x+n,y:t.y+a,w:t.w+r,h:t.h+h,radius:t.radius}}var y2=class extends kr{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(e){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,e&&Object.assign(this,e)}draw(e){let{inflateAmount:i,options:{borderColor:n,backgroundColor:a}}=this,{inner:r,outer:h}=HF(this),m=WF(h.radius)?Rc:GF;e.save(),(h.w!==r.w||h.h!==r.h)&&(e.beginPath(),m(e,XS(h,i,r)),e.clip(),m(e,XS(r,-i,h)),e.fillStyle=n,e.fill("evenodd")),e.beginPath(),m(e,XS(r,i)),e.fillStyle=a,e.fill(),e.restore()}inRange(e,i,n){return KS(this,e,i,n)}inXRange(e,i){return KS(this,e,null,i)}inYRange(e,i){return KS(this,null,e,i)}getCenterPoint(e){let{x:i,y:n,base:a,horizontal:r}=this.getProps(["x","y","base","horizontal"],e);return{x:r?(i+a)/2:i,y:r?n:(n+a)/2}}getRange(e){return e==="x"?this.width/2:this.height/2}},ZF=Object.freeze({__proto__:null,ArcElement:f2,BarElement:y2,LineElement:uf,PointElement:g2}),_2=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],aA=_2.map(t=>t.replace("rgb(","rgba(").replace(")",", 0.5)"));function qA(t){return _2[t%_2.length]}function HA(t){return aA[t%aA.length]}function KF(t,e){return t.borderColor=qA(e),t.backgroundColor=HA(e),++e}function XF(t,e){return t.backgroundColor=t.data.map(()=>qA(e++)),e}function YF(t,e){return t.backgroundColor=t.data.map(()=>HA(e++)),e}function JF(t){let e=0;return(i,n)=>{let a=t.getDatasetMeta(n).controller;a instanceof xd?e=XF(i,e):a instanceof bv?e=YF(i,e):a&&(e=KF(i,e))}}function lA(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}function QF(t){return t&&(t.borderColor||t.backgroundColor)}function eB(){return fn.borderColor!=="rgba(0,0,0,0.1)"||fn.backgroundColor!=="rgba(0,0,0,0.1)"}var tB={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){if(!i.enabled)return;let{data:{datasets:n},options:a}=t.config,{elements:r}=a,h=lA(n)||QF(a)||r&&lA(r)||eB();if(!i.forceOverride&&h)return;let m=JF(t);n.forEach(m)}};function iB(t,e,i,n,a){let r=a.samples||n;if(r>=i)return t.slice(e,e+i);let h=[],m=(i-2)/(r-2),b=0,T=e+i-1,k=e,P,F,U,X,Y;for(h[b++]=t[k],P=0;P<r-2;P++){let te=0,le=0,we,Le=Math.floor((P+1)*m)+1+e,Oe=Math.min(Math.floor((P+2)*m)+1,i)+e,ze=Oe-Le;for(we=Le;we<Oe;we++)te+=t[we].x,le+=t[we].y;te/=ze,le/=ze;let Xe=Math.floor(P*m)+1+e,Ke=Math.min(Math.floor((P+1)*m)+1,i)+e,{x:rt,y:at}=t[k];for(U=X=-1,we=Xe;we<Ke;we++)X=.5*Math.abs((rt-te)*(t[we].y-at)-(rt-t[we].x)*(le-at)),X>U&&(U=X,F=t[we],Y=we);h[b++]=F,k=Y}return h[b++]=t[T],h}function nB(t,e,i,n){let a=0,r=0,h,m,b,T,k,P,F,U,X,Y,te=[],le=e+i-1,we=t[e].x,Oe=t[le].x-we;for(h=e;h<e+i;++h){m=t[h],b=(m.x-we)/Oe*n,T=m.y;let ze=b|0;if(ze===k)T<X?(X=T,P=h):T>Y&&(Y=T,F=h),a=(r*a+m.x)/++r;else{let Xe=h-1;if(!yi(P)&&!yi(F)){let Ke=Math.min(P,F),rt=Math.max(P,F);Ke!==U&&Ke!==Xe&&te.push({...t[Ke],x:a}),rt!==U&&rt!==Xe&&te.push({...t[rt],x:a})}h>0&&Xe!==U&&te.push(t[Xe]),te.push(m),k=ze,r=0,X=Y=T,P=F=U=h}}return te}function WA(t){if(t._decimated){let e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function cA(t){t.data.datasets.forEach(e=>{WA(e)})}function rB(t,e){let i=e.length,n=0,a,{iScale:r}=t,{min:h,max:m,minDefined:b,maxDefined:T}=r.getUserBounds();return b&&(n=fr(Ba(e,r.axis,h).lo,0,i-1)),T?a=fr(Ba(e,r.axis,m).hi+1,n,i)-n:a=i-n,{start:n,count:a}}var sB={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled){cA(t);return}let n=t.width;t.data.datasets.forEach((a,r)=>{let{_data:h,indexAxis:m}=a,b=t.getDatasetMeta(r),T=h||a.data;if(_d([m,t.options.indexAxis])==="y"||!b.controller.supportsDecimation)return;let k=t.scales[b.xAxisID];if(k.type!=="linear"&&k.type!=="time"||t.options.parsing)return;let{start:P,count:F}=rB(b,T),U=i.threshold||4*n;if(F<=U){WA(a);return}yi(h)&&(a._data=T,delete a.data,Object.defineProperty(a,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(Y){this._data=Y}}));let X;switch(i.algorithm){case"lttb":X=iB(T,P,F,n,i);break;case"min-max":X=nB(T,P,F,n);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}a._decimated=X})},destroy(t){cA(t)}};function oB(t,e,i){let n=t.segments,a=t.points,r=e.points,h=[];for(let m of n){let{start:b,end:T}=m;T=C2(b,T,a);let k=v2(i,a[b],a[T],m.loop);if(!e.segments){h.push({source:m,target:k,start:a[b],end:a[T]});continue}let P=uv(e,k);for(let F of P){let U=v2(i,r[F.start],r[F.end],F.loop),X=cv(m,a,U);for(let Y of X)h.push({source:Y,target:F,start:{[i]:uA(k,U,"start",Math.max)},end:{[i]:uA(k,U,"end",Math.min)}})}}return h}function v2(t,e,i,n){if(n)return;let a=e[t],r=i[t];return t==="angle"&&(a=Us(a),r=Us(r)),{property:t,start:a,end:r}}function aB(t,e){let{x:i=null,y:n=null}=t||{},a=e.points,r=[];
vendor: 4,432 bytes, line 730
730return e.segments.forEach(({start:h,end:m})=>{m=C2(h,m,a);let b=a[h],T=a[m];n!==null?(r.push({x:b.x,y:n}),r.push({x:T.x,y:n})):i!==null&&(r.push({x:i,y:b.y}),r.push({x:i,y:T.y}))}),r}function C2(t,e,i){for(;e>t;e--){let n=i[e];if(!isNaN(n.x)&&!isNaN(n.y))break}return e}function uA(t,e,i,n){return t&&e?n(t[i],e[i]):t?t[i]:e?e[i]:0}function GA(t,e){let i=[],n=!1;return Pi(t)?(n=!0,i=t):i=aB(t,e),i.length?new uf({points:i,options:{tension:0},_loop:n,_fullLoop:n}):null}function hA(t){return t&&t.fill!==!1}function lB(t,e,i){let a=t[e].fill,r=[e],h;if(!i)return a;for(;a!==!1&&r.indexOf(a)===-1;){if(!pn(a))return a;if(h=t[a],!h)return!1;if(h.visible)return a;r.push(a),a=h.fill}return!1}function cB(t,e,i){let n=pB(t);if(Yt(n))return isNaN(n.value)?!1:n;let a=parseFloat(n);return pn(a)&&Math.floor(a)===a?uB(n[0],e,a,i):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function uB(t,e,i,n){return(t==="-"||t==="+")&&(i=e+i),i===e||i<0||i>=n?!1:i}function hB(t,e){let i=null;return t==="start"?i=e.bottom:t==="end"?i=e.top:Yt(t)?i=e.getPixelForValue(t.value):e.getBasePixel&&(i=e.getBasePixel()),i}function dB(t,e,i){let n;return t==="start"?n=i:t==="end"?n=e.options.reverse?e.min:e.max:Yt(t)?n=t.value:n=e.getBaseValue(),n}function pB(t){let e=t.options,i=e.fill,n=Ht(i&&i.target,i);return n===void 0&&(n=!!e.backgroundColor),n===!1||n===null?!1:n===!0?"origin":n}function fB(t){let{scale:e,index:i,line:n}=t,a=[],r=n.segments,h=n.points,m=mB(e,i);m.push(GA({x:null,y:e.bottom},n));for(let b=0;b<r.length;b++){let T=r[b];for(let k=T.start;k<=T.end;k++)gB(a,h[k],m)}return new uf({points:a,options:{}})}function mB(t,e){let i=[],n=t.getMatchingVisibleMetas("line");for(let a=0;a<n.length;a++){let r=n[a];if(r.index===e)break;r.hidden||i.unshift(r.dataset)}return i}function gB(t,e,i){let n=[];for(let a=0;a<i.length;a++){let r=i[a],{first:h,last:m,point:b}=yB(r,e,"x");if(!(!b||h&&m)){if(h)n.unshift(b);else if(t.push(b),!m)break}}t.push(...n)}function yB(t,e,i){let n=t.interpolate(e,i);if(!n)return{};let a=n[i],r=t.segments,h=t.points,m=!1,b=!1;for(let T=0;T<r.length;T++){let k=r[T],P=h[k.start][i],F=h[k.end][i];if(Ua(a,P,F)){m=a===P,b=a===F;break}}return{first:m,last:b,point:n}}var Tv=class{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius}pathSegment(e,i,n){let{x:a,y:r,radius:h}=this;return i=i||{start:0,end:Yi},e.arc(a,r,h,i.end,i.start,!0),!n.bounds}interpolate(e){let{x:i,y:n,radius:a}=this,r=e.angle;return{x:i+Math.cos(r)*a,y:n+Math.sin(r)*a,angle:r}}};function _B(t){let{chart:e,fill:i,line:n}=t;if(pn(i))return vB(e,i);if(i==="stack")return fB(t);if(i==="shape")return!0;let a=bB(t);return a instanceof Tv?a:GA(a,n)}function vB(t,e){let i=t.getDatasetMeta(e);return i&&t.isDatasetVisible(e)?i.dataset:null}function bB(t){return(t.scale||{}).getPointPositionForValue?wB(t):xB(t)}function xB(t){let{scale:e={},fill:i}=t,n=hB(i,e);if(pn(n)){let a=e.isHorizontal();return{x:a?n:null,y:a?null:n}}return null}function wB(t){let{scale:e,fill:i}=t,n=e.options,a=e.getLabels().length,r=n.reverse?e.max:e.min,h=dB(i,e,r),m=[];if(n.grid.circular){let b=e.getPointPositionForValue(0,r);return new Tv({x:b.x,y:b.y,radius:e.getDistanceFromCenterForValue(h)})}for(let b=0;b<a;++b)m.push(e.getPointPositionForValue(b,h));return m}function YS(t,e,i){let n=_B(e),{line:a,scale:r,axis:h}=e,m=a.options,b=m.fill,T=m.backgroundColor,{above:k=T,below:P=T}=b||{};n&&a.points.length&&(Nu(t,i),SB(t,{line:a,target:n,above:k,below:P,area:i,scale:r,axis:h}),Vu(t))}function SB(t,e){let{line:i,target:n,above:a,below:r,area:h,scale:m}=e,b=i._loop?"angle":e.axis;t.save(),b==="x"&&r!==a&&(dA(t,n,h.top),pA(t,{line:i,target:n,color:a,scale:m,property:b}),t.restore(),t.save(),dA(t,n,h.bottom)),pA(t,{line:i,target:n,color:r,scale:m,property:b}),t.restore()}function dA(t,e,i){let{segments:n,points:a}=e,r=!0,h=!1;t.beginPath();for(let m of n){let{start:b,end:T}=m,k=a[b],P=a[C2(b,T,a)];r?(t.moveTo(k.x,k.y),r=!1):(t.lineTo(k.x,i),t.lineTo(k.x,k.y)),h=!!e.pathSegment(t,m,{move:h}),h?t.closePath():t.lineTo(P.x,i)}t.lineTo(e.first().x,i),t.closePath(),t.clip()}function pA(t,e){let{line:i,target:n,property:a,color:r,scale:h}=e,m=oB(i,n,a);for(let{source:b,target:T,start:k,end:P}of m){let{style:{backgroundColor:F=r}={}}=b,U=n!==!0;t.save(),t.fillStyle=F,TB(t,h,U&&v2(a,k,P)),t.beginPath();let X=!!i.pathSegment(t,b),Y;if(U){X?t.closePath():fA(t,n,P,a);let te=!!n.pathSegment(t,T,{move:X,reverse:!0});Y=X&&te,Y||fA(t,n,k,a)}
vendor: 5,400 bytes, line 730
730t.closePath(),t.fill(Y?"evenodd":"nonzero"),t.restore()}}function TB(t,e,i){let{top:n,bottom:a}=e.chart.chartArea,{property:r,start:h,end:m}=i||{};r==="x"&&(t.beginPath(),t.rect(h,n,m-h,a-n),t.clip())}function fA(t,e,i,n){let a=e.interpolate(i,n);a&&t.lineTo(a.x,a.y)}var kB={id:"filler",afterDatasetsUpdate(t,e,i){let n=(t.data.datasets||[]).length,a=[],r,h,m,b;for(h=0;h<n;++h)r=t.getDatasetMeta(h),m=r.dataset,b=null,m&&m.options&&m instanceof uf&&(b={visible:t.isDatasetVisible(h),index:h,fill:cB(m,h,n),chart:t,axis:r.controller.options.indexAxis,scale:r.vScale,line:m}),r.$filler=b,a.push(b);for(h=0;h<n;++h)b=a[h],!(!b||b.fill===!1)&&(b.fill=lB(a,h,i.propagate))},beforeDraw(t,e,i){let n=i.drawTime==="beforeDraw",a=t.getSortedVisibleDatasetMetas(),r=t.chartArea;for(let h=a.length-1;h>=0;--h){let m=a[h].$filler;m&&(m.line.updateControlPoints(r,m.axis),n&&m.fill&&YS(t.ctx,m,r))}},beforeDatasetsDraw(t,e,i){if(i.drawTime!=="beforeDatasetsDraw")return;let n=t.getSortedVisibleDatasetMetas();for(let a=n.length-1;a>=0;--a){let r=n[a].$filler;hA(r)&&YS(t.ctx,r,t.chartArea)}},beforeDatasetDraw(t,e,i){let n=e.meta.$filler;!hA(n)||i.drawTime!=="beforeDatasetDraw"||YS(t.ctx,n,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},mA=(t,e)=>{let{boxHeight:i=e,boxWidth:n=e}=t;return t.usePointStyle&&(i=Math.min(i,e),n=t.pointStyleWidth||Math.min(n,e)),{boxWidth:n,boxHeight:i,itemHeight:Math.max(e,i)}},CB=(t,e)=>t!==null&&e!==null&&t.datasetIndex===e.datasetIndex&&t.index===e.index,kv=class extends kr{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.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(e,i,n){this.maxWidth=e,this.maxHeight=i,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(){let e=this.options.labels||{},i=$i(e.generateLabels,[this.chart],this)||[];e.filter&&(i=i.filter(n=>e.filter(n,this.chart.data))),e.sort&&(i=i.sort((n,a)=>e.sort(n,a,this.chart.data))),this.options.reverse&&i.reverse(),this.legendItems=i}fit(){let{options:e,ctx:i}=this;if(!e.display){this.width=this.height=0;return}let n=e.labels,a=Sn(n.font),r=a.size,h=this._computeTitleHeight(),{boxWidth:m,itemHeight:b}=mA(n,r),T,k;i.font=a.string,this.isHorizontal()?(T=this.maxWidth,k=this._fitRows(h,r,m,b)+10):(k=this.maxHeight,T=this._fitCols(h,a,m,b)+10),this.width=Math.min(T,e.maxWidth||this.maxWidth),this.height=Math.min(k,e.maxHeight||this.maxHeight)}_fitRows(e,i,n,a){let{ctx:r,maxWidth:h,options:{labels:{padding:m}}}=this,b=this.legendHitBoxes=[],T=this.lineWidths=[0],k=a+m,P=e;r.textAlign="left",r.textBaseline="middle";let F=-1,U=-k;return this.legendItems.forEach((X,Y)=>{let te=n+i/2+r.measureText(X.text).width;(Y===0||T[T.length-1]+te+2*m>h)&&(P+=k,T[T.length-(Y>0?0:1)]=0,U+=k,F++),b[Y]={left:0,top:U,row:F,width:te,height:a},T[T.length-1]+=te+m}),P}_fitCols(e,i,n,a){let{ctx:r,maxHeight:h,options:{labels:{padding:m}}}=this,b=this.legendHitBoxes=[],T=this.columnSizes=[],k=h-e,P=m,F=0,U=0,X=0,Y=0;return this.legendItems.forEach((te,le)=>{let{itemWidth:we,itemHeight:Le}=MB(n,i,r,te,a);le>0&&U+Le+2*m>k&&(P+=F+m,T.push({width:F,height:U}),X+=F+m,Y++,F=U=0),b[le]={left:X,top:U,col:Y,width:we,height:Le},F=Math.max(F,we),U+=Le+m}),P+=F,T.push({width:F,height:U}),P}adjustHitBoxes(){if(!this.options.display)return;let e=this._computeTitleHeight(),{legendHitBoxes:i,options:{align:n,labels:{padding:a},rtl:r}}=this,h=$u(r,this.left,this.width);if(this.isHorizontal()){let m=0,b=Or(n,this.left+a,this.right-this.lineWidths[m]);for(let T of i)m!==T.row&&(m=T.row,b=Or(n,this.left+a,this.right-this.lineWidths[m])),T.top+=this.top+e+a,T.left=h.leftForLtr(h.x(b),T.width),b+=T.width+a}else{let m=0,b=Or(n,this.top+e+a,this.bottom-this.columnSizes[m].height);for(let T of i)T.col!==m&&(m=T.col,b=Or(n,this.top+e+a,this.bottom-this.columnSizes[m].height)),T.top=b,T.left+=this.left+a,T.left=h.leftForLtr(h.x(T.left),T.width),b+=T.height+a}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let e=this.ctx;Nu(e,this),this._draw(),Vu(e)}}_draw(){let{options:e,columnSizes:i,lineWidths:n,ctx:a}=this,{align:r,labels:h}=e,m=fn.color,b=$u(e.rtl,this.left,this.width),T=Sn(h.font),{padding:k}=h,P=T.size,F=P/2,U;this.drawTitle(),a.textAlign=b.textAlign("left"),a.textBaseline="middle",a.lineWidth=.5,a.font=T.string;let{boxWidth:X,boxHeight:Y,itemHeight:te}=mA(h,P),le=function(Xe,Ke,rt){if(isNaN(X)||X<=0||isNaN(Y)||Y<0)return;a.save();let at=Ht(rt.lineWidth,1);if(a.fillStyle=Ht(rt.fillStyle,m),a.lineCap=Ht(rt.lineCap,"butt"),a.lineDashOffset=Ht(rt.lineDashOffset,0),a.lineJoin=Ht(rt.lineJoin,"miter"),a.lineWidth=at,a.strokeStyle=Ht(rt.strokeStyle,m),a.setLineDash(Ht(rt.lineDash,[])),h.usePointStyle){let $t={radius:Y*Math.SQRT2/2,pointStyle:rt.pointStyle,rotation:rt.rotation,borderWidth:at},Tt=b.xPlus(Xe,X/2),Lt=Ke+F;
vendor: 4,409 bytes, line 730
730ev(a,$t,Tt,Lt,h.pointStyleWidth&&X)}else{let $t=Ke+Math.max((P-Y)/2,0),Tt=b.leftForLtr(Xe,X),Lt=ja(rt.borderRadius);a.beginPath(),Object.values(Lt).some(Di=>Di!==0)?Rc(a,{x:Tt,y:$t,w:X,h:Y,radius:Lt}):a.rect(Tt,$t,X,Y),a.fill(),at!==0&&a.stroke()}a.restore()},we=function(Xe,Ke,rt){Dc(a,rt.text,Xe,Ke+te/2,T,{strikethrough:rt.hidden,textAlign:b.textAlign(rt.textAlign)})},Le=this.isHorizontal(),Oe=this._computeTitleHeight();Le?U={x:Or(r,this.left+k,this.right-n[0]),y:this.top+k+Oe,line:0}:U={x:this.left+k,y:Or(r,this.top+Oe+k,this.bottom-i[0].height),line:0},av(this.ctx,e.textDirection);let ze=te+k;this.legendItems.forEach((Xe,Ke)=>{a.strokeStyle=Xe.fontColor,a.fillStyle=Xe.fontColor;let rt=a.measureText(Xe.text).width,at=b.textAlign(Xe.textAlign||(Xe.textAlign=h.textAlign)),$t=X+F+rt,Tt=U.x,Lt=U.y;b.setWidth(this.width),Le?Ke>0&&Tt+$t+k>this.right&&(Lt=U.y+=ze,U.line++,Tt=U.x=Or(r,this.left+k,this.right-n[U.line])):Ke>0&&Lt+ze>this.bottom&&(Tt=U.x=Tt+i[U.line].width+k,U.line++,Lt=U.y=Or(r,this.top+Oe+k,this.bottom-i[U.line].height));let Di=b.x(Tt);if(le(Di,Lt,Xe),Tt=ES(at,Tt+X+F,Le?Tt+$t:this.right,e.rtl),we(b.x(Tt),Lt,Xe),Le)U.x+=$t+k;else if(typeof Xe.text!="string"){let mn=T.lineHeight;U.y+=ZA(Xe,mn)+k}else U.y+=ze}),lv(this.ctx,e.textDirection)}drawTitle(){let e=this.options,i=e.title,n=Sn(i.font),a=On(i.padding);if(!i.display)return;let r=$u(e.rtl,this.left,this.width),h=this.ctx,m=i.position,b=n.size/2,T=a.top+b,k,P=this.left,F=this.width;if(this.isHorizontal())F=Math.max(...this.lineWidths),k=this.top+T,P=Or(e.align,P,this.right-F);else{let X=this.columnSizes.reduce((Y,te)=>Math.max(Y,te.height),0);k=T+Or(e.align,this.top,this.bottom-X-e.labels.padding-this._computeTitleHeight())}let U=Or(m,P,P+F);h.textAlign=r.textAlign(mg(m)),h.textBaseline="middle",h.strokeStyle=i.color,h.fillStyle=i.color,h.font=n.string,Dc(h,i.text,U,k,n)}_computeTitleHeight(){let e=this.options.title,i=Sn(e.font),n=On(e.padding);return e.display?i.lineHeight+n.height:0}_getLegendItemAt(e,i){let n,a,r;if(Ua(e,this.left,this.right)&&Ua(i,this.top,this.bottom)){for(r=this.legendHitBoxes,n=0;n<r.length;++n)if(a=r[n],Ua(e,a.left,a.left+a.width)&&Ua(i,a.top,a.top+a.height))return this.legendItems[n]}return null}handleEvent(e){let i=this.options;if(!IB(e.type,i))return;let n=this._getLegendItemAt(e.x,e.y);if(e.type==="mousemove"||e.type==="mouseout"){let a=this._hoveredItem,r=CB(a,n);a&&!r&&$i(i.onLeave,[e,a,this],this),this._hoveredItem=n,n&&!r&&$i(i.onHover,[e,n,this],this)}else n&&$i(i.onClick,[e,n,this],this)}};function MB(t,e,i,n,a){let r=AB(n,t,e,i),h=EB(a,n,e.lineHeight);return{itemWidth:r,itemHeight:h}}function AB(t,e,i,n){let a=t.text;return a&&typeof a!="string"&&(a=a.reduce((r,h)=>r.length>h.length?r:h)),e+i.size/2+n.measureText(a).width}function EB(t,e,i){let n=t;return typeof e.text!="string"&&(n=ZA(e,i)),n}function ZA(t,e){let i=t.text?t.text.length:0;return e*i}function IB(t,e){return!!((t==="mousemove"||t==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(t==="click"||t==="mouseup"))}var LB={id:"legend",_element:kv,start(t,e,i){let n=t.legend=new kv({ctx:t.ctx,options:i,chart:t});Cs.configure(t,n,i),Cs.addBox(t,n)},stop(t){Cs.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){let n=t.legend;Cs.configure(t,n,i),n.options=i},afterUpdate(t){let e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){let n=e.datasetIndex,a=i.chart;a.isDatasetVisible(n)?(a.hide(n),e.hidden=!0):(a.show(n),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){let e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:n,textAlign:a,color:r,useBorderRadius:h,borderRadius:m}}=t.legend.options;return t._getSortedDatasetMetas().map(b=>{let T=b.controller.getStyle(i?0:void 0),k=On(T.borderWidth);return{text:e[b.index].label,fillStyle:T.backgroundColor,fontColor:r,hidden:!b.visible,lineCap:T.borderCapStyle,lineDash:T.borderDash,lineDashOffset:T.borderDashOffset,lineJoin:T.borderJoinStyle,lineWidth:(k.width+k.height)/4,strokeStyle:T.borderColor,pointStyle:n||T.pointStyle,rotation:T.rotation,textAlign:a||T.textAlign,borderRadius:h&&(m||T.borderRadius),datasetIndex:b.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}}
vendor: 4,126 bytes, lines 730-732
730,descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}},Ig=class extends kr{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.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(e,i){let 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=e,this.height=this.bottom=i;let a=Pi(n.text)?n.text.length:1;this._padding=On(n.padding);let r=a*Sn(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=r:this.width=r}isHorizontal(){let e=this.options.position;return e==="top"||e==="bottom"}_drawArgs(e){let{top:i,left:n,bottom:a,right:r,options:h}=this,m=h.align,b=0,T,k,P;return this.isHorizontal()?(k=Or(m,n,r),P=i+e,T=r-n):(h.position==="left"?(k=n+e,P=Or(m,a,i),b=gi*-.5):(k=r-e,P=Or(m,i,a),b=gi*.5),T=a-i),{titleX:k,titleY:P,maxWidth:T,rotation:b}}draw(){let e=this.ctx,i=this.options;if(!i.display)return;let n=Sn(i.font),r=n.lineHeight/2+this._padding.top,{titleX:h,titleY:m,maxWidth:b,rotation:T}=this._drawArgs(r);Dc(e,i.text,0,0,n,{color:i.color,maxWidth:b,rotation:T,textAlign:mg(i.align),textBaseline:"middle",translation:[h,m]})}};function PB(t,e){let i=new Ig({ctx:t.ctx,options:e,chart:t});Cs.configure(t,i,e),Cs.addBox(t,i),t.titleBlock=i}var DB={id:"title",_element:Ig,start(t,e,i){PB(t,i)},stop(t){let e=t.titleBlock;Cs.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){let n=t.titleBlock;Cs.configure(t,n,i),n.options=i},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}},mv=new WeakMap,RB={id:"subtitle",start(t,e,i){let n=new Ig({ctx:t.ctx,options:i,chart:t});Cs.configure(t,n,i),Cs.addBox(t,n),mv.set(t,n)},stop(t){Cs.removeBox(t,mv.get(t)),mv.delete(t)},beforeUpdate(t,e,i){let n=mv.get(t);Cs.configure(t,n,i),n.options=i},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}},Ag={average(t){if(!t.length)return!1;let e,i,n=new Set,a=0,r=0;for(e=0,i=t.length;e<i;++e){let m=t[e].element;if(m&&m.hasValue()){let b=m.tooltipPosition();n.add(b.x),a+=b.y,++r}}return r===0||n.size===0?!1:{x:[...n].reduce((m,b)=>m+b)/n.size,y:a/r}},nearest(t,e){if(!t.length)return!1;let i=e.x,n=e.y,a=Number.POSITIVE_INFINITY,r,h,m;for(r=0,h=t.length;r<h;++r){let b=t[r].element;if(b&&b.hasValue()){let T=b.getCenterPoint(),k=Lc(e,T);k<a&&(a=k,m=b)}}if(m){let b=m.tooltipPosition();i=b.x,n=b.y}return{x:i,y:n}}};function Ol(t,e){return e&&(Pi(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function Fc(t){return(typeof t=="string"||t instanceof String)&&t.indexOf(`
731`)>-1?t.split(`
732`):t}function zB(t,e){let{element:i,datasetIndex:n,index:a}=e,r=t.getDatasetMeta(n).controller,{label:h,value:m}=r.getLabelAndValue(a);return{chart:t,label:h,parsed:r.getParsed(a),raw:t.data.datasets[n].data[a],formattedValue:m,dataset:r.getDataset(),dataIndex:a,datasetIndex:n,element:i}}function gA(t,e){let i=t.chart.ctx,{body:n,footer:a,title:r}=t,{boxWidth:h,boxHeight:m}=e,b=Sn(e.bodyFont),T=Sn(e.titleFont),k=Sn(e.footerFont),P=r.length,F=a.length,U=n.length,X=On(e.padding),Y=X.height,te=0,le=n.reduce((Oe,ze)=>Oe+ze.before.length+ze.lines.length+ze.after.length,0);if(le+=t.beforeBody.length+t.afterBody.length,P&&(Y+=P*T.lineHeight+(P-1)*e.titleSpacing+e.titleMarginBottom),le){let Oe=e.displayColors?Math.max(m,b.lineHeight):b.lineHeight;Y+=U*Oe+(le-U)*b.lineHeight+(le-1)*e.bodySpacing}F&&(Y+=e.footerMarginTop+F*k.lineHeight+(F-1)*e.footerSpacing);let we=0,Le=function(Oe){te=Math.max(te,i.measureText(Oe).width+we)};return i.save(),i.font=T.string,Wi(t.title,Le),i.font=b.string,Wi(t.beforeBody.concat(t.afterBody),Le),we=e.displayColors?h+2+e.boxPadding:0,Wi(n,Oe=>{Wi(Oe.before,Le),Wi(Oe.lines,Le),Wi(Oe.after,Le)}
vendor: 10,374 bytes, line 732
732),we=0,i.font=k.string,Wi(t.footer,Le),i.restore(),te+=X.width,{width:te,height:Y}}function OB(t,e){let{y:i,height:n}=e;return i<n/2?"top":i>t.height-n/2?"bottom":"center"}function FB(t,e,i,n){let{x:a,width:r}=n,h=i.caretSize+i.caretPadding;if(t==="left"&&a+r+h>e.width||t==="right"&&a-r-h<0)return!0}function BB(t,e,i,n){let{x:a,width:r}=i,{width:h,chartArea:{left:m,right:b}}=t,T="center";return n==="center"?T=a<=(m+b)/2?"left":"right":a<=r/2?T="left":a>=h-r/2&&(T="right"),FB(T,t,e,i)&&(T="center"),T}function yA(t,e,i){let n=i.yAlign||e.yAlign||OB(t,i);return{xAlign:i.xAlign||e.xAlign||BB(t,e,i,n),yAlign:n}}function NB(t,e){let{x:i,width:n}=t;return e==="right"?i-=n:e==="center"&&(i-=n/2),i}function VB(t,e,i){let{y:n,height:a}=t;return e==="top"?n+=i:e==="bottom"?n-=a+i:n-=a/2,n}function _A(t,e,i,n){let{caretSize:a,caretPadding:r,cornerRadius:h}=t,{xAlign:m,yAlign:b}=i,T=a+r,{topLeft:k,topRight:P,bottomLeft:F,bottomRight:U}=ja(h),X=NB(e,m),Y=VB(e,b,T);return b==="center"?m==="left"?X+=T:m==="right"&&(X-=T):m==="left"?X-=Math.max(k,F)+a:m==="right"&&(X+=Math.max(P,U)+a),{x:fr(X,0,n.width-e.width),y:fr(Y,0,n.height-e.height)}}function gv(t,e,i){let n=On(i.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-n.right:t.x+n.left}function vA(t){return Ol([],Fc(t))}function $B(t,e,i){return zl(t,{tooltip:e,tooltipItems:i,type:"tooltip"})}function bA(t,e){let i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}var KA={beforeTitle:Va,title(t){if(t.length>0){let e=t[0],i=e.chart.data.labels,n=i?i.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(n>0&&e.dataIndex<n)return i[e.dataIndex]}return""},afterTitle:Va,beforeBody:Va,beforeLabel:Va,label(t){if(this&&this.options&&this.options.mode==="dataset")return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");let i=t.formattedValue;return yi(i)||(e+=i),e},labelColor(t){let i=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:i.borderColor,backgroundColor:i.backgroundColor,borderWidth:i.borderWidth,borderDash:i.borderDash,borderDashOffset:i.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){let i=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:i.pointStyle,rotation:i.rotation}},afterLabel:Va,afterBody:Va,beforeFooter:Va,footer:Va,afterFooter:Va};function ro(t,e,i,n){let a=t[e].call(i,n);return typeof a>"u"?KA[e].call(i,n):a}var Cv=class extends kr{static positioners=Ag;constructor(e){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=e.chart,this.options=e.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(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let e=this._cachedAnimations;if(e)return e;let i=this.chart,n=this.options.setContext(this.getContext()),a=n.enabled&&i.options.animation&&n.animations,r=new cf(this.chart,a);return a._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=$B(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,i){let{callbacks:n}=i,a=ro(n,"beforeTitle",this,e),r=ro(n,"title",this,e),h=ro(n,"afterTitle",this,e),m=[];return m=Ol(m,Fc(a)),m=Ol(m,Fc(r)),m=Ol(m,Fc(h)),m}getBeforeBody(e,i){return vA(ro(i.callbacks,"beforeBody",this,e))}getBody(e,i){let{callbacks:n}=i,a=[];return Wi(e,r=>{let h={before:[],lines:[],after:[]},m=bA(n,r);Ol(h.before,Fc(ro(m,"beforeLabel",this,r))),Ol(h.lines,ro(m,"label",this,r)),Ol(h.after,Fc(ro(m,"afterLabel",this,r))),a.push(h)}),a}getAfterBody(e,i){return vA(ro(i.callbacks,"afterBody",this,e))}getFooter(e,i){let{callbacks:n}=i,a=ro(n,"beforeFooter",this,e),r=ro(n,"footer",this,e),h=ro(n,"afterFooter",this,e),m=[];return m=Ol(m,Fc(a)),m=Ol(m,Fc(r)),m=Ol(m,Fc(h)),m}_createItems(e){let i=this._active,n=this.chart.data,a=[],r=[],h=[],m=[],b,T;for(b=0,T=i.length;b<T;++b)m.push(zB(this.chart,i[b]));return e.filter&&(m=m.filter((k,P,F)=>e.filter(k,P,F,n))),e.itemSort&&(m=m.sort((k,P)=>e.itemSort(k,P,n))),Wi(m,k=>{let P=bA(e.callbacks,k);a.push(ro(P,"labelColor",this,k)),r.push(ro(P,"labelPointStyle",this,k)),h.push(ro(P,"labelTextColor",this,k))}),this.labelColors=a,this.labelPointStyles=r,this.labelTextColors=h,this.dataPoints=m,m}update(e,i){let n=this.options.setContext(this.getContext()),a=this._active,r,h=[];if(!a.length)this.opacity!==0&&(r={opacity:0});else{let m=Ag[n.position].call(this,a,this._eventPosition);h=this._createItems(n),this.title=this.getTitle(h,n),this.beforeBody=this.getBeforeBody(h,n),this.body=this.getBody(h,n),this.afterBody=this.getAfterBody(h,n),this.footer=this.getFooter(h,n);let b=this._size=gA(this,n),T=Object.assign({},m,b),k=yA(this.chart,n,T),P=_A(n,T,k,this.chart);this.xAlign=k.xAlign,this.yAlign=k.yAlign,r={opacity:1,x:P.x,y:P.y,width:b.width,height:b.height,caretX:m.x,caretY:m.y}}this._tooltipItems=h,this.$context=void 0,r&&this._resolveAnimations().update(this,r),e&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:i})}drawCaret(e,i,n,a){let r=this.getCaretPosition(e,n,a);i.lineTo(r.x1,r.y1),i.lineTo(r.x2,r.y2),i.lineTo(r.x3,r.y3)}getCaretPosition(e,i,n){let{xAlign:a,yAlign:r}=this,{caretSize:h,cornerRadius:m}=n,{topLeft:b,topRight:T,bottomLeft:k,bottomRight:P}=ja(m),{x:F,y:U}=e,{width:X,height:Y}=i,te,le,we,Le,Oe,ze;return r==="center"?(Oe=U+Y/2,a==="left"?(te=F,le=te-h,Le=Oe+h,ze=Oe-h):(te=F+X,le=te+h,Le=Oe-h,ze=Oe+h),we=te):(a==="left"?le=F+Math.max(b,k)+h:a==="right"?le=F+X-Math.max(T,P)-h:le=this.caretX,r==="top"?(Le=U,Oe=Le-h,te=le-h,we=le+h):(Le=U+Y,Oe=Le+h,te=le+h,we=le-h),ze=Le),{x1:te,x2:le,x3:we,y1:Le,y2:Oe,y3:ze}}drawTitle(e,i,n){let a=this.title,r=a.length,h,m,b;if(r){let T=$u(n.rtl,this.x,this.width);for(e.x=gv(this,n.titleAlign,n),i.textAlign=T.textAlign(n.titleAlign),i.textBaseline="middle",h=Sn(n.titleFont),m=n.titleSpacing,i.fillStyle=n.titleColor,i.font=h.string,b=0;b<r;++b)i.fillText(a[b],T.x(e.x),e.y+h.lineHeight/2),e.y+=h.lineHeight+m,b+1===r&&(e.y+=n.titleMarginBottom-m)}}_drawColorBox(e,i,n,a,r){let h=this.labelColors[n],m=this.labelPointStyles[n],{boxHeight:b,boxWidth:T}=r,k=Sn(r.bodyFont),P=gv(this,"left",r),F=a.x(P),U=b<k.lineHeight?(k.lineHeight-b)/2:0,X=i.y+U;if(r.usePointStyle){let Y={radius:Math.min(T,b)/2,pointStyle:m.pointStyle,rotation:m.rotation,borderWidth:1},te=a.leftForLtr(F,T)+T/2,le=X+b/2;e.strokeStyle=r.multiKeyBackground,e.fillStyle=r.multiKeyBackground,yg(e,Y,te,le),e.strokeStyle=h.borderColor,e.fillStyle=h.backgroundColor,yg(e,Y,te,le)}else{e.lineWidth=Yt(h.borderWidth)?Math.max(...Object.values(h.borderWidth)):h.borderWidth||1,e.strokeStyle=h.borderColor,e.setLineDash(h.borderDash||[]),e.lineDashOffset=h.borderDashOffset||0;let Y=a.leftForLtr(F,T),te=a.leftForLtr(a.xPlus(F,1),T-2),le=ja(h.borderRadius);Object.values(le).some(we=>we!==0)?(e.beginPath(),e.fillStyle=r.multiKeyBackground,Rc(e,{x:Y,y:X,w:T,h:b,radius:le}),e.fill(),e.stroke(),e.fillStyle=h.backgroundColor,e.beginPath(),Rc(e,{x:te,y:X+1,w:T-2,h:b-2,radius:le}),e.fill()):(e.fillStyle=r.multiKeyBackground,e.fillRect(Y,X,T,b),e.strokeRect(Y,X,T,b),e.fillStyle=h.backgroundColor,e.fillRect(te,X+1,T-2,b-2))}e.fillStyle=this.labelTextColors[n]}drawBody(e,i,n){let{body:a}=this,{bodySpacing:r,bodyAlign:h,displayColors:m,boxHeight:b,boxWidth:T,boxPadding:k}=n,P=Sn(n.bodyFont),F=P.lineHeight,U=0,X=$u(n.rtl,this.x,this.width),Y=function(rt){i.fillText(rt,X.x(e.x+U),e.y+F/2),e.y+=F+r},te=X.textAlign(h),le,we,Le,Oe,ze,Xe,Ke;for(i.textAlign=h,i.textBaseline="middle",i.font=P.string,e.x=gv(this,te,n),i.fillStyle=n.bodyColor,Wi(this.beforeBody,Y),U=m&&te!=="right"?h==="center"?T/2+k:T+2+k:0,Oe=0,Xe=a.length;Oe<Xe;++Oe){for(le=a[Oe],we=this.labelTextColors[Oe],i.fillStyle=we,Wi(le.before,Y),Le=le.lines,m&&Le.length&&(this._drawColorBox(i,e,Oe,X,n),F=Math.max(P.lineHeight,b)),ze=0,Ke=Le.length;ze<Ke;++ze)Y(Le[ze]),F=P.lineHeight;Wi(le.after,Y)}U=0,F=P.lineHeight,Wi(this.afterBody,Y),e.y-=r}drawFooter(e,i,n){let a=this.footer,r=a.length,h,m;if(r){let b=$u(n.rtl,this.x,this.width);for(e.x=gv(this,n.footerAlign,n),e.y+=n.footerMarginTop,i.textAlign=b.textAlign(n.footerAlign),i.textBaseline="middle",h=Sn(n.footerFont),i.fillStyle=n.footerColor,i.font=h.string,m=0;m<r;++m)i.fillText(a[m],b.x(e.x),e.y+h.lineHeight/2),e.y+=h.lineHeight+n.footerSpacing}}drawBackground(e,i,n,a){let{xAlign:r,yAlign:h}=this,{x:m,y:b}=e,{width:T,height:k}=n,{topLeft:P,topRight:F,bottomLeft:U,bottomRight:X}=ja(a.cornerRadius);i.fillStyle=a.backgroundColor,i.strokeStyle=a.borderColor,i.lineWidth=a.borderWidth,i.beginPath(),i.moveTo(m+P,b),h==="top"&&this.drawCaret(e,i,n,a),i.lineTo(m+T-F,b),i.quadraticCurveTo(m+T,b,m+T,b+F),h==="center"&&r==="right"&&this.drawCaret(e,i,n,a),i.lineTo(m+T,b+k-X),i.quadraticCurveTo(m+T,b+k,m+T-X,b+k),h==="bottom"&&this.drawCaret(e,i,n,a),i.lineTo(m+U,b+k),i.quadraticCurveTo(m,b+k,m,b+k-U),h==="center"&&r==="left"&&this.drawCaret(e,i,n,a),i.lineTo(m,b+P),i.quadraticCurveTo(m,b,m+P,b),i.closePath(),i.fill(),a.borderWidth>0&&i.stroke()}_updateAnimationTarget(e){let i=this.chart,n=this.$animations,a=n&&n.x,r=n&&n.y;if(a||r){let h=Ag[e.position].call(this,this._active,this._eventPosition);if(!h)return;let m=this._size=gA(this,e),b=Object.assign({},h,this._size),T=yA(i,e,b),k=_A(e,b,T,i);(a._to!==k.x||r._to!==k.y)&&(this.xAlign=T.xAlign,this.yAlign=T.yAlign,this.width=m.width,this.height=m.height,this.caretX=h.x,this.caretY=h.y,this._resolveAnimations().update(this,k))}}_willRender(){return!!this.opacity}draw(e){let i=this.options.setContext(this.getContext()),n=this.opacity;if(!n)return;this._updateAnimationTarget(i);let a={width:this.width,height:this.height},r={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;let h=On(i.padding),m=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;
vendor: 5,266 bytes, line 732
732i.enabled&&m&&(e.save(),e.globalAlpha=n,this.drawBackground(r,e,a,i),av(e,i.textDirection),r.y+=h.top,this.drawTitle(r,e,i),this.drawBody(r,e,i),this.drawFooter(r,e,i),lv(e,i.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,i){let n=this._active,a=e.map(({datasetIndex:m,index:b})=>{let T=this.chart.getDatasetMeta(m);if(!T)throw new Error("Cannot find a dataset at index "+m);return{datasetIndex:m,element:T.data[b],index:b}}),r=!of(n,a),h=this._positionChanged(a,i);(r||h)&&(this._active=a,this._eventPosition=i,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,i,n=!0){if(i&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let a=this.options,r=this._active||[],h=this._getActiveElements(e,r,i,n),m=this._positionChanged(h,e),b=i||!of(h,r)||m;return b&&(this._active=h,(a.enabled||a.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,i))),b}_getActiveElements(e,i,n,a){let r=this.options;if(e.type==="mouseout")return[];if(!a)return i.filter(m=>this.chart.data.datasets[m.datasetIndex]&&this.chart.getDatasetMeta(m.datasetIndex).controller.getParsed(m.index)!==void 0);let h=this.chart.getElementsAtEventForMode(e,r.mode,r,n);return r.reverse&&h.reverse(),h}_positionChanged(e,i){let{caretX:n,caretY:a,options:r}=this,h=Ag[r.position].call(this,e,i);return h!==!1&&(n!==h.x||a!==h.y)}},UB={id:"tooltip",_element:Cv,positioners:Ag,afterInit(t,e,i){i&&(t.tooltip=new Cv({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){let e=t.tooltip;if(e&&e._willRender()){let i={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){let i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.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:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.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:KA},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},jB=Object.freeze({__proto__:null,Colors:tB,Decimation:sB,Filler:kB,Legend:LB,SubTitle:RB,Title:DB,Tooltip:UB}),qB=(t,e,i,n)=>(typeof e=="string"?(i=t.push(e)-1,n.unshift({index:i,label:e})):isNaN(e)&&(i=null),i);function HB(t,e,i,n){let a=t.indexOf(e);if(a===-1)return qB(t,e,i,n);let r=t.lastIndexOf(e);return a!==r?i:a}var WB=(t,e)=>t===null?null:fr(Math.round(t),0,e);function xA(t){let e=this.getLabels();return t>=0&&t<e.length?e[t]:t}var b2=class extends wd{static id="category";static defaults={ticks:{callback:xA}};constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){let i=this._addedLabels;if(i.length){let n=this.getLabels();for(let{index:a,label:r}of i)n[a]===r&&n.splice(a,1);this._addedLabels=[]}super.init(e)}parse(e,i){if(yi(e))return null;let n=this.getLabels();return i=isFinite(i)&&n[i]===e?i:HB(n,e,Ht(i,e),this._addedLabels),WB(i,n.length-1)}determineDataLimits(){let{minDefined:e,maxDefined:i}=this.getUserBounds(),{min:n,max:a}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(n=0),i||(a=this.getLabels().length-1)),this.min=n,this.max=a}buildTicks(){let e=this.min,i=this.max,n=this.options.offset,a=[],r=this.getLabels();r=e===0&&i===r.length-1?r:r.slice(e,i+1),this._valueRange=Math.max(r.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let h=e;h<=i;h++)a.push({value:h});return a}getLabelForValue(e){return xA.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!="number"&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){let i=this.ticks;return e<0||e>i.length-1?null:this.getPixelForValue(i[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}};function GB(t,e){let i=[],{bounds:a,step:r,min:h,max:m,precision:b,count:T,maxTicks:k,maxDigits:P,includeBounds:F}=t,U=r||1,X=k-1,{min:Y,max:te}=e,le=!yi(h),we=!yi(m),Le=!yi(T),Oe=(te-Y)/(P+1),ze=$_((te-Y)/X/U)*U,Xe,Ke,rt,at;if(ze<1e-14&&!le&&!we)return[{value:Y},{value:te}];at=Math.ceil(te/ze)-Math.floor(Y/ze),at>X&&(ze=$_(at*ze/X/U)*U),yi(b)||(Xe=Math.pow(10,b),ze=Math.ceil(ze*Xe)/Xe),a==="ticks"?(Ke=Math.floor(Y/ze)*ze,rt=Math.ceil(te/ze)*ze):(Ke=Y,rt
vendor: 4,911 bytes, line 732
732=te),le&&we&&r&&SS((m-h)/r,ze/1e3)?(at=Math.round(Math.min((m-h)/ze,k)),ze=(m-h)/at,Ke=h,rt=m):Le?(Ke=le?h:Ke,rt=we?m:rt,at=T-1,ze=(rt-Ke)/at):(at=(rt-Ke)/ze,pd(at,Math.round(at),ze/1e3)?at=Math.round(at):at=Math.ceil(at));let $t=Math.max(j_(ze),j_(Ke));Xe=Math.pow(10,yi(b)?$t:b),Ke=Math.round(Ke*Xe)/Xe,rt=Math.round(rt*Xe)/Xe;let Tt=0;for(le&&(F&&Ke!==h?(i.push({value:h}),Ke<h&&Tt++,pd(Math.round((Ke+Tt*ze)*Xe)/Xe,h,wA(h,Oe,t))&&Tt++):Ke<h&&Tt++);Tt<at;++Tt){let Lt=Math.round((Ke+Tt*ze)*Xe)/Xe;if(we&&Lt>m)break;i.push({value:Lt})}return we&&F&&rt!==m?i.length&&pd(i[i.length-1].value,m,wA(m,Oe,t))?i[i.length-1].value=m:i.push({value:m}):(!we||rt===m)&&i.push({value:rt}),i}function wA(t,e,{horizontal:i,minRotation:n}){let a=zn(n),r=(i?Math.sin(a):Math.cos(a))||.001,h=.75*e*(""+t).length;return Math.min(e/r,h)}var hf=class extends wd{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,i){return yi(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){let{beginAtZero:e}=this.options,{minDefined:i,maxDefined:n}=this.getUserBounds(),{min:a,max:r}=this,h=b=>a=i?a:b,m=b=>r=n?r:b;if(e){let b=sa(a),T=sa(r);b<0&&T<0?m(0):b>0&&T>0&&h(0)}if(a===r){let b=r===0?1:Math.abs(r*.05);m(r+b),e||h(a-b)}this.min=a,this.max=r}getTickLimit(){let e=this.options.ticks,{maxTicksLimit:i,stepSize:n}=e,a;return n?(a=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,a>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${a} ticks. Limiting to 1000.`),a=1e3)):(a=this.computeTickLimit(),i=i||11),i&&(a=Math.min(i,a)),a}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let e=this.options,i=e.ticks,n=this.getTickLimit();n=Math.max(2,n);let a={maxTicks:n,bounds:e.bounds,min:e.min,max:e.max,precision:i.precision,step:i.stepSize,count:i.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:i.minRotation||0,includeBounds:i.includeBounds!==!1},r=this._range||this,h=GB(a,r);return e.bounds==="ticks"&&U_(h,this,"value"),e.reverse?(h.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),h}configure(){let e=this.ticks,i=this.min,n=this.max;if(super.configure(),this.options.offset&&e.length){let a=(n-i)/Math.max(e.length-1,1)/2;i-=a,n+=a}this._startValue=i,this._endValue=n,this._valueRange=n-i}getLabelForValue(e){return yd(e,this.chart.options.locale,this.options.ticks.format)}},x2=class extends hf{static id="linear";static defaults={ticks:{callback:gg.formatters.numeric}};determineDataLimits(){let{min:e,max:i}=this.getMinMax(!0);this.min=pn(e)?e:0,this.max=pn(i)?i:1,this.handleTickRangeOptions()}computeTickLimit(){let e=this.isHorizontal(),i=e?this.width:this.height,n=zn(this.options.ticks.minRotation),a=(e?Math.sin(n):Math.cos(n))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(i/Math.min(40,r.lineHeight/a))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}},Lg=t=>Math.floor(Dl(t)),bd=(t,e)=>Math.pow(10,Lg(t)+e);function SA(t){return t/Math.pow(10,Lg(t))===1}function TA(t,e,i){let n=Math.pow(10,i),a=Math.floor(t/n);return Math.ceil(e/n)-a}function ZB(t,e){let i=e-t,n=Lg(i);for(;TA(t,e,n)>10;)n++;for(;TA(t,e,n)<10;)n--;return Math.min(n,Lg(t))}function KB(t,{min:e,max:i}){e=js(t.min,e);let n=[],a=Lg(e),r=ZB(e,i),h=r<0?Math.pow(10,Math.abs(r)):1,m=Math.pow(10,r),b=a>r?Math.pow(10,a):0,T=Math.round((e-b)*h)/h,k=Math.floor((e-b)/m/10)*m*10,P=Math.floor((T-k)/Math.pow(10,r)),F=js(t.min,Math.round((b+k+P*Math.pow(10,r))*h)/h);for(;F<i;)n.push({value:F,major:SA(F),significand:P}),P>=10?P=P<15?15:20:P++,P>=20&&(r++,P=2,h=r>=0?1:h),F=Math.round((b+k+P*Math.pow(10,r))*h)/h;let U=js(t.max,F);return n.push({value:U,major:SA(U),significand:P}),n}var w2=class extends wd{static id="logarithmic";static defaults={ticks:{callback:gg.formatters.logarithmic,major:{enabled:!0}}};constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,i){let n=hf.prototype.parse.apply(this,[e,i]);if(n===0){this._zero=!0;return}return pn(n)&&n>0?n:null}determineDataLimits(){let{min:e,max:i}=this.getMinMax(!0);this.min=pn(e)?Math.max(0,e):null,this.max=pn(i)?Math.max(0,i):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!pn(this._userMin)&&(this.min=e===bd(this.min,0)?bd(this.min,-1):bd(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:e,maxDefined:i}=this.getUserBounds(),n=this.min,a=this.max,r=m=>n=e?n:m,h=m=>a=i?a:m;n===a&&(n<=0?(r(1),h(10)):(r(bd(n,-1)),h(bd(a,1)))),n<=0&&r(bd(a,-1)),a<=0&&h(bd(n,1)),this.min=n,this.max=a}buildTicks(){let e=this.options,i={min:this._userMin,max:this._userMax},n=KB(i,this);
vendor: 6,456 bytes, line 732
732return e.bounds==="ticks"&&U_(n,this,"value"),e.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}getLabelForValue(e){return e===void 0?"0":yd(e,this.chart.options.locale,this.options.ticks.format)}configure(){let e=this.min;super.configure(),this._startValue=Dl(e),this._valueRange=Dl(this.max)-Dl(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(Dl(e)-this._startValue)/this._valueRange)}getValueForPixel(e){let i=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+i*this._valueRange)}};function S2(t){let e=t.ticks;if(e.display&&t.display){let i=On(e.backdropPadding);return Ht(e.font&&e.font.size,fn.font.size)+i.height}return 0}function XB(t,e,i){return i=Pi(i)?i:[i],{w:IS(t,e.string,i),h:i.length*e.lineHeight}}function kA(t,e,i,n,a){return t===n||t===a?{start:e-i/2,end:e+i/2}:t<n||t>a?{start:e-i,end:e}:{start:e,end:e+i}}function YB(t){let e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),n=[],a=[],r=t._pointLabels.length,h=t.options.pointLabels,m=h.centerPointLabels?gi/r:0;for(let b=0;b<r;b++){let T=h.setContext(t.getPointLabelContext(b));a[b]=T.padding;let k=t.getPointPosition(b,t.drawingArea+a[b],m),P=Sn(T.font),F=XB(t.ctx,P,t._pointLabels[b]);n[b]=F;let U=Us(t.getIndexAngle(b)+m),X=Math.round(fd(U)),Y=kA(X,k.x,F.w,0,180),te=kA(X,k.y,F.h,90,270);JB(i,e,U,Y,te)}t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=t3(t,n,a)}function JB(t,e,i,n,a){let r=Math.abs(Math.sin(i)),h=Math.abs(Math.cos(i)),m=0,b=0;n.start<e.l?(m=(e.l-n.start)/r,t.l=Math.min(t.l,e.l-m)):n.end>e.r&&(m=(n.end-e.r)/r,t.r=Math.max(t.r,e.r+m)),a.start<e.t?(b=(e.t-a.start)/h,t.t=Math.min(t.t,e.t-b)):a.end>e.b&&(b=(a.end-e.b)/h,t.b=Math.max(t.b,e.b+b))}function QB(t,e,i){let n=t.drawingArea,{extra:a,additionalAngle:r,padding:h,size:m}=i,b=t.getPointPosition(e,n+a+h,r),T=Math.round(fd(Us(b.angle+an))),k=r3(b.y,m.h,T),P=i3(T),F=n3(b.x,m.w,P);return{visible:!0,x:b.x,y:k,textAlign:P,left:F,top:k,right:F+m.w,bottom:k+m.h}}function e3(t,e){if(!e)return!0;let{left:i,top:n,right:a,bottom:r}=t;return!(Na({x:i,y:n},e)||Na({x:i,y:r},e)||Na({x:a,y:n},e)||Na({x:a,y:r},e))}function t3(t,e,i){let n=[],a=t._pointLabels.length,r=t.options,{centerPointLabels:h,display:m}=r.pointLabels,b={extra:S2(r)/2,additionalAngle:h?gi/a:0},T;for(let k=0;k<a;k++){b.padding=i[k],b.size=e[k];let P=QB(t,k,b);n.push(P),m==="auto"&&(P.visible=e3(P,T),P.visible&&(T=P))}return n}function i3(t){return t===0||t===180?"center":t<180?"left":"right"}function n3(t,e,i){return i==="right"?t-=e:i==="center"&&(t-=e/2),t}function r3(t,e,i){return i===90||i===270?t-=e/2:(i>270||i<90)&&(t-=e),t}function s3(t,e,i){let{left:n,top:a,right:r,bottom:h}=i,{backdropColor:m}=e;if(!yi(m)){let b=ja(e.borderRadius),T=On(e.backdropPadding);t.fillStyle=m;let k=n-T.left,P=a-T.top,F=r-n+T.width,U=h-a+T.height;Object.values(b).some(X=>X!==0)?(t.beginPath(),Rc(t,{x:k,y:P,w:F,h:U,radius:b}),t.fill()):t.fillRect(k,P,F,U)}}function o3(t,e){let{ctx:i,options:{pointLabels:n}}=t;for(let a=e-1;a>=0;a--){let r=t._pointLabelItems[a];if(!r.visible)continue;let h=n.setContext(t.getPointLabelContext(a));s3(i,h,r);let m=Sn(h.font),{x:b,y:T,textAlign:k}=r;Dc(i,t._pointLabels[a],b,T+m.lineHeight/2,m,{color:h.color,textAlign:k,textBaseline:"middle"})}}function XA(t,e,i,n){let{ctx:a}=t;if(i)a.arc(t.xCenter,t.yCenter,e,0,Yi);else{let r=t.getPointPosition(0,e);a.moveTo(r.x,r.y);for(let h=1;h<n;h++)r=t.getPointPosition(h,e),a.lineTo(r.x,r.y)}}function a3(t,e,i,n,a){let r=t.ctx,h=e.circular,{color:m,lineWidth:b}=e;!h&&!n||!m||!b||i<0||(r.save(),r.strokeStyle=m,r.lineWidth=b,r.setLineDash(a.dash||[]),r.lineDashOffset=a.dashOffset,r.beginPath(),XA(t,i,h,n),r.closePath(),r.stroke(),r.restore())}function l3(t,e,i){return zl(t,{label:i,index:e,type:"pointLabel"})}var T2=class extends hf{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:gg.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(e){super(e),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let e=this._padding=On(S2(this.options)/2),i=this.width=this.maxWidth-e.width,n=this.height=this.maxHeight-e.height;this.xCenter=Math.floor(this.left+i/2+e.left),this.yCenter=Math.floor(this.top+n/2+e.top),this.drawingArea=Math.floor(Math.min(i,n)/2)}determineDataLimits(){let{min:e,max:i}=this.getMinMax(!1);this.min=pn(e)&&!isNaN(e)?e:0,this.max=pn(i)&&!isNaN(i)?i:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/S2(this.options))}generateTickLabels(e){hf.prototype.generateTickLabels.call(this,e),this._pointLabels=this.getLabels().map((i,n)=>{let a=$i(this.options.pointLabels.callback,[i,n],this);return a||a===0?a:""}).filter((i,n)=>this.chart.getDataVisibility(n))}fit(){let e=this.options;e.display&&e.pointLabels.display?YB(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,i,n,a){this.xCenter+=Math.floor((e-i)/2),this.yCenter+=Math.floor((n-a)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,i,n,a))}getIndexAngle(e){let i=Yi/(this._pointLabels.length||1),n=this.options.startAngle||0;return Us(e*i+zn(n))}getDistanceFromCenterForValue(e){if(yi(e))return NaN;let i=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*i:(e-this.min)*i}getValueForDistanceFromCenter(e){if(yi(e))return NaN;let i=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-i:this.min+i}getPointLabelContext(e){let i=this._pointLabels||[];if(e>=0&&e<i.length){let n=i[e];return l3(this.getContext(),e,n)}}getPointPosition(e,i,n=0){let a=this.getIndexAngle(e)-an+n;return{x:Math.cos(a)*i+this.xCenter,y:Math.sin(a)*i+this.yCenter,angle:a}}getPointPositionForValue(e,i){return this.getPointPosition(e,this.getDistanceFromCenterForValue(i))}getBasePosition(e){return this.getPointPositionForValue(e||0,this.getBaseValue())}
vendor: 4,885 bytes, line 732
732getPointLabelPosition(e){let{left:i,top:n,right:a,bottom:r}=this._pointLabelItems[e];return{left:i,top:n,right:a,bottom:r}}drawBackground(){let{backgroundColor:e,grid:{circular:i}}=this.options;if(e){let n=this.ctx;n.save(),n.beginPath(),XA(this,this.getDistanceFromCenterForValue(this._endValue),i,this._pointLabels.length),n.closePath(),n.fillStyle=e,n.fill(),n.restore()}}drawGrid(){let e=this.ctx,i=this.options,{angleLines:n,grid:a,border:r}=i,h=this._pointLabels.length,m,b,T;if(i.pointLabels.display&&o3(this,h),a.display&&this.ticks.forEach((k,P)=>{if(P!==0||P===0&&this.min<0){b=this.getDistanceFromCenterForValue(k.value);let F=this.getContext(P),U=a.setContext(F),X=r.setContext(F);a3(this,U,b,h,X)}}),n.display){for(e.save(),m=h-1;m>=0;m--){let k=n.setContext(this.getPointLabelContext(m)),{color:P,lineWidth:F}=k;!F||!P||(e.lineWidth=F,e.strokeStyle=P,e.setLineDash(k.borderDash),e.lineDashOffset=k.borderDashOffset,b=this.getDistanceFromCenterForValue(i.reverse?this.min:this.max),T=this.getPointPosition(m,b),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(T.x,T.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){let e=this.ctx,i=this.options,n=i.ticks;if(!n.display)return;let a=this.getIndexAngle(0),r,h;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(a),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((m,b)=>{if(b===0&&this.min>=0&&!i.reverse)return;let T=n.setContext(this.getContext(b)),k=Sn(T.font);if(r=this.getDistanceFromCenterForValue(this.ticks[b].value),T.showLabelBackdrop){e.font=k.string,h=e.measureText(m.label).width,e.fillStyle=T.backdropColor;let P=On(T.backdropPadding);e.fillRect(-h/2-P.left,-r-k.size/2-P.top,h+P.width,k.size+P.height)}Dc(e,m.label,0,-r,k,{color:T.color,strokeColor:T.textStrokeColor,strokeWidth:T.textStrokeWidth})}),e.restore()}drawTitle(){}},Mv={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}},so=Object.keys(Mv);function CA(t,e){return t-e}function MA(t,e){if(yi(e))return null;let i=t._adapter,{parser:n,round:a,isoWeekday:r}=t._parseOpts,h=e;return typeof n=="function"&&(h=n(h)),pn(h)||(h=typeof n=="string"?i.parse(h,n):i.parse(h)),h===null?null:(a&&(h=a==="week"&&($a(r)||r===!0)?i.startOf(h,"isoWeek",r):i.startOf(h,a)),+h)}function AA(t,e,i,n){let a=so.length;for(let r=so.indexOf(t);r<a-1;++r){let h=Mv[so[r]],m=h.steps?h.steps:Number.MAX_SAFE_INTEGER;if(h.common&&Math.ceil((i-e)/(m*h.size))<=n)return so[r]}return so[a-1]}function c3(t,e,i,n,a){for(let r=so.length-1;r>=so.indexOf(i);r--){let h=so[r];if(Mv[h].common&&t._adapter.diff(a,n,h)>=e-1)return h}return so[i?so.indexOf(i):0]}function u3(t){for(let e=so.indexOf(t)+1,i=so.length;e<i;++e)if(Mv[so[e]].common)return so[e]}function EA(t,e,i){if(!i)t[e]=!0;else if(i.length){let{lo:n,hi:a}=fg(i,e),r=i[n]>=e?i[n]:i[a];t[r]=!0}}function h3(t,e,i,n){let a=t._adapter,r=+a.startOf(e[0].value,n),h=e[e.length-1].value,m,b;for(m=r;m<=h;m=+a.add(m,1,n))b=i[m],b>=0&&(e[b].major=!0);return e}function IA(t,e,i){let n=[],a={},r=e.length,h,m;for(h=0;h<r;++h)m=e[h],a[m]=h,n.push({value:m,major:!1});return r===0||!i?n:h3(t,n,a,i)}var Pg=class extends wd{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,i={}){let n=e.time||(e.time={}),a=this._adapter=new TO._date(e.adapters.date);a.init(i),dd(n.displayFormats,a.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(e),this._normalized=i.normalized}parse(e,i){return e===void 0?null:MA(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let e=this.options,i=this._adapter,n=e.time.unit||"day",{min:a,max:r,minDefined:h,maxDefined:m}=this.getUserBounds();function b(T){!h&&!isNaN(T.min)&&(a=Math.min(a,T.min)),!m&&!isNaN(T.max)&&(r=Math.max(r,T.max))}(!h||!m)&&(b(this._getLabelBounds()),(e.bounds!=="ticks"||e.ticks.source!=="labels")&&b(this.getMinMax(!1))),a=pn(a)&&!isNaN(a)?a:+i.startOf(Date.now(),n),r=pn(r)&&!isNaN(r)?r:+i.endOf(Date.now(),n)+1,this.min=Math.min(a,r-1),this.max=Math.max(a+1,r)}_getLabelBounds(){let e=this.getLabelTimestamps(),i=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return e.length&&(i=e[0],n=e[e.length-1]),{min:i,max:n}}buildTicks(){let e=this.options,i=e.time,n=e.ticks,a=n.source==="labels"?this.getLabelTimestamps():this._generate();
vendor: 2,698 bytes, line 732
732e.bounds==="ticks"&&a.length&&(this.min=this._userMin||a[0],this.max=this._userMax||a[a.length-1]);let r=this.min,h=this.max,m=CS(a,r,h);return this._unit=i.unit||(n.autoSkip?AA(i.minUnit,this.min,this.max,this._getLabelCapacity(r)):c3(this,m.length,i.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit==="year"?void 0:u3(this._unit),this.initOffsets(a),e.reverse&&m.reverse(),IA(this,m,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let i=0,n=0,a,r;this.options.offset&&e.length&&(a=this.getDecimalForValue(e[0]),e.length===1?i=1-a:i=(this.getDecimalForValue(e[1])-a)/2,r=this.getDecimalForValue(e[e.length-1]),e.length===1?n=r:n=(r-this.getDecimalForValue(e[e.length-2]))/2);let h=e.length<3?.5:.25;i=fr(i,0,h),n=fr(n,0,h),this._offsets={start:i,end:n,factor:1/(i+1+n)}}_generate(){let e=this._adapter,i=this.min,n=this.max,a=this.options,r=a.time,h=r.unit||AA(r.minUnit,i,n,this._getLabelCapacity(i)),m=Ht(a.ticks.stepSize,1),b=h==="week"?r.isoWeekday:!1,T=$a(b)||b===!0,k={},P=i,F,U;if(T&&(P=+e.startOf(P,"isoWeek",b)),P=+e.startOf(P,T?"day":h),e.diff(n,i,h)>1e5*m)throw new Error(i+" and "+n+" are too far apart with stepSize of "+m+" "+h);let X=a.ticks.source==="data"&&this.getDataTimestamps();for(F=P,U=0;F<n;F=+e.add(F,m,h),U++)EA(k,F,X);return(F===n||a.bounds==="ticks"||U===1)&&EA(k,F,X),Object.keys(k).sort(CA).map(Y=>+Y)}getLabelForValue(e){let i=this._adapter,n=this.options.time;return n.tooltipFormat?i.format(e,n.tooltipFormat):i.format(e,n.displayFormats.datetime)}format(e,i){let a=this.options.time.displayFormats,r=this._unit,h=i||a[r];return this._adapter.format(e,h)}_tickFormatFunction(e,i,n,a){let r=this.options,h=r.ticks.callback;if(h)return $i(h,[e,i,n],this);let m=r.time.displayFormats,b=this._unit,T=this._majorUnit,k=b&&m[b],P=T&&m[T],F=n[i],U=T&&P&&F&&F.major;return this._adapter.format(e,a||(U?P:k))}generateTickLabels(e){let i,n,a;for(i=0,n=e.length;i<n;++i)a=e[i],a.label=this._tickFormatFunction(a.value,i,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){let i=this._offsets,n=this.getDecimalForValue(e);return this.getPixelForDecimal((i.start+n)*i.factor)}getValueForPixel(e){let i=this._offsets,n=this.getDecimalForPixel(e)/i.factor-i.end;return this.min+n*(this.max-this.min)}_getLabelSize(e){let i=this.options.ticks,n=this.ctx.measureText(e).width,a=zn(this.isHorizontal()?i.maxRotation:i.minRotation),r=Math.cos(a),h=Math.sin(a),m=this._resolveTickFontOptions(0).size;return{w:n*r+m*h,h:n*h+m*r}}_getLabelCapacity(e){let i=this.options.time,n=i.displayFormats,a=n[i.unit]||n.millisecond,r=this._tick
732FormatFunction(e,0,IA(this,[e],this._majorUnit),a),h=this._getLabelSize(r),m=Math.floor(this.isHorizontal()?this.width/h.w:this.height/h.h)-1;return m>0?m:1}getDataTimestamps(){let e=this._cache.data||[],i,n;if(e.length)return e;let a=this.getMatchingVisibleMetas();if(this._normalized&&a.length)return this._cache.data=a[0].controller.getAllParsedValues(this);for(i=0,n=a.length;i<n;++i)e=e.concat(a[i].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){let e=this._cache.labels||[],i,n;if(e.length)return e;let a=this.getLabels();for(i=0,n=a.length;i<n;++i)e.push(MA(this,a[i]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return H_(e.sort(CA))}};function yv(t,e,i){let n=0,a=t.length-1,r,h,m,b;i?(e>=t[n].pos&&e<=t[a].pos&&({lo:n,hi:a}=Ba(t,"pos",e)),{pos:r,time:m}=t[n],{pos:h,time:b}=t[a]):(e>=t[n].time&&e<=t[a].time&&({lo:n,hi:a}=Ba(t,"time",e)),{time:r,pos:m}=t[n],{time:h,pos:b}=t[a]);let T=h-r;return T?m+(b-m)*(e-r)/T:m}var k2=class extends Pg{static id="timeseries";static defaults=Pg.defaults;constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let e=this._getTimestampsForTable(),i=this._table=this.buildLookupTable(e);this._minPos=yv(i,this.min),this._tableRange=yv(i,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){let{min:i,max:n}=this,a=[],r=[],h,m,b,T,k;for(h=0,m=e.length;h<m;++h)T=e[h],T>=i&&T<=n&&a.push(T);if(a.length<2)return[{time:i,pos:0},{time:n,pos:1}];for(h=0,m=a.length;h<m;++h)k=a[h+1],b=a[h-1],T=a[h],Math.round((k+b)/2)!==T&&r.push({time:T,pos:h/(m-1)});return r}_generate(){let e=this.min,i=this.max,n=super.getDataTimestamps();return(!n.includes(e)||!n.length)&&n.splice(0,0,e),(!n.includes(i)||n.length===1)&&n.push(i),n.sort((a,r)=>a-r)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;let i=this.getDataTimestamps(),n=this.getLabelTimestamps();return i.length&&n.length?e=this.normalize(i.concat(n)):e=i.length?i:n,e=this._cache.all=e,e}getDecimalForValue(e){return(yv(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){let i=this._offsets,n=this.getDecimalForPixel(e)/i.factor-i.end;return yv(this._table,n*this._tableRange+this._minPos,!0)}},d3=Object.freeze({__proto__:null,CategoryScale:b2,LinearScale:x2,LogarithmicScale:w2,RadialLinearScale:T2,TimeScale:Pg,TimeSeriesScale:k2}),YA=[SO,ZF,jB,d3];Nl.register(...YA);var Rg=Nl;var JA={modes:{point(t,e){return Av(t,e,{intersect:!0})},nearest(t,e,i){return m3(t,e,i)},x(t,e,i){return Av(t,e,{intersect:i.intersect,axis:"x"})},y(t,e,i){return Av(t,e,{intersect:i.intersect,axis:"y"})}}};function z2(t,e,i){return(JA.modes[i.mode]||JA.modes.nearest)(t,e,i)}function p3(t,e,i){return i!=="x"&&i!=="y"?t.inRange(e.x,e.y,"x",!0)||t.inRange(e.x,e.y,"y",!0):t.inRange(e.x,e.y,i,!0)}function f3(t,e,i){return i==="x"?{x:t.x,y:e.y}:i==="y"?{x:e.x,y:t.y}:e}function Av(t,e,i){return t.filter(n=>i.intersect?n.inRange(e.x,e.y):p3(n,e,i.axis))}function m3(t,e,i){let n=Number.POSITIVE_INFINITY;return Av(t,e,i).reduce((a,r)=>{let h=r.getCenterPoint(),m=f3(e,h,i.axis),b=Lc(e,m);return b<n?(a=[r],n=b):b===n&&a.push(r),a},[]).sort((a,r)=>a._index-r._index).slice(0,1)}function Ad(t,e,i){let n=Math.cos(i),a=Math.sin(i),r=e.x,h=e.y;return{x:r+n*(t.x-r)-a*(t.y-h),y:h+a*(t.x-r)+n*(t.y-h)}}var g3=(t,e)=>e>t||t.length>e.length&&t.slice(0,e.length)===e,Sd=.001,Iv=(t,e,i)=>Math.min(i,Math.max(e,t)),_E=(t,e)=>t.value>=t.start-e&&t.value<=t.end+e;function y3(t,e,i){for(let n of Object.keys(t))t[n]=Iv(t[n],e,i);return t}function _3(t,e,i,n){return!t||!e||i<=0?!1:Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)<=Math.pow(i+n,2)}function vE(t,{x:e,y:i,x2:n,y2:a},r,{borderWidth:h,hitTolerance:m}){let b=(h+m)/2,T=t.x>=e-b-Sd&&t.x<=n+b+Sd,k=t.y>=i-b-Sd&&t.y<=a+b+Sd;return r==="x"?T:(r==="y"||T)&&k}function bE(t,{rect:e,center:i},n,{rotation:a,borderWidth:r,hitTolerance:h}){let m=Ad(t,i,zn(-a));return vE(m,e,n,{borderWidth:r,hitTolerance:h})}function Ed(t,e){let{centerX:i,centerY:n}=t.getProps(["centerX","centerY"],e);return{x:i,y:n}}function v3(t,e,i,n=!0){let a=i.split("."),r=0;for(let h of e.split(".")){let m=a[r++];if(parseInt(h,10)<parseInt(m,10))break;if(g3(m,h)){if(n)throw new Error(`${t} v${i} is not supported. v${e} or newer is required.`);return!1}}return!0}var xE=t=>typeof t=="string"&&t.endsWith("%"),wE=t=>parseFloat(t)/100,SE=t=>Iv(wE(t),0,1),zg=(t,e)=>({x:t,y:e,x2:t,y2:e,width:0,height:0}),b3={box:t=>zg(t.centerX,t.centerY),doughnutLabel:t=>zg(t.centerX,t.centerY),ellipse:t=>({centerX:t.centerX,centerY:t.centerX,radius:0,width:0,height:0}),label:t=>zg(t.centerX,t.centerY),line:t=>zg(t.x,t.y),point:t=>({centerX:t.centerX,centerY:t.centerY,radius:0,width:0,height:0}),polygon:t=>zg(t.centerX,t.centerY)};function O2(t,e){return e==="start"?0:e==="end"?t:xE(e)?SE(e)*t:t/2}function Hu(t,e,i=!0){return typeof e=="number"?e:xE(e)?(i?SE(e):wE(e))*t:t}function x3(t,e){let{x:i,width:n}=t,a=e.textAlign;return a==="center"?i+n/2:a==="end"||a==="right"?i+n:i}function TE(t,e,{borderWidth:i,position:n,xAdjust:a,yAdjust:r},h){let m=Yt(h),b=e.width+(m?h.width:0)+i,T=e.height+(m?h.height:0)+i,k=F2(n),P=QA(t.x,b,a,k.x),F=QA(t.y,T,r,k.y);return{x:P,y:F,x2:P+b,y2:F+T,width:b,height:T,centerX:P+b/2,centerY:F+T/2}}function F2(t,e="center"){return Yt(t)?{x:Ht(t.x,e),y:Ht(t.y,e)}:(t=Ht(t,e),{x:t,y:t})}var kE=(t,e)=>t&&t.autoFit&&e<1;function CE(t,e){let i=t.font,n=Pi(i)?i:[i];return kE(t,e)?n.map(function(a){let r=Sn(a);return r.size=Math.floor(a.size*e),r.lineHeight=a.lineHeight,Sn(r)}):n.map(a=>Sn(a))}function ME(t){return t&&(Jr(t.xValue)||Jr(t.yValue))}function QA(t,e,i=0,n){return t-O2(e,n)+i}function gf(t,e,i){let n=i.init;if(n){if(n===!0)return EE(e,i)}else return;return w3(t,e,i)}function AE(t,e,i){let n=!1;return e.forEach(a=>{Yr(t[a])?(n=!0,i[a]=t[a]):Jr(i[a])&&delete i[a]}),n}function EE(t,e){let i=e.type||"line";return b3[i](t)}function w3(t,e,i){let n=$i(i.init,[{chart:t,properties:e,options:i}]);if(n===!0)return EE(e,i);if(Yt(n))return n}var M2=new Map,S3=t=>isNaN(t)||t<=0,T3=t=>t.reduce(function(e,i){return e+=i.string,e},"");function Lv(t){if(t&&typeof t=="object"){let e=t.toString();return e==="[object HTMLImageElement]"||e==="[object HTMLCanvasElement]"}}function Pv(t,{x:e,y:i},n){n&&(t.translate(e,i),t.rotate(zn(n)),t.translate(-e,-i))}function Bc(t,e){if(e&&e.borderWidth)return t.lineCap=e.borderCapStyle||"butt",t.setLineDash(e.borderDash),t.lineDashOffset=e.borderDashOffset,t.lineJoin=e.borderJoinStyle||"miter",t.lineWidth=e.borderWidth,t.strokeStyle=e.borderColor,!0}function yf(t,e){t.shadowColor=e.backgroundShadowColor,t.shadowBlur=e.shadowBlur,t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=e.shadowOffsetY}function Dv(t,e){let i=e.content;if(Lv(i))return{width:Hu(i.width,e.width),height:Hu(i.height,e.height)};let n=CE(e),a=e.textStrokeWidth,r=Pi(i)?i:[i],h=r.join()+T3(n)+a+(t._measureText?"-spriting":"");
732return M2.has(h)||M2.set(h,A3(t,r,n,a)),M2.get(h)}function IE(t,e,i){let{x:n,y:a,width:r,height:h}=e;t.save(),yf(t,i);let m=Bc(t,i);t.fillStyle=i.backgroundColor,t.beginPath(),Rc(t,{x:n,y:a,w:r,h,radius:y3(ja(i.borderRadius),0,Math.min(r,h)/2)}),t.closePath(),t.fill(),m&&(t.shadowColor=i.borderShadowColor,t.stroke()),t.restore()}function LE(t,e,i,n){let a=i.content;if(Lv(a)){t.save(),t.globalAlpha=L3(i.opacity,a.style.opacity),t.drawImage(a,e.x,e.y,e.width,e.height),t.restore();return}let r=Pi(a)?a:[a],h=CE(i,n),m=i.color,b=Pi(m)?m:[m],T=x3(e,i),k=e.y+i.textStrokeWidth/2;t.save(),t.textBaseline="middle",t.textAlign=i.textAlign,k3(t,i)&&E3(t,{x:T,y:k},r,h),I3(t,{x:T,y:k},r,{fonts:h,colors:b}),t.restore()}function k3(t,e){if(e.textStrokeWidth>0)return t.lineJoin="round",t.miterLimit=2,t.lineWidth=e.textStrokeWidth,t.strokeStyle=e.textStrokeColor,!0}function C3(t,e,i,n){let{radius:a,options:r}=e,h=r.pointStyle,m=r.rotation,b=(m||0)*pg;if(Lv(h)){t.save(),t.translate(i,n),t.rotate(b),t.drawImage(h,-h.width/2,-h.height/2,h.width,h.height),t.restore();return}S3(a)||M3(t,{x:i,y:n,radius:a,rotation:m,style:h,rad:b})}function M3(t,{x:e,y:i,radius:n,rotation:a,style:r,rad:h}){let m,b,T,k;switch(t.beginPath(),r){default:t.arc(e,i,n,0,Yi),t.closePath();break;case"triangle":t.moveTo(e+Math.sin(h)*n,i-Math.cos(h)*n),h+=nf,t.lineTo(e+Math.sin(h)*n,i-Math.cos(h)*n),h+=nf,t.lineTo(e+Math.sin(h)*n,i-Math.cos(h)*n),t.closePath();break;case"rectRounded":k=n*.516,T=n-k,m=Math.cos(h+no)*T,b=Math.sin(h+no)*T,t.arc(e-m,i-b,k,h-gi,h-an),t.arc(e+b,i-m,k,h-an,h),t.arc(e+m,i+b,k,h,h+an),t.arc(e-b,i+m,k,h+an,h+gi),t.closePath();break;case"rect":if(!a){T=Math.SQRT1_2*n,t.rect(e-T,i-T,2*T,2*T);break}h+=no;case"rectRot":m=Math.cos(h)*n,b=Math.sin(h)*n,t.moveTo(e-m,i-b),t.lineTo(e+b,i-m),t.lineTo(e+m,i+b),t.lineTo(e-b,i+m),t.closePath();break;case"crossRot":h+=no;case"cross":m=Math.cos(h)*n,b=Math.sin(h)*n,t.moveTo(e-m,i-b),t.lineTo(e+m,i+b),t.moveTo(e+b,i-m),t.lineTo(e-b,i+m);break;case"star":m=Math.cos(h)*n,b=Math.sin(h)*n,t.moveTo(e-m,i-b),t.lineTo(e+m,i+b),t.moveTo(e+b,i-m),t.lineTo(e-b,i+m),h+=no,m=Math.cos(h)*n,b=Math.sin(h)*n,t.moveTo(e-m,i-b),t.lineTo(e+m,i+b),t.moveTo(e+b,i-m),t.lineTo(e-b,i+m);break;case"line":m=Math.cos(h)*n,b=Math.sin(h)*n,t.moveTo(e-m,i-b),t.lineTo(e+m,i+b);break;case"dash":t.moveTo(e,i),t.lineTo(e+Math.cos(h)*n,i+Math.sin(h)*n);break}t.fill()}function A3(t,e,i,n){t.save();let a=e.length,r=0,h=n;for(let m=0;m<a;m++){let b=i[Math.min(m,i.length-1)];t.font=b.string;let T=e[m];r=Math.max(r,t.measureText(T).width+n),h+=b.lineHeight}return t.restore(),{width:r,height:h}}function E3(t,{x:e,y:i},n,a){t.beginPath();let r=0;n.forEach(function(h,m){let b=a[Math.min(m,a.length-1)],T=b.lineHeight;t.font=b.string,t.strokeText(h,e,i+T/2+r),r+=T}),t.stroke()}function I3(t,{x:e,y:i},n,{fonts:a,colors:r}){let h=0;n.forEach(function(m,b){let T=r[Math.min(b,r.length-1)],k=a[Math.min(b,a.length-1)],P=k.lineHeight;t.beginPath(),t.font=k.string,t.fillStyle=T,t.fillText(m,e,i+P/2+h),h+=P,t.fill()})}function L3(t,e){let i=$a(t)?t:e;return $a(i)?Iv(i,0,1):1}var PE=["left","bottom","top","right"];function P3(t,e){let{pointX:i,pointY:n,options:a}=e,r=a.callout,h=r&&r.display&&F3(e,r);if(!h||N3(e,r,h))return;if(t.save(),t.beginPath(),!Bc(t,r))return t.restore();let{separatorStart:b,separatorEnd:T}=D3(e,h),{sideStart:k,sideEnd:P}=z3(e,h,b);(r.margin>0||a.borderWidth===0)&&(t.moveTo(b.x,b.y),t.lineTo(T.x,T.y)),t.moveTo(k.x,k.y),t.lineTo(P.x,P.y);let F=Ad({x:i,y:n},e.getCenterPoint(),zn(-e.rotation));t.lineTo(F.x,F.y),t.stroke(),t.restore()}function D3(t,e){let{x:i,y:n,x2:a,y2:r}=t,h=R3(t,e),m,b;return e==="left"||e==="right"?(m={x:i+h,y:n},b={x:m.x,y:r}):(m={x:i,y:n+h},b={x:a,y:m.y}),{separatorStart:m,separatorEnd:b}}function R3(t,e){let{width:i,height:n,options:a}
732=t,r=a.callout.margin+a.borderWidth/2;return e==="right"?i+r:e==="bottom"?n+r:-r}function z3(t,e,i){let{y:n,width:a,height:r,options:h}=t,m=h.callout.start,b=O3(e,h.callout),T,k;return e==="left"||e==="right"?(T={x:i.x,y:n+Hu(r,m)},k={x:T.x+b,y:T.y}):(T={x:i.x+Hu(a,m),y:i.y},k={x:T.x,y:T.y+b}),{sideStart:T,sideEnd:k}}function O3(t,e){let i=e.side;return t==="left"||t==="top"?-i:i}function F3(t,e){let i=e.position;return PE.includes(i)?i:B3(t,e)}function B3(t,e){let{x:i,y:n,x2:a,y2:r,width:h,height:m,pointX:b,pointY:T,centerX:k,centerY:P,rotation:F}=t,U={x:k,y:P},X=e.start,Y=Hu(h,X),te=Hu(m,X),le=[i,i+Y,i+Y,a],we=[n+te,r,n,r],Le=[];for(let Oe=0;Oe<4;Oe++){let ze=Ad({x:le[Oe],y:we[Oe]},U,zn(F));Le.push({position:PE[Oe],distance:Lc(ze,{x:b,y:T})})}return Le.sort((Oe,ze)=>Oe.distance-ze.distance)[0].position}function N3(t,e,i){let{pointX:n,pointY:a}=t,r=e.margin,h=n,m=a;return i==="left"?h+=r:i==="right"?h-=r:i==="top"?m+=r:i==="bottom"&&(m-=r),t.inRange(h,m)}var eE={xScaleID:{min:"xMin",max:"xMax",start:"left",end:"right",startProp:"x",endProp:"x2"},yScaleID:{min:"yMin",max:"yMax",start:"bottom",end:"top",startProp:"y",endProp:"y2"}};function df(t,e,i){return e=typeof e=="number"?e:t.parse(e),pn(e)?t.getPixelForValue(e):i}function Td(t,e,i){let n=e[i];if(n||i==="scaleID")return n;let a=i.charAt(0),r=Object.values(t).filter(h=>h.axis&&h.axis===a);return r.length?r[0].id:a}function DE(t,e){if(t){let i=t.options.reverse,n=df(t,e.min,i?e.end:e.start),a=df(t,e.max,i?e.start:e.end);return{start:n,end:a}}}function RE(t,e){let{chartArea:i,scales:n}=t,a=n[Td(n,e,"xScaleID")],r=n[Td(n,e,"yScaleID")],h=i.width/2,m=i.height/2;return a&&(h=df(a,e.xValue,a.left+a.width/2)),r&&(m=df(r,e.yValue,r.top+r.height/2)),{x:h,y:m}}function B2(t,e){let i=t.scales,n=i[Td(i,e,"xScaleID")],a=i[Td(i,e,"yScaleID")];if(!n&&!a)return{};let{left:r,right:h}=n||t.chartArea,{top:m,bottom:b}=a||t.chartArea,T=tE(n,{min:e.xMin,max:e.xMax,start:r,end:h});r=T.start,h=T.end;let k=tE(a,{min:e.yMin,max:e.yMax,start:b,end:m});return m=k.start,b=k.end,{x:r,y:m,x2:h,y2:b,width:h-r,height:b-m,centerX:r+(h-r)/2,centerY:m+(b-m)/2}}function zE(t,e){if(!ME(e)){let i=B2(t,e),n=e.radius;(!n||isNaN(n))&&(n=Math.min(i.width,i.height)/2,e.radius=n);let a=n*2,r=i.centerX+e.xAdjust,h=i.centerY+e.yAdjust;return{x:r-n,y:h-n,x2:r+n,y2:h+n,centerX:r,centerY:h,width:a,height:a,radius:n}}return $3(t,e)}function V3(t,e){let{scales:i,chartArea:n}=t,a=i[e.scaleID],r={x:n.left,y:n.top,x2:n.right,y2:n.bottom};return a?U3(a,r,e):j3(i,r,e),r}function OE(t,e){let i=B2(t,e);return i.initProperties=gf(t,i,e),i.elements=[{type:"label",optionScope:"label",properties:W3(t,i,e),initProperties:i.initProperties}],i}function $3(t,e){let i=RE(t,e),n=e.radius*2;return{x:i.x-e.radius+e.xAdjust,y:i.y-e.radius+e.yAdjust,x2:i.x+e.radius+e.xAdjust,y2:i.y+e.radius+e.yAdjust,centerX:i.x+e.xAdjust,centerY:i.y+e.yAdjust,radius:e.radius,width:n,height:n}}function tE(t,e){let i=DE(t,e)||e;return{start:Math.min(i.start,i.end),end:Math.max(i.start,i.end)}}function U3(t,e,i){let n=df(t,i.value,NaN),a=df(t,i.endValue,n);t.isHorizontal()?(e.x=n,e.x2=a):(e.y=n,e.y2=a)}function j3(t,e,i){for(let n of Object.keys(eE)){let a=t[Td(t,i,n)];if(a){let{min:r,max:h,start:m,end:b,startProp:T,endProp:k}=eE[n],P=DE(a,{min:i[r],max:i[h],start:a[m],end:a[b]});e[T]=P.start,e[k]=P.end}}}function q3({properties:t,options:e},i,n,a){let{x:r,x2:h,width:m}=t;return FE({start:r,end:h,size:m,borderWidth:e.borderWidth},{position:n.x,padding:{start:a.left,end:a.right},adjust:e.label.xAdjust,size:i.width})}function H3({properties:t,options:e},i,n,a){let{y:r,y2:h,height:m}=t;return FE({start:r,end:h,size:m,borderWidth:e.borderWidth},{position:n.y,padding:{start:a.top,end:a.bottom},adjust:e.label.yAdjust,size:i.height})}function FE(t,e){let{start:i,end:n,borderWidth:a}=t,{position:r,padding:{start:h,end:m},adjust:b}=e,T=n-a-i-h-m-e.size;return i+a/2+b+O2(T,r)}function W3(t,e,i){let n=i.label;n.backgroundColor="transparent",n.callout.display=!1;let a=F2(n.position),r=On(n.padding),h=Dv(t.ctx,n),m=q3({properties:e,options:i},h,a,r),b=H3({properties:e,options:i},h,a,r),T=h.width+r.width,k=h.height+r.height;return{x:m,y:b,x2:m+T,y2:b+k,width:T,height:k,centerX:m+T/2,centerY:b+k/2,rotation:n.rotation}}var A2=["enter","leave"],N2=A2.concat("click");
732function G3(t,e,i){e.listened=AE(i,N2,e.listeners),e.moveListened=!1,A2.forEach(n=>{Yr(i[n])&&(e.moveListened=!0)}),(!e.listened||!e.moveListened)&&e.annotations.forEach(n=>{!e.listened&&Yr(n.click)&&(e.listened=!0),e.moveListened||A2.forEach(a=>{Yr(n[a])&&(e.listened=!0,e.moveListened=!0)})})}function Z3(t,e,i){if(t.listened)switch(e.type){case"mousemove":case"mouseout":return K3(t,e,i);case"click":return X3(t,e,i)}}function K3(t,e,i){if(!t.moveListened)return;let n;e.type==="mousemove"?n=z2(t.visibleElements,e,i.interaction):n=[];let a=t.hovered;t.hovered=n;let r={state:t,event:e},h=iE(r,"leave",a,n);return iE(r,"enter",n,a)||h}function iE({state:t,event:e},i,n,a){let r;for(let h of n)a.indexOf(h)<0&&(r=BE(h.options[i]||t.listeners[i],h,e)||r);return r}function X3(t,e,i){let n=t.listeners,a=z2(t.visibleElements,e,i.interaction),r;for(let h of a)r=BE(h.options.click||n.click,h,e)||r;return r}function BE(t,e,i){return $i(t,[e.$context,i])===!0}var Ev=["afterDraw","beforeDraw"];function Y3(t,e,i){let n=e.visibleElements;e.hooked=AE(i,Ev,e.hooks),e.hooked||n.forEach(a=>{e.hooked||Ev.forEach(r=>{Yr(a.options[r])&&(e.hooked=!0)})})}function nE(t,e,i){if(t.hooked){let n=e.options[i]||t.hooks[i];return $i(n,[e.$context])}}function J3(t,e,i){let n=n4(t.scales,e,i),a=rE(e,n,"min","suggestedMin");a=rE(e,n,"max","suggestedMax")||a,a&&Yr(e.handleTickRangeOptions)&&e.handleTickRangeOptions()}function Q3(t,e){for(let i of t)t4(i,e)}function rE(t,e,i,n){if(pn(e[i])&&!e4(t.options,i,n)){let a=t[i]!==e[i];return t[i]=e[i],a}}function e4(t,e,i){return Jr(t[e])||Jr(t[i])}function t4(t,e){for(let i of["scaleID","xScaleID","yScaleID"]){let n=Td(e,t,i);n&&!e[n]&&i4(t,i)&&console.warn(`No scale found with id '${n}' for annotation '${t.id}'`)}}function i4(t,e){if(e==="scaleID")return!0;let i=e.charAt(0);for(let n of["Min","Max","Value"])if(Jr(t[i+n]))return!0;return!1}function n4(t,e,i){let n=e.axis,a=e.id,r=n+"ScaleID",h={min:Ht(e.min,Number.NEGATIVE_INFINITY),max:Ht(e.max,Number.POSITIVE_INFINITY)};for(let m of i)m.scaleID===a?sE(m,e,["value","endValue"],h):Td(t,m,r)===a&&sE(m,e,[n+"Min",n+"Max",n+"Value"],h);return h}function sE(t,e,i,n){for(let a of i){let r=t[a];if(Jr(r)){let h=e.parse(r);n.min=Math.min(n.min,h),n.max=Math.max(n.max,h)}}}var Wu=class extends kr{inRange(e,i,n,a){let{x:r,y:h}=Ad({x:e,y:i},this.getCenterPoint(a),zn(-this.options.rotation));return vE({x:r,y:h},this.getProps(["x","y","x2","y2"],a),n,this.options)}getCenterPoint(e){return Ed(this,e)}draw(e){e.save(),Pv(e,this.getCenterPoint(),this.options.rotation),IE(e,this,this.options),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,i){return OE(e,i)}};Wu.id="boxAnnotation";Wu.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,hitTolerance:0,label:{backgroundColor:"transparent",borderWidth:0,callout:{display:!1},color:"black",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:void 0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};Wu.defaultRoutes={borderColor:"color",backgroundColor:"color"};Wu.descriptors={label:{_fallback:!0}};var pf=class extends kr{inRange(e,i,n,a){return bE({x:e,y:i},{rect:this.getProps(["x","y","x2","y2"],a),center:this.getCenterPoint(a)},n,{rotation:this.rotation,borderWidth:0,hitTolerance:this.options.hitTolerance})}getCenterPoint(e){return Ed(this,e)}draw(e){let i=this.options;!i.display||!i.content||(c4(e,this),e.save(),Pv(e,this.getCenterPoint(),this.rotation),LE(e,this,i,this._fitRatio),e.restore())}resolveElementProperties(e,i){let n=r4(e,i);if(!n)return{};let{controllerMeta:a,point:r,radius:h}=o4(e,i,n),m=Dv(e.ctx,i),b=a4(m,h);kE(i,b)&&(m={width:m.width*b,height:m.height*b});let{position:T,xAdjust:k,yAdjust:P}=i,F=TE(r,m,{borderWidth:0,position:T,xAdjust:k,yAdjust:P});return{initProperties:gf(e,F,i),...F,...a,rotation:i.rotation,_fitRatio:b}}};pf.id="doughnutLabelAnnotation";pf.defaults={autoFit:!0,autoHide:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderColor:"transparent",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:0,color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,spacing:1,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0};pf.defaultRoutes={};function r4(t,e){return t.getSortedVisibleDatasetMetas().reduce(function(i,n){let a=n.controller;return a instanceof xd&&s4(t,e,n.data)&&(!i||a.innerRadius<i.controller.innerRadius)&&a.options.circumference>=90?n:i},void 0)}function s4(t,e,i){if(!e.autoHide)return!0;for(let n=0;n<i.length;n++)if(!i[n].hidden&&t.getDataVisibility(n))return!0}function o4({chartArea:t},e,i){let{left:n,top:a,right:r,bottom:h}=t,{innerRadius:m,offsetX:b,offsetY:T}=i.controller,k=(n+r)/2+b,P=(a+h)/2+T,F={left:Math.max(k-m,n),right:Math.min(k+m,r),top:Math.max(P-m,a),bottom:Math.min(P+m,h)},U={x:(F.left+F.right)/2,y:(F.top+F.bottom)/2},X=e.spacing+e.borderWidth/2,Y=m-X,te=U.y>P,le=te?a+X:h-X,we=l4(le,k,P,Y);return{controllerMeta:{_centerX:k,_centerY:P,_radius:Y,_counterclockwise:te,...we},point:U,radius:Math.min(m,Math.min(F.right-F.left,F.bottom-F.top)/2)}}function a4({width:t,height:e},i){let n=Math.sqrt(Math.pow(t,2)+Math.pow(e,2));return i*2/n}function l4(t,e,i,n){let a=Math.pow(i-t,2),r=Math.pow(n,2),h=e*-2,m=Math.pow(e,2)+a-r,b=Math.pow(h,2)-4*m;if(b<=0)return{_startAngle:0,_endAngle:Yi};let T=(-h-Math.sqrt(b))/2,k=(-h+Math.sqrt(b))/2;return{_startAngle:md({x:e,y:i},{x:T,y:t}).angle,_endAngle:md({x:e,y:i},{x:k,y:t}).angle}}function c4(t,e){let{_centerX:i,_centerY:n,_radius:a,_startAngle:r,_endAngle:h,_counterclockwise:m,options:b}=e;t.save();let T=Bc(t,b);t.fillStyle=b.backgroundColor,t.beginPath(),t.arc(i,n,a,r,h,m),t.closePath(),t.fill(),T&&t.stroke(),t.restore(
732)}var kd=class extends kr{inRange(e,i,n,a){return bE({x:e,y:i},{rect:this.getProps(["x","y","x2","y2"],a),center:this.getCenterPoint(a)},n,{rotation:this.rotation,borderWidth:this.options.borderWidth,hitTolerance:this.options.hitTolerance})}getCenterPoint(e){return Ed(this,e)}draw(e){let i=this.options,n=!Jr(this._visible)||this._visible;!i.display||!i.content||!n||(e.save(),Pv(e,this.getCenterPoint(),this.rotation),P3(e,this),IE(e,this,i),LE(e,u4(this),i),e.restore())}resolveElementProperties(e,i){let n;if(ME(i))n=RE(e,i);else{let{centerX:m,centerY:b}=B2(e,i);n={x:m,y:b}}let a=On(i.padding),r=Dv(e.ctx,i),h=TE(n,r,i,a);return{initProperties:gf(e,h,i),pointX:n.x,pointY:n.y,...h,rotation:i.rotation}}};kd.id="labelAnnotation";kd.defaults={adjustScaleRange:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:0,callout:{borderCapStyle:"butt",borderColor:void 0,borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:1,display:!1,margin:5,position:"auto",side:5,start:"50%"},color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};kd.defaultRoutes={borderColor:"color"};function u4({x:t,y:e,width:i,height:n,options:a}){let r=a.borderWidth/2,h=On(a.padding);return{x:t+h.left+r,y:e+h.top+r,width:i-h.left-h.right-a.borderWidth,height:n-h.top-h.bottom-a.borderWidth}}var V2=(t,e,i)=>({x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}),E2=(t,e,i)=>V2(e,i,Math.abs((t-e.y)/(i.y-e.y))).x,oE=(t,e,i)=>V2(e,i,Math.abs((t-e.x)/(i.x-e.x))).y,Fg=t=>t*t,h4=(t,e,{x:i,y:n,x2:a,y2:r},h)=>h==="y"?{start:Math.min(n,r),end:Math.max(n,r),value:e}:{start:Math.min(i,a),end:Math.max(i,a),value:t},aE=(t,e,i,n)=>(1-n)*(1-n)*t+2*(1-n)*n*e+n*n*i,I2=(t,e,i,n)=>({x:aE(t.x,e.x,i.x,n),y:aE(t.y,e.y,i.y,n)}),lE=(t,e,i,n)=>2*(1-n)*(e-t)+2*n*(i-e),cE=(t,e,i,n)=>-Math.atan2(lE(t.x,e.x,i.x,n),lE(t.y,e.y,i.y,n))+.5*gi,Cd=class extends kr{inRange(e,i,n,a){let r=(this.options.borderWidth+this.options.hitTolerance)/2;if(n!=="x"&&n!=="y"){let h={mouseX:e,mouseY:i},{path:m,ctx:b}=this;if(m){Bc(b,this.options),b.lineWidth+=this.options.hitTolerance;let{chart:k}=this.$context,P=e*k.currentDevicePixelRatio,F=i*k.currentDevicePixelRatio,U=b.isPointInStroke(m,P,F)||L2(this,h,a);return b.restore(),U}let T=Fg(r);return m4(this,h,T,a)||L2(this,h,a)}return d4(this,{mouseX:e,mouseY:i},n,{hitSize:r,useFinalPosition:a})}getCenterPoint(e){return Ed(this,e)}draw(e){let{x:i,y:n,x2:a,y2:r,cp:h,options:m}=this;if(e.save(),!Bc(e,m))return e.restore();yf(e,m);let b=Math.sqrt(Math.pow(a-i,2)+Math.pow(r-n,2));if(m.curve&&h)return S4(e,this,h,b),e.restore();let{startOpts:T,endOpts:k,startAdjust:P,endAdjust:F}=NE(this),U=Math.atan2(r-n,a-i);e.translate(i,n),e.rotate(U),e.beginPath(),e.moveTo(0+P,0),e.lineTo(b-F,0),e.shadowColor=m.borderShadowColor,e.stroke(),P2(e,0,P,T),P2(e,b,-F,k),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,i){let n=V3(e,i),{x:a,y:r,x2:h,y2:m}=n,b=p4(n,e.chartArea),T=b?f4({x:a,y:r},{x:h,y:m},e.chartArea):{x:a,y:r,x2:h,y2:m,width:Math.abs(h-a),height:Math.abs(m-r)};if(T.centerX=(h+a)/2,T.centerY=(m+r)/2,T.initProperties=gf(e,T,i),i.curve){let P={x:T.x,y:T.y},F={x:T.x2,y:T.y2};T.cp=w4(T,i,Lc(P,F))}let k=g4(e,T,i.label);return k._visible=b,T.elements=[{type:"label",optionScope:"label",properties:k,initProperties:T.initProperties}],T}};Cd.id="lineAnnotation";var uE={backgroundColor:void 0,backgroundShadowColor:void 0,borderColor:void 0,borderDash:void 0,borderDashOffset:void 0,borderShadowColor:void 0,borderWidth:void 0,display:void 0,fill:void 0,length:void 0,shadowBlur:void 0,shadowOffsetX:void 0,shadowOffsetY:void 0,width:void 0};Cd.defaults={adjustScaleRange:!0,arrowHeads:{display:!1,end:Object.assign({},uE),fill:!1,length:12,start:Object.assign({},uE),width:6},borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:2,curve:!1,controlPoint:{y:"-50%"},display:!0,endValue:void 0,init:void 0,hitTolerance:0,label:{backgroundColor:"rgba(0,0,0,0.8)",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderColor:"black",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:6,borderShadowColor:"transparent",borderWidth:0,callout:Object.assign({},kd.defaults.callout),color:"#fff",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},scaleID:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,value:void 0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};Cd.descriptors={arrowHeads:{start:{_fallback:!0},end:{_fallback:!0},_fallback:!0}};Cd.defaultRoutes={borderColor:"color"};function d4(t,{mouseX:e,mouseY:i},n,{hitSize:a,useFinalPosition:r}){let h=h4(e,i,t.getProps(["x","y","x2","y2"],r),n);return _E(h,a)||L2(t,{mouseX:e,mouseY:i},r,n)}function p4({x:t,y:e,x2:i,y2:n},{top:a,right:r,bottom:h,left:m}){return!(t<m&&i<m||t>r&&i>r||e<a&&n<a||e>h&&n>h)}function hE({x:t,y:e}
732,i,{top:n,right:a,bottom:r,left:h}){return t<h&&(e=oE(h,{x:t,y:e},i),t=h),t>a&&(e=oE(a,{x:t,y:e},i),t=a),e<n&&(t=E2(n,{x:t,y:e},i),e=n),e>r&&(t=E2(r,{x:t,y:e},i),e=r),{x:t,y:e}}function f4(t,e,i){let{x:n,y:a}=hE(t,e,i),{x:r,y:h}=hE(e,t,i);return{x:n,y:a,x2:r,y2:h,width:Math.abs(r-n),height:Math.abs(h-a)}}function m4(t,{mouseX:e,mouseY:i},n=Sd,a){let{x:r,y:h,x2:m,y2:b}=t.getProps(["x","y","x2","y2"],a),T=m-r,k=b-h,P=Fg(T)+Fg(k),F=P===0?-1:((e-r)*T+(i-h)*k)/P,U,X;return F<0?(U=r,X=h):F>1?(U=m,X=b):(U=r+F*T,X=h+F*k),Fg(e-U)+Fg(i-X)<=n}function L2(t,{mouseX:e,mouseY:i},n,a){let r=t.label;return r.options.display&&r.inRange(e,i,a,n)}function g4(t,e,i){let n=i.borderWidth,a=On(i.padding),r=Dv(t.ctx,i),h=r.width+a.width+n,m=r.height+a.height+n;return _4(e,i,{width:h,height:m,padding:a},t.chartArea)}function y4(t){let{x:e,y:i,x2:n,y2:a}=t,r=Math.atan2(a-i,n-e);return r>gi/2?r-gi:r<gi/-2?r+gi:r}function _4(t,e,i,n){let{width:a,height:r,padding:h}=i,{xAdjust:m,yAdjust:b}=e,T={x:t.x,y:t.y},k={x:t.x2,y:t.y2},P=e.rotation==="auto"?y4(t):zn(e.rotation),F=v4(a,r,P),U=b4(t,e,{labelSize:F,padding:h},n),X=t.cp?I2(T,t.cp,k,U):V2(T,k,U),Y={size:F.w,min:n.left,max:n.right,padding:h.left},te={size:F.h,min:n.top,max:n.bottom,padding:h.top},le=pE(X.x,Y)+m,we=pE(X.y,te)+b;return{x:le-a/2,y:we-r/2,x2:le+a/2,y2:we+r/2,centerX:le,centerY:we,pointX:X.x,pointY:X.y,width:a,height:r,rotation:fd(P)}}function v4(t,e,i){let n=Math.cos(i),a=Math.sin(i);return{w:Math.abs(t*n)+Math.abs(e*a),h:Math.abs(t*a)+Math.abs(e*n)}}function b4(t,e,i,n){let a,r=x4(t,n);return e.position==="start"?a=dE({w:t.x2-t.x,h:t.y2-t.y},i,e,r):e.position==="end"?a=1-dE({w:t.x-t.x2,h:t.y-t.y2},i,e,r):a=O2(1,e.position),a}function dE(t,e,i,n){let{labelSize:a,padding:r}=e,h=t.w*n.dx,m=t.h*n.dy,b=h>0&&(a.w/2+r.left-n.x)/h,T=m>0&&(a.h/2+r.top-n.y)/m;return Iv(Math.max(b,T),0,.25)}function x4(t,e){let{x:i,x2:n,y:a,y2:r}=t,h=Math.min(a,r)-e.top,m=Math.min(i,n)-e.left,b=e.bottom-Math.max(a,r),T=e.right-Math.max(i,n);return{x:Math.min(m,T),y:Math.min(h,b),dx:m<=T?1:-1,dy:h<=b?1:-1}}function pE(t,e){let{size:i,min:n,max:a,padding:r}=e,h=i/2;return i>a-n?(a+n)/2:(n>=t-r-h&&(t=n+r+h),a<=t+r+h&&(t=a-r-h),t)}function NE(t){let e=t.options,i=e.arrowHeads&&e.arrowHeads.start,n=e.arrowHeads&&e.arrowHeads.end;return{startOpts:i,endOpts:n,startAdjust:fE(t,i),endAdjust:fE(t,n)}}function fE(t,e){if(!e||!e.display)return 0;let{length:i,width:n}=e,a=t.options.borderWidth/2,r={x:i,y:n+a};return Math.abs(E2(0,r,{x:0,y:a}))}function P2(t,e,i,n){if(!n||!n.display)return;let{length:a,width:r,fill:h,backgroundColor:m,borderColor:b}=n,T=Math.abs(e-a)+i;t.beginPath(),yf(t,n),Bc(t,n),t.moveTo(T,-r),t.lineTo(e+i,0),t.lineTo(T,r),h===!0?(t.fillStyle=m||b,t.closePath(),t.fill(),t.shadowColor="transparent"):t.shadowColor=n.borderShadowColor,t.stroke()}function w4(t,e,i){let{x:n,y:a,x2:r,y2:h,centerX:m,centerY:b}=t,T=Math.atan2(h-a,r-n),k=F2(e.controlPoint,0),P={x:m+Hu(i,k.x,!1),y:b+Hu(i,k.y,!1)};return Ad(P,{x:m,y:b},T)}function mE(t,{x:e,y:i},{angle:n,adjust:a},r){!r||!r.display||(t.save(),t.translate(e,i),t.rotate(n),P2(t,0,-a,r),t.restore())}function S4(t,e,i,n){let{x:a,y:r,x2:h,y2:m,options:b}=e,{startOpts:T,endOpts:k,startAdjust:P,endAdjust:F}=NE(e),U={x:a,y:r},X={x:h,y:m},Y=cE(U,i,X,0),te=cE(U,i,X,1)-gi,le=I2(U,i,X,P/n),we=I2(U,i,X,1-F/n),Le=new Path2D;t.beginPath(),Le.moveTo(le.x,le.y),Le.quadraticCurveTo(i.x,i.y,we.x,we.y),t.shadowColor=b.borderShadowColor,t.stroke(Le),e.path=Le,e.ctx=t,mE(t,le,{angle:Y,adjust:P},T),mE(t,we,{angle:te,adjust:F},k)}var Md=class extends kr{inRange(e,i,n,a){let r=this.options.rotation,h=(this.options.borderWidth+this.options.hitTolerance)/2;if(n!=="x"&&n!=="y")return T4({x:e,y:i},this.getProps(["width","height","centerX","centerY"],a),r,h);let{x:m,y:b,x2:T,y2:k}=this.getProps(["x","y","x2","y2"],a),P=n==="y"?{start:b,end:k}:{start:m,end:T},F=Ad({x:e,y:i},this.getCenterPoint(a),zn(-r));return F[n]>=P.start-h-Sd&&F[n]<=P.end+h+Sd}getCenterPoint(e){return Ed(this,e)}draw(e){let{width:i,height:n,centerX:a,centerY:r,options:h}=this;e.save(),Pv(e,this.getCenterPoint(),h.rotation),yf(e,this.options),e.beginPath(),e.fillStyle=h.backgroundColor;let m=Bc(e,h);e.ellipse(a,r,n/2,i/2,gi/2,0,2*gi),e.fill(),m&&(e.shadowColor=h.borderShadowColor,e.stroke()),e.restore(
732)}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,i){return OE(e,i)}};Md.id="ellipseAnnotation";Md.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,label:Object.assign({},Wu.defaults.label),rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};Md.defaultRoutes={borderColor:"color",backgroundColor:"color"};Md.descriptors={label:{_fallback:!0}};function T4(t,e,i,n){let{width:a,height:r,centerX:h,centerY:m}=e,b=a/2,T=r/2;if(b<=0||T<=0)return!1;let k=zn(i||0),P=Math.cos(k),F=Math.sin(k),U=Math.pow(P*(t.x-h)+F*(t.y-m),2),X=Math.pow(F*(t.x-h)-P*(t.y-m),2);return U/Math.pow(b+n,2)+X/Math.pow(T+n,2)<=1.0001}var ff=class extends kr{inRange(e,i,n,a){let{x:r,y:h,x2:m,y2:b,width:T}=this.getProps(["x","y","x2","y2","width"],a),k=(this.options.borderWidth+this.options.hitTolerance)/2;return n!=="x"&&n!=="y"?_3({x:e,y:i},this.getCenterPoint(a),T/2,k):_E(n==="y"?{start:h,end:b,value:i}:{start:r,end:m,value:e},k)}getCenterPoint(e){return Ed(this,e)}draw(e){let i=this.options,n=i.borderWidth;if(i.radius<.1)return;e.save(),e.fillStyle=i.backgroundColor,yf(e,i);let a=Bc(e,i);C3(e,this,this.centerX,this.centerY),a&&!Lv(i.pointStyle)&&(e.shadowColor=i.borderShadowColor,e.stroke()),e.restore(),i.borderWidth=n}resolveElementProperties(e,i){let n=zE(e,i);return n.initProperties=gf(e,n,i),n}};ff.id="pointAnnotation";ff.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,pointStyle:"circle",radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};ff.defaultRoutes={borderColor:"color",backgroundColor:"color"};var mf=class extends kr{inRange(e,i,n,a){if(n!=="x"&&n!=="y")return this.options.radius>=.1&&this.elements.length>1&&C4(this.elements,e,i,a);let r=Ad({x:e,y:i},this.getCenterPoint(a),zn(-this.options.rotation)),h=this.elements.map(T=>n==="y"?T.bY:T.bX),m=Math.min(...h),b=Math.max(...h);return r[n]>=m&&r[n]<=b}getCenterPoint(e){return Ed(this,e)}draw(e){let{elements:i,options:n}=this;e.save(),e.beginPath(),e.fillStyle=n.backgroundColor,yf(e,n);let a=Bc(e,n),r=!0;for(let h of i)r?(e.moveTo(h.x,h.y),r=!1):e.lineTo(h.x,h.y);e.closePath(),e.fill(),a&&(e.shadowColor=n.borderShadowColor,e.stroke()),e.restore()}resolveElementProperties(e,i){let n=zE(e,i),{sides:a,rotation:r}=i,h=[],m=2*gi/a,b=r*pg;for(let T=0;T<a;T++,b+=m){let k=k4(n,i,b);k.initProperties=gf(e,n,i),h.push(k)}return n.elements=h,n}};mf.id="polygonAnnotation";mf.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,point:{radius:0},radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,sides:3,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};mf.defaultRoutes={borderColor:"color",backgroundColor:"color"};function k4({centerX:t,centerY:e},{radius:i,borderWidth:n,hitTolerance:a},r){let h=(n+a)/2,m=Math.sin(r),b=Math.cos(r),T={x:t+m*i,y:e-b*i};return{type:"point",optionScope:"point",properties:{x:T.x,y:T.y,centerX:T.x,centerY:T.y,bX:t+m*(i+h),bY:e-b*(i+h)}}}function C4(t,e,i,n){let a=!1,r=t[t.length-1].getProps(["bX","bY"],n);for(let h of t){let m=h.getProps(["bX","bY"],n);m.bY>i!=r.bY>i&&e<(r.bX-m.bX)*(i-m.bY)/(r.bY-m.bY)+m.bX&&(a=!a),r=m}return a}var qu={box:Wu,doughnutLabel:pf,ellipse:Md,label:kd,line:Cd,point:ff,polygon:mf};Object.keys(qu).forEach(t=>{fn.describe(`elements.${qu[t].id}`,{_fallback:"plugins.annotation.common"})});var M4={update:Object.assign},A4=N2.concat(Ev),gE=(t,e)=>Yt(e)?R2(t,e):t,D2=t=>t==="color"||t==="font";function $2(t="line"){return qu[t]?t:(console.warn(`Unknown annotation type: '${t}', defaulting to 'line'`),"line")}function E4(t,e,i,n){let a=L4(t,i.animations,n),r=e.annotations,h=R4(e.elements,r);for(let m=0;m<r.length;m++){let b=r[m],T=VE(h,m,b.type),k=b.setContext(D4(t,T,h,b)),P=T.resolveElementProperties(t,k);P.skip=I4(P),"elements"in P&&(P4(T,P.elements,k,a),delete P.elements),Jr(T.x)||Object.assign(T,P),Object.assign(T,P.initProperties),P.options=$E(k),a.update(T,P)}}function I4(t){return isNaN(t.x)||isNaN(t.y)}function L4(t,e,i){return i==="reset"||i==="none"||i==="resize"?M4:new cf(t,e)}function P4(t,e,i,n){let a=t.elements||(t.elements=[]);a.length=e.length;for(let r=0;r<e.length;r++){let h=e[r],m=h.properties,b=VE(a,r,h.type,h.initProperties),T=i[h.optionScope].override(h);m.options=$E(T),n.update(b,m)}}function VE(t,e,i,n){let a=qu[$2(i)],r=t[e];return(!r||!(r instanceof a))&&(r=t[e]=new a,Object.assign(r,n)),r}function $E(t){let e=qu[$2(t.type)],i={};i.id=t.id,i.type=t.type,i.drawTime=t.drawTime,Object.assign(i,R2(t,e.defaults),R2(t,e.defaultRoutes));for(let n of A4)i[n]=t[n];return i}function R2(t,e){let i={};for(let n of Object.keys(e)){let a=e[n],r=t[n];D2(n)&&Pi(r)?i[n]=r.map(h=>gE(h,a)):i[n]=gE(r,a)}return i}function D4(t,e,i,n){return e.$context||(e.$context=Object.assign(Object.create(t.getContext()),{element:e,get elements(){return i.filter(a=>a&&a.options)},id:n.id,type:"annotation"}))}function R4(t,e){let i=e.length,n=t.length;if(n<i){let a=i-n;t.splice(n,0,...new Array(a))}else n>i&&t.splice(i,n-i);return t}var z4="3.1.0",ju=new Map,yE=t=>t.type!=="doughnutLabel",O4=N2.concat(Ev),UE={id:"annotation",version:z4,beforeRegister(){v3("chart.js","4.0",Nl.version)},afterRegister(){Nl.register(qu)},afterUnregister(){Nl.unregister(qu)},beforeInit(t){ju.set(t,{annotations:[],elements:[],visibleElements:[],listeners:{},listened:!1,moveListened:!1,hooks:{},hooked:!1,hovered:[]})},beforeUpdate(t,e,i){let n=ju.get(t),a=n.annotations=[],r=i.annotations;Yt(r)?Object.keys(r).forEach(h=>{let m=r[h];Yt(m)&&(m.id=h,a.push(m))}):Pi(r)&&a.push(...r),Q3(a.filter(yE),t.scales)},afterDataLimits(t,e){let i=ju.get(t);J3(t,e.scale,i.annotations.filter(yE).filter(n=>
732n.display&&n.adjustScaleRange))},afterUpdate(t,e,i){let n=ju.get(t);G3(t,n,i),E4(t,n,i,e.mode),n.visibleElements=n.elements.filter(a=>!a.skip&&a.options.display),Y3(t,n,i)},beforeDatasetsDraw(t,e,i){Og(t,"beforeDatasetsDraw",i.clip)},afterDatasetsDraw(t,e,i){Og(t,"afterDatasetsDraw",i.clip)},beforeDatasetDraw(t,e,i){Og(t,e.index,i.clip)},beforeDraw(t,e,i){Og(t,"beforeDraw",i.clip)},afterDraw(t,e,i){Og(t,"afterDraw",i.clip)},beforeEvent(t,e,i){let n=ju.get(t);Z3(n,e.event,i)&&(e.changed=!0)},afterDestroy(t){ju.delete(t)},getAnnotations(t){let e=ju.get(t);return e?e.elements:[]},_getAnnotationElementsAtEventForMode(t,e,i){return z2(t,e,i)},defaults:{animations:{numbers:{properties:["x","y","x2","y2","width","height","centerX","centerY","pointX","pointY","radius"],type:"number"},colors:{properties:["backgroundColor","borderColor"],type:"color"}},clip:!0,interaction:{mode:void 0,axis:void 0,intersect:void 0},common:{drawTime:"afterDatasetsDraw",init:!1,label:{}}},descriptors:{_indexable:!1,_scriptable:t=>!O4.includes(t)&&t!=="init",annotations:{_allKeys:!1,_fallback:(t,e)=>`elements.${qu[$2(e.type)].id}`},interaction:{_fallback:!0},common:{label:{_indexable:D2,_fallback:!0},_indexable:D2}},additionalOptionScopes:[""]};function Og(t,e,i){let{ctx:n,chartArea:a}=t,r=ju.get(t);i&&Nu(n,a);let h=F4(r.visibleElements,e).sort((m,b)=>m.element.options.z-b.element.options.z);for(let m of h)B4(n,a,r,m);i&&Vu(n)}function F4(t,e){let i=[];for(let n of t)if(n.options.drawTime===e&&i.push({element:n,main:!0}),n.elements&&n.elements.length)for(let a of n.elements)a.options.display&&a.options.drawTime===e&&i.push({element:a});return i}function B4(t,e,i,n){let a=n.element;n.main?(nE(i,a,"beforeDraw"),a.draw(t,e),nE(i,a,"afterDraw")):a.draw(t,e)}Rg.register(UE);var Rv=class extends Ve{static targets=["totalAscent","totalDescent","chartContainer"];static values={poiTraceId:String,apiUrl:String};connect(){console.log("Elevation Profile Chart Controller connected"),console.log("Poi Trace ID:",this.poiTraceIdValue),console.log("API URL:",this.apiUrlValue),this.waitForVisibility()}disconnect(){console.log("Elevation Profile Chart Controller disconnected"),this.observer&&(this.observer.disconnect(),this.observer=null)}waitForVisibility(){if(this.chartContainerTarget.querySelector("canvas")){console.log("\u2705 Graphique d\xE9j\xE0 charg\xE9");return}if(this.chartContainerTarget.dataset.loading==="true"){console.log("\u23F3 Chargement d\xE9j\xE0 en cours...");return}if(this.isVisible()){console.log("\u2705 Conteneur visible, chargement imm\xE9diat"),this.chartContainerTarget.dataset.loading="true",this.fetchElevationData();return}console.log("\u23F3 Conteneur cach\xE9, attente de visibilit\xE9..."),this.observer=new MutationObserver(()=>{this.isVisible()&&this.chartContainerTarget.dataset.loading!=="true"&&(console.log("\u2705 Conteneur devenu visible, chargement..."),this.observer.disconnect(),this.observer=null,this.chartContainerTarget.dataset.loading="true",this.fetchElevationData())});let t=this.chartContainerTarget;for(;t;)this.observer.observe(t,{attributes:!0,attributeFilter:["class","style"]}),t=t.parentElement}isVisible(){let t=this.chartContainerTarget.getBoundingClientRect();return t.width>0&&t.height>0}async fetchElevationData(){try{let t=`${window.location.origin}${this.apiUrlValue}`;console.log("Fetching from URL:",t);let i=await(await fetch(t)).json();console.log("Donn\xE9es brutes re\xE7ues:",i),console.log("Structure des points:",i.points.map(n=>({id:n.id,distance:n.distance,elevation:n.elevation}))),this.totalAscentTarget.textContent=`+${i.metadata.total_ascent} m`,this.totalDescentTarget.textContent=`-${i.metadata.total_descent} m`,this.drawChart(i),console.log("\u2705 Graphique charg\xE9 avec succ\xE8s")}catch(t){console.error("\u274C Erreur lors du chargement du graphique:",t),this.chartContainerTarget.dataset.loading="false"}}drawChart(t){let e=t.points,i=e[0].distance,n=e[e.length-1].distance,a=e.map(P=>P.distance),r=e.map(P=>P.elevation),h=e.find(P=>P.distance===0);console.log("Point z\xE9ro:",h);let m=document.createElement("canvas");m.style.width="100%",m.style.height="100%",this.chartContainerTarget.innerHTML="",this.chartContainerTarget.appendChild(m);let b=m.getContext("2d"),T=new Rg(m,{type:"line",data:{labels:a.map(P=>P/1e3),datasets:[...t.major_stops.map(P=>({label:P.name,data:[{x:P.distance/1e3,y:P.elevation}],borderColor:"#1e3a8a",backgroundColor:"#fab313",pointRadius:6,pointHoverRadius:8,pointBorderWidth:2,showLine:!1,zIndex:1e3})),{label:"\xC9l\xE9vation",data:r,borderColor:"#fab313",backgroundColor:P=>{let U=P.chart.ctx.createLinearGradient(0,0,0,400);return U.addColorStop(0,"rgba(30, 58, 138, 0.4)"),U.addColorStop(.5,"rgba(30, 58, 138, 0.2)"),U.addColorStop(1,"rgba(30, 58, 138, 0)"),U},borderWidth:2,fill:!0,tension:.4,pointRadius:0,zIndex:0}]},options:{responsive:!0,maintainAspectRatio:!1,layout:{padding:{top:20,right:20,bottom:20,left
732:20}},plugins:{legend:{display:!1},tooltip:{enabled:!0,mode:"index",intersect:!1,callbacks:{label:function(P){return`Altitude: ${P.parsed.y}m`},title:function(P){return`Distance: ${P[0].parsed.x}km`}},backgroundColor:"rgba(30, 58, 138, 0.9)",titleColor:"white",bodyColor:"white",padding:10,displayColors:!1},annotation:{annotations:t.major_stops.map(P=>({type:"label",xValue:P.distance/1e3,yValue:P.elevation,content:P.name,backgroundColor:"white",borderColor:"#1e3a8a",borderWidth:1,color:"#1e3a8a",font:{size:14,weight:"normal"},padding:{top:4,right:8,bottom:4,left:8},position:"top",yAdjust:-25,borderRadius:8}))}},scales:{x:{type:"linear",reverse:!0,display:!0,grid:{display:!0,borderDash:[5,5],color:"rgba(30, 58, 138, 0.1)"},ticks:{display:!0,stepSize:2,autoSkip:!1,callback:function(P){return P===0?"0 km":P===i/1e3||P===n/1e3?"":`${P} km`}},min:i/1e3,max:n/1e3,position:"bottom"},y:{display:!0,grid:{display:!0,borderDash:[5,5],color:"rgba(30, 58, 138, 0.1)"},ticks:{display:!0,stepSize:50,callback:function(P){return`${Math.round(P/50)*50}m`}},min:Math.floor(Math.min(...r)/50)*50,max:Math.ceil(Math.max(...r)/50)*50,position:"left"},y2:{display:!0,grid:{display:!1},ticks:{display:!0,stepSize:50,callback:function(P){return`${Math.round(P/50)*50}m`}},min:Math.floor(Math.min(...r)/50)*50,max:Math.ceil(Math.max(...r)/50)*50,position:"right"}}}});T.update(),setTimeout(()=>{let P=m.getContext("2d");P.font="bold 14px sans-serif",P.textAlign="center",t.major_stops.forEach(F=>{let U=F.distance,X=F.elevation,Y=T.scales.x.getPixelForValue(U/1e3),te=T.scales.y.getPixelForValue(X)-20;console.log(`Dessin du label pour ${F.name} \xE0 (${Y}, ${te})`);let le=P.measureText(F.name).width,we=8,Le=24;P.fillStyle="white",P.fillRect(Y-le/2-we,te-Le/2,le+we*2,Le),P.strokeStyle="#1e3a8a",P.lineWidth=1,P.strokeRect(Y-le/2-we,te-Le/2,le+we*2,Le),P.fillStyle="#1e3a8a",P.fillText(F.name,Y,te)})},100);let k=this.chartContainerTarget.closest(".overflow-x-auto");k&&(k.style.overflowX="scroll",k.style.scrollBehavior="smooth",k.style.transition="scroll 1.5s ease-in-out",k.style.scrollbarColor="#fab313 transparent",k.style.scrollbarWidth="thin",setTimeout(()=>{k.scrollTo({left:k.scrollWidth,behavior:"smooth"})},300))}};var zv=class extends Ve{static targets=["container"];static values={type:String,message:String,duration:{type:Number,default:300},axis:{type:String,default:"x"}};get hiddenClass(){return this.axisValue==="y"?"-translate-y-full":"translate-x-full"}get shownClass(){return this.axisValue==="y"?"translate-y-0":"translate-x-0"}connect(){this.show(),this.autoDismiss()}show(){this.containerTarget.classList.remove(this.hiddenClass),this.containerTarget.classList.add(this.shownClass)}close(){this.containerTarget.classList.remove(this.shownClass),this.containerTarget.classList.add(this.hiddenClass),setTimeout(()=>{this.element.remove()},300)}autoDismiss(){setTimeout(()=>{this.close()},this.durationValue)}};var Ov=class extends Ve{static targets=["map","dialog"];connect(){this.loaded=!1;let t=this.hasMapTarget?this.mapTarget:this.element.querySelector("#google-map");t&&t.offsetParent!==null&&this.load()}async open(t){t&&t.preventDefault(),this.hasDialogTarget&&this.dialogTarget.showModal(),await this.load(),this.map&&(google.maps.event.trigger(this.map,"resize"),this.map.setCenter(this.center))}close(t){t&&t.preventDefault(),this.hasDialogTarget&&this.dialogTarget.close()}async load(){if(!this.loaded){this.loaded=!0;try{for(;typeof google>"u";)await new Promise(t=>setTimeout(t,100));await this.initMap()}catch(t){console.error("Erreur lors de l'initialisation de Google Maps:",t)}}}async initMap(){let t=document.getElementById("google-map");if(!t)return;let e=parseFloat(t.dataset.latitude)||46.227638,i=parseFloat(t.dataset.longitude)||2.213749,n=t.dataset.name||"Mon \xE9tablissement",{AdvancedMarkerElement:a}=await google.maps.importLibrary("marker"),r=new google.maps.Map(t,{center:{lat:e,lng:i},zoom:15,mapTypeId:google.maps.MapTypeId.ROADMAP,mapId:"8f52f5c1c5f07f0e"});this.map=r,this.center={lat:e,lng:i};let h=new a({map:r,position:{lat:e,lng:i},title:n,gmpDraggable:!0}),m=new google.maps.InfoWindow({content:`<div style="
733        padding: 4px 8px;
734        font-size: 14px;
735        font-weight: 500;
736        white-space: nowrap;
737      ">${n}</div>`,pixelOffset:new google.maps.Size(0,-10),disableAutoPan:!0});m.open(r,h),h.addListener("position_changed",()=>{m.open(r,h)}),h.addListener("dragend",()=>{let b=h.position,T=b.lat,k=b.lng,P=document.getElementById("poi_attributes_latitude"),F=document.getElementById("poi_attributes_longitude");P&&F&&(P.value=T,F.value=k)})}};var Fv=class extends Ve{static targets=["map","tooltip"];static values={apiKey:String,center:Array,zoom:Number,environment:String};static CONFIG={DEFAULT_CENTER:[3.4,45.2],DEFAULT_ZOOM:6.5,COLORS:{DEFAULT:"#1F2648",ACTIVE:"#FAB313"},LINE_WIDTH:5,SELECTED_LINE_WIDTH:3,MAX_CACHE_SIZE:100,CACHE_DURATION:7*24*60*60*1e3,CACHE_PREFIX:"map_tile_cache:"};connect(){try{pr.apiKey=this.apiKeyValue,this.initializeMap(),this.initializeTooltip()}catch(t){console.error("Error in connect:",t)}}initializeCache(){this.cleanExpiredCache(),this.tileCache=new Map;try{let t=Object.keys(localStorage).filter(e=>e.startsWith(this.constructor.CONFIG.CACHE_PREFIX));for(let e of t){let i=JSON.parse(localStorage.getItem(e));if(i&&!this.isCacheExpired(i.timestamp)){let n=e.replace(this.constructor.CONFIG.CACHE_PREFIX,"");this.tileCache.set(n,i.url)}}console.log(`\u{1F4E6} Cache charg\xE9: ${this.tileCache.size} tuiles`)}catch(t){console.error("Erreur lors du chargement du cache:",t),this.tileCache.clear()}}cleanExpiredCache(){let t=Object.keys(localStorage).filter(i=>i.startsWith(this.constructor.CONFIG.CACHE_PREFIX)),e=0;for(let i of t)try{let n=JSON.parse(localStorage.getItem(i));n&&this.isCacheExpired(n.timestamp)&&(localStorage.removeItem(i),e++)}catch{localStorage.removeItem(i),e++}e>0&&console.log(`\u{1F9F9} Cache nettoy\xE9: ${e} tuiles expir\xE9es supprim\xE9es`)}isCacheExpired(t){return Date.now()-t>this.constructor.CONFIG.CACHE_DURATION}saveTileToCache(t,e){let i=this.constructor.CONFIG.CACHE_PREFIX+t,n={url:e,timestamp:Date.now()};try{if(localStorage.setItem(i,JSON.stringify(n)),this.tileCache.set(t,e),this.tileCache.size>this.constructor.CONFIG.MAX_CACHE_SIZE){let a=this.tileCache.keys().next().value;this.tileCache.delete(a),localStorage.removeItem(this.constructor.CONFIG.CACHE_PREFIX+a),console.log(`\u{1F5D1}\uFE0F Suppression de la tuile la plus ancienne: ${a}`)}console.log(`\u{1F4BE} Tuile mise en cache: ${t}`)}catch(a){console.error("Erreur lors de la sauvegarde dans le cache:",a),this.cleanExpiredCache()}}initializeTooltip(){let t=document.createElement("div");t.className="absolute left-1/2 bottom-8 transform -translate-x-1/2 bg-white px-4 py-2 rounded-lg shadow-lg text-base text-blue font-medium hidden",t.setAttribute("data-home-map-panel-target","tooltip"),this.element.appendChild(t)}showTooltip(t){this.hasTooltipTarget&&(this.tooltipTarget.textContent=t,this.tooltipTarget.classList.remove("hidden"))}hideTooltip(){this.hasTooltipTarget&&this.tooltipTarget.classList.add("hidden")}initializeMap(){let t=this.constructor.CONFIG.DEFAULT_CENTER,e=this.hasCenterValue?this.centerValue:t;this.element.style.cssText=`
738      position: relative;
739      overflow: hidden;
740      width: 100%;
741      height: 100%;
742    `;let i=document.createElement("style");i.textContent=`
743      .maplibregl-marker {
744        position: absolute !important;
745        top: 0;
746        left: 0;
747        will-change: transform;
748      }
749    `,document.head.appendChild(i);let n=(r,h)=>
749{if(h!=="Tile"||!r.endsWith(".pbf"))return{url:r};let m=r.match(/\/(\d+)\/(\d+)\/(\d+)\.pbf/);if(!m)return{url:r};let[,b,T,k]=m,P=`${b}/${T}/${k}`;return this.tileCache.has(P)?(console.log(`\u2705 Tuile trouv\xE9e dans le cache: ${P}`),{url:this.tileCache.get(P)}):(this.saveTileToCache(P,r),{url:r})};this.map=new Ac({container:this.element,style:"91479711-437a-4607-a18f-a357212e1c52",center:e,zoom:this.zoomValue||this.constructor.CONFIG.DEFAULT_ZOOM,minZoom:5,maxZoom:15,dragPan:!1,dragRotate:!1,scrollZoom:!1,touchZoom:!1,doubleClickZoom:!1,touchPitch:!1,keyboard:!1,attributionControl:!0,navigationControl:!1,geolocateControl:!1,fullscreenControl:!1,scaleControl:!1,transformRequest:n,maxTileCacheSize:this.constructor.CONFIG.MAX_CACHE_SIZE,fadeDuration:0,preserveDrawingBuffer:!1,trackResize:!1,renderWorldCopies:!1});let a=this.map.getContainer().querySelector(".maplibregl-ctrl-attrib");a&&(a.style.cssText="display: none !important;"),this.map.on("load",()=>{console.log("Carte charg\xE9e, chargement des chemins..."),this.loadPaths()})}async loadPaths(){try{console.log("=== LOAD PATHS D\xC9BUT ===");let t=await fetch("/api/way_itineraries.json");if(!t.ok)throw new Error("Network response was not ok");let e=await t.json();console.log("GeoJSON re\xE7u de l'API:",e),console.log("Nombre de features:",e.features.length),e.features.forEach((i,n)=>{console.log(`Feature #${n} - ID: ${i.properties.id}, Nom: ${i.properties.name}`),console.log(`  Type de g\xE9om\xE9trie: ${i.geometry.type}`),console.log(`  Nombre de coordonn\xE9es: ${i.geometry.coordinates.length}`),console.log("  Villes:",{start:i.properties.city_start,end:i.properties.city_end})}),this.pathsData=e,this.featuresById={},e.features.forEach(i=>{let n=i.properties.id;this.featuresById[n]=JSON.parse(JSON.stringify(i))}),console.log("Cache des features cr\xE9\xE9:",Object.keys(this.featuresById).length,"features index\xE9s"),console.log("Donn\xE9es GeoJSON stock\xE9es dans this.pathsData"),this.map.addSource("paths",{type:"geojson",data:e}),console.log("Source paths ajout\xE9e \xE0 la carte"),this.map.addLayer({id:"paths-line",type:"line",source:"paths",layout:{"line-join":"round","line-cap":"round",visibility:"visible"},paint:{"line-color":this.constructor.CONFIG.COLORS.DEFAULT,"line-width":this.constructor.CONFIG.LINE_WIDTH,"line-opacity":1}}),this.map.addSource("hover-path",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),this.map.addLayer({id:"hover-path-line",type:"line",source:"hover-path",layout:{"line-join":"round","line-cap":"round",visibility:"visible"},paint:{"line-color":this.constructor.CONFIG.COLORS.ACTIVE,"line-width":this.constructor.CONFIG.SELECTED_LINE_WIDTH,"line-opacity":1}}),this.map.addSource("selected-path",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),this.map.addLayer({id:"selected-path-line",type:"line",source:"selected-path",layout:{"line-join":"round","line-cap":"round",visibility:"visible"},paint:{"line-color":this.constructor.CONFIG.COLORS.ACTIVE,"line-width":this.constructor.CONFIG.SELECTED_LINE_WIDTH,"line-opacity":1}}),console.log("Ajout des marqueurs des villes..."),this.addCityMarkers(e.features),this.hoveredPathId=null,this.map.on("click","paths-line",i=>{if(i.features.length>0){let n=i.features[0];if(this.isPathSelected(n)){this.clearSelection();let a=document.querySelector(`[data-home-way-panel-target="wayDetails"][data-path-id="${n.properties.id}"] [data-action="click->home-way-panel#closeDetails"]`);a&&a.click()}else this.selectPath(n),this.showPathDetails(n.properties.id)}}),this.map.on("mousemove","paths-line",i=>{if(i.features.length>0){let n=i.features[0],a=n.properties.id;if(this.hoveredPathId===a)return;this.hoveredPathId=a,this.map.getCanvas().style.cursor="pointer",this.isPathSelected(n)||(this.clearPathHighlight(),setTimeout(()=>{this.hoveredPathId===a&&(this.highlightPath(n),this.highlightButton(n.properties.id),this.showTooltip(n.properties.name))},10))}}),this.map.on("mouseleave","paths-line",()=>{this.map.getCanvas().style.cursor="",this.hoveredPathId=null,this.clearPathHighlight(),this.clearButtonHighlight(),this.selectedFeature?this.showTooltip(this.selectedFeature.properties.name):this.hideTooltip()}),console.log("=== LOAD PATHS FIN ===")}catch(t){console.error("Error loading paths:",t)}}isPathSelected(t){return this.selectedFeature&&this.selectedFeature.properties.id===t.properties.id}selectPath(t){console.log("=== SELECT PATH D\xC9BUT ==="),console.log("Feature s\xE9lectionn\xE9:",t),console.log("Feature ID:",t.properties.id);try{this.selectedFeature={type:"Feature",geometry:JSON.parse(JSON.stringify(t.geometry)),properties:JSON.parse(JSON.stringify(t.properties))},console.log("Feature copi\xE9 et stock\xE9 dans this.selectedFeature");let e=this.map.getSource("selected-path");if(e){let i={type:"FeatureCollection",features:[this.selectedFeature]};console.log("Nouveau GeoJSON cr\xE9\xE9 pour la s\xE9lection"),console.log("Nombre de coordonn\xE9es:",this.selectedFeature.geometry.coordinates.length),e.setData(i),console.log("Source de s\xE9lection mise \xE0 jour")}else console.log("Source selected-path non trouv\xE9e");this.showTooltip(t.properties.name)}catch(e){console.error("Erreur lors de la s\xE9lection du chemin:",e)}console.log("=== SELECT PATH FIN ===")}clearSelection(){this.selectedFeature=null;let t=this.map.getSource("selected-path");t&&t.setData({type:"FeatureCollection",features:[]}),this.hideTooltip()}addCityMarkers(t){console.log("=== ADD CITY MARKERS D\xC9BUT ==="),console.log("Nombre de features:",t.length),t.forEach((e,i)=>{console.log(`Feature #${i}:`,{id:e.properties.id,name:e.properties.name,city_start:e.properties.city_start,city_end:e.properties.city_end});let{city_start:n,city_end:a}=e.properties;n&&(console.log("Ajout marqueur ville de d\xE9part:",n),this.createMarker(n.latitude,n.longitude)),a&&(console.log("Ajout marqueur ville d'arriv\xE9e:",a),this.createMarker(a.latitude,a.longitude))}),console.log("=== ADD CITY MARKERS FIN ===")}createMarker(t,e){let i=document.createElement("div");
749return i.className="custom-marker",i.style.width="12px",i.style.height="12px",i.style.backgroundColor="#fab313",i.style.borderRadius="50%",i.style.border="2px solid #000",i.style.boxSizing="border-box",new ld({element:i,anchor:"center"}).setLngLat([e,t]).addTo(this.map)}highlightPath(t){console.log("=== HIGHLIGHT PATH D\xC9BUT ==="),console.log("Feature survol\xE9:",t),console.log("Feature ID:",t.properties.id),console.log("Feature geometry type:",t.geometry.type),console.log("Feature coordinates length:",t.geometry.coordinates.length);let e=this.map.getSource("hover-path");if(e){console.log("Source hover-path trouv\xE9e");let i=t.properties.id;console.log("Trace ID:",i);try{let a={type:"FeatureCollection",features:[{type:"Feature",geometry:JSON.parse(JSON.stringify(t.geometry)),properties:JSON.parse(JSON.stringify(t.properties))}]};console.log("Nouveau GeoJSON cr\xE9\xE9:",a),console.log("Nombre de features:",a.features.length),console.log("Nombre de coordonn\xE9es:",a.features[0].geometry.coordinates.length),e.setData(a),console.log("Source mise \xE0 jour avec le nouveau GeoJSON")}catch(n){console.error("Erreur lors de la cr\xE9ation du GeoJSON:",n)}}else console.log("Source hover-path non trouv\xE9e");console.log("=== HIGHLIGHT PATH FIN ===")}clearPathHighlight(){console.log("=== CLEAR PATH HIGHLIGHT D\xC9BUT ===");let t=this.map.getSource("hover-path");t?(console.log("Source hover-path trouv\xE9e, vidage de la source"),t.setData({type:"FeatureCollection",features:[]}),console.log("Source vid\xE9e")):console.log("Source hover-path non trouv\xE9e"),console.log("=== CLEAR PATH HIGHLIGHT FIN ===")}
749highlightButton(t){let e=document.querySelector(`[data-path-id="${t}"]`);e&&e.classList.add("!bg-yellow-500","!border-yellow-600")}clearButtonHighlight(){document.querySelectorAll("[data-path-id]").forEach(e=>{e.classList.remove("!bg-yellow-500","!border-yellow-600")})}showPathDetails(t){let e=document.querySelector(`[data-path-id="${t}"]`),i=document.querySelector(`[data-home-way-panel-target="wayDetails"][data-path-id="${t}"]`),n=document.querySelector('[data-home-way-panel-target="buttonsList"]');if(e&&i&&n)if(i.classList.contains("hidden"))e.click();else{this.clearSelection();let a=i.querySelector('[data-action="click->home-way-panel#closeDetails"]');a&&a.click()}}findFeatureById(t,e){let i=e.map.getSource("paths");return i?i._data.features.find(a=>a.properties.id===parseInt(t)):null}highlightPathById(t){console.log(`=== HIGHLIGHT PATH BY ID: ${t} ===`);let e=parseInt(t,10),i=this.featuresById[e];if(i){console.log("Feature trouv\xE9 dans le cache:",i.properties.name);let n={type:"Feature",geometry:JSON.parse(JSON.stringify(i.geometry)),properties:JSON.parse(JSON.stringify(i.properties))},a=this.map.getSource("hover-path");if(a){let r={type:"FeatureCollection",features:[n]};console.log("Mise \xE0 jour de la source hover-path avec le feature ID:",e),a.setData(r)}return i}else return console.log(`Aucun feature trouv\xE9 dans le cache avec l'ID: ${e}`),this.findFeatureById(e,this)}selectPathById(t){console.log(`=== SELECT PATH BY ID: ${t} ===`);let e=parseInt(t,10),i=this.featuresById[e];if(i)return console.log("Feature trouv\xE9 dans le cache pour s\xE9lection:",i.properties.name),this.selectPath(i),i;{console.log(`Aucun feature trouv\xE9 dans le cache avec l'ID: ${e} pour s\xE9lection`);let n=this.findFeatureById(e,this);return n&&this.selectPath(n),n}}};var Bv=class extends Ve{static targets=["buttonsList","pathButton","wayDetails"];connect(){this.setupButtonEvents()}setupButtonEvents(){this.pathButtonTargets.forEach(t=>{t.addEventListener("mouseenter",()=>{let e=t.dataset.pathId,i=document.querySelector('[data-controller="home-map-panel"]'),n=this.application.getControllerForElementAndIdentifier(i,"home-map-panel");if(n){let a=n.highlightPathById(e);a&&n.showTooltip(a.properties.name)}}),t.addEventListener("mouseleave",()=>{let e=document.querySelector('[data-controller="home-map-panel"]'),i=this.application.getControllerForElementAndIdentifier(e,"home-map-panel");
749i&&(i.clearPathHighlight(),i.selectedFeature?i.showTooltip(i.selectedFeature.properties.name):i.hideTooltip())})})}findFeatureById(t,e){let i=e.map.getSource("paths");return i?i._data.features.find(a=>a.properties.id===parseInt(t)):null}showDetails(t){t.preventDefault();let i=t.currentTarget.dataset.pathId;this.buttonsListTarget.classList.add("hidden"),this.wayDetailsTargets.forEach(h=>{h.classList.add("hidden")});let n=this.wayDetailsTargets.find(h=>h.dataset.pathId===i);n&&n.classList.remove("hidden");let a=document.querySelector('[data-controller="home-map-panel"]'),r=this.application.getControllerForElementAndIdentifier(a,"home-map-panel");if(r){let h=r.selectPathById(i);h&&r.showTooltip(h.properties.name)}}closeDetails(t){t&&t.preventDefault(),this.wayDetailsTargets.forEach(n=>{n.classList.add("hidden")}),this.buttonsListTarget.classList.remove("hidden");let e=document.querySelector('[data-controller="home-map-panel"]'),i=this.application.getControllerForElementAndIdentifier(e,"home-map-panel");i&&(i.clearSelection(),i.clearPathHighlight(),i.clearButtonHighlight(),i.hideTooltip())}};var Nv=class extends Ve{static values={max:{type:Number,default:512}};async process(t){let e=t.target,i=e.files&&e.files[0];if(i){try{let n=await this.resize(i);if(n){let a=new DataTransfer;a.items.add(n),e.files=a.files}}catch{}this.element.requestSubmit()}}resize(t){return new Promise(e=>{let i=new Image,n=URL.createObjectURL(t);i.onload=()=>{URL.revokeObjectURL(n);let a=Math.min(1,this.maxValue/Math.max(i.width,i.height));if(a===1)return e(null);let r=document.createElement("canvas");r.width=Math.round(i.width*a),r.height=Math.round(i.height*a),r.getContext("2d").drawImage(i,0,0,r.width,r.height),r.toBlob(h=>{if(!h)return e(null);let m=(t.name||"avatar").replace(/\.\w+$/,"")+".jpg";e(new File([h],m,{type:"image/jpeg"}))},"image/jpeg",.85)},i.onerror=()=>{URL.revokeObjectURL(n),e(null)},i.src=n})}};var Vv=class extends Ve{opened(t){t.target.open&&t.target.scrollIntoView({block:"start",behavior:"smooth"})}};var $v=class extends Ve{static targets=["modal","wrapper","content","closeButton"];static values={currentUserId:Number,bookingId:Number};connect(){console.log("MemberBookingActions controller connected")}showDetails(t){t.preventDefault();let e=t.currentTarget.dataset.bookingId;this.bookingIdValue=e,this.modalTarget.classList.remove("hidden"),this.modalTarget.classList.add("flex"),this.wrapperTarget.classList.remove("scale-95","opacity-0"),this.wrapperTarget.classList.add("scale-100","opacity-100"),fetch(`/reservations/${e}/member_booking_details`).then(i=>i.text()).then(i=>{this.contentTarget.innerHTML=i})}closeDialog(){this.wrapperTarget.classList.remove("scale-100","opacity-100"),this.wrapperTarget.classList.add("scale-95","opacity-0"),setTimeout(()=>{this.modalTarget.classList.remove("flex"),this.modalTarget.classList.add("hidden"),this.contentTarget.innerHTML=""},300)}};var Uv=class extends Ve{static targets=["menu","submenu"];connect(){document.addEventListener("click",this.clickOutside.bind(this))}disconnect(){document.removeEventListener("click",this.clickOutside.bind(this))}toggleMenu(t){t.stopPropagation(),this.menuTarget.classList.toggle("hidden")}toggleSubmenu(t){t.preventDefault(),t.stopPropagation(),t.currentTarget.nextElementSibling.classList.toggle("hidden")}navigate(t){t.stopPropagation(),this.element.querySelectorAll("li a").forEach(i=>i.classList.remove("active")),t.currentTarget.classList.add("active"),this.menuTarget.classList.add("hidden")}clickOutside(t){this.element.contains(t.target)||(this.menuTarget.classList.add("hidden"),this.submenuTargets.forEach(e=>e.classList.add("hidden")))}};var jv=class extends Ve{static targets=["modal","content"];static values={autoOpen:{type:Boolean,default:!1},scrollOpen:{type:Boolean,default:!1},scrollThreshold:{type:Number,default:300},cappingDays:{type:Number,default:0},cappingPages:{type:Number,default:0},modalId:String,openOnExit:{type:Boolean,default:!1},openOnBottom:{type:Boolean,default:!1},priority:{type:Number,default:0},queueKey:{type:String,default:"modal_queue"},usePortal:{type:Boolean,default:!1},noIndex:{type:Boolean,default:!1}};initialize(){console.log("Modal controller initialized"),this.boundHandleScroll=this.handleScroll.bind(this),this.boundHandleExit=this.handleExitIntent.bind(this),this.boundHandleBottom=this.handleBottom.bind(this),this.boundHandleKeydown=this.handleKeydown.bind(this),this.boundHandleClickOutside=this.handleClickOutside.bind(this)}connect(){if(console.log("Modal controller connected",{element:this.element,modalTarget:this.modalTarget,contentTarget:this.contentTarget,usePortal:this.usePortalValue,modalId:this.modalIdValue}),this.modal=this.element.querySelector('[data-modal-target="modal"]'),this.content=this.element.querySelector('[data-modal-target="content"]'),console.log("Elements found:",{modal:this.modal,content:this.content}),!this.modal){console.error("Modal element not found");return}this.hasModalIdValue||console.warn("Modal sans ID d\xE9tect\xE9. Un ID unique est recommand\xE9 pour le capping et la file d'attente."),this.setupEventListeners(),this.shouldShowModal()&&this.isAutoModal()&&(this.registerInQueue(),this.open()),document.addEventListener("click",this.handleExternalTrigger.bind(this))}get modalElement(){return this.element.querySelector('[data-modal-target="modal"]')}get contentElement(){return this.element.querySelector('[data-modal-target="content"]')}transitionClasses(t){return{from:(t?.dataset.enterFrom||"scale-95 opacity-0").split(" ").filter(
749Boolean),to:(t?.dataset.enterTo||"scale-100 opacity-100").split(" ").filter(Boolean)}}open(t){if(t&&(t.preventDefault(),t.stopPropagation()),!!this.modal&&this.shouldShowModal()&&(document.querySelectorAll('[data-modal-target="modal"]').forEach(e=>{e!==this.modal&&(e.classList.add("hidden"),e.setAttribute("aria-hidden","true"))}),this.usePortalValue&&this.moveToPortal(),this.modal.classList.remove("hidden"),this.modal.classList.add("opacity-100"),this.modal.setAttribute("aria-hidden","false"),document.body.style.overflow="hidden",this.content)){let e=this.transitionClasses(this.content);requestAnimationFrame(()=>{this.content.classList.remove(...e.from),this.content.classList.add(...e.to)})}}showModal(){let t=this.modalElement;if(!t){console.error("Cannot show modal: modal element not found");return}t.classList.remove("hidden"),t.classList.add("opacity-100"),t.setAttribute("aria-hidden","false"),document.body.style.overflow="hidden";let e=this.contentElement;if(e){let i=this.transitionClasses(e);requestAnimationFrame(()=>{e.classList.remove(...i.from),e.classList.add(...i.to)})}}close(){if(this.modal){if(this.content){let t=this.transitionClasses(this.content);this.content.classList.remove(...t.to),this.content.classList.add(...t.from)}setTimeout(()=>{this.modal.classList.remove("opacity-100"),this.modal.classList.add("hidden"),this.modal.setAttribute("aria-hidden","true"),document.body.style.overflow="auto",this.usePortalValue&&this.moveFromPortal()},300)}}setupEventListeners(){this.element.querySelectorAll('[data-action="click->modal#open"]').forEach(t=>{t.addEventListener("click",e=>this.open(e))}),this.element.querySelectorAll('[data-action="modal#close"]').forEach(t=>{t.addEventListener("click",()=>this.close())}),this.element.querySelectorAll('[data-action="modal#dismiss"]').forEach(t=>{t.addEventListener("click",()=>this.dismiss())}),document.addEventListener("click",this.boundHandleClickOutside),this.scrollOpenValue&&window.addEventListener("scroll",this.boundHandleScroll),this.openOnExitValue&&document.addEventListener("mouseleave",this.boundHandleExit),this.openOnBottomValue&&window.addEventListener("scroll",this.boundHandleBottom),document.addEventListener("keydown",this.boundHandleKeydown)}removeEventListeners(){document.removeEventListener("keydown",this.boundHandleKeydown),document.removeEventListener("click",this.boundHandleClickOutside),window.removeEventListener("scroll",this.boundHandleScroll),document.removeEventListener("mouseleave",this.boundHandleExit),window.removeEventListener("scroll",this.boundHandleBottom)}dismiss(){this.setModalDismissed(),this.close()}animateClose(t){let e=t.querySelector('[data-modal-target="content"]');e&&(e.classList.remove("scale-100","opacity-100"),e.classList.add("scale-95","opacity-0")),setTimeout(()=>{t.classList.remove("opacity-100"),t.classList.add("hidden"),t.setAttribute("aria-hidden","true"),document.body.style.overflow="auto"},300)}handleKeydown(t){t.key==="Escape"&&this.isOpen&&this.close()}handleClickOutside(t){this.modal&&!this.modal.contains(t.target)&&!t.target.closest('[data-action*="modal#open"]')&&!t.target.closest("[data-modal-trigger]")&&this.close()}handleScroll(){window.scrollY>this.scrollThresholdValue&&!this.isOpen&&(this.open(),window.removeEventListener("scroll",this.boundHandleScroll))}handleExitIntent(t){t.clientY<=0&&!this.isOpen&&(this.open(),document.removeEventListener("mouseleave",this.boundHandleExit))}handleExternalTrigger(t){let e=t.target.closest("[data-modal-trigger]");e&&e.dataset.modalTrigger===this.modalIdValue&&(t.preventDefault(),t.stopPropagation(),this.open())}handleBottom(){window.innerHeight+window.scrollY>=document.documentElement.scrollHeight-100&&!this.isOpen&&(this.open(),window.removeEventListener("scroll",this.boundHandleBottom))}registerInQueue(){console.log("\u{1F4DD} Tentative d'enregistrement dans la file d'attente",{modalId:this.modalIdValue,priority:this.priorityValue,queueKey:this.queueKeyValue});let t=this.getQueue();return console.log("\u{1F4CB} File d'attente actuelle:",t),t.some(e=>e.id===this.modalIdValue)?(console.log("\u26A0\uFE0F La modale est d\xE9j\xE0 dans la file d'attente"),!0):(t.push({id:this.modalIdValue,priority:this.priorityValue}),t.sort((e,i)=>i.priority-e.priority),this.saveQueue(t),console.log("\u2705 Modale enregistr\xE9e dans la file d'attente"),console.log("\u{1F4CB} Nouvelle file d'attente:",this.getQueue()),!0)}removeFromQueue(){let t=this.getQueue();localStorage.setItem(this.queueKeyValue,JSON.stringify(t.filter(e=>e.id!==this.modalIdValue)))}showNextInQueue(){let t=this.getQueue(),e=t[0]&&document.querySelector(`[data-modal-modal-id-value="${t[0].id}"]`);e&&this.application.getControllerForElementAndIdentifier(e,"modal")?.showModal()}shouldShowModal(){if(!this.hasModalIdValue)return!0;let t=this.getDismissedData();if(!t)return!0;let{dismissedUntil:e,pagesVisited:i,maxPages:n}=t,a=Date.now()>parseInt(e);return this.cappingPagesValue>0?a||i>=n:a}setModalDismissed(){if(!this.hasModalIdValue)return;let t=new Date;t.setDate(t.getDate()+this.cappingDaysValue);let e={dismissedUntil:t.getTime().toString(),pagesVisited:0,maxPages:this.cappingPagesValue};localStorage.setItem(`modal_${this.modalIdValue}_dismissed_data`,JSON.stringify(e))}getQueue(){return JSON.parse(localStorage.getItem(this.queueKeyValue)||"[]")}get isOpen(){return!this.modalElement.classList.contains("hidden")}isAnyModalOpen(){return document.querySelector('.modal[aria-hidden="false"]')!==null}isAutoModal(){return this.autoOpenValue||this.scrollOpenValue||this.openOnExitValue||this.openOnBottomValue}closeAllModals(){document.querySelectorAll('.modal[aria-hidden="false"]').forEach(t=>{let e=this.application.getControllerForElementAndIdentifier(t,"modal");e&&e!==this&&e.close()})}incrementPageVisit(){if(!this.hasModalIdValue)return;let t=this.getDismissedData();t?.pagesVisited<t?.maxPages&&(t.pagesVisited+=1,localStorage.setItem(`modal_${this.modalIdValue}_dismissed_data`,JSON.stringify(t)))}getDismissedData(){let t=localStorage.getItem(`modal_${this.modalIdValue}_dismissed_data`);return t?JSON.parse(t):null}cleanQueue(){let e=this.getQueue().filter(i=>i.timestamp&&Date.now()-i.timestamp>864e5?!1:i.id.startsWith("roadbook-")||!i.id.includes("-"));this.saveQueue(e),console.log("\u{1F9F9} File d'attente nettoy\xE9e:",e)}saveQueue(t){localStorage.setItem(this.queueKeyValue,JSON.stringify(t))}moveToPortal(){if(!document.getElementById("modal-portal")){let e=document.createElement("div");e.id="modal-portal",e.style.cssText="position: fixed; top: 0; left: 0; width: 100%; z-index: 9999;",document.body.appendChild(e)}let t=document.getElementById("modal-portal");this.modal&&t&&(this.originalParent=this.modal.parentNode,this.originalNextSibling=this.modal.nextSibling,t.appendChild(this.modal))}moveFromPortal(){this.modal&&this.originalParent&&(this.originalNextSibling?this.originalParent.insertBefore(this.modal,this.originalNextSibling):this.originalParent.appendChild(this.modal))}disconnect(){this.removeEventListeners(),this.incrementPageVisit(),document.removeEventListener("click",this.handleExternalTrigger.bind(this)),this.usePortalValue&&this.moveFromPortal()}};var qv=class extends Ve{static targets=["nav","trigger","menu","mobileMenu","userMenu","mobileSubmenu","menuIcon","closeIcon"];static values={threshold:{type:Number,default:100}};connect(){this.closeDropdowns(),document.addEventListener("click",this.clickOutside.bind(this)),this.lastScrollTop=0,this.bindScrollEvent=this.handleScroll.bind(this),window.addEventListener("scroll",this.bindScrollEvent),this.navTarget.classList.add("transition-transform","duration-300")}disconnect(){document.removeEventListener("click",this.clickOutside.bind(this)),window.removeEventListener("scroll",this.bindScrollEvent),this.enableScroll()}handleScroll(){let t=window.scrollY||document.documentElement.scrollTop;t>this.lastScrollTop&&t>this.thresholdValue?this.hideNavbar():t<this.lastScrollTop&&this.showNavbar(),this.lastScrollTop=t<=0?0:t}hideNavbar(){this.navTarget.style.transform="translateY(-100%)"}showNavbar(){this.navTarget.style.transform="translateY(0)"}toggle(t){t.preventDefault();let e=t.currentTarget.nextElementSibling;
749this.menuTargets.forEach(i=>{i!==e&&i.classList.add("hidden")}),e.classList.toggle("hidden"),this.hasUserMenuTarget&&this.userMenuTarget.classList.add("hidden")}toggleMobile(){this.mobileMenuTarget.classList.toggle("hidden"),this.menuIconTarget.classList.toggle("hidden"),this.closeIconTarget.classList.toggle("hidden"),this.mobileMenuTarget.classList.contains("hidden")?this.enableScroll():this.disableScroll()}disableScroll(){document.body.style.overflow="hidden",document.body.style.height="100vh"}enableScroll(){document.body.style.overflow="",document.body.style.height=""}toggleMobileSubmenu(t){t.currentTarget.nextElementSibling.classList.toggle("hidden")}toggleUser(t){t.preventDefault(),this.userMenuTarget.classList.toggle("hidden"),this.menuTargets.forEach(e=>{e.classList.add("hidden")})}closeDropdowns(){this.menuTargets.forEach(t=>t.classList.add("hidden")),this.hasUserMenuTarget&&this.userMenuTarget.classList.add("hidden"),this.mobileSubmenuTargets.forEach(t=>t.classList.add("hidden"))}clickOutside(t){this.element.contains(t.target)||this.closeDropdowns()}};var Hv=class extends Ve{static targets=["lines","template"];add(t){t.preventDefault();let e=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,Date.now().toString());this.linesTarget.insertAdjacentHTML("beforeend",e)}remove(t){t.preventDefault();let e=t.target.closest(".js-nested-row");if(!e)return;let i=e.querySelector("input[name*='_destroy']");i?(i.value="1",e.classList.add("hidden")):e.remove()}};var Wv=class extends Ve{static targets=["list","template"];add(t){let e=this.templateTargets.find(i=>i.dataset.blockType===t.params.type);e&&this.append(e)}append(t){this.listTarget.appendChild(t.content.firstElementChild.cloneNode(!0))}remove(t){t.target.closest("[data-block]").remove()}moveUp(t){let e=t.target.closest("[data-block]"),i=e.previousElementSibling;i&&this.listTarget.insertBefore(e,i)}moveDown(t){let e=t.target.closest("[data-block]"),i=e.nextElementSibling;i&&this.listTarget.insertBefore(i,e)}insertCta(t){let e=t.target;e.value&&(this.insertAtCursor(e.closest("[data-block]").querySelector("textarea"),`{{cta:${e.value}}}`),e.value="")}insertSubtitle(t){this.insertAtCursor(t.target.closest("[data-block]").querySelector("textarea"),"<h2>Sous-titre</h2>")}insertFirstName(t){this.insertAtCursor(t.target.closest("[data-block]").querySelector("textarea"),"{{first_name}}")}async uploadImage(t){let e=t.target,i=e.files[0];if(!i)return;let n=new FormData;n.append("image",i);let a=document.querySelector('meta[name="csrf-token"]')?.content,r=await fetch(e.dataset.url,{method:"POST",body:n,headers:{"X-CSRF-Token":a}});if(!r.ok){e.value="";return}let{url:h}=await r.json();this.insertAtCursor(e.closest("[data-block]").querySelector("textarea"),`<img src="${h}" style="display:block; margin:0 auto; max-width:100%; height:auto;">`),e.value=""}insertAtCursor(t,e){let i=t.selectionStart??t.value.length,n=t.selectionEnd??i;t.value=t.value.slice(0,i)+e+t.value.slice(n),t.focus(),t.selectionStart=t.selectionEnd=i+e.length}};var Gv=class extends Ve{static values={url:String,target:{type:String,default:"_self"},text:String};connect(){this.hasTextValue&&(this.element.textContent=atob(this.textValue))}handleClick(){let t=atob(this.urlValue);this.targetValue==="_self"?window.location.href=t:window.open(t,this.targetValue,"noopener,noreferrer")}};var Zv=class extends Ve{static values={poiId:Number};static targets=["buttons"];async connect(){let t=window.OfflineBridge;if(t?.downloadedWays)try{let e=JSON.parse(t.downloadedWays()||"[]");for(let i of e){let n=await fetch(`/app/offline/ways/${i.wayId}/contacts.json`);if(!n.ok)continue;let{contacts:a}=await n.json(),r=a?.[this.poiIdValue];if(r)return this.render(r)}}catch{}}render({phone:t,mobile:e,whatsapp:i}){let n=t||e;if(!n)return;let a=[];a.push(this.link(`tel:${n}`,`Appeler ${n}`,"bg-yellow text-blue")),a.push(this.link(`sms:${n}`,"Envoyer un SMS","border border-blue text-blue")),i&&a.push(this.link(`https://wa.me/${i.replace(/\D/g,"")}`,"WhatsApp","border border-blue text-blue")),this.buttonsTarget.innerHTML=a.join(""),this.element.hidden=!1}link(t,e,i){return`<a href="${t}" class="block w-full rounded-lg ${i} px-4 py-2.5 text-center text-sm font-bold">${this.escape(e)}</a>`}escape(t){return t.replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}};var Kv=class extends Ve{static targets=["deviceId","state","reset"];connect(){let t=window.OfflineBridge?.deviceId?.();
749t&&(this.deviceIdTargets.forEach(e=>e.value=t),this.refreshStatus(t))}async refreshStatus(t){try{let e=await fetch(`/app/offline/device?device_id=${encodeURIComponent(t)}`,{headers:{Accept:"application/json"}});if(!e.ok)return;let i=await e.json();this.hasStateTarget&&(this.stateTarget.textContent=this.label(i.state)),this.hasResetTarget&&(this.resetTarget.hidden=i.state!=="other_device")}catch{}}label(t){return{other_device:"Un autre t\xE9l\xE9phone est d\xE9j\xE0 associ\xE9 \u2014 r\xE9initialise pour utiliser celui-ci.",no_subscription:"Le hors-ligne est r\xE9serv\xE9 aux supporters."}[t]||""}};var Xv=()=>window.OfflineBridge;function qa(){let t=Xv();try{if(t&&typeof t.isOnline=="function")return t.isOnline()}catch{}return navigator.onLine}function N4(){return!!Xv()?.download}function Yv(t){let e=Xv();if(!e?.downloadState)return{status:"idle",progress:0};try{return JSON.parse(e.downloadState(t))}catch{return{status:"idle",progress:0}}}function V4(t){return Yv(t).status==="done"}function $4(t){let e=Xv();try{return e?.downloadedVersion?e.downloadedVersion(t):""}catch{return""}}function U4(t,e){return V4(t)&&!!e&&$4(t)!==e}function Jv(t,e){if(!N4())return"app-only";let{status:i}=Yv(t);return i==="downloading"||i==="capturing"?"downloading":i==="error"?"error":i==="done"?qa()&&U4(t,e)?"update":"open":qa()?"download":"unavailable"}function Qv(t){if(!t?.length)return null;let e=new Date,i=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`;return(t.find(a=>a.date===i)||t.find(a=>a.date<=i&&i<a.departure))?.url||null}var j4={"app-only":"Disponible dans l'app",downloading:"T\xE9l\xE9chargement\u2026",error:"R\xE9essayer",update:"Mettre \xE0 jour",open:"Ouvrir la carte",download:"T\xE9l\xE9charger cette voie",unavailable:"Indisponible hors ligne"},eb=class extends Ve{static values={wayId:Number,manifestUrl:String,mapUrl:String,version:String,stages:Array};static targets=["button","spinner"];connect(){this.reflect(),this.state==="open"&&this.openMap({replace:!0})}disconnect(){clearInterval(this.timer)}reflect(){this.state=Jv(this.wayIdValue,this.versionValue),this.setLabel(j4[this.state]);let t=this.state==="unavailable"||this.state==="app-only",e=this.element.querySelector("button");e&&(e.disabled=t,e.classList.toggle("opacity-60",t)),this.state==="downloading"&&this.poll()}start(){if(this.state==="open")return this.openMap();if(this.state==="download"||this.state==="update"||this.state==="error")return this.download()}async download(){let t=window.OfflineBridge,e=t.deviceId();this.showSpinner(!0),this.setLabel("Pr\xE9paration\u2026");let i=await this.post("/app/offline/device/bind",{device_id:e});if(i?.result==="other_device")return this.finish("Autre t\xE9l\xE9phone associ\xE9");if(i?.state==="no_subscription")return this.finish("R\xE9serv\xE9 aux supporters");let n=new URL(this.manifestUrlValue,window.location.origin);n.searchParams.set("device_id",e);let a=await fetch(n,{headers:{Accept:"application/json"}});if(!a.ok)return this.finish("Erreur");let r=await a.json(),h=(r.pages||[]).map(T=>new URL(T,window.location.origin).href),m=r.data_pack_url?new URL(r.data_pack_url,window.location.origin).href:"",b=r.photos_pack_url?new URL(r.photos_pack_url,window.location.origin).href:"";t.download(this.wayIdValue,r.core.pmtiles_url,m,b,JSON.stringify(h),r.tiles_version||"",r.data_version||"",r.photos_version||""),this.poll()}poll(){clearInterval(this.timer),this.timer=setInterval(()=>{let t=Yv(this.wayIdValue);t.status==="downloading"?this.setLabel(`${t.progress} %`):t.status==="capturing"?this.setLabel(`Pages\u2026 ${t.progress} %`):t.status==="done"?(clearInterval(this.timer),this.showSpinner(!1),this.reflect()):t.status==="error"&&this.finish("\xC9chec")},500)}openMap({replace:t=!1}={}){if(!this.hasMapUrlValue)return;let e=Qv(this.stagesValue)||this.mapUrlValue;window.Turbo?window.Turbo.visit(e,t?{action:"replace"}:{}):window.location.href=e}finish(t){this.setLabel(t),this.showSpinner(!1),clearInterval(this.timer)}showSpinner(t){this.hasSpinnerTarget&&(this.spinnerTarget.hidden=!t)}setLabel(t){this.hasButtonTarget&&(this.buttonTarget.textContent=t)}async post(t,e){try{let i=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-Token":this.csrf},body:JSON.stringify(e)});return i.ok?await i.json():null}catch{return null}}get csrf(){return document.querySelector('meta[name="csrf-token"]')?.content||""}};var tb=class extends Ve{static values={names:Object};static targets=["list","empty"];connect(){let t=window.OfflineBridge;if(!t||!t.downloadedWays){this.element.hidden=!0;return}let e=[];try{e=JSON.parse(t.downloadedWays())}catch{e=[]}this.render(e)}render(t){this.listTarget.innerHTML="",this.emptyTarget.hidden=t.length>
7490,t.forEach(e=>this.listTarget.appendChild(this.rowFor(e.wayId)))}rowFor(t){let e=document.createElement("li");e.className="flex items-center justify-between py-2.5",e.dataset.wayId=t;let i=document.createElement("span");i.className="text-blue",i.textContent=this.namesValue[t]||`Voie ${t}`;let n=document.createElement("button");return n.type="button",n.className="text-sm font-medium text-red-600",n.textContent="Supprimer",n.dataset.action="offline-downloads#delete",n.dataset.wayId=t,e.append(i,n),e}delete(t){let e=Number(t.currentTarget.dataset.wayId);window.confirm("Supprimer le t\xE9l\xE9chargement de cette voie ?")&&(window.OfflineBridge?.delete?.(e),t.currentTarget.closest("[data-way-id]")?.remove(),this.emptyTarget.hidden=this.listTarget.children.length>0)}};var ib=class extends Ve{connect(){this.update=this.update.bind(this),this.element.removeAttribute("hidden"),window.addEventListener("online",this.update),window.addEventListener("offline",this.update),this.update()}disconnect(){window.removeEventListener("online",this.update),window.removeEventListener("offline",this.update)}update(){this.element.style.display=qa()?"none":""}};var nb=class extends Ve{connect(){this.update=this.update.bind(this),window.addEventListener("online",this.update),window.addEventListener("offline",this.update),this.update()}disconnect(){window.removeEventListener("online",this.update),window.removeEventListener("offline",this.update)}update(){this.element.style.display=qa()?"":"none"}};var rb=class extends Ve{static targets=["departmentCheckbox","typeCheckbox","fileCheckbox","distance","fetchButton","fetchProgress","fetchResults","filterButton","filterProgress","filterResults","departmentCheckAll","typeCheckAll","fileCheckAll"];connect(){this.fetchPollInterval=null,this.filterPollInterval=null}disconnect(){this.stopPolling()}toggleDepartments(t){let e=t.target.checked;this.departmentCheckboxTargets.forEach(i=>i.checked=e)}toggleTypes(t){let e=t.target.checked;this.typeCheckboxTargets.forEach(i=>i.checked=e)}toggleFiles(t){let e=t.target.checked;this.fileCheckboxTargets.forEach(i=>i.checked=e)}async fetchFromOverpass(t){t.preventDefault();let e=this.getCheckedValues(this.departmentCheckboxTargets),i=this.getCheckedValues(this.typeCheckboxTargets);if(e.length===0||i.length===0){alert("S\xE9lectionnez au moins un d\xE9partement et un type de POI");return}this.fetchButtonTarget.disabled=!0,this.fetchProgressTarget.classList.remove("hidden"),this.fetchResultsTarget.innerHTML="";try{let a=await(await fetch("/admin2/datas/pois_overpass/fetch_from_overpass",{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":this.getCSRFToken()},body:JSON.stringify({departments:e,poi_types:i})})).json();a.success&&a.job_id?this.startFetchPolling(a.job_id):(this.displayError(this.fetchResultsTarget,a.error),this.fetchButtonTarget.disabled=!1,this.fetchProgressTarget.classList.add("hidden"))}catch(n){this.displayError(this.fetchResultsTarget,n.message),this.fetchButtonTarget.disabled=!1,this.fetchProgressTarget.classList.add("hidden")}}startFetchPolling(t){let e=0,i=5;this.fetchPollInterval=setInterval(async()=>{try{let n=await fetch(`/admin2/datas/pois_overpass/fetch_status?job_id=${t}`,{headers:{"X-CSRF-Token":this.getCSRFToken()}}),a=await n.json();a.success&&a.status?(e=0,this.updateFetchProgress(a.status),(a.status.status==="completed"||a.status.status==="failed")&&(clearInterval(this.fetchPollInterval),this.fetchButtonTarget.disabled=!1,this.fetchProgressTarget.classList.add("hidden"),a.status.status==="completed"?(this.displayFetchResults(a.status.results),setTimeout(()=>window.location.reload(),2e3)):this.displayError(this.fetchResultsTarget,a.status.error))):n.status===404&&(e++,e>i&&(clearInterval(this.fetchPollInterval),this.fetchButtonTarget.disabled=!1,this.fetchProgressTarget.classList.add("hidden"),this.displayError(this.fetchResultsTarget,"Le job n'a pas d\xE9marr\xE9. V\xE9rifiez que Sidekiq est en cours d'ex\xE9cution.")))}catch(n){console.error("Erreur polling:",n)}},2e3)}updateFetchProgress(t){if(t.status==="queued")this.fetchProgressTarget.innerHTML=`
750        <div class="bg-blue-100 border-l-4 border-blue-500 text-blue-700 p-4" role="alert">
751          <p class="font-bold">\u23F3 En attente du d\xE9marrage...</p>
752          <p class="text-sm mt-1">Le job va d\xE9marrer dans quelques instants.</p>
753        </div>
754      `;else{let e=(t.current_step/t.total_steps*100).toFixed(0);this.fetchProgressTarget.innerHTML=`
755        <div class="bg-blue-100 border-l-4 border-blue-500 text-blue-700 p-4" role="alert">
756          <p class="font-bold">T\xE9l\xE9chargement en cours... ${e}%</p>
757          <div class="w-full bg-blue-200 rounded-full h-2.5 mt-2">
758            <div class="bg-blue-600 h-2.5 rounded-full" style="width: ${e}%"></div>
759          </div>
760          <p class="text-sm mt-1">${t.current_step} / ${t.total_steps} \xE9tapes</p>
761        </div>
762      `}}async filterLocally(t){t.preventDefault();let e=this.getCheckedValues(this.fileCheckboxTargets),i=this.distanceTarget.value;if(e.length===0){alert("S\xE9lectionnez au moins un fichier");return}this.filterButtonTarget.disabled=!0,this.filterProgressTarget.classList.remove("hidden"),this.filterResultsTarget.innerHTML="";try{let a=await(await fetch("/admin2/datas/pois_overpass/filter_locally",{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":this.getCSRFToken()},body:JSON.stringify({files:e,distance:i})})).json();a.success&&a.job_id?this.startFilterPolling(a.job_id):(this.displayError(this.filterResultsTarget,a.error),this.filterButtonTarget.disabled=!1,this.filterProgressTarget.classList.add("hidden"))}catch(n){this.displayError(this.filterResultsTarget,n.message),this.filterButtonTarget.disabled=!1,this.filterProgressTarget.classList.add("hidden")}}startFilterPolling(t){let e=0,i=5;this.filterPollInterval=setInterval(async()=>{try{let n=await fetch(`/admin2/datas/pois_overpass/filter_status?job_id=${t}`,{headers:{"X-CSRF-Token":this.getCSRFToken()}}),a=await n.json();a.success&&a.status?(e=0,this.updateFilterProgress(a.status),(a.status.status==="completed"||a.status.status==="failed")&&(clearInterval(this.filterPollInterval),this.filterButtonTarget.disabled=!1,this.filterProgressTarget.classList.add("hidden"),a.status.status==="completed"?(this.displayFilterResults(a.status.results),setTimeout(()=>window.location.reload(),2e3)):this.displayError(this.filterResultsTarget,a.status.error))):n.status===404&&(e++,e>i&&(clearInterval(this.filterPollInterval),this.filterButtonTarget.disabled=!1,this.filterProgressTarget.classList.add("hidden"),this.displayError(this.filterResultsTarget,"Le job n'a pas d\xE9marr\xE9. V\xE9rifiez que Sidekiq est en cours d'ex\xE9cution.")))}catch(n){console.error("Erreur polling:",n)}},2e3)}updateFilterProgress(t){if(t.status==="queued")this.filterProgressTarget.innerHTML=`
763        <div class="bg-green-100 border-l-4 border-green-500 text-green-700 p-4" role="alert">
764          <p class="font-bold">\u23F3 En attente du d\xE9marrage...</p>
765          <p class="text-sm mt-1">Le job va d\xE9marrer dans quelques instants.</p>
766        </div>
767      `;else{let e=(t.current_step/t.total_steps*100).toFixed(0);this.filterProgressTarget.innerHTML=`
768        <div class="bg-green-100 border-l-4 border-green-500 text-green-700 p-4" role="alert">
769          <p class="font-bold">Filtrage en cours... ${e}%</p>
770          <div class="w-full bg-green-200 rounded-full h-2.5 mt-2">
771            <div class="bg-green-600 h-2.5 rounded-full" style="width: ${e}%"></div>
772          </div>
773          <p class="text-sm mt-1">${t.current_step} / ${t.total_steps} fichiers</p>
774        </div>
775      `}}stopPolling(){this.fetchPollInterval&&clearInterval(this.fetchPollInterval),this.filterPollInterval&&clearInterval(this.filterPollInterval)}displayFetchResults(t){let e=t.filter(a=>!a.error),i=t.filter(a=>a.error),n='<div class="space-y-2">';e.length>0&&(n+='<div class="bg-green-50 border border-green-200 rounded p-3">',n+='<h4 class="font-bold text-green-800 mb-2">\u2705 T\xE9l\xE9chargements r\xE9ussis :</h4>',n+='<ul class="text-sm space-y-1">',e.forEach(a=>{n+=`<li>\u2022 ${a.department} - ${a.type} : <strong>${a.count} POIs</strong> \u2192 ${a.file}</li>`}),n+="</ul></div>"),i.length>0&&(n+='<div class="bg-red-50 border border-red-200 rounded p-3">
775',n+='<h4 class="font-bold text-red-800 mb-2">\u274C Erreurs :</h4>',n+='<ul class="text-sm space-y-1">',i.forEach(a=>{n+=`<li>\u2022 ${a.department} - ${a.type} : ${a.error}</li>`}),n+="</ul></div>"),n+="</div>",this.fetchResultsTarget.innerHTML=n}displayFilterResults(t){let e=t.filter(h=>h.success),i=e.reduce((h,m)=>h+m.total,0),n=e.reduce((h,m)=>h+m.filtered,0),a=i>0?(n/i*100).toFixed(1):0,r='<div class="bg-green-50 border border-green-200 rounded p-3">';r+='<h4 class="font-bold text-green-800 mb-2">\u2705 Filtrage termin\xE9 :</h4>',r+=`<p class="mb-2"><strong>${n}</strong> POIs conserv\xE9s sur <strong>${i}</strong> (${a}%)</p>`,r+='<ul class="text-sm space-y-1">',e.forEach(h=>{let m=h.total>0?(h.filtered/h.total*100).toFixed(1):0;r+=`<li>\u2022 ${h.type} : ${h.filtered} / ${h.total} (${m}%) \u2192 ${h.output}</li>`}),r+="</ul>",r+='<p class="mt-3 text-sm text-green-700">La page va se recharger pour afficher les nouveaux fichiers...</p>',r+="</div>",this.filterResultsTarget.innerHTML=r}displayError(t,e){t.innerHTML=`
776      <div class="bg-red-50 border border-red-200 rounded p-3">
777        <h4 class="font-bold text-red-800">\u274C Erreur :</h4>
778        <p class="text-sm text-red-700">${e}</p>
779      </div>
780    `}getCheckedValues(t){return t.filter(e=>e.checked).map(e=>e.value)}getCSRFToken(){return document.querySelector('meta[name="csrf-token"]').content}};var sb=class extends Ve{connect(){this.element.parentElement!==document.body&&document.body.appendChild(this.element)}};var ob=class extends Ve{static targets=["question","profiles","plannerProfile","adventurerProfile"];connect(){this.profilesTarget.classList.add("hidden"),this.plannerProfileTarget.classList.add("hidden"),this.adventurerProfileTarget.classList.add("hidden")}showProfile(t){let e=t.currentTarget.dataset.profileType;this.questionTarget.classList.add("opacity-0"),setTimeout(()=>{this.questionTarget.classList.add("hidden"),this.profilesTarget.classList.remove("hidden"),e==="planner"?(this.plannerProfileTarget.classList.remove("hidden"),this.adventurerProfileTarget.classList.add("hidden")):(this.adventurerProfileTarget.classList.remove("hidden"),this.plannerProfileTarget.classList.add("hidden")),requestAnimationFrame(()=>{this.profilesTarget.classList.remove("opacity-0")})},300)}reset(){this.profilesTarget.classList.add("opacity-0"),setTimeout(()=>{this.profilesTarget.classList.add("hidden"),this.plannerProfileTarget.classList.add("hidden"),this.adventurerProfileTarget.classList.add("hidden"),this.questionTarget.classList.remove("hidden"),requestAnimationFrame(()=>{this.questionTarget.classList.remove("opacity-0")})},300)}};var jE=n0(rw()),ab=class extends Ve{static values={throttleDelay:Number};initialize(){this.scroll=this.scroll.bind(this)}connect(){let t=this.throttleDelayValue||15;t>0&&(this.scroll=(0,jE.throttle)(this.scroll,t)),window.addEventListener("scroll",this.scroll,{passive:!0}),this.scroll()}disconnect(){window.removeEventListener("scroll",this.scroll)}scroll(){let t=document.documentElement.scrollHeight-document.documentElement.clientHeight,e=window.scrollY/t*100;this.element.style.width=`${e}%`}};var lb=class extends Ve{connect(){let t=window.OfflineBridge,e=t?.pushToken?.(),i=t?.deviceId?.();!e||!i||fetch("/app/push/register",{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]')?.content||""},body:JSON.stringify({device_id:i,push_token:e,platform:"android"})}).catch(()=>{})}};var cb=class extends Ve{static targets=["min","max","fill","minLabel","maxLabel"];connect(){this.sync()}sync(t){let e=+this.minTarget.value,i=+this.maxTarget.value;e>i&&(t?.target===this.minTarget?(e=i,this.minTarget.value=e):(i=e,this.maxTarget.value=i)),this.minLabelTarget.textContent=e,this.maxLabelTarget.textContent=i;let n=+this.maxTarget.max||1;this.fillTarget.style.left=`${e/n*100}%`,this.fillTarget.style.right=`${100-i/n*100}%`}trackDown(t){if(t.target instanceof HTMLInputElement)return;let e=t.currentTarget.getBoundingClientRect(),i=Math.min(1,Math.max(0,(t.clientX-e.left)/e.width)),n=Math.round(i*(+this.maxTarget.max||1)),a=Math.abs(n-+this.minTarget.value)<=Math.abs(n-+this.maxTarget.value)?this.minTarget:this.maxTarget;a.value=n,this.sync()}};var ub=class extends Ve{static targets=["button","number"];toggleNumber(t){t.preventDefault(),this.buttonTarget.classList.add("hidden"),this.numberTarget.classList.remove("hidden")}};var hb=class extends Ve{static values={mascot:String,place:String,defer:Boolean,firstNight:Boolean,askLevel:Boolean,askDate:Boolean,settingsUrl:String,config:Object,state:Object};connect(){this.state=this.hasStateValue?{...this.stateValue}:{},this.deferValue?(this._deferred=()=>this.#e(),document.addEventListener("dismissable:dismissed",this._deferred,{once:!0})):this.#e()}disconnect(){this._deferred&&document.removeEventListener("dismissable:dismissed",this._deferred),this.bubble?.remove(),this.closeMoteur()}#e(){if(this.askLevelValue)return this.#i("ask_niveau");
780if(this.askDateValue)return this.#i("ask_date");this.#i(this.firstNightValue?"ask_place":"ask_km")}#i(t){let e=this.configValue[t];if(!e)return this.#t();if(this.state.off)return this.#t();let i=Number(this.state[t]||0);if(i>=(e.max||1))return this.#t();this.bubble||(this.bubble=document.createElement("div"),this.bubble.className="fixed inset-x-0 bottom-24 z-[9999] flex justify-center px-4",document.body.appendChild(this.bubble));let n=e.choices||(e.button?[e.button]:[]);this.bubble.innerHTML=this.#s(this.#r(e.text),n,e.input),e.onShow&&this[e.onShow]?.(),this.state[t]=i+1,this.#o({[t]:this.state[t]}),this.bubble.querySelectorAll("[data-to]").forEach((a,r)=>{let h=n[r];a.addEventListener("click",()=>{h.do&&this[h.do]?.(h),h.to?this.#i(h.to):this.#t()})}),this.bubble.querySelector("[data-guidance-off]")?.addEventListener("click",()=>{this.state.off=!0,this.#o({off:!0}),this.#t()})}#t(){this.bubble?.remove(),this.bubble=null,this.closeMoteur()}#r(t){let e=this.placeValue||"ton point de d\xE9part",i=document.querySelector('[data-carte-target="kmMin"]')?.value??"?",n=document.querySelector('[data-carte-target="kmMax"]')?.value??"?";return String(t).replaceAll("{place}",e).replaceAll("{min}",i).replaceAll("{max}",n)}#s(t,e,i){let n=e.map((r,h)=>`<button type="button" data-to class="${h===0?"flex-1 rounded-full bg-secondary px-4 py-2.5 font-bold text-primary":"flex-1 rounded-full border border-white/40 px-4 py-2.5 font-semibold text-white"}">${this.#c(r.label)}</button>`).join(""),a=i==="date"?'<input type="date" data-guidance-date class="mt-3 w-full rounded-lg border-0 px-3 py-2 text-sm font-semibold text-blue">':"";return`<div class="w-full max-w-sm rounded-2xl bg-blue p-3 shadow-2xl ring-1 ring-white/15">
781      <div class="flex items-center gap-2">
782        <div class="size-14 shrink-0 overflow-hidden"><img src="${this.mascotValue}" alt="" aria-hidden="true" class="h-full w-full object-contain object-left drop-shadow"></div>
783        <p class="text-sm font-semibold text-white">${this.#c(t)}</p>
784      </div>
785      ${a}
786      <div class="mt-3 flex gap-2">${n}</div>
787      <button type="button" data-guidance-off class="mt-2 w-full text-center text-xs text-white/50 underline">C'est bon, ne plus m'accompagner</button>
788    </div>`}#o(t){if(!this.hasSettingsUrlValue)return;let e=Object.entries(t).map(([i,n])=>`guidance[${encodeURIComponent(i)}]=${encodeURIComponent(n)}`).join("&");fetch(this.settingsUrlValue,{method:"PATCH",headers:{"Content-Type":"application/x-www-form-urlencoded","X-CSRF-Token":this.#n()},body:e}).catch(()=>{})}setStayNight(){this.hasSettingsUrlValue&&fetch(this.settingsUrlValue,{method:"PATCH",headers:{"Content-Type":"application/x-www-form-urlencoded","X-CSRF-Token":this.#n()},body:"course[stay_night_before]=true"}).catch(()=>{})}setLevel(t){let e=document.querySelector('[data-carte-target="kmMin"]'),i=document.querySelector('[data-carte-target="kmMax"]');if(e&&i&&(e.value=t.min,i.value=t.max,e.dispatchEvent(new Event("input",{bubbles:!0}))),!this.hasSettingsUrlValue)return;let n=`course[level]=${encodeURIComponent(t.level)}&course[km_day_min]=${encodeURIComponent(t.min)}&course[km_day_max]=${encodeURIComponent(t.max)}`;fetch(this.settingsUrlValue,{method:"PATCH",headers:{"Content-Type":"application/x-www-form-urlencoded","X-CSRF-Token":this.#n()},body:n}).catch(()=>{})}setDate(){let t=this.bubble?.querySelector("[data-guidance-date]")?.value;if(!t||!this.hasSettingsUrlValue)return;let e=document.createElement("form");e.method="post",e.action=this.settingsUrlValue,e.hidden=!0,e.setAttribute("data-turbo-frame","poi_fiche"),e.innerHTML=`<input type="hidden" name="_method" value="patch"><input type="hidden" name="authenticity_token" value="${this.#n()}"><input type="hidden" name="course[starting_date_course]" value="${t}">`,document.body.appendChild(e),e.requestSubmit()}openMoteur(){this.moteur=document.querySelector("[data-carte-moteur]"),this.moteur&&(this.moteur.open=!0,this.#a(this.moteur))}closeMoteur(){this.moteur&&(this.moteur.open=!1),this.#l()}focusList(){let t=document.querySelector("[data-carte-target='sheet']");t&&(t.scrollIntoView({behavior:"smooth",block:"end"}),t.classList.add("ring-2","ring-secondary","transition"),setTimeout(()=>t.classList.remove("ring-2","ring-secondary","transition"),1600))}#a(t){this.#l();let e=t.getBoundingClientRect(),i=document.createElement("div");i.className="fixed inset-0 z-[9998] pointer-events-none",i.innerHTML=`<div class="absolute rounded-2xl" style="box-shadow:0 0 0 9999px rgba(0,0,0,.45); top:${e.top-8}px; left:${e.left-8}px; width:${e.width+16}px; height:${e.height+16}px"></div>`,document.body.appendChild(i),this.spot=i}#l(){this.spot?.remove(),this.spot=null}#n(){return document.querySelector('meta[name="csrf-token"]')?.content||""}#c(t){return String(t??"").replace(/[&<>"]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[e])}};var db=class extends Ve{static values={manageUrl:String};connect(){requestAnimationFrame(()=>{this.element.querySelector("[data-open]")?.scrollIntoView({block:"start",behavior:"auto"}),this.element.querySelector("[data-added]")?.animate([{boxShadow:"0 0 0 0 rgba(34,197,94,.55)"},{boxShadow:"0 0 0 10px rgba(34,197,94,0)"}],{duration:750,easing:"ease-out"})})}pick(t){t.preventDefault();let e=t.currentTarget;if(e.dataset.picking)return;e.dataset.picking="1";let{url:i,stage:n}=t.params;if(!i)return;let a=e.closest("[data-poi-id]")||e;a.style.willChange="transform, opacity",a.animate([{transform:"translateY(0)",opacity:1}
788,{transform:"translateY(-24px)",opacity:0}],{duration:320,easing:"ease-in",fill:"forwards"}),setTimeout(()=>this.#e(i,n),300)}#e(t,e){let i=document.createElement("form");i.method="post",i.action=t,i.hidden=!0,i.setAttribute("data-turbo-frame","poi_fiche");let n=document.querySelector('meta[name="csrf-token"]')?.content||"";i.innerHTML=`<input type="hidden" name="authenticity_token" value="${n}"><input type="hidden" name="stage" value="${e}">`,i.addEventListener("turbo:submit-end",()=>i.remove(),{once:!0}),document.body.appendChild(i),i.requestSubmit()}manage(t){if(t.preventDefault(),!this.manageUrlValue)return;let e=this.element.querySelector("[data-open]")?.dataset.stage,i=e?`${this.manageUrlValue}?etape=${encodeURIComponent(e)}`:this.manageUrlValue;window.Turbo?window.Turbo.visit(i):window.location.href=i}};var pb=["voie","depart"];function qE(t,e={}){return pb.includes(t)?e[t]?pb[pb.indexOf(t)+1]||"submit":t:pb[0]}var fb=class extends Ve{static targets=["step","voie","traceId","poiStartId","departInput","suggestions","progress","hero"];static values={citiesUrl:{type:String,default:"/api/pois/cities"},homeImage:String};connect(){this.wayId=null,this.answers={},this.voieImage=null,this.current=0,this.#e(0)}chooseVoie(t){let e=t.target.selectedOptions[0];!e||!e.value||(this.traceIdTarget.value=e.value,this.wayId=e.dataset.wayId,this.poiStartIdTarget.value=e.dataset.cityStartId||"",this.departInputTarget.value=e.dataset.cityStartName||"",this.voieImage=e.dataset.image||null,this.answers={voie:e.value},qE("voie",this.answers)==="depart"&&this.#e(this.current+1))}next(){this.#e(this.current+1)}back(){this.#e(this.current-1)}#e(t){let e=this.stepTargets;this.current=Math.max(0,Math.min(t,e.length-1)),e.forEach((i,n)=>i.hidden=n!==this.current),this.hasProgressTarget&&(this.progressTarget.textContent=`\xC9tape ${this.current+1} sur ${e.length}`),this.#i(),this.clearSuggestions()}#i(){if(!this.hasHeroTarget)return;let t=this.current===0||!this.voieImage?this.homeImageValue:this.voieImage;t&&(this.heroTarget.style.backgroundImage=`url('${t}')`)}searchDepart(){clearTimeout(this._t);let t=this.departInputTarget.value.trim();if(!this.wayId||t.length<2)return this.clearSuggestions();this._t=setTimeout(()=>this.#t(t),200)}async#t(t){try{let e=`${this.citiesUrlValue}?way_id=${this.wayId}&q=${encodeURIComponent(t)}`,i=await fetch(e,{headers:{Accept:"application/json"}});if(!i.ok)return this.clearSuggestions();this.#r(await i.json())}catch{this.clearSuggestions()}}#r(t){let e=this.suggestionsTarget;if(e.replaceChildren(),!t.length)return e.hidden=!0;t.slice(0,30).forEach(i=>{let n=document.createElement("li");n.textContent=i.department?`${i.name} (${i.department})`:i.name,n.className="cursor-pointer px-4 py-2 hover:bg-gray-100",n.addEventListener("click",()=>this.#s(i)),e.appendChild(n)}),e.hidden=!1}#s(t){this.poiStartIdTarget.value=t.id,this.departInputTarget.value=t.name,this.answers.depart=String(t.id),this.clearSuggestions()}clearSuggestions(){this.suggestionsTarget.replaceChildren(),this.suggestionsTarget.hidden=!0}};var HE=["/accueil","/planifier-son-chemin-de-compostelle"],q4=["/reglages","/activite","/compte","/mes-parcours","/mes-reservations","/app/checklist"],mb=class extends Ve{static values={connected:Boolean};connect(){let t=window.OfflineBridge;if(!qa()||!t?.captureShell)return;let i=(this.connectedValue?HE.concat(q4):HE).map(n=>new URL(n,window.location.origin).href);t.captureShell(JSON.stringify(i))}};var gb=class extends Ve{static targets=["navItem"];connect(){this.markActive(this.element.querySelector("[data-roadbook]")?"roadbook":"liste")}showCarte(){this.dispatch("show-carte"),this.markActive("carte")}activate(t){let e=t.currentTarget.dataset.shellFond;e&&this.markActive(e)}onFondLoad(t){let e=t.target.querySelector("[data-roadbook]")?"roadbook":t.target.querySelector("#poi-list-container")?"liste":null;if(this.isDesktop)return e&&this.markActive(e);if(!this.element.classList.contains("carte-list-mode"))return this.markActive("carte");this.markActive(e??"liste")}get isDesktop(){return window.matchMedia("(min-width: 1280px)").matches}onVueFond(t){this.markActive(t.detail.fond)}
788markActive(t){this.navItemTargets.forEach(e=>{e.dataset.shellFond===t?e.setAttribute("aria-current","page"):e.removeAttribute("aria-current")})}};var yb=class extends Ve{static values={enter:{type:Number,default:120},leave:{type:Number,default:24}};connect(){this.compact=!1,this.onScroll=this.onScroll.bind(this),window.addEventListener("scroll",this.onScroll,{passive:!0}),this.onScroll()}disconnect(){window.removeEventListener("scroll",this.onScroll)}onScroll(){let t=window.scrollY;!this.compact&&t>this.enterValue?this.setCompact(!0):this.compact&&t<this.leaveValue&&this.setCompact(!1)}setCompact(t){this.compact=t,this.element.classList.toggle("is-compact",t)}};var _b=class extends Ve{static targets=["map"];static values={wayId:String,waySlug:String,activeTraceId:Number};initialize(){this.layersInitialized=!1,this.tracesData=null,this.isLoadingTracesData=!1,this.handleMapInitialized=this.handleMapInitialized.bind(this),this.handleTurboLoad=this.handleTurboLoad.bind(this)}connect(){this.loadAttributesFromDOM(),!this.tracesData&&!this.isLoadingTracesData&&this.loadWayTracks(),document.addEventListener("map-initialized",this.handleMapInitialized),document.addEventListener("turbo:load",this.handleTurboLoad)}disconnect(){document.removeEventListener("map-initialized",this.handleMapInitialized),document.removeEventListener("turbo:load",this.handleTurboLoad),this.map&&this.cleanupLayers(),this.layersInitialized=!1}cleanupLayers(){let t=["way-paths-inactive","way-paths-active","way-paths-all","way-paths-fill"],e=["all-paths","active-paths","inactive-paths"];t.forEach(i=>{this.map.getLayer(i)&&this.map.removeLayer(i)}),e.forEach(i=>{this.map.getSource(i)&&this.map.removeSource(i)})}loadAttributesFromDOM(){let t=this.element.getAttribute("data-sleep-layers-way-id");t&&(this.wayIdValue=t);let e=this.element.getAttribute("data-sleep-layers-active-trace-id");e&&(this.activeTraceIdValue=parseInt(e,10));let i=this.element.getAttribute("data-sleep-layers-way-slug");i&&(this.waySlugValue=i)}handleMapInitialized(t){if(this.map=t.detail.map,!this.map){console.error("La carte n'a pas pu \xEAtre initialis\xE9e.");return}this.map.isStyleLoaded()?this.tracesData?this.initializeLayers():this.isLoadingTracesData||this.loadWayTracks():this.map.once("style.load",()=>{this.tracesData?this.initializeLayers():this.isLoadingTracesData||this.loadWayTracks()})}handleTurboLoad(){console.log("\u{1F504} Turbo load - Mise \xE0 jour des layers");let t=this.wayIdValue;this.loadAttributesFromDOM(),this.wayIdValue&&this.map&&(t!==this.wayIdValue||!this.layersInitialized)&&(console.log("\u{1F504} Rechargement des trac\xE9s apr\xE8s Turbo load"),this.cleanupLayers(),this.initializeLayers())}initializeLayers(){if(!(!this.map||!this.tracesData||this.layersInitialized)){if(!this.map.isStyleLoaded()){console.log("\u{1F6E3} Carte pas encore pr\xEAte, attente du chargement du style..."),setTimeout(()=>{this.map&&!this.layersInitialized&&(console.log("\u{1F6E3} Nouvelle tentative d'initialisation des layers..."),this.initializeLayers())},100);return}console.log("\u{1F6E3} Initialisation des layers...");try{this.addWayTracksToMap(this.tracesData.features),this.map.on("mouseenter","way-paths-fill",()=>{this.map.getCanvas().style.cursor="pointer"}),this.map.on("mouseleave","way-paths-fill",()=>{this.map.getCanvas().style.cursor=""}),this.layersInitialized=!0,console.log("\u2705 Layers initialis\xE9s avec succ\xE8s")}catch(t){console.error("\u274C Erreur lors de l'initialisation des layers:",t)}}}initializeTraceInteractions(){this.map.on("mouseenter","traces-inactive",()=>{this.map.getCanvas().style.cursor="pointer"}),this.map.on("mouseleave","traces-inactive",()=>{this.map.getCanvas().style.cursor=""}),this.map.on("mousemove","traces-inactive",t=>{t.features.length>0&&this.map.setPaintProperty("traces-inactive","line-color",["case",["==",["get","id"],t.features[0].properties.id],"#64748B","#94A3B8"])}),this.map.on("mouseleave","traces-inactive",()=>{this.map.setPaintProperty("traces-inactive","line-color","#94A3B8")}),this.map.on("click","traces-inactive",t=>{if(t.features.length>0){let e=t.features[0].properties.id;console.log(`Trace ${e} cliqu\xE9e`)}})}loadWayTracks(){if(!this.wayIdValue)return;if(this.isLoadingTracesData){console.log("\u{1F6E3} Chargement d\xE9j\xE0 en cours, annulation...");return}this.isLoadingTracesData=!0;let t=this.map?.getContainer();t&&(t.style.opacity="0.5",t.style.transition="opacity 0.3s"),console.log("\u{1F6E3} Chargement initial des traces..."),fetch(`/json_ways/${this.wayIdValue}.json`).then(e=>e.json()).then(e=>{if(!e||!e.features||!Array.isArray(e.features)){console.error("\u274C Les donn\xE9es re\xE7ues ne sont pas au format GeoJSON valide."),this.isLoadingTracesData=!1;return}console.log("\u2705 Donn\xE9es des traces charg\xE9es"),this.tracesData=e,this.isLoadingTracesData=!1,this.map&&(this.initializeLayers(),t&&(t.style.opacity="1"))}).catch(e=>{console.error("\u274C Erreur lors du chargement des trac\xE9s :",e),this.isLoadingTracesData=!1,t&&(t.style.opacity="1")})}addWayTracksToMap(t){let e={type:"FeatureCollection",features:t};this.map.getSource("all-paths")?this.map.getSource("all-paths").setData(e):this.map.addSource("all-paths",{type:"geojson",data:e}),this.map.getLayer("way-paths-all")||this.map.addLayer({id:"way-paths-all",type:"line",source:"all-paths",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#1F2648","line-width":7,"line-opacity":1}}),this.map.getLayer("way-paths-fill")||this.map.addLayer({id:"way-paths-fill",type:"line",source:"all-paths",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"transparent","line-width":15}});let i=t.filter(a=>a.properties.traces.includes(this.activeTraceIdValue)),n=t.filter(a=>!a.properties.traces.includes(this.activeTraceIdValue));this.map.getSource("active-paths")?this.map.getSource("active-paths").setData({type:"FeatureCollection",features:i}):this.map.addSource("active-paths",{type:"geojson",data:{type:"FeatureCollection",features:i}}),this.map.getLayer("way-paths-active")||this.map.addLayer({id:"way-paths-active",type:"line",source:"active-paths",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#FAB313","line-width":4,"line-opacity":1}}),this.map.getSource("inactive-paths")?this.map.getSource("inactive-paths").setData({type:"FeatureCollection",features:n}):this.map.addSource("inactive-paths",{type:"geojson",data:{type:"FeatureCollection",features:n}}),this.map.getLayer("way-paths-inactive")||this.map.addLayer({id:"way-paths-inactive",type:"line",source:"inactive-paths",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#CBD5E1","line-width":4,"line-opacity":1,"line-dasharray":[4,3]}}),this.map.on("click","way-paths-fill",a=>{let r=this.map.queryRenderedFeatures(a.point,{layers:["way-paths-fill"]});if(r.length>0){let h=r[0].properties.id,m=new URL(window.location.href),b=m.pathname.split("/"),T=b.indexOf("hebergements"),k=`/${this.waySlugValue}/hebergements`;b[T+1]==="from"&&b[T+2]&&(k+=`/from/${b[T+2]}`),b[T+3]==="distance"&&b[T+4]&&(k+=`/distance/${b[T+4]}`),k+=`/track/${h}`;let P=new URLSearchParams(m.search);P.delete("track"),P.delete("trace");let F=k;P.toString()&&(F+=`?${P.toString()}`),window.location.href=F}})}addPoiServicesLayer(){console.log("Ajout du layer pour les POI services...");let t=[2.672035,44.554877],e=this.generateFictitiousPoints(t);this.map.addSource("poi-services",{type:"geojson",data:{type:"FeatureCollection",features:e}}
788),this.map.addLayer({id:"poi-services-layer",type:"circle",source:"poi-services",paint:{"circle-radius":6,"circle-color":"#007bff"}})}generateFictitiousPoints(t){let e=[],[i,n]=t;for(let a=0;a<5;a++){let r=i+(Math.random()-.5)*.1,h=n+(Math.random()-.5)*.1;e.push({type:"Feature",geometry:{type:"Point",coordinates:[r,h]},properties:{id:a+1,type:"service"}})}return e}updateTraceStatus(t){if(!this.map||!this.layersInitialized)return;console.log(`\u{1F6E3} Mise \xE0 jour du statut de la trace ${t}`),this.activeTraceIdValue=t;let e=this.tracesData.features.filter(n=>n.properties.traces.includes(this.activeTraceIdValue)),i=this.tracesData.features.filter(n=>!n.properties.traces.includes(this.activeTraceIdValue));this.map.getSource("active-paths")&&this.map.getSource("active-paths").setData({type:"FeatureCollection",features:e}),this.map.getSource("inactive-paths")&&this.map.getSource("inactive-paths").setData({type:"FeatureCollection",features:i})}};var WE="santiagooo_map_position",GE="santiagooo_map_zoom",vb=class extends Ve{static values={latitude:Number,longitude:Number,zoom:Number,maptilerKey:String};initialize(){this.mapInitialized=!1,this.savedPosition=this.getSavedMapPosition(),this.savedZoom=this.getSavedMapZoom(),this.saveMapState=this.saveMapState.bind(this)}connect(){this.hasMaptilerKeyValue&&(pr.apiKey=this.maptilerKeyValue,this.initializeMap())}initializeMap(){if(this.mapInitialized||!this.mapElement){console.log("\u{1F5FA} Sortie pr\xE9coce de initializeMap:",{mapInitialized:this.mapInitialized,mapElement:!!this.mapElement});return}try{let t=this.savedPosition||[this.longitudeValue,this.latitudeValue],e=this.savedZoom||this.zoomValue;this.map=new Ac({container:this.mapElement,style:`https://api.maptiler.com/maps/dde387fc-1237-42da-8767-a16e8c6d4304/style.json?key=${this.maptilerKeyValue}`,center:t,zoom:e,maxZoom:15,minZoom:11}),this.map.once("load",()=>{console.log("\u{1F5FA} Carte MapTiler initialis\xE9e avec succ\xE8s"),this.mapInitialized=!0,document.dispatchEvent(new CustomEvent("map-initialized",{detail:{map:this.map}})),this.map.on("moveend",this.saveMapState),this.map.addControl(new Hm,"bottom-right"),this.map.addControl(new Wm({positionOptions:{enableHighAccuracy:!0},trackUserLocation:!0}),"bottom-right")})}catch(t){console.error("\u274C Erreur lors de l'initialisation de la carte MapTiler:",t),this.mapInitialized=!1}}saveMapState(){if(!this.map)return;let t=this.map.getCenter(),e=this.map.getZoom();localStorage.setItem(WE,JSON.stringify([t.lng,t.lat])),localStorage.setItem(GE,e.toString()),console.log("\u{1F5FA} \xC9tat de la carte sauvegard\xE9:",[t.lng,t.lat],e)}getSavedMapPosition(){try{let t=localStorage.getItem(WE);return t?JSON.parse(t):null}catch(t){return console.error("\u274C Erreur lors de la r\xE9cup\xE9ration de la position sauvegard\xE9e:",t),null}}getSavedMapZoom(){try{let t=localStorage.getItem(GE);return t?parseFloat(t):null}catch(t){return console.error("\u274C Erreur lors de la r\xE9cup\xE9ration du zoom sauvegard\xE9:",t),null}}refreshTimeout=null;lastRefresh=0;isRefreshing=!1;refreshMap(){let t=Date.now();if(!(t-this.lastRefresh<500||this.isRefreshing)){if(this.lastRefresh=t,this.isRefreshing=!0,!this.map||!this.mapInitialized){console.log("\u{1F5FA} Map not initialized yet, initializing..."),this.initializeMap(),this.isRefreshing=!1;return}try{this.map.resize(),console.log("\u{1F5FA} Map resized successfully")}catch(e){console.error("\u274C Error refreshing map:",e)}finally{this.isRefreshing=!1}}}disconnect(){console.log("\u{1F5FA} Map Controller: disconnect()"),this.map&&(this.saveMapState(),this.map.off("moveend",this.saveMapState),this.map.remove(),this.map=null,this.mapInitialized=!1),this.refreshTimeout&&clearTimeout(this.refreshTimeout)}get mapElement(){let t=this.element.querySelector("#map");return t||console.error("\u274C L'\xE9l\xE9ment #map n'a pas \xE9t\xE9 trouv\xE9 dans le DOM."),t}};var ZE={town:`<svg xmlns="http://www.w3.org/2000/svg" width="2rem" height="2rem" viewBox="0 0 256 256">
789              <path fill="#1F2648" d="M212.651 0H42.67C19.107 0 0 19.1 0 42.67v169.98c0 23.569 19.107 42.67 42.67 42.67h169.98c23.569 0 42.67-19.101 42.67-42.67V42.67C255.326 19.101 236.226 0 212.65 0z" />
790              <rect x="47.097" y="59.908" width="161.806" height="135.54" fill="#fab313" rx="13" />
791              <path fill="#1F2648" d="M100.57 162.48c-4.27 0-7.729-3.482-7.729-7.77v-54.1c0-4.287 3.458-7.769 7.729-7.769h54.18c4.283 0 7.73 3.482 7.73 7.77v54.1c0 4.287-3.447 7.768-7.73 7.768z" />
792            </svg>`,sleep:`<svg xmlns="http://www.w3.org/2000/svg" width="2rem" height="2rem" viewBox="0 0 24 24">
793              <g stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
794                <path d="M17.8 13.938h-.011a7 7 0 1 0-11.464.144h-.016l.14.171q.15.19.3.371L12 21l5.13-6.248q.291-.314.54-.659z" fill="#1F2648" stroke="#8FA5BD"/>
795                <path d="M12 13a3 3 0 1 0 0-6a3 3 0 0 0 0 6" fill="#1F2648" stroke="#8FA5BD"/>
796              </g>
797            </svg>`,partner:`<svg xmlns="http://www.w3.org/2000/svg" width="2rem" height="2rem" viewBox="0 0 24 24">
798                  <g stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
799                    <path d="M17.8 13.938h-.011a7 7 0 1 0-11.464.144h-.016l.14.171q.15.19.3.371L12 21l5.13-6.248q.291-.314.54-.659z" fill="#FAB313" stroke="#1F2648"/>
800                    <path d="M12 13a3 3 0 1 0 0-6a3 3 0 0 0 0 6" fill="#FAB313" stroke="#1F2648"/>
801                  </g>
802                </svg>`};var bb=class extends Ve{static targets=["map","infoPanel"];initialize(){this.markersInitialized=!1,this.townMarkers=[],this.poiMarkers=[],this.icons=ZE,this.currentPage=null,this.isLoadingPois=!1,this.pageCoordinates={},this.isPanelLocked=!1,this.hoveredMarker=null,this.defaultZoom=13,this.hoverZoom=15,this.zoomTimeout=null,this.isLoading=!1,this.hoverTimeout=null,this.flyTimeout=null}connect(){console.log("\u{1F5FA}\uFE0F SleepMarkersController connect\xE9");let t=new URL(window.location.href);this.currentPage=t.searchParams.get("page")||"1",this.buildPoiUrl(),this.cleanupMarkers(),this.mapInitHandler=this.handleMapInitialized.bind(this),document.addEventListener("map-initialized",this.mapInitHandler,{once:!0})}disconnect(){document.removeEventListener("map-initialized",this.mapInitHandler),this.cleanupMarkers(),this.map=null,this.poiMarkers=[],this.townMarkers=[],clearTimeout(this.hoverTimeout),clearTimeout(this.flyTimeout)}createLoadingSpinner(){let t=document.createElement("div");t.id="map-loading-spinner",t.className="hidden absolute inset-0 flex flex-col items-center justify-center bg-white/30 backdrop-blur-sm z-50 transition-opacity duration-300",t.innerHTML=`
803            <svg class="w-12 h-12 text-blue animate-spin" viewBox="0 0 64 64" fill="none"
804                xmlns="http://www.w3.org/2000/svg" width="24" height="24">
805                <path d="M32 3C35.8083 3 39.5794 3.75011 43.0978 5.20749C46.6163 6.66488 49.8132 8.80101 52.5061 11.4939C55.199 14.1868 57.3351 17.3837 58.7925 20.9022C60.2499 24.4206 61 28.1917 61 32C61 35.8083 60.2499 39.5794 58.7925 43.0978C57.3351 46.6163 55.199 49.8132 52.5061 52.5061C49.8132 55.199 46.6163 57.3351 43.0978 58.7925C39.5794 60.2499 35.8083 61 32 61C28.1917 61 24.4206 60.2499 20.9022 58.7925C17.3837 57.3351 14.1868 55.199 11.4939 52.5061C8.801 49.8132 6.66487 46.6163 5.20749 43.0978C3.7501 39.5794 3 35.8083 3 32C3 28.1917 3.75011 24.4206 5.2075 20.9022C6.66489 17.3837 8.80101 14.1868 11.4939 11.4939C14.1868 8.80099 17.3838 6.66487 20.9022 5.20749C24.4206 3.7501 28.1917 3 32 3L32 3Z" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"></path>
806                <path d="M32 3C36.5778 3 41.0906 4.08374 45.1692 6.16256C49.2477 8.24138 52.7762 11.2562 55.466 14.9605C58.1558 18.6647 59.9304 22.9531 60.6448 27.4748C61.3591 31.9965 60.9928 36.6232 59.5759 40.9762" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-linejoin="round" class="text-yellow"></path>
807            </svg>
808            <span class="mt-4 text-blue font-medium">Chargement en cours...</span>
809        `;let e=this.map.getContainer();e&&(e.style.position="relative",e.appendChild(t))}showLoadingSpinner(){let t=document.getElementById("map-loading-spinner");t&&(t.classList.remove("hidden"),t.classList.add("flex"))}hideLoadingSpinner(){let t=document.getElementById("map-loading-spinner");t&&(t.classList.add("hidden"),t.classList.remove("flex"))}buildPoiUrl(){let t=new URL(window.location.href),e=t.pathname;return e.endsWith(".json")||(e+=".json"),this.poiUrl=`${e}${t.search}`.replace(/&/g,"?"),this.poiUrl}async loadInitialPOIs(){if(!this.poiUrl||this.isLoading){console.log("\u274C Pas d'URL de POI disponible ou chargement en cours");return}this.isLoading=!0;let t=new URL(this.poiUrl,window.location.origin);t.searchParams.set("page",this.currentPage),console.log("\u{1F4CD} Chargement des POIs pour la page",this.currentPage),this.showLoadingSpinner();try{let e=await fetch(t.toString(),{headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}});if(!e.ok)throw new Error(`Erreur HTTP: ${e.status}`);let i=await e.json();if(!i||i.type!=="FeatureCollection"||!Array.isArray(i.features))throw new Error("Donn\xE9es invalides");this.initialPOIs=i,this.map&&(this.cleanupMarkers(),this.addMarkersToMap(i),this.markersInitialized=!0,document.documentElement.hasAttribute("data-turbo-loading")||this.calculateInitialBounds(),this.checkPoiCards())}catch(e){console.error("\u274C Erreur lors du chargement des POIs:",e)}finally{this.isLoading=!1,setTimeout(()=>{this.hideLoadingSpinner()},300)}}handleMapInitialized(t){!t.detail||!t.detail.map||(this.map=t.detail.map,this.createLoadingSpinner(),document.documentElement.hasAttribute("data-turbo-loading")||this.map.resize(),this.map.on("zoom",this.handleZoom.bind(this)),this.loadInitialPOIs())}handleZoom(){let t=this.map.getZoom();this.townMarkers.forEach(e=>{let i=e.getElement();i&&(i.style.display=t>13?"none":"block")})}addMarkersToMap(t){if(!t||t.type!=="FeatureCollection"||!Array.isArray(t.features)){console.error("\u274C Donn\xE9es GeoJSON invalides");return}if(!this.map){console.error("\u274C La carte n'est pas initialis\xE9e");return}this.cleanupMarkers();let e=t.features.filter(n=>n.properties?.type==="town");t.features.filter(n=>n.properties?.type!=="town").forEach(n=>{if(!n.geometry?.coordinates)return;n.geometry.coordinates=this.adjustMarkerPosition(n);let a=this.createPOIMarker(n);a&&(a.addTo(this.map),this.poiMarkers.push(a))}),e.forEach(n=>{if(!n.geometry?.coordinates)return;let a=this.createTownMarker(n);a&&(a.addTo(this.map),this.townMarkers.push(a))})}adjustMarkerPosition(t){let e=t.geometry.coordinates;if(!this.areValidCoordinates(e))return e;let i=t.properties.id||Math.random(),n=this.seededRandom(i),[a,r]=e;return[a+(n()-.5)*5e-4,r+(n()-.5)*5e-4]}seededRandom(t){let e=Math.sin(t)*1e4;return()=>Math.abs(e-Math.floor(e))}createPOIMarker(t){let e=t.geometry.coordinates;if(!this.areValidCoordinates(e))return;let i=document.createElement("div");i.className="maplibregl-marker poi-marker",i.setAttribute("data-poi-id",t.properties.id),i.style.position="absolute",i.style.top="0",i.innerHTML=`
810            <div class="relative group transition-all duration-300 cursor-pointer">
811                ${this.icons[t.properties.type]||'<div class="w-8 h-8 bg-blue rounded-full"></div>'}
812                <div class="absolute w-12 text-center -top-5 -right-2 text-sm font-semibold py-0.5 
813                    rounded-lg shadow-xl bg-white text-blue border border-blue 
814                    transition-all duration-300 ease-in-out">
815                    ${t.properties.price?`${t.properties.price}\u20AC`:"NC"}
816                </div>
817            </div>`;let n=new ld({element:i,anchor:"center"}).setLngLat(e);return n._feature=t,i.addEventListener("mouseenter",()=>{clearTimeout(this.hoverTimeout),this.hoverTimeout=setTimeout(()=>{this.hoverMarker(n),this.isPanelLocked||this.displayInfoPanel(t,!1)},150)}),i.addEventListener("mouseleave",()=>{clearTimeout(this.hoverTimeout),this.isPanelLocked||(this.hoverTimeout=setTimeout(()=>{this.resetMarker(n),this.closeInfoPanel()},100))}),i.addEventListener("click",a=>{a.stopPropagation(),clearTimeout(this.hoverTimeout),this.isPanelLocked=!0,this.hoverMarker(n),this.displayInfoPanel(t,!0),this.zoomToMarker(n,!0)}),n}createTownMarker(t){let e=t.geometry.coordinates;if(!this.areValidCoordinates(e))return;let i=document.createElement("div");i.className="maptiler-marker town-marker",i.style.position="absolute",i.style.top="0";let n=100;i.innerHTML=`
818            <div class="relative group">
819                <div class="w-3 h-3 rounded-full bg-blue shadow-md group-hover:shadow-lg group-hover:z-40"></div>
820                <div class="absolute left-1.5 -top-[100px] w-0.5 bg-gradient-to-t from-blue-400/40 to-blue"
821                     style="height: ${n}px;">
822                </div>
823                <div class="absolute -translate-x-1/2 left-1.5 group-hover:z-40"
824                     style="top: -${n+35}px">
825                    <div class="relative px-2 py-1 bg-white text-blue-900
826                              rounded-xl shadow-lg border border-blue/20 whitespace-nowrap
827                              group-hover:shadow-xl
828                              group-hover:-translate-y-1">
829                        <div class="flex items-center gap-2">
830                            <span class="font-bold text-sm max-w-[120px] truncate" 
831                                  title="${t.properties.name}">
832                                ${t.properties.name}
833                            </span>
834                        </div>
835                        <div class="absolute w-full left-0 -bottom-5 flex justify-center">
836                             <span class="text-xs text-blue-600 bg-white px-2 py-1 
837                                       rounded-full shadow-sm border border-blue/10">
838                                ${t.properties.kms} Km
839                            </span>
840                        </div>
841                    </div>
842                </div>
843            </div>
844        `;let a=new ld({element:i,anchor:"center"}).setLngLat(e);return a._feature=t,a}cleanupMarkers(){if(console.log("\u{1F9F9} Nettoyage des marqueurs existants"),this.poiMarkers.forEach(e=>{e&&e.remove&&e.remove()}),this.townMarkers.forEach(e=>{e&&e.remove&&e.remove()}),this.poiMarkers=[],this.townMarkers=[],this.hoveredMarker=null,this.isPanelLocked=!1,document.querySelectorAll(".poi-marker, .town-marker").forEach(e=>{e&&e.parentNode&&e.parentNode.removeChild(e)}),this.map)try{this.map.getLayer("poi-circles")&&this.map.removeLayer("poi-circles"),this.map.getSource("pois")&&this.map.removeSource("pois")}catch(e){console.warn("\u26A0\uFE0F Erreur lors du nettoyage des sources:",e)}}displayInfoPanel(t,e=!1){if(!t||!t.properties)return;let i=this.infoPanelTarget;if(!i){console.error("\u274C Impossible de trouver le panneau d'information. V\xE9rifiez l'attribut data-sleep-markers-target='infoPanel'");return}console.log("\u{1F4CD} Affichage du panneau pour:",t.properties.name);let n=this.map.project(t.geometry.coordinates),r=this.map.getContainer().offsetWidth,h=n.x<r/2;i.classList.remove("left-4","right-4","top-24","hidden"),i.classList.add(h?"left-4":"right-4","top-24","block","absolute","z-40"),e&&this.flyToMarker(t.geometry.coordinates,h);let m=i.querySelector("[data-distance]");m&&t.properties.kms&&(m.textContent=t.properties.kms);let b=i.querySelector("[data-partner-image]");if(b)if(t.properties.type==="partner"&&t.properties.image_url){let P=b.querySelector("img");P&&(P.src=t.properties.image_url,P.alt=t.properties.name||"Image h\xE9bergement partenaire"),b.classList.remove("hidden")}else b.classList.add("hidden");let T=i.querySelector("[data-content]");if(T&&(T.innerHTML=`
845                    <div class="flex flex-col space-y-3">
846                        <div class="space-y-0">
847                            <h3 class="text-lg font-bold m-0">${t.properties.name||"Sans titre"}</h3>
848                            <div class="text-sm text-gray-600">${t.properties.poi_type||""}${t.properties.capacity?` / ${t.properties.capacity} lits`:""}</div>
849                        </div>
850                        <div class="flex items-center space-x-2">
851                            <span class="font-bold text-primary">${t.properties.price?`${t.properties.price}\u20AC`:"Prix non disponible"}</span>
852                        </div>
853                        ${t.properties.url?`<a href="${t.properties.url}" 
854                            class="text-sm text-primary hover:underline" 
855                            data-action="click->sleep-markers#handleDetailsClick"
856                            data-return-to-map="true">Voir plus de d\xE9tails</a>`:""}
857                    </div>
858                `),e){let P=F=>{!i.contains(F.target)&&!F.target.closest(".poi-marker")&&(this.closeInfoPanel(),document.removeEventListener("click",P))};document.addEventListener("click",P)}let k=i.querySelector('[data-action="sleep-markers#closeInfoPanel"]');k&&k.addEventListener("click",()=>this.closeInfoPanel())}closeInfoPanel(){let t=this.infoPanelTarget;t&&(console.log("\u{1F4CD} Fermeture du panneau d'information"),this.isPanelLocked=!1,t.classList.add("hidden"),t.classList.remove("block","absolute"),this.hoveredMarker&&(this.resetMarker(this.hoveredMarker),this.zoomToMarker(this.hoveredMarker,!1),this.hoveredMarker=null))}hoverMarker(t){this.hoveredMarker&&this.hoveredMarker!==t&&this.resetMarker(this.hoveredMarker);let e=t.getElement();if(!e)return;this.hoveredMarker=t,e.style.zIndex="1000";let i=e.querySelector(".relative.group");if(i){i.style.transform="scale(1.2)",i.style.transition="all 0.2s ease-in-out";let n=i.querySelector("div:last-child");
858n&&(n.style.backgroundColor="#3B82F6",n.style.color="#FFFFFF",n.style.borderColor="#2563EB")}}resetMarker(t){let e=t.getElement();if(!e)return;this.hoveredMarker===t&&(this.hoveredMarker=null),e.style.zIndex="";let i=e.querySelector(".relative.group");if(i){i.style.transform="";let n=i.querySelector("div:last-child");n&&(n.style.backgroundColor="",n.style.color="",n.style.borderColor="")}}handleDetailsClick(t){if(!window.matchMedia("(max-width: 768px)").matches)return;t.preventDefault();let i=t.currentTarget.href,n={returnToMap:!0};try{history.pushState(n,"",i);let a=r=>{if(r.state?.returnToMap){let h=document.querySelector('[data-controller="toggle-view"]');if(h){let m=window.Stimulus.getControllerForElementAndIdentifier(h,"toggle-view");m&&typeof m.showMap=="function"&&m.showMap()}}};window.addEventListener("popstate",a,{once:!0}),window.location.href=i}catch(a){console.error("Erreur lors de la gestion du retour:",a),window.location.href=i}}storePageCoordinates(t,e){if(!e||e.length===0){console.log("\u274C Pas de features \xE0 stocker pour la page",t);return}this.pageCoordinates=this.pageCoordinates||{};let i=new sg;e.forEach(T=>{T&&T.geometry&&T.geometry.coordinates&&i.extend(T.geometry.coordinates)});
858let n=i.getSouthWest(),a=i.getNorthEast(),r=a.lng-n.lng,h=a.lat-n.lat,m=.2,b=new sg([n.lng-r*m,n.lat-h*m],[a.lng+r*m,a.lat+h*m]);this.pageCoordinates[t]={bounds:b,features:e},console.log(`\u2705 Coordonn\xE9es stock\xE9es pour la page ${t}`)}areValidCoordinates(t){return Array.isArray(t)&&t.length===2&&!isNaN(t[0])&&!isNaN(t[1])}getPadding(){return{top:50,bottom:50,left:50,right:50}}calculateInitialBounds(){if(!this.map||!this.initialPOIs||!this.initialPOIs.features)return;let t=new sg;this.initialPOIs.features.forEach(e=>{e.geometry&&e.geometry.coordinates&&t.extend(e.geometry.coordinates)}),t.isEmpty()||(this.initialBounds=t,document.documentElement.hasAttribute("data-turbo-loading")||this.map.fitBounds(t,{padding:this.getPadding(),maxZoom:this.getMaxZoom(),minZoom:this.getMinZoom(),duration:0}))}updatePoiSource(t){if(this.map)try{this.map.getSource("pois")&&(this.map.getLayer("poi-circles")&&this.map.removeLayer("poi-circles"),this.map.removeSource("pois")),this.map.addSource("pois",{type:"geojson",data:t}),this.map.addLayer({id:"poi-circles",type:"circle",source:"pois",paint:{"circle-radius":8,"circle-color":"#3B82F6","circle-opacity":.6}})}catch(e){console.warn("\u26A0\uFE0F Erreur lors de la mise \xE0 jour de la source:",e)}}handleViewModeChanged(t){if(!this.map||!this.initialBounds||this.initialBounds.isEmpty()){console.warn("\u26A0\uFE0F Carte ou bounds non disponibles pour l'adaptation");return}let e=t.detail.isMobile,i={padding:this.getPadding(),duration:500};e||(i.maxZoom=this.getMaxZoom(),i.minZoom=this.getMinZoom()),this.map.fitBounds(this.initialBounds,i),this.applyMaxBounds(this.initialBounds)}handleMapViewShown(){this.map&&setTimeout(()=>{this.map.resize(),this.initialBounds&&!this.initialBounds.isEmpty()&&(this.map.fitBounds(this.initialBounds,{padding:this.getPadding(),duration:500}),this.applyMaxBounds(this.initialBounds))},300)}disableTouchEvents(){let t=this.map?.getContainer();if(!t)return;this.savedTouchStart=t.ontouchstart,this.savedTouchMove=t.ontouchmove,this.savedTouchEnd=t.ontouchend;let e=i=>{i.target.closest("#boundary-message")||i.target.closest(".poi-marker")||(i.preventDefault(),i.stopPropagation())};t.ontouchstart=e,t.ontouchmove=e,t.ontouchend=e}enableTouchEvents(){let t=this.map?.getContainer();t&&(t.ontouchstart=this.savedTouchStart,t.ontouchmove=this.savedTouchMove,t.ontouchend=this.savedTouchEnd)}applyMaxBounds(t){if(!(!this.map||!t))try{this.map.setMaxBounds(null);
858let e=t.getSouthWest(),i=t.getNorthEast(),n=i.lng-e.lng,a=i.lat-e.lat,r=1,h=new sg([e.lng-n*r,e.lat-a*r],[i.lng+n*r,i.lat+a*r]);this.map.setMaxBounds(h)}catch{this.map&&this.map.setMaxBounds(null)}}getMinZoom(){return window.matchMedia("(max-width: 768px)").matches,9}getMaxZoom(){return window.matchMedia("(max-width: 768px)").matches?18:16}checkPoiCards(){let t=document.querySelectorAll("[data-poi-id]");t.length!==0&&t.forEach(e=>{let i=e.getAttribute("data-poi-id");i&&(e.removeEventListener("mouseenter",this.hoverCardHandler),e.removeEventListener("mouseleave",this.leaveCardHandler),e.addEventListener("mouseenter",()=>{clearTimeout(this.hoverTimeout),this.hoverTimeout=setTimeout(()=>{let n=this.findMarkerByPoiId(i);if(n&&!this.isPanelLocked){this.hoveredMarker&&this.hoveredMarker!==n&&this.resetMarker(this.hoveredMarker),this.hoverMarker(n);let a=n._feature.geometry.coordinates,r=this.map.project(a),h=this.map.getContainer();r.x>=0&&r.x<=h.offsetWidth&&r.y>=0&&r.y<=h.offsetHeight?this.zoomToMarker(n,!0):this.map.flyTo({center:a,zoom:this.hoverZoom,duration:1e3,essential:!0,easing:b=>b*(2-b)})}},150)}),e.addEventListener("mouseleave",()=>{clearTimeout(this.hoverTimeout);let n=this.findMarkerByPoiId(i);n&&!this.isPanelLocked&&(this.hoverTimeout=setTimeout(()=>{this.resetMarker(n),this.zoomToMarker(n,!1)},100))}))})}findMarkerByPoiId(t){return this.poiMarkers.find(e=>{let i=e.getElement();return i&&i.getAttribute("data-poi-id")===t})}flyToMarker(t,e){if(!this.map||!t)return;clearTimeout(this.flyTimeout);let i=this.map.project(t),n=this.map.getContainer();if(!(i.x>=0&&i.x<=n.offsetWidth&&i.y>=0&&i.y<=n.offsetHeight)){this.flyTimeout=setTimeout(()=>{this.map.flyTo({center:t,zoom:this.hoverZoom,duration:1500,essential:!0,easing:m=>m*(2-m)})},500);return}let r=320,h=e?r/2:-r/2;this.flyTimeout=setTimeout(()=>{this.map.flyTo({center:t,offset:[h,0],zoom:this.map.getZoom(),duration:1500,essential:!0,easing:m=>m*(2-m)})},500)}zoomToMarker(t,e){if(!this.map||!t._feature?.geometry?.coordinates)return;this.zoomTimeout&&clearTimeout(this.zoomTimeout);let i=e?this.hoverZoom:this.defaultZoom,n=this.map.getZoom();Math.abs(n-i)<.5||(this.lastZoom=n,this.map.flyTo({center:t._feature.geometry.coordinates,zoom:i,duration:1200,essential:!0,easing:a=>a*(2-a)}))}};var xb=class extends Ve{static targets=["container"];static values={interval:Number};connect(){this.currentIndex=0,this.slideCount=this.containerTarget.children.length,this.startAutoSlide()}disconnect(){this.stopAutoSlide()}startAutoSlide(){this.slideInterval=setInterval(()=>{this.next()},this.intervalValue)}stopAutoSlide(){this.slideInterval&&clearInterval(this.slideInterval)}next(){this.currentIndex=(this.currentIndex+1)%this.slideCount,this.slide()}prev(){this.currentIndex=(this.currentIndex-1+this.slideCount)%this.slideCount,this.slide()}slide(){let t=this.currentIndex*-100;this.containerTarget.style.transform=`translateX(${t}%)`}mouseEnter(){this.stopAutoSlide()}mouseLeave(){this.startAutoSlide()}};var wb=class extends Ve{static values={labels:Array,datasets:Array,type:{type:String,default:"line"}};
858connect(){this.chart=new Rg(this.element,{type:this.typeValue,data:{labels:this.labelsValue,datasets:this.datasetsValue.map(t=>({label:t.label,data:t.data,borderColor:t.color,backgroundColor:t.color,tension:.3}))},options:{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:this.datasetsValue.length>1,position:"bottom"}},scales:{y:{beginAtZero:!0,ticks:{precision:0}}}}})}disconnect(){this.chart?.destroy()}};var Sb=class extends Ve{static targets=["bar","sentinel"];connect(){!this.hasBarTarget||!this.hasSentinelTarget||(this.observer=new IntersectionObserver(([t])=>this.barTarget.classList.toggle("-translate-y-full",t.isIntersecting),{threshold:0}),this.observer.observe(this.sentinelTarget))}disconnect(){this.observer?.disconnect()}};var Tb=class extends Ve{static targets=["category","basis"];connect(){this.sync()}sync(){let t=this.categoryTarget.value==="extra";t&&(this.basisTarget.value="flat"),this.basisTarget.disabled=t}};var kb=class extends Ve{static targets=["days","hours","minutes","seconds"];static values={start:String};connect(){console.log("Timer controller connected"),console.log("Start value:",this.startValue),this.endDate=new Date(this.startValue),this.countdown()}countdown(){let t=new Date,e=Math.max(this.endDate.getTime()-t.getTime(),0);if(e===0){this.element.innerHTML='<p class="text-red-600 font-semibold">Cette offre est termin\xE9e</p>';return}let i=Math.floor(e/(1e3*60*60*24)),n=Math.floor(e%(1e3*60*60*24)/(1e3*60*60)),a=Math.floor(e%(1e3*60*60)/(1e3*60)),r=Math.floor(e%(1e3*60)/1e3);this.daysTarget.textContent=String(i).padStart(2,"0"),this.hoursTarget.textContent=String(n).padStart(2,"0"),this.minutesTarget.textContent=String(a).padStart(2,"0"),this.secondsTarget.textContent=String(r).padStart(2,"0"),requestAnimationFrame(()=>{setTimeout(()=>{this.countdown()},1e3)})}};var Cb=class extends Ve{static targets=["list","map","btnmap","btnlist"];connect(){window.innerWidth>=1280?this.showBothViews():this.showList()}
858showMap(){this.listTarget.classList.add("hidden"),this.mapTarget.classList.remove("hidden"),this.btnmapTarget.classList.add("hidden"),this.btnlistTarget.classList.remove("hidden"),window.dispatchEvent(new Event("resize"))}showList(){this.mapTarget.classList.add("hidden"),this.listTarget.classList.remove("hidden"),this.btnlistTarget.classList.add("hidden"),this.btnmapTarget.classList.remove("hidden")}showBothViews(){this.listTarget.classList.remove("hidden"),this.mapTarget.classList.remove("hidden"),this.btnmapTarget.classList.add("hidden"),this.btnlistTarget.classList.add("hidden"),window.dispatchEvent(new Event("resize"))}};function H4(t,e){return t?t.split("&").map(i=>i.trim()).filter(Boolean).every(i=>e.has(i)):!0}function KE(t,e,i){return t.find(n=>!i.has(n.key)&&H4(n.when,e))||null}var Mb=class extends Ve{static values={config:Array,context:String,mascot:String,defer:Boolean};connect(){this.deferValue?document.addEventListener("dismissable:dismissed",()=>this.evaluate(),{once:!0}):this.evaluate()}disconnect(){this.overlay?.remove()}evaluate(){if(this.overlay)return;let t=new Set((this.contextValue||"").split(/\s+/).filter(Boolean)),e=KE(this.configValue,t,this.#a());e&&this.#e(e)}#e(t){let e=t.target?document.querySelector(t.target):null,i=document.createElement("div");i.className="fixed inset-0 z-[9999]",i.innerHTML=e?this.#s(t):this.#r(t),document.body.appendChild(i),this.overlay=i,e&&this.#o(e,i),i.querySelector("[data-tour-dismiss]")?.addEventListener("click",()=>this.#i(t)),this._ev=t.advance?.startsWith("event:")?t.advance.slice(6):null,this._ev&&(this._advance=()=>this.#i(t),document.addEventListener(this._ev,this._advance,{once:!0}))}#i(t){this.overlay&&(this.#l(t.key),this._ev&&this._advance&&document.removeEventListener(this._ev,this._advance),this._ev=this._advance=null,this.overlay.remove(),this.overlay=null,this.evaluate())}#t(t){return`<div class="rounded-2xl bg-blue p-3 text-center shadow-2xl ring-1 ring-white/15">
859      <div class="flex items-center justify-center gap-2">
860        <div class="size-16 shrink-0 overflow-hidden">
861          <img src="${this.mascotValue}" alt="" aria-hidden="true" class="h-full w-full object-contain object-left drop-shadow">
862        </div>
863        <div class="relative rounded-2xl bg-white px-4 py-2.5 shadow-sm">
864          <span class="absolute -left-1 top-1/2 size-3 -translate-y-1/2 rotate-45 bg-white"></span>
865          <p class="relative text-sm font-semibold text-blue">${this.#n(t.text)}</p>
866        </div>
867      </div>
868      <button type="button" data-tour-dismiss
869        class="mt-3 w-full rounded-full bg-secondary px-6 py-2.5 font-bold text-primary">${this.#n(t.cta||"OK")}</button>
870    </div>`}#r(t){return`<div class="absolute inset-0 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4">
871      <div class="w-full max-w-sm">${this.#t(t)}</div>
872    </div>`}#s(t){return`
873      <div data-tour-hole class="pointer-events-none absolute rounded-xl" style="box-shadow: 0 0 0 9999px rgba(0,0,0,.6)"></div>
874      <div data-tour-bubble class="absolute left-1/2 w-[min(92vw,24rem)] -translate-x-1/2 px-2">${this.#t(t)}</div>`}#o(t,e){let i=t.getBoundingClientRect(),n=8,a=e.querySelector("[data-tour-hole]");Object.assign(a.style,{top:`${i.top-n}px`,left:`${i.left-n}px`,width:`${i.width+n*2}px`,height:`${i.height+n*2}px`});let r=e.querySelector("[data-tour-bubble]");i.top<window.innerHeight/2?r.style.top=`${i.bottom+16}px`:r.style.bottom=`${window.innerHeight-i.top+16}px`,t.scrollIntoView({block:"center",behavior:"smooth"})}#a(){return new Set(JSON.parse(localStorage.getItem("tour:seen")||"[]"))}#l(t){let e=this.#a();e.add(t),localStorage.setItem("tour:seen",JSON.stringify([...e]))}#n(t){return String(t??"").replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}};var Ab=class extends Ve{hideModal(){this.element.parentElement.removeAttribute("src"),this.element.remove()}};var W4=2e3,G4=.82,Z4=15e5,Eb=class extends Ve{static values={url:String,param:String};async upload(){let t=this.element;if(!t.files||!t.files.length)return;t.disabled=!0;let e=K4(t);try{let i=await Promise.all(Array.from(t.files).map(r=>X4(r))),n=new FormData;
874i.forEach(r=>n.append(this.paramValue,r));let a=await fetch(this.urlValue,{method:"POST",body:n,headers:{"X-CSRF-Token":document.querySelector('meta[name="csrf-token"]')?.content,Accept:"text/vnd.turbo-stream.html"}});window.Turbo.renderStreamMessage(await a.text())}catch{t.disabled=!1,e.remove()}}};function K4(t){let e=document.createElement("p");return e.className="mt-2 flex items-center gap-2 text-sm text-gray-500",e.innerHTML='<span class="inline-block size-4 rounded-full border-2 border-gray-300 border-t-gray-600 animate-spin"></span> Envoi en cours',t.insertAdjacentElement("afterend",e),e}async function X4(t){if(!t.type.startsWith("image/"))return t;let e;try{e=await createImageBitmap(t,{imageOrientation:"from-image"})}catch{return t}let i=Math.min(1,W4/Math.max(e.width,e.height));if(i===1&&t.size<Z4)return e.close?.(),t;let n=document.createElement("canvas");n.width=Math.round(e.width*i),n.height=Math.round(e.height*i),n.getContext("2d").drawImage(e,0,0,n.width,n.height),e.close?.();let a=await new Promise(h=>n.toBlob(h,"image/jpeg",G4));if(!a||a.size>=t.size)return t;let r=t.name.replace(/\.[^.]+$/,"")+".jpg";return new File([a],r,{type:"image/jpeg",lastModified:Date.now()})}var Bg="utilities",Ng="utilities-symbols",XE="carte:utilities-off",Ib=class extends Ve{static targets=["typeBox","panel","filterBtn"];initialize(){this.handleMapInitialized=this.handleMapInitialized.bind(this)}connect(){document.addEventListener("map-initialized",this.handleMapInitialized),document.addEventListener("map:ready",this.handleMapInitialized),this.restoreBoxes()}disconnect(){document.removeEventListener("map-initialized",this.handleMapInitialized),document.removeEventListener("map:ready",this.handleMapInitialized),this.map&&this.cleanup()}handleMapInitialized(t){this.map=t.detail.map,this.map&&(this.map.isStyleLoaded()?this.addUtilities():this.map.once("style.load",()=>this.addUtilities()))}async addUtilities(){if(!this.map.getSource(Bg))try{let e=await(await fetch("/carte/utilities.json",{headers:{Accept:"application/json"}})).json(),i=[...new Set((e.features||[]).map(n=>n.properties?.icon).filter(Boolean))];await this.loadIcons(i),this.map.addSource(Bg,{type:"geojson",data:e}),this.map.addLayer({id:Ng,type:"symbol",source:Bg,layout:{"icon-image":["get","icon"],"icon-size":["interpolate",["linear"],["zoom"],12,.6,22,.8],"icon-allow-overlap":!1}}),this.paintFilter()}catch(t){console.error("utilities-layer:",t)}}togglePanel(t){t.preventDefault(),t.stopPropagation(),this.panelTarget.classList.toggle("hidden")}closePanel(){this.panelTarget.classList.add("hidden")}panelBackdrop(t){t.target===this.panelTarget&&this.closePanel()}restoreBoxes(){let t=[];try{t=JSON.parse(localStorage.getItem(XE)||"[]")}catch{}this.typeBoxTargets.forEach(e=>{e.checked=!t.includes(e.value)}),this.paintFilterBtn()}applyFilter(){let t=this.typeBoxTargets.filter(e=>!e.checked).map(e=>e.value);try{localStorage.setItem(XE,JSON.stringify(t))}catch{}this.paintFilter(),this.paintFilterBtn()}paintFilter(){if(!this.map?.getLayer(Ng))return;let t=this.typeBoxTargets.filter(i=>i.checked).map(i=>i.value),e=t.length===this.typeBoxTargets.length;this.map.setFilter(Ng,e?null:["in",["get","icon"],["literal",t]])}paintFilterBtn(){let t=this.typeBoxTargets.some(e=>!e.checked);this.filterBtnTargets.forEach(e=>{e.dataset.utilitiesActive=t?"1":""})}async loadIcons(t){await Promise.all(t.map(e=>this.loadSvgIcon(e)))}async loadSvgIcon(t){if(!this.map.hasImage(t))try{let e=window.devicePixelRatio||1,i=32*e,n=new Image(i,i);await new Promise((r,h)=>{n.onload=r,n.onerror=h,n.src=`/map/icons/${t}.svg`});let a=document.createElement("canvas");if(a.width=i,a.height=i,a.getContext("2d").drawImage(n,0,0,i,i),!this.map.hasImage(t)){let r=a.getContext("2d").getImageData(0,0,i,i);this.map.addImage(t,r,{pixelRatio:e})}}catch(e){console.warn(`utilities-layer: ic\xF4ne ${t} non charg\xE9e`,e)}}cleanup(){this.map.getLayer(Ng)&&this.map.removeLayer(Ng),this.map.getSource(Bg)&&this.map.removeSource(Bg)}};var Lb=class extends Ve{static values={wayId:Number,version:String,mapUrl:String,stages:Array};open(t){if(!this.hasMapUrlValue||Jv(this.wayIdValue,this.versionValue)!=="open")return;t.preventDefault();let e=Qv(this.stagesValue)||this.mapUrlValue;window.Turbo?window.Turbo.visit(e):window.location.href=e}};var Pb=class extends Ve{static targets=["data","input","results"];static values={indexUrl:String};connect(){let{anchors:t,towns:e}=JSON.parse(this.dataTarget.textContent);this.anchors=t.sort((n,a)=>n.km-a.km),this.towns=e;let i=window.location.hash.match(/^#p(\d+)$/);i&&requestAnimationFrame(()=>
874{document.querySelector(`[data-poi-id="${i[1]}"]`)?.scrollIntoView({block:"start"})}),this.onTap=this.remapOfflineNav.bind(this),document.addEventListener("click",this.onTap,!0),qa()||this.loadIndex()}disconnect(){document.removeEventListener("click",this.onTap,!0)}remapOfflineNav(t){if(qa())return;let e=t.target.closest("a[href]");if(!e||e.dataset.turboFrame!=="poi_fiche")return;let i=new URL(e.href,window.location.origin);if(!i.pathname.includes("/hebergements"))return;let n=i.searchParams.get("from")||(i.pathname.match(/\/from\/(\d+)/)||[])[1];if(!n||i.searchParams.get("window"))return;let a=(this.index||this.towns).find(m=>String(m.id)===String(n));if(!a)return;let r=[...this.anchors].reverse().find(m=>m.km<=a.km)||this.anchors[0];if(!r)return;t.preventDefault(),t.stopPropagation();let h=document.getElementById("poi_fiche");h?h.src=r.url:window.Turbo&&window.Turbo.visit(r.url)}filter(){this.loadIndex();let t=this.normalize(this.inputTarget.value);if(t.length<2){this.resultsTarget.hidden=!0;return}let i=(this.index||this.towns).filter(n=>this.normalize(n.name).includes(t)||n.city&&this.normalize(n.city).includes(t)).sort((n,a)=>(n.kind==="Town"?0:1)-(a.kind==="Town"?0:1)||n.km-a.km).slice(0,10);this.resultsTarget.innerHTML=i.map(n=>`
875      <button type="button" data-action="window-resolver#pick" data-km="${n.km}" data-id="${n.id}"
876              class="flex w-full items-baseline justify-between gap-2 px-4 py-2.5 text-left text-sm text-gray-700 hover:bg-gray-50">
877        <span class="min-w-0 truncate">${this.escape(n.name)}${n.kind==="Sleep"&&n.city?` <span class="text-xs text-gray-400">\xB7 ${this.escape(n.city)}</span>`:""}</span>
878        <span class="shrink-0 text-xs text-gray-400">km ${n.km}</span>
879      </button>`).join(""),this.resultsTarget.hidden=i.length===0}async loadIndex(){if(!(this.index||this.indexLoading||!this.hasIndexUrlValue)){this.indexLoading=!0;try{let t=await fetch(this.indexUrlValue);if(t.ok){let{pois:e}=await t.json();this.index=e,this.filter()}}catch{}}}pick(t){this.open(parseFloat(t.currentTarget.dataset.km),t.currentTarget.dataset.id)}locate(){navigator.geolocation?.getCurrentPosition(t=>{let e=this.nearest(t.coords);e&&this.open(e.km,e.id)},()=>{})}nearest({latitude:t,longitude:e}){let i=Math.cos(t*Math.PI/180),n=null,a=1/0;for(let r of this.towns){if(r.lat==null||r.lon==null)continue;let h=(r.lat-t)**2+((r.lon-e)*i)**2;h<a&&(a=h,n=r)}return n}open(t,e=null){let i=[...this.anchors].reverse().find(a=>a.km<=t)||this.anchors[0];if(!i)return;let n=e?`${i.url}#p${e}`:i.url;window.Turbo?window.Turbo.visit(n):window.location.href=n}normalize(t){return t.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g," ").trim()}escape(t){return t.replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}};var Db=class extends Ve{static targets=["step","prevButton","nextButton","finishButton","recap","form","errors","nameInput","progress","navigation","kmInput","poiInput","waySelect","kmRangeMin","kmRangeMax","kmRangeMinLabel","kmRangeMaxLabel","kmRangeFill"];static values={totalSteps:Number,currentStep:{type:Number,default:0},showProgress:{type:Boolean,default:!1},poiStartId:String,wayId:String,poiCache:{type:Object,default:{}}};static MINIMUM_SEARCH_LENGTH=2;static DEBOUNCE_DELAY=50;static POI_CACHE_SIZE=50;connect(){console.log("\u{1F9D9}\u200D\u2642\uFE0F Wizard controller connected"),this.currentStepValue=0,this.clearStoredData(),this.updateStepVisibility(),this.hasPoiInputTarget&&(this.poiInputTarget.disabled=!0,this.poiInputTarget.value="",console.log("\u{1F9D9}\u200D\u2642\uFE0F Initialisation du champ POI"),this.boundHandleClickOutside=this.handleClickOutside.bind(this),document.addEventListener("click",this.boundHandleClickOutside),this.debouncedSearchPois=this.debounce(this.searchPois.bind(this),this.constructor.DEBOUNCE_DELAY),this.poiInputTarget.addEventListener("input",this.debouncedSearchPois))}disconnect(){this.hasPoiInputTarget&&(this.poiInputTarget.removeEventListener("input",this.debouncedSearchPois),document.removeEventListener("click",this.boundHandleClickOutside)),this.clearStoredData()}async loadItineraries(){try{let t=await fetch("/api/way_itineraries",{cache:"no-store"});if(!t.ok)throw new Error("Erreur lors du chargement des itin\xE9raires");let e=await t.json(),i=this.waySelectTarget;if(i.options.length=0,i.add(new Option("Choisis une option...","")),e.features.forEac
879h(n=>{let a=n.properties,r=new Option(a.name,a.way_id);a.track_id&&(r.dataset.trackId=a.track_id),r.dataset.traceName=a.name,r.dataset.cityStartId=a.city_start?.id||"",r.dataset.cityStartName=a.city_start?.name||"",i.add(r)}),this.hasPoiInputTarget){let n=this.poiInputTarget;n.disabled=!0,n.value="",n.placeholder="S\xE9lectionne d'abord une voie..."}}catch(t){console.error("\u274C Erreur:",t),this.showError("Une erreur est survenue lors du chargement des itin\xE9raires. Veuillez r\xE9essayer.")}}startWizard(){this.currentStepValue=1,this.showProgressValue=!0,this.progressTarget.classList.remove("hidden"),this.navigationTarget.classList.remove("hidden"),this.updateStepVisibility(),this.updateButtonsVisibility(),this.updateProgressBar()}handleClickOutside=t=>{if(!document.querySelector(".poi-suggestions"))return;t.target.closest(".poi-suggestions")||t.target.matches('[data-wizard-target="poiInput"]')||this.clearSuggestions()};async nextStep(){this.validateCurrentStep()&&this.currentStepValue<this.totalStepsValue-1&&(this.storeCurrentStepData(),this.currentStepValue++,await this.updateStepVisibility(),this.updateButtonsVisibility(),this.updateProgressBar())}async previousStep(){this.currentStepValue>1&&(this.storeCurrentStepData(),this.currentStepValue--,await this.updateStepVisibility(),this.updateButtonsVisibility(),this.updateProgressBar(),setTimeout(()=>{this.restoreStepData(),this.setupRequiredFields(this.stepTargets[this.currentStepValue])},100))}storeCurrentStepData(){let e=this.stepTargets[this.currentStepValue].querySelector("form");if(!e)return;let i=new FormData(e),n={};if(i.forEach((a,r)=>{let h=r.match(/course\[(.*?)\]/);h?n[h[1]]=a:n[r]=a}),this.currentStepValue===2&&n.way_id){let a=e.querySelector('[name="course[way_id]"]');if(a){let r=a.options[a.selectedIndex];r&&(r.dataset.traceName&&(n.trace_name=r.dataset.traceName),r.dataset.trackId&&(n.track_id=r.dataset.trackId))}}sessionStorage.setItem(`wizard_step_${this.currentStepValue}`,JSON.stringify(n))}restoreStepData(){let t=sessionStorage.getItem(`wizard_step_${this.currentStepValue}`);if(!t)return;let e=JSON.parse(t),n=this.stepTargets[this.currentStepValue].querySelector("form");n&&(Object.entries(e).forEach(([a,r])=>{let h=n.querySelector(`[name="course[${a}]"]`);h&&(h.value=r,h.tagName==="SELECT"&&h.dispatchEvent(new Event("change")))}),this.hasKmRangeMinTarget&&this.kmRangeChanged())}clearStoredData(){for(let t=1;t<=this.totalStepsValue;t++)sessionStorage.removeItem(`wizard_step_${t}`)}validateCurrentStep(){if(this.currentStepValue===0)return!0;let e=this.stepTargets[this.currentStepValue].querySelector("form");if(!e)return!0;if(this.currentStepValue===2){let a=e.querySelector('[name="course[poi_start_id]"]')?.value;if(!e.querySelector('[name="course[way_id]"]')?.value)return this.showError("Veuillez s\xE9lectionner une voie"),!1;if(!a)return this.showError("Veuillez s\xE9lectionner une ville de d\xE9part dans la liste des suggestions"),!1}return Array.from(e.elements).every(a=>a.checkValidity())?(this.hideError(),this.storeCurrentStepData(),!0):(e.reportValidity(),!1)}async updateStepVisibility(){if(this.currentStepValue===2)try{let t=await fetch("/wizard/step/2",{headers:{Accept:"text/html","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content}});if(!t.ok)throw new Error("Erreur lors du chargement de l'\xE9tape");let e=await t.text();this.stepTargets[2].innerHTML=e,this.hasWaySelectTarget&&await this.loadItineraries()}catch(t){console.error("\u274C Erreur:",t)}this.stepTargets.forEach((t,e)=>{let i=e===this.currentStepValue;t.classList.toggle("hidden",!i),i&&e>0&&(this.setupRequiredFields(t),e===this.totalStepsValue-1&&this.updateRecap())})}updateButtonsVisibility(){if(this.currentStepValue===0){this.prevButtonTarget.classList.add("hidden"),this.nextButtonTarget.classList.add("hidden"),this.finishButtonTarget.classList.add("hidden");return}this.prevButtonTarget.classList.toggle("hidden",this.currentStepValue===1);let t=this.currentStepValue===this.totalStepsValue-1;this.nextButtonTarget.classList.toggle("hidden",t),this.finishButtonTarget.classList.toggle("hidden",!t)}updateProgressBar(){if(!this.showProgressValue||!this.hasProgressTarget)return;let t=this.currentStepValue,e=this.totalStepsValue-1,i=Math.round(t/e*100);this.progressElements||(this.progressTarget.innerHTML="",this.createProgressBarElements()),this.progressElements.stepText.textContent=`\xC9tape ${t}/${e}`,this.progressElements.percentageText.textContent=`${i}%`,this.progressElements.progressBar.style.width=`${i}%`,this.progressElements.progressBar.setAttribute("aria-valuenow",i)}createProgressBarElements(){let t=document.createElement("div");t.className="mb-8";let e=document.createElement("div");e.className="flex justify-between mb-1";let i=document.createElement("span");i.className="text-base font-medium text-blue-700";let n=document.createElement("span");n.className="text-sm font-medium text-blue-700";let a=document.createElement("div");a.className="w-full bg-yellow-200 rounded-full h-2.5";let r=document.createElement("div");r.className="bg-blue h-2.5 rounded-full transition-all duration-500 ease-in-out",r.setAttribute("role","progressbar"),r.setAttribute("aria-valuemin","0"),r.setAttribute("aria-valuemax","100"),r.setAttribute("aria-label","Progression du formulaire"),e.appendChild(i),e.appendChild(n),a.appendChild(r),t.appendChild(e),t.appendChild(a),this.progressTarget.appendChild(t),this.progressElements={stepText:i,percentageText:n,progressBar:r}}updateRecap(){if(!this.hasRecapTarget)return;let t=this.recapTarget,e=t.querySelector("[data-starting-date]"),i=t.querySelector("[data-stay-night-before]"),n=t.querySelector("[data-km-by-day]"),a=t.querySelector("[data-average-speed]"),r=t.querySelector("[data-way-name]"),h={};for(let Y=1;Y<=this.totalStepsValue-1;Y++){let te=sessionStorage.getItem(`wizard_step_${Y}`);te&&Object.assign(h,JSON.parse(te))}r&&h.trace_name&&(r.textContent=h.trace_name);let m=new Date(h.starting_date_course),b={weekday:"long",year:"numeric",month:"long",day:"numeric"},T=m.toLocaleDateString("fr-FR",b),k=new Date(m);k.setDate(m.getDate()-1);let P=k.toLocaleDateString("fr-FR",b);if(e&&(e.textContent=T),i){let Y=h.stay_night_before==="1"?i.dataset.stayTemplate:i.dataset.noStayTemplate;i.textContent=Y.replace("%{date}",P)}if(n){let Y=h.km_by_day;if(Y&&Y!=="0"){let te=n.closest("li");te&&(te.classList.remove("hidden"),n.textContent=Y)}else{let te=n.closest("li");te&&te.classList.add("hidden")}}if(a){let Y=h.average_speed;Y&&Y!=="0"&&(a.textContent=`${Y} km/h`)}let F=t.querySelector("[data-km-range-item]");if(F){let Y=h.km_day_max!==void 0;if(F.classList.toggle("hidden",!Y),Y){let te=+h.km_day_min||0;F.querySelector("[data-km-range]").textContent=te>0?`${te} \xE0 ${h.km_day_max} km par jour`:`jusqu'\xE0 ${h.km_day_max} km par jour`}}let U=t.querySelector("[data-planned-days-item]");if(U){let Y="planned_days"in h;U.classList.toggle("hidden",!Y),Y&&(U.querySelector("[data-planned-days]").textContent=h.planned_days?`${h.planned_days} jours de marche`:"aller jusqu'au bout du chemin")}let X=t.closest("form");
879X&&Object.entries(h).forEach(([Y,te])=>{let le=X.querySelector(`input[name="course[${Y}]"]`);le&&(le.value=te)})}async finish(){if(this.validateCurrentStep()){this.finishButtonTarget.disabled=!0,this.finishButtonTarget.classList.add("opacity-50","cursor-not-allowed");let t=new FormData;this.poiStartIdValue&&t.append("course[poi_start_id]",this.poiStartIdValue),this.wayIdValue&&t.append("course[way_id]",this.wayIdValue);for(let e=1;e<=this.totalStepsValue-1;e++){let i=sessionStorage.getItem(`wizard_step_${e}`);if(i){let n=JSON.parse(i);Object.entries(n).forEach(([a,r])=>{t.append(`course[${a}]`,r)})}}try{let i=await(await fetch("/wizard",{method:"POST",headers:{"X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content,Accept:"application/json"},body:t})).json();i.success?(this.clearStoredData(),window.addEventListener("pageshow",n=>{n.persisted&&this.clearStoredData()}),window.location.href=i.redirect_to):(this.showErrors(i.errors),this.finishButtonTarget.disabled=!1,this.finishButtonTarget.classList.remove("opacity-50","cursor-not-allowed"))}catch(e){console.error("\u274C Erreur lors de la cr\xE9ation de la course:",e),this.finishButtonTarget.disabled=!1,this.finishButtonTarget.classList.remove("opacity-50","cursor-not-allowed")}}}showErrors(t){console.error("\u274C Form errors:",t);let e=this.errorsTarget;if(Array.isArray(t)){let i=t.map(n=>`<li>${n}</li>`).join("");e.innerHTML=`<ul class="list-disc pl-5">${i}</ul>`}else e.textContent=t;e.classList.remove("hidden")}setupRequiredFields(t=null){(t?[t]:this.stepTargets).forEach(i=>{i.querySelectorAll("label").forEach(a=>{if(a.querySelector(".text-red-500")){let r=a.getAttribute("for"),h=i.querySelector(`#${r}`);h&&h.setAttribute("required","required")}})})}validateField(t){let e=t.target,i=this.errorsTarget;switch(e.classList.remove("border-red-500","border-green-500"),e.classList.add("border-gray-300"),e.name){case"course[name]":if(e.value.length<3)return e.classList.remove("border-gray-300"),e.classList.add("border-red-500"),this.showFieldError(i,"Le titre doit contenir au moins 3 caract\xE8res"),!1;e.classList.remove("border-gray-300"),e.classList.add("border-green-500");break;case"course[number_of_people]":if(parseInt(e.value)<1)return e.value=1,e.classList.add("border-green-500"),!0;e.classList.add("border-green-500");break}return this.hideFieldError(i),!0}showFieldError(t,e){t.textContent=e,t.classList.remove("hidden"),t.classList.add("bg-red-50","p-4","rounded-md")}hideFieldError(t){t.textContent="",t.classList.add("hidden"),t.classList.remove("bg-red-50","p-4","rounded-md")}kmRangeChanged(){let t=+this.kmRangeMinTarget.value,e=+this.kmRangeMaxTarget.value;t>e&&([t,e]=[e,t]),this.kmRangeMinLabelTarget.textContent=t,this.kmRangeMaxLabelTarget.textContent=e;let i=+this.kmRangeMaxTarget.max||1;this.kmRangeFillTarget.style.left=`${t/i*100}%`,this.kmRangeFillTarget.style.right=`${100-e/i*100}%`}kmRangeTrackDown(t){if(t.target instanceof HTMLInputElement)return;let e=t.currentTarget.getBoundingClientRect(),i=Math.min(1,Math.max(0,(t.clientX-e.left)/e.width)),n=Math.round(i*(+this.kmRangeMaxTarget.max||1)),a=Math.abs(n-+this.kmRangeMinTarget.value)<=Math.abs(n-+this.kmRangeMaxTarget.value)?this.kmRangeMinTarget:this.kmRangeMaxTarget;a.value=n,this.kmRangeChanged()}updateKmHint(t){let e=t.target,i=e.parentElement.querySelector(".hint");i&&e.value&&(i.textContent=`Tu te projetes sur des \xE9tapes de ${e.value} kilom\xE8tres par jour`)}clearInput(t){console.log("\u{1F9D9}\u200D\u2642\uFE0F Nettoyage du champ de saisie");let e=t.target;e.value="",e.placeholder="Tape les premi\xE8res lettres de la ville...";let i=e.closest("form"),n=i.querySelector('[name="course[poi_start_id]"]'),a=i.querySelector('[name="course[poi_end_id]"]');n.value="",a.value="",this.clearSuggestions()}async fetchPois(t){let e=t.target.value;console.log("\u{1F9D9}\u200D\u2642\uFE0F fetchPois - Way ID s\xE9lectionn\xE9:",e);let i=t.target.closest("form"),n=i.querySelector('[data-wizard-target="poiInput"]'),a=i.querySelector('[name="course[poi_start_id]"]'),r=i.querySelector('[name="course[poi_end_id]"]');if(n.value="",a.value="",r.value="",e){let h=t.target.selectedOptions[0],m=h.dataset.cityStartId,b=h.dataset.cityStartName;m&&b&&(n.value=b,a.value=m,r.value=m);try{let T=await fetch(`/api/pois/cities?way_id=${e}`,{headers:{Accept:"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content}});if(!T.ok)throw new Error("Erreur lors du chargement des villes");let k=await T.json();this.poiCacheValue[e]=k}catch(T){console.error("\u274C Erreur:",T)}n.disabled=!1,n.placeholder="Tape les premi\xE8res lettres de la ville..."}else n.disabled=!0,n.placeholder="S\xE9lectionne d'abord une voie..."}updatePoiSuggestions(t,e){console.log("\u{1F9D9}\u200D\u2642\uFE0F Mise \xE0 jour des suggestions:",{nombrePois:t.length,inputValue:e.value}),this.clearSuggestions();let i=e.value.toLowerCase(),n=t.filter(b=>b.name.toLowerCase().startsWith(i));if(n.length===0)return;let a=e.closest("form"),r=a.querySelector('[name="course[poi_start_id]"]'),h=a.querySelector('[name="course[poi_end_id]"]');if(!r||!h){console.error("\u274C Champs de s\xE9lection POI non trouv\xE9s");return}let m=document.createElement("ul");m.className="poi-suggestions absolute z-10 w-full bg-white shadow-lg max-h-60 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm",n.forEac
879h(b=>{console.log("\u{1F9D9}\u200D\u2642\uFE0F Ajout suggestion:",b.name);let T=document.createElement("li");T.className="text-gray-900 cursor-default select-none relative py-2 pl-3 pr-9 hover:bg-blue-100",T.textContent=b.name,T.addEventListener("click",k=>{k.preventDefault(),k.stopPropagation(),e.value=b.name,r.value=b.id,h.value=b.id,this.clearSuggestions()}),m.appendChild(T)}),e.insertAdjacentElement("afterend",m)}clearSuggestions(){console.log("\u{1F9D9}\u200D\u2642\uFE0F Nettoyage des suggestions");let t=document.querySelector(".poi-suggestions");t&&t.remove()}cleanCache(){let t=Object.entries(this.poiCacheValue);t.length>this.constructor.POI_CACHE_SIZE&&(console.log("\u{1F9D9}\u200D\u2642\uFE0F Nettoyage du cache - Avant:",t.length,"entr\xE9es"),this.poiCacheValue=Object.fromEntries(t.slice(-this.constructor.POI_CACHE_SIZE)),console.log("\u{1F9D9}\u200D\u2642\uFE0F Nettoyage du cache - Apr\xE8s:",Object.keys(this.poiCacheValue).length,"entr\xE9es"))}async searchPois(t){let e=t.target.value.toLowerCase();console.log("\u{1F9D9}\u200D\u2642\uFE0F searchPois - D\xE9marrage de la recherche:",e);let i=t.target.closest("form"),n=i.querySelector('[name="course[poi_start_id]"]'),a=i.querySelector('[name="course[poi_end_id]"]');if(n&&(n.value=""),a&&(a.value=""),!this.hasWaySelectTarget){console.log("\u274C WaySelect non trouv\xE9");return}let h=this.waySelectTarget.value;if(!h){console.log("\u274C Aucun itin\xE9raire s\xE9lectionn\xE9");return}if(e.length<this.constructor.MINIMUM_SEARCH_LENGTH){console.log("\u274C Query trop courte"),this.clearSuggestions();return}if(this.poiCacheValue[h]){console.log("\u{1F9D9}\u200D\u2642\uFE0F Filtrage local des villes");let b=this.poiCacheValue[h].filter(T=>T.name.toLowerCase().includes(e)).slice(0,50);this.updatePoiSuggestions(b,t.target);return}try{let m=await fetch(`/api/pois/cities?way_id=${h}&q=${encodeURIComponent(e)}`,{headers:{Accept:"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content}});if(!m.ok){let T=await m.json();throw new Error(T.error||"Erreur lors du chargement des villes")}let b=await m.json();if(console.log("\u{1F9D9}\u200D\u2642\uFE0F searchPois - Villes re\xE7ues:",b),b.length===0){this.clearSuggestions();return}this.updatePoiSuggestions(b,t.target)}catch(m){console.error("\u274C Erreur:",m.message),this.clearSuggestions()}}showError(t){let i=this.stepTargets[this.currentStepValue].querySelector('[data-wizard-target="errors"]');if(!i){console.error("\u274C Div d'erreur non trouv\xE9 dans l'\xE9tape actuelle");return}i.textContent=t,i.classList.remove("hidden"),i.classList.add("bg-red-50","text-red-700","p-4","rounded-md","mb-4"),setTimeout(()=>{this.hideError()},5e3)}hideError(){let e=this.stepTargets[this.currentStepValue].querySelector('[data-wizard-target="errors"]');e&&(e.classList.add("hidden"),e.classList.remove("bg-red-50","text-red-700","p-4","rounded-md","mb-4"),e.textContent="")}debounce(t,e){let i;return function(...a){let r=()=>{clearTimeout(i),t.apply(this,a)};clearTimeout(i),i=setTimeout(r,e)}}};Ct.register("accordion",L0);Ct.register("auto-submit",P0);Ct.register("booking-details",D0);Ct.register("booking-form",R0);Ct.register("cached-search",F0);Ct.register("carousel",B0);Ct.register("carte",N0);Ct.register("carte-map",A_);Ct.register("clipboard",E_);Ct.register("dismissable",I_);Ct.register("elevation-profile",Rv);Ct.register("flash-message",zv);Ct.register("google-maps",Ov);Ct.register("home-map-panel",Fv);Ct.register("home-way-panel",Bv);Ct.register("image-resize",Nv);Ct.register("manage-accordion",Vv);Ct.register("member-booking-actions",$v);Ct.register("menu",Uv);Ct.register("modal",jv);Ct.register("navigation",qv);Ct.register("nested-form",Hv);Ct.register("newsletter-editor",Wv);Ct.register("obfuscated-link",Gv);Ct.register("offline-contact",Zv);Ct.register("offline-device",Kv);Ct.register("offline-download",eb);Ct.register("offline-downloads",tb);Ct.register("offline-only",ib);Ct.register("online-only",nb);Ct.register("pois-overpass",rb);Ct.register("portal",sb);Ct.register("profile-selector",ob);Ct.register("progress-bar",ab);Ct.register("push-register",lb);Ct.register("range-pair",cb);Ct.register("reveal",ub);Ct.register("roadbook-bifurcation",hb);Ct.register("roadbook-fond",db);Ct.register("roadbook-wizard",fb);Ct.register("shell-capture",mb);Ct.register("shell",gb);Ct.register("shrink-header",yb);Ct.register("sleep-layers",_b);Ct.register("sleep-map",vb);Ct.register("sleep-markers",bb);Ct.register("slider",xb);Ct.register("stats-chart",wb);Ct.register("sticky-header",Sb);Ct.register("tariff-line",Tb);Ct.register("timer",kb);Ct.register("toggle-view",Cb);Ct.register("tour",Mb);Ct.register("turbo-modal",Ab);Ct.register("upload-autosave",Eb);Ct.register("utilities-layer",Ib);Ct.register("voie-row",Lb);Ct.register("window-resolver",Pb);Ct.register("wizard",Db);document.addEventListener("turbo:before-render",t=>{document.startViewTransition&&(t.preventDefault(),document.startViewTransition(()=>t.detail.resume()))});var qs;function Y4(){let t=document.querySelector('meta[name="mascot-image"]')?.content||"",e=t?`<div class="size-16 shrink-0 overflow-hidden"><img src="${t}" alt="" aria-hidden="true" class="h-full w-full object-contain object-left drop-shadow"></div>`:"",i=t?'<span class="absolute -left-1 top-5 size-3 -translate-y-1/2 rotate-45 bg-white"></span>':"";qs=document.createElement("dialog"),qs.className="m-auto w-[min(90vw,26rem)] rounded-2xl border-0 bg-blue p-0 shadow-2xl",qs.innerHTML=`
880    <form method="dialog" class="p-5">
881      <div class="flex items-start gap-2">
882        ${e}
883        <div class="relative flex-1 rounded-2xl bg-white px-4 py-3 shadow-sm">
884          ${i}
885          <p data-confirm-message class="relative whitespace-pre-line text-sm font-semibold text-blue"></p>
886        </div>
887      </div>
888      <div class="mt-4 flex justify-end gap-2">
889        <button value="cancel" class="btn btn-secondary">Annuler</button>
890        <button value="confirm" class="btn btn-gold">Confirmer</button>
891      </div>
892    </form>`,qs.addEventListener("click",n=>{n.target===qs&&qs.close("cancel")}),document.body.appendChild(qs)}Mu.setConfirmMethod((t,e)=>{(!qs||!qs.isConnected)&&Y4();let i=e?.dataset?.turboConfirmVariant==="danger",n=qs.querySelector('[value="confirm"]');return n.className=i?"btn btn-danger":"btn btn-gold",qs.querySelector("[data-confirm-message]").textContent=t,qs.returnValue="",qs.showModal(),new Promise(a=>{qs.addEventListener("close",()=>a(qs.returnValue==="confirm"),{once:!0})})});
893/*! Bundled license information:
894
895lodash/lodash.js:
896  (**
897   * @license
898   * Lodash <https://lodash.com/>
899   * Copyright OpenJS Foundation and other contributors <https://
899openjsf.org/>
900   * Released under MIT license <https://lodash.com/license>
901   * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
902   * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
903   *)
904
905maplibre-gl/dist/maplibre-gl.js:
906  (**
907   * MapLibre GL JS
908   * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt
909   *)
910
911@kurkle/color/dist/color.esm.js:
912  (*!
913   * @kurkle/color v0.3.4
914   * https://github.com/kurkle/color#readme
915   * (c) 2024 Jukka Kurkela
916   * Released under the MIT License
917   *)
918
919chart.js/dist/chunks/helpers.segment.js:
920  (*!
921   * Chart.js v4.4.8
922   * https://www.chartjs.org
923   * (c) 2025 Chart.js Contributors
924   * Released under the MIT License
925   *)
926
927chart.js/dist/chart.js:
928  (*!
929   * Chart.js v4.4.8
930   * https://www.chartjs.org
931   * (c) 2025 Chart.js Contributors
932   * Released under the MIT License
933   *)
934
935chart.js/dist/helpers.js:
936  (*!
937   * Chart.js v4.4.8
938   * https://www.chartjs.org
939   * (c) 2025 Chart.js Contributors
940   * Released under the MIT License
941   *)
942
943chartjs-plugin-annotation/dist/chartjs-plugin-annotation.esm.js:
944  (*!
945  * chartjs-plugin-annotation v3.1.0
946  * https://www.chartjs.org/chartjs-plugin-annotation/index
947   * (c) 2024 chartjs-plugin-annotation Contributors
948   * Released under the MIT License
949   *)
950*/
951//# sourceMappingURL=/assets/application-f76e44d6.js.map

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