(function(E,ls){typeof exports=="object"&&typeof module<"u"?module.exports=ls(require("vue")):typeof define=="function"&&define.amd?define(["vue"],ls):(E=typeof globalThis<"u"?globalThis:E||self,E.VueUI=ls(E.Vue))})(this,function(E){"use strict";var gre=Object.defineProperty;var mre=(E,ls,lt)=>ls in E?gre(E,ls,{enumerable:!0,configurable:!0,writable:!0,value:lt}):E[ls]=lt;var Xi=(E,ls,lt)=>(mre(E,typeof ls!="symbol"?ls+"":ls,lt),lt);const ls={props:{type:{type:String,default:()=>""},title:{type:String,default:()=>""},color:{type:String,default:"blue"},size:{type:String,default:()=>""},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},icon:{type:String,default:()=>""},circle:Boolean,square:Boolean},data(){return{buttonClass:{}}},computed:{buttonData(){var t;return((t=this.buttonClass)==null?void 0:t[this.type])||this.buttonClass.default}},watch:{color:{immediate:!0,handler(t){this.buttonClass={primary:{params:{"border-1 border-transparent text-white":!0,[`bg-${t}-500`]:!0,[`hover:bg-${t}-600`]:!0,[`focus:ring-${t}-500`]:!0}},text:{params:{"border border-transparent":!0,[`text-${t}-500`]:!0,[`hover:bg-${t}-100`]:!0,[`focus:ring-${t}-500`]:!0}},plain:{params:{"border border-transparent hover:text-white ring-offset-white":!0,[`bg-${t}-100`]:!0,[`text-${t}-500`]:!0,[`hover:bg-${t}-500`]:!0,[`focus:ring-${t}-500`]:!0}},border:{params:{"border font-medium bg-white shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white":!0,[`text-${t}-700`]:!0,[`focus:ring-${t}-600`]:!0}},link:{params:{"border border-transparent ring-offset-white":!0,[`text-${t}-600`]:!0,[`hover:text-${t}-700`]:!0,[`focus:ring-${t}-600`]:!0}},default:{params:{"border !border-gray-200 hover:text-white bg-white":!0,[`text-${t}-500`]:!0,[`hover:border-${t}-500`]:!0,[`hover:bg-${t}-500`]:!0,[`focus:ring-${t}-500`]:!0}}}}}}},lt=(t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n},W3=t=>(E.pushScopeId("data-v-132b2fc1"),t=t(),E.popScopeId(),t),X3={key:1,role:"status"},K3=[W3(()=>E.createElementVNode("svg",{"aria-hidden":"true",class:"inline w-4 h-4 text-gray-200 animate-spin fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[E.createElementVNode("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),E.createElementVNode("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1))];function Z3(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("button",{type:"button",class:E.normalizeClass(["vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all",{...o.buttonData.params,[n.size==="mini"?"py-1 px-3":n.size==="large"?"py-3 px-7":"py-1.5 px-5"]:!0,[n.disabled?"disabled opacity-50 focus:ring-0 focus:ring-offset-0 cursor-not-allowed":"focus:ring-1 focus:ring-offset-1"]:!0,"!px-2 !py-2 !rounded-full":n.circle,"!px-2 !py-2 !rounded-md":n.square}])},[E.renderSlot(t.$slots,"default",{},()=>[E.createTextVNode(E.toDisplayString(n.title),1)],!0),n.icon?(E.openBlock(),E.createElementBlock("i",{key:0,class:E.normalizeClass(["ti "+n.icon,"pointer-events-none"])},null,2)):E.createCommentVNode("",!0),n.loading?(E.openBlock(),E.createElementBlock("div",X3,K3)):E.createCommentVNode("",!0)],2)}const Uc=lt(ls,[["render",Z3],["__scopeId","data-v-132b2fc1"]]),J3=E.defineComponent({props:{icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},modelValue:{type:String,default:()=>""},placeholder:{type:String,default:()=>""},iconPosition:{type:String,default:()=>"right"},type:{type:String,default:()=>"text"}},emits:["onInput","update:modelValue","blur"],computed:{value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t.trim())}},clearIconStyle(){return[{"right-8":this.icon&&this.iconPosition==="right","right-3":!this.icon||this.iconPosition!=="right","pointer-events-none":this.disabled}]},iconStylePosition(){return[{"left-3":this.icon&&this.iconPosition==="left","right-3":this.icon&&this.iconPosition==="right"}]},inputStyle(){return[{"pr-8":this.clearable&&this.icon&&this.iconPosition==="right","pl-8":this.icon&&this.iconPosition==="left","pr-[50px]":this.clearable&&this.value&&this.icon&&this.iconPosition==="right"}]}},methods:{handleInput(){this.$emit("onInput",this.modelValue)},handleBlur(){this.$emit("blur")},clearInput(){this.$emit("update:modelValue",""),this.$emit("onInput","")}}}),Q3=["disabled","type","placeholder"];function e5(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("div",{class:E.normalizeClass(["vs-form-text relative",{"cursor-not-allowed":t.disabled}])},[t.clearable&&t.value?(E.openBlock(),E.createElementBlock("i",{key:0,class:E.normalizeClass(["absolute bottom-2/4 translate-y-2/4 ti ti-x cursor-pointer hover:text-blue-500 bg-white transition-all text-gray-400",t.clearIconStyle]),onClick:e[0]||(e[0]=(...s)=>t.clearInput&&t.clearInput(...s))},null,2)):E.createCommentVNode("",!0),t.icon?(E.openBlock(),E.createElementBlock("i",{key:1,class:E.normalizeClass(["absolute bottom-2/4 translate-y-2/4 text-gray-500 cursor-pointer",["ti "+t.icon,t.iconStylePosition]])},null,2)):E.createCommentVNode("",!0),E.withDirectives(E.createElementVNode("input",{disabled:t.disabled,type:t.type,onInput:e[1]||(e[1]=(...s)=>t.handleInput&&t.handleInput(...s)),placeholder:t.placeholder,"onUpdate:modelValue":e[2]||(e[2]=s=>t.value=s),onBlur:e[3]||(e[3]=(...s)=>t.handleBlur&&t.handleBlur(...s)),class:E.normalizeClass([t.inputStyle,"py-2 px-3 transition-all block w-full border border-gray-200 focus:border-blue-500 !ring-0 focus:ring-0 outline-none border-solid rounded-lg text-sm disabled:opacity-50 disabled:pointer-events-none placeholder-gray-400"])},null,42,Q3),[[E.vModelDynamic,t.value]])],2)}const zc=lt(J3,[["render",e5],["__scopeId","data-v-b9664d97"]]);function Lu(t){return typeof t=="string"||t instanceof String}function jS(t){var e;return typeof t=="object"&&t!=null&&((e=t==null?void 0:t.constructor)==null?void 0:e.name)==="Object"}function qS(t,e){return Array.isArray(e)?qS(t,(n,r)=>e.includes(r)):Object.entries(t).reduce((n,r)=>{let[i,o]=r;return e(o,i)&&(n[i]=o),n},{})}const ct={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function t5(t){switch(t){case ct.LEFT:return ct.FORCE_LEFT;case ct.RIGHT:return ct.FORCE_RIGHT;default:return t}}function U1(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function qm(t,e){if(e===t)return!0;const n=Array.isArray(e),r=Array.isArray(t);let i;if(n&&r){if(e.length!=t.length)return!1;for(i=0;i!o.startsWith("_")),mask:e.constructor,_mask:r,...n}}}return jS(t)?{...t}:{mask:t}}function kl(t){if(St.Masked&&t instanceof St.Masked)return t;const e=up(t),n=US(e.mask);if(!n)throw new Error(`Masked class is not found for provided mask ${e.mask}, appropriate module needs to be imported manually before creating mask.`);return e.mask===n&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new n(e)}St.createMask=kl;class z1{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return e??this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return e??this.value.length}select(e,n){if(!(e==null||n==null||e===this.selectionStart&&n===this.selectionEnd))try{this._unsafeSelect(e,n)}catch{}}get isActive(){return!1}}St.MaskElement=z1;const zS=90,r5=89;class Um extends z1{constructor(e){super(),this.input=e,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var e,n;return((n=(e=this.input).getRootNode)==null?void 0:n.call(e))??document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){if(this._handlers.redo&&(e.keyCode===zS&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===r5&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===zS&&(e.metaKey||e.ctrlKey))return e.preventDefault(),this._handlers.undo(e);e.isComposing||this._handlers.selectionChange(e)}_onBeforeinput(e){if(e.inputType==="historyUndo"&&this._handlers.undo)return e.preventDefault(),this._handlers.undo(e);if(e.inputType==="historyRedo"&&this._handlers.redo)return e.preventDefault(),this._handlers.redo(e)}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}St.HTMLMaskElement=Um;class i5 extends Um{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,n){this.input.setSelectionRange(e,n)}get value(){return this.input.value}set value(e){this.input.value=e}}St.HTMLMaskElement=Um;class HS extends Um{get _unsafeSelectionStart(){const e=this.rootElement,n=e.getSelection&&e.getSelection(),r=n&&n.anchorOffset,i=n&&n.focusOffset;return i==null||r==null||ri?r:i}_unsafeSelect(e,n){if(!this.rootElement.createRange)return;const r=this.rootElement.createRange();r.setStart(this.input.firstChild||this.input,e),r.setEnd(this.input.lastChild||this.input,n);const i=this.rootElement,o=i.getSelection&&i.getSelection();o&&(o.removeAllRanges(),o.addRange(r))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}St.HTMLContenteditableMaskElement=HS;const T1=class T1{constructor(){Xi(this,"states",[]);Xi(this,"currentIndex",0)}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(e){this.currentIndexT1.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}};Xi(T1,"MAX_LENGTH",100);let H1=T1;class o5{constructor(e,n){this.el=e instanceof z1?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new HS(e):new i5(e),this.masked=kl(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new H1,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(e){var n;return e==null||((n=this.masked)==null?void 0:n.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof St.Masked)&&this.masked.constructor===US(e)){this.masked.updateOptions({mask:e});return}const n=e instanceof St.Masked?e:kl({mask:e});n.unmaskedValue=this.masked.unmaskedValue,this.masked=n}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(e,n){const r=this._listeners[e];r&&r.forEach(i=>i(n))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){!this.el||!this.el.isActive||(this.el.select(e,e),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value}updateControl(e){const n=this.masked.unmaskedValue,r=this.masked.value,i=this.masked.rawInputValue,o=this.displayValue,s=this.unmaskedValue!==n||this.value!==r||this._rawInputValue!==i;this._unmaskedValue=n,this._value=r,this._rawInputValue=i,this.el.value!==o&&(this.el.value=o),e==="auto"?this.alignCursor():e!=null&&(this.cursorPos=e),s&&this._fireChangeEvents(),!this._historyChanging&&(s||this.history.isEmpty)&&this.history.push({unmaskedValue:n,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:n,...r}=e,i=!this.maskEquals(n),o=this.masked.optionsIsChanged(r);i&&(this.mask=n),o&&this.masked.updateOptions(r),(i||o)&&this.updateControl()}updateCursor(e){e!=null&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,ct.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,n){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(n),this}off(e,n){if(!this._listeners[e])return this;if(!n)return delete this._listeners[e],this;const r=this._listeners[e].indexOf(n);return r>=0&&this._listeners[e].splice(r,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const n=new n5({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),r=this.masked.rawInputValue,i=this.masked.splice(n.startChangePos,n.removed.length,n.inserted,n.removeDirection,{input:!0,raw:!0}).offset,o=r===this.masked.rawInputValue?n.removeDirection:ct.NONE;let s=this.masked.nearestInputPos(n.startChangePos+i,o);o!==ct.NONE&&(s=this.masked.nearestInputPos(s,ct.NONE)),this.updateControl(s),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}St.InputMask=o5;class Gn{static normalize(e){return Array.isArray(e)?e:[e,new Gn]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",skip:!1,tailShift:0},e)}aggregate(e){return this.rawInserted+=e.rawInserted,this.skip=this.skip||e.skip,this.inserted+=e.inserted,this.tailShift+=e.tailShift,this}get offset(){return this.tailShift+this.inserted.length}}St.ChangeDetails=Gn;class Pl{constructor(e,n,r){e===void 0&&(e=""),n===void 0&&(n=0),this.value=e,this.from=n,this.stop=r}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||e!=null&&this.from>=e)return"";const n=this.value[0];return this.value=this.value.slice(1),n}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}const th=class th{constructor(e){this._value="",this._update({...th.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,n){n===void 0&&(n={input:!0}),this.reset(),this.append(e,n,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,n){return e}totalInputPositions(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),Math.min(this.displayValue.length,n-e)}extractInput(e,n,r){return e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),this.displayValue.slice(e,n)}extractTail(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),new Pl(this.extractInput(e,n),e)}appendTail(e){return Lu(e)&&(e=new Pl(String(e))),e.appendTo(this)}_appendCharRaw(e,n){return e?(this._value+=e,new Gn({inserted:e,rawInserted:e})):new Gn}_appendChar(e,n,r){n===void 0&&(n={});const i=this.state;let o;if([e,o]=this.doPrepareChar(e,n),e&&(o=o.aggregate(this._appendCharRaw(e,n))),o.inserted){let s,a=this.doValidate(n)!==!1;if(a&&r!=null){const u=this.state;if(this.overwrite===!0){s=r.state;for(let f=0;f1&&e!==0&&!u?ct.NONE:i),c.tailShift=f-e),c.aggregate(this.remove(f)),u&&i!==ct.NONE&&l===this.rawInputValue)if(i===ct.FORCE_LEFT){let h;for(;l===this.rawInputValue&&(h=this.displayValue.length);)c.aggregate(new Gn({tailShift:-1})).aggregate(this.remove(h-1))}else i===ct.FORCE_RIGHT&&a.unshift();return c.aggregate(this.append(r,o,a))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!qm(this,e)}typedValueEquals(e){const n=this.typedValue;return e===n||th.EMPTY_VALUES.includes(e)&&th.EMPTY_VALUES.includes(n)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}};Xi(th,"DEFAULTS",{skipInvalid:!0}),Xi(th,"EMPTY_VALUES",[void 0,null,""]);let Al=th;St.Masked=Al;class Hc{constructor(e,n){e===void 0&&(e=[]),n===void 0&&(n=0),this.chunks=e,this.from=n}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=Lu(e)?new Pl(String(e)):e;const n=this.chunks[this.chunks.length-1],r=n&&(n.stop===e.stop||e.stop==null)&&e.from===n.from+n.toString().length;if(e instanceof Pl)r?n.extend(e.toString()):this.chunks.push(e);else if(e instanceof Hc){if(e.stop==null){let i;for(;e.chunks.length&&e.chunks[0].stop==null;)i=e.chunks.shift(),i.from+=e.from,this.extend(i)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof St.MaskedPattern))return new Pl(this.toString()).appendTo(e);const n=new Gn;for(let r=0;r=0){const u=e._appendPlaceholder(s);n.aggregate(u)}a=i instanceof Hc&&e._blocks[s]}if(a){const u=a.appendTail(i);u.skip=!1,n.aggregate(u),e._value+=u.inserted;const l=i.toString().slice(u.rawInserted.length);l&&n.aggregate(e.append(l,{tail:!0}))}else n.aggregate(e.append(i.toString(),{tail:!0}))}return n}get state(){return{chunks:this.chunks.map(e=>e.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:n,...r}=e;Object.assign(this,r),this.chunks=n.map(i=>{const o="chunks"in i?new Hc:new Pl;return o.state=i,o})}unshift(e){if(!this.chunks.length||e!=null&&this.from>=e)return"";const n=e!=null?e-this.from:e;let r=0;for(;r=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(e){var n;for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((n=this.block)==null?void 0:n.displayValue.length)||0)if(e())return this.ok=!0;return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,ct.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,ct.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,ct.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,ct.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,ct.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,ct.NONE),!0})}}class GS{constructor(e){Object.assign(this,e),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(e,n){return e===void 0&&(e=0),n===void 0&&(n=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(n),this._value||(this._isRawInput=!1),new Gn}nearestInputPos(e,n){n===void 0&&(n=ct.NONE);const r=0,i=this._value.length;switch(n){case ct.LEFT:case ct.FORCE_LEFT:return r;case ct.NONE:case ct.RIGHT:case ct.FORCE_RIGHT:default:return i}}totalInputPositions(e,n){return e===void 0&&(e=0),n===void 0&&(n=this._value.length),this._isRawInput?n-e:0}extractInput(e,n,r){return e===void 0&&(e=0),n===void 0&&(n=this._value.length),r===void 0&&(r={}),r.raw&&this._isRawInput&&this._value.slice(e,n)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(e,n){n===void 0&&(n={});const r=new Gn;if(this.isFilled)return r;const i=this.eager===!0||this.eager==="append",s=this.char===e&&(this.isUnmasking||n.input||n.raw)&&(!n.raw||!i)&&!n.tail;return s&&(r.rawInserted=this.char),this._value=r.inserted=this.char,this._isRawInput=s&&(n.raw||n.input),r}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new Gn;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new Pl("")}appendTail(e){return Lu(e)&&(e=new Pl(String(e))),e.appendTo(this)}append(e,n,r){const i=this._appendChar(e[0],n);return r!=null&&(i.tailShift+=this.appendTail(r).tailShift),i}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=!!e._rawInputValue}}class zm{constructor(e){const{parent:n,isOptional:r,placeholderChar:i,displayChar:o,lazy:s,eager:a,...u}=e;this.masked=kl(u),Object.assign(this,{parent:n,isOptional:r,placeholderChar:i,displayChar:o,lazy:s,eager:a})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.value.length),e===0&&n>=1?(this.isFilled=!1,this.masked.remove(e,n)):new Gn}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(e,n){if(n===void 0&&(n={}),this.isFilled)return new Gn;const r=this.masked.state,i=this.masked._appendChar(e,this.currentMaskFlags(n));return i.inserted&&this.doValidate(n)===!1&&(i.inserted=i.rawInserted="",this.masked.state=r),!i.inserted&&!this.isOptional&&!this.lazy&&!n.input&&(i.inserted=this.placeholderChar),i.skip=!i.inserted&&!this.isOptional,this.isFilled=!!i.inserted,i}append(e,n,r){return this.masked.append(e,this.currentMaskFlags(n),r)}_appendPlaceholder(){const e=new Gn;return this.isFilled||this.isOptional||(this.isFilled=!0,e.inserted=this.placeholderChar),e}_appendEager(){return new Gn}extractTail(e,n){return this.masked.extractTail(e,n)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,n,r){return e===void 0&&(e=0),n===void 0&&(n=this.value.length),this.masked.extractInput(e,n,r)}nearestInputPos(e,n){n===void 0&&(n=ct.NONE);const r=0,i=this.value.length,o=Math.min(Math.max(e,r),i);switch(n){case ct.LEFT:case ct.FORCE_LEFT:return this.isComplete?o:r;case ct.RIGHT:case ct.FORCE_RIGHT:return this.isComplete?o:i;case ct.NONE:default:return o}}totalInputPositions(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.value.length),this.value.slice(e,n).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var n;return{...e,_beforeTailState:((n=e==null?void 0:e._beforeTailState)==null?void 0:n.masked)||(e==null?void 0:e._beforeTailState)}}}Xi(zm,"DEFAULT_DEFINITIONS",{0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./});class a5 extends Al{updateOptions(e){super.updateOptions(e)}_update(e){const n=e.mask;n&&(e.validate=r=>r.search(n)>=0),super._update(e)}}St.MaskedRegExp=a5;const bl=class bl extends Al{constructor(e){super({...bl.DEFAULTS,...e,definitions:Object.assign({},zm.DEFAULT_DEFINITIONS,e==null?void 0:e.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const n=this.mask;if(!n||!e)return;let r=!1,i=!1;for(let o=0;ol.indexOf(h)===0);f.sort((h,d)=>d.length-h.length);const c=f[0];if(c){const{expose:h,repeat:d,...g}=up(this.blocks[c]),y={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,...g,repeat:d,parent:this},b=d!=null?new St.RepeatBlock(y):kl(y);b&&(this._blocks.push(b),h&&(this.exposeBlock=b),this._maskedBlocks[c]||(this._maskedBlocks[c]=[]),this._maskedBlocks[c].push(this._blocks.length-1)),o+=c.length-1;continue}}let s=n[o],a=s in e;if(s===bl.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(s==="{"||s==="}"){r=!r;continue}if(s==="["||s==="]"){i=!i;continue}if(s===bl.ESCAPE_CHAR){if(++o,s=n[o],!s)break;a=!1}const u=a?new zm({isOptional:i,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...up(e[s]),parent:this}):new GS({char:s,eager:this.eager,isUnmasking:r});this._blocks.push(u)}}get state(){return{...super.state,_blocks:this._blocks.map(e=>e.state)}}set state(e){if(!e){this.reset();return}const{_blocks:n,...r}=e;this._blocks.forEach((i,o)=>i.state=n[o]),super.state=r}reset(){super.reset(),this._blocks.forEach(e=>e.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(e=>e.isComplete)}get isFilled(){return this._blocks.every(e=>e.isFilled)}get isFixed(){return this._blocks.every(e=>e.isFixed)}get isOptional(){return this._blocks.every(e=>e.isOptional)}doCommit(){this._blocks.forEach(e=>e.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((e,n)=>e+=n.unmaskedValue,"")}set unmaskedValue(e){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(n),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((e,n)=>e+=n.value,"")}set value(e){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(n),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(n),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce((e,n)=>e+=n.displayValue,"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var r;const e=new Gn;let n=(r=this._mapPosToBlock(this.displayValue.length))==null?void 0:r.index;if(n==null)return e;this._blocks[n].isFilled&&++n;for(let i=n;i{const u=i.extractTail(s,a);u.stop=this._findStopBefore(o),u.from=this._blockStartPos(o),u instanceof Hc&&(u.blockIndex=o),r.extend(u)}),r}extractInput(e,n,r){if(e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),r===void 0&&(r={}),e===n)return"";let i="";return this._forEachBlocksInRange(e,n,(o,s,a,u)=>{i+=o.extractInput(a,u,r)}),i}_findStopBefore(e){let n;for(let r=0;r{var a;if(!s.lazy||e!=null){const u=s._appendPlaceholder((a=s._blocks)==null?void 0:a.length);this._value+=u.inserted,n.aggregate(u)}}),n}_mapPosToBlock(e){let n="";for(let r=0;rn+=r.displayValue.length,0)}_forEachBlocksInRange(e,n,r){n===void 0&&(n=this.displayValue.length);const i=this._mapPosToBlock(e);if(i){const o=this._mapPosToBlock(n),s=o&&i.index===o.index,a=i.offset,u=o&&s?o.offset:this._blocks[i.index].displayValue.length;if(r(this._blocks[i.index],i.index,a,u),o&&!s){for(let l=i.index+1;l{r.aggregate(i.remove(s,a))}),r}nearestInputPos(e,n){if(n===void 0&&(n=ct.NONE),!this._blocks.length)return 0;const r=new s5(this,e);if(n===ct.NONE)return r.pushRightBeforeInput()||(r.popState(),r.pushLeftBeforeInput())?r.pos:this.displayValue.length;if(n===ct.LEFT||n===ct.FORCE_LEFT){if(n===ct.LEFT){if(r.pushRightBeforeFilled(),r.ok&&r.pos===e)return e;r.popState()}if(r.pushLeftBeforeInput(),r.pushLeftBeforeRequired(),r.pushLeftBeforeFilled(),n===ct.LEFT){if(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.ok&&r.pos<=e||(r.popState(),r.ok&&r.pos<=e))return r.pos;r.popState()}return r.ok?r.pos:n===ct.FORCE_LEFT?0:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:0)}return n===ct.RIGHT||n===ct.FORCE_RIGHT?(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.pushRightBeforeFilled()?r.pos:n===ct.FORCE_RIGHT?this.displayValue.length:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:this.nearestInputPos(e,ct.LEFT))):e}totalInputPositions(e,n){e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length);let r=0;return this._forEachBlocksInRange(e,n,(i,o,s,a)=>{r+=i.totalInputPositions(s,a)}),r}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const n=this._maskedBlocks[e];return n?n.map(r=>this._blocks[r]):[]}};Xi(bl,"DEFAULTS",{lazy:!0,placeholderChar:"_"}),Xi(bl,"STOP_CHAR","`"),Xi(bl,"ESCAPE_CHAR","\\"),Xi(bl,"InputDefinition",zm),Xi(bl,"FixedDefinition",GS);let Gc=bl;St.MaskedPattern=Gc;class Hm extends Gc{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:n=this.to||0,from:r=this.from||0,maxLength:i=this.maxLength||0,autofix:o=this.autofix,...s}=e;this.to=n,this.from=r,this.maxLength=Math.max(String(n).length,i),this.autofix=o;const a=String(this.from).padStart(this.maxLength,"0"),u=String(this.to).padStart(this.maxLength,"0");let l=0;for(;lthis.maxLength)return["",r];const[a,u]=this.boundaries(s);return Number(u)this.to?this.autofix==="pad"&&s.length{const u=s[a];!("autofix"in u)&&"autofix"in e&&(u.autofix=e.autofix)}),super._update({...o,mask:Lu(n)?n:r,blocks:s})}doValidate(e){const n=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&n!=null&&(this.min==null||this.min<=n)&&(this.max==null||n<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(Cu.extractPatternOptions(e))}};Xi(Cu,"GET_DEFAULT_BLOCKS",()=>({d:{mask:Hm,from:1,to:31,maxLength:2},m:{mask:Hm,from:1,to:12,maxLength:2},Y:{mask:Hm,from:1900,to:9999}})),Xi(Cu,"DEFAULTS",{mask:Date,pattern:"d{.}`m{.}`Y",format:(e,n)=>{if(!e)return"";const r=String(e.getDate()).padStart(2,"0"),i=String(e.getMonth()+1).padStart(2,"0"),o=e.getFullYear();return[r,i,o].join(".")},parse:(e,n)=>{const[r,i,o]=e.split(".").map(Number);return new Date(o,i-1,r)}});let G1=Cu;St.MaskedDate=G1;const I1=class I1 extends Al{constructor(e){super({...I1.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map(n=>{const{expose:r,...i}=up(n),o=kl({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...i});return r&&(this.exposeMask=o),o}):[])}_appendCharRaw(e,n){n===void 0&&(n={});const r=this._applyDispatch(e,n);return this.currentMask&&r.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(n))),r}_applyDispatch(e,n,r){e===void 0&&(e=""),n===void 0&&(n={}),r===void 0&&(r="");const i=n.tail&&n._beforeTailState!=null?n._beforeTailState._value:this.value,o=this.rawInputValue,s=n.tail&&n._beforeTailState!=null?n._beforeTailState._rawInputValue:o,a=o.slice(s.length),u=this.currentMask,l=new Gn,f=u==null?void 0:u.state;if(this.currentMask=this.doDispatch(e,{...n},r),this.currentMask)if(this.currentMask!==u){if(this.currentMask.reset(),s){const c=this.currentMask.append(s,{raw:!0});l.tailShift=c.inserted.length-i.length}a&&(l.tailShift+=this.currentMask.append(a,{raw:!0,tail:!0}).tailShift)}else f&&(this.currentMask.state=f);return l}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const n=new Gn;return e&&n.aggregate(this._applyDispatch("",{},e)),n.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var n,r;return{...e,_beforeTailState:((n=e._beforeTailState)==null?void 0:n.currentMaskRef)===this.currentMask&&((r=e._beforeTailState)==null?void 0:r.currentMask)||e._beforeTailState}}doDispatch(e,n,r){return n===void 0&&(n={}),r===void 0&&(r=""),this.dispatch(e,this,n,r)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,n){n===void 0&&(n={});let[r,i]=super.doPrepare(e,n);if(this.currentMask){let o;[r,o]=super.doPrepare(r,this.currentMaskFlags(n)),i=i.aggregate(o)}return[r,i]}doPrepareChar(e,n){n===void 0&&(n={});let[r,i]=super.doPrepareChar(e,n);if(this.currentMask){let o;[r,o]=super.doPrepareChar(r,this.currentMaskFlags(n)),i=i.aggregate(o)}return[r,i]}reset(){var e;(e=this.currentMask)==null||e.reset(),this.compiledMasks.forEach(n=>n.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask){this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,this._applyDispatch();return}let n=String(e);this.currentMask&&(this.currentMask.typedValue=e,n=this.currentMask.unmaskedValue),this.unmaskedValue=n}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return!!((e=this.currentMask)!=null&&e.isComplete)}get isFilled(){var e;return!!((e=this.currentMask)!=null&&e.isFilled)}remove(e,n){const r=new Gn;return this.currentMask&&r.aggregate(this.currentMask.remove(e,n)).aggregate(this._applyDispatch()),r}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(n=>n.state),currentMaskRef:this.currentMask,currentMask:(e=this.currentMask)==null?void 0:e.state}}set state(e){const{compiledMasks:n,currentMaskRef:r,currentMask:i,...o}=e;n&&this.compiledMasks.forEach((s,a)=>s.state=n[a]),r!=null&&(this.currentMask=r,this.currentMask.state=i),super.state=o}extractInput(e,n,r){return this.currentMask?this.currentMask.extractInput(e,n,r):""}extractTail(e,n){return this.currentMask?this.currentMask.extractTail(e,n):super.extractTail(e,n)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,n){return this.currentMask?this.currentMask.nearestInputPos(e,n):super.nearestInputPos(e,n)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every((n,r)=>{if(!e[r])return;const{mask:i,...o}=e[r];return qm(n,o)&&n.maskEquals(i)}):super.maskEquals(e)}typedValueEquals(e){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(e))}};Xi(I1,"DEFAULTS");let Gm=I1;Gm.DEFAULTS={dispatch:(t,e,n,r)=>{if(!e.compiledMasks.length)return;const i=e.rawInputValue,o=e.compiledMasks.map((s,a)=>{const u=e.currentMask===s,l=u?s.displayValue.length:s.nearestInputPos(s.displayValue.length,ct.FORCE_LEFT);return s.rawInputValue!==i?(s.reset(),s.append(i,{raw:!0})):u||s.remove(l),s.append(t,e.currentMaskFlags(n)),s.appendTail(r),{index:a,weight:s.rawInputValue.length,totalInputPositions:s.totalInputPositions(0,Math.max(l,s.nearestInputPos(s.displayValue.length,ct.FORCE_LEFT)))}});return o.sort((s,a)=>a.weight-s.weight||a.totalInputPositions-s.totalInputPositions),e.compiledMasks[o[0].index]}},St.MaskedDynamic=Gm;class l5 extends Gc{constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:n,...r}=e;if(n){const i=n.map(a=>a.length),o=Math.min(...i),s=Math.max(...i)-o;r.mask="*".repeat(o),s&&(r.mask+="["+"*".repeat(s)+"]"),this.enum=n}super._update(r)}doValidate(e){return this.enum.some(n=>n.indexOf(this.unmaskedValue)===0)&&super.doValidate(e)}}St.MaskedEnum=l5;class u5 extends Al{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}St.MaskedFunction=u5;const aa=class aa extends Al{constructor(e){super({...aa.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",r=(this.scale?`(${U1(this.radix)}\\d{0,${this.scale}})?`:"")+"$";this._numberRegExp=new RegExp(e+n+r),this._mapToRadixRegExp=new RegExp(`[${this.mapToRadix.map(U1).join("")}]`,"g"),this._thousandsSeparatorRegExp=new RegExp(U1(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const n=e.split(this.radix);return n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),n.join(this.radix)}doPrepareChar(e,n){n===void 0&&(n={});const[r,i]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(n.input&&n.raw||!n.input&&!n.raw)?e.replace(this._mapToRadixRegExp,this.radix):e),n);return e&&!r&&(i.skip=!0),r&&!this.allowPositive&&!this.value&&r!=="-"&&i.aggregate(this._appendChar("-")),[r,i]}_separatorsCount(e,n){n===void 0&&(n=!1);let r=0;for(let i=0;i=0&&(e=r);const i=this._findSeparatorAround(n);return i>=0&&(n=i+this.thousandsSeparator.length),[e,n]}remove(e,n){e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),[e,n]=this._adjustRangeWithSeparators(e,n);const r=this.value.slice(0,e),i=this.value.slice(n),o=this._separatorsCount(r.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(r+i));const s=this._separatorsCountFromSlice(r);return new Gn({tailShift:(s-o)*this.thousandsSeparator.length})}nearestInputPos(e,n){if(!this.thousandsSeparator)return e;switch(n){case ct.NONE:case ct.LEFT:case ct.FORCE_LEFT:{const r=this._findSeparatorAround(e-1);if(r>=0){const i=r+this.thousandsSeparator.length;if(e=0)return r+this.thousandsSeparator.length}}return e}doValidate(e){let n=!!this._removeThousandsSeparators(this.value).match(this._numberRegExp);if(n){const r=this.number;n=n&&!isNaN(r)&&(this.min==null||this.min>=0||this.min<=this.number)&&(this.max==null||this.max<=0||this.number<=this.max)}return n&&super.doValidate(e)}doCommit(){if(this.value){const e=this.number;let n=e;this.min!=null&&(n=Math.max(n,this.min)),this.max!=null&&(n=Math.min(n,this.max)),n!==e&&(this.unmaskedValue=this.format(n,this));let r=this.value;this.normalizeZeros&&(r=this._normalizeZeros(r)),this.padFractionalZeros&&this.scale>0&&(r=this._padFractionalZeros(r)),this._value=r}super.doCommit()}_normalizeZeros(e){const n=this._removeThousandsSeparators(e).split(this.radix);return n[0]=n[0].replace(/^(\D*)(0*)(\d*)/,(r,i,o,s)=>i+s),e.length&&!/\d$/.test(n[0])&&(n[0]=n[0]+"0"),n.length>1&&(n[1]=n[1].replace(/0*$/,""),n[1].length||(n.length=1)),this._insertThousandsSeparators(n.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const n=e.split(this.radix);return n.length<2&&n.push(""),n[1]=n[1].padEnd(this.scale,"0"),n.join(this.radix)}doSkipInvalid(e,n,r){n===void 0&&(n={});const i=this.scale===0&&e!==this.thousandsSeparator&&(e===this.radix||e===aa.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,n,r)&&!i}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,aa.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace(aa.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(e){return(super.typedValueEquals(e)||aa.EMPTY_VALUES.includes(e)&&aa.EMPTY_VALUES.includes(this.typedValue))&&!(e===0&&this.value==="")}};Xi(aa,"UNMASKED_RADIX","."),Xi(aa,"EMPTY_VALUES",[...Al.EMPTY_VALUES,0]),Xi(aa,"DEFAULTS",{mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[aa.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:e=>e.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})});let Y1=aa;St.MaskedNumber=Y1;const W1={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function YS(t,e,n){e===void 0&&(e=W1.MASKED),n===void 0&&(n=W1.MASKED);const r=kl(t);return i=>r.runIsolated(o=>(o[e]=i,o[n]))}function c5(t,e,n,r){return YS(e,n,r)(t)}St.PIPE_TYPE=W1,St.createPipe=YS,St.pipe=c5;class f5 extends Gc{get repeatFrom(){return(Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)??0}get repeatTo(){return(Array.isArray(this.repeat)?this.repeat[1]:this.repeat)??1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var o;const{repeat:n,...r}=up(e);this._blockOpts=Object.assign({},this._blockOpts,r);const i=kl(this._blockOpts);this.repeat=n??i.repeat??this.repeat??1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((o=this._blocks)==null?void 0:o.length)||0,this.repeatFrom)),blocks:{m:i},eager:i.eager,overwrite:i.overwrite,skipInvalid:i.skipInvalid,lazy:i.lazy,placeholderChar:i.placeholderChar,displayChar:i.displayChar})}_allocateBlock(e){if(e""},icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},modelValue:{type:String,default:()=>""},placeholder:{type:String,default:()=>""},iconPosition:{type:String,default:()=>"right"}},computed:{modelState:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}}},mounted(){this.initMask()},methods:{initMask(){const e=this.$refs.formText.$el.querySelector("input");St(e,{mask:this.mask})}}});function d5(t,e,n,r,i,o){const s=E.resolveComponent("VsFormText");return E.openBlock(),E.createElementBlock("div",null,[E.createVNode(s,{ref:"formText",icon:t.icon,iconPosition:t.iconPosition,disabled:t.disabled,clearable:t.clearable,modelValue:t.modelState,"onUpdate:modelValue":e[0]||(e[0]=a=>t.modelState=a),placeholder:t.placeholder},null,8,["icon","iconPosition","disabled","clearable","modelValue","placeholder"])])}const WS=lt(h5,[["render",d5]]),p5=E.defineComponent({props:{value:{type:[String,Number],default:()=>""},label:{type:[String,Number],default:()=>""},modelValue:{type:[Array,String],default:()=>""},disabled:{type:Boolean,default:()=>!1}},emits:["update:modelValue"],data(){return{id:`radio-${Math.floor(Math.random()*1e4)}`}},computed:{modelState:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}},labelCursorClasses(){return[{"cursor-not-allowed":this.disabled},{"cursor-pointer":!this.disabled}]}}}),g5={class:"flex"},m5=["value","name","id","disabled"],y5=["for"];function v5(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("div",g5,[E.withDirectives(E.createElementVNode("input",{value:t.value,"onUpdate:modelValue":e[0]||(e[0]=s=>t.modelState=s),type:"radio",name:t.id,class:"shrink-0 cursor-pointer transition-all mt-0.5 border-gray-200 rounded-full text-blue-600 ring-0 focus:ring-0 outline-none focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed",id:t.id,disabled:t.disabled},null,8,m5),[[E.vModelRadio,t.modelState]]),E.createElementVNode("label",{for:t.id,class:E.normalizeClass(["text-sm text-gray-500 ms-2",t.labelCursorClasses])},[E.renderSlot(t.$slots,"default",{},()=>[E.createTextVNode(E.toDisplayString(t.label),1)])],10,y5)])}const X1=lt(p5,[["render",v5]]),_5=E.defineComponent({props:{value:{type:[String,Number],default:()=>""},label:{type:[String,Number],default:()=>""},disabled:{type:Boolean,default:()=>!1},modelValue:{type:[Array,Boolean],default:()=>!1}},emits:["update:modelValue"],data(){return{id:`radio-${Math.floor(Math.random()*1e4)}`}},computed:{modelState:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}}}}),b5=["value","id","disabled"],E5=["for"];function w5(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("div",{class:E.normalizeClass(["flex",{"cursor-not-allowed":t.disabled}])},[E.withDirectives(E.createElementVNode("input",{type:"checkbox",value:t.value,"onUpdate:modelValue":e[0]||(e[0]=s=>t.modelState=s),class:"shrink-0 transition-all cursor-pointer mt-0.5 border-gray-200 rounded text-blue-600 ring-0 focus:ring-0 outline-none focus:border focus:border-blue-500 disabled:opacity-50 disabled:pointer-events-none",id:t.id,disabled:t.disabled},null,8,b5),[[E.vModelCheckbox,t.modelState]]),t.label?(E.openBlock(),E.createElementBlock("label",{key:0,for:t.id,class:"text-sm cursor-pointer text-gray-500 ms-3 checked:text-blue-500"},[E.renderSlot(t.$slots,"default",{},()=>[E.createTextVNode(E.toDisplayString(t.label),1)])],8,E5)):E.createCommentVNode("",!0)],2)}const Ym=lt(_5,[["render",w5]]),x5=E.defineComponent({props:{modelValue:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1}},data(){return{}},computed:{modelState:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}},labelCursorClasses(){return[{"cursor-not-allowed":this.disabled},{"cursor-pointer":!this.disabled}]}},methods:{handleEnterDown(t){const{keyCode:e}=t;e===13&&(this.modelState=!this.modelState)},addKeyHandler(){window.addEventListener("keydown",this.handleEnterDown)},removeKeyHandler(){window.removeEventListener("keydown",this.handleEnterDown)}}}),S5=["disabled"],C5={class:"ml-2 text-sm"};function N5(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("label",{class:E.normalizeClass(["relative inline-flex items-center cursor-pointer",t.labelCursorClasses])},[E.withDirectives(E.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=s=>t.modelState=s),type:"checkbox",value:"",class:"sr-only peer",disabled:t.disabled,tabindex:"-1"},null,8,S5),[[E.vModelCheckbox,t.modelState]]),E.createElementVNode("div",{class:"w-11 h-6 bg-gray-200 transition-all rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600 outline-none focus:border focus:border-blue-500",tabindex:"0",onFocus:e[1]||(e[1]=(...s)=>t.addKeyHandler&&t.addKeyHandler(...s)),onBlur:e[2]||(e[2]=(...s)=>t.removeKeyHandler&&t.removeKeyHandler(...s))},null,32),E.createElementVNode("span",C5,[E.renderSlot(t.$slots,"default",{},()=>[E.createTextVNode(E.toDisplayString(t.title),1)])])],2)}const XS=lt(x5,[["render",N5]]),O5=E.defineComponent({components:{VsFormText:zc},emits:["onSearch","update:modelValue","menuKeyUp","menuKeyDown","menuEnterSelect"],props:{disabled:{type:Boolean,default:()=>!1},placeholder:{type:String,default:()=>"Обрати"},clearable:{type:Boolean,default:()=>!1},modelValue:{type:[String,Array,Number],default:()=>""},multiple:{type:Boolean,default:()=>!1},searchable:{type:Boolean,default:()=>!1},searchPlaceholder:{type:String,default:()=>"Search..."},searchIcon:{type:String,default:()=>"ti-search"},lazyLoad:{type:Function,default:null},searchHighlight:{type:Boolean,default:()=>!1}},watch:{modelValue:{handler(){this.currentOption=null,this.getValue(),this.searchValue="",this.handleSearch()}}},computed:{tooltip(){return this.selectedOptions.map(t=>t==null?void 0:t.label).join(",")}},data(){return{list:{canClose:!1,visible:!1},currentOption:null,searchValue:"",selectedOptions:[]}},mounted(){window.addEventListener("keydown",this.handleKeyDown),window.addEventListener("click",this.clickOnBody,!1),window.addEventListener("resize",this.boundList),window.addEventListener("scroll",this.boundList),window.addEventListener("popstate",this.handleBrowserBackButton),this.lazyLoad!==null&&typeof this.lazyLoad=="function"?this.lazyLoad().then(()=>{this.getValue()}):this.getValue()},beforeUnmount(){window.removeEventListener("keydown",this.handleKeyDown),window.removeEventListener("click",this.clickOnBody),window.removeEventListener("resize",this.boundList),window.removeEventListener("scroll",this.boundList),window.removeEventListener("popstate",this.handleBrowserBackButton)},methods:{toggleDropdown(){var t;if(!this.disabled&&(this.list.visible=!this.list.visible,this.list.visible)){this.$nextTick(()=>{this.boundList()});const e=(t=this.$refs.autocompleteSearch.$el)==null?void 0:t.querySelector("input");e&&this.$nextTick(()=>{setTimeout(()=>{e.focus()},50)})}},handleKeyDown(t){if(this.list.visible){const{keyCode:e}=t;switch([38,40].includes(e)&&t.preventDefault(),e){case 38:this.$emit("menuKeyUp");break;case 40:this.$emit("menuKeyDown");break;case 13:this.$emit("menuEnterSelect"),this.multiple||this.closeList();break}}},clickOnBody(){this.list.canClose&&(this.list.visible=!1)},handleBrowserBackButton(){this.list.visible&&(this.list.visible=!1)},boundList(){var r,i;const t=(r=this.$refs)==null?void 0:r.button,e=t==null?void 0:t.getBoundingClientRect();if(!this.list.visible)return;const n=(i=this.$refs)==null?void 0:i.list;if(n){const o=e.top,s=n.clientHeight,a=window.innerHeight>=e.bottom+s+15?o+38:o-s-8;n.style.top=`${a}px`,n.style.left=`${e.left}px`,n.style.width=`${t.clientWidth}px`}},disallowBodyClick(t){const{type:e}=t;switch(this.boundList(),e){case"mouseenter":this.list.canClose=!1;break;default:this.list.canClose=!0;break}},getValue(){const t=this.$slots.default(),e=typeof t=="string"?[]:t,n=i=>i.reduce((o,s)=>{const a=s==null?void 0:s.children;return Array.isArray(a)&&!s.dynamicProps&&!s.key?o.concat(n(a)):o.concat(s)},[]),r=n(e);this.multiple?this.setMultipleOption(r):this.setSingleOption(r)},clearValue(){this.$emit("update:modelValue",this.multiple?[]:"")},closeList(){this.list.visible=!1},setSingleOption(t){const e=t.find(n=>{var i,o;const r=((i=n==null?void 0:n.props)==null?void 0:i.value)||((o=n==null?void 0:n.props)==null?void 0:o.label);if(typeof this.modelValue!="object")return r==this.modelValue});if(e){const n=e==null?void 0:e.props;this.currentOption=n}this.closeList()},setMultipleOption(t){this.selectedOptions=t.reduce((e,n)=>{var i,o;const r=((i=n==null?void 0:n.props)==null?void 0:i.value)||((o=n==null?void 0:n.props)==null?void 0:o.label);return this.modelValue&&this.modelValue.includes(r)?e.concat(n.props):e},[])},returnLabel(t){return(t==null?void 0:t.label)||(t==null?void 0:t.value)||t},handleSearch(){this.$emit("onSearch",this.searchValue)}}}),T5=["title"],I5={key:0,class:"flex items-center"},M5={key:1,class:"opacity-50 truncate pr-4"},k5={class:"vsTailwind",ref:"list",style:{position:"fixed","z-index":"10002"}},P5={ref:"listWrapper",class:"form-autocomplete__list vsTailwind"};function A5(t,e,n,r,i,o){var a,u;const s=E.resolveComponent("VsFormText");return E.openBlock(),E.createElementBlock("div",{class:E.normalizeClass(["form-autocomplete relative min-w-[6rem] vsTailwind",{"cursor-not-allowed":t.disabled}]),onMouseenter:e[6]||(e[6]=(...l)=>t.disallowBodyClick&&t.disallowBodyClick(...l)),onMouseleave:e[7]||(e[7]=(...l)=>t.disallowBodyClick&&t.disallowBodyClick(...l))},[E.createElementVNode("button",{title:t.tooltip,class:E.normalizeClass(["form-autocomplete__button py-2 px-4 transition-all block text-left font-semi relative block border border-solid w-full items-center gap-x-2 text-sm rounded-lg border border-gray-200 bg-white text-gray-800 hover:bg-gray-50 outline-none focus:border focus:border-blue-500",{"opacity-50 pointer-events-none":t.disabled,"ring-blue-500 border-blue-500":t.list.visible}]),ref:"button",type:"button",onClick:e[1]||(e[1]=(...l)=>t.toggleDropdown&&t.toggleDropdown(...l))},[t.selectedOptions.length||t.currentOption?(E.openBlock(),E.createElementBlock(E.Fragment,{key:0},[t.multiple?(E.openBlock(),E.createElementBlock(E.Fragment,{key:1},[E.createTextVNode(E.toDisplayString(`Обрано: ${t.selectedOptions.length}`),1)],64)):(E.openBlock(),E.createElementBlock("div",I5,[typeof t.currentOption=="object"&&((a=t.currentOption)!=null&&a.color)?(E.openBlock(),E.createElementBlock("div",{key:0,class:"w-4 h-4 rounded-md mr-2",style:E.normalizeStyle({"background-color":t.currentOption.color})},null,4)):E.createCommentVNode("",!0),E.createTextVNode(" "+E.toDisplayString(t.returnLabel(t.currentOption)),1)]))],64)):(E.openBlock(),E.createElementBlock("div",M5,E.toDisplayString(t.placeholder),1)),E.withDirectives(E.createElementVNode("i",{class:"absolute bottom-2/4 z-50 translate-y-2/4 ti ti-x right-8 hover:text-red-500 text-gray-500",onClick:e[0]||(e[0]=E.withModifiers((...l)=>t.clearValue&&t.clearValue(...l),["stop"]))},null,512),[[E.vShow,t.clearable&&((u=t.modelValue)==null?void 0:u.length)]]),E.createElementVNode("i",{class:E.normalizeClass(["ti ti-chevron-down absolute right-3 translate-y-2/4 bottom-1/2 text-500-gray text-gray-500",{"rotate-180":t.list.visible}])},null,2)],10,T5),(E.openBlock(),E.createBlock(E.Teleport,{to:"body"},[E.createElementVNode("div",k5,[E.withDirectives(E.createElementVNode("div",{class:"bg-white form-autocomplete__wrapper w-full border z-10 shadow-sm rounded-lg p-2 mt-2",onMouseenter:e[4]||(e[4]=(...l)=>t.disallowBodyClick&&t.disallowBodyClick(...l)),onMouseleave:e[5]||(e[5]=(...l)=>t.disallowBodyClick&&t.disallowBodyClick(...l))},[E.withDirectives(E.createVNode(s,{modelValue:t.searchValue,"onUpdate:modelValue":e[2]||(e[2]=l=>t.searchValue=l),class:"mb-2",placeholder:t.searchPlaceholder,icon:t.searchIcon,ref:"autocompleteSearch",onClick:e[3]||(e[3]=E.withModifiers(()=>{},["stop","self"])),onOnInput:t.handleSearch},null,8,["modelValue","placeholder","icon","onOnInput"]),[[E.vShow,t.searchable]]),E.createElementVNode("div",P5,[E.renderSlot(t.$slots,"default")],512)],544),[[E.vShow,t.list.visible]])],512)]))],34)}const KS=lt(O5,[["render",A5]]),L5=E.defineComponent({props:{isHighlighted:{type:Boolean,default:()=>!1},value:{type:String,default:()=>""},label:{type:String,default:()=>""}},computed:{parentInstance(){return this.$parent},parentValue(){return this.parentInstance.modelValue},parentSearchValue(){return this.parentInstance.searchValue},parentMultiple(){return this.parentInstance.multiple},isValueEqualParentValue(){const t=this.value||this.label;return this.parentMultiple?this.parentValue.includes(t):this.parentValue==t},activeClass(){return`${this.parentMultiple?"":"cursor-default"}`},highlightedText(){var t;return!this.parentSearchValue||!((t=this.parentInstance)!=null&&t.searchHighlight)?this.label:this.label.replace(new RegExp(this.parentSearchValue,"gi"),e=>`${e}`)}},methods:{handleClick(){const t=this.value||this.label,e=this.parentInstance;if(t===this.parentValue&&!this.parentMultiple){e.closeList();return}if(this.parentMultiple){const n=Array.isArray(this.parentValue)?this.parentValue:[];this.parentValue.includes(t)?e.$emit("update:modelValue",n.filter(r=>r!==t)):e.$emit("update:modelValue",n.concat(t))}else e.$emit("update:modelValue",t)}}}),D5=["innerHTML"],R5={key:0,class:"flex-shrink-0 w-3.5 h-3.5 text-blue-600",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},F5=[E.createElementVNode("polyline",{points:"20 6 9 17 4 12"},null,-1)];function B5(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("div",{class:E.normalizeClass(["form-autocomplete__item flex items-center justify-between gap-x-3.5 py-2 px-3 transition-all rounded-lg text-sm text-gray-800 cursor-pointer hover:bg-gray-100 active:bg-gray-200",{[t.activeClass]:t.isValueEqualParentValue,"bg-gray-100":t.isHighlighted}]),onClick:e[0]||(e[0]=E.withModifiers((...s)=>t.handleClick&&t.handleClick(...s),["stop"]))},[E.createElementVNode("div",{innerHTML:t.highlightedText,class:E.normalizeClass({"font-medium":t.isValueEqualParentValue})},null,10,D5),t.isValueEqualParentValue?(E.openBlock(),E.createElementBlock("svg",R5,F5)):E.createCommentVNode("",!0)],2)}const ZS=lt(L5,[["render",B5]]),V5=E.defineComponent({emits:["command"],props:{value:{type:String,default:()=>""},label:{type:String,default:"Обрати..."},icon:{type:String,default:()=>""},iconPosition:{type:String,default:()=>"left"},chevronIcon:{type:Boolean,default:()=>!0}},data(){return{list:{visible:!1,canClose:!1},currentOption:""}},mounted(){window.addEventListener("click",this.closeDropdownOnClickOutside,!1),window.addEventListener("resize",this.boundList),window.addEventListener("scroll",this.boundList)},beforeUnmount(){window.removeEventListener("click",this.closeDropdownOnClickOutside),window.removeEventListener("resize",this.boundList),window.removeEventListener("scroll",this.boundList)},methods:{handleClick(){this.list.visible=!this.list.visible,this.list.visible&&this.boundList()},closeDropdownOnClickOutside(){this.list.canClose&&(this.list.visible=!1)},disallowBodyClick(t){const{type:e}=t;switch(e){case"mouseenter":this.list.canClose=!1;break;default:this.list.canClose=!0;break}},boundList(){var n;const t=(n=this.$refs)==null?void 0:n.button,e=t==null?void 0:t.getBoundingClientRect();this.list.visible&&this.$nextTick(()=>{var i;const r=(i=this.$refs)==null?void 0:i.list;r.style.top=`${e.bottom}px`,r.style.left=`${e.left}px`,r.style.width=`${t.clientWidth}px`})},handleChange(t){this.currentOption=t,this.$emit("command",t),this.list.visible=!1}}}),$5={type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none"},j5={key:1},q5=[E.createElementVNode("path",{d:"m6 9 6 6 6-6"},null,-1)],U5={class:"min-w-[7rem] bg-white shadow-md rounded-lg p-2 mt-2 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},z5={class:"form-dropdown__list"};function H5(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("div",{class:"flex flex-col gap-1",onMouseenter:e[3]||(e[3]=(...s)=>t.disallowBodyClick&&t.disallowBodyClick(...s)),onMouseleave:e[4]||(e[4]=(...s)=>t.disallowBodyClick&&t.disallowBodyClick(...s))},[E.createElementVNode("div",{onClick:e[0]||(e[0]=(...s)=>t.handleClick&&t.handleClick(...s)),class:"block w-fit",ref:"button"},[E.renderSlot(t.$slots,"button",{},()=>[E.createElementVNode("button",$5,[t.icon&&t.iconPosition==="left"?(E.openBlock(),E.createElementBlock("i",{key:0,class:E.normalizeClass(t.icon)},null,2)):E.createCommentVNode("",!0),t.label?(E.openBlock(),E.createElementBlock("span",j5,E.toDisplayString(t.label),1)):E.createCommentVNode("",!0),t.chevronIcon?(E.openBlock(),E.createElementBlock("svg",{key:2,class:E.normalizeClass(["w-4 h-4 ml-auto transition-transform",{"rotate-180":t.list.visible}]),xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},q5,2)):E.createCommentVNode("",!0),t.icon&&t.iconPosition==="right"?(E.openBlock(),E.createElementBlock("i",{key:3,class:E.normalizeClass(t.icon)},null,2)):E.createCommentVNode("",!0)])])],512),(E.openBlock(),E.createBlock(E.Teleport,{to:"body"},[E.createVNode(E.Transition,{name:"fade"},{default:E.withCtx(()=>[E.withDirectives(E.createElementVNode("div",{class:"vsTailwind fixed",ref:"list",onMouseenter:e[1]||(e[1]=(...s)=>t.disallowBodyClick&&t.disallowBodyClick(...s)),onMouseleave:e[2]||(e[2]=(...s)=>t.disallowBodyClick&&t.disallowBodyClick(...s))},[E.createElementVNode("div",U5,[E.createElementVNode("div",z5,[E.renderSlot(t.$slots,"default")])])],544),[[E.vShow,t.list.visible]])]),_:3})]))],32)}const G5=lt(V5,[["render",H5]]);//! moment.js //! version : 2.30.1 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT //! momentjs.com var JS;function ze(){return JS.apply(null,arguments)}function Y5(t){JS=t}function ua(t){return t instanceof Array||Object.prototype.toString.call(t)==="[object Array]"}function Yc(t){return t!=null&&Object.prototype.toString.call(t)==="[object Object]"}function Fn(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function K1(t){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(t).length===0;var e;for(e in t)if(Fn(t,e))return!1;return!0}function Bo(t){return t===void 0}function Ll(t){return typeof t=="number"||Object.prototype.toString.call(t)==="[object Number]"}function cp(t){return t instanceof Date||Object.prototype.toString.call(t)==="[object Date]"}function QS(t,e){var n=[],r,i=t.length;for(r=0;r>>0,r;for(r=0;r0)for(n=0;n=0;return(o?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}var i_=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Xm=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,o_={},bh={};function ut(t,e,n,r){var i=r;typeof r=="string"&&(i=function(){return this[r]()}),t&&(bh[t]=i),e&&(bh[e[0]]=function(){return qa(i.apply(this,arguments),e[1],e[2])}),n&&(bh[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),t)})}function J5(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function Q5(t){var e=t.match(i_),n,r;for(n=0,r=e.length;n=0&&Xm.test(t);)t=t.replace(Xm,r),Xm.lastIndex=0,n-=1;return t}var eR={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function tR(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.match(i_).map(function(r){return r==="MMMM"||r==="MM"||r==="DD"||r==="dddd"?r.slice(1):r}).join(""),this._longDateFormat[t])}var nR="Invalid date";function rR(){return this._invalidDate}var iR="%d",oR=/\d{1,2}/;function sR(t){return this._ordinal.replace("%d",t)}var aR={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function lR(t,e,n,r){var i=this._relativeTime[n];return ja(i)?i(t,e,n,r):i.replace(/%d/i,t)}function uR(t,e){var n=this._relativeTime[t>0?"future":"past"];return ja(n)?n(e):n.replace(/%s/i,e)}var oC={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function Ts(t){return typeof t=="string"?oC[t]||oC[t.toLowerCase()]:void 0}function s_(t){var e={},n,r;for(r in t)Fn(t,r)&&(n=Ts(r),n&&(e[n]=t[r]));return e}var cR={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function fR(t){var e=[],n;for(n in t)Fn(t,n)&&e.push({unit:n,priority:cR[n]});return e.sort(function(r,i){return r.priority-i.priority}),e}var sC=/\d/,us=/\d\d/,aC=/\d{3}/,a_=/\d{4}/,Zm=/[+-]?\d{6}/,hr=/\d\d?/,lC=/\d\d\d\d?/,uC=/\d\d\d\d\d\d?/,Jm=/\d{1,3}/,l_=/\d{1,4}/,Qm=/[+-]?\d{1,6}/,Eh=/\d+/,ey=/[+-]?\d+/,hR=/Z|[+-]\d\d:?\d\d/gi,ty=/Z|[+-]\d\d(?::?\d\d)?/gi,dR=/[+-]?\d+(\.\d{1,3})?/,hp=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,wh=/^[1-9]\d?/,u_=/^([1-9]\d|\d)/,ny;ny={};function Ke(t,e,n){ny[t]=ja(e)?e:function(r,i){return r&&n?n:e}}function pR(t,e){return Fn(ny,t)?ny[t](e._strict,e._locale):new RegExp(gR(t))}function gR(t){return Dl(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,n,r,i,o){return n||r||i||o}))}function Dl(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Is(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function yn(t){var e=+t,n=0;return e!==0&&isFinite(e)&&(n=Is(e)),n}var c_={};function Qn(t,e){var n,r=e,i;for(typeof t=="string"&&(t=[t]),Ll(e)&&(r=function(o,s){s[e]=yn(o)}),i=t.length,n=0;n68?1900:2e3)};var cC=xh("FullYear",!0);function _R(){return ry(this.year())}function xh(t,e){return function(n){return n!=null?(fC(this,t,n),ze.updateOffset(this,e),this):gp(this,t)}}function gp(t,e){if(!t.isValid())return NaN;var n=t._d,r=t._isUTC;switch(e){case"Milliseconds":return r?n.getUTCMilliseconds():n.getMilliseconds();case"Seconds":return r?n.getUTCSeconds():n.getSeconds();case"Minutes":return r?n.getUTCMinutes():n.getMinutes();case"Hours":return r?n.getUTCHours():n.getHours();case"Date":return r?n.getUTCDate():n.getDate();case"Day":return r?n.getUTCDay():n.getDay();case"Month":return r?n.getUTCMonth():n.getMonth();case"FullYear":return r?n.getUTCFullYear():n.getFullYear();default:return NaN}}function fC(t,e,n){var r,i,o,s,a;if(!(!t.isValid()||isNaN(n))){switch(r=t._d,i=t._isUTC,e){case"Milliseconds":return void(i?r.setUTCMilliseconds(n):r.setMilliseconds(n));case"Seconds":return void(i?r.setUTCSeconds(n):r.setSeconds(n));case"Minutes":return void(i?r.setUTCMinutes(n):r.setMinutes(n));case"Hours":return void(i?r.setUTCHours(n):r.setHours(n));case"Date":return void(i?r.setUTCDate(n):r.setDate(n));case"FullYear":break;default:return}o=n,s=t.month(),a=t.date(),a=a===29&&s===1&&!ry(o)?28:a,i?r.setUTCFullYear(o,s,a):r.setFullYear(o,s,a)}}function bR(t){return t=Ts(t),ja(this[t])?this[t]():this}function ER(t,e){if(typeof t=="object"){t=s_(t);var n=fR(t),r,i=n.length;for(r=0;r=0?(a=new Date(t+400,e,n,r,i,o,s),isFinite(a.getFullYear())&&a.setFullYear(t)):a=new Date(t,e,n,r,i,o,s),a}function mp(t){var e,n;return t<100&&t>=0?(n=Array.prototype.slice.call(arguments),n[0]=t+400,e=new Date(Date.UTC.apply(null,n)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t)):e=new Date(Date.UTC.apply(null,arguments)),e}function iy(t,e,n){var r=7+e-n,i=(7+mp(t,0,r).getUTCDay()-e)%7;return-i+r-1}function yC(t,e,n,r,i){var o=(7+n-r)%7,s=iy(t,r,i),a=1+7*(e-1)+o+s,u,l;return a<=0?(u=t-1,l=pp(u)+a):a>pp(t)?(u=t+1,l=a-pp(t)):(u=t,l=a),{year:u,dayOfYear:l}}function yp(t,e,n){var r=iy(t.year(),e,n),i=Math.floor((t.dayOfYear()-r-1)/7)+1,o,s;return i<1?(s=t.year()-1,o=i+Bl(s,e,n)):i>Bl(t.year(),e,n)?(o=i-Bl(t.year(),e,n),s=t.year()+1):(s=t.year(),o=i),{week:o,year:s}}function Bl(t,e,n){var r=iy(t,e,n),i=iy(t+1,e,n);return(pp(t)-r+i)/7}ut("w",["ww",2],"wo","week"),ut("W",["WW",2],"Wo","isoWeek"),Ke("w",hr,wh),Ke("ww",hr,us),Ke("W",hr,wh),Ke("WW",hr,us),dp(["w","ww","W","WW"],function(t,e,n,r){e[r.substr(0,1)]=yn(t)});function LR(t){return yp(t,this._week.dow,this._week.doy).week}var DR={dow:0,doy:6};function RR(){return this._week.dow}function FR(){return this._week.doy}function BR(t){var e=this.localeData().week(this);return t==null?e:this.add((t-e)*7,"d")}function VR(t){var e=yp(this,1,4).week;return t==null?e:this.add((t-e)*7,"d")}ut("d",0,"do","day"),ut("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),ut("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),ut("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),ut("e",0,0,"weekday"),ut("E",0,0,"isoWeekday"),Ke("d",hr),Ke("e",hr),Ke("E",hr),Ke("dd",function(t,e){return e.weekdaysMinRegex(t)}),Ke("ddd",function(t,e){return e.weekdaysShortRegex(t)}),Ke("dddd",function(t,e){return e.weekdaysRegex(t)}),dp(["dd","ddd","dddd"],function(t,e,n,r){var i=n._locale.weekdaysParse(t,r,n._strict);i!=null?e.d=i:Tt(n).invalidWeekday=t}),dp(["d","e","E"],function(t,e,n,r){e[r]=yn(t)});function $R(t,e){return typeof t!="string"?t:isNaN(t)?(t=e.weekdaysParse(t),typeof t=="number"?t:null):parseInt(t,10)}function jR(t,e){return typeof t=="string"?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function h_(t,e){return t.slice(e,7).concat(t.slice(0,e))}var qR="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),vC="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),UR="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),zR=hp,HR=hp,GR=hp;function YR(t,e){var n=ua(this._weekdays)?this._weekdays:this._weekdays[t&&t!==!0&&this._weekdays.isFormat.test(e)?"format":"standalone"];return t===!0?h_(n,this._week.dow):t?n[t.day()]:n}function WR(t){return t===!0?h_(this._weekdaysShort,this._week.dow):t?this._weekdaysShort[t.day()]:this._weekdaysShort}function XR(t){return t===!0?h_(this._weekdaysMin,this._week.dow):t?this._weekdaysMin[t.day()]:this._weekdaysMin}function KR(t,e,n){var r,i,o,s=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)o=$a([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(o,"").toLocaleLowerCase();return n?e==="dddd"?(i=Ur.call(this._weekdaysParse,s),i!==-1?i:null):e==="ddd"?(i=Ur.call(this._shortWeekdaysParse,s),i!==-1?i:null):(i=Ur.call(this._minWeekdaysParse,s),i!==-1?i:null):e==="dddd"?(i=Ur.call(this._weekdaysParse,s),i!==-1||(i=Ur.call(this._shortWeekdaysParse,s),i!==-1)?i:(i=Ur.call(this._minWeekdaysParse,s),i!==-1?i:null)):e==="ddd"?(i=Ur.call(this._shortWeekdaysParse,s),i!==-1||(i=Ur.call(this._weekdaysParse,s),i!==-1)?i:(i=Ur.call(this._minWeekdaysParse,s),i!==-1?i:null)):(i=Ur.call(this._minWeekdaysParse,s),i!==-1||(i=Ur.call(this._weekdaysParse,s),i!==-1)?i:(i=Ur.call(this._shortWeekdaysParse,s),i!==-1?i:null))}function ZR(t,e,n){var r,i,o;if(this._weekdaysParseExact)return KR.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++){if(i=$a([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[r]||(o="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(o.replace(".",""),"i")),n&&e==="dddd"&&this._fullWeekdaysParse[r].test(t))return r;if(n&&e==="ddd"&&this._shortWeekdaysParse[r].test(t))return r;if(n&&e==="dd"&&this._minWeekdaysParse[r].test(t))return r;if(!n&&this._weekdaysParse[r].test(t))return r}}function JR(t){if(!this.isValid())return t!=null?this:NaN;var e=gp(this,"Day");return t!=null?(t=$R(t,this.localeData()),this.add(t-e,"d")):e}function QR(t){if(!this.isValid())return t!=null?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return t==null?e:this.add(t-e,"d")}function e4(t){if(!this.isValid())return t!=null?this:NaN;if(t!=null){var e=jR(t,this.localeData());return this.day(this.day()%7?e:e-7)}else return this.day()||7}function t4(t){return this._weekdaysParseExact?(Fn(this,"_weekdaysRegex")||d_.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(Fn(this,"_weekdaysRegex")||(this._weekdaysRegex=zR),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function n4(t){return this._weekdaysParseExact?(Fn(this,"_weekdaysRegex")||d_.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(Fn(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=HR),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function r4(t){return this._weekdaysParseExact?(Fn(this,"_weekdaysRegex")||d_.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(Fn(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=GR),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function d_(){function t(f,c){return c.length-f.length}var e=[],n=[],r=[],i=[],o,s,a,u,l;for(o=0;o<7;o++)s=$a([2e3,1]).day(o),a=Dl(this.weekdaysMin(s,"")),u=Dl(this.weekdaysShort(s,"")),l=Dl(this.weekdays(s,"")),e.push(a),n.push(u),r.push(l),i.push(a),i.push(u),i.push(l);e.sort(t),n.sort(t),r.sort(t),i.sort(t),this._weekdaysRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+e.join("|")+")","i")}function p_(){return this.hours()%12||12}function i4(){return this.hours()||24}ut("H",["HH",2],0,"hour"),ut("h",["hh",2],0,p_),ut("k",["kk",2],0,i4),ut("hmm",0,0,function(){return""+p_.apply(this)+qa(this.minutes(),2)}),ut("hmmss",0,0,function(){return""+p_.apply(this)+qa(this.minutes(),2)+qa(this.seconds(),2)}),ut("Hmm",0,0,function(){return""+this.hours()+qa(this.minutes(),2)}),ut("Hmmss",0,0,function(){return""+this.hours()+qa(this.minutes(),2)+qa(this.seconds(),2)});function _C(t,e){ut(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}_C("a",!0),_C("A",!1);function bC(t,e){return e._meridiemParse}Ke("a",bC),Ke("A",bC),Ke("H",hr,u_),Ke("h",hr,wh),Ke("k",hr,wh),Ke("HH",hr,us),Ke("hh",hr,us),Ke("kk",hr,us),Ke("hmm",lC),Ke("hmmss",uC),Ke("Hmm",lC),Ke("Hmmss",uC),Qn(["H","HH"],mi),Qn(["k","kk"],function(t,e,n){var r=yn(t);e[mi]=r===24?0:r}),Qn(["a","A"],function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t}),Qn(["h","hh"],function(t,e,n){e[mi]=yn(t),Tt(n).bigHour=!0}),Qn("hmm",function(t,e,n){var r=t.length-2;e[mi]=yn(t.substr(0,r)),e[fa]=yn(t.substr(r)),Tt(n).bigHour=!0}),Qn("hmmss",function(t,e,n){var r=t.length-4,i=t.length-2;e[mi]=yn(t.substr(0,r)),e[fa]=yn(t.substr(r,2)),e[Fl]=yn(t.substr(i)),Tt(n).bigHour=!0}),Qn("Hmm",function(t,e,n){var r=t.length-2;e[mi]=yn(t.substr(0,r)),e[fa]=yn(t.substr(r))}),Qn("Hmmss",function(t,e,n){var r=t.length-4,i=t.length-2;e[mi]=yn(t.substr(0,r)),e[fa]=yn(t.substr(r,2)),e[Fl]=yn(t.substr(i))});function o4(t){return(t+"").toLowerCase().charAt(0)==="p"}var s4=/[ap]\.?m?\.?/i,a4=xh("Hours",!0);function l4(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"}var EC={calendar:K5,longDateFormat:eR,invalidDate:nR,ordinal:iR,dayOfMonthOrdinalParse:oR,relativeTime:aR,months:xR,monthsShort:hC,week:DR,weekdays:qR,weekdaysMin:UR,weekdaysShort:vC,meridiemParse:s4},wr={},vp={},_p;function u4(t,e){var n,r=Math.min(t.length,e.length);for(n=0;n0;){if(i=oy(o.slice(0,n).join("-")),i)return i;if(r&&r.length>=n&&u4(o,r)>=n-1)break;n--}e++}return _p}function f4(t){return!!(t&&t.match("^[^/\\\\]*$"))}function oy(t){var e=null,n;if(wr[t]===void 0&&typeof module<"u"&&module&&module.exports&&f4(t))try{e=_p._abbr,n=require,n("./locale/"+t),Ru(e)}catch{wr[t]=null}return wr[t]}function Ru(t,e){var n;return t&&(Bo(e)?n=Vl(t):n=g_(t,e),n?_p=n:typeof console<"u"&&console.warn&&console.warn("Locale "+t+" not found. Did you forget to load it?")),_p._abbr}function g_(t,e){if(e!==null){var n,r=EC;if(e.abbr=t,wr[t]!=null)rC("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),r=wr[t]._config;else if(e.parentLocale!=null)if(wr[e.parentLocale]!=null)r=wr[e.parentLocale]._config;else if(n=oy(e.parentLocale),n!=null)r=n._config;else return vp[e.parentLocale]||(vp[e.parentLocale]=[]),vp[e.parentLocale].push({name:t,config:e}),null;return wr[t]=new n_(t_(r,e)),vp[t]&&vp[t].forEach(function(i){g_(i.name,i.config)}),Ru(t),wr[t]}else return delete wr[t],null}function h4(t,e){if(e!=null){var n,r,i=EC;wr[t]!=null&&wr[t].parentLocale!=null?wr[t].set(t_(wr[t]._config,e)):(r=oy(t),r!=null&&(i=r._config),e=t_(i,e),r==null&&(e.abbr=t),n=new n_(e),n.parentLocale=wr[t],wr[t]=n),Ru(t)}else wr[t]!=null&&(wr[t].parentLocale!=null?(wr[t]=wr[t].parentLocale,t===Ru()&&Ru(t)):wr[t]!=null&&delete wr[t]);return wr[t]}function Vl(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return _p;if(!ua(t)){if(e=oy(t),e)return e;t=[t]}return c4(t)}function d4(){return r_(wr)}function m_(t){var e,n=t._a;return n&&Tt(t).overflow===-2&&(e=n[Rl]<0||n[Rl]>11?Rl:n[Ua]<1||n[Ua]>f_(n[ao],n[Rl])?Ua:n[mi]<0||n[mi]>24||n[mi]===24&&(n[fa]!==0||n[Fl]!==0||n[Wc]!==0)?mi:n[fa]<0||n[fa]>59?fa:n[Fl]<0||n[Fl]>59?Fl:n[Wc]<0||n[Wc]>999?Wc:-1,Tt(t)._overflowDayOfYear&&(eUa)&&(e=Ua),Tt(t)._overflowWeeks&&e===-1&&(e=yR),Tt(t)._overflowWeekday&&e===-1&&(e=vR),Tt(t).overflow=e),t}var p4=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,g4=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,m4=/Z|[+-]\d\d(?::?\d\d)?/,sy=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],y_=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],y4=/^\/?Date\((-?\d+)/i,v4=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,_4={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function xC(t){var e,n,r=t._i,i=p4.exec(r)||g4.exec(r),o,s,a,u,l=sy.length,f=y_.length;if(i){for(Tt(t).iso=!0,e=0,n=l;epp(s)||t._dayOfYear===0)&&(Tt(t)._overflowDayOfYear=!0),n=mp(s,0,t._dayOfYear),t._a[Rl]=n.getUTCMonth(),t._a[Ua]=n.getUTCDate()),e=0;e<3&&t._a[e]==null;++e)t._a[e]=r[e]=i[e];for(;e<7;e++)t._a[e]=r[e]=t._a[e]==null?e===2?1:0:t._a[e];t._a[mi]===24&&t._a[fa]===0&&t._a[Fl]===0&&t._a[Wc]===0&&(t._nextDay=!0,t._a[mi]=0),t._d=(t._useUTC?mp:AR).apply(null,r),o=t._useUTC?t._d.getUTCDay():t._d.getDay(),t._tzm!=null&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[mi]=24),t._w&&typeof t._w.d<"u"&&t._w.d!==o&&(Tt(t).weekdayMismatch=!0)}}function O4(t){var e,n,r,i,o,s,a,u,l;e=t._w,e.GG!=null||e.W!=null||e.E!=null?(o=1,s=4,n=Sh(e.GG,t._a[ao],yp(dr(),1,4).year),r=Sh(e.W,1),i=Sh(e.E,1),(i<1||i>7)&&(u=!0)):(o=t._locale._week.dow,s=t._locale._week.doy,l=yp(dr(),o,s),n=Sh(e.gg,t._a[ao],l.year),r=Sh(e.w,l.week),e.d!=null?(i=e.d,(i<0||i>6)&&(u=!0)):e.e!=null?(i=e.e+o,(e.e<0||e.e>6)&&(u=!0)):i=o),r<1||r>Bl(n,o,s)?Tt(t)._overflowWeeks=!0:u!=null?Tt(t)._overflowWeekday=!0:(a=yC(n,r,i,o,s),t._a[ao]=a.year,t._dayOfYear=a.dayOfYear)}ze.ISO_8601=function(){},ze.RFC_2822=function(){};function __(t){if(t._f===ze.ISO_8601){xC(t);return}if(t._f===ze.RFC_2822){SC(t);return}t._a=[],Tt(t).empty=!0;var e=""+t._i,n,r,i,o,s,a=e.length,u=0,l,f;for(i=iC(t._f,t._locale).match(i_)||[],f=i.length,n=0;n0&&Tt(t).unusedInput.push(s),e=e.slice(e.indexOf(r)+r.length),u+=r.length),bh[o]?(r?Tt(t).empty=!1:Tt(t).unusedTokens.push(o),mR(o,r,t)):t._strict&&!r&&Tt(t).unusedTokens.push(o);Tt(t).charsLeftOver=a-u,e.length>0&&Tt(t).unusedInput.push(e),t._a[mi]<=12&&Tt(t).bigHour===!0&&t._a[mi]>0&&(Tt(t).bigHour=void 0),Tt(t).parsedDateParts=t._a.slice(0),Tt(t).meridiem=t._meridiem,t._a[mi]=T4(t._locale,t._a[mi],t._meridiem),l=Tt(t).era,l!==null&&(t._a[ao]=t._locale.erasConvertYear(l,t._a[ao])),v_(t),m_(t)}function T4(t,e,n){var r;return n==null?e:t.meridiemHour!=null?t.meridiemHour(e,n):(t.isPM!=null&&(r=t.isPM(n),r&&e<12&&(e+=12),!r&&e===12&&(e=0)),e)}function I4(t){var e,n,r,i,o,s,a=!1,u=t._f.length;if(u===0){Tt(t).invalidFormat=!0,t._d=new Date(NaN);return}for(i=0;ithis?this:t:Wm()});function OC(t,e){var n,r;if(e.length===1&&ua(e[0])&&(e=e[0]),!e.length)return dr();for(n=e[0],r=1;rthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function K4(){if(!Bo(this._isDSTShifted))return this._isDSTShifted;var t={},e;return e_(t,this),t=CC(t),t._a?(e=t._isUTC?$a(t._a):dr(t._a),this._isDSTShifted=this.isValid()&&j4(t._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Z4(){return this.isValid()?!this._isUTC:!1}function J4(){return this.isValid()?this._isUTC:!1}function IC(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Q4=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,eF=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function ha(t,e){var n=t,r=null,i,o,s;return ly(t)?n={ms:t._milliseconds,d:t._days,M:t._months}:Ll(t)||!isNaN(+t)?(n={},e?n[e]=+t:n.milliseconds=+t):(r=Q4.exec(t))?(i=r[1]==="-"?-1:1,n={y:0,d:yn(r[Ua])*i,h:yn(r[mi])*i,m:yn(r[fa])*i,s:yn(r[Fl])*i,ms:yn(b_(r[Wc]*1e3))*i}):(r=eF.exec(t))?(i=r[1]==="-"?-1:1,n={y:Xc(r[2],i),M:Xc(r[3],i),w:Xc(r[4],i),d:Xc(r[5],i),h:Xc(r[6],i),m:Xc(r[7],i),s:Xc(r[8],i)}):n==null?n={}:typeof n=="object"&&("from"in n||"to"in n)&&(s=tF(dr(n.from),dr(n.to)),n={},n.ms=s.milliseconds,n.M=s.months),o=new ay(n),ly(t)&&Fn(t,"_locale")&&(o._locale=t._locale),ly(t)&&Fn(t,"_isValid")&&(o._isValid=t._isValid),o}ha.fn=ay.prototype,ha.invalid=$4;function Xc(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function MC(t,e){var n={};return n.months=e.month()-t.month()+(e.year()-t.year())*12,t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function tF(t,e){var n;return t.isValid()&&e.isValid()?(e=w_(e,t),t.isBefore(e)?n=MC(t,e):(n=MC(e,t),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function kC(t,e){return function(n,r){var i,o;return r!==null&&!isNaN(+r)&&(rC(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),o=n,n=r,r=o),i=ha(n,r),PC(this,i,t),this}}function PC(t,e,n,r){var i=e._milliseconds,o=b_(e._days),s=b_(e._months);t.isValid()&&(r=r??!0,s&&pC(t,gp(t,"Month")+s*n),o&&fC(t,"Date",gp(t,"Date")+o*n),i&&t._d.setTime(t._d.valueOf()+i*n),r&&ze.updateOffset(t,o||s))}var nF=kC(1,"add"),rF=kC(-1,"subtract");function AC(t){return typeof t=="string"||t instanceof String}function iF(t){return ca(t)||cp(t)||AC(t)||Ll(t)||sF(t)||oF(t)||t===null||t===void 0}function oF(t){var e=Yc(t)&&!K1(t),n=!1,r=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],i,o,s=r.length;for(i=0;in.valueOf():n.valueOf()9999?Km(n,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):ja(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Km(n,"Z")):Km(n,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function bF(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t="moment",e="",n,r,i,o;return this.isLocal()||(t=this.utcOffset()===0?"moment.utc":"moment.parseZone",e="Z"),n="["+t+'("]',r=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i="-MM-DD[T]HH:mm:ss.SSS",o=e+'[")]',this.format(n+r+i+o)}function EF(t){t||(t=this.isUtc()?ze.defaultFormatUtc:ze.defaultFormat);var e=Km(this,t);return this.localeData().postformat(e)}function wF(t,e){return this.isValid()&&(ca(t)&&t.isValid()||dr(t).isValid())?ha({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function xF(t){return this.from(dr(),t)}function SF(t,e){return this.isValid()&&(ca(t)&&t.isValid()||dr(t).isValid())?ha({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function CF(t){return this.to(dr(),t)}function LC(t){var e;return t===void 0?this._locale._abbr:(e=Vl(t),e!=null&&(this._locale=e),this)}var DC=Os("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return t===void 0?this.localeData():this.locale(t)});function RC(){return this._locale}var cy=1e3,Ch=60*cy,fy=60*Ch,FC=(365*400+97)*24*fy;function Nh(t,e){return(t%e+e)%e}function BC(t,e,n){return t<100&&t>=0?new Date(t+400,e,n)-FC:new Date(t,e,n).valueOf()}function VC(t,e,n){return t<100&&t>=0?Date.UTC(t+400,e,n)-FC:Date.UTC(t,e,n)}function NF(t){var e,n;if(t=Ts(t),t===void 0||t==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?VC:BC,t){case"year":e=n(this.year(),0,1);break;case"quarter":e=n(this.year(),this.month()-this.month()%3,1);break;case"month":e=n(this.year(),this.month(),1);break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":e=n(this.year(),this.month(),this.date());break;case"hour":e=this._d.valueOf(),e-=Nh(e+(this._isUTC?0:this.utcOffset()*Ch),fy);break;case"minute":e=this._d.valueOf(),e-=Nh(e,Ch);break;case"second":e=this._d.valueOf(),e-=Nh(e,cy);break}return this._d.setTime(e),ze.updateOffset(this,!0),this}function OF(t){var e,n;if(t=Ts(t),t===void 0||t==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?VC:BC,t){case"year":e=n(this.year()+1,0,1)-1;break;case"quarter":e=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":e=n(this.year(),this.month()+1,1)-1;break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":e=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":e=this._d.valueOf(),e+=fy-Nh(e+(this._isUTC?0:this.utcOffset()*Ch),fy)-1;break;case"minute":e=this._d.valueOf(),e+=Ch-Nh(e,Ch)-1;break;case"second":e=this._d.valueOf(),e+=cy-Nh(e,cy)-1;break}return this._d.setTime(e),ze.updateOffset(this,!0),this}function TF(){return this._d.valueOf()-(this._offset||0)*6e4}function IF(){return Math.floor(this.valueOf()/1e3)}function MF(){return new Date(this.valueOf())}function kF(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function PF(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function AF(){return this.isValid()?this.toISOString():null}function LF(){return J1(this)}function DF(){return Du({},Tt(this))}function RF(){return Tt(this).overflow}function FF(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}ut("N",0,0,"eraAbbr"),ut("NN",0,0,"eraAbbr"),ut("NNN",0,0,"eraAbbr"),ut("NNNN",0,0,"eraName"),ut("NNNNN",0,0,"eraNarrow"),ut("y",["y",1],"yo","eraYear"),ut("y",["yy",2],0,"eraYear"),ut("y",["yyy",3],0,"eraYear"),ut("y",["yyyy",4],0,"eraYear"),Ke("N",S_),Ke("NN",S_),Ke("NNN",S_),Ke("NNNN",WF),Ke("NNNNN",XF),Qn(["N","NN","NNN","NNNN","NNNNN"],function(t,e,n,r){var i=n._locale.erasParse(t,r,n._strict);i?Tt(n).era=i:Tt(n).invalidEra=t}),Ke("y",Eh),Ke("yy",Eh),Ke("yyy",Eh),Ke("yyyy",Eh),Ke("yo",KF),Qn(["y","yy","yyy","yyyy"],ao),Qn(["yo"],function(t,e,n,r){var i;n._locale._eraYearOrdinalRegex&&(i=t.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?e[ao]=n._locale.eraYearOrdinalParse(t,i):e[ao]=parseInt(t,10)});function BF(t,e){var n,r,i,o=this._eras||Vl("en")._eras;for(n=0,r=o.length;n=0)return o[r]}function $F(t,e){var n=t.since<=t.until?1:-1;return e===void 0?ze(t.since).year():ze(t.since).year()+(e-t.offset)*n}function jF(){var t,e,n,r=this.localeData().eras();for(t=0,e=r.length;to&&(e=o),r6.call(this,t,e,n,r,i))}function r6(t,e,n,r,i){var o=yC(t,e,n,r,i),s=mp(o.year,0,o.dayOfYear);return this.year(s.getUTCFullYear()),this.month(s.getUTCMonth()),this.date(s.getUTCDate()),this}ut("Q",0,"Qo","quarter"),Ke("Q",sC),Qn("Q",function(t,e){e[Rl]=(yn(t)-1)*3});function i6(t){return t==null?Math.ceil((this.month()+1)/3):this.month((t-1)*3+this.month()%3)}ut("D",["DD",2],"Do","date"),Ke("D",hr,wh),Ke("DD",hr,us),Ke("Do",function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient}),Qn(["D","DD"],Ua),Qn("Do",function(t,e){e[Ua]=yn(t.match(hr)[0])});var jC=xh("Date",!0);ut("DDD",["DDDD",3],"DDDo","dayOfYear"),Ke("DDD",Jm),Ke("DDDD",aC),Qn(["DDD","DDDD"],function(t,e,n){n._dayOfYear=yn(t)});function o6(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return t==null?e:this.add(t-e,"d")}ut("m",["mm",2],0,"minute"),Ke("m",hr,u_),Ke("mm",hr,us),Qn(["m","mm"],fa);var s6=xh("Minutes",!1);ut("s",["ss",2],0,"second"),Ke("s",hr,u_),Ke("ss",hr,us),Qn(["s","ss"],Fl);var a6=xh("Seconds",!1);ut("S",0,0,function(){return~~(this.millisecond()/100)}),ut(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),ut(0,["SSS",3],0,"millisecond"),ut(0,["SSSS",4],0,function(){return this.millisecond()*10}),ut(0,["SSSSS",5],0,function(){return this.millisecond()*100}),ut(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),ut(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),ut(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),ut(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),Ke("S",Jm,sC),Ke("SS",Jm,us),Ke("SSS",Jm,aC);var Fu,qC;for(Fu="SSSS";Fu.length<=9;Fu+="S")Ke(Fu,Eh);function l6(t,e){e[Wc]=yn(("0."+t)*1e3)}for(Fu="S";Fu.length<=9;Fu+="S")Qn(Fu,l6);qC=xh("Milliseconds",!1),ut("z",0,0,"zoneAbbr"),ut("zz",0,0,"zoneName");function u6(){return this._isUTC?"UTC":""}function c6(){return this._isUTC?"Coordinated Universal Time":""}var ke=fp.prototype;ke.add=nF,ke.calendar=uF,ke.clone=cF,ke.diff=yF,ke.endOf=OF,ke.format=EF,ke.from=wF,ke.fromNow=xF,ke.to=SF,ke.toNow=CF,ke.get=bR,ke.invalidAt=RF,ke.isAfter=fF,ke.isBefore=hF,ke.isBetween=dF,ke.isSame=pF,ke.isSameOrAfter=gF,ke.isSameOrBefore=mF,ke.isValid=LF,ke.lang=DC,ke.locale=LC,ke.localeData=RC,ke.max=L4,ke.min=A4,ke.parsingFlags=DF,ke.set=ER,ke.startOf=NF,ke.subtract=rF,ke.toArray=kF,ke.toObject=PF,ke.toDate=MF,ke.toISOString=_F,ke.inspect=bF,typeof Symbol<"u"&&Symbol.for!=null&&(ke[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),ke.toJSON=AF,ke.toString=vF,ke.unix=IF,ke.valueOf=TF,ke.creationData=FF,ke.eraName=jF,ke.eraNarrow=qF,ke.eraAbbr=UF,ke.eraYear=zF,ke.year=cC,ke.isLeapYear=_R,ke.weekYear=ZF,ke.isoWeekYear=JF,ke.quarter=ke.quarters=i6,ke.month=gC,ke.daysInMonth=MR,ke.week=ke.weeks=BR,ke.isoWeek=ke.isoWeeks=VR,ke.weeksInYear=t6,ke.weeksInWeekYear=n6,ke.isoWeeksInYear=QF,ke.isoWeeksInISOWeekYear=e6,ke.date=jC,ke.day=ke.days=JR,ke.weekday=QR,ke.isoWeekday=e4,ke.dayOfYear=o6,ke.hour=ke.hours=a4,ke.minute=ke.minutes=s6,ke.second=ke.seconds=a6,ke.millisecond=ke.milliseconds=qC,ke.utcOffset=U4,ke.utc=H4,ke.local=G4,ke.parseZone=Y4,ke.hasAlignedHourOffset=W4,ke.isDST=X4,ke.isLocal=Z4,ke.isUtcOffset=J4,ke.isUtc=IC,ke.isUTC=IC,ke.zoneAbbr=u6,ke.zoneName=c6,ke.dates=Os("dates accessor is deprecated. Use date instead.",jC),ke.months=Os("months accessor is deprecated. Use month instead",gC),ke.years=Os("years accessor is deprecated. Use year instead",cC),ke.zone=Os("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",z4),ke.isDSTShifted=Os("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",K4);function f6(t){return dr(t*1e3)}function h6(){return dr.apply(null,arguments).parseZone()}function UC(t){return t}var Bn=n_.prototype;Bn.calendar=Z5,Bn.longDateFormat=tR,Bn.invalidDate=rR,Bn.ordinal=sR,Bn.preparse=UC,Bn.postformat=UC,Bn.relativeTime=lR,Bn.pastFuture=uR,Bn.set=X5,Bn.eras=BF,Bn.erasParse=VF,Bn.erasConvertYear=$F,Bn.erasAbbrRegex=GF,Bn.erasNameRegex=HF,Bn.erasNarrowRegex=YF,Bn.months=NR,Bn.monthsShort=OR,Bn.monthsParse=IR,Bn.monthsRegex=PR,Bn.monthsShortRegex=kR,Bn.week=LR,Bn.firstDayOfYear=FR,Bn.firstDayOfWeek=RR,Bn.weekdays=YR,Bn.weekdaysMin=XR,Bn.weekdaysShort=WR,Bn.weekdaysParse=ZR,Bn.weekdaysRegex=t4,Bn.weekdaysShortRegex=n4,Bn.weekdaysMinRegex=r4,Bn.isPM=o4,Bn.meridiem=l4;function dy(t,e,n,r){var i=Vl(),o=$a().set(r,e);return i[n](o,t)}function zC(t,e,n){if(Ll(t)&&(e=t,t=void 0),t=t||"",e!=null)return dy(t,e,n,"month");var r,i=[];for(r=0;r<12;r++)i[r]=dy(t,r,n,"month");return i}function N_(t,e,n,r){typeof t=="boolean"?(Ll(e)&&(n=e,e=void 0),e=e||""):(e=t,n=e,t=!1,Ll(e)&&(n=e,e=void 0),e=e||"");var i=Vl(),o=t?i._week.dow:0,s,a=[];if(n!=null)return dy(e,(n+o)%7,r,"day");for(s=0;s<7;s++)a[s]=dy(e,(s+o)%7,r,"day");return a}function d6(t,e){return zC(t,e,"months")}function p6(t,e){return zC(t,e,"monthsShort")}function g6(t,e,n){return N_(t,e,n,"weekdays")}function m6(t,e,n){return N_(t,e,n,"weekdaysShort")}function y6(t,e,n){return N_(t,e,n,"weekdaysMin")}Ru("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10,n=yn(t%100/10)===1?"th":e===1?"st":e===2?"nd":e===3?"rd":"th";return t+n}}),ze.lang=Os("moment.lang is deprecated. Use moment.locale instead.",Ru),ze.langData=Os("moment.langData is deprecated. Use moment.localeData instead.",Vl);var $l=Math.abs;function v6(){var t=this._data;return this._milliseconds=$l(this._milliseconds),this._days=$l(this._days),this._months=$l(this._months),t.milliseconds=$l(t.milliseconds),t.seconds=$l(t.seconds),t.minutes=$l(t.minutes),t.hours=$l(t.hours),t.months=$l(t.months),t.years=$l(t.years),this}function HC(t,e,n,r){var i=ha(e,n);return t._milliseconds+=r*i._milliseconds,t._days+=r*i._days,t._months+=r*i._months,t._bubble()}function _6(t,e){return HC(this,t,e,1)}function b6(t,e){return HC(this,t,e,-1)}function GC(t){return t<0?Math.floor(t):Math.ceil(t)}function E6(){var t=this._milliseconds,e=this._days,n=this._months,r=this._data,i,o,s,a,u;return t>=0&&e>=0&&n>=0||t<=0&&e<=0&&n<=0||(t+=GC(O_(n)+e)*864e5,e=0,n=0),r.milliseconds=t%1e3,i=Is(t/1e3),r.seconds=i%60,o=Is(i/60),r.minutes=o%60,s=Is(o/60),r.hours=s%24,e+=Is(s/24),u=Is(YC(e)),n+=u,e-=GC(O_(u)),a=Is(n/12),n%=12,r.days=e,r.months=n,r.years=a,this}function YC(t){return t*4800/146097}function O_(t){return t*146097/4800}function w6(t){if(!this.isValid())return NaN;var e,n,r=this._milliseconds;if(t=Ts(t),t==="month"||t==="quarter"||t==="year")switch(e=this._days+r/864e5,n=this._months+YC(e),t){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(e=this._days+Math.round(O_(this._months)),t){case"week":return e/7+r/6048e5;case"day":return e+r/864e5;case"hour":return e*24+r/36e5;case"minute":return e*1440+r/6e4;case"second":return e*86400+r/1e3;case"millisecond":return Math.floor(e*864e5)+r;default:throw new Error("Unknown unit "+t)}}function jl(t){return function(){return this.as(t)}}var WC=jl("ms"),x6=jl("s"),S6=jl("m"),C6=jl("h"),N6=jl("d"),O6=jl("w"),T6=jl("M"),I6=jl("Q"),M6=jl("y"),k6=WC;function P6(){return ha(this)}function A6(t){return t=Ts(t),this.isValid()?this[t+"s"]():NaN}function Kc(t){return function(){return this.isValid()?this._data[t]:NaN}}var L6=Kc("milliseconds"),D6=Kc("seconds"),R6=Kc("minutes"),F6=Kc("hours"),B6=Kc("days"),V6=Kc("months"),$6=Kc("years");function j6(){return Is(this.days()/7)}var ql=Math.round,Oh={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function q6(t,e,n,r,i){return i.relativeTime(e||1,!!n,t,r)}function U6(t,e,n,r){var i=ha(t).abs(),o=ql(i.as("s")),s=ql(i.as("m")),a=ql(i.as("h")),u=ql(i.as("d")),l=ql(i.as("M")),f=ql(i.as("w")),c=ql(i.as("y")),h=o<=n.ss&&["s",o]||o0,h[4]=r,q6.apply(null,h)}function z6(t){return t===void 0?ql:typeof t=="function"?(ql=t,!0):!1}function H6(t,e){return Oh[t]===void 0?!1:e===void 0?Oh[t]:(Oh[t]=e,t==="s"&&(Oh.ss=e-1),!0)}function G6(t,e){if(!this.isValid())return this.localeData().invalidDate();var n=!1,r=Oh,i,o;return typeof t=="object"&&(e=t,t=!1),typeof t=="boolean"&&(n=t),typeof e=="object"&&(r=Object.assign({},Oh,e),e.s!=null&&e.ss==null&&(r.ss=e.s-1)),i=this.localeData(),o=U6(this,!n,r,i),n&&(o=i.pastFuture(+this,o)),i.postformat(o)}var T_=Math.abs;function Th(t){return(t>0)-(t<0)||+t}function py(){if(!this.isValid())return this.localeData().invalidDate();var t=T_(this._milliseconds)/1e3,e=T_(this._days),n=T_(this._months),r,i,o,s,a=this.asSeconds(),u,l,f,c;return a?(r=Is(t/60),i=Is(r/60),t%=60,r%=60,o=Is(n/12),n%=12,s=t?t.toFixed(3).replace(/\.?0+$/,""):"",u=a<0?"-":"",l=Th(this._months)!==Th(a)?"-":"",f=Th(this._days)!==Th(a)?"-":"",c=Th(this._milliseconds)!==Th(a)?"-":"",u+"P"+(o?l+o+"Y":"")+(n?l+n+"M":"")+(e?f+e+"D":"")+(i||r||t?"T":"")+(i?c+i+"H":"")+(r?c+r+"M":"")+(t?c+s+"S":"")):"P0D"}var Tn=ay.prototype;Tn.isValid=V4,Tn.abs=v6,Tn.add=_6,Tn.subtract=b6,Tn.as=w6,Tn.asMilliseconds=WC,Tn.asSeconds=x6,Tn.asMinutes=S6,Tn.asHours=C6,Tn.asDays=N6,Tn.asWeeks=O6,Tn.asMonths=T6,Tn.asQuarters=I6,Tn.asYears=M6,Tn.valueOf=k6,Tn._bubble=E6,Tn.clone=P6,Tn.get=A6,Tn.milliseconds=L6,Tn.seconds=D6,Tn.minutes=R6,Tn.hours=F6,Tn.days=B6,Tn.weeks=j6,Tn.months=V6,Tn.years=$6,Tn.humanize=G6,Tn.toISOString=py,Tn.toString=py,Tn.toJSON=py,Tn.locale=LC,Tn.localeData=RC,Tn.toIsoString=Os("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",py),Tn.lang=DC,ut("X",0,0,"unix"),ut("x",0,0,"valueOf"),Ke("x",ey),Ke("X",dR),Qn("X",function(t,e,n){n._d=new Date(parseFloat(t)*1e3)}),Qn("x",function(t,e,n){n._d=new Date(yn(t))});//! moment.js ze.version="2.30.1",Y5(dr),ze.fn=ke,ze.min=D4,ze.max=R4,ze.now=F4,ze.utc=$a,ze.unix=f6,ze.months=d6,ze.isDate=cp,ze.locale=Ru,ze.invalid=Wm,ze.duration=ha,ze.isMoment=ca,ze.weekdays=g6,ze.parseZone=h6,ze.localeData=Vl,ze.isDuration=ly,ze.monthsShort=p6,ze.weekdaysMin=y6,ze.defineLocale=g_,ze.updateLocale=h4,ze.locales=d4,ze.weekdaysShort=m6,ze.normalizeUnits=Ts,ze.relativeTimeRounding=z6,ze.relativeTimeThreshold=H6,ze.calendarFormat=lF,ze.prototype=ke,ze.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const Y6={props:{modelValue:{type:String,default:()=>""}},data(){return{date:{day:new Date().getDate(),month:new Date().getMonth(),year:new Date().getFullYear()},selectedDate:null}},computed:{daysInMonth(){return this.getDaysMonth(this.date)},monthName(){const{day:t,month:e,year:n}=this.date;return new Date(n,e,t).toLocaleDateString("uk-UA",{month:"long"})}},created(){if(this.modelValue){const t=ze(this.modelValue,"YYYY-MM-DD").toDate();this.setDate(t),this.selectedDate=this.date}},methods:{selectDay(t){this.selectedDate={...this.date,day:t};const e=ze(this.createTemporaryDate(this.selectedDate)).format("YYYY-MM-DD");this.$emit("update:modelValue",e)},getDaysMonth({year:t,month:e}={}){return 32-new Date(t,e,32).getDate()},changeMonth(t){const e=t==="next"?1:-1,n=this.createTemporaryDate(this.date);n.setMonth(n.getMonth()+e),this.setDate(new Date(n))},changeYear(t){const e=this.createTemporaryDate(this.date),n=t==="next"?1:-1;e.setFullYear(e.getFullYear()+n),this.setDate(new Date(e))},createTemporaryDate({day:t,month:e,year:n}={}){return new Date(n,e,t)},setDate(t){this.date={day:t.getDate(),month:t.getMonth(),year:t.getFullYear()}},isDateEqualCurrent(t){var i,o,s;const e=this.date.month===((i=this.selectedDate)==null?void 0:i.month),n=this.date.year===((o=this.selectedDate)==null?void 0:o.year);return((s=this.selectedDate)==null?void 0:s.day)===t&&e&&n},isDateEqualToday(t){const e=new Date,n=this.date.year===e.getFullYear(),r=this.date.month===e.getMonth(),i=t===e.getDate();return n&&r&&i},daysToFirst(t){const e=["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"],n=t==="last"?1:this.daysInMonth,r=this.createTemporaryDate({...this.date,day:n}),i=e.indexOf(e[r.getDay()]);return t==="next"?[...e].slice(i,e.length).length:[...e].slice(0,i-1).length}},watch:{modelValue(t){t||(this.selectedDate=null)}}},W6={class:"w-fit",style:{"max-width":"300px"}},X6={class:"grid grid-cols-5 items-center gap-x-3 mx-1.5 pb-3"},K6={class:"col-span-1 flex justify-start"},Z6=[E.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[E.createElementVNode("path",{d:"m15 18-6-6 6-6"}),E.createElementVNode("path",{d:"m9 18-6-6 6-6"})],-1)],J6=[E.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[E.createElementVNode("path",{d:"m15 18-6-6 6-6"})],-1)],Q6={class:"col-span-3 flex justify-center items-center gap-x-1 text-gray-600"},eB=E.createElementVNode("span",{class:"font-serif"},"/",-1),tB={class:"font-serif"},nB={class:"col-span-1 flex justify-end"},rB=[E.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[E.createElementVNode("path",{d:"m9 18 6-6-6-6"})],-1)],iB=[E.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[E.createElementVNode("path",{d:"m9 18 6-6-6-6"}),E.createElementVNode("path",{d:"m15 18 6-6-6-6"})],-1)],oB={class:"flex pb-1.5 border-b"},sB={class:"flex flex-wrap"},aB=["onClick","data-testid"],lB=E.createElementVNode("div",{class:"flex"},null,-1);function uB(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("div",W6,[E.createElementVNode("div",X6,[E.createElementVNode("div",K6,[E.createElementVNode("button",{type:"button",class:"w-8 h-8 flex justify-center items-center text-gray-600 hover:bg-gray-100 rounded-full disabled:opacity-50 disabled:pointer-events-none",onClick:e[0]||(e[0]=s=>o.changeYear("prev"))},Z6),E.createElementVNode("button",{type:"button",class:"w-8 h-8 flex justify-center items-center text-gray-600 hover:bg-gray-100 rounded-full disabled:opacity-50 disabled:pointer-events-none",onClick:e[1]||(e[1]=s=>o.changeMonth("prev"))},J6)]),E.createElementVNode("div",Q6,[E.createElementVNode("div",null,E.toDisplayString(t.date.year),1),eB,E.createElementVNode("div",tB,E.toDisplayString(o.monthName),1)]),E.createElementVNode("div",nB,[E.createElementVNode("button",{type:"button",class:"w-8 h-8 flex justify-center items-center text-gray-600 hover:bg-gray-100 rounded-full disabled:opacity-50 disabled:pointer-events-none",onClick:e[2]||(e[2]=s=>o.changeMonth("next"))},rB),E.createElementVNode("button",{type:"button",class:"w-8 h-8 flex justify-center items-center text-gray-600 hover:bg-gray-100 rounded-full disabled:opacity-50 disabled:pointer-events-none",onClick:e[3]||(e[3]=s=>o.changeYear("next"))},iB)])]),E.createElementVNode("div",oB,[(E.openBlock(),E.createElementBlock(E.Fragment,null,E.renderList(["Пн","Вт","Ср","Чт","Пт","Сб","Нд"],s=>E.createElementVNode("span",{class:"m-px w-10 block text-center text-xs text-gray-600 font-serif",key:s},E.toDisplayString(s),1)),64))]),E.createElementVNode("div",sB,[(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(o.daysToFirst("last"),(s,a)=>(E.openBlock(),E.createElementBlock("button",{type:"button",key:a,class:"m-px w-10 h-10 flex justify-center items-center border border-transparent text-sm text-gray-600 hover:border-blue-600 hover:text-blue-600 rounded-full disabled:text-gray-300 disabled:pointer-events-none",disabled:""},E.toDisplayString(o.getDaysMonth({...t.date,month:t.date.month-1})-o.daysToFirst("last")+(a+1)),1))),128)),(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(o.daysInMonth,s=>(E.openBlock(),E.createElementBlock("button",{key:s,onClick:a=>o.selectDay(s),type:"button","data-testid":o.isDateEqualCurrent(s)?"active-day":"",class:E.normalizeClass(["m-px w-10 h-10 transition-all flex justify-center items-center border border-transparent text-sm hover:border-blue-600 hover:text-blue-600 rounded-full disabled:text-gray-300 disabled:pointer-events-none",[o.isDateEqualCurrent(s)?"bg-blue-500 !text-white hover:text-white":"",o.isDateEqualToday(s)?"text-blue-600":"text-gray-600"]])},E.toDisplayString(s),11,aB))),128)),(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(o.daysToFirst("next"),(s,a)=>(E.openBlock(),E.createElementBlock("button",{type:"button",key:a,class:"m-px w-10 h-10 flex justify-center items-center border border-transparent text-sm text-gray-600 hover:border-blue-600 hover:text-blue-600 rounded-full disabled:text-gray-300 disabled:pointer-events-none",disabled:""},E.toDisplayString(s),1))),128))]),lB])}const XC=lt(Y6,[["render",uB]]),cB=E.defineComponent({props:{isOpen:{type:Boolean,default:()=>!1},placement:{type:String,default:"right"},gap:{type:Number,default:0},width:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1}},data(){return{isVisible:this.isOpen}},mounted(){window.addEventListener("click",this.handleOutsideClick),window.addEventListener("popstate",this.handleBrowserBackButton)},beforeUnmount(){window.removeEventListener("click",this.handleOutsideClick),window.removeEventListener("popstate",this.handleBrowserBackButton)},watch:{isVisible(t){t?(window.addEventListener("scroll",this.getSettings),window.addEventListener("resize",this.getSettings),this.getSettings()):(window.removeEventListener("scroll",this.getSettings),window.removeEventListener("resize",this.getSettings))}},methods:{getSettings(){this.$nextTick(()=>{const{placement:t}=this,{contentPop:e,popoverRef:n}=this.$refs,r=e==null?void 0:e.getBoundingClientRect(),i=n==null?void 0:n.getBoundingClientRect();if(i&&r&&e){let o,s;switch(t){case"top":o=i.top-r.height-this.gap,s=i.left-r.width/2+i.width/2;break;case"bottom":o=i.bottom+this.gap,s=i.left-r.width/2+i.width/2;break;case"left":o=i.top-r.height/2+i.height/2,s=i.left-r.width-this.gap;break;case"right":o=i.top-r.height/2+i.height/2,s=i.right+this.gap;break;case"top-right":o=i.top-r.height-this.gap,s=i.right-r.width;break;case"top-left":o=i.top-r.height-this.gap,s=i.left;break;case"bottom-right":o=i.bottom+this.gap,s=i.right-r.width;break;case"bottom-left":o=i.bottom+this.gap,s=i.left;break}e instanceof HTMLElement&&(e.style.top=`${o}px`,e.style.left=`${s}px`)}})},togglePopover(){this.isVisible=!this.isVisible,this.getSettings()},handleOutsideClick(t){var r,i;if(!t){this.isVisible=!1;return}const e=(r=this.$refs)==null?void 0:r.popoverRef,n=(i=this.$refs)==null?void 0:i.contentPop;e&&e.contains(t.target)||n&&!n.contains(t.target)&&(this.isVisible=!1)},handleBrowserBackButton(){this.isVisible&&(this.isVisible=!1)}}}),fB={ref:"popover",class:"vs-popover"},hB={class:"text-center"},dB=E.createElementVNode("button",null,"Click me!",-1),pB={class:"bg-white w-full border z-10 shadow-sm rounded-lg p-2 mt-2 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},gB=E.createElementVNode("span",null,"Popover content",-1);function mB(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("div",fB,[E.createElementVNode("div",hB,[E.createElementVNode("div",{ref:"popoverRef",onClick:e[0]||(e[0]=(...s)=>t.togglePopover&&t.togglePopover(...s)),class:E.normalizeClass({"pointer-events-none":t.disabled})},[E.renderSlot(t.$slots,"reference",{},()=>[dB])],2),(E.openBlock(),E.createBlock(E.Teleport,{to:"body"},[E.createVNode(E.Transition,{name:"fade"},{default:E.withCtx(()=>[E.withDirectives(E.createElementVNode("div",{class:E.normalizeClass(["vsTailwind vs-popover__content",t.placement]),ref:"contentPop",style:E.normalizeStyle({width:t.width?t.width+"px":"fit-content",zIndex:10002})},[E.createElementVNode("div",pB,[E.renderSlot(t.$slots,"default",{},()=>[gB])])],6),[[E.vShow,t.isVisible]])]),_:3})]))])],512)}const KC=lt(cB,[["render",mB]]),yB=E.defineComponent({components:{VsCalendar:XC,VsPopover:KC},props:{modelValue:{type:String,default:""},now:{type:[Number,Boolean],default:0},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!0}},mounted(){if(this.now===1||this.now){const t=new Date,e=t.getDate().toString().padStart(2,"0"),n=(t.getMonth()+1).toString().padStart(2,"0"),r=t.getFullYear(),i=`${e}.${n}.${r}`;this.value=i}},computed:{value:{get(){return this.modelValue},set(t){this.$refs.popover.togglePopover(),this.$emit("update:modelValue",t)}}},methods:{clearInput(){this.$emit("update:modelValue","")}}}),vB={class:"px-2"},_B=["disabled"],bB=E.createElementVNode("i",{class:"ti ti-calendar"},null,-1);function EB(t,e,n,r,i,o){const s=E.resolveComponent("VsCalendar"),a=E.resolveComponent("VsPopover");return E.openBlock(),E.createBlock(a,{placement:"bottom-left",ref:"popover",disabled:t.disabled,class:E.normalizeClass({"cursor-not-allowed":t.disabled})},{reference:E.withCtx(()=>[E.createElementVNode("button",{type:"button",disabled:t.disabled,class:E.normalizeClass([{"pointer-events-none":t.disabled,"opacity-50":t.disabled},"vs-datepicker__button py-2 px-4 transition-all block text-left relative block border border-solid w-full items-center gap-x-2 text-sm font-normal rounded-lg border border-gray-200 bg-white text-gray-800 hover:bg-gray-50 relative outline-none focus:border focus:border-blue-500"])},[E.createElementVNode("div",{class:E.normalizeClass({"text-gray-400":!t.value})},[bB,E.createTextVNode(" "+E.toDisplayString(t.value||"Оберіть дату..."),1)],2),t.clearable&&t.value?(E.openBlock(),E.createElementBlock("i",{key:0,class:"absolute bottom-2/4 translate-y-2/4 ti ti-x right-2",onClick:e[1]||(e[1]=E.withModifiers((...u)=>t.clearInput&&t.clearInput(...u),["stop"]))})):E.createCommentVNode("",!0)],10,_B)]),default:E.withCtx(()=>[E.createElementVNode("div",vB,[E.createVNode(s,{modelValue:t.value,"onUpdate:modelValue":e[0]||(e[0]=u=>t.value=u),class:"vs-datepicker__calendar"},null,8,["modelValue"])])]),_:1},8,["disabled","class"])}const ZC=lt(yB,[["render",EB]]),wB=E.defineComponent({emits:["command"],props:{value:{type:String,default:()=>""},label:{type:String,default:()=>""},icon:{type:String,default:()=>""}},computed:{parentInstance(){var e;return(e=this.$parent)==null?void 0:e.$parent},parentValue(){return this.parentInstance.currentOption},isValueEqaulParentValue(){const t=this.value||this.label;return this.parentValue===t},activeClass(){return"bg-gray-100 cursor-default"}},methods:{handleClick(){const t=(this==null?void 0:this.value)||this.label;t&&(this.parentInstance.$emit("command",t),this.parentInstance.list.visible=!1)}}});function xB(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("div",{onClick:e[0]||(e[0]=E.withModifiers((...s)=>t.handleClick&&t.handleClick(...s),["stop","self"])),class:"flex items-center gap-x-3.5 py-2 px-3 rounded-lg text-sm text-gray-800 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 cursor-pointer"},[t.icon?(E.openBlock(),E.createElementBlock("i",{key:0,class:E.normalizeClass(t.icon)},null,2)):E.createCommentVNode("",!0),E.renderSlot(t.$slots,"default",{},()=>[E.createTextVNode(E.toDisplayString(t.label),1)])])}const SB=lt(wB,[["render",xB]]),CB={props:{visible:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""}},emits:["update:visible","onClose"],name:"vs-dialog",methods:{handleClose(){this.$emit("update:visible",!1),this.$emit("onClose")}}},JC=t=>(E.pushScopeId("data-v-c245c3b3"),t=t(),E.popScopeId(),t),NB={key:0,class:"vsTailwind ui-dialog__wrapper"},OB={class:"ui-dialog w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},TB={class:"flex justify-between items-center py-3 px-4 border-b"},IB={class:"font-bold text-gray-800 text-xl"},MB=[JC(()=>E.createElementVNode("span",{class:"sr-only"},"Close",-1)),JC(()=>E.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[E.createElementVNode("path",{d:"M18 6 6 18"}),E.createElementVNode("path",{d:"m6 6 12 12"})],-1))],kB={class:"ui-dialog__content p-4"};function PB(t,e,n,r,i,o){return E.openBlock(),E.createBlock(E.Teleport,{to:"body"},[E.createVNode(E.Transition,{name:"fade"},{default:E.withCtx(()=>[n.visible?(E.openBlock(),E.createElementBlock("div",NB,[E.createElementVNode("div",OB,[E.createVNode(E.Transition,{name:"content",appear:""},{default:E.withCtx(()=>[E.createElementVNode("div",{class:E.normalizeClass(["ui-dialog__modal opacity-1 transition-all flex flex-col bg-white border shadow-sm rounded-xl",[n.size==="small"?"w-5/12":"lg:w-7/12 w-11/12"]])},[E.createElementVNode("div",TB,[E.createElementVNode("h3",IB,E.toDisplayString(n.title),1),E.createElementVNode("button",{type:"button",class:"flex justify-center transition-all items-center w-7 h-7 text-sm font-semibold rounded-full border border-transparent text-gray-800 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none","data-hs-overlay":"#hs-basic-modal",onClick:e[0]||(e[0]=(...s)=>o.handleClose&&o.handleClose(...s))},MB)]),E.createElementVNode("div",kB,[E.renderSlot(t.$slots,"default",{},void 0,!0)])],2)]),_:3})])])):E.createCommentVNode("",!0)]),_:3})])}const Ih=lt(CB,[["render",PB],["__scopeId","data-v-c245c3b3"]]),AB=E.defineComponent({emits:["update:modelValue"],props:{modelValue:{type:String,default:()=>""},position:{type:String,default:()=>"horizontal"}},data(){return{tabId:`nav-${Math.floor(Math.random()*1e4)}`,bodyLoaded:!1}},mounted(){this.bodyLoaded=!0},computed:{tabPositionClasses(){return[{"font-semibold border-blue-600 text-blue-600 space-x-2 border-b ":this.position==="horizontal"},{"flex-col border-e space-y-2":this.position==="vertical"}]},wrapperPositionClasses(){return[{"flex flex-wrap":this.position==="vertical"}]}},methods:{handleTabSelection(t){this.$emit("update:modelValue",t)}}}),LB=["id"],DB={key:0,ref:"parentBody"};function RB(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("div",{class:E.normalizeClass(t.wrapperPositionClasses)},[E.createElementVNode("nav",{ref:"nav",class:E.normalizeClass(["flex border-gray-200",t.tabPositionClasses]),"aria-label":"Tabs",role:"tablist",id:t.tabId},null,10,LB),t.bodyLoaded?(E.openBlock(),E.createElementBlock("div",DB,[E.renderSlot(t.$slots,"default")],512)):E.createCommentVNode("",!0)],2)}const FB=lt(AB,[["render",RB]]),BB=E.defineComponent({props:{value:{type:String,default:()=>""},label:{type:String,default:()=>""},icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1}},computed:{tabClasses(){return[{"font-semibold border-solid border-blue-600 text-blue-600":this.parentInstance.modelValue===this.value},{"text-gray-500 border-transparent":this.parentInstance.modelValue!==this.value},{"py-4 px-1 border-b-2":this.parentInstance.position==="horizontal"},{"border-e-2 py-1 pe-4":this.parentInstance.position==="vertical"},{"opacity-40 pointer-events-none":this.disabled}]},bodyClasses(){return[{"ms-3":this.parentInstance.position==="vertical"}]},parentInstance(){return this.$parent},parentId(){return this.parentInstance.tabId},isValueEqualParentValue(){const t=this.value||this.label;return this.parentInstance.modelValue===t}},methods:{handleClick(){var t;this.disabled||this.value!==this.parentInstance.modelValue&&((t=this.parentInstance)==null||t.handleTabSelection(this.value))}}}),VB={ref:"wrapper"};function $B(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("div",VB,[(E.openBlock(),E.createBlock(E.Teleport,{to:`#${t.parentId}`},[E.createElementVNode("button",{ref:"button",type:"button",class:E.normalizeClass(["inline-flex justify-center w-full items-center gap-x-2 text-sm whitespace-nowrap hover:text-blue-600 !outline-none focus:!outline-none active:outline-none focus:text-blue-600 disabled:opacity-50 disabled:pointer-events-none",t.tabClasses]),onClick:e[0]||(e[0]=(...s)=>t.handleClick&&t.handleClick(...s))},[t.icon?(E.openBlock(),E.createElementBlock("i",{key:0,class:E.normalizeClass(t.icon)},null,2)):E.createCommentVNode("",!0),E.createTextVNode(" "+E.toDisplayString(t.label),1)],2)],8,["to"])),E.withDirectives(E.createElementVNode("div",{ref:"body",class:E.normalizeClass(["h-full",t.bodyClasses])},[E.renderSlot(t.$slots,"default")],2),[[E.vShow,t.isValueEqualParentValue]])],512)}const jB=lt(BB,[["render",$B]]);function QC(t,e){return function(){return t.apply(e,arguments)}}const{toString:qB}=Object.prototype,{getPrototypeOf:I_}=Object,gy=(t=>e=>{const n=qB.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),za=t=>(t=t.toLowerCase(),e=>gy(e)===t),my=t=>e=>typeof e===t,{isArray:Mh}=Array,Ep=my("undefined");function UB(t){return t!==null&&!Ep(t)&&t.constructor!==null&&!Ep(t.constructor)&&Ms(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const eN=za("ArrayBuffer");function zB(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&eN(t.buffer),e}const HB=my("string"),Ms=my("function"),tN=my("number"),yy=t=>t!==null&&typeof t=="object",GB=t=>t===!0||t===!1,vy=t=>{if(gy(t)!=="object")return!1;const e=I_(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},YB=za("Date"),WB=za("File"),XB=za("Blob"),KB=za("FileList"),ZB=t=>yy(t)&&Ms(t.pipe),JB=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Ms(t.append)&&((e=gy(t))==="formdata"||e==="object"&&Ms(t.toString)&&t.toString()==="[object FormData]"))},QB=za("URLSearchParams"),eV=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function wp(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,i;if(typeof t!="object"&&(t=[t]),Mh(t))for(r=0,i=t.length;r0;)if(i=n[r],e===i.toLowerCase())return i;return null}const rN=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,iN=t=>!Ep(t)&&t!==rN;function M_(){const{caseless:t}=iN(this)&&this||{},e={},n=(r,i)=>{const o=t&&nN(e,i)||i;vy(e[o])&&vy(r)?e[o]=M_(e[o],r):vy(r)?e[o]=M_({},r):Mh(r)?e[o]=r.slice():e[o]=r};for(let r=0,i=arguments.length;r(wp(e,(i,o)=>{n&&Ms(i)?t[o]=QC(i,n):t[o]=i},{allOwnKeys:r}),t),nV=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),rV=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},iV=(t,e,n,r)=>{let i,o,s;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)s=i[o],(!r||r(s,t,e))&&!a[s]&&(e[s]=t[s],a[s]=!0);t=n!==!1&&I_(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},oV=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},sV=t=>{if(!t)return null;if(Mh(t))return t;let e=t.length;if(!tN(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},aV=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&I_(Uint8Array)),lV=(t,e)=>{const r=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=r.next())&&!i.done;){const o=i.value;e.call(t,o[0],o[1])}},uV=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},cV=za("HTMLFormElement"),fV=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),oN=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),hV=za("RegExp"),sN=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};wp(n,(i,o)=>{let s;(s=e(i,o,t))!==!1&&(r[o]=s||i)}),Object.defineProperties(t,r)},dV=t=>{sN(t,(e,n)=>{if(Ms(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Ms(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},pV=(t,e)=>{const n={},r=i=>{i.forEach(o=>{n[o]=!0})};return Mh(t)?r(t):r(String(t).split(e)),n},gV=()=>{},mV=(t,e)=>(t=+t,Number.isFinite(t)?t:e),k_="abcdefghijklmnopqrstuvwxyz",aN="0123456789",lN={DIGIT:aN,ALPHA:k_,ALPHA_DIGIT:k_+k_.toUpperCase()+aN},yV=(t=16,e=lN.ALPHA_DIGIT)=>{let n="";const{length:r}=e;for(;t--;)n+=e[Math.random()*r|0];return n};function vV(t){return!!(t&&Ms(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const _V=t=>{const e=new Array(10),n=(r,i)=>{if(yy(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const o=Mh(r)?[]:{};return wp(r,(s,a)=>{const u=n(s,i+1);!Ep(u)&&(o[a]=u)}),e[i]=void 0,o}}return r};return n(t,0)},bV=za("AsyncFunction"),Ce={isArray:Mh,isArrayBuffer:eN,isBuffer:UB,isFormData:JB,isArrayBufferView:zB,isString:HB,isNumber:tN,isBoolean:GB,isObject:yy,isPlainObject:vy,isUndefined:Ep,isDate:YB,isFile:WB,isBlob:XB,isRegExp:hV,isFunction:Ms,isStream:ZB,isURLSearchParams:QB,isTypedArray:aV,isFileList:KB,forEach:wp,merge:M_,extend:tV,trim:eV,stripBOM:nV,inherits:rV,toFlatObject:iV,kindOf:gy,kindOfTest:za,endsWith:oV,toArray:sV,forEachEntry:lV,matchAll:uV,isHTMLForm:cV,hasOwnProperty:oN,hasOwnProp:oN,reduceDescriptors:sN,freezeMethods:dV,toObjectSet:pV,toCamelCase:fV,noop:gV,toFiniteNumber:mV,findKey:nN,global:rN,isContextDefined:iN,ALPHABET:lN,generateString:yV,isSpecCompliantForm:vV,toJSONObject:_V,isAsyncFn:bV,isThenable:t=>t&&(yy(t)||Ms(t))&&Ms(t.then)&&Ms(t.catch)};function In(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i)}Ce.inherits(In,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ce.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const uN=In.prototype,cN={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{cN[t]={value:t}}),Object.defineProperties(In,cN),Object.defineProperty(uN,"isAxiosError",{value:!0}),In.from=(t,e,n,r,i,o)=>{const s=Object.create(uN);return Ce.toFlatObject(t,s,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),In.call(s,t.message,e,n,r,i),s.cause=t,s.name=t.name,o&&Object.assign(s,o),s};const EV=null;function P_(t){return Ce.isPlainObject(t)||Ce.isArray(t)}function fN(t){return Ce.endsWith(t,"[]")?t.slice(0,-2):t}function hN(t,e,n){return t?t.concat(e).map(function(i,o){return i=fN(i),!n&&o?"["+i+"]":i}).join(n?".":""):e}function wV(t){return Ce.isArray(t)&&!t.some(P_)}const xV=Ce.toFlatObject(Ce,{},null,function(e){return/^is[A-Z]/.test(e)});function _y(t,e,n){if(!Ce.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=Ce.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,b){return!Ce.isUndefined(b[y])});const r=n.metaTokens,i=n.visitor||f,o=n.dots,s=n.indexes,u=(n.Blob||typeof Blob<"u"&&Blob)&&Ce.isSpecCompliantForm(e);if(!Ce.isFunction(i))throw new TypeError("visitor must be a function");function l(g){if(g===null)return"";if(Ce.isDate(g))return g.toISOString();if(!u&&Ce.isBlob(g))throw new In("Blob is not supported. Use a Buffer instead.");return Ce.isArrayBuffer(g)||Ce.isTypedArray(g)?u&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function f(g,y,b){let _=g;if(g&&!b&&typeof g=="object"){if(Ce.endsWith(y,"{}"))y=r?y:y.slice(0,-2),g=JSON.stringify(g);else if(Ce.isArray(g)&&wV(g)||(Ce.isFileList(g)||Ce.endsWith(y,"[]"))&&(_=Ce.toArray(g)))return y=fN(y),_.forEach(function(m,v){!(Ce.isUndefined(m)||m===null)&&e.append(s===!0?hN([y],v,o):s===null?y:y+"[]",l(m))}),!1}return P_(g)?!0:(e.append(hN(b,y,o),l(g)),!1)}const c=[],h=Object.assign(xV,{defaultVisitor:f,convertValue:l,isVisitable:P_});function d(g,y){if(!Ce.isUndefined(g)){if(c.indexOf(g)!==-1)throw Error("Circular reference detected in "+y.join("."));c.push(g),Ce.forEach(g,function(_,p){(!(Ce.isUndefined(_)||_===null)&&i.call(e,_,Ce.isString(p)?p.trim():p,y,h))===!0&&d(_,y?y.concat(p):[p])}),c.pop()}}if(!Ce.isObject(t))throw new TypeError("data must be an object");return d(t),e}function dN(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function A_(t,e){this._pairs=[],t&&_y(t,this,e)}const pN=A_.prototype;pN.append=function(e,n){this._pairs.push([e,n])},pN.toString=function(e){const n=e?function(r){return e.call(this,r,dN)}:dN;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function SV(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function gN(t,e,n){if(!e)return t;const r=n&&n.encode||SV,i=n&&n.serialize;let o;if(i?o=i(e,n):o=Ce.isURLSearchParams(e)?e.toString():new A_(e,n).toString(r),o){const s=t.indexOf("#");s!==-1&&(t=t.slice(0,s)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class mN{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Ce.forEach(this.handlers,function(r){r!==null&&e(r)})}}const yN={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},CV={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:A_,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},vN=typeof window<"u"&&typeof document<"u",NV=(t=>vN&&["ReactNative","NativeScript","NS"].indexOf(t)<0)(typeof navigator<"u"&&navigator.product),OV=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Ha={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:vN,hasStandardBrowserEnv:NV,hasStandardBrowserWebWorkerEnv:OV},Symbol.toStringTag,{value:"Module"})),...CV};function TV(t,e){return _y(t,new Ha.classes.URLSearchParams,Object.assign({visitor:function(n,r,i,o){return Ha.isNode&&Ce.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},e))}function IV(t){return Ce.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function MV(t){const e={},n=Object.keys(t);let r;const i=n.length;let o;for(r=0;r=n.length;return s=!s&&Ce.isArray(i)?i.length:s,u?(Ce.hasOwnProp(i,s)?i[s]=[i[s],r]:i[s]=r,!a):((!i[s]||!Ce.isObject(i[s]))&&(i[s]=[]),e(n,r,i[s],o)&&Ce.isArray(i[s])&&(i[s]=MV(i[s])),!a)}if(Ce.isFormData(t)&&Ce.isFunction(t.entries)){const n={};return Ce.forEachEntry(t,(r,i)=>{e(IV(r),i,n,0)}),n}return null}function kV(t,e,n){if(Ce.isString(t))try{return(e||JSON.parse)(t),Ce.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const L_={transitional:yN,adapter:["xhr","http"],transformRequest:[function(e,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,o=Ce.isObject(e);if(o&&Ce.isHTMLForm(e)&&(e=new FormData(e)),Ce.isFormData(e))return i?JSON.stringify(_N(e)):e;if(Ce.isArrayBuffer(e)||Ce.isBuffer(e)||Ce.isStream(e)||Ce.isFile(e)||Ce.isBlob(e))return e;if(Ce.isArrayBufferView(e))return e.buffer;if(Ce.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return TV(e,this.formSerializer).toString();if((a=Ce.isFileList(e))||r.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return _y(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return o||i?(n.setContentType("application/json",!1),kV(e)):e}],transformResponse:[function(e){const n=this.transitional||L_.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(e&&Ce.isString(e)&&(r&&!this.responseType||i)){const s=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?In.from(a,In.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ha.classes.FormData,Blob:Ha.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ce.forEach(["delete","get","head","post","put","patch"],t=>{L_.headers[t]={}});const D_=L_,PV=Ce.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),AV=t=>{const e={};let n,r,i;return t&&t.split(` `).forEach(function(s){i=s.indexOf(":"),n=s.substring(0,i).trim().toLowerCase(),r=s.substring(i+1).trim(),!(!n||e[n]&&PV[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},bN=Symbol("internals");function xp(t){return t&&String(t).trim().toLowerCase()}function by(t){return t===!1||t==null?t:Ce.isArray(t)?t.map(by):String(t)}function LV(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const DV=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function R_(t,e,n,r,i){if(Ce.isFunction(r))return r.call(this,e,n);if(i&&(e=n),!!Ce.isString(e)){if(Ce.isString(r))return e.indexOf(r)!==-1;if(Ce.isRegExp(r))return r.test(e)}}function RV(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function FV(t,e){const n=Ce.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(i,o,s){return this[r].call(this,e,i,o,s)},configurable:!0})})}class Ey{constructor(e){e&&this.set(e)}set(e,n,r){const i=this;function o(a,u,l){const f=xp(u);if(!f)throw new Error("header name must be a non-empty string");const c=Ce.findKey(i,f);(!c||i[c]===void 0||l===!0||l===void 0&&i[c]!==!1)&&(i[c||u]=by(a))}const s=(a,u)=>Ce.forEach(a,(l,f)=>o(l,f,u));return Ce.isPlainObject(e)||e instanceof this.constructor?s(e,n):Ce.isString(e)&&(e=e.trim())&&!DV(e)?s(AV(e),n):e!=null&&o(n,e,r),this}get(e,n){if(e=xp(e),e){const r=Ce.findKey(this,e);if(r){const i=this[r];if(!n)return i;if(n===!0)return LV(i);if(Ce.isFunction(n))return n.call(this,i,r);if(Ce.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=xp(e),e){const r=Ce.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||R_(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let i=!1;function o(s){if(s=xp(s),s){const a=Ce.findKey(r,s);a&&(!n||R_(r,r[a],a,n))&&(delete r[a],i=!0)}}return Ce.isArray(e)?e.forEach(o):o(e),i}clear(e){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const o=n[r];(!e||R_(this,this[o],o,e,!0))&&(delete this[o],i=!0)}return i}normalize(e){const n=this,r={};return Ce.forEach(this,(i,o)=>{const s=Ce.findKey(r,o);if(s){n[s]=by(i),delete n[o];return}const a=e?RV(o):String(o).trim();a!==o&&delete n[o],n[a]=by(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return Ce.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=e&&Ce.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[bN]=this[bN]={accessors:{}}).accessors,i=this.prototype;function o(s){const a=xp(s);r[a]||(FV(i,s),r[a]=!0)}return Ce.isArray(e)?e.forEach(o):o(e),this}}Ey.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Ce.reduceDescriptors(Ey.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}}),Ce.freezeMethods(Ey);const Ul=Ey;function F_(t,e){const n=this||D_,r=e||n,i=Ul.from(r.headers);let o=r.data;return Ce.forEach(t,function(a){o=a.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function EN(t){return!!(t&&t.__CANCEL__)}function Sp(t,e,n){In.call(this,t??"canceled",In.ERR_CANCELED,e,n),this.name="CanceledError"}Ce.inherits(Sp,In,{__CANCEL__:!0});function BV(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new In("Request failed with status code "+n.status,[In.ERR_BAD_REQUEST,In.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const VV=Ha.hasStandardBrowserEnv?{write(t,e,n,r,i,o){const s=[t+"="+encodeURIComponent(e)];Ce.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),Ce.isString(r)&&s.push("path="+r),Ce.isString(i)&&s.push("domain="+i),o===!0&&s.push("secure"),document.cookie=s.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function $V(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function jV(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function wN(t,e){return t&&!$V(e)?jV(t,e):e}const qV=Ha.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function i(o){let s=o;return e&&(n.setAttribute("href",s),s=n.href),n.setAttribute("href",s),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=i(window.location.href),function(s){const a=Ce.isString(s)?i(s):s;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}();function UV(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function zV(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i=0,o=0,s;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),f=r[o];s||(s=l),n[i]=u,r[i]=l;let c=o,h=0;for(;c!==i;)h+=n[c++],c=c%t;if(i=(i+1)%t,i===o&&(o=(o+1)%t),l-s{const o=i.loaded,s=i.lengthComputable?i.total:void 0,a=o-n,u=r(a),l=o<=s;n=o;const f={loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:u||void 0,estimated:u&&s&&l?(s-o)/u:void 0,event:i};f[e?"download":"upload"]=!0,t(f)}}const B_={http:EV,xhr:typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(n,r){let i=t.data;const o=Ul.from(t.headers).normalize();let{responseType:s,withXSRFToken:a}=t,u;function l(){t.cancelToken&&t.cancelToken.unsubscribe(u),t.signal&&t.signal.removeEventListener("abort",u)}let f;if(Ce.isFormData(i)){if(Ha.hasStandardBrowserEnv||Ha.hasStandardBrowserWebWorkerEnv)o.setContentType(!1);else if((f=o.getContentType())!==!1){const[y,...b]=f?f.split(";").map(_=>_.trim()).filter(Boolean):[];o.setContentType([y||"multipart/form-data",...b].join("; "))}}let c=new XMLHttpRequest;if(t.auth){const y=t.auth.username||"",b=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";o.set("Authorization","Basic "+btoa(y+":"+b))}const h=wN(t.baseURL,t.url);c.open(t.method.toUpperCase(),gN(h,t.params,t.paramsSerializer),!0),c.timeout=t.timeout;function d(){if(!c)return;const y=Ul.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders()),_={data:!s||s==="text"||s==="json"?c.responseText:c.response,status:c.status,statusText:c.statusText,headers:y,config:t,request:c};BV(function(m){n(m),l()},function(m){r(m),l()},_),c=null}if("onloadend"in c?c.onloadend=d:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(d)},c.onabort=function(){c&&(r(new In("Request aborted",In.ECONNABORTED,t,c)),c=null)},c.onerror=function(){r(new In("Network Error",In.ERR_NETWORK,t,c)),c=null},c.ontimeout=function(){let b=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const _=t.transitional||yN;t.timeoutErrorMessage&&(b=t.timeoutErrorMessage),r(new In(b,_.clarifyTimeoutError?In.ETIMEDOUT:In.ECONNABORTED,t,c)),c=null},Ha.hasStandardBrowserEnv&&(a&&Ce.isFunction(a)&&(a=a(t)),a||a!==!1&&qV(h))){const y=t.xsrfHeaderName&&t.xsrfCookieName&&VV.read(t.xsrfCookieName);y&&o.set(t.xsrfHeaderName,y)}i===void 0&&o.setContentType(null),"setRequestHeader"in c&&Ce.forEach(o.toJSON(),function(b,_){c.setRequestHeader(_,b)}),Ce.isUndefined(t.withCredentials)||(c.withCredentials=!!t.withCredentials),s&&s!=="json"&&(c.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&c.addEventListener("progress",xN(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",xN(t.onUploadProgress)),(t.cancelToken||t.signal)&&(u=y=>{c&&(r(!y||y.type?new Sp(null,t,c):y),c.abort(),c=null)},t.cancelToken&&t.cancelToken.subscribe(u),t.signal&&(t.signal.aborted?u():t.signal.addEventListener("abort",u)));const g=UV(h);if(g&&Ha.protocols.indexOf(g)===-1){r(new In("Unsupported protocol "+g+":",In.ERR_BAD_REQUEST,t));return}c.send(i||null)})}};Ce.forEach(B_,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const SN=t=>`- ${t}`,HV=t=>Ce.isFunction(t)||t===null||t===!1,CN={getAdapter:t=>{t=Ce.isArray(t)?t:[t];const{length:e}=t;let n,r;const i={};for(let o=0;o`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let s=e?o.length>1?`since : `+o.map(SN).join(` `):" "+SN(o[0]):"as no adapter specified";throw new In("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return r},adapters:B_};function V_(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Sp(null,t)}function NN(t){return V_(t),t.headers=Ul.from(t.headers),t.data=F_.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),CN.getAdapter(t.adapter||D_.adapter)(t).then(function(r){return V_(t),r.data=F_.call(t,t.transformResponse,r),r.headers=Ul.from(r.headers),r},function(r){return EN(r)||(V_(t),r&&r.response&&(r.response.data=F_.call(t,t.transformResponse,r.response),r.response.headers=Ul.from(r.response.headers))),Promise.reject(r)})}const ON=t=>t instanceof Ul?t.toJSON():t;function kh(t,e){e=e||{};const n={};function r(l,f,c){return Ce.isPlainObject(l)&&Ce.isPlainObject(f)?Ce.merge.call({caseless:c},l,f):Ce.isPlainObject(f)?Ce.merge({},f):Ce.isArray(f)?f.slice():f}function i(l,f,c){if(Ce.isUndefined(f)){if(!Ce.isUndefined(l))return r(void 0,l,c)}else return r(l,f,c)}function o(l,f){if(!Ce.isUndefined(f))return r(void 0,f)}function s(l,f){if(Ce.isUndefined(f)){if(!Ce.isUndefined(l))return r(void 0,l)}else return r(void 0,f)}function a(l,f,c){if(c in e)return r(l,f);if(c in t)return r(void 0,l)}const u={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(l,f)=>i(ON(l),ON(f),!0)};return Ce.forEach(Object.keys(Object.assign({},t,e)),function(f){const c=u[f]||i,h=c(t[f],e[f],f);Ce.isUndefined(h)&&c!==a||(n[f]=h)}),n}const TN="1.6.7",$_={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{$_[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const IN={};$_.transitional=function(e,n,r){function i(o,s){return"[Axios v"+TN+"] Transitional option '"+o+"'"+s+(r?". "+r:"")}return(o,s,a)=>{if(e===!1)throw new In(i(s," has been removed"+(n?" in "+n:"")),In.ERR_DEPRECATED);return n&&!IN[s]&&(IN[s]=!0,console.warn(i(s," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(o,s,a):!0}};function GV(t,e,n){if(typeof t!="object")throw new In("options must be an object",In.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const o=r[i],s=e[o];if(s){const a=t[o],u=a===void 0||s(a,o,t);if(u!==!0)throw new In("option "+o+" must be "+u,In.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new In("Unknown option "+o,In.ERR_BAD_OPTION)}}const j_={assertOptions:GV,validators:$_},Bu=j_.validators;class wy{constructor(e){this.defaults=e,this.interceptors={request:new mN,response:new mN}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;const o=i.stack?i.stack.replace(/^.+\n/,""):"";r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=` `+o):r.stack=o}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=kh(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:o}=n;r!==void 0&&j_.assertOptions(r,{silentJSONParsing:Bu.transitional(Bu.boolean),forcedJSONParsing:Bu.transitional(Bu.boolean),clarifyTimeoutError:Bu.transitional(Bu.boolean)},!1),i!=null&&(Ce.isFunction(i)?n.paramsSerializer={serialize:i}:j_.assertOptions(i,{encode:Bu.function,serialize:Bu.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=o&&Ce.merge(o.common,o[n.method]);o&&Ce.forEach(["delete","get","head","post","put","patch","common"],g=>{delete o[g]}),n.headers=Ul.concat(s,o);const a=[];let u=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(u=u&&y.synchronous,a.unshift(y.fulfilled,y.rejected))});const l=[];this.interceptors.response.forEach(function(y){l.push(y.fulfilled,y.rejected)});let f,c=0,h;if(!u){const g=[NN.bind(this),void 0];for(g.unshift.apply(g,a),g.push.apply(g,l),h=g.length,f=Promise.resolve(n);c{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](i);r._listeners=null}),this.promise.then=i=>{let o;const s=new Promise(a=>{r.subscribe(a),o=a}).then(i);return s.cancel=function(){r.unsubscribe(o)},s},e(function(o,s,a){r.reason||(r.reason=new Sp(o,s,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}static source(){let e;return{token:new q_(function(i){e=i}),cancel:e}}}const YV=q_;function WV(t){return function(n){return t.apply(null,n)}}function XV(t){return Ce.isObject(t)&&t.isAxiosError===!0}const U_={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(U_).forEach(([t,e])=>{U_[e]=t});const KV=U_;function MN(t){const e=new xy(t),n=QC(xy.prototype.request,e);return Ce.extend(n,xy.prototype,e,{allOwnKeys:!0}),Ce.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return MN(kh(t,i))},n}const Pt=MN(D_);Pt.Axios=xy,Pt.CanceledError=Sp,Pt.CancelToken=YV,Pt.isCancel=EN,Pt.VERSION=TN,Pt.toFormData=_y,Pt.AxiosError=In,Pt.Cancel=Pt.CanceledError,Pt.all=function(e){return Promise.all(e)},Pt.spread=WV,Pt.isAxiosError=XV,Pt.mergeConfig=kh,Pt.AxiosHeaders=Ul,Pt.formToJSON=t=>_N(Ce.isHTMLForm(t)?new FormData(t):t),Pt.getAdapter=CN.getAdapter,Pt.HttpStatusCode=KV,Pt.default=Pt;const Sy={load(){try{const t=Array.from(arguments);window.headLoadedFiles||(window.headLoadedFiles=[]);const e=typeof arguments[arguments.length-1]=="function"?arguments[arguments.length-1]:null,n=t.filter(r=>typeof r!="function").reduce((r,i)=>r.concat(i),[]).filter(r=>r&&!window.headLoadedFiles[r.url||r.split("?")[0]]);Promise.all(n.map(r=>this.loadFile1(r))).then(()=>{e&&e()})}catch(t){console.log(t)}},promise(t){return new Promise((e,n)=>{Sy.load(t,()=>{e()})})},loadFile1(t){let e=!1;typeof t=="object"&&(e=t.type,t=t.url);const n=t.split("?")[0];return new Promise((r,i)=>{function o(a){delete window.headLoadedFiles[`_${n}`],window.headLoadedFiles[n]=a.type,r(a.type)}let s;window.headLoadedFiles[`_${n}`]?s=window.headLoadedFiles[`_${n}`]:(n.includes(".css")?(s=document.createElement("link"),s.href=t,s.type="text/css",s.rel="stylesheet"):(s=document.createElement("script"),s.type="text/javascript",s.src=t,e&&(s.type=e)),window.headLoadedFiles[`_${n}`]=s,document.head.appendChild(s)),s.addEventListener("load",o),s.addEventListener("error",o)})}},ZV=(t,e=300)=>{let n;return function(...i){clearTimeout(n),n=setTimeout(()=>{t.apply(this,i)},e)}},JV=E.defineComponent({props:{data:{type:String,default:()=>""},original:{type:Object,default:()=>null},options:{type:Array,default:()=>null},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!0},modelValue:{type:[String,Array,Number],default:()=>""},multiple:{type:Boolean,default:()=>!1},multi:{type:Boolean,default:()=>!1},searchPlaceholder:{type:String,default:()=>"Search..."},searchIcon:{type:String,default:()=>"ti-search"},parent:{type:String,default:()=>""},mode:{type:String,default:()=>""},searchHighlight:{type:Boolean,default:()=>!0},placeholder:{type:String,default:()=>"Обрати"}},components:{VsAutocomplete:KS,VsAutocompleteOption:ZS,VsButton:Uc,VsDialog:Ih},inject:["formValues"],data(){return{firstInstance:null,optionsList:null,searchList:[],search:"",dialogVisible:!1,optionsLoading:!1,highlightedIndex:-1,handleSearchDebounced:ZV(t=>{this.handleSearch(t)},500)}},watch:{parentValue(t,e){t!==e&&(this.firstInstance=null,this.optionsList=null,this.search="",this.searchList=[],this.$emit("update:modelValue",""))}},computed:{value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}},addData(){var t;return((t=this.original)==null?void 0:t.add)||null},addFormTable(){var t;return((t=this.addData)==null?void 0:t.token)||this.addData.form},isMultiple(){return this.multiple||this.multi},addFormToken(){var t;return(t=this.addData)==null?void 0:t.token},countEqualTotal(){var t,e;return((t=this.firstInstance)==null?void 0:t.count)===((e=this.firstInstance)==null?void 0:e.limit)},totalBiggerThanLimit(){var t,e,n,r;if((t=this.firstInstance)!=null&&t.total&&((e=this.firstInstance)!=null&&e.limit))return((n=this.firstInstance)==null?void 0:n.total)>=((r=this.firstInstance)==null?void 0:r.limit)},parentValue(){var t;return this.formValues&&this.parent?((t=this.formValues)==null?void 0:t[this.parent])||this.parent:""},searchedDataList(){var e;const t=this.search.toLowerCase();return t?this.countEqualTotal?this.searchList:(e=this.optionsList)==null?void 0:e.filter(n=>n.text.toLowerCase().match(t)):this.optionsList},sortedDataList(){return this.searchedDataList?[...this.searchedDataList].sort(e=>Array.isArray(this.modelValue)?this.modelValue.includes(String(e.id))?-1:1:this.modelValue===String(e.id)?-1:1):null},isSearchable(){var t;return this.optionsList?((t=this.optionsList)==null?void 0:t.length)>=10:!1}},async created(){var t;if((t=this.parent)!=null&&t.includes("{{")){window!=null&&window.Handlebars||await Sy.promise(["https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.7.7/handlebars.min.js"]);const e=await window.Handlebars.compile(this.parent)({setting:window.setting});this.$emit("update:parent",e)}},methods:{async loadData(){this.modelValue&&await this.handleFocus()},handleKeyNavigation(t="next"){var i;const e=(((i=this.searchedDataList)==null?void 0:i.length)||0)-1,n=this.$refs.autocomplete.$refs.listWrapper;switch(t){case"next":this.highlightedIndex{const s=o;s.innerText===r&&s.scrollIntoView({block:"center",inline:"center"})})},menuEnterSelect(){var r,i;const e=(r=this.searchedDataList)!=null&&r.length?((i=this.searchedDataList)==null?void 0:i[0]["id"]).toString():null,n=this.getHighlightedValue()||e;if(n)if(this.isMultiple){const o=Array.isArray(this.modelValue)?this.modelValue:[],s=this.modelValue.includes(n)?o.filter(a=>a!==n):o.concat(n);this.$emit("update:modelValue",s)}else this.$emit("update:modelValue",n)},getHighlightedValue(t){var n;const e=(n=this.searchedDataList)==null?void 0:n[this.highlightedIndex];return e?t?e==null?void 0:e[t]:(e.id||e.text).toString():""},openDialog(){this.dialogVisible=!this.dialogVisible},async handleFocus(){this.optionsList||(this.optionsList=await this.getOptions())},async getOptions(){try{if(this.options)return this.options;const t=await this.requestData();this.firstInstance={count:t==null?void 0:t.count,total:t==null?void 0:t.total,limit:t==null?void 0:t.limit};let e=(t==null?void 0:t.data)||[];if(this.modelValue&&e.findIndex(r=>r.id==this.modelValue||this.modelValue.includes(r.id))===-1){const r=await this.requestData({val:`&val=${this.modelValue}`,search:""});e=e.concat((r==null?void 0:r.data)||[])}return e}catch(t){return console.error(t),null}},async requestData({val:t,search:e}={val:"",search:""}){var i;const n=setTimeout(()=>{this.optionsLoading=!0},600),r=()=>{clearTimeout(n),this.optionsLoading=!1};try{const o=this.parent?`&parent=${this.parentValue}`:"",s=((i=this.original)==null?void 0:i.host)||"",{data:a}=await Pt.get(`${s}/api-user/suggest/${this.data}?json=1${o}${e}${t}`);return r(),a}catch(o){return r(),console.error(o),null}},async handleSearch(t){var e;this.search=t,this.highlightedIndex=-1,this.totalBiggerThanLimit&&t&&this.mode!=="array"&&(this.searchList=(e=await this.requestData({search:`&key=${t.toLowerCase()}`,val:""}))==null?void 0:e.data)}}}),QV={class:"relative flex items-center"},e8={key:0,class:"animate-spin absolute z-10 top-2.5 right-9 inline-block w-4 h-4 border-[3px] border-current border-t-transparent text-blue-600 rounded-full",role:"status","aria-label":"loading"},t8=[E.createElementVNode("span",{class:"sr-only"},"Loading...",-1)],n8={class:"flex items-center"},r8={key:1,class:"text-center"},i8={class:"vs-form__autocomplete-dialog"};function o8(t,e,n,r,i,o){const s=E.resolveComponent("VsAutocompleteOption"),a=E.resolveComponent("VsAutocomplete"),u=E.resolveComponent("VsButton"),l=E.resolveComponent("VsFormWrapper"),f=E.resolveComponent("VsDialog");return E.openBlock(),E.createElementBlock("div",QV,[t.optionsLoading?(E.openBlock(),E.createElementBlock("div",e8,t8)):E.createCommentVNode("",!0),E.createVNode(a,{modelValue:t.value,"onUpdate:modelValue":e[0]||(e[0]=c=>t.value=c),class:"w-full",ref:"autocomplete",lazyLoad:t.loadData,disabled:t.disabled,clearable:t.clearable,multiple:t.isMultiple,searchable:t.isSearchable,searchHighlight:t.searchHighlight,searchPlaceholder:t.searchPlaceholder,searchIcon:t.searchIcon,onClick:t.handleFocus,onOnSearch:t.handleSearchDebounced,placeholder:t.placeholder,onMenuKeyDown:e[1]||(e[1]=c=>t.handleKeyNavigation("next")),onMenuKeyUp:e[2]||(e[2]=c=>t.handleKeyNavigation("prev")),onMenuEnterSelect:t.menuEnterSelect},{default:E.withCtx(()=>{var c;return[(c=t.optionsList)!=null&&c.length?(E.openBlock(!0),E.createElementBlock(E.Fragment,{key:0},E.renderList(t.sortedDataList,(h,d)=>(E.openBlock(),E.createBlock(s,{"is-highlighted":d===t.highlightedIndex,label:h.text||h.id||h,value:(h==null?void 0:h.id)||h,color:h.color,key:h.id||h.id},{default:E.withCtx(()=>[E.createElementVNode("div",n8,[h.color?(E.openBlock(),E.createElementBlock("div",{key:0,class:"w-4 h-4 rounded-md mr-2",style:E.normalizeStyle({"background-color":h.color})},null,4)):E.createCommentVNode("",!0),E.createTextVNode(" "+E.toDisplayString((h==null?void 0:h.text)||h),1)])]),_:2},1032,["is-highlighted","label","value","color"]))),128)):(E.openBlock(),E.createElementBlock("div",r8," Дані не знайдено "))]}),_:1},8,["modelValue","lazyLoad","disabled","clearable","multiple","searchable","searchHighlight","searchPlaceholder","searchIcon","onClick","onOnSearch","placeholder","onMenuEnterSelect"]),t.addData?(E.openBlock(),E.createBlock(u,{key:1,icon:"ti-plus",class:"ml-2 py-[11px] px-6",onClick:t.openDialog},null,8,["onClick"])):E.createCommentVNode("",!0),t.addData?(E.openBlock(),E.createBlock(f,{key:2,visible:t.dialogVisible,"onUpdate:visible":e[3]||(e[3]=c=>t.dialogVisible=c),title:"Додати"},{default:E.withCtx(()=>[E.createElementVNode("div",i8,[E.createVNode(l,{class:"add-form",table:t.addFormTable,token:t.addFormToken,mode:"add",onCancel:t.openDialog},null,8,["table","token","onCancel"])])]),_:1},8,["visible"])):E.createCommentVNode("",!0)])}const Cy=lt(JV,[["render",o8]]),s8=E.defineComponent({components:{VsFormText:zc},props:{mask:{type:[Object,String],default:()=>""},icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},modelValue:{type:String,default:()=>""},placeholder:{type:String,default:()=>""},iconPosition:{type:String,default:()=>"right"}},computed:{modelState:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}},placeholderValue(){return this.mask?this.mask.replace(/9/g,"_"):""}},mounted(){this.initMask()},methods:{initMask(){const e=this.$refs.formText.$el.querySelector("input");St(e,{mask:this.mask.replace(/9/gm,"0")})}}});function a8(t,e,n,r,i,o){const s=E.resolveComponent("VsFormText");return E.openBlock(),E.createElementBlock("div",null,[E.createVNode(s,{ref:"formText",icon:t.icon,iconPosition:t.iconPosition,disabled:t.disabled,modelValue:t.modelState,"onUpdate:modelValue":e[0]||(e[0]=a=>t.modelState=a),placeholder:t.placeholderValue,clearable:t.clearable},null,8,["icon","iconPosition","disabled","modelValue","placeholder","clearable"])])}const l8=lt(s8,[["render",a8]]),u8={props:{options:{type:Array,default:()=>[]},modelValue:{type:[Boolean,Array],default:({options:t})=>((t==null?void 0:t.length)||0)>1?[]:!1}},data(){return{}},computed:{value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}}},methods:{optionValue(t){return t.id||t.text},optionLabel(t){return(t==null?void 0:t.text)||t}},components:{VsCheckbox:Ym}};function c8(t,e,n,r,i,o){const s=E.resolveComponent("VsCheckbox");return E.openBlock(),E.createElementBlock("div",null,[(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(n.options,a=>(E.openBlock(),E.createBlock(s,{modelValue:o.value,"onUpdate:modelValue":e[0]||(e[0]=u=>o.value=u),disabled:a.disabled,label:o.optionLabel(a),value:o.optionValue(a),key:a.id},null,8,["modelValue","disabled","label","value"]))),128))])}const kN=lt(u8,[["render",c8]]),f8={props:{options:{type:Array,default:()=>[]},modelValue:{type:String,default:()=>""}},data(){return{}},computed:{value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}}},created(){if(!this.modelValue){const t=this.options[0];this.$emit("update:modelValue",this.optionValue(t))}},methods:{optionValue(t){return(t==null?void 0:t.id)||(t==null?void 0:t.text)||t},optionLabel(t){return(t==null?void 0:t.text)||t}},components:{VsRadio:X1}};function h8(t,e,n,r,i,o){const s=E.resolveComponent("VsRadio");return E.openBlock(),E.createElementBlock("div",null,[(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(n.options,a=>(E.openBlock(),E.createBlock(s,{modelValue:o.value,"onUpdate:modelValue":e[0]||(e[0]=u=>o.value=u),label:o.optionLabel(a),value:o.optionValue(a),key:a.id,disabled:a.disabled},null,8,["modelValue","label","value","disabled"]))),128))])}const d8=lt(f8,[["render",h8]]),p8={components:{VsText:zc},props:{defaultValue:{type:String,default:()=>""},modelValue:{type:String,default:t=>t.defaultValue},icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},placeholder:{type:[String,Object],default:()=>""},iconPosition:{type:String,default:()=>"right"}},computed:{value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}},placeholderValue(){var t;return((t=this.placeholder)==null?void 0:t.ua)||this.placeholder}}};function g8(t,e,n,r,i,o){const s=E.resolveComponent("VsText");return E.openBlock(),E.createBlock(s,{modelValue:o.value,"onUpdate:modelValue":e[0]||(e[0]=a=>o.value=a),icon:n.icon,iconPosition:n.iconPosition,disabled:n.disabled,placeholder:o.placeholderValue},null,8,["modelValue","icon","iconPosition","disabled","placeholder"])}const m8=lt(p8,[["render",g8]]),y8={props:{modelValue:{type:String,default:()=>""},clearable:{type:Boolean,default:()=>!1},disabled:{type:Boolean,default:()=>!1},placeholder:{type:String,default:()=>"Введіть текст..."},minHeight:{type:String,default:()=>"38px"},maxHeight:{type:String,default:()=>"150px"}},data(){return{}},computed:{value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}}},methods:{clearInput(){this.$emit("update:modelValue","")}}},v8={class:"vs-form-textarea relative"},_8=["placeholder","disabled"];function b8(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("div",v8,[n.clearable&&o.value?(E.openBlock(),E.createElementBlock("i",{key:0,class:E.normalizeClass(["absolute top-1/8 translate-y-2/4 ti ti-x right-2",{"pointer-events-none":n.disabled}]),onClick:e[0]||(e[0]=(...s)=>o.clearInput&&o.clearInput(...s))},null,2)):E.createCommentVNode("",!0),E.withDirectives(E.createElementVNode("textarea",{"onUpdate:modelValue":e[1]||(e[1]=s=>o.value=s),class:"py-2 px-3 block w-full border border-solid border-gray-200 rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none placeholder-gray-400 ring-0 focus:ring-0 outline-none focus:border focus:border-blue-500",rows:"3",placeholder:n.placeholder,disabled:n.disabled,style:E.normalizeStyle({"min-height":n.minHeight,"max-height":n.maxHeight})},null,12,_8),[[E.vModelText,o.value]])])}const E8=lt(y8,[["render",b8]]),w8={props:{min:{type:Number,default:()=>0},step:{type:Number,default:()=>1},max:{type:Number,default:()=>1/0},modelValue:{type:Number,default:()=>null},label:{type:String,default:()=>""},placeholder:{type:String,default:()=>"0"},disabled:{type:Boolean,default:()=>!1}},data(){return{id:`input-number-${Math.floor(Math.random()*1e3)}`}},computed:{value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}}}},x8=["step","min","max","id","placeholder","disabled"];function S8(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("div",null,[E.renderSlot(t.$slots,"label",E.normalizeProps(E.guardReactiveProps({id:t.id}))),E.withDirectives(E.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=s=>o.value=s),type:"number",step:n.step,min:n.min,max:n.max,id:t.id,"aria-describedby":"helper-text-explanation",class:E.normalizeClass(["vs-number__input bg-white border transition-all border-gray-200 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full px-2 py-2",{"cursor-not-allowed":n.disabled}]),placeholder:n.placeholder,disabled:n.disabled},null,10,x8),[[E.vModelText,o.value]])])}const PN=lt(w8,[["render",S8]]),je=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),z_=function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,n=window.getComputedStyle(t).overflowY,r=n.indexOf("hidden")!==-1,i=n.indexOf("visible")!==-1;return e&&!r&&!i},Ny=function(t,e=void 0){return!(!t||t===document.body||e&&t===e)&&(z_(t)?t:Ny(t.parentElement,e))},Ga=function(t){var e=new DOMParser().parseFromString(t,"text/html").body;if(e.childElementCount>1){for(var n=document.createElement("div");e.firstChild;)n.appendChild(e.firstChild);return n}return e.firstChild},H_=t=>`${t||""}`.split(" ").filter(e=>!!e),Ya=(t,e,n)=>{t&&H_(e).forEach(r=>{t.classList.toggle(r,n||!1)})};class Ph{constructor(e){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=e,this.pageX=e.pageX,this.pageY=e.pageY,this.clientX=e.clientX,this.clientY=e.clientY,this.id=self.Touch&&e instanceof Touch?e.identifier:-1,this.time=Date.now()}}const Ah={passive:!1};class C8{constructor(e,{start:n=()=>!0,move:r=()=>{},end:i=()=>{}}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=e,this.startCallback=n,this.moveCallback=r,this.endCallback=i;for(const o of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[o]=this[o].bind(this);this.element.addEventListener("mousedown",this.onPointerStart,Ah),this.element.addEventListener("touchstart",this.onTouchStart,Ah),this.element.addEventListener("touchmove",this.onMove,Ah),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd)}onPointerStart(e){if(!e.buttons||e.button!==0)return;const n=new Ph(e);this.currentPointers.some(r=>r.id===n.id)||this.triggerPointerStart(n,e)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(e){for(const n of Array.from(e.changedTouches||[]))this.triggerPointerStart(new Ph(n),e);window.addEventListener("blur",this.onWindowBlur)}onMove(e){const n=this.currentPointers.slice(),r="changedTouches"in e?Array.from(e.changedTouches||[]).map(o=>new Ph(o)):[new Ph(e)],i=[];for(const o of r){const s=this.currentPointers.findIndex(a=>a.id===o.id);s<0||(i.push(o),this.currentPointers[s]=o)}i.length&&this.moveCallback(e,this.currentPointers.slice(),n)}onPointerEnd(e){e.buttons>0&&e.button!==0||(this.triggerPointerEnd(e,new Ph(e)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(e){for(const n of Array.from(e.changedTouches||[]))this.triggerPointerEnd(e,new Ph(n))}triggerPointerStart(e,n){return!!this.startCallback(n,e,this.currentPointers.slice())&&(this.currentPointers.push(e),this.startPointers.push(e),!0)}triggerPointerEnd(e,n){const r=this.currentPointers.findIndex(i=>i.id===n.id);r<0||(this.currentPointers.splice(r,1),this.startPointers.splice(r,1),this.endCallback(e,n,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const e=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:e.clientX,clientY:e.clientY}),e,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,Ah),this.element.removeEventListener("touchstart",this.onTouchStart,Ah),this.element.removeEventListener("touchmove",this.onMove,Ah),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function AN(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function LN(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const G_=t=>typeof t=="object"&&t!==null&&t.constructor===Object&&Object.prototype.toString.call(t)==="[object Object]",Vo=(t,...e)=>{const n=e.length;for(let r=0;r{const a=Array.isArray(s)?[]:{};t[o]||Object.assign(t,{[o]:a}),G_(s)?Object.assign(t[o],Vo(a,s)):Array.isArray(s)?Object.assign(t,{[o]:[...s]}):Object.assign(t,{[o]:s})})}return t},Y_=function(t,e){return t.split(".").reduce((n,r)=>typeof n=="object"?n[r]:void 0,e)};class Oy{constructor(e={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(e);for(const n of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))n.startsWith("on")&&typeof this[n]=="function"&&(this[n]=this[n].bind(this))}setOptions(e){this.options=e?Vo({},this.constructor.defaults,e):{};for(const[n,r]of Object.entries(this.option("on")||{}))this.on(n,r)}option(e,...n){let r=Y_(e,this.options);return r&&typeof r=="function"&&(r=r.call(this,this,...n)),r}optionFor(e,n,r,...i){let o=Y_(n,e);var s;typeof(s=o)!="string"||isNaN(s)||isNaN(parseFloat(s))||(o=parseFloat(o)),o==="true"&&(o=!0),o==="false"&&(o=!1),o&&typeof o=="function"&&(o=o.call(this,this,e,...i));let a=Y_(n,this.options);return a&&typeof a=="function"?o=a.call(this,this,e,...i,o):o===void 0&&(o=a),o===void 0?r:o}cn(e){const n=this.options.classes;return n&&n[e]||""}localize(e,n=[]){e=String(e).replace(/\{\{(\w+).?(\w+)?\}\}/g,(r,i,o)=>{let s="";return o?s=this.option(`${i[0]+i.toLowerCase().substring(1)}.l10n.${o}`):i&&(s=this.option(`l10n.${i}`)),s||(s=r),s});for(let r=0;ri)}on(e,n){let r=[];typeof e=="string"?r=e.split(" "):Array.isArray(e)&&(r=e),this.events||(this.events=new Map),r.forEach(i=>{let o=this.events.get(i);o||(this.events.set(i,[]),o=[]),o.includes(n)||o.push(n),this.events.set(i,o)})}off(e,n){let r=[];typeof e=="string"?r=e.split(" "):Array.isArray(e)&&(r=e),r.forEach(i=>{const o=this.events.get(i);if(Array.isArray(o)){const s=o.indexOf(n);s>-1&&o.splice(s,1)}})}emit(e,...n){[...this.events.get(e)||[]].forEach(r=>r(this,...n)),e!=="*"&&this.emit("*",e,...n)}}Object.defineProperty(Oy,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.33"}),Object.defineProperty(Oy,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class W_ extends Oy{constructor(e={}){super(e),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(e={}){const n=new Map;for(const[r,i]of Object.entries(e)){const o=this.option(r),s=this.plugins[r];s||o===!1?s&&o===!1&&(s.detach(),delete this.plugins[r]):n.set(r,new i(this,o||{}))}for(const[r,i]of n)this.plugins[r]=i,i.attach()}detachPlugins(e){e=e||Object.keys(this.plugins);for(const n of e){const r=this.plugins[n];r&&r.detach(),delete this.plugins[n]}return this.emit("detachPlugins"),this}}var Hn;(function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"})(Hn||(Hn={}));const zl=["a","b","c","d","e","f"],DN={PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"},N8={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:DN},RN='',X_='
'+RN+RN+"
",$o=t=>t&&t!==null&&t instanceof Element&&"nodeType"in t,jn=(t,e)=>{t&&H_(e).forEach(n=>{t.classList.remove(n)})},it=(t,e)=>{t&&H_(e).forEach(n=>{t.classList.add(n)})},Ty={a:1,b:0,c:0,d:1,e:0,f:0},O8=1e5,Iy=1e4,ks="mousemove",FN="drag",BN="content";let K_=null,Z_=null;class Vu extends W_{get fits(){return this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1}get isTouchDevice(){return Z_===null&&(Z_=window.matchMedia("(hover: none)").matches),Z_}get isMobile(){return K_===null&&(K_=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),K_}get panMode(){return this.options.panMode!==ks||this.isTouchDevice?FN:ks}get panOnlyZoomed(){const e=this.options.panOnlyZoomed;return e==="auto"?this.isTouchDevice:e}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:e,b:n}=this.current;return Math.sqrt(e*e+n*n)||1}get targetScale(){const{a:e,b:n}=this.target;return Math.sqrt(e*e+n*n)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:e}=this;return e.fullWidth/e.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:e,contentRect:n}=this,r=Math.max(e.height/n.fitHeight,e.width/n.fitWidth)||1;return Math.min(this.fullScale,r)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const e=this.content;return!!(e&&e instanceof HTMLImageElement)&&!e.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const e of zl){const n=e=="e"||e==="f"?1e-4:1e-5;if(Math.abs(this.target[e]-this.current[e])>n)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(e,n={},r={}){var i;if(super(n),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pwt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"cwd",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"pmme",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Hn.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},Ty)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},Ty)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!e)throw new Error("Container Element Not Found");this.container=e,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},Vu.Plugins),r)),this.emit("attachPlugins"),this.emit("init");const o=this.content;if(o.addEventListener("load",this.onLoad),o.addEventListener("error",this.onError),this.isContentLoading){if(this.option("spinner")){e.classList.add(this.cn("isLoading"));const s=Ga(X_);!e.contains(o)||o.parentElement instanceof HTMLPictureElement?this.spinner=e.appendChild(s):this.spinner=((i=o.parentElement)===null||i===void 0?void 0:i.insertBefore(s,o))||null}this.emit("beforeLoad")}else queueMicrotask(()=>{this.enable()})}initContent(){const{container:e}=this,n=this.cn(BN);let r=this.option(BN)||e.querySelector(`.${n}`);if(r||(r=e.querySelector("img,picture")||e.firstElementChild,r&&it(r,n)),r instanceof HTMLPictureElement&&(r=r.querySelector("img")),!r)throw new Error("No content found");this.content=r}onLoad(){const{spinner:e,container:n,state:r}=this;e&&(e.remove(),this.spinner=null),this.option("spinner")&&n.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),r===Hn.Init?this.enable():this.updateMetrics()}onError(){this.state!==Hn.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=Hn.Error,this.emit("error"))}getNextScale(e){const{fullScale:n,targetScale:r,coverScale:i,maxScale:o,minScale:s}=this;let a=s;switch(e){case"toggleMax":a=r-s<.5*(o-s)?o:s;break;case"toggleCover":a=r-s<.5*(i-s)?i:s;break;case"toggleZoom":a=r-s<.5*(n-s)?n:s;break;case"iterateZoom":let u=[1,n,o].sort((f,c)=>f-c),l=u.findIndex(f=>f>r+1e-5);a=u[l]||1}return a}attachObserver(){var e;const n=()=>{const{container:r,containerRect:i}=this;return Math.abs(i.width-r.getBoundingClientRect().width)>.1||Math.abs(i.height-r.getBoundingClientRect().height)>.1};this.resizeObserver||window.ResizeObserver===void 0||(this.resizeObserver=new ResizeObserver(()=>{this.updateTimer||(n()?(this.onResize(),this.isMobile&&(this.updateTimer=setTimeout(()=>{n()&&this.onResize(),this.updateTimer=null},500))):this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null))})),(e=this.resizeObserver)===null||e===void 0||e.observe(this.container)}detachObserver(){var e;(e=this.resizeObserver)===null||e===void 0||e.disconnect()}attachEvents(){const{container:e}=this;e.addEventListener("click",this.onClick,{passive:!1,capture:!1}),e.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new C8(e,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener(ks,this.onMouseMove)}detachEvents(){var e;const{container:n}=this;n.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),n.removeEventListener("wheel",this.onWheel,{passive:!1}),(e=this.pointerTracker)===null||e===void 0||e.stop(),this.pointerTracker=null,document.removeEventListener(ks,this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const e=this.friction,n=this.option("maxVelocity");for(const r of zl)e?(this.velocity[r]*=1-e,n&&!this.isScaling&&(this.velocity[r]=Math.max(Math.min(this.velocity[r],n),-1*n)),this.current[r]+=this.velocity[r]):this.current[r]=this.target[r];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame(()=>this.animate()):this.stop("current")}setTargetForce(){for(const e of zl)e==="e"&&this.isBouncingX||e==="f"&&this.isBouncingY||(this.velocity[e]=(1/(1-this.friction)-1)*(this.target[e]-this.current[e]))}checkBounds(e=0,n=0){const{current:r}=this,i=r.e+e,o=r.f+n,s=this.getBounds(),{x:a,y:u}=s,l=a.min,f=a.max,c=u.min,h=u.max;let d=0,g=0;return l!==1/0&&if&&(d=f-i),c!==1/0&&oh&&(g=h-o),Math.abs(d)<1e-4&&(d=0),Math.abs(g)<1e-4&&(g=0),Object.assign(Object.assign({},s),{xDiff:d,yDiff:g,inBounds:!d&&!g})}clampTargetBounds(){const{target:e}=this,{x:n,y:r}=this.getBounds();n.min!==1/0&&(e.e=Math.max(e.e,n.min)),n.max!==1/0&&(e.e=Math.min(e.e,n.max)),r.min!==1/0&&(e.f=Math.max(e.f,r.min)),r.max!==1/0&&(e.f=Math.min(e.f,r.max))}calculateContentDim(e=this.current){const{content:n,contentRect:r}=this,{fitWidth:i,fitHeight:o,fullWidth:s,fullHeight:a}=r;let u=s,l=a;if(this.option("zoom")||this.angle!==0){const f=!(n instanceof HTMLImageElement)&&(window.getComputedStyle(n).maxWidth==="none"||window.getComputedStyle(n).maxHeight==="none"),c=f?s:i,h=f?a:o,d=this.getMatrix(e),g=new DOMPoint(0,0).matrixTransform(d),y=new DOMPoint(0+c,0).matrixTransform(d),b=new DOMPoint(0+c,0+h).matrixTransform(d),_=new DOMPoint(0,0+h).matrixTransform(d),p=Math.abs(b.x-g.x),m=Math.abs(b.y-g.y),v=Math.abs(_.x-y.x),w=Math.abs(_.y-y.y);u=Math.max(p,v),l=Math.max(m,w)}return{contentWidth:u,contentHeight:l}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||this.panMode===ks||this.targetScale{const d=window.getSelection();return d&&d.type==="Range"})()&&!r.closest("button"))return;const i=r.closest("[data-panzoom-action]"),o=r.closest("[data-panzoom-change]"),s=i||o,a=s&&$o(s)?s.dataset:null;if(a){const d=a.panzoomChange,g=a.panzoomAction;if((d||g)&&e.preventDefault(),d){let y={};try{y=JSON.parse(d)}catch{console&&console.warn("The given data was not valid JSON")}return void this.applyChange(y)}if(g)return void(this[g]&&this[g]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return e.preventDefault(),void e.stopPropagation();if(r.closest("[data-fancybox]"))return;const u=this.content.getBoundingClientRect(),l=this.dragStart;if(l.time&&!this.canZoomOut()&&(Math.abs(u.x-l.x)>2||Math.abs(u.y-l.y)>2))return;this.dragStart.time=0;const f=d=>{this.option("zoom",e)&&d&&typeof d=="string"&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(d)&&typeof this[d]=="function"&&(e.preventDefault(),this[d]({event:e}))},c=this.option("click",e),h=this.option("dblClick",e);h?(this.clicks++,this.clicks==1&&(this.clickTimer=setTimeout(()=>{this.clicks===1?(this.emit("click",e),!e.defaultPrevented&&c&&f(c)):(this.emit("dblClick",e),e.defaultPrevented||f(h)),this.clicks=0,this.clickTimer=null},350))):(this.emit("click",e),!e.defaultPrevented&&c&&f(c))}addTrackingPoint(e){const n=this.trackingPoints.filter(r=>r.time>Date.now()-100);n.push(e),this.trackingPoints=n}onPointerDown(e,n,r){var i;if(this.option("touch",e)===!1)return!1;this.pwt=0,this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const o=this.content.getBoundingClientRect();if(this.dragStart={x:o.x,y:o.y,top:o.top,left:o.left,time:Date.now()},this.clickTimer)return!1;if(this.panMode===ks&&this.targetScale>1)return e.preventDefault(),e.stopPropagation(),!1;const s=e.composedPath()[0];if(!r.length){if(["TEXTAREA","OPTION","INPUT","SELECT","VIDEO","IFRAME"].includes(s.nodeName)||s.closest("[contenteditable],[data-selectable],[data-draggable],[data-clickable],[data-panzoom-change],[data-panzoom-action]"))return!1;(i=window.getSelection())===null||i===void 0||i.removeAllRanges()}if(e.type==="mousedown")["A","BUTTON"].includes(s.nodeName)||e.preventDefault();else if(Math.abs(this.velocity.a)>.3)return!1;return this.target.e=this.current.e,this.target.f=this.current.f,this.stop(),this.isDragging||(this.isDragging=!0,this.addTrackingPoint(n),this.emit("touchStart",e)),!0}onPointerMove(e,n,r){if(this.option("touch",e)===!1||!this.isDragging||n.length<2&&this.panOnlyZoomed&&je(this.targetScale)<=je(this.minScale)||(this.emit("touchMove",e),e.defaultPrevented))return;this.addTrackingPoint(n[0]);const{content:i}=this,o=LN(r[0],r[1]),s=LN(n[0],n[1]);let a=0,u=0;if(n.length>1){const m=i.getBoundingClientRect();a=o.clientX-m.left-.5*m.width,u=o.clientY-m.top-.5*m.height}const l=AN(r[0],r[1]),f=AN(n[0],n[1]);let c=l?f/l:1,h=s.clientX-o.clientX,d=s.clientY-o.clientY;this.dragOffset.x+=h,this.dragOffset.y+=d,this.dragOffset.time=Date.now()-this.dragStart.time;let g=je(this.targetScale)===je(this.minScale)&&this.option("lockAxis");if(g&&!this.lockedAxis)if(g==="xy"||g==="y"||e.type==="touchmove"){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void e.preventDefault();const m=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=m>45&&m<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,h=0,d=0}else this.lockedAxis=g;if(Ny(e.target,this.content)&&(g="x",this.dragOffset.y=0),g&&g!=="xy"&&this.lockedAxis!==g&&je(this.targetScale)===je(this.minScale))return;e.cancelable&&e.preventDefault(),this.container.classList.add(this.cn("isDragging"));const y=this.checkBounds(h,d);this.option("rubberband")?(this.isInfinite!=="x"&&(y.xDiff>0&&h<0||y.xDiff<0&&h>0)&&(h*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*y.xDiff))),this.isInfinite!=="y"&&(y.yDiff>0&&d<0||y.yDiff<0&&d>0)&&(d*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*y.yDiff)))):(y.xDiff&&(h=0),y.yDiff&&(d=0));const b=this.targetScale,_=this.minScale,p=this.maxScale;b<.5*_&&(c=Math.max(c,_)),b>1.5*p&&(c=Math.min(c,p)),this.lockedAxis==="y"&&je(b)===je(_)&&(h=0),this.lockedAxis==="x"&&je(b)===je(_)&&(d=0),this.applyChange({originX:a,originY:u,panX:h,panY:d,scale:c,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(e,n,r){if(r.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.addTrackingPoint(n),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),Ny(e.target,this.content)&&this.lockedAxis==="y"&&(this.trackingPoints=[]),this.emit("touchEnd",e),this.isDragging=!1,this.lockedAxis=!1,this.state!==Hn.Destroy&&(e.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){var e;const n=this.isScaling;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const m of zl)this.velocity[m]=0;this.target.e=this.current.e,this.target.f=this.current.f,jn(this.container,"is-scaling"),jn(this.container,"is-animating"),this.isTicking=!1;const{trackingPoints:r}=this,i=r[0],o=r[r.length-1];let s=0,a=0,u=0;o&&i&&(s=o.clientX-i.clientX,a=o.clientY-i.clientY,u=o.time-i.time);const l=((e=window.visualViewport)===null||e===void 0?void 0:e.scale)||1;l!==1&&(s*=l,a*=l);let f=0,c=0,h=0,d=0,g=this.option("decelFriction");const y=this.targetScale;if(u>0){h=Math.abs(s)>3?s/(u/30):0,d=Math.abs(a)>3?a/(u/30):0;const m=this.option("maxVelocity");m&&(h=Math.max(Math.min(h,m),-1*m),d=Math.max(Math.min(d,m),-1*m))}h&&(f=h/(1/(1-g)-1)),d&&(c=d/(1/(1-g)-1)),(this.option("lockAxis")==="y"||this.option("lockAxis")==="xy"&&this.lockedAxis==="y"&&je(y)===this.minScale)&&(f=h=0),(this.option("lockAxis")==="x"||this.option("lockAxis")==="xy"&&this.lockedAxis==="x"&&je(y)===this.minScale)&&(c=d=0);const b=this.dragOffset.x,_=this.dragOffset.y,p=this.option("dragMinThreshold")||0;Math.abs(b)this.maxScale+1e-5)||n&&!f&&!c)&&(g=.35),this.applyChange({panX:f,panY:c,friction:g}),this.emit("decel",h,d,b,_)}onWheel(e){var n=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(o,s){return Math.abs(s)>Math.abs(o)?s:o});const r=Math.max(-1,Math.min(1,n));if(this.emit("wheel",e,r),this.panMode===ks||e.defaultPrevented)return;const i=this.option("wheel");i==="pan"?(e.preventDefault(),this.panOnlyZoomed&&!this.canZoomOut()||this.applyChange({panX:2*-e.deltaX,panY:2*-e.deltaY,bounce:!1})):i==="zoom"&&this.option("zoom")!==!1&&this.zoomWithWheel(e)}onMouseMove(e){this.panWithMouse(e)}onKeydown(e){e.key==="Escape"&&this.toggleFS()}onResize(){this.updateMetrics(),this.checkBounds().inBounds||this.requestTick()}setTransform(){this.emit("beforeTransform");const{current:e,target:n,content:r,contentRect:i}=this,o=Object.assign({},Ty);for(const b of zl){const _=b=="e"||b==="f"?Iy:O8;o[b]=je(e[b],_),Math.abs(n[b]-e[b])<(b=="e"||b==="f"?.51:.001)&&(e[b]=n[b])}let{a:s,b:a,c:u,d:l,e:f,f:c}=o,h=`matrix(${s}, ${a}, ${u}, ${l}, ${f}, ${c})`,d=r.parentElement instanceof HTMLPictureElement?r.parentElement:r;if(this.option("transformParent")&&(d=d.parentElement||d),d.style.transform===h)return;d.style.transform=h;const{contentWidth:g,contentHeight:y}=this.calculateContentDim();i.width=g,i.height=y,this.emit("afterTransform")}updateMetrics(e=!1){var n;if(!this||this.state===Hn.Destroy||this.isContentLoading)return;const r=Math.max(1,((n=window.visualViewport)===null||n===void 0?void 0:n.scale)||1),{container:i,content:o}=this,s=o instanceof HTMLImageElement,a=i.getBoundingClientRect(),u=getComputedStyle(this.container);let l=a.width*r,f=a.height*r;const c=parseFloat(u.paddingTop)+parseFloat(u.paddingBottom),h=l-(parseFloat(u.paddingLeft)+parseFloat(u.paddingRight)),d=f-c;this.containerRect={width:l,height:f,innerWidth:h,innerHeight:d};let g=this.option("width")||"auto",y=this.option("height")||"auto";g==="auto"&&(g=parseFloat(o.dataset.width||"")||(S=>{let C=0;return C=S instanceof HTMLImageElement?S.naturalWidth:S instanceof SVGElement?S.width.baseVal.value:Math.max(S.offsetWidth,S.scrollWidth),C||0})(o)),y==="auto"&&(y=parseFloat(o.dataset.height||"")||(S=>{let C=0;return C=S instanceof HTMLImageElement?S.naturalHeight:S instanceof SVGElement?S.height.baseVal.value:Math.max(S.offsetHeight,S.scrollHeight),C||0})(o));let b=o.parentElement instanceof HTMLPictureElement?o.parentElement:o;this.option("transformParent")&&(b=b.parentElement||b);const _=b.getAttribute("style")||"";b.style.setProperty("transform","none","important"),s&&(b.style.width="",b.style.height=""),b.offsetHeight;const p=o.getBoundingClientRect();let m=p.width*r,v=p.height*r,w=0,N=0;s&&(Math.abs(g-m)>1||Math.abs(y-v)>1)&&({width:m,height:v,top:w,left:N}=((S,C,O,M)=>{const T=O/M;return T>S/C?(O=S,M=S/T):(O=C*T,M=C),{width:O,height:M,top:.5*(C-M),left:.5*(S-O)}})(m,v,g,y)),this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:p.top-a.top+w,bottom:a.bottom-p.bottom+w,left:p.left-a.left+N,right:a.right-p.right+N,fitWidth:m,fitHeight:v,width:m,height:v,fullWidth:g,fullHeight:y}),b.style.cssText=_,s&&(b.style.width=`${m}px`,b.style.height=`${v}px`),this.setTransform(),e!==!0&&this.emit("refresh"),this.ignoreBounds||(je(this.targetScale)this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===Hn.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}calculateBounds(){const{contentWidth:e,contentHeight:n}=this.calculateContentDim(this.target),{targetScale:r,lockedAxis:i}=this,{fitWidth:o,fitHeight:s}=this.contentRect;let a=0,u=0,l=0,f=0;const c=this.option("infinite");if(c===!0||i&&c===i)a=-1/0,l=1/0,u=-1/0,f=1/0;else{let{containerRect:h,contentRect:d}=this,g=je(o*r,Iy),y=je(s*r,Iy),{innerWidth:b,innerHeight:_}=h;if(h.width===g&&(b=h.width),h.width===y&&(_=h.height),e>b){l=.5*(e-b),a=-1*l;let p=.5*(d.right-d.left);a+=p,l+=p}if(o>b&&e_){f=.5*(n-_),u=-1*f;let p=.5*(d.bottom-d.top);u+=p,f+=p}s>_&&n<_&&(a-=.5*(s-_),l-=.5*(s-_))}return{x:{min:a,max:l},y:{min:u,max:f}}}getBounds(){const e=this.option("bounds");return e!=="auto"?e:this.calculateBounds()}updateControls(){const e=this,n=e.container,{panMode:r,contentRect:i,targetScale:o,minScale:s}=e;let a=s,u=e.option("click")||!1;u&&(a=e.getNextScale(u));let l=e.canZoomIn(),f=e.canZoomOut(),c=r===FN&&!!this.option("touch"),h=f&&c;if(c&&(je(o)je(i.fitWidth,1)||je(i.height,1)>je(i.fitHeight,1))&&(h=!0)),je(i.width*o,1)je(o),g=!d&&!h&&f&&je(a)v&&(r=v/p)}_=_.scale(r)}_=_.translate(-o,-s).translate(-g,-y).multiply(b),i&&(_=_.rotate(i)),u&&(_=_.scale(-1,1)),l&&(_=_.scale(1,-1));for(const p of zl)p!=="e"&&p!=="f"&&(_[p]>this.minScale+1e-5||_[p].1||this.panMode===ks||c===!1)&&!f&&this.clampTargetBounds(),h===Hn.Init?this.animate():this.isResting||(this.state=Hn.Panning,this.requestTick())}stop(e=!1){if(this.state===Hn.Init||this.state===Hn.Destroy)return;const n=this.isTicking;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const r of zl)this.velocity[r]=0,e==="current"?this.current[r]=this.target[r]:e==="target"&&(this.target[r]=this.current[r]);this.setTransform(),jn(this.container,"is-scaling"),jn(this.container,"is-animating"),this.isTicking=!1,this.state=Hn.Ready,n&&(this.emit("endAnimation"),this.updateControls())}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),it(this.container,"is-animating"),this.isScaling&&it(this.container,"is-scaling")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame(()=>this.animate()))}panWithMouse(e,n=this.option("mouseMoveFriction")){if(this.pmme=e,this.panMode!==ks||!e||je(this.targetScale)<=je(this.minScale))return;this.emit("mouseMove",e);const{container:r,containerRect:i,contentRect:o}=this,s=i.width,a=i.height,u=r.getBoundingClientRect(),l=(e.clientX||0)-u.left,f=(e.clientY||0)-u.top;let{contentWidth:c,contentHeight:h}=this.calculateContentDim(this.target);const d=this.option("mouseMoveFactor");d>1&&(c!==s&&(c*=d),h!==a&&(h*=d));let g=.5*(c-s)-l/s*100/100*(c-s);g+=.5*(o.right-o.left);let y=.5*(h-a)-f/a*100/100*(h-a);y+=.5*(o.bottom-o.top),this.applyChange({panX:g-this.target.e,panY:y-this.target.f,friction:n})}zoomWithWheel(e){if(this.state===Hn.Destroy||this.state===Hn.Init)return;const n=Date.now();if(n-this.pwt<45)return void e.preventDefault();this.pwt=n;var r=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(l,f){return Math.abs(f)>Math.abs(l)?f:l});const i=Math.max(-1,Math.min(1,r)),{targetScale:o,maxScale:s,minScale:a}=this;let u=o*(100+45*i)/100;je(u)je(s)&&je(o)>=je(s)?(this.cwd+=Math.abs(i),u=s):(this.cwd=0,u=Math.max(Math.min(u,s),a)),this.cwd>this.option("wheelLimit")||(e.preventDefault(),je(u)!==je(o)&&this.zoomTo(u,{event:e}))}canZoomIn(){return this.option("zoom")&&(je(this.contentRect.width,1)je(this.minScale)}zoomIn(e=1.25,n){this.zoomTo(this.targetScale*e,n)}zoomOut(e=.8,n){this.zoomTo(this.targetScale*e,n)}zoomToFit(e){this.zoomTo("fit",e)}zoomToCover(e){this.zoomTo("cover",e)}zoomToFull(e){this.zoomTo("full",e)}zoomToMax(e){this.zoomTo("max",e)}toggleZoom(e){this.zoomTo(this.getNextScale("toggleZoom"),e)}toggleMax(e){this.zoomTo(this.getNextScale("toggleMax"),e)}toggleCover(e){this.zoomTo(this.getNextScale("toggleCover"),e)}iterateZoom(e){this.zoomTo("next",e)}zoomTo(e=1,{friction:n="auto",originX:r="auto",originY:i="auto",event:o}={}){if(this.isContentLoading||this.state===Hn.Destroy)return;const{targetScale:s,fullScale:a,maxScale:u,coverScale:l}=this;if(this.stop(),this.panMode===ks&&(o=this.pmme||o),o||r==="auto"||i==="auto"){const c=this.content.getBoundingClientRect(),h=this.container.getBoundingClientRect(),d=o?o.clientX:h.left+.5*h.width,g=o?o.clientY:h.top+.5*h.height;r=d-c.left-.5*c.width,i=g-c.top-.5*c.height}let f=1;typeof e=="number"?f=e:e==="full"?f=a:e==="cover"?f=l:e==="max"?f=u:e==="fit"?f=1:e==="next"&&(f=this.getNextScale("iterateZoom")),f=f/s||1,n=n==="auto"?f>1?.15:.25:n,this.applyChange({scale:f,originX:r,originY:i,friction:n}),o&&this.panMode===ks&&this.panWithMouse(o,n)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:e,contentRect:n,target:r}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-r.e,panY:.5*e.height-(n.top+.5*n.fitHeight)-r.f,scale:e.width/n.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:e,contentRect:n,target:r}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-r.e,panY:.5*e.innerHeight-(n.top+.5*n.fitHeight)-r.f,scale:e.height/n.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:e}=this,n=this.cn("inFullscreen"),r=this.cn("htmlHasFullscreen");e.classList.toggle(n);const i=e.classList.contains(n);i?(document.documentElement.classList.add(r),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(r),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(i?"enterFS":"exitFS")}getMatrix(e=this.current){const{a:n,b:r,c:i,d:o,e:s,f:a}=e;return new DOMMatrix([n,r,i,o,s,a])}reset(e){if(this.state!==Hn.Init&&this.state!==Hn.Destroy){this.stop("current");for(const n of zl)this.target[n]=Ty[n];this.target.a=this.minScale,this.target.d=this.minScale,this.clampTargetBounds(),this.isResting||(this.friction=e===void 0?this.option("friction"):e,this.state=Hn.Panning,this.requestTick())}}destroy(){this.stop(),this.state=Hn.Destroy,this.detachEvents(),this.detachObserver();const{container:e,content:n}=this,r=this.option("classes")||{};for(const i of Object.values(r))e.classList.remove(i+"");n&&(n.removeEventListener("load",this.onLoad),n.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(Vu,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:N8}),Object.defineProperty(Vu,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const VN=function(t,e){let n=!0;return(...r)=>{n&&(n=!1,t(...r),setTimeout(()=>{n=!0},e))}},$N=(t,e)=>{let n=[];return t.childNodes.forEach(r=>{r.nodeType!==Node.ELEMENT_NODE||e&&!r.matches(e)||n.push(r)}),n},T8={viewport:null,track:null,enabled:!0,slides:[],axis:"x",transition:"fade",preload:1,slidesPerPage:"auto",initialPage:0,friction:.12,Panzoom:{decelFriction:.12},center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:"ltr",classes:{container:"f-carousel",viewport:"f-carousel__viewport",track:"f-carousel__track",slide:"f-carousel__slide",isLTR:"is-ltr",isRTL:"is-rtl",isHorizontal:"is-horizontal",isVertical:"is-vertical",inTransition:"in-transition",isSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};var ni;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"})(ni||(ni={}));const J_=t=>{if(typeof t=="string"||t instanceof HTMLElement)t={html:t};else{const e=t.thumb;e!==void 0&&(typeof e=="string"&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",customClass:"",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},I8=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class da extends Oy{constructor(e,n){super(n),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:e})}attach(){}detach(){}}const M8={classes:{list:"f-carousel__dots",isDynamic:"is-dynamic",hasDots:"has-dots",dot:"f-carousel__dot",isBeforePrev:"is-before-prev",isPrev:"is-prev",isCurrent:"is-current",isNext:"is-next",isAfterNext:"is-after-next"},dotTpl:'',dynamicFrom:11,maxCount:1/0,minCount:2};class jN extends da{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let e=this.list;if(!e){e=document.createElement("ul"),it(e,this.cn("list")),e.setAttribute("role","tablist");const n=this.instance.container;n.appendChild(e),it(n,this.cn("hasDots")),this.list=e}return e}refresh(){var e;const n=this.instance.pages.length,r=Math.min(2,this.option("minCount")),i=Math.max(2e3,this.option("maxCount")),o=this.option("dynamicFrom");if(ni)return void this.cleanup();const s=typeof o=="number"&&n>5&&n>=o,a=!this.list||this.isDynamic!==s||this.list.children.length!==n;a&&this.cleanup();const u=this.build();if(Ya(u,this.cn("isDynamic"),!!s),a)for(let c=0;c=n-1&&o.setAttribute(My,"")))}addBtn(e){var n;const r=this.instance,i=document.createElement("button");i.setAttribute("tabindex","0"),i.setAttribute("title",r.localize(`{{${e.toUpperCase()}}}`)),it(i,this.cn("button")+" "+this.cn(e===ky?"isNext":"isPrev"));const o=r.isRTL?e===ky?qN:ky:e;var s;return i.innerHTML=r.localize(this.option(`${o}Tpl`)),i.dataset[`carousel${s=e,s?s.match("^[a-z]")?s.charAt(0).toUpperCase()+s.substring(1):s:""}`]="true",(n=this.container)===null||n===void 0||n.appendChild(i),i}build(){const e=this.instance.container,n=this.cn("container");let{container:r,prev:i,next:o}=this;r||(r=e.querySelector("."+n),this.isDom=!!r),r||(r=document.createElement("div"),it(r,n),e.appendChild(r)),this.container=r,o||(o=r.querySelector("[data-carousel-next]")),o||(o=this.addBtn(ky)),this.next=o,i||(i=r.querySelector("[data-carousel-prev]")),i||(i=this.addBtn(qN)),this.prev=i}cleanup(){this.isDom||(this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove()),this.prev=null,this.next=null,this.container=null,this.isDom=!1}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(UN,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'',prevTpl:''}});class zN extends da{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(e){this.target=this.instance,this.nav=e,this.attachEvents()}addAsNavFor(e){this.nav=this.instance,this.target=e,this.attachEvents()}attachEvents(){const{nav:e,target:n}=this;e&&n&&(e.options.initialSlide=n.options.initialPage,e.state===ni.Ready?this.onNavReady(e):e.on("ready",this.onNavReady),n.state===ni.Ready?this.onTargetReady(n):n.on("ready",this.onTargetReady))}onNavReady(e){e.on("createSlide",this.onNavCreateSlide),e.on("Panzoom.click",this.onNavClick),e.on("Panzoom.touchEnd",this.onNavTouch),this.onTargetChange()}onTargetReady(e){e.on("change",this.onTargetChange),e.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(e,n,r){this.onNavTouch(e,e.panzoom,r)}onNavTouch(e,n,r){var i,o;if(Math.abs(n.dragOffset.x)>3||Math.abs(n.dragOffset.y)>3)return;const s=r.target,{nav:a,target:u}=this;if(!a||!u||!s)return;const l=s.closest("[data-index]");if(r.stopPropagation(),r.preventDefault(),!l)return;const f=parseInt(l.dataset.index||"",10)||0,c=u.getPageForSlide(f),h=a.getPageForSlide(f);a.slideTo(h),u.slideTo(c,{friction:((o=(i=this.nav)===null||i===void 0?void 0:i.plugins)===null||o===void 0?void 0:o.Sync.option("friction"))||0}),this.markSelectedSlide(f)}onNavCreateSlide(e,n){n.index===this.selectedIndex&&this.markSelectedSlide(n.index)}onTargetChange(){var e,n;const{target:r,nav:i}=this;if(!r||!i||i.state!==ni.Ready||r.state!==ni.Ready)return;const o=(n=(e=r.pages[r.page])===null||e===void 0?void 0:e.slides[0])===null||n===void 0?void 0:n.index,s=i.getPageForSlide(o);this.markSelectedSlide(o),i.slideTo(s,i.prevPage===null&&r.prevPage===null?{friction:0}:void 0)}markSelectedSlide(e){const n=this.nav;n&&n.state===ni.Ready&&(this.selectedIndex=e,[...n.slides].map(r=>{r.el&&r.el.classList[r.index===e?"add":"remove"]("is-nav-selected")}))}attach(){const e=this;let n=e.options.target,r=e.options.nav;n?e.addAsNavFor(n):r&&e.addAsTargetFor(r)}detach(){const e=this,n=e.nav,r=e.target;n&&(n.off("ready",e.onNavReady),n.off("createSlide",e.onNavCreateSlide),n.off("Panzoom.click",e.onNavClick),n.off("Panzoom.touchEnd",e.onNavTouch)),e.nav=null,r&&(r.off("ready",e.onTargetReady),r.off("refresh",e.onTargetChange),r.off("change",e.onTargetChange)),e.target=null}}Object.defineProperty(zN,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const k8={Navigation:UN,Dots:jN,Sync:zN},Py="animationend",HN="isSelected",Ay="slide";class $u extends W_{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===ni.Ready}get isInfinite(){let e=!1;const{contentDim:n,viewportDim:r,pages:i,slides:o}=this,s=o[0];return i.length>=2&&s&&n+s.dim>=r&&(e=this.option("infinite")),e}get isRTL(){return this.option("direction")==="rtl"}get isHorizontal(){return this.option("axis")==="x"}constructor(e,n={},r={}){if(super(),Object.defineProperty(this,"bp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"lp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"userOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:ni.Init}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevPage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"inTransition",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"contentDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"viewportDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),typeof e=="string"&&(e=document.querySelector(e)),!e||!$o(e))throw new Error("No Element found");this.container=e,this.slideNext=VN(this.slideNext.bind(this),150),this.slidePrev=VN(this.slidePrev.bind(this),150),this.userOptions=n,this.userPlugins=r,queueMicrotask(()=>{this.processOptions()})}processOptions(){var e,n;const r=Vo({},$u.defaults,this.userOptions);let i="";const o=r.breakpoints;if(o&&G_(o))for(const[s,a]of Object.entries(o))window.matchMedia(s).matches&&G_(a)&&(i+=s,Vo(r,a));i===this.bp&&this.state!==ni.Init||(this.bp=i,this.state===ni.Ready&&(r.initialSlide=((n=(e=this.pages[this.page])===null||e===void 0?void 0:e.slides[0])===null||n===void 0?void 0:n.index)||0),this.state!==ni.Init&&this.destroy(),super.setOptions(r),this.option("enabled")===!1?this.attachEvents():setTimeout(()=>{this.init()},0))}init(){this.state=ni.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},$u.Plugins),this.userPlugins)),this.emit("attachPlugins"),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=ni.Ready,this.emit("ready")}initLayout(){const{container:e}=this,n=this.option("classes");it(e,this.cn("container")),Ya(e,n.isLTR,!this.isRTL),Ya(e,n.isRTL,this.isRTL),Ya(e,n.isVertical,!this.isHorizontal),Ya(e,n.isHorizontal,this.isHorizontal);let r=this.option("viewport")||e.querySelector(`.${n.viewport}`);r||(r=document.createElement("div"),it(r,n.viewport),r.append(...$N(e,`.${n.slide}`)),e.prepend(r)),r.addEventListener("scroll",this.onScroll);let i=this.option("track")||e.querySelector(`.${n.track}`);i||(i=document.createElement("div"),it(i,n.track),i.append(...Array.from(r.childNodes))),i.setAttribute("aria-live","polite"),r.contains(i)||r.prepend(i),this.viewport=r,this.track=i,this.emit("initLayout")}initSlides(){const{track:e}=this;if(!e)return;const n=[...this.slides],r=[];[...$N(e,`.${this.cn(Ay)}`)].forEach(i=>{if($o(i)){const o=J_({el:i,isDom:!0,index:this.slides.length});r.push(o)}});for(let i of[...this.option("slides",[])||[],...n])r.push(J_(i));this.slides=r;for(let i=0;i!(this.pages.length<2&&!n.options.infinite),bounds:()=>this.getBounds(),maxVelocity:n=>Math.abs(n.target[this.axis]-n.current[this.axis])<2*this.viewportDim?100:0},e)),this.panzoom.on("*",(n,r,...i)=>{this.emit(`Panzoom.${r}`,n,...i)}),this.panzoom.on("decel",this.onDecel),this.panzoom.on("refresh",this.onRefresh),this.panzoom.on("beforeTransform",this.onBeforeTransform),this.panzoom.on("endAnimation",this.onEndAnimation)}attachEvents(){const e=this.container;e&&(e.addEventListener("click",this.onClick,{passive:!1,capture:!1}),e.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let e=[];const{contentDim:n,viewportDim:r}=this;let i=this.option("slidesPerPage");i=(i==="auto"||n<=r)&&this.option("fill")!==!1?1/0:parseFloat(i+"");let o=0,s=0,a=0;for(const u of this.slides)(!e.length||s+u.dim-r>.05||a>=i)&&(e.push(I8()),o=e.length-1,s=0,a=0),e[o].slides.push(u),s+=u.dim+u.gap,a++;return e}processPages(){const e=this.pages,{contentDim:n,viewportDim:r,isInfinite:i}=this,o=this.option("center"),s=this.option("fill"),a=s&&o&&n>r&&!i;if(e.forEach((f,c)=>{var h;f.index=c,f.pos=((h=f.slides[0])===null||h===void 0?void 0:h.pos)||0,f.dim=0;for(const[d,g]of f.slides.entries())f.dim+=g.dim,d=n-.5*r?f.pos=n-r:o&&(f.pos+=-.5*(r-f.dim))}),e.forEach(f=>{s&&!i&&n>r&&(f.pos=Math.max(f.pos,0),f.pos=Math.min(f.pos,n-r)),f.pos=je(f.pos,1e3),f.dim=je(f.dim,1e3),Math.abs(f.pos)<=.1&&(f.pos=0)}),i)return e;const u=[];let l;return e.forEach(f=>{const c=Object.assign({},f);l&&c.pos===l.pos?(l.dim+=c.dim,l.slides=[...l.slides,...c.slides]):(c.index=u.length,l=c,u.push(c))}),u}getPageFromIndex(e=0){const n=this.pages.length;let r;return e=parseInt((e||0).toString())||0,r=this.isInfinite?(e%n+n)%n:Math.max(Math.min(e,n-1),0),r}getSlideMetrics(e){var n,r;const i=this.isHorizontal?"width":"height";let o=0,s=0,a=e.el;const u=!(!a||a.parentNode);if(a?o=parseFloat(a.dataset[i]||"")||0:(a=document.createElement("div"),a.style.visibility="hidden",(this.track||document.body).prepend(a)),it(a,this.cn(Ay)+" "+e.class+" "+e.customClass),o)a.style[i]=`${o}px`,a.style[i==="width"?"height":"width"]="";else{u&&(this.track||document.body).prepend(a),o=a.getBoundingClientRect()[i]*Math.max(1,((n=window.visualViewport)===null||n===void 0?void 0:n.scale)||1);let f=a[this.isHorizontal?"offsetWidth":"offsetHeight"];f-1>o&&(o=f)}const l=getComputedStyle(a);return l.boxSizing==="content-box"&&(this.isHorizontal?(o+=parseFloat(l.paddingLeft)||0,o+=parseFloat(l.paddingRight)||0):(o+=parseFloat(l.paddingTop)||0,o+=parseFloat(l.paddingBottom)||0)),s=parseFloat(l[this.isHorizontal?"marginRight":"marginBottom"])||0,u?(r=a.parentElement)===null||r===void 0||r.removeChild(a):e.el||a.remove(),{dim:je(o,1e3),gap:je(s,1e3)}}getBounds(){const{isInfinite:e,isRTL:n,isHorizontal:r,pages:i}=this;let o={min:0,max:0};if(e)o={min:-1/0,max:1/0};else if(i.length){const s=i[0].pos,a=i[i.length-1].pos;o=n&&r?{min:s,max:a}:{min:-1*a,max:-1*s}}return{x:r?o:{min:0,max:0},y:r?{min:0,max:0}:o}}repositionSlides(){let e,{isHorizontal:n,isRTL:r,isInfinite:i,viewport:o,viewportDim:s,contentDim:a,page:u,pages:l,slides:f,panzoom:c}=this,h=0,d=0,g=0,y=0;c?y=-1*c.current[this.axis]:l[u]&&(y=l[u].pos||0),e=n?r?"right":"left":"top",r&&n&&(y*=-1);for(const m of f){const v=m.el;v?(e==="top"?(v.style.right="",v.style.left=""):v.style.top="",m.index!==h?v.style[e]=d===0?"":`${je(d,1e3)}px`:v.style[e]="",g+=m.dim+m.gap,h++):d+=m.dim+m.gap}if(i&&g&&o){let m=getComputedStyle(o),v="padding",w=n?"Right":"Bottom",N=parseFloat(m[v+(n?"Left":"Top")]);y-=N,s+=N,s+=parseFloat(m[v+w]);for(const S of f)S.el&&(je(S.pos)je(a-s)&&(S.el.style[e]=`${je(d+g,1e3)}px`),je(S.pos+S.gap)>=je(a-s)&&je(S.pos)>je(y+s)&&je(y)1&&(b=l[p[0]],_=l[p[1]]),b&&_){let m=0;for(const v of f)v.el?this.inTransition.has(v.index)&&b.slides.indexOf(v)<0&&(v.el.style[e]=`${je(m+(b.pos-_.pos),1e3)}px`):m+=v.dim+v.gap}}createSlideEl(e){const{track:n,slides:r}=this;if(!n||!e||e.el&&e.el.parentNode)return;const i=e.el||document.createElement("div");it(i,this.cn(Ay)),it(i,e.class),it(i,e.customClass);const o=e.html;o&&(o instanceof HTMLElement?i.appendChild(o):i.innerHTML=e.html+"");const s=[];r.forEach((f,c)=>{f.el&&s.push(c)});const a=e.index;let u=null;s.length&&(u=r[s.reduce((f,c)=>Math.abs(c-a)1)return!1;const c=e>a?1:-1,h=u[f].pos*(this.isRTL?1:-1);if(a===f&&Math.abs(h-l.target[this.axis])<1)return!1;this.clearTransitions();const d=l.isResting;it(this.container,this.cn("inTransition"));const g=((o=u[a])===null||o===void 0?void 0:o.slides[0])||null,y=((s=u[f])===null||s===void 0?void 0:s.slides[0])||null;this.inTransition.add(y.index),this.createSlideEl(y);let b=g.el,_=y.el;d||n===Ay||(n="fadeFast",b=null);const p=this.isRTL?"next":"prev",m=this.isRTL?"prev":"next";return b&&(this.inTransition.add(g.index),g.transition=n,b.addEventListener(Py,this.onAnimationEnd),b.classList.add(`f-${n}Out`,`to-${c>0?m:p}`)),_&&(y.transition=n,_.addEventListener(Py,this.onAnimationEnd),_.classList.add(`f-${n}In`,`from-${c>0?p:m}`)),l.current[this.axis]=h,l.target[this.axis]=h,l.requestTick(),this.onChange(f),!0}manageSlideVisiblity(){const e=new Set,n=new Set,r=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const i of this.slides)r.has(i)?e.add(i):n.add(i);for(const i of this.inTransition)e.add(this.slides[i]);for(const i of e)this.createSlideEl(i),this.lazyLoadSlide(i);for(const i of n)e.has(i)||this.removeSlideEl(i);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const e="aria-hidden";let n=this.cn(HN);if(n)for(const r of this.slides){const i=r.el;i&&(i.dataset.index=`${r.index}`,i.classList.contains("f-thumbs__slide")?this.getVisibleSlides(0).has(r)?i.removeAttribute(e):i.setAttribute(e,"true"):this.pages[this.page].slides.includes(r)?(i.classList.contains(n)||(it(i,n),this.emit("selectSlide",r)),i.removeAttribute(e)):(i.classList.contains(n)&&(jn(i,n),this.emit("unselectSlide",r)),i.setAttribute(e,"true")))}}flipInfiniteTrack(){const{axis:e,isHorizontal:n,isInfinite:r,isRTL:i,viewportDim:o,contentDim:s}=this,a=this.panzoom;if(!a||!r)return;let u=a.current[e],l=a.target[e]-u,f=0,c=.5*o;i&&n?(u<-c&&(f=-1,u+=s),u>s-c&&(f=1,u-=s)):(u>c&&(f=1,u-=s),u<-s+c&&(f=-1,u+=s)),f&&(a.current[e]=u,a.target[e]=u+l)}lazyLoadImg(e,n){const r=this,i="f-fadeIn",o="is-preloading";let s=!1,a=null;const u=()=>{s||(s=!0,a&&(a.remove(),a=null),jn(n,o),n.complete&&(it(n,i),setTimeout(()=>{jn(n,i)},350)),this.option("adaptiveHeight")&&e.el&&this.pages[this.page].slides.indexOf(e)>-1&&(r.updateMetrics(),r.setViewportHeight()),this.emit("load",e))};it(n,o),n.src=n.dataset.lazySrcset||n.dataset.lazySrc||"",delete n.dataset.lazySrc,delete n.dataset.lazySrcset,n.addEventListener("error",()=>{u()}),n.addEventListener("load",()=>{u()}),setTimeout(()=>{const l=n.parentNode;l&&e.el&&(n.complete?u():s||(a=Ga(X_),l.insertBefore(a,n)))},300)}lazyLoadSlide(e){const n=e&&e.el;if(!n)return;const r=new Set;let i=Array.from(n.querySelectorAll("[data-lazy-src],[data-lazy-srcset]"));n.dataset.lazySrc&&i.push(n),i.map(o=>{o instanceof HTMLImageElement?r.add(o):o instanceof HTMLElement&&o.dataset.lazySrc&&(o.style.backgroundImage=`url('${o.dataset.lazySrc}')`,delete o.dataset.lazySrc)});for(const o of r)this.lazyLoadImg(e,o)}onAnimationEnd(e){var n;const r=e.target,i=r?parseInt(r.dataset.index||"",10)||0:-1,o=this.slides[i],s=e.animationName;if(!r||!o||!s)return;const a=!!this.inTransition.has(i)&&o.transition;a&&s.substring(0,a.length+2)===`f-${a}`&&this.inTransition.delete(i),this.inTransition.size||this.clearTransitions(),i===this.page&&(!((n=this.panzoom)===null||n===void 0)&&n.isResting)&&this.emit("settle")}onDecel(e,n=0,r=0,i=0,o=0){if(this.option("dragFree"))return void this.setPageFromPosition();const{isRTL:s,isHorizontal:a,axis:u,pages:l}=this,f=l.length,c=Math.abs(Math.atan2(r,n)/(Math.PI/180));let h=0;if(h=c>45&&c<135?a?0:r:a?n:0,!f)return;let d=this.page,g=s&&a?1:-1;const y=e.current[u]*g;let{pageIndex:b}=this.getPageFromPosition(y);Math.abs(h)>5?(l[d].dim=e&&(this.page+=h.length),this.updateMetrics(),a){const d=((o=this.pages[this.page])===null||o===void 0?void 0:o.pos)||0,g=((s=this.pages[this.page])===null||s===void 0?void 0:s.dim)||0,y=this.pages.length||1,b=this.isRTL?l-g:g-l,_=this.isRTL?u-d:d-u;f&&y===1?(e<=this.page&&(a.current[this.axis]-=b,a.target[this.axis]-=b),a.panTo({[this.isHorizontal?"x":"y"]:-1*d})):_&&e<=this.page&&(a.target[this.axis]-=_,a.current[this.axis]-=_,a.requestTick())}for(const d of h)this.emit("initSlide",d,d.index)}prependSlide(e){this.addSlide(0,e)}appendSlide(e){this.addSlide(this.slides.length,e)}removeSlide(e){const n=this.slides.length;e=(e%n+n)%n;const r=this.slides[e];if(r){this.removeSlideEl(r,!0),this.slides.splice(e,1);for(let i=0;ithis.page?-1:1;let u=-1*o.current.e,l=je((u-a.pos)/(1*a.dim),1e3),f=l,c=l;this.isInfinite&&r!==!0&&(f=je((u-a.pos+s)/(1*a.dim),1e3),c=je((u-a.pos-s)/(1*a.dim),1e3));let h=[l,f,c].reduce(function(d,g){return Math.abs(g)1?1:h<-1?-1:h}setViewportHeight(){const{page:e,pages:n,viewport:r,isHorizontal:i}=this;if(!r||!n[e])return;let o=0;i&&this.track&&(this.track.style.height="auto",n[e].slides.forEach(s=>{s.el&&(o=Math.max(o,s.el.offsetHeight))})),r.style.height=o?`${o}px`:""}getPageForSlide(e){for(const n of this.pages)for(const r of n.slides)if(r.index===e)return n.index;return-1}getVisibleSlides(e=0){var n;const r=new Set;let{panzoom:i,contentDim:o,viewportDim:s,pages:a,page:u}=this;if(s){o=o+((n=this.slides[this.slides.length-1])===null||n===void 0?void 0:n.gap)||0;let l=0;l=i&&i.state!==Hn.Init&&i.state!==Hn.Destroy?-1*i.current[this.axis]:a[u]&&a[u].pos||0,this.isInfinite&&(l-=Math.floor(l/o)*o),this.isRTL&&this.isHorizontal&&(l*=-1);const f=l-s*e,c=l+s*(e+1),h=this.isInfinite?[-1,0,1]:[0];for(const d of this.slides)for(const g of h){const y=d.pos+g*o,b=y+d.dim+d.gap;yf&&r.add(d)}}return r}getPageFromPosition(e){const{viewportDim:n,contentDim:r,slides:i,pages:o,panzoom:s}=this,a=o.length,u=i.length,l=i[0],f=i[u-1],c=this.option("center");let h=0,d=0,g=0,y=e===void 0?-1*((s==null?void 0:s.target[this.axis])||0):e;c&&(y+=.5*n),this.isInfinite?(yf.pos+f.dim+.5*f.gap&&(y-=r,g=1)):y=Math.max(l.pos||0,Math.min(y,f.pos));let b=f,_=i.find(p=>{const m=p.pos-.5*b.gap,v=p.pos+p.dim+.5*p.gap;return b=p,y>=m&&y{this.removeSlideEl(u)}),this.detachPlugins(),n&&(n.removeEventListener("scroll",this.onScroll),n.offsetParent&&r&&r.offsetParent&&n.replaceWith(...r.childNodes));for(const[u,l]of Object.entries(s))u!=="container"&&l&&e.classList.remove(l);this.track=null,this.viewport=null,this.page=0,this.slides=[];const a=this.events.get("ready");this.events=new Map,a&&this.events.set("ready",a)}}Object.defineProperty($u,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:Vu}),Object.defineProperty($u,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:T8}),Object.defineProperty($u,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:k8});const GN=function(t){if(!$o(t))return 0;const e=window.scrollY,n=window.innerHeight,r=e+n,i=t.getBoundingClientRect(),o=i.y+e,s=i.height,a=o+s;if(e>a||ra||or)return 100;let u=s;or&&(u-=a-r);const l=u/n*100;return Math.round(l)},Cp=!(typeof window>"u"||!window.document||!window.document.createElement);let Q_;const eb=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden]):not(.fancybox-focus-guard)","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"]):not([disabled]):not([aria-hidden])'].join(","),YN=t=>{if(t&&Cp){Q_===void 0&&document.createElement("div").focus({get preventScroll(){return Q_=!0,!1}});try{if(Q_)t.focus({preventScroll:!0});else{const e=window.scrollY||document.body.scrollTop,n=window.scrollX||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:n,behavior:"auto"})}}catch{}}},WN=()=>{const t=document;let e,n="",r="",i="";return t.fullscreenEnabled?(n="requestFullscreen",r="exitFullscreen",i="fullscreenElement"):t.webkitFullscreenEnabled&&(n="webkitRequestFullscreen",r="webkitExitFullscreen",i="webkitFullscreenElement"),n&&(e={request:function(o=t.documentElement){return n==="webkitRequestFullscreen"?o[n](Element.ALLOW_KEYBOARD_INPUT):o[n]()},exit:function(){return t[i]&&t[r]()},isFullscreen:function(){return t[i]}}),e},tb={dragToClose:!0,hideScrollbar:!0,Carousel:{classes:{container:"fancybox__carousel",viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"}},contentClick:"toggleZoom",contentDblClick:!1,backdropClick:"close",animated:!0,idle:3500,showClass:"f-zoomInUp",hideClass:"f-fadeOut",commonCaption:!1,parentEl:null,startIndex:0,l10n:Object.assign(Object.assign({},DN),{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}),tpl:{closeButton:'',main:``},groupAll:!1,groupAttr:"data-fancybox",defaultType:"image",defaultDisplay:"block",autoFocus:!0,trapFocus:!0,placeFocusBack:!0,closeButton:"auto",keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"prev",ArrowDown:"next",ArrowRight:"next",ArrowLeft:"prev"},Fullscreen:{autoStart:!1},compact:()=>window.matchMedia("(max-width: 578px), (max-height: 578px)").matches,wheel:"zoom"};var ki,lo;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Closing=2]="Closing",t[t.CustomClosing=3]="CustomClosing",t[t.Destroy=4]="Destroy"})(ki||(ki={})),function(t){t[t.Loading=0]="Loading",t[t.Opening=1]="Opening",t[t.Ready=2]="Ready",t[t.Closing=3]="Closing"}(lo||(lo={}));let XN="",Np=!1,Ly=!1,Zc=null;const KN=()=>{let t="",e="";const n=Mn.getInstance();if(n){const r=n.carousel,i=n.getSlide();if(r&&i){let o=i.slug||void 0,s=i.triggerEl||void 0;e=o||n.option("slug")||"",!e&&s&&s.dataset&&(e=s.dataset.fancybox||""),e&&e!=="true"&&(t="#"+e+(!o&&r.slides.length>1?"-"+(i.index+1):""))}}return{hash:t,slug:e,index:1}},Dy=()=>{const t=new URL(document.URL).hash,e=t.slice(1).split("-"),n=e[e.length-1],r=n&&/^\+?\d+$/.test(n)&&parseInt(e.pop()||"1",10)||1;return{hash:t,slug:e.join("-"),index:r}},ZN=()=>{const{slug:t,index:e}=Dy();if(!t)return;let n=document.querySelector(`[data-slug="${t}"]`);if(n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),Mn.getInstance())return;const r=document.querySelectorAll(`[data-fancybox="${t}"]`);r.length&&(n=r[e-1],n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})))},JN=()=>{if(Mn.defaults.Hash===!1)return;const t=Mn.getInstance();if((t==null?void 0:t.options.Hash)===!1)return;const{slug:e,index:n}=Dy(),{slug:r}=KN();t&&(e===r?t.jumpTo(n-1):(Np=!0,t.close())),ZN()},QN=()=>{Zc&&clearTimeout(Zc),queueMicrotask(()=>{JN()})},eO=()=>{window.addEventListener("hashchange",QN,!1),setTimeout(()=>{JN()},500)};Cp&&(/complete|interactive|loaded/.test(document.readyState)?eO():document.addEventListener("DOMContentLoaded",eO));const Ry="is-zooming-in";class tO extends da{onCreateSlide(e,n,r){const i=this.instance.optionFor(r,"src")||"";r.el&&r.type==="image"&&typeof i=="string"&&this.setImage(r,i)}onRemoveSlide(e,n,r){r.panzoom&&r.panzoom.destroy(),r.panzoom=void 0,r.imageEl=void 0}onChange(e,n,r,i){jn(this.instance.container,Ry);for(const o of n.slides){const s=o.panzoom;s&&o.index!==r&&s.reset(.35)}}onClose(){var e;const n=this.instance,r=n.container,i=n.getSlide();if(!r||!r.parentElement||!i)return;const{el:o,contentEl:s,panzoom:a,thumbElSrc:u}=i;if(!o||!u||!s||!a||a.isContentLoading||a.state===Hn.Init||a.state===Hn.Destroy)return;a.updateMetrics();let l=this.getZoomInfo(i);if(!l)return;this.instance.state=ki.CustomClosing,r.classList.remove(Ry),r.classList.add("is-zooming-out"),s.style.backgroundImage=`url('${u}')`;const f=r.getBoundingClientRect();(((e=window.visualViewport)===null||e===void 0?void 0:e.scale)||1)===1&&Object.assign(r.style,{position:"absolute",top:`${r.offsetTop+window.scrollY}px`,left:`${r.offsetLeft+window.scrollX}px`,bottom:"auto",right:"auto",width:`${f.width}px`,height:`${f.height}px`,overflow:"hidden"});const{x:c,y:h,scale:d,opacity:g}=l;if(g){const y=((b,_,p,m)=>{const v=_-b,w=m-p;return N=>p+((N-b)/v*w||0)})(a.scale,d,1,0);a.on("afterTransform",()=>{s.style.opacity=y(a.scale)+""})}a.on("endAnimation",()=>{n.destroy()}),a.target.a=d,a.target.b=0,a.target.c=0,a.target.d=d,a.panTo({x:c,y:h,scale:d,friction:g?.2:.33,ignoreBounds:!0}),a.isResting&&n.destroy()}setImage(e,n){const r=this.instance;e.src=n,this.process(e,n).then(i=>{const{contentEl:o,imageEl:s,thumbElSrc:a,el:u}=e;if(r.isClosing()||!o||!s)return;o.offsetHeight;const l=!!r.isOpeningSlide(e)&&this.getZoomInfo(e);if(this.option("protected")&&u){u.addEventListener("contextmenu",h=>{h.preventDefault()});const c=document.createElement("div");it(c,"fancybox-protected"),o.appendChild(c)}if(a&&l){const c=i.contentRect,h=Math.max(c.fullWidth,c.fullHeight);let d=null;!l.opacity&&h>1200&&(d=document.createElement("img"),it(d,"fancybox-ghost"),d.src=a,o.appendChild(d));const g=()=>{d&&(it(d,"f-fadeFastOut"),setTimeout(()=>{d&&(d.remove(),d=null)},200))};(f=a,new Promise((y,b)=>{const _=new Image;_.onload=y,_.onerror=b,_.src=f})).then(()=>{r.hideLoading(e),e.state=lo.Opening,this.instance.emit("reveal",e),this.zoomIn(e).then(()=>{g(),this.instance.done(e)},()=>{}),d&&setTimeout(()=>{g()},h>2500?800:200)},()=>{r.hideLoading(e),r.revealContent(e)})}else{const c=this.optionFor(e,"initialSize"),h=this.optionFor(e,"zoom"),d={event:r.prevMouseMoveEvent||r.options.event,friction:h?.12:0};let g=r.optionFor(e,"showClass")||void 0,y=!0;r.isOpeningSlide(e)&&(c==="full"?i.zoomToFull(d):c==="cover"?i.zoomToCover(d):c==="max"?i.zoomToMax(d):y=!1,i.stop("current")),y&&g&&(g=i.isDragging?"f-fadeIn":""),r.hideLoading(e),r.revealContent(e,g)}var f},()=>{r.setError(e,"{{IMAGE_ERROR}}")})}process(e,n){return new Promise((r,i)=>{var o;const s=this.instance,a=e.el;s.clearContent(e),s.showLoading(e);let u=this.optionFor(e,"content");if(typeof u=="string"&&(u=Ga(u)),!u||!$o(u)){if(u=document.createElement("img"),u instanceof HTMLImageElement){let l="",f=e.caption;l=typeof f=="string"&&f?f.replace(/<[^>]+>/gi,"").substring(0,1e3):`Image ${e.index+1} of ${((o=s.carousel)===null||o===void 0?void 0:o.pages.length)||1}`,u.src=n||"",u.alt=l,u.draggable=!1,e.srcset&&u.setAttribute("srcset",e.srcset),this.instance.isOpeningSlide(e)&&(u.fetchPriority="high")}e.sizes&&u.setAttribute("sizes",e.sizes)}it(u,"fancybox-image"),e.imageEl=u,s.setContent(e,u,!1),e.panzoom=new Vu(a,Vo({transformParent:!0},this.option("Panzoom")||{},{content:u,width:s.optionFor(e,"width","auto"),height:s.optionFor(e,"height","auto"),wheel:()=>{const l=s.option("wheel");return(l==="zoom"||l=="pan")&&l},click:(l,f)=>{var c,h;if(s.isCompact||s.isClosing()||e.index!==((c=s.getSlide())===null||c===void 0?void 0:c.index))return!1;if(f){const g=f.composedPath()[0];if(["A","BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(g.nodeName))return!1}let d=!f||f.target&&((h=e.contentEl)===null||h===void 0?void 0:h.contains(f.target));return s.option(d?"contentClick":"backdropClick")||!1},dblClick:()=>s.isCompact?"toggleZoom":s.option("contentDblClick")||!1,spinner:!1,panOnlyZoomed:!0,wheelLimit:1/0,on:{ready:l=>{r(l)},error:()=>{i()},destroy:()=>{i()}}}))})}zoomIn(e){return new Promise((n,r)=>{const i=this.instance,o=i.container,{panzoom:s,contentEl:a,el:u}=e;s&&s.updateMetrics();const l=this.getZoomInfo(e);if(!(l&&u&&a&&s&&o))return void r();const{x:f,y:c,scale:h,opacity:d}=l,g=()=>{e.state!==lo.Closing&&(d&&(a.style.opacity=Math.max(Math.min(1,1-(1-s.scale)/(1-h)),0)+""),s.scale>=1&&s.scale>s.targetScale-.1&&n(s))},y=p=>{(p.scale<.99||p.scale>1.01)&&!p.isDragging||(jn(o,Ry),a.style.opacity="",p.off("endAnimation",y),p.off("touchStart",y),p.off("afterTransform",g),n(p))};s.on("endAnimation",y),s.on("touchStart",y),s.on("afterTransform",g),s.on(["error","destroy"],()=>{r()}),s.panTo({x:f,y:c,scale:h,friction:0,ignoreBounds:!0}),s.stop("current");const b={event:s.panMode==="mousemove"?i.prevMouseMoveEvent||i.options.event:void 0},_=this.optionFor(e,"initialSize");it(o,Ry),i.hideLoading(e),_==="full"?s.zoomToFull(b):_==="cover"?s.zoomToCover(b):_==="max"?s.zoomToMax(b):s.reset(.172)})}getZoomInfo(e){const{el:n,imageEl:r,thumbEl:i,panzoom:o}=e,s=this.instance,a=s.container;if(!n||!r||!i||!o||GN(i)<3||!this.optionFor(e,"zoom")||!a||s.state===ki.Destroy||getComputedStyle(a).getPropertyValue("--f-images-zoom")==="0")return!1;const u=window.visualViewport||null;if((u?u.scale:1)!==1)return!1;let{top:l,left:f,width:c,height:h}=i.getBoundingClientRect(),{top:d,left:g,fitWidth:y,fitHeight:b}=o.contentRect;if(!(c&&h&&y&&b))return!1;const _=o.container.getBoundingClientRect();g+=_.left,d+=_.top;const p=-1*(g+.5*y-(f+.5*c)),m=-1*(d+.5*b-(l+.5*h)),v=c/y;let w=this.option("zoomOpacity")||!1;return w==="auto"&&(w=Math.abs(c/h-y/b)>.1),{x:p,y:m,scale:v,opacity:w}}attach(){const e=this,n=e.instance;n.on("Carousel.change",e.onChange),n.on("Carousel.createSlide",e.onCreateSlide),n.on("Carousel.removeSlide",e.onRemoveSlide),n.on("close",e.onClose)}detach(){const e=this,n=e.instance;n.off("Carousel.change",e.onChange),n.off("Carousel.createSlide",e.onCreateSlide),n.off("Carousel.removeSlide",e.onRemoveSlide),n.off("close",e.onClose)}}Object.defineProperty(tO,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{initialSize:"fit",Panzoom:{maxScale:1},protected:!1,zoom:!0,zoomOpacity:"auto"}}),typeof SuppressedError=="function"&&SuppressedError;const nb="html",nO="image",rb="map",Hl="youtube",Jc="vimeo",Op="html5video",rO=(t,e={})=>{const n=new URL(t),r=new URLSearchParams(n.search),i=new URLSearchParams;for(const[a,u]of[...r,...Object.entries(e)]){let l=u+"";if(a==="t"){let f=l.match(/((\d*)m)?(\d*)s?/);f&&i.set("start",60*parseInt(f[2]||"0")+parseInt(f[3]||"0")+"")}else i.set(a,l)}let o=i+"",s=t.match(/#t=((.*)?\d+s)/);return s&&(o+=`#t=${s[1]}`),o},P8={ajax:null,autoSize:!0,iframeAttr:{allow:"autoplay; fullscreen",scrolling:"auto"},preload:!0,videoAutoplay:!0,videoRatio:16/9,videoTpl:``,videoFormat:"",vimeo:{byline:1,color:"00adef",controls:1,dnt:1,muted:0},youtube:{controls:1,enablejsapi:1,nocookie:1,rel:0,fs:1}},A8=["image","html","ajax","inline","clone","iframe","map","pdf","html5video","youtube","vimeo"];class iO extends da{onBeforeInitSlide(e,n,r){this.processType(r)}onCreateSlide(e,n,r){this.setContent(r)}onClearContent(e,n){n.xhr&&(n.xhr.abort(),n.xhr=null);const r=n.iframeEl;r&&(r.onload=r.onerror=null,r.src="//about:blank",n.iframeEl=null);const i=n.contentEl,o=n.placeholderEl;if(n.type==="inline"&&i&&o)i.classList.remove("fancybox__content"),i.style.display!=="none"&&(i.style.display="none"),o.parentNode&&o.parentNode.insertBefore(i,o),o.remove(),n.contentEl=void 0,n.placeholderEl=void 0;else for(;n.el&&n.el.firstChild;)n.el.removeChild(n.el.firstChild)}onSelectSlide(e,n,r){r.state===lo.Ready&&this.playVideo()}onUnselectSlide(e,n,r){var i,o;if(r.type===Op){try{(o=(i=r.el)===null||i===void 0?void 0:i.querySelector("video"))===null||o===void 0||o.pause()}catch{}return}let s;r.type===Jc?s={method:"pause",value:"true"}:r.type===Hl&&(s={event:"command",func:"pauseVideo"}),s&&r.iframeEl&&r.iframeEl.contentWindow&&r.iframeEl.contentWindow.postMessage(JSON.stringify(s),"*"),r.poller&&clearTimeout(r.poller)}onDone(e,n){e.isCurrentSlide(n)&&!e.isClosing()&&this.playVideo()}onRefresh(e,n){n.slides.forEach(r=>{r.el&&(this.resizeIframe(r),this.setAspectRatio(r))})}onMessage(e){try{let n=JSON.parse(e.data);if(e.origin==="https://player.vimeo.com"){if(n.event==="ready")for(let r of Array.from(document.getElementsByClassName("fancybox__iframe")))r instanceof HTMLIFrameElement&&r.contentWindow===e.source&&(r.dataset.ready="true")}else if(e.origin.match(/^https:\/\/(www.)?youtube(-nocookie)?.com$/)&&n.event==="onReady"){const r=document.getElementById(n.id);r&&(r.dataset.ready="true")}}catch{}}loadAjaxContent(e){const n=this.instance.optionFor(e,"src")||"";this.instance.showLoading(e);const r=this.instance,i=new XMLHttpRequest;r.showLoading(e),i.onreadystatechange=function(){i.readyState===XMLHttpRequest.DONE&&r.state===ki.Ready&&(r.hideLoading(e),i.status===200?r.setContent(e,i.responseText):r.setError(e,i.status===404?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};const o=e.ajax||null;i.open(o?"POST":"GET",n+""),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.send(o),e.xhr=i}setInlineContent(e){let n=null;if($o(e.src))n=e.src;else if(typeof e.src=="string"){const r=e.src.split("#",2).pop();n=r?document.getElementById(r):null}if(n){if(e.type==="clone"||n.closest(".fancybox__slide")){n=n.cloneNode(!0);const r=n.dataset.animationName;r&&(n.classList.remove(r),delete n.dataset.animationName);let i=n.getAttribute("id");i=i?`${i}--clone`:`clone-${this.instance.id}-${e.index}`,n.setAttribute("id",i)}else if(n.parentNode){const r=document.createElement("div");r.classList.add("fancybox-placeholder"),n.parentNode.insertBefore(r,n),e.placeholderEl=r}this.instance.setContent(e,n)}else this.instance.setError(e,"{{ELEMENT_NOT_FOUND}}")}setIframeContent(e){const{src:n,el:r}=e;if(!n||typeof n!="string"||!r)return;r.classList.add("is-loading");const i=this.instance,o=document.createElement("iframe");o.className="fancybox__iframe",o.setAttribute("id",`fancybox__iframe_${i.id}_${e.index}`);for(const[a,u]of Object.entries(this.optionFor(e,"iframeAttr")||{}))o.setAttribute(a,u);o.onerror=()=>{i.setError(e,"{{IFRAME_ERROR}}")},e.iframeEl=o;const s=this.optionFor(e,"preload");if(e.type!=="iframe"||s===!1)return o.setAttribute("src",e.src+""),i.setContent(e,o,!1),this.resizeIframe(e),void i.revealContent(e);i.showLoading(e),o.onload=()=>{if(!o.src.length)return;const a=o.dataset.ready!=="true";o.dataset.ready="true",this.resizeIframe(e),a?i.revealContent(e):i.hideLoading(e)},o.setAttribute("src",n),i.setContent(e,o,!1)}resizeIframe(e){const{type:n,iframeEl:r}=e;if(n===Hl||n===Jc)return;const i=r==null?void 0:r.parentElement;if(!r||!i)return;let o=e.autoSize;o===void 0&&(o=this.optionFor(e,"autoSize"));let s=e.width||0,a=e.height||0;s&&a&&(o=!1);const u=i&&i.style;if(e.preload!==!1&&o!==!1&&u)try{const l=window.getComputedStyle(i),f=parseFloat(l.paddingLeft)+parseFloat(l.paddingRight),c=parseFloat(l.paddingTop)+parseFloat(l.paddingBottom),h=r.contentWindow;if(h){const d=h.document,g=d.getElementsByTagName(nb)[0],y=d.body;u.width="",y.style.overflow="hidden",s=s||g.scrollWidth+f,u.width=`${s}px`,y.style.overflow="",u.flex="0 0 auto",u.height=`${y.scrollHeight}px`,a=g.scrollHeight+c}}catch{}if(s||a){const l={flex:"0 1 auto",width:"",height:""};s&&s!=="auto"&&(l.width=`${s}px`),a&&a!=="auto"&&(l.height=`${a}px`),Object.assign(u,l)}}playVideo(){const e=this.instance.getSlide();if(!e)return;const{el:n}=e;if(!n||!n.offsetParent||!this.optionFor(e,"videoAutoplay"))return;if(e.type===Op)try{const i=n.querySelector("video");if(i){const o=i.play();o!==void 0&&o.then(()=>{}).catch(s=>{i.muted=!0,i.play()})}}catch{}if(e.type!==Hl&&e.type!==Jc)return;const r=()=>{if(e.iframeEl&&e.iframeEl.contentWindow){let i;if(e.iframeEl.dataset.ready==="true")return i=e.type===Hl?{event:"command",func:"playVideo"}:{method:"play",value:"true"},i&&e.iframeEl.contentWindow.postMessage(JSON.stringify(i),"*"),void(e.poller=void 0);e.type===Hl&&(i={event:"listening",id:e.iframeEl.getAttribute("id")},e.iframeEl.contentWindow.postMessage(JSON.stringify(i),"*"))}e.poller=setTimeout(r,250)};r()}processType(e){if(e.html)return e.type=nb,e.src=e.html,void(e.html="");const n=this.instance.optionFor(e,"src","");if(!n||typeof n!="string")return;let r=e.type,i=null;if(i=n.match(/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|shorts\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){const o=this.optionFor(e,Hl),{nocookie:s}=o,a=function(c,h){var d={};for(var g in c)Object.prototype.hasOwnProperty.call(c,g)&&h.indexOf(g)<0&&(d[g]=c[g]);if(c!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(g=Object.getOwnPropertySymbols(c);y0?"svembed":"embed"}`,r=rb):(i=n.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(e.src=`https://maps.google.${i[1]}/maps?q=${i[2].replace("query=","q=").replace("api=1","")}&output=embed`,r=rb),r=r||this.instance.option("defaultType"),e.type=r,r===nO&&(e.thumbSrc=e.thumbSrc||e.src)}setContent(e){const n=this.instance.optionFor(e,"src")||"";if(e&&e.type&&n){switch(e.type){case nb:this.instance.setContent(e,n);break;case Op:const r=this.option("videoTpl");r&&this.instance.setContent(e,r.replace(/\{\{src\}\}/gi,n+"").replace(/\{\{format\}\}/gi,this.optionFor(e,"videoFormat")||"").replace(/\{\{poster\}\}/gi,e.poster||e.thumbSrc||""));break;case"inline":case"clone":this.setInlineContent(e);break;case"ajax":this.loadAjaxContent(e);break;case"pdf":case rb:case Hl:case Jc:e.preload=!1;case"iframe":this.setIframeContent(e)}this.setAspectRatio(e)}}setAspectRatio(e){const n=e.contentEl;if(!(e.el&&n&&e.type&&[Hl,Jc,Op].includes(e.type)))return;let r,i=e.width||"auto",o=e.height||"auto";if(i==="auto"||o==="auto"){r=this.optionFor(e,"videoRatio");const l=(r+"").match(/(\d+)\s*\/\s?(\d+)/);r=l&&l.length>2?parseFloat(l[1])/parseFloat(l[2]):parseFloat(r+"")}else i&&o&&(r=i/o);if(!r)return;n.style.aspectRatio="",n.style.width="",n.style.height="",n.offsetHeight;const s=n.getBoundingClientRect(),a=s.width||1,u=s.height||1;n.style.aspectRatio=r+"",r{e.timer=null,e.inHover||e.onTimerEnd()},r),e.emit("set")}clear(){const e=this;e.timer&&(clearTimeout(e.timer),e.timer=null),e.removeProgressBar()}start(){const e=this;if(e.set(),e.state!==Tp){if(e.option("pauseOnHover")){const n=e.instance.container;n.addEventListener("mouseenter",e.onMouseEnter,!1),n.addEventListener("mouseleave",e.onMouseLeave,!1)}document.addEventListener("visibilitychange",e.onVisibilityChange,!1),e.emit("start")}}stop(){const e=this,n=e.state,r=e.instance.container;e.clear(),e.state=Tp,r.removeEventListener("mouseenter",e.onMouseEnter,!1),r.removeEventListener("mouseleave",e.onMouseLeave,!1),document.removeEventListener("visibilitychange",e.onVisibilityChange,!1),jn(r,"has-autoplay"),n!==Tp&&e.emit("stop")}pause(){const e=this;e.state===Fy&&(e.state=By,e.clear(),e.emit(By))}resume(){const e=this,n=e.instance;if(n.isInfinite||n.page!==n.pages.length-1)if(e.state!==Fy){if(e.state===By&&!e.inHover){const r=new Event("resume",{bubbles:!0,cancelable:!0});e.emit("resume",r),r.defaultPrevented||e.set()}}else e.set();else e.stop()}toggle(){this.state===Fy||this.state===By?this.stop():this.start()}attach(){const e=this,n=e.instance;n.on("ready",e.onReady),n.on("Panzoom.startAnimation",e.onChange),n.on("Panzoom.endAnimation",e.onSettle),n.on("Panzoom.touchMove",e.onChange)}detach(){const e=this,n=e.instance;n.off("ready",e.onReady),n.off("Panzoom.startAnimation",e.onChange),n.off("Panzoom.endAnimation",e.onSettle),n.off("Panzoom.touchMove",e.onChange),e.stop()}}Object.defineProperty(oO,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});class sO extends da{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null})}onPrepare(e){const n=e.carousel;if(!n)return;const r=e.container;r&&(n.options.Autoplay=Vo({autoStart:!1},this.option("Autoplay")||{},{pauseOnHover:!1,timeout:this.option("timeout"),progressParentEl:()=>this.option("progressParentEl")||null,on:{start:()=>{e.emit("startSlideshow")},set:i=>{var o;r.classList.add("has-slideshow"),((o=e.getSlide())===null||o===void 0?void 0:o.state)!==lo.Ready&&i.pause()},stop:()=>{r.classList.remove("has-slideshow"),e.isCompact||e.endIdle(),e.emit("endSlideshow")},resume:(i,o)=>{var s,a,u;!o||!o.cancelable||((s=e.getSlide())===null||s===void 0?void 0:s.state)===lo.Ready&&(!((u=(a=e.carousel)===null||a===void 0?void 0:a.panzoom)===null||u===void 0)&&u.isResting)||o.preventDefault()}}}),n.attachPlugins({Autoplay:oO}),this.ref=n.plugins.Autoplay)}onReady(e){const n=e.carousel,r=this.ref;r&&n&&this.option("playOnStart")&&(n.isInfinite||n.page{e.isCurrentSlide(n)&&r.stop()}),e.isCurrentSlide(n)&&r.resume()}onKeydown(e,n){var r;const i=this.ref;i&&n===this.option("key")&&((r=document.activeElement)===null||r===void 0?void 0:r.nodeName)!=="BUTTON"&&i.toggle()}attach(){const e=this,n=e.instance;n.on("Carousel.init",e.onPrepare),n.on("Carousel.ready",e.onReady),n.on("done",e.onDone),n.on("keydown",e.onKeydown)}detach(){const e=this,n=e.instance;n.off("Carousel.init",e.onPrepare),n.off("Carousel.ready",e.onReady),n.off("done",e.onDone),n.off("keydown",e.onKeydown)}}Object.defineProperty(sO,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{key:" ",playOnStart:!1,progressParentEl:t=>{var e;return((e=t.instance.container)===null||e===void 0?void 0:e.querySelector(".fancybox__toolbar [data-fancybox-toggle-slideshow]"))||t.instance.container},timeout:3e3}});const aO={classes:{container:"f-thumbs f-carousel__thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide",isResting:"is-resting",isSelected:"is-selected",isLoading:"is-loading",hasThumbs:"has-thumbs"},minCount:2,parentEl:null,thumbTpl:'',type:"modern"};var Gl;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden"})(Gl||(Gl={}));const lO="isResting",Vy="thumbWidth",Lh="thumbHeight",Wa="thumbClipWidth";let uO=class extends da{constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Gl.Init})}get isModern(){return this.type==="modern"}onInitSlide(t,e){const n=e.el?e.el.dataset:void 0;n&&(e.thumbSrc=n.thumbSrc||e.thumbSrc||"",e[Wa]=parseFloat(n[Wa]||"")||e[Wa]||0,e[Lh]=parseFloat(n.thumbHeight||"")||e[Lh]||0),this.addSlide(e)}onInitSlides(){this.build()}onChange(){var t;if(!this.isModern)return;const e=this.container,n=this.instance,r=n.panzoom,i=this.carousel,o=i?i.panzoom:null,s=n.page;if(r&&i&&o){if(r.isDragging){jn(e,this.cn(lO));let a=((t=i.pages[s])===null||t===void 0?void 0:t.pos)||0;a+=n.getProgress(s)*(this[Wa]+this.thumbGap);let u=o.getBounds();-1*a>u.x.min&&-1*aparseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-"+n))||0;this.thumbGap=e("gap"),this.thumbExtraGap=e("extra-gap"),this[Vy]=e("width")||40,this[Wa]=e("clip-width")||40,this[Lh]=e("height")||40}build(){const t=this;if(t.state!==Gl.Init)return;if(t.isDisabled())return void t.emit("disabled");const e=t.instance,n=e.container,r=t.getSlides(),i=t.option("type");t.type=i;const o=t.option("parentEl"),s=t.cn("container"),a=t.cn("track");let u=o==null?void 0:o.querySelector("."+s);u||(u=document.createElement("div"),it(u,s),o?o.appendChild(u):n.after(u)),it(u,`is-${i}`),it(n,t.cn("hasThumbs")),t.container=u,t.updateProps();let l=u.querySelector("."+a);l||(l=document.createElement("div"),it(l,t.cn("track")),u.appendChild(l)),t.track=l;const f=Vo({},{track:l,infinite:!1,center:!0,fill:i==="classic",dragFree:!0,slidesPerPage:1,transition:!1,preload:.25,friction:.12,Panzoom:{maxVelocity:0},Dots:!1,Navigation:!1,classes:{container:"f-thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide"}},t.option("Carousel")||{},{Sync:{target:e},slides:r}),c=new e.constructor(u,f);c.on("createSlide",(h,d)=>{t.setProps(d.index),t.emit("createSlide",d,d.el)}),c.on("ready",()=>{t.shiftModern(),t.emit("ready")}),c.on("refresh",()=>{t.shiftModern()}),c.on("Panzoom.click",(h,d,g)=>{t.onClick(g)}),t.carousel=c,t.state=Gl.Ready}onClick(t){t.preventDefault(),t.stopPropagation();const e=this.instance,{pages:n,page:r}=e,i=y=>{if(y){const b=y.closest("[data-carousel-index]");if(b)return[parseInt(b.dataset.carouselIndex||"",10)||0,b]}return[-1,void 0]},o=(y,b)=>{const _=document.elementFromPoint(y,b);return _?i(_):[-1,void 0]};let[s,a]=i(t.target);if(s>-1)return;const u=this[Wa],l=t.clientX,f=t.clientY;let[c,h]=o(l-u,f),[d,g]=o(l+u,f);h&&g?(s=Math.abs(l-h.getBoundingClientRect().right)-1&&n[s]&&e.slideTo(s)}getShift(t){var e;const n=this,{instance:r}=n,i=n.carousel;if(!r||!i)return 0;const o=n[Vy],s=n[Wa],a=n.thumbGap,u=n.thumbExtraGap;if(!(!((e=i.slides[t])===null||e===void 0)&&e.el))return 0;const l=.5*(o-s),f=r.pages.length-1;let c=r.getProgress(0),h=r.getProgress(f),d=r.getProgress(t,!1,!0),g=0,y=l+u+a;const b=c<0&&c>-1,_=h>0&&h<1;return t===0?(g=y*Math.abs(c),_&&c===1&&(g-=y*Math.abs(h))):t===f?(g=y*Math.abs(h)*-1,b&&h===-1&&(g+=y*Math.abs(c))):b||_?(g=-1*y,g+=y*Math.abs(c),g+=y*(1-Math.abs(h))):g=y*d,g}setProps(t){var e;const n=this;if(!n.isModern)return;const{instance:r}=n,i=n.carousel;if(r&&i){const o=(e=i.slides[t])===null||e===void 0?void 0:e.el;if(o&&o.childNodes.length){let s=je(1-Math.abs(r.getProgress(t))),a=je(n.getShift(t));o.style.setProperty("--progress",s?s+"":""),o.style.setProperty("--shift",a+"")}}}shiftModern(){const t=this;if(!t.isModern)return;const{instance:e,track:n}=t,r=e.panzoom,i=t.carousel;if(!(e&&n&&r&&i)||r.state===Hn.Init||r.state===Hn.Destroy)return;for(const s of e.slides)t.setProps(s.index);let o=(t[Wa]+t.thumbGap)*(i.slides.length||0);n.style.setProperty("--width",o+"")}cleanup(){const t=this;t.carousel&&t.carousel.destroy(),t.carousel=null,t.container&&t.container.remove(),t.container=null,t.track&&t.track.remove(),t.track=null,t.state=Gl.Init,jn(t.instance.container,t.cn("hasThumbs"))}attach(){const t=this,e=t.instance;e.on("initSlide",t.onInitSlide),e.state===ni.Init?e.on("initSlides",t.onInitSlides):t.onInitSlides(),e.on(["change","Panzoom.afterTransform"],t.onChange),e.on("Panzoom.refresh",t.onRefresh)}detach(){const t=this,e=t.instance;e.off("initSlide",t.onInitSlide),e.off("initSlides",t.onInitSlides),e.off(["change","Panzoom.afterTransform"],t.onChange),e.off("Panzoom.refresh",t.onRefresh),t.cleanup()}};Object.defineProperty(uO,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:aO});const L8=Object.assign(Object.assign({},aO),{key:"t",showOnStart:!0,parentEl:null}),cO="is-masked",fO="aria-hidden";class hO extends da{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hidden",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get isEnabled(){const e=this.ref;return e&&!e.isDisabled()}get isHidden(){return this.hidden}onClick(e,n){n.stopPropagation()}onCreateSlide(e,n){var r,i,o;const s=((o=(i=(r=this.instance)===null||r===void 0?void 0:r.carousel)===null||i===void 0?void 0:i.slides[n.index])===null||o===void 0?void 0:o.type)||"",a=n.el;if(a&&s){let u=`for-${s}`;["video","youtube","vimeo","html5video"].includes(s)&&(u+=" for-video"),it(a,u)}}onInit(){var e;const n=this,r=n.instance,i=r.carousel;if(n.ref||!i)return;const o=n.option("parentEl")||r.footer||r.container;if(!o)return;const s=Vo({},n.options,{parentEl:o,classes:{container:"f-thumbs fancybox__thumbs"},Carousel:{Sync:{friction:r.option("Carousel.friction")||0}},on:{ready:a=>{const u=a.container;u&&this.hidden&&(n.refresh(),u.style.transition="none",n.hide(),u.offsetHeight,queueMicrotask(()=>{u.style.transition="",n.show()}))}}});s.Carousel=s.Carousel||{},s.Carousel.on=Vo(((e=n.options.Carousel)===null||e===void 0?void 0:e.on)||{},{click:this.onClick,createSlide:this.onCreateSlide}),i.options.Thumbs=s,i.attachPlugins({Thumbs:uO}),n.ref=i.plugins.Thumbs,n.option("showOnStart")||(n.ref.state=Gl.Hidden,n.hidden=!0)}onResize(){var e;const n=(e=this.ref)===null||e===void 0?void 0:e.container;n&&(n.style.maxHeight="")}onKeydown(e,n){const r=this.option("key");r&&r===n&&this.toggle()}toggle(){const e=this.ref;if(e&&!e.isDisabled())return e.state===Gl.Hidden?(e.state=Gl.Init,void e.build()):void(this.hidden?this.show():this.hide())}show(){const e=this.ref;if(!e||e.isDisabled())return;const n=e.container;n&&(this.refresh(),n.offsetHeight,n.removeAttribute(fO),n.classList.remove(cO),this.hidden=!1)}hide(){const e=this.ref,n=e&&e.container;n&&(this.refresh(),n.offsetHeight,n.classList.add(cO),n.setAttribute(fO,"true")),this.hidden=!0}refresh(){const e=this.ref;if(!e||!e.state)return;const n=e.container,r=(n==null?void 0:n.firstChild)||null;n&&r&&r.childNodes.length&&(n.style.maxHeight=`${r.getBoundingClientRect().height}px`)}attach(){const e=this,n=e.instance;n.state===ki.Init?n.on("Carousel.init",e.onInit):e.onInit(),n.on("resize",e.onResize),n.on("keydown",e.onKeydown)}detach(){var e;const n=this,r=n.instance;r.off("Carousel.init",n.onInit),r.off("resize",n.onResize),r.off("keydown",n.onKeydown),(e=r.carousel)===null||e===void 0||e.detachPlugins(["Thumbs"]),n.ref=null}}Object.defineProperty(hO,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:L8});const ib={panLeft:{icon:'',change:{panX:-100}},panRight:{icon:'',change:{panX:100}},panUp:{icon:'',change:{panY:-100}},panDown:{icon:'',change:{panY:100}},zoomIn:{icon:'',action:"zoomIn"},zoomOut:{icon:'',action:"zoomOut"},toggle1to1:{icon:'',action:"toggleZoom"},toggleZoom:{icon:'',action:"toggleZoom"},iterateZoom:{icon:'',action:"iterateZoom"},rotateCCW:{icon:'',action:"rotateCCW"},rotateCW:{icon:'',action:"rotateCW"},flipX:{icon:'',action:"flipX"},flipY:{icon:'',action:"flipY"},fitX:{icon:'',action:"fitX"},fitY:{icon:'',action:"fitY"},reset:{icon:'',action:"reset"},toggleFS:{icon:'',action:"toggleFS"}};var Qc;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Disabled=2]="Disabled"})(Qc||(Qc={}));const D8={absolute:"auto",display:{left:["infobar"],middle:[],right:["iterateZoom","slideshow","fullscreen","thumbs","close"]},enabled:"auto",items:{infobar:{tpl:'
/
'},download:{tpl:'
'},prev:{tpl:''},next:{tpl:''},slideshow:{tpl:''},fullscreen:{tpl:''},thumbs:{tpl:''},close:{tpl:''}},parentEl:null},R8={tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},dO="has-toolbar",ob="fancybox__toolbar";class pO extends da{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Qc.Init}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}onReady(e){var n;if(!e.carousel)return;let r=this.option("display"),i=this.option("absolute"),o=this.option("enabled");if(o==="auto"){const l=this.instance.carousel;let f=0;if(l)for(const c of l.slides)(c.panzoom||c.type==="image")&&f++;f||(o=!1)}o||(r=void 0);let s=0;const a={left:[],middle:[],right:[]};if(r)for(const l of["left","middle","right"])for(const f of r[l]){const c=this.createEl(f);c&&((n=a[l])===null||n===void 0||n.push(c),s++)}let u=null;if(s&&(u=this.createContainer()),u){for(const[l,f]of Object.entries(a)){const c=document.createElement("div");it(c,ob+"__column is-"+l);for(const h of f)c.appendChild(h);i!=="auto"||l!=="middle"||f.length||(i=!0),u.appendChild(c)}i===!0&&it(u,"is-absolute"),this.state=Qc.Ready,this.onRefresh()}else this.state=Qc.Disabled}onClick(e){var n,r;const i=this.instance,o=i.getSlide(),s=o==null?void 0:o.panzoom,a=e.target,u=a&&$o(a)?a.dataset:null;if(!u)return;if(u.fancyboxToggleThumbs!==void 0)return e.preventDefault(),e.stopPropagation(),void((n=i.plugins.Thumbs)===null||n===void 0||n.toggle());if(u.fancyboxToggleFullscreen!==void 0)return e.preventDefault(),e.stopPropagation(),void this.instance.toggleFullscreen();if(u.fancyboxToggleSlideshow!==void 0){e.preventDefault(),e.stopPropagation();const c=(r=i.carousel)===null||r===void 0?void 0:r.plugins.Autoplay;let h=c.isActive;return s&&s.panMode==="mousemove"&&!h&&s.reset(),void(h?c.stop():c.start())}const l=u.panzoomAction,f=u.panzoomChange;if((f||l)&&(e.preventDefault(),e.stopPropagation()),f){let c={};try{c=JSON.parse(f)}catch{}s&&s.applyChange(c)}else l&&s&&s[l]&&s[l]()}onChange(){this.onRefresh()}onRefresh(){if(this.instance.isClosing())return;const e=this.container;if(!e)return;const n=this.instance.getSlide();if(!n||n.state!==lo.Ready)return;const r=n&&!n.error&&n.panzoom;for(const s of e.querySelectorAll("[data-panzoom-action]"))r?(s.removeAttribute("disabled"),s.removeAttribute("tabindex")):(s.setAttribute("disabled",""),s.setAttribute("tabindex","-1"));let i=r&&r.canZoomIn(),o=r&&r.canZoomOut();for(const s of e.querySelectorAll('[data-panzoom-action="zoomIn"]'))i?(s.removeAttribute("disabled"),s.removeAttribute("tabindex")):(s.setAttribute("disabled",""),s.setAttribute("tabindex","-1"));for(const s of e.querySelectorAll('[data-panzoom-action="zoomOut"]'))o?(s.removeAttribute("disabled"),s.removeAttribute("tabindex")):(s.setAttribute("disabled",""),s.setAttribute("tabindex","-1"));for(const s of e.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){o||i?(s.removeAttribute("disabled"),s.removeAttribute("tabindex")):(s.setAttribute("disabled",""),s.setAttribute("tabindex","-1"));const a=s.querySelector("g");a&&(a.style.display=i?"":"none")}}onDone(e,n){var r;(r=n.panzoom)===null||r===void 0||r.on("afterTransform",()=>{this.instance.isCurrentSlide(n)&&this.onRefresh()}),this.instance.isCurrentSlide(n)&&this.onRefresh()}createContainer(){const e=this.instance.container;if(!e)return null;const n=this.option("parentEl")||e;let r=n.querySelector("."+ob);return r||(r=document.createElement("div"),it(r,ob),n.prepend(r)),r.addEventListener("click",this.onClick,{passive:!1,capture:!0}),e&&it(e,dO),this.container=r,r}createEl(e){const n=this.instance,r=n.carousel;if(!r||e==="toggleFS"||e==="fullscreen"&&!WN())return null;let i=null;const o=r.slides.length||0;let s=0,a=0;for(const l of r.slides)(l.panzoom||l.type==="image")&&s++,(l.type==="image"||l.downloadSrc)&&a++;if(o<2&&["infobar","prev","next"].includes(e))return i;if(ib[e]!==void 0&&!s||e==="download"&&!a)return null;if(e==="thumbs"){const l=n.plugins.Thumbs;if(!l||!l.isEnabled)return null}if(e==="slideshow"&&(!r.plugins.Autoplay||o<2))return null;if(ib[e]!==void 0){const l=ib[e];i=document.createElement("button"),i.setAttribute("title",this.instance.localize(`{{${e.toUpperCase()}}}`)),it(i,"f-button"),l.action&&(i.dataset.panzoomAction=l.action),l.change&&(i.dataset.panzoomChange=JSON.stringify(l.change)),i.appendChild(Ga(this.instance.localize(l.icon)))}else{const l=(this.option("items")||[])[e];l&&(i=Ga(this.instance.localize(l.tpl)),typeof l.click=="function"&&i.addEventListener("click",f=>{f.preventDefault(),f.stopPropagation(),typeof l.click=="function"&&l.click.call(this,this,f)}))}const u=i==null?void 0:i.querySelector("svg");if(u)for(const[l,f]of Object.entries(R8))u.getAttribute(l)||u.setAttribute(l,String(f));return i}removeContainer(){const e=this.container;e&&e.remove(),this.container=null,this.state=Qc.Disabled;const n=this.instance.container;n&&jn(n,dO)}attach(){const e=this,n=e.instance;n.on("Carousel.initSlides",e.onReady),n.on("done",e.onDone),n.on(["reveal","Carousel.change"],e.onChange),e.onReady(e.instance)}detach(){const e=this,n=e.instance;n.off("Carousel.initSlides",e.onReady),n.off("done",e.onDone),n.off(["reveal","Carousel.change"],e.onChange),e.removeContainer()}}Object.defineProperty(pO,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:D8});const F8={Hash:class extends da{onReady(){Np=!1}onChange(t){Zc&&clearTimeout(Zc);const{hash:e}=KN(),{hash:n}=Dy(),r=t.isOpeningSlide(t.getSlide());r&&(XN=n===e?"":n),e&&e!==n&&(Zc=setTimeout(()=>{try{if(t.state===ki.Ready){let i="replaceState";r&&!Ly&&(i="pushState",Ly=!0),window.history[i]({},document.title,window.location.pathname+window.location.search+e)}}catch{}},300))}onClose(t){if(Zc&&clearTimeout(Zc),!Np&&Ly)return Ly=!1,Np=!1,void window.history.back();if(!Np)try{window.history.replaceState({},document.title,window.location.pathname+window.location.search+(XN||""))}catch{}}attach(){const t=this.instance;t.on("ready",this.onReady),t.on(["Carousel.ready","Carousel.change"],this.onChange),t.on("close",this.onClose)}detach(){const t=this.instance;t.off("ready",this.onReady),t.off(["Carousel.ready","Carousel.change"],this.onChange),t.off("close",this.onClose)}static parseURL(){return Dy()}static startFromUrl(){ZN()}static destroy(){window.removeEventListener("hashchange",QN,!1)}},Html:iO,Images:tO,Slideshow:sO,Thumbs:hO,Toolbar:pO},gO="with-fancybox",sb="hide-scrollbar",mO="--fancybox-scrollbar-compensate",yO="--fancybox-body-margin",ab="aria-hidden",lb="is-using-tab",ub="is-animated",vO="is-compact",_O="is-loading",cb="is-opening",$y="has-caption",Dh="disabled",ef="tabindex",bO="download",fb="href",Rh="src",ju=t=>typeof t=="string",EO=function(){var t=window.getSelection();return!!t&&t.type==="Range"};let Ps,As=null,tf=null,wO=0,xO=0;const Ip=new Map;let B8=0;class Mn extends W_{get isIdle(){return this.idle}get isCompact(){return this.option("compact")}constructor(e=[],n={},r={}){super(n),Object.defineProperty(this,"userSlides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"idle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"idleTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pwt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreFocusChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"startedFs",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:ki.Init}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"lastFocus",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Ps||(Ps=WN()),this.id=n.id||++B8,Ip.set(this.id,this),this.userSlides=e,this.userPlugins=r,queueMicrotask(()=>{this.init()})}init(){if(this.state===ki.Destroy)return;this.state=ki.Init,this.attachPlugins(Object.assign(Object.assign({},Mn.Plugins),this.userPlugins)),this.emit("init"),this.emit("attachPlugins"),this.option("hideScrollbar")===!0&&(()=>{if(!Cp)return;const n=document,r=n.body,i=n.documentElement;if(r.classList.contains(sb))return;let o=window.innerWidth-i.getBoundingClientRect().width;const s=parseFloat(window.getComputedStyle(r).marginRight);o<0&&(o=0),i.style.setProperty(mO,`${o}px`),s&&r.style.setProperty(yO,`${s}px`),r.classList.add(sb)})(),this.initLayout(),this.scale();const e=()=>{this.initCarousel(this.userSlides),this.state=ki.Ready,this.attachEvents(),this.emit("ready"),setTimeout(()=>{this.container&&this.container.setAttribute(ab,"false")},16)};this.option("Fullscreen.autoStart")&&Ps&&!Ps.isFullscreen()?Ps.request().then(()=>{this.startedFs=!0,e()}).catch(()=>e()):e()}initLayout(){var e,n;const r=this.option("parentEl")||document.body,i=Ga(this.localize(this.option("tpl.main")||""));i&&(i.setAttribute("id",`fancybox-${this.id}`),i.setAttribute("aria-label",this.localize("{{MODAL}}")),i.classList.toggle(vO,this.isCompact),it(i,this.option("mainClass")||""),it(i,cb),this.container=i,this.footer=i.querySelector(".fancybox__footer"),r.appendChild(i),it(document.documentElement,gO),As&&tf||(As=document.createElement("span"),it(As,"fancybox-focus-guard"),As.setAttribute(ef,"0"),As.setAttribute(ab,"true"),As.setAttribute("aria-label","Focus guard"),tf=As.cloneNode(),(e=i.parentElement)===null||e===void 0||e.insertBefore(As,i),(n=i.parentElement)===null||n===void 0||n.append(tf)),i.addEventListener("mousedown",o=>{wO=o.pageX,xO=o.pageY,jn(i,lb)}),this.option("animated")&&(it(i,ub),setTimeout(()=>{this.isClosing()||jn(i,ub)},350)),this.emit("initLayout"))}initCarousel(e){const n=this.container;if(!n)return;const r=n.querySelector(".fancybox__carousel");if(!r)return;const i=this.carousel=new $u(r,Vo({},{slides:e,transition:"fade",Panzoom:{lockAxis:this.option("dragToClose")?"xy":"x",infinite:!!this.option("dragToClose")&&"y"},Dots:!1,Navigation:{classes:{container:"fancybox__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"}},initialPage:this.option("startIndex"),l10n:this.option("l10n")},this.option("Carousel")||{}));i.on("*",(o,s,...a)=>{this.emit(`Carousel.${s}`,o,...a)}),i.on(["ready","change"],()=>{this.manageCaption()}),this.on("Carousel.removeSlide",(o,s,a)=>{this.clearContent(a),a.state=void 0}),i.on("Panzoom.touchStart",()=>{var o,s;this.isCompact||this.endIdle(),!((o=document.activeElement)===null||o===void 0)&&o.closest(".f-thumbs")&&((s=this.container)===null||s===void 0||s.focus())}),i.on("settle",()=>{this.idleTimer||this.isCompact||!this.option("idle")||this.setIdle(),this.option("autoFocus")&&!this.isClosing&&this.checkFocus()}),this.option("dragToClose")&&(i.on("Panzoom.afterTransform",(o,s)=>{const a=this.getSlide();if(a&&z_(a.el))return;const u=this.container;if(u){const l=Math.abs(s.current.f),f=l<1?"":Math.max(.5,Math.min(1,1-l/s.contentRect.fitHeight*1.5));u.style.setProperty("--fancybox-ts",f?"0s":""),u.style.setProperty("--fancybox-opacity",f+"")}}),i.on("Panzoom.touchEnd",(o,s,a)=>{var u;const l=this.getSlide();if(l&&z_(l.el)||s.isMobile&&document.activeElement&&["TEXTAREA","INPUT"].indexOf((u=document.activeElement)===null||u===void 0?void 0:u.nodeName)!==-1)return;const f=Math.abs(s.dragOffset.y);s.lockedAxis==="y"&&(f>=200||f>=50&&s.dragOffset.time<300)&&(a&&a.cancelable&&a.preventDefault(),this.close(a,"f-throwOut"+(s.current.f<0?"Up":"Down")))})),i.on("change",o=>{var s;let a=(s=this.getSlide())===null||s===void 0?void 0:s.triggerEl;if(a){const u=new CustomEvent("slideTo",{bubbles:!0,cancelable:!0,detail:o.page});a.dispatchEvent(u)}}),i.on(["refresh","change"],o=>{const s=this.container;if(!s)return;for(const l of s.querySelectorAll("[data-fancybox-current-index]"))l.innerHTML=o.page+1;for(const l of s.querySelectorAll("[data-fancybox-count]"))l.innerHTML=o.pages.length;if(!o.isInfinite){for(const l of s.querySelectorAll("[data-fancybox-next]"))o.page0?(l.removeAttribute(Dh),l.removeAttribute(ef)):(l.setAttribute(Dh,""),l.setAttribute(ef,"-1"))}const a=this.getSlide();if(!a)return;let u=a.downloadSrc||"";u||a.type!=="image"||a.error||!ju(a[Rh])||(u=a[Rh]);for(const l of s.querySelectorAll("[data-fancybox-download]")){const f=a.downloadFilename;u?(l.removeAttribute(Dh),l.removeAttribute(ef),l.setAttribute(fb,u),l.setAttribute(bO,f||u),l.setAttribute("target","_blank")):(l.setAttribute(Dh,""),l.setAttribute(ef,"-1"),l.removeAttribute(fb),l.removeAttribute(bO))}}),this.emit("initCarousel")}attachEvents(){const e=this,n=e.container;if(!n)return;n.addEventListener("click",e.onClick,{passive:!1,capture:!1}),n.addEventListener("wheel",e.onWheel,{passive:!1,capture:!1}),document.addEventListener("keydown",e.onKeydown,{passive:!1,capture:!0}),document.addEventListener("visibilitychange",e.onVisibilityChange,!1),document.addEventListener("mousemove",e.onMousemove),e.option("trapFocus")&&document.addEventListener("focus",e.onFocus,!0),window.addEventListener("resize",e.onResize);const r=window.visualViewport;r&&(r.addEventListener("scroll",e.onResize),r.addEventListener("resize",e.onResize))}detachEvents(){const e=this,n=e.container;if(!n)return;document.removeEventListener("keydown",e.onKeydown,{passive:!1,capture:!0}),n.removeEventListener("wheel",e.onWheel,{passive:!1,capture:!1}),n.removeEventListener("click",e.onClick,{passive:!1,capture:!1}),document.removeEventListener("mousemove",e.onMousemove),window.removeEventListener("resize",e.onResize);const r=window.visualViewport;r&&(r.removeEventListener("resize",e.onResize),r.removeEventListener("scroll",e.onResize)),document.removeEventListener("visibilitychange",e.onVisibilityChange,!1),document.removeEventListener("focus",e.onFocus,!0)}scale(){const e=this.container;if(!e)return;const n=window.visualViewport,r=Math.max(1,(n==null?void 0:n.scale)||1);let i="",o="",s="";if(n&&r>1){let a=`${n.offsetLeft}px`,u=`${n.offsetTop}px`;i=n.width*r+"px",o=n.height*r+"px",s=`translate3d(${a}, ${u}, 0) scale(${1/r})`}e.style.transform=s,e.style.width=i,e.style.height=o}onClick(e){var n;const{container:r,isCompact:i}=this;if(!r||this.isClosing())return;!i&&this.option("idle")&&this.resetIdle();const o=e.composedPath()[0];if(o.closest(".fancybox-spinner")||o.closest("[data-fancybox-close]"))return e.preventDefault(),void this.close(e);if(o.closest("[data-fancybox-prev]"))return e.preventDefault(),void this.prev();if(o.closest("[data-fancybox-next]"))return e.preventDefault(),void this.next();if(e.type==="click"&&e.detail===0||Math.abs(e.pageX-wO)>30||Math.abs(e.pageY-xO)>30)return;const s=document.activeElement;if(EO()&&s&&r.contains(s))return;if(i&&((n=this.getSlide())===null||n===void 0?void 0:n.type)==="image")return void(this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null):this.clickTimer=setTimeout(()=>{this.toggleIdle(),this.clickTimer=null},350));if(this.emit("click",e),e.defaultPrevented)return;let a=!1;if(o.closest(".fancybox__content")){if(s){if(s.closest("[contenteditable]"))return;o.matches(eb)||s.blur()}if(EO())return;a=this.option("contentClick")}else o.closest(".fancybox__carousel")&&!o.matches(eb)&&(a=this.option("backdropClick"));a==="close"?(e.preventDefault(),this.close(e)):a==="next"?(e.preventDefault(),this.next()):a==="prev"&&(e.preventDefault(),this.prev())}onWheel(e){const n=e.target;let r=this.option("wheel",e);n.closest(".fancybox__thumbs")&&(r="slide");const i=r==="slide",o=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(u,l){return Math.abs(l)>Math.abs(u)?l:u}),s=Math.max(-1,Math.min(1,o)),a=Date.now();this.pwt&&a-this.pwt<300?i&&e.preventDefault():(this.pwt=a,this.emit("wheel",e,s),e.defaultPrevented||(r==="close"?(e.preventDefault(),this.close(e)):r==="slide"&&(Ny(n)||(e.preventDefault(),this[s>0?"prev":"next"]()))))}onKeydown(e){if(!this.isTopmost())return;this.isCompact||!this.option("idle")||this.isClosing()||this.resetIdle();const n=e.key,r=this.option("keyboard");if(!r)return;const i=e.composedPath()[0],o=document.activeElement&&document.activeElement.classList,s=o&&o.contains("f-button")||i.dataset.carouselPage||i.dataset.carouselIndex;if(n!=="Escape"&&!s&&$o(i)&&(i.isContentEditable||["TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(i.nodeName)!==-1)||(e.key==="Tab"?it(this.container,lb):jn(this.container,lb),e.ctrlKey||e.altKey||e.shiftKey))return;this.emit("keydown",n,e);const a=r[n];a&&typeof this[a]=="function"&&(e.preventDefault(),this[a]())}onResize(){const e=this.container;if(!e)return;const n=this.isCompact;e.classList.toggle(vO,n),this.manageCaption(this.getSlide()),this.isCompact?this.clearIdle():this.endIdle(),this.scale(),this.emit("resize")}onFocus(e){this.isTopmost()&&this.checkFocus(e)}onMousemove(e){this.prevMouseMoveEvent=e,!this.isCompact&&this.option("idle")&&this.resetIdle()}onVisibilityChange(){document.visibilityState==="visible"?this.checkFocus():this.endIdle()}manageCloseBtn(e){const n=this.optionFor(e,"closeButton")||!1;if(n==="auto"){const i=this.plugins.Toolbar;if(i&&i.state===Qc.Ready)return}if(!n||!e.contentEl||e.closeBtnEl)return;const r=this.option("tpl.closeButton");if(r){const i=Ga(this.localize(r));e.closeBtnEl=e.contentEl.appendChild(i),e.el&&it(e.el,"has-close-btn")}}manageCaption(e=void 0){var n,r;const i="fancybox__caption",o=this.container;if(!o)return;jn(o,$y);const s=this.isCompact||this.option("commonCaption"),a=!s;if(this.caption&&this.stop(this.caption),a&&this.caption&&(this.caption.remove(),this.caption=null),s&&!this.caption)for(const c of((n=this.carousel)===null||n===void 0?void 0:n.slides)||[])c.captionEl&&(c.captionEl.remove(),c.captionEl=void 0,jn(c.el,$y),(r=c.el)===null||r===void 0||r.removeAttribute("aria-labelledby"));if(e||(e=this.getSlide()),!e||s&&!this.isCurrentSlide(e))return;const u=e.el;let l=this.optionFor(e,"caption","");if(!l)return void(s&&this.caption&&this.animate(this.caption,"f-fadeOut",()=>{this.caption&&(this.caption.innerHTML="")}));let f=null;if(a){if(f=e.captionEl||null,u&&!f){const c=i+`_${this.id}_${e.index}`;f=document.createElement("div"),it(f,i),f.setAttribute("id",c),e.captionEl=u.appendChild(f),it(u,$y),u.setAttribute("aria-labelledby",c)}}else f=this.caption,f||(f=o.querySelector("."+i)),!f&&(f=document.createElement("div"),f.dataset.fancyboxCaption="",it(f,i),(this.footer||o).prepend(f)),it(o,$y),this.caption=f;f&&(f.innerHTML="",ju(l)||typeof l=="number"?f.innerHTML=l+"":l instanceof HTMLElement&&f.appendChild(l))}checkFocus(e){this.focus(e)}focus(e){var n;if(this.ignoreFocusChange)return;const r=document.activeElement||null,i=(e==null?void 0:e.target)||null,o=this.container,s=(n=this.carousel)===null||n===void 0?void 0:n.viewport;if(!o||!s||!e&&r&&o.contains(r))return;const a=this.getSlide(),u=a&&a.state===lo.Ready?a.el:null;if(!u||u.contains(r)||o===r)return;e&&e.cancelable&&e.preventDefault(),this.ignoreFocusChange=!0;const l=Array.from(o.querySelectorAll(eb));let f=[],c=null;for(let d of l){const g=!d.offsetParent||!!d.closest('[aria-hidden="true"]'),y=u&&u.contains(d),b=!s.contains(d);if(d===o||(y||b)&&!g){f.push(d);const _=d.dataset.origTabindex;_!==void 0&&_&&(d.tabIndex=parseFloat(_)),d.removeAttribute("data-orig-tabindex"),!d.hasAttribute("autoFocus")&&c||(c=d)}else{const _=d.dataset.origTabindex===void 0?d.getAttribute("tabindex")||"":d.dataset.origTabindex;_&&(d.dataset.origTabindex=_),d.tabIndex=-1}}let h=null;e?(!i||f.indexOf(i)<0)&&(h=c||o,f.length&&(r===tf?h=f[0]:this.lastFocus!==o&&r!==As||(h=f[f.length-1]))):h=a&&a.type==="image"?o:c||o,h&&YN(h),this.lastFocus=document.activeElement,this.ignoreFocusChange=!1}next(){const e=this.carousel;e&&e.pages.length>1&&e.slideNext()}prev(){const e=this.carousel;e&&e.pages.length>1&&e.slidePrev()}jumpTo(...e){this.carousel&&this.carousel.slideTo(...e)}isTopmost(){var e;return((e=Mn.getInstance())===null||e===void 0?void 0:e.id)==this.id}animate(e=null,n="",r){if(!e||!n)return void(r&&r());this.stop(e);const i=o=>{o.target===e&&e.dataset.animationName&&(e.removeEventListener("animationend",i),delete e.dataset.animationName,r&&r(),jn(e,n))};e.dataset.animationName=n,e.addEventListener("animationend",i),it(e,n)}stop(e){e&&e.dispatchEvent(new CustomEvent("animationend",{bubbles:!1,cancelable:!0,currentTarget:e}))}setContent(e,n="",r=!0){if(this.isClosing())return;const i=e.el;if(!i)return;let o=null;if($o(n)?o=n:(o=Ga(n+""),$o(o)||(o=document.createElement("div"),o.innerHTML=n+"")),["img","picture","iframe","video","audio"].includes(o.nodeName.toLowerCase())){const s=document.createElement("div");s.appendChild(o),o=s}$o(o)&&e.filter&&!e.error&&(o=o.querySelector(e.filter)),o&&$o(o)?(it(o,"fancybox__content"),e.id&&o.setAttribute("id",e.id),o.style.display!=="none"&&getComputedStyle(o).getPropertyValue("display")!=="none"||(o.style.display=e.display||this.option("defaultDisplay")||"flex"),i.classList.add(`has-${e.error?"error":e.type||"unknown"}`),i.prepend(o),e.contentEl=o,r&&this.revealContent(e),this.manageCloseBtn(e),this.manageCaption(e)):this.setError(e,"{{ELEMENT_NOT_FOUND}}")}revealContent(e,n){const r=e.el,i=e.contentEl;r&&i&&(this.emit("reveal",e),this.hideLoading(e),e.state=lo.Opening,(n=this.isOpeningSlide(e)?n===void 0?this.optionFor(e,"showClass"):n:"f-fadeIn")?this.animate(i,n,()=>{this.done(e)}):this.done(e))}done(e){this.isClosing()||(e.state=lo.Ready,this.emit("done",e),it(e.el,"is-done"),this.isCurrentSlide(e)&&this.option("autoFocus")&&queueMicrotask(()=>{var n;(n=e.panzoom)===null||n===void 0||n.updateControls(),this.option("autoFocus")&&this.focus()}),this.isOpeningSlide(e)&&(jn(this.container,cb),!this.isCompact&&this.option("idle")&&this.setIdle()))}isCurrentSlide(e){const n=this.getSlide();return!(!e||!n)&&n.index===e.index}isOpeningSlide(e){var n,r;return((n=this.carousel)===null||n===void 0?void 0:n.prevPage)===null&&e&&e.index===((r=this.getSlide())===null||r===void 0?void 0:r.index)}showLoading(e){e.state=lo.Loading;const n=e.el;n&&(it(n,_O),this.emit("loading",e),e.spinnerEl||setTimeout(()=>{if(!this.isClosing()&&!e.spinnerEl&&e.state===lo.Loading){let r=Ga(X_);it(r,"fancybox-spinner"),e.spinnerEl=r,n.prepend(r),this.animate(r,"f-fadeIn")}},250))}hideLoading(e){const n=e.el;if(!n)return;const r=e.spinnerEl;this.isClosing()?r==null||r.remove():(jn(n,_O),r&&this.animate(r,"f-fadeOut",()=>{r.remove()}),e.state===lo.Loading&&(this.emit("loaded",e),e.state=lo.Ready))}setError(e,n){if(this.isClosing())return;const r=new Event("error",{bubbles:!0,cancelable:!0});if(this.emit("error",r,e),r.defaultPrevented)return;e.error=n,this.hideLoading(e),this.clearContent(e);const i=document.createElement("div");i.classList.add("fancybox-error"),i.innerHTML=this.localize(n||"

{{ERROR}}

"),this.setContent(e,i)}clearContent(e){if(e.state===void 0)return;this.emit("clearContent",e),e.contentEl&&(e.contentEl.remove(),e.contentEl=void 0);const n=e.el;n&&(jn(n,"has-error"),jn(n,"has-unknown"),jn(n,`has-${e.type||"unknown"}`)),e.closeBtnEl&&e.closeBtnEl.remove(),e.closeBtnEl=void 0,e.captionEl&&e.captionEl.remove(),e.captionEl=void 0,e.spinnerEl&&e.spinnerEl.remove(),e.spinnerEl=void 0}getSlide(){var e;const n=this.carousel;return((e=n==null?void 0:n.pages[n==null?void 0:n.page])===null||e===void 0?void 0:e.slides[0])||void 0}close(e,n){if(this.isClosing())return;const r=new Event("shouldClose",{bubbles:!0,cancelable:!0});if(this.emit("shouldClose",r,e),r.defaultPrevented)return;e&&e.cancelable&&(e.preventDefault(),e.stopPropagation());const i=()=>{this.proceedClose(e,n)};this.startedFs&&Ps&&Ps.isFullscreen()?Promise.resolve(Ps.exit()).then(()=>i()):i()}clearIdle(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=null}setIdle(e=!1){const n=()=>{this.clearIdle(),this.idle=!0,it(this.container,"is-idle"),this.emit("setIdle")};if(this.clearIdle(),!this.isClosing())if(e)n();else{const r=this.option("idle");r&&(this.idleTimer=setTimeout(n,r))}}endIdle(){this.clearIdle(),this.idle&&!this.isClosing()&&(this.idle=!1,jn(this.container,"is-idle"),this.emit("endIdle"))}resetIdle(){this.endIdle(),this.setIdle()}toggleIdle(){this.idle?this.endIdle():this.setIdle(!0)}toggleFullscreen(){Ps&&(Ps.isFullscreen()?Ps.exit():Ps.request().then(()=>{this.startedFs=!0}))}isClosing(){return[ki.Closing,ki.CustomClosing,ki.Destroy].includes(this.state)}proceedClose(e,n){var r,i;this.state=ki.Closing,this.clearIdle(),this.detachEvents();const o=this.container,s=this.carousel,a=this.getSlide(),u=a&&this.option("placeFocusBack")?a.triggerEl||this.option("triggerEl"):null;if(u&&(GN(u)?YN(u):u.focus()),o&&(jn(o,cb),it(o,"is-closing"),o.setAttribute(ab,"true"),this.option("animated")&&it(o,ub),o.style.pointerEvents="none"),s){s.clearTransitions(),(r=s.panzoom)===null||r===void 0||r.destroy(),(i=s.plugins.Navigation)===null||i===void 0||i.detach();for(const l of s.slides){l.state=lo.Closing,this.hideLoading(l);const f=l.contentEl;f&&this.stop(f);const c=l==null?void 0:l.panzoom;c&&(c.stop(),c.detachEvents(),c.detachObserver()),this.isCurrentSlide(l)||s.emit("removeSlide",l)}}this.emit("close",e),this.state!==ki.CustomClosing?(n===void 0&&a&&(n=this.optionFor(a,"hideClass")),n&&a?(this.animate(a.contentEl,n,()=>{s&&s.emit("removeSlide",a)}),setTimeout(()=>{this.destroy()},500)):this.destroy()):setTimeout(()=>{this.destroy()},500)}destroy(){var e;if(this.state===ki.Destroy)return;this.state=ki.Destroy,(e=this.carousel)===null||e===void 0||e.destroy();const n=this.container;n&&n.remove(),Ip.delete(this.id);const r=Mn.getInstance();r?r.focus():(As&&(As.remove(),As=null),tf&&(tf.remove(),tf=null),jn(document.documentElement,gO),(()=>{if(!Cp)return;const i=document,o=i.body;o.classList.remove(sb),o.style.setProperty(yO,""),i.documentElement.style.setProperty(mO,"")})(),this.emit("destroy"))}static bind(e,n,r){if(!Cp)return;let i,o="",s={};if(e===void 0?i=document.body:ju(e)?(i=document.body,o=e,typeof n=="object"&&(s=n||{})):(i=e,ju(n)&&(o=n),typeof r=="object"&&(s=r||{})),!i||!$o(i))return;o=o||"[data-fancybox]";const a=Mn.openers.get(i)||new Map;a.set(o,s),Mn.openers.set(i,a),a.size===1&&i.addEventListener("click",Mn.fromEvent)}static unbind(e,n){let r,i="";if(ju(e)?(r=document.body,i=e):(r=e,ju(n)&&(i=n)),!r)return;const o=Mn.openers.get(r);o&&i&&o.delete(i),i&&o||(Mn.openers.delete(r),r.removeEventListener("click",Mn.fromEvent))}static destroy(){let e;for(;e=Mn.getInstance();)e.destroy();for(const n of Mn.openers.keys())n.removeEventListener("click",Mn.fromEvent);Mn.openers=new Map}static fromEvent(e){if(e.defaultPrevented||e.button&&e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey)return;let n=e.composedPath()[0];const r=n.closest("[data-fancybox-trigger]");if(r){const g=r.dataset.fancyboxTrigger||"",y=document.querySelectorAll(`[data-fancybox="${g}"]`),b=parseInt(r.dataset.fancyboxIndex||"",10)||0;n=y[b]||n}if(!(n&&n instanceof Element))return;let i,o,s,a;if([...Mn.openers].reverse().find(([g,y])=>!(!g.contains(n)||![...y].reverse().find(([b,_])=>{let p=n.closest(b);return!!p&&(i=g,o=b,s=p,a=_,!0)}))),!i||!o||!s)return;a=a||{},e.preventDefault(),n=s;let u=[],l=Vo({},tb,a);l.event=e,l.triggerEl=n,l.delegate=r;const f=l.groupAll,c=l.groupAttr,h=c&&n?n.getAttribute(`${c}`):"";if((!n||h||f)&&(u=[].slice.call(i.querySelectorAll(o))),n&&!f&&(u=h?u.filter(g=>g.getAttribute(`${c}`)===h):[n]),!u.length)return;const d=Mn.getInstance();return d&&d.options.triggerEl&&u.indexOf(d.options.triggerEl)>-1?void 0:(n&&(l.startIndex=u.indexOf(n)),Mn.fromNodes(u,l))}static fromSelector(e,n,r){let i=null,o="",s={};if(ju(e)?(i=document.body,o=e,typeof n=="object"&&(s=n||{})):e instanceof HTMLElement&&ju(n)&&(i=e,o=n,typeof r=="object"&&(s=r||{})),!i||!o)return!1;const a=Mn.openers.get(i);return!!a&&(s=Vo({},a.get(o)||{},s),!!s&&Mn.fromNodes(Array.from(i.querySelectorAll(o)),s))}static fromNodes(e,n){n=Vo({},tb,n||{});const r=[];for(const i of e){const o=i.dataset||{},s=o[Rh]||i.getAttribute(fb)||i.getAttribute("currentSrc")||i.getAttribute(Rh)||void 0;let a;const u=n.delegate;let l;u&&r.length===n.startIndex&&(a=u instanceof HTMLImageElement?u:u.querySelector("img:not([aria-hidden])")),a||(a=i instanceof HTMLImageElement?i:i.querySelector("img:not([aria-hidden])")),a&&(l=a.currentSrc||a[Rh]||void 0,!l&&a.dataset&&(l=a.dataset.lazySrc||a.dataset[Rh]||void 0));const f={src:s,triggerEl:i,thumbEl:a,thumbElSrc:l,thumbSrc:l};for(const c in o){let h=o[c]+"";h=h!=="false"&&(h==="true"||h),f[c]=h}r.push(f)}return new Mn(r,n)}static getInstance(e){return e?Ip.get(e):Array.from(Ip.values()).reverse().find(n=>!n.isClosing()&&n)||null}static getSlide(){var e;return((e=Mn.getInstance())===null||e===void 0?void 0:e.getSlide())||null}static show(e=[],n={}){return new Mn(e,n)}static next(){const e=Mn.getInstance();e&&e.next()}static prev(){const e=Mn.getInstance();e&&e.prev()}static close(e=!0,...n){if(e)for(const r of Ip.values())r.close(...n);else{const r=Mn.getInstance();r&&r.close(...n)}}}Object.defineProperty(Mn,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.33"}),Object.defineProperty(Mn,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:tb}),Object.defineProperty(Mn,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:F8}),Object.defineProperty(Mn,"openers",{enumerable:!0,configurable:!0,writable:!0,value:new Map});const SO=Object.freeze(Object.defineProperty({__proto__:null,Carousel:$u,Fancybox:Mn,Panzoom:Vu},Symbol.toStringTag,{value:"Module"})),{Fancybox:V8}=SO,$8={data(){return{}},created(){V8.bind('[data-fancybox="gallery"]')},methods:{}},j8={class:"rounded-md vs-file-list"},q8={class:"w-full"},U8={class:"bg-gray-100"};function z8(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("div",j8,[E.createElementVNode("table",q8,[E.createElementVNode("thead",null,[E.createElementVNode("tr",U8,[(E.openBlock(),E.createElementBlock(E.Fragment,null,E.renderList(["Назва","Тип","Користувач","Розмір","Дата","Дії"],s=>E.createElementVNode("th",{key:s,scope:"col",class:E.normalizeClass(["px-6 py-2 text-xs font-medium text-gray-500 uppercase text-start",[{"!text-center vs-file-list__actions":s==="Дії"},{"!pl-10":s==="Назва"}]])},E.toDisplayString(s),3)),64))])]),E.createElementVNode("tbody",null,[E.renderSlot(t.$slots,"default")])])])}const H8=lt($8,[["render",z8]]),G8={props:{type:{type:String,default:"file"}}},Y8={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",width:"18px",height:"18px",viewBox:"0 0 256 256",version:"1.1"},W8=[E.createStaticVNode('',2)],X8={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",width:"18px",height:"18px",viewBox:"0 0 256 256",version:"1.1"},K8=[E.createStaticVNode('',1)],Z8={key:2,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",width:"18px",height:"18px",viewBox:"0 0 18 18",version:"1.1"},J8=[E.createStaticVNode('',2)],Q8={key:3,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",width:"18px",height:"18px",viewBox:"0 0 256 256",version:"1.1"},e9=[E.createStaticVNode('',2)];function t9(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock(E.Fragment,null,[n.type==="document"?(E.openBlock(),E.createElementBlock("svg",Y8,W8)):E.createCommentVNode("",!0),n.type==="image"?(E.openBlock(),E.createElementBlock("svg",X8,K8)):E.createCommentVNode("",!0),n.type==="video"?(E.openBlock(),E.createElementBlock("svg",Z8,J8)):E.createCommentVNode("",!0),n.type==="file"?(E.openBlock(),E.createElementBlock("svg",Q8,e9)):E.createCommentVNode("",!0)],64)}const n9={components:{VsFileIcon:lt(G8,[["render",t9]])},props:{data:{type:Object,default:()=>{}},appearance:{type:String,default:()=>"table"},isFileData:{type:Boolean,default:()=>!1}},data(){var t,e;return{buttonActionIcons:[{icon:"download",tooltip:"Завантажити файл"},{icon:"trash",tooltip:"Видалити файл"}],showTileImageActions:null,fileTitle:((t=this.data)==null?void 0:t.uploaded_name)||((e=this.data)==null?void 0:e.file_name)}},computed:{isPreviewable(){return this.fileIcon==="image"||this.fileExtension==="pdf"},fileExtension(){return this.data.ext||this.fileTitle.split(".").at(-1)},fileIcon(){const t=["jpg","jpeg","bmp","gif","png","svg"],e=["mp4","avi","mkv","mov"],n=["pdf","doc","docx","xls","xlsx","ppt","pptx"];return t.includes(this.fileExtension)?"image":e.includes(this.fileExtension)?"video":n.includes(this.fileExtension)?"document":"file"},fileDate(){const t={day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric"};return new Date(this.data.cdate).toLocaleDateString("uk-UK",t)},fileSrc(){const t=this.data.file_path;return t.includes("files/")?t:`files/${t}`}},methods:{getFileSize(t,e=2){if(t===0)return"0 Bytes";const n=1024,r=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],i=Math.floor(Math.log(t)/Math.log(n));return`${parseFloat((t/n**i).toFixed(e))} ${r[i]}`},getFileAction(t,e){switch(t){case"trash":this.$emit("openModal",{title:"Видалення",message:"Ви підтверджуєте видалення?",confirmButtonText:"Так",cancelButtonText:"Ні",confirm:this.deleteFile,updateListOnConfirm:!0});break;case"download":this.downloadFile(e);break}},async deleteFile(){try{await Pt.delete(`/file/delete${this.data.file_path}`)}catch(t){console.error(t)}},async downloadFile(t){function e(){return Pt.get(`/file/download${t.file_path}`,{responseType:"arraybuffer",headers:{"Content-Type":"application/json"}})}e().then(n=>{const r=n.headers["content-type"],i=new Blob([n.data],{type:r,encoding:"UTF-8"}),o=document.createElement("a");o.setAttribute("download",t.uploaded_name),o.href=window.URL.createObjectURL(i),o.click()})}}},r9={class:"px-2 py-1 whitespace-nowrap text-sm font-medium text-gray-800"},i9={class:"flex align-items-center"},o9=["data-src"],s9=["data-caption","href"],a9={class:"text-xs"},l9={key:1,class:"flex items-center gap-2"},u9={class:"text-xs"},c9={class:"px-6 py-1 whitespace-nowrap text-sm text-gray-800"},f9={class:"px-6 py-1 whitespace-nowrap text-sm text-gray-800"},h9={class:"px-6 py-1 whitespace-nowrap text-sm text-gray-800"},d9={class:"px-6 py-1 whitespace-nowrap text-sm text-gray-800"},p9={class:"px-6 py-1 whitespace-nowrap text-end text-sm font-medium flex gap-2 justify-end pr-0"},g9={key:1,class:"text-gray-300 pointer-events-none"};function m9(t,e,n,r,i,o){var l;const s=E.resolveComponent("VsFileIcon"),a=E.resolveComponent("VsButton"),u=E.resolveComponent("VsTooltip");return E.openBlock(),E.createElementBlock("tr",null,[E.createElementVNode("td",r9,[E.createElementVNode("span",i9,[E.createElementVNode("div",{"data-src":o.fileSrc},[o.isPreviewable?(E.openBlock(),E.createElementBlock("a",{key:0,class:"flex items-center gap-2","data-fancybox":"gallery","data-caption":n.data.uploaded_name,href:n.data.file_path},[E.createVNode(s,{type:o.fileIcon},null,8,["type"]),E.createElementVNode("span",a9,E.toDisplayString(i.fileTitle),1)],8,s9)):(E.openBlock(),E.createElementBlock("div",l9,[E.createVNode(s,{type:o.fileIcon},null,8,["type"]),E.createElementVNode("span",u9,E.toDisplayString(i.fileTitle),1)]))],8,o9)])]),E.createElementVNode("td",c9,E.toDisplayString(n.data.ext),1),E.createElementVNode("td",f9,E.toDisplayString((l=n.data)==null?void 0:l.username),1),E.createElementVNode("td",h9,E.toDisplayString(o.getFileSize(n.data.size)),1),E.createElementVNode("td",d9,E.toDisplayString(o.fileDate),1),E.createElementVNode("td",p9,[n.isFileData?(E.openBlock(),E.createElementBlock("div",g9,"...")):(E.openBlock(!0),E.createElementBlock(E.Fragment,{key:0},E.renderList(i.buttonActionIcons,f=>(E.openBlock(),E.createBlock(u,{content:f.tooltip,position:"bottom"},{reference:E.withCtx(()=>[(E.openBlock(),E.createBlock(a,{key:f.icon,square:"",size:"mini",onClick:c=>o.getFileAction(f.icon,n.data)},{default:E.withCtx(()=>[E.createElementVNode("i",{class:E.normalizeClass(`ti ti-${f.icon}`)},null,2)]),_:2},1032,["onClick"]))]),_:2},1032,["content"]))),256))])])}const y9=lt(n9,[["render",m9]]),v9={props:{content:{type:String,default:()=>""},position:{type:String,default:()=>"top"}},data(){return{tooltipVisible:!1}},methods:{showTooltip(){this.tooltipVisible=!0},hideTooltip(){this.tooltipVisible=!1},getTooltipPosition(){switch(this.position){case"left":return"tooltip-left";case"right":return"tooltip-right";case"bottom":return"tooltip-bottom";default:return"tooltip-top"}}}},_9=E.createElementVNode("button",null,"Hover Me",-1);function b9(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("div",{onMouseenter:e[0]||(e[0]=(...s)=>o.showTooltip&&o.showTooltip(...s)),onMouseleave:e[1]||(e[1]=(...s)=>o.hideTooltip&&o.hideTooltip(...s)),class:"vs-tooltip relative self-center cursor-pointer"},[E.renderSlot(t.$slots,"reference",{},()=>[_9]),i.tooltipVisible?(E.openBlock(),E.createElementBlock("span",{key:0,class:E.normalizeClass(["vs-tooltip__content inline-block absolute max-w-md z-10 py-1 px-2 bg-white text-xs font-medium text-black rounded-md border border-[#dcdfe6]",o.getTooltipPosition()])},E.toDisplayString(n.content),3)):E.createCommentVNode("",!0)],32)}const CO=lt(v9,[["render",b9]]),E9={components:{VsWidgetFileList:H8,VsWidgetFileItem:y9,VsDialog:Ih,VsTooltip:CO,VsButton:Uc},props:{id:{type:String,default:""},apiFiles:{type:String,default:()=>""},apiAddFiles:{type:String,default:()=>""},fileData:{type:Array,default:()=>[]},staticData:{type:Object,default:()=>null}},data(){return{files:[],user:null,galleryId:Math.floor(Math.random()*1e3)+1,isModalVisible:!1,modal:{}}},computed:{renderFiles(){return this.isFileDataAviable?this.fileData:this.files.map(t=>({...t,id:Math.floor(Math.random()*1e3)}))},filesCount(){return this.renderFiles.length},isFileDataAviable(){return this.fileData.length}},mounted(){!this.isFileDataAviable&&this.apiFiles&&this.getFileList(),this.staticData&&(this.user=this.staticData.user,this.files=this.staticData.rows)},methods:{async getFileList(){const{data:t}=await Pt.get(this.apiFiles);this.user=t==null?void 0:t.user,this.files=t==null?void 0:t.rows},async addFile(t){(await Promise.all(Array.from(t.target.files).map(async r=>{const i=new FormData;i.append("file",r);try{const o=this.apiAddFiles;return await Pt.post(o,i),r}catch(o){return console.error(o),null}}))).every(r=>r)&&await this.getFileList()},prepareModal(t){const e={...t};return t.cancel||(e.cancel=()=>{this.isModalVisible=!1}),t.updateListOnConfirm&&(e.confirm=async()=>{await t.confirm(),this.isModalVisible=!1,this.getFileList()}),e},handleOpenModal(t){this.modal=this.prepareModal(t),this.isModalVisible=!0}}},w9={class:"widget-file flex flex-col mb-2"},x9={class:"flex items-center justify-between"},S9={class:"text-sm font-medium text-gray-600"},C9=E.createElementVNode("div",null,null,-1),N9=E.createElementVNode("i",{class:"ti ti-plus"},null,-1),O9={key:1,class:"bg-gray-100 rounded text-gray-500 px-4 py-1.5",role:"alert"},T9=[E.createStaticVNode('

Файли відсутні

Додайте файли, щоб побачити список.

',1)],I9={class:"py-3 px-4"},M9={class:"mt-3 flex items-center gap-4 justify-center"};function k9(t,e,n,r,i,o){const s=E.resolveComponent("VsButton"),a=E.resolveComponent("VsTooltip"),u=E.resolveComponent("VsWidgetFileItem"),l=E.resolveComponent("VsWidgetFileList"),f=E.resolveComponent("VsDialog");return E.openBlock(),E.createElementBlock("div",null,[E.createElementVNode("div",w9,[E.createElementVNode("div",x9,[E.createElementVNode("h3",S9," Кількість: "+E.toDisplayString(o.filesCount),1),C9,E.createVNode(a,{content:"Додати файл",position:"bottom"},{reference:E.withCtx(()=>[E.createVNode(s,{square:"",style:{"font-size":"12px",position:"relative"}},{default:E.withCtx(()=>[N9,E.createElementVNode("input",{multiple:"",class:"form-control form-control-sm input-hidden",type:"file",name:"file",style:{opacity:"0",position:"absolute",top:"0",bottom:"0",left:"0",right:"0"},onChange:e[0]||(e[0]=c=>o.addFile(c))},null,32)]),_:1})]),_:1})])]),o.filesCount?(E.openBlock(),E.createBlock(l,{key:0},{default:E.withCtx(()=>[(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(o.renderFiles,(c,h)=>(E.openBlock(),E.createBlock(u,{key:(c==null?void 0:c.id)||h,"is-file-data":o.isFileDataAviable,data:c,onUpdateList:o.getFileList,onOpenModal:e[1]||(e[1]=d=>o.handleOpenModal(d))},null,8,["is-file-data","data","onUpdateList"]))),128))]),_:1})):(E.openBlock(),E.createElementBlock("div",O9,T9)),E.createVNode(f,{title:i.modal.title,size:"small",visible:i.isModalVisible,"onUpdate:visible":e[2]||(e[2]=c=>i.isModalVisible=c)},{default:E.withCtx(()=>[E.createElementVNode("div",I9,[E.createElementVNode("p",null,E.toDisplayString(i.modal.message),1),E.createElementVNode("div",M9,[E.createVNode(s,{class:"w-8",color:"red",onClick:i.modal.cancel},{default:E.withCtx(()=>[E.createTextVNode(E.toDisplayString(i.modal.cancelButtonText),1)]),_:1},8,["onClick"]),E.createVNode(s,{class:"w-8",type:"primary",onClick:i.modal.confirm},{default:E.withCtx(()=>[E.createTextVNode(E.toDisplayString(i.modal.confirmButtonText),1)]),_:1},8,["onClick"])])])]),_:1},8,["title","visible"])])}const NO=lt(E9,[["render",k9]]),P9={props:{componentKey:{type:String,default:()=>""},id:{type:String,default:()=>""},token:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},modelValue:{type:[Array,Object],default:()=>null}},data(){return{}},inject:["formValues"],computed:{apiFiles(){return`/api-user/widget/file/${this.token}`},apiAddFiles(){const t=this.componentKey?`&field=${this.componentKey}`:"";return`/file/upload/upload/${this.token}/?table=${this.token}&form=${this.token}${t}`},fileData(){var t;return this.modelValue||((t=this.formValues)==null?void 0:t.filelist)}},components:{VsFile:NO}};function A9(t,e,n,r,i,o){const s=E.resolveComponent("VsFile");return E.openBlock(),E.createElementBlock("div",null,[E.createVNode(s,{apiAddFiles:o.apiAddFiles,apiFiles:o.apiFiles,disabled:n.disabled},null,8,["apiAddFiles","apiFiles","disabled"])])}const L9=lt(P9,[["render",A9]]),{Fancybox:D9}=SO,R9={props:{id:{type:String,default:()=>""},table:{type:String,default:()=>""},token:{type:String,default:()=>""},multi:{type:Boolean,default:()=>!1},modelValue:{type:[Array,String],default:()=>[]}},data(){return{fileData:[],tempFiles:[],hoveredFileIndex:null,hoveredAddFile:!1,fileActionIcons:["download","trash"]}},computed:{inputInnerLabel(){return this.tempFiles.length?this.multi?`Файлів обрано: ${this.tempFiles.length}`:this.tempFiles[0].name:"Файл не вибрано"}},mounted(){D9.bind('[data-fancybox="gallery"]'),this.assignFileData(),window.addEventListener("form-refresh",this.clearData)},beforeUnmount(){window.removeEventListener("form-refresh",this.clearData)},methods:{clearData(){this.fileData=[]},getAction(t,e){switch(t){case"download":this.downloadFile(e);break;case"trash":this.removeFile(e);break}},openFilePicker(){this.$refs.filePicker.click()},assignFileData(){const e=Array.isArray(this.modelValue)?this.modelValue:[this.modelValue];this.fileData=e},getFileType(t){if(!t)return"";const e=t.split(".");return e[e.length-1]},getFileName(t){if(!t)return"";const e=t.split("/");return e[e.length-1]},isFileImg(t){const e=this.getFileType(t);return["png","jpg","jpeg"].includes(e)},getFileIcon(t){const e=this.getFileType(t);return{xls:"ti-file-type-xls",xlsx:"ti-file-spreadsheet",csv:"ti-file-type-csv",json:"ti-file-code",geojson:"ti-file-code",pdf:"ti-file-type-pdf"}[e]||"ti-file"},async removeFile(t){try{await Pt.delete(`file/delete/${t}`),this.fileData=this.fileData.filter(e=>e!==t),this.$emit("update:modelValue",this.fileData)}catch(e){console.error(e)}},async downloadFile(t){try{const e=await Pt.get(`file/download/files/uploads${t}`,{responseType:"arraybuffer",headers:{"Content-Type":"application/json"}}),n=e.headers["content-type"],r=new TextDecoder("utf-8").decode(e.data),i=new Blob([r],{type:n}),o=document.createElement("a");o.setAttribute("download",t),o.href=window.URL.createObjectURL(i),o.click()}catch(e){console.error(e.message)}},async handleChange(t){const{files:e}=t.target;this.tempFiles=Array.from(e).map(r=>({name:r.name,loading:0}));const n=await Array.from(e).reduce(async(r,i)=>{const o=await this.uploadFile(i);if(!o)return r;const s=o.result.file_path;return(await r).concat(s)},Promise.resolve([]));this.fileData=this.multi?this.fileData.concat(n):n,this.$emit("update:modelValue",this.fileData),this.$refs.filePicker.value=""},async uploadFile(t){const{table:e,token:n}=this;try{const r=new FormData;r.append("unique","true"),r.append("file",t);const{data:i}=await Pt.post(`/file/upload/uploads?id=${n}&form=${e}&table=${n}`,r,{onUploadProgress:o=>{this.tempFiles=this.tempFiles.map(s=>(s.name===t.name&&(s.loading=o.loaded*100/(o.total===void 0?0:o.total)),s))}});return i}catch(r){return console.error(r),null}}}},F9={class:"vs-form-file flex gap-4"},B9=["onMouseenter"],V9={class:"absolute inset-0 flex items-center justify-center"},$9=["src"],j9={key:1},q9=["href"],U9={key:0,class:"ti ti-zoom-in z-10 text-gray-600 hover:cursor-pointer"},z9=["onClick"];function H9(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("div",F9,[(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(t.fileData,(s,a)=>(E.openBlock(),E.createElementBlock("div",{key:s,class:"vs-form-file__item border-2 border-dotted border-gray-300 rounded-lg hover:border-blue-500 transition-all relative hover:text-blue-500",onMouseenter:u=>t.hoveredFileIndex=a,onMouseleave:e[0]||(e[0]=u=>t.hoveredFileIndex=null)},[E.createElementVNode("div",V9,[o.isFileImg(s)?(E.openBlock(),E.createElementBlock("img",{key:0,src:s,class:"vs-form-file__img"},null,8,$9)):(E.openBlock(),E.createElementBlock("span",j9,[E.createElementVNode("i",{class:E.normalizeClass(["text-xl text-gray-400 flex","ti "+o.getFileIcon(s)]),style:{"font-size":"80px"}},null,2)])),E.createElementVNode("div",{class:E.normalizeClass(["vs-form-file__actions absolute flex gap-1 z-20 items-center",{"vs-form-file__actions--active":a===t.hoveredFileIndex}])},[o.isFileImg(s)?(E.openBlock(),E.createElementBlock("a",{key:0,"data-fancybox":"gallery",href:s},[o.isFileImg(s)?(E.openBlock(),E.createElementBlock("i",U9)):E.createCommentVNode("",!0)],8,q9)):E.createCommentVNode("",!0),(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(t.fileActionIcons,u=>(E.openBlock(),E.createElementBlock("i",{key:u,class:E.normalizeClass(["z-10 text-gray-600 hover:cursor-pointer","ti ti-"+u]),onClick:l=>o.getAction(u,s)},null,10,z9))),128))],2)])],40,B9))),128)),E.createElementVNode("div",{class:"border-2 border-dotted border-gray-300 rounded-lg hover:border-blue-500 hover:cursor-pointer transition-all relative",style:{width:"120px",height:"120px"},onMouseenter:e[3]||(e[3]=s=>t.hoveredAddFile=!0),onMouseleave:e[4]||(e[4]=s=>t.hoveredAddFile=!1)},[E.createElementVNode("form",null,[E.withDirectives(E.createElementVNode("input",{type:"file",placeholder:"...",ref:"filePicker",name:"file-input",onChange:e[1]||(e[1]=(...s)=>o.handleChange&&o.handleChange(...s)),id:"file-input",class:"hidden"},null,544),[[E.vShow,!1]]),E.createElementVNode("div",{class:"absolute inset-0 flex items-center justify-center",onClick:e[2]||(e[2]=(...s)=>o.openFilePicker&&o.openFilePicker(...s))},[E.createElementVNode("i",{class:E.normalizeClass(["ti ti-plus text-lg absolute text-gray-400",{"!text-blue-500":t.hoveredAddFile}])},null,2)])])],32)])}const G9=lt(R9,[["render",H9],["__scopeId","data-v-3a349a7d"]]);var or=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ls(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function jy(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var OO={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(or,function(){var n=function(x,k){var R={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},Y={on:function(ie,ae,Se){if(R[ie]===void 0)throw new Error("Invalid event type: "+ie);R[ie].push({selector:ae,fn:Se})},render:function(ie){k.store.featureChanged(ie)}},te=function(ie,ae){for(var Se=R[ie],Me=Se.length;Me--;){var Fe=Se[Me];if(Fe.selector(ae)){Fe.fn.call(Y,ae)||k.store.render(),k.ui.updateMapClasses();break}}};return x.start.call(Y),{render:x.render,stop:function(){x.stop&&x.stop()},trash:function(){x.trash&&(x.trash(),k.store.render())},combineFeatures:function(){x.combineFeatures&&x.combineFeatures()},uncombineFeatures:function(){x.uncombineFeatures&&x.uncombineFeatures()},drag:function(ie){te("drag",ie)},click:function(ie){te("click",ie)},mousemove:function(ie){te("mousemove",ie)},mousedown:function(ie){te("mousedown",ie)},mouseup:function(ie){te("mouseup",ie)},mouseout:function(ie){te("mouseout",ie)},keydown:function(ie){te("keydown",ie)},keyup:function(ie){te("keyup",ie)},touchstart:function(ie){te("touchstart",ie)},touchmove:function(ie){te("touchmove",ie)},touchend:function(ie){te("touchend",ie)},tap:function(ie){te("tap",ie)}}};function r(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x.default:x}function i(x){if(x.__esModule)return x;var k=x.default;if(typeof k=="function"){var R=function Y(){if(this instanceof Y){var te=[null];te.push.apply(te,arguments);var ie=Function.bind.apply(k,te);return new ie}return k.apply(this,arguments)};R.prototype=k.prototype}else R={};return Object.defineProperty(R,"__esModule",{value:!0}),Object.keys(x).forEach(function(Y){var te=Object.getOwnPropertyDescriptor(x,Y);Object.defineProperty(R,Y,te.get?te:{enumerable:!0,get:function(){return x[Y]}})}),R}var o={},s={RADIUS:6378137,FLATTENING:1/298.257223563,POLAR_RADIUS:63567523142e-4},a=s;function u(x){var k=0;if(x&&x.length>0){k+=Math.abs(l(x[0]));for(var R=1;R2){for(ae=0;ae=Math.pow(2,x)?D(x,k):ie};D.rack=function(x,k,R){var Y=function(ie){var ae=0;do{if(ae++>10){if(!R)throw new Error("too many ID collisions, use more bits");x+=R}var Se=D(x,k)}while(Object.hasOwnProperty.call(te,Se));return te[Se]=ie,Se},te=Y.hats={};return Y.get=function(ie){return Y.hats[ie]},Y.set=function(ie,ae){return Y.hats[ie]=ae,Y},Y.bits=x||128,Y.base=k||16,Y};var j=r(V.exports),z=function(x,k){this.ctx=x,this.properties=k.properties||{},this.coordinates=k.geometry.coordinates,this.id=k.id||j(),this.type=k.geometry.type};z.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},z.prototype.incomingCoords=function(x){this.setCoordinates(x)},z.prototype.setCoordinates=function(x){this.coordinates=x,this.changed()},z.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},z.prototype.setProperty=function(x,k){this.properties[x]=k},z.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:y.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},z.prototype.internal=function(x){var k={id:this.id,meta:m.FEATURE,"meta:type":this.type,active:v.INACTIVE,mode:x};if(this.ctx.options.userProperties)for(var R in this.properties)k["user_"+R]=this.properties[R];return{type:y.FEATURE,properties:k,geometry:{coordinates:this.getCoordinates(),type:this.type}}};var ee=function(x,k){z.call(this,x,k)};(ee.prototype=Object.create(z.prototype)).isValid=function(){return typeof this.coordinates[0]=="number"&&typeof this.coordinates[1]=="number"},ee.prototype.updateCoordinate=function(x,k,R){this.coordinates=arguments.length===3?[k,R]:[x,k],this.changed()},ee.prototype.getCoordinate=function(){return this.getCoordinates()};var X=function(x,k){z.call(this,x,k)};(X.prototype=Object.create(z.prototype)).isValid=function(){return this.coordinates.length>1},X.prototype.addCoordinate=function(x,k,R){this.changed();var Y=parseInt(x,10);this.coordinates.splice(Y,0,[k,R])},X.prototype.getCoordinate=function(x){var k=parseInt(x,10);return JSON.parse(JSON.stringify(this.coordinates[k]))},X.prototype.removeCoordinate=function(x){this.changed(),this.coordinates.splice(parseInt(x,10),1)},X.prototype.updateCoordinate=function(x,k,R){var Y=parseInt(x,10);this.coordinates[Y]=[k,R],this.changed()};var q=function(x,k){z.call(this,x,k),this.coordinates=this.coordinates.map(function(R){return R.slice(0,-1)})};(q.prototype=Object.create(z.prototype)).isValid=function(){return this.coordinates.length!==0&&this.coordinates.every(function(x){return x.length>2})},q.prototype.incomingCoords=function(x){this.coordinates=x.map(function(k){return k.slice(0,-1)}),this.changed()},q.prototype.setCoordinates=function(x){this.coordinates=x,this.changed()},q.prototype.addCoordinate=function(x,k,R){this.changed();var Y=x.split(".").map(function(te){return parseInt(te,10)});this.coordinates[Y[0]].splice(Y[1],0,[k,R])},q.prototype.removeCoordinate=function(x){this.changed();var k=x.split(".").map(function(Y){return parseInt(Y,10)}),R=this.coordinates[k[0]];R&&(R.splice(k[1],1),R.length<3&&this.coordinates.splice(k[0],1))},q.prototype.getCoordinate=function(x){var k=x.split(".").map(function(Y){return parseInt(Y,10)}),R=this.coordinates[k[0]];return JSON.parse(JSON.stringify(R[k[1]]))},q.prototype.getCoordinates=function(){return this.coordinates.map(function(x){return x.concat([x[0]])})},q.prototype.updateCoordinate=function(x,k,R){this.changed();var Y=x.split("."),te=parseInt(Y[0],10),ie=parseInt(Y[1],10);this.coordinates[te]===void 0&&(this.coordinates[te]=[]),this.coordinates[te][ie]=[k,R]};var Q={MultiPoint:ee,MultiLineString:X,MultiPolygon:q},he=function(x,k,R,Y,te){var ie=R.split("."),ae=parseInt(ie[0],10),Se=ie[1]?ie.slice(1).join("."):null;return x[ae][k](Se,Y,te)},le=function(x,k){if(z.call(this,x,k),delete this.coordinates,this.model=Q[k.geometry.type],this.model===void 0)throw new TypeError(k.geometry.type+" is not a valid type");this.features=this._coordinatesToFeatures(k.geometry.coordinates)};function pe(x){this.map=x.map,this.drawConfig=JSON.parse(JSON.stringify(x.options||{})),this._ctx=x}(le.prototype=Object.create(z.prototype))._coordinatesToFeatures=function(x){var k=this,R=this.model.bind(this);return x.map(function(Y){return new R(k.ctx,{id:j(),type:y.FEATURE,properties:{},geometry:{coordinates:Y,type:k.type.replace("Multi","")}})})},le.prototype.isValid=function(){return this.features.every(function(x){return x.isValid()})},le.prototype.setCoordinates=function(x){this.features=this._coordinatesToFeatures(x),this.changed()},le.prototype.getCoordinate=function(x){return he(this.features,"getCoordinate",x)},le.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map(function(x){return x.type===y.POLYGON?x.getCoordinates():x.coordinates})))},le.prototype.updateCoordinate=function(x,k,R){he(this.features,"updateCoordinate",x,k,R),this.changed()},le.prototype.addCoordinate=function(x,k,R){he(this.features,"addCoordinate",x,k,R),this.changed()},le.prototype.removeCoordinate=function(x){he(this.features,"removeCoordinate",x),this.changed()},le.prototype.getFeatures=function(){return this.features},pe.prototype.setSelected=function(x){return this._ctx.store.setSelected(x)},pe.prototype.setSelectedCoordinates=function(x){var k=this;this._ctx.store.setSelectedCoordinates(x),x.reduce(function(R,Y){return R[Y.feature_id]===void 0&&(R[Y.feature_id]=!0,k._ctx.store.get(Y.feature_id).changed()),R},{})},pe.prototype.getSelected=function(){return this._ctx.store.getSelected()},pe.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},pe.prototype.isSelected=function(x){return this._ctx.store.isSelected(x)},pe.prototype.getFeature=function(x){return this._ctx.store.get(x)},pe.prototype.select=function(x){return this._ctx.store.select(x)},pe.prototype.deselect=function(x){return this._ctx.store.deselect(x)},pe.prototype.deleteFeature=function(x,k){return k===void 0&&(k={}),this._ctx.store.delete(x,k)},pe.prototype.addFeature=function(x){return this._ctx.store.add(x)},pe.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},pe.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},pe.prototype.setActionableState=function(x){x===void 0&&(x={});var k={trash:x.trash||!1,combineFeatures:x.combineFeatures||!1,uncombineFeatures:x.uncombineFeatures||!1};return this._ctx.events.actionable(k)},pe.prototype.changeMode=function(x,k,R){return k===void 0&&(k={}),R===void 0&&(R={}),this._ctx.events.changeMode(x,k,R)},pe.prototype.updateUIClasses=function(x){return this._ctx.ui.queueMapClasses(x)},pe.prototype.activateUIButton=function(x){return this._ctx.ui.setActiveButton(x)},pe.prototype.featuresAt=function(x,k,R){if(R===void 0&&(R="click"),R!=="click"&&R!=="touch")throw new Error("invalid buffer type");return L[R](x,k,this._ctx)},pe.prototype.newFeature=function(x){var k=x.geometry.type;return k===y.POINT?new ee(this._ctx,x):k===y.LINE_STRING?new X(this._ctx,x):k===y.POLYGON?new q(this._ctx,x):new le(this._ctx,x)},pe.prototype.isInstanceOf=function(x,k){if(x===y.POINT)return k instanceof ee;if(x===y.LINE_STRING)return k instanceof X;if(x===y.POLYGON)return k instanceof q;if(x==="MultiFeature")return k instanceof le;throw new Error("Unknown feature class: "+x)},pe.prototype.doRender=function(x){return this._ctx.store.featureChanged(x)},pe.prototype.onSetup=function(){},pe.prototype.onDrag=function(){},pe.prototype.onClick=function(){},pe.prototype.onMouseMove=function(){},pe.prototype.onMouseDown=function(){},pe.prototype.onMouseUp=function(){},pe.prototype.onMouseOut=function(){},pe.prototype.onKeyUp=function(){},pe.prototype.onKeyDown=function(){},pe.prototype.onTouchStart=function(){},pe.prototype.onTouchMove=function(){},pe.prototype.onTouchEnd=function(){},pe.prototype.onTap=function(){},pe.prototype.onStop=function(){},pe.prototype.onTrash=function(){},pe.prototype.onCombineFeature=function(){},pe.prototype.onUncombineFeature=function(){},pe.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};var Ie={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},We=Object.keys(Ie);function Xe(x){var k=Object.keys(x);return function(R,Y){Y===void 0&&(Y={});var te={},ie=k.reduce(function(ae,Se){return ae[Se]=x[Se],ae},new pe(R));return{start:function(){var ae=this;te=ie.onSetup(Y),We.forEach(function(Se){var Me,Fe=Ie[Se],Be=function(){return!1};x[Fe]&&(Be=function(){return!0}),ae.on(Se,Be,(Me=Fe,function(Ae){return ie[Me](te,Ae)}))})},stop:function(){ie.onStop(te)},trash:function(){ie.onTrash(te)},combineFeatures:function(){ie.onCombineFeatures(te)},uncombineFeatures:function(){ie.onUncombineFeatures(te)},render:function(ae,Se){ie.toDisplayFeatures(te,ae,Se)}}}}function H(x){return[].concat(x).filter(function(k){return k!==void 0})}function K(){var x=this;if(!(x.ctx.map&&x.ctx.map.getSource(h.HOT)!==void 0))return Me();var k=x.ctx.events.currentModeName();x.ctx.ui.queueMapClasses({mode:k});var R=[],Y=[];x.isDirty?Y=x.getAllIds():(R=x.getChangedIds().filter(function(Fe){return x.get(Fe)!==void 0}),Y=x.sources.hot.filter(function(Fe){return Fe.properties.id&&R.indexOf(Fe.properties.id)===-1&&x.get(Fe.properties.id)!==void 0}).map(function(Fe){return Fe.properties.id})),x.sources.hot=[];var te=x.sources.cold.length;x.sources.cold=x.isDirty?[]:x.sources.cold.filter(function(Fe){var Be=Fe.properties.id||Fe.properties.parent;return R.indexOf(Be)===-1});var ie=te!==x.sources.cold.length||Y.length>0;function ae(Fe,Be){var Ae=x.get(Fe).internal(k);x.ctx.events.currentModeRender(Ae,function(mt){x.sources[Be].push(mt)})}if(R.forEach(function(Fe){return ae(Fe,"hot")}),Y.forEach(function(Fe){return ae(Fe,"cold")}),ie&&x.ctx.map.getSource(h.COLD).setData({type:y.FEATURE_COLLECTION,features:x.sources.cold}),x.ctx.map.getSource(h.HOT).setData({type:y.FEATURE_COLLECTION,features:x.sources.hot}),x._emitSelectionChange&&(x.ctx.map.fire(_.SELECTION_CHANGE,{features:x.getSelected().map(function(Fe){return Fe.toGeoJSON()}),points:x.getSelectedCoordinates().map(function(Fe){return{type:y.FEATURE,properties:{},geometry:{type:y.POINT,coordinates:Fe.coordinates}}})}),x._emitSelectionChange=!1),x._deletedFeaturesToEmit.length){var Se=x._deletedFeaturesToEmit.map(function(Fe){return Fe.toGeoJSON()});x._deletedFeaturesToEmit=[],x.ctx.map.fire(_.DELETE,{features:Se})}function Me(){x.isDirty=!1,x.clearChangedIds()}Me(),x.ctx.map.fire(_.RENDER,{})}function ue(x){var k,R=this;this._features={},this._featureIds=new I,this._selectedFeatureIds=new I,this._selectedCoordinates=[],this._changedFeatureIds=new I,this._deletedFeaturesToEmit=[],this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=x,this.sources={hot:[],cold:[]},this.render=function(){k||(k=requestAnimationFrame(function(){k=null,K.call(R)}))},this.isDirty=!1}function _e(x,k){var R=x._selectedCoordinates.filter(function(Y){return x._selectedFeatureIds.has(Y.feature_id)});x._selectedCoordinates.length===R.length||k.silent||(x._emitSelectionChange=!0),x._selectedCoordinates=R}ue.prototype.createRenderBatch=function(){var x=this,k=this.render,R=0;return this.render=function(){R++},function(){x.render=k,R>0&&x.render()}},ue.prototype.setDirty=function(){return this.isDirty=!0,this},ue.prototype.featureChanged=function(x){return this._changedFeatureIds.add(x),this},ue.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},ue.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},ue.prototype.getAllIds=function(){return this._featureIds.values()},ue.prototype.add=function(x){return this.featureChanged(x.id),this._features[x.id]=x,this._featureIds.add(x.id),this},ue.prototype.delete=function(x,k){var R=this;return k===void 0&&(k={}),H(x).forEach(function(Y){R._featureIds.has(Y)&&(R._featureIds.delete(Y),R._selectedFeatureIds.delete(Y),k.silent||R._deletedFeaturesToEmit.indexOf(R._features[Y])===-1&&R._deletedFeaturesToEmit.push(R._features[Y]),delete R._features[Y],R.isDirty=!0)}),_e(this,k),this},ue.prototype.get=function(x){return this._features[x]},ue.prototype.getAll=function(){var x=this;return Object.keys(this._features).map(function(k){return x._features[k]})},ue.prototype.select=function(x,k){var R=this;return k===void 0&&(k={}),H(x).forEach(function(Y){R._selectedFeatureIds.has(Y)||(R._selectedFeatureIds.add(Y),R._changedFeatureIds.add(Y),k.silent||(R._emitSelectionChange=!0))}),this},ue.prototype.deselect=function(x,k){var R=this;return k===void 0&&(k={}),H(x).forEach(function(Y){R._selectedFeatureIds.has(Y)&&(R._selectedFeatureIds.delete(Y),R._changedFeatureIds.add(Y),k.silent||(R._emitSelectionChange=!0))}),_e(this,k),this},ue.prototype.clearSelected=function(x){return x===void 0&&(x={}),this.deselect(this._selectedFeatureIds.values(),{silent:x.silent}),this},ue.prototype.setSelected=function(x,k){var R=this;return k===void 0&&(k={}),x=H(x),this.deselect(this._selectedFeatureIds.values().filter(function(Y){return x.indexOf(Y)===-1}),{silent:k.silent}),this.select(x.filter(function(Y){return!R._selectedFeatureIds.has(Y)}),{silent:k.silent}),this},ue.prototype.setSelectedCoordinates=function(x){return this._selectedCoordinates=x,this._emitSelectionChange=!0,this},ue.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},ue.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},ue.prototype.getSelected=function(){var x=this;return this._selectedFeatureIds.values().map(function(k){return x.get(k)})},ue.prototype.getSelectedCoordinates=function(){var x=this;return this._selectedCoordinates.map(function(k){return{coordinates:x.get(k.feature_id).getCoordinate(k.coord_path)}})},ue.prototype.isSelected=function(x){return this._selectedFeatureIds.has(x)},ue.prototype.setFeatureProperty=function(x,k,R){this.get(x).setProperty(k,R),this.featureChanged(x)},ue.prototype.storeMapConfig=function(){var x=this;w.forEach(function(k){x.ctx.map[k]&&(x._mapInitialConfig[k]=x.ctx.map[k].isEnabled())})},ue.prototype.restoreMapConfig=function(){var x=this;Object.keys(this._mapInitialConfig).forEach(function(k){x._mapInitialConfig[k]?x.ctx.map[k].enable():x.ctx.map[k].disable()})},ue.prototype.getInitialConfigValue=function(x){return this._mapInitialConfig[x]===void 0||this._mapInitialConfig[x]};var Z=function(){for(var x=arguments,k={},R=0;R=48&&xe<=57)};function Et(xe,Ye,En){En===void 0&&(En={}),mt.stop();var jr=Se[xe];if(jr===void 0)throw new Error(xe+" is not valid");Ae=xe;var br=jr(ae,Ye);mt=n(br,ae),En.silent||ae.map.fire(_.MODE_CHANGE,{mode:xe}),ae.store.setDirty(),ae.store.render()}Be.keydown=function(xe){(xe.srcElement||xe.target).classList.contains("mapboxgl-canvas")&&(xe.keyCode!==8&&xe.keyCode!==46||!ae.options.controls.trash?ln(xe.keyCode)?mt.keydown(xe):xe.keyCode===49&&ae.options.controls.point?Et(b.DRAW_POINT):xe.keyCode===50&&ae.options.controls.line_string?Et(b.DRAW_LINE_STRING):xe.keyCode===51&&ae.options.controls.polygon&&Et(b.DRAW_POLYGON):(xe.preventDefault(),mt.trash()))},Be.keyup=function(xe){ln(xe.keyCode)&&mt.keyup(xe)},Be.zoomend=function(){ae.store.changeZoom()},Be.data=function(xe){if(xe.dataType==="style"){var Ye=ae.setup,En=ae.map,jr=ae.options,br=ae.store;jr.styles.some(function(Iu){return En.getLayer(Iu.id)})||(Ye.addLayers(),br.setDirty(),br.render())}};var _r={trash:!1,combineFeatures:!1,uncombineFeatures:!1};return{start:function(){Ae=ae.options.defaultMode,mt=n(Se[Ae](ae),ae)},changeMode:Et,actionable:function(xe){var Ye=!1;Object.keys(xe).forEach(function(En){if(_r[En]===void 0)throw new Error("Invalid action type");_r[En]!==xe[En]&&(Ye=!0),_r[En]=xe[En]}),Ye&&ae.map.fire(_.ACTIONABLE,{actions:_r})},currentModeName:function(){return Ae},currentModeRender:function(xe,Ye){return mt.render(xe,Ye)},fire:function(xe,Ye){Be[xe]&&Be[xe](Ye)},addEventListeners:function(){ae.map.on("mousemove",Be.mousemove),ae.map.on("mousedown",Be.mousedown),ae.map.on("mouseup",Be.mouseup),ae.map.on("data",Be.data),ae.map.on("touchmove",Be.touchmove),ae.map.on("touchstart",Be.touchstart),ae.map.on("touchend",Be.touchend),ae.container.addEventListener("mouseout",Be.mouseout),ae.options.keybindings&&(ae.container.addEventListener("keydown",Be.keydown),ae.container.addEventListener("keyup",Be.keyup))},removeEventListeners:function(){ae.map.off("mousemove",Be.mousemove),ae.map.off("mousedown",Be.mousedown),ae.map.off("mouseup",Be.mouseup),ae.map.off("data",Be.data),ae.map.off("touchmove",Be.touchmove),ae.map.off("touchstart",Be.touchstart),ae.map.off("touchend",Be.touchend),ae.container.removeEventListener("mouseout",Be.mouseout),ae.options.keybindings&&(ae.container.removeEventListener("keydown",Be.keydown),ae.container.removeEventListener("keyup",Be.keyup))},trash:function(xe){mt.trash(xe)},combineFeatures:function(){mt.combineFeatures()},uncombineFeatures:function(){mt.uncombineFeatures()},getMode:function(){return Ae}}}(x),x.ui=function(ae){var Se={},Me=null,Fe={mode:null,feature:null,mouse:null},Be={mode:null,feature:null,mouse:null};function Ae(xe){Be=de(Be,xe)}function mt(){var xe,Ye;if(ae.container){var En=[],jr=[];ge.forEach(function(br){Be[br]!==Fe[br]&&(En.push(br+"-"+Fe[br]),Be[br]!==null&&jr.push(br+"-"+Be[br]))}),En.length>0&&(xe=ae.container.classList).remove.apply(xe,En),jr.length>0&&(Ye=ae.container.classList).add.apply(Ye,jr),Fe=de(Fe,Be)}}function ln(xe,Ye){Ye===void 0&&(Ye={});var En=document.createElement("button");return En.className=c.CONTROL_BUTTON+" "+Ye.className,En.setAttribute("title",Ye.title),Ye.container.appendChild(En),En.addEventListener("click",function(jr){if(jr.preventDefault(),jr.stopPropagation(),jr.target===Me)return Et(),void Ye.onDeactivate();_r(xe),Ye.onActivate()},!0),En}function Et(){Me&&(Me.classList.remove(c.ACTIVE_BUTTON),Me=null)}function _r(xe){Et();var Ye=Se[xe];Ye&&Ye&&xe!=="trash"&&(Ye.classList.add(c.ACTIVE_BUTTON),Me=Ye)}return{setActiveButton:_r,queueMapClasses:Ae,updateMapClasses:mt,clearMapClasses:function(){Ae({mode:null,feature:null,mouse:null}),mt()},addButtons:function(){var xe=ae.options.controls,Ye=document.createElement("div");return Ye.className=c.CONTROL_GROUP+" "+c.CONTROL_BASE,xe&&(xe[g.LINE]&&(Se[g.LINE]=ln(g.LINE,{container:Ye,className:c.CONTROL_BUTTON_LINE,title:"LineString tool "+(ae.options.keybindings?"(l)":""),onActivate:function(){return ae.events.changeMode(b.DRAW_LINE_STRING)},onDeactivate:function(){return ae.events.trash()}})),xe[g.POLYGON]&&(Se[g.POLYGON]=ln(g.POLYGON,{container:Ye,className:c.CONTROL_BUTTON_POLYGON,title:"Polygon tool "+(ae.options.keybindings?"(p)":""),onActivate:function(){return ae.events.changeMode(b.DRAW_POLYGON)},onDeactivate:function(){return ae.events.trash()}})),xe[g.POINT]&&(Se[g.POINT]=ln(g.POINT,{container:Ye,className:c.CONTROL_BUTTON_POINT,title:"Marker tool "+(ae.options.keybindings?"(m)":""),onActivate:function(){return ae.events.changeMode(b.DRAW_POINT)},onDeactivate:function(){return ae.events.trash()}})),xe.trash&&(Se.trash=ln("trash",{container:Ye,className:c.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:function(){ae.events.trash()}})),xe.combine_features&&(Se.combine_features=ln("combineFeatures",{container:Ye,className:c.CONTROL_BUTTON_COMBINE_FEATURES,title:"Combine",onActivate:function(){ae.events.combineFeatures()}})),xe.uncombine_features&&(Se.uncombine_features=ln("uncombineFeatures",{container:Ye,className:c.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:function(){ae.events.uncombineFeatures()}}))),Ye},removeButtons:function(){Object.keys(Se).forEach(function(xe){var Ye=Se[xe];Ye.parentNode&&Ye.parentNode.removeChild(Ye),delete Se[xe]})}}}(x),x.container=te.getContainer(),x.store=new ue(x),k=x.ui.addButtons(),x.options.boxSelect&&(x.boxZoomInitial=te.boxZoom.isEnabled(),te.boxZoom.disable(),te.dragPan.disable(),te.dragPan.enable()),te.loaded()?Y.connect():(te.on("load",Y.connect),R=setInterval(function(){te.loaded()&&Y.connect()},16)),x.events.start(),k},addLayers:function(){x.map.addSource(h.COLD,{data:{type:y.FEATURE_COLLECTION,features:[]},type:"geojson"}),x.map.addSource(h.HOT,{data:{type:y.FEATURE_COLLECTION,features:[]},type:"geojson"}),x.options.styles.forEach(function(te){x.map.addLayer(te)}),x.store.setDirty(!0),x.store.render()},removeLayers:function(){x.options.styles.forEach(function(te){x.map.getLayer(te.id)&&x.map.removeLayer(te.id)}),x.map.getSource(h.COLD)&&x.map.removeSource(h.COLD),x.map.getSource(h.HOT)&&x.map.removeSource(h.HOT)}};return x.setup=Y,Y}var ve=[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],paint:{"fill-color":"#3bb2d0","fill-outline-color":"#3bb2d0","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","active","true"],["==","$type","Polygon"]],paint:{"fill-color":"#fbb03b","fill-outline-color":"#fbb03b","fill-opacity":.1}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","$type","Point"],["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","active","true"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-line-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","LineString"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-line-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-polygon-and-line-vertex-stroke-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-point-point-stroke-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-opacity":1,"circle-color":"#fff"}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#3bb2d0"}},{id:"gl-draw-point-stroke-active",type:"circle",filter:["all",["==","$type","Point"],["==","active","true"],["!=","meta","midpoint"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":5,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-fill-static",type:"fill",filter:["all",["==","mode","static"],["==","$type","Polygon"]],paint:{"fill-color":"#404040","fill-outline-color":"#404040","fill-opacity":.1}},{id:"gl-draw-polygon-stroke-static",type:"line",filter:["all",["==","mode","static"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-line-static",type:"line",filter:["all",["==","mode","static"],["==","$type","LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-point-static",type:"circle",filter:["all",["==","mode","static"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#404040"}}];function we(x){return function(k){var R=k.featureTarget;return!!R&&!!R.properties&&R.properties.meta===x}}function Oe(x){return!!x.originalEvent&&!!x.originalEvent.shiftKey&&x.originalEvent.button===0}function Re(x){return!!x.featureTarget&&!!x.featureTarget.properties&&x.featureTarget.properties.active===v.ACTIVE&&x.featureTarget.properties.meta===m.FEATURE}function Je(x){return!!x.featureTarget&&!!x.featureTarget.properties&&x.featureTarget.properties.active===v.INACTIVE&&x.featureTarget.properties.meta===m.FEATURE}function Ge(x){return x.featureTarget===void 0}function kt(x){return!!x.featureTarget&&!!x.featureTarget.properties&&x.featureTarget.properties.meta===m.FEATURE}function et(x){var k=x.featureTarget;return!!k&&!!k.properties&&k.properties.meta===m.VERTEX}function gn(x){return!!x.originalEvent&&x.originalEvent.shiftKey===!0}function Zr(x){return x.keyCode===27}function Ro(x){return x.keyCode===13}var El=Object.freeze({__proto__:null,isOfMetaType:we,isShiftMousedown:Oe,isActiveFeature:Re,isInactiveFeature:Je,noTarget:Ge,isFeature:kt,isVertex:et,isShiftDown:gn,isEscapeKey:Zr,isEnterKey:Ro,isTrue:function(){return!0}}),ss=as;function as(x,k){this.x=x,this.y=k}as.prototype={clone:function(){return new as(this.x,this.y)},add:function(x){return this.clone()._add(x)},sub:function(x){return this.clone()._sub(x)},multByPoint:function(x){return this.clone()._multByPoint(x)},divByPoint:function(x){return this.clone()._divByPoint(x)},mult:function(x){return this.clone()._mult(x)},div:function(x){return this.clone()._div(x)},rotate:function(x){return this.clone()._rotate(x)},rotateAround:function(x,k){return this.clone()._rotateAround(x,k)},matMult:function(x){return this.clone()._matMult(x)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(x){return this.x===x.x&&this.y===x.y},dist:function(x){return Math.sqrt(this.distSqr(x))},distSqr:function(x){var k=x.x-this.x,R=x.y-this.y;return k*k+R*R},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(x){return Math.atan2(this.y-x.y,this.x-x.x)},angleWith:function(x){return this.angleWithSep(x.x,x.y)},angleWithSep:function(x,k){return Math.atan2(this.x*k-this.y*x,this.x*x+this.y*k)},_matMult:function(x){var k=x[0]*this.x+x[1]*this.y,R=x[2]*this.x+x[3]*this.y;return this.x=k,this.y=R,this},_add:function(x){return this.x+=x.x,this.y+=x.y,this},_sub:function(x){return this.x-=x.x,this.y-=x.y,this},_mult:function(x){return this.x*=x,this.y*=x,this},_div:function(x){return this.x/=x,this.y/=x,this},_multByPoint:function(x){return this.x*=x.x,this.y*=x.y,this},_divByPoint:function(x){return this.x/=x.x,this.y/=x.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var x=this.y;return this.y=this.x,this.x=-x,this},_rotate:function(x){var k=Math.cos(x),R=Math.sin(x),Y=k*this.x-R*this.y,te=R*this.x+k*this.y;return this.x=Y,this.y=te,this},_rotateAround:function(x,k){var R=Math.cos(x),Y=Math.sin(x),te=k.x+R*(this.x-k.x)-Y*(this.y-k.y),ie=k.y+Y*(this.x-k.x)+R*(this.y-k.y);return this.x=te,this.y=ie,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},as.convert=function(x){return x instanceof as?x:Array.isArray(x)?new as(x[0],x[1]):x};var Or=r(ss);function Vr(x,k){var R=k.getBoundingClientRect();return new Or(x.clientX-R.left-(k.clientLeft||0),x.clientY-R.top-(k.clientTop||0))}function Jr(x,k,R,Y){return{type:y.FEATURE,properties:{meta:m.VERTEX,parent:x,coord_path:R,active:Y?v.ACTIVE:v.INACTIVE},geometry:{type:y.POINT,coordinates:k}}}function Nu(x,k,R){var Y=k.geometry.coordinates,te=R.geometry.coordinates;if(Y[1]>85||Y[1]85||te[1]=k&&this._bbox[3]>=R},Ni.prototype.intersect=function(x){return this._valid?(k=x instanceof Ni?x.bbox():x,!(this._bbox[0]>k[2]||this._bbox[2]k[3])):null;var k},Ni.prototype._fastContains=function(){if(!this._valid)return new Function("return null;");var x="return "+this._bbox[0]+"<= ll[0] &&"+this._bbox[1]+"<= ll[1] &&"+this._bbox[2]+">= ll[0] &&"+this._bbox[3]+">= ll[1]";return new Function("ll",x)},Ni.prototype.polygon=function(){return this._valid?{type:"Polygon",coordinates:[[[this._bbox[0],this._bbox[1]],[this._bbox[2],this._bbox[1]],[this._bbox[2],this._bbox[3]],[this._bbox[0],this._bbox[3]],[this._bbox[0],this._bbox[1]]]]}:null};var Om=function(x){if(!x)return[];var k=Ou(Cl(x)),R=[];return k.features.forEach(function(Y){Y.geometry&&(R=R.concat(Da(Y.geometry.coordinates)))}),R},Tm=Nm,Im=Wi,Qd={features:["FeatureCollection"],coordinates:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],geometry:["Feature"],geometries:["GeometryCollection"]},xo=Object.keys(Qd);function sh(x){for(var k=Im(),R=Om(x),Y=0;YR&&(R=Ae),mtte&&(te=mt),AeSe&&(Se=Et)});var Me=k;return R+Me.lat>85&&(Me.lat=85-R),te+Me.lat>90&&(Me.lat=90-te),Y+Me.lat<-85&&(Me.lat=-85-Y),ie+Me.lat=270&&(Me.lng-=360*Math.ceil(Math.abs(Me.lng)/360)),Me}function lh(x,k){var R=ah(x.map(function(Y){return Y.toGeoJSON()}),k);x.forEach(function(Y){var te,ie=Y.getCoordinates(),ae=function(Me){var Fe={lng:Me[0]+R.lng,lat:Me[1]+R.lat};return[Fe.lng,Fe.lat]},Se=function(Me){return Me.map(function(Fe){return ae(Fe)})};Y.type===y.POINT?te=ae(ie):Y.type===y.LINE_STRING||Y.type===y.MULTI_POINT?te=ie.map(ae):Y.type===y.POLYGON||Y.type===y.MULTI_LINE_STRING?te=ie.map(Se):Y.type===y.MULTI_POLYGON&&(te=ie.map(function(Me){return Me.map(function(Fe){return Se(Fe)})})),Y.incomingCoords(te)})}var fr={onSetup:function(x){var k=this,R={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initiallySelectedFeatureIds:x.featureIds||[]};return this.setSelected(R.initiallySelectedFeatureIds.filter(function(Y){return k.getFeature(Y)!==void 0})),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),R},fireUpdate:function(){this.map.fire(_.UPDATE,{action:p.MOVE,features:this.getSelected().map(function(x){return x.toGeoJSON()})})},fireActionable:function(){var x=this,k=this.getSelected(),R=k.filter(function(Se){return x.isInstanceOf("MultiFeature",Se)}),Y=!1;if(k.length>1){Y=!0;var te=k[0].type.replace("Multi","");k.forEach(function(Se){Se.type.replace("Multi","")!==te&&(Y=!1)})}var ie=R.length>0,ae=k.length>0;this.setActionableState({combineFeatures:Y,uncombineFeatures:ie,trash:ae})},getUniqueIds:function(x){return x.length?x.map(function(k){return k.properties.id}).filter(function(k){return k!==void 0}).reduce(function(k,R){return k.add(R),k},new I).values():[]},stopExtendedInteractions:function(x){x.boxSelectElement&&(x.boxSelectElement.parentNode&&x.boxSelectElement.parentNode.removeChild(x.boxSelectElement),x.boxSelectElement=null),this.map.dragPan.enable(),x.boxSelecting=!1,x.canBoxSelect=!1,x.dragMoving=!1,x.canDragMove=!1},onStop:function(){Ci.enable(this)},onMouseMove:function(x,k){return kt(k)&&x.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(x),!0},onMouseOut:function(x){return!x.dragMoving||this.fireUpdate()}};fr.onTap=fr.onClick=function(x,k){return Ge(k)?this.clickAnywhere(x,k):we(m.VERTEX)(k)?this.clickOnVertex(x,k):kt(k)?this.clickOnFeature(x,k):void 0},fr.clickAnywhere=function(x){var k=this,R=this.getSelectedIds();R.length&&(this.clearSelectedFeatures(),R.forEach(function(Y){return k.doRender(Y)})),Ci.enable(this),this.stopExtendedInteractions(x)},fr.clickOnVertex=function(x,k){this.changeMode(b.DIRECT_SELECT,{featureId:k.featureTarget.properties.parent,coordPath:k.featureTarget.properties.coord_path,startPos:k.lngLat}),this.updateUIClasses({mouse:d.MOVE})},fr.startOnActiveFeature=function(x,k){this.stopExtendedInteractions(x),this.map.dragPan.disable(),this.doRender(k.featureTarget.properties.id),x.canDragMove=!0,x.dragMoveLocation=k.lngLat},fr.clickOnFeature=function(x,k){var R=this;Ci.disable(this),this.stopExtendedInteractions(x);var Y=gn(k),te=this.getSelectedIds(),ie=k.featureTarget.properties.id,ae=this.isSelected(ie);if(!Y&&ae&&this.getFeature(ie).type!==y.POINT)return this.changeMode(b.DIRECT_SELECT,{featureId:ie});ae&&Y?(this.deselect(ie),this.updateUIClasses({mouse:d.POINTER}),te.length===1&&Ci.enable(this)):!ae&&Y?(this.select(ie),this.updateUIClasses({mouse:d.MOVE})):ae||Y||(te.forEach(function(Se){return R.doRender(Se)}),this.setSelected(ie),this.updateUIClasses({mouse:d.MOVE})),this.doRender(ie)},fr.onMouseDown=function(x,k){return Re(k)?this.startOnActiveFeature(x,k):this.drawConfig.boxSelect&&Oe(k)?this.startBoxSelect(x,k):void 0},fr.startBoxSelect=function(x,k){this.stopExtendedInteractions(x),this.map.dragPan.disable(),x.boxSelectStartLocation=Vr(k.originalEvent,this.map.getContainer()),x.canBoxSelect=!0},fr.onTouchStart=function(x,k){if(Re(k))return this.startOnActiveFeature(x,k)},fr.onDrag=function(x,k){return x.canDragMove?this.dragMove(x,k):this.drawConfig.boxSelect&&x.canBoxSelect?this.whileBoxSelect(x,k):void 0},fr.whileBoxSelect=function(x,k){x.boxSelecting=!0,this.updateUIClasses({mouse:d.ADD}),x.boxSelectElement||(x.boxSelectElement=document.createElement("div"),x.boxSelectElement.classList.add(c.BOX_SELECT),this.map.getContainer().appendChild(x.boxSelectElement));var R=Vr(k.originalEvent,this.map.getContainer()),Y=Math.min(x.boxSelectStartLocation.x,R.x),te=Math.max(x.boxSelectStartLocation.x,R.x),ie=Math.min(x.boxSelectStartLocation.y,R.y),ae=Math.max(x.boxSelectStartLocation.y,R.y),Se="translate("+Y+"px, "+ie+"px)";x.boxSelectElement.style.transform=Se,x.boxSelectElement.style.WebkitTransform=Se,x.boxSelectElement.style.width=te-Y+"px",x.boxSelectElement.style.height=ae-ie+"px"},fr.dragMove=function(x,k){x.dragMoving=!0,k.originalEvent.stopPropagation();var R={lng:k.lngLat.lng-x.dragMoveLocation.lng,lat:k.lngLat.lat-x.dragMoveLocation.lat};lh(this.getSelected(),R),x.dragMoveLocation=k.lngLat},fr.onTouchEnd=fr.onMouseUp=function(x,k){var R=this;if(x.dragMoving)this.fireUpdate();else if(x.boxSelecting){var Y=[x.boxSelectStartLocation,Vr(k.originalEvent,this.map.getContainer())],te=this.featuresAt(null,Y,"click"),ie=this.getUniqueIds(te).filter(function(ae){return!R.isSelected(ae)});ie.length&&(this.select(ie),ie.forEach(function(ae){return R.doRender(ae)}),this.updateUIClasses({mouse:d.MOVE}))}this.stopExtendedInteractions(x)},fr.toDisplayFeatures=function(x,k,R){k.properties.active=this.isSelected(k.properties.id)?v.ACTIVE:v.INACTIVE,R(k),this.fireActionable(),k.properties.active===v.ACTIVE&&k.geometry.type!==y.POINT&&wl(k).forEach(R)},fr.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},fr.onCombineFeatures=function(){var x=this.getSelected();if(!(x.length===0||x.length<2)){for(var k=[],R=[],Y=x[0].type.replace("Multi",""),te=0;te1){var ae=this.newFeature({type:y.FEATURE,properties:R[0].properties,geometry:{type:"Multi"+Y,coordinates:k}});this.addFeature(ae),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([ae.id]),this.map.fire(_.COMBINE_FEATURES,{createdFeatures:[ae.toGeoJSON()],deletedFeatures:R})}this.fireActionable()}},fr.onUncombineFeatures=function(){var x=this,k=this.getSelected();if(k.length!==0){for(var R=[],Y=[],te=function(ae){var Se=k[ae];x.isInstanceOf("MultiFeature",Se)&&(Se.getFeatures().forEach(function(Me){x.addFeature(Me),Me.properties=Se.properties,R.push(Me.toGeoJSON()),x.select([Me.id])}),x.deleteFeature(Se.id,{silent:!0}),Y.push(Se.toGeoJSON()))},ie=0;ie1&&this.map.fire(_.UNCOMBINE_FEATURES,{createdFeatures:R,deletedFeatures:Y}),this.fireActionable()}};var uh=we(m.VERTEX),Tu=we(m.MIDPOINT),Oi={fireUpdate:function(){this.map.fire(_.UPDATE,{action:p.CHANGE_COORDINATES,features:this.getSelected().map(function(x){return x.toGeoJSON()})})},fireActionable:function(x){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:x.selectedCoordPaths.length>0})},startDragging:function(x,k){this.map.dragPan.disable(),x.canDragMove=!0,x.dragMoveLocation=k.lngLat},stopDragging:function(x){this.map.dragPan.enable(),x.dragMoving=!1,x.canDragMove=!1,x.dragMoveLocation=null},onVertex:function(x,k){this.startDragging(x,k);var R=k.featureTarget.properties,Y=x.selectedCoordPaths.indexOf(R.coord_path);gn(k)||Y!==-1?gn(k)&&Y===-1&&x.selectedCoordPaths.push(R.coord_path):x.selectedCoordPaths=[R.coord_path];var te=this.pathsToCoordinates(x.featureId,x.selectedCoordPaths);this.setSelectedCoordinates(te)},onMidpoint:function(x,k){this.startDragging(x,k);var R=k.featureTarget.properties;x.feature.addCoordinate(R.coord_path,R.lng,R.lat),this.fireUpdate(),x.selectedCoordPaths=[R.coord_path]},pathsToCoordinates:function(x,k){return k.map(function(R){return{feature_id:x,coord_path:R}})},onFeature:function(x,k){x.selectedCoordPaths.length===0?this.startDragging(x,k):this.stopDragging(x)},dragFeature:function(x,k,R){lh(this.getSelected(),R),x.dragMoveLocation=k.lngLat},dragVertex:function(x,k,R){for(var Y=x.selectedCoordPaths.map(function(Se){return x.feature.getCoordinate(Se)}),te=ah(Y.map(function(Se){return{type:y.FEATURE,properties:{},geometry:{type:y.POINT,coordinates:Se}}}),R),ie=0;ie0?this.dragVertex(x,k,R):this.dragFeature(x,k,R),x.dragMoveLocation=k.lngLat}},Oi.onClick=function(x,k){return Ge(k)?this.clickNoTarget(x,k):Re(k)?this.clickActiveFeature(x,k):Je(k)?this.clickInactive(x,k):void this.stopDragging(x)},Oi.onTap=function(x,k){return Ge(k)?this.clickNoTarget(x,k):Re(k)?this.clickActiveFeature(x,k):Je(k)?this.clickInactive(x,k):void 0},Oi.onTouchEnd=Oi.onMouseUp=function(x){x.dragMoving&&this.fireUpdate(),this.stopDragging(x)};var So={};function Rc(x,k){return!!x.lngLat&&x.lngLat.lng===k[0]&&x.lngLat.lat===k[1]}So.onSetup=function(){var x=this.newFeature({type:y.FEATURE,properties:{},geometry:{type:y.POINT,coordinates:[]}});return this.addFeature(x),this.clearSelectedFeatures(),this.updateUIClasses({mouse:d.ADD}),this.activateUIButton(g.POINT),this.setActionableState({trash:!0}),{point:x}},So.stopDrawingAndRemove=function(x){this.deleteFeature([x.point.id],{silent:!0}),this.changeMode(b.SIMPLE_SELECT)},So.onTap=So.onClick=function(x,k){this.updateUIClasses({mouse:d.MOVE}),x.point.updateCoordinate("",k.lngLat.lng,k.lngLat.lat),this.map.fire(_.CREATE,{features:[x.point.toGeoJSON()]}),this.changeMode(b.SIMPLE_SELECT,{featureIds:[x.point.id]})},So.onStop=function(x){this.activateUIButton(),x.point.getCoordinate().length||this.deleteFeature([x.point.id],{silent:!0})},So.toDisplayFeatures=function(x,k,R){var Y=k.properties.id===x.point.id;if(k.properties.active=Y?v.ACTIVE:v.INACTIVE,!Y)return R(k)},So.onTrash=So.stopDrawingAndRemove,So.onKeyUp=function(x,k){if(Zr(k)||Ro(k))return this.stopDrawingAndRemove(x,k)};var Ra={onSetup:function(){var x=this.newFeature({type:y.FEATURE,properties:{},geometry:{type:y.POLYGON,coordinates:[[]]}});return this.addFeature(x),this.clearSelectedFeatures(),Ci.disable(this),this.updateUIClasses({mouse:d.ADD}),this.activateUIButton(g.POLYGON),this.setActionableState({trash:!0}),{polygon:x,currentVertexPosition:0}},clickAnywhere:function(x,k){if(x.currentVertexPosition>0&&Rc(k,x.polygon.coordinates[0][x.currentVertexPosition-1]))return this.changeMode(b.SIMPLE_SELECT,{featureIds:[x.polygon.id]});this.updateUIClasses({mouse:d.ADD}),x.polygon.updateCoordinate("0."+x.currentVertexPosition,k.lngLat.lng,k.lngLat.lat),x.currentVertexPosition++,x.polygon.updateCoordinate("0."+x.currentVertexPosition,k.lngLat.lng,k.lngLat.lat)},clickOnVertex:function(x){return this.changeMode(b.SIMPLE_SELECT,{featureIds:[x.polygon.id]})},onMouseMove:function(x,k){x.polygon.updateCoordinate("0."+x.currentVertexPosition,k.lngLat.lng,k.lngLat.lat),et(k)&&this.updateUIClasses({mouse:d.POINTER})}};Ra.onTap=Ra.onClick=function(x,k){return et(k)?this.clickOnVertex(x,k):this.clickAnywhere(x,k)},Ra.onKeyUp=function(x,k){Zr(k)?(this.deleteFeature([x.polygon.id],{silent:!0}),this.changeMode(b.SIMPLE_SELECT)):Ro(k)&&this.changeMode(b.SIMPLE_SELECT,{featureIds:[x.polygon.id]})},Ra.onStop=function(x){this.updateUIClasses({mouse:d.NONE}),Ci.enable(this),this.activateUIButton(),this.getFeature(x.polygon.id)!==void 0&&(x.polygon.removeCoordinate("0."+x.currentVertexPosition),x.polygon.isValid()?this.map.fire(_.CREATE,{features:[x.polygon.toGeoJSON()]}):(this.deleteFeature([x.polygon.id],{silent:!0}),this.changeMode(b.SIMPLE_SELECT,{},{silent:!0})))},Ra.toDisplayFeatures=function(x,k,R){var Y=k.properties.id===x.polygon.id;if(k.properties.active=Y?v.ACTIVE:v.INACTIVE,!Y)return R(k);if(k.geometry.coordinates.length!==0){var te=k.geometry.coordinates[0].length;if(!(te<3)){if(k.properties.meta=m.FEATURE,R(Jr(x.polygon.id,k.geometry.coordinates[0][0],"0.0",!1)),te>3){var ie=k.geometry.coordinates[0].length-3;R(Jr(x.polygon.id,k.geometry.coordinates[0][ie],"0."+ie,!1))}if(te<=4){var ae=[[k.geometry.coordinates[0][0][0],k.geometry.coordinates[0][0][1]],[k.geometry.coordinates[0][1][0],k.geometry.coordinates[0][1][1]]];if(R({type:y.FEATURE,properties:k.properties,geometry:{coordinates:ae,type:y.LINE_STRING}}),te===3)return}return R(k)}}},Ra.onTrash=function(x){this.deleteFeature([x.polygon.id],{silent:!0}),this.changeMode(b.SIMPLE_SELECT)};var Fa={onSetup:function(x){var k,R,Y=(x=x||{}).featureId,te="forward";if(Y){if(!(k=this.getFeature(Y)))throw new Error("Could not find a feature with the provided featureId");var ie=x.from;if(ie&&ie.type==="Feature"&&ie.geometry&&ie.geometry.type==="Point"&&(ie=ie.geometry),ie&&ie.type==="Point"&&ie.coordinates&&ie.coordinates.length===2&&(ie=ie.coordinates),!ie||!Array.isArray(ie))throw new Error("Please use the `from` property to indicate which point to continue the line from");var ae=k.coordinates.length-1;if(k.coordinates[ae][0]===ie[0]&&k.coordinates[ae][1]===ie[1])R=ae+1,k.addCoordinate.apply(k,[R].concat(k.coordinates[ae]));else{if(k.coordinates[0][0]!==ie[0]||k.coordinates[0][1]!==ie[1])throw new Error("`from` should match the point at either the start or the end of the provided LineString");te="backwards",R=0,k.addCoordinate.apply(k,[R].concat(k.coordinates[0]))}}else k=this.newFeature({type:y.FEATURE,properties:{},geometry:{type:y.LINE_STRING,coordinates:[]}}),R=0,this.addFeature(k);return this.clearSelectedFeatures(),Ci.disable(this),this.updateUIClasses({mouse:d.ADD}),this.activateUIButton(g.LINE),this.setActionableState({trash:!0}),{line:k,currentVertexPosition:R,direction:te}},clickAnywhere:function(x,k){if(x.currentVertexPosition>0&&Rc(k,x.line.coordinates[x.currentVertexPosition-1])||x.direction==="backwards"&&Rc(k,x.line.coordinates[x.currentVertexPosition+1]))return this.changeMode(b.SIMPLE_SELECT,{featureIds:[x.line.id]});this.updateUIClasses({mouse:d.ADD}),x.line.updateCoordinate(x.currentVertexPosition,k.lngLat.lng,k.lngLat.lat),x.direction==="forward"?(x.currentVertexPosition++,x.line.updateCoordinate(x.currentVertexPosition,k.lngLat.lng,k.lngLat.lat)):x.line.addCoordinate(0,k.lngLat.lng,k.lngLat.lat)},clickOnVertex:function(x){return this.changeMode(b.SIMPLE_SELECT,{featureIds:[x.line.id]})},onMouseMove:function(x,k){x.line.updateCoordinate(x.currentVertexPosition,k.lngLat.lng,k.lngLat.lat),et(k)&&this.updateUIClasses({mouse:d.POINTER})}};Fa.onTap=Fa.onClick=function(x,k){if(et(k))return this.clickOnVertex(x,k);this.clickAnywhere(x,k)},Fa.onKeyUp=function(x,k){Ro(k)?this.changeMode(b.SIMPLE_SELECT,{featureIds:[x.line.id]}):Zr(k)&&(this.deleteFeature([x.line.id],{silent:!0}),this.changeMode(b.SIMPLE_SELECT))},Fa.onStop=function(x){Ci.enable(this),this.activateUIButton(),this.getFeature(x.line.id)!==void 0&&(x.line.removeCoordinate(""+x.currentVertexPosition),x.line.isValid()?this.map.fire(_.CREATE,{features:[x.line.toGeoJSON()]}):(this.deleteFeature([x.line.id],{silent:!0}),this.changeMode(b.SIMPLE_SELECT,{},{silent:!0})))},Fa.onTrash=function(x){this.deleteFeature([x.line.id],{silent:!0}),this.changeMode(b.SIMPLE_SELECT)},Fa.toDisplayFeatures=function(x,k,R){var Y=k.properties.id===x.line.id;if(k.properties.active=Y?v.ACTIVE:v.INACTIVE,!Y)return R(k);k.geometry.coordinates.length<2||(k.properties.meta=m.FEATURE,R(Jr(x.line.id,k.geometry.coordinates[x.direction==="forward"?k.geometry.coordinates.length-2:1],""+(x.direction==="forward"?k.geometry.coordinates.length-2:1),!1)),R(k))};var ep={simple_select:fr,direct_select:Oi,draw_point:So,draw_polygon:Ra,draw_line_string:Fa},km={defaultMode:b.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:ve,modes:ep,controls:{},userProperties:!1},Fc={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},ch={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function Ol(x,k){return x.map(function(R){return R.source?R:de(R,{id:R.id+"."+k,source:k==="hot"?h.HOT:h.COLD})})}var Bc={exports:{}};(function(x,k){var R="__lodash_hash_undefined__",Y=9007199254740991,te="[object Arguments]",ie="[object Array]",ae="[object Boolean]",Se="[object Date]",Me="[object Error]",Fe="[object Function]",Be="[object Map]",Ae="[object Number]",mt="[object Object]",ln="[object Promise]",Et="[object RegExp]",_r="[object Set]",xe="[object String]",Ye="[object Symbol]",En="[object WeakMap]",jr="[object ArrayBuffer]",br="[object DataView]",Iu=/^\[object .+?Constructor\]$/,np=/^(?:0|[1-9]\d*)$/,wn={};wn["[object Float32Array]"]=wn["[object Float64Array]"]=wn["[object Int8Array]"]=wn["[object Int16Array]"]=wn["[object Int32Array]"]=wn["[object Uint8Array]"]=wn["[object Uint8ClampedArray]"]=wn["[object Uint16Array]"]=wn["[object Uint32Array]"]=!0,wn[te]=wn[ie]=wn[jr]=wn[ae]=wn[br]=wn[Se]=wn[Me]=wn[Fe]=wn[Be]=wn[Ae]=wn[mt]=wn[Et]=wn[_r]=wn[xe]=wn[En]=!1;var hh=typeof or=="object"&&or&&or.Object===Object&&or,dh=typeof self=="object"&&self&&self.Object===Object&&self,Ns=hh||dh||Function("return this")(),rp=k&&!k.nodeType&&k,P=rp&&x&&!x.nodeType&&x,U=P&&P.exports===rp,ne=U&&hh.process,Ee=function(){try{return ne&&ne.binding&&ne.binding("util")}catch{}}(),wt=Ee&&Ee.isTypedArray;function rt(fe,be){for(var Ve=-1,at=fe==null?0:fe.length;++Vegi))return!1;var Ii=xn.get(fe);if(Ii&&xn.get(be))return Ii==be;var Mi=-1,Ml=!0,ku=2&Ve?new k1:void 0;for(xn.set(fe,be),xn.set(be,fe);++Mi-1},Mu.prototype.set=function(fe,be){var Ve=this.__data__,at=P1(Ve,fe);return at<0?(++this.size,Ve.push([fe,be])):Ve[at][1]=be,this},yh.prototype.clear=function(){this.size=0,this.__data__={hash:new mh,map:new(Rm||Mu),string:new mh}},yh.prototype.delete=function(fe){var be=A1(this,fe).delete(fe);return this.size-=be?1:0,be},yh.prototype.get=function(fe){return A1(this,fe).get(fe)},yh.prototype.has=function(fe){return A1(this,fe).has(fe)},yh.prototype.set=function(fe,be){var Ve=A1(this,fe),at=Ve.size;return Ve.set(fe,be),this.size+=Ve.size==at?0:1,this},k1.prototype.add=k1.prototype.push=function(fe){return this.__data__.set(fe,R),this},k1.prototype.has=function(fe){return this.__data__.has(fe)},Vc.prototype.clear=function(){this.__data__=new Mu,this.size=0},Vc.prototype.delete=function(fe){var be=this.__data__,Ve=be.delete(fe);return this.size=be.size,Ve},Vc.prototype.get=function(fe){return this.__data__.get(fe)},Vc.prototype.has=function(fe){return this.__data__.has(fe)},Vc.prototype.set=function(fe,be){var Ve=this.__data__;if(Ve instanceof Mu){var at=Ve.__data__;if(!Rm||at.length<199)return at.push([fe,be]),this.size=++Ve.size,this;Ve=this.__data__=new yh(at)}return Ve.set(fe,be),this.size=Ve.size,this};var ure=L3?function(fe){return fe==null?[]:(fe=Object(fe),function(be,Ve){for(var at=-1,Er=be==null?0:be.length,xn=0,qr=[];++at-1&&fe%1==0&&fe-1&&fe%1==0&&fe<=Y}function U3(fe){var be=typeof fe;return fe!=null&&(be=="object"||be=="function")}function Vm(fe){return fe!=null&&typeof fe=="object"}var z3=wt?function(fe){return function(be){return fe(be)}}(wt):function(fe){return Vm(fe)&&q3(fe.length)&&!!wn[Bm(fe)]};function hre(fe){return(be=fe)!=null&&q3(be.length)&&!j3(be)?sre(fe):lre(fe);var be}x.exports=function(fe,be){return F3(fe,be)}})(Bc,Bc.exports);var fh=r(Bc.exports);function tp(x,k){return x.length===k.length&&JSON.stringify(x.map(function(R){return R}).sort())===JSON.stringify(k.map(function(R){return R}).sort())}var Pm={Polygon:q,LineString:X,Point:ee,MultiPolygon:le,MultiLineString:le,MultiPoint:le},Am=Object.freeze({__proto__:null,CommonSelectors:El,constrainFeatureMovement:ah,createMidPoint:Nu,createSupplementaryPoints:wl,createVertex:Jr,doubleClickZoom:Ci,euclideanDistance:G,featuresAt:L,getFeatureAtAndSetCursors:$,isClick:J,isEventAtCoordinates:Rc,isTap:W,mapEventToBoundingBox:T,ModeHandler:n,moveFeatures:lh,sortFeatures:M,stringSetsAreEqual:tp,StringSet:I,theme:ve,toDenseArray:H}),Lm=function(x,k){var R={options:x=function(te){te===void 0&&(te={});var ie=de(te);return te.controls||(ie.controls={}),te.displayControlsDefault===!1?ie.controls=de(ch,te.controls):ie.controls=de(Fc,te.controls),(ie=de(km,ie)).styles=Ol(ie.styles,"cold").concat(Ol(ie.styles,"hot")),ie}(x)};k=function(te,ie){return ie.modes=b,ie.getFeatureIdsAt=function(ae){return L.click({point:ae},null,te).map(function(Se){return Se.properties.id})},ie.getSelectedIds=function(){return te.store.getSelectedIds()},ie.getSelected=function(){return{type:y.FEATURE_COLLECTION,features:te.store.getSelectedIds().map(function(ae){return te.store.get(ae)}).map(function(ae){return ae.toGeoJSON()})}},ie.getSelectedPoints=function(){return{type:y.FEATURE_COLLECTION,features:te.store.getSelectedCoordinates().map(function(ae){return{type:y.FEATURE,properties:{},geometry:{type:y.POINT,coordinates:ae.coordinates}}})}},ie.set=function(ae){if(ae.type===void 0||ae.type!==y.FEATURE_COLLECTION||!Array.isArray(ae.features))throw new Error("Invalid FeatureCollection");var Se=te.store.createRenderBatch(),Me=te.store.getAllIds().slice(),Fe=ie.add(ae),Be=new I(Fe);return(Me=Me.filter(function(Ae){return!Be.has(Ae)})).length&&ie.delete(Me),Se(),Fe},ie.add=function(ae){var Se=JSON.parse(JSON.stringify(rh(ae))).features.map(function(Me){if(Me.id=Me.id||j(),Me.geometry===null)throw new Error("Invalid geometry: null");if(te.store.get(Me.id)===void 0||te.store.get(Me.id).type!==Me.geometry.type){var Fe=Pm[Me.geometry.type];if(Fe===void 0)throw new Error("Invalid geometry type: "+Me.geometry.type+".");var Be=new Fe(te,Me);te.store.add(Be)}else{var Ae=te.store.get(Me.id);Ae.properties=Me.properties,fh(Ae.properties,Me.properties)||te.store.featureChanged(Ae.id),fh(Ae.getCoordinates(),Me.geometry.coordinates)||Ae.incomingCoords(Me.geometry.coordinates)}return Me.id});return te.store.render(),Se},ie.get=function(ae){var Se=te.store.get(ae);if(Se)return Se.toGeoJSON()},ie.getAll=function(){return{type:y.FEATURE_COLLECTION,features:te.store.getAll().map(function(ae){return ae.toGeoJSON()})}},ie.delete=function(ae){return te.store.delete(ae,{silent:!0}),ie.getMode()!==b.DIRECT_SELECT||te.store.getSelectedIds().length?te.store.render():te.events.changeMode(b.SIMPLE_SELECT,void 0,{silent:!0}),ie},ie.deleteAll=function(){return te.store.delete(te.store.getAllIds(),{silent:!0}),ie.getMode()===b.DIRECT_SELECT?te.events.changeMode(b.SIMPLE_SELECT,void 0,{silent:!0}):te.store.render(),ie},ie.changeMode=function(ae,Se){return Se===void 0&&(Se={}),ae===b.SIMPLE_SELECT&&ie.getMode()===b.SIMPLE_SELECT?(tp(Se.featureIds||[],te.store.getSelectedIds())||(te.store.setSelected(Se.featureIds,{silent:!0}),te.store.render()),ie):(ae===b.DIRECT_SELECT&&ie.getMode()===b.DIRECT_SELECT&&Se.featureId===te.store.getSelectedIds()[0]||te.events.changeMode(ae,Se,{silent:!0}),ie)},ie.getMode=function(){return te.events.getMode()},ie.trash=function(){return te.events.trash({silent:!0}),ie},ie.combineFeatures=function(){return te.events.combineFeatures({silent:!0}),ie},ie.uncombineFeatures=function(){return te.events.uncombineFeatures({silent:!0}),ie},ie.setFeatureProperty=function(ae,Se,Me){return te.store.setFeatureProperty(ae,Se,Me),ie},ie}(R,k),R.api=k;var Y=se(R);return k.onAdd=Y.onAdd,k.onRemove=Y.onRemove,k.types=g,k.options=x,k};function Tl(x){Lm(x,this)}return Tl.modes=ep,Tl.constants=S,Tl.lib=Am,Tl})})(OO);var Y9=OO.exports;const TO=Ls(Y9);var ri=63710088e-1,qy={centimeters:ri*100,centimetres:ri*100,degrees:ri/111325,feet:ri*3.28084,inches:ri*39.37,kilometers:ri/1e3,kilometres:ri/1e3,meters:ri,metres:ri,miles:ri/1609.344,millimeters:ri*1e3,millimetres:ri*1e3,nauticalmiles:ri/1852,radians:1,yards:ri*1.0936},IO={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/ri,yards:1.0936133},Uy={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function zr(t,e,n){n===void 0&&(n={});var r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function MO(t,e,n){switch(t){case"Point":return xt(e).geometry;case"LineString":return kn(e).geometry;case"Polygon":return It(e).geometry;case"MultiPoint":return Mp(e).geometry;case"MultiLineString":return qu(e).geometry;case"MultiPolygon":return jo(e).geometry;default:throw new Error(t+" is invalid")}}function xt(t,e,n){if(n===void 0&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!oi(t[0])||!oi(t[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:t};return zr(r,e,n)}function kO(t,e,n){return n===void 0&&(n={}),ft(t.map(function(r){return xt(r,e)}),n)}function It(t,e,n){n===void 0&&(n={});for(var r=0,i=t;r=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n}function Fh(t,e){e===void 0&&(e="kilometers");var n=qy[e];if(!n)throw new Error(e+" units is invalid");return t*n}function nf(t,e){e===void 0&&(e="kilometers");var n=qy[e];if(!n)throw new Error(e+" units is invalid");return t/n}function zy(t,e){return Uu(nf(t,e))}function rf(t){var e=t%360;return e<0&&(e+=360),e}function Uu(t){var e=t%(2*Math.PI);return e*180/Math.PI}function ii(t){var e=t%360;return e*Math.PI/180}function of(t,e,n){if(e===void 0&&(e="kilometers"),n===void 0&&(n="kilometers"),!(t>=0))throw new Error("length must be a positive number");return Fh(nf(t,e),n)}function db(t,e,n){if(e===void 0&&(e="meters"),n===void 0&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var r=Uy[e];if(!r)throw new Error("invalid original units");var i=Uy[n];if(!i)throw new Error("invalid final units");return t/r*i}function oi(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function An(t){return!!t&&t.constructor===Object}function DO(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(t.length!==4&&t.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(function(e){if(!oi(e))throw new Error("bbox must only contain numbers")})}function RO(t){if(!t)throw new Error("id is required");if(["string","number"].indexOf(typeof t)===-1)throw new Error("id must be a number or a string")}const FO=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:Uy,bearingToAzimuth:rf,convertArea:db,convertLength:of,degreesToRadians:ii,earthRadius:ri,factors:qy,feature:zr,featureCollection:ft,geometry:MO,geometryCollection:hb,isNumber:oi,isObject:An,lengthToDegrees:zy,lengthToRadians:nf,lineString:kn,lineStrings:AO,multiLineString:qu,multiPoint:Mp,multiPolygon:jo,point:xt,points:kO,polygon:It,polygons:PO,radiansToDegrees:Uu,radiansToLength:Fh,round:LO,unitsFactors:IO,validateBBox:DO,validateId:RO},Symbol.toStringTag,{value:"Module"}));function xr(t,e,n){if(t!==null)for(var r,i,o,s,a,u,l,f=0,c=0,h,d=t.type,g=d==="FeatureCollection",y=d==="Feature",b=g?t.features.length:1,_=0;_u||g>l||y>f){a=c,u=r,l=g,f=y,o=0;return}var b=kn([a,c],n.properties);if(e(b,r,i,y,o)===!1)return!1;o++,a=c})===!1)return!1}}})}function vb(t,e,n){var r=n,i=!1;return Yl(t,function(o,s,a,u,l){i===!1&&n===void 0?r=o:r=e(r,o,s,a,u,l),i=!0}),r}function _b(t,e){if(!t)throw new Error("geojson is required");yi(t,function(n,r,i){if(n.geometry!==null){var o=n.geometry.type,s=n.geometry.coordinates;switch(o){case"LineString":if(e(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var a=0;an[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2]=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function pt(t){if(Array.isArray(t))return t;if(t.type==="Feature"){if(t.geometry!==null)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Eb(t){if(t.length>1&&oi(t[0])&&oi(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return Eb(t[0]);throw new Error("coordinates must only contain numbers")}function UO(t,e,n){if(!e||!n)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.type)}function kp(t,e,n){if(!t)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!t||t.type!=="Feature"||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)}function Wl(t,e,n){if(!t)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!t||t.type!=="FeatureCollection")throw new Error("Invalid input to "+n+", FeatureCollection required");for(var r=0,i=t.features;r * v. 1.2.0 * https://github.com/RaumZeit/MarchingSquares.js * * MarchingSquaresJS is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * MarchingSquaresJS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * As additional permission under GNU Affero General Public License version 3 * section 7, third-party projects (personal or commercial) may distribute, * include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the * requirement that said third-party project for that reason alone becomes * subject to any requirement of the GNU Affero General Public License version 3. * Any modifications to MarchingSquaresJS, however, must be shared with the public * and made available. * * In summary this: * - allows you to use MarchingSquaresJS at no cost * - allows you to use MarchingSquaresJS for both personal and commercial purposes * - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any * license as long as this license notice is included * - enables you to keep the source code of your program that uses MarchingSquaresJS * undisclosed * - forces you to share any modifications you have made to MarchingSquaresJS, * e.g. bug-fixes * * You should have received a copy of the GNU Affero General Public License * along with MarchingSquaresJS. If not, see . */var HO={successCallback:null,verbose:!1},Hy={};function t7(t,e,n){n=n||{};for(var r=Object.keys(HO),i=0;i=e?8:0,a|=l>=e?4:0,a|=f>=e?2:0,a|=c>=e?1:0;var h=!1;if(a===5||a===10){var d=(u+l+f+c)/4;a===5&&d=0;h--)if(Math.abs(e[h][0][0]-f)<=r&&Math.abs(e[h][0][1]-c)<=r){for(var d=u.path.length-2;d>=0;--d)e[h].unshift(u.path[d]);l=!0;break}}l||(e[n++]=u.path)}})}),e}function o7(t,e,n){var r=t.length,i=[],o=[0,0,1,1,0,0,0,0,-1,0,1,1,-1,0,-1,0],s=[0,-1,0,0,1,1,1,1,0,-1,0,0,0,-1,0,0],a,u,l=["none","left","bottom","left","right","none","bottom","left","top","top","none","top","right","right","bottom","none"],f=["none","bottom","right","right","top","top","top","top","left","bottom","right","right","left","bottom","left","none"],d,c=t[e][n],h=c.cval,d=l[h],g=xb(c,d);i.push([n+g[0],e+g[1]]),d=f[h],g=xb(c,d),i.push([n+g[0],e+g[1]]),YO(c);for(var y=n+o[h],b=e+s[h],_=h;y>=0&&b>=0&&b"u"));){if(h=c.cval,h===0||h===15)return{path:i,info:"mergeable"};d=f[h],a=o[h],u=s[h],(h===5||h===10)&&(h===5?c.flipped?s[_]===-1?(d="left",a=-1,u=0):(d="right",a=1,u=0):o[_]===-1&&(d="bottom",a=0,u=-1):h===10&&(c.flipped?o[_]===-1?(d="top",a=0,u=1):(d="bottom",a=0,u=-1):s[_]===1&&(d="left",a=-1,u=0))),g=xb(c,d),i.push([y+g[0],b+g[1]]),YO(c),y+=a,b+=u,_=h}return{path:i,info:"closed"}}function s7(t,e){if(e=e||{},!An(e))throw new Error("options is invalid");var n=e.zProperty||"elevation",r=e.flip,i=e.flags;Wl(t,"Point","input must contain Points");for(var o=a7(t,r),s=[],a=0;aM;){if(T-M>600){var A=T-M+1,L=O-M+1,B=Math.log(A),$=.5*Math.exp(2*B/3),G=.5*Math.sqrt(B*$*(A-$)/A)*(L-A/2<0?-1:1),J=Math.max(M,Math.floor(O-L*$/A+G)),W=Math.min(T,Math.floor(O+(A-L)*$/A+G));S(C,O,J,W,I)}var V=C[O],D=M,j=T;for(r(C,M,O),I(C[T],V)>0&&r(C,M,T);D0;)j--}I(C[M],V)===0?r(C,M,j):r(C,++j,T),j<=O&&(M=j+1),O<=j&&(T=j-1)}})(p,m,v||0,w||p.length-1,N||i)}function r(p,m,v){var w=p[m];p[m]=p[v],p[v]=w}function i(p,m){return pm?1:0}var o=function(p){p===void 0&&(p=9),this._maxEntries=Math.max(4,p),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(p,m,v){if(!v)return m.indexOf(p);for(var w=0;w=p.minX&&m.maxY>=p.minY}function b(p){return{children:p,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function _(p,m,v,w,N){for(var S=[m,v];S.length;)if(!((v=S.pop())-(m=S.pop())<=w)){var C=m+Math.ceil((v-m)/w/2)*w;n(p,C,m,v,N),S.push(m,C,C,v)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(p){var m=this.data,v=[];if(!y(p,m))return v;for(var w=this.toBBox,N=[];m;){for(var S=0;S=0&&N[m].children.length>this._maxEntries;)this._split(N,m),m--;this._adjustParentBBoxes(w,N,m)},o.prototype._split=function(p,m){var v=p[m],w=v.children.length,N=this._minEntries;this._chooseSplitAxis(v,N,w);var S=this._chooseSplitIndex(v,N,w),C=b(v.children.splice(S,v.children.length-S));C.height=v.height,C.leaf=v.leaf,a(v,this.toBBox),a(C,this.toBBox),m?p[m-1].children.push(C):this._splitRoot(v,C)},o.prototype._splitRoot=function(p,m){this.data=b([p,m]),this.data.height=p.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(p,m,v){for(var w,N,S,C,O,M,T,I=1/0,A=1/0,L=m;L<=v-m;L++){var B=u(p,0,L,this.toBBox),$=u(p,L,v,this.toBBox),G=(N=B,S=$,C=void 0,O=void 0,M=void 0,T=void 0,C=Math.max(N.minX,S.minX),O=Math.max(N.minY,S.minY),M=Math.min(N.maxX,S.maxX),T=Math.min(N.maxY,S.maxY),Math.max(0,M-C)*Math.max(0,T-O)),J=h(B)+h($);G=m;I--){var A=p.children[I];l(C,p.leaf?N(A):A),O+=d(C)}return O},o.prototype._adjustParentBBoxes=function(p,m,v){for(var w=v;w>=0;w--)l(m[w],p)},o.prototype._condense=function(p){for(var m=p.length-1,v=void 0;m>=0;m--)p[m].children.length===0?m>0?(v=p[m-1].children).splice(v.indexOf(p[m]),1):this.clear():a(p[m],this.toBBox)},o})})(WO);var f7=WO.exports;class h7{constructor(e=[],n=d7){if(this.data=e,this.length=this.data.length,this.compare=n,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:n,compare:r}=this,i=n[e];for(;e>0;){const o=e-1>>1,s=n[o];if(r(i,s)>=0)break;n[e]=s,e=o}n[e]=i}_down(e){const{data:n,compare:r}=this,i=this.length>>1,o=n[e];for(;e=0)break;n[e]=a,e=s}n[e]=o}}function d7(t,e){return te?1:0}const p7=jy(Object.freeze(Object.defineProperty({__proto__:null,default:h7},Symbol.toStringTag,{value:"Module"})));var Gy={exports:{}},g7=function(e,n,r,i){var o=e[0],s=e[1],a=!1;r===void 0&&(r=0),i===void 0&&(i=n.length);for(var u=(i-r)/2,l=0,f=u-1;ls!=g>s&&o<(d-c)*(s-h)/(g-h)+c;y&&(a=!a)}return a},m7=function(e,n,r,i){var o=e[0],s=e[1],a=!1;r===void 0&&(r=0),i===void 0&&(i=n.length);for(var u=i-r,l=0,f=u-1;ls!=g>s&&o<(d-c)*(s-h)/(g-h)+c;y&&(a=!a)}return a},XO=g7,KO=m7;Gy.exports=function(e,n,r,i){return n.length>0&&Array.isArray(n[0])?KO(e,n,r,i):XO(e,n,r,i)},Gy.exports.nested=KO,Gy.exports.flat=XO;var y7=Gy.exports,Cb={exports:{}};(function(t,e){(function(n,r){r(e)})(or,function(n){const i=33306690738754706e-32;function o(y,b,_,p,m){let v,w,N,S,C=b[0],O=p[0],M=0,T=0;O>C==O>-C?(v=C,C=b[++M]):(v=O,O=p[++T]);let I=0;if(MC==O>-C?(N=v-((w=C+v)-C),C=b[++M]):(N=v-((w=O+v)-O),O=p[++T]),v=w,N!==0&&(m[I++]=N);MC==O>-C?(N=v-((w=v+C)-(S=w-v))+(C-S),C=b[++M]):(N=v-((w=v+O)-(S=w-v))+(O-S),O=p[++T]),v=w,N!==0&&(m[I++]=N);for(;M0!=N>0)return S;const C=Math.abs(w+N);return Math.abs(S)>=a*C?S:-function(O,M,T,I,A,L,B){let $,G,J,W,V,D,j,z,ee,X,q,Q,he,le,pe,Ie,We,Xe;const H=O-A,K=T-A,ue=M-L,_e=I-L;V=(pe=(z=H-(j=(D=134217729*H)-(D-H)))*(X=_e-(ee=(D=134217729*_e)-(D-_e)))-((le=H*_e)-j*ee-z*ee-j*X))-(q=pe-(We=(z=ue-(j=(D=134217729*ue)-(D-ue)))*(X=K-(ee=(D=134217729*K)-(D-K)))-((Ie=ue*K)-j*ee-z*ee-j*X))),f[0]=pe-(q+V)+(V-We),V=(he=le-((Q=le+q)-(V=Q-le))+(q-V))-(q=he-Ie),f[1]=he-(q+V)+(V-Ie),V=(Xe=Q+q)-Q,f[2]=Q-(Xe-V)+(q-V),f[3]=Xe;let Z=function(ve,we){let Oe=we[0];for(let Re=1;Re=oe||-Z>=oe||($=O-(H+(V=O-H))+(V-A),J=T-(K+(V=T-K))+(V-A),G=M-(ue+(V=M-ue))+(V-L),W=I-(_e+(V=I-_e))+(V-L),$===0&&G===0&&J===0&&W===0)||(oe=l*B+i*Math.abs(Z),(Z+=H*W+_e*$-(ue*J+K*G))>=oe||-Z>=oe))return Z;V=(pe=(z=$-(j=(D=134217729*$)-(D-$)))*(X=_e-(ee=(D=134217729*_e)-(D-_e)))-((le=$*_e)-j*ee-z*ee-j*X))-(q=pe-(We=(z=G-(j=(D=134217729*G)-(D-G)))*(X=K-(ee=(D=134217729*K)-(D-K)))-((Ie=G*K)-j*ee-z*ee-j*X))),g[0]=pe-(q+V)+(V-We),V=(he=le-((Q=le+q)-(V=Q-le))+(q-V))-(q=he-Ie),g[1]=he-(q+V)+(V-Ie),V=(Xe=Q+q)-Q,g[2]=Q-(Xe-V)+(q-V),g[3]=Xe;const de=o(4,f,4,g,c);V=(pe=(z=H-(j=(D=134217729*H)-(D-H)))*(X=W-(ee=(D=134217729*W)-(D-W)))-((le=H*W)-j*ee-z*ee-j*X))-(q=pe-(We=(z=ue-(j=(D=134217729*ue)-(D-ue)))*(X=J-(ee=(D=134217729*J)-(D-J)))-((Ie=ue*J)-j*ee-z*ee-j*X))),g[0]=pe-(q+V)+(V-We),V=(he=le-((Q=le+q)-(V=Q-le))+(q-V))-(q=he-Ie),g[1]=he-(q+V)+(V-Ie),V=(Xe=Q+q)-Q,g[2]=Q-(Xe-V)+(q-V),g[3]=Xe;const ge=o(de,c,4,g,h);V=(pe=(z=$-(j=(D=134217729*$)-(D-$)))*(X=W-(ee=(D=134217729*W)-(D-W)))-((le=$*W)-j*ee-z*ee-j*X))-(q=pe-(We=(z=G-(j=(D=134217729*G)-(D-G)))*(X=J-(ee=(D=134217729*J)-(D-J)))-((Ie=G*J)-j*ee-z*ee-j*X))),g[0]=pe-(q+V)+(V-We),V=(he=le-((Q=le+q)-(V=Q-le))+(q-V))-(q=he-Ie),g[1]=he-(q+V)+(V-Ie),V=(Xe=Q+q)-Q,g[2]=Q-(Xe-V)+(q-V),g[3]=Xe;const se=o(ge,h,4,g,d);return d[se-1]}(y,b,_,p,m,v,C)},n.orient2dfast=function(y,b,_,p,m,v){return(b-v)*(_-m)-(y-m)*(p-v)},Object.defineProperty(n,"__esModule",{value:!0})})})(Cb,Cb.exports);var v7=Cb.exports,ZO=f7,Yy=p7,_7=y7,b7=v7.orient2d;Yy.default&&(Yy=Yy.default),Sb.exports=JO,Sb.exports.default=JO;function JO(t,e,n){e=Math.max(0,e===void 0?2:e),n=n||0;var r=C7(t),i=new ZO(16);i.toBBox=function(p){return{minX:p[0],minY:p[1],maxX:p[0],maxY:p[1]}},i.compareMinX=function(p,m){return p[0]-m[0]},i.compareMinY=function(p,m){return p[1]-m[1]},i.load(t);for(var o=[],s=0,a;so||a.push({node:f,dist:c})}for(;a.length&&!a.peek().node.children;){var h=a.pop(),d=h.node,g=Tb(d,e,n),y=Tb(d,r,i);if(h.dist=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function e2(t,e,n){for(var r=Math.min(t[0],e[0]),i=Math.min(t[1],e[1]),o=Math.max(t[0],e[0]),s=Math.max(t[1],e[1]),a=n.search({minX:r,minY:i,maxX:o,maxY:s}),u=0;u0!=Vh(t,e,r)>0&&Vh(n,r,t)>0!=Vh(n,r,e)>0}function Nb(t){var e=t.p,n=t.next.p;return t.minX=Math.min(e[0],n[0]),t.minY=Math.min(e[1],n[1]),t.maxX=Math.max(e[0],n[0]),t.maxY=Math.max(e[1],n[1]),t}function C7(t){for(var e=t[0],n=t[0],r=t[0],i=t[0],o=0;or[0]&&(r=s),s[1]i[1]&&(i=s)}var a=[e,n,r,i],u=a.slice();for(o=0;o1?(r=n[0],i=n[1]):a>0&&(r+=o*a,i+=s*a)}return o=t[0]-r,s=t[1]-i,o*o+s*s}function Wy(t,e,n,r,i,o,s,a){var u=n-t,l=r-e,f=s-i,c=a-o,h=t-i,d=e-o,g=u*u+l*l,y=u*f+l*c,b=f*f+c*c,_=u*h+l*d,p=f*h+c*d,m=g*b-y*y,v,w,N,S,C=m,O=m;m===0?(w=0,C=1,S=p,O=b):(w=y*p-b*_,S=g*p-y*_,w<0?(w=0,S=p,O=b):w>C&&(w=C,S=p+y,O=b)),S<0?(S=0,-_<0?w=0:-_>g?w=C:(w=-_,C=g)):S>O&&(S=O,-_+y<0?w=0:-_+y>g?w=C:(w=-_+y,C=g)),v=w===0?0:w/C,N=S===0?0:S/O;var M=(1-v)*t+v*n,T=(1-v)*e+v*r,I=(1-N)*i+N*s,A=(1-N)*o+N*a,L=I-M,B=A-T;return L*L+B*B}function N7(t,e){return t[0]===e[0]?t[1]-e[1]:t[0]-e[0]}function O7(t){t.sort(N7);for(var e=[],n=0;n=2&&Vh(e[e.length-2],e[e.length-1],t[n])<=0;)e.pop();e.push(t[n])}for(var r=[],i=t.length-1;i>=0;i--){for(;r.length>=2&&Vh(r[r.length-2],r[r.length-1],t[i])<=0;)r.pop();r.push(t[i])}return r.pop(),e.pop(),e.concat(r)}var T7=Sb.exports;const I7=Ls(T7);function n2(t,e){e===void 0&&(e={}),e.concavity=e.concavity||1/0;var n=[];if(xr(t,function(i){n.push([i[0],i[1]])}),!n.length)return null;var r=I7(n,e.concavity);return r.length>3?It([r]):null}function Xn(t,e,n){if(n===void 0&&(n={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var r=qn(t),i=Wn(e),o=i.type,s=e.bbox,a=i.coordinates;if(s&&M7(r,s)===!1)return!1;o==="Polygon"&&(a=[a]);for(var u=!1,l=0;lt[1]!=l>t[1]&&t[0]<(u-s)*(t[1]-a)/(l-a)+s;c&&(r=!r)}return r}function M7(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}function Ib(t,e){var n=[];return vn(t,function(r){var i=!1;if(r.geometry.type==="Point")qo(e,function(s){Xn(r,s)&&(i=!0)}),i&&n.push(r);else if(r.geometry.type==="MultiPoint"){var o=[];qo(e,function(s){xr(r,function(a){Xn(a,s)&&(i=!0,o.push(a))})}),i&&n.push(Mp(o))}else throw new Error("Input geometry must be a Point or MultiPoint")}),ft(n)}function Ln(t,e,n){n===void 0&&(n={});var r=qn(t),i=qn(e),o=ii(i[1]-r[1]),s=ii(i[0]-r[0]),a=ii(r[1]),u=ii(i[1]),l=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(u);return Fh(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),n.units)}function i2(t,e){var n=!1;return ft(A7(t.features.map(function(r){var i={x:r.geometry.coordinates[0],y:r.geometry.coordinates[1]};return e?i.z=r.properties[e]:r.geometry.coordinates.length===3&&(n=!0,i.z=r.geometry.coordinates[2]),i})).map(function(r){var i=[r.a.x,r.a.y],o=[r.b.x,r.b.y],s=[r.c.x,r.c.y],a={};return n?(i.push(r.a.z),o.push(r.b.z),s.push(r.c.z)):a={a:r.a.z,b:r.b.z,c:r.c.z},It([[i,o,s,i]],a)}))}var o2=function(){function t(e,n,r){this.a=e,this.b=n,this.c=r;var i=n.x-e.x,o=n.y-e.y,s=r.x-e.x,a=r.y-e.y,u=i*(e.x+n.x)+o*(e.y+n.y),l=s*(e.x+r.x)+a*(e.y+r.y),f=2*(i*(r.y-n.y)-o*(r.x-n.x)),c,h;this.x=(a*u-o*l)/f,this.y=(i*l-s*u)/f,c=this.x-e.x,h=this.y-e.y,this.r=c*c+h*h}return t}();function k7(t,e){return e.x-t.x}function P7(t){var e=t.length,n,r,i,o,s;e:for(;e;)for(r=t[--e],n=t[--e],i=e;i;)if(s=t[--i],o=t[--i],n===o&&r===s||n===s&&r===o){t.splice(e,2),t.splice(i,2),e-=2;continue e}}function A7(t){if(t.length<3)return[];t.sort(k7);for(var e=t.length-1,n=t[e].x,r=t[0].x,i=t[e].y,o=i,s=1e-12,a,u,l,f,c,h;e--;)t[e].yo&&(o=t[e].y);var d=r-n,g=o-i,y=d>g?d:g,b=(r+n)*.5,_=(o+i)*.5,p=[new o2({__sentinel:!0,x:b-20*y,y:_-y},{__sentinel:!0,x:b,y:_+20*y},{__sentinel:!0,x:b+20*y,y:_-y})],m=[],v=[],w;for(e=t.length;e--;){for(v.length=0,w=p.length;w--;){if(d=t[e].x-p[w].x,d>0&&d*d>p[w].r){m.push(p[w]),p.splice(w,1);continue}g=t[e].y-p[w].y,!(d*d+g*g>p[w].r)&&(v.push(p[w].a,p[w].b,p[w].b,p[w].c,p[w].c,p[w].a),p.splice(w,1))}for(P7(v),w=v.length;w;)u=v[--w],a=v[--w],l=t[e],f=u.x-a.x,c=u.y-a.y,h=2*(f*(l.y-u.y)-c*(l.x-u.x)),Math.abs(h)>s&&p.push(new o2(a,u,l))}for(Array.prototype.push.apply(m,p),e=m.length;e--;)(m[e].a.__sentinel||m[e].b.__sentinel||m[e].c.__sentinel)&&m.splice(e,1);return m}function Pi(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return s2(t);case"FeatureCollection":return L7(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Mb(t);default:throw new Error("unknown GeoJSON type")}}function s2(t){var e={type:"Feature"};return Object.keys(t).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:e[n]=t[n]}}),e.properties=a2(t.properties),e.geometry=Mb(t.geometry),e}function a2(t){var e={};return t&&Object.keys(t).forEach(function(n){var r=t[n];typeof r=="object"?r===null?e[n]=null:Array.isArray(r)?e[n]=r.map(function(i){return i}):e[n]=a2(r):e[n]=r}),e}function L7(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach(function(n){switch(n){case"type":case"features":return;default:e[n]=t[n]}}),e.features=t.features.map(function(n){return s2(n)}),e}function Mb(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),t.type==="GeometryCollection"?(e.geometries=t.geometries.map(function(n){return Mb(n)}),e):(e.coordinates=l2(t.coordinates),e)}function l2(t){var e=t;return typeof e[0]!="object"?e.slice():e.map(function(n){return l2(n)})}function D7(t,e){if(e===void 0&&(e={}),e=e||{},!An(e))throw new Error("options is invalid");var n=e.mutate;if(No(t)!=="FeatureCollection")throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");(n===!1||n===void 0)&&(t=Pi(t));var r=[],i=bb(t,function(o,s){var a=R7(o,s);return a||(r.push(o),s)});return i&&r.push(i),r.length?r.length===1?r[0]:qu(r.map(function(o){return o.coordinates})):null}function Xy(t){return t[0].toString()+","+t[1].toString()}function R7(t,e){var n=t.geometry.coordinates,r=e.geometry.coordinates,i=Xy(n[0]),o=Xy(n[n.length-1]),s=Xy(r[0]),a=Xy(r[r.length-1]),u;if(i===a)u=r.concat(n.slice(1));else if(s===o)u=n.concat(r.slice(1));else if(i===s)u=n.slice(1).reverse().concat(r);else if(o===a)u=n.concat(r.reverse().slice(1));else return null;return kn(u)}function F7(t){return t}function B7(t){if(t==null)return F7;var e,n,r=t.scale[0],i=t.scale[1],o=t.translate[0],s=t.translate[1];return function(a,u){u||(e=n=0);var l=2,f=a.length,c=new Array(f);for(c[0]=(e+=a[0])*r+o,c[1]=(n+=a[1])*i+s;l1)for(var c=1,h=a(l[0]),d,g;ch&&(g=l[0],l[0]=l[c],l[c]=g,h=d);return l}).filter(function(u){return u.length>0})}}var Ky=Object.prototype.hasOwnProperty;function z7(t){var e=1/0,n=1/0,r=-1/0,i=-1/0;function o(c){c!=null&&Ky.call(s,c.type)&&s[c.type](c)}var s={GeometryCollection:function(c){c.geometries.forEach(o)},Point:function(c){a(c.coordinates)},MultiPoint:function(c){c.coordinates.forEach(a)},LineString:function(c){u(c.arcs)},MultiLineString:function(c){c.arcs.forEach(u)},Polygon:function(c){c.arcs.forEach(u)},MultiPolygon:function(c){c.arcs.forEach(l)}};function a(c){var h=c[0],d=c[1];hr&&(r=h),di&&(i=d)}function u(c){c.forEach(a)}function l(c){c.forEach(u)}for(var f in t)o(t[f]);return r>=e&&i>=n?[e,n,r,i]:void 0}function H7(t,e,n,r,i){arguments.length===3&&(r=Array,i=null);for(var o=new r(t=1<=t)throw new Error("full hashset");d=o[h=h+1&s]}return o[h]=c,!0}function l(c){for(var h=e(c)&s,d=o[h],g=0;d!=i;){if(n(d,c))return!0;if(++g>=t)break;d=o[h=h+1&s]}return!1}function f(){for(var c=[],h=0,d=o.length;h=t)throw new Error("full hashmap");_=s[b=b+1&u]}return s[b]=g,a[b]=y,y}function c(g,y){for(var b=e(g)&u,_=s[b],p=0;_!=i;){if(n(_,g))return a[b];if(++p>=t)throw new Error("full hashmap");_=s[b=b+1&u]}return s[b]=g,a[b]=y,y}function h(g,y){for(var b=e(g)&u,_=s[b],p=0;_!=i;){if(n(_,g))return a[b];if(++p>=t)break;_=s[b=b+1&u]}return y}function d(){for(var g=[],y=0,b=s.length;y>7^Zy[2]^Zy[3],e&2147483647}function G7(t){var e=t.coordinates,n=t.lines,r=t.rings,i=N(),o=new Int32Array(e.length),s=new Int32Array(e.length),a=new Int32Array(e.length),u=new Int8Array(e.length),l=0,f,c,h,d,g;for(f=0,c=e.length;f=0){var $=a[A];(B!==I||$!==L)&&(B!==L||$!==I)&&(++l,u[A]=1)}else s[A]=I,a[A]=L}}function N(){for(var T=kb(e.length*1.4,S,C,Int32Array,-1,Int32Array),I=new Int32Array(e.length),A=0,L=e.length;A>1),i;e0&&n&&t$(t,n,e),i=X7(Y7(Z7(t))),o=i.coordinates,s=kb(i.arcs.length*1.4,r$,i$);t=i.objects,i.bbox=n,i.arcs=i.arcs.map(function(h,d){return s.set(h,d),o.slice(h[0],h[1]+1)}),delete i.coordinates,o=null;function a(h){h&&Ky.call(u,h.type)&&u[h.type](h)}var u={GeometryCollection:function(h){h.geometries.forEach(a)},LineString:function(h){h.arcs=l(h.arcs)},MultiLineString:function(h){h.arcs=h.arcs.map(l)},Polygon:function(h){h.arcs=h.arcs.map(l)},MultiPolygon:function(h){h.arcs=h.arcs.map(f)}};function l(h){var d=[];do{var g=s.get(h);d.push(h[0]u;){if(l-u>600){var c=l-u+1,h=a-u+1,d=Math.log(c),g=.5*Math.exp(2*d/3),y=.5*Math.sqrt(d*g*(c-g)/c)*(h-c/2<0?-1:1),b=Math.max(u,Math.floor(a-h*g/c+y)),_=Math.min(l,Math.floor(a+(c-h)*g/c+y));r(s,a,b,_,f)}var p=s[a],m=u,v=l;for(i(s,u,a),f(s[l],p)>0&&i(s,u,l);m0;)v--}f(s[u],p)===0?i(s,u,v):(v++,i(s,v,l)),v<=a&&(u=v+1),a<=v&&(l=v-1)}}function i(s,a,u){var l=s[a];s[a]=s[u],s[u]=l}function o(s,a){return sa?1:0}return n})})(d2);var c$=d2.exports;Db.exports=Pp,Db.exports.default=Pp;var f$=c$;function Pp(t,e){if(!(this instanceof Pp))return new Pp(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),e&&this._initFormat(e),this.clear()}Pp.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,n=[],r=this.toBBox;if(!Qy(t,e))return n;for(var i=[],o,s,a,u;e;){for(o=0,s=e.children.length;o=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(i,o,e)},_split:function(t,e){var n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);var o=this._chooseSplitIndex(n,i,r),s=jh(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,$h(n,this.toBBox),$h(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)},_splitRoot:function(t,e){this.data=jh([t,e]),this.data.height=t.height+1,this.data.leaf=!1,$h(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,n){var r,i,o,s,a,u,l,f;for(u=l=1/0,r=e;r<=n-e;r++)i=Ap(t,0,r,this.toBBox),o=Ap(t,r,n,this.toBBox),s=p$(i,o),a=Rb(i)+Rb(o),s=e;u--)l=t.children[u],Lp(s,t.leaf?i(l):l),a+=Jy(s);return a},_adjustParentBBoxes:function(t,e,n){for(var r=n;r>=0;r--)Lp(e[r],t)},_condense:function(t){for(var e=t.length-1,n;e>=0;e--)t[e].children.length===0?e>0?(n=t[e-1].children,n.splice(n.indexOf(t[e]),1)):this.clear():$h(t[e],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}};function h$(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r=t.minX&&e.maxY>=t.minY}function jh(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function m2(t,e,n,r,i){for(var o=[e,n],s;o.length;)n=o.pop(),e=o.pop(),!(n-e<=r)&&(s=e+Math.ceil((n-e)/r/2)*r,f$(t,s,e,n,i),o.push(e,s,s,n))}var g$=Db.exports;const Bb=Ls(g$);function m$(t,e,n,r){var i=Bb(6),o=e.features.map(function(s){var a;return{minX:s.geometry.coordinates[0],minY:s.geometry.coordinates[1],maxX:s.geometry.coordinates[0],maxY:s.geometry.coordinates[1],property:(a=s.properties)===null||a===void 0?void 0:a[n]}});return i.load(o),t.features.forEach(function(s){s.properties||(s.properties={});var a=Yn(s),u=i.search({minX:a[0],minY:a[1],maxX:a[2],maxY:a[3]}),l=[];u.forEach(function(f){Xn([f.minX,f.minY],s)&&l.push(f.property)}),s.properties[r]=l}),t}function y$(t,e){if(e=e||{},!An(e))throw new Error("options is invalid");var n=e.mutate;if(!t)throw new Error("geojson is required");return(n===!1||n===void 0)&&(t=Pi(t)),xr(t,function(r){var i=r[0],o=r[1];r[0]=o,r[1]=i}),t}function af(t,e){e===void 0&&(e={});var n=typeof e=="object"?e.mutate:e;if(!t)throw new Error("geojson is required");var r=No(t),i=[];switch(r){case"LineString":i=Vb(t);break;case"MultiLineString":case"Polygon":pt(t).forEach(function(s){i.push(Vb(s))});break;case"MultiPolygon":pt(t).forEach(function(s){var a=[];s.forEach(function(u){a.push(Vb(u))}),i.push(a)});break;case"Point":return t;case"MultiPoint":var o={};pt(t).forEach(function(s){var a=s.join("-");Object.prototype.hasOwnProperty.call(o,a)||(i.push(s),o[a]=!0)});break;default:throw new Error(r+" geometry not supported")}return t.coordinates?n===!0?(t.coordinates=i,t):{type:r,coordinates:i}:n===!0?(t.geometry.coordinates=i,t):zr({type:r,coordinates:i},t.properties,{bbox:t.bbox,id:t.id})}function Vb(t){var e=pt(t);if(e.length===2&&!y2(e[0],e[1]))return e;var n=[],r=e.length-1,i=n.length;n.push(e[0]);for(var o=1;o2&&v2(n[i-3],n[i-1],n[i-2])&&n.splice(n.length-2,1))}if(n.push(e[e.length-1]),i=n.length,y2(e[0],e[e.length-1])&&i<4)throw new Error("invalid polygon");return v2(n[i-3],n[i-1],n[i-2])&&n.splice(n.length-2,1),n}function y2(t,e){return t[0]===e[0]&&t[1]===e[1]}function v2(t,e,n){var r=n[0],i=n[1],o=t[0],s=t[1],a=e[0],u=e[1],l=r-o,f=i-s,c=a-o,h=u-s,d=l*h-f*c;return d!==0?!1:Math.abs(c)>=Math.abs(h)?c>0?o<=r&&r<=a:a<=r&&r<=o:h>0?s<=i&&i<=u:u<=i&&i<=s}function v$(t,e){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r}function _$(t,e,n){var r=e.x,i=e.y,o=n.x-r,s=n.y-i;if(o!==0||s!==0){var a=((t.x-r)*o+(t.y-i)*s)/(o*o+s*s);a>1?(r=n.x,i=n.y):a>0&&(r+=o*a,i+=s*a)}return o=t.x-r,s=t.y-i,o*o+s*s}function b$(t,e){for(var n=t[0],r=[n],i,o=1,s=t.length;oe&&(r.push(i),n=i);return n!==i&&r.push(i),r}function $b(t,e,n,r,i){for(var o=r,s,a=e+1;ao&&(s=a,o=u)}o>r&&(s-e>1&&$b(t,e,s,r,i),i.push(t[s]),n-s>1&&$b(t,s,n,r,i))}function E$(t,e){var n=t.length-1,r=[t[0]];return $b(t,0,n,e,r),r.push(t[n]),r}function jb(t,e,n){if(t.length<=2)return t;var r=e!==void 0?e*e:1;return t=n?t:b$(t,r),t=E$(t,r),t}function w$(t,e){if(e=e||{},!An(e))throw new Error("options is invalid");var n=e.tolerance!==void 0?e.tolerance:1,r=e.highQuality||!1,i=e.mutate||!1;if(!t)throw new Error("geojson is required");if(n&&n<0)throw new Error("invalid tolerance");return i!==!0&&(t=Pi(t)),qo(t,function(o){x$(o,n,r)}),t}function x$(t,e,n){var r=t.type;if(r==="Point"||r==="MultiPoint")return t;af(t,!0);var i=t.coordinates;switch(r){case"LineString":t.coordinates=_2(i,e,n);break;case"MultiLineString":t.coordinates=i.map(function(o){return _2(o,e,n)});break;case"Polygon":t.coordinates=b2(i,e,n);break;case"MultiPolygon":t.coordinates=i.map(function(o){return b2(o,e,n)})}return t}function _2(t,e,n){return jb(t.map(function(r){return{x:r[0],y:r[1],z:r[2]}}),e,n).map(function(r){return r.z?[r.x,r.y,r.z]:[r.x,r.y]})}function b2(t,e,n){return t.map(function(r){var i=r.map(function(s){return{x:s[0],y:s[1]}});if(i.length<4)throw new Error("invalid polygon");for(var o=jb(i,e,n).map(function(s){return[s.x,s.y]});!S$(o);)e-=e*.01,o=jb(i,e,n).map(function(s){return[s.x,s.y]});return(o[o.length-1][0]!==o[0][0]||o[o.length-1][1]!==o[0][1])&&o.push(o[0]),o})}function S$(t){return t.length<3?!1:!(t.length===3&&t[2][0]===t[0][0]&&t[2][1]===t[0][1])}var C$=function(){function t(e){this.points=e.points||[],this.duration=e.duration||1e4,this.sharpness=e.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=e.stepLength||60,this.length=this.points.length,this.delay=0;for(var n=0;ne&&(n.push(i),r=o)}return n},t.prototype.vector=function(e){var n=this.pos(e+10),r=this.pos(e-10);return{angle:180*Math.atan2(n.y-r.y,n.x-r.x)/3.14,speed:Math.sqrt((r.x-n.x)*(r.x-n.x)+(r.y-n.y)*(r.y-n.y)+(r.z-n.z)*(r.z-n.z))}},t.prototype.pos=function(e){var n=e-this.delay;n<0&&(n=0),n>this.duration&&(n=this.duration-1);var r=n/this.duration;if(r>=1)return this.points[this.length-1];var i=Math.floor((this.points.length-1)*r),o=(this.length-1)*r-i;return N$(o,this.points[i],this.controls[i][1],this.controls[i+1][0],this.points[i+1])},t}();function N$(t,e,n,r,i){var o=O$(t),s={x:i.x*o[0]+r.x*o[1]+n.x*o[2]+e.x*o[3],y:i.y*o[0]+r.y*o[1]+n.y*o[2]+e.y*o[3],z:i.z*o[0]+r.z*o[1]+n.z*o[2]+e.z*o[3]};return s}function O$(t){var e=t*t,n=e*t;return[n,3*e*(1-t),3*t*(1-t)*(1-t),(1-t)*(1-t)*(1-t)]}function E2(t,e){e===void 0&&(e={});for(var n=e.resolution||1e4,r=e.sharpness||.85,i=[],o=Wn(t).coordinates.map(function(l){return{x:l[0],y:l[1]}}),s=new C$({duration:n,points:o,sharpness:r}),a=function(l){var f=s.pos(l);Math.floor(l/100)%2===0&&i.push([f.x,f.y])},u=0;ui;)s=Math.floor((r+1)*Math.random()),o=n[s],n[s]=n[r],n[r]=o;return n.slice(i)}function qb(t,e){e===void 0&&(e={});var n=Number(t[0]),r=Number(t[1]),i=Number(t[2]),o=Number(t[3]);if(t.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var s=[n,r],a=[n,o],u=[i,o],l=[i,r];return It([[s,l,u,a,s]],e.properties,{bbox:t,id:e.id})}function w2(t){return qb(Yn(t))}function x2(t){var e=t[0],n=t[1],r=t[2],i=t[3],o=Ln(t.slice(0,2),[r,n]),s=Ln(t.slice(0,2),[e,i]);if(o>=s){var a=(n+i)/2;return[e,a-(r-e)/2,r,a+(r-e)/2]}else{var u=(e+r)/2;return[u-(i-n)/2,n,u+(i-n)/2,i]}}function Xa(t,e,n,r){r===void 0&&(r={});var i=qn(t),o=ii(i[0]),s=ii(i[1]),a=ii(n),u=nf(e,r.units),l=Math.asin(Math.sin(s)*Math.cos(u)+Math.cos(s)*Math.sin(u)*Math.cos(a)),f=o+Math.atan2(Math.sin(a)*Math.sin(u)*Math.cos(s),Math.cos(u)-Math.sin(s)*Math.sin(l)),c=Uu(f),h=Uu(l);return xt([c,h],r.properties)}function Ub(t,e,n){n===void 0&&(n={});for(var r=n.steps||64,i=n.properties?n.properties:!Array.isArray(t)&&t.type==="Feature"&&t.properties?t.properties:{},o=[],s=0;s80*n){a=l=t[0],u=f=t[1];for(var g=n;gl&&(l=c),h>f&&(f=h);d=Math.max(l-a,f-u),d=d!==0?32767/d:0}return Dp(o,s,n,a,u,d,0),s}function C2(t,e,n,r,i){var o,s;if(i===Yb(t,e,n,r)>0)for(o=e;o=e;o-=r)s=T2(o,t[o],t[o+1],s);return s&&nv(s,s.next)&&(Fp(s),s=s.next),s}function lf(t,e){if(!t)return t;e||(e=t);var n=t,r;do if(r=!1,!n.steiner&&(nv(n,n.next)||Tr(n.prev,n,n.next)===0)){if(Fp(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function Dp(t,e,n,r,i,o,s){if(t){!s&&o&&U$(t,r,i,o);for(var a=t,u,l;t.prev!==t.next;){if(u=t.prev,l=t.next,o?D$(t,r,i,o):L$(t)){e.push(u.i/n|0),e.push(t.i/n|0),e.push(l.i/n|0),Fp(t),t=l.next,a=l.next;continue}if(t=l,t===a){s?s===1?(t=R$(lf(t),e,n),Dp(t,e,n,r,i,o,2)):s===2&&F$(t,e,n,r,i,o):Dp(lf(t),e,n,r,i,o,1);break}}}}function L$(t){var e=t.prev,n=t,r=t.next;if(Tr(e,n,r)>=0)return!1;for(var i=e.x,o=n.x,s=r.x,a=e.y,u=n.y,l=r.y,f=io?i>s?i:s:o>s?o:s,d=a>u?a>l?a:l:u>l?u:l,g=r.next;g!==e;){if(g.x>=f&&g.x<=h&&g.y>=c&&g.y<=d&&Uh(i,a,o,u,s,l,g.x,g.y)&&Tr(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function D$(t,e,n,r){var i=t.prev,o=t,s=t.next;if(Tr(i,o,s)>=0)return!1;for(var a=i.x,u=o.x,l=s.x,f=i.y,c=o.y,h=s.y,d=au?a>l?a:l:u>l?u:l,b=f>c?f>h?f:h:c>h?c:h,_=Hb(d,g,e,n,r),p=Hb(y,b,e,n,r),m=t.prevZ,v=t.nextZ;m&&m.z>=_&&v&&v.z<=p;){if(m.x>=d&&m.x<=y&&m.y>=g&&m.y<=b&&m!==i&&m!==s&&Uh(a,f,u,c,l,h,m.x,m.y)&&Tr(m.prev,m,m.next)>=0||(m=m.prevZ,v.x>=d&&v.x<=y&&v.y>=g&&v.y<=b&&v!==i&&v!==s&&Uh(a,f,u,c,l,h,v.x,v.y)&&Tr(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;m&&m.z>=_;){if(m.x>=d&&m.x<=y&&m.y>=g&&m.y<=b&&m!==i&&m!==s&&Uh(a,f,u,c,l,h,m.x,m.y)&&Tr(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;v&&v.z<=p;){if(v.x>=d&&v.x<=y&&v.y>=g&&v.y<=b&&v!==i&&v!==s&&Uh(a,f,u,c,l,h,v.x,v.y)&&Tr(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function R$(t,e,n){var r=t;do{var i=r.prev,o=r.next.next;!nv(i,o)&&N2(i,r,r.next,o)&&Rp(i,o)&&Rp(o,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(o.i/n|0),Fp(r),Fp(r.next),r=t=o),r=r.next}while(r!==t);return lf(r)}function F$(t,e,n,r,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&G$(s,a)){var u=O2(s,a);s=lf(s,s.next),u=lf(u,u.next),Dp(s,e,n,r,i,o,0),Dp(u,e,n,r,i,o,0);return}a=a.next}s=s.next}while(s!==t)}function B$(t,e,n,r){var i=[],o,s,a,u,l;for(o=0,s=e.length;o=n.next.y&&n.next.y!==n.y){var a=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=r&&a>o&&(o=a,s=n.x=n.x&&n.x>=l&&r!==n.x&&Uh(is.x||n.x===s.x&&q$(s,n)))&&(s=n,c=h)),n=n.next;while(n!==u);return s}function q$(t,e){return Tr(t.prev,t,e.prev)<0&&Tr(e.next,t,t.next)<0}function U$(t,e,n,r){var i=t;do i.z===0&&(i.z=Hb(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,z$(i)}function z$(t){var e,n,r,i,o,s,a,u,l=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,r=n,a=0,e=0;e0||u>0&&r;)a!==0&&(u===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,l*=2}while(s>1);return t}function Hb(t,e,n,r,i){return t=(t-n)*i|0,e=(e-r)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function H$(t){var e=t,n=t;do(e.x=(t-s)*(o-a)&&(t-s)*(r-a)>=(n-s)*(e-a)&&(n-s)*(o-a)>=(i-s)*(r-a)}function G$(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Y$(t,e)&&(Rp(t,e)&&Rp(e,t)&&W$(t,e)&&(Tr(t.prev,t,e.prev)||Tr(t,e.prev,e))||nv(t,e)&&Tr(t.prev,t,t.next)>0&&Tr(e.prev,e,e.next)>0)}function Tr(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function nv(t,e){return t.x===e.x&&t.y===e.y}function N2(t,e,n,r){var i=iv(Tr(t,e,n)),o=iv(Tr(t,e,r)),s=iv(Tr(n,r,t)),a=iv(Tr(n,r,e));return!!(i!==o&&s!==a||i===0&&rv(t,n,e)||o===0&&rv(t,r,e)||s===0&&rv(n,t,r)||a===0&&rv(n,e,r))}function rv(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function iv(t){return t>0?1:t<0?-1:0}function Y$(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&N2(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function Rp(t,e){return Tr(t.prev,t,t.next)<0?Tr(t,e,t.next)>=0&&Tr(t,t.prev,e)>=0:Tr(t,e,t.prev)<0||Tr(t,t.next,e)<0}function W$(t,e){var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==t);return r}function O2(t,e){var n=new Gb(t.i,t.x,t.y),r=new Gb(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function T2(t,e,n,r){var i=new Gb(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Fp(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Gb(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}tv.deviation=function(t,e,n,r){var i=e&&e.length,o=i?e[0]*n:t.length,s=Math.abs(Yb(t,0,o,n));if(i)for(var a=0,u=e.length;a0&&(r+=t[i-1].length,n.holes.push(r))}return n};var X$=zb.exports;const K$=Ls(X$);function Z$(t){if(!t.geometry||t.geometry.type!=="Polygon"&&t.geometry.type!=="MultiPolygon")throw new Error("input must be a Polygon or MultiPolygon");var e={type:"FeatureCollection",features:[]};return t.geometry.type==="Polygon"?e.features=I2(t.geometry.coordinates):t.geometry.coordinates.forEach(function(n){e.features=e.features.concat(I2(n))}),e}function I2(t){var e=J$(t),n=2,r=K$(e.vertices,e.holes,n),i=[],o=[];r.forEach(function(u,l){var f=r[l];o.push([e.vertices[f*n],e.vertices[f*n+1]])});for(var s=0;s0&&(r+=t[i-1].length,n.holes.push(r))}return n}function ov(t,e){if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");var n,r=1/0,i=0;return vn(e,function(o,s){var a=Ln(t,o);ai?n:i,l=r>o?r:o;return[s,a,u,l]}var Wb={exports:{}},M2={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(or,function(){function n(p,m,v,w,N){(function S(C,O,M,T,I){for(;T>M;){if(T-M>600){var A=T-M+1,L=O-M+1,B=Math.log(A),$=.5*Math.exp(2*B/3),G=.5*Math.sqrt(B*$*(A-$)/A)*(L-A/2<0?-1:1),J=Math.max(M,Math.floor(O-L*$/A+G)),W=Math.min(T,Math.floor(O+(A-L)*$/A+G));S(C,O,J,W,I)}var V=C[O],D=M,j=T;for(r(C,M,O),I(C[T],V)>0&&r(C,M,T);D0;)j--}I(C[M],V)===0?r(C,M,j):r(C,++j,T),j<=O&&(M=j+1),O<=j&&(T=j-1)}})(p,m,v||0,w||p.length-1,N||i)}function r(p,m,v){var w=p[m];p[m]=p[v],p[v]=w}function i(p,m){return pm?1:0}var o=function(p){p===void 0&&(p=9),this._maxEntries=Math.max(4,p),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(p,m,v){if(!v)return m.indexOf(p);for(var w=0;w=p.minX&&m.maxY>=p.minY}function b(p){return{children:p,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function _(p,m,v,w,N){for(var S=[m,v];S.length;)if(!((v=S.pop())-(m=S.pop())<=w)){var C=m+Math.ceil((v-m)/w/2)*w;n(p,C,m,v,N),S.push(m,C,C,v)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(p){var m=this.data,v=[];if(!y(p,m))return v;for(var w=this.toBBox,N=[];m;){for(var S=0;S=0&&N[m].children.length>this._maxEntries;)this._split(N,m),m--;this._adjustParentBBoxes(w,N,m)},o.prototype._split=function(p,m){var v=p[m],w=v.children.length,N=this._minEntries;this._chooseSplitAxis(v,N,w);var S=this._chooseSplitIndex(v,N,w),C=b(v.children.splice(S,v.children.length-S));C.height=v.height,C.leaf=v.leaf,a(v,this.toBBox),a(C,this.toBBox),m?p[m-1].children.push(C):this._splitRoot(v,C)},o.prototype._splitRoot=function(p,m){this.data=b([p,m]),this.data.height=p.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(p,m,v){for(var w,N,S,C,O,M,T,I=1/0,A=1/0,L=m;L<=v-m;L++){var B=u(p,0,L,this.toBBox),$=u(p,L,v,this.toBBox),G=(N=B,S=$,C=void 0,O=void 0,M=void 0,T=void 0,C=Math.max(N.minX,S.minX),O=Math.max(N.minY,S.minY),M=Math.min(N.maxX,S.maxX),T=Math.min(N.maxY,S.maxY),Math.max(0,M-C)*Math.max(0,T-O)),J=h(B)+h($);G=m;I--){var A=p.children[I];l(C,p.leaf?N(A):A),O+=d(C)}return O},o.prototype._adjustParentBBoxes=function(p,m,v){for(var w=v;w>=0;w--)l(m[w],p)},o.prototype._condense=function(p){for(var m=p.length-1,v=void 0;m>=0;m--)p[m].children.length===0?m>0?(v=p[m-1].children).splice(v.indexOf(p[m]),1):this.clear():a(p[m],this.toBBox)},o})})(M2);var nj=M2.exports;const rj=jy(FO),ij=jy(qO),oj=jy(W9);var Ka=nj,k2=rj,P2=ij,zh=oj.default,sj=P2.featureEach;P2.coordEach,k2.polygon;var A2=k2.featureCollection;function L2(t){var e=new Ka(t);return e.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:zh(n),Ka.prototype.insert.call(this,n)},e.load=function(n){var r=[];return Array.isArray(n)?n.forEach(function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:zh(i),r.push(i)}):sj(n,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:zh(i),r.push(i)}),Ka.prototype.load.call(this,r)},e.remove=function(n,r){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:zh(n),Ka.prototype.remove.call(this,n,r)},e.clear=function(){return Ka.prototype.clear.call(this)},e.search=function(n){var r=Ka.prototype.search.call(this,this.toBBox(n));return A2(r)},e.collides=function(n){return Ka.prototype.collides.call(this,this.toBBox(n))},e.all=function(){var n=Ka.prototype.all.call(this);return A2(n)},e.toJSON=function(){return Ka.prototype.toJSON.call(this)},e.fromJSON=function(n){return Ka.prototype.fromJSON.call(this,n)},e.toBBox=function(n){var r;if(n.bbox)r=n.bbox;else if(Array.isArray(n)&&n.length===4)r=n;else if(Array.isArray(n)&&n.length===6)r=[n[0],n[1],n[3],n[4]];else if(n.type==="Feature")r=zh(n);else if(n.type==="FeatureCollection")r=zh(n);else throw new Error("invalid geojson");return{minX:r[0],minY:r[1],maxX:r[2],maxY:r[3]}},e}Wb.exports=L2,Wb.exports.default=L2;var aj=Wb.exports;const sv=Ls(aj);function Kl(t,e){var n={},r=[];if(t.type==="LineString"&&(t=zr(t)),e.type==="LineString"&&(e=zr(e)),t.type==="Feature"&&e.type==="Feature"&&t.geometry!==null&&e.geometry!==null&&t.geometry.type==="LineString"&&e.geometry.type==="LineString"&&t.geometry.coordinates.length===2&&e.geometry.coordinates.length===2){var i=D2(t,e);return i&&r.push(i),ft(r)}var o=sv();return o.load(uf(e)),vn(uf(t),function(s){vn(o.search(s),function(a){var u=D2(s,a);if(u){var l=pt(u).join(",");n[l]||(n[l]=!0,r.push(u))}})}),ft(r)}function D2(t,e){var n=pt(t),r=pt(e);if(n.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(r.length!==2)throw new Error(" line2 must only contain 2 coordinates");var i=n[0][0],o=n[0][1],s=n[1][0],a=n[1][1],u=r[0][0],l=r[0][1],f=r[1][0],c=r[1][1],h=(c-l)*(s-i)-(f-u)*(a-o),d=(f-u)*(o-l)-(c-l)*(i-u),g=(s-i)*(o-l)-(a-o)*(i-u);if(h===0)return null;var y=d/h,b=g/h;if(y>=0&&y<=1&&b>=0&&b<=1){var _=i+y*(s-i),p=o+y*(a-o);return xt([_,p])}return null}function Zl(t,e,n){n===void 0&&(n={});var r=xt([1/0,1/0],{dist:1/0}),i=0;return yi(t,function(o){for(var s=pt(o),a=0;a0&&(b=y.features[0],b.properties.dist=Ln(e,b,n),b.properties.location=i+Ln(u,b,n)),u.properties.dist180?-360:r[0]-i[0]>180?360:0;var o=lj(r,i),s=of(o,"meters",n.units);return s}function lj(t,e,n){n=n===void 0?ri:Number(n);var r=n,i=t[1]*Math.PI/180,o=e[1]*Math.PI/180,s=o-i,a=Math.abs(e[0]-t[0])*Math.PI/180;a>Math.PI&&(a-=2*Math.PI);var u=Math.log(Math.tan(o/2+Math.PI/4)/Math.tan(i/2+Math.PI/4)),l=Math.abs(u)>1e-11?s/u:Math.cos(i),f=Math.sqrt(s*s+l*l*a*a),c=f*r;return c}function R2(t,e,n){if(n===void 0&&(n={}),n.method||(n.method="geodesic"),n.units||(n.units="kilometers"),!t)throw new Error("pt is required");if(Array.isArray(t)?t=xt(t):t.type==="Point"?t=zr(t):kp(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=kn(e):e.type==="LineString"?e=zr(e):kp(e,"LineString","line");var r=1/0,i=t.geometry.coordinates;return Yl(e,function(o){var s=o.geometry.coordinates[0],a=o.geometry.coordinates[1],u=uj(i,s,a,n);u=0&&l<=1&&(d.onLine1=!0),f>=0&&f<=1&&(d.onLine2=!0),d.onLine1&&d.onLine2?[d.x,d.y]:!1)}function B2(t){for(var e=gj(t),n=qh(e),r=!1,i=0;!r&&i0){e+=Math.abs(q2(t[0]));for(var n=1;n2){for(a=0;a=o&&s===i.length-1);s++)if(o>=e){var a=e-o;if(a){var u=Xl(i[s],i[s-1])-180,l=Xa(i[s],a,u,n);return l}else return xt(i[s])}else o+=Ln(i[s],i[s+1],n);return xt(i[i.length-1])}function uv(t,e){return e===void 0&&(e={}),vb(t,function(n,r){var i=r.geometry.coordinates;return n+Ln(i[0],i[1],e)},0)}function vj(t,e,n){var r=pt(n);if(No(n)!=="LineString")throw new Error("line must be a LineString");var i=Zl(n,t),o=Zl(n,e),s;i.properties.index<=o.properties.index?s=[i,o]:s=[o,i];for(var a=[s[0].geometry.coordinates],u=s[0].properties.index+1;u=a&&c===i.length-1);c++){if(a>e&&o.length===0){if(u=e-a,!u)return o.push(i[c]),kn(o);l=Xl(i[c],i[c-1])-180,f=Xa(i[c],u,l,r),o.push(f.geometry.coordinates)}if(a>=n)return u=n-a,u?(l=Xl(i[c],i[c-1])-180,f=Xa(i[c],u,l,r),o.push(f.geometry.coordinates),kn(o)):(o.push(i[c]),kn(o));if(a>=e&&o.push(i[c]),c===i.length-1)return kn(o);a+=Ln(i[c],i[c+1],r)}if(a"u"?null:n.epsilon))return!0}return!1}function _j(t,e,n,r,i){var o=n[0],s=n[1],a=t[0],u=t[1],l=e[0],f=e[1],c=n[0]-a,h=n[1]-u,d=l-a,g=f-u,y=c*g-h*d;if(i!==null){if(Math.abs(y)>i)return!1}else if(y!==0)return!1;if(r){if(r==="start")return Math.abs(d)>=Math.abs(g)?d>0?a0?u=Math.abs(g)?d>0?a<=o&&o0?u<=s&&s=Math.abs(g)?d>0?a0?u=Math.abs(g)?d>0?a<=o&&o<=l:l<=o&&o<=a:g>0?u<=s&&s<=f:f<=s&&s<=u;return!1}function z2(t,e){var n=Wn(t),r=Wn(e),i=n.type,o=r.type;switch(i){case"Point":switch(o){case"MultiPoint":return bj(n,r);case"LineString":return Uo(n,r,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return Xn(n,r,{ignoreBoundary:!0});default:throw new Error("feature2 "+o+" geometry not supported")}case"MultiPoint":switch(o){case"MultiPoint":return Ej(n,r);case"LineString":return wj(n,r);case"Polygon":case"MultiPolygon":return xj(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"LineString":return Sj(n,r);case"Polygon":case"MultiPolygon":return Cj(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Polygon":case"MultiPolygon":return Nj(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}function bj(t,e){var n,r=!1;for(n=0;ne[0]||t[2]e[1]||t[3] is required");if(typeof n!="number")throw new Error(" must be a number");if(typeof r!="number")throw new Error(" must be a number");(i===!1||i===void 0)&&(t=JSON.parse(JSON.stringify(t)));var o=Math.pow(10,n);return xr(t,function(s){Tj(s,o,r)}),t}function Tj(t,e,n){t.length>n&&t.splice(n,t.length);for(var r=0;r=1||M<=0||T>=1||T<=0)){var I=O,A=!o[I];A&&(o[I]=!0),e?i.push(e(O,_,p,w,N,M,m,v,S,C,T,A)):i.push(O)}}}function b(_,p){var m=r[_][p],v=r[_][p+1],w,N,S,C;return m[0]u[ee.isect].coord?-1:1});for(var S=[];_.length>0;){var C=_.pop(),O=C.isect,M=C.parent,T=C.winding,I=S.length,A=[u[O].coord],L=O;if(u[O].ringAndEdge1Walkable)var B=u[O].ringAndEdge1,$=u[O].nxtIsectAlongRingAndEdge1;else var B=u[O].ringAndEdge2,$=u[O].nxtIsectAlongRingAndEdge2;for(;!Vp(u[O].coord,u[$].coord);){A.push(u[$].coord);for(var G=void 0,p=0;p<_.length;p++)if(_[p].isect==$){G=p;break}if(G!=null&&_.splice(G,1),Vp(B,u[$].ringAndEdge1)){if(B=u[$].ringAndEdge2,u[$].ringAndEdge2Walkable=!1,u[$].ringAndEdge1Walkable){var J={isect:$};cv([u[L].coord,u[$].coord,u[u[$].nxtIsectAlongRingAndEdge2].coord],T==1)?(J.parent=M,J.winding=-T):(J.parent=I,J.winding=T),_.push(J)}L=$,$=u[$].nxtIsectAlongRingAndEdge2}else{if(B=u[$].ringAndEdge1,u[$].ringAndEdge1Walkable=!1,u[$].ringAndEdge2Walkable){var J={isect:$};cv([u[L].coord,u[$].coord,u[u[$].nxtIsectAlongRingAndEdge1].coord],T==1)?(J.parent=M,J.winding=-T):(J.parent=I,J.winding=T),_.push(J)}L=$,$=u[$].nxtIsectAlongRingAndEdge1}}A.push(u[$].coord),S.push(It([A],{index:I,parent:M,winding:T,netWinding:void 0}))}var W=ft(S);V(),D();function V(){for(var z=[],ee=0;ee1)for(var ee=0;ee"u"&&(e=!0),t.length!=3)throw new Error("This function requires an array of three points [x,y]");var n=(t[1][0]-t[0][0])*(t[2][1]-t[0][1])-(t[1][1]-t[0][1])*(t[2][0]-t[0][0]);return n>=0==e}function Lj(t){for(var e=0,n=0;nh&&(y>f&&gf&&yu&&(u=b)}var _=[];if(a&&u0&&Math.abs(v-n[m-1][0])>h){var w=parseFloat(n[m-1][0]),N=parseFloat(n[m-1][1]),S=parseFloat(n[m][0]),C=parseFloat(n[m][1]);if(w>-180&&w-180&&n[m-1][0]f&&w<180&&S===-180&&m+1f&&n[m-1][0]<180){p.push([180,n[m][1]]),m++,p.push([n[m][0],n[m][1]]);continue}if(wf){var O=w;w=S,S=O;var M=N;N=C,C=M}if(w>f&&S=180&&wf?180:-180,I]),p=[],p.push([n[m-1][0]>f?-180:180,I]),_.push(p)}else p=[],_.push(p);p.push([v,n[m][1]])}else p.push([n[m][0],n[m][1]])}}else{var A=[];_.push(A);for(var L=0;L1&&n.push(kn(f)),ft(n)}function tT(t,e){if(!e.features.length)throw new Error("lines must contain features");if(e.features.length===1)return e.features[0];var n,r=1/0;return vn(e,function(i){var o=Zl(i,t),s=o.properties.dist;sf&&h.push(Xa(t,e,f,i).geometry.coordinates),kn(h,u)}function rT(t){var e=t%360;return e<0&&(e+=360),e}function jp(t,e){e===void 0&&(e={});var n=Wn(t);switch(!e.properties&&t.type==="Feature"&&(e.properties=t.properties),n.type){case"Polygon":return iT(n,e);case"MultiPolygon":return Vj(n,e);default:throw new Error("invalid poly")}}function iT(t,e){e===void 0&&(e={});var n=Wn(t),r=n.coordinates,i=e.properties?e.properties:t.type==="Feature"?t.properties:{};return oT(r,i)}function Vj(t,e){e===void 0&&(e={});var n=Wn(t),r=n.coordinates,i=e.properties?e.properties:t.type==="Feature"?t.properties:{},o=[];return r.forEach(function(s){o.push(oT(s,i))}),ft(o)}function oT(t,e){return t.length>1?qu(t,e):kn(t[0],e)}function sT(t,e){e===void 0&&(e={});var n,r,i,o=e.properties,s=(n=e.autoComplete)!==null&&n!==void 0?n:!0,a=(r=e.orderCoords)!==null&&r!==void 0?r:!0,u=(i=e.mutate)!==null&&i!==void 0?i:!1;switch(u||(t=Pi(t)),t.type){case"FeatureCollection":var l=[];return t.features.forEach(function(f){l.push(pt(aT(f,{},s,a)))}),jo(l,o);default:return aT(t,o,s,a)}}function aT(t,e,n,r){e=e||(t.type==="Feature"?t.properties:{});var i=Wn(t),o=i.coordinates,s=i.type;if(!o.length)throw new Error("line must contain coordinates");switch(s){case"LineString":return n&&(o=lT(o)),It([o],e);case"MultiLineString":var a=[],u=0;return o.forEach(function(l){if(n&&(l=lT(l)),r){var f=$j(Yn(kn(l)));f>u?(a.unshift(l),u=f):a.push(l)}else a.push(l)}),It(a,e);default:throw new Error("geometry type "+s+" is not supported")}}function lT(t){var e=t[0],n=e[0],r=e[1],i=t[t.length-1],o=i[0],s=i[1];return(n!==o||r!==s)&&t.push(e),t}function $j(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.abs(e-r)*Math.abs(n-i)}function jj(t,e,n){var r=t.length,i=Gh(t[0],e),o=[],s,a,u,l,f;for(n||(n=[]),s=1;se[2]&&(n|=2),t[1]e[3]&&(n|=8),n}function Uj(t,e){var n=Wn(t),r=n.type,i=t.type==="Feature"?t.properties:{},o=n.coordinates;switch(r){case"LineString":case"MultiLineString":{var s=[];return r==="LineString"&&(o=[o]),o.forEach(function(a){jj(a,e,s)}),s.length===1?kn(s[0],i):qu(s,i)}case"Polygon":return It(uT(o,e),i);case"MultiPolygon":return jo(o.map(function(a){return uT(a,e)}),i);default:throw new Error("geometry "+r+" not supported")}}function uT(t,e){for(var n=[],r=0,i=t;r0&&((s[0][0]!==s[s.length-1][0]||s[0][1]!==s[s.length-1][1])&&s.push(s[0]),s.length>=4&&n.push(s))}return n}var cT=Object.prototype.toString,fT=function(e){var n=cT.call(e),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&cT.call(e.callee)==="[object Function]"),r},rE,hT;function zj(){if(hT)return rE;hT=1;var t;if(!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=fT,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),s=i.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],u=function(h){var d=h.constructor;return d&&d.prototype===h},l={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=function(){if(typeof window>"u")return!1;for(var h in window)try{if(!l["$"+h]&&e.call(window,h)&&window[h]!==null&&typeof window[h]=="object")try{u(window[h])}catch{return!0}}catch{return!0}return!1}(),c=function(h){if(typeof window>"u"||!f)return u(h);try{return u(h)}catch{return!1}};t=function(d){var g=d!==null&&typeof d=="object",y=n.call(d)==="[object Function]",b=r(d),_=g&&n.call(d)==="[object String]",p=[];if(!g&&!y&&!b)throw new TypeError("Object.keys called on a non-object");var m=s&&y;if(_&&d.length>0&&!e.call(d,0))for(var v=0;v0)for(var w=0;w"u"||!Ai?_n:Ai(Uint8Array),ff={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?_n:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?_n:ArrayBuffer,"%ArrayIteratorPrototype%":Xh&&Ai?Ai([][Symbol.iterator]()):_n,"%AsyncFromSyncIteratorPrototype%":_n,"%AsyncFunction%":Kh,"%AsyncGenerator%":Kh,"%AsyncGeneratorFunction%":Kh,"%AsyncIteratorPrototype%":Kh,"%Atomics%":typeof Atomics>"u"?_n:Atomics,"%BigInt%":typeof BigInt>"u"?_n:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?_n:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?_n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?_n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":gq,"%eval%":eval,"%EvalError%":mq,"%Float32Array%":typeof Float32Array>"u"?_n:Float32Array,"%Float64Array%":typeof Float64Array>"u"?_n:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?_n:FinalizationRegistry,"%Function%":ET,"%GeneratorFunction%":Kh,"%Int8Array%":typeof Int8Array>"u"?_n:Int8Array,"%Int16Array%":typeof Int16Array>"u"?_n:Int16Array,"%Int32Array%":typeof Int32Array>"u"?_n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Xh&&Ai?Ai(Ai([][Symbol.iterator]())):_n,"%JSON%":typeof JSON=="object"?JSON:_n,"%Map%":typeof Map>"u"?_n:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Xh||!Ai?_n:Ai(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?_n:Promise,"%Proxy%":typeof Proxy>"u"?_n:Proxy,"%RangeError%":yq,"%ReferenceError%":vq,"%Reflect%":typeof Reflect>"u"?_n:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?_n:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Xh||!Ai?_n:Ai(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?_n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Xh&&Ai?Ai(""[Symbol.iterator]()):_n,"%Symbol%":Xh?Symbol:_n,"%SyntaxError%":Yh,"%ThrowTypeError%":bq,"%TypedArray%":wq,"%TypeError%":Wh,"%Uint8Array%":typeof Uint8Array>"u"?_n:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?_n:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?_n:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?_n:Uint32Array,"%URIError%":_q,"%WeakMap%":typeof WeakMap>"u"?_n:WeakMap,"%WeakRef%":typeof WeakRef>"u"?_n:WeakRef,"%WeakSet%":typeof WeakSet>"u"?_n:WeakSet};if(Ai)try{null.error}catch(t){var xq=Ai(Ai(t));ff["%Error.prototype%"]=xq}var Sq=function t(e){var n;if(e==="%AsyncFunction%")n=sE("async function () {}");else if(e==="%GeneratorFunction%")n=sE("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=sE("async function* () {}");else if(e==="%AsyncGenerator%"){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Ai&&(n=Ai(i.prototype))}return ff[e]=n,n},wT={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},qp=oE,dv=pq,Cq=qp.call(Function.call,Array.prototype.concat),Nq=qp.call(Function.apply,Array.prototype.splice),xT=qp.call(Function.call,String.prototype.replace),pv=qp.call(Function.call,String.prototype.slice),Oq=qp.call(Function.call,RegExp.prototype.exec),Tq=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Iq=/\\(\\)?/g,Mq=function(e){var n=pv(e,0,1),r=pv(e,-1);if(n==="%"&&r!=="%")throw new Yh("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new Yh("invalid intrinsic syntax, expected opening `%`");var i=[];return xT(e,Tq,function(o,s,a,u){i[i.length]=a?xT(u,Iq,"$1"):s||o}),i},kq=function(e,n){var r=e,i;if(dv(wT,r)&&(i=wT[r],r="%"+i[0]+"%"),dv(ff,r)){var o=ff[r];if(o===Kh&&(o=Sq(r)),typeof o>"u"&&!n)throw new Wh("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new Yh("intrinsic "+e+" does not exist!")},Up=function(e,n){if(typeof e!="string"||e.length===0)throw new Wh("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new Wh('"allowMissing" argument must be a boolean');if(Oq(/^%?[^%]*%?$/,e)===null)throw new Yh("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=Mq(e),i=r.length>0?r[0]:"",o=kq("%"+i+"%",n),s=o.name,a=o.value,u=!1,l=o.alias;l&&(i=l[0],Nq(r,Cq([0,1],l)));for(var f=1,c=!0;f=r.length){var y=cf(a,h);c=!!y,c&&"get"in y&&!("originalValue"in y.get)?a=y.get:a=a[h]}else c=dv(a,h),a=a[h];c&&!u&&(ff[s]=a)}}return a},ST={exports:{}},Pq=Up,gv=Pq("%Object.defineProperty%",!0)||!1;if(gv)try{gv({},"a",{value:1})}catch{gv=!1}var lE=gv,Aq=Up,mv=Aq("%Object.getOwnPropertyDescriptor%",!0);if(mv)try{mv([],"length")}catch{mv=null}var CT=mv,NT=lE,Lq=yT,Zh=hv,OT=CT,uE=function(e,n,r){if(!e||typeof e!="object"&&typeof e!="function")throw new Zh("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new Zh("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Zh("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Zh("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Zh("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Zh("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,s=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,u=!!OT&&OT(e,n);if(NT)NT(e,n,{configurable:s===null&&u?u.configurable:!s,enumerable:i===null&&u?u.enumerable:!i,value:r,writable:o===null&&u?u.writable:!o});else if(a||!i&&!o&&!s)e[n]=r;else throw new Lq("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},cE=lE,TT=function(){return!!cE};TT.hasArrayLengthDefineBug=function(){if(!cE)return null;try{return cE([],"length",{value:1}).length!==1}catch{return!0}};var fE=TT,Dq=Up,IT=uE,Rq=fE(),MT=CT,kT=hv,Fq=Dq("%Math.floor%"),Bq=function(e,n){if(typeof e!="function")throw new kT("`fn` is not a function");if(typeof n!="number"||n<0||n>4294967295||Fq(n)!==n)throw new kT("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,o=!0;if("length"in e&&MT){var s=MT(e,"length");s&&!s.configurable&&(i=!1),s&&!s.writable&&(o=!1)}return(i||o||!r)&&(Rq?IT(e,"length",n,!0,!0):IT(e,"length",n)),e};(function(t){var e=oE,n=Up,r=Bq,i=hv,o=n("%Function.prototype.apply%"),s=n("%Function.prototype.call%"),a=n("%Reflect.apply%",!0)||e.call(s,o),u=lE,l=n("%Math.max%");t.exports=function(h){if(typeof h!="function")throw new i("a function is required");var d=a(e,s,arguments);return r(d,1+l(0,h.length-(arguments.length-1)),!0)};var f=function(){return a(e,o,arguments)};u?u(t.exports,"apply",{value:f}):t.exports.apply=f})(ST);var hE=ST.exports,PT=Up,AT=hE,Vq=AT(PT("String.prototype.indexOf")),LT=function(e,n){var r=PT(e,!!n);return typeof r=="function"&&Vq(e,".prototype.")>-1?AT(r):r},$q=iE(),jq=LT,dE=jq("Object.prototype.toString"),yv=function(e){return $q&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:dE(e)==="[object Arguments]"},DT=function(e){return yv(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&dE(e)!=="[object Array]"&&dE(e.callee)==="[object Function]"},qq=function(){return yv(arguments)}();yv.isLegacyArguments=DT;var Uq=qq?yv:DT,zq=gT,Hq=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Gq=Object.prototype.toString,Yq=Array.prototype.concat,RT=uE,Wq=function(t){return typeof t=="function"&&Gq.call(t)==="[object Function]"},FT=fE(),Xq=function(t,e,n,r){if(e in t){if(r===!0){if(t[e]===n)return}else if(!Wq(r)||!r())return}FT?RT(t,e,n,!0):RT(t,e,n)},BT=function(t,e){var n=arguments.length>2?arguments[2]:{},r=zq(e);Hq&&(r=Yq.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i2&&!!arguments[2];return(!r||hU)&&(fU?YT(e,"name",n,!0,!0):YT(e,"name",n)),e},gU=pU,mU=Object,yU=TypeError,WT=gU(function(){if(this!=null&&this!==mU(this))throw new yU("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0),vU=WT,_U=zp.supportsDescriptors,bU=Object.getOwnPropertyDescriptor,XT=function(){if(_U&&/a/mig.flags==="gim"){var e=bU(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var n="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){n+="d"}}),Object.defineProperty(r,"sticky",{get:function(){n+="y"}}),n==="dy")return e.get}}return vU},EU=zp.supportsDescriptors,wU=XT,xU=Object.getOwnPropertyDescriptor,SU=Object.defineProperty,CU=TypeError,KT=Object.getPrototypeOf,NU=/a/,OU=function(){if(!EU||!KT)throw new CU("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=wU(),n=KT(NU),r=xU(n,"flags");return(!r||r.get!==e)&&SU(n,"flags",{configurable:!0,enumerable:!1,get:e}),e},TU=zp,IU=hE,MU=WT,ZT=XT,kU=OU,JT=IU(ZT());TU(JT,{getPolyfill:ZT,implementation:MU,shim:kU});var PU=JT,AU=Date.prototype.getDay,LU=function(e){try{return AU.call(e),!0}catch{return!1}},DU=Object.prototype.toString,RU="[object Date]",FU=iE(),BU=function(e){return typeof e!="object"||e===null?!1:FU?LU(e):DU.call(e)===RU},QT=gT,eI=Uq,tI=iU,nI=lU,rI=PU,iI=BU,oI=Date.prototype.getTime;function sI(t,e,n){var r=n||{};return(r.strict?tI(t,e):t===e)?!0:!t||!e||typeof t!="object"&&typeof e!="object"?r.strict?tI(t,e):t==e:VU(t,e,r)}function aI(t){return t==null}function lI(t){return!(!t||typeof t!="object"||typeof t.length!="number"||typeof t.copy!="function"||typeof t.slice!="function"||t.length>0&&typeof t[0]!="number")}function VU(t,e,n){var r,i;if(typeof t!=typeof e||aI(t)||aI(e)||t.prototype!==e.prototype||eI(t)!==eI(e))return!1;var o=nI(t),s=nI(e);if(o!==s)return!1;if(o||s)return t.source===e.source&&rI(t)===rI(e);if(iI(t)&&iI(e))return oI.call(t)===oI.call(e);var a=lI(t),u=lI(e);if(a!==u)return!1;if(a||u){if(t.length!==e.length)return!1;for(r=0;r=0;r--)if(l[r]!=f[r])return!1;for(r=l.length-1;r>=0;r--)if(i=l[r],!sI(t[i],e[i],n))return!1;return!0}var uI=sI;const Yp=Ls(uI);function cI(t,e,n){if(n===void 0&&(n={}),n=n||{},!An(n))throw new Error("options is invalid");var r=n.tolerance||0,i=[],o=sv(),s=uf(t);o.load(s);var a;return Yl(e,function(u){var l=!1;u&&(vn(o.search(u),function(f){if(l===!1){var c=pt(u).sort(),h=pt(f).sort();Yp(c,h)||(r===0?Uo(c[0],f)&&Uo(c[1],f):Zl(f,c[0]).properties.dist<=r&&Zl(f,c[1]).properties.dist<=r)?(l=!0,a?a=vE(a,u):a=u):(r===0?Uo(h[0],u)&&Uo(h[1],u):Zl(u,h[0]).properties.dist<=r&&Zl(u,h[1]).properties.dist<=r)&&(a?a=vE(a,f):a=f)}}),l===!1&&a&&(i.push(a),a=void 0))}),a&&i.push(a),ft(i)}function vE(t,e){var n=pt(e),r=pt(t),i=r[0],o=r[r.length-1],s=t.geometry.coordinates;return Yp(n[0],i)?s.unshift(n[1]):Yp(n[0],o)?s.push(n[1]):Yp(n[1],i)?s.unshift(n[0]):Yp(n[1],o)&&s.push(n[0]),t}function $U(t,e,n,r,i){if(i=i||{},!An(i))throw new Error("options is invalid");var o=i.properties;if(!t)throw new Error("center is required");if(n==null)throw new Error("bearing1 is required");if(r==null)throw new Error("bearing2 is required");if(!e)throw new Error("radius is required");if(typeof i!="object")throw new Error("options must be an object");if(fI(n)===fI(r))return Ub(t,e,i);var s=pt(t),a=nT(t,e,n,r,i),u=[[s]];return xr(a,function(l){u[0].push(l)}),u[0].push(s),It(u,o)}function fI(t){var e=t%360;return e<0&&(e+=360),e}function hf(t,e,n){n===void 0&&(n={});var r;n.final?r=hI(qn(e),qn(t)):r=hI(qn(t),qn(e));var i=r>180?-(360-r):r;return i}function hI(t,e){var n=ii(t[1]),r=ii(e[1]),i=ii(e[0]-t[0]);i>Math.PI&&(i-=2*Math.PI),i<-Math.PI&&(i+=2*Math.PI);var o=Math.log(Math.tan(r/2+Math.PI/4)/Math.tan(n/2+Math.PI/4)),s=Math.atan2(i,o);return(Uu(s)+360)%360}function Jh(t,e,n,r){r===void 0&&(r={});var i=e<0,o=of(Math.abs(e),r.units,"meters");i&&(o=-Math.abs(o));var s=qn(t),a=jU(s,o,n);return a[0]+=a[0]-s[0]>180?-360:s[0]-a[0]>180?360:0,xt(a,r.properties)}function jU(t,e,n,r){r=r===void 0?ri:Number(r);var i=e/r,o=t[0]*Math.PI/180,s=ii(t[1]),a=ii(n),u=i*Math.cos(a),l=s+u;Math.abs(l)>Math.PI/2&&(l=l>0?Math.PI-l:-Math.PI-l);var f=Math.log(Math.tan(l/2+Math.PI/4)/Math.tan(s/2+Math.PI/4)),c=Math.abs(f)>1e-11?u/f:Math.cos(s),h=i*Math.sin(a)/c,d=o+h;return[(d*180/Math.PI+540)%360-180,l*180/Math.PI]}function qU(t,e){var n=pt(t),r=pt(e),i,o,s,a,u=Yn(e),l=0,f=null;n[0]>u[0]&&n[0]u[1]&&n[1]0?zU(e,a,i)||(i=a):n>0&&r<=0&&(UU(e,a,o)||(o=a)),n=r}return[i,o]}function UU(t,e,n){return Wp(t,e,n)>0}function zU(t,e,n){return Wp(t,e,n)<0}function Wp(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(n[0]-t[0])*(e[1]-t[1])}function vv(t){for(var e=pt(t),n=0,r=1,i,o;r0}function HU(t,e){if(e=e||{},!An(e))throw new Error("options is invalid");var n=e.reverse||!1,r=e.mutate||!1;if(!t)throw new Error(" is required");if(typeof n!="boolean")throw new Error(" must be a boolean");if(typeof r!="boolean")throw new Error(" must be a boolean");r===!1&&(t=Pi(t));var i=[];switch(t.type){case"GeometryCollection":return qo(t,function(o){_v(o,n)}),t;case"FeatureCollection":return vn(t,function(o){vn(_v(o,n),function(s){i.push(s)})}),ft(i)}return _v(t,n)}function _v(t,e){var n=t.type==="Feature"?t.geometry.type:t.type;switch(n){case"GeometryCollection":return qo(t,function(r){_v(r,e)}),t;case"LineString":return pI(pt(t),e),t;case"Polygon":return gI(pt(t),e),t;case"MultiLineString":return pt(t).forEach(function(r){pI(r,e)}),t;case"MultiPolygon":return pt(t).forEach(function(r){gI(r,e)}),t;case"Point":case"MultiPoint":return t}}function pI(t,e){vv(t)===e&&t.reverse()}function gI(t,e){vv(t[0])!==e&&t[0].reverse();for(var n=1;n * v. 1.2.0 * https://github.com/RaumZeit/MarchingSquares.js * * MarchingSquaresJS is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * MarchingSquaresJS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * As additional permission under GNU Affero General Public License version 3 * section 7, third-party projects (personal or commercial) may distribute, * include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the * requirement that said third-party project for that reason alone becomes * subject to any requirement of the GNU Affero General Public License version 3. * Any modifications to MarchingSquaresJS, however, must be shared with the public * and made available. * * In summary this: * - allows you to use MarchingSquaresJS at no cost * - allows you to use MarchingSquaresJS for both personal and commercial purposes * - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any * license as long as this license notice is included * - enables you to keep the source code of your program that uses MarchingSquaresJS * undisclosed * - forces you to share any modifications you have made to MarchingSquaresJS, * e.g. bug-fixes * * You should have received a copy of the GNU Affero General Public License * along with MarchingSquaresJS. If not, see . */var mI={successCallback:null,verbose:!1,polygons:!1},df={};function WU(t,e,n,r){r=r||{};for(var i=Object.keys(mI),o=0;o-1}function Oz(t,e,n){for(var r=t.length-1,i=t[0].length-1,o={rows:r,cols:i,cells:[]},s=e+Math.abs(n),a=0;as?128:64,l|=cs?32:16,l|=hs?8:4,l|=ds?2:1;var g=+l,y=0;if(l===17||l===18||l===33||l===34||l===38||l===68||l===72||l===98||l===102||l===132||l===136||l===137||l===152||l===153){var b=(f+c+h+d)/4;y=b>s?2:b0?(l=156,y=4):l=152:l===33?y>0?(l=139,y=4):l=137:l===72?y>0?(l=99,y=4):l=98:l===132&&(y>0?(l=39,y=4):l=38)}if(l!=0&&l!=170){var _,p,m,v,w,N,S,C;_=p=m=v=w=N=S=C=.5;var O=[];l===1?(m=1-F(e,h,d),C=1-F(e,f,d),O.push(tt[l])):l===169?(m=F(s,d,h),C=F(s,d,f),O.push(tt[l])):l===4?(N=1-F(e,c,h),v=F(e,d,h),O.push(Ue[l])):l===166?(N=F(s,h,c),v=1-F(s,h,d),O.push(Ue[l])):l===16?(w=F(e,h,c),p=F(e,f,c),O.push(He[l])):l===154?(w=1-F(s,c,h),p=1-F(s,c,f),O.push(He[l])):l===64?(S=F(e,d,f),_=1-F(e,c,f),O.push(ht[l])):l===106?(S=1-F(s,f,d),_=F(s,f,c),O.push(ht[l])):l===168?(v=F(s,d,h),m=F(e,d,h),C=F(e,d,f),S=F(s,d,f),O.push(nt[l]),O.push(tt[l])):l===2?(v=1-F(e,h,d),m=1-F(s,h,d),C=1-F(s,f,d),S=1-F(e,f,d),O.push(nt[l]),O.push(tt[l])):l===162?(w=F(s,h,c),N=F(e,h,c),v=1-F(e,h,d),m=1-F(s,h,d),O.push(nt[l]),O.push(tt[l])):l===8?(w=1-F(e,c,h),N=1-F(s,c,h),v=F(s,d,h),m=F(e,d,h),O.push(He[l]),O.push(Ue[l])):l===138?(w=1-F(e,c,h),N=1-F(s,c,h),_=1-F(s,c,f),p=1-F(e,c,f),O.push(He[l]),O.push(Ue[l])):l===32?(w=F(s,h,c),N=F(e,h,c),_=F(e,f,c),p=F(s,f,c),O.push(He[l]),O.push(Ue[l])):l===42?(C=1-F(s,f,d),S=1-F(e,f,d),_=F(e,f,c),p=F(s,f,c),O.push(gt[l]),O.push(ht[l])):l===128&&(C=F(e,d,f),S=F(s,d,f),_=1-F(s,c,f),p=1-F(e,c,f),O.push(gt[l]),O.push(ht[l])),l===5?(N=1-F(e,c,h),C=1-F(e,f,d),O.push(Ue[l])):l===165?(N=F(s,h,c),C=F(s,d,f),O.push(Ue[l])):l===20?(v=F(e,d,h),p=F(e,f,c),O.push(nt[l])):l===150?(v=1-F(s,h,d),p=1-F(s,c,f),O.push(nt[l])):l===80?(w=F(e,h,c),S=F(e,d,f),O.push(He[l])):l===90?(w=1-F(s,c,h),S=1-F(s,f,d),O.push(He[l])):l===65?(m=1-F(e,h,d),_=1-F(e,c,f),O.push(tt[l])):l===105?(m=F(s,d,h),_=F(s,f,c),O.push(tt[l])):l===160?(w=F(s,h,c),N=F(e,h,c),C=F(e,d,f),S=F(s,d,f),O.push(He[l]),O.push(Ue[l])):l===10?(w=1-F(e,c,h),N=1-F(s,c,h),C=1-F(s,f,d),S=1-F(e,f,d),O.push(He[l]),O.push(Ue[l])):l===130?(v=1-F(e,h,d),m=1-F(s,h,d),_=1-F(s,c,f),p=1-F(e,c,f),O.push(nt[l]),O.push(tt[l])):l===40?(v=F(s,d,h),m=F(e,d,h),_=F(e,f,c),p=F(s,f,c),O.push(nt[l]),O.push(tt[l])):l===101?(N=F(s,h,c),_=F(s,f,c),O.push(Ue[l])):l===69?(N=1-F(e,c,h),_=1-F(e,c,f),O.push(Ue[l])):l===149?(C=F(s,d,f),p=1-F(s,c,f),O.push(gt[l])):l===21?(C=1-F(e,f,d),p=F(e,f,c),O.push(gt[l])):l===86?(v=1-F(s,h,d),S=1-F(s,f,d),O.push(nt[l])):l===84?(v=F(e,d,h),S=F(e,d,f),O.push(nt[l])):l===89?(w=1-F(s,c,h),m=F(s,d,h),O.push(tt[l])):l===81?(w=F(e,h,c),m=1-F(e,h,d),O.push(tt[l])):l===96?(w=F(s,h,c),N=F(e,h,c),S=F(e,d,f),_=F(s,f,c),O.push(He[l]),O.push(Ue[l])):l===74?(w=1-F(e,c,h),N=1-F(s,c,h),S=1-F(s,f,d),_=1-F(e,c,f),O.push(He[l]),O.push(Ue[l])):l===24?(w=1-F(s,c,h),v=F(s,d,h),m=F(e,d,h),p=F(e,f,c),O.push(He[l]),O.push(tt[l])):l===146?(w=F(e,h,c),v=1-F(e,h,d),m=1-F(s,h,d),p=1-F(s,c,f),O.push(He[l]),O.push(tt[l])):l===6?(N=1-F(e,c,h),v=1-F(s,h,d),C=1-F(s,f,d),S=1-F(e,f,d),O.push(Ue[l]),O.push(nt[l])):l===164?(N=F(s,h,c),v=F(e,d,h),C=F(e,d,f),S=F(s,d,f),O.push(Ue[l]),O.push(nt[l])):l===129?(m=1-F(e,h,d),C=F(s,d,f),_=1-F(s,c,f),p=1-F(e,c,f),O.push(tt[l]),O.push(gt[l])):l===41?(m=F(s,d,h),C=1-F(e,f,d),_=F(e,f,c),p=F(s,f,c),O.push(tt[l]),O.push(gt[l])):l===66?(v=1-F(e,h,d),m=1-F(s,h,d),S=1-F(s,f,d),_=1-F(e,c,f),O.push(nt[l]),O.push(tt[l])):l===104?(v=F(s,d,h),m=F(e,d,h),S=F(e,d,f),_=F(s,f,c),O.push(tt[l]),O.push(an[l])):l===144?(w=F(e,h,c),C=F(e,d,f),S=F(s,d,f),p=1-F(s,c,f),O.push(He[l]),O.push(ht[l])):l===26?(w=1-F(s,c,h),C=1-F(s,f,d),S=1-F(e,f,d),p=F(e,f,c),O.push(He[l]),O.push(ht[l])):l===36?(N=F(s,h,c),v=F(e,d,h),_=F(e,f,c),p=F(s,f,c),O.push(Ue[l]),O.push(nt[l])):l===134?(N=1-F(e,c,h),v=1-F(s,h,d),_=1-F(s,c,f),p=1-F(e,c,f),O.push(Ue[l]),O.push(nt[l])):l===9?(w=1-F(e,c,h),N=1-F(s,c,h),m=F(s,d,h),C=1-F(e,f,d),O.push(He[l]),O.push(Ue[l])):l===161?(w=F(s,h,c),N=F(e,h,c),m=1-F(e,h,d),C=F(s,d,f),O.push(He[l]),O.push(Ue[l])):l===37?(N=F(s,h,c),C=1-F(e,f,d),_=F(e,f,c),p=F(s,f,c),O.push(Ue[l]),O.push(gt[l])):l===133?(N=1-F(e,c,h),C=F(s,d,f),_=1-F(s,c,f),p=1-F(e,c,f),O.push(Ue[l]),O.push(gt[l])):l===148?(v=F(e,d,h),C=F(e,d,f),S=F(s,d,f),p=1-F(s,c,f),O.push(nt[l]),O.push(ht[l])):l===22?(v=1-F(s,h,d),C=1-F(s,f,d),S=1-F(e,f,d),p=F(e,f,c),O.push(nt[l]),O.push(ht[l])):l===82?(w=F(e,h,c),v=1-F(e,h,d),m=1-F(s,h,d),S=1-F(s,f,d),O.push(He[l]),O.push(tt[l])):l===88?(w=1-F(s,c,h),v=F(s,d,h),m=F(e,d,h),S=F(e,d,f),O.push(He[l]),O.push(tt[l])):l===73?(w=1-F(e,c,h),N=1-F(s,c,h),m=F(s,d,h),_=1-F(e,c,f),O.push(He[l]),O.push(Ue[l])):l===97?(w=F(s,h,c),N=F(e,h,c),m=1-F(e,h,d),_=F(s,f,c),O.push(He[l]),O.push(Ue[l])):l===145?(w=F(e,h,c),m=1-F(e,h,d),C=F(s,d,f),p=1-F(s,c,f),O.push(He[l]),O.push(gt[l])):l===25?(w=1-F(s,c,h),m=F(s,d,h),C=1-F(e,f,d),p=F(e,f,c),O.push(He[l]),O.push(gt[l])):l===70?(N=1-F(e,c,h),v=1-F(s,h,d),S=1-F(s,f,d),_=1-F(e,c,f),O.push(Ue[l]),O.push(nt[l])):l===100?(N=F(s,h,c),v=F(e,d,h),S=F(e,d,f),_=F(s,f,c),O.push(Ue[l]),O.push(nt[l])):l===34?(y===0?(w=1-F(e,c,h),N=1-F(s,c,h),v=F(s,d,h),m=F(e,d,h),C=F(e,d,f),S=F(s,d,f),_=1-F(s,c,f),p=1-F(e,c,f)):(w=F(s,h,c),N=F(e,h,c),v=1-F(e,h,d),m=1-F(s,h,d),C=1-F(s,f,d),S=1-F(e,f,d),_=F(e,f,c),p=F(s,f,c)),O.push(He[l]),O.push(Ue[l]),O.push(gt[l]),O.push(ht[l])):l===35?(y===4?(w=1-F(e,c,h),N=1-F(s,c,h),v=F(s,d,h),m=F(e,d,h),C=F(e,d,f),S=F(s,d,f),_=1-F(s,c,f),p=1-F(e,c,f)):(w=F(s,h,c),N=F(e,h,c),v=1-F(e,h,d),m=1-F(s,h,d),C=1-F(s,f,d),S=1-F(e,f,d),_=F(e,f,c),p=F(s,f,c)),O.push(He[l]),O.push(Ue[l]),O.push(tt[l]),O.push(ht[l])):l===136?(y===0?(w=F(s,h,c),N=F(e,h,c),v=1-F(e,h,d),m=1-F(s,h,d),C=1-F(s,f,d),S=1-F(e,f,d),_=F(e,f,c),p=F(s,f,c)):(w=1-F(e,c,h),N=1-F(s,c,h),v=F(s,d,h),m=F(e,d,h),C=F(e,d,f),S=F(s,d,f),_=1-F(s,c,f),p=1-F(e,c,f)),O.push(He[l]),O.push(Ue[l]),O.push(gt[l]),O.push(ht[l])):l===153?(y===0?(w=F(e,h,c),m=1-F(e,h,d),C=1-F(e,f,d),p=F(e,f,c)):(w=1-F(s,c,h),m=F(s,d,h),C=F(s,d,f),p=1-F(s,c,f)),O.push(He[l]),O.push(tt[l])):l===102?(y===0?(N=1-F(e,c,h),v=F(e,d,h),S=F(e,d,f),_=1-F(e,c,f)):(N=F(s,h,c),v=1-F(s,h,d),S=1-F(s,f,d),_=F(s,f,c)),O.push(Ue[l]),O.push(ht[l])):l===155?(y===4?(w=F(e,h,c),m=1-F(e,h,d),C=1-F(e,f,d),p=F(e,f,c)):(w=1-F(s,c,h),m=F(s,d,h),C=F(s,d,f),p=1-F(s,c,f)),O.push(He[l]),O.push(gt[l])):l===103?(y===4?(N=1-F(e,c,h),v=F(e,d,h),S=F(e,d,f),_=1-F(e,c,f)):(N=F(s,h,c),v=1-F(s,h,d),S=1-F(s,f,d),_=F(s,f,c)),O.push(Ue[l]),O.push(nt[l])):l===152?(y===0?(w=F(e,h,c),v=1-F(e,h,d),m=1-F(s,h,d),C=1-F(s,f,d),S=1-F(e,f,d),p=F(e,f,c)):(w=1-F(s,c,h),v=F(s,d,h),m=F(e,d,h),C=F(e,d,f),S=F(s,d,f),p=1-F(s,c,f)),O.push(He[l]),O.push(nt[l]),O.push(tt[l])):l===156?(y===4?(w=F(e,h,c),v=1-F(e,h,d),m=1-F(s,h,d),C=1-F(s,f,d),S=1-F(e,f,d),p=F(e,f,c)):(w=1-F(s,c,h),v=F(s,d,h),m=F(e,d,h),C=F(e,d,f),S=F(s,d,f),p=1-F(s,c,f)),O.push(He[l]),O.push(tt[l]),O.push(ht[l])):l===137?(y===0?(w=F(s,h,c),N=F(e,h,c),m=1-F(e,h,d),C=1-F(e,f,d),_=F(e,f,c),p=F(s,f,c)):(w=1-F(e,c,h),N=1-F(s,c,h),m=F(s,d,h),C=F(s,d,f),_=1-F(s,c,f),p=1-F(e,c,f)),O.push(He[l]),O.push(Ue[l]),O.push(tt[l])):l===139?(y===4?(w=F(s,h,c),N=F(e,h,c),m=1-F(e,h,d),C=1-F(e,f,d),_=F(e,f,c),p=F(s,f,c)):(w=1-F(e,c,h),N=1-F(s,c,h),m=F(s,d,h),C=F(s,d,f),_=1-F(s,c,f),p=1-F(e,c,f)),O.push(He[l]),O.push(Ue[l]),O.push(gt[l])):l===98?(y===0?(w=1-F(e,c,h),N=1-F(s,c,h),v=F(s,d,h),m=F(e,d,h),S=F(e,d,f),_=1-F(e,c,f)):(w=F(s,h,c),N=F(e,h,c),v=1-F(e,h,d),m=1-F(s,h,d),S=1-F(s,f,d),_=F(s,f,c)),O.push(He[l]),O.push(Ue[l]),O.push(ht[l])):l===99?(y===4?(w=1-F(e,c,h),N=1-F(s,c,h),v=F(s,d,h),m=F(e,d,h),S=F(e,d,f),_=1-F(e,c,f)):(w=F(s,h,c),N=F(e,h,c),v=1-F(e,h,d),m=1-F(s,h,d),S=1-F(s,f,d),_=F(s,f,c)),O.push(He[l]),O.push(Ue[l]),O.push(tt[l])):l===38?(y===0?(N=1-F(e,c,h),v=F(e,d,h),C=F(e,d,f),S=F(s,d,f),_=1-F(s,c,f),p=1-F(e,c,f)):(N=F(s,h,c),v=1-F(s,h,d),C=1-F(s,f,d),S=1-F(e,f,d),_=F(e,f,c),p=F(s,f,c)),O.push(Ue[l]),O.push(gt[l]),O.push(ht[l])):l===39?(y===4?(N=1-F(e,c,h),v=F(e,d,h),C=F(e,d,f),S=F(s,d,f),_=1-F(s,c,f),p=1-F(e,c,f)):(N=F(s,h,c),v=1-F(s,h,d),C=1-F(s,f,d),S=1-F(e,f,d),_=F(e,f,c),p=F(s,f,c)),O.push(Ue[l]),O.push(nt[l]),O.push(ht[l])):l===85&&(w=1,N=0,v=1,m=0,C=0,S=1,_=0,p=1),(_<0||_>1||p<0||p>1||w<0||w>1||v<0||v>1||C<0||C>1||S<0||S>1)&&console.log("MarchingSquaresJS-isoBands: "+l+" "+g+" "+f+","+c+","+h+","+d+" "+y+" "+_+" "+p+" "+w+" "+N+" "+v+" "+m+" "+C+" "+S),o.cells[a][u]={cval:l,cval_real:g,flipped:y,topleft:_,topright:p,righttop:w,rightbottom:N,bottomright:v,bottomleft:m,leftbottom:C,lefttop:S,edges:O}}}}}return o}function Tz(t){for(var e=[],n=t.rows,r=t.cols,i=[],o=0;o0){var a=t.cells[o][s],u=kz(a),l=null,f=s,c=o;u!==null&&i.push([u.p[0]+f,u.p[1]+c]);do{if(l=Pz(t.cells[c][f],u.x,u.y,u.o),l!==null)i.push([l.p[0]+f,l.p[1]+c]),f+=l.x,c+=l.y,u=l;else break;if(c<0||c>=n||f<0||f>=r||typeof t.cells[c][f]>"u"){f-=l.x,c-=l.y;var h=Iz(t,f,c,l.x,l.y,l.o);if(h!==null)h.path.forEach(function(d){i.push(d)}),f=h.i,c=h.j,u=h;else break}}while(typeof t.cells[c][f]<"u"&&t.cells[c][f].edges.length>0);e.push(i),i=[],t.cells[o][s].edges.length>0&&s--}return e}function Iz(t,e,n,r,i,o){for(var s=t.cells[n][e],a=s.cval_real,u=e+r,l=n+i,f=[],c=!1;!c;){if(typeof t.cells[l]>"u"||typeof t.cells[l][u]>"u")if(l-=i,u-=r,s=t.cells[l][u],a=s.cval_real,i===-1)if(o===0)if(a&Li)f.push([u,l]),r=-1,i=0,o=0;else if(a&vi)f.push([u+1,l]),r=1,i=0,o=0;else{f.push([u+s.bottomright,l]),r=0,i=1,o=1,c=!0;break}else if(a&Li)f.push([u,l]),r=-1,i=0,o=0;else if(a&vi){f.push([u+s.bottomright,l]),r=0,i=1,o=1,c=!0;break}else{f.push([u+s.bottomleft,l]),r=0,i=1,o=0,c=!0;break}else if(i===1)if(o===0)if(a&Ds)f.push([u+1,l+1]),r=1,i=0,o=1;else if(a&Ki){f.push([u+s.topleft,l+1]),r=0,i=-1,o=0,c=!0;break}else{f.push([u+s.topright,l+1]),r=0,i=-1,o=1,c=!0;break}else a&Ds?(f.push([u+1,l+1]),r=1,i=0,o=1):(f.push([u+1,l+1]),r=1,i=0,o=1);else if(r===-1)if(o===0)if(a&Ki)f.push([u,l+1]),r=0,i=1,o=0;else if(a&Li){f.push([u,l+s.leftbottom]),r=1,i=0,o=0,c=!0;break}else{f.push([u,l+s.lefttop]),r=1,i=0,o=1,c=!0;break}else if(a&Ki)f.push([u,l+1]),r=0,i=1,o=0;else{console.log("MarchingSquaresJS-isoBands: wtf");break}else if(r===1)if(o===0)if(a&vi)f.push([u+1,l]),r=0,i=-1,o=1;else{f.push([u+1,l+s.rightbottom]),r=-1,i=0,o=0,c=!0;break}else if(a&vi)f.push([u+1,l]),r=0,i=-1,o=1;else if(a&Ds){f.push([u+1,l+s.righttop]),r=-1,i=0,o=1;break}else{f.push([u+1,l+s.rightbottom]),r=-1,i=0,o=0,c=!0;break}else{console.log("MarchingSquaresJS-isoBands: we came from nowhere!");break}else if(s=t.cells[l][u],a=s.cval_real,r===-1)if(o===0)if(typeof t.cells[l-1]<"u"&&typeof t.cells[l-1][u]<"u")r=0,i=-1,o=1;else if(a&Li)f.push([u,l]);else{f.push([u+s.bottomright,l]),r=0,i=1,o=1,c=!0;break}else if(a&Ki)console.log("MarchingSquaresJS-isoBands: proceeding in x-direction!");else{console.log("MarchingSquaresJS-isoBands: found entry from top at "+u+","+l);break}else if(r===1)if(o===0){console.log("MarchingSquaresJS-isoBands: wtf");break}else if(typeof t.cells[l+1]<"u"&&typeof t.cells[l+1][u]<"u")r=0,i=1,o=0;else if(a&Ds)f.push([u+1,l+1]),r=1,i=0,o=1;else{f.push([u+s.topleft,l+1]),r=0,i=-1,o=0,c=!0;break}else if(i===-1)if(o===1)if(typeof t.cells[l][u+1]<"u")r=1,i=0,o=1;else if(a&vi)f.push([u+1,l]),r=0,i=-1,o=1;else{f.push([u+1,l+s.righttop]),r=-1,i=0,o=1,c=!0;break}else{console.log("MarchingSquaresJS-isoBands: wtf");break}else if(i===1)if(o===0)if(typeof t.cells[l][u-1]<"u")r=-1,i=0,o=0;else if(a&Ki)f.push([u,l+1]),r=0,i=1,o=0;else{f.push([u,l+s.leftbottom]),r=1,i=0,o=0,c=!0;break}else{console.log("MarchingSquaresJS-isoBands: wtf");break}else{console.log("MarchingSquaresJS-isoBands: where did we came from???");break}if(u+=r,l+=i,u===e&&l===n)break}return{path:f,i:u,j:l,x:r,y:i,o}}function Mz(t,e){delete t.edges[e];for(var n=e+1;n0){var e=t.edges[t.edges.length-1],n=t.cval_real;switch(e){case 0:return n&Ds?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 1:return n&vi?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 2:return n&vi?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 3:return n&Li?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 4:return n&Ds?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 5:return n&vi?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 6:return n&vi?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 7:return n&Li?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 8:return n&vi?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.righttop],x:-1,y:0,o:1};case 9:return n&Li?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 10:return n&Li?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.righttop],x:-1,y:0,o:1};case 11:return n&Ki?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 12:return n&vi?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 13:return n&Li?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 14:return n&Li?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 15:return n&Ki?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 16:return n&vi?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 17:return n&Ki?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 18:return n&Li?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 19:return n&Ki?{p:[t.bottomleft,0],x:0,y:1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 20:return n&Ki?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 21:return n&Ds?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.topright,1],x:0,y:-1,o:1};case 22:return n&Ki?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 23:return n&Ds?{p:[0,t.lefttop],x:1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};default:console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(t);break}}return null}function Pz(t,e,n,r){var i,o,s,a,u=t.cval,l;switch(e){case-1:switch(r){case 0:i=Ue[u],s=Ht[u],a=Gt[u],l=Yt[u];break;default:i=He[u],s=qt[u],a=Ut[u],l=zt[u];break}break;case 1:switch(r){case 0:i=gt[u],s=rn[u],a=on[u],l=sn[u];break;default:i=ht[u],s=en[u],a=tn[u],l=nn[u];break}break;default:switch(n){case-1:switch(r){case 0:i=an[u],s=Rt[u],a=Ft[u],l=Bt[u];break;default:i=un[u],s=Vt[u],a=$t[u],l=jt[u];break}break;case 1:switch(r){case 0:i=tt[u],s=Wt[u],a=Xt[u],l=Kt[u];break;default:i=nt[u],s=Zt[u],a=Jt[u],l=Qt[u];break}break}break}if(o=t.edges.indexOf(i),typeof t.edges[o]<"u")Mz(t,o);else return null;switch(u=t.cval_real,i){case 0:u&Ds?(e=t.topleft,n=1):(e=1,n=t.righttop);break;case 1:u&vi?(e=1,n=t.rightbottom):(e=t.topleft,n=1);break;case 2:u&vi?(e=t.topleft,n=1):(e=t.bottomright,n=0);break;case 3:u&Li?(e=t.bottomleft,n=0):(e=t.topleft,n=1);break;case 4:u&Ds?(e=t.topright,n=1):(e=1,n=t.righttop);break;case 5:u&vi?(e=1,n=t.rightbottom):(e=t.topright,n=1);break;case 6:u&vi?(e=t.topright,n=1):(e=t.bottomright,n=0);break;case 7:u&Li?(e=t.bottomleft,n=0):(e=t.topright,n=1);break;case 8:u&vi?(e=1,n=t.righttop):(e=t.bottomright,n=0);break;case 9:u&Li?(e=t.bottomleft,n=0):(e=1,n=t.righttop);break;case 10:u&Li?(e=1,n=t.righttop):(e=0,n=t.leftbottom);break;case 11:u&Ki?(e=0,n=t.lefttop):(e=1,n=t.righttop);break;case 12:u&vi?(e=1,n=t.rightbottom):(e=t.bottomright,n=0);break;case 13:u&Li?(e=t.bottomleft,n=0):(e=1,n=t.rightbottom);break;case 14:u&Li?(e=1,n=t.rightbottom):(e=0,n=t.leftbottom);break;case 15:u&Ki?(e=0,n=t.lefttop):(e=1,n=t.rightbottom);break;case 16:u&vi?(e=0,n=t.leftbottom):(e=t.bottomright,n=0);break;case 17:u&Ki?(e=0,n=t.lefttop):(e=t.bottomright,n=0);break;case 18:u&Li?(e=t.bottomleft,n=0):(e=0,n=t.leftbottom);break;case 19:u&Ki?(e=0,n=t.lefttop):(e=t.bottomleft,n=0);break;case 20:u&Ki?(e=0,n=t.leftbottom):(e=t.topleft,n=1);break;case 21:u&Ds?(e=t.topright,n=1):(e=0,n=t.leftbottom);break;case 22:u&Ki?(e=0,n=t.lefttop):(e=t.topleft,n=1);break;case 23:u&Ds?(e=t.topright,n=1):(e=0,n=t.lefttop);break;default:return console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(t),null}return(typeof e>"u"||typeof n>"u"||typeof s>"u"||typeof a>"u"||typeof l>"u")&&(console.log("MarchingSquaresJS-isoBands: undefined value!"),console.log(t),console.log(e+" "+n+" "+s+" "+a+" "+l)),{p:[e,n],x:s,y:a,o:l}}function Az(t){var e=[],n=0;return t.cells.forEach(function(r,i){r.forEach(function(o,s){if(typeof o<"u"){var a=$e[o.cval](o);typeof a=="object"&&OE(a)?typeof a[0]=="object"&&OE(a[0])?typeof a[0][0]=="object"&&OE(a[0][0])?a.forEach(function(u){u.forEach(function(l){l[0]+=s,l[1]+=i}),e[n++]=u}):(a.forEach(function(u){u[0]+=s,u[1]+=i}),e[n++]=a):console.log("MarchingSquaresJS-isoBands: bandcell polygon with malformed coordinates"):console.log("MarchingSquaresJS-isoBands: bandcell polygon with null coordinates")}})}),e}function Lz(t,e,n){if(n=n||{},!An(n))throw new Error("options is invalid");var r=n.zProperty||"elevation",i=n.commonProperties||{},o=n.breaksProperties||[];if(Wl(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks is not an Array");if(!An(i))throw new Error("commonProperties is not an Object");if(!Array.isArray(o))throw new Error("breaksProperties is not an Array");var s=GU(t,{zProperty:r,flip:!0}),a=Dz(s,e,r);a=Rz(a,s,t);var u=a.map(function(l,f){if(o[f]&&!An(o[f]))throw new Error("Each mappedProperty is required to be an Object");var c=wb({},i,o[f]);c[r]=l[r];var h=jo(l.groupedRings,c);return h});return ft(u)}function Dz(t,e,n){for(var r=[],i=1;i0){var f=r[u-1],c=Wz(l,f);c!==!1&&(f[1]=c,l[0]=c),s.push(f[0]),u===o.length-2&&(s.push(l[0]),s.push(l[1]))}o.length===2&&(s.push(l[0]),s.push(l[1]))}}),kn(s,t.properties)}function Kz(t,e,n){var r=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),i=t[0]+n*(e[1]-t[1])/r,o=e[0]+n*(e[1]-t[1])/r,s=t[1]+n*(t[0]-e[0])/r,a=e[1]+n*(t[0]-e[0])/r;return[[i,s],[o,a]]}function Zz(t){return(t>0)-(t<0)||+t}function IE(t,e,n){var r=e[0]-t[0],i=e[1]-t[1],o=n[0]-e[0],s=n[1]-e[1];return Zz(r*s-o*i)}function Jz(t,e){var n=t.geometry.coordinates[0].map(function(s){return s[0]}),r=t.geometry.coordinates[0].map(function(s){return s[1]}),i=e.geometry.coordinates[0].map(function(s){return s[0]}),o=e.geometry.coordinates[0].map(function(s){return s[1]});return Math.max.apply(null,n)===Math.max.apply(null,i)&&Math.max.apply(null,r)===Math.max.apply(null,o)&&Math.min.apply(null,n)===Math.min.apply(null,i)&&Math.min.apply(null,r)===Math.min.apply(null,o)}function EI(t,e){return e.geometry.coordinates[0].every(function(n){return Xn(xt(n),t)})}function Qz(t,e){return t[0]===e[0]&&t[1]===e[1]}var wI=function(){function t(e){this.id=t.buildId(e),this.coordinates=e,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return t.buildId=function(e){return e.join(",")},t.prototype.removeInnerEdge=function(e){this.innerEdges=this.innerEdges.filter(function(n){return n.from.id!==e.from.id})},t.prototype.removeOuterEdge=function(e){this.outerEdges=this.outerEdges.filter(function(n){return n.to.id!==e.to.id})},t.prototype.addOuterEdge=function(e){this.outerEdges.push(e),this.outerEdgesSorted=!1},t.prototype.sortOuterEdges=function(){var e=this;this.outerEdgesSorted||(this.outerEdges.sort(function(n,r){var i=n.to,o=r.to;if(i.coordinates[0]-e.coordinates[0]>=0&&o.coordinates[0]-e.coordinates[0]<0)return 1;if(i.coordinates[0]-e.coordinates[0]<0&&o.coordinates[0]-e.coordinates[0]>=0)return-1;if(i.coordinates[0]-e.coordinates[0]===0&&o.coordinates[0]-e.coordinates[0]===0)return i.coordinates[1]-e.coordinates[1]>=0||o.coordinates[1]-e.coordinates[1]>=0?i.coordinates[1]-o.coordinates[1]:o.coordinates[1]-i.coordinates[1];var s=IE(e.coordinates,i.coordinates,o.coordinates);if(s<0)return 1;if(s>0)return-1;var a=Math.pow(i.coordinates[0]-e.coordinates[0],2)+Math.pow(i.coordinates[1]-e.coordinates[1],2),u=Math.pow(o.coordinates[0]-e.coordinates[0],2)+Math.pow(o.coordinates[1]-e.coordinates[1],2);return a-u}),this.outerEdgesSorted=!0)},t.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},t.prototype.getOuterEdge=function(e){return this.sortOuterEdges(),this.outerEdges[e]},t.prototype.addInnerEdge=function(e){this.innerEdges.push(e)},t}(),eH=function(){function t(e,n){this.from=e,this.to=n,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return t.prototype.getSymetric=function(){return this.symetric||(this.symetric=new t(this.to,this.from),this.symetric.symetric=this),this.symetric},t.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},t.prototype.isEqual=function(e){return this.from.id===e.from.id&&this.to.id===e.to.id},t.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},t.prototype.toLineString=function(){return kn([this.from.coordinates,this.to.coordinates])},t.prototype.compareTo=function(e){return IE(e.from.coordinates,e.to.coordinates,this.to.coordinates)},t}(),tH=function(){function t(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return t.prototype.push=function(e){this.edges.push(e),this.polygon=this.envelope=void 0},t.prototype.get=function(e){return this.edges[e]},Object.defineProperty(t.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),t.prototype.forEach=function(e){this.edges.forEach(e)},t.prototype.map=function(e){return this.edges.map(e)},t.prototype.some=function(e){return this.edges.some(e)},t.prototype.isValid=function(){return!0},t.prototype.isHole=function(){var e=this,n=this.edges.reduce(function(s,a,u){return a.from.coordinates[1]>e.edges[s].from.coordinates[1]&&(s=u),s},0),r=(n===0?this.length:n)-1,i=(n+1)%this.length,o=IE(this.edges[r].from.coordinates,this.edges[n].from.coordinates,this.edges[i].from.coordinates);return o===0?this.edges[r].from.coordinates[0]>this.edges[i].from.coordinates[0]:o>0},t.prototype.toMultiPoint=function(){return Mp(this.edges.map(function(e){return e.from.coordinates}))},t.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var e=this.edges.map(function(n){return n.from.coordinates});return e.push(this.edges[0].from.coordinates),this.polygon=It([e])},t.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=w2(this.toPolygon())},t.findEdgeRingContaining=function(e,n){var r=e.getEnvelope(),i,o;return n.forEach(function(s){var a=s.getEnvelope();if(o&&(i=o.getEnvelope()),!Jz(a,r)&&EI(a,r)){for(var u=e.map(function(g){return g.from.coordinates}),l=void 0,f=function(g){s.some(function(y){return Qz(g,y.from.coordinates)})||(l=g)},c=0,h=u;c"u"?Object.keys(this.nodes).forEach(function(r){return n._computeNextCWEdges(n.nodes[r])}):e.getOuterEdges().forEach(function(r,i){e.getOuterEdge((i===0?e.getOuterEdges().length:i)-1).symetric.next=r})},t.prototype._computeNextCCWEdges=function(e,n){for(var r=e.getOuterEdges(),i,o,s=r.length-1;s>=0;--s){var a=r[s],u=a.symetric,l=void 0,f=void 0;a.label===n&&(l=a),u.label===n&&(f=u),!(!l||!f)&&(f&&(o=f),l&&(o&&(o.next=l,o=void 0),i||(i=l)))}o&&(o.next=i)},t.prototype._findLabeledEdgeRings=function(){var e=[],n=0;return this.edges.forEach(function(r){if(!(r.label>=0)){e.push(r);var i=r;do i.label=n,i=i.next;while(!r.isEqual(i));n++}}),e},t.prototype.getEdgeRings=function(){var e=this;this._computeNextCWEdges(),this.edges.forEach(function(r){r.label=void 0}),this._findLabeledEdgeRings().forEach(function(r){e._findIntersectionNodes(r).forEach(function(i){e._computeNextCCWEdges(i,r.label)})});var n=[];return this.edges.forEach(function(r){r.ring||n.push(e._findEdgeRing(r))}),n},t.prototype._findIntersectionNodes=function(e){var n=[],r=e,i=function(){var o=0;r.from.getOuterEdges().forEach(function(s){s.label===e.label&&++o}),o>1&&n.push(r.from),r=r.next};do i();while(!e.isEqual(r));return n},t.prototype._findEdgeRing=function(e){var n=e,r=new xI;do r.push(n),n.ring=r,n=n.next;while(!e.isEqual(n));return r},t.prototype.removeNode=function(e){var n=this;e.getOuterEdges().forEach(function(r){return n.removeEdge(r)}),e.innerEdges.forEach(function(r){return n.removeEdge(r)}),delete this.nodes[e.id]},t.prototype.removeEdge=function(e){this.edges=this.edges.filter(function(n){return!n.isEqual(e)}),e.deleteEdge()},t}();function iH(t){var e=rH.fromGeoJson(t);e.deleteDangles(),e.deleteCutEdges();var n=[],r=[];return e.getEdgeRings().filter(function(i){return i.isValid()}).forEach(function(i){i.isHole()?n.push(i):r.push(i)}),n.forEach(function(i){xI.findEdgeRingContaining(i,r)&&r.push(i)}),ft(r.map(function(i){return i.toPolygon()}))}function SI(t,e){var n=!0;return yi(t,function(r){yi(e,function(i){if(n===!1)return!1;n=oH(r.geometry,i.geometry)})}),n}function oH(t,e){switch(t.type){case"Point":switch(e.type){case"Point":return!uH(t.coordinates,e.coordinates);case"LineString":return!CI(e,t);case"Polygon":return!Xn(t,e)}break;case"LineString":switch(e.type){case"Point":return!CI(t,e);case"LineString":return!sH(t,e);case"Polygon":return!NI(e,t)}break;case"Polygon":switch(e.type){case"Point":return!Xn(e,t);case"LineString":return!NI(t,e);case"Polygon":return!aH(e,t)}}return!1}function CI(t,e){for(var n=0;n0}function NI(t,e){for(var n=0,r=e.coordinates;n0}function aH(t,e){for(var n=0,r=t.coordinates[0];n0}function lH(t,e,n){var r=n[0]-t[0],i=n[1]-t[1],o=e[0]-t[0],s=e[1]-t[1],a=r*s-i*o;return a!==0?!1:Math.abs(o)>=Math.abs(s)?o>0?t[0]<=n[0]&&n[0]<=e[0]:e[0]<=n[0]&&n[0]<=t[0]:s>0?t[1]<=n[1]&&n[1]<=e[1]:e[1]<=n[1]&&n[1]<=t[1]}function uH(t,e){return t[0]===e[0]&&t[1]===e[1]}function cH(t,e){var n=Wn(t),r=Wn(e),i=n.type,o=r.type,s=n.coordinates,a=r.coordinates;switch(i){case"Point":switch(o){case"Point":return ME(s,a);default:throw new Error("feature2 "+o+" geometry not supported")}case"MultiPoint":switch(o){case"Point":return fH(n,r);case"MultiPoint":return hH(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"Point":return Uo(r,n,{ignoreEndVertices:!0});case"LineString":return gH(n,r);case"MultiPoint":return dH(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Point":return Xn(r,n,{ignoreBoundary:!0});case"LineString":return mH(n,r);case"Polygon":return yH(n,r);case"MultiPoint":return pH(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}function fH(t,e){var n,r=!1;for(n=0;ne[0]||t[2]e[1]||t[3]0)for(var r=0;r0}function MI(t,e){for(var n=!1,r=!1,i=t.coordinates.length,o=0;o=Math.abs(a)?s>0?t[0]<=n[0]&&n[0]<=e[0]:e[0]<=n[0]&&n[0]<=t[0]:a>0?t[1]<=n[1]&&n[1]<=e[1]:e[1]<=n[1]&&n[1]<=t[1]:Math.abs(s)>=Math.abs(a)?s>0?t[0]0?t[1]=0&&(n=[].concat(t.slice(r,t.length),t.slice(1,r+1))),n},Za.prototype.comparePath=function(t,e){var n=this;return t.every(function(r,i){return n.compareCoord(r,this[i])},e)},Za.prototype.comparePolygon=function(t,e){if(this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)){var n=t.coordinates.slice(1,t.coordinates.length),r=e.coordinates.slice(1,e.coordinates.length),i=this;return n.every(function(o){return this.some(function(s){return i.compareLine(o,s,1,!0)})},r)}else return!1},Za.prototype.compareFeature=function(t,e){return t.id!==e.id||!this.objectComparator(t.properties,e.properties)||!this.compareBBox(t,e)?!1:this.compare(t.geometry,e.geometry)},Za.prototype.compareBBox=function(t,e){return!!(!t.bbox&&!e.bbox||t.bbox&&e.bbox&&this.compareCoord(t.bbox,e.bbox))},Za.prototype.removePseudo=function(t){return t};function wH(t,e){return EH(t,e,{strict:!0})}var xH=Za;const LI=Ls(xH);function SH(t,e){var n=Wn(t),r=Wn(e),i=n.type,o=r.type;if(i==="MultiPoint"&&o!=="MultiPoint"||(i==="LineString"||i==="MultiLineString")&&o!=="LineString"&&o!=="MultiLineString"||(i==="Polygon"||i==="MultiPolygon")&&o!=="Polygon"&&o!=="MultiPolygon")throw new Error("features must be of the same type");if(i==="Point")throw new Error("Point geometry not supported");var s=new LI({precision:6});if(s.compare(t,e))return!1;var a=0;switch(i){case"MultiPoint":for(var u=0;u0}function CH(t,e){var n=Wn(t).type,r=Wn(e).type;if(n!==r)return!1;var i=new LI({precision:6});return i.compare(af(t),af(e))}function DI(t,e){var n=!1;return yi(t,function(r){yi(e,function(i){if(n===!0)return!0;n=!SI(r.geometry,i.geometry)})}),n}var RI={exports:{}},kE={exports:{}},FI;function NH(){return FI||(FI=1,function(t){function e(n,r,i,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(n,r,i,o)}e.prototype.run=function(n,r,i,o){this._init(n,r,i,o);for(var s=0;s=this.minPts&&(r=this._mergeArrays(r,s))}this._assigned[o]!==1&&this._addToCluster(o,n)}},e.prototype._addToCluster=function(n,r){this.clusters[r].push(n),this._assigned[n]=1},e.prototype._regionQuery=function(n){for(var r=[],i=0;i0){for(var f=0;f=0);return r},e.prototype.assign=function(){for(var n=!1,r=this.dataset.length,i,o=0;o"u"&&(n[r]=[]),n[r].push(i);return n},e.prototype.argmin=function(n,r,i){for(var o=Number.MAX_VALUE,s=0,a=r.length,u,l=0;ls&&(i=o):r=this.minPts)return o}},n.prototype._regionQuery=function(r,i){i=i||this.epsilon;for(var o=[],s=0,a=this.dataset.length;s0;i.length0;){var u=e[Math.floor(Math.random()*s)],l=a?u.join("_"):""+u;r[l]||(r[l]=!0,i.push(u))}if(i.length0,a=e[Math.floor(Math.random()*o)];for(s?a.join("_"):""+a,i.push(a);i.length0,d=[];if(n)n=="kmrand"?i=RH(t,e):n=="kmpp"?i=FH(t,e):i=n;else for(var g={};i.lengthn&&(e.numberOfClusters=n),e.mutate!==!0&&(t=Pi(t));var r=Bh(t),i=r.slice(0,e.numberOfClusters),o=$H(r,e.numberOfClusters,i),s={};return o.centroids.forEach(function(a,u){s[u]=a}),vn(t,function(a,u){var l=o.idxs[u];a.properties.cluster=l,a.properties.centroid=s[l]}),t}function qH(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");var n=YI(t,"line1");if(n!=="LineString")throw new Error("line1 must be a LineString");var r=YI(e,"line2");if(r!=="LineString")throw new Error("line2 must be a LineString");for(var i=uf(af(t)).features,o=uf(af(e)).features,s=0;s0;){var u=s.pop();if(u===n)return WI(u);u.closed=!0;for(var l=t.neighbors(u),f=0,c=l.length;f0&&(this.content[0]=e,this.bubbleUp(0)),t},remove:function(t){var e=this.content.indexOf(t),n=this.content.pop();e!==this.content.length-1&&(this.content[e]=n,this.scoreFunction(n)0;){var n=(t+1>>1)-1,r=this.content[n];if(this.scoreFunction(e)=h;){for(var G=[],J=[],W=c+S,V=0;W<=d;){var D=xt([W,B]),j=GH(D,o);G.push(j?0:1),J.push(W+"|"+B);var z=Ln(D,t);!j&&z0)){if(y/=d,d<0){if(y0){if(y>h)return;y>c&&(c=y)}if(y=r-a,!(!d&&y<0)){if(y/=d,d<0){if(y>h)return;y>c&&(c=y)}else if(d>0){if(y0)){if(y/=g,g<0){if(y0){if(y>h)return;y>c&&(c=y)}if(y=i-u,!(!g&&y<0)){if(y/=g,g<0){if(y>h)return;y>c&&(c=y)}else if(g>0){if(y0)&&!(h<1)||(c>0&&(t[0]=[a+c*d,u+c*g]),h<1&&(t[1]=[a+h*d,u+h*g])),!0}}}}}function KH(t,e,n,r,i){var o=t[1];if(o)return!0;var s=t[0],a=t.left,u=t.right,l=a[0],f=a[1],c=u[0],h=u[1],d=(l+c)/2,g=(f+h)/2,y,b;if(h===f){if(d=r)return;if(l>c){if(!s)s=[d,n];else if(s[1]>=i)return;o=[d,i]}else{if(!s)s=[d,i];else if(s[1]1)if(l>c){if(!s)s=[(n-b)/y,n];else if(s[1]>=i)return;o=[(i-b)/y,i]}else{if(!s)s=[(i-b)/y,i];else if(s[1]=r)return;o=[r,y*r+b]}else{if(!s)s=[r,y*r+b];else if(s[0]er||Math.abs(o[0][1]-o[1][1])>er))&&delete uo[i]}function JH(t){return cs[t.index]={site:t,halfedges:[]}}function QH(t,e){var n=t.site,r=e.left,i=e.right;return n===i&&(i=r,r=n),i?Math.atan2(i[1]-r[1],i[0]-r[0]):(n===r?(r=e[1],i=e[0]):(r=e[0],i=e[1]),Math.atan2(r[0]-i[0],i[1]-r[1]))}function JI(t,e){return e[+(e.left!==t.site)]}function eG(t,e){return e[+(e.left===t.site)]}function tG(){for(var t=0,e=cs.length,n,r,i,o;ter||Math.abs(b-d)>er)&&(l.splice(u,0,uo.push(Jp(a,g,Math.abs(y-t)er?[t,Math.abs(h-t)er?[Math.abs(d-r)er?[n,Math.abs(h-n)er?[Math.abs(d-e)=-lG)){var d=u*u+l*l,g=f*f+c*c,y=(c*d-l*g)/h,b=(u*g-f*d)/h,_=QI.pop()||new rG;_.arc=t,_.site=i,_.x=y+s,_.y=(_.cy=b+a)+Math.sqrt(y*y+b*b),t.circle=_;for(var p=null,m=Qp._;m;)if(_.yer)a=a.L;else if(s=e-aG(a,n),s>er){if(!a.R){r=a;break}a=a.R}else{o>-er?(r=a.P,i=a):s>-er?(r=a,i=a.N):r=i=a;break}JH(t);var u=tM(t);if(nd.insert(r,u),!(!r&&!i)){if(r===i){td(r),i=tM(r.site),nd.insert(u,i),u.edge=i.edge=Zp(r.site,u.site),ed(r),ed(i);return}if(!i){u.edge=Zp(r.site,u.site);return}td(r),td(i);var l=r.site,f=l[0],c=l[1],h=t[0]-f,d=t[1]-c,g=i.site,y=g[0]-f,b=g[1]-c,_=2*(h*b-d*y),p=h*h+d*d,m=y*y+b*b,v=[(b*p-d*m)/_+f,(h*m-y*p)/_+c];Cv(i.edge,l,g,v),u.edge=Zp(l,t,null,v),i.edge=Zp(t,g,null,v),ed(r),ed(i)}}function nM(t,e){var n=t.site,r=n[0],i=n[1],o=i-e;if(!o)return r;var s=t.P;if(!s)return-1/0;n=s.site;var a=n[0],u=n[1],l=u-e;if(!l)return a;var f=a-r,c=1/o-1/l,h=f/l;return c?(-h+Math.sqrt(h*h-2*c*(f*f/(-2*l)-u+l/2+i-o/2)))/c+r:(r+a)/2}function aG(t,e){var n=t.N;if(n)return nM(n,e);var r=t.site;return r[1]===e?r[0]:1/0}var er=1e-6,lG=1e-12,nd,cs,Qp,uo;function uG(t,e,n){return(t[0]-n[0])*(e[1]-t[1])-(t[0]-e[0])*(n[1]-t[1])}function cG(t,e){return e[1]-t[1]||e[0]-t[0]}function BE(t,e){var n=t.sort(cG).pop(),r,i,o;for(uo=[],cs=new Array(t.length),nd=new xv,Qp=new xv;;)if(o=RE,n&&(!o||n[1]=s)return null;var u=t-a.site[0],l=e-a.site[1],f=u*u+l*l;do a=r.cells[i=o],o=null,a.halfedges.forEach(function(c){var h=r.edges[c],d=h.left;if(!((d===a.site||!d)&&!(d=h.right))){var g=t-d[0],y=e-d[1],b=g*g+y*y;b=-270&&(g=-g),d<-180&&d>=-360&&(y=-y),o==="degrees"){var b=g*Math.cos(f)+y*Math.sin(f),_=y*Math.cos(f)-g*Math.sin(f);g=b,y=_}c.push([g+l[0],y+l[1]])}return c.push(c[0]),o==="degrees"?It([c],u):yI(It([c],u),s,{pivot:a})}function iM(t){var e=t*Math.PI/180;return Math.tan(e)}function VE(t,e){e===void 0&&(e={});var n=0,r=0,i=0;return qo(t,function(o,s,a){var u=e.weight?a==null?void 0:a[e.weight]:void 0;if(u=u??1,!oi(u))throw new Error("weight value must be a number for feature index "+s);u=Number(u),u>0&&xr(o,function(l){n+=l[0]*u,r+=l[1]*u,i+=u})}),xt([n/i,r/i],e.properties,e)}function pG(t,e){if(e===void 0&&(e={}),e=e||{},!An(e))throw new Error("options is invalid");var n=e.counter||10;if(!oi(n))throw new Error("counter must be a number");var r=e.weight,i=VE(t,{weight:e.weight}),o=ft([]);vn(t,function(a){var u;o.features.push(zu(a,{properties:{weight:(u=a.properties)===null||u===void 0?void 0:u[r]}}))});var s={tolerance:e.tolerance,medianCandidates:[]};return oM(i.geometry.coordinates,[0,0],o,s,n)}function oM(t,e,n,r,i){var o=r.tolerance||.001,s=0,a=0,u=0,l=0;if(vn(n,function(h){var d,g=(d=h.properties)===null||d===void 0?void 0:d.weight,y=g??1;if(y=Number(y),!oi(y))throw new Error("weight value must be a number");if(y>0){l+=1;var b=y*Ln(h,t);b===0&&(b=1);var _=y/b;s+=h.geometry.coordinates[0]*_,a+=h.geometry.coordinates[1]*_,u+=_}}),l<1)throw new Error("no features to measure");var f=s/u,c=a/u;return l===1||i===0||Math.abs(f-e[0])0&&(u=It(a).geometry),vG(u,l),a=l.slice(0);n.push(It(a,s));break;case"MultiPolygon":a=[[[]]];for(var c=0;c0&&(u=jo(a).geometry),_G(u,l),a=l.slice(0);n.push(jo(a,s));break;default:throw new Error("geometry is invalid, must be Polygon or MultiPolygon")}}),ft(n)}function vG(t,e){var n=0,r=0;xr(t,function(i,o,s,a,u){u>n&&(n=u,r=o,e.push([]));var l=o-r,f=t.coordinates[u][l+1],c=i[0],h=i[1],d=f[0],g=f[1];e[u].push([.75*c+.25*d,.75*h+.25*g]),e[u].push([.25*c+.75*d,.25*h+.75*g])},!0),e.forEach(function(i){i.push(i[0])})}function _G(t,e){var n=0,r=0,i=0;xr(t,function(o,s,a,u,l){u>i&&(i=u,r=s,e.push([[]])),l>n&&(n=l,r=s,e[u].push([]));var f=s-r,c=t.coordinates[u][l][f+1],h=o[0],d=o[1],g=c[0],y=c[1];e[u][l].push([.75*h+.25*g,.75*d+.25*y]),e[u][l].push([.25*h+.75*g,.25*d+.75*y])},!0),e.forEach(function(o){o.forEach(function(s){s.push(s[0])})})}function bG(t,e,n){n===void 0&&(n=2);var r=qn(t),i=qn(e),o=r[0]-i[0],s=r[1]-i[1];return n===1?Math.abs(o)+Math.abs(s):Math.pow(Math.pow(o,n)+Math.pow(s,n),1/n)}function aM(t,e){e=e||{};var n=e.threshold||1e4,r=e.p||2,i=e.binary||!1,o=e.alpha||-1,s=e.standardization||!1,a=[];vn(t,function(d){a.push(zu(d))});for(var u=[],l=0;lr&&(o[0]=r),o[0]<-r&&(o[0]=-r),o[1]>r&&(o[1]=r),o[1]<-r&&(o[1]=-r),o}function dM(t){var e=180/Math.PI,n=6378137;return[t[0]*e/n,(Math.PI*.5-2*Math.atan(Math.exp(-t[1]/n)))*e]}function xG(t){return t<0?-1:t>0?1:0}const SG=Object.freeze(Object.defineProperty({__proto__:null,toMercator:uM,toWgs84:cM},Symbol.toStringTag,{value:"Module"}));var CG=function(){for(var t=0,e=0,n=arguments.length;e0?u+f[l-1]:u}),a.forEach(function(u){u=u*2*Math.PI/a[a.length-1];var l=Math.random();s.push([l*(e.max_radial_length||10)*Math.sin(u),l*(e.max_radial_length||10)*Math.cos(u)])}),s[s.length-1]=s[0],s=s.map(NG(eg(e.bbox))),n.push(It([s]))},i=0;i * @license MIT * @preserve *//*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */function kG(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(f){return u([l,f])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,i=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]e?1:t0){if(e.right===null)break;if(n(t,e.right.key)>0){var a=e.right;if(e.right=a.left,a.left=e,e=a,e.right===null)break}i.right=e,i=e,e=e.right}else break}return i.right=e.left,o.left=e.right,e.left=r.right,e.right=r.left,e}function UE(t,e,n,r){var i=new Hu(t,e);if(n===null)return i.left=i.right=null,i;n=Gu(t,n,r);var o=r(t,n.key);return o<0?(i.left=n.left,i.right=n,n.left=null):o>=0&&(i.right=n.right,i.left=n,n.right=null),i}function wM(t,e,n){var r=null,i=null;if(e){e=Gu(t,e,n);var o=n(e.key,t);o===0?(r=e.left,i=e.right):o<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)}return{left:r,right:i}}function AG(t,e,n){return e===null?t:(t===null||(e=Gu(t.key,e,n),e.left=t),e)}function zE(t,e,n,r,i){if(t){r(""+e+(n?"└── ":"├── ")+i(t)+` `);var o=e+(n?" ":"│ ");t.left&&zE(t.left,o,!1,r,i),t.right&&zE(t.right,o,!0,r,i)}}var HE=function(){function t(e){e===void 0&&(e=PG),this._root=null,this._size=0,this._comparator=e}return t.prototype.insert=function(e,n){return this._size++,this._root=UE(e,n,this._root,this._comparator)},t.prototype.add=function(e,n){var r=new Hu(e,n);this._root===null&&(r.left=r.right=null,this._size++,this._root=r);var i=this._comparator,o=Gu(e,this._root,i),s=i(e,o.key);return s===0?this._root=o:(s<0?(r.left=o.left,r.right=o,o.left=null):s>0&&(r.right=o.right,r.left=o,o.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},t.prototype._remove=function(e,n,r){var i;if(n===null)return null;n=Gu(e,n,r);var o=r(e,n.key);return o===0?(n.left===null?i=n.right:(i=Gu(e,n.left,r),i.right=n.right),this._size--,i):n},t.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=Gu(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},t.prototype.findStatic=function(e){for(var n=this._root,r=this._comparator;n;){var i=r(e,n.key);if(i===0)return n;i<0?n=n.left:n=n.right}return null},t.prototype.find=function(e){return this._root&&(this._root=Gu(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},t.prototype.contains=function(e){for(var n=this._root,r=this._comparator;n;){var i=r(e,n.key);if(i===0)return!0;i<0?n=n.left:n=n.right}return!1},t.prototype.forEach=function(e,n){for(var r=this._root,i=[],o=!1;!o;)r!==null?(i.push(r),r=r.left):i.length!==0?(r=i.pop(),e.call(n,r),r=r.right):o=!0;return this},t.prototype.range=function(e,n,r,i){for(var o=[],s=this._comparator,a=this._root,u;o.length!==0||a;)if(a)o.push(a),a=a.left;else{if(a=o.pop(),u=s(a.key,n),u>0)break;if(s(a.key,e)>=0&&r.call(i,a))return this;a=a.right}return this},t.prototype.keys=function(){var e=[];return this.forEach(function(n){var r=n.key;return e.push(r)}),e},t.prototype.values=function(){var e=[];return this.forEach(function(n){var r=n.data;return e.push(r)}),e},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},t.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},t.prototype.at=function(e){for(var n=this._root,r=!1,i=0,o=[];!r;)if(n)o.push(n),n=n.left;else if(o.length>0){if(n=o.pop(),i===e)return n;i++,n=n.right}else r=!0;return null},t.prototype.next=function(e){var n=this._root,r=null;if(e.right){for(r=e.right;r.left;)r=r.left;return r}for(var i=this._comparator;n;){var o=i(e.key,n.key);if(o===0)break;o<0?(r=n,n=n.left):n=n.right}return r},t.prototype.prev=function(e){var n=this._root,r=null;if(e.left!==null){for(r=e.left;r.right;)r=r.right;return r}for(var i=this._comparator;n;){var o=i(e.key,n.key);if(o===0)break;o<0?n=n.left:(r=n,n=n.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return DG(this._root)},t.prototype.load=function(e,n,r){n===void 0&&(n=[]),r===void 0&&(r=!1);var i=e.length,o=this._comparator;if(r&&WE(e,n,0,i-1,o),this._root===null)this._root=GE(e,n,0,i),this._size=i;else{var s=RG(this.toList(),LG(e,n),o);i=this._size+i,this._root=YE({head:s},0,i)}return this},t.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(e){e===void 0&&(e=function(r){return String(r.key)});var n=[];return zE(this._root,"",!0,function(r){return n.push(r)},e),n.join("")},t.prototype.update=function(e,n,r){var i=this._comparator,o=wM(e,this._root,i),s=o.left,a=o.right;i(e,n)<0?a=UE(n,r,a,i):s=UE(n,r,s,i),this._root=AG(s,a,i)},t.prototype.split=function(e){return wM(e,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var e,n,r;return kG(this,function(i){switch(i.label){case 0:e=this._root,n=[],r=!1,i.label=1;case 1:return r?[3,6]:e===null?[3,2]:(n.push(e),e=e.left,[3,5]);case 2:return n.length===0?[3,4]:(e=n.pop(),[4,e]);case 3:return i.sent(),e=e.right,[3,5];case 4:r=!0,i.label=5;case 5:return[3,1];case 6:return[2]}})},t}();function GE(t,e,n,r){var i=r-n;if(i>0){var o=n+Math.floor(i/2),s=t[o],a=e[o],u=new Hu(s,a);return u.left=GE(t,e,n,o),u.right=GE(t,e,o+1,r),u}return null}function LG(t,e){for(var n=new Hu(null,null),r=n,i=0;i0?(e=o=o.next=n.pop(),e=e.right):r=!0;return o.next=null,i.next}function YE(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),o=YE(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=YE(t,i+1,n),s}return null}function RG(t,e,n){for(var r=new Hu(null,null),i=r,o=t,s=e;o!==null&&s!==null;)n(o.key,s.key)<0?(i.next=o,o=o.next):(i.next=s,s=s.next),i=i.next;return o!==null?i.next=o:s!==null&&(i.next=s),r.next}function WE(t,e,n,r,i){if(!(n>=r)){for(var o=t[n+r>>1],s=n-1,a=r+1;;){do s++;while(i(t[s],o)<0);do a--;while(i(t[a],o)>0);if(s>=a)break;var u=t[s];t[s]=t[a],t[a]=u,u=e[s],e[s]=e[a],e[a]=u}WE(t,e,n,a,i),WE(t,e,a+1,r,i)}}const Jl=11102230246251565e-32,co=134217729,FG=(3+8*Jl)*Jl;function XE(t,e,n,r,i){let o,s,a,u,l=e[0],f=r[0],c=0,h=0;f>l==f>-l?(o=l,l=e[++c]):(o=f,f=r[++h]);let d=0;if(cl==f>-l?(s=l+o,a=o-(s-l),l=e[++c]):(s=f+o,a=o-(s-f),f=r[++h]),o=s,a!==0&&(i[d++]=a);cl==f>-l?(s=o+l,u=s-o,a=o-(s-u)+(l-u),l=e[++c]):(s=o+f,u=s-o,a=o-(s-u)+(f-u),f=r[++h]),o=s,a!==0&&(i[d++]=a);for(;c=L||-A>=L||(c=t-O,a=t-(O+c)+(c-i),c=n-M,l=n-(M+c)+(c-i),c=e-T,u=e-(T+c)+(c-o),c=r-I,f=r-(I+c)+(c-o),a===0&&u===0&&l===0&&f===0)||(L=jG*s+FG*Math.abs(A),A+=O*f+I*a-(T*l+M*u),A>=L||-A>=L))return A;v=a*I,h=co*a,d=h-(h-a),g=a-d,h=co*I,y=h-(h-I),b=I-y,w=g*b-(v-d*y-g*y-d*b),N=u*M,h=co*u,d=h-(h-u),g=u-d,h=co*M,y=h-(h-M),b=M-y,S=g*b-(N-d*y-g*y-d*b),_=w-S,c=w-_,Oo[0]=w-(_+c)+(c-S),p=v+_,c=p-v,m=v-(p-c)+(_-c),_=m-N,c=m-_,Oo[1]=m-(_+c)+(c-N),C=p+_,c=C-p,Oo[2]=p-(C-c)+(_-c),Oo[3]=C;const B=XE(4,rd,4,Oo,xM);v=O*f,h=co*O,d=h-(h-O),g=O-d,h=co*f,y=h-(h-f),b=f-y,w=g*b-(v-d*y-g*y-d*b),N=T*l,h=co*T,d=h-(h-T),g=T-d,h=co*l,y=h-(h-l),b=l-y,S=g*b-(N-d*y-g*y-d*b),_=w-S,c=w-_,Oo[0]=w-(_+c)+(c-S),p=v+_,c=p-v,m=v-(p-c)+(_-c),_=m-N,c=m-_,Oo[1]=m-(_+c)+(c-N),C=p+_,c=C-p,Oo[2]=p-(C-c)+(_-c),Oo[3]=C;const $=XE(B,xM,4,Oo,SM);v=a*f,h=co*a,d=h-(h-a),g=a-d,h=co*f,y=h-(h-f),b=f-y,w=g*b-(v-d*y-g*y-d*b),N=u*l,h=co*u,d=h-(h-u),g=u-d,h=co*l,y=h-(h-l),b=l-y,S=g*b-(N-d*y-g*y-d*b),_=w-S,c=w-_,Oo[0]=w-(_+c)+(c-S),p=v+_,c=p-v,m=v-(p-c)+(_-c),_=m-N,c=m-_,Oo[1]=m-(_+c)+(c-N),C=p+_,c=C-p,Oo[2]=p-(C-c)+(_-c),Oo[3]=C;const G=XE($,SM,4,Oo,CM);return CM[G-1]}function UG(t,e,n,r,i,o){const s=(e-o)*(n-i),a=(t-i)*(r-o),u=s-a,l=Math.abs(s+a);return Math.abs(u)>=VG*l?u:-qG(t,e,n,r,i,o,l)}var NM={};const ng=(t,e)=>t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y,KE=(t,e)=>{if(e.ur.x{if(-Yut.x*e.y-t.y*e.x,IM=(t,e)=>t.x*e.x+t.y*e.y,MM=(t,e,n)=>{const r=UG(t.x,t.y,e.x,e.y,n.x,n.y);return r>0?-1:r<0?1:0},Tv=t=>Math.sqrt(IM(t,t)),GG=(t,e,n)=>{const r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return Ov(i,r)/Tv(i)/Tv(r)},YG=(t,e,n)=>{const r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return IM(i,r)/Tv(i)/Tv(r)},kM=(t,e,n)=>e.y===0?null:{x:t.x+e.x/e.y*(n-t.y),y:n},PM=(t,e,n)=>e.x===0?null:{x:n,y:t.y+e.y/e.x*(n-t.x)},WG=(t,e,n,r)=>{if(e.x===0)return PM(n,r,t.x);if(r.x===0)return PM(t,e,n.x);if(e.y===0)return kM(n,r,t.y);if(r.y===0)return kM(t,e,n.y);const i=Ov(e,r);if(i==0)return null;const o={x:n.x-t.x,y:n.y-t.y},s=Ov(o,e)/i,a=Ov(o,r)/i,u=t.x+a*e.x,l=n.x+s*r.x,f=t.y+a*e.y,c=n.y+s*r.y,h=(u+l)/2,d=(f+c)/2;return{x:h,y:d}};class Rs{static compare(e,n){const r=Rs.comparePoints(e.point,n.point);return r!==0?r:(e.point!==n.point&&e.link(n),e.isLeft!==n.isLeft?e.isLeft?1:-1:Wu.compare(e.segment,n.segment))}static comparePoints(e,n){return e.xn.x?1:e.yn.y?1:0}constructor(e,n){e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}link(e){if(e.point===this.point)throw new Error("Tried to link already linked events");const n=e.point.events;for(let r=0,i=n.length;r{const o=i.otherSE;n.set(i,{sine:GG(this.point,e.point,o.point),cosine:YG(this.point,e.point,o.point)})};return(i,o)=>{n.has(i)||r(i),n.has(o)||r(o);const{sine:s,cosine:a}=n.get(i),{sine:u,cosine:l}=n.get(o);return s>=0&&u>=0?al?-1:0:s<0&&u<0?al?1:0:us?1:0}}}let XG=0;class Wu{static compare(e,n){const r=e.leftSE.point.x,i=n.leftSE.point.x,o=e.rightSE.point.x,s=n.rightSE.point.x;if(sa&&u>l)return-1;const c=e.comparePoint(n.leftSE.point);if(c<0)return 1;if(c>0)return-1;const h=n.comparePoint(e.rightSE.point);return h!==0?h:-1}if(r>i){if(au&&a>f)return 1;const c=n.comparePoint(e.leftSE.point);if(c!==0)return c;const h=e.comparePoint(n.rightSE.point);return h<0?1:h>0?-1:1}if(au)return 1;if(os){const c=e.comparePoint(n.rightSE.point);if(c<0)return 1;if(c>0)return-1}if(o!==s){const c=l-a,h=o-r,d=f-u,g=s-i;if(c>h&&dg)return-1}return o>s?1:of?1:e.idn.id?1:0}constructor(e,n,r,i){this.id=++XG,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=r,this.windings=i}static fromRing(e,n,r){let i,o,s;const a=Rs.comparePoints(e,n);if(a<0)i=e,o=n,s=1;else if(a>0)i=n,o=e,s=-1;else throw new Error(`Tried to create degenerate segment at [${e.x}, ${e.y}]`);const u=new Rs(i,!0),l=new Rs(o,!1);return new Wu(u,l,[r],[s])}replaceRightSE(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const e=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:en?e:n}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(e){return e.x===this.leftSE.point.x&&e.y===this.leftSE.point.y||e.x===this.rightSE.point.x&&e.y===this.rightSE.point.y}comparePoint(e){if(this.isAnEndpoint(e))return 0;const n=this.leftSE.point,r=this.rightSE.point,i=this.vector();if(n.x===r.x)return e.x===n.x?0:e.x0&&a.swapEvents(),Rs.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),o.checkForConsuming()),n}swapEvents(){const e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let n=0,r=this.windings.length;n0){const o=n;n=r,r=o}if(n.prev===r){const o=n;n=r,r=o}for(let o=0,s=r.rings.length;oi.length===1&&i[0].isSubject;this._isInResult=r(e)!==r(n);break}default:throw new Error(`Unrecognized operation type found ${pa.type}`)}return this._isInResult}}class AM{constructor(e,n,r){if(!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const i=rg.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};let o=i;for(let s=1,a=e.length;sthis.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),o=u)}(i.x!==o.x||i.y!==o.y)&&this.segments.push(Wu.fromRing(o,i,this))}getSweepEvents(){const e=[];for(let n=0,r=this.segments.length;nthis.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=n}getSweepEvents(){const e=this.exteriorRing.getSweepEvents();for(let n=0,r=this.interiorRings.length;nthis.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=n}getSweepEvents(){const e=[];for(let n=0,r=this.polys.length;n0&&(e=s)}let n=e.segment.prevInResult(),r=n?n.prevInResult():null;for(;;){if(!n)return null;if(!r)return n.ringOut;if(r.ringOut!==n.ringOut)return r.ringOut.enclosingRing()!==n.ringOut?n.ringOut:n.ringOut.enclosingRing();n=r.prevInResult(),r=n?n.prevInResult():null}}}class DM{constructor(e){this.exteriorRing=e,e.poly=this,this.interiorRings=[]}addInterior(e){this.interiorRings.push(e),e.poly=this}getGeom(){const e=[this.exteriorRing.getGeom()];if(e[0]===null)return null;for(let n=0,r=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:Wu.compare;this.queue=e,this.tree=new HE(n),this.segments=[]}process(e){const n=e.segment,r=[];if(e.consumedBy)return e.isLeft?this.queue.remove(e.otherSE):this.tree.remove(n),r;const i=e.isLeft?this.tree.add(n):this.tree.find(n);if(!i)throw new Error(`Unable to find segment #${n.id} [${n.leftSE.point.x}, ${n.leftSE.point.y}] -> [${n.rightSE.point.x}, ${n.rightSE.point.y}] in SweepLine tree.`);let o=i,s=i,a,u;for(;a===void 0;)o=this.tree.prev(o),o===null?a=null:o.key.consumedBy===void 0&&(a=o.key);for(;u===void 0;)s=this.tree.next(s),s===null?u=null:s.key.consumedBy===void 0&&(u=s.key);if(e.isLeft){let l=null;if(a){const c=a.getIntersection(n);if(c!==null&&(n.isAnEndpoint(c)||(l=c),!a.isAnEndpoint(c))){const h=this._splitSafely(a,c);for(let d=0,g=h.length;d0?(this.tree.remove(n),r.push(e)):(this.segments.push(n),n.prev=a)}else{if(a&&u){const l=a.getIntersection(u);if(l!==null){if(!a.isAnEndpoint(l)){const f=this._splitSafely(a,l);for(let c=0,h=f.length;cRM)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const s=new JG(o);let a=o.size,u=o.pop();for(;u;){const c=u.key;if(o.size===a){const d=c.segment;throw new Error(`Unable to pop() ${c.isLeft?"left":"right"} SweepEvent [${c.point.x}, ${c.point.y}] from segment #${d.id} [${d.leftSE.point.x}, ${d.leftSE.point.y}] -> [${d.rightSE.point.x}, ${d.rightSE.point.y}] from queue.`)}if(o.size>RM)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(s.segments.length>QG)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const h=s.process(c);for(let d=0,g=h.length;d1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;rn.x?1:this.yn.y?1:0},ce.prototype.clone=function(){},ce.prototype.copy=function(){return new ce(this)},ce.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},ce.prototype.distance3D=function(e){var n=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return Math.sqrt(n*n+r*r+i*i)},ce.prototype.distance=function(e){var n=this.x-e.x,r=this.y-e.y;return Math.sqrt(n*n+r*r)},ce.prototype.hashCode=function(){var e=17;return e=37*e+ce.hashCode(this.x),e=37*e+ce.hashCode(this.y),e},ce.prototype.setCoordinate=function(e){this.x=e.x,this.y=e.y,this.z=e.z},ce.prototype.interfaces_=function(){return[zo,Mv,Ho]},ce.prototype.getClass=function(){return ce},ce.hashCode=function(){if(arguments.length===1){var e=arguments[0],n=yt.doubleToLongBits(e);return Math.trunc((n^n)>>>32)}},gf.DimensionalComparator.get=function(){return eu},gf.serialVersionUID.get=function(){return 6683108902428367e3},gf.NULL_ORDINATE.get=function(){return yt.NaN},gf.X.get=function(){return 0},gf.Y.get=function(){return 1},gf.Z.get=function(){return 2},Object.defineProperties(ce,gf);var eu=function(e){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var n=arguments[0];if(n!==2&&n!==3)throw new tr("only 2 or 3 dimensions may be specified");this._dimensionsToTest=n}}};eu.prototype.compare=function(e,n){var r=e,i=n,o=eu.compare(r.x,i.x);if(o!==0)return o;var s=eu.compare(r.y,i.y);if(s!==0)return s;if(this._dimensionsToTest<=2)return 0;var a=eu.compare(r.z,i.z);return a},eu.prototype.interfaces_=function(){return[id]},eu.prototype.getClass=function(){return eu},eu.compare=function(e,n){return en?1:yt.isNaN(e)?yt.isNaN(n)?0:-1:yt.isNaN(n)?1:0};var od=function(){};od.prototype.create=function(){},od.prototype.interfaces_=function(){return[]},od.prototype.getClass=function(){return od};var me=function(){},ig={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};me.prototype.interfaces_=function(){return[]},me.prototype.getClass=function(){return me},me.toLocationSymbol=function(e){switch(e){case me.EXTERIOR:return"e";case me.BOUNDARY:return"b";case me.INTERIOR:return"i";case me.NONE:return"-"}throw new tr("Unknown location value: "+e)},ig.INTERIOR.get=function(){return 0},ig.BOUNDARY.get=function(){return 1},ig.EXTERIOR.get=function(){return 2},ig.NONE.get=function(){return-1},Object.defineProperties(me,ig);var st=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},To=function(){},BM={LOG_10:{configurable:!0}};To.prototype.interfaces_=function(){return[]},To.prototype.getClass=function(){return To},To.log10=function(e){var n=Math.log(e);return yt.isInfinite(n)||yt.isNaN(n)?n:n/To.LOG_10},To.min=function(e,n,r,i){var o=e;return nr?r:e}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],o=arguments[1],s=arguments[2];return is?s:i}},To.wrap=function(e,n){return e<0?n- -e%n:e%n},To.max=function(){if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2],i=e;return n>i&&(i=n),r>i&&(i=r),i}else if(arguments.length===4){var o=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3],l=o;return s>l&&(l=s),a>l&&(l=a),u>l&&(l=u),l}},To.average=function(e,n){return(e+n)/2},BM.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(To,BM);var Fs=function(e){this.str=e};Fs.prototype.append=function(e){this.str+=e},Fs.prototype.setCharAt=function(e,n){this.str=this.str.substr(0,e)+n+this.str.substr(e+1)},Fs.prototype.toString=function(e){return this.str};var Bs=function(e){this.value=e};Bs.prototype.intValue=function(){return this.value},Bs.prototype.compareTo=function(e){return this.valuee?1:0},Bs.isNaN=function(e){return Number.isNaN(e)};var og=function(){};og.isWhitespace=function(e){return e<=32&&e>=0||e===127},og.toUpperCase=function(e){return e.toUpperCase()};var ye=function t(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var r=arguments[0];t.call(this,t.parse(r))}}else if(arguments.length===2){var i=arguments[0],o=arguments[1];this.init(i,o)}},fs={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};ye.prototype.le=function(e){return(this._hi9?(c=!0,h="9"):h="0"+f,a.append(h),r=r.subtract(ye.valueOf(f)).multiply(ye.TEN),c&&r.selfAdd(ye.TEN);var d=!0,g=ye.magnitude(r._hi);if(g<0&&Math.abs(g)>=u-l&&(d=!1),!d)break}return n[0]=i,a.toString()},ye.prototype.sqr=function(){return this.multiply(this)},ye.prototype.doubleValue=function(){return this._hi+this._lo},ye.prototype.subtract=function(){if(arguments[0]instanceof ye){var e=arguments[0];return this.add(e.negate())}else if(typeof arguments[0]=="number"){var n=arguments[0];return this.add(-n)}},ye.prototype.equals=function(){if(arguments.length===1){var e=arguments[0];return this._hi===e._hi&&this._lo===e._lo}},ye.prototype.isZero=function(){return this._hi===0&&this._lo===0},ye.prototype.selfSubtract=function(){if(arguments[0]instanceof ye){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e._hi,-e._lo)}else if(typeof arguments[0]=="number"){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n,0)}},ye.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},ye.prototype.min=function(e){return this.le(e)?this:e},ye.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof ye){var e=arguments[0];return this.selfDivide(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var n=arguments[0];return this.selfDivide(n,0)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1],o=null,s=null,a=null,u=null,l=null,f=null,c=null,h=null;return l=this._hi/r,f=ye.SPLIT*l,o=f-l,h=ye.SPLIT*r,o=f-o,s=l-o,a=h-r,c=l*r,a=h-a,u=r-a,h=o*a-c+o*u+s*a+s*u,f=(this._hi-c-h+this._lo-l*i)/r,h=l+f,this._hi=h,this._lo=l-h+f,this}},ye.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},ye.prototype.divide=function(){if(arguments[0]instanceof ye){var e=arguments[0],n=null,r=null,i=null,o=null,s=null,a=null,u=null,l=null;s=this._hi/e._hi,a=ye.SPLIT*s,n=a-s,l=ye.SPLIT*e._hi,n=a-n,r=s-n,i=l-e._hi,u=s*e._hi,i=l-i,o=e._hi-i,l=n*i-u+n*o+r*i+r*o,a=(this._hi-u-l+this._lo-s*e._lo)/e._hi,l=s+a;var f=l,c=s-l+a;return new ye(f,c)}else if(typeof arguments[0]=="number"){var h=arguments[0];return yt.isNaN(h)?ye.createNaN():ye.copy(this).selfDivide(h,0)}},ye.prototype.ge=function(e){return(this._hi>e._hi||this._hi===e._hi)&&this._lo>=e._lo},ye.prototype.pow=function(e){if(e===0)return ye.valueOf(1);var n=new ye(this),r=ye.valueOf(1),i=Math.abs(e);if(i>1)for(;i>0;)i%2===1&&r.selfMultiply(n),i/=2,i>0&&(n=n.sqr());else r=n;return e<0?r.reciprocal():r},ye.prototype.ceil=function(){if(this.isNaN())return ye.NaN;var e=Math.ceil(this._hi),n=0;return e===this._hi&&(n=Math.ceil(this._lo)),new ye(e,n)},ye.prototype.compareTo=function(e){var n=e;return this._hin._hi?1:this._lon._lo?1:0},ye.prototype.rint=function(){if(this.isNaN())return this;var e=this.add(.5);return e.floor()},ye.prototype.setValue=function(){if(arguments[0]instanceof ye){var e=arguments[0];return this.init(e),this}else if(typeof arguments[0]=="number"){var n=arguments[0];return this.init(n),this}},ye.prototype.max=function(e){return this.ge(e)?this:e},ye.prototype.sqrt=function(){if(this.isZero())return ye.valueOf(0);if(this.isNegative())return ye.NaN;var e=1/Math.sqrt(this._hi),n=this._hi*e,r=ye.valueOf(n),i=this.subtract(r.sqr()),o=i._hi*(e*.5);return r.add(o)},ye.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof ye){var e=arguments[0];return this.selfAdd(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var n=arguments[0],r=null,i=null,o=null,s=null,a=null,u=null;return o=this._hi+n,a=o-this._hi,s=o-a,s=n-a+(this._hi-s),u=s+this._lo,r=o+u,i=u+(o-r),this._hi=r+i,this._lo=i+(r-this._hi),this}}else if(arguments.length===2){var l=arguments[0],f=arguments[1],c=null,h=null,d=null,g=null,y=null,b=null,_=null,p=null;y=this._hi+l,d=this._lo+f,_=y-this._hi,p=d-this._lo,b=y-_,g=d-p,b=l-_+(this._hi-b),g=f-p+(this._lo-g),_=b+d,c=y+_,h=_+(y-c),_=g+h;var m=c+_,v=_+(c-m);return this._hi=m,this._lo=v,this}},ye.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof ye){var e=arguments[0];return this.selfMultiply(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var n=arguments[0];return this.selfMultiply(n,0)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1],o=null,s=null,a=null,u=null,l=null,f=null;l=ye.SPLIT*this._hi,o=l-this._hi,f=ye.SPLIT*r,o=l-o,s=this._hi-o,a=f-r,l=this._hi*r,a=f-a,u=r-a,f=o*a-l+o*u+s*a+s*u+(this._hi*i+this._lo*r);var c=l+f;o=l-c;var h=f+o;return this._hi=c,this._lo=h,this}},ye.prototype.selfSqr=function(){return this.selfMultiply(this)},ye.prototype.floor=function(){if(this.isNaN())return ye.NaN;var e=Math.floor(this._hi),n=0;return e===this._hi&&(n=Math.floor(this._lo)),new ye(e,n)},ye.prototype.negate=function(){return this.isNaN()?this:new ye(-this._hi,-this._lo)},ye.prototype.clone=function(){},ye.prototype.multiply=function(){if(arguments[0]instanceof ye){var e=arguments[0];return e.isNaN()?ye.createNaN():ye.copy(this).selfMultiply(e)}else if(typeof arguments[0]=="number"){var n=arguments[0];return yt.isNaN(n)?ye.createNaN():ye.copy(this).selfMultiply(n,0)}},ye.prototype.isNaN=function(){return yt.isNaN(this._hi)},ye.prototype.intValue=function(){return Math.trunc(this._hi)},ye.prototype.toString=function(){var e=ye.magnitude(this._hi);return e>=-3&&e<=20?this.toStandardNotation():this.toSciNotation()},ye.prototype.toStandardNotation=function(){var e=this.getSpecialNumberString();if(e!==null)return e;var n=new Array(1).fill(null),r=this.extractSignificantDigits(!0,n),i=n[0]+1,o=r;if(r.charAt(0)===".")o="0"+r;else if(i<0)o="0."+ye.stringOfChar("0",-i)+r;else if(r.indexOf(".")===-1){var s=i-r.length,a=ye.stringOfChar("0",s);o=r+a+".0"}return this.isNegative()?"-"+o:o},ye.prototype.reciprocal=function(){var e=null,n=null,r=null,i=null,o=null,s=null,a=null,u=null;o=1/this._hi,s=ye.SPLIT*o,e=s-o,u=ye.SPLIT*this._hi,e=s-e,n=o-e,r=u-this._hi,a=o*this._hi,r=u-r,i=this._hi-r,u=e*r-a+e*i+n*r+n*i,s=(1-a-u-o*this._lo)/this._hi;var l=o+s,f=o-l+s;return new ye(l,f)},ye.prototype.toSciNotation=function(){if(this.isZero())return ye.SCI_NOT_ZERO;var e=this.getSpecialNumberString();if(e!==null)return e;var n=new Array(1).fill(null),r=this.extractSignificantDigits(!1,n),i=ye.SCI_NOT_EXPONENT_CHAR+n[0];if(r.charAt(0)==="0")throw new Error("Found leading zero: "+r);var o="";r.length>1&&(o=r.substring(1));var s=r.charAt(0)+"."+o;return this.isNegative()?"-"+s+i:s+i},ye.prototype.abs=function(){return this.isNaN()?ye.NaN:this.isNegative()?this.negate():new ye(this)},ye.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},ye.prototype.lt=function(e){return(this._hie._hi||this._hi===e._hi)&&this._lo>e._lo},ye.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},ye.prototype.trunc=function(){return this.isNaN()?ye.NaN:this.isPositive()?this.floor():this.ceil()},ye.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},ye.prototype.interfaces_=function(){return[Ho,zo,Mv]},ye.prototype.getClass=function(){return ye},ye.sqr=function(e){return ye.valueOf(e).selfMultiply(e)},ye.valueOf=function(){if(typeof arguments[0]=="string"){var e=arguments[0];return ye.parse(e)}else if(typeof arguments[0]=="number"){var n=arguments[0];return new ye(n)}},ye.sqrt=function(e){return ye.valueOf(e).sqrt()},ye.parse=function(e){for(var n=0,r=e.length;og.isWhitespace(e.charAt(n));)n++;var i=!1;if(n=r);){var f=e.charAt(n);if(n++,og.isDigit(f)){var c=f-"0";s.selfMultiply(ye.TEN),s.selfAdd(c),a++;continue}if(f==="."){u=a;continue}if(f==="e"||f==="E"){var h=e.substring(n);try{l=Bs.parseInt(h)}catch(_){throw _ instanceof Error?new Error("Invalid exponent "+h+" in string "+e):_}finally{}break}throw new Error("Unexpected character '"+f+"' at position "+n+" in string "+e)}var d=s,g=a-u-l;if(g===0)d=s;else if(g>0){var y=ye.TEN.pow(g);d=s.divide(y)}else if(g<0){var b=ye.TEN.pow(-g);d=s.multiply(b)}return i?d.negate():d},ye.createNaN=function(){return new ye(yt.NaN,yt.NaN)},ye.copy=function(e){return new ye(e)},ye.magnitude=function(e){var n=Math.abs(e),r=Math.log(n)/Math.log(10),i=Math.trunc(Math.floor(r)),o=Math.pow(10,i);return o*10<=n&&(i+=1),i},ye.stringOfChar=function(e,n){for(var r=new Fs,i=0;i0){if(s<=0)return Zi.signum(a);i=o+s}else if(o<0){if(s>=0)return Zi.signum(a);i=-o-s}else return Zi.signum(a);var u=Zi.DP_SAFE_EPSILON*i;return a>=u||-a>=u?Zi.signum(a):2},Zi.signum=function(e){return e>0?1:e<0?-1:0},VM.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(Zi,VM);var At=function(){},sg={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};sg.X.get=function(){return 0},sg.Y.get=function(){return 1},sg.Z.get=function(){return 2},sg.M.get=function(){return 3},At.prototype.setOrdinate=function(e,n,r){},At.prototype.size=function(){},At.prototype.getOrdinate=function(e,n){},At.prototype.getCoordinate=function(){},At.prototype.getCoordinateCopy=function(e){},At.prototype.getDimension=function(){},At.prototype.getX=function(e){},At.prototype.clone=function(){},At.prototype.expandEnvelope=function(e){},At.prototype.copy=function(){},At.prototype.getY=function(e){},At.prototype.toCoordinateArray=function(){},At.prototype.interfaces_=function(){return[Mv]},At.prototype.getClass=function(){return At},Object.defineProperties(At,sg);var $M=function(){},sd=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}($M),si=function(){};si.arraycopy=function(e,n,r,i,o){for(var s=0,a=n;ae._minx?this._minx:e._minx,r=this._miny>e._miny?this._miny:e._miny,i=this._maxx=this._minx&&n.getMaxX()<=this._maxx&&n.getMinY()>=this._miny&&n.getMaxY()<=this._maxy}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return this.isNull()?!1:r>=this._minx&&r<=this._maxx&&i>=this._miny&&i<=this._maxy}},Ze.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Ze){var e=arguments[0];return this.isNull()||e.isNull()?!1:!(e._minx>this._maxx||e._maxxthis._maxy||e._maxythis._maxx||rthis._maxy||ithis._maxx&&(this._maxx=n._maxx),n._minythis._maxy&&(this._maxy=n._maxy))}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.isNull()?(this._minx=r,this._maxx=r,this._miny=i,this._maxy=i):(rthis._maxx&&(this._maxx=r),ithis._maxy&&(this._maxy=i))}},Ze.prototype.minExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),n=this.getHeight();return en._minx?1:this._minyn._miny?1:this._maxxn._maxx?1:this._maxyn._maxy?1:0},Ze.prototype.translate=function(e,n){if(this.isNull())return null;this.init(this.getMinX()+e,this.getMaxX()+e,this.getMinY()+n,this.getMaxY()+n)},Ze.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Ze.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Ze.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Ze.prototype.maxExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),n=this.getHeight();return e>n?e:n},Ze.prototype.expandBy=function(){if(arguments.length===1){var e=arguments[0];this.expandBy(e,e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];if(this.isNull())return null;this._minx-=n,this._maxx+=n,this._miny-=r,this._maxy+=r,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},Ze.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Ze){var e=arguments[0];return this.covers(e)}else if(arguments[0]instanceof ce){var n=arguments[0];return this.covers(n)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return this.covers(r,i)}},Ze.prototype.centre=function(){return this.isNull()?null:new ce((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Ze.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof ce){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof Ze){var n=arguments[0];this._minx=n._minx,this._maxx=n._maxx,this._miny=n._miny,this._maxy=n._maxy}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.init(r.x,i.x,r.y,i.y)}else if(arguments.length===4){var o=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3];oe._maxx&&(n=this._minx-e._maxx);var r=0;return this._maxye._maxy&&(r=this._miny-e._maxy),n===0?r:r===0?n:Math.sqrt(n*n+r*r)},Ze.prototype.hashCode=function(){var e=17;return e=37*e+ce.hashCode(this._minx),e=37*e+ce.hashCode(this._maxx),e=37*e+ce.hashCode(this._miny),e=37*e+ce.hashCode(this._maxy),e},Ze.prototype.interfaces_=function(){return[zo,Ho]},Ze.prototype.getClass=function(){return Ze},Ze.intersects=function(){if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2];return r.x>=(e.xn.x?e.x:n.x)&&r.y>=(e.yn.y?e.y:n.y)}else if(arguments.length===4){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=Math.min(s.x,a.x),l=Math.max(s.x,a.x),f=Math.min(i.x,o.x),c=Math.max(i.x,o.x);return!(f>l||cl)||cr?(this._intLineIndex[e][0]=0,this._intLineIndex[e][1]=1):(this._intLineIndex[e][0]=1,this._intLineIndex[e][1]=0)}},nr.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},nr.prototype.setPrecisionModel=function(e){this._precisionModel=e},nr.prototype.isInteriorIntersection=function(){var e=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var n=arguments[0],r=0;ro?s=i:s=o;else{var a=Math.abs(e.x-n.x),u=Math.abs(e.y-n.y);i>o?s=a:s=u,s===0&&!e.equals(n)&&(s=Math.max(a,u))}return _t.isTrue(!(s===0&&!e.equals(n)),"Bad distance calculation"),s},nr.nonRobustComputeEdgeDistance=function(e,n,r){var i=e.x-n.x,o=e.y-n.y,s=Math.sqrt(i*i+o*o);return _t.isTrue(!(s===0&&!e.equals(n)),"Invalid distance calculation"),s},mf.DONT_INTERSECT.get=function(){return 0},mf.DO_INTERSECT.get=function(){return 1},mf.COLLINEAR.get=function(){return 2},mf.NO_INTERSECTION.get=function(){return 0},mf.POINT_INTERSECTION.get=function(){return 1},mf.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(nr,mf);var Xu=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(r){var i=new Ze(this._inputLines[0][0],this._inputLines[0][1]),o=new Ze(this._inputLines[1][0],this._inputLines[1][1]);return i.contains(r)&&o.contains(r)},e.prototype.computeIntersection=function(){if(arguments.length===3){var r=arguments[0],i=arguments[1],o=arguments[2];if(this._isProper=!1,Ze.intersects(i,o,r)&&Le.orientationIndex(i,o,r)===0&&Le.orientationIndex(o,i,r)===0)return this._isProper=!0,(r.equals(i)||r.equals(o))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION}else return t.prototype.computeIntersection.apply(this,arguments)},e.prototype.normalizeToMinimum=function(r,i,o,s,a){a.x=this.smallestInAbsValue(r.x,i.x,o.x,s.x),a.y=this.smallestInAbsValue(r.y,i.y,o.y,s.y),r.x-=a.x,r.y-=a.y,i.x-=a.x,i.y-=a.y,o.x-=a.x,o.y-=a.y,s.x-=a.x,s.y-=a.y},e.prototype.safeHCoordinateIntersection=function(r,i,o,s){var a=null;try{a=hs.intersection(r,i,o,s)}catch(u){if(u instanceof sd)a=e.nearestEndpoint(r,i,o,s);else throw u}finally{}return a},e.prototype.intersection=function(r,i,o,s){var a=this.intersectionWithNormalization(r,i,o,s);return this.isInSegmentEnvelopes(a)||(a=new ce(e.nearestEndpoint(r,i,o,s))),this._precisionModel!==null&&this._precisionModel.makePrecise(a),a},e.prototype.smallestInAbsValue=function(r,i,o,s){var a=r,u=Math.abs(a);return Math.abs(i)1e-4&&si.out.println("Distance = "+a.distance(u))},e.prototype.intersectionWithNormalization=function(r,i,o,s){var a=new ce(r),u=new ce(i),l=new ce(o),f=new ce(s),c=new ce;this.normalizeToEnvCentre(a,u,l,f,c);var h=this.safeHCoordinateIntersection(a,u,l,f);return h.x+=c.x,h.y+=c.y,h},e.prototype.computeCollinearIntersection=function(r,i,o,s){var a=Ze.intersects(r,i,o),u=Ze.intersects(r,i,s),l=Ze.intersects(o,s,r),f=Ze.intersects(o,s,i);return a&&u?(this._intPt[0]=o,this._intPt[1]=s,t.COLLINEAR_INTERSECTION):l&&f?(this._intPt[0]=r,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):a&&l?(this._intPt[0]=o,this._intPt[1]=r,o.equals(r)&&!u&&!f?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):a&&f?(this._intPt[0]=o,this._intPt[1]=i,o.equals(i)&&!u&&!l?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):u&&l?(this._intPt[0]=s,this._intPt[1]=r,s.equals(r)&&!a&&!f?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):u&&f?(this._intPt[0]=s,this._intPt[1]=i,s.equals(i)&&!a&&!l?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(r,i,o,s,a){var u=r.xi.x?r.x:i.x,c=r.y>i.y?r.y:i.y,h=o.xs.x?o.x:s.x,y=o.y>s.y?o.y:s.y,b=u>h?u:h,_=fd?l:d,m=c0&&u>0||a<0&&u<0)return t.NO_INTERSECTION;var l=Le.orientationIndex(o,s,r),f=Le.orientationIndex(o,s,i);if(l>0&&f>0||l<0&&f<0)return t.NO_INTERSECTION;var c=a===0&&u===0&&l===0&&f===0;return c?this.computeCollinearIntersection(r,i,o,s):(a===0||u===0||l===0||f===0?(this._isProper=!1,r.equals2D(o)||r.equals2D(s)?this._intPt[0]=r:i.equals2D(o)||i.equals2D(s)?this._intPt[0]=i:a===0?this._intPt[0]=new ce(o):u===0?this._intPt[0]=new ce(s):l===0?this._intPt[0]=new ce(r):f===0&&(this._intPt[0]=new ce(i))):(this._isProper=!0,this._intPt[0]=this.intersection(r,i,o,s)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(r,i,o,s){var a=r,u=Le.distancePointLine(r,o,s),l=Le.distancePointLine(i,o,s);return l0?r>0?-o:o:r>0?o:-o;if(n===0||r===0)return i>0?e>0?o:-o:e>0?-o:o;if(n>0?i>0?n<=i||(o=-o,s=e,e=r,r=s,s=n,n=i,i=s):n<=-i?(o=-o,r=-r,i=-i):(s=e,e=-r,r=s,s=n,n=-i,i=s):i>0?-n<=i?(o=-o,e=-e,n=-n):(s=-e,e=r,r=s,s=-n,n=i,i=s):n>=i?(e=-e,n=-n,r=-r,i=-i):(o=-o,s=-e,e=-r,r=s,s=-n,n=-i,i=s),e>0)if(r>0){if(!(e<=r))return o}else return o;else{if(r>0)return-o;if(e>=r)o=-o,e=-e,r=-r;else return-o}for(;;){if(a=Math.floor(r/e),r=r-a*e,i=i-a*n,i<0)return-o;if(i>n)return o;if(e>r+r){if(ni+i)return-o;r=e-r,i=n-i,o=-o}if(i===0)return r===0?0:-o;if(r===0||(a=Math.floor(e/r),e=e-a*r,n=n-a*i,n<0))return o;if(n>i)return-o;if(r>e+e){if(in+n)return o;e=r-e,n=i-n,o=-o}if(n===0)return e===0?0:o;if(e===0)return-o}};var $s=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var e=arguments[0];this._p=e};$s.prototype.countSegment=function(e,n){if(e.xi&&(r=n.x,i=e.x),this._p.x>=r&&this._p.x<=i&&(this._isPointOnSegment=!0),null}if(e.y>this._p.y&&n.y<=this._p.y||n.y>this._p.y&&e.y<=this._p.y){var o=e.x-this._p.x,s=e.y-this._p.y,a=n.x-this._p.x,u=n.y-this._p.y,l=yf.signOfDet2x2(o,s,a,u);if(l===0)return this._isPointOnSegment=!0,null;u0&&this._crossingCount++}},$s.prototype.isPointInPolygon=function(){return this.getLocation()!==me.EXTERIOR},$s.prototype.getLocation=function(){return this._isPointOnSegment?me.BOUNDARY:this._crossingCount%2===1?me.INTERIOR:me.EXTERIOR},$s.prototype.isOnSegment=function(){return this._isPointOnSegment},$s.prototype.interfaces_=function(){return[]},$s.prototype.getClass=function(){return $s},$s.locatePointInRing=function(){if(arguments[0]instanceof ce&&st(arguments[1],At)){for(var e=arguments[0],n=arguments[1],r=new $s(e),i=new ce,o=new ce,s=1;s1||l<0||l>1)&&(o=!0)}}return o?To.min(Le.distancePointLine(e,r,i),Le.distancePointLine(n,r,i),Le.distancePointLine(r,e,n),Le.distancePointLine(i,e,n)):0},Le.isPointInRing=function(e,n){return Le.locatePointInRing(e,n)!==me.EXTERIOR},Le.computeLength=function(e){var n=e.size();if(n<=1)return 0;var r=0,i=new ce;e.getCoordinate(0,i);for(var o=i.x,s=i.y,a=1;ar.y&&(r=s,i=o)}var a=i;do a=a-1,a<0&&(a=n);while(e[a].equals2D(r)&&a!==i);var u=i;do u=(u+1)%n;while(e[u].equals2D(r)&&u!==i);var l=e[a],f=e[u];if(l.equals2D(r)||f.equals2D(r)||l.equals2D(f))return!1;var c=Le.computeOrientation(l,r,f),h=!1;return c===0?h=l.x>f.x:h=c>0,h},Le.locatePointInRing=function(e,n){return $s.locatePointInRing(e,n)},Le.distancePointLinePerpendicular=function(e,n,r){var i=(r.x-n.x)*(r.x-n.x)+(r.y-n.y)*(r.y-n.y),o=((n.y-e.y)*(r.x-n.x)-(n.x-e.x)*(r.y-n.y))/i;return Math.abs(o)*Math.sqrt(i)},Le.computeOrientation=function(e,n,r){return Le.orientationIndex(e,n,r)},Le.distancePointLine=function(){if(arguments.length===2){var e=arguments[0],n=arguments[1];if(n.length===0)throw new tr("Line array must contain at least one vertex");for(var r=e.distance(n[0]),i=0;i=1)return s.distance(u);var c=((a.y-s.y)*(u.x-a.x)-(a.x-s.x)*(u.y-a.y))/l;return Math.abs(c)*Math.sqrt(l)}},Le.isOnLine=function(e,n){for(var r=new Xu,i=1;i0},ud.prototype.interfaces_=function(){return[Go]},ud.prototype.getClass=function(){return ud};var cd=function(){};cd.prototype.isInBoundary=function(e){return e>1},cd.prototype.interfaces_=function(){return[Go]},cd.prototype.getClass=function(){return cd};var fd=function(){};fd.prototype.isInBoundary=function(e){return e===1},fd.prototype.interfaces_=function(){return[Go]},fd.prototype.getClass=function(){return fd};var Ir=function(){};Ir.prototype.add=function(){},Ir.prototype.addAll=function(){},Ir.prototype.isEmpty=function(){},Ir.prototype.iterator=function(){},Ir.prototype.size=function(){},Ir.prototype.toArray=function(){},Ir.prototype.remove=function(){};function JE(t){this.message=t||""}JE.prototype=new Error,JE.prototype.name="IndexOutOfBoundsException";var hd=function(){};hd.prototype.hasNext=function(){},hd.prototype.next=function(){},hd.prototype.remove=function(){};var ps=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(Ir);function dd(t){this.message=t||""}dd.prototype=new Error,dd.prototype.name="NoSuchElementException";var Pe=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof Ir&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,Ir]},e.prototype.add=function(r){return arguments.length===1?this.array_.push(r):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(r){for(var i=this,o=r.iterator();o.hasNext();)i.add(o.next());return!0},e.prototype.set=function(r,i){var o=this.array_[r];return this.array_[r]=i,o},e.prototype.iterator=function(){return new nY(this)},e.prototype.get=function(r){if(r<0||r>=this.size())throw new JE;return this.array_[r]},e.prototype.isEmpty=function(){return this.array_.length===0},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var r=this,i=[],o=0,s=this.array_.length;o=1){var f=this.get(this.size()-1);if(f.equals2D(u))return null}t.prototype.add.call(this,u)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var c=arguments[0],h=arguments[1];return this.add(c,h),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var d=arguments[0],g=arguments[1],y=arguments[2];if(y)for(var b=0;b=0;_--)i.add(d[_],g);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof ce){var p=arguments[0],m=arguments[1],v=arguments[2];if(!v){var w=this.size();if(w>0){if(p>0){var N=this.get(p-1);if(N.equals2D(m))return null}if(pT&&(I=-1);for(var A=M;A!==T;A+=I)i.add(C[A],O);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new ce(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(Pe),Nt=function(){},Av={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Av.ForwardComparator.get=function(){return lg},Av.BidirectionalComparator.get=function(){return pd},Av.coordArrayType.get=function(){return new Array(0).fill(null)},Nt.prototype.interfaces_=function(){return[]},Nt.prototype.getClass=function(){return Nt},Nt.isRing=function(e){return!(e.length<4||!e[0].equals2D(e[e.length-1]))},Nt.ptNotInList=function(e,n){for(var r=0;r=e?n:[]},Nt.indexOf=function(e,n){for(var r=0;r0)&&(n=e[r]);return n},Nt.extract=function(e,n,r){n=To.clamp(n,0,e.length),r=To.clamp(r,-1,e.length);var i=r-n+1;r<0&&(i=0),n>=e.length&&(i=0),ri.length)return 1;if(r.length===0)return 0;var o=Nt.compare(r,i),s=Nt.isEqualReversed(r,i);return s?0:o},pd.prototype.OLDcompare=function(e,n){var r=e,i=n;if(r.lengthi.length)return 1;if(r.length===0)return 0;for(var o=Nt.increasingDirection(r),s=Nt.increasingDirection(i),a=o>0?0:r.length-1,u=s>0?0:r.length-1,l=0;l0)e=e.right;else return e.value}return null},_i.prototype.put=function(t,e){if(this.root_===null)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:nl,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,r,i;do if(r=n,i=t.compareTo(n.key),i<0)n=n.left;else if(i>0)n=n.right;else{var o=n.value;return n.value=e,o}while(n!==null);var s={key:t,left:null,right:null,value:e,parent:r,color:nl,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?r.left=s:r.right=s,this.fixAfterInsertion(s),this.size_++,null},_i.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=Ku;t!=null&&t!==this.root_&&t.parent.color===Ku;)if(Un(t)===ew(Un(Un(t)))){var n=UM(Un(Un(t)));qM(n)===Ku?(rl(Un(t),nl),rl(n,nl),rl(Un(Un(t)),Ku),t=Un(Un(t))):(t===UM(Un(t))&&(t=Un(t),e.rotateLeft(t)),rl(Un(t),nl),rl(Un(Un(t)),Ku),e.rotateRight(Un(Un(t))))}else{var r=ew(Un(Un(t)));qM(r)===Ku?(rl(Un(t),nl),rl(r,nl),rl(Un(Un(t)),Ku),t=Un(Un(t))):(t===ew(Un(t))&&(t=Un(t),e.rotateRight(t)),rl(Un(t),nl),rl(Un(Un(t)),Ku),e.rotateLeft(Un(Un(t))))}this.root_.color=nl},_i.prototype.values=function(){var t=new Pe,e=this.getFirstEntry();if(e!==null)for(t.add(e.value);(e=_i.successor(e))!==null;)t.add(e.value);return t},_i.prototype.entrySet=function(){var t=new QE,e=this.getFirstEntry();if(e!==null)for(t.add(e);(e=_i.successor(e))!==null;)t.add(e);return t},_i.prototype.rotateLeft=function(t){if(t!=null){var e=t.right;t.right=e.left,e.left!=null&&(e.left.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}},_i.prototype.rotateRight=function(t){if(t!=null){var e=t.left;t.left=e.right,e.right!=null&&(e.right.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}},_i.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t},_i.successor=function(t){if(t===null)return null;if(t.right!==null){for(var e=t.right;e.left!==null;)e=e.left;return e}else{for(var n=t.parent,r=t;n!==null&&r===n.right;)r=n,n=n.parent;return n}},_i.prototype.size=function(){return this.size_};var cg=function(){};cg.prototype.interfaces_=function(){return[]},cg.prototype.getClass=function(){return cg};function zM(){}zM.prototype=new Lv;function js(){this.array_=[],arguments[0]instanceof Ir&&this.addAll(arguments[0])}js.prototype=new zM,js.prototype.contains=function(t){for(var e=this,n=0,r=this.array_.length;n=0;){var a=o.substring(0,s);i.add(a),o=o.substring(s+r),s=o.indexOf(n)}o.length>0&&i.add(o);for(var u=new Array(i.size()).fill(null),l=0;l0)for(var s=o;s0&&i.append(" ");for(var s=0;s0&&i.append(","),i.append(Wo.toString(e.getOrdinate(o,s)))}return i.append(")"),i.toString()}},pr.ensureValidRing=function(e,n){var r=n.size();if(r===0)return n;if(r<=3)return pr.createClosedRing(e,n,4);var i=n.getOrdinate(0,At.X)===n.getOrdinate(r-1,At.X)&&n.getOrdinate(0,At.Y)===n.getOrdinate(r-1,At.Y);return i?n:pr.createClosedRing(e,n,r+1)},pr.createClosedRing=function(e,n,r){var i=e.create(r,n.getDimension()),o=n.size();pr.copy(n,0,i,0,o);for(var s=o;s0&&pr.reverse(i._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?cn.FALSE:0},e.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return Le.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var i=this._points.copy();pr.reverse(i);var o=this.getFactory().createLineString(i);return o},e.prototype.compareToSameClass=function(){var i=this;if(arguments.length===1){for(var o=arguments[0],s=o,a=0,u=0;a= 2)");this._points=i},e.prototype.isCoordinate=function(i){for(var o=this,s=0;s=1&&this.getCoordinateSequence().size()= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,n),e}(sr),va=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return ot.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(arguments.length===2){var i=arguments[0],o=arguments[1];return this.isEquivalentClass(i)?t.prototype.equalsExact.call(this,i,o):!1}else return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var i=this,o=this._geometries.length,s=new Array(o).fill(null),a=0;a0?n.createPoint(r[0]):n.createPoint():e},dg.prototype.interfaces_=function(){return[Xo.GeometryEditorOperation]},dg.prototype.getClass=function(){return dg};var pg=function(){};pg.prototype.edit=function(e,n){return e instanceof ya?n.createLinearRing(this.edit(e.getCoordinateSequence(),e)):e instanceof sr?n.createLineString(this.edit(e.getCoordinateSequence(),e)):e instanceof fo?n.createPoint(this.edit(e.getCoordinateSequence(),e)):e},pg.prototype.interfaces_=function(){return[Xo.GeometryEditorOperation]},pg.prototype.getClass=function(){return pg};var gr=function(){var e=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var n=arguments[0];this._coordinates=new Array(n).fill(null);for(var r=0;r0){var n=new Fs(17*this._coordinates.length);n.append("("),n.append(this._coordinates[0]);for(var r=1;r3&&(i=3),i<2?new gr(r):new gr(r,i)}},_a.prototype.interfaces_=function(){return[od,Ho]},_a.prototype.getClass=function(){return _a},_a.instance=function(){return _a.instanceObject},nw.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},nw.instanceObject.get=function(){return new _a},Object.defineProperties(_a,nw);var GM=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(r){return this.map_.get(r)||null},e.prototype.put=function(r,i){return this.map_.set(r,i),i},e.prototype.values=function(){for(var r=new Pe,i=this.map_.values(),o=i.next();!o.done;)r.add(o.value),o=i.next();return r},e.prototype.entrySet=function(){var r=new QE;return this.map_.entries().forEach(function(i){return r.add(i)}),r},e.prototype.size=function(){return this.map_.size()},e}(_f),fn=function t(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=t.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Us){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}}},rw={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};fn.prototype.equals=function(e){if(!(e instanceof fn))return!1;var n=e;return this._modelType===n._modelType&&this._scale===n._scale},fn.prototype.compareTo=function(e){var n=e,r=this.getMaximumSignificantDigits(),i=n.getMaximumSignificantDigits();return new Bs(r).compareTo(new Bs(i))},fn.prototype.getScale=function(){return this._scale},fn.prototype.isFloating=function(){return this._modelType===fn.FLOATING||this._modelType===fn.FLOATING_SINGLE},fn.prototype.getType=function(){return this._modelType},fn.prototype.toString=function(){var e="UNKNOWN";return this._modelType===fn.FLOATING?e="Floating":this._modelType===fn.FLOATING_SINGLE?e="Floating-Single":this._modelType===fn.FIXED&&(e="Fixed (Scale="+this.getScale()+")"),e},fn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var e=arguments[0];if(yt.isNaN(e))return e;if(this._modelType===fn.FLOATING_SINGLE){var n=e;return n}return this._modelType===fn.FIXED?Math.round(e*this._scale)/this._scale:e}else if(arguments[0]instanceof ce){var r=arguments[0];if(this._modelType===fn.FLOATING)return null;r.x=this.makePrecise(r.x),r.y=this.makePrecise(r.y)}},fn.prototype.getMaximumSignificantDigits=function(){var e=16;return this._modelType===fn.FLOATING?e=16:this._modelType===fn.FLOATING_SINGLE?e=6:this._modelType===fn.FIXED&&(e=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),e},fn.prototype.setScale=function(e){this._scale=Math.abs(e)},fn.prototype.interfaces_=function(){return[Ho,zo]},fn.prototype.getClass=function(){return fn},fn.mostPrecise=function(e,n){return e.compareTo(n)>=0?e:n},rw.serialVersionUID.get=function(){return 7777263578777804e3},rw.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(fn,rw);var Us=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},iw={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Us.prototype.readResolve=function(){return Us.nameToTypeMap.get(this._name)},Us.prototype.toString=function(){return this._name},Us.prototype.interfaces_=function(){return[Ho]},Us.prototype.getClass=function(){return Us},iw.serialVersionUID.get=function(){return-552860263173159e4},iw.nameToTypeMap.get=function(){return new GM},Object.defineProperties(Us,iw),fn.Type=Us,fn.FIXED=new Us("FIXED"),fn.FLOATING=new Us("FLOATING"),fn.FLOATING_SINGLE=new Us("FLOATING SINGLE");var Ot=function t(){this._precisionModel=new fn,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?st(arguments[0],od)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof fn&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},YM={serialVersionUID:{configurable:!0}};Ot.prototype.toGeometry=function(e){return e.isNull()?this.createPoint(null):e.getMinX()===e.getMaxX()&&e.getMinY()===e.getMaxY()?this.createPoint(new ce(e.getMinX(),e.getMinY())):e.getMinX()===e.getMaxX()||e.getMinY()===e.getMaxY()?this.createLineString([new ce(e.getMinX(),e.getMinY()),new ce(e.getMaxX(),e.getMaxY())]):this.createPolygon(this.createLinearRing([new ce(e.getMinX(),e.getMinY()),new ce(e.getMinX(),e.getMaxY()),new ce(e.getMaxX(),e.getMaxY()),new ce(e.getMaxX(),e.getMinY()),new ce(e.getMinX(),e.getMinY())]),null)},Ot.prototype.createLineString=function(e){if(e){if(e instanceof Array)return new sr(this.getCoordinateSequenceFactory().create(e),this);if(st(e,At))return new sr(e,this)}else return new sr(this.getCoordinateSequenceFactory().create([]),this)},Ot.prototype.createMultiLineString=function(){if(arguments.length===0)return new Ju(null,this);if(arguments.length===1){var e=arguments[0];return new Ju(e,this)}},Ot.prototype.buildGeometry=function(e){for(var n=null,r=!1,i=!1,o=e.iterator();o.hasNext();){var s=o.next(),a=s.getClass();n===null&&(n=a),a!==n&&(r=!0),s.isGeometryCollectionOrDerived()&&(i=!0)}if(n===null)return this.createGeometryCollection();if(r||i)return this.createGeometryCollection(Ot.toGeometryArray(e));var u=e.iterator().next(),l=e.size()>1;if(l){if(u instanceof Mr)return this.createMultiPolygon(Ot.toPolygonArray(e));if(u instanceof sr)return this.createMultiLineString(Ot.toLineStringArray(e));if(u instanceof fo)return this.createMultiPoint(Ot.toPointArray(e));_t.shouldNeverReachHere("Unhandled class: "+u.getClass().getName())}return u},Ot.prototype.createMultiPointFromCoords=function(e){return this.createMultiPoint(e!==null?this.getCoordinateSequenceFactory().create(e):null)},Ot.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof ce){var e=arguments[0];return this.createPoint(e!==null?this.getCoordinateSequenceFactory().create([e]):null)}else if(st(arguments[0],At)){var n=arguments[0];return new fo(n,this)}}},Ot.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},Ot.prototype.createPolygon=function(){if(arguments.length===0)return new Mr(null,null,this);if(arguments.length===1){if(st(arguments[0],At)){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}else if(arguments[0]instanceof ya){var r=arguments[0];return this.createPolygon(r,null)}}else if(arguments.length===2){var i=arguments[0],o=arguments[1];return new Mr(i,o,this)}},Ot.prototype.getSRID=function(){return this._SRID},Ot.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Di(null,this);if(arguments.length===1){var e=arguments[0];return new Di(e,this)}},Ot.prototype.createGeometry=function(e){var n=new Xo(this);return n.edit(e,{edit:function(){if(arguments.length===2){var r=arguments[0];return this._coordinateSequenceFactory.create(r)}}})},Ot.prototype.getPrecisionModel=function(){return this._precisionModel},Ot.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return this.createLinearRing(e!==null?this.getCoordinateSequenceFactory().create(e):null)}else if(st(arguments[0],At)){var n=arguments[0];return new ya(n,this)}}},Ot.prototype.createMultiPolygon=function(){if(arguments.length===0)return new va(null,this);if(arguments.length===1){var e=arguments[0];return new va(e,this)}},Ot.prototype.createMultiPoint=function(){var e=this;if(arguments.length===0)return new gd(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new gd(n,this)}else if(arguments[0]instanceof Array){var r=arguments[0];return this.createMultiPoint(r!==null?this.getCoordinateSequenceFactory().create(r):null)}else if(st(arguments[0],At)){var i=arguments[0];if(i===null)return this.createMultiPoint(new Array(0).fill(null));for(var o=new Array(i.size()).fill(null),s=0;s=this.size())throw new Error;return this.array_[t]},Hs.prototype.push=function(t){return this.array_.push(t),t},Hs.prototype.pop=function(t){if(this.array_.length===0)throw new $v;return this.array_.pop()},Hs.prototype.peek=function(){if(this.array_.length===0)throw new $v;return this.array_[this.array_.length-1]},Hs.prototype.empty=function(){return this.array_.length===0},Hs.prototype.isEmpty=function(){return this.empty()},Hs.prototype.search=function(t){return this.array_.indexOf(t)},Hs.prototype.size=function(){return this.array_.length},Hs.prototype.toArray=function(){for(var t=this,e=[],n=0,r=this.array_.length;n0&&this._minIndexthis._minCoord.y&&r.y>this._minCoord.y&&i===Le.CLOCKWISE)&&(o=!0),o&&(this._minIndex=this._minIndex-1)},Gs.prototype.getRightmostSideOfSegment=function(e,n){var r=e.getEdge(),i=r.getCoordinates();if(n<0||n+1>=i.length||i[n].y===i[n+1].y)return-1;var o=Te.LEFT;return i[n].yn._minCoord.x)&&(n._minDe=e,n._minIndex=i,n._minCoord=r[i])},Gs.prototype.findRightmostEdgeAtNode=function(){var e=this._minDe.getNode(),n=e.getEdges();this._minDe=n.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},Gs.prototype.findEdge=function(e){for(var n=this,r=e.iterator();r.hasNext();){var i=r.next();i.isForward()&&n.checkForRightmostCoordinate(i)}_t.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var o=this.getRightmostSide(this._minDe,this._minIndex);o===Te.LEFT&&(this._orientedDe=this._minDe.getSym())},Gs.prototype.interfaces_=function(){return[]},Gs.prototype.getClass=function(){return Gs};var ol=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new ce(r):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(r,i){return i?r:r+" [ "+i+" ]"},e}(Qa),jv=function(){this.array_=[]};jv.prototype.addLast=function(e){this.array_.push(e)},jv.prototype.removeFirst=function(){return this.array_.shift()},jv.prototype.isEmpty=function(){return this.array_.length===0};var Ri=function(){this._finder=null,this._dirEdgeList=new Pe,this._nodes=new Pe,this._rightMostCoord=null,this._env=null,this._finder=new Gs};Ri.prototype.clearVisitedEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var n=e.next();n.setVisited(!1)}},Ri.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},Ri.prototype.computeNodeDepth=function(e){for(var n=this,r=null,i=e.getEdges().iterator();i.hasNext();){var o=i.next();if(o.isVisited()||o.getSym().isVisited()){r=o;break}}if(r===null)throw new ol("unable to find edge to compute depths at "+e.getCoordinate());e.getEdges().computeDepths(r);for(var s=e.getEdges().iterator();s.hasNext();){var a=s.next();a.setVisited(!0),n.copySymDepths(a)}},Ri.prototype.computeDepth=function(e){this.clearVisitedEdges();var n=this._finder.getEdge();n.setEdgeDepths(Te.RIGHT,e),this.copySymDepths(n),this.computeDepths(n)},Ri.prototype.create=function(e){this.addReachable(e),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},Ri.prototype.findResultEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var n=e.next();n.getDepth(Te.RIGHT)>=1&&n.getDepth(Te.LEFT)<=0&&!n.isInteriorAreaEdge()&&n.setInResult(!0)}},Ri.prototype.computeDepths=function(e){var n=this,r=new QE,i=new jv,o=e.getNode();for(i.addLast(o),r.add(o),e.setVisited(!0);!i.isEmpty();){var s=i.removeFirst();r.add(s),n.computeNodeDepth(s);for(var a=s.getEdges().iterator();a.hasNext();){var u=a.next(),l=u.getSym();if(!l.isVisited()){var f=l.getNode();r.contains(f)||(i.addLast(f),r.add(f))}}}},Ri.prototype.compareTo=function(e){var n=e;return this._rightMostCoord.xn._rightMostCoord.x?1:0},Ri.prototype.getEnvelope=function(){if(this._env===null){for(var e=new Ze,n=this._dirEdgeList.iterator();n.hasNext();)for(var r=n.next(),i=r.getEdge().getCoordinates(),o=0;othis.location.length){var r=new Array(3).fill(null);r[Te.ON]=this.location[Te.ON],r[Te.LEFT]=me.NONE,r[Te.RIGHT]=me.NONE,this.location=r}for(var i=0;i1&&e.append(me.toLocationSymbol(this.location[Te.LEFT])),e.append(me.toLocationSymbol(this.location[Te.ON])),this.location.length>1&&e.append(me.toLocationSymbol(this.location[Te.RIGHT])),e.toString()},zn.prototype.setLocations=function(e,n,r){this.location[Te.ON]=e,this.location[Te.LEFT]=n,this.location[Te.RIGHT]=r},zn.prototype.get=function(e){return e1},zn.prototype.isAnyNull=function(){for(var e=this,n=0;ne._maxNodeDegree&&(e._maxNodeDegree=i),n=e.getNext(n)}while(n!==this._startDe);this._maxNodeDegree*=2},Sr.prototype.addPoints=function(e,n,r){var i=this,o=e.getCoordinates();if(n){var s=1;r&&(s=0);for(var a=s;a=0;l--)i._pts.add(o[l])}},Sr.prototype.isHole=function(){return this._isHole},Sr.prototype.setInResult=function(){var e=this._startDe;do e.getEdge().setInResult(!0),e=e.getNext();while(e!==this._startDe)},Sr.prototype.containsPoint=function(e){var n=this.getLinearRing(),r=n.getEnvelopeInternal();if(!r.contains(e)||!Le.isPointInRing(e,n.getCoordinates()))return!1;for(var i=this._holes.iterator();i.hasNext();){var o=i.next();if(o.containsPoint(e))return!1}return!0},Sr.prototype.addHole=function(e){this._holes.add(e)},Sr.prototype.isShell=function(){return this._shell===null},Sr.prototype.getLabel=function(){return this._label},Sr.prototype.getEdges=function(){return this._edges},Sr.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Sr.prototype.getShell=function(){return this._shell},Sr.prototype.mergeLabel=function(){if(arguments.length===1){var e=arguments[0];this.mergeLabel(e,0),this.mergeLabel(e,1)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=n.getLocation(r,Te.RIGHT);if(i===me.NONE)return null;if(this._label.getLocation(r)===me.NONE)return this._label.setLocation(r,i),null}},Sr.prototype.setShell=function(e){this._shell=e,e!==null&&e.addHole(this)},Sr.prototype.toPolygon=function(e){for(var n=this,r=new Array(this._holes.size()).fill(null),i=0;i=2,"found partial label"),this.computeIM(e)},Io.prototype.isInResult=function(){return this._isInResult},Io.prototype.isVisited=function(){return this._isVisited},Io.prototype.interfaces_=function(){return[]},Io.prototype.getClass=function(){return Io};var qv=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var n=arguments[0],r=arguments[1];this._coord=n,this._edges=r,this._label=new Sn(0,me.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var r=this.getEdges().getEdges().iterator();r.hasNext();){var i=r.next();if(i.getEdge().isInResult())return!0}return!1},e.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(r){r.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(r){},e.prototype.computeMergedLocation=function(r,i){var o=me.NONE;if(o=this._label.getLocation(i),!r.isNull(i)){var s=r.getLocation(i);o!==me.BOUNDARY&&(o=s)}return o},e.prototype.setLabel=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];this._label===null?this._label=new Sn(r,i):this._label.setLocation(r,i)}else return t.prototype.setLabel.apply(this,arguments)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var r=this;if(arguments[0]instanceof e){var i=arguments[0];this.mergeLabel(i._label)}else if(arguments[0]instanceof Sn)for(var o=arguments[0],s=0;s<2;s++){var a=r.computeMergedLocation(o,s),u=r._label.getLocation(s);u===me.NONE&&r._label.setLocation(s,a)}},e.prototype.add=function(r){this._edges.insert(r),r.setNode(this)},e.prototype.setLabelBoundary=function(r){if(this._label===null)return null;var i=me.NONE;this._label!==null&&(i=this._label.getLocation(r));var o=null;switch(i){case me.BOUNDARY:o=me.INTERIOR;break;case me.INTERIOR:o=me.BOUNDARY;break;default:o=me.BOUNDARY;break}this._label.setLocation(r,o)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Io),Ys=function(){this.nodeMap=new _i,this.nodeFact=null;var e=arguments[0];this.nodeFact=e};Ys.prototype.find=function(e){return this.nodeMap.get(e)},Ys.prototype.addNode=function(){if(arguments[0]instanceof ce){var e=arguments[0],n=this.nodeMap.get(e);return n===null&&(n=this.nodeFact.createNode(e),this.nodeMap.put(e,n)),n}else if(arguments[0]instanceof qv){var r=arguments[0],i=this.nodeMap.get(r.getCoordinate());return i===null?(this.nodeMap.put(r.getCoordinate(),r),r):(i.mergeLabel(r),i)}},Ys.prototype.print=function(e){for(var n=this.iterator();n.hasNext();){var r=n.next();r.print(e)}},Ys.prototype.iterator=function(){return this.nodeMap.values().iterator()},Ys.prototype.values=function(){return this.nodeMap.values()},Ys.prototype.getBoundaryNodes=function(e){for(var n=new Pe,r=this.iterator();r.hasNext();){var i=r.next();i.getLabel().getLocation(e)===me.BOUNDARY&&n.add(i)}return n},Ys.prototype.add=function(e){var n=e.getCoordinate(),r=this.addNode(n);r.add(e)},Ys.prototype.interfaces_=function(){return[]},Ys.prototype.getClass=function(){return Ys};var Dn=function(){},gg={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Dn.prototype.interfaces_=function(){return[]},Dn.prototype.getClass=function(){return Dn},Dn.isNorthern=function(e){return e===Dn.NE||e===Dn.NW},Dn.isOpposite=function(e,n){if(e===n)return!1;var r=(e-n+4)%4;return r===2},Dn.commonHalfPlane=function(e,n){if(e===n)return e;var r=(e-n+4)%4;if(r===2)return-1;var i=en?e:n;return i===0&&o===3?3:i},Dn.isInHalfPlane=function(e,n){return n===Dn.SE?e===Dn.SE||e===Dn.SW:e===n||e===n+1},Dn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],n=arguments[1];if(e===0&&n===0)throw new tr("Cannot compute the quadrant for point ( "+e+", "+n+" )");return e>=0?n>=0?Dn.NE:Dn.SE:n>=0?Dn.NW:Dn.SW}else if(arguments[0]instanceof ce&&arguments[1]instanceof ce){var r=arguments[0],i=arguments[1];if(i.x===r.x&&i.y===r.y)throw new tr("Cannot compute the quadrant for two identical points "+r);return i.x>=r.x?i.y>=r.y?Dn.NE:Dn.SE:i.y>=r.y?Dn.NW:Dn.SW}},gg.NE.get=function(){return 0},gg.NW.get=function(){return 1},gg.SW.get=function(){return 2},gg.SE.get=function(){return 3},Object.defineProperties(Dn,gg);var bi=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var e=arguments[0];this._edge=e}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2],o=null;this._edge=n,this.init(r,i),this._label=o}else if(arguments.length===4){var s=arguments[0],a=arguments[1],u=arguments[2],l=arguments[3];this._edge=s,this.init(a,u),this._label=l}};bi.prototype.compareDirection=function(e){return this._dx===e._dx&&this._dy===e._dy?0:this._quadrant>e._quadrant?1:this._quadrant2){a.linkDirectedEdgesForMinimalEdgeRings();var u=a.buildMinimalRings(),l=i.findShell(u);l!==null?(i.placePolygonHoles(l,u),n.add(l)):r.addAll(u)}else o.add(a)}return o},ho.prototype.containsPoint=function(e){for(var n=this._shellList.iterator();n.hasNext();){var r=n.next();if(r.containsPoint(e))return!0}return!1},ho.prototype.buildMaximalEdgeRings=function(e){for(var n=this,r=new Pe,i=e.iterator();i.hasNext();){var o=i.next();if(o.isInResult()&&o.getLabel().isArea()&&o.getEdgeRing()===null){var s=new dY(o,n._geometryFactory);r.add(s),s.setInResult()}}return r},ho.prototype.placePolygonHoles=function(e,n){for(var r=n.iterator();r.hasNext();){var i=r.next();i.isHole()&&i.setShell(e)}},ho.prototype.getPolygons=function(){var e=this.computePolygons(this._shellList);return e},ho.prototype.findEdgeRingContaining=function(e,n){for(var r=e.getLinearRing(),i=r.getEnvelopeInternal(),o=r.getCoordinateN(0),s=null,a=null,u=n.iterator();u.hasNext();){var l=u.next(),f=l.getLinearRing(),c=f.getEnvelopeInternal();s!==null&&(a=s.getLinearRing().getEnvelopeInternal());var h=!1;c.contains(i)&&Le.isPointInRing(o,f.getCoordinates())&&(h=!0),h&&(s===null||a.contains(c))&&(s=l)}return s},ho.prototype.findShell=function(e){for(var n=0,r=null,i=e.iterator();i.hasNext();){var o=i.next();o.isHole()||(r=o,n++)}return _t.isTrue(n<=1,"found two shells in MinimalEdgeRing list"),r},ho.prototype.add=function(){if(arguments.length===1){var e=arguments[0];this.add(e.getEdgeEnds(),e.getNodes())}else if(arguments.length===2){var n=arguments[0],r=arguments[1];rr.linkResultDirectedEdges(r);var i=this.buildMaximalEdgeRings(n),o=new Pe,s=this.buildMinimalEdgeRings(i,this._shellList,o);this.sortShellsAndHoles(s,this._shellList,o),this.placeFreeHoles(this._shellList,o)}},ho.prototype.interfaces_=function(){return[]},ho.prototype.getClass=function(){return ho};var yd=function(){};yd.prototype.getBounds=function(){},yd.prototype.interfaces_=function(){return[]},yd.prototype.getClass=function(){return yd};var ys=function(){this._bounds=null,this._item=null;var e=arguments[0],n=arguments[1];this._bounds=e,this._item=n};ys.prototype.getItem=function(){return this._item},ys.prototype.getBounds=function(){return this._bounds},ys.prototype.interfaces_=function(){return[yd,Ho]},ys.prototype.getClass=function(){return ys};var sl=function(){this._size=null,this._items=null,this._size=0,this._items=new Pe,this._items.add(null)};sl.prototype.poll=function(){if(this.isEmpty())return null;var e=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),e},sl.prototype.size=function(){return this._size},sl.prototype.reorder=function(e){for(var n=this,r=null,i=this._items.get(e);e*2<=this._size&&(r=e*2,r!==n._size&&n._items.get(r+1).compareTo(n._items.get(r))<0&&r++,n._items.get(r).compareTo(i)<0);e=r)n._items.set(e,n._items.get(r));this._items.set(e,i)},sl.prototype.clear=function(){this._size=0,this._items.clear()},sl.prototype.isEmpty=function(){return this._size===0},sl.prototype.add=function(e){var n=this;this._items.add(null),this._size+=1;var r=this._size;for(this._items.set(0,e);e.compareTo(this._items.get(Math.trunc(r/2)))<0;r/=2)n._items.set(r,n._items.get(Math.trunc(r/2)));this._items.set(r,e)},sl.prototype.interfaces_=function(){return[]},sl.prototype.getClass=function(){return sl};var nu=function(){};nu.prototype.visitItem=function(e){},nu.prototype.interfaces_=function(){return[]},nu.prototype.getClass=function(){return nu};var bf=function(){};bf.prototype.insert=function(e,n){},bf.prototype.remove=function(e,n){},bf.prototype.query=function(){},bf.prototype.interfaces_=function(){return[]},bf.prototype.getClass=function(){return bf};var kr=function(){if(this._childBoundables=new Pe,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this._level=e}}},XM={serialVersionUID:{configurable:!0}};kr.prototype.getLevel=function(){return this._level},kr.prototype.size=function(){return this._childBoundables.size()},kr.prototype.getChildBoundables=function(){return this._childBoundables},kr.prototype.addChildBoundable=function(e){_t.isTrue(this._bounds===null),this._childBoundables.add(e)},kr.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},kr.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},kr.prototype.interfaces_=function(){return[yd,Ho]},kr.prototype.getClass=function(){return kr},XM.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(kr,XM);var vs=function(){};vs.reverseOrder=function(){return{compare:function(n,r){return r.compareTo(n)}}},vs.min=function(e){return vs.sort(e),e.get(0)},vs.sort=function(e,n){var r=e.toArray();n?Zu.sort(r,n):Zu.sort(r);for(var i=e.iterator(),o=0,s=r.length;oCr.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,e,n),null):(this.expand(this._boundable2,this._boundable1,e,n),null);if(r)return this.expand(this._boundable1,this._boundable2,e,n),null;if(i)return this.expand(this._boundable2,this._boundable1,e,n),null;throw new tr("neither boundable is composite")},Cr.prototype.isLeaves=function(){return!(Cr.isComposite(this._boundable1)||Cr.isComposite(this._boundable2))},Cr.prototype.compareTo=function(e){var n=e;return this._distancen._distance?1:0},Cr.prototype.expand=function(e,n,r,i){for(var o=this,s=e.getChildBoundables(),a=s.iterator();a.hasNext();){var u=a.next(),l=new Cr(u,n,o._itemDistance);l.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},Uv={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Hr.prototype.getNodeCapacity=function(){return this._nodeCapacity},Hr.prototype.lastNode=function(e){return e.get(e.size()-1)},Hr.prototype.size=function(){var e=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var n=arguments[0],r=0,i=n.getChildBoundables().iterator();i.hasNext();){var o=i.next();o instanceof kr?r+=e.size(o):o instanceof ys&&(r+=1)}return r}},Hr.prototype.removeItem=function(e,n){for(var r=null,i=e.getChildBoundables().iterator();i.hasNext();){var o=i.next();o instanceof ys&&o.getItem()===n&&(r=o)}return r!==null?(e.getChildBoundables().remove(r),!0):!1},Hr.prototype.itemsTree=function(){var e=this;if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new Pe:n}else if(arguments.length===1){for(var r=arguments[0],i=new Pe,o=r.getChildBoundables().iterator();o.hasNext();){var s=o.next();if(s instanceof kr){var a=e.itemsTree(s);a!==null&&i.add(a)}else s instanceof ys?i.add(s.getItem()):_t.shouldNeverReachHere()}return i.size()<=0?null:i}},Hr.prototype.insert=function(e,n){_t.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new ys(e,n))},Hr.prototype.boundablesAtLevel=function(){var e=this;if(arguments.length===1){var n=arguments[0],r=new Pe;return this.boundablesAtLevel(n,this._root,r),r}else if(arguments.length===3){var i=arguments[0],o=arguments[1],s=arguments[2];if(_t.isTrue(i>-2),o.getLevel()===i)return s.add(o),null;for(var a=o.getChildBoundables().iterator();a.hasNext();){var u=a.next();u instanceof kr?e.boundablesAtLevel(i,u,s):(_t.isTrue(u instanceof ys),i===-1&&s.add(u))}return null}},Hr.prototype.query=function(){var e=this;if(arguments.length===1){var n=arguments[0];this.build();var r=new Pe;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,r),r}else if(arguments.length===2){var i=arguments[0],o=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),i)&&this.query(i,this._root,o)}else if(arguments.length===3){if(st(arguments[2],nu)&&arguments[0]instanceof Object&&arguments[1]instanceof kr)for(var s=arguments[0],a=arguments[1],u=arguments[2],l=a.getChildBoundables(),f=0;fr&&(r=s)}}return r+1}},Hr.prototype.createParentBoundables=function(e,n){var r=this;_t.isTrue(!e.isEmpty());var i=new Pe;i.add(this.createNode(n));var o=new Pe(e);vs.sort(o,this.getComparator());for(var s=o.iterator();s.hasNext();){var a=s.next();r.lastNode(i).getChildBoundables().size()===r.getNodeCapacity()&&i.add(r.createNode(n)),r.lastNode(i).addChildBoundable(a)}return i},Hr.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Hr.prototype.interfaces_=function(){return[Ho]},Hr.prototype.getClass=function(){return Hr},Hr.compareDoubles=function(e,n){return e>n?1:e0);for(var a=new Pe,u=0;u0;){var y=g.poll(),b=y.getDistance();if(b>=h)break;y.isLeaves()?(h=b,d=y):y.expandToQueue(g,h)}return[d.getBoundable(0).getItem(),d.getBoundable(1).getItem()]}}else if(arguments.length===3){var _=arguments[0],p=arguments[1],m=arguments[2],v=new ys(_,p),w=new Cr(this.getRoot(),v,m);return this.nearestNeighbour(w)[0]}},e.prototype.interfaces_=function(){return[bf,Ho]},e.prototype.getClass=function(){return e},e.centreX=function(i){return e.avg(i.getMinX(),i.getMaxX())},e.avg=function(i,o){return(i+o)/2},e.centreY=function(i){return e.avg(i.getMinY(),i.getMaxY())},n.STRtreeNode.get=function(){return ZM},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[id]},compare:function(r,i){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(i.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[id]},compare:function(r,i){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(i.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(r,i){return r.intersects(i)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,n),e}(Hr),ZM=function(t){function e(){var n=arguments[0];t.call(this,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var r=null,i=this.getChildBoundables().iterator();i.hasNext();){var o=i.next();r===null?r=new Ze(o.getBounds()):r.expandToInclude(o.getBounds())}return r},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(kr),Ji=function(){};Ji.prototype.interfaces_=function(){return[]},Ji.prototype.getClass=function(){return Ji},Ji.relativeSign=function(e,n){return en?1:0},Ji.compare=function(e,n,r){if(n.equals2D(r))return 0;var i=Ji.relativeSign(n.x,r.x),o=Ji.relativeSign(n.y,r.y);switch(e){case 0:return Ji.compareValue(i,o);case 1:return Ji.compareValue(o,i);case 2:return Ji.compareValue(o,-i);case 3:return Ji.compareValue(-i,o);case 4:return Ji.compareValue(-i,-o);case 5:return Ji.compareValue(-o,-i);case 6:return Ji.compareValue(-o,i);case 7:return Ji.compareValue(i,-o)}return _t.shouldNeverReachHere("invalid octant value"),0},Ji.compareValue=function(e,n){return e<0?-1:e>0?1:n<0?-1:n>0?1:0};var ru=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var e=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3];this._segString=e,this.coord=new ce(n),this.segmentIndex=r,this._segmentOctant=i,this._isInterior=!n.equals2D(e.getCoordinate(r))};ru.prototype.getCoordinate=function(){return this.coord},ru.prototype.print=function(e){e.print(this.coord),e.print(" seg # = "+this.segmentIndex)},ru.prototype.compareTo=function(e){var n=e;return this.segmentIndexn.segmentIndex?1:this.coord.equals2D(n.coord)?0:Ji.compare(this._segmentOctant,this.coord,n.coord)},ru.prototype.isEndPoint=function(e){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===e},ru.prototype.isInterior=function(){return this._isInterior},ru.prototype.interfaces_=function(){return[zo]},ru.prototype.getClass=function(){return ru};var Fi=function(){this._nodeMap=new _i,this._edge=null;var e=arguments[0];this._edge=e};Fi.prototype.getSplitCoordinates=function(){var e=this,n=new ag;this.addEndpoints();for(var r=this.iterator(),i=r.next();r.hasNext();){var o=r.next();e.addEdgeCoordinates(i,o,n),i=o}return n.toCoordinateArray()},Fi.prototype.addCollapsedNodes=function(){var e=this,n=new Pe;this.findCollapsesFromInsertedNodes(n),this.findCollapsesFromExistingVertices(n);for(var r=n.iterator();r.hasNext();){var i=r.next().intValue();e.add(e._edge.getCoordinate(i),i)}},Fi.prototype.print=function(e){e.println("Intersections:");for(var n=this.iterator();n.hasNext();){var r=n.next();r.print(e)}},Fi.prototype.findCollapsesFromExistingVertices=function(e){for(var n=this,r=0;r=0?n>=0?r>=i?0:1:r>=i?7:6:n>=0?r>=i?3:2:r>=i?4:5}else if(arguments[0]instanceof ce&&arguments[1]instanceof ce){var o=arguments[0],s=arguments[1],a=s.x-o.x,u=s.y-o.y;if(a===0&&u===0)throw new tr("Cannot compute the octant for two identical points "+o);return Ef.octant(a,u)}};var ba=function(){};ba.prototype.getCoordinates=function(){},ba.prototype.size=function(){},ba.prototype.getCoordinate=function(e){},ba.prototype.isClosed=function(){},ba.prototype.setData=function(e){},ba.prototype.getData=function(){},ba.prototype.interfaces_=function(){return[]},ba.prototype.getClass=function(){return ba};var mg=function(){};mg.prototype.addIntersection=function(e,n){},mg.prototype.interfaces_=function(){return[ba]},mg.prototype.getClass=function(){return mg};var mr=function(){this._nodeList=new Fi(this),this._pts=null,this._data=null;var e=arguments[0],n=arguments[1];this._pts=e,this._data=n};mr.prototype.getCoordinates=function(){return this._pts},mr.prototype.size=function(){return this._pts.length},mr.prototype.getCoordinate=function(e){return this._pts[e]},mr.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},mr.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(e),this.getCoordinate(e+1))},mr.prototype.setData=function(e){this._data=e},mr.prototype.safeOctant=function(e,n){return e.equals2D(n)?0:Ef.octant(e,n)},mr.prototype.getData=function(){return this._data},mr.prototype.addIntersection=function(){if(arguments.length===2){var e=arguments[0],n=arguments[1];this.addIntersectionNode(e,n)}else if(arguments.length===4){var r=arguments[0],i=arguments[1],o=arguments[3],s=new ce(r.getIntersection(o));this.addIntersection(s,i)}},mr.prototype.toString=function(){return ds.toLineString(new gr(this._pts))},mr.prototype.getNodeList=function(){return this._nodeList},mr.prototype.addIntersectionNode=function(e,n){var r=n,i=r+1;if(i=0&&r>=0||n<=0&&r<=0?Math.max(n,r):0}else if(arguments[0]instanceof ce){var i=arguments[0];return Le.orientationIndex(this.p0,this.p1,i)}},Qe.prototype.toGeometry=function(e){return e.createLineString([this.p0,this.p1])},Qe.prototype.isVertical=function(){return this.p0.x===this.p1.x},Qe.prototype.equals=function(e){if(!(e instanceof Qe))return!1;var n=e;return this.p0.equals(n.p0)&&this.p1.equals(n.p1)},Qe.prototype.intersection=function(e){var n=new Xu;return n.computeIntersection(this.p0,this.p1,e.p0,e.p1),n.hasIntersection()?n.getIntersection(0):null},Qe.prototype.project=function(){if(arguments[0]instanceof ce){var e=arguments[0];if(e.equals(this.p0)||e.equals(this.p1))return new ce(e);var n=this.projectionFactor(e),r=new ce;return r.x=this.p0.x+n*(this.p1.x-this.p0.x),r.y=this.p0.y+n*(this.p1.y-this.p0.y),r}else if(arguments[0]instanceof Qe){var i=arguments[0],o=this.projectionFactor(i.p0),s=this.projectionFactor(i.p1);if(o>=1&&s>=1||o<=0&&s<=0)return null;var a=this.project(i.p0);o<0&&(a=this.p0),o>1&&(a=this.p1);var u=this.project(i.p1);return s<0&&(u=this.p0),s>1&&(u=this.p1),new Qe(a,u)}},Qe.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},Qe.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},Qe.prototype.getCoordinate=function(e){return e===0?this.p0:this.p1},Qe.prototype.distancePerpendicular=function(e){return Le.distancePointLinePerpendicular(e,this.p0,this.p1)},Qe.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},Qe.prototype.midPoint=function(){return Qe.midPoint(this.p0,this.p1)},Qe.prototype.projectionFactor=function(e){if(e.equals(this.p0))return 0;if(e.equals(this.p1))return 1;var n=this.p1.x-this.p0.x,r=this.p1.y-this.p0.y,i=n*n+r*r;if(i<=0)return yt.NaN;var o=((e.x-this.p0.x)*n+(e.y-this.p0.y)*r)/i;return o},Qe.prototype.closestPoints=function(e){var n=this.intersection(e);if(n!==null)return[n,n];var r=new Array(2).fill(null),i=yt.MAX_VALUE,o=null,s=this.closestPoint(e.p0);i=s.distance(e.p0),r[0]=s,r[1]=e.p0;var a=this.closestPoint(e.p1);o=a.distance(e.p1),o0&&n<1)return this.project(e);var r=this.p0.distance(e),i=this.p1.distance(e);return r1||yt.isNaN(n))&&(n=1),n},Qe.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},Qe.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},Qe.prototype.distance=function(){if(arguments[0]instanceof Qe){var e=arguments[0];return Le.distanceLineLine(this.p0,this.p1,e.p0,e.p1)}else if(arguments[0]instanceof ce){var n=arguments[0];return Le.distancePointLine(n,this.p0,this.p1)}},Qe.prototype.pointAlong=function(e){var n=new ce;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n},Qe.prototype.hashCode=function(){var e=yt.doubleToLongBits(this.p0.x);e^=yt.doubleToLongBits(this.p0.y)*31;var n=Math.trunc(e)^Math.trunc(e>>32),r=yt.doubleToLongBits(this.p1.x);r^=yt.doubleToLongBits(this.p1.y)*31;var i=Math.trunc(r)^Math.trunc(r>>32);return n^i},Qe.prototype.interfaces_=function(){return[zo,Ho]},Qe.prototype.getClass=function(){return Qe},Qe.midPoint=function(e,n){return new ce((e.x+n.x)/2,(e.y+n.y)/2)},JM.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(Qe,JM);var yg=function(){this.tempEnv1=new Ze,this.tempEnv2=new Ze,this._overlapSeg1=new Qe,this._overlapSeg2=new Qe};yg.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var e=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3];e.getLineSegment(n,this._overlapSeg1),r.getLineSegment(i,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},yg.prototype.interfaces_=function(){return[]},yg.prototype.getClass=function(){return yg};var po=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var e=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3];this._pts=e,this._start=n,this._end=r,this._context=i};po.prototype.getLineSegment=function(e,n){n.p0=this._pts[e],n.p1=this._pts[e+1]},po.prototype.computeSelect=function(e,n,r,i){var o=this._pts[n],s=this._pts[r];if(i.tempEnv1.init(o,s),r-n===1)return i.select(this,n),null;if(!e.intersects(i.tempEnv1))return null;var a=Math.trunc((n+r)/2);n=e.length-1)return e.length-1;for(var i=Dn.quadrant(e[r],e[r+1]),o=n+1;oa.getId()&&(a.computeOverlaps(f,o),i._nOverlaps++),i._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return QM},Object.defineProperties(e,n),e}(vg),QM=function(t){function e(){t.call(this),this._si=null;var n=arguments[0];this._si=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(arguments.length===4){var r=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=r.getContext(),u=o.getContext();this._si.processIntersections(a,i,u,s)}else return t.prototype.overlap.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(yg),hn=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setQuadrantSegments(e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(arguments.length===4){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}}},al={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};hn.prototype.getEndCapStyle=function(){return this._endCapStyle},hn.prototype.isSingleSided=function(){return this._isSingleSided},hn.prototype.setQuadrantSegments=function(e){this._quadrantSegments=e,this._quadrantSegments===0&&(this._joinStyle=hn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=hn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),e<=0&&(this._quadrantSegments=1),this._joinStyle!==hn.JOIN_ROUND&&(this._quadrantSegments=hn.DEFAULT_QUADRANT_SEGMENTS)},hn.prototype.getJoinStyle=function(){return this._joinStyle},hn.prototype.setJoinStyle=function(e){this._joinStyle=e},hn.prototype.setSimplifyFactor=function(e){this._simplifyFactor=e<0?0:e},hn.prototype.getSimplifyFactor=function(){return this._simplifyFactor},hn.prototype.getQuadrantSegments=function(){return this._quadrantSegments},hn.prototype.setEndCapStyle=function(e){this._endCapStyle=e},hn.prototype.getMitreLimit=function(){return this._mitreLimit},hn.prototype.setMitreLimit=function(e){this._mitreLimit=e},hn.prototype.setSingleSided=function(e){this._isSingleSided=e},hn.prototype.interfaces_=function(){return[]},hn.prototype.getClass=function(){return hn},hn.bufferDistanceError=function(e){var n=Math.PI/2/e;return 1-Math.cos(n/2)},al.CAP_ROUND.get=function(){return 1},al.CAP_FLAT.get=function(){return 2},al.CAP_SQUARE.get=function(){return 3},al.JOIN_ROUND.get=function(){return 1},al.JOIN_MITRE.get=function(){return 2},al.JOIN_BEVEL.get=function(){return 3},al.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},al.DEFAULT_MITRE_LIMIT.get=function(){return 5},al.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(hn,al);var ar=function(e){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=Le.COUNTERCLOCKWISE,this._inputLine=e||null},_g={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};ar.prototype.isDeletable=function(e,n,r,i){var o=this._inputLine[e],s=this._inputLine[n],a=this._inputLine[r];return!this.isConcave(o,s,a)||!this.isShallow(o,s,a,i)?!1:this.isShallowSampled(o,s,e,r,i)},ar.prototype.deleteShallowConcavities=function(){for(var e=this,n=1,r=this.findNextNonDeletedIndex(n),i=this.findNextNonDeletedIndex(r),o=!1;i=0;o--)r.addPt(e[o])},Mo.prototype.isRedundant=function(e){if(this._ptList.size()<1)return!1;var n=this._ptList.get(this._ptList.size()-1),r=e.distance(n);return rMath.PI;)e-=Mt.PI_TIMES_2;for(;e<=-Math.PI;)e+=Mt.PI_TIMES_2;return e},Mt.angle=function(){if(arguments.length===1){var e=arguments[0];return Math.atan2(e.y,e.x)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=r.x-n.x,o=r.y-n.y;return Math.atan2(o,i)}},Mt.isAcute=function(e,n,r){var i=e.x-n.x,o=e.y-n.y,s=r.x-n.x,a=r.y-n.y,u=i*s+o*a;return u>0},Mt.isObtuse=function(e,n,r){var i=e.x-n.x,o=e.y-n.y,s=r.x-n.x,a=r.y-n.y,u=i*s+o*a;return u<0},Mt.interiorAngle=function(e,n,r){var i=Mt.angle(n,e),o=Mt.angle(n,r);return Math.abs(o-i)},Mt.normalizePositive=function(e){if(e<0){for(;e<0;)e+=Mt.PI_TIMES_2;e>=Mt.PI_TIMES_2&&(e=0)}else{for(;e>=Mt.PI_TIMES_2;)e-=Mt.PI_TIMES_2;e<0&&(e=0)}return e},Mt.angleBetween=function(e,n,r){var i=Mt.angle(n,e),o=Mt.angle(n,r);return Mt.diff(i,o)},Mt.diff=function(e,n){var r=null;return eMath.PI&&(r=2*Math.PI-r),r},Mt.toRadians=function(e){return e*Math.PI/180},Mt.getTurn=function(e,n){var r=Math.sin(n-e);return r>0?Mt.COUNTERCLOCKWISE:r<0?Mt.CLOCKWISE:Mt.NONE},Mt.angleBetweenOriented=function(e,n,r){var i=Mt.angle(n,e),o=Mt.angle(n,r),s=o-i;return s<=-Math.PI?s+Mt.PI_TIMES_2:s>Math.PI?s-Mt.PI_TIMES_2:s},wf.PI_TIMES_2.get=function(){return 2*Math.PI},wf.PI_OVER_2.get=function(){return Math.PI/2},wf.PI_OVER_4.get=function(){return Math.PI/4},wf.COUNTERCLOCKWISE.get=function(){return Le.COUNTERCLOCKWISE},wf.CLOCKWISE.get=function(){return Le.CLOCKWISE},wf.NONE.get=function(){return Le.COLLINEAR},Object.defineProperties(Mt,wf);var Kn=function t(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Qe,this._seg1=new Qe,this._offset0=new Qe,this._offset1=new Qe,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=e,this._bufParams=n,this._li=new Xu,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===hn.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},bg={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};Kn.prototype.addNextSegment=function(e,n){if(this._s0=this._s1,this._s1=this._s2,this._s2=e,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var r=Le.computeOrientation(this._s0,this._s1,this._s2),i=r===Le.CLOCKWISE&&this._side===Te.LEFT||r===Le.COUNTERCLOCKWISE&&this._side===Te.RIGHT;r===0?this.addCollinear(n):i?this.addOutsideTurn(r,n):this.addInsideTurn(r,n)},Kn.prototype.addLineEndCap=function(e,n){var r=new Qe(e,n),i=new Qe;this.computeOffsetSegment(r,Te.LEFT,this._distance,i);var o=new Qe;this.computeOffsetSegment(r,Te.RIGHT,this._distance,o);var s=n.x-e.x,a=n.y-e.y,u=Math.atan2(a,s);switch(this._bufParams.getEndCapStyle()){case hn.CAP_ROUND:this._segList.addPt(i.p1),this.addFilletArc(n,u+Math.PI/2,u-Math.PI/2,Le.CLOCKWISE,this._distance),this._segList.addPt(o.p1);break;case hn.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(o.p1);break;case hn.CAP_SQUARE:var l=new ce;l.x=Math.abs(this._distance)*Math.cos(u),l.y=Math.abs(this._distance)*Math.sin(u);var f=new ce(i.p1.x+l.x,i.p1.y+l.y),c=new ce(o.p1.x+l.x,o.p1.y+l.y);this._segList.addPt(f),this._segList.addPt(c);break}},Kn.prototype.getCoordinates=function(){var e=this._segList.getCoordinates();return e},Kn.prototype.addMitreJoin=function(e,n,r,i){var o=!0,s=null;try{s=hs.intersection(n.p0,n.p1,r.p0,r.p1);var a=i<=0?1:s.distance(e)/Math.abs(i);a>this._bufParams.getMitreLimit()&&(o=!1)}catch(u){if(u instanceof sd)s=new ce(0,0),o=!1;else throw u}finally{}o?this._segList.addPt(s):this.addLimitedMitreJoin(n,r,i,this._bufParams.getMitreLimit())},Kn.prototype.addFilletCorner=function(e,n,r,i,o){var s=n.x-e.x,a=n.y-e.y,u=Math.atan2(a,s),l=r.x-e.x,f=r.y-e.y,c=Math.atan2(f,l);i===Le.CLOCKWISE?u<=c&&(u+=2*Math.PI):u>=c&&(u-=2*Math.PI),this._segList.addPt(n),this.addFilletArc(e,u,c,i,o),this._segList.addPt(r)},Kn.prototype.addOutsideTurn=function(e,n){if(this._offset0.p1.distance(this._offset1.p0)0){var r=new ce((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r);var i=new ce((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(i)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},Kn.prototype.createCircle=function(e){var n=new ce(e.x+this._distance,e.y);this._segList.addPt(n),this.addFilletArc(e,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},Kn.prototype.addBevelJoin=function(e,n){this._segList.addPt(e.p1),this._segList.addPt(n.p0)},Kn.prototype.init=function(e){this._distance=e,this._maxCurveSegmentError=e*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Mo,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(e*Kn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},Kn.prototype.addCollinear=function(e){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var n=this._li.getIntersectionNum();n>=2&&(this._bufParams.getJoinStyle()===hn.JOIN_BEVEL||this._bufParams.getJoinStyle()===hn.JOIN_MITRE?(e&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,Le.CLOCKWISE,this._distance))},Kn.prototype.closeRing=function(){this._segList.closeRing()},Kn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},Kn.prototype.interfaces_=function(){return[]},Kn.prototype.getClass=function(){return Kn},bg.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},bg.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},bg.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},bg.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(Kn,bg);var Qi=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var e=arguments[0],n=arguments[1];this._precisionModel=e,this._bufParams=n};Qi.prototype.getOffsetCurve=function(e,n){if(this._distance=n,n===0)return null;var r=n<0,i=Math.abs(n),o=this.getSegGen(i);e.length<=1?this.computePointCurve(e[0],o):this.computeOffsetCurve(e,r,o);var s=o.getCoordinates();return r&&Nt.reverse(s),s},Qi.prototype.computeSingleSidedBufferCurve=function(e,n,r){var i=this.simplifyTolerance(this._distance);if(n){r.addSegments(e,!0);var o=ar.simplify(e,-i),s=o.length-1;r.initSideSegments(o[s],o[s-1],Te.LEFT),r.addFirstSegment();for(var a=s-2;a>=0;a--)r.addNextSegment(o[a],!0)}else{r.addSegments(e,!1);var u=ar.simplify(e,i),l=u.length-1;r.initSideSegments(u[0],u[1],Te.LEFT),r.addFirstSegment();for(var f=2;f<=l;f++)r.addNextSegment(u[f],!0)}r.addLastSegment(),r.closeRing()},Qi.prototype.computeRingBufferCurve=function(e,n,r){var i=this.simplifyTolerance(this._distance);n===Te.RIGHT&&(i=-i);var o=ar.simplify(e,i),s=o.length-1;r.initSideSegments(o[s-1],o[0],n);for(var a=1;a<=s;a++){var u=a!==1;r.addNextSegment(o[a],u)}r.closeRing()},Qi.prototype.computeLineBufferCurve=function(e,n){var r=this.simplifyTolerance(this._distance),i=ar.simplify(e,r),o=i.length-1;n.initSideSegments(i[0],i[1],Te.LEFT);for(var s=2;s<=o;s++)n.addNextSegment(i[s],!0);n.addLastSegment(),n.addLineEndCap(i[o-1],i[o]);var a=ar.simplify(e,-r),u=a.length-1;n.initSideSegments(a[u],a[u-1],Te.LEFT);for(var l=u-2;l>=0;l--)n.addNextSegment(a[l],!0);n.addLastSegment(),n.addLineEndCap(a[1],a[0]),n.closeRing()},Qi.prototype.computePointCurve=function(e,n){switch(this._bufParams.getEndCapStyle()){case hn.CAP_ROUND:n.createCircle(e);break;case hn.CAP_SQUARE:n.createSquare(e);break}},Qi.prototype.getLineCurve=function(e,n){if(this._distance=n,n<0&&!this._bufParams.isSingleSided()||n===0)return null;var r=Math.abs(n),i=this.getSegGen(r);if(e.length<=1)this.computePointCurve(e[0],i);else if(this._bufParams.isSingleSided()){var o=n<0;this.computeSingleSidedBufferCurve(e,o,i)}else this.computeLineBufferCurve(e,i);var s=i.getCoordinates();return s},Qi.prototype.getBufferParameters=function(){return this._bufParams},Qi.prototype.simplifyTolerance=function(e){return e*this._bufParams.getSimplifyFactor()},Qi.prototype.getRingCurve=function(e,n,r){if(this._distance=r,e.length<=2)return this.getLineCurve(e,r);if(r===0)return Qi.copyCoordinates(e);var i=this.getSegGen(r);return this.computeRingBufferCurve(e,n,i),i.getCoordinates()},Qi.prototype.computeOffsetCurve=function(e,n,r){var i=this.simplifyTolerance(this._distance);if(n){var o=ar.simplify(e,-i),s=o.length-1;r.initSideSegments(o[s],o[s-1],Te.LEFT),r.addFirstSegment();for(var a=s-2;a>=0;a--)r.addNextSegment(o[a],!0)}else{var u=ar.simplify(e,i),l=u.length-1;r.initSideSegments(u[0],u[1],Te.LEFT),r.addFirstSegment();for(var f=2;f<=l;f++)r.addNextSegment(u[f],!0)}r.addLastSegment()},Qi.prototype.getSegGen=function(e){return new Kn(this._precisionModel,this._bufParams,e)},Qi.prototype.interfaces_=function(){return[]},Qi.prototype.getClass=function(){return Qi},Qi.copyCoordinates=function(e){for(var n=new Array(e.length).fill(null),r=0;rs.getMaxY()||e.findStabbedSegments(n,o.getDirectedEdges(),r)}return r}else if(arguments.length===3){if(st(arguments[2],ps)&&arguments[0]instanceof ce&&arguments[1]instanceof sw)for(var a=arguments[0],u=arguments[1],l=arguments[2],f=u.getEdge().getCoordinates(),c=0;ce._seg.p1.y&&e._seg.reverse();var h=Math.max(e._seg.p0.x,e._seg.p1.x);if(!(he._seg.p1.y)&&Le.computeOrientation(e._seg.p0,e._seg.p1,a)!==Le.RIGHT){var d=u.getDepth(Te.LEFT);e._seg.p0.equals(f[c])||(d=u.getDepth(Te.RIGHT));var g=new ec(e._seg,d);l.add(g)}}else if(st(arguments[2],ps)&&arguments[0]instanceof ce&&st(arguments[1],ps))for(var y=arguments[0],b=arguments[1],_=arguments[2],p=b.iterator();p.hasNext();){var m=p.next();m.isForward()&&e.findStabbedSegments(y,m,_)}}},xf.prototype.getDepth=function(e){var n=this.findStabbedSegments(e);if(n.size()===0)return 0;var r=vs.min(n);return r._leftDepth},xf.prototype.interfaces_=function(){return[]},xf.prototype.getClass=function(){return xf},tk.DepthSegment.get=function(){return ec},Object.defineProperties(xf,tk);var ec=function(){this._upwardSeg=null,this._leftDepth=null;var e=arguments[0],n=arguments[1];this._upwardSeg=new Qe(e),this._leftDepth=n};ec.prototype.compareTo=function(e){var n=e;if(this._upwardSeg.minX()>=n._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=n._upwardSeg.minX())return-1;var r=this._upwardSeg.orientationIndex(n._upwardSeg);return r!==0||(r=-1*n._upwardSeg.orientationIndex(this._upwardSeg),r!==0)?r:this._upwardSeg.compareTo(n._upwardSeg)},ec.prototype.compareX=function(e,n){var r=e.p0.compareTo(n.p0);return r!==0?r:e.p1.compareTo(n.p1)},ec.prototype.toString=function(){return this._upwardSeg.toString()},ec.prototype.interfaces_=function(){return[zo]},ec.prototype.getClass=function(){return ec};var dn=function(e,n,r){this.p0=e||null,this.p1=n||null,this.p2=r||null};dn.prototype.area=function(){return dn.area(this.p0,this.p1,this.p2)},dn.prototype.signedArea=function(){return dn.signedArea(this.p0,this.p1,this.p2)},dn.prototype.interpolateZ=function(e){if(e===null)throw new tr("Supplied point is null.");return dn.interpolateZ(e,this.p0,this.p1,this.p2)},dn.prototype.longestSideLength=function(){return dn.longestSideLength(this.p0,this.p1,this.p2)},dn.prototype.isAcute=function(){return dn.isAcute(this.p0,this.p1,this.p2)},dn.prototype.circumcentre=function(){return dn.circumcentre(this.p0,this.p1,this.p2)},dn.prototype.area3D=function(){return dn.area3D(this.p0,this.p1,this.p2)},dn.prototype.centroid=function(){return dn.centroid(this.p0,this.p1,this.p2)},dn.prototype.inCentre=function(){return dn.inCentre(this.p0,this.p1,this.p2)},dn.prototype.interfaces_=function(){return[]},dn.prototype.getClass=function(){return dn},dn.area=function(e,n,r){return Math.abs(((r.x-e.x)*(n.y-e.y)-(n.x-e.x)*(r.y-e.y))/2)},dn.signedArea=function(e,n,r){return((r.x-e.x)*(n.y-e.y)-(n.x-e.x)*(r.y-e.y))/2},dn.det=function(e,n,r,i){return e*i-n*r},dn.interpolateZ=function(e,n,r,i){var o=n.x,s=n.y,a=r.x-o,u=i.x-o,l=r.y-s,f=i.y-s,c=a*f-u*l,h=e.x-o,d=e.y-s,g=(f*h-u*d)/c,y=(-l*h+a*d)/c,b=n.z+g*(r.z-n.z)+y*(i.z-n.z);return b},dn.longestSideLength=function(e,n,r){var i=e.distance(n),o=n.distance(r),s=r.distance(e),a=i;return o>a&&(a=o),s>a&&(a=s),a},dn.isAcute=function(e,n,r){return!(!Mt.isAcute(e,n,r)||!Mt.isAcute(n,r,e)||!Mt.isAcute(r,e,n))},dn.circumcentre=function(e,n,r){var i=r.x,o=r.y,s=e.x-i,a=e.y-o,u=n.x-i,l=n.y-o,f=2*dn.det(s,a,u,l),c=dn.det(a,s*s+a*a,l,u*u+l*l),h=dn.det(s,s*s+a*a,u,u*u+l*l),d=i-c/f,g=o+h/f;return new ce(d,g)},dn.perpendicularBisector=function(e,n){var r=n.x-e.x,i=n.y-e.y,o=new hs(e.x+r/2,e.y+i/2,1),s=new hs(e.x-i+r/2,e.y+r+i/2,1);return new hs(o,s)},dn.angleBisector=function(e,n,r){var i=n.distance(e),o=n.distance(r),s=i/(i+o),a=r.x-e.x,u=r.y-e.y,l=new ce(e.x+s*a,e.y+s*u);return l},dn.area3D=function(e,n,r){var i=n.x-e.x,o=n.y-e.y,s=n.z-e.z,a=r.x-e.x,u=r.y-e.y,l=r.z-e.z,f=o*l-s*u,c=s*a-i*l,h=i*u-o*a,d=f*f+c*c+h*h,g=Math.sqrt(d)/2;return g},dn.centroid=function(e,n,r){var i=(e.x+n.x+r.x)/3,o=(e.y+n.y+r.y)/3;return new ce(i,o)},dn.inCentre=function(e,n,r){var i=n.distance(r),o=e.distance(r),s=e.distance(n),a=i+o+s,u=(i*e.x+o*n.x+s*r.x)/a,l=(i*e.y+o*n.y+s*r.y)/a;return new ce(u,l)};var Ko=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new Pe;var e=arguments[0],n=arguments[1],r=arguments[2];this._inputGeom=e,this._distance=n,this._curveBuilder=r};Ko.prototype.addPoint=function(e){if(this._distance<=0)return null;var n=e.getCoordinates(),r=this._curveBuilder.getLineCurve(n,this._distance);this.addCurve(r,me.EXTERIOR,me.INTERIOR)},Ko.prototype.addPolygon=function(e){var n=this,r=this._distance,i=Te.LEFT;this._distance<0&&(r=-this._distance,i=Te.RIGHT);var o=e.getExteriorRing(),s=Nt.removeRepeatedPoints(o.getCoordinates());if(this._distance<0&&this.isErodedCompletely(o,this._distance)||this._distance<=0&&s.length<3)return null;this.addPolygonRing(s,r,i,me.EXTERIOR,me.INTERIOR);for(var a=0;a0&&n.isErodedCompletely(u,-n._distance)||n.addPolygonRing(l,r,Te.opposite(i),me.INTERIOR,me.EXTERIOR)}},Ko.prototype.isTriangleErodedCompletely=function(e,n){var r=new dn(e[0],e[1],e[2]),i=r.inCentre(),o=Le.distancePointLine(i,r.p0,r.p1);return o=ya.MINIMUM_VALID_SIZE&&Le.isCCW(e)&&(s=o,a=i,r=Te.opposite(r));var u=this._curveBuilder.getRingCurve(e,r,n);this.addCurve(u,s,a)},Ko.prototype.add=function(e){if(e.isEmpty())return null;e instanceof Mr?this.addPolygon(e):e instanceof sr?this.addLineString(e):e instanceof fo?this.addPoint(e):e instanceof gd?this.addCollection(e):e instanceof Ju?this.addCollection(e):e instanceof va?this.addCollection(e):e instanceof Di&&this.addCollection(e)},Ko.prototype.isErodedCompletely=function(e,n){var r=e.getCoordinates();if(r.length<4)return n<0;if(r.length===4)return this.isTriangleErodedCompletely(r,n);var i=e.getEnvelopeInternal(),o=Math.min(i.getHeight(),i.getWidth());return n<0&&2*Math.abs(n)>o},Ko.prototype.addCollection=function(e){for(var n=this,r=0;r=this._max)throw new dd;var e=this._parent.getGeometryN(this._index++);return e instanceof Di?(this._subcollectionIterator=new Ea(e),this._subcollectionIterator.next()):e},Ea.prototype.remove=function(){throw new Error(this.getClass().getName())},Ea.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},Ea.prototype.interfaces_=function(){return[hd]},Ea.prototype.getClass=function(){return Ea},Ea.isAtomic=function(e){return!(e instanceof Di)};var ko=function(){this._geom=null;var e=arguments[0];this._geom=e};ko.prototype.locate=function(e){return ko.locate(e,this._geom)},ko.prototype.interfaces_=function(){return[_d]},ko.prototype.getClass=function(){return ko},ko.isPointInRing=function(e,n){return n.getEnvelopeInternal().intersects(e)?Le.isPointInRing(e,n.getCoordinates()):!1},ko.containsPointInPolygon=function(e,n){if(n.isEmpty())return!1;var r=n.getExteriorRing();if(!ko.isPointInRing(e,r))return!1;for(var i=0;i=0;s--){var a=r._edgeList.get(s),u=a.getSym();o===null&&(o=u),i!==null&&u.setNext(i),i=a}o.setNext(i)},e.prototype.computeDepths=function(){var r=this;if(arguments.length===1){var i=arguments[0],o=this.findIndex(i),s=i.getDepth(Te.LEFT),a=i.getDepth(Te.RIGHT),u=this.computeDepths(o+1,this._edgeList.size(),s),l=this.computeDepths(0,o,u);if(l!==a)throw new ol("depth mismatch at "+i.getCoordinate())}else if(arguments.length===3){for(var f=arguments[0],c=arguments[1],h=arguments[2],d=h,g=f;g=0;u--){var l=i._resultAreaEdgeList.get(u),f=l.getSym();switch(o===null&&l.getEdgeRing()===r&&(o=l),a){case i._SCANNING_FOR_INCOMING:if(f.getEdgeRing()!==r)continue;s=f,a=i._LINKING_TO_OUTGOING;break;case i._LINKING_TO_OUTGOING:if(l.getEdgeRing()!==r)continue;s.setNextMin(l),a=i._SCANNING_FOR_INCOMING;break}}a===this._LINKING_TO_OUTGOING&&(_t.isTrue(o!==null,"found null for first outgoing dirEdge"),_t.isTrue(o.getEdgeRing()===r,"unable to link last incoming dirEdge"),s.setNextMin(o))},e.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var r=0,i=this.iterator();i.hasNext();){var o=i.next();o.isInResult()&&r++}return r}else if(arguments.length===1){for(var s=arguments[0],a=0,u=this.iterator();u.hasNext();){var l=u.next();l.getEdgeRing()===s&&a++}return a}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var r=me.NONE,i=this.iterator();i.hasNext();){var o=i.next(),s=o.getSym();if(!o.isLineEdge()){if(o.isInResult()){r=me.INTERIOR;break}if(s.isInResult()){r=me.EXTERIOR;break}}}if(r===me.NONE)return null;for(var a=r,u=this.iterator();u.hasNext();){var l=u.next(),f=l.getSym();l.isLineEdge()?l.getEdge().setCovered(a===me.INTERIOR):(l.isInResult()&&(a=me.EXTERIOR),f.isInResult()&&(a=me.INTERIOR))}},e.prototype.computeLabelling=function(r){var i=this;t.prototype.computeLabelling.call(this,r),this._label=new Sn(me.NONE);for(var o=this.iterator();o.hasNext();)for(var s=o.next(),a=s.getEdge(),u=a.getLabel(),l=0;l<2;l++){var f=u.getLocation(l);(f===me.INTERIOR||f===me.BOUNDARY)&&i._label.setLocation(l,me.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ei),nk=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(r){return new qv(r,new gY)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(md),iu=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};iu.prototype.compareTo=function(e){var n=e,r=iu.compareOriented(this._pts,this._orientation,n._pts,n._orientation);return r},iu.prototype.interfaces_=function(){return[zo]},iu.prototype.getClass=function(){return iu},iu.orientation=function(e){return Nt.increasingDirection(e)===1},iu.compareOriented=function(e,n,r,i){for(var o=n?1:-1,s=i?1:-1,a=n?e.length:-1,u=i?r.length:-1,l=n?0:e.length-1,f=i?0:r.length-1;;){var c=e[l].compareTo(r[f]);if(c!==0)return c;l+=o,f+=s;var h=l===a,d=f===u;if(h&&!d)return-1;if(!h&&d)return 1;if(h&&d)return 0}};var _s=function(){this._edges=new Pe,this._ocaMap=new _i};_s.prototype.print=function(e){var n=this;e.print("MULTILINESTRING ( ");for(var r=0;r0&&e.print(","),e.print("(");for(var o=i.getCoordinates(),s=0;s0&&e.print(","),e.print(o[s].x+" "+o[s].y);e.println(")")}e.print(") ")},_s.prototype.addAll=function(e){for(var n=this,r=e.iterator();r.hasNext();)n.add(r.next())},_s.prototype.findEdgeIndex=function(e){for(var n=this,r=0;r0||!n.coord.equals2D(o);s||i--;var a=new Array(i).fill(null),u=0;a[u++]=new ce(e.coord);for(var l=e.segmentIndex+1;l<=n.segmentIndex;l++)a[u++]=r.edge.pts[l];return s&&(a[u]=n.coord),new zv(a,new Sn(this.edge._label))},wa.prototype.add=function(e,n,r){var i=new Xs(e,n,r),o=this._nodeMap.get(i);return o!==null?o:(this._nodeMap.put(i,i),i)},wa.prototype.isIntersection=function(e){for(var n=this.iterator();n.hasNext();){var r=n.next();if(r.coord.equals(e))return!0}return!1},wa.prototype.interfaces_=function(){return[]},wa.prototype.getClass=function(){return wa};var nc=function(){};nc.prototype.getChainStartIndices=function(e){var n=this,r=0,i=new Pe;i.add(new Bs(r));do{var o=n.findChainEnd(e,r);i.add(new Bs(o)),r=o}while(rr?n:r},ll.prototype.getMinX=function(e){var n=this.pts[this.startIndex[e]].x,r=this.pts[this.startIndex[e+1]].x;return nr&&(o=1),e._depth[n][i]=o}}},ai.prototype.getDelta=function(e){return this._depth[e][Te.RIGHT]-this._depth[e][Te.LEFT]},ai.prototype.getLocation=function(e,n){return this._depth[e][n]<=0?me.EXTERIOR:me.INTERIOR},ai.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},ai.prototype.add=function(){var e=this;if(arguments.length===1)for(var n=arguments[0],r=0;r<2;r++)for(var i=1;i<3;i++){var o=n.getLocation(r,i);(o===me.EXTERIOR||o===me.INTERIOR)&&(e.isNull(r,i)?e._depth[r][i]=ai.depthAtLocation(o):e._depth[r][i]+=ai.depthAtLocation(o))}else if(arguments.length===3){var s=arguments[0],a=arguments[1],u=arguments[2];u===me.INTERIOR&&this._depth[s][a]++}},ai.prototype.interfaces_=function(){return[]},ai.prototype.getClass=function(){return ai},ai.depthAtLocation=function(e){return e===me.EXTERIOR?0:e===me.INTERIOR?1:ai.NULL_VALUE},rk.NULL_VALUE.get=function(){return-1},Object.defineProperties(ai,rk);var zv=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new wa(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new ai,this._depthDelta=0,arguments.length===1){var n=arguments[0];e.call(this,n,null)}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var r=new Array(2).fill(null);r[0]=this.pts[0],r[1]=this.pts[1];var i=new e(r,Sn.toLineLabel(this._label));return i},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(r){this._isIsolated=r},e.prototype.setName=function(r){this._name=r},e.prototype.equals=function(r){var i=this;if(!(r instanceof e))return!1;var o=r;if(this.pts.length!==o.pts.length)return!1;for(var s=!0,a=!0,u=this.pts.length,l=0;l0?this.pts[0]:null;if(arguments.length===1){var r=arguments[0];return this.pts[r]}},e.prototype.print=function(r){var i=this;r.print("edge "+this._name+": "),r.print("LINESTRING (");for(var o=0;o0&&r.print(","),r.print(i.pts[o].x+" "+i.pts[o].y);r.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(r){e.updateIM(this._label,r)},e.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(r){var i=this;r.print("edge "+this._name+": ");for(var o=this.pts.length-1;o>=0;o--)r.print(i.pts[o]+" ");r.println("")},e.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new ll(this)),this._mce},e.prototype.getEnvelope=function(){var r=this;if(this._env===null){this._env=new Ze;for(var i=0;i0&&i.append(","),i.append(r.pts[o].x+" "+r.pts[o].y);return i.append(") "+this._label+" "+this._depthDelta),i.toString()},e.prototype.isPointwiseEqual=function(r){var i=this;if(this.pts.length!==r.pts.length)return!1;for(var o=0;oi||this._maxys;if(a)return!1;var u=this.intersectsToleranceSquare(e,n);return _t.isTrue(!(a&&u),"Found bad envelope test"),u},eo.prototype.initCorners=function(e){var n=.5;this._minx=e.x-n,this._maxx=e.x+n,this._miny=e.y-n,this._maxy=e.y+n,this._corner[0]=new ce(this._maxx,this._maxy),this._corner[1]=new ce(this._minx,this._maxy),this._corner[2]=new ce(this._minx,this._miny),this._corner[3]=new ce(this._maxx,this._miny)},eo.prototype.intersects=function(e,n){return this._scaleFactor===1?this.intersectsScaled(e,n):(this.copyScaled(e,this._p0Scaled),this.copyScaled(n,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},eo.prototype.scale=function(e){return Math.round(e*this._scaleFactor)},eo.prototype.getCoordinate=function(){return this._originalPt},eo.prototype.copyScaled=function(e,n){n.x=this.scale(e.x),n.y=this.scale(e.y)},eo.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var e=eo.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Ze(this._originalPt.x-e,this._originalPt.x+e,this._originalPt.y-e,this._originalPt.y+e)}return this._safeEnv},eo.prototype.intersectsPixelClosure=function(e,n){return this._li.computeIntersection(e,n,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(e,n,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(e,n,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(e,n,this._corner[3],this._corner[0]),this._li.hasIntersection()))},eo.prototype.intersectsToleranceSquare=function(e,n){var r=!1,i=!1;return this._li.computeIntersection(e,n,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(e,n,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(e,n,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(e,n,this._corner[3],this._corner[0]),this._li.isProper())||r&&i||e.equals(this._pt)||n.equals(this._pt))},eo.prototype.addSnappedNode=function(e,n){var r=e.getCoordinate(n),i=e.getCoordinate(n+1);return this.intersects(r,i)?(e.addIntersection(this.getCoordinate(),n),!0):!1},eo.prototype.interfaces_=function(){return[]},eo.prototype.getClass=function(){return eo},ok.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(eo,ok);var Eg=function(){this.tempEnv1=new Ze,this.selectedSegment=new Qe};Eg.prototype.select=function(){if(arguments.length!==1){if(arguments.length===2){var e=arguments[0],n=arguments[1];e.getLineSegment(n,this.selectedSegment),this.select(this.selectedSegment)}}},Eg.prototype.interfaces_=function(){return[]},Eg.prototype.getClass=function(){return Eg};var bd=function(){this._index=null;var e=arguments[0];this._index=e},sk={HotPixelSnapAction:{configurable:!0}};bd.prototype.snap=function(){if(arguments.length===1){var e=arguments[0];return this.snap(e,null,-1)}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2],o=n.getSafeEnvelope(),s=new ak(n,r,i);return this._index.query(o,{interfaces_:function(){return[nu]},visitItem:function(a){var u=a;u.select(o,s)}}),s.isNodeAdded()}},bd.prototype.interfaces_=function(){return[]},bd.prototype.getClass=function(){return bd},sk.HotPixelSnapAction.get=function(){return ak},Object.defineProperties(bd,sk);var ak=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],r=arguments[1],i=arguments[2];this._hotPixel=n,this._parentEdge=r,this._hotPixelVertexIndex=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1],o=r.getContext();if(this._parentEdge!==null&&o===this._parentEdge&&i===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(o,i)}else return t.prototype.select.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Eg),Sf=function(){this._li=null,this._interiorIntersections=null;var e=arguments[0];this._li=e,this._interiorIntersections=new Pe};Sf.prototype.processIntersections=function(e,n,r,i){var o=this;if(e===r&&n===i)return null;var s=e.getCoordinates()[n],a=e.getCoordinates()[n+1],u=r.getCoordinates()[i],l=r.getCoordinates()[i+1];if(this._li.computeIntersection(s,a,u,l),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var f=0;f=0;n--){try{e.bufferReducedPrecision(n)}catch(s){if(s instanceof ol)e._saveException=s;else throw s}finally{}if(e._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var r=arguments[0],i=li.precisionScaleFactor(this._argGeom,this._distance,r),o=new fn(i);this.bufferFixedPrecision(o)}},li.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var e=this._argGeom.getFactory().getPrecisionModel();e.getType()===fn.FIXED?this.bufferFixedPrecision(e):this.bufferReducedPrecision()},li.prototype.setQuadrantSegments=function(e){this._bufParams.setQuadrantSegments(e)},li.prototype.bufferOriginalPrecision=function(){try{var e=new Bi(this._bufParams);this._resultGeometry=e.buffer(this._argGeom,this._distance)}catch(n){if(n instanceof Qa)this._saveException=n;else throw n}finally{}},li.prototype.getResultGeometry=function(e){return this._distance=e,this.computeGeometry(),this._resultGeometry},li.prototype.setEndCapStyle=function(e){this._bufParams.setEndCapStyle(e)},li.prototype.interfaces_=function(){return[]},li.prototype.getClass=function(){return li},li.bufferOp=function(){if(arguments.length===2){var e=arguments[0],n=arguments[1],r=new li(e),i=r.getResultGeometry(n);return i}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof ot&&typeof arguments[1]=="number"){var o=arguments[0],s=arguments[1],a=arguments[2],u=new li(o);u.setQuadrantSegments(a);var l=u.getResultGeometry(s);return l}else if(arguments[2]instanceof hn&&arguments[0]instanceof ot&&typeof arguments[1]=="number"){var f=arguments[0],c=arguments[1],h=arguments[2],d=new li(f,h),g=d.getResultGeometry(c);return g}}else if(arguments.length===4){var y=arguments[0],b=arguments[1],_=arguments[2],p=arguments[3],m=new li(y);m.setQuadrantSegments(_),m.setEndCapStyle(p);var v=m.getResultGeometry(b);return v}},li.precisionScaleFactor=function(e,n,r){var i=e.getEnvelopeInternal(),o=To.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY())),s=n>0?n:0,a=o+2*s,u=Math.trunc(Math.log(a)/Math.log(10)+1),l=r-u,f=Math.pow(10,l);return f},Ed.CAP_ROUND.get=function(){return hn.CAP_ROUND},Ed.CAP_BUTT.get=function(){return hn.CAP_FLAT},Ed.CAP_FLAT.get=function(){return hn.CAP_FLAT},Ed.CAP_SQUARE.get=function(){return hn.CAP_SQUARE},Ed.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(li,Ed);var Vi=function(){this._pt=[new ce,new ce],this._distance=yt.NaN,this._isNull=!0};Vi.prototype.getCoordinates=function(){return this._pt},Vi.prototype.getCoordinate=function(e){return this._pt[e]},Vi.prototype.setMinimum=function(){if(arguments.length===1){var e=arguments[0];this.setMinimum(e._pt[0],e._pt[1])}else if(arguments.length===2){var n=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(n,r),null;var i=n.distance(r);ithis._distance&&this.initialize(n,r,i)}},Vi.prototype.interfaces_=function(){return[]},Vi.prototype.getClass=function(){return Vi};var Sa=function(){};Sa.prototype.interfaces_=function(){return[]},Sa.prototype.getClass=function(){return Sa},Sa.computeDistance=function(){if(arguments[2]instanceof Vi&&arguments[0]instanceof sr&&arguments[1]instanceof ce)for(var e=arguments[0],n=arguments[1],r=arguments[2],i=e.getCoordinates(),o=new Qe,s=0;s0||this._isIn?me.INTERIOR:me.EXTERIOR)},bs.prototype.interfaces_=function(){return[]},bs.prototype.getClass=function(){return bs};var $i=function t(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var e=arguments[0],n=arguments[1];t.call(this,e,t.INSIDE_AREA,n)}else if(arguments.length===3){var r=arguments[0],i=arguments[1],o=arguments[2];this._component=r,this._segIndex=i,this._pt=o}},lk={INSIDE_AREA:{configurable:!0}};$i.prototype.isInsideArea=function(){return this._segIndex===$i.INSIDE_AREA},$i.prototype.getCoordinate=function(){return this._pt},$i.prototype.getGeometryComponent=function(){return this._component},$i.prototype.getSegmentIndex=function(){return this._segIndex},$i.prototype.interfaces_=function(){return[]},$i.prototype.getClass=function(){return $i},lk.INSIDE_AREA.get=function(){return-1},Object.defineProperties($i,lk);var au=function(e){this._pts=e||null};au.prototype.filter=function(e){e instanceof fo&&this._pts.add(e)},au.prototype.interfaces_=function(){return[qs]},au.prototype.getClass=function(){return au},au.getPoints=function(){if(arguments.length===1){var e=arguments[0];return e instanceof fo?vs.singletonList(e):au.getPoints(e,new Pe)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return n instanceof fo?r.add(n):n instanceof Di&&n.apply(new au(r)),r}};var Nf=function(){this._locations=null;var e=arguments[0];this._locations=e};Nf.prototype.filter=function(e){(e instanceof fo||e instanceof sr||e instanceof Mr)&&this._locations.add(new $i(e,0,e.getCoordinate()))},Nf.prototype.interfaces_=function(){return[qs]},Nf.prototype.getClass=function(){return Nf},Nf.getLocations=function(e){var n=new Pe;return e.apply(new Nf(n)),n};var ci=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new bs,this._minDistanceLocation=null,this._minDistance=yt.MAX_VALUE,arguments.length===2){var e=arguments[0],n=arguments[1];this._geom=[e,n],this._terminateDistance=0}else if(arguments.length===3){var r=arguments[0],i=arguments[1],o=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=i,this._terminateDistance=o}};ci.prototype.computeContainmentDistance=function(){var e=this;if(arguments.length===0){var n=new Array(2).fill(null);if(this.computeContainmentDistance(0,n),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,n)}else if(arguments.length===2){var r=arguments[0],i=arguments[1],o=1-r,s=ul.getPolygons(this._geom[r]);if(s.size()>0){var a=Nf.getLocations(this._geom[o]);if(this.computeContainmentDistance(a,s,i),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[o]=i[0],this._minDistanceLocation[r]=i[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&st(arguments[0],ps)&&st(arguments[1],ps)){for(var u=arguments[0],l=arguments[1],f=arguments[2],c=0;cthis._minDistance)return null;for(var o=n.getCoordinates(),s=r.getCoordinate(),a=0;athis._minDistance)return null;for(var g=c.getCoordinates(),y=h.getCoordinates(),b=0;bthis._distance&&this.initialize(n,r,i)}},wi.prototype.interfaces_=function(){return[]},wi.prototype.getClass=function(){return wi};var Zs=function(){};Zs.prototype.interfaces_=function(){return[]},Zs.prototype.getClass=function(){return Zs},Zs.computeDistance=function(){if(arguments[2]instanceof wi&&arguments[0]instanceof sr&&arguments[1]instanceof ce)for(var e=arguments[0],n=arguments[1],r=arguments[2],i=new Qe,o=e.getCoordinates(),s=0;s1||e<=0)throw new tr("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=e},Zo.prototype.compute=function(e,n){this.computeOrientedDistance(e,n,this._ptDist),this.computeOrientedDistance(n,e,this._ptDist)},Zo.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Zo.prototype.computeOrientedDistance=function(e,n,r){var i=new Of(n);if(e.apply(i),r.setMaximum(i.getMaxPointDistance()),this._densifyFrac>0){var o=new lu(n,this._densifyFrac);e.apply(o),r.setMaximum(o.getMaxPointDistance())}},Zo.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Zo.prototype.interfaces_=function(){return[]},Zo.prototype.getClass=function(){return Zo},Zo.distance=function(){if(arguments.length===2){var e=arguments[0],n=arguments[1],r=new Zo(e,n);return r.distance()}else if(arguments.length===3){var i=arguments[0],o=arguments[1],s=arguments[2],a=new Zo(i,o);return a.setDensifyFraction(s),a.distance()}},uw.MaxPointDistanceFilter.get=function(){return Of},uw.MaxDensifiedByFractionDistanceFilter.get=function(){return lu},Object.defineProperties(Zo,uw);var Of=function(){this._maxPtDist=new wi,this._minPtDist=new wi,this._euclideanDist=new Zs,this._geom=null;var e=arguments[0];this._geom=e};Of.prototype.filter=function(e){this._minPtDist.initialize(),Zs.computeDistance(this._geom,e,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Of.prototype.getMaxPointDistance=function(){return this._maxPtDist},Of.prototype.interfaces_=function(){return[ma]},Of.prototype.getClass=function(){return Of};var lu=function(){this._maxPtDist=new wi,this._minPtDist=new wi,this._geom=null,this._numSubSegs=0;var e=arguments[0],n=arguments[1];this._geom=e,this._numSubSegs=Math.trunc(Math.round(1/n))};lu.prototype.filter=function(e,n){var r=this;if(n===0)return null;for(var i=e.getCoordinate(n-1),o=e.getCoordinate(n),s=(o.x-i.x)/this._numSubSegs,a=(o.y-i.y)/this._numSubSegs,u=0;ur){this._isValid=!1;var o=i.getCoordinates();this._errorLocation=o[1],this._errorIndicator=e.getFactory().createLineString(o),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+ds.toLineString(o[0],o[1])+")"}},go.prototype.isValid=function(){var e=Math.abs(this._bufDistance),n=go.MAX_DISTANCE_DIFF_FRAC*e;return this._minValidDistance=e-n,this._maxValidDistance=e+n,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),go.VERBOSE&&si.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},go.prototype.checkNegativeValid=function(){if(!(this._input instanceof Mr||this._input instanceof va||this._input instanceof Di))return null;var e=this.getPolygonLines(this._input);if(this.checkMinimumDistance(e,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(e,this._result,this._maxValidDistance)},go.prototype.getErrorIndicator=function(){return this._errorIndicator},go.prototype.checkMinimumDistance=function(e,n,r){var i=new ci(e,n,r);if(this._minDistanceFound=i.distance(),this._minDistanceFound0&&e>n&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&e=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")},fi.prototype.report=function(e){if(!fi.VERBOSE)return null;si.out.println("Check "+e+": "+(this._isValid?"passed":"FAILED"))},fi.prototype.getErrorMessage=function(){return this._errorMsg},fi.prototype.interfaces_=function(){return[]},fi.prototype.getClass=function(){return fi},fi.isValidMsg=function(e,n,r){var i=new fi(e,n,r);return i.isValid()?null:i.getErrorMessage()},fi.isValid=function(e,n,r){var i=new fi(e,n,r);return!!i.isValid()},fw.VERBOSE.get=function(){return!1},fw.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(fi,fw);var Js=function(){this._pts=null,this._data=null;var e=arguments[0],n=arguments[1];this._pts=e,this._data=n};Js.prototype.getCoordinates=function(){return this._pts},Js.prototype.size=function(){return this._pts.length},Js.prototype.getCoordinate=function(e){return this._pts[e]},Js.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Js.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:Ef.octant(this.getCoordinate(e),this.getCoordinate(e+1))},Js.prototype.setData=function(e){this._data=e},Js.prototype.getData=function(){return this._data},Js.prototype.toString=function(){return ds.toLineString(new gr(this._pts))},Js.prototype.interfaces_=function(){return[ba]},Js.prototype.getClass=function(){return Js};var Gr=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new Pe,this._intersectionCount=0,this._keepIntersections=!0;var e=arguments[0];this._li=e,this._interiorIntersection=null};Gr.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Gr.prototype.setCheckEndSegmentsOnly=function(e){this._isCheckEndSegmentsOnly=e},Gr.prototype.getIntersectionSegments=function(){return this._intSegments},Gr.prototype.count=function(){return this._intersectionCount},Gr.prototype.getIntersections=function(){return this._intersections},Gr.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e},Gr.prototype.setKeepIntersections=function(e){this._keepIntersections=e},Gr.prototype.processIntersections=function(e,n,r,i){if(!this._findAllIntersections&&this.hasIntersection()||e===r&&n===i)return null;if(this._isCheckEndSegmentsOnly){var o=this.isEndSegment(e,n)||this.isEndSegment(r,i);if(!o)return null}var s=e.getCoordinates()[n],a=e.getCoordinates()[n+1],u=r.getCoordinates()[i],l=r.getCoordinates()[i+1];this._li.computeIntersection(s,a,u,l),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=s,this._intSegments[1]=a,this._intSegments[2]=u,this._intSegments[3]=l,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},Gr.prototype.isEndSegment=function(e,n){return n===0||n>=e.size()-2},Gr.prototype.hasIntersection=function(){return this._interiorIntersection!==null},Gr.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null},Gr.prototype.interfaces_=function(){return[tc]},Gr.prototype.getClass=function(){return Gr},Gr.createAllIntersectionsFinder=function(e){var n=new Gr(e);return n.setFindAllIntersections(!0),n},Gr.createAnyIntersectionFinder=function(e){return new Gr(e)},Gr.createIntersectionCounter=function(e){var n=new Gr(e);return n.setFindAllIntersections(!0),n.setKeepIntersections(!1),n};var Es=function(){this._li=new Xu,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var e=arguments[0];this._segStrings=e};Es.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},Es.prototype.getIntersections=function(){return this._segInt.getIntersections()},Es.prototype.isValid=function(){return this.execute(),this._isValid},Es.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e},Es.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Gr(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var e=new aw;if(e.setSegmentIntersector(this._segInt),e.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Es.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new ol(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Es.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var e=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+ds.toLineString(e[0],e[1])+" and "+ds.toLineString(e[2],e[3])},Es.prototype.interfaces_=function(){return[]},Es.prototype.getClass=function(){return Es},Es.computeIntersections=function(e){var n=new Es(e);return n.setFindAllIntersections(!0),n.isValid(),n.getIntersections()};var ic=function t(){this._nv=null;var e=arguments[0];this._nv=new Es(t.toSegmentStrings(e))};ic.prototype.checkValid=function(){this._nv.checkValid()},ic.prototype.interfaces_=function(){return[]},ic.prototype.getClass=function(){return ic},ic.toSegmentStrings=function(e){for(var n=new Pe,r=e.iterator();r.hasNext();){var i=r.next();n.add(new Js(i.getCoordinates(),i))}return n},ic.checkValid=function(e){var n=new ic(e);n.checkValid()};var Tf=function(e){this._mapOp=e};Tf.prototype.map=function(e){for(var n=this,r=new Pe,i=0;i0&&i<4&&!this._preserveType?this._factory.createLineString(r):this._factory.createLinearRing(r)},to.prototype.interfaces_=function(){return[]},to.prototype.getClass=function(){return to};var Ca=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Qe,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof sr&&typeof arguments[1]=="number"){var e=arguments[0],n=arguments[1];t.call(this,e.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=i}};Ca.prototype.snapVertices=function(e,n){for(var r=this,i=this._isClosed?e.size()-1:e.size(),o=0;o=0&&e.add(a+1,new ce(s),!1)}},Ca.prototype.findSegmentIndexToSnap=function(e,n){for(var r=this,i=yt.MAX_VALUE,o=-1,s=0;sn&&(n=i)}return n}else if(arguments.length===2){var o=arguments[0],s=arguments[1];return Math.min(yr.computeOverlaySnapTolerance(o),yr.computeOverlaySnapTolerance(s))}},yr.computeSizeBasedSnapTolerance=function(e){var n=e.getEnvelopeInternal(),r=Math.min(n.getHeight(),n.getWidth()),i=r*yr.SNAP_PRECISION_FACTOR;return i},yr.snapToSelf=function(e,n,r){var i=new yr(e);return i.snapToSelf(n,r)},uk.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(yr,uk);var ck=function(t){function e(n,r,i){t.call(this),this._snapTolerance=n||null,this._snapPts=r||null,this._isSelfSnap=i!==void 0?i:!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(r,i){var o=new Ca(r,this._snapTolerance);return o.setAllowSnappingToSourceVertices(this._isSelfSnap),o.snapTo(i)},e.prototype.transformCoordinates=function(r,i){var o=r.toCoordinateArray(),s=this.snapLine(o,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(s)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(to),ji=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};ji.prototype.getCommon=function(){return yt.longBitsToDouble(this._commonBits)},ji.prototype.add=function(e){var n=yt.doubleToLongBits(e);if(this._isFirst)return this._commonBits=n,this._commonSignExp=ji.signExpBits(this._commonBits),this._isFirst=!1,null;var r=ji.signExpBits(n);if(r!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=ji.numCommonMostSigMantissaBits(this._commonBits,n),this._commonBits=ji.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},ji.prototype.toString=function(){if(arguments.length===1){var e=arguments[0],n=yt.longBitsToDouble(e),r=yt.toBinaryString(e),i="0000000000000000000000000000000000000000000000000000000000000000"+r,o=i.substring(i.length-64),s=o.substring(0,1)+" "+o.substring(1,12)+"(exp) "+o.substring(12)+" [ "+n+" ]";return s}},ji.prototype.interfaces_=function(){return[]},ji.prototype.getClass=function(){return ji},ji.getBit=function(e,n){var r=1<>52},ji.zeroLowerBits=function(e,n){var r=(1<=0;i--){if(ji.getBit(e,i)!==ji.getBit(n,i))return r;r++}return 52};var uu=function(){this._commonCoord=null,this._ccFilter=new Mf},hw={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};uu.prototype.addCommonBits=function(e){var n=new cu(this._commonCoord);e.apply(n),e.geometryChanged()},uu.prototype.removeCommonBits=function(e){if(this._commonCoord.x===0&&this._commonCoord.y===0)return e;var n=new ce(this._commonCoord);n.x=-n.x,n.y=-n.y;var r=new cu(n);return e.apply(r),e.geometryChanged(),e},uu.prototype.getCommonCoordinate=function(){return this._commonCoord},uu.prototype.add=function(e){e.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},uu.prototype.interfaces_=function(){return[]},uu.prototype.getClass=function(){return uu},hw.CommonCoordinateFilter.get=function(){return Mf},hw.Translater.get=function(){return cu},Object.defineProperties(uu,hw);var Mf=function(){this._commonBitsX=new ji,this._commonBitsY=new ji};Mf.prototype.filter=function(e){this._commonBitsX.add(e.x),this._commonBitsY.add(e.y)},Mf.prototype.getCommonCoordinate=function(){return new ce(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Mf.prototype.interfaces_=function(){return[ma]},Mf.prototype.getClass=function(){return Mf};var cu=function(){this.trans=null;var e=arguments[0];this.trans=e};cu.prototype.filter=function(e,n){var r=e.getOrdinate(n,0)+this.trans.x,i=e.getOrdinate(n,1)+this.trans.y;e.setOrdinate(n,0,r),e.setOrdinate(n,1,i)},cu.prototype.isDone=function(){return!1},cu.prototype.isGeometryChanged=function(){return!0},cu.prototype.interfaces_=function(){return[ms]},cu.prototype.getClass=function(){return cu};var Yr=function(e,n){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=e,this._geom[1]=n,this.computeSnapTolerance()};Yr.prototype.selfSnap=function(e){var n=new yr(e),r=n.snapTo(e,this._snapTolerance);return r},Yr.prototype.removeCommonBits=function(e){this._cbr=new uu,this._cbr.add(e[0]),this._cbr.add(e[1]);var n=new Array(2).fill(null);return n[0]=this._cbr.removeCommonBits(e[0].copy()),n[1]=this._cbr.removeCommonBits(e[1].copy()),n},Yr.prototype.prepareResult=function(e){return this._cbr.addCommonBits(e),e},Yr.prototype.getResultGeometry=function(e){var n=this.snap(this._geom),r=vt.overlayOp(n[0],n[1],e);return this.prepareResult(r)},Yr.prototype.checkValid=function(e){e.isValid()||si.out.println("Snapped geometry is invalid")},Yr.prototype.computeSnapTolerance=function(){this._snapTolerance=yr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},Yr.prototype.snap=function(e){var n=this.removeCommonBits(e),r=yr.snap(n[0],n[1],this._snapTolerance);return r},Yr.prototype.interfaces_=function(){return[]},Yr.prototype.getClass=function(){return Yr},Yr.overlayOp=function(e,n,r){var i=new Yr(e,n);return i.getResultGeometry(r)},Yr.union=function(e,n){return Yr.overlayOp(e,n,vt.UNION)},Yr.intersection=function(e,n){return Yr.overlayOp(e,n,vt.INTERSECTION)},Yr.symDifference=function(e,n){return Yr.overlayOp(e,n,vt.SYMDIFFERENCE)},Yr.difference=function(e,n){return Yr.overlayOp(e,n,vt.DIFFERENCE)};var qi=function(e,n){this._geom=new Array(2).fill(null),this._geom[0]=e,this._geom[1]=n};qi.prototype.getResultGeometry=function(e){var n=null,r=!1,i=null;try{n=vt.overlayOp(this._geom[0],this._geom[1],e);var o=!0;o&&(r=!0)}catch(s){if(s instanceof Qa)i=s;else throw s}finally{}if(!r)try{n=Yr.overlayOp(this._geom[0],this._geom[1],e)}catch(s){throw s instanceof Qa?i:s}finally{}return n},qi.prototype.interfaces_=function(){return[]},qi.prototype.getClass=function(){return qi},qi.overlayOp=function(e,n,r){var i=new qi(e,n);return i.getResultGeometry(r)},qi.union=function(e,n){return qi.overlayOp(e,n,vt.UNION)},qi.intersection=function(e,n){return qi.overlayOp(e,n,vt.INTERSECTION)},qi.symDifference=function(e,n){return qi.overlayOp(e,n,vt.SYMDIFFERENCE)},qi.difference=function(e,n){return qi.overlayOp(e,n,vt.DIFFERENCE)};var wg=function(){this.mce=null,this.chainIndex=null;var e=arguments[0],n=arguments[1];this.mce=e,this.chainIndex=n};wg.prototype.computeIntersections=function(e,n){this.mce.computeIntersectsForChain(this.chainIndex,e.mce,e.chainIndex,n)},wg.prototype.interfaces_=function(){return[]},wg.prototype.getClass=function(){return wg};var mo=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var e=arguments[0],n=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=r,this._xValue=i,this._obj=o}},dw={INSERT:{configurable:!0},DELETE:{configurable:!0}};mo.prototype.isDelete=function(){return this._eventType===mo.DELETE},mo.prototype.setDeleteEventIndex=function(e){this._deleteEventIndex=e},mo.prototype.getObject=function(){return this._obj},mo.prototype.compareTo=function(e){var n=e;return this._xValuen._xValue?1:this._eventTypen._eventType?1:0},mo.prototype.getInsertEvent=function(){return this._insertEvent},mo.prototype.isInsert=function(){return this._eventType===mo.INSERT},mo.prototype.isSameLabel=function(e){return this._label===null?!1:this._label===e._label},mo.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},mo.prototype.interfaces_=function(){return[zo]},mo.prototype.getClass=function(){return mo},dw.INSERT.get=function(){return 1},dw.DELETE.get=function(){return 2},Object.defineProperties(mo,dw);var Hv=function(){};Hv.prototype.interfaces_=function(){return[]},Hv.prototype.getClass=function(){return Hv};var hi=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._li=e,this._includeProper=n,this._recordIsolated=r};hi.prototype.isTrivialIntersection=function(e,n,r,i){if(e===r&&this._li.getIntersectionNum()===1){if(hi.isAdjacentSegments(n,i))return!0;if(e.isClosed()){var o=e.getNumPoints()-1;if(n===0&&i===o||i===0&&n===o)return!0}}return!1},hi.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},hi.prototype.setIsDoneIfProperInt=function(e){this._isDoneWhenProperInt=e},hi.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},hi.prototype.isBoundaryPointInternal=function(e,n){for(var r=n.iterator();r.hasNext();){var i=r.next(),o=i.getCoordinate();if(e.isIntersection(o))return!0}return!1},hi.prototype.hasProperIntersection=function(){return this._hasProper},hi.prototype.hasIntersection=function(){return this._hasIntersection},hi.prototype.isDone=function(){return this._isDone},hi.prototype.isBoundaryPoint=function(e,n){return n===null?!1:!!(this.isBoundaryPointInternal(e,n[0])||this.isBoundaryPointInternal(e,n[1]))},hi.prototype.setBoundaryNodes=function(e,n){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=e,this._bdyNodes[1]=n},hi.prototype.addIntersections=function(e,n,r,i){if(e===r&&n===i)return null;this.numTests++;var o=e.getCoordinates()[n],s=e.getCoordinates()[n+1],a=r.getCoordinates()[i],u=r.getCoordinates()[i+1];this._li.computeIntersection(o,s,a,u),this._li.hasIntersection()&&(this._recordIsolated&&(e.setIsolated(!1),r.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(e,n,r,i)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(e.addIntersections(this._li,n,0),r.addIntersections(this._li,i,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},hi.prototype.interfaces_=function(){return[]},hi.prototype.getClass=function(){return hi},hi.isAdjacentSegments=function(e,n){return Math.abs(e-n)===1};var mY=function(t){function e(){t.call(this),this.events=new Pe,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){var r=this;vs.sort(this.events);for(var i=0;in||this._maxs?1:0},xg.prototype.interfaces_=function(){return[id]},xg.prototype.getClass=function(){return xg};var yY=function(t){function e(){t.call(this),this._item=null;var n=arguments[0],r=arguments[1],i=arguments[2];this._min=n,this._max=r,this._item=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(r,i,o){if(!this.intersects(r,i))return null;o.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Na),vY=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var n=arguments[0],r=arguments[1];this._node1=n,this._node2=r,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(r,i){this._min=Math.min(r._min,i._min),this._max=Math.max(r._max,i._max)},e.prototype.query=function(r,i,o){if(!this.intersects(r,i))return null;this._node1!==null&&this._node1.query(r,i,o),this._node2!==null&&this._node2.query(r,i,o)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Na),Oa=function(){this._leaves=new Pe,this._root=null,this._level=0};Oa.prototype.buildTree=function(){var e=this;vs.sort(this._leaves,new Na.NodeComparator);for(var n=this._leaves,r=null,i=new Pe;;){if(e.buildLevel(n,i),i.size()===1)return i.get(0);r=n,n=i,i=r}},Oa.prototype.insert=function(e,n,r){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new yY(e,n,r))},Oa.prototype.query=function(e,n,r){this.init(),this._root.query(e,n,r)},Oa.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},Oa.prototype.printNode=function(e){si.out.println(ds.toLineString(new ce(e._min,this._level),new ce(e._max,this._level)))},Oa.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},Oa.prototype.buildLevel=function(e,n){this._level++,n.clear();for(var r=0;r=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,i[0]),this.insertBoundaryPoint(this._argIndex,i[i.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var r=this.getBoundaryNodes(),i=new Array(r.size()).fill(null),o=0,s=r.iterator();s.hasNext();){var a=s.next();i[o++]=a.getCoordinate().copy()}return i},e.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(r,i,o){if(this.isBoundaryNode(r,i))return null;o===me.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(r,i):this.insertPoint(r,i,o)},e.prototype.addPolygonRing=function(r,i,o){if(r.isEmpty())return null;var s=Nt.removeRepeatedPoints(r.getCoordinates());if(s.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=s[0],null;var a=i,u=o;Le.isCCW(s)&&(a=o,u=i);var l=new zv(s,new Sn(this._argIndex,me.BOUNDARY,a,u));this._lineEdgeMap.put(r,l),this.insertEdge(l),this.insertPoint(this._argIndex,s[0],me.BOUNDARY)},e.prototype.insertPoint=function(r,i,o){var s=this._nodes.addNode(i),a=s.getLabel();a===null?s._label=new Sn(r,o):a.setLocation(r,o)},e.prototype.createEdgeSetIntersector=function(){return new mY},e.prototype.addSelfIntersectionNodes=function(r){for(var i=this,o=this._edges.iterator();o.hasNext();)for(var s=o.next(),a=s.getLabel().getLocation(r),u=s.eiList.iterator();u.hasNext();){var l=u.next();i.addSelfIntersectionNode(r,l.coord,a)}},e.prototype.add=function(){if(arguments.length===1){var r=arguments[0];if(r.isEmpty())return null;if(r instanceof va&&(this._useBoundaryDeterminationRule=!1),r instanceof Mr)this.addPolygon(r);else if(r instanceof sr)this.addLineString(r);else if(r instanceof fo)this.addPoint(r);else if(r instanceof gd)this.addCollection(r);else if(r instanceof Ju)this.addCollection(r);else if(r instanceof va)this.addCollection(r);else if(r instanceof Di)this.addCollection(r);else throw new Error(r.getClass().getName())}else return t.prototype.add.apply(this,arguments)},e.prototype.addCollection=function(r){for(var i=this,o=0;o50?(this._areaPtLocator===null&&(this._areaPtLocator=new xd(this._parentGeom)),this._areaPtLocator.locate(r)):this._ptLocator.locate(r,this._parentGeom)},e.prototype.findEdge=function(){if(arguments.length===1){var r=arguments[0];return this._lineEdgeMap.get(r)}else return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(r,i){return r.isInBoundary(i)?me.BOUNDARY:me.INTERIOR},e}(rr),Cd=function(){if(this._li=new Xu,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var e=arguments[0];this.setComputationPrecision(e.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new Sg(0,e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=Go.OGC_SFS_BOUNDARY_RULE;n.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(n.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Sg(0,n,i),this._arg[1]=new Sg(1,r,i)}else if(arguments.length===3){var o=arguments[0],s=arguments[1],a=arguments[2];o.getPrecisionModel().compareTo(s.getPrecisionModel())>=0?this.setComputationPrecision(o.getPrecisionModel()):this.setComputationPrecision(s.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Sg(0,o,a),this._arg[1]=new Sg(1,s,a)}};Cd.prototype.getArgGeometry=function(e){return this._arg[e].getGeometry()},Cd.prototype.setComputationPrecision=function(e){this._resultPrecisionModel=e,this._li.setPrecisionModel(this._resultPrecisionModel)},Cd.prototype.interfaces_=function(){return[]},Cd.prototype.getClass=function(){return Cd};var sc=function(){};sc.prototype.interfaces_=function(){return[]},sc.prototype.getClass=function(){return sc},sc.map=function(){if(arguments[0]instanceof ot&&st(arguments[1],sc.MapOp)){for(var e=arguments[0],n=arguments[1],r=new Pe,i=0;i=e.size()?null:e.get(n)},Nr.union=function(e){var n=new Nr(e);return n.union()},dk.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Nr,dk);var Gv=function(){};Gv.prototype.interfaces_=function(){return[]},Gv.prototype.getClass=function(){return Gv},Gv.union=function(e,n){if(e.isEmpty()||n.isEmpty()){if(e.isEmpty()&&n.isEmpty())return vt.createEmptyResult(vt.UNION,e,n,e.getFactory());if(e.isEmpty())return n.copy();if(n.isEmpty())return e.copy()}return e.checkNotGeometryCollection(e),e.checkNotGeometryCollection(n),qi.overlayOp(e,n,vt.UNION)};function lc(){return new Yv}function Yv(){this.reset()}Yv.prototype={constructor:Yv,reset:function(){this.s=this.t=0},add:function(t){pk(Wv,t,this.t),pk(this,Wv.s,this.s),this.s?this.t+=Wv.t:this.s=Wv.t},valueOf:function(){return this.s}};var Wv=new Yv;function pk(t,e,n){var r=t.s=e+n,i=r-e,o=r-i;t.t=e-o+(n-i)}var lr=1e-6,$n=Math.PI,cl=$n/2,gk=$n/4,fl=$n*2,uc=180/$n,ea=$n/180,Ui=Math.abs,_Y=Math.atan,Od=Math.atan2,Pr=Math.cos,Ar=Math.sin,Td=Math.sqrt;function mk(t){return t>1?0:t<-1?$n:Math.acos(t)}function kf(t){return t>1?cl:t<-1?-cl:Math.asin(t)}function Cg(){}function Xv(t,e){t&&vk.hasOwnProperty(t.type)&&vk[t.type](t,e)}var yk={Feature:function(t,e){Xv(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r$n?t-fl:t<-$n?t+fl:t,e]}_w.invert=_w;function EY(t,e,n){return(t%=fl)?e||n?bk(wk(t),xk(e,n)):wk(t):e||n?xk(e,n):_w}function Ek(t){return function(e,n){return e+=t,[e>$n?e-fl:e<-$n?e+fl:e,n]}}function wk(t){var e=Ek(t);return e.invert=Ek(-t),e}function xk(t,e){var n=Pr(t),r=Ar(t),i=Pr(e),o=Ar(e);function s(a,u){var l=Pr(u),f=Pr(a)*l,c=Ar(a)*l,h=Ar(u),d=h*n+f*r;return[Od(c*i-d*o,f*n-h*r),kf(d*i+c*o)]}return s.invert=function(a,u){var l=Pr(u),f=Pr(a)*l,c=Ar(a)*l,h=Ar(u),d=h*i-c*o;return[Od(c*i+h*o,f*n+d*r),kf(d*n-f*r)]},s}function wY(t,e,n,r,i,o){if(n){var s=Pr(e),a=Ar(e),u=r*n;i==null?(i=e+r*fl,o=e-u/2):(i=Sk(s,i),o=Sk(s,o),(r>0?io)&&(i+=r*fl));for(var l,f=i;r>0?f>o:f1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function xY(t,e,n,r,i,o){var s=t[0],a=t[1],u=e[0],l=e[1],f=0,c=1,h=u-s,d=l-a,g;if(g=n-s,!(!h&&g>0)){if(g/=h,h<0){if(g0){if(g>c)return;g>f&&(f=g)}if(g=i-s,!(!h&&g<0)){if(g/=h,h<0){if(g>c)return;g>f&&(f=g)}else if(h>0){if(g0)){if(g/=d,d<0){if(g0){if(g>c)return;g>f&&(f=g)}if(g=o-a,!(!d&&g<0)){if(g/=d,d<0){if(g>c)return;g>f&&(f=g)}else if(d>0){if(g0&&(t[0]=s+f*h,t[1]=a+f*d),c<1&&(e[0]=s+c*h,e[1]=a+c*d),!0}}}}}function Qv(t,e){return Ui(t[0]-e[0])=0;--a)i.point((c=f[a])[0],c[1]);else r(h.x,h.p.x,-1,i);h=h.p}h=h.o,f=h.z,d=!d}while(!h.v);i.lineEnd()}}}function Ok(t){if(e=t.length){for(var e,n=0,r=t[0],i;++ne?1:t>=e?0:NaN}function SY(t){return t.length===1&&(t=CY(t)),{left:function(e,n,r,i){for(r==null&&(r=0),i==null&&(i=e.length);r>>1;t(e[o],n)<0?r=o+1:i=o}return r},right:function(e,n,r,i){for(r==null&&(r=0),i==null&&(i=e.length);r>>1;t(e[o],n)>0?i=o:r=o+1}return r}}}function CY(t){return function(e,n){return Tk(t(e),n)}}SY(Tk);function Ik(t){for(var e=t.length,n,r=-1,i=0,o,s;++r=0;)for(s=t[e],n=s.length;--n>=0;)o[--i]=s[n];return o}var Ng=1e9,t0=-Ng;function NY(t,e,n,r){function i(l,f){return t<=l&&l<=n&&e<=f&&f<=r}function o(l,f,c,h){var d=0,g=0;if(l==null||(d=s(l,c))!==(g=s(f,c))||u(l,f)<0^c>0)do h.point(d===0||d===3?t:n,d>1?r:e);while((d=(d+c+4)%4)!==g);else h.point(f[0],f[1])}function s(l,f){return Ui(l[0]-t)0?0:3:Ui(l[0]-n)0?2:1:Ui(l[1]-e)0?1:0:f>0?3:2}function a(l,f){return u(l.x,f.x)}function u(l,f){var c=s(l,1),h=s(f,1);return c!==h?c-h:c===0?f[1]-l[1]:c===1?l[0]-f[0]:c===2?l[1]-f[1]:f[0]-l[0]}return function(l){var f=l,c=Ck(),h,d,g,y,b,_,p,m,v,w,N,S={point:C,lineStart:I,lineEnd:A,polygonStart:M,polygonEnd:T};function C(B,$){i(B,$)&&f.point(B,$)}function O(){for(var B=0,$=0,G=d.length;$r&&(ee-j)*(r-z)>(X-z)*(t-j)&&++B:X<=r&&(ee-j)*(r-z)<(X-z)*(t-j)&&--B;return B}function M(){f=c,h=[],d=[],N=!0}function T(){var B=O(),$=N&&B,G=(h=Ik(h)).length;($||G)&&(l.polygonStart(),$&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),G&&Nk(h,a,B,o,l),l.polygonEnd()),f=l,h=d=g=null}function I(){S.point=L,d&&d.push(g=[]),w=!0,v=!1,p=m=NaN}function A(){h&&(L(y,b),_&&v&&c.rejoin(),h.push(c.result())),S.point=C,v&&f.lineEnd()}function L(B,$){var G=i(B,$);if(d&&g.push([B,$]),w)y=B,b=$,_=G,w=!1,G&&(f.lineStart(),f.point(B,$));else if(G&&v)f.point(B,$);else{var J=[p=Math.max(t0,Math.min(Ng,p)),m=Math.max(t0,Math.min(Ng,m))],W=[B=Math.max(t0,Math.min(Ng,B)),$=Math.max(t0,Math.min(Ng,$))];xY(J,W,t,e,n,r)?(v||(f.lineStart(),f.point(J[0],J[1])),f.point(W[0],W[1]),G||f.lineEnd(),N=!1):G&&(f.lineStart(),f.point(B,$),N=!1)}p=B,m=$,v=G}return S}}var bw=lc();function OY(t,e){var n=e[0],r=e[1],i=[Ar(n),-Pr(n),0],o=0,s=0;bw.reset();for(var a=0,u=t.length;a=0?1:-1,C=S*N,O=C>$n,M=g*v;if(bw.add(Od(M*S*Ar(C),y*w+M*Pr(C))),o+=O?N+S*fl:N,O^h>=n^p>=n){var T=Zv(Id(c),Id(_));vw(T);var I=Zv(i,T);vw(I);var A=(O^N>=0?-1:1)*kf(I[2]);(r>A||r===A&&(T[0]||T[1]))&&(s+=O^N>=0?1:-1)}}return(o<-lr||oOg&&(Og=t),er0&&(r0=e)}lc();function Pk(t,e,n,r){return function(i,o){var s=e(o),a=i.invert(r[0],r[1]),u=Ck(),l=e(u),f=!1,c,h,d,g={point:y,lineStart:_,lineEnd:p,polygonStart:function(){g.point=m,g.lineStart=v,g.lineEnd=w,h=[],c=[]},polygonEnd:function(){g.point=y,g.lineStart=_,g.lineEnd=p,h=Ik(h);var N=OY(c,a);h.length?(f||(o.polygonStart(),f=!0),Nk(h,MY,N,n,o)):N&&(f||(o.polygonStart(),f=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),f&&(o.polygonEnd(),f=!1),h=c=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function y(N,S){var C=i(N,S);t(N=C[0],S=C[1])&&o.point(N,S)}function b(N,S){var C=i(N,S);s.point(C[0],C[1])}function _(){g.point=b,s.lineStart()}function p(){g.point=y,s.lineEnd()}function m(N,S){d.push([N,S]);var C=i(N,S);l.point(C[0],C[1])}function v(){l.lineStart(),d=[]}function w(){m(d[0][0],d[0][1]),l.lineEnd();var N=l.clean(),S=u.result(),C,O=S.length,M,T,I;if(d.pop(),c.push(d),d=null,!!O){if(N&1){if(T=S[0],(M=T.length-1)>0){for(f||(o.polygonStart(),f=!0),o.lineStart(),C=0;C1&&N&2&&S.push(S.pop().concat(S.shift())),h.push(S.filter(IY))}}return g}}function IY(t){return t.length>1}function MY(t,e){return((t=t.x)[0]<0?t[1]-cl-lr:cl-t[1])-((e=e.x)[0]<0?e[1]-cl-lr:cl-e[1])}const Ak=Pk(function(){return!0},kY,AY,[-$n,-cl]);function kY(t){var e=NaN,n=NaN,r=NaN,i;return{lineStart:function(){t.lineStart(),i=1},point:function(o,s){var a=o>0?$n:-$n,u=Ui(o-e);Ui(u-$n)0?cl:-cl),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(o,n),i=0):r!==a&&u>=$n&&(Ui(e-r)lr?_Y((Ar(e)*(o=Pr(r))*Ar(n)-Ar(r)*(i=Pr(e))*Ar(t))/(i*o*s)):(e+r)/2}function AY(t,e,n,r){var i;if(t==null)i=n*cl,r.point(-$n,i),r.point(0,i),r.point($n,i),r.point($n,0),r.point($n,-i),r.point(0,-i),r.point(-$n,-i),r.point(-$n,0),r.point(-$n,i);else if(Ui(t[0]-e[0])>lr){var o=t[0]0,i=Ui(n)>lr;function o(f,c,h,d){wY(d,t,e,h,f,c)}function s(f,c){return Pr(f)*Pr(c)>n}function a(f){var c,h,d,g,y;return{lineStart:function(){g=d=!1,y=1},point:function(b,_){var p=[b,_],m,v=s(b,_),w=r?v?0:l(b,_):v?l(b+(b<0?$n:-$n),_):0;if(!c&&(g=d=v)&&f.lineStart(),v!==d&&(m=u(c,p),(!m||Qv(c,m)||Qv(p,m))&&(p[0]+=lr,p[1]+=lr,v=s(p[0],p[1]))),v!==d)y=0,v?(f.lineStart(),m=u(p,c),f.point(m[0],m[1])):(m=u(c,p),f.point(m[0],m[1]),f.lineEnd()),c=m;else if(i&&c&&r^v){var N;!(w&h)&&(N=u(p,c,!0))&&(y=0,r?(f.lineStart(),f.point(N[0][0],N[0][1]),f.point(N[1][0],N[1][1]),f.lineEnd()):(f.point(N[1][0],N[1][1]),f.lineEnd(),f.lineStart(),f.point(N[0][0],N[0][1])))}v&&(!c||!Qv(c,p))&&f.point(p[0],p[1]),c=p,d=v,h=w},lineEnd:function(){d&&f.lineEnd(),c=null},clean:function(){return y|(g&&d)<<1}}}function u(f,c,h){var d=Id(f),g=Id(c),y=[1,0,0],b=Zv(d,g),_=Kv(b,b),p=b[0],m=_-p*p;if(!m)return!h&&f;var v=n*_/m,w=-n*p/m,N=Zv(y,b),S=Jv(y,v),C=Jv(b,w);yw(S,C);var O=N,M=Kv(S,O),T=Kv(O,O),I=M*M-T*(Kv(S,S)-1);if(!(I<0)){var A=Td(I),L=Jv(O,(-M-A)/T);if(yw(L,S),L=mw(L),!h)return L;var B=f[0],$=c[0],G=f[1],J=c[1],W;$0^L[1]<(Ui(L[0]-B)$n^(B<=L[0]&&L[0]<=$)){var z=Jv(O,(-M+A)/T);return yw(z,S),[L,mw(z)]}}}function l(f,c){var h=r?t:$n-t,d=0;return f<-h?d|=1:f>h&&(d|=2),c<-h?d|=4:c>h&&(d|=8),d}return Pk(s,a,o,r?[0,-t]:[-$n,t-$n])}function Lk(t){return function(e){var n=new Ew;for(var r in t)n[r]=t[r];return n.stream=e,n}}function Ew(){}Ew.prototype={constructor:Ew,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function Dk(t,e,n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),o!=null&&t.clipExtent(null),bY(n,t.stream(kk));var s=kk.result(),a=Math.min(r/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),u=+e[0][0]+(r-a*(s[1][0]+s[0][0]))/2,l=+e[0][1]+(i-a*(s[1][1]+s[0][1]))/2;return o!=null&&t.clipExtent(o),t.scale(a*150).translate([u,l])}function DY(t,e,n){return Dk(t,[[0,0],e],n)}var Rk=16,RY=Pr(30*ea);function Fk(t,e){return+e?BY(t,e):FY(t)}function FY(t){return Lk({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function BY(t,e){function n(r,i,o,s,a,u,l,f,c,h,d,g,y,b){var _=l-r,p=f-i,m=_*_+p*p;if(m>4*e&&y--){var v=s+h,w=a+d,N=u+g,S=Td(v*v+w*w+N*N),C=kf(N/=S),O=Ui(Ui(N)-1)e||Ui((_*A+p*L)/m-.5)>.3||s*h+a*d+u*g2?L[2]%360*ea:0,I()):[l*uc,f*uc,c*uc]},O.precision=function(L){return arguments.length?(N=Fk(T,w=L*L),A()):Td(w)},O.fitExtent=function(L,B){return Dk(O,L,B)},O.fitSize=function(L,B){return DY(O,L,B)};function I(){d=bk(h=EY(l,f,c),e);var L=e(a,u);return o=r-L[0]*n,s=i+L[1]*n,A()}function A(){return S=C=null,O}return function(){return e=t.apply(this,arguments),O.invert=e.invert&&M,I()}}function Bk(t){return function(e,n){var r=Pr(e),i=Pr(n),o=t(r*i);return[o*i*Ar(e),o*Ar(n)]}}function Vk(t){return function(e,n){var r=Td(e*e+n*n),i=t(r),o=Ar(i),s=Pr(i);return[Od(e*o,r*s),kf(r&&n*o/r)]}}var qY=Bk(function(t){return Td(2/(1+t))});qY.invert=Vk(function(t){return 2*kf(t/2)});var $k=Bk(function(t){return(t=mk(t))&&t/Ar(t)});$k.invert=Vk(function(t){return t});function UY(){return $Y($k).scale(79.4188).clipAngle(180-.001)}function jk(t,e){return[t,e]}jk.invert=jk;function zY(t,e,n){n=n||{};var r=n.units||"kilometers",i=n.steps||8;if(!t)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof i!="number")throw new Error("steps must be an number");if(e===void 0)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var o=[];switch(t.type){case"GeometryCollection":return qo(t,function(s){var a=i0(s,e,r,i);a&&o.push(a)}),ft(o);case"FeatureCollection":return vn(t,function(s){var a=i0(s,e,r,i);a&&vn(a,function(u){u&&o.push(u)})}),ft(o)}return i0(t,e,r,i)}function i0(t,e,n,r){var i=t.properties||{},o=t.type==="Feature"?t.geometry:t;if(o.type==="GeometryCollection"){var s=[];return qo(t,function(y){var b=i0(y,e,n,r);b&&s.push(b)}),ft(s)}var a=HY(o),u={type:o.type,coordinates:Uk(o.coordinates,a)},l=new ow,f=l.read(u),c=Fh(nf(e,n),"meters"),h=li.bufferOp(f,c,r),d=new WM;if(h=d.write(h),!qk(h.coordinates)){var g={type:h.type,coordinates:zk(h.coordinates,a)};return zr(g,i)}}function qk(t){return Array.isArray(t[0])?qk(t[0]):isNaN(t[0])}function Uk(t,e){return typeof t[0]!="object"?e(t):t.map(function(n){return Uk(n,e)})}function zk(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(n){return zk(n,e)})}function HY(t){var e=qh(t).geometry.coordinates,n=[-e[0],-e[1]];return UY().rotate(n).scale(ri)}function GY(t,e,n){n===void 0&&(n={});var r=Wn(t),i=Wn(e),o=Ql.union(r.coordinates,i.coordinates);return o.length===0?null:o.length===1?It(o[0],n.properties):jo(o,n.properties)}function Tg(t,e,n){n===void 0&&(n={});var r=Wn(t),i=Wn(e),o=Ql.intersection(r.coordinates,i.coordinates);return o.length===0?null:o.length===1?It(o[0],n.properties):jo(o,n.properties)}function YY(t,e){if(e=e||{},!An(e))throw new Error("options is invalid");var n=e.propertyName;Wl(t,"Polygon","dissolve");var r=[];if(e.propertyName){var i={};vn(t,function(u){Object.prototype.hasOwnProperty.call(i,u.properties[n])||(i[u.properties[n]]=[]),i[u.properties[n]].push(u)});for(var o=Object.keys(i),s=0;sb/2;M&&(O-=b/4);for(var T=[],I=[],A=0;A<6;A++){var L=2*Math.PI/6*A;T.push(Math.cos(L)),I.push(Math.sin(L))}for(var B=[],$=0;$<=N;$++)for(var G=0;G<=C;G++){var J=$%2===1;if(!(G===0&&J)&&!(G===0&&M)){var W=$*m+i-S,V=G*v+o+O;if(J&&(V-=b/2),n.triangles===!0)XY([W,V],c/2,d/2,JSON.parse(r),T,I).forEach(function(j){n.mask?Tg(n.mask,j)&&B.push(j):B.push(j)});else{var D=WY([W,V],c/2,d/2,JSON.parse(r),T,I);n.mask?Tg(n.mask,D)&&B.push(D):B.push(D)}}}return ft(B)}function WY(t,e,n,r,i,o){for(var s=[],a=0;a<6;a++){var u=t[0]+e*i[a],l=t[1]+n*o[a];s.push([u,l])}return s.push(s[0].slice()),It([s],r)}function XY(t,e,n,r,i,o){for(var s=[],a=0;a<6;a++){var u=[];u.push(t),u.push([t[0]+e*i[a],t[1]+n*o[a]]),u.push([t[0]+e*i[(a+1)%6],t[1]+n*o[(a+1)%6]]),u.push(t),s.push(It([u],r))}return s}function KY(t,e){var n=JY(e),r=null;return t.type==="FeatureCollection"?r=ZY(t):r=Gk(Ql.union(t.geometry.coordinates)),r.geometry.coordinates.forEach(function(i){n.geometry.coordinates.push(i[0])}),n}function ZY(t){var e=t.features.length===2?Ql.union(t.features[0].geometry.coordinates,t.features[1].geometry.coordinates):Ql.union.apply(Ql,t.features.map(function(n){return n.geometry.coordinates}));return Gk(e)}function Gk(t){return jo(t)}function JY(t){var e=[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]],n=t&&t.geometry.coordinates||e;return It(n)}function QY(t,e,n,r){r===void 0&&(r={});for(var i=[],o=t[0],s=t[1],a=t[2],u=t[3],l=e/Ln([o,s],[a,s],r),f=l*(a-o),c=n/Ln([o,s],[o,u],r),h=c*(u-s),d=a-o,g=u-s,y=Math.floor(d/f),b=Math.floor(g/h),_=(d-y*f)/2,p=(g-b*h)/2,m=o+_,v=0;v{}},height:{type:String,default:()=>"400px"}},data(){return{searchable:"",searchType:"atu",searchOptions:[{name:"Коорд.",placeholder:"50.44920, 30.52359",id:"coords"},{name:"Адрес",placeholder:"Шевченка, 10",id:"address"},{name:"АТУ",placeholder:"Київська область",id:"atu"},{name:"Here",placeholder:"50.44920, 30.52359",id:"here"}],marker:null,placeholder:"Київська область",searchData:null}},watch:{searchType(){this.searchable="",this.searchData=null,this.placeholder=this.searchOptions.find(t=>t.id===this.searchType).placeholder},searchable(){this.marker&&this.marker.remove()}},methods:{async searchOnMap(){switch(this.searchData=null,this.searchType){case"address":{this.searchAddress();break}case"atu":{this.searchAtu();break}case"here":{this.searchHere();break}case"coords":{this.searchCoords();break}}},async zoomToGeom(t){t.text&&(this.searchable=t.text);const n=typeof t.geom=="string"?JSON.parse(t.geom):t.geom,r=Yn(n);await this.map.fitBounds(r,{duration:0,maxZoom:17,padding:30}),this.searchData=null,await this.createMarker(n)},createMarker(t){const{geometry:e}=qh(t),n=e.coordinates;this.marker=new window.maplibregl.Marker({color:"#3b82f6"}).setLngLat(n).addTo(this.map)},async requestData(t){try{const{data:e}=await Pt.get(t);return e}catch(e){return console.error(e),this.$notify({type:"error",title:"Помилка!",message:"Під час пошуку сталась помилка"}),null}},searchCoords(){const t=r=>{const i=r.replaceAll(" ","").trim();if(i.includes(".")||i.length<=2)return i;const o=i.slice(0,2),s=i.slice(2,i.length-1);return`${o}.${s}`},e=this.searchable.split(",").map(r=>+t(r)),n=xt(e.reverse());this.zoomToGeom({geom:n})},async searchAddress(){const t=await this.requestData(`/api-user/suggest/map.address_id?limit=20&key=${this.searchable}`);this.searchData=t.map(e=>({...e,geom:xt([e.x,e.y])}))},async searchHere(){var n,r;this.searchData=await this.requestData(`https://data.softpro.ua/api-user/gis-url-proxy?searchtext=${this.searchable}`);const t=Object.values(((r=(n=this.searchData)==null?void 0:n.Location)==null?void 0:r.DisplayPosition)||{}).reverse(),e=xt(t);this.zoomToGeom({geom:e})},async searchAtu(){this.searchData=await this.requestData(`https://data.softpro.ua/api-user/suggest/atu.nsdi.ato_level?key=${this.searchable}`)}}},iW={class:"map-search"},oW={class:"map-search__input"},sW={class:"flex flex-nowrap"},aW=["value"],lW={class:"map-search__input-inner w-full"},uW=["placeholder"],cW=["onClick"];function fW(t,e,n,r,i,o){var s,a;return E.openBlock(),E.createElementBlock("div",iW,[E.createElementVNode("div",oW,[E.createElementVNode("div",sW,[E.withDirectives(E.createElementVNode("select",{"onUpdate:modelValue":e[0]||(e[0]=u=>i.searchType=u),class:"text-center flex-shrink-0 inline-flex items-center py-2.5 focus:ring-blue-100 focus:border-blue-100 outline-none text-sm font-medium text-gray-500 focus:outline-none !border !border-gray-300 rounded-s-md hover:bg-gray-100 cursor-pointer"},[(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(i.searchOptions,(u,l)=>(E.openBlock(),E.createElementBlock("option",{key:l,value:u.id},E.toDisplayString(u.name),9,aW))),128))],512),[[E.vModelSelect,i.searchType]]),E.createElementVNode("div",lW,[E.withDirectives(E.createElementVNode("input",{"onUpdate:modelValue":e[1]||(e[1]=u=>i.searchable=u),placeholder:i.placeholder,class:"block p-2.5 w-full focus:ring-blue-100 focus:border-blue-100 outline-none text-sm text-gray-900 rounded-e-md border-s-gray-50 border-s-2 focus:outline-none !border !border-gray-300 placeholder-gray-300 bg-white",onChange:e[2]||(e[2]=(...u)=>o.searchOnMap&&o.searchOnMap(...u))},null,40,uW),[[E.vModelText,i.searchable]]),i.searchable?(E.openBlock(),E.createElementBlock("i",{key:0,class:"ti ti-x map-search__input-close",onClick:e[3]||(e[3]=u=>i.searchable=null)})):E.createCommentVNode("",!0)])]),(a=(s=i.searchData)==null?void 0:s[0])!=null&&a.text?(E.openBlock(),E.createElementBlock("div",{key:0,class:"map-search__input-list",style:E.normalizeStyle({"max-height":n.height})},[(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(i.searchData,(u,l)=>E.withDirectives((E.openBlock(),E.createElementBlock("div",{key:l,class:"map-search__input-list__item",onClick:f=>{o.zoomToGeom(u)}},E.toDisplayString(u.text),9,cW)),[[E.vShow,i.searchData]])),128))],4)):E.createCommentVNode("",!0)])])}const hW=lt(rW,[["render",fW],["__scopeId","data-v-650dac28"]]),ww=["#FF6633","#FFB399","#FF33FF","#00B3E6","#E6B333","#3366E6","#999966","#99FF99","#B34D4D","#80B300","#809900","#E6B3B3","#6680B3","#66991A","#FF99E6","#CCFF1A","#FF1A66","#E6331A","#33FFCC","#66994D","#B366CC","#4D8000","#B33300","#CC80CC","#66664D","#991AFF","#E666FF","#4DB3FF","#1AB399","#E666B3","#33991A","#CC9999","#B3B31A","#00E680","#4D8066","#809980","#E6FF80","#1AFF33","#999933","#FF3380","#CCCC00","#66E64D","#4D80CC","#9900B3","#E64D66","#4DB380","#FF4D4D","#99E6E6","#6666FF","#FFFF99"],Jo={},Jk={};async function o0(t="pin4-sm-mi-plumber+f45942.png",e=null){return Jk[t]?null:new Promise(n=>{e==null||e.loadImage(t!=null&&t.includes("/")?t:`/api-user/marker_icon/${t}`,(r,i)=>{r?console.log(r):(e==null||e.addImage(t,i,{sdf:t==null?void 0:t.includes("+sdf")}),Jk[t]=!0),n()})})}function dW(t){if(!(t!=null&&t.startsWith("rgba")))return t;const e=t.replace(/^rgba?\(|\s+|\)$/g,"").split(",");return`${((1<<24)+(parseInt(e[0],10)<<16)+(parseInt(e[1],10)<<8)+parseInt(e[2],10)).toString(16).slice(1)}`}Jo.point=async(t={},e={},n=null)=>{var l,f,c,h,d,g,y,b,_,p,m,v;e||(e={}),((l=e==null?void 0:e.width)==null?void 0:l[0])==="["&&(e.width={stops:JSON.parse(e.width)}),typeof(e==null?void 0:e.width)=="string"&&(e.width-=0),typeof(e==null?void 0:e.opacity)=="string"&&(e.opacity=(e.opacity-0)*100);const r=((f=t.style)==null?void 0:f.colorAttr)||((c=t.style)==null?void 0:c.iconCls);let i={circle:"none-xl-{{marker}}+222.png",circle2:"circle-xl-{{marker}}+222.png",pin2:"pin2-xl-{{marker}}+sdf.png",pin:"pin-xl-{{marker}}+sdf.png"}[e.iconType]||(e==null?void 0:e.icon);const[o,s]=(i==null?void 0:i.split("-"))||[],a=((h=t.style)==null?void 0:h.color)||"blue";if(!((d=t.style)!=null&&d.iconAttr)&&(i!=null&&i.includes("{{marker}}"))&&(i=i.replace("{{marker}}","fa-star")),t.legendAuto={icon:[],color:[]},(g=t.style)!=null&&g.iconAttr&&i){const w=(b=(y=t.meta)==null?void 0:y.columns)==null?void 0:b.find(S=>{var C;return S.name===((C=t==null?void 0:t.style)==null?void 0:C.iconAttr)}),N=(w==null?void 0:w.values)||await window.axios.get(`/api-user/gis-ir/${t.id}/${(_=t.style)==null?void 0:_.iconAttr}`).then(S=>S.data.rows);if(N!=null&&N.length){const S=i.replace("{{color}}",a.length?a:dW(a)||[0]).split("+")[1].split(/[.-]/)[0];N.forEach((C,O)=>{var M;return C.icon=(M=C.icon)!=null&&M.includes("png")?C.icon:`${o}-${s}-${C.data||C.icon||`ub-${O}`}+${i!=null&&i.includes("circle")?"ddd-222":S}.png`}),i=i!=null&&i.includes("{{")?`${o}-${s}-fa-question+0c53ad.png`:i,t.legendAuto.iconText=(w==null?void 0:w.title)||t.style.iconAttr,N.forEach(C=>t.legendAuto.icon.push(C)),t.legendAuto.icon.push({icon:i,text:"Не визначено"}),t.style.iconArr=["match",["get",t.style.iconAttr]].concat(N.filter(C=>C.id).reduce((C,O)=>C.concat([O.id,O.icon]),[])).concat([i]),await Promise.all(N.map(C=>C.icon).map(C=>o0(C,n))),await o0(i,n)}else i=r?"pin6-m-fa-star+{{color}}.png":`pin6-m-fa-star+${a==null?void 0:a.replace("#","")}.png`}if(i!=null&&i.includes("{{color}}")?i=i.replace("{{color}}","222"):e!=null&&e.icon&&e.iconAttr,r){const w=(m=(p=t.meta)==null?void 0:p.columns)==null?void 0:m.find(S=>S.name===r),N=(w==null?void 0:w.values)||await window.axios.get(`/api-user/gis-ir/${t.id}/${r}`).then(S=>S.data.rows);t.style.color=N!=null&&N.length?["match",["get",r]].concat(N.filter(S=>S.id).reduce((S,C,O)=>S.concat([C.id,C.color||ww[O]]),[])).concat(["#aaa"]):a,t.style.colorArr=t.style.color,t.legendAuto.colorText=(w==null?void 0:w.title)||r,N.forEach(S=>t.legendAuto.color.push(S)),t.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),!((v=t.style)!=null&&v.iconAttr)&&!(i!=null&&i.includes("+sdf"))&&i&&(N.forEach((S,C)=>S.icon=`${i==null?void 0:i.split("+")[0]}+${(S.color||ww[C]).replace("#","")}.png`),t.style.iconArr=["match",["get",r]].concat(N.filter(S=>S.id).reduce((S,C)=>S.concat([C.id,C.icon]),[])).concat([i]),await Promise.all(N.map(S=>S.icon).map(S=>o0(S,n))))}i&&!(i!=null&&i.includes("{"))&&await o0(i,n);const u=i!=null&&i.includes("sdf")?["interpolate",["linear"],["zoom"],14,.1,18,.2]:["interpolate",["linear"],["zoom"],14,.7,16,1];return e.iconOffset=i!=null&&i.includes("pin")?[0,i!=null&&i.includes("+sdf")?-96:-20]:null,[{id:`${t.id}`,source:t.id,type:"circle",cluster:!0,lsource:e==null?void 0:e.lsource,minzoom:(e==null?void 0:e.minzoom)!==void 0?+(e==null?void 0:e.minzoom):4,maxzoom:(i!=null&&i.includes("+sdf")||!(i!=null&&i.includes("circle"))&&!(i!=null&&i.includes("none"))?+e.iconZoom:null)||+(e==null?void 0:e.maxzoom)||24,filter:["all",["==",["geometry-type"],"Point"],["!",["has","point_count"]]],paint:{"circle-stroke-width":["case",["boolean",["feature-state","select"],!1],1,["boolean",["feature-state","hover"],!1],2,1],"circle-stroke-color":["case",["boolean",["feature-state","select"],!1],e.color||(e==null?void 0:e.stroke)||"#fff",["boolean",["feature-state","hover"],!1],"maroon",e.color||(e==null?void 0:e.stroke)||"#fff"],"circle-opacity":(e.iconZoom?["interpolate",["exponential",.5],["zoom"],+e.iconZoom-1,1,+e.iconZoom,i!=null&&i.includes("none")?.3:0]:null)||e.opacity||1,"circle-color":e.color||["case",["boolean",["feature-state","hover"],!1],"red","blue"],"circle-radius":(Array.isArray(e.width)?{stops:e.width}:null)||e.width||{stops:e.iconZoom?[[+e.iconZoom,4],[+e.iconZoom,8],[18,16]]:[[13,4],[15,8],[18,12]]}}}].concat(e.iconArr||e.icon?[{id:`${t.id}-5`,source:t.id,lsource:e==null?void 0:e.lsource,type:"symbol",minzoom:+e.iconZoom||16,filter:["all",["!",["has","point_count"]]],layout:{"icon-image":e.iconArr||i,"icon-allow-overlap":!0,...e.iconOffset?{"icon-offset":e.iconOffset||!1}:{},...u?{"icon-size":u||!1}:{}},paint:{"icon-opacity":["case",["boolean",["feature-state","hover"],!1],.5,["boolean",["feature-state","select"],!1],.5,(i!=null&&i.includes("+sdf")?1:null)||(i!=null&&i.includes("circle")?.6:1)],...i!=null&&i.includes("+sdf")?{"icon-color":["case",["boolean",["feature-state","hover"],!1],"#cd0bbf",["boolean",["feature-state","select"],!1],"#8517cf",e.color||"#aa0000"]}:{}}}]:[]).concat(e.label?[{id:`${t.id}-4`,source:t.id,lsource:e==null?void 0:e.lsource,type:"symbol",minzoom:14,filter:["!",["has","point_count"]],layout:{"text-field":e.label,"text-font":["Open Sans Regular"],"text-size":e["text-size"]||8},paint:{"text-color":e["text-color"]||"#ffffff","text-halo-color":e["text-halo-color"]||"black"}}]:[]).concat(t.cluster||e.clusterMaxZoom?[{id:`${t.id}-1`,source:t.id,lsource:e==null?void 0:e.lsource,type:"circle",filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],"#51bbd6",100,"#f1f075",750,"#f28cb1"],"circle-radius":["step",["get","point_count"],20,100,30,750,40]}},{id:`${t.id}-2`,source:t.id,lsource:e==null?void 0:e.lsource,type:"symbol",filter:["has","point_count"],layout:{"text-field":"{point_count_abbreviated}","text-font":["Open Sans Regular"],"text-size":12}}]:[])},Jo.label=(t={})=>[{id:t.id,source:t.id,type:"line",layout:{"text-field":"{str_name}","text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"symbol-placement":"line","text-pitch-alignment":"viewport","text-max-angle":30,"text-size":{base:1,stops:[[13,12],[18,16]]}},paint:{"text-halo-width":0,"text-halo-blur":0,"text-color":"#78888a"}}],Jo.polygon=async(t={},e={},n=null)=>{var o,s,a,u;const{colorAttr:r}=e,i=((o=t.style)==null?void 0:o.color)||"blue";if(e.colorAttr){n.getSource(t.id)&&n.getSource(n.getSource(t.id).setData(`${n.getSource(t.id)._data.split("&props")[0]}&props=${r}`));const l=((a=(s=t.meta)==null?void 0:s.columns.find(f=>f.name===r))==null?void 0:a.values)||await window.axios.get(`/api-user/gis-ir/${t.id}/${r}`).then(f=>f.data.rows);t.legendAuto={color:[]},l.forEach(f=>t.legendAuto.color.push(f)),t.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),t.style.color=l?["match",["get",r]].concat(l.filter(f=>f.id).reduce((f,c,h)=>f.concat([c.id,c.color||ww[h]]),[])).concat(["#aaa"]):i}return[{id:`${t.id}`,source:`${t.id}`,lsource:e==null?void 0:e.lsource,minzoom:(+(e==null?void 0:e.minzoom)||+(e==null?void 0:e.pointZoom)||0)-0,maxzoom:+(e==null?void 0:e.maxzoom)||24,type:"fill",filter:["all",["match",["geometry-type"],["Polygon","MultiPolygon"],!0,!1]],paint:{"fill-color":["case",["boolean",["feature-state","hover"],!1],"red",["boolean",["feature-state","select"],!1],"#c356c1",(e==null?void 0:e.color)||"#0080ff"],"fill-opacity":.5}}].concat(e!=null&&e.pointZoom?[{id:`${t.id}-5`,source:(u=t.url)!=null&&u.includes(".vmt")?`${t.id}`:`${t.id}-point`,type:"circle",minzoom:0,maxzoom:((e==null?void 0:e.pointZoom)||1)-0,paint:{"circle-color":["case",["boolean",["feature-state","hover"],!1],"red",(e==null?void 0:e.color)||"blue"],"circle-stroke-width":1,"circle-stroke-color":"#fff"}}]:[]).concat(e!=null&&e.label?[{id:`${t.id}-1`,source:t.id,type:"symbol",lsource:e==null?void 0:e.lsource,minzoom:15,layout:{"text-field":e==null?void 0:e.label,"text-font":["Open Sans Regular"],"text-size":e["text-size"]||{stops:[[14,4],[18,16]]}},paint:{"text-color":e["text-color"]||"#ffffff","text-halo-color":e["text-halo-color"]||"#fff","text-halo-width":e["text-halo-width"]||0}}]:[]).concat(e!=null&&e.stroke?[{id:`${t.id}-2`,source:t.id,lsource:e==null?void 0:e.lsource,minzoom:(+(e==null?void 0:e.minzoom)||+(e==null?void 0:e.pointZoom)||0)-0,maxzoom:+(e==null?void 0:e.maxzoom)||24,type:"line",paint:{"line-color":["case",["boolean",["feature-state","select"],!1],"#c356c1",e.stroke],"line-width":["case",["boolean",["feature-state","select"],!1],3,(e.width||e["line-width"]||1)-0]}}]:[])},Jo.line=(t={},e={})=>[{id:t.id,source:t.id,lsource:e.lsource,type:"line",filter1:["all",["match",["geometry-type"],["LineString","MultiLineString","MultiPolygon","Polygon"],!0,!1]],minzoom:(e==null?void 0:e.minzoom)||t.minzoom||5,layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":["case",["boolean",["feature-state","select"],!1],4,e.width||e["line-width"]||1],"line-color":["case",["boolean",["feature-state","select"],!1],"#c356c1",e.color||e["line-color"]||"#c71ccb"],"line-gap-width":e["line-gap-width"]||0}}].concat(e.label?[{id:`${t.id}-4`,source:t.id,lsource:e.lsource,type:"symbol",minzoom:14,paint:{"text-color":"#111","text-halo-color":"#fff","text-halo-width":2},layout:{"symbol-placement":"line","text-letter-spacing":.2,"text-field":e.label,"text-font":["Open Sans Regular"],"text-size":e["text-size"]||15}}]:[]),Jo.linestring=Jo.line,Jo.circle=Jo.point;async function pW(t,e,n){var a,u,l,f,c,h,d,g,y,b,_,p;typeof e.style=="string"&&(e.style=e.style[0]==="{"?JSON.parse(e.style):(a=window.YAML.parse(e.style))==null?void 0:a.style),(l=(u=e.style)==null?void 0:u.filter)==null||l.call(u,m=>m.source).forEach(m=>{m.lsource=`${e.id}-${m.source}`});const r=((f=e==null?void 0:e.style)==null?void 0:f.type)||((_=((d=(h=(c=e==null?void 0:e.meta)==null?void 0:c.geom)==null?void 0:h.geometry)==null?void 0:d.length)>2?["point"]:[((b=(y=(g=e==null?void 0:e.meta)==null?void 0:g.geom)==null?void 0:y.geometry)==null?void 0:b[0].toLowerCase())||"point"])==null?void 0:_.map(m=>{var v;return(v=m==null?void 0:m.replace)==null?void 0:v.call(m,"multi","")})),i=Array.isArray(r)?r:[r],o=(await Promise.all(Array.isArray(e==null?void 0:e.style)?e.style.map(async m=>{var v;return(v=Jo[m.type])==null?void 0:v.call(Jo,e,m,n)}):i.map(async m=>{var v;return(v=Jo[m])==null?void 0:v.call(Jo,e,e.style,n)}))).reduce((m,v)=>v?m.concat(v):m,[]);o.forEach((m,v)=>{m.id=`${m.id}-${v}`});const s=o;return(e.service==="vtile"||(p=e.url)!=null&&p.includes(".vmt"))&&s.forEach(m=>{m.layout||(m.layout={}),m.layout.visibility="visible",m["source-layer"]=m.lsource||e.data||t}),s}const gW={data(){return{layerList:[{id:"graymap",name:"Сіра карта",visible:!0,service:"tms",image:"https://basemaps.cartocdn.com/light_all/10/601/348.png",url:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png"}],layerObj:{},colors:["red","blue","#fbb03b","#223b53","#e55e5e","#3bb2d0","red","blue","#fbb03b","#223b53","#e55e5e","#3bb2d0","red","blue","#fbb03b","#223b53","#e55e5e","#3bb2d0"],activeLayer:"",addedLayersSettings:[],hoveredFeatureId:null}},computed:{interactiveSources(){return this.layerList.filter(t=>t==null?void 0:t.interactive).map(t=>t.id)}},methods:{moveLayers(t,e=this.map||this.$store.state.map.map){e.getStyle().layers.forEach(n=>{n.id.match(t)&&e.moveLayer(n.id)})},getLayersBySourceId(t,e){return e||(e=this.$store.state.map.map),e.getStyle().layers.filter(r=>r.id.match(t))},async setVisible(t,e=!0,n={}){const r=typeof t=="object";try{const{style:i,map:o=this.map}=n,s=(t==null?void 0:t.id)||t,a=r?t:await this.getLayerById(s);if(!(a!=null&&a.id))throw new Error("MixinError: Layer has no id");const u=o.getStyle().layers.filter(l=>l.id.match(s));!u.length||i?await this.addToLayers({...a,...(n==null?void 0:n.data)||{},interactive:(a==null?void 0:a.interactive)!==void 0?a==null?void 0:a.interactive:!0,visible:e},{map:o,cb:n==null?void 0:n.onAddLayer}):(this.layerList=this.layerList.map(l=>l.id===a.id?{...l,visible:e}:l),u.forEach(l=>{o.setLayoutProperty(l.id,"visibility",e?"visible":"none")})),n!=null&&n.cb&&await(n==null?void 0:n.cb(a))}catch(i){console.error(i),!n.onAddLayer||n.onAddLayer({data:r?t:{id:t},message:i.message,type:"error"})}},async addToLayers(t,e={}){try{const{map:n=(this==null?void 0:this.map)||this.$store.state.map.map}=e;this.layerList.find(i=>i.id===t.id)||(this.layerList=this.layerList.concat(t)),this.layerObj[t.id]=t,t.visible?t!=null&&t.layer?await this.addVectorLayer(t,n):t.service==="vtile"?await this.addVtileLayer(t,n):t.service==="geojson"?await this.addGeojsonLayers(t,n):this.addRasterLayer(t,n):n.getStyle().layers.forEach(async i=>{i.source===t.id&&await n.setLayoutProperty(i.id,"visibility","none")}),!(e!=null&&e.cb&&(t!=null&&t.visible))||await e.cb({data:t,type:"success"}),this.moveLayers("gl-draw")}catch(n){console.error(n),!e.cb||e.cb({data:t,message:n.message,type:"error"})}},addRasterLayer(t,e){e.addSource(t.id,{type:"raster",tiles:[(t==null?void 0:t.url)||(t==null?void 0:t.url1)],tileSize:256,...t!=null&&t.scheme?{scheme:t==null?void 0:t.scheme}:{}}),e.addLayer({id:t.id,type:"raster",source:t.id,minzoom:0,maxzoom:(t==null?void 0:t.maxzoom)||22})},async addVtileLayer(t){await this.createGeometryLayer({data:t},"vector")},async addVectorLayer(t,e){const r=await(await fetch(t.layer)).json(),i={...t,source:t.id,layers:[]};Object.keys(r.sources).forEach(async o=>{await e.addSource(t.id,{type:r.sources[o].type,maxzoom:r.sources[o].maxzoom,url:r.sources[o].url})}),await r.layers.forEach(async o=>{await e.addLayer({...o,source:t.id,id:`${o.id}-${t.id}`}),i.layers=await i.layers.concat(`${o.id}-${t.id}`)})},async addGeojsonLayers(t){const e=n=>{throw this.$vsNotify({type:"warning",title:"Відсутня геометрія у обраному шарі",message:n,position:"bottom-right"}),this.layerList=this.layerList.filter(r=>r.id!==t.id),new Error(n)};if(typeof(t==null?void 0:t.geojson)=="object"){this.createGeometryLayer({data:t,geojson:t.geojson},"geojson");return}try{const n=await fetch((t==null?void 0:t.geojson)||(t==null?void 0:t.url)),r=await n.json();if(n.ok)this.createGeometryLayer({data:t,geojson:r},"geojson");else throw new Error((r==null?void 0:r.message)||(n==null?void 0:n.statusText)||"Error addGeojson layer")}catch(n){e(n.message),console.log(n)}},async createGeometryLayer({data:t,geojson:e},n){var a,u,l,f,c;const{map:r}=this,i=await pW(t.id,this.layerList.find(h=>h.id==t.id),r),o={type:n,cluster:((a=t==null?void 0:t.style)==null?void 0:a.cluster)||!1,clusterMaxZoom:((u=t==null?void 0:t.style)==null?void 0:u.clusterMaxZoom)||14};n==="vector"&&(o.tiles=[`${window.location.origin}${(t==null?void 0:t.geojson)||(t==null?void 0:t.url)}${t!=null&&t.version?`?ver=${t.version}`:""}${t.props?`&props=${t.props}`:""}${(l=t==null?void 0:t.style)!=null&&l.pointZoom?`&pointZoom=${t.style.pointZoom}`:""}`]),n==="geojson"&&(o.data=e||`${window.location.origin}${(t==null?void 0:t.geojson)||(t==null?void 0:t.url)}`),r.addSource(t.id,o),i.forEach(h=>{var g;const d={...h,source:t.id,maxzoom:+(h==null?void 0:h.maxzoom)||24,minzoom:+(h==null?void 0:h.minzoom)||0,cluster:!1,clusterMaxZoom:2};r.addLayer(d),r.moveLayer(h.id),(g=h==null?void 0:h.layout)!=null&&g["text-field"]||this.apiLayersHover(h.id,t.id,r),this.addedLayersSettings=this.addedLayersSettings.concat(d)});const s=i.map(h=>h.type).filter(h=>h&&h!=="symbol");(c=(f=t==null?void 0:t.meta)==null?void 0:f.geom)!=null&&c.geometry&&t.meta.geom.geometry.filter(d=>!s.includes(this.geometryByType(d,!0))).forEach(d=>{this.createStyleObj({type:d,style:t.style},t.id)})},async setStyle(t,e,n=this.map){const r=(t==null?void 0:t.id)||t;n.getStyle().layers.forEach(o=>{o.source===r&&n.removeLayer(o.id)}),n.getSource(r)&&(n==null||n.removeSource(r)),this.layerList=this.layerList.map(o=>(o.id===r&&(o.style=e),o));const i=this.layerList.find(o=>o.id===r);this.addToLayers(i)},geometryByType(t,e=!1){if(t==="fill"||t==="Polygon"||t==="MultiPolygon")return e?"fill":"Polygon";if(t==="circle"||t==="Point"||t==="MultiPoint")return e?"circle":"Point";if(t==="line"||t==="LineString"||t==="MultiLineString")return e?"line":"LineString"},async removeLayer(t,e=this.map){const n=(t==null?void 0:t.id)||t;this.layerList=this.layerList.filter(r=>r.id!==n),await e.getStyle().layers.forEach(async r=>{r.source===n&&await e.removeLayer(r.id)}),await e.removeSource(n)},async reloadUrl(t,e=this.map){const n=(t==null?void 0:t.id)||t;await e.getStyle().layers.forEach(r=>{r.id===n&&e.removeLayer(r.id)}),await e.removeSource(n),await this.setVisible(t,!0)},async setFilter(t,e){const n=this.layerObj[t],r=await this.map.getSource(t);if(n.service==="vtile")await r.setTiles([`${window.location.origin}${n.geojson||n.url}${n.url.includes("?")?"&":"?"}filter=${e}${n.props?`&props=${n.props}`:""}`]);else if(n.service==="geojson"){const o=await(await fetch((n==null?void 0:n.geojson)||`${n==null?void 0:n.url}?filter=${e}`)).json();await this.map.getSource(t).setData(o)}},async getLayerById(t,e=null){var r;const n=(t==null?void 0:t.id)||t;try{const i=(r=this.layerList)==null?void 0:r.find(s=>s.id===n);if(i)return i;const o=await fetch(`/api-user/gis-ir/${n}${t!=null&&t.service?`?service=${t==null?void 0:t.service}`:""}`);if(o.ok){const s=await o.json();return!e||await e(s),s}return this.$vsNotify({type:"warning",message:`Шар ${n} не було знайдено!`}),null}catch{this.$vsNotify({type:"warning",message:`Шар ${n} не було знайдено!`})}},createStyleObj({type:t,style:e},n){const r=this.geometryByType(t,!0);if(!r)throw Error("Geomery type ERROR: Error adding missing layers");const i=`${n}-${r}`;if(this.map.getStyle().layers.find(s=>s.id===i))return;const o={id:i,type:r,source:n,"source-layer":n,layout:{},paint:{[`${r}-color`]:["case",["boolean",["feature-state","hover"],!1],"red",(e==null?void 0:e.color)||"#444e3d"],[`${r}-opacity`]:e!=null&&e.opacity||r==="fill"?.5:1},filter:["all",["==",["geometry-type"],this.geometryByType(t)]]};this.map.addLayer(o),this.addedLayersSettings=this.addedLayersSettings.concat(o),this.apiLayersHover(i,n,this.map)},apiLayersHover(t,e,n){const r=n.getSource(e),i=()=>{const o={source:e,id:this.hoveredFeatureId};return r.type==="vector"&&(o.sourceLayer=e),o};n.on("mousemove",t,o=>{o.features.length>0&&(this.hoveredFeatureId!==null&&n.setFeatureState(i(),{hover:!1}),this.hoveredFeatureId=o.features[0].id,n.setFeatureState(i(),{hover:!0}))}),n.on("mouseleave",t,()=>{this.hoveredFeatureId!==null&&n.setFeatureState(i(),{hover:!1}),this.hoveredFeatureId=null})},async changeBaseLayer(t,e=!0,n=!0){await this.setVisible(t,e);const r=(t==null?void 0:t.id)||t;r!==this.activeLayer&&(n&&this.activeLayer&&await this.setVisible(this.activeLayer,!1),this.map.getStyle().layers.forEach(i=>{i.source!==r&&i.type!=="background"&&this.map.moveLayer(i.id)}),this.activeLayer=r)},async refreshLayer(t,e=this.map){const n=(t==null?void 0:t.id)||t;await e.getStyle().layers.forEach(r=>{r.source===n&&e.removeLayer(r.id)}),await e.removeSource(n),this.layers=await this.layers.filter(r=>r.id!==n),await this.setVisible(typeof t=="object"?t:n)}}},mW={components:{VsFormCheckbox:kN},props:{dataset:{type:Array,default:()=>[]},map:{type:Object,default:()=>{}}},data(){return{activeLayers:[]}},mounted(){this.startDataset()},methods:{createLayer(t,e){const n=this.createLayerUrl(t),r=t==null?void 0:t.data,i=Object.assign({},t.style,t.attrFill?{colorAttr:t.attrFill}:{}),o={...t,url:n,id:r,style:i};this.map.setVisible(o,e)},createLayerUrl({service:t,data:e,nocache:n=!1}){switch(t){case"vtile":return`/api-user/vtile/${e}/ua/{z}/{x}/{y}.vmt?nocache=${n?"1":"0"}`;case"geojson":return`/api-user/geojson/${e}.json`;default:throw new Error(`Dataset error: service - ${t} doesn't exist`)}},startDataset(){this.dataset.forEach(t=>{t!=null&&t.visible&&(this.activeLayers=this.activeLayers.concat((t==null?void 0:t.id)||t.data),this.createLayer(t,!0))})}}},yW=E.createElementVNode("div",{class:"block text-sm text-gray-500 layers__title"},"Набори",-1);function vW(t,e,n,r,i,o){const s=E.resolveComponent("VsFormCheckbox");return E.openBlock(),E.createElementBlock("div",null,[yW,(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(n.dataset,a=>(E.openBlock(),E.createBlock(s,{key:(a==null?void 0:a.id)||(a==null?void 0:a.data)||(a==null?void 0:a.name)||a.title,modelValue:i.activeLayers,"onUpdate:modelValue":e[0]||(e[0]=u=>i.activeLayers=u),class:"layers__item",label:(a==null?void 0:a.id)||a.data,onChange:u=>o.createLayer(a,u)},{default:E.withCtx(()=>[E.createTextVNode(E.toDisplayString((a==null?void 0:a.name)||a.title),1)]),_:2},1032,["modelValue","label","onChange"]))),128))])}const _W={components:{VsFormRadio:X1,VsFormGeomDataset:lt(mW,[["render",vW]]),VsFormCheckbox:Ym},props:{map:{type:Object,default:()=>{}},dataset:{type:Array,default:()=>[]},apiLayer:{type:String,default:()=>""},layers:{type:Array,default:()=>[]}},data(){return{radioLayers:{base:[{id:"graymap",name:"Сіра карта",url:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",attribution:"© OpenStreetMap, © CARTO",bounds1:"ua",image:"https://basemaps.cartocdn.com/light_all/10/601/348.png",position:0,owner:"OSM",visible:!0,enabled:!0}],all:[]},baseLayer:"graymap",activeLayers:[]}},watch:{baseLayer:{immediate:!0,handler(t){this.changeLayer(t)}}},async mounted(){var n;this.radioLayers=await this.getLayers();const t=this.radioLayers.base.filter(r=>r==null?void 0:r.visible),e=((n=t==null?void 0:t[0])==null?void 0:n.id)||this.radioLayers.base[0].id;this.baseLayer!==e&&(this.baseLayer=e)},methods:{async getLayers(){if(!this.apiLayer)return this.createLayersObject(this.layers);try{const t=await fetch(this.apiLayer);if(t.ok){const e=await t.json(),n=(e==null?void 0:e.layers)||e||[];return this.createLayersObject(n.concat(this.layers))}return null}catch(t){return console.error(t),this.createLayersObject(this.layers)}},changeLayer(t){const e=this.radioLayers.base.find(n=>n.id===t);this.map.changeBaseLayer(e,!0)},toggleLayer(t,e){this.map.setVisible(t,e)},createLayersObject(t){return t.reduce((e,n)=>{const r=n.overlay?"all":"base";return e[r].find(o=>o.id===n.id)?e:(r==="all"&&n.visible&&(this.activeLayers=this.activeLayers.concat(n.id),this.map.setVisible(n,!0)),{...e,[r]:e[r].concat(n)})},{all:[],base:this.radioLayers.base})}}},Qk=t=>(E.pushScopeId("data-v-ae4aec6b"),t=t(),E.popScopeId(),t),bW={class:"layers"},EW={key:1,class:"mb-3"},wW=Qk(()=>E.createElementVNode("div",{class:"layers__title block text-sm text-gray-500"},"Усі шари",-1)),xW=Qk(()=>E.createElementVNode("div",{class:"layers__title block text-sm text-gray-500"},"Базові шари",-1));function SW(t,e,n,r,i,o){var l,f;const s=E.resolveComponent("VsFormGeomDataset"),a=E.resolveComponent("VsFormCheckbox"),u=E.resolveComponent("VsFormRadio");return E.openBlock(),E.createElementBlock("div",bW,[n.dataset.length?(E.openBlock(),E.createBlock(s,{key:0,class:"mb-3",dataset:n.dataset,map:n.map},null,8,["dataset","map"])):E.createCommentVNode("",!0),(f=(l=i.radioLayers)==null?void 0:l.all)!=null&&f.length?(E.openBlock(),E.createElementBlock("div",EW,[wW,(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(i.radioLayers.all,c=>(E.openBlock(),E.createBlock(a,{key:c.id,modelValue:i.activeLayers,"onUpdate:modelValue":e[0]||(e[0]=h=>i.activeLayers=h),class:"layers__item",label:c.id,onChange:h=>o.toggleLayer(c,h)},{default:E.withCtx(()=>[E.createTextVNode(E.toDisplayString((c==null?void 0:c.name)||(c==null?void 0:c.title)||(c==null?void 0:c.id)||"Назва відсутня"),1)]),_:2},1032,["modelValue","label","onChange"]))),128))])):E.createCommentVNode("",!0),E.createElementVNode("div",null,[xW,(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(i.radioLayers.base,c=>(E.openBlock(),E.createBlock(u,{modelValue:i.baseLayer,"onUpdate:modelValue":e[1]||(e[1]=h=>i.baseLayer=h),key:c.id,class:"layers__item mb-2",value:c.id},{default:E.withCtx(()=>[E.createTextVNode(E.toDisplayString((c==null?void 0:c.name)||(c==null?void 0:c.title)||c.id||"Назва відсутня!"),1)]),_:2},1032,["modelValue","value"]))),128))])])}const CW=lt(_W,[["render",SW],["__scopeId","data-v-ae4aec6b"]]),NW={methods:{fileDownload(t,e,n="json"){const r=document.createElement("a");document.body.appendChild(r);const i=new File([t],`${e}.${n}`,{type:"text/plain"}),o=window.URL.createObjectURL(i);r.href=o,r.download=`${e}.${n}`,r.click(),window.URL.revokeObjectURL(o),r.remove()},readFile(t,e){const n=t,r=new FileReader;r.readAsText(n),r.onload=()=>e(r.result),r.onerror=()=>{console.log(r.error)}}}},OW={props:{maxFileSizeMB:{type:Number,default:20},label:{type:String,default:""},size:{type:String,default:()=>"default"},accept:{type:String,default:()=>""},disabled:{type:Boolean,default:!1}},methods:{handleFileChange(t){var r;const e=t.target;if(!((r=e==null?void 0:e.files)!=null&&r.length))return;const n=e==null?void 0:e.files[0];this.validateFileSize(n)?this.$emit("fileChange",e.files):alert(`Недопустимий розмір файлу. Макс. розмір - ${this.maxFileSizeMB}MB`)},validateFileSize(t){const e=this.maxFileSizeMB*1024*1024;return t.size<=e}}},TW={key:0,for:"file-input",class:"mb-2 text-gray-500 cursor-pointer"},IW=["accept"];function MW(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("div",null,[E.createElementVNode("form",null,[n.label?(E.openBlock(),E.createElementBlock("label",TW,E.toDisplayString(n.label),1)):E.createCommentVNode("",!0),E.createElementVNode("input",{id:"file-input",type:"file",name:"file-input",class:E.normalizeClass(["block w-full transition-all file:transition-all cursor-pointer hover:border-blue-500 file:cursor-pointer border border-gray-200 shadow-sm rounded-md focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-0 py-3 px-3 file:mr-4 file:py-3 file:px-6 file:rounded-md file:border-0 file:font-semibold file:bg-blue-500 file:text-white hover:file:bg-blue-700",{"text-xs file:text-xs":n.size==="mini","text-sm file:text-sm":n.size==="default","text-lg file:text-lg":n.size==="large"}]),accept:n.accept,onChange:e[0]||(e[0]=(...s)=>o.handleFileChange&&o.handleFileChange(...s))},null,42,IW)])])}const kW={components:{VsButton:Uc,VsDialog:Ih,VsFormFile:lt(OW,[["render",MW],["__scopeId","data-v-17e77adb"]]),VsFormAutocomplete:Cy},mixins:[NW],props:{draw:{type:Object,default:()=>{}},map:{type:Object,default:()=>{}},table:{type:String,default:()=>""},form:{type:String,default:()=>""},field:{type:String,default:()=>""},id:{type:String,default:()=>""}},data(){return{formData:{srid:"",encoding:"",file:"",limit:!0},dialogVisible:!1,sridOptions:[]}},computed:{noAviableFeatures(){return!this.$parent.featuresList.length}},watch:{dialogVisible(t){t&&!this.sridOptions.length&&this.getSridOptions()}},methods:{async exportFile(){if(!this.noAviableFeatures)try{const t=this.draw.getAll(),e=JSON.stringify(t),n="/api-user/export-geom-from-geojson",{data:r}=await Pt.post(n,{srid:"4326",geojson:e,format:"geojson"});window.open(`/file/download/${r}`,"_blank")}catch(t){console.error(t)}},async getSridOptions(){try{const{data:t}=await Pt.get("/api-user/suggest/gis.srid_from_setting?limit=50&json=1");this.sridOptions=t.data}catch(t){console.error(t),this.sridOptions=[{initial:!0,id:4326,text:"4326 - WGS 84"}]}},async uploadFile(t){try{const e=new FormData;e.append("file",t[0]),e.append("unique",!0);const n=await Pt("/file/upload/temp",{method:"post",params:{id:this.id,form:this.form,table:this.table,field:this.field},data:e});if(n.ok){const i=(await n.json()).result.file_path;this.formData.file=i}}catch(e){console.error(e),this.$vsNotify({type:"error",title:"Помилка",message:"Помилка при завантаженні файла геометрії"})}},async submitImport(){if(this.formData.file)try{const t=await fetch("/api-user/file2geojson",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(this.formData)});if(t.ok){const e=await t.json(),{features:n}=e[0];n.forEach(i=>{this.draw.add(i)});const r=Yn((n==null?void 0:n[0])||e[0]||n);this.map.fitBounds(r,{padding:30,maxZoom:17,duration:0}),this.$emit("upload"),this.dialogVisible=!1}}catch(t){console.error(t),this.$vsNotify({type:"error",title:"Помилка",message:"Помилка імпорту файла геометрії"})}}}},PW={class:"flex items-center"},AW={class:"mr-1"},LW={class:"p-2"},DW={class:"mb-4"},RW={class:"mb-3"},FW=E.createElementVNode("div",{class:"mb-1"},"Система координат",-1),BW={class:"mb-3"},VW=E.createElementVNode("div",{class:"mb-1"},"Кодування файлу",-1),$W=E.createElementVNode("div",{class:"mb-1"},"Файл",-1),jW={class:"flex justify-end"};function qW(t,e,n,r,i,o){const s=E.resolveComponent("VsButton"),a=E.resolveComponent("VsFormAutocomplete"),u=E.resolveComponent("VsFormFile"),l=E.resolveComponent("VsDialog");return E.openBlock(),E.createElementBlock("div",PW,[E.createElementVNode("div",AW,[E.createVNode(s,{title:"Імпорт ",square:"",onClick:e[0]||(e[0]=f=>i.dialogVisible=!0)})]),E.createElementVNode("div",null,[E.createVNode(s,{title:"Експорт",square:"",disabled:o.noAviableFeatures,onClick:o.exportFile},null,8,["disabled","onClick"])]),E.createVNode(l,{visible:i.dialogVisible,"onUpdate:visible":e[4]||(e[4]=f=>i.dialogVisible=f),title:"Імпорт геометрії"},{default:E.withCtx(()=>[E.createElementVNode("div",LW,[E.createElementVNode("div",DW,[E.createElementVNode("div",RW,[FW,i.sridOptions.length?(E.openBlock(),E.createBlock(a,{key:0,modelValue:i.formData.srid,"onUpdate:modelValue":e[1]||(e[1]=f=>i.formData.srid=f),"append-to-body":!0,"value-property":"id","label-property":"text",options:i.sridOptions},null,8,["modelValue","options"])):E.createCommentVNode("",!0)]),E.createElementVNode("div",BW,[VW,E.createVNode(a,{modelValue:i.formData.encoding,"onUpdate:modelValue":e[2]||(e[2]=f=>i.formData.encoding=f),"append-to-body":!0,options:["UTF-8","CP1251","LATIN-1"]},null,8,["modelValue"])]),E.createElementVNode("div",null,[$W,E.createVNode(u,{accept:".geojson,.zip",onFileChange:o.uploadFile},null,8,["onFileChange"])])]),E.createElementVNode("div",jW,[E.createVNode(s,{class:"mr-2",onClick:e[3]||(e[3]=f=>i.dialogVisible=!1),color:"red"},{default:E.withCtx(()=>[E.createTextVNode("Скасувати")]),_:1}),E.createVNode(s,{type:"primary",disabled:!i.formData.file,onClick:o.submitImport},{default:E.withCtx(()=>[E.createTextVNode("Додати")]),_:1},8,["disabled","onClick"])])])]),_:1},8,["visible"])])}const UW=lt(kW,[["render",qW]]),zW={props:{data:{type:Object,default:()=>{}},map:{type:Object,default:()=>{}},draw:{type:Object,default:()=>{}},selectedFeatures:{type:Array,default:()=>[]}},data(){return{}},computed:{featureActiveState(){return this.selectedFeatures.includes(this.data.id)?"bg-gray-50":""}},mounted(){window.addEventListener("form-refresh",this.deleteFeature)},beforeUnmount(){window.removeEventListener("form-refresh",this.deleteFeature)},methods:{deleteFeature(){this.$emit("delete")},zoomTo(){const t=Yn(this.data.geometry);this.map.fitBounds(t,{duration:1,maxZoom:17,padding:30}),this.highlightFeature()},highlightFeature(){const{id:t}=this.data;this.draw.changeMode("direct_select",{featureId:t})},additionalInfo(){var e,n;const{type:t}=this.data.geometry;if(t==="Point")return`
Центр: ${this.data.geometry.coordinates.map(i=>i.toFixed(5)).join(",")}
`;if(t==="Polygon"){const r=lv(this.data),i=(((n=(e=qh(this.data))==null?void 0:e.geometry)==null?void 0:n.coordinates)||[0,0]).reverse().map(s=>s.toFixed(5)).join(","),o=Math.floor(r)<1e5?`${r.toFixed(1)}м²`:`${db(r,"meters","kilometers").toFixed(1)}км²`;return`
Центр: ${i}
Площа: ${o}
`}return`
Відстань: ${uv(this.data).toFixed(1)}км
`}}},HW={class:"mr-auto"},GW={class:"font-bold"},YW=["innerHTML"],WW=[E.createElementVNode("i",{class:"ti ti-zoom-in"},null,-1)],XW=[E.createElementVNode("i",{class:"ti ti-x"},null,-1)];function KW(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("div",{class:E.normalizeClass(["form-geom__feature flex items-center text-xs transition-all",o.featureActiveState])},[E.createElementVNode("div",HW,[E.createTextVNode(" Тип: "),E.createElementVNode("span",GW,E.toDisplayString(n.data.geometry.type),1)]),E.createElementVNode("div",{class:"mr-3 flex items-center",innerHTML:o.additionalInfo()},null,8,YW),E.createElementVNode("div",{class:"bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Наблизити",onClick:e[0]||(e[0]=(...s)=>o.zoomTo&&o.zoomTo(...s))},WW),E.createElementVNode("div",{class:"bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Видалити",onClick:e[1]||(e[1]=s=>t.$emit("delete"))},XW)],2)}const ZW=lt(zW,[["render",KW]]),JW={props:{dataset:{type:Array,default:()=>[]},layerList:{type:Array,default:()=>[]}},data(){return{legendData:[]}},watch:{layerList(){this.getActiveLayers()}},methods:{getLegendData(t){var o;const e=(t==null?void 0:t.attrFill)||t.style.colorAttr;return(((o=t==null?void 0:t.meta)==null?void 0:o.columns)||[]).find(s=>s.name===e).values.map(s=>({...s,color:(s==null?void 0:s.color)||"#eee"}))},getActiveLayers(){const t=this.dataset.map(n=>(n==null?void 0:n.id)||n.data),e=this.layerList.reduce((n,r)=>{if(!t.includes(r.data)||!r.visible)return n;const i=this.legendData.find(s=>(s==null?void 0:s.name)===(r==null?void 0:r.name));if(i)return n.concat(i);const o={name:(r==null?void 0:r.name)||r.title,visible:!1,id:Math.floor(Math.random()*1e3),data:this.getLegendData(r)};return n.concat(o)},[]);this.legendData=e},toggleLegend({id:t}){this.legendData=this.legendData.map(e=>e.id===t?{...e,visible:!e.visible}:e)}}},QW={key:0,class:"legend"},eX=["onClick"],tX=["title"];function nX(t,e,n,r,i,o){return i.legendData.length?(E.openBlock(),E.createElementBlock("div",QW,[(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(i.legendData,s=>(E.openBlock(),E.createElementBlock("div",{key:s.name,class:"legend__wrapper"},[E.createElementVNode("div",{class:E.normalizeClass(["legend__title cursor-pointer",{active:s.visible}]),onClick:a=>o.toggleLegend(s)},E.toDisplayString(s.name),11,eX),s.visible?(E.openBlock(!0),E.createElementBlock(E.Fragment,{key:0},E.renderList(s.data,(a,u)=>(E.openBlock(),E.createElementBlock("div",{key:u,class:"legend__item"},[E.createElementVNode("div",{class:"legend__color",style:E.normalizeStyle("background-color:"+a.color+";")},null,4),E.createElementVNode("div",{title:a.text,class:"legend__label"},E.toDisplayString(a.text),9,tX)]))),128)):E.createCommentVNode("",!0)]))),128))])):E.createCommentVNode("",!0)}const rX={components:{VsMapSearch:hW,VsFormGeomLayers:CW,VsFormGeomFeature:ZW,VsFormGeomFilesTransfer:UW,VsFormGeomLegend:lt(JW,[["render",nX],["__scopeId","data-v-b5e7ce76"]])},mixins:[gW],props:{height:{type:String,default:()=>"400px"},modelValue:{type:[Object,Array],default:()=>null},multiple:{type:Boolean,default:()=>!1},multipleAll:{type:Boolean,default:()=>!1},componentKey:{type:String,default:()=>""},apiLayer:{type:String,default:()=>""},dataset:{type:Array,default:()=>[]},tools:{type:[Array],default:()=>["polygon"]},zoom:{type:Number,default:()=>10},center:{type:Array,default:()=>[30.5,50.45]},maxZoom:{type:Number,default:()=>21},minZoom:{type:Number,default:()=>0}},inject:["meta"],data(){return{mapId:`map-${Math.floor(Math.random()*1e3)}`,map:null,draw:null,activeTool:"",showLayers:!1,drawTools:[{title:"Полігон",mode:"draw_polygon",icon:"ti-polygon"},{title:"Точка",mode:"draw_point",icon:"ti-map-pin"},{title:"Лінія",mode:"draw_line_string",icon:"ti-line"},{title:"Полігон (квадрат)",mode:"draw_rectangle",icon:"ti-topology-ring-3"}],layers:[],mapLoaded:!1,selectedFeatures:[],featuresList:[],mapParams:{bearing:0},windowSettingLayers:""}},watch:{activeTool(t){const e=this.map.getCanvas();e.style.cursor=t?"crosshair":"grab"}},async mounted(){await Sy.promise(["https://cdn.softpro.ua/vendor/maplibre/maplibre.js","https://cdn.softpro.ua/vendor/maplibre/maplibre.css"]),this.initMap(),this.drawTools=this.drawTools.filter(t=>this.tools.find(e=>t.mode.match(e)))},beforeUnmount(){this.map.off("draw:create",this.drawCreateEvent),this.map.off("draw:update",this.drawEvent),this.map.off("draw:delete",this.drawEvent),window.removeEventListener("keydown",this.keyboardEvents)},computed:{compasRotate(){return`${this.mapParams.bearing-45}deg`},metaToken(){var t;return((t=this==null?void 0:this.meta)==null?void 0:t.token)||""},metaTable(){var t;return((t=this==null?void 0:this.meta)==null?void 0:t.table)||""},nextId(){var t;return console.log(this.meta),((t=this==null?void 0:this.meta)==null?void 0:t.nextId)||""}},methods:{async initMap(){var n,r;const t=((r=(n=window==null?void 0:window.setting)==null?void 0:n.map)==null?void 0:r.basemap)||"2997428371643697116,orto10,graymap";t&&(this.windowSettingLayers=t);const e=new maplibregl.Map({container:this.mapId,style:{version:8,sources:{},layers:[]},center:this.center,zoom:this.zoom,maxZoom:this.maxZoom,minZoom:this.minZoom});e.on("load",this.onMapLoad),e.on("rotate",this.rotateEvent)},async getLayerList(){try{const{data:t}=await Pt.get("/api-user/gis-layer-list"),e=(this.windowSettingLayers||"").split(",");this.layers=t.filter(n=>e.includes(n.id)),this.mapLoaded=!0}catch(t){this.mapLoaded=!0,console.error(t)}},initDrawTool(){const{modes:t}=TO;t.draw_rectangle=nW,this.draw=new TO({displayControlsDefault:!1,controls:{polygon:!0,trash:!0},modes:t}),this.map.on("click",this.handleMapClick),this.map.on("moveend",this.handleMapClick),this.map.addControl(this.draw),this.drawCreateEvent=async()=>{this.activeTool="",await this.drawEvent(),await this.getAllSelectedFeatures()},this.map.on("draw.create",this.drawCreateEvent),this.map.on("draw.update",this.drawEvent),this.map.on("draw.delete",this.drawEvent)},async onMapLoad(t){if(this.map=await t.target,this.map.setVisible=this.setVisible,this.map.changeBaseLayer=this.changeBaseLayer,await this.initDrawTool(),this.windowSettingLayers?this.getLayerList():this.mapLoaded=!0,this.modelValue){this.featuresByValue(),this.drawEvent(!1);const e=Yn(this.modelValue);this.map.fitBounds(e,{maxZoom:17,padding:30,duration:0})}this.callKatottg(),window.addEventListener("keydown",this.keyboardEvents),this.$emit("load",this.map)},async callKatottg(){const t=async()=>{var r,i;try{const o=((i=(r=window==null?void 0:window.setting)==null?void 0:r.map)==null?void 0:i.katottg)||"";if(!o)return null;const{data:s}=await Pt.get(`https://data.gki.com.ua/api-user/atu/${o}`);return s}catch(o){return console.error(o),null}},e=r=>{this.map.addSource("katottg",{type:"geojson",data:r}),this.map.addLayer({id:"katottg-line",type:"line",source:"katottg",layout:{},paint:{"line-color":"#ecb9ed","line-width":2}});const i=Yn(r);this.map.fitBounds(i,{padding:30,duration:0})},n=await t();n&&e(n)},drawEvent(t=!0){this.featuresList=this.formatFeatures(this.draw.getAll().features),t&&this.$emit("update:modelValue",this.emitDataByType(this.featuresList))},rotateEvent(){this.mapParams.bearing=this.map.getBearing()},featuresByValue(){var r;if(this.multipleAll){(((r=this.modelValue)==null?void 0:r.features)||this.modelValue).forEach(o=>this.draw.add(o));return}const e=this.modelValue.type.replace("Multi",""),n=e.replace(e[0],e[0].toLowerCase());if(this.modelValue.type.match("Multi")){this.modelValue.coordinates.forEach(o=>{this.draw.add(Xk[n](o))});return}this.draw.add(this.modelValue)},emitDataByType(t){var n,r;if(!t.length)return null;const e=this.multipleAll;if(e)return t;if(!e&&this.multiple&&t.length>1){const o=`multi${((r=(n=t[0])==null?void 0:n.geometry)==null?void 0:r.type)||""}`,s=t.map(u=>u.geometry.coordinates),{geometry:a}=Xk[o](s);return a}return t[0].geometry},formatFeatures(t){return this.multiple?t.reduce((n,r)=>r.geometry.type!==t[0].geometry.type&&!this.multipleAll?(this.$vsNotify({type:"error",title:"Помилка!",message:"У режимі мульти-геометрії можливо додавати лише декілька геометрій одного типу!"}),this.draw.delete(r.id),n):n.concat(r),[]):t},toolClick({mode:t}){this.multiple||(this.draw.deleteAll(),this.drawEvent()),this.activeTool=this.activeTool===t?"":t,this.draw.changeMode(t)},handleMapClick(){this.getAllSelectedFeatures()},getAllSelectedFeatures(){const{features:t}=this.draw.getSelected();this.selectedFeatures=t.map(e=>e.id)},deleteFeature({id:t}){this.draw.delete(t),this.drawEvent()},keyboardEvents(t){switch(t.keyCode){case 27:this.activeTool="";break}},mapLevelOut(){const{map:t}=this;t.flyTo({pitch:0,bearing:0})}}},iX={class:"form-geom"},oX=["id"],sX={class:"form-geom__panel"},aX={class:"form-geom__tools flex flex-col"},lX=["title","onClick"],uX={class:"relative"};function cX(t,e,n,r,i,o){const s=E.resolveComponent("VsFormGeomLegend"),a=E.resolveComponent("VsMapSearch"),u=E.resolveComponent("VsFormGeomFilesTransfer"),l=E.resolveComponent("VsFormGeomLayers"),f=E.resolveComponent("VsFormGeomFeature");return E.openBlock(),E.createElementBlock("div",null,[E.createElementVNode("div",iX,[E.createElementVNode("div",{id:i.mapId,style:E.normalizeStyle({height:n.height})},null,12,oX),E.createVNode(s,{dataset:n.dataset,"layer-list":t.layerList},null,8,["dataset","layer-list"]),E.createVNode(a,{map:i.map,"onUpdate:map":e[0]||(e[0]=c=>i.map=c),height:n.height,class:"form-geom__search"},null,8,["map","height"]),E.createElementVNode("div",sX,[E.createVNode(u,{field:"file",id:o.nextId,table:o.metaToken,form:o.metaTable,draw:i.draw,map:i.map,onUpload:o.drawEvent},null,8,["id","table","form","draw","map","onUpload"])]),E.createElementVNode("div",aX,[E.createElementVNode("div",{title:"Вирівняти карту",class:"form-geom__tool py-0.5 px-2 cursor-pointer transition-all border rounded-md text-sm bg-white hover:bg-blue-500",onClick:e[1]||(e[1]=(...c)=>o.mapLevelOut&&o.mapLevelOut(...c))},[E.createElementVNode("i",{class:"ti ti-compass",style:E.normalizeStyle({rotate:o.compasRotate})},null,4)]),(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(i.drawTools,c=>(E.openBlock(),E.createElementBlock("div",{key:c.mode,title:c.title,class:E.normalizeClass(["form-geom__tool py-0.5 px-2 cursor-pointer transition-all border rounded-md text-sm bg-white hover:bg-blue-500 hover:text-white",{"!bg-blue-500 !text-white":c.mode===i.activeTool}]),onClick:h=>o.toolClick(c)},[E.createElementVNode("i",{class:E.normalizeClass("ti "+c.icon)},null,2)],10,lX))),128)),E.createElementVNode("div",uX,[E.createElementVNode("div",{title:"Шари",class:E.normalizeClass(["form-geom__tool py-0.5 px-2 cursor-pointer transition-all border rounded-md text-sm bg-white hover:bg-blue-500",{"!bg-blue-500":i.showLayers}]),onClick:e[2]||(e[2]=c=>i.showLayers=!i.showLayers)},[E.createElementVNode("i",{class:E.normalizeClass(["ti ti-stack-2",{"!text-white":i.showLayers}])},null,2)],2),i.map&&i.mapLoaded?E.withDirectives((E.openBlock(),E.createBlock(l,{key:0,"api-layer":n.apiLayer,layers:i.layers,dataset:n.dataset,map:i.map},null,8,["api-layer","layers","dataset","map"])),[[E.vShow,i.showLayers]]):E.createCommentVNode("",!0)])])]),E.createVNode(E.TransitionGroup,{name:"list",duration:300,tag:"div",class:"form-geom__features"},{default:E.withCtx(()=>[(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(i.featuresList,c=>(E.openBlock(),E.createBlock(f,{key:c.id,class:"form-geom__feature flex items-center",draw:i.draw,data:c,"selected-features":i.selectedFeatures,map:i.map,onDelete:h=>o.deleteFeature(c)},null,8,["draw","data","selected-features","map","onDelete"]))),128))]),_:1})])}const fX=lt(rX,[["render",cX]]),hX={components:{VsButton:Uc},mixins:[{data(){return{files:[],fileResult:[],importType:null,exportVisible:!1,importVisible:!1}},async mounted(){await Sy.promise(["https://cdnjs.cloudflare.com/ajax/libs/yamljs/0.3.0/yaml.min.js"])},watch:{importType(){this.importType==="replace"?this.value=this.fileResult:this.importType==="append"&&(this.value=this.value.concat(...this.fileResult)),this.$emit("update:value",this.value),this.importType=null}},methods:{async importTable(t){this.files=t.target.files;const e=new FileReader;e.readAsText(t.target.files[0]),e.onload=()=>{this.fileResult=JSON.parse(e.result),this.exportVisible=!0},e.onerror=()=>{this.$message.error("Ой, щось пішло не так, файл не додано")},t.target.value=""},exportTable(t,e){if(t.length){const n=`${e}-${Date.now()}.geojson`;this.anchorDownload(JSON.stringify(t),n)}else this.$message.error("Таблиця пуста!")},anchorDownload(t,e){const n=document.createElement("a");document.body.appendChild(n);const r=new File([t],e),i=window.URL.createObjectURL(r);n.href=i,n.download=e,n.click(),window.URL.revokeObjectURL(i),n.remove()},saveYaml(t,e){t.length?this.anchorDownload(window.YAML.stringify(t),`${e}.yml`):this.$message.error("Таблиця пуста!")}}}],props:{value:{type:Object,default(){return{}}},input:{type:Object,default(){return{}}}}},dX=t=>(E.pushScopeId("data-v-10093311"),t=t(),E.popScopeId(),t),pX={class:"table-wrapper flex gap-2"},gX={class:"p-2"},mX=dX(()=>E.createElementVNode("h3",{class:"mb-2"},E.toDisplayString("Оберіть спосіб завантаження"),-1)),yX={class:"flex items-center gap-2"};function vX(t,e,n,r,i,o){const s=E.resolveComponent("VsButton"),a=E.resolveComponent("VsPopover");return E.openBlock(),E.createElementBlock("div",pX,[E.createElementVNode("input",{ref:"filePicker",class:"hidden",accept:".geojson",type:"file",onChange:e[0]||(e[0]=(...u)=>t.importTable&&t.importTable(...u))},null,544),E.createVNode(s,{square:"",icon:"ti ti-download",size:"mini",type:"plain",onClick:e[1]||(e[1]=u=>t.$refs.filePicker.click())}),E.createVNode(a,{width:"250"},{reference:E.withCtx(()=>[E.createVNode(s,{size:"mini",square:"",type:"plain",icon:"ti ti-upload"})]),default:E.withCtx(()=>[E.createElementVNode("div",gX,[mX,E.createElementVNode("div",yX,[E.createVNode(s,{size:"mini",type:"primary",onClick:e[2]||(e[2]=u=>{t.importVisible=!1,t.exportTable(n.value,"test")})},{default:E.withCtx(()=>[E.createTextVNode(E.toDisplayString("Як JSON"))]),_:1}),E.createVNode(s,{size:"mini",onClick:e[3]||(e[3]=u=>{t.importVisible=!1,t.saveYaml(n.value,"gis-editor")})},{default:E.withCtx(()=>[E.createTextVNode(E.toDisplayString("Як YAML"))]),_:1})])])]),_:1})])}const _X=lt(hX,[["render",vX],["__scopeId","data-v-10093311"]]),bX=E.defineComponent({components:{VsButton:Uc,VsDialog:Ih,VsText:zc,TableFormInput:_X,VsCheckbox:Ym},props:{colModel:{type:Array,default:()=>[]},modelValue:{default:()=>[]}},data(){return{userSearch:"",dialogType:"",newElement:{},currentlyEditing:null,keysMeta:[],dataset:[],selectKeys:[],isDialogVisible:!1}},computed:{dialogTitle(){return this.dialogType==="add"?"Додати елемент":"Редагувати елемент"},filteredDataset(){return this.dataset.filter(t=>!t.hide)},filterDatasetsExist(){return this.filteredDataset.length>0},showTableBody(){return this.filteredDataset.length>0&&this.filterDatasetsExist}},watch:{dataset:{handler(t){this.$emit("update:modelValue",t)},deep:!0},userSearch:{handler(){this.filterDataset()},immediate:!0},isDialogVisible(t){t||(this.newElement={})}},async mounted(){await this.initKeysMeta(),await this.initData()},methods:{async initKeysMeta(){this.keysMeta=this.colModel.filter(t=>t.type).map(t=>({...t,key:(t==null?void 0:t.name)||t.key,label:t.ua})),this.selectKeys=this.keysMeta.filter(t=>["Select2","Select","Autocomplete"].includes(t.type)).map(t=>({key:t.key,data:t.data}))},async initData(){this.dataset=this.modelValue||[],this.modelValue.length&&await Promise.all(this.modelValue.map(async t=>{await this.initRowSuggestText(t)}))},async initRowSuggestText(t){for(const e in t){const n=this.selectKeys.find(r=>r.key===e);if(n){const r=await this.getSuggestText(t[e],n.data);t[`${n.key}_suggest`]=r}}},async handleDelete(t){this.dataset=this.dataset.filter(e=>e!==t)},openAddForm(){this.dialogType="add",this.isDialogVisible=!0},async handleConfirm(){this.dialogType==="add"?await this.addNewElement():this.dialogType==="edit"&&await this.editElement(),this.dialogType="",this.isDialogVisible=!1},async addNewElement(){const t={};for(const e in this.newElement){t[e]=this.newElement[e];const n=this.selectKeys.find(r=>r.key===e);if(n){const r=await this.getSuggestText(this.newElement[e],n.data);t[`${n.key}_suggest`]=r}}this.dataset.push(t)},async editElement(){this.dataset=await Promise.all(this.dataset.map(async t=>t===this.currentlyEditing?await this.updateProperties(this.newElement):t)),this.currentlyEditing=null},async updateProperties(t){const e={};for(const n in t){if(n.includes("_suggest"))continue;e[n]=t[n];const r=this.selectKeys.find(i=>i.key===n);if(r){const i=await this.getSuggestText(t[n],r.data);e[`${r.key}_suggest`]=i}}return e},startEdit(t){this.newElement=JSON.parse(JSON.stringify(t)),this.currentlyEditing=t,this.dialogType="edit",this.isDialogVisible=!0},async getSuggestText(t,e){try{const{data:n}=await Pt.get(`/api-user/suggest/${e}`,{params:{val:t}});return n[0].text}catch(n){return console.error(n),t}},filterDataset(){this.dataset.forEach(t=>{t.hide=!Object.values(t).join("").toLowerCase().includes(this.userSearch.toLowerCase())})},rowTitle(t){return t||"-"}}}),eP=t=>(E.pushScopeId("data-v-158b0235"),t=t(),E.popScopeId(),t),EX={class:"vs-datatable"},wX={class:"flex items-center justify-between gap-5 pb-2"},xX={class:"flex items-center gap-2"},SX={class:"table-responsive vs-datatable__table-wrapper"},CX={class:"border-collapse border border-slate-300 w-full"},NX={class:"z-999 border-b-0 sticky top-0 bg-slate-50"},OX=eP(()=>E.createElementVNode("th",{class:"border w-10 border-slate-300 font-semibold p-2 text-slate-900 text-left"}," # ",-1)),TX=eP(()=>E.createElementVNode("th",{class:"border w-10 border-slate-300 font-semibold p-2 text-slate-900 text-left"}," Дії ",-1)),IX={class:"border w-10 border-slate-300 p-2 text-slate-500"},MX={key:0},kX={key:1},PX={class:"border border-slate-300 p-2 text-slate-500 w-10"},AX={class:"flex items-center justify-center gap-1"},LX={key:1,colspan:"100%",class:"text-center"},DX={class:"flex justify-end items-center gap-x-2 py-3 px-4 border-t"};function RX(t,e,n,r,i,o){const s=E.resolveComponent("VsText"),a=E.resolveComponent("TableFormInput"),u=E.resolveComponent("VsButton"),l=E.resolveComponent("VsCheckbox"),f=E.resolveComponent("VsForm"),c=E.resolveComponent("VsDialog");return E.openBlock(),E.createElementBlock("div",EX,[E.createElementVNode("div",wX,[E.createVNode(s,{modelValue:t.userSearch,"onUpdate:modelValue":e[0]||(e[0]=h=>t.userSearch=h),placeholder:"Пошук",size:"xs",icon:"ti ti-search",class:"w-full"},null,8,["modelValue"]),E.createElementVNode("div",xX,[E.createVNode(a,{value:t.dataset,"onUpdate:value":e[1]||(e[1]=h=>t.dataset=h),input:t.keysMeta,"onUpdate:input":e[2]||(e[2]=h=>t.keysMeta=h)},null,8,["value","input"]),E.createVNode(u,{type:"primary",size:"mini",onClick:t.openAddForm},{default:E.withCtx(()=>[E.createTextVNode("Додати")]),_:1},8,["onClick"])])]),E.createElementVNode("div",SX,[E.createElementVNode("table",CX,[E.createElementVNode("thead",NX,[E.createElementVNode("tr",null,[OX,(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(t.keysMeta,h=>(E.openBlock(),E.createElementBlock("th",{key:h.name,class:"border border-slate-300 font-semibold p-2 text-slate-900 text-left"},E.toDisplayString(h.ua),1))),128)),TX])]),E.createElementVNode("tbody",null,[t.showTableBody?(E.openBlock(!0),E.createElementBlock(E.Fragment,{key:0},E.renderList(t.filteredDataset,(h,d)=>E.withDirectives((E.openBlock(),E.createElementBlock("tr",{key:d},[E.createElementVNode("td",IX,E.toDisplayString(d+1),1),(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(t.keysMeta,g=>(E.openBlock(),E.createElementBlock("td",{key:g.name,class:"border border-slate-300 p-2 text-slate-500"},[g.type==="Switcher"?(E.openBlock(),E.createBlock(l,{key:0,modelValue:h[g.key],"onUpdate:modelValue":y=>h[g.key]=y},null,8,["modelValue","onUpdate:modelValue"])):(E.openBlock(),E.createElementBlock(E.Fragment,{key:1},[["Select2","Select","Autocomplete"].includes(g.type)?(E.openBlock(),E.createElementBlock("span",MX,E.toDisplayString(h[`${g.key}_suggest`]),1)):(E.openBlock(),E.createElementBlock("span",kX,E.toDisplayString(t.rowTitle(h[g.key])),1))],64))]))),128)),E.createElementVNode("td",PX,[E.createElementVNode("div",AX,[E.createVNode(u,{square:"",size:"mini",icon:"ti ti-pencil",onClick:g=>t.startEdit(h)},null,8,["onClick"]),E.createVNode(u,{square:"",size:"mini",icon:"ti ti-trash",onClick:g=>t.handleDelete(h)},null,8,["onClick"])])])])),[[E.vShow,!h.hide]])),128)):(E.openBlock(),E.createElementBlock("td",LX,"Нічого не знайдено"))])])]),E.createVNode(c,{visible:t.isDialogVisible,"onUpdate:visible":e[5]||(e[5]=h=>t.isDialogVisible=h),title:t.dialogTitle},{default:E.withCtx(()=>[t.isDialogVisible?(E.openBlock(),E.createBlock(f,{key:0,modelValue:t.newElement,"onUpdate:modelValue":e[3]||(e[3]=h=>t.newElement=h),class:"p-4",scheme:t.keysMeta},null,8,["modelValue","scheme"])):E.createCommentVNode("",!0),E.createElementVNode("div",DX,[E.createVNode(u,{title:"Скасувати",color:"red",onClick:e[4]||(e[4]=h=>t.isDialogVisible=!1)}),E.createVNode(u,{title:"Застосувати",onClick:t.handleConfirm},null,8,["onClick"])])]),_:1},8,["visible","title"])])}const FX=lt(bX,[["render",RX],["__scopeId","data-v-158b0235"]]),BX=E.defineComponent({props:{text:{type:String,default:""}}}),VX=["innerHTML"];function $X(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("div",{innerHTML:t.text,class:"html-code"},null,8,VX)}const jX=lt(BX,[["render",$X]]),qX={components:{VsText:zc},props:{defaultValue:{type:String,default:()=>""},modelValue:{type:String,default:t=>t.defaultValue},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},placeholder:{type:[String,Object],default:()=>"E-mail"},error:{type:String,default:()=>"Помилка при вводі емейла"}},emits:["update:modelValue","validate"],data:()=>({isValid:!0}),computed:{value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}},placeholderValue(){var t;return((t=this.placeholder)==null?void 0:t.ua)||this.placeholder}},methods:{handleInput(){this.validateEmail();const t=this.isValid?null:[{message:this.error}];this.$emit("validate",t)},validateEmail(){const t=/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/;this.isValid=t.test(this.value)||!this.value}}};function UX(t,e,n,r,i,o){const s=E.resolveComponent("vs-text");return E.openBlock(),E.createElementBlock("div",null,[E.createVNode(s,{modelValue:o.value,"onUpdate:modelValue":e[0]||(e[0]=a=>o.value=a),type:"email",icon:"ti-mail",iconPosition:"left",disabled:n.disabled,clearable:n.clearable,placeholder:o.placeholderValue,onBlur:o.handleInput},null,8,["modelValue","disabled","clearable","placeholder","onBlur"])])}const zX=lt(qX,[["render",UX]]),HX={components:{VsMarkedText:WS},props:{mask:{type:[Object,String],default:()=>"+38(999)999-99-99"},modelValue:{type:String,default:()=>""},placeholder:{type:String,default:()=>"Введіть телефон.."},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1}},emits:["update:modelValue"],computed:{value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}}}};function GX(t,e,n,r,i,o){const s=E.resolveComponent("VsMarkedText");return E.openBlock(),E.createElementBlock("div",null,[E.createVNode(s,{modelValue:o.value,"onUpdate:modelValue":e[0]||(e[0]=a=>o.value=a),icon:"ti-phone",iconPosition:"left",disabled:n.disabled,placeholder:n.placeholder,clearable:n.clearable,mask:n.mask},null,8,["modelValue","disabled","placeholder","clearable","mask"])])}const YX=lt(HX,[["render",GX]]),WX=/^#[0-9a-f]{0,6}$/i,XX={events:["update:modelValue"],props:{modelValue:{type:String,default:()=>"#000000"},disabled:{type:Boolean,default:()=>!1},isTextInputShown:{type:Boolean,default:()=>!0}},computed:{value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}}},data:()=>({HEX_MASK:WX})},KX={class:"flex items-center"},ZX=["disabled"];function JX(t,e,n,r,i,o){const s=E.resolveComponent("vs-text-mask");return E.openBlock(),E.createElementBlock("div",KX,[E.withDirectives(E.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=a=>o.value=a),type:"color",class:E.normalizeClass(["w-10 h-10 py-[1px] px-[3px] border border-[#d0d0d0] rounded-sm",n.disabled?"cursor-not-allowed":"cursor-pointer"]),disabled:n.disabled},null,10,ZX),[[E.vModelText,o.value]]),n.isTextInputShown?(E.openBlock(),E.createBlock(s,{key:0,modelValue:o.value,"onUpdate:modelValue":e[1]||(e[1]=a=>o.value=a),class:"ml-2",mask:t.HEX_MASK,disabled:n.disabled,clearable:""},null,8,["modelValue","mask","disabled"])):E.createCommentVNode("",!0)])}const QX=lt(XX,[["render",JX]]),eK=E.defineComponent({components:{QuillEditor:E.defineAsyncComponent(()=>typeof document<"u"?Promise.resolve().then(()=>Zne).then(t=>t.QuillEditor):"")}}),tK=E.createElementVNode("div",{id:"my-toolbar"},[E.createElementVNode("span",{class:"ql-formats"},[E.createElementVNode("select",{class:"ql-font"}),E.createElementVNode("select",{class:"ql-size"})]),E.createElementVNode("span",{class:"ql-formats"},[E.createElementVNode("button",{class:"ql-bold"}),E.createElementVNode("button",{class:"ql-italic"}),E.createElementVNode("button",{class:"ql-underline"}),E.createElementVNode("button",{class:"ql-strike"})]),E.createElementVNode("span",{class:"ql-formats"},[E.createElementVNode("select",{class:"ql-color"}),E.createElementVNode("select",{class:"ql-background"})]),E.createElementVNode("span",{class:"ql-formats"},[E.createElementVNode("button",{class:"ql-script",value:"sub"}),E.createElementVNode("button",{class:"ql-script",value:"super"})]),E.createElementVNode("span",{class:"ql-formats"},[E.createElementVNode("button",{class:"ql-header",value:"1"}),E.createElementVNode("button",{class:"ql-header",value:"2"}),E.createElementVNode("button",{class:"ql-blockquote"}),E.createElementVNode("button",{class:"ql-code-block"})]),E.createElementVNode("span",{class:"ql-formats"},[E.createElementVNode("button",{class:"ql-list",value:"ordered"}),E.createElementVNode("button",{class:"ql-list",value:"bullet"}),E.createElementVNode("button",{class:"ql-indent",value:"-1"}),E.createElementVNode("button",{class:"ql-indent",value:"+1"})]),E.createElementVNode("span",{class:"ql-formats"},[E.createElementVNode("button",{class:"ql-direction",value:"rtl"}),E.createElementVNode("select",{class:"ql-align"})]),E.createElementVNode("span",{class:"ql-formats"},[E.createElementVNode("button",{class:"ql-link"}),E.createElementVNode("button",{class:"ql-image"}),E.createElementVNode("button",{class:"ql-video"}),E.createElementVNode("button",{class:"ql-formula"})]),E.createElementVNode("span",{class:"ql-formats"},[E.createElementVNode("button",{class:"ql-clean"})])],-1);function nK(t,e,n,r,i,o){const s=E.resolveComponent("QuillEditor");return E.openBlock(),E.createBlock(s,{toolbar:"#my-toolbar"},{toolbar:E.withCtx(()=>[tK]),_:1})}const rK=lt(eK,[["render",nK]]),iK=E.defineComponent({props:{modelValue:{type:Array,default:()=>[]},disabled:{type:Boolean,default:()=>!1},placeholder:{type:String,default:()=>"Введіть теги.."}},emits:["update:modelValue"],data(){return{tags:this.modelValue,tagInput:"",isFocused:!1}},watch:{modelValue(t){this.tags=t},tags(t){this.$emit("update:modelValue",t)}},methods:{addTag(){this.tagInput.trim()!==""&&(this.tags.push(this.tagInput.trim()),this.tagInput="")},removeTag(t){this.tags.splice(t,1)}}}),oK=["onClick"],sK=["disabled","placeholder"],aK={key:0};function lK(t,e,n,r,i,o){return E.openBlock(),E.createElementBlock("span",{class:E.normalizeClass(["vs-form-tags relative flex flex-wrap gap-1 items-center py-2 px-3 transition-all block w-full border border-gray-200 rounded-lg !pr-8",{"ring-blue-500 border-blue-500":t.isFocused}])},[(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(t.tags,(s,a)=>(E.openBlock(),E.createElementBlock("span",{key:a,class:"bg-gray-200 px-1 rounded text-gray-500 text-xs flex items-center no-wrap"},[E.createTextVNode(E.toDisplayString(s)+" ",1),E.createElementVNode("i",{class:"ti ti-x cursor-pointer hover:text-blue-500 transition-all",onClick:u=>t.removeTag(a)},null,8,oK)]))),128)),E.withDirectives(E.createElementVNode("input",{disabled:t.disabled,placeholder:t.placeholder,"onUpdate:modelValue":e[0]||(e[0]=s=>t.tagInput=s),onFocus:e[1]||(e[1]=s=>t.isFocused=!0),onBlur:e[2]||(e[2]=s=>{t.isFocused=!1,t.addTag()}),onKeyup:e[3]||(e[3]=E.withKeys((...s)=>t.addTag&&t.addTag(...s),["enter"])),class:"vs-form-tags__input border-0 placeholder-gray-400 p-0 text-sm grow"},null,40,sK),[[E.vModelText,t.tagInput]]),t.tagInput.length?(E.openBlock(),E.createElementBlock("button",aK,[E.createElementVNode("i",{class:"absolute right-3 translate-y-2/4 bottom-1/2 ti ti-check cursor-pointer hover:text-blue-500 transition-all",onClick:e[4]||(e[4]=(...s)=>t.addTag&&t.addTag(...s))})])):E.createCommentVNode("",!0)],2)}const uK={components:{VsFormAutocomplete:Cy,VsFormSelect:Cy,VsFormSelect2:Cy,VsFormFilelist:L9,VsFormFile:G9,VsFormSwitcher:XS,VsFormMarkedtext:l8,VsFormText:m8,VsFormCheckbox:kN,VsFormRadio:d8,VsFormDatepicker:ZC,VsFormTextarea:E8,VsFormGeom:fX,VsFormNumber:PN,VsFormDatatable:FX,VsFormHtml:jX,VsFormEmail:zX,VsFormPhone:YX,VsFormColorpicker:QX,VsFormTexteditor:rK,VsFormTags:lt(iK,[["render",lK]])},computed:{pinComponents(){return this.formScheme.filter(t=>{var e;return(t==null?void 0:t.pin)||((e=t==null?void 0:t.original)==null?void 0:e.pin)})},nonPinComponents(){return this.formScheme.filter(t=>{var e;return!(t!=null&&t.pin)&&!((e=t==null?void 0:t.original)!=null&&e.pin)})},pinGroups(){return[this.nonPinComponents,this.pinComponents]},hasPinComponents(){var t;return(t=this.pinComponents)==null?void 0:t.length}},props:{id:{type:String,default:()=>""},scheme:{type:Array,default:()=>null},modelValue:{type:[Object,Array],default:()=>{}},api:{type:String,default:()=>""},table:{type:String,default:()=>""},token:{type:String,default:()=>""},layout:{type:Object,default:()=>({head:!1})}},provide(){return{formValues:E.computed(()=>this.formValues)}},data(){return{formId:"",formValues:{},formErrors:{},formScheme:[],behavior:{data:null,exist:!1}}},watch:{formValues:{deep:!0,handler(t,e){if(!Object.values(e||{}).length)return;this.behavior.exist&&(this.behavior.data=this.createBehavior());const n=this.createdNestedObject();this.$emit("update:modelValue",n),this.$emit("form-change",n)}}},async mounted(){this.formScheme=await this.getFormScheme(),this.setFromData(),this.behavior.data=this.createBehavior()},methods:{async getFormScheme(){if(this.api)try{const{data:t}=await Pt.get(this.api);return t.components}catch(t){return console.error(t),[]}return this.scheme},columnClass({original:t,key:e}){var i;const n=(t==null?void 0:t.col)||12,r=(i=this.formErrors)!=null&&i[e]?"col-error":"";return`col-md-${n} ${r}`},handleValidate(t,e){this.formErrors={...this.formErrors,[e]:t}},doValidation(){return new Promise((t,e)=>{this.formErrors=this.validation();const n=Object.keys(this.formErrors);n.length&&(this.$emit("onValidationError",n),e(new Error("validation error"))),t("submit")})},componentId(t){return`vs-form-${t.toLowerCase()}`},isComponentVisible(t){return t.toLowerCase()!=="hidden"},setFromData(){this.formValues=this.modelValue},fieldsIsRequired({validators:t}={}){return t?(t==null?void 0:t.findIndex(e=>e==="required"))!==-1:!1},validation(){const t={icon:"ti-alert-circle",message:"Це поле обов'язкове"},e=({validators:n,key:r}={})=>{var o,s,a,u,l;const i=this.formValues[r];return(!n||!((s=(o=this.behavior)==null?void 0:o.data)!=null&&s[r])||!n.includes("required")&&!i)&&!((a=this.formErrors)!=null&&a[r])?{}:!n&&((u=this.formErrors)!=null&&u[r])?{[r]:(l=this.formErrors)==null?void 0:l[r]}:n.reduce((f,c)=>c==="required"&&!i?{...f,[r]:(f[r]||[]).concat(t)}:typeof c=="object"&&(c!=null&&c.regexp)?new RegExp(c.regexp,(c==null?void 0:c.flags)||"gm").test(i)?f:{...f,[r]:(f[r]||[]).concat(c)}:f,{})};return this.formScheme.reduce((n,r)=>({...n,...e(r)}),{})},behaviorState({key:t}={}){var r;const e=this.behavior.data!==null,n=((r=this.behavior.data)==null?void 0:r[t])||!1;return e&&n},createBehavior(){const t=({show:n,hide:r}={})=>{const i=(o,s)=>(o==null?void 0:o.split(",").reduce((a,u)=>({...a,[u]:s}),{}))||{};return{...i(r,!1),...i(n,!0)}};return this.formScheme.reduce((n,r)=>{const{key:i,behavior:o,original:s}=r,a=o||(s==null?void 0:s.behavior),u=(n==null?void 0:n[i])===void 0?!0:n==null?void 0:n[i];if(a){this.behavior.exist=!0;const l=`${this.formValues[i]}`,f=Object.keys(a).includes(l)?l:"*",c={...f==="*"?{}:t(a["*"]),...t(a[f])};return{...n,[i]:u,...c}}return{...n,[i]:u}},{})},createdNestedObject(){const t=(r,i)=>{for(const o of Object.keys(i))i[o]instanceof Object&&Object.assign(i[o],t(r==null?void 0:r[o],i[o]));return Object.assign(r||{},i),r},e=(r,i)=>r.split(".").reduceRight((o,s)=>({[s]:o}),i);return Object.keys(this.formValues).reduce((r,i)=>{if(!i.includes("."))return{...r,[i]:this.formValues[i]};const o=e(i,this.formValues[i]);return t(o,r)},{})}}},cK={class:"vs-form",ref:"form"},fK={key:0,class:"vs-form__head mb-5 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},hK={class:"vs-form__body auto-rows-max container"},dK={class:"row"},pK={key:0,class:"flex items-center mb-2 text-sm font-medium text-gray-900"},gK={key:0,class:"ml-1 !text-red-600"},mK=E.createElementVNode("i",{class:"ti ti-info-circle-filled text-blue-400"},null,-1),yK={key:1,class:"errors"};function vK(t,e,n,r,i,o){const s=E.resolveComponent("vs-tooltip");return E.openBlock(),E.createElementBlock("div",cK,[n.layout.head?(E.openBlock(),E.createElementBlock("div",fK,[E.renderSlot(t.$slots,"header",E.normalizeProps(E.guardReactiveProps(o.doValidation)))])):E.createCommentVNode("",!0),E.createElementVNode("div",hK,[E.createElementVNode("div",dK,[(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(o.pinGroups,(a,u)=>(E.openBlock(),E.createElementBlock("div",{key:u,class:E.normalizeClass({"col-md-6 vs-form__pin-col":o.hasPinComponents})},[(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList(a,l=>{var f,c,h,d,g,y,b,_,p,m,v,w,N,S,C,O,M,T,I,A,L,B;return E.openBlock(),E.createElementBlock(E.Fragment,{key:l.key},[o.behaviorState(l)&&o.isComponentVisible(l.type)?(E.openBlock(),E.createElementBlock("div",{key:0,class:E.normalizeClass(["flex-shrink max-w-full mb-6 col-xs-12",o.columnClass(l)])},[l!=null&&l.ua||l!=null&&l.label?(E.openBlock(),E.createElementBlock("label",pK,[E.createTextVNode(E.toDisplayString((l==null?void 0:l.ua)||(l==null?void 0:l.label))+" ",1),o.fieldsIsRequired(l)?(E.openBlock(),E.createElementBlock("span",gK,"*")):E.createCommentVNode("",!0),l!=null&&l.info||(f=l==null?void 0:l.original)!=null&&f.info||l!=null&&l.i||(c=l==null?void 0:l.original)!=null&&c.i?(E.openBlock(),E.createBlock(s,{key:1,content:(l==null?void 0:l.info)||((h=l==null?void 0:l.original)==null?void 0:h.info)||(l==null?void 0:l.i)||((d=l==null?void 0:l.original)==null?void 0:d.i),class:"ml-1"},{reference:E.withCtx(()=>[mK]),_:2},1032,["content"])):E.createCommentVNode("",!0)])):E.createCommentVNode("",!0),(E.openBlock(),E.createBlock(E.resolveDynamicComponent(o.componentId(l.type)),{modelValue:t.formValues[l.key],"onUpdate:modelValue":$=>t.formValues[l.key]=$,parent:l.parent,"onUpdate:parent":$=>l.parent=$,id:n.id,componentKey:l.key,options:(l==null?void 0:l.options)||((g=l==null?void 0:l.original)==null?void 0:g.options)||null,placeholder:l==null?void 0:l.placeholder,searchable:l==null?void 0:l.searchable,icon:(l==null?void 0:l.icon)||((y=l==null?void 0:l.original)==null?void 0:y.icon),mask:(l==null?void 0:l.mask)||((b=l==null?void 0:l.original)==null?void 0:b.mask),iconPosition:(l==null?void 0:l.iconPosition)||((_=l==null?void 0:l.original)==null?void 0:_.iconPosition),data:(l==null?void 0:l.data)||((p=l==null?void 0:l.original)==null?void 0:p.data),multiple:(l==null?void 0:l.multiple)||((m=l==null?void 0:l.original)==null?void 0:m.multiple),multi:(l==null?void 0:l.multi)||((v=l==null?void 0:l.original)==null?void 0:v.multi),"input-type":(l==null?void 0:l.inputType)||((w=l==null?void 0:l.original)==null?void 0:w.inputType),defaultValue:l.defaultValue,table:n.table,token:n.token,original:l==null?void 0:l.original,clearable:(l==null?void 0:l.clearable)||((N=l==null?void 0:l.original)==null?void 0:N.clearable),label:(l==null?void 0:l.label)||((S=l==null?void 0:l.original)==null?void 0:S.label),"input-id":((C=l==null?void 0:l.original)==null?void 0:C.inputId)||(l==null?void 0:l.inputId),disabled:((O=l==null?void 0:l.original)==null?void 0:O.inputId)||(l==null?void 0:l.disabled),now:((M=l==null?void 0:l.original)==null?void 0:M.now)||(l==null?void 0:l.now),"col-model":((T=l==null?void 0:l.original)==null?void 0:T.colModel)||(l==null?void 0:l.colModel),"append-to-body":!0,text:((I=l==null?void 0:l.original)==null?void 0:I.text)||(l==null?void 0:l.text),mode:((A=l==null?void 0:l.original)==null?void 0:A.mode)||(l==null?void 0:l.mode),onValidate:$=>o.handleValidate($,l.key)},null,40,["modelValue","onUpdate:modelValue","parent","onUpdate:parent","id","componentKey","options","placeholder","searchable","icon","mask","iconPosition","data","multiple","multi","input-type","defaultValue","table","token","original","clearable","label","input-id","disabled","now","col-model","text","mode","onValidate"])),(L=t.formErrors)!=null&&L[l.key]?(E.openBlock(),E.createElementBlock("div",yK,[(E.openBlock(!0),E.createElementBlock(E.Fragment,null,E.renderList((B=t.formErrors)==null?void 0:B[l.key],($,G)=>(E.openBlock(),E.createElementBlock("div",{key:G,class:"text-red-600 text-xs"},[E.createElementVNode("i",{class:E.normalizeClass("ti "+(($==null?void 0:$.icon)||"ti-alert-circle"))},null,2),E.createTextVNode(" "+E.toDisplayString($.message),1)]))),128))])):E.createCommentVNode("",!0)],2)):E.createCommentVNode("",!0)],64)}),128))],2))),128))])])],512)}const tP=lt(uK,[["render",vK]]),_K={components:{VsForm:tP,VsButton:Uc},props:{mode:{type:String,default:()=>""},table:{type:String,default:()=>""},id:{type:String,default:()=>""},token:{type:String,default:()=>""},model:{type:String,default:()=>""},legacyDeps:{type:Boolean,default:()=>!1},scheme:{type:Object,default:()=>{}}},data(){return{formState:{error:"",loading:!0},formLayout:{head:!0},formId:"",formData:{},formMeta:{api:""},formScheme:null,refreshFormEvent:new CustomEvent("form-refresh")}},provide(){return{meta:E.computed(()=>({token:this.token,table:this.table,nextId:this.formId}))}},computed:{isAdd(){return window.location.pathname.match("/add")||this.mode==="add"},isEditing(){return(window.location.pathname.match("/edit")||this.mode==="edit")&&!this.isAdd},formatedScheme(){var t;return(t=this.formScheme)==null?void 0:t.components},formIsReady(){return!this.formState.loading},windowToken(){var t;return((t=window==null?void 0:window.v3cdep)==null?void 0:t.token)||""}},watch:{model(){this.initForm()}},beforeUnmount(){this.legacyDeps&&window.removeEventListener("form-data-change",this.handleFormDataChange)},async mounted(){this.legacyDeps&&window.addEventListener("form-data-change",this.handleFormDataChange),this.initForm()},methods:{async getFormId(){const t=async()=>{const{data:e}=await Pt.get("/api/next-id");return e.id};return this.isAdd?t():this.id},async getFormScheme(){try{if(this.scheme&&!this.table)return this.scheme;if(!this.table)return null;this.formState.loading=!0;const{data:t}=await Pt.get(`/api/template/form/${this.table}?formio=1`);return this.createFormMeta(t),this.token&&this.isEditing&&await this.getFormData(),this.formState.loading=!1,t}catch(t){return this.$notify({title:"Помилка!",message:"Помилка при завантаженні форми!",type:"error"}),this.formState.loading=!1,this.formState.error="Помилка під час завантаження форми!",console.error(t),null}},async getFormData(){try{const{data:t}=await Pt.get(`/api/${this.token}/${this.token}`);this.formData=t}catch(t){this.$notify({title:"Помилка!",message:"Помилка при отриманні данних!",type:"error"}),console.error(t)}},async editForm(){var t;try{const e=((t=this.formMeta)==null?void 0:t.api)||`/api/${this.token}/${this.token}`;await Pt.put(e,this.formData),this.$notify({title:"Успіх!",message:"Форму успішно редаговано!",type:"success"})}catch(e){throw this.$notify({title:"Помилка!",message:"Помилка при редагуванні форми!",type:"error"}),console.error(e),new Error("EditForm error")}},async createForm(){var t;try{const e=((t=this.formMeta)==null?void 0:t.api)||`/api/${this.token}/${this.formId}`;await Pt.post(e,this.formData),this.$notify({title:"Успіх!",message:"Форма успішно відправлена!",type:"success"}),this.resetFormData()}catch(e){throw this.$notify({title:"Помилка!",message:"Помилка при створенні форми!",type:"error"}),console.error(e),new Error("CreateForm error")}},async initForm(){this.formId=await this.getFormId(),this.formScheme=await this.getFormScheme()},handleFormDataChange(t){const e=t.detail||null;if(!(e!=null&&e.token)&&!(e!=null&&e.table))throw new Error("Table and Token aren't exist!");this.formState.loading=!1,this.formData={},this.formScheme=null,e!=null&&e.table&&this.$emit("update:table",e.table),e!=null&&e.token&&this.$emit("update:token",e.token),this.initForm()},applyFormChanges(t){t().then(this.editForm)},createFormMeta({api:t=""}){this.formMeta={api:t}},createBackUrl(){var n;const t=/back=([^&]+)/;if(window.location.href.match(t)){const i=((n=window.location.href.match(t))==null?void 0:n[0]).slice(5);return window.decodeURIComponent(i)}return null},goBack(){const t=this.createBackUrl();t?window!=null&&window.Backbone?window.Backbone.history.navigate(t,!0):window.history.pushState(null,"",t):window.history.go(-1),this.legacyDeps&&this.legacyWidgetRefresh()},handleCancel(){var e,n,r;this.$emit("cancel"),((r=(n=(e=this.$root)==null?void 0:e.$options)==null?void 0:n.name)==null?void 0:r.match("dialog"))?this.$root.modalClose():(this.resetFormData(),this.mode||this.goBack())},legacyWidgetRefresh(){window.widgetRefresh&&window.sid==="35"&&setTimeout(()=>{var n;const t=window.location.pathname.split("/")[1],e=(n=document.querySelector(`section[path="${t}"] [widget]`))==null?void 0:n.getAttribute("widget");window.widgetRefresh(e)},100)},handleSubmit(t){t().then(()=>{this.isAdd?this.createForm().then(this.goBack):this.isEditing&&this.editForm().then(this.goBack)})},handleValdidationError(){this.$notify({title:"Помилка!",message:"Перевірте правильність введених даних!",type:"error"})},resetFormData(){this.formData={},this.$nextTick(()=>{this.$refs.vsForm.setFromData(),window.dispatchEvent(this.refreshFormEvent)})}}},bK={class:"bg-white p-3"},EK={key:0,class:"animate-spin block m-auto w-8 h-8 border-[3px] border-current border-t-transparent text-blue-600 rounded-full",role:"status","aria-label":"loading"},wK=[E.createElementVNode("span",{class:"sr-only"},"Loading...",-1)],xK={key:1,class:"flex flex-col items-center"},SK=E.createElementVNode("i",{class:"ti ti-xbox-x text-4xl mb-1"},null,-1);function CK(t,e,n,r,i,o){const s=E.resolveComponent("VsButton"),a=E.resolveComponent("VsForm");return E.openBlock(),E.createElementBlock("div",bK,[E.createTextVNode(E.toDisplayString(o.windowToken)+" ",1),t.formState.loading&&!t.formScheme?(E.openBlock(),E.createElementBlock("div",EK,wK)):E.createCommentVNode("",!0),t.formState.error?(E.openBlock(),E.createElementBlock("div",xK,[SK,E.createTextVNode(" "+E.toDisplayString(t.formState.error),1)])):E.createCommentVNode("",!0),o.formIsReady&&t.formScheme?(E.openBlock(),E.createBlock(a,{key:2,ref:"vsForm",scheme:o.formatedScheme,onOnValidationError:o.handleValdidationError,table:n.table,token:n.token,id:t.formId,layout:t.formLayout,modelValue:t.formData,"onUpdate:modelValue":e[0]||(e[0]=u=>t.formData=u)},{header:E.withCtx(u=>[E.createVNode(s,{class:"mr-2",title:"Скасувати",color:"red",onClick:o.handleCancel},null,8,["onClick"]),o.isEditing?(E.openBlock(),E.createBlock(s,{key:0,class:"mr-2",title:"Застосувати",onClick:l=>o.applyFormChanges(u)},null,8,["onClick"])):E.createCommentVNode("",!0),E.createVNode(s,{title:"Зберегти",type:"primary",onClick:l=>o.handleSubmit(u)},null,8,["onClick"])]),_:1},8,["scheme","onOnValidationError","table","token","id","layout","modelValue"])):E.createCommentVNode("",!0)])}const nP=lt(_K,[["render",CK]]),rP=({message:t,title:e,type:n}={})=>{const r=document.querySelector(".p-toast__list");let i=r;const o=c=>{c.classList.remove("p-toast--visible"),c.classList.add("p-toast--hidden"),setTimeout(()=>{c.remove()},350)};r||(i=document.createElement("div"),i.className="p-toast__list vsTailwind",document.body.after(i));const s=document.createElement("div");s.addEventListener("click",()=>o(s)),s.className="p-toast vsTailwind p-toast--hidden";const a={error:'',success:''},u={success:"text-green-500 bg-green-100 dark:bg-green-800 dark:text-green-200",error:"text-red-500 bg-red-100 dark:bg-red-800 dark:text-red-200"},l=a[n],f=u[n];s.innerHTML=` `,i.after(s),setTimeout(()=>{i.classList.add("p-toast__list--move"),s.classList.remove("p-toast--hidden"),s.classList.add("p-toast--visible")},50),setTimeout(()=>{i.append(s),i.classList.remove("p-toast__list--move")},350),setTimeout(()=>{o(s)},3500)};var iP={};/** * @vue/shared v3.4.15 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/function zi(t,e){const n=new Set(t.split(","));return e?r=>n.has(r.toLowerCase()):r=>n.has(r)}const Cn=iP.NODE_ENV!=="production"?Object.freeze({}):{},kd=iP.NODE_ENV!=="production"?Object.freeze([]):[],ur=()=>{},Ig=()=>!1,hu=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),s0=t=>t.startsWith("onUpdate:"),Lt=Object.assign,xw=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},NK=Object.prototype.hasOwnProperty,pn=(t,e)=>NK.call(t,e),qe=Array.isArray,Pf=t=>Pd(t)==="[object Map]",Af=t=>Pd(t)==="[object Set]",oP=t=>Pd(t)==="[object Date]",OK=t=>Pd(t)==="[object RegExp]",dt=t=>typeof t=="function",bt=t=>typeof t=="string",Ta=t=>typeof t=="symbol",bn=t=>t!==null&&typeof t=="object",a0=t=>(bn(t)||dt(t))&&dt(t.then)&&dt(t.catch),sP=Object.prototype.toString,Pd=t=>sP.call(t),Sw=t=>Pd(t).slice(8,-1),aP=t=>Pd(t)==="[object Object]",Cw=t=>bt(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Lf=zi(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),lP=zi("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"),l0=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},TK=/-(\w)/g,Rr=l0(t=>t.replace(TK,(e,n)=>n?n.toUpperCase():"")),IK=/\B([A-Z])/g,yo=l0(t=>t.replace(IK,"-$1").toLowerCase()),hl=l0(t=>t.charAt(0).toUpperCase()+t.slice(1)),dl=l0(t=>t?`on${hl(t)}`:""),Ia=(t,e)=>!Object.is(t,e),cc=(t,e)=>{for(let n=0;n{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})},Mg=t=>{const e=parseFloat(t);return isNaN(e)?t:e},c0=t=>{const e=bt(t)?Number(t):NaN;return isNaN(e)?t:e};let uP;const Nw=()=>uP||(uP=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),pl={1:"TEXT",2:"CLASS",4:"STYLE",8:"PROPS",16:"FULL_PROPS",32:"NEED_HYDRATION",64:"STABLE_FRAGMENT",128:"KEYED_FRAGMENT",256:"UNKEYED_FRAGMENT",512:"NEED_PATCH",1024:"DYNAMIC_SLOTS",2048:"DEV_ROOT_FRAGMENT",[-1]:"HOISTED",[-2]:"BAIL"},MK={1:"STABLE",2:"DYNAMIC",3:"FORWARDED"},kK=zi("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error"),cP=2;function PK(t,e=0,n=t.length){let r=t.split(/(\r?\n)/);const i=r.filter((a,u)=>u%2===1);r=r.filter((a,u)=>u%2===0);let o=0;const s=[];for(let a=0;a=e){for(let u=a-cP;u<=a+cP||n>o;u++){if(u<0||u>=r.length)continue;const l=u+1;s.push(`${l}${" ".repeat(Math.max(3-String(l).length,0))}| ${r[u]}`);const f=r[u].length,c=i[u]&&i[u].length||0;if(u===a){const h=e-(o-(f+c)),d=Math.max(1,n>o?f-h:n-e);s.push(" | "+" ".repeat(h)+"^".repeat(d))}else if(u>a){if(n>o){const h=Math.max(Math.min(n-o,f),1);s.push(" | "+"^".repeat(h))}o+=f+c}}break}return s.join(` `)}function Ad(t){if(qe(t)){const e={};for(let n=0;n{if(n){const r=n.split(LK);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function RK(t){let e="";if(!t||bt(t))return e;for(const n in t){const r=t[n],i=n.startsWith("--")?n:yo(n);(bt(r)||typeof r=="number")&&(e+=`${i}:${r};`)}return e}function Ld(t){let e="";if(bt(t))e=t;else if(qe(t))for(let n=0;ndu(n,e))}const WK=t=>bt(t)?t:t==null?"":qe(t)||bn(t)&&(t.toString===sP||!dt(t.toString))?JSON.stringify(t,yP,2):String(t),yP=(t,e)=>e&&e.__v_isRef?yP(t,e.value):Pf(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((n,[r,i],o)=>(n[Tw(r,o)+" =>"]=i,n),{})}:Af(e)?{[`Set(${e.size})`]:[...e.values()].map(n=>Tw(n))}:Ta(e)?Tw(e):bn(e)&&!qe(e)&&!aP(e)?String(e):e,Tw=(t,e="")=>{var n;return Ta(t)?`Symbol(${(n=t.description)!=null?n:e})`:t};var Wr={};function h0(t,...e){console.warn(`[Vue warn] ${t}`,...e)}let ws;class Iw{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=ws,!e&&ws&&(this.index=(ws.scopes||(ws.scopes=[])).push(this)-1)}get active(){return this._active}run(e){if(this._active){const n=ws;try{return ws=this,e()}finally{ws=n}}else Wr.NODE_ENV!=="production"&&h0("cannot run an inactive effect scope.")}on(){ws=this}off(){ws=this.parent}stop(e){if(this._active){let n,r;for(n=0,r=this.effects.length;n=2))break}this._dirtyLevel<2&&(this._dirtyLevel=0),dc()}return this._dirtyLevel>=2}set dirty(e){this._dirtyLevel=e?2:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let e=fc,n=Df;try{return fc=!0,Df=this,this._runnings++,bP(this),this.fn()}finally{EP(this),this._runnings--,Df=n,fc=e}}stop(){var e;this.active&&(bP(this),EP(this),(e=this.onStop)==null||e.call(this),this.active=!1)}}function ZK(t){return t.value}function bP(t){t._trackId++,t._depsLength=0}function EP(t){if(t.deps&&t.deps.length>t._depsLength){for(let e=t._depsLength;e{n.dirty&&n.run()});e&&(Lt(n,e),e.scope&&vP(n,e.scope)),(!e||!e.lazy)&&n.run();const r=n.run.bind(n);return r.effect=n,r}function QK(t){t.effect.stop()}let fc=!0,Mw=0;const xP=[];function hc(){xP.push(fc),fc=!1}function dc(){const t=xP.pop();fc=t===void 0?!0:t}function kw(){Mw++}function Pw(){for(Mw--;!Mw&&Aw.length;)Aw.shift()()}function SP(t,e,n){var r;if(e.get(t)!==t._trackId){e.set(t,t._trackId);const i=t.deps[t._depsLength];i!==e?(i&&wP(i,t),t.deps[t._depsLength++]=e):t._depsLength++,Wr.NODE_ENV!=="production"&&((r=t.onTrack)==null||r.call(t,Lt({effect:t},n)))}}const Aw=[];function CP(t,e,n){var r;kw();for(const i of t.keys())if(i._dirtyLevel{const n=new Map;return n.cleanup=t,n.computed=e,n},d0=new WeakMap,Rf=Symbol(Wr.NODE_ENV!=="production"?"iterate":""),Lw=Symbol(Wr.NODE_ENV!=="production"?"Map key iterate":"");function no(t,e,n){if(fc&&Df){let r=d0.get(t);r||d0.set(t,r=new Map);let i=r.get(n);i||r.set(n,i=OP(()=>r.delete(n))),SP(Df,i,Wr.NODE_ENV!=="production"?{target:t,type:e,key:n}:void 0)}}function gl(t,e,n,r,i,o){const s=d0.get(t);if(!s)return;let a=[];if(e==="clear")a=[...s.values()];else if(n==="length"&&qe(t)){const u=Number(r);s.forEach((l,f)=>{(f==="length"||!Ta(f)&&f>=u)&&a.push(l)})}else switch(n!==void 0&&a.push(s.get(n)),e){case"add":qe(t)?Cw(n)&&a.push(s.get("length")):(a.push(s.get(Rf)),Pf(t)&&a.push(s.get(Lw)));break;case"delete":qe(t)||(a.push(s.get(Rf)),Pf(t)&&a.push(s.get(Lw)));break;case"set":Pf(t)&&a.push(s.get(Rf));break}kw();for(const u of a)u&&CP(u,2,Wr.NODE_ENV!=="production"?{target:t,type:e,key:n,newValue:r,oldValue:i,oldTarget:o}:void 0);Pw()}function eZ(t,e){var n;return(n=d0.get(t))==null?void 0:n.get(e)}const tZ=zi("__proto__,__v_isRef,__isVue"),TP=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Ta)),IP=nZ();function nZ(){const t={};return["includes","indexOf","lastIndexOf"].forEach(e=>{t[e]=function(...n){const r=Ct(this);for(let o=0,s=this.length;o{t[e]=function(...n){hc(),kw();const r=Ct(this)[e].apply(this,n);return Pw(),dc(),r}}),t}function rZ(t){const e=Ct(this);return no(e,"has",t),e.hasOwnProperty(t)}class MP{constructor(e=!1,n=!1){this._isReadonly=e,this._shallow=n}get(e,n,r){const i=this._isReadonly,o=this._shallow;if(n==="__v_isReactive")return!i;if(n==="__v_isReadonly")return i;if(n==="__v_isShallow")return o;if(n==="__v_raw")return r===(i?o?jP:$P:o?VP:BP).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const s=qe(e);if(!i){if(s&&pn(IP,n))return Reflect.get(IP,n,r);if(n==="hasOwnProperty")return rZ}const a=Reflect.get(e,n,r);return(Ta(n)?TP.has(n):tZ(n))||(i||no(e,"get",n),o)?a:di(a)?s&&Cw(n)?a:a.value:bn(a)?i?Rw(a):E0(a):a}}class kP extends MP{constructor(e=!1){super(!1,e)}set(e,n,r,i){let o=e[n];if(!this._shallow){const u=pu(o);if(!kg(r)&&!pu(r)&&(o=Ct(o),r=Ct(r)),!qe(e)&&di(o)&&!di(r))return u?!1:(o.value=r,!0)}const s=qe(e)&&Cw(n)?Number(n)t,p0=t=>Reflect.getPrototypeOf(t);function g0(t,e,n=!1,r=!1){t=t.__v_raw;const i=Ct(t),o=Ct(e);n||(Ia(e,o)&&no(i,"get",e),no(i,"get",o));const{has:s}=p0(i),a=r?Dw:n?Bw:Ag;if(s.call(i,e))return a(t.get(e));if(s.call(i,o))return a(t.get(o));t!==i&&t.get(e)}function m0(t,e=!1){const n=this.__v_raw,r=Ct(n),i=Ct(t);return e||(Ia(t,i)&&no(r,"has",t),no(r,"has",i)),t===i?n.has(t):n.has(t)||n.has(i)}function y0(t,e=!1){return t=t.__v_raw,!e&&no(Ct(t),"iterate",Rf),Reflect.get(t,"size",t)}function AP(t){t=Ct(t);const e=Ct(this);return p0(e).has.call(e,t)||(e.add(t),gl(e,"add",t,t)),this}function LP(t,e){e=Ct(e);const n=Ct(this),{has:r,get:i}=p0(n);let o=r.call(n,t);o?Wr.NODE_ENV!=="production"&&FP(n,r,t):(t=Ct(t),o=r.call(n,t));const s=i.call(n,t);return n.set(t,e),o?Ia(e,s)&&gl(n,"set",t,e,s):gl(n,"add",t,e),this}function DP(t){const e=Ct(this),{has:n,get:r}=p0(e);let i=n.call(e,t);i?Wr.NODE_ENV!=="production"&&FP(e,n,t):(t=Ct(t),i=n.call(e,t));const o=r?r.call(e,t):void 0,s=e.delete(t);return i&&gl(e,"delete",t,void 0,o),s}function RP(){const t=Ct(this),e=t.size!==0,n=Wr.NODE_ENV!=="production"?Pf(t)?new Map(t):new Set(t):void 0,r=t.clear();return e&&gl(t,"clear",void 0,void 0,n),r}function v0(t,e){return function(r,i){const o=this,s=o.__v_raw,a=Ct(s),u=e?Dw:t?Bw:Ag;return!t&&no(a,"iterate",Rf),s.forEach((l,f)=>r.call(i,u(l),u(f),o))}}function _0(t,e,n){return function(...r){const i=this.__v_raw,o=Ct(i),s=Pf(o),a=t==="entries"||t===Symbol.iterator&&s,u=t==="keys"&&s,l=i[t](...r),f=n?Dw:e?Bw:Ag;return!e&&no(o,"iterate",u?Lw:Rf),{next(){const{value:c,done:h}=l.next();return h?{value:c,done:h}:{value:a?[f(c[0]),f(c[1])]:f(c),done:h}},[Symbol.iterator](){return this}}}}function pc(t){return function(...e){if(Wr.NODE_ENV!=="production"){const n=e[0]?`on key "${e[0]}" `:"";console.warn(`${hl(t)} operation ${n}failed: target is readonly.`,Ct(this))}return t==="delete"?!1:t==="clear"?void 0:this}}function lZ(){const t={get(o){return g0(this,o)},get size(){return y0(this)},has:m0,add:AP,set:LP,delete:DP,clear:RP,forEach:v0(!1,!1)},e={get(o){return g0(this,o,!1,!0)},get size(){return y0(this)},has:m0,add:AP,set:LP,delete:DP,clear:RP,forEach:v0(!1,!0)},n={get(o){return g0(this,o,!0)},get size(){return y0(this,!0)},has(o){return m0.call(this,o,!0)},add:pc("add"),set:pc("set"),delete:pc("delete"),clear:pc("clear"),forEach:v0(!0,!1)},r={get(o){return g0(this,o,!0,!0)},get size(){return y0(this,!0)},has(o){return m0.call(this,o,!0)},add:pc("add"),set:pc("set"),delete:pc("delete"),clear:pc("clear"),forEach:v0(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(o=>{t[o]=_0(o,!1,!1),n[o]=_0(o,!0,!1),e[o]=_0(o,!1,!0),r[o]=_0(o,!0,!0)}),[t,n,e,r]}const[uZ,cZ,fZ,hZ]=lZ();function b0(t,e){const n=e?t?hZ:fZ:t?cZ:uZ;return(r,i,o)=>i==="__v_isReactive"?!t:i==="__v_isReadonly"?t:i==="__v_raw"?r:Reflect.get(pn(n,i)&&i in r?n:r,i,o)}const dZ={get:b0(!1,!1)},pZ={get:b0(!1,!0)},gZ={get:b0(!0,!1)},mZ={get:b0(!0,!0)};function FP(t,e,n){const r=Ct(n);if(r!==n&&e.call(t,r)){const i=Sw(t);console.warn(`Reactive ${i} contains both the raw and reactive versions of the same object${i==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const BP=new WeakMap,VP=new WeakMap,$P=new WeakMap,jP=new WeakMap;function yZ(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function vZ(t){return t.__v_skip||!Object.isExtensible(t)?0:yZ(Sw(t))}function E0(t){return pu(t)?t:w0(t,!1,iZ,dZ,BP)}function qP(t){return w0(t,!1,sZ,pZ,VP)}function Rw(t){return w0(t,!0,oZ,gZ,$P)}function Ff(t){return w0(t,!0,aZ,mZ,jP)}function w0(t,e,n,r,i){if(!bn(t))return Wr.NODE_ENV!=="production"&&console.warn(`value cannot be made reactive: ${String(t)}`),t;if(t.__v_raw&&!(e&&t.__v_isReactive))return t;const o=i.get(t);if(o)return o;const s=vZ(t);if(s===0)return t;const a=new Proxy(t,s===2?r:n);return i.set(t,a),a}function gc(t){return pu(t)?gc(t.__v_raw):!!(t&&t.__v_isReactive)}function pu(t){return!!(t&&t.__v_isReadonly)}function kg(t){return!!(t&&t.__v_isShallow)}function Pg(t){return gc(t)||pu(t)}function Ct(t){const e=t&&t.__v_raw;return e?Ct(e):t}function Fw(t){return u0(t,"__v_skip",!0),t}const Ag=t=>bn(t)?E0(t):t,Bw=t=>bn(t)?Rw(t):t;class UP{constructor(e,n,r,i){this._setter=n,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new Dd(()=>e(this._value),()=>Rd(this,1),()=>this.dep&&NP(this.dep)),this.effect.computed=this,this.effect.active=this._cacheable=!i,this.__v_isReadonly=r}get value(){const e=Ct(this);return(!e._cacheable||e.effect.dirty)&&Ia(e._value,e._value=e.effect.run())&&Rd(e,2),Vw(e),e.effect._dirtyLevel>=1&&Rd(e,1),e._value}set value(e){this._setter(e)}get _dirty(){return this.effect.dirty}set _dirty(e){this.effect.dirty=e}}function _Z(t,e,n=!1){let r,i;const o=dt(t);o?(r=t,i=Wr.NODE_ENV!=="production"?()=>{console.warn("Write operation failed: computed value is readonly")}:ur):(r=t.get,i=t.set);const s=new UP(r,i,o||!i,n);return Wr.NODE_ENV!=="production"&&e&&!n&&(s.effect.onTrack=e.onTrack,s.effect.onTrigger=e.onTrigger),s}function Vw(t){fc&&Df&&(t=Ct(t),SP(Df,t.dep||(t.dep=OP(()=>t.dep=void 0,t instanceof UP?t:void 0)),Wr.NODE_ENV!=="production"?{target:t,type:"get",key:"value"}:void 0))}function Rd(t,e=2,n){t=Ct(t);const r=t.dep;r&&CP(r,e,Wr.NODE_ENV!=="production"?{target:t,type:"set",key:"value",newValue:n}:void 0)}function di(t){return!!(t&&t.__v_isRef===!0)}function Bf(t){return zP(t,!1)}function bZ(t){return zP(t,!0)}function zP(t,e){return di(t)?t:new EZ(t,e)}class EZ{constructor(e,n){this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?e:Ct(e),this._value=n?e:Ag(e)}get value(){return Vw(this),this._value}set value(e){const n=this.__v_isShallow||kg(e)||pu(e);e=n?e:Ct(e),Ia(e,this._rawValue)&&(this._rawValue=e,this._value=n?e:Ag(e),Rd(this,2,e))}}function wZ(t){Rd(t,2,Wr.NODE_ENV!=="production"?t.value:void 0)}function $w(t){return di(t)?t.value:t}function xZ(t){return dt(t)?t():$w(t)}const SZ={get:(t,e,n)=>$w(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const i=t[e];return di(i)&&!di(n)?(i.value=n,!0):Reflect.set(t,e,n,r)}};function jw(t){return gc(t)?t:new Proxy(t,SZ)}class CZ{constructor(e){this.dep=void 0,this.__v_isRef=!0;const{get:n,set:r}=e(()=>Vw(this),()=>Rd(this));this._get=n,this._set=r}get value(){return this._get()}set value(e){this._set(e)}}function HP(t){return new CZ(t)}function NZ(t){Wr.NODE_ENV!=="production"&&!Pg(t)&&console.warn("toRefs() expects a reactive object but received a plain one.");const e=qe(t)?new Array(t.length):{};for(const n in t)e[n]=GP(t,n);return e}class OZ{constructor(e,n,r){this._object=e,this._key=n,this._defaultValue=r,this.__v_isRef=!0}get value(){const e=this._object[this._key];return e===void 0?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return eZ(Ct(this._object),this._key)}}class TZ{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function IZ(t,e,n){return di(t)?t:dt(t)?new TZ(t):bn(t)&&arguments.length>1?GP(t,e,n):Bf(t)}function GP(t,e,n){const r=t[e];return di(r)?r:new OZ(t,e,n)}const MZ={GET:"get",HAS:"has",ITERATE:"iterate"},kZ={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"};var re={};const Vf=[];function Lg(t){Vf.push(t)}function Dg(){Vf.pop()}function Ne(t,...e){hc();const n=Vf.length?Vf[Vf.length-1].component:null,r=n&&n.appContext.config.warnHandler,i=PZ();if(r)ml(r,n,11,[t+e.join(""),n&&n.proxy,i.map(({vnode:o})=>`at <${X0(n,o.type)}>`).join(` `),i]);else{const o=[`[Vue warn]: ${t}`,...e];i.length&&o.push(` `,...AZ(i)),console.warn(...o)}dc()}function PZ(){let t=Vf[Vf.length-1];if(!t)return[];const e=[];for(;t;){const n=e[0];n&&n.vnode===t?n.recurseCount++:e.push({vnode:t,recurseCount:0});const r=t.component&&t.component.parent;t=r&&r.vnode}return e}function AZ(t){const e=[];return t.forEach((n,r)=>{e.push(...r===0?[]:[` `],...LZ(n))}),e}function LZ({vnode:t,recurseCount:e}){const n=e>0?`... (${e} recursive calls)`:"",r=t.component?t.component.parent==null:!1,i=` at <${X0(t.component,t.type,r)}`,o=">"+n;return t.props?[i,...DZ(t.props),o]:[i+o]}function DZ(t){const e=[],n=Object.keys(t);return n.slice(0,3).forEach(r=>{e.push(...YP(r,t[r]))}),n.length>3&&e.push(" ..."),e}function YP(t,e,n){return bt(e)?(e=JSON.stringify(e),n?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?n?e:[`${t}=${e}`]:di(e)?(e=YP(t,Ct(e.value),!0),n?e:[`${t}=Ref<`,e,">"]):dt(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=Ct(e),n?e:[`${t}=`,e])}function qw(t,e){re.NODE_ENV!=="production"&&t!==void 0&&(typeof t!="number"?Ne(`${e} is not a valid number - got ${JSON.stringify(t)}.`):isNaN(t)&&Ne(`${e} is NaN - the duration expression might be incorrect.`))}const RZ={SETUP_FUNCTION:0,0:"SETUP_FUNCTION",RENDER_FUNCTION:1,1:"RENDER_FUNCTION",WATCH_GETTER:2,2:"WATCH_GETTER",WATCH_CALLBACK:3,3:"WATCH_CALLBACK",WATCH_CLEANUP:4,4:"WATCH_CLEANUP",NATIVE_EVENT_HANDLER:5,5:"NATIVE_EVENT_HANDLER",COMPONENT_EVENT_HANDLER:6,6:"COMPONENT_EVENT_HANDLER",VNODE_HOOK:7,7:"VNODE_HOOK",DIRECTIVE_HOOK:8,8:"DIRECTIVE_HOOK",TRANSITION_HOOK:9,9:"TRANSITION_HOOK",APP_ERROR_HANDLER:10,10:"APP_ERROR_HANDLER",APP_WARN_HANDLER:11,11:"APP_WARN_HANDLER",FUNCTION_REF:12,12:"FUNCTION_REF",ASYNC_COMPONENT_LOADER:13,13:"ASYNC_COMPONENT_LOADER",SCHEDULER:14,14:"SCHEDULER"},x0={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."};function ml(t,e,n,r){let i;try{i=r?t(...r):t()}catch(o){mc(o,e,n)}return i}function xs(t,e,n,r){if(dt(t)){const o=ml(t,e,n,r);return o&&a0(o)&&o.catch(s=>{mc(s,e,n)}),o}const i=[];for(let o=0;o>>1,i=vo[r],o=Vg(i);oyl&&vo.splice(e,1)}function Bg(t){qe(t)?Fd.push(...t):(!gu||!gu.includes(t,t.allowRecurse?yc+1:yc))&&Fd.push(t),XP()}function KP(t,e,n=Rg?yl+1:0){for(re.NODE_ENV!=="production"&&(e=e||new Map);nVg(n)-Vg(r));if(Fd.length=0,gu){gu.push(...e);return}for(gu=e,re.NODE_ENV!=="production"&&(t=t||new Map),yc=0;yct.id==null?1/0:t.id,jZ=(t,e)=>{const n=Vg(t)-Vg(e);if(n===0){if(t.pre&&!e.pre)return-1;if(e.pre&&!t.pre)return 1}return n};function ZP(t){Uw=!1,Rg=!0,re.NODE_ENV!=="production"&&(t=t||new Map),vo.sort(jZ);const e=re.NODE_ENV!=="production"?n=>Hw(t,n):ur;try{for(yl=0;ylBZ){const r=e.ownerInstance,i=r&&sm(r.type);return mc(`Maximum recursive updates exceeded${i?` in component <${i}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}else t.set(e,n+1)}}let vc=!1;const Bd=new Set;re.NODE_ENV!=="production"&&(Nw().__VUE_HMR_RUNTIME__={createRecord:Gw(JP),rerender:Gw(zZ),reload:Gw(HZ)});const $f=new Map;function qZ(t){const e=t.type.__hmrId;let n=$f.get(e);n||(JP(e,t.type),n=$f.get(e)),n.instances.add(t)}function UZ(t){$f.get(t.type.__hmrId).instances.delete(t)}function JP(t,e){return $f.has(t)?!1:($f.set(t,{initialDef:$g(e),instances:new Set}),!0)}function $g(t){return vL(t)?t.__vccOpts:t}function zZ(t,e){const n=$f.get(t);n&&(n.initialDef.render=e,[...n.instances].forEach(r=>{e&&(r.render=e,$g(r.type).render=e),r.renderCache=[],vc=!0,r.effect.dirty=!0,r.update(),vc=!1}))}function HZ(t,e){const n=$f.get(t);if(!n)return;e=$g(e),QP(n.initialDef,e);const r=[...n.instances];for(const i of r){const o=$g(i.type);Bd.has(o)||(o!==n.initialDef&&QP(o,e),Bd.add(o)),i.appContext.propsCache.delete(i.type),i.appContext.emitsCache.delete(i.type),i.appContext.optionsCache.delete(i.type),i.ceReload?(Bd.add(o),i.ceReload(e.styles),Bd.delete(o)):i.parent?(i.parent.effect.dirty=!0,Fg(i.parent.update)):i.appContext.reload?i.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required.")}Bg(()=>{for(const i of r)Bd.delete($g(i.type))})}function QP(t,e){Lt(t,e);for(const n in t)n!=="__file"&&!(n in e)&&delete t[n]}function Gw(t){return(e,n)=>{try{return t(e,n)}catch(r){console.error(r),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let Ma,jg=[],Yw=!1;function qg(t,...e){Ma?Ma.emit(t,...e):Yw||jg.push({event:t,args:e})}function Ww(t,e){var n,r;Ma=t,Ma?(Ma.enabled=!0,jg.forEach(({event:i,args:o})=>Ma.emit(i,...o)),jg=[]):typeof window<"u"&&window.HTMLElement&&!((r=(n=window.navigator)==null?void 0:n.userAgent)!=null&&r.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(o=>{Ww(o,e)}),setTimeout(()=>{Ma||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,Yw=!0,jg=[])},3e3)):(Yw=!0,jg=[])}function GZ(t,e){qg("app:init",t,e,{Fragment:Hi,Text:Ec,Comment:Xr,Static:wc})}function YZ(t){qg("app:unmount",t)}const Xw=Kw("component:added"),eA=Kw("component:updated"),WZ=Kw("component:removed"),XZ=t=>{Ma&&typeof Ma.cleanupBuffer=="function"&&!Ma.cleanupBuffer(t)&&WZ(t)};function Kw(t){return e=>{qg(t,e.appContext.app,e.uid,e.parent?e.parent.uid:void 0,e)}}const KZ=tA("perf:start"),ZZ=tA("perf:end");function tA(t){return(e,n,r)=>{qg(t,e.appContext.app,e.uid,e,n,r)}}function JZ(t,e,n){qg("component:emit",t.appContext.app,t,e,n)}function QZ(t,e,...n){if(t.isUnmounted)return;const r=t.vnode.props||Cn;if(re.NODE_ENV!=="production"){const{emitsOptions:f,propsOptions:[c]}=t;if(f)if(!(e in f))(!c||!(dl(e)in c))&&Ne(`Component emitted event "${e}" but it is neither declared in the emits option nor as an "${dl(e)}" prop.`);else{const h=f[e];dt(h)&&(h(...n)||Ne(`Invalid event arguments: event validation failed for event "${e}".`))}}let i=n;const o=e.startsWith("update:"),s=o&&e.slice(7);if(s&&s in r){const f=`${s==="modelValue"?"model":s}Modifiers`,{number:c,trim:h}=r[f]||Cn;h&&(i=n.map(d=>bt(d)?d.trim():d)),c&&(i=n.map(Mg))}if(re.NODE_ENV!=="production"&&JZ(t,e,i),re.NODE_ENV!=="production"){const f=e.toLowerCase();f!==e&&r[dl(f)]&&Ne(`Event "${f}" is emitted in component ${X0(t,t.type)} but the handler is registered for "${e}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${yo(e)}" instead of "${e}".`)}let a,u=r[a=dl(e)]||r[a=dl(Rr(e))];!u&&o&&(u=r[a=dl(yo(e))]),u&&xs(u,t,6,i);const l=r[a+"Once"];if(l){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,xs(l,t,6,i)}}function nA(t,e,n=!1){const r=e.emitsCache,i=r.get(t);if(i!==void 0)return i;const o=t.emits;let s={},a=!1;if(!dt(t)){const u=l=>{const f=nA(l,e,!0);f&&(a=!0,Lt(s,f))};!n&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}return!o&&!a?(bn(t)&&r.set(t,null),null):(qe(o)?o.forEach(u=>s[u]=null):Lt(s,o),bn(t)&&r.set(t,s),s)}function N0(t,e){return!t||!hu(e)?!1:(e=e.slice(2).replace(/Once$/,""),pn(t,e[0].toLowerCase()+e.slice(1))||pn(t,yo(e))||pn(t,e))}let Lr=null,O0=null;function Ug(t){const e=Lr;return Lr=t,O0=t&&t.type.__scopeId||null,e}function eJ(t){O0=t}function tJ(){O0=null}const nJ=t=>Zw;function Zw(t,e=Lr,n){if(!e||t._n)return t;const r=(...i)=>{r._d&&wx(-1);const o=Ug(e);let s;try{s=t(...i)}finally{Ug(o),r._d&&wx(1)}return re.NODE_ENV!=="production"&&eA(e),s};return r._n=!0,r._c=!0,r._d=!0,r}let Jw=!1;function T0(){Jw=!0}function I0(t){const{type:e,vnode:n,proxy:r,withProxy:i,props:o,propsOptions:[s],slots:a,attrs:u,emit:l,render:f,renderCache:c,data:h,setupState:d,ctx:g,inheritAttrs:y}=t;let b,_;const p=Ug(t);re.NODE_ENV!=="production"&&(Jw=!1);try{if(n.shapeFlag&4){const w=i||r,N=re.NODE_ENV!=="production"&&d.__isScriptSetup?new Proxy(w,{get(S,C,O){return Ne(`Property '${String(C)}' was accessed via 'this'. Avoid using 'this' in templates.`),Reflect.get(S,C,O)}}):w;b=es(f.call(N,w,c,o,d,h,g)),_=u}else{const w=e;re.NODE_ENV!=="production"&&u===o&&T0(),b=es(w.length>1?w(o,re.NODE_ENV!=="production"?{get attrs(){return T0(),u},slots:a,emit:l}:{attrs:u,slots:a,emit:l}):w(o,null)),_=e.props?u:rJ(u)}}catch(w){rm.length=0,mc(w,t,1),b=vr(Xr)}let m=b,v;if(re.NODE_ENV!=="production"&&b.patchFlag>0&&b.patchFlag&2048&&([m,v]=rA(b)),_&&y!==!1){const w=Object.keys(_),{shapeFlag:N}=m;if(w.length){if(N&7)s&&w.some(s0)&&(_=iJ(_,s)),m=na(m,_);else if(re.NODE_ENV!=="production"&&!Jw&&m.type!==Xr){const S=Object.keys(u),C=[],O=[];for(let M=0,T=S.length;M renders non-element root node that cannot be animated."),m.transition=n.transition),re.NODE_ENV!=="production"&&v?v(m):b=m,Ug(p),b}const rA=t=>{const e=t.children,n=t.dynamicChildren,r=M0(e,!1);if(r){if(re.NODE_ENV!=="production"&&r.patchFlag>0&&r.patchFlag&2048)return rA(r)}else return[t,void 0];const i=e.indexOf(r),o=n?n.indexOf(r):-1,s=a=>{e[i]=a,n&&(o>-1?n[o]=a:a.patchFlag>0&&(t.dynamicChildren=[...n,a]))};return[es(r),s]};function M0(t,e=!0){let n;for(let r=0;r0&&n.patchFlag&2048)return M0(n.children)}}else return}return n}const rJ=t=>{let e;for(const n in t)(n==="class"||n==="style"||hu(n))&&((e||(e={}))[n]=t[n]);return e},iJ=(t,e)=>{const n={};for(const r in t)(!s0(r)||!(r.slice(9)in e))&&(n[r]=t[r]);return n},iA=t=>t.shapeFlag&7||t.type===Xr;function oJ(t,e,n){const{props:r,children:i,component:o}=t,{props:s,children:a,patchFlag:u}=e,l=o.emitsOptions;if(re.NODE_ENV!=="production"&&(i||a)&&vc||e.dirs||e.transition)return!0;if(n&&u>=0){if(u&1024)return!0;if(u&16)return r?oA(r,s,l):!!s;if(u&8){const f=e.dynamicProps;for(let c=0;ct.__isSuspense;let nx=0;const cJ={name:"Suspense",__isSuspense:!0,process(t,e,n,r,i,o,s,a,u,l){if(t==null)fJ(e,n,r,i,o,s,a,u,l);else{if(o&&o.deps>0){e.suspense=t.suspense;return}hJ(t,e,n,r,i,s,a,u,l)}},hydrate:dJ,create:rx,normalize:pJ};function zg(t,e){const n=t.props&&t.props[e];dt(n)&&n()}function fJ(t,e,n,r,i,o,s,a,u){const{p:l,o:{createElement:f}}=u,c=f("div"),h=t.suspense=rx(t,i,r,e,c,n,o,s,a,u);l(null,h.pendingBranch=t.ssContent,c,null,r,h,o,s),h.deps>0?(zg(t,"onPending"),zg(t,"onFallback"),l(null,t.ssFallback,e,n,r,null,o,s),Vd(h,t.ssFallback)):h.resolve(!1,!0)}function hJ(t,e,n,r,i,o,s,a,{p:u,um:l,o:{createElement:f}}){const c=e.suspense=t.suspense;c.vnode=e,e.el=t.el;const h=e.ssContent,d=e.ssFallback,{activeBranch:g,pendingBranch:y,isInFallback:b,isHydrating:_}=c;if(y)c.pendingBranch=h,ka(h,y)?(u(y,h,c.hiddenContainer,null,i,c,o,s,a),c.deps<=0?c.resolve():b&&(_||(u(g,d,n,r,i,null,o,s,a),Vd(c,d)))):(c.pendingId=nx++,_?(c.isHydrating=!1,c.activeBranch=y):l(y,i,c),c.deps=0,c.effects.length=0,c.hiddenContainer=f("div"),b?(u(null,h,c.hiddenContainer,null,i,c,o,s,a),c.deps<=0?c.resolve():(u(g,d,n,r,i,null,o,s,a),Vd(c,d))):g&&ka(h,g)?(u(g,h,n,r,i,c,o,s,a),c.resolve(!0)):(u(null,h,c.hiddenContainer,null,i,c,o,s,a),c.deps<=0&&c.resolve()));else if(g&&ka(h,g))u(g,h,n,r,i,c,o,s,a),Vd(c,h);else if(zg(e,"onPending"),c.pendingBranch=h,h.shapeFlag&512?c.pendingId=h.component.suspenseId:c.pendingId=nx++,u(null,h,c.hiddenContainer,null,i,c,o,s,a),c.deps<=0)c.resolve();else{const{timeout:p,pendingId:m}=c;p>0?setTimeout(()=>{c.pendingId===m&&c.fallback(d)},p):p===0&&c.fallback(d)}}let lA=!1;function rx(t,e,n,r,i,o,s,a,u,l,f=!1){re.NODE_ENV!=="production"&&!lA&&(lA=!0,console[console.info?"info":"log"](" is an experimental feature and its API will likely change."));const{p:c,m:h,um:d,n:g,o:{parentNode:y,remove:b}}=l;let _;const p=gJ(t);p&&e!=null&&e.pendingBranch&&(_=e.pendingId,e.deps++);const m=t.props?c0(t.props.timeout):void 0;re.NODE_ENV!=="production"&&qw(m,"Suspense timeout");const v=o,w={vnode:t,parent:e,parentComponent:n,namespace:s,container:r,hiddenContainer:i,deps:0,pendingId:nx++,timeout:typeof m=="number"?m:-1,activeBranch:null,pendingBranch:null,isInFallback:!f,isHydrating:f,isUnmounted:!1,effects:[],resolve(N=!1,S=!1){if(re.NODE_ENV!=="production"){if(!N&&!w.pendingBranch)throw new Error("suspense.resolve() is called without a pending branch.");if(w.isUnmounted)throw new Error("suspense.resolve() is called on an already unmounted suspense boundary.")}const{vnode:C,activeBranch:O,pendingBranch:M,pendingId:T,effects:I,parentComponent:A,container:L}=w;let B=!1;w.isHydrating?w.isHydrating=!1:N||(B=O&&M.transition&&M.transition.mode==="out-in",B&&(O.transition.afterLeave=()=>{T===w.pendingId&&(h(M,L,o===v?g(O):o,0),Bg(I))}),O&&(y(O.el)!==w.hiddenContainer&&(o=g(O)),d(O,A,w,!0)),B||h(M,L,o,0)),Vd(w,M),w.pendingBranch=null,w.isInFallback=!1;let $=w.parent,G=!1;for(;$;){if($.pendingBranch){$.effects.push(...I),G=!0;break}$=$.parent}!G&&!B&&Bg(I),w.effects=[],p&&e&&e.pendingBranch&&_===e.pendingId&&(e.deps--,e.deps===0&&!S&&e.resolve()),zg(C,"onResolve")},fallback(N){if(!w.pendingBranch)return;const{vnode:S,activeBranch:C,parentComponent:O,container:M,namespace:T}=w;zg(S,"onFallback");const I=g(C),A=()=>{w.isInFallback&&(c(null,N,M,I,O,null,T,a,u),Vd(w,N))},L=N.transition&&N.transition.mode==="out-in";L&&(C.transition.afterLeave=A),w.isInFallback=!0,d(C,O,null,!0),L||A()},move(N,S,C){w.activeBranch&&h(w.activeBranch,N,S,C),w.container=N},next(){return w.activeBranch&&g(w.activeBranch)},registerDep(N,S){const C=!!w.pendingBranch;C&&w.deps++;const O=N.vnode.el;N.asyncDep.catch(M=>{mc(M,N,0)}).then(M=>{if(N.isUnmounted||w.isUnmounted||w.pendingId!==N.suspenseId)return;N.asyncResolved=!0;const{vnode:T}=N;re.NODE_ENV!=="production"&&Lg(T),kx(N,M,!1),O&&(T.el=O);const I=!O&&N.subTree.el;S(N,T,y(O||N.subTree.el),O?null:g(N.subTree),w,s,u),I&&b(I),Qw(N,T.el),re.NODE_ENV!=="production"&&Dg(),C&&--w.deps===0&&w.resolve()})},unmount(N,S){w.isUnmounted=!0,w.activeBranch&&d(w.activeBranch,n,N,S),w.pendingBranch&&d(w.pendingBranch,n,N,S)}};return w}function dJ(t,e,n,r,i,o,s,a,u){const l=e.suspense=rx(e,r,n,t.parentNode,document.createElement("div"),null,i,o,s,a,!0),f=u(t,l.pendingBranch=e.ssContent,n,l,o,s);return l.deps===0&&l.resolve(!1,!0),f}function pJ(t){const{shapeFlag:e,children:n}=t,r=e&32;t.ssContent=uA(r?n.default:n),t.ssFallback=r?uA(n.fallback):vr(Xr)}function uA(t){let e;if(dt(t)){const n=Yf&&t._c;n&&(t._d=!1,z0()),t=t(),n&&(t._d=!0,e=Qo,iL())}if(qe(t)){const n=M0(t);re.NODE_ENV!=="production"&&!n&&t.filter(r=>r!==ex).length>0&&Ne(" slots expect a single root node."),t=n}return t=es(t),e&&!t.dynamicChildren&&(t.dynamicChildren=e.filter(n=>n!==t)),t}function cA(t,e){e&&e.pendingBranch?qe(t)?e.effects.push(...t):e.effects.push(t):Bg(t)}function Vd(t,e){t.activeBranch=e;const{vnode:n,parentComponent:r}=t;let i=e.el;for(;!i&&e.component;)e=e.component.subTree,i=e.el;n.el=i,r&&r.subTree===n&&(r.vnode.el=i,Qw(r,i))}function gJ(t){var e;return((e=t.props)==null?void 0:e.suspensible)!=null&&t.props.suspensible!==!1}const fA=Symbol.for("v-scx"),hA=()=>{{const t=Qg(fA);return t||re.NODE_ENV!=="production"&&Ne("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."),t}};function mJ(t,e){return Gg(t,null,e)}function dA(t,e){return Gg(t,null,re.NODE_ENV!=="production"?Lt({},e,{flush:"post"}):{flush:"post"})}function pA(t,e){return Gg(t,null,re.NODE_ENV!=="production"?Lt({},e,{flush:"sync"}):{flush:"sync"})}const P0={};function Hg(t,e,n){return re.NODE_ENV!=="production"&&!dt(e)&&Ne("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature."),Gg(t,e,n)}function Gg(t,e,{immediate:n,deep:r,flush:i,once:o,onTrack:s,onTrigger:a}=Cn){if(e&&o){const S=e;e=(...C)=>{S(...C),N()}}re.NODE_ENV!=="production"&&r!==void 0&&typeof r=="number"&&Ne('watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.'),re.NODE_ENV!=="production"&&!e&&(n!==void 0&&Ne('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),r!==void 0&&Ne('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),o!==void 0&&Ne('watch() "once" option is only respected when using the watch(source, callback, options?) signature.'));const u=S=>{Ne("Invalid watch source: ",S,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},l=Kr,f=S=>r===!0?S:jf(S,r===!1?1:void 0);let c,h=!1,d=!1;if(di(t)?(c=()=>t.value,h=kg(t)):gc(t)?(c=()=>f(t),h=!0):qe(t)?(d=!0,h=t.some(S=>gc(S)||kg(S)),c=()=>t.map(S=>{if(di(S))return S.value;if(gc(S))return f(S);if(dt(S))return ml(S,l,2);re.NODE_ENV!=="production"&&u(S)})):dt(t)?e?c=()=>ml(t,l,2):c=()=>(g&&g(),xs(t,l,3,[y])):(c=ur,re.NODE_ENV!=="production"&&u(t)),e&&r){const S=c;c=()=>jf(S())}let g,y=S=>{g=v.onStop=()=>{ml(S,l,4),g=v.onStop=void 0}},b;if(im)if(y=ur,e?n&&xs(e,l,3,[c(),d?[]:void 0,y]):c(),i==="sync"){const S=hA();b=S.__watcherHandles||(S.__watcherHandles=[])}else return ur;let _=d?new Array(t.length).fill(P0):P0;const p=()=>{if(!(!v.active||!v.dirty))if(e){const S=v.run();(r||h||(d?S.some((C,O)=>Ia(C,_[O])):Ia(S,_)))&&(g&&g(),xs(e,l,3,[S,_===P0?void 0:d&&_[0]===P0?[]:_,y]),_=S)}else v.run()};p.allowRecurse=!!e;let m;i==="sync"?m=p:i==="post"?m=()=>ro(p,l&&l.suspense):(p.pre=!0,l&&(p.id=l.uid),m=()=>Fg(p));const v=new Dd(c,ur,m),w=_P(),N=()=>{v.stop(),w&&xw(w.effects,v)};return re.NODE_ENV!=="production"&&(v.onTrack=s,v.onTrigger=a),e?n?p():_=v.run():i==="post"?ro(v.run.bind(v),l&&l.suspense):v.run(),b&&b.push(N),N}function yJ(t,e,n){const r=this.proxy,i=bt(t)?t.includes(".")?gA(r,t):()=>r[t]:t.bind(r,r);let o;dt(e)?o=e:(o=e.handler,n=e);const s=Wf(this),a=Gg(i,o.bind(r),n);return s(),a}function gA(t,e){const n=e.split(".");return()=>{let r=t;for(let i=0;i0){if(n>=e)return t;n++}if(r=r||new Set,r.has(t))return t;if(r.add(t),di(t))jf(t.value,e,n,r);else if(qe(t))for(let i=0;i{jf(i,e,n,r)});else if(aP(t))for(const i in t)jf(t[i],e,n,r);return t}function mA(t){lP(t)&&Ne("Do not use built-in directive ids as custom directive id: "+t)}function vJ(t,e){if(Lr===null)return re.NODE_ENV!=="production"&&Ne("withDirectives can only be used inside render functions."),t;const n=W0(Lr)||Lr.proxy,r=t.dirs||(t.dirs=[]);for(let i=0;i{t.isMounted=!0}),F0(()=>{t.isUnmounting=!0}),t}const ta=[Function,Array],ox={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:ta,onEnter:ta,onAfterEnter:ta,onEnterCancelled:ta,onBeforeLeave:ta,onLeave:ta,onAfterLeave:ta,onLeaveCancelled:ta,onBeforeAppear:ta,onAppear:ta,onAfterAppear:ta,onAppearCancelled:ta},yA={name:"BaseTransition",props:ox,setup(t,{slots:e}){const n=Eu(),r=ix();let i;return()=>{const o=e.default&&L0(e.default(),!0);if(!o||!o.length)return;let s=o[0];if(o.length>1){let y=!1;for(const b of o)if(b.type!==Xr){if(re.NODE_ENV!=="production"&&y){Ne(" can only be used on a single element or component. Use for lists.");break}if(s=b,y=!0,re.NODE_ENV==="production")break}}const a=Ct(t),{mode:u}=a;if(re.NODE_ENV!=="production"&&u&&u!=="in-out"&&u!=="out-in"&&u!=="default"&&Ne(`invalid mode: ${u}`),r.isLeaving)return sx(s);const l=_A(s);if(!l)return sx(s);const f=$d(l,a,r,n);qf(l,f);const c=n.subTree,h=c&&_A(c);let d=!1;const{getTransitionKey:g}=l.type;if(g){const y=g();i===void 0?i=y:y!==i&&(i=y,d=!0)}if(h&&h.type!==Xr&&(!ka(l,h)||d)){const y=$d(h,a,r,n);if(qf(h,y),u==="out-in")return r.isLeaving=!0,y.afterLeave=()=>{r.isLeaving=!1,n.update.active!==!1&&(n.effect.dirty=!0,n.update())},sx(s);u==="in-out"&&l.type!==Xr&&(y.delayLeave=(b,_,p)=>{const m=vA(r,h);m[String(h.key)]=h,b[_c]=()=>{_(),b[_c]=void 0,delete f.delayedLeave},f.delayedLeave=p})}return s}}};function vA(t,e){const{leavingVNodes:n}=t;let r=n.get(e.type);return r||(r=Object.create(null),n.set(e.type,r)),r}function $d(t,e,n,r){const{appear:i,mode:o,persisted:s=!1,onBeforeEnter:a,onEnter:u,onAfterEnter:l,onEnterCancelled:f,onBeforeLeave:c,onLeave:h,onAfterLeave:d,onLeaveCancelled:g,onBeforeAppear:y,onAppear:b,onAfterAppear:_,onAppearCancelled:p}=e,m=String(t.key),v=vA(n,t),w=(C,O)=>{C&&xs(C,r,9,O)},N=(C,O)=>{const M=O[1];w(C,O),qe(C)?C.every(T=>T.length<=1)&&M():C.length<=1&&M()},S={mode:o,persisted:s,beforeEnter(C){let O=a;if(!n.isMounted)if(i)O=y||a;else return;C[_c]&&C[_c](!0);const M=v[m];M&&ka(t,M)&&M.el[_c]&&M.el[_c](),w(O,[C])},enter(C){let O=u,M=l,T=f;if(!n.isMounted)if(i)O=b||u,M=_||l,T=p||f;else return;let I=!1;const A=C[A0]=L=>{I||(I=!0,L?w(T,[C]):w(M,[C]),S.delayedLeave&&S.delayedLeave(),C[A0]=void 0)};O?N(O,[C,A]):A()},leave(C,O){const M=String(t.key);if(C[A0]&&C[A0](!0),n.isUnmounting)return O();w(c,[C]);let T=!1;const I=C[_c]=A=>{T||(T=!0,O(),A?w(g,[C]):w(d,[C]),C[_c]=void 0,v[M]===t&&delete v[M])};v[M]=t,h?N(h,[C,I]):I()},clone(C){return $d(C,e,n,r)}};return S}function sx(t){if(jd(t))return t=na(t),t.children=null,t}function _A(t){return jd(t)?re.NODE_ENV!=="production"&&t.component?t.component.subTree:t.children?t.children[0]:void 0:t}function qf(t,e){t.shapeFlag&6&&t.component?qf(t.component.subTree,e):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function L0(t,e=!1,n){let r=[],i=0;for(let o=0;o1)for(let o=0;o!!t.type.__asyncLoader;/*! #__NO_SIDE_EFFECTS__ */function _J(t){dt(t)&&(t={loader:t});const{loader:e,loadingComponent:n,errorComponent:r,delay:i=200,timeout:o,suspensible:s=!0,onError:a}=t;let u=null,l,f=0;const c=()=>(f++,u=null,h()),h=()=>{let d;return u||(d=u=e().catch(g=>{if(g=g instanceof Error?g:new Error(String(g)),a)return new Promise((y,b)=>{a(g,()=>y(c()),()=>b(g),f+1)});throw g}).then(g=>{if(d!==u&&u)return u;if(re.NODE_ENV!=="production"&&!g&&Ne("Async component loader resolved to undefined. If you are using retry(), make sure to return its return value."),g&&(g.__esModule||g[Symbol.toStringTag]==="Module")&&(g=g.default),re.NODE_ENV!=="production"&&g&&!bn(g)&&!dt(g))throw new Error(`Invalid async component load result: ${g}`);return l=g,g}))};return ax({name:"AsyncComponentWrapper",__asyncLoader:h,get __asyncResolved(){return l},setup(){const d=Kr;if(l)return()=>lx(l,d);const g=p=>{u=null,mc(p,d,13,!r)};if(s&&d.suspense||im)return h().then(p=>()=>lx(p,d)).catch(p=>(g(p),()=>r?vr(r,{error:p}):null));const y=Bf(!1),b=Bf(),_=Bf(!!i);return i&&setTimeout(()=>{_.value=!1},i),o!=null&&setTimeout(()=>{if(!y.value&&!b.value){const p=new Error(`Async component timed out after ${o}ms.`);g(p),b.value=p}},o),h().then(()=>{y.value=!0,d.parent&&jd(d.parent.vnode)&&(d.parent.effect.dirty=!0,Fg(d.parent.update))}).catch(p=>{g(p),b.value=p}),()=>{if(y.value&&l)return lx(l,d);if(b.value&&r)return vr(r,{error:b.value});if(n&&!_.value)return vr(n)}}})}function lx(t,e){const{ref:n,props:r,children:i,ce:o}=e.vnode,s=vr(t,r,i);return s.ref=n,s.ce=o,delete e.vnode.ce,s}const jd=t=>t.type.__isKeepAlive,bJ={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(t,{slots:e}){const n=Eu(),r=n.ctx;if(!r.renderer)return()=>{const p=e.default&&e.default();return p&&p.length===1?p[0]:p};const i=new Map,o=new Set;let s=null;re.NODE_ENV!=="production"&&(n.__v_cache=i);const a=n.suspense,{renderer:{p:u,m:l,um:f,o:{createElement:c}}}=r,h=c("div");r.activate=(p,m,v,w,N)=>{const S=p.component;l(p,m,v,0,a),u(S.vnode,p,m,v,S,a,w,p.slotScopeIds,N),ro(()=>{S.isDeactivated=!1,S.a&&cc(S.a);const C=p.props&&p.props.onVnodeMounted;C&&ts(C,S.parent,p)},a),re.NODE_ENV!=="production"&&Xw(S)},r.deactivate=p=>{const m=p.component;l(p,h,null,1,a),ro(()=>{m.da&&cc(m.da);const v=p.props&&p.props.onVnodeUnmounted;v&&ts(v,m.parent,p),m.isDeactivated=!0},a),re.NODE_ENV!=="production"&&Xw(m)};function d(p){ux(p),f(p,n,a,!0)}function g(p){i.forEach((m,v)=>{const w=sm(m.type);w&&(!p||!p(w))&&y(v)})}function y(p){const m=i.get(p);!s||!ka(m,s)?d(m):s&&ux(s),i.delete(p),o.delete(p)}Hg(()=>[t.include,t.exclude],([p,m])=>{p&&g(v=>Yg(p,v)),m&&g(v=>!Yg(m,v))},{flush:"post",deep:!0});let b=null;const _=()=>{b!=null&&i.set(b,cx(n.subTree))};return Wg(_),R0(_),F0(()=>{i.forEach(p=>{const{subTree:m,suspense:v}=n,w=cx(m);if(p.type===w.type&&p.key===w.key){ux(w);const N=w.component.da;N&&ro(N,v);return}d(p)})}),()=>{if(b=null,!e.default)return null;const p=e.default(),m=p[0];if(p.length>1)return re.NODE_ENV!=="production"&&Ne("KeepAlive should contain exactly one component child."),s=null,p;if(!bu(m)||!(m.shapeFlag&4)&&!(m.shapeFlag&128))return s=null,m;let v=cx(m);const w=v.type,N=sm(Uf(v)?v.type.__asyncResolved||{}:w),{include:S,exclude:C,max:O}=t;if(S&&(!N||!Yg(S,N))||C&&N&&Yg(C,N))return s=v,m;const M=v.key==null?w:v.key,T=i.get(M);return v.el&&(v=na(v),m.shapeFlag&128&&(m.ssContent=v)),b=M,T?(v.el=T.el,v.component=T.component,v.transition&&qf(v,v.transition),v.shapeFlag|=512,o.delete(M),o.add(M)):(o.add(M),O&&o.size>parseInt(O,10)&&y(o.values().next().value)),v.shapeFlag|=256,s=v,aA(m.type)?m:v}}};function Yg(t,e){return qe(t)?t.some(n=>Yg(n,e)):bt(t)?t.split(",").includes(e):OK(t)?t.test(e):!1}function bA(t,e){wA(t,"a",e)}function EA(t,e){wA(t,"da",e)}function wA(t,e,n=Kr){const r=t.__wdc||(t.__wdc=()=>{let i=n;for(;i;){if(i.isDeactivated)return;i=i.parent}return t()});if(D0(e,r,n),n){let i=n.parent;for(;i&&i.parent;)jd(i.parent.vnode)&&EJ(r,e,n,i),i=i.parent}}function EJ(t,e,n,r){const i=D0(e,t,r,!0);B0(()=>{xw(r[e],i)},n)}function ux(t){t.shapeFlag&=-257,t.shapeFlag&=-513}function cx(t){return t.shapeFlag&128?t.ssContent:t}function D0(t,e,n=Kr,r=!1){if(n){const i=n[t]||(n[t]=[]),o=e.__weh||(e.__weh=(...s)=>{if(n.isUnmounted)return;hc();const a=Wf(n),u=xs(e,n,t,s);return a(),dc(),u});return r?i.unshift(o):i.push(o),o}else if(re.NODE_ENV!=="production"){const i=dl(x0[t].replace(/ hook$/,""));Ne(`${i} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`)}}const mu=t=>(e,n=Kr)=>(!im||t==="sp")&&D0(t,(...r)=>e(...r),n),xA=mu("bm"),Wg=mu("m"),SA=mu("bu"),R0=mu("u"),F0=mu("bum"),B0=mu("um"),CA=mu("sp"),NA=mu("rtg"),OA=mu("rtc");function TA(t,e=Kr){D0("ec",t,e)}function wJ(t,e,n,r){let i;const o=n&&n[r];if(qe(t)||bt(t)){i=new Array(t.length);for(let s=0,a=t.length;se(s,a,void 0,o&&o[a]));else{const s=Object.keys(t);i=new Array(s.length);for(let a=0,u=s.length;a{const o=r.fn(...i);return o&&(o.key=r.key),o}:r.fn)}return t}function SJ(t,e,n={},r,i){if(Lr.isCE||Lr.parent&&Uf(Lr.parent)&&Lr.parent.isCE)return e!=="default"&&(n.name=e),vr("slot",n,r&&r());let o=t[e];re.NODE_ENV!=="production"&&o&&o.length>1&&(Ne("SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template."),o=()=>[]),o&&o._c&&(o._d=!1),z0();const s=o&&IA(o(n)),a=xx(Hi,{key:n.key||s&&s.key||`_${e}`},s||(r?r():[]),s&&t._===1?64:-2);return!i&&a.scopeId&&(a.slotScopeIds=[a.scopeId+"-s"]),o&&o._c&&(o._d=!0),a}function IA(t){return t.some(e=>bu(e)?!(e.type===Xr||e.type===Hi&&!IA(e.children)):!0)?t:null}function CJ(t,e){const n={};if(re.NODE_ENV!=="production"&&!bn(t))return Ne("v-on with no argument expects an object value."),n;for(const r in t)n[e&&/[A-Z]/.test(r)?`on:${r}`:dl(r)]=t[r];return n}const fx=t=>t?hL(t)?W0(t)||t.proxy:fx(t.parent):null,zf=Lt(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>re.NODE_ENV!=="production"?Ff(t.props):t.props,$attrs:t=>re.NODE_ENV!=="production"?Ff(t.attrs):t.attrs,$slots:t=>re.NODE_ENV!=="production"?Ff(t.slots):t.slots,$refs:t=>re.NODE_ENV!=="production"?Ff(t.refs):t.refs,$parent:t=>fx(t.parent),$root:t=>fx(t.root),$emit:t=>t.emit,$options:t=>gx(t),$forceUpdate:t=>t.f||(t.f=()=>{t.effect.dirty=!0,Fg(t.update)}),$nextTick:t=>t.n||(t.n=S0.bind(t.proxy)),$watch:t=>yJ.bind(t)}),hx=t=>t==="_"||t==="$",dx=(t,e)=>t!==Cn&&!t.__isScriptSetup&&pn(t,e),Xg={get({_:t},e){const{ctx:n,setupState:r,data:i,props:o,accessCache:s,type:a,appContext:u}=t;if(re.NODE_ENV!=="production"&&e==="__isVue")return!0;let l;if(e[0]!=="$"){const d=s[e];if(d!==void 0)switch(d){case 1:return r[e];case 2:return i[e];case 4:return n[e];case 3:return o[e]}else{if(dx(r,e))return s[e]=1,r[e];if(i!==Cn&&pn(i,e))return s[e]=2,i[e];if((l=t.propsOptions[0])&&pn(l,e))return s[e]=3,o[e];if(n!==Cn&&pn(n,e))return s[e]=4,n[e];px&&(s[e]=0)}}const f=zf[e];let c,h;if(f)return e==="$attrs"?(no(t,"get",e),re.NODE_ENV!=="production"&&T0()):re.NODE_ENV!=="production"&&e==="$slots"&&no(t,"get",e),f(t);if((c=a.__cssModules)&&(c=c[e]))return c;if(n!==Cn&&pn(n,e))return s[e]=4,n[e];if(h=u.config.globalProperties,pn(h,e))return h[e];re.NODE_ENV!=="production"&&Lr&&(!bt(e)||e.indexOf("__v")!==0)&&(i!==Cn&&hx(e[0])&&pn(i,e)?Ne(`Property ${JSON.stringify(e)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`):t===Lr&&Ne(`Property ${JSON.stringify(e)} was accessed during render but is not defined on instance.`))},set({_:t},e,n){const{data:r,setupState:i,ctx:o}=t;return dx(i,e)?(i[e]=n,!0):re.NODE_ENV!=="production"&&i.__isScriptSetup&&pn(i,e)?(Ne(`Cannot mutate