openms-insight 0.1.9__py3-none-any.whl → 0.1.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openms_insight/__init__.py +1 -1
- openms_insight/components/heatmap.py +24 -6
- openms_insight/components/sequenceview.py +20 -0
- openms_insight/components/table.py +170 -32
- openms_insight/js-component/dist/assets/index.css +1 -1
- openms_insight/js-component/dist/assets/index.js +3 -3
- openms_insight/preprocessing/compression.py +9 -4
- openms_insight/rendering/bridge.py +178 -13
- {openms_insight-0.1.9.dist-info → openms_insight-0.1.11.dist-info}/METADATA +21 -1
- {openms_insight-0.1.9.dist-info → openms_insight-0.1.11.dist-info}/RECORD +12 -12
- {openms_insight-0.1.9.dist-info → openms_insight-0.1.11.dist-info}/WHEEL +0 -0
- {openms_insight-0.1.9.dist-info → openms_insight-0.1.11.dist-info}/licenses/LICENSE +0 -0
|
@@ -52,7 +52,7 @@ object-assign
|
|
|
52
52
|
background-color: var(--background-color);
|
|
53
53
|
color: var(--text-color);
|
|
54
54
|
}
|
|
55
|
-
`)};function kj(t){var e=!1;try{e=t instanceof BigInt64Array||t instanceof BigUint64Array}catch{}return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array||e}var Sj=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,R){u.__proto__=R}||function(u,R){for(var p in R)Object.prototype.hasOwnProperty.call(R,p)&&(u[p]=R[p])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function u(){this.constructor=e}e.prototype=r===null?Object.create(r):(u.prototype=r.prototype,new u)}}();(function(t){Sj(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.componentDidMount=function(){Hc.setFrameHeight()},e.prototype.componentDidUpdate=function(){Hc.setFrameHeight()},e})(FB.PureComponent);const Aj=new TextDecoder("utf-8"),Cj=t=>Aj.decode(t),Mj=new TextEncoder,b7=t=>Mj.encode(t),rv=t=>typeof t=="function",x7=t=>t!=null&&Object(t)===t,Ej=t=>x7(t)&&"done"in t&&"value"in t,Ij=t=>x7(t)&&rv(t.clear)&&rv(t.bytes)&&rv(t.position)&&rv(t.setPosition)&&rv(t.capacity)&&rv(t.getBufferIdentifier)&&rv(t.createLong),Lj=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function _7(t,e){let r=Ej(e)?e.value:e;return r instanceof t?t===Uint8Array?new t(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=b7(r)),r instanceof ArrayBuffer?new t(r):r instanceof Lj?new t(r):Ij(r)?_7(t,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new t(0):new t(r.buffer,r.byteOffset,r.byteLength/t.BYTES_PER_ELEMENT):t.from(r)):new t(0)}function Pj(t,e){let r=0;const u=t.length;if(u!==e.length)return!1;if(u>0)do if(t[r]!==e[r])return!1;while(++r<u);return!0}var dp;(function(t){t[t.Sparse=0]="Sparse",t[t.Dense=1]="Dense"})(dp||(dp={}));var Of;(function(t){t[t.HALF=0]="HALF",t[t.SINGLE=1]="SINGLE",t[t.DOUBLE=2]="DOUBLE"})(Of||(Of={}));var dg;(function(t){t[t.DAY=0]="DAY",t[t.MILLISECOND=1]="MILLISECOND"})(dg||(dg={}));var Ja;(function(t){t[t.SECOND=0]="SECOND",t[t.MILLISECOND=1]="MILLISECOND",t[t.MICROSECOND=2]="MICROSECOND",t[t.NANOSECOND=3]="NANOSECOND"})(Ja||(Ja={}));var Iv;(function(t){t[t.YEAR_MONTH=0]="YEAR_MONTH",t[t.DAY_TIME=1]="DAY_TIME",t[t.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Iv||(Iv={}));var _r;(function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Duration=18]="Duration",t[t.LargeBinary=19]="LargeBinary",t[t.LargeUtf8=20]="LargeUtf8",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth",t[t.DurationSecond=-27]="DurationSecond",t[t.DurationMillisecond=-28]="DurationMillisecond",t[t.DurationMicrosecond=-29]="DurationMicrosecond",t[t.DurationNanosecond=-30]="DurationNanosecond"})(_r||(_r={}));var jp;(function(t){t[t.OFFSET=0]="OFFSET",t[t.DATA=1]="DATA",t[t.VALIDITY=2]="VALIDITY",t[t.TYPE=3]="TYPE"})(jp||(jp={}));const Dj=void 0;function Cb(t){if(t===null)return"null";if(t===Dj)return"undefined";switch(typeof t){case"number":return`${t}`;case"bigint":return`${t}`;case"string":return`"${t}"`}return typeof t[Symbol.toPrimitive]=="function"?t[Symbol.toPrimitive]("string"):ArrayBuffer.isView(t)?t instanceof BigInt64Array||t instanceof BigUint64Array?`[${[...t].map(e=>Cb(e))}]`:`[${t}]`:ArrayBuffer.isView(t)?`[${t}]`:JSON.stringify(t,(e,r)=>typeof r=="bigint"?`${r}`:r)}function Xh(t){if(typeof t=="bigint"&&(t<Number.MIN_SAFE_INTEGER||t>Number.MAX_SAFE_INTEGER))throw new TypeError(`${t} is not safe to convert to a number.`);return Number(t)}function w7(t,e){return Xh(t/e)+Xh(t%e)/Xh(e)}const Rj=Symbol.for("isArrowBigNum");function Pd(t,...e){return e.length===0?Object.setPrototypeOf(_7(this.TypedArray,t),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(t,...e),this.constructor.prototype)}Pd.prototype[Rj]=!0;Pd.prototype.toJSON=function(){return`"${Eb(this)}"`};Pd.prototype.valueOf=function(t){return T7(this,t)};Pd.prototype.toString=function(){return Eb(this)};Pd.prototype[Symbol.toPrimitive]=function(t="default"){switch(t){case"number":return T7(this);case"string":return Eb(this);case"default":return Fj(this)}return Eb(this)};function ly(...t){return Pd.apply(this,t)}function uy(...t){return Pd.apply(this,t)}function Mb(...t){return Pd.apply(this,t)}Object.setPrototypeOf(ly.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(uy.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Mb.prototype,Object.create(Uint32Array.prototype));Object.assign(ly.prototype,Pd.prototype,{constructor:ly,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(uy.prototype,Pd.prototype,{constructor:uy,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Mb.prototype,Pd.prototype,{constructor:Mb,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const Oj=BigInt(4294967296)*BigInt(4294967296),zj=Oj-BigInt(1);function T7(t,e){const{buffer:r,byteOffset:u,byteLength:R,signed:p}=t,f=new BigUint64Array(r,u,R/8),n=p&&f.at(-1)&BigInt(1)<<BigInt(63);let l=BigInt(0),c=0;if(n){for(const i of f)l|=(i^zj)*(BigInt(1)<<BigInt(64*c++));l*=BigInt(-1),l-=BigInt(1)}else for(const i of f)l|=i*(BigInt(1)<<BigInt(64*c++));if(typeof e=="number"){const i=BigInt(Math.pow(10,e)),_=l/i,b=l%i;return Xh(_)+Xh(b)/Xh(i)}return Xh(l)}function Eb(t){if(t.byteLength===8)return`${new t.BigIntArray(t.buffer,t.byteOffset,1)[0]}`;if(!t.signed)return p5(t);let e=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2);if(new Int16Array([e.at(-1)])[0]>=0)return p5(t);e=e.slice();let u=1;for(let p=0;p<e.length;p++){const f=e[p],n=~f+u;e[p]=n,u&=f===0?1:0}return`-${p5(e)}`}function Fj(t){return t.byteLength===8?new t.BigIntArray(t.buffer,t.byteOffset,1)[0]:Eb(t)}function p5(t){let e="";const r=new Uint32Array(2);let u=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2);const R=new Uint32Array((u=new Uint16Array(u).reverse()).buffer);let p=-1;const f=u.length-1;do{for(r[0]=u[p=0];p<f;)u[p++]=r[1]=r[0]/10,r[0]=(r[0]-r[1]*10<<16)+u[p];u[p]=r[1]=r[0]/10,r[0]=r[0]-r[1]*10,e=`${r[0]}${e}`}while(R[0]||R[1]||R[2]||R[3]);return e??"0"}class B4{static new(e,r){switch(r){case!0:return new ly(e);case!1:return new uy(e)}switch(e.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new ly(e)}return e.byteLength===16?new Mb(e):new uy(e)}static signed(e){return new ly(e)}static unsigned(e){return new uy(e)}static decimal(e){return new Mb(e)}constructor(e,r){return B4.new(e,r)}}var k7,S7,A7,C7,M7,E7,I7,L7,P7,D7,R7,O7,z7,F7,B7,N7,V7,j7,U7,H7,q7,W7;class so{static isNull(e){return(e==null?void 0:e.typeId)===_r.Null}static isInt(e){return(e==null?void 0:e.typeId)===_r.Int}static isFloat(e){return(e==null?void 0:e.typeId)===_r.Float}static isBinary(e){return(e==null?void 0:e.typeId)===_r.Binary}static isLargeBinary(e){return(e==null?void 0:e.typeId)===_r.LargeBinary}static isUtf8(e){return(e==null?void 0:e.typeId)===_r.Utf8}static isLargeUtf8(e){return(e==null?void 0:e.typeId)===_r.LargeUtf8}static isBool(e){return(e==null?void 0:e.typeId)===_r.Bool}static isDecimal(e){return(e==null?void 0:e.typeId)===_r.Decimal}static isDate(e){return(e==null?void 0:e.typeId)===_r.Date}static isTime(e){return(e==null?void 0:e.typeId)===_r.Time}static isTimestamp(e){return(e==null?void 0:e.typeId)===_r.Timestamp}static isInterval(e){return(e==null?void 0:e.typeId)===_r.Interval}static isDuration(e){return(e==null?void 0:e.typeId)===_r.Duration}static isList(e){return(e==null?void 0:e.typeId)===_r.List}static isStruct(e){return(e==null?void 0:e.typeId)===_r.Struct}static isUnion(e){return(e==null?void 0:e.typeId)===_r.Union}static isFixedSizeBinary(e){return(e==null?void 0:e.typeId)===_r.FixedSizeBinary}static isFixedSizeList(e){return(e==null?void 0:e.typeId)===_r.FixedSizeList}static isMap(e){return(e==null?void 0:e.typeId)===_r.Map}static isDictionary(e){return(e==null?void 0:e.typeId)===_r.Dictionary}static isDenseUnion(e){return so.isUnion(e)&&e.mode===dp.Dense}static isSparseUnion(e){return so.isUnion(e)&&e.mode===dp.Sparse}constructor(e){this.typeId=e}}k7=Symbol.toStringTag;so[k7]=(t=>(t.children=null,t.ArrayType=Array,t.OffsetArrayType=Int32Array,t[Symbol.toStringTag]="DataType"))(so.prototype);class PC extends so{constructor(){super(_r.Null)}toString(){return"Null"}}S7=Symbol.toStringTag;PC[S7]=(t=>t[Symbol.toStringTag]="Null")(PC.prototype);class DC extends so{constructor(e,r){super(_r.Int),this.isSigned=e,this.bitWidth=r}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}A7=Symbol.toStringTag;DC[A7]=(t=>(t.isSigned=null,t.bitWidth=null,t[Symbol.toStringTag]="Int"))(DC.prototype);class RC extends so{constructor(e){super(_r.Float),this.precision=e}get ArrayType(){switch(this.precision){case Of.HALF:return Uint16Array;case Of.SINGLE:return Float32Array;case Of.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}C7=Symbol.toStringTag;RC[C7]=(t=>(t.precision=null,t[Symbol.toStringTag]="Float"))(RC.prototype);class OC extends so{constructor(){super(_r.Binary)}toString(){return"Binary"}}M7=Symbol.toStringTag;OC[M7]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Binary"))(OC.prototype);class zC extends so{constructor(){super(_r.LargeBinary)}toString(){return"LargeBinary"}}E7=Symbol.toStringTag;zC[E7]=(t=>(t.ArrayType=Uint8Array,t.OffsetArrayType=BigInt64Array,t[Symbol.toStringTag]="LargeBinary"))(zC.prototype);class FC extends so{constructor(){super(_r.Utf8)}toString(){return"Utf8"}}I7=Symbol.toStringTag;FC[I7]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Utf8"))(FC.prototype);class BC extends so{constructor(){super(_r.LargeUtf8)}toString(){return"LargeUtf8"}}L7=Symbol.toStringTag;BC[L7]=(t=>(t.ArrayType=Uint8Array,t.OffsetArrayType=BigInt64Array,t[Symbol.toStringTag]="LargeUtf8"))(BC.prototype);class NC extends so{constructor(){super(_r.Bool)}toString(){return"Bool"}}P7=Symbol.toStringTag;NC[P7]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Bool"))(NC.prototype);class VC extends so{constructor(e,r,u=128){super(_r.Decimal),this.scale=e,this.precision=r,this.bitWidth=u}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}D7=Symbol.toStringTag;VC[D7]=(t=>(t.scale=null,t.precision=null,t.ArrayType=Uint32Array,t[Symbol.toStringTag]="Decimal"))(VC.prototype);class jC extends so{constructor(e){super(_r.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${dg[this.unit]}>`}get ArrayType(){return this.unit===dg.DAY?Int32Array:BigInt64Array}}R7=Symbol.toStringTag;jC[R7]=(t=>(t.unit=null,t[Symbol.toStringTag]="Date"))(jC.prototype);class UC extends so{constructor(e,r){super(_r.Time),this.unit=e,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${Ja[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}O7=Symbol.toStringTag;UC[O7]=(t=>(t.unit=null,t.bitWidth=null,t[Symbol.toStringTag]="Time"))(UC.prototype);class HC extends so{constructor(e,r){super(_r.Timestamp),this.unit=e,this.timezone=r}toString(){return`Timestamp<${Ja[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}z7=Symbol.toStringTag;HC[z7]=(t=>(t.unit=null,t.timezone=null,t.ArrayType=BigInt64Array,t[Symbol.toStringTag]="Timestamp"))(HC.prototype);class qC extends so{constructor(e){super(_r.Interval),this.unit=e}toString(){return`Interval<${Iv[this.unit]}>`}}F7=Symbol.toStringTag;qC[F7]=(t=>(t.unit=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Interval"))(qC.prototype);class WC extends so{constructor(e){super(_r.Duration),this.unit=e}toString(){return`Duration<${Ja[this.unit]}>`}}B7=Symbol.toStringTag;WC[B7]=(t=>(t.unit=null,t.ArrayType=BigInt64Array,t[Symbol.toStringTag]="Duration"))(WC.prototype);class GC extends so{constructor(e){super(_r.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}N7=Symbol.toStringTag;GC[N7]=(t=>(t.children=null,t[Symbol.toStringTag]="List"))(GC.prototype);class $C extends so{constructor(e){super(_r.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}V7=Symbol.toStringTag;$C[V7]=(t=>(t.children=null,t[Symbol.toStringTag]="Struct"))($C.prototype);class YC extends so{constructor(e,r,u){super(_r.Union),this.mode=e,this.children=u,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((R,p,f)=>(R[p]=f)&&R||R,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(" | ")}>`}}j7=Symbol.toStringTag;YC[j7]=(t=>(t.mode=null,t.typeIds=null,t.children=null,t.typeIdToChildIndex=null,t.ArrayType=Int8Array,t[Symbol.toStringTag]="Union"))(YC.prototype);class ZC extends so{constructor(e){super(_r.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}U7=Symbol.toStringTag;ZC[U7]=(t=>(t.byteWidth=null,t.ArrayType=Uint8Array,t[Symbol.toStringTag]="FixedSizeBinary"))(ZC.prototype);class XC extends so{constructor(e,r){super(_r.FixedSizeList),this.listSize=e,this.children=[r]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}H7=Symbol.toStringTag;XC[H7]=(t=>(t.children=null,t.listSize=null,t[Symbol.toStringTag]="FixedSizeList"))(XC.prototype);class KC extends so{constructor(e,r=!1){var u,R,p;if(super(_r.Map),this.children=[e],this.keysSorted=r,e&&(e.name="entries",!((u=e==null?void 0:e.type)===null||u===void 0)&&u.children)){const f=(R=e==null?void 0:e.type)===null||R===void 0?void 0:R.children[0];f&&(f.name="key");const n=(p=e==null?void 0:e.type)===null||p===void 0?void 0:p.children[1];n&&(n.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}q7=Symbol.toStringTag;KC[q7]=(t=>(t.children=null,t.keysSorted=null,t[Symbol.toStringTag]="Map_"))(KC.prototype);const Bj=(t=>()=>++t)(-1);class JC extends so{constructor(e,r,u,R){super(_r.Dictionary),this.indices=r,this.dictionary=e,this.isOrdered=R||!1,this.id=u==null?Bj():Xh(u)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}W7=Symbol.toStringTag;JC[W7]=(t=>(t.id=null,t.indices=null,t.isOrdered=null,t.dictionary=null,t[Symbol.toStringTag]="Dictionary"))(JC.prototype);function G7(t){const e=t;switch(t.typeId){case _r.Decimal:return t.bitWidth/32;case _r.Interval:return 1+e.unit;case _r.FixedSizeList:return e.listSize;case _r.FixedSizeBinary:return e.byteWidth;default:return 1}}class zo{visitMany(e,...r){return e.map((u,R)=>this.visit(u,...r.map(p=>p[R])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,r=!0){return Nj(this,e,r)}getVisitFnByTypeId(e,r=!0){return V0(this,e,r)}visitNull(e,...r){return null}visitBool(e,...r){return null}visitInt(e,...r){return null}visitFloat(e,...r){return null}visitUtf8(e,...r){return null}visitLargeUtf8(e,...r){return null}visitBinary(e,...r){return null}visitLargeBinary(e,...r){return null}visitFixedSizeBinary(e,...r){return null}visitDate(e,...r){return null}visitTimestamp(e,...r){return null}visitTime(e,...r){return null}visitDecimal(e,...r){return null}visitList(e,...r){return null}visitStruct(e,...r){return null}visitUnion(e,...r){return null}visitDictionary(e,...r){return null}visitInterval(e,...r){return null}visitDuration(e,...r){return null}visitFixedSizeList(e,...r){return null}visitMap(e,...r){return null}}function Nj(t,e,r=!0){return typeof e=="number"?V0(t,e,r):typeof e=="string"&&e in _r?V0(t,_r[e],r):e&&e instanceof so?V0(t,QC(e),r):e!=null&&e.type&&e.type instanceof so?V0(t,QC(e.type),r):V0(t,_r.NONE,r)}function V0(t,e,r=!0){let u=null;switch(e){case _r.Null:u=t.visitNull;break;case _r.Bool:u=t.visitBool;break;case _r.Int:u=t.visitInt;break;case _r.Int8:u=t.visitInt8||t.visitInt;break;case _r.Int16:u=t.visitInt16||t.visitInt;break;case _r.Int32:u=t.visitInt32||t.visitInt;break;case _r.Int64:u=t.visitInt64||t.visitInt;break;case _r.Uint8:u=t.visitUint8||t.visitInt;break;case _r.Uint16:u=t.visitUint16||t.visitInt;break;case _r.Uint32:u=t.visitUint32||t.visitInt;break;case _r.Uint64:u=t.visitUint64||t.visitInt;break;case _r.Float:u=t.visitFloat;break;case _r.Float16:u=t.visitFloat16||t.visitFloat;break;case _r.Float32:u=t.visitFloat32||t.visitFloat;break;case _r.Float64:u=t.visitFloat64||t.visitFloat;break;case _r.Utf8:u=t.visitUtf8;break;case _r.LargeUtf8:u=t.visitLargeUtf8;break;case _r.Binary:u=t.visitBinary;break;case _r.LargeBinary:u=t.visitLargeBinary;break;case _r.FixedSizeBinary:u=t.visitFixedSizeBinary;break;case _r.Date:u=t.visitDate;break;case _r.DateDay:u=t.visitDateDay||t.visitDate;break;case _r.DateMillisecond:u=t.visitDateMillisecond||t.visitDate;break;case _r.Timestamp:u=t.visitTimestamp;break;case _r.TimestampSecond:u=t.visitTimestampSecond||t.visitTimestamp;break;case _r.TimestampMillisecond:u=t.visitTimestampMillisecond||t.visitTimestamp;break;case _r.TimestampMicrosecond:u=t.visitTimestampMicrosecond||t.visitTimestamp;break;case _r.TimestampNanosecond:u=t.visitTimestampNanosecond||t.visitTimestamp;break;case _r.Time:u=t.visitTime;break;case _r.TimeSecond:u=t.visitTimeSecond||t.visitTime;break;case _r.TimeMillisecond:u=t.visitTimeMillisecond||t.visitTime;break;case _r.TimeMicrosecond:u=t.visitTimeMicrosecond||t.visitTime;break;case _r.TimeNanosecond:u=t.visitTimeNanosecond||t.visitTime;break;case _r.Decimal:u=t.visitDecimal;break;case _r.List:u=t.visitList;break;case _r.Struct:u=t.visitStruct;break;case _r.Union:u=t.visitUnion;break;case _r.DenseUnion:u=t.visitDenseUnion||t.visitUnion;break;case _r.SparseUnion:u=t.visitSparseUnion||t.visitUnion;break;case _r.Dictionary:u=t.visitDictionary;break;case _r.Interval:u=t.visitInterval;break;case _r.IntervalDayTime:u=t.visitIntervalDayTime||t.visitInterval;break;case _r.IntervalYearMonth:u=t.visitIntervalYearMonth||t.visitInterval;break;case _r.Duration:u=t.visitDuration;break;case _r.DurationSecond:u=t.visitDurationSecond||t.visitDuration;break;case _r.DurationMillisecond:u=t.visitDurationMillisecond||t.visitDuration;break;case _r.DurationMicrosecond:u=t.visitDurationMicrosecond||t.visitDuration;break;case _r.DurationNanosecond:u=t.visitDurationNanosecond||t.visitDuration;break;case _r.FixedSizeList:u=t.visitFixedSizeList;break;case _r.Map:u=t.visitMap;break}if(typeof u=="function")return u;if(!r)return()=>null;throw new Error(`Unrecognized type '${_r[e]}'`)}function QC(t){switch(t.typeId){case _r.Null:return _r.Null;case _r.Int:{const{bitWidth:e,isSigned:r}=t;switch(e){case 8:return r?_r.Int8:_r.Uint8;case 16:return r?_r.Int16:_r.Uint16;case 32:return r?_r.Int32:_r.Uint32;case 64:return r?_r.Int64:_r.Uint64}return _r.Int}case _r.Float:switch(t.precision){case Of.HALF:return _r.Float16;case Of.SINGLE:return _r.Float32;case Of.DOUBLE:return _r.Float64}return _r.Float;case _r.Binary:return _r.Binary;case _r.LargeBinary:return _r.LargeBinary;case _r.Utf8:return _r.Utf8;case _r.LargeUtf8:return _r.LargeUtf8;case _r.Bool:return _r.Bool;case _r.Decimal:return _r.Decimal;case _r.Time:switch(t.unit){case Ja.SECOND:return _r.TimeSecond;case Ja.MILLISECOND:return _r.TimeMillisecond;case Ja.MICROSECOND:return _r.TimeMicrosecond;case Ja.NANOSECOND:return _r.TimeNanosecond}return _r.Time;case _r.Timestamp:switch(t.unit){case Ja.SECOND:return _r.TimestampSecond;case Ja.MILLISECOND:return _r.TimestampMillisecond;case Ja.MICROSECOND:return _r.TimestampMicrosecond;case Ja.NANOSECOND:return _r.TimestampNanosecond}return _r.Timestamp;case _r.Date:switch(t.unit){case dg.DAY:return _r.DateDay;case dg.MILLISECOND:return _r.DateMillisecond}return _r.Date;case _r.Interval:switch(t.unit){case Iv.DAY_TIME:return _r.IntervalDayTime;case Iv.YEAR_MONTH:return _r.IntervalYearMonth}return _r.Interval;case _r.Duration:switch(t.unit){case Ja.SECOND:return _r.DurationSecond;case Ja.MILLISECOND:return _r.DurationMillisecond;case Ja.MICROSECOND:return _r.DurationMicrosecond;case Ja.NANOSECOND:return _r.DurationNanosecond}return _r.Duration;case _r.Map:return _r.Map;case _r.List:return _r.List;case _r.Struct:return _r.Struct;case _r.Union:switch(t.mode){case dp.Dense:return _r.DenseUnion;case dp.Sparse:return _r.SparseUnion}return _r.Union;case _r.FixedSizeBinary:return _r.FixedSizeBinary;case _r.FixedSizeList:return _r.FixedSizeList;case _r.Dictionary:return _r.Dictionary}throw new Error(`Unrecognized type '${_r[t.typeId]}'`)}zo.prototype.visitInt8=null;zo.prototype.visitInt16=null;zo.prototype.visitInt32=null;zo.prototype.visitInt64=null;zo.prototype.visitUint8=null;zo.prototype.visitUint16=null;zo.prototype.visitUint32=null;zo.prototype.visitUint64=null;zo.prototype.visitFloat16=null;zo.prototype.visitFloat32=null;zo.prototype.visitFloat64=null;zo.prototype.visitDateDay=null;zo.prototype.visitDateMillisecond=null;zo.prototype.visitTimestampSecond=null;zo.prototype.visitTimestampMillisecond=null;zo.prototype.visitTimestampMicrosecond=null;zo.prototype.visitTimestampNanosecond=null;zo.prototype.visitTimeSecond=null;zo.prototype.visitTimeMillisecond=null;zo.prototype.visitTimeMicrosecond=null;zo.prototype.visitTimeNanosecond=null;zo.prototype.visitDenseUnion=null;zo.prototype.visitSparseUnion=null;zo.prototype.visitIntervalDayTime=null;zo.prototype.visitIntervalYearMonth=null;zo.prototype.visitDuration=null;zo.prototype.visitDurationSecond=null;zo.prototype.visitDurationMillisecond=null;zo.prototype.visitDurationMicrosecond=null;zo.prototype.visitDurationNanosecond=null;const $7=new Float64Array(1),C0=new Uint32Array($7.buffer);function Y7(t){const e=(t&31744)>>10,r=(t&1023)/1024,u=Math.pow(-1,(t&32768)>>15);switch(e){case 31:return u*(r?Number.NaN:1/0);case 0:return u*(r?6103515625e-14*r:0)}return u*Math.pow(2,e-15)*(1+r)}function Vj(t){if(t!==t)return 32256;$7[0]=t;const e=(C0[1]&2147483648)>>16&65535;let r=C0[1]&2146435072,u=0;return r>=1089470464?C0[0]>0?r=31744:(r=(r&2080374784)>>16,u=(C0[1]&1048575)>>10):r<=1056964608?(u=1048576+(C0[1]&1048575),u=1048576+(u<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,u=(C0[1]&1048575)+512>>10),e|r|u&65535}class da extends zo{}function ya(t){return(e,r,u)=>{if(e.setValid(r,u!=null))return t(e,r,u)}}const jj=(t,e,r)=>{t[e]=Math.floor(r/864e5)},Z7=(t,e,r,u)=>{if(r+1<e.length){const R=Xh(e[r]),p=Xh(e[r+1]);t.set(u.subarray(0,p-R),R)}},Uj=({offset:t,values:e},r,u)=>{const R=t+r;u?e[R>>3]|=1<<R%8:e[R>>3]&=~(1<<R%8)},fm=({values:t},e,r)=>{t[e]=r},N4=({values:t},e,r)=>{t[e]=r},X7=({values:t},e,r)=>{t[e]=Vj(r)},Hj=(t,e,r)=>{switch(t.type.precision){case Of.HALF:return X7(t,e,r);case Of.SINGLE:case Of.DOUBLE:return N4(t,e,r)}},K7=({values:t},e,r)=>{jj(t,e,r.valueOf())},J7=({values:t},e,r)=>{t[e]=BigInt(r)},qj=({stride:t,values:e},r,u)=>{e.set(u.subarray(0,t),t*r)},Q7=({values:t,valueOffsets:e},r,u)=>Z7(t,e,r,u),eL=({values:t,valueOffsets:e},r,u)=>Z7(t,e,r,b7(u)),Wj=(t,e,r)=>{t.type.unit===dg.DAY?K7(t,e,r):J7(t,e,r)},tL=({values:t},e,r)=>{t[e]=BigInt(r/1e3)},nL=({values:t},e,r)=>{t[e]=BigInt(r)},rL=({values:t},e,r)=>{t[e]=BigInt(r*1e3)},iL=({values:t},e,r)=>{t[e]=BigInt(r*1e6)},Gj=(t,e,r)=>{switch(t.type.unit){case Ja.SECOND:return tL(t,e,r);case Ja.MILLISECOND:return nL(t,e,r);case Ja.MICROSECOND:return rL(t,e,r);case Ja.NANOSECOND:return iL(t,e,r)}},aL=({values:t},e,r)=>{t[e]=r},oL=({values:t},e,r)=>{t[e]=r},sL=({values:t},e,r)=>{t[e]=r},lL=({values:t},e,r)=>{t[e]=r},$j=(t,e,r)=>{switch(t.type.unit){case Ja.SECOND:return aL(t,e,r);case Ja.MILLISECOND:return oL(t,e,r);case Ja.MICROSECOND:return sL(t,e,r);case Ja.NANOSECOND:return lL(t,e,r)}},Yj=({values:t,stride:e},r,u)=>{t.set(u.subarray(0,e),e*r)},Zj=(t,e,r)=>{const u=t.children[0],R=t.valueOffsets,p=pp.getVisitFn(u);if(Array.isArray(r))for(let f=-1,n=R[e],l=R[e+1];n<l;)p(u,n++,r[++f]);else for(let f=-1,n=R[e],l=R[e+1];n<l;)p(u,n++,r.get(++f))},Xj=(t,e,r)=>{const u=t.children[0],{valueOffsets:R}=t,p=pp.getVisitFn(u);let{[e]:f,[e+1]:n}=R;const l=r instanceof Map?r.entries():Object.entries(r);for(const c of l)if(p(u,f,c),++f>=n)break},Kj=(t,e)=>(r,u,R,p)=>u&&r(u,t,e[p]),Jj=(t,e)=>(r,u,R,p)=>u&&r(u,t,e.get(p)),Qj=(t,e)=>(r,u,R,p)=>u&&r(u,t,e.get(R.name)),eU=(t,e)=>(r,u,R,p)=>u&&r(u,t,e[R.name]),tU=(t,e,r)=>{const u=t.type.children.map(p=>pp.getVisitFn(p.type)),R=r instanceof Map?Qj(e,r):r instanceof qc?Jj(e,r):Array.isArray(r)?Kj(e,r):eU(e,r);t.type.children.forEach((p,f)=>R(u[f],t.children[f],p,f))},nU=(t,e,r)=>{t.type.mode===dp.Dense?uL(t,e,r):cL(t,e,r)},uL=(t,e,r)=>{const u=t.type.typeIdToChildIndex[t.typeIds[e]],R=t.children[u];pp.visit(R,t.valueOffsets[e],r)},cL=(t,e,r)=>{const u=t.type.typeIdToChildIndex[t.typeIds[e]],R=t.children[u];pp.visit(R,e,r)},rU=(t,e,r)=>{var u;(u=t.dictionary)===null||u===void 0||u.set(t.values[e],r)},iU=(t,e,r)=>{t.type.unit===Iv.DAY_TIME?hL(t,e,r):fL(t,e,r)},hL=({values:t},e,r)=>{t.set(r.subarray(0,2),2*e)},fL=({values:t},e,r)=>{t[e]=r[0]*12+r[1]%12},dL=({values:t},e,r)=>{t[e]=r},pL=({values:t},e,r)=>{t[e]=r},mL=({values:t},e,r)=>{t[e]=r},gL=({values:t},e,r)=>{t[e]=r},aU=(t,e,r)=>{switch(t.type.unit){case Ja.SECOND:return dL(t,e,r);case Ja.MILLISECOND:return pL(t,e,r);case Ja.MICROSECOND:return mL(t,e,r);case Ja.NANOSECOND:return gL(t,e,r)}},oU=(t,e,r)=>{const{stride:u}=t,R=t.children[0],p=pp.getVisitFn(R);if(Array.isArray(r))for(let f=-1,n=e*u;++f<u;)p(R,n+f,r[f]);else for(let f=-1,n=e*u;++f<u;)p(R,n+f,r.get(f))};da.prototype.visitBool=ya(Uj);da.prototype.visitInt=ya(fm);da.prototype.visitInt8=ya(fm);da.prototype.visitInt16=ya(fm);da.prototype.visitInt32=ya(fm);da.prototype.visitInt64=ya(fm);da.prototype.visitUint8=ya(fm);da.prototype.visitUint16=ya(fm);da.prototype.visitUint32=ya(fm);da.prototype.visitUint64=ya(fm);da.prototype.visitFloat=ya(Hj);da.prototype.visitFloat16=ya(X7);da.prototype.visitFloat32=ya(N4);da.prototype.visitFloat64=ya(N4);da.prototype.visitUtf8=ya(eL);da.prototype.visitLargeUtf8=ya(eL);da.prototype.visitBinary=ya(Q7);da.prototype.visitLargeBinary=ya(Q7);da.prototype.visitFixedSizeBinary=ya(qj);da.prototype.visitDate=ya(Wj);da.prototype.visitDateDay=ya(K7);da.prototype.visitDateMillisecond=ya(J7);da.prototype.visitTimestamp=ya(Gj);da.prototype.visitTimestampSecond=ya(tL);da.prototype.visitTimestampMillisecond=ya(nL);da.prototype.visitTimestampMicrosecond=ya(rL);da.prototype.visitTimestampNanosecond=ya(iL);da.prototype.visitTime=ya($j);da.prototype.visitTimeSecond=ya(aL);da.prototype.visitTimeMillisecond=ya(oL);da.prototype.visitTimeMicrosecond=ya(sL);da.prototype.visitTimeNanosecond=ya(lL);da.prototype.visitDecimal=ya(Yj);da.prototype.visitList=ya(Zj);da.prototype.visitStruct=ya(tU);da.prototype.visitUnion=ya(nU);da.prototype.visitDenseUnion=ya(uL);da.prototype.visitSparseUnion=ya(cL);da.prototype.visitDictionary=ya(rU);da.prototype.visitInterval=ya(iU);da.prototype.visitIntervalDayTime=ya(hL);da.prototype.visitIntervalYearMonth=ya(fL);da.prototype.visitDuration=ya(aU);da.prototype.visitDurationSecond=ya(dL);da.prototype.visitDurationMillisecond=ya(pL);da.prototype.visitDurationMicrosecond=ya(mL);da.prototype.visitDurationNanosecond=ya(gL);da.prototype.visitFixedSizeList=ya(oU);da.prototype.visitMap=ya(Xj);const pp=new da,bd=Symbol.for("parent"),cy=Symbol.for("rowIndex");class V4{constructor(e,r){return this[bd]=e,this[cy]=r,new Proxy(this,new lU)}toArray(){return Object.values(this.toJSON())}toJSON(){const e=this[cy],r=this[bd],u=r.type.children,R={};for(let p=-1,f=u.length;++p<f;)R[u[p].name]=ad.visit(r.children[p],e);return R}toString(){return`{${[...this].map(([e,r])=>`${Cb(e)}: ${Cb(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new sU(this[bd],this[cy])}}class sU{constructor(e,r){this.childIndex=0,this.children=e.children,this.rowIndex=r,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const e=this.childIndex;return e<this.numChildren?(this.childIndex=e+1,{done:!1,value:[this.childFields[e].name,ad.visit(this.children[e],this.rowIndex)]}):{done:!0,value:null}}}Object.defineProperties(V4.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[bd]:{writable:!0,enumerable:!1,configurable:!1,value:null},[cy]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class lU{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[bd].type.children.map(r=>r.name)}has(e,r){return e[bd].type.children.findIndex(u=>u.name===r)!==-1}getOwnPropertyDescriptor(e,r){if(e[bd].type.children.findIndex(u=>u.name===r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,r){if(Reflect.has(e,r))return e[r];const u=e[bd].type.children.findIndex(R=>R.name===r);if(u!==-1){const R=ad.visit(e[bd].children[u],e[cy]);return Reflect.set(e,r,R),R}}set(e,r,u){const R=e[bd].type.children.findIndex(p=>p.name===r);return R!==-1?(pp.visit(e[bd].children[R],e[cy],u),Reflect.set(e,r,u)):Reflect.has(e,r)||typeof r=="symbol"?Reflect.set(e,r,u):!1}}class ua extends zo{}function pa(t){return(e,r)=>e.getValid(r)?t(e,r):null}const uU=(t,e)=>864e5*t[e],cU=(t,e)=>null,vL=(t,e,r)=>{if(r+1>=e.length)return null;const u=Xh(e[r]),R=Xh(e[r+1]);return t.subarray(u,R)},hU=({offset:t,values:e},r)=>{const u=t+r;return(e[u>>3]&1<<u%8)!==0},yL=({values:t},e)=>uU(t,e),bL=({values:t},e)=>Xh(t[e]),Ag=({stride:t,values:e},r)=>e[t*r],fU=({stride:t,values:e},r)=>Y7(e[t*r]),xL=({values:t},e)=>t[e],dU=({stride:t,values:e},r)=>e.subarray(t*r,t*(r+1)),_L=({values:t,valueOffsets:e},r)=>vL(t,e,r),wL=({values:t,valueOffsets:e},r)=>{const u=vL(t,e,r);return u!==null?Cj(u):null},pU=({values:t},e)=>t[e],mU=({type:t,values:e},r)=>t.precision!==Of.HALF?e[r]:Y7(e[r]),gU=(t,e)=>t.type.unit===dg.DAY?yL(t,e):bL(t,e),TL=({values:t},e)=>1e3*Xh(t[e]),kL=({values:t},e)=>Xh(t[e]),SL=({values:t},e)=>w7(t[e],BigInt(1e3)),AL=({values:t},e)=>w7(t[e],BigInt(1e6)),vU=(t,e)=>{switch(t.type.unit){case Ja.SECOND:return TL(t,e);case Ja.MILLISECOND:return kL(t,e);case Ja.MICROSECOND:return SL(t,e);case Ja.NANOSECOND:return AL(t,e)}},CL=({values:t},e)=>t[e],ML=({values:t},e)=>t[e],EL=({values:t},e)=>t[e],IL=({values:t},e)=>t[e],yU=(t,e)=>{switch(t.type.unit){case Ja.SECOND:return CL(t,e);case Ja.MILLISECOND:return ML(t,e);case Ja.MICROSECOND:return EL(t,e);case Ja.NANOSECOND:return IL(t,e)}},bU=({values:t,stride:e},r)=>B4.decimal(t.subarray(e*r,e*(r+1))),xU=(t,e)=>{const{valueOffsets:r,stride:u,children:R}=t,{[e*u]:p,[e*u+1]:f}=r,l=R[0].slice(p,f-p);return new qc([l])},_U=(t,e)=>{const{valueOffsets:r,children:u}=t,{[e]:R,[e+1]:p}=r,f=u[0];return new j4(f.slice(R,p-R))},wU=(t,e)=>new V4(t,e),TU=(t,e)=>t.type.mode===dp.Dense?LL(t,e):PL(t,e),LL=(t,e)=>{const r=t.type.typeIdToChildIndex[t.typeIds[e]],u=t.children[r];return ad.visit(u,t.valueOffsets[e])},PL=(t,e)=>{const r=t.type.typeIdToChildIndex[t.typeIds[e]],u=t.children[r];return ad.visit(u,e)},kU=(t,e)=>{var r;return(r=t.dictionary)===null||r===void 0?void 0:r.get(t.values[e])},SU=(t,e)=>t.type.unit===Iv.DAY_TIME?DL(t,e):RL(t,e),DL=({values:t},e)=>t.subarray(2*e,2*(e+1)),RL=({values:t},e)=>{const r=t[e],u=new Int32Array(2);return u[0]=Math.trunc(r/12),u[1]=Math.trunc(r%12),u},OL=({values:t},e)=>t[e],zL=({values:t},e)=>t[e],FL=({values:t},e)=>t[e],BL=({values:t},e)=>t[e],AU=(t,e)=>{switch(t.type.unit){case Ja.SECOND:return OL(t,e);case Ja.MILLISECOND:return zL(t,e);case Ja.MICROSECOND:return FL(t,e);case Ja.NANOSECOND:return BL(t,e)}},CU=(t,e)=>{const{stride:r,children:u}=t,p=u[0].slice(e*r,r);return new qc([p])};ua.prototype.visitNull=pa(cU);ua.prototype.visitBool=pa(hU);ua.prototype.visitInt=pa(pU);ua.prototype.visitInt8=pa(Ag);ua.prototype.visitInt16=pa(Ag);ua.prototype.visitInt32=pa(Ag);ua.prototype.visitInt64=pa(xL);ua.prototype.visitUint8=pa(Ag);ua.prototype.visitUint16=pa(Ag);ua.prototype.visitUint32=pa(Ag);ua.prototype.visitUint64=pa(xL);ua.prototype.visitFloat=pa(mU);ua.prototype.visitFloat16=pa(fU);ua.prototype.visitFloat32=pa(Ag);ua.prototype.visitFloat64=pa(Ag);ua.prototype.visitUtf8=pa(wL);ua.prototype.visitLargeUtf8=pa(wL);ua.prototype.visitBinary=pa(_L);ua.prototype.visitLargeBinary=pa(_L);ua.prototype.visitFixedSizeBinary=pa(dU);ua.prototype.visitDate=pa(gU);ua.prototype.visitDateDay=pa(yL);ua.prototype.visitDateMillisecond=pa(bL);ua.prototype.visitTimestamp=pa(vU);ua.prototype.visitTimestampSecond=pa(TL);ua.prototype.visitTimestampMillisecond=pa(kL);ua.prototype.visitTimestampMicrosecond=pa(SL);ua.prototype.visitTimestampNanosecond=pa(AL);ua.prototype.visitTime=pa(yU);ua.prototype.visitTimeSecond=pa(CL);ua.prototype.visitTimeMillisecond=pa(ML);ua.prototype.visitTimeMicrosecond=pa(EL);ua.prototype.visitTimeNanosecond=pa(IL);ua.prototype.visitDecimal=pa(bU);ua.prototype.visitList=pa(xU);ua.prototype.visitStruct=pa(wU);ua.prototype.visitUnion=pa(TU);ua.prototype.visitDenseUnion=pa(LL);ua.prototype.visitSparseUnion=pa(PL);ua.prototype.visitDictionary=pa(kU);ua.prototype.visitInterval=pa(SU);ua.prototype.visitIntervalDayTime=pa(DL);ua.prototype.visitIntervalYearMonth=pa(RL);ua.prototype.visitDuration=pa(AU);ua.prototype.visitDurationSecond=pa(OL);ua.prototype.visitDurationMillisecond=pa(zL);ua.prototype.visitDurationMicrosecond=pa(FL);ua.prototype.visitDurationNanosecond=pa(BL);ua.prototype.visitFixedSizeList=pa(CU);ua.prototype.visitMap=pa(_U);const ad=new ua,j0=Symbol.for("keys"),hy=Symbol.for("vals"),U0=Symbol.for("kKeysAsStrings"),dT=Symbol.for("_kKeysAsStrings");class j4{constructor(e){return this[j0]=new qc([e.children[0]]).memoize(),this[hy]=e.children[1],new Proxy(this,new EU)}get[U0](){return this[dT]||(this[dT]=Array.from(this[j0].toArray(),String))}[Symbol.iterator](){return new MU(this[j0],this[hy])}get size(){return this[j0].length}toArray(){return Object.values(this.toJSON())}toJSON(){const e=this[j0],r=this[hy],u={};for(let R=-1,p=e.length;++R<p;)u[e.get(R)]=ad.visit(r,R);return u}toString(){return`{${[...this].map(([e,r])=>`${Cb(e)}: ${Cb(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class MU{constructor(e,r){this.keys=e,this.vals=r,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){const e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),ad.visit(this.vals,e)]})}}class EU{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[U0]}has(e,r){return e[U0].includes(r)}getOwnPropertyDescriptor(e,r){if(e[U0].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,r){if(Reflect.has(e,r))return e[r];const u=e[U0].indexOf(r);if(u!==-1){const R=ad.visit(Reflect.get(e,hy),u);return Reflect.set(e,r,R),R}}set(e,r,u){const R=e[U0].indexOf(r);return R!==-1?(pp.visit(Reflect.get(e,hy),R,u),Reflect.set(e,r,u)):Reflect.has(e,r)?Reflect.set(e,r,u):!1}}Object.defineProperties(j4.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[j0]:{writable:!0,enumerable:!1,configurable:!1,value:null},[hy]:{writable:!0,enumerable:!1,configurable:!1,value:null},[dT]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let e6;function IU(t,e,r,u){const{length:R=0}=t;let p=typeof e!="number"?0:e,f=typeof r!="number"?R:r;return p<0&&(p=(p%R+R)%R),f<0&&(f=(f%R+R)%R),f<p&&(e6=p,p=f,f=e6),f>R&&(f=R),u?u(t,p,f):[p,f]}const LU=(t,e)=>t<0?e+t:t,t6=t=>t!==t;function Oy(t){if(typeof t!=="object"||t===null)return t6(t)?t6:r=>r===t;if(t instanceof Date){const r=t.valueOf();return u=>u instanceof Date?u.valueOf()===r:!1}return ArrayBuffer.isView(t)?r=>r?Pj(t,r):!1:t instanceof Map?DU(t):Array.isArray(t)?PU(t):t instanceof qc?RU(t):OU(t,!0)}function PU(t){const e=[];for(let r=-1,u=t.length;++r<u;)e[r]=Oy(t[r]);return Mw(e)}function DU(t){let e=-1;const r=[];for(const u of t.values())r[++e]=Oy(u);return Mw(r)}function RU(t){const e=[];for(let r=-1,u=t.length;++r<u;)e[r]=Oy(t.get(r));return Mw(e)}function OU(t,e=!1){const r=Object.keys(t);if(!e&&r.length===0)return()=>!1;const u=[];for(let R=-1,p=r.length;++R<p;)u[R]=Oy(t[r[R]]);return Mw(u,r)}function Mw(t,e){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return zU(t,r);case Map:return n6(t,r,r.keys());case j4:case V4:case Object:case void 0:return n6(t,r,e||Object.keys(r))}return r instanceof qc?FU(t,r):!1}}function zU(t,e){const r=t.length;if(e.length!==r)return!1;for(let u=-1;++u<r;)if(!t[u](e[u]))return!1;return!0}function FU(t,e){const r=t.length;if(e.length!==r)return!1;for(let u=-1;++u<r;)if(!t[u](e.get(u)))return!1;return!0}function n6(t,e,r){const u=r[Symbol.iterator](),R=e instanceof Map?e.keys():Object.keys(e)[Symbol.iterator](),p=e instanceof Map?e.values():Object.values(e)[Symbol.iterator]();let f=0;const n=t.length;let l=p.next(),c=u.next(),i=R.next();for(;f<n&&!c.done&&!i.done&&!l.done&&!(c.value!==i.value||!t[f](l.value));++f,c=u.next(),i=R.next(),l=p.next());return f===n&&c.done&&i.done&&l.done?!0:(u.return&&u.return(),R.return&&R.return(),p.return&&p.return(),!1)}function NL(t,e,r,u){return(r&1<<u)!==0}function BU(t,e,r,u){return(r&1<<u)>>u}function r6(t,e,r){const u=r.byteLength+7&-8;if(t>0||r.byteLength<u){const R=new Uint8Array(u);return R.set(t%8===0?r.subarray(t>>3):NU(new U4(r,t,e,null,NL)).subarray(0,u)),R}return r}function NU(t){const e=[];let r=0,u=0,R=0;for(const f of t)f&&(R|=1<<u),++u===8&&(e[r++]=R,R=u=0);(r===0||u>0)&&(e[r++]=R);const p=new Uint8Array(e.length+7&-8);return p.set(e),p}class U4{constructor(e,r,u,R,p){this.bytes=e,this.length=u,this.context=R,this.get=p,this.bit=r%8,this.byteIndex=r>>3,this.byte=e[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}}function pT(t,e,r){if(r-e<=0)return 0;if(r-e<8){let p=0;for(const f of new U4(t,e,r-e,t,BU))p+=f;return p}const u=r>>3<<3,R=e+(e%8===0?0:8-e%8);return pT(t,e,R)+pT(t,u,r)+VU(t,R>>3,u-R>>3)}function VU(t,e,r){let u=0,R=Math.trunc(e);const p=new DataView(t.buffer,t.byteOffset,t.byteLength),f=r===void 0?t.byteLength:R+r;for(;f-R>=4;)u+=m5(p.getUint32(R)),R+=4;for(;f-R>=2;)u+=m5(p.getUint16(R)),R+=2;for(;f-R>=1;)u+=m5(p.getUint8(R)),R+=1;return u}function m5(t){let e=Math.trunc(t);return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24}const jU=-1;class Ib{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:e}=this;return so.isSparseUnion(e)?this.children.some(r=>r.nullable):so.isDenseUnion(e)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0;const{valueOffsets:r,values:u,nullBitmap:R,typeIds:p}=this;return r&&(e+=r.byteLength),u&&(e+=u.byteLength),R&&(e+=R.byteLength),p&&(e+=p.byteLength),this.children.reduce((f,n)=>f+n.byteLength,e)}get nullCount(){if(so.isUnion(this.type))return this.children.reduce((u,R)=>u+R.nullCount,0);let e=this._nullCount,r;return e<=jU&&(r=this.nullBitmap)&&(this._nullCount=e=r.length===0?0:this.length-pT(r,this.offset,this.offset+this.length)),e}constructor(e,r,u,R,p,f=[],n){this.type=e,this.children=f,this.dictionary=n,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(u||0,0)),this._nullCount=Math.floor(Math.max(R||0,-1));let l;p instanceof Ib?(this.stride=p.stride,this.values=p.values,this.typeIds=p.typeIds,this.nullBitmap=p.nullBitmap,this.valueOffsets=p.valueOffsets):(this.stride=G7(e),p&&((l=p[0])&&(this.valueOffsets=l),(l=p[1])&&(this.values=l),(l=p[2])&&(this.nullBitmap=l),(l=p[3])&&(this.typeIds=l)))}getValid(e){const{type:r}=this;if(so.isUnion(r)){const u=r,R=this.children[u.typeIdToChildIndex[this.typeIds[e]]],p=u.mode===dp.Dense?this.valueOffsets[e]:e;return R.getValid(p)}if(this.nullable&&this.nullCount>0){const u=this.offset+e;return(this.nullBitmap[u>>3]&1<<u%8)!==0}return!0}setValid(e,r){let u;const{type:R}=this;if(so.isUnion(R)){const p=R,f=this.children[p.typeIdToChildIndex[this.typeIds[e]]],n=p.mode===dp.Dense?this.valueOffsets[e]:e;u=f.getValid(n),f.setValid(n,r)}else{let{nullBitmap:p}=this;const{offset:f,length:n}=this,l=f+e,c=1<<l%8,i=l>>3;(!p||p.byteLength<=i)&&(p=new Uint8Array((f+n+63&-64)>>3).fill(255),this.nullCount>0?(p.set(r6(f,n,this.nullBitmap),0),Object.assign(this,{nullBitmap:p})):Object.assign(this,{nullBitmap:p,_nullCount:0}));const _=p[i];u=(_&c)!==0,p[i]=r?_|c:_&~c}return u!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(e=this.type,r=this.offset,u=this.length,R=this._nullCount,p=this,f=this.children){return new Ib(e,r,u,R,p,f,this.dictionary)}slice(e,r){const{stride:u,typeId:R,children:p}=this,f=+(this._nullCount===0)-1,n=R===16?u:1,l=this._sliceBuffers(e,r,u,R);return this.clone(this.type,this.offset+e,r,f,l,p.length===0||this.valueOffsets?p:this._sliceChildren(p,n*e,n*r))}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===_r.Null)return this.clone(this.type,0,e,0);const{length:r,nullCount:u}=this,R=new Uint8Array((e+63&-64)>>3).fill(255,0,r>>3);R[r>>3]=(1<<r-(r&-8))-1,u>0&&R.set(r6(this.offset,r,this.nullBitmap),0);const p=this.buffers;return p[jp.VALIDITY]=R,this.clone(this.type,0,e,u+(e-r),p)}_sliceBuffers(e,r,u,R){let p;const{buffers:f}=this;return(p=f[jp.TYPE])&&(f[jp.TYPE]=p.subarray(e,e+r)),(p=f[jp.OFFSET])&&(f[jp.OFFSET]=p.subarray(e,e+r+1))||(p=f[jp.DATA])&&(f[jp.DATA]=R===6?p:p.subarray(u*e,u*(e+r))),f}_sliceChildren(e,r,u){return e.map(R=>R.slice(r,u))}}Ib.prototype.children=Object.freeze([]);class i6{constructor(e=0,r){this.numChunks=e,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){const e=this.chunkIterator.next();if(!e.done)return e;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}}function UU(t){return t.some(e=>e.nullable)}function HU(t){return t.reduce((e,r)=>e+r.nullCount,0)}function qU(t){return t.reduce((e,r,u)=>(e[u+1]=e[u]+r.length,e),new Uint32Array(t.length+1))}function WU(t,e,r,u){const R=[];for(let p=-1,f=t.length;++p<f;){const n=t[p],l=e[p],{length:c}=n;if(l>=u)break;if(r>=l+c)continue;if(l>=r&&l+c<=u){R.push(n);continue}const i=Math.max(0,r-l),_=Math.min(u-l,c);R.push(n.slice(i,_-i))}return R.length===0&&R.push(t[0].slice(0,0)),R}function H4(t,e,r,u){let R=0,p=0,f=e.length-1;do{if(R>=f-1)return r<e[f]?u(t,R,r-e[R]):null;p=R+Math.trunc((f-R)*.5),r<e[p]?f=p:R=p}while(R<f)}function VL(t,e){return t.getValid(e)}function a6(t){function e(r,u,R){return t(r[u],R)}return function(r){const u=this.data;return H4(u,this._offsets,r,e)}}function GU(t){let e;function r(u,R,p){return t(u[R],p,e)}return function(u,R){const p=this.data;e=R;const f=H4(p,this._offsets,u,r);return e=void 0,f}}function $U(t){let e;function r(u,R,p){let f=p,n=0,l=0;for(let c=R-1,i=u.length;++c<i;){const _=u[c];if(~(n=t(_,e,f)))return l+n;f=0,l+=_.length}return-1}return function(u,R){e=u;const p=this.data,f=typeof R!="number"?r(p,0,0):H4(p,this._offsets,R,r);return e=void 0,f}}class ca extends zo{}function YU(t,e){return e===null&&t.length>0?0:-1}function ZU(t,e){const{nullBitmap:r}=t;if(!r||t.nullCount<=0)return-1;let u=0;for(const R of new U4(r,t.offset+(e||0),t.length,r,NL)){if(!R)return u;++u}return-1}function wa(t,e,r){if(e===void 0)return-1;if(e===null)switch(t.typeId){case _r.Union:break;case _r.Dictionary:break;default:return ZU(t,r)}const u=ad.getVisitFn(t),R=Oy(e);for(let p=(r||0)-1,f=t.length;++p<f;)if(R(u(t,p)))return p;return-1}function jL(t,e,r){const u=ad.getVisitFn(t),R=Oy(e);for(let p=(r||0)-1,f=t.length;++p<f;)if(R(u(t,p)))return p;return-1}ca.prototype.visitNull=YU;ca.prototype.visitBool=wa;ca.prototype.visitInt=wa;ca.prototype.visitInt8=wa;ca.prototype.visitInt16=wa;ca.prototype.visitInt32=wa;ca.prototype.visitInt64=wa;ca.prototype.visitUint8=wa;ca.prototype.visitUint16=wa;ca.prototype.visitUint32=wa;ca.prototype.visitUint64=wa;ca.prototype.visitFloat=wa;ca.prototype.visitFloat16=wa;ca.prototype.visitFloat32=wa;ca.prototype.visitFloat64=wa;ca.prototype.visitUtf8=wa;ca.prototype.visitLargeUtf8=wa;ca.prototype.visitBinary=wa;ca.prototype.visitLargeBinary=wa;ca.prototype.visitFixedSizeBinary=wa;ca.prototype.visitDate=wa;ca.prototype.visitDateDay=wa;ca.prototype.visitDateMillisecond=wa;ca.prototype.visitTimestamp=wa;ca.prototype.visitTimestampSecond=wa;ca.prototype.visitTimestampMillisecond=wa;ca.prototype.visitTimestampMicrosecond=wa;ca.prototype.visitTimestampNanosecond=wa;ca.prototype.visitTime=wa;ca.prototype.visitTimeSecond=wa;ca.prototype.visitTimeMillisecond=wa;ca.prototype.visitTimeMicrosecond=wa;ca.prototype.visitTimeNanosecond=wa;ca.prototype.visitDecimal=wa;ca.prototype.visitList=wa;ca.prototype.visitStruct=wa;ca.prototype.visitUnion=wa;ca.prototype.visitDenseUnion=jL;ca.prototype.visitSparseUnion=jL;ca.prototype.visitDictionary=wa;ca.prototype.visitInterval=wa;ca.prototype.visitIntervalDayTime=wa;ca.prototype.visitIntervalYearMonth=wa;ca.prototype.visitDuration=wa;ca.prototype.visitDurationSecond=wa;ca.prototype.visitDurationMillisecond=wa;ca.prototype.visitDurationMicrosecond=wa;ca.prototype.visitDurationNanosecond=wa;ca.prototype.visitFixedSizeList=wa;ca.prototype.visitMap=wa;const o6=new ca;class ha extends zo{}function ma(t){const{type:e}=t;if(t.nullCount===0&&t.stride===1&&(so.isInt(e)&&e.bitWidth!==64||so.isTime(e)&&e.bitWidth!==64||so.isFloat(e)&&e.precision!==Of.HALF))return new i6(t.data.length,u=>{const R=t.data[u];return R.values.subarray(0,R.length)[Symbol.iterator]()});let r=0;return new i6(t.data.length,u=>{const p=t.data[u].length,f=t.slice(r,r+p);return r+=p,new XU(f)})}class XU{constructor(e){this.vector=e,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}}ha.prototype.visitNull=ma;ha.prototype.visitBool=ma;ha.prototype.visitInt=ma;ha.prototype.visitInt8=ma;ha.prototype.visitInt16=ma;ha.prototype.visitInt32=ma;ha.prototype.visitInt64=ma;ha.prototype.visitUint8=ma;ha.prototype.visitUint16=ma;ha.prototype.visitUint32=ma;ha.prototype.visitUint64=ma;ha.prototype.visitFloat=ma;ha.prototype.visitFloat16=ma;ha.prototype.visitFloat32=ma;ha.prototype.visitFloat64=ma;ha.prototype.visitUtf8=ma;ha.prototype.visitLargeUtf8=ma;ha.prototype.visitBinary=ma;ha.prototype.visitLargeBinary=ma;ha.prototype.visitFixedSizeBinary=ma;ha.prototype.visitDate=ma;ha.prototype.visitDateDay=ma;ha.prototype.visitDateMillisecond=ma;ha.prototype.visitTimestamp=ma;ha.prototype.visitTimestampSecond=ma;ha.prototype.visitTimestampMillisecond=ma;ha.prototype.visitTimestampMicrosecond=ma;ha.prototype.visitTimestampNanosecond=ma;ha.prototype.visitTime=ma;ha.prototype.visitTimeSecond=ma;ha.prototype.visitTimeMillisecond=ma;ha.prototype.visitTimeMicrosecond=ma;ha.prototype.visitTimeNanosecond=ma;ha.prototype.visitDecimal=ma;ha.prototype.visitList=ma;ha.prototype.visitStruct=ma;ha.prototype.visitUnion=ma;ha.prototype.visitDenseUnion=ma;ha.prototype.visitSparseUnion=ma;ha.prototype.visitDictionary=ma;ha.prototype.visitInterval=ma;ha.prototype.visitIntervalDayTime=ma;ha.prototype.visitIntervalYearMonth=ma;ha.prototype.visitDuration=ma;ha.prototype.visitDurationSecond=ma;ha.prototype.visitDurationMillisecond=ma;ha.prototype.visitDurationMicrosecond=ma;ha.prototype.visitDurationNanosecond=ma;ha.prototype.visitFixedSizeList=ma;ha.prototype.visitMap=ma;const KU=new ha;var UL;const HL={},qL={};class qc{constructor(e){var r,u,R;const p=e[0]instanceof qc?e.flatMap(n=>n.data):e;if(p.length===0||p.some(n=>!(n instanceof Ib)))throw new TypeError("Vector constructor expects an Array of Data instances.");const f=(r=p[0])===null||r===void 0?void 0:r.type;switch(p.length){case 0:this._offsets=[0];break;case 1:{const{get:n,set:l,indexOf:c}=HL[f.typeId],i=p[0];this.isValid=_=>VL(i,_),this.get=_=>n(i,_),this.set=(_,b)=>l(i,_,b),this.indexOf=_=>c(i,_),this._offsets=[0,i.length];break}default:Object.setPrototypeOf(this,qL[f.typeId]),this._offsets=qU(p);break}this.data=p,this.type=f,this.stride=G7(f),this.numChildren=(R=(u=f.children)===null||u===void 0?void 0:u.length)!==null&&R!==void 0?R:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((e,r)=>e+r.byteLength,0)}get nullable(){return UU(this.data)}get nullCount(){return HU(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${_r[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get(LU(e,this.length))}set(e,r){}indexOf(e,r){return-1}includes(e,r){return this.indexOf(e,r)>-1}[Symbol.iterator](){return KU.visit(this)}concat(...e){return new qc(this.data.concat(e.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(e,r){return new qc(IU(this,e,r,({data:u,_offsets:R},p,f)=>WU(u,R,p,f)))}toJSON(){return[...this]}toArray(){const{type:e,data:r,length:u,stride:R,ArrayType:p}=this;switch(e.typeId){case _r.Int:case _r.Float:case _r.Decimal:case _r.Time:case _r.Timestamp:switch(r.length){case 0:return new p;case 1:return r[0].values.subarray(0,u*R);default:return r.reduce((f,{values:n,length:l})=>(f.array.set(n.subarray(0,l*R),f.offset),f.offset+=l*R,f),{array:new p(u*R),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(e){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(u=>u.name===e))}getChildAt(e){return e>-1&&e<this.numChildren?new qc(this.data.map(({children:r})=>r[e])):null}get isMemoized(){return so.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(so.isDictionary(this.type)){const e=new N2(this.data[0].dictionary),r=this.data.map(u=>{const R=u.clone();return R.dictionary=e,R});return new qc(r)}return new N2(this)}unmemoize(){if(so.isDictionary(this.type)&&this.isMemoized){const e=this.data[0].dictionary.unmemoize(),r=this.data.map(u=>{const R=u.clone();return R.dictionary=e,R});return new qc(r)}return this}}UL=Symbol.toStringTag;qc[UL]=(t=>{t.type=so.prototype,t.data=[],t.length=0,t.stride=1,t.numChildren=0,t._offsets=new Uint32Array([0]),t[Symbol.isConcatSpreadable]=!0;const e=Object.keys(_r).map(r=>_r[r]).filter(r=>typeof r=="number"&&r!==_r.NONE);for(const r of e){const u=ad.getVisitFnByTypeId(r),R=pp.getVisitFnByTypeId(r),p=o6.getVisitFnByTypeId(r);HL[r]={get:u,set:R,indexOf:p},qL[r]=Object.create(t,{isValid:{value:a6(VL)},get:{value:a6(ad.getVisitFnByTypeId(r))},set:{value:GU(pp.getVisitFnByTypeId(r))},indexOf:{value:$U(o6.getVisitFnByTypeId(r))}})}return"Vector"})(qc.prototype);class N2 extends qc{constructor(e){super(e.data);const r=this.get,u=this.set,R=this.slice,p=new Array(this.length);Object.defineProperty(this,"get",{value(f){const n=p[f];if(n!==void 0)return n;const l=r.call(this,f);return p[f]=l,l}}),Object.defineProperty(this,"set",{value(f,n){u.call(this,f,n),p[f]=n}}),Object.defineProperty(this,"slice",{value:(f,n)=>new N2(R.call(this,f,n))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new qc(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}function JU(t){return t.endsWith("_page")}const zy=h8("selection",{state:()=>({id:void 0,selection_counter:void 0,pagination_counter:void 0,counter:void 0}),actions:{updateSelection(t,e){const r=JU(t);console.log("[SelectionStore] ===== updateSelection =====",{timestamp:Date.now(),identifier:t,value:e,isPagination:r,currentSelectionCounter:this.$state.selection_counter,currentPaginationCounter:this.$state.pagination_counter}),this.$patch(u=>{u[t]=e,r?u.pagination_counter=(u.pagination_counter||0)+1:u.selection_counter=(u.selection_counter||0)+1,u.counter=(u.counter||0)+1}),console.log("[SelectionStore] updateSelection DONE",{selectionCounter:this.$state.selection_counter,paginationCounter:this.$state.pagination_counter})}}}),Cg=h8("streamlit-data",{state:()=>({renderData:null,dataForDrawing:{},hash:"",annotations:null,requestData:!1}),getters:{args:t=>{var e;return(e=t.renderData)==null?void 0:e.args},components(){var t;return(t=this.args)==null?void 0:t.components},allDataForDrawing:t=>t.dataForDrawing,theme:t=>{var e;return(e=t.renderData)==null?void 0:e.theme}},actions:{updateRenderData(t){var p,f,n,l;const e=zy(),r=t.args.selection_store,u=t.args.hash,R=t.args.dataChanged;if(delete t.args.selection_store,delete t.args.hash,delete t.args.dataChanged,console.log("[StreamlitDataStore] ===== updateRenderData START =====",{timestamp:Date.now(),dataChanged:R,oldHash:(p=this.hash)==null?void 0:p.substring(0,8),newHash:u==null?void 0:u.substring(0,8),hasPagination:!!t.args._pagination,paginationPage:(f=t.args._pagination)==null?void 0:f.page,hasTableData:!!t.args.tableData,pythonStateCounter:r==null?void 0:r.counter,pythonSelectionCounter:r==null?void 0:r.selection_counter,pythonPaginationCounter:r==null?void 0:r.pagination_counter,pythonStateKeys:r?Object.keys(r):[]}),r){const c=r.selection_counter??r.counter??0,i=r.pagination_counter??r.counter??0,_=e.$state.selection_counter??e.$state.counter??0,b=e.$state.pagination_counter??e.$state.counter??0;e.$patch(w=>{if(r.id!==w.id){for(const v in w)w[v]=void 0;Object.assign(w,r)}else for(const v in r){const o=v.endsWith("_page"),a=o?i:c,h=o?b:_,s=!(v in w)||w[v]===void 0||a>=h||o&&R;console.log(`[StreamlitDataStore] State key "${v}":`,{isPagination:o,pythonCounter:a,vueCounter:h,dataChanged:R,keyInState:v in w,currentValue:w[v],pythonValue:r[v],shouldAccept:s}),s&&(w[v]=r[v])}})}if(R&&u){this.renderData=t;const c=t.args;Object.entries(c).forEach(([i,_])=>{var b;if(_ instanceof fT)if(i==="plotData"){const w=this.parseArrowTableToColumns(_);console.log(`[StreamlitDataStore] Parsed ${i} to columns:`,{columns:Object.keys(w),rowCount:((b=Object.values(w)[0])==null?void 0:b.length)??0}),this.dataForDrawing[i]=w}else{const w=this.parseArrowTable(_);console.log(`[StreamlitDataStore] Parsed ${i}:`,{rowCount:w.length}),this.dataForDrawing[i]=w}else this.dataForDrawing[i]=_}),c._pagination!==void 0&&(console.log("[StreamlitDataStore] Updating _pagination:",{oldPage:(n=this.dataForDrawing._pagination)==null?void 0:n.page,newPage:(l=c._pagination)==null?void 0:l.page,newPagination:c._pagination}),this.dataForDrawing._pagination=c._pagination),c._navigate_to_page!==void 0&&(console.log("[StreamlitDataStore] Updating _navigate_to_page:",c._navigate_to_page),this.dataForDrawing._navigate_to_page=c._navigate_to_page),c._target_row_index!==void 0&&(console.log("[StreamlitDataStore] Updating _target_row_index:",c._target_row_index),this.dataForDrawing._target_row_index=c._target_row_index),this.hash=u}else if(!R){const c=Object.keys(this.dataForDrawing).length>0;if(console.log("[StreamlitDataStore] Using cached data branch:",{timestamp:Date.now(),hasCache:c,incomingPagination:t.args._pagination,cachedPagination:this.dataForDrawing._pagination}),c)console.log("[StreamlitDataStore] Data unchanged, using cached data"),t.args.components&&(this.renderData?this.renderData.args.components=t.args.components:this.renderData=t);else{console.warn("[StreamlitDataStore] Cache miss - requesting data from Python"),this.requestData=!0;return}}},parseArrowTable(t){const e=t.table.numRows,r=t.table.schema.fields.map(p=>p.name),u=new Map;r.forEach((p,f)=>{const n=t.table.getChildAt(f);if(n){const l=n.toArray(),c=new Array(l.length);for(let i=0;i<l.length;i++)c[i]=this.parseArrowValue(l[i]);u.set(p,c)}});const R=new Array(e);for(let p=0;p<e;p++){const f={};r.forEach(n=>{const l=u.get(n);l&&(f[n]=l[p])}),R[p]=f}return R},parseArrowTableToColumns(t){const e={};return t.table.schema.fields.map(u=>u.name).forEach((u,R)=>{const p=t.table.getChildAt(R);if(p){const f=p.toArray(),n=new Array(f.length);for(let l=0;l<f.length;l++)n[l]=this.parseArrowValue(f[l]);e[u]=n}else e[u]=[]}),e},parseArrowValue(t){if(typeof t=="bigint")return Number(t);if(t instanceof qc){const e=[];for(let r=0;r<t.length;r++)e.push(this.parseArrowValue(t.get(r)));return e}return t},setAnnotations(t){this.annotations=t},clearRequestData(){this.requestData=!1}}});class ch{constructor(e){this.table=e}reloadData(e,r,u){return this.table.dataLoader.load(e,void 0,void 0,void 0,r,u)}langText(){return this.table.modules.localize.getText(...arguments)}langBind(){return this.table.modules.localize.bind(...arguments)}langLocale(){return this.table.modules.localize.getLocale(...arguments)}commsConnections(){return this.table.modules.comms.getConnections(...arguments)}commsSend(){return this.table.modules.comms.send(...arguments)}layoutMode(){return this.table.modules.layout.getMode()}layoutRefresh(e){return this.table.modules.layout.layout(e)}subscribe(){return this.table.eventBus.subscribe(...arguments)}unsubscribe(){return this.table.eventBus.unsubscribe(...arguments)}subscribed(e){return this.table.eventBus.subscribed(e)}subscriptionChange(){return this.table.eventBus.subscriptionChange(...arguments)}dispatch(){return this.table.eventBus.dispatch(...arguments)}chain(){return this.table.eventBus.chain(...arguments)}confirm(){return this.table.eventBus.confirm(...arguments)}dispatchExternal(){return this.table.externalEvents.dispatch(...arguments)}subscribedExternal(e){return this.table.externalEvents.subscribed(e)}subscriptionChangeExternal(){return this.table.externalEvents.subscriptionChange(...arguments)}options(e){return this.table.options[e]}setOption(e,r){return typeof r<"u"&&(this.table.options[e]=r),this.table.options[e]}deprecationCheck(e,r,u){return this.table.deprecationAdvisor.check(e,r,u)}deprecationCheckMsg(e,r){return this.table.deprecationAdvisor.checkMsg(e,r)}deprecationMsg(e){return this.table.deprecationAdvisor.msg(e)}module(e){return this.table.module(e)}}class Ks{static elVisible(e){return!(e.offsetWidth<=0&&e.offsetHeight<=0)}static elOffset(e){var r=e.getBoundingClientRect();return{top:r.top+window.pageYOffset-document.documentElement.clientTop,left:r.left+window.pageXOffset-document.documentElement.clientLeft}}static retrieveNestedData(e,r,u){var R=e?r.split(e):[r],p=R.length,f;for(let n=0;n<p&&(u=u[R[n]],f=u,!!u);n++);return f}static deepClone(e,r,u=[]){var R={}.__proto__,p=[].__proto__;r||(r=Object.assign(Array.isArray(e)?[]:{},e));for(var f in e){let n=e[f],l,c;n!=null&&typeof n=="object"&&(n.__proto__===R||n.__proto__===p)&&(l=u.findIndex(i=>i.subject===n),l>-1?r[f]=u[l].copy:(c=Object.assign(Array.isArray(n)?[]:{},n),u.unshift({subject:n,copy:c}),r[f]=this.deepClone(n,c,u)))}return r}}let QU=class WL extends ch{constructor(e,r,u){super(e),this.element=r,this.container=this._lookupContainer(),this.parent=u,this.reversedX=!1,this.childPopup=null,this.blurable=!1,this.blurCallback=null,this.blurEventsBound=!1,this.renderedCallback=null,this.visible=!1,this.hideable=!0,this.element.classList.add("tabulator-popup-container"),this.blurEvent=this.hide.bind(this,!1),this.escEvent=this._escapeCheck.bind(this),this.destroyBinding=this.tableDestroyed.bind(this),this.destroyed=!1}tableDestroyed(){this.destroyed=!0,this.hide(!0)}_lookupContainer(){var e=this.table.options.popupContainer;return typeof e=="string"?(e=document.querySelector(e),e||console.warn("Menu Error - no container element found matching selector:",this.table.options.popupContainer,"(defaulting to document body)")):e===!0&&(e=this.table.element),e&&!this._checkContainerIsParent(e)&&(e=!1,console.warn("Menu Error - container element does not contain this table:",this.table.options.popupContainer,"(defaulting to document body)")),e||(e=document.body),e}_checkContainerIsParent(e,r=this.table.element){return e===r?!0:r.parentNode?this._checkContainerIsParent(e,r.parentNode):!1}renderCallback(e){this.renderedCallback=e}containerEventCoords(e){var r=!(e instanceof MouseEvent),u=r?e.touches[0].pageX:e.pageX,R=r?e.touches[0].pageY:e.pageY;if(this.container!==document.body){let p=Ks.elOffset(this.container);u-=p.left,R-=p.top}return{x:u,y:R}}elementPositionCoords(e,r="right"){var u=Ks.elOffset(e),R,p,f;switch(this.container!==document.body&&(R=Ks.elOffset(this.container),u.left-=R.left,u.top-=R.top),r){case"right":p=u.left+e.offsetWidth,f=u.top-1;break;case"bottom":p=u.left,f=u.top+e.offsetHeight;break;case"left":p=u.left,f=u.top-1;break;case"top":p=u.left,f=u.top;break;case"center":p=u.left+e.offsetWidth/2,f=u.top+e.offsetHeight/2;break}return{x:p,y:f,offset:u}}show(e,r){var u,R,p,f,n;return this.destroyed||this.table.destroyed?this:(e instanceof HTMLElement?(p=e,n=this.elementPositionCoords(e,r),f=n.offset,u=n.x,R=n.y):typeof e=="number"?(f={top:0,left:0},u=e,R=r):(n=this.containerEventCoords(e),u=n.x,R=n.y,this.reversedX=!1),this.element.style.top=R+"px",this.element.style.left=u+"px",this.container.appendChild(this.element),typeof this.renderedCallback=="function"&&this.renderedCallback(),this._fitToScreen(u,R,p,f,r),this.visible=!0,this.subscribe("table-destroy",this.destroyBinding),this.element.addEventListener("mousedown",l=>{l.stopPropagation()}),this)}_fitToScreen(e,r,u,R,p){var f=this.container===document.body?document.documentElement.scrollTop:this.container.scrollTop;(e+this.element.offsetWidth>=this.container.offsetWidth||this.reversedX)&&(this.element.style.left="",u?this.element.style.right=this.container.offsetWidth-R.left+"px":this.element.style.right=this.container.offsetWidth-e+"px",this.reversedX=!0);let n=Math.max(this.container.offsetHeight,f?this.container.scrollHeight:0);if(r+this.element.offsetHeight>n)if(u)switch(p){case"bottom":this.element.style.top=parseInt(this.element.style.top)-this.element.offsetHeight-u.offsetHeight-1+"px";break;default:this.element.style.top=parseInt(this.element.style.top)-this.element.offsetHeight+u.offsetHeight+1+"px"}else this.element.style.height=n+"px"}isVisible(){return this.visible}hideOnBlur(e){return this.blurable=!0,this.visible&&(setTimeout(()=>{this.visible&&(this.table.rowManager.element.addEventListener("scroll",this.blurEvent),this.subscribe("cell-editing",this.blurEvent),document.body.addEventListener("click",this.blurEvent),document.body.addEventListener("contextmenu",this.blurEvent),document.body.addEventListener("mousedown",this.blurEvent),window.addEventListener("resize",this.blurEvent),document.body.addEventListener("keydown",this.escEvent),this.blurEventsBound=!0)},100),this.blurCallback=e),this}_escapeCheck(e){e.keyCode==27&&this.hide()}blockHide(){this.hideable=!1}restoreHide(){this.hideable=!0}hide(e=!1){return this.visible&&this.hideable&&(this.blurable&&this.blurEventsBound&&(document.body.removeEventListener("keydown",this.escEvent),document.body.removeEventListener("click",this.blurEvent),document.body.removeEventListener("contextmenu",this.blurEvent),document.body.removeEventListener("mousedown",this.blurEvent),window.removeEventListener("resize",this.blurEvent),this.table.rowManager.element.removeEventListener("scroll",this.blurEvent),this.unsubscribe("cell-editing",this.blurEvent),this.blurEventsBound=!1),this.childPopup&&this.childPopup.hide(),this.parent&&(this.parent.childPopup=null),this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.visible=!1,this.blurCallback&&!e&&this.blurCallback(),this.unsubscribe("table-destroy",this.destroyBinding)),this}child(e){return this.childPopup&&this.childPopup.hide(),this.childPopup=new WL(this.table,e,this),this.childPopup}};class uo extends ch{constructor(e,r){super(e),this._handler=null}initialize(){}registerTableOption(e,r){this.table.optionsList.register(e,r)}registerColumnOption(e,r){this.table.columnManager.optionsList.register(e,r)}registerTableFunction(e,r){typeof this.table[e]>"u"?this.table[e]=(...u)=>(this.table.initGuard(e),r(...u)):console.warn("Unable to bind table function, name already in use",e)}registerComponentFunction(e,r,u){return this.table.componentFunctionBinder.bind(e,r,u)}registerDataHandler(e,r){this.table.rowManager.registerDataPipelineHandler(e,r),this._handler=e}registerDisplayHandler(e,r){this.table.rowManager.registerDisplayPipelineHandler(e,r),this._handler=e}displayRows(e){var r=this.table.rowManager.displayRows.length-1,u;if(this._handler&&(u=this.table.rowManager.displayPipeline.findIndex(R=>R.handler===this._handler),u>-1&&(r=u)),e&&(r=r+e),this._handler)return r>-1?this.table.rowManager.getDisplayRows(r):this.activeRows()}activeRows(){return this.table.rowManager.activeRows}refreshData(e,r){r||(r=this._handler),r&&this.table.rowManager.refreshActiveData(r,!1,e)}footerAppend(e){return this.table.footerManager.append(e)}footerPrepend(e){return this.table.footerManager.prepend(e)}footerRemove(e){return this.table.footerManager.remove(e)}popup(e,r){return new QU(this.table,e,r)}alert(e,r){return this.table.alertManager.alert(e,r)}clearAlert(){return this.table.alertManager.clear()}}var eH={rownum:function(t,e,r,u,R,p){return p.getPosition()}};const Y0=class Y0 extends uo{constructor(e){super(e),this.allowedTypes=["","data","download","clipboard","print","htmlOutput"],this.registerColumnOption("accessor"),this.registerColumnOption("accessorParams"),this.registerColumnOption("accessorData"),this.registerColumnOption("accessorDataParams"),this.registerColumnOption("accessorDownload"),this.registerColumnOption("accessorDownloadParams"),this.registerColumnOption("accessorClipboard"),this.registerColumnOption("accessorClipboardParams"),this.registerColumnOption("accessorPrint"),this.registerColumnOption("accessorPrintParams"),this.registerColumnOption("accessorHtmlOutput"),this.registerColumnOption("accessorHtmlOutputParams")}initialize(){this.subscribe("column-layout",this.initializeColumn.bind(this)),this.subscribe("row-data-retrieve",this.transformRow.bind(this))}initializeColumn(e){var r=!1,u={};this.allowedTypes.forEach(R=>{var p="accessor"+(R.charAt(0).toUpperCase()+R.slice(1)),f;e.definition[p]&&(f=this.lookupAccessor(e.definition[p]),f&&(r=!0,u[p]={accessor:f,params:e.definition[p+"Params"]||{}}))}),r&&(e.modules.accessor=u)}lookupAccessor(e){var r=!1;switch(typeof e){case"string":Y0.accessors[e]?r=Y0.accessors[e]:console.warn("Accessor Error - No such accessor found, ignoring: ",e);break;case"function":r=e;break}return r}transformRow(e,r){var u="accessor"+(r.charAt(0).toUpperCase()+r.slice(1)),R=e.getComponent(),p=Ks.deepClone(e.data||{});return this.table.columnManager.traverse(function(f){var n,l,c,i;f.modules.accessor&&(l=f.modules.accessor[u]||f.modules.accessor.accessor||!1,l&&(n=f.getFieldValue(p),n!="undefined"&&(i=f.getComponent(),c=typeof l.params=="function"?l.params(n,p,r,i,R):l.params,f.setFieldValue(p,l.accessor(n,p,r,c,i,R)))))}),p}};Ci(Y0,"moduleName","accessor"),Ci(Y0,"accessors",eH);let mT=Y0;var tH={method:"GET"};function gT(t,e){var r=[];if(e=e||"",Array.isArray(t))t.forEach((R,p)=>{r=r.concat(gT(R,e?e+"["+p+"]":p))});else if(typeof t=="object")for(var u in t)r=r.concat(gT(t[u],e?e+"["+u+"]":u));else r.push({key:e,value:t});return r}function nH(t){var e=gT(t),r=[];return e.forEach(function(u){r.push(encodeURIComponent(u.key)+"="+encodeURIComponent(u.value))}),r.join("&")}function GL(t,e,r){return t&&r&&Object.keys(r).length&&(!e.method||e.method.toLowerCase()=="get")&&(e.method="get",t+=(t.includes("?")?"&":"?")+nH(r)),t}function rH(t,e,r){var u;return new Promise((R,p)=>{if(t=this.urlGenerator.call(this.table,t,e,r),e.method.toUpperCase()!="GET")if(u=typeof this.table.options.ajaxContentType=="object"?this.table.options.ajaxContentType:this.contentTypeFormatters[this.table.options.ajaxContentType],u){for(var f in u.headers)e.headers||(e.headers={}),typeof e.headers[f]>"u"&&(e.headers[f]=u.headers[f]);e.body=u.body.call(this,t,e,r)}else console.warn("Ajax Error - Invalid ajaxContentType value:",this.table.options.ajaxContentType);t?(typeof e.headers>"u"&&(e.headers={}),typeof e.headers.Accept>"u"&&(e.headers.Accept="application/json"),typeof e.headers["X-Requested-With"]>"u"&&(e.headers["X-Requested-With"]="XMLHttpRequest"),typeof e.mode>"u"&&(e.mode="cors"),e.mode=="cors"?(typeof e.headers.Origin>"u"&&(e.headers.Origin=window.location.origin),typeof e.credentials>"u"&&(e.credentials="same-origin")):typeof e.credentials>"u"&&(e.credentials="include"),fetch(t,e).then(n=>{n.ok?n.json().then(l=>{R(l)}).catch(l=>{p(l),console.warn("Ajax Load Error - Invalid JSON returned",l)}):(console.error("Ajax Load Error - Connection Error: "+n.status,n.statusText),p(n))}).catch(n=>{console.error("Ajax Load Error - Connection Error: ",n),p(n)})):(console.warn("Ajax Load Error - No URL Set"),R([]))})}function vT(t,e){var r=[];if(e=e||"",Array.isArray(t))t.forEach((R,p)=>{r=r.concat(vT(R,e?e+"["+p+"]":p))});else if(typeof t=="object")for(var u in t)r=r.concat(vT(t[u],e?e+"["+u+"]":u));else r.push({key:e,value:t});return r}var iH={json:{headers:{"Content-Type":"application/json"},body:function(t,e,r){return JSON.stringify(r)}},form:{headers:{},body:function(t,e,r){var u=vT(r),R=new FormData;return u.forEach(function(p){R.append(p.key,p.value)}),R}}};const vd=class vd extends uo{constructor(e){super(e),this.config={},this.url="",this.urlGenerator=!1,this.params=!1,this.loaderPromise=!1,this.registerTableOption("ajaxURL",!1),this.registerTableOption("ajaxURLGenerator",!1),this.registerTableOption("ajaxParams",{}),this.registerTableOption("ajaxConfig","get"),this.registerTableOption("ajaxContentType","form"),this.registerTableOption("ajaxRequestFunc",!1),this.registerTableOption("ajaxRequesting",function(){}),this.registerTableOption("ajaxResponse",!1),this.contentTypeFormatters=vd.contentTypeFormatters}initialize(){this.loaderPromise=this.table.options.ajaxRequestFunc||vd.defaultLoaderPromise,this.urlGenerator=this.table.options.ajaxURLGenerator||vd.defaultURLGenerator,this.table.options.ajaxURL&&this.setUrl(this.table.options.ajaxURL),this.setDefaultConfig(this.table.options.ajaxConfig),this.registerTableFunction("getAjaxUrl",this.getUrl.bind(this)),this.subscribe("data-loading",this.requestDataCheck.bind(this)),this.subscribe("data-params",this.requestParams.bind(this)),this.subscribe("data-load",this.requestData.bind(this))}requestParams(e,r,u,R){var p=this.table.options.ajaxParams;return p&&(typeof p=="function"&&(p=p.call(this.table)),R=Object.assign(Object.assign({},p),R)),R}requestDataCheck(e,r,u,R){return!!(!e&&this.url||typeof e=="string")}requestData(e,r,u,R,p){var f;return!p&&this.requestDataCheck(e)?(e&&this.setUrl(e),f=this.generateConfig(u),this.sendRequest(this.url,r,f)):p}setDefaultConfig(e={}){this.config=Object.assign({},vd.defaultConfig),typeof e=="string"?this.config.method=e:Object.assign(this.config,e)}generateConfig(e={}){var r=Object.assign({},this.config);return typeof e=="string"?r.method=e:Object.assign(r,e),r}setUrl(e){this.url=e}getUrl(){return this.url}sendRequest(e,r,u){return this.table.options.ajaxRequesting.call(this.table,e,r)!==!1?this.loaderPromise(e,u,r).then(R=>(this.table.options.ajaxResponse&&(R=this.table.options.ajaxResponse.call(this.table,e,r,R)),R)):Promise.reject()}};Ci(vd,"moduleName","ajax"),Ci(vd,"defaultConfig",tH),Ci(vd,"defaultURLGenerator",GL),Ci(vd,"defaultLoaderPromise",rH),Ci(vd,"contentTypeFormatters",iH);let yT=vd;var aH={replace:function(t){return this.table.setData(t)},update:function(t){return this.table.updateOrAddData(t)},insert:function(t){return this.table.addData(t)}},oH={table:function(t){var e=[],r=!0,u=this.table.columnManager.columns,R=[],p=[];return t=t.split(`
|
|
55
|
+
`)};function kj(t){var e=!1;try{e=t instanceof BigInt64Array||t instanceof BigUint64Array}catch{}return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array||e}var Sj=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,R){u.__proto__=R}||function(u,R){for(var p in R)Object.prototype.hasOwnProperty.call(R,p)&&(u[p]=R[p])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function u(){this.constructor=e}e.prototype=r===null?Object.create(r):(u.prototype=r.prototype,new u)}}();(function(t){Sj(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.componentDidMount=function(){Hc.setFrameHeight()},e.prototype.componentDidUpdate=function(){Hc.setFrameHeight()},e})(FB.PureComponent);const Aj=new TextDecoder("utf-8"),Cj=t=>Aj.decode(t),Mj=new TextEncoder,b7=t=>Mj.encode(t),rv=t=>typeof t=="function",x7=t=>t!=null&&Object(t)===t,Ej=t=>x7(t)&&"done"in t&&"value"in t,Ij=t=>x7(t)&&rv(t.clear)&&rv(t.bytes)&&rv(t.position)&&rv(t.setPosition)&&rv(t.capacity)&&rv(t.getBufferIdentifier)&&rv(t.createLong),Lj=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function _7(t,e){let r=Ej(e)?e.value:e;return r instanceof t?t===Uint8Array?new t(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=b7(r)),r instanceof ArrayBuffer?new t(r):r instanceof Lj?new t(r):Ij(r)?_7(t,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new t(0):new t(r.buffer,r.byteOffset,r.byteLength/t.BYTES_PER_ELEMENT):t.from(r)):new t(0)}function Pj(t,e){let r=0;const u=t.length;if(u!==e.length)return!1;if(u>0)do if(t[r]!==e[r])return!1;while(++r<u);return!0}var dp;(function(t){t[t.Sparse=0]="Sparse",t[t.Dense=1]="Dense"})(dp||(dp={}));var Of;(function(t){t[t.HALF=0]="HALF",t[t.SINGLE=1]="SINGLE",t[t.DOUBLE=2]="DOUBLE"})(Of||(Of={}));var dg;(function(t){t[t.DAY=0]="DAY",t[t.MILLISECOND=1]="MILLISECOND"})(dg||(dg={}));var Ja;(function(t){t[t.SECOND=0]="SECOND",t[t.MILLISECOND=1]="MILLISECOND",t[t.MICROSECOND=2]="MICROSECOND",t[t.NANOSECOND=3]="NANOSECOND"})(Ja||(Ja={}));var Iv;(function(t){t[t.YEAR_MONTH=0]="YEAR_MONTH",t[t.DAY_TIME=1]="DAY_TIME",t[t.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Iv||(Iv={}));var _r;(function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Duration=18]="Duration",t[t.LargeBinary=19]="LargeBinary",t[t.LargeUtf8=20]="LargeUtf8",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth",t[t.DurationSecond=-27]="DurationSecond",t[t.DurationMillisecond=-28]="DurationMillisecond",t[t.DurationMicrosecond=-29]="DurationMicrosecond",t[t.DurationNanosecond=-30]="DurationNanosecond"})(_r||(_r={}));var jp;(function(t){t[t.OFFSET=0]="OFFSET",t[t.DATA=1]="DATA",t[t.VALIDITY=2]="VALIDITY",t[t.TYPE=3]="TYPE"})(jp||(jp={}));const Dj=void 0;function Cb(t){if(t===null)return"null";if(t===Dj)return"undefined";switch(typeof t){case"number":return`${t}`;case"bigint":return`${t}`;case"string":return`"${t}"`}return typeof t[Symbol.toPrimitive]=="function"?t[Symbol.toPrimitive]("string"):ArrayBuffer.isView(t)?t instanceof BigInt64Array||t instanceof BigUint64Array?`[${[...t].map(e=>Cb(e))}]`:`[${t}]`:ArrayBuffer.isView(t)?`[${t}]`:JSON.stringify(t,(e,r)=>typeof r=="bigint"?`${r}`:r)}function Xh(t){if(typeof t=="bigint"&&(t<Number.MIN_SAFE_INTEGER||t>Number.MAX_SAFE_INTEGER))throw new TypeError(`${t} is not safe to convert to a number.`);return Number(t)}function w7(t,e){return Xh(t/e)+Xh(t%e)/Xh(e)}const Rj=Symbol.for("isArrowBigNum");function Pd(t,...e){return e.length===0?Object.setPrototypeOf(_7(this.TypedArray,t),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(t,...e),this.constructor.prototype)}Pd.prototype[Rj]=!0;Pd.prototype.toJSON=function(){return`"${Eb(this)}"`};Pd.prototype.valueOf=function(t){return T7(this,t)};Pd.prototype.toString=function(){return Eb(this)};Pd.prototype[Symbol.toPrimitive]=function(t="default"){switch(t){case"number":return T7(this);case"string":return Eb(this);case"default":return Fj(this)}return Eb(this)};function ly(...t){return Pd.apply(this,t)}function uy(...t){return Pd.apply(this,t)}function Mb(...t){return Pd.apply(this,t)}Object.setPrototypeOf(ly.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(uy.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Mb.prototype,Object.create(Uint32Array.prototype));Object.assign(ly.prototype,Pd.prototype,{constructor:ly,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(uy.prototype,Pd.prototype,{constructor:uy,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Mb.prototype,Pd.prototype,{constructor:Mb,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const Oj=BigInt(4294967296)*BigInt(4294967296),zj=Oj-BigInt(1);function T7(t,e){const{buffer:r,byteOffset:u,byteLength:R,signed:p}=t,f=new BigUint64Array(r,u,R/8),n=p&&f.at(-1)&BigInt(1)<<BigInt(63);let l=BigInt(0),c=0;if(n){for(const i of f)l|=(i^zj)*(BigInt(1)<<BigInt(64*c++));l*=BigInt(-1),l-=BigInt(1)}else for(const i of f)l|=i*(BigInt(1)<<BigInt(64*c++));if(typeof e=="number"){const i=BigInt(Math.pow(10,e)),_=l/i,b=l%i;return Xh(_)+Xh(b)/Xh(i)}return Xh(l)}function Eb(t){if(t.byteLength===8)return`${new t.BigIntArray(t.buffer,t.byteOffset,1)[0]}`;if(!t.signed)return p5(t);let e=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2);if(new Int16Array([e.at(-1)])[0]>=0)return p5(t);e=e.slice();let u=1;for(let p=0;p<e.length;p++){const f=e[p],n=~f+u;e[p]=n,u&=f===0?1:0}return`-${p5(e)}`}function Fj(t){return t.byteLength===8?new t.BigIntArray(t.buffer,t.byteOffset,1)[0]:Eb(t)}function p5(t){let e="";const r=new Uint32Array(2);let u=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2);const R=new Uint32Array((u=new Uint16Array(u).reverse()).buffer);let p=-1;const f=u.length-1;do{for(r[0]=u[p=0];p<f;)u[p++]=r[1]=r[0]/10,r[0]=(r[0]-r[1]*10<<16)+u[p];u[p]=r[1]=r[0]/10,r[0]=r[0]-r[1]*10,e=`${r[0]}${e}`}while(R[0]||R[1]||R[2]||R[3]);return e??"0"}class B4{static new(e,r){switch(r){case!0:return new ly(e);case!1:return new uy(e)}switch(e.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new ly(e)}return e.byteLength===16?new Mb(e):new uy(e)}static signed(e){return new ly(e)}static unsigned(e){return new uy(e)}static decimal(e){return new Mb(e)}constructor(e,r){return B4.new(e,r)}}var k7,S7,A7,C7,M7,E7,I7,L7,P7,D7,R7,O7,z7,F7,B7,N7,V7,j7,U7,H7,q7,W7;class so{static isNull(e){return(e==null?void 0:e.typeId)===_r.Null}static isInt(e){return(e==null?void 0:e.typeId)===_r.Int}static isFloat(e){return(e==null?void 0:e.typeId)===_r.Float}static isBinary(e){return(e==null?void 0:e.typeId)===_r.Binary}static isLargeBinary(e){return(e==null?void 0:e.typeId)===_r.LargeBinary}static isUtf8(e){return(e==null?void 0:e.typeId)===_r.Utf8}static isLargeUtf8(e){return(e==null?void 0:e.typeId)===_r.LargeUtf8}static isBool(e){return(e==null?void 0:e.typeId)===_r.Bool}static isDecimal(e){return(e==null?void 0:e.typeId)===_r.Decimal}static isDate(e){return(e==null?void 0:e.typeId)===_r.Date}static isTime(e){return(e==null?void 0:e.typeId)===_r.Time}static isTimestamp(e){return(e==null?void 0:e.typeId)===_r.Timestamp}static isInterval(e){return(e==null?void 0:e.typeId)===_r.Interval}static isDuration(e){return(e==null?void 0:e.typeId)===_r.Duration}static isList(e){return(e==null?void 0:e.typeId)===_r.List}static isStruct(e){return(e==null?void 0:e.typeId)===_r.Struct}static isUnion(e){return(e==null?void 0:e.typeId)===_r.Union}static isFixedSizeBinary(e){return(e==null?void 0:e.typeId)===_r.FixedSizeBinary}static isFixedSizeList(e){return(e==null?void 0:e.typeId)===_r.FixedSizeList}static isMap(e){return(e==null?void 0:e.typeId)===_r.Map}static isDictionary(e){return(e==null?void 0:e.typeId)===_r.Dictionary}static isDenseUnion(e){return so.isUnion(e)&&e.mode===dp.Dense}static isSparseUnion(e){return so.isUnion(e)&&e.mode===dp.Sparse}constructor(e){this.typeId=e}}k7=Symbol.toStringTag;so[k7]=(t=>(t.children=null,t.ArrayType=Array,t.OffsetArrayType=Int32Array,t[Symbol.toStringTag]="DataType"))(so.prototype);class PC extends so{constructor(){super(_r.Null)}toString(){return"Null"}}S7=Symbol.toStringTag;PC[S7]=(t=>t[Symbol.toStringTag]="Null")(PC.prototype);class DC extends so{constructor(e,r){super(_r.Int),this.isSigned=e,this.bitWidth=r}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}A7=Symbol.toStringTag;DC[A7]=(t=>(t.isSigned=null,t.bitWidth=null,t[Symbol.toStringTag]="Int"))(DC.prototype);class RC extends so{constructor(e){super(_r.Float),this.precision=e}get ArrayType(){switch(this.precision){case Of.HALF:return Uint16Array;case Of.SINGLE:return Float32Array;case Of.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}C7=Symbol.toStringTag;RC[C7]=(t=>(t.precision=null,t[Symbol.toStringTag]="Float"))(RC.prototype);class OC extends so{constructor(){super(_r.Binary)}toString(){return"Binary"}}M7=Symbol.toStringTag;OC[M7]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Binary"))(OC.prototype);class zC extends so{constructor(){super(_r.LargeBinary)}toString(){return"LargeBinary"}}E7=Symbol.toStringTag;zC[E7]=(t=>(t.ArrayType=Uint8Array,t.OffsetArrayType=BigInt64Array,t[Symbol.toStringTag]="LargeBinary"))(zC.prototype);class FC extends so{constructor(){super(_r.Utf8)}toString(){return"Utf8"}}I7=Symbol.toStringTag;FC[I7]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Utf8"))(FC.prototype);class BC extends so{constructor(){super(_r.LargeUtf8)}toString(){return"LargeUtf8"}}L7=Symbol.toStringTag;BC[L7]=(t=>(t.ArrayType=Uint8Array,t.OffsetArrayType=BigInt64Array,t[Symbol.toStringTag]="LargeUtf8"))(BC.prototype);class NC extends so{constructor(){super(_r.Bool)}toString(){return"Bool"}}P7=Symbol.toStringTag;NC[P7]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Bool"))(NC.prototype);class VC extends so{constructor(e,r,u=128){super(_r.Decimal),this.scale=e,this.precision=r,this.bitWidth=u}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}D7=Symbol.toStringTag;VC[D7]=(t=>(t.scale=null,t.precision=null,t.ArrayType=Uint32Array,t[Symbol.toStringTag]="Decimal"))(VC.prototype);class jC extends so{constructor(e){super(_r.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${dg[this.unit]}>`}get ArrayType(){return this.unit===dg.DAY?Int32Array:BigInt64Array}}R7=Symbol.toStringTag;jC[R7]=(t=>(t.unit=null,t[Symbol.toStringTag]="Date"))(jC.prototype);class UC extends so{constructor(e,r){super(_r.Time),this.unit=e,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${Ja[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}O7=Symbol.toStringTag;UC[O7]=(t=>(t.unit=null,t.bitWidth=null,t[Symbol.toStringTag]="Time"))(UC.prototype);class HC extends so{constructor(e,r){super(_r.Timestamp),this.unit=e,this.timezone=r}toString(){return`Timestamp<${Ja[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}z7=Symbol.toStringTag;HC[z7]=(t=>(t.unit=null,t.timezone=null,t.ArrayType=BigInt64Array,t[Symbol.toStringTag]="Timestamp"))(HC.prototype);class qC extends so{constructor(e){super(_r.Interval),this.unit=e}toString(){return`Interval<${Iv[this.unit]}>`}}F7=Symbol.toStringTag;qC[F7]=(t=>(t.unit=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Interval"))(qC.prototype);class WC extends so{constructor(e){super(_r.Duration),this.unit=e}toString(){return`Duration<${Ja[this.unit]}>`}}B7=Symbol.toStringTag;WC[B7]=(t=>(t.unit=null,t.ArrayType=BigInt64Array,t[Symbol.toStringTag]="Duration"))(WC.prototype);class GC extends so{constructor(e){super(_r.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}N7=Symbol.toStringTag;GC[N7]=(t=>(t.children=null,t[Symbol.toStringTag]="List"))(GC.prototype);class $C extends so{constructor(e){super(_r.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}V7=Symbol.toStringTag;$C[V7]=(t=>(t.children=null,t[Symbol.toStringTag]="Struct"))($C.prototype);class YC extends so{constructor(e,r,u){super(_r.Union),this.mode=e,this.children=u,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((R,p,f)=>(R[p]=f)&&R||R,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(" | ")}>`}}j7=Symbol.toStringTag;YC[j7]=(t=>(t.mode=null,t.typeIds=null,t.children=null,t.typeIdToChildIndex=null,t.ArrayType=Int8Array,t[Symbol.toStringTag]="Union"))(YC.prototype);class ZC extends so{constructor(e){super(_r.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}U7=Symbol.toStringTag;ZC[U7]=(t=>(t.byteWidth=null,t.ArrayType=Uint8Array,t[Symbol.toStringTag]="FixedSizeBinary"))(ZC.prototype);class XC extends so{constructor(e,r){super(_r.FixedSizeList),this.listSize=e,this.children=[r]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}H7=Symbol.toStringTag;XC[H7]=(t=>(t.children=null,t.listSize=null,t[Symbol.toStringTag]="FixedSizeList"))(XC.prototype);class KC extends so{constructor(e,r=!1){var u,R,p;if(super(_r.Map),this.children=[e],this.keysSorted=r,e&&(e.name="entries",!((u=e==null?void 0:e.type)===null||u===void 0)&&u.children)){const f=(R=e==null?void 0:e.type)===null||R===void 0?void 0:R.children[0];f&&(f.name="key");const n=(p=e==null?void 0:e.type)===null||p===void 0?void 0:p.children[1];n&&(n.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}q7=Symbol.toStringTag;KC[q7]=(t=>(t.children=null,t.keysSorted=null,t[Symbol.toStringTag]="Map_"))(KC.prototype);const Bj=(t=>()=>++t)(-1);class JC extends so{constructor(e,r,u,R){super(_r.Dictionary),this.indices=r,this.dictionary=e,this.isOrdered=R||!1,this.id=u==null?Bj():Xh(u)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}W7=Symbol.toStringTag;JC[W7]=(t=>(t.id=null,t.indices=null,t.isOrdered=null,t.dictionary=null,t[Symbol.toStringTag]="Dictionary"))(JC.prototype);function G7(t){const e=t;switch(t.typeId){case _r.Decimal:return t.bitWidth/32;case _r.Interval:return 1+e.unit;case _r.FixedSizeList:return e.listSize;case _r.FixedSizeBinary:return e.byteWidth;default:return 1}}class zo{visitMany(e,...r){return e.map((u,R)=>this.visit(u,...r.map(p=>p[R])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,r=!0){return Nj(this,e,r)}getVisitFnByTypeId(e,r=!0){return V0(this,e,r)}visitNull(e,...r){return null}visitBool(e,...r){return null}visitInt(e,...r){return null}visitFloat(e,...r){return null}visitUtf8(e,...r){return null}visitLargeUtf8(e,...r){return null}visitBinary(e,...r){return null}visitLargeBinary(e,...r){return null}visitFixedSizeBinary(e,...r){return null}visitDate(e,...r){return null}visitTimestamp(e,...r){return null}visitTime(e,...r){return null}visitDecimal(e,...r){return null}visitList(e,...r){return null}visitStruct(e,...r){return null}visitUnion(e,...r){return null}visitDictionary(e,...r){return null}visitInterval(e,...r){return null}visitDuration(e,...r){return null}visitFixedSizeList(e,...r){return null}visitMap(e,...r){return null}}function Nj(t,e,r=!0){return typeof e=="number"?V0(t,e,r):typeof e=="string"&&e in _r?V0(t,_r[e],r):e&&e instanceof so?V0(t,QC(e),r):e!=null&&e.type&&e.type instanceof so?V0(t,QC(e.type),r):V0(t,_r.NONE,r)}function V0(t,e,r=!0){let u=null;switch(e){case _r.Null:u=t.visitNull;break;case _r.Bool:u=t.visitBool;break;case _r.Int:u=t.visitInt;break;case _r.Int8:u=t.visitInt8||t.visitInt;break;case _r.Int16:u=t.visitInt16||t.visitInt;break;case _r.Int32:u=t.visitInt32||t.visitInt;break;case _r.Int64:u=t.visitInt64||t.visitInt;break;case _r.Uint8:u=t.visitUint8||t.visitInt;break;case _r.Uint16:u=t.visitUint16||t.visitInt;break;case _r.Uint32:u=t.visitUint32||t.visitInt;break;case _r.Uint64:u=t.visitUint64||t.visitInt;break;case _r.Float:u=t.visitFloat;break;case _r.Float16:u=t.visitFloat16||t.visitFloat;break;case _r.Float32:u=t.visitFloat32||t.visitFloat;break;case _r.Float64:u=t.visitFloat64||t.visitFloat;break;case _r.Utf8:u=t.visitUtf8;break;case _r.LargeUtf8:u=t.visitLargeUtf8;break;case _r.Binary:u=t.visitBinary;break;case _r.LargeBinary:u=t.visitLargeBinary;break;case _r.FixedSizeBinary:u=t.visitFixedSizeBinary;break;case _r.Date:u=t.visitDate;break;case _r.DateDay:u=t.visitDateDay||t.visitDate;break;case _r.DateMillisecond:u=t.visitDateMillisecond||t.visitDate;break;case _r.Timestamp:u=t.visitTimestamp;break;case _r.TimestampSecond:u=t.visitTimestampSecond||t.visitTimestamp;break;case _r.TimestampMillisecond:u=t.visitTimestampMillisecond||t.visitTimestamp;break;case _r.TimestampMicrosecond:u=t.visitTimestampMicrosecond||t.visitTimestamp;break;case _r.TimestampNanosecond:u=t.visitTimestampNanosecond||t.visitTimestamp;break;case _r.Time:u=t.visitTime;break;case _r.TimeSecond:u=t.visitTimeSecond||t.visitTime;break;case _r.TimeMillisecond:u=t.visitTimeMillisecond||t.visitTime;break;case _r.TimeMicrosecond:u=t.visitTimeMicrosecond||t.visitTime;break;case _r.TimeNanosecond:u=t.visitTimeNanosecond||t.visitTime;break;case _r.Decimal:u=t.visitDecimal;break;case _r.List:u=t.visitList;break;case _r.Struct:u=t.visitStruct;break;case _r.Union:u=t.visitUnion;break;case _r.DenseUnion:u=t.visitDenseUnion||t.visitUnion;break;case _r.SparseUnion:u=t.visitSparseUnion||t.visitUnion;break;case _r.Dictionary:u=t.visitDictionary;break;case _r.Interval:u=t.visitInterval;break;case _r.IntervalDayTime:u=t.visitIntervalDayTime||t.visitInterval;break;case _r.IntervalYearMonth:u=t.visitIntervalYearMonth||t.visitInterval;break;case _r.Duration:u=t.visitDuration;break;case _r.DurationSecond:u=t.visitDurationSecond||t.visitDuration;break;case _r.DurationMillisecond:u=t.visitDurationMillisecond||t.visitDuration;break;case _r.DurationMicrosecond:u=t.visitDurationMicrosecond||t.visitDuration;break;case _r.DurationNanosecond:u=t.visitDurationNanosecond||t.visitDuration;break;case _r.FixedSizeList:u=t.visitFixedSizeList;break;case _r.Map:u=t.visitMap;break}if(typeof u=="function")return u;if(!r)return()=>null;throw new Error(`Unrecognized type '${_r[e]}'`)}function QC(t){switch(t.typeId){case _r.Null:return _r.Null;case _r.Int:{const{bitWidth:e,isSigned:r}=t;switch(e){case 8:return r?_r.Int8:_r.Uint8;case 16:return r?_r.Int16:_r.Uint16;case 32:return r?_r.Int32:_r.Uint32;case 64:return r?_r.Int64:_r.Uint64}return _r.Int}case _r.Float:switch(t.precision){case Of.HALF:return _r.Float16;case Of.SINGLE:return _r.Float32;case Of.DOUBLE:return _r.Float64}return _r.Float;case _r.Binary:return _r.Binary;case _r.LargeBinary:return _r.LargeBinary;case _r.Utf8:return _r.Utf8;case _r.LargeUtf8:return _r.LargeUtf8;case _r.Bool:return _r.Bool;case _r.Decimal:return _r.Decimal;case _r.Time:switch(t.unit){case Ja.SECOND:return _r.TimeSecond;case Ja.MILLISECOND:return _r.TimeMillisecond;case Ja.MICROSECOND:return _r.TimeMicrosecond;case Ja.NANOSECOND:return _r.TimeNanosecond}return _r.Time;case _r.Timestamp:switch(t.unit){case Ja.SECOND:return _r.TimestampSecond;case Ja.MILLISECOND:return _r.TimestampMillisecond;case Ja.MICROSECOND:return _r.TimestampMicrosecond;case Ja.NANOSECOND:return _r.TimestampNanosecond}return _r.Timestamp;case _r.Date:switch(t.unit){case dg.DAY:return _r.DateDay;case dg.MILLISECOND:return _r.DateMillisecond}return _r.Date;case _r.Interval:switch(t.unit){case Iv.DAY_TIME:return _r.IntervalDayTime;case Iv.YEAR_MONTH:return _r.IntervalYearMonth}return _r.Interval;case _r.Duration:switch(t.unit){case Ja.SECOND:return _r.DurationSecond;case Ja.MILLISECOND:return _r.DurationMillisecond;case Ja.MICROSECOND:return _r.DurationMicrosecond;case Ja.NANOSECOND:return _r.DurationNanosecond}return _r.Duration;case _r.Map:return _r.Map;case _r.List:return _r.List;case _r.Struct:return _r.Struct;case _r.Union:switch(t.mode){case dp.Dense:return _r.DenseUnion;case dp.Sparse:return _r.SparseUnion}return _r.Union;case _r.FixedSizeBinary:return _r.FixedSizeBinary;case _r.FixedSizeList:return _r.FixedSizeList;case _r.Dictionary:return _r.Dictionary}throw new Error(`Unrecognized type '${_r[t.typeId]}'`)}zo.prototype.visitInt8=null;zo.prototype.visitInt16=null;zo.prototype.visitInt32=null;zo.prototype.visitInt64=null;zo.prototype.visitUint8=null;zo.prototype.visitUint16=null;zo.prototype.visitUint32=null;zo.prototype.visitUint64=null;zo.prototype.visitFloat16=null;zo.prototype.visitFloat32=null;zo.prototype.visitFloat64=null;zo.prototype.visitDateDay=null;zo.prototype.visitDateMillisecond=null;zo.prototype.visitTimestampSecond=null;zo.prototype.visitTimestampMillisecond=null;zo.prototype.visitTimestampMicrosecond=null;zo.prototype.visitTimestampNanosecond=null;zo.prototype.visitTimeSecond=null;zo.prototype.visitTimeMillisecond=null;zo.prototype.visitTimeMicrosecond=null;zo.prototype.visitTimeNanosecond=null;zo.prototype.visitDenseUnion=null;zo.prototype.visitSparseUnion=null;zo.prototype.visitIntervalDayTime=null;zo.prototype.visitIntervalYearMonth=null;zo.prototype.visitDuration=null;zo.prototype.visitDurationSecond=null;zo.prototype.visitDurationMillisecond=null;zo.prototype.visitDurationMicrosecond=null;zo.prototype.visitDurationNanosecond=null;const $7=new Float64Array(1),C0=new Uint32Array($7.buffer);function Y7(t){const e=(t&31744)>>10,r=(t&1023)/1024,u=Math.pow(-1,(t&32768)>>15);switch(e){case 31:return u*(r?Number.NaN:1/0);case 0:return u*(r?6103515625e-14*r:0)}return u*Math.pow(2,e-15)*(1+r)}function Vj(t){if(t!==t)return 32256;$7[0]=t;const e=(C0[1]&2147483648)>>16&65535;let r=C0[1]&2146435072,u=0;return r>=1089470464?C0[0]>0?r=31744:(r=(r&2080374784)>>16,u=(C0[1]&1048575)>>10):r<=1056964608?(u=1048576+(C0[1]&1048575),u=1048576+(u<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,u=(C0[1]&1048575)+512>>10),e|r|u&65535}class da extends zo{}function ya(t){return(e,r,u)=>{if(e.setValid(r,u!=null))return t(e,r,u)}}const jj=(t,e,r)=>{t[e]=Math.floor(r/864e5)},Z7=(t,e,r,u)=>{if(r+1<e.length){const R=Xh(e[r]),p=Xh(e[r+1]);t.set(u.subarray(0,p-R),R)}},Uj=({offset:t,values:e},r,u)=>{const R=t+r;u?e[R>>3]|=1<<R%8:e[R>>3]&=~(1<<R%8)},fm=({values:t},e,r)=>{t[e]=r},N4=({values:t},e,r)=>{t[e]=r},X7=({values:t},e,r)=>{t[e]=Vj(r)},Hj=(t,e,r)=>{switch(t.type.precision){case Of.HALF:return X7(t,e,r);case Of.SINGLE:case Of.DOUBLE:return N4(t,e,r)}},K7=({values:t},e,r)=>{jj(t,e,r.valueOf())},J7=({values:t},e,r)=>{t[e]=BigInt(r)},qj=({stride:t,values:e},r,u)=>{e.set(u.subarray(0,t),t*r)},Q7=({values:t,valueOffsets:e},r,u)=>Z7(t,e,r,u),eL=({values:t,valueOffsets:e},r,u)=>Z7(t,e,r,b7(u)),Wj=(t,e,r)=>{t.type.unit===dg.DAY?K7(t,e,r):J7(t,e,r)},tL=({values:t},e,r)=>{t[e]=BigInt(r/1e3)},nL=({values:t},e,r)=>{t[e]=BigInt(r)},rL=({values:t},e,r)=>{t[e]=BigInt(r*1e3)},iL=({values:t},e,r)=>{t[e]=BigInt(r*1e6)},Gj=(t,e,r)=>{switch(t.type.unit){case Ja.SECOND:return tL(t,e,r);case Ja.MILLISECOND:return nL(t,e,r);case Ja.MICROSECOND:return rL(t,e,r);case Ja.NANOSECOND:return iL(t,e,r)}},aL=({values:t},e,r)=>{t[e]=r},oL=({values:t},e,r)=>{t[e]=r},sL=({values:t},e,r)=>{t[e]=r},lL=({values:t},e,r)=>{t[e]=r},$j=(t,e,r)=>{switch(t.type.unit){case Ja.SECOND:return aL(t,e,r);case Ja.MILLISECOND:return oL(t,e,r);case Ja.MICROSECOND:return sL(t,e,r);case Ja.NANOSECOND:return lL(t,e,r)}},Yj=({values:t,stride:e},r,u)=>{t.set(u.subarray(0,e),e*r)},Zj=(t,e,r)=>{const u=t.children[0],R=t.valueOffsets,p=pp.getVisitFn(u);if(Array.isArray(r))for(let f=-1,n=R[e],l=R[e+1];n<l;)p(u,n++,r[++f]);else for(let f=-1,n=R[e],l=R[e+1];n<l;)p(u,n++,r.get(++f))},Xj=(t,e,r)=>{const u=t.children[0],{valueOffsets:R}=t,p=pp.getVisitFn(u);let{[e]:f,[e+1]:n}=R;const l=r instanceof Map?r.entries():Object.entries(r);for(const c of l)if(p(u,f,c),++f>=n)break},Kj=(t,e)=>(r,u,R,p)=>u&&r(u,t,e[p]),Jj=(t,e)=>(r,u,R,p)=>u&&r(u,t,e.get(p)),Qj=(t,e)=>(r,u,R,p)=>u&&r(u,t,e.get(R.name)),eU=(t,e)=>(r,u,R,p)=>u&&r(u,t,e[R.name]),tU=(t,e,r)=>{const u=t.type.children.map(p=>pp.getVisitFn(p.type)),R=r instanceof Map?Qj(e,r):r instanceof qc?Jj(e,r):Array.isArray(r)?Kj(e,r):eU(e,r);t.type.children.forEach((p,f)=>R(u[f],t.children[f],p,f))},nU=(t,e,r)=>{t.type.mode===dp.Dense?uL(t,e,r):cL(t,e,r)},uL=(t,e,r)=>{const u=t.type.typeIdToChildIndex[t.typeIds[e]],R=t.children[u];pp.visit(R,t.valueOffsets[e],r)},cL=(t,e,r)=>{const u=t.type.typeIdToChildIndex[t.typeIds[e]],R=t.children[u];pp.visit(R,e,r)},rU=(t,e,r)=>{var u;(u=t.dictionary)===null||u===void 0||u.set(t.values[e],r)},iU=(t,e,r)=>{t.type.unit===Iv.DAY_TIME?hL(t,e,r):fL(t,e,r)},hL=({values:t},e,r)=>{t.set(r.subarray(0,2),2*e)},fL=({values:t},e,r)=>{t[e]=r[0]*12+r[1]%12},dL=({values:t},e,r)=>{t[e]=r},pL=({values:t},e,r)=>{t[e]=r},mL=({values:t},e,r)=>{t[e]=r},gL=({values:t},e,r)=>{t[e]=r},aU=(t,e,r)=>{switch(t.type.unit){case Ja.SECOND:return dL(t,e,r);case Ja.MILLISECOND:return pL(t,e,r);case Ja.MICROSECOND:return mL(t,e,r);case Ja.NANOSECOND:return gL(t,e,r)}},oU=(t,e,r)=>{const{stride:u}=t,R=t.children[0],p=pp.getVisitFn(R);if(Array.isArray(r))for(let f=-1,n=e*u;++f<u;)p(R,n+f,r[f]);else for(let f=-1,n=e*u;++f<u;)p(R,n+f,r.get(f))};da.prototype.visitBool=ya(Uj);da.prototype.visitInt=ya(fm);da.prototype.visitInt8=ya(fm);da.prototype.visitInt16=ya(fm);da.prototype.visitInt32=ya(fm);da.prototype.visitInt64=ya(fm);da.prototype.visitUint8=ya(fm);da.prototype.visitUint16=ya(fm);da.prototype.visitUint32=ya(fm);da.prototype.visitUint64=ya(fm);da.prototype.visitFloat=ya(Hj);da.prototype.visitFloat16=ya(X7);da.prototype.visitFloat32=ya(N4);da.prototype.visitFloat64=ya(N4);da.prototype.visitUtf8=ya(eL);da.prototype.visitLargeUtf8=ya(eL);da.prototype.visitBinary=ya(Q7);da.prototype.visitLargeBinary=ya(Q7);da.prototype.visitFixedSizeBinary=ya(qj);da.prototype.visitDate=ya(Wj);da.prototype.visitDateDay=ya(K7);da.prototype.visitDateMillisecond=ya(J7);da.prototype.visitTimestamp=ya(Gj);da.prototype.visitTimestampSecond=ya(tL);da.prototype.visitTimestampMillisecond=ya(nL);da.prototype.visitTimestampMicrosecond=ya(rL);da.prototype.visitTimestampNanosecond=ya(iL);da.prototype.visitTime=ya($j);da.prototype.visitTimeSecond=ya(aL);da.prototype.visitTimeMillisecond=ya(oL);da.prototype.visitTimeMicrosecond=ya(sL);da.prototype.visitTimeNanosecond=ya(lL);da.prototype.visitDecimal=ya(Yj);da.prototype.visitList=ya(Zj);da.prototype.visitStruct=ya(tU);da.prototype.visitUnion=ya(nU);da.prototype.visitDenseUnion=ya(uL);da.prototype.visitSparseUnion=ya(cL);da.prototype.visitDictionary=ya(rU);da.prototype.visitInterval=ya(iU);da.prototype.visitIntervalDayTime=ya(hL);da.prototype.visitIntervalYearMonth=ya(fL);da.prototype.visitDuration=ya(aU);da.prototype.visitDurationSecond=ya(dL);da.prototype.visitDurationMillisecond=ya(pL);da.prototype.visitDurationMicrosecond=ya(mL);da.prototype.visitDurationNanosecond=ya(gL);da.prototype.visitFixedSizeList=ya(oU);da.prototype.visitMap=ya(Xj);const pp=new da,bd=Symbol.for("parent"),cy=Symbol.for("rowIndex");class V4{constructor(e,r){return this[bd]=e,this[cy]=r,new Proxy(this,new lU)}toArray(){return Object.values(this.toJSON())}toJSON(){const e=this[cy],r=this[bd],u=r.type.children,R={};for(let p=-1,f=u.length;++p<f;)R[u[p].name]=ad.visit(r.children[p],e);return R}toString(){return`{${[...this].map(([e,r])=>`${Cb(e)}: ${Cb(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new sU(this[bd],this[cy])}}class sU{constructor(e,r){this.childIndex=0,this.children=e.children,this.rowIndex=r,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const e=this.childIndex;return e<this.numChildren?(this.childIndex=e+1,{done:!1,value:[this.childFields[e].name,ad.visit(this.children[e],this.rowIndex)]}):{done:!0,value:null}}}Object.defineProperties(V4.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[bd]:{writable:!0,enumerable:!1,configurable:!1,value:null},[cy]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class lU{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[bd].type.children.map(r=>r.name)}has(e,r){return e[bd].type.children.findIndex(u=>u.name===r)!==-1}getOwnPropertyDescriptor(e,r){if(e[bd].type.children.findIndex(u=>u.name===r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,r){if(Reflect.has(e,r))return e[r];const u=e[bd].type.children.findIndex(R=>R.name===r);if(u!==-1){const R=ad.visit(e[bd].children[u],e[cy]);return Reflect.set(e,r,R),R}}set(e,r,u){const R=e[bd].type.children.findIndex(p=>p.name===r);return R!==-1?(pp.visit(e[bd].children[R],e[cy],u),Reflect.set(e,r,u)):Reflect.has(e,r)||typeof r=="symbol"?Reflect.set(e,r,u):!1}}class ua extends zo{}function pa(t){return(e,r)=>e.getValid(r)?t(e,r):null}const uU=(t,e)=>864e5*t[e],cU=(t,e)=>null,vL=(t,e,r)=>{if(r+1>=e.length)return null;const u=Xh(e[r]),R=Xh(e[r+1]);return t.subarray(u,R)},hU=({offset:t,values:e},r)=>{const u=t+r;return(e[u>>3]&1<<u%8)!==0},yL=({values:t},e)=>uU(t,e),bL=({values:t},e)=>Xh(t[e]),Ag=({stride:t,values:e},r)=>e[t*r],fU=({stride:t,values:e},r)=>Y7(e[t*r]),xL=({values:t},e)=>t[e],dU=({stride:t,values:e},r)=>e.subarray(t*r,t*(r+1)),_L=({values:t,valueOffsets:e},r)=>vL(t,e,r),wL=({values:t,valueOffsets:e},r)=>{const u=vL(t,e,r);return u!==null?Cj(u):null},pU=({values:t},e)=>t[e],mU=({type:t,values:e},r)=>t.precision!==Of.HALF?e[r]:Y7(e[r]),gU=(t,e)=>t.type.unit===dg.DAY?yL(t,e):bL(t,e),TL=({values:t},e)=>1e3*Xh(t[e]),kL=({values:t},e)=>Xh(t[e]),SL=({values:t},e)=>w7(t[e],BigInt(1e3)),AL=({values:t},e)=>w7(t[e],BigInt(1e6)),vU=(t,e)=>{switch(t.type.unit){case Ja.SECOND:return TL(t,e);case Ja.MILLISECOND:return kL(t,e);case Ja.MICROSECOND:return SL(t,e);case Ja.NANOSECOND:return AL(t,e)}},CL=({values:t},e)=>t[e],ML=({values:t},e)=>t[e],EL=({values:t},e)=>t[e],IL=({values:t},e)=>t[e],yU=(t,e)=>{switch(t.type.unit){case Ja.SECOND:return CL(t,e);case Ja.MILLISECOND:return ML(t,e);case Ja.MICROSECOND:return EL(t,e);case Ja.NANOSECOND:return IL(t,e)}},bU=({values:t,stride:e},r)=>B4.decimal(t.subarray(e*r,e*(r+1))),xU=(t,e)=>{const{valueOffsets:r,stride:u,children:R}=t,{[e*u]:p,[e*u+1]:f}=r,l=R[0].slice(p,f-p);return new qc([l])},_U=(t,e)=>{const{valueOffsets:r,children:u}=t,{[e]:R,[e+1]:p}=r,f=u[0];return new j4(f.slice(R,p-R))},wU=(t,e)=>new V4(t,e),TU=(t,e)=>t.type.mode===dp.Dense?LL(t,e):PL(t,e),LL=(t,e)=>{const r=t.type.typeIdToChildIndex[t.typeIds[e]],u=t.children[r];return ad.visit(u,t.valueOffsets[e])},PL=(t,e)=>{const r=t.type.typeIdToChildIndex[t.typeIds[e]],u=t.children[r];return ad.visit(u,e)},kU=(t,e)=>{var r;return(r=t.dictionary)===null||r===void 0?void 0:r.get(t.values[e])},SU=(t,e)=>t.type.unit===Iv.DAY_TIME?DL(t,e):RL(t,e),DL=({values:t},e)=>t.subarray(2*e,2*(e+1)),RL=({values:t},e)=>{const r=t[e],u=new Int32Array(2);return u[0]=Math.trunc(r/12),u[1]=Math.trunc(r%12),u},OL=({values:t},e)=>t[e],zL=({values:t},e)=>t[e],FL=({values:t},e)=>t[e],BL=({values:t},e)=>t[e],AU=(t,e)=>{switch(t.type.unit){case Ja.SECOND:return OL(t,e);case Ja.MILLISECOND:return zL(t,e);case Ja.MICROSECOND:return FL(t,e);case Ja.NANOSECOND:return BL(t,e)}},CU=(t,e)=>{const{stride:r,children:u}=t,p=u[0].slice(e*r,r);return new qc([p])};ua.prototype.visitNull=pa(cU);ua.prototype.visitBool=pa(hU);ua.prototype.visitInt=pa(pU);ua.prototype.visitInt8=pa(Ag);ua.prototype.visitInt16=pa(Ag);ua.prototype.visitInt32=pa(Ag);ua.prototype.visitInt64=pa(xL);ua.prototype.visitUint8=pa(Ag);ua.prototype.visitUint16=pa(Ag);ua.prototype.visitUint32=pa(Ag);ua.prototype.visitUint64=pa(xL);ua.prototype.visitFloat=pa(mU);ua.prototype.visitFloat16=pa(fU);ua.prototype.visitFloat32=pa(Ag);ua.prototype.visitFloat64=pa(Ag);ua.prototype.visitUtf8=pa(wL);ua.prototype.visitLargeUtf8=pa(wL);ua.prototype.visitBinary=pa(_L);ua.prototype.visitLargeBinary=pa(_L);ua.prototype.visitFixedSizeBinary=pa(dU);ua.prototype.visitDate=pa(gU);ua.prototype.visitDateDay=pa(yL);ua.prototype.visitDateMillisecond=pa(bL);ua.prototype.visitTimestamp=pa(vU);ua.prototype.visitTimestampSecond=pa(TL);ua.prototype.visitTimestampMillisecond=pa(kL);ua.prototype.visitTimestampMicrosecond=pa(SL);ua.prototype.visitTimestampNanosecond=pa(AL);ua.prototype.visitTime=pa(yU);ua.prototype.visitTimeSecond=pa(CL);ua.prototype.visitTimeMillisecond=pa(ML);ua.prototype.visitTimeMicrosecond=pa(EL);ua.prototype.visitTimeNanosecond=pa(IL);ua.prototype.visitDecimal=pa(bU);ua.prototype.visitList=pa(xU);ua.prototype.visitStruct=pa(wU);ua.prototype.visitUnion=pa(TU);ua.prototype.visitDenseUnion=pa(LL);ua.prototype.visitSparseUnion=pa(PL);ua.prototype.visitDictionary=pa(kU);ua.prototype.visitInterval=pa(SU);ua.prototype.visitIntervalDayTime=pa(DL);ua.prototype.visitIntervalYearMonth=pa(RL);ua.prototype.visitDuration=pa(AU);ua.prototype.visitDurationSecond=pa(OL);ua.prototype.visitDurationMillisecond=pa(zL);ua.prototype.visitDurationMicrosecond=pa(FL);ua.prototype.visitDurationNanosecond=pa(BL);ua.prototype.visitFixedSizeList=pa(CU);ua.prototype.visitMap=pa(_U);const ad=new ua,j0=Symbol.for("keys"),hy=Symbol.for("vals"),U0=Symbol.for("kKeysAsStrings"),dT=Symbol.for("_kKeysAsStrings");class j4{constructor(e){return this[j0]=new qc([e.children[0]]).memoize(),this[hy]=e.children[1],new Proxy(this,new EU)}get[U0](){return this[dT]||(this[dT]=Array.from(this[j0].toArray(),String))}[Symbol.iterator](){return new MU(this[j0],this[hy])}get size(){return this[j0].length}toArray(){return Object.values(this.toJSON())}toJSON(){const e=this[j0],r=this[hy],u={};for(let R=-1,p=e.length;++R<p;)u[e.get(R)]=ad.visit(r,R);return u}toString(){return`{${[...this].map(([e,r])=>`${Cb(e)}: ${Cb(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class MU{constructor(e,r){this.keys=e,this.vals=r,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){const e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),ad.visit(this.vals,e)]})}}class EU{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[U0]}has(e,r){return e[U0].includes(r)}getOwnPropertyDescriptor(e,r){if(e[U0].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,r){if(Reflect.has(e,r))return e[r];const u=e[U0].indexOf(r);if(u!==-1){const R=ad.visit(Reflect.get(e,hy),u);return Reflect.set(e,r,R),R}}set(e,r,u){const R=e[U0].indexOf(r);return R!==-1?(pp.visit(Reflect.get(e,hy),R,u),Reflect.set(e,r,u)):Reflect.has(e,r)?Reflect.set(e,r,u):!1}}Object.defineProperties(j4.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[j0]:{writable:!0,enumerable:!1,configurable:!1,value:null},[hy]:{writable:!0,enumerable:!1,configurable:!1,value:null},[dT]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let e6;function IU(t,e,r,u){const{length:R=0}=t;let p=typeof e!="number"?0:e,f=typeof r!="number"?R:r;return p<0&&(p=(p%R+R)%R),f<0&&(f=(f%R+R)%R),f<p&&(e6=p,p=f,f=e6),f>R&&(f=R),u?u(t,p,f):[p,f]}const LU=(t,e)=>t<0?e+t:t,t6=t=>t!==t;function Oy(t){if(typeof t!=="object"||t===null)return t6(t)?t6:r=>r===t;if(t instanceof Date){const r=t.valueOf();return u=>u instanceof Date?u.valueOf()===r:!1}return ArrayBuffer.isView(t)?r=>r?Pj(t,r):!1:t instanceof Map?DU(t):Array.isArray(t)?PU(t):t instanceof qc?RU(t):OU(t,!0)}function PU(t){const e=[];for(let r=-1,u=t.length;++r<u;)e[r]=Oy(t[r]);return Mw(e)}function DU(t){let e=-1;const r=[];for(const u of t.values())r[++e]=Oy(u);return Mw(r)}function RU(t){const e=[];for(let r=-1,u=t.length;++r<u;)e[r]=Oy(t.get(r));return Mw(e)}function OU(t,e=!1){const r=Object.keys(t);if(!e&&r.length===0)return()=>!1;const u=[];for(let R=-1,p=r.length;++R<p;)u[R]=Oy(t[r[R]]);return Mw(u,r)}function Mw(t,e){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return zU(t,r);case Map:return n6(t,r,r.keys());case j4:case V4:case Object:case void 0:return n6(t,r,e||Object.keys(r))}return r instanceof qc?FU(t,r):!1}}function zU(t,e){const r=t.length;if(e.length!==r)return!1;for(let u=-1;++u<r;)if(!t[u](e[u]))return!1;return!0}function FU(t,e){const r=t.length;if(e.length!==r)return!1;for(let u=-1;++u<r;)if(!t[u](e.get(u)))return!1;return!0}function n6(t,e,r){const u=r[Symbol.iterator](),R=e instanceof Map?e.keys():Object.keys(e)[Symbol.iterator](),p=e instanceof Map?e.values():Object.values(e)[Symbol.iterator]();let f=0;const n=t.length;let l=p.next(),c=u.next(),i=R.next();for(;f<n&&!c.done&&!i.done&&!l.done&&!(c.value!==i.value||!t[f](l.value));++f,c=u.next(),i=R.next(),l=p.next());return f===n&&c.done&&i.done&&l.done?!0:(u.return&&u.return(),R.return&&R.return(),p.return&&p.return(),!1)}function NL(t,e,r,u){return(r&1<<u)!==0}function BU(t,e,r,u){return(r&1<<u)>>u}function r6(t,e,r){const u=r.byteLength+7&-8;if(t>0||r.byteLength<u){const R=new Uint8Array(u);return R.set(t%8===0?r.subarray(t>>3):NU(new U4(r,t,e,null,NL)).subarray(0,u)),R}return r}function NU(t){const e=[];let r=0,u=0,R=0;for(const f of t)f&&(R|=1<<u),++u===8&&(e[r++]=R,R=u=0);(r===0||u>0)&&(e[r++]=R);const p=new Uint8Array(e.length+7&-8);return p.set(e),p}class U4{constructor(e,r,u,R,p){this.bytes=e,this.length=u,this.context=R,this.get=p,this.bit=r%8,this.byteIndex=r>>3,this.byte=e[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}}function pT(t,e,r){if(r-e<=0)return 0;if(r-e<8){let p=0;for(const f of new U4(t,e,r-e,t,BU))p+=f;return p}const u=r>>3<<3,R=e+(e%8===0?0:8-e%8);return pT(t,e,R)+pT(t,u,r)+VU(t,R>>3,u-R>>3)}function VU(t,e,r){let u=0,R=Math.trunc(e);const p=new DataView(t.buffer,t.byteOffset,t.byteLength),f=r===void 0?t.byteLength:R+r;for(;f-R>=4;)u+=m5(p.getUint32(R)),R+=4;for(;f-R>=2;)u+=m5(p.getUint16(R)),R+=2;for(;f-R>=1;)u+=m5(p.getUint8(R)),R+=1;return u}function m5(t){let e=Math.trunc(t);return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24}const jU=-1;class Ib{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:e}=this;return so.isSparseUnion(e)?this.children.some(r=>r.nullable):so.isDenseUnion(e)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0;const{valueOffsets:r,values:u,nullBitmap:R,typeIds:p}=this;return r&&(e+=r.byteLength),u&&(e+=u.byteLength),R&&(e+=R.byteLength),p&&(e+=p.byteLength),this.children.reduce((f,n)=>f+n.byteLength,e)}get nullCount(){if(so.isUnion(this.type))return this.children.reduce((u,R)=>u+R.nullCount,0);let e=this._nullCount,r;return e<=jU&&(r=this.nullBitmap)&&(this._nullCount=e=r.length===0?0:this.length-pT(r,this.offset,this.offset+this.length)),e}constructor(e,r,u,R,p,f=[],n){this.type=e,this.children=f,this.dictionary=n,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(u||0,0)),this._nullCount=Math.floor(Math.max(R||0,-1));let l;p instanceof Ib?(this.stride=p.stride,this.values=p.values,this.typeIds=p.typeIds,this.nullBitmap=p.nullBitmap,this.valueOffsets=p.valueOffsets):(this.stride=G7(e),p&&((l=p[0])&&(this.valueOffsets=l),(l=p[1])&&(this.values=l),(l=p[2])&&(this.nullBitmap=l),(l=p[3])&&(this.typeIds=l)))}getValid(e){const{type:r}=this;if(so.isUnion(r)){const u=r,R=this.children[u.typeIdToChildIndex[this.typeIds[e]]],p=u.mode===dp.Dense?this.valueOffsets[e]:e;return R.getValid(p)}if(this.nullable&&this.nullCount>0){const u=this.offset+e;return(this.nullBitmap[u>>3]&1<<u%8)!==0}return!0}setValid(e,r){let u;const{type:R}=this;if(so.isUnion(R)){const p=R,f=this.children[p.typeIdToChildIndex[this.typeIds[e]]],n=p.mode===dp.Dense?this.valueOffsets[e]:e;u=f.getValid(n),f.setValid(n,r)}else{let{nullBitmap:p}=this;const{offset:f,length:n}=this,l=f+e,c=1<<l%8,i=l>>3;(!p||p.byteLength<=i)&&(p=new Uint8Array((f+n+63&-64)>>3).fill(255),this.nullCount>0?(p.set(r6(f,n,this.nullBitmap),0),Object.assign(this,{nullBitmap:p})):Object.assign(this,{nullBitmap:p,_nullCount:0}));const _=p[i];u=(_&c)!==0,p[i]=r?_|c:_&~c}return u!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(e=this.type,r=this.offset,u=this.length,R=this._nullCount,p=this,f=this.children){return new Ib(e,r,u,R,p,f,this.dictionary)}slice(e,r){const{stride:u,typeId:R,children:p}=this,f=+(this._nullCount===0)-1,n=R===16?u:1,l=this._sliceBuffers(e,r,u,R);return this.clone(this.type,this.offset+e,r,f,l,p.length===0||this.valueOffsets?p:this._sliceChildren(p,n*e,n*r))}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===_r.Null)return this.clone(this.type,0,e,0);const{length:r,nullCount:u}=this,R=new Uint8Array((e+63&-64)>>3).fill(255,0,r>>3);R[r>>3]=(1<<r-(r&-8))-1,u>0&&R.set(r6(this.offset,r,this.nullBitmap),0);const p=this.buffers;return p[jp.VALIDITY]=R,this.clone(this.type,0,e,u+(e-r),p)}_sliceBuffers(e,r,u,R){let p;const{buffers:f}=this;return(p=f[jp.TYPE])&&(f[jp.TYPE]=p.subarray(e,e+r)),(p=f[jp.OFFSET])&&(f[jp.OFFSET]=p.subarray(e,e+r+1))||(p=f[jp.DATA])&&(f[jp.DATA]=R===6?p:p.subarray(u*e,u*(e+r))),f}_sliceChildren(e,r,u){return e.map(R=>R.slice(r,u))}}Ib.prototype.children=Object.freeze([]);class i6{constructor(e=0,r){this.numChunks=e,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){const e=this.chunkIterator.next();if(!e.done)return e;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}}function UU(t){return t.some(e=>e.nullable)}function HU(t){return t.reduce((e,r)=>e+r.nullCount,0)}function qU(t){return t.reduce((e,r,u)=>(e[u+1]=e[u]+r.length,e),new Uint32Array(t.length+1))}function WU(t,e,r,u){const R=[];for(let p=-1,f=t.length;++p<f;){const n=t[p],l=e[p],{length:c}=n;if(l>=u)break;if(r>=l+c)continue;if(l>=r&&l+c<=u){R.push(n);continue}const i=Math.max(0,r-l),_=Math.min(u-l,c);R.push(n.slice(i,_-i))}return R.length===0&&R.push(t[0].slice(0,0)),R}function H4(t,e,r,u){let R=0,p=0,f=e.length-1;do{if(R>=f-1)return r<e[f]?u(t,R,r-e[R]):null;p=R+Math.trunc((f-R)*.5),r<e[p]?f=p:R=p}while(R<f)}function VL(t,e){return t.getValid(e)}function a6(t){function e(r,u,R){return t(r[u],R)}return function(r){const u=this.data;return H4(u,this._offsets,r,e)}}function GU(t){let e;function r(u,R,p){return t(u[R],p,e)}return function(u,R){const p=this.data;e=R;const f=H4(p,this._offsets,u,r);return e=void 0,f}}function $U(t){let e;function r(u,R,p){let f=p,n=0,l=0;for(let c=R-1,i=u.length;++c<i;){const _=u[c];if(~(n=t(_,e,f)))return l+n;f=0,l+=_.length}return-1}return function(u,R){e=u;const p=this.data,f=typeof R!="number"?r(p,0,0):H4(p,this._offsets,R,r);return e=void 0,f}}class ca extends zo{}function YU(t,e){return e===null&&t.length>0?0:-1}function ZU(t,e){const{nullBitmap:r}=t;if(!r||t.nullCount<=0)return-1;let u=0;for(const R of new U4(r,t.offset+(e||0),t.length,r,NL)){if(!R)return u;++u}return-1}function wa(t,e,r){if(e===void 0)return-1;if(e===null)switch(t.typeId){case _r.Union:break;case _r.Dictionary:break;default:return ZU(t,r)}const u=ad.getVisitFn(t),R=Oy(e);for(let p=(r||0)-1,f=t.length;++p<f;)if(R(u(t,p)))return p;return-1}function jL(t,e,r){const u=ad.getVisitFn(t),R=Oy(e);for(let p=(r||0)-1,f=t.length;++p<f;)if(R(u(t,p)))return p;return-1}ca.prototype.visitNull=YU;ca.prototype.visitBool=wa;ca.prototype.visitInt=wa;ca.prototype.visitInt8=wa;ca.prototype.visitInt16=wa;ca.prototype.visitInt32=wa;ca.prototype.visitInt64=wa;ca.prototype.visitUint8=wa;ca.prototype.visitUint16=wa;ca.prototype.visitUint32=wa;ca.prototype.visitUint64=wa;ca.prototype.visitFloat=wa;ca.prototype.visitFloat16=wa;ca.prototype.visitFloat32=wa;ca.prototype.visitFloat64=wa;ca.prototype.visitUtf8=wa;ca.prototype.visitLargeUtf8=wa;ca.prototype.visitBinary=wa;ca.prototype.visitLargeBinary=wa;ca.prototype.visitFixedSizeBinary=wa;ca.prototype.visitDate=wa;ca.prototype.visitDateDay=wa;ca.prototype.visitDateMillisecond=wa;ca.prototype.visitTimestamp=wa;ca.prototype.visitTimestampSecond=wa;ca.prototype.visitTimestampMillisecond=wa;ca.prototype.visitTimestampMicrosecond=wa;ca.prototype.visitTimestampNanosecond=wa;ca.prototype.visitTime=wa;ca.prototype.visitTimeSecond=wa;ca.prototype.visitTimeMillisecond=wa;ca.prototype.visitTimeMicrosecond=wa;ca.prototype.visitTimeNanosecond=wa;ca.prototype.visitDecimal=wa;ca.prototype.visitList=wa;ca.prototype.visitStruct=wa;ca.prototype.visitUnion=wa;ca.prototype.visitDenseUnion=jL;ca.prototype.visitSparseUnion=jL;ca.prototype.visitDictionary=wa;ca.prototype.visitInterval=wa;ca.prototype.visitIntervalDayTime=wa;ca.prototype.visitIntervalYearMonth=wa;ca.prototype.visitDuration=wa;ca.prototype.visitDurationSecond=wa;ca.prototype.visitDurationMillisecond=wa;ca.prototype.visitDurationMicrosecond=wa;ca.prototype.visitDurationNanosecond=wa;ca.prototype.visitFixedSizeList=wa;ca.prototype.visitMap=wa;const o6=new ca;class ha extends zo{}function ma(t){const{type:e}=t;if(t.nullCount===0&&t.stride===1&&(so.isInt(e)&&e.bitWidth!==64||so.isTime(e)&&e.bitWidth!==64||so.isFloat(e)&&e.precision!==Of.HALF))return new i6(t.data.length,u=>{const R=t.data[u];return R.values.subarray(0,R.length)[Symbol.iterator]()});let r=0;return new i6(t.data.length,u=>{const p=t.data[u].length,f=t.slice(r,r+p);return r+=p,new XU(f)})}class XU{constructor(e){this.vector=e,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}}ha.prototype.visitNull=ma;ha.prototype.visitBool=ma;ha.prototype.visitInt=ma;ha.prototype.visitInt8=ma;ha.prototype.visitInt16=ma;ha.prototype.visitInt32=ma;ha.prototype.visitInt64=ma;ha.prototype.visitUint8=ma;ha.prototype.visitUint16=ma;ha.prototype.visitUint32=ma;ha.prototype.visitUint64=ma;ha.prototype.visitFloat=ma;ha.prototype.visitFloat16=ma;ha.prototype.visitFloat32=ma;ha.prototype.visitFloat64=ma;ha.prototype.visitUtf8=ma;ha.prototype.visitLargeUtf8=ma;ha.prototype.visitBinary=ma;ha.prototype.visitLargeBinary=ma;ha.prototype.visitFixedSizeBinary=ma;ha.prototype.visitDate=ma;ha.prototype.visitDateDay=ma;ha.prototype.visitDateMillisecond=ma;ha.prototype.visitTimestamp=ma;ha.prototype.visitTimestampSecond=ma;ha.prototype.visitTimestampMillisecond=ma;ha.prototype.visitTimestampMicrosecond=ma;ha.prototype.visitTimestampNanosecond=ma;ha.prototype.visitTime=ma;ha.prototype.visitTimeSecond=ma;ha.prototype.visitTimeMillisecond=ma;ha.prototype.visitTimeMicrosecond=ma;ha.prototype.visitTimeNanosecond=ma;ha.prototype.visitDecimal=ma;ha.prototype.visitList=ma;ha.prototype.visitStruct=ma;ha.prototype.visitUnion=ma;ha.prototype.visitDenseUnion=ma;ha.prototype.visitSparseUnion=ma;ha.prototype.visitDictionary=ma;ha.prototype.visitInterval=ma;ha.prototype.visitIntervalDayTime=ma;ha.prototype.visitIntervalYearMonth=ma;ha.prototype.visitDuration=ma;ha.prototype.visitDurationSecond=ma;ha.prototype.visitDurationMillisecond=ma;ha.prototype.visitDurationMicrosecond=ma;ha.prototype.visitDurationNanosecond=ma;ha.prototype.visitFixedSizeList=ma;ha.prototype.visitMap=ma;const KU=new ha;var UL;const HL={},qL={};class qc{constructor(e){var r,u,R;const p=e[0]instanceof qc?e.flatMap(n=>n.data):e;if(p.length===0||p.some(n=>!(n instanceof Ib)))throw new TypeError("Vector constructor expects an Array of Data instances.");const f=(r=p[0])===null||r===void 0?void 0:r.type;switch(p.length){case 0:this._offsets=[0];break;case 1:{const{get:n,set:l,indexOf:c}=HL[f.typeId],i=p[0];this.isValid=_=>VL(i,_),this.get=_=>n(i,_),this.set=(_,b)=>l(i,_,b),this.indexOf=_=>c(i,_),this._offsets=[0,i.length];break}default:Object.setPrototypeOf(this,qL[f.typeId]),this._offsets=qU(p);break}this.data=p,this.type=f,this.stride=G7(f),this.numChildren=(R=(u=f.children)===null||u===void 0?void 0:u.length)!==null&&R!==void 0?R:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((e,r)=>e+r.byteLength,0)}get nullable(){return UU(this.data)}get nullCount(){return HU(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${_r[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get(LU(e,this.length))}set(e,r){}indexOf(e,r){return-1}includes(e,r){return this.indexOf(e,r)>-1}[Symbol.iterator](){return KU.visit(this)}concat(...e){return new qc(this.data.concat(e.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(e,r){return new qc(IU(this,e,r,({data:u,_offsets:R},p,f)=>WU(u,R,p,f)))}toJSON(){return[...this]}toArray(){const{type:e,data:r,length:u,stride:R,ArrayType:p}=this;switch(e.typeId){case _r.Int:case _r.Float:case _r.Decimal:case _r.Time:case _r.Timestamp:switch(r.length){case 0:return new p;case 1:return r[0].values.subarray(0,u*R);default:return r.reduce((f,{values:n,length:l})=>(f.array.set(n.subarray(0,l*R),f.offset),f.offset+=l*R,f),{array:new p(u*R),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(e){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(u=>u.name===e))}getChildAt(e){return e>-1&&e<this.numChildren?new qc(this.data.map(({children:r})=>r[e])):null}get isMemoized(){return so.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(so.isDictionary(this.type)){const e=new N2(this.data[0].dictionary),r=this.data.map(u=>{const R=u.clone();return R.dictionary=e,R});return new qc(r)}return new N2(this)}unmemoize(){if(so.isDictionary(this.type)&&this.isMemoized){const e=this.data[0].dictionary.unmemoize(),r=this.data.map(u=>{const R=u.clone();return R.dictionary=e,R});return new qc(r)}return this}}UL=Symbol.toStringTag;qc[UL]=(t=>{t.type=so.prototype,t.data=[],t.length=0,t.stride=1,t.numChildren=0,t._offsets=new Uint32Array([0]),t[Symbol.isConcatSpreadable]=!0;const e=Object.keys(_r).map(r=>_r[r]).filter(r=>typeof r=="number"&&r!==_r.NONE);for(const r of e){const u=ad.getVisitFnByTypeId(r),R=pp.getVisitFnByTypeId(r),p=o6.getVisitFnByTypeId(r);HL[r]={get:u,set:R,indexOf:p},qL[r]=Object.create(t,{isValid:{value:a6(VL)},get:{value:a6(ad.getVisitFnByTypeId(r))},set:{value:GU(pp.getVisitFnByTypeId(r))},indexOf:{value:$U(o6.getVisitFnByTypeId(r))}})}return"Vector"})(qc.prototype);class N2 extends qc{constructor(e){super(e.data);const r=this.get,u=this.set,R=this.slice,p=new Array(this.length);Object.defineProperty(this,"get",{value(f){const n=p[f];if(n!==void 0)return n;const l=r.call(this,f);return p[f]=l,l}}),Object.defineProperty(this,"set",{value(f,n){u.call(this,f,n),p[f]=n}}),Object.defineProperty(this,"slice",{value:(f,n)=>new N2(R.call(this,f,n))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new qc(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}function JU(t){return t.endsWith("_page")}const zy=h8("selection",{state:()=>({id:void 0,selection_counter:void 0,pagination_counter:void 0,counter:void 0}),actions:{updateSelection(t,e){const r=JU(t);console.log("[SelectionStore] ===== updateSelection =====",{timestamp:Date.now(),identifier:t,value:e,isPagination:r,currentSelectionCounter:this.$state.selection_counter,currentPaginationCounter:this.$state.pagination_counter}),this.$patch(u=>{u[t]=e,r?u.pagination_counter=(u.pagination_counter||0)+1:u.selection_counter=(u.selection_counter||0)+1,u.counter=(u.counter||0)+1}),console.log("[SelectionStore] updateSelection DONE",{selectionCounter:this.$state.selection_counter,paginationCounter:this.$state.pagination_counter})}}}),Cg=h8("streamlit-data",{state:()=>({renderData:null,dataForDrawing:{},hash:"",annotations:null,requestData:!1}),getters:{args:t=>{var e;return(e=t.renderData)==null?void 0:e.args},components(){var t;return(t=this.args)==null?void 0:t.components},allDataForDrawing:t=>t.dataForDrawing,theme:t=>{var e;return(e=t.renderData)==null?void 0:e.theme}},actions:{updateRenderData(t){var p,f,n,l;const e=zy(),r=t.args.selection_store,u=t.args.hash,R=t.args.dataChanged;if(delete t.args.selection_store,delete t.args.hash,delete t.args.dataChanged,console.log("[StreamlitDataStore] ===== updateRenderData START =====",{timestamp:Date.now(),dataChanged:R,oldHash:(p=this.hash)==null?void 0:p.substring(0,8),newHash:u==null?void 0:u.substring(0,8),hasPagination:!!t.args._pagination,paginationPage:(f=t.args._pagination)==null?void 0:f.page,hasTableData:!!t.args.tableData,pythonStateCounter:r==null?void 0:r.counter,pythonSelectionCounter:r==null?void 0:r.selection_counter,pythonPaginationCounter:r==null?void 0:r.pagination_counter,pythonStateKeys:r?Object.keys(r):[]}),r){const c=r.selection_counter??r.counter??0,i=r.pagination_counter??r.counter??0,_=e.$state.selection_counter??e.$state.counter??0,b=e.$state.pagination_counter??e.$state.counter??0;e.$patch(w=>{if(r.id!==w.id){for(const v in w)w[v]=void 0;Object.assign(w,r)}else for(const v in r){const o=v.endsWith("_page"),a=o?i:c,h=o?b:_,s=!(v in w)||w[v]===void 0||a>=h||o&&R;console.log(`[StreamlitDataStore] State key "${v}":`,{isPagination:o,pythonCounter:a,vueCounter:h,dataChanged:R,keyInState:v in w,currentValue:w[v],pythonValue:r[v],shouldAccept:s}),s&&(w[v]=r[v])}})}if(R&&u){this.renderData=t;const c=t.args;Object.entries(c).forEach(([i,_])=>{var b;if(_ instanceof fT)if(i==="plotData"){const w=this.parseArrowTableToColumns(_);console.log(`[StreamlitDataStore] Parsed ${i} to columns:`,{columns:Object.keys(w),rowCount:((b=Object.values(w)[0])==null?void 0:b.length)??0}),this.dataForDrawing[i]=w}else{const w=this.parseArrowTable(_);console.log(`[StreamlitDataStore] Parsed ${i}:`,{rowCount:w.length}),this.dataForDrawing[i]=w}else this.dataForDrawing[i]=_}),c._pagination!==void 0&&(console.log("[StreamlitDataStore] Updating _pagination:",{oldPage:(n=this.dataForDrawing._pagination)==null?void 0:n.page,newPage:(l=c._pagination)==null?void 0:l.page,newPagination:c._pagination}),this.dataForDrawing._pagination=c._pagination),c._navigate_to_page!==void 0&&(console.log("[StreamlitDataStore] Updating _navigate_to_page:",c._navigate_to_page),this.dataForDrawing._navigate_to_page=c._navigate_to_page),c._target_row_index!==void 0&&(console.log("[StreamlitDataStore] Updating _target_row_index:",c._target_row_index),this.dataForDrawing._target_row_index=c._target_row_index),this.hash=u}else if(!R){const c=Object.keys(this.dataForDrawing).length>0;if(console.log("[StreamlitDataStore] Using cached data branch:",{timestamp:Date.now(),hasCache:c,incomingPagination:t.args._pagination,cachedPagination:this.dataForDrawing._pagination}),c)console.log("[StreamlitDataStore] Data unchanged, using cached data"),t.args.components&&(this.renderData?this.renderData.args.components=t.args.components:this.renderData=t),t.args._plotConfig!==void 0&&(this.dataForDrawing._plotConfig=t.args._plotConfig);else{console.warn("[StreamlitDataStore] Cache miss - requesting data from Python"),this.requestData=!0;return}}},parseArrowTable(t){const e=t.table.numRows,r=t.table.schema.fields.map(p=>p.name),u=new Map;r.forEach((p,f)=>{const n=t.table.getChildAt(f);if(n){const l=n.toArray(),c=new Array(l.length);for(let i=0;i<l.length;i++)c[i]=this.parseArrowValue(l[i]);u.set(p,c)}});const R=new Array(e);for(let p=0;p<e;p++){const f={};r.forEach(n=>{const l=u.get(n);l&&(f[n]=l[p])}),R[p]=f}return R},parseArrowTableToColumns(t){const e={};return t.table.schema.fields.map(u=>u.name).forEach((u,R)=>{const p=t.table.getChildAt(R);if(p){const f=p.toArray(),n=new Array(f.length);for(let l=0;l<f.length;l++)n[l]=this.parseArrowValue(f[l]);e[u]=n}else e[u]=[]}),e},parseArrowValue(t){if(typeof t=="bigint")return Number(t);if(t instanceof qc){const e=[];for(let r=0;r<t.length;r++)e.push(this.parseArrowValue(t.get(r)));return e}return t},setAnnotations(t){this.annotations=t},clearRequestData(){this.requestData=!1}}});class ch{constructor(e){this.table=e}reloadData(e,r,u){return this.table.dataLoader.load(e,void 0,void 0,void 0,r,u)}langText(){return this.table.modules.localize.getText(...arguments)}langBind(){return this.table.modules.localize.bind(...arguments)}langLocale(){return this.table.modules.localize.getLocale(...arguments)}commsConnections(){return this.table.modules.comms.getConnections(...arguments)}commsSend(){return this.table.modules.comms.send(...arguments)}layoutMode(){return this.table.modules.layout.getMode()}layoutRefresh(e){return this.table.modules.layout.layout(e)}subscribe(){return this.table.eventBus.subscribe(...arguments)}unsubscribe(){return this.table.eventBus.unsubscribe(...arguments)}subscribed(e){return this.table.eventBus.subscribed(e)}subscriptionChange(){return this.table.eventBus.subscriptionChange(...arguments)}dispatch(){return this.table.eventBus.dispatch(...arguments)}chain(){return this.table.eventBus.chain(...arguments)}confirm(){return this.table.eventBus.confirm(...arguments)}dispatchExternal(){return this.table.externalEvents.dispatch(...arguments)}subscribedExternal(e){return this.table.externalEvents.subscribed(e)}subscriptionChangeExternal(){return this.table.externalEvents.subscriptionChange(...arguments)}options(e){return this.table.options[e]}setOption(e,r){return typeof r<"u"&&(this.table.options[e]=r),this.table.options[e]}deprecationCheck(e,r,u){return this.table.deprecationAdvisor.check(e,r,u)}deprecationCheckMsg(e,r){return this.table.deprecationAdvisor.checkMsg(e,r)}deprecationMsg(e){return this.table.deprecationAdvisor.msg(e)}module(e){return this.table.module(e)}}class Ks{static elVisible(e){return!(e.offsetWidth<=0&&e.offsetHeight<=0)}static elOffset(e){var r=e.getBoundingClientRect();return{top:r.top+window.pageYOffset-document.documentElement.clientTop,left:r.left+window.pageXOffset-document.documentElement.clientLeft}}static retrieveNestedData(e,r,u){var R=e?r.split(e):[r],p=R.length,f;for(let n=0;n<p&&(u=u[R[n]],f=u,!!u);n++);return f}static deepClone(e,r,u=[]){var R={}.__proto__,p=[].__proto__;r||(r=Object.assign(Array.isArray(e)?[]:{},e));for(var f in e){let n=e[f],l,c;n!=null&&typeof n=="object"&&(n.__proto__===R||n.__proto__===p)&&(l=u.findIndex(i=>i.subject===n),l>-1?r[f]=u[l].copy:(c=Object.assign(Array.isArray(n)?[]:{},n),u.unshift({subject:n,copy:c}),r[f]=this.deepClone(n,c,u)))}return r}}let QU=class WL extends ch{constructor(e,r,u){super(e),this.element=r,this.container=this._lookupContainer(),this.parent=u,this.reversedX=!1,this.childPopup=null,this.blurable=!1,this.blurCallback=null,this.blurEventsBound=!1,this.renderedCallback=null,this.visible=!1,this.hideable=!0,this.element.classList.add("tabulator-popup-container"),this.blurEvent=this.hide.bind(this,!1),this.escEvent=this._escapeCheck.bind(this),this.destroyBinding=this.tableDestroyed.bind(this),this.destroyed=!1}tableDestroyed(){this.destroyed=!0,this.hide(!0)}_lookupContainer(){var e=this.table.options.popupContainer;return typeof e=="string"?(e=document.querySelector(e),e||console.warn("Menu Error - no container element found matching selector:",this.table.options.popupContainer,"(defaulting to document body)")):e===!0&&(e=this.table.element),e&&!this._checkContainerIsParent(e)&&(e=!1,console.warn("Menu Error - container element does not contain this table:",this.table.options.popupContainer,"(defaulting to document body)")),e||(e=document.body),e}_checkContainerIsParent(e,r=this.table.element){return e===r?!0:r.parentNode?this._checkContainerIsParent(e,r.parentNode):!1}renderCallback(e){this.renderedCallback=e}containerEventCoords(e){var r=!(e instanceof MouseEvent),u=r?e.touches[0].pageX:e.pageX,R=r?e.touches[0].pageY:e.pageY;if(this.container!==document.body){let p=Ks.elOffset(this.container);u-=p.left,R-=p.top}return{x:u,y:R}}elementPositionCoords(e,r="right"){var u=Ks.elOffset(e),R,p,f;switch(this.container!==document.body&&(R=Ks.elOffset(this.container),u.left-=R.left,u.top-=R.top),r){case"right":p=u.left+e.offsetWidth,f=u.top-1;break;case"bottom":p=u.left,f=u.top+e.offsetHeight;break;case"left":p=u.left,f=u.top-1;break;case"top":p=u.left,f=u.top;break;case"center":p=u.left+e.offsetWidth/2,f=u.top+e.offsetHeight/2;break}return{x:p,y:f,offset:u}}show(e,r){var u,R,p,f,n;return this.destroyed||this.table.destroyed?this:(e instanceof HTMLElement?(p=e,n=this.elementPositionCoords(e,r),f=n.offset,u=n.x,R=n.y):typeof e=="number"?(f={top:0,left:0},u=e,R=r):(n=this.containerEventCoords(e),u=n.x,R=n.y,this.reversedX=!1),this.element.style.top=R+"px",this.element.style.left=u+"px",this.container.appendChild(this.element),typeof this.renderedCallback=="function"&&this.renderedCallback(),this._fitToScreen(u,R,p,f,r),this.visible=!0,this.subscribe("table-destroy",this.destroyBinding),this.element.addEventListener("mousedown",l=>{l.stopPropagation()}),this)}_fitToScreen(e,r,u,R,p){var f=this.container===document.body?document.documentElement.scrollTop:this.container.scrollTop;(e+this.element.offsetWidth>=this.container.offsetWidth||this.reversedX)&&(this.element.style.left="",u?this.element.style.right=this.container.offsetWidth-R.left+"px":this.element.style.right=this.container.offsetWidth-e+"px",this.reversedX=!0);let n=Math.max(this.container.offsetHeight,f?this.container.scrollHeight:0);if(r+this.element.offsetHeight>n)if(u)switch(p){case"bottom":this.element.style.top=parseInt(this.element.style.top)-this.element.offsetHeight-u.offsetHeight-1+"px";break;default:this.element.style.top=parseInt(this.element.style.top)-this.element.offsetHeight+u.offsetHeight+1+"px"}else this.element.style.height=n+"px"}isVisible(){return this.visible}hideOnBlur(e){return this.blurable=!0,this.visible&&(setTimeout(()=>{this.visible&&(this.table.rowManager.element.addEventListener("scroll",this.blurEvent),this.subscribe("cell-editing",this.blurEvent),document.body.addEventListener("click",this.blurEvent),document.body.addEventListener("contextmenu",this.blurEvent),document.body.addEventListener("mousedown",this.blurEvent),window.addEventListener("resize",this.blurEvent),document.body.addEventListener("keydown",this.escEvent),this.blurEventsBound=!0)},100),this.blurCallback=e),this}_escapeCheck(e){e.keyCode==27&&this.hide()}blockHide(){this.hideable=!1}restoreHide(){this.hideable=!0}hide(e=!1){return this.visible&&this.hideable&&(this.blurable&&this.blurEventsBound&&(document.body.removeEventListener("keydown",this.escEvent),document.body.removeEventListener("click",this.blurEvent),document.body.removeEventListener("contextmenu",this.blurEvent),document.body.removeEventListener("mousedown",this.blurEvent),window.removeEventListener("resize",this.blurEvent),this.table.rowManager.element.removeEventListener("scroll",this.blurEvent),this.unsubscribe("cell-editing",this.blurEvent),this.blurEventsBound=!1),this.childPopup&&this.childPopup.hide(),this.parent&&(this.parent.childPopup=null),this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.visible=!1,this.blurCallback&&!e&&this.blurCallback(),this.unsubscribe("table-destroy",this.destroyBinding)),this}child(e){return this.childPopup&&this.childPopup.hide(),this.childPopup=new WL(this.table,e,this),this.childPopup}};class uo extends ch{constructor(e,r){super(e),this._handler=null}initialize(){}registerTableOption(e,r){this.table.optionsList.register(e,r)}registerColumnOption(e,r){this.table.columnManager.optionsList.register(e,r)}registerTableFunction(e,r){typeof this.table[e]>"u"?this.table[e]=(...u)=>(this.table.initGuard(e),r(...u)):console.warn("Unable to bind table function, name already in use",e)}registerComponentFunction(e,r,u){return this.table.componentFunctionBinder.bind(e,r,u)}registerDataHandler(e,r){this.table.rowManager.registerDataPipelineHandler(e,r),this._handler=e}registerDisplayHandler(e,r){this.table.rowManager.registerDisplayPipelineHandler(e,r),this._handler=e}displayRows(e){var r=this.table.rowManager.displayRows.length-1,u;if(this._handler&&(u=this.table.rowManager.displayPipeline.findIndex(R=>R.handler===this._handler),u>-1&&(r=u)),e&&(r=r+e),this._handler)return r>-1?this.table.rowManager.getDisplayRows(r):this.activeRows()}activeRows(){return this.table.rowManager.activeRows}refreshData(e,r){r||(r=this._handler),r&&this.table.rowManager.refreshActiveData(r,!1,e)}footerAppend(e){return this.table.footerManager.append(e)}footerPrepend(e){return this.table.footerManager.prepend(e)}footerRemove(e){return this.table.footerManager.remove(e)}popup(e,r){return new QU(this.table,e,r)}alert(e,r){return this.table.alertManager.alert(e,r)}clearAlert(){return this.table.alertManager.clear()}}var eH={rownum:function(t,e,r,u,R,p){return p.getPosition()}};const Y0=class Y0 extends uo{constructor(e){super(e),this.allowedTypes=["","data","download","clipboard","print","htmlOutput"],this.registerColumnOption("accessor"),this.registerColumnOption("accessorParams"),this.registerColumnOption("accessorData"),this.registerColumnOption("accessorDataParams"),this.registerColumnOption("accessorDownload"),this.registerColumnOption("accessorDownloadParams"),this.registerColumnOption("accessorClipboard"),this.registerColumnOption("accessorClipboardParams"),this.registerColumnOption("accessorPrint"),this.registerColumnOption("accessorPrintParams"),this.registerColumnOption("accessorHtmlOutput"),this.registerColumnOption("accessorHtmlOutputParams")}initialize(){this.subscribe("column-layout",this.initializeColumn.bind(this)),this.subscribe("row-data-retrieve",this.transformRow.bind(this))}initializeColumn(e){var r=!1,u={};this.allowedTypes.forEach(R=>{var p="accessor"+(R.charAt(0).toUpperCase()+R.slice(1)),f;e.definition[p]&&(f=this.lookupAccessor(e.definition[p]),f&&(r=!0,u[p]={accessor:f,params:e.definition[p+"Params"]||{}}))}),r&&(e.modules.accessor=u)}lookupAccessor(e){var r=!1;switch(typeof e){case"string":Y0.accessors[e]?r=Y0.accessors[e]:console.warn("Accessor Error - No such accessor found, ignoring: ",e);break;case"function":r=e;break}return r}transformRow(e,r){var u="accessor"+(r.charAt(0).toUpperCase()+r.slice(1)),R=e.getComponent(),p=Ks.deepClone(e.data||{});return this.table.columnManager.traverse(function(f){var n,l,c,i;f.modules.accessor&&(l=f.modules.accessor[u]||f.modules.accessor.accessor||!1,l&&(n=f.getFieldValue(p),n!="undefined"&&(i=f.getComponent(),c=typeof l.params=="function"?l.params(n,p,r,i,R):l.params,f.setFieldValue(p,l.accessor(n,p,r,c,i,R)))))}),p}};Ci(Y0,"moduleName","accessor"),Ci(Y0,"accessors",eH);let mT=Y0;var tH={method:"GET"};function gT(t,e){var r=[];if(e=e||"",Array.isArray(t))t.forEach((R,p)=>{r=r.concat(gT(R,e?e+"["+p+"]":p))});else if(typeof t=="object")for(var u in t)r=r.concat(gT(t[u],e?e+"["+u+"]":u));else r.push({key:e,value:t});return r}function nH(t){var e=gT(t),r=[];return e.forEach(function(u){r.push(encodeURIComponent(u.key)+"="+encodeURIComponent(u.value))}),r.join("&")}function GL(t,e,r){return t&&r&&Object.keys(r).length&&(!e.method||e.method.toLowerCase()=="get")&&(e.method="get",t+=(t.includes("?")?"&":"?")+nH(r)),t}function rH(t,e,r){var u;return new Promise((R,p)=>{if(t=this.urlGenerator.call(this.table,t,e,r),e.method.toUpperCase()!="GET")if(u=typeof this.table.options.ajaxContentType=="object"?this.table.options.ajaxContentType:this.contentTypeFormatters[this.table.options.ajaxContentType],u){for(var f in u.headers)e.headers||(e.headers={}),typeof e.headers[f]>"u"&&(e.headers[f]=u.headers[f]);e.body=u.body.call(this,t,e,r)}else console.warn("Ajax Error - Invalid ajaxContentType value:",this.table.options.ajaxContentType);t?(typeof e.headers>"u"&&(e.headers={}),typeof e.headers.Accept>"u"&&(e.headers.Accept="application/json"),typeof e.headers["X-Requested-With"]>"u"&&(e.headers["X-Requested-With"]="XMLHttpRequest"),typeof e.mode>"u"&&(e.mode="cors"),e.mode=="cors"?(typeof e.headers.Origin>"u"&&(e.headers.Origin=window.location.origin),typeof e.credentials>"u"&&(e.credentials="same-origin")):typeof e.credentials>"u"&&(e.credentials="include"),fetch(t,e).then(n=>{n.ok?n.json().then(l=>{R(l)}).catch(l=>{p(l),console.warn("Ajax Load Error - Invalid JSON returned",l)}):(console.error("Ajax Load Error - Connection Error: "+n.status,n.statusText),p(n))}).catch(n=>{console.error("Ajax Load Error - Connection Error: ",n),p(n)})):(console.warn("Ajax Load Error - No URL Set"),R([]))})}function vT(t,e){var r=[];if(e=e||"",Array.isArray(t))t.forEach((R,p)=>{r=r.concat(vT(R,e?e+"["+p+"]":p))});else if(typeof t=="object")for(var u in t)r=r.concat(vT(t[u],e?e+"["+u+"]":u));else r.push({key:e,value:t});return r}var iH={json:{headers:{"Content-Type":"application/json"},body:function(t,e,r){return JSON.stringify(r)}},form:{headers:{},body:function(t,e,r){var u=vT(r),R=new FormData;return u.forEach(function(p){R.append(p.key,p.value)}),R}}};const vd=class vd extends uo{constructor(e){super(e),this.config={},this.url="",this.urlGenerator=!1,this.params=!1,this.loaderPromise=!1,this.registerTableOption("ajaxURL",!1),this.registerTableOption("ajaxURLGenerator",!1),this.registerTableOption("ajaxParams",{}),this.registerTableOption("ajaxConfig","get"),this.registerTableOption("ajaxContentType","form"),this.registerTableOption("ajaxRequestFunc",!1),this.registerTableOption("ajaxRequesting",function(){}),this.registerTableOption("ajaxResponse",!1),this.contentTypeFormatters=vd.contentTypeFormatters}initialize(){this.loaderPromise=this.table.options.ajaxRequestFunc||vd.defaultLoaderPromise,this.urlGenerator=this.table.options.ajaxURLGenerator||vd.defaultURLGenerator,this.table.options.ajaxURL&&this.setUrl(this.table.options.ajaxURL),this.setDefaultConfig(this.table.options.ajaxConfig),this.registerTableFunction("getAjaxUrl",this.getUrl.bind(this)),this.subscribe("data-loading",this.requestDataCheck.bind(this)),this.subscribe("data-params",this.requestParams.bind(this)),this.subscribe("data-load",this.requestData.bind(this))}requestParams(e,r,u,R){var p=this.table.options.ajaxParams;return p&&(typeof p=="function"&&(p=p.call(this.table)),R=Object.assign(Object.assign({},p),R)),R}requestDataCheck(e,r,u,R){return!!(!e&&this.url||typeof e=="string")}requestData(e,r,u,R,p){var f;return!p&&this.requestDataCheck(e)?(e&&this.setUrl(e),f=this.generateConfig(u),this.sendRequest(this.url,r,f)):p}setDefaultConfig(e={}){this.config=Object.assign({},vd.defaultConfig),typeof e=="string"?this.config.method=e:Object.assign(this.config,e)}generateConfig(e={}){var r=Object.assign({},this.config);return typeof e=="string"?r.method=e:Object.assign(r,e),r}setUrl(e){this.url=e}getUrl(){return this.url}sendRequest(e,r,u){return this.table.options.ajaxRequesting.call(this.table,e,r)!==!1?this.loaderPromise(e,u,r).then(R=>(this.table.options.ajaxResponse&&(R=this.table.options.ajaxResponse.call(this.table,e,r,R)),R)):Promise.reject()}};Ci(vd,"moduleName","ajax"),Ci(vd,"defaultConfig",tH),Ci(vd,"defaultURLGenerator",GL),Ci(vd,"defaultLoaderPromise",rH),Ci(vd,"contentTypeFormatters",iH);let yT=vd;var aH={replace:function(t){return this.table.setData(t)},update:function(t){return this.table.updateOrAddData(t)},insert:function(t){return this.table.addData(t)}},oH={table:function(t){var e=[],r=!0,u=this.table.columnManager.columns,R=[],p=[];return t=t.split(`
|
|
56
56
|
`),t.forEach(function(f){e.push(f.split(" "))}),e.length&&!(e.length===1&&e[0].length<2)?(e[0].forEach(function(f){var n=u.find(function(l){return f&&l.definition.title&&f.trim()&&l.definition.title.trim()===f.trim()});n?R.push(n):r=!1}),r||(r=!0,R=[],e[0].forEach(function(f){var n=u.find(function(l){return f&&l.field&&f.trim()&&l.field.trim()===f.trim()});n?R.push(n):r=!1}),r||(R=this.table.columnManager.columnsByIndex)),r&&e.shift(),e.forEach(function(f){var n={};f.forEach(function(l,c){R[c]&&(n[R[c].field]=l)}),p.push(n)}),p):!1}},sH={copyToClipboard:["ctrl + 67","meta + 67"]},lH={copyToClipboard:function(t){this.table.modules.edit.currentCell||this.table.modExists("clipboard",!0)&&this.table.modules.clipboard.copy(!1,!0)}},uH={keybindings:{bindings:sH,actions:lH}};const Xm=class Xm extends uo{constructor(e){super(e),this.mode=!0,this.pasteParser=function(){},this.pasteAction=function(){},this.customSelection=!1,this.rowRange=!1,this.blocked=!0,this.registerTableOption("clipboard",!1),this.registerTableOption("clipboardCopyStyled",!0),this.registerTableOption("clipboardCopyConfig",!1),this.registerTableOption("clipboardCopyFormatter",!1),this.registerTableOption("clipboardCopyRowRange","active"),this.registerTableOption("clipboardPasteParser","table"),this.registerTableOption("clipboardPasteAction","insert"),this.registerColumnOption("clipboard"),this.registerColumnOption("titleClipboard")}initialize(){this.mode=this.table.options.clipboard,this.rowRange=this.table.options.clipboardCopyRowRange,(this.mode===!0||this.mode==="copy")&&this.table.element.addEventListener("copy",e=>{var r,u,R;this.blocked||(e.preventDefault(),this.customSelection?(r=this.customSelection,this.table.options.clipboardCopyFormatter&&(r=this.table.options.clipboardCopyFormatter("plain",r))):(R=this.table.modules.export.generateExportList(this.table.options.clipboardCopyConfig,this.table.options.clipboardCopyStyled,this.rowRange,"clipboard"),u=this.table.modules.export.generateHTMLTable(R),r=u?this.generatePlainContent(R):"",this.table.options.clipboardCopyFormatter&&(r=this.table.options.clipboardCopyFormatter("plain",r),u=this.table.options.clipboardCopyFormatter("html",u))),window.clipboardData&&window.clipboardData.setData?window.clipboardData.setData("Text",r):e.clipboardData&&e.clipboardData.setData?(e.clipboardData.setData("text/plain",r),u&&e.clipboardData.setData("text/html",u)):e.originalEvent&&e.originalEvent.clipboardData.setData&&(e.originalEvent.clipboardData.setData("text/plain",r),u&&e.originalEvent.clipboardData.setData("text/html",u)),this.dispatchExternal("clipboardCopied",r,u),this.reset())}),(this.mode===!0||this.mode==="paste")&&this.table.element.addEventListener("paste",e=>{this.paste(e)}),this.setPasteParser(this.table.options.clipboardPasteParser),this.setPasteAction(this.table.options.clipboardPasteAction),this.registerTableFunction("copyToClipboard",this.copy.bind(this))}reset(){this.blocked=!0,this.customSelection=!1}generatePlainContent(e){var r=[];return e.forEach(u=>{var R=[];u.columns.forEach(p=>{var f="";if(p)if(u.type==="group"&&(p.value=p.component.getKey()),p.value===null)f="";else switch(typeof p.value){case"object":f=JSON.stringify(p.value);break;case"undefined":f="";break;default:f=p.value}R.push(f)}),r.push(R.join(" "))}),r.join(`
|
|
57
57
|
`)}copy(e,r){var u,R;this.blocked=!1,this.customSelection=!1,(this.mode===!0||this.mode==="copy")&&(this.rowRange=e||this.table.options.clipboardCopyRowRange,typeof window.getSelection<"u"&&typeof document.createRange<"u"?(e=document.createRange(),e.selectNodeContents(this.table.element),u=window.getSelection(),u.toString()&&r&&(this.customSelection=u.toString()),u.removeAllRanges(),u.addRange(e)):typeof document.selection<"u"&&typeof document.body.createTextRange<"u"&&(R=document.body.createTextRange(),R.moveToElementText(this.table.element),R.select()),document.execCommand("copy"),u&&u.removeAllRanges())}setPasteAction(e){switch(typeof e){case"string":this.pasteAction=Xm.pasteActions[e],this.pasteAction||console.warn("Clipboard Error - No such paste action found:",e);break;case"function":this.pasteAction=e;break}}setPasteParser(e){switch(typeof e){case"string":this.pasteParser=Xm.pasteParsers[e],this.pasteParser||console.warn("Clipboard Error - No such paste parser found:",e);break;case"function":this.pasteParser=e;break}}paste(e){var r,u,R;this.checkPasteOrigin(e)&&(r=this.getPasteData(e),u=this.pasteParser.call(this,r),u?(e.preventDefault(),this.table.modExists("mutator")&&(u=this.mutateData(u)),R=this.pasteAction.call(this,u),this.dispatchExternal("clipboardPasted",r,u,R)):this.dispatchExternal("clipboardPasteError",r))}mutateData(e){var r=[];return Array.isArray(e)?e.forEach(u=>{r.push(this.table.modules.mutator.transformRow(u,"clipboard"))}):r=e,r}checkPasteOrigin(e){var r=!0,u=this.confirm("clipboard-paste",[e]);return(u||!["DIV","SPAN"].includes(e.target.tagName))&&(r=!1),r}getPasteData(e){var r;return window.clipboardData&&window.clipboardData.getData?r=window.clipboardData.getData("Text"):e.clipboardData&&e.clipboardData.getData?r=e.clipboardData.getData("text/plain"):e.originalEvent&&e.originalEvent.clipboardData.getData&&(r=e.originalEvent.clipboardData.getData("text/plain")),r}};Ci(Xm,"moduleName","clipboard"),Ci(Xm,"moduleExtensions",uH),Ci(Xm,"pasteActions",aH),Ci(Xm,"pasteParsers",oH);let bT=Xm;class cH{constructor(e){return this._row=e,new Proxy(this,{get:function(r,u,R){return typeof r[u]<"u"?r[u]:r._row.table.componentFunctionBinder.handle("row",r._row,u)}})}getData(e){return this._row.getData(e)}getElement(){return this._row.getElement()}getTable(){return this._row.table}getCells(){var e=[];return this._row.getCells().forEach(function(r){e.push(r.getComponent())}),e}getCell(e){var r=this._row.getCell(e);return r?r.getComponent():!1}_getSelf(){return this._row}}class $L{constructor(e){return this._cell=e,new Proxy(this,{get:function(r,u,R){return typeof r[u]<"u"?r[u]:r._cell.table.componentFunctionBinder.handle("cell",r._cell,u)}})}getValue(){return this._cell.getValue()}getOldValue(){return this._cell.getOldValue()}getInitialValue(){return this._cell.initialValue}getElement(){return this._cell.getElement()}getRow(){return this._cell.row.getComponent()}getData(e){return this._cell.row.getData(e)}getType(){return"cell"}getField(){return this._cell.column.getField()}getColumn(){return this._cell.column.getComponent()}setValue(e,r){typeof r>"u"&&(r=!0),this._cell.setValue(e,r)}restoreOldValue(){this._cell.setValueActual(this._cell.getOldValue())}restoreInitialValue(){this._cell.setValueActual(this._cell.initialValue)}checkHeight(){this._cell.checkHeight()}getTable(){return this._cell.table}_getSelf(){return this._cell}}class sx extends ch{constructor(e,r){super(e.table),this.table=e.table,this.column=e,this.row=r,this.element=null,this.value=null,this.initialValue,this.oldValue=null,this.modules={},this.height=null,this.width=null,this.minWidth=null,this.component=null,this.loaded=!1,this.build()}build(){this.generateElement(),this.setWidth(),this._configureCell(),this.setValueActual(this.column.getFieldValue(this.row.data)),this.initialValue=this.value}generateElement(){this.element=document.createElement("div"),this.element.className="tabulator-cell",this.element.setAttribute("role","gridcell"),this.column.isRowHeader&&this.element.classList.add("tabulator-row-header")}_configureCell(){var e=this.element,r=this.column.getField(),u={top:"flex-start",bottom:"flex-end",middle:"center"},R={left:"flex-start",right:"flex-end",center:"center"};if(e.style.textAlign=this.column.hozAlign,this.column.vertAlign&&(e.style.display="inline-flex",e.style.alignItems=u[this.column.vertAlign]||"",this.column.hozAlign&&(e.style.justifyContent=R[this.column.hozAlign]||"")),r&&e.setAttribute("tabulator-field",r),this.column.definition.cssClass){var p=this.column.definition.cssClass.split(" ");p.forEach(f=>{e.classList.add(f)})}this.dispatch("cell-init",this),this.column.visible||this.hide()}_generateContents(){var e;switch(e=this.chain("cell-format",this,null,()=>this.element.innerHTML=this.value),typeof e){case"object":if(e instanceof Node){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.element.appendChild(e)}else this.element.innerHTML="",e!=null&&console.warn("Format Error - Formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:",e);break;case"undefined":this.element.innerHTML="";break;default:this.element.innerHTML=e}}cellRendered(){this.dispatch("cell-rendered",this)}getElement(e){return this.loaded||(this.loaded=!0,e||this.layoutElement()),this.element}getValue(){return this.value}getOldValue(){return this.oldValue}setValue(e,r,u){var R=this.setValueProcessData(e,r,u);R&&(this.dispatch("cell-value-updated",this),this.cellRendered(),this.column.definition.cellEdited&&this.column.definition.cellEdited.call(this.table,this.getComponent()),this.dispatchExternal("cellEdited",this.getComponent()),this.subscribedExternal("dataChanged")&&this.dispatchExternal("dataChanged",this.table.rowManager.getData()))}setValueProcessData(e,r,u){var R=!1;return(this.value!==e||u)&&(R=!0,r&&(e=this.chain("cell-value-changing",[this,e],null,e))),this.setValueActual(e),R&&this.dispatch("cell-value-changed",this),R}setValueActual(e){this.oldValue=this.value,this.value=e,this.dispatch("cell-value-save-before",this),this.column.setFieldValue(this.row.data,e),this.dispatch("cell-value-save-after",this),this.loaded&&this.layoutElement()}layoutElement(){this._generateContents(),this.dispatch("cell-layout",this)}setWidth(){this.width=this.column.width,this.element.style.width=this.column.widthStyled}clearWidth(){this.width="",this.element.style.width=""}getWidth(){return this.width||this.element.offsetWidth}setMinWidth(){this.minWidth=this.column.minWidth,this.element.style.minWidth=this.column.minWidthStyled}setMaxWidth(){this.maxWidth=this.column.maxWidth,this.element.style.maxWidth=this.column.maxWidthStyled}checkHeight(){this.row.reinitializeHeight()}clearHeight(){this.element.style.height="",this.height=null,this.dispatch("cell-height",this,"")}setHeight(){this.height=this.row.height,this.element.style.height=this.row.heightStyled,this.dispatch("cell-height",this,this.row.heightStyled)}getHeight(){return this.height||this.element.offsetHeight}show(){this.element.style.display=this.column.vertAlign?"inline-flex":""}hide(){this.element.style.display="none"}delete(){this.dispatch("cell-delete",this),!this.table.rowManager.redrawBlock&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=!1,this.column.deleteCell(this),this.row.deleteCell(this),this.calcs={}}getIndex(){return this.row.getCellIndex(this)}getComponent(){return this.component||(this.component=new $L(this)),this.component}}class YL{constructor(e){return this._column=e,this.type="ColumnComponent",new Proxy(this,{get:function(r,u,R){return typeof r[u]<"u"?r[u]:r._column.table.componentFunctionBinder.handle("column",r._column,u)}})}getElement(){return this._column.getElement()}getDefinition(){return this._column.getDefinition()}getField(){return this._column.getField()}getTitleDownload(){return this._column.getTitleDownload()}getCells(){var e=[];return this._column.cells.forEach(function(r){e.push(r.getComponent())}),e}isVisible(){return this._column.visible}show(){this._column.isGroup?this._column.columns.forEach(function(e){e.show()}):this._column.show()}hide(){this._column.isGroup?this._column.columns.forEach(function(e){e.hide()}):this._column.hide()}toggle(){this._column.visible?this.hide():this.show()}delete(){return this._column.delete()}getSubColumns(){var e=[];return this._column.columns.length&&this._column.columns.forEach(function(r){e.push(r.getComponent())}),e}getParentColumn(){return this._column.getParentComponent()}_getSelf(){return this._column}scrollTo(e,r){return this._column.table.columnManager.scrollToColumn(this._column,e,r)}getTable(){return this._column.table}move(e,r){var u=this._column.table.columnManager.findColumn(e);u?this._column.table.columnManager.moveColumn(this._column,u,r):console.warn("Move Error - No matching column found:",u)}getNextColumn(){var e=this._column.nextColumn();return e?e.getComponent():!1}getPrevColumn(){var e=this._column.prevColumn();return e?e.getComponent():!1}updateDefinition(e){return this._column.updateDefinition(e)}getWidth(){return this._column.getWidth()}setWidth(e){var r;return e===!0?r=this._column.reinitializeWidth(!0):r=this._column.setWidth(e),this._column.table.columnManager.rerenderColumns(!0),r}}var ZL={title:void 0,field:void 0,columns:void 0,visible:void 0,hozAlign:void 0,vertAlign:void 0,width:void 0,minWidth:40,maxWidth:void 0,maxInitialWidth:void 0,cssClass:void 0,variableHeight:void 0,headerVertical:void 0,headerHozAlign:void 0,headerWordWrap:!1,editableTitle:void 0};const hv=class hv extends ch{constructor(e,r,u){super(r.table),this.definition=e,this.parent=r,this.type="column",this.columns=[],this.cells=[],this.isGroup=!1,this.isRowHeader=u,this.element=this.createElement(),this.contentElement=!1,this.titleHolderElement=!1,this.titleElement=!1,this.groupElement=this.createGroupElement(),this.hozAlign="",this.vertAlign="",this.field="",this.fieldStructure="",this.getFieldValue="",this.setFieldValue="",this.titleDownload=null,this.titleFormatterRendered=!1,this.mapDefinitions(),this.setField(this.definition.field),this.modules={},this.width=null,this.widthStyled="",this.maxWidth=null,this.maxWidthStyled="",this.maxInitialWidth=null,this.minWidth=null,this.minWidthStyled="",this.widthFixed=!1,this.visible=!0,this.component=null,this.definition.columns?(this.isGroup=!0,this.definition.columns.forEach((R,p)=>{var f=new hv(R,this);this.attachColumn(f)}),this.checkColumnVisibility()):r.registerColumnField(this),this._initialize()}createElement(){var e=document.createElement("div");switch(e.classList.add("tabulator-col"),e.setAttribute("role","columnheader"),e.setAttribute("aria-sort","none"),this.isRowHeader&&e.classList.add("tabulator-row-header"),this.table.options.columnHeaderVertAlign){case"middle":e.style.justifyContent="center";break;case"bottom":e.style.justifyContent="flex-end";break}return e}createGroupElement(){var e=document.createElement("div");return e.classList.add("tabulator-col-group-cols"),e}mapDefinitions(){var e=this.table.options.columnDefaults;if(e)for(let r in e)typeof this.definition[r]>"u"&&(this.definition[r]=e[r]);this.definition=this.table.columnManager.optionsList.generate(hv.defaultOptionList,this.definition)}checkDefinition(){Object.keys(this.definition).forEach(e=>{hv.defaultOptionList.indexOf(e)===-1&&console.warn("Invalid column definition option in '"+(this.field||this.definition.title)+"' column:",e)})}setField(e){this.field=e,this.fieldStructure=e?this.table.options.nestedFieldSeparator?e.split(this.table.options.nestedFieldSeparator):[e]:[],this.getFieldValue=this.fieldStructure.length>1?this._getNestedData:this._getFlatData,this.setFieldValue=this.fieldStructure.length>1?this._setNestedData:this._setFlatData}registerColumnPosition(e){this.parent.registerColumnPosition(e)}registerColumnField(e){this.parent.registerColumnField(e)}reRegisterPosition(){this.isGroup?this.columns.forEach(function(e){e.reRegisterPosition()}):this.registerColumnPosition(this)}_initialize(){for(var e=this.definition;this.element.firstChild;)this.element.removeChild(this.element.firstChild);e.headerVertical&&(this.element.classList.add("tabulator-col-vertical"),e.headerVertical==="flip"&&this.element.classList.add("tabulator-col-vertical-flip")),this.contentElement=this._buildColumnHeaderContent(),this.element.appendChild(this.contentElement),this.isGroup?this._buildGroupHeader():this._buildColumnHeader(),this.dispatch("column-init",this)}_buildColumnHeader(){var e=this.definition;if(this.dispatch("column-layout",this),typeof e.visible<"u"&&(e.visible?this.show(!0):this.hide(!0)),e.cssClass){var r=e.cssClass.split(" ");r.forEach(u=>{this.element.classList.add(u)})}e.field&&this.element.setAttribute("tabulator-field",e.field),this.setMinWidth(parseInt(e.minWidth)),e.maxInitialWidth&&(this.maxInitialWidth=parseInt(e.maxInitialWidth)),e.maxWidth&&this.setMaxWidth(parseInt(e.maxWidth)),this.reinitializeWidth(),this.hozAlign=this.definition.hozAlign,this.vertAlign=this.definition.vertAlign,this.titleElement.style.textAlign=this.definition.headerHozAlign}_buildColumnHeaderContent(){var e=document.createElement("div");return e.classList.add("tabulator-col-content"),this.titleHolderElement=document.createElement("div"),this.titleHolderElement.classList.add("tabulator-col-title-holder"),e.appendChild(this.titleHolderElement),this.titleElement=this._buildColumnHeaderTitle(),this.titleHolderElement.appendChild(this.titleElement),e}_buildColumnHeaderTitle(){var e=this.definition,r=document.createElement("div");if(r.classList.add("tabulator-col-title"),e.headerWordWrap&&r.classList.add("tabulator-col-title-wrap"),e.editableTitle){var u=document.createElement("input");u.classList.add("tabulator-title-editor"),u.addEventListener("click",R=>{R.stopPropagation(),u.focus()}),u.addEventListener("mousedown",R=>{R.stopPropagation()}),u.addEventListener("change",()=>{e.title=u.value,this.dispatchExternal("columnTitleChanged",this.getComponent())}),r.appendChild(u),e.field?this.langBind("columns|"+e.field,R=>{u.value=R||e.title||" "}):u.value=e.title||" "}else e.field?this.langBind("columns|"+e.field,R=>{this._formatColumnHeaderTitle(r,R||e.title||" ")}):this._formatColumnHeaderTitle(r,e.title||" ");return r}_formatColumnHeaderTitle(e,r){var u=this.chain("column-format",[this,r,e],null,()=>r);switch(typeof u){case"object":u instanceof Node?e.appendChild(u):(e.innerHTML="",console.warn("Format Error - Title formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:",u));break;case"undefined":e.innerHTML="";break;default:e.innerHTML=u}}_buildGroupHeader(){if(this.element.classList.add("tabulator-col-group"),this.element.setAttribute("role","columngroup"),this.element.setAttribute("aria-title",this.definition.title),this.definition.cssClass){var e=this.definition.cssClass.split(" ");e.forEach(r=>{this.element.classList.add(r)})}this.titleElement.style.textAlign=this.definition.headerHozAlign,this.element.appendChild(this.groupElement)}_getFlatData(e){return e[this.field]}_getNestedData(e){var r=e,u=this.fieldStructure,R=u.length,p;for(let f=0;f<R&&(r=r[u[f]],p=r,!!r);f++);return p}_setFlatData(e,r){this.field&&(e[this.field]=r)}_setNestedData(e,r){var u=e,R=this.fieldStructure,p=R.length;for(let f=0;f<p;f++)if(f==p-1)u[R[f]]=r;else{if(!u[R[f]])if(typeof r<"u")u[R[f]]={};else break;u=u[R[f]]}}attachColumn(e){this.groupElement?(this.columns.push(e),this.groupElement.appendChild(e.getElement()),e.columnRendered()):console.warn("Column Warning - Column being attached to another column instead of column group")}verticalAlign(e,r){var u=this.parent.isGroup?this.parent.getGroupElement().clientHeight:r||this.parent.getHeadersElement().clientHeight;this.element.style.height=u+"px",this.dispatch("column-height",this,this.element.style.height),this.isGroup&&(this.groupElement.style.minHeight=u-this.contentElement.offsetHeight+"px"),this.columns.forEach(function(R){R.verticalAlign(e)})}clearVerticalAlign(){this.element.style.paddingTop="",this.element.style.height="",this.element.style.minHeight="",this.groupElement.style.minHeight="",this.columns.forEach(function(e){e.clearVerticalAlign()}),this.dispatch("column-height",this,"")}getElement(){return this.element}getGroupElement(){return this.groupElement}getField(){return this.field}getTitleDownload(){return this.titleDownload}getFirstColumn(){return this.isGroup?this.columns.length?this.columns[0].getFirstColumn():!1:this}getLastColumn(){return this.isGroup?this.columns.length?this.columns[this.columns.length-1].getLastColumn():!1:this}getColumns(e){var r=[];return e?this.columns.forEach(u=>{r.push(u),r=r.concat(u.getColumns(!0))}):r=this.columns,r}getCells(){return this.cells}getTopColumn(){return this.parent.isGroup?this.parent.getTopColumn():this}getDefinition(e){var r=[];return this.isGroup&&e&&(this.columns.forEach(function(u){r.push(u.getDefinition(!0))}),this.definition.columns=r),this.definition}checkColumnVisibility(){var e=!1;this.columns.forEach(function(r){r.visible&&(e=!0)}),e?(this.show(),this.dispatchExternal("columnVisibilityChanged",this.getComponent(),!1)):this.hide()}show(e,r){this.visible||(this.visible=!0,this.element.style.display="",this.parent.isGroup&&this.parent.checkColumnVisibility(),this.cells.forEach(function(u){u.show()}),!this.isGroup&&this.width===null&&this.reinitializeWidth(),this.table.columnManager.verticalAlignHeaders(),this.dispatch("column-show",this,r),e||this.dispatchExternal("columnVisibilityChanged",this.getComponent(),!0),this.parent.isGroup&&this.parent.matchChildWidths(),this.silent||this.table.columnManager.rerenderColumns())}hide(e,r){this.visible&&(this.visible=!1,this.element.style.display="none",this.table.columnManager.verticalAlignHeaders(),this.parent.isGroup&&this.parent.checkColumnVisibility(),this.cells.forEach(function(u){u.hide()}),this.dispatch("column-hide",this,r),e||this.dispatchExternal("columnVisibilityChanged",this.getComponent(),!1),this.parent.isGroup&&this.parent.matchChildWidths(),this.silent||this.table.columnManager.rerenderColumns())}matchChildWidths(){var e=0;this.contentElement&&this.columns.length&&(this.columns.forEach(function(r){r.visible&&(e+=r.getWidth())}),this.contentElement.style.maxWidth=e-1+"px",this.table.initialized&&(this.element.style.width=e+"px"),this.parent.isGroup&&this.parent.matchChildWidths())}removeChild(e){var r=this.columns.indexOf(e);r>-1&&this.columns.splice(r,1),this.columns.length||this.delete()}setWidth(e){this.widthFixed=!0,this.setWidthActual(e)}setWidthActual(e){isNaN(e)&&(e=Math.floor(this.table.element.clientWidth/100*parseInt(e))),e=Math.max(this.minWidth,e),this.maxWidth&&(e=Math.min(this.maxWidth,e)),this.width=e,this.widthStyled=e?e+"px":"",this.element.style.width=this.widthStyled,this.isGroup||this.cells.forEach(function(r){r.setWidth()}),this.parent.isGroup&&this.parent.matchChildWidths(),this.dispatch("column-width",this),this.subscribedExternal("columnWidth")&&this.dispatchExternal("columnWidth",this.getComponent())}checkCellHeights(){var e=[];this.cells.forEach(function(r){r.row.heightInitialized&&(r.row.getElement().offsetParent!==null?(e.push(r.row),r.row.clearCellHeight()):r.row.heightInitialized=!1)}),e.forEach(function(r){r.calcHeight()}),e.forEach(function(r){r.setCellHeight()})}getWidth(){var e=0;return this.isGroup?this.columns.forEach(function(r){r.visible&&(e+=r.getWidth())}):e=this.width,e}getLeftOffset(){var e=this.element.offsetLeft;return this.parent.isGroup&&(e+=this.parent.getLeftOffset()),e}getHeight(){return Math.ceil(this.element.getBoundingClientRect().height)}setMinWidth(e){this.maxWidth&&e>this.maxWidth&&(e=this.maxWidth,console.warn("the minWidth ("+e+"px) for column '"+this.field+"' cannot be bigger that its maxWidth ("+this.maxWidthStyled+")")),this.minWidth=e,this.minWidthStyled=e?e+"px":"",this.element.style.minWidth=this.minWidthStyled,this.cells.forEach(function(r){r.setMinWidth()})}setMaxWidth(e){this.minWidth&&e<this.minWidth&&(e=this.minWidth,console.warn("the maxWidth ("+e+"px) for column '"+this.field+"' cannot be smaller that its minWidth ("+this.minWidthStyled+")")),this.maxWidth=e,this.maxWidthStyled=e?e+"px":"",this.element.style.maxWidth=this.maxWidthStyled,this.cells.forEach(function(r){r.setMaxWidth()})}delete(){return new Promise((e,r)=>{this.isGroup&&this.columns.forEach(function(R){R.delete()}),this.dispatch("column-delete",this);var u=this.cells.length;for(let R=0;R<u;R++)this.cells[0].delete();this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=!1,this.contentElement=!1,this.titleElement=!1,this.groupElement=!1,this.parent.isGroup&&this.parent.removeChild(this),this.table.columnManager.deregisterColumn(this),this.table.columnManager.rerenderColumns(!0),this.dispatch("column-deleted",this),e()})}columnRendered(){this.titleFormatterRendered&&this.titleFormatterRendered(),this.dispatch("column-rendered",this)}generateCell(e){var r=new sx(this,e);return this.cells.push(r),r}nextColumn(){var e=this.table.columnManager.findColumnIndex(this);return e>-1?this._nextVisibleColumn(e+1):!1}_nextVisibleColumn(e){var r=this.table.columnManager.getColumnByIndex(e);return!r||r.visible?r:this._nextVisibleColumn(e+1)}prevColumn(){var e=this.table.columnManager.findColumnIndex(this);return e>-1?this._prevVisibleColumn(e-1):!1}_prevVisibleColumn(e){var r=this.table.columnManager.getColumnByIndex(e);return!r||r.visible?r:this._prevVisibleColumn(e-1)}reinitializeWidth(e){this.widthFixed=!1,typeof this.definition.width<"u"&&!e&&this.setWidth(this.definition.width),this.dispatch("column-width-fit-before",this),this.fitToData(e),this.dispatch("column-width-fit-after",this)}fitToData(e){if(!this.isGroup){this.widthFixed||(this.element.style.width="",this.cells.forEach(R=>{R.clearWidth()}));var r=this.element.offsetWidth;if((!this.width||!this.widthFixed)&&(this.cells.forEach(R=>{var p=R.getWidth();p>r&&(r=p)}),r)){var u=r+1;e?this.setWidth(u):(this.maxInitialWidth&&!e&&(u=Math.min(u,this.maxInitialWidth)),this.setWidthActual(u))}}}updateDefinition(e){var r;return this.isGroup||this.parent.isGroup?(console.error("Column Update Error - The updateDefinition function is only available on ungrouped columns"),Promise.reject("Column Update Error - The updateDefinition function is only available on columns, not column groups")):(r=Object.assign({},this.getDefinition()),r=Object.assign(r,e),this.table.columnManager.addColumn(r,!1,this).then(u=>(r.field==this.field&&(this.field=!1),this.delete().then(()=>u.getComponent()))))}deleteCell(e){var r=this.cells.indexOf(e);r>-1&&this.cells.splice(r,1)}getComponent(){return this.component||(this.component=new YL(this)),this.component}getPosition(){return this.table.columnManager.getVisibleColumnsByIndex().indexOf(this)+1}getParentComponent(){return this.parent instanceof hv?this.parent.getComponent():!1}};Ci(hv,"defaultOptionList",ZL);let xv=hv;class Ew{constructor(e){return this._row=e,new Proxy(this,{get:function(r,u,R){return typeof r[u]<"u"?r[u]:r._row.table.componentFunctionBinder.handle("row",r._row,u)}})}getData(e){return this._row.getData(e)}getElement(){return this._row.getElement()}getCells(){var e=[];return this._row.getCells().forEach(function(r){e.push(r.getComponent())}),e}getCell(e){var r=this._row.getCell(e);return r?r.getComponent():!1}getIndex(){return this._row.getData("data")[this._row.table.options.index]}getPosition(){return this._row.getPosition()}watchPosition(e){return this._row.watchPosition(e)}delete(){return this._row.delete()}scrollTo(e,r){return this._row.table.rowManager.scrollToRow(this._row,e,r)}move(e,r){this._row.moveToRow(e,r)}update(e){return this._row.updateData(e)}normalizeHeight(){this._row.normalizeHeight(!0)}_getSelf(){return this._row}reformat(){return this._row.reinitialize()}getTable(){return this._row.table}getNextRow(){var e=this._row.nextRow();return e&&e.getComponent()}getPrevRow(){var e=this._row.prevRow();return e&&e.getComponent()}}class Sh extends ch{constructor(e,r,u="row"){super(r.table),this.parent=r,this.data={},this.type=u,this.element=!1,this.modules={},this.cells=[],this.height=0,this.heightStyled="",this.manualHeight=!1,this.outerHeight=0,this.initialized=!1,this.heightInitialized=!1,this.position=0,this.positionWatchers=[],this.component=null,this.created=!1,this.setData(e)}create(){this.created||(this.created=!0,this.generateElement())}createElement(){var e=document.createElement("div");e.classList.add("tabulator-row"),e.setAttribute("role","row"),this.element=e}getElement(){return this.create(),this.element}detachElement(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}generateElement(){this.createElement(),this.dispatch("row-init",this)}generateCells(){this.cells=this.table.columnManager.generateCells(this)}initialize(e,r){if(this.create(),!this.initialized||e){for(this.deleteCells();this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.dispatch("row-layout-before",this),this.generateCells(),this.initialized=!0,this.table.columnManager.renderer.renderRowCells(this,r),e&&this.normalizeHeight(),this.dispatch("row-layout",this),this.table.options.rowFormatter&&this.table.options.rowFormatter(this.getComponent()),this.dispatch("row-layout-after",this)}else this.table.columnManager.renderer.rerenderRowCells(this,r)}rendered(){this.cells.forEach(e=>{e.cellRendered()})}reinitializeHeight(){this.heightInitialized=!1,this.element&&this.element.offsetParent!==null&&this.normalizeHeight(!0)}deinitialize(){this.initialized=!1}deinitializeHeight(){this.heightInitialized=!1}reinitialize(e){this.initialized=!1,this.heightInitialized=!1,this.manualHeight||(this.height=0,this.heightStyled=""),this.element&&this.element.offsetParent!==null&&this.initialize(!0),this.dispatch("row-relayout",this)}calcHeight(e){var r=0,u=0;this.table.options.rowHeight?this.height=this.table.options.rowHeight:(u=this.calcMinHeight(),r=this.calcMaxHeight(),e?this.height=Math.max(r,u):this.height=this.manualHeight?this.height:Math.max(r,u)),this.heightStyled=this.height?this.height+"px":"",this.outerHeight=this.element.offsetHeight}calcMinHeight(){return this.table.options.resizableRows?this.element.clientHeight:0}calcMaxHeight(){var e=0;return this.cells.forEach(function(r){var u=r.getHeight();u>e&&(e=u)}),e}setCellHeight(){this.cells.forEach(function(e){e.setHeight()}),this.heightInitialized=!0}clearCellHeight(){this.cells.forEach(function(e){e.clearHeight()})}normalizeHeight(e){e&&!this.table.options.rowHeight&&this.clearCellHeight(),this.calcHeight(e),this.setCellHeight()}setHeight(e,r){(this.height!=e||r)&&(this.manualHeight=!0,this.height=e,this.heightStyled=e?e+"px":"",this.setCellHeight(),this.outerHeight=this.element.offsetHeight,this.subscribedExternal("rowHeight")&&this.dispatchExternal("rowHeight",this.getComponent()))}getHeight(){return this.outerHeight}getWidth(){return this.element.offsetWidth}deleteCell(e){var r=this.cells.indexOf(e);r>-1&&this.cells.splice(r,1)}setData(e){this.data=this.chain("row-data-init-before",[this,e],void 0,e),this.dispatch("row-data-init-after",this)}updateData(e){var r=this.element&&Ks.elVisible(this.element),u={},R;return new Promise((p,f)=>{typeof e=="string"&&(e=JSON.parse(e)),this.dispatch("row-data-save-before",this),this.subscribed("row-data-changing")&&(u=Object.assign(u,this.data),u=Object.assign(u,e)),R=this.chain("row-data-changing",[this,u,e],null,e);for(let n in R)this.data[n]=R[n];this.dispatch("row-data-save-after",this);for(let n in e)this.table.columnManager.getColumnsByFieldRoot(n).forEach(c=>{let i=this.getCell(c.getField());if(i){let _=c.getFieldValue(R);i.getValue()!==_&&(i.setValueProcessData(_),r&&i.cellRendered())}});r?(this.normalizeHeight(!0),this.table.options.rowFormatter&&this.table.options.rowFormatter(this.getComponent())):(this.initialized=!1,this.height=0,this.heightStyled=""),this.dispatch("row-data-changed",this,r,e),this.dispatchExternal("rowUpdated",this.getComponent()),this.subscribedExternal("dataChanged")&&this.dispatchExternal("dataChanged",this.table.rowManager.getData()),p()})}getData(e){return e?this.chain("row-data-retrieve",[this,e],null,this.data):this.data}getCell(e){var r=!1;return e=this.table.columnManager.findColumn(e),!this.initialized&&this.cells.length===0&&this.generateCells(),r=this.cells.find(function(u){return u.column===e}),r}getCellIndex(e){return this.cells.findIndex(function(r){return r===e})}findCell(e){return this.cells.find(r=>r.element===e)}getCells(){return!this.initialized&&this.cells.length===0&&this.generateCells(),this.cells}nextRow(){var e=this.table.rowManager.nextDisplayRow(this,!0);return e||!1}prevRow(){var e=this.table.rowManager.prevDisplayRow(this,!0);return e||!1}moveToRow(e,r){var u=this.table.rowManager.findRow(e);u?(this.table.rowManager.moveRowActual(this,u,!r),this.table.rowManager.refreshActiveData("display",!1,!0)):console.warn("Move Error - No matching row found:",e)}delete(){return this.dispatch("row-delete",this),this.deleteActual(),Promise.resolve()}deleteActual(e){this.detachModules(),this.table.rowManager.deleteRow(this,e),this.deleteCells(),this.initialized=!1,this.heightInitialized=!1,this.element=!1,this.dispatch("row-deleted",this)}detachModules(){this.dispatch("row-deleting",this)}deleteCells(){var e=this.cells.length;for(let r=0;r<e;r++)this.cells[0].delete()}wipe(){if(this.detachModules(),this.deleteCells(),this.element){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.element.parentNode&&this.element.parentNode.removeChild(this.element)}this.element=!1,this.modules={}}isDisplayed(){return this.table.rowManager.getDisplayRows().includes(this)}getPosition(){return this.isDisplayed()?this.position:!1}setPosition(e){e!=this.position&&(this.position=e,this.positionWatchers.forEach(r=>{r(this.position)}))}watchPosition(e){this.positionWatchers.push(e),e(this.position)}getGroup(){return this.modules.group||!1}getComponent(){return this.component||(this.component=new Ew(this)),this.component}}var hH={avg:function(t,e,r){var u=0,R=typeof r.precision<"u"?r.precision:2;return t.length&&(u=t.reduce(function(p,f){return Number(p)+Number(f)}),u=u/t.length,u=R!==!1?u.toFixed(R):u),parseFloat(u).toString()},max:function(t,e,r){var u=null,R=typeof r.precision<"u"?r.precision:!1;return t.forEach(function(p){p=Number(p),(p>u||u===null)&&(u=p)}),u!==null?R!==!1?u.toFixed(R):u:""},min:function(t,e,r){var u=null,R=typeof r.precision<"u"?r.precision:!1;return t.forEach(function(p){p=Number(p),(p<u||u===null)&&(u=p)}),u!==null?R!==!1?u.toFixed(R):u:""},sum:function(t,e,r){var u=0,R=typeof r.precision<"u"?r.precision:!1;return t.length&&t.forEach(function(p){p=Number(p),u+=isNaN(p)?0:Number(p)}),R!==!1?u.toFixed(R):u},concat:function(t,e,r){var u=0;return t.length&&(u=t.reduce(function(R,p){return String(R)+String(p)})),u},count:function(t,e,r){var u=0;return t.length&&t.forEach(function(R){R&&u++}),u},unique:function(t,e,r){var u=t.filter((R,p)=>(t||R===0)&&t.indexOf(R)===p);return u.length}};const Km=class Km extends uo{constructor(e){super(e),this.topCalcs=[],this.botCalcs=[],this.genColumn=!1,this.topElement=this.createElement(),this.botElement=this.createElement(),this.topRow=!1,this.botRow=!1,this.topInitialized=!1,this.botInitialized=!1,this.blocked=!1,this.recalcAfterBlock=!1,this.registerTableOption("columnCalcs",!0),this.registerColumnOption("topCalc"),this.registerColumnOption("topCalcParams"),this.registerColumnOption("topCalcFormatter"),this.registerColumnOption("topCalcFormatterParams"),this.registerColumnOption("bottomCalc"),this.registerColumnOption("bottomCalcParams"),this.registerColumnOption("bottomCalcFormatter"),this.registerColumnOption("bottomCalcFormatterParams")}createElement(){var e=document.createElement("div");return e.classList.add("tabulator-calcs-holder"),e}initialize(){this.genColumn=new xv({field:"value"},this),this.subscribe("cell-value-changed",this.cellValueChanged.bind(this)),this.subscribe("column-init",this.initializeColumnCheck.bind(this)),this.subscribe("row-deleted",this.rowsUpdated.bind(this)),this.subscribe("scroll-horizontal",this.scrollHorizontal.bind(this)),this.subscribe("row-added",this.rowsUpdated.bind(this)),this.subscribe("column-moved",this.recalcActiveRows.bind(this)),this.subscribe("column-add",this.recalcActiveRows.bind(this)),this.subscribe("data-refreshed",this.recalcActiveRowsRefresh.bind(this)),this.subscribe("table-redraw",this.tableRedraw.bind(this)),this.subscribe("rows-visible",this.visibleRows.bind(this)),this.subscribe("scrollbar-vertical",this.adjustForScrollbar.bind(this)),this.subscribe("redraw-blocked",this.blockRedraw.bind(this)),this.subscribe("redraw-restored",this.restoreRedraw.bind(this)),this.subscribe("table-redrawing",this.resizeHolderWidth.bind(this)),this.subscribe("column-resized",this.resizeHolderWidth.bind(this)),this.subscribe("column-show",this.resizeHolderWidth.bind(this)),this.subscribe("column-hide",this.resizeHolderWidth.bind(this)),this.registerTableFunction("getCalcResults",this.getResults.bind(this)),this.registerTableFunction("recalc",this.userRecalc.bind(this)),this.resizeHolderWidth()}resizeHolderWidth(){this.topElement.style.minWidth=this.table.columnManager.headersElement.offsetWidth+"px"}tableRedraw(e){this.recalc(this.table.rowManager.activeRows),e&&this.redraw()}blockRedraw(){this.blocked=!0,this.recalcAfterBlock=!1}restoreRedraw(){this.blocked=!1,this.recalcAfterBlock&&(this.recalcAfterBlock=!1,this.recalcActiveRowsRefresh())}userRecalc(){this.recalc(this.table.rowManager.activeRows)}blockCheck(){return this.blocked&&(this.recalcAfterBlock=!0),this.blocked}visibleRows(e,r){return this.topRow&&r.unshift(this.topRow),this.botRow&&r.push(this.botRow),r}rowsUpdated(e){this.table.options.groupBy?this.recalcRowGroup(e):this.recalcActiveRows()}recalcActiveRowsRefresh(){this.table.options.groupBy&&this.table.options.dataTreeStartExpanded&&this.table.options.dataTree?this.recalcAll():this.recalcActiveRows()}recalcActiveRows(){this.recalc(this.table.rowManager.activeRows)}cellValueChanged(e){(e.column.definition.topCalc||e.column.definition.bottomCalc)&&(this.table.options.groupBy?((this.table.options.columnCalcs=="table"||this.table.options.columnCalcs=="both")&&this.recalcActiveRows(),this.table.options.columnCalcs!="table"&&this.recalcRowGroup(e.row)):this.recalcActiveRows())}initializeColumnCheck(e){(e.definition.topCalc||e.definition.bottomCalc)&&this.initializeColumn(e)}initializeColumn(e){var r=e.definition,u={topCalcParams:r.topCalcParams||{},botCalcParams:r.bottomCalcParams||{}};if(r.topCalc){switch(typeof r.topCalc){case"string":Km.calculations[r.topCalc]?u.topCalc=Km.calculations[r.topCalc]:console.warn("Column Calc Error - No such calculation found, ignoring: ",r.topCalc);break;case"function":u.topCalc=r.topCalc;break}u.topCalc&&(e.modules.columnCalcs=u,this.topCalcs.push(e),this.table.options.columnCalcs!="group"&&this.initializeTopRow())}if(r.bottomCalc){switch(typeof r.bottomCalc){case"string":Km.calculations[r.bottomCalc]?u.botCalc=Km.calculations[r.bottomCalc]:console.warn("Column Calc Error - No such calculation found, ignoring: ",r.bottomCalc);break;case"function":u.botCalc=r.bottomCalc;break}u.botCalc&&(e.modules.columnCalcs=u,this.botCalcs.push(e),this.table.options.columnCalcs!="group"&&this.initializeBottomRow())}}registerColumnField(){}removeCalcs(){var e=!1;this.topInitialized&&(this.topInitialized=!1,this.topElement.parentNode.removeChild(this.topElement),e=!0),this.botInitialized&&(this.botInitialized=!1,this.footerRemove(this.botElement),e=!0),e&&this.table.rowManager.adjustTableSize()}reinitializeCalcs(){this.topCalcs.length&&this.initializeTopRow(),this.botCalcs.length&&this.initializeBottomRow()}initializeTopRow(){var e=document.createDocumentFragment();this.topInitialized||(e.appendChild(document.createElement("br")),e.appendChild(this.topElement),this.table.columnManager.getContentsElement().insertBefore(e,this.table.columnManager.headersElement.nextSibling),this.topInitialized=!0)}initializeBottomRow(){this.botInitialized||(this.footerPrepend(this.botElement),this.botInitialized=!0)}scrollHorizontal(e){this.botInitialized&&this.botRow&&(this.botElement.scrollLeft=e)}recalc(e){var r,u;if(!this.blockCheck()&&(this.topInitialized||this.botInitialized)){if(r=this.rowsToData(e),this.topInitialized){for(this.topRow&&this.topRow.deleteCells(),u=this.generateRow("top",r),this.topRow=u;this.topElement.firstChild;)this.topElement.removeChild(this.topElement.firstChild);this.topElement.appendChild(u.getElement()),u.initialize(!0)}if(this.botInitialized){for(this.botRow&&this.botRow.deleteCells(),u=this.generateRow("bottom",r),this.botRow=u;this.botElement.firstChild;)this.botElement.removeChild(this.botElement.firstChild);this.botElement.appendChild(u.getElement()),u.initialize(!0)}this.table.rowManager.adjustTableSize(),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout()}}recalcRowGroup(e){this.recalcGroup(this.table.modules.groupRows.getRowGroup(e))}recalcAll(){if((this.topCalcs.length||this.botCalcs.length)&&(this.table.options.columnCalcs!=="group"&&this.recalcActiveRows(),this.table.options.groupBy&&this.table.options.columnCalcs!=="table")){var e=this.table.modules.groupRows.getChildGroups();e.forEach(r=>{this.recalcGroup(r)})}}recalcGroup(e){var r,u;this.blockCheck()||e&&e.calcs&&(e.calcs.bottom&&(r=this.rowsToData(e.rows),u=this.generateRowData("bottom",r),e.calcs.bottom.updateData(u),e.calcs.bottom.reinitialize()),e.calcs.top&&(r=this.rowsToData(e.rows),u=this.generateRowData("top",r),e.calcs.top.updateData(u),e.calcs.top.reinitialize()))}generateTopRow(e){return this.generateRow("top",this.rowsToData(e))}generateBottomRow(e){return this.generateRow("bottom",this.rowsToData(e))}rowsToData(e){var r=[],u=this.table.options.dataTree&&this.table.options.dataTreeChildColumnCalcs,R=this.table.modules.dataTree;return e.forEach(p=>{var f;r.push(p.getData()),u&&((f=p.modules.dataTree)!=null&&f.open)&&this.rowsToData(R.getFilteredTreeChildren(p)).forEach(n=>{r.push(p)})}),r}generateRow(e,r){var u=this.generateRowData(e,r),R;return this.table.modExists("mutator")&&this.table.modules.mutator.disable(),R=new Sh(u,this,"calc"),this.table.modExists("mutator")&&this.table.modules.mutator.enable(),R.getElement().classList.add("tabulator-calcs","tabulator-calcs-"+e),R.component=!1,R.getComponent=()=>(R.component||(R.component=new cH(R)),R.component),R.generateCells=()=>{var p=[];this.table.columnManager.columnsByIndex.forEach(f=>{this.genColumn.setField(f.getField()),this.genColumn.hozAlign=f.hozAlign,f.definition[e+"CalcFormatter"]&&this.table.modExists("format")?this.genColumn.modules.format={formatter:this.table.modules.format.lookupFormatter(f.definition[e+"CalcFormatter"]),params:f.definition[e+"CalcFormatterParams"]||{}}:this.genColumn.modules.format={formatter:this.table.modules.format.lookupFormatter("plaintext"),params:{}},this.genColumn.definition.cssClass=f.definition.cssClass;var n=new sx(this.genColumn,R);n.getElement(),n.column=f,n.setWidth(),f.cells.push(n),p.push(n),f.visible||n.hide()}),R.cells=p},R}generateRowData(e,r){var u={},R=e=="top"?this.topCalcs:this.botCalcs,p=e=="top"?"topCalc":"botCalc",f,n;return R.forEach(function(l){var c=[];l.modules.columnCalcs&&l.modules.columnCalcs[p]&&(r.forEach(function(i){c.push(l.getFieldValue(i))}),n=p+"Params",f=typeof l.modules.columnCalcs[n]=="function"?l.modules.columnCalcs[n](c,r):l.modules.columnCalcs[n],l.setFieldValue(u,l.modules.columnCalcs[p](c,r,f)))}),u}hasTopCalcs(){return!!this.topCalcs.length}hasBottomCalcs(){return!!this.botCalcs.length}redraw(){this.topRow&&this.topRow.normalizeHeight(!0),this.botRow&&this.botRow.normalizeHeight(!0)}getResults(){var e={},r;return this.table.options.groupBy&&this.table.modExists("groupRows")?(r=this.table.modules.groupRows.getGroups(!0),r.forEach(u=>{e[u.getKey()]=this.getGroupResults(u)})):e={top:this.topRow?this.topRow.getData():{},bottom:this.botRow?this.botRow.getData():{}},e}getGroupResults(e){var r=e._getSelf(),u=e.getSubGroups(),R={},p={};return u.forEach(f=>{R[f.getKey()]=this.getGroupResults(f)}),p={top:r.calcs.top?r.calcs.top.getData():{},bottom:r.calcs.bottom?r.calcs.bottom.getData():{},groups:R},p}adjustForScrollbar(e){this.botRow&&(this.table.rtl?this.botElement.style.paddingLeft=e+"px":this.botElement.style.paddingRight=e+"px")}};Ci(Km,"moduleName","columnCalcs"),Ci(Km,"calculations",hH);let xT=Km;class XL extends uo{constructor(e){super(e),this.indent=10,this.field="",this.collapseEl=null,this.expandEl=null,this.branchEl=null,this.elementField=!1,this.startOpen=function(){},this.registerTableOption("dataTree",!1),this.registerTableOption("dataTreeFilter",!0),this.registerTableOption("dataTreeSort",!0),this.registerTableOption("dataTreeElementColumn",!1),this.registerTableOption("dataTreeBranchElement",!0),this.registerTableOption("dataTreeChildIndent",9),this.registerTableOption("dataTreeChildField","_children"),this.registerTableOption("dataTreeCollapseElement",!1),this.registerTableOption("dataTreeExpandElement",!1),this.registerTableOption("dataTreeStartExpanded",!1),this.registerTableOption("dataTreeChildColumnCalcs",!1),this.registerTableOption("dataTreeSelectPropagate",!1),this.registerComponentFunction("row","treeCollapse",this.collapseRow.bind(this)),this.registerComponentFunction("row","treeExpand",this.expandRow.bind(this)),this.registerComponentFunction("row","treeToggle",this.toggleRow.bind(this)),this.registerComponentFunction("row","getTreeParent",this.getTreeParent.bind(this)),this.registerComponentFunction("row","getTreeChildren",this.getRowChildren.bind(this)),this.registerComponentFunction("row","addTreeChild",this.addTreeChildRow.bind(this)),this.registerComponentFunction("row","isTreeExpanded",this.isRowExpanded.bind(this))}initialize(){if(this.table.options.dataTree){var e=null,r=this.table.options;switch(this.field=r.dataTreeChildField,this.indent=r.dataTreeChildIndent,this.options("movableRows")&&console.warn("The movableRows option is not available with dataTree enabled, moving of child rows could result in unpredictable behavior"),r.dataTreeBranchElement?r.dataTreeBranchElement===!0?(this.branchEl=document.createElement("div"),this.branchEl.classList.add("tabulator-data-tree-branch")):typeof r.dataTreeBranchElement=="string"?(e=document.createElement("div"),e.innerHTML=r.dataTreeBranchElement,this.branchEl=e.firstChild):this.branchEl=r.dataTreeBranchElement:(this.branchEl=document.createElement("div"),this.branchEl.classList.add("tabulator-data-tree-branch-empty")),r.dataTreeCollapseElement?typeof r.dataTreeCollapseElement=="string"?(e=document.createElement("div"),e.innerHTML=r.dataTreeCollapseElement,this.collapseEl=e.firstChild):this.collapseEl=r.dataTreeCollapseElement:(this.collapseEl=document.createElement("div"),this.collapseEl.classList.add("tabulator-data-tree-control"),this.collapseEl.tabIndex=0,this.collapseEl.innerHTML="<div class='tabulator-data-tree-control-collapse'></div>"),r.dataTreeExpandElement?typeof r.dataTreeExpandElement=="string"?(e=document.createElement("div"),e.innerHTML=r.dataTreeExpandElement,this.expandEl=e.firstChild):this.expandEl=r.dataTreeExpandElement:(this.expandEl=document.createElement("div"),this.expandEl.classList.add("tabulator-data-tree-control"),this.expandEl.tabIndex=0,this.expandEl.innerHTML="<div class='tabulator-data-tree-control-expand'></div>"),typeof r.dataTreeStartExpanded){case"boolean":this.startOpen=function(u,R){return r.dataTreeStartExpanded};break;case"function":this.startOpen=r.dataTreeStartExpanded;break;default:this.startOpen=function(u,R){return r.dataTreeStartExpanded[R]};break}this.subscribe("row-init",this.initializeRow.bind(this)),this.subscribe("row-layout-after",this.layoutRow.bind(this)),this.subscribe("row-deleting",this.rowDeleting.bind(this)),this.subscribe("row-deleted",this.rowDelete.bind(this),0),this.subscribe("row-data-changed",this.rowDataChanged.bind(this),10),this.subscribe("cell-value-updated",this.cellValueChanged.bind(this)),this.subscribe("edit-cancelled",this.cellValueChanged.bind(this)),this.subscribe("column-moving-rows",this.columnMoving.bind(this)),this.subscribe("table-built",this.initializeElementField.bind(this)),this.subscribe("table-redrawing",this.tableRedrawing.bind(this)),this.registerDisplayHandler(this.getRows.bind(this),30)}}tableRedrawing(e){var r;e&&(r=this.table.rowManager.getRows(),r.forEach(u=>{this.reinitializeRowChildren(u)}))}initializeElementField(){var e=this.table.columnManager.getFirstVisibleColumn();this.elementField=this.table.options.dataTreeElementColumn||(e?e.field:!1)}getRowChildren(e){return this.getTreeChildren(e,!0)}columnMoving(){var e=[];return this.table.rowManager.rows.forEach(r=>{e=e.concat(this.getTreeChildren(r,!1,!0))}),e}rowDataChanged(e,r,u){this.redrawNeeded(u)&&(this.initializeRow(e),r&&(this.layoutRow(e),this.refreshData(!0)))}cellValueChanged(e){var r=e.column.getField();r===this.elementField&&this.layoutRow(e.row)}initializeRow(e){var r=e.getData()[this.field],u=Array.isArray(r),R=u||!u&&typeof r=="object"&&r!==null;!R&&e.modules.dataTree&&e.modules.dataTree.branchEl&&e.modules.dataTree.branchEl.parentNode.removeChild(e.modules.dataTree.branchEl),!R&&e.modules.dataTree&&e.modules.dataTree.controlEl&&e.modules.dataTree.controlEl.parentNode.removeChild(e.modules.dataTree.controlEl),e.modules.dataTree={index:e.modules.dataTree?e.modules.dataTree.index:0,open:R?e.modules.dataTree?e.modules.dataTree.open:this.startOpen(e.getComponent(),0):!1,controlEl:e.modules.dataTree&&R?e.modules.dataTree.controlEl:!1,branchEl:e.modules.dataTree&&R?e.modules.dataTree.branchEl:!1,parent:e.modules.dataTree?e.modules.dataTree.parent:!1,children:R}}reinitializeRowChildren(e){var r=this.getTreeChildren(e,!1,!0);r.forEach(function(u){u.reinitialize(!0)})}layoutRow(e){var r=this.elementField?e.getCell(this.elementField):e.getCells()[0],u=r.getElement(),R=e.modules.dataTree;R.branchEl&&(R.branchEl.parentNode&&R.branchEl.parentNode.removeChild(R.branchEl),R.branchEl=!1),R.controlEl&&(R.controlEl.parentNode&&R.controlEl.parentNode.removeChild(R.controlEl),R.controlEl=!1),this.generateControlElement(e,u),e.getElement().classList.add("tabulator-tree-level-"+R.index),R.index&&(this.branchEl?(R.branchEl=this.branchEl.cloneNode(!0),u.insertBefore(R.branchEl,u.firstChild),this.table.rtl?R.branchEl.style.marginRight=(R.branchEl.offsetWidth+R.branchEl.style.marginLeft)*(R.index-1)+R.index*this.indent+"px":R.branchEl.style.marginLeft=(R.branchEl.offsetWidth+R.branchEl.style.marginRight)*(R.index-1)+R.index*this.indent+"px"):this.table.rtl?u.style.paddingRight=parseInt(window.getComputedStyle(u,null).getPropertyValue("padding-right"))+R.index*this.indent+"px":u.style.paddingLeft=parseInt(window.getComputedStyle(u,null).getPropertyValue("padding-left"))+R.index*this.indent+"px")}generateControlElement(e,r){var u=e.modules.dataTree,R=u.controlEl;r=r||e.getCells()[0].getElement(),u.children!==!1&&(u.open?(u.controlEl=this.collapseEl.cloneNode(!0),u.controlEl.addEventListener("click",p=>{p.stopPropagation(),this.collapseRow(e)})):(u.controlEl=this.expandEl.cloneNode(!0),u.controlEl.addEventListener("click",p=>{p.stopPropagation(),this.expandRow(e)})),u.controlEl.addEventListener("mousedown",p=>{p.stopPropagation()}),R&&R.parentNode===r?R.parentNode.replaceChild(u.controlEl,R):r.insertBefore(u.controlEl,r.firstChild))}getRows(e){var r=[];return e.forEach((u,R)=>{var p,f;r.push(u),u instanceof Sh&&(u.create(),p=u.modules.dataTree,!p.index&&p.children!==!1&&(f=this.getChildren(u,!1,!0),f.forEach(n=>{n.create(),r.push(n)})))}),r}getChildren(e,r,u){var R=e.modules.dataTree,p=[],f=[];return R.children!==!1&&(R.open||r)&&(Array.isArray(R.children)||(R.children=this.generateChildren(e)),this.table.modExists("filter")&&this.table.options.dataTreeFilter?p=this.table.modules.filter.filter(R.children):p=R.children,this.table.modExists("sort")&&this.table.options.dataTreeSort&&this.table.modules.sort.sort(p,u),p.forEach(n=>{f.push(n);var l=this.getChildren(n,!1,!0);l.forEach(c=>{f.push(c)})})),f}generateChildren(e){var r=[],u=e.getData()[this.field];return Array.isArray(u)||(u=[u]),u.forEach(R=>{var p=new Sh(R||{},this.table.rowManager);p.create(),p.modules.dataTree.index=e.modules.dataTree.index+1,p.modules.dataTree.parent=e,p.modules.dataTree.children&&(p.modules.dataTree.open=this.startOpen(p.getComponent(),p.modules.dataTree.index)),r.push(p)}),r}expandRow(e,r){var u=e.modules.dataTree;u.children!==!1&&(u.open=!0,e.reinitialize(),this.refreshData(!0),this.dispatchExternal("dataTreeRowExpanded",e.getComponent(),e.modules.dataTree.index))}collapseRow(e){var r=e.modules.dataTree;r.children!==!1&&(r.open=!1,e.reinitialize(),this.refreshData(!0),this.dispatchExternal("dataTreeRowCollapsed",e.getComponent(),e.modules.dataTree.index))}toggleRow(e){var r=e.modules.dataTree;r.children!==!1&&(r.open?this.collapseRow(e):this.expandRow(e))}isRowExpanded(e){return e.modules.dataTree.open}getTreeParent(e){return e.modules.dataTree.parent?e.modules.dataTree.parent.getComponent():!1}getTreeParentRoot(e){return e.modules.dataTree&&e.modules.dataTree.parent?this.getTreeParentRoot(e.modules.dataTree.parent):e}getFilteredTreeChildren(e){var r=e.modules.dataTree,u=[],R;return r.children&&(Array.isArray(r.children)||(r.children=this.generateChildren(e)),this.table.modExists("filter")&&this.table.options.dataTreeFilter?R=this.table.modules.filter.filter(r.children):R=r.children,R.forEach(p=>{p instanceof Sh&&u.push(p)})),u}rowDeleting(e){var r=e.modules.dataTree;r&&r.children&&Array.isArray(r.children)&&r.children.forEach(u=>{u instanceof Sh&&u.wipe()})}rowDelete(e){var r=e.modules.dataTree.parent,u;r&&(u=this.findChildIndex(e,r),u!==!1&&r.data[this.field].splice(u,1),r.data[this.field].length||delete r.data[this.field],this.initializeRow(r),this.layoutRow(r)),this.refreshData(!0)}addTreeChildRow(e,r,u,R){var p=!1;typeof r=="string"&&(r=JSON.parse(r)),Array.isArray(e.data[this.field])||(e.data[this.field]=[],e.modules.dataTree.open=this.startOpen(e.getComponent(),e.modules.dataTree.index)),typeof R<"u"&&(p=this.findChildIndex(R,e),p!==!1&&e.data[this.field].splice(u?p:p+1,0,r)),p===!1&&(u?e.data[this.field].unshift(r):e.data[this.field].push(r)),this.initializeRow(e),this.layoutRow(e),this.refreshData(!0)}findChildIndex(e,r){var u=!1;return typeof e=="object"?e instanceof Sh?u=e.data:e instanceof Ew?u=e._getSelf().data:typeof HTMLElement<"u"&&e instanceof HTMLElement?r.modules.dataTree&&(u=r.modules.dataTree.children.find(R=>R instanceof Sh?R.element===e:!1),u&&(u=u.data)):e===null&&(u=!1):typeof e>"u"?u=!1:u=r.data[this.field].find(R=>R.data[this.table.options.index]==e),u&&(Array.isArray(r.data[this.field])&&(u=r.data[this.field].indexOf(u)),u==-1&&(u=!1)),u}getTreeChildren(e,r,u){var R=e.modules.dataTree,p=[];return R&&R.children&&(Array.isArray(R.children)||(R.children=this.generateChildren(e)),R.children.forEach(f=>{f instanceof Sh&&(p.push(r?f.getComponent():f),u&&this.getTreeChildren(f,r,u).forEach(n=>{p.push(n)}))})),p}getChildField(){return this.field}redrawNeeded(e){return(this.field?typeof e[this.field]<"u":!1)||(this.elementField?typeof e[this.elementField]<"u":!1)}}Ci(XL,"moduleName","dataTree");function fH(t,e={},r){var u=e.delimiter?e.delimiter:",",R=[],p=[];t.forEach(f=>{var n=[];switch(f.type){case"group":console.warn("Download Warning - CSV downloader cannot process row groups");break;case"calc":console.warn("Download Warning - CSV downloader cannot process column calculations");break;case"header":f.columns.forEach((l,c)=>{l&&l.depth===1&&(p[c]=typeof l.value>"u"||l.value===null?"":'"'+String(l.value).split('"').join('""')+'"')});break;case"row":f.columns.forEach(l=>{if(l){switch(typeof l.value){case"object":l.value=l.value!==null?JSON.stringify(l.value):"";break;case"undefined":l.value="";break}n.push('"'+String(l.value).split('"').join('""')+'"')}}),R.push(n.join(u));break}}),p.length&&R.unshift(p.join(u)),R=R.join(`
|
|
58
58
|
`),e.bom&&(R="\uFEFF"+R),r(R,"text/csv")}function dH(t,e,r){var u=[];t.forEach(R=>{var p={};switch(R.type){case"header":break;case"group":console.warn("Download Warning - JSON downloader cannot process row groups");break;case"calc":console.warn("Download Warning - JSON downloader cannot process column calculations");break;case"row":R.columns.forEach(f=>{f&&(p[f.component.getTitleDownload()||f.component.getField()]=f.value)}),u.push(p);break}}),u=JSON.stringify(u,null," "),r(u,"application/json")}function pH(t,e={},r){var u=[],R=[],p={},f=e.rowGroupStyles||{fontStyle:"bold",fontSize:12,cellPadding:6,fillColor:220},n=e.rowCalcStyles||{fontStyle:"bold",fontSize:10,cellPadding:4,fillColor:232},l=e.jsPDF||{},c=e.title?e.title:"",i,_;l.orientation||(l.orientation=e.orientation||"landscape"),l.unit||(l.unit="pt"),t.forEach(w=>{switch(w.type){case"header":u.push(b(w));break;case"group":R.push(b(w,f));break;case"calc":R.push(b(w,n));break;case"row":R.push(b(w));break}});function b(w,v){var o=[];return w.columns.forEach(a=>{var h;if(a){switch(typeof a.value){case"object":a.value=a.value!==null?JSON.stringify(a.value):"";break;case"undefined":a.value="";break}h={content:a.value,colSpan:a.width,rowSpan:a.height},v&&(h.styles=v),o.push(h)}}),o}i=this.dependencyRegistry.lookup("jspdf","jsPDF"),_=new i(l),e.autoTable&&(typeof e.autoTable=="function"?p=e.autoTable(_)||{}:p=e.autoTable),c&&(p.didDrawPage=function(w){_.text(c,40,30)}),p.head=u,p.body=R,_.autoTable(p),e.documentProcessing&&e.documentProcessing(_),r(_.output("arraybuffer"),"application/pdf")}function mH(t,e,r){var u=this,R=e.sheetName||"Sheet1",p=this.dependencyRegistry.lookup("XLSX"),f=p.utils.book_new(),n=new ch(this),l="compress"in e?e.compress:!0,c=e.writeOptions||{bookType:"xlsx",bookSST:!0,compression:l},i;c.type="binary",f.SheetNames=[],f.Sheets={};function _(){var v=[],o=[],a={},h={s:{c:0,r:0},e:{c:t[0]?t[0].columns.reduce((s,m)=>s+(m&&m.width?m.width:1),0):0,r:t.length}};return t.forEach((s,m)=>{var y=[];s.columns.forEach(function(x,S){x?(y.push(!(x.value instanceof Date)&&typeof x.value=="object"?JSON.stringify(x.value):x.value),(x.width>1||x.height>-1)&&(x.height>1||x.width>1)&&o.push({s:{r:m,c:S},e:{r:m+x.height-1,c:S+x.width-1}})):y.push("")}),v.push(y)}),p.utils.sheet_add_aoa(a,v),a["!ref"]=p.utils.encode_range(h),o.length&&(a["!merges"]=o),a}if(e.sheetOnly){r(_());return}if(e.sheets)for(var b in e.sheets)e.sheets[b]===!0?(f.SheetNames.push(b),f.Sheets[b]=_()):(f.SheetNames.push(b),n.commsSend(e.sheets[b],"download","intercept",{type:"xlsx",options:{sheetOnly:!0},active:u.active,intercept:function(v){f.Sheets[b]=v}}));else f.SheetNames.push(R),f.Sheets[R]=_();e.documentProcessing&&(f=e.documentProcessing(f));function w(v){for(var o=new ArrayBuffer(v.length),a=new Uint8Array(o),h=0;h!=v.length;++h)a[h]=v.charCodeAt(h)&255;return o}i=p.write(f,c),r(w(i),"application/octet-stream")}function gH(t,e,r){this.modExists("export",!0)&&r(this.modules.export.generateHTMLTable(t),"text/html")}function vH(t,e,r){const u=[];t.forEach(R=>{const p={};switch(R.type){case"header":break;case"group":console.warn("Download Warning - JSON downloader cannot process row groups");break;case"calc":console.warn("Download Warning - JSON downloader cannot process column calculations");break;case"row":R.columns.forEach(f=>{f&&(p[f.component.getTitleDownload()||f.component.getField()]=f.value)}),u.push(JSON.stringify(p));break}}),r(u.join(`
|
|
@@ -84,7 +84,7 @@ Data: `,e)}_wipeElements(){this.dispatch("rows-wipe"),this.destroy(),this.ad
|
|
|
84
84
|
font-size: 12px;
|
|
85
85
|
font-weight: 500;
|
|
86
86
|
line-height: 1.4;
|
|
87
|
-
">${u}</span>`}const pP={scientific:_W,signed:wW,badge:TW};function kW(t){return t in pP}function SW(t){return pP[t]}let AW=0;const CW=wg({name:"TabulatorTable",props:{args:{type:Object,required:!0}},emits:["rowSelected"],setup(){const t=Cg(),e=zy(),r=`table-${Date.now()}-${++AW}`;return{streamlitDataStore:t,selectionStore:e,uniqueId:r}},data(){return{tabulator:void 0,selectedColumns:[],filterValues:{},filterTypes:{},columnAnalysis:{},teleportDialog:!1,teleportBackdrop:null,teleportContainer:null,parentDocument:null,showGoTo:!1,selectedGoToField:"",goToInputValue:"",pendingSelection:null,lastDataHash:"",skipNextSync:!1,pendingDataRequest:null,isLoadingServerData:!1,currentColumnFilters:[],isTableBuilt:!1,isNavigatingPages:!1,pendingTargetRowIndex:null,pendingPageNavigation:!1,initialLoadComplete:!1,lastRequestedPage:null,requestedSortColumn:"",requestedSortDir:"asc",pendingRequestCounter:null}},computed:{id(){return this.uniqueId},tableClasses(){var t,e;return{"table-dark":((t=this.streamlitDataStore.theme)==null?void 0:t.base)==="dark","table-light":((e=this.streamlitDataStore.theme)==null?void 0:e.base)==="light","table-bordered":!0,"table-sm":!0}},tableData(){var e;const t=(e=this.streamlitDataStore.allDataForDrawing)==null?void 0:e.tableData;return Array.isArray(t)?t:[]},columnNames(){return(this.args.columnDefinitions||[]).map(t=>({field:t.field||"",title:t.title||t.field||""})).filter(t=>t.field!=="")},activeFilterCount(){let t=0;for(const e of this.selectedColumns){const r=this.filterValues[e];if(!r)continue;const u=this.filterTypes[e];let R=!1;switch(u){case"categorical":R=!!(r.categorical&&r.categorical.length>0);break;case"numeric":if(r.numeric){const p=this.getMinValue(e),f=this.getMaxValue(e);R=r.numeric.min!==p||r.numeric.max!==f}break;case"text":R=!!(r.text&&r.text.trim()!=="");break}R&&t++}return t},preparedTableData(){const t=this.args.tableIndexField||"id",e=this.args.interactivity||{},r=Object.values(e),u=[...(this.args.columnDefinitions||[]).map(p=>p.field),t,...r],R=[...new Set(u)];if(this.tableData.length>0){const p=[];return this.tableData.forEach((f,n)=>{const l={};R.forEach(c=>{c!==void 0&&(l[c]=f[c])}),this.tableData[0][t]===void 0?p.push({...l,[t]:n}):p.push({...l})}),p}return this.tableData},currentDataHash(){return this.streamlitDataStore.hash||""},paginationState(){var e;const t=(e=this.streamlitDataStore.allDataForDrawing)==null?void 0:e._pagination;return console.log(`[TabulatorTable ${this.args.title}] paginationState COMPUTED:`,{page:t==null?void 0:t.page,totalRows:t==null?void 0:t.total_rows,hasState:!!t}),t},navigateToPage(){var e;const t=(e=this.streamlitDataStore.allDataForDrawing)==null?void 0:e._navigate_to_page;return typeof t=="number"?t:null},targetRowIndex(){var e;const t=(e=this.streamlitDataStore.allDataForDrawing)==null?void 0:e._target_row_index;return typeof t=="number"?t:null},isServerSidePagination(){return this.args.pagination!==!1&&!!this.args.paginationIdentifier},serverSortColumn(){var t;return((t=this.paginationState)==null?void 0:t.sort_column)||""},serverSortDir(){var t;return((t=this.paginationState)==null?void 0:t.sort_dir)||"asc"},serverColumnMetadata(){return this.args.columnMetadata||{}}},watch:{currentDataHash(t,e){var r;if(console.log(`[TabulatorTable ${this.args.title}] ===== currentDataHash WATCHER FIRED =====`,{timestamp:Date.now(),newHash:t==null?void 0:t.slice(0,8),oldHash:e==null?void 0:e.slice(0,8),lastDataHash:(r=this.lastDataHash)==null?void 0:r.slice(0,8),hasPendingRequest:!!this.pendingDataRequest,pendingTargetRowIndex:this.pendingTargetRowIndex}),t===this.lastDataHash){console.log(`[TabulatorTable ${this.args.title}] currentDataHash watcher: early return (hash unchanged)`);return}this.lastDataHash=t,this.clearInvalidSelections(),this.$nextTick(()=>{this.tabulator?this.updateTableData():this.drawTable()})},"args.height"(t){if(this.tabulator&&t){const e=t-56-(this.showGoTo?58:0);this.tabulator.setHeight(Math.max(e,50))}},selectedColumns:{handler(t){t.forEach(e=>{this.initializeFilterValue(e)})},immediate:!0},"selectionStore.$state":{handler(){this.syncSelectionFromStore()},deep:!0},navigateToPage(t){if(console.log(`[TabulatorTable ${this.args.title}] navigateToPage watcher:`,{newPage:t,targetRowIndex:this.targetRowIndex,isServerSidePagination:this.isServerSidePagination,hasTabulator:!!this.tabulator,isNavigatingPages:this.isNavigatingPages}),this.isNavigatingPages){console.log(`[TabulatorTable ${this.args.title}] navigateToPage: SKIPPING (Vue-initiated navigation in progress)`);return}t&&this.tabulator&&this.isServerSidePagination&&(this.pendingTargetRowIndex=this.targetRowIndex,this.pendingPageNavigation=!0,this.isNavigatingPages=!0,console.log(`[TabulatorTable ${this.args.title}] Set pendingTargetRowIndex:`,this.pendingTargetRowIndex),this.tabulator.setPage(t))},paginationState:{handler(t,e){if(console.log(`[TabulatorTable ${this.args.title}] ===== paginationState WATCHER FIRED =====`,{timestamp:Date.now(),newPage:t==null?void 0:t.page,oldPage:e==null?void 0:e.page,newTotalRows:t==null?void 0:t.total_rows,pendingTargetRowIndex:this.pendingTargetRowIndex,hasPendingDataRequest:!!this.pendingDataRequest,pendingRequestCounter:this.pendingRequestCounter,isTableBuilt:this.isTableBuilt,isServerSidePagination:this.isServerSidePagination,preparedDataLength:this.preparedTableData.length,storeDataForDrawingKeys:Object.keys(this.streamlitDataStore.allDataForDrawing||{})}),!t||!this.isServerSidePagination||!this.tabulator){console.log(`[TabulatorTable ${this.args.title}] paginationState watcher: early return`);return}this.injectServerSideData(t),t.sort_column!==void 0&&(this.requestedSortColumn=t.sort_column||""),t.sort_dir!==void 0&&(this.requestedSortDir=t.sort_dir||"asc"),this.pendingTargetRowIndex!==null&&(console.log(`[TabulatorTable ${this.args.title}] paginationState watcher: scheduling selectPendingTargetRow`),this.$nextTick(()=>{this.selectPendingTargetRow()})),console.log(`[TabulatorTable ${this.args.title}] paginationState watcher: checking pendingDataRequest`,{hasPendingDataRequest:!!this.pendingDataRequest,pendingRequestCounter:this.pendingRequestCounter}),this.pendingDataRequest?this.resolveDataRequest():console.log(`[TabulatorTable ${this.args.title}] paginationState watcher: NO pendingDataRequest to resolve`),!this.initialLoadComplete&&this.isTableBuilt&&this.$nextTick(()=>{this.initialLoadComplete=!0,console.log(`[TabulatorTable ${this.args.title}] initialLoadComplete set to true`),this.selectDefaultRow()}),this.isLoadingServerData=!1},deep:!0}},mounted(){this.lastDataHash=this.currentDataHash,this.drawTable(),this.initializeTeleport(),this.initializeGoTo()},beforeUnmount(){this.cleanupTeleport()},methods:{drawTable(){var l;this.isTableBuilt=!1,this.initialLoadComplete=!1,this.tabulator&&(this.tabulator.destroy(),this.tabulator=void 0);const t=this.args.tableIndexField||"id",e=this.args.height,r=this.args.title?320:310,u=e?e-56:r,R=this.showGoTo?58:0,p=u-R,f={index:t,minHeight:150,maxHeight:Math.max(p,150),height:Math.max(p,150),responsiveLayout:"collapse",layout:this.args.tableLayoutParam||"fitDataFill",selectable:1,columnDefaults:{title:"",hozAlign:"right"},columns:(this.args.columnDefinitions||[]).map(c=>{const i={...c};if(i.headerTooltip===void 0&&(i.headerTooltip=!0),typeof i.formatter=="string"&&kW(i.formatter)){const _=SW(i.formatter);_&&(i.formatter=_)}return i}),initialSort:this.args.initialSort};if(this.args.pagination!==!1)f.pagination=!0,f.paginationSize=((l=this.paginationState)==null?void 0:l.page_size)||this.args.pageSize||100,f.paginationSizeSelector=[50,100,200,500,1e3],f.paginationCounter="rows",this.isServerSidePagination?(f.paginationMode="remote",f.sortMode="remote",f.filterMode="remote",f.ajaxURL="streamlit://data",f.ajaxRequestFunc=this.handleRemoteRequest.bind(this)):f.data=this.preparedTableData;else{f.data=this.preparedTableData;const c=this.preparedTableData.length>100;f.renderVertical=c?"virtual":"basic"}this.tabulator=new xW(`#${this.id}`,f),this.tabulator.on("dataLoadError",c=>{console.error(`[TabulatorTable ${this.args.title}] Data load error:`,c)}),this.tabulator.on("ajaxError",c=>{console.error(`[TabulatorTable ${this.args.title}] AJAX error:`,c)}),this.tabulator.on("tableBuilt",()=>{this.isTableBuilt=!0,this.injectServerSideData(),this.isServerSidePagination||this.selectDefaultRow(),this.applyFilters(),this.$nextTick(()=>{this.args.height?Hc.setFrameHeight(this.args.height):Hc.setFrameHeight(),setTimeout(()=>{if(this.tabulator){const c=this.tabulator.getSelectedRows();c.length>0?this.tabulator.scrollToRow(c[0],"center",!1):this.tabulator.scrollToRow(this.tabulator.getRows()[0],"top",!1)}},50)})}),this.tabulator.on("rowClick",(c,i)=>{this.onRowClick(i)}),this.isServerSidePagination&&this.tabulator.on("dataSorting",c=>{var o,a,h;if(console.log(`[TabulatorTable ${this.args.title}] dataSorting event:`,c),!c||c.length===0)return;const i=c[0].field,_=c[0].dir,b=((o=this.paginationState)==null?void 0:o.sort_column)||"",w=((a=this.paginationState)==null?void 0:a.sort_dir)||"asc";if(i===b&&_===w){console.log(`[TabulatorTable ${this.args.title}] dataSorting: sort unchanged, skipping`);return}console.log(`[TabulatorTable ${this.args.title}] dataSorting: requesting sorted data`,{from:{col:b,dir:w},to:{col:i,dir:_}}),this.requestedSortColumn=i,this.requestedSortDir=_,this.isLoadingServerData=!0;const v=this.args.paginationIdentifier;v&&this.selectionStore.updateSelection(v,{page:1,page_size:((h=this.paginationState)==null?void 0:h.page_size)||this.args.pageSize||100,sort_column:i,sort_dir:_,column_filters:this.currentColumnFilters})})},handleRemoteRequest(t,e,r){var b,w,v,o,a,h,s,m;const u=r.page||1,R=r.size||this.args.pageSize||100;this.lastRequestedPage=u;const p=((w=(b=r.sorters)==null?void 0:b[0])==null?void 0:w.field)??(this.requestedSortColumn||void 0),f=((o=(v=r.sorters)==null?void 0:v[0])==null?void 0:o.dir)??this.requestedSortDir??"asc";console.log(`[TabulatorTable ${this.args.title}] ===== handleRemoteRequest START =====`,{timestamp:Date.now(),requestedPage:u,requestedSize:R,requestedSortColumn:p,requestedSortDir:f,rawSorters:r.sorters,paginationIdentifier:this.args.paginationIdentifier,currentPaginationState:this.paginationState,cachedSortColumn:(a=this.paginationState)==null?void 0:a.sort_column,cachedSortDir:(h=this.paginationState)==null?void 0:h.sort_dir,hasPendingRequest:!!this.pendingDataRequest});const n=((s=this.paginationState)==null?void 0:s.sort_column)||"",l=((m=this.paginationState)==null?void 0:m.sort_dir)||"asc",c=p||"",i=n===c&&l===f;if(console.log(`[TabulatorTable ${this.args.title}] handleRemoteRequest: SORT CHECK v2`,{cachedSortCol:n,cachedSortDir:l,requestedSortCol:c,requestedSortDir:f,sortMatch:i}),this.paginationState&&this.paginationState.page===u&&this.paginationState.page_size===R&&i&&this.tableData.length>0){console.log(`[TabulatorTable ${this.args.title}] handleRemoteRequest: using cached data (page=${u}, sortCol=${n})`);const y=this.args.paginationIdentifier;y&&this.selectionStore.updateSelection(y,{page:u,page_size:R,sort_column:p,sort_dir:f,column_filters:this.currentColumnFilters});const x={last_page:this.paginationState.total_pages,last_row:this.paginationState.total_rows,data:this.preparedTableData};return new Promise(S=>{setTimeout(()=>S(x),0)})}this.isLoadingServerData=!0,this.isNavigatingPages=!0;const _=this.args.paginationIdentifier;return _&&(console.log(`[TabulatorTable ${this.args.title}] handleRemoteRequest: requesting page ${u} via selectionStore`),this.selectionStore.updateSelection(_,{page:u,page_size:R,sort_column:p,sort_dir:f,column_filters:this.currentColumnFilters})),this.pendingRequestCounter=this.selectionStore.$state.pagination_counter||0,console.log(`[TabulatorTable ${this.args.title}] handleRemoteRequest: STORED pendingRequestCounter`,{pendingRequestCounter:this.pendingRequestCounter,selectionStorePaginationCounter:this.selectionStore.$state.pagination_counter}),new Promise((y,x)=>{this.pendingDataRequest={resolve:y,reject:x},console.log(`[TabulatorTable ${this.args.title}] handleRemoteRequest: pendingDataRequest SET`,{timestamp:Date.now(),requestCounter:this.pendingRequestCounter}),setTimeout(()=>{this.pendingDataRequest&&(console.warn(`[TabulatorTable ${this.args.title}] Request timeout`),this.pendingDataRequest=null,this.pendingRequestCounter=null,this.isLoadingServerData=!1,x(new Error("Request timeout")))},3e4)})},resolveDataRequest(){var u;const t=this.selectionStore.$state;if(console.log(`[TabulatorTable ${this.args.title}] ===== resolveDataRequest CALLED =====`,{timestamp:Date.now(),hasPendingRequest:!!this.pendingDataRequest,pendingRequestCounter:this.pendingRequestCounter,paginationStatePage:(u=this.paginationState)==null?void 0:u.page,preparedDataLength:this.preparedTableData.length,selectionStorePaginationCounter:t.pagination_counter,selectionStoreCounter:t.counter}),!this.pendingDataRequest||!this.paginationState){console.log(`[TabulatorTable ${this.args.title}] resolveDataRequest: EARLY RETURN (missing data)`,{hasPendingRequest:!!this.pendingDataRequest,hasPaginationState:!!this.paginationState});return}const e=this.selectionStore.$state.pagination_counter||0,r=this.pendingRequestCounter!==null&&e>this.pendingRequestCounter+1;if(console.log(`[TabulatorTable ${this.args.title}] resolveDataRequest: STALE CHECK`,{pendingRequestCounter:this.pendingRequestCounter,currentCounter:e,threshold:this.pendingRequestCounter!==null?this.pendingRequestCounter+1:"N/A",isStale:r}),r){console.log(`[TabulatorTable ${this.args.title}] resolveDataRequest: STALE RESPONSE DETECTED, rejecting promise`),this.pendingDataRequest.reject(new Error("Stale response - newer request pending")),this.pendingDataRequest=null,this.pendingRequestCounter=null,this.isLoadingServerData=!1;return}console.log(`[TabulatorTable ${this.args.title}] resolveDataRequest: RESOLVING PROMISE`,{lastPage:this.paginationState.total_pages,lastRow:this.paginationState.total_rows,dataLength:this.preparedTableData.length}),this.pendingDataRequest.resolve({last_page:this.paginationState.total_pages,last_row:this.paginationState.total_rows,data:this.preparedTableData}),this.pendingDataRequest=null,this.pendingRequestCounter=null,this.isLoadingServerData=!1,console.log(`[TabulatorTable ${this.args.title}] resolveDataRequest: PROMISE RESOLVED`)},injectServerSideData(t){var f,n;const e=t??this.paginationState;if(console.log(`[TabulatorTable ${this.args.title}] ===== injectServerSideData CALLED =====`,{timestamp:Date.now(),hasPaginationState:!!e,paginationPage:e==null?void 0:e.page,isTableBuilt:this.isTableBuilt,hasPendingRequest:!!this.pendingDataRequest,pendingPageNavigation:this.pendingPageNavigation,tabulatorRows:(f=this.tabulator)==null?void 0:f.getRows().length,preparedDataLength:this.preparedTableData.length,isServerSidePagination:this.isServerSidePagination}),!this.tabulator||!this.isServerSidePagination||!e||!this.isTableBuilt){console.log(`[TabulatorTable ${this.args.title}] injectServerSideData: early return (preconditions)`);return}const r=!!this.pendingDataRequest,u=this.tabulator.getRows().length;if(r){console.log(`[TabulatorTable ${this.args.title}] injectServerSideData: skipping (AJAX pending)`);return}if(!(this.pendingPageNavigation&&this.preparedTableData.length>0)&&(u>0||this.preparedTableData.length===0)){console.log(`[TabulatorTable ${this.args.title}] injectServerSideData: early return (has data/no request)`);return}this.pendingPageNavigation&&(this.pendingPageNavigation=!1),console.log(`[TabulatorTable ${this.args.title}] injectServerSideData: injecting data`);const p=this.tabulator;p.rowManager.setData(this.preparedTableData,!1,!1),(n=p.modules)!=null&&n.page&&(p.modules.page.setMaxRows(e.total_rows),p.modules.page.setMaxPage(e.total_pages)),p.redraw(!0),p.clearAlert&&p.clearAlert()},selectPendingTargetRow(){var r;const t=this.pendingTargetRowIndex;if(this.pendingTargetRowIndex=null,console.log(`[TabulatorTable ${this.args.title}] selectPendingTargetRow:`,{targetIndex:t,hasTabulator:!!this.tabulator,activeRowCount:(r=this.tabulator)==null?void 0:r.getRows("active").length}),t===null||!this.tabulator){console.log(`[TabulatorTable ${this.args.title}] selectPendingTargetRow: early return`);return}const e=this.tabulator.getRows("active");console.log(`[TabulatorTable ${this.args.title}] selectPendingTargetRow: rows[${t}] exists:`,!!(e!=null&&e[t])),e&&e[t]&&(this.tabulator.deselectRow(),e[t].select(),e[t].scrollTo("center",!1),console.log(`[TabulatorTable ${this.args.title}] selectPendingTargetRow: SUCCESS - selected row ${t}`))},syncSelectionFromStore(){if(this.skipNextSync||!this.tabulator)return;const t=this.args.interactivity||{};if(this.isServerSidePagination){for(const[e,r]of Object.entries(t)){const u=this.selectionStore.$state[e];if(u!=null){const R=this.tabulator.getSelectedRows()[0];if(R&&R.getData()[r]===u)return;const p=this.preparedTableData.findIndex(f=>f[r]===u);if(p>=0){const f=this.args.tableIndexField||"id",n=this.preparedTableData[p][f],l=this.tabulator.getRow(n);l&&(this.tabulator.deselectRow(),l.select(),l.scrollTo("center",!1))}else this.pendingSelection={[e]:u};break}}return}for(const[e,r]of Object.entries(t)){const u=this.selectionStore.$state[e];if(u!=null){const R=this.tabulator.getSelectedRows()[0];if(R&&R.getData()[r]===u){this.pendingSelection=null;return}const p=this.preparedTableData.findIndex(f=>f[r]===u);if(p>=0){const f=this.args.tableIndexField||"id",n=this.preparedTableData[p][f],l=this.tabulator.getRow(n);l?(this.tabulator.deselectRow(),l.select(),this.tabulator.options.pagination?this.tabulator.setPageToRow(n).then(()=>{l.scrollTo("center",!1)}):l.scrollTo("center",!1),this.pendingSelection=null):this.pendingSelection={[e]:u}}else this.pendingSelection={[e]:u};break}}},selectDefaultRow(){var r,u,R,p,f;if(this.isServerSidePagination&&!this.initialLoadComplete){console.log(`[TabulatorTable ${this.args.title}] selectDefaultRow: SKIPPED (initial load not complete)`);return}if(this.isServerSidePagination&&this.isNavigatingPages){const n=(r=this.paginationState)==null?void 0:r.page,l=this.lastRequestedPage;if(n===l)return}const t=this.args.interactivity||{};let e=!1;if(this.pendingSelection)for(const[n,l]of Object.entries(this.pendingSelection)){const c=t[n];if(c&&l!==void 0&&l!==null){const i=this.preparedTableData.findIndex(_=>_[c]===l);if(i>=0){const _=this.args.tableIndexField||"id",b=this.preparedTableData[i][_],v=(((u=this.tabulator)==null?void 0:u.getRows())||[]).find(o=>o.getData()[_]===b);if(v){v.select(),(R=this.tabulator)!=null&&R.options.pagination?this.tabulator.setPageToRow(b).then(()=>{v.scrollTo("center",!1)}):v.scrollTo("center",!1),e=!0,this.pendingSelection=null;break}}}}if(!e)for(const[n,l]of Object.entries(t)){const c=this.selectionStore.$state[n];if(c!=null){const i=this.preparedTableData.findIndex(_=>_[l]===c);if(i>=0){const _=this.args.tableIndexField||"id",b=this.preparedTableData[i][_],v=(((p=this.tabulator)==null?void 0:p.getRows())||[]).find(o=>o.getData()[_]===b);if(v){v.select(),(f=this.tabulator)!=null&&f.options.pagination?this.tabulator.setPageToRow(b).then(()=>{v.scrollTo("center",!1)}):v.scrollTo("center",!1),e=!0;break}}e=!0;break}}if(!e&&!this.isServerSidePagination){const n=this.args.defaultRow??0;n>=0&&setTimeout(()=>{var c;const l=(c=this.tabulator)==null?void 0:c.getRows("active");if(l&&l.length>0&&n<l.length){const i=l[n];i.select();const _=i.getData();if(_){const b=this.args.interactivity||{};for(const[w,v]of Object.entries(b)){const o=_[v];this.selectionStore.updateSelection(w,o)}}}},0)}},clearInvalidSelections(){if(this.isServerSidePagination)return;const t=this.args.interactivity||{};for(const[e,r]of Object.entries(t)){const u=this.selectionStore.$state[e];if(u==null)continue;this.preparedTableData.findIndex(p=>p[r]===u)<0&&(this.selectionStore.updateSelection(e,null),this.pendingSelection&&e in this.pendingSelection&&(delete this.pendingSelection[e],Object.keys(this.pendingSelection).length===0&&(this.pendingSelection=null)))}},onRowClick(t){var R;const e=t.getData(),r=t.getIndex();(R=this.tabulator)==null||R.deselectRow(),t.select(),this.$emit("rowSelected",r),this.skipNextSync=!0;const u=this.args.interactivity||{};if(e)for(const[p,f]of Object.entries(u)){const n=e[f];this.selectionStore.updateSelection(p,n)}this.$nextTick(()=>{this.skipNextSync=!1})},updateTableData(){var R,p,f,n,l,c,i,_,b,w,v,o,a;if(console.log("[TabulatorTable] updateTableData called",{hasTabulator:!!this.tabulator,isServerSidePagination:this.isServerSidePagination,paginationState:this.paginationState,isNavigatingPages:this.isNavigatingPages,dataLength:(R=this.preparedTableData)==null?void 0:R.length}),!this.tabulator){this.drawTable();return}const t=(p=this.paginationState)==null?void 0:p.page,e=(f=this.paginationState)==null?void 0:f.total_rows,r=(n=this.paginationState)==null?void 0:n.total_pages,u=this.tabulator;console.log("[TabulatorTable] Before replaceData - Tabulator internal state:",{hasPageModule:!!((l=u.modules)!=null&&l.page),maxPage:(i=(c=u.modules)==null?void 0:c.page)==null?void 0:i.max,lastPage:(b=(_=u.modules)==null?void 0:_.page)==null?void 0:b.lastPage,currentPage:(v=(w=u.modules)==null?void 0:w.page)==null?void 0:v.page,size:(a=(o=u.modules)==null?void 0:o.page)==null?void 0:a.size}),this.tabulator.replaceData(this.preparedTableData).then(()=>{var h,s,m,y,x,S,C,A,E,P;if(console.log("[TabulatorTable] After replaceData - Tabulator internal state:",{hasPageModule:!!((h=u.modules)!=null&&h.page),maxPage:(m=(s=u.modules)==null?void 0:s.page)==null?void 0:m.max,lastPage:(x=(y=u.modules)==null?void 0:y.page)==null?void 0:x.lastPage,currentPage:(C=(S=u.modules)==null?void 0:S.page)==null?void 0:C.page}),this.pendingPageNavigation&&this.tabulator.clearAlert&&(this.tabulator.clearAlert(),this.pendingPageNavigation=!1,this.$nextTick(()=>{this.selectPendingTargetRow()})),this.isNavigatingPages||this.applyFilters(),this.isServerSidePagination&&e!==void 0&&r!==void 0&&(A=u.modules)!=null&&A.page)try{const M=Number(e),L=Number(r);console.log("[TabulatorTable] Calling setMaxRows and setMaxPage",{totalRows:M,totalPages:L}),u.modules.page.setMaxRows(M),u.modules.page.setMaxPage(L),console.log("[TabulatorTable] After setMaxRows/setMaxPage:",{maxPage:(P=(E=u.modules)==null?void 0:E.page)==null?void 0:P.max}),u.redraw(!0)}catch(M){console.error("[TabulatorTable] Error setting pagination limits:",M)}this.isServerSidePagination&&t&&this.isNavigatingPages&&this.tabulator.setPage(t),this.isNavigatingPages||this.selectDefaultRow(),this.isNavigatingPages=!1,this.$nextTick(()=>{this.args.height?Hc.setFrameHeight(this.args.height):Hc.setFrameHeight()})})},downloadTable(){this.tabulator&&this.tabulator.download("csv",`${this.args.title||"table"}.csv`)},openFilterDialog(){this.canUseTeleport()&&this.openTeleportDialog()},toggleColumnSelection(t){const e=this.selectedColumns.indexOf(t);e>-1?(this.selectedColumns.splice(e,1),this.cleanupFilterForColumn(t)):(this.selectedColumns.push(t),this.$nextTick(()=>{this.initializeFilterValue(t)}))},analyzeColumn(t){if(this.columnAnalysis[t])return this.columnAnalysis[t];if(this.isServerSidePagination&&this.serverColumnMetadata[t]){const c=this.serverColumnMetadata[t],i={uniqueValues:(c.unique_values||[]).map(_=>typeof _=="string"||typeof _=="number"?_:String(_)),minValue:c.min,maxValue:c.max,dataType:c.type};return this.columnAnalysis[t]=i,this.filterTypes[t]=c.type,i}const e=(this.args.columnDefinitions||[]).find(c=>c.field===t),r=this.preparedTableData.map(c=>c[t]).filter(c=>c!=null&&c!==""),u=[...new Set(r)],R=e==null?void 0:e.sorter;let p,f,n;if(R==="number"){const c=r.filter(i=>typeof i=="number"||!isNaN(Number(i)));if(c.length>0){const i=c.map(_=>Number(_));f=Math.min(...i),n=Math.max(...i),p=u.length<=10?"categorical":"numeric"}else p="text"}else p=u.length<=50?"categorical":"text";const l={uniqueValues:u.slice(0,100).map(c=>typeof c=="string"||typeof c=="number"?c:String(c)),minValue:f,maxValue:n,dataType:p};return this.columnAnalysis[t]=l,this.filterTypes[t]=p,l},getFilterType(t){return this.filterTypes[t]||this.analyzeColumn(t),this.filterTypes[t]},getUniqueValues(t){return this.analyzeColumn(t).uniqueValues.map(r=>String(r)).sort()},getMinValue(t){return this.analyzeColumn(t).minValue??0},getMaxValue(t){return this.analyzeColumn(t).maxValue??100},initializeFilterValue(t){if(!this.filterValues[t]){const e=this.getFilterType(t),r={};switch(e){case"categorical":r.categorical=[];break;case"numeric":r.numeric={min:this.getMinValue(t),max:this.getMaxValue(t)};break;case"text":r.text="";break}this.filterValues[t]=r}},applyFilters(){var t;if(this.tabulator){if(this.isServerSidePagination){const e=[];this.selectedColumns.forEach(u=>{var f;const R=this.filterValues[u],p=this.filterTypes[u];if(R)switch(p){case"categorical":if((f=R.categorical)!=null&&f.length){const n=(this.args.columnDefinitions||[]).find(i=>i.field===u),c=(n==null?void 0:n.sorter)==="number"?R.categorical.map(i=>{const _=Number(i);return isNaN(_)?i:_}):R.categorical;e.push({field:u,type:"in",value:c})}break;case"numeric":R.numeric&&(e.push({field:u,type:">=",value:R.numeric.min}),e.push({field:u,type:"<=",value:R.numeric.max}));break;case"text":R.text&&e.push({field:u,type:"regex",value:R.text});break}}),this.currentColumnFilters=e;const r=this.args.paginationIdentifier;r&&this.selectionStore.updateSelection(r,{page:1,page_size:((t=this.paginationState)==null?void 0:t.page_size)||this.args.pageSize||100,sort_column:this.requestedSortColumn||void 0,sort_dir:this.requestedSortDir,column_filters:e});return}this.tabulator.clearFilter(!0),this.selectedColumns.forEach(e=>{var R,p,f,n,l;const r=this.filterValues[e],u=this.filterTypes[e];if(r)switch(u){case"categorical":if((R=r.categorical)!=null&&R.length){const c=(this.args.columnDefinitions||[]).find(b=>b.field===e),_=(c==null?void 0:c.sorter)==="number"?r.categorical.map(b=>{const w=Number(b);return isNaN(w)?b:w}):r.categorical;(p=this.tabulator)==null||p.addFilter(e,"in",_)}break;case"numeric":r.numeric&&((f=this.tabulator)==null||f.addFilter(e,">=",r.numeric.min),(n=this.tabulator)==null||n.addFilter(e,"<=",r.numeric.max));break;case"text":r.text&&((l=this.tabulator)==null||l.addFilter(e,"regex",r.text));break}})}},cleanupFilterForColumn(t){delete this.filterValues[t],delete this.filterTypes[t],delete this.columnAnalysis[t],this.applyFilters()},canUseTeleport(){try{return!!(window.parent&&window.parent.document&&window.parent!==window)}catch{return!1}},initializeTeleport(){this.canUseTeleport()&&(this.parentDocument=window.parent.document)},openTeleportDialog(){!this.parentDocument||this.teleportDialog||(this.teleportDialog=!0,this.createTeleportBackdrop(),this.createTeleportContainer(),this.renderFilterDialog())},createTeleportBackdrop(){this.parentDocument&&(this.teleportBackdrop=this.parentDocument.createElement("div"),this.teleportBackdrop.style.cssText=`
|
|
87
|
+
">${u}</span>`}const pP={scientific:_W,signed:wW,badge:TW};function kW(t){return t in pP}function SW(t){return pP[t]}let AW=0;const CW=wg({name:"TabulatorTable",props:{args:{type:Object,required:!0}},emits:["rowSelected"],setup(){const t=Cg(),e=zy(),r=`table-${Date.now()}-${++AW}`;return{streamlitDataStore:t,selectionStore:e,uniqueId:r}},data(){return{tabulator:void 0,selectedColumns:[],filterValues:{},filterTypes:{},columnAnalysis:{},teleportDialog:!1,teleportBackdrop:null,teleportContainer:null,parentDocument:null,showGoTo:!1,selectedGoToField:"",goToInputValue:"",pendingSelection:null,lastDataHash:"",skipNextSync:!1,pendingDataRequest:null,isLoadingServerData:!1,currentColumnFilters:[],isTableBuilt:!1,isNavigatingPages:!1,pendingTargetRowIndex:null,pendingPageNavigation:!1,initialLoadComplete:!1,lastRequestedPage:null,requestedSortColumn:"",requestedSortDir:"asc",pendingRequestCounter:null}},computed:{id(){return this.uniqueId},tableClasses(){var t,e;return{"table-dark":((t=this.streamlitDataStore.theme)==null?void 0:t.base)==="dark","table-light":((e=this.streamlitDataStore.theme)==null?void 0:e.base)==="light","table-bordered":!0,"table-sm":!0}},tableData(){var e;const t=(e=this.streamlitDataStore.allDataForDrawing)==null?void 0:e.tableData;return Array.isArray(t)?t:[]},columnNames(){return(this.args.columnDefinitions||[]).map(t=>({field:t.field||"",title:t.title||t.field||""})).filter(t=>t.field!=="")},activeFilterCount(){let t=0;for(const e of this.selectedColumns){const r=this.filterValues[e];if(!r)continue;const u=this.filterTypes[e];let R=!1;switch(u){case"categorical":R=!!(r.categorical&&r.categorical.length>0);break;case"numeric":if(r.numeric){const p=this.getMinValue(e),f=this.getMaxValue(e);R=r.numeric.min!==p||r.numeric.max!==f}break;case"text":R=!!(r.text&&r.text.trim()!=="");break}R&&t++}return t},preparedTableData(){const t=this.args.tableIndexField||"id",e=this.args.interactivity||{},r=Object.values(e),u=[...(this.args.columnDefinitions||[]).map(p=>p.field),t,...r],R=[...new Set(u)];if(this.tableData.length>0){const p=[];return this.tableData.forEach((f,n)=>{const l={};R.forEach(c=>{c!==void 0&&(l[c]=f[c])}),this.tableData[0][t]===void 0?p.push({...l,[t]:n}):p.push({...l})}),p}return this.tableData},currentDataHash(){return this.streamlitDataStore.hash||""},paginationState(){var e;const t=(e=this.streamlitDataStore.allDataForDrawing)==null?void 0:e._pagination;return console.log(`[TabulatorTable ${this.args.title}] paginationState COMPUTED:`,{page:t==null?void 0:t.page,totalRows:t==null?void 0:t.total_rows,hasState:!!t}),t},navigateToPage(){var e;const t=(e=this.streamlitDataStore.allDataForDrawing)==null?void 0:e._navigate_to_page;return typeof t=="number"?t:null},targetRowIndex(){var e;const t=(e=this.streamlitDataStore.allDataForDrawing)==null?void 0:e._target_row_index;return typeof t=="number"?t:null},isServerSidePagination(){return this.args.pagination!==!1&&!!this.args.paginationIdentifier},serverSortColumn(){var t;return((t=this.paginationState)==null?void 0:t.sort_column)||""},serverSortDir(){var t;return((t=this.paginationState)==null?void 0:t.sort_dir)||"asc"},serverColumnMetadata(){return this.args.columnMetadata||{}}},watch:{currentDataHash(t,e){var r;if(console.log(`[TabulatorTable ${this.args.title}] ===== currentDataHash WATCHER FIRED =====`,{timestamp:Date.now(),newHash:t==null?void 0:t.slice(0,8),oldHash:e==null?void 0:e.slice(0,8),lastDataHash:(r=this.lastDataHash)==null?void 0:r.slice(0,8),hasPendingRequest:!!this.pendingDataRequest,pendingTargetRowIndex:this.pendingTargetRowIndex}),t===this.lastDataHash){console.log(`[TabulatorTable ${this.args.title}] currentDataHash watcher: early return (hash unchanged)`);return}this.lastDataHash=t,this.clearInvalidSelections(),this.$nextTick(()=>{this.tabulator?this.updateTableData():this.drawTable()})},"args.height"(t){if(this.tabulator&&t){const e=t-56-(this.showGoTo?58:0);this.tabulator.setHeight(Math.max(e,50))}},selectedColumns:{handler(t){t.forEach(e=>{this.initializeFilterValue(e)})},immediate:!0},"selectionStore.$state":{handler(){this.syncSelectionFromStore()},deep:!0},navigateToPage(t){if(console.log(`[TabulatorTable ${this.args.title}] navigateToPage watcher:`,{newPage:t,targetRowIndex:this.targetRowIndex,isServerSidePagination:this.isServerSidePagination,hasTabulator:!!this.tabulator,isNavigatingPages:this.isNavigatingPages}),this.isNavigatingPages){console.log(`[TabulatorTable ${this.args.title}] navigateToPage: SKIPPING (Vue-initiated navigation in progress)`);return}t&&this.tabulator&&this.isServerSidePagination&&(this.pendingTargetRowIndex=this.targetRowIndex,this.pendingPageNavigation=!0,this.isNavigatingPages=!0,console.log(`[TabulatorTable ${this.args.title}] Set pendingTargetRowIndex:`,this.pendingTargetRowIndex),this.tabulator.setPage(t))},paginationState:{handler(t,e){var u;if(console.log(`[TabulatorTable ${this.args.title}] ===== paginationState WATCHER FIRED =====`,{timestamp:Date.now(),newPage:t==null?void 0:t.page,oldPage:e==null?void 0:e.page,newTotalRows:t==null?void 0:t.total_rows,pendingTargetRowIndex:this.pendingTargetRowIndex,hasPendingDataRequest:!!this.pendingDataRequest,pendingRequestCounter:this.pendingRequestCounter,isTableBuilt:this.isTableBuilt,isServerSidePagination:this.isServerSidePagination,preparedDataLength:this.preparedTableData.length,storeDataForDrawingKeys:Object.keys(this.streamlitDataStore.allDataForDrawing||{})}),!t||!this.isServerSidePagination||!this.tabulator){console.log(`[TabulatorTable ${this.args.title}] paginationState watcher: early return`);return}this.injectServerSideData(t);const r=this.tabulator;(u=r.modules)!=null&&u.page&&((e==null?void 0:e.total_rows)!==t.total_rows||(e==null?void 0:e.total_pages)!==t.total_pages)&&(console.log(`[TabulatorTable ${this.args.title}] paginationState watcher: updating pagination limits`,{oldTotalRows:e==null?void 0:e.total_rows,newTotalRows:t.total_rows,oldTotalPages:e==null?void 0:e.total_pages,newTotalPages:t.total_pages}),r.modules.page.setMaxRows(t.total_rows),r.modules.page.setMaxPage(t.total_pages),r.redraw(!0),r.setPage(t.page||1)),t.sort_column!==void 0&&(this.requestedSortColumn=t.sort_column||""),t.sort_dir!==void 0&&(this.requestedSortDir=t.sort_dir||"asc"),this.pendingTargetRowIndex!==null&&(console.log(`[TabulatorTable ${this.args.title}] paginationState watcher: scheduling selectPendingTargetRow`),this.$nextTick(()=>{this.selectPendingTargetRow()})),console.log(`[TabulatorTable ${this.args.title}] paginationState watcher: checking pendingDataRequest`,{hasPendingDataRequest:!!this.pendingDataRequest,pendingRequestCounter:this.pendingRequestCounter}),this.pendingDataRequest?this.resolveDataRequest():console.log(`[TabulatorTable ${this.args.title}] paginationState watcher: NO pendingDataRequest to resolve`),!this.initialLoadComplete&&this.isTableBuilt&&this.$nextTick(()=>{this.initialLoadComplete=!0,console.log(`[TabulatorTable ${this.args.title}] initialLoadComplete set to true`),this.selectDefaultRow()}),this.isLoadingServerData=!1},deep:!0}},mounted(){this.lastDataHash=this.currentDataHash,this.drawTable(),this.initializeTeleport(),this.initializeGoTo()},beforeUnmount(){this.cleanupTeleport()},methods:{drawTable(){var l;this.isTableBuilt=!1,this.initialLoadComplete=!1,this.tabulator&&(this.tabulator.destroy(),this.tabulator=void 0);const t=this.args.tableIndexField||"id",e=this.args.height,r=this.args.title?320:310,u=e?e-56:r,R=this.showGoTo?58:0,p=u-R,f={index:t,minHeight:150,maxHeight:Math.max(p,150),height:Math.max(p,150),responsiveLayout:"collapse",layout:this.args.tableLayoutParam||"fitDataFill",selectable:1,columnDefaults:{title:"",hozAlign:"right"},columns:(this.args.columnDefinitions||[]).map(c=>{const i={...c};if(i.headerTooltip===void 0&&(i.headerTooltip=!0),typeof i.formatter=="string"&&kW(i.formatter)){const _=SW(i.formatter);_&&(i.formatter=_)}return i}),initialSort:this.args.initialSort};if(this.args.pagination!==!1)f.pagination=!0,f.paginationSize=((l=this.paginationState)==null?void 0:l.page_size)||this.args.pageSize||100,f.paginationSizeSelector=[50,100,200,500,1e3],f.paginationCounter="rows",this.isServerSidePagination?(f.paginationMode="remote",f.sortMode="remote",f.filterMode="remote",f.ajaxURL="streamlit://data",f.ajaxRequestFunc=this.handleRemoteRequest.bind(this)):f.data=this.preparedTableData;else{f.data=this.preparedTableData;const c=this.preparedTableData.length>100;f.renderVertical=c?"virtual":"basic"}this.tabulator=new xW(`#${this.id}`,f),this.tabulator.on("dataLoadError",c=>{console.error(`[TabulatorTable ${this.args.title}] Data load error:`,c)}),this.tabulator.on("ajaxError",c=>{console.error(`[TabulatorTable ${this.args.title}] AJAX error:`,c)}),this.tabulator.on("tableBuilt",()=>{this.isTableBuilt=!0,this.injectServerSideData(),this.isServerSidePagination||this.selectDefaultRow(),this.applyFilters(),this.$nextTick(()=>{this.args.height?Hc.setFrameHeight(this.args.height):Hc.setFrameHeight(),setTimeout(()=>{if(this.tabulator){const c=this.tabulator.getSelectedRows();c.length>0?this.tabulator.scrollToRow(c[0],"center",!1):this.tabulator.scrollToRow(this.tabulator.getRows()[0],"top",!1)}},50)})}),this.tabulator.on("rowClick",(c,i)=>{this.onRowClick(i)}),this.tabulator.on("renderComplete",()=>{var i;(((i=this.tabulator)==null?void 0:i.getSelectedRows())||[]).length===0&&!this.skipNextSync&&this.syncSelectionFromStore()}),this.isServerSidePagination&&this.tabulator.on("dataSorting",c=>{var o,a,h;if(console.log(`[TabulatorTable ${this.args.title}] dataSorting event:`,c),!c||c.length===0)return;const i=c[0].field,_=c[0].dir,b=((o=this.paginationState)==null?void 0:o.sort_column)||"",w=((a=this.paginationState)==null?void 0:a.sort_dir)||"asc";if(i===b&&_===w){console.log(`[TabulatorTable ${this.args.title}] dataSorting: sort unchanged, skipping`);return}console.log(`[TabulatorTable ${this.args.title}] dataSorting: requesting sorted data`,{from:{col:b,dir:w},to:{col:i,dir:_}}),this.requestedSortColumn=i,this.requestedSortDir=_,this.isLoadingServerData=!0;const v=this.args.paginationIdentifier;v&&this.selectionStore.updateSelection(v,{page:1,page_size:((h=this.paginationState)==null?void 0:h.page_size)||this.args.pageSize||100,sort_column:i,sort_dir:_,column_filters:this.currentColumnFilters})})},handleRemoteRequest(t,e,r){var b,w,v,o,a,h,s,m;const u=r.page||1,R=r.size||this.args.pageSize||100;this.lastRequestedPage=u;const p=((w=(b=r.sorters)==null?void 0:b[0])==null?void 0:w.field)??(this.requestedSortColumn||void 0),f=((o=(v=r.sorters)==null?void 0:v[0])==null?void 0:o.dir)??this.requestedSortDir??"asc";console.log(`[TabulatorTable ${this.args.title}] ===== handleRemoteRequest START =====`,{timestamp:Date.now(),requestedPage:u,requestedSize:R,requestedSortColumn:p,requestedSortDir:f,rawSorters:r.sorters,paginationIdentifier:this.args.paginationIdentifier,currentPaginationState:this.paginationState,cachedSortColumn:(a=this.paginationState)==null?void 0:a.sort_column,cachedSortDir:(h=this.paginationState)==null?void 0:h.sort_dir,hasPendingRequest:!!this.pendingDataRequest});const n=((s=this.paginationState)==null?void 0:s.sort_column)||"",l=((m=this.paginationState)==null?void 0:m.sort_dir)||"asc",c=p||"",i=n===c&&l===f;if(console.log(`[TabulatorTable ${this.args.title}] handleRemoteRequest: SORT CHECK v2`,{cachedSortCol:n,cachedSortDir:l,requestedSortCol:c,requestedSortDir:f,sortMatch:i}),this.paginationState&&this.paginationState.page===u&&this.paginationState.page_size===R&&i&&this.tableData.length>0){console.log(`[TabulatorTable ${this.args.title}] handleRemoteRequest: using cached data (page=${u}, sortCol=${n})`);const y=this.args.paginationIdentifier;y&&this.selectionStore.updateSelection(y,{page:u,page_size:R,sort_column:p,sort_dir:f,column_filters:this.currentColumnFilters});const x={last_page:this.paginationState.total_pages,last_row:this.paginationState.total_rows,data:this.preparedTableData};return new Promise(S=>{setTimeout(()=>S(x),0)})}this.isLoadingServerData=!0,this.isNavigatingPages=!0;const _=this.args.paginationIdentifier;return _&&(console.log(`[TabulatorTable ${this.args.title}] handleRemoteRequest: requesting page ${u} via selectionStore`),this.selectionStore.updateSelection(_,{page:u,page_size:R,sort_column:p,sort_dir:f,column_filters:this.currentColumnFilters})),this.pendingRequestCounter=this.selectionStore.$state.pagination_counter||0,console.log(`[TabulatorTable ${this.args.title}] handleRemoteRequest: STORED pendingRequestCounter`,{pendingRequestCounter:this.pendingRequestCounter,selectionStorePaginationCounter:this.selectionStore.$state.pagination_counter}),new Promise((y,x)=>{this.pendingDataRequest={resolve:y,reject:x},console.log(`[TabulatorTable ${this.args.title}] handleRemoteRequest: pendingDataRequest SET`,{timestamp:Date.now(),requestCounter:this.pendingRequestCounter}),setTimeout(()=>{this.pendingDataRequest&&(console.warn(`[TabulatorTable ${this.args.title}] Request timeout`),this.pendingDataRequest=null,this.pendingRequestCounter=null,this.isLoadingServerData=!1,x(new Error("Request timeout")))},3e4)})},resolveDataRequest(){var u;const t=this.selectionStore.$state;if(console.log(`[TabulatorTable ${this.args.title}] ===== resolveDataRequest CALLED =====`,{timestamp:Date.now(),hasPendingRequest:!!this.pendingDataRequest,pendingRequestCounter:this.pendingRequestCounter,paginationStatePage:(u=this.paginationState)==null?void 0:u.page,preparedDataLength:this.preparedTableData.length,selectionStorePaginationCounter:t.pagination_counter,selectionStoreCounter:t.counter}),!this.pendingDataRequest||!this.paginationState){console.log(`[TabulatorTable ${this.args.title}] resolveDataRequest: EARLY RETURN (missing data)`,{hasPendingRequest:!!this.pendingDataRequest,hasPaginationState:!!this.paginationState});return}const e=this.selectionStore.$state.pagination_counter||0,r=this.pendingRequestCounter!==null&&e>this.pendingRequestCounter+1;if(console.log(`[TabulatorTable ${this.args.title}] resolveDataRequest: STALE CHECK`,{pendingRequestCounter:this.pendingRequestCounter,currentCounter:e,threshold:this.pendingRequestCounter!==null?this.pendingRequestCounter+1:"N/A",isStale:r}),r){console.log(`[TabulatorTable ${this.args.title}] resolveDataRequest: STALE RESPONSE DETECTED, rejecting promise`),this.pendingDataRequest.reject(new Error("Stale response - newer request pending")),this.pendingDataRequest=null,this.pendingRequestCounter=null,this.isLoadingServerData=!1;return}console.log(`[TabulatorTable ${this.args.title}] resolveDataRequest: RESOLVING PROMISE`,{lastPage:this.paginationState.total_pages,lastRow:this.paginationState.total_rows,dataLength:this.preparedTableData.length}),this.pendingDataRequest.resolve({last_page:this.paginationState.total_pages,last_row:this.paginationState.total_rows,data:this.preparedTableData}),this.pendingDataRequest=null,this.pendingRequestCounter=null,this.isLoadingServerData=!1,console.log(`[TabulatorTable ${this.args.title}] resolveDataRequest: PROMISE RESOLVED`)},injectServerSideData(t){var f,n;const e=t??this.paginationState;if(console.log(`[TabulatorTable ${this.args.title}] ===== injectServerSideData CALLED =====`,{timestamp:Date.now(),hasPaginationState:!!e,paginationPage:e==null?void 0:e.page,isTableBuilt:this.isTableBuilt,hasPendingRequest:!!this.pendingDataRequest,pendingPageNavigation:this.pendingPageNavigation,tabulatorRows:(f=this.tabulator)==null?void 0:f.getRows().length,preparedDataLength:this.preparedTableData.length,isServerSidePagination:this.isServerSidePagination}),!this.tabulator||!this.isServerSidePagination||!e||!this.isTableBuilt){console.log(`[TabulatorTable ${this.args.title}] injectServerSideData: early return (preconditions)`);return}const r=!!this.pendingDataRequest,u=this.tabulator.getRows().length;if(r){console.log(`[TabulatorTable ${this.args.title}] injectServerSideData: skipping (AJAX pending)`);return}if(!(this.pendingPageNavigation&&this.preparedTableData.length>0)&&(u>0||this.preparedTableData.length===0)){console.log(`[TabulatorTable ${this.args.title}] injectServerSideData: early return (has data/no request)`);return}this.pendingPageNavigation&&(this.pendingPageNavigation=!1),console.log(`[TabulatorTable ${this.args.title}] injectServerSideData: injecting data`);const p=this.tabulator;p.rowManager.setData(this.preparedTableData,!1,!1),(n=p.modules)!=null&&n.page&&(p.modules.page.setMaxRows(e.total_rows),p.modules.page.setMaxPage(e.total_pages)),p.redraw(!0),p.clearAlert&&p.clearAlert()},selectPendingTargetRow(){var r;const t=this.pendingTargetRowIndex;if(this.pendingTargetRowIndex=null,console.log(`[TabulatorTable ${this.args.title}] selectPendingTargetRow:`,{targetIndex:t,hasTabulator:!!this.tabulator,activeRowCount:(r=this.tabulator)==null?void 0:r.getRows("active").length}),t===null||!this.tabulator){console.log(`[TabulatorTable ${this.args.title}] selectPendingTargetRow: early return`);return}const e=this.tabulator.getRows("active");console.log(`[TabulatorTable ${this.args.title}] selectPendingTargetRow: rows[${t}] exists:`,!!(e!=null&&e[t])),e&&e[t]&&(this.tabulator.deselectRow(),e[t].select(),e[t].scrollTo("center",!1),console.log(`[TabulatorTable ${this.args.title}] selectPendingTargetRow: SUCCESS - selected row ${t}`))},syncSelectionFromStore(){if(this.skipNextSync||!this.tabulator)return;const t=this.args.interactivity||{};if(this.isServerSidePagination){for(const[e,r]of Object.entries(t)){const u=this.selectionStore.$state[e];if(u!=null){const R=this.tabulator.getSelectedRows()[0];if(R&&R.getData()[r]===u)return;const p=this.preparedTableData.findIndex(f=>f[r]===u);if(p>=0){const f=this.args.tableIndexField||"id",n=this.preparedTableData[p][f],l=this.tabulator.getRow(n);l&&(this.tabulator.deselectRow(),l.select(),l.scrollTo("center",!1))}else this.pendingSelection={[e]:u};break}}return}for(const[e,r]of Object.entries(t)){const u=this.selectionStore.$state[e];if(u!=null){const R=this.tabulator.getSelectedRows()[0];if(R&&R.getData()[r]===u){this.pendingSelection=null;return}const p=this.preparedTableData.findIndex(f=>f[r]===u);if(p>=0){const f=this.args.tableIndexField||"id",n=this.preparedTableData[p][f],l=this.tabulator.getRow(n);l?(this.tabulator.deselectRow(),l.select(),this.tabulator.options.pagination?this.tabulator.setPageToRow(n).then(()=>{l.scrollTo("center",!1)}):l.scrollTo("center",!1),this.pendingSelection=null):this.pendingSelection={[e]:u}}else this.pendingSelection={[e]:u};break}}},selectDefaultRow(){var r,u,R,p,f;if(this.isServerSidePagination&&!this.initialLoadComplete){console.log(`[TabulatorTable ${this.args.title}] selectDefaultRow: SKIPPED (initial load not complete)`);return}if(this.isServerSidePagination&&this.isNavigatingPages){const n=(r=this.paginationState)==null?void 0:r.page,l=this.lastRequestedPage;if(n===l)return}const t=this.args.interactivity||{};let e=!1;if(this.pendingSelection)for(const[n,l]of Object.entries(this.pendingSelection)){const c=t[n];if(c&&l!==void 0&&l!==null){const i=this.preparedTableData.findIndex(_=>_[c]===l);if(i>=0){const _=this.args.tableIndexField||"id",b=this.preparedTableData[i][_],v=(((u=this.tabulator)==null?void 0:u.getRows())||[]).find(o=>o.getData()[_]===b);if(v){v.select(),(R=this.tabulator)!=null&&R.options.pagination?this.tabulator.setPageToRow(b).then(()=>{v.scrollTo("center",!1)}):v.scrollTo("center",!1),e=!0,this.pendingSelection=null;break}}}}if(!e)for(const[n,l]of Object.entries(t)){const c=this.selectionStore.$state[n];if(c!=null){const i=this.preparedTableData.findIndex(_=>_[l]===c);if(i>=0){const _=this.args.tableIndexField||"id",b=this.preparedTableData[i][_],v=(((p=this.tabulator)==null?void 0:p.getRows())||[]).find(o=>o.getData()[_]===b);if(v){v.select(),(f=this.tabulator)!=null&&f.options.pagination?this.tabulator.setPageToRow(b).then(()=>{v.scrollTo("center",!1)}):v.scrollTo("center",!1),e=!0;break}}e=!0;break}}if(!e&&!this.isServerSidePagination){const n=this.args.defaultRow??0;n>=0&&setTimeout(()=>{var c;const l=(c=this.tabulator)==null?void 0:c.getRows("active");if(l&&l.length>0&&n<l.length){const i=l[n];i.select();const _=i.getData();if(_){const b=this.args.interactivity||{};for(const[w,v]of Object.entries(b)){const o=_[v];this.selectionStore.updateSelection(w,o)}}}},0)}},clearInvalidSelections(){if(this.isServerSidePagination)return;const t=this.args.interactivity||{};for(const[e,r]of Object.entries(t)){const u=this.selectionStore.$state[e];if(u==null)continue;this.preparedTableData.findIndex(p=>p[r]===u)<0&&(this.selectionStore.updateSelection(e,null),this.pendingSelection&&e in this.pendingSelection&&(delete this.pendingSelection[e],Object.keys(this.pendingSelection).length===0&&(this.pendingSelection=null)))}},onRowClick(t){var R;const e=t.getData(),r=t.getIndex();(R=this.tabulator)==null||R.deselectRow(),t.select(),this.$emit("rowSelected",r),this.skipNextSync=!0;const u=this.args.interactivity||{};if(e)for(const[p,f]of Object.entries(u)){const n=e[f];this.selectionStore.updateSelection(p,n)}this.$nextTick(()=>{this.skipNextSync=!1})},updateTableData(){var R,p,f,n,l,c,i,_,b,w,v,o,a;if(console.log("[TabulatorTable] updateTableData called",{hasTabulator:!!this.tabulator,isServerSidePagination:this.isServerSidePagination,paginationState:this.paginationState,isNavigatingPages:this.isNavigatingPages,dataLength:(R=this.preparedTableData)==null?void 0:R.length}),!this.tabulator){this.drawTable();return}const t=(p=this.paginationState)==null?void 0:p.page,e=(f=this.paginationState)==null?void 0:f.total_rows,r=(n=this.paginationState)==null?void 0:n.total_pages,u=this.tabulator;console.log("[TabulatorTable] Before replaceData - Tabulator internal state:",{hasPageModule:!!((l=u.modules)!=null&&l.page),maxPage:(i=(c=u.modules)==null?void 0:c.page)==null?void 0:i.max,lastPage:(b=(_=u.modules)==null?void 0:_.page)==null?void 0:b.lastPage,currentPage:(v=(w=u.modules)==null?void 0:w.page)==null?void 0:v.page,size:(a=(o=u.modules)==null?void 0:o.page)==null?void 0:a.size}),this.tabulator.replaceData(this.preparedTableData).then(()=>{var h,s,m,y,x,S,C,A,E,P;if(console.log("[TabulatorTable] After replaceData - Tabulator internal state:",{hasPageModule:!!((h=u.modules)!=null&&h.page),maxPage:(m=(s=u.modules)==null?void 0:s.page)==null?void 0:m.max,lastPage:(x=(y=u.modules)==null?void 0:y.page)==null?void 0:x.lastPage,currentPage:(C=(S=u.modules)==null?void 0:S.page)==null?void 0:C.page}),this.pendingPageNavigation&&this.tabulator.clearAlert&&(this.tabulator.clearAlert(),this.pendingPageNavigation=!1,this.$nextTick(()=>{this.selectPendingTargetRow()})),this.isNavigatingPages||this.applyFilters(),this.isServerSidePagination&&e!==void 0&&r!==void 0&&(A=u.modules)!=null&&A.page)try{const M=Number(e),L=Number(r);console.log("[TabulatorTable] Calling setMaxRows and setMaxPage",{totalRows:M,totalPages:L}),u.modules.page.setMaxRows(M),u.modules.page.setMaxPage(L),console.log("[TabulatorTable] After setMaxRows/setMaxPage:",{maxPage:(P=(E=u.modules)==null?void 0:E.page)==null?void 0:P.max}),u.redraw(!0),u.setPage(t||u.getPage()||1)}catch(M){console.error("[TabulatorTable] Error setting pagination limits:",M)}this.isServerSidePagination&&t&&this.isNavigatingPages&&this.tabulator.setPage(t),this.isNavigatingPages||this.selectDefaultRow(),this.isNavigatingPages=!1,this.$nextTick(()=>{this.args.height?Hc.setFrameHeight(this.args.height):Hc.setFrameHeight()})})},downloadTable(){this.tabulator&&this.tabulator.download("csv",`${this.args.title||"table"}.csv`)},openFilterDialog(){this.canUseTeleport()&&this.openTeleportDialog()},toggleColumnSelection(t){const e=this.selectedColumns.indexOf(t);e>-1?(this.selectedColumns.splice(e,1),this.cleanupFilterForColumn(t)):(this.selectedColumns.push(t),this.$nextTick(()=>{this.initializeFilterValue(t)}))},analyzeColumn(t){if(this.columnAnalysis[t])return this.columnAnalysis[t];if(this.isServerSidePagination&&this.serverColumnMetadata[t]){const c=this.serverColumnMetadata[t],i={uniqueValues:(c.unique_values||[]).map(_=>typeof _=="string"||typeof _=="number"?_:String(_)),minValue:c.min,maxValue:c.max,dataType:c.type};return this.columnAnalysis[t]=i,this.filterTypes[t]=c.type,i}const e=(this.args.columnDefinitions||[]).find(c=>c.field===t),r=this.preparedTableData.map(c=>c[t]).filter(c=>c!=null&&c!==""),u=[...new Set(r)],R=e==null?void 0:e.sorter;let p,f,n;if(R==="number"){const c=r.filter(i=>typeof i=="number"||!isNaN(Number(i)));if(c.length>0){const i=c.map(_=>Number(_));f=Math.min(...i),n=Math.max(...i),p=u.length<=10?"categorical":"numeric"}else p="text"}else p=u.length<=50?"categorical":"text";const l={uniqueValues:u.slice(0,100).map(c=>typeof c=="string"||typeof c=="number"?c:String(c)),minValue:f,maxValue:n,dataType:p};return this.columnAnalysis[t]=l,this.filterTypes[t]=p,l},getFilterType(t){return this.filterTypes[t]||this.analyzeColumn(t),this.filterTypes[t]},getUniqueValues(t){return this.analyzeColumn(t).uniqueValues.map(r=>String(r)).sort()},getMinValue(t){return this.analyzeColumn(t).minValue??0},getMaxValue(t){return this.analyzeColumn(t).maxValue??100},initializeFilterValue(t){if(!this.filterValues[t]){const e=this.getFilterType(t),r={};switch(e){case"categorical":r.categorical=[];break;case"numeric":r.numeric={min:this.getMinValue(t),max:this.getMaxValue(t)};break;case"text":r.text="";break}this.filterValues[t]=r}},applyFilters(){var t;if(this.tabulator){if(this.isServerSidePagination){const e=[];this.selectedColumns.forEach(u=>{var f;const R=this.filterValues[u],p=this.filterTypes[u];if(R)switch(p){case"categorical":if((f=R.categorical)!=null&&f.length){const n=(this.args.columnDefinitions||[]).find(i=>i.field===u),c=(n==null?void 0:n.sorter)==="number"?R.categorical.map(i=>{const _=Number(i);return isNaN(_)?i:_}):R.categorical;e.push({field:u,type:"in",value:c})}break;case"numeric":R.numeric&&(e.push({field:u,type:">=",value:R.numeric.min}),e.push({field:u,type:"<=",value:R.numeric.max}));break;case"text":R.text&&e.push({field:u,type:"regex",value:R.text});break}}),this.currentColumnFilters=e;const r=this.args.paginationIdentifier;r&&this.selectionStore.updateSelection(r,{page:1,page_size:((t=this.paginationState)==null?void 0:t.page_size)||this.args.pageSize||100,sort_column:this.requestedSortColumn||void 0,sort_dir:this.requestedSortDir,column_filters:e});return}this.tabulator.clearFilter(!0),this.selectedColumns.forEach(e=>{var R,p,f,n,l;const r=this.filterValues[e],u=this.filterTypes[e];if(r)switch(u){case"categorical":if((R=r.categorical)!=null&&R.length){const c=(this.args.columnDefinitions||[]).find(b=>b.field===e),_=(c==null?void 0:c.sorter)==="number"?r.categorical.map(b=>{const w=Number(b);return isNaN(w)?b:w}):r.categorical;(p=this.tabulator)==null||p.addFilter(e,"in",_)}break;case"numeric":r.numeric&&((f=this.tabulator)==null||f.addFilter(e,">=",r.numeric.min),(n=this.tabulator)==null||n.addFilter(e,"<=",r.numeric.max));break;case"text":r.text&&((l=this.tabulator)==null||l.addFilter(e,"regex",r.text));break}})}},cleanupFilterForColumn(t){delete this.filterValues[t],delete this.filterTypes[t],delete this.columnAnalysis[t],this.applyFilters()},canUseTeleport(){try{return!!(window.parent&&window.parent.document&&window.parent!==window)}catch{return!1}},initializeTeleport(){this.canUseTeleport()&&(this.parentDocument=window.parent.document)},openTeleportDialog(){!this.parentDocument||this.teleportDialog||(this.teleportDialog=!0,this.createTeleportBackdrop(),this.createTeleportContainer(),this.renderFilterDialog())},createTeleportBackdrop(){this.parentDocument&&(this.teleportBackdrop=this.parentDocument.createElement("div"),this.teleportBackdrop.style.cssText=`
|
|
88
88
|
position: fixed;
|
|
89
89
|
top: 0;
|
|
90
90
|
left: 0;
|
|
@@ -4210,7 +4210,7 @@ uniform ${Re} ${je} u_${tt};
|
|
|
4210
4210
|
#endif
|
|
4211
4211
|
`}),staticAttributes:z,staticUniforms:ie}}class Yr{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(d,g,z,j,$,ie,de,xe,Ae){this.context=d;let Re=this.boundPaintVertexBuffers.length!==j.length;for(let je=0;!Re&&je<j.length;je++)this.boundPaintVertexBuffers[je]!==j[je]&&(Re=!0);!this.vao||this.boundProgram!==g||this.boundLayoutVertexBuffer!==z||Re||this.boundIndexBuffer!==$||this.boundVertexOffset!==ie||this.boundDynamicVertexBuffer!==de||this.boundDynamicVertexBuffer2!==xe||this.boundDynamicVertexBuffer3!==Ae?this.freshBind(g,z,j,$,ie,de,xe,Ae):(d.bindVertexArray.set(this.vao),de&&de.bind(),$&&$.dynamicDraw&&$.bind(),xe&&xe.bind(),Ae&&Ae.bind())}freshBind(d,g,z,j,$,ie,de,xe){const Ae=d.numAttributes,Re=this.context,je=Re.gl;this.vao&&this.destroy(),this.vao=Re.createVertexArray(),Re.bindVertexArray.set(this.vao),this.boundProgram=d,this.boundLayoutVertexBuffer=g,this.boundPaintVertexBuffers=z,this.boundIndexBuffer=j,this.boundVertexOffset=$,this.boundDynamicVertexBuffer=ie,this.boundDynamicVertexBuffer2=de,this.boundDynamicVertexBuffer3=xe,g.enableAttributes(je,d);for(const tt of z)tt.enableAttributes(je,d);ie&&ie.enableAttributes(je,d),de&&de.enableAttributes(je,d),xe&&xe.enableAttributes(je,d),g.bind(),g.setVertexAttribPointers(je,d,$);for(const tt of z)tt.bind(),tt.setVertexAttribPointers(je,d,$);ie&&(ie.bind(),ie.setVertexAttribPointers(je,d,$)),j&&j.bind(),de&&(de.bind(),de.setVertexAttribPointers(je,d,$)),xe&&(xe.bind(),xe.setVertexAttribPointers(je,d,$)),Re.currentNumAttributes=Ae}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const _n=(V,d,g,z,j)=>({u_matrix:V,u_texture:0,u_ele_delta:d,u_fog_matrix:g,u_fog_color:z?z.properties.get("fog-color"):i.aN.white,u_fog_ground_blend:z?z.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:z?z.calculateFogBlendOpacity(j):0,u_horizon_color:z?z.properties.get("horizon-color"):i.aN.white,u_horizon_fog_blend:z?z.properties.get("horizon-fog-blend"):1});function Sn(V){const d=[];for(let g=0;g<V.length;g++){if(V[g]===null)continue;const z=V[g].split(" ");d.push(z.pop())}return d}class or{constructor(d,g,z,j,$,ie){const de=d.gl;this.program=de.createProgram();const xe=Sn(g.staticAttributes),Ae=z?z.getBinderAttributes():[],Re=xe.concat(Ae),je=Ir.prelude.staticUniforms?Sn(Ir.prelude.staticUniforms):[],tt=g.staticUniforms?Sn(g.staticUniforms):[],lt=z?z.getBinderUniforms():[],ft=je.concat(tt).concat(lt),yt=[];for(const Yt of ft)yt.indexOf(Yt)<0&&yt.push(Yt);const Ct=z?z.defines():[];$&&Ct.push("#define OVERDRAW_INSPECTOR;"),ie&&Ct.push("#define TERRAIN3D;");const kt=Ct.concat(Ir.prelude.fragmentSource,g.fragmentSource).join(`
|
|
4212
4212
|
`),Bt=Ct.concat(Ir.prelude.vertexSource,g.vertexSource).join(`
|
|
4213
|
-
`),At=de.createShader(de.FRAGMENT_SHADER);if(de.isContextLost())return void(this.failedToCreate=!0);if(de.shaderSource(At,kt),de.compileShader(At),!de.getShaderParameter(At,de.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${de.getShaderInfoLog(At)}`);de.attachShader(this.program,At);const $t=de.createShader(de.VERTEX_SHADER);if(de.isContextLost())return void(this.failedToCreate=!0);if(de.shaderSource($t,Bt),de.compileShader($t),!de.getShaderParameter($t,de.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${de.getShaderInfoLog($t)}`);de.attachShader(this.program,$t),this.attributes={};const Kt={};this.numAttributes=Re.length;for(let Yt=0;Yt<this.numAttributes;Yt++)Re[Yt]&&(de.bindAttribLocation(this.program,Yt,Re[Yt]),this.attributes[Re[Yt]]=Yt);if(de.linkProgram(this.program),!de.getProgramParameter(this.program,de.LINK_STATUS))throw new Error(`Program failed to link: ${de.getProgramInfoLog(this.program)}`);de.deleteShader($t),de.deleteShader(At);for(let Yt=0;Yt<yt.length;Yt++){const pn=yt[Yt];if(pn&&!Kt[pn]){const Tn=de.getUniformLocation(this.program,pn);Tn&&(Kt[pn]=Tn)}}this.fixedUniforms=j(d,Kt),this.terrainUniforms=((Yt,pn)=>({u_depth:new i.aI(Yt,pn.u_depth),u_terrain:new i.aI(Yt,pn.u_terrain),u_terrain_dim:new i.aJ(Yt,pn.u_terrain_dim),u_terrain_matrix:new i.aK(Yt,pn.u_terrain_matrix),u_terrain_unpack:new i.aL(Yt,pn.u_terrain_unpack),u_terrain_exaggeration:new i.aJ(Yt,pn.u_terrain_exaggeration)}))(d,Kt),this.binderUniforms=z?z.getUniforms(d,Kt):[]}draw(d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt,ft,yt,Ct,kt,Bt){const At=d.gl;if(this.failedToCreate)return;if(d.program.set(this.program),d.setDepthMode(z),d.setStencilMode(j),d.setColorMode($),d.setCullFace(ie),xe){d.activeTexture.set(At.TEXTURE2),At.bindTexture(At.TEXTURE_2D,xe.depthTexture),d.activeTexture.set(At.TEXTURE3),At.bindTexture(At.TEXTURE_2D,xe.texture);for(const Kt in this.terrainUniforms)this.terrainUniforms[Kt].set(xe[Kt])}for(const Kt in this.fixedUniforms)this.fixedUniforms[Kt].set(de[Kt]);yt&&yt.setUniforms(d,this.binderUniforms,lt,{zoom:ft});let $t=0;switch(g){case At.LINES:$t=2;break;case At.TRIANGLES:$t=3;break;case At.LINE_STRIP:$t=1}for(const Kt of tt.get()){const Yt=Kt.vaos||(Kt.vaos={});(Yt[Ae]||(Yt[Ae]=new Yr)).bind(d,this,Re,yt?yt.getPaintVertexBuffers():[],je,Kt.vertexOffset,Ct,kt,Bt),At.drawElements(g,Kt.primitiveLength*$t,At.UNSIGNED_SHORT,Kt.primitiveOffset*$t*2)}}}function qn(V,d,g){const z=1/Tt(g,1,d.transform.tileZoom),j=Math.pow(2,g.tileID.overscaledZ),$=g.tileSize*Math.pow(2,d.transform.tileZoom)/j,ie=$*(g.tileID.canonical.x+g.tileID.wrap*j),de=$*g.tileID.canonical.y;return{u_image:0,u_texsize:g.imageAtlasTexture.size,u_scale:[z,V.fromScale,V.toScale],u_fade:V.t,u_pixel_coord_upper:[ie>>16,de>>16],u_pixel_coord_lower:[65535&ie,65535&de]}}const sr=(V,d,g,z)=>{const j=d.style.light,$=j.properties.get("position"),ie=[$.x,$.y,$.z],de=function(){var Ae=new i.A(9);return i.A!=Float32Array&&(Ae[1]=0,Ae[2]=0,Ae[3]=0,Ae[5]=0,Ae[6]=0,Ae[7]=0),Ae[0]=1,Ae[4]=1,Ae[8]=1,Ae}();j.properties.get("anchor")==="viewport"&&function(Ae,Re){var je=Math.sin(Re),tt=Math.cos(Re);Ae[0]=tt,Ae[1]=je,Ae[2]=0,Ae[3]=-je,Ae[4]=tt,Ae[5]=0,Ae[6]=0,Ae[7]=0,Ae[8]=1}(de,-d.transform.angle),function(Ae,Re,je){var tt=Re[0],lt=Re[1],ft=Re[2];Ae[0]=tt*je[0]+lt*je[3]+ft*je[6],Ae[1]=tt*je[1]+lt*je[4]+ft*je[7],Ae[2]=tt*je[2]+lt*je[5]+ft*je[8]}(ie,ie,de);const xe=j.properties.get("color");return{u_matrix:V,u_lightpos:ie,u_lightintensity:j.properties.get("intensity"),u_lightcolor:[xe.r,xe.g,xe.b],u_vertical_gradient:+g,u_opacity:z}},Sr=(V,d,g,z,j,$,ie)=>i.e(sr(V,d,g,z),qn($,d,ie),{u_height_factor:-Math.pow(2,j.overscaledZ)/ie.tileSize/8}),wr=V=>({u_matrix:V}),Ur=(V,d,g,z)=>i.e(wr(V),qn(g,d,z)),ti=(V,d)=>({u_matrix:V,u_world:d}),vn=(V,d,g,z,j)=>i.e(Ur(V,d,g,z),{u_world:j}),Gn=(V,d,g,z)=>{const j=V.transform;let $,ie;if(z.paint.get("circle-pitch-alignment")==="map"){const de=Tt(g,1,j.zoom);$=!0,ie=[de,de]}else $=!1,ie=j.pixelsToGLUnits;return{u_camera_to_center_distance:j.cameraToCenterDistance,u_scale_with_map:+(z.paint.get("circle-pitch-scale")==="map"),u_matrix:V.translatePosMatrix(d.posMatrix,g,z.paint.get("circle-translate"),z.paint.get("circle-translate-anchor")),u_pitch_with_map:+$,u_device_pixel_ratio:V.pixelRatio,u_extrude_scale:ie}},nn=(V,d)=>({u_matrix:d,u_pixel_extrude_scale:[1/V.width,1/V.height]}),ln=(V,d,g)=>({u_matrix:V,u_inv_matrix:d,u_camera_to_center_distance:g.cameraToCenterDistance,u_viewport_size:[g.width,g.height]}),bn=(V,d,g=1)=>({u_matrix:V,u_color:d,u_overlay:0,u_overlay_scale:g}),Fn=V=>({u_matrix:V}),Bn=(V,d,g,z)=>({u_matrix:V,u_extrude_scale:Tt(d,1,g),u_intensity:z}),Kn=(V,d,g,z)=>{const j=i.H();i.aQ(j,0,V.width,V.height,0,0,1);const $=V.context.gl;return{u_matrix:j,u_world:[$.drawingBufferWidth,$.drawingBufferHeight],u_image:g,u_color_ramp:z,u_opacity:d.paint.get("heatmap-opacity")}},Hn=(V,d,g,z)=>{const j=g.paint.get("hillshade-shadow-color"),$=g.paint.get("hillshade-highlight-color"),ie=g.paint.get("hillshade-accent-color");let de=g.paint.get("hillshade-illumination-direction")*(Math.PI/180);g.paint.get("hillshade-illumination-anchor")==="viewport"&&(de-=V.transform.angle);const xe=!V.options.moving;return{u_matrix:z?z.posMatrix:V.transform.calculatePosMatrix(d.tileID.toUnwrapped(),xe),u_image:0,u_latrange:hn(0,d.tileID),u_light:[g.paint.get("hillshade-exaggeration"),de],u_shadow:j,u_highlight:$,u_accent:ie}},Dn=(V,d)=>{const g=d.stride,z=i.H();return i.aQ(z,0,i.X,-i.X,0,0,1),i.J(z,z,[0,-i.X,0]),{u_matrix:z,u_image:1,u_dimension:[g,g],u_zoom:V.overscaledZ,u_unpack:d.getUnpackVector()}};function hn(V,d){const g=Math.pow(2,d.canonical.z),z=d.canonical.y;return[new i.Z(0,z/g).toLngLat().lat,new i.Z(0,(z+1)/g).toLngLat().lat]}const cn=(V,d,g,z)=>{const j=V.transform;return{u_matrix:yr(V,d,g,z),u_ratio:1/Tt(d,1,j.zoom),u_device_pixel_ratio:V.pixelRatio,u_units_to_pixels:[1/j.pixelsToGLUnits[0],1/j.pixelsToGLUnits[1]]}},En=(V,d,g,z,j)=>i.e(cn(V,d,g,j),{u_image:0,u_image_height:z}),tr=(V,d,g,z,j)=>{const $=V.transform,ie=fr(d,$);return{u_matrix:yr(V,d,g,j),u_texsize:d.imageAtlasTexture.size,u_ratio:1/Tt(d,1,$.zoom),u_device_pixel_ratio:V.pixelRatio,u_image:0,u_scale:[ie,z.fromScale,z.toScale],u_fade:z.t,u_units_to_pixels:[1/$.pixelsToGLUnits[0],1/$.pixelsToGLUnits[1]]}},dr=(V,d,g,z,j,$)=>{const ie=V.transform,de=V.lineAtlas,xe=fr(d,ie),Ae=g.layout.get("line-cap")==="round",Re=de.getDash(z.from,Ae),je=de.getDash(z.to,Ae),tt=Re.width*j.fromScale,lt=je.width*j.toScale;return i.e(cn(V,d,g,$),{u_patternscale_a:[xe/tt,-Re.height/2],u_patternscale_b:[xe/lt,-je.height/2],u_sdfgamma:de.width/(256*Math.min(tt,lt)*V.pixelRatio)/2,u_image:0,u_tex_y_a:Re.y,u_tex_y_b:je.y,u_mix:j.t})};function fr(V,d){return 1/Tt(V,1,d.tileZoom)}function yr(V,d,g,z){return V.translatePosMatrix(z?z.posMatrix:d.tileID.posMatrix,d,g.paint.get("line-translate"),g.paint.get("line-translate-anchor"))}const Or=(V,d,g,z,j)=>{return{u_matrix:V,u_tl_parent:d,u_scale_parent:g,u_buffer_scale:1,u_fade_t:z.mix,u_opacity:z.opacity*j.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:j.paint.get("raster-brightness-min"),u_brightness_high:j.paint.get("raster-brightness-max"),u_saturation_factor:(ie=j.paint.get("raster-saturation"),ie>0?1-1/(1.001-ie):-ie),u_contrast_factor:($=j.paint.get("raster-contrast"),$>0?1/(1-$):1+$),u_spin_weights:Er(j.paint.get("raster-hue-rotate"))};var $,ie};function Er(V){V*=Math.PI/180;const d=Math.sin(V),g=Math.cos(V);return[(2*g+1)/3,(-Math.sqrt(3)*d-g+1)/3,(Math.sqrt(3)*d-g+1)/3]}const Br=(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt)=>{const ft=ie.transform;return{u_is_size_zoom_constant:+(V==="constant"||V==="source"),u_is_size_feature_constant:+(V==="constant"||V==="camera"),u_size_t:d?d.uSizeT:0,u_size:d?d.uSize:0,u_camera_to_center_distance:ft.cameraToCenterDistance,u_pitch:ft.pitch/360*2*Math.PI,u_rotate_symbol:+g,u_aspect_ratio:ft.width/ft.height,u_fade_change:ie.options.fadeDuration?ie.symbolFadeChange:1,u_matrix:de,u_label_plane_matrix:xe,u_coord_matrix:Ae,u_is_text:+je,u_pitch_with_map:+z,u_is_along_line:j,u_is_variable_anchor:$,u_texsize:tt,u_texture:0,u_translation:Re,u_pitched_scale:lt}},Cr=(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt,ft)=>{const yt=ie.transform;return i.e(Br(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,ft),{u_gamma_scale:z?Math.cos(yt._pitch)*yt.cameraToCenterDistance:1,u_device_pixel_ratio:ie.pixelRatio,u_is_halo:1})},Dr=(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt)=>i.e(Cr(V,d,g,z,j,$,ie,de,xe,Ae,Re,!0,je,!0,lt),{u_texsize_icon:tt,u_texture_icon:1}),$r=(V,d,g)=>({u_matrix:V,u_opacity:d,u_color:g}),fi=(V,d,g,z,j,$)=>i.e(function(ie,de,xe,Ae){const Re=xe.imageManager.getPattern(ie.from.toString()),je=xe.imageManager.getPattern(ie.to.toString()),{width:tt,height:lt}=xe.imageManager.getPixelSize(),ft=Math.pow(2,Ae.tileID.overscaledZ),yt=Ae.tileSize*Math.pow(2,xe.transform.tileZoom)/ft,Ct=yt*(Ae.tileID.canonical.x+Ae.tileID.wrap*ft),kt=yt*Ae.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:Re.tl,u_pattern_br_a:Re.br,u_pattern_tl_b:je.tl,u_pattern_br_b:je.br,u_texsize:[tt,lt],u_mix:de.t,u_pattern_size_a:Re.displaySize,u_pattern_size_b:je.displaySize,u_scale_a:de.fromScale,u_scale_b:de.toScale,u_tile_units_to_pixels:1/Tt(Ae,1,xe.transform.tileZoom),u_pixel_coord_upper:[Ct>>16,kt>>16],u_pixel_coord_lower:[65535&Ct,65535&kt]}}(z,$,g,j),{u_matrix:V,u_opacity:d}),Qr={fillExtrusion:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_lightpos:new i.aO(V,d.u_lightpos),u_lightintensity:new i.aJ(V,d.u_lightintensity),u_lightcolor:new i.aO(V,d.u_lightcolor),u_vertical_gradient:new i.aJ(V,d.u_vertical_gradient),u_opacity:new i.aJ(V,d.u_opacity)}),fillExtrusionPattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_lightpos:new i.aO(V,d.u_lightpos),u_lightintensity:new i.aJ(V,d.u_lightintensity),u_lightcolor:new i.aO(V,d.u_lightcolor),u_vertical_gradient:new i.aJ(V,d.u_vertical_gradient),u_height_factor:new i.aJ(V,d.u_height_factor),u_image:new i.aI(V,d.u_image),u_texsize:new i.aP(V,d.u_texsize),u_pixel_coord_upper:new i.aP(V,d.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,d.u_pixel_coord_lower),u_scale:new i.aO(V,d.u_scale),u_fade:new i.aJ(V,d.u_fade),u_opacity:new i.aJ(V,d.u_opacity)}),fill:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix)}),fillPattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_image:new i.aI(V,d.u_image),u_texsize:new i.aP(V,d.u_texsize),u_pixel_coord_upper:new i.aP(V,d.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,d.u_pixel_coord_lower),u_scale:new i.aO(V,d.u_scale),u_fade:new i.aJ(V,d.u_fade)}),fillOutline:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_world:new i.aP(V,d.u_world)}),fillOutlinePattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_world:new i.aP(V,d.u_world),u_image:new i.aI(V,d.u_image),u_texsize:new i.aP(V,d.u_texsize),u_pixel_coord_upper:new i.aP(V,d.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,d.u_pixel_coord_lower),u_scale:new i.aO(V,d.u_scale),u_fade:new i.aJ(V,d.u_fade)}),circle:(V,d)=>({u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_scale_with_map:new i.aI(V,d.u_scale_with_map),u_pitch_with_map:new i.aI(V,d.u_pitch_with_map),u_extrude_scale:new i.aP(V,d.u_extrude_scale),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_matrix:new i.aK(V,d.u_matrix)}),collisionBox:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_pixel_extrude_scale:new i.aP(V,d.u_pixel_extrude_scale)}),collisionCircle:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_inv_matrix:new i.aK(V,d.u_inv_matrix),u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_viewport_size:new i.aP(V,d.u_viewport_size)}),debug:(V,d)=>({u_color:new i.aM(V,d.u_color),u_matrix:new i.aK(V,d.u_matrix),u_overlay:new i.aI(V,d.u_overlay),u_overlay_scale:new i.aJ(V,d.u_overlay_scale)}),clippingMask:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix)}),heatmap:(V,d)=>({u_extrude_scale:new i.aJ(V,d.u_extrude_scale),u_intensity:new i.aJ(V,d.u_intensity),u_matrix:new i.aK(V,d.u_matrix)}),heatmapTexture:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_world:new i.aP(V,d.u_world),u_image:new i.aI(V,d.u_image),u_color_ramp:new i.aI(V,d.u_color_ramp),u_opacity:new i.aJ(V,d.u_opacity)}),hillshade:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_image:new i.aI(V,d.u_image),u_latrange:new i.aP(V,d.u_latrange),u_light:new i.aP(V,d.u_light),u_shadow:new i.aM(V,d.u_shadow),u_highlight:new i.aM(V,d.u_highlight),u_accent:new i.aM(V,d.u_accent)}),hillshadePrepare:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_image:new i.aI(V,d.u_image),u_dimension:new i.aP(V,d.u_dimension),u_zoom:new i.aJ(V,d.u_zoom),u_unpack:new i.aL(V,d.u_unpack)}),line:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_ratio:new i.aJ(V,d.u_ratio),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_units_to_pixels:new i.aP(V,d.u_units_to_pixels)}),lineGradient:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_ratio:new i.aJ(V,d.u_ratio),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_units_to_pixels:new i.aP(V,d.u_units_to_pixels),u_image:new i.aI(V,d.u_image),u_image_height:new i.aJ(V,d.u_image_height)}),linePattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_texsize:new i.aP(V,d.u_texsize),u_ratio:new i.aJ(V,d.u_ratio),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_image:new i.aI(V,d.u_image),u_units_to_pixels:new i.aP(V,d.u_units_to_pixels),u_scale:new i.aO(V,d.u_scale),u_fade:new i.aJ(V,d.u_fade)}),lineSDF:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_ratio:new i.aJ(V,d.u_ratio),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_units_to_pixels:new i.aP(V,d.u_units_to_pixels),u_patternscale_a:new i.aP(V,d.u_patternscale_a),u_patternscale_b:new i.aP(V,d.u_patternscale_b),u_sdfgamma:new i.aJ(V,d.u_sdfgamma),u_image:new i.aI(V,d.u_image),u_tex_y_a:new i.aJ(V,d.u_tex_y_a),u_tex_y_b:new i.aJ(V,d.u_tex_y_b),u_mix:new i.aJ(V,d.u_mix)}),raster:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_tl_parent:new i.aP(V,d.u_tl_parent),u_scale_parent:new i.aJ(V,d.u_scale_parent),u_buffer_scale:new i.aJ(V,d.u_buffer_scale),u_fade_t:new i.aJ(V,d.u_fade_t),u_opacity:new i.aJ(V,d.u_opacity),u_image0:new i.aI(V,d.u_image0),u_image1:new i.aI(V,d.u_image1),u_brightness_low:new i.aJ(V,d.u_brightness_low),u_brightness_high:new i.aJ(V,d.u_brightness_high),u_saturation_factor:new i.aJ(V,d.u_saturation_factor),u_contrast_factor:new i.aJ(V,d.u_contrast_factor),u_spin_weights:new i.aO(V,d.u_spin_weights)}),symbolIcon:(V,d)=>({u_is_size_zoom_constant:new i.aI(V,d.u_is_size_zoom_constant),u_is_size_feature_constant:new i.aI(V,d.u_is_size_feature_constant),u_size_t:new i.aJ(V,d.u_size_t),u_size:new i.aJ(V,d.u_size),u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_pitch:new i.aJ(V,d.u_pitch),u_rotate_symbol:new i.aI(V,d.u_rotate_symbol),u_aspect_ratio:new i.aJ(V,d.u_aspect_ratio),u_fade_change:new i.aJ(V,d.u_fade_change),u_matrix:new i.aK(V,d.u_matrix),u_label_plane_matrix:new i.aK(V,d.u_label_plane_matrix),u_coord_matrix:new i.aK(V,d.u_coord_matrix),u_is_text:new i.aI(V,d.u_is_text),u_pitch_with_map:new i.aI(V,d.u_pitch_with_map),u_is_along_line:new i.aI(V,d.u_is_along_line),u_is_variable_anchor:new i.aI(V,d.u_is_variable_anchor),u_texsize:new i.aP(V,d.u_texsize),u_texture:new i.aI(V,d.u_texture),u_translation:new i.aP(V,d.u_translation),u_pitched_scale:new i.aJ(V,d.u_pitched_scale)}),symbolSDF:(V,d)=>({u_is_size_zoom_constant:new i.aI(V,d.u_is_size_zoom_constant),u_is_size_feature_constant:new i.aI(V,d.u_is_size_feature_constant),u_size_t:new i.aJ(V,d.u_size_t),u_size:new i.aJ(V,d.u_size),u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_pitch:new i.aJ(V,d.u_pitch),u_rotate_symbol:new i.aI(V,d.u_rotate_symbol),u_aspect_ratio:new i.aJ(V,d.u_aspect_ratio),u_fade_change:new i.aJ(V,d.u_fade_change),u_matrix:new i.aK(V,d.u_matrix),u_label_plane_matrix:new i.aK(V,d.u_label_plane_matrix),u_coord_matrix:new i.aK(V,d.u_coord_matrix),u_is_text:new i.aI(V,d.u_is_text),u_pitch_with_map:new i.aI(V,d.u_pitch_with_map),u_is_along_line:new i.aI(V,d.u_is_along_line),u_is_variable_anchor:new i.aI(V,d.u_is_variable_anchor),u_texsize:new i.aP(V,d.u_texsize),u_texture:new i.aI(V,d.u_texture),u_gamma_scale:new i.aJ(V,d.u_gamma_scale),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_is_halo:new i.aI(V,d.u_is_halo),u_translation:new i.aP(V,d.u_translation),u_pitched_scale:new i.aJ(V,d.u_pitched_scale)}),symbolTextAndIcon:(V,d)=>({u_is_size_zoom_constant:new i.aI(V,d.u_is_size_zoom_constant),u_is_size_feature_constant:new i.aI(V,d.u_is_size_feature_constant),u_size_t:new i.aJ(V,d.u_size_t),u_size:new i.aJ(V,d.u_size),u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_pitch:new i.aJ(V,d.u_pitch),u_rotate_symbol:new i.aI(V,d.u_rotate_symbol),u_aspect_ratio:new i.aJ(V,d.u_aspect_ratio),u_fade_change:new i.aJ(V,d.u_fade_change),u_matrix:new i.aK(V,d.u_matrix),u_label_plane_matrix:new i.aK(V,d.u_label_plane_matrix),u_coord_matrix:new i.aK(V,d.u_coord_matrix),u_is_text:new i.aI(V,d.u_is_text),u_pitch_with_map:new i.aI(V,d.u_pitch_with_map),u_is_along_line:new i.aI(V,d.u_is_along_line),u_is_variable_anchor:new i.aI(V,d.u_is_variable_anchor),u_texsize:new i.aP(V,d.u_texsize),u_texsize_icon:new i.aP(V,d.u_texsize_icon),u_texture:new i.aI(V,d.u_texture),u_texture_icon:new i.aI(V,d.u_texture_icon),u_gamma_scale:new i.aJ(V,d.u_gamma_scale),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_is_halo:new i.aI(V,d.u_is_halo),u_translation:new i.aP(V,d.u_translation),u_pitched_scale:new i.aJ(V,d.u_pitched_scale)}),background:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_opacity:new i.aJ(V,d.u_opacity),u_color:new i.aM(V,d.u_color)}),backgroundPattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_opacity:new i.aJ(V,d.u_opacity),u_image:new i.aI(V,d.u_image),u_pattern_tl_a:new i.aP(V,d.u_pattern_tl_a),u_pattern_br_a:new i.aP(V,d.u_pattern_br_a),u_pattern_tl_b:new i.aP(V,d.u_pattern_tl_b),u_pattern_br_b:new i.aP(V,d.u_pattern_br_b),u_texsize:new i.aP(V,d.u_texsize),u_mix:new i.aJ(V,d.u_mix),u_pattern_size_a:new i.aP(V,d.u_pattern_size_a),u_pattern_size_b:new i.aP(V,d.u_pattern_size_b),u_scale_a:new i.aJ(V,d.u_scale_a),u_scale_b:new i.aJ(V,d.u_scale_b),u_pixel_coord_upper:new i.aP(V,d.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,d.u_pixel_coord_lower),u_tile_units_to_pixels:new i.aJ(V,d.u_tile_units_to_pixels)}),terrain:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_texture:new i.aI(V,d.u_texture),u_ele_delta:new i.aJ(V,d.u_ele_delta),u_fog_matrix:new i.aK(V,d.u_fog_matrix),u_fog_color:new i.aM(V,d.u_fog_color),u_fog_ground_blend:new i.aJ(V,d.u_fog_ground_blend),u_fog_ground_blend_opacity:new i.aJ(V,d.u_fog_ground_blend_opacity),u_horizon_color:new i.aM(V,d.u_horizon_color),u_horizon_fog_blend:new i.aJ(V,d.u_horizon_fog_blend)}),terrainDepth:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_ele_delta:new i.aJ(V,d.u_ele_delta)}),terrainCoords:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_texture:new i.aI(V,d.u_texture),u_terrain_coords_id:new i.aJ(V,d.u_terrain_coords_id),u_ele_delta:new i.aJ(V,d.u_ele_delta)}),sky:(V,d)=>({u_sky_color:new i.aM(V,d.u_sky_color),u_horizon_color:new i.aM(V,d.u_horizon_color),u_horizon:new i.aJ(V,d.u_horizon),u_sky_horizon_blend:new i.aJ(V,d.u_sky_horizon_blend)})};class Hr{constructor(d,g,z){this.context=d;const j=d.gl;this.buffer=j.createBuffer(),this.dynamicDraw=!!z,this.context.unbindVAO(),d.bindElementBuffer.set(this.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,g.arrayBuffer,this.dynamicDraw?j.DYNAMIC_DRAW:j.STATIC_DRAW),this.dynamicDraw||delete g.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(d){const g=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),g.bufferSubData(g.ELEMENT_ARRAY_BUFFER,0,d.arrayBuffer)}destroy(){const d=this.context.gl;this.buffer&&(d.deleteBuffer(this.buffer),delete this.buffer)}}const oi={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Mi{constructor(d,g,z,j){this.length=g.length,this.attributes=z,this.itemSize=g.bytesPerElement,this.dynamicDraw=j,this.context=d;const $=d.gl;this.buffer=$.createBuffer(),d.bindVertexBuffer.set(this.buffer),$.bufferData($.ARRAY_BUFFER,g.arrayBuffer,this.dynamicDraw?$.DYNAMIC_DRAW:$.STATIC_DRAW),this.dynamicDraw||delete g.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(d){if(d.length!==this.length)throw new Error(`Length of new data is ${d.length}, which doesn't match current length of ${this.length}`);const g=this.context.gl;this.bind(),g.bufferSubData(g.ARRAY_BUFFER,0,d.arrayBuffer)}enableAttributes(d,g){for(let z=0;z<this.attributes.length;z++){const j=this.attributes[z],$=g.attributes[j.name];$!==void 0&&d.enableVertexAttribArray($)}}setVertexAttribPointers(d,g,z){for(let j=0;j<this.attributes.length;j++){const $=this.attributes[j],ie=g.attributes[$.name];ie!==void 0&&d.vertexAttribPointer(ie,$.components,d[oi[$.type]],!1,this.itemSize,$.offset+this.itemSize*(z||0))}}destroy(){const d=this.context.gl;this.buffer&&(d.deleteBuffer(this.buffer),delete this.buffer)}}const Bi=new WeakMap;function Ya(V){var d;if(Bi.has(V))return Bi.get(V);{const g=(d=V.getParameter(V.VERSION))===null||d===void 0?void 0:d.startsWith("WebGL 2.0");return Bi.set(V,g),g}}class Vi{constructor(d){this.gl=d.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(d){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class ns extends Vi{getDefault(){return i.aN.transparent}set(d){const g=this.current;(d.r!==g.r||d.g!==g.g||d.b!==g.b||d.a!==g.a||this.dirty)&&(this.gl.clearColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class no extends Vi{getDefault(){return 1}set(d){(d!==this.current||this.dirty)&&(this.gl.clearDepth(d),this.current=d,this.dirty=!1)}}class ko extends Vi{getDefault(){return 0}set(d){(d!==this.current||this.dirty)&&(this.gl.clearStencil(d),this.current=d,this.dirty=!1)}}class el extends Vi{getDefault(){return[!0,!0,!0,!0]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||d[2]!==g[2]||d[3]!==g[3]||this.dirty)&&(this.gl.colorMask(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class Ui extends Vi{getDefault(){return!0}set(d){(d!==this.current||this.dirty)&&(this.gl.depthMask(d),this.current=d,this.dirty=!1)}}class qo extends Vi{getDefault(){return 255}set(d){(d!==this.current||this.dirty)&&(this.gl.stencilMask(d),this.current=d,this.dirty=!1)}}class Bl extends Vi{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(d){const g=this.current;(d.func!==g.func||d.ref!==g.ref||d.mask!==g.mask||this.dirty)&&(this.gl.stencilFunc(d.func,d.ref,d.mask),this.current=d,this.dirty=!1)}}class jo extends Vi{getDefault(){const d=this.gl;return[d.KEEP,d.KEEP,d.KEEP]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||d[2]!==g[2]||this.dirty)&&(this.gl.stencilOp(d[0],d[1],d[2]),this.current=d,this.dirty=!1)}}class qu extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;d?g.enable(g.STENCIL_TEST):g.disable(g.STENCIL_TEST),this.current=d,this.dirty=!1}}class Sl extends Vi{getDefault(){return[0,1]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||this.dirty)&&(this.gl.depthRange(d[0],d[1]),this.current=d,this.dirty=!1)}}class Is extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;d?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST),this.current=d,this.dirty=!1}}class Wu extends Vi{getDefault(){return this.gl.LESS}set(d){(d!==this.current||this.dirty)&&(this.gl.depthFunc(d),this.current=d,this.dirty=!1)}}class Gu extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;d?g.enable(g.BLEND):g.disable(g.BLEND),this.current=d,this.dirty=!1}}class dc extends Vi{getDefault(){const d=this.gl;return[d.ONE,d.ZERO]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||this.dirty)&&(this.gl.blendFunc(d[0],d[1]),this.current=d,this.dirty=!1)}}class tl extends Vi{getDefault(){return i.aN.transparent}set(d){const g=this.current;(d.r!==g.r||d.g!==g.g||d.b!==g.b||d.a!==g.a||this.dirty)&&(this.gl.blendColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class Su extends Vi{getDefault(){return this.gl.FUNC_ADD}set(d){(d!==this.current||this.dirty)&&(this.gl.blendEquation(d),this.current=d,this.dirty=!1)}}class Al extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;d?g.enable(g.CULL_FACE):g.disable(g.CULL_FACE),this.current=d,this.dirty=!1}}class ro extends Vi{getDefault(){return this.gl.BACK}set(d){(d!==this.current||this.dirty)&&(this.gl.cullFace(d),this.current=d,this.dirty=!1)}}class rs extends Vi{getDefault(){return this.gl.CCW}set(d){(d!==this.current||this.dirty)&&(this.gl.frontFace(d),this.current=d,this.dirty=!1)}}class $u extends Vi{getDefault(){return null}set(d){(d!==this.current||this.dirty)&&(this.gl.useProgram(d),this.current=d,this.dirty=!1)}}class Au extends Vi{getDefault(){return this.gl.TEXTURE0}set(d){(d!==this.current||this.dirty)&&(this.gl.activeTexture(d),this.current=d,this.dirty=!1)}}class fu extends Vi{getDefault(){const d=this.gl;return[0,0,d.drawingBufferWidth,d.drawingBufferHeight]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||d[2]!==g[2]||d[3]!==g[3]||this.dirty)&&(this.gl.viewport(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class Yu extends Vi{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.bindFramebuffer(g.FRAMEBUFFER,d),this.current=d,this.dirty=!1}}class du extends Vi{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.bindRenderbuffer(g.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class Zu extends Vi{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.bindTexture(g.TEXTURE_2D,d),this.current=d,this.dirty=!1}}class Xu extends Vi{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.bindBuffer(g.ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class Cu extends Vi{getDefault(){return null}set(d){const g=this.gl;g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class Ls extends Vi{getDefault(){return null}set(d){var g;if(d===this.current&&!this.dirty)return;const z=this.gl;Ya(z)?z.bindVertexArray(d):(g=z.getExtension("OES_vertex_array_object"))===null||g===void 0||g.bindVertexArrayOES(d),this.current=d,this.dirty=!1}}class Ph extends Vi{getDefault(){return 4}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.pixelStorei(g.UNPACK_ALIGNMENT,d),this.current=d,this.dirty=!1}}class dh extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d),this.current=d,this.dirty=!1}}class pc extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,d),this.current=d,this.dirty=!1}}class Dh extends Vi{constructor(d,g){super(d),this.context=d,this.parent=g}getDefault(){return null}}class Qh extends Dh{setDirty(){this.dirty=!0}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const g=this.gl;g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,g.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class Nl extends Dh{set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const g=this.gl;g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class ef extends Dh{set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const g=this.gl;g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class ld{constructor(d,g,z,j,$){this.context=d,this.width=g,this.height=z;const ie=d.gl,de=this.framebuffer=ie.createFramebuffer();if(this.colorAttachment=new Qh(d,de),j)this.depthAttachment=$?new ef(d,de):new Nl(d,de);else if($)throw new Error("Stencil cannot be set without depth");if(ie.checkFramebufferStatus(ie.FRAMEBUFFER)!==ie.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const d=this.context.gl,g=this.colorAttachment.get();if(g&&d.deleteTexture(g),this.depthAttachment){const z=this.depthAttachment.get();z&&d.deleteRenderbuffer(z)}d.deleteFramebuffer(this.framebuffer)}}class Wo{constructor(d,g,z){this.blendFunction=d,this.blendColor=g,this.mask=z}}Wo.Replace=[1,0],Wo.disabled=new Wo(Wo.Replace,i.aN.transparent,[!1,!1,!1,!1]),Wo.unblended=new Wo(Wo.Replace,i.aN.transparent,[!0,!0,!0,!0]),Wo.alphaBlended=new Wo([1,771],i.aN.transparent,[!0,!0,!0,!0]);class Zc{constructor(d){var g,z;if(this.gl=d,this.clearColor=new ns(this),this.clearDepth=new no(this),this.clearStencil=new ko(this),this.colorMask=new el(this),this.depthMask=new Ui(this),this.stencilMask=new qo(this),this.stencilFunc=new Bl(this),this.stencilOp=new jo(this),this.stencilTest=new qu(this),this.depthRange=new Sl(this),this.depthTest=new Is(this),this.depthFunc=new Wu(this),this.blend=new Gu(this),this.blendFunc=new dc(this),this.blendColor=new tl(this),this.blendEquation=new Su(this),this.cullFace=new Al(this),this.cullFaceSide=new ro(this),this.frontFace=new rs(this),this.program=new $u(this),this.activeTexture=new Au(this),this.viewport=new fu(this),this.bindFramebuffer=new Yu(this),this.bindRenderbuffer=new du(this),this.bindTexture=new Zu(this),this.bindVertexBuffer=new Xu(this),this.bindElementBuffer=new Cu(this),this.bindVertexArray=new Ls(this),this.pixelStoreUnpack=new Ph(this),this.pixelStoreUnpackPremultiplyAlpha=new dh(this),this.pixelStoreUnpackFlipY=new pc(this),this.extTextureFilterAnisotropic=d.getExtension("EXT_texture_filter_anisotropic")||d.getExtension("MOZ_EXT_texture_filter_anisotropic")||d.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=d.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=d.getParameter(d.MAX_TEXTURE_SIZE),Ya(d)){this.HALF_FLOAT=d.HALF_FLOAT;const j=d.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(g=d.RGBA16F)!==null&&g!==void 0?g:j==null?void 0:j.RGBA16F_EXT,this.RGB16F=(z=d.RGB16F)!==null&&z!==void 0?z:j==null?void 0:j.RGB16F_EXT,d.getExtension("EXT_color_buffer_float")}else{d.getExtension("EXT_color_buffer_half_float"),d.getExtension("OES_texture_half_float_linear");const j=d.getExtension("OES_texture_half_float");this.HALF_FLOAT=j==null?void 0:j.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(d,g){return new Hr(this,d,g)}createVertexBuffer(d,g,z){return new Mi(this,d,g,z)}createRenderbuffer(d,g,z){const j=this.gl,$=j.createRenderbuffer();return this.bindRenderbuffer.set($),j.renderbufferStorage(j.RENDERBUFFER,d,g,z),this.bindRenderbuffer.set(null),$}createFramebuffer(d,g,z,j){return new ld(this,d,g,z,j)}clear({color:d,depth:g,stencil:z}){const j=this.gl;let $=0;d&&($|=j.COLOR_BUFFER_BIT,this.clearColor.set(d),this.colorMask.set([!0,!0,!0,!0])),g!==void 0&&($|=j.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(g),this.depthMask.set(!0)),z!==void 0&&($|=j.STENCIL_BUFFER_BIT,this.clearStencil.set(z),this.stencilMask.set(255)),j.clear($)}setCullFace(d){d.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(d.mode),this.frontFace.set(d.frontFace))}setDepthMode(d){d.func!==this.gl.ALWAYS||d.mask?(this.depthTest.set(!0),this.depthFunc.set(d.func),this.depthMask.set(d.mask),this.depthRange.set(d.range)):this.depthTest.set(!1)}setStencilMode(d){d.test.func!==this.gl.ALWAYS||d.mask?(this.stencilTest.set(!0),this.stencilMask.set(d.mask),this.stencilOp.set([d.fail,d.depthFail,d.pass]),this.stencilFunc.set({func:d.test.func,ref:d.ref,mask:d.test.mask})):this.stencilTest.set(!1)}setColorMode(d){i.aF(d.blendFunction,Wo.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(d.blendFunction),this.blendColor.set(d.blendColor)),this.colorMask.set(d.mask)}createVertexArray(){var d;return Ya(this.gl)?this.gl.createVertexArray():(d=this.gl.getExtension("OES_vertex_array_object"))===null||d===void 0?void 0:d.createVertexArrayOES()}deleteVertexArray(d){var g;return Ya(this.gl)?this.gl.deleteVertexArray(d):(g=this.gl.getExtension("OES_vertex_array_object"))===null||g===void 0?void 0:g.deleteVertexArrayOES(d)}unbindVAO(){this.bindVertexArray.set(null)}}class Qi{constructor(d,g,z){this.func=d,this.mask=g,this.range=z}}Qi.ReadOnly=!1,Qi.ReadWrite=!0,Qi.disabled=new Qi(519,Qi.ReadOnly,[0,1]);const mc=7680;class Za{constructor(d,g,z,j,$,ie){this.test=d,this.ref=g,this.mask=z,this.fail=j,this.depthFail=$,this.pass=ie}}Za.disabled=new Za({func:519,mask:0},0,0,mc,mc,mc);class Xa{constructor(d,g,z){this.enable=d,this.mode=g,this.frontFace=z}}let Vl;function dl(V,d,g,z,j){const $=V.context,ie=$.gl,de=V.useProgram("collisionBox"),xe=[];let Ae=0,Re=0;for(let Ct=0;Ct<z.length;Ct++){const kt=z[Ct],Bt=d.getTile(kt).getBucket(g);if(!Bt)continue;const At=j?Bt.textCollisionBox:Bt.iconCollisionBox,$t=Bt.collisionCircleArray;if($t.length>0){const Kt=i.H();i.aR(Kt,Bt.placementInvProjMatrix,V.transform.glCoordMatrix),i.aR(Kt,Kt,Bt.placementViewportMatrix),xe.push({circleArray:$t,circleOffset:Re,transform:kt.posMatrix,invTransform:Kt,coord:kt}),Ae+=$t.length/4,Re=Ae}At&&de.draw($,ie.LINES,Qi.disabled,Za.disabled,V.colorModeForRenderPass(),Xa.disabled,nn(V.transform,kt.posMatrix),V.style.map.terrain&&V.style.map.terrain.getTerrainData(kt),g.id,At.layoutVertexBuffer,At.indexBuffer,At.segments,null,V.transform.zoom,null,null,At.collisionVertexBuffer)}if(!j||!xe.length)return;const je=V.useProgram("collisionCircle"),tt=new i.aS;tt.resize(4*Ae),tt._trim();let lt=0;for(const Ct of xe)for(let kt=0;kt<Ct.circleArray.length/4;kt++){const Bt=4*kt,At=Ct.circleArray[Bt+0],$t=Ct.circleArray[Bt+1],Kt=Ct.circleArray[Bt+2],Yt=Ct.circleArray[Bt+3];tt.emplace(lt++,At,$t,Kt,Yt,0),tt.emplace(lt++,At,$t,Kt,Yt,1),tt.emplace(lt++,At,$t,Kt,Yt,2),tt.emplace(lt++,At,$t,Kt,Yt,3)}(!Vl||Vl.length<2*Ae)&&(Vl=function(Ct){const kt=2*Ct,Bt=new i.aU;Bt.resize(kt),Bt._trim();for(let At=0;At<kt;At++){const $t=6*At;Bt.uint16[$t+0]=4*At+0,Bt.uint16[$t+1]=4*At+1,Bt.uint16[$t+2]=4*At+2,Bt.uint16[$t+3]=4*At+2,Bt.uint16[$t+4]=4*At+3,Bt.uint16[$t+5]=4*At+0}return Bt}(Ae));const ft=$.createIndexBuffer(Vl,!0),yt=$.createVertexBuffer(tt,i.aT.members,!0);for(const Ct of xe){const kt=ln(Ct.transform,Ct.invTransform,V.transform);je.draw($,ie.TRIANGLES,Qi.disabled,Za.disabled,V.colorModeForRenderPass(),Xa.disabled,kt,V.style.map.terrain&&V.style.map.terrain.getTerrainData(Ct.coord),g.id,yt,ft,i.a0.simpleSegment(0,2*Ct.circleOffset,Ct.circleArray.length,Ct.circleArray.length/2),null,V.transform.zoom,null,null,null)}yt.destroy(),ft.destroy()}Xa.disabled=new Xa(!1,1029,2305),Xa.backCCW=new Xa(!0,1029,2305);const Xc=i.ao(new Float32Array(16));function Ku(V,d,g,z,j){if(V.renderPass!=="translucent")return;const $=Za.disabled,ie=V.colorModeForRenderPass();(g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(de,xe,Ae,Re,je,tt,lt,ft,yt){const Ct=xe.transform,kt=Rn(),Bt=je==="map",At=tt==="map";for(const $t of de){const Kt=Re.getTile($t),Yt=Kt.getBucket(Ae);if(!Yt||!Yt.text||!Yt.text.segments.get().length)continue;const pn=Yt.textSizeData,Tn=i.ah(pn,Ct.zoom),Vn=Tt(Kt,1,xe.transform.zoom),jn=Nt($t.posMatrix,At,Bt,xe.transform,Vn),$n=Ae.layout.get("icon-text-fit")!=="none"&&Yt.hasIconData();if(Tn){const er=Math.pow(2,Ct.zoom-Kt.tileID.overscaledZ),Tr=xe.style.map.terrain?(Ar,ur)=>xe.style.map.terrain.getElevation($t,Ar,ur):null,rr=kt.translatePosition(Ct,Kt,lt,ft);vs(Yt,Bt,At,yt,Ct,jn,$t.posMatrix,er,Tn,$n,kt,rr,$t.toUnwrapped(),Tr)}}}(z,V,g,d,g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),j),g.paint.get("icon-opacity").constantOr(1)!==0&&Pc(V,d,g,z,!1,g.paint.get("icon-translate"),g.paint.get("icon-translate-anchor"),g.layout.get("icon-rotation-alignment"),g.layout.get("icon-pitch-alignment"),g.layout.get("icon-keep-upright"),$,ie),g.paint.get("text-opacity").constantOr(1)!==0&&Pc(V,d,g,z,!0,g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),g.layout.get("text-keep-upright"),$,ie),d.map.showCollisionBoxes&&(dl(V,d,g,z,!0),dl(V,d,g,z,!1))}function pl(V,d,g,z,j,$){const{horizontalAlign:ie,verticalAlign:de}=i.av(V),xe=-(ie-.5)*d,Ae=-(de-.5)*g;return new i.P((xe/j+z[0])*$,(Ae/j+z[1])*$)}function Cl(V,d,g,z,j,$){const ie=d.tileAnchorPoint.add(new i.P(d.translation[0],d.translation[1]));if(d.pitchWithMap){let de=z.mult($);return g||(de=de.rotate(-j)),Ut(ie.add(de),d.labelPlaneMatrix,d.getElevation).point}if(g){const de=$e(d.tileAnchorPoint.x+1,d.tileAnchorPoint.y,d).point.sub(V),xe=Math.atan(de.y/de.x)+(de.x<0?Math.PI:0);return V.add(z.rotate(xe))}return V.add(z)}function vs(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt){const ft=V.text.placedSymbolArray,yt=V.text.dynamicLayoutVertexArray,Ct=V.icon.dynamicLayoutVertexArray,kt={};yt.clear();for(let Bt=0;Bt<ft.length;Bt++){const At=ft.get(Bt),$t=V.allowVerticalPlacement&&!At.placedOrientation,Kt=At.hidden||!At.crossTileID||$t?null:z[At.crossTileID];if(Kt){const Yt=new i.P(At.anchorX,At.anchorY),pn={getElevation:lt,width:j.width,height:j.height,labelPlaneMatrix:$,pitchWithMap:g,projection:Re,tileAnchorPoint:Yt,translation:je,unwrappedTileID:tt},Tn=g?Ut(Yt,ie,lt):$e(Yt.x,Yt.y,pn),Vn=at(j.cameraToCenterDistance,Tn.signedDistanceFromCamera);let jn=i.aj(V.textSizeData,xe,At)*Vn/i.aq;g&&(jn*=V.tilePixelRatio/de);const{width:$n,height:er,anchor:Tr,textOffset:rr,textBoxScale:Ar}=Kt,ur=pl(Tr,$n,er,rr,Ar,jn),Pr=Re.getPitchedTextCorrection(j,Yt.add(new i.P(je[0],je[1])),tt),br=Cl(Tn.point,pn,d,ur,j.angle,Pr),Nr=V.allowVerticalPlacement&&At.placedOrientation===i.ai.vertical?Math.PI/2:0;for(let li=0;li<At.numGlyphs;li++)i.ak(yt,br,Nr);Ae&&At.associatedIconIndex>=0&&(kt[At.associatedIconIndex]={shiftedAnchor:br,angle:Nr})}else Ft(At.numGlyphs,yt)}if(Ae){Ct.clear();const Bt=V.icon.placedSymbolArray;for(let At=0;At<Bt.length;At++){const $t=Bt.get(At);if($t.hidden)Ft($t.numGlyphs,Ct);else{const Kt=kt[At];if(Kt)for(let Yt=0;Yt<$t.numGlyphs;Yt++)i.ak(Ct,Kt.shiftedAnchor,Kt.angle);else Ft($t.numGlyphs,Ct)}}V.icon.dynamicLayoutVertexBuffer.updateData(Ct)}V.text.dynamicLayoutVertexBuffer.updateData(yt)}function fa(V,d,g){return g.iconsInText&&d?"symbolTextAndIcon":V?"symbolSDF":"symbolIcon"}function Pc(V,d,g,z,j,$,ie,de,xe,Ae,Re,je){const tt=V.context,lt=tt.gl,ft=V.transform,yt=Rn(),Ct=de==="map",kt=xe==="map",Bt=de!=="viewport"&&g.layout.get("symbol-placement")!=="point",At=Ct&&!kt&&!Bt,$t=!kt&&Bt,Kt=!g.layout.get("symbol-sort-key").isConstant();let Yt=!1;const pn=V.depthModeForSublayer(0,Qi.ReadOnly),Tn=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Vn=[],jn=yt.getCircleRadiusCorrection(ft);for(const $n of z){const er=d.getTile($n),Tr=er.getBucket(g);if(!Tr)continue;const rr=j?Tr.text:Tr.icon;if(!rr||!rr.segments.get().length||!rr.hasVisibleVertices)continue;const Ar=rr.programConfigurations.get(g.id),ur=j||Tr.sdfIcons,Pr=j?Tr.textSizeData:Tr.iconSizeData,br=kt||ft.pitch!==0,Nr=V.useProgram(fa(ur,j,Tr),Ar),li=i.ah(Pr,ft.zoom),Fr=V.style.map.terrain&&V.style.map.terrain.getTerrainData($n);let ri,vi,qi,Di,Yi=[0,0],Gi=null;if(j){if(vi=er.glyphAtlasTexture,qi=lt.LINEAR,ri=er.glyphAtlasTexture.size,Tr.iconsInText){Yi=er.imageAtlasTexture.size,Gi=er.imageAtlasTexture;const Wi=Pr.kind==="composite"||Pr.kind==="camera";Di=br||V.options.rotating||V.options.zooming||Wi?lt.LINEAR:lt.NEAREST}}else{const Wi=g.layout.get("icon-size").constantOr(0)!==1||Tr.iconsNeedLinear;vi=er.imageAtlasTexture,qi=ur||V.options.rotating||V.options.zooming||Wi||br?lt.LINEAR:lt.NEAREST,ri=er.imageAtlasTexture.size}const ea=Tt(er,1,V.transform.zoom),_a=$t?$n.posMatrix:Xc,So=Nt(_a,kt,Ct,V.transform,ea),go=jt(_a,kt,Ct,V.transform,ea),Zo=jt($n.posMatrix,kt,Ct,V.transform,ea),Aa=yt.translatePosition(V.transform,er,$,ie),ra=Tn&&Tr.hasTextData(),oo=g.layout.get("icon-text-fit")!=="none"&&ra&&Tr.hasIconData();if(Bt){const Wi=V.style.map.terrain?(Uo,Il)=>V.style.map.terrain.getElevation($n,Uo,Il):null,_s=g.layout.get("text-rotation-alignment")==="map";ct(Tr,$n.posMatrix,V,j,So,Zo,kt,Ae,_s,yt,$n.toUnwrapped(),ft.width,ft.height,Aa,Wi)}const Pa=$n.posMatrix,va=j&&Tn||oo,Ca=Bt||va?Xc:So,Wa=go,aa=ur&&g.paint.get(j?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Kl;Kl=ur?Tr.iconsInText?Dr(Pr.kind,li,At,kt,Bt,va,V,Pa,Ca,Wa,Aa,ri,Yi,jn):Cr(Pr.kind,li,At,kt,Bt,va,V,Pa,Ca,Wa,Aa,j,ri,!0,jn):Br(Pr.kind,li,At,kt,Bt,va,V,Pa,Ca,Wa,Aa,j,ri,jn);const Lo={program:Nr,buffers:rr,uniformValues:Kl,atlasTexture:vi,atlasTextureIcon:Gi,atlasInterpolation:qi,atlasInterpolationIcon:Di,isSDF:ur,hasHalo:aa};if(Kt&&Tr.canOverlap){Yt=!0;const Wi=rr.segments.get();for(const _s of Wi)Vn.push({segments:new i.a0([_s]),sortKey:_s.sortKey,state:Lo,terrainData:Fr})}else Vn.push({segments:rr.segments,sortKey:0,state:Lo,terrainData:Fr})}Yt&&Vn.sort(($n,er)=>$n.sortKey-er.sortKey);for(const $n of Vn){const er=$n.state;if(tt.activeTexture.set(lt.TEXTURE0),er.atlasTexture.bind(er.atlasInterpolation,lt.CLAMP_TO_EDGE),er.atlasTextureIcon&&(tt.activeTexture.set(lt.TEXTURE1),er.atlasTextureIcon&&er.atlasTextureIcon.bind(er.atlasInterpolationIcon,lt.CLAMP_TO_EDGE)),er.isSDF){const Tr=er.uniformValues;er.hasHalo&&(Tr.u_is_halo=1,tf(er.buffers,$n.segments,g,V,er.program,pn,Re,je,Tr,$n.terrainData)),Tr.u_is_halo=0}tf(er.buffers,$n.segments,g,V,er.program,pn,Re,je,er.uniformValues,$n.terrainData)}}function tf(V,d,g,z,j,$,ie,de,xe,Ae){const Re=z.context,je=Re.gl;j.draw(Re,je.TRIANGLES,$,ie,de,Xa.disabled,xe,Ae,g.id,V.layoutVertexBuffer,V.indexBuffer,d,g.paint,z.transform.zoom,V.programConfigurations.get(g.id),V.dynamicLayoutVertexBuffer,V.opacityVertexBuffer)}function Ju(V,d,g,z){if(g.paint.get("heatmap-opacity")!==0)if(V.renderPass==="offscreen"){const j=V.context,$=j.gl,ie=Za.disabled,de=new Wo([$.ONE,$.ONE],i.aN.transparent,[!0,!0,!0,!0]);(function(xe,Ae,Re){const je=xe.gl;xe.activeTexture.set(je.TEXTURE1),xe.viewport.set([0,0,Ae.width/4,Ae.height/4]);let tt=Re.heatmapFbo;if(tt)je.bindTexture(je.TEXTURE_2D,tt.colorAttachment.get()),xe.bindFramebuffer.set(tt.framebuffer);else{const lt=je.createTexture();je.bindTexture(je.TEXTURE_2D,lt),je.texParameteri(je.TEXTURE_2D,je.TEXTURE_WRAP_S,je.CLAMP_TO_EDGE),je.texParameteri(je.TEXTURE_2D,je.TEXTURE_WRAP_T,je.CLAMP_TO_EDGE),je.texParameteri(je.TEXTURE_2D,je.TEXTURE_MIN_FILTER,je.LINEAR),je.texParameteri(je.TEXTURE_2D,je.TEXTURE_MAG_FILTER,je.LINEAR),tt=Re.heatmapFbo=xe.createFramebuffer(Ae.width/4,Ae.height/4,!1,!1),function(ft,yt,Ct,kt){var Bt,At;const $t=ft.gl,Kt=(Bt=ft.HALF_FLOAT)!==null&&Bt!==void 0?Bt:$t.UNSIGNED_BYTE,Yt=(At=ft.RGBA16F)!==null&&At!==void 0?At:$t.RGBA;$t.texImage2D($t.TEXTURE_2D,0,Yt,yt.width/4,yt.height/4,0,$t.RGBA,Kt,null),kt.colorAttachment.set(Ct)}(xe,Ae,lt,tt)}})(j,V,g),j.clear({color:i.aN.transparent});for(let xe=0;xe<z.length;xe++){const Ae=z[xe];if(d.hasRenderableParent(Ae))continue;const Re=d.getTile(Ae),je=Re.getBucket(g);if(!je)continue;const tt=je.programConfigurations.get(g.id),lt=V.useProgram("heatmap",tt),{zoom:ft}=V.transform;lt.draw(j,$.TRIANGLES,Qi.disabled,ie,de,Xa.disabled,Bn(Ae.posMatrix,Re,ft,g.paint.get("heatmap-intensity")),null,g.id,je.layoutVertexBuffer,je.indexBuffer,je.segments,g.paint,V.transform.zoom,tt)}j.viewport.set([0,0,V.width,V.height])}else V.renderPass==="translucent"&&(V.context.setColorMode(V.colorModeForRenderPass()),function(j,$){const ie=j.context,de=ie.gl,xe=$.heatmapFbo;if(!xe)return;ie.activeTexture.set(de.TEXTURE0),de.bindTexture(de.TEXTURE_2D,xe.colorAttachment.get()),ie.activeTexture.set(de.TEXTURE1);let Ae=$.colorRampTexture;Ae||(Ae=$.colorRampTexture=new D(ie,$.colorRamp,de.RGBA)),Ae.bind(de.LINEAR,de.CLAMP_TO_EDGE),j.useProgram("heatmapTexture").draw(ie,de.TRIANGLES,Qi.disabled,Za.disabled,j.colorModeForRenderPass(),Xa.disabled,Kn(j,$,0,1),null,$.id,j.viewportBuffer,j.quadTriangleIndexBuffer,j.viewportSegments,$.paint,j.transform.zoom)}(V,g))}function Qu(V,d,g,z,j){if(!g||!z||!z.imageAtlas)return;const $=z.imageAtlas.patternPositions;let ie=$[g.to.toString()],de=$[g.from.toString()];if(!ie&&de&&(ie=de),!de&&ie&&(de=ie),!ie||!de){const xe=j.getPaintProperty(d);ie=$[xe],de=$[xe]}ie&&de&&V.setConstantPatternPositions(ie,de)}function ph(V,d,g,z,j,$,ie){const de=V.context.gl,xe="fill-pattern",Ae=g.paint.get(xe),Re=Ae&&Ae.constantOr(1),je=g.getCrossfadeParameters();let tt,lt,ft,yt,Ct;ie?(lt=Re&&!g.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",tt=de.LINES):(lt=Re?"fillPattern":"fill",tt=de.TRIANGLES);const kt=Ae.constantOr(null);for(const Bt of z){const At=d.getTile(Bt);if(Re&&!At.patternsLoaded())continue;const $t=At.getBucket(g);if(!$t)continue;const Kt=$t.programConfigurations.get(g.id),Yt=V.useProgram(lt,Kt),pn=V.style.map.terrain&&V.style.map.terrain.getTerrainData(Bt);Re&&(V.context.activeTexture.set(de.TEXTURE0),At.imageAtlasTexture.bind(de.LINEAR,de.CLAMP_TO_EDGE),Kt.updatePaintBuffers(je)),Qu(Kt,xe,kt,At,g);const Tn=pn?Bt:null,Vn=Tn?Tn.posMatrix:Bt.posMatrix,jn=V.translatePosMatrix(Vn,At,g.paint.get("fill-translate"),g.paint.get("fill-translate-anchor"));if(ie){yt=$t.indexBuffer2,Ct=$t.segments2;const $n=[de.drawingBufferWidth,de.drawingBufferHeight];ft=lt==="fillOutlinePattern"&&Re?vn(jn,V,je,At,$n):ti(jn,$n)}else yt=$t.indexBuffer,Ct=$t.segments,ft=Re?Ur(jn,V,je,At):wr(jn);Yt.draw(V.context,tt,j,V.stencilModeForClipping(Bt),$,Xa.disabled,ft,pn,g.id,$t.layoutVertexBuffer,yt,Ct,g.paint,V.transform.zoom,Kt)}}function Kc(V,d,g,z,j,$,ie){const de=V.context,xe=de.gl,Ae="fill-extrusion-pattern",Re=g.paint.get(Ae),je=Re.constantOr(1),tt=g.getCrossfadeParameters(),lt=g.paint.get("fill-extrusion-opacity"),ft=Re.constantOr(null);for(const yt of z){const Ct=d.getTile(yt),kt=Ct.getBucket(g);if(!kt)continue;const Bt=V.style.map.terrain&&V.style.map.terrain.getTerrainData(yt),At=kt.programConfigurations.get(g.id),$t=V.useProgram(je?"fillExtrusionPattern":"fillExtrusion",At);je&&(V.context.activeTexture.set(xe.TEXTURE0),Ct.imageAtlasTexture.bind(xe.LINEAR,xe.CLAMP_TO_EDGE),At.updatePaintBuffers(tt)),Qu(At,Ae,ft,Ct,g);const Kt=V.translatePosMatrix(yt.posMatrix,Ct,g.paint.get("fill-extrusion-translate"),g.paint.get("fill-extrusion-translate-anchor")),Yt=g.paint.get("fill-extrusion-vertical-gradient"),pn=je?Sr(Kt,V,Yt,lt,yt,tt,Ct):sr(Kt,V,Yt,lt);$t.draw(de,de.gl.TRIANGLES,j,$,ie,Xa.backCCW,pn,Bt,g.id,kt.layoutVertexBuffer,kt.indexBuffer,kt.segments,g.paint,V.transform.zoom,At,V.style.map.terrain&&kt.centroidVertexBuffer)}}function Jc(V,d,g,z,j,$,ie){const de=V.context,xe=de.gl,Ae=g.fbo;if(!Ae)return;const Re=V.useProgram("hillshade"),je=V.style.map.terrain&&V.style.map.terrain.getTerrainData(d);de.activeTexture.set(xe.TEXTURE0),xe.bindTexture(xe.TEXTURE_2D,Ae.colorAttachment.get());const tt=je?d:null;Re.draw(de,xe.TRIANGLES,j,$,ie,Xa.disabled,Hn(V,g,z,tt),je,z.id,V.rasterBoundsBuffer,V.quadTriangleIndexBuffer,V.rasterBoundsSegments)}function bf(V,d,g,z,j,$){const ie=V.context,de=ie.gl,xe=d.dem;if(xe&&xe.data){const Ae=xe.dim,Re=xe.stride,je=xe.getPixels();if(ie.activeTexture.set(de.TEXTURE1),ie.pixelStoreUnpackPremultiplyAlpha.set(!1),d.demTexture=d.demTexture||V.getTileTexture(Re),d.demTexture){const lt=d.demTexture;lt.update(je,{premultiply:!1}),lt.bind(de.NEAREST,de.CLAMP_TO_EDGE)}else d.demTexture=new D(ie,je,de.RGBA,{premultiply:!1}),d.demTexture.bind(de.NEAREST,de.CLAMP_TO_EDGE);ie.activeTexture.set(de.TEXTURE0);let tt=d.fbo;if(!tt){const lt=new D(ie,{width:Ae,height:Ae,data:null},de.RGBA);lt.bind(de.LINEAR,de.CLAMP_TO_EDGE),tt=d.fbo=ie.createFramebuffer(Ae,Ae,!0,!1),tt.colorAttachment.set(lt.texture)}ie.bindFramebuffer.set(tt.framebuffer),ie.viewport.set([0,0,Ae,Ae]),V.useProgram("hillshadePrepare").draw(ie,de.TRIANGLES,z,j,$,Xa.disabled,Dn(d.tileID,xe),null,g.id,V.rasterBoundsBuffer,V.quadTriangleIndexBuffer,V.rasterBoundsSegments),d.needsHillshadePrepare=!1}}function jl(V,d,g,z,j,$){const ie=z.paint.get("raster-fade-duration");if(!$&&ie>0){const de=v.now(),xe=(de-V.timeAdded)/ie,Ae=d?(de-d.timeAdded)/ie:-1,Re=g.getSource(),je=j.coveringZoomLevel({tileSize:Re.tileSize,roundZoom:Re.roundZoom}),tt=!d||Math.abs(d.tileID.overscaledZ-je)>Math.abs(V.tileID.overscaledZ-je),lt=tt&&V.refreshedUponExpiration?1:i.ad(tt?xe:1-Ae,0,1);return V.refreshedUponExpiration&&xe>=1&&(V.refreshedUponExpiration=!1),d?{opacity:1,mix:1-lt}:{opacity:lt,mix:0}}return{opacity:1,mix:0}}const pu=new i.aN(1,0,0,1),ec=new i.aN(0,1,0,1),Ul=new i.aN(0,0,1,1),ga=new i.aN(1,0,1,1),Rh=new i.aN(0,1,1,1);function Oh(V){const d=V.transform.padding;mh(V,V.transform.height-(d.top||0),3,pu),mh(V,d.bottom||0,3,ec),Ps(V,d.left||0,3,Ul),Ps(V,V.transform.width-(d.right||0),3,ga);const g=V.transform.centerPoint;(function(z,j,$,ie){Qc(z,j-1,$-10,2,20,ie),Qc(z,j-10,$-1,20,2,ie)})(V,g.x,V.transform.height-g.y,Rh)}function mh(V,d,g,z){Qc(V,0,d+g/2,V.transform.width,g,z)}function Ps(V,d,g,z){Qc(V,d-g/2,0,g,V.transform.height,z)}function Qc(V,d,g,z,j,$){const ie=V.context,de=ie.gl;de.enable(de.SCISSOR_TEST),de.scissor(d*V.pixelRatio,g*V.pixelRatio,z*V.pixelRatio,j*V.pixelRatio),ie.clear({color:$}),de.disable(de.SCISSOR_TEST)}function Hf(V,d,g){const z=V.context,j=z.gl,$=g.posMatrix,ie=V.useProgram("debug"),de=Qi.disabled,xe=Za.disabled,Ae=V.colorModeForRenderPass(),Re="$debug",je=V.style.map.terrain&&V.style.map.terrain.getTerrainData(g);z.activeTexture.set(j.TEXTURE0);const tt=d.getTileByID(g.key).latestRawTileData,lt=tt&&tt.byteLength||0,ft=Math.floor(lt/1024),yt=d.getTile(g).tileSize,Ct=512/Math.min(yt,512)*(g.overscaledZ/V.transform.zoom)*.5;let kt=g.canonical.toString();g.overscaledZ!==g.canonical.z&&(kt+=` => ${g.overscaledZ}`),function(Bt,At){Bt.initDebugOverlayCanvas();const $t=Bt.debugOverlayCanvas,Kt=Bt.context.gl,Yt=Bt.debugOverlayCanvas.getContext("2d");Yt.clearRect(0,0,$t.width,$t.height),Yt.shadowColor="white",Yt.shadowBlur=2,Yt.lineWidth=1.5,Yt.strokeStyle="white",Yt.textBaseline="top",Yt.font="bold 36px Open Sans, sans-serif",Yt.fillText(At,5,5),Yt.strokeText(At,5,5),Bt.debugOverlayTexture.update($t),Bt.debugOverlayTexture.bind(Kt.LINEAR,Kt.CLAMP_TO_EDGE)}(V,`${kt} ${ft}kB`),ie.draw(z,j.TRIANGLES,de,xe,Wo.alphaBlended,Xa.disabled,bn($,i.aN.transparent,Ct),null,Re,V.debugBuffer,V.quadTriangleIndexBuffer,V.debugSegments),ie.draw(z,j.LINE_STRIP,de,xe,Ae,Xa.disabled,bn($,i.aN.red),je,Re,V.debugBuffer,V.tileBorderIndexBuffer,V.debugSegments)}function Dc(V,d,g){const z=V.context,j=z.gl,$=V.colorModeForRenderPass(),ie=new Qi(j.LEQUAL,Qi.ReadWrite,V.depthRangeFor3D),de=V.useProgram("terrain"),xe=d.getTerrainMesh();z.bindFramebuffer.set(null),z.viewport.set([0,0,V.width,V.height]);for(const Ae of g){const Re=V.renderToTexture.getTexture(Ae),je=d.getTerrainData(Ae.tileID);z.activeTexture.set(j.TEXTURE0),j.bindTexture(j.TEXTURE_2D,Re.texture);const tt=V.transform.calculatePosMatrix(Ae.tileID.toUnwrapped()),lt=d.getMeshFrameDelta(V.transform.zoom),ft=V.transform.calculateFogMatrix(Ae.tileID.toUnwrapped()),yt=_n(tt,lt,ft,V.style.sky,V.transform.pitch);de.draw(z,j.TRIANGLES,ie,Za.disabled,$,Xa.backCCW,yt,je,"terrain",xe.vertexBuffer,xe.indexBuffer,xe.segments)}}class Rc{constructor(d,g,z){this.vertexBuffer=d,this.indexBuffer=g,this.segments=z}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class Oc{constructor(d,g){this.context=new Zc(d),this.transform=g,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:i.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=qe.maxUnderzooming+qe.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new ar}resize(d,g,z){if(this.width=Math.floor(d*z),this.height=Math.floor(g*z),this.pixelRatio=z,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const j of this.style._order)this.style._layers[j].resize()}setup(){const d=this.context,g=new i.aX;g.emplaceBack(0,0),g.emplaceBack(i.X,0),g.emplaceBack(0,i.X),g.emplaceBack(i.X,i.X),this.tileExtentBuffer=d.createVertexBuffer(g,gr.members),this.tileExtentSegments=i.a0.simpleSegment(0,0,4,2);const z=new i.aX;z.emplaceBack(0,0),z.emplaceBack(i.X,0),z.emplaceBack(0,i.X),z.emplaceBack(i.X,i.X),this.debugBuffer=d.createVertexBuffer(z,gr.members),this.debugSegments=i.a0.simpleSegment(0,0,4,5);const j=new i.$;j.emplaceBack(0,0,0,0),j.emplaceBack(i.X,0,i.X,0),j.emplaceBack(0,i.X,0,i.X),j.emplaceBack(i.X,i.X,i.X,i.X),this.rasterBoundsBuffer=d.createVertexBuffer(j,Fe.members),this.rasterBoundsSegments=i.a0.simpleSegment(0,0,4,2);const $=new i.aX;$.emplaceBack(0,0),$.emplaceBack(1,0),$.emplaceBack(0,1),$.emplaceBack(1,1),this.viewportBuffer=d.createVertexBuffer($,gr.members),this.viewportSegments=i.a0.simpleSegment(0,0,4,2);const ie=new i.aZ;ie.emplaceBack(0),ie.emplaceBack(1),ie.emplaceBack(3),ie.emplaceBack(2),ie.emplaceBack(0),this.tileBorderIndexBuffer=d.createIndexBuffer(ie);const de=new i.aY;de.emplaceBack(0,1,2),de.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=d.createIndexBuffer(de);const xe=this.context.gl;this.stencilClearMode=new Za({func:xe.ALWAYS,mask:0},0,255,xe.ZERO,xe.ZERO,xe.ZERO)}clearStencil(){const d=this.context,g=d.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const z=i.H();i.aQ(z,0,this.width,this.height,0,0,1),i.K(z,z,[g.drawingBufferWidth,g.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(d,g.TRIANGLES,Qi.disabled,this.stencilClearMode,Wo.disabled,Xa.disabled,Fn(z),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(d,g){if(this.currentStencilSource===d.source||!d.isTileClipped()||!g||!g.length)return;this.currentStencilSource=d.source;const z=this.context,j=z.gl;this.nextStencilID+g.length>256&&this.clearStencil(),z.setColorMode(Wo.disabled),z.setDepthMode(Qi.disabled);const $=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const ie of g){const de=this._tileClippingMaskIDs[ie.key]=this.nextStencilID++,xe=this.style.map.terrain&&this.style.map.terrain.getTerrainData(ie);$.draw(z,j.TRIANGLES,Qi.disabled,new Za({func:j.ALWAYS,mask:0},de,255,j.KEEP,j.KEEP,j.REPLACE),Wo.disabled,Xa.disabled,Fn(ie.posMatrix),xe,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const d=this.nextStencilID++,g=this.context.gl;return new Za({func:g.NOTEQUAL,mask:255},d,255,g.KEEP,g.KEEP,g.REPLACE)}stencilModeForClipping(d){const g=this.context.gl;return new Za({func:g.EQUAL,mask:255},this._tileClippingMaskIDs[d.key],0,g.KEEP,g.KEEP,g.REPLACE)}stencilConfigForOverlap(d){const g=this.context.gl,z=d.sort((ie,de)=>de.overscaledZ-ie.overscaledZ),j=z[z.length-1].overscaledZ,$=z[0].overscaledZ-j+1;if($>1){this.currentStencilSource=void 0,this.nextStencilID+$>256&&this.clearStencil();const ie={};for(let de=0;de<$;de++)ie[de+j]=new Za({func:g.GEQUAL,mask:255},de+this.nextStencilID,255,g.KEEP,g.KEEP,g.REPLACE);return this.nextStencilID+=$,[ie,z]}return[{[j]:Za.disabled},z]}colorModeForRenderPass(){const d=this.context.gl;return this._showOverdrawInspector?new Wo([d.CONSTANT_COLOR,d.ONE],new i.aN(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Wo.unblended:Wo.alphaBlended}depthModeForSublayer(d,g,z){if(!this.opaquePassEnabledForLayer())return Qi.disabled;const j=1-((1+this.currentLayer)*this.numSublayers+d)*this.depthEpsilon;return new Qi(z||this.context.gl.LEQUAL,g,[j,j])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(d,g){var z;this.style=d,this.options=g,this.lineAtlas=d.lineAtlas,this.imageManager=d.imageManager,this.glyphManager=d.glyphManager,this.symbolFadeChange=d.placement.symbolFadeChange(v.now()),this.imageManager.beginFrame();const j=this.style._order,$=this.style.sourceCaches,ie={},de={},xe={};for(const Ae in $){const Re=$[Ae];Re.used&&Re.prepare(this.context),ie[Ae]=Re.getVisibleCoordinates(),de[Ae]=ie[Ae].slice().reverse(),xe[Ae]=Re.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let Ae=0;Ae<j.length;Ae++){const Re=j[Ae];if(this.style._layers[Re].is3D()){this.opaquePassCutoff=Ae;break}}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const Ae of j){const Re=this.style._layers[Ae];if(!Re.hasOffscreenPass()||Re.isHidden(this.transform.zoom))continue;const je=de[Re.source];(Re.type==="custom"||je.length)&&this.renderLayer(this,$[Re.source],Re,je)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:g.showOverdrawInspector?i.aN.black:i.aN.transparent,depth:1}),this.clearStencil(),!((z=this.style.stylesheet)===null||z===void 0)&&z.sky&&function(Ae,Re){const je=Ae.context,tt=je.gl,lt=((Bt,At,$t)=>({u_sky_color:Bt.properties.get("sky-color"),u_horizon_color:Bt.properties.get("horizon-color"),u_horizon:(At.height/2+At.getHorizon())*$t,u_sky_horizon_blend:Bt.properties.get("sky-horizon-blend")*At.height/2*$t}))(Re,Ae.style.map.transform,Ae.pixelRatio),ft=new Qi(tt.LEQUAL,Qi.ReadWrite,[0,1]),yt=Za.disabled,Ct=Ae.colorModeForRenderPass(),kt=Ae.useProgram("sky");if(!Re.mesh){const Bt=new i.aX;Bt.emplaceBack(-1,-1),Bt.emplaceBack(1,-1),Bt.emplaceBack(1,1),Bt.emplaceBack(-1,1);const At=new i.aY;At.emplaceBack(0,1,2),At.emplaceBack(0,2,3),Re.mesh=new Rc(je.createVertexBuffer(Bt,gr.members),je.createIndexBuffer(At),i.a0.simpleSegment(0,0,Bt.length,At.length))}kt.draw(je,tt.TRIANGLES,ft,yt,Ct,Xa.disabled,lt,void 0,"sky",Re.mesh.vertexBuffer,Re.mesh.indexBuffer,Re.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=g.showOverdrawInspector,this.depthRangeFor3D=[0,1-(d._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=j.length-1;this.currentLayer>=0;this.currentLayer--){const Ae=this.style._layers[j[this.currentLayer]],Re=$[Ae.source],je=ie[Ae.source];this._renderTileClippingMasks(Ae,je),this.renderLayer(this,Re,Ae,je)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<j.length;this.currentLayer++){const Ae=this.style._layers[j[this.currentLayer]],Re=$[Ae.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(Ae))continue;const je=(Ae.type==="symbol"?xe:de)[Ae.source];this._renderTileClippingMasks(Ae,ie[Ae.source]),this.renderLayer(this,Re,Ae,je)}if(this.options.showTileBoundaries){const Ae=function(Re,je){let tt=null;const lt=Object.values(Re._layers).flatMap(kt=>kt.source&&!kt.isHidden(je)?[Re.sourceCaches[kt.source]]:[]),ft=lt.filter(kt=>kt.getSource().type==="vector"),yt=lt.filter(kt=>kt.getSource().type!=="vector"),Ct=kt=>{(!tt||tt.getSource().maxzoom<kt.getSource().maxzoom)&&(tt=kt)};return ft.forEach(kt=>Ct(kt)),tt||yt.forEach(kt=>Ct(kt)),tt}(this.style,this.transform.zoom);Ae&&function(Re,je,tt){for(let lt=0;lt<tt.length;lt++)Hf(Re,je,tt[lt])}(this,Ae,Ae.getVisibleCoordinates())}this.options.showPadding&&Oh(this),this.context.setDefault()}maybeDrawDepthAndCoords(d){if(!this.style||!this.style.map||!this.style.map.terrain)return;const g=this.terrainFacilitator.matrix,z=this.transform.modelViewProjectionMatrix;let j=this.terrainFacilitator.dirty;j||(j=d?!i.a_(g,z):!i.a$(g,z)),j||(j=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),j&&(i.b0(g,z),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function($,ie){const de=$.context,xe=de.gl,Ae=Wo.unblended,Re=new Qi(xe.LEQUAL,Qi.ReadWrite,[0,1]),je=ie.getTerrainMesh(),tt=ie.sourceCache.getRenderableTiles(),lt=$.useProgram("terrainDepth");de.bindFramebuffer.set(ie.getFramebuffer("depth").framebuffer),de.viewport.set([0,0,$.width/devicePixelRatio,$.height/devicePixelRatio]),de.clear({color:i.aN.transparent,depth:1});for(const ft of tt){const yt=ie.getTerrainData(ft.tileID),Ct={u_matrix:$.transform.calculatePosMatrix(ft.tileID.toUnwrapped()),u_ele_delta:ie.getMeshFrameDelta($.transform.zoom)};lt.draw(de,xe.TRIANGLES,Re,Za.disabled,Ae,Xa.backCCW,Ct,yt,"terrain",je.vertexBuffer,je.indexBuffer,je.segments)}de.bindFramebuffer.set(null),de.viewport.set([0,0,$.width,$.height])}(this,this.style.map.terrain),function($,ie){const de=$.context,xe=de.gl,Ae=Wo.unblended,Re=new Qi(xe.LEQUAL,Qi.ReadWrite,[0,1]),je=ie.getTerrainMesh(),tt=ie.getCoordsTexture(),lt=ie.sourceCache.getRenderableTiles(),ft=$.useProgram("terrainCoords");de.bindFramebuffer.set(ie.getFramebuffer("coords").framebuffer),de.viewport.set([0,0,$.width/devicePixelRatio,$.height/devicePixelRatio]),de.clear({color:i.aN.transparent,depth:1}),ie.coordsIndex=[];for(const yt of lt){const Ct=ie.getTerrainData(yt.tileID);de.activeTexture.set(xe.TEXTURE0),xe.bindTexture(xe.TEXTURE_2D,tt.texture);const kt={u_matrix:$.transform.calculatePosMatrix(yt.tileID.toUnwrapped()),u_terrain_coords_id:(255-ie.coordsIndex.length)/255,u_texture:0,u_ele_delta:ie.getMeshFrameDelta($.transform.zoom)};ft.draw(de,xe.TRIANGLES,Re,Za.disabled,Ae,Xa.backCCW,kt,Ct,"terrain",je.vertexBuffer,je.indexBuffer,je.segments),ie.coordsIndex.push(yt.tileID.key)}de.bindFramebuffer.set(null),de.viewport.set([0,0,$.width,$.height])}(this,this.style.map.terrain))}renderLayer(d,g,z,j){if(!z.isHidden(this.transform.zoom)&&(z.type==="background"||z.type==="custom"||(j||[]).length))switch(this.id=z.id,z.type){case"symbol":Ku(d,g,z,j,this.style.placement.variableOffsets);break;case"circle":(function($,ie,de,xe){if($.renderPass!=="translucent")return;const Ae=de.paint.get("circle-opacity"),Re=de.paint.get("circle-stroke-width"),je=de.paint.get("circle-stroke-opacity"),tt=!de.layout.get("circle-sort-key").isConstant();if(Ae.constantOr(1)===0&&(Re.constantOr(1)===0||je.constantOr(1)===0))return;const lt=$.context,ft=lt.gl,yt=$.depthModeForSublayer(0,Qi.ReadOnly),Ct=Za.disabled,kt=$.colorModeForRenderPass(),Bt=[];for(let At=0;At<xe.length;At++){const $t=xe[At],Kt=ie.getTile($t),Yt=Kt.getBucket(de);if(!Yt)continue;const pn=Yt.programConfigurations.get(de.id),Tn=$.useProgram("circle",pn),Vn=Yt.layoutVertexBuffer,jn=Yt.indexBuffer,$n=$.style.map.terrain&&$.style.map.terrain.getTerrainData($t),er={programConfiguration:pn,program:Tn,layoutVertexBuffer:Vn,indexBuffer:jn,uniformValues:Gn($,$t,Kt,de),terrainData:$n};if(tt){const Tr=Yt.segments.get();for(const rr of Tr)Bt.push({segments:new i.a0([rr]),sortKey:rr.sortKey,state:er})}else Bt.push({segments:Yt.segments,sortKey:0,state:er})}tt&&Bt.sort((At,$t)=>At.sortKey-$t.sortKey);for(const At of Bt){const{programConfiguration:$t,program:Kt,layoutVertexBuffer:Yt,indexBuffer:pn,uniformValues:Tn,terrainData:Vn}=At.state,jn=At.segments;Kt.draw(lt,ft.TRIANGLES,yt,Ct,kt,Xa.disabled,Tn,Vn,de.id,Yt,pn,jn,de.paint,$.transform.zoom,$t)}})(d,g,z,j);break;case"heatmap":Ju(d,g,z,j);break;case"line":(function($,ie,de,xe){if($.renderPass!=="translucent")return;const Ae=de.paint.get("line-opacity"),Re=de.paint.get("line-width");if(Ae.constantOr(1)===0||Re.constantOr(1)===0)return;const je=$.depthModeForSublayer(0,Qi.ReadOnly),tt=$.colorModeForRenderPass(),lt=de.paint.get("line-dasharray"),ft=de.paint.get("line-pattern"),yt=ft.constantOr(1),Ct=de.paint.get("line-gradient"),kt=de.getCrossfadeParameters(),Bt=yt?"linePattern":lt?"lineSDF":Ct?"lineGradient":"line",At=$.context,$t=At.gl;let Kt=!0;for(const Yt of xe){const pn=ie.getTile(Yt);if(yt&&!pn.patternsLoaded())continue;const Tn=pn.getBucket(de);if(!Tn)continue;const Vn=Tn.programConfigurations.get(de.id),jn=$.context.program.get(),$n=$.useProgram(Bt,Vn),er=Kt||$n.program!==jn,Tr=$.style.map.terrain&&$.style.map.terrain.getTerrainData(Yt),rr=ft.constantOr(null);if(rr&&pn.imageAtlas){const Pr=pn.imageAtlas,br=Pr.patternPositions[rr.to.toString()],Nr=Pr.patternPositions[rr.from.toString()];br&&Nr&&Vn.setConstantPatternPositions(br,Nr)}const Ar=Tr?Yt:null,ur=yt?tr($,pn,de,kt,Ar):lt?dr($,pn,de,lt,kt,Ar):Ct?En($,pn,de,Tn.lineClipsArray.length,Ar):cn($,pn,de,Ar);if(yt)At.activeTexture.set($t.TEXTURE0),pn.imageAtlasTexture.bind($t.LINEAR,$t.CLAMP_TO_EDGE),Vn.updatePaintBuffers(kt);else if(lt&&(er||$.lineAtlas.dirty))At.activeTexture.set($t.TEXTURE0),$.lineAtlas.bind(At);else if(Ct){const Pr=Tn.gradients[de.id];let br=Pr.texture;if(de.gradientVersion!==Pr.version){let Nr=256;if(de.stepInterpolant){const li=ie.getSource().maxzoom,Fr=Yt.canonical.z===li?Math.ceil(1<<$.transform.maxZoom-Yt.canonical.z):1,ri=Tn.maxLineLength/i.X*1024*Fr;Nr=i.ad(i.aV(ri),256,At.maxTextureSize)}Pr.gradient=i.aW({expression:de.gradientExpression(),evaluationKey:"lineProgress",resolution:Nr,image:Pr.gradient||void 0,clips:Tn.lineClipsArray}),Pr.texture?Pr.texture.update(Pr.gradient):Pr.texture=new D(At,Pr.gradient,$t.RGBA),Pr.version=de.gradientVersion,br=Pr.texture}At.activeTexture.set($t.TEXTURE0),br.bind(de.stepInterpolant?$t.NEAREST:$t.LINEAR,$t.CLAMP_TO_EDGE)}$n.draw(At,$t.TRIANGLES,je,$.stencilModeForClipping(Yt),tt,Xa.disabled,ur,Tr,de.id,Tn.layoutVertexBuffer,Tn.indexBuffer,Tn.segments,de.paint,$.transform.zoom,Vn,Tn.layoutVertexBuffer2),Kt=!1}})(d,g,z,j);break;case"fill":(function($,ie,de,xe){const Ae=de.paint.get("fill-color"),Re=de.paint.get("fill-opacity");if(Re.constantOr(1)===0)return;const je=$.colorModeForRenderPass(),tt=de.paint.get("fill-pattern"),lt=$.opaquePassEnabledForLayer()&&!tt.constantOr(1)&&Ae.constantOr(i.aN.transparent).a===1&&Re.constantOr(0)===1?"opaque":"translucent";if($.renderPass===lt){const ft=$.depthModeForSublayer(1,$.renderPass==="opaque"?Qi.ReadWrite:Qi.ReadOnly);ph($,ie,de,xe,ft,je,!1)}if($.renderPass==="translucent"&&de.paint.get("fill-antialias")){const ft=$.depthModeForSublayer(de.getPaintProperty("fill-outline-color")?2:0,Qi.ReadOnly);ph($,ie,de,xe,ft,je,!0)}})(d,g,z,j);break;case"fill-extrusion":(function($,ie,de,xe){const Ae=de.paint.get("fill-extrusion-opacity");if(Ae!==0&&$.renderPass==="translucent"){const Re=new Qi($.context.gl.LEQUAL,Qi.ReadWrite,$.depthRangeFor3D);if(Ae!==1||de.paint.get("fill-extrusion-pattern").constantOr(1))Kc($,ie,de,xe,Re,Za.disabled,Wo.disabled),Kc($,ie,de,xe,Re,$.stencilModeFor3D(),$.colorModeForRenderPass());else{const je=$.colorModeForRenderPass();Kc($,ie,de,xe,Re,Za.disabled,je)}}})(d,g,z,j);break;case"hillshade":(function($,ie,de,xe){if($.renderPass!=="offscreen"&&$.renderPass!=="translucent")return;const Ae=$.context,Re=$.depthModeForSublayer(0,Qi.ReadOnly),je=$.colorModeForRenderPass(),[tt,lt]=$.renderPass==="translucent"?$.stencilConfigForOverlap(xe):[{},xe];for(const ft of lt){const yt=ie.getTile(ft);yt.needsHillshadePrepare!==void 0&&yt.needsHillshadePrepare&&$.renderPass==="offscreen"?bf($,yt,de,Re,Za.disabled,je):$.renderPass==="translucent"&&Jc($,ft,yt,de,Re,tt[ft.overscaledZ],je)}Ae.viewport.set([0,0,$.width,$.height])})(d,g,z,j);break;case"raster":(function($,ie,de,xe){if($.renderPass!=="translucent"||de.paint.get("raster-opacity")===0||!xe.length)return;const Ae=$.context,Re=Ae.gl,je=ie.getSource(),tt=$.useProgram("raster"),lt=$.colorModeForRenderPass(),[ft,yt]=je instanceof Le?[{},xe]:$.stencilConfigForOverlap(xe),Ct=yt[yt.length-1].overscaledZ,kt=!$.options.moving;for(const Bt of yt){const At=$.depthModeForSublayer(Bt.overscaledZ-Ct,de.paint.get("raster-opacity")===1?Qi.ReadWrite:Qi.ReadOnly,Re.LESS),$t=ie.getTile(Bt);$t.registerFadeDuration(de.paint.get("raster-fade-duration"));const Kt=ie.findLoadedParent(Bt,0),Yt=ie.findLoadedSibling(Bt),pn=jl($t,Kt||Yt||null,ie,de,$.transform,$.style.map.terrain);let Tn,Vn;const jn=de.paint.get("raster-resampling")==="nearest"?Re.NEAREST:Re.LINEAR;Ae.activeTexture.set(Re.TEXTURE0),$t.texture.bind(jn,Re.CLAMP_TO_EDGE,Re.LINEAR_MIPMAP_NEAREST),Ae.activeTexture.set(Re.TEXTURE1),Kt?(Kt.texture.bind(jn,Re.CLAMP_TO_EDGE,Re.LINEAR_MIPMAP_NEAREST),Tn=Math.pow(2,Kt.tileID.overscaledZ-$t.tileID.overscaledZ),Vn=[$t.tileID.canonical.x*Tn%1,$t.tileID.canonical.y*Tn%1]):$t.texture.bind(jn,Re.CLAMP_TO_EDGE,Re.LINEAR_MIPMAP_NEAREST),$t.texture.useMipmap&&Ae.extTextureFilterAnisotropic&&$.transform.pitch>20&&Re.texParameterf(Re.TEXTURE_2D,Ae.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,Ae.extTextureFilterAnisotropicMax);const $n=$.style.map.terrain&&$.style.map.terrain.getTerrainData(Bt),er=$n?Bt:null,Tr=er?er.posMatrix:$.transform.calculatePosMatrix(Bt.toUnwrapped(),kt),rr=Or(Tr,Vn||[0,0],Tn||1,pn,de);je instanceof Le?tt.draw(Ae,Re.TRIANGLES,At,Za.disabled,lt,Xa.disabled,rr,$n,de.id,je.boundsBuffer,$.quadTriangleIndexBuffer,je.boundsSegments):tt.draw(Ae,Re.TRIANGLES,At,ft[Bt.overscaledZ],lt,Xa.disabled,rr,$n,de.id,$.rasterBoundsBuffer,$.quadTriangleIndexBuffer,$.rasterBoundsSegments)}})(d,g,z,j);break;case"background":(function($,ie,de,xe){const Ae=de.paint.get("background-color"),Re=de.paint.get("background-opacity");if(Re===0)return;const je=$.context,tt=je.gl,lt=$.transform,ft=lt.tileSize,yt=de.paint.get("background-pattern");if($.isPatternMissing(yt))return;const Ct=!yt&&Ae.a===1&&Re===1&&$.opaquePassEnabledForLayer()?"opaque":"translucent";if($.renderPass!==Ct)return;const kt=Za.disabled,Bt=$.depthModeForSublayer(0,Ct==="opaque"?Qi.ReadWrite:Qi.ReadOnly),At=$.colorModeForRenderPass(),$t=$.useProgram(yt?"backgroundPattern":"background"),Kt=xe||lt.coveringTiles({tileSize:ft,terrain:$.style.map.terrain});yt&&(je.activeTexture.set(tt.TEXTURE0),$.imageManager.bind($.context));const Yt=de.getCrossfadeParameters();for(const pn of Kt){const Tn=xe?pn.posMatrix:$.transform.calculatePosMatrix(pn.toUnwrapped()),Vn=yt?fi(Tn,Re,$,yt,{tileID:pn,tileSize:ft},Yt):$r(Tn,Re,Ae),jn=$.style.map.terrain&&$.style.map.terrain.getTerrainData(pn);$t.draw(je,tt.TRIANGLES,Bt,kt,At,Xa.disabled,Vn,jn,de.id,$.tileExtentBuffer,$.quadTriangleIndexBuffer,$.tileExtentSegments)}})(d,0,z,j);break;case"custom":(function($,ie,de){const xe=$.context,Ae=de.implementation;if($.renderPass==="offscreen"){const Re=Ae.prerender;Re&&($.setCustomLayerDefaults(),xe.setColorMode($.colorModeForRenderPass()),Re.call(Ae,xe.gl,$.transform.customLayerMatrix()),xe.setDirty(),$.setBaseState())}else if($.renderPass==="translucent"){$.setCustomLayerDefaults(),xe.setColorMode($.colorModeForRenderPass()),xe.setStencilMode(Za.disabled);const Re=Ae.renderingMode==="3d"?new Qi($.context.gl.LEQUAL,Qi.ReadWrite,$.depthRangeFor3D):$.depthModeForSublayer(0,Qi.ReadOnly);xe.setDepthMode(Re),Ae.render(xe.gl,$.transform.customLayerMatrix(),{farZ:$.transform.farZ,nearZ:$.transform.nearZ,fov:$.transform._fov,modelViewProjectionMatrix:$.transform.modelViewProjectionMatrix,projectionMatrix:$.transform.projectionMatrix}),xe.setDirty(),$.setBaseState(),xe.bindFramebuffer.set(null)}})(d,0,z)}}translatePosMatrix(d,g,z,j,$){if(!z[0]&&!z[1])return d;const ie=$?j==="map"?this.transform.angle:0:j==="viewport"?-this.transform.angle:0;if(ie){const Ae=Math.sin(ie),Re=Math.cos(ie);z=[z[0]*Re-z[1]*Ae,z[0]*Ae+z[1]*Re]}const de=[$?z[0]:Tt(g,z[0],this.transform.zoom),$?z[1]:Tt(g,z[1],this.transform.zoom),0],xe=new Float32Array(16);return i.J(xe,d,de),xe}saveTileTexture(d){const g=this._tileTextures[d.size[0]];g?g.push(d):this._tileTextures[d.size[0]]=[d]}getTileTexture(d){const g=this._tileTextures[d];return g&&g.length>0?g.pop():null}isPatternMissing(d){if(!d)return!1;if(!d.from||!d.to)return!0;const g=this.imageManager.getPattern(d.from.toString()),z=this.imageManager.getPattern(d.to.toString());return!g||!z}useProgram(d,g){this.cache=this.cache||{};const z=d+(g?g.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[z]||(this.cache[z]=new or(this.context,Ir[d],g,Qr[d],this._showOverdrawInspector,this.style.map.terrain)),this.cache[z]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const d=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(d.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;const d=this.context.gl;this.debugOverlayTexture=new D(this.context,this.debugOverlayCanvas,d.RGBA)}}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:d,drawingBufferHeight:g}=this.context.gl;return this.width!==d||this.height!==g}}class mu{constructor(d,g){this.points=d,this.planes=g}static fromInvProjectionMatrix(d,g,z){const j=Math.pow(2,z),$=[[-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(de=>{const xe=1/(de=i.ag([],de,d))[3]/g*j;return i.b1(de,de,[xe,xe,1/de[3],xe])}),ie=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(de=>{const xe=function(tt,lt){var ft=lt[0],yt=lt[1],Ct=lt[2],kt=ft*ft+yt*yt+Ct*Ct;return kt>0&&(kt=1/Math.sqrt(kt)),tt[0]=lt[0]*kt,tt[1]=lt[1]*kt,tt[2]=lt[2]*kt,tt}([],function(tt,lt,ft){var yt=lt[0],Ct=lt[1],kt=lt[2],Bt=ft[0],At=ft[1],$t=ft[2];return tt[0]=Ct*$t-kt*At,tt[1]=kt*Bt-yt*$t,tt[2]=yt*At-Ct*Bt,tt}([],P([],$[de[0]],$[de[1]]),P([],$[de[2]],$[de[1]]))),Ae=(Re=xe,je=$[de[1]],-(Re[0]*je[0]+Re[1]*je[1]+Re[2]*je[2]));var Re,je;return xe.concat(Ae)});return new mu($,ie)}}class Hl{constructor(d,g){this.min=d,this.max=g,this.center=function(z,j,$){return z[0]=j[0]*$,z[1]=j[1]*$,z[2]=j[2]*$,z}([],function(z,j,$){return z[0]=j[0]+$[0],z[1]=j[1]+$[1],z[2]=j[2]+$[2],z}([],this.min,this.max),.5)}quadrant(d){const g=[d%2==0,d<2],z=A(this.min),j=A(this.max);for(let $=0;$<g.length;$++)z[$]=g[$]?this.min[$]:this.center[$],j[$]=g[$]?this.center[$]:this.max[$];return j[2]=this.max[2],new Hl(z,j)}distanceX(d){return Math.max(Math.min(this.max[0],d[0]),this.min[0])-d[0]}distanceY(d){return Math.max(Math.min(this.max[1],d[1]),this.min[1])-d[1]}intersects(d){const g=[[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],1],[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]];let z=!0;for(let j=0;j<d.planes.length;j++){const $=d.planes[j];let ie=0;for(let de=0;de<g.length;de++)i.b2($,g[de])>=0&&ie++;if(ie===0)return 0;ie!==g.length&&(z=!1)}if(z)return 2;for(let j=0;j<3;j++){let $=Number.MAX_VALUE,ie=-Number.MAX_VALUE;for(let de=0;de<d.points.length;de++){const xe=d.points[de][j]-this.min[j];$=Math.min($,xe),ie=Math.max(ie,xe)}if(ie<0||$>this.max[j]-this.min[j])return 0}return 1}}class tc{constructor(d=0,g=0,z=0,j=0){if(isNaN(d)||d<0||isNaN(g)||g<0||isNaN(z)||z<0||isNaN(j)||j<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=d,this.bottom=g,this.left=z,this.right=j}interpolate(d,g,z){return g.top!=null&&d.top!=null&&(this.top=i.z.number(d.top,g.top,z)),g.bottom!=null&&d.bottom!=null&&(this.bottom=i.z.number(d.bottom,g.bottom,z)),g.left!=null&&d.left!=null&&(this.left=i.z.number(d.left,g.left,z)),g.right!=null&&d.right!=null&&(this.right=i.z.number(d.right,g.right,z)),this}getCenter(d,g){const z=i.ad((this.left+d-this.right)/2,0,d),j=i.ad((this.top+g-this.bottom)/2,0,g);return new i.P(z,j)}equals(d){return this.top===d.top&&this.bottom===d.bottom&&this.left===d.left&&this.right===d.right}clone(){return new tc(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const eh=85.051129;class Ia{constructor(d,g,z,j,$){this.tileSize=512,this._renderWorldCopies=$===void 0||!!$,this._minZoom=d||0,this._maxZoom=g||22,this._minPitch=z??0,this._maxPitch=j??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new i.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new tc,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const d=new Ia(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return d.apply(this),d}apply(d){this.tileSize=d.tileSize,this.latRange=d.latRange,this.width=d.width,this.height=d.height,this._center=d._center,this._elevation=d._elevation,this.minElevationForCurrentTile=d.minElevationForCurrentTile,this.zoom=d.zoom,this.angle=d.angle,this._fov=d._fov,this._pitch=d._pitch,this._unmodified=d._unmodified,this._edgeInsets=d._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(d){this._minZoom!==d&&(this._minZoom=d,this.zoom=Math.max(this.zoom,d))}get maxZoom(){return this._maxZoom}set maxZoom(d){this._maxZoom!==d&&(this._maxZoom=d,this.zoom=Math.min(this.zoom,d))}get minPitch(){return this._minPitch}set minPitch(d){this._minPitch!==d&&(this._minPitch=d,this.pitch=Math.max(this.pitch,d))}get maxPitch(){return this._maxPitch}set maxPitch(d){this._maxPitch!==d&&(this._maxPitch=d,this.pitch=Math.min(this.pitch,d))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(d){d===void 0?d=!0:d===null&&(d=!1),this._renderWorldCopies=d}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new i.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(d){const g=-i.b3(d,-180,180)*Math.PI/180;this.angle!==g&&(this._unmodified=!1,this.angle=g,this._calcMatrices(),this.rotationMatrix=function(){var z=new i.A(4);return i.A!=Float32Array&&(z[1]=0,z[2]=0),z[0]=1,z[3]=1,z}(),function(z,j,$){var ie=j[0],de=j[1],xe=j[2],Ae=j[3],Re=Math.sin($),je=Math.cos($);z[0]=ie*je+xe*Re,z[1]=de*je+Ae*Re,z[2]=ie*-Re+xe*je,z[3]=de*-Re+Ae*je}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(d){const g=i.ad(d,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==g&&(this._unmodified=!1,this._pitch=g,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(d){d=Math.max(.01,Math.min(60,d)),this._fov!==d&&(this._unmodified=!1,this._fov=d/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(d){const g=Math.min(Math.max(d,this.minZoom),this.maxZoom);this._zoom!==g&&(this._unmodified=!1,this._zoom=g,this.tileZoom=Math.max(0,Math.floor(g)),this.scale=this.zoomScale(g),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(d){d.lat===this._center.lat&&d.lng===this._center.lng||(this._unmodified=!1,this._center=d,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(d){d!==this._elevation&&(this._elevation=d,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(d){this._edgeInsets.equals(d)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,d,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(d){return this._edgeInsets.equals(d)}interpolatePadding(d,g,z){this._unmodified=!1,this._edgeInsets.interpolate(d,g,z),this._constrain(),this._calcMatrices()}coveringZoomLevel(d){const g=(d.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/d.tileSize));return Math.max(0,g)}getVisibleUnwrappedCoordinates(d){const g=[new i.b4(0,d)];if(this._renderWorldCopies){const z=this.pointCoordinate(new i.P(0,0)),j=this.pointCoordinate(new i.P(this.width,0)),$=this.pointCoordinate(new i.P(this.width,this.height)),ie=this.pointCoordinate(new i.P(0,this.height)),de=Math.floor(Math.min(z.x,j.x,$.x,ie.x)),xe=Math.floor(Math.max(z.x,j.x,$.x,ie.x)),Ae=1;for(let Re=de-Ae;Re<=xe+Ae;Re++)Re!==0&&g.push(new i.b4(Re,d))}return g}coveringTiles(d){var g,z;let j=this.coveringZoomLevel(d);const $=j;if(d.minzoom!==void 0&&j<d.minzoom)return[];d.maxzoom!==void 0&&j>d.maxzoom&&(j=d.maxzoom);const ie=this.pointCoordinate(this.getCameraPoint()),de=i.Z.fromLngLat(this.center),xe=Math.pow(2,j),Ae=[xe*ie.x,xe*ie.y,0],Re=[xe*de.x,xe*de.y,0],je=mu.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,j);let tt=d.minzoom||0;!d.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(tt=j);const lt=d.terrain?2/Math.min(this.tileSize,d.tileSize)*this.tileSize:3,ft=At=>({aabb:new Hl([At*xe,0,0],[(At+1)*xe,xe,0]),zoom:0,x:0,y:0,wrap:At,fullyVisible:!1}),yt=[],Ct=[],kt=j,Bt=d.reparseOverscaled?$:j;if(this._renderWorldCopies)for(let At=1;At<=3;At++)yt.push(ft(-At)),yt.push(ft(At));for(yt.push(ft(0));yt.length>0;){const At=yt.pop(),$t=At.x,Kt=At.y;let Yt=At.fullyVisible;if(!Yt){const er=At.aabb.intersects(je);if(er===0)continue;Yt=er===2}const pn=d.terrain?Ae:Re,Tn=At.aabb.distanceX(pn),Vn=At.aabb.distanceY(pn),jn=Math.max(Math.abs(Tn),Math.abs(Vn)),$n=lt+(1<<kt-At.zoom)-2;if(At.zoom===kt||jn>$n&&At.zoom>=tt){const er=kt-At.zoom,Tr=Ae[0]-.5-($t<<er),rr=Ae[1]-.5-(Kt<<er);Ct.push({tileID:new i.S(At.zoom===kt?Bt:At.zoom,At.wrap,At.zoom,$t,Kt),distanceSq:M([Re[0]-.5-$t,Re[1]-.5-Kt]),tileDistanceToCamera:Math.sqrt(Tr*Tr+rr*rr)})}else for(let er=0;er<4;er++){const Tr=($t<<1)+er%2,rr=(Kt<<1)+(er>>1),Ar=At.zoom+1;let ur=At.aabb.quadrant(er);if(d.terrain){const Pr=new i.S(Ar,At.wrap,Ar,Tr,rr),br=d.terrain.getMinMaxElevation(Pr),Nr=(g=br.minElevation)!==null&&g!==void 0?g:this.elevation,li=(z=br.maxElevation)!==null&&z!==void 0?z:this.elevation;ur=new Hl([ur.min[0],ur.min[1],Nr],[ur.max[0],ur.max[1],li])}yt.push({aabb:ur,zoom:Ar,x:Tr,y:rr,wrap:At.wrap,fullyVisible:Yt})}}return Ct.sort((At,$t)=>At.distanceSq-$t.distanceSq).map(At=>At.tileID)}resize(d,g){this.width=d,this.height=g,this.pixelsToGLUnits=[2/d,-2/g],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(d){return Math.pow(2,d)}scaleZoom(d){return Math.log(d)/Math.LN2}project(d){const g=i.ad(d.lat,-85.051129,eh);return new i.P(i.O(d.lng)*this.worldSize,i.Q(g)*this.worldSize)}unproject(d){return new i.Z(d.x/this.worldSize,d.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(d){const g=this.elevation,z=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,j=this.pointLocation(this.centerPoint,d),$=d.getElevationForLngLatZoom(j,this.tileZoom);if(!(this.elevation-$))return;const ie=z+g-$,de=Math.cos(this._pitch)*this.cameraToCenterDistance/ie/i.b5(1,j.lat)/this.tileSize,xe=this.scaleZoom(de);this._elevation=$,this._center=j,this.zoom=xe}setLocationAtPoint(d,g){const z=this.pointCoordinate(g),j=this.pointCoordinate(this.centerPoint),$=this.locationCoordinate(d),ie=new i.Z($.x-(z.x-j.x),$.y-(z.y-j.y));this.center=this.coordinateLocation(ie),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(d,g){return g?this.coordinatePoint(this.locationCoordinate(d),g.getElevationForLngLatZoom(d,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(d))}pointLocation(d,g){return this.coordinateLocation(this.pointCoordinate(d,g))}locationCoordinate(d){return i.Z.fromLngLat(d)}coordinateLocation(d){return d&&d.toLngLat()}pointCoordinate(d,g){if(g){const ft=g.pointCoordinate(d);if(ft!=null)return ft}const z=[d.x,d.y,0,1],j=[d.x,d.y,1,1];i.ag(z,z,this.pixelMatrixInverse),i.ag(j,j,this.pixelMatrixInverse);const $=z[3],ie=j[3],de=z[0]/$,xe=j[0]/ie,Ae=z[1]/$,Re=j[1]/ie,je=z[2]/$,tt=j[2]/ie,lt=je===tt?0:(0-je)/(tt-je);return new i.Z(i.z.number(de,xe,lt)/this.worldSize,i.z.number(Ae,Re,lt)/this.worldSize)}coordinatePoint(d,g=0,z=this.pixelMatrix){const j=[d.x*this.worldSize,d.y*this.worldSize,g,1];return i.ag(j,j,z),new i.P(j[0]/j[3],j[1]/j[3])}getBounds(){const d=Math.max(0,this.height/2-this.getHorizon());return new Se().extend(this.pointLocation(new i.P(0,d))).extend(this.pointLocation(new i.P(this.width,d))).extend(this.pointLocation(new i.P(this.width,this.height))).extend(this.pointLocation(new i.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Se([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(d){d?(this.lngRange=[d.getWest(),d.getEast()],this.latRange=[d.getSouth(),d.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,eh])}calculateTileMatrix(d){const g=d.canonical,z=this.worldSize/this.zoomScale(g.z),j=g.x+Math.pow(2,g.z)*d.wrap,$=i.ao(new Float64Array(16));return i.J($,$,[j*z,g.y*z,0]),i.K($,$,[z/i.X,z/i.X,1]),$}calculatePosMatrix(d,g=!1){const z=d.key,j=g?this._alignedPosMatrixCache:this._posMatrixCache;if(j[z])return j[z];const $=this.calculateTileMatrix(d);return i.L($,g?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,$),j[z]=new Float32Array($),j[z]}calculateFogMatrix(d){const g=d.key,z=this._fogMatrixCache;if(z[g])return z[g];const j=this.calculateTileMatrix(d);return i.L(j,this.fogMatrix,j),z[g]=new Float32Array(j),z[g]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(d,g){g=i.ad(+g,this.minZoom,this.maxZoom);const z={center:new i.N(d.lng,d.lat),zoom:g};let j=this.lngRange;if(!this._renderWorldCopies&&j===null){const At=179.9999999999;j=[-At,At]}const $=this.tileSize*this.zoomScale(z.zoom);let ie=0,de=$,xe=0,Ae=$,Re=0,je=0;const{x:tt,y:lt}=this.size;if(this.latRange){const At=this.latRange;ie=i.Q(At[1])*$,de=i.Q(At[0])*$,de-ie<lt&&(Re=lt/(de-ie))}j&&(xe=i.b3(i.O(j[0])*$,0,$),Ae=i.b3(i.O(j[1])*$,0,$),Ae<xe&&(Ae+=$),Ae-xe<tt&&(je=tt/(Ae-xe)));const{x:ft,y:yt}=this.project.call({worldSize:$},d);let Ct,kt;const Bt=Math.max(je||0,Re||0);if(Bt){const At=new i.P(je?(Ae+xe)/2:ft,Re?(de+ie)/2:yt);return z.center=this.unproject.call({worldSize:$},At).wrap(),z.zoom+=this.scaleZoom(Bt),z}if(this.latRange){const At=lt/2;yt-At<ie&&(kt=ie+At),yt+At>de&&(kt=de-At)}if(j){const At=(xe+Ae)/2;let $t=ft;this._renderWorldCopies&&($t=i.b3(ft,At-$/2,At+$/2));const Kt=tt/2;$t-Kt<xe&&(Ct=xe+Kt),$t+Kt>Ae&&(Ct=Ae-Kt)}if(Ct!==void 0||kt!==void 0){const At=new i.P(Ct??ft,kt??yt);z.center=this.unproject.call({worldSize:$},At).wrap()}return z}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const d=this._unmodified,{center:g,zoom:z}=this.getConstrained(this.center,this.zoom);this.center=g,this.zoom=z,this._unmodified=d,this._constraining=!1}_calcMatrices(){if(!this.height)return;const d=this._fov/2,g=this.centerOffset,z=this.point.x,j=this.point.y;this.cameraToCenterDistance=.5/Math.tan(d)*this.height,this._pixelPerMeter=i.b5(1,this.center.lat)*this.worldSize;let $=i.ao(new Float64Array(16));i.K($,$,[this.width/2,-this.height/2,1]),i.J($,$,[1,-1,0]),this.labelPlaneMatrix=$,$=i.ao(new Float64Array(16)),i.K($,$,[1,-1,1]),i.J($,$,[-1,-1,0]),i.K($,$,[2/this.width,2/this.height,1]),this.glCoordMatrix=$;const ie=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),de=Math.min(this.elevation,this.minElevationForCurrentTile),xe=ie-de*this._pixelPerMeter/Math.cos(this._pitch),Ae=de<0?xe:ie,Re=Math.PI/2+this._pitch,je=this._fov*(.5+g.y/this.height),tt=Math.sin(je)*Ae/Math.sin(i.ad(Math.PI-Re-je,.01,Math.PI-.01)),lt=this.getHorizon(),ft=2*Math.atan(lt/this.cameraToCenterDistance)*(.5+g.y/(2*lt)),yt=Math.sin(ft)*Ae/Math.sin(i.ad(Math.PI-Re-ft,.01,Math.PI-.01)),Ct=Math.min(tt,yt);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*Ct+Ae),this.nearZ=this.height/50,$=new Float64Array(16),i.b6($,this._fov,this.width/this.height,this.nearZ,this.farZ),$[8]=2*-g.x/this.width,$[9]=2*g.y/this.height,this.projectionMatrix=i.af($),i.K($,$,[1,-1,1]),i.J($,$,[0,0,-this.cameraToCenterDistance]),i.b7($,$,this._pitch),i.ae($,$,this.angle),i.J($,$,[-z,-j,0]),this.mercatorMatrix=i.K([],$,[this.worldSize,this.worldSize,this.worldSize]),i.K($,$,[1,1,this._pixelPerMeter]),this.pixelMatrix=i.L(new Float64Array(16),this.labelPlaneMatrix,$),i.J($,$,[0,0,-this.elevation]),this.modelViewProjectionMatrix=$,this.invModelViewProjectionMatrix=i.at([],$),this.fogMatrix=new Float64Array(16),i.b6(this.fogMatrix,this._fov,this.width/this.height,ie,this.farZ),this.fogMatrix[8]=2*-g.x/this.width,this.fogMatrix[9]=2*g.y/this.height,i.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),i.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),i.b7(this.fogMatrix,this.fogMatrix,this._pitch),i.ae(this.fogMatrix,this.fogMatrix,this.angle),i.J(this.fogMatrix,this.fogMatrix,[-z,-j,0]),i.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),i.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=i.L(new Float64Array(16),this.labelPlaneMatrix,$);const kt=this.width%2/2,Bt=this.height%2/2,At=Math.cos(this.angle),$t=Math.sin(this.angle),Kt=z-Math.round(z)+At*kt+$t*Bt,Yt=j-Math.round(j)+At*Bt+$t*kt,pn=new Float64Array($);if(i.J(pn,pn,[Kt>.5?Kt-1:Kt,Yt>.5?Yt-1:Yt,0]),this.alignedModelViewProjectionMatrix=pn,$=i.at(new Float64Array(16),this.pixelMatrix),!$)throw new Error("failed to invert matrix");this.pixelMatrixInverse=$,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const d=this.pointCoordinate(new i.P(0,0)),g=[d.x*this.worldSize,d.y*this.worldSize,0,1];return i.ag(g,g,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const d=this._pitch,g=Math.tan(d)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.P(0,g))}getCameraQueryGeometry(d){const g=this.getCameraPoint();if(d.length===1)return[d[0],g];{let z=g.x,j=g.y,$=g.x,ie=g.y;for(const de of d)z=Math.min(z,de.x),j=Math.min(j,de.y),$=Math.max($,de.x),ie=Math.max(ie,de.y);return[new i.P(z,j),new i.P($,j),new i.P($,ie),new i.P(z,ie),new i.P(z,j)]}}lngLatToCameraDepth(d,g){const z=this.locationCoordinate(d),j=[z.x*this.worldSize,z.y*this.worldSize,g,1];return i.ag(j,j,this.modelViewProjectionMatrix),j[2]/j[3]}}function gu(V,d){let g,z=!1,j=null,$=null;const ie=()=>{j=null,z&&(V.apply($,g),j=setTimeout(ie,d),z=!1)};return(...de)=>(z=!0,$=this,g=de,j||ie(),j)}class Go{constructor(d){this._getCurrentHash=()=>{const g=window.location.hash.replace("#","");if(this._hashName){let z;return g.split("&").map(j=>j.split("=")).forEach(j=>{j[0]===this._hashName&&(z=j)}),(z&&z[1]||"").split("/")}return g.split("/")},this._onHashChange=()=>{const g=this._getCurrentHash();if(g.length>=3&&!g.some(z=>isNaN(z))){const z=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(g[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+g[2],+g[1]],zoom:+g[0],bearing:z,pitch:+(g[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const g=window.location.href.replace(/(#.+)?$/,this.getHashString());window.history.replaceState(window.history.state,null,g)},this._removeHash=()=>{const g=this._getCurrentHash();if(g.length===0)return;const z=g.join("/");let j=z;j.split("&").length>0&&(j=j.split("&")[0]),this._hashName&&(j=`${this._hashName}=${z}`);let $=window.location.hash.replace(j,"");$.startsWith("#&")?$=$.slice(0,1)+$.slice(2):$==="#"&&($="");let ie=window.location.href.replace(/(#.+)?$/,$);ie=ie.replace("&&","&"),window.history.replaceState(window.history.state,null,ie)},this._updateHash=gu(this._updateHashUnthrottled,300),this._hashName=d&&encodeURIComponent(d)}addTo(d){return this._map=d,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(d){const g=this._map.getCenter(),z=Math.round(100*this._map.getZoom())/100,j=Math.ceil((z*Math.LN2+Math.log(512/360/.5))/Math.LN10),$=Math.pow(10,j),ie=Math.round(g.lng*$)/$,de=Math.round(g.lat*$)/$,xe=this._map.getBearing(),Ae=this._map.getPitch();let Re="";if(Re+=d?`/${ie}/${de}/${z}`:`${z}/${de}/${ie}`,(xe||Ae)&&(Re+="/"+Math.round(10*xe)/10),Ae&&(Re+=`/${Math.round(Ae)}`),this._hashName){const je=this._hashName;let tt=!1;const lt=window.location.hash.slice(1).split("&").map(ft=>{const yt=ft.split("=")[0];return yt===je?(tt=!0,`${yt}=${Re}`):ft}).filter(ft=>ft);return tt||lt.push(`${je}=${Re}`),`#${lt.join("&")}`}return`#${Re}`}}const nl={linearity:.3,easing:i.b8(0,0,.3,1)},Sa=i.e({deceleration:2500,maxSpeed:1400},nl),La=i.e({deceleration:20,maxSpeed:1400},nl),ql=i.e({deceleration:1e3,maxSpeed:360},nl),th=i.e({deceleration:1e3,maxSpeed:90},nl);class zc{constructor(d){this._map=d,this.clear()}clear(){this._inertiaBuffer=[]}record(d){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:v.now(),settings:d})}_drainInertiaBuffer(){const d=this._inertiaBuffer,g=v.now();for(;d.length>0&&g-d[0].time>160;)d.shift()}_onMoveEnd(d){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const g={zoom:0,bearing:0,pitch:0,pan:new i.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:$}of this._inertiaBuffer)g.zoom+=$.zoomDelta||0,g.bearing+=$.bearingDelta||0,g.pitch+=$.pitchDelta||0,$.panDelta&&g.pan._add($.panDelta),$.around&&(g.around=$.around),$.pinchAround&&(g.pinchAround=$.pinchAround);const z=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,j={};if(g.pan.mag()){const $=vc(g.pan.mag(),z,i.e({},Sa,d||{}));j.offset=g.pan.mult($.amount/g.pan.mag()),j.center=this._map.transform.center,gc(j,$)}if(g.zoom){const $=vc(g.zoom,z,La);j.zoom=this._map.transform.zoom+$.amount,gc(j,$)}if(g.bearing){const $=vc(g.bearing,z,ql);j.bearing=this._map.transform.bearing+i.ad($.amount,-179,179),gc(j,$)}if(g.pitch){const $=vc(g.pitch,z,th);j.pitch=this._map.transform.pitch+$.amount,gc(j,$)}if(j.zoom||j.bearing){const $=g.pinchAround===void 0?g.around:g.pinchAround;j.around=$?this._map.unproject($):this._map.getCenter()}return this.clear(),i.e(j,{noMoveStart:!0})}}function gc(V,d){(!V.duration||V.duration<d.duration)&&(V.duration=d.duration,V.easing=d.easing)}function vc(V,d,g){const{maxSpeed:z,linearity:j,deceleration:$}=g,ie=i.ad(V*j/(d/1e3),-z,z),de=Math.abs(ie)/($*j);return{easing:g.easing,duration:1e3*de,amount:ie*(de/2)}}class Ds extends i.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,g,z,j={}){const $=o.mousePos(g.getCanvas(),z),ie=g.unproject($);super(d,i.e({point:$,lngLat:ie,originalEvent:z},j)),this._defaultPrevented=!1,this.target=g}}class ys extends i.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,g,z){const j=d==="touchend"?z.changedTouches:z.touches,$=o.touchPos(g.getCanvasContainer(),j),ie=$.map(xe=>g.unproject(xe)),de=$.reduce((xe,Ae,Re,je)=>xe.add(Ae.div(je.length)),new i.P(0,0));super(d,{points:$,point:de,lngLats:ie,lngLat:g.unproject(de),originalEvent:z}),this._defaultPrevented=!1}}class Mu extends i.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,g,z){super(d,{originalEvent:z}),this._defaultPrevented=!1}}class Fc{constructor(d,g){this._map=d,this._clickTolerance=g.clickTolerance}reset(){delete this._mousedownPos}wheel(d){return this._firePreventable(new Mu(d.type,this._map,d))}mousedown(d,g){return this._mousedownPos=g,this._firePreventable(new Ds(d.type,this._map,d))}mouseup(d){this._map.fire(new Ds(d.type,this._map,d))}click(d,g){this._mousedownPos&&this._mousedownPos.dist(g)>=this._clickTolerance||this._map.fire(new Ds(d.type,this._map,d))}dblclick(d){return this._firePreventable(new Ds(d.type,this._map,d))}mouseover(d){this._map.fire(new Ds(d.type,this._map,d))}mouseout(d){this._map.fire(new Ds(d.type,this._map,d))}touchstart(d){return this._firePreventable(new ys(d.type,this._map,d))}touchmove(d){this._map.fire(new ys(d.type,this._map,d))}touchend(d){this._map.fire(new ys(d.type,this._map,d))}touchcancel(d){this._map.fire(new ys(d.type,this._map,d))}_firePreventable(d){if(this._map.fire(d),d.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vs{constructor(d){this._map=d}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(d){this._map.fire(new Ds(d.type,this._map,d))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ds("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(d){this._delayContextMenu?this._contextMenuEvent=d:this._ignoreContextMenu||this._map.fire(new Ds(d.type,this._map,d)),this._map.listens("contextmenu")&&d.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class io{constructor(d){this._map=d}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(d){return this.transform.pointLocation(i.P.convert(d),this._map.terrain)}}class bs{constructor(d,g){this._map=d,this._tr=new io(d),this._el=d.getCanvasContainer(),this._container=d.getContainer(),this._clickTolerance=g.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(d,g){this.isEnabled()&&d.shiftKey&&d.button===0&&(o.disableDrag(),this._startPos=this._lastPos=g,this._active=!0)}mousemoveWindow(d,g){if(!this._active)return;const z=g;if(this._lastPos.equals(z)||!this._box&&z.dist(this._startPos)<this._clickTolerance)return;const j=this._startPos;this._lastPos=z,this._box||(this._box=o.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",d));const $=Math.min(j.x,z.x),ie=Math.max(j.x,z.x),de=Math.min(j.y,z.y),xe=Math.max(j.y,z.y);o.setTransform(this._box,`translate(${$}px,${de}px)`),this._box.style.width=ie-$+"px",this._box.style.height=xe-de+"px"}mouseupWindow(d,g){if(!this._active||d.button!==0)return;const z=this._startPos,j=g;if(this.reset(),o.suppressClick(),z.x!==j.x||z.y!==j.y)return this._map.fire(new i.k("boxzoomend",{originalEvent:d})),{cameraAnimation:$=>$.fitScreenCoordinates(z,j,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",d)}keydown(d){this._active&&d.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",d))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(o.remove(this._box),this._box=null),o.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(d,g){return this._map.fire(new i.k(d,{originalEvent:g}))}}function Ba(V,d){if(V.length!==d.length)throw new Error(`The number of touches and points are not equal - touches ${V.length}, points ${d.length}`);const g={};for(let z=0;z<V.length;z++)g[V[z].identifier]=d[z];return g}class $o{constructor(d){this.reset(),this.numTouches=d.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(d,g,z){(this.centroid||z.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=d.timeStamp),z.length===this.numTouches&&(this.centroid=function(j){const $=new i.P(0,0);for(const ie of j)$._add(ie);return $.div(j.length)}(g),this.touches=Ba(z,g)))}touchmove(d,g,z){if(this.aborted||!this.centroid)return;const j=Ba(z,g);for(const $ in this.touches){const ie=this.touches[$],de=j[$];(!de||de.dist(ie)>30)&&(this.aborted=!0)}}touchend(d,g,z){if((!this.centroid||d.timeStamp-this.startTime>500)&&(this.aborted=!0),z.length===0){const j=!this.aborted&&this.centroid;if(this.reset(),j)return j}}}class Na{constructor(d){this.singleTap=new $o(d),this.numTaps=d.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(d,g,z){this.singleTap.touchstart(d,g,z)}touchmove(d,g,z){this.singleTap.touchmove(d,g,z)}touchend(d,g,z){const j=this.singleTap.touchend(d,g,z);if(j){const $=d.timeStamp-this.lastTime<500,ie=!this.lastTap||this.lastTap.dist(j)<30;if($&&ie||this.reset(),this.count++,this.lastTime=d.timeStamp,this.lastTap=j,this.count===this.numTaps)return this.reset(),j}}}class is{constructor(d){this._tr=new io(d),this._zoomIn=new Na({numTouches:1,numTaps:2}),this._zoomOut=new Na({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(d,g,z){this._zoomIn.touchstart(d,g,z),this._zoomOut.touchstart(d,g,z)}touchmove(d,g,z){this._zoomIn.touchmove(d,g,z),this._zoomOut.touchmove(d,g,z)}touchend(d,g,z){const j=this._zoomIn.touchend(d,g,z),$=this._zoomOut.touchend(d,g,z),ie=this._tr;return j?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:de=>de.easeTo({duration:300,zoom:ie.zoom+1,around:ie.unproject(j)},{originalEvent:d})}):$?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:de=>de.easeTo({duration:300,zoom:ie.zoom-1,around:ie.unproject($)},{originalEvent:d})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class xs{constructor(d){this._enabled=!!d.enable,this._moveStateManager=d.moveStateManager,this._clickTolerance=d.clickTolerance||1,this._moveFunction=d.move,this._activateOnStart=!!d.activateOnStart,d.assignEvents(this),this.reset()}reset(d){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(d)}_move(...d){const g=this._moveFunction(...d);if(g.bearingDelta||g.pitchDelta||g.around||g.panDelta)return this._active=!0,g}dragStart(d,g){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(d)&&(this._moveStateManager.startMove(d),this._lastPoint=g.length?g[0]:g,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(d,g){if(!this.isEnabled())return;const z=this._lastPoint;if(!z)return;if(d.preventDefault(),!this._moveStateManager.isValidMoveEvent(d))return void this.reset(d);const j=g.length?g[0]:g;return!this._moved&&j.dist(z)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=j,this._move(z,j))}dragEnd(d){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(d)&&(this._moved&&o.suppressClick(),this.reset(d))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Eu={0:1,2:2};class ml{constructor(d){this._correctEvent=d.checkCorrectEvent}startMove(d){const g=o.mouseButton(d);this._eventButton=g}endMove(d){delete this._eventButton}isValidStartEvent(d){return this._correctEvent(d)}isValidMoveEvent(d){return!function(g,z){const j=Eu[z];return g.buttons===void 0||(g.buttons&j)!==j}(d,this._eventButton)}isValidEndEvent(d){return o.mouseButton(d)===this._eventButton}}class nc{constructor(){this._firstTouch=void 0}_isOneFingerTouch(d){return d.targetTouches.length===1}_isSameTouchEvent(d){return d.targetTouches[0].identifier===this._firstTouch}startMove(d){const g=d.targetTouches[0].identifier;this._firstTouch=g}endMove(d){delete this._firstTouch}isValidStartEvent(d){return this._isOneFingerTouch(d)}isValidMoveEvent(d){return this._isOneFingerTouch(d)&&this._isSameTouchEvent(d)}isValidEndEvent(d){return this._isOneFingerTouch(d)&&this._isSameTouchEvent(d)}}const Rs=V=>{V.mousedown=V.dragStart,V.mousemoveWindow=V.dragMove,V.mouseup=V.dragEnd,V.contextmenu=d=>{d.preventDefault()}},yc=({enable:V,clickTolerance:d,bearingDegreesPerPixelMoved:g=.8})=>{const z=new ml({checkCorrectEvent:j=>o.mouseButton(j)===0&&j.ctrlKey||o.mouseButton(j)===2});return new xs({clickTolerance:d,move:(j,$)=>({bearingDelta:($.x-j.x)*g}),moveStateManager:z,enable:V,assignEvents:Rs})},Iu=({enable:V,clickTolerance:d,pitchDegreesPerPixelMoved:g=-.5})=>{const z=new ml({checkCorrectEvent:j=>o.mouseButton(j)===0&&j.ctrlKey||o.mouseButton(j)===2});return new xs({clickTolerance:d,move:(j,$)=>({pitchDelta:($.y-j.y)*g}),moveStateManager:z,enable:V,assignEvents:Rs})};class Wl{constructor(d,g){this._clickTolerance=d.clickTolerance||1,this._map=g,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new i.P(0,0)}_shouldBePrevented(d){return d<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(d,g,z){return this._calculateTransform(d,g,z)}touchmove(d,g,z){if(this._active){if(!this._shouldBePrevented(z.length))return d.preventDefault(),this._calculateTransform(d,g,z);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",d)}}touchend(d,g,z){this._calculateTransform(d,g,z),this._active&&this._shouldBePrevented(z.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(d,g,z){z.length>0&&(this._active=!0);const j=Ba(z,g),$=new i.P(0,0),ie=new i.P(0,0);let de=0;for(const Ae in j){const Re=j[Ae],je=this._touches[Ae];je&&($._add(Re),ie._add(Re.sub(je)),de++,j[Ae]=Re)}if(this._touches=j,this._shouldBePrevented(de)||!ie.mag())return;const xe=ie.div(de);return this._sum._add(xe),this._sum.mag()<this._clickTolerance?void 0:{around:$.div(de),panDelta:xe}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class as{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(d,g,z){this._firstTwoTouches||z.length<2||(this._firstTwoTouches=[z[0].identifier,z[1].identifier],this._start([g[0],g[1]]))}touchmove(d,g,z){if(!this._firstTwoTouches)return;d.preventDefault();const[j,$]=this._firstTwoTouches,ie=qa(z,g,j),de=qa(z,g,$);if(!ie||!de)return;const xe=this._aroundCenter?null:ie.add(de).div(2);return this._move([ie,de],xe,d)}touchend(d,g,z){if(!this._firstTwoTouches)return;const[j,$]=this._firstTwoTouches,ie=qa(z,g,j),de=qa(z,g,$);ie&&de||(this._active&&o.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(d){this._enabled=!0,this._aroundCenter=!!d&&d.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function qa(V,d,g){for(let z=0;z<V.length;z++)if(V[z].identifier===g)return d[z]}function Gl(V,d){return Math.log(V/d)/Math.LN2}class ki extends as{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(d){this._startDistance=this._distance=d[0].dist(d[1])}_move(d,g){const z=this._distance;if(this._distance=d[0].dist(d[1]),this._active||!(Math.abs(Gl(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Gl(this._distance,z),pinchAround:g}}}function nh(V,d){return 180*V.angleWith(d)/Math.PI}class zh extends as{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(d){this._startVector=this._vector=d[0].sub(d[1]),this._minDiameter=d[0].dist(d[1])}_move(d,g,z){const j=this._vector;if(this._vector=d[0].sub(d[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:nh(this._vector,j),pinchAround:g}}_isBelowThreshold(d){this._minDiameter=Math.min(this._minDiameter,d.mag());const g=25/(Math.PI*this._minDiameter)*360,z=nh(d,this._startVector);return Math.abs(z)<g}}function Lu(V){return Math.abs(V.y)>Math.abs(V.x)}class rc extends as{constructor(d){super(),this._currentTouchCount=0,this._map=d}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(d,g,z){super.touchstart(d,g,z),this._currentTouchCount=z.length}_start(d){this._lastPoints=d,Lu(d[0].sub(d[1]))&&(this._valid=!1)}_move(d,g,z){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const j=d[0].sub(this._lastPoints[0]),$=d[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(j,$,z.timeStamp),this._valid?(this._lastPoints=d,this._active=!0,{pitchDelta:(j.y+$.y)/2*-.5}):void 0}gestureBeginsVertically(d,g,z){if(this._valid!==void 0)return this._valid;const j=d.mag()>=2,$=g.mag()>=2;if(!j&&!$)return;if(!j||!$)return this._firstMove===void 0&&(this._firstMove=z),z-this._firstMove<100&&void 0;const ie=d.y>0==g.y>0;return Lu(d)&&Lu(g)&&ie}}const ic={panStep:100,bearingStep:15,pitchStep:10};class Bc{constructor(d){this._tr=new io(d);const g=ic;this._panStep=g.panStep,this._bearingStep=g.bearingStep,this._pitchStep=g.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(d){if(d.altKey||d.ctrlKey||d.metaKey)return;let g=0,z=0,j=0,$=0,ie=0;switch(d.keyCode){case 61:case 107:case 171:case 187:g=1;break;case 189:case 109:case 173:g=-1;break;case 37:d.shiftKey?z=-1:(d.preventDefault(),$=-1);break;case 39:d.shiftKey?z=1:(d.preventDefault(),$=1);break;case 38:d.shiftKey?j=1:(d.preventDefault(),ie=-1);break;case 40:d.shiftKey?j=-1:(d.preventDefault(),ie=1);break;default:return}return this._rotationDisabled&&(z=0,j=0),{cameraAnimation:de=>{const xe=this._tr;de.easeTo({duration:300,easeId:"keyboardHandler",easing:si,zoom:g?Math.round(xe.zoom)+g*(d.shiftKey?2:1):xe.zoom,bearing:xe.bearing+z*this._bearingStep,pitch:xe.pitch+j*this._pitchStep,offset:[-$*this._panStep,-ie*this._panStep],center:xe.center},{originalEvent:d})}}}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 si(V){return V*(2-V)}const vl=4.000244140625;class Pu{constructor(d,g){this._onTimeout=z=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(z)},this._map=d,this._tr=new io(d),this._triggerRenderFrame=g,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(d){this._defaultZoomRate=d}setWheelZoomRate(d){this._wheelZoomRate=d}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(d){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!d&&d.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(d){return!!this._map.cooperativeGestures.isEnabled()&&!(d.ctrlKey||this._map.cooperativeGestures.isBypassed(d))}wheel(d){if(!this.isEnabled())return;if(this._shouldBePrevented(d))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",d);let g=d.deltaMode===WheelEvent.DOM_DELTA_LINE?40*d.deltaY:d.deltaY;const z=v.now(),j=z-(this._lastWheelEventTime||0);this._lastWheelEventTime=z,g!==0&&g%vl==0?this._type="wheel":g!==0&&Math.abs(g)<4?this._type="trackpad":j>400?(this._type=null,this._lastValue=g,this._timeout=setTimeout(this._onTimeout,40,d)):this._type||(this._type=Math.abs(j*g)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,g+=this._lastValue)),d.shiftKey&&g&&(g/=4),this._type&&(this._lastWheelEvent=d,this._delta-=g,this._active||this._start(d)),d.preventDefault()}_start(d){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const g=o.mousePos(this._map.getCanvas(),d),z=this._tr;g.y>z.transform.height/2-z.transform.getHorizon()?this._around=i.N.convert(this._aroundCenter?z.center:z.unproject(g)):this._around=i.N.convert(z.center),this._aroundPoint=z.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const d=this._tr.transform;if(this._delta!==0){const xe=this._type==="wheel"&&Math.abs(this._delta)>vl?this._wheelZoomRate:this._defaultZoomRate;let Ae=2/(1+Math.exp(-Math.abs(this._delta*xe)));this._delta<0&&Ae!==0&&(Ae=1/Ae);const Re=typeof this._targetZoom=="number"?d.zoomScale(this._targetZoom):d.scale;this._targetZoom=Math.min(d.maxZoom,Math.max(d.minZoom,d.scaleZoom(Re*Ae))),this._type==="wheel"&&(this._startZoom=d.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const g=typeof this._targetZoom=="number"?this._targetZoom:d.zoom,z=this._startZoom,j=this._easing;let $,ie=!1;const de=v.now()-this._lastWheelEventTime;if(this._type==="wheel"&&z&&j&&de){const xe=Math.min(de/200,1),Ae=j(xe);$=i.z.number(z,g,Ae),xe<1?this._frameId||(this._frameId=!0):ie=!0}else $=g,ie=!0;return this._active=!0,ie&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!ie,zoomDelta:$-d.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(d){let g=i.b9;if(this._prevEase){const z=this._prevEase,j=(v.now()-z.start)/z.duration,$=z.easing(j+.01)-z.easing(j),ie=.27/Math.sqrt($*$+1e-4)*.01,de=Math.sqrt(.0729-ie*ie);g=i.b8(ie,de,.25,1)}return this._prevEase={start:v.now(),duration:d,easing:g},g}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ao{constructor(d,g){this._clickZoom=d,this._tapZoom=g}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 rl{constructor(d){this._tr=new io(d),this.reset()}reset(){this._active=!1}dblclick(d,g){return d.preventDefault(),{cameraAnimation:z=>{z.easeTo({duration:300,zoom:this._tr.zoom+(d.shiftKey?-1:1),around:this._tr.unproject(g)},{originalEvent:d})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Du{constructor(){this._tap=new Na({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(d,g,z){if(!this._swipePoint)if(this._tapTime){const j=g[0],$=d.timeStamp-this._tapTime<500,ie=this._tapPoint.dist(j)<30;$&&ie?z.length>0&&(this._swipePoint=j,this._swipeTouch=z[0].identifier):this.reset()}else this._tap.touchstart(d,g,z)}touchmove(d,g,z){if(this._tapTime){if(this._swipePoint){if(z[0].identifier!==this._swipeTouch)return;const j=g[0],$=j.y-this._swipePoint.y;return this._swipePoint=j,d.preventDefault(),this._active=!0,{zoomDelta:$/128}}}else this._tap.touchmove(d,g,z)}touchend(d,g,z){if(this._tapTime)this._swipePoint&&z.length===0&&this.reset();else{const j=this._tap.touchend(d,g,z);j&&(this._tapTime=d.timeStamp,this._tapPoint=j)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $l{constructor(d,g,z){this._el=d,this._mousePan=g,this._touchPan=z}enable(d){this._inertiaOptions=d||{},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 js{constructor(d,g,z){this._pitchWithRotate=d.pitchWithRotate,this._mouseRotate=g,this._mousePitch=z}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 Ru{constructor(d,g,z,j){this._el=d,this._touchZoom=g,this._touchRotate=z,this._tapDragZoom=j,this._rotationDisabled=!1,this._enabled=!0}enable(d){this._touchZoom.enable(d),this._rotationDisabled||this._touchRotate.enable(d),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 Ml{constructor(d,g){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=d,this._options=g,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const d=this._map.getCanvasContainer();d.classList.add("maplibregl-cooperative-gestures"),this._container=o.create("div","maplibregl-cooperative-gesture-screen",d);let g=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(g=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const z=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),j=document.createElement("div");j.className="maplibregl-desktop-message",j.textContent=g,this._container.appendChild(j);const $=document.createElement("div");$.className="maplibregl-mobile-message",$.textContent=z,this._container.appendChild($),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(o.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(d){return d[this._bypassKey]}notifyGestureBlocked(d,g){this._enabled&&(this._map.fire(new i.k("cooperativegestureprevented",{gestureType:d,originalEvent:g})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const il=V=>V.zoom||V.drag||V.pitch||V.rotate;class Yl extends i.k{}function bi(V){return V.panDelta&&V.panDelta.mag()||V.zoomDelta||V.bearingDelta||V.pitchDelta}class ba{constructor(d,g){this.handleWindowEvent=j=>{this.handleEvent(j,`${j.type}Window`)},this.handleEvent=(j,$)=>{if(j.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const ie=j.type==="renderFrame"?void 0:j,de={needsRenderFrame:!1},xe={},Ae={},Re=j.touches,je=Re?this._getMapTouches(Re):void 0,tt=je?o.touchPos(this._map.getCanvas(),je):o.mousePos(this._map.getCanvas(),j);for(const{handlerName:yt,handler:Ct,allowed:kt}of this._handlers){if(!Ct.isEnabled())continue;let Bt;this._blockedByActive(Ae,kt,yt)?Ct.reset():Ct[$||j.type]&&(Bt=Ct[$||j.type](j,tt,je),this.mergeHandlerResult(de,xe,Bt,yt,ie),Bt&&Bt.needsRenderFrame&&this._triggerRenderFrame()),(Bt||Ct.isActive())&&(Ae[yt]=Ct)}const lt={};for(const yt in this._previousActiveHandlers)Ae[yt]||(lt[yt]=ie);this._previousActiveHandlers=Ae,(Object.keys(lt).length||bi(de))&&(this._changes.push([de,xe,lt]),this._triggerRenderFrame()),(Object.keys(Ae).length||bi(de))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ft}=de;ft&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ft(this._map))},this._map=d,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new zc(d),this._bearingSnap=g.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(g);const z=this._el;this._listeners=[[z,"touchstart",{passive:!0}],[z,"touchmove",{passive:!1}],[z,"touchend",void 0],[z,"touchcancel",void 0],[z,"mousedown",void 0],[z,"mousemove",void 0],[z,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[z,"mouseover",void 0],[z,"mouseout",void 0],[z,"dblclick",void 0],[z,"click",void 0],[z,"keydown",{capture:!1}],[z,"keyup",void 0],[z,"wheel",{passive:!1}],[z,"contextmenu",void 0],[window,"blur",void 0]];for(const[j,$,ie]of this._listeners)o.addEventListener(j,$,j===document?this.handleWindowEvent:this.handleEvent,ie)}destroy(){for(const[d,g,z]of this._listeners)o.removeEventListener(d,g,d===document?this.handleWindowEvent:this.handleEvent,z)}_addDefaultHandlers(d){const g=this._map,z=g.getCanvasContainer();this._add("mapEvent",new Fc(g,d));const j=g.boxZoom=new bs(g,d);this._add("boxZoom",j),d.interactive&&d.boxZoom&&j.enable();const $=g.cooperativeGestures=new Ml(g,d.cooperativeGestures);this._add("cooperativeGestures",$),d.cooperativeGestures&&$.enable();const ie=new is(g),de=new rl(g);g.doubleClickZoom=new ao(de,ie),this._add("tapZoom",ie),this._add("clickZoom",de),d.interactive&&d.doubleClickZoom&&g.doubleClickZoom.enable();const xe=new Du;this._add("tapDragZoom",xe);const Ae=g.touchPitch=new rc(g);this._add("touchPitch",Ae),d.interactive&&d.touchPitch&&g.touchPitch.enable(d.touchPitch);const Re=yc(d),je=Iu(d);g.dragRotate=new js(d,Re,je),this._add("mouseRotate",Re,["mousePitch"]),this._add("mousePitch",je,["mouseRotate"]),d.interactive&&d.dragRotate&&g.dragRotate.enable();const tt=(({enable:Bt,clickTolerance:At})=>{const $t=new ml({checkCorrectEvent:Kt=>o.mouseButton(Kt)===0&&!Kt.ctrlKey});return new xs({clickTolerance:At,move:(Kt,Yt)=>({around:Yt,panDelta:Yt.sub(Kt)}),activateOnStart:!0,moveStateManager:$t,enable:Bt,assignEvents:Rs})})(d),lt=new Wl(d,g);g.dragPan=new $l(z,tt,lt),this._add("mousePan",tt),this._add("touchPan",lt,["touchZoom","touchRotate"]),d.interactive&&d.dragPan&&g.dragPan.enable(d.dragPan);const ft=new zh,yt=new ki;g.touchZoomRotate=new Ru(z,yt,ft,xe),this._add("touchRotate",ft,["touchPan","touchZoom"]),this._add("touchZoom",yt,["touchPan","touchRotate"]),d.interactive&&d.touchZoomRotate&&g.touchZoomRotate.enable(d.touchZoomRotate);const Ct=g.scrollZoom=new Pu(g,()=>this._triggerRenderFrame());this._add("scrollZoom",Ct,["mousePan"]),d.interactive&&d.scrollZoom&&g.scrollZoom.enable(d.scrollZoom);const kt=g.keyboard=new Bc(g);this._add("keyboard",kt),d.interactive&&d.keyboard&&g.keyboard.enable(),this._add("blockableMapEvent",new Vs(g))}_add(d,g,z){this._handlers.push({handlerName:d,handler:g,allowed:z}),this._handlersById[d]=g}stop(d){if(!this._updatingCamera){for(const{handler:g}of this._handlers)g.reset();this._inertia.clear(),this._fireEvents({},{},d),this._changes=[]}}isActive(){for(const{handler:d}of this._handlers)if(d.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!il(this._eventsInProgress)||this.isZooming()}_blockedByActive(d,g,z){for(const j in d)if(j!==z&&(!g||g.indexOf(j)<0))return!0;return!1}_getMapTouches(d){const g=[];for(const z of d){const j=z.target;this._el.contains(j)&&g.push(z)}return g}mergeHandlerResult(d,g,z,j,$){if(!z)return;i.e(d,z);const ie={handlerName:j,originalEvent:z.originalEvent||$};z.zoomDelta!==void 0&&(g.zoom=ie),z.panDelta!==void 0&&(g.drag=ie),z.pitchDelta!==void 0&&(g.pitch=ie),z.bearingDelta!==void 0&&(g.rotate=ie)}_applyChanges(){const d={},g={},z={};for(const[j,$,ie]of this._changes)j.panDelta&&(d.panDelta=(d.panDelta||new i.P(0,0))._add(j.panDelta)),j.zoomDelta&&(d.zoomDelta=(d.zoomDelta||0)+j.zoomDelta),j.bearingDelta&&(d.bearingDelta=(d.bearingDelta||0)+j.bearingDelta),j.pitchDelta&&(d.pitchDelta=(d.pitchDelta||0)+j.pitchDelta),j.around!==void 0&&(d.around=j.around),j.pinchAround!==void 0&&(d.pinchAround=j.pinchAround),j.noInertia&&(d.noInertia=j.noInertia),i.e(g,$),i.e(z,ie);this._updateMapTransform(d,g,z),this._changes=[]}_updateMapTransform(d,g,z){const j=this._map,$=j._getTransformForUpdate(),ie=j.terrain;if(!(bi(d)||ie&&this._terrainMovement))return this._fireEvents(g,z,!0);let{panDelta:de,zoomDelta:xe,bearingDelta:Ae,pitchDelta:Re,around:je,pinchAround:tt}=d;tt!==void 0&&(je=tt),j._stop(!0),je=je||j.transform.centerPoint;const lt=$.pointLocation(de?je.sub(de):je);Ae&&($.bearing+=Ae),Re&&($.pitch+=Re),xe&&($.zoom+=xe),ie?this._terrainMovement||!g.drag&&!g.zoom?g.drag&&this._terrainMovement?$.center=$.pointLocation($.centerPoint.sub(de)):$.setLocationAtPoint(lt,je):(this._terrainMovement=!0,this._map._elevationFreeze=!0,$.setLocationAtPoint(lt,je)):$.setLocationAtPoint(lt,je),j._applyUpdatedTransform($),this._map._update(),d.noInertia||this._inertia.record(d),this._fireEvents(g,z,!0)}_fireEvents(d,g,z){const j=il(this._eventsInProgress),$=il(d),ie={};for(const je in d){const{originalEvent:tt}=d[je];this._eventsInProgress[je]||(ie[`${je}start`]=tt),this._eventsInProgress[je]=d[je]}!j&&$&&this._fireEvent("movestart",$.originalEvent);for(const je in ie)this._fireEvent(je,ie[je]);$&&this._fireEvent("move",$.originalEvent);for(const je in d){const{originalEvent:tt}=d[je];this._fireEvent(je,tt)}const de={};let xe;for(const je in this._eventsInProgress){const{handlerName:tt,originalEvent:lt}=this._eventsInProgress[je];this._handlersById[tt].isActive()||(delete this._eventsInProgress[je],xe=g[tt]||lt,de[`${je}end`]=xe)}for(const je in de)this._fireEvent(je,de[je]);const Ae=il(this._eventsInProgress),Re=(j||$)&&!Ae;if(Re&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const je=this._map._getTransformForUpdate();je.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(je)}if(z&&Re){this._updatingCamera=!0;const je=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),tt=lt=>lt!==0&&-this._bearingSnap<lt&<<this._bearingSnap;!je||!je.essential&&v.prefersReducedMotion?(this._map.fire(new i.k("moveend",{originalEvent:xe})),tt(this._map.getBearing())&&this._map.resetNorth()):(tt(je.bearing||this._map.getBearing())&&(je.bearing=0),je.freezeElevation=!0,this._map.easeTo(je,{originalEvent:xe})),this._updatingCamera=!1}}_fireEvent(d,g){this._map.fire(new i.k(d,g?{originalEvent:g}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(d=>{delete this._frameId,this.handleEvent(new Yl("renderFrame",{timeStamp:d})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Yo extends i.E{constructor(d,g){super(),this._renderFrameCallback=()=>{const z=Math.min((v.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(z)),z<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=d,this._bearingSnap=g.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new i.N(this.transform.center.lng,this.transform.center.lat)}setCenter(d,g){return this.jumpTo({center:d},g)}panBy(d,g,z){return d=i.P.convert(d).mult(-1),this.panTo(this.transform.center,i.e({offset:d},g),z)}panTo(d,g,z){return this.easeTo(i.e({center:d},g),z)}getZoom(){return this.transform.zoom}setZoom(d,g){return this.jumpTo({zoom:d},g),this}zoomTo(d,g,z){return this.easeTo(i.e({zoom:d},g),z)}zoomIn(d,g){return this.zoomTo(this.getZoom()+1,d,g),this}zoomOut(d,g){return this.zoomTo(this.getZoom()-1,d,g),this}getBearing(){return this.transform.bearing}setBearing(d,g){return this.jumpTo({bearing:d},g),this}getPadding(){return this.transform.padding}setPadding(d,g){return this.jumpTo({padding:d},g),this}rotateTo(d,g,z){return this.easeTo(i.e({bearing:d},g),z)}resetNorth(d,g){return this.rotateTo(0,i.e({duration:1e3},d),g),this}resetNorthPitch(d,g){return this.easeTo(i.e({bearing:0,pitch:0,duration:1e3},d),g),this}snapToNorth(d,g){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(d,g):this}getPitch(){return this.transform.pitch}setPitch(d,g){return this.jumpTo({pitch:d},g),this}cameraForBounds(d,g){d=Se.convert(d);const z=g&&g.bearing||0;return this._cameraForBoxAndBearing(d.getNorthWest(),d.getSouthEast(),z,g)}_cameraForBoxAndBearing(d,g,z,j){const $={top:0,bottom:0,right:0,left:0};if(typeof(j=i.e({padding:$,offset:[0,0],maxZoom:this.transform.maxZoom},j)).padding=="number"){const Tr=j.padding;j.padding={top:Tr,bottom:Tr,right:Tr,left:Tr}}j.padding=i.e($,j.padding);const ie=this.transform,de=ie.padding,xe=new Se(d,g),Ae=ie.project(xe.getNorthWest()),Re=ie.project(xe.getNorthEast()),je=ie.project(xe.getSouthEast()),tt=ie.project(xe.getSouthWest()),lt=i.ba(-z),ft=Ae.rotate(lt),yt=Re.rotate(lt),Ct=je.rotate(lt),kt=tt.rotate(lt),Bt=new i.P(Math.max(ft.x,yt.x,kt.x,Ct.x),Math.max(ft.y,yt.y,kt.y,Ct.y)),At=new i.P(Math.min(ft.x,yt.x,kt.x,Ct.x),Math.min(ft.y,yt.y,kt.y,Ct.y)),$t=Bt.sub(At),Kt=(ie.width-(de.left+de.right+j.padding.left+j.padding.right))/$t.x,Yt=(ie.height-(de.top+de.bottom+j.padding.top+j.padding.bottom))/$t.y;if(Yt<0||Kt<0)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const pn=Math.min(ie.scaleZoom(ie.scale*Math.min(Kt,Yt)),j.maxZoom),Tn=i.P.convert(j.offset),Vn=(j.padding.left-j.padding.right)/2,jn=(j.padding.top-j.padding.bottom)/2,$n=new i.P(Vn,jn).rotate(i.ba(z)),er=Tn.add($n).mult(ie.scale/ie.zoomScale(pn));return{center:ie.unproject(Ae.add(je).div(2).sub(er)),zoom:pn,bearing:z}}fitBounds(d,g,z){return this._fitInternal(this.cameraForBounds(d,g),g,z)}fitScreenCoordinates(d,g,z,j,$){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(i.P.convert(d)),this.transform.pointLocation(i.P.convert(g)),z,j),j,$)}_fitInternal(d,g,z){return d?(delete(g=i.e(d,g)).padding,g.linear?this.easeTo(g,z):this.flyTo(g,z)):this}jumpTo(d,g){this.stop();const z=this._getTransformForUpdate();let j=!1,$=!1,ie=!1;return"zoom"in d&&z.zoom!==+d.zoom&&(j=!0,z.zoom=+d.zoom),d.center!==void 0&&(z.center=i.N.convert(d.center)),"bearing"in d&&z.bearing!==+d.bearing&&($=!0,z.bearing=+d.bearing),"pitch"in d&&z.pitch!==+d.pitch&&(ie=!0,z.pitch=+d.pitch),d.padding==null||z.isPaddingEqual(d.padding)||(z.padding=d.padding),this._applyUpdatedTransform(z),this.fire(new i.k("movestart",g)).fire(new i.k("move",g)),j&&this.fire(new i.k("zoomstart",g)).fire(new i.k("zoom",g)).fire(new i.k("zoomend",g)),$&&this.fire(new i.k("rotatestart",g)).fire(new i.k("rotate",g)).fire(new i.k("rotateend",g)),ie&&this.fire(new i.k("pitchstart",g)).fire(new i.k("pitch",g)).fire(new i.k("pitchend",g)),this.fire(new i.k("moveend",g))}calculateCameraOptionsFromTo(d,g,z,j=0){const $=i.Z.fromLngLat(d,g),ie=i.Z.fromLngLat(z,j),de=ie.x-$.x,xe=ie.y-$.y,Ae=ie.z-$.z,Re=Math.hypot(de,xe,Ae);if(Re===0)throw new Error("Can't calculate camera options with same From and To");const je=Math.hypot(de,xe),tt=this.transform.scaleZoom(this.transform.cameraToCenterDistance/Re/this.transform.tileSize),lt=180*Math.atan2(de,-xe)/Math.PI;let ft=180*Math.acos(je/Re)/Math.PI;return ft=Ae<0?90-ft:90+ft,{center:ie.toLngLat(),zoom:tt,pitch:ft,bearing:lt}}easeTo(d,g){var z;this._stop(!1,d.easeId),((d=i.e({offset:[0,0],duration:500,easing:i.b9},d)).animate===!1||!d.essential&&v.prefersReducedMotion)&&(d.duration=0);const j=this._getTransformForUpdate(),$=j.zoom,ie=j.bearing,de=j.pitch,xe=j.padding,Ae="bearing"in d?this._normalizeBearing(d.bearing,ie):ie,Re="pitch"in d?+d.pitch:de,je="padding"in d?d.padding:j.padding,tt=i.P.convert(d.offset);let lt=j.centerPoint.add(tt);const ft=j.pointLocation(lt),{center:yt,zoom:Ct}=j.getConstrained(i.N.convert(d.center||ft),(z=d.zoom)!==null&&z!==void 0?z:$);this._normalizeCenter(yt,j);const kt=j.project(ft),Bt=j.project(yt).sub(kt),At=j.zoomScale(Ct-$);let $t,Kt;d.around&&($t=i.N.convert(d.around),Kt=j.locationPoint($t));const Yt={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||Ct!==$,this._rotating=this._rotating||ie!==Ae,this._pitching=this._pitching||Re!==de,this._padding=!j.isPaddingEqual(je),this._easeId=d.easeId,this._prepareEase(g,d.noMoveStart,Yt),this.terrain&&this._prepareElevation(yt),this._ease(pn=>{if(this._zooming&&(j.zoom=i.z.number($,Ct,pn)),this._rotating&&(j.bearing=i.z.number(ie,Ae,pn)),this._pitching&&(j.pitch=i.z.number(de,Re,pn)),this._padding&&(j.interpolatePadding(xe,je,pn),lt=j.centerPoint.add(tt)),this.terrain&&!d.freezeElevation&&this._updateElevation(pn),$t)j.setLocationAtPoint($t,Kt);else{const Tn=j.zoomScale(j.zoom-$),Vn=Ct>$?Math.min(2,At):Math.max(.5,At),jn=Math.pow(Vn,1-pn),$n=j.unproject(kt.add(Bt.mult(pn*jn)).mult(Tn));j.setLocationAtPoint(j.renderWorldCopies?$n.wrap():$n,lt)}this._applyUpdatedTransform(j),this._fireMoveEvents(g)},pn=>{this.terrain&&d.freezeElevation&&this._finalizeElevation(),this._afterEase(g,pn)},d),this}_prepareEase(d,g,z={}){this._moving=!0,g||z.moving||this.fire(new i.k("movestart",d)),this._zooming&&!z.zooming&&this.fire(new i.k("zoomstart",d)),this._rotating&&!z.rotating&&this.fire(new i.k("rotatestart",d)),this._pitching&&!z.pitching&&this.fire(new i.k("pitchstart",d))}_prepareElevation(d){this._elevationCenter=d,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(d,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(d){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const g=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(d<1&&g!==this._elevationTarget){const z=this._elevationTarget-this._elevationStart,j=(g-(z*d+this._elevationStart))/(1-d);this._elevationStart+=d*(z-j),this._elevationTarget=g}this.transform.elevation=i.z.number(this._elevationStart,this._elevationTarget,d)}_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(d){const g=d.getCameraPosition(),z=this.terrain.getElevationForLngLatZoom(g.lngLat,d.zoom);if(g.altitude<z){const j=this.calculateCameraOptionsFromTo(g.lngLat,z,d.center,d.elevation);return{pitch:j.pitch,zoom:j.zoom}}return{}}_applyUpdatedTransform(d){const g=[];if(this.terrain&&g.push(j=>this._elevateCameraIfInsideTerrain(j)),this.transformCameraUpdate&&g.push(j=>this.transformCameraUpdate(j)),!g.length)return;const z=d.clone();for(const j of g){const $=z.clone(),{center:ie,zoom:de,pitch:xe,bearing:Ae,elevation:Re}=j($);ie&&($.center=ie),de!==void 0&&($.zoom=de),xe!==void 0&&($.pitch=xe),Ae!==void 0&&($.bearing=Ae),Re!==void 0&&($.elevation=Re),z.apply($)}this.transform.apply(z)}_fireMoveEvents(d){this.fire(new i.k("move",d)),this._zooming&&this.fire(new i.k("zoom",d)),this._rotating&&this.fire(new i.k("rotate",d)),this._pitching&&this.fire(new i.k("pitch",d))}_afterEase(d,g){if(this._easeId&&g&&this._easeId===g)return;delete this._easeId;const z=this._zooming,j=this._rotating,$=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,z&&this.fire(new i.k("zoomend",d)),j&&this.fire(new i.k("rotateend",d)),$&&this.fire(new i.k("pitchend",d)),this.fire(new i.k("moveend",d))}flyTo(d,g){var z;if(!d.essential&&v.prefersReducedMotion){const ur=i.M(d,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ur,g)}this.stop(),d=i.e({offset:[0,0],speed:1.2,curve:1.42,easing:i.b9},d);const j=this._getTransformForUpdate(),$=j.zoom,ie=j.bearing,de=j.pitch,xe=j.padding,Ae="bearing"in d?this._normalizeBearing(d.bearing,ie):ie,Re="pitch"in d?+d.pitch:de,je="padding"in d?d.padding:j.padding,tt=i.P.convert(d.offset);let lt=j.centerPoint.add(tt);const ft=j.pointLocation(lt),{center:yt,zoom:Ct}=j.getConstrained(i.N.convert(d.center||ft),(z=d.zoom)!==null&&z!==void 0?z:$);this._normalizeCenter(yt,j);const kt=j.zoomScale(Ct-$),Bt=j.project(ft),At=j.project(yt).sub(Bt);let $t=d.curve;const Kt=Math.max(j.width,j.height),Yt=Kt/kt,pn=At.mag();if("minZoom"in d){const ur=i.ad(Math.min(d.minZoom,$,Ct),j.minZoom,j.maxZoom),Pr=Kt/j.zoomScale(ur-$);$t=Math.sqrt(Pr/pn*2)}const Tn=$t*$t;function Vn(ur){const Pr=(Yt*Yt-Kt*Kt+(ur?-1:1)*Tn*Tn*pn*pn)/(2*(ur?Yt:Kt)*Tn*pn);return Math.log(Math.sqrt(Pr*Pr+1)-Pr)}function jn(ur){return(Math.exp(ur)-Math.exp(-ur))/2}function $n(ur){return(Math.exp(ur)+Math.exp(-ur))/2}const er=Vn(!1);let Tr=function(ur){return $n(er)/$n(er+$t*ur)},rr=function(ur){return Kt*(($n(er)*(jn(Pr=er+$t*ur)/$n(Pr))-jn(er))/Tn)/pn;var Pr},Ar=(Vn(!0)-er)/$t;if(Math.abs(pn)<1e-6||!isFinite(Ar)){if(Math.abs(Kt-Yt)<1e-6)return this.easeTo(d,g);const ur=Yt<Kt?-1:1;Ar=Math.abs(Math.log(Yt/Kt))/$t,rr=()=>0,Tr=Pr=>Math.exp(ur*$t*Pr)}if("duration"in d)d.duration=+d.duration;else{const ur="screenSpeed"in d?+d.screenSpeed/$t:+d.speed;d.duration=1e3*Ar/ur}return d.maxDuration&&d.duration>d.maxDuration&&(d.duration=0),this._zooming=!0,this._rotating=ie!==Ae,this._pitching=Re!==de,this._padding=!j.isPaddingEqual(je),this._prepareEase(g,!1),this.terrain&&this._prepareElevation(yt),this._ease(ur=>{const Pr=ur*Ar,br=1/Tr(Pr);j.zoom=ur===1?Ct:$+j.scaleZoom(br),this._rotating&&(j.bearing=i.z.number(ie,Ae,ur)),this._pitching&&(j.pitch=i.z.number(de,Re,ur)),this._padding&&(j.interpolatePadding(xe,je,ur),lt=j.centerPoint.add(tt)),this.terrain&&!d.freezeElevation&&this._updateElevation(ur);const Nr=ur===1?yt:j.unproject(Bt.add(At.mult(rr(Pr))).mult(br));j.setLocationAtPoint(j.renderWorldCopies?Nr.wrap():Nr,lt),this._applyUpdatedTransform(j),this._fireMoveEvents(g)},()=>{this.terrain&&d.freezeElevation&&this._finalizeElevation(),this._afterEase(g)},d),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(d,g){var z;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const j=this._onEaseEnd;delete this._onEaseEnd,j.call(this,g)}return d||(z=this.handlers)===null||z===void 0||z.stop(!1),this}_ease(d,g,z){z.animate===!1||z.duration===0?(d(1),g()):(this._easeStart=v.now(),this._easeOptions=z,this._onEaseFrame=d,this._onEaseEnd=g,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(d,g){d=i.b3(d,-180,180);const z=Math.abs(d-g);return Math.abs(d-360-g)<z&&(d-=360),Math.abs(d+360-g)<z&&(d+=360),d}_normalizeCenter(d,g){if(!g.renderWorldCopies||g.lngRange)return;const z=d.lng-g.center.lng;d.lng+=z>180?-360:z<-180?360:0}queryTerrainElevation(d){return this.terrain?this.terrain.getElevationForLngLatZoom(i.N.convert(d),this.transform.tileZoom)-this.transform.elevation:null}}const Us={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class yl{constructor(d=Us){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=g=>{!g||g.sourceDataType!=="metadata"&&g.sourceDataType!=="visibility"&&g.dataType!=="style"&&g.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=d}getDefaultPosition(){return"bottom-right"}onAdd(d){return this._map=d,this._compact=this.options.compact,this._container=o.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=o.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=o.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(){o.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(d,g){const z=this._map._getUIString(`AttributionControl.${g}`);d.title=z,d.setAttribute("aria-label",z)}_updateAttributions(){if(!this._map.style)return;let d=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?d=d.concat(this.options.customAttribution.map(j=>typeof j!="string"?"":j)):typeof this.options.customAttribution=="string"&&d.push(this.options.customAttribution)),this._map.style.stylesheet){const j=this._map.style.stylesheet;this.styleOwner=j.owner,this.styleId=j.id}const g=this._map.style.sourceCaches;for(const j in g){const $=g[j];if($.used||$.usedForTerrain){const ie=$.getSource();ie.attribution&&d.indexOf(ie.attribution)<0&&d.push(ie.attribution)}}d=d.filter(j=>String(j).trim()),d.sort((j,$)=>j.length-$.length),d=d.filter((j,$)=>{for(let ie=$+1;ie<d.length;ie++)if(d[ie].indexOf(j)>=0)return!1;return!0});const z=d.join(" | ");z!==this._attribHTML&&(this._attribHTML=z,d.length?(this._innerContainer.innerHTML=z,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class os{constructor(d={}){this._updateCompact=()=>{const g=this._container.children;if(g.length){const z=g[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&z.classList.add("maplibregl-compact"):z.classList.remove("maplibregl-compact")}},this.options=d}getDefaultPosition(){return"bottom-left"}onAdd(d){this._map=d,this._compact=this.options&&this.options.compact,this._container=o.create("div","maplibregl-ctrl");const g=o.create("a","maplibregl-ctrl-logo");return g.target="_blank",g.rel="noopener nofollow",g.href="https://maplibre.org/",g.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),g.setAttribute("rel","noopener nofollow"),this._container.appendChild(g),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){o.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class rh{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(d){const g=++this._id;return this._queue.push({callback:d,id:g,cancelled:!1}),g}remove(d){const g=this._currentlyRunning,z=g?this._queue.concat(g):this._queue;for(const j of z)if(j.id===d)return void(j.cancelled=!0)}run(d=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const g=this._currentlyRunning=this._queue;this._queue=[];for(const z of g)if(!z.cancelled&&(z.callback(d),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var mi=i.Y([{name:"a_pos3d",type:"Int16",components:3}]);class Hs extends i.E{constructor(d){super(),this.sourceCache=d,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,d.usedForTerrain=!0,d.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(d,g){this.sourceCache.update(d,g),this._renderableTilesKeys=[];const z={};for(const j of d.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:g}))z[j.key]=!0,this._renderableTilesKeys.push(j.key),this._tiles[j.key]||(j.posMatrix=new Float64Array(16),i.aQ(j.posMatrix,0,i.X,0,i.X,0,1),this._tiles[j.key]=new we(j,this.tileSize));for(const j in this._tiles)z[j]||delete this._tiles[j]}freeRtt(d){for(const g in this._tiles){const z=this._tiles[g];(!d||z.tileID.equals(d)||z.tileID.isChildOf(d)||d.isChildOf(z.tileID))&&(z.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(d=>this.getTileByID(d))}getTileByID(d){return this._tiles[d]}getTerrainCoords(d){const g={};for(const z of this._renderableTilesKeys){const j=this._tiles[z].tileID;if(j.canonical.equals(d.canonical)){const $=d.clone();$.posMatrix=new Float64Array(16),i.aQ($.posMatrix,0,i.X,0,i.X,0,1),g[z]=$}else if(j.canonical.isChildOf(d.canonical)){const $=d.clone();$.posMatrix=new Float64Array(16);const ie=j.canonical.z-d.canonical.z,de=j.canonical.x-(j.canonical.x>>ie<<ie),xe=j.canonical.y-(j.canonical.y>>ie<<ie),Ae=i.X>>ie;i.aQ($.posMatrix,0,Ae,0,Ae,0,1),i.J($.posMatrix,$.posMatrix,[-de*Ae,-xe*Ae,0]),g[z]=$}else if(d.canonical.isChildOf(j.canonical)){const $=d.clone();$.posMatrix=new Float64Array(16);const ie=d.canonical.z-j.canonical.z,de=d.canonical.x-(d.canonical.x>>ie<<ie),xe=d.canonical.y-(d.canonical.y>>ie<<ie),Ae=i.X>>ie;i.aQ($.posMatrix,0,i.X,0,i.X,0,1),i.J($.posMatrix,$.posMatrix,[de*Ae,xe*Ae,0]),i.K($.posMatrix,$.posMatrix,[1/2**ie,1/2**ie,0]),g[z]=$}}return g}getSourceTile(d,g){const z=this.sourceCache._source;let j=d.overscaledZ-this.deltaZoom;if(j>z.maxzoom&&(j=z.maxzoom),j<z.minzoom)return null;this._sourceTileCache[d.key]||(this._sourceTileCache[d.key]=d.scaledTo(j).key);let $=this.sourceCache.getTileByID(this._sourceTileCache[d.key]);if((!$||!$.dem)&&g)for(;j>=z.minzoom&&(!$||!$.dem);)$=this.sourceCache.getTileByID(d.scaledTo(j--).key);return $}tilesAfterTime(d=Date.now()){return Object.values(this._tiles).filter(g=>g.timeAdded>=d)}}class xa{constructor(d,g,z){this.painter=d,this.sourceCache=new Hs(g),this.options=z,this.exaggeration=typeof z.exaggeration=="number"?z.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(d,g,z,j=i.X){var $;if(!(g>=0&&g<j&&z>=0&&z<j))return 0;const ie=this.getTerrainData(d),de=($=ie.tile)===null||$===void 0?void 0:$.dem;if(!de)return 0;const xe=function(ft,yt,Ct){var kt=yt[0],Bt=yt[1];return ft[0]=Ct[0]*kt+Ct[4]*Bt+Ct[12],ft[1]=Ct[1]*kt+Ct[5]*Bt+Ct[13],ft}([],[g/j*i.X,z/j*i.X],ie.u_terrain_matrix),Ae=[xe[0]*de.dim,xe[1]*de.dim],Re=Math.floor(Ae[0]),je=Math.floor(Ae[1]),tt=Ae[0]-Re,lt=Ae[1]-je;return de.get(Re,je)*(1-tt)*(1-lt)+de.get(Re+1,je)*tt*(1-lt)+de.get(Re,je+1)*(1-tt)*lt+de.get(Re+1,je+1)*tt*lt}getElevationForLngLatZoom(d,g){const{tileID:z,mercatorX:j,mercatorY:$}=this._getOverscaledTileIDFromLngLatZoom(d,g);return this.getElevation(z,j%i.X,$%i.X,i.X)}getElevation(d,g,z,j=i.X){return this.getDEMElevation(d,g,z,j)*this.exaggeration}getTerrainData(d){if(!this._emptyDemTexture){const j=this.painter.context,$=new i.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new D(j,$,j.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new D(j,new i.R({width:1,height:1}),j.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(j.gl.NEAREST,j.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=i.ao([])}const g=this.sourceCache.getSourceTile(d,!0);if(g&&g.dem&&(!g.demTexture||g.needsTerrainPrepare)){const j=this.painter.context;g.demTexture=this.painter.getTileTexture(g.dem.stride),g.demTexture?g.demTexture.update(g.dem.getPixels(),{premultiply:!1}):g.demTexture=new D(j,g.dem.getPixels(),j.gl.RGBA,{premultiply:!1}),g.demTexture.bind(j.gl.NEAREST,j.gl.CLAMP_TO_EDGE),g.needsTerrainPrepare=!1}const z=g&&g+g.tileID.key+d.key;if(z&&!this._demMatrixCache[z]){const j=this.sourceCache.sourceCache._source.maxzoom;let $=d.canonical.z-g.tileID.canonical.z;d.overscaledZ>d.canonical.z&&(d.canonical.z>=j?$=d.canonical.z-j:i.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const ie=d.canonical.x-(d.canonical.x>>$<<$),de=d.canonical.y-(d.canonical.y>>$<<$),xe=i.bb(new Float64Array(16),[1/(i.X<<$),1/(i.X<<$),0]);i.J(xe,xe,[ie*i.X,de*i.X,0]),this._demMatrixCache[d.key]={matrix:xe,coord:d}}return{u_depth:2,u_terrain:3,u_terrain_dim:g&&g.dem&&g.dem.dim||1,u_terrain_matrix:z?this._demMatrixCache[d.key].matrix:this._emptyDemMatrix,u_terrain_unpack:g&&g.dem&&g.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(g&&g.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:g}}getFramebuffer(d){const g=this.painter,z=g.width/devicePixelRatio,j=g.height/devicePixelRatio;return!this._fbo||this._fbo.width===z&&this._fbo.height===j||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new D(g.context,{width:z,height:j,data:null},g.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(g.context.gl.NEAREST,g.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new D(g.context,{width:z,height:j,data:null},g.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(g.context.gl.NEAREST,g.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=g.context.createFramebuffer(z,j,!0,!1),this._fbo.depthAttachment.set(g.context.createRenderbuffer(g.context.gl.DEPTH_COMPONENT16,z,j))),this._fbo.colorAttachment.set(d==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const d=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const g=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let $=0,ie=0;$<this._coordsTextureSize;$++)for(let de=0;de<this._coordsTextureSize;de++,ie+=4)g[ie+0]=255&de,g[ie+1]=255&$,g[ie+2]=de>>8<<4|$>>8,g[ie+3]=0;const z=new i.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(g.buffer)),j=new D(d,z,d.gl.RGBA,{premultiply:!1});return j.bind(d.gl.NEAREST,d.gl.CLAMP_TO_EDGE),this._coordsTexture=j,j}pointCoordinate(d){this.painter.maybeDrawDepthAndCoords(!0);const g=new Uint8Array(4),z=this.painter.context,j=z.gl,$=Math.round(d.x*this.painter.pixelRatio/devicePixelRatio),ie=Math.round(d.y*this.painter.pixelRatio/devicePixelRatio),de=Math.round(this.painter.height/devicePixelRatio);z.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),j.readPixels($,de-ie-1,1,1,j.RGBA,j.UNSIGNED_BYTE,g),z.bindFramebuffer.set(null);const xe=g[0]+(g[2]>>4<<8),Ae=g[1]+((15&g[2])<<8),Re=this.coordsIndex[255-g[3]],je=Re&&this.sourceCache.getTileByID(Re);if(!je)return null;const tt=this._coordsTextureSize,lt=(1<<je.tileID.canonical.z)*tt;return new i.Z((je.tileID.canonical.x*tt+xe)/lt+je.tileID.wrap,(je.tileID.canonical.y*tt+Ae)/lt,this.getElevation(je.tileID,xe,Ae,tt))}depthAtPoint(d){const g=new Uint8Array(4),z=this.painter.context,j=z.gl;return z.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),j.readPixels(d.x,this.painter.height/devicePixelRatio-d.y-1,1,1,j.RGBA,j.UNSIGNED_BYTE,g),z.bindFramebuffer.set(null),(g[0]/16777216+g[1]/65536+g[2]/256+g[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const d=this.painter.context,g=new i.bc,z=new i.aY,j=this.meshSize,$=i.X/j,ie=j*j;for(let je=0;je<=j;je++)for(let tt=0;tt<=j;tt++)g.emplaceBack(tt*$,je*$,0);for(let je=0;je<ie;je+=j+1)for(let tt=0;tt<j;tt++)z.emplaceBack(tt+je,j+tt+je+1,j+tt+je+2),z.emplaceBack(tt+je,j+tt+je+2,tt+je+1);const de=g.length,xe=de+2*(j+1);for(const je of[0,1])for(let tt=0;tt<=j;tt++)for(const lt of[0,1])g.emplaceBack(tt*$,je*i.X,lt);for(let je=0;je<2*j;je+=2)z.emplaceBack(xe+je,xe+je+1,xe+je+3),z.emplaceBack(xe+je,xe+je+3,xe+je+2),z.emplaceBack(de+je,de+je+3,de+je+1),z.emplaceBack(de+je,de+je+2,de+je+3);const Ae=g.length,Re=Ae+2*(j+1);for(const je of[0,1])for(let tt=0;tt<=j;tt++)for(const lt of[0,1])g.emplaceBack(je*i.X,tt*$,lt);for(let je=0;je<2*j;je+=2)z.emplaceBack(Ae+je,Ae+je+1,Ae+je+3),z.emplaceBack(Ae+je,Ae+je+3,Ae+je+2),z.emplaceBack(Re+je,Re+je+3,Re+je+1),z.emplaceBack(Re+je,Re+je+2,Re+je+3);return this._mesh=new Rc(d.createVertexBuffer(g,mi.members),d.createIndexBuffer(z),i.a0.simpleSegment(0,0,g.length,z.length)),this._mesh}getMeshFrameDelta(d){return 2*Math.PI*i.bd/Math.pow(2,d)/5}getMinTileElevationForLngLatZoom(d,g){var z;const{tileID:j}=this._getOverscaledTileIDFromLngLatZoom(d,g);return(z=this.getMinMaxElevation(j).minElevation)!==null&&z!==void 0?z:0}getMinMaxElevation(d){const g=this.getTerrainData(d).tile,z={minElevation:null,maxElevation:null};return g&&g.dem&&(z.minElevation=g.dem.min*this.exaggeration,z.maxElevation=g.dem.max*this.exaggeration),z}_getOverscaledTileIDFromLngLatZoom(d,g){const z=i.Z.fromLngLat(d.wrap()),j=(1<<g)*i.X,$=z.x*j,ie=z.y*j,de=Math.floor($/i.X),xe=Math.floor(ie/i.X);return{tileID:new i.S(g,0,g,de,xe),mercatorX:$,mercatorY:ie}}}class ac{constructor(d,g,z){this._context=d,this._size=g,this._tileSize=z,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const d of this._objects)d.texture.destroy(),d.fbo.destroy()}_createObject(d){const g=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),z=new D(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return z.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),g.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),g.colorAttachment.set(z.texture),{id:d,fbo:g,texture:z,stamp:-1,inUse:!1}}getObjectForId(d){return this._objects[d]}useObject(d){d.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(g=>d.id!==g),this._recentlyUsed.push(d.id)}stampObject(d){d.stamp=++this._stamp}getOrCreateFreeObject(){for(const g of this._recentlyUsed)if(!this._objects[g].inUse)return this._objects[g];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const d=this._createObject(this._objects.length);return this._objects.push(d),d}freeObject(d){d.inUse=!1}freeAllObjects(){for(const d of this._objects)this.freeObject(d)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(d=>!d.inUse)===!1}}const El={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class vu{constructor(d,g){this.painter=d,this.terrain=g,this.pool=new ac(d.context,30,g.sourceCache.tileSize*g.qualityFactor)}destruct(){this.pool.destruct()}getTexture(d){return this.pool.getObjectForId(d.rtt[this._stacks.length-1].id).texture}prepareForRender(d,g){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=d._order.filter(z=>!d._layers[z].isHidden(g)),this._coordsDescendingInv={};for(const z in d.sourceCaches){this._coordsDescendingInv[z]={};const j=d.sourceCaches[z].getVisibleCoordinates();for(const $ of j){const ie=this.terrain.sourceCache.getTerrainCoords($);for(const de in ie)this._coordsDescendingInv[z][de]||(this._coordsDescendingInv[z][de]=[]),this._coordsDescendingInv[z][de].push(ie[de])}}this._coordsDescendingInvStr={};for(const z of d._order){const j=d._layers[z],$=j.source;if(El[j.type]&&!this._coordsDescendingInvStr[$]){this._coordsDescendingInvStr[$]={};for(const ie in this._coordsDescendingInv[$])this._coordsDescendingInvStr[$][ie]=this._coordsDescendingInv[$][ie].map(de=>de.key).sort().join()}}for(const z of this._renderableTiles)for(const j in this._coordsDescendingInvStr){const $=this._coordsDescendingInvStr[j][z.tileID.key];$&&$!==z.rttCoords[j]&&(z.rtt=[])}}renderLayer(d){if(d.isHidden(this.painter.transform.zoom))return!1;const g=d.type,z=this.painter,j=this._renderableLayerIds[this._renderableLayerIds.length-1]===d.id;if(El[g]&&(this._prevType&&El[this._prevType]||this._stacks.push([]),this._prevType=g,this._stacks[this._stacks.length-1].push(d.id),!j))return!0;if(El[this._prevType]||El[g]&&j){this._prevType=g;const $=this._stacks.length-1,ie=this._stacks[$]||[];for(const de of this._renderableTiles){if(this.pool.isFull()&&(Dc(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(de),de.rtt[$]){const Ae=this.pool.getObjectForId(de.rtt[$].id);if(Ae.stamp===de.rtt[$].stamp){this.pool.useObject(Ae);continue}}const xe=this.pool.getOrCreateFreeObject();this.pool.useObject(xe),this.pool.stampObject(xe),de.rtt[$]={id:xe.id,stamp:xe.stamp},z.context.bindFramebuffer.set(xe.fbo.framebuffer),z.context.clear({color:i.aN.transparent,stencil:0}),z.currentStencilSource=void 0;for(let Ae=0;Ae<ie.length;Ae++){const Re=z.style._layers[ie[Ae]],je=Re.source?this._coordsDescendingInv[Re.source][de.tileID.key]:[de.tileID];z.context.viewport.set([0,0,xe.fbo.width,xe.fbo.height]),z._renderTileClippingMasks(Re,je),z.renderLayer(z,z.style.sourceCaches[Re.source],Re,je),Re.source&&(de.rttCoords[Re.source]=this._coordsDescendingInvStr[Re.source][de.tileID.key])}}return Dc(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),El[g]}return!1}}const gh={"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 ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},ih=_,Ou={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Us,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:i.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},co=V=>{V.touchstart=V.dragStart,V.touchmoveWindow=V.dragMove,V.touchend=V.dragEnd},Zl={showCompass:!0,showZoom:!0,visualizePitch:!1};class ui{constructor(d,g,z=!1){this.mousedown=ie=>{this.startMouse(i.e({},ie,{ctrlKey:!0,preventDefault:()=>ie.preventDefault()}),o.mousePos(this.element,ie)),o.addEventListener(window,"mousemove",this.mousemove),o.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=ie=>{this.moveMouse(ie,o.mousePos(this.element,ie))},this.mouseup=ie=>{this.mouseRotate.dragEnd(ie),this.mousePitch&&this.mousePitch.dragEnd(ie),this.offTemp()},this.touchstart=ie=>{ie.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=o.touchPos(this.element,ie.targetTouches)[0],this.startTouch(ie,this._startPos),o.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.addEventListener(window,"touchend",this.touchend))},this.touchmove=ie=>{ie.targetTouches.length!==1?this.reset():(this._lastPos=o.touchPos(this.element,ie.targetTouches)[0],this.moveTouch(ie,this._lastPos))},this.touchend=ie=>{ie.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;const j=d.dragRotate._mouseRotate.getClickTolerance(),$=d.dragRotate._mousePitch.getClickTolerance();this.element=g,this.mouseRotate=yc({clickTolerance:j,enable:!0}),this.touchRotate=(({enable:ie,clickTolerance:de,bearingDegreesPerPixelMoved:xe=.8})=>{const Ae=new nc;return new xs({clickTolerance:de,move:(Re,je)=>({bearingDelta:(je.x-Re.x)*xe}),moveStateManager:Ae,enable:ie,assignEvents:co})})({clickTolerance:j,enable:!0}),this.map=d,z&&(this.mousePitch=Iu({clickTolerance:$,enable:!0}),this.touchPitch=(({enable:ie,clickTolerance:de,pitchDegreesPerPixelMoved:xe=-.5})=>{const Ae=new nc;return new xs({clickTolerance:de,move:(Re,je)=>({pitchDelta:(je.y-Re.y)*xe}),moveStateManager:Ae,enable:ie,assignEvents:co})})({clickTolerance:$,enable:!0})),o.addEventListener(g,"mousedown",this.mousedown),o.addEventListener(g,"touchstart",this.touchstart,{passive:!1}),o.addEventListener(g,"touchcancel",this.reset)}startMouse(d,g){this.mouseRotate.dragStart(d,g),this.mousePitch&&this.mousePitch.dragStart(d,g),o.disableDrag()}startTouch(d,g){this.touchRotate.dragStart(d,g),this.touchPitch&&this.touchPitch.dragStart(d,g),o.disableDrag()}moveMouse(d,g){const z=this.map,{bearingDelta:j}=this.mouseRotate.dragMove(d,g)||{};if(j&&z.setBearing(z.getBearing()+j),this.mousePitch){const{pitchDelta:$}=this.mousePitch.dragMove(d,g)||{};$&&z.setPitch(z.getPitch()+$)}}moveTouch(d,g){const z=this.map,{bearingDelta:j}=this.touchRotate.dragMove(d,g)||{};if(j&&z.setBearing(z.getBearing()+j),this.touchPitch){const{pitchDelta:$}=this.touchPitch.dragMove(d,g)||{};$&&z.setPitch(z.getPitch()+$)}}off(){const d=this.element;o.removeEventListener(d,"mousedown",this.mousedown),o.removeEventListener(d,"touchstart",this.touchstart,{passive:!1}),o.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.removeEventListener(window,"touchend",this.touchend),o.removeEventListener(d,"touchcancel",this.reset),this.offTemp()}offTemp(){o.enableDrag(),o.removeEventListener(window,"mousemove",this.mousemove),o.removeEventListener(window,"mouseup",this.mouseup),o.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.removeEventListener(window,"touchend",this.touchend)}}let Pi;function al(V,d,g){const z=new i.N(V.lng,V.lat);if(V=new i.N(V.lng,V.lat),d){const j=new i.N(V.lng-360,V.lat),$=new i.N(V.lng+360,V.lat),ie=g.locationPoint(V).distSqr(d);g.locationPoint(j).distSqr(d)<ie?V=j:g.locationPoint($).distSqr(d)<ie&&(V=$)}for(;Math.abs(V.lng-g.center.lng)>180;){const j=g.locationPoint(V);if(j.x>=0&&j.y>=0&&j.x<=g.width&&j.y<=g.height)break;V.lng>g.center.lng?V.lng-=360:V.lng+=360}return V.lng!==z.lng&&g.locationPoint(V).y>g.height/2-g.getHorizon()?V:z}const Xl={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 zu(V,d,g){const z=V.classList;for(const j in Xl)z.remove(`maplibregl-${g}-anchor-${j}`);z.add(`maplibregl-${g}-anchor-${d}`)}class bo extends i.E{constructor(d){if(super(),this._onKeyPress=g=>{const z=g.code,j=g.charCode||g.keyCode;z!=="Space"&&z!=="Enter"&&j!==32&&j!==13||this.togglePopup()},this._onMapClick=g=>{const z=g.originalEvent.target,j=this._element;this._popup&&(z===j||j.contains(z))&&this.togglePopup()},this._update=g=>{var z;if(!this._map)return;const j=this._map.loaded()&&!this._map.isMoving();((g==null?void 0:g.type)==="terrain"||(g==null?void 0:g.type)==="render"&&!j)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies?this._lngLat=al(this._lngLat,this._flatPos,this._map.transform):this._lngLat=(z=this._lngLat)===null||z===void 0?void 0:z.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 $="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?$=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&($=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let ie="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?ie="rotateX(0deg)":this._pitchAlignment==="map"&&(ie=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||g&&g.type!=="moveend"||(this._pos=this._pos.round()),o.setTransform(this._element,`${Xl[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${ie} ${$}`),v.frameAsync(new AbortController).then(()=>{this._updateOpacity(g&&g.type==="moveend")}).catch(()=>{})},this._onMove=g=>{if(!this._isDragging){const z=this._clickTolerance||this._map._clickTolerance;this._isDragging=g.point.dist(this._pointerdownPos)>=z}this._isDragging&&(this._pos=g.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 i.k("dragstart"))),this.fire(new i.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 i.k("dragend")),this._state="inactive"},this._addDragHandler=g=>{this._element.contains(g.originalEvent.target)&&(g.preventDefault(),this._positionDelta=g.point.sub(this._pos).add(this._offset),this._pointerdownPos=g.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=d&&d.anchor||"center",this._color=d&&d.color||"#3FB1CE",this._scale=d&&d.scale||1,this._draggable=d&&d.draggable||!1,this._clickTolerance=d&&d.clickTolerance||0,this._subpixelPositioning=d&&d.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=d&&d.rotation||0,this._rotationAlignment=d&&d.rotationAlignment||"auto",this._pitchAlignment=d&&d.pitchAlignment&&d.pitchAlignment!=="auto"?d.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(d==null?void 0:d.opacity,d==null?void 0:d.opacityWhenCovered),d&&d.element)this._element=d.element,this._offset=i.P.convert(d&&d.offset||[0,0]);else{this._defaultMarker=!0,this._element=o.create("div");const g=o.createNS("http://www.w3.org/2000/svg","svg"),z=41,j=27;g.setAttributeNS(null,"display","block"),g.setAttributeNS(null,"height",`${z}px`),g.setAttributeNS(null,"width",`${j}px`),g.setAttributeNS(null,"viewBox",`0 0 ${j} ${z}`);const $=o.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"stroke","none"),$.setAttributeNS(null,"stroke-width","1"),$.setAttributeNS(null,"fill","none"),$.setAttributeNS(null,"fill-rule","evenodd");const ie=o.createNS("http://www.w3.org/2000/svg","g");ie.setAttributeNS(null,"fill-rule","nonzero");const de=o.createNS("http://www.w3.org/2000/svg","g");de.setAttributeNS(null,"transform","translate(3.0, 29.0)"),de.setAttributeNS(null,"fill","#000000");const xe=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const kt of xe){const Bt=o.createNS("http://www.w3.org/2000/svg","ellipse");Bt.setAttributeNS(null,"opacity","0.04"),Bt.setAttributeNS(null,"cx","10.5"),Bt.setAttributeNS(null,"cy","5.80029008"),Bt.setAttributeNS(null,"rx",kt.rx),Bt.setAttributeNS(null,"ry",kt.ry),de.appendChild(Bt)}const Ae=o.createNS("http://www.w3.org/2000/svg","g");Ae.setAttributeNS(null,"fill",this._color);const Re=o.createNS("http://www.w3.org/2000/svg","path");Re.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"),Ae.appendChild(Re);const je=o.createNS("http://www.w3.org/2000/svg","g");je.setAttributeNS(null,"opacity","0.25"),je.setAttributeNS(null,"fill","#000000");const tt=o.createNS("http://www.w3.org/2000/svg","path");tt.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"),je.appendChild(tt);const lt=o.createNS("http://www.w3.org/2000/svg","g");lt.setAttributeNS(null,"transform","translate(6.0, 7.0)"),lt.setAttributeNS(null,"fill","#FFFFFF");const ft=o.createNS("http://www.w3.org/2000/svg","g");ft.setAttributeNS(null,"transform","translate(8.0, 8.0)");const yt=o.createNS("http://www.w3.org/2000/svg","circle");yt.setAttributeNS(null,"fill","#000000"),yt.setAttributeNS(null,"opacity","0.25"),yt.setAttributeNS(null,"cx","5.5"),yt.setAttributeNS(null,"cy","5.5"),yt.setAttributeNS(null,"r","5.4999962");const Ct=o.createNS("http://www.w3.org/2000/svg","circle");Ct.setAttributeNS(null,"fill","#FFFFFF"),Ct.setAttributeNS(null,"cx","5.5"),Ct.setAttributeNS(null,"cy","5.5"),Ct.setAttributeNS(null,"r","5.4999962"),ft.appendChild(yt),ft.appendChild(Ct),ie.appendChild(de),ie.appendChild(Ae),ie.appendChild(je),ie.appendChild(lt),ie.appendChild(ft),g.appendChild(ie),g.setAttributeNS(null,"height",z*this._scale+"px"),g.setAttributeNS(null,"width",j*this._scale+"px"),this._element.appendChild(g),this._offset=i.P.convert(d&&d.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",g=>{g.preventDefault()}),this._element.addEventListener("mousedown",g=>{g.preventDefault()}),zu(this._element,this._anchor,"marker"),d&&d.className)for(const g of d.className.split(" "))this._element.classList.add(g);this._popup=null}addTo(d){return this.remove(),this._map=d,this._element.setAttribute("aria-label",d._getUIString("Marker.Title")),d.getCanvasContainer().appendChild(this._element),d.on("move",this._update),d.on("moveend",this._update),d.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),o.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=i.N.convert(d),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(d){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),d){if(!("offset"in d.options)){const j=Math.abs(13.5)/Math.SQRT2;d.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[j,-1*(24.6+j)],"bottom-right":[-j,-1*(24.6+j)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=d,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(d){return this._subpixelPositioning=d,this}getPopup(){return this._popup}togglePopup(){const d=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:d?(d.isOpen()?d.remove():(d.setLngLat(this._lngLat),d.addTo(this._map)),this):this}_updateOpacity(d=!1){var g,z;if(!(!((g=this._map)===null||g===void 0)&&g.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(d)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const j=this._map,$=j.terrain.depthAtPoint(this._pos),ie=j.terrain.getElevationForLngLatZoom(this._lngLat,j.transform.tileZoom);if(j.transform.lngLatToCameraDepth(this._lngLat,ie)-$<.006)return void(this._element.style.opacity=this._opacity);const de=-this._offset.y/j.transform._pixelPerMeter,xe=Math.sin(j.getPitch()*Math.PI/180)*de,Ae=j.terrain.depthAtPoint(new i.P(this._pos.x,this._pos.y-this._offset.y)),Re=j.transform.lngLatToCameraDepth(this._lngLat,ie+xe)-Ae>.006;!((z=this._popup)===null||z===void 0)&&z.isOpen()&&Re&&this._popup.remove(),this._element.style.opacity=Re?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(d){return this._offset=i.P.convert(d),this._update(),this}addClassName(d){this._element.classList.add(d)}removeClassName(d){this._element.classList.remove(d)}toggleClassName(d){return this._element.classList.toggle(d)}setDraggable(d){return this._draggable=!!d,this._map&&(d?(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(d){return this._rotation=d||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(d){return this._rotationAlignment=d||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(d){return this._pitchAlignment=d&&d!=="auto"?d:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(d,g){return d===void 0&&g===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),d!==void 0&&(this._opacity=d),g!==void 0&&(this._opacityWhenCovered=g),this._map&&this._updateOpacity(!0),this}}const oc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let na=0,bc=!1;class _i extends i.E{constructor(d){super(),this._onSuccess=g=>{if(this._map){if(this._isOutOfMapMaxBounds(g))return this._setErrorState(),this.fire(new i.k("outofmaxbounds",g)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=g,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(g),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(g),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new i.k("geolocate",g)),this._finish()}},this._updateCamera=g=>{const z=new i.N(g.coords.longitude,g.coords.latitude),j=g.coords.accuracy,$=this._map.getBearing(),ie=i.e({bearing:$},this.options.fitBoundsOptions),de=Se.fromLngLat(z,j);this._map.fitBounds(de,ie,{geolocateSource:!0})},this._updateMarker=g=>{if(g){const z=new i.N(g.coords.longitude,g.coords.latitude);this._accuracyCircleMarker.setLngLat(z).addTo(this._map),this._userLocationDotMarker.setLngLat(z).addTo(this._map),this._accuracy=g.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=g=>{if(this._map){if(this.options.trackUserLocation)if(g.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const z=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=z,this._geolocateButton.setAttribute("aria-label",z),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(g.code===3&&bc)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new i.k("error",g)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",g=>g.preventDefault()),this._geolocateButton=o.create("button","maplibregl-ctrl-geolocate",this._container),o.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=g=>{if(this._map){if(g===!1){i.w("Geolocation support is not available so the GeolocateControl will be disabled.");const z=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=z,this._geolocateButton.setAttribute("aria-label",z)}else{const z=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=z,this._geolocateButton.setAttribute("aria-label",z)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=o.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new bo({element:this._dotElement}),this._circleElement=o.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new bo({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",z=>{const j=z.originalEvent&&z.originalEvent.type==="resize";z.geolocateSource||this._watchState!=="ACTIVE_LOCK"||j||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new i.k("trackuserlocationend")),this.fire(new i.k("userlocationlostfocus")))})}},this.options=i.e({},oc,d)}onAdd(d){return this._map=d,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return i._(this,arguments,void 0,function*(g=!1){if(Pi!==void 0&&!g)return Pi;if(window.navigator.permissions===void 0)return Pi=!!window.navigator.geolocation,Pi;try{Pi=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Pi=!!window.navigator.geolocation}return Pi})}().then(g=>this._finishSetupUI(g)),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(),o.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,na=0,bc=!1}_isOutOfMapMaxBounds(d){const g=this._map.getMaxBounds(),z=d.coords;return g&&(z.longitude<g.getWest()||z.longitude>g.getEast()||z.latitude<g.getSouth()||z.latitude>g.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const d=this._map.getBounds(),g=d.getSouthEast(),z=d.getNorthEast(),j=g.distanceTo(z),$=this._map._container.clientHeight,ie=Math.ceil(this._accuracy/(j/$)*2);this._circleElement.style.width=`${ie}px`,this._circleElement.style.height=`${ie}px`}trigger(){if(!this._setup)return i.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 i.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":na--,bc=!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 i.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 i.k("trackuserlocationstart")),this.fire(new i.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 d;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),na++,na>1?(d={maximumAge:6e5,timeout:0},bc=!0):(d=this.options.positionOptions,bc=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,d)}}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)}}const gi={maxWidth:100,unit:"metric"};function Ka(V,d,g){const z=g&&g.maxWidth||100,j=V._container.clientHeight/2,$=V.unproject([0,j]),ie=V.unproject([z,j]),de=$.distanceTo(ie);if(g&&g.unit==="imperial"){const xe=3.2808*de;xe>5280?ss(d,z,xe/5280,V._getUIString("ScaleControl.Miles")):ss(d,z,xe,V._getUIString("ScaleControl.Feet"))}else g&&g.unit==="nautical"?ss(d,z,de/1852,V._getUIString("ScaleControl.NauticalMiles")):de>=1e3?ss(d,z,de/1e3,V._getUIString("ScaleControl.Kilometers")):ss(d,z,de,V._getUIString("ScaleControl.Meters"))}function ss(V,d,g,z){const j=function(ie){const de=Math.pow(10,`${Math.floor(ie)}`.length-1);let xe=ie/de;return xe=xe>=10?10:xe>=5?5:xe>=3?3:xe>=2?2:xe>=1?1:function(Ae){const Re=Math.pow(10,Math.ceil(-Math.log(Ae)/Math.LN10));return Math.round(Ae*Re)/Re}(xe),de*xe}(g),$=j/g;V.style.width=d*$+"px",V.innerHTML=`${j} ${z}`}class sc extends i.E{constructor(d={}){super(),this._onFullscreenChange=()=>{var g;let z=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((g=z==null?void 0:z.shadowRoot)===null||g===void 0)&&g.fullscreenElement;)z=z.shadowRoot.fullscreenElement;z===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,d&&d.container&&(d.container instanceof HTMLElement?this._container=d.container:i.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(d){return this._map=d,this._container||(this._container=this._map.getContainer()),this._controlContainer=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){o.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const d=this._fullscreenButton=o.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);o.create("span","maplibregl-ctrl-icon",d).setAttribute("aria-hidden","true"),d.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const d=this._getTitle();this._fullscreenButton.setAttribute("aria-label",d),this._fullscreenButton.title=d}_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 i.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new i.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()}}const ol={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},gt=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");class xt extends i.E{constructor(d){super(),this.remove=()=>(this._content&&o.remove(this._content),this._container&&(o.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 i.k("close"))),this),this._onMouseUp=g=>{this._update(g.point)},this._onMouseMove=g=>{this._update(g.point)},this._onDrag=g=>{this._update(g.point)},this._update=g=>{var z;const j=this._lngLat||this._trackPointer;if(!this._map||!j||!this._content)return;if(!this._container){if(this._container=o.create("div","maplibregl-popup",this._map.getContainer()),this._tip=o.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const Ae of this.options.className.split(" "))this._container.classList.add(Ae);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._map.transform.renderWorldCopies&&!this._trackPointer?this._lngLat=al(this._lngLat,this._flatPos,this._map.transform):this._lngLat=(z=this._lngLat)===null||z===void 0?void 0:z.wrap(),this._trackPointer&&!g)return;const $=this._flatPos=this._pos=this._trackPointer&&g?g:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&g?g:this._map.transform.locationPoint(this._lngLat));let ie=this.options.anchor;const de=Pt(this.options.offset);if(!ie){const Ae=this._container.offsetWidth,Re=this._container.offsetHeight;let je;je=$.y+de.bottom.y<Re?["top"]:$.y>this._map.transform.height-Re?["bottom"]:[],$.x<Ae/2?je.push("left"):$.x>this._map.transform.width-Ae/2&&je.push("right"),ie=je.length===0?"bottom":je.join("-")}let xe=$.add(de[ie]);this.options.subpixelPositioning||(xe=xe.round()),o.setTransform(this._container,`${Xl[ie]} translate(${xe.x}px,${xe.y}px)`),zu(this._container,ie,"popup")},this._onClose=()=>{this.remove()},this.options=i.e(Object.create(ol),d)}addTo(d){return this._map&&this.remove(),this._map=d,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 i.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=i.N.convert(d),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(d){return this.setDOMContent(document.createTextNode(d))}setHTML(d){const g=document.createDocumentFragment(),z=document.createElement("body");let j;for(z.innerHTML=d;j=z.firstChild,j;)g.appendChild(j);return this.setDOMContent(g)}getMaxWidth(){var d;return(d=this._container)===null||d===void 0?void 0:d.style.maxWidth}setMaxWidth(d){return this.options.maxWidth=d,this._update(),this}setDOMContent(d){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=o.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(d),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(d){return this._container&&this._container.classList.add(d),this}removeClassName(d){return this._container&&this._container.classList.remove(d),this}setOffset(d){return this.options.offset=d,this._update(),this}toggleClassName(d){if(this._container)return this._container.classList.toggle(d)}setSubpixelPositioning(d){this.options.subpixelPositioning=d}_createCloseButton(){this.options.closeButton&&(this._closeButton=o.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const d=this._container.querySelector(gt);d&&d.focus()}}function Pt(V){if(V){if(typeof V=="number"){const d=Math.round(Math.abs(V)/Math.SQRT2);return{center:new i.P(0,0),top:new i.P(0,V),"top-left":new i.P(d,d),"top-right":new i.P(-d,d),bottom:new i.P(0,-V),"bottom-left":new i.P(d,-d),"bottom-right":new i.P(-d,-d),left:new i.P(V,0),right:new i.P(-V,0)}}if(V instanceof i.P||Array.isArray(V)){const d=i.P.convert(V);return{center:d,top:d,"top-left":d,"top-right":d,bottom:d,"bottom-left":d,"bottom-right":d,left:d,right:d}}return{center:i.P.convert(V.center||[0,0]),top:i.P.convert(V.top||[0,0]),"top-left":i.P.convert(V["top-left"]||[0,0]),"top-right":i.P.convert(V["top-right"]||[0,0]),bottom:i.P.convert(V.bottom||[0,0]),"bottom-left":i.P.convert(V["bottom-left"]||[0,0]),"bottom-right":i.P.convert(V["bottom-right"]||[0,0]),left:i.P.convert(V.left||[0,0]),right:i.P.convert(V.right||[0,0])}}return Pt(new i.P(0,0))}const te=_;c.AJAXError=i.bg,c.Evented=i.E,c.LngLat=i.N,c.MercatorCoordinate=i.Z,c.Point=i.P,c.addProtocol=i.bh,c.config=i.a,c.removeProtocol=i.bi,c.AttributionControl=yl,c.BoxZoomHandler=bs,c.CanvasSource=Me,c.CooperativeGesturesHandler=Ml,c.DoubleClickZoomHandler=ao,c.DragPanHandler=$l,c.DragRotateHandler=js,c.EdgeInsets=tc,c.FullscreenControl=sc,c.GeoJSONSource=Ee,c.GeolocateControl=_i,c.Hash=Go,c.ImageSource=Le,c.KeyboardHandler=Bc,c.LngLatBounds=Se,c.LogoControl=os,c.Map=class extends Yo{constructor(V){i.be.mark(i.bf.create);const d=Object.assign(Object.assign({},Ou),V);if(d.minZoom!=null&&d.maxZoom!=null&&d.minZoom>d.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(d.minPitch!=null&&d.maxPitch!=null&&d.minPitch>d.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(d.minPitch!=null&&d.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(d.maxPitch!=null&&d.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ia(d.minZoom,d.maxZoom,d.minPitch,d.maxPitch,d.renderWorldCopies),{bearingSnap:d.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new rh,this._controls=[],this._mapId=i.a4(),this._contextLost=z=>{z.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new i.k("webglcontextlost",{originalEvent:z}))},this._contextRestored=z=>{this._setupPainter(),this.resize(),this._update(),this.fire(new i.k("webglcontextrestored",{originalEvent:z}))},this._onMapScroll=z=>{if(z.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=d.interactive,this._maxTileCacheSize=d.maxTileCacheSize,this._maxTileCacheZoomLevels=d.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=d.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=d.preserveDrawingBuffer===!0,this._antialias=d.antialias===!0,this._trackResize=d.trackResize===!0,this._bearingSnap=d.bearingSnap,this._refreshExpiredTiles=d.refreshExpiredTiles===!0,this._fadeDuration=d.fadeDuration,this._crossSourceCollisions=d.crossSourceCollisions===!0,this._collectResourceTiming=d.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},gh),d.locale),this._clickTolerance=d.clickTolerance,this._overridePixelRatio=d.pixelRatio,this._maxCanvasSize=d.maxCanvasSize,this.transformCameraUpdate=d.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=d.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=S.addThrottleControl(()=>this.isMoving()),this._requestManager=new C(d.transformRequest),typeof d.container=="string"){if(this._container=document.getElementById(d.container),!this._container)throw new Error(`Container '${d.container}' not found.`)}else{if(!(d.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=d.container}if(d.maxBounds&&this.setMaxBounds(d.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 z=!1;const j=gu($=>{this._trackResize&&!this._removed&&this.resize($)._update()},50);this._resizeObserver=new ResizeObserver($=>{z?j($):z=!0}),this._resizeObserver.observe(this._container)}this.handlers=new ba(this,d);const g=typeof d.hash=="string"&&d.hash||void 0;this._hash=d.hash&&new Go(g).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:d.center,zoom:d.zoom,bearing:d.bearing,pitch:d.pitch}),d.bounds&&(this.resize(),this.fitBounds(d.bounds,i.e({},d.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=d.localIdeographFontFamily,this._validateStyle=d.validateStyle,d.style&&this.setStyle(d.style,{localIdeographFontFamily:d.localIdeographFontFamily}),d.attributionControl&&this.addControl(new yl(typeof d.attributionControl=="boolean"?void 0:d.attributionControl)),d.maplibreLogo&&this.addControl(new os,d.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",z=>{this._update(z.dataType==="style"),this.fire(new i.k(`${z.dataType}data`,z))}),this.on("dataloading",z=>{this.fire(new i.k(`${z.dataType}dataloading`,z))}),this.on("dataabort",z=>{this.fire(new i.k("sourcedataabort",z))})}_getMapId(){return this._mapId}addControl(V,d){if(d===void 0&&(d=V.getDefaultPosition?V.getDefaultPosition():"top-right"),!V||!V.onAdd)return this.fire(new i.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const g=V.onAdd(this);this._controls.push(V);const z=this._controlPositions[d];return d.indexOf("bottom")!==-1?z.insertBefore(g,z.firstChild):z.appendChild(g),this}removeControl(V){if(!V||!V.onRemove)return this.fire(new i.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const d=this._controls.indexOf(V);return d>-1&&this._controls.splice(d,1),V.onRemove(this),this}hasControl(V){return this._controls.indexOf(V)>-1}calculateCameraOptionsFromTo(V,d,g,z){return z==null&&this.terrain&&(z=this.terrain.getElevationForLngLatZoom(g,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(V,d,g,z)}resize(V){var d;const g=this._containerDimensions(),z=g[0],j=g[1],$=this._getClampedPixelRatio(z,j);if(this._resizeCanvas(z,j,$),this.painter.resize(z,j,$),this.painter.overLimit()){const de=this.painter.context.gl;this._maxCanvasSize=[de.drawingBufferWidth,de.drawingBufferHeight];const xe=this._getClampedPixelRatio(z,j);this._resizeCanvas(z,j,xe),this.painter.resize(z,j,xe)}this.transform.resize(z,j),(d=this._requestedCameraState)===null||d===void 0||d.resize(z,j);const ie=!this._moving;return ie&&(this.stop(),this.fire(new i.k("movestart",V)).fire(new i.k("move",V))),this.fire(new i.k("resize",V)),ie&&this.fire(new i.k("moveend",V)),this}_getClampedPixelRatio(V,d){const{0:g,1:z}=this._maxCanvasSize,j=this.getPixelRatio(),$=V*j,ie=d*j,de=$>g?g/$:1,xe=ie>z?z/ie:1;return Math.min(de,xe)*j}getPixelRatio(){var V;return(V=this._overridePixelRatio)!==null&&V!==void 0?V:devicePixelRatio}setPixelRatio(V){this._overridePixelRatio=V,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(V){return this.transform.setMaxBounds(Se.convert(V)),this._update()}setMinZoom(V){if((V=V??-2)>=-2&&V<=this.transform.maxZoom)return this.transform.minZoom=V,this._update(),this.getZoom()<V&&this.setZoom(V),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(V){if((V=V??22)>=this.transform.minZoom)return this.transform.maxZoom=V,this._update(),this.getZoom()>V&&this.setZoom(V),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(V){if((V=V??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(V>=0&&V<=this.transform.maxPitch)return this.transform.minPitch=V,this._update(),this.getPitch()<V&&this.setPitch(V),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(V){if((V=V??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(V>=this.transform.minPitch)return this.transform.maxPitch=V,this._update(),this.getPitch()>V&&this.setPitch(V),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(V){return this.transform.renderWorldCopies=V,this._update()}project(V){return this.transform.locationPoint(i.N.convert(V),this.style&&this.terrain)}unproject(V){return this.transform.pointLocation(i.P.convert(V),this.terrain)}isMoving(){var V;return this._moving||((V=this.handlers)===null||V===void 0?void 0:V.isMoving())}isZooming(){var V;return this._zooming||((V=this.handlers)===null||V===void 0?void 0:V.isZooming())}isRotating(){var V;return this._rotating||((V=this.handlers)===null||V===void 0?void 0:V.isRotating())}_createDelegatedListener(V,d,g){if(V==="mouseenter"||V==="mouseover"){let z=!1;return{layer:d,listener:g,delegates:{mousemove:$=>{const ie=this.getLayer(d)?this.queryRenderedFeatures($.point,{layers:[d]}):[];ie.length?z||(z=!0,g.call(this,new Ds(V,this,$.originalEvent,{features:ie}))):z=!1},mouseout:()=>{z=!1}}}}if(V==="mouseleave"||V==="mouseout"){let z=!1;return{layer:d,listener:g,delegates:{mousemove:ie=>{(this.getLayer(d)?this.queryRenderedFeatures(ie.point,{layers:[d]}):[]).length?z=!0:z&&(z=!1,g.call(this,new Ds(V,this,ie.originalEvent)))},mouseout:ie=>{z&&(z=!1,g.call(this,new Ds(V,this,ie.originalEvent)))}}}}{const z=j=>{const $=this.getLayer(d)?this.queryRenderedFeatures(j.point,{layers:[d]}):[];$.length&&(j.features=$,g.call(this,j),delete j.features)};return{layer:d,listener:g,delegates:{[V]:z}}}}on(V,d,g){if(g===void 0)return super.on(V,d);const z=this._createDelegatedListener(V,d,g);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[V]=this._delegatedListeners[V]||[],this._delegatedListeners[V].push(z);for(const j in z.delegates)this.on(j,z.delegates[j]);return this}once(V,d,g){if(g===void 0)return super.once(V,d);const z=this._createDelegatedListener(V,d,g);for(const j in z.delegates)this.once(j,z.delegates[j]);return this}off(V,d,g){return g===void 0?super.off(V,d):(this._delegatedListeners&&this._delegatedListeners[V]&&(z=>{const j=z[V];for(let $=0;$<j.length;$++){const ie=j[$];if(ie.layer===d&&ie.listener===g){for(const de in ie.delegates)this.off(de,ie.delegates[de]);return j.splice($,1),this}}})(this._delegatedListeners),this)}queryRenderedFeatures(V,d){if(!this.style)return[];let g;const z=V instanceof i.P||Array.isArray(V),j=z?V:[[0,0],[this.transform.width,this.transform.height]];if(d=d||(z?{}:V)||{},j instanceof i.P||typeof j[0]=="number")g=[i.P.convert(j)];else{const $=i.P.convert(j[0]),ie=i.P.convert(j[1]);g=[$,new i.P(ie.x,$.y),ie,new i.P($.x,ie.y),$]}return this.style.queryRenderedFeatures(g,d,this.transform)}querySourceFeatures(V,d){return this.style.querySourceFeatures(V,d)}setStyle(V,d){return(d=i.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},d)).diff!==!1&&d.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&V?(this._diffStyle(V,d),this):(this._localIdeographFontFamily=d.localIdeographFontFamily,this._updateStyle(V,d))}setTransformRequest(V){return this._requestManager.setTransformRequest(V),this}_getUIString(V){const d=this._locale[V];if(d==null)throw new Error(`Missing UI string '${V}'`);return d}_updateStyle(V,d){if(d.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(V,d));const g=this.style&&d.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!V)),V?(this.style=new Jr(this,d||{}),this.style.setEventedParent(this,{style:this.style}),typeof V=="string"?this.style.loadURL(V,d,g):this.style.loadJSON(V,d,g),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Jr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(V,d){if(typeof V=="string"){const g=V,z=this._requestManager.transformRequest(g,"Style");i.h(z,new AbortController).then(j=>{this._updateDiff(j.data,d)}).catch(j=>{j&&this.fire(new i.j(j))})}else typeof V=="object"&&this._updateDiff(V,d)}_updateDiff(V,d){try{this.style.setState(V,d)&&this._update(!0)}catch(g){i.w(`Unable to perform style diff: ${g.message||g.error||g}. Rebuilding the style from scratch.`),this._updateStyle(V,d)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():i.w("There is no style added to the map.")}addSource(V,d){return this._lazyInitEmptyStyle(),this.style.addSource(V,d),this._update(!0)}isSourceLoaded(V){const d=this.style&&this.style.sourceCaches[V];if(d!==void 0)return d.loaded();this.fire(new i.j(new Error(`There is no source with ID '${V}'`)))}setTerrain(V){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),V){const d=this.style.sourceCaches[V.source];if(!d)throw new Error(`cannot load terrain, because there exists no source with ID: ${V.source}`);this.terrain===null&&d.reload();for(const g in this.style._layers){const z=this.style._layers[g];z.type==="hillshade"&&z.source===V.source&&i.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 xa(this.painter,d,V),this.painter.renderToTexture=new vu(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=g=>{g.dataType==="style"?this.terrain.sourceCache.freeRtt():g.dataType==="source"&&g.tile&&(g.sourceId!==V.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(g.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 i.k("terrain",{terrain:V})),this}getTerrain(){var V,d;return(d=(V=this.terrain)===null||V===void 0?void 0:V.options)!==null&&d!==void 0?d:null}areTilesLoaded(){const V=this.style&&this.style.sourceCaches;for(const d in V){const g=V[d]._tiles;for(const z in g){const j=g[z];if(j.state!=="loaded"&&j.state!=="errored")return!1}}return!0}removeSource(V){return this.style.removeSource(V),this._update(!0)}getSource(V){return this.style.getSource(V)}addImage(V,d,g={}){const{pixelRatio:z=1,sdf:j=!1,stretchX:$,stretchY:ie,content:de,textFitWidth:xe,textFitHeight:Ae}=g;if(this._lazyInitEmptyStyle(),!(d instanceof HTMLImageElement||i.b(d))){if(d.width===void 0||d.height===void 0)return this.fire(new i.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:Re,height:je,data:tt}=d,lt=d;return this.style.addImage(V,{data:new i.R({width:Re,height:je},new Uint8Array(tt)),pixelRatio:z,stretchX:$,stretchY:ie,content:de,textFitWidth:xe,textFitHeight:Ae,sdf:j,version:0,userImage:lt}),lt.onAdd&<.onAdd(this,V),this}}{const{width:Re,height:je,data:tt}=v.getImageData(d);this.style.addImage(V,{data:new i.R({width:Re,height:je},tt),pixelRatio:z,stretchX:$,stretchY:ie,content:de,textFitWidth:xe,textFitHeight:Ae,sdf:j,version:0})}}updateImage(V,d){const g=this.style.getImage(V);if(!g)return this.fire(new i.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const z=d instanceof HTMLImageElement||i.b(d)?v.getImageData(d):d,{width:j,height:$,data:ie}=z;if(j===void 0||$===void 0)return this.fire(new i.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(j!==g.data.width||$!==g.data.height)return this.fire(new i.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const de=!(d instanceof HTMLImageElement||i.b(d));return g.data.replace(ie,de),this.style.updateImage(V,g),this}getImage(V){return this.style.getImage(V)}hasImage(V){return V?!!this.style.getImage(V):(this.fire(new i.j(new Error("Missing required image id"))),!1)}removeImage(V){this.style.removeImage(V)}loadImage(V){return S.getImage(this._requestManager.transformRequest(V,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(V,d){return this._lazyInitEmptyStyle(),this.style.addLayer(V,d),this._update(!0)}moveLayer(V,d){return this.style.moveLayer(V,d),this._update(!0)}removeLayer(V){return this.style.removeLayer(V),this._update(!0)}getLayer(V){return this.style.getLayer(V)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(V,d,g){return this.style.setLayerZoomRange(V,d,g),this._update(!0)}setFilter(V,d,g={}){return this.style.setFilter(V,d,g),this._update(!0)}getFilter(V){return this.style.getFilter(V)}setPaintProperty(V,d,g,z={}){return this.style.setPaintProperty(V,d,g,z),this._update(!0)}getPaintProperty(V,d){return this.style.getPaintProperty(V,d)}setLayoutProperty(V,d,g,z={}){return this.style.setLayoutProperty(V,d,g,z),this._update(!0)}getLayoutProperty(V,d){return this.style.getLayoutProperty(V,d)}setGlyphs(V,d={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(V,d),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(V,d,g={}){return this._lazyInitEmptyStyle(),this.style.addSprite(V,d,g,z=>{z||this._update(!0)}),this}removeSprite(V){return this._lazyInitEmptyStyle(),this.style.removeSprite(V),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(V,d={}){return this._lazyInitEmptyStyle(),this.style.setSprite(V,d,g=>{g||this._update(!0)}),this}setLight(V,d={}){return this._lazyInitEmptyStyle(),this.style.setLight(V,d),this._update(!0)}getLight(){return this.style.getLight()}setSky(V){return this._lazyInitEmptyStyle(),this.style.setSky(V),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(V,d){return this.style.setFeatureState(V,d),this._update()}removeFeatureState(V,d){return this.style.removeFeatureState(V,d),this._update()}getFeatureState(V){return this.style.getFeatureState(V)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let V=0,d=0;return this._container&&(V=this._container.clientWidth||400,d=this._container.clientHeight||300),[V,d]}_setupContainer(){const V=this._container;V.classList.add("maplibregl-map");const d=this._canvasContainer=o.create("div","maplibregl-canvas-container",V);this._interactive&&d.classList.add("maplibregl-interactive"),this._canvas=o.create("canvas","maplibregl-canvas",d),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","region");const g=this._containerDimensions(),z=this._getClampedPixelRatio(g[0],g[1]);this._resizeCanvas(g[0],g[1],z);const j=this._controlContainer=o.create("div","maplibregl-control-container",V),$=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(ie=>{$[ie]=o.create("div",`maplibregl-ctrl-${ie} `,j)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(V,d,g){this._canvas.width=Math.floor(g*V),this._canvas.height=Math.floor(g*d),this._canvas.style.width=`${V}px`,this._canvas.style.height=`${d}px`}_setupPainter(){const V={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let d=null;this._canvas.addEventListener("webglcontextcreationerror",z=>{d={requestedAttributes:V},z&&(d.statusMessage=z.statusMessage,d.type=z.type)},{once:!0});const g=this._canvas.getContext("webgl2",V)||this._canvas.getContext("webgl",V);if(!g){const z="Failed to initialize WebGL";throw d?(d.message=z,new Error(JSON.stringify(d))):new Error(z)}this.painter=new Oc(g,this.transform),a.testSupport(g)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(V){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||V,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(V){return this._update(),this._renderTaskQueue.add(V)}_cancelRenderFrame(V){this._renderTaskQueue.remove(V)}_render(V){const d=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(V),this._removed)return;let g=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const j=this.transform.zoom,$=v.now();this.style.zoomHistory.update(j,$);const ie=new i.a9(j,{now:$,fadeDuration:d,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),de=ie.crossFadingFactor();de===1&&de===this._crossFadingFactor||(g=!0,this._crossFadingFactor=de),this.style.update(ie)}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,d,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:d,showPadding:this.showPadding}),this.fire(new i.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,i.be.mark(i.bf.load),this.fire(new i.k("load"))),this.style&&(this.style.hasTransitions()||g)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const z=this._sourcesDirty||this._styleDirty||this._placementDirty;return z||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new i.k("idle")),!this._loaded||this._fullyLoaded||z||(this._fullyLoaded=!0,i.be.mark(i.bf.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var V;this._hash&&this._hash.remove();for(const g of this._controls)g.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),S.removeThrottleControl(this._imageQueueHandle),(V=this._resizeObserver)===null||V===void 0||V.disconnect();const d=this.painter.context.gl.getExtension("WEBGL_lose_context");d!=null&&d.loseContext&&d.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),o.remove(this._canvasContainer),o.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),i.be.clearMetrics(),this._removed=!0,this.fire(new i.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,v.frameAsync(this._frameRequest).then(V=>{i.be.frame(V),this._frameRequest=null,this._render(V)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(V){this._showTileBoundaries!==V&&(this._showTileBoundaries=V,this._update())}get showPadding(){return!!this._showPadding}set showPadding(V){this._showPadding!==V&&(this._showPadding=V,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(V){this._showCollisionBoxes!==V&&(this._showCollisionBoxes=V,V?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(V){this._showOverdrawInspector!==V&&(this._showOverdrawInspector=V,this._update())}get repaint(){return!!this._repaint}set repaint(V){this._repaint!==V&&(this._repaint=V,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(V){this._vertices=V,this._update()}get version(){return ih}getCameraTargetElevation(){return this.transform.elevation}},c.MapMouseEvent=Ds,c.MapTouchEvent=ys,c.MapWheelEvent=Mu,c.Marker=bo,c.NavigationControl=class{constructor(V){this._updateZoomButtons=()=>{const d=this._map.getZoom(),g=d===this._map.getMaxZoom(),z=d===this._map.getMinZoom();this._zoomInButton.disabled=g,this._zoomOutButton.disabled=z,this._zoomInButton.setAttribute("aria-disabled",g.toString()),this._zoomOutButton.setAttribute("aria-disabled",z.toString())},this._rotateCompassArrow=()=>{const d=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=d},this._setButtonTitle=(d,g)=>{const z=this._map._getUIString(`NavigationControl.${g}`);d.title=z,d.setAttribute("aria-label",z)},this.options=i.e({},Zl,V),this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",d=>d.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",d=>this._map.zoomIn({},{originalEvent:d})),o.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",d=>this._map.zoomOut({},{originalEvent:d})),o.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",d=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:d}):this._map.resetNorth({},{originalEvent:d})}),this._compassIcon=o.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(V){return this._map=V,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 ui(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){o.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(V,d){const g=o.create("button",V,this._container);return g.type="button",g.addEventListener("click",d),g}},c.Popup=xt,c.RasterDEMTileSource=He,c.RasterTileSource=Pe,c.ScaleControl=class{constructor(V){this._onMove=()=>{Ka(this._map,this._container,this.options)},this.setUnit=d=>{this.options.unit=d,Ka(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},gi),V)}getDefaultPosition(){return"bottom-left"}onAdd(V){return this._map=V,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-scale",V.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){o.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},c.ScrollZoomHandler=Pu,c.Style=Jr,c.TerrainControl=class{constructor(V){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=V}onAdd(V){return this._map=V,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=o.create("button","maplibregl-ctrl-terrain",this._container),o.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(){o.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},c.TwoFingersTouchPitchHandler=rc,c.TwoFingersTouchRotateHandler=zh,c.TwoFingersTouchZoomHandler=ki,c.TwoFingersTouchZoomRotateHandler=Ru,c.VectorTileSource=Ie,c.VideoSource=ve,c.addSourceType=(V,d)=>i._(void 0,void 0,void 0,function*(){if(Ue(V))throw new Error(`A source type called "${V}" already exists.`);((g,z)=>{ke[g]=z})(V,d)}),c.clearPrewarmedResources=function(){const V=fe;V&&(V.isPreloaded()&&V.numActive()===1?(V.release(ce),fe=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()"))},c.getMaxParallelImageRequests=function(){return i.a.MAX_PARALLEL_IMAGE_REQUESTS},c.getRTLTextPluginStatus=function(){return Xe().getRTLTextPluginStatus()},c.getVersion=function(){return te},c.getWorkerCount=function(){return he.workerCount},c.getWorkerUrl=function(){return i.a.WORKER_URL},c.importScriptInWorkers=function(V){return pe().broadcast("IS",V)},c.prewarm=function(){oe().acquire(ce)},c.setMaxParallelImageRequests=function(V){i.a.MAX_PARALLEL_IMAGE_REQUESTS=V},c.setRTLTextPlugin=function(V,d){return Xe().setRTLTextPlugin(V,d)},c.setWorkerCount=function(V){he.workerCount=V},c.setWorkerUrl=function(V){i.a.WORKER_URL=V}}),f}()},88640:function(p,f,n){function l(be,_e,Se){be.prototype=_e.prototype=Se,Se.constructor=be}function c(be,_e){var Se=Object.create(be.prototype);for(var Ce in _e)Se[Ce]=_e[Ce];return Se}function i(){}n.d(f,{GW:function(){return me},Dj:function(){return he}});var _=.7,b=1/_,w="\\s*([+-]?\\d+)\\s*",v="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",o="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",a=/^#([0-9a-f]{3,8})$/,h=new RegExp("^rgb\\(".concat(w,",").concat(w,",").concat(w,"\\)$")),s=new RegExp("^rgb\\(".concat(o,",").concat(o,",").concat(o,"\\)$")),m=new RegExp("^rgba\\(".concat(w,",").concat(w,",").concat(w,",").concat(v,"\\)$")),y=new RegExp("^rgba\\(".concat(o,",").concat(o,",").concat(o,",").concat(v,"\\)$")),x=new RegExp("^hsl\\(".concat(v,",").concat(o,",").concat(o,"\\)$")),S=new RegExp("^hsla\\(".concat(v,",").concat(o,",").concat(o,",").concat(v,"\\)$")),C={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function A(){return this.rgb().formatHex()}function E(){return this.rgb().formatRgb()}function P(be){var _e,Se;return be=(be+"").trim().toLowerCase(),(_e=a.exec(be))?(Se=_e[1].length,_e=parseInt(_e[1],16),Se===6?M(_e):Se===3?new T(_e>>8&15|_e>>4&240,_e>>4&15|240&_e,(15&_e)<<4|15&_e,1):Se===8?L(_e>>24&255,_e>>16&255,_e>>8&255,(255&_e)/255):Se===4?L(_e>>12&15|_e>>8&240,_e>>8&15|_e>>4&240,_e>>4&15|240&_e,((15&_e)<<4|15&_e)/255):null):(_e=h.exec(be))?new T(_e[1],_e[2],_e[3],1):(_e=s.exec(be))?new T(255*_e[1]/100,255*_e[2]/100,255*_e[3]/100,1):(_e=m.exec(be))?L(_e[1],_e[2],_e[3],_e[4]):(_e=y.exec(be))?L(255*_e[1]/100,255*_e[2]/100,255*_e[3]/100,_e[4]):(_e=x.exec(be))?U(_e[1],_e[2]/100,_e[3]/100,1):(_e=S.exec(be))?U(_e[1],_e[2]/100,_e[3]/100,_e[4]):C.hasOwnProperty(be)?M(C[be]):be==="transparent"?new T(NaN,NaN,NaN,0):null}function M(be){return new T(be>>16&255,be>>8&255,255&be,1)}function L(be,_e,Se,Ce){return Ce<=0&&(be=_e=Se=NaN),new T(be,_e,Se,Ce)}function I(be,_e,Se,Ce){return arguments.length===1?((Ie=be)instanceof i||(Ie=P(Ie)),Ie?new T((Ie=Ie.rgb()).r,Ie.g,Ie.b,Ie.opacity):new T):new T(be,_e,Se,Ce??1);var Ie}function T(be,_e,Se,Ce){this.r=+be,this.g=+_e,this.b=+Se,this.opacity=+Ce}function D(){return"#".concat(N(this.r)).concat(N(this.g)).concat(N(this.b))}function k(){var be=O(this.opacity);return"".concat(be===1?"rgb(":"rgba(").concat(F(this.r),", ").concat(F(this.g),", ").concat(F(this.b)).concat(be===1?")":", ".concat(be,")"))}function O(be){return isNaN(be)?1:Math.max(0,Math.min(1,be))}function F(be){return Math.max(0,Math.min(255,Math.round(be)||0))}function N(be){return((be=F(be))<16?"0":"")+be.toString(16)}function U(be,_e,Se,Ce){return Ce<=0?be=_e=Se=NaN:Se<=0||Se>=1?be=_e=NaN:_e<=0&&(be=NaN),new H(be,_e,Se,Ce)}function q(be){if(be instanceof H)return new H(be.h,be.s,be.l,be.opacity);if(be instanceof i||(be=P(be)),!be)return new H;if(be instanceof H)return be;var _e=(be=be.rgb()).r/255,Se=be.g/255,Ce=be.b/255,Ie=Math.min(_e,Se,Ce),Pe=Math.max(_e,Se,Ce),He=NaN,Ee=Pe-Ie,Fe=(Pe+Ie)/2;return Ee?(He=_e===Pe?(Se-Ce)/Ee+6*(Se<Ce):Se===Pe?(Ce-_e)/Ee+2:(_e-Se)/Ee+4,Ee/=Fe<.5?Pe+Ie:2-Pe-Ie,He*=60):Ee=Fe>0&&Fe<1?0:He,new H(He,Ee,Fe,be.opacity)}function H(be,_e,Se,Ce){this.h=+be,this.s=+_e,this.l=+Se,this.opacity=+Ce}function Z(be){return(be=(be||0)%360)<0?be+360:be}function ee(be){return Math.max(0,Math.min(1,be||0))}function G(be,_e,Se){return 255*(be<60?_e+(Se-_e)*be/60:be<180?Se:be<240?_e+(Se-_e)*(240-be)/60:_e)}l(i,P,{copy:function(be){return Object.assign(new this.constructor,this,be)},displayable:function(){return this.rgb().displayable()},hex:A,formatHex:A,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return q(this).formatHsl()},formatRgb:E,toString:E}),l(T,I,c(i,{brighter:function(be){return be=be==null?b:Math.pow(b,be),new T(this.r*be,this.g*be,this.b*be,this.opacity)},darker:function(be){return be=be==null?_:Math.pow(_,be),new T(this.r*be,this.g*be,this.b*be,this.opacity)},rgb:function(){return this},clamp:function(){return new T(F(this.r),F(this.g),F(this.b),O(this.opacity))},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:D,formatHex:D,formatHex8:function(){return"#".concat(N(this.r)).concat(N(this.g)).concat(N(this.b)).concat(N(255*(isNaN(this.opacity)?1:this.opacity)))},formatRgb:k,toString:k})),l(H,function(be,_e,Se,Ce){return arguments.length===1?q(be):new H(be,_e,Se,Ce??1)},c(i,{brighter:function(be){return be=be==null?b:Math.pow(b,be),new H(this.h,this.s,this.l*be,this.opacity)},darker:function(be){return be=be==null?_:Math.pow(_,be),new H(this.h,this.s,this.l*be,this.opacity)},rgb:function(){var be=this.h%360+360*(this.h<0),_e=isNaN(be)||isNaN(this.s)?0:this.s,Se=this.l,Ce=Se+(Se<.5?Se:1-Se)*_e,Ie=2*Se-Ce;return new T(G(be>=240?be-240:be+120,Ie,Ce),G(be,Ie,Ce),G(be<120?be+240:be-120,Ie,Ce),this.opacity)},clamp:function(){return new H(Z(this.h),ee(this.s),ee(this.l),O(this.opacity))},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var be=O(this.opacity);return"".concat(be===1?"hsl(":"hsla(").concat(Z(this.h),", ").concat(100*ee(this.s),"%, ").concat(100*ee(this.l),"%").concat(be===1?")":", ".concat(be,")"))}}));var ne=function(be){return function(){return be}};function K(be,_e){var Se=_e-be;return Se?function(Ce,Ie){return function(Pe){return Ce+Pe*Ie}}(be,Se):ne(isNaN(be)?_e:be)}var X=function be(_e){var Se=function(Ie){return(Ie=+Ie)==1?K:function(Pe,He){return He-Pe?function(Ee,Fe,Le){return Ee=Math.pow(Ee,Le),Fe=Math.pow(Fe,Le)-Ee,Le=1/Le,function(ve){return Math.pow(Ee+ve*Fe,Le)}}(Pe,He,Ie):ne(isNaN(Pe)?He:Pe)}}(_e);function Ce(Ie,Pe){var He=Se((Ie=I(Ie)).r,(Pe=I(Pe)).r),Ee=Se(Ie.g,Pe.g),Fe=Se(Ie.b,Pe.b),Le=K(Ie.opacity,Pe.opacity);return function(ve){return Ie.r=He(ve),Ie.g=Ee(ve),Ie.b=Fe(ve),Ie.opacity=Le(ve),Ie+""}}return Ce.gamma=be,Ce}(1);function Q(be,_e){var Se,Ce=_e?_e.length:0,Ie=be?Math.min(Ce,be.length):0,Pe=new Array(Ie),He=new Array(Ce);for(Se=0;Se<Ie;++Se)Pe[Se]=me(be[Se],_e[Se]);for(;Se<Ce;++Se)He[Se]=_e[Se];return function(Ee){for(Se=0;Se<Ie;++Se)He[Se]=Pe[Se](Ee);return He}}function ce(be,_e){var Se=new Date;return be=+be,_e=+_e,function(Ce){return Se.setTime(be*(1-Ce)+_e*Ce),Se}}function he(be,_e){return be=+be,_e=+_e,function(Se){return be*(1-Se)+_e*Se}}function se(be){return se=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_e){return typeof _e}:function(_e){return _e&&typeof Symbol=="function"&&_e.constructor===Symbol&&_e!==Symbol.prototype?"symbol":typeof _e},se(be)}function fe(be,_e){var Se,Ce={},Ie={};for(Se in be!==null&&se(be)==="object"||(be={}),_e!==null&&se(_e)==="object"||(_e={}),_e)Se in be?Ce[Se]=me(be[Se],_e[Se]):Ie[Se]=_e[Se];return function(Pe){for(Se in Ce)Ie[Se]=Ce[Se](Pe);return Ie}}var re=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,oe=new RegExp(re.source,"g");function le(be,_e){var Se,Ce,Ie,Pe=re.lastIndex=oe.lastIndex=0,He=-1,Ee=[],Fe=[];for(be+="",_e+="";(Se=re.exec(be))&&(Ce=oe.exec(_e));)(Ie=Ce.index)>Pe&&(Ie=_e.slice(Pe,Ie),Ee[He]?Ee[He]+=Ie:Ee[++He]=Ie),(Se=Se[0])===(Ce=Ce[0])?Ee[He]?Ee[He]+=Ce:Ee[++He]=Ce:(Ee[++He]=null,Fe.push({i:He,x:he(Se,Ce)})),Pe=oe.lastIndex;return Pe<_e.length&&(Ie=_e.slice(Pe),Ee[He]?Ee[He]+=Ie:Ee[++He]=Ie),Ee.length<2?Fe[0]?function(Le){return function(ve){return Le(ve)+""}}(Fe[0].x):function(Le){return function(){return Le}}(_e):(_e=Fe.length,function(Le){for(var ve,Me=0;Me<_e;++Me)Ee[(ve=Fe[Me]).i]=ve.x(Le);return Ee.join("")})}function pe(be,_e){_e||(_e=[]);var Se,Ce=be?Math.min(_e.length,be.length):0,Ie=_e.slice();return function(Pe){for(Se=0;Se<Ce;++Se)Ie[Se]=be[Se]*(1-Pe)+_e[Se]*Pe;return Ie}}function ge(be){return ge=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_e){return typeof _e}:function(_e){return _e&&typeof Symbol=="function"&&_e.constructor===Symbol&&_e!==Symbol.prototype?"symbol":typeof _e},ge(be)}function me(be,_e){var Se,Ce,Ie=ge(_e);return _e==null||Ie==="boolean"?ne(_e):(Ie==="number"?he:Ie==="string"?(Se=P(_e))?(_e=Se,X):le:_e instanceof P?X:_e instanceof Date?ce:(Ce=_e,!ArrayBuffer.isView(Ce)||Ce instanceof DataView?Array.isArray(_e)?Q:typeof _e.valueOf!="function"&&typeof _e.toString!="function"||isNaN(_e)?fe:he:pe))(be,_e)}},23648:function(p){p.exports=JSON.parse('["xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller"]')},2362:function(p){p.exports=JSON.parse('["normal","condensed","semi-condensed","extra-condensed","ultra-condensed","expanded","semi-expanded","extra-expanded","ultra-expanded"]')},87486:function(p){p.exports=JSON.parse('["normal","italic","oblique"]')},99803:function(p){p.exports=JSON.parse('["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"]')},54324:function(p){p.exports=JSON.parse('["inherit","initial","unset"]')},94316:function(p){p.exports=JSON.parse('["caption","icon","menu","message-box","small-caption","status-bar"]')},37071:function(p){p.exports=JSON.parse(`{"version":8,"name":"orto","metadata":{"maputnik:renderer":"mlgljs"},"center":[1.537786,41.837539],"zoom":12,"bearing":0,"pitch":0,"light":{"anchor":"viewport","color":"white","intensity":0.4,"position":[1.15,45,30]},"sources":{"ortoEsri":{"type":"raster","tiles":["https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"],"tileSize":256,"maxzoom":18,"attribution":"ESRI © <a href='http://www.esri.com'>ESRI</a>"},"ortoInstaMaps":{"type":"raster","tiles":["https://tilemaps.icgc.cat/mapfactory/wmts/orto_8_12/CAT3857/{z}/{x}/{y}.png"],"tileSize":256,"maxzoom":13},"ortoICGC":{"type":"raster","tiles":["https://geoserveis.icgc.cat/icc_mapesmultibase/noutm/wmts/orto/GRID3857/{z}/{x}/{y}.jpeg"],"tileSize":256,"minzoom":13.1,"maxzoom":20},"openmaptiles":{"type":"vector","url":"https://geoserveis.icgc.cat/contextmaps/basemap.json"}},"sprite":"https://geoserveis.icgc.cat/contextmaps/sprites/sprite@1","glyphs":"https://geoserveis.icgc.cat/contextmaps/glyphs/{fontstack}/{range}.pbf","layers":[{"id":"background","type":"background","paint":{"background-color":"#F4F9F4"}},{"id":"ortoEsri","type":"raster","source":"ortoEsri","maxzoom":16,"layout":{"visibility":"visible"}},{"id":"ortoICGC","type":"raster","source":"ortoICGC","minzoom":13.1,"maxzoom":19,"layout":{"visibility":"visible"}},{"id":"ortoInstaMaps","type":"raster","source":"ortoInstaMaps","maxzoom":13,"layout":{"visibility":"visible"}},{"id":"waterway_tunnel","type":"line","source":"openmaptiles","source-layer":"waterway","minzoom":14,"filter":["all",["in","class","river","stream","canal"],["==","brunnel","tunnel"]],"layout":{"line-cap":"round"},"paint":{"line-color":"#a0c8f0","line-width":{"base":1.3,"stops":[[13,0.5],[20,6]]},"line-dasharray":[2,4]}},{"id":"waterway-other","type":"line","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"waterway","filter":["!in","class","canal","river","stream"],"layout":{"line-cap":"round"},"paint":{"line-color":"#a0c8f0","line-width":{"base":1.3,"stops":[[13,0.5],[20,2]]}}},{"id":"waterway-stream-canal","type":"line","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"waterway","filter":["all",["in","class","canal","stream"],["!=","brunnel","tunnel"]],"layout":{"line-cap":"round"},"paint":{"line-color":"#a0c8f0","line-width":{"base":1.3,"stops":[[13,0.5],[20,6]]}}},{"id":"waterway-river","type":"line","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"waterway","filter":["all",["==","class","river"],["!=","brunnel","tunnel"]],"layout":{"line-cap":"round"},"paint":{"line-color":"#a0c8f0","line-width":{"base":1.2,"stops":[[10,0.8],[20,4]]},"line-opacity":0.5}},{"id":"water-offset","type":"fill","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"water","maxzoom":8,"filter":["==","$type","Polygon"],"layout":{"visibility":"visible"},"paint":{"fill-opacity":0,"fill-color":"#a0c8f0","fill-translate":{"base":1,"stops":[[6,[2,0]],[8,[0,0]]]}}},{"id":"water","type":"fill","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"water","layout":{"visibility":"visible"},"paint":{"fill-color":"hsl(210, 67%, 85%)","fill-opacity":0}},{"id":"water-pattern","type":"fill","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"water","layout":{"visibility":"visible"},"paint":{"fill-translate":[0,2.5],"fill-pattern":"wave","fill-opacity":1}},{"id":"landcover-ice-shelf","type":"fill","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"landcover","filter":["==","subclass","ice_shelf"],"layout":{"visibility":"visible"},"paint":{"fill-color":"#fff","fill-opacity":{"base":1,"stops":[[0,0.9],[10,0.3]]}}},{"id":"tunnel-service-track-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","service","track"]],"layout":{"line-join":"round"},"paint":{"line-color":"#cfcdca","line-dasharray":[0.5,0.25],"line-width":{"base":1.2,"stops":[[15,1],[16,4],[20,11]]}}},{"id":"tunnel-minor-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","minor"]],"layout":{"line-join":"round"},"paint":{"line-color":"#cfcdca","line-opacity":{"stops":[[12,0],[12.5,1]]},"line-width":{"base":1.2,"stops":[[12,0.5],[13,1],[14,4],[20,15]]}}},{"id":"tunnel-secondary-tertiary-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","secondary","tertiary"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[8,1.5],[20,17]]}}},{"id":"tunnel-trunk-primary-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","primary","trunk"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-width":{"base":1.2,"stops":[[5,0.4],[6,0.6],[7,1.5],[20,22]]},"line-opacity":0.7}},{"id":"tunnel-motorway-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","motorway"]],"layout":{"line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-dasharray":[0.5,0.25],"line-width":{"base":1.2,"stops":[[5,0.4],[6,0.6],[7,1.5],[20,22]]},"line-opacity":0.5}},{"id":"tunnel-path","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","brunnel","tunnel"],["==","class","path"]]],"paint":{"line-color":"#cba","line-dasharray":[1.5,0.75],"line-width":{"base":1.2,"stops":[[15,1.2],[20,4]]}}},{"id":"tunnel-service-track","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","service","track"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fff","line-width":{"base":1.2,"stops":[[15.5,0],[16,2],[20,7.5]]}}},{"id":"tunnel-minor","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","minor_road"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fff","line-opacity":1,"line-width":{"base":1.2,"stops":[[13.5,0],[14,2.5],[20,11.5]]}}},{"id":"tunnel-secondary-tertiary","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","secondary","tertiary"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fff4c6","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,10]]}}},{"id":"tunnel-trunk-primary","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","primary","trunk"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fff4c6","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"tunnel-motorway","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","motorway"]],"layout":{"line-join":"round","visibility":"visible"},"paint":{"line-color":"#ffdaa6","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"tunnel-railway","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","rail"]],"paint":{"line-color":"#bbb","line-width":{"base":1.4,"stops":[[14,0.4],[15,0.75],[20,2]]},"line-dasharray":[2,2]}},{"id":"ferry","type":"line","source":"openmaptiles","source-layer":"transportation","filter":["all",["in","class","ferry"]],"layout":{"line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(108, 159, 182, 1)","line-width":1.1,"line-dasharray":[2,2]}},{"id":"aeroway-taxiway-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"aeroway","minzoom":12,"filter":["all",["in","class","taxiway"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(153, 153, 153, 1)","line-width":{"base":1.5,"stops":[[11,2],[17,12]]},"line-opacity":1}},{"id":"aeroway-runway-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"aeroway","minzoom":12,"filter":["all",["in","class","runway"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(153, 153, 153, 1)","line-width":{"base":1.5,"stops":[[11,5],[17,55]]},"line-opacity":1}},{"id":"aeroway-taxiway","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"aeroway","minzoom":4,"filter":["all",["in","class","taxiway"],["==","$type","LineString"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(255, 255, 255, 1)","line-width":{"base":1.5,"stops":[[11,1],[17,10]]},"line-opacity":{"base":1,"stops":[[11,0],[12,1]]}}},{"id":"aeroway-runway","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"aeroway","minzoom":4,"filter":["all",["in","class","runway"],["==","$type","LineString"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(255, 255, 255, 1)","line-width":{"base":1.5,"stops":[[11,4],[17,50]]},"line-opacity":{"base":1,"stops":[[11,0],[12,1]]}}},{"id":"highway-motorway-link-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":12,"filter":["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway_link"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[12,1],[13,3],[14,4],[20,15]]}}},{"id":"highway-link-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":13,"filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[12,1],[13,3],[14,4],[20,15]]}}},{"id":"highway-minor-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!=","brunnel","tunnel"],["in","class","minor","service","track"]]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"#cfcdca","line-opacity":{"stops":[[12,0],[12.5,0]]},"line-width":{"base":1.2,"stops":[[12,0.5],[13,1],[14,4],[20,15]]}}},{"id":"highway-secondary-tertiary-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","secondary","tertiary"]],"layout":{"line-cap":"butt","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-opacity":0.5,"line-width":{"base":1.2,"stops":[[8,1.5],[20,17]]}}},{"id":"highway-primary-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":5,"filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","primary"]],"layout":{"line-cap":"butt","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-opacity":{"stops":[[7,0],[8,0.6]]},"line-width":{"base":1.2,"stops":[[7,0],[8,0.6],[9,1.5],[20,22]]}}},{"id":"highway-trunk-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":5,"filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","trunk"]],"layout":{"line-cap":"butt","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-opacity":{"stops":[[5,0],[6,0.5]]},"line-width":{"base":1.2,"stops":[[5,0],[6,0.6],[7,1.5],[20,22]]}}},{"id":"highway-motorway-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":4,"filter":["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway"]],"layout":{"line-cap":"butt","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-width":{"base":1.2,"stops":[[4,0],[5,0.4],[6,0.6],[7,1.5],[20,22]]},"line-opacity":{"stops":[[4,0],[5,0.5]]}}},{"id":"highway-path","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["==","class","path"]]],"paint":{"line-color":"#cba","line-dasharray":[1.5,0.75],"line-width":{"base":1.2,"stops":[[15,1.2],[20,4]]}}},{"id":"highway-motorway-link","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":12,"filter":["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway_link"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"#fc8","line-width":{"base":1.2,"stops":[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{"id":"highway-link","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":13,"filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{"id":"highway-minor","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!=","brunnel","tunnel"],["in","class","minor","service","track"]]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"#fff","line-opacity":0.5,"line-width":{"base":1.2,"stops":[[13.5,0],[14,2.5],[20,11.5]]}}},{"id":"highway-secondary-tertiary","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","secondary","tertiary"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[6.5,0],[8,0.5],[20,13]]},"line-opacity":0.5}},{"id":"highway-primary","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["in","class","primary"]]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[8.5,0],[9,0.5],[20,18]]},"line-opacity":0}},{"id":"highway-trunk","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["in","class","trunk"]]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"highway-motorway","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":5,"filter":["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway"]]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fc8","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"railway-transit","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","class","transit"],["!in","brunnel","tunnel"]]],"layout":{"visibility":"visible"},"paint":{"line-color":"hsla(0, 0%, 73%, 0.77)","line-width":{"base":1.4,"stops":[[14,0.4],[20,1]]}}},{"id":"railway-transit-hatching","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","class","transit"],["!in","brunnel","tunnel"]]],"layout":{"visibility":"visible"},"paint":{"line-color":"hsla(0, 0%, 73%, 0.68)","line-dasharray":[0.2,8],"line-width":{"base":1.4,"stops":[[14.5,0],[15,2],[20,6]]}}},{"id":"railway-service","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","class","rail"],["has","service"]]],"paint":{"line-color":"hsla(0, 0%, 73%, 0.77)","line-width":{"base":1.4,"stops":[[14,0.4],[20,1]]}}},{"id":"railway-service-hatching","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","class","rail"],["has","service"]]],"layout":{"visibility":"visible"},"paint":{"line-color":"hsla(0, 0%, 73%, 0.68)","line-dasharray":[0.2,8],"line-width":{"base":1.4,"stops":[[14.5,0],[15,2],[20,6]]}}},{"id":"railway","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!has","service"],["!in","brunnel","bridge","tunnel"],["==","class","rail"]]],"paint":{"line-color":"#bbb","line-width":{"base":1.4,"stops":[[14,0.4],[15,0.75],[20,2]]}}},{"id":"railway-hatching","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!has","service"],["!in","brunnel","bridge","tunnel"],["==","class","rail"]]],"paint":{"line-color":"#bbb","line-dasharray":[0.2,8],"line-width":{"base":1.4,"stops":[[14.5,0],[15,3],[20,8]]}}},{"id":"bridge-motorway-link-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","motorway_link"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[12,1],[13,3],[14,4],[20,15]]}}},{"id":"bridge-link-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[12,1],[13,3],[14,4],[20,15]]}}},{"id":"bridge-secondary-tertiary-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","secondary","tertiary"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[8,1.5],[20,28]]}}},{"id":"bridge-trunk-primary-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","primary","trunk"]],"layout":{"line-join":"round"},"paint":{"line-color":"hsl(28, 76%, 67%)","line-width":{"base":1.2,"stops":[[5,0.4],[6,0.6],[7,1.5],[20,26]]}}},{"id":"bridge-motorway-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","motorway"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-width":{"base":1.2,"stops":[[5,0.4],[6,0.6],[7,1.5],[20,22]]},"line-opacity":0.5}},{"id":"bridge-path-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","brunnel","bridge"],["==","class","path"]]],"paint":{"line-color":"#f8f4f0","line-width":{"base":1.2,"stops":[[15,1.2],[20,18]]}}},{"id":"bridge-path","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","brunnel","bridge"],["==","class","path"]]],"paint":{"line-color":"#cba","line-width":{"base":1.2,"stops":[[15,1.2],[20,4]]},"line-dasharray":[1.5,0.75]}},{"id":"bridge-motorway-link","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","motorway_link"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fc8","line-width":{"base":1.2,"stops":[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{"id":"bridge-link","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{"id":"bridge-secondary-tertiary","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","secondary","tertiary"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,20]]}}},{"id":"bridge-trunk-primary","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","primary","trunk"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]}}},{"id":"bridge-motorway","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","motorway"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fc8","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"bridge-railway","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","rail"]],"paint":{"line-color":"#bbb","line-width":{"base":1.4,"stops":[[14,0.4],[15,0.75],[20,2]]}}},{"id":"bridge-railway-hatching","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","rail"]],"paint":{"line-color":"#bbb","line-dasharray":[0.2,8],"line-width":{"base":1.4,"stops":[[14.5,0],[15,3],[20,8]]}}},{"id":"cablecar","type":"line","source":"openmaptiles","source-layer":"transportation","minzoom":13,"filter":["==","class","cable_car"],"layout":{"visibility":"visible","line-cap":"round"},"paint":{"line-color":"hsl(0, 0%, 70%)","line-width":{"base":1,"stops":[[11,1],[19,2.5]]}}},{"id":"cablecar-dash","type":"line","source":"openmaptiles","source-layer":"transportation","minzoom":13,"filter":["==","class","cable_car"],"layout":{"visibility":"visible","line-cap":"round"},"paint":{"line-color":"hsl(0, 0%, 70%)","line-width":{"base":1,"stops":[[11,3],[19,5.5]]},"line-dasharray":[2,3]}},{"id":"boundary-land-level-4","type":"line","source":"openmaptiles","source-layer":"boundary","filter":["all",[">=","admin_level",4],["<=","admin_level",8],["!=","maritime",1]],"layout":{"line-join":"round"},"paint":{"line-color":"#9e9cab","line-dasharray":[3,1,1,1],"line-width":{"base":1.4,"stops":[[4,0.4],[5,1],[12,3]]},"line-opacity":0.6}},{"id":"boundary-land-level-2","type":"line","source":"openmaptiles","source-layer":"boundary","filter":["all",["==","admin_level",2],["!=","maritime",1],["!=","disputed",1]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"hsl(248, 7%, 66%)","line-width":{"base":1,"stops":[[0,0.6],[4,1.4],[5,2],[12,2]]}}},{"id":"boundary-land-disputed","type":"line","source":"openmaptiles","source-layer":"boundary","filter":["all",["!=","maritime",1],["==","disputed",1]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"hsl(248, 7%, 70%)","line-dasharray":[1,3],"line-width":{"base":1,"stops":[[0,0.6],[4,1.4],[5,2],[12,8]]}}},{"id":"boundary-water","type":"line","source":"openmaptiles","source-layer":"boundary","filter":["all",["in","admin_level",2,4],["==","maritime",1]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"rgba(154, 189, 214, 1)","line-width":{"base":1,"stops":[[0,0.6],[4,1],[5,1],[12,1]]},"line-opacity":{"stops":[[6,0],[10,0]]}}},{"id":"waterway-name","type":"symbol","source":"openmaptiles","source-layer":"waterway","minzoom":13,"filter":["all",["==","$type","LineString"],["has","name"]],"layout":{"text-font":["Noto Sans Italic"],"text-size":14,"text-field":"{name:latin} {name:nonlatin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"line","text-letter-spacing":0.2,"symbol-spacing":350},"paint":{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{"id":"water-name-lakeline","type":"symbol","source":"openmaptiles","source-layer":"water_name","filter":["==","$type","LineString"],"layout":{"text-font":["Noto Sans Italic"],"text-size":14,"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"line","symbol-spacing":350,"text-letter-spacing":0.2},"paint":{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{"id":"water-name-ocean","type":"symbol","source":"openmaptiles","source-layer":"water_name","filter":["all",["==","$type","Point"],["==","class","ocean"]],"layout":{"text-font":["Noto Sans Italic"],"text-size":14,"text-field":"{name:latin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"point","symbol-spacing":350,"text-letter-spacing":0.2},"paint":{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{"id":"water-name-other","type":"symbol","source":"openmaptiles","source-layer":"water_name","filter":["all",["==","$type","Point"],["!in","class","ocean"]],"layout":{"text-font":["Noto Sans Italic"],"text-size":{"stops":[[0,10],[6,14]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"point","symbol-spacing":350,"text-letter-spacing":0.2,"visibility":"visible"},"paint":{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{"id":"poi-level-3","type":"symbol","source":"openmaptiles","source-layer":"poi","minzoom":16,"filter":["all",["==","$type","Point"],[">=","rank",25]],"layout":{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":"{name:latin}\\n{name:nonlatin}","text-offset":[0,0.6],"text-size":12,"text-max-width":9},"paint":{"text-halo-blur":0.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{"id":"poi-level-2","type":"symbol","source":"openmaptiles","source-layer":"poi","minzoom":15,"filter":["all",["==","$type","Point"],["<=","rank",24],[">=","rank",15]],"layout":{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":"{name:latin}\\n{name:nonlatin}","text-offset":[0,0.6],"text-size":12,"text-max-width":9},"paint":{"text-halo-blur":0.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{"id":"poi-level-1","type":"symbol","source":"openmaptiles","source-layer":"poi","minzoom":14,"filter":["all",["==","$type","Point"],["<=","rank",14],["has","name"]],"layout":{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":"{name:latin}\\n{name:nonlatin}","text-offset":[0,0.6],"text-size":11,"text-max-width":9},"paint":{"text-halo-blur":0.5,"text-color":"rgba(191, 228, 172, 1)","text-halo-width":1,"text-halo-color":"rgba(30, 29, 29, 1)"}},{"id":"poi-railway","type":"symbol","source":"openmaptiles","source-layer":"poi","minzoom":13,"filter":["all",["==","$type","Point"],["has","name"],["==","class","railway"],["==","subclass","station"]],"layout":{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":"{name:latin}\\n{name:nonlatin}","text-offset":[0,0.6],"text-size":12,"text-max-width":9,"icon-optional":false,"icon-ignore-placement":false,"icon-allow-overlap":false,"text-ignore-placement":false,"text-allow-overlap":false,"text-optional":true},"paint":{"text-halo-blur":0.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{"id":"road_oneway","type":"symbol","source":"openmaptiles","source-layer":"transportation","minzoom":15,"filter":["all",["==","oneway",1],["in","class","motorway","trunk","primary","secondary","tertiary","minor","service"]],"layout":{"symbol-placement":"line","icon-image":"oneway","symbol-spacing":75,"icon-padding":2,"icon-rotation-alignment":"map","icon-rotate":90,"icon-size":{"stops":[[15,0.5],[19,1]]}},"paint":{"icon-opacity":0.5}},{"id":"road_oneway_opposite","type":"symbol","source":"openmaptiles","source-layer":"transportation","minzoom":15,"filter":["all",["==","oneway",-1],["in","class","motorway","trunk","primary","secondary","tertiary","minor","service"]],"layout":{"symbol-placement":"line","icon-image":"oneway","symbol-spacing":75,"icon-padding":2,"icon-rotation-alignment":"map","icon-rotate":-90,"icon-size":{"stops":[[15,0.5],[19,1]]}},"paint":{"icon-opacity":0.5}},{"id":"highway-name-path","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":15.5,"filter":["==","class","path"],"layout":{"text-size":{"base":1,"stops":[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},"paint":{"text-halo-color":"#f8f4f0","text-color":"hsl(30, 23%, 62%)","text-halo-width":0.5}},{"id":"highway-name-minor","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":15,"filter":["all",["==","$type","LineString"],["in","class","minor","service","track"]],"layout":{"text-size":{"base":1,"stops":[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},"paint":{"text-halo-blur":0.5,"text-color":"#765","text-halo-width":1}},{"id":"highway-name-major","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":12.2,"filter":["in","class","primary","secondary","tertiary","trunk"],"layout":{"text-size":{"base":1,"stops":[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},"paint":{"text-halo-blur":0.5,"text-color":"#765","text-halo-width":1}},{"id":"highway-shield","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":8,"filter":["all",["<=","ref_length",6],["==","$type","LineString"],["!in","network","us-interstate","us-highway","us-state"]],"layout":{"text-size":10,"icon-image":"road_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-font":["Noto Sans Regular"],"symbol-placement":{"base":1,"stops":[[10,"point"],[11,"line"]]},"text-rotation-alignment":"viewport","icon-size":1,"text-field":"{ref}"},"paint":{"text-opacity":1,"text-color":"rgba(20, 19, 19, 1)","text-halo-color":"rgba(230, 221, 221, 0)","text-halo-width":2,"icon-color":"rgba(183, 18, 18, 1)","icon-opacity":0.3,"icon-halo-color":"rgba(183, 55, 55, 0)"}},{"id":"highway-shield-us-interstate","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":7,"filter":["all",["<=","ref_length",6],["==","$type","LineString"],["in","network","us-interstate"]],"layout":{"text-size":10,"icon-image":"{network}_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-font":["Noto Sans Regular"],"symbol-placement":{"base":1,"stops":[[7,"point"],[7,"line"],[8,"line"]]},"text-rotation-alignment":"viewport","icon-size":1,"text-field":"{ref}"},"paint":{"text-color":"rgba(0, 0, 0, 1)"}},{"id":"highway-shield-us-other","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":9,"filter":["all",["<=","ref_length",6],["==","$type","LineString"],["in","network","us-highway","us-state"]],"layout":{"text-size":10,"icon-image":"{network}_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-font":["Noto Sans Regular"],"symbol-placement":{"base":1,"stops":[[10,"point"],[11,"line"]]},"text-rotation-alignment":"viewport","icon-size":1,"text-field":"{ref}"},"paint":{"text-color":"rgba(0, 0, 0, 1)"}},{"id":"place-other","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","minzoom":12,"filter":["!in","class","city","town","village","country","continent"],"layout":{"text-letter-spacing":0.1,"text-size":{"base":1.2,"stops":[[12,10],[15,14]]},"text-font":["Noto Sans Bold"],"text-field":"{name:latin}\\n{name:nonlatin}","text-transform":"uppercase","text-max-width":9,"visibility":"visible"},"paint":{"text-color":"rgba(255,255,255,1)","text-halo-width":1.2,"text-halo-color":"rgba(57, 28, 28, 1)"}},{"id":"place-village","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","minzoom":10,"filter":["==","class","village"],"layout":{"text-font":["Noto Sans Regular"],"text-size":{"base":1.2,"stops":[[10,12],[15,16]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":8,"visibility":"visible"},"paint":{"text-color":"rgba(255, 255, 255, 1)","text-halo-width":1.2,"text-halo-color":"rgba(10, 9, 9, 0.8)"}},{"id":"place-town","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["==","class","town"],"layout":{"text-font":["Noto Sans Regular"],"text-size":{"base":1.2,"stops":[[10,14],[15,24]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":8,"visibility":"visible"},"paint":{"text-color":"rgba(255, 255, 255, 1)","text-halo-width":1.2,"text-halo-color":"rgba(22, 22, 22, 0.8)"}},{"id":"place-city","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["!=","capital",2],["==","class","city"]],"layout":{"text-font":["Noto Sans Regular"],"text-size":{"base":1.2,"stops":[[7,14],[11,24]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":8,"visibility":"visible"},"paint":{"text-color":"rgba(0, 0, 0, 1)","text-halo-width":1.2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-city-capital","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","capital",2],["==","class","city"]],"layout":{"text-font":["Noto Sans Regular"],"text-size":{"base":1.2,"stops":[[7,14],[11,24]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":8,"icon-image":"star_11","text-offset":[0.4,0],"icon-size":0.8,"text-anchor":"left","visibility":"visible"},"paint":{"text-color":"#333","text-halo-width":1.2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-country-other","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","class","country"],[">=","rank",3],["!has","iso_a2"]],"layout":{"text-font":["Noto Sans Italic"],"text-field":"{name:latin}","text-size":{"stops":[[3,11],[7,17]]},"text-transform":"uppercase","text-max-width":6.25,"visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-country-3","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","class","country"],[">=","rank",3],["has","iso_a2"]],"layout":{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{"stops":[[3,11],[7,17]]},"text-transform":"uppercase","text-max-width":6.25,"visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-country-2","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","class","country"],["==","rank",2],["has","iso_a2"]],"layout":{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{"stops":[[2,11],[5,17]]},"text-transform":"uppercase","text-max-width":6.25,"visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-country-1","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","class","country"],["==","rank",1],["has","iso_a2"]],"layout":{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{"stops":[[1,11],[4,17]]},"text-transform":"uppercase","text-max-width":6.25,"visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-continent","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","maxzoom":1,"filter":["==","class","continent"],"layout":{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":14,"text-max-width":6.25,"text-transform":"uppercase","visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}}],"id":"qebnlkra6"}`)},51962:function(p){p.exports=JSON.parse(`{"version":8,"name":"orto","metadata":{},"center":[1.537786,41.837539],"zoom":12,"bearing":0,"pitch":0,"light":{"anchor":"viewport","color":"white","intensity":0.4,"position":[1.15,45,30]},"sources":{"ortoEsri":{"type":"raster","tiles":["https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"],"tileSize":256,"maxzoom":18,"attribution":"ESRI © <a href='http://www.esri.com'>ESRI</a>"},"ortoInstaMaps":{"type":"raster","tiles":["https://tilemaps.icgc.cat/mapfactory/wmts/orto_8_12/CAT3857/{z}/{x}/{y}.png"],"tileSize":256,"maxzoom":13},"ortoICGC":{"type":"raster","tiles":["https://geoserveis.icgc.cat/icc_mapesmultibase/noutm/wmts/orto/GRID3857/{z}/{x}/{y}.jpeg"],"tileSize":256,"minzoom":13.1,"maxzoom":20},"openmaptiles":{"type":"vector","url":"https://geoserveis.icgc.cat/contextmaps/basemap.json"}},"sprite":"https://geoserveis.icgc.cat/contextmaps/sprites/sprite@1","glyphs":"https://geoserveis.icgc.cat/contextmaps/glyphs/{fontstack}/{range}.pbf","layers":[{"id":"background","type":"background","paint":{"background-color":"#F4F9F4"}},{"id":"ortoEsri","type":"raster","source":"ortoEsri","maxzoom":16,"layout":{"visibility":"visible"}},{"id":"ortoICGC","type":"raster","source":"ortoICGC","minzoom":13.1,"maxzoom":19,"layout":{"visibility":"visible"}},{"id":"ortoInstaMaps","type":"raster","source":"ortoInstaMaps","maxzoom":13,"layout":{"visibility":"visible"}}]}`)}},u={};function R(p){var f=u[p];if(f!==void 0)return f.exports;var n=u[p]={id:p,exports:{}};return r[p].call(n.exports,n,n.exports,R),n.exports}return R.m=r,R.n=function(p){var f=p&&p.__esModule?function(){return p.default}:function(){return p};return R.d(f,{a:f}),f},R.d=function(p,f){for(var n in f)R.o(f,n)&&!R.o(p,n)&&Object.defineProperty(p,n,{enumerable:!0,get:f[n]})},R.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),R.o=function(p,f){return Object.prototype.hasOwnProperty.call(p,f)},R.r=function(p){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(p,"__esModule",{value:!0})},R.b=document.baseURI||self.location.href,R.nc=void 0,R(20260)}()})})(mP);var UW=mP.exports;const nd=f8(UW),HW={highlightColor:"#E4572E",selectedColor:"#F3A712",unhighlightedColor:"lightblue",highlightHiddenColor:"#1f77b4",annotationBackground:"#f8f8f8"},qW={xPosScalingFactor:80,xPosScalingThreshold:500,minAnnotationWidth:40},WW=wg({name:"PlotlyLineplot",props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(){const t=Cg(),e=zy();return{streamlitDataStore:t,selectionStore:e}},data(){return{isInitialized:!1,manualXRange:void 0,lastAutoZoomedPeakIndex:void 0,textMeasureCanvas:null}},computed:{id(){return`plot-${this.index}`},theme(){return this.streamlitDataStore.theme},styling(){return{...HW,...this.args.styling}},config(){return{...qW,...this.args.config}},actualPlotWidth(){const t=document.getElementById(this.id);if(t){const e=t.getBoundingClientRect();if(e.width>0)return e.width}return 800},plotConfig(){var t;return(t=this.streamlitDataStore.allDataForDrawing)==null?void 0:t._plotConfig},plotData(){var n;const t=(n=this.streamlitDataStore.allDataForDrawing)==null?void 0:n.plotData;if(!t)return;const e=this.plotConfig,r=(e==null?void 0:e.xColumn)||this.args.xColumn||"x",u=(e==null?void 0:e.yColumn)||this.args.yColumn||"y",R={x_values:t[r]||[],y_values:t[u]||[]},p=(e==null?void 0:e.highlightColumn)||this.args.highlightColumn;p&&t[p]&&(R.highlight_mask=t[p]);const f=(e==null?void 0:e.annotationColumn)||this.args.annotationColumn;if(f&&t[f]&&(R.annotations=t[f]),this.args.interactivity)for(const[l,c]of Object.entries(this.args.interactivity)){const i=c;t[i]&&(R[`interactivity_${i}`]=t[i])}return R},interactivity(){return this.args.interactivity||{}},selectedPeakIndex(){if(!(!this.isDataReady||!this.plotData))for(const[t,e]of Object.entries(this.interactivity)){const r=this.selectionStore.$state[t];if(r==null)continue;const u=`interactivity_${e}`,R=this.plotData[u];if(R&&Array.isArray(R)){for(let p=0;p<R.length;p++)if(R[p]===r)return p}else if(e===this.args.xColumn){const p=this.plotData.x_values;for(let f=0;f<p.length;f++)if(p[f]===r)return f}}},isDataReady(){return this.plotData?Array.isArray(this.plotData.x_values)&&Array.isArray(this.plotData.y_values)&&this.plotData.x_values.length>0:!1},xValuesStick(){if(!this.isDataReady||!this.plotData)return[];const t=[];for(const e of this.plotData.x_values)t.push(e,e,e);return t},yValuesStick(){if(!this.isDataReady||!this.plotData)return[];const t=[],e=-1e7;for(const r of this.plotData.y_values)t.push(e,r,e);return t},xRange(){if(this.manualXRange)return this.manualXRange;if(!this.isDataReady||!this.plotData)return[0,1];const t=this.plotData.x_values,e=Math.min(...t),r=Math.max(...t),u=(r-e)*.02;return[e-u,r+u]},yRange(){if(!this.isDataReady||!this.plotData)return[0,1];const{x_values:t,y_values:e}=this.plotData,r=this.xRange;let u=0;for(let R=0;R<t.length;R++){const p=t[R],f=e[R];p>=r[0]&&p<=r[1]&&f>u&&(u=f)}return u===0?[0,1]:[0,u*1.8]},xPosScalingFactor(){const t=this.xRange,e=t[1]-t[0];return 1200/this.actualPlotWidth*e/this.config.xPosScalingFactor},annotatedPeaks(){if(!this.isDataReady||!this.plotData)return[];const{x_values:t,y_values:e,annotations:r,highlight_mask:u}=this.plotData;if(!r)return[];const R=[];for(let p=0;p<r.length;p++){const f=r[p];!f||f.length===0||u&&!u[p]||R.push({x:t[p],y:e[p],label:f,index:p})}return R},annotationBoxData(){const t=this.annotatedPeaks;if(t.length===0)return[];const e=this.yRange,r=this.xRange;if(e[1]<=0||r[1]<=r[0])return[];const u=e[1]/1.8,R=u*1.18,p=u*1.32,f=p-R,n=16,l=[];for(const b of t){const w=b.x>=r[0]&&b.x<=r[1],v=this.measureTextWidth(b.label),o=this.pixelWidthToDataUnits(v+n);l.push({x:b.x,y:(R+p)/2,width:o,height:f,label:b.label,visible:!1,inVisibleRange:w,index:b.index,peakY:b.y})}const c=l.filter(b=>b.inVisibleRange).sort((b,w)=>w.peakY!==b.peakY?w.peakY-b.peakY:b.x-w.x),i=this.pixelWidthToDataUnits(4),_=[];for(const b of c){const w=b.x-b.width/2-i,v=b.x+b.width/2+i;let o=!1;for(const a of _){const h=a.x-a.width/2,s=a.x+a.width/2;if(!(v<h||w>s)){o=!0;break}}o||(b.visible=!0,_.push(b))}return l},annotationShapes(){const t=this.annotationBoxData,e=[],r=this.yRange;if(r[1]<=0)return e;const u=r[1]/1.8,R=u*1.18,p=u*1.32,f=this.selectedPeakIndex;for(const n of t){if(!n.visible)continue;const c=n.index===f?this.styling.selectedColor:this.styling.highlightColor;e.push({type:"rect",x0:n.x-n.width/2,y0:R,x1:n.x+n.width/2,y1:p,fillcolor:c,line:{width:0}})}return e},peakAnnotations(){const t=this.annotationBoxData,e=[],r=this.yRange;if(r[1]<=0)return e;const R=r[1]/1.8*1.25;for(const p of t)p.visible&&e.push({x:p.x,y:R,xref:"x",yref:"y",text:p.label,showarrow:!1,font:{size:14,color:"white"}});return e},selectedAnnotationHidden(){const t=this.selectedPeakIndex;if(t===void 0)return!1;const r=this.annotationBoxData.find(u=>u.index===t);return r?!r.visible:!1},traces(){if(!this.isDataReady||!this.plotData)return this.getFallbackData();const t=[],{highlight_mask:e}=this.plotData,r=this.selectedPeakIndex,u=-1e7,R=[],p=[],f=[],n=[],l=[],c=[],i=this.plotData.x_values.length;for(let _=0;_<i;_++){const b=this.plotData.x_values[_],w=this.plotData.y_values[_],v=e?e[_]:!1;r!==void 0&&_===r?(l.push(b,b,b),c.push(u,w,u)):v?(f.push(b,b,b),n.push(u,w,u)):(R.push(b,b,b),p.push(u,w,u))}return R.length>0&&t.push({x:R,y:p,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.unhighlightedColor},hoverinfo:"x+y"}),f.length>0&&t.push({x:f,y:n,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.highlightColor},hoverinfo:"x+y"}),l.length>0&&t.push({x:l,y:c,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.selectedColor},line:{width:3},hoverinfo:"x+y"}),t.length===0&&t.push({x:this.xValuesStick,y:this.yValuesStick,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.highlightHiddenColor},hoverinfo:"x+y"}),t},layout(){var t,e,r,u,R;return{title:this.args.title?{text:`<b>${this.args.title}</b>`}:void 0,showlegend:!1,height:this.args.height||400,xaxis:{title:this.args.xLabel?{text:this.args.xLabel}:void 0,showgrid:!1,showline:!0,linecolor:"grey",linewidth:1,range:this.xRange},yaxis:{title:this.args.yLabel?{text:this.args.yLabel}:void 0,showgrid:!0,gridcolor:((t=this.theme)==null?void 0:t.secondaryBackgroundColor)||"#f0f0f0",rangemode:"nonnegative",fixedrange:!1,showline:!0,linecolor:"grey",linewidth:1,range:this.yRange},paper_bgcolor:((e=this.theme)==null?void 0:e.backgroundColor)||"white",plot_bgcolor:((r=this.theme)==null?void 0:r.backgroundColor)||"white",font:{color:((u=this.theme)==null?void 0:u.textColor)||"black",family:((R=this.theme)==null?void 0:R.font)||"Arial"},margin:{l:60,r:20,t:this.args.title?50:20,b:50},shapes:this.annotationShapes,annotations:this.peakAnnotations}},cssCustomProperties(){return{"--highlight-color":this.styling.highlightColor,"--selected-color":this.styling.selectedColor,"--unhighlighted-color":this.styling.unhighlightedColor}}},watch:{isDataReady:{handler(t){t&&this.isInitialized&&this.renderPlot()},immediate:!0},"streamlitDataStore.allDataForDrawing.plotData":{handler(t,e){var r,u,R,p;console.log("[LinePlot] plotData changed",{newLength:(r=t==null?void 0:t.x_values)==null?void 0:r.length,oldLength:(u=e==null?void 0:e.x_values)==null?void 0:u.length,newFirstX:(R=t==null?void 0:t.x_values)==null?void 0:R[0],oldFirstX:(p=e==null?void 0:e.x_values)==null?void 0:p[0]}),this.isInitialized&&(this.manualXRange=void 0,this.lastAutoZoomedPeakIndex=void 0,this.renderPlot())},deep:!0},"streamlitDataStore.allDataForDrawing._plotConfig":{handler(){this.isInitialized&&this.renderPlot()},deep:!0},"selectionStore.$state":{handler(t){console.log("[LinePlot] selection changed",t),this.isDataReady&&this.isInitialized&&(this.autoZoomToSelectedAnnotation(),this.renderPlot())},deep:!0}},mounted(){this.isInitialized=!0,this.$nextTick(()=>{this.isDataReady&&this.renderPlot()})},methods:{measureTextWidth(t){this.textMeasureCanvas||(this.textMeasureCanvas=document.createElement("canvas"));const e=this.textMeasureCanvas.getContext("2d");return e?(e.font="14px Arial",e.measureText(t).width):t.length*8},pixelWidthToDataUnits(t){const e=this.xRange,r=e[1]-e[0],u=this.actualPlotWidth;return t/(u/r)},async renderPlot(){try{if(!document.getElementById(this.id)){console.warn(`PlotlyLineplot: DOM element with id '${this.id}' not found`);return}const e=[{title:"Download as SVG",name:"toImageSvg",icon:{width:1792,height:1792,path:"M1152 1376v-160q0-14-9-23t-23-9h-96v-512q0-14-9-23t-23-9h-320q-14 0-23 9t-9 23v160q0 14 9 23t23 9h96v320h-96q-14 0-23 9t-9 23v160q0 14 9 23t23 9h320q14 0 23-9t9-23zm-128-896v-160q0-14-9-23t-23-9h-192q-14 0-23 9t-9 23v160q0 14 9 23t23 9h192q14 0 23-9t9-23zm640 416q0 209-103 385.5t-279.5 279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5 385.5-103 385.5 103 279.5 279.5 103 385.5z"},click:()=>{const u=document.getElementById(this.id);u&&nd.downloadImage(u,{filename:this.args.title||"plot",height:400,width:1200,format:"svg"})}}];await nd.newPlot(this.id,this.traces,this.layout,{modeBarButtonsToRemove:["toImage","sendDataToCloud"],modeBarButtonsToAdd:e,scrollZoom:!0,responsive:!0}),this.$nextTick(()=>{this.args.height?Hc.setFrameHeight(this.args.height):Hc.setFrameHeight()});const r=document.getElementById(this.id);r&&(r.on("plotly_click",u=>{this.onPlotClick(u)}),r.on("plotly_relayout",u=>{this.onRelayout(u)}))}catch(t){console.error("PlotlyLineplot: Error rendering plot:",t),this.renderFallback()}},onRelayout(t){if(t["xaxis.range[0]"]!==void 0&&t["xaxis.range[1]"]!==void 0){const e=[t["xaxis.range[0]"],t["xaxis.range[1]"]];e[0]<0&&(e[0]=0),this.manualXRange=e,this.lastAutoZoomedPeakIndex=void 0,this.renderPlot()}else t["xaxis.autorange"]===!0&&(this.manualXRange=void 0,this.lastAutoZoomedPeakIndex=void 0,this.renderPlot())},autoZoomToSelectedAnnotation(){const t=this.selectedPeakIndex;if(t===void 0){this.lastAutoZoomedPeakIndex=void 0;return}if(t===this.lastAutoZoomedPeakIndex||!this.selectedAnnotationHidden)return;const e=this.calculateZoomForSelectedAnnotation();e&&(this.manualXRange=e,this.lastAutoZoomedPeakIndex=t)},calculateZoomForSelectedAnnotation(){const t=this.selectedPeakIndex;if(t===void 0||!this.plotData)return;const e=this.annotatedPeaks,r=e.find(b=>b.index===t);if(!r)return;let u=1/0,R=1/0;for(const b of e){if(b.index===t)continue;const w=b.x-r.x;w<0&&-w<u?u=-w:w>0&&w<R&&(R=w)}const p=Math.min(u,R);this.actualPlotWidth,this.config.xPosScalingFactor;let f;if(p<1/0)f=p*2;else{const b=this.plotData.x_values;f=(Math.max(...b)-Math.min(...b))*.2}const n=this.plotData.x_values,l=Math.min(...n),c=Math.max(...n);let i=r.x-f/2,_=r.x+f/2;return i<l&&(i=l,_=Math.min(l+f,c)),_>c&&(_=c,i=Math.max(c-f,l)),[i,_]},onPlotClick(t){if(!(!this.interactivity||Object.keys(this.interactivity).length===0)&&t.points&&t.points.length>0){const r=t.points[0].x;if(!this.plotData)return;const u=this.plotData.x_values;let R=0,p=1/0;for(let f=0;f<u.length;f++){const n=Math.abs(u[f]-r);n<p&&(p=n,R=f)}for(const[f,n]of Object.entries(this.interactivity)){const l=`interactivity_${n}`,c=this.plotData[l];c&&Array.isArray(c)&&R<c.length?this.selectionStore.updateSelection(f,c[R]):n===this.args.xColumn&&this.selectionStore.updateSelection(f,u[R])}}},getFallbackData(){return[{x:[0,1],y:[0,0],mode:"lines",type:"scatter",marker:{color:this.styling.unhighlightedColor},name:"No Data"}]},async renderFallback(){var t,e,r,u;try{const R={title:{text:"<b>No Data Available</b>"},showlegend:!1,height:400,xaxis:{title:{text:"X"},showgrid:!1},yaxis:{title:{text:"Y"},showgrid:!0,rangemode:"nonnegative"},paper_bgcolor:((t=this.theme)==null?void 0:t.backgroundColor)||"white",plot_bgcolor:((e=this.theme)==null?void 0:e.backgroundColor)||"white",font:{color:((r=this.theme)==null?void 0:r.textColor)||"black",family:((u=this.theme)==null?void 0:u.font)||"Arial"}};await nd.newPlot(this.id,this.getFallbackData(),R,{staticPlot:!0})}catch(R){console.error("PlotlyLineplot: Failed to render fallback:",R)}}}}),GW=["id"];function $W(t,e,r,u,R,p){return Va(),vo("div",{id:t.id,class:"plot-container",style:ii(t.cssCustomProperties)},null,12,GW)}const h6=Vv(WW,[["render",$W],["__scopeId","data-v-322c72ba"]]);function vP(t){const{id:e,interactivity:r,getData:u,title:R,narrowThreshold:p=600}=t,f=Cg(),n=zy(),l=Wr(800),c=Wr(null),i=rn(()=>l.value<p),_=rn(()=>f.theme),b=rn(()=>{var s,m,y,x;return{paper_bgcolor:((s=_.value)==null?void 0:s.backgroundColor)||"white",plot_bgcolor:((m=_.value)==null?void 0:m.secondaryBackgroundColor)||"#f5f5f5",font:{color:((y=_.value)==null?void 0:y.textColor)||"black",family:((x=_.value)==null?void 0:x.font)||"Arial"}}});function w(){const s=document.getElementById(e.value);s&&window.ResizeObserver&&(c.value=new ResizeObserver(m=>{for(const y of m){const x=y.contentRect.width;Math.abs(x-l.value)>10&&(l.value=x)}}),c.value.observe(s))}function v(){c.value&&(c.value.disconnect(),c.value=null)}function o(s){const m=[{title:"Download as SVG",name:"toImageSvg",icon:nd.Icons.camera,click:y=>{nd.downloadImage(y,{filename:(R==null?void 0:R.value)||"plot",height:400,width:1200,format:"svg"})}},...s||[]];return{modeBarButtonsToRemove:["toImage","sendDataToCloud"],modeBarButtonsToAdd:m,scrollZoom:!0,responsive:!0}}function a(){const s=document.getElementById(e.value);s&&s.on("plotly_click",m=>{const y=r.value;if(!(!y||Object.keys(y).length===0)&&m.points&&m.points.length>0){const x=m.points[0].pointIndex,C=u()[x];if(C)for(const[A,E]of Object.entries(y)){const P=C[E];P!==void 0&&n.updateSelection(A,P)}}})}function h(){Hc.setFrameHeight()}return{plotWidth:l,isNarrowPlot:i,theme:_,themeLayout:b,setupResizeObserver:w,cleanupResizeObserver:v,getPlotConfig:o,setupClickHandler:a,updateFrameHeight:h,selectionStore:n}}const YW=wg({name:"PlotlyHeatmap",props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(t){const e=Cg(),r=vP({id:rn(()=>`heatmap-${t.index}`),interactivity:rn(()=>t.args.interactivity||{}),getData:()=>{var R;return((R=e.allDataForDrawing)==null?void 0:R.heatmapData)||[]},title:rn(()=>t.args.title)});return{streamlitDataStore:e,...r}},data(){return{isInitialized:!1,zoomRange:void 0,colorbarVisible:!0,userOverrideColorbar:!1,heatmapResizeObserver:null,zoomDebounceTimer:null,pendingZoomRange:void 0,zoomThrottleTimer:null,lastZoomUpdateTime:0,plotInitialized:!1}},computed:{id(){return`heatmap-${this.index}`},effectiveColorbarVisible(){return this.userOverrideColorbar?this.colorbarVisible:this.isNarrowPlot?!1:this.colorbarVisible},heatmapData(){var e;return((e=this.streamlitDataStore.allDataForDrawing)==null?void 0:e.heatmapData)||[]},interactivity(){return this.args.interactivity||{}},isDataReady(){return Array.isArray(this.heatmapData)&&this.heatmapData.length>0},xValues(){if(!this.isDataReady)return[];const t=this.args.xColumn;return this.heatmapData.map(e=>e[t])},yValues(){if(!this.isDataReady)return[];const t=this.args.yColumn;return this.heatmapData.map(e=>e[t])},intensityValues(){if(!this.isDataReady)return[];const t=this.args.intensityColumn;return this.heatmapData.map(e=>e[t])},logIntensityValues(){return this.intensityValues.map(t=>t>0?Math.log10(t):0)},isLogScale(){return this.args.logScale!==!1},effectiveColorValues(){return this.isLogScale?this.logIntensityValues:this.intensityValues},colorbarLabel(){return this.args.intensityLabel||"Intensity"},isCategoricalMode(){return!!this.args.categoryColumn},categoryValues(){return!this.isDataReady||!this.args.categoryColumn?[]:this.heatmapData.map(t=>t[this.args.categoryColumn])},uniqueCategories(){if(!this.isCategoricalMode)return[];const t=new Set,e=[];for(const r of this.categoryValues)t.has(r)||(t.add(r),e.push(r));return e},defaultCategoryColors(){return["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"]},getCategoryColor(){const t=this.args.categoryColors||{},e=this.defaultCategoryColors;return r=>{const u=String(r);if(t[u])return t[u];const R=this.uniqueCategories.indexOf(r);return e[R%e.length]}},xRange(){const t=this.zoomRange;if(t&&!(t.xRange[0]<0&&t.xRange[1]<0))return t.xRange},yRange(){const t=this.zoomRange;if(t&&!(t.yRange[0]<0&&t.yRange[1]<0))return t.yRange},colorbarTicks(){if(!this.isLogScale)return null;const t=this.intensityValues.filter(f=>f>0);if(t.length===0)return{tickvals:[0],ticktext:["0"]};const e=Math.min(...t),r=Math.max(...t),u=Math.floor(Math.log10(e)),R=Math.ceil(Math.log10(r)),p=Array.from({length:R-u+1},(f,n)=>Math.pow(10,u+n));return{tickvals:p.map(f=>Math.log10(f)),ticktext:p.map(f=>f.toExponential(0))}},data(){if(!this.isDataReady)return this.getFallbackData();if(this.isCategoricalMode)return this.buildCategoricalTraces();const t=this.colorbarTicks,e={title:{text:this.colorbarLabel}};return t&&(e.tickvals=t.tickvals,e.ticktext=t.ticktext,e.tickmode="array"),[{type:"scattergl",name:"points",x:this.xValues,y:this.yValues,mode:"markers",marker:{color:this.effectiveColorValues,colorscale:this.args.colorscale||"Portland",reversescale:this.args.reversescale??!1,showscale:this.effectiveColorbarVisible,colorbar:e},hovertext:this.intensityValues.map(r=>r.toExponential(2)),hoverinfo:"x+y+text"}]},layout(){const t=this.isCategoricalMode,e=this.isCategoricalMode||this.effectiveColorbarVisible;return{...this.themeLayout,title:this.args.title?{text:`<b>${this.args.title}</b>`}:void 0,showlegend:t,legend:t?{x:1.02,y:1,xanchor:"left",yanchor:"top",bgcolor:"rgba(255, 255, 255, 0.8)",bordercolor:"#ccc",borderwidth:1}:void 0,height:this.args.height||400,xaxis:{title:this.args.xLabel?{text:this.args.xLabel}:void 0,range:this.xRange},yaxis:{title:this.args.yLabel?{text:this.args.yLabel}:void 0,range:this.yRange},margin:{l:60,r:e?120:20,t:this.args.title?60:20,b:60}}}},watch:{isDataReady:{handler(t){t&&this.isInitialized&&this.renderPlot()},immediate:!0},"streamlitDataStore.allDataForDrawing.heatmapData":{handler(){this.isInitialized&&this.renderPlot()},deep:!0},zoomRange:{handler(){if(this.zoomRange===void 0)return;const t=this.args.zoomIdentifier||"heatmap_zoom";this.selectionStore.updateSelection(t,this.zoomRange)},deep:!0}},mounted(){this.isInitialized=!0,this.$nextTick(()=>{this.isDataReady&&this.renderPlot(),this.setupHeatmapResizeObserver()})},beforeUnmount(){this.zoomDebounceTimer&&(clearTimeout(this.zoomDebounceTimer),this.zoomDebounceTimer=null),this.zoomThrottleTimer&&(clearTimeout(this.zoomThrottleTimer),this.zoomThrottleTimer=null),this.plotInitialized=!1,this.cleanupHeatmapResizeObserver()},methods:{buildCategoricalTraces(){const t=this.getCategoryColor,e=[];for(const r of this.uniqueCategories){const u=[];for(let n=0;n<this.categoryValues.length;n++)this.categoryValues[n]===r&&u.push(n);const R=u.map(n=>this.xValues[n]),p=u.map(n=>this.yValues[n]),f=u.map(n=>this.intensityValues[n].toExponential(2));e.push({type:"scattergl",name:String(r),x:R,y:p,mode:"markers",marker:{color:t(r),size:6},hovertext:f,hoverinfo:"x+y+text"})}return e},async renderPlot(){try{if(!document.getElementById(this.id)){console.warn(`PlotlyHeatmap: DOM element with id '${this.id}' not found`);return}this.plotInitialized?(console.debug("[PlotlyHeatmap] renderPlot: using Plotly.react() (update)"),await nd.react(this.id,this.data,this.layout,this.getHeatmapPlotConfig())):(console.debug("[PlotlyHeatmap] renderPlot: using Plotly.newPlot() (first render)"),await nd.newPlot(this.id,this.data,this.layout,this.getHeatmapPlotConfig()),this.setupPlotEventHandlers(),this.plotInitialized=!0),this.$nextTick(()=>{this.updateFrameHeight()})}catch(t){console.error("PlotlyHeatmap: Error rendering plot:",t),this.plotInitialized=!1,this.renderFallback()}},getHeatmapPlotConfig(){const t={title:"Toggle Colorbar",name:"toggleColorbar",icon:{width:1792,height:1792,path:"M1408 768v192q0 40-28 68t-68 28H480q-40 0-68-28t-28-68V768q0-40 28-68t68-28h832q40 0 68 28t28 68zm0-384v192q0 40-28 68t-68 28H480q-40 0-68-28t-28-68V384q0-40 28-68t68-28h832q40 0 68 28t28 68zm0-384v192q0 40-28 68t-68 28H480q-40 0-68-28t-28-68V0q0-40 28-68t68-28h832q40 0 68 28t28 68z",transform:"matrix(1 0 0 -1 0 1792)"},click:()=>{this.toggleColorbar()}};return this.getPlotConfig([t])},setupPlotEventHandlers(){const t=document.getElementById(this.id);t&&(t.on("plotly_relayout",e=>{let r;e["xaxis.autorange"]?r={xRange:[-1,-1],yRange:[-1,-1]}:e["xaxis.range[0]"]!==void 0&&e["xaxis.range[1]"]!==void 0&&e["yaxis.range[0]"]!==void 0&&e["yaxis.range[1]"]!==void 0&&(r={xRange:[e["xaxis.range[0]"],e["xaxis.range[1]"]],yRange:[e["yaxis.range[0]"],e["yaxis.range[1]"]]}),r&&!this.zoomRangesEqual(r,this.zoomRange)&&(this.pendingZoomRange=r,this.debouncedUpdateZoom())}),this.setupClickHandler())},debouncedUpdateZoom(){this.zoomDebounceTimer&&(clearTimeout(this.zoomDebounceTimer),console.debug("[PlotlyHeatmap] Zoom debounced (timer reset)")),this.zoomThrottleTimer&&(clearTimeout(this.zoomThrottleTimer),this.zoomThrottleTimer=null,console.debug("[PlotlyHeatmap] Throttle timer cancelled (user still interacting)")),this.zoomDebounceTimer=setTimeout(()=>{this.zoomDebounceTimer=null;const u=Date.now()-this.lastZoomUpdateTime;if(u>=500)this.applyZoomUpdate();else{this.zoomThrottleTimer&&clearTimeout(this.zoomThrottleTimer);const R=500-u;console.debug(`[PlotlyHeatmap] Throttling zoom update, waiting ${R}ms`),this.zoomThrottleTimer=setTimeout(()=>{this.zoomThrottleTimer=null,this.applyZoomUpdate()},R)}},150)},applyZoomUpdate(){this.pendingZoomRange&&(console.debug("[PlotlyHeatmap] Applying zoom update:",this.pendingZoomRange),this.lastZoomUpdateTime=Date.now(),this.zoomRange=this.pendingZoomRange,this.pendingZoomRange=void 0)},zoomRangesEqual(t,e){return t===e?!0:!t||!e?!1:t.xRange[0]===e.xRange[0]&&t.xRange[1]===e.xRange[1]&&t.yRange[0]===e.yRange[0]&&t.yRange[1]===e.yRange[1]},async toggleColorbar(){this.colorbarVisible=!this.colorbarVisible,this.userOverrideColorbar=!0,await this.updatePlot()},async updatePlot(){const t=document.getElementById(this.id);if(t)try{await nd.restyle(t,{"marker.showscale":this.effectiveColorbarVisible},[0]),await nd.relayout(t,{margin:{r:this.effectiveColorbarVisible?120:20}})}catch{}},setupHeatmapResizeObserver(){const t=document.getElementById(this.id);t&&window.ResizeObserver&&(this.heatmapResizeObserver=new ResizeObserver(e=>{for(const r of e){const u=r.contentRect.width;if(Math.abs(u-this.plotWidth)>10){const R=this.isNarrowPlot;this.plotWidth=u;const p=this.isNarrowPlot;R!==p&&!this.userOverrideColorbar&&(this.colorbarVisible=!p,this.updatePlot())}}}),this.heatmapResizeObserver.observe(t))},cleanupHeatmapResizeObserver(){this.heatmapResizeObserver&&(this.heatmapResizeObserver.disconnect(),this.heatmapResizeObserver=null)},getFallbackData(){return[{type:"scattergl",x:[0],y:[0],mode:"markers",marker:{color:"grey"},name:"No Data"}]},async renderFallback(){try{const t={...this.themeLayout,title:{text:"<b>No Data Available</b>"},showlegend:!1,xaxis:{title:{text:"X"}},yaxis:{title:{text:"Y"}}};await nd.newPlot(this.id,this.getFallbackData(),t,{staticPlot:!0})}catch(t){console.error("PlotlyHeatmap: Failed to render fallback:",t)}}}}),ZW=["id"];function XW(t,e,r,u,R,p){return Va(),vo("div",{id:t.id,class:"heatmap-container"},null,8,ZW)}const f6=Vv(YW,[["render",XW],["__scopeId","data-v-ba3d5702"]]);function d6(t,e,r,u){return e>=u?"ns":t>=r?"up":t<=-r?"down":"ns"}const KW=wg({name:"PlotlyVolcano",props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(t){const e=Cg(),r=vP({id:rn(()=>`volcano-${t.index}`),interactivity:rn(()=>t.args.interactivity||{}),getData:()=>{var R;return((R=e.allDataForDrawing)==null?void 0:R.volcanoData)||[]},title:rn(()=>t.args.title)});return{streamlitDataStore:e,...r}},data(){return{isInitialized:!1}},computed:{id(){return`volcano-${this.index}`},volcanoData(){var e;return((e=this.streamlitDataStore.allDataForDrawing)==null?void 0:e.volcanoData)||[]},isDataReady(){return Array.isArray(this.volcanoData)&&this.volcanoData.length>0},fcThreshold(){return this.args.fcThreshold??1},pThreshold(){return this.args.pThreshold??.05},neglog10PThreshold(){return this.pThreshold>0?-Math.log10(this.pThreshold):0},categorizedData(){const t={x:[],y:[],text:[],indices:[]},e={x:[],y:[],text:[],indices:[]},r={x:[],y:[],text:[],indices:[]},u=this.args.log2fcColumn,R=this.args.neglog10pColumn,p=this.args.pvalueColumn,f=this.args.labelColumn;return this.volcanoData.forEach((n,l)=>{const c=Number(n[u])||0,i=Number(n[R])||0,_=Number(n[p])||1,b=f?String(n[f]||""):"",w=f?`${b}<br>log2FC: ${c.toFixed(3)}<br>p-value: ${_.toExponential(2)}`:`log2FC: ${c.toFixed(3)}<br>p-value: ${_.toExponential(2)}`,v=d6(c,_,this.fcThreshold,this.pThreshold);v==="up"?(t.x.push(c),t.y.push(i),t.text.push(w),t.indices.push(l)):v==="down"?(e.x.push(c),e.y.push(i),e.text.push(w),e.indices.push(l)):(r.x.push(c),r.y.push(i),r.text.push(w),r.indices.push(l))}),{up:t,down:e,ns:r}},plotData(){if(!this.isDataReady)return this.getFallbackData();const{up:t,down:e,ns:r}=this.categorizedData,u=[];return r.x.length>0&&u.push({type:"scattergl",name:"Not significant",x:r.x,y:r.y,mode:"markers",marker:{color:this.args.nsColor||"#95A5A6",size:6,opacity:.6},text:r.text,hoverinfo:"text",customdata:r.indices}),e.x.length>0&&u.push({type:"scattergl",name:"Down-regulated",x:e.x,y:e.y,mode:"markers",marker:{color:this.args.downColor||"#3498DB",size:8},text:e.text,hoverinfo:"text",customdata:e.indices}),t.x.length>0&&u.push({type:"scattergl",name:"Up-regulated",x:t.x,y:t.y,mode:"markers",marker:{color:this.args.upColor||"#E74C3C",size:8},text:t.text,hoverinfo:"text",customdata:t.indices}),u},thresholdShapes(){if(!this.args.showThresholdLines)return[];const t=this.args.thresholdLineStyle||"dash",e=[];return e.push({type:"line",xref:"paper",yref:"y",x0:0,x1:1,y0:this.neglog10PThreshold,y1:this.neglog10PThreshold,line:{color:"rgba(100, 100, 100, 0.5)",width:1.5,dash:t}}),e.push({type:"line",xref:"x",yref:"paper",x0:this.fcThreshold,x1:this.fcThreshold,y0:0,y1:1,line:{color:"rgba(100, 100, 100, 0.5)",width:1.5,dash:t}}),e.push({type:"line",xref:"x",yref:"paper",x0:-this.fcThreshold,x1:-this.fcThreshold,y0:0,y1:1,line:{color:"rgba(100, 100, 100, 0.5)",width:1.5,dash:t}}),e},pointAnnotations(){if(!this.args.labelColumn)return[];const t=this.args.maxLabels??10;if(t<=0)return[];const e=this.args.labelColumn,r=this.args.log2fcColumn,u=this.args.neglog10pColumn,R=this.args.pvalueColumn,p=[];return this.volcanoData.forEach(n=>{const l=Number(n[r])||0,c=Number(n[R])||1,i=Number(n[u])||0,_=String(n[e]||"");d6(l,c,this.fcThreshold,this.pThreshold)!=="ns"&&_&&p.push({label:_,log2fc:l,neglog10p:i})}),p.sort((n,l)=>l.neglog10p-n.neglog10p),p.slice(0,t).map(n=>{var l;return{x:n.log2fc,y:n.neglog10p,text:n.label,showarrow:!0,arrowhead:0,arrowsize:.5,arrowwidth:1,arrowcolor:"rgba(100, 100, 100, 0.5)",ax:0,ay:-25,font:{size:10,color:((l=this.theme)==null?void 0:l.textColor)||"black"},bgcolor:"rgba(255, 255, 255, 0.8)",borderpad:2}})},layout(){return{...this.themeLayout,title:this.args.title?{text:`<b>${this.args.title}</b>`}:void 0,showlegend:!0,legend:{orientation:"h",yanchor:"bottom",y:1.02,xanchor:"right",x:1},height:this.args.height||400,xaxis:{title:{text:this.args.xLabel||"log2 Fold Change"},zeroline:!0,zerolinecolor:"rgba(150, 150, 150, 0.3)",zerolinewidth:1},yaxis:{title:{text:this.args.yLabel||"-log10(p-value)"},rangemode:"tozero"},shapes:this.thresholdShapes,annotations:this.pointAnnotations,margin:{l:60,r:20,t:this.args.title?80:40,b:60}}}},watch:{isDataReady:{handler(t){t&&this.isInitialized&&this.renderPlot()},immediate:!0},"streamlitDataStore.allDataForDrawing.volcanoData":{handler(){this.isInitialized&&this.renderPlot()},deep:!0},fcThreshold(){this.isInitialized&&this.isDataReady&&this.renderPlot()},pThreshold(){this.isInitialized&&this.isDataReady&&this.renderPlot()}},mounted(){this.isInitialized=!0,this.$nextTick(()=>{this.isDataReady&&this.renderPlot(),this.setupResizeObserver()})},beforeUnmount(){this.cleanupResizeObserver()},methods:{async renderPlot(){try{if(!document.getElementById(this.id)){console.warn(`PlotlyVolcano: DOM element with id '${this.id}' not found`);return}await nd.newPlot(this.id,this.plotData,this.layout,this.getPlotConfig()),this.setupClickHandler(),this.$nextTick(()=>{this.updateFrameHeight()})}catch(t){console.error("PlotlyVolcano: Error rendering plot:",t),this.renderFallback()}},getFallbackData(){return[{type:"scattergl",x:[0],y:[0],mode:"markers",marker:{color:"grey"},name:"No Data"}]},async renderFallback(){try{const t={...this.themeLayout,title:{text:"<b>No Data Available</b>"},showlegend:!1,xaxis:{title:{text:"log2 Fold Change"}},yaxis:{title:{text:"-log10(p-value)"}}};await nd.newPlot(this.id,this.getFallbackData(),t,{staticPlot:!0})}catch(t){console.error("PlotlyVolcano: Failed to render fallback:",t)}}}}),JW=["id"];function QW(t,e,r,u,R,p){return Va(),vo("div",{id:t.id,class:"volcano-container"},null,8,JW)}const p6=Vv(KW,[["render",QW],["__scopeId","data-v-1837a4fb"]]),eG=wg({name:"AminoAcidCell",props:{sequenceObject:{type:Object,required:!0},index:{type:Number,required:!0},sequenceLength:{type:Number,required:!0},fixedModification:{type:Boolean,default:!1},showFragments:{type:Boolean,default:!0},fontSize:{type:Number,default:12},isHighlighted:{type:Boolean,default:!1},modification:{type:Number,default:null}},emits:["selected"],setup(){return{streamlitData:Cg()}},computed:{id(){return`aa-${this.aminoAcid}-${this.index}`},theme(){return this.streamlitData.theme},aminoAcid(){return this.sequenceObject.aminoAcid},prefix(){return this.index+1},suffix(){return this.sequenceLength-this.index},hasExtraFragTypes(){return this.sequenceObject.extraTypes.length>0},hasMatchingFragments(){return this.sequenceObject.aIon||this.sequenceObject.bIon||this.sequenceObject.cIon||this.sequenceObject.xIon||this.sequenceObject.yIon||this.sequenceObject.zIon},aminoAcidCellClass(){return{"sequence-amino-acid":!this.fixedModification,"sequence-amino-acid-highlighted":this.fixedModification}},cellStyles(){var e,r,u,R,p;const t=((e=this.theme)==null?void 0:e.base)==="dark";return{"--amino-acid-cell-color":((r=this.theme)==null?void 0:r.textColor)??"#000","--amino-acid-cell-bg-color":((u=this.theme)==null?void 0:u.secondaryBackgroundColor)??"#f0f0f0","--amino-acid-cell-hover-color":((R=this.theme)==null?void 0:R.textColor)??"#000","--amino-acid-cell-hover-bg-color":((p=this.theme)==null?void 0:p.backgroundColor)??"#fff","--amino-acid-font-size":`${this.fontSize}px`,"--mod-mass-bg-color":t?"#e0e0e0":"#fff","--mod-mass-text-color":"#000","--mod-mass-border-color":t?"#666":"#a79c91","--mod-marker-dot-color":t?"rgba(150, 150, 220, 0.8)":"#676a9c","--mod-marker-bg-color":t?"rgba(180, 180, 220, 0.3)":"#e5e5f7","--extra-frag-stroke":t?"rgba(255, 255, 255, 0.5)":"black",position:"relative"}},modificationDisplay(){if(this.modification===null)return"";const t=this.modification;return t>=0?`+${t.toFixed(2)}`:t.toFixed(2)}},methods:{selectCell(){this.hasMatchingFragments&&this.$emit("selected",this.index)}}}),tG=["id"],nG={key:0,class:"frag-marker-container frag-marker-a"},rG={key:1,class:"frag-marker-container frag-marker-b"},iG={key:2,class:"frag-marker-container frag-marker-c"},aG={key:3,class:"frag-marker-container frag-marker-x"},oG={key:4,class:"frag-marker-container frag-marker-y"},sG={key:5,class:"frag-marker-container frag-marker-z"},lG={key:6,class:"rounded-lg mod-marker mod-start"},uG={key:7,class:"rounded-lg mod-marker mod-end"},cG={key:8,class:"rounded-lg mod-mass"},hG={key:9,class:"rounded-lg mod-mass-a"},fG={key:10,class:"rounded-lg mod-mass-b"},dG={key:11,class:"rounded-lg mod-mass-c"},pG={key:12,class:"frag-marker-extra-type"},mG={class:"aa-text"},gG={key:0},vG={key:1},yG={key:2};function bG(t,e,r,u,R,p){const f=iu("v-tooltip");return Va(),vo("div",{id:t.id,class:jr(["d-flex justify-center align-center rounded-lg",[t.aminoAcidCellClass,{highlighted:t.isHighlighted},{"fixed-mod":t.fixedModification}]]),style:ii(t.cellStyles),onClick:e[0]||(e[0]=(...n)=>t.selectCell&&t.selectCell(...n))},[t.showFragments&&t.sequenceObject.aIon?(Va(),vo("div",nG,[...e[1]||(e[1]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"green",d:"M7, 1 L9, 3 L9, 7 L9, 3 L7, 1 z","stroke-width":"1.5"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.bIon?(Va(),vo("div",rG,[...e[2]||(e[2]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"blue",d:"M10, 0 V5 M10, 0 H5 z","stroke-width":"3"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.cIon?(Va(),vo("div",iG,[...e[3]||(e[3]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"red",d:"M4, 1 L9, 3 L9, 7 L9, 3 L4, 1 z","stroke-width":"1.5"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.xIon?(Va(),vo("div",aG,[...e[4]||(e[4]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"green",d:"M1, 3 L1, 7 L3, 9 L1, 7 L1, 3 z","stroke-width":"1.5"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.yIon?(Va(),vo("div",oG,[...e[5]||(e[5]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"blue",d:"M0, 10 V5 M0, 10 H5 z","stroke-width":"3"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.zIon?(Va(),vo("div",sG,[...e[6]||(e[6]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"red",d:"M1, 3 L1, 7 L6, 9 L1, 7 L1, 3 z","stroke-width":"1.5"})],-1)])])):wl("",!0),t.modification!==null?(Va(),vo("div",lG)):wl("",!0),t.modification!==null?(Va(),vo("div",uG)):wl("",!0),t.modification!==null?(Va(),vo("div",cG,[Fs(Bs(t.modificationDisplay)+" ",1),Qt(f,{activator:"parent",class:"foreground"},{default:ds(()=>[Fs(" Modification Mass: "+Bs(t.modificationDisplay)+" Da ",1)]),_:1})])):wl("",!0),t.showFragments&&t.modification!==null&&t.sequenceObject.aIon&&!t.sequenceObject.bIon?(Va(),vo("div",hG,Bs(t.modificationDisplay),1)):wl("",!0),t.showFragments&&t.modification!==null&&t.sequenceObject.bIon?(Va(),vo("div",fG,Bs(t.modificationDisplay),1)):wl("",!0),t.showFragments&&t.modification!==null&&t.sequenceObject.cIon&&!t.sequenceObject.bIon?(Va(),vo("div",dG,Bs(t.modificationDisplay),1)):wl("",!0),t.hasExtraFragTypes?(Va(),vo("div",pG,[...e[7]||(e[7]=[en("svg",{viewBox:"0 0 10 10"},[en("circle",{cx:"5",cy:"5",r:"0.5",class:"extra-frag-circle","stroke-width":"0.3",fill:"gold"})],-1)])])):wl("",!0),en("div",mG,Bs(t.aminoAcid),1),Qt(f,{activator:"parent"},{default:ds(()=>[en("div",null,"Position: "+Bs(t.index+1),1),t.prefix!==void 0?(Va(),vo("div",gG,"Prefix: "+Bs(t.prefix),1)):wl("",!0),t.suffix!==void 0?(Va(),vo("div",vG,"Suffix: "+Bs(t.suffix),1)):wl("",!0),t.hasExtraFragTypes?(Va(),vo("div",yG,Bs(t.sequenceObject.extraTypes.join(", ")),1)):wl("",!0)]),_:1})],14,tG)}const xG=Vv(eG,[["render",bG],["__scopeId","data-v-3401e0d8"]]),_G={default:[{typeName:"",typeMass:0}],"water loss":[{typeName:"-H2O",typeMass:-18.0105646863}],"ammonium loss":[{typeName:"-NH3",typeMass:-17.0265491015}],"proton loss/addition":[{typeName:"-H",typeMass:-1.0078250319},{typeName:"+H",typeMass:1.0078250319}]},wG=1.007276,TG={0:"⁰",1:"¹",2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function kG(t){return String(t).split("").map(e=>TG[e]||e).join("")}const SG=wg({name:"SequenceView",components:{AminoAcidCell:xG},props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(){const t=Cg(),e=zy();return{streamlitDataStore:t,selectionStore:e}},data(){return{rowWidth:35,fontSize:12,autoZoomApplied:!1,showFragments:!0,ionTypes:[{text:"a",selected:!1},{text:"b",selected:!0},{text:"c",selected:!1},{text:"x",selected:!1},{text:"y",selected:!0},{text:"z",selected:!1}],ionTypesExtra:{"water loss":!1,"ammonium loss":!1,"proton loss/addition":!1},fragmentMassTolerance:10,toleranceIsPpm:!0,useExternalAnnotations:!0,sequenceObjects:[],fragmentTableData:[],selectedAAIndex:void 0,selectedFragmentRowIndex:void 0,copySnackbar:!1,copySnackbarText:""}},computed:{containerStyle(){return{height:`${this.args.height||400}px`,overflowY:"auto"}},theme(){return this.streamlitDataStore.theme},sequenceData(){return this.streamlitDataStore.allDataForDrawing.sequenceData},observedMasses(){return this.streamlitDataStore.allDataForDrawing.observedMasses??[]},peakIds(){return this.streamlitDataStore.allDataForDrawing.peakIds},precursorMass(){return this.streamlitDataStore.allDataForDrawing.precursorMass??0},interactivity(){return this.args.interactivity??{}},deconvolved(){return this.args.deconvolved??!0},maxCharge(){var t;return((t=this.streamlitDataStore.allDataForDrawing)==null?void 0:t.precursorCharge)??1},sequence(){var t;return((t=this.sequenceData)==null?void 0:t.sequence)??[]},modifications(){var t;return((t=this.sequenceData)==null?void 0:t.modifications)??[]},theoreticalMass(){var t;return((t=this.sequenceData)==null?void 0:t.theoretical_mass)??0},fixedModificationSites(){var t;return((t=this.sequenceData)==null?void 0:t.fixed_modifications)??[]},externalAnnotations(){var t;return((t=this.sequenceData)==null?void 0:t.external_annotations)??[]},hasExternalAnnotations(){return this.externalAnnotations.length>0},defaultTolerance(){var t;return((t=this.sequenceData)==null?void 0:t.fragment_tolerance)??10},defaultToleranceIsPpm(){var t;return((t=this.sequenceData)==null?void 0:t.fragment_tolerance_ppm)??!0},gridClasses(){return{"sequence-grid":!0,[`grid-width-${this.rowWidth}`]:!0}},residueCleavagePercentage(){if(this.sequenceObjects.length<=1)return 0;let t=0;for(let e=0;e<this.sequenceObjects.length-1;e++){const r=this.sequenceObjects[e],u=this.sequenceObjects[e+1];(r.aIon||r.bIon||r.cIon||u.xIon||u.yIon||u.zIon)&&t++}return t/(this.sequence.length-1)*100},fragmentTableHeaders(){const t=[{title:"Name",key:"Name",sortable:!0},{title:"Ion Type",key:"IonType",sortable:!0},{title:"Ion #",key:"IonNumber",sortable:!0}];return this.deconvolved||t.push({title:"z",key:"Charge",sortable:!0}),t.push({title:this.deconvolved?"Theo. Mass":"Theo. m/z",key:"TheoreticalMass",sortable:!0},{title:this.deconvolved?"Obs. Mass":"Obs. m/z",key:"ObservedMass",sortable:!0},{title:"Δ Da",key:"MassDiffDa",sortable:!0},{title:"Δ ppm",key:"MassDiffPpm",sortable:!0}),t}},watch:{sequenceData:{handler(t,e){var R,p,f,n,l,c;const r=((R=t==null?void 0:t.sequence)==null?void 0:R.join(""))??"",u=((p=e==null?void 0:e.sequence)==null?void 0:p.join(""))??"";r!==u&&(this.autoZoomApplied=!1),this.initializeSequenceObjects(),this.applyAutoZoom(),((f=this.sequenceData)==null?void 0:f.fragment_tolerance)!==void 0&&(this.fragmentMassTolerance=this.sequenceData.fragment_tolerance),((n=this.sequenceData)==null?void 0:n.fragment_tolerance_ppm)!==void 0&&(this.toleranceIsPpm=this.sequenceData.fragment_tolerance_ppm),((l=this.sequenceData)==null?void 0:l.neutral_losses)!==void 0&&(this.ionTypesExtra["water loss"]=this.sequenceData.neutral_losses,this.ionTypesExtra["ammonium loss"]=this.sequenceData.neutral_losses),((c=this.sequenceData)==null?void 0:c.proton_loss_addition)!==void 0&&(this.ionTypesExtra["proton loss/addition"]=this.sequenceData.proton_loss_addition),this.matchFragments()},immediate:!0,deep:!0},observedMasses:{handler(){this.matchFragments()},deep:!0},ionTypes:{handler(){this.resetFragmentMarkers(),this.matchFragments()},deep:!0},ionTypesExtra:{handler(){this.resetFragmentMarkers(),this.matchFragments()},deep:!0},fragmentMassTolerance(){this.resetFragmentMarkers(),this.matchFragments()},toleranceIsPpm(){this.resetFragmentMarkers(),this.matchFragments()},useExternalAnnotations(){this.resetFragmentMarkers(),this.matchFragments()}},methods:{initializeSequenceObjects(){this.sequenceObjects=[];for(const t of this.sequence)this.sequenceObjects.push({aminoAcid:t,aIon:!1,bIon:!1,cIon:!1,xIon:!1,yIon:!1,zIon:!1,extraTypes:[]})},applyAutoZoom(){if(this.autoZoomApplied)return;const t=20,e=16;this.sequence.length>0&&this.sequence.length<=t&&(this.rowWidth=t,this.fontSize=e),this.autoZoomApplied=!0},resetFragmentMarkers(){for(const t of this.sequenceObjects)t.aIon=!1,t.bIon=!1,t.cIon=!1,t.xIon=!1,t.yIon=!1,t.zIon=!1,t.extraTypes=[]},getFragmentMasses(t){if(!this.sequenceData)return[];const e=`fragment_masses_${t}`;return this.sequenceData[e]??[]},isWithinTolerance(t,e){return this.toleranceIsPpm?Math.abs(t/e*1e6)<=this.fragmentMassTolerance:Math.abs(t)<=this.fragmentMassTolerance},markAminoAcidPosition(t,e,r){const u=this.sequence.length,p=["a","b","c"].includes(t)?e-1:u-e;if(p>=0&&p<this.sequenceObjects.length){const f=this.sequenceObjects[p],n=`${t}Ion`;f[n]=!0,r&&f.extraTypes.push(`${t}${r}`)}},matchFragmentsExternal(){const t=[];for(const e of this.externalAnnotations){let r=null,u=-1,R=1/0;for(let i=0;i<this.observedMasses.length;i++){const _=this.observedMasses[i],b=Math.abs(_-e.mz);b<R&&(R=b,r=_,u=i)}if(r===null)continue;const p=r-e.mz,f=p/e.mz*1e6;if(!this.isWithinTolerance(p,e.mz))continue;let n=0;const l=e.annotation.match(/[a-z](\d+)/i);l&&(n=parseInt(l[1],10));const c={Name:e.annotation,IonType:e.ion_type,IonNumber:n,TheoreticalMass:e.mz.toFixed(3),ObservedMass:r,MassDiffDa:p.toFixed(3),MassDiffPpm:f.toFixed(3)};e.charge>1&&(c.Charge=e.charge),this.peakIds&&u>=0&&this.peakIds[u]!==void 0&&(c.PeakId=this.peakIds[u]),t.push(c),n>0&&e.ion_type!=="unknown"&&this.markAminoAcidPosition(e.ion_type,n,"")}return t},matchFragmentsTheoretical(){const t=[];this.sequence.length;const e=Object.entries(_G).filter(([u])=>this.ionTypesExtra[u]||u==="default").map(([u,R])=>R).flat(),r=this.deconvolved?[1]:Array.from({length:this.maxCharge},(u,R)=>R+1);for(const u of this.ionTypes.filter(R=>R.selected)){const R=this.getFragmentMasses(u.text);for(let p=0;p<R.length;p++)for(const f of R[p])for(const{typeName:n,typeMass:l}of e){const c=f+l;for(const i of r){const _=this.deconvolved?c:(c+i*wG)/i;for(let b=0;b<this.observedMasses.length;b++){const w=this.observedMasses[b],v=w-_;if(this.isWithinTolerance(v,_)){const o=v/_*1e6,a=`${u.text}${p+1}${n}`,s={Name:this.deconvolved?a:`${a}${kG(i)}⁺`,IonType:`${u.text}${n}`,IonNumber:p+1,TheoreticalMass:_.toFixed(3),ObservedMass:w,MassDiffDa:v.toFixed(3),MassDiffPpm:o.toFixed(3)};this.deconvolved||(s.Charge=i),this.peakIds&&this.peakIds[b]!==void 0&&(s.PeakId=this.peakIds[b]),t.push(s),this.markAminoAcidPosition(u.text,p+1,n)}}}}}return t},matchFragments(){if(this.sequence.length===0||this.observedMasses.length===0){this.fragmentTableData=[],this.streamlitDataStore.setAnnotations(null);return}this.useExternalAnnotations&&this.hasExternalAnnotations?this.fragmentTableData=this.matchFragmentsExternal():this.fragmentTableData=this.matchFragmentsTheoretical();const t=[],e=[],r=[];for(const f of this.fragmentTableData)if(f.PeakId!==void 0){t.push(f.PeakId);const n=f.IonType.charAt(0).toLowerCase(),l=["a","b","c"].includes(n)?"#E4572E":"#1f77b4";e.push(l),r.push(f.Name)}const u=this.streamlitDataStore.annotations,R=(u==null?void 0:u.peak_id)??[],p=t.length!==R.length||t.some((f,n)=>f!==R[n]);t.length>0?this.streamlitDataStore.setAnnotations({peak_id:t,highlight_color:e,annotation:r}):this.streamlitDataStore.setAnnotations(null),p&&this.selectionStore.$patch({counter:(this.selectionStore.$state.counter||0)+1})},isFixedModification(t){return this.fixedModificationSites.includes(t)},onAminoAcidSelected(t){this.selectedAAIndex=t;const e=this.sequenceObjects[t];let r="";if(e.bIon?r=`b${t+1}`:e.aIon?r=`a${t+1}`:e.cIon?r=`c${t+1}`:e.yIon?r=`y${this.sequence.length-t}`:e.xIon?r=`x${this.sequence.length-t}`:e.zIon&&(r=`z${this.sequence.length-t}`),r){const u=this.fragmentTableData.findIndex(R=>R.Name===r);u>=0&&(this.selectedFragmentRowIndex=u)}},onFragmentTableRowClick(t,{item:e}){const r=e.IonType.charAt(0),u=e.IonNumber,p=["a","b","c"].includes(r)?u-1:this.sequence.length-u;if(p>=0&&p<this.sequenceObjects.length&&(this.selectedAAIndex=p),e.PeakId!==void 0&&Object.keys(this.interactivity).length>0)for(const[f,n]of Object.entries(this.interactivity))this.selectionStore.updateSelection(f,e.PeakId)},getRowProps({index:t}){return{class:t===this.selectedFragmentRowIndex?"bg-amber-lighten-4":""}},async copySequence(){try{const t=this.sequence.join("");await navigator.clipboard.writeText(t),this.copySnackbarText="Sequence copied to clipboard!",this.copySnackbar=!0}catch(t){this.copySnackbarText="Failed to copy sequence",this.copySnackbar=!0,console.error("Copy failed:",t)}}}}),AG={class:"d-flex justify-end px-4 mb-4"},CG={class:"d-flex justify-space-evenly"},MG={class:"d-flex justify-space-evenly"},EG={class:"d-flex align-center ga-2"},IG={key:0,class:"d-flex justify-center align-center row-number"},LG={key:1,class:"d-flex justify-center align-center terminal-cell"},PG={key:2,class:"d-flex justify-center align-center row-number"},DG={key:3,class:"d-flex justify-center align-center terminal-cell"},RG={key:0,class:"mt-4"},OG={class:"d-flex justify-space-between align-center mb-2"},zG={class:"text-caption"};function FG(t,e,r,u,R,p){var A;const f=iu("v-icon"),n=iu("v-tooltip"),l=iu("v-btn"),c=iu("v-list-item-title"),i=iu("v-slider"),_=iu("v-list-item"),b=iu("v-checkbox"),w=iu("v-text-field"),v=iu("v-btn-toggle"),o=iu("v-list-item-subtitle"),a=iu("v-list"),h=iu("v-card"),s=iu("v-menu"),m=iu("AminoAcidCell"),y=iu("v-divider"),x=iu("v-data-table"),S=iu("v-sheet"),C=iu("v-snackbar");return Va(),vo("div",{class:"sequence-view-container",style:ii(t.containerStyle)},[Qt(S,{class:"pa-4 rounded-lg",theme:((A=t.theme)==null?void 0:A.base)??"light",border:""},{default:ds(()=>[e[18]||(e[18]=en("div",{class:"d-flex justify-center mb-2"},[en("h4",null,"Sequence View")],-1)),en("div",AG,[Qt(l,{variant:"text",icon:"",size:"small",disabled:t.sequence.length===0,onClick:t.copySequence},{default:ds(()=>[Qt(f,null,{default:ds(()=>[...e[7]||(e[7]=[Fs("mdi-content-copy",-1)])]),_:1}),Qt(n,{activator:"parent",location:"bottom"},{default:ds(()=>[...e[8]||(e[8]=[Fs("Copy sequence to clipboard",-1)])]),_:1})]),_:1},8,["disabled","onClick"]),Qt(l,{id:"settings-btn",variant:"text",icon:"",size:"small"},{default:ds(()=>[Qt(f,null,{default:ds(()=>[...e[9]||(e[9]=[Fs("mdi-cog",-1)])]),_:1})]),_:1}),Qt(s,{"close-on-content-click":!1,activator:"#settings-btn",location:"bottom"},{default:ds(()=>[Qt(h,{"min-width":"300"},{default:ds(()=>[Qt(a,null,{default:ds(()=>[Qt(_,null,{default:ds(()=>[Qt(c,null,{default:ds(()=>[...e[10]||(e[10]=[Fs("# amino acids per row",-1)])]),_:1}),Qt(i,{modelValue:t.rowWidth,"onUpdate:modelValue":e[0]||(e[0]=E=>t.rowWidth=E),ticks:{20:"20",25:"25",30:"30",35:"35",40:"40"},min:20,max:40,step:"5","show-ticks":"always","tick-size":"4"},null,8,["modelValue"])]),_:1}),Qt(_,null,{default:ds(()=>[Qt(c,null,{default:ds(()=>[...e[11]||(e[11]=[Fs("Font Size",-1)])]),_:1}),Qt(i,{modelValue:t.fontSize,"onUpdate:modelValue":e[1]||(e[1]=E=>t.fontSize=E),ticks:{8:"8",10:"10",12:"12",14:"14",16:"16"},min:8,max:16,step:"2","show-ticks":"always","tick-size":"4"},null,8,["modelValue"])]),_:1}),Qt(_,null,{default:ds(()=>[Qt(c,null,{default:ds(()=>[...e[12]||(e[12]=[Fs("Show Fragments",-1)])]),_:1}),Qt(b,{modelValue:t.showFragments,"onUpdate:modelValue":e[2]||(e[2]=E=>t.showFragments=E),"hide-details":"",density:"comfortable"},null,8,["modelValue"])]),_:1}),Qt(_,null,{default:ds(()=>[Qt(c,null,{default:ds(()=>[...e[13]||(e[13]=[Fs("Fragment ion types",-1)])]),_:1}),en("div",CG,[(Va(!0),vo(yi,null,z_(t.ionTypes,E=>(Va(),ty(b,{key:E.text,modelValue:E.selected,"onUpdate:modelValue":P=>E.selected=P,label:E.text,disabled:!t.showFragments,"hide-details":"",density:"comfortable"},null,8,["modelValue","onUpdate:modelValue","label","disabled"]))),128))]),en("div",MG,[(Va(!0),vo(yi,null,z_(t.ionTypesExtra,(E,P)=>(Va(),ty(b,{key:P,modelValue:t.ionTypesExtra[P],"onUpdate:modelValue":M=>t.ionTypesExtra[P]=M,label:P,disabled:!t.showFragments,"hide-details":"",density:"comfortable"},null,8,["modelValue","onUpdate:modelValue","label","disabled"]))),128))])]),_:1}),Qt(_,null,{default:ds(()=>[Qt(c,null,{default:ds(()=>[...e[14]||(e[14]=[Fs("Fragment mass tolerance",-1)])]),_:1}),en("div",EG,[Qt(w,{modelValue:t.fragmentMassTolerance,"onUpdate:modelValue":e[3]||(e[3]=E=>t.fragmentMassTolerance=E),modelModifiers:{number:!0},type:"number","hide-details":"auto",disabled:!t.showFragments,density:"compact",style:{"max-width":"100px"}},null,8,["modelValue","disabled"]),Qt(v,{modelValue:t.toleranceIsPpm,"onUpdate:modelValue":e[4]||(e[4]=E=>t.toleranceIsPpm=E),mandatory:"",density:"compact",disabled:!t.showFragments},{default:ds(()=>[Qt(l,{value:!0,size:"small"},{default:ds(()=>[...e[15]||(e[15]=[Fs("ppm",-1)])]),_:1}),Qt(l,{value:!1,size:"small"},{default:ds(()=>[...e[16]||(e[16]=[Fs("Da",-1)])]),_:1})]),_:1},8,["modelValue","disabled"])])]),_:1}),t.hasExternalAnnotations?(Va(),ty(_,{key:0},{default:ds(()=>[Qt(c,null,{default:ds(()=>[...e[17]||(e[17]=[Fs("Use search engine annotations",-1)])]),_:1}),Qt(b,{modelValue:t.useExternalAnnotations,"onUpdate:modelValue":e[5]||(e[5]=E=>t.useExternalAnnotations=E),disabled:!t.showFragments,"hide-details":"",density:"comfortable"},null,8,["modelValue","disabled"]),Qt(o,{class:"text-caption"},{default:ds(()=>[Fs(Bs(t.externalAnnotations.length)+" annotations from idXML ",1)]),_:1})]),_:1})):wl("",!0)]),_:1})]),_:1})]),_:1})]),en("div",{class:jr(["px-2 pb-4",t.gridClasses]),style:{width:"100%","max-width":"100%"}},[(Va(!0),vo(yi,null,z_(t.sequenceObjects,(E,P)=>(Va(),vo(yi,{key:P},[P!==0&&P%t.rowWidth===0?(Va(),vo("div",IG,Bs(P+1),1)):wl("",!0),P===0?(Va(),vo("div",LG,"N")):wl("",!0),Qt(m,{"sequence-object":E,index:P,"sequence-length":t.sequence.length,"fixed-modification":t.isFixedModification(E.aminoAcid),"show-fragments":t.showFragments,"font-size":t.fontSize,"is-highlighted":t.selectedAAIndex===P,modification:t.modifications[P]??null,onSelected:t.onAminoAcidSelected},null,8,["sequence-object","index","sequence-length","fixed-modification","show-fragments","font-size","is-highlighted","modification","onSelected"]),P%t.rowWidth===t.rowWidth-1&&P!==t.sequence.length-1?(Va(),vo("div",PG,Bs(P+1),1)):wl("",!0),P===t.sequence.length-1?(Va(),vo("div",DG," C ")):wl("",!0)],64))),128))],2),t.showFragments&&t.fragmentTableData.length>0?(Va(),vo("div",RG,[Qt(y,{class:"mb-4"}),en("div",OG,[en("h5",null,"Matching Fragments ("+Bs(t.fragmentTableData.length)+")",1),en("span",zG,"Residue cleavage: "+Bs(t.residueCleavagePercentage.toFixed(1))+"%",1)]),Qt(x,{headers:t.fragmentTableHeaders,items:t.fragmentTableData,"items-per-page":10,density:"compact",class:"elevation-1","row-props":t.getRowProps,"onClick:row":t.onFragmentTableRowClick},null,8,["headers","items","row-props","onClick:row"])])):wl("",!0)]),_:1},8,["theme"]),Qt(C,{modelValue:t.copySnackbar,"onUpdate:modelValue":e[6]||(e[6]=E=>t.copySnackbar=E),timeout:2e3,location:"bottom"},{default:ds(()=>[Fs(Bs(t.copySnackbarText),1)]),_:1},8,["modelValue"])],4)}const m6=Vv(SG,[["render",FG],["__scopeId","data-v-3b89d373"]]),BG=wg({name:"App",components:{TabulatorTable:c6,PlotlyLineplot:h6,PlotlyHeatmap:f6,PlotlyVolcano:p6,SequenceView:m6},setup(){const t=Cg(),e=zy();let r,u,R,p=null;const f=100,n=()=>{const i=e.$state.counter,_=t.hash||null,b=t.annotations,w=b?JSON.stringify(b.peak_id):void 0;if(i===r&&_===u&&w===R){console.log("[App] sendStateToStreamlit: SKIPPED (duplicate)",{timestamp:Date.now(),counter:i});return}r=i,u=_??void 0,R=w;const v=JSON.parse(JSON.stringify(e.$state)),o=Object.keys(v).find(h=>{var s;return typeof v[h]=="object"&&((s=v[h])==null?void 0:s.page)!==void 0}),a=o?v[o]:void 0;console.log("[App] ===== sendStateToStreamlit =====",{timestamp:Date.now(),counter:i,hash:_==null?void 0:_.substring(0,8),paginationIdentifier:o,paginationValue:a,requestData:t.requestData}),v._vueDataHash=_,b&&(v._annotations=JSON.parse(JSON.stringify(b))),t.requestData&&(v._requestData=!0,t.clearRequestData()),Hc.setComponentValue(v),console.log("[App] setComponentValue CALLED")},l=()=>{p&&clearTimeout(p),p=setTimeout(()=>{n(),p=null},f)},c=()=>{p&&(clearTimeout(p),p=null)};return ei(()=>e.$state.counter,(i,_)=>{_===void 0?n():l()},{immediate:!0}),ei(()=>t.hash,()=>n()),ei(()=>t.annotations,()=>n(),{deep:!0}),ei(()=>t.requestData,i=>{i&&(c(),n())}),ei(()=>{var i;return(i=t.allDataForDrawing)==null?void 0:i.height},i=>{i&&typeof i=="number"&&Hc.setFrameHeight(i)},{immediate:!0}),{streamlitDataStore:t,selectionStore:e}},data(){return{resizeObserver:void 0}},computed:{componentArgs(){var e;const t=(e=this.streamlitDataStore.args)==null?void 0:e.components;if(t&&t.length>0&&t[0].length>0)return t[0][0].componentArgs},currentComponent(){var e;const t=(e=this.componentArgs)==null?void 0:e.componentType;switch(t){case"TabulatorTable":return c6;case"PlotlyLineplotUnified":case"PlotlyLineplot":return h6;case"PlotlyHeatmap":return f6;case"PlotlyVolcano":return p6;case"SequenceView":return m6;default:return console.warn(`Unknown component type: ${t}`),null}}},created(){Hc.setComponentReady(),Hc.setFrameHeight(400),Hc.events.addEventListener(Hc.RENDER_EVENT,this.updateStreamlitData)},mounted(){this.resizeObserver=new ResizeObserver(()=>{Hc.setFrameHeight()}),this.resizeObserver.observe(this.$el)},unmounted(){Hc.events.removeEventListener(Hc.RENDER_EVENT,this.updateStreamlitData),this.resizeObserver&&this.resizeObserver.disconnect()},methods:{async updateStreamlitData(t){this.streamlitDataStore.updateRenderData(t.detail)}}}),NG={key:0},VG={key:1,class:"d-flex w-100",style:{height:"200px"}};function jG(t,e,r,u,R,p){const f=iu("v-progress-linear"),n=iu("v-alert");return t.componentArgs!==void 0?(Va(),vo("div",NG,[(Va(),ty(ME(t.currentComponent),{args:t.componentArgs,index:0},null,8,["args"]))])):(Va(),vo("div",VG,[Qt(n,{class:"h-50 ma-8",icon:"mdi-application-variable-outline",title:"Loading...",type:"info",density:"compact"},{default:ds(()=>[Qt(f,{indeterminate:""})]),_:1})]))}const UG=Vv(BG,[["render",jG]]);function yP(t,e){e=Array.isArray(e)?e.slice(0,-1).map(r=>`'${r}'`).join(", ")+` or '${e.at(-1)}'`:`'${e}'`}const Ro=typeof window<"u",W4=Ro&&"IntersectionObserver"in window,HG=Ro&&("ontouchstart"in window||window.navigator.maxTouchPoints>0),g6=Ro&&"EyeDropper"in window,G4=Ro&&"matchMedia"in window&&typeof window.matchMedia=="function",mp=()=>G4&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function v6(t,e,r){qG(t,e),e.set(t,r)}function qG(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function y6(t,e,r){return t.set(bP(t,e),r),r}function Op(t,e){return t.get(bP(t,e))}function bP(t,e,r){if(typeof t=="function"?t===e:t.has(e))return arguments.length<3?e:r;throw new TypeError("Private element is not present on this object")}function xP(t,e,r){const u=e.length-1;if(u<0)return t===void 0?r:t;for(let R=0;R<u;R++){if(t==null)return r;t=t[e[R]]}return t==null||t[e[u]]===void 0?r:t[e[u]]}function Lv(t,e,r){return t==null||!e||typeof e!="string"?r:t[e]!==void 0?t[e]:(e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),xP(t,e.split("."),r))}function au(t,e,r){if(e===!0)return t===void 0?r:t;if(e==null||typeof e=="boolean")return r;if(t!==Object(t)){if(typeof e!="function")return r;const R=e(t,r);return typeof R>"u"?r:R}if(typeof e=="string")return Lv(t,e,r);if(Array.isArray(e))return xP(t,e,r);if(typeof e!="function")return r;const u=e(t,r);return typeof u>"u"?r:u}function If(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Array.from({length:t},(r,u)=>e+u)}function ai(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"px";if(t==null||t==="")return;const r=Number(t);return isNaN(r)?String(t):isFinite(r)?`${r}${e}`:void 0}function pg(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function UT(t){let e;return t!==null&&typeof t=="object"&&((e=Object.getPrototypeOf(t))===Object.prototype||e===null)}function $4(t){if(t&&"$el"in t){const e=t.$el;return(e==null?void 0:e.nodeType)===Node.TEXT_NODE?e.nextElementSibling:e}return t}const HT=Object.freeze({enter:"Enter",tab:"Tab",delete:"Delete",esc:"Escape",space:"Space",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",end:"End",home:"Home",del:"Delete",backspace:"Backspace",insert:"Insert",pageup:"PageUp",pagedown:"PageDown",shift:"Shift"});function _P(t){return Object.keys(t)}function mv(t,e){return e.every(r=>t.hasOwnProperty(r))}function Jh(t,e){const r={};for(const u of e)Object.prototype.hasOwnProperty.call(t,u)&&(r[u]=t[u]);return r}function qT(t,e,r){const u=Object.create(null),R=Object.create(null);for(const p in t)e.some(f=>f instanceof RegExp?f.test(p):f===p)?u[p]=t[p]:R[p]=t[p];return[u,R]}function Ga(t,e){const r={...t};return e.forEach(u=>delete r[u]),r}const wP=/^on[^a-z]/,Y4=t=>wP.test(t),WG=["onAfterscriptexecute","onAnimationcancel","onAnimationend","onAnimationiteration","onAnimationstart","onAuxclick","onBeforeinput","onBeforescriptexecute","onChange","onClick","onCompositionend","onCompositionstart","onCompositionupdate","onContextmenu","onCopy","onCut","onDblclick","onFocusin","onFocusout","onFullscreenchange","onFullscreenerror","onGesturechange","onGestureend","onGesturestart","onGotpointercapture","onInput","onKeydown","onKeypress","onKeyup","onLostpointercapture","onMousedown","onMousemove","onMouseout","onMouseover","onMouseup","onMousewheel","onPaste","onPointercancel","onPointerdown","onPointerenter","onPointerleave","onPointermove","onPointerout","onPointerover","onPointerup","onReset","onSelect","onSubmit","onTouchcancel","onTouchend","onTouchmove","onTouchstart","onTransitioncancel","onTransitionend","onTransitionrun","onTransitionstart","onWheel"],GG=["ArrowUp","ArrowDown","ArrowRight","ArrowLeft","Enter","Escape","Tab"," "];function $G(t){return t.isComposing&&GG.includes(t.key)}function Mg(t){const[e,r]=qT(t,[wP]),u=Ga(e,WG),[R,p]=qT(r,["class","style","id",/^data-/]);return Object.assign(R,e),Object.assign(p,u),[R,p]}function Ss(t){return t==null?[]:Array.isArray(t)?t:[t]}function TP(t,e){let r=0;const u=function(){for(var R=arguments.length,p=new Array(R),f=0;f<R;f++)p[f]=arguments[f];clearTimeout(r),r=setTimeout(()=>t(...p),$h(e))};return u.clear=()=>{clearTimeout(r)},u.immediate=t,u}function Vo(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;return Math.max(e,Math.min(r,t))}function b6(t){const e=t.toString().trim();return e.includes(".")?e.length-e.indexOf(".")-1:0}function x6(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"0";return t+r.repeat(Math.max(0,e-t.length))}function _6(t,e){return(arguments.length>2&&arguments[2]!==void 0?arguments[2]:"0").repeat(Math.max(0,e-t.length))+t}function YG(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;const r=[];let u=0;for(;u<t.length;)r.push(t.substr(u,e)),u+=e;return r}function w6(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e3;if(t<e)return`${t} B`;const r=e===1024?["Ki","Mi","Gi"]:["k","M","G"];let u=-1;for(;Math.abs(t)>=e&&u<r.length-1;)t/=e,++u;return`${t.toFixed(1)} ${r[u]}B`}function oh(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;const u={};for(const R in t)u[R]=t[R];for(const R in e){const p=t[R],f=e[R];if(UT(p)&&UT(f)){u[R]=oh(p,f,r);continue}if(r&&Array.isArray(p)&&Array.isArray(f)){u[R]=r(p,f);continue}u[R]=f}return u}function kP(t){return t.map(e=>e.type===yi?kP(e.children):e).flat()}function _v(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";if(_v.cache.has(t))return _v.cache.get(t);const e=t.replace(/[^a-z]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase();return _v.cache.set(t,e),e}_v.cache=new Map;function G0(t,e){if(!e||typeof e!="object")return[];if(Array.isArray(e))return e.map(r=>G0(t,r)).flat(1);if(e.suspense)return G0(t,e.ssContent);if(Array.isArray(e.children))return e.children.map(r=>G0(t,r)).flat(1);if(e.component){if(Object.getOwnPropertyDescriptor(e.component.provides,t))return[e.component];if(e.component.subTree)return G0(t,e.component.subTree).flat(1)}return[]}var M0=new WeakMap,iv=new WeakMap;class SP{constructor(e){v6(this,M0,[]),v6(this,iv,0),this.size=e}get isFull(){return Op(M0,this).length===this.size}push(e){Op(M0,this)[Op(iv,this)]=e,y6(iv,this,(Op(iv,this)+1)%this.size)}values(){return Op(M0,this).slice(Op(iv,this)).concat(Op(M0,this).slice(0,Op(iv,this)))}clear(){Op(M0,this).length=0,y6(iv,this,0)}}function ZG(t){return"touches"in t?{clientX:t.touches[0].clientX,clientY:t.touches[0].clientY}:{clientX:t.clientX,clientY:t.clientY}}function Z4(t){const e=cc({});fl(()=>{const u=t();for(const R in u)e[R]=u[R]},{flush:"sync"});const r={};for(const u in e)r[u]=Nn(()=>e[u]);return r}function V2(t,e){return t.includes(e)}function AP(t){return t[2].toLowerCase()+t.slice(3)}const Wc=()=>[Function,Array];function T6(t,e){return e="on"+bp(e),!!(t[e]||t[`${e}Once`]||t[`${e}Capture`]||t[`${e}OnceCapture`]||t[`${e}CaptureOnce`])}function lx(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),u=1;u<e;u++)r[u-1]=arguments[u];if(Array.isArray(t))for(const R of t)R(...r);else typeof t=="function"&&t(...r)}function wv(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;const r=["button","[href]",'input:not([type="hidden"])',"select","textarea","details:not(:has(> summary))","details > summary","[tabindex]",'[contenteditable]:not([contenteditable="false"])',"audio[controls]","video[controls]"].map(R=>`${R}${e?':not([tabindex="-1"])':""}:not([disabled], [inert])`).join(", ");let u;try{u=[...t.querySelectorAll(r)]}catch{return[]}return u.filter(R=>!R.closest("[inert]")).filter(R=>!!R.offsetParent||R.getClientRects().length>0).filter(R=>{var p,f;return!((p=R.parentElement)!=null&&p.closest("details:not([open])"))||R.tagName==="SUMMARY"&&((f=R.parentElement)==null?void 0:f.tagName)==="DETAILS"})}function CP(t,e,r){let u,R=t.indexOf(document.activeElement);const p=e==="next"?1:-1;do R+=p,u=t[R];while((!u||u.offsetParent==null||!((r==null?void 0:r(u))??!0))&&R<t.length&&R>=0);return u}function Tv(t,e){var u,R,p,f;const r=wv(t);if(e==null)(t===document.activeElement||!t.contains(document.activeElement))&&((u=r[0])==null||u.focus());else if(e==="first")(R=r[0])==null||R.focus();else if(e==="last")(p=r.at(-1))==null||p.focus();else if(typeof e=="number")(f=r[e])==null||f.focus();else{const n=CP(r,e);n?n.focus():Tv(t,e==="next"?"first":"last")}}function C_(t){return t==null||typeof t=="string"&&t.trim()===""}function Pw(){}function wy(t,e){if(!(Ro&&typeof CSS<"u"&&typeof CSS.supports<"u"&&CSS.supports(`selector(${e})`)))return null;try{return!!t&&t.matches(e)}catch{return null}}function Dw(t){return t.some(e=>yb(e)?e.type===Ch?!1:e.type!==yi||Dw(e.children):!0)?t:null}function M_(t,e,r){return(t==null?void 0:t(e))??(r==null?void 0:r(e))}function XG(t,e){if(!Ro||t===0)return e(),()=>{};const r=window.setTimeout(e,t);return()=>window.clearTimeout(r)}function KG(t,e){const r=t.clientX,u=t.clientY,R=e.getBoundingClientRect(),p=R.left,f=R.top,n=R.right,l=R.bottom;return r>=p&&r<=n&&u>=f&&u<=l}function j2(){const t=ni(),e=r=>{t.value=r};return Object.defineProperty(e,"value",{enumerable:!0,get:()=>t.value,set:r=>t.value=r}),Object.defineProperty(e,"el",{enumerable:!0,get:()=>$4(t.value)}),e}function Ty(t){const e=t.key.length===1,r=!t.ctrlKey&&!t.metaKey&&!t.altKey;return e&&r}function mg(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"}function U2(t){return"\\^$*+?.()|{}[]".includes(t)?`\\${t}`:t}function JG(t,e,r){const u=new RegExp(`[\\d\\-${U2(r)}]`),R=t.split("").filter(f=>u.test(f)).filter((f,n,l)=>n===0&&/[-]/.test(f)||f===r&&n===l.indexOf(f)||/\d/.test(f)).join("");if(e===0)return R.split(r)[0];const p=new RegExp(`${U2(r)}\\d`);if(e!==null&&p.test(R)){const f=R.split(r);return[f[0],f[1].substring(0,e)].join(r)}return R}function QG(t){const e={};for(const r in t)e[Kh(r)]=t[r];return e}function e$(t){const e=["checked","disabled"];return Object.fromEntries(Object.entries(t).filter(r=>{let[u,R]=r;return e.includes(u)?!!R:R!==void 0}))}function k6(t){const e=r=>Array.isArray(r)?r.map(u=>e(u)):Xs(r)||lp(r)||Yb(r)?e(Zi(r)):UT(r)?Object.keys(r).reduce((u,R)=>(u[R]=e(r[R]),u),{}):r;return e(t)}const MP=["top","bottom"],t$=["start","end","left","right"];function WT(t,e){let[r,u]=t.split(" ");return u||(u=V2(MP,r)?"start":V2(t$,r)?"top":"center"),{side:GT(r,e),align:GT(u,e)}}function GT(t,e){return t==="start"?e?"right":"left":t==="end"?e?"left":"right":t}function y5(t){return{side:{center:"center",top:"bottom",bottom:"top",left:"right",right:"left"}[t.side],align:t.align}}function b5(t){return{side:t.side,align:{center:"center",top:"bottom",bottom:"top",left:"right",right:"left"}[t.align]}}function S6(t){return{side:t.align,align:t.side}}function A6(t){return V2(MP,t.side)?"y":"x"}class rd{constructor(e){const r=document.body.currentCSSZoom??1,u=e instanceof Element,R=u?1+(1-r)/r:1,{x:p,y:f,width:n,height:l}=u?e.getBoundingClientRect():e;this.x=p*R,this.y=f*R,this.width=n*R,this.height=l*R}get top(){return this.y}get bottom(){return this.y+this.height}get left(){return this.x}get right(){return this.x+this.width}}function C6(t,e){return{x:{before:Math.max(0,e.left-t.left),after:Math.max(0,t.right-e.right)},y:{before:Math.max(0,e.top-t.top),after:Math.max(0,t.bottom-e.bottom)}}}function EP(t){if(Array.isArray(t)){const e=document.body.currentCSSZoom??1,r=1+(1-e)/e;return new rd({x:t[0]*r,y:t[1]*r,width:0*r,height:0*r})}else return new rd(t)}function n$(t){if(t===document.documentElement)if(visualViewport){const e=document.body.currentCSSZoom??1;return new rd({x:visualViewport.scale>1?0:visualViewport.offsetLeft,y:visualViewport.scale>1?0:visualViewport.offsetTop,width:visualViewport.width*visualViewport.scale/e,height:visualViewport.height*visualViewport.scale/e})}else return new rd({x:0,y:0,width:document.documentElement.clientWidth,height:document.documentElement.clientHeight});else return new rd(t)}function X4(t){const e=new rd(t),r=getComputedStyle(t),u=r.transform;if(u){let R,p,f,n,l;if(u.startsWith("matrix3d("))R=u.slice(9,-1).split(/, /),p=Number(R[0]),f=Number(R[5]),n=Number(R[12]),l=Number(R[13]);else if(u.startsWith("matrix("))R=u.slice(7,-1).split(/, /),p=Number(R[0]),f=Number(R[3]),n=Number(R[4]),l=Number(R[5]);else return new rd(e);const c=r.transformOrigin,i=e.x-n-(1-p)*parseFloat(c),_=e.y-l-(1-f)*parseFloat(c.slice(c.indexOf(" ")+1)),b=p?e.width/p:t.offsetWidth+1,w=f?e.height/f:t.offsetHeight+1;return new rd({x:i,y:_,width:b,height:w})}else return new rd(e)}function Wp(t,e,r){if(typeof t.animate>"u")return{finished:Promise.resolve()};let u;try{u=t.animate(e,r)}catch{return{finished:Promise.resolve()}}return typeof u.finished>"u"&&(u.finished=new Promise(R=>{u.onfinish=()=>{R(u)}})),u}const Z_=new WeakMap;function r$(t,e){Object.keys(e).forEach(r=>{if(Y4(r)){const u=AP(r),R=Z_.get(t);if(e[r]==null)R==null||R.forEach(p=>{const[f,n]=p;f===u&&(t.removeEventListener(u,n),R.delete(p))});else if(!R||![...R].some(p=>p[0]===u&&p[1]===e[r])){t.addEventListener(u,e[r]);const p=R||new Set;p.add([u,e[r]]),Z_.has(t)||Z_.set(t,p)}}else e[r]==null?t.removeAttribute(r):t.setAttribute(r,e[r])})}function i$(t,e){Object.keys(e).forEach(r=>{if(Y4(r)){const u=AP(r),R=Z_.get(t);R==null||R.forEach(p=>{const[f,n]=p;f===u&&(t.removeEventListener(u,n),R.delete(p))})}else t.removeAttribute(r)})}const E0=2.4,M6=.2126729,E6=.7151522,I6=.072175,a$=.55,o$=.58,s$=.57,l$=.62,E_=.03,L6=1.45,u$=5e-4,c$=1.25,h$=1.25,P6=.078,D6=12.82051282051282,I_=.06,R6=.001;function O6(t,e){const r=(t.r/255)**E0,u=(t.g/255)**E0,R=(t.b/255)**E0,p=(e.r/255)**E0,f=(e.g/255)**E0,n=(e.b/255)**E0;let l=r*M6+u*E6+R*I6,c=p*M6+f*E6+n*I6;if(l<=E_&&(l+=(E_-l)**L6),c<=E_&&(c+=(E_-c)**L6),Math.abs(c-l)<u$)return 0;let i;if(c>l){const _=(c**a$-l**o$)*c$;i=_<R6?0:_<P6?_-_*D6*I_:_-I_}else{const _=(c**l$-l**s$)*h$;i=_>-R6?0:_>-P6?_-_*D6*I_:_+I_}return i*100}const H2=.20689655172413793,f$=t=>t>H2**3?Math.cbrt(t):t/(3*H2**2)+4/29,d$=t=>t>H2?t**3:3*H2**2*(t-4/29);function IP(t){const e=f$,r=e(t[1]);return[116*r-16,500*(e(t[0]/.95047)-r),200*(r-e(t[2]/1.08883))]}function LP(t){const e=d$,r=(t[0]+16)/116;return[e(r+t[1]/500)*.95047,e(r),e(r-t[2]/200)*1.08883]}const p$=[[3.2406,-1.5372,-.4986],[-.9689,1.8758,.0415],[.0557,-.204,1.057]],m$=t=>t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055,g$=[[.4124,.3576,.1805],[.2126,.7152,.0722],[.0193,.1192,.9505]],v$=t=>t<=.04045?t/12.92:((t+.055)/1.055)**2.4;function PP(t){const e=Array(3),r=m$,u=p$;for(let R=0;R<3;++R)e[R]=Math.round(Vo(r(u[R][0]*t[0]+u[R][1]*t[1]+u[R][2]*t[2]))*255);return{r:e[0],g:e[1],b:e[2]}}function K4(t){let{r:e,g:r,b:u}=t;const R=[0,0,0],p=v$,f=g$;e=p(e/255),r=p(r/255),u=p(u/255);for(let n=0;n<3;++n)R[n]=f[n][0]*e+f[n][1]*r+f[n][2]*u;return R}function $T(t){return!!t&&/^(#|var\(--|(rgb|hsl)a?\()/.test(t)}function y$(t){return $T(t)&&!/^((rgb|hsl)a?\()?var\(--/.test(t)}const z6=/^(?<fn>(?:rgb|hsl)a?)\((?<values>.+)\)/,b$={rgb:(t,e,r,u)=>({r:t,g:e,b:r,a:u}),rgba:(t,e,r,u)=>({r:t,g:e,b:r,a:u}),hsl:(t,e,r,u)=>F6({h:t,s:e,l:r,a:u}),hsla:(t,e,r,u)=>F6({h:t,s:e,l:r,a:u}),hsv:(t,e,r,u)=>gp({h:t,s:e,v:r,a:u}),hsva:(t,e,r,u)=>gp({h:t,s:e,v:r,a:u})};function Lf(t){if(typeof t=="number")return{r:(t&16711680)>>16,g:(t&65280)>>8,b:t&255};if(typeof t=="string"&&z6.test(t)){const{groups:e}=t.match(z6),{fn:r,values:u}=e,R=u.split(/,\s*|\s*\/\s*|\s+/).map((p,f)=>p.endsWith("%")||f>0&&f<3&&["hsl","hsla","hsv","hsva"].includes(r)?parseFloat(p)/100:parseFloat(p));return b$[r](...R)}else if(typeof t=="string"){let e=t.startsWith("#")?t.slice(1):t;return[3,4].includes(e.length)?e=e.split("").map(r=>r+r).join(""):[6,8].includes(e.length),zP(e)}else if(typeof t=="object"){if(mv(t,["r","g","b"]))return t;if(mv(t,["h","s","l"]))return gp(J4(t));if(mv(t,["h","s","v"]))return gp(t)}throw new TypeError(`Invalid color: ${t==null?t:String(t)||t.constructor.name}
|
|
4213
|
+
`),At=de.createShader(de.FRAGMENT_SHADER);if(de.isContextLost())return void(this.failedToCreate=!0);if(de.shaderSource(At,kt),de.compileShader(At),!de.getShaderParameter(At,de.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${de.getShaderInfoLog(At)}`);de.attachShader(this.program,At);const $t=de.createShader(de.VERTEX_SHADER);if(de.isContextLost())return void(this.failedToCreate=!0);if(de.shaderSource($t,Bt),de.compileShader($t),!de.getShaderParameter($t,de.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${de.getShaderInfoLog($t)}`);de.attachShader(this.program,$t),this.attributes={};const Kt={};this.numAttributes=Re.length;for(let Yt=0;Yt<this.numAttributes;Yt++)Re[Yt]&&(de.bindAttribLocation(this.program,Yt,Re[Yt]),this.attributes[Re[Yt]]=Yt);if(de.linkProgram(this.program),!de.getProgramParameter(this.program,de.LINK_STATUS))throw new Error(`Program failed to link: ${de.getProgramInfoLog(this.program)}`);de.deleteShader($t),de.deleteShader(At);for(let Yt=0;Yt<yt.length;Yt++){const pn=yt[Yt];if(pn&&!Kt[pn]){const Tn=de.getUniformLocation(this.program,pn);Tn&&(Kt[pn]=Tn)}}this.fixedUniforms=j(d,Kt),this.terrainUniforms=((Yt,pn)=>({u_depth:new i.aI(Yt,pn.u_depth),u_terrain:new i.aI(Yt,pn.u_terrain),u_terrain_dim:new i.aJ(Yt,pn.u_terrain_dim),u_terrain_matrix:new i.aK(Yt,pn.u_terrain_matrix),u_terrain_unpack:new i.aL(Yt,pn.u_terrain_unpack),u_terrain_exaggeration:new i.aJ(Yt,pn.u_terrain_exaggeration)}))(d,Kt),this.binderUniforms=z?z.getUniforms(d,Kt):[]}draw(d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt,ft,yt,Ct,kt,Bt){const At=d.gl;if(this.failedToCreate)return;if(d.program.set(this.program),d.setDepthMode(z),d.setStencilMode(j),d.setColorMode($),d.setCullFace(ie),xe){d.activeTexture.set(At.TEXTURE2),At.bindTexture(At.TEXTURE_2D,xe.depthTexture),d.activeTexture.set(At.TEXTURE3),At.bindTexture(At.TEXTURE_2D,xe.texture);for(const Kt in this.terrainUniforms)this.terrainUniforms[Kt].set(xe[Kt])}for(const Kt in this.fixedUniforms)this.fixedUniforms[Kt].set(de[Kt]);yt&&yt.setUniforms(d,this.binderUniforms,lt,{zoom:ft});let $t=0;switch(g){case At.LINES:$t=2;break;case At.TRIANGLES:$t=3;break;case At.LINE_STRIP:$t=1}for(const Kt of tt.get()){const Yt=Kt.vaos||(Kt.vaos={});(Yt[Ae]||(Yt[Ae]=new Yr)).bind(d,this,Re,yt?yt.getPaintVertexBuffers():[],je,Kt.vertexOffset,Ct,kt,Bt),At.drawElements(g,Kt.primitiveLength*$t,At.UNSIGNED_SHORT,Kt.primitiveOffset*$t*2)}}}function qn(V,d,g){const z=1/Tt(g,1,d.transform.tileZoom),j=Math.pow(2,g.tileID.overscaledZ),$=g.tileSize*Math.pow(2,d.transform.tileZoom)/j,ie=$*(g.tileID.canonical.x+g.tileID.wrap*j),de=$*g.tileID.canonical.y;return{u_image:0,u_texsize:g.imageAtlasTexture.size,u_scale:[z,V.fromScale,V.toScale],u_fade:V.t,u_pixel_coord_upper:[ie>>16,de>>16],u_pixel_coord_lower:[65535&ie,65535&de]}}const sr=(V,d,g,z)=>{const j=d.style.light,$=j.properties.get("position"),ie=[$.x,$.y,$.z],de=function(){var Ae=new i.A(9);return i.A!=Float32Array&&(Ae[1]=0,Ae[2]=0,Ae[3]=0,Ae[5]=0,Ae[6]=0,Ae[7]=0),Ae[0]=1,Ae[4]=1,Ae[8]=1,Ae}();j.properties.get("anchor")==="viewport"&&function(Ae,Re){var je=Math.sin(Re),tt=Math.cos(Re);Ae[0]=tt,Ae[1]=je,Ae[2]=0,Ae[3]=-je,Ae[4]=tt,Ae[5]=0,Ae[6]=0,Ae[7]=0,Ae[8]=1}(de,-d.transform.angle),function(Ae,Re,je){var tt=Re[0],lt=Re[1],ft=Re[2];Ae[0]=tt*je[0]+lt*je[3]+ft*je[6],Ae[1]=tt*je[1]+lt*je[4]+ft*je[7],Ae[2]=tt*je[2]+lt*je[5]+ft*je[8]}(ie,ie,de);const xe=j.properties.get("color");return{u_matrix:V,u_lightpos:ie,u_lightintensity:j.properties.get("intensity"),u_lightcolor:[xe.r,xe.g,xe.b],u_vertical_gradient:+g,u_opacity:z}},Sr=(V,d,g,z,j,$,ie)=>i.e(sr(V,d,g,z),qn($,d,ie),{u_height_factor:-Math.pow(2,j.overscaledZ)/ie.tileSize/8}),wr=V=>({u_matrix:V}),Ur=(V,d,g,z)=>i.e(wr(V),qn(g,d,z)),ti=(V,d)=>({u_matrix:V,u_world:d}),vn=(V,d,g,z,j)=>i.e(Ur(V,d,g,z),{u_world:j}),Gn=(V,d,g,z)=>{const j=V.transform;let $,ie;if(z.paint.get("circle-pitch-alignment")==="map"){const de=Tt(g,1,j.zoom);$=!0,ie=[de,de]}else $=!1,ie=j.pixelsToGLUnits;return{u_camera_to_center_distance:j.cameraToCenterDistance,u_scale_with_map:+(z.paint.get("circle-pitch-scale")==="map"),u_matrix:V.translatePosMatrix(d.posMatrix,g,z.paint.get("circle-translate"),z.paint.get("circle-translate-anchor")),u_pitch_with_map:+$,u_device_pixel_ratio:V.pixelRatio,u_extrude_scale:ie}},nn=(V,d)=>({u_matrix:d,u_pixel_extrude_scale:[1/V.width,1/V.height]}),ln=(V,d,g)=>({u_matrix:V,u_inv_matrix:d,u_camera_to_center_distance:g.cameraToCenterDistance,u_viewport_size:[g.width,g.height]}),bn=(V,d,g=1)=>({u_matrix:V,u_color:d,u_overlay:0,u_overlay_scale:g}),Fn=V=>({u_matrix:V}),Bn=(V,d,g,z)=>({u_matrix:V,u_extrude_scale:Tt(d,1,g),u_intensity:z}),Kn=(V,d,g,z)=>{const j=i.H();i.aQ(j,0,V.width,V.height,0,0,1);const $=V.context.gl;return{u_matrix:j,u_world:[$.drawingBufferWidth,$.drawingBufferHeight],u_image:g,u_color_ramp:z,u_opacity:d.paint.get("heatmap-opacity")}},Hn=(V,d,g,z)=>{const j=g.paint.get("hillshade-shadow-color"),$=g.paint.get("hillshade-highlight-color"),ie=g.paint.get("hillshade-accent-color");let de=g.paint.get("hillshade-illumination-direction")*(Math.PI/180);g.paint.get("hillshade-illumination-anchor")==="viewport"&&(de-=V.transform.angle);const xe=!V.options.moving;return{u_matrix:z?z.posMatrix:V.transform.calculatePosMatrix(d.tileID.toUnwrapped(),xe),u_image:0,u_latrange:hn(0,d.tileID),u_light:[g.paint.get("hillshade-exaggeration"),de],u_shadow:j,u_highlight:$,u_accent:ie}},Dn=(V,d)=>{const g=d.stride,z=i.H();return i.aQ(z,0,i.X,-i.X,0,0,1),i.J(z,z,[0,-i.X,0]),{u_matrix:z,u_image:1,u_dimension:[g,g],u_zoom:V.overscaledZ,u_unpack:d.getUnpackVector()}};function hn(V,d){const g=Math.pow(2,d.canonical.z),z=d.canonical.y;return[new i.Z(0,z/g).toLngLat().lat,new i.Z(0,(z+1)/g).toLngLat().lat]}const cn=(V,d,g,z)=>{const j=V.transform;return{u_matrix:yr(V,d,g,z),u_ratio:1/Tt(d,1,j.zoom),u_device_pixel_ratio:V.pixelRatio,u_units_to_pixels:[1/j.pixelsToGLUnits[0],1/j.pixelsToGLUnits[1]]}},En=(V,d,g,z,j)=>i.e(cn(V,d,g,j),{u_image:0,u_image_height:z}),tr=(V,d,g,z,j)=>{const $=V.transform,ie=fr(d,$);return{u_matrix:yr(V,d,g,j),u_texsize:d.imageAtlasTexture.size,u_ratio:1/Tt(d,1,$.zoom),u_device_pixel_ratio:V.pixelRatio,u_image:0,u_scale:[ie,z.fromScale,z.toScale],u_fade:z.t,u_units_to_pixels:[1/$.pixelsToGLUnits[0],1/$.pixelsToGLUnits[1]]}},dr=(V,d,g,z,j,$)=>{const ie=V.transform,de=V.lineAtlas,xe=fr(d,ie),Ae=g.layout.get("line-cap")==="round",Re=de.getDash(z.from,Ae),je=de.getDash(z.to,Ae),tt=Re.width*j.fromScale,lt=je.width*j.toScale;return i.e(cn(V,d,g,$),{u_patternscale_a:[xe/tt,-Re.height/2],u_patternscale_b:[xe/lt,-je.height/2],u_sdfgamma:de.width/(256*Math.min(tt,lt)*V.pixelRatio)/2,u_image:0,u_tex_y_a:Re.y,u_tex_y_b:je.y,u_mix:j.t})};function fr(V,d){return 1/Tt(V,1,d.tileZoom)}function yr(V,d,g,z){return V.translatePosMatrix(z?z.posMatrix:d.tileID.posMatrix,d,g.paint.get("line-translate"),g.paint.get("line-translate-anchor"))}const Or=(V,d,g,z,j)=>{return{u_matrix:V,u_tl_parent:d,u_scale_parent:g,u_buffer_scale:1,u_fade_t:z.mix,u_opacity:z.opacity*j.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:j.paint.get("raster-brightness-min"),u_brightness_high:j.paint.get("raster-brightness-max"),u_saturation_factor:(ie=j.paint.get("raster-saturation"),ie>0?1-1/(1.001-ie):-ie),u_contrast_factor:($=j.paint.get("raster-contrast"),$>0?1/(1-$):1+$),u_spin_weights:Er(j.paint.get("raster-hue-rotate"))};var $,ie};function Er(V){V*=Math.PI/180;const d=Math.sin(V),g=Math.cos(V);return[(2*g+1)/3,(-Math.sqrt(3)*d-g+1)/3,(Math.sqrt(3)*d-g+1)/3]}const Br=(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt)=>{const ft=ie.transform;return{u_is_size_zoom_constant:+(V==="constant"||V==="source"),u_is_size_feature_constant:+(V==="constant"||V==="camera"),u_size_t:d?d.uSizeT:0,u_size:d?d.uSize:0,u_camera_to_center_distance:ft.cameraToCenterDistance,u_pitch:ft.pitch/360*2*Math.PI,u_rotate_symbol:+g,u_aspect_ratio:ft.width/ft.height,u_fade_change:ie.options.fadeDuration?ie.symbolFadeChange:1,u_matrix:de,u_label_plane_matrix:xe,u_coord_matrix:Ae,u_is_text:+je,u_pitch_with_map:+z,u_is_along_line:j,u_is_variable_anchor:$,u_texsize:tt,u_texture:0,u_translation:Re,u_pitched_scale:lt}},Cr=(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt,ft)=>{const yt=ie.transform;return i.e(Br(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,ft),{u_gamma_scale:z?Math.cos(yt._pitch)*yt.cameraToCenterDistance:1,u_device_pixel_ratio:ie.pixelRatio,u_is_halo:1})},Dr=(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt)=>i.e(Cr(V,d,g,z,j,$,ie,de,xe,Ae,Re,!0,je,!0,lt),{u_texsize_icon:tt,u_texture_icon:1}),$r=(V,d,g)=>({u_matrix:V,u_opacity:d,u_color:g}),fi=(V,d,g,z,j,$)=>i.e(function(ie,de,xe,Ae){const Re=xe.imageManager.getPattern(ie.from.toString()),je=xe.imageManager.getPattern(ie.to.toString()),{width:tt,height:lt}=xe.imageManager.getPixelSize(),ft=Math.pow(2,Ae.tileID.overscaledZ),yt=Ae.tileSize*Math.pow(2,xe.transform.tileZoom)/ft,Ct=yt*(Ae.tileID.canonical.x+Ae.tileID.wrap*ft),kt=yt*Ae.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:Re.tl,u_pattern_br_a:Re.br,u_pattern_tl_b:je.tl,u_pattern_br_b:je.br,u_texsize:[tt,lt],u_mix:de.t,u_pattern_size_a:Re.displaySize,u_pattern_size_b:je.displaySize,u_scale_a:de.fromScale,u_scale_b:de.toScale,u_tile_units_to_pixels:1/Tt(Ae,1,xe.transform.tileZoom),u_pixel_coord_upper:[Ct>>16,kt>>16],u_pixel_coord_lower:[65535&Ct,65535&kt]}}(z,$,g,j),{u_matrix:V,u_opacity:d}),Qr={fillExtrusion:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_lightpos:new i.aO(V,d.u_lightpos),u_lightintensity:new i.aJ(V,d.u_lightintensity),u_lightcolor:new i.aO(V,d.u_lightcolor),u_vertical_gradient:new i.aJ(V,d.u_vertical_gradient),u_opacity:new i.aJ(V,d.u_opacity)}),fillExtrusionPattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_lightpos:new i.aO(V,d.u_lightpos),u_lightintensity:new i.aJ(V,d.u_lightintensity),u_lightcolor:new i.aO(V,d.u_lightcolor),u_vertical_gradient:new i.aJ(V,d.u_vertical_gradient),u_height_factor:new i.aJ(V,d.u_height_factor),u_image:new i.aI(V,d.u_image),u_texsize:new i.aP(V,d.u_texsize),u_pixel_coord_upper:new i.aP(V,d.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,d.u_pixel_coord_lower),u_scale:new i.aO(V,d.u_scale),u_fade:new i.aJ(V,d.u_fade),u_opacity:new i.aJ(V,d.u_opacity)}),fill:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix)}),fillPattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_image:new i.aI(V,d.u_image),u_texsize:new i.aP(V,d.u_texsize),u_pixel_coord_upper:new i.aP(V,d.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,d.u_pixel_coord_lower),u_scale:new i.aO(V,d.u_scale),u_fade:new i.aJ(V,d.u_fade)}),fillOutline:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_world:new i.aP(V,d.u_world)}),fillOutlinePattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_world:new i.aP(V,d.u_world),u_image:new i.aI(V,d.u_image),u_texsize:new i.aP(V,d.u_texsize),u_pixel_coord_upper:new i.aP(V,d.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,d.u_pixel_coord_lower),u_scale:new i.aO(V,d.u_scale),u_fade:new i.aJ(V,d.u_fade)}),circle:(V,d)=>({u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_scale_with_map:new i.aI(V,d.u_scale_with_map),u_pitch_with_map:new i.aI(V,d.u_pitch_with_map),u_extrude_scale:new i.aP(V,d.u_extrude_scale),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_matrix:new i.aK(V,d.u_matrix)}),collisionBox:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_pixel_extrude_scale:new i.aP(V,d.u_pixel_extrude_scale)}),collisionCircle:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_inv_matrix:new i.aK(V,d.u_inv_matrix),u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_viewport_size:new i.aP(V,d.u_viewport_size)}),debug:(V,d)=>({u_color:new i.aM(V,d.u_color),u_matrix:new i.aK(V,d.u_matrix),u_overlay:new i.aI(V,d.u_overlay),u_overlay_scale:new i.aJ(V,d.u_overlay_scale)}),clippingMask:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix)}),heatmap:(V,d)=>({u_extrude_scale:new i.aJ(V,d.u_extrude_scale),u_intensity:new i.aJ(V,d.u_intensity),u_matrix:new i.aK(V,d.u_matrix)}),heatmapTexture:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_world:new i.aP(V,d.u_world),u_image:new i.aI(V,d.u_image),u_color_ramp:new i.aI(V,d.u_color_ramp),u_opacity:new i.aJ(V,d.u_opacity)}),hillshade:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_image:new i.aI(V,d.u_image),u_latrange:new i.aP(V,d.u_latrange),u_light:new i.aP(V,d.u_light),u_shadow:new i.aM(V,d.u_shadow),u_highlight:new i.aM(V,d.u_highlight),u_accent:new i.aM(V,d.u_accent)}),hillshadePrepare:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_image:new i.aI(V,d.u_image),u_dimension:new i.aP(V,d.u_dimension),u_zoom:new i.aJ(V,d.u_zoom),u_unpack:new i.aL(V,d.u_unpack)}),line:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_ratio:new i.aJ(V,d.u_ratio),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_units_to_pixels:new i.aP(V,d.u_units_to_pixels)}),lineGradient:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_ratio:new i.aJ(V,d.u_ratio),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_units_to_pixels:new i.aP(V,d.u_units_to_pixels),u_image:new i.aI(V,d.u_image),u_image_height:new i.aJ(V,d.u_image_height)}),linePattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_texsize:new i.aP(V,d.u_texsize),u_ratio:new i.aJ(V,d.u_ratio),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_image:new i.aI(V,d.u_image),u_units_to_pixels:new i.aP(V,d.u_units_to_pixels),u_scale:new i.aO(V,d.u_scale),u_fade:new i.aJ(V,d.u_fade)}),lineSDF:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_ratio:new i.aJ(V,d.u_ratio),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_units_to_pixels:new i.aP(V,d.u_units_to_pixels),u_patternscale_a:new i.aP(V,d.u_patternscale_a),u_patternscale_b:new i.aP(V,d.u_patternscale_b),u_sdfgamma:new i.aJ(V,d.u_sdfgamma),u_image:new i.aI(V,d.u_image),u_tex_y_a:new i.aJ(V,d.u_tex_y_a),u_tex_y_b:new i.aJ(V,d.u_tex_y_b),u_mix:new i.aJ(V,d.u_mix)}),raster:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_tl_parent:new i.aP(V,d.u_tl_parent),u_scale_parent:new i.aJ(V,d.u_scale_parent),u_buffer_scale:new i.aJ(V,d.u_buffer_scale),u_fade_t:new i.aJ(V,d.u_fade_t),u_opacity:new i.aJ(V,d.u_opacity),u_image0:new i.aI(V,d.u_image0),u_image1:new i.aI(V,d.u_image1),u_brightness_low:new i.aJ(V,d.u_brightness_low),u_brightness_high:new i.aJ(V,d.u_brightness_high),u_saturation_factor:new i.aJ(V,d.u_saturation_factor),u_contrast_factor:new i.aJ(V,d.u_contrast_factor),u_spin_weights:new i.aO(V,d.u_spin_weights)}),symbolIcon:(V,d)=>({u_is_size_zoom_constant:new i.aI(V,d.u_is_size_zoom_constant),u_is_size_feature_constant:new i.aI(V,d.u_is_size_feature_constant),u_size_t:new i.aJ(V,d.u_size_t),u_size:new i.aJ(V,d.u_size),u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_pitch:new i.aJ(V,d.u_pitch),u_rotate_symbol:new i.aI(V,d.u_rotate_symbol),u_aspect_ratio:new i.aJ(V,d.u_aspect_ratio),u_fade_change:new i.aJ(V,d.u_fade_change),u_matrix:new i.aK(V,d.u_matrix),u_label_plane_matrix:new i.aK(V,d.u_label_plane_matrix),u_coord_matrix:new i.aK(V,d.u_coord_matrix),u_is_text:new i.aI(V,d.u_is_text),u_pitch_with_map:new i.aI(V,d.u_pitch_with_map),u_is_along_line:new i.aI(V,d.u_is_along_line),u_is_variable_anchor:new i.aI(V,d.u_is_variable_anchor),u_texsize:new i.aP(V,d.u_texsize),u_texture:new i.aI(V,d.u_texture),u_translation:new i.aP(V,d.u_translation),u_pitched_scale:new i.aJ(V,d.u_pitched_scale)}),symbolSDF:(V,d)=>({u_is_size_zoom_constant:new i.aI(V,d.u_is_size_zoom_constant),u_is_size_feature_constant:new i.aI(V,d.u_is_size_feature_constant),u_size_t:new i.aJ(V,d.u_size_t),u_size:new i.aJ(V,d.u_size),u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_pitch:new i.aJ(V,d.u_pitch),u_rotate_symbol:new i.aI(V,d.u_rotate_symbol),u_aspect_ratio:new i.aJ(V,d.u_aspect_ratio),u_fade_change:new i.aJ(V,d.u_fade_change),u_matrix:new i.aK(V,d.u_matrix),u_label_plane_matrix:new i.aK(V,d.u_label_plane_matrix),u_coord_matrix:new i.aK(V,d.u_coord_matrix),u_is_text:new i.aI(V,d.u_is_text),u_pitch_with_map:new i.aI(V,d.u_pitch_with_map),u_is_along_line:new i.aI(V,d.u_is_along_line),u_is_variable_anchor:new i.aI(V,d.u_is_variable_anchor),u_texsize:new i.aP(V,d.u_texsize),u_texture:new i.aI(V,d.u_texture),u_gamma_scale:new i.aJ(V,d.u_gamma_scale),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_is_halo:new i.aI(V,d.u_is_halo),u_translation:new i.aP(V,d.u_translation),u_pitched_scale:new i.aJ(V,d.u_pitched_scale)}),symbolTextAndIcon:(V,d)=>({u_is_size_zoom_constant:new i.aI(V,d.u_is_size_zoom_constant),u_is_size_feature_constant:new i.aI(V,d.u_is_size_feature_constant),u_size_t:new i.aJ(V,d.u_size_t),u_size:new i.aJ(V,d.u_size),u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_pitch:new i.aJ(V,d.u_pitch),u_rotate_symbol:new i.aI(V,d.u_rotate_symbol),u_aspect_ratio:new i.aJ(V,d.u_aspect_ratio),u_fade_change:new i.aJ(V,d.u_fade_change),u_matrix:new i.aK(V,d.u_matrix),u_label_plane_matrix:new i.aK(V,d.u_label_plane_matrix),u_coord_matrix:new i.aK(V,d.u_coord_matrix),u_is_text:new i.aI(V,d.u_is_text),u_pitch_with_map:new i.aI(V,d.u_pitch_with_map),u_is_along_line:new i.aI(V,d.u_is_along_line),u_is_variable_anchor:new i.aI(V,d.u_is_variable_anchor),u_texsize:new i.aP(V,d.u_texsize),u_texsize_icon:new i.aP(V,d.u_texsize_icon),u_texture:new i.aI(V,d.u_texture),u_texture_icon:new i.aI(V,d.u_texture_icon),u_gamma_scale:new i.aJ(V,d.u_gamma_scale),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_is_halo:new i.aI(V,d.u_is_halo),u_translation:new i.aP(V,d.u_translation),u_pitched_scale:new i.aJ(V,d.u_pitched_scale)}),background:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_opacity:new i.aJ(V,d.u_opacity),u_color:new i.aM(V,d.u_color)}),backgroundPattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_opacity:new i.aJ(V,d.u_opacity),u_image:new i.aI(V,d.u_image),u_pattern_tl_a:new i.aP(V,d.u_pattern_tl_a),u_pattern_br_a:new i.aP(V,d.u_pattern_br_a),u_pattern_tl_b:new i.aP(V,d.u_pattern_tl_b),u_pattern_br_b:new i.aP(V,d.u_pattern_br_b),u_texsize:new i.aP(V,d.u_texsize),u_mix:new i.aJ(V,d.u_mix),u_pattern_size_a:new i.aP(V,d.u_pattern_size_a),u_pattern_size_b:new i.aP(V,d.u_pattern_size_b),u_scale_a:new i.aJ(V,d.u_scale_a),u_scale_b:new i.aJ(V,d.u_scale_b),u_pixel_coord_upper:new i.aP(V,d.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,d.u_pixel_coord_lower),u_tile_units_to_pixels:new i.aJ(V,d.u_tile_units_to_pixels)}),terrain:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_texture:new i.aI(V,d.u_texture),u_ele_delta:new i.aJ(V,d.u_ele_delta),u_fog_matrix:new i.aK(V,d.u_fog_matrix),u_fog_color:new i.aM(V,d.u_fog_color),u_fog_ground_blend:new i.aJ(V,d.u_fog_ground_blend),u_fog_ground_blend_opacity:new i.aJ(V,d.u_fog_ground_blend_opacity),u_horizon_color:new i.aM(V,d.u_horizon_color),u_horizon_fog_blend:new i.aJ(V,d.u_horizon_fog_blend)}),terrainDepth:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_ele_delta:new i.aJ(V,d.u_ele_delta)}),terrainCoords:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_texture:new i.aI(V,d.u_texture),u_terrain_coords_id:new i.aJ(V,d.u_terrain_coords_id),u_ele_delta:new i.aJ(V,d.u_ele_delta)}),sky:(V,d)=>({u_sky_color:new i.aM(V,d.u_sky_color),u_horizon_color:new i.aM(V,d.u_horizon_color),u_horizon:new i.aJ(V,d.u_horizon),u_sky_horizon_blend:new i.aJ(V,d.u_sky_horizon_blend)})};class Hr{constructor(d,g,z){this.context=d;const j=d.gl;this.buffer=j.createBuffer(),this.dynamicDraw=!!z,this.context.unbindVAO(),d.bindElementBuffer.set(this.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,g.arrayBuffer,this.dynamicDraw?j.DYNAMIC_DRAW:j.STATIC_DRAW),this.dynamicDraw||delete g.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(d){const g=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),g.bufferSubData(g.ELEMENT_ARRAY_BUFFER,0,d.arrayBuffer)}destroy(){const d=this.context.gl;this.buffer&&(d.deleteBuffer(this.buffer),delete this.buffer)}}const oi={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Mi{constructor(d,g,z,j){this.length=g.length,this.attributes=z,this.itemSize=g.bytesPerElement,this.dynamicDraw=j,this.context=d;const $=d.gl;this.buffer=$.createBuffer(),d.bindVertexBuffer.set(this.buffer),$.bufferData($.ARRAY_BUFFER,g.arrayBuffer,this.dynamicDraw?$.DYNAMIC_DRAW:$.STATIC_DRAW),this.dynamicDraw||delete g.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(d){if(d.length!==this.length)throw new Error(`Length of new data is ${d.length}, which doesn't match current length of ${this.length}`);const g=this.context.gl;this.bind(),g.bufferSubData(g.ARRAY_BUFFER,0,d.arrayBuffer)}enableAttributes(d,g){for(let z=0;z<this.attributes.length;z++){const j=this.attributes[z],$=g.attributes[j.name];$!==void 0&&d.enableVertexAttribArray($)}}setVertexAttribPointers(d,g,z){for(let j=0;j<this.attributes.length;j++){const $=this.attributes[j],ie=g.attributes[$.name];ie!==void 0&&d.vertexAttribPointer(ie,$.components,d[oi[$.type]],!1,this.itemSize,$.offset+this.itemSize*(z||0))}}destroy(){const d=this.context.gl;this.buffer&&(d.deleteBuffer(this.buffer),delete this.buffer)}}const Bi=new WeakMap;function Ya(V){var d;if(Bi.has(V))return Bi.get(V);{const g=(d=V.getParameter(V.VERSION))===null||d===void 0?void 0:d.startsWith("WebGL 2.0");return Bi.set(V,g),g}}class Vi{constructor(d){this.gl=d.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(d){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class ns extends Vi{getDefault(){return i.aN.transparent}set(d){const g=this.current;(d.r!==g.r||d.g!==g.g||d.b!==g.b||d.a!==g.a||this.dirty)&&(this.gl.clearColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class no extends Vi{getDefault(){return 1}set(d){(d!==this.current||this.dirty)&&(this.gl.clearDepth(d),this.current=d,this.dirty=!1)}}class ko extends Vi{getDefault(){return 0}set(d){(d!==this.current||this.dirty)&&(this.gl.clearStencil(d),this.current=d,this.dirty=!1)}}class el extends Vi{getDefault(){return[!0,!0,!0,!0]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||d[2]!==g[2]||d[3]!==g[3]||this.dirty)&&(this.gl.colorMask(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class Ui extends Vi{getDefault(){return!0}set(d){(d!==this.current||this.dirty)&&(this.gl.depthMask(d),this.current=d,this.dirty=!1)}}class qo extends Vi{getDefault(){return 255}set(d){(d!==this.current||this.dirty)&&(this.gl.stencilMask(d),this.current=d,this.dirty=!1)}}class Bl extends Vi{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(d){const g=this.current;(d.func!==g.func||d.ref!==g.ref||d.mask!==g.mask||this.dirty)&&(this.gl.stencilFunc(d.func,d.ref,d.mask),this.current=d,this.dirty=!1)}}class jo extends Vi{getDefault(){const d=this.gl;return[d.KEEP,d.KEEP,d.KEEP]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||d[2]!==g[2]||this.dirty)&&(this.gl.stencilOp(d[0],d[1],d[2]),this.current=d,this.dirty=!1)}}class qu extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;d?g.enable(g.STENCIL_TEST):g.disable(g.STENCIL_TEST),this.current=d,this.dirty=!1}}class Sl extends Vi{getDefault(){return[0,1]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||this.dirty)&&(this.gl.depthRange(d[0],d[1]),this.current=d,this.dirty=!1)}}class Is extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;d?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST),this.current=d,this.dirty=!1}}class Wu extends Vi{getDefault(){return this.gl.LESS}set(d){(d!==this.current||this.dirty)&&(this.gl.depthFunc(d),this.current=d,this.dirty=!1)}}class Gu extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;d?g.enable(g.BLEND):g.disable(g.BLEND),this.current=d,this.dirty=!1}}class dc extends Vi{getDefault(){const d=this.gl;return[d.ONE,d.ZERO]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||this.dirty)&&(this.gl.blendFunc(d[0],d[1]),this.current=d,this.dirty=!1)}}class tl extends Vi{getDefault(){return i.aN.transparent}set(d){const g=this.current;(d.r!==g.r||d.g!==g.g||d.b!==g.b||d.a!==g.a||this.dirty)&&(this.gl.blendColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class Su extends Vi{getDefault(){return this.gl.FUNC_ADD}set(d){(d!==this.current||this.dirty)&&(this.gl.blendEquation(d),this.current=d,this.dirty=!1)}}class Al extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;d?g.enable(g.CULL_FACE):g.disable(g.CULL_FACE),this.current=d,this.dirty=!1}}class ro extends Vi{getDefault(){return this.gl.BACK}set(d){(d!==this.current||this.dirty)&&(this.gl.cullFace(d),this.current=d,this.dirty=!1)}}class rs extends Vi{getDefault(){return this.gl.CCW}set(d){(d!==this.current||this.dirty)&&(this.gl.frontFace(d),this.current=d,this.dirty=!1)}}class $u extends Vi{getDefault(){return null}set(d){(d!==this.current||this.dirty)&&(this.gl.useProgram(d),this.current=d,this.dirty=!1)}}class Au extends Vi{getDefault(){return this.gl.TEXTURE0}set(d){(d!==this.current||this.dirty)&&(this.gl.activeTexture(d),this.current=d,this.dirty=!1)}}class fu extends Vi{getDefault(){const d=this.gl;return[0,0,d.drawingBufferWidth,d.drawingBufferHeight]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||d[2]!==g[2]||d[3]!==g[3]||this.dirty)&&(this.gl.viewport(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class Yu extends Vi{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.bindFramebuffer(g.FRAMEBUFFER,d),this.current=d,this.dirty=!1}}class du extends Vi{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.bindRenderbuffer(g.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class Zu extends Vi{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.bindTexture(g.TEXTURE_2D,d),this.current=d,this.dirty=!1}}class Xu extends Vi{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.bindBuffer(g.ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class Cu extends Vi{getDefault(){return null}set(d){const g=this.gl;g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class Ls extends Vi{getDefault(){return null}set(d){var g;if(d===this.current&&!this.dirty)return;const z=this.gl;Ya(z)?z.bindVertexArray(d):(g=z.getExtension("OES_vertex_array_object"))===null||g===void 0||g.bindVertexArrayOES(d),this.current=d,this.dirty=!1}}class Ph extends Vi{getDefault(){return 4}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.pixelStorei(g.UNPACK_ALIGNMENT,d),this.current=d,this.dirty=!1}}class dh extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d),this.current=d,this.dirty=!1}}class pc extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,d),this.current=d,this.dirty=!1}}class Dh extends Vi{constructor(d,g){super(d),this.context=d,this.parent=g}getDefault(){return null}}class Qh extends Dh{setDirty(){this.dirty=!0}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const g=this.gl;g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,g.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class Nl extends Dh{set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const g=this.gl;g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class ef extends Dh{set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const g=this.gl;g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class ld{constructor(d,g,z,j,$){this.context=d,this.width=g,this.height=z;const ie=d.gl,de=this.framebuffer=ie.createFramebuffer();if(this.colorAttachment=new Qh(d,de),j)this.depthAttachment=$?new ef(d,de):new Nl(d,de);else if($)throw new Error("Stencil cannot be set without depth");if(ie.checkFramebufferStatus(ie.FRAMEBUFFER)!==ie.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const d=this.context.gl,g=this.colorAttachment.get();if(g&&d.deleteTexture(g),this.depthAttachment){const z=this.depthAttachment.get();z&&d.deleteRenderbuffer(z)}d.deleteFramebuffer(this.framebuffer)}}class Wo{constructor(d,g,z){this.blendFunction=d,this.blendColor=g,this.mask=z}}Wo.Replace=[1,0],Wo.disabled=new Wo(Wo.Replace,i.aN.transparent,[!1,!1,!1,!1]),Wo.unblended=new Wo(Wo.Replace,i.aN.transparent,[!0,!0,!0,!0]),Wo.alphaBlended=new Wo([1,771],i.aN.transparent,[!0,!0,!0,!0]);class Zc{constructor(d){var g,z;if(this.gl=d,this.clearColor=new ns(this),this.clearDepth=new no(this),this.clearStencil=new ko(this),this.colorMask=new el(this),this.depthMask=new Ui(this),this.stencilMask=new qo(this),this.stencilFunc=new Bl(this),this.stencilOp=new jo(this),this.stencilTest=new qu(this),this.depthRange=new Sl(this),this.depthTest=new Is(this),this.depthFunc=new Wu(this),this.blend=new Gu(this),this.blendFunc=new dc(this),this.blendColor=new tl(this),this.blendEquation=new Su(this),this.cullFace=new Al(this),this.cullFaceSide=new ro(this),this.frontFace=new rs(this),this.program=new $u(this),this.activeTexture=new Au(this),this.viewport=new fu(this),this.bindFramebuffer=new Yu(this),this.bindRenderbuffer=new du(this),this.bindTexture=new Zu(this),this.bindVertexBuffer=new Xu(this),this.bindElementBuffer=new Cu(this),this.bindVertexArray=new Ls(this),this.pixelStoreUnpack=new Ph(this),this.pixelStoreUnpackPremultiplyAlpha=new dh(this),this.pixelStoreUnpackFlipY=new pc(this),this.extTextureFilterAnisotropic=d.getExtension("EXT_texture_filter_anisotropic")||d.getExtension("MOZ_EXT_texture_filter_anisotropic")||d.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=d.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=d.getParameter(d.MAX_TEXTURE_SIZE),Ya(d)){this.HALF_FLOAT=d.HALF_FLOAT;const j=d.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(g=d.RGBA16F)!==null&&g!==void 0?g:j==null?void 0:j.RGBA16F_EXT,this.RGB16F=(z=d.RGB16F)!==null&&z!==void 0?z:j==null?void 0:j.RGB16F_EXT,d.getExtension("EXT_color_buffer_float")}else{d.getExtension("EXT_color_buffer_half_float"),d.getExtension("OES_texture_half_float_linear");const j=d.getExtension("OES_texture_half_float");this.HALF_FLOAT=j==null?void 0:j.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(d,g){return new Hr(this,d,g)}createVertexBuffer(d,g,z){return new Mi(this,d,g,z)}createRenderbuffer(d,g,z){const j=this.gl,$=j.createRenderbuffer();return this.bindRenderbuffer.set($),j.renderbufferStorage(j.RENDERBUFFER,d,g,z),this.bindRenderbuffer.set(null),$}createFramebuffer(d,g,z,j){return new ld(this,d,g,z,j)}clear({color:d,depth:g,stencil:z}){const j=this.gl;let $=0;d&&($|=j.COLOR_BUFFER_BIT,this.clearColor.set(d),this.colorMask.set([!0,!0,!0,!0])),g!==void 0&&($|=j.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(g),this.depthMask.set(!0)),z!==void 0&&($|=j.STENCIL_BUFFER_BIT,this.clearStencil.set(z),this.stencilMask.set(255)),j.clear($)}setCullFace(d){d.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(d.mode),this.frontFace.set(d.frontFace))}setDepthMode(d){d.func!==this.gl.ALWAYS||d.mask?(this.depthTest.set(!0),this.depthFunc.set(d.func),this.depthMask.set(d.mask),this.depthRange.set(d.range)):this.depthTest.set(!1)}setStencilMode(d){d.test.func!==this.gl.ALWAYS||d.mask?(this.stencilTest.set(!0),this.stencilMask.set(d.mask),this.stencilOp.set([d.fail,d.depthFail,d.pass]),this.stencilFunc.set({func:d.test.func,ref:d.ref,mask:d.test.mask})):this.stencilTest.set(!1)}setColorMode(d){i.aF(d.blendFunction,Wo.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(d.blendFunction),this.blendColor.set(d.blendColor)),this.colorMask.set(d.mask)}createVertexArray(){var d;return Ya(this.gl)?this.gl.createVertexArray():(d=this.gl.getExtension("OES_vertex_array_object"))===null||d===void 0?void 0:d.createVertexArrayOES()}deleteVertexArray(d){var g;return Ya(this.gl)?this.gl.deleteVertexArray(d):(g=this.gl.getExtension("OES_vertex_array_object"))===null||g===void 0?void 0:g.deleteVertexArrayOES(d)}unbindVAO(){this.bindVertexArray.set(null)}}class Qi{constructor(d,g,z){this.func=d,this.mask=g,this.range=z}}Qi.ReadOnly=!1,Qi.ReadWrite=!0,Qi.disabled=new Qi(519,Qi.ReadOnly,[0,1]);const mc=7680;class Za{constructor(d,g,z,j,$,ie){this.test=d,this.ref=g,this.mask=z,this.fail=j,this.depthFail=$,this.pass=ie}}Za.disabled=new Za({func:519,mask:0},0,0,mc,mc,mc);class Xa{constructor(d,g,z){this.enable=d,this.mode=g,this.frontFace=z}}let Vl;function dl(V,d,g,z,j){const $=V.context,ie=$.gl,de=V.useProgram("collisionBox"),xe=[];let Ae=0,Re=0;for(let Ct=0;Ct<z.length;Ct++){const kt=z[Ct],Bt=d.getTile(kt).getBucket(g);if(!Bt)continue;const At=j?Bt.textCollisionBox:Bt.iconCollisionBox,$t=Bt.collisionCircleArray;if($t.length>0){const Kt=i.H();i.aR(Kt,Bt.placementInvProjMatrix,V.transform.glCoordMatrix),i.aR(Kt,Kt,Bt.placementViewportMatrix),xe.push({circleArray:$t,circleOffset:Re,transform:kt.posMatrix,invTransform:Kt,coord:kt}),Ae+=$t.length/4,Re=Ae}At&&de.draw($,ie.LINES,Qi.disabled,Za.disabled,V.colorModeForRenderPass(),Xa.disabled,nn(V.transform,kt.posMatrix),V.style.map.terrain&&V.style.map.terrain.getTerrainData(kt),g.id,At.layoutVertexBuffer,At.indexBuffer,At.segments,null,V.transform.zoom,null,null,At.collisionVertexBuffer)}if(!j||!xe.length)return;const je=V.useProgram("collisionCircle"),tt=new i.aS;tt.resize(4*Ae),tt._trim();let lt=0;for(const Ct of xe)for(let kt=0;kt<Ct.circleArray.length/4;kt++){const Bt=4*kt,At=Ct.circleArray[Bt+0],$t=Ct.circleArray[Bt+1],Kt=Ct.circleArray[Bt+2],Yt=Ct.circleArray[Bt+3];tt.emplace(lt++,At,$t,Kt,Yt,0),tt.emplace(lt++,At,$t,Kt,Yt,1),tt.emplace(lt++,At,$t,Kt,Yt,2),tt.emplace(lt++,At,$t,Kt,Yt,3)}(!Vl||Vl.length<2*Ae)&&(Vl=function(Ct){const kt=2*Ct,Bt=new i.aU;Bt.resize(kt),Bt._trim();for(let At=0;At<kt;At++){const $t=6*At;Bt.uint16[$t+0]=4*At+0,Bt.uint16[$t+1]=4*At+1,Bt.uint16[$t+2]=4*At+2,Bt.uint16[$t+3]=4*At+2,Bt.uint16[$t+4]=4*At+3,Bt.uint16[$t+5]=4*At+0}return Bt}(Ae));const ft=$.createIndexBuffer(Vl,!0),yt=$.createVertexBuffer(tt,i.aT.members,!0);for(const Ct of xe){const kt=ln(Ct.transform,Ct.invTransform,V.transform);je.draw($,ie.TRIANGLES,Qi.disabled,Za.disabled,V.colorModeForRenderPass(),Xa.disabled,kt,V.style.map.terrain&&V.style.map.terrain.getTerrainData(Ct.coord),g.id,yt,ft,i.a0.simpleSegment(0,2*Ct.circleOffset,Ct.circleArray.length,Ct.circleArray.length/2),null,V.transform.zoom,null,null,null)}yt.destroy(),ft.destroy()}Xa.disabled=new Xa(!1,1029,2305),Xa.backCCW=new Xa(!0,1029,2305);const Xc=i.ao(new Float32Array(16));function Ku(V,d,g,z,j){if(V.renderPass!=="translucent")return;const $=Za.disabled,ie=V.colorModeForRenderPass();(g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(de,xe,Ae,Re,je,tt,lt,ft,yt){const Ct=xe.transform,kt=Rn(),Bt=je==="map",At=tt==="map";for(const $t of de){const Kt=Re.getTile($t),Yt=Kt.getBucket(Ae);if(!Yt||!Yt.text||!Yt.text.segments.get().length)continue;const pn=Yt.textSizeData,Tn=i.ah(pn,Ct.zoom),Vn=Tt(Kt,1,xe.transform.zoom),jn=Nt($t.posMatrix,At,Bt,xe.transform,Vn),$n=Ae.layout.get("icon-text-fit")!=="none"&&Yt.hasIconData();if(Tn){const er=Math.pow(2,Ct.zoom-Kt.tileID.overscaledZ),Tr=xe.style.map.terrain?(Ar,ur)=>xe.style.map.terrain.getElevation($t,Ar,ur):null,rr=kt.translatePosition(Ct,Kt,lt,ft);vs(Yt,Bt,At,yt,Ct,jn,$t.posMatrix,er,Tn,$n,kt,rr,$t.toUnwrapped(),Tr)}}}(z,V,g,d,g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),j),g.paint.get("icon-opacity").constantOr(1)!==0&&Pc(V,d,g,z,!1,g.paint.get("icon-translate"),g.paint.get("icon-translate-anchor"),g.layout.get("icon-rotation-alignment"),g.layout.get("icon-pitch-alignment"),g.layout.get("icon-keep-upright"),$,ie),g.paint.get("text-opacity").constantOr(1)!==0&&Pc(V,d,g,z,!0,g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),g.layout.get("text-keep-upright"),$,ie),d.map.showCollisionBoxes&&(dl(V,d,g,z,!0),dl(V,d,g,z,!1))}function pl(V,d,g,z,j,$){const{horizontalAlign:ie,verticalAlign:de}=i.av(V),xe=-(ie-.5)*d,Ae=-(de-.5)*g;return new i.P((xe/j+z[0])*$,(Ae/j+z[1])*$)}function Cl(V,d,g,z,j,$){const ie=d.tileAnchorPoint.add(new i.P(d.translation[0],d.translation[1]));if(d.pitchWithMap){let de=z.mult($);return g||(de=de.rotate(-j)),Ut(ie.add(de),d.labelPlaneMatrix,d.getElevation).point}if(g){const de=$e(d.tileAnchorPoint.x+1,d.tileAnchorPoint.y,d).point.sub(V),xe=Math.atan(de.y/de.x)+(de.x<0?Math.PI:0);return V.add(z.rotate(xe))}return V.add(z)}function vs(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt){const ft=V.text.placedSymbolArray,yt=V.text.dynamicLayoutVertexArray,Ct=V.icon.dynamicLayoutVertexArray,kt={};yt.clear();for(let Bt=0;Bt<ft.length;Bt++){const At=ft.get(Bt),$t=V.allowVerticalPlacement&&!At.placedOrientation,Kt=At.hidden||!At.crossTileID||$t?null:z[At.crossTileID];if(Kt){const Yt=new i.P(At.anchorX,At.anchorY),pn={getElevation:lt,width:j.width,height:j.height,labelPlaneMatrix:$,pitchWithMap:g,projection:Re,tileAnchorPoint:Yt,translation:je,unwrappedTileID:tt},Tn=g?Ut(Yt,ie,lt):$e(Yt.x,Yt.y,pn),Vn=at(j.cameraToCenterDistance,Tn.signedDistanceFromCamera);let jn=i.aj(V.textSizeData,xe,At)*Vn/i.aq;g&&(jn*=V.tilePixelRatio/de);const{width:$n,height:er,anchor:Tr,textOffset:rr,textBoxScale:Ar}=Kt,ur=pl(Tr,$n,er,rr,Ar,jn),Pr=Re.getPitchedTextCorrection(j,Yt.add(new i.P(je[0],je[1])),tt),br=Cl(Tn.point,pn,d,ur,j.angle,Pr),Nr=V.allowVerticalPlacement&&At.placedOrientation===i.ai.vertical?Math.PI/2:0;for(let li=0;li<At.numGlyphs;li++)i.ak(yt,br,Nr);Ae&&At.associatedIconIndex>=0&&(kt[At.associatedIconIndex]={shiftedAnchor:br,angle:Nr})}else Ft(At.numGlyphs,yt)}if(Ae){Ct.clear();const Bt=V.icon.placedSymbolArray;for(let At=0;At<Bt.length;At++){const $t=Bt.get(At);if($t.hidden)Ft($t.numGlyphs,Ct);else{const Kt=kt[At];if(Kt)for(let Yt=0;Yt<$t.numGlyphs;Yt++)i.ak(Ct,Kt.shiftedAnchor,Kt.angle);else Ft($t.numGlyphs,Ct)}}V.icon.dynamicLayoutVertexBuffer.updateData(Ct)}V.text.dynamicLayoutVertexBuffer.updateData(yt)}function fa(V,d,g){return g.iconsInText&&d?"symbolTextAndIcon":V?"symbolSDF":"symbolIcon"}function Pc(V,d,g,z,j,$,ie,de,xe,Ae,Re,je){const tt=V.context,lt=tt.gl,ft=V.transform,yt=Rn(),Ct=de==="map",kt=xe==="map",Bt=de!=="viewport"&&g.layout.get("symbol-placement")!=="point",At=Ct&&!kt&&!Bt,$t=!kt&&Bt,Kt=!g.layout.get("symbol-sort-key").isConstant();let Yt=!1;const pn=V.depthModeForSublayer(0,Qi.ReadOnly),Tn=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Vn=[],jn=yt.getCircleRadiusCorrection(ft);for(const $n of z){const er=d.getTile($n),Tr=er.getBucket(g);if(!Tr)continue;const rr=j?Tr.text:Tr.icon;if(!rr||!rr.segments.get().length||!rr.hasVisibleVertices)continue;const Ar=rr.programConfigurations.get(g.id),ur=j||Tr.sdfIcons,Pr=j?Tr.textSizeData:Tr.iconSizeData,br=kt||ft.pitch!==0,Nr=V.useProgram(fa(ur,j,Tr),Ar),li=i.ah(Pr,ft.zoom),Fr=V.style.map.terrain&&V.style.map.terrain.getTerrainData($n);let ri,vi,qi,Di,Yi=[0,0],Gi=null;if(j){if(vi=er.glyphAtlasTexture,qi=lt.LINEAR,ri=er.glyphAtlasTexture.size,Tr.iconsInText){Yi=er.imageAtlasTexture.size,Gi=er.imageAtlasTexture;const Wi=Pr.kind==="composite"||Pr.kind==="camera";Di=br||V.options.rotating||V.options.zooming||Wi?lt.LINEAR:lt.NEAREST}}else{const Wi=g.layout.get("icon-size").constantOr(0)!==1||Tr.iconsNeedLinear;vi=er.imageAtlasTexture,qi=ur||V.options.rotating||V.options.zooming||Wi||br?lt.LINEAR:lt.NEAREST,ri=er.imageAtlasTexture.size}const ea=Tt(er,1,V.transform.zoom),_a=$t?$n.posMatrix:Xc,So=Nt(_a,kt,Ct,V.transform,ea),go=jt(_a,kt,Ct,V.transform,ea),Zo=jt($n.posMatrix,kt,Ct,V.transform,ea),Aa=yt.translatePosition(V.transform,er,$,ie),ra=Tn&&Tr.hasTextData(),oo=g.layout.get("icon-text-fit")!=="none"&&ra&&Tr.hasIconData();if(Bt){const Wi=V.style.map.terrain?(Uo,Il)=>V.style.map.terrain.getElevation($n,Uo,Il):null,_s=g.layout.get("text-rotation-alignment")==="map";ct(Tr,$n.posMatrix,V,j,So,Zo,kt,Ae,_s,yt,$n.toUnwrapped(),ft.width,ft.height,Aa,Wi)}const Pa=$n.posMatrix,va=j&&Tn||oo,Ca=Bt||va?Xc:So,Wa=go,aa=ur&&g.paint.get(j?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Kl;Kl=ur?Tr.iconsInText?Dr(Pr.kind,li,At,kt,Bt,va,V,Pa,Ca,Wa,Aa,ri,Yi,jn):Cr(Pr.kind,li,At,kt,Bt,va,V,Pa,Ca,Wa,Aa,j,ri,!0,jn):Br(Pr.kind,li,At,kt,Bt,va,V,Pa,Ca,Wa,Aa,j,ri,jn);const Lo={program:Nr,buffers:rr,uniformValues:Kl,atlasTexture:vi,atlasTextureIcon:Gi,atlasInterpolation:qi,atlasInterpolationIcon:Di,isSDF:ur,hasHalo:aa};if(Kt&&Tr.canOverlap){Yt=!0;const Wi=rr.segments.get();for(const _s of Wi)Vn.push({segments:new i.a0([_s]),sortKey:_s.sortKey,state:Lo,terrainData:Fr})}else Vn.push({segments:rr.segments,sortKey:0,state:Lo,terrainData:Fr})}Yt&&Vn.sort(($n,er)=>$n.sortKey-er.sortKey);for(const $n of Vn){const er=$n.state;if(tt.activeTexture.set(lt.TEXTURE0),er.atlasTexture.bind(er.atlasInterpolation,lt.CLAMP_TO_EDGE),er.atlasTextureIcon&&(tt.activeTexture.set(lt.TEXTURE1),er.atlasTextureIcon&&er.atlasTextureIcon.bind(er.atlasInterpolationIcon,lt.CLAMP_TO_EDGE)),er.isSDF){const Tr=er.uniformValues;er.hasHalo&&(Tr.u_is_halo=1,tf(er.buffers,$n.segments,g,V,er.program,pn,Re,je,Tr,$n.terrainData)),Tr.u_is_halo=0}tf(er.buffers,$n.segments,g,V,er.program,pn,Re,je,er.uniformValues,$n.terrainData)}}function tf(V,d,g,z,j,$,ie,de,xe,Ae){const Re=z.context,je=Re.gl;j.draw(Re,je.TRIANGLES,$,ie,de,Xa.disabled,xe,Ae,g.id,V.layoutVertexBuffer,V.indexBuffer,d,g.paint,z.transform.zoom,V.programConfigurations.get(g.id),V.dynamicLayoutVertexBuffer,V.opacityVertexBuffer)}function Ju(V,d,g,z){if(g.paint.get("heatmap-opacity")!==0)if(V.renderPass==="offscreen"){const j=V.context,$=j.gl,ie=Za.disabled,de=new Wo([$.ONE,$.ONE],i.aN.transparent,[!0,!0,!0,!0]);(function(xe,Ae,Re){const je=xe.gl;xe.activeTexture.set(je.TEXTURE1),xe.viewport.set([0,0,Ae.width/4,Ae.height/4]);let tt=Re.heatmapFbo;if(tt)je.bindTexture(je.TEXTURE_2D,tt.colorAttachment.get()),xe.bindFramebuffer.set(tt.framebuffer);else{const lt=je.createTexture();je.bindTexture(je.TEXTURE_2D,lt),je.texParameteri(je.TEXTURE_2D,je.TEXTURE_WRAP_S,je.CLAMP_TO_EDGE),je.texParameteri(je.TEXTURE_2D,je.TEXTURE_WRAP_T,je.CLAMP_TO_EDGE),je.texParameteri(je.TEXTURE_2D,je.TEXTURE_MIN_FILTER,je.LINEAR),je.texParameteri(je.TEXTURE_2D,je.TEXTURE_MAG_FILTER,je.LINEAR),tt=Re.heatmapFbo=xe.createFramebuffer(Ae.width/4,Ae.height/4,!1,!1),function(ft,yt,Ct,kt){var Bt,At;const $t=ft.gl,Kt=(Bt=ft.HALF_FLOAT)!==null&&Bt!==void 0?Bt:$t.UNSIGNED_BYTE,Yt=(At=ft.RGBA16F)!==null&&At!==void 0?At:$t.RGBA;$t.texImage2D($t.TEXTURE_2D,0,Yt,yt.width/4,yt.height/4,0,$t.RGBA,Kt,null),kt.colorAttachment.set(Ct)}(xe,Ae,lt,tt)}})(j,V,g),j.clear({color:i.aN.transparent});for(let xe=0;xe<z.length;xe++){const Ae=z[xe];if(d.hasRenderableParent(Ae))continue;const Re=d.getTile(Ae),je=Re.getBucket(g);if(!je)continue;const tt=je.programConfigurations.get(g.id),lt=V.useProgram("heatmap",tt),{zoom:ft}=V.transform;lt.draw(j,$.TRIANGLES,Qi.disabled,ie,de,Xa.disabled,Bn(Ae.posMatrix,Re,ft,g.paint.get("heatmap-intensity")),null,g.id,je.layoutVertexBuffer,je.indexBuffer,je.segments,g.paint,V.transform.zoom,tt)}j.viewport.set([0,0,V.width,V.height])}else V.renderPass==="translucent"&&(V.context.setColorMode(V.colorModeForRenderPass()),function(j,$){const ie=j.context,de=ie.gl,xe=$.heatmapFbo;if(!xe)return;ie.activeTexture.set(de.TEXTURE0),de.bindTexture(de.TEXTURE_2D,xe.colorAttachment.get()),ie.activeTexture.set(de.TEXTURE1);let Ae=$.colorRampTexture;Ae||(Ae=$.colorRampTexture=new D(ie,$.colorRamp,de.RGBA)),Ae.bind(de.LINEAR,de.CLAMP_TO_EDGE),j.useProgram("heatmapTexture").draw(ie,de.TRIANGLES,Qi.disabled,Za.disabled,j.colorModeForRenderPass(),Xa.disabled,Kn(j,$,0,1),null,$.id,j.viewportBuffer,j.quadTriangleIndexBuffer,j.viewportSegments,$.paint,j.transform.zoom)}(V,g))}function Qu(V,d,g,z,j){if(!g||!z||!z.imageAtlas)return;const $=z.imageAtlas.patternPositions;let ie=$[g.to.toString()],de=$[g.from.toString()];if(!ie&&de&&(ie=de),!de&&ie&&(de=ie),!ie||!de){const xe=j.getPaintProperty(d);ie=$[xe],de=$[xe]}ie&&de&&V.setConstantPatternPositions(ie,de)}function ph(V,d,g,z,j,$,ie){const de=V.context.gl,xe="fill-pattern",Ae=g.paint.get(xe),Re=Ae&&Ae.constantOr(1),je=g.getCrossfadeParameters();let tt,lt,ft,yt,Ct;ie?(lt=Re&&!g.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",tt=de.LINES):(lt=Re?"fillPattern":"fill",tt=de.TRIANGLES);const kt=Ae.constantOr(null);for(const Bt of z){const At=d.getTile(Bt);if(Re&&!At.patternsLoaded())continue;const $t=At.getBucket(g);if(!$t)continue;const Kt=$t.programConfigurations.get(g.id),Yt=V.useProgram(lt,Kt),pn=V.style.map.terrain&&V.style.map.terrain.getTerrainData(Bt);Re&&(V.context.activeTexture.set(de.TEXTURE0),At.imageAtlasTexture.bind(de.LINEAR,de.CLAMP_TO_EDGE),Kt.updatePaintBuffers(je)),Qu(Kt,xe,kt,At,g);const Tn=pn?Bt:null,Vn=Tn?Tn.posMatrix:Bt.posMatrix,jn=V.translatePosMatrix(Vn,At,g.paint.get("fill-translate"),g.paint.get("fill-translate-anchor"));if(ie){yt=$t.indexBuffer2,Ct=$t.segments2;const $n=[de.drawingBufferWidth,de.drawingBufferHeight];ft=lt==="fillOutlinePattern"&&Re?vn(jn,V,je,At,$n):ti(jn,$n)}else yt=$t.indexBuffer,Ct=$t.segments,ft=Re?Ur(jn,V,je,At):wr(jn);Yt.draw(V.context,tt,j,V.stencilModeForClipping(Bt),$,Xa.disabled,ft,pn,g.id,$t.layoutVertexBuffer,yt,Ct,g.paint,V.transform.zoom,Kt)}}function Kc(V,d,g,z,j,$,ie){const de=V.context,xe=de.gl,Ae="fill-extrusion-pattern",Re=g.paint.get(Ae),je=Re.constantOr(1),tt=g.getCrossfadeParameters(),lt=g.paint.get("fill-extrusion-opacity"),ft=Re.constantOr(null);for(const yt of z){const Ct=d.getTile(yt),kt=Ct.getBucket(g);if(!kt)continue;const Bt=V.style.map.terrain&&V.style.map.terrain.getTerrainData(yt),At=kt.programConfigurations.get(g.id),$t=V.useProgram(je?"fillExtrusionPattern":"fillExtrusion",At);je&&(V.context.activeTexture.set(xe.TEXTURE0),Ct.imageAtlasTexture.bind(xe.LINEAR,xe.CLAMP_TO_EDGE),At.updatePaintBuffers(tt)),Qu(At,Ae,ft,Ct,g);const Kt=V.translatePosMatrix(yt.posMatrix,Ct,g.paint.get("fill-extrusion-translate"),g.paint.get("fill-extrusion-translate-anchor")),Yt=g.paint.get("fill-extrusion-vertical-gradient"),pn=je?Sr(Kt,V,Yt,lt,yt,tt,Ct):sr(Kt,V,Yt,lt);$t.draw(de,de.gl.TRIANGLES,j,$,ie,Xa.backCCW,pn,Bt,g.id,kt.layoutVertexBuffer,kt.indexBuffer,kt.segments,g.paint,V.transform.zoom,At,V.style.map.terrain&&kt.centroidVertexBuffer)}}function Jc(V,d,g,z,j,$,ie){const de=V.context,xe=de.gl,Ae=g.fbo;if(!Ae)return;const Re=V.useProgram("hillshade"),je=V.style.map.terrain&&V.style.map.terrain.getTerrainData(d);de.activeTexture.set(xe.TEXTURE0),xe.bindTexture(xe.TEXTURE_2D,Ae.colorAttachment.get());const tt=je?d:null;Re.draw(de,xe.TRIANGLES,j,$,ie,Xa.disabled,Hn(V,g,z,tt),je,z.id,V.rasterBoundsBuffer,V.quadTriangleIndexBuffer,V.rasterBoundsSegments)}function bf(V,d,g,z,j,$){const ie=V.context,de=ie.gl,xe=d.dem;if(xe&&xe.data){const Ae=xe.dim,Re=xe.stride,je=xe.getPixels();if(ie.activeTexture.set(de.TEXTURE1),ie.pixelStoreUnpackPremultiplyAlpha.set(!1),d.demTexture=d.demTexture||V.getTileTexture(Re),d.demTexture){const lt=d.demTexture;lt.update(je,{premultiply:!1}),lt.bind(de.NEAREST,de.CLAMP_TO_EDGE)}else d.demTexture=new D(ie,je,de.RGBA,{premultiply:!1}),d.demTexture.bind(de.NEAREST,de.CLAMP_TO_EDGE);ie.activeTexture.set(de.TEXTURE0);let tt=d.fbo;if(!tt){const lt=new D(ie,{width:Ae,height:Ae,data:null},de.RGBA);lt.bind(de.LINEAR,de.CLAMP_TO_EDGE),tt=d.fbo=ie.createFramebuffer(Ae,Ae,!0,!1),tt.colorAttachment.set(lt.texture)}ie.bindFramebuffer.set(tt.framebuffer),ie.viewport.set([0,0,Ae,Ae]),V.useProgram("hillshadePrepare").draw(ie,de.TRIANGLES,z,j,$,Xa.disabled,Dn(d.tileID,xe),null,g.id,V.rasterBoundsBuffer,V.quadTriangleIndexBuffer,V.rasterBoundsSegments),d.needsHillshadePrepare=!1}}function jl(V,d,g,z,j,$){const ie=z.paint.get("raster-fade-duration");if(!$&&ie>0){const de=v.now(),xe=(de-V.timeAdded)/ie,Ae=d?(de-d.timeAdded)/ie:-1,Re=g.getSource(),je=j.coveringZoomLevel({tileSize:Re.tileSize,roundZoom:Re.roundZoom}),tt=!d||Math.abs(d.tileID.overscaledZ-je)>Math.abs(V.tileID.overscaledZ-je),lt=tt&&V.refreshedUponExpiration?1:i.ad(tt?xe:1-Ae,0,1);return V.refreshedUponExpiration&&xe>=1&&(V.refreshedUponExpiration=!1),d?{opacity:1,mix:1-lt}:{opacity:lt,mix:0}}return{opacity:1,mix:0}}const pu=new i.aN(1,0,0,1),ec=new i.aN(0,1,0,1),Ul=new i.aN(0,0,1,1),ga=new i.aN(1,0,1,1),Rh=new i.aN(0,1,1,1);function Oh(V){const d=V.transform.padding;mh(V,V.transform.height-(d.top||0),3,pu),mh(V,d.bottom||0,3,ec),Ps(V,d.left||0,3,Ul),Ps(V,V.transform.width-(d.right||0),3,ga);const g=V.transform.centerPoint;(function(z,j,$,ie){Qc(z,j-1,$-10,2,20,ie),Qc(z,j-10,$-1,20,2,ie)})(V,g.x,V.transform.height-g.y,Rh)}function mh(V,d,g,z){Qc(V,0,d+g/2,V.transform.width,g,z)}function Ps(V,d,g,z){Qc(V,d-g/2,0,g,V.transform.height,z)}function Qc(V,d,g,z,j,$){const ie=V.context,de=ie.gl;de.enable(de.SCISSOR_TEST),de.scissor(d*V.pixelRatio,g*V.pixelRatio,z*V.pixelRatio,j*V.pixelRatio),ie.clear({color:$}),de.disable(de.SCISSOR_TEST)}function Hf(V,d,g){const z=V.context,j=z.gl,$=g.posMatrix,ie=V.useProgram("debug"),de=Qi.disabled,xe=Za.disabled,Ae=V.colorModeForRenderPass(),Re="$debug",je=V.style.map.terrain&&V.style.map.terrain.getTerrainData(g);z.activeTexture.set(j.TEXTURE0);const tt=d.getTileByID(g.key).latestRawTileData,lt=tt&&tt.byteLength||0,ft=Math.floor(lt/1024),yt=d.getTile(g).tileSize,Ct=512/Math.min(yt,512)*(g.overscaledZ/V.transform.zoom)*.5;let kt=g.canonical.toString();g.overscaledZ!==g.canonical.z&&(kt+=` => ${g.overscaledZ}`),function(Bt,At){Bt.initDebugOverlayCanvas();const $t=Bt.debugOverlayCanvas,Kt=Bt.context.gl,Yt=Bt.debugOverlayCanvas.getContext("2d");Yt.clearRect(0,0,$t.width,$t.height),Yt.shadowColor="white",Yt.shadowBlur=2,Yt.lineWidth=1.5,Yt.strokeStyle="white",Yt.textBaseline="top",Yt.font="bold 36px Open Sans, sans-serif",Yt.fillText(At,5,5),Yt.strokeText(At,5,5),Bt.debugOverlayTexture.update($t),Bt.debugOverlayTexture.bind(Kt.LINEAR,Kt.CLAMP_TO_EDGE)}(V,`${kt} ${ft}kB`),ie.draw(z,j.TRIANGLES,de,xe,Wo.alphaBlended,Xa.disabled,bn($,i.aN.transparent,Ct),null,Re,V.debugBuffer,V.quadTriangleIndexBuffer,V.debugSegments),ie.draw(z,j.LINE_STRIP,de,xe,Ae,Xa.disabled,bn($,i.aN.red),je,Re,V.debugBuffer,V.tileBorderIndexBuffer,V.debugSegments)}function Dc(V,d,g){const z=V.context,j=z.gl,$=V.colorModeForRenderPass(),ie=new Qi(j.LEQUAL,Qi.ReadWrite,V.depthRangeFor3D),de=V.useProgram("terrain"),xe=d.getTerrainMesh();z.bindFramebuffer.set(null),z.viewport.set([0,0,V.width,V.height]);for(const Ae of g){const Re=V.renderToTexture.getTexture(Ae),je=d.getTerrainData(Ae.tileID);z.activeTexture.set(j.TEXTURE0),j.bindTexture(j.TEXTURE_2D,Re.texture);const tt=V.transform.calculatePosMatrix(Ae.tileID.toUnwrapped()),lt=d.getMeshFrameDelta(V.transform.zoom),ft=V.transform.calculateFogMatrix(Ae.tileID.toUnwrapped()),yt=_n(tt,lt,ft,V.style.sky,V.transform.pitch);de.draw(z,j.TRIANGLES,ie,Za.disabled,$,Xa.backCCW,yt,je,"terrain",xe.vertexBuffer,xe.indexBuffer,xe.segments)}}class Rc{constructor(d,g,z){this.vertexBuffer=d,this.indexBuffer=g,this.segments=z}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class Oc{constructor(d,g){this.context=new Zc(d),this.transform=g,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:i.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=qe.maxUnderzooming+qe.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new ar}resize(d,g,z){if(this.width=Math.floor(d*z),this.height=Math.floor(g*z),this.pixelRatio=z,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const j of this.style._order)this.style._layers[j].resize()}setup(){const d=this.context,g=new i.aX;g.emplaceBack(0,0),g.emplaceBack(i.X,0),g.emplaceBack(0,i.X),g.emplaceBack(i.X,i.X),this.tileExtentBuffer=d.createVertexBuffer(g,gr.members),this.tileExtentSegments=i.a0.simpleSegment(0,0,4,2);const z=new i.aX;z.emplaceBack(0,0),z.emplaceBack(i.X,0),z.emplaceBack(0,i.X),z.emplaceBack(i.X,i.X),this.debugBuffer=d.createVertexBuffer(z,gr.members),this.debugSegments=i.a0.simpleSegment(0,0,4,5);const j=new i.$;j.emplaceBack(0,0,0,0),j.emplaceBack(i.X,0,i.X,0),j.emplaceBack(0,i.X,0,i.X),j.emplaceBack(i.X,i.X,i.X,i.X),this.rasterBoundsBuffer=d.createVertexBuffer(j,Fe.members),this.rasterBoundsSegments=i.a0.simpleSegment(0,0,4,2);const $=new i.aX;$.emplaceBack(0,0),$.emplaceBack(1,0),$.emplaceBack(0,1),$.emplaceBack(1,1),this.viewportBuffer=d.createVertexBuffer($,gr.members),this.viewportSegments=i.a0.simpleSegment(0,0,4,2);const ie=new i.aZ;ie.emplaceBack(0),ie.emplaceBack(1),ie.emplaceBack(3),ie.emplaceBack(2),ie.emplaceBack(0),this.tileBorderIndexBuffer=d.createIndexBuffer(ie);const de=new i.aY;de.emplaceBack(0,1,2),de.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=d.createIndexBuffer(de);const xe=this.context.gl;this.stencilClearMode=new Za({func:xe.ALWAYS,mask:0},0,255,xe.ZERO,xe.ZERO,xe.ZERO)}clearStencil(){const d=this.context,g=d.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const z=i.H();i.aQ(z,0,this.width,this.height,0,0,1),i.K(z,z,[g.drawingBufferWidth,g.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(d,g.TRIANGLES,Qi.disabled,this.stencilClearMode,Wo.disabled,Xa.disabled,Fn(z),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(d,g){if(this.currentStencilSource===d.source||!d.isTileClipped()||!g||!g.length)return;this.currentStencilSource=d.source;const z=this.context,j=z.gl;this.nextStencilID+g.length>256&&this.clearStencil(),z.setColorMode(Wo.disabled),z.setDepthMode(Qi.disabled);const $=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const ie of g){const de=this._tileClippingMaskIDs[ie.key]=this.nextStencilID++,xe=this.style.map.terrain&&this.style.map.terrain.getTerrainData(ie);$.draw(z,j.TRIANGLES,Qi.disabled,new Za({func:j.ALWAYS,mask:0},de,255,j.KEEP,j.KEEP,j.REPLACE),Wo.disabled,Xa.disabled,Fn(ie.posMatrix),xe,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const d=this.nextStencilID++,g=this.context.gl;return new Za({func:g.NOTEQUAL,mask:255},d,255,g.KEEP,g.KEEP,g.REPLACE)}stencilModeForClipping(d){const g=this.context.gl;return new Za({func:g.EQUAL,mask:255},this._tileClippingMaskIDs[d.key],0,g.KEEP,g.KEEP,g.REPLACE)}stencilConfigForOverlap(d){const g=this.context.gl,z=d.sort((ie,de)=>de.overscaledZ-ie.overscaledZ),j=z[z.length-1].overscaledZ,$=z[0].overscaledZ-j+1;if($>1){this.currentStencilSource=void 0,this.nextStencilID+$>256&&this.clearStencil();const ie={};for(let de=0;de<$;de++)ie[de+j]=new Za({func:g.GEQUAL,mask:255},de+this.nextStencilID,255,g.KEEP,g.KEEP,g.REPLACE);return this.nextStencilID+=$,[ie,z]}return[{[j]:Za.disabled},z]}colorModeForRenderPass(){const d=this.context.gl;return this._showOverdrawInspector?new Wo([d.CONSTANT_COLOR,d.ONE],new i.aN(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Wo.unblended:Wo.alphaBlended}depthModeForSublayer(d,g,z){if(!this.opaquePassEnabledForLayer())return Qi.disabled;const j=1-((1+this.currentLayer)*this.numSublayers+d)*this.depthEpsilon;return new Qi(z||this.context.gl.LEQUAL,g,[j,j])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(d,g){var z;this.style=d,this.options=g,this.lineAtlas=d.lineAtlas,this.imageManager=d.imageManager,this.glyphManager=d.glyphManager,this.symbolFadeChange=d.placement.symbolFadeChange(v.now()),this.imageManager.beginFrame();const j=this.style._order,$=this.style.sourceCaches,ie={},de={},xe={};for(const Ae in $){const Re=$[Ae];Re.used&&Re.prepare(this.context),ie[Ae]=Re.getVisibleCoordinates(),de[Ae]=ie[Ae].slice().reverse(),xe[Ae]=Re.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let Ae=0;Ae<j.length;Ae++){const Re=j[Ae];if(this.style._layers[Re].is3D()){this.opaquePassCutoff=Ae;break}}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const Ae of j){const Re=this.style._layers[Ae];if(!Re.hasOffscreenPass()||Re.isHidden(this.transform.zoom))continue;const je=de[Re.source];(Re.type==="custom"||je.length)&&this.renderLayer(this,$[Re.source],Re,je)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:g.showOverdrawInspector?i.aN.black:i.aN.transparent,depth:1}),this.clearStencil(),!((z=this.style.stylesheet)===null||z===void 0)&&z.sky&&function(Ae,Re){const je=Ae.context,tt=je.gl,lt=((Bt,At,$t)=>({u_sky_color:Bt.properties.get("sky-color"),u_horizon_color:Bt.properties.get("horizon-color"),u_horizon:(At.height/2+At.getHorizon())*$t,u_sky_horizon_blend:Bt.properties.get("sky-horizon-blend")*At.height/2*$t}))(Re,Ae.style.map.transform,Ae.pixelRatio),ft=new Qi(tt.LEQUAL,Qi.ReadWrite,[0,1]),yt=Za.disabled,Ct=Ae.colorModeForRenderPass(),kt=Ae.useProgram("sky");if(!Re.mesh){const Bt=new i.aX;Bt.emplaceBack(-1,-1),Bt.emplaceBack(1,-1),Bt.emplaceBack(1,1),Bt.emplaceBack(-1,1);const At=new i.aY;At.emplaceBack(0,1,2),At.emplaceBack(0,2,3),Re.mesh=new Rc(je.createVertexBuffer(Bt,gr.members),je.createIndexBuffer(At),i.a0.simpleSegment(0,0,Bt.length,At.length))}kt.draw(je,tt.TRIANGLES,ft,yt,Ct,Xa.disabled,lt,void 0,"sky",Re.mesh.vertexBuffer,Re.mesh.indexBuffer,Re.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=g.showOverdrawInspector,this.depthRangeFor3D=[0,1-(d._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=j.length-1;this.currentLayer>=0;this.currentLayer--){const Ae=this.style._layers[j[this.currentLayer]],Re=$[Ae.source],je=ie[Ae.source];this._renderTileClippingMasks(Ae,je),this.renderLayer(this,Re,Ae,je)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<j.length;this.currentLayer++){const Ae=this.style._layers[j[this.currentLayer]],Re=$[Ae.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(Ae))continue;const je=(Ae.type==="symbol"?xe:de)[Ae.source];this._renderTileClippingMasks(Ae,ie[Ae.source]),this.renderLayer(this,Re,Ae,je)}if(this.options.showTileBoundaries){const Ae=function(Re,je){let tt=null;const lt=Object.values(Re._layers).flatMap(kt=>kt.source&&!kt.isHidden(je)?[Re.sourceCaches[kt.source]]:[]),ft=lt.filter(kt=>kt.getSource().type==="vector"),yt=lt.filter(kt=>kt.getSource().type!=="vector"),Ct=kt=>{(!tt||tt.getSource().maxzoom<kt.getSource().maxzoom)&&(tt=kt)};return ft.forEach(kt=>Ct(kt)),tt||yt.forEach(kt=>Ct(kt)),tt}(this.style,this.transform.zoom);Ae&&function(Re,je,tt){for(let lt=0;lt<tt.length;lt++)Hf(Re,je,tt[lt])}(this,Ae,Ae.getVisibleCoordinates())}this.options.showPadding&&Oh(this),this.context.setDefault()}maybeDrawDepthAndCoords(d){if(!this.style||!this.style.map||!this.style.map.terrain)return;const g=this.terrainFacilitator.matrix,z=this.transform.modelViewProjectionMatrix;let j=this.terrainFacilitator.dirty;j||(j=d?!i.a_(g,z):!i.a$(g,z)),j||(j=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),j&&(i.b0(g,z),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function($,ie){const de=$.context,xe=de.gl,Ae=Wo.unblended,Re=new Qi(xe.LEQUAL,Qi.ReadWrite,[0,1]),je=ie.getTerrainMesh(),tt=ie.sourceCache.getRenderableTiles(),lt=$.useProgram("terrainDepth");de.bindFramebuffer.set(ie.getFramebuffer("depth").framebuffer),de.viewport.set([0,0,$.width/devicePixelRatio,$.height/devicePixelRatio]),de.clear({color:i.aN.transparent,depth:1});for(const ft of tt){const yt=ie.getTerrainData(ft.tileID),Ct={u_matrix:$.transform.calculatePosMatrix(ft.tileID.toUnwrapped()),u_ele_delta:ie.getMeshFrameDelta($.transform.zoom)};lt.draw(de,xe.TRIANGLES,Re,Za.disabled,Ae,Xa.backCCW,Ct,yt,"terrain",je.vertexBuffer,je.indexBuffer,je.segments)}de.bindFramebuffer.set(null),de.viewport.set([0,0,$.width,$.height])}(this,this.style.map.terrain),function($,ie){const de=$.context,xe=de.gl,Ae=Wo.unblended,Re=new Qi(xe.LEQUAL,Qi.ReadWrite,[0,1]),je=ie.getTerrainMesh(),tt=ie.getCoordsTexture(),lt=ie.sourceCache.getRenderableTiles(),ft=$.useProgram("terrainCoords");de.bindFramebuffer.set(ie.getFramebuffer("coords").framebuffer),de.viewport.set([0,0,$.width/devicePixelRatio,$.height/devicePixelRatio]),de.clear({color:i.aN.transparent,depth:1}),ie.coordsIndex=[];for(const yt of lt){const Ct=ie.getTerrainData(yt.tileID);de.activeTexture.set(xe.TEXTURE0),xe.bindTexture(xe.TEXTURE_2D,tt.texture);const kt={u_matrix:$.transform.calculatePosMatrix(yt.tileID.toUnwrapped()),u_terrain_coords_id:(255-ie.coordsIndex.length)/255,u_texture:0,u_ele_delta:ie.getMeshFrameDelta($.transform.zoom)};ft.draw(de,xe.TRIANGLES,Re,Za.disabled,Ae,Xa.backCCW,kt,Ct,"terrain",je.vertexBuffer,je.indexBuffer,je.segments),ie.coordsIndex.push(yt.tileID.key)}de.bindFramebuffer.set(null),de.viewport.set([0,0,$.width,$.height])}(this,this.style.map.terrain))}renderLayer(d,g,z,j){if(!z.isHidden(this.transform.zoom)&&(z.type==="background"||z.type==="custom"||(j||[]).length))switch(this.id=z.id,z.type){case"symbol":Ku(d,g,z,j,this.style.placement.variableOffsets);break;case"circle":(function($,ie,de,xe){if($.renderPass!=="translucent")return;const Ae=de.paint.get("circle-opacity"),Re=de.paint.get("circle-stroke-width"),je=de.paint.get("circle-stroke-opacity"),tt=!de.layout.get("circle-sort-key").isConstant();if(Ae.constantOr(1)===0&&(Re.constantOr(1)===0||je.constantOr(1)===0))return;const lt=$.context,ft=lt.gl,yt=$.depthModeForSublayer(0,Qi.ReadOnly),Ct=Za.disabled,kt=$.colorModeForRenderPass(),Bt=[];for(let At=0;At<xe.length;At++){const $t=xe[At],Kt=ie.getTile($t),Yt=Kt.getBucket(de);if(!Yt)continue;const pn=Yt.programConfigurations.get(de.id),Tn=$.useProgram("circle",pn),Vn=Yt.layoutVertexBuffer,jn=Yt.indexBuffer,$n=$.style.map.terrain&&$.style.map.terrain.getTerrainData($t),er={programConfiguration:pn,program:Tn,layoutVertexBuffer:Vn,indexBuffer:jn,uniformValues:Gn($,$t,Kt,de),terrainData:$n};if(tt){const Tr=Yt.segments.get();for(const rr of Tr)Bt.push({segments:new i.a0([rr]),sortKey:rr.sortKey,state:er})}else Bt.push({segments:Yt.segments,sortKey:0,state:er})}tt&&Bt.sort((At,$t)=>At.sortKey-$t.sortKey);for(const At of Bt){const{programConfiguration:$t,program:Kt,layoutVertexBuffer:Yt,indexBuffer:pn,uniformValues:Tn,terrainData:Vn}=At.state,jn=At.segments;Kt.draw(lt,ft.TRIANGLES,yt,Ct,kt,Xa.disabled,Tn,Vn,de.id,Yt,pn,jn,de.paint,$.transform.zoom,$t)}})(d,g,z,j);break;case"heatmap":Ju(d,g,z,j);break;case"line":(function($,ie,de,xe){if($.renderPass!=="translucent")return;const Ae=de.paint.get("line-opacity"),Re=de.paint.get("line-width");if(Ae.constantOr(1)===0||Re.constantOr(1)===0)return;const je=$.depthModeForSublayer(0,Qi.ReadOnly),tt=$.colorModeForRenderPass(),lt=de.paint.get("line-dasharray"),ft=de.paint.get("line-pattern"),yt=ft.constantOr(1),Ct=de.paint.get("line-gradient"),kt=de.getCrossfadeParameters(),Bt=yt?"linePattern":lt?"lineSDF":Ct?"lineGradient":"line",At=$.context,$t=At.gl;let Kt=!0;for(const Yt of xe){const pn=ie.getTile(Yt);if(yt&&!pn.patternsLoaded())continue;const Tn=pn.getBucket(de);if(!Tn)continue;const Vn=Tn.programConfigurations.get(de.id),jn=$.context.program.get(),$n=$.useProgram(Bt,Vn),er=Kt||$n.program!==jn,Tr=$.style.map.terrain&&$.style.map.terrain.getTerrainData(Yt),rr=ft.constantOr(null);if(rr&&pn.imageAtlas){const Pr=pn.imageAtlas,br=Pr.patternPositions[rr.to.toString()],Nr=Pr.patternPositions[rr.from.toString()];br&&Nr&&Vn.setConstantPatternPositions(br,Nr)}const Ar=Tr?Yt:null,ur=yt?tr($,pn,de,kt,Ar):lt?dr($,pn,de,lt,kt,Ar):Ct?En($,pn,de,Tn.lineClipsArray.length,Ar):cn($,pn,de,Ar);if(yt)At.activeTexture.set($t.TEXTURE0),pn.imageAtlasTexture.bind($t.LINEAR,$t.CLAMP_TO_EDGE),Vn.updatePaintBuffers(kt);else if(lt&&(er||$.lineAtlas.dirty))At.activeTexture.set($t.TEXTURE0),$.lineAtlas.bind(At);else if(Ct){const Pr=Tn.gradients[de.id];let br=Pr.texture;if(de.gradientVersion!==Pr.version){let Nr=256;if(de.stepInterpolant){const li=ie.getSource().maxzoom,Fr=Yt.canonical.z===li?Math.ceil(1<<$.transform.maxZoom-Yt.canonical.z):1,ri=Tn.maxLineLength/i.X*1024*Fr;Nr=i.ad(i.aV(ri),256,At.maxTextureSize)}Pr.gradient=i.aW({expression:de.gradientExpression(),evaluationKey:"lineProgress",resolution:Nr,image:Pr.gradient||void 0,clips:Tn.lineClipsArray}),Pr.texture?Pr.texture.update(Pr.gradient):Pr.texture=new D(At,Pr.gradient,$t.RGBA),Pr.version=de.gradientVersion,br=Pr.texture}At.activeTexture.set($t.TEXTURE0),br.bind(de.stepInterpolant?$t.NEAREST:$t.LINEAR,$t.CLAMP_TO_EDGE)}$n.draw(At,$t.TRIANGLES,je,$.stencilModeForClipping(Yt),tt,Xa.disabled,ur,Tr,de.id,Tn.layoutVertexBuffer,Tn.indexBuffer,Tn.segments,de.paint,$.transform.zoom,Vn,Tn.layoutVertexBuffer2),Kt=!1}})(d,g,z,j);break;case"fill":(function($,ie,de,xe){const Ae=de.paint.get("fill-color"),Re=de.paint.get("fill-opacity");if(Re.constantOr(1)===0)return;const je=$.colorModeForRenderPass(),tt=de.paint.get("fill-pattern"),lt=$.opaquePassEnabledForLayer()&&!tt.constantOr(1)&&Ae.constantOr(i.aN.transparent).a===1&&Re.constantOr(0)===1?"opaque":"translucent";if($.renderPass===lt){const ft=$.depthModeForSublayer(1,$.renderPass==="opaque"?Qi.ReadWrite:Qi.ReadOnly);ph($,ie,de,xe,ft,je,!1)}if($.renderPass==="translucent"&&de.paint.get("fill-antialias")){const ft=$.depthModeForSublayer(de.getPaintProperty("fill-outline-color")?2:0,Qi.ReadOnly);ph($,ie,de,xe,ft,je,!0)}})(d,g,z,j);break;case"fill-extrusion":(function($,ie,de,xe){const Ae=de.paint.get("fill-extrusion-opacity");if(Ae!==0&&$.renderPass==="translucent"){const Re=new Qi($.context.gl.LEQUAL,Qi.ReadWrite,$.depthRangeFor3D);if(Ae!==1||de.paint.get("fill-extrusion-pattern").constantOr(1))Kc($,ie,de,xe,Re,Za.disabled,Wo.disabled),Kc($,ie,de,xe,Re,$.stencilModeFor3D(),$.colorModeForRenderPass());else{const je=$.colorModeForRenderPass();Kc($,ie,de,xe,Re,Za.disabled,je)}}})(d,g,z,j);break;case"hillshade":(function($,ie,de,xe){if($.renderPass!=="offscreen"&&$.renderPass!=="translucent")return;const Ae=$.context,Re=$.depthModeForSublayer(0,Qi.ReadOnly),je=$.colorModeForRenderPass(),[tt,lt]=$.renderPass==="translucent"?$.stencilConfigForOverlap(xe):[{},xe];for(const ft of lt){const yt=ie.getTile(ft);yt.needsHillshadePrepare!==void 0&&yt.needsHillshadePrepare&&$.renderPass==="offscreen"?bf($,yt,de,Re,Za.disabled,je):$.renderPass==="translucent"&&Jc($,ft,yt,de,Re,tt[ft.overscaledZ],je)}Ae.viewport.set([0,0,$.width,$.height])})(d,g,z,j);break;case"raster":(function($,ie,de,xe){if($.renderPass!=="translucent"||de.paint.get("raster-opacity")===0||!xe.length)return;const Ae=$.context,Re=Ae.gl,je=ie.getSource(),tt=$.useProgram("raster"),lt=$.colorModeForRenderPass(),[ft,yt]=je instanceof Le?[{},xe]:$.stencilConfigForOverlap(xe),Ct=yt[yt.length-1].overscaledZ,kt=!$.options.moving;for(const Bt of yt){const At=$.depthModeForSublayer(Bt.overscaledZ-Ct,de.paint.get("raster-opacity")===1?Qi.ReadWrite:Qi.ReadOnly,Re.LESS),$t=ie.getTile(Bt);$t.registerFadeDuration(de.paint.get("raster-fade-duration"));const Kt=ie.findLoadedParent(Bt,0),Yt=ie.findLoadedSibling(Bt),pn=jl($t,Kt||Yt||null,ie,de,$.transform,$.style.map.terrain);let Tn,Vn;const jn=de.paint.get("raster-resampling")==="nearest"?Re.NEAREST:Re.LINEAR;Ae.activeTexture.set(Re.TEXTURE0),$t.texture.bind(jn,Re.CLAMP_TO_EDGE,Re.LINEAR_MIPMAP_NEAREST),Ae.activeTexture.set(Re.TEXTURE1),Kt?(Kt.texture.bind(jn,Re.CLAMP_TO_EDGE,Re.LINEAR_MIPMAP_NEAREST),Tn=Math.pow(2,Kt.tileID.overscaledZ-$t.tileID.overscaledZ),Vn=[$t.tileID.canonical.x*Tn%1,$t.tileID.canonical.y*Tn%1]):$t.texture.bind(jn,Re.CLAMP_TO_EDGE,Re.LINEAR_MIPMAP_NEAREST),$t.texture.useMipmap&&Ae.extTextureFilterAnisotropic&&$.transform.pitch>20&&Re.texParameterf(Re.TEXTURE_2D,Ae.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,Ae.extTextureFilterAnisotropicMax);const $n=$.style.map.terrain&&$.style.map.terrain.getTerrainData(Bt),er=$n?Bt:null,Tr=er?er.posMatrix:$.transform.calculatePosMatrix(Bt.toUnwrapped(),kt),rr=Or(Tr,Vn||[0,0],Tn||1,pn,de);je instanceof Le?tt.draw(Ae,Re.TRIANGLES,At,Za.disabled,lt,Xa.disabled,rr,$n,de.id,je.boundsBuffer,$.quadTriangleIndexBuffer,je.boundsSegments):tt.draw(Ae,Re.TRIANGLES,At,ft[Bt.overscaledZ],lt,Xa.disabled,rr,$n,de.id,$.rasterBoundsBuffer,$.quadTriangleIndexBuffer,$.rasterBoundsSegments)}})(d,g,z,j);break;case"background":(function($,ie,de,xe){const Ae=de.paint.get("background-color"),Re=de.paint.get("background-opacity");if(Re===0)return;const je=$.context,tt=je.gl,lt=$.transform,ft=lt.tileSize,yt=de.paint.get("background-pattern");if($.isPatternMissing(yt))return;const Ct=!yt&&Ae.a===1&&Re===1&&$.opaquePassEnabledForLayer()?"opaque":"translucent";if($.renderPass!==Ct)return;const kt=Za.disabled,Bt=$.depthModeForSublayer(0,Ct==="opaque"?Qi.ReadWrite:Qi.ReadOnly),At=$.colorModeForRenderPass(),$t=$.useProgram(yt?"backgroundPattern":"background"),Kt=xe||lt.coveringTiles({tileSize:ft,terrain:$.style.map.terrain});yt&&(je.activeTexture.set(tt.TEXTURE0),$.imageManager.bind($.context));const Yt=de.getCrossfadeParameters();for(const pn of Kt){const Tn=xe?pn.posMatrix:$.transform.calculatePosMatrix(pn.toUnwrapped()),Vn=yt?fi(Tn,Re,$,yt,{tileID:pn,tileSize:ft},Yt):$r(Tn,Re,Ae),jn=$.style.map.terrain&&$.style.map.terrain.getTerrainData(pn);$t.draw(je,tt.TRIANGLES,Bt,kt,At,Xa.disabled,Vn,jn,de.id,$.tileExtentBuffer,$.quadTriangleIndexBuffer,$.tileExtentSegments)}})(d,0,z,j);break;case"custom":(function($,ie,de){const xe=$.context,Ae=de.implementation;if($.renderPass==="offscreen"){const Re=Ae.prerender;Re&&($.setCustomLayerDefaults(),xe.setColorMode($.colorModeForRenderPass()),Re.call(Ae,xe.gl,$.transform.customLayerMatrix()),xe.setDirty(),$.setBaseState())}else if($.renderPass==="translucent"){$.setCustomLayerDefaults(),xe.setColorMode($.colorModeForRenderPass()),xe.setStencilMode(Za.disabled);const Re=Ae.renderingMode==="3d"?new Qi($.context.gl.LEQUAL,Qi.ReadWrite,$.depthRangeFor3D):$.depthModeForSublayer(0,Qi.ReadOnly);xe.setDepthMode(Re),Ae.render(xe.gl,$.transform.customLayerMatrix(),{farZ:$.transform.farZ,nearZ:$.transform.nearZ,fov:$.transform._fov,modelViewProjectionMatrix:$.transform.modelViewProjectionMatrix,projectionMatrix:$.transform.projectionMatrix}),xe.setDirty(),$.setBaseState(),xe.bindFramebuffer.set(null)}})(d,0,z)}}translatePosMatrix(d,g,z,j,$){if(!z[0]&&!z[1])return d;const ie=$?j==="map"?this.transform.angle:0:j==="viewport"?-this.transform.angle:0;if(ie){const Ae=Math.sin(ie),Re=Math.cos(ie);z=[z[0]*Re-z[1]*Ae,z[0]*Ae+z[1]*Re]}const de=[$?z[0]:Tt(g,z[0],this.transform.zoom),$?z[1]:Tt(g,z[1],this.transform.zoom),0],xe=new Float32Array(16);return i.J(xe,d,de),xe}saveTileTexture(d){const g=this._tileTextures[d.size[0]];g?g.push(d):this._tileTextures[d.size[0]]=[d]}getTileTexture(d){const g=this._tileTextures[d];return g&&g.length>0?g.pop():null}isPatternMissing(d){if(!d)return!1;if(!d.from||!d.to)return!0;const g=this.imageManager.getPattern(d.from.toString()),z=this.imageManager.getPattern(d.to.toString());return!g||!z}useProgram(d,g){this.cache=this.cache||{};const z=d+(g?g.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[z]||(this.cache[z]=new or(this.context,Ir[d],g,Qr[d],this._showOverdrawInspector,this.style.map.terrain)),this.cache[z]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const d=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(d.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;const d=this.context.gl;this.debugOverlayTexture=new D(this.context,this.debugOverlayCanvas,d.RGBA)}}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:d,drawingBufferHeight:g}=this.context.gl;return this.width!==d||this.height!==g}}class mu{constructor(d,g){this.points=d,this.planes=g}static fromInvProjectionMatrix(d,g,z){const j=Math.pow(2,z),$=[[-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(de=>{const xe=1/(de=i.ag([],de,d))[3]/g*j;return i.b1(de,de,[xe,xe,1/de[3],xe])}),ie=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(de=>{const xe=function(tt,lt){var ft=lt[0],yt=lt[1],Ct=lt[2],kt=ft*ft+yt*yt+Ct*Ct;return kt>0&&(kt=1/Math.sqrt(kt)),tt[0]=lt[0]*kt,tt[1]=lt[1]*kt,tt[2]=lt[2]*kt,tt}([],function(tt,lt,ft){var yt=lt[0],Ct=lt[1],kt=lt[2],Bt=ft[0],At=ft[1],$t=ft[2];return tt[0]=Ct*$t-kt*At,tt[1]=kt*Bt-yt*$t,tt[2]=yt*At-Ct*Bt,tt}([],P([],$[de[0]],$[de[1]]),P([],$[de[2]],$[de[1]]))),Ae=(Re=xe,je=$[de[1]],-(Re[0]*je[0]+Re[1]*je[1]+Re[2]*je[2]));var Re,je;return xe.concat(Ae)});return new mu($,ie)}}class Hl{constructor(d,g){this.min=d,this.max=g,this.center=function(z,j,$){return z[0]=j[0]*$,z[1]=j[1]*$,z[2]=j[2]*$,z}([],function(z,j,$){return z[0]=j[0]+$[0],z[1]=j[1]+$[1],z[2]=j[2]+$[2],z}([],this.min,this.max),.5)}quadrant(d){const g=[d%2==0,d<2],z=A(this.min),j=A(this.max);for(let $=0;$<g.length;$++)z[$]=g[$]?this.min[$]:this.center[$],j[$]=g[$]?this.center[$]:this.max[$];return j[2]=this.max[2],new Hl(z,j)}distanceX(d){return Math.max(Math.min(this.max[0],d[0]),this.min[0])-d[0]}distanceY(d){return Math.max(Math.min(this.max[1],d[1]),this.min[1])-d[1]}intersects(d){const g=[[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],1],[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]];let z=!0;for(let j=0;j<d.planes.length;j++){const $=d.planes[j];let ie=0;for(let de=0;de<g.length;de++)i.b2($,g[de])>=0&&ie++;if(ie===0)return 0;ie!==g.length&&(z=!1)}if(z)return 2;for(let j=0;j<3;j++){let $=Number.MAX_VALUE,ie=-Number.MAX_VALUE;for(let de=0;de<d.points.length;de++){const xe=d.points[de][j]-this.min[j];$=Math.min($,xe),ie=Math.max(ie,xe)}if(ie<0||$>this.max[j]-this.min[j])return 0}return 1}}class tc{constructor(d=0,g=0,z=0,j=0){if(isNaN(d)||d<0||isNaN(g)||g<0||isNaN(z)||z<0||isNaN(j)||j<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=d,this.bottom=g,this.left=z,this.right=j}interpolate(d,g,z){return g.top!=null&&d.top!=null&&(this.top=i.z.number(d.top,g.top,z)),g.bottom!=null&&d.bottom!=null&&(this.bottom=i.z.number(d.bottom,g.bottom,z)),g.left!=null&&d.left!=null&&(this.left=i.z.number(d.left,g.left,z)),g.right!=null&&d.right!=null&&(this.right=i.z.number(d.right,g.right,z)),this}getCenter(d,g){const z=i.ad((this.left+d-this.right)/2,0,d),j=i.ad((this.top+g-this.bottom)/2,0,g);return new i.P(z,j)}equals(d){return this.top===d.top&&this.bottom===d.bottom&&this.left===d.left&&this.right===d.right}clone(){return new tc(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const eh=85.051129;class Ia{constructor(d,g,z,j,$){this.tileSize=512,this._renderWorldCopies=$===void 0||!!$,this._minZoom=d||0,this._maxZoom=g||22,this._minPitch=z??0,this._maxPitch=j??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new i.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new tc,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const d=new Ia(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return d.apply(this),d}apply(d){this.tileSize=d.tileSize,this.latRange=d.latRange,this.width=d.width,this.height=d.height,this._center=d._center,this._elevation=d._elevation,this.minElevationForCurrentTile=d.minElevationForCurrentTile,this.zoom=d.zoom,this.angle=d.angle,this._fov=d._fov,this._pitch=d._pitch,this._unmodified=d._unmodified,this._edgeInsets=d._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(d){this._minZoom!==d&&(this._minZoom=d,this.zoom=Math.max(this.zoom,d))}get maxZoom(){return this._maxZoom}set maxZoom(d){this._maxZoom!==d&&(this._maxZoom=d,this.zoom=Math.min(this.zoom,d))}get minPitch(){return this._minPitch}set minPitch(d){this._minPitch!==d&&(this._minPitch=d,this.pitch=Math.max(this.pitch,d))}get maxPitch(){return this._maxPitch}set maxPitch(d){this._maxPitch!==d&&(this._maxPitch=d,this.pitch=Math.min(this.pitch,d))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(d){d===void 0?d=!0:d===null&&(d=!1),this._renderWorldCopies=d}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new i.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(d){const g=-i.b3(d,-180,180)*Math.PI/180;this.angle!==g&&(this._unmodified=!1,this.angle=g,this._calcMatrices(),this.rotationMatrix=function(){var z=new i.A(4);return i.A!=Float32Array&&(z[1]=0,z[2]=0),z[0]=1,z[3]=1,z}(),function(z,j,$){var ie=j[0],de=j[1],xe=j[2],Ae=j[3],Re=Math.sin($),je=Math.cos($);z[0]=ie*je+xe*Re,z[1]=de*je+Ae*Re,z[2]=ie*-Re+xe*je,z[3]=de*-Re+Ae*je}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(d){const g=i.ad(d,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==g&&(this._unmodified=!1,this._pitch=g,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(d){d=Math.max(.01,Math.min(60,d)),this._fov!==d&&(this._unmodified=!1,this._fov=d/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(d){const g=Math.min(Math.max(d,this.minZoom),this.maxZoom);this._zoom!==g&&(this._unmodified=!1,this._zoom=g,this.tileZoom=Math.max(0,Math.floor(g)),this.scale=this.zoomScale(g),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(d){d.lat===this._center.lat&&d.lng===this._center.lng||(this._unmodified=!1,this._center=d,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(d){d!==this._elevation&&(this._elevation=d,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(d){this._edgeInsets.equals(d)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,d,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(d){return this._edgeInsets.equals(d)}interpolatePadding(d,g,z){this._unmodified=!1,this._edgeInsets.interpolate(d,g,z),this._constrain(),this._calcMatrices()}coveringZoomLevel(d){const g=(d.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/d.tileSize));return Math.max(0,g)}getVisibleUnwrappedCoordinates(d){const g=[new i.b4(0,d)];if(this._renderWorldCopies){const z=this.pointCoordinate(new i.P(0,0)),j=this.pointCoordinate(new i.P(this.width,0)),$=this.pointCoordinate(new i.P(this.width,this.height)),ie=this.pointCoordinate(new i.P(0,this.height)),de=Math.floor(Math.min(z.x,j.x,$.x,ie.x)),xe=Math.floor(Math.max(z.x,j.x,$.x,ie.x)),Ae=1;for(let Re=de-Ae;Re<=xe+Ae;Re++)Re!==0&&g.push(new i.b4(Re,d))}return g}coveringTiles(d){var g,z;let j=this.coveringZoomLevel(d);const $=j;if(d.minzoom!==void 0&&j<d.minzoom)return[];d.maxzoom!==void 0&&j>d.maxzoom&&(j=d.maxzoom);const ie=this.pointCoordinate(this.getCameraPoint()),de=i.Z.fromLngLat(this.center),xe=Math.pow(2,j),Ae=[xe*ie.x,xe*ie.y,0],Re=[xe*de.x,xe*de.y,0],je=mu.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,j);let tt=d.minzoom||0;!d.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(tt=j);const lt=d.terrain?2/Math.min(this.tileSize,d.tileSize)*this.tileSize:3,ft=At=>({aabb:new Hl([At*xe,0,0],[(At+1)*xe,xe,0]),zoom:0,x:0,y:0,wrap:At,fullyVisible:!1}),yt=[],Ct=[],kt=j,Bt=d.reparseOverscaled?$:j;if(this._renderWorldCopies)for(let At=1;At<=3;At++)yt.push(ft(-At)),yt.push(ft(At));for(yt.push(ft(0));yt.length>0;){const At=yt.pop(),$t=At.x,Kt=At.y;let Yt=At.fullyVisible;if(!Yt){const er=At.aabb.intersects(je);if(er===0)continue;Yt=er===2}const pn=d.terrain?Ae:Re,Tn=At.aabb.distanceX(pn),Vn=At.aabb.distanceY(pn),jn=Math.max(Math.abs(Tn),Math.abs(Vn)),$n=lt+(1<<kt-At.zoom)-2;if(At.zoom===kt||jn>$n&&At.zoom>=tt){const er=kt-At.zoom,Tr=Ae[0]-.5-($t<<er),rr=Ae[1]-.5-(Kt<<er);Ct.push({tileID:new i.S(At.zoom===kt?Bt:At.zoom,At.wrap,At.zoom,$t,Kt),distanceSq:M([Re[0]-.5-$t,Re[1]-.5-Kt]),tileDistanceToCamera:Math.sqrt(Tr*Tr+rr*rr)})}else for(let er=0;er<4;er++){const Tr=($t<<1)+er%2,rr=(Kt<<1)+(er>>1),Ar=At.zoom+1;let ur=At.aabb.quadrant(er);if(d.terrain){const Pr=new i.S(Ar,At.wrap,Ar,Tr,rr),br=d.terrain.getMinMaxElevation(Pr),Nr=(g=br.minElevation)!==null&&g!==void 0?g:this.elevation,li=(z=br.maxElevation)!==null&&z!==void 0?z:this.elevation;ur=new Hl([ur.min[0],ur.min[1],Nr],[ur.max[0],ur.max[1],li])}yt.push({aabb:ur,zoom:Ar,x:Tr,y:rr,wrap:At.wrap,fullyVisible:Yt})}}return Ct.sort((At,$t)=>At.distanceSq-$t.distanceSq).map(At=>At.tileID)}resize(d,g){this.width=d,this.height=g,this.pixelsToGLUnits=[2/d,-2/g],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(d){return Math.pow(2,d)}scaleZoom(d){return Math.log(d)/Math.LN2}project(d){const g=i.ad(d.lat,-85.051129,eh);return new i.P(i.O(d.lng)*this.worldSize,i.Q(g)*this.worldSize)}unproject(d){return new i.Z(d.x/this.worldSize,d.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(d){const g=this.elevation,z=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,j=this.pointLocation(this.centerPoint,d),$=d.getElevationForLngLatZoom(j,this.tileZoom);if(!(this.elevation-$))return;const ie=z+g-$,de=Math.cos(this._pitch)*this.cameraToCenterDistance/ie/i.b5(1,j.lat)/this.tileSize,xe=this.scaleZoom(de);this._elevation=$,this._center=j,this.zoom=xe}setLocationAtPoint(d,g){const z=this.pointCoordinate(g),j=this.pointCoordinate(this.centerPoint),$=this.locationCoordinate(d),ie=new i.Z($.x-(z.x-j.x),$.y-(z.y-j.y));this.center=this.coordinateLocation(ie),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(d,g){return g?this.coordinatePoint(this.locationCoordinate(d),g.getElevationForLngLatZoom(d,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(d))}pointLocation(d,g){return this.coordinateLocation(this.pointCoordinate(d,g))}locationCoordinate(d){return i.Z.fromLngLat(d)}coordinateLocation(d){return d&&d.toLngLat()}pointCoordinate(d,g){if(g){const ft=g.pointCoordinate(d);if(ft!=null)return ft}const z=[d.x,d.y,0,1],j=[d.x,d.y,1,1];i.ag(z,z,this.pixelMatrixInverse),i.ag(j,j,this.pixelMatrixInverse);const $=z[3],ie=j[3],de=z[0]/$,xe=j[0]/ie,Ae=z[1]/$,Re=j[1]/ie,je=z[2]/$,tt=j[2]/ie,lt=je===tt?0:(0-je)/(tt-je);return new i.Z(i.z.number(de,xe,lt)/this.worldSize,i.z.number(Ae,Re,lt)/this.worldSize)}coordinatePoint(d,g=0,z=this.pixelMatrix){const j=[d.x*this.worldSize,d.y*this.worldSize,g,1];return i.ag(j,j,z),new i.P(j[0]/j[3],j[1]/j[3])}getBounds(){const d=Math.max(0,this.height/2-this.getHorizon());return new Se().extend(this.pointLocation(new i.P(0,d))).extend(this.pointLocation(new i.P(this.width,d))).extend(this.pointLocation(new i.P(this.width,this.height))).extend(this.pointLocation(new i.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Se([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(d){d?(this.lngRange=[d.getWest(),d.getEast()],this.latRange=[d.getSouth(),d.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,eh])}calculateTileMatrix(d){const g=d.canonical,z=this.worldSize/this.zoomScale(g.z),j=g.x+Math.pow(2,g.z)*d.wrap,$=i.ao(new Float64Array(16));return i.J($,$,[j*z,g.y*z,0]),i.K($,$,[z/i.X,z/i.X,1]),$}calculatePosMatrix(d,g=!1){const z=d.key,j=g?this._alignedPosMatrixCache:this._posMatrixCache;if(j[z])return j[z];const $=this.calculateTileMatrix(d);return i.L($,g?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,$),j[z]=new Float32Array($),j[z]}calculateFogMatrix(d){const g=d.key,z=this._fogMatrixCache;if(z[g])return z[g];const j=this.calculateTileMatrix(d);return i.L(j,this.fogMatrix,j),z[g]=new Float32Array(j),z[g]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(d,g){g=i.ad(+g,this.minZoom,this.maxZoom);const z={center:new i.N(d.lng,d.lat),zoom:g};let j=this.lngRange;if(!this._renderWorldCopies&&j===null){const At=179.9999999999;j=[-At,At]}const $=this.tileSize*this.zoomScale(z.zoom);let ie=0,de=$,xe=0,Ae=$,Re=0,je=0;const{x:tt,y:lt}=this.size;if(this.latRange){const At=this.latRange;ie=i.Q(At[1])*$,de=i.Q(At[0])*$,de-ie<lt&&(Re=lt/(de-ie))}j&&(xe=i.b3(i.O(j[0])*$,0,$),Ae=i.b3(i.O(j[1])*$,0,$),Ae<xe&&(Ae+=$),Ae-xe<tt&&(je=tt/(Ae-xe)));const{x:ft,y:yt}=this.project.call({worldSize:$},d);let Ct,kt;const Bt=Math.max(je||0,Re||0);if(Bt){const At=new i.P(je?(Ae+xe)/2:ft,Re?(de+ie)/2:yt);return z.center=this.unproject.call({worldSize:$},At).wrap(),z.zoom+=this.scaleZoom(Bt),z}if(this.latRange){const At=lt/2;yt-At<ie&&(kt=ie+At),yt+At>de&&(kt=de-At)}if(j){const At=(xe+Ae)/2;let $t=ft;this._renderWorldCopies&&($t=i.b3(ft,At-$/2,At+$/2));const Kt=tt/2;$t-Kt<xe&&(Ct=xe+Kt),$t+Kt>Ae&&(Ct=Ae-Kt)}if(Ct!==void 0||kt!==void 0){const At=new i.P(Ct??ft,kt??yt);z.center=this.unproject.call({worldSize:$},At).wrap()}return z}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const d=this._unmodified,{center:g,zoom:z}=this.getConstrained(this.center,this.zoom);this.center=g,this.zoom=z,this._unmodified=d,this._constraining=!1}_calcMatrices(){if(!this.height)return;const d=this._fov/2,g=this.centerOffset,z=this.point.x,j=this.point.y;this.cameraToCenterDistance=.5/Math.tan(d)*this.height,this._pixelPerMeter=i.b5(1,this.center.lat)*this.worldSize;let $=i.ao(new Float64Array(16));i.K($,$,[this.width/2,-this.height/2,1]),i.J($,$,[1,-1,0]),this.labelPlaneMatrix=$,$=i.ao(new Float64Array(16)),i.K($,$,[1,-1,1]),i.J($,$,[-1,-1,0]),i.K($,$,[2/this.width,2/this.height,1]),this.glCoordMatrix=$;const ie=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),de=Math.min(this.elevation,this.minElevationForCurrentTile),xe=ie-de*this._pixelPerMeter/Math.cos(this._pitch),Ae=de<0?xe:ie,Re=Math.PI/2+this._pitch,je=this._fov*(.5+g.y/this.height),tt=Math.sin(je)*Ae/Math.sin(i.ad(Math.PI-Re-je,.01,Math.PI-.01)),lt=this.getHorizon(),ft=2*Math.atan(lt/this.cameraToCenterDistance)*(.5+g.y/(2*lt)),yt=Math.sin(ft)*Ae/Math.sin(i.ad(Math.PI-Re-ft,.01,Math.PI-.01)),Ct=Math.min(tt,yt);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*Ct+Ae),this.nearZ=this.height/50,$=new Float64Array(16),i.b6($,this._fov,this.width/this.height,this.nearZ,this.farZ),$[8]=2*-g.x/this.width,$[9]=2*g.y/this.height,this.projectionMatrix=i.af($),i.K($,$,[1,-1,1]),i.J($,$,[0,0,-this.cameraToCenterDistance]),i.b7($,$,this._pitch),i.ae($,$,this.angle),i.J($,$,[-z,-j,0]),this.mercatorMatrix=i.K([],$,[this.worldSize,this.worldSize,this.worldSize]),i.K($,$,[1,1,this._pixelPerMeter]),this.pixelMatrix=i.L(new Float64Array(16),this.labelPlaneMatrix,$),i.J($,$,[0,0,-this.elevation]),this.modelViewProjectionMatrix=$,this.invModelViewProjectionMatrix=i.at([],$),this.fogMatrix=new Float64Array(16),i.b6(this.fogMatrix,this._fov,this.width/this.height,ie,this.farZ),this.fogMatrix[8]=2*-g.x/this.width,this.fogMatrix[9]=2*g.y/this.height,i.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),i.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),i.b7(this.fogMatrix,this.fogMatrix,this._pitch),i.ae(this.fogMatrix,this.fogMatrix,this.angle),i.J(this.fogMatrix,this.fogMatrix,[-z,-j,0]),i.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),i.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=i.L(new Float64Array(16),this.labelPlaneMatrix,$);const kt=this.width%2/2,Bt=this.height%2/2,At=Math.cos(this.angle),$t=Math.sin(this.angle),Kt=z-Math.round(z)+At*kt+$t*Bt,Yt=j-Math.round(j)+At*Bt+$t*kt,pn=new Float64Array($);if(i.J(pn,pn,[Kt>.5?Kt-1:Kt,Yt>.5?Yt-1:Yt,0]),this.alignedModelViewProjectionMatrix=pn,$=i.at(new Float64Array(16),this.pixelMatrix),!$)throw new Error("failed to invert matrix");this.pixelMatrixInverse=$,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const d=this.pointCoordinate(new i.P(0,0)),g=[d.x*this.worldSize,d.y*this.worldSize,0,1];return i.ag(g,g,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const d=this._pitch,g=Math.tan(d)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.P(0,g))}getCameraQueryGeometry(d){const g=this.getCameraPoint();if(d.length===1)return[d[0],g];{let z=g.x,j=g.y,$=g.x,ie=g.y;for(const de of d)z=Math.min(z,de.x),j=Math.min(j,de.y),$=Math.max($,de.x),ie=Math.max(ie,de.y);return[new i.P(z,j),new i.P($,j),new i.P($,ie),new i.P(z,ie),new i.P(z,j)]}}lngLatToCameraDepth(d,g){const z=this.locationCoordinate(d),j=[z.x*this.worldSize,z.y*this.worldSize,g,1];return i.ag(j,j,this.modelViewProjectionMatrix),j[2]/j[3]}}function gu(V,d){let g,z=!1,j=null,$=null;const ie=()=>{j=null,z&&(V.apply($,g),j=setTimeout(ie,d),z=!1)};return(...de)=>(z=!0,$=this,g=de,j||ie(),j)}class Go{constructor(d){this._getCurrentHash=()=>{const g=window.location.hash.replace("#","");if(this._hashName){let z;return g.split("&").map(j=>j.split("=")).forEach(j=>{j[0]===this._hashName&&(z=j)}),(z&&z[1]||"").split("/")}return g.split("/")},this._onHashChange=()=>{const g=this._getCurrentHash();if(g.length>=3&&!g.some(z=>isNaN(z))){const z=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(g[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+g[2],+g[1]],zoom:+g[0],bearing:z,pitch:+(g[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const g=window.location.href.replace(/(#.+)?$/,this.getHashString());window.history.replaceState(window.history.state,null,g)},this._removeHash=()=>{const g=this._getCurrentHash();if(g.length===0)return;const z=g.join("/");let j=z;j.split("&").length>0&&(j=j.split("&")[0]),this._hashName&&(j=`${this._hashName}=${z}`);let $=window.location.hash.replace(j,"");$.startsWith("#&")?$=$.slice(0,1)+$.slice(2):$==="#"&&($="");let ie=window.location.href.replace(/(#.+)?$/,$);ie=ie.replace("&&","&"),window.history.replaceState(window.history.state,null,ie)},this._updateHash=gu(this._updateHashUnthrottled,300),this._hashName=d&&encodeURIComponent(d)}addTo(d){return this._map=d,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(d){const g=this._map.getCenter(),z=Math.round(100*this._map.getZoom())/100,j=Math.ceil((z*Math.LN2+Math.log(512/360/.5))/Math.LN10),$=Math.pow(10,j),ie=Math.round(g.lng*$)/$,de=Math.round(g.lat*$)/$,xe=this._map.getBearing(),Ae=this._map.getPitch();let Re="";if(Re+=d?`/${ie}/${de}/${z}`:`${z}/${de}/${ie}`,(xe||Ae)&&(Re+="/"+Math.round(10*xe)/10),Ae&&(Re+=`/${Math.round(Ae)}`),this._hashName){const je=this._hashName;let tt=!1;const lt=window.location.hash.slice(1).split("&").map(ft=>{const yt=ft.split("=")[0];return yt===je?(tt=!0,`${yt}=${Re}`):ft}).filter(ft=>ft);return tt||lt.push(`${je}=${Re}`),`#${lt.join("&")}`}return`#${Re}`}}const nl={linearity:.3,easing:i.b8(0,0,.3,1)},Sa=i.e({deceleration:2500,maxSpeed:1400},nl),La=i.e({deceleration:20,maxSpeed:1400},nl),ql=i.e({deceleration:1e3,maxSpeed:360},nl),th=i.e({deceleration:1e3,maxSpeed:90},nl);class zc{constructor(d){this._map=d,this.clear()}clear(){this._inertiaBuffer=[]}record(d){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:v.now(),settings:d})}_drainInertiaBuffer(){const d=this._inertiaBuffer,g=v.now();for(;d.length>0&&g-d[0].time>160;)d.shift()}_onMoveEnd(d){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const g={zoom:0,bearing:0,pitch:0,pan:new i.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:$}of this._inertiaBuffer)g.zoom+=$.zoomDelta||0,g.bearing+=$.bearingDelta||0,g.pitch+=$.pitchDelta||0,$.panDelta&&g.pan._add($.panDelta),$.around&&(g.around=$.around),$.pinchAround&&(g.pinchAround=$.pinchAround);const z=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,j={};if(g.pan.mag()){const $=vc(g.pan.mag(),z,i.e({},Sa,d||{}));j.offset=g.pan.mult($.amount/g.pan.mag()),j.center=this._map.transform.center,gc(j,$)}if(g.zoom){const $=vc(g.zoom,z,La);j.zoom=this._map.transform.zoom+$.amount,gc(j,$)}if(g.bearing){const $=vc(g.bearing,z,ql);j.bearing=this._map.transform.bearing+i.ad($.amount,-179,179),gc(j,$)}if(g.pitch){const $=vc(g.pitch,z,th);j.pitch=this._map.transform.pitch+$.amount,gc(j,$)}if(j.zoom||j.bearing){const $=g.pinchAround===void 0?g.around:g.pinchAround;j.around=$?this._map.unproject($):this._map.getCenter()}return this.clear(),i.e(j,{noMoveStart:!0})}}function gc(V,d){(!V.duration||V.duration<d.duration)&&(V.duration=d.duration,V.easing=d.easing)}function vc(V,d,g){const{maxSpeed:z,linearity:j,deceleration:$}=g,ie=i.ad(V*j/(d/1e3),-z,z),de=Math.abs(ie)/($*j);return{easing:g.easing,duration:1e3*de,amount:ie*(de/2)}}class Ds extends i.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,g,z,j={}){const $=o.mousePos(g.getCanvas(),z),ie=g.unproject($);super(d,i.e({point:$,lngLat:ie,originalEvent:z},j)),this._defaultPrevented=!1,this.target=g}}class ys extends i.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,g,z){const j=d==="touchend"?z.changedTouches:z.touches,$=o.touchPos(g.getCanvasContainer(),j),ie=$.map(xe=>g.unproject(xe)),de=$.reduce((xe,Ae,Re,je)=>xe.add(Ae.div(je.length)),new i.P(0,0));super(d,{points:$,point:de,lngLats:ie,lngLat:g.unproject(de),originalEvent:z}),this._defaultPrevented=!1}}class Mu extends i.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,g,z){super(d,{originalEvent:z}),this._defaultPrevented=!1}}class Fc{constructor(d,g){this._map=d,this._clickTolerance=g.clickTolerance}reset(){delete this._mousedownPos}wheel(d){return this._firePreventable(new Mu(d.type,this._map,d))}mousedown(d,g){return this._mousedownPos=g,this._firePreventable(new Ds(d.type,this._map,d))}mouseup(d){this._map.fire(new Ds(d.type,this._map,d))}click(d,g){this._mousedownPos&&this._mousedownPos.dist(g)>=this._clickTolerance||this._map.fire(new Ds(d.type,this._map,d))}dblclick(d){return this._firePreventable(new Ds(d.type,this._map,d))}mouseover(d){this._map.fire(new Ds(d.type,this._map,d))}mouseout(d){this._map.fire(new Ds(d.type,this._map,d))}touchstart(d){return this._firePreventable(new ys(d.type,this._map,d))}touchmove(d){this._map.fire(new ys(d.type,this._map,d))}touchend(d){this._map.fire(new ys(d.type,this._map,d))}touchcancel(d){this._map.fire(new ys(d.type,this._map,d))}_firePreventable(d){if(this._map.fire(d),d.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vs{constructor(d){this._map=d}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(d){this._map.fire(new Ds(d.type,this._map,d))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ds("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(d){this._delayContextMenu?this._contextMenuEvent=d:this._ignoreContextMenu||this._map.fire(new Ds(d.type,this._map,d)),this._map.listens("contextmenu")&&d.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class io{constructor(d){this._map=d}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(d){return this.transform.pointLocation(i.P.convert(d),this._map.terrain)}}class bs{constructor(d,g){this._map=d,this._tr=new io(d),this._el=d.getCanvasContainer(),this._container=d.getContainer(),this._clickTolerance=g.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(d,g){this.isEnabled()&&d.shiftKey&&d.button===0&&(o.disableDrag(),this._startPos=this._lastPos=g,this._active=!0)}mousemoveWindow(d,g){if(!this._active)return;const z=g;if(this._lastPos.equals(z)||!this._box&&z.dist(this._startPos)<this._clickTolerance)return;const j=this._startPos;this._lastPos=z,this._box||(this._box=o.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",d));const $=Math.min(j.x,z.x),ie=Math.max(j.x,z.x),de=Math.min(j.y,z.y),xe=Math.max(j.y,z.y);o.setTransform(this._box,`translate(${$}px,${de}px)`),this._box.style.width=ie-$+"px",this._box.style.height=xe-de+"px"}mouseupWindow(d,g){if(!this._active||d.button!==0)return;const z=this._startPos,j=g;if(this.reset(),o.suppressClick(),z.x!==j.x||z.y!==j.y)return this._map.fire(new i.k("boxzoomend",{originalEvent:d})),{cameraAnimation:$=>$.fitScreenCoordinates(z,j,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",d)}keydown(d){this._active&&d.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",d))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(o.remove(this._box),this._box=null),o.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(d,g){return this._map.fire(new i.k(d,{originalEvent:g}))}}function Ba(V,d){if(V.length!==d.length)throw new Error(`The number of touches and points are not equal - touches ${V.length}, points ${d.length}`);const g={};for(let z=0;z<V.length;z++)g[V[z].identifier]=d[z];return g}class $o{constructor(d){this.reset(),this.numTouches=d.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(d,g,z){(this.centroid||z.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=d.timeStamp),z.length===this.numTouches&&(this.centroid=function(j){const $=new i.P(0,0);for(const ie of j)$._add(ie);return $.div(j.length)}(g),this.touches=Ba(z,g)))}touchmove(d,g,z){if(this.aborted||!this.centroid)return;const j=Ba(z,g);for(const $ in this.touches){const ie=this.touches[$],de=j[$];(!de||de.dist(ie)>30)&&(this.aborted=!0)}}touchend(d,g,z){if((!this.centroid||d.timeStamp-this.startTime>500)&&(this.aborted=!0),z.length===0){const j=!this.aborted&&this.centroid;if(this.reset(),j)return j}}}class Na{constructor(d){this.singleTap=new $o(d),this.numTaps=d.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(d,g,z){this.singleTap.touchstart(d,g,z)}touchmove(d,g,z){this.singleTap.touchmove(d,g,z)}touchend(d,g,z){const j=this.singleTap.touchend(d,g,z);if(j){const $=d.timeStamp-this.lastTime<500,ie=!this.lastTap||this.lastTap.dist(j)<30;if($&&ie||this.reset(),this.count++,this.lastTime=d.timeStamp,this.lastTap=j,this.count===this.numTaps)return this.reset(),j}}}class is{constructor(d){this._tr=new io(d),this._zoomIn=new Na({numTouches:1,numTaps:2}),this._zoomOut=new Na({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(d,g,z){this._zoomIn.touchstart(d,g,z),this._zoomOut.touchstart(d,g,z)}touchmove(d,g,z){this._zoomIn.touchmove(d,g,z),this._zoomOut.touchmove(d,g,z)}touchend(d,g,z){const j=this._zoomIn.touchend(d,g,z),$=this._zoomOut.touchend(d,g,z),ie=this._tr;return j?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:de=>de.easeTo({duration:300,zoom:ie.zoom+1,around:ie.unproject(j)},{originalEvent:d})}):$?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:de=>de.easeTo({duration:300,zoom:ie.zoom-1,around:ie.unproject($)},{originalEvent:d})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class xs{constructor(d){this._enabled=!!d.enable,this._moveStateManager=d.moveStateManager,this._clickTolerance=d.clickTolerance||1,this._moveFunction=d.move,this._activateOnStart=!!d.activateOnStart,d.assignEvents(this),this.reset()}reset(d){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(d)}_move(...d){const g=this._moveFunction(...d);if(g.bearingDelta||g.pitchDelta||g.around||g.panDelta)return this._active=!0,g}dragStart(d,g){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(d)&&(this._moveStateManager.startMove(d),this._lastPoint=g.length?g[0]:g,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(d,g){if(!this.isEnabled())return;const z=this._lastPoint;if(!z)return;if(d.preventDefault(),!this._moveStateManager.isValidMoveEvent(d))return void this.reset(d);const j=g.length?g[0]:g;return!this._moved&&j.dist(z)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=j,this._move(z,j))}dragEnd(d){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(d)&&(this._moved&&o.suppressClick(),this.reset(d))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Eu={0:1,2:2};class ml{constructor(d){this._correctEvent=d.checkCorrectEvent}startMove(d){const g=o.mouseButton(d);this._eventButton=g}endMove(d){delete this._eventButton}isValidStartEvent(d){return this._correctEvent(d)}isValidMoveEvent(d){return!function(g,z){const j=Eu[z];return g.buttons===void 0||(g.buttons&j)!==j}(d,this._eventButton)}isValidEndEvent(d){return o.mouseButton(d)===this._eventButton}}class nc{constructor(){this._firstTouch=void 0}_isOneFingerTouch(d){return d.targetTouches.length===1}_isSameTouchEvent(d){return d.targetTouches[0].identifier===this._firstTouch}startMove(d){const g=d.targetTouches[0].identifier;this._firstTouch=g}endMove(d){delete this._firstTouch}isValidStartEvent(d){return this._isOneFingerTouch(d)}isValidMoveEvent(d){return this._isOneFingerTouch(d)&&this._isSameTouchEvent(d)}isValidEndEvent(d){return this._isOneFingerTouch(d)&&this._isSameTouchEvent(d)}}const Rs=V=>{V.mousedown=V.dragStart,V.mousemoveWindow=V.dragMove,V.mouseup=V.dragEnd,V.contextmenu=d=>{d.preventDefault()}},yc=({enable:V,clickTolerance:d,bearingDegreesPerPixelMoved:g=.8})=>{const z=new ml({checkCorrectEvent:j=>o.mouseButton(j)===0&&j.ctrlKey||o.mouseButton(j)===2});return new xs({clickTolerance:d,move:(j,$)=>({bearingDelta:($.x-j.x)*g}),moveStateManager:z,enable:V,assignEvents:Rs})},Iu=({enable:V,clickTolerance:d,pitchDegreesPerPixelMoved:g=-.5})=>{const z=new ml({checkCorrectEvent:j=>o.mouseButton(j)===0&&j.ctrlKey||o.mouseButton(j)===2});return new xs({clickTolerance:d,move:(j,$)=>({pitchDelta:($.y-j.y)*g}),moveStateManager:z,enable:V,assignEvents:Rs})};class Wl{constructor(d,g){this._clickTolerance=d.clickTolerance||1,this._map=g,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new i.P(0,0)}_shouldBePrevented(d){return d<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(d,g,z){return this._calculateTransform(d,g,z)}touchmove(d,g,z){if(this._active){if(!this._shouldBePrevented(z.length))return d.preventDefault(),this._calculateTransform(d,g,z);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",d)}}touchend(d,g,z){this._calculateTransform(d,g,z),this._active&&this._shouldBePrevented(z.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(d,g,z){z.length>0&&(this._active=!0);const j=Ba(z,g),$=new i.P(0,0),ie=new i.P(0,0);let de=0;for(const Ae in j){const Re=j[Ae],je=this._touches[Ae];je&&($._add(Re),ie._add(Re.sub(je)),de++,j[Ae]=Re)}if(this._touches=j,this._shouldBePrevented(de)||!ie.mag())return;const xe=ie.div(de);return this._sum._add(xe),this._sum.mag()<this._clickTolerance?void 0:{around:$.div(de),panDelta:xe}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class as{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(d,g,z){this._firstTwoTouches||z.length<2||(this._firstTwoTouches=[z[0].identifier,z[1].identifier],this._start([g[0],g[1]]))}touchmove(d,g,z){if(!this._firstTwoTouches)return;d.preventDefault();const[j,$]=this._firstTwoTouches,ie=qa(z,g,j),de=qa(z,g,$);if(!ie||!de)return;const xe=this._aroundCenter?null:ie.add(de).div(2);return this._move([ie,de],xe,d)}touchend(d,g,z){if(!this._firstTwoTouches)return;const[j,$]=this._firstTwoTouches,ie=qa(z,g,j),de=qa(z,g,$);ie&&de||(this._active&&o.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(d){this._enabled=!0,this._aroundCenter=!!d&&d.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function qa(V,d,g){for(let z=0;z<V.length;z++)if(V[z].identifier===g)return d[z]}function Gl(V,d){return Math.log(V/d)/Math.LN2}class ki extends as{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(d){this._startDistance=this._distance=d[0].dist(d[1])}_move(d,g){const z=this._distance;if(this._distance=d[0].dist(d[1]),this._active||!(Math.abs(Gl(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Gl(this._distance,z),pinchAround:g}}}function nh(V,d){return 180*V.angleWith(d)/Math.PI}class zh extends as{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(d){this._startVector=this._vector=d[0].sub(d[1]),this._minDiameter=d[0].dist(d[1])}_move(d,g,z){const j=this._vector;if(this._vector=d[0].sub(d[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:nh(this._vector,j),pinchAround:g}}_isBelowThreshold(d){this._minDiameter=Math.min(this._minDiameter,d.mag());const g=25/(Math.PI*this._minDiameter)*360,z=nh(d,this._startVector);return Math.abs(z)<g}}function Lu(V){return Math.abs(V.y)>Math.abs(V.x)}class rc extends as{constructor(d){super(),this._currentTouchCount=0,this._map=d}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(d,g,z){super.touchstart(d,g,z),this._currentTouchCount=z.length}_start(d){this._lastPoints=d,Lu(d[0].sub(d[1]))&&(this._valid=!1)}_move(d,g,z){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const j=d[0].sub(this._lastPoints[0]),$=d[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(j,$,z.timeStamp),this._valid?(this._lastPoints=d,this._active=!0,{pitchDelta:(j.y+$.y)/2*-.5}):void 0}gestureBeginsVertically(d,g,z){if(this._valid!==void 0)return this._valid;const j=d.mag()>=2,$=g.mag()>=2;if(!j&&!$)return;if(!j||!$)return this._firstMove===void 0&&(this._firstMove=z),z-this._firstMove<100&&void 0;const ie=d.y>0==g.y>0;return Lu(d)&&Lu(g)&&ie}}const ic={panStep:100,bearingStep:15,pitchStep:10};class Bc{constructor(d){this._tr=new io(d);const g=ic;this._panStep=g.panStep,this._bearingStep=g.bearingStep,this._pitchStep=g.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(d){if(d.altKey||d.ctrlKey||d.metaKey)return;let g=0,z=0,j=0,$=0,ie=0;switch(d.keyCode){case 61:case 107:case 171:case 187:g=1;break;case 189:case 109:case 173:g=-1;break;case 37:d.shiftKey?z=-1:(d.preventDefault(),$=-1);break;case 39:d.shiftKey?z=1:(d.preventDefault(),$=1);break;case 38:d.shiftKey?j=1:(d.preventDefault(),ie=-1);break;case 40:d.shiftKey?j=-1:(d.preventDefault(),ie=1);break;default:return}return this._rotationDisabled&&(z=0,j=0),{cameraAnimation:de=>{const xe=this._tr;de.easeTo({duration:300,easeId:"keyboardHandler",easing:si,zoom:g?Math.round(xe.zoom)+g*(d.shiftKey?2:1):xe.zoom,bearing:xe.bearing+z*this._bearingStep,pitch:xe.pitch+j*this._pitchStep,offset:[-$*this._panStep,-ie*this._panStep],center:xe.center},{originalEvent:d})}}}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 si(V){return V*(2-V)}const vl=4.000244140625;class Pu{constructor(d,g){this._onTimeout=z=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(z)},this._map=d,this._tr=new io(d),this._triggerRenderFrame=g,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(d){this._defaultZoomRate=d}setWheelZoomRate(d){this._wheelZoomRate=d}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(d){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!d&&d.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(d){return!!this._map.cooperativeGestures.isEnabled()&&!(d.ctrlKey||this._map.cooperativeGestures.isBypassed(d))}wheel(d){if(!this.isEnabled())return;if(this._shouldBePrevented(d))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",d);let g=d.deltaMode===WheelEvent.DOM_DELTA_LINE?40*d.deltaY:d.deltaY;const z=v.now(),j=z-(this._lastWheelEventTime||0);this._lastWheelEventTime=z,g!==0&&g%vl==0?this._type="wheel":g!==0&&Math.abs(g)<4?this._type="trackpad":j>400?(this._type=null,this._lastValue=g,this._timeout=setTimeout(this._onTimeout,40,d)):this._type||(this._type=Math.abs(j*g)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,g+=this._lastValue)),d.shiftKey&&g&&(g/=4),this._type&&(this._lastWheelEvent=d,this._delta-=g,this._active||this._start(d)),d.preventDefault()}_start(d){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const g=o.mousePos(this._map.getCanvas(),d),z=this._tr;g.y>z.transform.height/2-z.transform.getHorizon()?this._around=i.N.convert(this._aroundCenter?z.center:z.unproject(g)):this._around=i.N.convert(z.center),this._aroundPoint=z.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const d=this._tr.transform;if(this._delta!==0){const xe=this._type==="wheel"&&Math.abs(this._delta)>vl?this._wheelZoomRate:this._defaultZoomRate;let Ae=2/(1+Math.exp(-Math.abs(this._delta*xe)));this._delta<0&&Ae!==0&&(Ae=1/Ae);const Re=typeof this._targetZoom=="number"?d.zoomScale(this._targetZoom):d.scale;this._targetZoom=Math.min(d.maxZoom,Math.max(d.minZoom,d.scaleZoom(Re*Ae))),this._type==="wheel"&&(this._startZoom=d.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const g=typeof this._targetZoom=="number"?this._targetZoom:d.zoom,z=this._startZoom,j=this._easing;let $,ie=!1;const de=v.now()-this._lastWheelEventTime;if(this._type==="wheel"&&z&&j&&de){const xe=Math.min(de/200,1),Ae=j(xe);$=i.z.number(z,g,Ae),xe<1?this._frameId||(this._frameId=!0):ie=!0}else $=g,ie=!0;return this._active=!0,ie&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!ie,zoomDelta:$-d.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(d){let g=i.b9;if(this._prevEase){const z=this._prevEase,j=(v.now()-z.start)/z.duration,$=z.easing(j+.01)-z.easing(j),ie=.27/Math.sqrt($*$+1e-4)*.01,de=Math.sqrt(.0729-ie*ie);g=i.b8(ie,de,.25,1)}return this._prevEase={start:v.now(),duration:d,easing:g},g}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ao{constructor(d,g){this._clickZoom=d,this._tapZoom=g}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 rl{constructor(d){this._tr=new io(d),this.reset()}reset(){this._active=!1}dblclick(d,g){return d.preventDefault(),{cameraAnimation:z=>{z.easeTo({duration:300,zoom:this._tr.zoom+(d.shiftKey?-1:1),around:this._tr.unproject(g)},{originalEvent:d})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Du{constructor(){this._tap=new Na({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(d,g,z){if(!this._swipePoint)if(this._tapTime){const j=g[0],$=d.timeStamp-this._tapTime<500,ie=this._tapPoint.dist(j)<30;$&&ie?z.length>0&&(this._swipePoint=j,this._swipeTouch=z[0].identifier):this.reset()}else this._tap.touchstart(d,g,z)}touchmove(d,g,z){if(this._tapTime){if(this._swipePoint){if(z[0].identifier!==this._swipeTouch)return;const j=g[0],$=j.y-this._swipePoint.y;return this._swipePoint=j,d.preventDefault(),this._active=!0,{zoomDelta:$/128}}}else this._tap.touchmove(d,g,z)}touchend(d,g,z){if(this._tapTime)this._swipePoint&&z.length===0&&this.reset();else{const j=this._tap.touchend(d,g,z);j&&(this._tapTime=d.timeStamp,this._tapPoint=j)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $l{constructor(d,g,z){this._el=d,this._mousePan=g,this._touchPan=z}enable(d){this._inertiaOptions=d||{},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 js{constructor(d,g,z){this._pitchWithRotate=d.pitchWithRotate,this._mouseRotate=g,this._mousePitch=z}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 Ru{constructor(d,g,z,j){this._el=d,this._touchZoom=g,this._touchRotate=z,this._tapDragZoom=j,this._rotationDisabled=!1,this._enabled=!0}enable(d){this._touchZoom.enable(d),this._rotationDisabled||this._touchRotate.enable(d),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 Ml{constructor(d,g){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=d,this._options=g,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const d=this._map.getCanvasContainer();d.classList.add("maplibregl-cooperative-gestures"),this._container=o.create("div","maplibregl-cooperative-gesture-screen",d);let g=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(g=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const z=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),j=document.createElement("div");j.className="maplibregl-desktop-message",j.textContent=g,this._container.appendChild(j);const $=document.createElement("div");$.className="maplibregl-mobile-message",$.textContent=z,this._container.appendChild($),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(o.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(d){return d[this._bypassKey]}notifyGestureBlocked(d,g){this._enabled&&(this._map.fire(new i.k("cooperativegestureprevented",{gestureType:d,originalEvent:g})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const il=V=>V.zoom||V.drag||V.pitch||V.rotate;class Yl extends i.k{}function bi(V){return V.panDelta&&V.panDelta.mag()||V.zoomDelta||V.bearingDelta||V.pitchDelta}class ba{constructor(d,g){this.handleWindowEvent=j=>{this.handleEvent(j,`${j.type}Window`)},this.handleEvent=(j,$)=>{if(j.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const ie=j.type==="renderFrame"?void 0:j,de={needsRenderFrame:!1},xe={},Ae={},Re=j.touches,je=Re?this._getMapTouches(Re):void 0,tt=je?o.touchPos(this._map.getCanvas(),je):o.mousePos(this._map.getCanvas(),j);for(const{handlerName:yt,handler:Ct,allowed:kt}of this._handlers){if(!Ct.isEnabled())continue;let Bt;this._blockedByActive(Ae,kt,yt)?Ct.reset():Ct[$||j.type]&&(Bt=Ct[$||j.type](j,tt,je),this.mergeHandlerResult(de,xe,Bt,yt,ie),Bt&&Bt.needsRenderFrame&&this._triggerRenderFrame()),(Bt||Ct.isActive())&&(Ae[yt]=Ct)}const lt={};for(const yt in this._previousActiveHandlers)Ae[yt]||(lt[yt]=ie);this._previousActiveHandlers=Ae,(Object.keys(lt).length||bi(de))&&(this._changes.push([de,xe,lt]),this._triggerRenderFrame()),(Object.keys(Ae).length||bi(de))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ft}=de;ft&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ft(this._map))},this._map=d,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new zc(d),this._bearingSnap=g.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(g);const z=this._el;this._listeners=[[z,"touchstart",{passive:!0}],[z,"touchmove",{passive:!1}],[z,"touchend",void 0],[z,"touchcancel",void 0],[z,"mousedown",void 0],[z,"mousemove",void 0],[z,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[z,"mouseover",void 0],[z,"mouseout",void 0],[z,"dblclick",void 0],[z,"click",void 0],[z,"keydown",{capture:!1}],[z,"keyup",void 0],[z,"wheel",{passive:!1}],[z,"contextmenu",void 0],[window,"blur",void 0]];for(const[j,$,ie]of this._listeners)o.addEventListener(j,$,j===document?this.handleWindowEvent:this.handleEvent,ie)}destroy(){for(const[d,g,z]of this._listeners)o.removeEventListener(d,g,d===document?this.handleWindowEvent:this.handleEvent,z)}_addDefaultHandlers(d){const g=this._map,z=g.getCanvasContainer();this._add("mapEvent",new Fc(g,d));const j=g.boxZoom=new bs(g,d);this._add("boxZoom",j),d.interactive&&d.boxZoom&&j.enable();const $=g.cooperativeGestures=new Ml(g,d.cooperativeGestures);this._add("cooperativeGestures",$),d.cooperativeGestures&&$.enable();const ie=new is(g),de=new rl(g);g.doubleClickZoom=new ao(de,ie),this._add("tapZoom",ie),this._add("clickZoom",de),d.interactive&&d.doubleClickZoom&&g.doubleClickZoom.enable();const xe=new Du;this._add("tapDragZoom",xe);const Ae=g.touchPitch=new rc(g);this._add("touchPitch",Ae),d.interactive&&d.touchPitch&&g.touchPitch.enable(d.touchPitch);const Re=yc(d),je=Iu(d);g.dragRotate=new js(d,Re,je),this._add("mouseRotate",Re,["mousePitch"]),this._add("mousePitch",je,["mouseRotate"]),d.interactive&&d.dragRotate&&g.dragRotate.enable();const tt=(({enable:Bt,clickTolerance:At})=>{const $t=new ml({checkCorrectEvent:Kt=>o.mouseButton(Kt)===0&&!Kt.ctrlKey});return new xs({clickTolerance:At,move:(Kt,Yt)=>({around:Yt,panDelta:Yt.sub(Kt)}),activateOnStart:!0,moveStateManager:$t,enable:Bt,assignEvents:Rs})})(d),lt=new Wl(d,g);g.dragPan=new $l(z,tt,lt),this._add("mousePan",tt),this._add("touchPan",lt,["touchZoom","touchRotate"]),d.interactive&&d.dragPan&&g.dragPan.enable(d.dragPan);const ft=new zh,yt=new ki;g.touchZoomRotate=new Ru(z,yt,ft,xe),this._add("touchRotate",ft,["touchPan","touchZoom"]),this._add("touchZoom",yt,["touchPan","touchRotate"]),d.interactive&&d.touchZoomRotate&&g.touchZoomRotate.enable(d.touchZoomRotate);const Ct=g.scrollZoom=new Pu(g,()=>this._triggerRenderFrame());this._add("scrollZoom",Ct,["mousePan"]),d.interactive&&d.scrollZoom&&g.scrollZoom.enable(d.scrollZoom);const kt=g.keyboard=new Bc(g);this._add("keyboard",kt),d.interactive&&d.keyboard&&g.keyboard.enable(),this._add("blockableMapEvent",new Vs(g))}_add(d,g,z){this._handlers.push({handlerName:d,handler:g,allowed:z}),this._handlersById[d]=g}stop(d){if(!this._updatingCamera){for(const{handler:g}of this._handlers)g.reset();this._inertia.clear(),this._fireEvents({},{},d),this._changes=[]}}isActive(){for(const{handler:d}of this._handlers)if(d.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!il(this._eventsInProgress)||this.isZooming()}_blockedByActive(d,g,z){for(const j in d)if(j!==z&&(!g||g.indexOf(j)<0))return!0;return!1}_getMapTouches(d){const g=[];for(const z of d){const j=z.target;this._el.contains(j)&&g.push(z)}return g}mergeHandlerResult(d,g,z,j,$){if(!z)return;i.e(d,z);const ie={handlerName:j,originalEvent:z.originalEvent||$};z.zoomDelta!==void 0&&(g.zoom=ie),z.panDelta!==void 0&&(g.drag=ie),z.pitchDelta!==void 0&&(g.pitch=ie),z.bearingDelta!==void 0&&(g.rotate=ie)}_applyChanges(){const d={},g={},z={};for(const[j,$,ie]of this._changes)j.panDelta&&(d.panDelta=(d.panDelta||new i.P(0,0))._add(j.panDelta)),j.zoomDelta&&(d.zoomDelta=(d.zoomDelta||0)+j.zoomDelta),j.bearingDelta&&(d.bearingDelta=(d.bearingDelta||0)+j.bearingDelta),j.pitchDelta&&(d.pitchDelta=(d.pitchDelta||0)+j.pitchDelta),j.around!==void 0&&(d.around=j.around),j.pinchAround!==void 0&&(d.pinchAround=j.pinchAround),j.noInertia&&(d.noInertia=j.noInertia),i.e(g,$),i.e(z,ie);this._updateMapTransform(d,g,z),this._changes=[]}_updateMapTransform(d,g,z){const j=this._map,$=j._getTransformForUpdate(),ie=j.terrain;if(!(bi(d)||ie&&this._terrainMovement))return this._fireEvents(g,z,!0);let{panDelta:de,zoomDelta:xe,bearingDelta:Ae,pitchDelta:Re,around:je,pinchAround:tt}=d;tt!==void 0&&(je=tt),j._stop(!0),je=je||j.transform.centerPoint;const lt=$.pointLocation(de?je.sub(de):je);Ae&&($.bearing+=Ae),Re&&($.pitch+=Re),xe&&($.zoom+=xe),ie?this._terrainMovement||!g.drag&&!g.zoom?g.drag&&this._terrainMovement?$.center=$.pointLocation($.centerPoint.sub(de)):$.setLocationAtPoint(lt,je):(this._terrainMovement=!0,this._map._elevationFreeze=!0,$.setLocationAtPoint(lt,je)):$.setLocationAtPoint(lt,je),j._applyUpdatedTransform($),this._map._update(),d.noInertia||this._inertia.record(d),this._fireEvents(g,z,!0)}_fireEvents(d,g,z){const j=il(this._eventsInProgress),$=il(d),ie={};for(const je in d){const{originalEvent:tt}=d[je];this._eventsInProgress[je]||(ie[`${je}start`]=tt),this._eventsInProgress[je]=d[je]}!j&&$&&this._fireEvent("movestart",$.originalEvent);for(const je in ie)this._fireEvent(je,ie[je]);$&&this._fireEvent("move",$.originalEvent);for(const je in d){const{originalEvent:tt}=d[je];this._fireEvent(je,tt)}const de={};let xe;for(const je in this._eventsInProgress){const{handlerName:tt,originalEvent:lt}=this._eventsInProgress[je];this._handlersById[tt].isActive()||(delete this._eventsInProgress[je],xe=g[tt]||lt,de[`${je}end`]=xe)}for(const je in de)this._fireEvent(je,de[je]);const Ae=il(this._eventsInProgress),Re=(j||$)&&!Ae;if(Re&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const je=this._map._getTransformForUpdate();je.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(je)}if(z&&Re){this._updatingCamera=!0;const je=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),tt=lt=>lt!==0&&-this._bearingSnap<lt&<<this._bearingSnap;!je||!je.essential&&v.prefersReducedMotion?(this._map.fire(new i.k("moveend",{originalEvent:xe})),tt(this._map.getBearing())&&this._map.resetNorth()):(tt(je.bearing||this._map.getBearing())&&(je.bearing=0),je.freezeElevation=!0,this._map.easeTo(je,{originalEvent:xe})),this._updatingCamera=!1}}_fireEvent(d,g){this._map.fire(new i.k(d,g?{originalEvent:g}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(d=>{delete this._frameId,this.handleEvent(new Yl("renderFrame",{timeStamp:d})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Yo extends i.E{constructor(d,g){super(),this._renderFrameCallback=()=>{const z=Math.min((v.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(z)),z<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=d,this._bearingSnap=g.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new i.N(this.transform.center.lng,this.transform.center.lat)}setCenter(d,g){return this.jumpTo({center:d},g)}panBy(d,g,z){return d=i.P.convert(d).mult(-1),this.panTo(this.transform.center,i.e({offset:d},g),z)}panTo(d,g,z){return this.easeTo(i.e({center:d},g),z)}getZoom(){return this.transform.zoom}setZoom(d,g){return this.jumpTo({zoom:d},g),this}zoomTo(d,g,z){return this.easeTo(i.e({zoom:d},g),z)}zoomIn(d,g){return this.zoomTo(this.getZoom()+1,d,g),this}zoomOut(d,g){return this.zoomTo(this.getZoom()-1,d,g),this}getBearing(){return this.transform.bearing}setBearing(d,g){return this.jumpTo({bearing:d},g),this}getPadding(){return this.transform.padding}setPadding(d,g){return this.jumpTo({padding:d},g),this}rotateTo(d,g,z){return this.easeTo(i.e({bearing:d},g),z)}resetNorth(d,g){return this.rotateTo(0,i.e({duration:1e3},d),g),this}resetNorthPitch(d,g){return this.easeTo(i.e({bearing:0,pitch:0,duration:1e3},d),g),this}snapToNorth(d,g){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(d,g):this}getPitch(){return this.transform.pitch}setPitch(d,g){return this.jumpTo({pitch:d},g),this}cameraForBounds(d,g){d=Se.convert(d);const z=g&&g.bearing||0;return this._cameraForBoxAndBearing(d.getNorthWest(),d.getSouthEast(),z,g)}_cameraForBoxAndBearing(d,g,z,j){const $={top:0,bottom:0,right:0,left:0};if(typeof(j=i.e({padding:$,offset:[0,0],maxZoom:this.transform.maxZoom},j)).padding=="number"){const Tr=j.padding;j.padding={top:Tr,bottom:Tr,right:Tr,left:Tr}}j.padding=i.e($,j.padding);const ie=this.transform,de=ie.padding,xe=new Se(d,g),Ae=ie.project(xe.getNorthWest()),Re=ie.project(xe.getNorthEast()),je=ie.project(xe.getSouthEast()),tt=ie.project(xe.getSouthWest()),lt=i.ba(-z),ft=Ae.rotate(lt),yt=Re.rotate(lt),Ct=je.rotate(lt),kt=tt.rotate(lt),Bt=new i.P(Math.max(ft.x,yt.x,kt.x,Ct.x),Math.max(ft.y,yt.y,kt.y,Ct.y)),At=new i.P(Math.min(ft.x,yt.x,kt.x,Ct.x),Math.min(ft.y,yt.y,kt.y,Ct.y)),$t=Bt.sub(At),Kt=(ie.width-(de.left+de.right+j.padding.left+j.padding.right))/$t.x,Yt=(ie.height-(de.top+de.bottom+j.padding.top+j.padding.bottom))/$t.y;if(Yt<0||Kt<0)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const pn=Math.min(ie.scaleZoom(ie.scale*Math.min(Kt,Yt)),j.maxZoom),Tn=i.P.convert(j.offset),Vn=(j.padding.left-j.padding.right)/2,jn=(j.padding.top-j.padding.bottom)/2,$n=new i.P(Vn,jn).rotate(i.ba(z)),er=Tn.add($n).mult(ie.scale/ie.zoomScale(pn));return{center:ie.unproject(Ae.add(je).div(2).sub(er)),zoom:pn,bearing:z}}fitBounds(d,g,z){return this._fitInternal(this.cameraForBounds(d,g),g,z)}fitScreenCoordinates(d,g,z,j,$){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(i.P.convert(d)),this.transform.pointLocation(i.P.convert(g)),z,j),j,$)}_fitInternal(d,g,z){return d?(delete(g=i.e(d,g)).padding,g.linear?this.easeTo(g,z):this.flyTo(g,z)):this}jumpTo(d,g){this.stop();const z=this._getTransformForUpdate();let j=!1,$=!1,ie=!1;return"zoom"in d&&z.zoom!==+d.zoom&&(j=!0,z.zoom=+d.zoom),d.center!==void 0&&(z.center=i.N.convert(d.center)),"bearing"in d&&z.bearing!==+d.bearing&&($=!0,z.bearing=+d.bearing),"pitch"in d&&z.pitch!==+d.pitch&&(ie=!0,z.pitch=+d.pitch),d.padding==null||z.isPaddingEqual(d.padding)||(z.padding=d.padding),this._applyUpdatedTransform(z),this.fire(new i.k("movestart",g)).fire(new i.k("move",g)),j&&this.fire(new i.k("zoomstart",g)).fire(new i.k("zoom",g)).fire(new i.k("zoomend",g)),$&&this.fire(new i.k("rotatestart",g)).fire(new i.k("rotate",g)).fire(new i.k("rotateend",g)),ie&&this.fire(new i.k("pitchstart",g)).fire(new i.k("pitch",g)).fire(new i.k("pitchend",g)),this.fire(new i.k("moveend",g))}calculateCameraOptionsFromTo(d,g,z,j=0){const $=i.Z.fromLngLat(d,g),ie=i.Z.fromLngLat(z,j),de=ie.x-$.x,xe=ie.y-$.y,Ae=ie.z-$.z,Re=Math.hypot(de,xe,Ae);if(Re===0)throw new Error("Can't calculate camera options with same From and To");const je=Math.hypot(de,xe),tt=this.transform.scaleZoom(this.transform.cameraToCenterDistance/Re/this.transform.tileSize),lt=180*Math.atan2(de,-xe)/Math.PI;let ft=180*Math.acos(je/Re)/Math.PI;return ft=Ae<0?90-ft:90+ft,{center:ie.toLngLat(),zoom:tt,pitch:ft,bearing:lt}}easeTo(d,g){var z;this._stop(!1,d.easeId),((d=i.e({offset:[0,0],duration:500,easing:i.b9},d)).animate===!1||!d.essential&&v.prefersReducedMotion)&&(d.duration=0);const j=this._getTransformForUpdate(),$=j.zoom,ie=j.bearing,de=j.pitch,xe=j.padding,Ae="bearing"in d?this._normalizeBearing(d.bearing,ie):ie,Re="pitch"in d?+d.pitch:de,je="padding"in d?d.padding:j.padding,tt=i.P.convert(d.offset);let lt=j.centerPoint.add(tt);const ft=j.pointLocation(lt),{center:yt,zoom:Ct}=j.getConstrained(i.N.convert(d.center||ft),(z=d.zoom)!==null&&z!==void 0?z:$);this._normalizeCenter(yt,j);const kt=j.project(ft),Bt=j.project(yt).sub(kt),At=j.zoomScale(Ct-$);let $t,Kt;d.around&&($t=i.N.convert(d.around),Kt=j.locationPoint($t));const Yt={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||Ct!==$,this._rotating=this._rotating||ie!==Ae,this._pitching=this._pitching||Re!==de,this._padding=!j.isPaddingEqual(je),this._easeId=d.easeId,this._prepareEase(g,d.noMoveStart,Yt),this.terrain&&this._prepareElevation(yt),this._ease(pn=>{if(this._zooming&&(j.zoom=i.z.number($,Ct,pn)),this._rotating&&(j.bearing=i.z.number(ie,Ae,pn)),this._pitching&&(j.pitch=i.z.number(de,Re,pn)),this._padding&&(j.interpolatePadding(xe,je,pn),lt=j.centerPoint.add(tt)),this.terrain&&!d.freezeElevation&&this._updateElevation(pn),$t)j.setLocationAtPoint($t,Kt);else{const Tn=j.zoomScale(j.zoom-$),Vn=Ct>$?Math.min(2,At):Math.max(.5,At),jn=Math.pow(Vn,1-pn),$n=j.unproject(kt.add(Bt.mult(pn*jn)).mult(Tn));j.setLocationAtPoint(j.renderWorldCopies?$n.wrap():$n,lt)}this._applyUpdatedTransform(j),this._fireMoveEvents(g)},pn=>{this.terrain&&d.freezeElevation&&this._finalizeElevation(),this._afterEase(g,pn)},d),this}_prepareEase(d,g,z={}){this._moving=!0,g||z.moving||this.fire(new i.k("movestart",d)),this._zooming&&!z.zooming&&this.fire(new i.k("zoomstart",d)),this._rotating&&!z.rotating&&this.fire(new i.k("rotatestart",d)),this._pitching&&!z.pitching&&this.fire(new i.k("pitchstart",d))}_prepareElevation(d){this._elevationCenter=d,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(d,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(d){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const g=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(d<1&&g!==this._elevationTarget){const z=this._elevationTarget-this._elevationStart,j=(g-(z*d+this._elevationStart))/(1-d);this._elevationStart+=d*(z-j),this._elevationTarget=g}this.transform.elevation=i.z.number(this._elevationStart,this._elevationTarget,d)}_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(d){const g=d.getCameraPosition(),z=this.terrain.getElevationForLngLatZoom(g.lngLat,d.zoom);if(g.altitude<z){const j=this.calculateCameraOptionsFromTo(g.lngLat,z,d.center,d.elevation);return{pitch:j.pitch,zoom:j.zoom}}return{}}_applyUpdatedTransform(d){const g=[];if(this.terrain&&g.push(j=>this._elevateCameraIfInsideTerrain(j)),this.transformCameraUpdate&&g.push(j=>this.transformCameraUpdate(j)),!g.length)return;const z=d.clone();for(const j of g){const $=z.clone(),{center:ie,zoom:de,pitch:xe,bearing:Ae,elevation:Re}=j($);ie&&($.center=ie),de!==void 0&&($.zoom=de),xe!==void 0&&($.pitch=xe),Ae!==void 0&&($.bearing=Ae),Re!==void 0&&($.elevation=Re),z.apply($)}this.transform.apply(z)}_fireMoveEvents(d){this.fire(new i.k("move",d)),this._zooming&&this.fire(new i.k("zoom",d)),this._rotating&&this.fire(new i.k("rotate",d)),this._pitching&&this.fire(new i.k("pitch",d))}_afterEase(d,g){if(this._easeId&&g&&this._easeId===g)return;delete this._easeId;const z=this._zooming,j=this._rotating,$=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,z&&this.fire(new i.k("zoomend",d)),j&&this.fire(new i.k("rotateend",d)),$&&this.fire(new i.k("pitchend",d)),this.fire(new i.k("moveend",d))}flyTo(d,g){var z;if(!d.essential&&v.prefersReducedMotion){const ur=i.M(d,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ur,g)}this.stop(),d=i.e({offset:[0,0],speed:1.2,curve:1.42,easing:i.b9},d);const j=this._getTransformForUpdate(),$=j.zoom,ie=j.bearing,de=j.pitch,xe=j.padding,Ae="bearing"in d?this._normalizeBearing(d.bearing,ie):ie,Re="pitch"in d?+d.pitch:de,je="padding"in d?d.padding:j.padding,tt=i.P.convert(d.offset);let lt=j.centerPoint.add(tt);const ft=j.pointLocation(lt),{center:yt,zoom:Ct}=j.getConstrained(i.N.convert(d.center||ft),(z=d.zoom)!==null&&z!==void 0?z:$);this._normalizeCenter(yt,j);const kt=j.zoomScale(Ct-$),Bt=j.project(ft),At=j.project(yt).sub(Bt);let $t=d.curve;const Kt=Math.max(j.width,j.height),Yt=Kt/kt,pn=At.mag();if("minZoom"in d){const ur=i.ad(Math.min(d.minZoom,$,Ct),j.minZoom,j.maxZoom),Pr=Kt/j.zoomScale(ur-$);$t=Math.sqrt(Pr/pn*2)}const Tn=$t*$t;function Vn(ur){const Pr=(Yt*Yt-Kt*Kt+(ur?-1:1)*Tn*Tn*pn*pn)/(2*(ur?Yt:Kt)*Tn*pn);return Math.log(Math.sqrt(Pr*Pr+1)-Pr)}function jn(ur){return(Math.exp(ur)-Math.exp(-ur))/2}function $n(ur){return(Math.exp(ur)+Math.exp(-ur))/2}const er=Vn(!1);let Tr=function(ur){return $n(er)/$n(er+$t*ur)},rr=function(ur){return Kt*(($n(er)*(jn(Pr=er+$t*ur)/$n(Pr))-jn(er))/Tn)/pn;var Pr},Ar=(Vn(!0)-er)/$t;if(Math.abs(pn)<1e-6||!isFinite(Ar)){if(Math.abs(Kt-Yt)<1e-6)return this.easeTo(d,g);const ur=Yt<Kt?-1:1;Ar=Math.abs(Math.log(Yt/Kt))/$t,rr=()=>0,Tr=Pr=>Math.exp(ur*$t*Pr)}if("duration"in d)d.duration=+d.duration;else{const ur="screenSpeed"in d?+d.screenSpeed/$t:+d.speed;d.duration=1e3*Ar/ur}return d.maxDuration&&d.duration>d.maxDuration&&(d.duration=0),this._zooming=!0,this._rotating=ie!==Ae,this._pitching=Re!==de,this._padding=!j.isPaddingEqual(je),this._prepareEase(g,!1),this.terrain&&this._prepareElevation(yt),this._ease(ur=>{const Pr=ur*Ar,br=1/Tr(Pr);j.zoom=ur===1?Ct:$+j.scaleZoom(br),this._rotating&&(j.bearing=i.z.number(ie,Ae,ur)),this._pitching&&(j.pitch=i.z.number(de,Re,ur)),this._padding&&(j.interpolatePadding(xe,je,ur),lt=j.centerPoint.add(tt)),this.terrain&&!d.freezeElevation&&this._updateElevation(ur);const Nr=ur===1?yt:j.unproject(Bt.add(At.mult(rr(Pr))).mult(br));j.setLocationAtPoint(j.renderWorldCopies?Nr.wrap():Nr,lt),this._applyUpdatedTransform(j),this._fireMoveEvents(g)},()=>{this.terrain&&d.freezeElevation&&this._finalizeElevation(),this._afterEase(g)},d),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(d,g){var z;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const j=this._onEaseEnd;delete this._onEaseEnd,j.call(this,g)}return d||(z=this.handlers)===null||z===void 0||z.stop(!1),this}_ease(d,g,z){z.animate===!1||z.duration===0?(d(1),g()):(this._easeStart=v.now(),this._easeOptions=z,this._onEaseFrame=d,this._onEaseEnd=g,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(d,g){d=i.b3(d,-180,180);const z=Math.abs(d-g);return Math.abs(d-360-g)<z&&(d-=360),Math.abs(d+360-g)<z&&(d+=360),d}_normalizeCenter(d,g){if(!g.renderWorldCopies||g.lngRange)return;const z=d.lng-g.center.lng;d.lng+=z>180?-360:z<-180?360:0}queryTerrainElevation(d){return this.terrain?this.terrain.getElevationForLngLatZoom(i.N.convert(d),this.transform.tileZoom)-this.transform.elevation:null}}const Us={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class yl{constructor(d=Us){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=g=>{!g||g.sourceDataType!=="metadata"&&g.sourceDataType!=="visibility"&&g.dataType!=="style"&&g.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=d}getDefaultPosition(){return"bottom-right"}onAdd(d){return this._map=d,this._compact=this.options.compact,this._container=o.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=o.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=o.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(){o.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(d,g){const z=this._map._getUIString(`AttributionControl.${g}`);d.title=z,d.setAttribute("aria-label",z)}_updateAttributions(){if(!this._map.style)return;let d=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?d=d.concat(this.options.customAttribution.map(j=>typeof j!="string"?"":j)):typeof this.options.customAttribution=="string"&&d.push(this.options.customAttribution)),this._map.style.stylesheet){const j=this._map.style.stylesheet;this.styleOwner=j.owner,this.styleId=j.id}const g=this._map.style.sourceCaches;for(const j in g){const $=g[j];if($.used||$.usedForTerrain){const ie=$.getSource();ie.attribution&&d.indexOf(ie.attribution)<0&&d.push(ie.attribution)}}d=d.filter(j=>String(j).trim()),d.sort((j,$)=>j.length-$.length),d=d.filter((j,$)=>{for(let ie=$+1;ie<d.length;ie++)if(d[ie].indexOf(j)>=0)return!1;return!0});const z=d.join(" | ");z!==this._attribHTML&&(this._attribHTML=z,d.length?(this._innerContainer.innerHTML=z,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class os{constructor(d={}){this._updateCompact=()=>{const g=this._container.children;if(g.length){const z=g[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&z.classList.add("maplibregl-compact"):z.classList.remove("maplibregl-compact")}},this.options=d}getDefaultPosition(){return"bottom-left"}onAdd(d){this._map=d,this._compact=this.options&&this.options.compact,this._container=o.create("div","maplibregl-ctrl");const g=o.create("a","maplibregl-ctrl-logo");return g.target="_blank",g.rel="noopener nofollow",g.href="https://maplibre.org/",g.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),g.setAttribute("rel","noopener nofollow"),this._container.appendChild(g),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){o.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class rh{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(d){const g=++this._id;return this._queue.push({callback:d,id:g,cancelled:!1}),g}remove(d){const g=this._currentlyRunning,z=g?this._queue.concat(g):this._queue;for(const j of z)if(j.id===d)return void(j.cancelled=!0)}run(d=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const g=this._currentlyRunning=this._queue;this._queue=[];for(const z of g)if(!z.cancelled&&(z.callback(d),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var mi=i.Y([{name:"a_pos3d",type:"Int16",components:3}]);class Hs extends i.E{constructor(d){super(),this.sourceCache=d,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,d.usedForTerrain=!0,d.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(d,g){this.sourceCache.update(d,g),this._renderableTilesKeys=[];const z={};for(const j of d.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:g}))z[j.key]=!0,this._renderableTilesKeys.push(j.key),this._tiles[j.key]||(j.posMatrix=new Float64Array(16),i.aQ(j.posMatrix,0,i.X,0,i.X,0,1),this._tiles[j.key]=new we(j,this.tileSize));for(const j in this._tiles)z[j]||delete this._tiles[j]}freeRtt(d){for(const g in this._tiles){const z=this._tiles[g];(!d||z.tileID.equals(d)||z.tileID.isChildOf(d)||d.isChildOf(z.tileID))&&(z.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(d=>this.getTileByID(d))}getTileByID(d){return this._tiles[d]}getTerrainCoords(d){const g={};for(const z of this._renderableTilesKeys){const j=this._tiles[z].tileID;if(j.canonical.equals(d.canonical)){const $=d.clone();$.posMatrix=new Float64Array(16),i.aQ($.posMatrix,0,i.X,0,i.X,0,1),g[z]=$}else if(j.canonical.isChildOf(d.canonical)){const $=d.clone();$.posMatrix=new Float64Array(16);const ie=j.canonical.z-d.canonical.z,de=j.canonical.x-(j.canonical.x>>ie<<ie),xe=j.canonical.y-(j.canonical.y>>ie<<ie),Ae=i.X>>ie;i.aQ($.posMatrix,0,Ae,0,Ae,0,1),i.J($.posMatrix,$.posMatrix,[-de*Ae,-xe*Ae,0]),g[z]=$}else if(d.canonical.isChildOf(j.canonical)){const $=d.clone();$.posMatrix=new Float64Array(16);const ie=d.canonical.z-j.canonical.z,de=d.canonical.x-(d.canonical.x>>ie<<ie),xe=d.canonical.y-(d.canonical.y>>ie<<ie),Ae=i.X>>ie;i.aQ($.posMatrix,0,i.X,0,i.X,0,1),i.J($.posMatrix,$.posMatrix,[de*Ae,xe*Ae,0]),i.K($.posMatrix,$.posMatrix,[1/2**ie,1/2**ie,0]),g[z]=$}}return g}getSourceTile(d,g){const z=this.sourceCache._source;let j=d.overscaledZ-this.deltaZoom;if(j>z.maxzoom&&(j=z.maxzoom),j<z.minzoom)return null;this._sourceTileCache[d.key]||(this._sourceTileCache[d.key]=d.scaledTo(j).key);let $=this.sourceCache.getTileByID(this._sourceTileCache[d.key]);if((!$||!$.dem)&&g)for(;j>=z.minzoom&&(!$||!$.dem);)$=this.sourceCache.getTileByID(d.scaledTo(j--).key);return $}tilesAfterTime(d=Date.now()){return Object.values(this._tiles).filter(g=>g.timeAdded>=d)}}class xa{constructor(d,g,z){this.painter=d,this.sourceCache=new Hs(g),this.options=z,this.exaggeration=typeof z.exaggeration=="number"?z.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(d,g,z,j=i.X){var $;if(!(g>=0&&g<j&&z>=0&&z<j))return 0;const ie=this.getTerrainData(d),de=($=ie.tile)===null||$===void 0?void 0:$.dem;if(!de)return 0;const xe=function(ft,yt,Ct){var kt=yt[0],Bt=yt[1];return ft[0]=Ct[0]*kt+Ct[4]*Bt+Ct[12],ft[1]=Ct[1]*kt+Ct[5]*Bt+Ct[13],ft}([],[g/j*i.X,z/j*i.X],ie.u_terrain_matrix),Ae=[xe[0]*de.dim,xe[1]*de.dim],Re=Math.floor(Ae[0]),je=Math.floor(Ae[1]),tt=Ae[0]-Re,lt=Ae[1]-je;return de.get(Re,je)*(1-tt)*(1-lt)+de.get(Re+1,je)*tt*(1-lt)+de.get(Re,je+1)*(1-tt)*lt+de.get(Re+1,je+1)*tt*lt}getElevationForLngLatZoom(d,g){const{tileID:z,mercatorX:j,mercatorY:$}=this._getOverscaledTileIDFromLngLatZoom(d,g);return this.getElevation(z,j%i.X,$%i.X,i.X)}getElevation(d,g,z,j=i.X){return this.getDEMElevation(d,g,z,j)*this.exaggeration}getTerrainData(d){if(!this._emptyDemTexture){const j=this.painter.context,$=new i.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new D(j,$,j.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new D(j,new i.R({width:1,height:1}),j.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(j.gl.NEAREST,j.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=i.ao([])}const g=this.sourceCache.getSourceTile(d,!0);if(g&&g.dem&&(!g.demTexture||g.needsTerrainPrepare)){const j=this.painter.context;g.demTexture=this.painter.getTileTexture(g.dem.stride),g.demTexture?g.demTexture.update(g.dem.getPixels(),{premultiply:!1}):g.demTexture=new D(j,g.dem.getPixels(),j.gl.RGBA,{premultiply:!1}),g.demTexture.bind(j.gl.NEAREST,j.gl.CLAMP_TO_EDGE),g.needsTerrainPrepare=!1}const z=g&&g+g.tileID.key+d.key;if(z&&!this._demMatrixCache[z]){const j=this.sourceCache.sourceCache._source.maxzoom;let $=d.canonical.z-g.tileID.canonical.z;d.overscaledZ>d.canonical.z&&(d.canonical.z>=j?$=d.canonical.z-j:i.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const ie=d.canonical.x-(d.canonical.x>>$<<$),de=d.canonical.y-(d.canonical.y>>$<<$),xe=i.bb(new Float64Array(16),[1/(i.X<<$),1/(i.X<<$),0]);i.J(xe,xe,[ie*i.X,de*i.X,0]),this._demMatrixCache[d.key]={matrix:xe,coord:d}}return{u_depth:2,u_terrain:3,u_terrain_dim:g&&g.dem&&g.dem.dim||1,u_terrain_matrix:z?this._demMatrixCache[d.key].matrix:this._emptyDemMatrix,u_terrain_unpack:g&&g.dem&&g.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(g&&g.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:g}}getFramebuffer(d){const g=this.painter,z=g.width/devicePixelRatio,j=g.height/devicePixelRatio;return!this._fbo||this._fbo.width===z&&this._fbo.height===j||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new D(g.context,{width:z,height:j,data:null},g.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(g.context.gl.NEAREST,g.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new D(g.context,{width:z,height:j,data:null},g.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(g.context.gl.NEAREST,g.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=g.context.createFramebuffer(z,j,!0,!1),this._fbo.depthAttachment.set(g.context.createRenderbuffer(g.context.gl.DEPTH_COMPONENT16,z,j))),this._fbo.colorAttachment.set(d==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const d=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const g=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let $=0,ie=0;$<this._coordsTextureSize;$++)for(let de=0;de<this._coordsTextureSize;de++,ie+=4)g[ie+0]=255&de,g[ie+1]=255&$,g[ie+2]=de>>8<<4|$>>8,g[ie+3]=0;const z=new i.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(g.buffer)),j=new D(d,z,d.gl.RGBA,{premultiply:!1});return j.bind(d.gl.NEAREST,d.gl.CLAMP_TO_EDGE),this._coordsTexture=j,j}pointCoordinate(d){this.painter.maybeDrawDepthAndCoords(!0);const g=new Uint8Array(4),z=this.painter.context,j=z.gl,$=Math.round(d.x*this.painter.pixelRatio/devicePixelRatio),ie=Math.round(d.y*this.painter.pixelRatio/devicePixelRatio),de=Math.round(this.painter.height/devicePixelRatio);z.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),j.readPixels($,de-ie-1,1,1,j.RGBA,j.UNSIGNED_BYTE,g),z.bindFramebuffer.set(null);const xe=g[0]+(g[2]>>4<<8),Ae=g[1]+((15&g[2])<<8),Re=this.coordsIndex[255-g[3]],je=Re&&this.sourceCache.getTileByID(Re);if(!je)return null;const tt=this._coordsTextureSize,lt=(1<<je.tileID.canonical.z)*tt;return new i.Z((je.tileID.canonical.x*tt+xe)/lt+je.tileID.wrap,(je.tileID.canonical.y*tt+Ae)/lt,this.getElevation(je.tileID,xe,Ae,tt))}depthAtPoint(d){const g=new Uint8Array(4),z=this.painter.context,j=z.gl;return z.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),j.readPixels(d.x,this.painter.height/devicePixelRatio-d.y-1,1,1,j.RGBA,j.UNSIGNED_BYTE,g),z.bindFramebuffer.set(null),(g[0]/16777216+g[1]/65536+g[2]/256+g[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const d=this.painter.context,g=new i.bc,z=new i.aY,j=this.meshSize,$=i.X/j,ie=j*j;for(let je=0;je<=j;je++)for(let tt=0;tt<=j;tt++)g.emplaceBack(tt*$,je*$,0);for(let je=0;je<ie;je+=j+1)for(let tt=0;tt<j;tt++)z.emplaceBack(tt+je,j+tt+je+1,j+tt+je+2),z.emplaceBack(tt+je,j+tt+je+2,tt+je+1);const de=g.length,xe=de+2*(j+1);for(const je of[0,1])for(let tt=0;tt<=j;tt++)for(const lt of[0,1])g.emplaceBack(tt*$,je*i.X,lt);for(let je=0;je<2*j;je+=2)z.emplaceBack(xe+je,xe+je+1,xe+je+3),z.emplaceBack(xe+je,xe+je+3,xe+je+2),z.emplaceBack(de+je,de+je+3,de+je+1),z.emplaceBack(de+je,de+je+2,de+je+3);const Ae=g.length,Re=Ae+2*(j+1);for(const je of[0,1])for(let tt=0;tt<=j;tt++)for(const lt of[0,1])g.emplaceBack(je*i.X,tt*$,lt);for(let je=0;je<2*j;je+=2)z.emplaceBack(Ae+je,Ae+je+1,Ae+je+3),z.emplaceBack(Ae+je,Ae+je+3,Ae+je+2),z.emplaceBack(Re+je,Re+je+3,Re+je+1),z.emplaceBack(Re+je,Re+je+2,Re+je+3);return this._mesh=new Rc(d.createVertexBuffer(g,mi.members),d.createIndexBuffer(z),i.a0.simpleSegment(0,0,g.length,z.length)),this._mesh}getMeshFrameDelta(d){return 2*Math.PI*i.bd/Math.pow(2,d)/5}getMinTileElevationForLngLatZoom(d,g){var z;const{tileID:j}=this._getOverscaledTileIDFromLngLatZoom(d,g);return(z=this.getMinMaxElevation(j).minElevation)!==null&&z!==void 0?z:0}getMinMaxElevation(d){const g=this.getTerrainData(d).tile,z={minElevation:null,maxElevation:null};return g&&g.dem&&(z.minElevation=g.dem.min*this.exaggeration,z.maxElevation=g.dem.max*this.exaggeration),z}_getOverscaledTileIDFromLngLatZoom(d,g){const z=i.Z.fromLngLat(d.wrap()),j=(1<<g)*i.X,$=z.x*j,ie=z.y*j,de=Math.floor($/i.X),xe=Math.floor(ie/i.X);return{tileID:new i.S(g,0,g,de,xe),mercatorX:$,mercatorY:ie}}}class ac{constructor(d,g,z){this._context=d,this._size=g,this._tileSize=z,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const d of this._objects)d.texture.destroy(),d.fbo.destroy()}_createObject(d){const g=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),z=new D(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return z.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),g.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),g.colorAttachment.set(z.texture),{id:d,fbo:g,texture:z,stamp:-1,inUse:!1}}getObjectForId(d){return this._objects[d]}useObject(d){d.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(g=>d.id!==g),this._recentlyUsed.push(d.id)}stampObject(d){d.stamp=++this._stamp}getOrCreateFreeObject(){for(const g of this._recentlyUsed)if(!this._objects[g].inUse)return this._objects[g];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const d=this._createObject(this._objects.length);return this._objects.push(d),d}freeObject(d){d.inUse=!1}freeAllObjects(){for(const d of this._objects)this.freeObject(d)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(d=>!d.inUse)===!1}}const El={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class vu{constructor(d,g){this.painter=d,this.terrain=g,this.pool=new ac(d.context,30,g.sourceCache.tileSize*g.qualityFactor)}destruct(){this.pool.destruct()}getTexture(d){return this.pool.getObjectForId(d.rtt[this._stacks.length-1].id).texture}prepareForRender(d,g){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=d._order.filter(z=>!d._layers[z].isHidden(g)),this._coordsDescendingInv={};for(const z in d.sourceCaches){this._coordsDescendingInv[z]={};const j=d.sourceCaches[z].getVisibleCoordinates();for(const $ of j){const ie=this.terrain.sourceCache.getTerrainCoords($);for(const de in ie)this._coordsDescendingInv[z][de]||(this._coordsDescendingInv[z][de]=[]),this._coordsDescendingInv[z][de].push(ie[de])}}this._coordsDescendingInvStr={};for(const z of d._order){const j=d._layers[z],$=j.source;if(El[j.type]&&!this._coordsDescendingInvStr[$]){this._coordsDescendingInvStr[$]={};for(const ie in this._coordsDescendingInv[$])this._coordsDescendingInvStr[$][ie]=this._coordsDescendingInv[$][ie].map(de=>de.key).sort().join()}}for(const z of this._renderableTiles)for(const j in this._coordsDescendingInvStr){const $=this._coordsDescendingInvStr[j][z.tileID.key];$&&$!==z.rttCoords[j]&&(z.rtt=[])}}renderLayer(d){if(d.isHidden(this.painter.transform.zoom))return!1;const g=d.type,z=this.painter,j=this._renderableLayerIds[this._renderableLayerIds.length-1]===d.id;if(El[g]&&(this._prevType&&El[this._prevType]||this._stacks.push([]),this._prevType=g,this._stacks[this._stacks.length-1].push(d.id),!j))return!0;if(El[this._prevType]||El[g]&&j){this._prevType=g;const $=this._stacks.length-1,ie=this._stacks[$]||[];for(const de of this._renderableTiles){if(this.pool.isFull()&&(Dc(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(de),de.rtt[$]){const Ae=this.pool.getObjectForId(de.rtt[$].id);if(Ae.stamp===de.rtt[$].stamp){this.pool.useObject(Ae);continue}}const xe=this.pool.getOrCreateFreeObject();this.pool.useObject(xe),this.pool.stampObject(xe),de.rtt[$]={id:xe.id,stamp:xe.stamp},z.context.bindFramebuffer.set(xe.fbo.framebuffer),z.context.clear({color:i.aN.transparent,stencil:0}),z.currentStencilSource=void 0;for(let Ae=0;Ae<ie.length;Ae++){const Re=z.style._layers[ie[Ae]],je=Re.source?this._coordsDescendingInv[Re.source][de.tileID.key]:[de.tileID];z.context.viewport.set([0,0,xe.fbo.width,xe.fbo.height]),z._renderTileClippingMasks(Re,je),z.renderLayer(z,z.style.sourceCaches[Re.source],Re,je),Re.source&&(de.rttCoords[Re.source]=this._coordsDescendingInvStr[Re.source][de.tileID.key])}}return Dc(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),El[g]}return!1}}const gh={"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 ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},ih=_,Ou={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Us,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:i.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},co=V=>{V.touchstart=V.dragStart,V.touchmoveWindow=V.dragMove,V.touchend=V.dragEnd},Zl={showCompass:!0,showZoom:!0,visualizePitch:!1};class ui{constructor(d,g,z=!1){this.mousedown=ie=>{this.startMouse(i.e({},ie,{ctrlKey:!0,preventDefault:()=>ie.preventDefault()}),o.mousePos(this.element,ie)),o.addEventListener(window,"mousemove",this.mousemove),o.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=ie=>{this.moveMouse(ie,o.mousePos(this.element,ie))},this.mouseup=ie=>{this.mouseRotate.dragEnd(ie),this.mousePitch&&this.mousePitch.dragEnd(ie),this.offTemp()},this.touchstart=ie=>{ie.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=o.touchPos(this.element,ie.targetTouches)[0],this.startTouch(ie,this._startPos),o.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.addEventListener(window,"touchend",this.touchend))},this.touchmove=ie=>{ie.targetTouches.length!==1?this.reset():(this._lastPos=o.touchPos(this.element,ie.targetTouches)[0],this.moveTouch(ie,this._lastPos))},this.touchend=ie=>{ie.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;const j=d.dragRotate._mouseRotate.getClickTolerance(),$=d.dragRotate._mousePitch.getClickTolerance();this.element=g,this.mouseRotate=yc({clickTolerance:j,enable:!0}),this.touchRotate=(({enable:ie,clickTolerance:de,bearingDegreesPerPixelMoved:xe=.8})=>{const Ae=new nc;return new xs({clickTolerance:de,move:(Re,je)=>({bearingDelta:(je.x-Re.x)*xe}),moveStateManager:Ae,enable:ie,assignEvents:co})})({clickTolerance:j,enable:!0}),this.map=d,z&&(this.mousePitch=Iu({clickTolerance:$,enable:!0}),this.touchPitch=(({enable:ie,clickTolerance:de,pitchDegreesPerPixelMoved:xe=-.5})=>{const Ae=new nc;return new xs({clickTolerance:de,move:(Re,je)=>({pitchDelta:(je.y-Re.y)*xe}),moveStateManager:Ae,enable:ie,assignEvents:co})})({clickTolerance:$,enable:!0})),o.addEventListener(g,"mousedown",this.mousedown),o.addEventListener(g,"touchstart",this.touchstart,{passive:!1}),o.addEventListener(g,"touchcancel",this.reset)}startMouse(d,g){this.mouseRotate.dragStart(d,g),this.mousePitch&&this.mousePitch.dragStart(d,g),o.disableDrag()}startTouch(d,g){this.touchRotate.dragStart(d,g),this.touchPitch&&this.touchPitch.dragStart(d,g),o.disableDrag()}moveMouse(d,g){const z=this.map,{bearingDelta:j}=this.mouseRotate.dragMove(d,g)||{};if(j&&z.setBearing(z.getBearing()+j),this.mousePitch){const{pitchDelta:$}=this.mousePitch.dragMove(d,g)||{};$&&z.setPitch(z.getPitch()+$)}}moveTouch(d,g){const z=this.map,{bearingDelta:j}=this.touchRotate.dragMove(d,g)||{};if(j&&z.setBearing(z.getBearing()+j),this.touchPitch){const{pitchDelta:$}=this.touchPitch.dragMove(d,g)||{};$&&z.setPitch(z.getPitch()+$)}}off(){const d=this.element;o.removeEventListener(d,"mousedown",this.mousedown),o.removeEventListener(d,"touchstart",this.touchstart,{passive:!1}),o.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.removeEventListener(window,"touchend",this.touchend),o.removeEventListener(d,"touchcancel",this.reset),this.offTemp()}offTemp(){o.enableDrag(),o.removeEventListener(window,"mousemove",this.mousemove),o.removeEventListener(window,"mouseup",this.mouseup),o.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.removeEventListener(window,"touchend",this.touchend)}}let Pi;function al(V,d,g){const z=new i.N(V.lng,V.lat);if(V=new i.N(V.lng,V.lat),d){const j=new i.N(V.lng-360,V.lat),$=new i.N(V.lng+360,V.lat),ie=g.locationPoint(V).distSqr(d);g.locationPoint(j).distSqr(d)<ie?V=j:g.locationPoint($).distSqr(d)<ie&&(V=$)}for(;Math.abs(V.lng-g.center.lng)>180;){const j=g.locationPoint(V);if(j.x>=0&&j.y>=0&&j.x<=g.width&&j.y<=g.height)break;V.lng>g.center.lng?V.lng-=360:V.lng+=360}return V.lng!==z.lng&&g.locationPoint(V).y>g.height/2-g.getHorizon()?V:z}const Xl={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 zu(V,d,g){const z=V.classList;for(const j in Xl)z.remove(`maplibregl-${g}-anchor-${j}`);z.add(`maplibregl-${g}-anchor-${d}`)}class bo extends i.E{constructor(d){if(super(),this._onKeyPress=g=>{const z=g.code,j=g.charCode||g.keyCode;z!=="Space"&&z!=="Enter"&&j!==32&&j!==13||this.togglePopup()},this._onMapClick=g=>{const z=g.originalEvent.target,j=this._element;this._popup&&(z===j||j.contains(z))&&this.togglePopup()},this._update=g=>{var z;if(!this._map)return;const j=this._map.loaded()&&!this._map.isMoving();((g==null?void 0:g.type)==="terrain"||(g==null?void 0:g.type)==="render"&&!j)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies?this._lngLat=al(this._lngLat,this._flatPos,this._map.transform):this._lngLat=(z=this._lngLat)===null||z===void 0?void 0:z.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 $="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?$=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&($=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let ie="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?ie="rotateX(0deg)":this._pitchAlignment==="map"&&(ie=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||g&&g.type!=="moveend"||(this._pos=this._pos.round()),o.setTransform(this._element,`${Xl[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${ie} ${$}`),v.frameAsync(new AbortController).then(()=>{this._updateOpacity(g&&g.type==="moveend")}).catch(()=>{})},this._onMove=g=>{if(!this._isDragging){const z=this._clickTolerance||this._map._clickTolerance;this._isDragging=g.point.dist(this._pointerdownPos)>=z}this._isDragging&&(this._pos=g.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 i.k("dragstart"))),this.fire(new i.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 i.k("dragend")),this._state="inactive"},this._addDragHandler=g=>{this._element.contains(g.originalEvent.target)&&(g.preventDefault(),this._positionDelta=g.point.sub(this._pos).add(this._offset),this._pointerdownPos=g.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=d&&d.anchor||"center",this._color=d&&d.color||"#3FB1CE",this._scale=d&&d.scale||1,this._draggable=d&&d.draggable||!1,this._clickTolerance=d&&d.clickTolerance||0,this._subpixelPositioning=d&&d.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=d&&d.rotation||0,this._rotationAlignment=d&&d.rotationAlignment||"auto",this._pitchAlignment=d&&d.pitchAlignment&&d.pitchAlignment!=="auto"?d.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(d==null?void 0:d.opacity,d==null?void 0:d.opacityWhenCovered),d&&d.element)this._element=d.element,this._offset=i.P.convert(d&&d.offset||[0,0]);else{this._defaultMarker=!0,this._element=o.create("div");const g=o.createNS("http://www.w3.org/2000/svg","svg"),z=41,j=27;g.setAttributeNS(null,"display","block"),g.setAttributeNS(null,"height",`${z}px`),g.setAttributeNS(null,"width",`${j}px`),g.setAttributeNS(null,"viewBox",`0 0 ${j} ${z}`);const $=o.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"stroke","none"),$.setAttributeNS(null,"stroke-width","1"),$.setAttributeNS(null,"fill","none"),$.setAttributeNS(null,"fill-rule","evenodd");const ie=o.createNS("http://www.w3.org/2000/svg","g");ie.setAttributeNS(null,"fill-rule","nonzero");const de=o.createNS("http://www.w3.org/2000/svg","g");de.setAttributeNS(null,"transform","translate(3.0, 29.0)"),de.setAttributeNS(null,"fill","#000000");const xe=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const kt of xe){const Bt=o.createNS("http://www.w3.org/2000/svg","ellipse");Bt.setAttributeNS(null,"opacity","0.04"),Bt.setAttributeNS(null,"cx","10.5"),Bt.setAttributeNS(null,"cy","5.80029008"),Bt.setAttributeNS(null,"rx",kt.rx),Bt.setAttributeNS(null,"ry",kt.ry),de.appendChild(Bt)}const Ae=o.createNS("http://www.w3.org/2000/svg","g");Ae.setAttributeNS(null,"fill",this._color);const Re=o.createNS("http://www.w3.org/2000/svg","path");Re.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"),Ae.appendChild(Re);const je=o.createNS("http://www.w3.org/2000/svg","g");je.setAttributeNS(null,"opacity","0.25"),je.setAttributeNS(null,"fill","#000000");const tt=o.createNS("http://www.w3.org/2000/svg","path");tt.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"),je.appendChild(tt);const lt=o.createNS("http://www.w3.org/2000/svg","g");lt.setAttributeNS(null,"transform","translate(6.0, 7.0)"),lt.setAttributeNS(null,"fill","#FFFFFF");const ft=o.createNS("http://www.w3.org/2000/svg","g");ft.setAttributeNS(null,"transform","translate(8.0, 8.0)");const yt=o.createNS("http://www.w3.org/2000/svg","circle");yt.setAttributeNS(null,"fill","#000000"),yt.setAttributeNS(null,"opacity","0.25"),yt.setAttributeNS(null,"cx","5.5"),yt.setAttributeNS(null,"cy","5.5"),yt.setAttributeNS(null,"r","5.4999962");const Ct=o.createNS("http://www.w3.org/2000/svg","circle");Ct.setAttributeNS(null,"fill","#FFFFFF"),Ct.setAttributeNS(null,"cx","5.5"),Ct.setAttributeNS(null,"cy","5.5"),Ct.setAttributeNS(null,"r","5.4999962"),ft.appendChild(yt),ft.appendChild(Ct),ie.appendChild(de),ie.appendChild(Ae),ie.appendChild(je),ie.appendChild(lt),ie.appendChild(ft),g.appendChild(ie),g.setAttributeNS(null,"height",z*this._scale+"px"),g.setAttributeNS(null,"width",j*this._scale+"px"),this._element.appendChild(g),this._offset=i.P.convert(d&&d.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",g=>{g.preventDefault()}),this._element.addEventListener("mousedown",g=>{g.preventDefault()}),zu(this._element,this._anchor,"marker"),d&&d.className)for(const g of d.className.split(" "))this._element.classList.add(g);this._popup=null}addTo(d){return this.remove(),this._map=d,this._element.setAttribute("aria-label",d._getUIString("Marker.Title")),d.getCanvasContainer().appendChild(this._element),d.on("move",this._update),d.on("moveend",this._update),d.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),o.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=i.N.convert(d),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(d){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),d){if(!("offset"in d.options)){const j=Math.abs(13.5)/Math.SQRT2;d.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[j,-1*(24.6+j)],"bottom-right":[-j,-1*(24.6+j)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=d,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(d){return this._subpixelPositioning=d,this}getPopup(){return this._popup}togglePopup(){const d=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:d?(d.isOpen()?d.remove():(d.setLngLat(this._lngLat),d.addTo(this._map)),this):this}_updateOpacity(d=!1){var g,z;if(!(!((g=this._map)===null||g===void 0)&&g.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(d)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const j=this._map,$=j.terrain.depthAtPoint(this._pos),ie=j.terrain.getElevationForLngLatZoom(this._lngLat,j.transform.tileZoom);if(j.transform.lngLatToCameraDepth(this._lngLat,ie)-$<.006)return void(this._element.style.opacity=this._opacity);const de=-this._offset.y/j.transform._pixelPerMeter,xe=Math.sin(j.getPitch()*Math.PI/180)*de,Ae=j.terrain.depthAtPoint(new i.P(this._pos.x,this._pos.y-this._offset.y)),Re=j.transform.lngLatToCameraDepth(this._lngLat,ie+xe)-Ae>.006;!((z=this._popup)===null||z===void 0)&&z.isOpen()&&Re&&this._popup.remove(),this._element.style.opacity=Re?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(d){return this._offset=i.P.convert(d),this._update(),this}addClassName(d){this._element.classList.add(d)}removeClassName(d){this._element.classList.remove(d)}toggleClassName(d){return this._element.classList.toggle(d)}setDraggable(d){return this._draggable=!!d,this._map&&(d?(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(d){return this._rotation=d||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(d){return this._rotationAlignment=d||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(d){return this._pitchAlignment=d&&d!=="auto"?d:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(d,g){return d===void 0&&g===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),d!==void 0&&(this._opacity=d),g!==void 0&&(this._opacityWhenCovered=g),this._map&&this._updateOpacity(!0),this}}const oc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let na=0,bc=!1;class _i extends i.E{constructor(d){super(),this._onSuccess=g=>{if(this._map){if(this._isOutOfMapMaxBounds(g))return this._setErrorState(),this.fire(new i.k("outofmaxbounds",g)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=g,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(g),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(g),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new i.k("geolocate",g)),this._finish()}},this._updateCamera=g=>{const z=new i.N(g.coords.longitude,g.coords.latitude),j=g.coords.accuracy,$=this._map.getBearing(),ie=i.e({bearing:$},this.options.fitBoundsOptions),de=Se.fromLngLat(z,j);this._map.fitBounds(de,ie,{geolocateSource:!0})},this._updateMarker=g=>{if(g){const z=new i.N(g.coords.longitude,g.coords.latitude);this._accuracyCircleMarker.setLngLat(z).addTo(this._map),this._userLocationDotMarker.setLngLat(z).addTo(this._map),this._accuracy=g.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=g=>{if(this._map){if(this.options.trackUserLocation)if(g.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const z=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=z,this._geolocateButton.setAttribute("aria-label",z),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(g.code===3&&bc)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new i.k("error",g)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",g=>g.preventDefault()),this._geolocateButton=o.create("button","maplibregl-ctrl-geolocate",this._container),o.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=g=>{if(this._map){if(g===!1){i.w("Geolocation support is not available so the GeolocateControl will be disabled.");const z=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=z,this._geolocateButton.setAttribute("aria-label",z)}else{const z=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=z,this._geolocateButton.setAttribute("aria-label",z)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=o.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new bo({element:this._dotElement}),this._circleElement=o.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new bo({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",z=>{const j=z.originalEvent&&z.originalEvent.type==="resize";z.geolocateSource||this._watchState!=="ACTIVE_LOCK"||j||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new i.k("trackuserlocationend")),this.fire(new i.k("userlocationlostfocus")))})}},this.options=i.e({},oc,d)}onAdd(d){return this._map=d,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return i._(this,arguments,void 0,function*(g=!1){if(Pi!==void 0&&!g)return Pi;if(window.navigator.permissions===void 0)return Pi=!!window.navigator.geolocation,Pi;try{Pi=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Pi=!!window.navigator.geolocation}return Pi})}().then(g=>this._finishSetupUI(g)),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(),o.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,na=0,bc=!1}_isOutOfMapMaxBounds(d){const g=this._map.getMaxBounds(),z=d.coords;return g&&(z.longitude<g.getWest()||z.longitude>g.getEast()||z.latitude<g.getSouth()||z.latitude>g.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const d=this._map.getBounds(),g=d.getSouthEast(),z=d.getNorthEast(),j=g.distanceTo(z),$=this._map._container.clientHeight,ie=Math.ceil(this._accuracy/(j/$)*2);this._circleElement.style.width=`${ie}px`,this._circleElement.style.height=`${ie}px`}trigger(){if(!this._setup)return i.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 i.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":na--,bc=!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 i.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 i.k("trackuserlocationstart")),this.fire(new i.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 d;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),na++,na>1?(d={maximumAge:6e5,timeout:0},bc=!0):(d=this.options.positionOptions,bc=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,d)}}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)}}const gi={maxWidth:100,unit:"metric"};function Ka(V,d,g){const z=g&&g.maxWidth||100,j=V._container.clientHeight/2,$=V.unproject([0,j]),ie=V.unproject([z,j]),de=$.distanceTo(ie);if(g&&g.unit==="imperial"){const xe=3.2808*de;xe>5280?ss(d,z,xe/5280,V._getUIString("ScaleControl.Miles")):ss(d,z,xe,V._getUIString("ScaleControl.Feet"))}else g&&g.unit==="nautical"?ss(d,z,de/1852,V._getUIString("ScaleControl.NauticalMiles")):de>=1e3?ss(d,z,de/1e3,V._getUIString("ScaleControl.Kilometers")):ss(d,z,de,V._getUIString("ScaleControl.Meters"))}function ss(V,d,g,z){const j=function(ie){const de=Math.pow(10,`${Math.floor(ie)}`.length-1);let xe=ie/de;return xe=xe>=10?10:xe>=5?5:xe>=3?3:xe>=2?2:xe>=1?1:function(Ae){const Re=Math.pow(10,Math.ceil(-Math.log(Ae)/Math.LN10));return Math.round(Ae*Re)/Re}(xe),de*xe}(g),$=j/g;V.style.width=d*$+"px",V.innerHTML=`${j} ${z}`}class sc extends i.E{constructor(d={}){super(),this._onFullscreenChange=()=>{var g;let z=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((g=z==null?void 0:z.shadowRoot)===null||g===void 0)&&g.fullscreenElement;)z=z.shadowRoot.fullscreenElement;z===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,d&&d.container&&(d.container instanceof HTMLElement?this._container=d.container:i.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(d){return this._map=d,this._container||(this._container=this._map.getContainer()),this._controlContainer=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){o.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const d=this._fullscreenButton=o.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);o.create("span","maplibregl-ctrl-icon",d).setAttribute("aria-hidden","true"),d.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const d=this._getTitle();this._fullscreenButton.setAttribute("aria-label",d),this._fullscreenButton.title=d}_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 i.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new i.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()}}const ol={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},gt=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");class xt extends i.E{constructor(d){super(),this.remove=()=>(this._content&&o.remove(this._content),this._container&&(o.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 i.k("close"))),this),this._onMouseUp=g=>{this._update(g.point)},this._onMouseMove=g=>{this._update(g.point)},this._onDrag=g=>{this._update(g.point)},this._update=g=>{var z;const j=this._lngLat||this._trackPointer;if(!this._map||!j||!this._content)return;if(!this._container){if(this._container=o.create("div","maplibregl-popup",this._map.getContainer()),this._tip=o.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const Ae of this.options.className.split(" "))this._container.classList.add(Ae);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._map.transform.renderWorldCopies&&!this._trackPointer?this._lngLat=al(this._lngLat,this._flatPos,this._map.transform):this._lngLat=(z=this._lngLat)===null||z===void 0?void 0:z.wrap(),this._trackPointer&&!g)return;const $=this._flatPos=this._pos=this._trackPointer&&g?g:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&g?g:this._map.transform.locationPoint(this._lngLat));let ie=this.options.anchor;const de=Pt(this.options.offset);if(!ie){const Ae=this._container.offsetWidth,Re=this._container.offsetHeight;let je;je=$.y+de.bottom.y<Re?["top"]:$.y>this._map.transform.height-Re?["bottom"]:[],$.x<Ae/2?je.push("left"):$.x>this._map.transform.width-Ae/2&&je.push("right"),ie=je.length===0?"bottom":je.join("-")}let xe=$.add(de[ie]);this.options.subpixelPositioning||(xe=xe.round()),o.setTransform(this._container,`${Xl[ie]} translate(${xe.x}px,${xe.y}px)`),zu(this._container,ie,"popup")},this._onClose=()=>{this.remove()},this.options=i.e(Object.create(ol),d)}addTo(d){return this._map&&this.remove(),this._map=d,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 i.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=i.N.convert(d),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(d){return this.setDOMContent(document.createTextNode(d))}setHTML(d){const g=document.createDocumentFragment(),z=document.createElement("body");let j;for(z.innerHTML=d;j=z.firstChild,j;)g.appendChild(j);return this.setDOMContent(g)}getMaxWidth(){var d;return(d=this._container)===null||d===void 0?void 0:d.style.maxWidth}setMaxWidth(d){return this.options.maxWidth=d,this._update(),this}setDOMContent(d){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=o.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(d),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(d){return this._container&&this._container.classList.add(d),this}removeClassName(d){return this._container&&this._container.classList.remove(d),this}setOffset(d){return this.options.offset=d,this._update(),this}toggleClassName(d){if(this._container)return this._container.classList.toggle(d)}setSubpixelPositioning(d){this.options.subpixelPositioning=d}_createCloseButton(){this.options.closeButton&&(this._closeButton=o.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const d=this._container.querySelector(gt);d&&d.focus()}}function Pt(V){if(V){if(typeof V=="number"){const d=Math.round(Math.abs(V)/Math.SQRT2);return{center:new i.P(0,0),top:new i.P(0,V),"top-left":new i.P(d,d),"top-right":new i.P(-d,d),bottom:new i.P(0,-V),"bottom-left":new i.P(d,-d),"bottom-right":new i.P(-d,-d),left:new i.P(V,0),right:new i.P(-V,0)}}if(V instanceof i.P||Array.isArray(V)){const d=i.P.convert(V);return{center:d,top:d,"top-left":d,"top-right":d,bottom:d,"bottom-left":d,"bottom-right":d,left:d,right:d}}return{center:i.P.convert(V.center||[0,0]),top:i.P.convert(V.top||[0,0]),"top-left":i.P.convert(V["top-left"]||[0,0]),"top-right":i.P.convert(V["top-right"]||[0,0]),bottom:i.P.convert(V.bottom||[0,0]),"bottom-left":i.P.convert(V["bottom-left"]||[0,0]),"bottom-right":i.P.convert(V["bottom-right"]||[0,0]),left:i.P.convert(V.left||[0,0]),right:i.P.convert(V.right||[0,0])}}return Pt(new i.P(0,0))}const te=_;c.AJAXError=i.bg,c.Evented=i.E,c.LngLat=i.N,c.MercatorCoordinate=i.Z,c.Point=i.P,c.addProtocol=i.bh,c.config=i.a,c.removeProtocol=i.bi,c.AttributionControl=yl,c.BoxZoomHandler=bs,c.CanvasSource=Me,c.CooperativeGesturesHandler=Ml,c.DoubleClickZoomHandler=ao,c.DragPanHandler=$l,c.DragRotateHandler=js,c.EdgeInsets=tc,c.FullscreenControl=sc,c.GeoJSONSource=Ee,c.GeolocateControl=_i,c.Hash=Go,c.ImageSource=Le,c.KeyboardHandler=Bc,c.LngLatBounds=Se,c.LogoControl=os,c.Map=class extends Yo{constructor(V){i.be.mark(i.bf.create);const d=Object.assign(Object.assign({},Ou),V);if(d.minZoom!=null&&d.maxZoom!=null&&d.minZoom>d.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(d.minPitch!=null&&d.maxPitch!=null&&d.minPitch>d.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(d.minPitch!=null&&d.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(d.maxPitch!=null&&d.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ia(d.minZoom,d.maxZoom,d.minPitch,d.maxPitch,d.renderWorldCopies),{bearingSnap:d.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new rh,this._controls=[],this._mapId=i.a4(),this._contextLost=z=>{z.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new i.k("webglcontextlost",{originalEvent:z}))},this._contextRestored=z=>{this._setupPainter(),this.resize(),this._update(),this.fire(new i.k("webglcontextrestored",{originalEvent:z}))},this._onMapScroll=z=>{if(z.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=d.interactive,this._maxTileCacheSize=d.maxTileCacheSize,this._maxTileCacheZoomLevels=d.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=d.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=d.preserveDrawingBuffer===!0,this._antialias=d.antialias===!0,this._trackResize=d.trackResize===!0,this._bearingSnap=d.bearingSnap,this._refreshExpiredTiles=d.refreshExpiredTiles===!0,this._fadeDuration=d.fadeDuration,this._crossSourceCollisions=d.crossSourceCollisions===!0,this._collectResourceTiming=d.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},gh),d.locale),this._clickTolerance=d.clickTolerance,this._overridePixelRatio=d.pixelRatio,this._maxCanvasSize=d.maxCanvasSize,this.transformCameraUpdate=d.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=d.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=S.addThrottleControl(()=>this.isMoving()),this._requestManager=new C(d.transformRequest),typeof d.container=="string"){if(this._container=document.getElementById(d.container),!this._container)throw new Error(`Container '${d.container}' not found.`)}else{if(!(d.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=d.container}if(d.maxBounds&&this.setMaxBounds(d.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 z=!1;const j=gu($=>{this._trackResize&&!this._removed&&this.resize($)._update()},50);this._resizeObserver=new ResizeObserver($=>{z?j($):z=!0}),this._resizeObserver.observe(this._container)}this.handlers=new ba(this,d);const g=typeof d.hash=="string"&&d.hash||void 0;this._hash=d.hash&&new Go(g).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:d.center,zoom:d.zoom,bearing:d.bearing,pitch:d.pitch}),d.bounds&&(this.resize(),this.fitBounds(d.bounds,i.e({},d.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=d.localIdeographFontFamily,this._validateStyle=d.validateStyle,d.style&&this.setStyle(d.style,{localIdeographFontFamily:d.localIdeographFontFamily}),d.attributionControl&&this.addControl(new yl(typeof d.attributionControl=="boolean"?void 0:d.attributionControl)),d.maplibreLogo&&this.addControl(new os,d.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",z=>{this._update(z.dataType==="style"),this.fire(new i.k(`${z.dataType}data`,z))}),this.on("dataloading",z=>{this.fire(new i.k(`${z.dataType}dataloading`,z))}),this.on("dataabort",z=>{this.fire(new i.k("sourcedataabort",z))})}_getMapId(){return this._mapId}addControl(V,d){if(d===void 0&&(d=V.getDefaultPosition?V.getDefaultPosition():"top-right"),!V||!V.onAdd)return this.fire(new i.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const g=V.onAdd(this);this._controls.push(V);const z=this._controlPositions[d];return d.indexOf("bottom")!==-1?z.insertBefore(g,z.firstChild):z.appendChild(g),this}removeControl(V){if(!V||!V.onRemove)return this.fire(new i.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const d=this._controls.indexOf(V);return d>-1&&this._controls.splice(d,1),V.onRemove(this),this}hasControl(V){return this._controls.indexOf(V)>-1}calculateCameraOptionsFromTo(V,d,g,z){return z==null&&this.terrain&&(z=this.terrain.getElevationForLngLatZoom(g,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(V,d,g,z)}resize(V){var d;const g=this._containerDimensions(),z=g[0],j=g[1],$=this._getClampedPixelRatio(z,j);if(this._resizeCanvas(z,j,$),this.painter.resize(z,j,$),this.painter.overLimit()){const de=this.painter.context.gl;this._maxCanvasSize=[de.drawingBufferWidth,de.drawingBufferHeight];const xe=this._getClampedPixelRatio(z,j);this._resizeCanvas(z,j,xe),this.painter.resize(z,j,xe)}this.transform.resize(z,j),(d=this._requestedCameraState)===null||d===void 0||d.resize(z,j);const ie=!this._moving;return ie&&(this.stop(),this.fire(new i.k("movestart",V)).fire(new i.k("move",V))),this.fire(new i.k("resize",V)),ie&&this.fire(new i.k("moveend",V)),this}_getClampedPixelRatio(V,d){const{0:g,1:z}=this._maxCanvasSize,j=this.getPixelRatio(),$=V*j,ie=d*j,de=$>g?g/$:1,xe=ie>z?z/ie:1;return Math.min(de,xe)*j}getPixelRatio(){var V;return(V=this._overridePixelRatio)!==null&&V!==void 0?V:devicePixelRatio}setPixelRatio(V){this._overridePixelRatio=V,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(V){return this.transform.setMaxBounds(Se.convert(V)),this._update()}setMinZoom(V){if((V=V??-2)>=-2&&V<=this.transform.maxZoom)return this.transform.minZoom=V,this._update(),this.getZoom()<V&&this.setZoom(V),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(V){if((V=V??22)>=this.transform.minZoom)return this.transform.maxZoom=V,this._update(),this.getZoom()>V&&this.setZoom(V),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(V){if((V=V??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(V>=0&&V<=this.transform.maxPitch)return this.transform.minPitch=V,this._update(),this.getPitch()<V&&this.setPitch(V),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(V){if((V=V??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(V>=this.transform.minPitch)return this.transform.maxPitch=V,this._update(),this.getPitch()>V&&this.setPitch(V),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(V){return this.transform.renderWorldCopies=V,this._update()}project(V){return this.transform.locationPoint(i.N.convert(V),this.style&&this.terrain)}unproject(V){return this.transform.pointLocation(i.P.convert(V),this.terrain)}isMoving(){var V;return this._moving||((V=this.handlers)===null||V===void 0?void 0:V.isMoving())}isZooming(){var V;return this._zooming||((V=this.handlers)===null||V===void 0?void 0:V.isZooming())}isRotating(){var V;return this._rotating||((V=this.handlers)===null||V===void 0?void 0:V.isRotating())}_createDelegatedListener(V,d,g){if(V==="mouseenter"||V==="mouseover"){let z=!1;return{layer:d,listener:g,delegates:{mousemove:$=>{const ie=this.getLayer(d)?this.queryRenderedFeatures($.point,{layers:[d]}):[];ie.length?z||(z=!0,g.call(this,new Ds(V,this,$.originalEvent,{features:ie}))):z=!1},mouseout:()=>{z=!1}}}}if(V==="mouseleave"||V==="mouseout"){let z=!1;return{layer:d,listener:g,delegates:{mousemove:ie=>{(this.getLayer(d)?this.queryRenderedFeatures(ie.point,{layers:[d]}):[]).length?z=!0:z&&(z=!1,g.call(this,new Ds(V,this,ie.originalEvent)))},mouseout:ie=>{z&&(z=!1,g.call(this,new Ds(V,this,ie.originalEvent)))}}}}{const z=j=>{const $=this.getLayer(d)?this.queryRenderedFeatures(j.point,{layers:[d]}):[];$.length&&(j.features=$,g.call(this,j),delete j.features)};return{layer:d,listener:g,delegates:{[V]:z}}}}on(V,d,g){if(g===void 0)return super.on(V,d);const z=this._createDelegatedListener(V,d,g);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[V]=this._delegatedListeners[V]||[],this._delegatedListeners[V].push(z);for(const j in z.delegates)this.on(j,z.delegates[j]);return this}once(V,d,g){if(g===void 0)return super.once(V,d);const z=this._createDelegatedListener(V,d,g);for(const j in z.delegates)this.once(j,z.delegates[j]);return this}off(V,d,g){return g===void 0?super.off(V,d):(this._delegatedListeners&&this._delegatedListeners[V]&&(z=>{const j=z[V];for(let $=0;$<j.length;$++){const ie=j[$];if(ie.layer===d&&ie.listener===g){for(const de in ie.delegates)this.off(de,ie.delegates[de]);return j.splice($,1),this}}})(this._delegatedListeners),this)}queryRenderedFeatures(V,d){if(!this.style)return[];let g;const z=V instanceof i.P||Array.isArray(V),j=z?V:[[0,0],[this.transform.width,this.transform.height]];if(d=d||(z?{}:V)||{},j instanceof i.P||typeof j[0]=="number")g=[i.P.convert(j)];else{const $=i.P.convert(j[0]),ie=i.P.convert(j[1]);g=[$,new i.P(ie.x,$.y),ie,new i.P($.x,ie.y),$]}return this.style.queryRenderedFeatures(g,d,this.transform)}querySourceFeatures(V,d){return this.style.querySourceFeatures(V,d)}setStyle(V,d){return(d=i.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},d)).diff!==!1&&d.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&V?(this._diffStyle(V,d),this):(this._localIdeographFontFamily=d.localIdeographFontFamily,this._updateStyle(V,d))}setTransformRequest(V){return this._requestManager.setTransformRequest(V),this}_getUIString(V){const d=this._locale[V];if(d==null)throw new Error(`Missing UI string '${V}'`);return d}_updateStyle(V,d){if(d.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(V,d));const g=this.style&&d.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!V)),V?(this.style=new Jr(this,d||{}),this.style.setEventedParent(this,{style:this.style}),typeof V=="string"?this.style.loadURL(V,d,g):this.style.loadJSON(V,d,g),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Jr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(V,d){if(typeof V=="string"){const g=V,z=this._requestManager.transformRequest(g,"Style");i.h(z,new AbortController).then(j=>{this._updateDiff(j.data,d)}).catch(j=>{j&&this.fire(new i.j(j))})}else typeof V=="object"&&this._updateDiff(V,d)}_updateDiff(V,d){try{this.style.setState(V,d)&&this._update(!0)}catch(g){i.w(`Unable to perform style diff: ${g.message||g.error||g}. Rebuilding the style from scratch.`),this._updateStyle(V,d)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():i.w("There is no style added to the map.")}addSource(V,d){return this._lazyInitEmptyStyle(),this.style.addSource(V,d),this._update(!0)}isSourceLoaded(V){const d=this.style&&this.style.sourceCaches[V];if(d!==void 0)return d.loaded();this.fire(new i.j(new Error(`There is no source with ID '${V}'`)))}setTerrain(V){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),V){const d=this.style.sourceCaches[V.source];if(!d)throw new Error(`cannot load terrain, because there exists no source with ID: ${V.source}`);this.terrain===null&&d.reload();for(const g in this.style._layers){const z=this.style._layers[g];z.type==="hillshade"&&z.source===V.source&&i.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 xa(this.painter,d,V),this.painter.renderToTexture=new vu(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=g=>{g.dataType==="style"?this.terrain.sourceCache.freeRtt():g.dataType==="source"&&g.tile&&(g.sourceId!==V.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(g.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 i.k("terrain",{terrain:V})),this}getTerrain(){var V,d;return(d=(V=this.terrain)===null||V===void 0?void 0:V.options)!==null&&d!==void 0?d:null}areTilesLoaded(){const V=this.style&&this.style.sourceCaches;for(const d in V){const g=V[d]._tiles;for(const z in g){const j=g[z];if(j.state!=="loaded"&&j.state!=="errored")return!1}}return!0}removeSource(V){return this.style.removeSource(V),this._update(!0)}getSource(V){return this.style.getSource(V)}addImage(V,d,g={}){const{pixelRatio:z=1,sdf:j=!1,stretchX:$,stretchY:ie,content:de,textFitWidth:xe,textFitHeight:Ae}=g;if(this._lazyInitEmptyStyle(),!(d instanceof HTMLImageElement||i.b(d))){if(d.width===void 0||d.height===void 0)return this.fire(new i.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:Re,height:je,data:tt}=d,lt=d;return this.style.addImage(V,{data:new i.R({width:Re,height:je},new Uint8Array(tt)),pixelRatio:z,stretchX:$,stretchY:ie,content:de,textFitWidth:xe,textFitHeight:Ae,sdf:j,version:0,userImage:lt}),lt.onAdd&<.onAdd(this,V),this}}{const{width:Re,height:je,data:tt}=v.getImageData(d);this.style.addImage(V,{data:new i.R({width:Re,height:je},tt),pixelRatio:z,stretchX:$,stretchY:ie,content:de,textFitWidth:xe,textFitHeight:Ae,sdf:j,version:0})}}updateImage(V,d){const g=this.style.getImage(V);if(!g)return this.fire(new i.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const z=d instanceof HTMLImageElement||i.b(d)?v.getImageData(d):d,{width:j,height:$,data:ie}=z;if(j===void 0||$===void 0)return this.fire(new i.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(j!==g.data.width||$!==g.data.height)return this.fire(new i.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const de=!(d instanceof HTMLImageElement||i.b(d));return g.data.replace(ie,de),this.style.updateImage(V,g),this}getImage(V){return this.style.getImage(V)}hasImage(V){return V?!!this.style.getImage(V):(this.fire(new i.j(new Error("Missing required image id"))),!1)}removeImage(V){this.style.removeImage(V)}loadImage(V){return S.getImage(this._requestManager.transformRequest(V,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(V,d){return this._lazyInitEmptyStyle(),this.style.addLayer(V,d),this._update(!0)}moveLayer(V,d){return this.style.moveLayer(V,d),this._update(!0)}removeLayer(V){return this.style.removeLayer(V),this._update(!0)}getLayer(V){return this.style.getLayer(V)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(V,d,g){return this.style.setLayerZoomRange(V,d,g),this._update(!0)}setFilter(V,d,g={}){return this.style.setFilter(V,d,g),this._update(!0)}getFilter(V){return this.style.getFilter(V)}setPaintProperty(V,d,g,z={}){return this.style.setPaintProperty(V,d,g,z),this._update(!0)}getPaintProperty(V,d){return this.style.getPaintProperty(V,d)}setLayoutProperty(V,d,g,z={}){return this.style.setLayoutProperty(V,d,g,z),this._update(!0)}getLayoutProperty(V,d){return this.style.getLayoutProperty(V,d)}setGlyphs(V,d={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(V,d),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(V,d,g={}){return this._lazyInitEmptyStyle(),this.style.addSprite(V,d,g,z=>{z||this._update(!0)}),this}removeSprite(V){return this._lazyInitEmptyStyle(),this.style.removeSprite(V),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(V,d={}){return this._lazyInitEmptyStyle(),this.style.setSprite(V,d,g=>{g||this._update(!0)}),this}setLight(V,d={}){return this._lazyInitEmptyStyle(),this.style.setLight(V,d),this._update(!0)}getLight(){return this.style.getLight()}setSky(V){return this._lazyInitEmptyStyle(),this.style.setSky(V),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(V,d){return this.style.setFeatureState(V,d),this._update()}removeFeatureState(V,d){return this.style.removeFeatureState(V,d),this._update()}getFeatureState(V){return this.style.getFeatureState(V)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let V=0,d=0;return this._container&&(V=this._container.clientWidth||400,d=this._container.clientHeight||300),[V,d]}_setupContainer(){const V=this._container;V.classList.add("maplibregl-map");const d=this._canvasContainer=o.create("div","maplibregl-canvas-container",V);this._interactive&&d.classList.add("maplibregl-interactive"),this._canvas=o.create("canvas","maplibregl-canvas",d),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","region");const g=this._containerDimensions(),z=this._getClampedPixelRatio(g[0],g[1]);this._resizeCanvas(g[0],g[1],z);const j=this._controlContainer=o.create("div","maplibregl-control-container",V),$=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(ie=>{$[ie]=o.create("div",`maplibregl-ctrl-${ie} `,j)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(V,d,g){this._canvas.width=Math.floor(g*V),this._canvas.height=Math.floor(g*d),this._canvas.style.width=`${V}px`,this._canvas.style.height=`${d}px`}_setupPainter(){const V={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let d=null;this._canvas.addEventListener("webglcontextcreationerror",z=>{d={requestedAttributes:V},z&&(d.statusMessage=z.statusMessage,d.type=z.type)},{once:!0});const g=this._canvas.getContext("webgl2",V)||this._canvas.getContext("webgl",V);if(!g){const z="Failed to initialize WebGL";throw d?(d.message=z,new Error(JSON.stringify(d))):new Error(z)}this.painter=new Oc(g,this.transform),a.testSupport(g)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(V){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||V,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(V){return this._update(),this._renderTaskQueue.add(V)}_cancelRenderFrame(V){this._renderTaskQueue.remove(V)}_render(V){const d=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(V),this._removed)return;let g=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const j=this.transform.zoom,$=v.now();this.style.zoomHistory.update(j,$);const ie=new i.a9(j,{now:$,fadeDuration:d,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),de=ie.crossFadingFactor();de===1&&de===this._crossFadingFactor||(g=!0,this._crossFadingFactor=de),this.style.update(ie)}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,d,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:d,showPadding:this.showPadding}),this.fire(new i.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,i.be.mark(i.bf.load),this.fire(new i.k("load"))),this.style&&(this.style.hasTransitions()||g)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const z=this._sourcesDirty||this._styleDirty||this._placementDirty;return z||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new i.k("idle")),!this._loaded||this._fullyLoaded||z||(this._fullyLoaded=!0,i.be.mark(i.bf.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var V;this._hash&&this._hash.remove();for(const g of this._controls)g.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),S.removeThrottleControl(this._imageQueueHandle),(V=this._resizeObserver)===null||V===void 0||V.disconnect();const d=this.painter.context.gl.getExtension("WEBGL_lose_context");d!=null&&d.loseContext&&d.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),o.remove(this._canvasContainer),o.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),i.be.clearMetrics(),this._removed=!0,this.fire(new i.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,v.frameAsync(this._frameRequest).then(V=>{i.be.frame(V),this._frameRequest=null,this._render(V)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(V){this._showTileBoundaries!==V&&(this._showTileBoundaries=V,this._update())}get showPadding(){return!!this._showPadding}set showPadding(V){this._showPadding!==V&&(this._showPadding=V,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(V){this._showCollisionBoxes!==V&&(this._showCollisionBoxes=V,V?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(V){this._showOverdrawInspector!==V&&(this._showOverdrawInspector=V,this._update())}get repaint(){return!!this._repaint}set repaint(V){this._repaint!==V&&(this._repaint=V,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(V){this._vertices=V,this._update()}get version(){return ih}getCameraTargetElevation(){return this.transform.elevation}},c.MapMouseEvent=Ds,c.MapTouchEvent=ys,c.MapWheelEvent=Mu,c.Marker=bo,c.NavigationControl=class{constructor(V){this._updateZoomButtons=()=>{const d=this._map.getZoom(),g=d===this._map.getMaxZoom(),z=d===this._map.getMinZoom();this._zoomInButton.disabled=g,this._zoomOutButton.disabled=z,this._zoomInButton.setAttribute("aria-disabled",g.toString()),this._zoomOutButton.setAttribute("aria-disabled",z.toString())},this._rotateCompassArrow=()=>{const d=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=d},this._setButtonTitle=(d,g)=>{const z=this._map._getUIString(`NavigationControl.${g}`);d.title=z,d.setAttribute("aria-label",z)},this.options=i.e({},Zl,V),this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",d=>d.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",d=>this._map.zoomIn({},{originalEvent:d})),o.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",d=>this._map.zoomOut({},{originalEvent:d})),o.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",d=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:d}):this._map.resetNorth({},{originalEvent:d})}),this._compassIcon=o.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(V){return this._map=V,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 ui(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){o.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(V,d){const g=o.create("button",V,this._container);return g.type="button",g.addEventListener("click",d),g}},c.Popup=xt,c.RasterDEMTileSource=He,c.RasterTileSource=Pe,c.ScaleControl=class{constructor(V){this._onMove=()=>{Ka(this._map,this._container,this.options)},this.setUnit=d=>{this.options.unit=d,Ka(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},gi),V)}getDefaultPosition(){return"bottom-left"}onAdd(V){return this._map=V,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-scale",V.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){o.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},c.ScrollZoomHandler=Pu,c.Style=Jr,c.TerrainControl=class{constructor(V){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=V}onAdd(V){return this._map=V,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=o.create("button","maplibregl-ctrl-terrain",this._container),o.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(){o.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},c.TwoFingersTouchPitchHandler=rc,c.TwoFingersTouchRotateHandler=zh,c.TwoFingersTouchZoomHandler=ki,c.TwoFingersTouchZoomRotateHandler=Ru,c.VectorTileSource=Ie,c.VideoSource=ve,c.addSourceType=(V,d)=>i._(void 0,void 0,void 0,function*(){if(Ue(V))throw new Error(`A source type called "${V}" already exists.`);((g,z)=>{ke[g]=z})(V,d)}),c.clearPrewarmedResources=function(){const V=fe;V&&(V.isPreloaded()&&V.numActive()===1?(V.release(ce),fe=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()"))},c.getMaxParallelImageRequests=function(){return i.a.MAX_PARALLEL_IMAGE_REQUESTS},c.getRTLTextPluginStatus=function(){return Xe().getRTLTextPluginStatus()},c.getVersion=function(){return te},c.getWorkerCount=function(){return he.workerCount},c.getWorkerUrl=function(){return i.a.WORKER_URL},c.importScriptInWorkers=function(V){return pe().broadcast("IS",V)},c.prewarm=function(){oe().acquire(ce)},c.setMaxParallelImageRequests=function(V){i.a.MAX_PARALLEL_IMAGE_REQUESTS=V},c.setRTLTextPlugin=function(V,d){return Xe().setRTLTextPlugin(V,d)},c.setWorkerCount=function(V){he.workerCount=V},c.setWorkerUrl=function(V){i.a.WORKER_URL=V}}),f}()},88640:function(p,f,n){function l(be,_e,Se){be.prototype=_e.prototype=Se,Se.constructor=be}function c(be,_e){var Se=Object.create(be.prototype);for(var Ce in _e)Se[Ce]=_e[Ce];return Se}function i(){}n.d(f,{GW:function(){return me},Dj:function(){return he}});var _=.7,b=1/_,w="\\s*([+-]?\\d+)\\s*",v="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",o="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",a=/^#([0-9a-f]{3,8})$/,h=new RegExp("^rgb\\(".concat(w,",").concat(w,",").concat(w,"\\)$")),s=new RegExp("^rgb\\(".concat(o,",").concat(o,",").concat(o,"\\)$")),m=new RegExp("^rgba\\(".concat(w,",").concat(w,",").concat(w,",").concat(v,"\\)$")),y=new RegExp("^rgba\\(".concat(o,",").concat(o,",").concat(o,",").concat(v,"\\)$")),x=new RegExp("^hsl\\(".concat(v,",").concat(o,",").concat(o,"\\)$")),S=new RegExp("^hsla\\(".concat(v,",").concat(o,",").concat(o,",").concat(v,"\\)$")),C={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function A(){return this.rgb().formatHex()}function E(){return this.rgb().formatRgb()}function P(be){var _e,Se;return be=(be+"").trim().toLowerCase(),(_e=a.exec(be))?(Se=_e[1].length,_e=parseInt(_e[1],16),Se===6?M(_e):Se===3?new T(_e>>8&15|_e>>4&240,_e>>4&15|240&_e,(15&_e)<<4|15&_e,1):Se===8?L(_e>>24&255,_e>>16&255,_e>>8&255,(255&_e)/255):Se===4?L(_e>>12&15|_e>>8&240,_e>>8&15|_e>>4&240,_e>>4&15|240&_e,((15&_e)<<4|15&_e)/255):null):(_e=h.exec(be))?new T(_e[1],_e[2],_e[3],1):(_e=s.exec(be))?new T(255*_e[1]/100,255*_e[2]/100,255*_e[3]/100,1):(_e=m.exec(be))?L(_e[1],_e[2],_e[3],_e[4]):(_e=y.exec(be))?L(255*_e[1]/100,255*_e[2]/100,255*_e[3]/100,_e[4]):(_e=x.exec(be))?U(_e[1],_e[2]/100,_e[3]/100,1):(_e=S.exec(be))?U(_e[1],_e[2]/100,_e[3]/100,_e[4]):C.hasOwnProperty(be)?M(C[be]):be==="transparent"?new T(NaN,NaN,NaN,0):null}function M(be){return new T(be>>16&255,be>>8&255,255&be,1)}function L(be,_e,Se,Ce){return Ce<=0&&(be=_e=Se=NaN),new T(be,_e,Se,Ce)}function I(be,_e,Se,Ce){return arguments.length===1?((Ie=be)instanceof i||(Ie=P(Ie)),Ie?new T((Ie=Ie.rgb()).r,Ie.g,Ie.b,Ie.opacity):new T):new T(be,_e,Se,Ce??1);var Ie}function T(be,_e,Se,Ce){this.r=+be,this.g=+_e,this.b=+Se,this.opacity=+Ce}function D(){return"#".concat(N(this.r)).concat(N(this.g)).concat(N(this.b))}function k(){var be=O(this.opacity);return"".concat(be===1?"rgb(":"rgba(").concat(F(this.r),", ").concat(F(this.g),", ").concat(F(this.b)).concat(be===1?")":", ".concat(be,")"))}function O(be){return isNaN(be)?1:Math.max(0,Math.min(1,be))}function F(be){return Math.max(0,Math.min(255,Math.round(be)||0))}function N(be){return((be=F(be))<16?"0":"")+be.toString(16)}function U(be,_e,Se,Ce){return Ce<=0?be=_e=Se=NaN:Se<=0||Se>=1?be=_e=NaN:_e<=0&&(be=NaN),new H(be,_e,Se,Ce)}function q(be){if(be instanceof H)return new H(be.h,be.s,be.l,be.opacity);if(be instanceof i||(be=P(be)),!be)return new H;if(be instanceof H)return be;var _e=(be=be.rgb()).r/255,Se=be.g/255,Ce=be.b/255,Ie=Math.min(_e,Se,Ce),Pe=Math.max(_e,Se,Ce),He=NaN,Ee=Pe-Ie,Fe=(Pe+Ie)/2;return Ee?(He=_e===Pe?(Se-Ce)/Ee+6*(Se<Ce):Se===Pe?(Ce-_e)/Ee+2:(_e-Se)/Ee+4,Ee/=Fe<.5?Pe+Ie:2-Pe-Ie,He*=60):Ee=Fe>0&&Fe<1?0:He,new H(He,Ee,Fe,be.opacity)}function H(be,_e,Se,Ce){this.h=+be,this.s=+_e,this.l=+Se,this.opacity=+Ce}function Z(be){return(be=(be||0)%360)<0?be+360:be}function ee(be){return Math.max(0,Math.min(1,be||0))}function G(be,_e,Se){return 255*(be<60?_e+(Se-_e)*be/60:be<180?Se:be<240?_e+(Se-_e)*(240-be)/60:_e)}l(i,P,{copy:function(be){return Object.assign(new this.constructor,this,be)},displayable:function(){return this.rgb().displayable()},hex:A,formatHex:A,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return q(this).formatHsl()},formatRgb:E,toString:E}),l(T,I,c(i,{brighter:function(be){return be=be==null?b:Math.pow(b,be),new T(this.r*be,this.g*be,this.b*be,this.opacity)},darker:function(be){return be=be==null?_:Math.pow(_,be),new T(this.r*be,this.g*be,this.b*be,this.opacity)},rgb:function(){return this},clamp:function(){return new T(F(this.r),F(this.g),F(this.b),O(this.opacity))},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:D,formatHex:D,formatHex8:function(){return"#".concat(N(this.r)).concat(N(this.g)).concat(N(this.b)).concat(N(255*(isNaN(this.opacity)?1:this.opacity)))},formatRgb:k,toString:k})),l(H,function(be,_e,Se,Ce){return arguments.length===1?q(be):new H(be,_e,Se,Ce??1)},c(i,{brighter:function(be){return be=be==null?b:Math.pow(b,be),new H(this.h,this.s,this.l*be,this.opacity)},darker:function(be){return be=be==null?_:Math.pow(_,be),new H(this.h,this.s,this.l*be,this.opacity)},rgb:function(){var be=this.h%360+360*(this.h<0),_e=isNaN(be)||isNaN(this.s)?0:this.s,Se=this.l,Ce=Se+(Se<.5?Se:1-Se)*_e,Ie=2*Se-Ce;return new T(G(be>=240?be-240:be+120,Ie,Ce),G(be,Ie,Ce),G(be<120?be+240:be-120,Ie,Ce),this.opacity)},clamp:function(){return new H(Z(this.h),ee(this.s),ee(this.l),O(this.opacity))},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var be=O(this.opacity);return"".concat(be===1?"hsl(":"hsla(").concat(Z(this.h),", ").concat(100*ee(this.s),"%, ").concat(100*ee(this.l),"%").concat(be===1?")":", ".concat(be,")"))}}));var ne=function(be){return function(){return be}};function K(be,_e){var Se=_e-be;return Se?function(Ce,Ie){return function(Pe){return Ce+Pe*Ie}}(be,Se):ne(isNaN(be)?_e:be)}var X=function be(_e){var Se=function(Ie){return(Ie=+Ie)==1?K:function(Pe,He){return He-Pe?function(Ee,Fe,Le){return Ee=Math.pow(Ee,Le),Fe=Math.pow(Fe,Le)-Ee,Le=1/Le,function(ve){return Math.pow(Ee+ve*Fe,Le)}}(Pe,He,Ie):ne(isNaN(Pe)?He:Pe)}}(_e);function Ce(Ie,Pe){var He=Se((Ie=I(Ie)).r,(Pe=I(Pe)).r),Ee=Se(Ie.g,Pe.g),Fe=Se(Ie.b,Pe.b),Le=K(Ie.opacity,Pe.opacity);return function(ve){return Ie.r=He(ve),Ie.g=Ee(ve),Ie.b=Fe(ve),Ie.opacity=Le(ve),Ie+""}}return Ce.gamma=be,Ce}(1);function Q(be,_e){var Se,Ce=_e?_e.length:0,Ie=be?Math.min(Ce,be.length):0,Pe=new Array(Ie),He=new Array(Ce);for(Se=0;Se<Ie;++Se)Pe[Se]=me(be[Se],_e[Se]);for(;Se<Ce;++Se)He[Se]=_e[Se];return function(Ee){for(Se=0;Se<Ie;++Se)He[Se]=Pe[Se](Ee);return He}}function ce(be,_e){var Se=new Date;return be=+be,_e=+_e,function(Ce){return Se.setTime(be*(1-Ce)+_e*Ce),Se}}function he(be,_e){return be=+be,_e=+_e,function(Se){return be*(1-Se)+_e*Se}}function se(be){return se=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_e){return typeof _e}:function(_e){return _e&&typeof Symbol=="function"&&_e.constructor===Symbol&&_e!==Symbol.prototype?"symbol":typeof _e},se(be)}function fe(be,_e){var Se,Ce={},Ie={};for(Se in be!==null&&se(be)==="object"||(be={}),_e!==null&&se(_e)==="object"||(_e={}),_e)Se in be?Ce[Se]=me(be[Se],_e[Se]):Ie[Se]=_e[Se];return function(Pe){for(Se in Ce)Ie[Se]=Ce[Se](Pe);return Ie}}var re=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,oe=new RegExp(re.source,"g");function le(be,_e){var Se,Ce,Ie,Pe=re.lastIndex=oe.lastIndex=0,He=-1,Ee=[],Fe=[];for(be+="",_e+="";(Se=re.exec(be))&&(Ce=oe.exec(_e));)(Ie=Ce.index)>Pe&&(Ie=_e.slice(Pe,Ie),Ee[He]?Ee[He]+=Ie:Ee[++He]=Ie),(Se=Se[0])===(Ce=Ce[0])?Ee[He]?Ee[He]+=Ce:Ee[++He]=Ce:(Ee[++He]=null,Fe.push({i:He,x:he(Se,Ce)})),Pe=oe.lastIndex;return Pe<_e.length&&(Ie=_e.slice(Pe),Ee[He]?Ee[He]+=Ie:Ee[++He]=Ie),Ee.length<2?Fe[0]?function(Le){return function(ve){return Le(ve)+""}}(Fe[0].x):function(Le){return function(){return Le}}(_e):(_e=Fe.length,function(Le){for(var ve,Me=0;Me<_e;++Me)Ee[(ve=Fe[Me]).i]=ve.x(Le);return Ee.join("")})}function pe(be,_e){_e||(_e=[]);var Se,Ce=be?Math.min(_e.length,be.length):0,Ie=_e.slice();return function(Pe){for(Se=0;Se<Ce;++Se)Ie[Se]=be[Se]*(1-Pe)+_e[Se]*Pe;return Ie}}function ge(be){return ge=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_e){return typeof _e}:function(_e){return _e&&typeof Symbol=="function"&&_e.constructor===Symbol&&_e!==Symbol.prototype?"symbol":typeof _e},ge(be)}function me(be,_e){var Se,Ce,Ie=ge(_e);return _e==null||Ie==="boolean"?ne(_e):(Ie==="number"?he:Ie==="string"?(Se=P(_e))?(_e=Se,X):le:_e instanceof P?X:_e instanceof Date?ce:(Ce=_e,!ArrayBuffer.isView(Ce)||Ce instanceof DataView?Array.isArray(_e)?Q:typeof _e.valueOf!="function"&&typeof _e.toString!="function"||isNaN(_e)?fe:he:pe))(be,_e)}},23648:function(p){p.exports=JSON.parse('["xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller"]')},2362:function(p){p.exports=JSON.parse('["normal","condensed","semi-condensed","extra-condensed","ultra-condensed","expanded","semi-expanded","extra-expanded","ultra-expanded"]')},87486:function(p){p.exports=JSON.parse('["normal","italic","oblique"]')},99803:function(p){p.exports=JSON.parse('["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"]')},54324:function(p){p.exports=JSON.parse('["inherit","initial","unset"]')},94316:function(p){p.exports=JSON.parse('["caption","icon","menu","message-box","small-caption","status-bar"]')},37071:function(p){p.exports=JSON.parse(`{"version":8,"name":"orto","metadata":{"maputnik:renderer":"mlgljs"},"center":[1.537786,41.837539],"zoom":12,"bearing":0,"pitch":0,"light":{"anchor":"viewport","color":"white","intensity":0.4,"position":[1.15,45,30]},"sources":{"ortoEsri":{"type":"raster","tiles":["https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"],"tileSize":256,"maxzoom":18,"attribution":"ESRI © <a href='http://www.esri.com'>ESRI</a>"},"ortoInstaMaps":{"type":"raster","tiles":["https://tilemaps.icgc.cat/mapfactory/wmts/orto_8_12/CAT3857/{z}/{x}/{y}.png"],"tileSize":256,"maxzoom":13},"ortoICGC":{"type":"raster","tiles":["https://geoserveis.icgc.cat/icc_mapesmultibase/noutm/wmts/orto/GRID3857/{z}/{x}/{y}.jpeg"],"tileSize":256,"minzoom":13.1,"maxzoom":20},"openmaptiles":{"type":"vector","url":"https://geoserveis.icgc.cat/contextmaps/basemap.json"}},"sprite":"https://geoserveis.icgc.cat/contextmaps/sprites/sprite@1","glyphs":"https://geoserveis.icgc.cat/contextmaps/glyphs/{fontstack}/{range}.pbf","layers":[{"id":"background","type":"background","paint":{"background-color":"#F4F9F4"}},{"id":"ortoEsri","type":"raster","source":"ortoEsri","maxzoom":16,"layout":{"visibility":"visible"}},{"id":"ortoICGC","type":"raster","source":"ortoICGC","minzoom":13.1,"maxzoom":19,"layout":{"visibility":"visible"}},{"id":"ortoInstaMaps","type":"raster","source":"ortoInstaMaps","maxzoom":13,"layout":{"visibility":"visible"}},{"id":"waterway_tunnel","type":"line","source":"openmaptiles","source-layer":"waterway","minzoom":14,"filter":["all",["in","class","river","stream","canal"],["==","brunnel","tunnel"]],"layout":{"line-cap":"round"},"paint":{"line-color":"#a0c8f0","line-width":{"base":1.3,"stops":[[13,0.5],[20,6]]},"line-dasharray":[2,4]}},{"id":"waterway-other","type":"line","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"waterway","filter":["!in","class","canal","river","stream"],"layout":{"line-cap":"round"},"paint":{"line-color":"#a0c8f0","line-width":{"base":1.3,"stops":[[13,0.5],[20,2]]}}},{"id":"waterway-stream-canal","type":"line","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"waterway","filter":["all",["in","class","canal","stream"],["!=","brunnel","tunnel"]],"layout":{"line-cap":"round"},"paint":{"line-color":"#a0c8f0","line-width":{"base":1.3,"stops":[[13,0.5],[20,6]]}}},{"id":"waterway-river","type":"line","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"waterway","filter":["all",["==","class","river"],["!=","brunnel","tunnel"]],"layout":{"line-cap":"round"},"paint":{"line-color":"#a0c8f0","line-width":{"base":1.2,"stops":[[10,0.8],[20,4]]},"line-opacity":0.5}},{"id":"water-offset","type":"fill","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"water","maxzoom":8,"filter":["==","$type","Polygon"],"layout":{"visibility":"visible"},"paint":{"fill-opacity":0,"fill-color":"#a0c8f0","fill-translate":{"base":1,"stops":[[6,[2,0]],[8,[0,0]]]}}},{"id":"water","type":"fill","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"water","layout":{"visibility":"visible"},"paint":{"fill-color":"hsl(210, 67%, 85%)","fill-opacity":0}},{"id":"water-pattern","type":"fill","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"water","layout":{"visibility":"visible"},"paint":{"fill-translate":[0,2.5],"fill-pattern":"wave","fill-opacity":1}},{"id":"landcover-ice-shelf","type":"fill","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"landcover","filter":["==","subclass","ice_shelf"],"layout":{"visibility":"visible"},"paint":{"fill-color":"#fff","fill-opacity":{"base":1,"stops":[[0,0.9],[10,0.3]]}}},{"id":"tunnel-service-track-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","service","track"]],"layout":{"line-join":"round"},"paint":{"line-color":"#cfcdca","line-dasharray":[0.5,0.25],"line-width":{"base":1.2,"stops":[[15,1],[16,4],[20,11]]}}},{"id":"tunnel-minor-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","minor"]],"layout":{"line-join":"round"},"paint":{"line-color":"#cfcdca","line-opacity":{"stops":[[12,0],[12.5,1]]},"line-width":{"base":1.2,"stops":[[12,0.5],[13,1],[14,4],[20,15]]}}},{"id":"tunnel-secondary-tertiary-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","secondary","tertiary"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[8,1.5],[20,17]]}}},{"id":"tunnel-trunk-primary-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","primary","trunk"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-width":{"base":1.2,"stops":[[5,0.4],[6,0.6],[7,1.5],[20,22]]},"line-opacity":0.7}},{"id":"tunnel-motorway-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","motorway"]],"layout":{"line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-dasharray":[0.5,0.25],"line-width":{"base":1.2,"stops":[[5,0.4],[6,0.6],[7,1.5],[20,22]]},"line-opacity":0.5}},{"id":"tunnel-path","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","brunnel","tunnel"],["==","class","path"]]],"paint":{"line-color":"#cba","line-dasharray":[1.5,0.75],"line-width":{"base":1.2,"stops":[[15,1.2],[20,4]]}}},{"id":"tunnel-service-track","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","service","track"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fff","line-width":{"base":1.2,"stops":[[15.5,0],[16,2],[20,7.5]]}}},{"id":"tunnel-minor","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","minor_road"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fff","line-opacity":1,"line-width":{"base":1.2,"stops":[[13.5,0],[14,2.5],[20,11.5]]}}},{"id":"tunnel-secondary-tertiary","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","secondary","tertiary"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fff4c6","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,10]]}}},{"id":"tunnel-trunk-primary","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","primary","trunk"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fff4c6","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"tunnel-motorway","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","motorway"]],"layout":{"line-join":"round","visibility":"visible"},"paint":{"line-color":"#ffdaa6","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"tunnel-railway","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","rail"]],"paint":{"line-color":"#bbb","line-width":{"base":1.4,"stops":[[14,0.4],[15,0.75],[20,2]]},"line-dasharray":[2,2]}},{"id":"ferry","type":"line","source":"openmaptiles","source-layer":"transportation","filter":["all",["in","class","ferry"]],"layout":{"line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(108, 159, 182, 1)","line-width":1.1,"line-dasharray":[2,2]}},{"id":"aeroway-taxiway-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"aeroway","minzoom":12,"filter":["all",["in","class","taxiway"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(153, 153, 153, 1)","line-width":{"base":1.5,"stops":[[11,2],[17,12]]},"line-opacity":1}},{"id":"aeroway-runway-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"aeroway","minzoom":12,"filter":["all",["in","class","runway"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(153, 153, 153, 1)","line-width":{"base":1.5,"stops":[[11,5],[17,55]]},"line-opacity":1}},{"id":"aeroway-taxiway","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"aeroway","minzoom":4,"filter":["all",["in","class","taxiway"],["==","$type","LineString"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(255, 255, 255, 1)","line-width":{"base":1.5,"stops":[[11,1],[17,10]]},"line-opacity":{"base":1,"stops":[[11,0],[12,1]]}}},{"id":"aeroway-runway","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"aeroway","minzoom":4,"filter":["all",["in","class","runway"],["==","$type","LineString"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(255, 255, 255, 1)","line-width":{"base":1.5,"stops":[[11,4],[17,50]]},"line-opacity":{"base":1,"stops":[[11,0],[12,1]]}}},{"id":"highway-motorway-link-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":12,"filter":["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway_link"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[12,1],[13,3],[14,4],[20,15]]}}},{"id":"highway-link-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":13,"filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[12,1],[13,3],[14,4],[20,15]]}}},{"id":"highway-minor-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!=","brunnel","tunnel"],["in","class","minor","service","track"]]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"#cfcdca","line-opacity":{"stops":[[12,0],[12.5,0]]},"line-width":{"base":1.2,"stops":[[12,0.5],[13,1],[14,4],[20,15]]}}},{"id":"highway-secondary-tertiary-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","secondary","tertiary"]],"layout":{"line-cap":"butt","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-opacity":0.5,"line-width":{"base":1.2,"stops":[[8,1.5],[20,17]]}}},{"id":"highway-primary-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":5,"filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","primary"]],"layout":{"line-cap":"butt","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-opacity":{"stops":[[7,0],[8,0.6]]},"line-width":{"base":1.2,"stops":[[7,0],[8,0.6],[9,1.5],[20,22]]}}},{"id":"highway-trunk-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":5,"filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","trunk"]],"layout":{"line-cap":"butt","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-opacity":{"stops":[[5,0],[6,0.5]]},"line-width":{"base":1.2,"stops":[[5,0],[6,0.6],[7,1.5],[20,22]]}}},{"id":"highway-motorway-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":4,"filter":["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway"]],"layout":{"line-cap":"butt","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-width":{"base":1.2,"stops":[[4,0],[5,0.4],[6,0.6],[7,1.5],[20,22]]},"line-opacity":{"stops":[[4,0],[5,0.5]]}}},{"id":"highway-path","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["==","class","path"]]],"paint":{"line-color":"#cba","line-dasharray":[1.5,0.75],"line-width":{"base":1.2,"stops":[[15,1.2],[20,4]]}}},{"id":"highway-motorway-link","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":12,"filter":["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway_link"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"#fc8","line-width":{"base":1.2,"stops":[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{"id":"highway-link","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":13,"filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{"id":"highway-minor","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!=","brunnel","tunnel"],["in","class","minor","service","track"]]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"#fff","line-opacity":0.5,"line-width":{"base":1.2,"stops":[[13.5,0],[14,2.5],[20,11.5]]}}},{"id":"highway-secondary-tertiary","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","secondary","tertiary"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[6.5,0],[8,0.5],[20,13]]},"line-opacity":0.5}},{"id":"highway-primary","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["in","class","primary"]]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[8.5,0],[9,0.5],[20,18]]},"line-opacity":0}},{"id":"highway-trunk","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["in","class","trunk"]]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"highway-motorway","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":5,"filter":["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway"]]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fc8","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"railway-transit","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","class","transit"],["!in","brunnel","tunnel"]]],"layout":{"visibility":"visible"},"paint":{"line-color":"hsla(0, 0%, 73%, 0.77)","line-width":{"base":1.4,"stops":[[14,0.4],[20,1]]}}},{"id":"railway-transit-hatching","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","class","transit"],["!in","brunnel","tunnel"]]],"layout":{"visibility":"visible"},"paint":{"line-color":"hsla(0, 0%, 73%, 0.68)","line-dasharray":[0.2,8],"line-width":{"base":1.4,"stops":[[14.5,0],[15,2],[20,6]]}}},{"id":"railway-service","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","class","rail"],["has","service"]]],"paint":{"line-color":"hsla(0, 0%, 73%, 0.77)","line-width":{"base":1.4,"stops":[[14,0.4],[20,1]]}}},{"id":"railway-service-hatching","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","class","rail"],["has","service"]]],"layout":{"visibility":"visible"},"paint":{"line-color":"hsla(0, 0%, 73%, 0.68)","line-dasharray":[0.2,8],"line-width":{"base":1.4,"stops":[[14.5,0],[15,2],[20,6]]}}},{"id":"railway","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!has","service"],["!in","brunnel","bridge","tunnel"],["==","class","rail"]]],"paint":{"line-color":"#bbb","line-width":{"base":1.4,"stops":[[14,0.4],[15,0.75],[20,2]]}}},{"id":"railway-hatching","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!has","service"],["!in","brunnel","bridge","tunnel"],["==","class","rail"]]],"paint":{"line-color":"#bbb","line-dasharray":[0.2,8],"line-width":{"base":1.4,"stops":[[14.5,0],[15,3],[20,8]]}}},{"id":"bridge-motorway-link-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","motorway_link"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[12,1],[13,3],[14,4],[20,15]]}}},{"id":"bridge-link-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[12,1],[13,3],[14,4],[20,15]]}}},{"id":"bridge-secondary-tertiary-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","secondary","tertiary"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[8,1.5],[20,28]]}}},{"id":"bridge-trunk-primary-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","primary","trunk"]],"layout":{"line-join":"round"},"paint":{"line-color":"hsl(28, 76%, 67%)","line-width":{"base":1.2,"stops":[[5,0.4],[6,0.6],[7,1.5],[20,26]]}}},{"id":"bridge-motorway-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","motorway"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-width":{"base":1.2,"stops":[[5,0.4],[6,0.6],[7,1.5],[20,22]]},"line-opacity":0.5}},{"id":"bridge-path-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","brunnel","bridge"],["==","class","path"]]],"paint":{"line-color":"#f8f4f0","line-width":{"base":1.2,"stops":[[15,1.2],[20,18]]}}},{"id":"bridge-path","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","brunnel","bridge"],["==","class","path"]]],"paint":{"line-color":"#cba","line-width":{"base":1.2,"stops":[[15,1.2],[20,4]]},"line-dasharray":[1.5,0.75]}},{"id":"bridge-motorway-link","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","motorway_link"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fc8","line-width":{"base":1.2,"stops":[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{"id":"bridge-link","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{"id":"bridge-secondary-tertiary","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","secondary","tertiary"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,20]]}}},{"id":"bridge-trunk-primary","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","primary","trunk"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]}}},{"id":"bridge-motorway","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","motorway"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fc8","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"bridge-railway","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","rail"]],"paint":{"line-color":"#bbb","line-width":{"base":1.4,"stops":[[14,0.4],[15,0.75],[20,2]]}}},{"id":"bridge-railway-hatching","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","rail"]],"paint":{"line-color":"#bbb","line-dasharray":[0.2,8],"line-width":{"base":1.4,"stops":[[14.5,0],[15,3],[20,8]]}}},{"id":"cablecar","type":"line","source":"openmaptiles","source-layer":"transportation","minzoom":13,"filter":["==","class","cable_car"],"layout":{"visibility":"visible","line-cap":"round"},"paint":{"line-color":"hsl(0, 0%, 70%)","line-width":{"base":1,"stops":[[11,1],[19,2.5]]}}},{"id":"cablecar-dash","type":"line","source":"openmaptiles","source-layer":"transportation","minzoom":13,"filter":["==","class","cable_car"],"layout":{"visibility":"visible","line-cap":"round"},"paint":{"line-color":"hsl(0, 0%, 70%)","line-width":{"base":1,"stops":[[11,3],[19,5.5]]},"line-dasharray":[2,3]}},{"id":"boundary-land-level-4","type":"line","source":"openmaptiles","source-layer":"boundary","filter":["all",[">=","admin_level",4],["<=","admin_level",8],["!=","maritime",1]],"layout":{"line-join":"round"},"paint":{"line-color":"#9e9cab","line-dasharray":[3,1,1,1],"line-width":{"base":1.4,"stops":[[4,0.4],[5,1],[12,3]]},"line-opacity":0.6}},{"id":"boundary-land-level-2","type":"line","source":"openmaptiles","source-layer":"boundary","filter":["all",["==","admin_level",2],["!=","maritime",1],["!=","disputed",1]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"hsl(248, 7%, 66%)","line-width":{"base":1,"stops":[[0,0.6],[4,1.4],[5,2],[12,2]]}}},{"id":"boundary-land-disputed","type":"line","source":"openmaptiles","source-layer":"boundary","filter":["all",["!=","maritime",1],["==","disputed",1]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"hsl(248, 7%, 70%)","line-dasharray":[1,3],"line-width":{"base":1,"stops":[[0,0.6],[4,1.4],[5,2],[12,8]]}}},{"id":"boundary-water","type":"line","source":"openmaptiles","source-layer":"boundary","filter":["all",["in","admin_level",2,4],["==","maritime",1]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"rgba(154, 189, 214, 1)","line-width":{"base":1,"stops":[[0,0.6],[4,1],[5,1],[12,1]]},"line-opacity":{"stops":[[6,0],[10,0]]}}},{"id":"waterway-name","type":"symbol","source":"openmaptiles","source-layer":"waterway","minzoom":13,"filter":["all",["==","$type","LineString"],["has","name"]],"layout":{"text-font":["Noto Sans Italic"],"text-size":14,"text-field":"{name:latin} {name:nonlatin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"line","text-letter-spacing":0.2,"symbol-spacing":350},"paint":{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{"id":"water-name-lakeline","type":"symbol","source":"openmaptiles","source-layer":"water_name","filter":["==","$type","LineString"],"layout":{"text-font":["Noto Sans Italic"],"text-size":14,"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"line","symbol-spacing":350,"text-letter-spacing":0.2},"paint":{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{"id":"water-name-ocean","type":"symbol","source":"openmaptiles","source-layer":"water_name","filter":["all",["==","$type","Point"],["==","class","ocean"]],"layout":{"text-font":["Noto Sans Italic"],"text-size":14,"text-field":"{name:latin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"point","symbol-spacing":350,"text-letter-spacing":0.2},"paint":{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{"id":"water-name-other","type":"symbol","source":"openmaptiles","source-layer":"water_name","filter":["all",["==","$type","Point"],["!in","class","ocean"]],"layout":{"text-font":["Noto Sans Italic"],"text-size":{"stops":[[0,10],[6,14]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"point","symbol-spacing":350,"text-letter-spacing":0.2,"visibility":"visible"},"paint":{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{"id":"poi-level-3","type":"symbol","source":"openmaptiles","source-layer":"poi","minzoom":16,"filter":["all",["==","$type","Point"],[">=","rank",25]],"layout":{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":"{name:latin}\\n{name:nonlatin}","text-offset":[0,0.6],"text-size":12,"text-max-width":9},"paint":{"text-halo-blur":0.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{"id":"poi-level-2","type":"symbol","source":"openmaptiles","source-layer":"poi","minzoom":15,"filter":["all",["==","$type","Point"],["<=","rank",24],[">=","rank",15]],"layout":{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":"{name:latin}\\n{name:nonlatin}","text-offset":[0,0.6],"text-size":12,"text-max-width":9},"paint":{"text-halo-blur":0.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{"id":"poi-level-1","type":"symbol","source":"openmaptiles","source-layer":"poi","minzoom":14,"filter":["all",["==","$type","Point"],["<=","rank",14],["has","name"]],"layout":{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":"{name:latin}\\n{name:nonlatin}","text-offset":[0,0.6],"text-size":11,"text-max-width":9},"paint":{"text-halo-blur":0.5,"text-color":"rgba(191, 228, 172, 1)","text-halo-width":1,"text-halo-color":"rgba(30, 29, 29, 1)"}},{"id":"poi-railway","type":"symbol","source":"openmaptiles","source-layer":"poi","minzoom":13,"filter":["all",["==","$type","Point"],["has","name"],["==","class","railway"],["==","subclass","station"]],"layout":{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":"{name:latin}\\n{name:nonlatin}","text-offset":[0,0.6],"text-size":12,"text-max-width":9,"icon-optional":false,"icon-ignore-placement":false,"icon-allow-overlap":false,"text-ignore-placement":false,"text-allow-overlap":false,"text-optional":true},"paint":{"text-halo-blur":0.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{"id":"road_oneway","type":"symbol","source":"openmaptiles","source-layer":"transportation","minzoom":15,"filter":["all",["==","oneway",1],["in","class","motorway","trunk","primary","secondary","tertiary","minor","service"]],"layout":{"symbol-placement":"line","icon-image":"oneway","symbol-spacing":75,"icon-padding":2,"icon-rotation-alignment":"map","icon-rotate":90,"icon-size":{"stops":[[15,0.5],[19,1]]}},"paint":{"icon-opacity":0.5}},{"id":"road_oneway_opposite","type":"symbol","source":"openmaptiles","source-layer":"transportation","minzoom":15,"filter":["all",["==","oneway",-1],["in","class","motorway","trunk","primary","secondary","tertiary","minor","service"]],"layout":{"symbol-placement":"line","icon-image":"oneway","symbol-spacing":75,"icon-padding":2,"icon-rotation-alignment":"map","icon-rotate":-90,"icon-size":{"stops":[[15,0.5],[19,1]]}},"paint":{"icon-opacity":0.5}},{"id":"highway-name-path","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":15.5,"filter":["==","class","path"],"layout":{"text-size":{"base":1,"stops":[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},"paint":{"text-halo-color":"#f8f4f0","text-color":"hsl(30, 23%, 62%)","text-halo-width":0.5}},{"id":"highway-name-minor","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":15,"filter":["all",["==","$type","LineString"],["in","class","minor","service","track"]],"layout":{"text-size":{"base":1,"stops":[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},"paint":{"text-halo-blur":0.5,"text-color":"#765","text-halo-width":1}},{"id":"highway-name-major","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":12.2,"filter":["in","class","primary","secondary","tertiary","trunk"],"layout":{"text-size":{"base":1,"stops":[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},"paint":{"text-halo-blur":0.5,"text-color":"#765","text-halo-width":1}},{"id":"highway-shield","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":8,"filter":["all",["<=","ref_length",6],["==","$type","LineString"],["!in","network","us-interstate","us-highway","us-state"]],"layout":{"text-size":10,"icon-image":"road_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-font":["Noto Sans Regular"],"symbol-placement":{"base":1,"stops":[[10,"point"],[11,"line"]]},"text-rotation-alignment":"viewport","icon-size":1,"text-field":"{ref}"},"paint":{"text-opacity":1,"text-color":"rgba(20, 19, 19, 1)","text-halo-color":"rgba(230, 221, 221, 0)","text-halo-width":2,"icon-color":"rgba(183, 18, 18, 1)","icon-opacity":0.3,"icon-halo-color":"rgba(183, 55, 55, 0)"}},{"id":"highway-shield-us-interstate","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":7,"filter":["all",["<=","ref_length",6],["==","$type","LineString"],["in","network","us-interstate"]],"layout":{"text-size":10,"icon-image":"{network}_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-font":["Noto Sans Regular"],"symbol-placement":{"base":1,"stops":[[7,"point"],[7,"line"],[8,"line"]]},"text-rotation-alignment":"viewport","icon-size":1,"text-field":"{ref}"},"paint":{"text-color":"rgba(0, 0, 0, 1)"}},{"id":"highway-shield-us-other","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":9,"filter":["all",["<=","ref_length",6],["==","$type","LineString"],["in","network","us-highway","us-state"]],"layout":{"text-size":10,"icon-image":"{network}_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-font":["Noto Sans Regular"],"symbol-placement":{"base":1,"stops":[[10,"point"],[11,"line"]]},"text-rotation-alignment":"viewport","icon-size":1,"text-field":"{ref}"},"paint":{"text-color":"rgba(0, 0, 0, 1)"}},{"id":"place-other","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","minzoom":12,"filter":["!in","class","city","town","village","country","continent"],"layout":{"text-letter-spacing":0.1,"text-size":{"base":1.2,"stops":[[12,10],[15,14]]},"text-font":["Noto Sans Bold"],"text-field":"{name:latin}\\n{name:nonlatin}","text-transform":"uppercase","text-max-width":9,"visibility":"visible"},"paint":{"text-color":"rgba(255,255,255,1)","text-halo-width":1.2,"text-halo-color":"rgba(57, 28, 28, 1)"}},{"id":"place-village","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","minzoom":10,"filter":["==","class","village"],"layout":{"text-font":["Noto Sans Regular"],"text-size":{"base":1.2,"stops":[[10,12],[15,16]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":8,"visibility":"visible"},"paint":{"text-color":"rgba(255, 255, 255, 1)","text-halo-width":1.2,"text-halo-color":"rgba(10, 9, 9, 0.8)"}},{"id":"place-town","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["==","class","town"],"layout":{"text-font":["Noto Sans Regular"],"text-size":{"base":1.2,"stops":[[10,14],[15,24]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":8,"visibility":"visible"},"paint":{"text-color":"rgba(255, 255, 255, 1)","text-halo-width":1.2,"text-halo-color":"rgba(22, 22, 22, 0.8)"}},{"id":"place-city","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["!=","capital",2],["==","class","city"]],"layout":{"text-font":["Noto Sans Regular"],"text-size":{"base":1.2,"stops":[[7,14],[11,24]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":8,"visibility":"visible"},"paint":{"text-color":"rgba(0, 0, 0, 1)","text-halo-width":1.2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-city-capital","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","capital",2],["==","class","city"]],"layout":{"text-font":["Noto Sans Regular"],"text-size":{"base":1.2,"stops":[[7,14],[11,24]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":8,"icon-image":"star_11","text-offset":[0.4,0],"icon-size":0.8,"text-anchor":"left","visibility":"visible"},"paint":{"text-color":"#333","text-halo-width":1.2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-country-other","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","class","country"],[">=","rank",3],["!has","iso_a2"]],"layout":{"text-font":["Noto Sans Italic"],"text-field":"{name:latin}","text-size":{"stops":[[3,11],[7,17]]},"text-transform":"uppercase","text-max-width":6.25,"visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-country-3","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","class","country"],[">=","rank",3],["has","iso_a2"]],"layout":{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{"stops":[[3,11],[7,17]]},"text-transform":"uppercase","text-max-width":6.25,"visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-country-2","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","class","country"],["==","rank",2],["has","iso_a2"]],"layout":{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{"stops":[[2,11],[5,17]]},"text-transform":"uppercase","text-max-width":6.25,"visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-country-1","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","class","country"],["==","rank",1],["has","iso_a2"]],"layout":{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{"stops":[[1,11],[4,17]]},"text-transform":"uppercase","text-max-width":6.25,"visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-continent","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","maxzoom":1,"filter":["==","class","continent"],"layout":{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":14,"text-max-width":6.25,"text-transform":"uppercase","visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}}],"id":"qebnlkra6"}`)},51962:function(p){p.exports=JSON.parse(`{"version":8,"name":"orto","metadata":{},"center":[1.537786,41.837539],"zoom":12,"bearing":0,"pitch":0,"light":{"anchor":"viewport","color":"white","intensity":0.4,"position":[1.15,45,30]},"sources":{"ortoEsri":{"type":"raster","tiles":["https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"],"tileSize":256,"maxzoom":18,"attribution":"ESRI © <a href='http://www.esri.com'>ESRI</a>"},"ortoInstaMaps":{"type":"raster","tiles":["https://tilemaps.icgc.cat/mapfactory/wmts/orto_8_12/CAT3857/{z}/{x}/{y}.png"],"tileSize":256,"maxzoom":13},"ortoICGC":{"type":"raster","tiles":["https://geoserveis.icgc.cat/icc_mapesmultibase/noutm/wmts/orto/GRID3857/{z}/{x}/{y}.jpeg"],"tileSize":256,"minzoom":13.1,"maxzoom":20},"openmaptiles":{"type":"vector","url":"https://geoserveis.icgc.cat/contextmaps/basemap.json"}},"sprite":"https://geoserveis.icgc.cat/contextmaps/sprites/sprite@1","glyphs":"https://geoserveis.icgc.cat/contextmaps/glyphs/{fontstack}/{range}.pbf","layers":[{"id":"background","type":"background","paint":{"background-color":"#F4F9F4"}},{"id":"ortoEsri","type":"raster","source":"ortoEsri","maxzoom":16,"layout":{"visibility":"visible"}},{"id":"ortoICGC","type":"raster","source":"ortoICGC","minzoom":13.1,"maxzoom":19,"layout":{"visibility":"visible"}},{"id":"ortoInstaMaps","type":"raster","source":"ortoInstaMaps","maxzoom":13,"layout":{"visibility":"visible"}}]}`)}},u={};function R(p){var f=u[p];if(f!==void 0)return f.exports;var n=u[p]={id:p,exports:{}};return r[p].call(n.exports,n,n.exports,R),n.exports}return R.m=r,R.n=function(p){var f=p&&p.__esModule?function(){return p.default}:function(){return p};return R.d(f,{a:f}),f},R.d=function(p,f){for(var n in f)R.o(f,n)&&!R.o(p,n)&&Object.defineProperty(p,n,{enumerable:!0,get:f[n]})},R.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),R.o=function(p,f){return Object.prototype.hasOwnProperty.call(p,f)},R.r=function(p){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(p,"__esModule",{value:!0})},R.b=document.baseURI||self.location.href,R.nc=void 0,R(20260)}()})})(mP);var UW=mP.exports;const nd=f8(UW),HW={highlightColor:"#E4572E",selectedColor:"#F3A712",unhighlightedColor:"lightblue",highlightHiddenColor:"#1f77b4",annotationBackground:"#f8f8f8"},qW={xPosScalingFactor:80,xPosScalingThreshold:500,minAnnotationWidth:40},WW=wg({name:"PlotlyLineplot",props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(){const t=Cg(),e=zy();return{streamlitDataStore:t,selectionStore:e}},data(){return{isInitialized:!1,manualXRange:void 0,lastAutoZoomedPeakIndex:void 0,textMeasureCanvas:null}},computed:{id(){return`plot-${this.index}`},theme(){return this.streamlitDataStore.theme},styling(){return{...HW,...this.args.styling}},config(){return{...qW,...this.args.config}},actualPlotWidth(){const t=document.getElementById(this.id);if(t){const e=t.getBoundingClientRect();if(e.width>0)return e.width}return 800},plotConfig(){var t;return(t=this.streamlitDataStore.allDataForDrawing)==null?void 0:t._plotConfig},plotData(){var n;const t=(n=this.streamlitDataStore.allDataForDrawing)==null?void 0:n.plotData;if(!t)return;const e=this.plotConfig,r=(e==null?void 0:e.xColumn)||this.args.xColumn||"x",u=(e==null?void 0:e.yColumn)||this.args.yColumn||"y",R={x_values:t[r]||[],y_values:t[u]||[]},p=(e==null?void 0:e.highlightColumn)||this.args.highlightColumn;p&&t[p]&&(R.highlight_mask=t[p]);const f=(e==null?void 0:e.annotationColumn)||this.args.annotationColumn;if(f&&t[f]&&(R.annotations=t[f]),this.args.interactivity)for(const[l,c]of Object.entries(this.args.interactivity)){const i=c;t[i]&&(R[`interactivity_${i}`]=t[i])}return R},interactivity(){return this.args.interactivity||{}},selectedPeakIndex(){if(!(!this.isDataReady||!this.plotData))for(const[t,e]of Object.entries(this.interactivity)){const r=this.selectionStore.$state[t];if(r==null)continue;const u=`interactivity_${e}`,R=this.plotData[u];if(R&&Array.isArray(R)){for(let p=0;p<R.length;p++)if(R[p]===r)return p}else if(e===this.args.xColumn){const p=this.plotData.x_values;for(let f=0;f<p.length;f++)if(p[f]===r)return f}}},isDataReady(){return this.plotData?Array.isArray(this.plotData.x_values)&&Array.isArray(this.plotData.y_values)&&this.plotData.x_values.length>0:!1},xValuesStick(){if(!this.isDataReady||!this.plotData)return[];const t=[];for(const e of this.plotData.x_values)t.push(e,e,e);return t},yValuesStick(){if(!this.isDataReady||!this.plotData)return[];const t=[],e=-1e7;for(const r of this.plotData.y_values)t.push(e,r,e);return t},xRange(){if(this.manualXRange)return this.manualXRange;if(!this.isDataReady||!this.plotData)return[0,1];const t=this.plotData.x_values,e=Math.min(...t),r=Math.max(...t),u=(r-e)*.02;return[e-u,r+u]},yRange(){if(!this.isDataReady||!this.plotData)return[0,1];const{x_values:t,y_values:e}=this.plotData,r=this.xRange;let u=0;for(let R=0;R<t.length;R++){const p=t[R],f=e[R];p>=r[0]&&p<=r[1]&&f>u&&(u=f)}return u===0?[0,1]:[0,u*1.8]},xPosScalingFactor(){const t=this.xRange,e=t[1]-t[0];return 1200/this.actualPlotWidth*e/this.config.xPosScalingFactor},annotatedPeaks(){if(!this.isDataReady||!this.plotData)return[];const{x_values:t,y_values:e,annotations:r,highlight_mask:u}=this.plotData;if(!r)return[];const R=[];for(let p=0;p<r.length;p++){const f=r[p];!f||f.length===0||u&&!u[p]||R.push({x:t[p],y:e[p],label:f,index:p})}return R},annotationBoxData(){const t=this.annotatedPeaks;if(t.length===0)return[];const e=this.yRange,r=this.xRange;if(e[1]<=0||r[1]<=r[0])return[];const u=e[1]/1.8,R=u*1.18,p=u*1.32,f=p-R,n=16,l=[];for(const b of t){const w=b.x>=r[0]&&b.x<=r[1],v=this.measureTextWidth(b.label),o=this.pixelWidthToDataUnits(v+n);l.push({x:b.x,y:(R+p)/2,width:o,height:f,label:b.label,visible:!1,inVisibleRange:w,index:b.index,peakY:b.y})}const c=l.filter(b=>b.inVisibleRange).sort((b,w)=>w.peakY!==b.peakY?w.peakY-b.peakY:b.x-w.x),i=this.pixelWidthToDataUnits(4),_=[];for(const b of c){const w=b.x-b.width/2-i,v=b.x+b.width/2+i;let o=!1;for(const a of _){const h=a.x-a.width/2,s=a.x+a.width/2;if(!(v<h||w>s)){o=!0;break}}o||(b.visible=!0,_.push(b))}return l},annotationShapes(){const t=this.annotationBoxData,e=[],r=this.yRange;if(r[1]<=0)return e;const u=r[1]/1.8,R=u*1.18,p=u*1.32,f=this.selectedPeakIndex;for(const n of t){if(!n.visible)continue;const c=n.index===f?this.styling.selectedColor:this.styling.highlightColor;e.push({type:"rect",x0:n.x-n.width/2,y0:R,x1:n.x+n.width/2,y1:p,fillcolor:c,line:{width:0}})}return e},peakAnnotations(){const t=this.annotationBoxData,e=[],r=this.yRange;if(r[1]<=0)return e;const R=r[1]/1.8*1.25;for(const p of t)p.visible&&e.push({x:p.x,y:R,xref:"x",yref:"y",text:p.label,showarrow:!1,font:{size:14,color:"white"}});return e},selectedAnnotationHidden(){const t=this.selectedPeakIndex;if(t===void 0)return!1;const r=this.annotationBoxData.find(u=>u.index===t);return r?!r.visible:!1},traces(){if(!this.isDataReady||!this.plotData)return this.getFallbackData();const t=[],{highlight_mask:e}=this.plotData,r=this.selectedPeakIndex,u=-1e7,R=[],p=[],f=[],n=[],l=[],c=[],i=this.plotData.x_values.length;for(let _=0;_<i;_++){const b=this.plotData.x_values[_],w=this.plotData.y_values[_],v=e?e[_]:!1;r!==void 0&&_===r?(l.push(b,b,b),c.push(u,w,u)):v?(f.push(b,b,b),n.push(u,w,u)):(R.push(b,b,b),p.push(u,w,u))}return R.length>0&&t.push({x:R,y:p,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.unhighlightedColor},hoverinfo:"x+y"}),f.length>0&&t.push({x:f,y:n,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.highlightColor},hoverinfo:"x+y"}),l.length>0&&t.push({x:l,y:c,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.selectedColor},line:{width:3},hoverinfo:"x+y"}),t.length===0&&t.push({x:this.xValuesStick,y:this.yValuesStick,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.highlightHiddenColor},hoverinfo:"x+y"}),t},layout(){var t,e,r,u,R;return{title:this.args.title?{text:`<b>${this.args.title}</b>`}:void 0,showlegend:!1,height:this.args.height||400,xaxis:{title:this.args.xLabel?{text:this.args.xLabel}:void 0,showgrid:!1,showline:!0,linecolor:"grey",linewidth:1,range:this.xRange},yaxis:{title:this.args.yLabel?{text:this.args.yLabel}:void 0,showgrid:!0,gridcolor:((t=this.theme)==null?void 0:t.secondaryBackgroundColor)||"#f0f0f0",rangemode:"nonnegative",fixedrange:!1,showline:!0,linecolor:"grey",linewidth:1,range:this.yRange},paper_bgcolor:((e=this.theme)==null?void 0:e.backgroundColor)||"white",plot_bgcolor:((r=this.theme)==null?void 0:r.backgroundColor)||"white",font:{color:((u=this.theme)==null?void 0:u.textColor)||"black",family:((R=this.theme)==null?void 0:R.font)||"Arial"},margin:{l:60,r:20,t:this.args.title?50:20,b:50},shapes:this.annotationShapes,annotations:this.peakAnnotations}},cssCustomProperties(){return{"--highlight-color":this.styling.highlightColor,"--selected-color":this.styling.selectedColor,"--unhighlighted-color":this.styling.unhighlightedColor}}},watch:{isDataReady:{handler(t){t&&this.isInitialized&&this.renderPlot()},immediate:!0},"streamlitDataStore.allDataForDrawing.plotData":{handler(t,e){var r,u,R,p;console.log("[LinePlot] plotData changed",{newLength:(r=t==null?void 0:t.x_values)==null?void 0:r.length,oldLength:(u=e==null?void 0:e.x_values)==null?void 0:u.length,newFirstX:(R=t==null?void 0:t.x_values)==null?void 0:R[0],oldFirstX:(p=e==null?void 0:e.x_values)==null?void 0:p[0]}),this.isInitialized&&(this.manualXRange=void 0,this.lastAutoZoomedPeakIndex=void 0,this.renderPlot())},deep:!0},"streamlitDataStore.allDataForDrawing._plotConfig":{handler(){this.isInitialized&&this.renderPlot()},deep:!0},"selectionStore.$state":{handler(t){console.log("[LinePlot] selection changed",t),this.isDataReady&&this.isInitialized&&(this.autoZoomToSelectedAnnotation(),this.renderPlot())},deep:!0}},mounted(){this.isInitialized=!0,this.$nextTick(()=>{this.isDataReady&&this.renderPlot()})},methods:{measureTextWidth(t){this.textMeasureCanvas||(this.textMeasureCanvas=document.createElement("canvas"));const e=this.textMeasureCanvas.getContext("2d");return e?(e.font="14px Arial",e.measureText(t).width):t.length*8},pixelWidthToDataUnits(t){const e=this.xRange,r=e[1]-e[0],u=this.actualPlotWidth;return t/(u/r)},async renderPlot(){try{if(!document.getElementById(this.id)){console.warn(`PlotlyLineplot: DOM element with id '${this.id}' not found`);return}const e=[{title:"Download as SVG",name:"toImageSvg",icon:{width:1792,height:1792,path:"M1152 1376v-160q0-14-9-23t-23-9h-96v-512q0-14-9-23t-23-9h-320q-14 0-23 9t-9 23v160q0 14 9 23t23 9h96v320h-96q-14 0-23 9t-9 23v160q0 14 9 23t23 9h320q14 0 23-9t9-23zm-128-896v-160q0-14-9-23t-23-9h-192q-14 0-23 9t-9 23v160q0 14 9 23t23 9h192q14 0 23-9t9-23zm640 416q0 209-103 385.5t-279.5 279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5 385.5-103 385.5 103 279.5 279.5 103 385.5z"},click:()=>{const u=document.getElementById(this.id);u&&nd.downloadImage(u,{filename:this.args.title||"plot",height:400,width:1200,format:"svg"})}}];await nd.newPlot(this.id,this.traces,this.layout,{modeBarButtonsToRemove:["toImage","sendDataToCloud"],modeBarButtonsToAdd:e,scrollZoom:!0,responsive:!0}),this.$nextTick(()=>{this.args.height?Hc.setFrameHeight(this.args.height):Hc.setFrameHeight()});const r=document.getElementById(this.id);r&&(r.on("plotly_click",u=>{this.onPlotClick(u)}),r.on("plotly_relayout",u=>{this.onRelayout(u)}))}catch(t){console.error("PlotlyLineplot: Error rendering plot:",t),this.renderFallback()}},onRelayout(t){if(t["xaxis.range[0]"]!==void 0&&t["xaxis.range[1]"]!==void 0){const e=[t["xaxis.range[0]"],t["xaxis.range[1]"]];e[0]<0&&(e[0]=0),this.manualXRange=e,this.lastAutoZoomedPeakIndex=void 0,this.renderPlot()}else t["xaxis.autorange"]===!0&&(this.manualXRange=void 0,this.lastAutoZoomedPeakIndex=void 0,this.renderPlot())},autoZoomToSelectedAnnotation(){const t=this.selectedPeakIndex;if(t===void 0){this.lastAutoZoomedPeakIndex=void 0;return}if(t===this.lastAutoZoomedPeakIndex||!this.selectedAnnotationHidden)return;const e=this.calculateZoomForSelectedAnnotation();e&&(this.manualXRange=e,this.lastAutoZoomedPeakIndex=t)},calculateZoomForSelectedAnnotation(){const t=this.selectedPeakIndex;if(t===void 0||!this.plotData)return;const e=this.annotatedPeaks,r=e.find(b=>b.index===t);if(!r)return;let u=1/0,R=1/0;for(const b of e){if(b.index===t)continue;const w=b.x-r.x;w<0&&-w<u?u=-w:w>0&&w<R&&(R=w)}const p=Math.min(u,R);this.actualPlotWidth,this.config.xPosScalingFactor;let f;if(p<1/0)f=p*2;else{const b=this.plotData.x_values;f=(Math.max(...b)-Math.min(...b))*.2}const n=this.plotData.x_values,l=Math.min(...n),c=Math.max(...n);let i=r.x-f/2,_=r.x+f/2;return i<l&&(i=l,_=Math.min(l+f,c)),_>c&&(_=c,i=Math.max(c-f,l)),[i,_]},onPlotClick(t){if(!(!this.interactivity||Object.keys(this.interactivity).length===0)&&t.points&&t.points.length>0){const r=t.points[0].x;if(!this.plotData)return;const u=this.plotData.x_values;let R=0,p=1/0;for(let f=0;f<u.length;f++){const n=Math.abs(u[f]-r);n<p&&(p=n,R=f)}for(const[f,n]of Object.entries(this.interactivity)){const l=`interactivity_${n}`,c=this.plotData[l];c&&Array.isArray(c)&&R<c.length?this.selectionStore.updateSelection(f,c[R]):n===this.args.xColumn&&this.selectionStore.updateSelection(f,u[R])}}},getFallbackData(){return[{x:[0,1],y:[0,0],mode:"lines",type:"scatter",marker:{color:this.styling.unhighlightedColor},name:"No Data"}]},async renderFallback(){var t,e,r,u;try{const R={title:{text:"<b>No Data Available</b>"},showlegend:!1,height:400,xaxis:{title:{text:"X"},showgrid:!1},yaxis:{title:{text:"Y"},showgrid:!0,rangemode:"nonnegative"},paper_bgcolor:((t=this.theme)==null?void 0:t.backgroundColor)||"white",plot_bgcolor:((e=this.theme)==null?void 0:e.backgroundColor)||"white",font:{color:((r=this.theme)==null?void 0:r.textColor)||"black",family:((u=this.theme)==null?void 0:u.font)||"Arial"}};await nd.newPlot(this.id,this.getFallbackData(),R,{staticPlot:!0})}catch(R){console.error("PlotlyLineplot: Failed to render fallback:",R)}}}}),GW=["id"];function $W(t,e,r,u,R,p){return Va(),vo("div",{id:t.id,class:"plot-container",style:ii(t.cssCustomProperties)},null,12,GW)}const h6=Vv(WW,[["render",$W],["__scopeId","data-v-322c72ba"]]);function vP(t){const{id:e,interactivity:r,getData:u,title:R,narrowThreshold:p=600}=t,f=Cg(),n=zy(),l=Wr(800),c=Wr(null),i=rn(()=>l.value<p),_=rn(()=>f.theme),b=rn(()=>{var s,m,y,x;return{paper_bgcolor:((s=_.value)==null?void 0:s.backgroundColor)||"white",plot_bgcolor:((m=_.value)==null?void 0:m.secondaryBackgroundColor)||"#f5f5f5",font:{color:((y=_.value)==null?void 0:y.textColor)||"black",family:((x=_.value)==null?void 0:x.font)||"Arial"}}});function w(){const s=document.getElementById(e.value);s&&window.ResizeObserver&&(c.value=new ResizeObserver(m=>{for(const y of m){const x=y.contentRect.width;Math.abs(x-l.value)>10&&(l.value=x)}}),c.value.observe(s))}function v(){c.value&&(c.value.disconnect(),c.value=null)}function o(s){const m=[{title:"Download as SVG",name:"toImageSvg",icon:nd.Icons.camera,click:y=>{nd.downloadImage(y,{filename:(R==null?void 0:R.value)||"plot",height:400,width:1200,format:"svg"})}},...s||[]];return{modeBarButtonsToRemove:["toImage","sendDataToCloud"],modeBarButtonsToAdd:m,scrollZoom:!0,responsive:!0}}function a(){const s=document.getElementById(e.value);s&&s.on("plotly_click",m=>{const y=r.value;if(!(!y||Object.keys(y).length===0)&&m.points&&m.points.length>0){const x=m.points[0].pointIndex,C=u()[x];if(C)for(const[A,E]of Object.entries(y)){const P=C[E];P!==void 0&&n.updateSelection(A,P)}}})}function h(){Hc.setFrameHeight()}return{plotWidth:l,isNarrowPlot:i,theme:_,themeLayout:b,setupResizeObserver:w,cleanupResizeObserver:v,getPlotConfig:o,setupClickHandler:a,updateFrameHeight:h,selectionStore:n}}const YW=wg({name:"PlotlyHeatmap",props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(t){const e=Cg(),r=vP({id:rn(()=>`heatmap-${t.index}`),interactivity:rn(()=>t.args.interactivity||{}),getData:()=>{var R;return((R=e.allDataForDrawing)==null?void 0:R.heatmapData)||[]},title:rn(()=>t.args.title)});return{streamlitDataStore:e,...r}},data(){return{isInitialized:!1,zoomRange:void 0,colorbarVisible:!0,userOverrideColorbar:!1,heatmapResizeObserver:null,zoomDebounceTimer:null,pendingZoomRange:void 0,zoomThrottleTimer:null,lastZoomUpdateTime:0,plotInitialized:!1}},computed:{id(){return`heatmap-${this.index}`},effectiveColorbarVisible(){return this.userOverrideColorbar?this.colorbarVisible:this.isNarrowPlot?!1:this.colorbarVisible},heatmapData(){var e;return((e=this.streamlitDataStore.allDataForDrawing)==null?void 0:e.heatmapData)||[]},interactivity(){return this.args.interactivity||{}},isDataReady(){return Array.isArray(this.heatmapData)&&this.heatmapData.length>0},xValues(){if(!this.isDataReady)return[];const t=this.args.xColumn;return this.heatmapData.map(e=>e[t])},yValues(){if(!this.isDataReady)return[];const t=this.args.yColumn;return this.heatmapData.map(e=>e[t])},intensityValues(){if(!this.isDataReady)return[];const t=this.args.intensityColumn;return this.heatmapData.map(e=>e[t])},logIntensityValues(){return this.intensityValues.map(t=>t>0?Math.log10(t):0)},isLogScale(){return this.args.logScale!==!1},effectiveColorValues(){return this.isLogScale?this.logIntensityValues:this.intensityValues},colorbarLabel(){return this.args.intensityLabel||"Intensity"},isCategoricalMode(){return!!this.args.categoryColumn},categoryValues(){return!this.isDataReady||!this.args.categoryColumn?[]:this.heatmapData.map(t=>t[this.args.categoryColumn])},uniqueCategories(){if(!this.isCategoricalMode)return[];const t=new Set,e=[];for(const r of this.categoryValues)t.has(r)||(t.add(r),e.push(r));return e},defaultCategoryColors(){return["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"]},getCategoryColor(){const t=this.args.categoryColors||{},e=this.defaultCategoryColors;return r=>{const u=String(r);if(t[u])return t[u];const R=this.uniqueCategories.indexOf(r);return e[R%e.length]}},xRange(){const t=this.zoomRange;if(t&&!(t.xRange[0]<0&&t.xRange[1]<0))return t.xRange},yRange(){const t=this.zoomRange;if(t&&!(t.yRange[0]<0&&t.yRange[1]<0))return t.yRange},colorbarTicks(){if(!this.isLogScale)return null;const t=this.intensityValues.filter(f=>f>0);if(t.length===0)return{tickvals:[0],ticktext:["0"]};const e=Math.min(...t),r=Math.max(...t),u=Math.floor(Math.log10(e)),R=Math.ceil(Math.log10(r)),p=Array.from({length:R-u+1},(f,n)=>Math.pow(10,u+n));return{tickvals:p.map(f=>Math.log10(f)),ticktext:p.map(f=>f.toExponential(0))}},data(){if(!this.isDataReady)return this.getFallbackData();if(this.isCategoricalMode)return this.buildCategoricalTraces();const t=this.colorbarTicks,e={title:{text:this.colorbarLabel}};return t&&(e.tickvals=t.tickvals,e.ticktext=t.ticktext,e.tickmode="array"),[{type:"scattergl",name:"points",x:this.xValues,y:this.yValues,mode:"markers",marker:{color:this.effectiveColorValues,colorscale:this.args.colorscale||"Portland",reversescale:this.args.reversescale??!1,showscale:this.effectiveColorbarVisible,colorbar:e},hovertext:this.intensityValues.map(r=>r.toExponential(2)),hoverinfo:"x+y+text"}]},layout(){const t=this.isCategoricalMode,e=this.isCategoricalMode||this.effectiveColorbarVisible;return{...this.themeLayout,title:this.args.title?{text:`<b>${this.args.title}</b>`}:void 0,showlegend:t,legend:t?{x:1.02,y:1,xanchor:"left",yanchor:"top",bgcolor:"rgba(255, 255, 255, 0.8)",bordercolor:"#ccc",borderwidth:1}:void 0,height:this.args.height||400,xaxis:{title:this.args.xLabel?{text:this.args.xLabel}:void 0,range:this.xRange},yaxis:{title:this.args.yLabel?{text:this.args.yLabel}:void 0,range:this.yRange},margin:{l:60,r:e?120:20,t:this.args.title?60:20,b:60}}}},watch:{isDataReady:{handler(t){t&&this.isInitialized&&this.renderPlot()},immediate:!0},"streamlitDataStore.allDataForDrawing.heatmapData":{handler(){this.isInitialized&&this.renderPlot()},deep:!0},zoomRange:{handler(){if(this.zoomRange===void 0)return;const t=this.args.zoomIdentifier||"heatmap_zoom";this.selectionStore.updateSelection(t,this.zoomRange)},deep:!0}},mounted(){this.isInitialized=!0,this.$nextTick(()=>{this.isDataReady&&this.renderPlot(),this.setupHeatmapResizeObserver()})},beforeUnmount(){this.zoomDebounceTimer&&(clearTimeout(this.zoomDebounceTimer),this.zoomDebounceTimer=null),this.zoomThrottleTimer&&(clearTimeout(this.zoomThrottleTimer),this.zoomThrottleTimer=null),this.plotInitialized=!1,this.cleanupHeatmapResizeObserver()},methods:{buildCategoricalTraces(){const t=this.getCategoryColor,e=[];for(const r of this.uniqueCategories){const u=[];for(let n=0;n<this.categoryValues.length;n++)this.categoryValues[n]===r&&u.push(n);const R=u.map(n=>this.xValues[n]),p=u.map(n=>this.yValues[n]),f=u.map(n=>this.intensityValues[n].toExponential(2));e.push({type:"scattergl",name:String(r),x:R,y:p,mode:"markers",marker:{color:t(r),size:6},hovertext:f,hoverinfo:"x+y+text"})}return e},async renderPlot(){try{if(!document.getElementById(this.id)){console.warn(`PlotlyHeatmap: DOM element with id '${this.id}' not found`);return}this.plotInitialized?(console.debug("[PlotlyHeatmap] renderPlot: using Plotly.react() (update)"),await nd.react(this.id,this.data,this.layout,this.getHeatmapPlotConfig())):(console.debug("[PlotlyHeatmap] renderPlot: using Plotly.newPlot() (first render)"),await nd.newPlot(this.id,this.data,this.layout,this.getHeatmapPlotConfig()),this.setupPlotEventHandlers(),this.plotInitialized=!0),this.$nextTick(()=>{this.updateFrameHeight()})}catch(t){console.error("PlotlyHeatmap: Error rendering plot:",t),this.plotInitialized=!1,this.renderFallback()}},getHeatmapPlotConfig(){const t={title:"Toggle Colorbar",name:"toggleColorbar",icon:{width:1792,height:1792,path:"M1408 768v192q0 40-28 68t-68 28H480q-40 0-68-28t-28-68V768q0-40 28-68t68-28h832q40 0 68 28t28 68zm0-384v192q0 40-28 68t-68 28H480q-40 0-68-28t-28-68V384q0-40 28-68t68-28h832q40 0 68 28t28 68zm0-384v192q0 40-28 68t-68 28H480q-40 0-68-28t-28-68V0q0-40 28-68t68-28h832q40 0 68 28t28 68z",transform:"matrix(1 0 0 -1 0 1792)"},click:()=>{this.toggleColorbar()}};return this.getPlotConfig([t])},setupPlotEventHandlers(){const t=document.getElementById(this.id);t&&(t.on("plotly_relayout",e=>{let r;e["xaxis.autorange"]?r={xRange:[-1,-1],yRange:[-1,-1]}:e["xaxis.range[0]"]!==void 0&&e["xaxis.range[1]"]!==void 0&&e["yaxis.range[0]"]!==void 0&&e["yaxis.range[1]"]!==void 0&&(r={xRange:[e["xaxis.range[0]"],e["xaxis.range[1]"]],yRange:[e["yaxis.range[0]"],e["yaxis.range[1]"]]}),r&&!this.zoomRangesEqual(r,this.zoomRange)&&(this.pendingZoomRange=r,this.debouncedUpdateZoom())}),this.setupClickHandler())},debouncedUpdateZoom(){this.zoomDebounceTimer&&(clearTimeout(this.zoomDebounceTimer),console.debug("[PlotlyHeatmap] Zoom debounced (timer reset)")),this.zoomThrottleTimer&&(clearTimeout(this.zoomThrottleTimer),this.zoomThrottleTimer=null,console.debug("[PlotlyHeatmap] Throttle timer cancelled (user still interacting)")),this.zoomDebounceTimer=setTimeout(()=>{this.zoomDebounceTimer=null;const u=Date.now()-this.lastZoomUpdateTime;if(u>=500)this.applyZoomUpdate();else{this.zoomThrottleTimer&&clearTimeout(this.zoomThrottleTimer);const R=500-u;console.debug(`[PlotlyHeatmap] Throttling zoom update, waiting ${R}ms`),this.zoomThrottleTimer=setTimeout(()=>{this.zoomThrottleTimer=null,this.applyZoomUpdate()},R)}},150)},applyZoomUpdate(){this.pendingZoomRange&&(console.debug("[PlotlyHeatmap] Applying zoom update:",this.pendingZoomRange),this.lastZoomUpdateTime=Date.now(),this.zoomRange=this.pendingZoomRange,this.pendingZoomRange=void 0)},zoomRangesEqual(t,e){return t===e?!0:!t||!e?!1:t.xRange[0]===e.xRange[0]&&t.xRange[1]===e.xRange[1]&&t.yRange[0]===e.yRange[0]&&t.yRange[1]===e.yRange[1]},async toggleColorbar(){this.colorbarVisible=!this.colorbarVisible,this.userOverrideColorbar=!0,await this.updatePlot()},async updatePlot(){const t=document.getElementById(this.id);if(t)try{await nd.restyle(t,{"marker.showscale":this.effectiveColorbarVisible},[0]),await nd.relayout(t,{margin:{r:this.effectiveColorbarVisible?120:20}})}catch{}},setupHeatmapResizeObserver(){const t=document.getElementById(this.id);t&&window.ResizeObserver&&(this.heatmapResizeObserver=new ResizeObserver(e=>{for(const r of e){const u=r.contentRect.width;if(Math.abs(u-this.plotWidth)>10){const R=this.isNarrowPlot;this.plotWidth=u;const p=this.isNarrowPlot;R!==p&&!this.userOverrideColorbar&&(this.colorbarVisible=!p,this.updatePlot())}}}),this.heatmapResizeObserver.observe(t))},cleanupHeatmapResizeObserver(){this.heatmapResizeObserver&&(this.heatmapResizeObserver.disconnect(),this.heatmapResizeObserver=null)},getFallbackData(){return[{type:"scattergl",x:[0],y:[0],mode:"markers",marker:{color:"grey"},name:"No Data"}]},async renderFallback(){try{const t={...this.themeLayout,title:{text:"<b>No Data Available</b>"},showlegend:!1,xaxis:{title:{text:"X"}},yaxis:{title:{text:"Y"}}};await nd.newPlot(this.id,this.getFallbackData(),t,{staticPlot:!0})}catch(t){console.error("PlotlyHeatmap: Failed to render fallback:",t)}}}}),ZW=["id"];function XW(t,e,r,u,R,p){return Va(),vo("div",{id:t.id,class:"heatmap-container"},null,8,ZW)}const f6=Vv(YW,[["render",XW],["__scopeId","data-v-ba3d5702"]]);function d6(t,e,r,u){return e>=u?"ns":t>=r?"up":t<=-r?"down":"ns"}const KW=wg({name:"PlotlyVolcano",props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(t){const e=Cg(),r=vP({id:rn(()=>`volcano-${t.index}`),interactivity:rn(()=>t.args.interactivity||{}),getData:()=>{var R;return((R=e.allDataForDrawing)==null?void 0:R.volcanoData)||[]},title:rn(()=>t.args.title)});return{streamlitDataStore:e,...r}},data(){return{isInitialized:!1}},computed:{id(){return`volcano-${this.index}`},volcanoData(){var e;return((e=this.streamlitDataStore.allDataForDrawing)==null?void 0:e.volcanoData)||[]},isDataReady(){return Array.isArray(this.volcanoData)&&this.volcanoData.length>0},fcThreshold(){return this.args.fcThreshold??1},pThreshold(){return this.args.pThreshold??.05},neglog10PThreshold(){return this.pThreshold>0?-Math.log10(this.pThreshold):0},categorizedData(){const t={x:[],y:[],text:[],indices:[]},e={x:[],y:[],text:[],indices:[]},r={x:[],y:[],text:[],indices:[]},u=this.args.log2fcColumn,R=this.args.neglog10pColumn,p=this.args.pvalueColumn,f=this.args.labelColumn;return this.volcanoData.forEach((n,l)=>{const c=Number(n[u])||0,i=Number(n[R])||0,_=Number(n[p])||1,b=f?String(n[f]||""):"",w=f?`${b}<br>log2FC: ${c.toFixed(3)}<br>p-value: ${_.toExponential(2)}`:`log2FC: ${c.toFixed(3)}<br>p-value: ${_.toExponential(2)}`,v=d6(c,_,this.fcThreshold,this.pThreshold);v==="up"?(t.x.push(c),t.y.push(i),t.text.push(w),t.indices.push(l)):v==="down"?(e.x.push(c),e.y.push(i),e.text.push(w),e.indices.push(l)):(r.x.push(c),r.y.push(i),r.text.push(w),r.indices.push(l))}),{up:t,down:e,ns:r}},plotData(){if(!this.isDataReady)return this.getFallbackData();const{up:t,down:e,ns:r}=this.categorizedData,u=[];return r.x.length>0&&u.push({type:"scattergl",name:"Not significant",x:r.x,y:r.y,mode:"markers",marker:{color:this.args.nsColor||"#95A5A6",size:6,opacity:.6},text:r.text,hoverinfo:"text",customdata:r.indices}),e.x.length>0&&u.push({type:"scattergl",name:"Down-regulated",x:e.x,y:e.y,mode:"markers",marker:{color:this.args.downColor||"#3498DB",size:8},text:e.text,hoverinfo:"text",customdata:e.indices}),t.x.length>0&&u.push({type:"scattergl",name:"Up-regulated",x:t.x,y:t.y,mode:"markers",marker:{color:this.args.upColor||"#E74C3C",size:8},text:t.text,hoverinfo:"text",customdata:t.indices}),u},thresholdShapes(){if(!this.args.showThresholdLines)return[];const t=this.args.thresholdLineStyle||"dash",e=[];return e.push({type:"line",xref:"paper",yref:"y",x0:0,x1:1,y0:this.neglog10PThreshold,y1:this.neglog10PThreshold,line:{color:"rgba(100, 100, 100, 0.5)",width:1.5,dash:t}}),e.push({type:"line",xref:"x",yref:"paper",x0:this.fcThreshold,x1:this.fcThreshold,y0:0,y1:1,line:{color:"rgba(100, 100, 100, 0.5)",width:1.5,dash:t}}),e.push({type:"line",xref:"x",yref:"paper",x0:-this.fcThreshold,x1:-this.fcThreshold,y0:0,y1:1,line:{color:"rgba(100, 100, 100, 0.5)",width:1.5,dash:t}}),e},pointAnnotations(){if(!this.args.labelColumn)return[];const t=this.args.maxLabels??10;if(t<=0)return[];const e=this.args.labelColumn,r=this.args.log2fcColumn,u=this.args.neglog10pColumn,R=this.args.pvalueColumn,p=[];return this.volcanoData.forEach(n=>{const l=Number(n[r])||0,c=Number(n[R])||1,i=Number(n[u])||0,_=String(n[e]||"");d6(l,c,this.fcThreshold,this.pThreshold)!=="ns"&&_&&p.push({label:_,log2fc:l,neglog10p:i})}),p.sort((n,l)=>l.neglog10p-n.neglog10p),p.slice(0,t).map(n=>{var l;return{x:n.log2fc,y:n.neglog10p,text:n.label,showarrow:!0,arrowhead:0,arrowsize:.5,arrowwidth:1,arrowcolor:"rgba(100, 100, 100, 0.5)",ax:0,ay:-25,font:{size:10,color:((l=this.theme)==null?void 0:l.textColor)||"black"},bgcolor:"rgba(255, 255, 255, 0.8)",borderpad:2}})},layout(){return{...this.themeLayout,title:this.args.title?{text:`<b>${this.args.title}</b>`}:void 0,showlegend:!0,legend:{orientation:"h",yanchor:"bottom",y:1.02,xanchor:"right",x:1},height:this.args.height||400,xaxis:{title:{text:this.args.xLabel||"log2 Fold Change"},zeroline:!0,zerolinecolor:"rgba(150, 150, 150, 0.3)",zerolinewidth:1},yaxis:{title:{text:this.args.yLabel||"-log10(p-value)"},rangemode:"tozero"},shapes:this.thresholdShapes,annotations:this.pointAnnotations,margin:{l:60,r:20,t:this.args.title?80:40,b:60}}}},watch:{isDataReady:{handler(t){t&&this.isInitialized&&this.renderPlot()},immediate:!0},"streamlitDataStore.allDataForDrawing.volcanoData":{handler(){this.isInitialized&&this.renderPlot()},deep:!0},fcThreshold(){this.isInitialized&&this.isDataReady&&this.renderPlot()},pThreshold(){this.isInitialized&&this.isDataReady&&this.renderPlot()}},mounted(){this.isInitialized=!0,this.$nextTick(()=>{this.isDataReady&&this.renderPlot(),this.setupResizeObserver()})},beforeUnmount(){this.cleanupResizeObserver()},methods:{async renderPlot(){try{if(!document.getElementById(this.id)){console.warn(`PlotlyVolcano: DOM element with id '${this.id}' not found`);return}await nd.newPlot(this.id,this.plotData,this.layout,this.getPlotConfig()),this.setupClickHandler(),this.$nextTick(()=>{this.updateFrameHeight()})}catch(t){console.error("PlotlyVolcano: Error rendering plot:",t),this.renderFallback()}},getFallbackData(){return[{type:"scattergl",x:[0],y:[0],mode:"markers",marker:{color:"grey"},name:"No Data"}]},async renderFallback(){try{const t={...this.themeLayout,title:{text:"<b>No Data Available</b>"},showlegend:!1,xaxis:{title:{text:"log2 Fold Change"}},yaxis:{title:{text:"-log10(p-value)"}}};await nd.newPlot(this.id,this.getFallbackData(),t,{staticPlot:!0})}catch(t){console.error("PlotlyVolcano: Failed to render fallback:",t)}}}}),JW=["id"];function QW(t,e,r,u,R,p){return Va(),vo("div",{id:t.id,class:"volcano-container"},null,8,JW)}const p6=Vv(KW,[["render",QW],["__scopeId","data-v-1837a4fb"]]),eG=wg({name:"AminoAcidCell",props:{sequenceObject:{type:Object,required:!0},index:{type:Number,required:!0},sequenceLength:{type:Number,required:!0},fixedModification:{type:Boolean,default:!1},showFragments:{type:Boolean,default:!0},fontSize:{type:Number,default:12},isHighlighted:{type:Boolean,default:!1},modification:{type:Number,default:null}},emits:["selected"],setup(){return{streamlitData:Cg()}},computed:{id(){return`aa-${this.aminoAcid}-${this.index}`},theme(){return this.streamlitData.theme},aminoAcid(){return this.sequenceObject.aminoAcid},prefix(){return this.index+1},suffix(){return this.sequenceLength-this.index},hasExtraFragTypes(){return this.sequenceObject.extraTypes.length>0},hasMatchingFragments(){return this.sequenceObject.aIon||this.sequenceObject.bIon||this.sequenceObject.cIon||this.sequenceObject.xIon||this.sequenceObject.yIon||this.sequenceObject.zIon},aminoAcidCellClass(){return{"sequence-amino-acid":!this.fixedModification,"sequence-amino-acid-highlighted":this.fixedModification}},cellStyles(){var e,r,u,R,p;const t=((e=this.theme)==null?void 0:e.base)==="dark";return{"--amino-acid-cell-color":((r=this.theme)==null?void 0:r.textColor)??"#000","--amino-acid-cell-bg-color":((u=this.theme)==null?void 0:u.secondaryBackgroundColor)??"#f0f0f0","--amino-acid-cell-hover-color":((R=this.theme)==null?void 0:R.textColor)??"#000","--amino-acid-cell-hover-bg-color":((p=this.theme)==null?void 0:p.backgroundColor)??"#fff","--amino-acid-font-size":`${this.fontSize}px`,"--mod-mass-bg-color":t?"#e0e0e0":"#fff","--mod-mass-text-color":"#000","--mod-mass-border-color":t?"#666":"#a79c91","--mod-marker-dot-color":t?"rgba(150, 150, 220, 0.8)":"#676a9c","--mod-marker-bg-color":t?"rgba(180, 180, 220, 0.3)":"#e5e5f7","--extra-frag-stroke":t?"rgba(255, 255, 255, 0.5)":"black",position:"relative"}},modificationDisplay(){if(this.modification===null)return"";const t=this.modification;return t>=0?`+${t.toFixed(2)}`:t.toFixed(2)}},methods:{selectCell(){this.hasMatchingFragments&&this.$emit("selected",this.index)}}}),tG=["id"],nG={key:0,class:"frag-marker-container frag-marker-a"},rG={key:1,class:"frag-marker-container frag-marker-b"},iG={key:2,class:"frag-marker-container frag-marker-c"},aG={key:3,class:"frag-marker-container frag-marker-x"},oG={key:4,class:"frag-marker-container frag-marker-y"},sG={key:5,class:"frag-marker-container frag-marker-z"},lG={key:6,class:"rounded-lg mod-marker mod-start"},uG={key:7,class:"rounded-lg mod-marker mod-end"},cG={key:8,class:"rounded-lg mod-mass"},hG={key:9,class:"rounded-lg mod-mass-a"},fG={key:10,class:"rounded-lg mod-mass-b"},dG={key:11,class:"rounded-lg mod-mass-c"},pG={key:12,class:"frag-marker-extra-type"},mG={class:"aa-text"},gG={key:0},vG={key:1},yG={key:2};function bG(t,e,r,u,R,p){const f=iu("v-tooltip");return Va(),vo("div",{id:t.id,class:jr(["d-flex justify-center align-center rounded-lg",[t.aminoAcidCellClass,{highlighted:t.isHighlighted},{"fixed-mod":t.fixedModification}]]),style:ii(t.cellStyles),onClick:e[0]||(e[0]=(...n)=>t.selectCell&&t.selectCell(...n))},[t.showFragments&&t.sequenceObject.aIon?(Va(),vo("div",nG,[...e[1]||(e[1]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"green",d:"M7, 1 L9, 3 L9, 7 L9, 3 L7, 1 z","stroke-width":"1.5"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.bIon?(Va(),vo("div",rG,[...e[2]||(e[2]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"blue",d:"M10, 0 V5 M10, 0 H5 z","stroke-width":"3"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.cIon?(Va(),vo("div",iG,[...e[3]||(e[3]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"red",d:"M4, 1 L9, 3 L9, 7 L9, 3 L4, 1 z","stroke-width":"1.5"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.xIon?(Va(),vo("div",aG,[...e[4]||(e[4]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"green",d:"M1, 3 L1, 7 L3, 9 L1, 7 L1, 3 z","stroke-width":"1.5"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.yIon?(Va(),vo("div",oG,[...e[5]||(e[5]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"blue",d:"M0, 10 V5 M0, 10 H5 z","stroke-width":"3"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.zIon?(Va(),vo("div",sG,[...e[6]||(e[6]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"red",d:"M1, 3 L1, 7 L6, 9 L1, 7 L1, 3 z","stroke-width":"1.5"})],-1)])])):wl("",!0),t.modification!==null?(Va(),vo("div",lG)):wl("",!0),t.modification!==null?(Va(),vo("div",uG)):wl("",!0),t.modification!==null?(Va(),vo("div",cG,[Fs(Bs(t.modificationDisplay)+" ",1),Qt(f,{activator:"parent",class:"foreground"},{default:ds(()=>[Fs(" Modification Mass: "+Bs(t.modificationDisplay)+" Da ",1)]),_:1})])):wl("",!0),t.showFragments&&t.modification!==null&&t.sequenceObject.aIon&&!t.sequenceObject.bIon?(Va(),vo("div",hG,Bs(t.modificationDisplay),1)):wl("",!0),t.showFragments&&t.modification!==null&&t.sequenceObject.bIon?(Va(),vo("div",fG,Bs(t.modificationDisplay),1)):wl("",!0),t.showFragments&&t.modification!==null&&t.sequenceObject.cIon&&!t.sequenceObject.bIon?(Va(),vo("div",dG,Bs(t.modificationDisplay),1)):wl("",!0),t.hasExtraFragTypes?(Va(),vo("div",pG,[...e[7]||(e[7]=[en("svg",{viewBox:"0 0 10 10"},[en("circle",{cx:"5",cy:"5",r:"0.5",class:"extra-frag-circle","stroke-width":"0.3",fill:"gold"})],-1)])])):wl("",!0),en("div",mG,Bs(t.aminoAcid),1),Qt(f,{activator:"parent"},{default:ds(()=>[en("div",null,"Position: "+Bs(t.index+1),1),t.prefix!==void 0?(Va(),vo("div",gG,"Prefix: "+Bs(t.prefix),1)):wl("",!0),t.suffix!==void 0?(Va(),vo("div",vG,"Suffix: "+Bs(t.suffix),1)):wl("",!0),t.hasExtraFragTypes?(Va(),vo("div",yG,Bs(t.sequenceObject.extraTypes.join(", ")),1)):wl("",!0)]),_:1})],14,tG)}const xG=Vv(eG,[["render",bG],["__scopeId","data-v-3401e0d8"]]),_G={default:[{typeName:"",typeMass:0}],"water loss":[{typeName:"-H2O",typeMass:-18.0105646863}],"ammonium loss":[{typeName:"-NH3",typeMass:-17.0265491015}],"proton loss/addition":[{typeName:"-H",typeMass:-1.0078250319},{typeName:"+H",typeMass:1.0078250319}]},wG=1.007276,TG={0:"⁰",1:"¹",2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function kG(t){return String(t).split("").map(e=>TG[e]||e).join("")}const SG=wg({name:"SequenceView",components:{AminoAcidCell:xG},props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(){const t=Cg(),e=zy();return{streamlitDataStore:t,selectionStore:e}},data(){return{rowWidth:35,fontSize:12,autoZoomApplied:!1,showFragments:!0,ionTypes:[{text:"a",selected:!1},{text:"b",selected:!0},{text:"c",selected:!1},{text:"x",selected:!1},{text:"y",selected:!0},{text:"z",selected:!1}],ionTypesExtra:{"water loss":!1,"ammonium loss":!1,"proton loss/addition":!1},fragmentMassTolerance:10,toleranceIsPpm:!0,settingsInitialized:!1,useExternalAnnotations:!0,sequenceObjects:[],fragmentTableData:[],selectedAAIndex:void 0,selectedFragmentRowIndex:void 0,copySnackbar:!1,copySnackbarText:""}},computed:{containerStyle(){return{height:`${this.args.height||400}px`,overflowY:"auto"}},theme(){return this.streamlitDataStore.theme},sequenceData(){return this.streamlitDataStore.allDataForDrawing.sequenceData},observedMasses(){return this.streamlitDataStore.allDataForDrawing.observedMasses??[]},peakIds(){return this.streamlitDataStore.allDataForDrawing.peakIds},precursorMass(){return this.streamlitDataStore.allDataForDrawing.precursorMass??0},interactivity(){return this.args.interactivity??{}},deconvolved(){return this.args.deconvolved??!0},maxCharge(){var t;return((t=this.streamlitDataStore.allDataForDrawing)==null?void 0:t.precursorCharge)??1},sequence(){var t;return((t=this.sequenceData)==null?void 0:t.sequence)??[]},modifications(){var t;return((t=this.sequenceData)==null?void 0:t.modifications)??[]},theoreticalMass(){var t;return((t=this.sequenceData)==null?void 0:t.theoretical_mass)??0},fixedModificationSites(){var t;return((t=this.sequenceData)==null?void 0:t.fixed_modifications)??[]},externalAnnotations(){var t;return((t=this.sequenceData)==null?void 0:t.external_annotations)??[]},hasExternalAnnotations(){return this.externalAnnotations.length>0},defaultTolerance(){var t;return((t=this.sequenceData)==null?void 0:t.fragment_tolerance)??10},defaultToleranceIsPpm(){var t;return((t=this.sequenceData)==null?void 0:t.fragment_tolerance_ppm)??!0},gridClasses(){return{"sequence-grid":!0,[`grid-width-${this.rowWidth}`]:!0}},residueCleavagePercentage(){if(this.sequenceObjects.length<=1)return 0;let t=0;for(let e=0;e<this.sequenceObjects.length-1;e++){const r=this.sequenceObjects[e],u=this.sequenceObjects[e+1];(r.aIon||r.bIon||r.cIon||u.xIon||u.yIon||u.zIon)&&t++}return t/(this.sequence.length-1)*100},fragmentTableHeaders(){const t=[{title:"Name",key:"Name",sortable:!0},{title:"Ion Type",key:"IonType",sortable:!0},{title:"Ion #",key:"IonNumber",sortable:!0}];return this.deconvolved||t.push({title:"z",key:"Charge",sortable:!0}),t.push({title:this.deconvolved?"Theo. Mass":"Theo. m/z",key:"TheoreticalMass",sortable:!0},{title:this.deconvolved?"Obs. Mass":"Obs. m/z",key:"ObservedMass",sortable:!0},{title:"Δ Da",key:"MassDiffDa",sortable:!0},{title:"Δ ppm",key:"MassDiffPpm",sortable:!0}),t}},watch:{sequenceData:{handler(t,e){var R,p,f,n,l,c;const r=((R=t==null?void 0:t.sequence)==null?void 0:R.join(""))??"",u=((p=e==null?void 0:e.sequence)==null?void 0:p.join(""))??"";r!==u&&(this.autoZoomApplied=!1),this.initializeSequenceObjects(),this.applyAutoZoom(),this.settingsInitialized||(((f=this.sequenceData)==null?void 0:f.fragment_tolerance)!==void 0&&(this.fragmentMassTolerance=this.sequenceData.fragment_tolerance),((n=this.sequenceData)==null?void 0:n.fragment_tolerance_ppm)!==void 0&&(this.toleranceIsPpm=this.sequenceData.fragment_tolerance_ppm),((l=this.sequenceData)==null?void 0:l.neutral_losses)!==void 0&&(this.ionTypesExtra["water loss"]=this.sequenceData.neutral_losses,this.ionTypesExtra["ammonium loss"]=this.sequenceData.neutral_losses),((c=this.sequenceData)==null?void 0:c.proton_loss_addition)!==void 0&&(this.ionTypesExtra["proton loss/addition"]=this.sequenceData.proton_loss_addition),this.settingsInitialized=!0),this.matchFragments()},immediate:!0,deep:!0},observedMasses:{handler(){this.matchFragments()},deep:!0},ionTypes:{handler(){this.resetFragmentMarkers(),this.matchFragments()},deep:!0},ionTypesExtra:{handler(){this.resetFragmentMarkers(),this.matchFragments()},deep:!0},fragmentMassTolerance(){this.resetFragmentMarkers(),this.matchFragments()},toleranceIsPpm(){this.resetFragmentMarkers(),this.matchFragments()},useExternalAnnotations(){this.resetFragmentMarkers(),this.matchFragments()}},methods:{initializeSequenceObjects(){this.sequenceObjects=[];for(const t of this.sequence)this.sequenceObjects.push({aminoAcid:t,aIon:!1,bIon:!1,cIon:!1,xIon:!1,yIon:!1,zIon:!1,extraTypes:[]})},applyAutoZoom(){if(this.autoZoomApplied)return;const t=20,e=16;this.sequence.length>0&&this.sequence.length<=t&&(this.rowWidth=t,this.fontSize=e),this.autoZoomApplied=!0},resetFragmentMarkers(){for(const t of this.sequenceObjects)t.aIon=!1,t.bIon=!1,t.cIon=!1,t.xIon=!1,t.yIon=!1,t.zIon=!1,t.extraTypes=[]},getFragmentMasses(t){if(!this.sequenceData)return[];const e=`fragment_masses_${t}`;return this.sequenceData[e]??[]},isWithinTolerance(t,e){return this.toleranceIsPpm?Math.abs(t/e*1e6)<=this.fragmentMassTolerance:Math.abs(t)<=this.fragmentMassTolerance},markAminoAcidPosition(t,e,r){const u=this.sequence.length,p=["a","b","c"].includes(t)?e-1:u-e;if(p>=0&&p<this.sequenceObjects.length){const f=this.sequenceObjects[p],n=`${t}Ion`;f[n]=!0,r&&f.extraTypes.push(`${t}${r}`)}},matchFragmentsExternal(){const t=[];for(const e of this.externalAnnotations){let r=null,u=-1,R=1/0;for(let i=0;i<this.observedMasses.length;i++){const _=this.observedMasses[i],b=Math.abs(_-e.mz);b<R&&(R=b,r=_,u=i)}if(r===null)continue;const p=r-e.mz,f=p/e.mz*1e6;if(!this.isWithinTolerance(p,e.mz))continue;let n=0;const l=e.annotation.match(/[a-z](\d+)/i);l&&(n=parseInt(l[1],10));const c={Name:e.annotation,IonType:e.ion_type,IonNumber:n,TheoreticalMass:e.mz.toFixed(3),ObservedMass:r,MassDiffDa:p.toFixed(3),MassDiffPpm:f.toFixed(3)};e.charge>1&&(c.Charge=e.charge),this.peakIds&&u>=0&&this.peakIds[u]!==void 0&&(c.PeakId=this.peakIds[u]),t.push(c),n>0&&e.ion_type!=="unknown"&&this.markAminoAcidPosition(e.ion_type,n,"")}return t},matchFragmentsTheoretical(){const t=[];this.sequence.length;const e=Object.entries(_G).filter(([u])=>this.ionTypesExtra[u]||u==="default").map(([u,R])=>R).flat(),r=this.deconvolved?[1]:Array.from({length:this.maxCharge},(u,R)=>R+1);for(const u of this.ionTypes.filter(R=>R.selected)){const R=this.getFragmentMasses(u.text);for(let p=0;p<R.length;p++)for(const f of R[p])for(const{typeName:n,typeMass:l}of e){const c=f+l;for(const i of r){const _=this.deconvolved?c:(c+i*wG)/i;for(let b=0;b<this.observedMasses.length;b++){const w=this.observedMasses[b],v=w-_;if(this.isWithinTolerance(v,_)){const o=v/_*1e6,a=`${u.text}${p+1}${n}`,s={Name:this.deconvolved?a:`${a}${kG(i)}⁺`,IonType:`${u.text}${n}`,IonNumber:p+1,TheoreticalMass:_.toFixed(3),ObservedMass:w,MassDiffDa:v.toFixed(3),MassDiffPpm:o.toFixed(3)};this.deconvolved||(s.Charge=i),this.peakIds&&this.peakIds[b]!==void 0&&(s.PeakId=this.peakIds[b]),t.push(s),this.markAminoAcidPosition(u.text,p+1,n)}}}}}return t},matchFragments(){if(this.sequence.length===0||this.observedMasses.length===0){this.fragmentTableData=[],this.streamlitDataStore.setAnnotations(null);return}this.useExternalAnnotations&&this.hasExternalAnnotations?this.fragmentTableData=this.matchFragmentsExternal():this.fragmentTableData=this.matchFragmentsTheoretical();const t=[],e=[],r=[];for(const f of this.fragmentTableData)if(f.PeakId!==void 0){t.push(f.PeakId);const n=f.IonType.charAt(0).toLowerCase(),l=["a","b","c"].includes(n)?"#E4572E":"#1f77b4";e.push(l),r.push(f.Name)}const u=this.streamlitDataStore.annotations,R=(u==null?void 0:u.peak_id)??[],p=t.length!==R.length||t.some((f,n)=>f!==R[n]);t.length>0?this.streamlitDataStore.setAnnotations({peak_id:t,highlight_color:e,annotation:r}):this.streamlitDataStore.setAnnotations(null),p&&this.selectionStore.$patch({counter:(this.selectionStore.$state.counter||0)+1})},isFixedModification(t){return this.fixedModificationSites.includes(t)},onAminoAcidSelected(t){this.selectedAAIndex=t;const e=this.sequenceObjects[t];let r="";if(e.bIon?r=`b${t+1}`:e.aIon?r=`a${t+1}`:e.cIon?r=`c${t+1}`:e.yIon?r=`y${this.sequence.length-t}`:e.xIon?r=`x${this.sequence.length-t}`:e.zIon&&(r=`z${this.sequence.length-t}`),r){const u=this.fragmentTableData.findIndex(R=>R.Name===r);u>=0&&(this.selectedFragmentRowIndex=u)}},onFragmentTableRowClick(t,{item:e}){const r=e.IonType.charAt(0),u=e.IonNumber,p=["a","b","c"].includes(r)?u-1:this.sequence.length-u;if(p>=0&&p<this.sequenceObjects.length&&(this.selectedAAIndex=p),e.PeakId!==void 0&&Object.keys(this.interactivity).length>0)for(const[f,n]of Object.entries(this.interactivity))this.selectionStore.updateSelection(f,e.PeakId)},getRowProps({index:t}){return{class:t===this.selectedFragmentRowIndex?"bg-amber-lighten-4":""}},async copySequence(){try{const t=this.sequence.join("");await navigator.clipboard.writeText(t),this.copySnackbarText="Sequence copied to clipboard!",this.copySnackbar=!0}catch(t){this.copySnackbarText="Failed to copy sequence",this.copySnackbar=!0,console.error("Copy failed:",t)}}}}),AG={class:"d-flex justify-end px-4 mb-4"},CG={class:"d-flex justify-space-evenly"},MG={class:"d-flex justify-space-evenly"},EG={class:"d-flex align-center ga-2"},IG={key:0,class:"d-flex justify-center align-center row-number"},LG={key:1,class:"d-flex justify-center align-center terminal-cell"},PG={key:2,class:"d-flex justify-center align-center row-number"},DG={key:3,class:"d-flex justify-center align-center terminal-cell"},RG={key:0,class:"mt-4"},OG={class:"d-flex justify-space-between align-center mb-2"},zG={class:"text-caption"};function FG(t,e,r,u,R,p){var A;const f=iu("v-icon"),n=iu("v-tooltip"),l=iu("v-btn"),c=iu("v-list-item-title"),i=iu("v-slider"),_=iu("v-list-item"),b=iu("v-checkbox"),w=iu("v-text-field"),v=iu("v-btn-toggle"),o=iu("v-list-item-subtitle"),a=iu("v-list"),h=iu("v-card"),s=iu("v-menu"),m=iu("AminoAcidCell"),y=iu("v-divider"),x=iu("v-data-table"),S=iu("v-sheet"),C=iu("v-snackbar");return Va(),vo("div",{class:"sequence-view-container",style:ii(t.containerStyle)},[Qt(S,{class:"pa-4 rounded-lg",theme:((A=t.theme)==null?void 0:A.base)??"light",border:""},{default:ds(()=>[e[18]||(e[18]=en("div",{class:"d-flex justify-center mb-2"},[en("h4",null,"Sequence View")],-1)),en("div",AG,[Qt(l,{variant:"text",icon:"",size:"small",disabled:t.sequence.length===0,onClick:t.copySequence},{default:ds(()=>[Qt(f,null,{default:ds(()=>[...e[7]||(e[7]=[Fs("mdi-content-copy",-1)])]),_:1}),Qt(n,{activator:"parent",location:"bottom"},{default:ds(()=>[...e[8]||(e[8]=[Fs("Copy sequence to clipboard",-1)])]),_:1})]),_:1},8,["disabled","onClick"]),Qt(l,{id:"settings-btn",variant:"text",icon:"",size:"small"},{default:ds(()=>[Qt(f,null,{default:ds(()=>[...e[9]||(e[9]=[Fs("mdi-cog",-1)])]),_:1})]),_:1}),Qt(s,{"close-on-content-click":!1,activator:"#settings-btn",location:"bottom"},{default:ds(()=>[Qt(h,{"min-width":"300"},{default:ds(()=>[Qt(a,null,{default:ds(()=>[Qt(_,null,{default:ds(()=>[Qt(c,null,{default:ds(()=>[...e[10]||(e[10]=[Fs("# amino acids per row",-1)])]),_:1}),Qt(i,{modelValue:t.rowWidth,"onUpdate:modelValue":e[0]||(e[0]=E=>t.rowWidth=E),ticks:{20:"20",25:"25",30:"30",35:"35",40:"40"},min:20,max:40,step:"5","show-ticks":"always","tick-size":"4"},null,8,["modelValue"])]),_:1}),Qt(_,null,{default:ds(()=>[Qt(c,null,{default:ds(()=>[...e[11]||(e[11]=[Fs("Font Size",-1)])]),_:1}),Qt(i,{modelValue:t.fontSize,"onUpdate:modelValue":e[1]||(e[1]=E=>t.fontSize=E),ticks:{8:"8",10:"10",12:"12",14:"14",16:"16"},min:8,max:16,step:"2","show-ticks":"always","tick-size":"4"},null,8,["modelValue"])]),_:1}),Qt(_,null,{default:ds(()=>[Qt(c,null,{default:ds(()=>[...e[12]||(e[12]=[Fs("Show Fragments",-1)])]),_:1}),Qt(b,{modelValue:t.showFragments,"onUpdate:modelValue":e[2]||(e[2]=E=>t.showFragments=E),"hide-details":"",density:"comfortable"},null,8,["modelValue"])]),_:1}),Qt(_,null,{default:ds(()=>[Qt(c,null,{default:ds(()=>[...e[13]||(e[13]=[Fs("Fragment ion types",-1)])]),_:1}),en("div",CG,[(Va(!0),vo(yi,null,z_(t.ionTypes,E=>(Va(),ty(b,{key:E.text,modelValue:E.selected,"onUpdate:modelValue":P=>E.selected=P,label:E.text,disabled:!t.showFragments,"hide-details":"",density:"comfortable"},null,8,["modelValue","onUpdate:modelValue","label","disabled"]))),128))]),en("div",MG,[(Va(!0),vo(yi,null,z_(t.ionTypesExtra,(E,P)=>(Va(),ty(b,{key:P,modelValue:t.ionTypesExtra[P],"onUpdate:modelValue":M=>t.ionTypesExtra[P]=M,label:P,disabled:!t.showFragments,"hide-details":"",density:"comfortable"},null,8,["modelValue","onUpdate:modelValue","label","disabled"]))),128))])]),_:1}),Qt(_,null,{default:ds(()=>[Qt(c,null,{default:ds(()=>[...e[14]||(e[14]=[Fs("Fragment mass tolerance",-1)])]),_:1}),en("div",EG,[Qt(w,{modelValue:t.fragmentMassTolerance,"onUpdate:modelValue":e[3]||(e[3]=E=>t.fragmentMassTolerance=E),modelModifiers:{number:!0},type:"number","hide-details":"auto",disabled:!t.showFragments,density:"compact",style:{"max-width":"100px"}},null,8,["modelValue","disabled"]),Qt(v,{modelValue:t.toleranceIsPpm,"onUpdate:modelValue":e[4]||(e[4]=E=>t.toleranceIsPpm=E),mandatory:"",density:"compact",disabled:!t.showFragments},{default:ds(()=>[Qt(l,{value:!0,size:"small"},{default:ds(()=>[...e[15]||(e[15]=[Fs("ppm",-1)])]),_:1}),Qt(l,{value:!1,size:"small"},{default:ds(()=>[...e[16]||(e[16]=[Fs("Da",-1)])]),_:1})]),_:1},8,["modelValue","disabled"])])]),_:1}),t.hasExternalAnnotations?(Va(),ty(_,{key:0},{default:ds(()=>[Qt(c,null,{default:ds(()=>[...e[17]||(e[17]=[Fs("Use search engine annotations",-1)])]),_:1}),Qt(b,{modelValue:t.useExternalAnnotations,"onUpdate:modelValue":e[5]||(e[5]=E=>t.useExternalAnnotations=E),disabled:!t.showFragments,"hide-details":"",density:"comfortable"},null,8,["modelValue","disabled"]),Qt(o,{class:"text-caption"},{default:ds(()=>[Fs(Bs(t.externalAnnotations.length)+" annotations from idXML ",1)]),_:1})]),_:1})):wl("",!0)]),_:1})]),_:1})]),_:1})]),en("div",{class:jr(["px-2 pb-4",t.gridClasses]),style:{width:"100%","max-width":"100%"}},[(Va(!0),vo(yi,null,z_(t.sequenceObjects,(E,P)=>(Va(),vo(yi,{key:P},[P!==0&&P%t.rowWidth===0?(Va(),vo("div",IG,Bs(P+1),1)):wl("",!0),P===0?(Va(),vo("div",LG,"N")):wl("",!0),Qt(m,{"sequence-object":E,index:P,"sequence-length":t.sequence.length,"fixed-modification":t.isFixedModification(E.aminoAcid),"show-fragments":t.showFragments,"font-size":t.fontSize,"is-highlighted":t.selectedAAIndex===P,modification:t.modifications[P]??null,onSelected:t.onAminoAcidSelected},null,8,["sequence-object","index","sequence-length","fixed-modification","show-fragments","font-size","is-highlighted","modification","onSelected"]),P%t.rowWidth===t.rowWidth-1&&P!==t.sequence.length-1?(Va(),vo("div",PG,Bs(P+1),1)):wl("",!0),P===t.sequence.length-1?(Va(),vo("div",DG," C ")):wl("",!0)],64))),128))],2),t.showFragments&&t.fragmentTableData.length>0?(Va(),vo("div",RG,[Qt(y,{class:"mb-4"}),en("div",OG,[en("h5",null,"Matching Fragments ("+Bs(t.fragmentTableData.length)+")",1),en("span",zG,"Residue cleavage: "+Bs(t.residueCleavagePercentage.toFixed(1))+"%",1)]),Qt(x,{headers:t.fragmentTableHeaders,items:t.fragmentTableData,"items-per-page":10,density:"compact",class:"elevation-1","row-props":t.getRowProps,"onClick:row":t.onFragmentTableRowClick},null,8,["headers","items","row-props","onClick:row"])])):wl("",!0)]),_:1},8,["theme"]),Qt(C,{modelValue:t.copySnackbar,"onUpdate:modelValue":e[6]||(e[6]=E=>t.copySnackbar=E),timeout:2e3,location:"bottom"},{default:ds(()=>[Fs(Bs(t.copySnackbarText),1)]),_:1},8,["modelValue"])],4)}const m6=Vv(SG,[["render",FG],["__scopeId","data-v-320b86db"]]),BG=wg({name:"App",components:{TabulatorTable:c6,PlotlyLineplot:h6,PlotlyHeatmap:f6,PlotlyVolcano:p6,SequenceView:m6},setup(){const t=Cg(),e=zy();let r,u,R,p=null;const f=100,n=()=>{const i=e.$state.counter,_=t.hash||null,b=t.annotations,w=b?JSON.stringify(b.peak_id):void 0;if(i===r&&_===u&&w===R){console.log("[App] sendStateToStreamlit: SKIPPED (duplicate)",{timestamp:Date.now(),counter:i});return}r=i,u=_??void 0,R=w;const v=JSON.parse(JSON.stringify(e.$state)),o=Object.keys(v).find(h=>{var s;return typeof v[h]=="object"&&((s=v[h])==null?void 0:s.page)!==void 0}),a=o?v[o]:void 0;console.log("[App] ===== sendStateToStreamlit =====",{timestamp:Date.now(),counter:i,hash:_==null?void 0:_.substring(0,8),paginationIdentifier:o,paginationValue:a,requestData:t.requestData}),v._vueDataHash=_,b&&(v._annotations=JSON.parse(JSON.stringify(b))),t.requestData&&(v._requestData=!0,t.clearRequestData()),Hc.setComponentValue(v),console.log("[App] setComponentValue CALLED")},l=()=>{p&&clearTimeout(p),p=setTimeout(()=>{n(),p=null},f)},c=()=>{p&&(clearTimeout(p),p=null)};return ei(()=>e.$state.counter,(i,_)=>{_===void 0?n():l()},{immediate:!0}),ei(()=>t.hash,()=>n()),ei(()=>t.annotations,()=>n(),{deep:!0}),ei(()=>t.requestData,i=>{i&&(c(),n())}),ei(()=>{var i;return(i=t.allDataForDrawing)==null?void 0:i.height},i=>{i&&typeof i=="number"&&Hc.setFrameHeight(i)},{immediate:!0}),{streamlitDataStore:t,selectionStore:e}},data(){return{resizeObserver:void 0}},computed:{componentArgs(){var e;const t=(e=this.streamlitDataStore.args)==null?void 0:e.components;if(t&&t.length>0&&t[0].length>0)return t[0][0].componentArgs},currentComponent(){var e;const t=(e=this.componentArgs)==null?void 0:e.componentType;switch(t){case"TabulatorTable":return c6;case"PlotlyLineplotUnified":case"PlotlyLineplot":return h6;case"PlotlyHeatmap":return f6;case"PlotlyVolcano":return p6;case"SequenceView":return m6;default:return console.warn(`Unknown component type: ${t}`),null}}},created(){Hc.setComponentReady(),Hc.setFrameHeight(400),Hc.events.addEventListener(Hc.RENDER_EVENT,this.updateStreamlitData)},mounted(){this.resizeObserver=new ResizeObserver(()=>{Hc.setFrameHeight()}),this.resizeObserver.observe(this.$el)},unmounted(){Hc.events.removeEventListener(Hc.RENDER_EVENT,this.updateStreamlitData),this.resizeObserver&&this.resizeObserver.disconnect()},methods:{async updateStreamlitData(t){this.streamlitDataStore.updateRenderData(t.detail)}}}),NG={key:0},VG={key:1,class:"d-flex w-100",style:{height:"200px"}};function jG(t,e,r,u,R,p){const f=iu("v-progress-linear"),n=iu("v-alert");return t.componentArgs!==void 0?(Va(),vo("div",NG,[(Va(),ty(ME(t.currentComponent),{args:t.componentArgs,index:0},null,8,["args"]))])):(Va(),vo("div",VG,[Qt(n,{class:"h-50 ma-8",icon:"mdi-application-variable-outline",title:"Loading...",type:"info",density:"compact"},{default:ds(()=>[Qt(f,{indeterminate:""})]),_:1})]))}const UG=Vv(BG,[["render",jG]]);function yP(t,e){e=Array.isArray(e)?e.slice(0,-1).map(r=>`'${r}'`).join(", ")+` or '${e.at(-1)}'`:`'${e}'`}const Ro=typeof window<"u",W4=Ro&&"IntersectionObserver"in window,HG=Ro&&("ontouchstart"in window||window.navigator.maxTouchPoints>0),g6=Ro&&"EyeDropper"in window,G4=Ro&&"matchMedia"in window&&typeof window.matchMedia=="function",mp=()=>G4&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function v6(t,e,r){qG(t,e),e.set(t,r)}function qG(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function y6(t,e,r){return t.set(bP(t,e),r),r}function Op(t,e){return t.get(bP(t,e))}function bP(t,e,r){if(typeof t=="function"?t===e:t.has(e))return arguments.length<3?e:r;throw new TypeError("Private element is not present on this object")}function xP(t,e,r){const u=e.length-1;if(u<0)return t===void 0?r:t;for(let R=0;R<u;R++){if(t==null)return r;t=t[e[R]]}return t==null||t[e[u]]===void 0?r:t[e[u]]}function Lv(t,e,r){return t==null||!e||typeof e!="string"?r:t[e]!==void 0?t[e]:(e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),xP(t,e.split("."),r))}function au(t,e,r){if(e===!0)return t===void 0?r:t;if(e==null||typeof e=="boolean")return r;if(t!==Object(t)){if(typeof e!="function")return r;const R=e(t,r);return typeof R>"u"?r:R}if(typeof e=="string")return Lv(t,e,r);if(Array.isArray(e))return xP(t,e,r);if(typeof e!="function")return r;const u=e(t,r);return typeof u>"u"?r:u}function If(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Array.from({length:t},(r,u)=>e+u)}function ai(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"px";if(t==null||t==="")return;const r=Number(t);return isNaN(r)?String(t):isFinite(r)?`${r}${e}`:void 0}function pg(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function UT(t){let e;return t!==null&&typeof t=="object"&&((e=Object.getPrototypeOf(t))===Object.prototype||e===null)}function $4(t){if(t&&"$el"in t){const e=t.$el;return(e==null?void 0:e.nodeType)===Node.TEXT_NODE?e.nextElementSibling:e}return t}const HT=Object.freeze({enter:"Enter",tab:"Tab",delete:"Delete",esc:"Escape",space:"Space",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",end:"End",home:"Home",del:"Delete",backspace:"Backspace",insert:"Insert",pageup:"PageUp",pagedown:"PageDown",shift:"Shift"});function _P(t){return Object.keys(t)}function mv(t,e){return e.every(r=>t.hasOwnProperty(r))}function Jh(t,e){const r={};for(const u of e)Object.prototype.hasOwnProperty.call(t,u)&&(r[u]=t[u]);return r}function qT(t,e,r){const u=Object.create(null),R=Object.create(null);for(const p in t)e.some(f=>f instanceof RegExp?f.test(p):f===p)?u[p]=t[p]:R[p]=t[p];return[u,R]}function Ga(t,e){const r={...t};return e.forEach(u=>delete r[u]),r}const wP=/^on[^a-z]/,Y4=t=>wP.test(t),WG=["onAfterscriptexecute","onAnimationcancel","onAnimationend","onAnimationiteration","onAnimationstart","onAuxclick","onBeforeinput","onBeforescriptexecute","onChange","onClick","onCompositionend","onCompositionstart","onCompositionupdate","onContextmenu","onCopy","onCut","onDblclick","onFocusin","onFocusout","onFullscreenchange","onFullscreenerror","onGesturechange","onGestureend","onGesturestart","onGotpointercapture","onInput","onKeydown","onKeypress","onKeyup","onLostpointercapture","onMousedown","onMousemove","onMouseout","onMouseover","onMouseup","onMousewheel","onPaste","onPointercancel","onPointerdown","onPointerenter","onPointerleave","onPointermove","onPointerout","onPointerover","onPointerup","onReset","onSelect","onSubmit","onTouchcancel","onTouchend","onTouchmove","onTouchstart","onTransitioncancel","onTransitionend","onTransitionrun","onTransitionstart","onWheel"],GG=["ArrowUp","ArrowDown","ArrowRight","ArrowLeft","Enter","Escape","Tab"," "];function $G(t){return t.isComposing&&GG.includes(t.key)}function Mg(t){const[e,r]=qT(t,[wP]),u=Ga(e,WG),[R,p]=qT(r,["class","style","id",/^data-/]);return Object.assign(R,e),Object.assign(p,u),[R,p]}function Ss(t){return t==null?[]:Array.isArray(t)?t:[t]}function TP(t,e){let r=0;const u=function(){for(var R=arguments.length,p=new Array(R),f=0;f<R;f++)p[f]=arguments[f];clearTimeout(r),r=setTimeout(()=>t(...p),$h(e))};return u.clear=()=>{clearTimeout(r)},u.immediate=t,u}function Vo(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;return Math.max(e,Math.min(r,t))}function b6(t){const e=t.toString().trim();return e.includes(".")?e.length-e.indexOf(".")-1:0}function x6(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"0";return t+r.repeat(Math.max(0,e-t.length))}function _6(t,e){return(arguments.length>2&&arguments[2]!==void 0?arguments[2]:"0").repeat(Math.max(0,e-t.length))+t}function YG(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;const r=[];let u=0;for(;u<t.length;)r.push(t.substr(u,e)),u+=e;return r}function w6(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e3;if(t<e)return`${t} B`;const r=e===1024?["Ki","Mi","Gi"]:["k","M","G"];let u=-1;for(;Math.abs(t)>=e&&u<r.length-1;)t/=e,++u;return`${t.toFixed(1)} ${r[u]}B`}function oh(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;const u={};for(const R in t)u[R]=t[R];for(const R in e){const p=t[R],f=e[R];if(UT(p)&&UT(f)){u[R]=oh(p,f,r);continue}if(r&&Array.isArray(p)&&Array.isArray(f)){u[R]=r(p,f);continue}u[R]=f}return u}function kP(t){return t.map(e=>e.type===yi?kP(e.children):e).flat()}function _v(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";if(_v.cache.has(t))return _v.cache.get(t);const e=t.replace(/[^a-z]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase();return _v.cache.set(t,e),e}_v.cache=new Map;function G0(t,e){if(!e||typeof e!="object")return[];if(Array.isArray(e))return e.map(r=>G0(t,r)).flat(1);if(e.suspense)return G0(t,e.ssContent);if(Array.isArray(e.children))return e.children.map(r=>G0(t,r)).flat(1);if(e.component){if(Object.getOwnPropertyDescriptor(e.component.provides,t))return[e.component];if(e.component.subTree)return G0(t,e.component.subTree).flat(1)}return[]}var M0=new WeakMap,iv=new WeakMap;class SP{constructor(e){v6(this,M0,[]),v6(this,iv,0),this.size=e}get isFull(){return Op(M0,this).length===this.size}push(e){Op(M0,this)[Op(iv,this)]=e,y6(iv,this,(Op(iv,this)+1)%this.size)}values(){return Op(M0,this).slice(Op(iv,this)).concat(Op(M0,this).slice(0,Op(iv,this)))}clear(){Op(M0,this).length=0,y6(iv,this,0)}}function ZG(t){return"touches"in t?{clientX:t.touches[0].clientX,clientY:t.touches[0].clientY}:{clientX:t.clientX,clientY:t.clientY}}function Z4(t){const e=cc({});fl(()=>{const u=t();for(const R in u)e[R]=u[R]},{flush:"sync"});const r={};for(const u in e)r[u]=Nn(()=>e[u]);return r}function V2(t,e){return t.includes(e)}function AP(t){return t[2].toLowerCase()+t.slice(3)}const Wc=()=>[Function,Array];function T6(t,e){return e="on"+bp(e),!!(t[e]||t[`${e}Once`]||t[`${e}Capture`]||t[`${e}OnceCapture`]||t[`${e}CaptureOnce`])}function lx(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),u=1;u<e;u++)r[u-1]=arguments[u];if(Array.isArray(t))for(const R of t)R(...r);else typeof t=="function"&&t(...r)}function wv(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;const r=["button","[href]",'input:not([type="hidden"])',"select","textarea","details:not(:has(> summary))","details > summary","[tabindex]",'[contenteditable]:not([contenteditable="false"])',"audio[controls]","video[controls]"].map(R=>`${R}${e?':not([tabindex="-1"])':""}:not([disabled], [inert])`).join(", ");let u;try{u=[...t.querySelectorAll(r)]}catch{return[]}return u.filter(R=>!R.closest("[inert]")).filter(R=>!!R.offsetParent||R.getClientRects().length>0).filter(R=>{var p,f;return!((p=R.parentElement)!=null&&p.closest("details:not([open])"))||R.tagName==="SUMMARY"&&((f=R.parentElement)==null?void 0:f.tagName)==="DETAILS"})}function CP(t,e,r){let u,R=t.indexOf(document.activeElement);const p=e==="next"?1:-1;do R+=p,u=t[R];while((!u||u.offsetParent==null||!((r==null?void 0:r(u))??!0))&&R<t.length&&R>=0);return u}function Tv(t,e){var u,R,p,f;const r=wv(t);if(e==null)(t===document.activeElement||!t.contains(document.activeElement))&&((u=r[0])==null||u.focus());else if(e==="first")(R=r[0])==null||R.focus();else if(e==="last")(p=r.at(-1))==null||p.focus();else if(typeof e=="number")(f=r[e])==null||f.focus();else{const n=CP(r,e);n?n.focus():Tv(t,e==="next"?"first":"last")}}function C_(t){return t==null||typeof t=="string"&&t.trim()===""}function Pw(){}function wy(t,e){if(!(Ro&&typeof CSS<"u"&&typeof CSS.supports<"u"&&CSS.supports(`selector(${e})`)))return null;try{return!!t&&t.matches(e)}catch{return null}}function Dw(t){return t.some(e=>yb(e)?e.type===Ch?!1:e.type!==yi||Dw(e.children):!0)?t:null}function M_(t,e,r){return(t==null?void 0:t(e))??(r==null?void 0:r(e))}function XG(t,e){if(!Ro||t===0)return e(),()=>{};const r=window.setTimeout(e,t);return()=>window.clearTimeout(r)}function KG(t,e){const r=t.clientX,u=t.clientY,R=e.getBoundingClientRect(),p=R.left,f=R.top,n=R.right,l=R.bottom;return r>=p&&r<=n&&u>=f&&u<=l}function j2(){const t=ni(),e=r=>{t.value=r};return Object.defineProperty(e,"value",{enumerable:!0,get:()=>t.value,set:r=>t.value=r}),Object.defineProperty(e,"el",{enumerable:!0,get:()=>$4(t.value)}),e}function Ty(t){const e=t.key.length===1,r=!t.ctrlKey&&!t.metaKey&&!t.altKey;return e&&r}function mg(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"}function U2(t){return"\\^$*+?.()|{}[]".includes(t)?`\\${t}`:t}function JG(t,e,r){const u=new RegExp(`[\\d\\-${U2(r)}]`),R=t.split("").filter(f=>u.test(f)).filter((f,n,l)=>n===0&&/[-]/.test(f)||f===r&&n===l.indexOf(f)||/\d/.test(f)).join("");if(e===0)return R.split(r)[0];const p=new RegExp(`${U2(r)}\\d`);if(e!==null&&p.test(R)){const f=R.split(r);return[f[0],f[1].substring(0,e)].join(r)}return R}function QG(t){const e={};for(const r in t)e[Kh(r)]=t[r];return e}function e$(t){const e=["checked","disabled"];return Object.fromEntries(Object.entries(t).filter(r=>{let[u,R]=r;return e.includes(u)?!!R:R!==void 0}))}function k6(t){const e=r=>Array.isArray(r)?r.map(u=>e(u)):Xs(r)||lp(r)||Yb(r)?e(Zi(r)):UT(r)?Object.keys(r).reduce((u,R)=>(u[R]=e(r[R]),u),{}):r;return e(t)}const MP=["top","bottom"],t$=["start","end","left","right"];function WT(t,e){let[r,u]=t.split(" ");return u||(u=V2(MP,r)?"start":V2(t$,r)?"top":"center"),{side:GT(r,e),align:GT(u,e)}}function GT(t,e){return t==="start"?e?"right":"left":t==="end"?e?"left":"right":t}function y5(t){return{side:{center:"center",top:"bottom",bottom:"top",left:"right",right:"left"}[t.side],align:t.align}}function b5(t){return{side:t.side,align:{center:"center",top:"bottom",bottom:"top",left:"right",right:"left"}[t.align]}}function S6(t){return{side:t.align,align:t.side}}function A6(t){return V2(MP,t.side)?"y":"x"}class rd{constructor(e){const r=document.body.currentCSSZoom??1,u=e instanceof Element,R=u?1+(1-r)/r:1,{x:p,y:f,width:n,height:l}=u?e.getBoundingClientRect():e;this.x=p*R,this.y=f*R,this.width=n*R,this.height=l*R}get top(){return this.y}get bottom(){return this.y+this.height}get left(){return this.x}get right(){return this.x+this.width}}function C6(t,e){return{x:{before:Math.max(0,e.left-t.left),after:Math.max(0,t.right-e.right)},y:{before:Math.max(0,e.top-t.top),after:Math.max(0,t.bottom-e.bottom)}}}function EP(t){if(Array.isArray(t)){const e=document.body.currentCSSZoom??1,r=1+(1-e)/e;return new rd({x:t[0]*r,y:t[1]*r,width:0*r,height:0*r})}else return new rd(t)}function n$(t){if(t===document.documentElement)if(visualViewport){const e=document.body.currentCSSZoom??1;return new rd({x:visualViewport.scale>1?0:visualViewport.offsetLeft,y:visualViewport.scale>1?0:visualViewport.offsetTop,width:visualViewport.width*visualViewport.scale/e,height:visualViewport.height*visualViewport.scale/e})}else return new rd({x:0,y:0,width:document.documentElement.clientWidth,height:document.documentElement.clientHeight});else return new rd(t)}function X4(t){const e=new rd(t),r=getComputedStyle(t),u=r.transform;if(u){let R,p,f,n,l;if(u.startsWith("matrix3d("))R=u.slice(9,-1).split(/, /),p=Number(R[0]),f=Number(R[5]),n=Number(R[12]),l=Number(R[13]);else if(u.startsWith("matrix("))R=u.slice(7,-1).split(/, /),p=Number(R[0]),f=Number(R[3]),n=Number(R[4]),l=Number(R[5]);else return new rd(e);const c=r.transformOrigin,i=e.x-n-(1-p)*parseFloat(c),_=e.y-l-(1-f)*parseFloat(c.slice(c.indexOf(" ")+1)),b=p?e.width/p:t.offsetWidth+1,w=f?e.height/f:t.offsetHeight+1;return new rd({x:i,y:_,width:b,height:w})}else return new rd(e)}function Wp(t,e,r){if(typeof t.animate>"u")return{finished:Promise.resolve()};let u;try{u=t.animate(e,r)}catch{return{finished:Promise.resolve()}}return typeof u.finished>"u"&&(u.finished=new Promise(R=>{u.onfinish=()=>{R(u)}})),u}const Z_=new WeakMap;function r$(t,e){Object.keys(e).forEach(r=>{if(Y4(r)){const u=AP(r),R=Z_.get(t);if(e[r]==null)R==null||R.forEach(p=>{const[f,n]=p;f===u&&(t.removeEventListener(u,n),R.delete(p))});else if(!R||![...R].some(p=>p[0]===u&&p[1]===e[r])){t.addEventListener(u,e[r]);const p=R||new Set;p.add([u,e[r]]),Z_.has(t)||Z_.set(t,p)}}else e[r]==null?t.removeAttribute(r):t.setAttribute(r,e[r])})}function i$(t,e){Object.keys(e).forEach(r=>{if(Y4(r)){const u=AP(r),R=Z_.get(t);R==null||R.forEach(p=>{const[f,n]=p;f===u&&(t.removeEventListener(u,n),R.delete(p))})}else t.removeAttribute(r)})}const E0=2.4,M6=.2126729,E6=.7151522,I6=.072175,a$=.55,o$=.58,s$=.57,l$=.62,E_=.03,L6=1.45,u$=5e-4,c$=1.25,h$=1.25,P6=.078,D6=12.82051282051282,I_=.06,R6=.001;function O6(t,e){const r=(t.r/255)**E0,u=(t.g/255)**E0,R=(t.b/255)**E0,p=(e.r/255)**E0,f=(e.g/255)**E0,n=(e.b/255)**E0;let l=r*M6+u*E6+R*I6,c=p*M6+f*E6+n*I6;if(l<=E_&&(l+=(E_-l)**L6),c<=E_&&(c+=(E_-c)**L6),Math.abs(c-l)<u$)return 0;let i;if(c>l){const _=(c**a$-l**o$)*c$;i=_<R6?0:_<P6?_-_*D6*I_:_-I_}else{const _=(c**l$-l**s$)*h$;i=_>-R6?0:_>-P6?_-_*D6*I_:_+I_}return i*100}const H2=.20689655172413793,f$=t=>t>H2**3?Math.cbrt(t):t/(3*H2**2)+4/29,d$=t=>t>H2?t**3:3*H2**2*(t-4/29);function IP(t){const e=f$,r=e(t[1]);return[116*r-16,500*(e(t[0]/.95047)-r),200*(r-e(t[2]/1.08883))]}function LP(t){const e=d$,r=(t[0]+16)/116;return[e(r+t[1]/500)*.95047,e(r),e(r-t[2]/200)*1.08883]}const p$=[[3.2406,-1.5372,-.4986],[-.9689,1.8758,.0415],[.0557,-.204,1.057]],m$=t=>t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055,g$=[[.4124,.3576,.1805],[.2126,.7152,.0722],[.0193,.1192,.9505]],v$=t=>t<=.04045?t/12.92:((t+.055)/1.055)**2.4;function PP(t){const e=Array(3),r=m$,u=p$;for(let R=0;R<3;++R)e[R]=Math.round(Vo(r(u[R][0]*t[0]+u[R][1]*t[1]+u[R][2]*t[2]))*255);return{r:e[0],g:e[1],b:e[2]}}function K4(t){let{r:e,g:r,b:u}=t;const R=[0,0,0],p=v$,f=g$;e=p(e/255),r=p(r/255),u=p(u/255);for(let n=0;n<3;++n)R[n]=f[n][0]*e+f[n][1]*r+f[n][2]*u;return R}function $T(t){return!!t&&/^(#|var\(--|(rgb|hsl)a?\()/.test(t)}function y$(t){return $T(t)&&!/^((rgb|hsl)a?\()?var\(--/.test(t)}const z6=/^(?<fn>(?:rgb|hsl)a?)\((?<values>.+)\)/,b$={rgb:(t,e,r,u)=>({r:t,g:e,b:r,a:u}),rgba:(t,e,r,u)=>({r:t,g:e,b:r,a:u}),hsl:(t,e,r,u)=>F6({h:t,s:e,l:r,a:u}),hsla:(t,e,r,u)=>F6({h:t,s:e,l:r,a:u}),hsv:(t,e,r,u)=>gp({h:t,s:e,v:r,a:u}),hsva:(t,e,r,u)=>gp({h:t,s:e,v:r,a:u})};function Lf(t){if(typeof t=="number")return{r:(t&16711680)>>16,g:(t&65280)>>8,b:t&255};if(typeof t=="string"&&z6.test(t)){const{groups:e}=t.match(z6),{fn:r,values:u}=e,R=u.split(/,\s*|\s*\/\s*|\s+/).map((p,f)=>p.endsWith("%")||f>0&&f<3&&["hsl","hsla","hsv","hsva"].includes(r)?parseFloat(p)/100:parseFloat(p));return b$[r](...R)}else if(typeof t=="string"){let e=t.startsWith("#")?t.slice(1):t;return[3,4].includes(e.length)?e=e.split("").map(r=>r+r).join(""):[6,8].includes(e.length),zP(e)}else if(typeof t=="object"){if(mv(t,["r","g","b"]))return t;if(mv(t,["h","s","l"]))return gp(J4(t));if(mv(t,["h","s","v"]))return gp(t)}throw new TypeError(`Invalid color: ${t==null?t:String(t)||t.constructor.name}
|
|
4214
4214
|
Expected #hex, #hexa, rgb(), rgba(), hsl(), hsla(), object or number`)}function gp(t){const{h:e,s:r,v:u,a:R}=t,p=n=>{const l=(n+e/60)%6;return u-u*r*Math.max(Math.min(l,4-l,1),0)},f=[p(5),p(3),p(1)].map(n=>Math.round(n*255));return{r:f[0],g:f[1],b:f[2],a:R}}function F6(t){return gp(J4(t))}function ux(t){if(!t)return{h:0,s:1,v:1,a:1};const e=t.r/255,r=t.g/255,u=t.b/255,R=Math.max(e,r,u),p=Math.min(e,r,u);let f=0;R!==p&&(R===e?f=60*(0+(r-u)/(R-p)):R===r?f=60*(2+(u-e)/(R-p)):R===u&&(f=60*(4+(e-r)/(R-p)))),f<0&&(f=f+360);const n=R===0?0:(R-p)/R,l=[f,n,R];return{h:l[0],s:l[1],v:l[2],a:t.a}}function YT(t){const{h:e,s:r,v:u,a:R}=t,p=u-u*r/2,f=p===1||p===0?0:(u-p)/Math.min(p,1-p);return{h:e,s:f,l:p,a:R}}function J4(t){const{h:e,s:r,l:u,a:R}=t,p=u+r*Math.min(u,1-u),f=p===0?0:2-2*u/p;return{h:e,s:f,v:p,a:R}}function DP(t){let{r:e,g:r,b:u,a:R}=t;return R===void 0?`rgb(${e}, ${r}, ${u})`:`rgba(${e}, ${r}, ${u}, ${R})`}function RP(t){return DP(gp(t))}function L_(t){const e=Math.round(t).toString(16);return("00".substr(0,2-e.length)+e).toUpperCase()}function OP(t){let{r:e,g:r,b:u,a:R}=t;return`#${[L_(e),L_(r),L_(u),R!==void 0?L_(Math.round(R*255)):""].join("")}`}function zP(t){t=_$(t);let[e,r,u,R]=YG(t,2).map(p=>parseInt(p,16));return R=R===void 0?R:R/255,{r:e,g:r,b:u,a:R}}function x$(t){const e=zP(t);return ux(e)}function FP(t){return OP(gp(t))}function _$(t){return t.startsWith("#")&&(t=t.slice(1)),t=t.replace(/([^0-9a-f])/gi,"F"),(t.length===3||t.length===4)&&(t=t.split("").map(e=>e+e).join("")),t.length!==6&&(t=x6(x6(t,6),8,"F")),t}function w$(t,e){const r=IP(K4(t));return r[0]=r[0]+e*10,PP(LP(r))}function T$(t,e){const r=IP(K4(t));return r[0]=r[0]-e*10,PP(LP(r))}function ZT(t){const e=Lf(t);return K4(e)[1]}function k$(t,e){const r=ZT(t),u=ZT(e),R=Math.max(r,u),p=Math.min(r,u);return(R+.05)/(p+.05)}function BP(t){const e=Math.abs(O6(Lf(0),Lf(t)));return Math.abs(O6(Lf(16777215),Lf(t)))>Math.min(e,50)?"#fff":"#000"}function ir(t,e){return r=>Object.keys(t).reduce((u,R)=>{const f=typeof t[R]=="object"&&t[R]!=null&&!Array.isArray(t[R])?t[R]:{type:t[R]};return r&&R in r?u[R]={...f,default:r[R]}:u[R]=f,e&&!u[R].source&&(u[R].source=e),u},{})}const Ti=ir({class:[String,Array,Object],style:{type:[String,Array,Object],default:null}},"component");function lu(t,e){const r=Ly();if(!r)throw new Error(`[Vuetify] ${t} must be called from inside a setup function`);return r}function xp(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"composables";const e=lu(t).type;return _v((e==null?void 0:e.aliasName)||(e==null?void 0:e.name))}function S$(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:lu("injectSelf");const{provides:r}=e;if(r&&t in r)return r[t]}const ky=Symbol.for("vuetify:defaults");function A$(t){return Wr(t)}function Q4(){const t=Ea(ky);if(!t)throw new Error("[Vuetify] Could not find defaults instance");return t}function kl(t,e){const r=Q4(),u=Wr(t),R=rn(()=>{if($h(e==null?void 0:e.disabled))return r.value;const f=$h(e==null?void 0:e.scoped),n=$h(e==null?void 0:e.reset),l=$h(e==null?void 0:e.root);if(u.value==null&&!(f||n||l))return r.value;let c=oh(u.value,{prev:r.value});if(f)return c;if(n||l){const i=Number(n||1/0);for(let _=0;_<=i&&!(!c||!("prev"in c));_++)c=c.prev;return c&&typeof l=="string"&&l in c&&(c=oh(oh(c,{prev:c}),c[l])),c}return c.prev?oh(c.prev,c):c});return Ns(ky,R),R}function C$(t,e){return t.props&&(typeof t.props[e]<"u"||typeof t.props[_v(e)]<"u")}function M$(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Q4();const u=lu("useDefaults");if(e=e??u.type.name??u.type.__name,!e)throw new Error("[Vuetify] Could not determine component name");const R=rn(()=>{var l;return(l=r.value)==null?void 0:l[t._as??e]}),p=new Proxy(t,{get(l,c){var w,v,o,a;const i=Reflect.get(l,c);if(c==="class"||c==="style")return[(w=R.value)==null?void 0:w[c],i].filter(h=>h!=null);if(C$(u.vnode,c))return i;const _=(v=R.value)==null?void 0:v[c];if(_!==void 0)return _;const b=(a=(o=r.value)==null?void 0:o.global)==null?void 0:a[c];return b!==void 0?b:i}}),f=ni();fl(()=>{if(R.value){const l=Object.entries(R.value).filter(c=>{let[i]=c;return i.startsWith(i[0].toUpperCase())});f.value=l.length?Object.fromEntries(l):void 0}else f.value=void 0});function n(){const l=S$(ky,u);Ns(ky,rn(()=>f.value?oh((l==null?void 0:l.value)??{},f.value):l==null?void 0:l.value))}return{props:p,provideSubDefaults:n}}function Ih(t){if(t._setup=t._setup??t.setup,!t.name)return t;if(t._setup){t.props=ir(t.props??{},t.name)();const e=Object.keys(t.props).filter(r=>r!=="class"&&r!=="style");t.filterProps=function(u){return Jh(u,e)},t.props._as=String,t.setup=function(u,R){const p=Q4();if(!p.value)return t._setup(u,R);const{props:f,provideSubDefaults:n}=M$(u,u._as??t.name,p),l=t._setup(f,R);return n(),l}}return t}function zr(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return e=>(t?Ih:wg)(e)}function E$(t,e){return e.props=t,e}function dm(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"div",r=arguments.length>2?arguments[2]:void 0;return zr()({name:r??bp(Kh(t.replace(/__/g,"-"))),props:{tag:{type:String,default:e},...Ti()},setup(u,R){let{slots:p}=R;return()=>{var f;return lm(u.tag,{class:[t,u.class],style:u.style},(f=p.default)==null?void 0:f.call(p))}}})}function I$(t,e,r,u){if(!r||mg(t)||mg(e))return;const R=r.get(t);if(R)R.set(e,u);else{const p=new WeakMap;p.set(e,u),r.set(t,p)}}function L$(t,e,r){var p,f;if(!r||mg(t)||mg(e))return null;const u=(p=r.get(t))==null?void 0:p.get(e);if(typeof u=="boolean")return u;const R=(f=r.get(e))==null?void 0:f.get(t);return typeof R=="boolean"?R:null}function Ec(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new WeakMap;if(t===e)return!0;if(t instanceof Date&&e instanceof Date&&t.getTime()!==e.getTime()||t!==Object(t)||e!==Object(e))return!1;const u=Object.keys(t);if(u.length!==Object.keys(e).length)return!1;const R=L$(t,e,r);return R||(I$(t,e,r,!0),u.every(p=>Ec(t[p],e[p],r)))}function NP(t){if(typeof t.getRootNode!="function"){for(;t.parentNode;)t=t.parentNode;return t!==document?null:document}const e=t.getRootNode();return e!==document&&e.getRootNode({composed:!0})!==document?null:e}const Lb="cubic-bezier(0.4, 0, 0.2, 1)",B6="cubic-bezier(0.0, 0, 0.2, 1)",N6="cubic-bezier(0.4, 0, 1, 1)",P$={linear:t=>t,easeInQuad:t=>t**2,easeOutQuad:t=>t*(2-t),easeInOutQuad:t=>t<.5?2*t**2:-1+(4-2*t)*t,easeInCubic:t=>t**3,easeOutCubic:t=>--t**3+1,easeInOutCubic:t=>t<.5?4*t**3:(t-1)*(2*t-2)*(2*t-2)+1,easeInQuart:t=>t**4,easeOutQuart:t=>1- --t**4,easeInOutQuart:t=>t<.5?8*t**4:1-8*--t**4,easeInQuint:t=>t**5,easeOutQuint:t=>1+--t**5,easeInOutQuint:t=>t<.5?16*t**5:1+16*--t**5,instant:t=>1};function Pf(t,e,r){return Object.keys(t).filter(u=>Y4(u)&&u.endsWith(e)).reduce((u,R)=>(u[R.slice(0,-e.length)]=p=>lx(t[R],p,r(p)),u),{})}function Rw(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;for(;t;){if(e?D$(t):eS(t))return t;t=t.parentElement}return document.scrollingElement}function q2(t,e){const r=[];if(e&&t&&!e.contains(t))return r;for(;t&&(eS(t)&&r.push(t),t!==e);)t=t.parentElement;return r}function eS(t){if(!t||t.nodeType!==Node.ELEMENT_NODE)return!1;const e=window.getComputedStyle(t),r=e.overflowY==="scroll"||e.overflowY==="auto"&&t.scrollHeight>t.clientHeight,u=e.overflowX==="scroll"||e.overflowX==="auto"&&t.scrollWidth>t.clientWidth;return r||u}function D$(t){if(!t||t.nodeType!==Node.ELEMENT_NODE)return!1;const e=window.getComputedStyle(t);return["scroll","auto"].includes(e.overflowY)}function R$(t){let{depth:e,isLast:r,isLastGroup:u,leafLinks:R,separateRoots:p,parentIndentLines:f,variant:n}=t;const l=r&&(!u||p||e>1);return!f||!e?{leaf:void 0,node:void 0,children:f,footer:f&&(!l||n==="simple")?[...f,p?"none":"line"]:["none"]}:n==="simple"?{leaf:[...f,"line"],node:[...f,"line"],children:[...f,"line"],footer:[...f,"line","line"]}:{leaf:[...f,l?"last-leaf":"leaf",...R?["leaf-link"]:[]],node:[...f,l?"last-leaf":"leaf"],children:[...f,l?"none":"line"],footer:[...f,l?"none":"line"]}}function O$(t){for(;t;){if(window.getComputedStyle(t).position==="fixed")return!0;t=t.offsetParent}return!1}function Gr(t){const e=lu("useRender");e.render=t}function z$(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{leading:!0,trailing:!0},u=0,R=0,p=!1,f=0;function n(){clearTimeout(u),p=!1,f=0}const l=function(){for(var c=arguments.length,i=new Array(c),_=0;_<c;_++)i[_]=arguments[_];clearTimeout(u);const b=Date.now();f||(f=b);const w=b-Math.max(f,R);function v(){R=Date.now(),u=setTimeout(n,e),t(...i)}p?w>=e?v():r.trailing&&(u=setTimeout(v,e-w)):(p=!0,r.leading&&v())};return l.clear=n,l.immediate=t,l}const Fi=[String,Function,Object,Array],XT=Symbol.for("vuetify:icons"),Ow=ir({icon:{type:Fi},tag:{type:[String,Object,Function],required:!0}},"icon"),KT=zr()({name:"VComponentIcon",props:Ow(),setup(t,e){let{slots:r}=e;return()=>{const u=t.icon;return Qt(t.tag,null,{default:()=>{var R;return[t.icon?Qt(u,null,null):(R=r.default)==null?void 0:R.call(r)]}})}}}),tS=Ih({name:"VSvgIcon",inheritAttrs:!1,props:Ow(),setup(t,e){let{attrs:r}=e;return()=>Qt(t.tag,kr(r,{style:null}),{default:()=>[en("svg",{class:"v-icon__svg",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"img","aria-hidden":"true"},[Array.isArray(t.icon)?t.icon.map(u=>Array.isArray(u)?en("path",{d:u[0],"fill-opacity":u[1]},null):en("path",{d:u},null)):en("path",{d:t.icon},null)])]})}}),F$=Ih({name:"VLigatureIcon",props:Ow(),setup(t){return()=>Qt(t.tag,null,{default:()=>[t.icon]})}}),nS=Ih({name:"VClassIcon",props:Ow(),setup(t){return()=>Qt(t.tag,{class:jr(t.icon)},null)}}),B$=t=>{const e=Ea(XT);if(!e)throw new Error("Missing Vuetify Icons provide!");return{iconData:rn(()=>{var l;const u=Mc(t);if(!u)return{component:KT};let R=u;if(typeof R=="string"&&(R=R.trim(),R.startsWith("$")&&(R=(l=e.aliases)==null?void 0:l[R.slice(1)])),Array.isArray(R))return{component:tS,icon:R};if(typeof R!="string")return{component:KT,icon:R};const p=Object.keys(e.sets).find(c=>typeof R=="string"&&R.startsWith(`${c}:`)),f=p?R.slice(p.length+1):R;return{component:e.sets[p??e.defaultSet].component,icon:f}})}},N$={collapse:"mdi-chevron-up",complete:"mdi-check",cancel:"mdi-close-circle",close:"mdi-close",delete:"mdi-close-circle",clear:"mdi-close-circle",success:"mdi-check-circle",info:"mdi-information",warning:"mdi-alert-circle",error:"mdi-close-circle",prev:"mdi-chevron-left",next:"mdi-chevron-right",checkboxOn:"mdi-checkbox-marked",checkboxOff:"mdi-checkbox-blank-outline",checkboxIndeterminate:"mdi-minus-box",delimiter:"mdi-circle",sortAsc:"mdi-arrow-up",sortDesc:"mdi-arrow-down",expand:"mdi-chevron-down",menu:"mdi-menu",subgroup:"mdi-menu-down",dropdown:"mdi-menu-down",radioOn:"mdi-radiobox-marked",radioOff:"mdi-radiobox-blank",edit:"mdi-pencil",ratingEmpty:"mdi-star-outline",ratingFull:"mdi-star",ratingHalf:"mdi-star-half-full",loading:"mdi-cached",first:"mdi-page-first",last:"mdi-page-last",unfold:"mdi-unfold-more-horizontal",file:"mdi-paperclip",plus:"mdi-plus",minus:"mdi-minus",calendar:"mdi-calendar",treeviewCollapse:"mdi-menu-down",treeviewExpand:"mdi-menu-right",tableGroupCollapse:"mdi-chevron-down",tableGroupExpand:"mdi-chevron-right",eyeDropper:"mdi-eyedropper",upload:"mdi-cloud-upload",color:"mdi-palette",command:"mdi-apple-keyboard-command",ctrl:"mdi-apple-keyboard-control",space:"mdi-keyboard-space",shift:"mdi-apple-keyboard-shift",alt:"mdi-apple-keyboard-option",enter:"mdi-keyboard-return",arrowup:"mdi-arrow-up",arrowdown:"mdi-arrow-down",arrowleft:"mdi-arrow-left",arrowright:"mdi-arrow-right",backspace:"mdi-backspace",play:"mdi-play",pause:"mdi-pause",fullscreen:"mdi-fullscreen",fullscreenExit:"mdi-fullscreen-exit",volumeHigh:"mdi-volume-high",volumeMedium:"mdi-volume-medium",volumeLow:"mdi-volume-low",volumeOff:"mdi-volume-variant-off"},V$={component:t=>lm(nS,{...t,class:"mdi"})};function j$(){return{svg:{component:tS},class:{component:nS}}}function U$(t){const e=j$(),r=(t==null?void 0:t.defaultSet)??"mdi";return r==="mdi"&&!e.mdi&&(e.mdi=V$),oh({defaultSet:r,sets:e,aliases:{...N$,vuetify:["M8.2241 14.2009L12 21L22 3H14.4459L8.2241 14.2009Z",["M7.26303 12.4733L7.00113 12L2 3H12.5261C12.5261 3 12.5261 3 12.5261 3L7.26303 12.4733Z",.6]],"vuetify-outline":"svg:M7.26 12.47 12.53 3H2L7.26 12.47ZM14.45 3 8.22 14.2 12 21 22 3H14.45ZM18.6 5 12 16.88 10.51 14.2 15.62 5ZM7.26 8.35 5.4 5H9.13L7.26 8.35Z","vuetify-play":["m6.376 13.184-4.11-7.192C1.505 4.66 2.467 3 4.003 3h8.532l-.953 1.576-.006.01-.396.677c-.429.732-.214 1.507.194 2.015.404.503 1.092.878 1.869.806a3.72 3.72 0 0 1 1.005.022c.276.053.434.143.523.237.138.146.38.635-.25 2.09-.893 1.63-1.553 1.722-1.847 1.677-.213-.033-.468-.158-.756-.406a4.95 4.95 0 0 1-.8-.927c-.39-.564-1.04-.84-1.66-.846-.625-.006-1.316.27-1.693.921l-.478.826-.911 1.506Z",["M9.093 11.552c.046-.079.144-.15.32-.148a.53.53 0 0 1 .43.207c.285.414.636.847 1.046 1.2.405.35.914.662 1.516.754 1.334.205 2.502-.698 3.48-2.495l.014-.028.013-.03c.687-1.574.774-2.852-.005-3.675-.37-.391-.861-.586-1.333-.676a5.243 5.243 0 0 0-1.447-.044c-.173.016-.393-.073-.54-.257-.145-.18-.127-.316-.082-.392l.393-.672L14.287 3h5.71c1.536 0 2.499 1.659 1.737 2.992l-7.997 13.996c-.768 1.344-2.706 1.344-3.473 0l-3.037-5.314 1.377-2.278.004-.006.004-.007.481-.831Z",.6]]}},t)}function sh(t,e){let r;function u(){r=ag(),r.run(()=>e.length?e(()=>{r==null||r.stop(),u()}):e())}ei(t,R=>{R&&!r?u():R||(r==null||r.stop(),r=void 0)},{immediate:!0}),ju(()=>{r==null||r.stop()})}function Ri(t,e,r){let u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:_=>_,R=arguments.length>4&&arguments[4]!==void 0?arguments[4]:_=>_;const p=lu("useProxiedModel"),f=Wr(t[e]!==void 0?t[e]:r),n=_v(e),c=rn(n!==e?()=>{var _,b,w,v;return t[e],!!(((_=p.vnode.props)!=null&&_.hasOwnProperty(e)||(b=p.vnode.props)!=null&&b.hasOwnProperty(n))&&((w=p.vnode.props)!=null&&w.hasOwnProperty(`onUpdate:${e}`)||(v=p.vnode.props)!=null&&v.hasOwnProperty(`onUpdate:${n}`)))}:()=>{var _,b;return t[e],!!((_=p.vnode.props)!=null&&_.hasOwnProperty(e)&&((b=p.vnode.props)!=null&&b.hasOwnProperty(`onUpdate:${e}`)))});sh(()=>!c.value,()=>{ei(()=>t[e],_=>{f.value=_})});const i=rn({get(){const _=t[e];return u(c.value?_:f.value)},set(_){const b=R(_),w=Zi(c.value?t[e]:f.value);w===b||u(w)===_||(f.value=b,p==null||p.emit(`update:${e}`,b))}});return Object.defineProperty(i,"externalValue",{get:()=>c.value?t[e]:f.value}),i}const H$={badge:"Badge",open:"Open",close:"Close",dismiss:"Dismiss",confirmEdit:{ok:"OK",cancel:"Cancel"},dataIterator:{noResultsText:"No matching records found",loadingText:"Loading items..."},dataTable:{itemsPerPageText:"Rows per page:",ariaLabel:{sortDescending:"Sorted descending.",sortAscending:"Sorted ascending.",sortNone:"Not sorted.",activateNone:"Activate to remove sorting.",activateDescending:"Activate to sort descending.",activateAscending:"Activate to sort ascending."},sortBy:"Sort by"},dataFooter:{itemsPerPageText:"Items per page:",itemsPerPageAll:"All",nextPage:"Next page",prevPage:"Previous page",firstPage:"First page",lastPage:"Last page",pageText:"{0}-{1} of {2}"},dateRangeInput:{divider:"to"},datePicker:{itemsSelected:"{0} selected",range:{title:"Select dates",header:"Enter dates"},title:"Select date",header:"Enter date",input:{placeholder:"Enter date"},ariaLabel:{previousMonth:"Previous month",nextMonth:"Next month",selectYear:"Select year",previousYear:"Previous year",nextYear:"Next year",selectMonth:"Select month",selectDate:"{0}",currentDate:"Today, {0}"}},noDataText:"No data available",carousel:{prev:"Previous visual",next:"Next visual",ariaLabel:{delimiter:"Carousel slide {0} of {1}"}},calendar:{moreEvents:"{0} more",today:"Today"},input:{clear:"Clear {0}",prependAction:"{0} prepended action",appendAction:"{0} appended action",otp:"Please enter OTP character {0}"},fileInput:{counter:"{0} files",counterSize:"{0} files ({1} in total)"},fileUpload:{title:"Drag and drop files here",divider:"or",browse:"Browse Files"},timePicker:{am:"AM",pm:"PM",title:"Select Time",hour:"Hour",minute:"Minute",second:"Second"},pagination:{ariaLabel:{root:"Pagination Navigation",next:"Next page",previous:"Previous page",page:"Go to page {0}",currentPage:"Page {0}, Current page",first:"First page",last:"Last page"}},stepper:{next:"Next",prev:"Previous"},rating:{ariaLabel:{item:"Rating {0} of {1}"}},loading:"Loading...",infiniteScroll:{loadMore:"Load more",empty:"No more"},rules:{required:"This field is required",email:"Please enter a valid email",number:"This field can only contain numbers",integer:"This field can only contain integer values",capital:"This field can only contain uppercase letters",maxLength:"You must enter a maximum of {0} characters",minLength:"You must enter a minimum of {0} characters",strictLength:"The length of the entered field is invalid",exclude:"The {0} character is not allowed",notEmpty:"Please choose at least one value",pattern:"Invalid format"},hotkey:{then:"then",ctrl:"Ctrl",command:"Command",space:"Space",shift:"Shift",alt:"Alt",enter:"Enter",escape:"Escape",upArrow:"Up Arrow",downArrow:"Down Arrow",leftArrow:"Left Arrow",rightArrow:"Right Arrow",backspace:"Backspace",option:"Option",plus:"plus",shortcut:"Keyboard shortcut: {0}",or:"or"},video:{play:"Play",pause:"Pause",seek:"Seek",volume:"Volume",showVolume:"Show volume control",mute:"Mute",unmute:"Unmute",enterFullscreen:"Full screen",exitFullscreen:"Exit full screen"},colorPicker:{ariaLabel:{eyedropper:"Select color with eyedropper",hueSlider:"Hue",alphaSlider:"Alpha",redInput:"Red value",greenInput:"Green value",blueInput:"Blue value",alphaInput:"Alpha value",hueInput:"Hue value",saturationInput:"Saturation value",lightnessInput:"Lightness value",hexInput:"HEX value",hexaInput:"HEX with alpha value",changeFormat:"Change color format"}}},V6="$vuetify.",j6=(t,e)=>t.replace(/\{(\d+)\}/g,(r,u)=>String(e[Number(u)])),VP=(t,e,r)=>function(u){for(var R=arguments.length,p=new Array(R>1?R-1:0),f=1;f<R;f++)p[f-1]=arguments[f];if(!u.startsWith(V6))return j6(u,p);const n=u.replace(V6,""),l=t.value&&r.value[t.value],c=e.value&&r.value[e.value];let i=Lv(l,n,null);return i||(`${u}${t.value}`,i=Lv(c,n,null)),i||(i=u),typeof i!="string"&&(i=u),j6(i,p)};function rS(t,e){return(r,u)=>new Intl.NumberFormat([t.value,e.value],u).format(r)}function jP(t,e){return rS(t,e)(.1).includes(",")?",":"."}function x5(t,e,r){const u=Ri(t,e,t[e]??r.value);return u.value=t[e]??r.value,ei(r,R=>{t[e]==null&&(u.value=r.value)}),u}function UP(t){return e=>{const r=x5(e,"locale",t.current),u=x5(e,"fallback",t.fallback),R=x5(e,"messages",t.messages);return{name:"vuetify",current:r,fallback:u,messages:R,decimalSeparator:Nn(()=>jP(r,u)),t:VP(r,u,R),n:rS(r,u),provide:UP({current:r,fallback:u,messages:R})}}}function q$(t){const e=ni((t==null?void 0:t.locale)??"en"),r=ni((t==null?void 0:t.fallback)??"en"),u=Wr({en:H$,...t==null?void 0:t.messages});return{name:"vuetify",current:e,fallback:r,messages:u,decimalSeparator:Nn(()=>(t==null?void 0:t.decimalSeparator)??jP(e,r)),t:VP(e,r,u),n:rS(e,r),provide:UP({current:e,fallback:r,messages:u})}}const Sy=Symbol.for("vuetify:locale");function W$(t){return t.name!=null}function G$(t){const e=t!=null&&t.adapter&&W$(t==null?void 0:t.adapter)?t==null?void 0:t.adapter:q$(t),r=Y$(e,t);return{...e,...r}}function Fo(){const t=Ea(Sy);if(!t)throw new Error("[Vuetify] Could not find injected locale instance");return t}function HP(t){const e=Ea(Sy);if(!e)throw new Error("[Vuetify] Could not find injected locale instance");const r=e.provide(t),u=Z$(r,e.rtl,t),R={...r,...u};return Ns(Sy,R),R}function $$(){return{af:!1,ar:!0,bg:!1,ca:!1,ckb:!1,cs:!1,de:!1,el:!1,en:!1,es:!1,et:!1,fa:!0,fi:!1,fr:!1,hr:!1,hu:!1,he:!0,id:!1,it:!1,ja:!1,km:!1,ko:!1,lv:!1,lt:!1,nl:!1,no:!1,pl:!1,pt:!1,ro:!1,ru:!1,sk:!1,sl:!1,srCyrl:!1,srLatn:!1,sv:!1,th:!1,tr:!1,az:!1,uk:!1,vi:!1,zhHans:!1,zhHant:!1}}function Y$(t,e){const r=Wr((e==null?void 0:e.rtl)??$$()),u=rn(()=>r.value[t.current.value]??!1);return{isRtl:u,rtl:r,rtlClasses:Nn(()=>`v-locale--is-${u.value?"rtl":"ltr"}`)}}function Z$(t,e,r){const u=rn(()=>r.rtl??e.value[t.current.value]??!1);return{isRtl:u,rtl:e,rtlClasses:Nn(()=>`v-locale--is-${u.value?"rtl":"ltr"}`)}}function ku(){const t=Ea(Sy);if(!t)throw new Error("[Vuetify] Could not find injected rtl instance");return{isRtl:t.isRtl,rtlClasses:t.rtlClasses}}function cx(t){const e=t.slice(-2).toUpperCase();switch(!0){case t==="GB-alt-variant":return{firstDay:0,firstWeekSize:4};case t==="001":return{firstDay:1,firstWeekSize:1};case`AG AS BD BR BS BT BW BZ CA CO DM DO ET GT GU HK HN ID IL IN JM JP KE
|
|
4215
4215
|
KH KR LA MH MM MO MT MX MZ NI NP PA PE PH PK PR PY SA SG SV TH TT TW UM US
|
|
4216
4216
|
VE VI WS YE ZA ZW`.includes(e):return{firstDay:0,firstWeekSize:1};case`AI AL AM AR AU AZ BA BM BN BY CL CM CN CR CY EC GE HR KG KZ LB LK LV
|