@opengis/admin 0.1.76 → 0.1.77
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +29 -29
- package/config.js +4 -4
- package/dist/{IconChevronDown-BMnTiJIv.js → IconChevronDown-C7p-qa08.js} +1 -1
- package/dist/{add-page-BxK4iJe4.js → add-page-BjxUl0Xb.js} +1 -1
- package/dist/{admin-interface-D9vWpTqM.js → admin-interface-hP6bBpCA.js} +4 -4
- package/dist/{admin-view-DPtlpZue.js → admin-view-Bg210Kja.js} +3 -3
- package/dist/admin.js +1 -1
- package/dist/admin.umd.cjs +6 -6
- package/dist/assets/logo.svg +41 -41
- package/dist/{card-page-KnsaeAPW.js → card-page-DrVSEjOf.js} +2 -2
- package/dist/{card-view-BAC53pSQ.js → card-view-CrrcS8Wm.js} +1 -1
- package/dist/{edit-page-D2KM1hue.js → edit-page-CJxp0cdD.js} +1 -1
- package/dist/{import-file-C3Slz6rJ.js → import-file-L1iBMu59.js} +22 -15
- package/dist/style.css +1 -1
- package/module/settings/card/admin.roles.table/access.hbs +27 -27
- package/module/settings/card/admin.roles.table/general_info.hbs +16 -16
- package/module/settings/card/admin.roles.table/index.yml +14 -14
- package/module/settings/card/admin.roles.table/users.hbs +27 -27
- package/module/settings/card/admin.routes.table/general_info.hbs +40 -40
- package/module/settings/card/admin.routes.table/index.yml +8 -8
- package/module/settings/card/admin.routes.table/users.hbs +33 -33
- package/module/settings/card/admin.users.table/general_info.hbs +25 -25
- package/module/settings/card/admin.users.table/index.yml +12 -12
- package/module/settings/card/admin.users.table/logs.hbs +30 -30
- package/module/settings/card/admin.users.table/user_roles.hbs +24 -24
- package/module/settings/cls/core.actions.json +13 -13
- package/module/settings/cls/core.scope.json +13 -13
- package/module/settings/cls/properties.site_status.json +13 -13
- package/module/settings/cls/properties.widget_status.json +13 -13
- package/module/settings/cls/users.user_type.json +13 -13
- package/module/settings/form/admin.access.form.json +36 -36
- package/module/settings/form/admin.custom_column.form.json +71 -71
- package/module/settings/form/admin.properties.form.json +15 -15
- package/module/settings/form/admin.roles.form.json +19 -19
- package/module/settings/form/admin.routes.form.json +25 -25
- package/module/settings/form/admin.user_properties.form.json +15 -15
- package/module/settings/form/admin.user_roles.form.json +21 -21
- package/module/settings/form/admin.users.form.json +153 -153
- package/module/settings/form/user.user_roles.form.json +13 -13
- package/module/settings/interface/admin.properties.json +4 -4
- package/module/settings/interface/admin.roles.json +4 -4
- package/module/settings/interface/admin.routes.json +4 -4
- package/module/settings/interface/admin.users.json +4 -4
- package/module/settings/menu.json +50 -50
- package/module/settings/select/core.roles.json +2 -2
- package/module/settings/select/core.routes.sql +1 -1
- package/module/settings/select/core.user_mentioned.sql +1 -1
- package/module/settings/select/core.user_uid.sql +1 -1
- package/module/settings/table/admin.access.table.json +83 -83
- package/module/settings/table/admin.custom_column.table.json +99 -99
- package/module/settings/table/admin.properties.table.json +39 -39
- package/module/settings/table/admin.roles.table.json +64 -64
- package/module/settings/table/admin.routes.table.json +68 -68
- package/module/settings/table/admin.user_properties.table.json +34 -34
- package/module/settings/table/admin.user_roles.table.json +72 -72
- package/module/settings/table/admin.users.table.json +121 -121
- package/package.json +82 -82
- package/plugin.js +27 -27
- package/server/helpers/controllers/badge.js +11 -11
- package/server/helpers/controllers/hb.js +2 -2
- package/server/helpers/controllers/map.js +2 -2
- package/server/helpers/controllers/mls.js +2 -2
- package/server/helpers/controllers/vue.js +2 -2
- package/server/helpers/index.mjs +15 -15
- package/server/plugins/adminHook.js +93 -93
- package/server/plugins/cron.js +10 -10
- package/server/plugins/docs.js +28 -28
- package/server/plugins/hook.js +214 -214
- package/server/plugins/vite.js +71 -71
- package/server/routes/calendar/controllers/calendar.data.js +88 -88
- package/server/routes/calendar/index.mjs +7 -7
- package/server/routes/calendar/schema.js +21 -21
- package/server/routes/data/controllers/cardData.js +61 -57
- package/server/routes/data/controllers/cardTabData.js +49 -49
- package/server/routes/data/controllers/funcs/getFilterSQL/index.js +92 -92
- package/server/routes/data/controllers/funcs/getFilterSQL/util/formatValue.js +170 -170
- package/server/routes/data/controllers/funcs/getFilterSQL/util/getCustomQuery.js +13 -13
- package/server/routes/data/controllers/funcs/getFilterSQL/util/getFilterQuery.js +64 -64
- package/server/routes/data/controllers/funcs/getFilterSQL/util/getOptimizedQuery.js +12 -12
- package/server/routes/data/controllers/funcs/getFilterSQL/util/getTableSql.js +34 -34
- package/server/routes/data/controllers/tableData.js +11 -11
- package/server/routes/data/controllers/tableDataId.js +27 -27
- package/server/routes/data/controllers/tableFilter.js +63 -63
- package/server/routes/data/controllers/utils/assignTokens.js +30 -30
- package/server/routes/data/controllers/utils/getColumns.js +8 -8
- package/server/routes/data/index.mjs +15 -15
- package/server/routes/data/schema.js +54 -54
- package/server/routes/menu/controllers/getMenu.js +67 -67
- package/server/routes/menu/index.mjs +5 -5
- package/server/routes/notifications/controllers/readNotifications.js +27 -27
- package/server/routes/notifications/controllers/testEmail.js +35 -35
- package/server/routes/notifications/controllers/userNotifications.js +57 -57
- package/server/routes/notifications/funcs/addNotification.js +21 -21
- package/server/routes/notifications/funcs/sendNotification.js +105 -105
- package/server/routes/notifications/hook/onWidgetSet.js +57 -57
- package/server/routes/notifications/index.mjs +27 -27
- package/server/routes/notifications/schema.js +16 -16
- package/server/routes/properties/controllers/admin.properties.get.js +29 -29
- package/server/routes/properties/controllers/user.properties.get.js +34 -34
- package/server/routes/properties/controllers/user.properties.post.js +30 -30
- package/server/routes/properties/funcs/getSettings.js +56 -56
- package/server/routes/properties/funcs/setSettings.js +44 -44
- package/server/routes/properties/funcs/utils/dataInsert.js +26 -26
- package/server/routes/properties/index.mjs +14 -14
- package/server/routes/properties/schema.js +10 -10
- package/server/routes/root.mjs +3 -3
- package/server/routes/templates/controllers/getTemplate.js +22 -22
- package/server/routes/templates/index.mjs +14 -14
- package/server/routes/templates/scheme.js +8 -8
- package/server/routes/user/controllers/user.cls.id.js +14 -14
- package/server/routes/user/controllers/user.cls.js +71 -71
- package/server/routes/user/controllers/user.cls.post.js +52 -52
- package/server/routes/user/controllers/user.info.js +17 -17
- package/server/routes/user/schema.js +14 -14
- package/server/routes/widget/controllers/utils/historyFormat.js +75 -75
- package/server/routes/widget/controllers/utils/obj2db.js +13 -13
- package/server/routes/widget/controllers/widget.del.js +41 -41
- package/server/routes/widget/controllers/widget.get.js +96 -96
- package/server/routes/widget/controllers/widget.set.js +76 -76
- package/server/routes/widget/index.mjs +39 -39
- package/server/templates/cls/itree.recrzone_category.json +73 -73
- package/server/templates/cls/test.json +9 -9
- package/server/templates/form/admin.user_cls.data.form.json +49 -49
- package/server/templates/form/admin.user_group_rel.form.json +21 -21
- package/server/templates/form/cp_building.form.json +32 -32
- package/server/templates/form/form-user-pass.json +10 -10
- package/server/templates/form/form-user_group.json +39 -39
- package/server/templates/form/form-users.json +156 -156
- package/server/templates/form/user_group_access.form.json +22 -22
- package/server/templates/select/account_id.json +2 -2
- package/server/templates/table/gis.dataset.table.json +43 -43
- package/server/templates/table/management.user_group.table.json +112 -112
- package/server/templates/table/management.users.table.json +126 -126
- package/utils.js +26 -26
package/dist/admin.umd.cjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
(function(f,uc){typeof exports=="object"&&typeof module<"u"?module.exports=uc(require("vue")):typeof define=="function"&&define.amd?define(["vue"],uc):(f=typeof globalThis<"u"?globalThis:f||self,f.admin=uc(f.Vue))})(this,function(f){"use strict";function uc(t,e){return function(){return t.apply(e,arguments)}}const{toString:vC}=Object.prototype,{getPrototypeOf:Qm}=Object,rp=(t=>e=>{const n=vC.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),zs=t=>(t=t.toLowerCase(),e=>rp(e)===t),sp=t=>e=>typeof e===t,{isArray:hc}=Array,Yu=sp("undefined");function wC(t){return t!==null&&!Yu(t)&&t.constructor!==null&&!Yu(t.constructor)&&Hr(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const bb=zs("ArrayBuffer");function kC(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&bb(t.buffer),e}const SC=sp("string"),Hr=sp("function"),xb=sp("number"),op=t=>t!==null&&typeof t=="object",EC=t=>t===!0||t===!1,ap=t=>{if(rp(t)!=="object")return!1;const e=Qm(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},CC=zs("Date"),TC=zs("File"),MC=zs("Blob"),AC=zs("FileList"),IC=t=>op(t)&&Hr(t.pipe),PC=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Hr(t.append)&&((e=rp(t))==="formdata"||e==="object"&&Hr(t.toString)&&t.toString()==="[object FormData]"))},DC=zs("URLSearchParams"),[OC,zC,BC,NC]=["ReadableStream","Request","Response","Headers"].map(zs),RC=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Xu(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let i,r;if(typeof t!="object"&&(t=[t]),hc(t))for(i=0,r=t.length;i<r;i++)e.call(null,t[i],i,t);else{const a=n?Object.getOwnPropertyNames(t):Object.keys(t),u=a.length;let l;for(i=0;i<u;i++)l=a[i],e.call(null,t[l],l,t)}}function vb(t,e){e=e.toLowerCase();const n=Object.keys(t);let i=n.length,r;for(;i-- >0;)if(r=n[i],e===r.toLowerCase())return r;return null}const ll=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,wb=t=>!Yu(t)&&t!==ll;function eg(){const{caseless:t}=wb(this)&&this||{},e={},n=(i,r)=>{const a=t&&vb(e,r)||r;ap(e[a])&&ap(i)?e[a]=eg(e[a],i):ap(i)?e[a]=eg({},i):hc(i)?e[a]=i.slice():e[a]=i};for(let i=0,r=arguments.length;i<r;i++)arguments[i]&&Xu(arguments[i],n);return e}const LC=(t,e,n,{allOwnKeys:i}={})=>(Xu(e,(r,a)=>{n&&Hr(r)?t[a]=uc(r,n):t[a]=r},{allOwnKeys:i}),t),VC=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),FC=(t,e,n,i)=>{t.prototype=Object.create(e.prototype,i),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},$C=(t,e,n,i)=>{let r,a,u;const l={};if(e=e||{},t==null)return e;do{for(r=Object.getOwnPropertyNames(t),a=r.length;a-- >0;)u=r[a],(!i||i(u,t,e))&&!l[u]&&(e[u]=t[u],l[u]=!0);t=n!==!1&&Qm(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},jC=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const i=t.indexOf(e,n);return i!==-1&&i===n},UC=t=>{if(!t)return null;if(hc(t))return t;let e=t.length;if(!xb(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},HC=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Qm(Uint8Array)),qC=(t,e)=>{const i=(t&&t[Symbol.iterator]).call(t);let r;for(;(r=i.next())&&!r.done;){const a=r.value;e.call(t,a[0],a[1])}},WC=(t,e)=>{let n;const i=[];for(;(n=t.exec(e))!==null;)i.push(n);return i},GC=zs("HTMLFormElement"),ZC=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,i,r){return i.toUpperCase()+r}),kb=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),YC=zs("RegExp"),Sb=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),i={};Xu(n,(r,a)=>{let u;(u=e(r,a,t))!==!1&&(i[a]=u||r)}),Object.defineProperties(t,i)},XC=t=>{Sb(t,(e,n)=>{if(Hr(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const i=t[n];if(Hr(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},KC=(t,e)=>{const n={},i=r=>{r.forEach(a=>{n[a]=!0})};return hc(t)?i(t):i(String(t).split(e)),n},JC=()=>{},QC=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,tg="abcdefghijklmnopqrstuvwxyz",Eb="0123456789",Cb={DIGIT:Eb,ALPHA:tg,ALPHA_DIGIT:tg+tg.toUpperCase()+Eb},eT=(t=16,e=Cb.ALPHA_DIGIT)=>{let n="";const{length:i}=e;for(;t--;)n+=e[Math.random()*i|0];return n};function tT(t){return!!(t&&Hr(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const nT=t=>{const e=new Array(10),n=(i,r)=>{if(op(i)){if(e.indexOf(i)>=0)return;if(!("toJSON"in i)){e[r]=i;const a=hc(i)?[]:{};return Xu(i,(u,l)=>{const g=n(u,r+1);!Yu(g)&&(a[l]=g)}),e[r]=void 0,a}}return i};return n(t,0)},iT=zs("AsyncFunction"),rT=t=>t&&(op(t)||Hr(t))&&Hr(t.then)&&Hr(t.catch),Tb=((t,e)=>t?setImmediate:e?((n,i)=>(ll.addEventListener("message",({source:r,data:a})=>{r===ll&&a===n&&i.length&&i.shift()()},!1),r=>{i.push(r),ll.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Hr(ll.postMessage)),sT=typeof queueMicrotask<"u"?queueMicrotask.bind(ll):typeof process<"u"&&process.nextTick||Tb,Pe={isArray:hc,isArrayBuffer:bb,isBuffer:wC,isFormData:PC,isArrayBufferView:kC,isString:SC,isNumber:xb,isBoolean:EC,isObject:op,isPlainObject:ap,isReadableStream:OC,isRequest:zC,isResponse:BC,isHeaders:NC,isUndefined:Yu,isDate:CC,isFile:TC,isBlob:MC,isRegExp:YC,isFunction:Hr,isStream:IC,isURLSearchParams:DC,isTypedArray:HC,isFileList:AC,forEach:Xu,merge:eg,extend:LC,trim:RC,stripBOM:VC,inherits:FC,toFlatObject:$C,kindOf:rp,kindOfTest:zs,endsWith:jC,toArray:UC,forEachEntry:qC,matchAll:WC,isHTMLForm:GC,hasOwnProperty:kb,hasOwnProp:kb,reduceDescriptors:Sb,freezeMethods:XC,toObjectSet:KC,toCamelCase:ZC,noop:JC,toFiniteNumber:QC,findKey:vb,global:ll,isContextDefined:wb,ALPHABET:Cb,generateString:eT,isSpecCompliantForm:tT,toJSONObject:nT,isAsyncFn:iT,isThenable:rT,setImmediate:Tb,asap:sT};function qt(t,e,n,i,r){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),i&&(this.request=i),r&&(this.response=r,this.status=r.status?r.status:null)}Pe.inherits(qt,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:Pe.toJSONObject(this.config),code:this.code,status:this.status}}});const Mb=qt.prototype,Ab={};["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=>{Ab[t]={value:t}}),Object.defineProperties(qt,Ab),Object.defineProperty(Mb,"isAxiosError",{value:!0}),qt.from=(t,e,n,i,r,a)=>{const u=Object.create(Mb);return Pe.toFlatObject(t,u,function(g){return g!==Error.prototype},l=>l!=="isAxiosError"),qt.call(u,t.message,e,n,i,r),u.cause=t,u.name=t.name,a&&Object.assign(u,a),u};const oT=null;function ng(t){return Pe.isPlainObject(t)||Pe.isArray(t)}function Ib(t){return Pe.endsWith(t,"[]")?t.slice(0,-2):t}function Pb(t,e,n){return t?t.concat(e).map(function(r,a){return r=Ib(r),!n&&a?"["+r+"]":r}).join(n?".":""):e}function aT(t){return Pe.isArray(t)&&!t.some(ng)}const lT=Pe.toFlatObject(Pe,{},null,function(e){return/^is[A-Z]/.test(e)});function lp(t,e,n){if(!Pe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=Pe.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(R,j){return!Pe.isUndefined(j[R])});const i=n.metaTokens,r=n.visitor||S,a=n.dots,u=n.indexes,g=(n.Blob||typeof Blob<"u"&&Blob)&&Pe.isSpecCompliantForm(e);if(!Pe.isFunction(r))throw new TypeError("visitor must be a function");function b(D){if(D===null)return"";if(Pe.isDate(D))return D.toISOString();if(!g&&Pe.isBlob(D))throw new qt("Blob is not supported. Use a Buffer instead.");return Pe.isArrayBuffer(D)||Pe.isTypedArray(D)?g&&typeof Blob=="function"?new Blob([D]):Buffer.from(D):D}function S(D,R,j){let W=D;if(D&&!j&&typeof D=="object"){if(Pe.endsWith(R,"{}"))R=i?R:R.slice(0,-2),D=JSON.stringify(D);else if(Pe.isArray(D)&&aT(D)||(Pe.isFileList(D)||Pe.endsWith(R,"[]"))&&(W=Pe.toArray(D)))return R=Ib(R),W.forEach(function(le,J){!(Pe.isUndefined(le)||le===null)&&e.append(u===!0?Pb([R],J,a):u===null?R:R+"[]",b(le))}),!1}return ng(D)?!0:(e.append(Pb(j,R,a),b(D)),!1)}const E=[],C=Object.assign(lT,{defaultVisitor:S,convertValue:b,isVisitable:ng});function P(D,R){if(!Pe.isUndefined(D)){if(E.indexOf(D)!==-1)throw Error("Circular reference detected in "+R.join("."));E.push(D),Pe.forEach(D,function(W,ee){(!(Pe.isUndefined(W)||W===null)&&r.call(e,W,Pe.isString(ee)?ee.trim():ee,R,C))===!0&&P(W,R?R.concat(ee):[ee])}),E.pop()}}if(!Pe.isObject(t))throw new TypeError("data must be an object");return P(t),e}function Db(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function ig(t,e){this._pairs=[],t&&lp(t,this,e)}const Ob=ig.prototype;Ob.append=function(e,n){this._pairs.push([e,n])},Ob.toString=function(e){const n=e?function(i){return e.call(this,i,Db)}:Db;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function cT(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function zb(t,e,n){if(!e)return t;const i=n&&n.encode||cT,r=n&&n.serialize;let a;if(r?a=r(e,n):a=Pe.isURLSearchParams(e)?e.toString():new ig(e,n).toString(i),a){const u=t.indexOf("#");u!==-1&&(t=t.slice(0,u)),t+=(t.indexOf("?")===-1?"?":"&")+a}return t}class Bb{constructor(){this.handlers=[]}use(e,n,i){return this.handlers.push({fulfilled:e,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Pe.forEach(this.handlers,function(i){i!==null&&e(i)})}}const Nb={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},uT={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ig,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},rg=typeof window<"u"&&typeof document<"u",sg=typeof navigator=="object"&&navigator||void 0,hT=rg&&(!sg||["ReactNative","NativeScript","NS"].indexOf(sg.product)<0),dT=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",pT=rg&&window.location.href||"http://localhost",kr={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:rg,hasStandardBrowserEnv:hT,hasStandardBrowserWebWorkerEnv:dT,navigator:sg,origin:pT},Symbol.toStringTag,{value:"Module"})),...uT};function fT(t,e){return lp(t,new kr.classes.URLSearchParams,Object.assign({visitor:function(n,i,r,a){return kr.isNode&&Pe.isBuffer(n)?(this.append(i,n.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},e))}function mT(t){return Pe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function gT(t){const e={},n=Object.keys(t);let i;const r=n.length;let a;for(i=0;i<r;i++)a=n[i],e[a]=t[a];return e}function Rb(t){function e(n,i,r,a){let u=n[a++];if(u==="__proto__")return!0;const l=Number.isFinite(+u),g=a>=n.length;return u=!u&&Pe.isArray(r)?r.length:u,g?(Pe.hasOwnProp(r,u)?r[u]=[r[u],i]:r[u]=i,!l):((!r[u]||!Pe.isObject(r[u]))&&(r[u]=[]),e(n,i,r[u],a)&&Pe.isArray(r[u])&&(r[u]=gT(r[u])),!l)}if(Pe.isFormData(t)&&Pe.isFunction(t.entries)){const n={};return Pe.forEachEntry(t,(i,r)=>{e(mT(i),r,n,0)}),n}return null}function yT(t,e,n){if(Pe.isString(t))try{return(e||JSON.parse)(t),Pe.trim(t)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(t)}const Ku={transitional:Nb,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const i=n.getContentType()||"",r=i.indexOf("application/json")>-1,a=Pe.isObject(e);if(a&&Pe.isHTMLForm(e)&&(e=new FormData(e)),Pe.isFormData(e))return r?JSON.stringify(Rb(e)):e;if(Pe.isArrayBuffer(e)||Pe.isBuffer(e)||Pe.isStream(e)||Pe.isFile(e)||Pe.isBlob(e)||Pe.isReadableStream(e))return e;if(Pe.isArrayBufferView(e))return e.buffer;if(Pe.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return fT(e,this.formSerializer).toString();if((l=Pe.isFileList(e))||i.indexOf("multipart/form-data")>-1){const g=this.env&&this.env.FormData;return lp(l?{"files[]":e}:e,g&&new g,this.formSerializer)}}return a||r?(n.setContentType("application/json",!1),yT(e)):e}],transformResponse:[function(e){const n=this.transitional||Ku.transitional,i=n&&n.forcedJSONParsing,r=this.responseType==="json";if(Pe.isResponse(e)||Pe.isReadableStream(e))return e;if(e&&Pe.isString(e)&&(i&&!this.responseType||r)){const u=!(n&&n.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(l){if(u)throw l.name==="SyntaxError"?qt.from(l,qt.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:kr.classes.FormData,Blob:kr.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Pe.forEach(["delete","get","head","post","put","patch"],t=>{Ku.headers[t]={}});const _T=Pe.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"]),bT=t=>{const e={};let n,i,r;return t&&t.split(`
|
1
|
+
(function(f,uc){typeof exports=="object"&&typeof module<"u"?module.exports=uc(require("vue")):typeof define=="function"&&define.amd?define(["vue"],uc):(f=typeof globalThis<"u"?globalThis:f||self,f.admin=uc(f.Vue))})(this,function(f){"use strict";function uc(t,e){return function(){return t.apply(e,arguments)}}const{toString:vC}=Object.prototype,{getPrototypeOf:Qm}=Object,rp=(t=>e=>{const n=vC.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),zs=t=>(t=t.toLowerCase(),e=>rp(e)===t),sp=t=>e=>typeof e===t,{isArray:hc}=Array,Yu=sp("undefined");function wC(t){return t!==null&&!Yu(t)&&t.constructor!==null&&!Yu(t.constructor)&&Hr(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const bb=zs("ArrayBuffer");function kC(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&bb(t.buffer),e}const SC=sp("string"),Hr=sp("function"),xb=sp("number"),op=t=>t!==null&&typeof t=="object",EC=t=>t===!0||t===!1,ap=t=>{if(rp(t)!=="object")return!1;const e=Qm(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},CC=zs("Date"),TC=zs("File"),MC=zs("Blob"),AC=zs("FileList"),IC=t=>op(t)&&Hr(t.pipe),PC=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Hr(t.append)&&((e=rp(t))==="formdata"||e==="object"&&Hr(t.toString)&&t.toString()==="[object FormData]"))},DC=zs("URLSearchParams"),[OC,zC,BC,NC]=["ReadableStream","Request","Response","Headers"].map(zs),RC=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Xu(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let i,r;if(typeof t!="object"&&(t=[t]),hc(t))for(i=0,r=t.length;i<r;i++)e.call(null,t[i],i,t);else{const a=n?Object.getOwnPropertyNames(t):Object.keys(t),u=a.length;let l;for(i=0;i<u;i++)l=a[i],e.call(null,t[l],l,t)}}function vb(t,e){e=e.toLowerCase();const n=Object.keys(t);let i=n.length,r;for(;i-- >0;)if(r=n[i],e===r.toLowerCase())return r;return null}const ll=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,wb=t=>!Yu(t)&&t!==ll;function eg(){const{caseless:t}=wb(this)&&this||{},e={},n=(i,r)=>{const a=t&&vb(e,r)||r;ap(e[a])&&ap(i)?e[a]=eg(e[a],i):ap(i)?e[a]=eg({},i):hc(i)?e[a]=i.slice():e[a]=i};for(let i=0,r=arguments.length;i<r;i++)arguments[i]&&Xu(arguments[i],n);return e}const LC=(t,e,n,{allOwnKeys:i}={})=>(Xu(e,(r,a)=>{n&&Hr(r)?t[a]=uc(r,n):t[a]=r},{allOwnKeys:i}),t),VC=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),FC=(t,e,n,i)=>{t.prototype=Object.create(e.prototype,i),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},$C=(t,e,n,i)=>{let r,a,u;const l={};if(e=e||{},t==null)return e;do{for(r=Object.getOwnPropertyNames(t),a=r.length;a-- >0;)u=r[a],(!i||i(u,t,e))&&!l[u]&&(e[u]=t[u],l[u]=!0);t=n!==!1&&Qm(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},jC=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const i=t.indexOf(e,n);return i!==-1&&i===n},UC=t=>{if(!t)return null;if(hc(t))return t;let e=t.length;if(!xb(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},HC=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Qm(Uint8Array)),qC=(t,e)=>{const i=(t&&t[Symbol.iterator]).call(t);let r;for(;(r=i.next())&&!r.done;){const a=r.value;e.call(t,a[0],a[1])}},WC=(t,e)=>{let n;const i=[];for(;(n=t.exec(e))!==null;)i.push(n);return i},GC=zs("HTMLFormElement"),ZC=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,i,r){return i.toUpperCase()+r}),kb=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),YC=zs("RegExp"),Sb=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),i={};Xu(n,(r,a)=>{let u;(u=e(r,a,t))!==!1&&(i[a]=u||r)}),Object.defineProperties(t,i)},XC=t=>{Sb(t,(e,n)=>{if(Hr(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const i=t[n];if(Hr(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},KC=(t,e)=>{const n={},i=r=>{r.forEach(a=>{n[a]=!0})};return hc(t)?i(t):i(String(t).split(e)),n},JC=()=>{},QC=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,tg="abcdefghijklmnopqrstuvwxyz",Eb="0123456789",Cb={DIGIT:Eb,ALPHA:tg,ALPHA_DIGIT:tg+tg.toUpperCase()+Eb},eT=(t=16,e=Cb.ALPHA_DIGIT)=>{let n="";const{length:i}=e;for(;t--;)n+=e[Math.random()*i|0];return n};function tT(t){return!!(t&&Hr(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const nT=t=>{const e=new Array(10),n=(i,r)=>{if(op(i)){if(e.indexOf(i)>=0)return;if(!("toJSON"in i)){e[r]=i;const a=hc(i)?[]:{};return Xu(i,(u,l)=>{const g=n(u,r+1);!Yu(g)&&(a[l]=g)}),e[r]=void 0,a}}return i};return n(t,0)},iT=zs("AsyncFunction"),rT=t=>t&&(op(t)||Hr(t))&&Hr(t.then)&&Hr(t.catch),Tb=((t,e)=>t?setImmediate:e?((n,i)=>(ll.addEventListener("message",({source:r,data:a})=>{r===ll&&a===n&&i.length&&i.shift()()},!1),r=>{i.push(r),ll.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Hr(ll.postMessage)),sT=typeof queueMicrotask<"u"?queueMicrotask.bind(ll):typeof process<"u"&&process.nextTick||Tb,Pe={isArray:hc,isArrayBuffer:bb,isBuffer:wC,isFormData:PC,isArrayBufferView:kC,isString:SC,isNumber:xb,isBoolean:EC,isObject:op,isPlainObject:ap,isReadableStream:OC,isRequest:zC,isResponse:BC,isHeaders:NC,isUndefined:Yu,isDate:CC,isFile:TC,isBlob:MC,isRegExp:YC,isFunction:Hr,isStream:IC,isURLSearchParams:DC,isTypedArray:HC,isFileList:AC,forEach:Xu,merge:eg,extend:LC,trim:RC,stripBOM:VC,inherits:FC,toFlatObject:$C,kindOf:rp,kindOfTest:zs,endsWith:jC,toArray:UC,forEachEntry:qC,matchAll:WC,isHTMLForm:GC,hasOwnProperty:kb,hasOwnProp:kb,reduceDescriptors:Sb,freezeMethods:XC,toObjectSet:KC,toCamelCase:ZC,noop:JC,toFiniteNumber:QC,findKey:vb,global:ll,isContextDefined:wb,ALPHABET:Cb,generateString:eT,isSpecCompliantForm:tT,toJSONObject:nT,isAsyncFn:iT,isThenable:rT,setImmediate:Tb,asap:sT};function qt(t,e,n,i,r){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),i&&(this.request=i),r&&(this.response=r,this.status=r.status?r.status:null)}Pe.inherits(qt,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:Pe.toJSONObject(this.config),code:this.code,status:this.status}}});const Mb=qt.prototype,Ab={};["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=>{Ab[t]={value:t}}),Object.defineProperties(qt,Ab),Object.defineProperty(Mb,"isAxiosError",{value:!0}),qt.from=(t,e,n,i,r,a)=>{const u=Object.create(Mb);return Pe.toFlatObject(t,u,function(g){return g!==Error.prototype},l=>l!=="isAxiosError"),qt.call(u,t.message,e,n,i,r),u.cause=t,u.name=t.name,a&&Object.assign(u,a),u};const oT=null;function ng(t){return Pe.isPlainObject(t)||Pe.isArray(t)}function Ib(t){return Pe.endsWith(t,"[]")?t.slice(0,-2):t}function Pb(t,e,n){return t?t.concat(e).map(function(r,a){return r=Ib(r),!n&&a?"["+r+"]":r}).join(n?".":""):e}function aT(t){return Pe.isArray(t)&&!t.some(ng)}const lT=Pe.toFlatObject(Pe,{},null,function(e){return/^is[A-Z]/.test(e)});function lp(t,e,n){if(!Pe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=Pe.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(R,j){return!Pe.isUndefined(j[R])});const i=n.metaTokens,r=n.visitor||S,a=n.dots,u=n.indexes,g=(n.Blob||typeof Blob<"u"&&Blob)&&Pe.isSpecCompliantForm(e);if(!Pe.isFunction(r))throw new TypeError("visitor must be a function");function b(D){if(D===null)return"";if(Pe.isDate(D))return D.toISOString();if(!g&&Pe.isBlob(D))throw new qt("Blob is not supported. Use a Buffer instead.");return Pe.isArrayBuffer(D)||Pe.isTypedArray(D)?g&&typeof Blob=="function"?new Blob([D]):Buffer.from(D):D}function S(D,R,j){let W=D;if(D&&!j&&typeof D=="object"){if(Pe.endsWith(R,"{}"))R=i?R:R.slice(0,-2),D=JSON.stringify(D);else if(Pe.isArray(D)&&aT(D)||(Pe.isFileList(D)||Pe.endsWith(R,"[]"))&&(W=Pe.toArray(D)))return R=Ib(R),W.forEach(function(le,J){!(Pe.isUndefined(le)||le===null)&&e.append(u===!0?Pb([R],J,a):u===null?R:R+"[]",b(le))}),!1}return ng(D)?!0:(e.append(Pb(j,R,a),b(D)),!1)}const E=[],C=Object.assign(lT,{defaultVisitor:S,convertValue:b,isVisitable:ng});function P(D,R){if(!Pe.isUndefined(D)){if(E.indexOf(D)!==-1)throw Error("Circular reference detected in "+R.join("."));E.push(D),Pe.forEach(D,function(W,ee){(!(Pe.isUndefined(W)||W===null)&&r.call(e,W,Pe.isString(ee)?ee.trim():ee,R,C))===!0&&P(W,R?R.concat(ee):[ee])}),E.pop()}}if(!Pe.isObject(t))throw new TypeError("data must be an object");return P(t),e}function Db(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function ig(t,e){this._pairs=[],t&&lp(t,this,e)}const Ob=ig.prototype;Ob.append=function(e,n){this._pairs.push([e,n])},Ob.toString=function(e){const n=e?function(i){return e.call(this,i,Db)}:Db;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function cT(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function zb(t,e,n){if(!e)return t;const i=n&&n.encode||cT,r=n&&n.serialize;let a;if(r?a=r(e,n):a=Pe.isURLSearchParams(e)?e.toString():new ig(e,n).toString(i),a){const u=t.indexOf("#");u!==-1&&(t=t.slice(0,u)),t+=(t.indexOf("?")===-1?"?":"&")+a}return t}class Bb{constructor(){this.handlers=[]}use(e,n,i){return this.handlers.push({fulfilled:e,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Pe.forEach(this.handlers,function(i){i!==null&&e(i)})}}const Nb={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},uT={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ig,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},rg=typeof window<"u"&&typeof document<"u",sg=typeof navigator=="object"&&navigator||void 0,hT=rg&&(!sg||["ReactNative","NativeScript","NS"].indexOf(sg.product)<0),dT=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",pT=rg&&window.location.href||"http://localhost",kr={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:rg,hasStandardBrowserEnv:hT,hasStandardBrowserWebWorkerEnv:dT,navigator:sg,origin:pT},Symbol.toStringTag,{value:"Module"})),...uT};function fT(t,e){return lp(t,new kr.classes.URLSearchParams,Object.assign({visitor:function(n,i,r,a){return kr.isNode&&Pe.isBuffer(n)?(this.append(i,n.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},e))}function mT(t){return Pe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function gT(t){const e={},n=Object.keys(t);let i;const r=n.length;let a;for(i=0;i<r;i++)a=n[i],e[a]=t[a];return e}function Rb(t){function e(n,i,r,a){let u=n[a++];if(u==="__proto__")return!0;const l=Number.isFinite(+u),g=a>=n.length;return u=!u&&Pe.isArray(r)?r.length:u,g?(Pe.hasOwnProp(r,u)?r[u]=[r[u],i]:r[u]=i,!l):((!r[u]||!Pe.isObject(r[u]))&&(r[u]=[]),e(n,i,r[u],a)&&Pe.isArray(r[u])&&(r[u]=gT(r[u])),!l)}if(Pe.isFormData(t)&&Pe.isFunction(t.entries)){const n={};return Pe.forEachEntry(t,(i,r)=>{e(mT(i),r,n,0)}),n}return null}function yT(t,e,n){if(Pe.isString(t))try{return(e||JSON.parse)(t),Pe.trim(t)}catch(i){if(i.name!=="SyntaxError")throw i}return(0,JSON.stringify)(t)}const Ku={transitional:Nb,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const i=n.getContentType()||"",r=i.indexOf("application/json")>-1,a=Pe.isObject(e);if(a&&Pe.isHTMLForm(e)&&(e=new FormData(e)),Pe.isFormData(e))return r?JSON.stringify(Rb(e)):e;if(Pe.isArrayBuffer(e)||Pe.isBuffer(e)||Pe.isStream(e)||Pe.isFile(e)||Pe.isBlob(e)||Pe.isReadableStream(e))return e;if(Pe.isArrayBufferView(e))return e.buffer;if(Pe.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return fT(e,this.formSerializer).toString();if((l=Pe.isFileList(e))||i.indexOf("multipart/form-data")>-1){const g=this.env&&this.env.FormData;return lp(l?{"files[]":e}:e,g&&new g,this.formSerializer)}}return a||r?(n.setContentType("application/json",!1),yT(e)):e}],transformResponse:[function(e){const n=this.transitional||Ku.transitional,i=n&&n.forcedJSONParsing,r=this.responseType==="json";if(Pe.isResponse(e)||Pe.isReadableStream(e))return e;if(e&&Pe.isString(e)&&(i&&!this.responseType||r)){const u=!(n&&n.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(l){if(u)throw l.name==="SyntaxError"?qt.from(l,qt.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:kr.classes.FormData,Blob:kr.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Pe.forEach(["delete","get","head","post","put","patch"],t=>{Ku.headers[t]={}});const _T=Pe.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"]),bT=t=>{const e={};let n,i,r;return t&&t.split(`
|
2
2
|
`).forEach(function(u){r=u.indexOf(":"),n=u.substring(0,r).trim().toLowerCase(),i=u.substring(r+1).trim(),!(!n||e[n]&&_T[n])&&(n==="set-cookie"?e[n]?e[n].push(i):e[n]=[i]:e[n]=e[n]?e[n]+", "+i:i)}),e},Lb=Symbol("internals");function Ju(t){return t&&String(t).trim().toLowerCase()}function cp(t){return t===!1||t==null?t:Pe.isArray(t)?t.map(cp):String(t)}function xT(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(t);)e[i[1]]=i[2];return e}const vT=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function og(t,e,n,i,r){if(Pe.isFunction(i))return i.call(this,e,n);if(r&&(e=n),!!Pe.isString(e)){if(Pe.isString(i))return e.indexOf(i)!==-1;if(Pe.isRegExp(i))return i.test(e)}}function wT(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,i)=>n.toUpperCase()+i)}function kT(t,e){const n=Pe.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(t,i+n,{value:function(r,a,u){return this[i].call(this,e,r,a,u)},configurable:!0})})}class Sr{constructor(e){e&&this.set(e)}set(e,n,i){const r=this;function a(l,g,b){const S=Ju(g);if(!S)throw new Error("header name must be a non-empty string");const E=Pe.findKey(r,S);(!E||r[E]===void 0||b===!0||b===void 0&&r[E]!==!1)&&(r[E||g]=cp(l))}const u=(l,g)=>Pe.forEach(l,(b,S)=>a(b,S,g));if(Pe.isPlainObject(e)||e instanceof this.constructor)u(e,n);else if(Pe.isString(e)&&(e=e.trim())&&!vT(e))u(bT(e),n);else if(Pe.isHeaders(e))for(const[l,g]of e.entries())a(g,l,i);else e!=null&&a(n,e,i);return this}get(e,n){if(e=Ju(e),e){const i=Pe.findKey(this,e);if(i){const r=this[i];if(!n)return r;if(n===!0)return xT(r);if(Pe.isFunction(n))return n.call(this,r,i);if(Pe.isRegExp(n))return n.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Ju(e),e){const i=Pe.findKey(this,e);return!!(i&&this[i]!==void 0&&(!n||og(this,this[i],i,n)))}return!1}delete(e,n){const i=this;let r=!1;function a(u){if(u=Ju(u),u){const l=Pe.findKey(i,u);l&&(!n||og(i,i[l],l,n))&&(delete i[l],r=!0)}}return Pe.isArray(e)?e.forEach(a):a(e),r}clear(e){const n=Object.keys(this);let i=n.length,r=!1;for(;i--;){const a=n[i];(!e||og(this,this[a],a,e,!0))&&(delete this[a],r=!0)}return r}normalize(e){const n=this,i={};return Pe.forEach(this,(r,a)=>{const u=Pe.findKey(i,a);if(u){n[u]=cp(r),delete n[a];return}const l=e?wT(a):String(a).trim();l!==a&&delete n[a],n[l]=cp(r),i[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return Pe.forEach(this,(i,r)=>{i!=null&&i!==!1&&(n[r]=e&&Pe.isArray(i)?i.join(", "):i)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
|
3
|
-
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const i=new this(e);return n.forEach(r=>i.set(r)),i}static accessor(e){const i=(this[Lb]=this[Lb]={accessors:{}}).accessors,r=this.prototype;function a(u){const l=Ju(u);i[l]||(kT(r,u),i[l]=!0)}return Pe.isArray(e)?e.forEach(a):a(e),this}}Sr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Pe.reduceDescriptors(Sr.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(i){this[n]=i}}}),Pe.freezeMethods(Sr);function ag(t,e){const n=this||Ku,i=e||n,r=Sr.from(i.headers);let a=i.data;return Pe.forEach(t,function(l){a=l.call(n,a,r.normalize(),e?e.status:void 0)}),r.normalize(),a}function Vb(t){return!!(t&&t.__CANCEL__)}function dc(t,e,n){qt.call(this,t??"canceled",qt.ERR_CANCELED,e,n),this.name="CanceledError"}Pe.inherits(dc,qt,{__CANCEL__:!0});function Fb(t,e,n){const i=n.config.validateStatus;!n.status||!i||i(n.status)?t(n):e(new qt("Request failed with status code "+n.status,[qt.ERR_BAD_REQUEST,qt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function ST(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function ET(t,e){t=t||10;const n=new Array(t),i=new Array(t);let r=0,a=0,u;return e=e!==void 0?e:1e3,function(g){const b=Date.now(),S=i[a];u||(u=b),n[r]=g,i[r]=b;let E=a,C=0;for(;E!==r;)C+=n[E++],E=E%t;if(r=(r+1)%t,r===a&&(a=(a+1)%t),b-u<e)return;const P=S&&b-S;return P?Math.round(C*1e3/P):void 0}}function CT(t,e){let n=0,i=1e3/e,r,a;const u=(b,S=Date.now())=>{n=S,r=null,a&&(clearTimeout(a),a=null),t.apply(null,b)};return[(...b)=>{const S=Date.now(),E=S-n;E>=i?u(b,S):(r=b,a||(a=setTimeout(()=>{a=null,u(r)},i-E)))},()=>r&&u(r)]}const up=(t,e,n=3)=>{let i=0;const r=ET(50,250);return CT(a=>{const u=a.loaded,l=a.lengthComputable?a.total:void 0,g=u-i,b=r(g),S=u<=l;i=u;const E={loaded:u,total:l,progress:l?u/l:void 0,bytes:g,rate:b||void 0,estimated:b&&l&&S?(l-u)/b:void 0,event:a,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(E)},n)},$b=(t,e)=>{const n=t!=null;return[i=>e[0]({lengthComputable:n,total:t,loaded:i}),e[1]]},jb=t=>(...e)=>Pe.asap(()=>t(...e)),TT=kr.hasStandardBrowserEnv?function(){const e=kr.navigator&&/(msie|trident)/i.test(kr.navigator.userAgent),n=document.createElement("a");let i;function r(a){let u=a;return e&&(n.setAttribute("href",u),u=n.href),n.setAttribute("href",u),{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 i=r(window.location.href),function(u){const l=Pe.isString(u)?r(u):u;return l.protocol===i.protocol&&l.host===i.host}}():function(){return function(){return!0}}(),MT=kr.hasStandardBrowserEnv?{write(t,e,n,i,r,a){const u=[t+"="+encodeURIComponent(e)];Pe.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),Pe.isString(i)&&u.push("path="+i),Pe.isString(r)&&u.push("domain="+r),a===!0&&u.push("secure"),document.cookie=u.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 AT(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function IT(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Ub(t,e){return t&&!AT(e)?IT(t,e):e}const Hb=t=>t instanceof Sr?{...t}:t;function cl(t,e){e=e||{};const n={};function i(b,S,E){return Pe.isPlainObject(b)&&Pe.isPlainObject(S)?Pe.merge.call({caseless:E},b,S):Pe.isPlainObject(S)?Pe.merge({},S):Pe.isArray(S)?S.slice():S}function r(b,S,E){if(Pe.isUndefined(S)){if(!Pe.isUndefined(b))return i(void 0,b,E)}else return i(b,S,E)}function a(b,S){if(!Pe.isUndefined(S))return i(void 0,S)}function u(b,S){if(Pe.isUndefined(S)){if(!Pe.isUndefined(b))return i(void 0,b)}else return i(void 0,S)}function l(b,S,E){if(E in e)return i(b,S);if(E in t)return i(void 0,b)}const g={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:l,headers:(b,S)=>r(Hb(b),Hb(S),!0)};return Pe.forEach(Object.keys(Object.assign({},t,e)),function(S){const E=g[S]||r,C=E(t[S],e[S],S);Pe.isUndefined(C)&&E!==l||(n[S]=C)}),n}const qb=t=>{const e=cl({},t);let{data:n,withXSRFToken:i,xsrfHeaderName:r,xsrfCookieName:a,headers:u,auth:l}=e;e.headers=u=Sr.from(u),e.url=zb(Ub(e.baseURL,e.url),t.params,t.paramsSerializer),l&&u.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let g;if(Pe.isFormData(n)){if(kr.hasStandardBrowserEnv||kr.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if((g=u.getContentType())!==!1){const[b,...S]=g?g.split(";").map(E=>E.trim()).filter(Boolean):[];u.setContentType([b||"multipart/form-data",...S].join("; "))}}if(kr.hasStandardBrowserEnv&&(i&&Pe.isFunction(i)&&(i=i(e)),i||i!==!1&&TT(e.url))){const b=r&&a&&MT.read(a);b&&u.set(r,b)}return e},PT=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(n,i){const r=qb(t);let a=r.data;const u=Sr.from(r.headers).normalize();let{responseType:l,onUploadProgress:g,onDownloadProgress:b}=r,S,E,C,P,D;function R(){P&&P(),D&&D(),r.cancelToken&&r.cancelToken.unsubscribe(S),r.signal&&r.signal.removeEventListener("abort",S)}let j=new XMLHttpRequest;j.open(r.method.toUpperCase(),r.url,!0),j.timeout=r.timeout;function W(){if(!j)return;const le=Sr.from("getAllResponseHeaders"in j&&j.getAllResponseHeaders()),Te={data:!l||l==="text"||l==="json"?j.responseText:j.response,status:j.status,statusText:j.statusText,headers:le,config:t,request:j};Fb(function(Ae){n(Ae),R()},function(Ae){i(Ae),R()},Te),j=null}"onloadend"in j?j.onloadend=W:j.onreadystatechange=function(){!j||j.readyState!==4||j.status===0&&!(j.responseURL&&j.responseURL.indexOf("file:")===0)||setTimeout(W)},j.onabort=function(){j&&(i(new qt("Request aborted",qt.ECONNABORTED,t,j)),j=null)},j.onerror=function(){i(new qt("Network Error",qt.ERR_NETWORK,t,j)),j=null},j.ontimeout=function(){let J=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const Te=r.transitional||Nb;r.timeoutErrorMessage&&(J=r.timeoutErrorMessage),i(new qt(J,Te.clarifyTimeoutError?qt.ETIMEDOUT:qt.ECONNABORTED,t,j)),j=null},a===void 0&&u.setContentType(null),"setRequestHeader"in j&&Pe.forEach(u.toJSON(),function(J,Te){j.setRequestHeader(Te,J)}),Pe.isUndefined(r.withCredentials)||(j.withCredentials=!!r.withCredentials),l&&l!=="json"&&(j.responseType=r.responseType),b&&([C,D]=up(b,!0),j.addEventListener("progress",C)),g&&j.upload&&([E,P]=up(g),j.upload.addEventListener("progress",E),j.upload.addEventListener("loadend",P)),(r.cancelToken||r.signal)&&(S=le=>{j&&(i(!le||le.type?new dc(null,t,j):le),j.abort(),j=null)},r.cancelToken&&r.cancelToken.subscribe(S),r.signal&&(r.signal.aborted?S():r.signal.addEventListener("abort",S)));const ee=ST(r.url);if(ee&&kr.protocols.indexOf(ee)===-1){i(new qt("Unsupported protocol "+ee+":",qt.ERR_BAD_REQUEST,t));return}j.send(a||null)})},DT=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let i=new AbortController,r;const a=function(b){if(!r){r=!0,l();const S=b instanceof Error?b:this.reason;i.abort(S instanceof qt?S:new dc(S instanceof Error?S.message:S))}};let u=e&&setTimeout(()=>{u=null,a(new qt(`timeout ${e} of ms exceeded`,qt.ETIMEDOUT))},e);const l=()=>{t&&(u&&clearTimeout(u),u=null,t.forEach(b=>{b.unsubscribe?b.unsubscribe(a):b.removeEventListener("abort",a)}),t=null)};t.forEach(b=>b.addEventListener("abort",a));const{signal:g}=i;return g.unsubscribe=()=>Pe.asap(l),g}},OT=function*(t,e){let n=t.byteLength;if(!e||n<e){yield t;return}let i=0,r;for(;i<n;)r=i+e,yield t.slice(i,r),i=r},zT=async function*(t,e){for await(const n of BT(t))yield*OT(n,e)},BT=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:i}=await e.read();if(n)break;yield i}}finally{await e.cancel()}},Wb=(t,e,n,i)=>{const r=zT(t,e);let a=0,u,l=g=>{u||(u=!0,i&&i(g))};return new ReadableStream({async pull(g){try{const{done:b,value:S}=await r.next();if(b){l(),g.close();return}let E=S.byteLength;if(n){let C=a+=E;n(C)}g.enqueue(new Uint8Array(S))}catch(b){throw l(b),b}},cancel(g){return l(g),r.return()}},{highWaterMark:2})},hp=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Gb=hp&&typeof ReadableStream=="function",NT=hp&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),Zb=(t,...e)=>{try{return!!t(...e)}catch{return!1}},RT=Gb&&Zb(()=>{let t=!1;const e=new Request(kr.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Yb=64*1024,lg=Gb&&Zb(()=>Pe.isReadableStream(new Response("").body)),dp={stream:lg&&(t=>t.body)};hp&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!dp[e]&&(dp[e]=Pe.isFunction(t[e])?n=>n[e]():(n,i)=>{throw new qt(`Response type '${e}' is not supported`,qt.ERR_NOT_SUPPORT,i)})})})(new Response);const LT=async t=>{if(t==null)return 0;if(Pe.isBlob(t))return t.size;if(Pe.isSpecCompliantForm(t))return(await new Request(kr.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Pe.isArrayBufferView(t)||Pe.isArrayBuffer(t))return t.byteLength;if(Pe.isURLSearchParams(t)&&(t=t+""),Pe.isString(t))return(await NT(t)).byteLength},VT=async(t,e)=>{const n=Pe.toFiniteNumber(t.getContentLength());return n??LT(e)},cg={http:oT,xhr:PT,fetch:hp&&(async t=>{let{url:e,method:n,data:i,signal:r,cancelToken:a,timeout:u,onDownloadProgress:l,onUploadProgress:g,responseType:b,headers:S,withCredentials:E="same-origin",fetchOptions:C}=qb(t);b=b?(b+"").toLowerCase():"text";let P=DT([r,a&&a.toAbortSignal()],u),D;const R=P&&P.unsubscribe&&(()=>{P.unsubscribe()});let j;try{if(g&&RT&&n!=="get"&&n!=="head"&&(j=await VT(S,i))!==0){let Te=new Request(e,{method:"POST",body:i,duplex:"half"}),xe;if(Pe.isFormData(i)&&(xe=Te.headers.get("content-type"))&&S.setContentType(xe),Te.body){const[Ae,je]=$b(j,up(jb(g)));i=Wb(Te.body,Yb,Ae,je)}}Pe.isString(E)||(E=E?"include":"omit");const W="credentials"in Request.prototype;D=new Request(e,{...C,signal:P,method:n.toUpperCase(),headers:S.normalize().toJSON(),body:i,duplex:"half",credentials:W?E:void 0});let ee=await fetch(D);const le=lg&&(b==="stream"||b==="response");if(lg&&(l||le&&R)){const Te={};["status","statusText","headers"].forEach(De=>{Te[De]=ee[De]});const xe=Pe.toFiniteNumber(ee.headers.get("content-length")),[Ae,je]=l&&$b(xe,up(jb(l),!0))||[];ee=new Response(Wb(ee.body,Yb,Ae,()=>{je&&je(),R&&R()}),Te)}b=b||"text";let J=await dp[Pe.findKey(dp,b)||"text"](ee,t);return!le&&R&&R(),await new Promise((Te,xe)=>{Fb(Te,xe,{data:J,headers:Sr.from(ee.headers),status:ee.status,statusText:ee.statusText,config:t,request:D})})}catch(W){throw R&&R(),W&&W.name==="TypeError"&&/fetch/i.test(W.message)?Object.assign(new qt("Network Error",qt.ERR_NETWORK,t,D),{cause:W.cause||W}):qt.from(W,W&&W.code,t,D)}})};Pe.forEach(cg,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Xb=t=>`- ${t}`,FT=t=>Pe.isFunction(t)||t===null||t===!1,Kb={getAdapter:t=>{t=Pe.isArray(t)?t:[t];const{length:e}=t;let n,i;const r={};for(let a=0;a<e;a++){n=t[a];let u;if(i=n,!FT(n)&&(i=cg[(u=String(n)).toLowerCase()],i===void 0))throw new qt(`Unknown adapter '${u}'`);if(i)break;r[u||"#"+a]=i}if(!i){const a=Object.entries(r).map(([l,g])=>`adapter ${l} `+(g===!1?"is not supported by the environment":"is not available in the build"));let u=e?a.length>1?`since :
|
3
|
+
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const i=new this(e);return n.forEach(r=>i.set(r)),i}static accessor(e){const i=(this[Lb]=this[Lb]={accessors:{}}).accessors,r=this.prototype;function a(u){const l=Ju(u);i[l]||(kT(r,u),i[l]=!0)}return Pe.isArray(e)?e.forEach(a):a(e),this}}Sr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Pe.reduceDescriptors(Sr.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(i){this[n]=i}}}),Pe.freezeMethods(Sr);function ag(t,e){const n=this||Ku,i=e||n,r=Sr.from(i.headers);let a=i.data;return Pe.forEach(t,function(l){a=l.call(n,a,r.normalize(),e?e.status:void 0)}),r.normalize(),a}function Vb(t){return!!(t&&t.__CANCEL__)}function dc(t,e,n){qt.call(this,t??"canceled",qt.ERR_CANCELED,e,n),this.name="CanceledError"}Pe.inherits(dc,qt,{__CANCEL__:!0});function Fb(t,e,n){const i=n.config.validateStatus;!n.status||!i||i(n.status)?t(n):e(new qt("Request failed with status code "+n.status,[qt.ERR_BAD_REQUEST,qt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function ST(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function ET(t,e){t=t||10;const n=new Array(t),i=new Array(t);let r=0,a=0,u;return e=e!==void 0?e:1e3,function(g){const b=Date.now(),S=i[a];u||(u=b),n[r]=g,i[r]=b;let E=a,C=0;for(;E!==r;)C+=n[E++],E=E%t;if(r=(r+1)%t,r===a&&(a=(a+1)%t),b-u<e)return;const P=S&&b-S;return P?Math.round(C*1e3/P):void 0}}function CT(t,e){let n=0,i=1e3/e,r,a;const u=(b,S=Date.now())=>{n=S,r=null,a&&(clearTimeout(a),a=null),t.apply(null,b)};return[(...b)=>{const S=Date.now(),E=S-n;E>=i?u(b,S):(r=b,a||(a=setTimeout(()=>{a=null,u(r)},i-E)))},()=>r&&u(r)]}const up=(t,e,n=3)=>{let i=0;const r=ET(50,250);return CT(a=>{const u=a.loaded,l=a.lengthComputable?a.total:void 0,g=u-i,b=r(g),S=u<=l;i=u;const E={loaded:u,total:l,progress:l?u/l:void 0,bytes:g,rate:b||void 0,estimated:b&&l&&S?(l-u)/b:void 0,event:a,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(E)},n)},$b=(t,e)=>{const n=t!=null;return[i=>e[0]({lengthComputable:n,total:t,loaded:i}),e[1]]},jb=t=>(...e)=>Pe.asap(()=>t(...e)),TT=kr.hasStandardBrowserEnv?function(){const e=kr.navigator&&/(msie|trident)/i.test(kr.navigator.userAgent),n=document.createElement("a");let i;function r(a){let u=a;return e&&(n.setAttribute("href",u),u=n.href),n.setAttribute("href",u),{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 i=r(window.location.href),function(u){const l=Pe.isString(u)?r(u):u;return l.protocol===i.protocol&&l.host===i.host}}():function(){return function(){return!0}}(),MT=kr.hasStandardBrowserEnv?{write(t,e,n,i,r,a){const u=[t+"="+encodeURIComponent(e)];Pe.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),Pe.isString(i)&&u.push("path="+i),Pe.isString(r)&&u.push("domain="+r),a===!0&&u.push("secure"),document.cookie=u.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 AT(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function IT(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Ub(t,e){return t&&!AT(e)?IT(t,e):e}const Hb=t=>t instanceof Sr?{...t}:t;function cl(t,e){e=e||{};const n={};function i(b,S,E){return Pe.isPlainObject(b)&&Pe.isPlainObject(S)?Pe.merge.call({caseless:E},b,S):Pe.isPlainObject(S)?Pe.merge({},S):Pe.isArray(S)?S.slice():S}function r(b,S,E){if(Pe.isUndefined(S)){if(!Pe.isUndefined(b))return i(void 0,b,E)}else return i(b,S,E)}function a(b,S){if(!Pe.isUndefined(S))return i(void 0,S)}function u(b,S){if(Pe.isUndefined(S)){if(!Pe.isUndefined(b))return i(void 0,b)}else return i(void 0,S)}function l(b,S,E){if(E in e)return i(b,S);if(E in t)return i(void 0,b)}const g={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:l,headers:(b,S)=>r(Hb(b),Hb(S),!0)};return Pe.forEach(Object.keys(Object.assign({},t,e)),function(S){const E=g[S]||r,C=E(t[S],e[S],S);Pe.isUndefined(C)&&E!==l||(n[S]=C)}),n}const qb=t=>{const e=cl({},t);let{data:n,withXSRFToken:i,xsrfHeaderName:r,xsrfCookieName:a,headers:u,auth:l}=e;e.headers=u=Sr.from(u),e.url=zb(Ub(e.baseURL,e.url),t.params,t.paramsSerializer),l&&u.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let g;if(Pe.isFormData(n)){if(kr.hasStandardBrowserEnv||kr.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if((g=u.getContentType())!==!1){const[b,...S]=g?g.split(";").map(E=>E.trim()).filter(Boolean):[];u.setContentType([b||"multipart/form-data",...S].join("; "))}}if(kr.hasStandardBrowserEnv&&(i&&Pe.isFunction(i)&&(i=i(e)),i||i!==!1&&TT(e.url))){const b=r&&a&&MT.read(a);b&&u.set(r,b)}return e},PT=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(n,i){const r=qb(t);let a=r.data;const u=Sr.from(r.headers).normalize();let{responseType:l,onUploadProgress:g,onDownloadProgress:b}=r,S,E,C,P,D;function R(){P&&P(),D&&D(),r.cancelToken&&r.cancelToken.unsubscribe(S),r.signal&&r.signal.removeEventListener("abort",S)}let j=new XMLHttpRequest;j.open(r.method.toUpperCase(),r.url,!0),j.timeout=r.timeout;function W(){if(!j)return;const le=Sr.from("getAllResponseHeaders"in j&&j.getAllResponseHeaders()),Te={data:!l||l==="text"||l==="json"?j.responseText:j.response,status:j.status,statusText:j.statusText,headers:le,config:t,request:j};Fb(function(Ae){n(Ae),R()},function(Ae){i(Ae),R()},Te),j=null}"onloadend"in j?j.onloadend=W:j.onreadystatechange=function(){!j||j.readyState!==4||j.status===0&&!(j.responseURL&&j.responseURL.indexOf("file:")===0)||setTimeout(W)},j.onabort=function(){j&&(i(new qt("Request aborted",qt.ECONNABORTED,t,j)),j=null)},j.onerror=function(){i(new qt("Network Error",qt.ERR_NETWORK,t,j)),j=null},j.ontimeout=function(){let J=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const Te=r.transitional||Nb;r.timeoutErrorMessage&&(J=r.timeoutErrorMessage),i(new qt(J,Te.clarifyTimeoutError?qt.ETIMEDOUT:qt.ECONNABORTED,t,j)),j=null},a===void 0&&u.setContentType(null),"setRequestHeader"in j&&Pe.forEach(u.toJSON(),function(J,Te){j.setRequestHeader(Te,J)}),Pe.isUndefined(r.withCredentials)||(j.withCredentials=!!r.withCredentials),l&&l!=="json"&&(j.responseType=r.responseType),b&&([C,D]=up(b,!0),j.addEventListener("progress",C)),g&&j.upload&&([E,P]=up(g),j.upload.addEventListener("progress",E),j.upload.addEventListener("loadend",P)),(r.cancelToken||r.signal)&&(S=le=>{j&&(i(!le||le.type?new dc(null,t,j):le),j.abort(),j=null)},r.cancelToken&&r.cancelToken.subscribe(S),r.signal&&(r.signal.aborted?S():r.signal.addEventListener("abort",S)));const ee=ST(r.url);if(ee&&kr.protocols.indexOf(ee)===-1){i(new qt("Unsupported protocol "+ee+":",qt.ERR_BAD_REQUEST,t));return}j.send(a||null)})},DT=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let i=new AbortController,r;const a=function(b){if(!r){r=!0,l();const S=b instanceof Error?b:this.reason;i.abort(S instanceof qt?S:new dc(S instanceof Error?S.message:S))}};let u=e&&setTimeout(()=>{u=null,a(new qt(`timeout ${e} of ms exceeded`,qt.ETIMEDOUT))},e);const l=()=>{t&&(u&&clearTimeout(u),u=null,t.forEach(b=>{b.unsubscribe?b.unsubscribe(a):b.removeEventListener("abort",a)}),t=null)};t.forEach(b=>b.addEventListener("abort",a));const{signal:g}=i;return g.unsubscribe=()=>Pe.asap(l),g}},OT=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let i=0,r;for(;i<n;)r=i+e,yield t.slice(i,r),i=r},zT=async function*(t,e){for await(const n of BT(t))yield*OT(n,e)},BT=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:i}=await e.read();if(n)break;yield i}}finally{await e.cancel()}},Wb=(t,e,n,i)=>{const r=zT(t,e);let a=0,u,l=g=>{u||(u=!0,i&&i(g))};return new ReadableStream({async pull(g){try{const{done:b,value:S}=await r.next();if(b){l(),g.close();return}let E=S.byteLength;if(n){let C=a+=E;n(C)}g.enqueue(new Uint8Array(S))}catch(b){throw l(b),b}},cancel(g){return l(g),r.return()}},{highWaterMark:2})},hp=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Gb=hp&&typeof ReadableStream=="function",NT=hp&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),Zb=(t,...e)=>{try{return!!t(...e)}catch{return!1}},RT=Gb&&Zb(()=>{let t=!1;const e=new Request(kr.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Yb=64*1024,lg=Gb&&Zb(()=>Pe.isReadableStream(new Response("").body)),dp={stream:lg&&(t=>t.body)};hp&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!dp[e]&&(dp[e]=Pe.isFunction(t[e])?n=>n[e]():(n,i)=>{throw new qt(`Response type '${e}' is not supported`,qt.ERR_NOT_SUPPORT,i)})})})(new Response);const LT=async t=>{if(t==null)return 0;if(Pe.isBlob(t))return t.size;if(Pe.isSpecCompliantForm(t))return(await new Request(kr.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Pe.isArrayBufferView(t)||Pe.isArrayBuffer(t))return t.byteLength;if(Pe.isURLSearchParams(t)&&(t=t+""),Pe.isString(t))return(await NT(t)).byteLength},VT=async(t,e)=>{const n=Pe.toFiniteNumber(t.getContentLength());return n??LT(e)},cg={http:oT,xhr:PT,fetch:hp&&(async t=>{let{url:e,method:n,data:i,signal:r,cancelToken:a,timeout:u,onDownloadProgress:l,onUploadProgress:g,responseType:b,headers:S,withCredentials:E="same-origin",fetchOptions:C}=qb(t);b=b?(b+"").toLowerCase():"text";let P=DT([r,a&&a.toAbortSignal()],u),D;const R=P&&P.unsubscribe&&(()=>{P.unsubscribe()});let j;try{if(g&&RT&&n!=="get"&&n!=="head"&&(j=await VT(S,i))!==0){let Te=new Request(e,{method:"POST",body:i,duplex:"half"}),xe;if(Pe.isFormData(i)&&(xe=Te.headers.get("content-type"))&&S.setContentType(xe),Te.body){const[Ae,je]=$b(j,up(jb(g)));i=Wb(Te.body,Yb,Ae,je)}}Pe.isString(E)||(E=E?"include":"omit");const W="credentials"in Request.prototype;D=new Request(e,{...C,signal:P,method:n.toUpperCase(),headers:S.normalize().toJSON(),body:i,duplex:"half",credentials:W?E:void 0});let ee=await fetch(D);const le=lg&&(b==="stream"||b==="response");if(lg&&(l||le&&R)){const Te={};["status","statusText","headers"].forEach(De=>{Te[De]=ee[De]});const xe=Pe.toFiniteNumber(ee.headers.get("content-length")),[Ae,je]=l&&$b(xe,up(jb(l),!0))||[];ee=new Response(Wb(ee.body,Yb,Ae,()=>{je&&je(),R&&R()}),Te)}b=b||"text";let J=await dp[Pe.findKey(dp,b)||"text"](ee,t);return!le&&R&&R(),await new Promise((Te,xe)=>{Fb(Te,xe,{data:J,headers:Sr.from(ee.headers),status:ee.status,statusText:ee.statusText,config:t,request:D})})}catch(W){throw R&&R(),W&&W.name==="TypeError"&&/fetch/i.test(W.message)?Object.assign(new qt("Network Error",qt.ERR_NETWORK,t,D),{cause:W.cause||W}):qt.from(W,W&&W.code,t,D)}})};Pe.forEach(cg,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Xb=t=>`- ${t}`,FT=t=>Pe.isFunction(t)||t===null||t===!1,Kb={getAdapter:t=>{t=Pe.isArray(t)?t:[t];const{length:e}=t;let n,i;const r={};for(let a=0;a<e;a++){n=t[a];let u;if(i=n,!FT(n)&&(i=cg[(u=String(n)).toLowerCase()],i===void 0))throw new qt(`Unknown adapter '${u}'`);if(i)break;r[u||"#"+a]=i}if(!i){const a=Object.entries(r).map(([l,g])=>`adapter ${l} `+(g===!1?"is not supported by the environment":"is not available in the build"));let u=e?a.length>1?`since :
|
4
4
|
`+a.map(Xb).join(`
|
5
5
|
`):" "+Xb(a[0]):"as no adapter specified";throw new qt("There is no suitable adapter to dispatch the request "+u,"ERR_NOT_SUPPORT")}return i},adapters:cg};function ug(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new dc(null,t)}function Jb(t){return ug(t),t.headers=Sr.from(t.headers),t.data=ag.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Kb.getAdapter(t.adapter||Ku.adapter)(t).then(function(i){return ug(t),i.data=ag.call(t,t.transformResponse,i),i.headers=Sr.from(i.headers),i},function(i){return Vb(i)||(ug(t),i&&i.response&&(i.response.data=ag.call(t,t.transformResponse,i.response),i.response.headers=Sr.from(i.response.headers))),Promise.reject(i)})}const Qb="1.7.7",hg={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{hg[t]=function(i){return typeof i===t||"a"+(e<1?"n ":" ")+t}});const ex={};hg.transitional=function(e,n,i){function r(a,u){return"[Axios v"+Qb+"] Transitional option '"+a+"'"+u+(i?". "+i:"")}return(a,u,l)=>{if(e===!1)throw new qt(r(u," has been removed"+(n?" in "+n:"")),qt.ERR_DEPRECATED);return n&&!ex[u]&&(ex[u]=!0,console.warn(r(u," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(a,u,l):!0}};function $T(t,e,n){if(typeof t!="object")throw new qt("options must be an object",qt.ERR_BAD_OPTION_VALUE);const i=Object.keys(t);let r=i.length;for(;r-- >0;){const a=i[r],u=e[a];if(u){const l=t[a],g=l===void 0||u(l,a,t);if(g!==!0)throw new qt("option "+a+" must be "+g,qt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new qt("Unknown option "+a,qt.ERR_BAD_OPTION)}}const dg={assertOptions:$T,validators:hg},ia=dg.validators;class ul{constructor(e){this.defaults=e,this.interceptors={request:new Bb,response:new Bb}}async request(e,n){try{return await this._request(e,n)}catch(i){if(i instanceof Error){let r;Error.captureStackTrace?Error.captureStackTrace(r={}):r=new Error;const a=r.stack?r.stack.replace(/^.+\n/,""):"";try{i.stack?a&&!String(i.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(i.stack+=`
|
6
6
|
`+a):i.stack=a}catch{}}throw i}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=cl(this.defaults,n);const{transitional:i,paramsSerializer:r,headers:a}=n;i!==void 0&&dg.assertOptions(i,{silentJSONParsing:ia.transitional(ia.boolean),forcedJSONParsing:ia.transitional(ia.boolean),clarifyTimeoutError:ia.transitional(ia.boolean)},!1),r!=null&&(Pe.isFunction(r)?n.paramsSerializer={serialize:r}:dg.assertOptions(r,{encode:ia.function,serialize:ia.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let u=a&&Pe.merge(a.common,a[n.method]);a&&Pe.forEach(["delete","get","head","post","put","patch","common"],D=>{delete a[D]}),n.headers=Sr.concat(u,a);const l=[];let g=!0;this.interceptors.request.forEach(function(R){typeof R.runWhen=="function"&&R.runWhen(n)===!1||(g=g&&R.synchronous,l.unshift(R.fulfilled,R.rejected))});const b=[];this.interceptors.response.forEach(function(R){b.push(R.fulfilled,R.rejected)});let S,E=0,C;if(!g){const D=[Jb.bind(this),void 0];for(D.unshift.apply(D,l),D.push.apply(D,b),C=D.length,S=Promise.resolve(n);E<C;)S=S.then(D[E++],D[E++]);return S}C=l.length;let P=n;for(E=0;E<C;){const D=l[E++],R=l[E++];try{P=D(P)}catch(j){R.call(this,j);break}}try{S=Jb.call(this,P)}catch(D){return Promise.reject(D)}for(E=0,C=b.length;E<C;)S=S.then(b[E++],b[E++]);return S}getUri(e){e=cl(this.defaults,e);const n=Ub(e.baseURL,e.url);return zb(n,e.params,e.paramsSerializer)}}Pe.forEach(["delete","get","head","options"],function(e){ul.prototype[e]=function(n,i){return this.request(cl(i||{},{method:e,url:n,data:(i||{}).data}))}}),Pe.forEach(["post","put","patch"],function(e){function n(i){return function(a,u,l){return this.request(cl(l||{},{method:e,headers:i?{"Content-Type":"multipart/form-data"}:{},url:a,data:u}))}}ul.prototype[e]=n(),ul.prototype[e+"Form"]=n(!0)});class pg{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const i=this;this.promise.then(r=>{if(!i._listeners)return;let a=i._listeners.length;for(;a-- >0;)i._listeners[a](r);i._listeners=null}),this.promise.then=r=>{let a;const u=new Promise(l=>{i.subscribe(l),a=l}).then(r);return u.cancel=function(){i.unsubscribe(a)},u},e(function(a,u,l){i.reason||(i.reason=new dc(a,u,l),n(i.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)}toAbortSignal(){const e=new AbortController,n=i=>{e.abort(i)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new pg(function(r){e=r}),cancel:e}}}function jT(t){return function(n){return t.apply(null,n)}}function UT(t){return Pe.isObject(t)&&t.isAxiosError===!0}const fg={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(fg).forEach(([t,e])=>{fg[e]=t});function tx(t){const e=new ul(t),n=uc(ul.prototype.request,e);return Pe.extend(n,ul.prototype,e,{allOwnKeys:!0}),Pe.extend(n,e,null,{allOwnKeys:!0}),n.create=function(r){return tx(cl(t,r))},n}const ct=tx(Ku);ct.Axios=ul,ct.CanceledError=dc,ct.CancelToken=pg,ct.isCancel=Vb,ct.VERSION=Qb,ct.toFormData=lp,ct.AxiosError=qt,ct.Cancel=ct.CanceledError,ct.all=function(e){return Promise.all(e)},ct.spread=jT,ct.isAxiosError=UT,ct.mergeConfig=cl,ct.AxiosHeaders=Sr,ct.formToJSON=t=>Rb(Pe.isHTMLForm(t)?new FormData(t):t),ct.getAdapter=Kb.getAdapter,ct.HttpStatusCode=fg,ct.default=ct;const hl=f.ref({}),HT={__name:"admin",setup(t){var n,i;document.title=((n=hl.value)==null?void 0:n.titlePrefix)||""+((i=hl.value)==null?void 0:i.title)||"",e(hl.value.favicon);function e(r){let a=document.querySelector("link[rel~='icon']");a||(a=document.createElement("link"),a.rel="icon",document.getElementsByTagName("head")[0].appendChild(a)),a.href=r}return(r,a)=>{const u=f.resolveComponent("router-view");return f.openBlock(),f.createBlock(u)}}};function qT(){return nx().__VUE_DEVTOOLS_GLOBAL_HOOK__}function nx(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const WT=typeof Proxy=="function",GT="devtools-plugin:setup",ZT="plugin:settings:set";let pc,mg;function YT(){var t;return pc!==void 0||(typeof window<"u"&&window.performance?(pc=!0,mg=window.performance):typeof globalThis<"u"&&(!((t=globalThis.perf_hooks)===null||t===void 0)&&t.performance)?(pc=!0,mg=globalThis.perf_hooks.performance):pc=!1),pc}function XT(){return YT()?mg.now():Date.now()}class KT{constructor(e,n){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=n;const i={};if(e.settings)for(const u in e.settings){const l=e.settings[u];i[u]=l.defaultValue}const r=`__vue-devtools-plugin-settings__${e.id}`;let a=Object.assign({},i);try{const u=localStorage.getItem(r),l=JSON.parse(u);Object.assign(a,l)}catch{}this.fallbacks={getSettings(){return a},setSettings(u){try{localStorage.setItem(r,JSON.stringify(u))}catch{}a=u},now(){return XT()}},n&&n.on(ZT,(u,l)=>{u===this.plugin.id&&this.fallbacks.setSettings(l)}),this.proxiedOn=new Proxy({},{get:(u,l)=>this.target?this.target.on[l]:(...g)=>{this.onQueue.push({method:l,args:g})}}),this.proxiedTarget=new Proxy({},{get:(u,l)=>this.target?this.target[l]:l==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(l)?(...g)=>(this.targetQueue.push({method:l,args:g,resolve:()=>{}}),this.fallbacks[l](...g)):(...g)=>new Promise(b=>{this.targetQueue.push({method:l,args:g,resolve:b})})})}async setRealTarget(e){this.target=e;for(const n of this.onQueue)this.target.on[n.method](...n.args);for(const n of this.targetQueue)n.resolve(await this.target[n.method](...n.args))}}function JT(t,e){const n=t,i=nx(),r=qT(),a=WT&&n.enableEarlyProxy;if(r&&(i.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!a))r.emit(GT,t,e);else{const u=a?new KT(n,r):null;(i.__VUE_DEVTOOLS_PLUGINS__=i.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:n,setupFn:e,proxy:u}),u&&e(u.proxiedTarget)}}/*!
|
@@ -621,15 +621,15 @@ uniform ${V} ${F} u_${G};
|
|
621
621
|
#endif
|
622
622
|
`}),staticAttributes:m,staticUniforms:M}}class Qh{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(s,d,m,y,x,M,I,O,N){this.context=s;let V=this.boundPaintVertexBuffers.length!==y.length;for(let F=0;!V&&F<y.length;F++)this.boundPaintVertexBuffers[F]!==y[F]&&(V=!0);!this.vao||this.boundProgram!==d||this.boundLayoutVertexBuffer!==m||V||this.boundIndexBuffer!==x||this.boundVertexOffset!==M||this.boundDynamicVertexBuffer!==I||this.boundDynamicVertexBuffer2!==O||this.boundDynamicVertexBuffer3!==N?this.freshBind(d,m,y,x,M,I,O,N):(s.bindVertexArray.set(this.vao),I&&I.bind(),x&&x.dynamicDraw&&x.bind(),O&&O.bind(),N&&N.bind())}freshBind(s,d,m,y,x,M,I,O){const N=s.numAttributes,V=this.context,F=V.gl;this.vao&&this.destroy(),this.vao=V.createVertexArray(),V.bindVertexArray.set(this.vao),this.boundProgram=s,this.boundLayoutVertexBuffer=d,this.boundPaintVertexBuffers=m,this.boundIndexBuffer=y,this.boundVertexOffset=x,this.boundDynamicVertexBuffer=M,this.boundDynamicVertexBuffer2=I,this.boundDynamicVertexBuffer3=O,d.enableAttributes(F,s);for(const G of m)G.enableAttributes(F,s);M&&M.enableAttributes(F,s),I&&I.enableAttributes(F,s),O&&O.enableAttributes(F,s),d.bind(),d.setVertexAttribPointers(F,s,x);for(const G of m)G.bind(),G.setVertexAttribPointers(F,s,x);M&&(M.bind(),M.setVertexAttribPointers(F,s,x)),y&&y.bind(),I&&(I.bind(),I.setVertexAttribPointers(F,s,x)),O&&(O.bind(),O.setVertexAttribPointers(F,s,x)),V.currentNumAttributes=N}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const ed=(v,s,d,m,y)=>({u_matrix:v,u_texture:0,u_ele_delta:s,u_fog_matrix:d,u_fog_color:m?m.properties.get("fog-color"):l.aM.white,u_fog_ground_blend:m?m.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:m?m.calculateFogBlendOpacity(y):0,u_horizon_color:m?m.properties.get("horizon-color"):l.aM.white,u_horizon_fog_blend:m?m.properties.get("horizon-fog-blend"):1});function Ia(v){const s=[];for(let d=0;d<v.length;d++){if(v[d]===null)continue;const m=v[d].split(" ");s.push(m.pop())}return s}class td{constructor(s,d,m,y,x,M){const I=s.gl;this.program=I.createProgram();const O=Ia(d.staticAttributes),N=m?m.getBinderAttributes():[],V=O.concat(N),F=ho.prelude.staticUniforms?Ia(ho.prelude.staticUniforms):[],G=d.staticUniforms?Ia(d.staticUniforms):[],K=m?m.getBinderUniforms():[],Q=F.concat(G).concat(K),re=[];for(const ve of Q)re.indexOf(ve)<0&&re.push(ve);const ae=m?m.defines():[];x&&ae.push("#define OVERDRAW_INSPECTOR;"),M&&ae.push("#define TERRAIN3D;");const ce=ae.concat(ho.prelude.fragmentSource,d.fragmentSource).join(`
|
623
623
|
`),he=ae.concat(ho.prelude.vertexSource,d.vertexSource).join(`
|
624
|
-
`),te=I.createShader(I.FRAGMENT_SHADER);if(I.isContextLost())return void(this.failedToCreate=!0);if(I.shaderSource(te,ce),I.compileShader(te),!I.getShaderParameter(te,I.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${I.getShaderInfoLog(te)}`);I.attachShader(this.program,te);const me=I.createShader(I.VERTEX_SHADER);if(I.isContextLost())return void(this.failedToCreate=!0);if(I.shaderSource(me,he),I.compileShader(me),!I.getShaderParameter(me,I.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${I.getShaderInfoLog(me)}`);I.attachShader(this.program,me),this.attributes={};const ge={};this.numAttributes=V.length;for(let ve=0;ve<this.numAttributes;ve++)V[ve]&&(I.bindAttribLocation(this.program,ve,V[ve]),this.attributes[V[ve]]=ve);if(I.linkProgram(this.program),!I.getProgramParameter(this.program,I.LINK_STATUS))throw new Error(`Program failed to link: ${I.getProgramInfoLog(this.program)}`);I.deleteShader(me),I.deleteShader(te);for(let ve=0;ve<re.length;ve++){const ze=re[ve];if(ze&&!ge[ze]){const Ve=I.getUniformLocation(this.program,ze);Ve&&(ge[ze]=Ve)}}this.fixedUniforms=y(s,ge),this.terrainUniforms=((ve,ze)=>({u_depth:new l.aH(ve,ze.u_depth),u_terrain:new l.aH(ve,ze.u_terrain),u_terrain_dim:new l.aI(ve,ze.u_terrain_dim),u_terrain_matrix:new l.aJ(ve,ze.u_terrain_matrix),u_terrain_unpack:new l.aK(ve,ze.u_terrain_unpack),u_terrain_exaggeration:new l.aI(ve,ze.u_terrain_exaggeration)}))(s,ge),this.binderUniforms=m?m.getUniforms(s,ge):[]}draw(s,d,m,y,x,M,I,O,N,V,F,G,K,Q,re,ae,ce,he){const te=s.gl;if(this.failedToCreate)return;if(s.program.set(this.program),s.setDepthMode(m),s.setStencilMode(y),s.setColorMode(x),s.setCullFace(M),O){s.activeTexture.set(te.TEXTURE2),te.bindTexture(te.TEXTURE_2D,O.depthTexture),s.activeTexture.set(te.TEXTURE3),te.bindTexture(te.TEXTURE_2D,O.texture);for(const ge in this.terrainUniforms)this.terrainUniforms[ge].set(O[ge])}for(const ge in this.fixedUniforms)this.fixedUniforms[ge].set(I[ge]);re&&re.setUniforms(s,this.binderUniforms,K,{zoom:Q});let me=0;switch(d){case te.LINES:me=2;break;case te.TRIANGLES:me=3;break;case te.LINE_STRIP:me=1}for(const ge of G.get()){const ve=ge.vaos||(ge.vaos={});(ve[N]||(ve[N]=new Qh)).bind(s,this,V,re?re.getPaintVertexBuffers():[],F,ge.vertexOffset,ae,ce,he),te.drawElements(d,ge.primitiveLength*me,te.UNSIGNED_SHORT,ge.primitiveOffset*me*2)}}}function iu(v,s,d){const m=1/Zt(d,1,s.transform.tileZoom),y=Math.pow(2,d.tileID.overscaledZ),x=d.tileSize*Math.pow(2,s.transform.tileZoom)/y,M=x*(d.tileID.canonical.x+d.tileID.wrap*y),I=x*d.tileID.canonical.y;return{u_image:0,u_texsize:d.imageAtlasTexture.size,u_scale:[m,v.fromScale,v.toScale],u_fade:v.t,u_pixel_coord_upper:[M>>16,I>>16],u_pixel_coord_lower:[65535&M,65535&I]}}const Vl=(v,s,d,m)=>{const y=s.style.light,x=y.properties.get("position"),M=[x.x,x.y,x.z],I=function(){var N=new l.A(9);return l.A!=Float32Array&&(N[1]=0,N[2]=0,N[3]=0,N[5]=0,N[6]=0,N[7]=0),N[0]=1,N[4]=1,N[8]=1,N}();y.properties.get("anchor")==="viewport"&&function(N,V){var F=Math.sin(V),G=Math.cos(V);N[0]=G,N[1]=F,N[2]=0,N[3]=-F,N[4]=G,N[5]=0,N[6]=0,N[7]=0,N[8]=1}(I,-s.transform.angle),function(N,V,F){var G=V[0],K=V[1],Q=V[2];N[0]=G*F[0]+K*F[3]+Q*F[6],N[1]=G*F[1]+K*F[4]+Q*F[7],N[2]=G*F[2]+K*F[5]+Q*F[8]}(M,M,I);const O=y.properties.get("color");return{u_matrix:v,u_lightpos:M,u_lightintensity:y.properties.get("intensity"),u_lightcolor:[O.r,O.g,O.b],u_vertical_gradient:+d,u_opacity:m}},ru=(v,s,d,m,y,x,M)=>l.e(Vl(v,s,d,m),iu(x,s,M),{u_height_factor:-Math.pow(2,y.overscaledZ)/M.tileSize/8}),Pa=v=>({u_matrix:v}),Kf=(v,s,d,m)=>l.e(Pa(v),iu(d,s,m)),n_=(v,s)=>({u_matrix:v,u_world:s}),Jf=(v,s,d,m,y)=>l.e(Kf(v,s,d,m),{u_world:y}),i_=(v,s,d,m)=>{const y=v.transform;let x,M;if(m.paint.get("circle-pitch-alignment")==="map"){const I=Zt(d,1,y.zoom);x=!0,M=[I,I]}else x=!1,M=y.pixelsToGLUnits;return{u_camera_to_center_distance:y.cameraToCenterDistance,u_scale_with_map:+(m.paint.get("circle-pitch-scale")==="map"),u_matrix:v.translatePosMatrix(s.posMatrix,d,m.paint.get("circle-translate"),m.paint.get("circle-translate-anchor")),u_pitch_with_map:+x,u_device_pixel_ratio:v.pixelRatio,u_extrude_scale:M}},jo=(v,s,d)=>({u_matrix:v,u_inv_matrix:s,u_camera_to_center_distance:d.cameraToCenterDistance,u_viewport_size:[d.width,d.height]}),Fl=(v,s,d=1)=>({u_matrix:v,u_color:s,u_overlay:0,u_overlay_scale:d}),nr=v=>({u_matrix:v}),ir=(v,s,d,m)=>({u_matrix:v,u_extrude_scale:Zt(s,1,d),u_intensity:m}),su=(v,s,d,m)=>{const y=l.H();l.aP(y,0,v.width,v.height,0,0,1);const x=v.context.gl;return{u_matrix:y,u_world:[x.drawingBufferWidth,x.drawingBufferHeight],u_image:d,u_color_ramp:m,u_opacity:s.paint.get("heatmap-opacity")}};function ou(v,s){const d=Math.pow(2,s.canonical.z),m=s.canonical.y;return[new l.Z(0,m/d).toLngLat().lat,new l.Z(0,(m+1)/d).toLngLat().lat]}const au=(v,s,d,m)=>{const y=v.transform;return{u_matrix:tm(v,s,d,m),u_ratio:1/Zt(s,1,y.zoom),u_device_pixel_ratio:v.pixelRatio,u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]]}},Qf=(v,s,d,m,y)=>l.e(au(v,s,d,y),{u_image:0,u_image_height:m}),Da=(v,s,d,m,y)=>{const x=v.transform,M=em(s,x);return{u_matrix:tm(v,s,d,y),u_texsize:s.imageAtlasTexture.size,u_ratio:1/Zt(s,1,x.zoom),u_device_pixel_ratio:v.pixelRatio,u_image:0,u_scale:[M,m.fromScale,m.toScale],u_fade:m.t,u_units_to_pixels:[1/x.pixelsToGLUnits[0],1/x.pixelsToGLUnits[1]]}},r_=(v,s,d,m,y,x)=>{const M=v.lineAtlas,I=em(s,v.transform),O=d.layout.get("line-cap")==="round",N=M.getDash(m.from,O),V=M.getDash(m.to,O),F=N.width*y.fromScale,G=V.width*y.toScale;return l.e(au(v,s,d,x),{u_patternscale_a:[I/F,-N.height/2],u_patternscale_b:[I/G,-V.height/2],u_sdfgamma:M.width/(256*Math.min(F,G)*v.pixelRatio)/2,u_image:0,u_tex_y_a:N.y,u_tex_y_b:V.y,u_mix:y.t})};function em(v,s){return 1/Zt(v,1,s.tileZoom)}function tm(v,s,d,m){return v.translatePosMatrix(m?m.posMatrix:s.tileID.posMatrix,s,d.paint.get("line-translate"),d.paint.get("line-translate-anchor"))}const s_=(v,s,d,m,y)=>{return{u_matrix:v,u_tl_parent:s,u_scale_parent:d,u_buffer_scale:1,u_fade_t:m.mix,u_opacity:m.opacity*y.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:y.paint.get("raster-brightness-min"),u_brightness_high:y.paint.get("raster-brightness-max"),u_saturation_factor:(M=y.paint.get("raster-saturation"),M>0?1-1/(1.001-M):-M),u_contrast_factor:(x=y.paint.get("raster-contrast"),x>0?1/(1-x):1+x),u_spin_weights:o_(y.paint.get("raster-hue-rotate"))};var x,M};function o_(v){v*=Math.PI/180;const s=Math.sin(v),d=Math.cos(v);return[(2*d+1)/3,(-Math.sqrt(3)*s-d+1)/3,(Math.sqrt(3)*s-d+1)/3]}const nm=(v,s,d,m,y,x,M,I,O,N,V,F,G,K)=>{const Q=M.transform;return{u_is_size_zoom_constant:+(v==="constant"||v==="source"),u_is_size_feature_constant:+(v==="constant"||v==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:Q.cameraToCenterDistance,u_pitch:Q.pitch/360*2*Math.PI,u_rotate_symbol:+d,u_aspect_ratio:Q.width/Q.height,u_fade_change:M.options.fadeDuration?M.symbolFadeChange:1,u_matrix:I,u_label_plane_matrix:O,u_coord_matrix:N,u_is_text:+F,u_pitch_with_map:+m,u_is_along_line:y,u_is_variable_anchor:x,u_texsize:G,u_texture:0,u_translation:V,u_pitched_scale:K}},$l=(v,s,d,m,y,x,M,I,O,N,V,F,G,K,Q)=>{const re=M.transform;return l.e(nm(v,s,d,m,y,x,M,I,O,N,V,F,G,Q),{u_gamma_scale:m?Math.cos(re._pitch)*re.cameraToCenterDistance:1,u_device_pixel_ratio:M.pixelRatio,u_is_halo:+K})},nd=(v,s,d,m,y,x,M,I,O,N,V,F,G,K)=>l.e($l(v,s,d,m,y,x,M,I,O,N,V,!0,F,!0,K),{u_texsize_icon:G,u_texture_icon:1}),lu=(v,s,d)=>({u_matrix:v,u_opacity:s,u_color:d}),id=(v,s,d,m,y,x)=>l.e(function(M,I,O,N){const V=O.imageManager.getPattern(M.from.toString()),F=O.imageManager.getPattern(M.to.toString()),{width:G,height:K}=O.imageManager.getPixelSize(),Q=Math.pow(2,N.tileID.overscaledZ),re=N.tileSize*Math.pow(2,O.transform.tileZoom)/Q,ae=re*(N.tileID.canonical.x+N.tileID.wrap*Q),ce=re*N.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:V.tl,u_pattern_br_a:V.br,u_pattern_tl_b:F.tl,u_pattern_br_b:F.br,u_texsize:[G,K],u_mix:I.t,u_pattern_size_a:V.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:I.fromScale,u_scale_b:I.toScale,u_tile_units_to_pixels:1/Zt(N,1,O.transform.tileZoom),u_pixel_coord_upper:[ae>>16,ce>>16],u_pixel_coord_lower:[65535&ae,65535&ce]}}(m,x,d,y),{u_matrix:v,u_opacity:s}),rd={fillExtrusion:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_lightpos:new l.aN(v,s.u_lightpos),u_lightintensity:new l.aI(v,s.u_lightintensity),u_lightcolor:new l.aN(v,s.u_lightcolor),u_vertical_gradient:new l.aI(v,s.u_vertical_gradient),u_opacity:new l.aI(v,s.u_opacity)}),fillExtrusionPattern:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_lightpos:new l.aN(v,s.u_lightpos),u_lightintensity:new l.aI(v,s.u_lightintensity),u_lightcolor:new l.aN(v,s.u_lightcolor),u_vertical_gradient:new l.aI(v,s.u_vertical_gradient),u_height_factor:new l.aI(v,s.u_height_factor),u_image:new l.aH(v,s.u_image),u_texsize:new l.aO(v,s.u_texsize),u_pixel_coord_upper:new l.aO(v,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,s.u_pixel_coord_lower),u_scale:new l.aN(v,s.u_scale),u_fade:new l.aI(v,s.u_fade),u_opacity:new l.aI(v,s.u_opacity)}),fill:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix)}),fillPattern:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_image:new l.aH(v,s.u_image),u_texsize:new l.aO(v,s.u_texsize),u_pixel_coord_upper:new l.aO(v,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,s.u_pixel_coord_lower),u_scale:new l.aN(v,s.u_scale),u_fade:new l.aI(v,s.u_fade)}),fillOutline:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_world:new l.aO(v,s.u_world)}),fillOutlinePattern:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_world:new l.aO(v,s.u_world),u_image:new l.aH(v,s.u_image),u_texsize:new l.aO(v,s.u_texsize),u_pixel_coord_upper:new l.aO(v,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,s.u_pixel_coord_lower),u_scale:new l.aN(v,s.u_scale),u_fade:new l.aI(v,s.u_fade)}),circle:(v,s)=>({u_camera_to_center_distance:new l.aI(v,s.u_camera_to_center_distance),u_scale_with_map:new l.aH(v,s.u_scale_with_map),u_pitch_with_map:new l.aH(v,s.u_pitch_with_map),u_extrude_scale:new l.aO(v,s.u_extrude_scale),u_device_pixel_ratio:new l.aI(v,s.u_device_pixel_ratio),u_matrix:new l.aJ(v,s.u_matrix)}),collisionBox:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_pixel_extrude_scale:new l.aO(v,s.u_pixel_extrude_scale)}),collisionCircle:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_inv_matrix:new l.aJ(v,s.u_inv_matrix),u_camera_to_center_distance:new l.aI(v,s.u_camera_to_center_distance),u_viewport_size:new l.aO(v,s.u_viewport_size)}),debug:(v,s)=>({u_color:new l.aL(v,s.u_color),u_matrix:new l.aJ(v,s.u_matrix),u_overlay:new l.aH(v,s.u_overlay),u_overlay_scale:new l.aI(v,s.u_overlay_scale)}),clippingMask:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix)}),heatmap:(v,s)=>({u_extrude_scale:new l.aI(v,s.u_extrude_scale),u_intensity:new l.aI(v,s.u_intensity),u_matrix:new l.aJ(v,s.u_matrix)}),heatmapTexture:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_world:new l.aO(v,s.u_world),u_image:new l.aH(v,s.u_image),u_color_ramp:new l.aH(v,s.u_color_ramp),u_opacity:new l.aI(v,s.u_opacity)}),hillshade:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_image:new l.aH(v,s.u_image),u_latrange:new l.aO(v,s.u_latrange),u_light:new l.aO(v,s.u_light),u_shadow:new l.aL(v,s.u_shadow),u_highlight:new l.aL(v,s.u_highlight),u_accent:new l.aL(v,s.u_accent)}),hillshadePrepare:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_image:new l.aH(v,s.u_image),u_dimension:new l.aO(v,s.u_dimension),u_zoom:new l.aI(v,s.u_zoom),u_unpack:new l.aK(v,s.u_unpack)}),line:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_ratio:new l.aI(v,s.u_ratio),u_device_pixel_ratio:new l.aI(v,s.u_device_pixel_ratio),u_units_to_pixels:new l.aO(v,s.u_units_to_pixels)}),lineGradient:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_ratio:new l.aI(v,s.u_ratio),u_device_pixel_ratio:new l.aI(v,s.u_device_pixel_ratio),u_units_to_pixels:new l.aO(v,s.u_units_to_pixels),u_image:new l.aH(v,s.u_image),u_image_height:new l.aI(v,s.u_image_height)}),linePattern:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_texsize:new l.aO(v,s.u_texsize),u_ratio:new l.aI(v,s.u_ratio),u_device_pixel_ratio:new l.aI(v,s.u_device_pixel_ratio),u_image:new l.aH(v,s.u_image),u_units_to_pixels:new l.aO(v,s.u_units_to_pixels),u_scale:new l.aN(v,s.u_scale),u_fade:new l.aI(v,s.u_fade)}),lineSDF:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_ratio:new l.aI(v,s.u_ratio),u_device_pixel_ratio:new l.aI(v,s.u_device_pixel_ratio),u_units_to_pixels:new l.aO(v,s.u_units_to_pixels),u_patternscale_a:new l.aO(v,s.u_patternscale_a),u_patternscale_b:new l.aO(v,s.u_patternscale_b),u_sdfgamma:new l.aI(v,s.u_sdfgamma),u_image:new l.aH(v,s.u_image),u_tex_y_a:new l.aI(v,s.u_tex_y_a),u_tex_y_b:new l.aI(v,s.u_tex_y_b),u_mix:new l.aI(v,s.u_mix)}),raster:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_tl_parent:new l.aO(v,s.u_tl_parent),u_scale_parent:new l.aI(v,s.u_scale_parent),u_buffer_scale:new l.aI(v,s.u_buffer_scale),u_fade_t:new l.aI(v,s.u_fade_t),u_opacity:new l.aI(v,s.u_opacity),u_image0:new l.aH(v,s.u_image0),u_image1:new l.aH(v,s.u_image1),u_brightness_low:new l.aI(v,s.u_brightness_low),u_brightness_high:new l.aI(v,s.u_brightness_high),u_saturation_factor:new l.aI(v,s.u_saturation_factor),u_contrast_factor:new l.aI(v,s.u_contrast_factor),u_spin_weights:new l.aN(v,s.u_spin_weights)}),symbolIcon:(v,s)=>({u_is_size_zoom_constant:new l.aH(v,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(v,s.u_is_size_feature_constant),u_size_t:new l.aI(v,s.u_size_t),u_size:new l.aI(v,s.u_size),u_camera_to_center_distance:new l.aI(v,s.u_camera_to_center_distance),u_pitch:new l.aI(v,s.u_pitch),u_rotate_symbol:new l.aH(v,s.u_rotate_symbol),u_aspect_ratio:new l.aI(v,s.u_aspect_ratio),u_fade_change:new l.aI(v,s.u_fade_change),u_matrix:new l.aJ(v,s.u_matrix),u_label_plane_matrix:new l.aJ(v,s.u_label_plane_matrix),u_coord_matrix:new l.aJ(v,s.u_coord_matrix),u_is_text:new l.aH(v,s.u_is_text),u_pitch_with_map:new l.aH(v,s.u_pitch_with_map),u_is_along_line:new l.aH(v,s.u_is_along_line),u_is_variable_anchor:new l.aH(v,s.u_is_variable_anchor),u_texsize:new l.aO(v,s.u_texsize),u_texture:new l.aH(v,s.u_texture),u_translation:new l.aO(v,s.u_translation),u_pitched_scale:new l.aI(v,s.u_pitched_scale)}),symbolSDF:(v,s)=>({u_is_size_zoom_constant:new l.aH(v,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(v,s.u_is_size_feature_constant),u_size_t:new l.aI(v,s.u_size_t),u_size:new l.aI(v,s.u_size),u_camera_to_center_distance:new l.aI(v,s.u_camera_to_center_distance),u_pitch:new l.aI(v,s.u_pitch),u_rotate_symbol:new l.aH(v,s.u_rotate_symbol),u_aspect_ratio:new l.aI(v,s.u_aspect_ratio),u_fade_change:new l.aI(v,s.u_fade_change),u_matrix:new l.aJ(v,s.u_matrix),u_label_plane_matrix:new l.aJ(v,s.u_label_plane_matrix),u_coord_matrix:new l.aJ(v,s.u_coord_matrix),u_is_text:new l.aH(v,s.u_is_text),u_pitch_with_map:new l.aH(v,s.u_pitch_with_map),u_is_along_line:new l.aH(v,s.u_is_along_line),u_is_variable_anchor:new l.aH(v,s.u_is_variable_anchor),u_texsize:new l.aO(v,s.u_texsize),u_texture:new l.aH(v,s.u_texture),u_gamma_scale:new l.aI(v,s.u_gamma_scale),u_device_pixel_ratio:new l.aI(v,s.u_device_pixel_ratio),u_is_halo:new l.aH(v,s.u_is_halo),u_translation:new l.aO(v,s.u_translation),u_pitched_scale:new l.aI(v,s.u_pitched_scale)}),symbolTextAndIcon:(v,s)=>({u_is_size_zoom_constant:new l.aH(v,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(v,s.u_is_size_feature_constant),u_size_t:new l.aI(v,s.u_size_t),u_size:new l.aI(v,s.u_size),u_camera_to_center_distance:new l.aI(v,s.u_camera_to_center_distance),u_pitch:new l.aI(v,s.u_pitch),u_rotate_symbol:new l.aH(v,s.u_rotate_symbol),u_aspect_ratio:new l.aI(v,s.u_aspect_ratio),u_fade_change:new l.aI(v,s.u_fade_change),u_matrix:new l.aJ(v,s.u_matrix),u_label_plane_matrix:new l.aJ(v,s.u_label_plane_matrix),u_coord_matrix:new l.aJ(v,s.u_coord_matrix),u_is_text:new l.aH(v,s.u_is_text),u_pitch_with_map:new l.aH(v,s.u_pitch_with_map),u_is_along_line:new l.aH(v,s.u_is_along_line),u_is_variable_anchor:new l.aH(v,s.u_is_variable_anchor),u_texsize:new l.aO(v,s.u_texsize),u_texsize_icon:new l.aO(v,s.u_texsize_icon),u_texture:new l.aH(v,s.u_texture),u_texture_icon:new l.aH(v,s.u_texture_icon),u_gamma_scale:new l.aI(v,s.u_gamma_scale),u_device_pixel_ratio:new l.aI(v,s.u_device_pixel_ratio),u_is_halo:new l.aH(v,s.u_is_halo),u_translation:new l.aO(v,s.u_translation),u_pitched_scale:new l.aI(v,s.u_pitched_scale)}),background:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_opacity:new l.aI(v,s.u_opacity),u_color:new l.aL(v,s.u_color)}),backgroundPattern:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_opacity:new l.aI(v,s.u_opacity),u_image:new l.aH(v,s.u_image),u_pattern_tl_a:new l.aO(v,s.u_pattern_tl_a),u_pattern_br_a:new l.aO(v,s.u_pattern_br_a),u_pattern_tl_b:new l.aO(v,s.u_pattern_tl_b),u_pattern_br_b:new l.aO(v,s.u_pattern_br_b),u_texsize:new l.aO(v,s.u_texsize),u_mix:new l.aI(v,s.u_mix),u_pattern_size_a:new l.aO(v,s.u_pattern_size_a),u_pattern_size_b:new l.aO(v,s.u_pattern_size_b),u_scale_a:new l.aI(v,s.u_scale_a),u_scale_b:new l.aI(v,s.u_scale_b),u_pixel_coord_upper:new l.aO(v,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,s.u_pixel_coord_lower),u_tile_units_to_pixels:new l.aI(v,s.u_tile_units_to_pixels)}),terrain:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_texture:new l.aH(v,s.u_texture),u_ele_delta:new l.aI(v,s.u_ele_delta),u_fog_matrix:new l.aJ(v,s.u_fog_matrix),u_fog_color:new l.aL(v,s.u_fog_color),u_fog_ground_blend:new l.aI(v,s.u_fog_ground_blend),u_fog_ground_blend_opacity:new l.aI(v,s.u_fog_ground_blend_opacity),u_horizon_color:new l.aL(v,s.u_horizon_color),u_horizon_fog_blend:new l.aI(v,s.u_horizon_fog_blend)}),terrainDepth:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_ele_delta:new l.aI(v,s.u_ele_delta)}),terrainCoords:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_texture:new l.aH(v,s.u_texture),u_terrain_coords_id:new l.aI(v,s.u_terrain_coords_id),u_ele_delta:new l.aI(v,s.u_ele_delta)}),sky:(v,s)=>({u_sky_color:new l.aL(v,s.u_sky_color),u_horizon_color:new l.aL(v,s.u_horizon_color),u_horizon:new l.aI(v,s.u_horizon),u_sky_horizon_blend:new l.aI(v,s.u_sky_horizon_blend)})};class Ms{constructor(s,d,m){this.context=s;const y=s.gl;this.buffer=y.createBuffer(),this.dynamicDraw=!!m,this.context.unbindVAO(),s.bindElementBuffer.set(this.buffer),y.bufferData(y.ELEMENT_ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(s){const d=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),d.bufferSubData(d.ELEMENT_ARRAY_BUFFER,0,s.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const a_={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class sd{constructor(s,d,m,y){this.length=d.length,this.attributes=m,this.itemSize=d.bytesPerElement,this.dynamicDraw=y,this.context=s;const x=s.gl;this.buffer=x.createBuffer(),s.bindVertexBuffer.set(this.buffer),x.bufferData(x.ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?x.DYNAMIC_DRAW:x.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(s){if(s.length!==this.length)throw new Error(`Length of new data is ${s.length}, which doesn't match current length of ${this.length}`);const d=this.context.gl;this.bind(),d.bufferSubData(d.ARRAY_BUFFER,0,s.arrayBuffer)}enableAttributes(s,d){for(let m=0;m<this.attributes.length;m++){const y=d.attributes[this.attributes[m].name];y!==void 0&&s.enableVertexAttribArray(y)}}setVertexAttribPointers(s,d,m){for(let y=0;y<this.attributes.length;y++){const x=this.attributes[y],M=d.attributes[x.name];M!==void 0&&s.vertexAttribPointer(M,x.components,s[a_[x.type]],!1,this.itemSize,x.offset+this.itemSize*(m||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Uo=new WeakMap;function po(v){var s;if(Uo.has(v))return Uo.get(v);{const d=(s=v.getParameter(v.VERSION))===null||s===void 0?void 0:s.startsWith("WebGL 2.0");return Uo.set(v,d),d}}class _n{constructor(s){this.gl=s.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(s){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class cu extends _n{getDefault(){return l.aM.transparent}set(s){const d=this.current;(s.r!==d.r||s.g!==d.g||s.b!==d.b||s.a!==d.a||this.dirty)&&(this.gl.clearColor(s.r,s.g,s.b,s.a),this.current=s,this.dirty=!1)}}class l_ extends _n{getDefault(){return 1}set(s){(s!==this.current||this.dirty)&&(this.gl.clearDepth(s),this.current=s,this.dirty=!1)}}class Oa extends _n{getDefault(){return 0}set(s){(s!==this.current||this.dirty)&&(this.gl.clearStencil(s),this.current=s,this.dirty=!1)}}class c_ extends _n{getDefault(){return[!0,!0,!0,!0]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||s[2]!==d[2]||s[3]!==d[3]||this.dirty)&&(this.gl.colorMask(s[0],s[1],s[2],s[3]),this.current=s,this.dirty=!1)}}class im extends _n{getDefault(){return!0}set(s){(s!==this.current||this.dirty)&&(this.gl.depthMask(s),this.current=s,this.dirty=!1)}}class u_ extends _n{getDefault(){return 255}set(s){(s!==this.current||this.dirty)&&(this.gl.stencilMask(s),this.current=s,this.dirty=!1)}}class rm extends _n{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(s){const d=this.current;(s.func!==d.func||s.ref!==d.ref||s.mask!==d.mask||this.dirty)&&(this.gl.stencilFunc(s.func,s.ref,s.mask),this.current=s,this.dirty=!1)}}class od extends _n{getDefault(){const s=this.gl;return[s.KEEP,s.KEEP,s.KEEP]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||s[2]!==d[2]||this.dirty)&&(this.gl.stencilOp(s[0],s[1],s[2]),this.current=s,this.dirty=!1)}}class sm extends _n{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;s?d.enable(d.STENCIL_TEST):d.disable(d.STENCIL_TEST),this.current=s,this.dirty=!1}}class om extends _n{getDefault(){return[0,1]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||this.dirty)&&(this.gl.depthRange(s[0],s[1]),this.current=s,this.dirty=!1)}}class am extends _n{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;s?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),this.current=s,this.dirty=!1}}class lm extends _n{getDefault(){return this.gl.LESS}set(s){(s!==this.current||this.dirty)&&(this.gl.depthFunc(s),this.current=s,this.dirty=!1)}}class Ho extends _n{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;s?d.enable(d.BLEND):d.disable(d.BLEND),this.current=s,this.dirty=!1}}class cm extends _n{getDefault(){const s=this.gl;return[s.ONE,s.ZERO]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||this.dirty)&&(this.gl.blendFunc(s[0],s[1]),this.current=s,this.dirty=!1)}}class h_ extends _n{getDefault(){return l.aM.transparent}set(s){const d=this.current;(s.r!==d.r||s.g!==d.g||s.b!==d.b||s.a!==d.a||this.dirty)&&(this.gl.blendColor(s.r,s.g,s.b,s.a),this.current=s,this.dirty=!1)}}class um extends _n{getDefault(){return this.gl.FUNC_ADD}set(s){(s!==this.current||this.dirty)&&(this.gl.blendEquation(s),this.current=s,this.dirty=!1)}}class jl extends _n{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;s?d.enable(d.CULL_FACE):d.disable(d.CULL_FACE),this.current=s,this.dirty=!1}}class d_ extends _n{getDefault(){return this.gl.BACK}set(s){(s!==this.current||this.dirty)&&(this.gl.cullFace(s),this.current=s,this.dirty=!1)}}class uu extends _n{getDefault(){return this.gl.CCW}set(s){(s!==this.current||this.dirty)&&(this.gl.frontFace(s),this.current=s,this.dirty=!1)}}class p_ extends _n{getDefault(){return null}set(s){(s!==this.current||this.dirty)&&(this.gl.useProgram(s),this.current=s,this.dirty=!1)}}class f_ extends _n{getDefault(){return this.gl.TEXTURE0}set(s){(s!==this.current||this.dirty)&&(this.gl.activeTexture(s),this.current=s,this.dirty=!1)}}class hm extends _n{getDefault(){const s=this.gl;return[0,0,s.drawingBufferWidth,s.drawingBufferHeight]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||s[2]!==d[2]||s[3]!==d[3]||this.dirty)&&(this.gl.viewport(s[0],s[1],s[2],s[3]),this.current=s,this.dirty=!1)}}class dm extends _n{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.bindFramebuffer(d.FRAMEBUFFER,s),this.current=s,this.dirty=!1}}class pm extends _n{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.bindRenderbuffer(d.RENDERBUFFER,s),this.current=s,this.dirty=!1}}class ad extends _n{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.bindTexture(d.TEXTURE_2D,s),this.current=s,this.dirty=!1}}class fm extends _n{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.bindBuffer(d.ARRAY_BUFFER,s),this.current=s,this.dirty=!1}}class hu extends _n{getDefault(){return null}set(s){const d=this.gl;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,s),this.current=s,this.dirty=!1}}class Hs extends _n{getDefault(){return null}set(s){var d;if(s===this.current&&!this.dirty)return;const m=this.gl;po(m)?m.bindVertexArray(s):(d=m.getExtension("OES_vertex_array_object"))===null||d===void 0||d.bindVertexArrayOES(s),this.current=s,this.dirty=!1}}class ld extends _n{getDefault(){return 4}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_ALIGNMENT,s),this.current=s,this.dirty=!1}}class cd extends _n{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s),this.current=s,this.dirty=!1}}class ud extends _n{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL,s),this.current=s,this.dirty=!1}}class du extends _n{constructor(s,d){super(s),this.context=s,this.parent=d}getDefault(){return null}}class hd extends du{setDirty(){this.dirty=!0}set(s){if(s===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,s,0),this.current=s,this.dirty=!1}}class qo extends du{set(s){if(s===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,s),this.current=s,this.dirty=!1}}class dd extends du{set(s){if(s===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,s),this.current=s,this.dirty=!1}}class m_{constructor(s,d,m,y,x){this.context=s,this.width=d,this.height=m;const M=s.gl,I=this.framebuffer=M.createFramebuffer();if(this.colorAttachment=new hd(s,I),y)this.depthAttachment=x?new dd(s,I):new qo(s,I);else if(x)throw new Error("Stencil cannot be set without depth");if(M.checkFramebufferStatus(M.FRAMEBUFFER)!==M.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const s=this.context.gl,d=this.colorAttachment.get();if(d&&s.deleteTexture(d),this.depthAttachment){const m=this.depthAttachment.get();m&&s.deleteRenderbuffer(m)}s.deleteFramebuffer(this.framebuffer)}}class Jn{constructor(s,d,m){this.blendFunction=s,this.blendColor=d,this.mask=m}}Jn.Replace=[1,0],Jn.disabled=new Jn(Jn.Replace,l.aM.transparent,[!1,!1,!1,!1]),Jn.unblended=new Jn(Jn.Replace,l.aM.transparent,[!0,!0,!0,!0]),Jn.alphaBlended=new Jn([1,771],l.aM.transparent,[!0,!0,!0,!0]);class g_{constructor(s){var d,m;if(this.gl=s,this.clearColor=new cu(this),this.clearDepth=new l_(this),this.clearStencil=new Oa(this),this.colorMask=new c_(this),this.depthMask=new im(this),this.stencilMask=new u_(this),this.stencilFunc=new rm(this),this.stencilOp=new od(this),this.stencilTest=new sm(this),this.depthRange=new om(this),this.depthTest=new am(this),this.depthFunc=new lm(this),this.blend=new Ho(this),this.blendFunc=new cm(this),this.blendColor=new h_(this),this.blendEquation=new um(this),this.cullFace=new jl(this),this.cullFaceSide=new d_(this),this.frontFace=new uu(this),this.program=new p_(this),this.activeTexture=new f_(this),this.viewport=new hm(this),this.bindFramebuffer=new dm(this),this.bindRenderbuffer=new pm(this),this.bindTexture=new ad(this),this.bindVertexBuffer=new fm(this),this.bindElementBuffer=new hu(this),this.bindVertexArray=new Hs(this),this.pixelStoreUnpack=new ld(this),this.pixelStoreUnpackPremultiplyAlpha=new cd(this),this.pixelStoreUnpackFlipY=new ud(this),this.extTextureFilterAnisotropic=s.getExtension("EXT_texture_filter_anisotropic")||s.getExtension("MOZ_EXT_texture_filter_anisotropic")||s.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=s.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=s.getParameter(s.MAX_TEXTURE_SIZE),po(s)){this.HALF_FLOAT=s.HALF_FLOAT;const y=s.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(d=s.RGBA16F)!==null&&d!==void 0?d:y==null?void 0:y.RGBA16F_EXT,this.RGB16F=(m=s.RGB16F)!==null&&m!==void 0?m:y==null?void 0:y.RGB16F_EXT,s.getExtension("EXT_color_buffer_float")}else{s.getExtension("EXT_color_buffer_half_float"),s.getExtension("OES_texture_half_float_linear");const y=s.getExtension("OES_texture_half_float");this.HALF_FLOAT=y==null?void 0:y.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(s,d){return new Ms(this,s,d)}createVertexBuffer(s,d,m){return new sd(this,s,d,m)}createRenderbuffer(s,d,m){const y=this.gl,x=y.createRenderbuffer();return this.bindRenderbuffer.set(x),y.renderbufferStorage(y.RENDERBUFFER,s,d,m),this.bindRenderbuffer.set(null),x}createFramebuffer(s,d,m,y){return new m_(this,s,d,m,y)}clear({color:s,depth:d,stencil:m}){const y=this.gl;let x=0;s&&(x|=y.COLOR_BUFFER_BIT,this.clearColor.set(s),this.colorMask.set([!0,!0,!0,!0])),d!==void 0&&(x|=y.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(d),this.depthMask.set(!0)),m!==void 0&&(x|=y.STENCIL_BUFFER_BIT,this.clearStencil.set(m),this.stencilMask.set(255)),y.clear(x)}setCullFace(s){s.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(s.mode),this.frontFace.set(s.frontFace))}setDepthMode(s){s.func!==this.gl.ALWAYS||s.mask?(this.depthTest.set(!0),this.depthFunc.set(s.func),this.depthMask.set(s.mask),this.depthRange.set(s.range)):this.depthTest.set(!1)}setStencilMode(s){s.test.func!==this.gl.ALWAYS||s.mask?(this.stencilTest.set(!0),this.stencilMask.set(s.mask),this.stencilOp.set([s.fail,s.depthFail,s.pass]),this.stencilFunc.set({func:s.test.func,ref:s.ref,mask:s.test.mask})):this.stencilTest.set(!1)}setColorMode(s){l.aE(s.blendFunction,Jn.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(s.blendFunction),this.blendColor.set(s.blendColor)),this.colorMask.set(s.mask)}createVertexArray(){var s;return po(this.gl)?this.gl.createVertexArray():(s=this.gl.getExtension("OES_vertex_array_object"))===null||s===void 0?void 0:s.createVertexArrayOES()}deleteVertexArray(s){var d;return po(this.gl)?this.gl.deleteVertexArray(s):(d=this.gl.getExtension("OES_vertex_array_object"))===null||d===void 0?void 0:d.deleteVertexArrayOES(s)}unbindVAO(){this.bindVertexArray.set(null)}}class Ht{constructor(s,d,m){this.func=s,this.mask=d,this.range=m}}Ht.ReadOnly=!1,Ht.ReadWrite=!0,Ht.disabled=new Ht(519,Ht.ReadOnly,[0,1]);const pu=7680;class On{constructor(s,d,m,y,x,M){this.test=s,this.ref=d,this.mask=m,this.fail=y,this.depthFail=x,this.pass=M}}On.disabled=new On({func:519,mask:0},0,0,pu,pu,pu);class Tn{constructor(s,d,m){this.enable=s,this.mode=d,this.frontFace=m}}let Wo;function Ul(v,s,d,m,y){const x=v.context,M=x.gl,I=v.useProgram("collisionBox"),O=[];let N=0,V=0;for(let ce=0;ce<m.length;ce++){const he=m[ce],te=s.getTile(he).getBucket(d);if(!te)continue;const me=y?te.textCollisionBox:te.iconCollisionBox,ge=te.collisionCircleArray;if(ge.length>0){const ve=l.H();l.aQ(ve,te.placementInvProjMatrix,v.transform.glCoordMatrix),l.aQ(ve,ve,te.placementViewportMatrix),O.push({circleArray:ge,circleOffset:V,transform:he.posMatrix,invTransform:ve,coord:he}),N+=ge.length/4,V=N}me&&I.draw(x,M.LINES,Ht.disabled,On.disabled,v.colorModeForRenderPass(),Tn.disabled,{u_matrix:he.posMatrix,u_pixel_extrude_scale:[1/(F=v.transform).width,1/F.height]},v.style.map.terrain&&v.style.map.terrain.getTerrainData(he),d.id,me.layoutVertexBuffer,me.indexBuffer,me.segments,null,v.transform.zoom,null,null,me.collisionVertexBuffer)}var F;if(!y||!O.length)return;const G=v.useProgram("collisionCircle"),K=new l.aR;K.resize(4*N),K._trim();let Q=0;for(const ce of O)for(let he=0;he<ce.circleArray.length/4;he++){const te=4*he,me=ce.circleArray[te+0],ge=ce.circleArray[te+1],ve=ce.circleArray[te+2],ze=ce.circleArray[te+3];K.emplace(Q++,me,ge,ve,ze,0),K.emplace(Q++,me,ge,ve,ze,1),K.emplace(Q++,me,ge,ve,ze,2),K.emplace(Q++,me,ge,ve,ze,3)}(!Wo||Wo.length<2*N)&&(Wo=function(ce){const he=2*ce,te=new l.aT;te.resize(he),te._trim();for(let me=0;me<he;me++){const ge=6*me;te.uint16[ge+0]=4*me+0,te.uint16[ge+1]=4*me+1,te.uint16[ge+2]=4*me+2,te.uint16[ge+3]=4*me+2,te.uint16[ge+4]=4*me+3,te.uint16[ge+5]=4*me+0}return te}(N));const re=x.createIndexBuffer(Wo,!0),ae=x.createVertexBuffer(K,l.aS.members,!0);for(const ce of O){const he=jo(ce.transform,ce.invTransform,v.transform);G.draw(x,M.TRIANGLES,Ht.disabled,On.disabled,v.colorModeForRenderPass(),Tn.disabled,he,v.style.map.terrain&&v.style.map.terrain.getTerrainData(ce.coord),d.id,ae,re,l.a0.simpleSegment(0,2*ce.circleOffset,ce.circleArray.length,ce.circleArray.length/2),null,v.transform.zoom,null,null,null)}ae.destroy(),re.destroy()}Tn.disabled=new Tn(!1,1029,2305),Tn.backCCW=new Tn(!0,1029,2305);const Hl=l.an(new Float32Array(16));function pd(v,s,d,m,y,x){const{horizontalAlign:M,verticalAlign:I}=l.au(v);return new l.P((-(M-.5)*s/y+m[0])*x,(-(I-.5)*d/y+m[1])*x)}function Go(v,s,d,m,y,x){const M=s.tileAnchorPoint.add(new l.P(s.translation[0],s.translation[1]));if(s.pitchWithMap){let I=m.mult(x);d||(I=I.rotate(-y));const O=M.add(I);return se(O.x,O.y,s.labelPlaneMatrix,s.getElevation).point}if(d){const I=Me(s.tileAnchorPoint.x+1,s.tileAnchorPoint.y,s).point.sub(v),O=Math.atan(I.y/I.x)+(I.x<0?Math.PI:0);return v.add(m.rotate(O))}return v.add(m)}function za(v,s,d,m,y,x,M,I,O,N,V,F,G,K){const Q=v.text.placedSymbolArray,re=v.text.dynamicLayoutVertexArray,ae=v.icon.dynamicLayoutVertexArray,ce={};re.clear();for(let he=0;he<Q.length;he++){const te=Q.get(he),me=te.hidden||!te.crossTileID||v.allowVerticalPlacement&&!te.placedOrientation?null:m[te.crossTileID];if(me){const ge=new l.P(te.anchorX,te.anchorY),ve={getElevation:K,width:y.width,height:y.height,labelPlaneMatrix:x,lineVertexArray:null,pitchWithMap:d,projection:V,projectionCache:null,tileAnchorPoint:ge,translation:F,unwrappedTileID:G},ze=d?se(ge.x,ge.y,M,K):Me(ge.x,ge.y,ve),Ve=H(y.cameraToCenterDistance,ze.signedDistanceFromCamera);let Je=l.ai(v.textSizeData,O,te)*Ve/l.ap;d&&(Je*=v.tilePixelRatio/I);const{width:it,height:Ge,anchor:qe,textOffset:mt,textBoxScale:Dt}=me,Ye=pd(qe,it,Ge,mt,Dt,Je),tt=V.getPitchedTextCorrection(y,ge.add(new l.P(F[0],F[1])),G),It=Go(ze.point,ve,s,Ye,y.angle,tt),Fn=v.allowVerticalPlacement&&te.placedOrientation===l.ah.vertical?Math.PI/2:0;for(let Lt=0;Lt<te.numGlyphs;Lt++)l.aj(re,It,Fn);N&&te.associatedIconIndex>=0&&(ce[te.associatedIconIndex]={shiftedAnchor:It,angle:Fn})}else kt(te.numGlyphs,re)}if(N){ae.clear();const he=v.icon.placedSymbolArray;for(let te=0;te<he.length;te++){const me=he.get(te);if(me.hidden)kt(me.numGlyphs,ae);else{const ge=ce[te];if(ge)for(let ve=0;ve<me.numGlyphs;ve++)l.aj(ae,ge.shiftedAnchor,ge.angle);else kt(me.numGlyphs,ae)}}v.icon.dynamicLayoutVertexBuffer.updateData(ae)}v.text.dynamicLayoutVertexBuffer.updateData(re)}function Rr(v,s,d){return d.iconsInText&&s?"symbolTextAndIcon":v?"symbolSDF":"symbolIcon"}function fd(v,s,d,m,y,x,M,I,O,N,V,F){const G=v.context,K=G.gl,Q=v.transform,re=Fo(),ae=I==="map",ce=O==="map",he=I!=="viewport"&&d.layout.get("symbol-placement")!=="point",te=ae&&!ce&&!he,me=!ce&&he,ge=!d.layout.get("symbol-sort-key").isConstant();let ve=!1;const ze=v.depthModeForSublayer(0,Ht.ReadOnly),Ve=d._unevaluatedLayout.hasValue("text-variable-anchor")||d._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Je=[],it=re.getCircleRadiusCorrection(Q);for(const Ge of m){const qe=s.getTile(Ge),mt=qe.getBucket(d);if(!mt)continue;const Dt=y?mt.text:mt.icon;if(!Dt||!Dt.segments.get().length||!Dt.hasVisibleVertices)continue;const Ye=Dt.programConfigurations.get(d.id),tt=y||mt.sdfIcons,It=y?mt.textSizeData:mt.iconSizeData,Fn=ce||Q.pitch!==0,Lt=v.useProgram(Rr(tt,y,mt),Ye),Yt=l.ag(It,Q.zoom),$n=v.style.map.terrain&&v.style.map.terrain.getTerrainData(Ge);let Di,ns,jn,rr,Wi=[0,0],Oi=null;if(y)ns=qe.glyphAtlasTexture,jn=K.LINEAR,Di=qe.glyphAtlasTexture.size,mt.iconsInText&&(Wi=qe.imageAtlasTexture.size,Oi=qe.imageAtlasTexture,rr=Fn||v.options.rotating||v.options.zooming||It.kind==="composite"||It.kind==="camera"?K.LINEAR:K.NEAREST);else{const tn=d.layout.get("icon-size").constantOr(0)!==1||mt.iconsNeedLinear;ns=qe.imageAtlasTexture,jn=tt||v.options.rotating||v.options.zooming||tn||Fn?K.LINEAR:K.NEAREST,Di=qe.imageAtlasTexture.size}const Gi=Zt(qe,1,v.transform.zoom),Ps=me?Ge.posMatrix:Hl,Xa=Hi(Ps,ce,ae,v.transform,Gi),Du=fr(Ps,ce,ae,v.transform,Gi),Ka=fr(Ge.posMatrix,ce,ae,v.transform,Gi),Fr=re.translatePosition(v.transform,qe,x,M),Ou=Ve&&mt.hasTextData(),Vd=d.layout.get("icon-text-fit")!=="none"&&Ou&&mt.hasIconData();if(he){const tn=v.style.map.terrain?(Ja,Qa)=>v.style.map.terrain.getElevation(Ge,Ja,Qa):null,Jo=d.layout.get("text-rotation-alignment")==="map";Y(mt,Ge.posMatrix,v,y,Xa,Ka,ce,N,Jo,re,Ge.toUnwrapped(),Q.width,Q.height,Fr,tn)}const $r=Ge.posMatrix,jr=y&&Ve||Vd,fo=he||jr?Hl:Xa,is=Du,ki=tt&&d.paint.get(y?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let zi;zi=tt?mt.iconsInText?nd(It.kind,Yt,te,ce,he,jr,v,$r,fo,is,Fr,Di,Wi,it):$l(It.kind,Yt,te,ce,he,jr,v,$r,fo,is,Fr,y,Di,!0,it):nm(It.kind,Yt,te,ce,he,jr,v,$r,fo,is,Fr,y,Di,it);const xr={program:Lt,buffers:Dt,uniformValues:zi,atlasTexture:ns,atlasTextureIcon:Oi,atlasInterpolation:jn,atlasInterpolationIcon:rr,isSDF:tt,hasHalo:ki};if(ge&&mt.canOverlap){ve=!0;const tn=Dt.segments.get();for(const Jo of tn)Je.push({segments:new l.a0([Jo]),sortKey:Jo.sortKey,state:xr,terrainData:$n})}else Je.push({segments:Dt.segments,sortKey:0,state:xr,terrainData:$n})}ve&&Je.sort((Ge,qe)=>Ge.sortKey-qe.sortKey);for(const Ge of Je){const qe=Ge.state;if(G.activeTexture.set(K.TEXTURE0),qe.atlasTexture.bind(qe.atlasInterpolation,K.CLAMP_TO_EDGE),qe.atlasTextureIcon&&(G.activeTexture.set(K.TEXTURE1),qe.atlasTextureIcon&&qe.atlasTextureIcon.bind(qe.atlasInterpolationIcon,K.CLAMP_TO_EDGE)),qe.isSDF){const mt=qe.uniformValues;qe.hasHalo&&(mt.u_is_halo=1,md(qe.buffers,Ge.segments,d,v,qe.program,ze,V,F,mt,Ge.terrainData)),mt.u_is_halo=0}md(qe.buffers,Ge.segments,d,v,qe.program,ze,V,F,qe.uniformValues,Ge.terrainData)}}function md(v,s,d,m,y,x,M,I,O,N){const V=m.context;y.draw(V,V.gl.TRIANGLES,x,M,I,Tn.disabled,O,N,d.id,v.layoutVertexBuffer,v.indexBuffer,s,d.paint,m.transform.zoom,v.programConfigurations.get(d.id),v.dynamicLayoutVertexBuffer,v.opacityVertexBuffer)}function gd(v,s,d,m){const y=v.context,x=y.gl,M=On.disabled,I=new Jn([x.ONE,x.ONE],l.aM.transparent,[!0,!0,!0,!0]),O=s.getBucket(d);if(!O)return;const N=m.key;let V=d.heatmapFbos.get(N);V||(V=ql(y,s.tileSize,s.tileSize),d.heatmapFbos.set(N,V)),y.bindFramebuffer.set(V.framebuffer),y.viewport.set([0,0,s.tileSize,s.tileSize]),y.clear({color:l.aM.transparent});const F=O.programConfigurations.get(d.id),G=v.useProgram("heatmap",F),K=v.style.map.terrain.getTerrainData(m);G.draw(y,x.TRIANGLES,Ht.disabled,M,I,Tn.disabled,ir(m.posMatrix,s,v.transform.zoom,d.paint.get("heatmap-intensity")),K,d.id,O.layoutVertexBuffer,O.indexBuffer,O.segments,d.paint,v.transform.zoom,F)}function Zo(v,s,d){const m=v.context,y=m.gl;m.setColorMode(v.colorModeForRenderPass());const x=Wl(m,s),M=d.key,I=s.heatmapFbos.get(M);I&&(m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,I.colorAttachment.get()),m.activeTexture.set(y.TEXTURE1),x.bind(y.LINEAR,y.CLAMP_TO_EDGE),v.useProgram("heatmapTexture").draw(m,y.TRIANGLES,Ht.disabled,On.disabled,v.colorModeForRenderPass(),Tn.disabled,su(v,s,0,1),null,s.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments,s.paint,v.transform.zoom),I.destroy(),s.heatmapFbos.delete(M))}function ql(v,s,d){var m,y;const x=v.gl,M=x.createTexture();x.bindTexture(x.TEXTURE_2D,M),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,x.LINEAR),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,x.LINEAR);const I=(m=v.HALF_FLOAT)!==null&&m!==void 0?m:x.UNSIGNED_BYTE,O=(y=v.RGBA16F)!==null&&y!==void 0?y:x.RGBA;x.texImage2D(x.TEXTURE_2D,0,O,s,d,0,x.RGBA,I,null);const N=v.createFramebuffer(s,d,!1,!1);return N.colorAttachment.set(M),N}function Wl(v,s){return s.colorRampTexture||(s.colorRampTexture=new rt(v,s.colorRamp,v.gl.RGBA)),s.colorRampTexture}function Ba(v,s,d,m,y){if(!d||!m||!m.imageAtlas)return;const x=m.imageAtlas.patternPositions;let M=x[d.to.toString()],I=x[d.from.toString()];if(!M&&I&&(M=I),!I&&M&&(I=M),!M||!I){const O=y.getPaintProperty(s);M=x[O],I=x[O]}M&&I&&v.setConstantPatternPositions(M,I)}function Gl(v,s,d,m,y,x,M){const I=v.context.gl,O="fill-pattern",N=d.paint.get(O),V=N&&N.constantOr(1),F=d.getCrossfadeParameters();let G,K,Q,re,ae;M?(K=V&&!d.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",G=I.LINES):(K=V?"fillPattern":"fill",G=I.TRIANGLES);const ce=N.constantOr(null);for(const he of m){const te=s.getTile(he);if(V&&!te.patternsLoaded())continue;const me=te.getBucket(d);if(!me)continue;const ge=me.programConfigurations.get(d.id),ve=v.useProgram(K,ge),ze=v.style.map.terrain&&v.style.map.terrain.getTerrainData(he);V&&(v.context.activeTexture.set(I.TEXTURE0),te.imageAtlasTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),ge.updatePaintBuffers(F)),Ba(ge,O,ce,te,d);const Ve=ze?he:null,Je=v.translatePosMatrix(Ve?Ve.posMatrix:he.posMatrix,te,d.paint.get("fill-translate"),d.paint.get("fill-translate-anchor"));if(M){re=me.indexBuffer2,ae=me.segments2;const it=[I.drawingBufferWidth,I.drawingBufferHeight];Q=K==="fillOutlinePattern"&&V?Jf(Je,v,F,te,it):n_(Je,it)}else re=me.indexBuffer,ae=me.segments,Q=V?Kf(Je,v,F,te):Pa(Je);ve.draw(v.context,G,y,v.stencilModeForClipping(he),x,Tn.disabled,Q,ze,d.id,me.layoutVertexBuffer,re,ae,d.paint,v.transform.zoom,ge)}}function fu(v,s,d,m,y,x,M){const I=v.context,O=I.gl,N="fill-extrusion-pattern",V=d.paint.get(N),F=V.constantOr(1),G=d.getCrossfadeParameters(),K=d.paint.get("fill-extrusion-opacity"),Q=V.constantOr(null);for(const re of m){const ae=s.getTile(re),ce=ae.getBucket(d);if(!ce)continue;const he=v.style.map.terrain&&v.style.map.terrain.getTerrainData(re),te=ce.programConfigurations.get(d.id),me=v.useProgram(F?"fillExtrusionPattern":"fillExtrusion",te);F&&(v.context.activeTexture.set(O.TEXTURE0),ae.imageAtlasTexture.bind(O.LINEAR,O.CLAMP_TO_EDGE),te.updatePaintBuffers(G)),Ba(te,N,Q,ae,d);const ge=v.translatePosMatrix(re.posMatrix,ae,d.paint.get("fill-extrusion-translate"),d.paint.get("fill-extrusion-translate-anchor")),ve=d.paint.get("fill-extrusion-vertical-gradient"),ze=F?ru(ge,v,ve,K,re,G,ae):Vl(ge,v,ve,K);me.draw(I,I.gl.TRIANGLES,y,x,M,Tn.backCCW,ze,he,d.id,ce.layoutVertexBuffer,ce.indexBuffer,ce.segments,d.paint,v.transform.zoom,te,v.style.map.terrain&&ce.centroidVertexBuffer)}}function Na(v,s,d,m,y,x,M){const I=v.context,O=I.gl,N=d.fbo;if(!N)return;const V=v.useProgram("hillshade"),F=v.style.map.terrain&&v.style.map.terrain.getTerrainData(s);I.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,N.colorAttachment.get()),V.draw(I,O.TRIANGLES,y,x,M,Tn.disabled,((G,K,Q,re)=>{const ae=Q.paint.get("hillshade-shadow-color"),ce=Q.paint.get("hillshade-highlight-color"),he=Q.paint.get("hillshade-accent-color");let te=Q.paint.get("hillshade-illumination-direction")*(Math.PI/180);Q.paint.get("hillshade-illumination-anchor")==="viewport"&&(te-=G.transform.angle);const me=!G.options.moving;return{u_matrix:re?re.posMatrix:G.transform.calculatePosMatrix(K.tileID.toUnwrapped(),me),u_image:0,u_latrange:ou(0,K.tileID),u_light:[Q.paint.get("hillshade-exaggeration"),te],u_shadow:ae,u_highlight:ce,u_accent:he}})(v,d,m,F?s:null),F,m.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments)}function Ra(v,s,d,m,y,x){const M=v.context,I=M.gl,O=s.dem;if(O&&O.data){const N=O.dim,V=O.stride,F=O.getPixels();if(M.activeTexture.set(I.TEXTURE1),M.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||v.getTileTexture(V),s.demTexture){const K=s.demTexture;K.update(F,{premultiply:!1}),K.bind(I.NEAREST,I.CLAMP_TO_EDGE)}else s.demTexture=new rt(M,F,I.RGBA,{premultiply:!1}),s.demTexture.bind(I.NEAREST,I.CLAMP_TO_EDGE);M.activeTexture.set(I.TEXTURE0);let G=s.fbo;if(!G){const K=new rt(M,{width:N,height:N,data:null},I.RGBA);K.bind(I.LINEAR,I.CLAMP_TO_EDGE),G=s.fbo=M.createFramebuffer(N,N,!0,!1),G.colorAttachment.set(K.texture)}M.bindFramebuffer.set(G.framebuffer),M.viewport.set([0,0,N,N]),v.useProgram("hillshadePrepare").draw(M,I.TRIANGLES,m,y,x,Tn.disabled,((K,Q)=>{const re=Q.stride,ae=l.H();return l.aP(ae,0,l.X,-l.X,0,0,1),l.J(ae,ae,[0,-l.X,0]),{u_matrix:ae,u_image:1,u_dimension:[re,re],u_zoom:K.overscaledZ,u_unpack:Q.getUnpackVector()}})(s.tileID,O),null,d.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function mm(v,s,d,m,y,x){const M=m.paint.get("raster-fade-duration");if(!x&&M>0){const I=E.now(),O=(I-v.timeAdded)/M,N=s?(I-s.timeAdded)/M:-1,V=d.getSource(),F=y.coveringZoomLevel({tileSize:V.tileSize,roundZoom:V.roundZoom}),G=!s||Math.abs(s.tileID.overscaledZ-F)>Math.abs(v.tileID.overscaledZ-F),K=G&&v.refreshedUponExpiration?1:l.ac(G?O:1-N,0,1);return v.refreshedUponExpiration&&O>=1&&(v.refreshedUponExpiration=!1),s?{opacity:1,mix:1-K}:{opacity:K,mix:0}}return{opacity:1,mix:0}}const yd=new l.aM(1,0,0,1),un=new l.aM(0,1,0,1),mu=new l.aM(0,0,1,1),y_=new l.aM(1,0,1,1),gm=new l.aM(0,1,1,1);function La(v,s,d,m){gu(v,0,s+d/2,v.transform.width,d,m)}function ym(v,s,d,m){gu(v,s-d/2,0,d,v.transform.height,m)}function gu(v,s,d,m,y,x){const M=v.context,I=M.gl;I.enable(I.SCISSOR_TEST),I.scissor(s*v.pixelRatio,d*v.pixelRatio,m*v.pixelRatio,y*v.pixelRatio),M.clear({color:x}),I.disable(I.SCISSOR_TEST)}function _m(v,s,d){const m=v.context,y=m.gl,x=d.posMatrix,M=v.useProgram("debug"),I=Ht.disabled,O=On.disabled,N=v.colorModeForRenderPass(),V="$debug",F=v.style.map.terrain&&v.style.map.terrain.getTerrainData(d);m.activeTexture.set(y.TEXTURE0);const G=s.getTileByID(d.key).latestRawTileData,K=Math.floor((G&&G.byteLength||0)/1024),Q=s.getTile(d).tileSize,re=512/Math.min(Q,512)*(d.overscaledZ/v.transform.zoom)*.5;let ae=d.canonical.toString();d.overscaledZ!==d.canonical.z&&(ae+=` => ${d.overscaledZ}`),function(ce,he){ce.initDebugOverlayCanvas();const te=ce.debugOverlayCanvas,me=ce.context.gl,ge=ce.debugOverlayCanvas.getContext("2d");ge.clearRect(0,0,te.width,te.height),ge.shadowColor="white",ge.shadowBlur=2,ge.lineWidth=1.5,ge.strokeStyle="white",ge.textBaseline="top",ge.font="bold 36px Open Sans, sans-serif",ge.fillText(he,5,5),ge.strokeText(he,5,5),ce.debugOverlayTexture.update(te),ce.debugOverlayTexture.bind(me.LINEAR,me.CLAMP_TO_EDGE)}(v,`${ae} ${K}kB`),M.draw(m,y.TRIANGLES,I,O,Jn.alphaBlended,Tn.disabled,Fl(x,l.aM.transparent,re),null,V,v.debugBuffer,v.quadTriangleIndexBuffer,v.debugSegments),M.draw(m,y.LINE_STRIP,I,O,N,Tn.disabled,Fl(x,l.aM.red),F,V,v.debugBuffer,v.tileBorderIndexBuffer,v.debugSegments)}function bm(v,s,d){const m=v.context,y=m.gl,x=v.colorModeForRenderPass(),M=new Ht(y.LEQUAL,Ht.ReadWrite,v.depthRangeFor3D),I=v.useProgram("terrain"),O=s.getTerrainMesh();m.bindFramebuffer.set(null),m.viewport.set([0,0,v.width,v.height]);for(const N of d){const V=v.renderToTexture.getTexture(N),F=s.getTerrainData(N.tileID);m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,V.texture);const G=v.transform.calculatePosMatrix(N.tileID.toUnwrapped()),K=s.getMeshFrameDelta(v.transform.zoom),Q=v.transform.calculateFogMatrix(N.tileID.toUnwrapped()),re=ed(G,K,Q,v.style.sky,v.transform.pitch);I.draw(m,y.TRIANGLES,M,On.disabled,x,Tn.backCCW,re,F,"terrain",O.vertexBuffer,O.indexBuffer,O.segments)}}class yu{constructor(s,d,m){this.vertexBuffer=s,this.indexBuffer=d,this.segments=m}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class _u{constructor(s,d){this.context=new g_(s),this.transform=d,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Ne.maxUnderzooming+Ne.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Jh}resize(s,d,m){if(this.width=Math.floor(s*m),this.height=Math.floor(d*m),this.pixelRatio=m,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const y of this.style._order)this.style._layers[y].resize()}setup(){const s=this.context,d=new l.aX;d.emplaceBack(0,0),d.emplaceBack(l.X,0),d.emplaceBack(0,l.X),d.emplaceBack(l.X,l.X),this.tileExtentBuffer=s.createVertexBuffer(d,$o.members),this.tileExtentSegments=l.a0.simpleSegment(0,0,4,2);const m=new l.aX;m.emplaceBack(0,0),m.emplaceBack(l.X,0),m.emplaceBack(0,l.X),m.emplaceBack(l.X,l.X),this.debugBuffer=s.createVertexBuffer(m,$o.members),this.debugSegments=l.a0.simpleSegment(0,0,4,5);const y=new l.$;y.emplaceBack(0,0,0,0),y.emplaceBack(l.X,0,l.X,0),y.emplaceBack(0,l.X,0,l.X),y.emplaceBack(l.X,l.X,l.X,l.X),this.rasterBoundsBuffer=s.createVertexBuffer(y,tr.members),this.rasterBoundsSegments=l.a0.simpleSegment(0,0,4,2);const x=new l.aX;x.emplaceBack(0,0),x.emplaceBack(1,0),x.emplaceBack(0,1),x.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(x,$o.members),this.viewportSegments=l.a0.simpleSegment(0,0,4,2);const M=new l.aZ;M.emplaceBack(0),M.emplaceBack(1),M.emplaceBack(3),M.emplaceBack(2),M.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(M);const I=new l.aY;I.emplaceBack(0,1,2),I.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(I);const O=this.context.gl;this.stencilClearMode=new On({func:O.ALWAYS,mask:0},0,255,O.ZERO,O.ZERO,O.ZERO)}clearStencil(){const s=this.context,d=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const m=l.H();l.aP(m,0,this.width,this.height,0,0,1),l.K(m,m,[d.drawingBufferWidth,d.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,d.TRIANGLES,Ht.disabled,this.stencilClearMode,Jn.disabled,Tn.disabled,nr(m),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(s,d){if(this.currentStencilSource===s.source||!s.isTileClipped()||!d||!d.length)return;this.currentStencilSource=s.source;const m=this.context,y=m.gl;this.nextStencilID+d.length>256&&this.clearStencil(),m.setColorMode(Jn.disabled),m.setDepthMode(Ht.disabled);const x=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const M of d){const I=this._tileClippingMaskIDs[M.key]=this.nextStencilID++,O=this.style.map.terrain&&this.style.map.terrain.getTerrainData(M);x.draw(m,y.TRIANGLES,Ht.disabled,new On({func:y.ALWAYS,mask:0},I,255,y.KEEP,y.KEEP,y.REPLACE),Jn.disabled,Tn.disabled,nr(M.posMatrix),O,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,d=this.context.gl;return new On({func:d.NOTEQUAL,mask:255},s,255,d.KEEP,d.KEEP,d.REPLACE)}stencilModeForClipping(s){const d=this.context.gl;return new On({func:d.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,d.KEEP,d.KEEP,d.REPLACE)}stencilConfigForOverlap(s){const d=this.context.gl,m=s.sort((M,I)=>I.overscaledZ-M.overscaledZ),y=m[m.length-1].overscaledZ,x=m[0].overscaledZ-y+1;if(x>1){this.currentStencilSource=void 0,this.nextStencilID+x>256&&this.clearStencil();const M={};for(let I=0;I<x;I++)M[I+y]=new On({func:d.GEQUAL,mask:255},I+this.nextStencilID,255,d.KEEP,d.KEEP,d.REPLACE);return this.nextStencilID+=x,[M,m]}return[{[y]:On.disabled},m]}colorModeForRenderPass(){const s=this.context.gl;return this._showOverdrawInspector?new Jn([s.CONSTANT_COLOR,s.ONE],new l.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Jn.unblended:Jn.alphaBlended}depthModeForSublayer(s,d,m){if(!this.opaquePassEnabledForLayer())return Ht.disabled;const y=1-((1+this.currentLayer)*this.numSublayers+s)*this.depthEpsilon;return new Ht(m||this.context.gl.LEQUAL,d,[y,y])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(s,d){this.style=s,this.options=d,this.lineAtlas=s.lineAtlas,this.imageManager=s.imageManager,this.glyphManager=s.glyphManager,this.symbolFadeChange=s.placement.symbolFadeChange(E.now()),this.imageManager.beginFrame();const m=this.style._order,y=this.style.sourceCaches,x={},M={},I={};for(const O in y){const N=y[O];N.used&&N.prepare(this.context),x[O]=N.getVisibleCoordinates(),M[O]=x[O].slice().reverse(),I[O]=N.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let O=0;O<m.length;O++)if(this.style._layers[m[O]].is3D()){this.opaquePassCutoff=O;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const O of m){const N=this.style._layers[O];if(!N.hasOffscreenPass()||N.isHidden(this.transform.zoom))continue;const V=M[N.source];(N.type==="custom"||V.length)&&this.renderLayer(this,y[N.source],N,V)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:d.showOverdrawInspector?l.aM.black:l.aM.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(O,N){const V=O.context,F=V.gl,G=((ce,he,te)=>({u_sky_color:ce.properties.get("sky-color"),u_horizon_color:ce.properties.get("horizon-color"),u_horizon:(he.height/2+he.getHorizon())*te,u_sky_horizon_blend:ce.properties.get("sky-horizon-blend")*he.height/2*te}))(N,O.style.map.transform,O.pixelRatio),K=new Ht(F.LEQUAL,Ht.ReadWrite,[0,1]),Q=On.disabled,re=O.colorModeForRenderPass(),ae=O.useProgram("sky");if(!N.mesh){const ce=new l.aX;ce.emplaceBack(-1,-1),ce.emplaceBack(1,-1),ce.emplaceBack(1,1),ce.emplaceBack(-1,1);const he=new l.aY;he.emplaceBack(0,1,2),he.emplaceBack(0,2,3),N.mesh=new yu(V.createVertexBuffer(ce,$o.members),V.createIndexBuffer(he),l.a0.simpleSegment(0,0,ce.length,he.length))}ae.draw(V,F.TRIANGLES,K,Q,re,Tn.disabled,G,void 0,"sky",N.mesh.vertexBuffer,N.mesh.indexBuffer,N.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=d.showOverdrawInspector,this.depthRangeFor3D=[0,1-(s._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=m.length-1;this.currentLayer>=0;this.currentLayer--){const O=this.style._layers[m[this.currentLayer]],N=y[O.source],V=x[O.source];this._renderTileClippingMasks(O,V),this.renderLayer(this,N,O,V)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<m.length;this.currentLayer++){const O=this.style._layers[m[this.currentLayer]],N=y[O.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(O))continue;const V=(O.type==="symbol"?I:M)[O.source];this._renderTileClippingMasks(O,x[O.source]),this.renderLayer(this,N,O,V)}if(this.options.showTileBoundaries){const O=function(N,V){let F=null;const G=Object.values(N._layers).flatMap(ae=>ae.source&&!ae.isHidden(V)?[N.sourceCaches[ae.source]]:[]),K=G.filter(ae=>ae.getSource().type==="vector"),Q=G.filter(ae=>ae.getSource().type!=="vector"),re=ae=>{(!F||F.getSource().maxzoom<ae.getSource().maxzoom)&&(F=ae)};return K.forEach(ae=>re(ae)),F||Q.forEach(ae=>re(ae)),F}(this.style,this.transform.zoom);O&&function(N,V,F){for(let G=0;G<F.length;G++)_m(N,V,F[G])}(this,O,O.getVisibleCoordinates())}this.options.showPadding&&function(O){const N=O.transform.padding;La(O,O.transform.height-(N.top||0),3,yd),La(O,N.bottom||0,3,un),ym(O,N.left||0,3,mu),ym(O,O.transform.width-(N.right||0),3,y_);const V=O.transform.centerPoint;(function(F,G,K,Q){gu(F,G-1,K-10,2,20,Q),gu(F,G-10,K-1,20,2,Q)})(O,V.x,O.transform.height-V.y,gm)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(s){if(!this.style||!this.style.map||!this.style.map.terrain)return;const d=this.terrainFacilitator.matrix,m=this.transform.modelViewProjectionMatrix;let y=this.terrainFacilitator.dirty;y||(y=s?!l.a_(d,m):!l.a$(d,m)),y||(y=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),y&&(l.b0(d,m),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(x,M){const I=x.context,O=I.gl,N=Jn.unblended,V=new Ht(O.LEQUAL,Ht.ReadWrite,[0,1]),F=M.getTerrainMesh(),G=M.sourceCache.getRenderableTiles(),K=x.useProgram("terrainDepth");I.bindFramebuffer.set(M.getFramebuffer("depth").framebuffer),I.viewport.set([0,0,x.width/devicePixelRatio,x.height/devicePixelRatio]),I.clear({color:l.aM.transparent,depth:1});for(const Q of G){const re=M.getTerrainData(Q.tileID),ae={u_matrix:x.transform.calculatePosMatrix(Q.tileID.toUnwrapped()),u_ele_delta:M.getMeshFrameDelta(x.transform.zoom)};K.draw(I,O.TRIANGLES,V,On.disabled,N,Tn.backCCW,ae,re,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}I.bindFramebuffer.set(null),I.viewport.set([0,0,x.width,x.height])}(this,this.style.map.terrain),function(x,M){const I=x.context,O=I.gl,N=Jn.unblended,V=new Ht(O.LEQUAL,Ht.ReadWrite,[0,1]),F=M.getTerrainMesh(),G=M.getCoordsTexture(),K=M.sourceCache.getRenderableTiles(),Q=x.useProgram("terrainCoords");I.bindFramebuffer.set(M.getFramebuffer("coords").framebuffer),I.viewport.set([0,0,x.width/devicePixelRatio,x.height/devicePixelRatio]),I.clear({color:l.aM.transparent,depth:1}),M.coordsIndex=[];for(const re of K){const ae=M.getTerrainData(re.tileID);I.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,G.texture);const ce={u_matrix:x.transform.calculatePosMatrix(re.tileID.toUnwrapped()),u_terrain_coords_id:(255-M.coordsIndex.length)/255,u_texture:0,u_ele_delta:M.getMeshFrameDelta(x.transform.zoom)};Q.draw(I,O.TRIANGLES,V,On.disabled,N,Tn.backCCW,ce,ae,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),M.coordsIndex.push(re.tileID.key)}I.bindFramebuffer.set(null),I.viewport.set([0,0,x.width,x.height])}(this,this.style.map.terrain))}renderLayer(s,d,m,y){if(!m.isHidden(this.transform.zoom)&&(m.type==="background"||m.type==="custom"||(y||[]).length))switch(this.id=m.id,m.type){case"symbol":(function(x,M,I,O,N){if(x.renderPass!=="translucent")return;const V=On.disabled,F=x.colorModeForRenderPass();(I._unevaluatedLayout.hasValue("text-variable-anchor")||I._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(G,K,Q,re,ae,ce,he,te,me){const ge=K.transform,ve=Fo(),ze=ae==="map",Ve=ce==="map";for(const Je of G){const it=re.getTile(Je),Ge=it.getBucket(Q);if(!Ge||!Ge.text||!Ge.text.segments.get().length)continue;const qe=l.ag(Ge.textSizeData,ge.zoom),mt=Zt(it,1,K.transform.zoom),Dt=Hi(Je.posMatrix,Ve,ze,K.transform,mt),Ye=Q.layout.get("icon-text-fit")!=="none"&&Ge.hasIconData();if(qe){const tt=Math.pow(2,ge.zoom-it.tileID.overscaledZ),It=K.style.map.terrain?(Lt,Yt)=>K.style.map.terrain.getElevation(Je,Lt,Yt):null,Fn=ve.translatePosition(ge,it,he,te);za(Ge,ze,Ve,me,ge,Dt,Je.posMatrix,tt,qe,Ye,ve,Fn,Je.toUnwrapped(),It)}}}(O,x,I,M,I.layout.get("text-rotation-alignment"),I.layout.get("text-pitch-alignment"),I.paint.get("text-translate"),I.paint.get("text-translate-anchor"),N),I.paint.get("icon-opacity").constantOr(1)!==0&&fd(x,M,I,O,!1,I.paint.get("icon-translate"),I.paint.get("icon-translate-anchor"),I.layout.get("icon-rotation-alignment"),I.layout.get("icon-pitch-alignment"),I.layout.get("icon-keep-upright"),V,F),I.paint.get("text-opacity").constantOr(1)!==0&&fd(x,M,I,O,!0,I.paint.get("text-translate"),I.paint.get("text-translate-anchor"),I.layout.get("text-rotation-alignment"),I.layout.get("text-pitch-alignment"),I.layout.get("text-keep-upright"),V,F),M.map.showCollisionBoxes&&(Ul(x,M,I,O,!0),Ul(x,M,I,O,!1))})(s,d,m,y,this.style.placement.variableOffsets);break;case"circle":(function(x,M,I,O){if(x.renderPass!=="translucent")return;const N=I.paint.get("circle-opacity"),V=I.paint.get("circle-stroke-width"),F=I.paint.get("circle-stroke-opacity"),G=!I.layout.get("circle-sort-key").isConstant();if(N.constantOr(1)===0&&(V.constantOr(1)===0||F.constantOr(1)===0))return;const K=x.context,Q=K.gl,re=x.depthModeForSublayer(0,Ht.ReadOnly),ae=On.disabled,ce=x.colorModeForRenderPass(),he=[];for(let te=0;te<O.length;te++){const me=O[te],ge=M.getTile(me),ve=ge.getBucket(I);if(!ve)continue;const ze=ve.programConfigurations.get(I.id),Ve=x.useProgram("circle",ze),Je=ve.layoutVertexBuffer,it=ve.indexBuffer,Ge=x.style.map.terrain&&x.style.map.terrain.getTerrainData(me),qe={programConfiguration:ze,program:Ve,layoutVertexBuffer:Je,indexBuffer:it,uniformValues:i_(x,me,ge,I),terrainData:Ge};if(G){const mt=ve.segments.get();for(const Dt of mt)he.push({segments:new l.a0([Dt]),sortKey:Dt.sortKey,state:qe})}else he.push({segments:ve.segments,sortKey:0,state:qe})}G&&he.sort((te,me)=>te.sortKey-me.sortKey);for(const te of he){const{programConfiguration:me,program:ge,layoutVertexBuffer:ve,indexBuffer:ze,uniformValues:Ve,terrainData:Je}=te.state;ge.draw(K,Q.TRIANGLES,re,ae,ce,Tn.disabled,Ve,Je,I.id,ve,ze,te.segments,I.paint,x.transform.zoom,me)}})(s,d,m,y);break;case"heatmap":(function(x,M,I,O){if(I.paint.get("heatmap-opacity")===0)return;const N=x.context;if(x.style.map.terrain){for(const V of O){const F=M.getTile(V);M.hasRenderableParent(V)||(x.renderPass==="offscreen"?gd(x,F,I,V):x.renderPass==="translucent"&&Zo(x,I,V))}N.viewport.set([0,0,x.width,x.height])}else x.renderPass==="offscreen"?function(V,F,G,K){const Q=V.context,re=Q.gl,ae=On.disabled,ce=new Jn([re.ONE,re.ONE],l.aM.transparent,[!0,!0,!0,!0]);(function(he,te,me){const ge=he.gl;he.activeTexture.set(ge.TEXTURE1),he.viewport.set([0,0,te.width/4,te.height/4]);let ve=me.heatmapFbos.get(l.aU);ve?(ge.bindTexture(ge.TEXTURE_2D,ve.colorAttachment.get()),he.bindFramebuffer.set(ve.framebuffer)):(ve=ql(he,te.width/4,te.height/4),me.heatmapFbos.set(l.aU,ve))})(Q,V,G),Q.clear({color:l.aM.transparent});for(let he=0;he<K.length;he++){const te=K[he];if(F.hasRenderableParent(te))continue;const me=F.getTile(te),ge=me.getBucket(G);if(!ge)continue;const ve=ge.programConfigurations.get(G.id),ze=V.useProgram("heatmap",ve),{zoom:Ve}=V.transform;ze.draw(Q,re.TRIANGLES,Ht.disabled,ae,ce,Tn.disabled,ir(te.posMatrix,me,Ve,G.paint.get("heatmap-intensity")),null,G.id,ge.layoutVertexBuffer,ge.indexBuffer,ge.segments,G.paint,V.transform.zoom,ve)}Q.viewport.set([0,0,V.width,V.height])}(x,M,I,O):x.renderPass==="translucent"&&function(V,F){const G=V.context,K=G.gl;G.setColorMode(V.colorModeForRenderPass());const Q=F.heatmapFbos.get(l.aU);Q&&(G.activeTexture.set(K.TEXTURE0),K.bindTexture(K.TEXTURE_2D,Q.colorAttachment.get()),G.activeTexture.set(K.TEXTURE1),Wl(G,F).bind(K.LINEAR,K.CLAMP_TO_EDGE),V.useProgram("heatmapTexture").draw(G,K.TRIANGLES,Ht.disabled,On.disabled,V.colorModeForRenderPass(),Tn.disabled,su(V,F,0,1),null,F.id,V.viewportBuffer,V.quadTriangleIndexBuffer,V.viewportSegments,F.paint,V.transform.zoom))}(x,I)})(s,d,m,y);break;case"line":(function(x,M,I,O){if(x.renderPass!=="translucent")return;const N=I.paint.get("line-opacity"),V=I.paint.get("line-width");if(N.constantOr(1)===0||V.constantOr(1)===0)return;const F=x.depthModeForSublayer(0,Ht.ReadOnly),G=x.colorModeForRenderPass(),K=I.paint.get("line-dasharray"),Q=I.paint.get("line-pattern"),re=Q.constantOr(1),ae=I.paint.get("line-gradient"),ce=I.getCrossfadeParameters(),he=re?"linePattern":K?"lineSDF":ae?"lineGradient":"line",te=x.context,me=te.gl;let ge=!0;for(const ve of O){const ze=M.getTile(ve);if(re&&!ze.patternsLoaded())continue;const Ve=ze.getBucket(I);if(!Ve)continue;const Je=Ve.programConfigurations.get(I.id),it=x.context.program.get(),Ge=x.useProgram(he,Je),qe=ge||Ge.program!==it,mt=x.style.map.terrain&&x.style.map.terrain.getTerrainData(ve),Dt=Q.constantOr(null);if(Dt&&ze.imageAtlas){const It=ze.imageAtlas,Fn=It.patternPositions[Dt.to.toString()],Lt=It.patternPositions[Dt.from.toString()];Fn&&Lt&&Je.setConstantPatternPositions(Fn,Lt)}const Ye=mt?ve:null,tt=re?Da(x,ze,I,ce,Ye):K?r_(x,ze,I,K,ce,Ye):ae?Qf(x,ze,I,Ve.lineClipsArray.length,Ye):au(x,ze,I,Ye);if(re)te.activeTexture.set(me.TEXTURE0),ze.imageAtlasTexture.bind(me.LINEAR,me.CLAMP_TO_EDGE),Je.updatePaintBuffers(ce);else if(K&&(qe||x.lineAtlas.dirty))te.activeTexture.set(me.TEXTURE0),x.lineAtlas.bind(te);else if(ae){const It=Ve.gradients[I.id];let Fn=It.texture;if(I.gradientVersion!==It.version){let Lt=256;if(I.stepInterpolant){const Yt=M.getSource().maxzoom,$n=ve.canonical.z===Yt?Math.ceil(1<<x.transform.maxZoom-ve.canonical.z):1;Lt=l.ac(l.aV(Ve.maxLineLength/l.X*1024*$n),256,te.maxTextureSize)}It.gradient=l.aW({expression:I.gradientExpression(),evaluationKey:"lineProgress",resolution:Lt,image:It.gradient||void 0,clips:Ve.lineClipsArray}),It.texture?It.texture.update(It.gradient):It.texture=new rt(te,It.gradient,me.RGBA),It.version=I.gradientVersion,Fn=It.texture}te.activeTexture.set(me.TEXTURE0),Fn.bind(I.stepInterpolant?me.NEAREST:me.LINEAR,me.CLAMP_TO_EDGE)}Ge.draw(te,me.TRIANGLES,F,x.stencilModeForClipping(ve),G,Tn.disabled,tt,mt,I.id,Ve.layoutVertexBuffer,Ve.indexBuffer,Ve.segments,I.paint,x.transform.zoom,Je,Ve.layoutVertexBuffer2),ge=!1}})(s,d,m,y);break;case"fill":(function(x,M,I,O){const N=I.paint.get("fill-color"),V=I.paint.get("fill-opacity");if(V.constantOr(1)===0)return;const F=x.colorModeForRenderPass(),G=I.paint.get("fill-pattern"),K=x.opaquePassEnabledForLayer()&&!G.constantOr(1)&&N.constantOr(l.aM.transparent).a===1&&V.constantOr(0)===1?"opaque":"translucent";if(x.renderPass===K){const Q=x.depthModeForSublayer(1,x.renderPass==="opaque"?Ht.ReadWrite:Ht.ReadOnly);Gl(x,M,I,O,Q,F,!1)}if(x.renderPass==="translucent"&&I.paint.get("fill-antialias")){const Q=x.depthModeForSublayer(I.getPaintProperty("fill-outline-color")?2:0,Ht.ReadOnly);Gl(x,M,I,O,Q,F,!0)}})(s,d,m,y);break;case"fill-extrusion":(function(x,M,I,O){const N=I.paint.get("fill-extrusion-opacity");if(N!==0&&x.renderPass==="translucent"){const V=new Ht(x.context.gl.LEQUAL,Ht.ReadWrite,x.depthRangeFor3D);if(N!==1||I.paint.get("fill-extrusion-pattern").constantOr(1))fu(x,M,I,O,V,On.disabled,Jn.disabled),fu(x,M,I,O,V,x.stencilModeFor3D(),x.colorModeForRenderPass());else{const F=x.colorModeForRenderPass();fu(x,M,I,O,V,On.disabled,F)}}})(s,d,m,y);break;case"hillshade":(function(x,M,I,O){if(x.renderPass!=="offscreen"&&x.renderPass!=="translucent")return;const N=x.context,V=x.depthModeForSublayer(0,Ht.ReadOnly),F=x.colorModeForRenderPass(),[G,K]=x.renderPass==="translucent"?x.stencilConfigForOverlap(O):[{},O];for(const Q of K){const re=M.getTile(Q);re.needsHillshadePrepare!==void 0&&re.needsHillshadePrepare&&x.renderPass==="offscreen"?Ra(x,re,I,V,On.disabled,F):x.renderPass==="translucent"&&Na(x,Q,re,I,V,G[Q.overscaledZ],F)}N.viewport.set([0,0,x.width,x.height])})(s,d,m,y);break;case"raster":(function(x,M,I,O){if(x.renderPass!=="translucent"||I.paint.get("raster-opacity")===0||!O.length)return;const N=x.context,V=N.gl,F=M.getSource(),G=x.useProgram("raster"),K=x.colorModeForRenderPass(),[Q,re]=F instanceof bi?[{},O]:x.stencilConfigForOverlap(O),ae=re[re.length-1].overscaledZ,ce=!x.options.moving;for(const he of re){const te=x.depthModeForSublayer(he.overscaledZ-ae,I.paint.get("raster-opacity")===1?Ht.ReadWrite:Ht.ReadOnly,V.LESS),me=M.getTile(he);me.registerFadeDuration(I.paint.get("raster-fade-duration"));const ge=M.findLoadedParent(he,0),ve=M.findLoadedSibling(he),ze=mm(me,ge||ve||null,M,I,x.transform,x.style.map.terrain);let Ve,Je;const it=I.paint.get("raster-resampling")==="nearest"?V.NEAREST:V.LINEAR;N.activeTexture.set(V.TEXTURE0),me.texture.bind(it,V.CLAMP_TO_EDGE,V.LINEAR_MIPMAP_NEAREST),N.activeTexture.set(V.TEXTURE1),ge?(ge.texture.bind(it,V.CLAMP_TO_EDGE,V.LINEAR_MIPMAP_NEAREST),Ve=Math.pow(2,ge.tileID.overscaledZ-me.tileID.overscaledZ),Je=[me.tileID.canonical.x*Ve%1,me.tileID.canonical.y*Ve%1]):me.texture.bind(it,V.CLAMP_TO_EDGE,V.LINEAR_MIPMAP_NEAREST),me.texture.useMipmap&&N.extTextureFilterAnisotropic&&x.transform.pitch>20&&V.texParameterf(V.TEXTURE_2D,N.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,N.extTextureFilterAnisotropicMax);const Ge=x.style.map.terrain&&x.style.map.terrain.getTerrainData(he),qe=Ge?he:null,mt=qe?qe.posMatrix:x.transform.calculatePosMatrix(he.toUnwrapped(),ce),Dt=s_(mt,Je||[0,0],Ve||1,ze,I);F instanceof bi?G.draw(N,V.TRIANGLES,te,On.disabled,K,Tn.disabled,Dt,Ge,I.id,F.boundsBuffer,x.quadTriangleIndexBuffer,F.boundsSegments):G.draw(N,V.TRIANGLES,te,Q[he.overscaledZ],K,Tn.disabled,Dt,Ge,I.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments)}})(s,d,m,y);break;case"background":(function(x,M,I,O){const N=I.paint.get("background-color"),V=I.paint.get("background-opacity");if(V===0)return;const F=x.context,G=F.gl,K=x.transform,Q=K.tileSize,re=I.paint.get("background-pattern");if(x.isPatternMissing(re))return;const ae=!re&&N.a===1&&V===1&&x.opaquePassEnabledForLayer()?"opaque":"translucent";if(x.renderPass!==ae)return;const ce=On.disabled,he=x.depthModeForSublayer(0,ae==="opaque"?Ht.ReadWrite:Ht.ReadOnly),te=x.colorModeForRenderPass(),me=x.useProgram(re?"backgroundPattern":"background"),ge=O||K.coveringTiles({tileSize:Q,terrain:x.style.map.terrain});re&&(F.activeTexture.set(G.TEXTURE0),x.imageManager.bind(x.context));const ve=I.getCrossfadeParameters();for(const ze of ge){const Ve=O?ze.posMatrix:x.transform.calculatePosMatrix(ze.toUnwrapped()),Je=re?id(Ve,V,x,re,{tileID:ze,tileSize:Q},ve):lu(Ve,V,N),it=x.style.map.terrain&&x.style.map.terrain.getTerrainData(ze);me.draw(F,G.TRIANGLES,he,ce,te,Tn.disabled,Je,it,I.id,x.tileExtentBuffer,x.quadTriangleIndexBuffer,x.tileExtentSegments)}})(s,0,m,y);break;case"custom":(function(x,M,I){const O=x.context,N=I.implementation;if(x.renderPass==="offscreen"){const V=N.prerender;V&&(x.setCustomLayerDefaults(),O.setColorMode(x.colorModeForRenderPass()),V.call(N,O.gl,x.transform.customLayerMatrix()),O.setDirty(),x.setBaseState())}else if(x.renderPass==="translucent"){x.setCustomLayerDefaults(),O.setColorMode(x.colorModeForRenderPass()),O.setStencilMode(On.disabled);const V=N.renderingMode==="3d"?new Ht(x.context.gl.LEQUAL,Ht.ReadWrite,x.depthRangeFor3D):x.depthModeForSublayer(0,Ht.ReadOnly);O.setDepthMode(V),N.render(O.gl,x.transform.customLayerMatrix(),{farZ:x.transform.farZ,nearZ:x.transform.nearZ,fov:x.transform._fov,modelViewProjectionMatrix:x.transform.modelViewProjectionMatrix,projectionMatrix:x.transform.projectionMatrix}),O.setDirty(),x.setBaseState(),O.bindFramebuffer.set(null)}})(s,0,m)}}translatePosMatrix(s,d,m,y,x){if(!m[0]&&!m[1])return s;const M=x?y==="map"?this.transform.angle:0:y==="viewport"?-this.transform.angle:0;if(M){const N=Math.sin(M),V=Math.cos(M);m=[m[0]*V-m[1]*N,m[0]*N+m[1]*V]}const I=[x?m[0]:Zt(d,m[0],this.transform.zoom),x?m[1]:Zt(d,m[1],this.transform.zoom),0],O=new Float32Array(16);return l.J(O,s,I),O}saveTileTexture(s){const d=this._tileTextures[s.size[0]];d?d.push(s):this._tileTextures[s.size[0]]=[s]}getTileTexture(s){const d=this._tileTextures[s];return d&&d.length>0?d.pop():null}isPatternMissing(s){if(!s)return!1;if(!s.from||!s.to)return!0;const d=this.imageManager.getPattern(s.from.toString()),m=this.imageManager.getPattern(s.to.toString());return!d||!m}useProgram(s,d){this.cache=this.cache||{};const m=s+(d?d.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[m]||(this.cache[m]=new td(this.context,ho[s],d,rd[s],this._showOverdrawInspector,this.style.map.terrain)),this.cache[m]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const s=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(s.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new rt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:s,drawingBufferHeight:d}=this.context.gl;return this.width!==s||this.height!==d}}class Va{constructor(s,d){this.points=s,this.planes=d}static fromInvProjectionMatrix(s,d,m){const y=Math.pow(2,m),x=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(I=>{const O=1/(I=l.af([],I,s))[3]/d*y;return l.b1(I,I,[O,O,1/I[3],O])}),M=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(I=>{const O=function(G,K){var Q=K[0],re=K[1],ae=K[2],ce=Q*Q+re*re+ae*ae;return ce>0&&(ce=1/Math.sqrt(ce)),G[0]=K[0]*ce,G[1]=K[1]*ce,G[2]=K[2]*ce,G}([],function(G,K,Q){var re=K[0],ae=K[1],ce=K[2],he=Q[0],te=Q[1],me=Q[2];return G[0]=ae*me-ce*te,G[1]=ce*he-re*me,G[2]=re*te-ae*he,G}([],Ae([],x[I[0]],x[I[1]]),Ae([],x[I[2]],x[I[1]]))),N=-((V=O)[0]*(F=x[I[1]])[0]+V[1]*F[1]+V[2]*F[2]);var V,F;return O.concat(N)});return new Va(x,M)}}class Fa{constructor(s,d){this.min=s,this.max=d,this.center=function(m,y,x){return m[0]=.5*y[0],m[1]=.5*y[1],m[2]=.5*y[2],m}([],function(m,y,x){return m[0]=y[0]+x[0],m[1]=y[1]+x[1],m[2]=y[2]+x[2],m}([],this.min,this.max))}quadrant(s){const d=[s%2==0,s<2],m=Te(this.min),y=Te(this.max);for(let x=0;x<d.length;x++)m[x]=d[x]?this.min[x]:this.center[x],y[x]=d[x]?this.center[x]:this.max[x];return y[2]=this.max[2],new Fa(m,y)}distanceX(s){return Math.max(Math.min(this.max[0],s[0]),this.min[0])-s[0]}distanceY(s){return Math.max(Math.min(this.max[1],s[1]),this.min[1])-s[1]}intersects(s){const d=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let m=!0;for(let y=0;y<s.planes.length;y++){const x=s.planes[y];let M=0;for(let I=0;I<d.length;I++)l.b2(x,d[I])>=0&&M++;if(M===0)return 0;M!==d.length&&(m=!1)}if(m)return 2;for(let y=0;y<3;y++){let x=Number.MAX_VALUE,M=-Number.MAX_VALUE;for(let I=0;I<s.points.length;I++){const O=s.points[I][y]-this.min[y];x=Math.min(x,O),M=Math.max(M,O)}if(M<0||x>this.max[y]-this.min[y])return 0}return 1}}class $a{constructor(s=0,d=0,m=0,y=0){if(isNaN(s)||s<0||isNaN(d)||d<0||isNaN(m)||m<0||isNaN(y)||y<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=d,this.left=m,this.right=y}interpolate(s,d,m){return d.top!=null&&s.top!=null&&(this.top=l.y.number(s.top,d.top,m)),d.bottom!=null&&s.bottom!=null&&(this.bottom=l.y.number(s.bottom,d.bottom,m)),d.left!=null&&s.left!=null&&(this.left=l.y.number(s.left,d.left,m)),d.right!=null&&s.right!=null&&(this.right=l.y.number(s.right,d.right,m)),this}getCenter(s,d){const m=l.ac((this.left+s-this.right)/2,0,s),y=l.ac((this.top+d-this.bottom)/2,0,d);return new l.P(m,y)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new $a(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const _d=85.051129;class ja{constructor(s,d,m,y,x){this.tileSize=512,this._renderWorldCopies=x===void 0||!!x,this._minZoom=s||0,this._maxZoom=d||22,this._minPitch=m??0,this._maxPitch=y??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new l.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new $a,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const s=new ja(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return s.apply(this),s}apply(s){this.tileSize=s.tileSize,this.latRange=s.latRange,this.lngRange=s.lngRange,this.width=s.width,this.height=s.height,this._center=s._center,this._elevation=s._elevation,this.minElevationForCurrentTile=s.minElevationForCurrentTile,this.zoom=s.zoom,this.angle=s.angle,this._fov=s._fov,this._pitch=s._pitch,this._unmodified=s._unmodified,this._edgeInsets=s._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(s){this._minZoom!==s&&(this._minZoom=s,this.zoom=Math.max(this.zoom,s))}get maxZoom(){return this._maxZoom}set maxZoom(s){this._maxZoom!==s&&(this._maxZoom=s,this.zoom=Math.min(this.zoom,s))}get minPitch(){return this._minPitch}set minPitch(s){this._minPitch!==s&&(this._minPitch=s,this.pitch=Math.max(this.pitch,s))}get maxPitch(){return this._maxPitch}set maxPitch(s){this._maxPitch!==s&&(this._maxPitch=s,this.pitch=Math.min(this.pitch,s))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(s){s===void 0?s=!0:s===null&&(s=!1),this._renderWorldCopies=s}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(s){const d=-l.b3(s,-180,180)*Math.PI/180;this.angle!==d&&(this._unmodified=!1,this.angle=d,this._calcMatrices(),this.rotationMatrix=function(){var m=new l.A(4);return l.A!=Float32Array&&(m[1]=0,m[2]=0),m[0]=1,m[3]=1,m}(),function(m,y,x){var M=y[0],I=y[1],O=y[2],N=y[3],V=Math.sin(x),F=Math.cos(x);m[0]=M*F+O*V,m[1]=I*F+N*V,m[2]=M*-V+O*F,m[3]=I*-V+N*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const d=l.ac(s,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==d&&(this._unmodified=!1,this._pitch=d,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(s){s=Math.max(.01,Math.min(60,s)),this._fov!==s&&(this._unmodified=!1,this._fov=s/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(s){const d=Math.min(Math.max(s,this.minZoom),this.maxZoom);this._zoom!==d&&(this._unmodified=!1,this._zoom=d,this.tileZoom=Math.max(0,Math.floor(d)),this.scale=this.zoomScale(d),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(s){s.lat===this._center.lat&&s.lng===this._center.lng||(this._unmodified=!1,this._center=s,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(s){s!==this._elevation&&(this._elevation=s,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(s){this._edgeInsets.equals(s)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,s,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(s){return this._edgeInsets.equals(s)}interpolatePadding(s,d,m){this._unmodified=!1,this._edgeInsets.interpolate(s,d,m),this._constrain(),this._calcMatrices()}coveringZoomLevel(s){const d=(s.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/s.tileSize));return Math.max(0,d)}getVisibleUnwrappedCoordinates(s){const d=[new l.b4(0,s)];if(this._renderWorldCopies){const m=this.pointCoordinate(new l.P(0,0)),y=this.pointCoordinate(new l.P(this.width,0)),x=this.pointCoordinate(new l.P(this.width,this.height)),M=this.pointCoordinate(new l.P(0,this.height)),I=Math.floor(Math.min(m.x,y.x,x.x,M.x)),O=Math.floor(Math.max(m.x,y.x,x.x,M.x)),N=1;for(let V=I-N;V<=O+N;V++)V!==0&&d.push(new l.b4(V,s))}return d}coveringTiles(s){var d,m;let y=this.coveringZoomLevel(s);const x=y;if(s.minzoom!==void 0&&y<s.minzoom)return[];s.maxzoom!==void 0&&y>s.maxzoom&&(y=s.maxzoom);const M=this.pointCoordinate(this.getCameraPoint()),I=l.Z.fromLngLat(this.center),O=Math.pow(2,y),N=[O*M.x,O*M.y,0],V=[O*I.x,O*I.y,0],F=Va.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,y);let G=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(G=y);const K=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,Q=te=>({aabb:new Fa([te*O,0,0],[(te+1)*O,O,0]),zoom:0,x:0,y:0,wrap:te,fullyVisible:!1}),re=[],ae=[],ce=y,he=s.reparseOverscaled?x:y;if(this._renderWorldCopies)for(let te=1;te<=3;te++)re.push(Q(-te)),re.push(Q(te));for(re.push(Q(0));re.length>0;){const te=re.pop(),me=te.x,ge=te.y;let ve=te.fullyVisible;if(!ve){const Ge=te.aabb.intersects(F);if(Ge===0)continue;ve=Ge===2}const ze=s.terrain?N:V,Ve=te.aabb.distanceX(ze),Je=te.aabb.distanceY(ze),it=Math.max(Math.abs(Ve),Math.abs(Je));if(te.zoom===ce||it>K+(1<<ce-te.zoom)-2&&te.zoom>=G){const Ge=ce-te.zoom,qe=N[0]-.5-(me<<Ge),mt=N[1]-.5-(ge<<Ge);ae.push({tileID:new l.S(te.zoom===ce?he:te.zoom,te.wrap,te.zoom,me,ge),distanceSq:je([V[0]-.5-me,V[1]-.5-ge]),tileDistanceToCamera:Math.sqrt(qe*qe+mt*mt)})}else for(let Ge=0;Ge<4;Ge++){const qe=(me<<1)+Ge%2,mt=(ge<<1)+(Ge>>1),Dt=te.zoom+1;let Ye=te.aabb.quadrant(Ge);if(s.terrain){const tt=new l.S(Dt,te.wrap,Dt,qe,mt),It=s.terrain.getMinMaxElevation(tt),Fn=(d=It.minElevation)!==null&&d!==void 0?d:this.elevation,Lt=(m=It.maxElevation)!==null&&m!==void 0?m:this.elevation;Ye=new Fa([Ye.min[0],Ye.min[1],Fn],[Ye.max[0],Ye.max[1],Lt])}re.push({aabb:Ye,zoom:Dt,x:qe,y:mt,wrap:te.wrap,fullyVisible:ve})}}return ae.sort((te,me)=>te.distanceSq-me.distanceSq).map(te=>te.tileID)}resize(s,d){this.width=s,this.height=d,this.pixelsToGLUnits=[2/s,-2/d],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(s){return Math.pow(2,s)}scaleZoom(s){return Math.log(s)/Math.LN2}project(s){const d=l.ac(s.lat,-85.051129,_d);return new l.P(l.O(s.lng)*this.worldSize,l.Q(d)*this.worldSize)}unproject(s){return new l.Z(s.x/this.worldSize,s.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(s){const d=this.elevation,m=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,y=this.pointLocation(this.centerPoint,s),x=s.getElevationForLngLatZoom(y,this.tileZoom);if(!(this.elevation-x))return;const M=m+d-x,I=Math.cos(this._pitch)*this.cameraToCenterDistance/M/l.b5(1,y.lat),O=this.scaleZoom(I/this.tileSize);this._elevation=x,this._center=y,this.zoom=O}setLocationAtPoint(s,d){const m=this.pointCoordinate(d),y=this.pointCoordinate(this.centerPoint),x=this.locationCoordinate(s),M=new l.Z(x.x-(m.x-y.x),x.y-(m.y-y.y));this.center=this.coordinateLocation(M),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(s,d){return d?this.coordinatePoint(this.locationCoordinate(s),d.getElevationForLngLatZoom(s,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(s))}pointLocation(s,d){return this.coordinateLocation(this.pointCoordinate(s,d))}locationCoordinate(s){return l.Z.fromLngLat(s)}coordinateLocation(s){return s&&s.toLngLat()}pointCoordinate(s,d){if(d){const G=d.pointCoordinate(s);if(G!=null)return G}const m=[s.x,s.y,0,1],y=[s.x,s.y,1,1];l.af(m,m,this.pixelMatrixInverse),l.af(y,y,this.pixelMatrixInverse);const x=m[3],M=y[3],I=m[1]/x,O=y[1]/M,N=m[2]/x,V=y[2]/M,F=N===V?0:(0-N)/(V-N);return new l.Z(l.y.number(m[0]/x,y[0]/M,F)/this.worldSize,l.y.number(I,O,F)/this.worldSize)}coordinatePoint(s,d=0,m=this.pixelMatrix){const y=[s.x*this.worldSize,s.y*this.worldSize,d,1];return l.af(y,y,m),new l.P(y[0]/y[3],y[1]/y[3])}getBounds(){const s=Math.max(0,this.height/2-this.getHorizon());return new we().extend(this.pointLocation(new l.P(0,s))).extend(this.pointLocation(new l.P(this.width,s))).extend(this.pointLocation(new l.P(this.width,this.height))).extend(this.pointLocation(new l.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new we([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(s){s?(this.lngRange=[s.getWest(),s.getEast()],this.latRange=[s.getSouth(),s.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,_d])}calculateTileMatrix(s){const d=s.canonical,m=this.worldSize/this.zoomScale(d.z),y=d.x+Math.pow(2,d.z)*s.wrap,x=l.an(new Float64Array(16));return l.J(x,x,[y*m,d.y*m,0]),l.K(x,x,[m/l.X,m/l.X,1]),x}calculatePosMatrix(s,d=!1){const m=s.key,y=d?this._alignedPosMatrixCache:this._posMatrixCache;if(y[m])return y[m];const x=this.calculateTileMatrix(s);return l.L(x,d?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,x),y[m]=new Float32Array(x),y[m]}calculateFogMatrix(s){const d=s.key,m=this._fogMatrixCache;if(m[d])return m[d];const y=this.calculateTileMatrix(s);return l.L(y,this.fogMatrix,y),m[d]=new Float32Array(y),m[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(s,d){d=l.ac(+d,this.minZoom,this.maxZoom);const m={center:new l.N(s.lng,s.lat),zoom:d};let y=this.lngRange;if(!this._renderWorldCopies&&y===null){const te=179.9999999999;y=[-te,te]}const x=this.tileSize*this.zoomScale(m.zoom);let M=0,I=x,O=0,N=x,V=0,F=0;const{x:G,y:K}=this.size;if(this.latRange){const te=this.latRange;M=l.Q(te[1])*x,I=l.Q(te[0])*x,I-M<K&&(V=K/(I-M))}y&&(O=l.b3(l.O(y[0])*x,0,x),N=l.b3(l.O(y[1])*x,0,x),N<O&&(N+=x),N-O<G&&(F=G/(N-O)));const{x:Q,y:re}=this.project.call({worldSize:x},s);let ae,ce;const he=Math.max(F||0,V||0);if(he){const te=new l.P(F?(N+O)/2:Q,V?(I+M)/2:re);return m.center=this.unproject.call({worldSize:x},te).wrap(),m.zoom+=this.scaleZoom(he),m}if(this.latRange){const te=K/2;re-te<M&&(ce=M+te),re+te>I&&(ce=I-te)}if(y){const te=(O+N)/2;let me=Q;this._renderWorldCopies&&(me=l.b3(Q,te-x/2,te+x/2));const ge=G/2;me-ge<O&&(ae=O+ge),me+ge>N&&(ae=N-ge)}if(ae!==void 0||ce!==void 0){const te=new l.P(ae??Q,ce??re);m.center=this.unproject.call({worldSize:x},te).wrap()}return m}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const s=this._unmodified,{center:d,zoom:m}=this.getConstrained(this.center,this.zoom);this.center=d,this.zoom=m,this._unmodified=s,this._constraining=!1}_calcMatrices(){if(!this.height)return;const s=this.centerOffset,d=this.point.x,m=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=l.b5(1,this.center.lat)*this.worldSize;let y=l.an(new Float64Array(16));l.K(y,y,[this.width/2,-this.height/2,1]),l.J(y,y,[1,-1,0]),this.labelPlaneMatrix=y,y=l.an(new Float64Array(16)),l.K(y,y,[1,-1,1]),l.J(y,y,[-1,-1,0]),l.K(y,y,[2/this.width,2/this.height,1]),this.glCoordMatrix=y;const x=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),M=Math.min(this.elevation,this.minElevationForCurrentTile),I=x-M*this._pixelPerMeter/Math.cos(this._pitch),O=M<0?I:x,N=Math.PI/2+this._pitch,V=this._fov*(.5+s.y/this.height),F=Math.sin(V)*O/Math.sin(l.ac(Math.PI-N-V,.01,Math.PI-.01)),G=this.getHorizon(),K=2*Math.atan(G/this.cameraToCenterDistance)*(.5+s.y/(2*G)),Q=Math.sin(K)*O/Math.sin(l.ac(Math.PI-N-K,.01,Math.PI-.01)),re=Math.min(F,Q);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*re+O),this.nearZ=this.height/50,y=new Float64Array(16),l.b6(y,this._fov,this.width/this.height,this.nearZ,this.farZ),y[8]=2*-s.x/this.width,y[9]=2*s.y/this.height,this.projectionMatrix=l.ae(y),l.K(y,y,[1,-1,1]),l.J(y,y,[0,0,-this.cameraToCenterDistance]),l.b7(y,y,this._pitch),l.ad(y,y,this.angle),l.J(y,y,[-d,-m,0]),this.mercatorMatrix=l.K([],y,[this.worldSize,this.worldSize,this.worldSize]),l.K(y,y,[1,1,this._pixelPerMeter]),this.pixelMatrix=l.L(new Float64Array(16),this.labelPlaneMatrix,y),l.J(y,y,[0,0,-this.elevation]),this.modelViewProjectionMatrix=y,this.invModelViewProjectionMatrix=l.as([],y),this.fogMatrix=new Float64Array(16),l.b6(this.fogMatrix,this._fov,this.width/this.height,x,this.farZ),this.fogMatrix[8]=2*-s.x/this.width,this.fogMatrix[9]=2*s.y/this.height,l.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),l.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),l.b7(this.fogMatrix,this.fogMatrix,this._pitch),l.ad(this.fogMatrix,this.fogMatrix,this.angle),l.J(this.fogMatrix,this.fogMatrix,[-d,-m,0]),l.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),l.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=l.L(new Float64Array(16),this.labelPlaneMatrix,y);const ae=this.width%2/2,ce=this.height%2/2,he=Math.cos(this.angle),te=Math.sin(this.angle),me=d-Math.round(d)+he*ae+te*ce,ge=m-Math.round(m)+he*ce+te*ae,ve=new Float64Array(y);if(l.J(ve,ve,[me>.5?me-1:me,ge>.5?ge-1:ge,0]),this.alignedModelViewProjectionMatrix=ve,y=l.as(new Float64Array(16),this.pixelMatrix),!y)throw new Error("failed to invert matrix");this.pixelMatrixInverse=y,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const s=this.pointCoordinate(new l.P(0,0)),d=[s.x*this.worldSize,s.y*this.worldSize,0,1];return l.af(d,d,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.P(0,s))}getCameraQueryGeometry(s){const d=this.getCameraPoint();if(s.length===1)return[s[0],d];{let m=d.x,y=d.y,x=d.x,M=d.y;for(const I of s)m=Math.min(m,I.x),y=Math.min(y,I.y),x=Math.max(x,I.x),M=Math.max(M,I.y);return[new l.P(m,y),new l.P(x,y),new l.P(x,M),new l.P(m,M),new l.P(m,y)]}}lngLatToCameraDepth(s,d){const m=this.locationCoordinate(s),y=[m.x*this.worldSize,m.y*this.worldSize,d,1];return l.af(y,y,this.modelViewProjectionMatrix),y[2]/y[3]}}function Zl(v,s){let d,m=!1,y=null,x=null;const M=()=>{y=null,m&&(v.apply(x,d),y=setTimeout(M,s),m=!1)};return(...I)=>(m=!0,x=this,d=I,y||M(),y)}class bu{constructor(s){this._getCurrentHash=()=>{const d=window.location.hash.replace("#","");if(this._hashName){let m;return d.split("&").map(y=>y.split("=")).forEach(y=>{y[0]===this._hashName&&(m=y)}),(m&&m[1]||"").split("/")}return d.split("/")},this._onHashChange=()=>{const d=this._getCurrentHash();if(d.length>=3&&!d.some(m=>isNaN(m))){const m=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(d[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+d[2],+d[1]],zoom:+d[0],bearing:m,pitch:+(d[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const d=window.location.href.replace(/(#.+)?$/,this.getHashString());window.history.replaceState(window.history.state,null,d)},this._removeHash=()=>{const d=this._getCurrentHash();if(d.length===0)return;const m=d.join("/");let y=m;y.split("&").length>0&&(y=y.split("&")[0]),this._hashName&&(y=`${this._hashName}=${m}`);let x=window.location.hash.replace(y,"");x.startsWith("#&")?x=x.slice(0,1)+x.slice(2):x==="#"&&(x="");let M=window.location.href.replace(/(#.+)?$/,x);M=M.replace("&&","&"),window.history.replaceState(window.history.state,null,M)},this._updateHash=Zl(this._updateHashUnthrottled,300),this._hashName=s&&encodeURIComponent(s)}addTo(s){return this._map=s,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(s){const d=this._map.getCenter(),m=Math.round(100*this._map.getZoom())/100,y=Math.ceil((m*Math.LN2+Math.log(512/360/.5))/Math.LN10),x=Math.pow(10,y),M=Math.round(d.lng*x)/x,I=Math.round(d.lat*x)/x,O=this._map.getBearing(),N=this._map.getPitch();let V="";if(V+=s?`/${M}/${I}/${m}`:`${m}/${I}/${M}`,(O||N)&&(V+="/"+Math.round(10*O)/10),N&&(V+=`/${Math.round(N)}`),this._hashName){const F=this._hashName;let G=!1;const K=window.location.hash.slice(1).split("&").map(Q=>{const re=Q.split("=")[0];return re===F?(G=!0,`${re}=${V}`):Q}).filter(Q=>Q);return G||K.push(`${F}=${V}`),`#${K.join("&")}`}return`#${V}`}}const xu={linearity:.3,easing:l.b8(0,0,.3,1)},bd=l.e({deceleration:2500,maxSpeed:1400},xu),__=l.e({deceleration:20,maxSpeed:1400},xu),xm=l.e({deceleration:1e3,maxSpeed:360},xu),vu=l.e({deceleration:1e3,maxSpeed:90},xu);class xd{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:E.now(),settings:s})}_drainInertiaBuffer(){const s=this._inertiaBuffer,d=E.now();for(;s.length>0&&d-s[0].time>160;)s.shift()}_onMoveEnd(s){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const d={zoom:0,bearing:0,pitch:0,pan:new l.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:x}of this._inertiaBuffer)d.zoom+=x.zoomDelta||0,d.bearing+=x.bearingDelta||0,d.pitch+=x.pitchDelta||0,x.panDelta&&d.pan._add(x.panDelta),x.around&&(d.around=x.around),x.pinchAround&&(d.pinchAround=x.pinchAround);const m=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,y={};if(d.pan.mag()){const x=Xl(d.pan.mag(),m,l.e({},bd,s||{}));y.offset=d.pan.mult(x.amount/d.pan.mag()),y.center=this._map.transform.center,Yl(y,x)}if(d.zoom){const x=Xl(d.zoom,m,__);y.zoom=this._map.transform.zoom+x.amount,Yl(y,x)}if(d.bearing){const x=Xl(d.bearing,m,xm);y.bearing=this._map.transform.bearing+l.ac(x.amount,-179,179),Yl(y,x)}if(d.pitch){const x=Xl(d.pitch,m,vu);y.pitch=this._map.transform.pitch+x.amount,Yl(y,x)}if(y.zoom||y.bearing){const x=d.pinchAround===void 0?d.around:d.pinchAround;y.around=x?this._map.unproject(x):this._map.getCenter()}return this.clear(),l.e(y,{noMoveStart:!0})}}function Yl(v,s){(!v.duration||v.duration<s.duration)&&(v.duration=s.duration,v.easing=s.easing)}function Xl(v,s,d){const{maxSpeed:m,linearity:y,deceleration:x}=d,M=l.ac(v*y/(s/1e3),-m,m),I=Math.abs(M)/(x*y);return{easing:d.easing,duration:1e3*I,amount:M*(I/2)}}class Pi extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,d,m,y={}){const x=C.mousePos(d.getCanvas(),m),M=d.unproject(x);super(s,l.e({point:x,lngLat:M,originalEvent:m},y)),this._defaultPrevented=!1,this.target=d}}class Yo extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,d,m){const y=s==="touchend"?m.changedTouches:m.touches,x=C.touchPos(d.getCanvasContainer(),y),M=x.map(O=>d.unproject(O)),I=x.reduce((O,N,V,F)=>O.add(N.div(F.length)),new l.P(0,0));super(s,{points:x,point:I,lngLats:M,lngLat:d.unproject(I),originalEvent:m}),this._defaultPrevented=!1}}class vm extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,d,m){super(s,{originalEvent:m}),this._defaultPrevented=!1}}class wm{constructor(s,d){this._map=s,this._clickTolerance=d.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new vm(s.type,this._map,s))}mousedown(s,d){return this._mousedownPos=d,this._firePreventable(new Pi(s.type,this._map,s))}mouseup(s){this._map.fire(new Pi(s.type,this._map,s))}click(s,d){this._mousedownPos&&this._mousedownPos.dist(d)>=this._clickTolerance||this._map.fire(new Pi(s.type,this._map,s))}dblclick(s){return this._firePreventable(new Pi(s.type,this._map,s))}mouseover(s){this._map.fire(new Pi(s.type,this._map,s))}mouseout(s){this._map.fire(new Pi(s.type,this._map,s))}touchstart(s){return this._firePreventable(new Yo(s.type,this._map,s))}touchmove(s){this._map.fire(new Yo(s.type,this._map,s))}touchend(s){this._map.fire(new Yo(s.type,this._map,s))}touchcancel(s){this._map.fire(new Yo(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Qn{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new Pi(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Pi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new Pi(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class es{constructor(s){this._map=s}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(s){return this.transform.pointLocation(l.P.convert(s),this._map.terrain)}}class _r{constructor(s,d){this._map=s,this._tr=new es(s),this._el=s.getCanvasContainer(),this._container=s.getContainer(),this._clickTolerance=d.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(s,d){this.isEnabled()&&s.shiftKey&&s.button===0&&(C.disableDrag(),this._startPos=this._lastPos=d,this._active=!0)}mousemoveWindow(s,d){if(!this._active)return;const m=d;if(this._lastPos.equals(m)||!this._box&&m.dist(this._startPos)<this._clickTolerance)return;const y=this._startPos;this._lastPos=m,this._box||(this._box=C.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",s));const x=Math.min(y.x,m.x),M=Math.max(y.x,m.x),I=Math.min(y.y,m.y),O=Math.max(y.y,m.y);C.setTransform(this._box,`translate(${x}px,${I}px)`),this._box.style.width=M-x+"px",this._box.style.height=O-I+"px"}mouseupWindow(s,d){if(!this._active||s.button!==0)return;const m=this._startPos,y=d;if(this.reset(),C.suppressClick(),m.x!==y.x||m.y!==y.y)return this._map.fire(new l.k("boxzoomend",{originalEvent:s})),{cameraAnimation:x=>x.fitScreenCoordinates(m,y,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",s)}keydown(s){this._active&&s.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",s))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(C.remove(this._box),this._box=null),C.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,d){return this._map.fire(new l.k(s,{originalEvent:d}))}}function Kl(v,s){if(v.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${v.length}, points ${s.length}`);const d={};for(let m=0;m<v.length;m++)d[v[m].identifier]=s[m];return d}class vd{constructor(s){this.reset(),this.numTouches=s.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(s,d,m){(this.centroid||m.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),m.length===this.numTouches&&(this.centroid=function(y){const x=new l.P(0,0);for(const M of y)x._add(M);return x.div(y.length)}(d),this.touches=Kl(m,d)))}touchmove(s,d,m){if(this.aborted||!this.centroid)return;const y=Kl(m,d);for(const x in this.touches){const M=y[x];(!M||M.dist(this.touches[x])>30)&&(this.aborted=!0)}}touchend(s,d,m){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),m.length===0){const y=!this.aborted&&this.centroid;if(this.reset(),y)return y}}}class wu{constructor(s){this.singleTap=new vd(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(s,d,m){this.singleTap.touchstart(s,d,m)}touchmove(s,d,m){this.singleTap.touchmove(s,d,m)}touchend(s,d,m){const y=this.singleTap.touchend(s,d,m);if(y){const x=s.timeStamp-this.lastTime<500,M=!this.lastTap||this.lastTap.dist(y)<30;if(x&&M||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=y,this.count===this.numTaps)return this.reset(),y}}}class Ua{constructor(s){this._tr=new es(s),this._zoomIn=new wu({numTouches:1,numTaps:2}),this._zoomOut=new wu({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,d,m){this._zoomIn.touchstart(s,d,m),this._zoomOut.touchstart(s,d,m)}touchmove(s,d,m){this._zoomIn.touchmove(s,d,m),this._zoomOut.touchmove(s,d,m)}touchend(s,d,m){const y=this._zoomIn.touchend(s,d,m),x=this._zoomOut.touchend(s,d,m),M=this._tr;return y?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:M.zoom+1,around:M.unproject(y)},{originalEvent:s})}):x?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:M.zoom-1,around:M.unproject(x)},{originalEvent:s})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qs{constructor(s){this._enabled=!!s.enable,this._moveStateManager=s.moveStateManager,this._clickTolerance=s.clickTolerance||1,this._moveFunction=s.move,this._activateOnStart=!!s.activateOnStart,s.assignEvents(this),this.reset()}reset(s){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(s)}_move(...s){const d=this._moveFunction(...s);if(d.bearingDelta||d.pitchDelta||d.around||d.panDelta)return this._active=!0,d}dragStart(s,d){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(s)&&(this._moveStateManager.startMove(s),this._lastPoint=d.length?d[0]:d,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(s,d){if(!this.isEnabled())return;const m=this._lastPoint;if(!m)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);const y=d.length?d[0]:d;return!this._moved&&y.dist(m)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=y,this._move(m,y))}dragEnd(s){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(s)&&(this._moved&&C.suppressClick(),this.reset(s))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const wd={0:1,2:2};class ku{constructor(s){this._correctEvent=s.checkCorrectEvent}startMove(s){const d=C.mouseButton(s);this._eventButton=d}endMove(s){delete this._eventButton}isValidStartEvent(s){return this._correctEvent(s)}isValidMoveEvent(s){return!function(d,m){const y=wd[m];return d.buttons===void 0||(d.buttons&y)!==y}(s,this._eventButton)}isValidEndEvent(s){return C.mouseButton(s)===this._eventButton}}class kd{constructor(){this._firstTouch=void 0}_isOneFingerTouch(s){return s.targetTouches.length===1}_isSameTouchEvent(s){return s.targetTouches[0].identifier===this._firstTouch}startMove(s){this._firstTouch=s.targetTouches[0].identifier}endMove(s){delete this._firstTouch}isValidStartEvent(s){return this._isOneFingerTouch(s)}isValidMoveEvent(s){return this._isOneFingerTouch(s)&&this._isSameTouchEvent(s)}isValidEndEvent(s){return this._isOneFingerTouch(s)&&this._isSameTouchEvent(s)}}const Su=v=>{v.mousedown=v.dragStart,v.mousemoveWindow=v.dragMove,v.mouseup=v.dragEnd,v.contextmenu=s=>{s.preventDefault()}},Sd=({enable:v,clickTolerance:s,bearingDegreesPerPixelMoved:d=.8})=>{const m=new ku({checkCorrectEvent:y=>C.mouseButton(y)===0&&y.ctrlKey||C.mouseButton(y)===2});return new qs({clickTolerance:s,move:(y,x)=>({bearingDelta:(x.x-y.x)*d}),moveStateManager:m,enable:v,assignEvents:Su})},Ed=({enable:v,clickTolerance:s,pitchDegreesPerPixelMoved:d=-.5})=>{const m=new ku({checkCorrectEvent:y=>C.mouseButton(y)===0&&y.ctrlKey||C.mouseButton(y)===2});return new qs({clickTolerance:s,move:(y,x)=>({pitchDelta:(x.y-y.y)*d}),moveStateManager:m,enable:v,assignEvents:Su})};class Xo{constructor(s,d){this._clickTolerance=s.clickTolerance||1,this._map=d,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.P(0,0)}_shouldBePrevented(s){return s<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(s,d,m){return this._calculateTransform(s,d,m)}touchmove(s,d,m){if(this._active){if(!this._shouldBePrevented(m.length))return s.preventDefault(),this._calculateTransform(s,d,m);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",s)}}touchend(s,d,m){this._calculateTransform(s,d,m),this._active&&this._shouldBePrevented(m.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(s,d,m){m.length>0&&(this._active=!0);const y=Kl(m,d),x=new l.P(0,0),M=new l.P(0,0);let I=0;for(const N in y){const V=y[N],F=this._touches[N];F&&(x._add(V),M._add(V.sub(F)),I++,y[N]=V)}if(this._touches=y,this._shouldBePrevented(I)||!M.mag())return;const O=M.div(I);return this._sum._add(O),this._sum.mag()<this._clickTolerance?void 0:{around:x.div(I),panDelta:O}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Eu{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(s,d,m){this._firstTwoTouches||m.length<2||(this._firstTwoTouches=[m[0].identifier,m[1].identifier],this._start([d[0],d[1]]))}touchmove(s,d,m){if(!this._firstTwoTouches)return;s.preventDefault();const[y,x]=this._firstTwoTouches,M=Jl(m,d,y),I=Jl(m,d,x);if(!M||!I)return;const O=this._aroundCenter?null:M.add(I).div(2);return this._move([M,I],O,s)}touchend(s,d,m){if(!this._firstTwoTouches)return;const[y,x]=this._firstTwoTouches,M=Jl(m,d,y),I=Jl(m,d,x);M&&I||(this._active&&C.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(s){this._enabled=!0,this._aroundCenter=!!s&&s.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Jl(v,s,d){for(let m=0;m<v.length;m++)if(v[m].identifier===d)return s[m]}function Cd(v,s){return Math.log(v/s)/Math.LN2}class Td extends Eu{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(s){this._startDistance=this._distance=s[0].dist(s[1])}_move(s,d){const m=this._distance;if(this._distance=s[0].dist(s[1]),this._active||!(Math.abs(Cd(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Cd(this._distance,m),pinchAround:d}}}function Md(v,s){return 180*v.angleWith(s)/Math.PI}class Ad extends Eu{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(s){this._startVector=this._vector=s[0].sub(s[1]),this._minDiameter=s[0].dist(s[1])}_move(s,d,m){const y=this._vector;if(this._vector=s[0].sub(s[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Md(this._vector,y),pinchAround:d}}_isBelowThreshold(s){this._minDiameter=Math.min(this._minDiameter,s.mag());const d=25/(Math.PI*this._minDiameter)*360,m=Md(s,this._startVector);return Math.abs(m)<d}}function Cu(v){return Math.abs(v.y)>Math.abs(v.x)}class Ha extends Eu{constructor(s){super(),this._currentTouchCount=0,this._map=s}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(s,d,m){super.touchstart(s,d,m),this._currentTouchCount=m.length}_start(s){this._lastPoints=s,Cu(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,d,m){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const y=s[0].sub(this._lastPoints[0]),x=s[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(y,x,m.timeStamp),this._valid?(this._lastPoints=s,this._active=!0,{pitchDelta:(y.y+x.y)/2*-.5}):void 0}gestureBeginsVertically(s,d,m){if(this._valid!==void 0)return this._valid;const y=s.mag()>=2,x=d.mag()>=2;if(!y&&!x)return;if(!y||!x)return this._firstMove===void 0&&(this._firstMove=m),m-this._firstMove<100&&void 0;const M=s.y>0==d.y>0;return Cu(s)&&Cu(d)&&M}}const km={panStep:100,bearingStep:15,pitchStep:10};class Lr{constructor(s){this._tr=new es(s);const d=km;this._panStep=d.panStep,this._bearingStep=d.bearingStep,this._pitchStep=d.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(s){if(s.altKey||s.ctrlKey||s.metaKey)return;let d=0,m=0,y=0,x=0,M=0;switch(s.keyCode){case 61:case 107:case 171:case 187:d=1;break;case 189:case 109:case 173:d=-1;break;case 37:s.shiftKey?m=-1:(s.preventDefault(),x=-1);break;case 39:s.shiftKey?m=1:(s.preventDefault(),x=1);break;case 38:s.shiftKey?y=1:(s.preventDefault(),M=-1);break;case 40:s.shiftKey?y=-1:(s.preventDefault(),M=1);break;default:return}return this._rotationDisabled&&(m=0,y=0),{cameraAnimation:I=>{const O=this._tr;I.easeTo({duration:300,easeId:"keyboardHandler",easing:As,zoom:d?Math.round(O.zoom)+d*(s.shiftKey?2:1):O.zoom,bearing:O.bearing+m*this._bearingStep,pitch:O.pitch+y*this._pitchStep,offset:[-x*this._panStep,-M*this._panStep],center:O.center},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function As(v){return v*(2-v)}const Id=4.000244140625;class ts{constructor(s,d){this._onTimeout=m=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(m)},this._map=s,this._tr=new es(s),this._triggerRenderFrame=d,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(s){this._defaultZoomRate=s}setWheelZoomRate(s){this._wheelZoomRate=s}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(s){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!s&&s.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(s){return!!this._map.cooperativeGestures.isEnabled()&&!(s.ctrlKey||this._map.cooperativeGestures.isBypassed(s))}wheel(s){if(!this.isEnabled())return;if(this._shouldBePrevented(s))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",s);let d=s.deltaMode===WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const m=E.now(),y=m-(this._lastWheelEventTime||0);this._lastWheelEventTime=m,d!==0&&d%Id==0?this._type="wheel":d!==0&&Math.abs(d)<4?this._type="trackpad":y>400?(this._type=null,this._lastValue=d,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(y*d)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,d+=this._lastValue)),s.shiftKey&&d&&(d/=4),this._type&&(this._lastWheelEvent=s,this._delta-=d,this._active||this._start(s)),s.preventDefault()}_start(s){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const d=C.mousePos(this._map.getCanvas(),s),m=this._tr;this._around=d.y>m.transform.height/2-m.transform.getHorizon()?l.N.convert(this._aroundCenter?m.center:m.unproject(d)):l.N.convert(m.center),this._aroundPoint=m.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const s=this._tr.transform;if(this._delta!==0){const O=this._type==="wheel"&&Math.abs(this._delta)>Id?this._wheelZoomRate:this._defaultZoomRate;let N=2/(1+Math.exp(-Math.abs(this._delta*O)));this._delta<0&&N!==0&&(N=1/N);const V=typeof this._targetZoom=="number"?s.zoomScale(this._targetZoom):s.scale;this._targetZoom=Math.min(s.maxZoom,Math.max(s.minZoom,s.scaleZoom(V*N))),this._type==="wheel"&&(this._startZoom=s.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const d=typeof this._targetZoom=="number"?this._targetZoom:s.zoom,m=this._startZoom,y=this._easing;let x,M=!1;const I=E.now()-this._lastWheelEventTime;if(this._type==="wheel"&&m&&y&&I){const O=Math.min(I/200,1),N=y(O);x=l.y.number(m,d,N),O<1?this._frameId||(this._frameId=!0):M=!0}else x=d,M=!0;return this._active=!0,M&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!M,zoomDelta:x-s.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let d=l.b9;if(this._prevEase){const m=this._prevEase,y=(E.now()-m.start)/m.duration,x=m.easing(y+.01)-m.easing(y),M=.27/Math.sqrt(x*x+1e-4)*.01,I=Math.sqrt(.0729-M*M);d=l.b8(M,I,.25,1)}return this._prevEase={start:E.now(),duration:s,easing:d},d}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ko{constructor(s,d){this._clickZoom=s,this._tapZoom=d}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class b_{constructor(s){this._tr=new es(s),this.reset()}reset(){this._active=!1}dblclick(s,d){return s.preventDefault(),{cameraAnimation:m=>{m.easeTo({duration:300,zoom:this._tr.zoom+(s.shiftKey?-1:1),around:this._tr.unproject(d)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class x_{constructor(){this._tap=new wu({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(s,d,m){if(!this._swipePoint)if(this._tapTime){const y=d[0],x=s.timeStamp-this._tapTime<500,M=this._tapPoint.dist(y)<30;x&&M?m.length>0&&(this._swipePoint=y,this._swipeTouch=m[0].identifier):this.reset()}else this._tap.touchstart(s,d,m)}touchmove(s,d,m){if(this._tapTime){if(this._swipePoint){if(m[0].identifier!==this._swipeTouch)return;const y=d[0],x=y.y-this._swipePoint.y;return this._swipePoint=y,s.preventDefault(),this._active=!0,{zoomDelta:x/128}}}else this._tap.touchmove(s,d,m)}touchend(s,d,m){if(this._tapTime)this._swipePoint&&m.length===0&&this.reset();else{const y=this._tap.touchend(s,d,m);y&&(this._tapTime=s.timeStamp,this._tapPoint=y)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Sm{constructor(s,d,m){this._el=s,this._mousePan=d,this._touchPan=m}enable(s){this._inertiaOptions=s||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Em{constructor(s,d,m){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=d,this._mousePitch=m}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Pd{constructor(s,d,m,y){this._el=s,this._touchZoom=d,this._touchRotate=m,this._tapDragZoom=y,this._rotationDisabled=!1,this._enabled=!0}enable(s){this._touchZoom.enable(s),this._rotationDisabled||this._touchRotate.enable(s),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class qa{constructor(s,d){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=s,this._options=d,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const s=this._map.getCanvasContainer();s.classList.add("maplibregl-cooperative-gestures"),this._container=C.create("div","maplibregl-cooperative-gesture-screen",s);let d=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(d=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const m=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),y=document.createElement("div");y.className="maplibregl-desktop-message",y.textContent=d,this._container.appendChild(y);const x=document.createElement("div");x.className="maplibregl-mobile-message",x.textContent=m,this._container.appendChild(x),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(C.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(s){return s[this._bypassKey]}notifyGestureBlocked(s,d){this._enabled&&(this._map.fire(new l.k("cooperativegestureprevented",{gestureType:s,originalEvent:d})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Vr=v=>v.zoom||v.drag||v.pitch||v.rotate;class lt extends l.k{}function Tu(v){return v.panDelta&&v.panDelta.mag()||v.zoomDelta||v.bearingDelta||v.pitchDelta}class Dd{constructor(s,d){this.handleWindowEvent=y=>{this.handleEvent(y,`${y.type}Window`)},this.handleEvent=(y,x)=>{if(y.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const M=y.type==="renderFrame"?void 0:y,I={needsRenderFrame:!1},O={},N={},V=y.touches,F=V?this._getMapTouches(V):void 0,G=F?C.touchPos(this._map.getCanvas(),F):C.mousePos(this._map.getCanvas(),y);for(const{handlerName:re,handler:ae,allowed:ce}of this._handlers){if(!ae.isEnabled())continue;let he;this._blockedByActive(N,ce,re)?ae.reset():ae[x||y.type]&&(he=ae[x||y.type](y,G,F),this.mergeHandlerResult(I,O,he,re,M),he&&he.needsRenderFrame&&this._triggerRenderFrame()),(he||ae.isActive())&&(N[re]=ae)}const K={};for(const re in this._previousActiveHandlers)N[re]||(K[re]=M);this._previousActiveHandlers=N,(Object.keys(K).length||Tu(I))&&(this._changes.push([I,O,K]),this._triggerRenderFrame()),(Object.keys(N).length||Tu(I))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:Q}=I;Q&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],Q(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new xd(s),this._bearingSnap=d.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(d);const m=this._el;this._listeners=[[m,"touchstart",{passive:!0}],[m,"touchmove",{passive:!1}],[m,"touchend",void 0],[m,"touchcancel",void 0],[m,"mousedown",void 0],[m,"mousemove",void 0],[m,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[m,"mouseover",void 0],[m,"mouseout",void 0],[m,"dblclick",void 0],[m,"click",void 0],[m,"keydown",{capture:!1}],[m,"keyup",void 0],[m,"wheel",{passive:!1}],[m,"contextmenu",void 0],[window,"blur",void 0]];for(const[y,x,M]of this._listeners)C.addEventListener(y,x,y===document?this.handleWindowEvent:this.handleEvent,M)}destroy(){for(const[s,d,m]of this._listeners)C.removeEventListener(s,d,s===document?this.handleWindowEvent:this.handleEvent,m)}_addDefaultHandlers(s){const d=this._map,m=d.getCanvasContainer();this._add("mapEvent",new wm(d,s));const y=d.boxZoom=new _r(d,s);this._add("boxZoom",y),s.interactive&&s.boxZoom&&y.enable();const x=d.cooperativeGestures=new qa(d,s.cooperativeGestures);this._add("cooperativeGestures",x),s.cooperativeGestures&&x.enable();const M=new Ua(d),I=new b_(d);d.doubleClickZoom=new Ko(I,M),this._add("tapZoom",M),this._add("clickZoom",I),s.interactive&&s.doubleClickZoom&&d.doubleClickZoom.enable();const O=new x_;this._add("tapDragZoom",O);const N=d.touchPitch=new Ha(d);this._add("touchPitch",N),s.interactive&&s.touchPitch&&d.touchPitch.enable(s.touchPitch);const V=Sd(s),F=Ed(s);d.dragRotate=new Em(s,V,F),this._add("mouseRotate",V,["mousePitch"]),this._add("mousePitch",F,["mouseRotate"]),s.interactive&&s.dragRotate&&d.dragRotate.enable();const G=(({enable:he,clickTolerance:te})=>{const me=new ku({checkCorrectEvent:ge=>C.mouseButton(ge)===0&&!ge.ctrlKey});return new qs({clickTolerance:te,move:(ge,ve)=>({around:ve,panDelta:ve.sub(ge)}),activateOnStart:!0,moveStateManager:me,enable:he,assignEvents:Su})})(s),K=new Xo(s,d);d.dragPan=new Sm(m,G,K),this._add("mousePan",G),this._add("touchPan",K,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&d.dragPan.enable(s.dragPan);const Q=new Ad,re=new Td;d.touchZoomRotate=new Pd(m,re,Q,O),this._add("touchRotate",Q,["touchPan","touchZoom"]),this._add("touchZoom",re,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&d.touchZoomRotate.enable(s.touchZoomRotate);const ae=d.scrollZoom=new ts(d,()=>this._triggerRenderFrame());this._add("scrollZoom",ae,["mousePan"]),s.interactive&&s.scrollZoom&&d.scrollZoom.enable(s.scrollZoom);const ce=d.keyboard=new Lr(d);this._add("keyboard",ce),s.interactive&&s.keyboard&&d.keyboard.enable(),this._add("blockableMapEvent",new Qn(d))}_add(s,d,m){this._handlers.push({handlerName:s,handler:d,allowed:m}),this._handlersById[s]=d}stop(s){if(!this._updatingCamera){for(const{handler:d}of this._handlers)d.reset();this._inertia.clear(),this._fireEvents({},{},s),this._changes=[]}}isActive(){for(const{handler:s}of this._handlers)if(s.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Vr(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,d,m){for(const y in s)if(y!==m&&(!d||d.indexOf(y)<0))return!0;return!1}_getMapTouches(s){const d=[];for(const m of s)this._el.contains(m.target)&&d.push(m);return d}mergeHandlerResult(s,d,m,y,x){if(!m)return;l.e(s,m);const M={handlerName:y,originalEvent:m.originalEvent||x};m.zoomDelta!==void 0&&(d.zoom=M),m.panDelta!==void 0&&(d.drag=M),m.pitchDelta!==void 0&&(d.pitch=M),m.bearingDelta!==void 0&&(d.rotate=M)}_applyChanges(){const s={},d={},m={};for(const[y,x,M]of this._changes)y.panDelta&&(s.panDelta=(s.panDelta||new l.P(0,0))._add(y.panDelta)),y.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+y.zoomDelta),y.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+y.bearingDelta),y.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+y.pitchDelta),y.around!==void 0&&(s.around=y.around),y.pinchAround!==void 0&&(s.pinchAround=y.pinchAround),y.noInertia&&(s.noInertia=y.noInertia),l.e(d,x),l.e(m,M);this._updateMapTransform(s,d,m),this._changes=[]}_updateMapTransform(s,d,m){const y=this._map,x=y._getTransformForUpdate(),M=y.terrain;if(!(Tu(s)||M&&this._terrainMovement))return this._fireEvents(d,m,!0);let{panDelta:I,zoomDelta:O,bearingDelta:N,pitchDelta:V,around:F,pinchAround:G}=s;G!==void 0&&(F=G),y._stop(!0),F=F||y.transform.centerPoint;const K=x.pointLocation(I?F.sub(I):F);N&&(x.bearing+=N),V&&(x.pitch+=V),O&&(x.zoom+=O),M?this._terrainMovement||!d.drag&&!d.zoom?d.drag&&this._terrainMovement?x.center=x.pointLocation(x.centerPoint.sub(I)):x.setLocationAtPoint(K,F):(this._terrainMovement=!0,this._map._elevationFreeze=!0,x.setLocationAtPoint(K,F)):x.setLocationAtPoint(K,F),y._applyUpdatedTransform(x),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(d,m,!0)}_fireEvents(s,d,m){const y=Vr(this._eventsInProgress),x=Vr(s),M={};for(const F in s){const{originalEvent:G}=s[F];this._eventsInProgress[F]||(M[`${F}start`]=G),this._eventsInProgress[F]=s[F]}!y&&x&&this._fireEvent("movestart",x.originalEvent);for(const F in M)this._fireEvent(F,M[F]);x&&this._fireEvent("move",x.originalEvent);for(const F in s){const{originalEvent:G}=s[F];this._fireEvent(F,G)}const I={};let O;for(const F in this._eventsInProgress){const{handlerName:G,originalEvent:K}=this._eventsInProgress[F];this._handlersById[G].isActive()||(delete this._eventsInProgress[F],O=d[G]||K,I[`${F}end`]=O)}for(const F in I)this._fireEvent(F,I[F]);const N=Vr(this._eventsInProgress),V=(y||x)&&!N;if(V&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const F=this._map._getTransformForUpdate();F.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(F)}if(m&&V){this._updatingCamera=!0;const F=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),G=K=>K!==0&&-this._bearingSnap<K&&K<this._bearingSnap;!F||!F.essential&&E.prefersReducedMotion?(this._map.fire(new l.k("moveend",{originalEvent:O})),G(this._map.getBearing())&&this._map.resetNorth()):(G(F.bearing||this._map.getBearing())&&(F.bearing=0),F.freezeElevation=!0,this._map.easeTo(F,{originalEvent:O})),this._updatingCamera=!1}}_fireEvent(s,d){this._map.fire(new l.k(s,d?{originalEvent:d}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(s=>{delete this._frameId,this.handleEvent(new lt("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Cm extends l.E{constructor(s,d){super(),this._renderFrameCallback=()=>{const m=Math.min((E.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(m)),m<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=s,this._bearingSnap=d.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new l.N(this.transform.center.lng,this.transform.center.lat)}setCenter(s,d){return this.jumpTo({center:s},d)}panBy(s,d,m){return s=l.P.convert(s).mult(-1),this.panTo(this.transform.center,l.e({offset:s},d),m)}panTo(s,d,m){return this.easeTo(l.e({center:s},d),m)}getZoom(){return this.transform.zoom}setZoom(s,d){return this.jumpTo({zoom:s},d),this}zoomTo(s,d,m){return this.easeTo(l.e({zoom:s},d),m)}zoomIn(s,d){return this.zoomTo(this.getZoom()+1,s,d),this}zoomOut(s,d){return this.zoomTo(this.getZoom()-1,s,d),this}getBearing(){return this.transform.bearing}setBearing(s,d){return this.jumpTo({bearing:s},d),this}getPadding(){return this.transform.padding}setPadding(s,d){return this.jumpTo({padding:s},d),this}rotateTo(s,d,m){return this.easeTo(l.e({bearing:s},d),m)}resetNorth(s,d){return this.rotateTo(0,l.e({duration:1e3},s),d),this}resetNorthPitch(s,d){return this.easeTo(l.e({bearing:0,pitch:0,duration:1e3},s),d),this}snapToNorth(s,d){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(s,d):this}getPitch(){return this.transform.pitch}setPitch(s,d){return this.jumpTo({pitch:s},d),this}cameraForBounds(s,d){s=we.convert(s).adjustAntiMeridian();const m=d&&d.bearing||0;return this._cameraForBoxAndBearing(s.getNorthWest(),s.getSouthEast(),m,d)}_cameraForBoxAndBearing(s,d,m,y){const x={top:0,bottom:0,right:0,left:0};if(typeof(y=l.e({padding:x,offset:[0,0],maxZoom:this.transform.maxZoom},y)).padding=="number"){const Ge=y.padding;y.padding={top:Ge,bottom:Ge,right:Ge,left:Ge}}y.padding=l.e(x,y.padding);const M=this.transform,I=M.padding,O=new we(s,d),N=M.project(O.getNorthWest()),V=M.project(O.getNorthEast()),F=M.project(O.getSouthEast()),G=M.project(O.getSouthWest()),K=l.ba(-m),Q=N.rotate(K),re=V.rotate(K),ae=F.rotate(K),ce=G.rotate(K),he=new l.P(Math.max(Q.x,re.x,ce.x,ae.x),Math.max(Q.y,re.y,ce.y,ae.y)),te=new l.P(Math.min(Q.x,re.x,ce.x,ae.x),Math.min(Q.y,re.y,ce.y,ae.y)),me=he.sub(te),ge=(M.width-(I.left+I.right+y.padding.left+y.padding.right))/me.x,ve=(M.height-(I.top+I.bottom+y.padding.top+y.padding.bottom))/me.y;if(ve<0||ge<0)return void l.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const ze=Math.min(M.scaleZoom(M.scale*Math.min(ge,ve)),y.maxZoom),Ve=l.P.convert(y.offset),Je=new l.P((y.padding.left-y.padding.right)/2,(y.padding.top-y.padding.bottom)/2).rotate(l.ba(m)),it=Ve.add(Je).mult(M.scale/M.zoomScale(ze));return{center:M.unproject(N.add(F).div(2).sub(it)),zoom:ze,bearing:m}}fitBounds(s,d,m){return this._fitInternal(this.cameraForBounds(s,d),d,m)}fitScreenCoordinates(s,d,m,y,x){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(l.P.convert(s)),this.transform.pointLocation(l.P.convert(d)),m,y),y,x)}_fitInternal(s,d,m){return s?(delete(d=l.e(s,d)).padding,d.linear?this.easeTo(d,m):this.flyTo(d,m)):this}jumpTo(s,d){this.stop();const m=this._getTransformForUpdate();let y=!1,x=!1,M=!1;return"zoom"in s&&m.zoom!==+s.zoom&&(y=!0,m.zoom=+s.zoom),s.center!==void 0&&(m.center=l.N.convert(s.center)),"bearing"in s&&m.bearing!==+s.bearing&&(x=!0,m.bearing=+s.bearing),"pitch"in s&&m.pitch!==+s.pitch&&(M=!0,m.pitch=+s.pitch),s.padding==null||m.isPaddingEqual(s.padding)||(m.padding=s.padding),this._applyUpdatedTransform(m),this.fire(new l.k("movestart",d)).fire(new l.k("move",d)),y&&this.fire(new l.k("zoomstart",d)).fire(new l.k("zoom",d)).fire(new l.k("zoomend",d)),x&&this.fire(new l.k("rotatestart",d)).fire(new l.k("rotate",d)).fire(new l.k("rotateend",d)),M&&this.fire(new l.k("pitchstart",d)).fire(new l.k("pitch",d)).fire(new l.k("pitchend",d)),this.fire(new l.k("moveend",d))}calculateCameraOptionsFromTo(s,d,m,y=0){const x=l.Z.fromLngLat(s,d),M=l.Z.fromLngLat(m,y),I=M.x-x.x,O=M.y-x.y,N=M.z-x.z,V=Math.hypot(I,O,N);if(V===0)throw new Error("Can't calculate camera options with same From and To");const F=Math.hypot(I,O),G=this.transform.scaleZoom(this.transform.cameraToCenterDistance/V/this.transform.tileSize),K=180*Math.atan2(I,-O)/Math.PI;let Q=180*Math.acos(F/V)/Math.PI;return Q=N<0?90-Q:90+Q,{center:M.toLngLat(),zoom:G,pitch:Q,bearing:K}}easeTo(s,d){var m;this._stop(!1,s.easeId),((s=l.e({offset:[0,0],duration:500,easing:l.b9},s)).animate===!1||!s.essential&&E.prefersReducedMotion)&&(s.duration=0);const y=this._getTransformForUpdate(),x=y.zoom,M=y.bearing,I=y.pitch,O=y.padding,N="bearing"in s?this._normalizeBearing(s.bearing,M):M,V="pitch"in s?+s.pitch:I,F="padding"in s?s.padding:y.padding,G=l.P.convert(s.offset);let K=y.centerPoint.add(G);const Q=y.pointLocation(K),{center:re,zoom:ae}=y.getConstrained(l.N.convert(s.center||Q),(m=s.zoom)!==null&&m!==void 0?m:x);this._normalizeCenter(re,y);const ce=y.project(Q),he=y.project(re).sub(ce),te=y.zoomScale(ae-x);let me,ge;s.around&&(me=l.N.convert(s.around),ge=y.locationPoint(me));const ve={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||ae!==x,this._rotating=this._rotating||M!==N,this._pitching=this._pitching||V!==I,this._padding=!y.isPaddingEqual(F),this._easeId=s.easeId,this._prepareEase(d,s.noMoveStart,ve),this.terrain&&this._prepareElevation(re),this._ease(ze=>{if(this._zooming&&(y.zoom=l.y.number(x,ae,ze)),this._rotating&&(y.bearing=l.y.number(M,N,ze)),this._pitching&&(y.pitch=l.y.number(I,V,ze)),this._padding&&(y.interpolatePadding(O,F,ze),K=y.centerPoint.add(G)),this.terrain&&!s.freezeElevation&&this._updateElevation(ze),me)y.setLocationAtPoint(me,ge);else{const Ve=y.zoomScale(y.zoom-x),Je=ae>x?Math.min(2,te):Math.max(.5,te),it=Math.pow(Je,1-ze),Ge=y.unproject(ce.add(he.mult(ze*it)).mult(Ve));y.setLocationAtPoint(y.renderWorldCopies?Ge.wrap():Ge,K)}this._applyUpdatedTransform(y),this._fireMoveEvents(d)},ze=>{this.terrain&&s.freezeElevation&&this._finalizeElevation(),this._afterEase(d,ze)},s),this}_prepareEase(s,d,m={}){this._moving=!0,d||m.moving||this.fire(new l.k("movestart",s)),this._zooming&&!m.zooming&&this.fire(new l.k("zoomstart",s)),this._rotating&&!m.rotating&&this.fire(new l.k("rotatestart",s)),this._pitching&&!m.pitching&&this.fire(new l.k("pitchstart",s))}_prepareElevation(s){this._elevationCenter=s,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(s){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const d=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(s<1&&d!==this._elevationTarget){const m=this._elevationTarget-this._elevationStart;this._elevationStart+=s*(m-(d-(m*s+this._elevationStart))/(1-s)),this._elevationTarget=d}this.transform.elevation=l.y.number(this._elevationStart,this._elevationTarget,s)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(s){const d=s.getCameraPosition(),m=this.terrain.getElevationForLngLatZoom(d.lngLat,s.zoom);if(d.altitude<m){const y=this.calculateCameraOptionsFromTo(d.lngLat,m,s.center,s.elevation);return{pitch:y.pitch,zoom:y.zoom}}return{}}_applyUpdatedTransform(s){const d=[];if(this.terrain&&d.push(y=>this._elevateCameraIfInsideTerrain(y)),this.transformCameraUpdate&&d.push(y=>this.transformCameraUpdate(y)),!d.length)return;const m=s.clone();for(const y of d){const x=m.clone(),{center:M,zoom:I,pitch:O,bearing:N,elevation:V}=y(x);M&&(x.center=M),I!==void 0&&(x.zoom=I),O!==void 0&&(x.pitch=O),N!==void 0&&(x.bearing=N),V!==void 0&&(x.elevation=V),m.apply(x)}this.transform.apply(m)}_fireMoveEvents(s){this.fire(new l.k("move",s)),this._zooming&&this.fire(new l.k("zoom",s)),this._rotating&&this.fire(new l.k("rotate",s)),this._pitching&&this.fire(new l.k("pitch",s))}_afterEase(s,d){if(this._easeId&&d&&this._easeId===d)return;delete this._easeId;const m=this._zooming,y=this._rotating,x=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,m&&this.fire(new l.k("zoomend",s)),y&&this.fire(new l.k("rotateend",s)),x&&this.fire(new l.k("pitchend",s)),this.fire(new l.k("moveend",s))}flyTo(s,d){var m;if(!s.essential&&E.prefersReducedMotion){const tt=l.M(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(tt,d)}this.stop(),s=l.e({offset:[0,0],speed:1.2,curve:1.42,easing:l.b9},s);const y=this._getTransformForUpdate(),x=y.zoom,M=y.bearing,I=y.pitch,O=y.padding,N="bearing"in s?this._normalizeBearing(s.bearing,M):M,V="pitch"in s?+s.pitch:I,F="padding"in s?s.padding:y.padding,G=l.P.convert(s.offset);let K=y.centerPoint.add(G);const Q=y.pointLocation(K),{center:re,zoom:ae}=y.getConstrained(l.N.convert(s.center||Q),(m=s.zoom)!==null&&m!==void 0?m:x);this._normalizeCenter(re,y);const ce=y.zoomScale(ae-x),he=y.project(Q),te=y.project(re).sub(he);let me=s.curve;const ge=Math.max(y.width,y.height),ve=ge/ce,ze=te.mag();if("minZoom"in s){const tt=l.ac(Math.min(s.minZoom,x,ae),y.minZoom,y.maxZoom),It=ge/y.zoomScale(tt-x);me=Math.sqrt(It/ze*2)}const Ve=me*me;function Je(tt){const It=(ve*ve-ge*ge+(tt?-1:1)*Ve*Ve*ze*ze)/(2*(tt?ve:ge)*Ve*ze);return Math.log(Math.sqrt(It*It+1)-It)}function it(tt){return(Math.exp(tt)-Math.exp(-tt))/2}function Ge(tt){return(Math.exp(tt)+Math.exp(-tt))/2}const qe=Je(!1);let mt=function(tt){return Ge(qe)/Ge(qe+me*tt)},Dt=function(tt){return ge*((Ge(qe)*(it(It=qe+me*tt)/Ge(It))-it(qe))/Ve)/ze;var It},Ye=(Je(!0)-qe)/me;if(Math.abs(ze)<1e-6||!isFinite(Ye)){if(Math.abs(ge-ve)<1e-6)return this.easeTo(s,d);const tt=ve<ge?-1:1;Ye=Math.abs(Math.log(ve/ge))/me,Dt=()=>0,mt=It=>Math.exp(tt*me*It)}return s.duration="duration"in s?+s.duration:1e3*Ye/("screenSpeed"in s?+s.screenSpeed/me:+s.speed),s.maxDuration&&s.duration>s.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=M!==N,this._pitching=V!==I,this._padding=!y.isPaddingEqual(F),this._prepareEase(d,!1),this.terrain&&this._prepareElevation(re),this._ease(tt=>{const It=tt*Ye,Fn=1/mt(It);y.zoom=tt===1?ae:x+y.scaleZoom(Fn),this._rotating&&(y.bearing=l.y.number(M,N,tt)),this._pitching&&(y.pitch=l.y.number(I,V,tt)),this._padding&&(y.interpolatePadding(O,F,tt),K=y.centerPoint.add(G)),this.terrain&&!s.freezeElevation&&this._updateElevation(tt);const Lt=tt===1?re:y.unproject(he.add(te.mult(Dt(It))).mult(Fn));y.setLocationAtPoint(y.renderWorldCopies?Lt.wrap():Lt,K),this._applyUpdatedTransform(y),this._fireMoveEvents(d)},()=>{this.terrain&&s.freezeElevation&&this._finalizeElevation(),this._afterEase(d)},s),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(s,d){var m;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const y=this._onEaseEnd;delete this._onEaseEnd,y.call(this,d)}return s||(m=this.handlers)===null||m===void 0||m.stop(!1),this}_ease(s,d,m){m.animate===!1||m.duration===0?(s(1),d()):(this._easeStart=E.now(),this._easeOptions=m,this._onEaseFrame=s,this._onEaseEnd=d,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(s,d){s=l.b3(s,-180,180);const m=Math.abs(s-d);return Math.abs(s-360-d)<m&&(s-=360),Math.abs(s+360-d)<m&&(s+=360),s}_normalizeCenter(s,d){if(!d.renderWorldCopies||d.lngRange)return;const m=s.lng-d.center.lng;s.lng+=m>180?-360:m<-180?360:0}queryTerrainElevation(s){return this.terrain?this.terrain.getElevationForLngLatZoom(l.N.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}const Wa={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Ga{constructor(s=Wa){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=d=>{!d||d.sourceDataType!=="metadata"&&d.sourceDataType!=="visibility"&&d.dataType!=="style"&&d.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=s}getDefaultPosition(){return"bottom-right"}onAdd(s){return this._map=s,this._compact=this.options.compact,this._container=C.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=C.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=C.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){C.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(s,d){const m=this._map._getUIString(`AttributionControl.${d}`);s.title=m,s.setAttribute("aria-label",m)}_updateAttributions(){if(!this._map.style)return;let s=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=s.concat(this.options.customAttribution.map(y=>typeof y!="string"?"":y)):typeof this.options.customAttribution=="string"&&s.push(this.options.customAttribution)),this._map.style.stylesheet){const y=this._map.style.stylesheet;this.styleOwner=y.owner,this.styleId=y.id}const d=this._map.style.sourceCaches;for(const y in d){const x=d[y];if(x.used||x.usedForTerrain){const M=x.getSource();M.attribution&&s.indexOf(M.attribution)<0&&s.push(M.attribution)}}s=s.filter(y=>String(y).trim()),s.sort((y,x)=>y.length-x.length),s=s.filter((y,x)=>{for(let M=x+1;M<s.length;M++)if(s[M].indexOf(y)>=0)return!1;return!0});const m=s.join(" | ");m!==this._attribHTML&&(this._attribHTML=m,s.length?(this._innerContainer.innerHTML=m,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Od{constructor(s={}){this._updateCompact=()=>{const d=this._container.children;if(d.length){const m=d[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&m.classList.add("maplibregl-compact"):m.classList.remove("maplibregl-compact")}},this.options=s}getDefaultPosition(){return"bottom-left"}onAdd(s){this._map=s,this._compact=this.options&&this.options.compact,this._container=C.create("div","maplibregl-ctrl");const d=C.create("a","maplibregl-ctrl-logo");return d.target="_blank",d.rel="noopener nofollow",d.href="https://maplibre.org/",d.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),d.setAttribute("rel","noopener nofollow"),this._container.appendChild(d),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){C.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class en{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(s){const d=++this._id;return this._queue.push({callback:s,id:d,cancelled:!1}),d}remove(s){const d=this._currentlyRunning,m=d?this._queue.concat(d):this._queue;for(const y of m)if(y.id===s)return void(y.cancelled=!0)}run(s=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const d=this._currentlyRunning=this._queue;this._queue=[];for(const m of d)if(!m.cancelled&&(m.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var zd=l.Y([{name:"a_pos3d",type:"Int16",components:3}]);class v_ extends l.E{constructor(s){super(),this.sourceCache=s,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,s.usedForTerrain=!0,s.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(s,d){this.sourceCache.update(s,d),this._renderableTilesKeys=[];const m={};for(const y of s.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:d}))m[y.key]=!0,this._renderableTilesKeys.push(y.key),this._tiles[y.key]||(y.posMatrix=new Float64Array(16),l.aP(y.posMatrix,0,l.X,0,l.X,0,1),this._tiles[y.key]=new Ts(y,this.tileSize));for(const y in this._tiles)m[y]||delete this._tiles[y]}freeRtt(s){for(const d in this._tiles){const m=this._tiles[d];(!s||m.tileID.equals(s)||m.tileID.isChildOf(s)||s.isChildOf(m.tileID))&&(m.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(s=>this.getTileByID(s))}getTileByID(s){return this._tiles[s]}getTerrainCoords(s){const d={};for(const m of this._renderableTilesKeys){const y=this._tiles[m].tileID;if(y.canonical.equals(s.canonical)){const x=s.clone();x.posMatrix=new Float64Array(16),l.aP(x.posMatrix,0,l.X,0,l.X,0,1),d[m]=x}else if(y.canonical.isChildOf(s.canonical)){const x=s.clone();x.posMatrix=new Float64Array(16);const M=y.canonical.z-s.canonical.z,I=y.canonical.x-(y.canonical.x>>M<<M),O=y.canonical.y-(y.canonical.y>>M<<M),N=l.X>>M;l.aP(x.posMatrix,0,N,0,N,0,1),l.J(x.posMatrix,x.posMatrix,[-I*N,-O*N,0]),d[m]=x}else if(s.canonical.isChildOf(y.canonical)){const x=s.clone();x.posMatrix=new Float64Array(16);const M=s.canonical.z-y.canonical.z,I=s.canonical.x-(s.canonical.x>>M<<M),O=s.canonical.y-(s.canonical.y>>M<<M),N=l.X>>M;l.aP(x.posMatrix,0,l.X,0,l.X,0,1),l.J(x.posMatrix,x.posMatrix,[I*N,O*N,0]),l.K(x.posMatrix,x.posMatrix,[1/2**M,1/2**M,0]),d[m]=x}}return d}getSourceTile(s,d){const m=this.sourceCache._source;let y=s.overscaledZ-this.deltaZoom;if(y>m.maxzoom&&(y=m.maxzoom),y<m.minzoom)return null;this._sourceTileCache[s.key]||(this._sourceTileCache[s.key]=s.scaledTo(y).key);let x=this.sourceCache.getTileByID(this._sourceTileCache[s.key]);if((!x||!x.dem)&&d)for(;y>=m.minzoom&&(!x||!x.dem);)x=this.sourceCache.getTileByID(s.scaledTo(y--).key);return x}tilesAfterTime(s=Date.now()){return Object.values(this._tiles).filter(d=>d.timeAdded>=s)}}class Bd{constructor(s,d,m){this.painter=s,this.sourceCache=new v_(d),this.options=m,this.exaggeration=typeof m.exaggeration=="number"?m.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(s,d,m,y=l.X){var x;if(!(d>=0&&d<y&&m>=0&&m<y))return 0;const M=this.getTerrainData(s),I=(x=M.tile)===null||x===void 0?void 0:x.dem;if(!I)return 0;const O=function(Q,re,ae){var ce=re[0],he=re[1];return Q[0]=ae[0]*ce+ae[4]*he+ae[12],Q[1]=ae[1]*ce+ae[5]*he+ae[13],Q}([],[d/y*l.X,m/y*l.X],M.u_terrain_matrix),N=[O[0]*I.dim,O[1]*I.dim],V=Math.floor(N[0]),F=Math.floor(N[1]),G=N[0]-V,K=N[1]-F;return I.get(V,F)*(1-G)*(1-K)+I.get(V+1,F)*G*(1-K)+I.get(V,F+1)*(1-G)*K+I.get(V+1,F+1)*G*K}getElevationForLngLatZoom(s,d){if(!l.bb(d,s.wrap()))return 0;const{tileID:m,mercatorX:y,mercatorY:x}=this._getOverscaledTileIDFromLngLatZoom(s,d);return this.getElevation(m,y%l.X,x%l.X,l.X)}getElevation(s,d,m,y=l.X){return this.getDEMElevation(s,d,m,y)*this.exaggeration}getTerrainData(s){if(!this._emptyDemTexture){const y=this.painter.context,x=new l.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new rt(y,x,y.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new rt(y,new l.R({width:1,height:1}),y.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(y.gl.NEAREST,y.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=l.an([])}const d=this.sourceCache.getSourceTile(s,!0);if(d&&d.dem&&(!d.demTexture||d.needsTerrainPrepare)){const y=this.painter.context;d.demTexture=this.painter.getTileTexture(d.dem.stride),d.demTexture?d.demTexture.update(d.dem.getPixels(),{premultiply:!1}):d.demTexture=new rt(y,d.dem.getPixels(),y.gl.RGBA,{premultiply:!1}),d.demTexture.bind(y.gl.NEAREST,y.gl.CLAMP_TO_EDGE),d.needsTerrainPrepare=!1}const m=d&&d+d.tileID.key+s.key;if(m&&!this._demMatrixCache[m]){const y=this.sourceCache.sourceCache._source.maxzoom;let x=s.canonical.z-d.tileID.canonical.z;s.overscaledZ>s.canonical.z&&(s.canonical.z>=y?x=s.canonical.z-y:l.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const M=s.canonical.x-(s.canonical.x>>x<<x),I=s.canonical.y-(s.canonical.y>>x<<x),O=l.bc(new Float64Array(16),[1/(l.X<<x),1/(l.X<<x),0]);l.J(O,O,[M*l.X,I*l.X,0]),this._demMatrixCache[s.key]={matrix:O,coord:s}}return{u_depth:2,u_terrain:3,u_terrain_dim:d&&d.dem&&d.dem.dim||1,u_terrain_matrix:m?this._demMatrixCache[s.key].matrix:this._emptyDemMatrix,u_terrain_unpack:d&&d.dem&&d.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(d&&d.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:d}}getFramebuffer(s){const d=this.painter,m=d.width/devicePixelRatio,y=d.height/devicePixelRatio;return!this._fbo||this._fbo.width===m&&this._fbo.height===y||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new rt(d.context,{width:m,height:y,data:null},d.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(d.context.gl.NEAREST,d.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new rt(d.context,{width:m,height:y,data:null},d.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(d.context.gl.NEAREST,d.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=d.context.createFramebuffer(m,y,!0,!1),this._fbo.depthAttachment.set(d.context.createRenderbuffer(d.context.gl.DEPTH_COMPONENT16,m,y))),this._fbo.colorAttachment.set(s==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const s=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const d=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let x=0,M=0;x<this._coordsTextureSize;x++)for(let I=0;I<this._coordsTextureSize;I++,M+=4)d[M+0]=255&I,d[M+1]=255&x,d[M+2]=I>>8<<4|x>>8,d[M+3]=0;const m=new l.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(d.buffer)),y=new rt(s,m,s.gl.RGBA,{premultiply:!1});return y.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._coordsTexture=y,y}pointCoordinate(s){this.painter.maybeDrawDepthAndCoords(!0);const d=new Uint8Array(4),m=this.painter.context,y=m.gl,x=Math.round(s.x*this.painter.pixelRatio/devicePixelRatio),M=Math.round(s.y*this.painter.pixelRatio/devicePixelRatio),I=Math.round(this.painter.height/devicePixelRatio);m.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),y.readPixels(x,I-M-1,1,1,y.RGBA,y.UNSIGNED_BYTE,d),m.bindFramebuffer.set(null);const O=d[0]+(d[2]>>4<<8),N=d[1]+((15&d[2])<<8),V=this.coordsIndex[255-d[3]],F=V&&this.sourceCache.getTileByID(V);if(!F)return null;const G=this._coordsTextureSize,K=(1<<F.tileID.canonical.z)*G;return new l.Z((F.tileID.canonical.x*G+O)/K+F.tileID.wrap,(F.tileID.canonical.y*G+N)/K,this.getElevation(F.tileID,O,N,G))}depthAtPoint(s){const d=new Uint8Array(4),m=this.painter.context,y=m.gl;return m.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),y.readPixels(s.x,this.painter.height/devicePixelRatio-s.y-1,1,1,y.RGBA,y.UNSIGNED_BYTE,d),m.bindFramebuffer.set(null),(d[0]/16777216+d[1]/65536+d[2]/256+d[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const s=this.painter.context,d=new l.bd,m=new l.aY,y=this.meshSize,x=l.X/y,M=y*y;for(let F=0;F<=y;F++)for(let G=0;G<=y;G++)d.emplaceBack(G*x,F*x,0);for(let F=0;F<M;F+=y+1)for(let G=0;G<y;G++)m.emplaceBack(G+F,y+G+F+1,y+G+F+2),m.emplaceBack(G+F,y+G+F+2,G+F+1);const I=d.length,O=I+2*(y+1);for(const F of[0,1])for(let G=0;G<=y;G++)for(const K of[0,1])d.emplaceBack(G*x,F*l.X,K);for(let F=0;F<2*y;F+=2)m.emplaceBack(O+F,O+F+1,O+F+3),m.emplaceBack(O+F,O+F+3,O+F+2),m.emplaceBack(I+F,I+F+3,I+F+1),m.emplaceBack(I+F,I+F+2,I+F+3);const N=d.length,V=N+2*(y+1);for(const F of[0,1])for(let G=0;G<=y;G++)for(const K of[0,1])d.emplaceBack(F*l.X,G*x,K);for(let F=0;F<2*y;F+=2)m.emplaceBack(N+F,N+F+1,N+F+3),m.emplaceBack(N+F,N+F+3,N+F+2),m.emplaceBack(V+F,V+F+3,V+F+1),m.emplaceBack(V+F,V+F+2,V+F+3);return this._mesh=new yu(s.createVertexBuffer(d,zd.members),s.createIndexBuffer(m),l.a0.simpleSegment(0,0,d.length,m.length)),this._mesh}getMeshFrameDelta(s){return 2*Math.PI*l.be/Math.pow(2,s)/5}getMinTileElevationForLngLatZoom(s,d){var m;const{tileID:y}=this._getOverscaledTileIDFromLngLatZoom(s,d);return(m=this.getMinMaxElevation(y).minElevation)!==null&&m!==void 0?m:0}getMinMaxElevation(s){const d=this.getTerrainData(s).tile,m={minElevation:null,maxElevation:null};return d&&d.dem&&(m.minElevation=d.dem.min*this.exaggeration,m.maxElevation=d.dem.max*this.exaggeration),m}_getOverscaledTileIDFromLngLatZoom(s,d){const m=l.Z.fromLngLat(s.wrap()),y=(1<<d)*l.X,x=m.x*y,M=m.y*y,I=Math.floor(x/l.X),O=Math.floor(M/l.X);return{tileID:new l.S(d,0,d,I,O),mercatorX:x,mercatorY:M}}}class w_{constructor(s,d,m){this._context=s,this._size=d,this._tileSize=m,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const s of this._objects)s.texture.destroy(),s.fbo.destroy()}_createObject(s){const d=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),m=new rt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return m.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),d.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),d.colorAttachment.set(m.texture),{id:s,fbo:d,texture:m,stamp:-1,inUse:!1}}getObjectForId(s){return this._objects[s]}useObject(s){s.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(d=>s.id!==d),this._recentlyUsed.push(s.id)}stampObject(s){s.stamp=++this._stamp}getOrCreateFreeObject(){for(const d of this._recentlyUsed)if(!this._objects[d].inUse)return this._objects[d];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const s=this._createObject(this._objects.length);return this._objects.push(s),s}freeObject(s){s.inUse=!1}freeAllObjects(){for(const s of this._objects)this.freeObject(s)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(s=>!s.inUse)===!1}}const Za={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Tm{constructor(s,d){this.painter=s,this.terrain=d,this.pool=new w_(s.context,30,d.sourceCache.tileSize*d.qualityFactor)}destruct(){this.pool.destruct()}getTexture(s){return this.pool.getObjectForId(s.rtt[this._stacks.length-1].id).texture}prepareForRender(s,d){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=s._order.filter(m=>!s._layers[m].isHidden(d)),this._coordsDescendingInv={};for(const m in s.sourceCaches){this._coordsDescendingInv[m]={};const y=s.sourceCaches[m].getVisibleCoordinates();for(const x of y){const M=this.terrain.sourceCache.getTerrainCoords(x);for(const I in M)this._coordsDescendingInv[m][I]||(this._coordsDescendingInv[m][I]=[]),this._coordsDescendingInv[m][I].push(M[I])}}this._coordsDescendingInvStr={};for(const m of s._order){const y=s._layers[m],x=y.source;if(Za[y.type]&&!this._coordsDescendingInvStr[x]){this._coordsDescendingInvStr[x]={};for(const M in this._coordsDescendingInv[x])this._coordsDescendingInvStr[x][M]=this._coordsDescendingInv[x][M].map(I=>I.key).sort().join()}}for(const m of this._renderableTiles)for(const y in this._coordsDescendingInvStr){const x=this._coordsDescendingInvStr[y][m.tileID.key];x&&x!==m.rttCoords[y]&&(m.rtt=[])}}renderLayer(s){if(s.isHidden(this.painter.transform.zoom))return!1;const d=s.type,m=this.painter,y=this._renderableLayerIds[this._renderableLayerIds.length-1]===s.id;if(Za[d]&&(this._prevType&&Za[this._prevType]||this._stacks.push([]),this._prevType=d,this._stacks[this._stacks.length-1].push(s.id),!y))return!0;if(Za[this._prevType]||Za[d]&&y){this._prevType=d;const x=this._stacks.length-1,M=this._stacks[x]||[];for(const I of this._renderableTiles){if(this.pool.isFull()&&(bm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(I),I.rtt[x]){const N=this.pool.getObjectForId(I.rtt[x].id);if(N.stamp===I.rtt[x].stamp){this.pool.useObject(N);continue}}const O=this.pool.getOrCreateFreeObject();this.pool.useObject(O),this.pool.stampObject(O),I.rtt[x]={id:O.id,stamp:O.stamp},m.context.bindFramebuffer.set(O.fbo.framebuffer),m.context.clear({color:l.aM.transparent,stencil:0}),m.currentStencilSource=void 0;for(let N=0;N<M.length;N++){const V=m.style._layers[M[N]],F=V.source?this._coordsDescendingInv[V.source][I.tileID.key]:[I.tileID];m.context.viewport.set([0,0,O.fbo.width,O.fbo.height]),m._renderTileClippingMasks(V,F),m.renderLayer(m,m.style.sourceCaches[V.source],V,F),V.source&&(I.rttCoords[V.source]=this._coordsDescendingInvStr[V.source][I.tileID.key])}}return bm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Za[d]}return!1}}const Nd={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},Mm=g,k_={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Wa,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,refreshExpiredTiles:!0,scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],zoom:0,bearing:0,pitch:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:l.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0},Rd=v=>{v.touchstart=v.dragStart,v.touchmoveWindow=v.dragMove,v.touchend=v.dragEnd},S_={showCompass:!0,showZoom:!0,visualizePitch:!1};class E_{constructor(s,d,m=!1){this.mousedown=M=>{this.startMouse(l.e({},M,{ctrlKey:!0,preventDefault:()=>M.preventDefault()}),C.mousePos(this.element,M)),C.addEventListener(window,"mousemove",this.mousemove),C.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=M=>{this.moveMouse(M,C.mousePos(this.element,M))},this.mouseup=M=>{this.mouseRotate.dragEnd(M),this.mousePitch&&this.mousePitch.dragEnd(M),this.offTemp()},this.touchstart=M=>{M.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=C.touchPos(this.element,M.targetTouches)[0],this.startTouch(M,this._startPos),C.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.addEventListener(window,"touchend",this.touchend))},this.touchmove=M=>{M.targetTouches.length!==1?this.reset():(this._lastPos=C.touchPos(this.element,M.targetTouches)[0],this.moveTouch(M,this._lastPos))},this.touchend=M=>{M.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const y=s.dragRotate._mouseRotate.getClickTolerance(),x=s.dragRotate._mousePitch.getClickTolerance();this.element=d,this.mouseRotate=Sd({clickTolerance:y,enable:!0}),this.touchRotate=(({enable:M,clickTolerance:I,bearingDegreesPerPixelMoved:O=.8})=>{const N=new kd;return new qs({clickTolerance:I,move:(V,F)=>({bearingDelta:(F.x-V.x)*O}),moveStateManager:N,enable:M,assignEvents:Rd})})({clickTolerance:y,enable:!0}),this.map=s,m&&(this.mousePitch=Ed({clickTolerance:x,enable:!0}),this.touchPitch=(({enable:M,clickTolerance:I,pitchDegreesPerPixelMoved:O=-.5})=>{const N=new kd;return new qs({clickTolerance:I,move:(V,F)=>({pitchDelta:(F.y-V.y)*O}),moveStateManager:N,enable:M,assignEvents:Rd})})({clickTolerance:x,enable:!0})),C.addEventListener(d,"mousedown",this.mousedown),C.addEventListener(d,"touchstart",this.touchstart,{passive:!1}),C.addEventListener(d,"touchcancel",this.reset)}startMouse(s,d){this.mouseRotate.dragStart(s,d),this.mousePitch&&this.mousePitch.dragStart(s,d),C.disableDrag()}startTouch(s,d){this.touchRotate.dragStart(s,d),this.touchPitch&&this.touchPitch.dragStart(s,d),C.disableDrag()}moveMouse(s,d){const m=this.map,{bearingDelta:y}=this.mouseRotate.dragMove(s,d)||{};if(y&&m.setBearing(m.getBearing()+y),this.mousePitch){const{pitchDelta:x}=this.mousePitch.dragMove(s,d)||{};x&&m.setPitch(m.getPitch()+x)}}moveTouch(s,d){const m=this.map,{bearingDelta:y}=this.touchRotate.dragMove(s,d)||{};if(y&&m.setBearing(m.getBearing()+y),this.touchPitch){const{pitchDelta:x}=this.touchPitch.dragMove(s,d)||{};x&&m.setPitch(m.getPitch()+x)}}off(){const s=this.element;C.removeEventListener(s,"mousedown",this.mousedown),C.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),C.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.removeEventListener(window,"touchend",this.touchend),C.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){C.enableDrag(),C.removeEventListener(window,"mousemove",this.mousemove),C.removeEventListener(window,"mouseup",this.mouseup),C.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.removeEventListener(window,"touchend",this.touchend)}}let br;function Vn(v,s,d){const m=new l.N(v.lng,v.lat);if(v=new l.N(v.lng,v.lat),s){const y=new l.N(v.lng-360,v.lat),x=new l.N(v.lng+360,v.lat),M=d.locationPoint(v).distSqr(s);d.locationPoint(y).distSqr(s)<M?v=y:d.locationPoint(x).distSqr(s)<M&&(v=x)}for(;Math.abs(v.lng-d.center.lng)>180;){const y=d.locationPoint(v);if(y.x>=0&&y.y>=0&&y.x<=d.width&&y.y<=d.height)break;v.lng>d.center.lng?v.lng-=360:v.lng+=360}return v.lng!==m.lng&&d.locationPoint(v).y>d.height/2-d.getHorizon()?v:m}const Ya={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Mu(v,s,d){const m=v.classList;for(const y in Ya)m.remove(`maplibregl-${d}-anchor-${y}`);m.add(`maplibregl-${d}-anchor-${s}`)}class Au extends l.E{constructor(s){if(super(),this._onKeyPress=d=>{const m=d.code,y=d.charCode||d.keyCode;m!=="Space"&&m!=="Enter"&&y!==32&&y!==13||this.togglePopup()},this._onMapClick=d=>{const m=d.originalEvent.target,y=this._element;this._popup&&(m===y||y.contains(m))&&this.togglePopup()},this._update=d=>{var m;if(!this._map)return;const y=this._map.loaded()&&!this._map.isMoving();((d==null?void 0:d.type)==="terrain"||(d==null?void 0:d.type)==="render"&&!y)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Vn(this._lngLat,this._flatPos,this._map.transform):(m=this._lngLat)===null||m===void 0?void 0:m.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let x="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?x=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(x=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let M="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?M="rotateX(0deg)":this._pitchAlignment==="map"&&(M=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||d&&d.type!=="moveend"||(this._pos=this._pos.round()),C.setTransform(this._element,`${Ya[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${M} ${x}`),E.frameAsync(new AbortController).then(()=>{this._updateOpacity(d&&d.type==="moveend")}).catch(()=>{})},this._onMove=d=>{if(!this._isDragging){const m=this._clickTolerance||this._map._clickTolerance;this._isDragging=d.point.dist(this._pointerdownPos)>=m}this._isDragging&&(this._pos=d.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new l.k("dragstart"))),this.fire(new l.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new l.k("dragend")),this._state="inactive"},this._addDragHandler=d=>{this._element.contains(d.originalEvent.target)&&(d.preventDefault(),this._positionDelta=d.point.sub(this._pos).add(this._offset),this._pointerdownPos=d.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=s&&s.anchor||"center",this._color=s&&s.color||"#3FB1CE",this._scale=s&&s.scale||1,this._draggable=s&&s.draggable||!1,this._clickTolerance=s&&s.clickTolerance||0,this._subpixelPositioning=s&&s.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=s&&s.rotation||0,this._rotationAlignment=s&&s.rotationAlignment||"auto",this._pitchAlignment=s&&s.pitchAlignment&&s.pitchAlignment!=="auto"?s.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(s==null?void 0:s.opacity,s==null?void 0:s.opacityWhenCovered),s&&s.element)this._element=s.element,this._offset=l.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=C.create("div");const d=C.createNS("http://www.w3.org/2000/svg","svg"),m=41,y=27;d.setAttributeNS(null,"display","block"),d.setAttributeNS(null,"height",`${m}px`),d.setAttributeNS(null,"width",`${y}px`),d.setAttributeNS(null,"viewBox",`0 0 ${y} ${m}`);const x=C.createNS("http://www.w3.org/2000/svg","g");x.setAttributeNS(null,"stroke","none"),x.setAttributeNS(null,"stroke-width","1"),x.setAttributeNS(null,"fill","none"),x.setAttributeNS(null,"fill-rule","evenodd");const M=C.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"fill-rule","nonzero");const I=C.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"transform","translate(3.0, 29.0)"),I.setAttributeNS(null,"fill","#000000");const O=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const ce of O){const he=C.createNS("http://www.w3.org/2000/svg","ellipse");he.setAttributeNS(null,"opacity","0.04"),he.setAttributeNS(null,"cx","10.5"),he.setAttributeNS(null,"cy","5.80029008"),he.setAttributeNS(null,"rx",ce.rx),he.setAttributeNS(null,"ry",ce.ry),I.appendChild(he)}const N=C.createNS("http://www.w3.org/2000/svg","g");N.setAttributeNS(null,"fill",this._color);const V=C.createNS("http://www.w3.org/2000/svg","path");V.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),N.appendChild(V);const F=C.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"fill","#000000");const G=C.createNS("http://www.w3.org/2000/svg","path");G.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),F.appendChild(G);const K=C.createNS("http://www.w3.org/2000/svg","g");K.setAttributeNS(null,"transform","translate(6.0, 7.0)"),K.setAttributeNS(null,"fill","#FFFFFF");const Q=C.createNS("http://www.w3.org/2000/svg","g");Q.setAttributeNS(null,"transform","translate(8.0, 8.0)");const re=C.createNS("http://www.w3.org/2000/svg","circle");re.setAttributeNS(null,"fill","#000000"),re.setAttributeNS(null,"opacity","0.25"),re.setAttributeNS(null,"cx","5.5"),re.setAttributeNS(null,"cy","5.5"),re.setAttributeNS(null,"r","5.4999962");const ae=C.createNS("http://www.w3.org/2000/svg","circle");ae.setAttributeNS(null,"fill","#FFFFFF"),ae.setAttributeNS(null,"cx","5.5"),ae.setAttributeNS(null,"cy","5.5"),ae.setAttributeNS(null,"r","5.4999962"),Q.appendChild(re),Q.appendChild(ae),M.appendChild(I),M.appendChild(N),M.appendChild(F),M.appendChild(K),M.appendChild(Q),d.appendChild(M),d.setAttributeNS(null,"height",m*this._scale+"px"),d.setAttributeNS(null,"width",y*this._scale+"px"),this._element.appendChild(d),this._offset=l.P.convert(s&&s.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",d=>{d.preventDefault()}),this._element.addEventListener("mousedown",d=>{d.preventDefault()}),Mu(this._element,this._anchor,"marker"),s&&s.className)for(const d of s.className.split(" "))this._element.classList.add(d);this._popup=null}addTo(s){return this.remove(),this._map=s,this._element.setAttribute("aria-label",s._getUIString("Marker.Title")),s.getCanvasContainer().appendChild(this._element),s.on("move",this._update),s.on("moveend",this._update),s.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),C.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=l.N.convert(s),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(s){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),s){if(!("offset"in s.options)){const y=Math.abs(13.5)/Math.SQRT2;s.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[y,-1*(38.1-13.5+y)],"bottom-right":[-y,-1*(38.1-13.5+y)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(s){return this._subpixelPositioning=s,this}getPopup(){return this._popup}togglePopup(){const s=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:s?(s.isOpen()?s.remove():(s.setLngLat(this._lngLat),s.addTo(this._map)),this):this}_updateOpacity(s=!1){var d,m;if(!(!((d=this._map)===null||d===void 0)&&d.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(s)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const y=this._map,x=y.terrain.depthAtPoint(this._pos),M=y.terrain.getElevationForLngLatZoom(this._lngLat,y.transform.tileZoom);if(y.transform.lngLatToCameraDepth(this._lngLat,M)-x<.006)return void(this._element.style.opacity=this._opacity);const I=-this._offset.y/y.transform._pixelPerMeter,O=Math.sin(y.getPitch()*Math.PI/180)*I,N=y.terrain.depthAtPoint(new l.P(this._pos.x,this._pos.y-this._offset.y)),V=y.transform.lngLatToCameraDepth(this._lngLat,M+O)-N>.006;!((m=this._popup)===null||m===void 0)&&m.isOpen()&&V&&this._popup.remove(),this._element.style.opacity=V?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(s){return this._offset=l.P.convert(s),this._update(),this}addClassName(s){this._element.classList.add(s)}removeClassName(s){this._element.classList.remove(s)}toggleClassName(s){return this._element.classList.toggle(s)}setDraggable(s){return this._draggable=!!s,this._map&&(s?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(s){return this._rotation=s||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(s){return this._rotationAlignment=s||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(s){return this._pitchAlignment=s&&s!=="auto"?s:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(s,d){return s===void 0&&d===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),s!==void 0&&(this._opacity=s),d!==void 0&&(this._opacityWhenCovered=d),this._map&&this._updateOpacity(!0),this}}const Am={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ql=0,ec=!1;const Is={maxWidth:100,unit:"metric"};function tc(v,s,d){const m=d&&d.maxWidth||100,y=v._container.clientHeight/2,x=v.unproject([0,y]),M=v.unproject([m,y]),I=x.distanceTo(M);if(d&&d.unit==="imperial"){const O=3.2808*I;O>5280?ft(s,m,O/5280,v._getUIString("ScaleControl.Miles")):ft(s,m,O,v._getUIString("ScaleControl.Feet"))}else d&&d.unit==="nautical"?ft(s,m,I/1852,v._getUIString("ScaleControl.NauticalMiles")):I>=1e3?ft(s,m,I/1e3,v._getUIString("ScaleControl.Kilometers")):ft(s,m,I,v._getUIString("ScaleControl.Meters"))}function ft(v,s,d,m){const y=function(x){const M=Math.pow(10,`${Math.floor(x)}`.length-1);let I=x/M;return I=I>=10?10:I>=5?5:I>=3?3:I>=2?2:I>=1?1:function(O){const N=Math.pow(10,Math.ceil(-Math.log(O)/Math.LN10));return Math.round(O*N)/N}(I),M*I}(d);v.style.width=s*(y/d)+"px",v.innerHTML=`${y} ${m}`}const Et={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Iu=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Pu(v){if(v){if(typeof v=="number"){const s=Math.round(Math.abs(v)/Math.SQRT2);return{center:new l.P(0,0),top:new l.P(0,v),"top-left":new l.P(s,s),"top-right":new l.P(-s,s),bottom:new l.P(0,-v),"bottom-left":new l.P(s,-s),"bottom-right":new l.P(-s,-s),left:new l.P(v,0),right:new l.P(-v,0)}}if(v instanceof l.P||Array.isArray(v)){const s=l.P.convert(v);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}return{center:l.P.convert(v.center||[0,0]),top:l.P.convert(v.top||[0,0]),"top-left":l.P.convert(v["top-left"]||[0,0]),"top-right":l.P.convert(v["top-right"]||[0,0]),bottom:l.P.convert(v.bottom||[0,0]),"bottom-left":l.P.convert(v["bottom-left"]||[0,0]),"bottom-right":l.P.convert(v["bottom-right"]||[0,0]),left:l.P.convert(v.left||[0,0]),right:l.P.convert(v.right||[0,0])}}return Pu(new l.P(0,0))}const Ld=g;u.AJAXError=l.bh,u.Evented=l.E,u.LngLat=l.N,u.MercatorCoordinate=l.Z,u.Point=l.P,u.addProtocol=l.bi,u.config=l.a,u.removeProtocol=l.bj,u.AttributionControl=Ga,u.BoxZoomHandler=_r,u.CanvasSource=xi,u.CooperativeGesturesHandler=qa,u.DoubleClickZoomHandler=Ko,u.DragPanHandler=Sm,u.DragRotateHandler=Em,u.EdgeInsets=$a,u.FullscreenControl=class extends l.E{constructor(v={}){super(),this._onFullscreenChange=()=>{var s;let d=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((s=d==null?void 0:d.shadowRoot)===null||s===void 0)&&s.fullscreenElement;)d=d.shadowRoot.fullscreenElement;d===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,v&&v.container&&(v.container instanceof HTMLElement?this._container=v.container:l.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(v){return this._map=v,this._container||(this._container=this._map.getContainer()),this._controlContainer=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){C.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const v=this._fullscreenButton=C.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);C.create("span","maplibregl-ctrl-icon",v).setAttribute("aria-hidden","true"),v.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const v=this._getTitle();this._fullscreenButton.setAttribute("aria-label",v),this._fullscreenButton.title=v}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new l.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new l.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},u.GeoJSONSource=Ui,u.GeolocateControl=class extends l.E{constructor(v){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new l.k("outofmaxbounds",s)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=s,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(s),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(s),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new l.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{const d=new l.N(s.coords.longitude,s.coords.latitude),m=s.coords.accuracy,y=this._map.getBearing(),x=l.e({bearing:y},this.options.fitBoundsOptions),M=we.fromLngLat(d,m);this._map.fitBounds(M,x,{geolocateSource:!0})},this._updateMarker=s=>{if(s){const d=new l.N(s.coords.longitude,s.coords.latitude);this._accuracyCircleMarker.setLngLat(d).addTo(this._map),this._userLocationDotMarker.setLngLat(d).addTo(this._map),this._accuracy=s.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=s=>{if(this._map){if(this.options.trackUserLocation)if(s.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=d,this._geolocateButton.setAttribute("aria-label",d),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(s.code===3&&ec)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new l.k("error",s)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",s=>s.preventDefault()),this._geolocateButton=C.create("button","maplibregl-ctrl-geolocate",this._container),C.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=s=>{if(this._map){if(s===!1){l.w("Geolocation support is not available so the GeolocateControl will be disabled.");const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=d,this._geolocateButton.setAttribute("aria-label",d)}else{const d=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=d,this._geolocateButton.setAttribute("aria-label",d)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=C.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Au({element:this._dotElement}),this._circleElement=C.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Au({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",d=>{d.geolocateSource||this._watchState!=="ACTIVE_LOCK"||d.originalEvent&&d.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new l.k("trackuserlocationend")),this.fire(new l.k("userlocationlostfocus")))})}},this.options=l.e({},Am,v)}onAdd(v){return this._map=v,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return l._(this,arguments,void 0,function*(s=!1){if(br!==void 0&&!s)return br;if(window.navigator.permissions===void 0)return br=!!window.navigator.geolocation,br;try{br=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{br=!!window.navigator.geolocation}return br})}().then(s=>this._finishSetupUI(s)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),C.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Ql=0,ec=!1}_isOutOfMapMaxBounds(v){const s=this._map.getMaxBounds(),d=v.coords;return s&&(d.longitude<s.getWest()||d.longitude>s.getEast()||d.latitude<s.getSouth()||d.latitude>s.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const v=this._map.getBounds(),s=v.getSouthEast(),d=v.getNorthEast(),m=s.distanceTo(d),y=Math.ceil(this._accuracy/(m/this._map._container.clientHeight)*2);this._circleElement.style.width=`${y}px`,this._circleElement.style.height=`${y}px`}trigger(){if(!this._setup)return l.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new l.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ql--,ec=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new l.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new l.k("trackuserlocationstart")),this.fire(new l.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let v;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Ql++,Ql>1?(v={maximumAge:6e5,timeout:0},ec=!0):(v=this.options.positionOptions,ec=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,v)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},u.Hash=bu,u.ImageSource=bi,u.KeyboardHandler=Lr,u.LngLatBounds=we,u.LogoControl=Od,u.Map=class extends Cm{constructor(v){l.bf.mark(l.bg.create);const s=Object.assign(Object.assign({},k_),v);if(s.minZoom!=null&&s.maxZoom!=null&&s.minZoom>s.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(s.minPitch!=null&&s.maxPitch!=null&&s.minPitch>s.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(s.minPitch!=null&&s.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(s.maxPitch!=null&&s.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ja(s.minZoom,s.maxZoom,s.minPitch,s.maxPitch,s.renderWorldCopies),{bearingSnap:s.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new en,this._controls=[],this._mapId=l.a4(),this._contextLost=d=>{d.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new l.k("webglcontextlost",{originalEvent:d}))},this._contextRestored=d=>{this._setupPainter(),this.resize(),this._update(),this.fire(new l.k("webglcontextrestored",{originalEvent:d}))},this._onMapScroll=d=>{if(d.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=s.interactive,this._maxTileCacheSize=s.maxTileCacheSize,this._maxTileCacheZoomLevels=s.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=s.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=s.preserveDrawingBuffer===!0,this._antialias=s.antialias===!0,this._trackResize=s.trackResize===!0,this._bearingSnap=s.bearingSnap,this._refreshExpiredTiles=s.refreshExpiredTiles===!0,this._fadeDuration=s.fadeDuration,this._crossSourceCollisions=s.crossSourceCollisions===!0,this._collectResourceTiming=s.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Nd),s.locale),this._clickTolerance=s.clickTolerance,this._overridePixelRatio=s.pixelRatio,this._maxCanvasSize=s.maxCanvasSize,this.transformCameraUpdate=s.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=s.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=le.addThrottleControl(()=>this.isMoving()),this._requestManager=new J(s.transformRequest),typeof s.container=="string"){if(this._container=document.getElementById(s.container),!this._container)throw new Error(`Container '${s.container}' not found.`)}else{if(!(s.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=s.container}if(s.maxBounds&&this.setMaxBounds(s.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let d=!1;const m=Zl(y=>{this._trackResize&&!this._removed&&(this.resize(y),this.redraw())},50);this._resizeObserver=new ResizeObserver(y=>{d?m(y):d=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Dd(this,s),this._hash=s.hash&&new bu(typeof s.hash=="string"&&s.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:s.center,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch}),s.bounds&&(this.resize(),this.fitBounds(s.bounds,l.e({},s.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=s.localIdeographFontFamily,this._validateStyle=s.validateStyle,s.style&&this.setStyle(s.style,{localIdeographFontFamily:s.localIdeographFontFamily}),s.attributionControl&&this.addControl(new Ga(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new Od,s.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",d=>{this._update(d.dataType==="style"),this.fire(new l.k(`${d.dataType}data`,d))}),this.on("dataloading",d=>{this.fire(new l.k(`${d.dataType}dataloading`,d))}),this.on("dataabort",d=>{this.fire(new l.k("sourcedataabort",d))})}_getMapId(){return this._mapId}addControl(v,s){if(s===void 0&&(s=v.getDefaultPosition?v.getDefaultPosition():"top-right"),!v||!v.onAdd)return this.fire(new l.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const d=v.onAdd(this);this._controls.push(v);const m=this._controlPositions[s];return s.indexOf("bottom")!==-1?m.insertBefore(d,m.firstChild):m.appendChild(d),this}removeControl(v){if(!v||!v.onRemove)return this.fire(new l.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(v);return s>-1&&this._controls.splice(s,1),v.onRemove(this),this}hasControl(v){return this._controls.indexOf(v)>-1}calculateCameraOptionsFromTo(v,s,d,m){return m==null&&this.terrain&&(m=this.terrain.getElevationForLngLatZoom(d,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(v,s,d,m)}resize(v){var s;const d=this._containerDimensions(),m=d[0],y=d[1],x=this._getClampedPixelRatio(m,y);if(this._resizeCanvas(m,y,x),this.painter.resize(m,y,x),this.painter.overLimit()){const I=this.painter.context.gl;this._maxCanvasSize=[I.drawingBufferWidth,I.drawingBufferHeight];const O=this._getClampedPixelRatio(m,y);this._resizeCanvas(m,y,O),this.painter.resize(m,y,O)}this.transform.resize(m,y),(s=this._requestedCameraState)===null||s===void 0||s.resize(m,y);const M=!this._moving;return M&&(this.stop(),this.fire(new l.k("movestart",v)).fire(new l.k("move",v))),this.fire(new l.k("resize",v)),M&&this.fire(new l.k("moveend",v)),this}_getClampedPixelRatio(v,s){const{0:d,1:m}=this._maxCanvasSize,y=this.getPixelRatio(),x=v*y,M=s*y;return Math.min(x>d?d/x:1,M>m?m/M:1)*y}getPixelRatio(){var v;return(v=this._overridePixelRatio)!==null&&v!==void 0?v:devicePixelRatio}setPixelRatio(v){this._overridePixelRatio=v,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(v){return this.transform.setMaxBounds(we.convert(v)),this._update()}setMinZoom(v){if((v=v??-2)>=-2&&v<=this.transform.maxZoom)return this.transform.minZoom=v,this._update(),this.getZoom()<v&&this.setZoom(v),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(v){if((v=v??22)>=this.transform.minZoom)return this.transform.maxZoom=v,this._update(),this.getZoom()>v&&this.setZoom(v),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(v){if((v=v??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(v>=0&&v<=this.transform.maxPitch)return this.transform.minPitch=v,this._update(),this.getPitch()<v&&this.setPitch(v),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(v){if((v=v??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(v>=this.transform.minPitch)return this.transform.maxPitch=v,this._update(),this.getPitch()>v&&this.setPitch(v),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(v){return this.transform.renderWorldCopies=v,this._update()}project(v){return this.transform.locationPoint(l.N.convert(v),this.style&&this.terrain)}unproject(v){return this.transform.pointLocation(l.P.convert(v),this.terrain)}isMoving(){var v;return this._moving||((v=this.handlers)===null||v===void 0?void 0:v.isMoving())}isZooming(){var v;return this._zooming||((v=this.handlers)===null||v===void 0?void 0:v.isZooming())}isRotating(){var v;return this._rotating||((v=this.handlers)===null||v===void 0?void 0:v.isRotating())}_createDelegatedListener(v,s,d){if(v==="mouseenter"||v==="mouseover"){let m=!1;return{layers:s,listener:d,delegates:{mousemove:x=>{const M=s.filter(O=>this.getLayer(O)),I=M.length!==0?this.queryRenderedFeatures(x.point,{layers:M}):[];I.length?m||(m=!0,d.call(this,new Pi(v,this,x.originalEvent,{features:I}))):m=!1},mouseout:()=>{m=!1}}}}if(v==="mouseleave"||v==="mouseout"){let m=!1;return{layers:s,listener:d,delegates:{mousemove:M=>{const I=s.filter(O=>this.getLayer(O));(I.length!==0?this.queryRenderedFeatures(M.point,{layers:I}):[]).length?m=!0:m&&(m=!1,d.call(this,new Pi(v,this,M.originalEvent)))},mouseout:M=>{m&&(m=!1,d.call(this,new Pi(v,this,M.originalEvent)))}}}}{const m=y=>{const x=s.filter(I=>this.getLayer(I)),M=x.length!==0?this.queryRenderedFeatures(y.point,{layers:x}):[];M.length&&(y.features=M,d.call(this,y),delete y.features)};return{layers:s,listener:d,delegates:{[v]:m}}}}_saveDelegatedListener(v,s){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[v]=this._delegatedListeners[v]||[],this._delegatedListeners[v].push(s)}_removeDelegatedListener(v,s,d){if(!this._delegatedListeners||!this._delegatedListeners[v])return;const m=this._delegatedListeners[v];for(let y=0;y<m.length;y++){const x=m[y];if(x.listener===d&&x.layers.length===s.length&&x.layers.every(M=>s.includes(M))){for(const M in x.delegates)this.off(M,x.delegates[M]);return void m.splice(y,1)}}}on(v,s,d){if(d===void 0)return super.on(v,s);const m=this._createDelegatedListener(v,typeof s=="string"?[s]:s,d);this._saveDelegatedListener(v,m);for(const y in m.delegates)this.on(y,m.delegates[y]);return this}once(v,s,d){if(d===void 0)return super.once(v,s);const m=typeof s=="string"?[s]:s,y=this._createDelegatedListener(v,m,d);for(const x in y.delegates){const M=y.delegates[x];y.delegates[x]=(...I)=>{this._removeDelegatedListener(v,m,d),M(...I)}}this._saveDelegatedListener(v,y);for(const x in y.delegates)this.once(x,y.delegates[x]);return this}off(v,s,d){return d===void 0?super.off(v,s):(this._removeDelegatedListener(v,typeof s=="string"?[s]:s,d),this)}queryRenderedFeatures(v,s){if(!this.style)return[];let d;const m=v instanceof l.P||Array.isArray(v),y=m?v:[[0,0],[this.transform.width,this.transform.height]];if(s=s||(m?{}:v)||{},y instanceof l.P||typeof y[0]=="number")d=[l.P.convert(y)];else{const x=l.P.convert(y[0]),M=l.P.convert(y[1]);d=[x,new l.P(M.x,x.y),M,new l.P(x.x,M.y),x]}return this.style.queryRenderedFeatures(d,s,this.transform)}querySourceFeatures(v,s){return this.style.querySourceFeatures(v,s)}setStyle(v,s){return(s=l.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},s)).diff!==!1&&s.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&v?(this._diffStyle(v,s),this):(this._localIdeographFontFamily=s.localIdeographFontFamily,this._updateStyle(v,s))}setTransformRequest(v){return this._requestManager.setTransformRequest(v),this}_getUIString(v){const s=this._locale[v];if(s==null)throw new Error(`Missing UI string '${v}'`);return s}_updateStyle(v,s){if(s.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(v,s));const d=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!v)),v?(this.style=new nu(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof v=="string"?this.style.loadURL(v,s,d):this.style.loadJSON(v,s,d),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new nu(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(v,s){if(typeof v=="string"){const d=this._requestManager.transformRequest(v,"Style");l.h(d,new AbortController).then(m=>{this._updateDiff(m.data,s)}).catch(m=>{m&&this.fire(new l.j(m))})}else typeof v=="object"&&this._updateDiff(v,s)}_updateDiff(v,s){try{this.style.setState(v,s)&&this._update(!0)}catch(d){l.w(`Unable to perform style diff: ${d.message||d.error||d}. Rebuilding the style from scratch.`),this._updateStyle(v,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():l.w("There is no style added to the map.")}addSource(v,s){return this._lazyInitEmptyStyle(),this.style.addSource(v,s),this._update(!0)}isSourceLoaded(v){const s=this.style&&this.style.sourceCaches[v];if(s!==void 0)return s.loaded();this.fire(new l.j(new Error(`There is no source with ID '${v}'`)))}setTerrain(v){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),v){const s=this.style.sourceCaches[v.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${v.source}`);this.terrain===null&&s.reload();for(const d in this.style._layers){const m=this.style._layers[d];m.type==="hillshade"&&m.source===v.source&&l.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Bd(this.painter,s,v),this.painter.renderToTexture=new Tm(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=d=>{d.dataType==="style"?this.terrain.sourceCache.freeRtt():d.dataType==="source"&&d.tile&&(d.sourceId!==v.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(d.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new l.k("terrain",{terrain:v})),this}getTerrain(){var v,s;return(s=(v=this.terrain)===null||v===void 0?void 0:v.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const v=this.style&&this.style.sourceCaches;for(const s in v){const d=v[s]._tiles;for(const m in d){const y=d[m];if(y.state!=="loaded"&&y.state!=="errored")return!1}}return!0}removeSource(v){return this.style.removeSource(v),this._update(!0)}getSource(v){return this.style.getSource(v)}addImage(v,s,d={}){const{pixelRatio:m=1,sdf:y=!1,stretchX:x,stretchY:M,content:I,textFitWidth:O,textFitHeight:N}=d;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||l.b(s))){if(s.width===void 0||s.height===void 0)return this.fire(new l.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:V,height:F,data:G}=s,K=s;return this.style.addImage(v,{data:new l.R({width:V,height:F},new Uint8Array(G)),pixelRatio:m,stretchX:x,stretchY:M,content:I,textFitWidth:O,textFitHeight:N,sdf:y,version:0,userImage:K}),K.onAdd&&K.onAdd(this,v),this}}{const{width:V,height:F,data:G}=E.getImageData(s);this.style.addImage(v,{data:new l.R({width:V,height:F},G),pixelRatio:m,stretchX:x,stretchY:M,content:I,textFitWidth:O,textFitHeight:N,sdf:y,version:0})}}updateImage(v,s){const d=this.style.getImage(v);if(!d)return this.fire(new l.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const m=s instanceof HTMLImageElement||l.b(s)?E.getImageData(s):s,{width:y,height:x,data:M}=m;if(y===void 0||x===void 0)return this.fire(new l.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(y!==d.data.width||x!==d.data.height)return this.fire(new l.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const I=!(s instanceof HTMLImageElement||l.b(s));return d.data.replace(M,I),this.style.updateImage(v,d),this}getImage(v){return this.style.getImage(v)}hasImage(v){return v?!!this.style.getImage(v):(this.fire(new l.j(new Error("Missing required image id"))),!1)}removeImage(v){this.style.removeImage(v)}loadImage(v){return le.getImage(this._requestManager.transformRequest(v,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(v,s){return this._lazyInitEmptyStyle(),this.style.addLayer(v,s),this._update(!0)}moveLayer(v,s){return this.style.moveLayer(v,s),this._update(!0)}removeLayer(v){return this.style.removeLayer(v),this._update(!0)}getLayer(v){return this.style.getLayer(v)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(v,s,d){return this.style.setLayerZoomRange(v,s,d),this._update(!0)}setFilter(v,s,d={}){return this.style.setFilter(v,s,d),this._update(!0)}getFilter(v){return this.style.getFilter(v)}setPaintProperty(v,s,d,m={}){return this.style.setPaintProperty(v,s,d,m),this._update(!0)}getPaintProperty(v,s){return this.style.getPaintProperty(v,s)}setLayoutProperty(v,s,d,m={}){return this.style.setLayoutProperty(v,s,d,m),this._update(!0)}getLayoutProperty(v,s){return this.style.getLayoutProperty(v,s)}setGlyphs(v,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(v,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(v,s,d={}){return this._lazyInitEmptyStyle(),this.style.addSprite(v,s,d,m=>{m||this._update(!0)}),this}removeSprite(v){return this._lazyInitEmptyStyle(),this.style.removeSprite(v),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(v,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(v,s,d=>{d||this._update(!0)}),this}setLight(v,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(v,s),this._update(!0)}getLight(){return this.style.getLight()}setSky(v){return this._lazyInitEmptyStyle(),this.style.setSky(v),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(v,s){return this.style.setFeatureState(v,s),this._update()}removeFeatureState(v,s){return this.style.removeFeatureState(v,s),this._update()}getFeatureState(v){return this.style.getFeatureState(v)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let v=0,s=0;return this._container&&(v=this._container.clientWidth||400,s=this._container.clientHeight||300),[v,s]}_setupContainer(){const v=this._container;v.classList.add("maplibregl-map");const s=this._canvasContainer=C.create("div","maplibregl-canvas-container",v);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=C.create("canvas","maplibregl-canvas",s),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const d=this._containerDimensions(),m=this._getClampedPixelRatio(d[0],d[1]);this._resizeCanvas(d[0],d[1],m);const y=this._controlContainer=C.create("div","maplibregl-control-container",v),x=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(M=>{x[M]=C.create("div",`maplibregl-ctrl-${M} `,y)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(v,s,d){this._canvas.width=Math.floor(d*v),this._canvas.height=Math.floor(d*s),this._canvas.style.width=`${v}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const v={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let s=null;this._canvas.addEventListener("webglcontextcreationerror",m=>{s={requestedAttributes:v},m&&(s.statusMessage=m.statusMessage,s.type=m.type)},{once:!0});const d=this._canvas.getContext("webgl2",v)||this._canvas.getContext("webgl",v);if(!d){const m="Failed to initialize WebGL";throw s?(s.message=m,new Error(JSON.stringify(s))):new Error(m)}this.painter=new _u(d,this.transform),P.testSupport(d)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(v){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||v,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(v){return this._update(),this._renderTaskQueue.add(v)}_cancelRenderFrame(v){this._renderTaskQueue.remove(v)}_render(v){const s=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(v),this._removed)return;let d=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const y=this.transform.zoom,x=E.now();this.style.zoomHistory.update(y,x);const M=new l.z(y,{now:x,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),I=M.crossFadingFactor();I===1&&I===this._crossFadingFactor||(d=!0,this._crossFadingFactor=I),this.style.update(M)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,s,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new l.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.bf.mark(l.bg.load),this.fire(new l.k("load"))),this.style&&(this.style.hasTransitions()||d)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const m=this._sourcesDirty||this._styleDirty||this._placementDirty;return m||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.k("idle")),!this._loaded||this._fullyLoaded||m||(this._fullyLoaded=!0,l.bf.mark(l.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var v;this._hash&&this._hash.remove();for(const d of this._controls)d.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),le.removeThrottleControl(this._imageQueueHandle),(v=this._resizeObserver)===null||v===void 0||v.disconnect();const s=this.painter.context.gl.getExtension("WEBGL_lose_context");s!=null&&s.loseContext&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),C.remove(this._canvasContainer),C.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),l.bf.clearMetrics(),this._removed=!0,this.fire(new l.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(v=>{l.bf.frame(v),this._frameRequest=null,this._render(v)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(v){this._showTileBoundaries!==v&&(this._showTileBoundaries=v,this._update())}get showPadding(){return!!this._showPadding}set showPadding(v){this._showPadding!==v&&(this._showPadding=v,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(v){this._showCollisionBoxes!==v&&(this._showCollisionBoxes=v,v?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(v){this._showOverdrawInspector!==v&&(this._showOverdrawInspector=v,this._update())}get repaint(){return!!this._repaint}set repaint(v){this._repaint!==v&&(this._repaint=v,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(v){this._vertices=v,this._update()}get version(){return Mm}getCameraTargetElevation(){return this.transform.elevation}},u.MapMouseEvent=Pi,u.MapTouchEvent=Yo,u.MapWheelEvent=vm,u.Marker=Au,u.NavigationControl=class{constructor(v){this._updateZoomButtons=()=>{const s=this._map.getZoom(),d=s===this._map.getMaxZoom(),m=s===this._map.getMinZoom();this._zoomInButton.disabled=d,this._zoomOutButton.disabled=m,this._zoomInButton.setAttribute("aria-disabled",d.toString()),this._zoomOutButton.setAttribute("aria-disabled",m.toString())},this._rotateCompassArrow=()=>{const s=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=s},this._setButtonTitle=(s,d)=>{const m=this._map._getUIString(`NavigationControl.${d}`);s.title=m,s.setAttribute("aria-label",m)},this.options=l.e({},S_,v),this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",s=>s.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",s=>this._map.zoomIn({},{originalEvent:s})),C.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",s=>this._map.zoomOut({},{originalEvent:s})),C.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",s=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:s}):this._map.resetNorth({},{originalEvent:s})}),this._compassIcon=C.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(v){return this._map=v,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new E_(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){C.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(v,s){const d=C.create("button",v,this._container);return d.type="button",d.addEventListener("click",s),d}},u.Popup=class extends l.E{constructor(v){super(),this.remove=()=>(this._content&&C.remove(this._content),this._container&&(C.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new l.k("close"))),this),this._onMouseUp=s=>{this._update(s.point)},this._onMouseMove=s=>{this._update(s.point)},this._onDrag=s=>{this._update(s.point)},this._update=s=>{var d;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=C.create("div","maplibregl-popup",this._map.getContainer()),this._tip=C.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const I of this.options.className.split(" "))this._container.classList.add(I);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Vn(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.wrap(),this._trackPointer&&!s)return;const m=this._flatPos=this._pos=this._trackPointer&&s?s:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&s?s:this._map.transform.locationPoint(this._lngLat));let y=this.options.anchor;const x=Pu(this.options.offset);if(!y){const I=this._container.offsetWidth,O=this._container.offsetHeight;let N;N=m.y+x.bottom.y<O?["top"]:m.y>this._map.transform.height-O?["bottom"]:[],m.x<I/2?N.push("left"):m.x>this._map.transform.width-I/2&&N.push("right"),y=N.length===0?"bottom":N.join("-")}let M=m.add(x[y]);this.options.subpixelPositioning||(M=M.round()),C.setTransform(this._container,`${Ya[y]} translate(${M.x}px,${M.y}px)`),Mu(this._container,y,"popup")},this._onClose=()=>{this.remove()},this.options=l.e(Object.create(Et),v)}addTo(v){return this._map&&this.remove(),this._map=v,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new l.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(v){return this._lngLat=l.N.convert(v),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(v){return this.setDOMContent(document.createTextNode(v))}setHTML(v){const s=document.createDocumentFragment(),d=document.createElement("body");let m;for(d.innerHTML=v;m=d.firstChild,m;)s.appendChild(m);return this.setDOMContent(s)}getMaxWidth(){var v;return(v=this._container)===null||v===void 0?void 0:v.style.maxWidth}setMaxWidth(v){return this.options.maxWidth=v,this._update(),this}setDOMContent(v){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=C.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(v),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(v){return this._container&&this._container.classList.add(v),this}removeClassName(v){return this._container&&this._container.classList.remove(v),this}setOffset(v){return this.options.offset=v,this._update(),this}toggleClassName(v){if(this._container)return this._container.classList.toggle(v)}setSubpixelPositioning(v){this.options.subpixelPositioning=v}_createCloseButton(){this.options.closeButton&&(this._closeButton=C.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const v=this._container.querySelector(Iu);v&&v.focus()}},u.RasterDEMTileSource=Qt,u.RasterTileSource=jt,u.ScaleControl=class{constructor(v){this._onMove=()=>{tc(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,tc(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Is),v)}getDefaultPosition(){return"bottom-left"}onAdd(v){return this._map=v,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-scale",v.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){C.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},u.ScrollZoomHandler=ts,u.Style=nu,u.TerrainControl=class{constructor(v){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=v}onAdd(v){return this._map=v,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=C.create("button","maplibregl-ctrl-terrain",this._container),C.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){C.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},u.TwoFingersTouchPitchHandler=Ha,u.TwoFingersTouchRotateHandler=Ad,u.TwoFingersTouchZoomHandler=Td,u.TwoFingersTouchZoomRotateHandler=Pd,u.VectorTileSource=pr,u.VideoSource=Or,u.addSourceType=(v,s)=>l._(void 0,void 0,void 0,function*(){if(Cs(v))throw new Error(`A source type called "${v}" already exists.`);((d,m)=>{Es[d]=m})(v,s)}),u.clearPrewarmedResources=function(){const v=Ee;v&&(v.isPreloaded()&&v.numActive()===1?(v.release(Nn),Ee=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},u.getMaxParallelImageRequests=function(){return l.a.MAX_PARALLEL_IMAGE_REQUESTS},u.getRTLTextPluginStatus=function(){return Br().getRTLTextPluginStatus()},u.getVersion=function(){return Ld},u.getWorkerCount=function(){return Pn.workerCount},u.getWorkerUrl=function(){return l.a.WORKER_URL},u.importScriptInWorkers=function(v){return Bt().broadcast("IS",v)},u.prewarm=function(){Ze().acquire(Nn)},u.setMaxParallelImageRequests=function(v){l.a.MAX_PARALLEL_IMAGE_REQUESTS=v},u.setRTLTextPlugin=function(v,s){return Br().setRTLTextPlugin(v,s)},u.setWorkerCount=function(v){Pn.workerCount=v},u.setWorkerUrl=function(v){l.a.WORKER_URL=v}});var a=n;return a})})(H1);var Sz=H1.exports;const Ez=wz(Sz),Fp=["#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"],Cr={};async function $p(t="pin4-sm-mi-plumber+f45942.png",e=null){try{const i=t!=null&&t.includes("/")?t:`/api-user/marker_icon/${t}`,r=await e.loadImage(i);if(e.hasImage(t))return;e==null||e.addImage(t,r.data,{sdf:t==null?void 0:t.includes("+sdf")})}catch(n){console.error(n)}}function Cz(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)}`}Cr.point=async(t={},e={},n=null)=>{var E,C,P,D,R,j,W,ee,le,J,Te,xe;e||(e={}),((E=e==null?void 0:e.width)==null?void 0:E[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 i=((C=t.style)==null?void 0:C.colorAttr)||((P=t.style)==null?void 0:P.iconCls);let r={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[a,u]=(r==null?void 0:r.split("-"))||[],l=((D=t.style)==null?void 0:D.color)||"blue";!((R=t.style)!=null&&R.iconAttr)&&(r!=null&&r.includes("{{marker}}"))&&(r=r.replace("{{marker}}","fa-star"));const g="gray",b=(Ae,je)=>`${Ae==null?void 0:Ae.split("+")[0]}+${je.replace("#","")}.png`;if(t.legendAuto={icon:[],color:[]},(j=t.style)!=null&&j.iconAttr&&r){const Ae=(ee=(W=t.meta)==null?void 0:W.columns)==null?void 0:ee.find(De=>{var Ke;return De.name===((Ke=t==null?void 0:t.style)==null?void 0:Ke.iconAttr)}),je=(Ae==null?void 0:Ae.values)||await ct.get(`/api-user/gis-ir/${t.id}/${(le=t.style)==null?void 0:le.iconAttr}`).then(De=>De.data.rows);if(je!=null&&je.length){const De=r.replace("{{color}}",l.length?l:Cz(l)||[0]).split("+")[1].split(/[.-]/)[0];je.forEach((Ke,rt)=>{var Rt;return Ke.icon=(Rt=Ke.icon)!=null&&Rt.includes("png")?Ke.icon:`${a}-${u}-${Ke.data||Ke.icon||`ub-${rt}`}+${r!=null&&r.includes("circle")?"ddd-222":De}.png`}),r=r!=null&&r.includes("{{")?`${a}-${u}-fa-question+0c53ad.png`:r,t.legendAuto.iconText=(Ae==null?void 0:Ae.title)||t.style.iconAttr,je.forEach(Ke=>t.legendAuto.icon.push(Ke)),t.legendAuto.icon.push({icon:r,text:"Не визначено"}),t.style.iconArr=["match",["get",t.style.iconAttr]].concat(je.filter(Ke=>Ke.id).reduce((Ke,rt)=>Ke.concat([rt.id,rt.icon]),[])).concat([r]),await Promise.all(je.map(Ke=>Ke.icon).map(Ke=>$p(Ke,n))),await $p(r,n)}else r=i?"pin6-m-fa-star+{{color}}.png":`pin6-m-fa-star+${l==null?void 0:l.replace("#","")}.png`}if(r!=null&&r.includes("{{color}}")?r=r.replace("{{color}}","222"):e!=null&&e.icon&&e.iconAttr,i){const Ae=(Te=(J=t.meta)==null?void 0:J.columns)==null?void 0:Te.find(De=>De.name===i),je=(Ae==null?void 0:Ae.values)||await ct.get(`/api-user/gis-ir/${t.id}/${i}`).then(De=>De.data.rows);t.style.color=je!=null&&je.length?["match",["get",i]].concat(je.filter(De=>De.id).reduce((De,Ke,rt)=>De.concat([Ke.id,Ke.color||Fp[rt]]),[])).concat(["#aaa"]):l,t.style.colorArr=t.style.color,t.legendAuto.colorText=(Ae==null?void 0:Ae.title)||i,je.forEach(De=>t.legendAuto.color.push(De)),t.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),!((xe=t.style)!=null&&xe.iconAttr)&&!(r!=null&&r.includes("+sdf"))&&r&&(je.forEach((De,Ke)=>De.icon=b(r,De.color||Fp[Ke])),t.style.iconArr=["match",["get",i]].concat(je.filter(De=>De.id).reduce((De,Ke)=>De.concat([Ke.id,Ke.icon]),[])).concat([b(r,g)]),await Promise.all(je.map(De=>De.icon).map(De=>$p(De,n))))}if(r&&!(r!=null&&r.includes("{"))){const Ae=e!=null&&e.colorAttr?b(r,g):r;await $p(Ae,n)}const S=r!=null&&r.includes("sdf")?["interpolate",["linear"],["zoom"],14,.1,18,.2]:["interpolate",["linear"],["zoom"],14,.7,16,1];return e.iconOffset=r!=null&&r.includes("pin")?[0,r!=null&&r.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:(r!=null&&r.includes("+sdf")||!(r!=null&&r.includes("circle"))&&!(r!=null&&r.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],(e==null?void 0:e.strokeWidth)||1,["boolean",["feature-state","hover"],!1],2,(e==null?void 0:e.strokeWidth)||1],"circle-stroke-color":["case",["boolean",["feature-state","select"],!1],(e==null?void 0:e.stroke)||(e==null?void 0:e.color)||"#fff",["boolean",["feature-state","hover"],!1],"maroon",(e==null?void 0:e.stroke)||(e==null?void 0:e.color)||"#fff"],"circle-opacity":(e.iconZoom?["interpolate",["exponential",.5],["zoom"],+e.iconZoom-1,1,+e.iconZoom,r!=null&&r.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!=null&&e.colorAttr&&e.iconArr||r,"icon-allow-overlap":!0,...e.iconOffset?{"icon-offset":e.iconOffset||!1}:{},...S?{"icon-size":S||!1}:{}},paint:{"icon-opacity":["case",["boolean",["feature-state","hover"],!1],.5,["boolean",["feature-state","select"],!1],.5,(r!=null&&r.includes("+sdf")?1:null)||(r!=null&&r.includes("circle")?.6:1)],...r!=null&&r.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}}]:[])},Cr.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"}}],Cr.polygon=async(t={},e={},n=null)=>{var a,u,l,g;const{colorAttr:i}=e,r=((a=t.style)==null?void 0:a.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=${i}`));const b=((l=(u=t.meta)==null?void 0:u.columns.find(S=>S.name===i))==null?void 0:l.values)||await ct.get(`/api-user/gis-ir/${t.id}/${i}`).then(S=>S.data.rows);t.legendAuto={color:[]},b.forEach(S=>t.legendAuto.color.push(S)),t.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),t.style.color=b?["match",["get",i]].concat(b.filter(S=>S.id).reduce((S,E,C)=>S.concat([E.id,E.color||Fp[C]]),[])).concat(["#aaa"]):r}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:(g=t.url)!=null&&g.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]}}]:[])},Cr.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}}]:[]),Cr.linestring=Cr.line,Cr.circle=Cr.point;async function Tz(t,e,n){var l,g,b,S,E,C,P,D,R,j,W,ee;typeof e.style=="string"&&(e.style=e.style[0]==="{"?JSON.parse(e.style):(l=window.YAML.parse(e.style))==null?void 0:l.style),(b=(g=e.style)==null?void 0:g.filter)==null||b.call(g,le=>le.source).forEach(le=>{le.lsource=`${e.id}-${le.source}`});const i=((S=e==null?void 0:e.style)==null?void 0:S.type)||((W=((P=(C=(E=e==null?void 0:e.meta)==null?void 0:E.geom)==null?void 0:C.geometry)==null?void 0:P.length)>2?["point"]:[((j=(R=(D=e==null?void 0:e.meta)==null?void 0:D.geom)==null?void 0:R.geometry)==null?void 0:j[0].toLowerCase())||"point"])==null?void 0:W.map(le=>{var J;return(J=le==null?void 0:le.replace)==null?void 0:J.call(le,"multi","")})),r=Array.isArray(i)?i:[i],a=(await Promise.all(Array.isArray(e==null?void 0:e.style)?e.style.map(async le=>{var J;return(J=Cr[le.type])==null?void 0:J.call(Cr,e,le,n)}):r.map(async le=>{var J;return(J=Cr[le])==null?void 0:J.call(Cr,e,e.style,n)}))).reduce((le,J)=>J?le.concat(J):le,[]);a.forEach((le,J)=>{le.id=`${le.id}-${J}`});const u=a;return(e.service==="vtile"||(ee=e.url)!=null&&ee.includes(".vmt"))&&u.forEach(le=>{le.layout||(le.layout={}),le.layout.visibility="visible",le["source-layer"]=le.lsource||e.data||t}),u}const Mz={data(){return{layerList:[],layerObj:{},colors:Fp,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){e.getStyle().layers.forEach(n=>{n.id.match(t)&&e.moveLayer(n.id)})},getLayersBySourceId(t,e){return e.getStyle().layers.filter(i=>i.id.match(t))},async setVisible(t,e=!0,n={}){const i=typeof t=="object";try{const{style:r,map:a=this.map}=n,u=(t==null?void 0:t.id)||t,l=i?t:await this.getLayerById(u);if(!(l!=null&&l.id))throw new Error("MixinError: Layer has no id");const g=a.getStyle().layers.filter(b=>b.id.match(u));!g.length||r?await this.addToLayers({...l,...(n==null?void 0:n.data)||{},interactive:(l==null?void 0:l.interactive)!==void 0?l==null?void 0:l.interactive:!0,visible:e},{map:a,cb:n==null?void 0:n.onAddLayer}):(this.layerList=this.layerList.map(b=>b.id===l.id?{...b,visible:e}:b),g.forEach(b=>{a.setLayoutProperty(b.id,"visibility",e?"visible":"none")})),n!=null&&n.cb&&await(n==null?void 0:n.cb(l))}catch(r){console.error(r),!n.onAddLayer||n.onAddLayer({data:i?t:{id:t},message:r.message,type:"error"})}},async addToLayers(t,e={}){try{const{map:n=this==null?void 0:this.map}=e;this.layerList.find(r=>r.id===t.id)||(this.layerList=this.layerList.concat(t)),this.layerObj={...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 r=>{r.source===t.id&&await n.setLayoutProperty(r.id,"visibility","none")}),!(e!=null&&e.cb&&(t!=null&&t.visible))||await e.cb({data:t,type:"success"}),this.moveLayers("gl-draw")}catch(n){!e.cb||e.cb({data:t,message:n.message,type:"error"}),console.error(n)}},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{data:n}=await ct.get(t.layer),i={...t,source:t.id,layers:[]};Object.keys(n.sources).forEach(async r=>{await e.addSource(t.id,{type:n.sources[r].type,maxzoom:n.sources[r].maxzoom,url:n.sources[r].url})}),await n.layers.forEach(async r=>{await e.addLayer({...r,source:t.id,id:`${r.id}-${t.id}`}),i.layers=await i.layers.concat(`${r.id}-${t.id}`)})},async addGeojsonLayers(t){const e=n=>{throw this.$notify({type:"error",title:"Відсутня геометрія у обраному шарі",message:n,position:"bottom-right"}),this.layerList=this.layerList.filter(i=>i.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 ct.get((t==null?void 0:t.geojson)||(t==null?void 0:t.url)),i=await n.data;if(n.statusText==="OK")this.createGeometryLayer({data:t,geojson:i},"geojson");else throw new Error((i==null?void 0:i.message)||(n==null?void 0:n.statusText)||"Error addGeojson layer")}catch(n){e(n.message),console.error(n)}},async createGeometryLayer({data:t,geojson:e},n){var l,g,b,S,E;const{map:i}=this,r=await Tz(t.id,this.layerList.find(C=>C.id==t.id),i),a={type:n,cluster:((l=t==null?void 0:t.style)==null?void 0:l.cluster)||!1,clusterMaxZoom:((g=t==null?void 0:t.style)==null?void 0:g.clusterMaxZoom)||14};n==="vector"&&(a.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}`:""}${(b=t==null?void 0:t.style)!=null&&b.pointZoom?`&pointZoom=${t.style.pointZoom}`:""}`]),n==="geojson"&&(a.data=e||`${window.location.origin}${(t==null?void 0:t.geojson)||(t==null?void 0:t.url)}`),i.addSource(t.id,a),r.forEach(C=>{var D;const P={...C,source:t.id,maxzoom:+(C==null?void 0:C.maxzoom)||24,minzoom:+(C==null?void 0:C.minzoom)||0,cluster:!1,clusterMaxZoom:2};i.addLayer(P),i.moveLayer(C.id),(D=C==null?void 0:C.layout)!=null&&D["text-field"]||this.apiLayersHover(C.id,t.id,i),this.addedLayersSettings=this.addedLayersSettings.concat(P)});const u=r.map(C=>C.type).filter(C=>C&&C!=="symbol");(E=(S=t==null?void 0:t.meta)==null?void 0:S.geom)!=null&&E.geometry&&t.meta.geom.geometry.filter(P=>!u.includes(this.geometryByType(P,!0))).forEach(P=>{this.createStyleObj({type:P,style:t.style},t.id)})},async setStyle(t,e,n=this.map){const i=(t==null?void 0:t.id)||t;n.getStyle().layers.forEach(a=>{a.source===i&&n.removeLayer(a.id)}),n.getSource(i)&&(n==null||n.removeSource(i)),this.layerList=this.layerList.map(a=>(a.id===i&&(a.style=e),a));const r=this.layerList.find(a=>a.id===i);this.addToLayers(r)},setLayerData({source:t,data:e}){const n=(t==null?void 0:t.id)||t;this.layerList=this.layerList.map(i=>i.id===n?{...i,...e}:i),this.layerObj={...this.layerObj,[t]:{...this.layerObj[t],...e}}},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(i=>i.id!==n),await e.getStyle().layers.forEach(async i=>{i.source===n&&await e.removeLayer(i.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(i=>{i.id===n&&e.removeLayer(i.id)}),await e.removeSource(n),await this.setVisible(t,!0)},async setFilter(t,e){const n=this.layerObj[t],i=await this.map.getSource(t);if(n.service==="vtile")await i.setTiles([`${window.location.origin}${n.geojson||n.url}${n.url.includes("?")?"&":"?"}filter=${e}${n.props?`&props=${n.props}`:""}`]);else if(n.service==="geojson"){const{data:r}=await ct.get((n==null?void 0:n.geojson)||`${n==null?void 0:n.url}?filter=${e}`);await this.map.getSource(t).setData(r)}},async getLayerById(t,e=null){var i;const n=(t==null?void 0:t.id)||t;try{const r=(i=this.layerList)==null?void 0:i.find(u=>u.id===n);if(r)return r;const a=await ct.get(`/api-user/gis-ir/${n}${t!=null&&t.service?`?service=${t==null?void 0:t.service}`:""}`);if(a.statusText==="OK"){const u=await a.data;return!e||await e(u),u}return this.$notify({type:"warning",message:`Шар ${n} не було знайдено!`}),null}catch(r){this.$notify({type:"warning",message:`Шар ${n} не було знайдено!`}),console.error(r)}},createStyleObj({type:t,style:e},n){const i=this.geometryByType(t,!0);if(!i)throw Error("Geomery type ERROR: Error adding missing layers");const r=`${n}-${i}`;if(this.map.getStyle().layers.find(u=>u.id===r))return;const a={id:r,type:i,source:n,"source-layer":n,layout:{},paint:{[`${i}-color`]:["case",["boolean",["feature-state","hover"],!1],"red",(e==null?void 0:e.color)||"#444e3d"],[`${i}-opacity`]:e!=null&&e.opacity||i==="fill"?.5:1},filter:["all",["==",["geometry-type"],this.geometryByType(t)]]};this.map.addLayer(a),this.addedLayersSettings=this.addedLayersSettings.concat(a),this.apiLayersHover(r,n,this.map)},apiLayersHover(t,e,n){const i=n.getSource(e),r=()=>{const a={source:e,id:this.hoveredFeatureId};return i.type==="vector"&&(a.sourceLayer=e),a};n.on("mousemove",t,a=>{a.features.length>0&&(this.hoveredFeatureId!==null&&n.setFeatureState(r(),{hover:!1}),this.hoveredFeatureId=a.features[0].id,n.setFeatureState(r(),{hover:!0}))}),n.on("mouseleave",t,()=>{this.hoveredFeatureId!==null&&n.setFeatureState(r(),{hover:!1}),this.hoveredFeatureId=null})},async changeBaseLayer(t,e=!0,n=!0){await this.setVisible(t,e);const i=(t==null?void 0:t.id)||t;i!==this.activeLayer&&(n&&this.activeLayer&&await this.setVisible(this.activeLayer,!1),this.map.getStyle().layers.forEach(r=>{r.source!==i&&r.type!=="background"&&this.map.moveLayer(r.id)}),this.activeLayer=i)},async refreshLayer(t,e=this.map){const n=(t==null?void 0:t.id)||t;await e.getStyle().layers.forEach(i=>{i.source===n&&e.removeLayer(i.id)}),await e.removeSource(n),this.layers=await this.layers.filter(i=>i.id!==n),await this.setVisible(typeof t=="object"?t:n)}}},Az={props:{objectData:{type:Array,default:()=>[]},object:{type:Object,default:()=>null},mapRef:{type:Object,default:()=>null}},computed:{currentLayer(){var n;const t=(n=this.object)==null?void 0:n.source;return this.mapRef.layerObj[t]},popupPosition(){var e,n,i;return((i=(n=(e=this.currentLayer)==null?void 0:e.setting)==null?void 0:n.popup)==null?void 0:i.position)||"horizontal"},popupWidth(){var e,n,i;return`${((i=(n=(e=this.currentLayer)==null?void 0:e.setting)==null?void 0:n.popup)==null?void 0:i.width)||240}px`},popupRows(){return this.objectData.filter(t=>t.column!=="image")},positionIsVertical(){return this.popupPosition==="vertical"}},methods:{rowValue(t){return t.value},rowTitle(t){return t.title}}},Iz={key:0,class:"vsTailwind map-popup__vertical"},Pz={class:"mb-1"},Dz={class:"text-sm"},Oz={key:1,class:"map__popup-body"},zz=["innerHTML"],Bz={key:1};function Nz(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",{class:"map-popup",style:f.normalizeStyle({"max-width":a.popupWidth,width:a.popupWidth})},[a.positionIsVertical?(f.openBlock(),f.createElementBlock("div",Iz,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.popupRows,u=>(f.openBlock(),f.createElementBlock("div",{class:"border-b py-1 last:border-none last:pt-1 last:pb-0",key:a.rowTitle(u)},[f.createElementVNode("strong",Pz,f.toDisplayString(a.rowTitle(u)),1),f.createElementVNode("div",Dz,f.toDisplayString(a.rowValue(u)),1)]))),128))])):(f.openBlock(),f.createElementBlock("table",Oz,[f.createElementVNode("tbody",null,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.popupRows,u=>f.withDirectives((f.openBlock(),f.createElementBlock("tr",{key:a.rowTitle(u),class:"map__popup-body-item"},[f.createElementVNode("td",null,f.toDisplayString(a.rowTitle(u)),1),a.rowValue(u)?(f.openBlock(),f.createElementBlock("td",{key:0,innerHTML:a.rowValue(u)},null,8,zz)):(f.openBlock(),f.createElementBlock("td",Bz,e[0]||(e[0]=[f.createElementVNode("div",{class:"text-red-500"}," Не визначено ",-1)])))])),[[f.vShow,!a.rowValue(u).includes("id")]])),128))])]))],4)}const Rz=$e(Az,[["render",Nz],["__scopeId","data-v-3f5a9aff"]]),q1={width:200,show:!0,position:"horizontal"},Lz={components:{VsPopupBody:Rz},props:{aviableFields:{type:Array,default:()=>[]},mapRef:{type:[Object,Array],default:()=>{}},object:{type:[Object,Array],default:()=>{}}},data(){return{objectData:[],popupSettings:q1}},computed:{getImage(){return this.objectData.find(t=>t.column==="image")||null},currentLayer(){var t;return(t=this.$parent.layerList)==null?void 0:t.find(e=>{var n;return(e==null?void 0:e.id)===((n=this.object)==null?void 0:n.source)})}},watch:{async object(t,e){t!==null&&(t==null?void 0:t.id)!==(e==null?void 0:e.id)||!(t!=null&&t.id)?await this.getFormatObject(t):t===null&&(this.objectData=[])}},methods:{async getFormatObject(t){var g,b,S,E,C,P;if(!t)return;const e=Object.keys(t.properties).filter(D=>!D.match("__text")&&!["id"].includes(D)),{currentLayer:n}=this;if((g=n==null?void 0:n.setting)!=null&&g.popup&&(this.popupSettings=(n==null?void 0:n.setting.popup)||q1),!(n!=null&&n.meta)){const D=e.map(R=>({title:R,value:t.properties[R]}));this.objectData=[...D,{value:((b=t.properties)==null?void 0:b.image)||"",title:"Фото",column:"image"}];return}const i=n.meta.columns,r=e.map(D=>{var le,J,Te,xe;const R={},W=Object.assign({values:[]},i.find(Ae=>Ae.name===D));typeof W.values!="object"&&console.warn(`Warning: Layer ${t.source} has key "values" which is not an object in meta!`);const ee=W!=null&&W.values&&((le=W==null?void 0:W.values)==null?void 0:le.find(Ae=>(Ae==null?void 0:Ae.id)==t.properties[D]))||null;return R.value=(W==null?void 0:W.format)==="select"?this.formatBadge({text:(ee==null?void 0:ee.text)||((J=t.properties)==null?void 0:J[`${D}__text`])||((Te=t.properties)==null?void 0:Te[D])||"-",color:(ee==null?void 0:ee.color)||"#1989FA"}):(ee==null?void 0:ee.text)||((xe=t.properties)==null?void 0:xe[`${D}__text`])||t.properties[D],R.column=D,R.title=(W==null?void 0:W[window==null?void 0:window.lang])||(W==null?void 0:W.ua)||(W==null?void 0:W.title)||D,R});this.objectData=[...r,{value:((S=t.properties)==null?void 0:S.image)||"",title:"Фото",column:"image"}];const a=(C=(E=n==null?void 0:n.setting)==null?void 0:E.popup)==null?void 0:C.popup,u=typeof a=="string"?a==null?void 0:a.split(","):a,l=[...this.aviableFields,...((P=n==null?void 0:n.popup)==null?void 0:P.split(","))||[],...u||[]];this.objectData=l.length?this.objectData.filter(D=>l.includes(D.column)||l.includes(D.title)):[]},noInfoObject(){var i,r,a,u,l;if(!this.object)return"Інформація відсутня";const{currentLayer:t}=this,e=((r=(i=t==null?void 0:t.meta)==null?void 0:i.columns)==null?void 0:r.find(g=>(g==null?void 0:g.meta)==="title"))||((a=t==null?void 0:t.meta)==null?void 0:a.columns[0])||null;return{title:(t==null?void 0:t.name)||(t==null?void 0:t.id)||((u=this.object)==null?void 0:u.sourceLayer)||((l=this.object)==null?void 0:l.source)||"Дані по шару не знайдено",column:e}},formatBadge(t){const e=(t==null?void 0:t.text)||"-";return t!=null&&t.color?`<span >${e}</span>`:e}}},Vz={key:0},Fz={key:0},$z=["src","alt"],jz={key:1},Uz={class:"text-left text-sm m-b-sm"},Hz={key:1,class:"text-center"};function qz(t,e,n,i,r,a){var l,g,b,S,E,C,P,D,R,j,W;const u=f.resolveComponent("VsPopupBody");return f.openBlock(),f.createElementBlock("div",{class:f.normalizeClass((((l=r.popupSettings)==null?void 0:l.position)||"horizontal")+"-position")},[r.objectData.filter(ee=>ee.column!=="image").length?(f.openBlock(),f.createElementBlock("div",Vz,[a.getImage&&((g=a.getImage)!=null&&g.value)?(f.openBlock(),f.createElementBlock("div",Fz,[f.createElementVNode("img",{class:"popup-image",src:"files/"+a.getImage.value,alt:a.getImage.column},null,8,$z)])):f.createCommentVNode("",!0),f.createVNode(u,{"object-data":r.objectData,object:n.object,mapRef:n.mapRef},null,8,["object-data","object","mapRef"])])):(f.openBlock(),f.createElementBlock("div",jz,[(b=a.noInfoObject())!=null&&b.column?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[f.createElementVNode("b",Uz,f.toDisplayString(a.noInfoObject().title),1),f.createElementVNode("div",null,[f.createElementVNode("b",null,f.toDisplayString(((E=(S=a.noInfoObject())==null?void 0:S.column)==null?void 0:E.ua)||((P=(C=a.noInfoObject())==null?void 0:C.column)==null?void 0:P.title))+":",1),f.createTextVNode(" "+f.toDisplayString(((W=(D=n.object)==null?void 0:D.properties)==null?void 0:W[(j=(R=a.noInfoObject())==null?void 0:R.column)==null?void 0:j.name])||"-"),1)])],64)):(f.openBlock(),f.createElementBlock("div",Hz,f.toDisplayString(a.noInfoObject().title),1))]))],2)}const Wz=$e(Lz,[["render",qz],["__scopeId","data-v-deb51e0a"]]),{Map:Gz,NavigationControl:Zz,Popup:Yz}=Ez,Xz={mixins:[Mz],components:{VsMapPopup:Wz},props:{popupVisible:{type:Boolean,default:()=>!0},map:{type:Object,default:()=>null},height:{type:String,default:()=>"400px"}},data(){return{mapId:`gis-map-${Math.floor(Math.random()*1e3)}`,features:[],popup:{geometry:null,map:null},cityBbox:null}},async mounted(){this.initMap()},computed:{mapRef(){return this}},methods:{initMap(){const t={version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{},layers:[]},e=new Gz({container:this.mapId,style:t,center:[0,0],zoom:1,interactive:!0});e.addControl(new Zz({visualizePitch:!0})),window==null||window.addEventListener("resize",()=>{e.resize()}),e.on("load",this.onMapLoad)},async onMapLoad(t){const e=t.target;e.resize();const n={id:"graymap",name:"Сіра карта",url:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",attribution:"© <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, © <a href='https://carto.com/attributions'>CARTO</a>",bounds1:"ua",image:"https://basemaps.cartocdn.com/light_all/10/601/348.png",position:0,owner:"OSM",basemap:!0};await this.$emit("update:map",e),await this.setVisible(n,!0),this.$emit("load",e),this.createPopup(),this.createBoundsLayers(),this.createAtuLayer()},createPopup(){var n,i,r,a,u,l;const{map:t}=this,e=["measure","geometry","mapbox-gl-draw-hot","mapbox-gl-draw-cold"];this.popup.map=new Yz({closeOnClick:!1}).setDOMContent((i=(n=this==null?void 0:this.$refs)==null?void 0:n.popup)==null?void 0:i.$el),t&&(t.on("mousemove",g=>{var S,E;const b=t.queryRenderedFeatures(g.point).filter(C=>{var R,j,W;const P=this.layerList.find(ee=>ee.id===C.source),D=((j=(R=P==null?void 0:P.setting)==null?void 0:R.popup)==null?void 0:j.show)===void 0?!0:P.setting.popup.show;if((this.interactiveSources.includes(C.source)&&!((W=C.properties)!=null&&W.cluster)&&D||!P&&Object.keys(C.properties).length)&&!e.includes(C.source))return C}).filter(C=>{var P,D;return!((D=(P=C.layer)==null?void 0:P.layout)!=null&&D["text-field"])});b.length&&this.popupVisible?(this.features=(b==null?void 0:b[0])||null,(S=this.popup.map)==null||S.setLngLat(Object.values(g.lngLat)).addTo(t),t.getCanvas().style.cursor=b.length?"pointer":"grab"):(this.features=null,(E=this.popup.map)==null||E.remove()),this.$emit("mouseMove",{event:g,features:b})}),t.on("touchend",this.handleMapClick),t.on("click",this.handleMapClick),t.on("dblclick",g=>{const b=t.queryRenderedFeatures(g.point);this.$emit("dbclick",{features:b,event:g})}),(l=(u=(a=(r=this==null?void 0:this.$refs)==null?void 0:r.popup)==null?void 0:a.$el)==null?void 0:u.parentElement)==null||l.addEventListener("mouseenter",()=>{var g;(g=this.popup.map)==null||g.remove()}))},createBoundsLayers(){const{map:t}=this;t&&(t.addSource("bounds-dataset",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),t.addLayer({id:"bounds-dataset-line",type:"line",source:"bounds-dataset",layout:{},paint:{"line-color":"#a91a9e","line-width":2}}))},handleMapClick(t){if(!this.map)return;const e=this.map.queryRenderedFeatures(t.point);if(!e.length)return;const n=e.filter(i=>this.interactiveSources.includes(i==null?void 0:i.source));this.$emit("mapClick",n)},homeZoom(){const{map:t}=this,e=this.cityBbox?this.cityBbox:[22.1352,44.3909,40.2276,52.3791];t==null||t.fitBounds(e,{duration:0,padding:10})}}},Kz={class:"relative"},Jz=["id"];function Qz(t,e,n,i,r,a){const u=f.resolveComponent("VsMapPopup");return f.openBlock(),f.createElementBlock("div",Kz,[f.createElementVNode("div",{id:r.mapId,style:f.normalizeStyle({height:n.height})},null,12,Jz),f.createVNode(u,{ref:"popup",object:r.features,"map-ref":a.mapRef},null,8,["object","map-ref"])])}const eB=$e(Xz,[["render",Qz]]),Qs="widget-map-source",tB={components:{VsMap:eB},props:{geometry:{type:Object,default:()=>null},zoom:{type:String,default:()=>"50"}},data(){return{map:null}},mounted(){this.geometry&&this.initGeometryLayer()},watch:{geometry(){console.log(this.zoom),this.initGeometryLayer()}},methods:{initMap(){this.geometry&&this.map&&this.initGeometryLayer()},handleMapLoad(){this.initMap()},initGeometryLayer(){const{map:t}=this;if(!t)return;const e=this.formatGeojson(this.geometry),n=t.getSource(Qs);if(this.zoomToGeometry(e),n){n.setData(e);return}t.addSource(Qs,{type:"geojson",data:e}),t.addLayer({id:`${Qs}-point`,type:"circle",source:Qs,paint:{"circle-radius":10,"circle-color":"#F84C4C"},filter:["==","$type","Point"]}),t.addLayer({id:`${Qs}-polygon`,type:"fill",source:Qs,layout:{},paint:{"fill-color":"#0080ff","fill-opacity":.5},filter:["==","$type","Polygon"]}),t.addLayer({id:`${Qs}-polygon-line`,type:"line",source:Qs,layout:{},paint:{"line-color":"#0080ff","line-width":2},filter:["==","$type","Polygon"]}),t.addLayer({id:`${Qs}-line`,type:"line",source:Qs,layout:{},paint:{"line-color":"#0080ff","line-width":3},filter:["==","$type","LineString"]})},formatGeojson(t){let e=t;const n=t==null?void 0:t.type;if(Array.isArray(t))return U1(t);if(!n)throw new Error("Unknown geometry type!");return n==="FeatureCollection"?t:(n==="Feature"&&(e=[t]),!["FeatureCollection","Feature"].includes(n)&&(e=[kz(t)]),U1(e))},zoomToGeometry(t){const{map:e}=this,n=xz(t);e.fitBounds(n,{zoom:this.zoom,padding:30,duration:0})}}};function nB(t,e,n,i,r,a){const u=f.resolveComponent("VsMap");return f.openBlock(),f.createElementBlock("div",null,[f.createVNode(u,{map:r.map,"onUpdate:map":e[0]||(e[0]=l=>r.map=l),onLoad:a.handleMapLoad},null,8,["map","onLoad"])])}const W1=$e(tB,[["render",nB]]),at=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),ay=function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,n=window.getComputedStyle(t).overflowY,i=n.indexOf("hidden")!==-1,r=n.indexOf("visible")!==-1;return e&&!i&&!r},jp=function(t,e=void 0){return!(!t||t===document.body||e&&t===e)&&(ay(t)?t:jp(t.parentElement,e))},eo=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},ly=t=>`${t||""}`.split(" ").filter(e=>!!e),to=(t,e,n)=>{t&&ly(e).forEach(i=>{t.classList.toggle(i,n||!1)})};class Ec{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 Cc={passive:!1};class iB{constructor(e,{start:n=()=>!0,move:i=()=>{},end:r=()=>{}}){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=i,this.endCallback=r;for(const a of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[a]=this[a].bind(this);this.element.addEventListener("mousedown",this.onPointerStart,Cc),this.element.addEventListener("touchstart",this.onTouchStart,Cc),this.element.addEventListener("touchmove",this.onMove,Cc),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd)}onPointerStart(e){if(!e.buttons||e.button!==0)return;const n=new Ec(e);this.currentPointers.some(i=>i.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 Ec(n),e);window.addEventListener("blur",this.onWindowBlur)}onMove(e){const n=this.currentPointers.slice(),i="changedTouches"in e?Array.from(e.changedTouches||[]).map(a=>new Ec(a)):[new Ec(e)],r=[];for(const a of i){const u=this.currentPointers.findIndex(l=>l.id===a.id);u<0||(r.push(a),this.currentPointers[u]=a)}r.length&&this.moveCallback(e,this.currentPointers.slice(),n)}onPointerEnd(e){e.buttons>0&&e.button!==0||(this.triggerPointerEnd(e,new Ec(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 Ec(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 i=this.currentPointers.findIndex(r=>r.id===n.id);i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,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,Cc),this.element.removeEventListener("touchstart",this.onTouchStart,Cc),this.element.removeEventListener("touchmove",this.onMove,Cc),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 G1(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function Z1(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const cy=t=>typeof t=="object"&&t!==null&&t.constructor===Object&&Object.prototype.toString.call(t)==="[object Object]",Tr=(t,...e)=>{const n=e.length;for(let i=0;i<n;i++){const r=e[i]||{};Object.entries(r).forEach(([a,u])=>{const l=Array.isArray(u)?[]:{};t[a]||Object.assign(t,{[a]:l}),cy(u)?Object.assign(t[a],Tr(l,u)):Array.isArray(u)?Object.assign(t,{[a]:[...u]}):Object.assign(t,{[a]:u})})}return t},uy=function(t,e){return t.split(".").reduce((n,i)=>typeof n=="object"?n[i]:void 0,e)};class Up{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?Tr({},this.constructor.defaults,e):{};for(const[n,i]of Object.entries(this.option("on")||{}))this.on(n,i)}option(e,...n){let i=uy(e,this.options);return i&&typeof i=="function"&&(i=i.call(this,this,...n)),i}optionFor(e,n,i,...r){let a=uy(n,e);var u;typeof(u=a)!="string"||isNaN(u)||isNaN(parseFloat(u))||(a=parseFloat(a)),a==="true"&&(a=!0),a==="false"&&(a=!1),a&&typeof a=="function"&&(a=a.call(this,this,e,...r));let l=uy(n,this.options);return l&&typeof l=="function"?a=l.call(this,this,e,...r,a):a===void 0&&(a=l),a===void 0?i:a}cn(e){const n=this.options.classes;return n&&n[e]||""}localize(e,n=[]){e=String(e).replace(/\{\{(\w+).?(\w+)?\}\}/g,(i,r,a)=>{let u="";return a?u=this.option(`${r[0]+r.toLowerCase().substring(1)}.l10n.${a}`):r&&(u=this.option(`l10n.${r}`)),u||(u=i),u});for(let i=0;i<n.length;i++)e=e.split(n[i][0]).join(n[i][1]);return e=e.replace(/\{\{(.*?)\}\}/g,(i,r)=>r)}on(e,n){let i=[];typeof e=="string"?i=e.split(" "):Array.isArray(e)&&(i=e),this.events||(this.events=new Map),i.forEach(r=>{let a=this.events.get(r);a||(this.events.set(r,[]),a=[]),a.includes(n)||a.push(n),this.events.set(r,a)})}off(e,n){let i=[];typeof e=="string"?i=e.split(" "):Array.isArray(e)&&(i=e),i.forEach(r=>{const a=this.events.get(r);if(Array.isArray(a)){const u=a.indexOf(n);u>-1&&a.splice(u,1)}})}emit(e,...n){[...this.events.get(e)||[]].forEach(i=>i(this,...n)),e!=="*"&&this.emit("*",e,...n)}}Object.defineProperty(Up,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(Up,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class hy extends Up{constructor(e={}){super(e),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(e={}){const n=new Map;for(const[i,r]of Object.entries(e)){const a=this.option(i),u=this.plugins[i];u||a===!1?u&&a===!1&&(u.detach(),delete this.plugins[i]):n.set(i,new r(this,a||{}))}for(const[i,r]of n)this.plugins[i]=r,r.attach()}detachPlugins(e){e=e||Object.keys(this.plugins);for(const n of e){const i=this.plugins[n];i&&i.detach(),delete this.plugins[n]}return this.emit("detachPlugins"),this}}var In;(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"})(In||(In={}));const Po=["a","b","c","d","e","f"],Y1={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"},rB={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:Y1},X1='<circle cx="25" cy="25" r="20"></circle>',dy='<div class="f-spinner"><svg viewBox="0 0 50 50">'+X1+X1+"</svg></div>",Mr=t=>t&&t!==null&&t instanceof Element&&"nodeType"in t,En=(t,e)=>{t&&ly(e).forEach(n=>{t.classList.remove(n)})},Ct=(t,e)=>{t&&ly(e).forEach(n=>{t.classList.add(n)})},Hp={a:1,b:0,c:0,d:1,e:0,f:0},sB=1e5,qp=1e4,ps="mousemove",K1="drag",J1="content",fs="auto";let py=null,fy=null;class ua extends hy{get fits(){return this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1}get isTouchDevice(){return fy===null&&(fy=window.matchMedia("(hover: none)").matches),fy}get isMobile(){return py===null&&(py=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),py}get panMode(){return this.options.panMode!==ps||this.isTouchDevice?K1:ps}get panOnlyZoomed(){const e=this.options.panOnlyZoomed;return e===fs?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,i=Math.max(e.height/n.fitHeight,e.width/n.fitWidth)||1;return Math.min(this.fullScale,i)}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 Po){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={},i={}){var r;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:In.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({},Hp)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},Hp)}),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({},ua.Plugins),i)),this.emit("attachPlugins"),this.emit("init");const a=this.content;if(a.addEventListener("load",this.onLoad),a.addEventListener("error",this.onError),this.isContentLoading){if(this.option("spinner")){e.classList.add(this.cn("isLoading"));const u=eo(dy);!e.contains(a)||a.parentElement instanceof HTMLPictureElement?this.spinner=e.appendChild(u):this.spinner=((r=a.parentElement)===null||r===void 0?void 0:r.insertBefore(u,a))||null}this.emit("beforeLoad")}else queueMicrotask(()=>{this.enable()})}initContent(){const{container:e}=this,n=this.cn(J1);let i=this.option(J1)||e.querySelector(`.${n}`);if(i||(i=e.querySelector("img,picture")||e.firstElementChild,i&&Ct(i,n)),i instanceof HTMLPictureElement&&(i=i.querySelector("img")),!i)throw new Error("No content found");this.content=i}onLoad(){const{spinner:e,container:n,state:i}=this;e&&(e.remove(),this.spinner=null),this.option("spinner")&&n.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),i===In.Init?this.enable():this.updateMetrics()}onError(){this.state!==In.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=In.Error,this.emit("error"))}getNextScale(e){const{fullScale:n,targetScale:i,coverScale:r,maxScale:a,minScale:u}=this;let l=u;switch(e){case"toggleMax":l=i-u<.5*(a-u)?a:u;break;case"toggleCover":l=i-u<.5*(r-u)?r:u;break;case"toggleZoom":l=i-u<.5*(n-u)?n:u;break;case"iterateZoom":let g=[1,n,a].sort((S,E)=>S-E),b=g.findIndex(S=>S>i+1e-5);l=g[b]||1}return l}attachObserver(){var e;const n=()=>{const{container:i,containerRect:r}=this;return Math.abs(r.width-i.getBoundingClientRect().width)>.1||Math.abs(r.height-i.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 iB(e,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener(ps,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(ps,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 i of Po)e?(this.velocity[i]*=1-e,n&&!this.isScaling&&(this.velocity[i]=Math.max(Math.min(this.velocity[i],n),-1*n)),this.current[i]+=this.velocity[i]):this.current[i]=this.target[i];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame(()=>this.animate()):this.stop("current")}setTargetForce(){for(const e of Po)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:i}=this,r=i.e+e,a=i.f+n,u=this.getBounds(),{x:l,y:g}=u,b=l.min,S=l.max,E=g.min,C=g.max;let P=0,D=0;return b!==1/0&&r<b?P=b-r:S!==1/0&&r>S&&(P=S-r),E!==1/0&&a<E?D=E-a:C!==1/0&&a>C&&(D=C-a),Math.abs(P)<1e-4&&(P=0),Math.abs(D)<1e-4&&(D=0),Object.assign(Object.assign({},u),{xDiff:P,yDiff:D,inBounds:!P&&!D})}clampTargetBounds(){const{target:e}=this,{x:n,y:i}=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)),i.min!==1/0&&(e.f=Math.max(e.f,i.min)),i.max!==1/0&&(e.f=Math.min(e.f,i.max))}calculateContentDim(e=this.current){const{content:n,contentRect:i}=this,{fitWidth:r,fitHeight:a,fullWidth:u,fullHeight:l}=i;let g=u,b=l;if(this.option("zoom")||this.angle!==0){const S=!(n instanceof HTMLImageElement)&&(window.getComputedStyle(n).maxWidth==="none"||window.getComputedStyle(n).maxHeight==="none"),E=S?u:r,C=S?l:a,P=this.getMatrix(e),D=new DOMPoint(0,0).matrixTransform(P),R=new DOMPoint(0+E,0).matrixTransform(P),j=new DOMPoint(0+E,0+C).matrixTransform(P),W=new DOMPoint(0,0+C).matrixTransform(P),ee=Math.abs(j.x-D.x),le=Math.abs(j.y-D.y),J=Math.abs(W.x-R.x),Te=Math.abs(W.y-R.y);g=Math.max(ee,J),b=Math.max(le,Te)}return{contentWidth:g,contentHeight:b}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||this.panMode===ps||this.targetScale<this.scale)return this.isBouncingX=!1,void(this.isBouncingY=!1);const{target:e}=this,{x:n,y:i,xDiff:r,yDiff:a}=this.checkBounds(),u=this.option("maxVelocity");let l=this.velocity.e,g=this.velocity.f;r!==0?(this.isBouncingX=!0,r*l<=0?l+=.14*r:(l=.14*r,n.min!==1/0&&(this.target.e=Math.max(e.e,n.min)),n.max!==1/0&&(this.target.e=Math.min(e.e,n.max))),u&&(l=Math.max(Math.min(l,u),-1*u))):this.isBouncingX=!1,a!==0?(this.isBouncingY=!0,a*g<=0?g+=.14*a:(g=.14*a,i.min!==1/0&&(this.target.f=Math.max(e.f,i.min)),i.max!==1/0&&(this.target.f=Math.min(e.f,i.max))),u&&(g=Math.max(Math.min(g,u),-1*u))):this.isBouncingY=!1,this.isBouncingX&&(this.velocity.e=l),this.isBouncingY&&(this.velocity.f=g)}enable(){const{content:e}=this,n=new DOMMatrixReadOnly(window.getComputedStyle(e).transform);for(const i of Po)this.current[i]=this.target[i]=n[i];this.updateMetrics(),this.attachObserver(),this.attachEvents(),this.state=In.Ready,this.emit("ready")}onClick(e){var n;e.type==="click"&&e.detail===0&&(this.dragOffset.x=0,this.dragOffset.y=0),this.isDragging&&((n=this.pointerTracker)===null||n===void 0||n.clear(),this.trackingPoints=[],this.startDecelAnim());const i=e.target;if(!i||e.defaultPrevented)return;if(i.hasAttribute("disabled"))return e.preventDefault(),void e.stopPropagation();if((()=>{const P=window.getSelection();return P&&P.type==="Range"})()&&!i.closest("button"))return;const r=i.closest("[data-panzoom-action]"),a=i.closest("[data-panzoom-change]"),u=r||a,l=u&&Mr(u)?u.dataset:null;if(l){const P=l.panzoomChange,D=l.panzoomAction;if((P||D)&&e.preventDefault(),P){let R={};try{R=JSON.parse(P)}catch{console&&console.warn("The given data was not valid JSON")}return void this.applyChange(R)}if(D)return void(this[D]&&this[D]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return e.preventDefault(),void e.stopPropagation();if(i.closest("[data-fancybox]"))return;const g=this.content.getBoundingClientRect(),b=this.dragStart;if(b.time&&!this.canZoomOut()&&(Math.abs(g.x-b.x)>2||Math.abs(g.y-b.y)>2))return;this.dragStart.time=0;const S=P=>{this.option("zoom",e)&&P&&typeof P=="string"&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(P)&&typeof this[P]=="function"&&(e.preventDefault(),this[P]({event:e}))},E=this.option("click",e),C=this.option("dblClick",e);C?(this.clicks++,this.clicks==1&&(this.clickTimer=setTimeout(()=>{this.clicks===1?(this.emit("click",e),!e.defaultPrevented&&E&&S(E)):(this.emit("dblClick",e),e.defaultPrevented||S(C)),this.clicks=0,this.clickTimer=null},350))):(this.emit("click",e),!e.defaultPrevented&&E&&S(E))}addTrackingPoint(e){const n=this.trackingPoints.filter(i=>i.time>Date.now()-100);n.push(e),this.trackingPoints=n}onPointerDown(e,n,i){var r;if(this.option("touch",e)===!1)return!1;this.pwt=0,this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const a=this.content.getBoundingClientRect();if(this.dragStart={x:a.x,y:a.y,top:a.top,left:a.left,time:Date.now()},this.clickTimer)return!1;if(this.panMode===ps&&this.targetScale>1)return e.preventDefault(),e.stopPropagation(),!1;const u=e.composedPath()[0];if(!i.length){if(["TEXTAREA","OPTION","INPUT","SELECT","VIDEO","IFRAME"].includes(u.nodeName)||u.closest("[contenteditable],[data-selectable],[data-draggable],[data-clickable],[data-panzoom-change],[data-panzoom-action]"))return!1;(r=window.getSelection())===null||r===void 0||r.removeAllRanges()}if(e.type==="mousedown")["A","BUTTON"].includes(u.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,i){if(this.option("touch",e)===!1||!this.isDragging||n.length<2&&this.panOnlyZoomed&&at(this.targetScale)<=at(this.minScale)||(this.emit("touchMove",e),e.defaultPrevented))return;this.addTrackingPoint(n[0]);const{content:r}=this,a=Z1(i[0],i[1]),u=Z1(n[0],n[1]);let l=0,g=0;if(n.length>1){const le=r.getBoundingClientRect();l=a.clientX-le.left-.5*le.width,g=a.clientY-le.top-.5*le.height}const b=G1(i[0],i[1]),S=G1(n[0],n[1]);let E=b?S/b:1,C=u.clientX-a.clientX,P=u.clientY-a.clientY;this.dragOffset.x+=C,this.dragOffset.y+=P,this.dragOffset.time=Date.now()-this.dragStart.time;let D=at(this.targetScale)===at(this.minScale)&&this.option("lockAxis");if(D&&!this.lockedAxis)if(D==="xy"||D==="y"||e.type==="touchmove"){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void e.preventDefault();const le=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=le>45&&le<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,C=0,P=0}else this.lockedAxis=D;if(jp(e.target,this.content)&&(D="x",this.dragOffset.y=0),D&&D!=="xy"&&this.lockedAxis!==D&&at(this.targetScale)===at(this.minScale))return;e.cancelable&&e.preventDefault(),this.container.classList.add(this.cn("isDragging"));const R=this.checkBounds(C,P);this.option("rubberband")?(this.isInfinite!=="x"&&(R.xDiff>0&&C<0||R.xDiff<0&&C>0)&&(C*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*R.xDiff))),this.isInfinite!=="y"&&(R.yDiff>0&&P<0||R.yDiff<0&&P>0)&&(P*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*R.yDiff)))):(R.xDiff&&(C=0),R.yDiff&&(P=0));const j=this.targetScale,W=this.minScale,ee=this.maxScale;j<.5*W&&(E=Math.max(E,W)),j>1.5*ee&&(E=Math.min(E,ee)),this.lockedAxis==="y"&&at(j)===at(W)&&(C=0),this.lockedAxis==="x"&&at(j)===at(W)&&(P=0),this.applyChange({originX:l,originY:g,panX:C,panY:P,scale:E,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(e,n,i){if(i.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=[]),jp(e.target,this.content)&&this.lockedAxis==="y"&&(this.trackingPoints=[]),this.emit("touchEnd",e),this.isDragging=!1,this.lockedAxis=!1,this.state!==In.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 le of Po)this.velocity[le]=0;this.target.e=this.current.e,this.target.f=this.current.f,En(this.container,"is-scaling"),En(this.container,"is-animating"),this.isTicking=!1;const{trackingPoints:i}=this,r=i[0],a=i[i.length-1];let u=0,l=0,g=0;a&&r&&(u=a.clientX-r.clientX,l=a.clientY-r.clientY,g=a.time-r.time);const b=((e=window.visualViewport)===null||e===void 0?void 0:e.scale)||1;b!==1&&(u*=b,l*=b);let S=0,E=0,C=0,P=0,D=this.option("decelFriction");const R=this.targetScale;if(g>0){C=Math.abs(u)>3?u/(g/30):0,P=Math.abs(l)>3?l/(g/30):0;const le=this.option("maxVelocity");le&&(C=Math.max(Math.min(C,le),-1*le),P=Math.max(Math.min(P,le),-1*le))}C&&(S=C/(1/(1-D)-1)),P&&(E=P/(1/(1-D)-1)),(this.option("lockAxis")==="y"||this.option("lockAxis")==="xy"&&this.lockedAxis==="y"&&at(R)===this.minScale)&&(S=C=0),(this.option("lockAxis")==="x"||this.option("lockAxis")==="xy"&&this.lockedAxis==="x"&&at(R)===this.minScale)&&(E=P=0);const j=this.dragOffset.x,W=this.dragOffset.y,ee=this.option("dragMinThreshold")||0;Math.abs(j)<ee&&Math.abs(W)<ee&&(S=E=0,C=P=0),(this.option("zoom")&&(R<this.minScale-1e-5||R>this.maxScale+1e-5)||n&&!S&&!E)&&(D=.35),this.applyChange({panX:S,panY:E,friction:D}),this.emit("decel",C,P,j,W)}onWheel(e){var n=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(a,u){return Math.abs(u)>Math.abs(a)?u:a});const i=Math.max(-1,Math.min(1,n));if(this.emit("wheel",e,i),this.panMode===ps||e.defaultPrevented)return;const r=this.option("wheel");r==="pan"?(e.preventDefault(),this.panOnlyZoomed&&!this.canZoomOut()||this.applyChange({panX:2*-e.deltaX,panY:2*-e.deltaY,bounce:!1})):r==="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:i,contentRect:r}=this,a=Object.assign({},Hp);for(const j of Po){const W=j=="e"||j==="f"?qp:sB;a[j]=at(e[j],W),Math.abs(n[j]-e[j])<(j=="e"||j==="f"?.51:.001)&&(e[j]=n[j])}let{a:u,b:l,c:g,d:b,e:S,f:E}=a,C=`matrix(${u}, ${l}, ${g}, ${b}, ${S}, ${E})`,P=i.parentElement instanceof HTMLPictureElement?i.parentElement:i;if(this.option("transformParent")&&(P=P.parentElement||P),P.style.transform===C)return;P.style.transform=C;const{contentWidth:D,contentHeight:R}=this.calculateContentDim();r.width=D,r.height=R,this.emit("afterTransform")}updateMetrics(e=!1){var n;if(!this||this.state===In.Destroy||this.isContentLoading)return;const i=Math.max(1,((n=window.visualViewport)===null||n===void 0?void 0:n.scale)||1),{container:r,content:a}=this,u=a instanceof HTMLImageElement,l=r.getBoundingClientRect(),g=getComputedStyle(this.container);let b=l.width*i,S=l.height*i;const E=parseFloat(g.paddingTop)+parseFloat(g.paddingBottom),C=b-(parseFloat(g.paddingLeft)+parseFloat(g.paddingRight)),P=S-E;this.containerRect={width:b,height:S,innerWidth:C,innerHeight:P};const D=parseFloat(a.dataset.width||"")||(pt=>{let zt=0;return zt=pt instanceof HTMLImageElement?pt.naturalWidth:pt instanceof SVGElement?pt.width.baseVal.value:Math.max(pt.offsetWidth,pt.scrollWidth),zt||0})(a),R=parseFloat(a.dataset.height||"")||(pt=>{let zt=0;return zt=pt instanceof HTMLImageElement?pt.naturalHeight:pt instanceof SVGElement?pt.height.baseVal.value:Math.max(pt.offsetHeight,pt.scrollHeight),zt||0})(a);let j=this.option("width",D)||fs,W=this.option("height",R)||fs;const ee=j===fs,le=W===fs;typeof j!="number"&&(j=D),typeof W!="number"&&(W=R),ee&&(j=D*(W/R)),le&&(W=R/(D/j));let J=a.parentElement instanceof HTMLPictureElement?a.parentElement:a;this.option("transformParent")&&(J=J.parentElement||J);const Te=J.getAttribute("style")||"";J.style.setProperty("transform","none","important"),u&&(J.style.width="",J.style.height=""),J.offsetHeight;const xe=a.getBoundingClientRect();let Ae=xe.width*i,je=xe.height*i,De=Ae,Ke=je;Ae=Math.min(Ae,j),je=Math.min(je,W),u?{width:Ae,height:je}=((pt,zt,Xt,on)=>{const $t=Xt/pt,Kt=on/zt,Cn=Math.min($t,Kt);return{width:pt*=Cn,height:zt*=Cn}})(j,W,Ae,je):(Ae=Math.min(Ae,j),je=Math.min(je,W));let rt=.5*(Ke-je),Rt=.5*(De-Ae);this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:xe.top-l.top+rt,bottom:l.bottom-xe.bottom+rt,left:xe.left-l.left+Rt,right:l.right-xe.right+Rt,fitWidth:Ae,fitHeight:je,width:Ae,height:je,fullWidth:j,fullHeight:W}),J.style.cssText=Te,u&&(J.style.width=`${Ae}px`,J.style.height=`${je}px`),this.setTransform(),e!==!0&&this.emit("refresh"),this.ignoreBounds||(at(this.targetScale)<at(this.minScale)?this.zoomTo(this.minScale,{friction:0}):this.targetScale>this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===In.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}calculateBounds(){const{contentWidth:e,contentHeight:n}=this.calculateContentDim(this.target),{targetScale:i,lockedAxis:r}=this,{fitWidth:a,fitHeight:u}=this.contentRect;let l=0,g=0,b=0,S=0;const E=this.option("infinite");if(E===!0||r&&E===r)l=-1/0,b=1/0,g=-1/0,S=1/0;else{let{containerRect:C,contentRect:P}=this,D=at(a*i,qp),R=at(u*i,qp),{innerWidth:j,innerHeight:W}=C;if(C.width===D&&(j=C.width),C.width===R&&(W=C.height),e>j){b=.5*(e-j),l=-1*b;let ee=.5*(P.right-P.left);l+=ee,b+=ee}if(a>j&&e<j&&(l-=.5*(a-j),b-=.5*(a-j)),n>W){S=.5*(n-W),g=-1*S;let ee=.5*(P.bottom-P.top);g+=ee,S+=ee}u>W&&n<W&&(l-=.5*(u-W),b-=.5*(u-W))}return{x:{min:l,max:b},y:{min:g,max:S}}}getBounds(){const e=this.option("bounds");return e!==fs?e:this.calculateBounds()}updateControls(){const e=this,n=e.container,{panMode:i,contentRect:r,targetScale:a,minScale:u}=e;let l=u,g=e.option("click")||!1;g&&(l=e.getNextScale(g));let b=e.canZoomIn(),S=e.canZoomOut(),E=i===K1&&!!this.option("touch"),C=S&&E;if(E&&(at(a)<at(u)&&!this.panOnlyZoomed&&(C=!0),(at(r.width,1)>at(r.fitWidth,1)||at(r.height,1)>at(r.fitHeight,1))&&(C=!0)),at(r.width*a,1)<at(r.fitWidth,1)&&(C=!1),i===ps&&(C=!1),to(n,this.cn("isDraggable"),C),!this.option("zoom"))return;let P=b&&at(l)>at(a),D=!P&&!C&&S&&at(l)<at(a);to(n,this.cn("canZoomIn"),P),to(n,this.cn("canZoomOut"),D);for(const R of n.querySelectorAll("[data-panzoom-action]")){let j=!1,W=!1;switch(R.dataset.panzoomAction){case"zoomIn":b?j=!0:W=!0;break;case"zoomOut":S?j=!0:W=!0;break;case"toggleZoom":case"iterateZoom":b||S?j=!0:W=!0;const ee=R.querySelector("g");ee&&(ee.style.display=b?"":"none")}j?(R.removeAttribute("disabled"),R.removeAttribute("tabindex")):W&&(R.setAttribute("disabled",""),R.setAttribute("tabindex","-1"))}}panTo({x:e=this.target.e,y:n=this.target.f,scale:i=this.targetScale,friction:r=this.option("friction"),angle:a=0,originX:u=0,originY:l=0,flipX:g=!1,flipY:b=!1,ignoreBounds:S=!1}){this.state!==In.Destroy&&this.applyChange({panX:e-this.target.e,panY:n-this.target.f,scale:i/this.targetScale,angle:a,originX:u,originY:l,friction:r,flipX:g,flipY:b,ignoreBounds:S})}applyChange({panX:e=0,panY:n=0,scale:i=1,angle:r=0,originX:a=-this.current.e,originY:u=-this.current.f,friction:l=this.option("friction"),flipX:g=!1,flipY:b=!1,ignoreBounds:S=!1,bounce:E=this.option("bounce")}){const C=this.state;if(C===In.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.friction=l||0,this.ignoreBounds=S;const{current:P}=this,D=P.e,R=P.f,j=this.getMatrix(this.target);let W=new DOMMatrix().translate(D,R).translate(a,u).translate(e,n);if(this.option("zoom")){if(!S){const ee=this.targetScale,le=this.minScale,J=this.maxScale;ee*i<le&&(i=le/ee),ee*i>J&&(i=J/ee)}W=W.scale(i)}W=W.translate(-a,-u).translate(-D,-R).multiply(j),r&&(W=W.rotate(r)),g&&(W=W.scale(-1,1)),b&&(W=W.scale(1,-1));for(const ee of Po)ee!=="e"&&ee!=="f"&&(W[ee]>this.minScale+1e-5||W[ee]<this.minScale-1e-5)?this.target[ee]=W[ee]:this.target[ee]=at(W[ee],qp);(this.targetScale<this.scale||Math.abs(i-1)>.1||this.panMode===ps||E===!1)&&!S&&this.clampTargetBounds(),C===In.Init?this.animate():this.isResting||(this.state=In.Panning,this.requestTick())}stop(e=!1){if(this.state===In.Init||this.state===In.Destroy)return;const n=this.isTicking;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const i of Po)this.velocity[i]=0,e==="current"?this.current[i]=this.target[i]:e==="target"&&(this.target[i]=this.current[i]);this.setTransform(),En(this.container,"is-scaling"),En(this.container,"is-animating"),this.isTicking=!1,this.state=In.Ready,n&&(this.emit("endAnimation"),this.updateControls())}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),Ct(this.container,"is-animating"),this.isScaling&&Ct(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!==ps||!e||at(this.targetScale)<=at(this.minScale))return;this.emit("mouseMove",e);const{container:i,containerRect:r,contentRect:a}=this,u=r.width,l=r.height,g=i.getBoundingClientRect(),b=(e.clientX||0)-g.left,S=(e.clientY||0)-g.top;let{contentWidth:E,contentHeight:C}=this.calculateContentDim(this.target);const P=this.option("mouseMoveFactor");P>1&&(E!==u&&(E*=P),C!==l&&(C*=P));let D=.5*(E-u)-b/u*100/100*(E-u);D+=.5*(a.right-a.left);let R=.5*(C-l)-S/l*100/100*(C-l);R+=.5*(a.bottom-a.top),this.applyChange({panX:D-this.target.e,panY:R-this.target.f,friction:n})}zoomWithWheel(e){if(this.state===In.Destroy||this.state===In.Init)return;const n=Date.now();if(n-this.pwt<45)return void e.preventDefault();this.pwt=n;var i=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(b,S){return Math.abs(S)>Math.abs(b)?S:b});const r=Math.max(-1,Math.min(1,i)),{targetScale:a,maxScale:u,minScale:l}=this;let g=a*(100+45*r)/100;at(g)<at(l)&&at(a)<=at(l)?(this.cwd+=Math.abs(r),g=l):at(g)>at(u)&&at(a)>=at(u)?(this.cwd+=Math.abs(r),g=u):(this.cwd=0,g=Math.max(Math.min(g,u),l)),this.cwd>this.option("wheelLimit")||(e.preventDefault(),at(g)!==at(a)&&this.zoomTo(g,{event:e}))}canZoomIn(){return this.option("zoom")&&(at(this.contentRect.width,1)<at(this.contentRect.fitWidth,1)||at(this.targetScale)<at(this.maxScale))}canZoomOut(){return this.option("zoom")&&at(this.targetScale)>at(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=fs,originX:i=fs,originY:r=fs,event:a}={}){if(this.isContentLoading||this.state===In.Destroy)return;const{targetScale:u,fullScale:l,maxScale:g,coverScale:b}=this;if(this.stop(),this.panMode===ps&&(a=this.pmme||a),a||i===fs||r===fs){const E=this.content.getBoundingClientRect(),C=this.container.getBoundingClientRect(),P=a?a.clientX:C.left+.5*C.width,D=a?a.clientY:C.top+.5*C.height;i=P-E.left-.5*E.width,r=D-E.top-.5*E.height}let S=1;typeof e=="number"?S=e:e==="full"?S=l:e==="cover"?S=b:e==="max"?S=g:e==="fit"?S=1:e==="next"&&(S=this.getNextScale("iterateZoom")),S=S/u||1,n=n===fs?S>1?.15:.25:n,this.applyChange({scale:S,originX:i,originY:r,friction:n}),a&&this.panMode===ps&&this.panWithMouse(a,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:i}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-i.e,panY:.5*e.height-(n.top+.5*n.fitHeight)-i.f,scale:e.width/n.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:e,contentRect:n,target:i}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-i.e,panY:.5*e.innerHeight-(n.top+.5*n.fitHeight)-i.f,scale:e.height/n.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:e}=this,n=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");e.classList.toggle(n);const r=e.classList.contains(n);r?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(r?"enterFS":"exitFS")}getMatrix(e=this.current){const{a:n,b:i,c:r,d:a,e:u,f:l}=e;return new DOMMatrix([n,i,r,a,u,l])}reset(e){if(this.state!==In.Init&&this.state!==In.Destroy){this.stop("current");for(const n of Po)this.target[n]=Hp[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=In.Panning,this.requestTick())}}destroy(){this.stop(),this.state=In.Destroy,this.detachEvents(),this.detachObserver();const{container:e,content:n}=this,i=this.option("classes")||{};for(const r of Object.values(i))e.classList.remove(r+"");n&&(n.removeEventListener("load",this.onLoad),n.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(ua,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:rB}),Object.defineProperty(ua,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const Q1=function(t,e){let n=!0;return(...i)=>{n&&(n=!1,t(...i),setTimeout(()=>{n=!0},e))}},ev=(t,e)=>{let n=[];return t.childNodes.forEach(i=>{i.nodeType!==Node.ELEMENT_NODE||e&&!i.matches(e)||n.push(i)}),n},oB={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 hi;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"})(hi||(hi={}));const my=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)},aB=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class Vs extends Up{constructor(e,n){super(n),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:e})}attach(){}detach(){}}const lB={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:'<button type="button" data-carousel-page="%i" aria-label="{{GOTO}}"><span class="f-carousel__dot" aria-hidden="true"></span></button>',dynamicFrom:11,maxCount:1/0,minCount:2};class tv extends Vs{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"),Ct(e,this.cn("list")),e.setAttribute("role","tablist");const n=this.instance.container;n.appendChild(e),Ct(n,this.cn("hasDots")),this.list=e}return e}refresh(){var e;const n=this.instance.pages.length,i=Math.min(2,this.option("minCount")),r=Math.max(2e3,this.option("maxCount")),a=this.option("dynamicFrom");if(n<i||n>r)return void this.cleanup();const u=typeof a=="number"&&n>5&&n>=a,l=!this.list||this.isDynamic!==u||this.list.children.length!==n;l&&this.cleanup();const g=this.build();if(to(g,this.cn("isDynamic"),!!u),l)for(let E=0;E<n;E++)g.append(this.createItem(E));let b,S=0;for(const E of[...g.children]){const C=S===this.instance.page;C&&(b=E),to(E,this.cn("isCurrent"),C),(e=E.children[0])===null||e===void 0||e.setAttribute("aria-selected",C?"true":"false");for(const P of["isBeforePrev","isPrev","isNext","isAfterNext"])En(E,this.cn(P));S++}if(b=b||g.firstChild,u&&b){const E=b.previousElementSibling,C=E&&E.previousElementSibling;Ct(E,this.cn("isPrev")),Ct(C,this.cn("isBeforePrev"));const P=b.nextElementSibling,D=P&&P.nextElementSibling;Ct(P,this.cn("isNext")),Ct(D,this.cn("isAfterNext"))}this.isDynamic=u}createItem(e=0){var n;const i=document.createElement("li");i.setAttribute("role","presentation");const r=eo(this.instance.localize(this.option("dotTpl"),[["%d",e+1]]).replace(/\%i/g,e+""));return i.appendChild(r),(n=i.children[0])===null||n===void 0||n.setAttribute("role","tab"),i}cleanup(){this.list&&(this.list.remove(),this.list=null),this.isDynamic=!1,En(this.instance.container,this.cn("hasDots"))}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(tv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:lB});const Wp="disabled",Gp="next",nv="prev";class iv extends Vs{constructor(){super(...arguments),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prev",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"next",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isDom",{enumerable:!0,configurable:!0,writable:!0,value:!1})}onRefresh(){const e=this.instance,n=e.pages.length,i=e.page;if(n<2)return void this.cleanup();this.build();let r=this.prev,a=this.next;r&&a&&(r.removeAttribute(Wp),a.removeAttribute(Wp),e.isInfinite||(i<=0&&r.setAttribute(Wp,""),i>=n-1&&a.setAttribute(Wp,"")))}addBtn(e){var n;const i=this.instance,r=document.createElement("button");r.setAttribute("tabindex","0"),r.setAttribute("title",i.localize(`{{${e.toUpperCase()}}}`)),Ct(r,this.cn("button")+" "+this.cn(e===Gp?"isNext":"isPrev"));const a=i.isRTL?e===Gp?nv:Gp:e;var u;return r.innerHTML=i.localize(this.option(`${a}Tpl`)),r.dataset[`carousel${u=e,u?u.match("^[a-z]")?u.charAt(0).toUpperCase()+u.substring(1):u:""}`]="true",(n=this.container)===null||n===void 0||n.appendChild(r),r}build(){const e=this.instance.container,n=this.cn("container");let{container:i,prev:r,next:a}=this;i||(i=e.querySelector("."+n),this.isDom=!!i),i||(i=document.createElement("div"),Ct(i,n),e.appendChild(i)),this.container=i,a||(a=i.querySelector("[data-carousel-next]")),a||(a=this.addBtn(Gp)),this.next=a,r||(r=i.querySelector("[data-carousel-prev]")),r||(r=this.addBtn(nv)),this.prev=r}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(iv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M9 3l9 9-9 9"/></svg>',prevTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M15 3l-9 9 9 9"/></svg>'}});class rv extends Vs{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===hi.Ready?this.onNavReady(e):e.on("ready",this.onNavReady),n.state===hi.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,i){this.onNavTouch(e,e.panzoom,i)}onNavTouch(e,n,i){var r,a;if(Math.abs(n.dragOffset.x)>3||Math.abs(n.dragOffset.y)>3)return;const u=i.target,{nav:l,target:g}=this;if(!l||!g||!u)return;const b=u.closest("[data-index]");if(i.stopPropagation(),i.preventDefault(),!b)return;const S=parseInt(b.dataset.index||"",10)||0,E=g.getPageForSlide(S),C=l.getPageForSlide(S);l.slideTo(C),g.slideTo(E,{friction:((a=(r=this.nav)===null||r===void 0?void 0:r.plugins)===null||a===void 0?void 0:a.Sync.option("friction"))||0}),this.markSelectedSlide(S)}onNavCreateSlide(e,n){n.index===this.selectedIndex&&this.markSelectedSlide(n.index)}onTargetChange(){var e,n;const{target:i,nav:r}=this;if(!i||!r||r.state!==hi.Ready||i.state!==hi.Ready)return;const a=(n=(e=i.pages[i.page])===null||e===void 0?void 0:e.slides[0])===null||n===void 0?void 0:n.index,u=r.getPageForSlide(a);this.markSelectedSlide(a),r.slideTo(u,r.prevPage===null&&i.prevPage===null?{friction:0}:void 0)}markSelectedSlide(e){const n=this.nav;n&&n.state===hi.Ready&&(this.selectedIndex=e,[...n.slides].map(i=>{i.el&&i.el.classList[i.index===e?"add":"remove"]("is-nav-selected")}))}attach(){const e=this;let n=e.options.target,i=e.options.nav;n?e.addAsNavFor(n):i&&e.addAsTargetFor(i)}detach(){const e=this,n=e.nav,i=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,i&&(i.off("ready",e.onTargetReady),i.off("refresh",e.onTargetChange),i.off("change",e.onTargetChange)),e.target=null}}Object.defineProperty(rv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const cB={Navigation:iv,Dots:tv,Sync:rv},Zp="animationend",sv="isSelected",Yp="slide";class ha extends hy{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===hi.Ready}get isInfinite(){let e=!1;const{contentDim:n,viewportDim:i,pages:r,slides:a}=this,u=a[0];return r.length>=2&&u&&n+u.dim>=i&&(e=this.option("infinite")),e}get isRTL(){return this.option("direction")==="rtl"}get isHorizontal(){return this.option("axis")==="x"}constructor(e,n={},i={}){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:hi.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||!Mr(e))throw new Error("No Element found");this.container=e,this.slideNext=Q1(this.slideNext.bind(this),150),this.slidePrev=Q1(this.slidePrev.bind(this),150),this.userOptions=n,this.userPlugins=i,queueMicrotask(()=>{this.processOptions()})}processOptions(){var e,n;const i=Tr({},ha.defaults,this.userOptions);let r="";const a=i.breakpoints;if(a&&cy(a))for(const[u,l]of Object.entries(a))window.matchMedia(u).matches&&cy(l)&&(r+=u,Tr(i,l));r===this.bp&&this.state!==hi.Init||(this.bp=r,this.state===hi.Ready&&(i.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!==hi.Init&&this.destroy(),super.setOptions(i),this.option("enabled")===!1?this.attachEvents():setTimeout(()=>{this.init()},0))}init(){this.state=hi.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},ha.Plugins),this.userPlugins)),this.emit("attachPlugins"),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=hi.Ready,this.emit("ready")}initLayout(){const{container:e}=this,n=this.option("classes");Ct(e,this.cn("container")),to(e,n.isLTR,!this.isRTL),to(e,n.isRTL,this.isRTL),to(e,n.isVertical,!this.isHorizontal),to(e,n.isHorizontal,this.isHorizontal);let i=this.option("viewport")||e.querySelector(`.${n.viewport}`);i||(i=document.createElement("div"),Ct(i,n.viewport),i.append(...ev(e,`.${n.slide}`)),e.prepend(i)),i.addEventListener("scroll",this.onScroll);let r=this.option("track")||e.querySelector(`.${n.track}`);r||(r=document.createElement("div"),Ct(r,n.track),r.append(...Array.from(i.childNodes))),r.setAttribute("aria-live","polite"),i.contains(r)||i.prepend(r),this.viewport=i,this.track=r,this.emit("initLayout")}initSlides(){const{track:e}=this;if(!e)return;const n=[...this.slides],i=[];[...ev(e,`.${this.cn(Yp)}`)].forEach(r=>{if(Mr(r)){const a=my({el:r,isDom:!0,index:this.slides.length});i.push(a)}});for(let r of[...this.option("slides",[])||[],...n])i.push(my(r));this.slides=i;for(let r=0;r<this.slides.length;r++)this.slides[r].index=r;for(const r of i)this.emit("beforeInitSlide",r,r.index),this.emit("initSlide",r,r.index);this.emit("initSlides")}setInitialPage(){const e=this.option("initialSlide");this.page=typeof e=="number"?this.getPageForSlide(e):parseInt(this.option("initialPage",0)+"",10)||0}setInitialPosition(){const{track:e,pages:n,isHorizontal:i}=this;if(!e||!n.length)return;let r=this.page;n[r]||(this.page=r=0);const a=(n[r].pos||0)*(this.isRTL&&i?1:-1),u=i?`${a}px`:"0",l=i?"0":`${a}px`;e.style.transform=`translate3d(${u}, ${l}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const e=this.option("Panzoom")||{};this.panzoom=new ua(this.viewport,Tr({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,click:!1,dblClick:!1,touch:n=>!(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,i,...r)=>{this.emit(`Panzoom.${i}`,n,...r)}),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:i}=this;let r=this.option("slidesPerPage");r=(r==="auto"||n<=i)&&this.option("fill")!==!1?1/0:parseFloat(r+"");let a=0,u=0,l=0;for(const g of this.slides)(!e.length||u+g.dim-i>.05||l>=r)&&(e.push(aB()),a=e.length-1,u=0,l=0),e[a].slides.push(g),u+=g.dim+g.gap,l++;return e}processPages(){const e=this.pages,{contentDim:n,viewportDim:i,isInfinite:r}=this,a=this.option("center"),u=this.option("fill"),l=u&&a&&n>i&&!r;if(e.forEach((S,E)=>{var C;S.index=E,S.pos=((C=S.slides[0])===null||C===void 0?void 0:C.pos)||0,S.dim=0;for(const[P,D]of S.slides.entries())S.dim+=D.dim,P<S.slides.length-1&&(S.dim+=D.gap);l&&S.pos+.5*S.dim<.5*i?S.pos=0:l&&S.pos+.5*S.dim>=n-.5*i?S.pos=n-i:a&&(S.pos+=-.5*(i-S.dim))}),e.forEach(S=>{u&&!r&&n>i&&(S.pos=Math.max(S.pos,0),S.pos=Math.min(S.pos,n-i)),S.pos=at(S.pos,1e3),S.dim=at(S.dim,1e3),Math.abs(S.pos)<=.1&&(S.pos=0)}),r)return e;const g=[];let b;return e.forEach(S=>{const E=Object.assign({},S);b&&E.pos===b.pos?(b.dim+=E.dim,b.slides=[...b.slides,...E.slides]):(E.index=g.length,b=E,g.push(E))}),g}getPageFromIndex(e=0){const n=this.pages.length;let i;return e=parseInt((e||0).toString())||0,i=this.isInfinite?(e%n+n)%n:Math.max(Math.min(e,n-1),0),i}getSlideMetrics(e){var n,i;const r=this.isHorizontal?"width":"height";let a=0,u=0,l=e.el;const g=!(!l||l.parentNode);if(l?a=parseFloat(l.dataset[r]||"")||0:(l=document.createElement("div"),l.style.visibility="hidden",(this.track||document.body).prepend(l)),Ct(l,this.cn(Yp)+" "+e.class+" "+e.customClass),a)l.style[r]=`${a}px`,l.style[r==="width"?"height":"width"]="";else{g&&(this.track||document.body).prepend(l),a=l.getBoundingClientRect()[r]*Math.max(1,((n=window.visualViewport)===null||n===void 0?void 0:n.scale)||1);let S=l[this.isHorizontal?"offsetWidth":"offsetHeight"];S-1>a&&(a=S)}const b=getComputedStyle(l);return b.boxSizing==="content-box"&&(this.isHorizontal?(a+=parseFloat(b.paddingLeft)||0,a+=parseFloat(b.paddingRight)||0):(a+=parseFloat(b.paddingTop)||0,a+=parseFloat(b.paddingBottom)||0)),u=parseFloat(b[this.isHorizontal?"marginRight":"marginBottom"])||0,g?(i=l.parentElement)===null||i===void 0||i.removeChild(l):e.el||l.remove(),{dim:at(a,1e3),gap:at(u,1e3)}}getBounds(){const{isInfinite:e,isRTL:n,isHorizontal:i,pages:r}=this;let a={min:0,max:0};if(e)a={min:-1/0,max:1/0};else if(r.length){const u=r[0].pos,l=r[r.length-1].pos;a=n&&i?{min:u,max:l}:{min:-1*l,max:-1*u}}return{x:i?a:{min:0,max:0},y:i?{min:0,max:0}:a}}repositionSlides(){let e,{isHorizontal:n,isRTL:i,isInfinite:r,viewport:a,viewportDim:u,contentDim:l,page:g,pages:b,slides:S,panzoom:E}=this,C=0,P=0,D=0,R=0;E?R=-1*E.current[this.axis]:b[g]&&(R=b[g].pos||0),e=n?i?"right":"left":"top",i&&n&&(R*=-1);for(const le of S){const J=le.el;J?(e==="top"?(J.style.right="",J.style.left=""):J.style.top="",le.index!==C?J.style[e]=P===0?"":`${at(P,1e3)}px`:J.style[e]="",D+=le.dim+le.gap,C++):P+=le.dim+le.gap}if(r&&D&&a){let le=getComputedStyle(a),J="padding",Te=n?"Right":"Bottom",xe=parseFloat(le[J+(n?"Left":"Top")]);R-=xe,u+=xe,u+=parseFloat(le[J+Te]);for(const Ae of S)Ae.el&&(at(Ae.pos)<at(u)&&at(Ae.pos+Ae.dim+Ae.gap)<at(R)&&at(R)>at(l-u)&&(Ae.el.style[e]=`${at(P+D,1e3)}px`),at(Ae.pos+Ae.gap)>=at(l-u)&&at(Ae.pos)>at(R+u)&&at(R)<at(u)&&(Ae.el.style[e]=`-${at(D,1e3)}px`))}let j,W,ee=[...this.inTransition];if(ee.length>1&&(j=b[ee[0]],W=b[ee[1]]),j&&W){let le=0;for(const J of S)J.el?this.inTransition.has(J.index)&&j.slides.indexOf(J)<0&&(J.el.style[e]=`${at(le+(j.pos-W.pos),1e3)}px`):le+=J.dim+J.gap}}createSlideEl(e){const{track:n,slides:i}=this;if(!n||!e||e.el&&e.el.parentNode)return;const r=e.el||document.createElement("div");Ct(r,this.cn(Yp)),Ct(r,e.class),Ct(r,e.customClass);const a=e.html;a&&(a instanceof HTMLElement?r.appendChild(a):r.innerHTML=e.html+"");const u=[];i.forEach((S,E)=>{S.el&&u.push(E)});const l=e.index;let g=null;u.length&&(g=i[u.reduce((S,E)=>Math.abs(E-l)<Math.abs(S-l)?E:S)]);const b=g&&g.el&&g.el.parentNode?g.index<e.index?g.el.nextSibling:g.el:null;n.insertBefore(r,n.contains(b)?b:null),e.el=r,this.emit("createSlide",e)}removeSlideEl(e,n=!1){const i=e==null?void 0:e.el;if(!i||!i.parentNode)return;const r=this.cn(sv);if(i.classList.contains(r)&&(En(i,r),this.emit("unselectSlide",e)),e.isDom&&!n)return i.removeAttribute("aria-hidden"),i.removeAttribute("data-index"),void(i.style.left="");this.emit("removeSlide",e);const a=new CustomEvent(Zp);i.dispatchEvent(a),e.el&&(e.el.remove(),e.el=null)}transitionTo(e=0,n=this.option("transition")){var i,r,a,u;if(!n)return!1;const l=this.page,{pages:g,panzoom:b}=this;e=parseInt((e||0).toString())||0;const S=this.getPageFromIndex(e);if(!b||!g[S]||g.length<2||Math.abs((((r=(i=g[l])===null||i===void 0?void 0:i.slides[0])===null||r===void 0?void 0:r.dim)||0)-this.viewportDim)>1)return!1;let E=e>l?1:-1;this.isInfinite&&(l===0&&e===g.length-1&&(E=-1),l===g.length-1&&e===0&&(E=1));const C=g[S].pos*(this.isRTL?1:-1);if(l===S&&Math.abs(C-b.target[this.axis])<1)return!1;this.clearTransitions();const P=b.isResting;Ct(this.container,this.cn("inTransition"));const D=((a=g[l])===null||a===void 0?void 0:a.slides[0])||null,R=((u=g[S])===null||u===void 0?void 0:u.slides[0])||null;this.inTransition.add(R.index),this.createSlideEl(R);let j=D.el,W=R.el;P||n===Yp||(n="fadeFast",j=null);const ee=this.isRTL?"next":"prev",le=this.isRTL?"prev":"next";return j&&(this.inTransition.add(D.index),D.transition=n,j.addEventListener(Zp,this.onAnimationEnd),j.classList.add(`f-${n}Out`,`to-${E>0?le:ee}`)),W&&(R.transition=n,W.addEventListener(Zp,this.onAnimationEnd),W.classList.add(`f-${n}In`,`from-${E>0?ee:le}`)),b.current[this.axis]=C,b.target[this.axis]=C,b.requestTick(),this.onChange(S),!0}manageSlideVisiblity(){const e=new Set,n=new Set,i=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const r of this.slides)i.has(r)?e.add(r):n.add(r);for(const r of this.inTransition)e.add(this.slides[r]);for(const r of e)this.createSlideEl(r),this.lazyLoadSlide(r);for(const r of n)e.has(r)||this.removeSlideEl(r);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const e="aria-hidden";let n=this.cn(sv);if(n)for(const i of this.slides){const r=i.el;r&&(r.dataset.index=`${i.index}`,r.classList.contains("f-thumbs__slide")?this.getVisibleSlides(0).has(i)?r.removeAttribute(e):r.setAttribute(e,"true"):this.pages[this.page].slides.includes(i)?(r.classList.contains(n)||(Ct(r,n),this.emit("selectSlide",i)),r.removeAttribute(e)):(r.classList.contains(n)&&(En(r,n),this.emit("unselectSlide",i)),r.setAttribute(e,"true")))}}flipInfiniteTrack(){const{axis:e,isHorizontal:n,isInfinite:i,isRTL:r,viewportDim:a,contentDim:u}=this,l=this.panzoom;if(!l||!i)return;let g=l.current[e],b=l.target[e]-g,S=0,E=.5*a;r&&n?(g<-E&&(S=-1,g+=u),g>u-E&&(S=1,g-=u)):(g>E&&(S=1,g-=u),g<-u+E&&(S=-1,g+=u)),S&&(l.current[e]=g,l.target[e]=g+b)}lazyLoadImg(e,n){const i=this,r="f-fadeIn",a="is-preloading";let u=!1,l=null;const g=()=>{u||(u=!0,l&&(l.remove(),l=null),En(n,a),n.complete&&(Ct(n,r),setTimeout(()=>{En(n,r)},350)),this.option("adaptiveHeight")&&e.el&&this.pages[this.page].slides.indexOf(e)>-1&&(i.updateMetrics(),i.setViewportHeight()),this.emit("load",e))};Ct(n,a),n.src=n.dataset.lazySrcset||n.dataset.lazySrc||"",delete n.dataset.lazySrc,delete n.dataset.lazySrcset,n.addEventListener("error",()=>{g()}),n.addEventListener("load",()=>{g()}),setTimeout(()=>{const b=n.parentNode;b&&e.el&&(n.complete?g():u||(l=eo(dy),b.insertBefore(l,n)))},300)}lazyLoadSlide(e){const n=e&&e.el;if(!n)return;const i=new Set;let r=Array.from(n.querySelectorAll("[data-lazy-src],[data-lazy-srcset]"));n.dataset.lazySrc&&r.push(n),r.map(a=>{a instanceof HTMLImageElement?i.add(a):a instanceof HTMLElement&&a.dataset.lazySrc&&(a.style.backgroundImage=`url('${a.dataset.lazySrc}')`,delete a.dataset.lazySrc)});for(const a of i)this.lazyLoadImg(e,a)}onAnimationEnd(e){var n;const i=e.target,r=i?parseInt(i.dataset.index||"",10)||0:-1,a=this.slides[r],u=e.animationName;if(!i||!a||!u)return;const l=!!this.inTransition.has(r)&&a.transition;l&&u.substring(0,l.length+2)===`f-${l}`&&this.inTransition.delete(r),this.inTransition.size||this.clearTransitions(),r===this.page&&(!((n=this.panzoom)===null||n===void 0)&&n.isResting)&&this.emit("settle")}onDecel(e,n=0,i=0,r=0,a=0){if(this.option("dragFree"))return void this.setPageFromPosition();const{isRTL:u,isHorizontal:l,axis:g,pages:b}=this,S=b.length,E=Math.abs(Math.atan2(i,n)/(Math.PI/180));let C=0;if(C=E>45&&E<135?l?0:i:l?n:0,!S)return;let P=this.page,D=u&&l?1:-1;const R=e.current[g]*D;let{pageIndex:j}=this.getPageFromPosition(R);Math.abs(C)>5?(b[P].dim<document.documentElement["client"+(this.isHorizontal?"Width":"Height")]-1&&(P=j),P=u&&l?C<0?P-1:P+1:C<0?P+1:P-1):P=r===0&&a===0?P:j,this.slideTo(P,{transition:!1,friction:e.option("decelFriction")})}onClick(e){const n=e.target,i=n&&Mr(n)?n.dataset:null;let r,a;i&&(i.carouselPage!==void 0?(a="slideTo",r=i.carouselPage):i.carouselNext!==void 0?a="slideNext":i.carouselPrev!==void 0&&(a="slidePrev")),a?(e.preventDefault(),e.stopPropagation(),n&&!n.hasAttribute("disabled")&&this[a](r)):this.emit("click",e)}onSlideTo(e){const n=e.detail||0;this.slideTo(this.getPageForSlide(n),{friction:0})}onChange(e,n=0){const i=this.page;this.prevPage=i,this.page=e,this.option("adaptiveHeight")&&this.setViewportHeight(),e!==i&&(this.markSelectedSlides(),this.emit("change",e,i,n))}onRefresh(){let e=this.contentDim,n=this.viewportDim;this.updateMetrics(),this.contentDim===e&&this.viewportDim===n||this.slideTo(this.page,{friction:0,transition:!1})}onScroll(){var e;(e=this.viewport)===null||e===void 0||e.scroll(0,0)}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(e){this.lp!==e.current[this.axis]&&(this.flipInfiniteTrack(),this.manageSlideVisiblity()),this.lp=e.current.e}onEndAnimation(){this.inTransition.size||this.emit("settle")}reInit(e=null,n=null){this.destroy(),this.state=hi.Init,this.prevPage=null,this.userOptions=e||this.userOptions,this.userPlugins=n||this.userPlugins,this.processOptions()}slideTo(e=0,{friction:n=this.option("friction"),transition:i=this.option("transition")}={}){if(this.state===hi.Destroy)return;e=parseInt((e||0).toString())||0;const r=this.getPageFromIndex(e),{axis:a,isHorizontal:u,isRTL:l,pages:g,panzoom:b}=this,S=g.length,E=l&&u?1:-1;if(!b||!S)return;if(this.page!==r){const P=new Event("beforeChange",{bubbles:!0,cancelable:!0});if(this.emit("beforeChange",P,e),P.defaultPrevented)return}if(this.transitionTo(e,i))return;let C=g[r].pos;if(this.isInfinite){const P=this.contentDim,D=b.target[a]*E;S===2?C+=P*Math.floor(parseFloat(e+"")/2):C=[C,C-P,C+P].reduce(function(R,j){return Math.abs(j-D)<Math.abs(R-D)?j:R})}C*=E,Math.abs(b.target[a]-C)<1||(b.panTo({x:u?C:0,y:u?0:C,friction:n}),this.onChange(r))}slideToClosest(e){if(this.panzoom){const{pageIndex:n}=this.getPageFromPosition();this.slideTo(n,e)}}slideNext(){this.slideTo(this.page+1)}slidePrev(){this.slideTo(this.page-1)}clearTransitions(){this.inTransition.clear(),En(this.container,this.cn("inTransition"));const e=["to-prev","to-next","from-prev","from-next"];for(const n of this.slides){const i=n.el;if(i){i.removeEventListener(Zp,this.onAnimationEnd),i.classList.remove(...e);const r=n.transition;r&&i.classList.remove(`f-${r}Out`,`f-${r}In`)}}this.manageSlideVisiblity()}addSlide(e,n){var i,r,a,u;const l=this.panzoom,g=((i=this.pages[this.page])===null||i===void 0?void 0:i.pos)||0,b=((r=this.pages[this.page])===null||r===void 0?void 0:r.dim)||0,S=this.contentDim<this.viewportDim;let E=Array.isArray(n)?n:[n];const C=[];for(const P of E)C.push(my(P));this.slides.splice(e,0,...C);for(let P=0;P<this.slides.length;P++)this.slides[P].index=P;for(const P of C)this.emit("beforeInitSlide",P,P.index);if(this.page>=e&&(this.page+=C.length),this.updateMetrics(),l){const P=((a=this.pages[this.page])===null||a===void 0?void 0:a.pos)||0,D=((u=this.pages[this.page])===null||u===void 0?void 0:u.dim)||0,R=this.pages.length||1,j=this.isRTL?b-D:D-b,W=this.isRTL?g-P:P-g;S&&R===1?(e<=this.page&&(l.current[this.axis]-=j,l.target[this.axis]-=j),l.panTo({[this.isHorizontal?"x":"y"]:-1*P})):W&&e<=this.page&&(l.target[this.axis]-=W,l.current[this.axis]-=W,l.requestTick())}for(const P of C)this.emit("initSlide",P,P.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 i=this.slides[e];if(i){this.removeSlideEl(i,!0),this.slides.splice(e,1);for(let r=0;r<this.slides.length;r++)this.slides[r].index=r;this.updateMetrics(),this.slideTo(this.page,{friction:0,transition:!1}),this.emit("destroySlide",i)}}updateMetrics(){const{panzoom:e,viewport:n,track:i,slides:r,isHorizontal:a,isInfinite:u}=this;if(!i)return;const l=a?"width":"height",g=a?"offsetWidth":"offsetHeight";if(n){let E=Math.max(n[g],at(n.getBoundingClientRect()[l],1e3)),C=getComputedStyle(n),P="padding",D=a?"Right":"Bottom";E-=parseFloat(C[P+(a?"Left":"Top")])+parseFloat(C[P+D]),this.viewportDim=E}let b,S=0;for(const[E,C]of r.entries()){let P=0,D=0;!C.el&&b?(P=b.dim,D=b.gap):({dim:P,gap:D}=this.getSlideMetrics(C),b=C),P=at(P,1e3),D=at(D,1e3),C.dim=P,C.gap=D,C.pos=S,S+=P,(u||E<r.length-1)&&(S+=D)}S=at(S,1e3),this.contentDim=S,e&&(e.contentRect[l]=S,e.contentRect[a?"fullWidth":"fullHeight"]=S),this.pages=this.createPages(),this.pages=this.processPages(),this.state===hi.Init&&this.setInitialPage(),this.page=Math.max(0,Math.min(this.page,this.pages.length-1)),this.manageSlideVisiblity(),this.emit("refresh")}getProgress(e,n=!1,i=!1){e===void 0&&(e=this.page);const r=this,a=r.panzoom,u=r.contentDim,l=r.pages[e]||0;if(!l||!a)return e>this.page?-1:1;let g=-1*a.current.e,b=at((g-l.pos)/(1*l.dim),1e3),S=b,E=b;this.isInfinite&&i!==!0&&(S=at((g-l.pos+u)/(1*l.dim),1e3),E=at((g-l.pos-u)/(1*l.dim),1e3));let C=[b,S,E].reduce(function(P,D){return Math.abs(D)<Math.abs(P)?D:P});return n?C:C>1?1:C<-1?-1:C}setViewportHeight(){const{page:e,pages:n,viewport:i,isHorizontal:r}=this;if(!i||!n[e])return;let a=0;r&&this.track&&(this.track.style.height="auto",n[e].slides.forEach(u=>{u.el&&(a=Math.max(a,u.el.offsetHeight))})),i.style.height=a?`${a}px`:""}getPageForSlide(e){for(const n of this.pages)for(const i of n.slides)if(i.index===e)return n.index;return-1}getVisibleSlides(e=0){var n;const i=new Set;let{panzoom:r,contentDim:a,viewportDim:u,pages:l,page:g}=this;if(u){a=a+((n=this.slides[this.slides.length-1])===null||n===void 0?void 0:n.gap)||0;let b=0;b=r&&r.state!==In.Init&&r.state!==In.Destroy?-1*r.current[this.axis]:l[g]&&l[g].pos||0,this.isInfinite&&(b-=Math.floor(b/a)*a),this.isRTL&&this.isHorizontal&&(b*=-1);const S=b-u*e,E=b+u*(e+1),C=this.isInfinite?[-1,0,1]:[0];for(const P of this.slides)for(const D of C){const R=P.pos+D*a,j=R+P.dim+P.gap;R<E&&j>S&&i.add(P)}}return i}getPageFromPosition(e){const{viewportDim:n,contentDim:i,slides:r,pages:a,panzoom:u}=this,l=a.length,g=r.length,b=r[0],S=r[g-1],E=this.option("center");let C=0,P=0,D=0,R=e===void 0?-1*((u==null?void 0:u.target[this.axis])||0):e;E&&(R+=.5*n),this.isInfinite?(R<b.pos-.5*S.gap&&(R-=i,D=-1),R>S.pos+S.dim+.5*S.gap&&(R-=i,D=1)):R=Math.max(b.pos||0,Math.min(R,S.pos));let j=S,W=r.find(ee=>{const le=ee.pos-.5*j.gap,J=ee.pos+ee.dim+.5*ee.gap;return j=ee,R>=le&&R<J});return W||(W=S),P=this.getPageForSlide(W.index),C=P+D*l,{page:C,pageIndex:P}}setPageFromPosition(){const{pageIndex:e}=this.getPageFromPosition();this.onChange(e)}destroy(){if([hi.Destroy].includes(this.state))return;this.state=hi.Destroy;const{container:e,viewport:n,track:i,slides:r,panzoom:a}=this,u=this.option("classes");e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),a&&(a.destroy(),this.panzoom=null),r&&r.forEach(g=>{this.removeSlideEl(g)}),this.detachPlugins(),n&&(n.removeEventListener("scroll",this.onScroll),n.offsetParent&&i&&i.offsetParent&&n.replaceWith(...i.childNodes));for(const[g,b]of Object.entries(u))g!=="container"&&b&&e.classList.remove(b);this.track=null,this.viewport=null,this.page=0,this.slides=[];const l=this.events.get("ready");this.events=new Map,l&&this.events.set("ready",l)}}Object.defineProperty(ha,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:ua}),Object.defineProperty(ha,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:oB}),Object.defineProperty(ha,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:cB});const ov=function(t){if(!Mr(t))return 0;const e=window.scrollY,n=window.innerHeight,i=e+n,r=t.getBoundingClientRect(),a=r.y+e,u=r.height,l=a+u;if(e>l||i<a)return 0;if(e<a&&i>l||a<e&&l>i)return 100;let g=u;a<e&&(g-=e-a),l>i&&(g-=l-i);const b=g/n*100;return Math.round(b)},mh=!(typeof window>"u"||!window.document||!window.document.createElement);let gy;const yy=["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(","),av=t=>{if(t&&mh){gy===void 0&&document.createElement("div").focus({get preventScroll(){return gy=!0,!1}});try{if(gy)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{}}},lv=()=>{const t=document;let e,n="",i="",r="";return t.fullscreenEnabled?(n="requestFullscreen",i="exitFullscreen",r="fullscreenElement"):t.webkitFullscreenEnabled&&(n="webkitRequestFullscreen",i="webkitExitFullscreen",r="webkitFullscreenElement"),n&&(e={request:function(a=t.documentElement){return n==="webkitRequestFullscreen"?a[n](Element.ALLOW_KEYBOARD_INPUT):a[n]()},exit:function(){return t[r]&&t[i]()},isFullscreen:function(){return t[r]}}),e},_y={animated:!0,autoFocus:!0,backdropClick:"close",Carousel:{classes:{container:"fancybox__carousel",viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"}},closeButton:"auto",closeExisting:!1,commonCaption:!1,compact:()=>window.matchMedia("(max-width: 578px), (max-height: 578px)").matches,contentClick:"toggleZoom",contentDblClick:!1,defaultType:"image",defaultDisplay:"flex",dragToClose:!0,Fullscreen:{autoStart:!1},groupAll:!1,groupAttr:"data-fancybox",hideClass:"f-fadeOut",hideScrollbar:!0,idle:3500,keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"prev",ArrowDown:"next",ArrowRight:"next",ArrowLeft:"prev"},l10n:Object.assign(Object.assign({},Y1),{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"}),parentEl:null,placeFocusBack:!0,showClass:"f-zoomInUp",startIndex:0,tpl:{closeButton:'<button data-fancybox-close class="f-button is-close-btn" title="{{CLOSE}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M20 20L4 4m16 0L4 20"/></svg></button>',main:`<div class="fancybox__container" role="dialog" aria-modal="true" aria-label="{{MODAL}}" tabindex="-1">
|
624
|
+
`),te=I.createShader(I.FRAGMENT_SHADER);if(I.isContextLost())return void(this.failedToCreate=!0);if(I.shaderSource(te,ce),I.compileShader(te),!I.getShaderParameter(te,I.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${I.getShaderInfoLog(te)}`);I.attachShader(this.program,te);const me=I.createShader(I.VERTEX_SHADER);if(I.isContextLost())return void(this.failedToCreate=!0);if(I.shaderSource(me,he),I.compileShader(me),!I.getShaderParameter(me,I.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${I.getShaderInfoLog(me)}`);I.attachShader(this.program,me),this.attributes={};const ge={};this.numAttributes=V.length;for(let ve=0;ve<this.numAttributes;ve++)V[ve]&&(I.bindAttribLocation(this.program,ve,V[ve]),this.attributes[V[ve]]=ve);if(I.linkProgram(this.program),!I.getProgramParameter(this.program,I.LINK_STATUS))throw new Error(`Program failed to link: ${I.getProgramInfoLog(this.program)}`);I.deleteShader(me),I.deleteShader(te);for(let ve=0;ve<re.length;ve++){const ze=re[ve];if(ze&&!ge[ze]){const Ve=I.getUniformLocation(this.program,ze);Ve&&(ge[ze]=Ve)}}this.fixedUniforms=y(s,ge),this.terrainUniforms=((ve,ze)=>({u_depth:new l.aH(ve,ze.u_depth),u_terrain:new l.aH(ve,ze.u_terrain),u_terrain_dim:new l.aI(ve,ze.u_terrain_dim),u_terrain_matrix:new l.aJ(ve,ze.u_terrain_matrix),u_terrain_unpack:new l.aK(ve,ze.u_terrain_unpack),u_terrain_exaggeration:new l.aI(ve,ze.u_terrain_exaggeration)}))(s,ge),this.binderUniforms=m?m.getUniforms(s,ge):[]}draw(s,d,m,y,x,M,I,O,N,V,F,G,K,Q,re,ae,ce,he){const te=s.gl;if(this.failedToCreate)return;if(s.program.set(this.program),s.setDepthMode(m),s.setStencilMode(y),s.setColorMode(x),s.setCullFace(M),O){s.activeTexture.set(te.TEXTURE2),te.bindTexture(te.TEXTURE_2D,O.depthTexture),s.activeTexture.set(te.TEXTURE3),te.bindTexture(te.TEXTURE_2D,O.texture);for(const ge in this.terrainUniforms)this.terrainUniforms[ge].set(O[ge])}for(const ge in this.fixedUniforms)this.fixedUniforms[ge].set(I[ge]);re&&re.setUniforms(s,this.binderUniforms,K,{zoom:Q});let me=0;switch(d){case te.LINES:me=2;break;case te.TRIANGLES:me=3;break;case te.LINE_STRIP:me=1}for(const ge of G.get()){const ve=ge.vaos||(ge.vaos={});(ve[N]||(ve[N]=new Qh)).bind(s,this,V,re?re.getPaintVertexBuffers():[],F,ge.vertexOffset,ae,ce,he),te.drawElements(d,ge.primitiveLength*me,te.UNSIGNED_SHORT,ge.primitiveOffset*me*2)}}}function iu(v,s,d){const m=1/Zt(d,1,s.transform.tileZoom),y=Math.pow(2,d.tileID.overscaledZ),x=d.tileSize*Math.pow(2,s.transform.tileZoom)/y,M=x*(d.tileID.canonical.x+d.tileID.wrap*y),I=x*d.tileID.canonical.y;return{u_image:0,u_texsize:d.imageAtlasTexture.size,u_scale:[m,v.fromScale,v.toScale],u_fade:v.t,u_pixel_coord_upper:[M>>16,I>>16],u_pixel_coord_lower:[65535&M,65535&I]}}const Vl=(v,s,d,m)=>{const y=s.style.light,x=y.properties.get("position"),M=[x.x,x.y,x.z],I=function(){var N=new l.A(9);return l.A!=Float32Array&&(N[1]=0,N[2]=0,N[3]=0,N[5]=0,N[6]=0,N[7]=0),N[0]=1,N[4]=1,N[8]=1,N}();y.properties.get("anchor")==="viewport"&&function(N,V){var F=Math.sin(V),G=Math.cos(V);N[0]=G,N[1]=F,N[2]=0,N[3]=-F,N[4]=G,N[5]=0,N[6]=0,N[7]=0,N[8]=1}(I,-s.transform.angle),function(N,V,F){var G=V[0],K=V[1],Q=V[2];N[0]=G*F[0]+K*F[3]+Q*F[6],N[1]=G*F[1]+K*F[4]+Q*F[7],N[2]=G*F[2]+K*F[5]+Q*F[8]}(M,M,I);const O=y.properties.get("color");return{u_matrix:v,u_lightpos:M,u_lightintensity:y.properties.get("intensity"),u_lightcolor:[O.r,O.g,O.b],u_vertical_gradient:+d,u_opacity:m}},ru=(v,s,d,m,y,x,M)=>l.e(Vl(v,s,d,m),iu(x,s,M),{u_height_factor:-Math.pow(2,y.overscaledZ)/M.tileSize/8}),Pa=v=>({u_matrix:v}),Kf=(v,s,d,m)=>l.e(Pa(v),iu(d,s,m)),n_=(v,s)=>({u_matrix:v,u_world:s}),Jf=(v,s,d,m,y)=>l.e(Kf(v,s,d,m),{u_world:y}),i_=(v,s,d,m)=>{const y=v.transform;let x,M;if(m.paint.get("circle-pitch-alignment")==="map"){const I=Zt(d,1,y.zoom);x=!0,M=[I,I]}else x=!1,M=y.pixelsToGLUnits;return{u_camera_to_center_distance:y.cameraToCenterDistance,u_scale_with_map:+(m.paint.get("circle-pitch-scale")==="map"),u_matrix:v.translatePosMatrix(s.posMatrix,d,m.paint.get("circle-translate"),m.paint.get("circle-translate-anchor")),u_pitch_with_map:+x,u_device_pixel_ratio:v.pixelRatio,u_extrude_scale:M}},jo=(v,s,d)=>({u_matrix:v,u_inv_matrix:s,u_camera_to_center_distance:d.cameraToCenterDistance,u_viewport_size:[d.width,d.height]}),Fl=(v,s,d=1)=>({u_matrix:v,u_color:s,u_overlay:0,u_overlay_scale:d}),nr=v=>({u_matrix:v}),ir=(v,s,d,m)=>({u_matrix:v,u_extrude_scale:Zt(s,1,d),u_intensity:m}),su=(v,s,d,m)=>{const y=l.H();l.aP(y,0,v.width,v.height,0,0,1);const x=v.context.gl;return{u_matrix:y,u_world:[x.drawingBufferWidth,x.drawingBufferHeight],u_image:d,u_color_ramp:m,u_opacity:s.paint.get("heatmap-opacity")}};function ou(v,s){const d=Math.pow(2,s.canonical.z),m=s.canonical.y;return[new l.Z(0,m/d).toLngLat().lat,new l.Z(0,(m+1)/d).toLngLat().lat]}const au=(v,s,d,m)=>{const y=v.transform;return{u_matrix:tm(v,s,d,m),u_ratio:1/Zt(s,1,y.zoom),u_device_pixel_ratio:v.pixelRatio,u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]]}},Qf=(v,s,d,m,y)=>l.e(au(v,s,d,y),{u_image:0,u_image_height:m}),Da=(v,s,d,m,y)=>{const x=v.transform,M=em(s,x);return{u_matrix:tm(v,s,d,y),u_texsize:s.imageAtlasTexture.size,u_ratio:1/Zt(s,1,x.zoom),u_device_pixel_ratio:v.pixelRatio,u_image:0,u_scale:[M,m.fromScale,m.toScale],u_fade:m.t,u_units_to_pixels:[1/x.pixelsToGLUnits[0],1/x.pixelsToGLUnits[1]]}},r_=(v,s,d,m,y,x)=>{const M=v.lineAtlas,I=em(s,v.transform),O=d.layout.get("line-cap")==="round",N=M.getDash(m.from,O),V=M.getDash(m.to,O),F=N.width*y.fromScale,G=V.width*y.toScale;return l.e(au(v,s,d,x),{u_patternscale_a:[I/F,-N.height/2],u_patternscale_b:[I/G,-V.height/2],u_sdfgamma:M.width/(256*Math.min(F,G)*v.pixelRatio)/2,u_image:0,u_tex_y_a:N.y,u_tex_y_b:V.y,u_mix:y.t})};function em(v,s){return 1/Zt(v,1,s.tileZoom)}function tm(v,s,d,m){return v.translatePosMatrix(m?m.posMatrix:s.tileID.posMatrix,s,d.paint.get("line-translate"),d.paint.get("line-translate-anchor"))}const s_=(v,s,d,m,y)=>{return{u_matrix:v,u_tl_parent:s,u_scale_parent:d,u_buffer_scale:1,u_fade_t:m.mix,u_opacity:m.opacity*y.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:y.paint.get("raster-brightness-min"),u_brightness_high:y.paint.get("raster-brightness-max"),u_saturation_factor:(M=y.paint.get("raster-saturation"),M>0?1-1/(1.001-M):-M),u_contrast_factor:(x=y.paint.get("raster-contrast"),x>0?1/(1-x):1+x),u_spin_weights:o_(y.paint.get("raster-hue-rotate"))};var x,M};function o_(v){v*=Math.PI/180;const s=Math.sin(v),d=Math.cos(v);return[(2*d+1)/3,(-Math.sqrt(3)*s-d+1)/3,(Math.sqrt(3)*s-d+1)/3]}const nm=(v,s,d,m,y,x,M,I,O,N,V,F,G,K)=>{const Q=M.transform;return{u_is_size_zoom_constant:+(v==="constant"||v==="source"),u_is_size_feature_constant:+(v==="constant"||v==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:Q.cameraToCenterDistance,u_pitch:Q.pitch/360*2*Math.PI,u_rotate_symbol:+d,u_aspect_ratio:Q.width/Q.height,u_fade_change:M.options.fadeDuration?M.symbolFadeChange:1,u_matrix:I,u_label_plane_matrix:O,u_coord_matrix:N,u_is_text:+F,u_pitch_with_map:+m,u_is_along_line:y,u_is_variable_anchor:x,u_texsize:G,u_texture:0,u_translation:V,u_pitched_scale:K}},$l=(v,s,d,m,y,x,M,I,O,N,V,F,G,K,Q)=>{const re=M.transform;return l.e(nm(v,s,d,m,y,x,M,I,O,N,V,F,G,Q),{u_gamma_scale:m?Math.cos(re._pitch)*re.cameraToCenterDistance:1,u_device_pixel_ratio:M.pixelRatio,u_is_halo:+K})},nd=(v,s,d,m,y,x,M,I,O,N,V,F,G,K)=>l.e($l(v,s,d,m,y,x,M,I,O,N,V,!0,F,!0,K),{u_texsize_icon:G,u_texture_icon:1}),lu=(v,s,d)=>({u_matrix:v,u_opacity:s,u_color:d}),id=(v,s,d,m,y,x)=>l.e(function(M,I,O,N){const V=O.imageManager.getPattern(M.from.toString()),F=O.imageManager.getPattern(M.to.toString()),{width:G,height:K}=O.imageManager.getPixelSize(),Q=Math.pow(2,N.tileID.overscaledZ),re=N.tileSize*Math.pow(2,O.transform.tileZoom)/Q,ae=re*(N.tileID.canonical.x+N.tileID.wrap*Q),ce=re*N.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:V.tl,u_pattern_br_a:V.br,u_pattern_tl_b:F.tl,u_pattern_br_b:F.br,u_texsize:[G,K],u_mix:I.t,u_pattern_size_a:V.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:I.fromScale,u_scale_b:I.toScale,u_tile_units_to_pixels:1/Zt(N,1,O.transform.tileZoom),u_pixel_coord_upper:[ae>>16,ce>>16],u_pixel_coord_lower:[65535&ae,65535&ce]}}(m,x,d,y),{u_matrix:v,u_opacity:s}),rd={fillExtrusion:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_lightpos:new l.aN(v,s.u_lightpos),u_lightintensity:new l.aI(v,s.u_lightintensity),u_lightcolor:new l.aN(v,s.u_lightcolor),u_vertical_gradient:new l.aI(v,s.u_vertical_gradient),u_opacity:new l.aI(v,s.u_opacity)}),fillExtrusionPattern:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_lightpos:new l.aN(v,s.u_lightpos),u_lightintensity:new l.aI(v,s.u_lightintensity),u_lightcolor:new l.aN(v,s.u_lightcolor),u_vertical_gradient:new l.aI(v,s.u_vertical_gradient),u_height_factor:new l.aI(v,s.u_height_factor),u_image:new l.aH(v,s.u_image),u_texsize:new l.aO(v,s.u_texsize),u_pixel_coord_upper:new l.aO(v,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,s.u_pixel_coord_lower),u_scale:new l.aN(v,s.u_scale),u_fade:new l.aI(v,s.u_fade),u_opacity:new l.aI(v,s.u_opacity)}),fill:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix)}),fillPattern:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_image:new l.aH(v,s.u_image),u_texsize:new l.aO(v,s.u_texsize),u_pixel_coord_upper:new l.aO(v,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,s.u_pixel_coord_lower),u_scale:new l.aN(v,s.u_scale),u_fade:new l.aI(v,s.u_fade)}),fillOutline:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_world:new l.aO(v,s.u_world)}),fillOutlinePattern:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_world:new l.aO(v,s.u_world),u_image:new l.aH(v,s.u_image),u_texsize:new l.aO(v,s.u_texsize),u_pixel_coord_upper:new l.aO(v,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,s.u_pixel_coord_lower),u_scale:new l.aN(v,s.u_scale),u_fade:new l.aI(v,s.u_fade)}),circle:(v,s)=>({u_camera_to_center_distance:new l.aI(v,s.u_camera_to_center_distance),u_scale_with_map:new l.aH(v,s.u_scale_with_map),u_pitch_with_map:new l.aH(v,s.u_pitch_with_map),u_extrude_scale:new l.aO(v,s.u_extrude_scale),u_device_pixel_ratio:new l.aI(v,s.u_device_pixel_ratio),u_matrix:new l.aJ(v,s.u_matrix)}),collisionBox:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_pixel_extrude_scale:new l.aO(v,s.u_pixel_extrude_scale)}),collisionCircle:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_inv_matrix:new l.aJ(v,s.u_inv_matrix),u_camera_to_center_distance:new l.aI(v,s.u_camera_to_center_distance),u_viewport_size:new l.aO(v,s.u_viewport_size)}),debug:(v,s)=>({u_color:new l.aL(v,s.u_color),u_matrix:new l.aJ(v,s.u_matrix),u_overlay:new l.aH(v,s.u_overlay),u_overlay_scale:new l.aI(v,s.u_overlay_scale)}),clippingMask:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix)}),heatmap:(v,s)=>({u_extrude_scale:new l.aI(v,s.u_extrude_scale),u_intensity:new l.aI(v,s.u_intensity),u_matrix:new l.aJ(v,s.u_matrix)}),heatmapTexture:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_world:new l.aO(v,s.u_world),u_image:new l.aH(v,s.u_image),u_color_ramp:new l.aH(v,s.u_color_ramp),u_opacity:new l.aI(v,s.u_opacity)}),hillshade:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_image:new l.aH(v,s.u_image),u_latrange:new l.aO(v,s.u_latrange),u_light:new l.aO(v,s.u_light),u_shadow:new l.aL(v,s.u_shadow),u_highlight:new l.aL(v,s.u_highlight),u_accent:new l.aL(v,s.u_accent)}),hillshadePrepare:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_image:new l.aH(v,s.u_image),u_dimension:new l.aO(v,s.u_dimension),u_zoom:new l.aI(v,s.u_zoom),u_unpack:new l.aK(v,s.u_unpack)}),line:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_ratio:new l.aI(v,s.u_ratio),u_device_pixel_ratio:new l.aI(v,s.u_device_pixel_ratio),u_units_to_pixels:new l.aO(v,s.u_units_to_pixels)}),lineGradient:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_ratio:new l.aI(v,s.u_ratio),u_device_pixel_ratio:new l.aI(v,s.u_device_pixel_ratio),u_units_to_pixels:new l.aO(v,s.u_units_to_pixels),u_image:new l.aH(v,s.u_image),u_image_height:new l.aI(v,s.u_image_height)}),linePattern:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_texsize:new l.aO(v,s.u_texsize),u_ratio:new l.aI(v,s.u_ratio),u_device_pixel_ratio:new l.aI(v,s.u_device_pixel_ratio),u_image:new l.aH(v,s.u_image),u_units_to_pixels:new l.aO(v,s.u_units_to_pixels),u_scale:new l.aN(v,s.u_scale),u_fade:new l.aI(v,s.u_fade)}),lineSDF:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_ratio:new l.aI(v,s.u_ratio),u_device_pixel_ratio:new l.aI(v,s.u_device_pixel_ratio),u_units_to_pixels:new l.aO(v,s.u_units_to_pixels),u_patternscale_a:new l.aO(v,s.u_patternscale_a),u_patternscale_b:new l.aO(v,s.u_patternscale_b),u_sdfgamma:new l.aI(v,s.u_sdfgamma),u_image:new l.aH(v,s.u_image),u_tex_y_a:new l.aI(v,s.u_tex_y_a),u_tex_y_b:new l.aI(v,s.u_tex_y_b),u_mix:new l.aI(v,s.u_mix)}),raster:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_tl_parent:new l.aO(v,s.u_tl_parent),u_scale_parent:new l.aI(v,s.u_scale_parent),u_buffer_scale:new l.aI(v,s.u_buffer_scale),u_fade_t:new l.aI(v,s.u_fade_t),u_opacity:new l.aI(v,s.u_opacity),u_image0:new l.aH(v,s.u_image0),u_image1:new l.aH(v,s.u_image1),u_brightness_low:new l.aI(v,s.u_brightness_low),u_brightness_high:new l.aI(v,s.u_brightness_high),u_saturation_factor:new l.aI(v,s.u_saturation_factor),u_contrast_factor:new l.aI(v,s.u_contrast_factor),u_spin_weights:new l.aN(v,s.u_spin_weights)}),symbolIcon:(v,s)=>({u_is_size_zoom_constant:new l.aH(v,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(v,s.u_is_size_feature_constant),u_size_t:new l.aI(v,s.u_size_t),u_size:new l.aI(v,s.u_size),u_camera_to_center_distance:new l.aI(v,s.u_camera_to_center_distance),u_pitch:new l.aI(v,s.u_pitch),u_rotate_symbol:new l.aH(v,s.u_rotate_symbol),u_aspect_ratio:new l.aI(v,s.u_aspect_ratio),u_fade_change:new l.aI(v,s.u_fade_change),u_matrix:new l.aJ(v,s.u_matrix),u_label_plane_matrix:new l.aJ(v,s.u_label_plane_matrix),u_coord_matrix:new l.aJ(v,s.u_coord_matrix),u_is_text:new l.aH(v,s.u_is_text),u_pitch_with_map:new l.aH(v,s.u_pitch_with_map),u_is_along_line:new l.aH(v,s.u_is_along_line),u_is_variable_anchor:new l.aH(v,s.u_is_variable_anchor),u_texsize:new l.aO(v,s.u_texsize),u_texture:new l.aH(v,s.u_texture),u_translation:new l.aO(v,s.u_translation),u_pitched_scale:new l.aI(v,s.u_pitched_scale)}),symbolSDF:(v,s)=>({u_is_size_zoom_constant:new l.aH(v,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(v,s.u_is_size_feature_constant),u_size_t:new l.aI(v,s.u_size_t),u_size:new l.aI(v,s.u_size),u_camera_to_center_distance:new l.aI(v,s.u_camera_to_center_distance),u_pitch:new l.aI(v,s.u_pitch),u_rotate_symbol:new l.aH(v,s.u_rotate_symbol),u_aspect_ratio:new l.aI(v,s.u_aspect_ratio),u_fade_change:new l.aI(v,s.u_fade_change),u_matrix:new l.aJ(v,s.u_matrix),u_label_plane_matrix:new l.aJ(v,s.u_label_plane_matrix),u_coord_matrix:new l.aJ(v,s.u_coord_matrix),u_is_text:new l.aH(v,s.u_is_text),u_pitch_with_map:new l.aH(v,s.u_pitch_with_map),u_is_along_line:new l.aH(v,s.u_is_along_line),u_is_variable_anchor:new l.aH(v,s.u_is_variable_anchor),u_texsize:new l.aO(v,s.u_texsize),u_texture:new l.aH(v,s.u_texture),u_gamma_scale:new l.aI(v,s.u_gamma_scale),u_device_pixel_ratio:new l.aI(v,s.u_device_pixel_ratio),u_is_halo:new l.aH(v,s.u_is_halo),u_translation:new l.aO(v,s.u_translation),u_pitched_scale:new l.aI(v,s.u_pitched_scale)}),symbolTextAndIcon:(v,s)=>({u_is_size_zoom_constant:new l.aH(v,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(v,s.u_is_size_feature_constant),u_size_t:new l.aI(v,s.u_size_t),u_size:new l.aI(v,s.u_size),u_camera_to_center_distance:new l.aI(v,s.u_camera_to_center_distance),u_pitch:new l.aI(v,s.u_pitch),u_rotate_symbol:new l.aH(v,s.u_rotate_symbol),u_aspect_ratio:new l.aI(v,s.u_aspect_ratio),u_fade_change:new l.aI(v,s.u_fade_change),u_matrix:new l.aJ(v,s.u_matrix),u_label_plane_matrix:new l.aJ(v,s.u_label_plane_matrix),u_coord_matrix:new l.aJ(v,s.u_coord_matrix),u_is_text:new l.aH(v,s.u_is_text),u_pitch_with_map:new l.aH(v,s.u_pitch_with_map),u_is_along_line:new l.aH(v,s.u_is_along_line),u_is_variable_anchor:new l.aH(v,s.u_is_variable_anchor),u_texsize:new l.aO(v,s.u_texsize),u_texsize_icon:new l.aO(v,s.u_texsize_icon),u_texture:new l.aH(v,s.u_texture),u_texture_icon:new l.aH(v,s.u_texture_icon),u_gamma_scale:new l.aI(v,s.u_gamma_scale),u_device_pixel_ratio:new l.aI(v,s.u_device_pixel_ratio),u_is_halo:new l.aH(v,s.u_is_halo),u_translation:new l.aO(v,s.u_translation),u_pitched_scale:new l.aI(v,s.u_pitched_scale)}),background:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_opacity:new l.aI(v,s.u_opacity),u_color:new l.aL(v,s.u_color)}),backgroundPattern:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_opacity:new l.aI(v,s.u_opacity),u_image:new l.aH(v,s.u_image),u_pattern_tl_a:new l.aO(v,s.u_pattern_tl_a),u_pattern_br_a:new l.aO(v,s.u_pattern_br_a),u_pattern_tl_b:new l.aO(v,s.u_pattern_tl_b),u_pattern_br_b:new l.aO(v,s.u_pattern_br_b),u_texsize:new l.aO(v,s.u_texsize),u_mix:new l.aI(v,s.u_mix),u_pattern_size_a:new l.aO(v,s.u_pattern_size_a),u_pattern_size_b:new l.aO(v,s.u_pattern_size_b),u_scale_a:new l.aI(v,s.u_scale_a),u_scale_b:new l.aI(v,s.u_scale_b),u_pixel_coord_upper:new l.aO(v,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,s.u_pixel_coord_lower),u_tile_units_to_pixels:new l.aI(v,s.u_tile_units_to_pixels)}),terrain:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_texture:new l.aH(v,s.u_texture),u_ele_delta:new l.aI(v,s.u_ele_delta),u_fog_matrix:new l.aJ(v,s.u_fog_matrix),u_fog_color:new l.aL(v,s.u_fog_color),u_fog_ground_blend:new l.aI(v,s.u_fog_ground_blend),u_fog_ground_blend_opacity:new l.aI(v,s.u_fog_ground_blend_opacity),u_horizon_color:new l.aL(v,s.u_horizon_color),u_horizon_fog_blend:new l.aI(v,s.u_horizon_fog_blend)}),terrainDepth:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_ele_delta:new l.aI(v,s.u_ele_delta)}),terrainCoords:(v,s)=>({u_matrix:new l.aJ(v,s.u_matrix),u_texture:new l.aH(v,s.u_texture),u_terrain_coords_id:new l.aI(v,s.u_terrain_coords_id),u_ele_delta:new l.aI(v,s.u_ele_delta)}),sky:(v,s)=>({u_sky_color:new l.aL(v,s.u_sky_color),u_horizon_color:new l.aL(v,s.u_horizon_color),u_horizon:new l.aI(v,s.u_horizon),u_sky_horizon_blend:new l.aI(v,s.u_sky_horizon_blend)})};class Ms{constructor(s,d,m){this.context=s;const y=s.gl;this.buffer=y.createBuffer(),this.dynamicDraw=!!m,this.context.unbindVAO(),s.bindElementBuffer.set(this.buffer),y.bufferData(y.ELEMENT_ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(s){const d=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),d.bufferSubData(d.ELEMENT_ARRAY_BUFFER,0,s.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const a_={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class sd{constructor(s,d,m,y){this.length=d.length,this.attributes=m,this.itemSize=d.bytesPerElement,this.dynamicDraw=y,this.context=s;const x=s.gl;this.buffer=x.createBuffer(),s.bindVertexBuffer.set(this.buffer),x.bufferData(x.ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?x.DYNAMIC_DRAW:x.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(s){if(s.length!==this.length)throw new Error(`Length of new data is ${s.length}, which doesn't match current length of ${this.length}`);const d=this.context.gl;this.bind(),d.bufferSubData(d.ARRAY_BUFFER,0,s.arrayBuffer)}enableAttributes(s,d){for(let m=0;m<this.attributes.length;m++){const y=d.attributes[this.attributes[m].name];y!==void 0&&s.enableVertexAttribArray(y)}}setVertexAttribPointers(s,d,m){for(let y=0;y<this.attributes.length;y++){const x=this.attributes[y],M=d.attributes[x.name];M!==void 0&&s.vertexAttribPointer(M,x.components,s[a_[x.type]],!1,this.itemSize,x.offset+this.itemSize*(m||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Uo=new WeakMap;function po(v){var s;if(Uo.has(v))return Uo.get(v);{const d=(s=v.getParameter(v.VERSION))===null||s===void 0?void 0:s.startsWith("WebGL 2.0");return Uo.set(v,d),d}}class _n{constructor(s){this.gl=s.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(s){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class cu extends _n{getDefault(){return l.aM.transparent}set(s){const d=this.current;(s.r!==d.r||s.g!==d.g||s.b!==d.b||s.a!==d.a||this.dirty)&&(this.gl.clearColor(s.r,s.g,s.b,s.a),this.current=s,this.dirty=!1)}}class l_ extends _n{getDefault(){return 1}set(s){(s!==this.current||this.dirty)&&(this.gl.clearDepth(s),this.current=s,this.dirty=!1)}}class Oa extends _n{getDefault(){return 0}set(s){(s!==this.current||this.dirty)&&(this.gl.clearStencil(s),this.current=s,this.dirty=!1)}}class c_ extends _n{getDefault(){return[!0,!0,!0,!0]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||s[2]!==d[2]||s[3]!==d[3]||this.dirty)&&(this.gl.colorMask(s[0],s[1],s[2],s[3]),this.current=s,this.dirty=!1)}}class im extends _n{getDefault(){return!0}set(s){(s!==this.current||this.dirty)&&(this.gl.depthMask(s),this.current=s,this.dirty=!1)}}class u_ extends _n{getDefault(){return 255}set(s){(s!==this.current||this.dirty)&&(this.gl.stencilMask(s),this.current=s,this.dirty=!1)}}class rm extends _n{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(s){const d=this.current;(s.func!==d.func||s.ref!==d.ref||s.mask!==d.mask||this.dirty)&&(this.gl.stencilFunc(s.func,s.ref,s.mask),this.current=s,this.dirty=!1)}}class od extends _n{getDefault(){const s=this.gl;return[s.KEEP,s.KEEP,s.KEEP]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||s[2]!==d[2]||this.dirty)&&(this.gl.stencilOp(s[0],s[1],s[2]),this.current=s,this.dirty=!1)}}class sm extends _n{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;s?d.enable(d.STENCIL_TEST):d.disable(d.STENCIL_TEST),this.current=s,this.dirty=!1}}class om extends _n{getDefault(){return[0,1]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||this.dirty)&&(this.gl.depthRange(s[0],s[1]),this.current=s,this.dirty=!1)}}class am extends _n{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;s?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),this.current=s,this.dirty=!1}}class lm extends _n{getDefault(){return this.gl.LESS}set(s){(s!==this.current||this.dirty)&&(this.gl.depthFunc(s),this.current=s,this.dirty=!1)}}class Ho extends _n{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;s?d.enable(d.BLEND):d.disable(d.BLEND),this.current=s,this.dirty=!1}}class cm extends _n{getDefault(){const s=this.gl;return[s.ONE,s.ZERO]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||this.dirty)&&(this.gl.blendFunc(s[0],s[1]),this.current=s,this.dirty=!1)}}class h_ extends _n{getDefault(){return l.aM.transparent}set(s){const d=this.current;(s.r!==d.r||s.g!==d.g||s.b!==d.b||s.a!==d.a||this.dirty)&&(this.gl.blendColor(s.r,s.g,s.b,s.a),this.current=s,this.dirty=!1)}}class um extends _n{getDefault(){return this.gl.FUNC_ADD}set(s){(s!==this.current||this.dirty)&&(this.gl.blendEquation(s),this.current=s,this.dirty=!1)}}class jl extends _n{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;s?d.enable(d.CULL_FACE):d.disable(d.CULL_FACE),this.current=s,this.dirty=!1}}class d_ extends _n{getDefault(){return this.gl.BACK}set(s){(s!==this.current||this.dirty)&&(this.gl.cullFace(s),this.current=s,this.dirty=!1)}}class uu extends _n{getDefault(){return this.gl.CCW}set(s){(s!==this.current||this.dirty)&&(this.gl.frontFace(s),this.current=s,this.dirty=!1)}}class p_ extends _n{getDefault(){return null}set(s){(s!==this.current||this.dirty)&&(this.gl.useProgram(s),this.current=s,this.dirty=!1)}}class f_ extends _n{getDefault(){return this.gl.TEXTURE0}set(s){(s!==this.current||this.dirty)&&(this.gl.activeTexture(s),this.current=s,this.dirty=!1)}}class hm extends _n{getDefault(){const s=this.gl;return[0,0,s.drawingBufferWidth,s.drawingBufferHeight]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||s[2]!==d[2]||s[3]!==d[3]||this.dirty)&&(this.gl.viewport(s[0],s[1],s[2],s[3]),this.current=s,this.dirty=!1)}}class dm extends _n{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.bindFramebuffer(d.FRAMEBUFFER,s),this.current=s,this.dirty=!1}}class pm extends _n{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.bindRenderbuffer(d.RENDERBUFFER,s),this.current=s,this.dirty=!1}}class ad extends _n{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.bindTexture(d.TEXTURE_2D,s),this.current=s,this.dirty=!1}}class fm extends _n{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.bindBuffer(d.ARRAY_BUFFER,s),this.current=s,this.dirty=!1}}class hu extends _n{getDefault(){return null}set(s){const d=this.gl;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,s),this.current=s,this.dirty=!1}}class Hs extends _n{getDefault(){return null}set(s){var d;if(s===this.current&&!this.dirty)return;const m=this.gl;po(m)?m.bindVertexArray(s):(d=m.getExtension("OES_vertex_array_object"))===null||d===void 0||d.bindVertexArrayOES(s),this.current=s,this.dirty=!1}}class ld extends _n{getDefault(){return 4}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_ALIGNMENT,s),this.current=s,this.dirty=!1}}class cd extends _n{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s),this.current=s,this.dirty=!1}}class ud extends _n{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL,s),this.current=s,this.dirty=!1}}class du extends _n{constructor(s,d){super(s),this.context=s,this.parent=d}getDefault(){return null}}class hd extends du{setDirty(){this.dirty=!0}set(s){if(s===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,s,0),this.current=s,this.dirty=!1}}class qo extends du{set(s){if(s===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,s),this.current=s,this.dirty=!1}}class dd extends du{set(s){if(s===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,s),this.current=s,this.dirty=!1}}class m_{constructor(s,d,m,y,x){this.context=s,this.width=d,this.height=m;const M=s.gl,I=this.framebuffer=M.createFramebuffer();if(this.colorAttachment=new hd(s,I),y)this.depthAttachment=x?new dd(s,I):new qo(s,I);else if(x)throw new Error("Stencil cannot be set without depth");if(M.checkFramebufferStatus(M.FRAMEBUFFER)!==M.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const s=this.context.gl,d=this.colorAttachment.get();if(d&&s.deleteTexture(d),this.depthAttachment){const m=this.depthAttachment.get();m&&s.deleteRenderbuffer(m)}s.deleteFramebuffer(this.framebuffer)}}class Jn{constructor(s,d,m){this.blendFunction=s,this.blendColor=d,this.mask=m}}Jn.Replace=[1,0],Jn.disabled=new Jn(Jn.Replace,l.aM.transparent,[!1,!1,!1,!1]),Jn.unblended=new Jn(Jn.Replace,l.aM.transparent,[!0,!0,!0,!0]),Jn.alphaBlended=new Jn([1,771],l.aM.transparent,[!0,!0,!0,!0]);class g_{constructor(s){var d,m;if(this.gl=s,this.clearColor=new cu(this),this.clearDepth=new l_(this),this.clearStencil=new Oa(this),this.colorMask=new c_(this),this.depthMask=new im(this),this.stencilMask=new u_(this),this.stencilFunc=new rm(this),this.stencilOp=new od(this),this.stencilTest=new sm(this),this.depthRange=new om(this),this.depthTest=new am(this),this.depthFunc=new lm(this),this.blend=new Ho(this),this.blendFunc=new cm(this),this.blendColor=new h_(this),this.blendEquation=new um(this),this.cullFace=new jl(this),this.cullFaceSide=new d_(this),this.frontFace=new uu(this),this.program=new p_(this),this.activeTexture=new f_(this),this.viewport=new hm(this),this.bindFramebuffer=new dm(this),this.bindRenderbuffer=new pm(this),this.bindTexture=new ad(this),this.bindVertexBuffer=new fm(this),this.bindElementBuffer=new hu(this),this.bindVertexArray=new Hs(this),this.pixelStoreUnpack=new ld(this),this.pixelStoreUnpackPremultiplyAlpha=new cd(this),this.pixelStoreUnpackFlipY=new ud(this),this.extTextureFilterAnisotropic=s.getExtension("EXT_texture_filter_anisotropic")||s.getExtension("MOZ_EXT_texture_filter_anisotropic")||s.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=s.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=s.getParameter(s.MAX_TEXTURE_SIZE),po(s)){this.HALF_FLOAT=s.HALF_FLOAT;const y=s.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(d=s.RGBA16F)!==null&&d!==void 0?d:y==null?void 0:y.RGBA16F_EXT,this.RGB16F=(m=s.RGB16F)!==null&&m!==void 0?m:y==null?void 0:y.RGB16F_EXT,s.getExtension("EXT_color_buffer_float")}else{s.getExtension("EXT_color_buffer_half_float"),s.getExtension("OES_texture_half_float_linear");const y=s.getExtension("OES_texture_half_float");this.HALF_FLOAT=y==null?void 0:y.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(s,d){return new Ms(this,s,d)}createVertexBuffer(s,d,m){return new sd(this,s,d,m)}createRenderbuffer(s,d,m){const y=this.gl,x=y.createRenderbuffer();return this.bindRenderbuffer.set(x),y.renderbufferStorage(y.RENDERBUFFER,s,d,m),this.bindRenderbuffer.set(null),x}createFramebuffer(s,d,m,y){return new m_(this,s,d,m,y)}clear({color:s,depth:d,stencil:m}){const y=this.gl;let x=0;s&&(x|=y.COLOR_BUFFER_BIT,this.clearColor.set(s),this.colorMask.set([!0,!0,!0,!0])),d!==void 0&&(x|=y.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(d),this.depthMask.set(!0)),m!==void 0&&(x|=y.STENCIL_BUFFER_BIT,this.clearStencil.set(m),this.stencilMask.set(255)),y.clear(x)}setCullFace(s){s.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(s.mode),this.frontFace.set(s.frontFace))}setDepthMode(s){s.func!==this.gl.ALWAYS||s.mask?(this.depthTest.set(!0),this.depthFunc.set(s.func),this.depthMask.set(s.mask),this.depthRange.set(s.range)):this.depthTest.set(!1)}setStencilMode(s){s.test.func!==this.gl.ALWAYS||s.mask?(this.stencilTest.set(!0),this.stencilMask.set(s.mask),this.stencilOp.set([s.fail,s.depthFail,s.pass]),this.stencilFunc.set({func:s.test.func,ref:s.ref,mask:s.test.mask})):this.stencilTest.set(!1)}setColorMode(s){l.aE(s.blendFunction,Jn.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(s.blendFunction),this.blendColor.set(s.blendColor)),this.colorMask.set(s.mask)}createVertexArray(){var s;return po(this.gl)?this.gl.createVertexArray():(s=this.gl.getExtension("OES_vertex_array_object"))===null||s===void 0?void 0:s.createVertexArrayOES()}deleteVertexArray(s){var d;return po(this.gl)?this.gl.deleteVertexArray(s):(d=this.gl.getExtension("OES_vertex_array_object"))===null||d===void 0?void 0:d.deleteVertexArrayOES(s)}unbindVAO(){this.bindVertexArray.set(null)}}class Ht{constructor(s,d,m){this.func=s,this.mask=d,this.range=m}}Ht.ReadOnly=!1,Ht.ReadWrite=!0,Ht.disabled=new Ht(519,Ht.ReadOnly,[0,1]);const pu=7680;class On{constructor(s,d,m,y,x,M){this.test=s,this.ref=d,this.mask=m,this.fail=y,this.depthFail=x,this.pass=M}}On.disabled=new On({func:519,mask:0},0,0,pu,pu,pu);class Tn{constructor(s,d,m){this.enable=s,this.mode=d,this.frontFace=m}}let Wo;function Ul(v,s,d,m,y){const x=v.context,M=x.gl,I=v.useProgram("collisionBox"),O=[];let N=0,V=0;for(let ce=0;ce<m.length;ce++){const he=m[ce],te=s.getTile(he).getBucket(d);if(!te)continue;const me=y?te.textCollisionBox:te.iconCollisionBox,ge=te.collisionCircleArray;if(ge.length>0){const ve=l.H();l.aQ(ve,te.placementInvProjMatrix,v.transform.glCoordMatrix),l.aQ(ve,ve,te.placementViewportMatrix),O.push({circleArray:ge,circleOffset:V,transform:he.posMatrix,invTransform:ve,coord:he}),N+=ge.length/4,V=N}me&&I.draw(x,M.LINES,Ht.disabled,On.disabled,v.colorModeForRenderPass(),Tn.disabled,{u_matrix:he.posMatrix,u_pixel_extrude_scale:[1/(F=v.transform).width,1/F.height]},v.style.map.terrain&&v.style.map.terrain.getTerrainData(he),d.id,me.layoutVertexBuffer,me.indexBuffer,me.segments,null,v.transform.zoom,null,null,me.collisionVertexBuffer)}var F;if(!y||!O.length)return;const G=v.useProgram("collisionCircle"),K=new l.aR;K.resize(4*N),K._trim();let Q=0;for(const ce of O)for(let he=0;he<ce.circleArray.length/4;he++){const te=4*he,me=ce.circleArray[te+0],ge=ce.circleArray[te+1],ve=ce.circleArray[te+2],ze=ce.circleArray[te+3];K.emplace(Q++,me,ge,ve,ze,0),K.emplace(Q++,me,ge,ve,ze,1),K.emplace(Q++,me,ge,ve,ze,2),K.emplace(Q++,me,ge,ve,ze,3)}(!Wo||Wo.length<2*N)&&(Wo=function(ce){const he=2*ce,te=new l.aT;te.resize(he),te._trim();for(let me=0;me<he;me++){const ge=6*me;te.uint16[ge+0]=4*me+0,te.uint16[ge+1]=4*me+1,te.uint16[ge+2]=4*me+2,te.uint16[ge+3]=4*me+2,te.uint16[ge+4]=4*me+3,te.uint16[ge+5]=4*me+0}return te}(N));const re=x.createIndexBuffer(Wo,!0),ae=x.createVertexBuffer(K,l.aS.members,!0);for(const ce of O){const he=jo(ce.transform,ce.invTransform,v.transform);G.draw(x,M.TRIANGLES,Ht.disabled,On.disabled,v.colorModeForRenderPass(),Tn.disabled,he,v.style.map.terrain&&v.style.map.terrain.getTerrainData(ce.coord),d.id,ae,re,l.a0.simpleSegment(0,2*ce.circleOffset,ce.circleArray.length,ce.circleArray.length/2),null,v.transform.zoom,null,null,null)}ae.destroy(),re.destroy()}Tn.disabled=new Tn(!1,1029,2305),Tn.backCCW=new Tn(!0,1029,2305);const Hl=l.an(new Float32Array(16));function pd(v,s,d,m,y,x){const{horizontalAlign:M,verticalAlign:I}=l.au(v);return new l.P((-(M-.5)*s/y+m[0])*x,(-(I-.5)*d/y+m[1])*x)}function Go(v,s,d,m,y,x){const M=s.tileAnchorPoint.add(new l.P(s.translation[0],s.translation[1]));if(s.pitchWithMap){let I=m.mult(x);d||(I=I.rotate(-y));const O=M.add(I);return se(O.x,O.y,s.labelPlaneMatrix,s.getElevation).point}if(d){const I=Me(s.tileAnchorPoint.x+1,s.tileAnchorPoint.y,s).point.sub(v),O=Math.atan(I.y/I.x)+(I.x<0?Math.PI:0);return v.add(m.rotate(O))}return v.add(m)}function za(v,s,d,m,y,x,M,I,O,N,V,F,G,K){const Q=v.text.placedSymbolArray,re=v.text.dynamicLayoutVertexArray,ae=v.icon.dynamicLayoutVertexArray,ce={};re.clear();for(let he=0;he<Q.length;he++){const te=Q.get(he),me=te.hidden||!te.crossTileID||v.allowVerticalPlacement&&!te.placedOrientation?null:m[te.crossTileID];if(me){const ge=new l.P(te.anchorX,te.anchorY),ve={getElevation:K,width:y.width,height:y.height,labelPlaneMatrix:x,lineVertexArray:null,pitchWithMap:d,projection:V,projectionCache:null,tileAnchorPoint:ge,translation:F,unwrappedTileID:G},ze=d?se(ge.x,ge.y,M,K):Me(ge.x,ge.y,ve),Ve=H(y.cameraToCenterDistance,ze.signedDistanceFromCamera);let Je=l.ai(v.textSizeData,O,te)*Ve/l.ap;d&&(Je*=v.tilePixelRatio/I);const{width:it,height:Ge,anchor:qe,textOffset:mt,textBoxScale:Dt}=me,Ye=pd(qe,it,Ge,mt,Dt,Je),tt=V.getPitchedTextCorrection(y,ge.add(new l.P(F[0],F[1])),G),It=Go(ze.point,ve,s,Ye,y.angle,tt),Fn=v.allowVerticalPlacement&&te.placedOrientation===l.ah.vertical?Math.PI/2:0;for(let Lt=0;Lt<te.numGlyphs;Lt++)l.aj(re,It,Fn);N&&te.associatedIconIndex>=0&&(ce[te.associatedIconIndex]={shiftedAnchor:It,angle:Fn})}else kt(te.numGlyphs,re)}if(N){ae.clear();const he=v.icon.placedSymbolArray;for(let te=0;te<he.length;te++){const me=he.get(te);if(me.hidden)kt(me.numGlyphs,ae);else{const ge=ce[te];if(ge)for(let ve=0;ve<me.numGlyphs;ve++)l.aj(ae,ge.shiftedAnchor,ge.angle);else kt(me.numGlyphs,ae)}}v.icon.dynamicLayoutVertexBuffer.updateData(ae)}v.text.dynamicLayoutVertexBuffer.updateData(re)}function Rr(v,s,d){return d.iconsInText&&s?"symbolTextAndIcon":v?"symbolSDF":"symbolIcon"}function fd(v,s,d,m,y,x,M,I,O,N,V,F){const G=v.context,K=G.gl,Q=v.transform,re=Fo(),ae=I==="map",ce=O==="map",he=I!=="viewport"&&d.layout.get("symbol-placement")!=="point",te=ae&&!ce&&!he,me=!ce&&he,ge=!d.layout.get("symbol-sort-key").isConstant();let ve=!1;const ze=v.depthModeForSublayer(0,Ht.ReadOnly),Ve=d._unevaluatedLayout.hasValue("text-variable-anchor")||d._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Je=[],it=re.getCircleRadiusCorrection(Q);for(const Ge of m){const qe=s.getTile(Ge),mt=qe.getBucket(d);if(!mt)continue;const Dt=y?mt.text:mt.icon;if(!Dt||!Dt.segments.get().length||!Dt.hasVisibleVertices)continue;const Ye=Dt.programConfigurations.get(d.id),tt=y||mt.sdfIcons,It=y?mt.textSizeData:mt.iconSizeData,Fn=ce||Q.pitch!==0,Lt=v.useProgram(Rr(tt,y,mt),Ye),Yt=l.ag(It,Q.zoom),$n=v.style.map.terrain&&v.style.map.terrain.getTerrainData(Ge);let Di,ns,jn,rr,Wi=[0,0],Oi=null;if(y)ns=qe.glyphAtlasTexture,jn=K.LINEAR,Di=qe.glyphAtlasTexture.size,mt.iconsInText&&(Wi=qe.imageAtlasTexture.size,Oi=qe.imageAtlasTexture,rr=Fn||v.options.rotating||v.options.zooming||It.kind==="composite"||It.kind==="camera"?K.LINEAR:K.NEAREST);else{const tn=d.layout.get("icon-size").constantOr(0)!==1||mt.iconsNeedLinear;ns=qe.imageAtlasTexture,jn=tt||v.options.rotating||v.options.zooming||tn||Fn?K.LINEAR:K.NEAREST,Di=qe.imageAtlasTexture.size}const Gi=Zt(qe,1,v.transform.zoom),Ps=me?Ge.posMatrix:Hl,Xa=Hi(Ps,ce,ae,v.transform,Gi),Du=fr(Ps,ce,ae,v.transform,Gi),Ka=fr(Ge.posMatrix,ce,ae,v.transform,Gi),Fr=re.translatePosition(v.transform,qe,x,M),Ou=Ve&&mt.hasTextData(),Vd=d.layout.get("icon-text-fit")!=="none"&&Ou&&mt.hasIconData();if(he){const tn=v.style.map.terrain?(Ja,Qa)=>v.style.map.terrain.getElevation(Ge,Ja,Qa):null,Jo=d.layout.get("text-rotation-alignment")==="map";Y(mt,Ge.posMatrix,v,y,Xa,Ka,ce,N,Jo,re,Ge.toUnwrapped(),Q.width,Q.height,Fr,tn)}const $r=Ge.posMatrix,jr=y&&Ve||Vd,fo=he||jr?Hl:Xa,is=Du,ki=tt&&d.paint.get(y?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let zi;zi=tt?mt.iconsInText?nd(It.kind,Yt,te,ce,he,jr,v,$r,fo,is,Fr,Di,Wi,it):$l(It.kind,Yt,te,ce,he,jr,v,$r,fo,is,Fr,y,Di,!0,it):nm(It.kind,Yt,te,ce,he,jr,v,$r,fo,is,Fr,y,Di,it);const xr={program:Lt,buffers:Dt,uniformValues:zi,atlasTexture:ns,atlasTextureIcon:Oi,atlasInterpolation:jn,atlasInterpolationIcon:rr,isSDF:tt,hasHalo:ki};if(ge&&mt.canOverlap){ve=!0;const tn=Dt.segments.get();for(const Jo of tn)Je.push({segments:new l.a0([Jo]),sortKey:Jo.sortKey,state:xr,terrainData:$n})}else Je.push({segments:Dt.segments,sortKey:0,state:xr,terrainData:$n})}ve&&Je.sort((Ge,qe)=>Ge.sortKey-qe.sortKey);for(const Ge of Je){const qe=Ge.state;if(G.activeTexture.set(K.TEXTURE0),qe.atlasTexture.bind(qe.atlasInterpolation,K.CLAMP_TO_EDGE),qe.atlasTextureIcon&&(G.activeTexture.set(K.TEXTURE1),qe.atlasTextureIcon&&qe.atlasTextureIcon.bind(qe.atlasInterpolationIcon,K.CLAMP_TO_EDGE)),qe.isSDF){const mt=qe.uniformValues;qe.hasHalo&&(mt.u_is_halo=1,md(qe.buffers,Ge.segments,d,v,qe.program,ze,V,F,mt,Ge.terrainData)),mt.u_is_halo=0}md(qe.buffers,Ge.segments,d,v,qe.program,ze,V,F,qe.uniformValues,Ge.terrainData)}}function md(v,s,d,m,y,x,M,I,O,N){const V=m.context;y.draw(V,V.gl.TRIANGLES,x,M,I,Tn.disabled,O,N,d.id,v.layoutVertexBuffer,v.indexBuffer,s,d.paint,m.transform.zoom,v.programConfigurations.get(d.id),v.dynamicLayoutVertexBuffer,v.opacityVertexBuffer)}function gd(v,s,d,m){const y=v.context,x=y.gl,M=On.disabled,I=new Jn([x.ONE,x.ONE],l.aM.transparent,[!0,!0,!0,!0]),O=s.getBucket(d);if(!O)return;const N=m.key;let V=d.heatmapFbos.get(N);V||(V=ql(y,s.tileSize,s.tileSize),d.heatmapFbos.set(N,V)),y.bindFramebuffer.set(V.framebuffer),y.viewport.set([0,0,s.tileSize,s.tileSize]),y.clear({color:l.aM.transparent});const F=O.programConfigurations.get(d.id),G=v.useProgram("heatmap",F),K=v.style.map.terrain.getTerrainData(m);G.draw(y,x.TRIANGLES,Ht.disabled,M,I,Tn.disabled,ir(m.posMatrix,s,v.transform.zoom,d.paint.get("heatmap-intensity")),K,d.id,O.layoutVertexBuffer,O.indexBuffer,O.segments,d.paint,v.transform.zoom,F)}function Zo(v,s,d){const m=v.context,y=m.gl;m.setColorMode(v.colorModeForRenderPass());const x=Wl(m,s),M=d.key,I=s.heatmapFbos.get(M);I&&(m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,I.colorAttachment.get()),m.activeTexture.set(y.TEXTURE1),x.bind(y.LINEAR,y.CLAMP_TO_EDGE),v.useProgram("heatmapTexture").draw(m,y.TRIANGLES,Ht.disabled,On.disabled,v.colorModeForRenderPass(),Tn.disabled,su(v,s,0,1),null,s.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments,s.paint,v.transform.zoom),I.destroy(),s.heatmapFbos.delete(M))}function ql(v,s,d){var m,y;const x=v.gl,M=x.createTexture();x.bindTexture(x.TEXTURE_2D,M),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,x.LINEAR),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,x.LINEAR);const I=(m=v.HALF_FLOAT)!==null&&m!==void 0?m:x.UNSIGNED_BYTE,O=(y=v.RGBA16F)!==null&&y!==void 0?y:x.RGBA;x.texImage2D(x.TEXTURE_2D,0,O,s,d,0,x.RGBA,I,null);const N=v.createFramebuffer(s,d,!1,!1);return N.colorAttachment.set(M),N}function Wl(v,s){return s.colorRampTexture||(s.colorRampTexture=new rt(v,s.colorRamp,v.gl.RGBA)),s.colorRampTexture}function Ba(v,s,d,m,y){if(!d||!m||!m.imageAtlas)return;const x=m.imageAtlas.patternPositions;let M=x[d.to.toString()],I=x[d.from.toString()];if(!M&&I&&(M=I),!I&&M&&(I=M),!M||!I){const O=y.getPaintProperty(s);M=x[O],I=x[O]}M&&I&&v.setConstantPatternPositions(M,I)}function Gl(v,s,d,m,y,x,M){const I=v.context.gl,O="fill-pattern",N=d.paint.get(O),V=N&&N.constantOr(1),F=d.getCrossfadeParameters();let G,K,Q,re,ae;M?(K=V&&!d.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",G=I.LINES):(K=V?"fillPattern":"fill",G=I.TRIANGLES);const ce=N.constantOr(null);for(const he of m){const te=s.getTile(he);if(V&&!te.patternsLoaded())continue;const me=te.getBucket(d);if(!me)continue;const ge=me.programConfigurations.get(d.id),ve=v.useProgram(K,ge),ze=v.style.map.terrain&&v.style.map.terrain.getTerrainData(he);V&&(v.context.activeTexture.set(I.TEXTURE0),te.imageAtlasTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),ge.updatePaintBuffers(F)),Ba(ge,O,ce,te,d);const Ve=ze?he:null,Je=v.translatePosMatrix(Ve?Ve.posMatrix:he.posMatrix,te,d.paint.get("fill-translate"),d.paint.get("fill-translate-anchor"));if(M){re=me.indexBuffer2,ae=me.segments2;const it=[I.drawingBufferWidth,I.drawingBufferHeight];Q=K==="fillOutlinePattern"&&V?Jf(Je,v,F,te,it):n_(Je,it)}else re=me.indexBuffer,ae=me.segments,Q=V?Kf(Je,v,F,te):Pa(Je);ve.draw(v.context,G,y,v.stencilModeForClipping(he),x,Tn.disabled,Q,ze,d.id,me.layoutVertexBuffer,re,ae,d.paint,v.transform.zoom,ge)}}function fu(v,s,d,m,y,x,M){const I=v.context,O=I.gl,N="fill-extrusion-pattern",V=d.paint.get(N),F=V.constantOr(1),G=d.getCrossfadeParameters(),K=d.paint.get("fill-extrusion-opacity"),Q=V.constantOr(null);for(const re of m){const ae=s.getTile(re),ce=ae.getBucket(d);if(!ce)continue;const he=v.style.map.terrain&&v.style.map.terrain.getTerrainData(re),te=ce.programConfigurations.get(d.id),me=v.useProgram(F?"fillExtrusionPattern":"fillExtrusion",te);F&&(v.context.activeTexture.set(O.TEXTURE0),ae.imageAtlasTexture.bind(O.LINEAR,O.CLAMP_TO_EDGE),te.updatePaintBuffers(G)),Ba(te,N,Q,ae,d);const ge=v.translatePosMatrix(re.posMatrix,ae,d.paint.get("fill-extrusion-translate"),d.paint.get("fill-extrusion-translate-anchor")),ve=d.paint.get("fill-extrusion-vertical-gradient"),ze=F?ru(ge,v,ve,K,re,G,ae):Vl(ge,v,ve,K);me.draw(I,I.gl.TRIANGLES,y,x,M,Tn.backCCW,ze,he,d.id,ce.layoutVertexBuffer,ce.indexBuffer,ce.segments,d.paint,v.transform.zoom,te,v.style.map.terrain&&ce.centroidVertexBuffer)}}function Na(v,s,d,m,y,x,M){const I=v.context,O=I.gl,N=d.fbo;if(!N)return;const V=v.useProgram("hillshade"),F=v.style.map.terrain&&v.style.map.terrain.getTerrainData(s);I.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,N.colorAttachment.get()),V.draw(I,O.TRIANGLES,y,x,M,Tn.disabled,((G,K,Q,re)=>{const ae=Q.paint.get("hillshade-shadow-color"),ce=Q.paint.get("hillshade-highlight-color"),he=Q.paint.get("hillshade-accent-color");let te=Q.paint.get("hillshade-illumination-direction")*(Math.PI/180);Q.paint.get("hillshade-illumination-anchor")==="viewport"&&(te-=G.transform.angle);const me=!G.options.moving;return{u_matrix:re?re.posMatrix:G.transform.calculatePosMatrix(K.tileID.toUnwrapped(),me),u_image:0,u_latrange:ou(0,K.tileID),u_light:[Q.paint.get("hillshade-exaggeration"),te],u_shadow:ae,u_highlight:ce,u_accent:he}})(v,d,m,F?s:null),F,m.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments)}function Ra(v,s,d,m,y,x){const M=v.context,I=M.gl,O=s.dem;if(O&&O.data){const N=O.dim,V=O.stride,F=O.getPixels();if(M.activeTexture.set(I.TEXTURE1),M.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||v.getTileTexture(V),s.demTexture){const K=s.demTexture;K.update(F,{premultiply:!1}),K.bind(I.NEAREST,I.CLAMP_TO_EDGE)}else s.demTexture=new rt(M,F,I.RGBA,{premultiply:!1}),s.demTexture.bind(I.NEAREST,I.CLAMP_TO_EDGE);M.activeTexture.set(I.TEXTURE0);let G=s.fbo;if(!G){const K=new rt(M,{width:N,height:N,data:null},I.RGBA);K.bind(I.LINEAR,I.CLAMP_TO_EDGE),G=s.fbo=M.createFramebuffer(N,N,!0,!1),G.colorAttachment.set(K.texture)}M.bindFramebuffer.set(G.framebuffer),M.viewport.set([0,0,N,N]),v.useProgram("hillshadePrepare").draw(M,I.TRIANGLES,m,y,x,Tn.disabled,((K,Q)=>{const re=Q.stride,ae=l.H();return l.aP(ae,0,l.X,-l.X,0,0,1),l.J(ae,ae,[0,-l.X,0]),{u_matrix:ae,u_image:1,u_dimension:[re,re],u_zoom:K.overscaledZ,u_unpack:Q.getUnpackVector()}})(s.tileID,O),null,d.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function mm(v,s,d,m,y,x){const M=m.paint.get("raster-fade-duration");if(!x&&M>0){const I=E.now(),O=(I-v.timeAdded)/M,N=s?(I-s.timeAdded)/M:-1,V=d.getSource(),F=y.coveringZoomLevel({tileSize:V.tileSize,roundZoom:V.roundZoom}),G=!s||Math.abs(s.tileID.overscaledZ-F)>Math.abs(v.tileID.overscaledZ-F),K=G&&v.refreshedUponExpiration?1:l.ac(G?O:1-N,0,1);return v.refreshedUponExpiration&&O>=1&&(v.refreshedUponExpiration=!1),s?{opacity:1,mix:1-K}:{opacity:K,mix:0}}return{opacity:1,mix:0}}const yd=new l.aM(1,0,0,1),un=new l.aM(0,1,0,1),mu=new l.aM(0,0,1,1),y_=new l.aM(1,0,1,1),gm=new l.aM(0,1,1,1);function La(v,s,d,m){gu(v,0,s+d/2,v.transform.width,d,m)}function ym(v,s,d,m){gu(v,s-d/2,0,d,v.transform.height,m)}function gu(v,s,d,m,y,x){const M=v.context,I=M.gl;I.enable(I.SCISSOR_TEST),I.scissor(s*v.pixelRatio,d*v.pixelRatio,m*v.pixelRatio,y*v.pixelRatio),M.clear({color:x}),I.disable(I.SCISSOR_TEST)}function _m(v,s,d){const m=v.context,y=m.gl,x=d.posMatrix,M=v.useProgram("debug"),I=Ht.disabled,O=On.disabled,N=v.colorModeForRenderPass(),V="$debug",F=v.style.map.terrain&&v.style.map.terrain.getTerrainData(d);m.activeTexture.set(y.TEXTURE0);const G=s.getTileByID(d.key).latestRawTileData,K=Math.floor((G&&G.byteLength||0)/1024),Q=s.getTile(d).tileSize,re=512/Math.min(Q,512)*(d.overscaledZ/v.transform.zoom)*.5;let ae=d.canonical.toString();d.overscaledZ!==d.canonical.z&&(ae+=` => ${d.overscaledZ}`),function(ce,he){ce.initDebugOverlayCanvas();const te=ce.debugOverlayCanvas,me=ce.context.gl,ge=ce.debugOverlayCanvas.getContext("2d");ge.clearRect(0,0,te.width,te.height),ge.shadowColor="white",ge.shadowBlur=2,ge.lineWidth=1.5,ge.strokeStyle="white",ge.textBaseline="top",ge.font="bold 36px Open Sans, sans-serif",ge.fillText(he,5,5),ge.strokeText(he,5,5),ce.debugOverlayTexture.update(te),ce.debugOverlayTexture.bind(me.LINEAR,me.CLAMP_TO_EDGE)}(v,`${ae} ${K}kB`),M.draw(m,y.TRIANGLES,I,O,Jn.alphaBlended,Tn.disabled,Fl(x,l.aM.transparent,re),null,V,v.debugBuffer,v.quadTriangleIndexBuffer,v.debugSegments),M.draw(m,y.LINE_STRIP,I,O,N,Tn.disabled,Fl(x,l.aM.red),F,V,v.debugBuffer,v.tileBorderIndexBuffer,v.debugSegments)}function bm(v,s,d){const m=v.context,y=m.gl,x=v.colorModeForRenderPass(),M=new Ht(y.LEQUAL,Ht.ReadWrite,v.depthRangeFor3D),I=v.useProgram("terrain"),O=s.getTerrainMesh();m.bindFramebuffer.set(null),m.viewport.set([0,0,v.width,v.height]);for(const N of d){const V=v.renderToTexture.getTexture(N),F=s.getTerrainData(N.tileID);m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,V.texture);const G=v.transform.calculatePosMatrix(N.tileID.toUnwrapped()),K=s.getMeshFrameDelta(v.transform.zoom),Q=v.transform.calculateFogMatrix(N.tileID.toUnwrapped()),re=ed(G,K,Q,v.style.sky,v.transform.pitch);I.draw(m,y.TRIANGLES,M,On.disabled,x,Tn.backCCW,re,F,"terrain",O.vertexBuffer,O.indexBuffer,O.segments)}}class yu{constructor(s,d,m){this.vertexBuffer=s,this.indexBuffer=d,this.segments=m}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class _u{constructor(s,d){this.context=new g_(s),this.transform=d,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Ne.maxUnderzooming+Ne.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Jh}resize(s,d,m){if(this.width=Math.floor(s*m),this.height=Math.floor(d*m),this.pixelRatio=m,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const y of this.style._order)this.style._layers[y].resize()}setup(){const s=this.context,d=new l.aX;d.emplaceBack(0,0),d.emplaceBack(l.X,0),d.emplaceBack(0,l.X),d.emplaceBack(l.X,l.X),this.tileExtentBuffer=s.createVertexBuffer(d,$o.members),this.tileExtentSegments=l.a0.simpleSegment(0,0,4,2);const m=new l.aX;m.emplaceBack(0,0),m.emplaceBack(l.X,0),m.emplaceBack(0,l.X),m.emplaceBack(l.X,l.X),this.debugBuffer=s.createVertexBuffer(m,$o.members),this.debugSegments=l.a0.simpleSegment(0,0,4,5);const y=new l.$;y.emplaceBack(0,0,0,0),y.emplaceBack(l.X,0,l.X,0),y.emplaceBack(0,l.X,0,l.X),y.emplaceBack(l.X,l.X,l.X,l.X),this.rasterBoundsBuffer=s.createVertexBuffer(y,tr.members),this.rasterBoundsSegments=l.a0.simpleSegment(0,0,4,2);const x=new l.aX;x.emplaceBack(0,0),x.emplaceBack(1,0),x.emplaceBack(0,1),x.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(x,$o.members),this.viewportSegments=l.a0.simpleSegment(0,0,4,2);const M=new l.aZ;M.emplaceBack(0),M.emplaceBack(1),M.emplaceBack(3),M.emplaceBack(2),M.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(M);const I=new l.aY;I.emplaceBack(0,1,2),I.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(I);const O=this.context.gl;this.stencilClearMode=new On({func:O.ALWAYS,mask:0},0,255,O.ZERO,O.ZERO,O.ZERO)}clearStencil(){const s=this.context,d=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const m=l.H();l.aP(m,0,this.width,this.height,0,0,1),l.K(m,m,[d.drawingBufferWidth,d.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,d.TRIANGLES,Ht.disabled,this.stencilClearMode,Jn.disabled,Tn.disabled,nr(m),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(s,d){if(this.currentStencilSource===s.source||!s.isTileClipped()||!d||!d.length)return;this.currentStencilSource=s.source;const m=this.context,y=m.gl;this.nextStencilID+d.length>256&&this.clearStencil(),m.setColorMode(Jn.disabled),m.setDepthMode(Ht.disabled);const x=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const M of d){const I=this._tileClippingMaskIDs[M.key]=this.nextStencilID++,O=this.style.map.terrain&&this.style.map.terrain.getTerrainData(M);x.draw(m,y.TRIANGLES,Ht.disabled,new On({func:y.ALWAYS,mask:0},I,255,y.KEEP,y.KEEP,y.REPLACE),Jn.disabled,Tn.disabled,nr(M.posMatrix),O,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,d=this.context.gl;return new On({func:d.NOTEQUAL,mask:255},s,255,d.KEEP,d.KEEP,d.REPLACE)}stencilModeForClipping(s){const d=this.context.gl;return new On({func:d.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,d.KEEP,d.KEEP,d.REPLACE)}stencilConfigForOverlap(s){const d=this.context.gl,m=s.sort((M,I)=>I.overscaledZ-M.overscaledZ),y=m[m.length-1].overscaledZ,x=m[0].overscaledZ-y+1;if(x>1){this.currentStencilSource=void 0,this.nextStencilID+x>256&&this.clearStencil();const M={};for(let I=0;I<x;I++)M[I+y]=new On({func:d.GEQUAL,mask:255},I+this.nextStencilID,255,d.KEEP,d.KEEP,d.REPLACE);return this.nextStencilID+=x,[M,m]}return[{[y]:On.disabled},m]}colorModeForRenderPass(){const s=this.context.gl;return this._showOverdrawInspector?new Jn([s.CONSTANT_COLOR,s.ONE],new l.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Jn.unblended:Jn.alphaBlended}depthModeForSublayer(s,d,m){if(!this.opaquePassEnabledForLayer())return Ht.disabled;const y=1-((1+this.currentLayer)*this.numSublayers+s)*this.depthEpsilon;return new Ht(m||this.context.gl.LEQUAL,d,[y,y])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(s,d){this.style=s,this.options=d,this.lineAtlas=s.lineAtlas,this.imageManager=s.imageManager,this.glyphManager=s.glyphManager,this.symbolFadeChange=s.placement.symbolFadeChange(E.now()),this.imageManager.beginFrame();const m=this.style._order,y=this.style.sourceCaches,x={},M={},I={};for(const O in y){const N=y[O];N.used&&N.prepare(this.context),x[O]=N.getVisibleCoordinates(),M[O]=x[O].slice().reverse(),I[O]=N.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let O=0;O<m.length;O++)if(this.style._layers[m[O]].is3D()){this.opaquePassCutoff=O;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const O of m){const N=this.style._layers[O];if(!N.hasOffscreenPass()||N.isHidden(this.transform.zoom))continue;const V=M[N.source];(N.type==="custom"||V.length)&&this.renderLayer(this,y[N.source],N,V)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:d.showOverdrawInspector?l.aM.black:l.aM.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(O,N){const V=O.context,F=V.gl,G=((ce,he,te)=>({u_sky_color:ce.properties.get("sky-color"),u_horizon_color:ce.properties.get("horizon-color"),u_horizon:(he.height/2+he.getHorizon())*te,u_sky_horizon_blend:ce.properties.get("sky-horizon-blend")*he.height/2*te}))(N,O.style.map.transform,O.pixelRatio),K=new Ht(F.LEQUAL,Ht.ReadWrite,[0,1]),Q=On.disabled,re=O.colorModeForRenderPass(),ae=O.useProgram("sky");if(!N.mesh){const ce=new l.aX;ce.emplaceBack(-1,-1),ce.emplaceBack(1,-1),ce.emplaceBack(1,1),ce.emplaceBack(-1,1);const he=new l.aY;he.emplaceBack(0,1,2),he.emplaceBack(0,2,3),N.mesh=new yu(V.createVertexBuffer(ce,$o.members),V.createIndexBuffer(he),l.a0.simpleSegment(0,0,ce.length,he.length))}ae.draw(V,F.TRIANGLES,K,Q,re,Tn.disabled,G,void 0,"sky",N.mesh.vertexBuffer,N.mesh.indexBuffer,N.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=d.showOverdrawInspector,this.depthRangeFor3D=[0,1-(s._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=m.length-1;this.currentLayer>=0;this.currentLayer--){const O=this.style._layers[m[this.currentLayer]],N=y[O.source],V=x[O.source];this._renderTileClippingMasks(O,V),this.renderLayer(this,N,O,V)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<m.length;this.currentLayer++){const O=this.style._layers[m[this.currentLayer]],N=y[O.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(O))continue;const V=(O.type==="symbol"?I:M)[O.source];this._renderTileClippingMasks(O,x[O.source]),this.renderLayer(this,N,O,V)}if(this.options.showTileBoundaries){const O=function(N,V){let F=null;const G=Object.values(N._layers).flatMap(ae=>ae.source&&!ae.isHidden(V)?[N.sourceCaches[ae.source]]:[]),K=G.filter(ae=>ae.getSource().type==="vector"),Q=G.filter(ae=>ae.getSource().type!=="vector"),re=ae=>{(!F||F.getSource().maxzoom<ae.getSource().maxzoom)&&(F=ae)};return K.forEach(ae=>re(ae)),F||Q.forEach(ae=>re(ae)),F}(this.style,this.transform.zoom);O&&function(N,V,F){for(let G=0;G<F.length;G++)_m(N,V,F[G])}(this,O,O.getVisibleCoordinates())}this.options.showPadding&&function(O){const N=O.transform.padding;La(O,O.transform.height-(N.top||0),3,yd),La(O,N.bottom||0,3,un),ym(O,N.left||0,3,mu),ym(O,O.transform.width-(N.right||0),3,y_);const V=O.transform.centerPoint;(function(F,G,K,Q){gu(F,G-1,K-10,2,20,Q),gu(F,G-10,K-1,20,2,Q)})(O,V.x,O.transform.height-V.y,gm)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(s){if(!this.style||!this.style.map||!this.style.map.terrain)return;const d=this.terrainFacilitator.matrix,m=this.transform.modelViewProjectionMatrix;let y=this.terrainFacilitator.dirty;y||(y=s?!l.a_(d,m):!l.a$(d,m)),y||(y=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),y&&(l.b0(d,m),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(x,M){const I=x.context,O=I.gl,N=Jn.unblended,V=new Ht(O.LEQUAL,Ht.ReadWrite,[0,1]),F=M.getTerrainMesh(),G=M.sourceCache.getRenderableTiles(),K=x.useProgram("terrainDepth");I.bindFramebuffer.set(M.getFramebuffer("depth").framebuffer),I.viewport.set([0,0,x.width/devicePixelRatio,x.height/devicePixelRatio]),I.clear({color:l.aM.transparent,depth:1});for(const Q of G){const re=M.getTerrainData(Q.tileID),ae={u_matrix:x.transform.calculatePosMatrix(Q.tileID.toUnwrapped()),u_ele_delta:M.getMeshFrameDelta(x.transform.zoom)};K.draw(I,O.TRIANGLES,V,On.disabled,N,Tn.backCCW,ae,re,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}I.bindFramebuffer.set(null),I.viewport.set([0,0,x.width,x.height])}(this,this.style.map.terrain),function(x,M){const I=x.context,O=I.gl,N=Jn.unblended,V=new Ht(O.LEQUAL,Ht.ReadWrite,[0,1]),F=M.getTerrainMesh(),G=M.getCoordsTexture(),K=M.sourceCache.getRenderableTiles(),Q=x.useProgram("terrainCoords");I.bindFramebuffer.set(M.getFramebuffer("coords").framebuffer),I.viewport.set([0,0,x.width/devicePixelRatio,x.height/devicePixelRatio]),I.clear({color:l.aM.transparent,depth:1}),M.coordsIndex=[];for(const re of K){const ae=M.getTerrainData(re.tileID);I.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,G.texture);const ce={u_matrix:x.transform.calculatePosMatrix(re.tileID.toUnwrapped()),u_terrain_coords_id:(255-M.coordsIndex.length)/255,u_texture:0,u_ele_delta:M.getMeshFrameDelta(x.transform.zoom)};Q.draw(I,O.TRIANGLES,V,On.disabled,N,Tn.backCCW,ce,ae,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),M.coordsIndex.push(re.tileID.key)}I.bindFramebuffer.set(null),I.viewport.set([0,0,x.width,x.height])}(this,this.style.map.terrain))}renderLayer(s,d,m,y){if(!m.isHidden(this.transform.zoom)&&(m.type==="background"||m.type==="custom"||(y||[]).length))switch(this.id=m.id,m.type){case"symbol":(function(x,M,I,O,N){if(x.renderPass!=="translucent")return;const V=On.disabled,F=x.colorModeForRenderPass();(I._unevaluatedLayout.hasValue("text-variable-anchor")||I._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(G,K,Q,re,ae,ce,he,te,me){const ge=K.transform,ve=Fo(),ze=ae==="map",Ve=ce==="map";for(const Je of G){const it=re.getTile(Je),Ge=it.getBucket(Q);if(!Ge||!Ge.text||!Ge.text.segments.get().length)continue;const qe=l.ag(Ge.textSizeData,ge.zoom),mt=Zt(it,1,K.transform.zoom),Dt=Hi(Je.posMatrix,Ve,ze,K.transform,mt),Ye=Q.layout.get("icon-text-fit")!=="none"&&Ge.hasIconData();if(qe){const tt=Math.pow(2,ge.zoom-it.tileID.overscaledZ),It=K.style.map.terrain?(Lt,Yt)=>K.style.map.terrain.getElevation(Je,Lt,Yt):null,Fn=ve.translatePosition(ge,it,he,te);za(Ge,ze,Ve,me,ge,Dt,Je.posMatrix,tt,qe,Ye,ve,Fn,Je.toUnwrapped(),It)}}}(O,x,I,M,I.layout.get("text-rotation-alignment"),I.layout.get("text-pitch-alignment"),I.paint.get("text-translate"),I.paint.get("text-translate-anchor"),N),I.paint.get("icon-opacity").constantOr(1)!==0&&fd(x,M,I,O,!1,I.paint.get("icon-translate"),I.paint.get("icon-translate-anchor"),I.layout.get("icon-rotation-alignment"),I.layout.get("icon-pitch-alignment"),I.layout.get("icon-keep-upright"),V,F),I.paint.get("text-opacity").constantOr(1)!==0&&fd(x,M,I,O,!0,I.paint.get("text-translate"),I.paint.get("text-translate-anchor"),I.layout.get("text-rotation-alignment"),I.layout.get("text-pitch-alignment"),I.layout.get("text-keep-upright"),V,F),M.map.showCollisionBoxes&&(Ul(x,M,I,O,!0),Ul(x,M,I,O,!1))})(s,d,m,y,this.style.placement.variableOffsets);break;case"circle":(function(x,M,I,O){if(x.renderPass!=="translucent")return;const N=I.paint.get("circle-opacity"),V=I.paint.get("circle-stroke-width"),F=I.paint.get("circle-stroke-opacity"),G=!I.layout.get("circle-sort-key").isConstant();if(N.constantOr(1)===0&&(V.constantOr(1)===0||F.constantOr(1)===0))return;const K=x.context,Q=K.gl,re=x.depthModeForSublayer(0,Ht.ReadOnly),ae=On.disabled,ce=x.colorModeForRenderPass(),he=[];for(let te=0;te<O.length;te++){const me=O[te],ge=M.getTile(me),ve=ge.getBucket(I);if(!ve)continue;const ze=ve.programConfigurations.get(I.id),Ve=x.useProgram("circle",ze),Je=ve.layoutVertexBuffer,it=ve.indexBuffer,Ge=x.style.map.terrain&&x.style.map.terrain.getTerrainData(me),qe={programConfiguration:ze,program:Ve,layoutVertexBuffer:Je,indexBuffer:it,uniformValues:i_(x,me,ge,I),terrainData:Ge};if(G){const mt=ve.segments.get();for(const Dt of mt)he.push({segments:new l.a0([Dt]),sortKey:Dt.sortKey,state:qe})}else he.push({segments:ve.segments,sortKey:0,state:qe})}G&&he.sort((te,me)=>te.sortKey-me.sortKey);for(const te of he){const{programConfiguration:me,program:ge,layoutVertexBuffer:ve,indexBuffer:ze,uniformValues:Ve,terrainData:Je}=te.state;ge.draw(K,Q.TRIANGLES,re,ae,ce,Tn.disabled,Ve,Je,I.id,ve,ze,te.segments,I.paint,x.transform.zoom,me)}})(s,d,m,y);break;case"heatmap":(function(x,M,I,O){if(I.paint.get("heatmap-opacity")===0)return;const N=x.context;if(x.style.map.terrain){for(const V of O){const F=M.getTile(V);M.hasRenderableParent(V)||(x.renderPass==="offscreen"?gd(x,F,I,V):x.renderPass==="translucent"&&Zo(x,I,V))}N.viewport.set([0,0,x.width,x.height])}else x.renderPass==="offscreen"?function(V,F,G,K){const Q=V.context,re=Q.gl,ae=On.disabled,ce=new Jn([re.ONE,re.ONE],l.aM.transparent,[!0,!0,!0,!0]);(function(he,te,me){const ge=he.gl;he.activeTexture.set(ge.TEXTURE1),he.viewport.set([0,0,te.width/4,te.height/4]);let ve=me.heatmapFbos.get(l.aU);ve?(ge.bindTexture(ge.TEXTURE_2D,ve.colorAttachment.get()),he.bindFramebuffer.set(ve.framebuffer)):(ve=ql(he,te.width/4,te.height/4),me.heatmapFbos.set(l.aU,ve))})(Q,V,G),Q.clear({color:l.aM.transparent});for(let he=0;he<K.length;he++){const te=K[he];if(F.hasRenderableParent(te))continue;const me=F.getTile(te),ge=me.getBucket(G);if(!ge)continue;const ve=ge.programConfigurations.get(G.id),ze=V.useProgram("heatmap",ve),{zoom:Ve}=V.transform;ze.draw(Q,re.TRIANGLES,Ht.disabled,ae,ce,Tn.disabled,ir(te.posMatrix,me,Ve,G.paint.get("heatmap-intensity")),null,G.id,ge.layoutVertexBuffer,ge.indexBuffer,ge.segments,G.paint,V.transform.zoom,ve)}Q.viewport.set([0,0,V.width,V.height])}(x,M,I,O):x.renderPass==="translucent"&&function(V,F){const G=V.context,K=G.gl;G.setColorMode(V.colorModeForRenderPass());const Q=F.heatmapFbos.get(l.aU);Q&&(G.activeTexture.set(K.TEXTURE0),K.bindTexture(K.TEXTURE_2D,Q.colorAttachment.get()),G.activeTexture.set(K.TEXTURE1),Wl(G,F).bind(K.LINEAR,K.CLAMP_TO_EDGE),V.useProgram("heatmapTexture").draw(G,K.TRIANGLES,Ht.disabled,On.disabled,V.colorModeForRenderPass(),Tn.disabled,su(V,F,0,1),null,F.id,V.viewportBuffer,V.quadTriangleIndexBuffer,V.viewportSegments,F.paint,V.transform.zoom))}(x,I)})(s,d,m,y);break;case"line":(function(x,M,I,O){if(x.renderPass!=="translucent")return;const N=I.paint.get("line-opacity"),V=I.paint.get("line-width");if(N.constantOr(1)===0||V.constantOr(1)===0)return;const F=x.depthModeForSublayer(0,Ht.ReadOnly),G=x.colorModeForRenderPass(),K=I.paint.get("line-dasharray"),Q=I.paint.get("line-pattern"),re=Q.constantOr(1),ae=I.paint.get("line-gradient"),ce=I.getCrossfadeParameters(),he=re?"linePattern":K?"lineSDF":ae?"lineGradient":"line",te=x.context,me=te.gl;let ge=!0;for(const ve of O){const ze=M.getTile(ve);if(re&&!ze.patternsLoaded())continue;const Ve=ze.getBucket(I);if(!Ve)continue;const Je=Ve.programConfigurations.get(I.id),it=x.context.program.get(),Ge=x.useProgram(he,Je),qe=ge||Ge.program!==it,mt=x.style.map.terrain&&x.style.map.terrain.getTerrainData(ve),Dt=Q.constantOr(null);if(Dt&&ze.imageAtlas){const It=ze.imageAtlas,Fn=It.patternPositions[Dt.to.toString()],Lt=It.patternPositions[Dt.from.toString()];Fn&&Lt&&Je.setConstantPatternPositions(Fn,Lt)}const Ye=mt?ve:null,tt=re?Da(x,ze,I,ce,Ye):K?r_(x,ze,I,K,ce,Ye):ae?Qf(x,ze,I,Ve.lineClipsArray.length,Ye):au(x,ze,I,Ye);if(re)te.activeTexture.set(me.TEXTURE0),ze.imageAtlasTexture.bind(me.LINEAR,me.CLAMP_TO_EDGE),Je.updatePaintBuffers(ce);else if(K&&(qe||x.lineAtlas.dirty))te.activeTexture.set(me.TEXTURE0),x.lineAtlas.bind(te);else if(ae){const It=Ve.gradients[I.id];let Fn=It.texture;if(I.gradientVersion!==It.version){let Lt=256;if(I.stepInterpolant){const Yt=M.getSource().maxzoom,$n=ve.canonical.z===Yt?Math.ceil(1<<x.transform.maxZoom-ve.canonical.z):1;Lt=l.ac(l.aV(Ve.maxLineLength/l.X*1024*$n),256,te.maxTextureSize)}It.gradient=l.aW({expression:I.gradientExpression(),evaluationKey:"lineProgress",resolution:Lt,image:It.gradient||void 0,clips:Ve.lineClipsArray}),It.texture?It.texture.update(It.gradient):It.texture=new rt(te,It.gradient,me.RGBA),It.version=I.gradientVersion,Fn=It.texture}te.activeTexture.set(me.TEXTURE0),Fn.bind(I.stepInterpolant?me.NEAREST:me.LINEAR,me.CLAMP_TO_EDGE)}Ge.draw(te,me.TRIANGLES,F,x.stencilModeForClipping(ve),G,Tn.disabled,tt,mt,I.id,Ve.layoutVertexBuffer,Ve.indexBuffer,Ve.segments,I.paint,x.transform.zoom,Je,Ve.layoutVertexBuffer2),ge=!1}})(s,d,m,y);break;case"fill":(function(x,M,I,O){const N=I.paint.get("fill-color"),V=I.paint.get("fill-opacity");if(V.constantOr(1)===0)return;const F=x.colorModeForRenderPass(),G=I.paint.get("fill-pattern"),K=x.opaquePassEnabledForLayer()&&!G.constantOr(1)&&N.constantOr(l.aM.transparent).a===1&&V.constantOr(0)===1?"opaque":"translucent";if(x.renderPass===K){const Q=x.depthModeForSublayer(1,x.renderPass==="opaque"?Ht.ReadWrite:Ht.ReadOnly);Gl(x,M,I,O,Q,F,!1)}if(x.renderPass==="translucent"&&I.paint.get("fill-antialias")){const Q=x.depthModeForSublayer(I.getPaintProperty("fill-outline-color")?2:0,Ht.ReadOnly);Gl(x,M,I,O,Q,F,!0)}})(s,d,m,y);break;case"fill-extrusion":(function(x,M,I,O){const N=I.paint.get("fill-extrusion-opacity");if(N!==0&&x.renderPass==="translucent"){const V=new Ht(x.context.gl.LEQUAL,Ht.ReadWrite,x.depthRangeFor3D);if(N!==1||I.paint.get("fill-extrusion-pattern").constantOr(1))fu(x,M,I,O,V,On.disabled,Jn.disabled),fu(x,M,I,O,V,x.stencilModeFor3D(),x.colorModeForRenderPass());else{const F=x.colorModeForRenderPass();fu(x,M,I,O,V,On.disabled,F)}}})(s,d,m,y);break;case"hillshade":(function(x,M,I,O){if(x.renderPass!=="offscreen"&&x.renderPass!=="translucent")return;const N=x.context,V=x.depthModeForSublayer(0,Ht.ReadOnly),F=x.colorModeForRenderPass(),[G,K]=x.renderPass==="translucent"?x.stencilConfigForOverlap(O):[{},O];for(const Q of K){const re=M.getTile(Q);re.needsHillshadePrepare!==void 0&&re.needsHillshadePrepare&&x.renderPass==="offscreen"?Ra(x,re,I,V,On.disabled,F):x.renderPass==="translucent"&&Na(x,Q,re,I,V,G[Q.overscaledZ],F)}N.viewport.set([0,0,x.width,x.height])})(s,d,m,y);break;case"raster":(function(x,M,I,O){if(x.renderPass!=="translucent"||I.paint.get("raster-opacity")===0||!O.length)return;const N=x.context,V=N.gl,F=M.getSource(),G=x.useProgram("raster"),K=x.colorModeForRenderPass(),[Q,re]=F instanceof bi?[{},O]:x.stencilConfigForOverlap(O),ae=re[re.length-1].overscaledZ,ce=!x.options.moving;for(const he of re){const te=x.depthModeForSublayer(he.overscaledZ-ae,I.paint.get("raster-opacity")===1?Ht.ReadWrite:Ht.ReadOnly,V.LESS),me=M.getTile(he);me.registerFadeDuration(I.paint.get("raster-fade-duration"));const ge=M.findLoadedParent(he,0),ve=M.findLoadedSibling(he),ze=mm(me,ge||ve||null,M,I,x.transform,x.style.map.terrain);let Ve,Je;const it=I.paint.get("raster-resampling")==="nearest"?V.NEAREST:V.LINEAR;N.activeTexture.set(V.TEXTURE0),me.texture.bind(it,V.CLAMP_TO_EDGE,V.LINEAR_MIPMAP_NEAREST),N.activeTexture.set(V.TEXTURE1),ge?(ge.texture.bind(it,V.CLAMP_TO_EDGE,V.LINEAR_MIPMAP_NEAREST),Ve=Math.pow(2,ge.tileID.overscaledZ-me.tileID.overscaledZ),Je=[me.tileID.canonical.x*Ve%1,me.tileID.canonical.y*Ve%1]):me.texture.bind(it,V.CLAMP_TO_EDGE,V.LINEAR_MIPMAP_NEAREST),me.texture.useMipmap&&N.extTextureFilterAnisotropic&&x.transform.pitch>20&&V.texParameterf(V.TEXTURE_2D,N.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,N.extTextureFilterAnisotropicMax);const Ge=x.style.map.terrain&&x.style.map.terrain.getTerrainData(he),qe=Ge?he:null,mt=qe?qe.posMatrix:x.transform.calculatePosMatrix(he.toUnwrapped(),ce),Dt=s_(mt,Je||[0,0],Ve||1,ze,I);F instanceof bi?G.draw(N,V.TRIANGLES,te,On.disabled,K,Tn.disabled,Dt,Ge,I.id,F.boundsBuffer,x.quadTriangleIndexBuffer,F.boundsSegments):G.draw(N,V.TRIANGLES,te,Q[he.overscaledZ],K,Tn.disabled,Dt,Ge,I.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments)}})(s,d,m,y);break;case"background":(function(x,M,I,O){const N=I.paint.get("background-color"),V=I.paint.get("background-opacity");if(V===0)return;const F=x.context,G=F.gl,K=x.transform,Q=K.tileSize,re=I.paint.get("background-pattern");if(x.isPatternMissing(re))return;const ae=!re&&N.a===1&&V===1&&x.opaquePassEnabledForLayer()?"opaque":"translucent";if(x.renderPass!==ae)return;const ce=On.disabled,he=x.depthModeForSublayer(0,ae==="opaque"?Ht.ReadWrite:Ht.ReadOnly),te=x.colorModeForRenderPass(),me=x.useProgram(re?"backgroundPattern":"background"),ge=O||K.coveringTiles({tileSize:Q,terrain:x.style.map.terrain});re&&(F.activeTexture.set(G.TEXTURE0),x.imageManager.bind(x.context));const ve=I.getCrossfadeParameters();for(const ze of ge){const Ve=O?ze.posMatrix:x.transform.calculatePosMatrix(ze.toUnwrapped()),Je=re?id(Ve,V,x,re,{tileID:ze,tileSize:Q},ve):lu(Ve,V,N),it=x.style.map.terrain&&x.style.map.terrain.getTerrainData(ze);me.draw(F,G.TRIANGLES,he,ce,te,Tn.disabled,Je,it,I.id,x.tileExtentBuffer,x.quadTriangleIndexBuffer,x.tileExtentSegments)}})(s,0,m,y);break;case"custom":(function(x,M,I){const O=x.context,N=I.implementation;if(x.renderPass==="offscreen"){const V=N.prerender;V&&(x.setCustomLayerDefaults(),O.setColorMode(x.colorModeForRenderPass()),V.call(N,O.gl,x.transform.customLayerMatrix()),O.setDirty(),x.setBaseState())}else if(x.renderPass==="translucent"){x.setCustomLayerDefaults(),O.setColorMode(x.colorModeForRenderPass()),O.setStencilMode(On.disabled);const V=N.renderingMode==="3d"?new Ht(x.context.gl.LEQUAL,Ht.ReadWrite,x.depthRangeFor3D):x.depthModeForSublayer(0,Ht.ReadOnly);O.setDepthMode(V),N.render(O.gl,x.transform.customLayerMatrix(),{farZ:x.transform.farZ,nearZ:x.transform.nearZ,fov:x.transform._fov,modelViewProjectionMatrix:x.transform.modelViewProjectionMatrix,projectionMatrix:x.transform.projectionMatrix}),O.setDirty(),x.setBaseState(),O.bindFramebuffer.set(null)}})(s,0,m)}}translatePosMatrix(s,d,m,y,x){if(!m[0]&&!m[1])return s;const M=x?y==="map"?this.transform.angle:0:y==="viewport"?-this.transform.angle:0;if(M){const N=Math.sin(M),V=Math.cos(M);m=[m[0]*V-m[1]*N,m[0]*N+m[1]*V]}const I=[x?m[0]:Zt(d,m[0],this.transform.zoom),x?m[1]:Zt(d,m[1],this.transform.zoom),0],O=new Float32Array(16);return l.J(O,s,I),O}saveTileTexture(s){const d=this._tileTextures[s.size[0]];d?d.push(s):this._tileTextures[s.size[0]]=[s]}getTileTexture(s){const d=this._tileTextures[s];return d&&d.length>0?d.pop():null}isPatternMissing(s){if(!s)return!1;if(!s.from||!s.to)return!0;const d=this.imageManager.getPattern(s.from.toString()),m=this.imageManager.getPattern(s.to.toString());return!d||!m}useProgram(s,d){this.cache=this.cache||{};const m=s+(d?d.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[m]||(this.cache[m]=new td(this.context,ho[s],d,rd[s],this._showOverdrawInspector,this.style.map.terrain)),this.cache[m]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const s=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(s.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new rt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:s,drawingBufferHeight:d}=this.context.gl;return this.width!==s||this.height!==d}}class Va{constructor(s,d){this.points=s,this.planes=d}static fromInvProjectionMatrix(s,d,m){const y=Math.pow(2,m),x=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(I=>{const O=1/(I=l.af([],I,s))[3]/d*y;return l.b1(I,I,[O,O,1/I[3],O])}),M=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(I=>{const O=function(G,K){var Q=K[0],re=K[1],ae=K[2],ce=Q*Q+re*re+ae*ae;return ce>0&&(ce=1/Math.sqrt(ce)),G[0]=K[0]*ce,G[1]=K[1]*ce,G[2]=K[2]*ce,G}([],function(G,K,Q){var re=K[0],ae=K[1],ce=K[2],he=Q[0],te=Q[1],me=Q[2];return G[0]=ae*me-ce*te,G[1]=ce*he-re*me,G[2]=re*te-ae*he,G}([],Ae([],x[I[0]],x[I[1]]),Ae([],x[I[2]],x[I[1]]))),N=-((V=O)[0]*(F=x[I[1]])[0]+V[1]*F[1]+V[2]*F[2]);var V,F;return O.concat(N)});return new Va(x,M)}}class Fa{constructor(s,d){this.min=s,this.max=d,this.center=function(m,y,x){return m[0]=.5*y[0],m[1]=.5*y[1],m[2]=.5*y[2],m}([],function(m,y,x){return m[0]=y[0]+x[0],m[1]=y[1]+x[1],m[2]=y[2]+x[2],m}([],this.min,this.max))}quadrant(s){const d=[s%2==0,s<2],m=Te(this.min),y=Te(this.max);for(let x=0;x<d.length;x++)m[x]=d[x]?this.min[x]:this.center[x],y[x]=d[x]?this.center[x]:this.max[x];return y[2]=this.max[2],new Fa(m,y)}distanceX(s){return Math.max(Math.min(this.max[0],s[0]),this.min[0])-s[0]}distanceY(s){return Math.max(Math.min(this.max[1],s[1]),this.min[1])-s[1]}intersects(s){const d=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let m=!0;for(let y=0;y<s.planes.length;y++){const x=s.planes[y];let M=0;for(let I=0;I<d.length;I++)l.b2(x,d[I])>=0&&M++;if(M===0)return 0;M!==d.length&&(m=!1)}if(m)return 2;for(let y=0;y<3;y++){let x=Number.MAX_VALUE,M=-Number.MAX_VALUE;for(let I=0;I<s.points.length;I++){const O=s.points[I][y]-this.min[y];x=Math.min(x,O),M=Math.max(M,O)}if(M<0||x>this.max[y]-this.min[y])return 0}return 1}}class $a{constructor(s=0,d=0,m=0,y=0){if(isNaN(s)||s<0||isNaN(d)||d<0||isNaN(m)||m<0||isNaN(y)||y<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=d,this.left=m,this.right=y}interpolate(s,d,m){return d.top!=null&&s.top!=null&&(this.top=l.y.number(s.top,d.top,m)),d.bottom!=null&&s.bottom!=null&&(this.bottom=l.y.number(s.bottom,d.bottom,m)),d.left!=null&&s.left!=null&&(this.left=l.y.number(s.left,d.left,m)),d.right!=null&&s.right!=null&&(this.right=l.y.number(s.right,d.right,m)),this}getCenter(s,d){const m=l.ac((this.left+s-this.right)/2,0,s),y=l.ac((this.top+d-this.bottom)/2,0,d);return new l.P(m,y)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new $a(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const _d=85.051129;class ja{constructor(s,d,m,y,x){this.tileSize=512,this._renderWorldCopies=x===void 0||!!x,this._minZoom=s||0,this._maxZoom=d||22,this._minPitch=m??0,this._maxPitch=y??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new l.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new $a,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const s=new ja(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return s.apply(this),s}apply(s){this.tileSize=s.tileSize,this.latRange=s.latRange,this.lngRange=s.lngRange,this.width=s.width,this.height=s.height,this._center=s._center,this._elevation=s._elevation,this.minElevationForCurrentTile=s.minElevationForCurrentTile,this.zoom=s.zoom,this.angle=s.angle,this._fov=s._fov,this._pitch=s._pitch,this._unmodified=s._unmodified,this._edgeInsets=s._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(s){this._minZoom!==s&&(this._minZoom=s,this.zoom=Math.max(this.zoom,s))}get maxZoom(){return this._maxZoom}set maxZoom(s){this._maxZoom!==s&&(this._maxZoom=s,this.zoom=Math.min(this.zoom,s))}get minPitch(){return this._minPitch}set minPitch(s){this._minPitch!==s&&(this._minPitch=s,this.pitch=Math.max(this.pitch,s))}get maxPitch(){return this._maxPitch}set maxPitch(s){this._maxPitch!==s&&(this._maxPitch=s,this.pitch=Math.min(this.pitch,s))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(s){s===void 0?s=!0:s===null&&(s=!1),this._renderWorldCopies=s}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(s){const d=-l.b3(s,-180,180)*Math.PI/180;this.angle!==d&&(this._unmodified=!1,this.angle=d,this._calcMatrices(),this.rotationMatrix=function(){var m=new l.A(4);return l.A!=Float32Array&&(m[1]=0,m[2]=0),m[0]=1,m[3]=1,m}(),function(m,y,x){var M=y[0],I=y[1],O=y[2],N=y[3],V=Math.sin(x),F=Math.cos(x);m[0]=M*F+O*V,m[1]=I*F+N*V,m[2]=M*-V+O*F,m[3]=I*-V+N*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const d=l.ac(s,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==d&&(this._unmodified=!1,this._pitch=d,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(s){s=Math.max(.01,Math.min(60,s)),this._fov!==s&&(this._unmodified=!1,this._fov=s/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(s){const d=Math.min(Math.max(s,this.minZoom),this.maxZoom);this._zoom!==d&&(this._unmodified=!1,this._zoom=d,this.tileZoom=Math.max(0,Math.floor(d)),this.scale=this.zoomScale(d),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(s){s.lat===this._center.lat&&s.lng===this._center.lng||(this._unmodified=!1,this._center=s,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(s){s!==this._elevation&&(this._elevation=s,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(s){this._edgeInsets.equals(s)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,s,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(s){return this._edgeInsets.equals(s)}interpolatePadding(s,d,m){this._unmodified=!1,this._edgeInsets.interpolate(s,d,m),this._constrain(),this._calcMatrices()}coveringZoomLevel(s){const d=(s.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/s.tileSize));return Math.max(0,d)}getVisibleUnwrappedCoordinates(s){const d=[new l.b4(0,s)];if(this._renderWorldCopies){const m=this.pointCoordinate(new l.P(0,0)),y=this.pointCoordinate(new l.P(this.width,0)),x=this.pointCoordinate(new l.P(this.width,this.height)),M=this.pointCoordinate(new l.P(0,this.height)),I=Math.floor(Math.min(m.x,y.x,x.x,M.x)),O=Math.floor(Math.max(m.x,y.x,x.x,M.x)),N=1;for(let V=I-N;V<=O+N;V++)V!==0&&d.push(new l.b4(V,s))}return d}coveringTiles(s){var d,m;let y=this.coveringZoomLevel(s);const x=y;if(s.minzoom!==void 0&&y<s.minzoom)return[];s.maxzoom!==void 0&&y>s.maxzoom&&(y=s.maxzoom);const M=this.pointCoordinate(this.getCameraPoint()),I=l.Z.fromLngLat(this.center),O=Math.pow(2,y),N=[O*M.x,O*M.y,0],V=[O*I.x,O*I.y,0],F=Va.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,y);let G=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(G=y);const K=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,Q=te=>({aabb:new Fa([te*O,0,0],[(te+1)*O,O,0]),zoom:0,x:0,y:0,wrap:te,fullyVisible:!1}),re=[],ae=[],ce=y,he=s.reparseOverscaled?x:y;if(this._renderWorldCopies)for(let te=1;te<=3;te++)re.push(Q(-te)),re.push(Q(te));for(re.push(Q(0));re.length>0;){const te=re.pop(),me=te.x,ge=te.y;let ve=te.fullyVisible;if(!ve){const Ge=te.aabb.intersects(F);if(Ge===0)continue;ve=Ge===2}const ze=s.terrain?N:V,Ve=te.aabb.distanceX(ze),Je=te.aabb.distanceY(ze),it=Math.max(Math.abs(Ve),Math.abs(Je));if(te.zoom===ce||it>K+(1<<ce-te.zoom)-2&&te.zoom>=G){const Ge=ce-te.zoom,qe=N[0]-.5-(me<<Ge),mt=N[1]-.5-(ge<<Ge);ae.push({tileID:new l.S(te.zoom===ce?he:te.zoom,te.wrap,te.zoom,me,ge),distanceSq:je([V[0]-.5-me,V[1]-.5-ge]),tileDistanceToCamera:Math.sqrt(qe*qe+mt*mt)})}else for(let Ge=0;Ge<4;Ge++){const qe=(me<<1)+Ge%2,mt=(ge<<1)+(Ge>>1),Dt=te.zoom+1;let Ye=te.aabb.quadrant(Ge);if(s.terrain){const tt=new l.S(Dt,te.wrap,Dt,qe,mt),It=s.terrain.getMinMaxElevation(tt),Fn=(d=It.minElevation)!==null&&d!==void 0?d:this.elevation,Lt=(m=It.maxElevation)!==null&&m!==void 0?m:this.elevation;Ye=new Fa([Ye.min[0],Ye.min[1],Fn],[Ye.max[0],Ye.max[1],Lt])}re.push({aabb:Ye,zoom:Dt,x:qe,y:mt,wrap:te.wrap,fullyVisible:ve})}}return ae.sort((te,me)=>te.distanceSq-me.distanceSq).map(te=>te.tileID)}resize(s,d){this.width=s,this.height=d,this.pixelsToGLUnits=[2/s,-2/d],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(s){return Math.pow(2,s)}scaleZoom(s){return Math.log(s)/Math.LN2}project(s){const d=l.ac(s.lat,-85.051129,_d);return new l.P(l.O(s.lng)*this.worldSize,l.Q(d)*this.worldSize)}unproject(s){return new l.Z(s.x/this.worldSize,s.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(s){const d=this.elevation,m=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,y=this.pointLocation(this.centerPoint,s),x=s.getElevationForLngLatZoom(y,this.tileZoom);if(!(this.elevation-x))return;const M=m+d-x,I=Math.cos(this._pitch)*this.cameraToCenterDistance/M/l.b5(1,y.lat),O=this.scaleZoom(I/this.tileSize);this._elevation=x,this._center=y,this.zoom=O}setLocationAtPoint(s,d){const m=this.pointCoordinate(d),y=this.pointCoordinate(this.centerPoint),x=this.locationCoordinate(s),M=new l.Z(x.x-(m.x-y.x),x.y-(m.y-y.y));this.center=this.coordinateLocation(M),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(s,d){return d?this.coordinatePoint(this.locationCoordinate(s),d.getElevationForLngLatZoom(s,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(s))}pointLocation(s,d){return this.coordinateLocation(this.pointCoordinate(s,d))}locationCoordinate(s){return l.Z.fromLngLat(s)}coordinateLocation(s){return s&&s.toLngLat()}pointCoordinate(s,d){if(d){const G=d.pointCoordinate(s);if(G!=null)return G}const m=[s.x,s.y,0,1],y=[s.x,s.y,1,1];l.af(m,m,this.pixelMatrixInverse),l.af(y,y,this.pixelMatrixInverse);const x=m[3],M=y[3],I=m[1]/x,O=y[1]/M,N=m[2]/x,V=y[2]/M,F=N===V?0:(0-N)/(V-N);return new l.Z(l.y.number(m[0]/x,y[0]/M,F)/this.worldSize,l.y.number(I,O,F)/this.worldSize)}coordinatePoint(s,d=0,m=this.pixelMatrix){const y=[s.x*this.worldSize,s.y*this.worldSize,d,1];return l.af(y,y,m),new l.P(y[0]/y[3],y[1]/y[3])}getBounds(){const s=Math.max(0,this.height/2-this.getHorizon());return new we().extend(this.pointLocation(new l.P(0,s))).extend(this.pointLocation(new l.P(this.width,s))).extend(this.pointLocation(new l.P(this.width,this.height))).extend(this.pointLocation(new l.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new we([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(s){s?(this.lngRange=[s.getWest(),s.getEast()],this.latRange=[s.getSouth(),s.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,_d])}calculateTileMatrix(s){const d=s.canonical,m=this.worldSize/this.zoomScale(d.z),y=d.x+Math.pow(2,d.z)*s.wrap,x=l.an(new Float64Array(16));return l.J(x,x,[y*m,d.y*m,0]),l.K(x,x,[m/l.X,m/l.X,1]),x}calculatePosMatrix(s,d=!1){const m=s.key,y=d?this._alignedPosMatrixCache:this._posMatrixCache;if(y[m])return y[m];const x=this.calculateTileMatrix(s);return l.L(x,d?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,x),y[m]=new Float32Array(x),y[m]}calculateFogMatrix(s){const d=s.key,m=this._fogMatrixCache;if(m[d])return m[d];const y=this.calculateTileMatrix(s);return l.L(y,this.fogMatrix,y),m[d]=new Float32Array(y),m[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(s,d){d=l.ac(+d,this.minZoom,this.maxZoom);const m={center:new l.N(s.lng,s.lat),zoom:d};let y=this.lngRange;if(!this._renderWorldCopies&&y===null){const te=179.9999999999;y=[-te,te]}const x=this.tileSize*this.zoomScale(m.zoom);let M=0,I=x,O=0,N=x,V=0,F=0;const{x:G,y:K}=this.size;if(this.latRange){const te=this.latRange;M=l.Q(te[1])*x,I=l.Q(te[0])*x,I-M<K&&(V=K/(I-M))}y&&(O=l.b3(l.O(y[0])*x,0,x),N=l.b3(l.O(y[1])*x,0,x),N<O&&(N+=x),N-O<G&&(F=G/(N-O)));const{x:Q,y:re}=this.project.call({worldSize:x},s);let ae,ce;const he=Math.max(F||0,V||0);if(he){const te=new l.P(F?(N+O)/2:Q,V?(I+M)/2:re);return m.center=this.unproject.call({worldSize:x},te).wrap(),m.zoom+=this.scaleZoom(he),m}if(this.latRange){const te=K/2;re-te<M&&(ce=M+te),re+te>I&&(ce=I-te)}if(y){const te=(O+N)/2;let me=Q;this._renderWorldCopies&&(me=l.b3(Q,te-x/2,te+x/2));const ge=G/2;me-ge<O&&(ae=O+ge),me+ge>N&&(ae=N-ge)}if(ae!==void 0||ce!==void 0){const te=new l.P(ae??Q,ce??re);m.center=this.unproject.call({worldSize:x},te).wrap()}return m}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const s=this._unmodified,{center:d,zoom:m}=this.getConstrained(this.center,this.zoom);this.center=d,this.zoom=m,this._unmodified=s,this._constraining=!1}_calcMatrices(){if(!this.height)return;const s=this.centerOffset,d=this.point.x,m=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=l.b5(1,this.center.lat)*this.worldSize;let y=l.an(new Float64Array(16));l.K(y,y,[this.width/2,-this.height/2,1]),l.J(y,y,[1,-1,0]),this.labelPlaneMatrix=y,y=l.an(new Float64Array(16)),l.K(y,y,[1,-1,1]),l.J(y,y,[-1,-1,0]),l.K(y,y,[2/this.width,2/this.height,1]),this.glCoordMatrix=y;const x=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),M=Math.min(this.elevation,this.minElevationForCurrentTile),I=x-M*this._pixelPerMeter/Math.cos(this._pitch),O=M<0?I:x,N=Math.PI/2+this._pitch,V=this._fov*(.5+s.y/this.height),F=Math.sin(V)*O/Math.sin(l.ac(Math.PI-N-V,.01,Math.PI-.01)),G=this.getHorizon(),K=2*Math.atan(G/this.cameraToCenterDistance)*(.5+s.y/(2*G)),Q=Math.sin(K)*O/Math.sin(l.ac(Math.PI-N-K,.01,Math.PI-.01)),re=Math.min(F,Q);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*re+O),this.nearZ=this.height/50,y=new Float64Array(16),l.b6(y,this._fov,this.width/this.height,this.nearZ,this.farZ),y[8]=2*-s.x/this.width,y[9]=2*s.y/this.height,this.projectionMatrix=l.ae(y),l.K(y,y,[1,-1,1]),l.J(y,y,[0,0,-this.cameraToCenterDistance]),l.b7(y,y,this._pitch),l.ad(y,y,this.angle),l.J(y,y,[-d,-m,0]),this.mercatorMatrix=l.K([],y,[this.worldSize,this.worldSize,this.worldSize]),l.K(y,y,[1,1,this._pixelPerMeter]),this.pixelMatrix=l.L(new Float64Array(16),this.labelPlaneMatrix,y),l.J(y,y,[0,0,-this.elevation]),this.modelViewProjectionMatrix=y,this.invModelViewProjectionMatrix=l.as([],y),this.fogMatrix=new Float64Array(16),l.b6(this.fogMatrix,this._fov,this.width/this.height,x,this.farZ),this.fogMatrix[8]=2*-s.x/this.width,this.fogMatrix[9]=2*s.y/this.height,l.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),l.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),l.b7(this.fogMatrix,this.fogMatrix,this._pitch),l.ad(this.fogMatrix,this.fogMatrix,this.angle),l.J(this.fogMatrix,this.fogMatrix,[-d,-m,0]),l.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),l.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=l.L(new Float64Array(16),this.labelPlaneMatrix,y);const ae=this.width%2/2,ce=this.height%2/2,he=Math.cos(this.angle),te=Math.sin(this.angle),me=d-Math.round(d)+he*ae+te*ce,ge=m-Math.round(m)+he*ce+te*ae,ve=new Float64Array(y);if(l.J(ve,ve,[me>.5?me-1:me,ge>.5?ge-1:ge,0]),this.alignedModelViewProjectionMatrix=ve,y=l.as(new Float64Array(16),this.pixelMatrix),!y)throw new Error("failed to invert matrix");this.pixelMatrixInverse=y,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const s=this.pointCoordinate(new l.P(0,0)),d=[s.x*this.worldSize,s.y*this.worldSize,0,1];return l.af(d,d,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.P(0,s))}getCameraQueryGeometry(s){const d=this.getCameraPoint();if(s.length===1)return[s[0],d];{let m=d.x,y=d.y,x=d.x,M=d.y;for(const I of s)m=Math.min(m,I.x),y=Math.min(y,I.y),x=Math.max(x,I.x),M=Math.max(M,I.y);return[new l.P(m,y),new l.P(x,y),new l.P(x,M),new l.P(m,M),new l.P(m,y)]}}lngLatToCameraDepth(s,d){const m=this.locationCoordinate(s),y=[m.x*this.worldSize,m.y*this.worldSize,d,1];return l.af(y,y,this.modelViewProjectionMatrix),y[2]/y[3]}}function Zl(v,s){let d,m=!1,y=null,x=null;const M=()=>{y=null,m&&(v.apply(x,d),y=setTimeout(M,s),m=!1)};return(...I)=>(m=!0,x=this,d=I,y||M(),y)}class bu{constructor(s){this._getCurrentHash=()=>{const d=window.location.hash.replace("#","");if(this._hashName){let m;return d.split("&").map(y=>y.split("=")).forEach(y=>{y[0]===this._hashName&&(m=y)}),(m&&m[1]||"").split("/")}return d.split("/")},this._onHashChange=()=>{const d=this._getCurrentHash();if(d.length>=3&&!d.some(m=>isNaN(m))){const m=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(d[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+d[2],+d[1]],zoom:+d[0],bearing:m,pitch:+(d[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const d=window.location.href.replace(/(#.+)?$/,this.getHashString());window.history.replaceState(window.history.state,null,d)},this._removeHash=()=>{const d=this._getCurrentHash();if(d.length===0)return;const m=d.join("/");let y=m;y.split("&").length>0&&(y=y.split("&")[0]),this._hashName&&(y=`${this._hashName}=${m}`);let x=window.location.hash.replace(y,"");x.startsWith("#&")?x=x.slice(0,1)+x.slice(2):x==="#"&&(x="");let M=window.location.href.replace(/(#.+)?$/,x);M=M.replace("&&","&"),window.history.replaceState(window.history.state,null,M)},this._updateHash=Zl(this._updateHashUnthrottled,300),this._hashName=s&&encodeURIComponent(s)}addTo(s){return this._map=s,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(s){const d=this._map.getCenter(),m=Math.round(100*this._map.getZoom())/100,y=Math.ceil((m*Math.LN2+Math.log(512/360/.5))/Math.LN10),x=Math.pow(10,y),M=Math.round(d.lng*x)/x,I=Math.round(d.lat*x)/x,O=this._map.getBearing(),N=this._map.getPitch();let V="";if(V+=s?`/${M}/${I}/${m}`:`${m}/${I}/${M}`,(O||N)&&(V+="/"+Math.round(10*O)/10),N&&(V+=`/${Math.round(N)}`),this._hashName){const F=this._hashName;let G=!1;const K=window.location.hash.slice(1).split("&").map(Q=>{const re=Q.split("=")[0];return re===F?(G=!0,`${re}=${V}`):Q}).filter(Q=>Q);return G||K.push(`${F}=${V}`),`#${K.join("&")}`}return`#${V}`}}const xu={linearity:.3,easing:l.b8(0,0,.3,1)},bd=l.e({deceleration:2500,maxSpeed:1400},xu),__=l.e({deceleration:20,maxSpeed:1400},xu),xm=l.e({deceleration:1e3,maxSpeed:360},xu),vu=l.e({deceleration:1e3,maxSpeed:90},xu);class xd{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:E.now(),settings:s})}_drainInertiaBuffer(){const s=this._inertiaBuffer,d=E.now();for(;s.length>0&&d-s[0].time>160;)s.shift()}_onMoveEnd(s){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const d={zoom:0,bearing:0,pitch:0,pan:new l.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:x}of this._inertiaBuffer)d.zoom+=x.zoomDelta||0,d.bearing+=x.bearingDelta||0,d.pitch+=x.pitchDelta||0,x.panDelta&&d.pan._add(x.panDelta),x.around&&(d.around=x.around),x.pinchAround&&(d.pinchAround=x.pinchAround);const m=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,y={};if(d.pan.mag()){const x=Xl(d.pan.mag(),m,l.e({},bd,s||{}));y.offset=d.pan.mult(x.amount/d.pan.mag()),y.center=this._map.transform.center,Yl(y,x)}if(d.zoom){const x=Xl(d.zoom,m,__);y.zoom=this._map.transform.zoom+x.amount,Yl(y,x)}if(d.bearing){const x=Xl(d.bearing,m,xm);y.bearing=this._map.transform.bearing+l.ac(x.amount,-179,179),Yl(y,x)}if(d.pitch){const x=Xl(d.pitch,m,vu);y.pitch=this._map.transform.pitch+x.amount,Yl(y,x)}if(y.zoom||y.bearing){const x=d.pinchAround===void 0?d.around:d.pinchAround;y.around=x?this._map.unproject(x):this._map.getCenter()}return this.clear(),l.e(y,{noMoveStart:!0})}}function Yl(v,s){(!v.duration||v.duration<s.duration)&&(v.duration=s.duration,v.easing=s.easing)}function Xl(v,s,d){const{maxSpeed:m,linearity:y,deceleration:x}=d,M=l.ac(v*y/(s/1e3),-m,m),I=Math.abs(M)/(x*y);return{easing:d.easing,duration:1e3*I,amount:M*(I/2)}}class Pi extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,d,m,y={}){const x=C.mousePos(d.getCanvas(),m),M=d.unproject(x);super(s,l.e({point:x,lngLat:M,originalEvent:m},y)),this._defaultPrevented=!1,this.target=d}}class Yo extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,d,m){const y=s==="touchend"?m.changedTouches:m.touches,x=C.touchPos(d.getCanvasContainer(),y),M=x.map(O=>d.unproject(O)),I=x.reduce((O,N,V,F)=>O.add(N.div(F.length)),new l.P(0,0));super(s,{points:x,point:I,lngLats:M,lngLat:d.unproject(I),originalEvent:m}),this._defaultPrevented=!1}}class vm extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,d,m){super(s,{originalEvent:m}),this._defaultPrevented=!1}}class wm{constructor(s,d){this._map=s,this._clickTolerance=d.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new vm(s.type,this._map,s))}mousedown(s,d){return this._mousedownPos=d,this._firePreventable(new Pi(s.type,this._map,s))}mouseup(s){this._map.fire(new Pi(s.type,this._map,s))}click(s,d){this._mousedownPos&&this._mousedownPos.dist(d)>=this._clickTolerance||this._map.fire(new Pi(s.type,this._map,s))}dblclick(s){return this._firePreventable(new Pi(s.type,this._map,s))}mouseover(s){this._map.fire(new Pi(s.type,this._map,s))}mouseout(s){this._map.fire(new Pi(s.type,this._map,s))}touchstart(s){return this._firePreventable(new Yo(s.type,this._map,s))}touchmove(s){this._map.fire(new Yo(s.type,this._map,s))}touchend(s){this._map.fire(new Yo(s.type,this._map,s))}touchcancel(s){this._map.fire(new Yo(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Qn{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new Pi(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Pi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new Pi(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class es{constructor(s){this._map=s}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(s){return this.transform.pointLocation(l.P.convert(s),this._map.terrain)}}class _r{constructor(s,d){this._map=s,this._tr=new es(s),this._el=s.getCanvasContainer(),this._container=s.getContainer(),this._clickTolerance=d.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(s,d){this.isEnabled()&&s.shiftKey&&s.button===0&&(C.disableDrag(),this._startPos=this._lastPos=d,this._active=!0)}mousemoveWindow(s,d){if(!this._active)return;const m=d;if(this._lastPos.equals(m)||!this._box&&m.dist(this._startPos)<this._clickTolerance)return;const y=this._startPos;this._lastPos=m,this._box||(this._box=C.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",s));const x=Math.min(y.x,m.x),M=Math.max(y.x,m.x),I=Math.min(y.y,m.y),O=Math.max(y.y,m.y);C.setTransform(this._box,`translate(${x}px,${I}px)`),this._box.style.width=M-x+"px",this._box.style.height=O-I+"px"}mouseupWindow(s,d){if(!this._active||s.button!==0)return;const m=this._startPos,y=d;if(this.reset(),C.suppressClick(),m.x!==y.x||m.y!==y.y)return this._map.fire(new l.k("boxzoomend",{originalEvent:s})),{cameraAnimation:x=>x.fitScreenCoordinates(m,y,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",s)}keydown(s){this._active&&s.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",s))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(C.remove(this._box),this._box=null),C.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,d){return this._map.fire(new l.k(s,{originalEvent:d}))}}function Kl(v,s){if(v.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${v.length}, points ${s.length}`);const d={};for(let m=0;m<v.length;m++)d[v[m].identifier]=s[m];return d}class vd{constructor(s){this.reset(),this.numTouches=s.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(s,d,m){(this.centroid||m.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),m.length===this.numTouches&&(this.centroid=function(y){const x=new l.P(0,0);for(const M of y)x._add(M);return x.div(y.length)}(d),this.touches=Kl(m,d)))}touchmove(s,d,m){if(this.aborted||!this.centroid)return;const y=Kl(m,d);for(const x in this.touches){const M=y[x];(!M||M.dist(this.touches[x])>30)&&(this.aborted=!0)}}touchend(s,d,m){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),m.length===0){const y=!this.aborted&&this.centroid;if(this.reset(),y)return y}}}class wu{constructor(s){this.singleTap=new vd(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(s,d,m){this.singleTap.touchstart(s,d,m)}touchmove(s,d,m){this.singleTap.touchmove(s,d,m)}touchend(s,d,m){const y=this.singleTap.touchend(s,d,m);if(y){const x=s.timeStamp-this.lastTime<500,M=!this.lastTap||this.lastTap.dist(y)<30;if(x&&M||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=y,this.count===this.numTaps)return this.reset(),y}}}class Ua{constructor(s){this._tr=new es(s),this._zoomIn=new wu({numTouches:1,numTaps:2}),this._zoomOut=new wu({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,d,m){this._zoomIn.touchstart(s,d,m),this._zoomOut.touchstart(s,d,m)}touchmove(s,d,m){this._zoomIn.touchmove(s,d,m),this._zoomOut.touchmove(s,d,m)}touchend(s,d,m){const y=this._zoomIn.touchend(s,d,m),x=this._zoomOut.touchend(s,d,m),M=this._tr;return y?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:M.zoom+1,around:M.unproject(y)},{originalEvent:s})}):x?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:M.zoom-1,around:M.unproject(x)},{originalEvent:s})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qs{constructor(s){this._enabled=!!s.enable,this._moveStateManager=s.moveStateManager,this._clickTolerance=s.clickTolerance||1,this._moveFunction=s.move,this._activateOnStart=!!s.activateOnStart,s.assignEvents(this),this.reset()}reset(s){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(s)}_move(...s){const d=this._moveFunction(...s);if(d.bearingDelta||d.pitchDelta||d.around||d.panDelta)return this._active=!0,d}dragStart(s,d){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(s)&&(this._moveStateManager.startMove(s),this._lastPoint=d.length?d[0]:d,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(s,d){if(!this.isEnabled())return;const m=this._lastPoint;if(!m)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);const y=d.length?d[0]:d;return!this._moved&&y.dist(m)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=y,this._move(m,y))}dragEnd(s){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(s)&&(this._moved&&C.suppressClick(),this.reset(s))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const wd={0:1,2:2};class ku{constructor(s){this._correctEvent=s.checkCorrectEvent}startMove(s){const d=C.mouseButton(s);this._eventButton=d}endMove(s){delete this._eventButton}isValidStartEvent(s){return this._correctEvent(s)}isValidMoveEvent(s){return!function(d,m){const y=wd[m];return d.buttons===void 0||(d.buttons&y)!==y}(s,this._eventButton)}isValidEndEvent(s){return C.mouseButton(s)===this._eventButton}}class kd{constructor(){this._firstTouch=void 0}_isOneFingerTouch(s){return s.targetTouches.length===1}_isSameTouchEvent(s){return s.targetTouches[0].identifier===this._firstTouch}startMove(s){this._firstTouch=s.targetTouches[0].identifier}endMove(s){delete this._firstTouch}isValidStartEvent(s){return this._isOneFingerTouch(s)}isValidMoveEvent(s){return this._isOneFingerTouch(s)&&this._isSameTouchEvent(s)}isValidEndEvent(s){return this._isOneFingerTouch(s)&&this._isSameTouchEvent(s)}}const Su=v=>{v.mousedown=v.dragStart,v.mousemoveWindow=v.dragMove,v.mouseup=v.dragEnd,v.contextmenu=s=>{s.preventDefault()}},Sd=({enable:v,clickTolerance:s,bearingDegreesPerPixelMoved:d=.8})=>{const m=new ku({checkCorrectEvent:y=>C.mouseButton(y)===0&&y.ctrlKey||C.mouseButton(y)===2});return new qs({clickTolerance:s,move:(y,x)=>({bearingDelta:(x.x-y.x)*d}),moveStateManager:m,enable:v,assignEvents:Su})},Ed=({enable:v,clickTolerance:s,pitchDegreesPerPixelMoved:d=-.5})=>{const m=new ku({checkCorrectEvent:y=>C.mouseButton(y)===0&&y.ctrlKey||C.mouseButton(y)===2});return new qs({clickTolerance:s,move:(y,x)=>({pitchDelta:(x.y-y.y)*d}),moveStateManager:m,enable:v,assignEvents:Su})};class Xo{constructor(s,d){this._clickTolerance=s.clickTolerance||1,this._map=d,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.P(0,0)}_shouldBePrevented(s){return s<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(s,d,m){return this._calculateTransform(s,d,m)}touchmove(s,d,m){if(this._active){if(!this._shouldBePrevented(m.length))return s.preventDefault(),this._calculateTransform(s,d,m);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",s)}}touchend(s,d,m){this._calculateTransform(s,d,m),this._active&&this._shouldBePrevented(m.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(s,d,m){m.length>0&&(this._active=!0);const y=Kl(m,d),x=new l.P(0,0),M=new l.P(0,0);let I=0;for(const N in y){const V=y[N],F=this._touches[N];F&&(x._add(V),M._add(V.sub(F)),I++,y[N]=V)}if(this._touches=y,this._shouldBePrevented(I)||!M.mag())return;const O=M.div(I);return this._sum._add(O),this._sum.mag()<this._clickTolerance?void 0:{around:x.div(I),panDelta:O}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Eu{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(s,d,m){this._firstTwoTouches||m.length<2||(this._firstTwoTouches=[m[0].identifier,m[1].identifier],this._start([d[0],d[1]]))}touchmove(s,d,m){if(!this._firstTwoTouches)return;s.preventDefault();const[y,x]=this._firstTwoTouches,M=Jl(m,d,y),I=Jl(m,d,x);if(!M||!I)return;const O=this._aroundCenter?null:M.add(I).div(2);return this._move([M,I],O,s)}touchend(s,d,m){if(!this._firstTwoTouches)return;const[y,x]=this._firstTwoTouches,M=Jl(m,d,y),I=Jl(m,d,x);M&&I||(this._active&&C.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(s){this._enabled=!0,this._aroundCenter=!!s&&s.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Jl(v,s,d){for(let m=0;m<v.length;m++)if(v[m].identifier===d)return s[m]}function Cd(v,s){return Math.log(v/s)/Math.LN2}class Td extends Eu{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(s){this._startDistance=this._distance=s[0].dist(s[1])}_move(s,d){const m=this._distance;if(this._distance=s[0].dist(s[1]),this._active||!(Math.abs(Cd(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Cd(this._distance,m),pinchAround:d}}}function Md(v,s){return 180*v.angleWith(s)/Math.PI}class Ad extends Eu{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(s){this._startVector=this._vector=s[0].sub(s[1]),this._minDiameter=s[0].dist(s[1])}_move(s,d,m){const y=this._vector;if(this._vector=s[0].sub(s[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Md(this._vector,y),pinchAround:d}}_isBelowThreshold(s){this._minDiameter=Math.min(this._minDiameter,s.mag());const d=25/(Math.PI*this._minDiameter)*360,m=Md(s,this._startVector);return Math.abs(m)<d}}function Cu(v){return Math.abs(v.y)>Math.abs(v.x)}class Ha extends Eu{constructor(s){super(),this._currentTouchCount=0,this._map=s}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(s,d,m){super.touchstart(s,d,m),this._currentTouchCount=m.length}_start(s){this._lastPoints=s,Cu(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,d,m){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const y=s[0].sub(this._lastPoints[0]),x=s[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(y,x,m.timeStamp),this._valid?(this._lastPoints=s,this._active=!0,{pitchDelta:(y.y+x.y)/2*-.5}):void 0}gestureBeginsVertically(s,d,m){if(this._valid!==void 0)return this._valid;const y=s.mag()>=2,x=d.mag()>=2;if(!y&&!x)return;if(!y||!x)return this._firstMove===void 0&&(this._firstMove=m),m-this._firstMove<100&&void 0;const M=s.y>0==d.y>0;return Cu(s)&&Cu(d)&&M}}const km={panStep:100,bearingStep:15,pitchStep:10};class Lr{constructor(s){this._tr=new es(s);const d=km;this._panStep=d.panStep,this._bearingStep=d.bearingStep,this._pitchStep=d.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(s){if(s.altKey||s.ctrlKey||s.metaKey)return;let d=0,m=0,y=0,x=0,M=0;switch(s.keyCode){case 61:case 107:case 171:case 187:d=1;break;case 189:case 109:case 173:d=-1;break;case 37:s.shiftKey?m=-1:(s.preventDefault(),x=-1);break;case 39:s.shiftKey?m=1:(s.preventDefault(),x=1);break;case 38:s.shiftKey?y=1:(s.preventDefault(),M=-1);break;case 40:s.shiftKey?y=-1:(s.preventDefault(),M=1);break;default:return}return this._rotationDisabled&&(m=0,y=0),{cameraAnimation:I=>{const O=this._tr;I.easeTo({duration:300,easeId:"keyboardHandler",easing:As,zoom:d?Math.round(O.zoom)+d*(s.shiftKey?2:1):O.zoom,bearing:O.bearing+m*this._bearingStep,pitch:O.pitch+y*this._pitchStep,offset:[-x*this._panStep,-M*this._panStep],center:O.center},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function As(v){return v*(2-v)}const Id=4.000244140625;class ts{constructor(s,d){this._onTimeout=m=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(m)},this._map=s,this._tr=new es(s),this._triggerRenderFrame=d,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(s){this._defaultZoomRate=s}setWheelZoomRate(s){this._wheelZoomRate=s}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(s){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!s&&s.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(s){return!!this._map.cooperativeGestures.isEnabled()&&!(s.ctrlKey||this._map.cooperativeGestures.isBypassed(s))}wheel(s){if(!this.isEnabled())return;if(this._shouldBePrevented(s))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",s);let d=s.deltaMode===WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const m=E.now(),y=m-(this._lastWheelEventTime||0);this._lastWheelEventTime=m,d!==0&&d%Id==0?this._type="wheel":d!==0&&Math.abs(d)<4?this._type="trackpad":y>400?(this._type=null,this._lastValue=d,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(y*d)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,d+=this._lastValue)),s.shiftKey&&d&&(d/=4),this._type&&(this._lastWheelEvent=s,this._delta-=d,this._active||this._start(s)),s.preventDefault()}_start(s){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const d=C.mousePos(this._map.getCanvas(),s),m=this._tr;this._around=d.y>m.transform.height/2-m.transform.getHorizon()?l.N.convert(this._aroundCenter?m.center:m.unproject(d)):l.N.convert(m.center),this._aroundPoint=m.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const s=this._tr.transform;if(this._delta!==0){const O=this._type==="wheel"&&Math.abs(this._delta)>Id?this._wheelZoomRate:this._defaultZoomRate;let N=2/(1+Math.exp(-Math.abs(this._delta*O)));this._delta<0&&N!==0&&(N=1/N);const V=typeof this._targetZoom=="number"?s.zoomScale(this._targetZoom):s.scale;this._targetZoom=Math.min(s.maxZoom,Math.max(s.minZoom,s.scaleZoom(V*N))),this._type==="wheel"&&(this._startZoom=s.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const d=typeof this._targetZoom=="number"?this._targetZoom:s.zoom,m=this._startZoom,y=this._easing;let x,M=!1;const I=E.now()-this._lastWheelEventTime;if(this._type==="wheel"&&m&&y&&I){const O=Math.min(I/200,1),N=y(O);x=l.y.number(m,d,N),O<1?this._frameId||(this._frameId=!0):M=!0}else x=d,M=!0;return this._active=!0,M&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!M,zoomDelta:x-s.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let d=l.b9;if(this._prevEase){const m=this._prevEase,y=(E.now()-m.start)/m.duration,x=m.easing(y+.01)-m.easing(y),M=.27/Math.sqrt(x*x+1e-4)*.01,I=Math.sqrt(.0729-M*M);d=l.b8(M,I,.25,1)}return this._prevEase={start:E.now(),duration:s,easing:d},d}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ko{constructor(s,d){this._clickZoom=s,this._tapZoom=d}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class b_{constructor(s){this._tr=new es(s),this.reset()}reset(){this._active=!1}dblclick(s,d){return s.preventDefault(),{cameraAnimation:m=>{m.easeTo({duration:300,zoom:this._tr.zoom+(s.shiftKey?-1:1),around:this._tr.unproject(d)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class x_{constructor(){this._tap=new wu({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(s,d,m){if(!this._swipePoint)if(this._tapTime){const y=d[0],x=s.timeStamp-this._tapTime<500,M=this._tapPoint.dist(y)<30;x&&M?m.length>0&&(this._swipePoint=y,this._swipeTouch=m[0].identifier):this.reset()}else this._tap.touchstart(s,d,m)}touchmove(s,d,m){if(this._tapTime){if(this._swipePoint){if(m[0].identifier!==this._swipeTouch)return;const y=d[0],x=y.y-this._swipePoint.y;return this._swipePoint=y,s.preventDefault(),this._active=!0,{zoomDelta:x/128}}}else this._tap.touchmove(s,d,m)}touchend(s,d,m){if(this._tapTime)this._swipePoint&&m.length===0&&this.reset();else{const y=this._tap.touchend(s,d,m);y&&(this._tapTime=s.timeStamp,this._tapPoint=y)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Sm{constructor(s,d,m){this._el=s,this._mousePan=d,this._touchPan=m}enable(s){this._inertiaOptions=s||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Em{constructor(s,d,m){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=d,this._mousePitch=m}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Pd{constructor(s,d,m,y){this._el=s,this._touchZoom=d,this._touchRotate=m,this._tapDragZoom=y,this._rotationDisabled=!1,this._enabled=!0}enable(s){this._touchZoom.enable(s),this._rotationDisabled||this._touchRotate.enable(s),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class qa{constructor(s,d){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=s,this._options=d,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const s=this._map.getCanvasContainer();s.classList.add("maplibregl-cooperative-gestures"),this._container=C.create("div","maplibregl-cooperative-gesture-screen",s);let d=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(d=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const m=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),y=document.createElement("div");y.className="maplibregl-desktop-message",y.textContent=d,this._container.appendChild(y);const x=document.createElement("div");x.className="maplibregl-mobile-message",x.textContent=m,this._container.appendChild(x),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(C.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(s){return s[this._bypassKey]}notifyGestureBlocked(s,d){this._enabled&&(this._map.fire(new l.k("cooperativegestureprevented",{gestureType:s,originalEvent:d})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Vr=v=>v.zoom||v.drag||v.pitch||v.rotate;class lt extends l.k{}function Tu(v){return v.panDelta&&v.panDelta.mag()||v.zoomDelta||v.bearingDelta||v.pitchDelta}class Dd{constructor(s,d){this.handleWindowEvent=y=>{this.handleEvent(y,`${y.type}Window`)},this.handleEvent=(y,x)=>{if(y.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const M=y.type==="renderFrame"?void 0:y,I={needsRenderFrame:!1},O={},N={},V=y.touches,F=V?this._getMapTouches(V):void 0,G=F?C.touchPos(this._map.getCanvas(),F):C.mousePos(this._map.getCanvas(),y);for(const{handlerName:re,handler:ae,allowed:ce}of this._handlers){if(!ae.isEnabled())continue;let he;this._blockedByActive(N,ce,re)?ae.reset():ae[x||y.type]&&(he=ae[x||y.type](y,G,F),this.mergeHandlerResult(I,O,he,re,M),he&&he.needsRenderFrame&&this._triggerRenderFrame()),(he||ae.isActive())&&(N[re]=ae)}const K={};for(const re in this._previousActiveHandlers)N[re]||(K[re]=M);this._previousActiveHandlers=N,(Object.keys(K).length||Tu(I))&&(this._changes.push([I,O,K]),this._triggerRenderFrame()),(Object.keys(N).length||Tu(I))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:Q}=I;Q&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],Q(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new xd(s),this._bearingSnap=d.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(d);const m=this._el;this._listeners=[[m,"touchstart",{passive:!0}],[m,"touchmove",{passive:!1}],[m,"touchend",void 0],[m,"touchcancel",void 0],[m,"mousedown",void 0],[m,"mousemove",void 0],[m,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[m,"mouseover",void 0],[m,"mouseout",void 0],[m,"dblclick",void 0],[m,"click",void 0],[m,"keydown",{capture:!1}],[m,"keyup",void 0],[m,"wheel",{passive:!1}],[m,"contextmenu",void 0],[window,"blur",void 0]];for(const[y,x,M]of this._listeners)C.addEventListener(y,x,y===document?this.handleWindowEvent:this.handleEvent,M)}destroy(){for(const[s,d,m]of this._listeners)C.removeEventListener(s,d,s===document?this.handleWindowEvent:this.handleEvent,m)}_addDefaultHandlers(s){const d=this._map,m=d.getCanvasContainer();this._add("mapEvent",new wm(d,s));const y=d.boxZoom=new _r(d,s);this._add("boxZoom",y),s.interactive&&s.boxZoom&&y.enable();const x=d.cooperativeGestures=new qa(d,s.cooperativeGestures);this._add("cooperativeGestures",x),s.cooperativeGestures&&x.enable();const M=new Ua(d),I=new b_(d);d.doubleClickZoom=new Ko(I,M),this._add("tapZoom",M),this._add("clickZoom",I),s.interactive&&s.doubleClickZoom&&d.doubleClickZoom.enable();const O=new x_;this._add("tapDragZoom",O);const N=d.touchPitch=new Ha(d);this._add("touchPitch",N),s.interactive&&s.touchPitch&&d.touchPitch.enable(s.touchPitch);const V=Sd(s),F=Ed(s);d.dragRotate=new Em(s,V,F),this._add("mouseRotate",V,["mousePitch"]),this._add("mousePitch",F,["mouseRotate"]),s.interactive&&s.dragRotate&&d.dragRotate.enable();const G=(({enable:he,clickTolerance:te})=>{const me=new ku({checkCorrectEvent:ge=>C.mouseButton(ge)===0&&!ge.ctrlKey});return new qs({clickTolerance:te,move:(ge,ve)=>({around:ve,panDelta:ve.sub(ge)}),activateOnStart:!0,moveStateManager:me,enable:he,assignEvents:Su})})(s),K=new Xo(s,d);d.dragPan=new Sm(m,G,K),this._add("mousePan",G),this._add("touchPan",K,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&d.dragPan.enable(s.dragPan);const Q=new Ad,re=new Td;d.touchZoomRotate=new Pd(m,re,Q,O),this._add("touchRotate",Q,["touchPan","touchZoom"]),this._add("touchZoom",re,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&d.touchZoomRotate.enable(s.touchZoomRotate);const ae=d.scrollZoom=new ts(d,()=>this._triggerRenderFrame());this._add("scrollZoom",ae,["mousePan"]),s.interactive&&s.scrollZoom&&d.scrollZoom.enable(s.scrollZoom);const ce=d.keyboard=new Lr(d);this._add("keyboard",ce),s.interactive&&s.keyboard&&d.keyboard.enable(),this._add("blockableMapEvent",new Qn(d))}_add(s,d,m){this._handlers.push({handlerName:s,handler:d,allowed:m}),this._handlersById[s]=d}stop(s){if(!this._updatingCamera){for(const{handler:d}of this._handlers)d.reset();this._inertia.clear(),this._fireEvents({},{},s),this._changes=[]}}isActive(){for(const{handler:s}of this._handlers)if(s.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Vr(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,d,m){for(const y in s)if(y!==m&&(!d||d.indexOf(y)<0))return!0;return!1}_getMapTouches(s){const d=[];for(const m of s)this._el.contains(m.target)&&d.push(m);return d}mergeHandlerResult(s,d,m,y,x){if(!m)return;l.e(s,m);const M={handlerName:y,originalEvent:m.originalEvent||x};m.zoomDelta!==void 0&&(d.zoom=M),m.panDelta!==void 0&&(d.drag=M),m.pitchDelta!==void 0&&(d.pitch=M),m.bearingDelta!==void 0&&(d.rotate=M)}_applyChanges(){const s={},d={},m={};for(const[y,x,M]of this._changes)y.panDelta&&(s.panDelta=(s.panDelta||new l.P(0,0))._add(y.panDelta)),y.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+y.zoomDelta),y.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+y.bearingDelta),y.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+y.pitchDelta),y.around!==void 0&&(s.around=y.around),y.pinchAround!==void 0&&(s.pinchAround=y.pinchAround),y.noInertia&&(s.noInertia=y.noInertia),l.e(d,x),l.e(m,M);this._updateMapTransform(s,d,m),this._changes=[]}_updateMapTransform(s,d,m){const y=this._map,x=y._getTransformForUpdate(),M=y.terrain;if(!(Tu(s)||M&&this._terrainMovement))return this._fireEvents(d,m,!0);let{panDelta:I,zoomDelta:O,bearingDelta:N,pitchDelta:V,around:F,pinchAround:G}=s;G!==void 0&&(F=G),y._stop(!0),F=F||y.transform.centerPoint;const K=x.pointLocation(I?F.sub(I):F);N&&(x.bearing+=N),V&&(x.pitch+=V),O&&(x.zoom+=O),M?this._terrainMovement||!d.drag&&!d.zoom?d.drag&&this._terrainMovement?x.center=x.pointLocation(x.centerPoint.sub(I)):x.setLocationAtPoint(K,F):(this._terrainMovement=!0,this._map._elevationFreeze=!0,x.setLocationAtPoint(K,F)):x.setLocationAtPoint(K,F),y._applyUpdatedTransform(x),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(d,m,!0)}_fireEvents(s,d,m){const y=Vr(this._eventsInProgress),x=Vr(s),M={};for(const F in s){const{originalEvent:G}=s[F];this._eventsInProgress[F]||(M[`${F}start`]=G),this._eventsInProgress[F]=s[F]}!y&&x&&this._fireEvent("movestart",x.originalEvent);for(const F in M)this._fireEvent(F,M[F]);x&&this._fireEvent("move",x.originalEvent);for(const F in s){const{originalEvent:G}=s[F];this._fireEvent(F,G)}const I={};let O;for(const F in this._eventsInProgress){const{handlerName:G,originalEvent:K}=this._eventsInProgress[F];this._handlersById[G].isActive()||(delete this._eventsInProgress[F],O=d[G]||K,I[`${F}end`]=O)}for(const F in I)this._fireEvent(F,I[F]);const N=Vr(this._eventsInProgress),V=(y||x)&&!N;if(V&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const F=this._map._getTransformForUpdate();F.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(F)}if(m&&V){this._updatingCamera=!0;const F=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),G=K=>K!==0&&-this._bearingSnap<K&&K<this._bearingSnap;!F||!F.essential&&E.prefersReducedMotion?(this._map.fire(new l.k("moveend",{originalEvent:O})),G(this._map.getBearing())&&this._map.resetNorth()):(G(F.bearing||this._map.getBearing())&&(F.bearing=0),F.freezeElevation=!0,this._map.easeTo(F,{originalEvent:O})),this._updatingCamera=!1}}_fireEvent(s,d){this._map.fire(new l.k(s,d?{originalEvent:d}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(s=>{delete this._frameId,this.handleEvent(new lt("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Cm extends l.E{constructor(s,d){super(),this._renderFrameCallback=()=>{const m=Math.min((E.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(m)),m<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=s,this._bearingSnap=d.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new l.N(this.transform.center.lng,this.transform.center.lat)}setCenter(s,d){return this.jumpTo({center:s},d)}panBy(s,d,m){return s=l.P.convert(s).mult(-1),this.panTo(this.transform.center,l.e({offset:s},d),m)}panTo(s,d,m){return this.easeTo(l.e({center:s},d),m)}getZoom(){return this.transform.zoom}setZoom(s,d){return this.jumpTo({zoom:s},d),this}zoomTo(s,d,m){return this.easeTo(l.e({zoom:s},d),m)}zoomIn(s,d){return this.zoomTo(this.getZoom()+1,s,d),this}zoomOut(s,d){return this.zoomTo(this.getZoom()-1,s,d),this}getBearing(){return this.transform.bearing}setBearing(s,d){return this.jumpTo({bearing:s},d),this}getPadding(){return this.transform.padding}setPadding(s,d){return this.jumpTo({padding:s},d),this}rotateTo(s,d,m){return this.easeTo(l.e({bearing:s},d),m)}resetNorth(s,d){return this.rotateTo(0,l.e({duration:1e3},s),d),this}resetNorthPitch(s,d){return this.easeTo(l.e({bearing:0,pitch:0,duration:1e3},s),d),this}snapToNorth(s,d){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(s,d):this}getPitch(){return this.transform.pitch}setPitch(s,d){return this.jumpTo({pitch:s},d),this}cameraForBounds(s,d){s=we.convert(s).adjustAntiMeridian();const m=d&&d.bearing||0;return this._cameraForBoxAndBearing(s.getNorthWest(),s.getSouthEast(),m,d)}_cameraForBoxAndBearing(s,d,m,y){const x={top:0,bottom:0,right:0,left:0};if(typeof(y=l.e({padding:x,offset:[0,0],maxZoom:this.transform.maxZoom},y)).padding=="number"){const Ge=y.padding;y.padding={top:Ge,bottom:Ge,right:Ge,left:Ge}}y.padding=l.e(x,y.padding);const M=this.transform,I=M.padding,O=new we(s,d),N=M.project(O.getNorthWest()),V=M.project(O.getNorthEast()),F=M.project(O.getSouthEast()),G=M.project(O.getSouthWest()),K=l.ba(-m),Q=N.rotate(K),re=V.rotate(K),ae=F.rotate(K),ce=G.rotate(K),he=new l.P(Math.max(Q.x,re.x,ce.x,ae.x),Math.max(Q.y,re.y,ce.y,ae.y)),te=new l.P(Math.min(Q.x,re.x,ce.x,ae.x),Math.min(Q.y,re.y,ce.y,ae.y)),me=he.sub(te),ge=(M.width-(I.left+I.right+y.padding.left+y.padding.right))/me.x,ve=(M.height-(I.top+I.bottom+y.padding.top+y.padding.bottom))/me.y;if(ve<0||ge<0)return void l.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const ze=Math.min(M.scaleZoom(M.scale*Math.min(ge,ve)),y.maxZoom),Ve=l.P.convert(y.offset),Je=new l.P((y.padding.left-y.padding.right)/2,(y.padding.top-y.padding.bottom)/2).rotate(l.ba(m)),it=Ve.add(Je).mult(M.scale/M.zoomScale(ze));return{center:M.unproject(N.add(F).div(2).sub(it)),zoom:ze,bearing:m}}fitBounds(s,d,m){return this._fitInternal(this.cameraForBounds(s,d),d,m)}fitScreenCoordinates(s,d,m,y,x){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(l.P.convert(s)),this.transform.pointLocation(l.P.convert(d)),m,y),y,x)}_fitInternal(s,d,m){return s?(delete(d=l.e(s,d)).padding,d.linear?this.easeTo(d,m):this.flyTo(d,m)):this}jumpTo(s,d){this.stop();const m=this._getTransformForUpdate();let y=!1,x=!1,M=!1;return"zoom"in s&&m.zoom!==+s.zoom&&(y=!0,m.zoom=+s.zoom),s.center!==void 0&&(m.center=l.N.convert(s.center)),"bearing"in s&&m.bearing!==+s.bearing&&(x=!0,m.bearing=+s.bearing),"pitch"in s&&m.pitch!==+s.pitch&&(M=!0,m.pitch=+s.pitch),s.padding==null||m.isPaddingEqual(s.padding)||(m.padding=s.padding),this._applyUpdatedTransform(m),this.fire(new l.k("movestart",d)).fire(new l.k("move",d)),y&&this.fire(new l.k("zoomstart",d)).fire(new l.k("zoom",d)).fire(new l.k("zoomend",d)),x&&this.fire(new l.k("rotatestart",d)).fire(new l.k("rotate",d)).fire(new l.k("rotateend",d)),M&&this.fire(new l.k("pitchstart",d)).fire(new l.k("pitch",d)).fire(new l.k("pitchend",d)),this.fire(new l.k("moveend",d))}calculateCameraOptionsFromTo(s,d,m,y=0){const x=l.Z.fromLngLat(s,d),M=l.Z.fromLngLat(m,y),I=M.x-x.x,O=M.y-x.y,N=M.z-x.z,V=Math.hypot(I,O,N);if(V===0)throw new Error("Can't calculate camera options with same From and To");const F=Math.hypot(I,O),G=this.transform.scaleZoom(this.transform.cameraToCenterDistance/V/this.transform.tileSize),K=180*Math.atan2(I,-O)/Math.PI;let Q=180*Math.acos(F/V)/Math.PI;return Q=N<0?90-Q:90+Q,{center:M.toLngLat(),zoom:G,pitch:Q,bearing:K}}easeTo(s,d){var m;this._stop(!1,s.easeId),((s=l.e({offset:[0,0],duration:500,easing:l.b9},s)).animate===!1||!s.essential&&E.prefersReducedMotion)&&(s.duration=0);const y=this._getTransformForUpdate(),x=y.zoom,M=y.bearing,I=y.pitch,O=y.padding,N="bearing"in s?this._normalizeBearing(s.bearing,M):M,V="pitch"in s?+s.pitch:I,F="padding"in s?s.padding:y.padding,G=l.P.convert(s.offset);let K=y.centerPoint.add(G);const Q=y.pointLocation(K),{center:re,zoom:ae}=y.getConstrained(l.N.convert(s.center||Q),(m=s.zoom)!==null&&m!==void 0?m:x);this._normalizeCenter(re,y);const ce=y.project(Q),he=y.project(re).sub(ce),te=y.zoomScale(ae-x);let me,ge;s.around&&(me=l.N.convert(s.around),ge=y.locationPoint(me));const ve={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||ae!==x,this._rotating=this._rotating||M!==N,this._pitching=this._pitching||V!==I,this._padding=!y.isPaddingEqual(F),this._easeId=s.easeId,this._prepareEase(d,s.noMoveStart,ve),this.terrain&&this._prepareElevation(re),this._ease(ze=>{if(this._zooming&&(y.zoom=l.y.number(x,ae,ze)),this._rotating&&(y.bearing=l.y.number(M,N,ze)),this._pitching&&(y.pitch=l.y.number(I,V,ze)),this._padding&&(y.interpolatePadding(O,F,ze),K=y.centerPoint.add(G)),this.terrain&&!s.freezeElevation&&this._updateElevation(ze),me)y.setLocationAtPoint(me,ge);else{const Ve=y.zoomScale(y.zoom-x),Je=ae>x?Math.min(2,te):Math.max(.5,te),it=Math.pow(Je,1-ze),Ge=y.unproject(ce.add(he.mult(ze*it)).mult(Ve));y.setLocationAtPoint(y.renderWorldCopies?Ge.wrap():Ge,K)}this._applyUpdatedTransform(y),this._fireMoveEvents(d)},ze=>{this.terrain&&s.freezeElevation&&this._finalizeElevation(),this._afterEase(d,ze)},s),this}_prepareEase(s,d,m={}){this._moving=!0,d||m.moving||this.fire(new l.k("movestart",s)),this._zooming&&!m.zooming&&this.fire(new l.k("zoomstart",s)),this._rotating&&!m.rotating&&this.fire(new l.k("rotatestart",s)),this._pitching&&!m.pitching&&this.fire(new l.k("pitchstart",s))}_prepareElevation(s){this._elevationCenter=s,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(s){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const d=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(s<1&&d!==this._elevationTarget){const m=this._elevationTarget-this._elevationStart;this._elevationStart+=s*(m-(d-(m*s+this._elevationStart))/(1-s)),this._elevationTarget=d}this.transform.elevation=l.y.number(this._elevationStart,this._elevationTarget,s)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(s){const d=s.getCameraPosition(),m=this.terrain.getElevationForLngLatZoom(d.lngLat,s.zoom);if(d.altitude<m){const y=this.calculateCameraOptionsFromTo(d.lngLat,m,s.center,s.elevation);return{pitch:y.pitch,zoom:y.zoom}}return{}}_applyUpdatedTransform(s){const d=[];if(this.terrain&&d.push(y=>this._elevateCameraIfInsideTerrain(y)),this.transformCameraUpdate&&d.push(y=>this.transformCameraUpdate(y)),!d.length)return;const m=s.clone();for(const y of d){const x=m.clone(),{center:M,zoom:I,pitch:O,bearing:N,elevation:V}=y(x);M&&(x.center=M),I!==void 0&&(x.zoom=I),O!==void 0&&(x.pitch=O),N!==void 0&&(x.bearing=N),V!==void 0&&(x.elevation=V),m.apply(x)}this.transform.apply(m)}_fireMoveEvents(s){this.fire(new l.k("move",s)),this._zooming&&this.fire(new l.k("zoom",s)),this._rotating&&this.fire(new l.k("rotate",s)),this._pitching&&this.fire(new l.k("pitch",s))}_afterEase(s,d){if(this._easeId&&d&&this._easeId===d)return;delete this._easeId;const m=this._zooming,y=this._rotating,x=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,m&&this.fire(new l.k("zoomend",s)),y&&this.fire(new l.k("rotateend",s)),x&&this.fire(new l.k("pitchend",s)),this.fire(new l.k("moveend",s))}flyTo(s,d){var m;if(!s.essential&&E.prefersReducedMotion){const tt=l.M(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(tt,d)}this.stop(),s=l.e({offset:[0,0],speed:1.2,curve:1.42,easing:l.b9},s);const y=this._getTransformForUpdate(),x=y.zoom,M=y.bearing,I=y.pitch,O=y.padding,N="bearing"in s?this._normalizeBearing(s.bearing,M):M,V="pitch"in s?+s.pitch:I,F="padding"in s?s.padding:y.padding,G=l.P.convert(s.offset);let K=y.centerPoint.add(G);const Q=y.pointLocation(K),{center:re,zoom:ae}=y.getConstrained(l.N.convert(s.center||Q),(m=s.zoom)!==null&&m!==void 0?m:x);this._normalizeCenter(re,y);const ce=y.zoomScale(ae-x),he=y.project(Q),te=y.project(re).sub(he);let me=s.curve;const ge=Math.max(y.width,y.height),ve=ge/ce,ze=te.mag();if("minZoom"in s){const tt=l.ac(Math.min(s.minZoom,x,ae),y.minZoom,y.maxZoom),It=ge/y.zoomScale(tt-x);me=Math.sqrt(It/ze*2)}const Ve=me*me;function Je(tt){const It=(ve*ve-ge*ge+(tt?-1:1)*Ve*Ve*ze*ze)/(2*(tt?ve:ge)*Ve*ze);return Math.log(Math.sqrt(It*It+1)-It)}function it(tt){return(Math.exp(tt)-Math.exp(-tt))/2}function Ge(tt){return(Math.exp(tt)+Math.exp(-tt))/2}const qe=Je(!1);let mt=function(tt){return Ge(qe)/Ge(qe+me*tt)},Dt=function(tt){return ge*((Ge(qe)*(it(It=qe+me*tt)/Ge(It))-it(qe))/Ve)/ze;var It},Ye=(Je(!0)-qe)/me;if(Math.abs(ze)<1e-6||!isFinite(Ye)){if(Math.abs(ge-ve)<1e-6)return this.easeTo(s,d);const tt=ve<ge?-1:1;Ye=Math.abs(Math.log(ve/ge))/me,Dt=()=>0,mt=It=>Math.exp(tt*me*It)}return s.duration="duration"in s?+s.duration:1e3*Ye/("screenSpeed"in s?+s.screenSpeed/me:+s.speed),s.maxDuration&&s.duration>s.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=M!==N,this._pitching=V!==I,this._padding=!y.isPaddingEqual(F),this._prepareEase(d,!1),this.terrain&&this._prepareElevation(re),this._ease(tt=>{const It=tt*Ye,Fn=1/mt(It);y.zoom=tt===1?ae:x+y.scaleZoom(Fn),this._rotating&&(y.bearing=l.y.number(M,N,tt)),this._pitching&&(y.pitch=l.y.number(I,V,tt)),this._padding&&(y.interpolatePadding(O,F,tt),K=y.centerPoint.add(G)),this.terrain&&!s.freezeElevation&&this._updateElevation(tt);const Lt=tt===1?re:y.unproject(he.add(te.mult(Dt(It))).mult(Fn));y.setLocationAtPoint(y.renderWorldCopies?Lt.wrap():Lt,K),this._applyUpdatedTransform(y),this._fireMoveEvents(d)},()=>{this.terrain&&s.freezeElevation&&this._finalizeElevation(),this._afterEase(d)},s),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(s,d){var m;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const y=this._onEaseEnd;delete this._onEaseEnd,y.call(this,d)}return s||(m=this.handlers)===null||m===void 0||m.stop(!1),this}_ease(s,d,m){m.animate===!1||m.duration===0?(s(1),d()):(this._easeStart=E.now(),this._easeOptions=m,this._onEaseFrame=s,this._onEaseEnd=d,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(s,d){s=l.b3(s,-180,180);const m=Math.abs(s-d);return Math.abs(s-360-d)<m&&(s-=360),Math.abs(s+360-d)<m&&(s+=360),s}_normalizeCenter(s,d){if(!d.renderWorldCopies||d.lngRange)return;const m=s.lng-d.center.lng;s.lng+=m>180?-360:m<-180?360:0}queryTerrainElevation(s){return this.terrain?this.terrain.getElevationForLngLatZoom(l.N.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}const Wa={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Ga{constructor(s=Wa){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=d=>{!d||d.sourceDataType!=="metadata"&&d.sourceDataType!=="visibility"&&d.dataType!=="style"&&d.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=s}getDefaultPosition(){return"bottom-right"}onAdd(s){return this._map=s,this._compact=this.options.compact,this._container=C.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=C.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=C.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){C.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(s,d){const m=this._map._getUIString(`AttributionControl.${d}`);s.title=m,s.setAttribute("aria-label",m)}_updateAttributions(){if(!this._map.style)return;let s=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=s.concat(this.options.customAttribution.map(y=>typeof y!="string"?"":y)):typeof this.options.customAttribution=="string"&&s.push(this.options.customAttribution)),this._map.style.stylesheet){const y=this._map.style.stylesheet;this.styleOwner=y.owner,this.styleId=y.id}const d=this._map.style.sourceCaches;for(const y in d){const x=d[y];if(x.used||x.usedForTerrain){const M=x.getSource();M.attribution&&s.indexOf(M.attribution)<0&&s.push(M.attribution)}}s=s.filter(y=>String(y).trim()),s.sort((y,x)=>y.length-x.length),s=s.filter((y,x)=>{for(let M=x+1;M<s.length;M++)if(s[M].indexOf(y)>=0)return!1;return!0});const m=s.join(" | ");m!==this._attribHTML&&(this._attribHTML=m,s.length?(this._innerContainer.innerHTML=m,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Od{constructor(s={}){this._updateCompact=()=>{const d=this._container.children;if(d.length){const m=d[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&m.classList.add("maplibregl-compact"):m.classList.remove("maplibregl-compact")}},this.options=s}getDefaultPosition(){return"bottom-left"}onAdd(s){this._map=s,this._compact=this.options&&this.options.compact,this._container=C.create("div","maplibregl-ctrl");const d=C.create("a","maplibregl-ctrl-logo");return d.target="_blank",d.rel="noopener nofollow",d.href="https://maplibre.org/",d.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),d.setAttribute("rel","noopener nofollow"),this._container.appendChild(d),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){C.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class en{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(s){const d=++this._id;return this._queue.push({callback:s,id:d,cancelled:!1}),d}remove(s){const d=this._currentlyRunning,m=d?this._queue.concat(d):this._queue;for(const y of m)if(y.id===s)return void(y.cancelled=!0)}run(s=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const d=this._currentlyRunning=this._queue;this._queue=[];for(const m of d)if(!m.cancelled&&(m.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var zd=l.Y([{name:"a_pos3d",type:"Int16",components:3}]);class v_ extends l.E{constructor(s){super(),this.sourceCache=s,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,s.usedForTerrain=!0,s.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(s,d){this.sourceCache.update(s,d),this._renderableTilesKeys=[];const m={};for(const y of s.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:d}))m[y.key]=!0,this._renderableTilesKeys.push(y.key),this._tiles[y.key]||(y.posMatrix=new Float64Array(16),l.aP(y.posMatrix,0,l.X,0,l.X,0,1),this._tiles[y.key]=new Ts(y,this.tileSize));for(const y in this._tiles)m[y]||delete this._tiles[y]}freeRtt(s){for(const d in this._tiles){const m=this._tiles[d];(!s||m.tileID.equals(s)||m.tileID.isChildOf(s)||s.isChildOf(m.tileID))&&(m.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(s=>this.getTileByID(s))}getTileByID(s){return this._tiles[s]}getTerrainCoords(s){const d={};for(const m of this._renderableTilesKeys){const y=this._tiles[m].tileID;if(y.canonical.equals(s.canonical)){const x=s.clone();x.posMatrix=new Float64Array(16),l.aP(x.posMatrix,0,l.X,0,l.X,0,1),d[m]=x}else if(y.canonical.isChildOf(s.canonical)){const x=s.clone();x.posMatrix=new Float64Array(16);const M=y.canonical.z-s.canonical.z,I=y.canonical.x-(y.canonical.x>>M<<M),O=y.canonical.y-(y.canonical.y>>M<<M),N=l.X>>M;l.aP(x.posMatrix,0,N,0,N,0,1),l.J(x.posMatrix,x.posMatrix,[-I*N,-O*N,0]),d[m]=x}else if(s.canonical.isChildOf(y.canonical)){const x=s.clone();x.posMatrix=new Float64Array(16);const M=s.canonical.z-y.canonical.z,I=s.canonical.x-(s.canonical.x>>M<<M),O=s.canonical.y-(s.canonical.y>>M<<M),N=l.X>>M;l.aP(x.posMatrix,0,l.X,0,l.X,0,1),l.J(x.posMatrix,x.posMatrix,[I*N,O*N,0]),l.K(x.posMatrix,x.posMatrix,[1/2**M,1/2**M,0]),d[m]=x}}return d}getSourceTile(s,d){const m=this.sourceCache._source;let y=s.overscaledZ-this.deltaZoom;if(y>m.maxzoom&&(y=m.maxzoom),y<m.minzoom)return null;this._sourceTileCache[s.key]||(this._sourceTileCache[s.key]=s.scaledTo(y).key);let x=this.sourceCache.getTileByID(this._sourceTileCache[s.key]);if((!x||!x.dem)&&d)for(;y>=m.minzoom&&(!x||!x.dem);)x=this.sourceCache.getTileByID(s.scaledTo(y--).key);return x}tilesAfterTime(s=Date.now()){return Object.values(this._tiles).filter(d=>d.timeAdded>=s)}}class Bd{constructor(s,d,m){this.painter=s,this.sourceCache=new v_(d),this.options=m,this.exaggeration=typeof m.exaggeration=="number"?m.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(s,d,m,y=l.X){var x;if(!(d>=0&&d<y&&m>=0&&m<y))return 0;const M=this.getTerrainData(s),I=(x=M.tile)===null||x===void 0?void 0:x.dem;if(!I)return 0;const O=function(Q,re,ae){var ce=re[0],he=re[1];return Q[0]=ae[0]*ce+ae[4]*he+ae[12],Q[1]=ae[1]*ce+ae[5]*he+ae[13],Q}([],[d/y*l.X,m/y*l.X],M.u_terrain_matrix),N=[O[0]*I.dim,O[1]*I.dim],V=Math.floor(N[0]),F=Math.floor(N[1]),G=N[0]-V,K=N[1]-F;return I.get(V,F)*(1-G)*(1-K)+I.get(V+1,F)*G*(1-K)+I.get(V,F+1)*(1-G)*K+I.get(V+1,F+1)*G*K}getElevationForLngLatZoom(s,d){if(!l.bb(d,s.wrap()))return 0;const{tileID:m,mercatorX:y,mercatorY:x}=this._getOverscaledTileIDFromLngLatZoom(s,d);return this.getElevation(m,y%l.X,x%l.X,l.X)}getElevation(s,d,m,y=l.X){return this.getDEMElevation(s,d,m,y)*this.exaggeration}getTerrainData(s){if(!this._emptyDemTexture){const y=this.painter.context,x=new l.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new rt(y,x,y.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new rt(y,new l.R({width:1,height:1}),y.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(y.gl.NEAREST,y.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=l.an([])}const d=this.sourceCache.getSourceTile(s,!0);if(d&&d.dem&&(!d.demTexture||d.needsTerrainPrepare)){const y=this.painter.context;d.demTexture=this.painter.getTileTexture(d.dem.stride),d.demTexture?d.demTexture.update(d.dem.getPixels(),{premultiply:!1}):d.demTexture=new rt(y,d.dem.getPixels(),y.gl.RGBA,{premultiply:!1}),d.demTexture.bind(y.gl.NEAREST,y.gl.CLAMP_TO_EDGE),d.needsTerrainPrepare=!1}const m=d&&d+d.tileID.key+s.key;if(m&&!this._demMatrixCache[m]){const y=this.sourceCache.sourceCache._source.maxzoom;let x=s.canonical.z-d.tileID.canonical.z;s.overscaledZ>s.canonical.z&&(s.canonical.z>=y?x=s.canonical.z-y:l.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const M=s.canonical.x-(s.canonical.x>>x<<x),I=s.canonical.y-(s.canonical.y>>x<<x),O=l.bc(new Float64Array(16),[1/(l.X<<x),1/(l.X<<x),0]);l.J(O,O,[M*l.X,I*l.X,0]),this._demMatrixCache[s.key]={matrix:O,coord:s}}return{u_depth:2,u_terrain:3,u_terrain_dim:d&&d.dem&&d.dem.dim||1,u_terrain_matrix:m?this._demMatrixCache[s.key].matrix:this._emptyDemMatrix,u_terrain_unpack:d&&d.dem&&d.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(d&&d.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:d}}getFramebuffer(s){const d=this.painter,m=d.width/devicePixelRatio,y=d.height/devicePixelRatio;return!this._fbo||this._fbo.width===m&&this._fbo.height===y||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new rt(d.context,{width:m,height:y,data:null},d.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(d.context.gl.NEAREST,d.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new rt(d.context,{width:m,height:y,data:null},d.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(d.context.gl.NEAREST,d.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=d.context.createFramebuffer(m,y,!0,!1),this._fbo.depthAttachment.set(d.context.createRenderbuffer(d.context.gl.DEPTH_COMPONENT16,m,y))),this._fbo.colorAttachment.set(s==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const s=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const d=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let x=0,M=0;x<this._coordsTextureSize;x++)for(let I=0;I<this._coordsTextureSize;I++,M+=4)d[M+0]=255&I,d[M+1]=255&x,d[M+2]=I>>8<<4|x>>8,d[M+3]=0;const m=new l.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(d.buffer)),y=new rt(s,m,s.gl.RGBA,{premultiply:!1});return y.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._coordsTexture=y,y}pointCoordinate(s){this.painter.maybeDrawDepthAndCoords(!0);const d=new Uint8Array(4),m=this.painter.context,y=m.gl,x=Math.round(s.x*this.painter.pixelRatio/devicePixelRatio),M=Math.round(s.y*this.painter.pixelRatio/devicePixelRatio),I=Math.round(this.painter.height/devicePixelRatio);m.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),y.readPixels(x,I-M-1,1,1,y.RGBA,y.UNSIGNED_BYTE,d),m.bindFramebuffer.set(null);const O=d[0]+(d[2]>>4<<8),N=d[1]+((15&d[2])<<8),V=this.coordsIndex[255-d[3]],F=V&&this.sourceCache.getTileByID(V);if(!F)return null;const G=this._coordsTextureSize,K=(1<<F.tileID.canonical.z)*G;return new l.Z((F.tileID.canonical.x*G+O)/K+F.tileID.wrap,(F.tileID.canonical.y*G+N)/K,this.getElevation(F.tileID,O,N,G))}depthAtPoint(s){const d=new Uint8Array(4),m=this.painter.context,y=m.gl;return m.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),y.readPixels(s.x,this.painter.height/devicePixelRatio-s.y-1,1,1,y.RGBA,y.UNSIGNED_BYTE,d),m.bindFramebuffer.set(null),(d[0]/16777216+d[1]/65536+d[2]/256+d[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const s=this.painter.context,d=new l.bd,m=new l.aY,y=this.meshSize,x=l.X/y,M=y*y;for(let F=0;F<=y;F++)for(let G=0;G<=y;G++)d.emplaceBack(G*x,F*x,0);for(let F=0;F<M;F+=y+1)for(let G=0;G<y;G++)m.emplaceBack(G+F,y+G+F+1,y+G+F+2),m.emplaceBack(G+F,y+G+F+2,G+F+1);const I=d.length,O=I+2*(y+1);for(const F of[0,1])for(let G=0;G<=y;G++)for(const K of[0,1])d.emplaceBack(G*x,F*l.X,K);for(let F=0;F<2*y;F+=2)m.emplaceBack(O+F,O+F+1,O+F+3),m.emplaceBack(O+F,O+F+3,O+F+2),m.emplaceBack(I+F,I+F+3,I+F+1),m.emplaceBack(I+F,I+F+2,I+F+3);const N=d.length,V=N+2*(y+1);for(const F of[0,1])for(let G=0;G<=y;G++)for(const K of[0,1])d.emplaceBack(F*l.X,G*x,K);for(let F=0;F<2*y;F+=2)m.emplaceBack(N+F,N+F+1,N+F+3),m.emplaceBack(N+F,N+F+3,N+F+2),m.emplaceBack(V+F,V+F+3,V+F+1),m.emplaceBack(V+F,V+F+2,V+F+3);return this._mesh=new yu(s.createVertexBuffer(d,zd.members),s.createIndexBuffer(m),l.a0.simpleSegment(0,0,d.length,m.length)),this._mesh}getMeshFrameDelta(s){return 2*Math.PI*l.be/Math.pow(2,s)/5}getMinTileElevationForLngLatZoom(s,d){var m;const{tileID:y}=this._getOverscaledTileIDFromLngLatZoom(s,d);return(m=this.getMinMaxElevation(y).minElevation)!==null&&m!==void 0?m:0}getMinMaxElevation(s){const d=this.getTerrainData(s).tile,m={minElevation:null,maxElevation:null};return d&&d.dem&&(m.minElevation=d.dem.min*this.exaggeration,m.maxElevation=d.dem.max*this.exaggeration),m}_getOverscaledTileIDFromLngLatZoom(s,d){const m=l.Z.fromLngLat(s.wrap()),y=(1<<d)*l.X,x=m.x*y,M=m.y*y,I=Math.floor(x/l.X),O=Math.floor(M/l.X);return{tileID:new l.S(d,0,d,I,O),mercatorX:x,mercatorY:M}}}class w_{constructor(s,d,m){this._context=s,this._size=d,this._tileSize=m,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const s of this._objects)s.texture.destroy(),s.fbo.destroy()}_createObject(s){const d=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),m=new rt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return m.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),d.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),d.colorAttachment.set(m.texture),{id:s,fbo:d,texture:m,stamp:-1,inUse:!1}}getObjectForId(s){return this._objects[s]}useObject(s){s.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(d=>s.id!==d),this._recentlyUsed.push(s.id)}stampObject(s){s.stamp=++this._stamp}getOrCreateFreeObject(){for(const d of this._recentlyUsed)if(!this._objects[d].inUse)return this._objects[d];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const s=this._createObject(this._objects.length);return this._objects.push(s),s}freeObject(s){s.inUse=!1}freeAllObjects(){for(const s of this._objects)this.freeObject(s)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(s=>!s.inUse)===!1}}const Za={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Tm{constructor(s,d){this.painter=s,this.terrain=d,this.pool=new w_(s.context,30,d.sourceCache.tileSize*d.qualityFactor)}destruct(){this.pool.destruct()}getTexture(s){return this.pool.getObjectForId(s.rtt[this._stacks.length-1].id).texture}prepareForRender(s,d){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=s._order.filter(m=>!s._layers[m].isHidden(d)),this._coordsDescendingInv={};for(const m in s.sourceCaches){this._coordsDescendingInv[m]={};const y=s.sourceCaches[m].getVisibleCoordinates();for(const x of y){const M=this.terrain.sourceCache.getTerrainCoords(x);for(const I in M)this._coordsDescendingInv[m][I]||(this._coordsDescendingInv[m][I]=[]),this._coordsDescendingInv[m][I].push(M[I])}}this._coordsDescendingInvStr={};for(const m of s._order){const y=s._layers[m],x=y.source;if(Za[y.type]&&!this._coordsDescendingInvStr[x]){this._coordsDescendingInvStr[x]={};for(const M in this._coordsDescendingInv[x])this._coordsDescendingInvStr[x][M]=this._coordsDescendingInv[x][M].map(I=>I.key).sort().join()}}for(const m of this._renderableTiles)for(const y in this._coordsDescendingInvStr){const x=this._coordsDescendingInvStr[y][m.tileID.key];x&&x!==m.rttCoords[y]&&(m.rtt=[])}}renderLayer(s){if(s.isHidden(this.painter.transform.zoom))return!1;const d=s.type,m=this.painter,y=this._renderableLayerIds[this._renderableLayerIds.length-1]===s.id;if(Za[d]&&(this._prevType&&Za[this._prevType]||this._stacks.push([]),this._prevType=d,this._stacks[this._stacks.length-1].push(s.id),!y))return!0;if(Za[this._prevType]||Za[d]&&y){this._prevType=d;const x=this._stacks.length-1,M=this._stacks[x]||[];for(const I of this._renderableTiles){if(this.pool.isFull()&&(bm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(I),I.rtt[x]){const N=this.pool.getObjectForId(I.rtt[x].id);if(N.stamp===I.rtt[x].stamp){this.pool.useObject(N);continue}}const O=this.pool.getOrCreateFreeObject();this.pool.useObject(O),this.pool.stampObject(O),I.rtt[x]={id:O.id,stamp:O.stamp},m.context.bindFramebuffer.set(O.fbo.framebuffer),m.context.clear({color:l.aM.transparent,stencil:0}),m.currentStencilSource=void 0;for(let N=0;N<M.length;N++){const V=m.style._layers[M[N]],F=V.source?this._coordsDescendingInv[V.source][I.tileID.key]:[I.tileID];m.context.viewport.set([0,0,O.fbo.width,O.fbo.height]),m._renderTileClippingMasks(V,F),m.renderLayer(m,m.style.sourceCaches[V.source],V,F),V.source&&(I.rttCoords[V.source]=this._coordsDescendingInvStr[V.source][I.tileID.key])}}return bm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Za[d]}return!1}}const Nd={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},Mm=g,k_={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Wa,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,refreshExpiredTiles:!0,scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],zoom:0,bearing:0,pitch:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:l.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0},Rd=v=>{v.touchstart=v.dragStart,v.touchmoveWindow=v.dragMove,v.touchend=v.dragEnd},S_={showCompass:!0,showZoom:!0,visualizePitch:!1};class E_{constructor(s,d,m=!1){this.mousedown=M=>{this.startMouse(l.e({},M,{ctrlKey:!0,preventDefault:()=>M.preventDefault()}),C.mousePos(this.element,M)),C.addEventListener(window,"mousemove",this.mousemove),C.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=M=>{this.moveMouse(M,C.mousePos(this.element,M))},this.mouseup=M=>{this.mouseRotate.dragEnd(M),this.mousePitch&&this.mousePitch.dragEnd(M),this.offTemp()},this.touchstart=M=>{M.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=C.touchPos(this.element,M.targetTouches)[0],this.startTouch(M,this._startPos),C.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.addEventListener(window,"touchend",this.touchend))},this.touchmove=M=>{M.targetTouches.length!==1?this.reset():(this._lastPos=C.touchPos(this.element,M.targetTouches)[0],this.moveTouch(M,this._lastPos))},this.touchend=M=>{M.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const y=s.dragRotate._mouseRotate.getClickTolerance(),x=s.dragRotate._mousePitch.getClickTolerance();this.element=d,this.mouseRotate=Sd({clickTolerance:y,enable:!0}),this.touchRotate=(({enable:M,clickTolerance:I,bearingDegreesPerPixelMoved:O=.8})=>{const N=new kd;return new qs({clickTolerance:I,move:(V,F)=>({bearingDelta:(F.x-V.x)*O}),moveStateManager:N,enable:M,assignEvents:Rd})})({clickTolerance:y,enable:!0}),this.map=s,m&&(this.mousePitch=Ed({clickTolerance:x,enable:!0}),this.touchPitch=(({enable:M,clickTolerance:I,pitchDegreesPerPixelMoved:O=-.5})=>{const N=new kd;return new qs({clickTolerance:I,move:(V,F)=>({pitchDelta:(F.y-V.y)*O}),moveStateManager:N,enable:M,assignEvents:Rd})})({clickTolerance:x,enable:!0})),C.addEventListener(d,"mousedown",this.mousedown),C.addEventListener(d,"touchstart",this.touchstart,{passive:!1}),C.addEventListener(d,"touchcancel",this.reset)}startMouse(s,d){this.mouseRotate.dragStart(s,d),this.mousePitch&&this.mousePitch.dragStart(s,d),C.disableDrag()}startTouch(s,d){this.touchRotate.dragStart(s,d),this.touchPitch&&this.touchPitch.dragStart(s,d),C.disableDrag()}moveMouse(s,d){const m=this.map,{bearingDelta:y}=this.mouseRotate.dragMove(s,d)||{};if(y&&m.setBearing(m.getBearing()+y),this.mousePitch){const{pitchDelta:x}=this.mousePitch.dragMove(s,d)||{};x&&m.setPitch(m.getPitch()+x)}}moveTouch(s,d){const m=this.map,{bearingDelta:y}=this.touchRotate.dragMove(s,d)||{};if(y&&m.setBearing(m.getBearing()+y),this.touchPitch){const{pitchDelta:x}=this.touchPitch.dragMove(s,d)||{};x&&m.setPitch(m.getPitch()+x)}}off(){const s=this.element;C.removeEventListener(s,"mousedown",this.mousedown),C.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),C.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.removeEventListener(window,"touchend",this.touchend),C.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){C.enableDrag(),C.removeEventListener(window,"mousemove",this.mousemove),C.removeEventListener(window,"mouseup",this.mouseup),C.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.removeEventListener(window,"touchend",this.touchend)}}let br;function Vn(v,s,d){const m=new l.N(v.lng,v.lat);if(v=new l.N(v.lng,v.lat),s){const y=new l.N(v.lng-360,v.lat),x=new l.N(v.lng+360,v.lat),M=d.locationPoint(v).distSqr(s);d.locationPoint(y).distSqr(s)<M?v=y:d.locationPoint(x).distSqr(s)<M&&(v=x)}for(;Math.abs(v.lng-d.center.lng)>180;){const y=d.locationPoint(v);if(y.x>=0&&y.y>=0&&y.x<=d.width&&y.y<=d.height)break;v.lng>d.center.lng?v.lng-=360:v.lng+=360}return v.lng!==m.lng&&d.locationPoint(v).y>d.height/2-d.getHorizon()?v:m}const Ya={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Mu(v,s,d){const m=v.classList;for(const y in Ya)m.remove(`maplibregl-${d}-anchor-${y}`);m.add(`maplibregl-${d}-anchor-${s}`)}class Au extends l.E{constructor(s){if(super(),this._onKeyPress=d=>{const m=d.code,y=d.charCode||d.keyCode;m!=="Space"&&m!=="Enter"&&y!==32&&y!==13||this.togglePopup()},this._onMapClick=d=>{const m=d.originalEvent.target,y=this._element;this._popup&&(m===y||y.contains(m))&&this.togglePopup()},this._update=d=>{var m;if(!this._map)return;const y=this._map.loaded()&&!this._map.isMoving();((d==null?void 0:d.type)==="terrain"||(d==null?void 0:d.type)==="render"&&!y)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Vn(this._lngLat,this._flatPos,this._map.transform):(m=this._lngLat)===null||m===void 0?void 0:m.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let x="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?x=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(x=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let M="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?M="rotateX(0deg)":this._pitchAlignment==="map"&&(M=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||d&&d.type!=="moveend"||(this._pos=this._pos.round()),C.setTransform(this._element,`${Ya[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${M} ${x}`),E.frameAsync(new AbortController).then(()=>{this._updateOpacity(d&&d.type==="moveend")}).catch(()=>{})},this._onMove=d=>{if(!this._isDragging){const m=this._clickTolerance||this._map._clickTolerance;this._isDragging=d.point.dist(this._pointerdownPos)>=m}this._isDragging&&(this._pos=d.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new l.k("dragstart"))),this.fire(new l.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new l.k("dragend")),this._state="inactive"},this._addDragHandler=d=>{this._element.contains(d.originalEvent.target)&&(d.preventDefault(),this._positionDelta=d.point.sub(this._pos).add(this._offset),this._pointerdownPos=d.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=s&&s.anchor||"center",this._color=s&&s.color||"#3FB1CE",this._scale=s&&s.scale||1,this._draggable=s&&s.draggable||!1,this._clickTolerance=s&&s.clickTolerance||0,this._subpixelPositioning=s&&s.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=s&&s.rotation||0,this._rotationAlignment=s&&s.rotationAlignment||"auto",this._pitchAlignment=s&&s.pitchAlignment&&s.pitchAlignment!=="auto"?s.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(s==null?void 0:s.opacity,s==null?void 0:s.opacityWhenCovered),s&&s.element)this._element=s.element,this._offset=l.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=C.create("div");const d=C.createNS("http://www.w3.org/2000/svg","svg"),m=41,y=27;d.setAttributeNS(null,"display","block"),d.setAttributeNS(null,"height",`${m}px`),d.setAttributeNS(null,"width",`${y}px`),d.setAttributeNS(null,"viewBox",`0 0 ${y} ${m}`);const x=C.createNS("http://www.w3.org/2000/svg","g");x.setAttributeNS(null,"stroke","none"),x.setAttributeNS(null,"stroke-width","1"),x.setAttributeNS(null,"fill","none"),x.setAttributeNS(null,"fill-rule","evenodd");const M=C.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"fill-rule","nonzero");const I=C.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"transform","translate(3.0, 29.0)"),I.setAttributeNS(null,"fill","#000000");const O=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const ce of O){const he=C.createNS("http://www.w3.org/2000/svg","ellipse");he.setAttributeNS(null,"opacity","0.04"),he.setAttributeNS(null,"cx","10.5"),he.setAttributeNS(null,"cy","5.80029008"),he.setAttributeNS(null,"rx",ce.rx),he.setAttributeNS(null,"ry",ce.ry),I.appendChild(he)}const N=C.createNS("http://www.w3.org/2000/svg","g");N.setAttributeNS(null,"fill",this._color);const V=C.createNS("http://www.w3.org/2000/svg","path");V.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),N.appendChild(V);const F=C.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"fill","#000000");const G=C.createNS("http://www.w3.org/2000/svg","path");G.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),F.appendChild(G);const K=C.createNS("http://www.w3.org/2000/svg","g");K.setAttributeNS(null,"transform","translate(6.0, 7.0)"),K.setAttributeNS(null,"fill","#FFFFFF");const Q=C.createNS("http://www.w3.org/2000/svg","g");Q.setAttributeNS(null,"transform","translate(8.0, 8.0)");const re=C.createNS("http://www.w3.org/2000/svg","circle");re.setAttributeNS(null,"fill","#000000"),re.setAttributeNS(null,"opacity","0.25"),re.setAttributeNS(null,"cx","5.5"),re.setAttributeNS(null,"cy","5.5"),re.setAttributeNS(null,"r","5.4999962");const ae=C.createNS("http://www.w3.org/2000/svg","circle");ae.setAttributeNS(null,"fill","#FFFFFF"),ae.setAttributeNS(null,"cx","5.5"),ae.setAttributeNS(null,"cy","5.5"),ae.setAttributeNS(null,"r","5.4999962"),Q.appendChild(re),Q.appendChild(ae),M.appendChild(I),M.appendChild(N),M.appendChild(F),M.appendChild(K),M.appendChild(Q),d.appendChild(M),d.setAttributeNS(null,"height",m*this._scale+"px"),d.setAttributeNS(null,"width",y*this._scale+"px"),this._element.appendChild(d),this._offset=l.P.convert(s&&s.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",d=>{d.preventDefault()}),this._element.addEventListener("mousedown",d=>{d.preventDefault()}),Mu(this._element,this._anchor,"marker"),s&&s.className)for(const d of s.className.split(" "))this._element.classList.add(d);this._popup=null}addTo(s){return this.remove(),this._map=s,this._element.setAttribute("aria-label",s._getUIString("Marker.Title")),s.getCanvasContainer().appendChild(this._element),s.on("move",this._update),s.on("moveend",this._update),s.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),C.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=l.N.convert(s),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(s){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),s){if(!("offset"in s.options)){const y=Math.abs(13.5)/Math.SQRT2;s.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[y,-1*(38.1-13.5+y)],"bottom-right":[-y,-1*(38.1-13.5+y)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(s){return this._subpixelPositioning=s,this}getPopup(){return this._popup}togglePopup(){const s=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:s?(s.isOpen()?s.remove():(s.setLngLat(this._lngLat),s.addTo(this._map)),this):this}_updateOpacity(s=!1){var d,m;if(!(!((d=this._map)===null||d===void 0)&&d.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(s)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const y=this._map,x=y.terrain.depthAtPoint(this._pos),M=y.terrain.getElevationForLngLatZoom(this._lngLat,y.transform.tileZoom);if(y.transform.lngLatToCameraDepth(this._lngLat,M)-x<.006)return void(this._element.style.opacity=this._opacity);const I=-this._offset.y/y.transform._pixelPerMeter,O=Math.sin(y.getPitch()*Math.PI/180)*I,N=y.terrain.depthAtPoint(new l.P(this._pos.x,this._pos.y-this._offset.y)),V=y.transform.lngLatToCameraDepth(this._lngLat,M+O)-N>.006;!((m=this._popup)===null||m===void 0)&&m.isOpen()&&V&&this._popup.remove(),this._element.style.opacity=V?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(s){return this._offset=l.P.convert(s),this._update(),this}addClassName(s){this._element.classList.add(s)}removeClassName(s){this._element.classList.remove(s)}toggleClassName(s){return this._element.classList.toggle(s)}setDraggable(s){return this._draggable=!!s,this._map&&(s?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(s){return this._rotation=s||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(s){return this._rotationAlignment=s||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(s){return this._pitchAlignment=s&&s!=="auto"?s:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(s,d){return s===void 0&&d===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),s!==void 0&&(this._opacity=s),d!==void 0&&(this._opacityWhenCovered=d),this._map&&this._updateOpacity(!0),this}}const Am={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ql=0,ec=!1;const Is={maxWidth:100,unit:"metric"};function tc(v,s,d){const m=d&&d.maxWidth||100,y=v._container.clientHeight/2,x=v.unproject([0,y]),M=v.unproject([m,y]),I=x.distanceTo(M);if(d&&d.unit==="imperial"){const O=3.2808*I;O>5280?ft(s,m,O/5280,v._getUIString("ScaleControl.Miles")):ft(s,m,O,v._getUIString("ScaleControl.Feet"))}else d&&d.unit==="nautical"?ft(s,m,I/1852,v._getUIString("ScaleControl.NauticalMiles")):I>=1e3?ft(s,m,I/1e3,v._getUIString("ScaleControl.Kilometers")):ft(s,m,I,v._getUIString("ScaleControl.Meters"))}function ft(v,s,d,m){const y=function(x){const M=Math.pow(10,`${Math.floor(x)}`.length-1);let I=x/M;return I=I>=10?10:I>=5?5:I>=3?3:I>=2?2:I>=1?1:function(O){const N=Math.pow(10,Math.ceil(-Math.log(O)/Math.LN10));return Math.round(O*N)/N}(I),M*I}(d);v.style.width=s*(y/d)+"px",v.innerHTML=`${y} ${m}`}const Et={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Iu=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Pu(v){if(v){if(typeof v=="number"){const s=Math.round(Math.abs(v)/Math.SQRT2);return{center:new l.P(0,0),top:new l.P(0,v),"top-left":new l.P(s,s),"top-right":new l.P(-s,s),bottom:new l.P(0,-v),"bottom-left":new l.P(s,-s),"bottom-right":new l.P(-s,-s),left:new l.P(v,0),right:new l.P(-v,0)}}if(v instanceof l.P||Array.isArray(v)){const s=l.P.convert(v);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}return{center:l.P.convert(v.center||[0,0]),top:l.P.convert(v.top||[0,0]),"top-left":l.P.convert(v["top-left"]||[0,0]),"top-right":l.P.convert(v["top-right"]||[0,0]),bottom:l.P.convert(v.bottom||[0,0]),"bottom-left":l.P.convert(v["bottom-left"]||[0,0]),"bottom-right":l.P.convert(v["bottom-right"]||[0,0]),left:l.P.convert(v.left||[0,0]),right:l.P.convert(v.right||[0,0])}}return Pu(new l.P(0,0))}const Ld=g;u.AJAXError=l.bh,u.Evented=l.E,u.LngLat=l.N,u.MercatorCoordinate=l.Z,u.Point=l.P,u.addProtocol=l.bi,u.config=l.a,u.removeProtocol=l.bj,u.AttributionControl=Ga,u.BoxZoomHandler=_r,u.CanvasSource=xi,u.CooperativeGesturesHandler=qa,u.DoubleClickZoomHandler=Ko,u.DragPanHandler=Sm,u.DragRotateHandler=Em,u.EdgeInsets=$a,u.FullscreenControl=class extends l.E{constructor(v={}){super(),this._onFullscreenChange=()=>{var s;let d=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((s=d==null?void 0:d.shadowRoot)===null||s===void 0)&&s.fullscreenElement;)d=d.shadowRoot.fullscreenElement;d===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,v&&v.container&&(v.container instanceof HTMLElement?this._container=v.container:l.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(v){return this._map=v,this._container||(this._container=this._map.getContainer()),this._controlContainer=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){C.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const v=this._fullscreenButton=C.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);C.create("span","maplibregl-ctrl-icon",v).setAttribute("aria-hidden","true"),v.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const v=this._getTitle();this._fullscreenButton.setAttribute("aria-label",v),this._fullscreenButton.title=v}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new l.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new l.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},u.GeoJSONSource=Ui,u.GeolocateControl=class extends l.E{constructor(v){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new l.k("outofmaxbounds",s)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=s,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(s),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(s),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new l.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{const d=new l.N(s.coords.longitude,s.coords.latitude),m=s.coords.accuracy,y=this._map.getBearing(),x=l.e({bearing:y},this.options.fitBoundsOptions),M=we.fromLngLat(d,m);this._map.fitBounds(M,x,{geolocateSource:!0})},this._updateMarker=s=>{if(s){const d=new l.N(s.coords.longitude,s.coords.latitude);this._accuracyCircleMarker.setLngLat(d).addTo(this._map),this._userLocationDotMarker.setLngLat(d).addTo(this._map),this._accuracy=s.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=s=>{if(this._map){if(this.options.trackUserLocation)if(s.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=d,this._geolocateButton.setAttribute("aria-label",d),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(s.code===3&&ec)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new l.k("error",s)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",s=>s.preventDefault()),this._geolocateButton=C.create("button","maplibregl-ctrl-geolocate",this._container),C.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=s=>{if(this._map){if(s===!1){l.w("Geolocation support is not available so the GeolocateControl will be disabled.");const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=d,this._geolocateButton.setAttribute("aria-label",d)}else{const d=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=d,this._geolocateButton.setAttribute("aria-label",d)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=C.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Au({element:this._dotElement}),this._circleElement=C.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Au({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",d=>{d.geolocateSource||this._watchState!=="ACTIVE_LOCK"||d.originalEvent&&d.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new l.k("trackuserlocationend")),this.fire(new l.k("userlocationlostfocus")))})}},this.options=l.e({},Am,v)}onAdd(v){return this._map=v,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return l._(this,arguments,void 0,function*(s=!1){if(br!==void 0&&!s)return br;if(window.navigator.permissions===void 0)return br=!!window.navigator.geolocation,br;try{br=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{br=!!window.navigator.geolocation}return br})}().then(s=>this._finishSetupUI(s)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),C.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Ql=0,ec=!1}_isOutOfMapMaxBounds(v){const s=this._map.getMaxBounds(),d=v.coords;return s&&(d.longitude<s.getWest()||d.longitude>s.getEast()||d.latitude<s.getSouth()||d.latitude>s.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const v=this._map.getBounds(),s=v.getSouthEast(),d=v.getNorthEast(),m=s.distanceTo(d),y=Math.ceil(this._accuracy/(m/this._map._container.clientHeight)*2);this._circleElement.style.width=`${y}px`,this._circleElement.style.height=`${y}px`}trigger(){if(!this._setup)return l.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new l.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ql--,ec=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new l.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new l.k("trackuserlocationstart")),this.fire(new l.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let v;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Ql++,Ql>1?(v={maximumAge:6e5,timeout:0},ec=!0):(v=this.options.positionOptions,ec=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,v)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},u.Hash=bu,u.ImageSource=bi,u.KeyboardHandler=Lr,u.LngLatBounds=we,u.LogoControl=Od,u.Map=class extends Cm{constructor(v){l.bf.mark(l.bg.create);const s=Object.assign(Object.assign({},k_),v);if(s.minZoom!=null&&s.maxZoom!=null&&s.minZoom>s.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(s.minPitch!=null&&s.maxPitch!=null&&s.minPitch>s.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(s.minPitch!=null&&s.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(s.maxPitch!=null&&s.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ja(s.minZoom,s.maxZoom,s.minPitch,s.maxPitch,s.renderWorldCopies),{bearingSnap:s.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new en,this._controls=[],this._mapId=l.a4(),this._contextLost=d=>{d.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new l.k("webglcontextlost",{originalEvent:d}))},this._contextRestored=d=>{this._setupPainter(),this.resize(),this._update(),this.fire(new l.k("webglcontextrestored",{originalEvent:d}))},this._onMapScroll=d=>{if(d.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=s.interactive,this._maxTileCacheSize=s.maxTileCacheSize,this._maxTileCacheZoomLevels=s.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=s.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=s.preserveDrawingBuffer===!0,this._antialias=s.antialias===!0,this._trackResize=s.trackResize===!0,this._bearingSnap=s.bearingSnap,this._refreshExpiredTiles=s.refreshExpiredTiles===!0,this._fadeDuration=s.fadeDuration,this._crossSourceCollisions=s.crossSourceCollisions===!0,this._collectResourceTiming=s.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Nd),s.locale),this._clickTolerance=s.clickTolerance,this._overridePixelRatio=s.pixelRatio,this._maxCanvasSize=s.maxCanvasSize,this.transformCameraUpdate=s.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=s.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=le.addThrottleControl(()=>this.isMoving()),this._requestManager=new J(s.transformRequest),typeof s.container=="string"){if(this._container=document.getElementById(s.container),!this._container)throw new Error(`Container '${s.container}' not found.`)}else{if(!(s.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=s.container}if(s.maxBounds&&this.setMaxBounds(s.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let d=!1;const m=Zl(y=>{this._trackResize&&!this._removed&&(this.resize(y),this.redraw())},50);this._resizeObserver=new ResizeObserver(y=>{d?m(y):d=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Dd(this,s),this._hash=s.hash&&new bu(typeof s.hash=="string"&&s.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:s.center,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch}),s.bounds&&(this.resize(),this.fitBounds(s.bounds,l.e({},s.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=s.localIdeographFontFamily,this._validateStyle=s.validateStyle,s.style&&this.setStyle(s.style,{localIdeographFontFamily:s.localIdeographFontFamily}),s.attributionControl&&this.addControl(new Ga(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new Od,s.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",d=>{this._update(d.dataType==="style"),this.fire(new l.k(`${d.dataType}data`,d))}),this.on("dataloading",d=>{this.fire(new l.k(`${d.dataType}dataloading`,d))}),this.on("dataabort",d=>{this.fire(new l.k("sourcedataabort",d))})}_getMapId(){return this._mapId}addControl(v,s){if(s===void 0&&(s=v.getDefaultPosition?v.getDefaultPosition():"top-right"),!v||!v.onAdd)return this.fire(new l.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const d=v.onAdd(this);this._controls.push(v);const m=this._controlPositions[s];return s.indexOf("bottom")!==-1?m.insertBefore(d,m.firstChild):m.appendChild(d),this}removeControl(v){if(!v||!v.onRemove)return this.fire(new l.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(v);return s>-1&&this._controls.splice(s,1),v.onRemove(this),this}hasControl(v){return this._controls.indexOf(v)>-1}calculateCameraOptionsFromTo(v,s,d,m){return m==null&&this.terrain&&(m=this.terrain.getElevationForLngLatZoom(d,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(v,s,d,m)}resize(v){var s;const d=this._containerDimensions(),m=d[0],y=d[1],x=this._getClampedPixelRatio(m,y);if(this._resizeCanvas(m,y,x),this.painter.resize(m,y,x),this.painter.overLimit()){const I=this.painter.context.gl;this._maxCanvasSize=[I.drawingBufferWidth,I.drawingBufferHeight];const O=this._getClampedPixelRatio(m,y);this._resizeCanvas(m,y,O),this.painter.resize(m,y,O)}this.transform.resize(m,y),(s=this._requestedCameraState)===null||s===void 0||s.resize(m,y);const M=!this._moving;return M&&(this.stop(),this.fire(new l.k("movestart",v)).fire(new l.k("move",v))),this.fire(new l.k("resize",v)),M&&this.fire(new l.k("moveend",v)),this}_getClampedPixelRatio(v,s){const{0:d,1:m}=this._maxCanvasSize,y=this.getPixelRatio(),x=v*y,M=s*y;return Math.min(x>d?d/x:1,M>m?m/M:1)*y}getPixelRatio(){var v;return(v=this._overridePixelRatio)!==null&&v!==void 0?v:devicePixelRatio}setPixelRatio(v){this._overridePixelRatio=v,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(v){return this.transform.setMaxBounds(we.convert(v)),this._update()}setMinZoom(v){if((v=v??-2)>=-2&&v<=this.transform.maxZoom)return this.transform.minZoom=v,this._update(),this.getZoom()<v&&this.setZoom(v),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(v){if((v=v??22)>=this.transform.minZoom)return this.transform.maxZoom=v,this._update(),this.getZoom()>v&&this.setZoom(v),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(v){if((v=v??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(v>=0&&v<=this.transform.maxPitch)return this.transform.minPitch=v,this._update(),this.getPitch()<v&&this.setPitch(v),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(v){if((v=v??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(v>=this.transform.minPitch)return this.transform.maxPitch=v,this._update(),this.getPitch()>v&&this.setPitch(v),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(v){return this.transform.renderWorldCopies=v,this._update()}project(v){return this.transform.locationPoint(l.N.convert(v),this.style&&this.terrain)}unproject(v){return this.transform.pointLocation(l.P.convert(v),this.terrain)}isMoving(){var v;return this._moving||((v=this.handlers)===null||v===void 0?void 0:v.isMoving())}isZooming(){var v;return this._zooming||((v=this.handlers)===null||v===void 0?void 0:v.isZooming())}isRotating(){var v;return this._rotating||((v=this.handlers)===null||v===void 0?void 0:v.isRotating())}_createDelegatedListener(v,s,d){if(v==="mouseenter"||v==="mouseover"){let m=!1;return{layers:s,listener:d,delegates:{mousemove:x=>{const M=s.filter(O=>this.getLayer(O)),I=M.length!==0?this.queryRenderedFeatures(x.point,{layers:M}):[];I.length?m||(m=!0,d.call(this,new Pi(v,this,x.originalEvent,{features:I}))):m=!1},mouseout:()=>{m=!1}}}}if(v==="mouseleave"||v==="mouseout"){let m=!1;return{layers:s,listener:d,delegates:{mousemove:M=>{const I=s.filter(O=>this.getLayer(O));(I.length!==0?this.queryRenderedFeatures(M.point,{layers:I}):[]).length?m=!0:m&&(m=!1,d.call(this,new Pi(v,this,M.originalEvent)))},mouseout:M=>{m&&(m=!1,d.call(this,new Pi(v,this,M.originalEvent)))}}}}{const m=y=>{const x=s.filter(I=>this.getLayer(I)),M=x.length!==0?this.queryRenderedFeatures(y.point,{layers:x}):[];M.length&&(y.features=M,d.call(this,y),delete y.features)};return{layers:s,listener:d,delegates:{[v]:m}}}}_saveDelegatedListener(v,s){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[v]=this._delegatedListeners[v]||[],this._delegatedListeners[v].push(s)}_removeDelegatedListener(v,s,d){if(!this._delegatedListeners||!this._delegatedListeners[v])return;const m=this._delegatedListeners[v];for(let y=0;y<m.length;y++){const x=m[y];if(x.listener===d&&x.layers.length===s.length&&x.layers.every(M=>s.includes(M))){for(const M in x.delegates)this.off(M,x.delegates[M]);return void m.splice(y,1)}}}on(v,s,d){if(d===void 0)return super.on(v,s);const m=this._createDelegatedListener(v,typeof s=="string"?[s]:s,d);this._saveDelegatedListener(v,m);for(const y in m.delegates)this.on(y,m.delegates[y]);return this}once(v,s,d){if(d===void 0)return super.once(v,s);const m=typeof s=="string"?[s]:s,y=this._createDelegatedListener(v,m,d);for(const x in y.delegates){const M=y.delegates[x];y.delegates[x]=(...I)=>{this._removeDelegatedListener(v,m,d),M(...I)}}this._saveDelegatedListener(v,y);for(const x in y.delegates)this.once(x,y.delegates[x]);return this}off(v,s,d){return d===void 0?super.off(v,s):(this._removeDelegatedListener(v,typeof s=="string"?[s]:s,d),this)}queryRenderedFeatures(v,s){if(!this.style)return[];let d;const m=v instanceof l.P||Array.isArray(v),y=m?v:[[0,0],[this.transform.width,this.transform.height]];if(s=s||(m?{}:v)||{},y instanceof l.P||typeof y[0]=="number")d=[l.P.convert(y)];else{const x=l.P.convert(y[0]),M=l.P.convert(y[1]);d=[x,new l.P(M.x,x.y),M,new l.P(x.x,M.y),x]}return this.style.queryRenderedFeatures(d,s,this.transform)}querySourceFeatures(v,s){return this.style.querySourceFeatures(v,s)}setStyle(v,s){return(s=l.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},s)).diff!==!1&&s.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&v?(this._diffStyle(v,s),this):(this._localIdeographFontFamily=s.localIdeographFontFamily,this._updateStyle(v,s))}setTransformRequest(v){return this._requestManager.setTransformRequest(v),this}_getUIString(v){const s=this._locale[v];if(s==null)throw new Error(`Missing UI string '${v}'`);return s}_updateStyle(v,s){if(s.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(v,s));const d=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!v)),v?(this.style=new nu(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof v=="string"?this.style.loadURL(v,s,d):this.style.loadJSON(v,s,d),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new nu(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(v,s){if(typeof v=="string"){const d=this._requestManager.transformRequest(v,"Style");l.h(d,new AbortController).then(m=>{this._updateDiff(m.data,s)}).catch(m=>{m&&this.fire(new l.j(m))})}else typeof v=="object"&&this._updateDiff(v,s)}_updateDiff(v,s){try{this.style.setState(v,s)&&this._update(!0)}catch(d){l.w(`Unable to perform style diff: ${d.message||d.error||d}. Rebuilding the style from scratch.`),this._updateStyle(v,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():l.w("There is no style added to the map.")}addSource(v,s){return this._lazyInitEmptyStyle(),this.style.addSource(v,s),this._update(!0)}isSourceLoaded(v){const s=this.style&&this.style.sourceCaches[v];if(s!==void 0)return s.loaded();this.fire(new l.j(new Error(`There is no source with ID '${v}'`)))}setTerrain(v){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),v){const s=this.style.sourceCaches[v.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${v.source}`);this.terrain===null&&s.reload();for(const d in this.style._layers){const m=this.style._layers[d];m.type==="hillshade"&&m.source===v.source&&l.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Bd(this.painter,s,v),this.painter.renderToTexture=new Tm(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=d=>{d.dataType==="style"?this.terrain.sourceCache.freeRtt():d.dataType==="source"&&d.tile&&(d.sourceId!==v.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(d.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new l.k("terrain",{terrain:v})),this}getTerrain(){var v,s;return(s=(v=this.terrain)===null||v===void 0?void 0:v.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const v=this.style&&this.style.sourceCaches;for(const s in v){const d=v[s]._tiles;for(const m in d){const y=d[m];if(y.state!=="loaded"&&y.state!=="errored")return!1}}return!0}removeSource(v){return this.style.removeSource(v),this._update(!0)}getSource(v){return this.style.getSource(v)}addImage(v,s,d={}){const{pixelRatio:m=1,sdf:y=!1,stretchX:x,stretchY:M,content:I,textFitWidth:O,textFitHeight:N}=d;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||l.b(s))){if(s.width===void 0||s.height===void 0)return this.fire(new l.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:V,height:F,data:G}=s,K=s;return this.style.addImage(v,{data:new l.R({width:V,height:F},new Uint8Array(G)),pixelRatio:m,stretchX:x,stretchY:M,content:I,textFitWidth:O,textFitHeight:N,sdf:y,version:0,userImage:K}),K.onAdd&&K.onAdd(this,v),this}}{const{width:V,height:F,data:G}=E.getImageData(s);this.style.addImage(v,{data:new l.R({width:V,height:F},G),pixelRatio:m,stretchX:x,stretchY:M,content:I,textFitWidth:O,textFitHeight:N,sdf:y,version:0})}}updateImage(v,s){const d=this.style.getImage(v);if(!d)return this.fire(new l.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const m=s instanceof HTMLImageElement||l.b(s)?E.getImageData(s):s,{width:y,height:x,data:M}=m;if(y===void 0||x===void 0)return this.fire(new l.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(y!==d.data.width||x!==d.data.height)return this.fire(new l.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const I=!(s instanceof HTMLImageElement||l.b(s));return d.data.replace(M,I),this.style.updateImage(v,d),this}getImage(v){return this.style.getImage(v)}hasImage(v){return v?!!this.style.getImage(v):(this.fire(new l.j(new Error("Missing required image id"))),!1)}removeImage(v){this.style.removeImage(v)}loadImage(v){return le.getImage(this._requestManager.transformRequest(v,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(v,s){return this._lazyInitEmptyStyle(),this.style.addLayer(v,s),this._update(!0)}moveLayer(v,s){return this.style.moveLayer(v,s),this._update(!0)}removeLayer(v){return this.style.removeLayer(v),this._update(!0)}getLayer(v){return this.style.getLayer(v)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(v,s,d){return this.style.setLayerZoomRange(v,s,d),this._update(!0)}setFilter(v,s,d={}){return this.style.setFilter(v,s,d),this._update(!0)}getFilter(v){return this.style.getFilter(v)}setPaintProperty(v,s,d,m={}){return this.style.setPaintProperty(v,s,d,m),this._update(!0)}getPaintProperty(v,s){return this.style.getPaintProperty(v,s)}setLayoutProperty(v,s,d,m={}){return this.style.setLayoutProperty(v,s,d,m),this._update(!0)}getLayoutProperty(v,s){return this.style.getLayoutProperty(v,s)}setGlyphs(v,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(v,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(v,s,d={}){return this._lazyInitEmptyStyle(),this.style.addSprite(v,s,d,m=>{m||this._update(!0)}),this}removeSprite(v){return this._lazyInitEmptyStyle(),this.style.removeSprite(v),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(v,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(v,s,d=>{d||this._update(!0)}),this}setLight(v,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(v,s),this._update(!0)}getLight(){return this.style.getLight()}setSky(v){return this._lazyInitEmptyStyle(),this.style.setSky(v),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(v,s){return this.style.setFeatureState(v,s),this._update()}removeFeatureState(v,s){return this.style.removeFeatureState(v,s),this._update()}getFeatureState(v){return this.style.getFeatureState(v)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let v=0,s=0;return this._container&&(v=this._container.clientWidth||400,s=this._container.clientHeight||300),[v,s]}_setupContainer(){const v=this._container;v.classList.add("maplibregl-map");const s=this._canvasContainer=C.create("div","maplibregl-canvas-container",v);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=C.create("canvas","maplibregl-canvas",s),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const d=this._containerDimensions(),m=this._getClampedPixelRatio(d[0],d[1]);this._resizeCanvas(d[0],d[1],m);const y=this._controlContainer=C.create("div","maplibregl-control-container",v),x=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(M=>{x[M]=C.create("div",`maplibregl-ctrl-${M} `,y)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(v,s,d){this._canvas.width=Math.floor(d*v),this._canvas.height=Math.floor(d*s),this._canvas.style.width=`${v}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const v={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let s=null;this._canvas.addEventListener("webglcontextcreationerror",m=>{s={requestedAttributes:v},m&&(s.statusMessage=m.statusMessage,s.type=m.type)},{once:!0});const d=this._canvas.getContext("webgl2",v)||this._canvas.getContext("webgl",v);if(!d){const m="Failed to initialize WebGL";throw s?(s.message=m,new Error(JSON.stringify(s))):new Error(m)}this.painter=new _u(d,this.transform),P.testSupport(d)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(v){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||v,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(v){return this._update(),this._renderTaskQueue.add(v)}_cancelRenderFrame(v){this._renderTaskQueue.remove(v)}_render(v){const s=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(v),this._removed)return;let d=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const y=this.transform.zoom,x=E.now();this.style.zoomHistory.update(y,x);const M=new l.z(y,{now:x,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),I=M.crossFadingFactor();I===1&&I===this._crossFadingFactor||(d=!0,this._crossFadingFactor=I),this.style.update(M)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,s,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new l.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.bf.mark(l.bg.load),this.fire(new l.k("load"))),this.style&&(this.style.hasTransitions()||d)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const m=this._sourcesDirty||this._styleDirty||this._placementDirty;return m||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.k("idle")),!this._loaded||this._fullyLoaded||m||(this._fullyLoaded=!0,l.bf.mark(l.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var v;this._hash&&this._hash.remove();for(const d of this._controls)d.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),le.removeThrottleControl(this._imageQueueHandle),(v=this._resizeObserver)===null||v===void 0||v.disconnect();const s=this.painter.context.gl.getExtension("WEBGL_lose_context");s!=null&&s.loseContext&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),C.remove(this._canvasContainer),C.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),l.bf.clearMetrics(),this._removed=!0,this.fire(new l.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(v=>{l.bf.frame(v),this._frameRequest=null,this._render(v)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(v){this._showTileBoundaries!==v&&(this._showTileBoundaries=v,this._update())}get showPadding(){return!!this._showPadding}set showPadding(v){this._showPadding!==v&&(this._showPadding=v,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(v){this._showCollisionBoxes!==v&&(this._showCollisionBoxes=v,v?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(v){this._showOverdrawInspector!==v&&(this._showOverdrawInspector=v,this._update())}get repaint(){return!!this._repaint}set repaint(v){this._repaint!==v&&(this._repaint=v,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(v){this._vertices=v,this._update()}get version(){return Mm}getCameraTargetElevation(){return this.transform.elevation}},u.MapMouseEvent=Pi,u.MapTouchEvent=Yo,u.MapWheelEvent=vm,u.Marker=Au,u.NavigationControl=class{constructor(v){this._updateZoomButtons=()=>{const s=this._map.getZoom(),d=s===this._map.getMaxZoom(),m=s===this._map.getMinZoom();this._zoomInButton.disabled=d,this._zoomOutButton.disabled=m,this._zoomInButton.setAttribute("aria-disabled",d.toString()),this._zoomOutButton.setAttribute("aria-disabled",m.toString())},this._rotateCompassArrow=()=>{const s=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=s},this._setButtonTitle=(s,d)=>{const m=this._map._getUIString(`NavigationControl.${d}`);s.title=m,s.setAttribute("aria-label",m)},this.options=l.e({},S_,v),this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",s=>s.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",s=>this._map.zoomIn({},{originalEvent:s})),C.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",s=>this._map.zoomOut({},{originalEvent:s})),C.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",s=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:s}):this._map.resetNorth({},{originalEvent:s})}),this._compassIcon=C.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(v){return this._map=v,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new E_(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){C.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(v,s){const d=C.create("button",v,this._container);return d.type="button",d.addEventListener("click",s),d}},u.Popup=class extends l.E{constructor(v){super(),this.remove=()=>(this._content&&C.remove(this._content),this._container&&(C.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new l.k("close"))),this),this._onMouseUp=s=>{this._update(s.point)},this._onMouseMove=s=>{this._update(s.point)},this._onDrag=s=>{this._update(s.point)},this._update=s=>{var d;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=C.create("div","maplibregl-popup",this._map.getContainer()),this._tip=C.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const I of this.options.className.split(" "))this._container.classList.add(I);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Vn(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.wrap(),this._trackPointer&&!s)return;const m=this._flatPos=this._pos=this._trackPointer&&s?s:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&s?s:this._map.transform.locationPoint(this._lngLat));let y=this.options.anchor;const x=Pu(this.options.offset);if(!y){const I=this._container.offsetWidth,O=this._container.offsetHeight;let N;N=m.y+x.bottom.y<O?["top"]:m.y>this._map.transform.height-O?["bottom"]:[],m.x<I/2?N.push("left"):m.x>this._map.transform.width-I/2&&N.push("right"),y=N.length===0?"bottom":N.join("-")}let M=m.add(x[y]);this.options.subpixelPositioning||(M=M.round()),C.setTransform(this._container,`${Ya[y]} translate(${M.x}px,${M.y}px)`),Mu(this._container,y,"popup")},this._onClose=()=>{this.remove()},this.options=l.e(Object.create(Et),v)}addTo(v){return this._map&&this.remove(),this._map=v,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new l.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(v){return this._lngLat=l.N.convert(v),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(v){return this.setDOMContent(document.createTextNode(v))}setHTML(v){const s=document.createDocumentFragment(),d=document.createElement("body");let m;for(d.innerHTML=v;m=d.firstChild,m;)s.appendChild(m);return this.setDOMContent(s)}getMaxWidth(){var v;return(v=this._container)===null||v===void 0?void 0:v.style.maxWidth}setMaxWidth(v){return this.options.maxWidth=v,this._update(),this}setDOMContent(v){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=C.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(v),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(v){return this._container&&this._container.classList.add(v),this}removeClassName(v){return this._container&&this._container.classList.remove(v),this}setOffset(v){return this.options.offset=v,this._update(),this}toggleClassName(v){if(this._container)return this._container.classList.toggle(v)}setSubpixelPositioning(v){this.options.subpixelPositioning=v}_createCloseButton(){this.options.closeButton&&(this._closeButton=C.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const v=this._container.querySelector(Iu);v&&v.focus()}},u.RasterDEMTileSource=Qt,u.RasterTileSource=jt,u.ScaleControl=class{constructor(v){this._onMove=()=>{tc(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,tc(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Is),v)}getDefaultPosition(){return"bottom-left"}onAdd(v){return this._map=v,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-scale",v.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){C.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},u.ScrollZoomHandler=ts,u.Style=nu,u.TerrainControl=class{constructor(v){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=v}onAdd(v){return this._map=v,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=C.create("button","maplibregl-ctrl-terrain",this._container),C.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){C.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},u.TwoFingersTouchPitchHandler=Ha,u.TwoFingersTouchRotateHandler=Ad,u.TwoFingersTouchZoomHandler=Td,u.TwoFingersTouchZoomRotateHandler=Pd,u.VectorTileSource=pr,u.VideoSource=Or,u.addSourceType=(v,s)=>l._(void 0,void 0,void 0,function*(){if(Cs(v))throw new Error(`A source type called "${v}" already exists.`);((d,m)=>{Es[d]=m})(v,s)}),u.clearPrewarmedResources=function(){const v=Ee;v&&(v.isPreloaded()&&v.numActive()===1?(v.release(Nn),Ee=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},u.getMaxParallelImageRequests=function(){return l.a.MAX_PARALLEL_IMAGE_REQUESTS},u.getRTLTextPluginStatus=function(){return Br().getRTLTextPluginStatus()},u.getVersion=function(){return Ld},u.getWorkerCount=function(){return Pn.workerCount},u.getWorkerUrl=function(){return l.a.WORKER_URL},u.importScriptInWorkers=function(v){return Bt().broadcast("IS",v)},u.prewarm=function(){Ze().acquire(Nn)},u.setMaxParallelImageRequests=function(v){l.a.MAX_PARALLEL_IMAGE_REQUESTS=v},u.setRTLTextPlugin=function(v,s){return Br().setRTLTextPlugin(v,s)},u.setWorkerCount=function(v){Pn.workerCount=v},u.setWorkerUrl=function(v){l.a.WORKER_URL=v}});var a=n;return a})})(H1);var Sz=H1.exports;const Ez=wz(Sz),Fp=["#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"],Cr={};async function $p(t="pin4-sm-mi-plumber+f45942.png",e=null){try{const i=t!=null&&t.includes("/")?t:`/api-user/marker_icon/${t}`,r=await e.loadImage(i);if(e.hasImage(t))return;e==null||e.addImage(t,r.data,{sdf:t==null?void 0:t.includes("+sdf")})}catch(n){console.error(n)}}function Cz(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)}`}Cr.point=async(t={},e={},n=null)=>{var E,C,P,D,R,j,W,ee,le,J,Te,xe;e||(e={}),((E=e==null?void 0:e.width)==null?void 0:E[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 i=((C=t.style)==null?void 0:C.colorAttr)||((P=t.style)==null?void 0:P.iconCls);let r={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[a,u]=(r==null?void 0:r.split("-"))||[],l=((D=t.style)==null?void 0:D.color)||"blue";!((R=t.style)!=null&&R.iconAttr)&&(r!=null&&r.includes("{{marker}}"))&&(r=r.replace("{{marker}}","fa-star"));const g="gray",b=(Ae,je)=>`${Ae==null?void 0:Ae.split("+")[0]}+${je.replace("#","")}.png`;if(t.legendAuto={icon:[],color:[]},(j=t.style)!=null&&j.iconAttr&&r){const Ae=(ee=(W=t.meta)==null?void 0:W.columns)==null?void 0:ee.find(De=>{var Ke;return De.name===((Ke=t==null?void 0:t.style)==null?void 0:Ke.iconAttr)}),je=(Ae==null?void 0:Ae.values)||await ct.get(`/api-user/gis-ir/${t.id}/${(le=t.style)==null?void 0:le.iconAttr}`).then(De=>De.data.rows);if(je!=null&&je.length){const De=r.replace("{{color}}",l.length?l:Cz(l)||[0]).split("+")[1].split(/[.-]/)[0];je.forEach((Ke,rt)=>{var Rt;return Ke.icon=(Rt=Ke.icon)!=null&&Rt.includes("png")?Ke.icon:`${a}-${u}-${Ke.data||Ke.icon||`ub-${rt}`}+${r!=null&&r.includes("circle")?"ddd-222":De}.png`}),r=r!=null&&r.includes("{{")?`${a}-${u}-fa-question+0c53ad.png`:r,t.legendAuto.iconText=(Ae==null?void 0:Ae.title)||t.style.iconAttr,je.forEach(Ke=>t.legendAuto.icon.push(Ke)),t.legendAuto.icon.push({icon:r,text:"Не визначено"}),t.style.iconArr=["match",["get",t.style.iconAttr]].concat(je.filter(Ke=>Ke.id).reduce((Ke,rt)=>Ke.concat([rt.id,rt.icon]),[])).concat([r]),await Promise.all(je.map(Ke=>Ke.icon).map(Ke=>$p(Ke,n))),await $p(r,n)}else r=i?"pin6-m-fa-star+{{color}}.png":`pin6-m-fa-star+${l==null?void 0:l.replace("#","")}.png`}if(r!=null&&r.includes("{{color}}")?r=r.replace("{{color}}","222"):e!=null&&e.icon&&e.iconAttr,i){const Ae=(Te=(J=t.meta)==null?void 0:J.columns)==null?void 0:Te.find(De=>De.name===i),je=(Ae==null?void 0:Ae.values)||await ct.get(`/api-user/gis-ir/${t.id}/${i}`).then(De=>De.data.rows);t.style.color=je!=null&&je.length?["match",["get",i]].concat(je.filter(De=>De.id).reduce((De,Ke,rt)=>De.concat([Ke.id,Ke.color||Fp[rt]]),[])).concat(["#aaa"]):l,t.style.colorArr=t.style.color,t.legendAuto.colorText=(Ae==null?void 0:Ae.title)||i,je.forEach(De=>t.legendAuto.color.push(De)),t.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),!((xe=t.style)!=null&&xe.iconAttr)&&!(r!=null&&r.includes("+sdf"))&&r&&(je.forEach((De,Ke)=>De.icon=b(r,De.color||Fp[Ke])),t.style.iconArr=["match",["get",i]].concat(je.filter(De=>De.id).reduce((De,Ke)=>De.concat([Ke.id,Ke.icon]),[])).concat([b(r,g)]),await Promise.all(je.map(De=>De.icon).map(De=>$p(De,n))))}if(r&&!(r!=null&&r.includes("{"))){const Ae=e!=null&&e.colorAttr?b(r,g):r;await $p(Ae,n)}const S=r!=null&&r.includes("sdf")?["interpolate",["linear"],["zoom"],14,.1,18,.2]:["interpolate",["linear"],["zoom"],14,.7,16,1];return e.iconOffset=r!=null&&r.includes("pin")?[0,r!=null&&r.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:(r!=null&&r.includes("+sdf")||!(r!=null&&r.includes("circle"))&&!(r!=null&&r.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],(e==null?void 0:e.strokeWidth)||1,["boolean",["feature-state","hover"],!1],2,(e==null?void 0:e.strokeWidth)||1],"circle-stroke-color":["case",["boolean",["feature-state","select"],!1],(e==null?void 0:e.stroke)||(e==null?void 0:e.color)||"#fff",["boolean",["feature-state","hover"],!1],"maroon",(e==null?void 0:e.stroke)||(e==null?void 0:e.color)||"#fff"],"circle-opacity":(e.iconZoom?["interpolate",["exponential",.5],["zoom"],+e.iconZoom-1,1,+e.iconZoom,r!=null&&r.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!=null&&e.colorAttr&&e.iconArr||r,"icon-allow-overlap":!0,...e.iconOffset?{"icon-offset":e.iconOffset||!1}:{},...S?{"icon-size":S||!1}:{}},paint:{"icon-opacity":["case",["boolean",["feature-state","hover"],!1],.5,["boolean",["feature-state","select"],!1],.5,(r!=null&&r.includes("+sdf")?1:null)||(r!=null&&r.includes("circle")?.6:1)],...r!=null&&r.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}}]:[])},Cr.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"}}],Cr.polygon=async(t={},e={},n=null)=>{var a,u,l,g;const{colorAttr:i}=e,r=((a=t.style)==null?void 0:a.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=${i}`));const b=((l=(u=t.meta)==null?void 0:u.columns.find(S=>S.name===i))==null?void 0:l.values)||await ct.get(`/api-user/gis-ir/${t.id}/${i}`).then(S=>S.data.rows);t.legendAuto={color:[]},b.forEach(S=>t.legendAuto.color.push(S)),t.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),t.style.color=b?["match",["get",i]].concat(b.filter(S=>S.id).reduce((S,E,C)=>S.concat([E.id,E.color||Fp[C]]),[])).concat(["#aaa"]):r}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:(g=t.url)!=null&&g.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]}}]:[])},Cr.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}}]:[]),Cr.linestring=Cr.line,Cr.circle=Cr.point;async function Tz(t,e,n){var l,g,b,S,E,C,P,D,R,j,W,ee;typeof e.style=="string"&&(e.style=e.style[0]==="{"?JSON.parse(e.style):(l=window.YAML.parse(e.style))==null?void 0:l.style),(b=(g=e.style)==null?void 0:g.filter)==null||b.call(g,le=>le.source).forEach(le=>{le.lsource=`${e.id}-${le.source}`});const i=((S=e==null?void 0:e.style)==null?void 0:S.type)||((W=((P=(C=(E=e==null?void 0:e.meta)==null?void 0:E.geom)==null?void 0:C.geometry)==null?void 0:P.length)>2?["point"]:[((j=(R=(D=e==null?void 0:e.meta)==null?void 0:D.geom)==null?void 0:R.geometry)==null?void 0:j[0].toLowerCase())||"point"])==null?void 0:W.map(le=>{var J;return(J=le==null?void 0:le.replace)==null?void 0:J.call(le,"multi","")})),r=Array.isArray(i)?i:[i],a=(await Promise.all(Array.isArray(e==null?void 0:e.style)?e.style.map(async le=>{var J;return(J=Cr[le.type])==null?void 0:J.call(Cr,e,le,n)}):r.map(async le=>{var J;return(J=Cr[le])==null?void 0:J.call(Cr,e,e.style,n)}))).reduce((le,J)=>J?le.concat(J):le,[]);a.forEach((le,J)=>{le.id=`${le.id}-${J}`});const u=a;return(e.service==="vtile"||(ee=e.url)!=null&&ee.includes(".vmt"))&&u.forEach(le=>{le.layout||(le.layout={}),le.layout.visibility="visible",le["source-layer"]=le.lsource||e.data||t}),u}const Mz={data(){return{layerList:[],layerObj:{},colors:Fp,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){e.getStyle().layers.forEach(n=>{n.id.match(t)&&e.moveLayer(n.id)})},getLayersBySourceId(t,e){return e.getStyle().layers.filter(i=>i.id.match(t))},async setVisible(t,e=!0,n={}){const i=typeof t=="object";try{const{style:r,map:a=this.map}=n,u=(t==null?void 0:t.id)||t,l=i?t:await this.getLayerById(u);if(!(l!=null&&l.id))throw new Error("MixinError: Layer has no id");const g=a.getStyle().layers.filter(b=>b.id.match(u));!g.length||r?await this.addToLayers({...l,...(n==null?void 0:n.data)||{},interactive:(l==null?void 0:l.interactive)!==void 0?l==null?void 0:l.interactive:!0,visible:e},{map:a,cb:n==null?void 0:n.onAddLayer}):(this.layerList=this.layerList.map(b=>b.id===l.id?{...b,visible:e}:b),g.forEach(b=>{a.setLayoutProperty(b.id,"visibility",e?"visible":"none")})),n!=null&&n.cb&&await(n==null?void 0:n.cb(l))}catch(r){console.error(r),!n.onAddLayer||n.onAddLayer({data:i?t:{id:t},message:r.message,type:"error"})}},async addToLayers(t,e={}){try{const{map:n=this==null?void 0:this.map}=e;this.layerList.find(r=>r.id===t.id)||(this.layerList=this.layerList.concat(t)),this.layerObj={...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 r=>{r.source===t.id&&await n.setLayoutProperty(r.id,"visibility","none")}),!(e!=null&&e.cb&&(t!=null&&t.visible))||await e.cb({data:t,type:"success"}),this.moveLayers("gl-draw")}catch(n){!e.cb||e.cb({data:t,message:n.message,type:"error"}),console.error(n)}},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{data:n}=await ct.get(t.layer),i={...t,source:t.id,layers:[]};Object.keys(n.sources).forEach(async r=>{await e.addSource(t.id,{type:n.sources[r].type,maxzoom:n.sources[r].maxzoom,url:n.sources[r].url})}),await n.layers.forEach(async r=>{await e.addLayer({...r,source:t.id,id:`${r.id}-${t.id}`}),i.layers=await i.layers.concat(`${r.id}-${t.id}`)})},async addGeojsonLayers(t){const e=n=>{throw this.$notify({type:"error",title:"Відсутня геометрія у обраному шарі",message:n,position:"bottom-right"}),this.layerList=this.layerList.filter(i=>i.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 ct.get((t==null?void 0:t.geojson)||(t==null?void 0:t.url)),i=await n.data;if(n.statusText==="OK")this.createGeometryLayer({data:t,geojson:i},"geojson");else throw new Error((i==null?void 0:i.message)||(n==null?void 0:n.statusText)||"Error addGeojson layer")}catch(n){e(n.message),console.error(n)}},async createGeometryLayer({data:t,geojson:e},n){var l,g,b,S,E;const{map:i}=this,r=await Tz(t.id,this.layerList.find(C=>C.id==t.id),i),a={type:n,cluster:((l=t==null?void 0:t.style)==null?void 0:l.cluster)||!1,clusterMaxZoom:((g=t==null?void 0:t.style)==null?void 0:g.clusterMaxZoom)||14};n==="vector"&&(a.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}`:""}${(b=t==null?void 0:t.style)!=null&&b.pointZoom?`&pointZoom=${t.style.pointZoom}`:""}`]),n==="geojson"&&(a.data=e||`${window.location.origin}${(t==null?void 0:t.geojson)||(t==null?void 0:t.url)}`),i.addSource(t.id,a),r.forEach(C=>{var D;const P={...C,source:t.id,maxzoom:+(C==null?void 0:C.maxzoom)||24,minzoom:+(C==null?void 0:C.minzoom)||0,cluster:!1,clusterMaxZoom:2};i.addLayer(P),i.moveLayer(C.id),(D=C==null?void 0:C.layout)!=null&&D["text-field"]||this.apiLayersHover(C.id,t.id,i),this.addedLayersSettings=this.addedLayersSettings.concat(P)});const u=r.map(C=>C.type).filter(C=>C&&C!=="symbol");(E=(S=t==null?void 0:t.meta)==null?void 0:S.geom)!=null&&E.geometry&&t.meta.geom.geometry.filter(P=>!u.includes(this.geometryByType(P,!0))).forEach(P=>{this.createStyleObj({type:P,style:t.style},t.id)})},async setStyle(t,e,n=this.map){const i=(t==null?void 0:t.id)||t;n.getStyle().layers.forEach(a=>{a.source===i&&n.removeLayer(a.id)}),n.getSource(i)&&(n==null||n.removeSource(i)),this.layerList=this.layerList.map(a=>(a.id===i&&(a.style=e),a));const r=this.layerList.find(a=>a.id===i);this.addToLayers(r)},setLayerData({source:t,data:e}){const n=(t==null?void 0:t.id)||t;this.layerList=this.layerList.map(i=>i.id===n?{...i,...e}:i),this.layerObj={...this.layerObj,[t]:{...this.layerObj[t],...e}}},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(i=>i.id!==n),await e.getStyle().layers.forEach(async i=>{i.source===n&&await e.removeLayer(i.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(i=>{i.id===n&&e.removeLayer(i.id)}),await e.removeSource(n),await this.setVisible(t,!0)},async setFilter(t,e){const n=this.layerObj[t],i=await this.map.getSource(t);if(n.service==="vtile")await i.setTiles([`${window.location.origin}${n.geojson||n.url}${n.url.includes("?")?"&":"?"}filter=${e}${n.props?`&props=${n.props}`:""}`]);else if(n.service==="geojson"){const{data:r}=await ct.get((n==null?void 0:n.geojson)||`${n==null?void 0:n.url}?filter=${e}`);await this.map.getSource(t).setData(r)}},async getLayerById(t,e=null){var i;const n=(t==null?void 0:t.id)||t;try{const r=(i=this.layerList)==null?void 0:i.find(u=>u.id===n);if(r)return r;const a=await ct.get(`/api-user/gis-ir/${n}${t!=null&&t.service?`?service=${t==null?void 0:t.service}`:""}`);if(a.statusText==="OK"){const u=await a.data;return!e||await e(u),u}return this.$notify({type:"warning",message:`Шар ${n} не було знайдено!`}),null}catch(r){this.$notify({type:"warning",message:`Шар ${n} не було знайдено!`}),console.error(r)}},createStyleObj({type:t,style:e},n){const i=this.geometryByType(t,!0);if(!i)throw Error("Geomery type ERROR: Error adding missing layers");const r=`${n}-${i}`;if(this.map.getStyle().layers.find(u=>u.id===r))return;const a={id:r,type:i,source:n,"source-layer":n,layout:{},paint:{[`${i}-color`]:["case",["boolean",["feature-state","hover"],!1],"red",(e==null?void 0:e.color)||"#444e3d"],[`${i}-opacity`]:e!=null&&e.opacity||i==="fill"?.5:1},filter:["all",["==",["geometry-type"],this.geometryByType(t)]]};this.map.addLayer(a),this.addedLayersSettings=this.addedLayersSettings.concat(a),this.apiLayersHover(r,n,this.map)},apiLayersHover(t,e,n){const i=n.getSource(e),r=()=>{const a={source:e,id:this.hoveredFeatureId};return i.type==="vector"&&(a.sourceLayer=e),a};n.on("mousemove",t,a=>{a.features.length>0&&(this.hoveredFeatureId!==null&&n.setFeatureState(r(),{hover:!1}),this.hoveredFeatureId=a.features[0].id,n.setFeatureState(r(),{hover:!0}))}),n.on("mouseleave",t,()=>{this.hoveredFeatureId!==null&&n.setFeatureState(r(),{hover:!1}),this.hoveredFeatureId=null})},async changeBaseLayer(t,e=!0,n=!0){await this.setVisible(t,e);const i=(t==null?void 0:t.id)||t;i!==this.activeLayer&&(n&&this.activeLayer&&await this.setVisible(this.activeLayer,!1),this.map.getStyle().layers.forEach(r=>{r.source!==i&&r.type!=="background"&&this.map.moveLayer(r.id)}),this.activeLayer=i)},async refreshLayer(t,e=this.map){const n=(t==null?void 0:t.id)||t;await e.getStyle().layers.forEach(i=>{i.source===n&&e.removeLayer(i.id)}),await e.removeSource(n),this.layers=await this.layers.filter(i=>i.id!==n),await this.setVisible(typeof t=="object"?t:n)}}},Az={props:{objectData:{type:Array,default:()=>[]},object:{type:Object,default:()=>null},mapRef:{type:Object,default:()=>null}},computed:{currentLayer(){var n;const t=(n=this.object)==null?void 0:n.source;return this.mapRef.layerObj[t]},popupPosition(){var e,n,i;return((i=(n=(e=this.currentLayer)==null?void 0:e.setting)==null?void 0:n.popup)==null?void 0:i.position)||"horizontal"},popupWidth(){var e,n,i;return`${((i=(n=(e=this.currentLayer)==null?void 0:e.setting)==null?void 0:n.popup)==null?void 0:i.width)||240}px`},popupRows(){return this.objectData.filter(t=>t.column!=="image")},positionIsVertical(){return this.popupPosition==="vertical"}},methods:{rowValue(t){return t.value},rowTitle(t){return t.title}}},Iz={key:0,class:"vsTailwind map-popup__vertical"},Pz={class:"mb-1"},Dz={class:"text-sm"},Oz={key:1,class:"map__popup-body"},zz=["innerHTML"],Bz={key:1};function Nz(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",{class:"map-popup",style:f.normalizeStyle({"max-width":a.popupWidth,width:a.popupWidth})},[a.positionIsVertical?(f.openBlock(),f.createElementBlock("div",Iz,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.popupRows,u=>(f.openBlock(),f.createElementBlock("div",{class:"border-b py-1 last:border-none last:pt-1 last:pb-0",key:a.rowTitle(u)},[f.createElementVNode("strong",Pz,f.toDisplayString(a.rowTitle(u)),1),f.createElementVNode("div",Dz,f.toDisplayString(a.rowValue(u)),1)]))),128))])):(f.openBlock(),f.createElementBlock("table",Oz,[f.createElementVNode("tbody",null,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.popupRows,u=>f.withDirectives((f.openBlock(),f.createElementBlock("tr",{key:a.rowTitle(u),class:"map__popup-body-item"},[f.createElementVNode("td",null,f.toDisplayString(a.rowTitle(u)),1),a.rowValue(u)?(f.openBlock(),f.createElementBlock("td",{key:0,innerHTML:a.rowValue(u)},null,8,zz)):(f.openBlock(),f.createElementBlock("td",Bz,e[0]||(e[0]=[f.createElementVNode("div",{class:"text-red-500"}," Не визначено ",-1)])))])),[[f.vShow,!a.rowValue(u).includes("id")]])),128))])]))],4)}const Rz=$e(Az,[["render",Nz],["__scopeId","data-v-14698eb6"]]),q1={width:200,show:!0,position:"horizontal"},Lz={components:{VsPopupBody:Rz},props:{aviableFields:{type:Array,default:()=>[]},mapRef:{type:[Object,Array],default:()=>{}},object:{type:[Object,Array],default:()=>{}}},data(){return{objectData:[],popupSettings:q1}},computed:{getImage(){return this.objectData.find(t=>t.column==="image")||null},currentLayer(){var t;return(t=this.$parent.layerList)==null?void 0:t.find(e=>{var n;return(e==null?void 0:e.id)===((n=this.object)==null?void 0:n.source)})}},watch:{async object(t,e){t!==null&&(t==null?void 0:t.id)!==(e==null?void 0:e.id)||!(t!=null&&t.id)?await this.getFormatObject(t):t===null&&(this.objectData=[])}},methods:{async getFormatObject(t){var g,b,S,E,C,P;if(!t)return;const e=Object.keys(t.properties).filter(D=>!D.match("__text")&&!["id"].includes(D)),{currentLayer:n}=this;if((g=n==null?void 0:n.setting)!=null&&g.popup&&(this.popupSettings=(n==null?void 0:n.setting.popup)||q1),!(n!=null&&n.meta)){const D=e.map(R=>({title:R,value:t.properties[R]}));this.objectData=[...D,{value:((b=t.properties)==null?void 0:b.image)||"",title:"Фото",column:"image"}];return}const i=n.meta.columns,r=e.map(D=>{var le,J,Te,xe;const R={},W=Object.assign({values:[]},i.find(Ae=>Ae.name===D));typeof W.values!="object"&&console.warn(`Warning: Layer ${t.source} has key "values" which is not an object in meta!`);const ee=W!=null&&W.values&&((le=W==null?void 0:W.values)==null?void 0:le.find(Ae=>(Ae==null?void 0:Ae.id)==t.properties[D]))||null;return R.value=(W==null?void 0:W.format)==="select"?this.formatBadge({text:(ee==null?void 0:ee.text)||((J=t.properties)==null?void 0:J[`${D}__text`])||((Te=t.properties)==null?void 0:Te[D])||"-",color:(ee==null?void 0:ee.color)||"#1989FA"}):(ee==null?void 0:ee.text)||((xe=t.properties)==null?void 0:xe[`${D}__text`])||t.properties[D],R.column=D,R.title=(W==null?void 0:W[window==null?void 0:window.lang])||(W==null?void 0:W.ua)||(W==null?void 0:W.title)||D,R});this.objectData=[...r,{value:((S=t.properties)==null?void 0:S.image)||"",title:"Фото",column:"image"}];const a=(C=(E=n==null?void 0:n.setting)==null?void 0:E.popup)==null?void 0:C.popup,u=typeof a=="string"?a==null?void 0:a.split(","):a,l=[...this.aviableFields,...((P=n==null?void 0:n.popup)==null?void 0:P.split(","))||[],...u||[]];this.objectData=l.length?this.objectData.filter(D=>l.includes(D.column)||l.includes(D.title)):[]},noInfoObject(){var i,r,a,u,l;if(!this.object)return"Інформація відсутня";const{currentLayer:t}=this,e=((r=(i=t==null?void 0:t.meta)==null?void 0:i.columns)==null?void 0:r.find(g=>(g==null?void 0:g.meta)==="title"))||((a=t==null?void 0:t.meta)==null?void 0:a.columns[0])||null;return{title:(t==null?void 0:t.name)||(t==null?void 0:t.id)||((u=this.object)==null?void 0:u.sourceLayer)||((l=this.object)==null?void 0:l.source)||"Дані по шару не знайдено",column:e}},formatBadge(t){const e=(t==null?void 0:t.text)||"-";return t!=null&&t.color?`<span >${e}</span>`:e}}},Vz={key:0},Fz={key:0},$z=["src","alt"],jz={key:1},Uz={class:"text-left text-sm m-b-sm"},Hz={key:1,class:"text-center"};function qz(t,e,n,i,r,a){var l,g,b,S,E,C,P,D,R,j,W;const u=f.resolveComponent("VsPopupBody");return f.openBlock(),f.createElementBlock("div",{class:f.normalizeClass((((l=r.popupSettings)==null?void 0:l.position)||"horizontal")+"-position")},[r.objectData.filter(ee=>ee.column!=="image").length?(f.openBlock(),f.createElementBlock("div",Vz,[a.getImage&&((g=a.getImage)!=null&&g.value)?(f.openBlock(),f.createElementBlock("div",Fz,[f.createElementVNode("img",{class:"popup-image",src:"files/"+a.getImage.value,alt:a.getImage.column},null,8,$z)])):f.createCommentVNode("",!0),f.createVNode(u,{"object-data":r.objectData,object:n.object,mapRef:n.mapRef},null,8,["object-data","object","mapRef"])])):(f.openBlock(),f.createElementBlock("div",jz,[(b=a.noInfoObject())!=null&&b.column?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[f.createElementVNode("b",Uz,f.toDisplayString(a.noInfoObject().title),1),f.createElementVNode("div",null,[f.createElementVNode("b",null,f.toDisplayString(((E=(S=a.noInfoObject())==null?void 0:S.column)==null?void 0:E.ua)||((P=(C=a.noInfoObject())==null?void 0:C.column)==null?void 0:P.title))+":",1),f.createTextVNode(" "+f.toDisplayString(((W=(D=n.object)==null?void 0:D.properties)==null?void 0:W[(j=(R=a.noInfoObject())==null?void 0:R.column)==null?void 0:j.name])||"-"),1)])],64)):(f.openBlock(),f.createElementBlock("div",Hz,f.toDisplayString(a.noInfoObject().title),1))]))],2)}const Wz=$e(Lz,[["render",qz],["__scopeId","data-v-180f4367"]]),{Map:Gz,NavigationControl:Zz,Popup:Yz}=Ez,Xz={mixins:[Mz],components:{VsMapPopup:Wz},props:{popupVisible:{type:Boolean,default:()=>!0},map:{type:Object,default:()=>null},height:{type:String,default:()=>"400px"}},data(){return{mapId:`gis-map-${Math.floor(Math.random()*1e3)}`,features:[],popup:{geometry:null,map:null},cityBbox:null}},async mounted(){this.initMap()},computed:{mapRef(){return this}},methods:{initMap(){const t={version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{},layers:[]},e=new Gz({container:this.mapId,style:t,center:[0,0],zoom:1,interactive:!0});e.addControl(new Zz({visualizePitch:!0})),window==null||window.addEventListener("resize",()=>{e.resize()}),e.on("load",this.onMapLoad)},async onMapLoad(t){const e=t.target;e.resize();const n={id:"graymap",name:"Сіра карта",url:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",attribution:"© <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, © <a href='https://carto.com/attributions'>CARTO</a>",bounds1:"ua",image:"https://basemaps.cartocdn.com/light_all/10/601/348.png",position:0,owner:"OSM",basemap:!0};await this.$emit("update:map",e),await this.setVisible(n,!0),this.$emit("load",e),this.createPopup(),this.createBoundsLayers(),this.createAtuLayer()},createPopup(){var n,i,r,a,u,l;const{map:t}=this,e=["measure","geometry","mapbox-gl-draw-hot","mapbox-gl-draw-cold"];this.popup.map=new Yz({closeOnClick:!1}).setDOMContent((i=(n=this==null?void 0:this.$refs)==null?void 0:n.popup)==null?void 0:i.$el),t&&(t.on("mousemove",g=>{var S,E;const b=t.queryRenderedFeatures(g.point).filter(C=>{var R,j,W;const P=this.layerList.find(ee=>ee.id===C.source),D=((j=(R=P==null?void 0:P.setting)==null?void 0:R.popup)==null?void 0:j.show)===void 0?!0:P.setting.popup.show;if((this.interactiveSources.includes(C.source)&&!((W=C.properties)!=null&&W.cluster)&&D||!P&&Object.keys(C.properties).length)&&!e.includes(C.source))return C}).filter(C=>{var P,D;return!((D=(P=C.layer)==null?void 0:P.layout)!=null&&D["text-field"])});b.length&&this.popupVisible?(this.features=(b==null?void 0:b[0])||null,(S=this.popup.map)==null||S.setLngLat(Object.values(g.lngLat)).addTo(t),t.getCanvas().style.cursor=b.length?"pointer":"grab"):(this.features=null,(E=this.popup.map)==null||E.remove()),this.$emit("mouseMove",{event:g,features:b})}),t.on("touchend",this.handleMapClick),t.on("click",this.handleMapClick),t.on("dblclick",g=>{const b=t.queryRenderedFeatures(g.point);this.$emit("dbclick",{features:b,event:g})}),(l=(u=(a=(r=this==null?void 0:this.$refs)==null?void 0:r.popup)==null?void 0:a.$el)==null?void 0:u.parentElement)==null||l.addEventListener("mouseenter",()=>{var g;(g=this.popup.map)==null||g.remove()}))},createBoundsLayers(){const{map:t}=this;t&&(t.addSource("bounds-dataset",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),t.addLayer({id:"bounds-dataset-line",type:"line",source:"bounds-dataset",layout:{},paint:{"line-color":"#a91a9e","line-width":2}}))},handleMapClick(t){if(!this.map)return;const e=this.map.queryRenderedFeatures(t.point);if(!e.length)return;const n=e.filter(i=>this.interactiveSources.includes(i==null?void 0:i.source));this.$emit("mapClick",n)},homeZoom(){const{map:t}=this,e=this.cityBbox?this.cityBbox:[22.1352,44.3909,40.2276,52.3791];t==null||t.fitBounds(e,{duration:0,padding:10})}}},Kz={class:"relative"},Jz=["id"];function Qz(t,e,n,i,r,a){const u=f.resolveComponent("VsMapPopup");return f.openBlock(),f.createElementBlock("div",Kz,[f.createElementVNode("div",{id:r.mapId,style:f.normalizeStyle({height:n.height})},null,12,Jz),f.createVNode(u,{ref:"popup",object:r.features,"map-ref":a.mapRef},null,8,["object","map-ref"])])}const eB=$e(Xz,[["render",Qz]]),Qs="widget-map-source",tB={components:{VsMap:eB},props:{geometry:{type:Object,default:()=>null},zoom:{type:String,default:()=>"50"}},data(){return{map:null}},mounted(){this.geometry&&this.initGeometryLayer()},watch:{geometry(){console.log(this.zoom),this.initGeometryLayer()}},methods:{initMap(){this.geometry&&this.map&&this.initGeometryLayer()},handleMapLoad(){this.initMap()},initGeometryLayer(){const{map:t}=this;if(!t)return;const e=this.formatGeojson(this.geometry),n=t.getSource(Qs);if(this.zoomToGeometry(e),n){n.setData(e);return}t.addSource(Qs,{type:"geojson",data:e}),t.addLayer({id:`${Qs}-point`,type:"circle",source:Qs,paint:{"circle-radius":10,"circle-color":"#F84C4C"},filter:["==","$type","Point"]}),t.addLayer({id:`${Qs}-polygon`,type:"fill",source:Qs,layout:{},paint:{"fill-color":"#0080ff","fill-opacity":.5},filter:["==","$type","Polygon"]}),t.addLayer({id:`${Qs}-polygon-line`,type:"line",source:Qs,layout:{},paint:{"line-color":"#0080ff","line-width":2},filter:["==","$type","Polygon"]}),t.addLayer({id:`${Qs}-line`,type:"line",source:Qs,layout:{},paint:{"line-color":"#0080ff","line-width":3},filter:["==","$type","LineString"]})},formatGeojson(t){let e=t;const n=t==null?void 0:t.type;if(Array.isArray(t))return U1(t);if(!n)throw new Error("Unknown geometry type!");return n==="FeatureCollection"?t:(n==="Feature"&&(e=[t]),!["FeatureCollection","Feature"].includes(n)&&(e=[kz(t)]),U1(e))},zoomToGeometry(t){const{map:e}=this,n=xz(t);e.fitBounds(n,{zoom:this.zoom,padding:30,duration:0})}}};function nB(t,e,n,i,r,a){const u=f.resolveComponent("VsMap");return f.openBlock(),f.createElementBlock("div",null,[f.createVNode(u,{map:r.map,"onUpdate:map":e[0]||(e[0]=l=>r.map=l),onLoad:a.handleMapLoad},null,8,["map","onLoad"])])}const W1=$e(tB,[["render",nB]]),at=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),ay=function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,n=window.getComputedStyle(t).overflowY,i=n.indexOf("hidden")!==-1,r=n.indexOf("visible")!==-1;return e&&!i&&!r},jp=function(t,e=void 0){return!(!t||t===document.body||e&&t===e)&&(ay(t)?t:jp(t.parentElement,e))},eo=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},ly=t=>`${t||""}`.split(" ").filter(e=>!!e),to=(t,e,n)=>{t&&ly(e).forEach(i=>{t.classList.toggle(i,n||!1)})};class Ec{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 Cc={passive:!1};class iB{constructor(e,{start:n=()=>!0,move:i=()=>{},end:r=()=>{}}){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=i,this.endCallback=r;for(const a of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[a]=this[a].bind(this);this.element.addEventListener("mousedown",this.onPointerStart,Cc),this.element.addEventListener("touchstart",this.onTouchStart,Cc),this.element.addEventListener("touchmove",this.onMove,Cc),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd)}onPointerStart(e){if(!e.buttons||e.button!==0)return;const n=new Ec(e);this.currentPointers.some(i=>i.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 Ec(n),e);window.addEventListener("blur",this.onWindowBlur)}onMove(e){const n=this.currentPointers.slice(),i="changedTouches"in e?Array.from(e.changedTouches||[]).map(a=>new Ec(a)):[new Ec(e)],r=[];for(const a of i){const u=this.currentPointers.findIndex(l=>l.id===a.id);u<0||(r.push(a),this.currentPointers[u]=a)}r.length&&this.moveCallback(e,this.currentPointers.slice(),n)}onPointerEnd(e){e.buttons>0&&e.button!==0||(this.triggerPointerEnd(e,new Ec(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 Ec(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 i=this.currentPointers.findIndex(r=>r.id===n.id);i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,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,Cc),this.element.removeEventListener("touchstart",this.onTouchStart,Cc),this.element.removeEventListener("touchmove",this.onMove,Cc),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 G1(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function Z1(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const cy=t=>typeof t=="object"&&t!==null&&t.constructor===Object&&Object.prototype.toString.call(t)==="[object Object]",Tr=(t,...e)=>{const n=e.length;for(let i=0;i<n;i++){const r=e[i]||{};Object.entries(r).forEach(([a,u])=>{const l=Array.isArray(u)?[]:{};t[a]||Object.assign(t,{[a]:l}),cy(u)?Object.assign(t[a],Tr(l,u)):Array.isArray(u)?Object.assign(t,{[a]:[...u]}):Object.assign(t,{[a]:u})})}return t},uy=function(t,e){return t.split(".").reduce((n,i)=>typeof n=="object"?n[i]:void 0,e)};class Up{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?Tr({},this.constructor.defaults,e):{};for(const[n,i]of Object.entries(this.option("on")||{}))this.on(n,i)}option(e,...n){let i=uy(e,this.options);return i&&typeof i=="function"&&(i=i.call(this,this,...n)),i}optionFor(e,n,i,...r){let a=uy(n,e);var u;typeof(u=a)!="string"||isNaN(u)||isNaN(parseFloat(u))||(a=parseFloat(a)),a==="true"&&(a=!0),a==="false"&&(a=!1),a&&typeof a=="function"&&(a=a.call(this,this,e,...r));let l=uy(n,this.options);return l&&typeof l=="function"?a=l.call(this,this,e,...r,a):a===void 0&&(a=l),a===void 0?i:a}cn(e){const n=this.options.classes;return n&&n[e]||""}localize(e,n=[]){e=String(e).replace(/\{\{(\w+).?(\w+)?\}\}/g,(i,r,a)=>{let u="";return a?u=this.option(`${r[0]+r.toLowerCase().substring(1)}.l10n.${a}`):r&&(u=this.option(`l10n.${r}`)),u||(u=i),u});for(let i=0;i<n.length;i++)e=e.split(n[i][0]).join(n[i][1]);return e=e.replace(/\{\{(.*?)\}\}/g,(i,r)=>r)}on(e,n){let i=[];typeof e=="string"?i=e.split(" "):Array.isArray(e)&&(i=e),this.events||(this.events=new Map),i.forEach(r=>{let a=this.events.get(r);a||(this.events.set(r,[]),a=[]),a.includes(n)||a.push(n),this.events.set(r,a)})}off(e,n){let i=[];typeof e=="string"?i=e.split(" "):Array.isArray(e)&&(i=e),i.forEach(r=>{const a=this.events.get(r);if(Array.isArray(a)){const u=a.indexOf(n);u>-1&&a.splice(u,1)}})}emit(e,...n){[...this.events.get(e)||[]].forEach(i=>i(this,...n)),e!=="*"&&this.emit("*",e,...n)}}Object.defineProperty(Up,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(Up,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class hy extends Up{constructor(e={}){super(e),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(e={}){const n=new Map;for(const[i,r]of Object.entries(e)){const a=this.option(i),u=this.plugins[i];u||a===!1?u&&a===!1&&(u.detach(),delete this.plugins[i]):n.set(i,new r(this,a||{}))}for(const[i,r]of n)this.plugins[i]=r,r.attach()}detachPlugins(e){e=e||Object.keys(this.plugins);for(const n of e){const i=this.plugins[n];i&&i.detach(),delete this.plugins[n]}return this.emit("detachPlugins"),this}}var In;(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"})(In||(In={}));const Po=["a","b","c","d","e","f"],Y1={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"},rB={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:Y1},X1='<circle cx="25" cy="25" r="20"></circle>',dy='<div class="f-spinner"><svg viewBox="0 0 50 50">'+X1+X1+"</svg></div>",Mr=t=>t&&t!==null&&t instanceof Element&&"nodeType"in t,En=(t,e)=>{t&&ly(e).forEach(n=>{t.classList.remove(n)})},Ct=(t,e)=>{t&&ly(e).forEach(n=>{t.classList.add(n)})},Hp={a:1,b:0,c:0,d:1,e:0,f:0},sB=1e5,qp=1e4,ps="mousemove",K1="drag",J1="content",fs="auto";let py=null,fy=null;class ua extends hy{get fits(){return this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1}get isTouchDevice(){return fy===null&&(fy=window.matchMedia("(hover: none)").matches),fy}get isMobile(){return py===null&&(py=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),py}get panMode(){return this.options.panMode!==ps||this.isTouchDevice?K1:ps}get panOnlyZoomed(){const e=this.options.panOnlyZoomed;return e===fs?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,i=Math.max(e.height/n.fitHeight,e.width/n.fitWidth)||1;return Math.min(this.fullScale,i)}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 Po){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={},i={}){var r;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:In.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({},Hp)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},Hp)}),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({},ua.Plugins),i)),this.emit("attachPlugins"),this.emit("init");const a=this.content;if(a.addEventListener("load",this.onLoad),a.addEventListener("error",this.onError),this.isContentLoading){if(this.option("spinner")){e.classList.add(this.cn("isLoading"));const u=eo(dy);!e.contains(a)||a.parentElement instanceof HTMLPictureElement?this.spinner=e.appendChild(u):this.spinner=((r=a.parentElement)===null||r===void 0?void 0:r.insertBefore(u,a))||null}this.emit("beforeLoad")}else queueMicrotask(()=>{this.enable()})}initContent(){const{container:e}=this,n=this.cn(J1);let i=this.option(J1)||e.querySelector(`.${n}`);if(i||(i=e.querySelector("img,picture")||e.firstElementChild,i&&Ct(i,n)),i instanceof HTMLPictureElement&&(i=i.querySelector("img")),!i)throw new Error("No content found");this.content=i}onLoad(){const{spinner:e,container:n,state:i}=this;e&&(e.remove(),this.spinner=null),this.option("spinner")&&n.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),i===In.Init?this.enable():this.updateMetrics()}onError(){this.state!==In.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=In.Error,this.emit("error"))}getNextScale(e){const{fullScale:n,targetScale:i,coverScale:r,maxScale:a,minScale:u}=this;let l=u;switch(e){case"toggleMax":l=i-u<.5*(a-u)?a:u;break;case"toggleCover":l=i-u<.5*(r-u)?r:u;break;case"toggleZoom":l=i-u<.5*(n-u)?n:u;break;case"iterateZoom":let g=[1,n,a].sort((S,E)=>S-E),b=g.findIndex(S=>S>i+1e-5);l=g[b]||1}return l}attachObserver(){var e;const n=()=>{const{container:i,containerRect:r}=this;return Math.abs(r.width-i.getBoundingClientRect().width)>.1||Math.abs(r.height-i.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 iB(e,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener(ps,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(ps,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 i of Po)e?(this.velocity[i]*=1-e,n&&!this.isScaling&&(this.velocity[i]=Math.max(Math.min(this.velocity[i],n),-1*n)),this.current[i]+=this.velocity[i]):this.current[i]=this.target[i];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame(()=>this.animate()):this.stop("current")}setTargetForce(){for(const e of Po)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:i}=this,r=i.e+e,a=i.f+n,u=this.getBounds(),{x:l,y:g}=u,b=l.min,S=l.max,E=g.min,C=g.max;let P=0,D=0;return b!==1/0&&r<b?P=b-r:S!==1/0&&r>S&&(P=S-r),E!==1/0&&a<E?D=E-a:C!==1/0&&a>C&&(D=C-a),Math.abs(P)<1e-4&&(P=0),Math.abs(D)<1e-4&&(D=0),Object.assign(Object.assign({},u),{xDiff:P,yDiff:D,inBounds:!P&&!D})}clampTargetBounds(){const{target:e}=this,{x:n,y:i}=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)),i.min!==1/0&&(e.f=Math.max(e.f,i.min)),i.max!==1/0&&(e.f=Math.min(e.f,i.max))}calculateContentDim(e=this.current){const{content:n,contentRect:i}=this,{fitWidth:r,fitHeight:a,fullWidth:u,fullHeight:l}=i;let g=u,b=l;if(this.option("zoom")||this.angle!==0){const S=!(n instanceof HTMLImageElement)&&(window.getComputedStyle(n).maxWidth==="none"||window.getComputedStyle(n).maxHeight==="none"),E=S?u:r,C=S?l:a,P=this.getMatrix(e),D=new DOMPoint(0,0).matrixTransform(P),R=new DOMPoint(0+E,0).matrixTransform(P),j=new DOMPoint(0+E,0+C).matrixTransform(P),W=new DOMPoint(0,0+C).matrixTransform(P),ee=Math.abs(j.x-D.x),le=Math.abs(j.y-D.y),J=Math.abs(W.x-R.x),Te=Math.abs(W.y-R.y);g=Math.max(ee,J),b=Math.max(le,Te)}return{contentWidth:g,contentHeight:b}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||this.panMode===ps||this.targetScale<this.scale)return this.isBouncingX=!1,void(this.isBouncingY=!1);const{target:e}=this,{x:n,y:i,xDiff:r,yDiff:a}=this.checkBounds(),u=this.option("maxVelocity");let l=this.velocity.e,g=this.velocity.f;r!==0?(this.isBouncingX=!0,r*l<=0?l+=.14*r:(l=.14*r,n.min!==1/0&&(this.target.e=Math.max(e.e,n.min)),n.max!==1/0&&(this.target.e=Math.min(e.e,n.max))),u&&(l=Math.max(Math.min(l,u),-1*u))):this.isBouncingX=!1,a!==0?(this.isBouncingY=!0,a*g<=0?g+=.14*a:(g=.14*a,i.min!==1/0&&(this.target.f=Math.max(e.f,i.min)),i.max!==1/0&&(this.target.f=Math.min(e.f,i.max))),u&&(g=Math.max(Math.min(g,u),-1*u))):this.isBouncingY=!1,this.isBouncingX&&(this.velocity.e=l),this.isBouncingY&&(this.velocity.f=g)}enable(){const{content:e}=this,n=new DOMMatrixReadOnly(window.getComputedStyle(e).transform);for(const i of Po)this.current[i]=this.target[i]=n[i];this.updateMetrics(),this.attachObserver(),this.attachEvents(),this.state=In.Ready,this.emit("ready")}onClick(e){var n;e.type==="click"&&e.detail===0&&(this.dragOffset.x=0,this.dragOffset.y=0),this.isDragging&&((n=this.pointerTracker)===null||n===void 0||n.clear(),this.trackingPoints=[],this.startDecelAnim());const i=e.target;if(!i||e.defaultPrevented)return;if(i.hasAttribute("disabled"))return e.preventDefault(),void e.stopPropagation();if((()=>{const P=window.getSelection();return P&&P.type==="Range"})()&&!i.closest("button"))return;const r=i.closest("[data-panzoom-action]"),a=i.closest("[data-panzoom-change]"),u=r||a,l=u&&Mr(u)?u.dataset:null;if(l){const P=l.panzoomChange,D=l.panzoomAction;if((P||D)&&e.preventDefault(),P){let R={};try{R=JSON.parse(P)}catch{console&&console.warn("The given data was not valid JSON")}return void this.applyChange(R)}if(D)return void(this[D]&&this[D]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return e.preventDefault(),void e.stopPropagation();if(i.closest("[data-fancybox]"))return;const g=this.content.getBoundingClientRect(),b=this.dragStart;if(b.time&&!this.canZoomOut()&&(Math.abs(g.x-b.x)>2||Math.abs(g.y-b.y)>2))return;this.dragStart.time=0;const S=P=>{this.option("zoom",e)&&P&&typeof P=="string"&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(P)&&typeof this[P]=="function"&&(e.preventDefault(),this[P]({event:e}))},E=this.option("click",e),C=this.option("dblClick",e);C?(this.clicks++,this.clicks==1&&(this.clickTimer=setTimeout(()=>{this.clicks===1?(this.emit("click",e),!e.defaultPrevented&&E&&S(E)):(this.emit("dblClick",e),e.defaultPrevented||S(C)),this.clicks=0,this.clickTimer=null},350))):(this.emit("click",e),!e.defaultPrevented&&E&&S(E))}addTrackingPoint(e){const n=this.trackingPoints.filter(i=>i.time>Date.now()-100);n.push(e),this.trackingPoints=n}onPointerDown(e,n,i){var r;if(this.option("touch",e)===!1)return!1;this.pwt=0,this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const a=this.content.getBoundingClientRect();if(this.dragStart={x:a.x,y:a.y,top:a.top,left:a.left,time:Date.now()},this.clickTimer)return!1;if(this.panMode===ps&&this.targetScale>1)return e.preventDefault(),e.stopPropagation(),!1;const u=e.composedPath()[0];if(!i.length){if(["TEXTAREA","OPTION","INPUT","SELECT","VIDEO","IFRAME"].includes(u.nodeName)||u.closest("[contenteditable],[data-selectable],[data-draggable],[data-clickable],[data-panzoom-change],[data-panzoom-action]"))return!1;(r=window.getSelection())===null||r===void 0||r.removeAllRanges()}if(e.type==="mousedown")["A","BUTTON"].includes(u.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,i){if(this.option("touch",e)===!1||!this.isDragging||n.length<2&&this.panOnlyZoomed&&at(this.targetScale)<=at(this.minScale)||(this.emit("touchMove",e),e.defaultPrevented))return;this.addTrackingPoint(n[0]);const{content:r}=this,a=Z1(i[0],i[1]),u=Z1(n[0],n[1]);let l=0,g=0;if(n.length>1){const le=r.getBoundingClientRect();l=a.clientX-le.left-.5*le.width,g=a.clientY-le.top-.5*le.height}const b=G1(i[0],i[1]),S=G1(n[0],n[1]);let E=b?S/b:1,C=u.clientX-a.clientX,P=u.clientY-a.clientY;this.dragOffset.x+=C,this.dragOffset.y+=P,this.dragOffset.time=Date.now()-this.dragStart.time;let D=at(this.targetScale)===at(this.minScale)&&this.option("lockAxis");if(D&&!this.lockedAxis)if(D==="xy"||D==="y"||e.type==="touchmove"){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void e.preventDefault();const le=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=le>45&&le<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,C=0,P=0}else this.lockedAxis=D;if(jp(e.target,this.content)&&(D="x",this.dragOffset.y=0),D&&D!=="xy"&&this.lockedAxis!==D&&at(this.targetScale)===at(this.minScale))return;e.cancelable&&e.preventDefault(),this.container.classList.add(this.cn("isDragging"));const R=this.checkBounds(C,P);this.option("rubberband")?(this.isInfinite!=="x"&&(R.xDiff>0&&C<0||R.xDiff<0&&C>0)&&(C*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*R.xDiff))),this.isInfinite!=="y"&&(R.yDiff>0&&P<0||R.yDiff<0&&P>0)&&(P*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*R.yDiff)))):(R.xDiff&&(C=0),R.yDiff&&(P=0));const j=this.targetScale,W=this.minScale,ee=this.maxScale;j<.5*W&&(E=Math.max(E,W)),j>1.5*ee&&(E=Math.min(E,ee)),this.lockedAxis==="y"&&at(j)===at(W)&&(C=0),this.lockedAxis==="x"&&at(j)===at(W)&&(P=0),this.applyChange({originX:l,originY:g,panX:C,panY:P,scale:E,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(e,n,i){if(i.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=[]),jp(e.target,this.content)&&this.lockedAxis==="y"&&(this.trackingPoints=[]),this.emit("touchEnd",e),this.isDragging=!1,this.lockedAxis=!1,this.state!==In.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 le of Po)this.velocity[le]=0;this.target.e=this.current.e,this.target.f=this.current.f,En(this.container,"is-scaling"),En(this.container,"is-animating"),this.isTicking=!1;const{trackingPoints:i}=this,r=i[0],a=i[i.length-1];let u=0,l=0,g=0;a&&r&&(u=a.clientX-r.clientX,l=a.clientY-r.clientY,g=a.time-r.time);const b=((e=window.visualViewport)===null||e===void 0?void 0:e.scale)||1;b!==1&&(u*=b,l*=b);let S=0,E=0,C=0,P=0,D=this.option("decelFriction");const R=this.targetScale;if(g>0){C=Math.abs(u)>3?u/(g/30):0,P=Math.abs(l)>3?l/(g/30):0;const le=this.option("maxVelocity");le&&(C=Math.max(Math.min(C,le),-1*le),P=Math.max(Math.min(P,le),-1*le))}C&&(S=C/(1/(1-D)-1)),P&&(E=P/(1/(1-D)-1)),(this.option("lockAxis")==="y"||this.option("lockAxis")==="xy"&&this.lockedAxis==="y"&&at(R)===this.minScale)&&(S=C=0),(this.option("lockAxis")==="x"||this.option("lockAxis")==="xy"&&this.lockedAxis==="x"&&at(R)===this.minScale)&&(E=P=0);const j=this.dragOffset.x,W=this.dragOffset.y,ee=this.option("dragMinThreshold")||0;Math.abs(j)<ee&&Math.abs(W)<ee&&(S=E=0,C=P=0),(this.option("zoom")&&(R<this.minScale-1e-5||R>this.maxScale+1e-5)||n&&!S&&!E)&&(D=.35),this.applyChange({panX:S,panY:E,friction:D}),this.emit("decel",C,P,j,W)}onWheel(e){var n=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(a,u){return Math.abs(u)>Math.abs(a)?u:a});const i=Math.max(-1,Math.min(1,n));if(this.emit("wheel",e,i),this.panMode===ps||e.defaultPrevented)return;const r=this.option("wheel");r==="pan"?(e.preventDefault(),this.panOnlyZoomed&&!this.canZoomOut()||this.applyChange({panX:2*-e.deltaX,panY:2*-e.deltaY,bounce:!1})):r==="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:i,contentRect:r}=this,a=Object.assign({},Hp);for(const j of Po){const W=j=="e"||j==="f"?qp:sB;a[j]=at(e[j],W),Math.abs(n[j]-e[j])<(j=="e"||j==="f"?.51:.001)&&(e[j]=n[j])}let{a:u,b:l,c:g,d:b,e:S,f:E}=a,C=`matrix(${u}, ${l}, ${g}, ${b}, ${S}, ${E})`,P=i.parentElement instanceof HTMLPictureElement?i.parentElement:i;if(this.option("transformParent")&&(P=P.parentElement||P),P.style.transform===C)return;P.style.transform=C;const{contentWidth:D,contentHeight:R}=this.calculateContentDim();r.width=D,r.height=R,this.emit("afterTransform")}updateMetrics(e=!1){var n;if(!this||this.state===In.Destroy||this.isContentLoading)return;const i=Math.max(1,((n=window.visualViewport)===null||n===void 0?void 0:n.scale)||1),{container:r,content:a}=this,u=a instanceof HTMLImageElement,l=r.getBoundingClientRect(),g=getComputedStyle(this.container);let b=l.width*i,S=l.height*i;const E=parseFloat(g.paddingTop)+parseFloat(g.paddingBottom),C=b-(parseFloat(g.paddingLeft)+parseFloat(g.paddingRight)),P=S-E;this.containerRect={width:b,height:S,innerWidth:C,innerHeight:P};const D=parseFloat(a.dataset.width||"")||(pt=>{let zt=0;return zt=pt instanceof HTMLImageElement?pt.naturalWidth:pt instanceof SVGElement?pt.width.baseVal.value:Math.max(pt.offsetWidth,pt.scrollWidth),zt||0})(a),R=parseFloat(a.dataset.height||"")||(pt=>{let zt=0;return zt=pt instanceof HTMLImageElement?pt.naturalHeight:pt instanceof SVGElement?pt.height.baseVal.value:Math.max(pt.offsetHeight,pt.scrollHeight),zt||0})(a);let j=this.option("width",D)||fs,W=this.option("height",R)||fs;const ee=j===fs,le=W===fs;typeof j!="number"&&(j=D),typeof W!="number"&&(W=R),ee&&(j=D*(W/R)),le&&(W=R/(D/j));let J=a.parentElement instanceof HTMLPictureElement?a.parentElement:a;this.option("transformParent")&&(J=J.parentElement||J);const Te=J.getAttribute("style")||"";J.style.setProperty("transform","none","important"),u&&(J.style.width="",J.style.height=""),J.offsetHeight;const xe=a.getBoundingClientRect();let Ae=xe.width*i,je=xe.height*i,De=Ae,Ke=je;Ae=Math.min(Ae,j),je=Math.min(je,W),u?{width:Ae,height:je}=((pt,zt,Xt,on)=>{const $t=Xt/pt,Kt=on/zt,Cn=Math.min($t,Kt);return{width:pt*=Cn,height:zt*=Cn}})(j,W,Ae,je):(Ae=Math.min(Ae,j),je=Math.min(je,W));let rt=.5*(Ke-je),Rt=.5*(De-Ae);this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:xe.top-l.top+rt,bottom:l.bottom-xe.bottom+rt,left:xe.left-l.left+Rt,right:l.right-xe.right+Rt,fitWidth:Ae,fitHeight:je,width:Ae,height:je,fullWidth:j,fullHeight:W}),J.style.cssText=Te,u&&(J.style.width=`${Ae}px`,J.style.height=`${je}px`),this.setTransform(),e!==!0&&this.emit("refresh"),this.ignoreBounds||(at(this.targetScale)<at(this.minScale)?this.zoomTo(this.minScale,{friction:0}):this.targetScale>this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===In.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}calculateBounds(){const{contentWidth:e,contentHeight:n}=this.calculateContentDim(this.target),{targetScale:i,lockedAxis:r}=this,{fitWidth:a,fitHeight:u}=this.contentRect;let l=0,g=0,b=0,S=0;const E=this.option("infinite");if(E===!0||r&&E===r)l=-1/0,b=1/0,g=-1/0,S=1/0;else{let{containerRect:C,contentRect:P}=this,D=at(a*i,qp),R=at(u*i,qp),{innerWidth:j,innerHeight:W}=C;if(C.width===D&&(j=C.width),C.width===R&&(W=C.height),e>j){b=.5*(e-j),l=-1*b;let ee=.5*(P.right-P.left);l+=ee,b+=ee}if(a>j&&e<j&&(l-=.5*(a-j),b-=.5*(a-j)),n>W){S=.5*(n-W),g=-1*S;let ee=.5*(P.bottom-P.top);g+=ee,S+=ee}u>W&&n<W&&(l-=.5*(u-W),b-=.5*(u-W))}return{x:{min:l,max:b},y:{min:g,max:S}}}getBounds(){const e=this.option("bounds");return e!==fs?e:this.calculateBounds()}updateControls(){const e=this,n=e.container,{panMode:i,contentRect:r,targetScale:a,minScale:u}=e;let l=u,g=e.option("click")||!1;g&&(l=e.getNextScale(g));let b=e.canZoomIn(),S=e.canZoomOut(),E=i===K1&&!!this.option("touch"),C=S&&E;if(E&&(at(a)<at(u)&&!this.panOnlyZoomed&&(C=!0),(at(r.width,1)>at(r.fitWidth,1)||at(r.height,1)>at(r.fitHeight,1))&&(C=!0)),at(r.width*a,1)<at(r.fitWidth,1)&&(C=!1),i===ps&&(C=!1),to(n,this.cn("isDraggable"),C),!this.option("zoom"))return;let P=b&&at(l)>at(a),D=!P&&!C&&S&&at(l)<at(a);to(n,this.cn("canZoomIn"),P),to(n,this.cn("canZoomOut"),D);for(const R of n.querySelectorAll("[data-panzoom-action]")){let j=!1,W=!1;switch(R.dataset.panzoomAction){case"zoomIn":b?j=!0:W=!0;break;case"zoomOut":S?j=!0:W=!0;break;case"toggleZoom":case"iterateZoom":b||S?j=!0:W=!0;const ee=R.querySelector("g");ee&&(ee.style.display=b?"":"none")}j?(R.removeAttribute("disabled"),R.removeAttribute("tabindex")):W&&(R.setAttribute("disabled",""),R.setAttribute("tabindex","-1"))}}panTo({x:e=this.target.e,y:n=this.target.f,scale:i=this.targetScale,friction:r=this.option("friction"),angle:a=0,originX:u=0,originY:l=0,flipX:g=!1,flipY:b=!1,ignoreBounds:S=!1}){this.state!==In.Destroy&&this.applyChange({panX:e-this.target.e,panY:n-this.target.f,scale:i/this.targetScale,angle:a,originX:u,originY:l,friction:r,flipX:g,flipY:b,ignoreBounds:S})}applyChange({panX:e=0,panY:n=0,scale:i=1,angle:r=0,originX:a=-this.current.e,originY:u=-this.current.f,friction:l=this.option("friction"),flipX:g=!1,flipY:b=!1,ignoreBounds:S=!1,bounce:E=this.option("bounce")}){const C=this.state;if(C===In.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.friction=l||0,this.ignoreBounds=S;const{current:P}=this,D=P.e,R=P.f,j=this.getMatrix(this.target);let W=new DOMMatrix().translate(D,R).translate(a,u).translate(e,n);if(this.option("zoom")){if(!S){const ee=this.targetScale,le=this.minScale,J=this.maxScale;ee*i<le&&(i=le/ee),ee*i>J&&(i=J/ee)}W=W.scale(i)}W=W.translate(-a,-u).translate(-D,-R).multiply(j),r&&(W=W.rotate(r)),g&&(W=W.scale(-1,1)),b&&(W=W.scale(1,-1));for(const ee of Po)ee!=="e"&&ee!=="f"&&(W[ee]>this.minScale+1e-5||W[ee]<this.minScale-1e-5)?this.target[ee]=W[ee]:this.target[ee]=at(W[ee],qp);(this.targetScale<this.scale||Math.abs(i-1)>.1||this.panMode===ps||E===!1)&&!S&&this.clampTargetBounds(),C===In.Init?this.animate():this.isResting||(this.state=In.Panning,this.requestTick())}stop(e=!1){if(this.state===In.Init||this.state===In.Destroy)return;const n=this.isTicking;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const i of Po)this.velocity[i]=0,e==="current"?this.current[i]=this.target[i]:e==="target"&&(this.target[i]=this.current[i]);this.setTransform(),En(this.container,"is-scaling"),En(this.container,"is-animating"),this.isTicking=!1,this.state=In.Ready,n&&(this.emit("endAnimation"),this.updateControls())}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),Ct(this.container,"is-animating"),this.isScaling&&Ct(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!==ps||!e||at(this.targetScale)<=at(this.minScale))return;this.emit("mouseMove",e);const{container:i,containerRect:r,contentRect:a}=this,u=r.width,l=r.height,g=i.getBoundingClientRect(),b=(e.clientX||0)-g.left,S=(e.clientY||0)-g.top;let{contentWidth:E,contentHeight:C}=this.calculateContentDim(this.target);const P=this.option("mouseMoveFactor");P>1&&(E!==u&&(E*=P),C!==l&&(C*=P));let D=.5*(E-u)-b/u*100/100*(E-u);D+=.5*(a.right-a.left);let R=.5*(C-l)-S/l*100/100*(C-l);R+=.5*(a.bottom-a.top),this.applyChange({panX:D-this.target.e,panY:R-this.target.f,friction:n})}zoomWithWheel(e){if(this.state===In.Destroy||this.state===In.Init)return;const n=Date.now();if(n-this.pwt<45)return void e.preventDefault();this.pwt=n;var i=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(b,S){return Math.abs(S)>Math.abs(b)?S:b});const r=Math.max(-1,Math.min(1,i)),{targetScale:a,maxScale:u,minScale:l}=this;let g=a*(100+45*r)/100;at(g)<at(l)&&at(a)<=at(l)?(this.cwd+=Math.abs(r),g=l):at(g)>at(u)&&at(a)>=at(u)?(this.cwd+=Math.abs(r),g=u):(this.cwd=0,g=Math.max(Math.min(g,u),l)),this.cwd>this.option("wheelLimit")||(e.preventDefault(),at(g)!==at(a)&&this.zoomTo(g,{event:e}))}canZoomIn(){return this.option("zoom")&&(at(this.contentRect.width,1)<at(this.contentRect.fitWidth,1)||at(this.targetScale)<at(this.maxScale))}canZoomOut(){return this.option("zoom")&&at(this.targetScale)>at(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=fs,originX:i=fs,originY:r=fs,event:a}={}){if(this.isContentLoading||this.state===In.Destroy)return;const{targetScale:u,fullScale:l,maxScale:g,coverScale:b}=this;if(this.stop(),this.panMode===ps&&(a=this.pmme||a),a||i===fs||r===fs){const E=this.content.getBoundingClientRect(),C=this.container.getBoundingClientRect(),P=a?a.clientX:C.left+.5*C.width,D=a?a.clientY:C.top+.5*C.height;i=P-E.left-.5*E.width,r=D-E.top-.5*E.height}let S=1;typeof e=="number"?S=e:e==="full"?S=l:e==="cover"?S=b:e==="max"?S=g:e==="fit"?S=1:e==="next"&&(S=this.getNextScale("iterateZoom")),S=S/u||1,n=n===fs?S>1?.15:.25:n,this.applyChange({scale:S,originX:i,originY:r,friction:n}),a&&this.panMode===ps&&this.panWithMouse(a,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:i}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-i.e,panY:.5*e.height-(n.top+.5*n.fitHeight)-i.f,scale:e.width/n.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:e,contentRect:n,target:i}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-i.e,panY:.5*e.innerHeight-(n.top+.5*n.fitHeight)-i.f,scale:e.height/n.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:e}=this,n=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");e.classList.toggle(n);const r=e.classList.contains(n);r?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(r?"enterFS":"exitFS")}getMatrix(e=this.current){const{a:n,b:i,c:r,d:a,e:u,f:l}=e;return new DOMMatrix([n,i,r,a,u,l])}reset(e){if(this.state!==In.Init&&this.state!==In.Destroy){this.stop("current");for(const n of Po)this.target[n]=Hp[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=In.Panning,this.requestTick())}}destroy(){this.stop(),this.state=In.Destroy,this.detachEvents(),this.detachObserver();const{container:e,content:n}=this,i=this.option("classes")||{};for(const r of Object.values(i))e.classList.remove(r+"");n&&(n.removeEventListener("load",this.onLoad),n.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(ua,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:rB}),Object.defineProperty(ua,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const Q1=function(t,e){let n=!0;return(...i)=>{n&&(n=!1,t(...i),setTimeout(()=>{n=!0},e))}},ev=(t,e)=>{let n=[];return t.childNodes.forEach(i=>{i.nodeType!==Node.ELEMENT_NODE||e&&!i.matches(e)||n.push(i)}),n},oB={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 hi;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"})(hi||(hi={}));const my=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)},aB=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class Vs extends Up{constructor(e,n){super(n),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:e})}attach(){}detach(){}}const lB={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:'<button type="button" data-carousel-page="%i" aria-label="{{GOTO}}"><span class="f-carousel__dot" aria-hidden="true"></span></button>',dynamicFrom:11,maxCount:1/0,minCount:2};class tv extends Vs{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"),Ct(e,this.cn("list")),e.setAttribute("role","tablist");const n=this.instance.container;n.appendChild(e),Ct(n,this.cn("hasDots")),this.list=e}return e}refresh(){var e;const n=this.instance.pages.length,i=Math.min(2,this.option("minCount")),r=Math.max(2e3,this.option("maxCount")),a=this.option("dynamicFrom");if(n<i||n>r)return void this.cleanup();const u=typeof a=="number"&&n>5&&n>=a,l=!this.list||this.isDynamic!==u||this.list.children.length!==n;l&&this.cleanup();const g=this.build();if(to(g,this.cn("isDynamic"),!!u),l)for(let E=0;E<n;E++)g.append(this.createItem(E));let b,S=0;for(const E of[...g.children]){const C=S===this.instance.page;C&&(b=E),to(E,this.cn("isCurrent"),C),(e=E.children[0])===null||e===void 0||e.setAttribute("aria-selected",C?"true":"false");for(const P of["isBeforePrev","isPrev","isNext","isAfterNext"])En(E,this.cn(P));S++}if(b=b||g.firstChild,u&&b){const E=b.previousElementSibling,C=E&&E.previousElementSibling;Ct(E,this.cn("isPrev")),Ct(C,this.cn("isBeforePrev"));const P=b.nextElementSibling,D=P&&P.nextElementSibling;Ct(P,this.cn("isNext")),Ct(D,this.cn("isAfterNext"))}this.isDynamic=u}createItem(e=0){var n;const i=document.createElement("li");i.setAttribute("role","presentation");const r=eo(this.instance.localize(this.option("dotTpl"),[["%d",e+1]]).replace(/\%i/g,e+""));return i.appendChild(r),(n=i.children[0])===null||n===void 0||n.setAttribute("role","tab"),i}cleanup(){this.list&&(this.list.remove(),this.list=null),this.isDynamic=!1,En(this.instance.container,this.cn("hasDots"))}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(tv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:lB});const Wp="disabled",Gp="next",nv="prev";class iv extends Vs{constructor(){super(...arguments),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prev",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"next",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isDom",{enumerable:!0,configurable:!0,writable:!0,value:!1})}onRefresh(){const e=this.instance,n=e.pages.length,i=e.page;if(n<2)return void this.cleanup();this.build();let r=this.prev,a=this.next;r&&a&&(r.removeAttribute(Wp),a.removeAttribute(Wp),e.isInfinite||(i<=0&&r.setAttribute(Wp,""),i>=n-1&&a.setAttribute(Wp,"")))}addBtn(e){var n;const i=this.instance,r=document.createElement("button");r.setAttribute("tabindex","0"),r.setAttribute("title",i.localize(`{{${e.toUpperCase()}}}`)),Ct(r,this.cn("button")+" "+this.cn(e===Gp?"isNext":"isPrev"));const a=i.isRTL?e===Gp?nv:Gp:e;var u;return r.innerHTML=i.localize(this.option(`${a}Tpl`)),r.dataset[`carousel${u=e,u?u.match("^[a-z]")?u.charAt(0).toUpperCase()+u.substring(1):u:""}`]="true",(n=this.container)===null||n===void 0||n.appendChild(r),r}build(){const e=this.instance.container,n=this.cn("container");let{container:i,prev:r,next:a}=this;i||(i=e.querySelector("."+n),this.isDom=!!i),i||(i=document.createElement("div"),Ct(i,n),e.appendChild(i)),this.container=i,a||(a=i.querySelector("[data-carousel-next]")),a||(a=this.addBtn(Gp)),this.next=a,r||(r=i.querySelector("[data-carousel-prev]")),r||(r=this.addBtn(nv)),this.prev=r}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(iv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M9 3l9 9-9 9"/></svg>',prevTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M15 3l-9 9 9 9"/></svg>'}});class rv extends Vs{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===hi.Ready?this.onNavReady(e):e.on("ready",this.onNavReady),n.state===hi.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,i){this.onNavTouch(e,e.panzoom,i)}onNavTouch(e,n,i){var r,a;if(Math.abs(n.dragOffset.x)>3||Math.abs(n.dragOffset.y)>3)return;const u=i.target,{nav:l,target:g}=this;if(!l||!g||!u)return;const b=u.closest("[data-index]");if(i.stopPropagation(),i.preventDefault(),!b)return;const S=parseInt(b.dataset.index||"",10)||0,E=g.getPageForSlide(S),C=l.getPageForSlide(S);l.slideTo(C),g.slideTo(E,{friction:((a=(r=this.nav)===null||r===void 0?void 0:r.plugins)===null||a===void 0?void 0:a.Sync.option("friction"))||0}),this.markSelectedSlide(S)}onNavCreateSlide(e,n){n.index===this.selectedIndex&&this.markSelectedSlide(n.index)}onTargetChange(){var e,n;const{target:i,nav:r}=this;if(!i||!r||r.state!==hi.Ready||i.state!==hi.Ready)return;const a=(n=(e=i.pages[i.page])===null||e===void 0?void 0:e.slides[0])===null||n===void 0?void 0:n.index,u=r.getPageForSlide(a);this.markSelectedSlide(a),r.slideTo(u,r.prevPage===null&&i.prevPage===null?{friction:0}:void 0)}markSelectedSlide(e){const n=this.nav;n&&n.state===hi.Ready&&(this.selectedIndex=e,[...n.slides].map(i=>{i.el&&i.el.classList[i.index===e?"add":"remove"]("is-nav-selected")}))}attach(){const e=this;let n=e.options.target,i=e.options.nav;n?e.addAsNavFor(n):i&&e.addAsTargetFor(i)}detach(){const e=this,n=e.nav,i=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,i&&(i.off("ready",e.onTargetReady),i.off("refresh",e.onTargetChange),i.off("change",e.onTargetChange)),e.target=null}}Object.defineProperty(rv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const cB={Navigation:iv,Dots:tv,Sync:rv},Zp="animationend",sv="isSelected",Yp="slide";class ha extends hy{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===hi.Ready}get isInfinite(){let e=!1;const{contentDim:n,viewportDim:i,pages:r,slides:a}=this,u=a[0];return r.length>=2&&u&&n+u.dim>=i&&(e=this.option("infinite")),e}get isRTL(){return this.option("direction")==="rtl"}get isHorizontal(){return this.option("axis")==="x"}constructor(e,n={},i={}){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:hi.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||!Mr(e))throw new Error("No Element found");this.container=e,this.slideNext=Q1(this.slideNext.bind(this),150),this.slidePrev=Q1(this.slidePrev.bind(this),150),this.userOptions=n,this.userPlugins=i,queueMicrotask(()=>{this.processOptions()})}processOptions(){var e,n;const i=Tr({},ha.defaults,this.userOptions);let r="";const a=i.breakpoints;if(a&&cy(a))for(const[u,l]of Object.entries(a))window.matchMedia(u).matches&&cy(l)&&(r+=u,Tr(i,l));r===this.bp&&this.state!==hi.Init||(this.bp=r,this.state===hi.Ready&&(i.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!==hi.Init&&this.destroy(),super.setOptions(i),this.option("enabled")===!1?this.attachEvents():setTimeout(()=>{this.init()},0))}init(){this.state=hi.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},ha.Plugins),this.userPlugins)),this.emit("attachPlugins"),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=hi.Ready,this.emit("ready")}initLayout(){const{container:e}=this,n=this.option("classes");Ct(e,this.cn("container")),to(e,n.isLTR,!this.isRTL),to(e,n.isRTL,this.isRTL),to(e,n.isVertical,!this.isHorizontal),to(e,n.isHorizontal,this.isHorizontal);let i=this.option("viewport")||e.querySelector(`.${n.viewport}`);i||(i=document.createElement("div"),Ct(i,n.viewport),i.append(...ev(e,`.${n.slide}`)),e.prepend(i)),i.addEventListener("scroll",this.onScroll);let r=this.option("track")||e.querySelector(`.${n.track}`);r||(r=document.createElement("div"),Ct(r,n.track),r.append(...Array.from(i.childNodes))),r.setAttribute("aria-live","polite"),i.contains(r)||i.prepend(r),this.viewport=i,this.track=r,this.emit("initLayout")}initSlides(){const{track:e}=this;if(!e)return;const n=[...this.slides],i=[];[...ev(e,`.${this.cn(Yp)}`)].forEach(r=>{if(Mr(r)){const a=my({el:r,isDom:!0,index:this.slides.length});i.push(a)}});for(let r of[...this.option("slides",[])||[],...n])i.push(my(r));this.slides=i;for(let r=0;r<this.slides.length;r++)this.slides[r].index=r;for(const r of i)this.emit("beforeInitSlide",r,r.index),this.emit("initSlide",r,r.index);this.emit("initSlides")}setInitialPage(){const e=this.option("initialSlide");this.page=typeof e=="number"?this.getPageForSlide(e):parseInt(this.option("initialPage",0)+"",10)||0}setInitialPosition(){const{track:e,pages:n,isHorizontal:i}=this;if(!e||!n.length)return;let r=this.page;n[r]||(this.page=r=0);const a=(n[r].pos||0)*(this.isRTL&&i?1:-1),u=i?`${a}px`:"0",l=i?"0":`${a}px`;e.style.transform=`translate3d(${u}, ${l}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const e=this.option("Panzoom")||{};this.panzoom=new ua(this.viewport,Tr({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,click:!1,dblClick:!1,touch:n=>!(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,i,...r)=>{this.emit(`Panzoom.${i}`,n,...r)}),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:i}=this;let r=this.option("slidesPerPage");r=(r==="auto"||n<=i)&&this.option("fill")!==!1?1/0:parseFloat(r+"");let a=0,u=0,l=0;for(const g of this.slides)(!e.length||u+g.dim-i>.05||l>=r)&&(e.push(aB()),a=e.length-1,u=0,l=0),e[a].slides.push(g),u+=g.dim+g.gap,l++;return e}processPages(){const e=this.pages,{contentDim:n,viewportDim:i,isInfinite:r}=this,a=this.option("center"),u=this.option("fill"),l=u&&a&&n>i&&!r;if(e.forEach((S,E)=>{var C;S.index=E,S.pos=((C=S.slides[0])===null||C===void 0?void 0:C.pos)||0,S.dim=0;for(const[P,D]of S.slides.entries())S.dim+=D.dim,P<S.slides.length-1&&(S.dim+=D.gap);l&&S.pos+.5*S.dim<.5*i?S.pos=0:l&&S.pos+.5*S.dim>=n-.5*i?S.pos=n-i:a&&(S.pos+=-.5*(i-S.dim))}),e.forEach(S=>{u&&!r&&n>i&&(S.pos=Math.max(S.pos,0),S.pos=Math.min(S.pos,n-i)),S.pos=at(S.pos,1e3),S.dim=at(S.dim,1e3),Math.abs(S.pos)<=.1&&(S.pos=0)}),r)return e;const g=[];let b;return e.forEach(S=>{const E=Object.assign({},S);b&&E.pos===b.pos?(b.dim+=E.dim,b.slides=[...b.slides,...E.slides]):(E.index=g.length,b=E,g.push(E))}),g}getPageFromIndex(e=0){const n=this.pages.length;let i;return e=parseInt((e||0).toString())||0,i=this.isInfinite?(e%n+n)%n:Math.max(Math.min(e,n-1),0),i}getSlideMetrics(e){var n,i;const r=this.isHorizontal?"width":"height";let a=0,u=0,l=e.el;const g=!(!l||l.parentNode);if(l?a=parseFloat(l.dataset[r]||"")||0:(l=document.createElement("div"),l.style.visibility="hidden",(this.track||document.body).prepend(l)),Ct(l,this.cn(Yp)+" "+e.class+" "+e.customClass),a)l.style[r]=`${a}px`,l.style[r==="width"?"height":"width"]="";else{g&&(this.track||document.body).prepend(l),a=l.getBoundingClientRect()[r]*Math.max(1,((n=window.visualViewport)===null||n===void 0?void 0:n.scale)||1);let S=l[this.isHorizontal?"offsetWidth":"offsetHeight"];S-1>a&&(a=S)}const b=getComputedStyle(l);return b.boxSizing==="content-box"&&(this.isHorizontal?(a+=parseFloat(b.paddingLeft)||0,a+=parseFloat(b.paddingRight)||0):(a+=parseFloat(b.paddingTop)||0,a+=parseFloat(b.paddingBottom)||0)),u=parseFloat(b[this.isHorizontal?"marginRight":"marginBottom"])||0,g?(i=l.parentElement)===null||i===void 0||i.removeChild(l):e.el||l.remove(),{dim:at(a,1e3),gap:at(u,1e3)}}getBounds(){const{isInfinite:e,isRTL:n,isHorizontal:i,pages:r}=this;let a={min:0,max:0};if(e)a={min:-1/0,max:1/0};else if(r.length){const u=r[0].pos,l=r[r.length-1].pos;a=n&&i?{min:u,max:l}:{min:-1*l,max:-1*u}}return{x:i?a:{min:0,max:0},y:i?{min:0,max:0}:a}}repositionSlides(){let e,{isHorizontal:n,isRTL:i,isInfinite:r,viewport:a,viewportDim:u,contentDim:l,page:g,pages:b,slides:S,panzoom:E}=this,C=0,P=0,D=0,R=0;E?R=-1*E.current[this.axis]:b[g]&&(R=b[g].pos||0),e=n?i?"right":"left":"top",i&&n&&(R*=-1);for(const le of S){const J=le.el;J?(e==="top"?(J.style.right="",J.style.left=""):J.style.top="",le.index!==C?J.style[e]=P===0?"":`${at(P,1e3)}px`:J.style[e]="",D+=le.dim+le.gap,C++):P+=le.dim+le.gap}if(r&&D&&a){let le=getComputedStyle(a),J="padding",Te=n?"Right":"Bottom",xe=parseFloat(le[J+(n?"Left":"Top")]);R-=xe,u+=xe,u+=parseFloat(le[J+Te]);for(const Ae of S)Ae.el&&(at(Ae.pos)<at(u)&&at(Ae.pos+Ae.dim+Ae.gap)<at(R)&&at(R)>at(l-u)&&(Ae.el.style[e]=`${at(P+D,1e3)}px`),at(Ae.pos+Ae.gap)>=at(l-u)&&at(Ae.pos)>at(R+u)&&at(R)<at(u)&&(Ae.el.style[e]=`-${at(D,1e3)}px`))}let j,W,ee=[...this.inTransition];if(ee.length>1&&(j=b[ee[0]],W=b[ee[1]]),j&&W){let le=0;for(const J of S)J.el?this.inTransition.has(J.index)&&j.slides.indexOf(J)<0&&(J.el.style[e]=`${at(le+(j.pos-W.pos),1e3)}px`):le+=J.dim+J.gap}}createSlideEl(e){const{track:n,slides:i}=this;if(!n||!e||e.el&&e.el.parentNode)return;const r=e.el||document.createElement("div");Ct(r,this.cn(Yp)),Ct(r,e.class),Ct(r,e.customClass);const a=e.html;a&&(a instanceof HTMLElement?r.appendChild(a):r.innerHTML=e.html+"");const u=[];i.forEach((S,E)=>{S.el&&u.push(E)});const l=e.index;let g=null;u.length&&(g=i[u.reduce((S,E)=>Math.abs(E-l)<Math.abs(S-l)?E:S)]);const b=g&&g.el&&g.el.parentNode?g.index<e.index?g.el.nextSibling:g.el:null;n.insertBefore(r,n.contains(b)?b:null),e.el=r,this.emit("createSlide",e)}removeSlideEl(e,n=!1){const i=e==null?void 0:e.el;if(!i||!i.parentNode)return;const r=this.cn(sv);if(i.classList.contains(r)&&(En(i,r),this.emit("unselectSlide",e)),e.isDom&&!n)return i.removeAttribute("aria-hidden"),i.removeAttribute("data-index"),void(i.style.left="");this.emit("removeSlide",e);const a=new CustomEvent(Zp);i.dispatchEvent(a),e.el&&(e.el.remove(),e.el=null)}transitionTo(e=0,n=this.option("transition")){var i,r,a,u;if(!n)return!1;const l=this.page,{pages:g,panzoom:b}=this;e=parseInt((e||0).toString())||0;const S=this.getPageFromIndex(e);if(!b||!g[S]||g.length<2||Math.abs((((r=(i=g[l])===null||i===void 0?void 0:i.slides[0])===null||r===void 0?void 0:r.dim)||0)-this.viewportDim)>1)return!1;let E=e>l?1:-1;this.isInfinite&&(l===0&&e===g.length-1&&(E=-1),l===g.length-1&&e===0&&(E=1));const C=g[S].pos*(this.isRTL?1:-1);if(l===S&&Math.abs(C-b.target[this.axis])<1)return!1;this.clearTransitions();const P=b.isResting;Ct(this.container,this.cn("inTransition"));const D=((a=g[l])===null||a===void 0?void 0:a.slides[0])||null,R=((u=g[S])===null||u===void 0?void 0:u.slides[0])||null;this.inTransition.add(R.index),this.createSlideEl(R);let j=D.el,W=R.el;P||n===Yp||(n="fadeFast",j=null);const ee=this.isRTL?"next":"prev",le=this.isRTL?"prev":"next";return j&&(this.inTransition.add(D.index),D.transition=n,j.addEventListener(Zp,this.onAnimationEnd),j.classList.add(`f-${n}Out`,`to-${E>0?le:ee}`)),W&&(R.transition=n,W.addEventListener(Zp,this.onAnimationEnd),W.classList.add(`f-${n}In`,`from-${E>0?ee:le}`)),b.current[this.axis]=C,b.target[this.axis]=C,b.requestTick(),this.onChange(S),!0}manageSlideVisiblity(){const e=new Set,n=new Set,i=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const r of this.slides)i.has(r)?e.add(r):n.add(r);for(const r of this.inTransition)e.add(this.slides[r]);for(const r of e)this.createSlideEl(r),this.lazyLoadSlide(r);for(const r of n)e.has(r)||this.removeSlideEl(r);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const e="aria-hidden";let n=this.cn(sv);if(n)for(const i of this.slides){const r=i.el;r&&(r.dataset.index=`${i.index}`,r.classList.contains("f-thumbs__slide")?this.getVisibleSlides(0).has(i)?r.removeAttribute(e):r.setAttribute(e,"true"):this.pages[this.page].slides.includes(i)?(r.classList.contains(n)||(Ct(r,n),this.emit("selectSlide",i)),r.removeAttribute(e)):(r.classList.contains(n)&&(En(r,n),this.emit("unselectSlide",i)),r.setAttribute(e,"true")))}}flipInfiniteTrack(){const{axis:e,isHorizontal:n,isInfinite:i,isRTL:r,viewportDim:a,contentDim:u}=this,l=this.panzoom;if(!l||!i)return;let g=l.current[e],b=l.target[e]-g,S=0,E=.5*a;r&&n?(g<-E&&(S=-1,g+=u),g>u-E&&(S=1,g-=u)):(g>E&&(S=1,g-=u),g<-u+E&&(S=-1,g+=u)),S&&(l.current[e]=g,l.target[e]=g+b)}lazyLoadImg(e,n){const i=this,r="f-fadeIn",a="is-preloading";let u=!1,l=null;const g=()=>{u||(u=!0,l&&(l.remove(),l=null),En(n,a),n.complete&&(Ct(n,r),setTimeout(()=>{En(n,r)},350)),this.option("adaptiveHeight")&&e.el&&this.pages[this.page].slides.indexOf(e)>-1&&(i.updateMetrics(),i.setViewportHeight()),this.emit("load",e))};Ct(n,a),n.src=n.dataset.lazySrcset||n.dataset.lazySrc||"",delete n.dataset.lazySrc,delete n.dataset.lazySrcset,n.addEventListener("error",()=>{g()}),n.addEventListener("load",()=>{g()}),setTimeout(()=>{const b=n.parentNode;b&&e.el&&(n.complete?g():u||(l=eo(dy),b.insertBefore(l,n)))},300)}lazyLoadSlide(e){const n=e&&e.el;if(!n)return;const i=new Set;let r=Array.from(n.querySelectorAll("[data-lazy-src],[data-lazy-srcset]"));n.dataset.lazySrc&&r.push(n),r.map(a=>{a instanceof HTMLImageElement?i.add(a):a instanceof HTMLElement&&a.dataset.lazySrc&&(a.style.backgroundImage=`url('${a.dataset.lazySrc}')`,delete a.dataset.lazySrc)});for(const a of i)this.lazyLoadImg(e,a)}onAnimationEnd(e){var n;const i=e.target,r=i?parseInt(i.dataset.index||"",10)||0:-1,a=this.slides[r],u=e.animationName;if(!i||!a||!u)return;const l=!!this.inTransition.has(r)&&a.transition;l&&u.substring(0,l.length+2)===`f-${l}`&&this.inTransition.delete(r),this.inTransition.size||this.clearTransitions(),r===this.page&&(!((n=this.panzoom)===null||n===void 0)&&n.isResting)&&this.emit("settle")}onDecel(e,n=0,i=0,r=0,a=0){if(this.option("dragFree"))return void this.setPageFromPosition();const{isRTL:u,isHorizontal:l,axis:g,pages:b}=this,S=b.length,E=Math.abs(Math.atan2(i,n)/(Math.PI/180));let C=0;if(C=E>45&&E<135?l?0:i:l?n:0,!S)return;let P=this.page,D=u&&l?1:-1;const R=e.current[g]*D;let{pageIndex:j}=this.getPageFromPosition(R);Math.abs(C)>5?(b[P].dim<document.documentElement["client"+(this.isHorizontal?"Width":"Height")]-1&&(P=j),P=u&&l?C<0?P-1:P+1:C<0?P+1:P-1):P=r===0&&a===0?P:j,this.slideTo(P,{transition:!1,friction:e.option("decelFriction")})}onClick(e){const n=e.target,i=n&&Mr(n)?n.dataset:null;let r,a;i&&(i.carouselPage!==void 0?(a="slideTo",r=i.carouselPage):i.carouselNext!==void 0?a="slideNext":i.carouselPrev!==void 0&&(a="slidePrev")),a?(e.preventDefault(),e.stopPropagation(),n&&!n.hasAttribute("disabled")&&this[a](r)):this.emit("click",e)}onSlideTo(e){const n=e.detail||0;this.slideTo(this.getPageForSlide(n),{friction:0})}onChange(e,n=0){const i=this.page;this.prevPage=i,this.page=e,this.option("adaptiveHeight")&&this.setViewportHeight(),e!==i&&(this.markSelectedSlides(),this.emit("change",e,i,n))}onRefresh(){let e=this.contentDim,n=this.viewportDim;this.updateMetrics(),this.contentDim===e&&this.viewportDim===n||this.slideTo(this.page,{friction:0,transition:!1})}onScroll(){var e;(e=this.viewport)===null||e===void 0||e.scroll(0,0)}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(e){this.lp!==e.current[this.axis]&&(this.flipInfiniteTrack(),this.manageSlideVisiblity()),this.lp=e.current.e}onEndAnimation(){this.inTransition.size||this.emit("settle")}reInit(e=null,n=null){this.destroy(),this.state=hi.Init,this.prevPage=null,this.userOptions=e||this.userOptions,this.userPlugins=n||this.userPlugins,this.processOptions()}slideTo(e=0,{friction:n=this.option("friction"),transition:i=this.option("transition")}={}){if(this.state===hi.Destroy)return;e=parseInt((e||0).toString())||0;const r=this.getPageFromIndex(e),{axis:a,isHorizontal:u,isRTL:l,pages:g,panzoom:b}=this,S=g.length,E=l&&u?1:-1;if(!b||!S)return;if(this.page!==r){const P=new Event("beforeChange",{bubbles:!0,cancelable:!0});if(this.emit("beforeChange",P,e),P.defaultPrevented)return}if(this.transitionTo(e,i))return;let C=g[r].pos;if(this.isInfinite){const P=this.contentDim,D=b.target[a]*E;S===2?C+=P*Math.floor(parseFloat(e+"")/2):C=[C,C-P,C+P].reduce(function(R,j){return Math.abs(j-D)<Math.abs(R-D)?j:R})}C*=E,Math.abs(b.target[a]-C)<1||(b.panTo({x:u?C:0,y:u?0:C,friction:n}),this.onChange(r))}slideToClosest(e){if(this.panzoom){const{pageIndex:n}=this.getPageFromPosition();this.slideTo(n,e)}}slideNext(){this.slideTo(this.page+1)}slidePrev(){this.slideTo(this.page-1)}clearTransitions(){this.inTransition.clear(),En(this.container,this.cn("inTransition"));const e=["to-prev","to-next","from-prev","from-next"];for(const n of this.slides){const i=n.el;if(i){i.removeEventListener(Zp,this.onAnimationEnd),i.classList.remove(...e);const r=n.transition;r&&i.classList.remove(`f-${r}Out`,`f-${r}In`)}}this.manageSlideVisiblity()}addSlide(e,n){var i,r,a,u;const l=this.panzoom,g=((i=this.pages[this.page])===null||i===void 0?void 0:i.pos)||0,b=((r=this.pages[this.page])===null||r===void 0?void 0:r.dim)||0,S=this.contentDim<this.viewportDim;let E=Array.isArray(n)?n:[n];const C=[];for(const P of E)C.push(my(P));this.slides.splice(e,0,...C);for(let P=0;P<this.slides.length;P++)this.slides[P].index=P;for(const P of C)this.emit("beforeInitSlide",P,P.index);if(this.page>=e&&(this.page+=C.length),this.updateMetrics(),l){const P=((a=this.pages[this.page])===null||a===void 0?void 0:a.pos)||0,D=((u=this.pages[this.page])===null||u===void 0?void 0:u.dim)||0,R=this.pages.length||1,j=this.isRTL?b-D:D-b,W=this.isRTL?g-P:P-g;S&&R===1?(e<=this.page&&(l.current[this.axis]-=j,l.target[this.axis]-=j),l.panTo({[this.isHorizontal?"x":"y"]:-1*P})):W&&e<=this.page&&(l.target[this.axis]-=W,l.current[this.axis]-=W,l.requestTick())}for(const P of C)this.emit("initSlide",P,P.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 i=this.slides[e];if(i){this.removeSlideEl(i,!0),this.slides.splice(e,1);for(let r=0;r<this.slides.length;r++)this.slides[r].index=r;this.updateMetrics(),this.slideTo(this.page,{friction:0,transition:!1}),this.emit("destroySlide",i)}}updateMetrics(){const{panzoom:e,viewport:n,track:i,slides:r,isHorizontal:a,isInfinite:u}=this;if(!i)return;const l=a?"width":"height",g=a?"offsetWidth":"offsetHeight";if(n){let E=Math.max(n[g],at(n.getBoundingClientRect()[l],1e3)),C=getComputedStyle(n),P="padding",D=a?"Right":"Bottom";E-=parseFloat(C[P+(a?"Left":"Top")])+parseFloat(C[P+D]),this.viewportDim=E}let b,S=0;for(const[E,C]of r.entries()){let P=0,D=0;!C.el&&b?(P=b.dim,D=b.gap):({dim:P,gap:D}=this.getSlideMetrics(C),b=C),P=at(P,1e3),D=at(D,1e3),C.dim=P,C.gap=D,C.pos=S,S+=P,(u||E<r.length-1)&&(S+=D)}S=at(S,1e3),this.contentDim=S,e&&(e.contentRect[l]=S,e.contentRect[a?"fullWidth":"fullHeight"]=S),this.pages=this.createPages(),this.pages=this.processPages(),this.state===hi.Init&&this.setInitialPage(),this.page=Math.max(0,Math.min(this.page,this.pages.length-1)),this.manageSlideVisiblity(),this.emit("refresh")}getProgress(e,n=!1,i=!1){e===void 0&&(e=this.page);const r=this,a=r.panzoom,u=r.contentDim,l=r.pages[e]||0;if(!l||!a)return e>this.page?-1:1;let g=-1*a.current.e,b=at((g-l.pos)/(1*l.dim),1e3),S=b,E=b;this.isInfinite&&i!==!0&&(S=at((g-l.pos+u)/(1*l.dim),1e3),E=at((g-l.pos-u)/(1*l.dim),1e3));let C=[b,S,E].reduce(function(P,D){return Math.abs(D)<Math.abs(P)?D:P});return n?C:C>1?1:C<-1?-1:C}setViewportHeight(){const{page:e,pages:n,viewport:i,isHorizontal:r}=this;if(!i||!n[e])return;let a=0;r&&this.track&&(this.track.style.height="auto",n[e].slides.forEach(u=>{u.el&&(a=Math.max(a,u.el.offsetHeight))})),i.style.height=a?`${a}px`:""}getPageForSlide(e){for(const n of this.pages)for(const i of n.slides)if(i.index===e)return n.index;return-1}getVisibleSlides(e=0){var n;const i=new Set;let{panzoom:r,contentDim:a,viewportDim:u,pages:l,page:g}=this;if(u){a=a+((n=this.slides[this.slides.length-1])===null||n===void 0?void 0:n.gap)||0;let b=0;b=r&&r.state!==In.Init&&r.state!==In.Destroy?-1*r.current[this.axis]:l[g]&&l[g].pos||0,this.isInfinite&&(b-=Math.floor(b/a)*a),this.isRTL&&this.isHorizontal&&(b*=-1);const S=b-u*e,E=b+u*(e+1),C=this.isInfinite?[-1,0,1]:[0];for(const P of this.slides)for(const D of C){const R=P.pos+D*a,j=R+P.dim+P.gap;R<E&&j>S&&i.add(P)}}return i}getPageFromPosition(e){const{viewportDim:n,contentDim:i,slides:r,pages:a,panzoom:u}=this,l=a.length,g=r.length,b=r[0],S=r[g-1],E=this.option("center");let C=0,P=0,D=0,R=e===void 0?-1*((u==null?void 0:u.target[this.axis])||0):e;E&&(R+=.5*n),this.isInfinite?(R<b.pos-.5*S.gap&&(R-=i,D=-1),R>S.pos+S.dim+.5*S.gap&&(R-=i,D=1)):R=Math.max(b.pos||0,Math.min(R,S.pos));let j=S,W=r.find(ee=>{const le=ee.pos-.5*j.gap,J=ee.pos+ee.dim+.5*ee.gap;return j=ee,R>=le&&R<J});return W||(W=S),P=this.getPageForSlide(W.index),C=P+D*l,{page:C,pageIndex:P}}setPageFromPosition(){const{pageIndex:e}=this.getPageFromPosition();this.onChange(e)}destroy(){if([hi.Destroy].includes(this.state))return;this.state=hi.Destroy;const{container:e,viewport:n,track:i,slides:r,panzoom:a}=this,u=this.option("classes");e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),a&&(a.destroy(),this.panzoom=null),r&&r.forEach(g=>{this.removeSlideEl(g)}),this.detachPlugins(),n&&(n.removeEventListener("scroll",this.onScroll),n.offsetParent&&i&&i.offsetParent&&n.replaceWith(...i.childNodes));for(const[g,b]of Object.entries(u))g!=="container"&&b&&e.classList.remove(b);this.track=null,this.viewport=null,this.page=0,this.slides=[];const l=this.events.get("ready");this.events=new Map,l&&this.events.set("ready",l)}}Object.defineProperty(ha,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:ua}),Object.defineProperty(ha,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:oB}),Object.defineProperty(ha,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:cB});const ov=function(t){if(!Mr(t))return 0;const e=window.scrollY,n=window.innerHeight,i=e+n,r=t.getBoundingClientRect(),a=r.y+e,u=r.height,l=a+u;if(e>l||i<a)return 0;if(e<a&&i>l||a<e&&l>i)return 100;let g=u;a<e&&(g-=e-a),l>i&&(g-=l-i);const b=g/n*100;return Math.round(b)},mh=!(typeof window>"u"||!window.document||!window.document.createElement);let gy;const yy=["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(","),av=t=>{if(t&&mh){gy===void 0&&document.createElement("div").focus({get preventScroll(){return gy=!0,!1}});try{if(gy)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{}}},lv=()=>{const t=document;let e,n="",i="",r="";return t.fullscreenEnabled?(n="requestFullscreen",i="exitFullscreen",r="fullscreenElement"):t.webkitFullscreenEnabled&&(n="webkitRequestFullscreen",i="webkitExitFullscreen",r="webkitFullscreenElement"),n&&(e={request:function(a=t.documentElement){return n==="webkitRequestFullscreen"?a[n](Element.ALLOW_KEYBOARD_INPUT):a[n]()},exit:function(){return t[r]&&t[i]()},isFullscreen:function(){return t[r]}}),e},_y={animated:!0,autoFocus:!0,backdropClick:"close",Carousel:{classes:{container:"fancybox__carousel",viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"}},closeButton:"auto",closeExisting:!1,commonCaption:!1,compact:()=>window.matchMedia("(max-width: 578px), (max-height: 578px)").matches,contentClick:"toggleZoom",contentDblClick:!1,defaultType:"image",defaultDisplay:"flex",dragToClose:!0,Fullscreen:{autoStart:!1},groupAll:!1,groupAttr:"data-fancybox",hideClass:"f-fadeOut",hideScrollbar:!0,idle:3500,keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"prev",ArrowDown:"next",ArrowRight:"next",ArrowLeft:"prev"},l10n:Object.assign(Object.assign({},Y1),{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"}),parentEl:null,placeFocusBack:!0,showClass:"f-zoomInUp",startIndex:0,tpl:{closeButton:'<button data-fancybox-close class="f-button is-close-btn" title="{{CLOSE}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M20 20L4 4m16 0L4 20"/></svg></button>',main:`<div class="fancybox__container" role="dialog" aria-modal="true" aria-label="{{MODAL}}" tabindex="-1">
|
625
625
|
<div class="fancybox__backdrop"></div>
|
626
626
|
<div class="fancybox__carousel"></div>
|
627
627
|
<div class="fancybox__footer"></div>
|
628
628
|
</div>`},trapFocus:!0,wheel:"zoom"};var Ei,Ki;(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"})(Ei||(Ei={})),function(t){t[t.Loading=0]="Loading",t[t.Opening=1]="Opening",t[t.Ready=2]="Ready",t[t.Closing=3]="Closing"}(Ki||(Ki={}));let cv="",gh=!1,Xp=!1,gl=null;const uv=()=>{let t="",e="";const n=gn.getInstance();if(n){const i=n.carousel,r=n.getSlide();if(i&&r){let a=r.slug||void 0,u=r.triggerEl||void 0;e=a||n.option("slug")||"",!e&&u&&u.dataset&&(e=u.dataset.fancybox||""),e&&e!=="true"&&(t="#"+e+(!a&&i.slides.length>1?"-"+(r.index+1):""))}}return{hash:t,slug:e,index:1}},Kp=()=>{const t=new URL(document.URL).hash,e=t.slice(1).split("-"),n=e[e.length-1],i=n&&/^\+?\d+$/.test(n)&&parseInt(e.pop()||"1",10)||1;return{hash:t,slug:e.join("-"),index:i}},hv=()=>{const{slug:t,index:e}=Kp();if(!t)return;let n=document.querySelector(`[data-slug="${t}"]`);if(n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),gn.getInstance())return;const i=document.querySelectorAll(`[data-fancybox="${t}"]`);i.length&&(n=i[e-1],n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})))},dv=()=>{if(gn.defaults.Hash===!1)return;const t=gn.getInstance();if((t==null?void 0:t.options.Hash)===!1)return;const{slug:e,index:n}=Kp(),{slug:i}=uv();t&&(e===i?t.jumpTo(n-1):(gh=!0,t.close())),hv()},pv=()=>{gl&&clearTimeout(gl),queueMicrotask(()=>{dv()})},fv=()=>{window.addEventListener("hashchange",pv,!1),setTimeout(()=>{dv()},500)};mh&&(/complete|interactive|loaded/.test(document.readyState)?fv():document.addEventListener("DOMContentLoaded",fv));const Jp="is-zooming-in";class mv extends Vs{onCreateSlide(e,n,i){const r=this.instance.optionFor(i,"src")||"";i.el&&i.type==="image"&&typeof r=="string"&&this.setImage(i,r)}onRemoveSlide(e,n,i){i.panzoom&&i.panzoom.destroy(),i.panzoom=void 0,i.imageEl=void 0}onChange(e,n,i,r){En(this.instance.container,Jp);for(const a of n.slides){const u=a.panzoom;u&&a.index!==i&&u.reset(.35)}}onClose(){var e;const n=this.instance,i=n.container,r=n.getSlide();if(!i||!i.parentElement||!r)return;const{el:a,contentEl:u,panzoom:l,thumbElSrc:g}=r;if(!a||!g||!u||!l||l.isContentLoading||l.state===In.Init||l.state===In.Destroy)return;l.updateMetrics();let b=this.getZoomInfo(r);if(!b)return;this.instance.state=Ei.CustomClosing,i.classList.remove(Jp),i.classList.add("is-zooming-out"),u.style.backgroundImage=`url('${g}')`;const S=i.getBoundingClientRect();(((e=window.visualViewport)===null||e===void 0?void 0:e.scale)||1)===1&&Object.assign(i.style,{position:"absolute",top:`${i.offsetTop+window.scrollY}px`,left:`${i.offsetLeft+window.scrollX}px`,bottom:"auto",right:"auto",width:`${S.width}px`,height:`${S.height}px`,overflow:"hidden"});const{x:E,y:C,scale:P,opacity:D}=b;if(D){const R=((j,W,ee,le)=>{const J=W-j,Te=le-ee;return xe=>ee+((xe-j)/J*Te||0)})(l.scale,P,1,0);l.on("afterTransform",()=>{u.style.opacity=R(l.scale)+""})}l.on("endAnimation",()=>{n.destroy()}),l.target.a=P,l.target.b=0,l.target.c=0,l.target.d=P,l.panTo({x:E,y:C,scale:P,friction:D?.2:.33,ignoreBounds:!0}),l.isResting&&n.destroy()}setImage(e,n){const i=this.instance;e.src=n,this.process(e,n).then(r=>{const{contentEl:a,imageEl:u,thumbElSrc:l,el:g}=e;if(i.isClosing()||!a||!u)return;a.offsetHeight;const b=!!i.isOpeningSlide(e)&&this.getZoomInfo(e);if(this.option("protected")&&g){g.addEventListener("contextmenu",C=>{C.preventDefault()});const E=document.createElement("div");Ct(E,"fancybox-protected"),a.appendChild(E)}if(l&&b){const E=r.contentRect,C=Math.max(E.fullWidth,E.fullHeight);let P=null;!b.opacity&&C>1200&&(P=document.createElement("img"),Ct(P,"fancybox-ghost"),P.src=l,a.appendChild(P));const D=()=>{P&&(Ct(P,"f-fadeFastOut"),setTimeout(()=>{P&&(P.remove(),P=null)},200))};(S=l,new Promise((R,j)=>{const W=new Image;W.onload=R,W.onerror=j,W.src=S})).then(()=>{i.hideLoading(e),e.state=Ki.Opening,this.instance.emit("reveal",e),this.zoomIn(e).then(()=>{D(),this.instance.done(e)},()=>{}),P&&setTimeout(()=>{D()},C>2500?800:200)},()=>{i.hideLoading(e),i.revealContent(e)})}else{const E=this.optionFor(e,"initialSize"),C=this.optionFor(e,"zoom"),P={event:i.prevMouseMoveEvent||i.options.event,friction:C?.12:0};let D=i.optionFor(e,"showClass")||void 0,R=!0;i.isOpeningSlide(e)&&(E==="full"?r.zoomToFull(P):E==="cover"?r.zoomToCover(P):E==="max"?r.zoomToMax(P):R=!1,r.stop("current")),R&&D&&(D=r.isDragging?"f-fadeIn":""),i.hideLoading(e),i.revealContent(e,D)}var S},()=>{i.setError(e,"{{IMAGE_ERROR}}")})}process(e,n){return new Promise((i,r)=>{var a;const u=this.instance,l=e.el;u.clearContent(e),u.showLoading(e);let g=this.optionFor(e,"content");if(typeof g=="string"&&(g=eo(g)),!g||!Mr(g)){if(g=document.createElement("img"),g instanceof HTMLImageElement){let b="",S=e.caption;b=typeof S=="string"&&S?S.replace(/<[^>]+>/gi,"").substring(0,1e3):`Image ${e.index+1} of ${((a=u.carousel)===null||a===void 0?void 0:a.pages.length)||1}`,g.src=n||"",g.alt=b,g.draggable=!1,e.srcset&&g.setAttribute("srcset",e.srcset),this.instance.isOpeningSlide(e)&&(g.fetchPriority="high")}e.sizes&&g.setAttribute("sizes",e.sizes)}Ct(g,"fancybox-image"),e.imageEl=g,u.setContent(e,g,!1),e.panzoom=new ua(l,Tr({transformParent:!0},this.option("Panzoom")||{},{content:g,width:(b,S)=>u.optionFor(e,"width","auto",S)||"auto",height:(b,S)=>u.optionFor(e,"height","auto",S)||"auto",wheel:()=>{const b=u.option("wheel");return(b==="zoom"||b=="pan")&&b},click:(b,S)=>{var E,C;if(u.isCompact||u.isClosing()||e.index!==((E=u.getSlide())===null||E===void 0?void 0:E.index))return!1;if(S){const D=S.composedPath()[0];if(["A","BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(D.nodeName))return!1}let P=!S||S.target&&((C=e.contentEl)===null||C===void 0?void 0:C.contains(S.target));return u.option(P?"contentClick":"backdropClick")||!1},dblClick:()=>u.isCompact?"toggleZoom":u.option("contentDblClick")||!1,spinner:!1,panOnlyZoomed:!0,wheelLimit:1/0,on:{ready:b=>{i(b)},error:()=>{r()},destroy:()=>{r()}}}))})}zoomIn(e){return new Promise((n,i)=>{const r=this.instance,a=r.container,{panzoom:u,contentEl:l,el:g}=e;u&&u.updateMetrics();const b=this.getZoomInfo(e);if(!(b&&g&&l&&u&&a))return void i();const{x:S,y:E,scale:C,opacity:P}=b,D=()=>{e.state!==Ki.Closing&&(P&&(l.style.opacity=Math.max(Math.min(1,1-(1-u.scale)/(1-C)),0)+""),u.scale>=1&&u.scale>u.targetScale-.1&&n(u))},R=ee=>{(ee.scale<.99||ee.scale>1.01)&&!ee.isDragging||(En(a,Jp),l.style.opacity="",ee.off("endAnimation",R),ee.off("touchStart",R),ee.off("afterTransform",D),n(ee))};u.on("endAnimation",R),u.on("touchStart",R),u.on("afterTransform",D),u.on(["error","destroy"],()=>{i()}),u.panTo({x:S,y:E,scale:C,friction:0,ignoreBounds:!0}),u.stop("current");const j={event:u.panMode==="mousemove"?r.prevMouseMoveEvent||r.options.event:void 0},W=this.optionFor(e,"initialSize");Ct(a,Jp),r.hideLoading(e),W==="full"?u.zoomToFull(j):W==="cover"?u.zoomToCover(j):W==="max"?u.zoomToMax(j):u.reset(.172)})}getZoomInfo(e){const{el:n,imageEl:i,thumbEl:r,panzoom:a}=e,u=this.instance,l=u.container;if(!n||!i||!r||!a||ov(r)<3||!this.optionFor(e,"zoom")||!l||u.state===Ei.Destroy||getComputedStyle(l).getPropertyValue("--f-images-zoom")==="0")return!1;const g=window.visualViewport||null;if((g?g.scale:1)!==1)return!1;let{top:b,left:S,width:E,height:C}=r.getBoundingClientRect(),{top:P,left:D,fitWidth:R,fitHeight:j}=a.contentRect;if(!(E&&C&&R&&j))return!1;const W=a.container.getBoundingClientRect();D+=W.left,P+=W.top;const ee=-1*(D+.5*R-(S+.5*E)),le=-1*(P+.5*j-(b+.5*C)),J=E/R;let Te=this.option("zoomOpacity")||!1;return Te==="auto"&&(Te=Math.abs(E/C-R/j)>.1),{x:ee,y:le,scale:J,opacity:Te}}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(mv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{initialSize:"fit",Panzoom:{maxScale:1},protected:!1,zoom:!0,zoomOpacity:"auto"}}),typeof SuppressedError=="function"&&SuppressedError;const by="html",gv="image",xy="map",Do="youtube",yl="vimeo",yh="html5video",yv=(t,e={})=>{const n=new URL(t),i=new URLSearchParams(n.search),r=new URLSearchParams;for(const[l,g]of[...i,...Object.entries(e)]){let b=g+"";if(l==="t"){let S=b.match(/((\d*)m)?(\d*)s?/);S&&r.set("start",60*parseInt(S[2]||"0")+parseInt(S[3]||"0")+"")}else r.set(l,b)}let a=r+"",u=t.match(/#t=((.*)?\d+s)/);return u&&(a+=`#t=${u[1]}`),a},uB={ajax:null,autoSize:!0,iframeAttr:{allow:"autoplay; fullscreen",scrolling:"auto"},preload:!0,videoAutoplay:!0,videoRatio:16/9,videoTpl:`<video class="fancybox__html5video" playsinline controls controlsList="nodownload" poster="{{poster}}">
|
629
629
|
<source src="{{src}}" type="{{format}}" />Sorry, your browser doesn't support embedded videos.</video>`,videoFormat:"",vimeo:{byline:1,color:"00adef",controls:1,dnt:1,muted:0},youtube:{controls:1,enablejsapi:1,nocookie:1,rel:0,fs:1}},hB=["image","html","ajax","inline","clone","iframe","map","pdf","html5video","youtube","vimeo"];class _v extends Vs{onBeforeInitSlide(e,n,i){this.processType(i)}onCreateSlide(e,n,i){this.setContent(i)}onClearContent(e,n){n.xhr&&(n.xhr.abort(),n.xhr=null);const i=n.iframeEl;i&&(i.onload=i.onerror=null,i.src="//about:blank",n.iframeEl=null);const r=n.contentEl,a=n.placeholderEl;if(n.type==="inline"&&r&&a)r.classList.remove("fancybox__content"),getComputedStyle(r).getPropertyValue("display")!=="none"&&(r.style.display="none"),setTimeout(()=>{a&&(r&&a.parentNode&&a.parentNode.insertBefore(r,a),a.remove())},0),n.contentEl=void 0,n.placeholderEl=void 0;else for(;n.el&&n.el.firstChild;)n.el.removeChild(n.el.firstChild)}onSelectSlide(e,n,i){i.state===Ki.Ready&&this.playVideo()}onUnselectSlide(e,n,i){var r,a;if(i.type===yh){try{(a=(r=i.el)===null||r===void 0?void 0:r.querySelector("video"))===null||a===void 0||a.pause()}catch{}return}let u;i.type===yl?u={method:"pause",value:"true"}:i.type===Do&&(u={event:"command",func:"pauseVideo"}),u&&i.iframeEl&&i.iframeEl.contentWindow&&i.iframeEl.contentWindow.postMessage(JSON.stringify(u),"*"),i.poller&&clearTimeout(i.poller)}onDone(e,n){e.isCurrentSlide(n)&&!e.isClosing()&&this.playVideo()}onRefresh(e,n){n.slides.forEach(i=>{i.el&&(this.resizeIframe(i),this.setAspectRatio(i))})}onMessage(e){try{let n=JSON.parse(e.data);if(e.origin==="https://player.vimeo.com"){if(n.event==="ready")for(let i of Array.from(document.getElementsByClassName("fancybox__iframe")))i instanceof HTMLIFrameElement&&i.contentWindow===e.source&&(i.dataset.ready="true")}else if(e.origin.match(/^https:\/\/(www.)?youtube(-nocookie)?.com$/)&&n.event==="onReady"){const i=document.getElementById(n.id);i&&(i.dataset.ready="true")}}catch{}}loadAjaxContent(e){const n=this.instance.optionFor(e,"src")||"";this.instance.showLoading(e);const i=this.instance,r=new XMLHttpRequest;i.showLoading(e),r.onreadystatechange=function(){r.readyState===XMLHttpRequest.DONE&&i.state===Ei.Ready&&(i.hideLoading(e),r.status===200?i.setContent(e,r.responseText):i.setError(e,r.status===404?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};const a=e.ajax||null;r.open(a?"POST":"GET",n+""),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.setRequestHeader("X-Requested-With","XMLHttpRequest"),r.send(a),e.xhr=r}setInlineContent(e){let n=null;if(Mr(e.src))n=e.src;else if(typeof e.src=="string"){const i=e.src.split("#",2).pop();n=i?document.getElementById(i):null}if(n){if(e.type==="clone"||n.closest(".fancybox__slide")){n=n.cloneNode(!0);const i=n.dataset.animationName;i&&(n.classList.remove(i),delete n.dataset.animationName);let r=n.getAttribute("id");r=r?`${r}--clone`:`clone-${this.instance.id}-${e.index}`,n.setAttribute("id",r)}else if(n.parentNode){const i=document.createElement("div");i.classList.add("fancybox-placeholder"),n.parentNode.insertBefore(i,n),e.placeholderEl=i}this.instance.setContent(e,n)}else this.instance.setError(e,"{{ELEMENT_NOT_FOUND}}")}setIframeContent(e){const{src:n,el:i}=e;if(!n||typeof n!="string"||!i)return;i.classList.add("is-loading");const r=this.instance,a=document.createElement("iframe");a.className="fancybox__iframe",a.setAttribute("id",`fancybox__iframe_${r.id}_${e.index}`);for(const[l,g]of Object.entries(this.optionFor(e,"iframeAttr")||{}))a.setAttribute(l,g);a.onerror=()=>{r.setError(e,"{{IFRAME_ERROR}}")},e.iframeEl=a;const u=this.optionFor(e,"preload");if(e.type!=="iframe"||u===!1)return a.setAttribute("src",e.src+""),r.setContent(e,a,!1),this.resizeIframe(e),void r.revealContent(e);r.showLoading(e),a.onload=()=>{if(!a.src.length)return;const l=a.dataset.ready!=="true";a.dataset.ready="true",this.resizeIframe(e),l?r.revealContent(e):r.hideLoading(e)},a.setAttribute("src",n),r.setContent(e,a,!1)}resizeIframe(e){const{type:n,iframeEl:i}=e;if(n===Do||n===yl)return;const r=i==null?void 0:i.parentElement;if(!i||!r)return;let a=e.autoSize;a===void 0&&(a=this.optionFor(e,"autoSize"));let u=e.width||0,l=e.height||0;u&&l&&(a=!1);const g=r&&r.style;if(e.preload!==!1&&a!==!1&&g)try{const b=window.getComputedStyle(r),S=parseFloat(b.paddingLeft)+parseFloat(b.paddingRight),E=parseFloat(b.paddingTop)+parseFloat(b.paddingBottom),C=i.contentWindow;if(C){const P=C.document,D=P.getElementsByTagName(by)[0],R=P.body;g.width="",R.style.overflow="hidden",u=u||D.scrollWidth+S,g.width=`${u}px`,R.style.overflow="",g.flex="0 0 auto",g.height=`${R.scrollHeight}px`,l=D.scrollHeight+E}}catch{}if(u||l){const b={flex:"0 1 auto",width:"",height:""};u&&u!=="auto"&&(b.width=`${u}px`),l&&l!=="auto"&&(b.height=`${l}px`),Object.assign(g,b)}}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===yh)try{const r=n.querySelector("video");if(r){const a=r.play();a!==void 0&&a.then(()=>{}).catch(u=>{r.muted=!0,r.play()})}}catch{}if(e.type!==Do&&e.type!==yl)return;const i=()=>{if(e.iframeEl&&e.iframeEl.contentWindow){let r;if(e.iframeEl.dataset.ready==="true")return r=e.type===Do?{event:"command",func:"playVideo"}:{method:"play",value:"true"},r&&e.iframeEl.contentWindow.postMessage(JSON.stringify(r),"*"),void(e.poller=void 0);e.type===Do&&(r={event:"listening",id:e.iframeEl.getAttribute("id")},e.iframeEl.contentWindow.postMessage(JSON.stringify(r),"*"))}e.poller=setTimeout(i,250)};i()}processType(e){if(e.html)return e.type=by,e.src=e.html,void(e.html="");const n=this.instance.optionFor(e,"src","");if(!n||typeof n!="string")return;let i=e.type,r=null;if(r=n.match(/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|shorts\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){const a=this.optionFor(e,Do),{nocookie:u}=a,l=function(E,C){var P={};for(var D in E)Object.prototype.hasOwnProperty.call(E,D)&&C.indexOf(D)<0&&(P[D]=E[D]);if(E!=null&&typeof Object.getOwnPropertySymbols=="function"){var R=0;for(D=Object.getOwnPropertySymbols(E);R<D.length;R++)C.indexOf(D[R])<0&&Object.prototype.propertyIsEnumerable.call(E,D[R])&&(P[D[R]]=E[D[R]])}return P}(a,["nocookie"]),g=`www.youtube${u?"-nocookie":""}.com`,b=yv(n,l),S=encodeURIComponent(r[2]);e.videoId=S,e.src=`https://${g}/embed/${S}?${b}`,e.thumbSrc=e.thumbSrc||`https://i.ytimg.com/vi/${S}/mqdefault.jpg`,i=Do}else if(r=n.match(/^.+vimeo.com\/(?:\/)?([\d]+)((\/|\?h=)([a-z0-9]+))?(.*)?/)){const a=yv(n,this.optionFor(e,yl)),u=encodeURIComponent(r[1]),l=r[4]||"";e.videoId=u,e.src=`https://player.vimeo.com/video/${u}?${l?`h=${l}${a?"&":""}`:""}${a}`,i=yl}if(!i&&e.triggerEl){const a=e.triggerEl.dataset.type;hB.includes(a)&&(i=a)}i||typeof n=="string"&&(n.charAt(0)==="#"?i="inline":(r=n.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(i=yh,e.videoFormat=e.videoFormat||"video/"+(r[1]==="ogv"?"ogg":r[1])):n.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?i=gv:n.match(/\.(pdf)((\?|#).*)?$/i)&&(i="pdf")),(r=n.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(e.src=`https://maps.google.${r[1]}/?ll=${(r[2]?r[2]+"&z="+Math.floor(parseFloat(r[3]))+(r[4]?r[4].replace(/^\//,"&"):""):r[4]+"").replace(/\?/,"&")}&output=${r[4]&&r[4].indexOf("layer=c")>0?"svembed":"embed"}`,i=xy):(r=n.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(e.src=`https://maps.google.${r[1]}/maps?q=${r[2].replace("query=","q=").replace("api=1","")}&output=embed`,i=xy),i=i||this.instance.option("defaultType"),e.type=i,i===gv&&(e.thumbSrc=e.thumbSrc||e.src)}setContent(e){const n=this.instance.optionFor(e,"src")||"";if(e&&e.type&&n){switch(e.type){case by:this.instance.setContent(e,n);break;case yh:const i=this.option("videoTpl");i&&this.instance.setContent(e,i.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 xy:case Do:case yl:e.preload=!1;case"iframe":this.setIframeContent(e)}this.setAspectRatio(e)}}setAspectRatio(e){const n=e.contentEl;if(!(e.el&&n&&e.type&&[Do,yl,yh].includes(e.type)))return;let i,r=e.width||"auto",a=e.height||"auto";if(r==="auto"||a==="auto"){i=this.optionFor(e,"videoRatio");const b=(i+"").match(/(\d+)\s*\/\s?(\d+)/);i=b&&b.length>2?parseFloat(b[1])/parseFloat(b[2]):parseFloat(i+"")}else r&&a&&(i=r/a);if(!i)return;n.style.aspectRatio="",n.style.width="",n.style.height="",n.offsetHeight;const u=n.getBoundingClientRect(),l=u.width||1,g=u.height||1;n.style.aspectRatio=i+"",i<l/g?(a=a==="auto"?g:Math.min(g,a),n.style.width="auto",n.style.height=`${a}px`):(r=r==="auto"?l:Math.min(l,r),n.style.width=`${r}px`,n.style.height="auto")}attach(){const e=this,n=e.instance;n.on("Carousel.beforeInitSlide",e.onBeforeInitSlide),n.on("Carousel.createSlide",e.onCreateSlide),n.on("Carousel.selectSlide",e.onSelectSlide),n.on("Carousel.unselectSlide",e.onUnselectSlide),n.on("Carousel.Panzoom.refresh",e.onRefresh),n.on("done",e.onDone),n.on("clearContent",e.onClearContent),window.addEventListener("message",e.onMessage)}detach(){const e=this,n=e.instance;n.off("Carousel.beforeInitSlide",e.onBeforeInitSlide),n.off("Carousel.createSlide",e.onCreateSlide),n.off("Carousel.selectSlide",e.onSelectSlide),n.off("Carousel.unselectSlide",e.onUnselectSlide),n.off("Carousel.Panzoom.refresh",e.onRefresh),n.off("done",e.onDone),n.off("clearContent",e.onClearContent),window.removeEventListener("message",e.onMessage)}}Object.defineProperty(_v,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:uB});const Qp="play",ef="pause",_h="ready";class bv extends Vs{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:_h}),Object.defineProperty(this,"inHover",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"progressBar",{enumerable:!0,configurable:!0,writable:!0,value:null})}get isActive(){return this.state!==_h}onReady(e){this.option("autoStart")&&(e.isInfinite||e.page<e.pages.length-1)&&this.start()}onChange(){this.removeProgressBar(),this.pause()}onSettle(){this.resume()}onVisibilityChange(){document.visibilityState==="visible"?this.resume():this.pause()}onMouseEnter(){this.inHover=!0,this.pause()}onMouseLeave(){var e;this.inHover=!1,!((e=this.instance.panzoom)===null||e===void 0)&&e.isResting&&this.resume()}onTimerEnd(){const e=this.instance;this.state==="play"&&(e.isInfinite||e.page!==e.pages.length-1?e.slideNext():e.slideTo(0))}removeProgressBar(){this.progressBar&&(this.progressBar.remove(),this.progressBar=null)}createProgressBar(){var e;if(!this.option("showProgress"))return null;this.removeProgressBar();const n=this.instance,i=((e=n.pages[n.page])===null||e===void 0?void 0:e.slides)||[];let r=this.option("progressParentEl");if(r||(r=(i.length===1?i[0].el:null)||n.viewport),!r)return null;const a=document.createElement("div");return Ct(a,"f-progress"),r.prepend(a),this.progressBar=a,a.offsetHeight,a}set(){const e=this,n=e.instance;if(n.pages.length<2||e.timer)return;const i=e.option("timeout");e.state=Qp,Ct(n.container,"has-autoplay");let r=e.createProgressBar();r&&(r.style.transitionDuration=`${i}ms`,r.style.transform="scaleX(1)"),e.timer=setTimeout(()=>{e.timer=null,e.inHover||e.onTimerEnd()},i),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!==_h){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,i=e.instance.container;e.clear(),e.state=_h,i.removeEventListener("mouseenter",e.onMouseEnter,!1),i.removeEventListener("mouseleave",e.onMouseLeave,!1),document.removeEventListener("visibilitychange",e.onVisibilityChange,!1),En(i,"has-autoplay"),n!==_h&&e.emit("stop")}pause(){const e=this;e.state===Qp&&(e.state=ef,e.clear(),e.emit(ef))}resume(){const e=this,n=e.instance;if(n.isInfinite||n.page!==n.pages.length-1)if(e.state!==Qp){if(e.state===ef&&!e.inHover){const i=new Event("resume",{bubbles:!0,cancelable:!0});e.emit("resume",i),i.defaultPrevented||e.set()}}else e.set();else e.stop()}toggle(){this.state===Qp||this.state===ef?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(bv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});class xv extends Vs{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 i=e.container;i&&(n.options.Autoplay=Tr({autoStart:!1},this.option("Autoplay")||{},{pauseOnHover:!1,timeout:this.option("timeout"),progressParentEl:()=>this.option("progressParentEl")||null,on:{start:()=>{e.emit("startSlideshow")},set:r=>{var a;i.classList.add("has-slideshow"),((a=e.getSlide())===null||a===void 0?void 0:a.state)!==Ki.Ready&&r.pause()},stop:()=>{i.classList.remove("has-slideshow"),e.isCompact||e.endIdle(),e.emit("endSlideshow")},resume:(r,a)=>{var u,l,g;!a||!a.cancelable||((u=e.getSlide())===null||u===void 0?void 0:u.state)===Ki.Ready&&(!((g=(l=e.carousel)===null||l===void 0?void 0:l.panzoom)===null||g===void 0)&&g.isResting)||a.preventDefault()}}}),n.attachPlugins({Autoplay:bv}),this.ref=n.plugins.Autoplay)}onReady(e){const n=e.carousel,i=this.ref;i&&n&&this.option("playOnStart")&&(n.isInfinite||n.page<n.pages.length-1)&&i.start()}onDone(e,n){const i=this.ref,r=e.carousel;if(!i||!r)return;const a=n.panzoom;a&&a.on("startAnimation",()=>{e.isCurrentSlide(n)&&i.stop()}),e.isCurrentSlide(n)&&i.resume()}onKeydown(e,n){var i;const r=this.ref;r&&n===this.option("key")&&((i=document.activeElement)===null||i===void 0?void 0:i.nodeName)!=="BUTTON"&&r.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(xv,"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 vv={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:'<button class="f-thumbs__slide__button" tabindex="0" type="button" aria-label="{{GOTO}}" data-carousel-index="%i"><img class="f-thumbs__slide__img" data-lazy-src="{{%s}}" alt="" /></button>',type:"modern"};var Oo;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden"})(Oo||(Oo={}));const wv="isResting",tf="thumbWidth",Tc="thumbHeight",no="thumbClipWidth";let kv=class extends Vs{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:Oo.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[no]=parseFloat(n[no]||"")||e[no]||0,e[Tc]=parseFloat(n.thumbHeight||"")||e[Tc]||0),this.addSlide(e)}onInitSlides(){this.build()}onChange(){var t;if(!this.isModern)return;const e=this.container,n=this.instance,i=n.panzoom,r=this.carousel,a=r?r.panzoom:null,u=n.page;if(i&&r&&a){if(i.isDragging){En(e,this.cn(wv));let l=((t=r.pages[u])===null||t===void 0?void 0:t.pos)||0;l+=n.getProgress(u)*(this[no]+this.thumbGap);let g=a.getBounds();-1*l>g.x.min&&-1*l<g.x.max&&a.panTo({x:-1*l,friction:.12})}else to(e,this.cn(wv),i.isResting);this.shiftModern()}}onRefresh(){this.updateProps();for(const t of this.instance.slides||[])this.resizeModernSlide(t);this.shiftModern()}isDisabled(){const t=this.option("minCount")||0;if(t){const n=this.instance;let i=0;for(const r of n.slides||[])r.thumbSrc&&i++;if(i<t)return!0}const e=this.option("type");return["modern","classic"].indexOf(e)<0}getThumb(t){const e=this.option("thumbTpl")||"";return{html:this.instance.localize(e,[["%i",t.index],["%d",t.index+1],["%s",t.thumbSrc||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"]])}}addSlide(t){const e=this.carousel;e&&e.addSlide(t.index,this.getThumb(t))}getSlides(){const t=[];for(const e of this.instance.slides||[])t.push(this.getThumb(e));return t}resizeModernSlide(t){this.isModern&&(t[tf]=t[no]&&t[Tc]?Math.round(this[Tc]*(t[no]/t[Tc])):this[tf])}updateProps(){const t=this.container;if(!t)return;const e=n=>parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-"+n))||0;this.thumbGap=e("gap"),this.thumbExtraGap=e("extra-gap"),this[tf]=e("width")||40,this[no]=e("clip-width")||40,this[Tc]=e("height")||40}build(){const t=this;if(t.state!==Oo.Init)return;if(t.isDisabled())return void t.emit("disabled");const e=t.instance,n=e.container,i=t.getSlides(),r=t.option("type");t.type=r;const a=t.option("parentEl"),u=t.cn("container"),l=t.cn("track");let g=a==null?void 0:a.querySelector("."+u);g||(g=document.createElement("div"),Ct(g,u),a?a.appendChild(g):n.after(g)),Ct(g,`is-${r}`),Ct(n,t.cn("hasThumbs")),t.container=g,t.updateProps();let b=g.querySelector("."+l);b||(b=document.createElement("div"),Ct(b,t.cn("track")),g.appendChild(b)),t.track=b;const S=Tr({},{track:b,infinite:!1,center:!0,fill:r==="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:i}),E=new e.constructor(g,S);E.on("createSlide",(C,P)=>{t.setProps(P.index),t.emit("createSlide",P,P.el)}),E.on("ready",()=>{t.shiftModern(),t.emit("ready")}),E.on("refresh",()=>{t.shiftModern()}),E.on("Panzoom.click",(C,P,D)=>{t.onClick(D)}),t.carousel=E,t.state=Oo.Ready}onClick(t){t.preventDefault(),t.stopPropagation();const e=this.instance,{pages:n,page:i}=e,r=R=>{if(R){const j=R.closest("[data-carousel-index]");if(j)return[parseInt(j.dataset.carouselIndex||"",10)||0,j]}return[-1,void 0]},a=(R,j)=>{const W=document.elementFromPoint(R,j);return W?r(W):[-1,void 0]};let[u,l]=r(t.target);if(u>-1)return;const g=this[no],b=t.clientX,S=t.clientY;let[E,C]=a(b-g,S),[P,D]=a(b+g,S);C&&D?(u=Math.abs(b-C.getBoundingClientRect().right)<Math.abs(b-D.getBoundingClientRect().left)?E:P,u===i&&(u=u===E?P:E)):C?u=E:D&&(u=P),u>-1&&n[u]&&e.slideTo(u)}getShift(t){var e;const n=this,{instance:i}=n,r=n.carousel;if(!i||!r)return 0;const a=n[tf],u=n[no],l=n.thumbGap,g=n.thumbExtraGap;if(!(!((e=r.slides[t])===null||e===void 0)&&e.el))return 0;const b=.5*(a-u),S=i.pages.length-1;let E=i.getProgress(0),C=i.getProgress(S),P=i.getProgress(t,!1,!0),D=0,R=b+g+l;const j=E<0&&E>-1,W=C>0&&C<1;return t===0?(D=R*Math.abs(E),W&&E===1&&(D-=R*Math.abs(C))):t===S?(D=R*Math.abs(C)*-1,j&&C===-1&&(D+=R*Math.abs(E))):j||W?(D=-1*R,D+=R*Math.abs(E),D+=R*(1-Math.abs(C))):D=R*P,D}setProps(t){var e;const n=this;if(!n.isModern)return;const{instance:i}=n,r=n.carousel;if(i&&r){const a=(e=r.slides[t])===null||e===void 0?void 0:e.el;if(a&&a.childNodes.length){let u=at(1-Math.abs(i.getProgress(t))),l=at(n.getShift(t));a.style.setProperty("--progress",u?u+"":""),a.style.setProperty("--shift",l+"")}}}shiftModern(){const t=this;if(!t.isModern)return;const{instance:e,track:n}=t,i=e.panzoom,r=t.carousel;if(!(e&&n&&i&&r)||i.state===In.Init||i.state===In.Destroy)return;for(const u of e.slides)t.setProps(u.index);let a=(t[no]+t.thumbGap)*(r.slides.length||0);n.style.setProperty("--width",a+"")}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=Oo.Init,En(t.instance.container,t.cn("hasThumbs"))}attach(){const t=this,e=t.instance;e.on("initSlide",t.onInitSlide),e.state===hi.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(kv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:vv});const dB=Object.assign(Object.assign({},vv),{key:"t",showOnStart:!0,parentEl:null}),Sv="is-masked",Ev="aria-hidden";class Cv extends Vs{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 i,r,a;const u=((a=(r=(i=this.instance)===null||i===void 0?void 0:i.carousel)===null||r===void 0?void 0:r.slides[n.index])===null||a===void 0?void 0:a.type)||"",l=n.el;if(l&&u){let g=`for-${u}`;["video","youtube","vimeo","html5video"].includes(u)&&(g+=" for-video"),Ct(l,g)}}onInit(){var e;const n=this,i=n.instance,r=i.carousel;if(n.ref||!r)return;const a=n.option("parentEl")||i.footer||i.container;if(!a)return;const u=Tr({},n.options,{parentEl:a,classes:{container:"f-thumbs fancybox__thumbs"},Carousel:{Sync:{friction:i.option("Carousel.friction")||0}},on:{ready:l=>{const g=l.container;g&&this.hidden&&(n.refresh(),g.style.transition="none",n.hide(),g.offsetHeight,queueMicrotask(()=>{g.style.transition="",n.show()}))}}});u.Carousel=u.Carousel||{},u.Carousel.on=Tr(((e=n.options.Carousel)===null||e===void 0?void 0:e.on)||{},{click:this.onClick,createSlide:this.onCreateSlide}),r.options.Thumbs=u,r.attachPlugins({Thumbs:kv}),n.ref=r.plugins.Thumbs,n.option("showOnStart")||(n.ref.state=Oo.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 i=this.option("key");i&&i===n&&this.toggle()}toggle(){const e=this.ref;if(e&&!e.isDisabled())return e.state===Oo.Hidden?(e.state=Oo.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(Ev),n.classList.remove(Sv),this.hidden=!1)}hide(){const e=this.ref,n=e&&e.container;n&&(this.refresh(),n.offsetHeight,n.classList.add(Sv),n.setAttribute(Ev,"true")),this.hidden=!0}refresh(){const e=this.ref;if(!e||!e.state)return;const n=e.container,i=(n==null?void 0:n.firstChild)||null;n&&i&&i.childNodes.length&&(n.style.maxHeight=`${i.getBoundingClientRect().height}px`)}attach(){const e=this,n=e.instance;n.state===Ei.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,i=n.instance;i.off("Carousel.init",n.onInit),i.off("resize",n.onResize),i.off("keydown",n.onKeydown),(e=i.carousel)===null||e===void 0||e.detachPlugins(["Thumbs"]),n.ref=null}}Object.defineProperty(Cv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:dB});const vy={panLeft:{icon:'<svg><path d="M5 12h14M5 12l6 6M5 12l6-6"/></svg>',change:{panX:-100}},panRight:{icon:'<svg><path d="M5 12h14M13 18l6-6M13 6l6 6"/></svg>',change:{panX:100}},panUp:{icon:'<svg><path d="M12 5v14M18 11l-6-6M6 11l6-6"/></svg>',change:{panY:-100}},panDown:{icon:'<svg><path d="M12 5v14M18 13l-6 6M6 13l6 6"/></svg>',change:{panY:100}},zoomIn:{icon:'<svg><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M11 8v6M8 11h6"/></svg>',action:"zoomIn"},zoomOut:{icon:'<svg><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>',action:"zoomOut"},toggle1to1:{icon:'<svg><path d="M3.51 3.07c5.74.02 11.48-.02 17.22.02 1.37.1 2.34 1.64 2.18 3.13 0 4.08.02 8.16 0 12.23-.1 1.54-1.47 2.64-2.79 2.46-5.61-.01-11.24.02-16.86-.01-1.36-.12-2.33-1.65-2.17-3.14 0-4.07-.02-8.16 0-12.23.1-1.36 1.22-2.48 2.42-2.46Z"/><path d="M5.65 8.54h1.49v6.92m8.94-6.92h1.49v6.92M11.5 9.4v.02m0 5.18v0"/></svg>',action:"toggleZoom"},toggleZoom:{icon:'<svg><g><line x1="11" y1="8" x2="11" y2="14"></line></g><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>',action:"toggleZoom"},iterateZoom:{icon:'<svg><g><line x1="11" y1="8" x2="11" y2="14"></line></g><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>',action:"iterateZoom"},rotateCCW:{icon:'<svg><path d="M15 4.55a8 8 0 0 0-6 14.9M9 15v5H4M18.37 7.16v.01M13 19.94v.01M16.84 18.37v.01M19.37 15.1v.01M19.94 11v.01"/></svg>',action:"rotateCCW"},rotateCW:{icon:'<svg><path d="M9 4.55a8 8 0 0 1 6 14.9M15 15v5h5M5.63 7.16v.01M4.06 11v.01M4.63 15.1v.01M7.16 18.37v.01M11 19.94v.01"/></svg>',action:"rotateCW"},flipX:{icon:'<svg style="stroke-width: 1.3"><path d="M12 3v18M16 7v10h5L16 7M8 7v10H3L8 7"/></svg>',action:"flipX"},flipY:{icon:'<svg style="stroke-width: 1.3"><path d="M3 12h18M7 16h10L7 21v-5M7 8h10L7 3v5"/></svg>',action:"flipY"},fitX:{icon:'<svg><path d="M4 12V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v6M10 18H3M21 18h-7M6 15l-3 3 3 3M18 15l3 3-3 3"/></svg>',action:"fitX"},fitY:{icon:'<svg><path d="M12 20H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h6M18 14v7M18 3v7M15 18l3 3 3-3M15 6l3-3 3 3"/></svg>',action:"fitY"},reset:{icon:'<svg><path d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/></svg>',action:"reset"},toggleFS:{icon:'<svg><g><path d="M14.5 9.5 21 3m0 0h-6m6 0v6M3 21l6.5-6.5M3 21v-6m0 6h6"/></g><g><path d="m14 10 7-7m-7 7h6m-6 0V4M3 21l7-7m0 0v6m0-6H4"/></g></svg>',action:"toggleFS"}};var _l;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Disabled=2]="Disabled"})(_l||(_l={}));const pB={absolute:"auto",display:{left:["infobar"],middle:[],right:["iterateZoom","slideshow","fullscreen","thumbs","close"]},enabled:"auto",items:{infobar:{tpl:'<div class="fancybox__infobar" tabindex="-1"><span data-fancybox-current-index></span>/<span data-fancybox-count></span></div>'},download:{tpl:'<a class="f-button" title="{{DOWNLOAD}}" data-fancybox-download href="javasript:;"><svg><path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2M7 11l5 5 5-5M12 4v12"/></svg></a>'},prev:{tpl:'<button class="f-button" title="{{PREV}}" data-fancybox-prev><svg><path d="m15 6-6 6 6 6"/></svg></button>'},next:{tpl:'<button class="f-button" title="{{NEXT}}" data-fancybox-next><svg><path d="m9 6 6 6-6 6"/></svg></button>'},slideshow:{tpl:'<button class="f-button" title="{{TOGGLE_SLIDESHOW}}" data-fancybox-toggle-slideshow><svg><g><path d="M8 4v16l13 -8z"></path></g><g><path d="M8 4v15M17 4v15"/></g></svg></button>'},fullscreen:{tpl:'<button class="f-button" title="{{TOGGLE_FULLSCREEN}}" data-fancybox-toggle-fullscreen><svg><g><path d="M4 8V6a2 2 0 0 1 2-2h2M4 16v2a2 2 0 0 0 2 2h2M16 4h2a2 2 0 0 1 2 2v2M16 20h2a2 2 0 0 0 2-2v-2"/></g><g><path d="M15 19v-2a2 2 0 0 1 2-2h2M15 5v2a2 2 0 0 0 2 2h2M5 15h2a2 2 0 0 1 2 2v2M5 9h2a2 2 0 0 0 2-2V5"/></g></svg></button>'},thumbs:{tpl:'<button class="f-button" title="{{TOGGLE_THUMBS}}" data-fancybox-toggle-thumbs><svg><circle cx="5.5" cy="5.5" r="1"/><circle cx="12" cy="5.5" r="1"/><circle cx="18.5" cy="5.5" r="1"/><circle cx="5.5" cy="12" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="18.5" cy="12" r="1"/><circle cx="5.5" cy="18.5" r="1"/><circle cx="12" cy="18.5" r="1"/><circle cx="18.5" cy="18.5" r="1"/></svg></button>'},close:{tpl:'<button class="f-button" title="{{CLOSE}}" data-fancybox-close><svg><path d="m19.5 4.5-15 15M4.5 4.5l15 15"/></svg></button>'}},parentEl:null},fB={tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Tv="has-toolbar",wy="fancybox__toolbar";class Mv extends Vs{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:_l.Init}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}onReady(e){var n;if(!e.carousel)return;let i=this.option("display"),r=this.option("absolute"),a=this.option("enabled");if(a==="auto"){const b=this.instance.carousel;let S=0;if(b)for(const E of b.slides)(E.panzoom||E.type==="image")&&S++;S||(a=!1)}a||(i=void 0);let u=0;const l={left:[],middle:[],right:[]};if(i)for(const b of["left","middle","right"])for(const S of i[b]){const E=this.createEl(S);E&&((n=l[b])===null||n===void 0||n.push(E),u++)}let g=null;if(u&&(g=this.createContainer()),g){for(const[b,S]of Object.entries(l)){const E=document.createElement("div");Ct(E,wy+"__column is-"+b);for(const C of S)E.appendChild(C);r!=="auto"||b!=="middle"||S.length||(r=!0),g.appendChild(E)}r===!0&&Ct(g,"is-absolute"),this.state=_l.Ready,this.onRefresh()}else this.state=_l.Disabled}onClick(e){var n,i;const r=this.instance,a=r.getSlide(),u=a==null?void 0:a.panzoom,l=e.target,g=l&&Mr(l)?l.dataset:null;if(!g)return;if(g.fancyboxToggleThumbs!==void 0)return e.preventDefault(),e.stopPropagation(),void((n=r.plugins.Thumbs)===null||n===void 0||n.toggle());if(g.fancyboxToggleFullscreen!==void 0)return e.preventDefault(),e.stopPropagation(),void this.instance.toggleFullscreen();if(g.fancyboxToggleSlideshow!==void 0){e.preventDefault(),e.stopPropagation();const E=(i=r.carousel)===null||i===void 0?void 0:i.plugins.Autoplay;let C=E.isActive;return u&&u.panMode==="mousemove"&&!C&&u.reset(),void(C?E.stop():E.start())}const b=g.panzoomAction,S=g.panzoomChange;if((S||b)&&(e.preventDefault(),e.stopPropagation()),S){let E={};try{E=JSON.parse(S)}catch{}u&&u.applyChange(E)}else b&&u&&u[b]&&u[b]()}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!==Ki.Ready)return;const i=n&&!n.error&&n.panzoom;for(const u of e.querySelectorAll("[data-panzoom-action]"))i?(u.removeAttribute("disabled"),u.removeAttribute("tabindex")):(u.setAttribute("disabled",""),u.setAttribute("tabindex","-1"));let r=i&&i.canZoomIn(),a=i&&i.canZoomOut();for(const u of e.querySelectorAll('[data-panzoom-action="zoomIn"]'))r?(u.removeAttribute("disabled"),u.removeAttribute("tabindex")):(u.setAttribute("disabled",""),u.setAttribute("tabindex","-1"));for(const u of e.querySelectorAll('[data-panzoom-action="zoomOut"]'))a?(u.removeAttribute("disabled"),u.removeAttribute("tabindex")):(u.setAttribute("disabled",""),u.setAttribute("tabindex","-1"));for(const u of e.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){a||r?(u.removeAttribute("disabled"),u.removeAttribute("tabindex")):(u.setAttribute("disabled",""),u.setAttribute("tabindex","-1"));const l=u.querySelector("g");l&&(l.style.display=r?"":"none")}}onDone(e,n){var i;(i=n.panzoom)===null||i===void 0||i.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 i=n.querySelector("."+wy);return i||(i=document.createElement("div"),Ct(i,wy),n.prepend(i)),i.addEventListener("click",this.onClick,{passive:!1,capture:!0}),e&&Ct(e,Tv),this.container=i,i}createEl(e){const n=this.instance,i=n.carousel;if(!i||e==="toggleFS"||e==="fullscreen"&&!lv())return null;let r=null;const a=i.slides.length||0;let u=0,l=0;for(const b of i.slides)(b.panzoom||b.type==="image")&&u++,(b.type==="image"||b.downloadSrc)&&l++;if(a<2&&["infobar","prev","next"].includes(e))return r;if(vy[e]!==void 0&&!u||e==="download"&&!l)return null;if(e==="thumbs"){const b=n.plugins.Thumbs;if(!b||!b.isEnabled)return null}if(e==="slideshow"&&(!i.plugins.Autoplay||a<2))return null;if(vy[e]!==void 0){const b=vy[e];r=document.createElement("button"),r.setAttribute("title",this.instance.localize(`{{${e.toUpperCase()}}}`)),Ct(r,"f-button"),b.action&&(r.dataset.panzoomAction=b.action),b.change&&(r.dataset.panzoomChange=JSON.stringify(b.change)),r.appendChild(eo(this.instance.localize(b.icon)))}else{const b=(this.option("items")||[])[e];b&&(r=eo(this.instance.localize(b.tpl)),typeof b.click=="function"&&r.addEventListener("click",S=>{S.preventDefault(),S.stopPropagation(),typeof b.click=="function"&&b.click.call(this,this,S)}))}const g=r==null?void 0:r.querySelector("svg");if(g)for(const[b,S]of Object.entries(fB))g.getAttribute(b)||g.setAttribute(b,String(S));return r}removeContainer(){const e=this.container;e&&e.remove(),this.container=null,this.state=_l.Disabled;const n=this.instance.container;n&&En(n,Tv)}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(Mv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:pB});const mB={Hash:class extends Vs{onReady(){gh=!1}onChange(t){gl&&clearTimeout(gl);const{hash:e}=uv(),{hash:n}=Kp(),i=t.isOpeningSlide(t.getSlide());i&&(cv=n===e?"":n),e&&e!==n&&(gl=setTimeout(()=>{try{if(t.state===Ei.Ready){let r="replaceState";i&&!Xp&&(r="pushState",Xp=!0),window.history[r]({},document.title,window.location.pathname+window.location.search+e)}}catch{}},300))}onClose(t){if(gl&&clearTimeout(gl),!gh&&Xp)return Xp=!1,gh=!1,void window.history.back();if(!gh)try{window.history.replaceState({},document.title,window.location.pathname+window.location.search+(cv||""))}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 Kp()}static startFromUrl(){hv()}static destroy(){window.removeEventListener("hashchange",pv,!1)}},Html:_v,Images:mv,Slideshow:xv,Thumbs:Cv,Toolbar:Mv},Av="with-fancybox",ky="hide-scrollbar",Iv="--fancybox-scrollbar-compensate",Pv="--fancybox-body-margin",Sy="aria-hidden",Ey="is-using-tab",Cy="is-animated",Dv="is-compact",Ov="is-loading",Ty="is-opening",nf="has-caption",Mc="disabled",bl="tabindex",zv="download",My="href",Ac="src",da=t=>typeof t=="string",Bv=function(){var t=window.getSelection();return!!t&&t.type==="Range"};let ms,gs=null,xl=null,Nv=0,Rv=0,Lv=0,Vv=0;const Ic=new Map;let gB=0;class gn extends hy{get isIdle(){return this.idle}get isCompact(){return this.option("compact")}constructor(e=[],n={},i={}){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:Ei.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}),ms||(ms=lv()),this.id=n.id||++gB,Ic.set(this.id,this),this.userSlides=e,this.userPlugins=i,queueMicrotask(()=>{this.init()})}init(){if(this.state===Ei.Destroy)return;this.state=Ei.Init,this.attachPlugins(Object.assign(Object.assign({},gn.Plugins),this.userPlugins)),this.emit("init"),this.emit("attachPlugins"),this.option("hideScrollbar")===!0&&(()=>{if(!mh)return;const n=document,i=n.body,r=n.documentElement;if(i.classList.contains(ky))return;let a=window.innerWidth-r.getBoundingClientRect().width;const u=parseFloat(window.getComputedStyle(i).marginRight);a<0&&(a=0),r.style.setProperty(Iv,`${a}px`),u&&i.style.setProperty(Pv,`${u}px`),i.classList.add(ky)})(),this.initLayout(),this.scale();const e=()=>{this.initCarousel(this.userSlides),this.state=Ei.Ready,this.attachEvents(),this.emit("ready"),setTimeout(()=>{this.container&&this.container.setAttribute(Sy,"false")},16)};this.option("Fullscreen.autoStart")&&ms&&!ms.isFullscreen()?ms.request().then(()=>{this.startedFs=!0,e()}).catch(()=>e()):e()}initLayout(){var e,n;const i=this.option("parentEl")||document.body,r=eo(this.localize(this.option("tpl.main")||""));if(r){if(r.setAttribute("id",`fancybox-${this.id}`),r.setAttribute("aria-label",this.localize("{{MODAL}}")),r.classList.toggle(Dv,this.isCompact),Ct(r,this.option("mainClass")||""),Ct(r,Ty),this.container=r,this.footer=r.querySelector(".fancybox__footer"),i.appendChild(r),Ct(document.documentElement,Av),gs&&xl||(gs=document.createElement("span"),Ct(gs,"fancybox-focus-guard"),gs.setAttribute(bl,"0"),gs.setAttribute(Sy,"true"),gs.setAttribute("aria-label","Focus guard"),xl=gs.cloneNode(),(e=r.parentElement)===null||e===void 0||e.insertBefore(gs,r),(n=r.parentElement)===null||n===void 0||n.append(xl)),r.addEventListener("mousedown",a=>{Nv=a.pageX,Rv=a.pageY,En(r,Ey)}),this.option("closeExisting"))for(const a of Ic.values())a.id!==this.id&&a.close();else this.option("animated")&&(Ct(r,Cy),setTimeout(()=>{this.isClosing()||En(r,Cy)},350));this.emit("initLayout")}}initCarousel(e){const n=this.container;if(!n)return;const i=n.querySelector(".fancybox__carousel");if(!i)return;const r=this.carousel=new ha(i,Tr({},{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")||{}));r.on("*",(a,u,...l)=>{this.emit(`Carousel.${u}`,a,...l)}),r.on(["ready","change"],()=>{this.manageCaption()}),this.on("Carousel.removeSlide",(a,u,l)=>{this.clearContent(l),l.state=void 0}),r.on("Panzoom.touchStart",()=>{var a,u;this.isCompact||this.endIdle(),!((a=document.activeElement)===null||a===void 0)&&a.closest(".f-thumbs")&&((u=this.container)===null||u===void 0||u.focus())}),r.on("settle",()=>{this.idleTimer||this.isCompact||!this.option("idle")||this.setIdle(),this.option("autoFocus")&&!this.isClosing&&this.checkFocus()}),this.option("dragToClose")&&(r.on("Panzoom.afterTransform",(a,u)=>{const l=this.getSlide();if(l&&ay(l.el))return;const g=this.container;if(g){const b=Math.abs(u.current.f),S=b<1?"":Math.max(.5,Math.min(1,1-b/u.contentRect.fitHeight*1.5));g.style.setProperty("--fancybox-ts",S?"0s":""),g.style.setProperty("--fancybox-opacity",S+"")}}),r.on("Panzoom.touchEnd",(a,u,l)=>{var g;const b=this.getSlide();if(b&&ay(b.el)||u.isMobile&&document.activeElement&&["TEXTAREA","INPUT"].indexOf((g=document.activeElement)===null||g===void 0?void 0:g.nodeName)!==-1)return;const S=Math.abs(u.dragOffset.y);u.lockedAxis==="y"&&(S>=200||S>=50&&u.dragOffset.time<300)&&(l&&l.cancelable&&l.preventDefault(),this.close(l,"f-throwOut"+(u.current.f<0?"Up":"Down")))})),r.on("change",a=>{var u;let l=(u=this.getSlide())===null||u===void 0?void 0:u.triggerEl;if(l){const g=new CustomEvent("slideTo",{bubbles:!0,cancelable:!0,detail:a.page});l.dispatchEvent(g)}}),r.on(["refresh","change"],a=>{const u=this.container;if(!u)return;for(const b of u.querySelectorAll("[data-fancybox-current-index]"))b.innerHTML=a.page+1;for(const b of u.querySelectorAll("[data-fancybox-count]"))b.innerHTML=a.pages.length;if(!a.isInfinite){for(const b of u.querySelectorAll("[data-fancybox-next]"))a.page<a.pages.length-1?(b.removeAttribute(Mc),b.removeAttribute(bl)):(b.setAttribute(Mc,""),b.setAttribute(bl,"-1"));for(const b of u.querySelectorAll("[data-fancybox-prev]"))a.page>0?(b.removeAttribute(Mc),b.removeAttribute(bl)):(b.setAttribute(Mc,""),b.setAttribute(bl,"-1"))}const l=this.getSlide();if(!l)return;let g=l.downloadSrc||"";g||l.type!=="image"||l.error||!da(l[Ac])||(g=l[Ac]);for(const b of u.querySelectorAll("[data-fancybox-download]")){const S=l.downloadFilename;g?(b.removeAttribute(Mc),b.removeAttribute(bl),b.setAttribute(My,g),b.setAttribute(zv,S||g),b.setAttribute("target","_blank")):(b.setAttribute(Mc,""),b.setAttribute(bl,"-1"),b.removeAttribute(My),b.removeAttribute(zv))}}),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 i=window.visualViewport;i&&(i.addEventListener("scroll",e.onResize),i.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 i=window.visualViewport;i&&(i.removeEventListener("resize",e.onResize),i.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,i=Math.max(1,(n==null?void 0:n.scale)||1);let r="",a="",u="";if(n&&i>1){let l=`${n.offsetLeft}px`,g=`${n.offsetTop}px`;r=n.width*i+"px",a=n.height*i+"px",u=`translate3d(${l}, ${g}, 0) scale(${1/i})`}e.style.transform=u,e.style.width=r,e.style.height=a}onClick(e){var n;const{container:i,isCompact:r}=this;if(!i||this.isClosing())return;!r&&this.option("idle")&&this.resetIdle();const a=e.composedPath()[0];if(a.closest(".fancybox-spinner")||a.closest("[data-fancybox-close]"))return e.preventDefault(),void this.close(e);if(a.closest("[data-fancybox-prev]"))return e.preventDefault(),void this.prev();if(a.closest("[data-fancybox-next]"))return e.preventDefault(),void this.next();if(e.type==="click"&&e.detail===0||Math.abs(e.pageX-Nv)>30||Math.abs(e.pageY-Rv)>30)return;const u=document.activeElement;if(Bv()&&u&&i.contains(u))return;if(r&&((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 l=!1;if(a.closest(".fancybox__content")){if(u){if(u.closest("[contenteditable]"))return;a.matches(yy)||u.blur()}if(Bv())return;l=this.option("contentClick")}else a.closest(".fancybox__carousel")&&!a.matches(yy)&&(l=this.option("backdropClick"));l==="close"?(e.preventDefault(),this.close(e)):l==="next"?(e.preventDefault(),this.next()):l==="prev"&&(e.preventDefault(),this.prev())}onWheel(e){const n=e.target;let i=this.option("wheel",e);n.closest(".fancybox__thumbs")&&(i="slide");const r=i==="slide",a=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(g,b){return Math.abs(b)>Math.abs(g)?b:g}),u=Math.max(-1,Math.min(1,a)),l=Date.now();this.pwt&&l-this.pwt<300?r&&e.preventDefault():(this.pwt=l,this.emit("wheel",e,u),e.defaultPrevented||(i==="close"?(e.preventDefault(),this.close(e)):i==="slide"&&(jp(n)||(e.preventDefault(),this[u>0?"prev":"next"]()))))}onScroll(){window.scrollTo(Lv,Vv)}onKeydown(e){if(!this.isTopmost())return;this.isCompact||!this.option("idle")||this.isClosing()||this.resetIdle();const n=e.key,i=this.option("keyboard");if(!i)return;const r=e.composedPath()[0],a=document.activeElement&&document.activeElement.classList,u=a&&a.contains("f-button")||r.dataset.carouselPage||r.dataset.carouselIndex;if(n!=="Escape"&&!u&&Mr(r)&&(r.isContentEditable||["TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(r.nodeName)!==-1)||(e.key==="Tab"?Ct(this.container,Ey):En(this.container,Ey),e.ctrlKey||e.altKey||e.shiftKey))return;this.emit("keydown",n,e);const l=i[n];l&&typeof this[l]=="function"&&(e.preventDefault(),this[l]())}onResize(){const e=this.container;if(!e)return;const n=this.isCompact;e.classList.toggle(Dv,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 r=this.plugins.Toolbar;if(r&&r.state===_l.Ready)return}if(!n||!e.contentEl||e.closeBtnEl)return;const i=this.option("tpl.closeButton");if(i){const r=eo(this.localize(i));e.closeBtnEl=e.contentEl.appendChild(r),e.el&&Ct(e.el,"has-close-btn")}}manageCaption(e=void 0){var n,i;const r="fancybox__caption",a=this.container;if(!a)return;En(a,nf);const u=this.isCompact||this.option("commonCaption"),l=!u;if(this.caption&&this.stop(this.caption),l&&this.caption&&(this.caption.remove(),this.caption=null),u&&!this.caption)for(const E of((n=this.carousel)===null||n===void 0?void 0:n.slides)||[])E.captionEl&&(E.captionEl.remove(),E.captionEl=void 0,En(E.el,nf),(i=E.el)===null||i===void 0||i.removeAttribute("aria-labelledby"));if(e||(e=this.getSlide()),!e||u&&!this.isCurrentSlide(e))return;const g=e.el;let b=this.optionFor(e,"caption","");if(!b)return void(u&&this.caption&&this.animate(this.caption,"f-fadeOut",()=>{this.caption&&(this.caption.innerHTML="")}));let S=null;if(l){if(S=e.captionEl||null,g&&!S){const E=r+`_${this.id}_${e.index}`;S=document.createElement("div"),Ct(S,r),S.setAttribute("id",E),e.captionEl=g.appendChild(S),Ct(g,nf),g.setAttribute("aria-labelledby",E)}}else S=this.caption,S||(S=a.querySelector("."+r)),!S&&(S=document.createElement("div"),S.dataset.fancyboxCaption="",Ct(S,r),(this.footer||a).prepend(S)),Ct(a,nf),this.caption=S;S&&(S.innerHTML="",da(b)||typeof b=="number"?S.innerHTML=b+"":b instanceof HTMLElement&&S.appendChild(b))}checkFocus(e){this.focus(e)}focus(e){var n;if(this.ignoreFocusChange)return;const i=document.activeElement||null,r=(e==null?void 0:e.target)||null,a=this.container,u=(n=this.carousel)===null||n===void 0?void 0:n.viewport;if(!a||!u||!e&&i&&a.contains(i))return;const l=this.getSlide(),g=l&&l.state===Ki.Ready?l.el:null;if(!g||g.contains(i)||a===i)return;e&&e.cancelable&&e.preventDefault(),this.ignoreFocusChange=!0;const b=Array.from(a.querySelectorAll(yy));let S=[],E=null;for(let P of b){const D=!P.offsetParent||!!P.closest('[aria-hidden="true"]'),R=g&&g.contains(P),j=!u.contains(P);if(P===a||(R||j)&&!D){S.push(P);const W=P.dataset.origTabindex;W!==void 0&&W&&(P.tabIndex=parseFloat(W)),P.removeAttribute("data-orig-tabindex"),!P.hasAttribute("autoFocus")&&E||(E=P)}else{const W=P.dataset.origTabindex===void 0?P.getAttribute("tabindex")||"":P.dataset.origTabindex;W&&(P.dataset.origTabindex=W),P.tabIndex=-1}}let C=null;e?(!r||S.indexOf(r)<0)&&(C=E||a,S.length&&(i===xl?C=S[0]:this.lastFocus!==a&&i!==gs||(C=S[S.length-1]))):C=l&&l.type==="image"?a:E||a,C&&av(C),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=gn.getInstance())===null||e===void 0?void 0:e.id)==this.id}animate(e=null,n="",i){if(!e||!n)return void(i&&i());this.stop(e);const r=a=>{a.target===e&&e.dataset.animationName&&(e.removeEventListener("animationend",r),delete e.dataset.animationName,i&&i(),En(e,n))};e.dataset.animationName=n,e.addEventListener("animationend",r),Ct(e,n)}stop(e){e&&e.dispatchEvent(new CustomEvent("animationend",{bubbles:!1,cancelable:!0,currentTarget:e}))}setContent(e,n="",i=!0){if(this.isClosing())return;const r=e.el;if(!r)return;let a=null;if(Mr(n)?a=n:(a=eo(n+""),Mr(a)||(a=document.createElement("div"),a.innerHTML=n+"")),["img","picture","iframe","video","audio"].includes(a.nodeName.toLowerCase())){const u=document.createElement("div");u.appendChild(a),a=u}Mr(a)&&e.filter&&!e.error&&(a=a.querySelector(e.filter)),a&&Mr(a)?(Ct(a,"fancybox__content"),e.id&&a.setAttribute("id",e.id),r.classList.add(`has-${e.error?"error":e.type||"unknown"}`),r.prepend(a),a.style.display==="none"&&(a.style.display=""),getComputedStyle(a).getPropertyValue("display")==="none"&&(a.style.display=e.display||this.option("defaultDisplay")||"flex"),e.contentEl=a,i&&this.revealContent(e),this.manageCloseBtn(e),this.manageCaption(e)):this.setError(e,"{{ELEMENT_NOT_FOUND}}")}revealContent(e,n){const i=e.el,r=e.contentEl;i&&r&&(this.emit("reveal",e),this.hideLoading(e),e.state=Ki.Opening,(n=this.isOpeningSlide(e)?n===void 0?this.optionFor(e,"showClass"):n:"f-fadeIn")?this.animate(r,n,()=>{this.done(e)}):this.done(e))}done(e){this.isClosing()||(e.state=Ki.Ready,this.emit("done",e),Ct(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)&&(En(this.container,Ty),!this.isCompact&&this.option("idle")&&this.setIdle()))}isCurrentSlide(e){const n=this.getSlide();return!(!e||!n)&&n.index===e.index}isOpeningSlide(e){var n,i;return((n=this.carousel)===null||n===void 0?void 0:n.prevPage)===null&&e&&e.index===((i=this.getSlide())===null||i===void 0?void 0:i.index)}showLoading(e){e.state=Ki.Loading;const n=e.el;n&&(Ct(n,Ov),this.emit("loading",e),e.spinnerEl||setTimeout(()=>{if(!this.isClosing()&&!e.spinnerEl&&e.state===Ki.Loading){let i=eo(dy);Ct(i,"fancybox-spinner"),e.spinnerEl=i,n.prepend(i),this.animate(i,"f-fadeIn")}},250))}hideLoading(e){const n=e.el;if(!n)return;const i=e.spinnerEl;this.isClosing()?i==null||i.remove():(En(n,Ov),i&&this.animate(i,"f-fadeOut",()=>{i.remove()}),e.state===Ki.Loading&&(this.emit("loaded",e),e.state=Ki.Ready))}setError(e,n){if(this.isClosing())return;const i=new Event("error",{bubbles:!0,cancelable:!0});if(this.emit("error",i,e),i.defaultPrevented)return;e.error=n,this.hideLoading(e),this.clearContent(e);const r=document.createElement("div");r.classList.add("fancybox-error"),r.innerHTML=this.localize(n||"<p>{{ERROR}}</p>"),this.setContent(e,r)}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&&(En(n,"has-error"),En(n,"has-unknown"),En(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 i=new Event("shouldClose",{bubbles:!0,cancelable:!0});if(this.emit("shouldClose",i,e),i.defaultPrevented)return;e&&e.cancelable&&(e.preventDefault(),e.stopPropagation());const r=()=>{this.proceedClose(e,n)};this.startedFs&&ms&&ms.isFullscreen()?Promise.resolve(ms.exit()).then(()=>r()):r()}clearIdle(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=null}setIdle(e=!1){const n=()=>{this.clearIdle(),this.idle=!0,Ct(this.container,"is-idle"),this.emit("setIdle")};if(this.clearIdle(),!this.isClosing())if(e)n();else{const i=this.option("idle");i&&(this.idleTimer=setTimeout(n,i))}}endIdle(){this.clearIdle(),this.idle&&!this.isClosing()&&(this.idle=!1,En(this.container,"is-idle"),this.emit("endIdle"))}resetIdle(){this.endIdle(),this.setIdle()}toggleIdle(){this.idle?this.endIdle():this.setIdle(!0)}toggleFullscreen(){ms&&(ms.isFullscreen()?ms.exit():ms.request().then(()=>{this.startedFs=!0}))}isClosing(){return[Ei.Closing,Ei.CustomClosing,Ei.Destroy].includes(this.state)}proceedClose(e,n){var i,r;this.state=Ei.Closing,this.clearIdle(),this.detachEvents();const a=this.container,u=this.carousel,l=this.getSlide(),g=l&&this.option("placeFocusBack")?l.triggerEl||this.option("triggerEl"):null;if(g&&(ov(g)?av(g):g.focus()),a&&(En(a,Ty),Ct(a,"is-closing"),a.setAttribute(Sy,"true"),this.option("animated")&&Ct(a,Cy),a.style.pointerEvents="none"),u){u.clearTransitions(),(i=u.panzoom)===null||i===void 0||i.destroy(),(r=u.plugins.Navigation)===null||r===void 0||r.detach();for(const b of u.slides){b.state=Ki.Closing,this.hideLoading(b);const S=b.contentEl;S&&this.stop(S);const E=b==null?void 0:b.panzoom;E&&(E.stop(),E.detachEvents(),E.detachObserver()),this.isCurrentSlide(b)||u.emit("removeSlide",b)}}Lv=window.scrollX,Vv=window.scrollY,window.addEventListener("scroll",this.onScroll),this.emit("close",e),this.state!==Ei.CustomClosing?(n===void 0&&l&&(n=this.optionFor(l,"hideClass")),n&&l?(this.animate(l.contentEl,n,()=>{u&&u.emit("removeSlide",l)}),setTimeout(()=>{this.destroy()},500)):this.destroy()):setTimeout(()=>{this.destroy()},500)}destroy(){var e;if(this.state===Ei.Destroy)return;window.removeEventListener("scroll",this.onScroll),this.state=Ei.Destroy,(e=this.carousel)===null||e===void 0||e.destroy();const n=this.container;n&&n.remove(),Ic.delete(this.id);const i=gn.getInstance();i?i.focus():(gs&&(gs.remove(),gs=null),xl&&(xl.remove(),xl=null),En(document.documentElement,Av),(()=>{if(!mh)return;const r=document,a=r.body;a.classList.remove(ky),a.style.setProperty(Pv,""),r.documentElement.style.setProperty(Iv,"")})(),this.emit("destroy"))}static bind(e,n,i){if(!mh)return;let r,a="",u={};if(e===void 0?r=document.body:da(e)?(r=document.body,a=e,typeof n=="object"&&(u=n||{})):(r=e,da(n)&&(a=n),typeof i=="object"&&(u=i||{})),!r||!Mr(r))return;a=a||"[data-fancybox]";const l=gn.openers.get(r)||new Map;l.set(a,u),gn.openers.set(r,l),l.size===1&&r.addEventListener("click",gn.fromEvent)}static unbind(e,n){let i,r="";if(da(e)?(i=document.body,r=e):(i=e,da(n)&&(r=n)),!i)return;const a=gn.openers.get(i);a&&r&&a.delete(r),r&&a||(gn.openers.delete(i),i.removeEventListener("click",gn.fromEvent))}static destroy(){let e;for(;e=gn.getInstance();)e.destroy();for(const n of gn.openers.keys())n.removeEventListener("click",gn.fromEvent);gn.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 i=n.closest("[data-fancybox-trigger]");if(i){const D=i.dataset.fancyboxTrigger||"",R=document.querySelectorAll(`[data-fancybox="${D}"]`),j=parseInt(i.dataset.fancyboxIndex||"",10)||0;n=R[j]||n}if(!(n&&n instanceof Element))return;let r,a,u,l;if([...gn.openers].reverse().find(([D,R])=>!(!D.contains(n)||![...R].reverse().find(([j,W])=>{let ee=n.closest(j);return!!ee&&(r=D,a=j,u=ee,l=W,!0)}))),!r||!a||!u)return;l=l||{},e.preventDefault(),n=u;let g=[],b=Tr({},_y,l);b.event=e,b.triggerEl=n,b.delegate=i;const S=b.groupAll,E=b.groupAttr,C=E&&n?n.getAttribute(`${E}`):"";if((!n||C||S)&&(g=[].slice.call(r.querySelectorAll(a))),n&&!S&&(g=C?g.filter(D=>D.getAttribute(`${E}`)===C):[n]),!g.length)return;const P=gn.getInstance();return P&&P.options.triggerEl&&g.indexOf(P.options.triggerEl)>-1?void 0:(n&&(b.startIndex=g.indexOf(n)),gn.fromNodes(g,b))}static fromSelector(e,n,i){let r=null,a="",u={};if(da(e)?(r=document.body,a=e,typeof n=="object"&&(u=n||{})):e instanceof HTMLElement&&da(n)&&(r=e,a=n,typeof i=="object"&&(u=i||{})),!r||!a)return!1;const l=gn.openers.get(r);return!!l&&(u=Tr({},l.get(a)||{},u),!!u&&gn.fromNodes(Array.from(r.querySelectorAll(a)),u))}static fromNodes(e,n){n=Tr({},_y,n||{});const i=[];for(const r of e){const a=r.dataset||{},u=a[Ac]||r.getAttribute(My)||r.getAttribute("currentSrc")||r.getAttribute(Ac)||void 0;let l;const g=n.delegate;let b;g&&i.length===n.startIndex&&(l=g instanceof HTMLImageElement?g:g.querySelector("img:not([aria-hidden])")),l||(l=r instanceof HTMLImageElement?r:r.querySelector("img:not([aria-hidden])")),l&&(b=l.currentSrc||l[Ac]||void 0,!b&&l.dataset&&(b=l.dataset.lazySrc||l.dataset[Ac]||void 0));const S={src:u,triggerEl:r,thumbEl:l,thumbElSrc:b,thumbSrc:b};for(const E in a){let C=a[E]+"";C=C!=="false"&&(C==="true"||C),S[E]=C}i.push(S)}return new gn(i,n)}static getInstance(e){return e?Ic.get(e):Array.from(Ic.values()).reverse().find(n=>!n.isClosing()&&n)||null}static getSlide(){var e;return((e=gn.getInstance())===null||e===void 0?void 0:e.getSlide())||null}static show(e=[],n={}){return new gn(e,n)}static next(){const e=gn.getInstance();e&&e.next()}static prev(){const e=gn.getInstance();e&&e.prev()}static close(e=!0,...n){if(e)for(const i of Ic.values())i.close(...n);else{const i=gn.getInstance();i&&i.close(...n)}}}Object.defineProperty(gn,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(gn,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:_y}),Object.defineProperty(gn,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:mB}),Object.defineProperty(gn,"openers",{enumerable:!0,configurable:!0,writable:!0,value:new Map});const Fv=Object.freeze(Object.defineProperty({__proto__:null,Carousel:ha,Fancybox:gn,Panzoom:ua},Symbol.toStringTag,{value:"Module"})),{Fancybox:rf}=Fv,yB={props:{options:Object},mounted(){rf.defaults={...this.options||{}}},updated(){rf.close(),rf.defaults={...this.options||{}}},unmounted(){rf.close()}},_B={ref:"container"};function bB(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",_B,[f.renderSlot(t.$slots,"default")],512)}const xB=$e(yB,[["render",bB]]),vB={},wB={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-file"};function kB(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",wB,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"},null,-1),f.createElementVNode("path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"},null,-1)]))}const SB={componens:{IconFile:$e(vB,[["render",kB]])},props:{item:null},computed:{createDate(){try{const t=ut(this.item.cdate,"YYYY-MM-DD");return new Date(t).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}}},EB={style:{"max-width":"calc(50vw - 300px)"}},CB={class:"truncate text-sm font-semibold text-gray-800 dark:text-neutral-200"},TB={class:"block truncate text-xs text-gray-500 dark:text-neutral-500"};function MB(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock(f.Fragment,null,[e[0]||(e[0]=f.createStaticVNode('<div class="flex items-center justify-center h-[30px] w-[30px]"><svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-file"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path></svg></div>',1)),f.createElementVNode("div",EB,[f.createElementVNode("p",CB,f.toDisplayString(n.item.uploaded_name),1),f.createElementVNode("p",TB,[f.createElementVNode("span",null,f.toDisplayString(n.item.username),1),f.createTextVNode(" "+f.toDisplayString(a.createDate),1)])])],64)}const AB=$e(SB,[["render",MB]]),IB={},PB={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function DB(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",PB,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),f.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),f.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const $v=$e(IB,[["render",DB]]),OB={},zB={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function BB(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",zB,e[0]||(e[0]=[f.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const jv=$e(OB,[["render",BB]]),NB={components:{Fancybox:xB,VsWidgetFileInfo:AB,IconDownload:$v,IconTrash:jv},props:{item:null},data(){return{optionsFile:{defaultType:"iframe"}}},computed:{createDate(){try{const t=ut(this.item.cdate,"YYYY-MM-DD");return new Date(t).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}},methods:{isSupportedFile(t){return["pdf","txt","json"].includes(t.ext)&&parseInt(t.size,10)<=10485760},async downloadFile(t){const e=document.createElement("a");e.setAttribute("download",t.uploaded_name),e.href=t.file_path,e.click()},confirnDeleteFile(){this.$emit("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:this.deleteFile,updateListOnConfirm:!0})},async deleteFile(){try{await ct.delete(`/api/widget/file/${this.item.entity_id}/${this.item.file_id}`),this.$emit("update")}catch(t){console.error(t)}}}},RB={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-xl w-full"},LB={key:0,class:"flex"},VB=["href"],FB={key:1,class:"flex"},$B=["href"],jB={key:2,class:"flex gap-x-3 w-full"},UB={class:"lg:absolute lg:top-3 lg:end-3 group-hover:opacity-100 lg:opacity-0"},HB={class:"p-0.5 sm:p-1 inline-flex items-center gap-0.5 bg-white border border-gray-200 lg:shadow rounded-lg dark:bg-neutral-800 dark:border-neutral-700"},qB={class:"hs-tooltip inline-block"},WB={class:"hs-tooltip inline-block"};function GB(t,e,n,i,r,a){const u=f.resolveComponent("VsWidgetFileInfo"),l=f.resolveComponent("Fancybox"),g=f.resolveComponent("IconDownload"),b=f.resolveComponent("IconTrash");return f.openBlock(),f.createElementBlock("div",RB,[n.item.ext==="jpg"||n.item.ext==="png"?(f.openBlock(),f.createElementBlock("div",LB,[f.createVNode(l,null,{default:f.withCtx(()=>[f.createElementVNode("a",{"data-fancybox":"gallery",href:n.item.file_path,target:"_blank",class:"flex gap-x-3 w-full"},[f.createVNode(u,{item:n.item},null,8,["item"])],8,VB)]),_:1})])):a.isSupportedFile(n.item)?(f.openBlock(),f.createElementBlock("div",FB,[f.createVNode(l,{options:r.optionsFile},{default:f.withCtx(()=>[f.createElementVNode("a",{"data-fancybox":"gallery",href:n.item.file_path,target:"_blank",class:"flex gap-x-3 w-full"},[f.createVNode(u,{item:n.item},null,8,["item"])],8,$B)]),_:1},8,["options"])])):(f.openBlock(),f.createElementBlock("div",jB,[f.createVNode(u,{item:n.item},null,8,["item"])])),f.createElementVNode("div",UB,[f.createElementVNode("div",HB,[f.createElementVNode("div",qB,[f.createElementVNode("button",{class:"hs-tooltip-toggle inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[0]||(e[0]=S=>a.downloadFile(n.item))},[f.createVNode(g,{height:"14",width:"14"})])]),e[2]||(e[2]=f.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),f.createElementVNode("div",WB,[f.createElementVNode("button",{type:"button",class:"hs-tooltip-toggle size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20","data-hs-overlay":"#hs-pro-dupfmdl",onClick:e[1]||(e[1]=S=>a.confirnDeleteFile())},[f.createVNode(b,{height:"14",width:"14"})])])])])])}const ZB=$e(NB,[["render",GB]]),YB={props:["text"]},XB={class:"pl-3 text-sm font-medium text-gray-600"};function KB(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",null,[f.createElementVNode("p",XB,f.toDisplayString(n.text),1)])}const Uv=$e(YB,[["render",KB]]),JB={},QB={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-upload"};function eN(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",QB,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),f.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),f.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Hv=$e(JB,[["render",eN]]),tN={components:{VsWidgetFileItem:ZB,VsEmptyWidget:Uv,IconUpload:Hv},props:{id:{type:String,default(){return""}},prefilledData:{}},data(){return{isModalVisible:!1,modal:{},files:"",searchValue:""}},mounted(){this.getFileList()},computed:{filteredFiles(){return this.searchValue===""?this.files:this.files.filter(e=>e.uploaded_name.includes(this.searchValue))}},methods:{async getFileList(){if(this.prefilledData){this.files=this.prefilledData.rows;return}try{const{data:t}=await ct.get(`/api/widget/file/${this.id}`);this.files=t==null?void 0:t.rows}catch(t){console.error(t)}},async addFile(t){console.log(t),await Promise.all(Array.from(t.target.files).map(async e=>{const n=new FormData;n.append("file",e);try{const i=`/api/widget/file/${this.id}`;return await ct.post(i,n),this.$emit("update","file-list"),e}catch(i){return console.error(i),null}})),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}}},nN={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700"},iN={class:"flex justify-between w-full pb-[10px] items-center gap-x-2"},rN={key:0,class:"font-semibold text-gray-800 dark:text-neutral-200"},sN={class:"ml-auto"},oN={class:"inline-flex items-center p-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"},aN={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},lN={class:"relative"},cN={key:1,class:"space-y-3 pr-[6px] max-h-[300px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},uN={key:0},hN={class:"p-4"},dN={class:"mt-1 text-gray-500 dark:text-neutral-500"},pN={class:"flex justify-end mt-4 gap-x-3"};function fN(t,e,n,i,r,a){var S,E,C;const u=f.resolveComponent("IconUpload"),l=f.resolveComponent("VsWidgetFileItem"),g=f.resolveComponent("VsEmptyWidget"),b=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock("div",nN,[f.createElementVNode("div",iN,[(S=r.files)!=null&&S.length?(f.openBlock(),f.createElementBlock("h2",rN," Кількість: "+f.toDisplayString(r.files.length),1)):f.createCommentVNode("",!0),f.createElementVNode("div",sN,[f.createElementVNode("label",null,[f.createElementVNode("input",{type:"file",class:"hidden",onChange:e[0]||(e[0]=P=>a.addFile(P))},null,32),f.createElementVNode("div",oN,[f.createVNode(u,{height:"20",width:"20"})])])])]),((E=r.files)==null?void 0:E.length)>4?(f.openBlock(),f.createElementBlock("div",aN,[f.createElementVNode("div",null,[f.createElementVNode("div",lN,[e[7]||(e[7]=f.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-20 ps-3.5"},[f.createElementVNode("svg",{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400",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"},[f.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),f.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),f.withDirectives(f.createElementVNode("input",{type:"text","onUpdate:modelValue":e[1]||(e[1]=P=>r.searchValue=P),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[f.vModelText,r.searchValue,void 0,{trim:!0}]])])])])):f.createCommentVNode("",!0),(C=r.files)!=null&&C.length?(f.openBlock(),f.createElementBlock("div",cN,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.filteredFiles,(P,D)=>(f.openBlock(),f.createBlock(l,{key:D,id:n.id,item:P,onUpdate:e[2]||(e[2]=R=>t.$emit("update","file-list")),onOpenModal:e[3]||(e[3]=R=>a.handleOpenModal(R))},null,8,["id","item"]))),128)),a.filteredFiles.length?f.createCommentVNode("",!0):(f.openBlock(),f.createElementBlock("div",uN,e[8]||(e[8]=[f.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):(f.openBlock(),f.createBlock(g,{key:2,text:"Файли відсутні"})),f.createVNode(b,{title:r.modal.title,size:"small",visible:r.isModalVisible,"onUpdate:visible":e[6]||(e[6]=P=>r.isModalVisible=P)},{default:f.withCtx(()=>[f.createElementVNode("div",hN,[f.createElementVNode("p",dN,f.toDisplayString(r.modal.message),1),f.createElementVNode("div",pN,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[4]||(e[4]=(...P)=>r.modal.cancel&&r.modal.cancel(...P))},f.toDisplayString(r.modal.cancelButtonText),1),f.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[5]||(e[5]=(...P)=>r.modal.confirm&&r.modal.confirm(...P))},f.toDisplayString(r.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const qv=$e(tN,[["render",fN]]),mN={class:"flex flex-col vs-widget-images xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700"},gN={class:"flex items-center justify-between mb-4 gap-x-2"},yN={class:"flex items-center justify-end gap-x-2"},_N={class:"inline-flex items-center p-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"},bN={class:"flex flex-wrap gap-[16px]"},xN=["href","data-caption"],vN=["src","alt"],wN={class:"item__text-content bg-white opacity-0 rounded-b-lg absolute w-full bottom-0 p-3 flex gap-2.5 items-center justify-between"},kN={class:"text-xs w-[180px] block overflow-hidden text-nowrap overflow-ellipsis"},SN={class:"flex flex-wrap items-center text-xs text-gray-600 widget-images__item-desc"},EN={class:"flex items-center"},CN={class:"text-xs"},TN=["onClick"],MN=["onClick"],AN={class:"p-4"},IN={class:"mt-1 text-gray-500 dark:text-neutral-500"},PN={class:"flex justify-end mt-4 gap-x-3"},DN={__name:"vs-widget-gallery",props:{id:{type:String,default:""},readonly:{type:Boolean,default:!1},prefilledData:{type:Array,default:()=>[]}},setup(t){const{Fancybox:e}=Fv,n=t,i=f.ref([]),r=f.ref(!1),a=f.ref(null),u=f.ref({}),l=async()=>{var D;if((D=n==null?void 0:n.prefilledData)!=null&&D.length){i.value=n==null?void 0:n.prefilledData,e.bind("[data-fancybox='gallery']");return}try{const{data:R}=await ct.get(`/api/widget/gallery/${n==null?void 0:n.id}`);i.value=R==null?void 0:R.rows,e.bind("[data-fancybox='gallery']")}catch(R){console.error(R)}},g=async D=>{var j;const R=Array.from((j=D.target)==null?void 0:j.files);await Promise.all(R.map(async W=>{const ee=new FormData;ee.append("file",W);try{await ct.post(`/api/widget/file/${n==null?void 0:n.id}`,ee)}catch(le){console.error(le)}})),await l()},b=D=>{const R=document.createElement("a");R.setAttribute("download",D==null?void 0:D.uploaded_name),R.href=D==null?void 0:D.file_path,R.click()},S=D=>{a.value=D,u.value={title:"Ви впевнені?",message:"Ви впевнені що хочете видалити зображення?",confirmButtonText:"Так, видалити ",cancelButtonText:"Відмінити",confirm:async()=>{await E(),r.value=!1,await l()},cancel:()=>{r.value=!1}},r.value=!0},E=async()=>{var D,R;try{await ct.delete(`/api/widget/gallery/${(D=a.value)==null?void 0:D.entity_id}/${(R=a.value)==null?void 0:R.file_id}`)}catch(j){console.error(j)}},C=(D,R=2)=>{if(D===0)return"0 Bytes";const j=1024,W=R<0?0:R,ee=["Bytes","KB","MB","GB","TB"],le=Math.floor(Math.log(D)/Math.log(j));return`${parseFloat((D/j**le).toFixed(W))} ${ee[le]}`},P=D=>{const R={day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric"};return new Date(D).toLocaleDateString("ru-RU",R)};return f.watch(()=>n.id,l),f.onMounted(l),(D,R)=>{const j=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock("div",mN,[f.createElementVNode("div",gN,[R[3]||(R[3]=f.createElementVNode("h2",{class:"inline-block font-semibold text-gray-800 dark:text-neutral-200"},null,-1)),f.createElementVNode("div",yN,[f.createElementVNode("div",null,[f.createElementVNode("label",null,[f.createElementVNode("input",{type:"file",class:"hidden",onChange:g},null,32),f.createElementVNode("div",_N,[f.createVNode(Hv,{height:"20",width:"20"})])])])])]),f.createElementVNode("div",bN,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(i.value,W=>(f.openBlock(),f.createElementBlock("div",{key:W.file_path,class:"relative cursor-pointer rounded-b-lg item hover:shadow-lg h-[200px] w-[300px]"},[f.createElementVNode("a",{href:W.file_path,"data-fancybox":"gallery","data-caption":W.uploaded_name,target:"_blank"},[f.createElementVNode("img",{class:"object-cover w-full h-full rounded-lg",src:W.file_path||"/icons/no-image.jpg",alt:W.uploaded_name},null,8,vN),f.createElementVNode("div",wN,[f.createElementVNode("div",null,[f.createElementVNode("span",kN,f.toDisplayString(W.uploaded_name),1),f.createElementVNode("div",SN,[f.createElementVNode("span",EN,f.toDisplayString(C(W.size)),1),f.createElementVNode("span",null,f.toDisplayString(P(W.cdate)),1)]),f.createElementVNode("span",CN,f.toDisplayString(W.username),1)]),f.createElementVNode("div",null,[f.createElementVNode("div",{class:"flex items-center justify-center gap-2 hover:bg-gray-200 p-[6px] rounded",onClick:f.withModifiers(ee=>b(W),["prevent"])},[f.createVNode($v,{height:"14",width:"14"})],8,TN),f.createElementVNode("div",{class:"flex items-center gap-2 hover:bg-gray-200 p-[6px] rounded hover:cursor-pointer",onClick:f.withModifiers(ee=>S(W),["prevent"])},[f.createVNode(jv,{height:"14",width:"14"})],8,MN)])])],8,xN)]))),128))]),f.createVNode(j,{title:u.value.title,size:"small",visible:r.value,"onUpdate:visible":R[2]||(R[2]=W=>r.value=W)},{default:f.withCtx(()=>[f.createElementVNode("div",AN,[f.createElementVNode("p",IN,f.toDisplayString(u.value.message),1),f.createElementVNode("div",PN,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:R[0]||(R[0]=(...W)=>u.value.cancel&&u.value.cancel(...W))},f.toDisplayString(u.value.cancelButtonText),1),f.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600",onClick:R[1]||(R[1]=(...W)=>u.value.confirm&&u.value.confirm(...W))},f.toDisplayString(u.value.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}}};function Vi(t){this.content=t}Vi.prototype={constructor:Vi,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var i=n&&n!=t?this.remove(n):this,r=i.find(t),a=i.content.slice();return r==-1?a.push(n||t,e):(a[r+1]=e,n&&(a[r]=n)),new Vi(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Vi(n)},addToStart:function(t,e){return new Vi([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Vi(n)},addBefore:function(t,e,n){var i=this.remove(e),r=i.content.slice(),a=i.find(t);return r.splice(a==-1?r.length:a,0,e,n),new Vi(r)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Vi.from(t),t.size?new Vi(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Vi.from(t),t.size?new Vi(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Vi.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},Vi.from=function(t){if(t instanceof Vi)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Vi(e)};function Wv(t,e,n){for(let i=0;;i++){if(i==t.childCount||i==e.childCount)return t.childCount==e.childCount?null:n;let r=t.child(i),a=e.child(i);if(r==a){n+=r.nodeSize;continue}if(!r.sameMarkup(a))return n;if(r.isText&&r.text!=a.text){for(let u=0;r.text[u]==a.text[u];u++)n++;return n}if(r.content.size||a.content.size){let u=Wv(r.content,a.content,n+1);if(u!=null)return u}n+=r.nodeSize}}function Gv(t,e,n,i){for(let r=t.childCount,a=e.childCount;;){if(r==0||a==0)return r==a?null:{a:n,b:i};let u=t.child(--r),l=e.child(--a),g=u.nodeSize;if(u==l){n-=g,i-=g;continue}if(!u.sameMarkup(l))return{a:n,b:i};if(u.isText&&u.text!=l.text){let b=0,S=Math.min(u.text.length,l.text.length);for(;b<S&&u.text[u.text.length-b-1]==l.text[l.text.length-b-1];)b++,n--,i--;return{a:n,b:i}}if(u.content.size||l.content.size){let b=Gv(u.content,l.content,n-1,i-1);if(b)return b}n-=g,i-=g}}class Fe{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let i=0;i<e.length;i++)this.size+=e[i].nodeSize}nodesBetween(e,n,i,r=0,a){for(let u=0,l=0;l<n;u++){let g=this.content[u],b=l+g.nodeSize;if(b>e&&i(g,r+l,a||null,u)!==!1&&g.content.size){let S=l+1;g.nodesBetween(Math.max(0,e-S),Math.min(g.content.size,n-S),i,r+S)}l=b}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,i,r){let a="",u=!0;return this.nodesBetween(e,n,(l,g)=>{let b=l.isText?l.text.slice(Math.max(e,g)-g,n-g):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&b||l.isTextblock)&&i&&(u?u=!1:a+=i),a+=b},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,i=e.firstChild,r=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(i)&&(r[r.length-1]=n.withText(n.text+i.text),a=1);a<e.content.length;a++)r.push(e.content[a]);return new Fe(r,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let i=[],r=0;if(n>e)for(let a=0,u=0;u<n;a++){let l=this.content[a],g=u+l.nodeSize;g>e&&((u<e||g>n)&&(l.isText?l=l.cut(Math.max(0,e-u),Math.min(l.text.length,n-u)):l=l.cut(Math.max(0,e-u-1),Math.min(l.content.size,n-u-1))),i.push(l),r+=l.nodeSize),u=g}return new Fe(i,r)}cutByIndex(e,n){return e==n?Fe.empty:e==0&&n==this.content.length?this:new Fe(this.content.slice(e,n))}replaceChild(e,n){let i=this.content[e];if(i==n)return this;let r=this.content.slice(),a=this.size+n.nodeSize-i.nodeSize;return r[e]=n,new Fe(r,a)}addToStart(e){return new Fe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Fe(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,i=0;n<this.content.length;n++){let r=this.content[n];e(r,i,n),i+=r.nodeSize}}findDiffStart(e,n=0){return Wv(this,e,n)}findDiffEnd(e,n=this.size,i=e.size){return Gv(this,e,n,i)}findIndex(e,n=-1){if(e==0)return sf(0,e);if(e==this.size)return sf(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let i=0,r=0;;i++){let a=this.child(i),u=r+a.nodeSize;if(u>=e)return u==e||n>0?sf(i+1,u):sf(i,r);r=u}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Fe.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Fe(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Fe.empty;let n,i=0;for(let r=0;r<e.length;r++){let a=e[r];i+=a.nodeSize,r&&a.isText&&e[r-1].sameMarkup(a)?(n||(n=e.slice(0,r)),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new Fe(n||e,i)}static from(e){if(!e)return Fe.empty;if(e instanceof Fe)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Fe([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Fe.empty=new Fe([],0);const Ay={index:0,offset:0};function sf(t,e){return Ay.index=t,Ay.offset=e,Ay}function of(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!of(t[i],e[i]))return!1}else{for(let i in t)if(!(i in e)||!of(t[i],e[i]))return!1;for(let i in e)if(!(i in t))return!1}return!0}let Hn=class mb{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,i=!1;for(let r=0;r<e.length;r++){let a=e[r];if(this.eq(a))return e;if(this.type.excludes(a.type))n||(n=e.slice(0,r));else{if(a.type.excludes(this.type))return e;!i&&a.type.rank>this.type.rank&&(n||(n=e.slice(0,r)),n.push(this),i=!0),n&&n.push(a)}}return n||(n=e.slice()),i||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&of(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let i=e.marks[n.type];if(!i)throw new RangeError(`There is no mark type ${n.type} in this schema`);let r=i.create(n.attrs);return i.checkAttrs(r.attrs),r}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let i=0;i<e.length;i++)if(!e[i].eq(n[i]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return mb.none;if(e instanceof mb)return[e];let n=e.slice();return n.sort((i,r)=>i.type.rank-r.type.rank),n}};Hn.none=[];class af extends Error{}class dt{constructor(e,n,i){this.content=e,this.openStart=n,this.openEnd=i}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let i=Yv(this.content,e+this.openStart,n);return i&&new dt(i,this.openStart,this.openEnd)}removeBetween(e,n){return new dt(Zv(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return dt.empty;let i=n.openStart||0,r=n.openEnd||0;if(typeof i!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new dt(Fe.fromJSON(e,n.content),i,r)}static maxOpen(e,n=!0){let i=0,r=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)i++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)r++;return new dt(e,i,r)}}dt.empty=new dt(Fe.empty,0,0);function Zv(t,e,n){let{index:i,offset:r}=t.findIndex(e),a=t.maybeChild(i),{index:u,offset:l}=t.findIndex(n);if(r==e||a.isText){if(l!=n&&!t.child(u).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(i!=u)throw new RangeError("Removing non-flat range");return t.replaceChild(i,a.copy(Zv(a.content,e-r-1,n-r-1)))}function Yv(t,e,n,i){let{index:r,offset:a}=t.findIndex(e),u=t.maybeChild(r);if(a==e||u.isText)return t.cut(0,e).append(n).append(t.cut(e));let l=Yv(u.content,e-a-1,n);return l&&t.replaceChild(r,u.copy(l))}function ON(t,e,n){if(n.openStart>t.depth)throw new af("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new af("Inconsistent open depths");return Xv(t,e,n,0)}function Xv(t,e,n,i){let r=t.index(i),a=t.node(i);if(r==e.index(i)&&i<t.depth-n.openStart){let u=Xv(t,e,n,i+1);return a.copy(a.content.replaceChild(r,u))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==i&&e.depth==i){let u=t.parent,l=u.content;return wl(u,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:u,end:l}=zN(n,t);return wl(a,Jv(t,u,l,e,i))}else return wl(a,lf(t,e,i))}function Kv(t,e){if(!e.type.compatibleContent(t.type))throw new af("Cannot join "+e.type.name+" onto "+t.type.name)}function Iy(t,e,n){let i=t.node(n);return Kv(i,e.node(n)),i}function vl(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function bh(t,e,n,i){let r=(e||t).node(n),a=0,u=e?e.index(n):r.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(vl(t.nodeAfter,i),a++));for(let l=a;l<u;l++)vl(r.child(l),i);e&&e.depth==n&&e.textOffset&&vl(e.nodeBefore,i)}function wl(t,e){return t.type.checkContent(e),t.copy(e)}function Jv(t,e,n,i,r){let a=t.depth>r&&Iy(t,e,r+1),u=i.depth>r&&Iy(n,i,r+1),l=[];return bh(null,t,r,l),a&&u&&e.index(r)==n.index(r)?(Kv(a,u),vl(wl(a,Jv(t,e,n,i,r+1)),l)):(a&&vl(wl(a,lf(t,e,r+1)),l),bh(e,n,r,l),u&&vl(wl(u,lf(n,i,r+1)),l)),bh(i,null,r,l),new Fe(l)}function lf(t,e,n){let i=[];if(bh(null,t,n,i),t.depth>n){let r=Iy(t,e,n+1);vl(wl(r,lf(t,e,n+1)),i)}return bh(e,null,n,i),new Fe(i)}function zN(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)r=e.node(a).copy(Fe.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class xh{constructor(e,n,i){this.pos=e,this.path=n,this.parentOffset=i,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let i=this.pos-this.path[this.path.length-1],r=e.child(n);return i?e.child(n).cut(i):r}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let i=this.path[n*3],r=n==0?0:this.path[n*3-1]+1;for(let a=0;a<e;a++)r+=i.child(a).nodeSize;return r}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Hn.none;if(this.textOffset)return e.child(n).marks;let i=e.maybeChild(n-1),r=e.maybeChild(n);if(!i){let l=i;i=r,r=l}let a=i.marks;for(var u=0;u<a.length;u++)a[u].type.spec.inclusive===!1&&(!r||!a[u].isInSet(r.marks))&&(a=a[u--].removeFromSet(a));return a}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let i=n.marks,r=e.parent.maybeChild(e.index());for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let i=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);i>=0;i--)if(e.pos<=this.end(i)&&(!n||n(this.node(i))))return new cf(this,e,i);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let i=[],r=0,a=n;for(let u=e;;){let{index:l,offset:g}=u.content.findIndex(a),b=a-g;if(i.push(u,l,r+g),!b||(u=u.child(l),u.isText))break;a=b-1,r+=g+1}return new xh(n,i,a)}static resolveCached(e,n){let i=Qv.get(e);if(i)for(let a=0;a<i.elts.length;a++){let u=i.elts[a];if(u.pos==n)return u}else Qv.set(e,i=new BN);let r=i.elts[i.i]=xh.resolve(e,n);return i.i=(i.i+1)%NN,r}}class BN{constructor(){this.elts=[],this.i=0}}const NN=12,Qv=new WeakMap;class cf{constructor(e,n,i){this.$from=e,this.$to=n,this.depth=i}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const RN=Object.create(null);let kl=class gb{constructor(e,n,i,r=Hn.none){this.type=e,this.attrs=n,this.marks=r,this.content=i||Fe.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,i,r=0){this.content.nodesBetween(e,n,i,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,i,r){return this.content.textBetween(e,n,i,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,i){return this.type==e&&of(this.attrs,n||e.defaultAttrs||RN)&&Hn.sameSet(this.marks,i||Hn.none)}copy(e=null){return e==this.content?this:new gb(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new gb(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,i=!1){if(e==n)return dt.empty;let r=this.resolve(e),a=this.resolve(n),u=i?0:r.sharedDepth(n),l=r.start(u),b=r.node(u).content.cut(r.pos-l,a.pos-l);return new dt(b,r.depth-u,a.depth-u)}replace(e,n,i){return ON(this.resolve(e),this.resolve(n),i)}nodeAt(e){for(let n=this;;){let{index:i,offset:r}=n.content.findIndex(e);if(n=n.maybeChild(i),!n)return null;if(r==e||n.isText)return n;e-=r+1}}childAfter(e){let{index:n,offset:i}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:i}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:i}=this.content.findIndex(e);if(i<e)return{node:this.content.child(n),index:n,offset:i};let r=this.content.child(n-1);return{node:r,index:n-1,offset:i-r.nodeSize}}resolve(e){return xh.resolveCached(this,e)}resolveNoCache(e){return xh.resolve(this,e)}rangeHasMark(e,n,i){let r=!1;return n>e&&this.nodesBetween(e,n,a=>(i.isInSet(a.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),ew(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,i=Fe.empty,r=0,a=i.childCount){let u=this.contentMatchAt(e).matchFragment(i,r,a),l=u&&u.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let g=r;g<a;g++)if(!this.type.allowsMarks(i.child(g).marks))return!1;return!0}canReplaceWith(e,n,i,r){if(r&&!this.type.allowsMarks(r))return!1;let a=this.contentMatchAt(e).matchType(i),u=a&&a.matchFragment(this.content,n);return u?u.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Hn.none;for(let n=0;n<this.marks.length;n++){let i=this.marks[n];i.type.checkAttrs(i.attrs),e=i.addToSet(e)}if(!Hn.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let i;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");i=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,i)}let r=Fe.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,r,i);return a.type.checkAttrs(a.attrs),a}};kl.prototype.text=void 0;class uf extends kl{constructor(e,n,i,r){if(super(e,n,null,r),!i)throw new RangeError("Empty text nodes are not allowed");this.text=i}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ew(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new uf(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new uf(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function ew(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Sl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let i=new LN(e,n);if(i.next==null)return Sl.empty;let r=tw(i);i.next&&i.err("Unexpected trailing text");let a=qN(HN(r));return WN(a,i),a}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,i=e.childCount){let r=this;for(let a=n;r&&a<i;a++)r=r.matchType(e.child(a).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let i=0;i<e.next.length;i++)if(this.next[n].type==e.next[i].type)return!0;return!1}fillBefore(e,n=!1,i=0){let r=[this];function a(u,l){let g=u.matchFragment(e,i);if(g&&(!n||g.validEnd))return Fe.from(l.map(b=>b.createAndFill()));for(let b=0;b<u.next.length;b++){let{type:S,next:E}=u.next[b];if(!(S.isText||S.hasRequiredAttrs())&&r.indexOf(E)==-1){r.push(E);let C=a(E,l.concat(S));if(C)return C}}return null}return a(this,[])}findWrapping(e){for(let i=0;i<this.wrapCache.length;i+=2)if(this.wrapCache[i]==e)return this.wrapCache[i+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),i=[{match:this,type:null,via:null}];for(;i.length;){let r=i.shift(),a=r.match;if(a.matchType(e)){let u=[];for(let l=r;l.type;l=l.via)u.push(l.type);return u.reverse()}for(let u=0;u<a.next.length;u++){let{type:l,next:g}=a.next[u];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!r.type||g.validEnd)&&(i.push({match:l.contentMatch,type:l,via:r}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(i){e.push(i);for(let r=0;r<i.next.length;r++)e.indexOf(i.next[r].next)==-1&&n(i.next[r].next)}return n(this),e.map((i,r)=>{let a=r+(i.validEnd?"*":" ")+" ";for(let u=0;u<i.next.length;u++)a+=(u?", ":"")+i.next[u].type.name+"->"+e.indexOf(i.next[u].next);return a}).join(`
|
630
|
-
`)}}Sl.empty=new Sl(!0);class LN{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function tw(t){let e=[];do e.push(VN(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function VN(t){let e=[];do e.push(FN(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function FN(t){let e=UN(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=$N(t,e);else break;return e}function nw(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function $N(t,e){let n=nw(t),i=n;return t.eat(",")&&(t.next!="}"?i=nw(t):i=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:i,expr:e}}function jN(t,e){let n=t.nodeTypes,i=n[e];if(i)return[i];let r=[];for(let a in n){let u=n[a];u.groups.indexOf(e)>-1&&r.push(u)}return r.length==0&&t.err("No node type or group '"+e+"' found"),r}function UN(t){if(t.eat("(")){let e=tw(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=jN(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function HN(t){let e=[[]];return r(a(t,0),n()),e;function n(){return e.push([])-1}function i(u,l,g){let b={term:g,to:l};return e[u].push(b),b}function r(u,l){u.forEach(g=>g.to=l)}function a(u,l){if(u.type=="choice")return u.exprs.reduce((g,b)=>g.concat(a(b,l)),[]);if(u.type=="seq")for(let g=0;;g++){let b=a(u.exprs[g],l);if(g==u.exprs.length-1)return b;r(b,l=n())}else if(u.type=="star"){let g=n();return i(l,g),r(a(u.expr,g),g),[i(g)]}else if(u.type=="plus"){let g=n();return r(a(u.expr,l),g),r(a(u.expr,g),g),[i(g)]}else{if(u.type=="opt")return[i(l)].concat(a(u.expr,l));if(u.type=="range"){let g=l;for(let b=0;b<u.min;b++){let S=n();r(a(u.expr,g),S),g=S}if(u.max==-1)r(a(u.expr,g),g);else for(let b=u.min;b<u.max;b++){let S=n();i(g,S),r(a(u.expr,g),S),g=S}return[i(g)]}else{if(u.type=="name")return[i(l,void 0,u.value)];throw new Error("Unknown expr type")}}}}function iw(t,e){return e-t}function rw(t,e){let n=[];return i(e),n.sort(iw);function i(r){let a=t[r];if(a.length==1&&!a[0].term)return i(a[0].to);n.push(r);for(let u=0;u<a.length;u++){let{term:l,to:g}=a[u];!l&&n.indexOf(g)==-1&&i(g)}}}function qN(t){let e=Object.create(null);return n(rw(t,0));function n(i){let r=[];i.forEach(u=>{t[u].forEach(({term:l,to:g})=>{if(!l)return;let b;for(let S=0;S<r.length;S++)r[S][0]==l&&(b=r[S][1]);rw(t,g).forEach(S=>{b||r.push([l,b=[]]),b.indexOf(S)==-1&&b.push(S)})})});let a=e[i.join(",")]=new Sl(i.indexOf(t.length-1)>-1);for(let u=0;u<r.length;u++){let l=r[u][1].sort(iw);a.next.push({type:r[u][0],next:e[l.join(",")]||n(l)})}return a}}function WN(t,e){for(let n=0,i=[t];n<i.length;n++){let r=i[n],a=!r.validEnd,u=[];for(let l=0;l<r.next.length;l++){let{type:g,next:b}=r.next[l];u.push(g.name),a&&!(g.isText||g.hasRequiredAttrs())&&(a=!1),i.indexOf(b)==-1&&i.push(b)}a&&e.err("Only non-generatable nodes ("+u.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function sw(t){let e=Object.create(null);for(let n in t){let i=t[n];if(!i.hasDefault)return null;e[n]=i.default}return e}function ow(t,e){let n=Object.create(null);for(let i in t){let r=e&&e[i];if(r===void 0){let a=t[i];if(a.hasDefault)r=a.default;else throw new RangeError("No value supplied for attribute "+i)}n[i]=r}return n}function aw(t,e,n,i){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let r in t){let a=t[r];a.validate&&a.validate(e[r])}}function lw(t,e){let n=Object.create(null);if(e)for(let i in e)n[i]=new ZN(t,i,e[i]);return n}let cw=class xC{constructor(e,n,i){this.name=e,this.schema=n,this.spec=i,this.markSet=null,this.groups=i.group?i.group.split(" "):[],this.attrs=lw(e,i.attrs),this.defaultAttrs=sw(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(i.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Sl.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:ow(this.attrs,e)}create(e=null,n,i){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new kl(this,this.computeAttrs(e),Fe.from(n),Hn.setFrom(i))}createChecked(e=null,n,i){return n=Fe.from(n),this.checkContent(n),new kl(this,this.computeAttrs(e),n,Hn.setFrom(i))}createAndFill(e=null,n,i){if(e=this.computeAttrs(e),n=Fe.from(n),n.size){let u=this.contentMatch.fillBefore(n);if(!u)return null;n=u.append(n)}let r=this.contentMatch.matchFragment(n),a=r&&r.fillBefore(Fe.empty,!0);return a?new kl(this,e,n.append(a),Hn.setFrom(i)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let i=0;i<e.childCount;i++)if(!this.allowsMarks(e.child(i).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){aw(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let i=0;i<e.length;i++)this.allowsMarkType(e[i].type)?n&&n.push(e[i]):n||(n=e.slice(0,i));return n?n.length?n:Hn.none:e}static compile(e,n){let i=Object.create(null);e.forEach((a,u)=>i[a]=new xC(a,n,u));let r=n.spec.topNode||"doc";if(!i[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!i.text)throw new RangeError("Every schema needs a 'text' type");for(let a in i.text.attrs)throw new RangeError("The text node type should not have attributes");return i}};function GN(t,e,n){let i=n.split("|");return r=>{let a=r===null?"null":typeof r;if(i.indexOf(a)<0)throw new RangeError(`Expected value of type ${i} for attribute ${e} on type ${t}, got ${a}`)}}class ZN{constructor(e,n,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?GN(e,n,i.validate):i.validate}get isRequired(){return!this.hasDefault}}class hf{constructor(e,n,i,r){this.name=e,this.rank=n,this.schema=i,this.spec=r,this.attrs=lw(e,r.attrs),this.excluded=null;let a=sw(this.attrs);this.instance=a?new Hn(this,a):null}create(e=null){return!e&&this.instance?this.instance:new Hn(this,ow(this.attrs,e))}static compile(e,n){let i=Object.create(null),r=0;return e.forEach((a,u)=>i[a]=new hf(a,r++,n,u)),i}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){aw(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class uw{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let r in e)n[r]=e[r];n.nodes=Vi.from(e.nodes),n.marks=Vi.from(e.marks||{}),this.nodes=cw.compile(this.spec.nodes,this),this.marks=hf.compile(this.spec.marks,this);let i=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let a=this.nodes[r],u=a.spec.content||"",l=a.spec.marks;if(a.contentMatch=i[u]||(i[u]=Sl.parse(u,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=l=="_"?null:l?hw(this,l.split(" ")):l==""||!a.inlineContent?[]:null}for(let r in this.marks){let a=this.marks[r],u=a.spec.excludes;a.excluded=u==null?[a]:u==""?[]:hw(this,u.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,i,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof cw){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,i,r)}text(e,n){let i=this.nodes.text;return new uf(i,i.defaultAttrs,e,Hn.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return kl.fromJSON(this,e)}markFromJSON(e){return Hn.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function hw(t,e){let n=[];for(let i=0;i<e.length;i++){let r=e[i],a=t.marks[r],u=a;if(a)n.push(a);else for(let l in t.marks){let g=t.marks[l];(r=="_"||g.spec.group&&g.spec.group.split(" ").indexOf(r)>-1)&&n.push(u=g)}if(!u)throw new SyntaxError("Unknown mark type: '"+e[i]+"'")}return n}function YN(t){return t.tag!=null}function XN(t){return t.style!=null}let vh=class yb{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let i=this.matchedStyles=[];n.forEach(r=>{if(YN(r))this.tags.push(r);else if(XN(r)){let a=/[^=]*/.exec(r.style)[0];i.indexOf(a)<0&&i.push(a),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let a=e.nodes[r.node];return a.contentMatch.matchType(a)})}parse(e,n={}){let i=new mw(this,n,!1);return i.addAll(e,Hn.none,n.from,n.to),i.finish()}parseSlice(e,n={}){let i=new mw(this,n,!0);return i.addAll(e,Hn.none,n.from,n.to),dt.maxOpen(i.finish())}matchTag(e,n,i){for(let r=i?this.tags.indexOf(i)+1:0;r<this.tags.length;r++){let a=this.tags[r];if(QN(e,a.tag)&&(a.namespace===void 0||e.namespaceURI==a.namespace)&&(!a.context||n.matchesContext(a.context))){if(a.getAttrs){let u=a.getAttrs(e);if(u===!1)continue;a.attrs=u||void 0}return a}}}matchStyle(e,n,i,r){for(let a=r?this.styles.indexOf(r)+1:0;a<this.styles.length;a++){let u=this.styles[a],l=u.style;if(!(l.indexOf(e)!=0||u.context&&!i.matchesContext(u.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(u.getAttrs){let g=u.getAttrs(n);if(g===!1)continue;u.attrs=g||void 0}return u}}}static schemaRules(e){let n=[];function i(r){let a=r.priority==null?50:r.priority,u=0;for(;u<n.length;u++){let l=n[u];if((l.priority==null?50:l.priority)<a)break}n.splice(u,0,r)}for(let r in e.marks){let a=e.marks[r].spec.parseDOM;a&&a.forEach(u=>{i(u=gw(u)),u.mark||u.ignore||u.clearMark||(u.mark=r)})}for(let r in e.nodes){let a=e.nodes[r].spec.parseDOM;a&&a.forEach(u=>{i(u=gw(u)),u.node||u.ignore||u.mark||(u.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new yb(e,yb.schemaRules(e)))}};const dw={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},KN={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},pw={ol:!0,ul:!0},df=1,pf=2,wh=4;function fw(t,e,n){return e!=null?(e?df:0)|(e==="full"?pf:0):t&&t.whitespace=="pre"?df|pf:n&~wh}class ff{constructor(e,n,i,r,a,u){this.type=e,this.attrs=n,this.marks=i,this.solid=r,this.options=u,this.content=[],this.activeMarks=Hn.none,this.match=a||(u&wh?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Fe.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let i=this.type.contentMatch,r;return(r=i.findWrapping(e.type))?(this.match=i,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&df)){let i=this.content[this.content.length-1],r;if(i&&i.isText&&(r=/[ \t\r\n\u000c]+$/.exec(i.text))){let a=i;i.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-r[0].length))}}let n=Fe.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Fe.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!dw.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class mw{constructor(e,n,i){this.parser=e,this.options=n,this.isOpen=i,this.open=0;let r=n.topNode,a,u=fw(null,n.preserveWhitespace,0)|(i?wh:0);r?a=new ff(r.type,r.attrs,Hn.none,!0,n.topMatch||r.type.contentMatch,u):i?a=new ff(null,null,Hn.none,!0,null,u):a=new ff(e.schema.topNodeType,null,Hn.none,!0,null,u),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let i=e.nodeValue,r=this.top;if(r.options&pf||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(i)){if(r.options&df)r.options&pf?i=i.replace(/\r\n?/g,`
|
630
|
+
`)}}Sl.empty=new Sl(!0);class LN{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function tw(t){let e=[];do e.push(VN(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function VN(t){let e=[];do e.push(FN(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function FN(t){let e=UN(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=$N(t,e);else break;return e}function nw(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function $N(t,e){let n=nw(t),i=n;return t.eat(",")&&(t.next!="}"?i=nw(t):i=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:i,expr:e}}function jN(t,e){let n=t.nodeTypes,i=n[e];if(i)return[i];let r=[];for(let a in n){let u=n[a];u.isInGroup(e)&&r.push(u)}return r.length==0&&t.err("No node type or group '"+e+"' found"),r}function UN(t){if(t.eat("(")){let e=tw(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=jN(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function HN(t){let e=[[]];return r(a(t,0),n()),e;function n(){return e.push([])-1}function i(u,l,g){let b={term:g,to:l};return e[u].push(b),b}function r(u,l){u.forEach(g=>g.to=l)}function a(u,l){if(u.type=="choice")return u.exprs.reduce((g,b)=>g.concat(a(b,l)),[]);if(u.type=="seq")for(let g=0;;g++){let b=a(u.exprs[g],l);if(g==u.exprs.length-1)return b;r(b,l=n())}else if(u.type=="star"){let g=n();return i(l,g),r(a(u.expr,g),g),[i(g)]}else if(u.type=="plus"){let g=n();return r(a(u.expr,l),g),r(a(u.expr,g),g),[i(g)]}else{if(u.type=="opt")return[i(l)].concat(a(u.expr,l));if(u.type=="range"){let g=l;for(let b=0;b<u.min;b++){let S=n();r(a(u.expr,g),S),g=S}if(u.max==-1)r(a(u.expr,g),g);else for(let b=u.min;b<u.max;b++){let S=n();i(g,S),r(a(u.expr,g),S),g=S}return[i(g)]}else{if(u.type=="name")return[i(l,void 0,u.value)];throw new Error("Unknown expr type")}}}}function iw(t,e){return e-t}function rw(t,e){let n=[];return i(e),n.sort(iw);function i(r){let a=t[r];if(a.length==1&&!a[0].term)return i(a[0].to);n.push(r);for(let u=0;u<a.length;u++){let{term:l,to:g}=a[u];!l&&n.indexOf(g)==-1&&i(g)}}}function qN(t){let e=Object.create(null);return n(rw(t,0));function n(i){let r=[];i.forEach(u=>{t[u].forEach(({term:l,to:g})=>{if(!l)return;let b;for(let S=0;S<r.length;S++)r[S][0]==l&&(b=r[S][1]);rw(t,g).forEach(S=>{b||r.push([l,b=[]]),b.indexOf(S)==-1&&b.push(S)})})});let a=e[i.join(",")]=new Sl(i.indexOf(t.length-1)>-1);for(let u=0;u<r.length;u++){let l=r[u][1].sort(iw);a.next.push({type:r[u][0],next:e[l.join(",")]||n(l)})}return a}}function WN(t,e){for(let n=0,i=[t];n<i.length;n++){let r=i[n],a=!r.validEnd,u=[];for(let l=0;l<r.next.length;l++){let{type:g,next:b}=r.next[l];u.push(g.name),a&&!(g.isText||g.hasRequiredAttrs())&&(a=!1),i.indexOf(b)==-1&&i.push(b)}a&&e.err("Only non-generatable nodes ("+u.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function sw(t){let e=Object.create(null);for(let n in t){let i=t[n];if(!i.hasDefault)return null;e[n]=i.default}return e}function ow(t,e){let n=Object.create(null);for(let i in t){let r=e&&e[i];if(r===void 0){let a=t[i];if(a.hasDefault)r=a.default;else throw new RangeError("No value supplied for attribute "+i)}n[i]=r}return n}function aw(t,e,n,i){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let r in t){let a=t[r];a.validate&&a.validate(e[r])}}function lw(t,e){let n=Object.create(null);if(e)for(let i in e)n[i]=new ZN(t,i,e[i]);return n}let cw=class xC{constructor(e,n,i){this.name=e,this.schema=n,this.spec=i,this.markSet=null,this.groups=i.group?i.group.split(" "):[],this.attrs=lw(e,i.attrs),this.defaultAttrs=sw(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(i.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Sl.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:ow(this.attrs,e)}create(e=null,n,i){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new kl(this,this.computeAttrs(e),Fe.from(n),Hn.setFrom(i))}createChecked(e=null,n,i){return n=Fe.from(n),this.checkContent(n),new kl(this,this.computeAttrs(e),n,Hn.setFrom(i))}createAndFill(e=null,n,i){if(e=this.computeAttrs(e),n=Fe.from(n),n.size){let u=this.contentMatch.fillBefore(n);if(!u)return null;n=u.append(n)}let r=this.contentMatch.matchFragment(n),a=r&&r.fillBefore(Fe.empty,!0);return a?new kl(this,e,n.append(a),Hn.setFrom(i)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let i=0;i<e.childCount;i++)if(!this.allowsMarks(e.child(i).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){aw(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let i=0;i<e.length;i++)this.allowsMarkType(e[i].type)?n&&n.push(e[i]):n||(n=e.slice(0,i));return n?n.length?n:Hn.none:e}static compile(e,n){let i=Object.create(null);e.forEach((a,u)=>i[a]=new xC(a,n,u));let r=n.spec.topNode||"doc";if(!i[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!i.text)throw new RangeError("Every schema needs a 'text' type");for(let a in i.text.attrs)throw new RangeError("The text node type should not have attributes");return i}};function GN(t,e,n){let i=n.split("|");return r=>{let a=r===null?"null":typeof r;if(i.indexOf(a)<0)throw new RangeError(`Expected value of type ${i} for attribute ${e} on type ${t}, got ${a}`)}}class ZN{constructor(e,n,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?GN(e,n,i.validate):i.validate}get isRequired(){return!this.hasDefault}}class hf{constructor(e,n,i,r){this.name=e,this.rank=n,this.schema=i,this.spec=r,this.attrs=lw(e,r.attrs),this.excluded=null;let a=sw(this.attrs);this.instance=a?new Hn(this,a):null}create(e=null){return!e&&this.instance?this.instance:new Hn(this,ow(this.attrs,e))}static compile(e,n){let i=Object.create(null),r=0;return e.forEach((a,u)=>i[a]=new hf(a,r++,n,u)),i}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){aw(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class uw{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let r in e)n[r]=e[r];n.nodes=Vi.from(e.nodes),n.marks=Vi.from(e.marks||{}),this.nodes=cw.compile(this.spec.nodes,this),this.marks=hf.compile(this.spec.marks,this);let i=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let a=this.nodes[r],u=a.spec.content||"",l=a.spec.marks;if(a.contentMatch=i[u]||(i[u]=Sl.parse(u,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=l=="_"?null:l?hw(this,l.split(" ")):l==""||!a.inlineContent?[]:null}for(let r in this.marks){let a=this.marks[r],u=a.spec.excludes;a.excluded=u==null?[a]:u==""?[]:hw(this,u.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,i,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof cw){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,i,r)}text(e,n){let i=this.nodes.text;return new uf(i,i.defaultAttrs,e,Hn.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return kl.fromJSON(this,e)}markFromJSON(e){return Hn.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function hw(t,e){let n=[];for(let i=0;i<e.length;i++){let r=e[i],a=t.marks[r],u=a;if(a)n.push(a);else for(let l in t.marks){let g=t.marks[l];(r=="_"||g.spec.group&&g.spec.group.split(" ").indexOf(r)>-1)&&n.push(u=g)}if(!u)throw new SyntaxError("Unknown mark type: '"+e[i]+"'")}return n}function YN(t){return t.tag!=null}function XN(t){return t.style!=null}let vh=class yb{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let i=this.matchedStyles=[];n.forEach(r=>{if(YN(r))this.tags.push(r);else if(XN(r)){let a=/[^=]*/.exec(r.style)[0];i.indexOf(a)<0&&i.push(a),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let a=e.nodes[r.node];return a.contentMatch.matchType(a)})}parse(e,n={}){let i=new mw(this,n,!1);return i.addAll(e,Hn.none,n.from,n.to),i.finish()}parseSlice(e,n={}){let i=new mw(this,n,!0);return i.addAll(e,Hn.none,n.from,n.to),dt.maxOpen(i.finish())}matchTag(e,n,i){for(let r=i?this.tags.indexOf(i)+1:0;r<this.tags.length;r++){let a=this.tags[r];if(QN(e,a.tag)&&(a.namespace===void 0||e.namespaceURI==a.namespace)&&(!a.context||n.matchesContext(a.context))){if(a.getAttrs){let u=a.getAttrs(e);if(u===!1)continue;a.attrs=u||void 0}return a}}}matchStyle(e,n,i,r){for(let a=r?this.styles.indexOf(r)+1:0;a<this.styles.length;a++){let u=this.styles[a],l=u.style;if(!(l.indexOf(e)!=0||u.context&&!i.matchesContext(u.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(u.getAttrs){let g=u.getAttrs(n);if(g===!1)continue;u.attrs=g||void 0}return u}}}static schemaRules(e){let n=[];function i(r){let a=r.priority==null?50:r.priority,u=0;for(;u<n.length;u++){let l=n[u];if((l.priority==null?50:l.priority)<a)break}n.splice(u,0,r)}for(let r in e.marks){let a=e.marks[r].spec.parseDOM;a&&a.forEach(u=>{i(u=gw(u)),u.mark||u.ignore||u.clearMark||(u.mark=r)})}for(let r in e.nodes){let a=e.nodes[r].spec.parseDOM;a&&a.forEach(u=>{i(u=gw(u)),u.node||u.ignore||u.mark||(u.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new yb(e,yb.schemaRules(e)))}};const dw={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},KN={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},pw={ol:!0,ul:!0},df=1,pf=2,wh=4;function fw(t,e,n){return e!=null?(e?df:0)|(e==="full"?pf:0):t&&t.whitespace=="pre"?df|pf:n&~wh}class ff{constructor(e,n,i,r,a,u){this.type=e,this.attrs=n,this.marks=i,this.solid=r,this.options=u,this.content=[],this.activeMarks=Hn.none,this.match=a||(u&wh?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Fe.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let i=this.type.contentMatch,r;return(r=i.findWrapping(e.type))?(this.match=i,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&df)){let i=this.content[this.content.length-1],r;if(i&&i.isText&&(r=/[ \t\r\n\u000c]+$/.exec(i.text))){let a=i;i.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-r[0].length))}}let n=Fe.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Fe.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!dw.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class mw{constructor(e,n,i){this.parser=e,this.options=n,this.isOpen=i,this.open=0;let r=n.topNode,a,u=fw(null,n.preserveWhitespace,0)|(i?wh:0);r?a=new ff(r.type,r.attrs,Hn.none,!0,n.topMatch||r.type.contentMatch,u):i?a=new ff(null,null,Hn.none,!0,null,u):a=new ff(e.schema.topNodeType,null,Hn.none,!0,null,u),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let i=e.nodeValue,r=this.top;if(r.options&pf||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(i)){if(r.options&df)r.options&pf?i=i.replace(/\r\n?/g,`
|
631
631
|
`):i=i.replace(/\r?\n|\r/g," ");else if(i=i.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(i)&&this.open==this.nodes.length-1){let a=r.content[r.content.length-1],u=e.previousSibling;(!a||u&&u.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(i=i.slice(1))}i&&this.insertNode(this.parser.schema.text(i),n),this.findInText(e)}else this.findInside(e)}addElement(e,n,i){let r=e.nodeName.toLowerCase(),a;pw.hasOwnProperty(r)&&this.parser.normalizeLists&&JN(e);let u=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,i));if(u?u.ignore:KN.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e,n);else if(!u||u.skip||u.closeParent){u&&u.closeParent?this.open=Math.max(0,this.open-1):u&&u.skip.nodeType&&(e=u.skip);let l,g=this.top,b=this.needsBlock;if(dw.hasOwnProperty(r))g.content.length&&g.content[0].isInline&&this.open&&(this.open--,g=this.top),l=!0,g.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);return}let S=u&&u.skip?n:this.readStyles(e,n);S&&this.addAll(e,S),l&&this.sync(g),this.needsBlock=b}else{let l=this.readStyles(e,n);l&&this.addElementByRule(e,u,l,u.consuming===!1?a:void 0)}}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
632
|
-
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(e,n){let i=e.style;if(i&&i.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let a=this.parser.matchedStyles[r],u=i.getPropertyValue(a);if(u)for(let l=void 0;;){let g=this.parser.matchStyle(a,u,this,l);if(!g)break;if(g.ignore)return null;if(g.clearMark?n=n.filter(b=>!g.clearMark(b)):n=n.concat(this.parser.schema.marks[g.mark].create(g.attrs)),g.consuming===!1)l=g;else break}}return n}addElementByRule(e,n,i,r){let a,u;if(n.node)if(u=this.parser.schema.nodes[n.node],u.isLeaf)this.insertNode(u.create(n.attrs),i)||this.leafFallback(e,i);else{let g=this.enter(u,n.attrs||null,i,n.preserveWhitespace);g&&(a=!0,i=g)}else{let g=this.parser.schema.marks[n.mark];i=i.concat(g.create(n.attrs))}let l=this.top;if(u&&u.isLeaf)this.findInside(e);else if(r)this.addElement(e,i,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(g=>this.insertNode(g,i));else{let g=e;typeof n.contentElement=="string"?g=e.querySelector(n.contentElement):typeof n.contentElement=="function"?g=n.contentElement(e):n.contentElement&&(g=n.contentElement),this.findAround(e,g,!0),this.addAll(g,i)}a&&this.sync(l)&&this.open--}addAll(e,n,i,r){let a=i||0;for(let u=i?e.childNodes[i]:e.firstChild,l=r==null?null:e.childNodes[r];u!=l;u=u.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(u,n);this.findAtPoint(e,a)}findPlace(e,n){let i,r;for(let a=this.open;a>=0;a--){let u=this.nodes[a],l=u.findWrapping(e);if(l&&(!i||i.length>l.length)&&(i=l,r=u,!l.length)||u.solid)break}if(!i)return null;this.sync(r);for(let a=0;a<i.length;a++)n=this.enterInner(i[a],null,n,!1);return n}insertNode(e,n){if(e.isInline&&this.needsBlock&&!this.top.type){let r=this.textblockFromContext();r&&(n=this.enterInner(r,null,n))}let i=this.findPlace(e,n);if(i){this.closeExtra();let r=this.top;r.match&&(r.match=r.match.matchType(e.type));let a=Hn.none;for(let u of i.concat(e.marks))(r.type?r.type.allowsMarkType(u.type):yw(u.type,e.type))&&(a=u.addToSet(a));return r.content.push(e.mark(a)),!0}return!1}enter(e,n,i,r){let a=this.findPlace(e.create(n),i);return a&&(a=this.enterInner(e,n,i,!0,r)),a}enterInner(e,n,i,r=!1,a){this.closeExtra();let u=this.top;u.match=u.match&&u.match.matchType(e);let l=fw(e,a,u.options);u.options&wh&&u.content.length==0&&(l|=wh);let g=Hn.none;return i=i.filter(b=>(u.type?u.type.allowsMarkType(b.type):yw(b.type,e))?(g=b.addToSet(g),!1):!0),this.nodes.push(new ff(e,n,g,r,null,l)),this.open++,i}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let n=this.open;n>=0;n--)if(this.nodes[n]==e)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let i=this.nodes[n].content;for(let r=i.length-1;r>=0;r--)e+=i[r].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].node==e&&this.find[i].offset==n&&(this.find[i].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,i){if(e!=n&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&n.compareDocumentPosition(this.find[r].node)&(i?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),i=this.options.context,r=!this.isOpen&&(!i||i.parent.type==this.nodes[0].type),a=-(i?i.depth+1:0)+(r?0:1),u=(l,g)=>{for(;l>=0;l--){let b=n[l];if(b==""){if(l==n.length-1||l==0)continue;for(;g>=a;g--)if(u(l-1,g))return!0;return!1}else{let S=g>0||g==0&&r?this.nodes[g].type:i&&g>=a?i.node(g-a).type:null;if(!S||S.name!=b&&S.groups.indexOf(b)==-1)return!1;g--}}return!0};return u(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(i&&i.isTextblock&&i.defaultAttrs)return i}for(let n in this.parser.schema.nodes){let i=this.parser.schema.nodes[n];if(i.isTextblock&&i.defaultAttrs)return i}}}function JN(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&pw.hasOwnProperty(i)&&n?(n.appendChild(e),e=n):i=="li"?n=e:i&&(n=null)}}function QN(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function gw(t){let e={};for(let n in t)e[n]=t[n];return e}function yw(t,e){let n=e.schema.nodes;for(let i in n){let r=n[i];if(!r.allowsMarkType(t))continue;let a=[],u=l=>{a.push(l);for(let g=0;g<l.edgeCount;g++){let{type:b,next:S}=l.edge(g);if(b==e||a.indexOf(S)<0&&u(S))return!0}};if(u(r.contentMatch))return!0}}class El{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},i){i||(i=Py(n).createDocumentFragment());let r=i,a=[];return e.forEach(u=>{if(a.length||u.marks.length){let l=0,g=0;for(;l<a.length&&g<u.marks.length;){let b=u.marks[g];if(!this.marks[b.type.name]){g++;continue}if(!b.eq(a[l][0])||b.type.spec.spanning===!1)break;l++,g++}for(;l<a.length;)r=a.pop()[1];for(;g<u.marks.length;){let b=u.marks[g++],S=this.serializeMark(b,u.isInline,n);S&&(a.push([b,r]),r.appendChild(S.dom),r=S.contentDOM||S.dom)}}r.appendChild(this.serializeNodeInner(u,n))}),i}serializeNodeInner(e,n){let{dom:i,contentDOM:r}=mf(Py(n),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,r)}return i}serializeNode(e,n={}){let i=this.serializeNodeInner(e,n);for(let r=e.marks.length-1;r>=0;r--){let a=this.serializeMark(e.marks[r],e.isInline,n);a&&((a.contentDOM||a.dom).appendChild(i),i=a.dom)}return i}serializeMark(e,n,i={}){let r=this.marks[e.type.name];return r&&mf(Py(i),r(e,n),null,e.attrs)}static renderSpec(e,n,i=null,r){return mf(e,n,i,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new El(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=_w(e.nodes);return n.text||(n.text=i=>i.text),n}static marksFromSchema(e){return _w(e.marks)}}function _w(t){let e={};for(let n in t){let i=t[n].spec.toDOM;i&&(e[n]=i)}return e}function Py(t){return t.document||window.document}const bw=new WeakMap;function e5(t){let e=bw.get(t);return e===void 0&&bw.set(t,e=t5(t)),e}function t5(t){let e=null;function n(i){if(i&&typeof i=="object")if(Array.isArray(i))if(typeof i[0]=="string")e||(e=[]),e.push(i);else for(let r=0;r<i.length;r++)n(i[r]);else for(let r in i)n(i[r])}return n(t),e}function mf(t,e,n,i){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],a;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(i&&(a=e5(i))&&a.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let u=r.indexOf(" ");u>0&&(n=r.slice(0,u),r=r.slice(u+1));let l,g=n?t.createElementNS(n,r):t.createElement(r),b=e[1],S=1;if(b&&typeof b=="object"&&b.nodeType==null&&!Array.isArray(b)){S=2;for(let E in b)if(b[E]!=null){let C=E.indexOf(" ");C>0?g.setAttributeNS(E.slice(0,C),E.slice(C+1),b[E]):g.setAttribute(E,b[E])}}for(let E=S;E<e.length;E++){let C=e[E];if(C===0){if(E<e.length-1||E>S)throw new RangeError("Content hole must be the only child of its parent node");return{dom:g,contentDOM:g}}else{let{dom:P,contentDOM:D}=mf(t,C,n,i);if(g.appendChild(P),D){if(l)throw new RangeError("Multiple content holes");l=D}}}return{dom:g,contentDOM:l}}const xw=65535,vw=Math.pow(2,16);function n5(t,e){return t+e*vw}function ww(t){return t&xw}function i5(t){return(t-(t&xw))/vw}const kw=1,Sw=2,gf=4,Ew=8;class Dy{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&Ew)>0}get deletedBefore(){return(this.delInfo&(kw|gf))>0}get deletedAfter(){return(this.delInfo&(Sw|gf))>0}get deletedAcross(){return(this.delInfo&gf)>0}}class Gr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Gr.empty)return Gr.empty}recover(e){let n=0,i=ww(e);if(!this.inverted)for(let r=0;r<i;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[i*3]+n+i5(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,i){let r=0,a=this.inverted?2:1,u=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let g=this.ranges[l]-(this.inverted?r:0);if(g>e)break;let b=this.ranges[l+a],S=this.ranges[l+u],E=g+b;if(e<=E){let C=b?e==g?-1:e==E?1:n:n,P=g+r+(C<0?0:S);if(i)return P;let D=e==(n<0?g:E)?null:n5(l/3,e-g),R=e==g?Sw:e==E?kw:gf;return(n<0?e!=g:e!=E)&&(R|=Ew),new Dy(P,R,D)}r+=S-b}return i?e+r:new Dy(e+r,0,null)}touches(e,n){let i=0,r=ww(n),a=this.inverted?2:1,u=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let g=this.ranges[l]-(this.inverted?i:0);if(g>e)break;let b=this.ranges[l+a],S=g+b;if(e<=S&&l==r*3)return!0;i+=this.ranges[l+u]-b}return!1}forEach(e){let n=this.inverted?2:1,i=this.inverted?1:2;for(let r=0,a=0;r<this.ranges.length;r+=3){let u=this.ranges[r],l=u-(this.inverted?a:0),g=u+(this.inverted?0:a),b=this.ranges[r+n],S=this.ranges[r+i];e(l,l+b,g,g+S),a+=S-b}}invert(){return new Gr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Gr.empty:new Gr(e<0?[0,-e,0]:[0,0,e])}}Gr.empty=new Gr([]);class Pc{constructor(e=[],n,i=0,r=e.length){this.maps=e,this.mirror=n,this.from=i,this.to=r}slice(e=0,n=this.maps.length){return new Pc(this.maps,this.mirror,e,n)}copy(){return new Pc(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,n){this.to=this.maps.push(e),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(e){for(let n=0,i=this.maps.length;n<e.maps.length;n++){let r=e.getMirror(n);this.appendMap(e.maps[n],r!=null&&r<n?i+r:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,i=this.maps.length+e.maps.length;n>=0;n--){let r=e.getMirror(n);this.appendMap(e.maps[n].invert(),r!=null&&r>n?i-r-1:void 0)}}invert(){let e=new Pc;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let i=this.from;i<this.to;i++)e=this.maps[i].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,i){let r=0;for(let a=this.from;a<this.to;a++){let u=this.maps[a],l=u.mapResult(e,n);if(l.recover!=null){let g=this.getMirror(a);if(g!=null&&g>a&&g<this.to){a=g,e=this.maps[g].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return i?e:new Dy(e,r,null)}}const Oy=Object.create(null);class Ji{getMap(){return Gr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=Oy[n.stepType];if(!i)throw new RangeError(`No step type ${n.stepType} defined`);return i.fromJSON(e,n)}static jsonID(e,n){if(e in Oy)throw new RangeError("Duplicate use of step JSON ID "+e);return Oy[e]=n,n.prototype.jsonID=e,n}}class di{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new di(e,null)}static fail(e){return new di(null,e)}static fromReplace(e,n,i,r){try{return di.ok(e.replace(n,i,r))}catch(a){if(a instanceof af)return di.fail(a.message);throw a}}}function zy(t,e,n){let i=[];for(let r=0;r<t.childCount;r++){let a=t.child(r);a.content.size&&(a=a.copy(zy(a.content,e,a))),a.isInline&&(a=e(a,n,r)),i.push(a)}return Fe.fromArray(i)}class pa extends Ji{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=e.resolve(this.from),r=i.node(i.sharedDepth(this.to)),a=new dt(zy(n.content,(u,l)=>!u.isAtom||!l.type.allowsMarkType(this.mark.type)?u:u.mark(this.mark.addToSet(u.marks)),r),n.openStart,n.openEnd);return di.fromReplace(e,this.from,this.to,a)}invert(){return new io(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new pa(n.pos,i.pos,this.mark)}merge(e){return e instanceof pa&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new pa(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new pa(n.from,n.to,e.markFromJSON(n.mark))}}Ji.jsonID("addMark",pa);class io extends Ji{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=new dt(zy(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return di.fromReplace(e,this.from,this.to,i)}invert(){return new pa(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new io(n.pos,i.pos,this.mark)}merge(e){return e instanceof io&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new io(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new io(n.from,n.to,e.markFromJSON(n.mark))}}Ji.jsonID("removeMark",io);class fa extends Ji{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return di.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return di.fromReplace(e,this.pos,this.pos+1,new dt(Fe.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let i=this.mark.addToSet(n.marks);if(i.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(i))return new fa(this.pos,n.marks[r]);return new fa(this.pos,this.mark)}}return new Dc(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new fa(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new fa(n.pos,e.markFromJSON(n.mark))}}Ji.jsonID("addNodeMark",fa);class Dc extends Ji{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return di.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return di.fromReplace(e,this.pos,this.pos+1,new dt(Fe.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new fa(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Dc(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Dc(n.pos,e.markFromJSON(n.mark))}}Ji.jsonID("removeNodeMark",Dc);class Ci extends Ji{constructor(e,n,i,r=!1){super(),this.from=e,this.to=n,this.slice=i,this.structure=r}apply(e){return this.structure&&By(e,this.from,this.to)?di.fail("Structure replace would overwrite content"):di.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Gr([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ci(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deletedAcross&&i.deletedAcross?null:new Ci(n.pos,Math.max(n.pos,i.pos),this.slice)}merge(e){if(!(e instanceof Ci)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?dt.empty:new dt(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ci(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?dt.empty:new dt(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ci(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ci(n.from,n.to,dt.fromJSON(e,n.slice),!!n.structure)}}Ji.jsonID("replace",Ci);class Ti extends Ji{constructor(e,n,i,r,a,u,l=!1){super(),this.from=e,this.to=n,this.gapFrom=i,this.gapTo=r,this.slice=a,this.insert=u,this.structure=l}apply(e){if(this.structure&&(By(e,this.from,this.gapFrom)||By(e,this.gapTo,this.to)))return di.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return di.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,n.content);return i?di.fromReplace(e,this.from,this.to,i):di.fail("Content does not fit in gap")}getMap(){return new Gr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Ti(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return n.deletedAcross&&i.deletedAcross||r<n.pos||a>i.pos?null:new Ti(n.pos,i.pos,r,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ti(n.from,n.to,n.gapFrom,n.gapTo,dt.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ji.jsonID("replaceAround",Ti);function By(t,e,n){let i=t.resolve(e),r=n-e,a=i.depth;for(;r>0&&a>0&&i.indexAfter(a)==i.node(a).childCount;)a--,r--;if(r>0){let u=i.node(a).maybeChild(i.indexAfter(a));for(;r>0;){if(!u||u.isLeaf)return!0;u=u.firstChild,r--}}return!1}function r5(t,e,n,i){let r=[],a=[],u,l;t.doc.nodesBetween(e,n,(g,b,S)=>{if(!g.isInline)return;let E=g.marks;if(!i.isInSet(E)&&S.type.allowsMarkType(i.type)){let C=Math.max(b,e),P=Math.min(b+g.nodeSize,n),D=i.addToSet(E);for(let R=0;R<E.length;R++)E[R].isInSet(D)||(u&&u.to==C&&u.mark.eq(E[R])?u.to=P:r.push(u=new io(C,P,E[R])));l&&l.to==C?l.to=P:a.push(l=new pa(C,P,i))}}),r.forEach(g=>t.step(g)),a.forEach(g=>t.step(g))}function s5(t,e,n,i){let r=[],a=0;t.doc.nodesBetween(e,n,(u,l)=>{if(!u.isInline)return;a++;let g=null;if(i instanceof hf){let b=u.marks,S;for(;S=i.isInSet(b);)(g||(g=[])).push(S),b=S.removeFromSet(b)}else i?i.isInSet(u.marks)&&(g=[i]):g=u.marks;if(g&&g.length){let b=Math.min(l+u.nodeSize,n);for(let S=0;S<g.length;S++){let E=g[S],C;for(let P=0;P<r.length;P++){let D=r[P];D.step==a-1&&E.eq(r[P].style)&&(C=D)}C?(C.to=b,C.step=a):r.push({style:E,from:Math.max(l,e),to:b,step:a})}}}),r.forEach(u=>t.step(new io(u.from,u.to,u.style)))}function Cw(t,e,n,i=n.contentMatch,r=!0){let a=t.doc.nodeAt(e),u=[],l=e+1;for(let g=0;g<a.childCount;g++){let b=a.child(g),S=l+b.nodeSize,E=i.matchType(b.type);if(!E)u.push(new Ci(l,S,dt.empty));else{i=E;for(let C=0;C<b.marks.length;C++)n.allowsMarkType(b.marks[C].type)||t.step(new io(l,S,b.marks[C]));if(r&&b.isText&&n.whitespace!="pre"){let C,P=/\r?\n|\r/g,D;for(;C=P.exec(b.text);)D||(D=new dt(Fe.from(n.schema.text(" ",n.allowedMarks(b.marks))),0,0)),u.push(new Ci(l+C.index,l+C.index+C[0].length,D))}}l=S}if(!i.validEnd){let g=i.fillBefore(Fe.empty,!0);t.replace(l,l,new dt(g,0,0))}for(let g=u.length-1;g>=0;g--)t.step(u[g])}function o5(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Oc(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let i=t.depth;;--i){let r=t.$from.node(i),a=t.$from.index(i),u=t.$to.indexAfter(i);if(i<t.depth&&r.canReplace(a,u,n))return i;if(i==0||r.type.spec.isolating||!o5(r,a,u))break}return null}function a5(t,e,n){let{$from:i,$to:r,depth:a}=e,u=i.before(a+1),l=r.after(a+1),g=u,b=l,S=Fe.empty,E=0;for(let D=a,R=!1;D>n;D--)R||i.index(D)>0?(R=!0,S=Fe.from(i.node(D).copy(S)),E++):g--;let C=Fe.empty,P=0;for(let D=a,R=!1;D>n;D--)R||r.after(D+1)<r.end(D)?(R=!0,C=Fe.from(r.node(D).copy(C)),P++):b++;t.step(new Ti(g,b,u,l,new dt(S.append(C),E,P),S.size-E,!0))}function Ny(t,e,n=null,i=t){let r=l5(t,e),a=r&&c5(i,e);return a?r.map(Tw).concat({type:e,attrs:n}).concat(a.map(Tw)):null}function Tw(t){return{type:t,attrs:null}}function l5(t,e){let{parent:n,startIndex:i,endIndex:r}=t,a=n.contentMatchAt(i).findWrapping(e);if(!a)return null;let u=a.length?a[0]:e;return n.canReplaceWith(i,r,u)?a:null}function c5(t,e){let{parent:n,startIndex:i,endIndex:r}=t,a=n.child(i),u=e.contentMatch.findWrapping(a.type);if(!u)return null;let g=(u.length?u[u.length-1]:e).contentMatch;for(let b=i;g&&b<r;b++)g=g.matchType(n.child(b).type);return!g||!g.validEnd?null:u}function u5(t,e,n){let i=Fe.empty;for(let u=n.length-1;u>=0;u--){if(i.size){let l=n[u].type.contentMatch.matchFragment(i);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=Fe.from(n[u].type.create(n[u].attrs,i))}let r=e.start,a=e.end;t.step(new Ti(r,a,r,a,new dt(i,0,0),n.length,!0))}function h5(t,e,n,i,r){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(e,n,(u,l)=>{let g=typeof r=="function"?r(u):r;if(u.isTextblock&&!u.hasMarkup(i,g)&&f5(t.doc,t.mapping.slice(a).map(l),i)){let b=null;if(i.schema.linebreakReplacement){let P=i.whitespace=="pre",D=!!i.contentMatch.matchType(i.schema.linebreakReplacement);P&&!D?b=!1:!P&&D&&(b=!0)}b===!1&&p5(t,u,l,a),Cw(t,t.mapping.slice(a).map(l,1),i,void 0,b===null);let S=t.mapping.slice(a),E=S.map(l,1),C=S.map(l+u.nodeSize,1);return t.step(new Ti(E,C,E+1,C-1,new dt(Fe.from(i.create(g,null,u.marks)),0,0),1,!0)),b===!0&&d5(t,u,l,a),!1}})}function d5(t,e,n,i){e.forEach((r,a)=>{if(r.isText){let u,l=/\r?\n|\r/g;for(;u=l.exec(r.text);){let g=t.mapping.slice(i).map(n+1+a+u.index);t.replaceWith(g,g+1,e.type.schema.linebreakReplacement.create())}}})}function p5(t,e,n,i){e.forEach((r,a)=>{if(r.type==r.type.schema.linebreakReplacement){let u=t.mapping.slice(i).map(n+1+a);t.replaceWith(u,u+1,e.type.schema.text(`
|
632
|
+
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(e,n){let i=e.style;if(i&&i.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let a=this.parser.matchedStyles[r],u=i.getPropertyValue(a);if(u)for(let l=void 0;;){let g=this.parser.matchStyle(a,u,this,l);if(!g)break;if(g.ignore)return null;if(g.clearMark?n=n.filter(b=>!g.clearMark(b)):n=n.concat(this.parser.schema.marks[g.mark].create(g.attrs)),g.consuming===!1)l=g;else break}}return n}addElementByRule(e,n,i,r){let a,u;if(n.node)if(u=this.parser.schema.nodes[n.node],u.isLeaf)this.insertNode(u.create(n.attrs),i)||this.leafFallback(e,i);else{let g=this.enter(u,n.attrs||null,i,n.preserveWhitespace);g&&(a=!0,i=g)}else{let g=this.parser.schema.marks[n.mark];i=i.concat(g.create(n.attrs))}let l=this.top;if(u&&u.isLeaf)this.findInside(e);else if(r)this.addElement(e,i,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(g=>this.insertNode(g,i));else{let g=e;typeof n.contentElement=="string"?g=e.querySelector(n.contentElement):typeof n.contentElement=="function"?g=n.contentElement(e):n.contentElement&&(g=n.contentElement),this.findAround(e,g,!0),this.addAll(g,i),this.findAround(e,g,!1)}a&&this.sync(l)&&this.open--}addAll(e,n,i,r){let a=i||0;for(let u=i?e.childNodes[i]:e.firstChild,l=r==null?null:e.childNodes[r];u!=l;u=u.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(u,n);this.findAtPoint(e,a)}findPlace(e,n){let i,r;for(let a=this.open;a>=0;a--){let u=this.nodes[a],l=u.findWrapping(e);if(l&&(!i||i.length>l.length)&&(i=l,r=u,!l.length)||u.solid)break}if(!i)return null;this.sync(r);for(let a=0;a<i.length;a++)n=this.enterInner(i[a],null,n,!1);return n}insertNode(e,n){if(e.isInline&&this.needsBlock&&!this.top.type){let r=this.textblockFromContext();r&&(n=this.enterInner(r,null,n))}let i=this.findPlace(e,n);if(i){this.closeExtra();let r=this.top;r.match&&(r.match=r.match.matchType(e.type));let a=Hn.none;for(let u of i.concat(e.marks))(r.type?r.type.allowsMarkType(u.type):yw(u.type,e.type))&&(a=u.addToSet(a));return r.content.push(e.mark(a)),!0}return!1}enter(e,n,i,r){let a=this.findPlace(e.create(n),i);return a&&(a=this.enterInner(e,n,i,!0,r)),a}enterInner(e,n,i,r=!1,a){this.closeExtra();let u=this.top;u.match=u.match&&u.match.matchType(e);let l=fw(e,a,u.options);u.options&wh&&u.content.length==0&&(l|=wh);let g=Hn.none;return i=i.filter(b=>(u.type?u.type.allowsMarkType(b.type):yw(b.type,e))?(g=b.addToSet(g),!1):!0),this.nodes.push(new ff(e,n,g,r,null,l)),this.open++,i}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let n=this.open;n>=0;n--)if(this.nodes[n]==e)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let i=this.nodes[n].content;for(let r=i.length-1;r>=0;r--)e+=i[r].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].node==e&&this.find[i].offset==n&&(this.find[i].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,i){if(e!=n&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&n.compareDocumentPosition(this.find[r].node)&(i?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),i=this.options.context,r=!this.isOpen&&(!i||i.parent.type==this.nodes[0].type),a=-(i?i.depth+1:0)+(r?0:1),u=(l,g)=>{for(;l>=0;l--){let b=n[l];if(b==""){if(l==n.length-1||l==0)continue;for(;g>=a;g--)if(u(l-1,g))return!0;return!1}else{let S=g>0||g==0&&r?this.nodes[g].type:i&&g>=a?i.node(g-a).type:null;if(!S||S.name!=b&&!S.isInGroup(b))return!1;g--}}return!0};return u(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(i&&i.isTextblock&&i.defaultAttrs)return i}for(let n in this.parser.schema.nodes){let i=this.parser.schema.nodes[n];if(i.isTextblock&&i.defaultAttrs)return i}}}function JN(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&pw.hasOwnProperty(i)&&n?(n.appendChild(e),e=n):i=="li"?n=e:i&&(n=null)}}function QN(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function gw(t){let e={};for(let n in t)e[n]=t[n];return e}function yw(t,e){let n=e.schema.nodes;for(let i in n){let r=n[i];if(!r.allowsMarkType(t))continue;let a=[],u=l=>{a.push(l);for(let g=0;g<l.edgeCount;g++){let{type:b,next:S}=l.edge(g);if(b==e||a.indexOf(S)<0&&u(S))return!0}};if(u(r.contentMatch))return!0}}class El{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},i){i||(i=Py(n).createDocumentFragment());let r=i,a=[];return e.forEach(u=>{if(a.length||u.marks.length){let l=0,g=0;for(;l<a.length&&g<u.marks.length;){let b=u.marks[g];if(!this.marks[b.type.name]){g++;continue}if(!b.eq(a[l][0])||b.type.spec.spanning===!1)break;l++,g++}for(;l<a.length;)r=a.pop()[1];for(;g<u.marks.length;){let b=u.marks[g++],S=this.serializeMark(b,u.isInline,n);S&&(a.push([b,r]),r.appendChild(S.dom),r=S.contentDOM||S.dom)}}r.appendChild(this.serializeNodeInner(u,n))}),i}serializeNodeInner(e,n){let{dom:i,contentDOM:r}=mf(Py(n),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,r)}return i}serializeNode(e,n={}){let i=this.serializeNodeInner(e,n);for(let r=e.marks.length-1;r>=0;r--){let a=this.serializeMark(e.marks[r],e.isInline,n);a&&((a.contentDOM||a.dom).appendChild(i),i=a.dom)}return i}serializeMark(e,n,i={}){let r=this.marks[e.type.name];return r&&mf(Py(i),r(e,n),null,e.attrs)}static renderSpec(e,n,i=null,r){return mf(e,n,i,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new El(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=_w(e.nodes);return n.text||(n.text=i=>i.text),n}static marksFromSchema(e){return _w(e.marks)}}function _w(t){let e={};for(let n in t){let i=t[n].spec.toDOM;i&&(e[n]=i)}return e}function Py(t){return t.document||window.document}const bw=new WeakMap;function e5(t){let e=bw.get(t);return e===void 0&&bw.set(t,e=t5(t)),e}function t5(t){let e=null;function n(i){if(i&&typeof i=="object")if(Array.isArray(i))if(typeof i[0]=="string")e||(e=[]),e.push(i);else for(let r=0;r<i.length;r++)n(i[r]);else for(let r in i)n(i[r])}return n(t),e}function mf(t,e,n,i){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],a;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(i&&(a=e5(i))&&a.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let u=r.indexOf(" ");u>0&&(n=r.slice(0,u),r=r.slice(u+1));let l,g=n?t.createElementNS(n,r):t.createElement(r),b=e[1],S=1;if(b&&typeof b=="object"&&b.nodeType==null&&!Array.isArray(b)){S=2;for(let E in b)if(b[E]!=null){let C=E.indexOf(" ");C>0?g.setAttributeNS(E.slice(0,C),E.slice(C+1),b[E]):g.setAttribute(E,b[E])}}for(let E=S;E<e.length;E++){let C=e[E];if(C===0){if(E<e.length-1||E>S)throw new RangeError("Content hole must be the only child of its parent node");return{dom:g,contentDOM:g}}else{let{dom:P,contentDOM:D}=mf(t,C,n,i);if(g.appendChild(P),D){if(l)throw new RangeError("Multiple content holes");l=D}}}return{dom:g,contentDOM:l}}const xw=65535,vw=Math.pow(2,16);function n5(t,e){return t+e*vw}function ww(t){return t&xw}function i5(t){return(t-(t&xw))/vw}const kw=1,Sw=2,gf=4,Ew=8;class Dy{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&Ew)>0}get deletedBefore(){return(this.delInfo&(kw|gf))>0}get deletedAfter(){return(this.delInfo&(Sw|gf))>0}get deletedAcross(){return(this.delInfo&gf)>0}}class Gr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Gr.empty)return Gr.empty}recover(e){let n=0,i=ww(e);if(!this.inverted)for(let r=0;r<i;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[i*3]+n+i5(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,i){let r=0,a=this.inverted?2:1,u=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let g=this.ranges[l]-(this.inverted?r:0);if(g>e)break;let b=this.ranges[l+a],S=this.ranges[l+u],E=g+b;if(e<=E){let C=b?e==g?-1:e==E?1:n:n,P=g+r+(C<0?0:S);if(i)return P;let D=e==(n<0?g:E)?null:n5(l/3,e-g),R=e==g?Sw:e==E?kw:gf;return(n<0?e!=g:e!=E)&&(R|=Ew),new Dy(P,R,D)}r+=S-b}return i?e+r:new Dy(e+r,0,null)}touches(e,n){let i=0,r=ww(n),a=this.inverted?2:1,u=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let g=this.ranges[l]-(this.inverted?i:0);if(g>e)break;let b=this.ranges[l+a],S=g+b;if(e<=S&&l==r*3)return!0;i+=this.ranges[l+u]-b}return!1}forEach(e){let n=this.inverted?2:1,i=this.inverted?1:2;for(let r=0,a=0;r<this.ranges.length;r+=3){let u=this.ranges[r],l=u-(this.inverted?a:0),g=u+(this.inverted?0:a),b=this.ranges[r+n],S=this.ranges[r+i];e(l,l+b,g,g+S),a+=S-b}}invert(){return new Gr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Gr.empty:new Gr(e<0?[0,-e,0]:[0,0,e])}}Gr.empty=new Gr([]);class Pc{constructor(e=[],n,i=0,r=e.length){this.maps=e,this.mirror=n,this.from=i,this.to=r}slice(e=0,n=this.maps.length){return new Pc(this.maps,this.mirror,e,n)}copy(){return new Pc(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,n){this.to=this.maps.push(e),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(e){for(let n=0,i=this.maps.length;n<e.maps.length;n++){let r=e.getMirror(n);this.appendMap(e.maps[n],r!=null&&r<n?i+r:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,i=this.maps.length+e.maps.length;n>=0;n--){let r=e.getMirror(n);this.appendMap(e.maps[n].invert(),r!=null&&r>n?i-r-1:void 0)}}invert(){let e=new Pc;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let i=this.from;i<this.to;i++)e=this.maps[i].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,i){let r=0;for(let a=this.from;a<this.to;a++){let u=this.maps[a],l=u.mapResult(e,n);if(l.recover!=null){let g=this.getMirror(a);if(g!=null&&g>a&&g<this.to){a=g,e=this.maps[g].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return i?e:new Dy(e,r,null)}}const Oy=Object.create(null);class Ji{getMap(){return Gr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=Oy[n.stepType];if(!i)throw new RangeError(`No step type ${n.stepType} defined`);return i.fromJSON(e,n)}static jsonID(e,n){if(e in Oy)throw new RangeError("Duplicate use of step JSON ID "+e);return Oy[e]=n,n.prototype.jsonID=e,n}}class di{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new di(e,null)}static fail(e){return new di(null,e)}static fromReplace(e,n,i,r){try{return di.ok(e.replace(n,i,r))}catch(a){if(a instanceof af)return di.fail(a.message);throw a}}}function zy(t,e,n){let i=[];for(let r=0;r<t.childCount;r++){let a=t.child(r);a.content.size&&(a=a.copy(zy(a.content,e,a))),a.isInline&&(a=e(a,n,r)),i.push(a)}return Fe.fromArray(i)}class pa extends Ji{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=e.resolve(this.from),r=i.node(i.sharedDepth(this.to)),a=new dt(zy(n.content,(u,l)=>!u.isAtom||!l.type.allowsMarkType(this.mark.type)?u:u.mark(this.mark.addToSet(u.marks)),r),n.openStart,n.openEnd);return di.fromReplace(e,this.from,this.to,a)}invert(){return new io(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new pa(n.pos,i.pos,this.mark)}merge(e){return e instanceof pa&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new pa(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new pa(n.from,n.to,e.markFromJSON(n.mark))}}Ji.jsonID("addMark",pa);class io extends Ji{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=new dt(zy(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return di.fromReplace(e,this.from,this.to,i)}invert(){return new pa(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new io(n.pos,i.pos,this.mark)}merge(e){return e instanceof io&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new io(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new io(n.from,n.to,e.markFromJSON(n.mark))}}Ji.jsonID("removeMark",io);class fa extends Ji{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return di.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return di.fromReplace(e,this.pos,this.pos+1,new dt(Fe.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let i=this.mark.addToSet(n.marks);if(i.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(i))return new fa(this.pos,n.marks[r]);return new fa(this.pos,this.mark)}}return new Dc(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new fa(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new fa(n.pos,e.markFromJSON(n.mark))}}Ji.jsonID("addNodeMark",fa);class Dc extends Ji{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return di.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return di.fromReplace(e,this.pos,this.pos+1,new dt(Fe.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new fa(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Dc(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Dc(n.pos,e.markFromJSON(n.mark))}}Ji.jsonID("removeNodeMark",Dc);class Ci extends Ji{constructor(e,n,i,r=!1){super(),this.from=e,this.to=n,this.slice=i,this.structure=r}apply(e){return this.structure&&By(e,this.from,this.to)?di.fail("Structure replace would overwrite content"):di.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Gr([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ci(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deletedAcross&&i.deletedAcross?null:new Ci(n.pos,Math.max(n.pos,i.pos),this.slice)}merge(e){if(!(e instanceof Ci)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?dt.empty:new dt(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ci(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?dt.empty:new dt(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ci(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ci(n.from,n.to,dt.fromJSON(e,n.slice),!!n.structure)}}Ji.jsonID("replace",Ci);class Ti extends Ji{constructor(e,n,i,r,a,u,l=!1){super(),this.from=e,this.to=n,this.gapFrom=i,this.gapTo=r,this.slice=a,this.insert=u,this.structure=l}apply(e){if(this.structure&&(By(e,this.from,this.gapFrom)||By(e,this.gapTo,this.to)))return di.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return di.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,n.content);return i?di.fromReplace(e,this.from,this.to,i):di.fail("Content does not fit in gap")}getMap(){return new Gr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Ti(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return n.deletedAcross&&i.deletedAcross||r<n.pos||a>i.pos?null:new Ti(n.pos,i.pos,r,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ti(n.from,n.to,n.gapFrom,n.gapTo,dt.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ji.jsonID("replaceAround",Ti);function By(t,e,n){let i=t.resolve(e),r=n-e,a=i.depth;for(;r>0&&a>0&&i.indexAfter(a)==i.node(a).childCount;)a--,r--;if(r>0){let u=i.node(a).maybeChild(i.indexAfter(a));for(;r>0;){if(!u||u.isLeaf)return!0;u=u.firstChild,r--}}return!1}function r5(t,e,n,i){let r=[],a=[],u,l;t.doc.nodesBetween(e,n,(g,b,S)=>{if(!g.isInline)return;let E=g.marks;if(!i.isInSet(E)&&S.type.allowsMarkType(i.type)){let C=Math.max(b,e),P=Math.min(b+g.nodeSize,n),D=i.addToSet(E);for(let R=0;R<E.length;R++)E[R].isInSet(D)||(u&&u.to==C&&u.mark.eq(E[R])?u.to=P:r.push(u=new io(C,P,E[R])));l&&l.to==C?l.to=P:a.push(l=new pa(C,P,i))}}),r.forEach(g=>t.step(g)),a.forEach(g=>t.step(g))}function s5(t,e,n,i){let r=[],a=0;t.doc.nodesBetween(e,n,(u,l)=>{if(!u.isInline)return;a++;let g=null;if(i instanceof hf){let b=u.marks,S;for(;S=i.isInSet(b);)(g||(g=[])).push(S),b=S.removeFromSet(b)}else i?i.isInSet(u.marks)&&(g=[i]):g=u.marks;if(g&&g.length){let b=Math.min(l+u.nodeSize,n);for(let S=0;S<g.length;S++){let E=g[S],C;for(let P=0;P<r.length;P++){let D=r[P];D.step==a-1&&E.eq(r[P].style)&&(C=D)}C?(C.to=b,C.step=a):r.push({style:E,from:Math.max(l,e),to:b,step:a})}}}),r.forEach(u=>t.step(new io(u.from,u.to,u.style)))}function Cw(t,e,n,i=n.contentMatch,r=!0){let a=t.doc.nodeAt(e),u=[],l=e+1;for(let g=0;g<a.childCount;g++){let b=a.child(g),S=l+b.nodeSize,E=i.matchType(b.type);if(!E)u.push(new Ci(l,S,dt.empty));else{i=E;for(let C=0;C<b.marks.length;C++)n.allowsMarkType(b.marks[C].type)||t.step(new io(l,S,b.marks[C]));if(r&&b.isText&&n.whitespace!="pre"){let C,P=/\r?\n|\r/g,D;for(;C=P.exec(b.text);)D||(D=new dt(Fe.from(n.schema.text(" ",n.allowedMarks(b.marks))),0,0)),u.push(new Ci(l+C.index,l+C.index+C[0].length,D))}}l=S}if(!i.validEnd){let g=i.fillBefore(Fe.empty,!0);t.replace(l,l,new dt(g,0,0))}for(let g=u.length-1;g>=0;g--)t.step(u[g])}function o5(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Oc(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let i=t.depth;;--i){let r=t.$from.node(i),a=t.$from.index(i),u=t.$to.indexAfter(i);if(i<t.depth&&r.canReplace(a,u,n))return i;if(i==0||r.type.spec.isolating||!o5(r,a,u))break}return null}function a5(t,e,n){let{$from:i,$to:r,depth:a}=e,u=i.before(a+1),l=r.after(a+1),g=u,b=l,S=Fe.empty,E=0;for(let D=a,R=!1;D>n;D--)R||i.index(D)>0?(R=!0,S=Fe.from(i.node(D).copy(S)),E++):g--;let C=Fe.empty,P=0;for(let D=a,R=!1;D>n;D--)R||r.after(D+1)<r.end(D)?(R=!0,C=Fe.from(r.node(D).copy(C)),P++):b++;t.step(new Ti(g,b,u,l,new dt(S.append(C),E,P),S.size-E,!0))}function Ny(t,e,n=null,i=t){let r=l5(t,e),a=r&&c5(i,e);return a?r.map(Tw).concat({type:e,attrs:n}).concat(a.map(Tw)):null}function Tw(t){return{type:t,attrs:null}}function l5(t,e){let{parent:n,startIndex:i,endIndex:r}=t,a=n.contentMatchAt(i).findWrapping(e);if(!a)return null;let u=a.length?a[0]:e;return n.canReplaceWith(i,r,u)?a:null}function c5(t,e){let{parent:n,startIndex:i,endIndex:r}=t,a=n.child(i),u=e.contentMatch.findWrapping(a.type);if(!u)return null;let g=(u.length?u[u.length-1]:e).contentMatch;for(let b=i;g&&b<r;b++)g=g.matchType(n.child(b).type);return!g||!g.validEnd?null:u}function u5(t,e,n){let i=Fe.empty;for(let u=n.length-1;u>=0;u--){if(i.size){let l=n[u].type.contentMatch.matchFragment(i);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=Fe.from(n[u].type.create(n[u].attrs,i))}let r=e.start,a=e.end;t.step(new Ti(r,a,r,a,new dt(i,0,0),n.length,!0))}function h5(t,e,n,i,r){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(e,n,(u,l)=>{let g=typeof r=="function"?r(u):r;if(u.isTextblock&&!u.hasMarkup(i,g)&&f5(t.doc,t.mapping.slice(a).map(l),i)){let b=null;if(i.schema.linebreakReplacement){let P=i.whitespace=="pre",D=!!i.contentMatch.matchType(i.schema.linebreakReplacement);P&&!D?b=!1:!P&&D&&(b=!0)}b===!1&&p5(t,u,l,a),Cw(t,t.mapping.slice(a).map(l,1),i,void 0,b===null);let S=t.mapping.slice(a),E=S.map(l,1),C=S.map(l+u.nodeSize,1);return t.step(new Ti(E,C,E+1,C-1,new dt(Fe.from(i.create(g,null,u.marks)),0,0),1,!0)),b===!0&&d5(t,u,l,a),!1}})}function d5(t,e,n,i){e.forEach((r,a)=>{if(r.isText){let u,l=/\r?\n|\r/g;for(;u=l.exec(r.text);){let g=t.mapping.slice(i).map(n+1+a+u.index);t.replaceWith(g,g+1,e.type.schema.linebreakReplacement.create())}}})}function p5(t,e,n,i){e.forEach((r,a)=>{if(r.type==r.type.schema.linebreakReplacement){let u=t.mapping.slice(i).map(n+1+a);t.replaceWith(u,u+1,e.type.schema.text(`
|
633
633
|
`))}})}function f5(t,e,n){let i=t.resolve(e),r=i.index();return i.parent.canReplaceWith(r,r+1,n)}function m5(t,e,n,i,r){let a=t.doc.nodeAt(e);if(!a)throw new RangeError("No node at given position");n||(n=a.type);let u=n.create(i,null,r||a.marks);if(a.isLeaf)return t.replaceWith(e,e+a.nodeSize,u);if(!n.validContent(a.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Ti(e,e+a.nodeSize,e+1,e+a.nodeSize-1,new dt(Fe.from(u),0,0),1,!0))}function zc(t,e,n=1,i){let r=t.resolve(e),a=r.depth-n,u=i&&i[i.length-1]||r.parent;if(a<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!u.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let b=r.depth-1,S=n-2;b>a;b--,S--){let E=r.node(b),C=r.index(b);if(E.type.spec.isolating)return!1;let P=E.content.cutByIndex(C,E.childCount),D=i&&i[S+1];D&&(P=P.replaceChild(0,D.type.create(D.attrs)));let R=i&&i[S]||E;if(!E.canReplace(C+1,E.childCount)||!R.type.validContent(P))return!1}let l=r.indexAfter(a),g=i&&i[0];return r.node(a).canReplaceWith(l,l,g?g.type:r.node(a+1).type)}function g5(t,e,n=1,i){let r=t.doc.resolve(e),a=Fe.empty,u=Fe.empty;for(let l=r.depth,g=r.depth-n,b=n-1;l>g;l--,b--){a=Fe.from(r.node(l).copy(a));let S=i&&i[b];u=Fe.from(S?S.type.create(S.attrs,u):r.node(l).copy(u))}t.step(new Ci(e,e,new dt(a.append(u),n,n),!0))}function ma(t,e){let n=t.resolve(e),i=n.index();return Mw(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(i,i+1)}function Mw(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function yf(t,e,n=-1){let i=t.resolve(e);for(let r=i.depth;;r--){let a,u,l=i.index(r);if(r==i.depth?(a=i.nodeBefore,u=i.nodeAfter):n>0?(a=i.node(r+1),l++,u=i.node(r).maybeChild(l)):(a=i.node(r).maybeChild(l-1),u=i.node(r+1)),a&&!a.isTextblock&&Mw(a,u)&&i.node(r).canReplace(l,l+1))return e;if(r==0)break;e=n<0?i.before(r):i.after(r)}}function y5(t,e,n){let i=new Ci(e-n,e+n,dt.empty,!0);t.step(i)}function _5(t,e,n){let i=t.resolve(e);if(i.parent.canReplaceWith(i.index(),i.index(),n))return e;if(i.parentOffset==0)for(let r=i.depth-1;r>=0;r--){let a=i.index(r);if(i.node(r).canReplaceWith(a,a,n))return i.before(r+1);if(a>0)return null}if(i.parentOffset==i.parent.content.size)for(let r=i.depth-1;r>=0;r--){let a=i.indexAfter(r);if(i.node(r).canReplaceWith(a,a,n))return i.after(r+1);if(a<i.node(r).childCount)return null}return null}function Aw(t,e,n){let i=t.resolve(e);if(!n.content.size)return e;let r=n.content;for(let a=0;a<n.openStart;a++)r=r.firstChild.content;for(let a=1;a<=(n.openStart==0&&n.size?2:1);a++)for(let u=i.depth;u>=0;u--){let l=u==i.depth?0:i.pos<=(i.start(u+1)+i.end(u+1))/2?-1:1,g=i.index(u)+(l>0?1:0),b=i.node(u),S=!1;if(a==1)S=b.canReplace(g,g,r);else{let E=b.contentMatchAt(g).findWrapping(r.firstChild.type);S=E&&b.canReplaceWith(g,g,E[0])}if(S)return l==0?i.pos:l<0?i.before(u+1):i.after(u+1)}return null}function _f(t,e,n=e,i=dt.empty){if(e==n&&!i.size)return null;let r=t.resolve(e),a=t.resolve(n);return Iw(r,a,i)?new Ci(e,n,i):new b5(r,a,i).fit()}function Iw(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class b5{constructor(e,n,i){this.$from=e,this.$to=n,this.unplaced=i,this.frontier=[],this.placed=Fe.empty;for(let r=0;r<=e.depth;r++){let a=e.node(r);this.frontier.push({type:a.type,match:a.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=Fe.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let b=this.findFittable();b?this.placeNodes(b):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,i=this.$from,r=this.close(e<0?this.$to:i.doc.resolve(e));if(!r)return null;let a=this.placed,u=i.depth,l=r.depth;for(;u&&l&&a.childCount==1;)a=a.firstChild.content,u--,l--;let g=new dt(a,u,l);return e>-1?new Ti(i.pos,e,this.$to.pos,this.$to.end(),g,n):g.size||i.pos!=this.$to.pos?new Ci(i.pos,r.pos,g):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,i=0,r=this.unplaced.openEnd;i<e;i++){let a=n.firstChild;if(n.childCount>1&&(r=0),a.type.spec.isolating&&r<=i){e=i;break}n=a.content}for(let n=1;n<=2;n++)for(let i=n==1?e:this.unplaced.openStart;i>=0;i--){let r,a=null;i?(a=Ry(this.unplaced.content,i-1).firstChild,r=a.content):r=this.unplaced.content;let u=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:g,match:b}=this.frontier[l],S,E=null;if(n==1&&(u?b.matchType(u.type)||(E=b.fillBefore(Fe.from(u),!1)):a&&g.compatibleContent(a.type)))return{sliceDepth:i,frontierDepth:l,parent:a,inject:E};if(n==2&&u&&(S=b.findWrapping(u.type)))return{sliceDepth:i,frontierDepth:l,parent:a,wrap:S};if(a&&b.matchType(a.type))break}}}openMore(){let{content:e,openStart:n,openEnd:i}=this.unplaced,r=Ry(e,n);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new dt(e,n+1,Math.max(i,r.size+n>=e.size-i?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:i}=this.unplaced,r=Ry(e,n);if(r.childCount<=1&&n>0){let a=e.size-n<=n+r.size;this.unplaced=new dt(kh(e,n-1,1),n-1,a?n-1:i)}else this.unplaced=new dt(kh(e,n,1),n,i)}placeNodes({sliceDepth:e,frontierDepth:n,parent:i,inject:r,wrap:a}){for(;this.depth>n;)this.closeFrontierNode();if(a)for(let R=0;R<a.length;R++)this.openFrontierNode(a[R]);let u=this.unplaced,l=i?i.content:u.content,g=u.openStart-e,b=0,S=[],{match:E,type:C}=this.frontier[n];if(r){for(let R=0;R<r.childCount;R++)S.push(r.child(R));E=E.matchFragment(r)}let P=l.size+e-(u.content.size-u.openEnd);for(;b<l.childCount;){let R=l.child(b),j=E.matchType(R.type);if(!j)break;b++,(b>1||g==0||R.content.size)&&(E=j,S.push(Pw(R.mark(C.allowedMarks(R.marks)),b==1?g:0,b==l.childCount?P:-1)))}let D=b==l.childCount;D||(P=-1),this.placed=Sh(this.placed,n,Fe.from(S)),this.frontier[n].match=E,D&&P<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let R=0,j=l;R<P;R++){let W=j.lastChild;this.frontier.push({type:W.type,match:W.contentMatchAt(W.childCount)}),j=W.content}this.unplaced=D?e==0?dt.empty:new dt(kh(u.content,e-1,1),e-1,P<0?u.openEnd:e-1):new dt(kh(u.content,e,b),u.openStart,u.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Ly(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:i}=this.$to,r=this.$to.after(i);for(;i>1&&r==this.$to.end(--i);)++r;return r}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:i,type:r}=this.frontier[n],a=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),u=Ly(e,n,r,i,a);if(u){for(let l=n-1;l>=0;l--){let{match:g,type:b}=this.frontier[l],S=Ly(e,l,b,g,!0);if(!S||S.childCount)continue e}return{depth:n,fit:u,move:a?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Sh(this.placed,n.depth,n.fit)),e=n.move;for(let i=n.depth+1;i<=e.depth;i++){let r=e.node(i),a=r.type.contentMatch.fillBefore(r.content,!0,e.index(i));this.openFrontierNode(r.type,r.attrs,a)}return e}openFrontierNode(e,n=null,i){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Sh(this.placed,this.depth,Fe.from(e.create(n,i))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Fe.empty,!0);n.childCount&&(this.placed=Sh(this.placed,this.frontier.length,n))}}function kh(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(kh(t.firstChild.content,e-1,n)))}function Sh(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Sh(t.lastChild.content,e-1,n)))}function Ry(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Pw(t,e,n){if(e<=0)return t;let i=t.content;return e>1&&(i=i.replaceChild(0,Pw(i.firstChild,e-1,i.childCount==1?n-1:0))),e>0&&(i=t.type.contentMatch.fillBefore(i).append(i),n<=0&&(i=i.append(t.type.contentMatch.matchFragment(i).fillBefore(Fe.empty,!0)))),t.copy(i)}function Ly(t,e,n,i,r){let a=t.node(e),u=r?t.indexAfter(e):t.index(e);if(u==a.childCount&&!n.compatibleContent(a.type))return null;let l=i.fillBefore(a.content,!0,u);return l&&!x5(n,a.content,u)?l:null}function x5(t,e,n){for(let i=n;i<e.childCount;i++)if(!t.allowsMarks(e.child(i).marks))return!0;return!1}function v5(t){return t.spec.defining||t.spec.definingForContent}function w5(t,e,n,i){if(!i.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),a=t.doc.resolve(n);if(Iw(r,a,i))return t.step(new Ci(e,n,i));let u=Ow(r,t.doc.resolve(n));u[u.length-1]==0&&u.pop();let l=-(r.depth+1);u.unshift(l);for(let C=r.depth,P=r.pos-1;C>0;C--,P--){let D=r.node(C).type.spec;if(D.defining||D.definingAsContext||D.isolating)break;u.indexOf(C)>-1?l=C:r.before(C)==P&&u.splice(1,0,-C)}let g=u.indexOf(l),b=[],S=i.openStart;for(let C=i.content,P=0;;P++){let D=C.firstChild;if(b.push(D),P==i.openStart)break;C=D.content}for(let C=S-1;C>=0;C--){let P=b[C],D=v5(P.type);if(D&&!P.sameMarkup(r.node(Math.abs(l)-1)))S=C;else if(D||!P.type.isTextblock)break}for(let C=i.openStart;C>=0;C--){let P=(C+S+1)%(i.openStart+1),D=b[P];if(D)for(let R=0;R<u.length;R++){let j=u[(R+g)%u.length],W=!0;j<0&&(W=!1,j=-j);let ee=r.node(j-1),le=r.index(j-1);if(ee.canReplaceWith(le,le,D.type,D.marks))return t.replace(r.before(j),W?a.after(j):n,new dt(Dw(i.content,0,i.openStart,P),P,i.openEnd))}}let E=t.steps.length;for(let C=u.length-1;C>=0&&(t.replace(e,n,i),!(t.steps.length>E));C--){let P=u[C];P<0||(e=r.before(P),n=a.after(P))}}function Dw(t,e,n,i,r){if(e<n){let a=t.firstChild;t=t.replaceChild(0,a.copy(Dw(a.content,e+1,n,i,a)))}if(e>i){let a=r.contentMatchAt(0),u=a.fillBefore(t).append(t);t=u.append(a.matchFragment(u).fillBefore(Fe.empty,!0))}return t}function k5(t,e,n,i){if(!i.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let r=_5(t.doc,e,i.type);r!=null&&(e=n=r)}t.replaceRange(e,n,new dt(Fe.from(i),0,0))}function S5(t,e,n){let i=t.doc.resolve(e),r=t.doc.resolve(n),a=Ow(i,r);for(let u=0;u<a.length;u++){let l=a[u],g=u==a.length-1;if(g&&l==0||i.node(l).type.contentMatch.validEnd)return t.delete(i.start(l),r.end(l));if(l>0&&(g||i.node(l-1).canReplace(i.index(l-1),r.indexAfter(l-1))))return t.delete(i.before(l),r.after(l))}for(let u=1;u<=i.depth&&u<=r.depth;u++)if(e-i.start(u)==i.depth-u&&n>i.end(u)&&r.end(u)-n!=r.depth-u)return t.delete(i.before(u),n);t.delete(e,n)}function Ow(t,e){let n=[],i=Math.min(t.depth,e.depth);for(let r=i;r>=0;r--){let a=t.start(r);if(a<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(a==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==a-1)&&n.push(r)}return n}class Bc extends Ji{constructor(e,n,i){super(),this.pos=e,this.attr=n,this.value=i}apply(e){let n=e.nodeAt(this.pos);if(!n)return di.fail("No node at attribute step's position");let i=Object.create(null);for(let a in n.attrs)i[a]=n.attrs[a];i[this.attr]=this.value;let r=n.type.create(i,null,n.marks);return di.fromReplace(e,this.pos,this.pos+1,new dt(Fe.from(r),0,n.isLeaf?0:1))}getMap(){return Gr.empty}invert(e){return new Bc(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Bc(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Bc(n.pos,n.attr,n.value)}}Ji.jsonID("attr",Bc);class Eh extends Ji{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let i=e.type.create(n,e.content,e.marks);return di.ok(i)}getMap(){return Gr.empty}invert(e){return new Eh(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Eh(n.attr,n.value)}}Ji.jsonID("docAttr",Eh);let Nc=class extends Error{};Nc=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},Nc.prototype=Object.create(Error.prototype),Nc.prototype.constructor=Nc,Nc.prototype.name="TransformError";class E5{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Pc}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Nc(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,i=dt.empty){let r=_f(this.doc,e,n,i);return r&&this.step(r),this}replaceWith(e,n,i){return this.replace(e,n,new dt(Fe.from(i),0,0))}delete(e,n){return this.replace(e,n,dt.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,i){return w5(this,e,n,i),this}replaceRangeWith(e,n,i){return k5(this,e,n,i),this}deleteRange(e,n){return S5(this,e,n),this}lift(e,n){return a5(this,e,n),this}join(e,n=1){return y5(this,e,n),this}wrap(e,n){return u5(this,e,n),this}setBlockType(e,n=e,i,r=null){return h5(this,e,n,i,r),this}setNodeMarkup(e,n,i=null,r){return m5(this,e,n,i,r),this}setNodeAttribute(e,n,i){return this.step(new Bc(e,n,i)),this}setDocAttribute(e,n){return this.step(new Eh(e,n)),this}addNodeMark(e,n){return this.step(new fa(e,n)),this}removeNodeMark(e,n){if(!(n instanceof Hn)){let i=this.doc.nodeAt(e);if(!i)throw new RangeError("No node at position "+e);if(n=n.isInSet(i.marks),!n)return this}return this.step(new Dc(e,n)),this}split(e,n=1,i){return g5(this,e,n,i),this}addMark(e,n,i){return r5(this,e,n,i),this}removeMark(e,n,i){return s5(this,e,n,i),this}clearIncompatible(e,n,i){return Cw(this,e,n,i),this}}const Vy=Object.create(null);class Gt{constructor(e,n,i){this.$anchor=e,this.$head=n,this.ranges=i||[new C5(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=dt.empty){let i=n.content.lastChild,r=null;for(let l=0;l<n.openEnd;l++)r=i,i=i.lastChild;let a=e.steps.length,u=this.ranges;for(let l=0;l<u.length;l++){let{$from:g,$to:b}=u[l],S=e.mapping.slice(a);e.replaceRange(S.map(g.pos),S.map(b.pos),l?dt.empty:n),l==0&&Nw(e,a,(i?i.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,n){let i=e.steps.length,r=this.ranges;for(let a=0;a<r.length;a++){let{$from:u,$to:l}=r[a],g=e.mapping.slice(i),b=g.map(u.pos),S=g.map(l.pos);a?e.deleteRange(b,S):(e.replaceRangeWith(b,S,n),Nw(e,i,n.isInline?-1:1))}}static findFrom(e,n,i=!1){let r=e.parent.inlineContent?new Vt(e):Rc(e.node(0),e.parent,e.pos,e.index(),n,i);if(r)return r;for(let a=e.depth-1;a>=0;a--){let u=n<0?Rc(e.node(0),e.node(a),e.before(a+1),e.index(a),n,i):Rc(e.node(0),e.node(a),e.after(a+1),e.index(a)+1,n,i);if(u)return u}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Fs(e.node(0))}static atStart(e){return Rc(e,e,0,0,1)||new Fs(e)}static atEnd(e){return Rc(e,e,e.content.size,e.childCount,-1)||new Fs(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let i=Vy[n.type];if(!i)throw new RangeError(`No selection type ${n.type} defined`);return i.fromJSON(e,n)}static jsonID(e,n){if(e in Vy)throw new RangeError("Duplicate use of selection JSON ID "+e);return Vy[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Vt.between(this.$anchor,this.$head).getBookmark()}}Gt.prototype.visible=!0;class C5{constructor(e,n){this.$from=e,this.$to=n}}let zw=!1;function Bw(t){!zw&&!t.parent.inlineContent&&(zw=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Vt extends Gt{constructor(e,n=e){Bw(e),Bw(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let i=e.resolve(n.map(this.head));if(!i.parent.inlineContent)return Gt.near(i);let r=e.resolve(n.map(this.anchor));return new Vt(r.parent.inlineContent?r:i,i)}replace(e,n=dt.empty){if(super.replace(e,n),n==dt.empty){let i=this.$from.marksAcross(this.$to);i&&e.ensureMarks(i)}}eq(e){return e instanceof Vt&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new bf(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Vt(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,i=n){let r=e.resolve(n);return new this(r,i==n?r:e.resolve(i))}static between(e,n,i){let r=e.pos-n.pos;if((!i||r)&&(i=r>=0?1:-1),!n.parent.inlineContent){let a=Gt.findFrom(n,i,!0)||Gt.findFrom(n,-i,!0);if(a)n=a.$head;else return Gt.near(n,i)}return e.parent.inlineContent||(r==0?e=n:(e=(Gt.findFrom(e,-i,!0)||Gt.findFrom(e,i,!0)).$anchor,e.pos<n.pos!=r<0&&(e=n))),new Vt(e,n)}}Gt.jsonID("text",Vt);class bf{constructor(e,n){this.anchor=e,this.head=n}map(e){return new bf(e.map(this.anchor),e.map(this.head))}resolve(e){return Vt.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ot extends Gt{constructor(e){let n=e.nodeAfter,i=e.node(0).resolve(e.pos+n.nodeSize);super(e,i),this.node=n}map(e,n){let{deleted:i,pos:r}=n.mapResult(this.anchor),a=e.resolve(r);return i?Gt.near(a):new Ot(a)}content(){return new dt(Fe.from(this.node),0,0)}eq(e){return e instanceof Ot&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Fy(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ot(e.resolve(n.anchor))}static create(e,n){return new Ot(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ot.prototype.visible=!1,Gt.jsonID("node",Ot);class Fy{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:i}=e.mapResult(this.anchor);return n?new bf(i,i):new Fy(i)}resolve(e){let n=e.resolve(this.anchor),i=n.nodeAfter;return i&&Ot.isSelectable(i)?new Ot(n):Gt.near(n)}}class Fs extends Gt{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=dt.empty){if(n==dt.empty){e.delete(0,e.doc.content.size);let i=Gt.atStart(e.doc);i.eq(e.selection)||e.setSelection(i)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Fs(e)}map(e){return new Fs(e)}eq(e){return e instanceof Fs}getBookmark(){return T5}}Gt.jsonID("all",Fs);const T5={map(){return this},resolve(t){return new Fs(t)}};function Rc(t,e,n,i,r,a=!1){if(e.inlineContent)return Vt.create(t,n);for(let u=i-(r>0?0:1);r>0?u<e.childCount:u>=0;u+=r){let l=e.child(u);if(l.isAtom){if(!a&&Ot.isSelectable(l))return Ot.create(t,n-(r<0?l.nodeSize:0))}else{let g=Rc(t,l,n+r,r<0?l.childCount:0,r,a);if(g)return g}n+=l.nodeSize*r}return null}function Nw(t,e,n){let i=t.steps.length-1;if(i<e)return;let r=t.steps[i];if(!(r instanceof Ci||r instanceof Ti))return;let a=t.mapping.maps[i],u;a.forEach((l,g,b,S)=>{u==null&&(u=S)}),t.setSelection(Gt.near(t.doc.resolve(u),n))}const Rw=1,xf=2,Lw=4;class M5 extends E5{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Rw)&~xf,this.storedMarks=null,this}get selectionSet(){return(this.updated&Rw)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=xf,this}ensureMarks(e){return Hn.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&xf)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~xf,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let i=this.selection;return n&&(e=e.mark(this.storedMarks||(i.empty?i.$from.marks():i.$from.marksAcross(i.$to)||Hn.none))),i.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,i){let r=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(i==null&&(i=n),i=i??n,!e)return this.deleteRange(n,i);let a=this.storedMarks;if(!a){let u=this.doc.resolve(n);a=i==n?u.marks():u.marksAcross(this.doc.resolve(i))}return this.replaceRangeWith(n,i,r.text(e,a)),this.selection.empty||this.setSelection(Gt.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Lw,this}get scrolledIntoView(){return(this.updated&Lw)>0}}function Vw(t,e){return!e||!t?t:t.bind(e)}class Ch{constructor(e,n,i){this.name=e,this.init=Vw(n.init,i),this.apply=Vw(n.apply,i)}}const A5=[new Ch("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Ch("selection",{init(t,e){return t.selection||Gt.atStart(e.doc)},apply(t){return t.selection}}),new Ch("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,i){return i.selection.$cursor?t.storedMarks:null}}),new Ch("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class $y{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=A5.slice(),n&&n.forEach(i=>{if(this.pluginsByKey[i.key])throw new RangeError("Adding different instances of a keyed plugin ("+i.key+")");this.plugins.push(i),this.pluginsByKey[i.key]=i,i.spec.state&&this.fields.push(new Ch(i.key,i.spec.state,i))})}}class Lc{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let i=0;i<this.config.plugins.length;i++)if(i!=n){let r=this.config.plugins[i];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],i=this.applyInner(e),r=null;for(;;){let a=!1;for(let u=0;u<this.config.plugins.length;u++){let l=this.config.plugins[u];if(l.spec.appendTransaction){let g=r?r[u].n:0,b=r?r[u].state:this,S=g<n.length&&l.spec.appendTransaction.call(l,g?n.slice(g):n,b,i);if(S&&i.filterTransaction(S,u)){if(S.setMeta("appendedTransaction",e),!r){r=[];for(let E=0;E<this.config.plugins.length;E++)r.push(E<u?{state:i,n:n.length}:{state:this,n:0})}n.push(S),i=i.applyInner(S),a=!0}r&&(r[u]={state:i,n:n.length})}}if(!a)return{state:i,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Lc(this.config),i=this.config.fields;for(let r=0;r<i.length;r++){let a=i[r];n[a.name]=a.apply(e,this[a.name],this,n)}return n}get tr(){return new M5(this)}static create(e){let n=new $y(e.doc?e.doc.type.schema:e.schema,e.plugins),i=new Lc(n);for(let r=0;r<n.fields.length;r++)i[n.fields[r].name]=n.fields[r].init(e,i);return i}reconfigure(e){let n=new $y(this.schema,e.plugins),i=n.fields,r=new Lc(n);for(let a=0;a<i.length;a++){let u=i[a].name;r[u]=this.hasOwnProperty(u)?this[u]:i[a].init(e,r)}return r}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(i=>i.toJSON())),e&&typeof e=="object")for(let i in e){if(i=="doc"||i=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[i],a=r.spec.state;a&&a.toJSON&&(n[i]=a.toJSON.call(r,this[r.key]))}return n}static fromJSON(e,n,i){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new $y(e.schema,e.plugins),a=new Lc(r);return r.fields.forEach(u=>{if(u.name=="doc")a.doc=kl.fromJSON(e.schema,n.doc);else if(u.name=="selection")a.selection=Gt.fromJSON(a.doc,n.selection);else if(u.name=="storedMarks")n.storedMarks&&(a.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(i)for(let l in i){let g=i[l],b=g.spec.state;if(g.key==u.name&&b&&b.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){a[u.name]=b.fromJSON.call(g,e,n[l],a);return}}a[u.name]=u.init(e,a)}}),a}}function Fw(t,e,n){for(let i in t){let r=t[i];r instanceof Function?r=r.bind(e):i=="handleDOMEvents"&&(r=Fw(r,e,{})),n[i]=r}return n}class Fi{constructor(e){this.spec=e,this.props={},e.props&&Fw(e.props,this,this.props),this.key=e.key?e.key.key:$w("plugin")}getState(e){return e[this.key]}}const jy=Object.create(null);function $w(t){return t in jy?t+"$"+ ++jy[t]:(jy[t]=0,t+"$")}class Ar{constructor(e="key"){this.key=$w(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const $i=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Th=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Uy=null;const zo=function(t,e,n){let i=Uy||(Uy=document.createRange());return i.setEnd(t,n??t.nodeValue.length),i.setStart(t,e||0),i},I5=function(){Uy=null},Cl=function(t,e,n,i){return n&&(jw(t,e,n,i,-1)||jw(t,e,n,i,1))},P5=/^(img|br|input|textarea|hr)$/i;function jw(t,e,n,i,r){for(;;){if(t==n&&e==i)return!0;if(e==(r<0?0:ys(t))){let a=t.parentNode;if(!a||a.nodeType!=1||Mh(t)||P5.test(t.nodeName)||t.contentEditable=="false")return!1;e=$i(t)+(r<0?0:1),t=a}else if(t.nodeType==1){if(t=t.childNodes[e+(r<0?-1:0)],t.contentEditable=="false")return!1;e=r<0?ys(t):0}else return!1}}function ys(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function D5(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=ys(t)}else if(t.parentNode&&!Mh(t))e=$i(t),t=t.parentNode;else return null}}function O5(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Mh(t))e=$i(t)+1,t=t.parentNode;else return null}}function z5(t,e,n){for(let i=e==0,r=e==ys(t);i||r;){if(t==n)return!0;let a=$i(t);if(t=t.parentNode,!t)return!1;i=i&&a==0,r=r&&a==ys(t)}}function Mh(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const vf=function(t){return t.focusNode&&Cl(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Tl(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function B5(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function N5(t,e,n){if(t.caretPositionFromPoint)try{let i=t.caretPositionFromPoint(e,n);if(i)return{node:i.offsetNode,offset:Math.min(ys(i.offsetNode),i.offset)}}catch{}if(t.caretRangeFromPoint){let i=t.caretRangeFromPoint(e,n);if(i)return{node:i.startContainer,offset:Math.min(ys(i.startContainer),i.startOffset)}}}const ro=typeof navigator<"u"?navigator:null,Uw=typeof document<"u"?document:null,ga=ro&&ro.userAgent||"",Hy=/Edge\/(\d+)/.exec(ga),Hw=/MSIE \d/.exec(ga),qy=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ga),Ir=!!(Hw||qy||Hy),ya=Hw?document.documentMode:qy?+qy[1]:Hy?+Hy[1]:0,$s=!Ir&&/gecko\/(\d+)/i.test(ga);$s&&+(/Firefox\/(\d+)/.exec(ga)||[0,0])[1];const Wy=!Ir&&/Chrome\/(\d+)/.exec(ga),Qi=!!Wy,qw=Wy?+Wy[1]:0,ur=!Ir&&!!ro&&/Apple Computer/.test(ro.vendor),Vc=ur&&(/Mobile\/\w+/.test(ga)||!!ro&&ro.maxTouchPoints>2),_s=Vc||(ro?/Mac/.test(ro.platform):!1),R5=ro?/Win/.test(ro.platform):!1,js=/Android \d/.test(ga),Ah=!!Uw&&"webkitFontSmoothing"in Uw.documentElement.style,L5=Ah?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function V5(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Bo(t,e){return typeof t=="number"?t:t[e]}function F5(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,i=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*i}}function Ww(t,e,n){let i=t.someProp("scrollThreshold")||0,r=t.someProp("scrollMargin")||5,a=t.dom.ownerDocument;for(let u=n||t.dom;u;u=Th(u)){if(u.nodeType!=1)continue;let l=u,g=l==a.body,b=g?V5(a):F5(l),S=0,E=0;if(e.top<b.top+Bo(i,"top")?E=-(b.top-e.top+Bo(r,"top")):e.bottom>b.bottom-Bo(i,"bottom")&&(E=e.bottom-e.top>b.bottom-b.top?e.top+Bo(r,"top")-b.top:e.bottom-b.bottom+Bo(r,"bottom")),e.left<b.left+Bo(i,"left")?S=-(b.left-e.left+Bo(r,"left")):e.right>b.right-Bo(i,"right")&&(S=e.right-b.right+Bo(r,"right")),S||E)if(g)a.defaultView.scrollBy(S,E);else{let C=l.scrollLeft,P=l.scrollTop;E&&(l.scrollTop+=E),S&&(l.scrollLeft+=S);let D=l.scrollLeft-C,R=l.scrollTop-P;e={left:e.left-D,top:e.top-R,right:e.right-D,bottom:e.bottom-R}}if(g||/^(fixed|sticky)$/.test(getComputedStyle(u).position))break}}function $5(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),i,r;for(let a=(e.left+e.right)/2,u=n+1;u<Math.min(innerHeight,e.bottom);u+=5){let l=t.root.elementFromPoint(a,u);if(!l||l==t.dom||!t.dom.contains(l))continue;let g=l.getBoundingClientRect();if(g.top>=n-20){i=l,r=g.top;break}}return{refDOM:i,refTop:r,stack:Gw(t.dom)}}function Gw(t){let e=[],n=t.ownerDocument;for(let i=t;i&&(e.push({dom:i,top:i.scrollTop,left:i.scrollLeft}),t!=n);i=Th(i));return e}function j5({refDOM:t,refTop:e,stack:n}){let i=t?t.getBoundingClientRect().top:0;Zw(n,i==0?0:i-e)}function Zw(t,e){for(let n=0;n<t.length;n++){let{dom:i,top:r,left:a}=t[n];i.scrollTop!=r+e&&(i.scrollTop=r+e),i.scrollLeft!=a&&(i.scrollLeft=a)}}let Fc=null;function U5(t){if(t.setActive)return t.setActive();if(Fc)return t.focus(Fc);let e=Gw(t);t.focus(Fc==null?{get preventScroll(){return Fc={preventScroll:!0},!0}}:void 0),Fc||(Fc=!1,Zw(e,0))}function Yw(t,e){let n,i=2e8,r,a=0,u=e.top,l=e.top,g,b;for(let S=t.firstChild,E=0;S;S=S.nextSibling,E++){let C;if(S.nodeType==1)C=S.getClientRects();else if(S.nodeType==3)C=zo(S).getClientRects();else continue;for(let P=0;P<C.length;P++){let D=C[P];if(D.top<=u&&D.bottom>=l){u=Math.max(D.bottom,u),l=Math.min(D.top,l);let R=D.left>e.left?D.left-e.left:D.right<e.left?e.left-D.right:0;if(R<i){n=S,i=R,r=R&&n.nodeType==3?{left:D.right<e.left?D.right:D.left,top:e.top}:e,S.nodeType==1&&R&&(a=E+(e.left>=(D.left+D.right)/2?1:0));continue}}else D.top>e.top&&!g&&D.left<=e.left&&D.right>=e.left&&(g=S,b={left:Math.max(D.left,Math.min(D.right,e.left)),top:D.top});!n&&(e.left>=D.right&&e.top>=D.top||e.left>=D.left&&e.top>=D.bottom)&&(a=E+1)}}return!n&&g&&(n=g,r=b,i=0),n&&n.nodeType==3?H5(n,r):!n||i&&n.nodeType==1?{node:t,offset:a}:Yw(n,r)}function H5(t,e){let n=t.nodeValue.length,i=document.createRange();for(let r=0;r<n;r++){i.setEnd(t,r+1),i.setStart(t,r);let a=_a(i,1);if(a.top!=a.bottom&&Gy(e,a))return{node:t,offset:r+(e.left>=(a.left+a.right)/2?1:0)}}return{node:t,offset:0}}function Gy(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function q5(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function W5(t,e,n){let{node:i,offset:r}=Yw(e,n),a=-1;if(i.nodeType==1&&!i.firstChild){let u=i.getBoundingClientRect();a=u.left!=u.right&&n.left>(u.left+u.right)/2?1:-1}return t.docView.posFromDOM(i,r,a)}function G5(t,e,n,i){let r=-1;for(let a=e,u=!1;a!=t.dom;){let l=t.docView.nearestDesc(a,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)){let g=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&(!u&&g.left>i.left||g.top>i.top?r=l.posBefore:(!u&&g.right<i.left||g.bottom<i.top)&&(r=l.posAfter),u=!0),!l.contentDOM&&r<0&&!l.node.isText)return(l.node.isBlock?i.top<(g.top+g.bottom)/2:i.left<(g.left+g.right)/2)?l.posBefore:l.posAfter}a=l.dom.parentNode}return r>-1?r:t.docView.posFromDOM(e,n,-1)}function Xw(t,e,n){let i=t.childNodes.length;if(i&&n.top<n.bottom)for(let r=Math.max(0,Math.min(i-1,Math.floor(i*(e.top-n.top)/(n.bottom-n.top))-2)),a=r;;){let u=t.childNodes[a];if(u.nodeType==1){let l=u.getClientRects();for(let g=0;g<l.length;g++){let b=l[g];if(Gy(e,b))return Xw(u,e,b)}}if((a=(a+1)%i)==r)break}return t}function Z5(t,e){let n=t.dom.ownerDocument,i,r=0,a=N5(n,e.left,e.top);a&&({node:i,offset:r}=a);let u=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!u||!t.dom.contains(u.nodeType!=1?u.parentNode:u)){let b=t.dom.getBoundingClientRect();if(!Gy(e,b)||(u=Xw(t.dom,e,b),!u))return null}if(ur)for(let b=u;i&&b;b=Th(b))b.draggable&&(i=void 0);if(u=q5(u,e),i){if($s&&i.nodeType==1&&(r=Math.min(r,i.childNodes.length),r<i.childNodes.length)){let S=i.childNodes[r],E;S.nodeName=="IMG"&&(E=S.getBoundingClientRect()).right<=e.left&&E.bottom>e.top&&r++}let b;Ah&&r&&i.nodeType==1&&(b=i.childNodes[r-1]).nodeType==1&&b.contentEditable=="false"&&b.getBoundingClientRect().top>=e.top&&r--,i==t.dom&&r==i.childNodes.length-1&&i.lastChild.nodeType==1&&e.top>i.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(r==0||i.nodeType!=1||i.childNodes[r-1].nodeName!="BR")&&(l=G5(t,i,r,e))}l==null&&(l=W5(t,u,e));let g=t.docView.nearestDesc(u,!0);return{pos:l,inside:g?g.posAtStart-g.border:-1}}function Kw(t){return t.top<t.bottom||t.left<t.right}function _a(t,e){let n=t.getClientRects();if(n.length){let i=n[e<0?0:n.length-1];if(Kw(i))return i}return Array.prototype.find.call(n,Kw)||t.getBoundingClientRect()}const Y5=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Jw(t,e,n){let{node:i,offset:r,atom:a}=t.docView.domFromPos(e,n<0?-1:1),u=Ah||$s;if(i.nodeType==3)if(u&&(Y5.test(i.nodeValue)||(n<0?!r:r==i.nodeValue.length))){let g=_a(zo(i,r,r),n);if($s&&r&&/\s/.test(i.nodeValue[r-1])&&r<i.nodeValue.length){let b=_a(zo(i,r-1,r-1),-1);if(b.top==g.top){let S=_a(zo(i,r,r+1),-1);if(S.top!=g.top)return Ih(S,S.left<b.left)}}return g}else{let g=r,b=r,S=n<0?1:-1;return n<0&&!r?(b++,S=-1):n>=0&&r==i.nodeValue.length?(g--,S=1):n<0?g--:b++,Ih(_a(zo(i,g,b),S),S<0)}if(!t.state.doc.resolve(e-(a||0)).parent.inlineContent){if(a==null&&r&&(n<0||r==ys(i))){let g=i.childNodes[r-1];if(g.nodeType==1)return Zy(g.getBoundingClientRect(),!1)}if(a==null&&r<ys(i)){let g=i.childNodes[r];if(g.nodeType==1)return Zy(g.getBoundingClientRect(),!0)}return Zy(i.getBoundingClientRect(),n>=0)}if(a==null&&r&&(n<0||r==ys(i))){let g=i.childNodes[r-1],b=g.nodeType==3?zo(g,ys(g)-(u?0:1)):g.nodeType==1&&(g.nodeName!="BR"||!g.nextSibling)?g:null;if(b)return Ih(_a(b,1),!1)}if(a==null&&r<ys(i)){let g=i.childNodes[r];for(;g.pmViewDesc&&g.pmViewDesc.ignoreForCoords;)g=g.nextSibling;let b=g?g.nodeType==3?zo(g,0,u?0:1):g.nodeType==1?g:null:null;if(b)return Ih(_a(b,-1),!0)}return Ih(_a(i.nodeType==3?zo(i):i,-n),n>=0)}function Ih(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Zy(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Qw(t,e,n){let i=t.state,r=t.root.activeElement;i!=e&&t.updateState(e),r!=t.dom&&t.focus();try{return n()}finally{i!=e&&t.updateState(i),r!=t.dom&&r&&r.focus()}}function X5(t,e,n){let i=e.selection,r=n=="up"?i.$from:i.$to;return Qw(t,e,()=>{let{node:a}=t.docView.domFromPos(r.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(a,!0);if(!l)break;if(l.node.isBlock){a=l.contentDOM||l.dom;break}a=l.dom.parentNode}let u=Jw(t,r.pos,1);for(let l=a.firstChild;l;l=l.nextSibling){let g;if(l.nodeType==1)g=l.getClientRects();else if(l.nodeType==3)g=zo(l,0,l.nodeValue.length).getClientRects();else continue;for(let b=0;b<g.length;b++){let S=g[b];if(S.bottom>S.top+1&&(n=="up"?u.top-S.top>(S.bottom-u.top)*2:S.bottom-u.bottom>(u.bottom-S.top)*2))return!1}}return!0})}const K5=/[\u0590-\u08ac]/;function J5(t,e,n){let{$head:i}=e.selection;if(!i.parent.isTextblock)return!1;let r=i.parentOffset,a=!r,u=r==i.parent.content.size,l=t.domSelection();return l?!K5.test(i.parent.textContent)||!l.modify?n=="left"||n=="backward"?a:u:Qw(t,e,()=>{let{focusNode:g,focusOffset:b,anchorNode:S,anchorOffset:E}=t.domSelectionRange(),C=l.caretBidiLevel;l.modify("move",n,"character");let P=i.depth?t.docView.domAfterPos(i.before()):t.dom,{focusNode:D,focusOffset:R}=t.domSelectionRange(),j=D&&!P.contains(D.nodeType==1?D:D.parentNode)||g==D&&b==R;try{l.collapse(S,E),g&&(g!=S||b!=E)&&l.extend&&l.extend(g,b)}catch{}return C!=null&&(l.caretBidiLevel=C),j}):i.pos==i.start()||i.pos==i.end()}let ek=null,tk=null,nk=!1;function Q5(t,e,n){return ek==e&&tk==n?nk:(ek=e,tk=n,nk=n=="up"||n=="down"?X5(t,e,n):J5(t,e,n))}const bs=0,ik=1,Ml=2,so=3;class Ph{constructor(e,n,i,r){this.parent=e,this.children=n,this.dom=i,this.contentDOM=r,this.dirty=bs,i.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,i){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,i=this.posAtStart;;n++){let r=this.children[n];if(r==e)return i;i+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,i){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(i<0){let a,u;if(e==this.contentDOM)a=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;a=e.previousSibling}for(;a&&!((u=a.pmViewDesc)&&u.parent==this);)a=a.previousSibling;return a?this.posBeforeChild(u)+u.size:this.posAtStart}else{let a,u;if(e==this.contentDOM)a=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;a=e.nextSibling}for(;a&&!((u=a.pmViewDesc)&&u.parent==this);)a=a.nextSibling;return a?this.posBeforeChild(u):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=n>$i(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let a=e;;a=a.parentNode){if(a==this.dom){r=!1;break}if(a.previousSibling)break}if(r==null&&n==e.childNodes.length)for(let a=e;;a=a.parentNode){if(a==this.dom){r=!0;break}if(a.nextSibling)break}}return r??i>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let i=!0,r=e;r;r=r.parentNode){let a=this.getDesc(r),u;if(a&&(!n||a.node))if(i&&(u=a.nodeDOM)&&!(u.nodeType==1?u.contains(e.nodeType==1?e:e.parentNode):u==e))i=!1;else return a}}getDesc(e){let n=e.pmViewDesc;for(let i=n;i;i=i.parent)if(i==this)return n}posFromDOM(e,n,i){for(let r=e;r;r=r.parentNode){let a=this.getDesc(r);if(a)return a.localPosFromDOM(e,n,i)}return-1}descAt(e){for(let n=0,i=0;n<this.children.length;n++){let r=this.children[n],a=i+r.size;if(i==e&&a!=i){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<a)return r.descAt(e-i-r.border);i=a}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let i=0,r=0;for(let a=0;i<this.children.length;i++){let u=this.children[i],l=a+u.size;if(l>e||u instanceof ok){r=e-a;break}a=l}if(r)return this.children[i].domFromPos(r-this.children[i].border,n);for(let a;i&&!(a=this.children[i-1]).size&&a instanceof rk&&a.side>=0;i--);if(n<=0){let a,u=!0;for(;a=i?this.children[i-1]:null,!(!a||a.dom.parentNode==this.contentDOM);i--,u=!1);return a&&n&&u&&!a.border&&!a.domAtom?a.domFromPos(a.size,n):{node:this.contentDOM,offset:a?$i(a.dom)+1:0}}else{let a,u=!0;for(;a=i<this.children.length?this.children[i]:null,!(!a||a.dom.parentNode==this.contentDOM);i++,u=!1);return a&&u&&!a.border&&!a.domAtom?a.domFromPos(0,n):{node:this.contentDOM,offset:a?$i(a.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,i=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,a=-1;for(let u=i,l=0;;l++){let g=this.children[l],b=u+g.size;if(r==-1&&e<=b){let S=u+g.border;if(e>=S&&n<=b-g.border&&g.node&&g.contentDOM&&this.contentDOM.contains(g.contentDOM))return g.parseRange(e,n,S);e=u;for(let E=l;E>0;E--){let C=this.children[E-1];if(C.size&&C.dom.parentNode==this.contentDOM&&!C.emptyChildAt(1)){r=$i(C.dom)+1;break}e-=C.size}r==-1&&(r=0)}if(r>-1&&(b>n||l==this.children.length-1)){n=b;for(let S=l+1;S<this.children.length;S++){let E=this.children[S];if(E.size&&E.dom.parentNode==this.contentDOM&&!E.emptyChildAt(-1)){a=$i(E.dom);break}n+=E.size}a==-1&&(a=this.contentDOM.childNodes.length);break}u=b}return{node:this.contentDOM,from:e,to:n,fromOffset:r,toOffset:a}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:i}=this.domFromPos(e,0);if(n.nodeType!=1||i==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[i]}setSelection(e,n,i,r=!1){let a=Math.min(e,n),u=Math.max(e,n);for(let C=0,P=0;C<this.children.length;C++){let D=this.children[C],R=P+D.size;if(a>P&&u<R)return D.setSelection(e-P-D.border,n-P-D.border,i,r);P=R}let l=this.domFromPos(e,e?-1:1),g=n==e?l:this.domFromPos(n,n?-1:1),b=i.getSelection(),S=!1;if(($s||ur)&&e==n){let{node:C,offset:P}=l;if(C.nodeType==3){if(S=!!(P&&C.nodeValue[P-1]==`
|
634
634
|
`),S&&P==C.nodeValue.length)for(let D=C,R;D;D=D.parentNode){if(R=D.nextSibling){R.nodeName=="BR"&&(l=g={node:R.parentNode,offset:$i(R)+1});break}let j=D.pmViewDesc;if(j&&j.node&&j.node.isBlock)break}}else{let D=C.childNodes[P-1];S=D&&(D.nodeName=="BR"||D.contentEditable=="false")}}if($s&&b.focusNode&&b.focusNode!=g.node&&b.focusNode.nodeType==1){let C=b.focusNode.childNodes[b.focusOffset];C&&C.contentEditable=="false"&&(r=!0)}if(!(r||S&&ur)&&Cl(l.node,l.offset,b.anchorNode,b.anchorOffset)&&Cl(g.node,g.offset,b.focusNode,b.focusOffset))return;let E=!1;if((b.extend||e==n)&&!S){b.collapse(l.node,l.offset);try{e!=n&&b.extend(g.node,g.offset),E=!0}catch{}}if(!E){if(e>n){let P=l;l=g,g=P}let C=document.createRange();C.setEnd(g.node,g.offset),C.setStart(l.node,l.offset),b.removeAllRanges(),b.addRange(C)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let i=0,r=0;r<this.children.length;r++){let a=this.children[r],u=i+a.size;if(i==u?e<=u&&n>=i:e<u&&n>i){let l=i+a.border,g=u-a.border;if(e>=l&&n<=g){this.dirty=e==i||n==u?Ml:ik,e==l&&n==g&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=so:a.markDirty(e-l,n-l);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?Ml:so}i=u}this.dirty=Ml}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let i=e==1?Ml:ik;n.dirty<i&&(n.dirty=i)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class rk extends Ph{constructor(e,n,i,r){let a,u=n.type.toDOM;if(typeof u=="function"&&(u=u(i,()=>{if(!a)return r;if(a.parent)return a.parent.posBeforeChild(a)})),!n.type.spec.raw){if(u.nodeType!=1){let l=document.createElement("span");l.appendChild(u),u=l}u.contentEditable="false",u.classList.add("ProseMirror-widget")}super(e,[],u,null),this.widget=n,this.widget=n,a=this}matchesWidget(e){return this.dirty==bs&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class eR extends Ph{constructor(e,n,i,r){super(e,[],n,null),this.textDOM=i,this.text=r}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Al extends Ph{constructor(e,n,i,r){super(e,[],i,r),this.mark=n}static create(e,n,i,r){let a=r.nodeViews[n.type.name],u=a&&a(n,r,i);return(!u||!u.dom)&&(u=El.renderSpec(document,n.type.spec.toDOM(n,i),null,n.attrs)),new Al(e,n,u.dom,u.contentDOM||u.dom)}parseRule(){return this.dirty&so||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=so&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=bs){let i=this.parent;for(;!i.node;)i=i.parent;i.dirty<this.dirty&&(i.dirty=this.dirty),this.dirty=bs}}slice(e,n,i){let r=Al.create(this.parent,this.mark,!0,i),a=this.children,u=this.size;n<u&&(a=Xy(a,n,u,i)),e>0&&(a=Xy(a,0,e,i));for(let l=0;l<a.length;l++)a[l].parent=r;return r.children=a,r}}class ba extends Ph{constructor(e,n,i,r,a,u,l,g,b){super(e,[],a,u),this.node=n,this.outerDeco=i,this.innerDeco=r,this.nodeDOM=l}static create(e,n,i,r,a,u){let l=a.nodeViews[n.type.name],g,b=l&&l(n,a,()=>{if(!g)return u;if(g.parent)return g.parent.posBeforeChild(g)},i,r),S=b&&b.dom,E=b&&b.contentDOM;if(n.isText){if(!S)S=document.createTextNode(n.text);else if(S.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else S||({dom:S,contentDOM:E}=El.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!E&&!n.isText&&S.nodeName!="BR"&&(S.hasAttribute("contenteditable")||(S.contentEditable="false"),n.type.spec.draggable&&(S.draggable=!0));let C=S;return S=ck(S,i,n),b?g=new tR(e,n,i,r,S,E||null,C,b,a,u+1):n.isText?new wf(e,n,i,r,S,C,a):new ba(e,n,i,r,S,E||null,C,a,u+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let i=this.children[n];if(this.dom.contains(i.dom.parentNode)){e.contentElement=i.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Fe.empty)}return e}matchesNode(e,n,i){return this.dirty==bs&&e.eq(this.node)&&kf(n,this.outerDeco)&&i.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let i=this.node.inlineContent,r=n,a=e.composing?this.localCompositionInfo(e,n):null,u=a&&a.pos>-1?a:null,l=a&&a.pos<0,g=new iR(this,u&&u.node,e);oR(this.node,this.innerDeco,(b,S,E)=>{b.spec.marks?g.syncToMarks(b.spec.marks,i,e):b.type.side>=0&&!E&&g.syncToMarks(S==this.node.childCount?Hn.none:this.node.child(S).marks,i,e),g.placeWidget(b,e,r)},(b,S,E,C)=>{g.syncToMarks(b.marks,i,e);let P;g.findNodeMatch(b,S,E,C)||l&&e.state.selection.from>r&&e.state.selection.to<r+b.nodeSize&&(P=g.findIndexWithChild(a.node))>-1&&g.updateNodeAt(b,S,E,P,e)||g.updateNextNode(b,S,E,e,C,r)||g.addNode(b,S,E,e,r),r+=b.nodeSize}),g.syncToMarks([],i,e),this.node.isTextblock&&g.addTextblockHacks(),g.destroyRest(),(g.changed||this.dirty==Ml)&&(u&&this.protectLocalComposition(e,u),ak(this.contentDOM,this.children,e),Vc&&aR(this.dom))}localCompositionInfo(e,n){let{from:i,to:r}=e.state.selection;if(!(e.state.selection instanceof Vt)||i<n||r>n+this.node.content.size)return null;let a=e.input.compositionNode;if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){let u=a.nodeValue,l=lR(this.node.content,u,i-n,r-n);return l<0?null:{node:a,pos:l,text:u}}else return{node:a,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:i,text:r}){if(this.getDesc(n))return;let a=n;for(;a.parentNode!=this.contentDOM;a=a.parentNode){for(;a.previousSibling;)a.parentNode.removeChild(a.previousSibling);for(;a.nextSibling;)a.parentNode.removeChild(a.nextSibling);a.pmViewDesc&&(a.pmViewDesc=void 0)}let u=new eR(this,a,n,r);e.input.compositionNodes.push(u),this.children=Xy(this.children,i,i+r.length,e,u)}update(e,n,i,r){return this.dirty==so||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,i,r),!0)}updateInner(e,n,i,r){this.updateOuterDeco(n),this.node=e,this.innerDeco=i,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=bs}updateOuterDeco(e){if(kf(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,i=this.dom;this.dom=lk(this.dom,this.nodeDOM,Yy(this.outerDeco,this.node,n),Yy(e,this.node,n)),this.dom!=i&&(i.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function sk(t,e,n,i,r){ck(i,e,t);let a=new ba(void 0,t,e,n,i,i,i,r,0);return a.contentDOM&&a.updateChildren(r,0),a}class wf extends ba{constructor(e,n,i,r,a,u,l){super(e,n,i,r,a,null,u,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,i,r){return this.dirty==so||this.dirty!=bs&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=bs||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=bs,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,i){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,i)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,i){let r=this.node.cut(e,n),a=document.createTextNode(r.text);return new wf(this.parent,r,this.outerDeco,this.innerDeco,a,a,i)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=so)}get domAtom(){return!1}isText(e){return this.node.text==e}}class ok extends Ph{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==bs&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class tR extends ba{constructor(e,n,i,r,a,u,l,g,b,S){super(e,n,i,r,a,u,l,b,S),this.spec=g}update(e,n,i,r){if(this.dirty==so)return!1;if(this.spec.update){let a=this.spec.update(e,n,i);return a&&this.updateInner(e,n,i,r),a}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,i,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,i,r){this.spec.setSelection?this.spec.setSelection(e,n,i):super.setSelection(e,n,i,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function ak(t,e,n){let i=t.firstChild,r=!1;for(let a=0;a<e.length;a++){let u=e[a],l=u.dom;if(l.parentNode==t){for(;l!=i;)i=uk(i),r=!0;i=i.nextSibling}else r=!0,t.insertBefore(l,i);if(u instanceof Al){let g=i?i.previousSibling:t.lastChild;ak(u.contentDOM,u.children,n),i=g?g.nextSibling:t.firstChild}}for(;i;)i=uk(i),r=!0;r&&n.trackWrites==t&&(n.trackWrites=null)}const Dh=function(t){t&&(this.nodeName=t)};Dh.prototype=Object.create(null);const Il=[new Dh];function Yy(t,e,n){if(t.length==0)return Il;let i=n?Il[0]:new Dh,r=[i];for(let a=0;a<t.length;a++){let u=t[a].type.attrs;if(u){u.nodeName&&r.push(i=new Dh(u.nodeName));for(let l in u){let g=u[l];g!=null&&(n&&r.length==1&&r.push(i=new Dh(e.isInline?"span":"div")),l=="class"?i.class=(i.class?i.class+" ":"")+g:l=="style"?i.style=(i.style?i.style+";":"")+g:l!="nodeName"&&(i[l]=g))}}}return r}function lk(t,e,n,i){if(n==Il&&i==Il)return e;let r=e;for(let a=0;a<i.length;a++){let u=i[a],l=n[a];if(a){let g;l&&l.nodeName==u.nodeName&&r!=t&&(g=r.parentNode)&&g.nodeName.toLowerCase()==u.nodeName||(g=document.createElement(u.nodeName),g.pmIsDeco=!0,g.appendChild(r),l=Il[0]),r=g}nR(r,l||Il[0],u)}return r}function nR(t,e,n){for(let i in e)i!="class"&&i!="style"&&i!="nodeName"&&!(i in n)&&t.removeAttribute(i);for(let i in n)i!="class"&&i!="style"&&i!="nodeName"&&n[i]!=e[i]&&t.setAttribute(i,n[i]);if(e.class!=n.class){let i=e.class?e.class.split(" ").filter(Boolean):[],r=n.class?n.class.split(" ").filter(Boolean):[];for(let a=0;a<i.length;a++)r.indexOf(i[a])==-1&&t.classList.remove(i[a]);for(let a=0;a<r.length;a++)i.indexOf(r[a])==-1&&t.classList.add(r[a]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let i=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=i.exec(e.style);)t.style.removeProperty(r[1])}n.style&&(t.style.cssText+=n.style)}}function ck(t,e,n){return lk(t,t,Il,Yy(e,n,t.nodeType!=1))}function kf(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function uk(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class iR{constructor(e,n,i){this.lock=n,this.view=i,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=rR(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let i=e;i<n;i++)this.top.children[i].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,i){let r=0,a=this.stack.length>>1,u=Math.min(a,e.length);for(;r<u&&(r==a-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&e[r].type.spec.spanning!==!1;)r++;for(;r<a;)this.destroyRest(),this.top.dirty=bs,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let g=this.index;g<Math.min(this.index+3,this.top.children.length);g++){let b=this.top.children[g];if(b.matchesMark(e[a])&&!this.isLocked(b.dom)){l=g;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let g=Al.create(this.top,e[a],n,i);this.top.children.splice(this.index,0,g),this.top=g,this.changed=!0}this.index=0,a++}}findNodeMatch(e,n,i,r){let a=-1,u;if(r>=this.preMatch.index&&(u=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&u.matchesNode(e,n,i))a=this.top.children.indexOf(u,this.index);else for(let l=this.index,g=Math.min(this.top.children.length,l+5);l<g;l++){let b=this.top.children[l];if(b.matchesNode(e,n,i)&&!this.preMatch.matched.has(b)){a=l;break}}return a<0?!1:(this.destroyBetween(this.index,a),this.index++,!0)}updateNodeAt(e,n,i,r,a){let u=this.top.children[r];return u.dirty==so&&u.dom==u.contentDOM&&(u.dirty=Ml),u.update(e,n,i,a)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let i=e.pmViewDesc;if(i){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==i)return r}return-1}e=n}}updateNextNode(e,n,i,r,a,u){for(let l=this.index;l<this.top.children.length;l++){let g=this.top.children[l];if(g instanceof ba){let b=this.preMatch.matched.get(g);if(b!=null&&b!=a)return!1;let S=g.dom,E,C=this.isLocked(S)&&!(e.isText&&g.node&&g.node.isText&&g.nodeDOM.nodeValue==e.text&&g.dirty!=so&&kf(n,g.outerDeco));if(!C&&g.update(e,n,i,r))return this.destroyBetween(this.index,l),g.dom!=S&&(this.changed=!0),this.index++,!0;if(!C&&(E=this.recreateWrapper(g,e,n,i,r,u)))return this.destroyBetween(this.index,l),this.top.children[this.index]=E,E.contentDOM&&(E.dirty=Ml,E.updateChildren(r,u+1),E.dirty=bs),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,i,r,a,u){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!kf(i,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=ba.create(this.top,n,i,r,a,u);if(l.contentDOM){l.children=e.children,e.children=[];for(let g of l.children)g.parent=l}return e.destroy(),l}addNode(e,n,i,r,a){let u=ba.create(this.top,e,n,i,r,a);u.contentDOM&&u.updateChildren(r,a+1),this.top.children.splice(this.index++,0,u),this.changed=!0}placeWidget(e,n,i){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let a=new rk(this.top,e,n,i);this.top.children.splice(this.index++,0,a),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Al;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof wf)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ur||Qi)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let i=document.createElement(e);e=="IMG"&&(i.className="ProseMirror-separator",i.alt=""),e=="BR"&&(i.className="ProseMirror-trailingBreak");let r=new ok(this.top,[],i,null);n!=this.top?n.children.push(r):n.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function rR(t,e){let n=e,i=n.children.length,r=t.childCount,a=new Map,u=[];e:for(;r>0;){let l;for(;;)if(i){let b=n.children[i-1];if(b instanceof Al)n=b,i=b.children.length;else{l=b,i--;break}}else{if(n==e)break e;i=n.parent.children.indexOf(n),n=n.parent}let g=l.node;if(g){if(g!=t.child(r-1))break;--r,a.set(l,r),u.push(l)}}return{index:r,matched:a,matches:u.reverse()}}function sR(t,e){return t.type.side-e.type.side}function oR(t,e,n,i){let r=e.locals(t),a=0;if(r.length==0){for(let b=0;b<t.childCount;b++){let S=t.child(b);i(S,r,e.forChild(a,S),b),a+=S.nodeSize}return}let u=0,l=[],g=null;for(let b=0;;){let S,E;for(;u<r.length&&r[u].to==a;){let j=r[u++];j.widget&&(S?(E||(E=[S])).push(j):S=j)}if(S)if(E){E.sort(sR);for(let j=0;j<E.length;j++)n(E[j],b,!!g)}else n(S,b,!!g);let C,P;if(g)P=-1,C=g,g=null;else if(b<t.childCount)P=b,C=t.child(b++);else break;for(let j=0;j<l.length;j++)l[j].to<=a&&l.splice(j--,1);for(;u<r.length&&r[u].from<=a&&r[u].to>a;)l.push(r[u++]);let D=a+C.nodeSize;if(C.isText){let j=D;u<r.length&&r[u].from<j&&(j=r[u].from);for(let W=0;W<l.length;W++)l[W].to<j&&(j=l[W].to);j<D&&(g=C.cut(j-a),C=C.cut(0,j-a),D=j,P=-1)}else for(;u<r.length&&r[u].to<D;)u++;let R=C.isInline&&!C.isLeaf?l.filter(j=>!j.inline):l.slice();i(C,R,e.forChild(a,C),P),a=D}}function aR(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function lR(t,e,n,i){for(let r=0,a=0;r<t.childCount&&a<=i;){let u=t.child(r++),l=a;if(a+=u.nodeSize,!u.isText)continue;let g=u.text;for(;r<t.childCount;){let b=t.child(r++);if(a+=b.nodeSize,!b.isText)break;g+=b.text}if(a>=n){if(a>=i&&g.slice(i-e.length-l,i-l)==e)return i-e.length;let b=l<i?g.lastIndexOf(e,i-l-1):-1;if(b>=0&&b+e.length+l>=n)return l+b;if(n==i&&g.length>=i+e.length-l&&g.slice(i-l,i-l+e.length)==e)return i}}return-1}function Xy(t,e,n,i,r){let a=[];for(let u=0,l=0;u<t.length;u++){let g=t[u],b=l,S=l+=g.size;b>=n||S<=e?a.push(g):(b<e&&a.push(g.slice(0,e-b,i)),r&&(a.push(r),r=void 0),S>n&&a.push(g.slice(n-b,g.size,i)))}return a}function Ky(t,e=null){let n=t.domSelectionRange(),i=t.state.doc;if(!n.focusNode)return null;let r=t.docView.nearestDesc(n.focusNode),a=r&&r.size==0,u=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(u<0)return null;let l=i.resolve(u),g,b;if(vf(n)){for(g=u;r&&!r.node;)r=r.parent;let E=r.node;if(r&&E.isAtom&&Ot.isSelectable(E)&&r.parent&&!(E.isInline&&z5(n.focusNode,n.focusOffset,r.dom))){let C=r.posBefore;b=new Ot(u==C?l:i.resolve(C))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let E=u,C=u;for(let P=0;P<n.rangeCount;P++){let D=n.getRangeAt(P);E=Math.min(E,t.docView.posFromDOM(D.startContainer,D.startOffset,1)),C=Math.max(C,t.docView.posFromDOM(D.endContainer,D.endOffset,-1))}if(E<0)return null;[g,u]=C==t.state.selection.anchor?[C,E]:[E,C],l=i.resolve(u)}else g=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(g<0)return null}let S=i.resolve(g);if(!b){let E=e=="pointer"||t.state.selection.head<l.pos&&!a?1:-1;b=Qy(t,S,l,E)}return b}function hk(t){return t.editable?t.hasFocus():_k(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function No(t,e=!1){let n=t.state.selection;if(mk(t,n),!!hk(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Qi){let i=t.domSelectionRange(),r=t.domObserver.currentSelection;if(i.anchorNode&&r.anchorNode&&Cl(i.anchorNode,i.anchorOffset,r.anchorNode,r.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)uR(t);else{let{anchor:i,head:r}=n,a,u;dk&&!(n instanceof Vt)&&(n.$from.parent.inlineContent||(a=pk(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(u=pk(t,n.to))),t.docView.setSelection(i,r,t.root,e),dk&&(a&&fk(a),u&&fk(u)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&cR(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const dk=ur||Qi&&qw<63;function pk(t,e){let{node:n,offset:i}=t.docView.domFromPos(e,0),r=i<n.childNodes.length?n.childNodes[i]:null,a=i?n.childNodes[i-1]:null;if(ur&&r&&r.contentEditable=="false")return Jy(r);if((!r||r.contentEditable=="false")&&(!a||a.contentEditable=="false")){if(r)return Jy(r);if(a)return Jy(a)}}function Jy(t){return t.contentEditable="true",ur&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function fk(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function cR(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),i=n.anchorNode,r=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=i||n.anchorOffset!=r)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!hk(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function uR(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let i=t.cursorWrapper.dom,r=i.nodeName=="IMG";r?n.setStart(i.parentNode,$i(i)+1):n.setStart(i,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!r&&!t.state.selection.visible&&Ir&&ya<=11&&(i.disabled=!0,i.disabled=!1)}function mk(t,e){if(e instanceof Ot){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(gk(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else gk(t)}function gk(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Qy(t,e,n,i){return t.someProp("createSelectionBetween",r=>r(t,e,n))||Vt.between(e,n,i)}function yk(t){return t.editable&&!t.hasFocus()?!1:_k(t)}function _k(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function hR(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Cl(e.node,e.offset,n.anchorNode,n.anchorOffset)}function e0(t,e){let{$anchor:n,$head:i}=t.selection,r=e>0?n.max(i):n.min(i),a=r.parent.inlineContent?r.depth?t.doc.resolve(e>0?r.after():r.before()):null:r;return a&&Gt.findFrom(a,e)}function xa(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function bk(t,e,n){let i=t.state.selection;if(i instanceof Vt)if(n.indexOf("s")>-1){let{$head:r}=i,a=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let u=t.state.doc.resolve(r.pos+a.nodeSize*(e<0?-1:1));return xa(t,new Vt(i.$anchor,u))}else if(i.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let r=e0(t.state,e);return r&&r instanceof Ot?xa(t,r):!1}else if(!(_s&&n.indexOf("m")>-1)){let r=i.$head,a=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,u;if(!a||a.isText)return!1;let l=e<0?r.pos-a.nodeSize:r.pos;return a.isAtom||(u=t.docView.descAt(l))&&!u.contentDOM?Ot.isSelectable(a)?xa(t,new Ot(e<0?t.state.doc.resolve(r.pos-a.nodeSize):r)):Ah?xa(t,new Vt(t.state.doc.resolve(e<0?l:l+a.nodeSize))):!1:!1}}else return!1;else{if(i instanceof Ot&&i.node.isInline)return xa(t,new Vt(e>0?i.$to:i.$from));{let r=e0(t.state,e);return r?xa(t,r):!1}}}function Sf(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Oh(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function $c(t,e){return e<0?dR(t):pR(t)}function dR(t){let e=t.domSelectionRange(),n=e.focusNode,i=e.focusOffset;if(!n)return;let r,a,u=!1;for($s&&n.nodeType==1&&i<Sf(n)&&Oh(n.childNodes[i],-1)&&(u=!0);;)if(i>0){if(n.nodeType!=1)break;{let l=n.childNodes[i-1];if(Oh(l,-1))r=n,a=--i;else if(l.nodeType==3)n=l,i=n.nodeValue.length;else break}}else{if(xk(n))break;{let l=n.previousSibling;for(;l&&Oh(l,-1);)r=n.parentNode,a=$i(l),l=l.previousSibling;if(l)n=l,i=Sf(n);else{if(n=n.parentNode,n==t.dom)break;i=0}}}u?t0(t,n,i):r&&t0(t,r,a)}function pR(t){let e=t.domSelectionRange(),n=e.focusNode,i=e.focusOffset;if(!n)return;let r=Sf(n),a,u;for(;;)if(i<r){if(n.nodeType!=1)break;let l=n.childNodes[i];if(Oh(l,1))a=n,u=++i;else break}else{if(xk(n))break;{let l=n.nextSibling;for(;l&&Oh(l,1);)a=l.parentNode,u=$i(l)+1,l=l.nextSibling;if(l)n=l,i=0,r=Sf(n);else{if(n=n.parentNode,n==t.dom)break;i=r=0}}}a&&t0(t,a,u)}function xk(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function fR(t,e){for(;t&&e==t.childNodes.length&&!Mh(t);)e=$i(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function mR(t,e){for(;t&&!e&&!Mh(t);)e=$i(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function t0(t,e,n){if(e.nodeType!=3){let a,u;(u=fR(e,n))?(e=u,n=0):(a=mR(e,n))&&(e=a,n=a.nodeValue.length)}let i=t.domSelection();if(!i)return;if(vf(i)){let a=document.createRange();a.setEnd(e,n),a.setStart(e,n),i.removeAllRanges(),i.addRange(a)}else i.extend&&i.extend(e,n);t.domObserver.setCurSelection();let{state:r}=t;setTimeout(()=>{t.state==r&&No(t)},50)}function vk(t,e){let n=t.state.doc.resolve(e);if(!(Qi||R5)&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let a=t.coordsAtPos(e-1),u=(a.top+a.bottom)/2;if(u>r.top&&u<r.bottom&&Math.abs(a.left-r.left)>1)return a.left<r.left?"ltr":"rtl"}if(e<n.end()){let a=t.coordsAtPos(e+1),u=(a.top+a.bottom)/2;if(u>r.top&&u<r.bottom&&Math.abs(a.left-r.left)>1)return a.left>r.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function wk(t,e,n){let i=t.state.selection;if(i instanceof Vt&&!i.empty||n.indexOf("s")>-1||_s&&n.indexOf("m")>-1)return!1;let{$from:r,$to:a}=i;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let u=e0(t.state,e);if(u&&u instanceof Ot)return xa(t,u)}if(!r.parent.inlineContent){let u=e<0?r:a,l=i instanceof Fs?Gt.near(u,e):Gt.findFrom(u,e);return l?xa(t,l):!1}return!1}function kk(t,e){if(!(t.state.selection instanceof Vt))return!0;let{$head:n,$anchor:i,empty:r}=t.state.selection;if(!n.sameParent(i))return!0;if(!r)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let a=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let u=t.state.tr;return e<0?u.delete(n.pos-a.nodeSize,n.pos):u.delete(n.pos,n.pos+a.nodeSize),t.dispatch(u),!0}return!1}function Sk(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function gR(t){if(!ur||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let i=e.firstChild;Sk(t,i,"true"),setTimeout(()=>Sk(t,i,"false"),20)}return!1}function yR(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function _R(t,e){let n=e.keyCode,i=yR(e);if(n==8||_s&&n==72&&i=="c")return kk(t,-1)||$c(t,-1);if(n==46&&!e.shiftKey||_s&&n==68&&i=="c")return kk(t,1)||$c(t,1);if(n==13||n==27)return!0;if(n==37||_s&&n==66&&i=="c"){let r=n==37?vk(t,t.state.selection.from)=="ltr"?-1:1:-1;return bk(t,r,i)||$c(t,r)}else if(n==39||_s&&n==70&&i=="c"){let r=n==39?vk(t,t.state.selection.from)=="ltr"?1:-1:1;return bk(t,r,i)||$c(t,r)}else{if(n==38||_s&&n==80&&i=="c")return wk(t,-1,i)||$c(t,-1);if(n==40||_s&&n==78&&i=="c")return gR(t)||wk(t,1,i)||$c(t,1);if(i==(_s?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Ek(t,e){t.someProp("transformCopied",P=>{e=P(e,t)});let n=[],{content:i,openStart:r,openEnd:a}=e;for(;r>1&&a>1&&i.childCount==1&&i.firstChild.childCount==1;){r--,a--;let P=i.firstChild;n.push(P.type.name,P.attrs!=P.type.defaultAttrs?P.attrs:null),i=P.content}let u=t.someProp("clipboardSerializer")||El.fromSchema(t.state.schema),l=Ok(),g=l.createElement("div");g.appendChild(u.serializeFragment(i,{document:l}));let b=g.firstChild,S,E=0;for(;b&&b.nodeType==1&&(S=Pk[b.nodeName.toLowerCase()]);){for(let P=S.length-1;P>=0;P--){let D=l.createElement(S[P]);for(;g.firstChild;)D.appendChild(g.firstChild);g.appendChild(D),E++}b=g.firstChild}b&&b.nodeType==1&&b.setAttribute("data-pm-slice",`${r} ${a}${E?` -${E}`:""} ${JSON.stringify(n)}`);let C=t.someProp("clipboardTextSerializer",P=>P(e,t))||e.content.textBetween(0,e.content.size,`
|
635
635
|
|
@@ -738,4 +738,4 @@ img.ProseMirror-separator {
|
|
738
738
|
|
739
739
|
`);return!a||!u?!1:t.chain().command(({tr:l})=>(l.delete(i.pos-2,i.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:i}=e,{$from:r,empty:a}=n;if(!a||r.parent.type!==this.type||!(r.parentOffset===r.parent.nodeSize-2))return!1;const l=r.after();return l===void 0?!1:i.nodeAt(l)?t.commands.command(({tr:b})=>(b.setSelection(Gt.near(i.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[A0({find:yF,type:this.type,getAttributes:t=>({language:t[1]})}),A0({find:_F,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Fi({key:new Ar("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),i=e.clipboardData.getData("vscode-editor-data"),r=i?JSON.parse(i):void 0,a=r==null?void 0:r.mode;if(!n||!a)return!1;const{tr:u,schema:l}=t.state,g=l.text(n.replace(/\r\n?/g,`
|
740
740
|
`));return u.replaceSelectionWith(this.type.create({language:a},g)),u.selection.$from.parent.type!==this.type&&u.setSelection(Vt.near(u.doc.resolve(Math.max(0,u.selection.from-2)))),u.setMeta("paste",!0),t.dispatch(u),!0}}})]}}),bF=xs.create({name:"doc",topNode:!0,content:"block+"});function xF(t={}){return new Fi({view(e){return new vF(e,t)}})}class vF{constructor(e,n){var i;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(i=n.width)!==null&&i!==void 0?i:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let a=u=>{this[r](u)};return e.dom.addEventListener(r,a),{name:r,handler:a}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,i;if(n){let l=e.nodeBefore,g=e.nodeAfter;if(l||g){let b=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(b){let S=b.getBoundingClientRect(),E=l?S.bottom:S.top;l&&g&&(E=(E+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),i={left:S.left,right:S.right,top:E-this.width/2,bottom:E+this.width/2}}}}if(!i){let l=this.editorView.coordsAtPos(this.cursorPos);i={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let r=this.editorView.dom.offsetParent;this.element||(this.element=r.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let a,u;if(!r||r==document.body&&getComputedStyle(r).position=="static")a=-pageXOffset,u=-pageYOffset;else{let l=r.getBoundingClientRect();a=l.left-r.scrollLeft,u=l.top-r.scrollTop}this.element.style.left=i.left-a+"px",this.element.style.top=i.top-u+"px",this.element.style.width=i.right-i.left+"px",this.element.style.height=i.bottom-i.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),i=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),r=i&&i.type.spec.disableDropCursor,a=typeof r=="function"?r(this.editorView,n,e):r;if(n&&!a){let u=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Aw(this.editorView.state.doc,u,this.editorView.dragging.slice);l!=null&&(u=l)}this.setCursor(u),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const wF=Ai.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[xF(this.options)]}});class ri extends Gt{constructor(e){super(e,e)}map(e,n){let i=e.resolve(n.map(this.head));return ri.valid(i)?new ri(i):Gt.near(i)}content(){return dt.empty}eq(e){return e instanceof ri&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ri(e.resolve(n.pos))}getBookmark(){return new Z0(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!kF(e)||!SF(e))return!1;let i=n.type.spec.allowGapCursor;if(i!=null)return i;let r=n.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,n,i=!1){e:for(;;){if(!i&&ri.valid(e))return e;let r=e.pos,a=null;for(let u=e.depth;;u--){let l=e.node(u);if(n>0?e.indexAfter(u)<l.childCount:e.index(u)>0){a=l.child(n>0?e.indexAfter(u):e.index(u)-1);break}else if(u==0)return null;r+=n;let g=e.doc.resolve(r);if(ri.valid(g))return g}for(;;){let u=n>0?a.firstChild:a.lastChild;if(!u){if(a.isAtom&&!a.isText&&!Ot.isSelectable(a)){e=e.doc.resolve(r+a.nodeSize*n),i=!1;continue e}break}a=u,r+=n;let l=e.doc.resolve(r);if(ri.valid(l))return l}return null}}}ri.prototype.visible=!1,ri.findFrom=ri.findGapCursorFrom,Gt.jsonID("gapcursor",ri);class Z0{constructor(e){this.pos=e}map(e){return new Z0(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ri.valid(n)?new ri(n):Gt.near(n)}}function kF(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),i=t.node(e);if(n==0){if(i.type.spec.isolating)return!0;continue}for(let r=i.child(n-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function SF(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),i=t.node(e);if(n==i.childCount){if(i.type.spec.isolating)return!0;continue}for(let r=i.child(n);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function EF(){return new Fi({props:{decorations:AF,createSelectionBetween(t,e,n){return e.pos==n.pos&&ri.valid(n)?new ri(n):null},handleClick:TF,handleKeyDown:CF,handleDOMEvents:{beforeinput:MF}}})}const CF=t2({ArrowLeft:Zf("horiz",-1),ArrowRight:Zf("horiz",1),ArrowUp:Zf("vert",-1),ArrowDown:Zf("vert",1)});function Zf(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(i,r,a){let u=i.selection,l=e>0?u.$to:u.$from,g=u.empty;if(u instanceof Vt){if(!a.endOfTextblock(n)||l.depth==0)return!1;g=!1,l=i.doc.resolve(e>0?l.after():l.before())}let b=ri.findGapCursorFrom(l,e,g);return b?(r&&r(i.tr.setSelection(new ri(b))),!0):!1}}function TF(t,e,n){if(!t||!t.editable)return!1;let i=t.state.doc.resolve(e);if(!ri.valid(i))return!1;let r=t.posAtCoords({left:n.clientX,top:n.clientY});return r&&r.inside>-1&&Ot.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ri(i))),!0)}function MF(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ri))return!1;let{$from:n}=t.state.selection,i=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!i)return!1;let r=Fe.empty;for(let u=i.length-1;u>=0;u--)r=Fe.from(i[u].createAndFill(null,r));let a=t.state.tr.replace(n.pos,n.pos,new dt(r,0,0));return a.setSelection(Vt.near(a.doc.resolve(n.pos+1))),t.dispatch(a),!1}function AF(t){if(!(t.selection instanceof ri))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",pi.create(t.doc,[Zr.widget(t.selection.head,e,{key:"gapcursor"})])}const IF=Ai.create({name:"gapCursor",addProseMirrorPlugins(){return[EF()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=sn(wt(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),PF=xs.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",ci(this.options.HTMLAttributes,t)]},renderText(){return`
|
741
|
-
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:i})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:r,storedMarks:a}=n;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:u}=this.options,{splittableMarks:l}=i.extensionManager,g=a||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:b,dispatch:S})=>{if(S&&g&&u){const E=g.filter(C=>l.includes(C.type.name));b.ensureMarks(E)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),DF=xs.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,ci(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>A0({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Yf=200,Ii=function(){};Ii.prototype.append=function(e){return e.length?(e=Ii.from(e),!this.length&&e||e.length<Yf&&this.leafAppend(e)||this.length<Yf&&e.leafPrepend(this)||this.appendInner(e)):this},Ii.prototype.prepend=function(e){return e.length?Ii.from(e).append(this):this},Ii.prototype.appendInner=function(e){return new OF(this,e)},Ii.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ii.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},Ii.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ii.prototype.forEach=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=this.length),n<=i?this.forEachInner(e,n,i,0):this.forEachInvertedInner(e,n,i,0)},Ii.prototype.map=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=this.length);var r=[];return this.forEach(function(a,u){return r.push(e(a,u))},n,i),r},Ii.from=function(e){return e instanceof Ii?e:e&&e.length?new gS(e):Ii.empty};var gS=function(t){function e(i){t.call(this),this.values=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,a){return r==0&&a==this.length?this:new e(this.values.slice(r,a))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,a,u,l){for(var g=a;g<u;g++)if(r(this.values[g],l+g)===!1)return!1},e.prototype.forEachInvertedInner=function(r,a,u,l){for(var g=a-1;g>=u;g--)if(r(this.values[g],l+g)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=Yf)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=Yf)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Ii);Ii.empty=new gS([]);var OF=function(t){function e(n,i){t.call(this),this.left=n,this.right=i,this.length=n.length+i.length,this.depth=Math.max(n.depth,i.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(i){return i<this.left.length?this.left.get(i):this.right.get(i-this.left.length)},e.prototype.forEachInner=function(i,r,a,u){var l=this.left.length;if(r<l&&this.left.forEachInner(i,r,Math.min(a,l),u)===!1||a>l&&this.right.forEachInner(i,Math.max(r-l,0),Math.min(this.length,a)-l,u+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,r,a,u){var l=this.left.length;if(r>l&&this.right.forEachInvertedInner(i,r-l,Math.max(a,l)-l,u+l)===!1||a<l&&this.left.forEachInvertedInner(i,Math.min(r,l),a,u)===!1)return!1},e.prototype.sliceInner=function(i,r){if(i==0&&r==this.length)return this;var a=this.left.length;return r<=a?this.left.slice(i,r):i>=a?this.right.slice(i-a,r-a):this.left.slice(i,a).append(this.right.slice(0,r-a))},e.prototype.leafAppend=function(i){var r=this.right.leafAppend(i);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(i){var r=this.left.leafPrepend(i);if(r)return new e(r,this.right)},e.prototype.appendInner=function(i){return this.left.depth>=Math.max(this.right.depth,i.depth)+1?new e(this.left,new e(this.right,i)):new e(this,i)},e}(Ii);const zF=500;class Us{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}let r,a;n&&(r=this.remapping(i,this.items.length),a=r.maps.length);let u=e.tr,l,g,b=[],S=[];return this.items.forEach((E,C)=>{if(!E.step){r||(r=this.remapping(i,C+1),a=r.maps.length),a--,S.push(E);return}if(r){S.push(new uo(E.map));let P=E.step.map(r.slice(a)),D;P&&u.maybeStep(P).doc&&(D=u.mapping.maps[u.mapping.maps.length-1],b.push(new uo(D,void 0,void 0,b.length+S.length))),a--,D&&r.appendMap(D,a)}else u.maybeStep(E.step);if(E.selection)return l=r?E.selection.map(r.slice(a)):E.selection,g=new Us(this.items.slice(0,i).append(S.reverse().concat(b)),this.eventCount-1),!1},this.items.length,0),{remaining:g,transform:u,selection:l}}addTransform(e,n,i,r){let a=[],u=this.eventCount,l=this.items,g=!r&&l.length?l.get(l.length-1):null;for(let S=0;S<e.steps.length;S++){let E=e.steps[S].invert(e.docs[S]),C=new uo(e.mapping.maps[S],E,n),P;(P=g&&g.merge(C))&&(C=P,S?a.pop():l=l.slice(0,l.length-1)),a.push(C),n&&(u++,n=void 0),r||(g=C)}let b=u-i.depth;return b>NF&&(l=BF(l,b),u-=b),new Us(l.append(a),u)}remapping(e,n){let i=new Pc;return this.items.forEach((r,a)=>{let u=r.mirrorOffset!=null&&a-r.mirrorOffset>=e?i.maps.length-r.mirrorOffset:void 0;i.appendMap(r.map,u)},e,n),i}addMaps(e){return this.eventCount==0?this:new Us(this.items.append(e.map(n=>new uo(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let i=[],r=Math.max(0,this.items.length-n),a=e.mapping,u=e.steps.length,l=this.eventCount;this.items.forEach(C=>{C.selection&&l--},r);let g=n;this.items.forEach(C=>{let P=a.getMirror(--g);if(P==null)return;u=Math.min(u,P);let D=a.maps[P];if(C.step){let R=e.steps[P].invert(e.docs[P]),j=C.selection&&C.selection.map(a.slice(g+1,P));j&&l++,i.push(new uo(D,R,j))}else i.push(new uo(D))},r);let b=[];for(let C=n;C<u;C++)b.push(new uo(a.maps[C]));let S=this.items.slice(0,r).append(b).append(i),E=new Us(S,l);return E.emptyItemCount()>zF&&(E=E.compress(this.items.length-i.length)),E}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),i=n.maps.length,r=[],a=0;return this.items.forEach((u,l)=>{if(l>=e)r.push(u),u.selection&&a++;else if(u.step){let g=u.step.map(n.slice(i)),b=g&&g.getMap();if(i--,b&&n.appendMap(b,i),g){let S=u.selection&&u.selection.map(n.slice(i));S&&a++;let E=new uo(b.invert(),g,S),C,P=r.length-1;(C=r.length&&r[P].merge(E))?r[P]=C:r.push(E)}}else u.map&&i--},this.items.length,0),new Us(Ii.from(r.reverse()),a)}}Us.empty=new Us(Ii.empty,0);function BF(t,e){let n;return t.forEach((i,r)=>{if(i.selection&&e--==0)return n=r,!1}),t.slice(n)}class uo{constructor(e,n,i,r){this.map=e,this.step=n,this.selection=i,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new uo(n.getMap().invert(),n,this.selection)}}}class Ta{constructor(e,n,i,r,a){this.done=e,this.undone=n,this.prevRanges=i,this.prevTime=r,this.prevComposition=a}}const NF=20;function RF(t,e,n,i){let r=n.getMeta(Rl),a;if(r)return r.historyState;n.getMeta(FF)&&(t=new Ta(t.done,t.undone,null,0,-1));let u=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(u&&u.getMeta(Rl))return u.getMeta(Rl).redo?new Ta(t.done.addTransform(n,void 0,i,Xf(e)),t.undone,yS(n.mapping.maps),t.prevTime,t.prevComposition):new Ta(t.done,t.undone.addTransform(n,void 0,i,Xf(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(u&&u.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),g=t.prevTime==0||!u&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-i.newGroupDelay||!LF(n,t.prevRanges)),b=u?Y0(t.prevRanges,n.mapping):yS(n.mapping.maps);return new Ta(t.done.addTransform(n,g?e.selection.getBookmark():void 0,i,Xf(e)),Us.empty,b,n.time,l??t.prevComposition)}else return(a=n.getMeta("rebased"))?new Ta(t.done.rebased(n,a),t.undone.rebased(n,a),Y0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ta(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Y0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function LF(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((i,r)=>{for(let a=0;a<e.length;a+=2)i<=e[a+1]&&r>=e[a]&&(n=!0)}),n}function yS(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((i,r,a,u)=>e.push(a,u));return e}function Y0(t,e){if(!t)return null;let n=[];for(let i=0;i<t.length;i+=2){let r=e.map(t[i],1),a=e.map(t[i+1],-1);r<=a&&n.push(r,a)}return n}function VF(t,e,n){let i=Xf(e),r=Rl.get(e).spec.config,a=(n?t.undone:t.done).popEvent(e,i);if(!a)return null;let u=a.selection.resolve(a.transform.doc),l=(n?t.done:t.undone).addTransform(a.transform,e.selection.getBookmark(),r,i),g=new Ta(n?l:a.remaining,n?a.remaining:l,null,0,-1);return a.transform.setSelection(u).setMeta(Rl,{redo:n,historyState:g})}let X0=!1,_S=null;function Xf(t){let e=t.plugins;if(_S!=e){X0=!1,_S=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){X0=!0;break}}return X0}const Rl=new Ar("history"),FF=new Ar("closeHistory");function $F(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Fi({key:Rl,state:{init(){return new Ta(Us.empty,Us.empty,null,0,-1)},apply(e,n,i){return RF(n,i,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let i=n.inputType,r=i=="historyUndo"?xS:i=="historyRedo"?vS:null;return r?(n.preventDefault(),r(e.state,e.dispatch)):!1}}}})}function bS(t,e){return(n,i)=>{let r=Rl.getState(n);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(i){let a=VF(r,n,t);a&&i(e?a.scrollIntoView():a)}return!0}}const xS=bS(!1,!0),vS=bS(!0,!0),jF=Ai.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>xS(t,e),redo:()=>({state:t,dispatch:e})=>vS(t,e)}},addProseMirrorPlugins(){return[$F(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),UF=xs.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",ci(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{selection:n}=e,{$from:i,$to:r}=n,a=t();return i.parentOffset===0?a.insertContentAt({from:Math.max(i.pos-1,0),to:r.pos},{type:this.name}):w2(n)?a.insertContentAt(r.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({tr:u,dispatch:l})=>{var g;if(l){const{$to:b}=u.selection,S=b.end();if(b.nodeAfter)b.nodeAfter.isTextblock?u.setSelection(Vt.create(u.doc,b.pos+1)):b.nodeAfter.isBlock?u.setSelection(Ot.create(u.doc,b.pos)):u.setSelection(Vt.create(u.doc,b.pos));else{const E=(g=b.parent.type.contentMatch.defaultType)===null||g===void 0?void 0:g.create();E&&(u.insert(S,E),u.setSelection(Vt.create(u.doc,S+1)))}u.scrollIntoView()}return!0}).run()}}},addInputRules(){return[v4({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),HF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,qF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,WF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,GF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,ZF=oo.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",ci(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Wc({find:HF,type:this.type}),Wc({find:WF,type:this.type})]},addPasteRules(){return[Gc({find:qF,type:this.type}),Gc({find:GF,type:this.type})]}}),wS=/^(\d+)\.\s$/,YF=xs.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",ci(this.options.HTMLAttributes,n),0]:["ol",ci(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(G0.name,this.editor.getAttributes(Yh.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Lh({find:wS,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Lh({find:wS,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Yh.name)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),XF=xs.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",ci(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),KF=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,JF=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,QF=oo.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",ci(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Wc({find:KF,type:this.type})]},addPasteRules(){return[Gc({find:JF,type:this.type})]}}),kS=xs.create({name:"text",group:"inline"}),e6=Ai.create({name:"starterKit",addExtensions(){var t,e,n,i,r,a,u,l,g,b,S,E,C,P,D,R,j,W;const ee=[];return this.options.bold!==!1&&ee.push(dF.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&ee.push(aF.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&ee.push(pF.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&ee.push(gF.configure((i=this.options)===null||i===void 0?void 0:i.code)),this.options.codeBlock!==!1&&ee.push(mS.configure((r=this.options)===null||r===void 0?void 0:r.codeBlock)),this.options.document!==!1&&ee.push(bF.configure((a=this.options)===null||a===void 0?void 0:a.document)),this.options.dropcursor!==!1&&ee.push(wF.configure((u=this.options)===null||u===void 0?void 0:u.dropcursor)),this.options.gapcursor!==!1&&ee.push(IF.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&ee.push(PF.configure((g=this.options)===null||g===void 0?void 0:g.hardBreak)),this.options.heading!==!1&&ee.push(DF.configure((b=this.options)===null||b===void 0?void 0:b.heading)),this.options.history!==!1&&ee.push(jF.configure((S=this.options)===null||S===void 0?void 0:S.history)),this.options.horizontalRule!==!1&&ee.push(UF.configure((E=this.options)===null||E===void 0?void 0:E.horizontalRule)),this.options.italic!==!1&&ee.push(ZF.configure((C=this.options)===null||C===void 0?void 0:C.italic)),this.options.listItem!==!1&&ee.push(G0.configure((P=this.options)===null||P===void 0?void 0:P.listItem)),this.options.orderedList!==!1&&ee.push(YF.configure((D=this.options)===null||D===void 0?void 0:D.orderedList)),this.options.paragraph!==!1&&ee.push(XF.configure((R=this.options)===null||R===void 0?void 0:R.paragraph)),this.options.strike!==!1&&ee.push(QF.configure((j=this.options)===null||j===void 0?void 0:j.strike)),this.options.text!==!1&&ee.push(kS.configure((W=this.options)===null||W===void 0?void 0:W.text)),ee}}),t6=Ai.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;return(e=t.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}});function n6(t){var e;const{char:n,allowSpaces:i,allowedPrefixes:r,startOfLine:a,$position:u}=t,l=w4(n),g=new RegExp(`\\s${l}$`),b=a?"^":"",S=i?new RegExp(`${b}${l}.*?(?=\\s${l}|$)`,"gm"):new RegExp(`${b}(?:^)?${l}[^\\s${l}]*`,"gm"),E=((e=u.nodeBefore)===null||e===void 0?void 0:e.isText)&&u.nodeBefore.text;if(!E)return null;const C=u.pos-E.length,P=Array.from(E.matchAll(S)).pop();if(!P||P.input===void 0||P.index===void 0)return null;const D=P.input.slice(Math.max(0,P.index-1),P.index),R=new RegExp(`^[${r==null?void 0:r.join("")}\0]?$`).test(D);if(r!==null&&!R)return null;const j=C+P.index;let W=j+P[0].length;return i&&g.test(E.slice(W-1,W+1))&&(P[0]+=" ",W+=1),j<u.pos&&W>=u.pos?{range:{from:j,to:W},query:P[0].slice(n.length),text:P[0]}:null}const i6=new Ar("suggestion");function r6({pluginKey:t=i6,editor:e,char:n="@",allowSpaces:i=!1,allowedPrefixes:r=[" "],startOfLine:a=!1,decorationTag:u="span",decorationClass:l="suggestion",command:g=()=>null,items:b=()=>[],render:S=()=>({}),allow:E=()=>!0,findSuggestionMatch:C=n6}){let P;const D=S==null?void 0:S(),R=new Fi({key:t,view(){return{update:async(j,W)=>{var ee,le,J,Te,xe,Ae,je;const De=(ee=this.key)===null||ee===void 0?void 0:ee.getState(W),Ke=(le=this.key)===null||le===void 0?void 0:le.getState(j.state),rt=De.active&&Ke.active&&De.range.from!==Ke.range.from,Rt=!De.active&&Ke.active,pt=De.active&&!Ke.active,zt=!Rt&&!pt&&De.query!==Ke.query,Xt=Rt||rt&&zt,on=zt||rt,$t=pt||rt&&zt;if(!Xt&&!on&&!$t)return;const Kt=$t&&!Xt?De:Ke,Cn=j.dom.querySelector(`[data-decoration-id="${Kt.decorationId}"]`);P={editor:e,range:Kt.range,query:Kt.query,text:Kt.text,items:[],command:dn=>g({editor:e,range:Kt.range,props:dn}),decorationNode:Cn,clientRect:Cn?()=>{var dn;const{decorationId:vn}=(dn=this.key)===null||dn===void 0?void 0:dn.getState(e.state),pn=j.dom.querySelector(`[data-decoration-id="${vn}"]`);return(pn==null?void 0:pn.getBoundingClientRect())||null}:null},Xt&&((J=D==null?void 0:D.onBeforeStart)===null||J===void 0||J.call(D,P)),on&&((Te=D==null?void 0:D.onBeforeUpdate)===null||Te===void 0||Te.call(D,P)),(on||Xt)&&(P.items=await b({editor:e,query:Kt.query})),$t&&((xe=D==null?void 0:D.onExit)===null||xe===void 0||xe.call(D,P)),on&&((Ae=D==null?void 0:D.onUpdate)===null||Ae===void 0||Ae.call(D,P)),Xt&&((je=D==null?void 0:D.onStart)===null||je===void 0||je.call(D,P))},destroy:()=>{var j;P&&((j=D==null?void 0:D.onExit)===null||j===void 0||j.call(D,P))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(j,W,ee,le){const{isEditable:J}=e,{composing:Te}=e.view,{selection:xe}=j,{empty:Ae,from:je}=xe,De={...W};if(De.composing=Te,J&&(Ae||e.view.composing)){(je<W.range.from||je>W.range.to)&&!Te&&!W.composing&&(De.active=!1);const Ke=C({char:n,allowSpaces:i,allowedPrefixes:r,startOfLine:a,$position:xe.$from}),rt=`id_${Math.floor(Math.random()*4294967295)}`;Ke&&E({editor:e,state:le,range:Ke.range,isActive:W.active})?(De.active=!0,De.decorationId=W.decorationId?W.decorationId:rt,De.range=Ke.range,De.query=Ke.query,De.text=Ke.text):De.active=!1}else De.active=!1;return De.active||(De.decorationId=null,De.range={from:0,to:0},De.query=null,De.text=null),De}},props:{handleKeyDown(j,W){var ee;const{active:le,range:J}=R.getState(j.state);return le&&((ee=D==null?void 0:D.onKeyDown)===null||ee===void 0?void 0:ee.call(D,{view:j,event:W,range:J}))||!1},decorations(j){const{active:W,range:ee,decorationId:le}=R.getState(j);return W?pi.create(j.doc,[Zr.inline(ee.from,ee.to,{nodeName:u,class:l,"data-decoration-id":le})]):null}}});return R}const s6=new Ar("mention"),o6=xs.create({name:"mention",addOptions(){return{HTMLAttributes:{},renderText({options:t,node:e}){var n;return`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e}){var n;return["span",ci(this.HTMLAttributes,t.HTMLAttributes),`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`]},suggestion:{char:"@",pluginKey:s6,command:({editor:t,range:e,props:n})=>{var i,r,a;const u=t.view.state.selection.$to.nodeAfter;((i=u==null?void 0:u.text)===null||i===void 0?void 0:i.startsWith(" "))&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:this.name,attrs:n},{type:"text",text:" "}]).run(),(a=(r=t.view.dom.ownerDocument.defaultView)===null||r===void 0?void 0:r.getSelection())===null||a===void 0||a.collapseToEnd()},allow:({state:t,range:e})=>{const n=t.doc.resolve(e.from),i=t.schema.nodes[this.name];return!!n.parent.type.contentMatch.matchType(i)}}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",ci({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t})];const n={...this.options};n.HTMLAttributes=ci({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:n,node:t});return typeof i=="string"?["span",ci({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},renderText({node:t}){return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel({options:this.options,node:t})):this.options.renderText({options:this.options,node:t})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:i}=e,{empty:r,anchor:a}=i;return r?(e.doc.nodesBetween(a-1,a,(u,l)=>{if(u.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",l,l+u.nodeSize),!1}),n):!1})}},addProseMirrorPlugins(){return[r6({editor:this.editor,...this.options.suggestion})]}}),a6=oo.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",ci(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),l6={props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function c6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleBlockquote&&a.toggleBlockquote(...u)),class:"p-1.5 text-gray-500 rounded hover:text-gray-900 dark:hover:text-white focus:outline-none"},e[1]||(e[1]=[f.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[f.createElementVNode("path",{"fill-rule":"evenodd",d:"M6 6a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3H5a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2H6Zm9 0a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3h-1a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3Z"})],-1)]))}const u6=$e(l6,[["render",c6]]),h6={props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function d6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleBulletList&&a.toggleBulletList(...u)),class:"p-1.5 text-gray-500 rounded hover:text-gray-900 dark:hover:text-white focus:outline-none"},e[1]||(e[1]=[f.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[f.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 8h10M9 12h10M9 16h10M4.99 8H5m-.02 4h.01m0 4H5"})],-1)]))}const p6=$e(h6,[["render",d6]]),f6={props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function m6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleOrderedList&&a.toggleOrderedList(...u)),class:"p-1.5 text-gray-500 rounded hover:text-gray-900 dark:hover:text-white focus:outline-none"},e[1]||(e[1]=[f.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[f.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6h8m-8 6h8m-8 6h8M4 16a2 2 0 1 1 3.321 1.5L4 20h5M4 5l2-1v6m-2 0h4"})],-1)]))}const g6=$e(f6,[["render",m6]]),y6={props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function _6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleCodeBlock&&a.toggleCodeBlock(...u)),class:"p-1.5 text-gray-500 rounded hover:text-gray-900 dark:hover:text-white focus:outline-none"},e[1]||(e[1]=[f.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24"},[f.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8 8-4 4 4 4m8 0 4-4-4-4m-2-3-4 14"})],-1)]))}const b6=$e(y6,[["render",_6]]),x6={props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.chain().toggleBold().run()}}};function v6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleBold&&a.toggleBold(...u)),class:f.normalizeClass(["p-1.5 text-gray-500 rounded cursor-pointer hover:text-gray-900 hover:bg-gray-200",{"bg-gray-200 text-gray-900":n.editor.isActive("bold")}])},e[1]||(e[1]=[f.createElementVNode("svg",{class:"w-5 h-5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24"},[f.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 5h4.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0-7H6m2 7h6.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0 0H6"})],-1),f.createElementVNode("span",{class:"sr-only"},"Bold",-1)]),2)}const w6=$e(x6,[["render",v6]]),k6={props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function S6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleItalic&&a.toggleItalic(...u)),class:f.normalizeClass(["p-1.5 text-gray-500 rounded cursor-pointer hover:text-gray-900 hover:bg-gray-200",{"bg-gray-200 text-gray-900":n.editor.isActive("italic")}])},e[1]||(e[1]=[f.createElementVNode("svg",{class:"w-5 h-5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24"},[f.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8.874 19 6.143-14M6 19h6.33m-.66-14H18"})],-1),f.createElementVNode("span",{class:"sr-only"},"Italic",-1)]),2)}const E6=$e(k6,[["render",S6]]),C6={},T6={"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"};function M6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",T6,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 19.2H5.5c-.3 0-.5-.2-.5-.5V16c0-.2.2-.4.5-.4h13c.3 0 .5.2.5.4v2.7c0 .3-.2.5-.5.5H18m-6-1 1.4 1.8h.2l1.4-1.7m-7-5.4L12 4c0-.1 0-.1 0 0l4 8.8m-6-2.7h4m-7 2.7h2.5m5 0H17"},null,-1)]))}const A6={components:{IconA:$e(C6,[["render",M6]])},props:{editor:Object},data(){return{color:"#000000",colors:["#000000","#0055CC","#206A83","#216E4E","#E56910","#AE2E24","#5E4DB2","#758195","#FF0000","#008000","#28A9AB","#AB7222"]}},methods:{setColor(t){this.editor&&(this.editor.chain().focus().setColor(t).run(),this.$refs.popover.togglePopover(),this.color=t)}}},I6={class:"relative flex"},P6={class:"flex w-[160px] flex-wrap gap-[4px]"},D6=["onClick"];function O6(t,e,n,i,r,a){const u=f.resolveComponent("IconA"),l=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(l,{ref:"popover",placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",I6,[f.createVNode(u,{height:"20",width:"20",class:"text-gray-500"}),f.createElementVNode("span",{class:"absolute h-[4px] w-[80%] bottom-[2px] left-[2px]",style:f.normalizeStyle({backgroundColor:r.color})},null,4)])]),default:f.withCtx(()=>[f.createElementVNode("div",null,[f.createElementVNode("ul",P6,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.colors,g=>(f.openBlock(),f.createElementBlock("li",{class:"h-[37px] w-[37px] rounded",style:f.normalizeStyle({backgroundColor:g}),onClick:b=>a.setColor(g),key:g},null,12,D6))),128))])])]),_:1},512)}const z6=$e(A6,[["render",O6]]),B6={},N6={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-dots-vertical"};function R6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",N6,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),f.createElementVNode("path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),f.createElementVNode("path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)]))}const SS=$e(B6,[["render",R6]]),L6={components:{IconMore:SS},props:{editor:Object},methods:{toggleUnderline(){this.$refs.popover.togglePopover(),this.editor&&this.editor.chain().focus().toggleUnderline().run()},toggleStrike(){this.$refs.popover.togglePopover(),this.editor&&this.editor.chain().focus().toggleStrike().run()}}};function V6(t,e,n,i,r,a){const u=f.resolveComponent("IconMore"),l=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(l,{ref:"popover",placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",{class:f.normalizeClass(["p-1.5 text-gray-500 rounded cursor-pointer hover:text-gray-900 hover:bg-gray-200",{"bg-gray-200 text-gray-900":n.editor.isActive("underline")||n.editor.isActive("strike")}])},[f.createVNode(u,{height:"18",width:"18",class:"rotate-90"})],2)]),default:f.withCtx(()=>[f.createElementVNode("div",null,[f.createElementVNode("button",{onClick:e[0]||(e[0]=(...g)=>a.toggleUnderline&&a.toggleUnderline(...g)),class:f.normalizeClass(["p-[8px] block rounded-lg w-[140px] mb-[4px] text-start hover:bg-gray-100 !duration-300 underline underline-offset-1",{"bg-gray-100 text-gray-900":n.editor.isActive("underline")}])}," Підкресленний ",2),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...g)=>a.toggleStrike&&a.toggleStrike(...g)),class:f.normalizeClass(["p-[8px] block rounded-lg w-[140px] text-start hover:bg-gray-100 !duration-300 line-through",{"bg-gray-100 text-gray-900":n.editor.isActive("strike")}])}," Перекресленний ",2)])]),_:1},512)}const F6={bold:w6,italic:E6,text_more:$e(L6,[["render",V6]]),color:z6,bullet_list:p6,ordered_list:g6,blockquote:u6,codeblock:b6},$6={components:{EditorContent:sF},props:{controls:{type:Array,default:()=>["bold","italic","color","blockquote","bullet_list","ordered_list","codeblock","text_more"]},options:{type:Array,default:()=>[]},modelValue:{type:String,default:()=>""}},data(){return{editor:null}},computed:{controlsList(){return Object.entries(F6).filter(([t])=>this.controls.includes(t)).map(([t,e])=>e)}},watch:{modelValue(t){this.editor&&this.editor.getHTML()!==t&&this.editor.commands.setContent(t)},editor(t){t&&this.editor.on("update",({editor:e})=>{const n=e.getHTML();n!==this.modelValue&&this.$emit("update:modelValue",n)})}},mounted(){this.editor&&this.editor.destroy(),this.initEditor()},beforeDestroy(){this.editor&&this.editor.destroy()},methods:{initEditor(){this.editor=new rF({content:this.modelValue,extensions:[e6,mS,Yh,t6,a6,kS,o6.configure({HTMLAttributes:{class:"mention"},suggestion:{items:({query:t})=>{const e=this.options.filter(n=>{var i,r;return(r=(i=n==null?void 0:n.email)==null?void 0:i.toLowerCase())==null?void 0:r.includes(t==null?void 0:t.toLowerCase())}).slice(0,5);return e.length?e:[{id:null,text:"Данні відсутні",email:null}]},render:()=>{let t,e;return{onStart:n=>{t=document.createElement("div"),t.className="mention-popup",n.items.forEach(a=>{const u=document.createElement("div");u.className="mention-option",a.id===null?(u.textContent=a.text,u.style.pointerEvents="none",u.style.color="#999"):(u.textContent=a.text,u.addEventListener("click",()=>{n.command({id:a.id,label:a.email})})),t.appendChild(u)}),document.body.appendChild(t);const{from:i}=n.range,r=n.editor.view.coordsAtPos(i);t.style.position="absolute",t.style.left=`${r.left}px`,t.style.top=`${r.top-t.offsetHeight}px`,e=t},onUpdate:n=>{for(;t.firstChild;)t.removeChild(t.firstChild);n.items.forEach(a=>{const u=document.createElement("div");u.className="mention-option",a.id===null?(u.textContent=a.text,u.style.pointerEvents="none",u.style.color="#999"):(u.textContent=a.text,u.addEventListener("click",()=>{n.command({id:a.id,label:a.email})})),t.appendChild(u)});const{from:i}=n.range,r=n.editor.view.coordsAtPos(i);t.style.left=`${r.left}px`,t.style.top=`${r.top-t.offsetHeight}px`},onExit:()=>{e&&e.remove()}}}}})]})},focusEditor(){this.editor&&!this.editor.isFocused&&this.editor.commands.focus()}}},j6={class:"w-full border border-gray-200 rounded-lg editor-container bg-gray-50 dark:bg-gray-700 dark:border-gray-600"},U6={key:0,class:"flex flex-wrap items-center w-full gap-2 px-3 py-2 border-b editor-toolbar dark:border-gray-600"};function H6(t,e,n,i,r,a){const u=f.resolveComponent("EditorContent");return f.openBlock(),f.createElementBlock("div",j6,[r.editor?(f.openBlock(),f.createElementBlock("div",U6,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.controlsList,(l,g)=>(f.openBlock(),f.createBlock(f.resolveDynamicComponent(l),{key:g,editor:r.editor},null,8,["editor"]))),128))])):f.createCommentVNode("",!0),f.createElementVNode("div",{onClick:e[0]||(e[0]=(...l)=>a.focusEditor&&a.focusEditor(...l)),class:"relative w-full px-4 py-2 bg-white rounded-b-lg editor-content dark:bg-gray-800"},[f.createVNode(u,{editor:r.editor,class:"relative w-full"},null,8,["editor"])])])}const ES=$e($6,[["render",H6]]),q6=t=>{const e=/(\b\S)?/g,n=t.match(e);return n?n.join("").toUpperCase():""},W6={props:{name:{type:String,default(){return""}},avatar:{type:String,default(){return""}}},computed:{inItials(){return q6(this.name)}}},G6={class:"mr-2"},Z6=["src"],Y6={key:1,class:"flex flex-shrink-0 items-center justify-center w-6 h-6 bg-gray-500 text-xs text-white rounded-full"},X6={key:0},K6={key:1,class:"text-sm"};function J6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",G6,[n.avatar?(f.openBlock(),f.createElementBlock("img",{key:0,src:n.avatar,alt:"avatar",class:"flex flex-shrink-0 items-center justify-center w-6 h-6 rounded-full"},null,8,Z6)):n.name?(f.openBlock(),f.createElementBlock("div",Y6,[a.inItials.length?(f.openBlock(),f.createElementBlock("span",X6,f.toDisplayString(a.inItials),1)):(f.openBlock(),f.createElementBlock("span",K6,e[0]||(e[0]=[f.createElementVNode("i",{class:"ti ti-user"},null,-1)])))])):f.createCommentVNode("",!0)])}const Q6={components:{VsWidgetCommentsAvatar:$e(W6,[["render",J6]]),VsTextEditor:ES},props:{comment:{type:Object,default:()=>({})},user:{type:Object,default:()=>({})},id:{type:String,default:""},options:Array},data(){return{commentContent:this.comment.body,isCommentActionVisible:!1,isOpen:!1,textareaValue:""}},computed:{isUserAutor(){return this.user.uid===this.comment.uid},createDate(){try{const t=ut(this.comment.cdate,"YYYY-MM-DD");return new Date(t).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}},watch:{isOpen(t){t&&(this.textareaValue=this.comment.body)}},methods:{confirnDeleteComment(){document.body.click(),this.$emit("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей коментар?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:this.deleteComment,updateListOnConfirm:!0})},async updateComment(){try{await ct.post(`/api/widget/comment/${this.id}/${this.comment.communication_id}`,{body:this.textareaValue}),this.$emit("list-update"),this.isOpen=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},openEditModal(){document.body.click(),this.isOpen=!0},async deleteComment(){try{await ct.delete(`/api/widget/comment/${this.id}/${this.comment.communication_id}`),this.$emit("list-update"),this.isCommentActionVisible=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},toggleCommentAction(){this.isCommentActionVisible=!this.isCommentActionVisible}}},e$={class:"p-6 pl-1 text-base bg-white dark:bg-gray-900"},t$={class:"flex justify-between items-center mb-2"},n$={class:"flex items-center"},i$={class:"inline-flex items-center mr-3 text-sm text-gray-900 dark:text-white font-semibold"},r$={class:"text-sm text-gray-600 dark:text-gray-400"},s$={class:"flex flex-col items-center gap-[4px]"},o$=["innerHTML"],a$={class:"flex flex-col gap-[8px] text-sm font-medium text-gray-500"},l$={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function c$(t,e,n,i,r,a){const u=f.resolveComponent("VsWidgetCommentsAvatar"),l=f.resolveComponent("VsPopover"),g=f.resolveComponent("VsTextEditor"),b=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("div",e$,[f.createElementVNode("div",t$,[f.createElementVNode("div",n$,[f.createElementVNode("p",i$,[f.createVNode(u,{name:n.comment.username,avatar:n.comment.avatar},null,8,["name","avatar"]),f.createTextVNode(f.toDisplayString(n.comment.username),1)]),f.createElementVNode("p",r$,[f.createElementVNode("time",null,f.toDisplayString(a.createDate),1)])]),f.createVNode(l,{placement:"bottom"},{reference:f.withCtx(()=>e[6]||(e[6]=[f.createElementVNode("button",{class:"inline-flex items-center p-2 text-sm font-medium text-center text-gray-500 dark:text-gray-40 bg-white rounded-lg hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-50 dark:bg-gray-900 dark:hover:bg-gray-700 dark:focus:ring-gray-600",type:"button"},[f.createElementVNode("svg",{class:"w-4 h-4","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 3"},[f.createElementVNode("path",{d:"M2 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm6.041 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM14 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Z"})])],-1)])),default:f.withCtx(()=>[f.createElementVNode("div",s$,[f.createElementVNode("button",{type:"button",class:"block px-[12px] rounded-lg py-[4px] text-start w-[100px] duration-300 hover:bg-gray-100",onClick:e[0]||(e[0]=(...S)=>a.openEditModal&&a.openEditModal(...S))}," Редагувати "),f.createElementVNode("button",{type:"button",class:"block py-2 px-[12px] rounded-lg py-[6px] text-start duration-300 w-[100px] hover:bg-gray-100",onClick:e[1]||(e[1]=S=>a.confirnDeleteComment())}," Видалити ")])]),_:1})]),f.createElementVNode("p",{class:"text-gray-500 dark:text-gray-400",innerHTML:n.comment.body},null,8,o$)]),f.createVNode(b,{visible:r.isOpen,"onUpdate:visible":e[5]||(e[5]=S=>r.isOpen=S),title:"Редагувати",size:"small"},{footer:f.withCtx(()=>[f.createElementVNode("div",l$,[f.createElementVNode("button",{onClick:e[3]||(e[3]=S=>r.isOpen=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Відмінити "),f.createElementVNode("button",{onClick:e[4]||(e[4]=(...S)=>a.updateComment&&a.updateComment(...S)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:f.withCtx(()=>[f.createElementVNode("div",a$,[e[7]||(e[7]=f.createTextVNode(" Коментар ")),f.createVNode(g,{modelValue:r.textareaValue,"onUpdate:modelValue":e[2]||(e[2]=S=>r.textareaValue=S),options:n.options},null,8,["modelValue","options"])])]),_:1},8,["visible"])],64)}const u$={components:{VsWidgetCommentsItem:$e(Q6,[["render",c$]])},inject:["activeAddFormEditor"],props:{id:{type:String,default:()=>""},prefilledData:{type:Object,default:null},options:Array},data(){return{isLoaded:!1,isLoadFailed:!1,comments:[],user:{},modal:{title:"",message:"",cancel:"",confirm:"",cancelButtonText:"",confirmButtonText:""},isModalVisible:!1}},async created(){await this.getComments()},methods:{async getComments(){if(this.prefilledData){this.comments=this.prefilledData.rows,this.isLoaded=!0;return}try{const{data:t}=await ct.get(`/api/widget/comment/${this.id}`);this.comments=t.rows,this.user=t.user}catch(t){this.isLoadFailed=!0,console.error(t)}this.isLoaded=!0,this.$emit("update-comment-count")},prepareModal(t){const e={...t};return t.cancel||(e.cancel=()=>{this.isModalVisible=!1}),t.updateListOnConfirm&&(e.confirm=async()=>{await t.confirm(),this.isModalVisible=!1}),e},handleOpenModal(t){this.modal=this.prepareModal(t),this.isModalVisible=!0}}},h$={class:"flex flex-col"},d$={key:0,class:"max-h-[300px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},p$={key:1},f$={class:"p-4"},m$={class:"mt-1 text-gray-500 dark:text-neutral-500"},g$={class:"mt-4 flex justify-end gap-x-3"};function y$(t,e,n,i,r,a){const u=f.resolveComponent("VsErrorOnLoading"),l=f.resolveComponent("VsWidgetCommentsItem"),g=f.resolveComponent("VsLoader"),b=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock("div",h$,[r.isLoaded?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[r.isLoadFailed?(f.openBlock(),f.createBlock(u,{key:0})):(f.openBlock(),f.createElementBlock(f.Fragment,{key:1},[r.comments.length?(f.openBlock(),f.createElementBlock("div",d$,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.comments,(S,E)=>(f.openBlock(),f.createBlock(l,{key:E,comment:S,user:r.user,options:n.options,index:E,id:n.id,onListUpdate:a.getComments,class:"border-top",onOpenModal:e[0]||(e[0]=C=>a.handleOpenModal(C))},null,8,["comment","user","options","index","id","onListUpdate"]))),128))])):(f.openBlock(),f.createElementBlock("div",p$,e[4]||(e[4]=[f.createElementVNode("p",{class:"pl-3 text-sm font-medium text-gray-600"}," Коментарі відсутні ",-1)])))],64))],64)):(f.openBlock(),f.createBlock(g,{key:1,class:"justify-center",text:"Please wait..."})),f.createVNode(b,{title:r.modal.title,size:"small",visible:r.isModalVisible,"onUpdate:visible":e[3]||(e[3]=S=>r.isModalVisible=S)},{default:f.withCtx(()=>[f.createElementVNode("div",f$,[f.createElementVNode("p",m$,f.toDisplayString(r.modal.message),1),f.createElementVNode("div",g$,[f.createElementVNode("button",{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 focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[1]||(e[1]=(...S)=>r.modal.cancel&&r.modal.cancel(...S))},f.toDisplayString(r.modal.cancelButtonText),1),f.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[2]||(e[2]=(...S)=>r.modal.confirm&&r.modal.confirm(...S))},f.toDisplayString(r.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const _$=$e(u$,[["render",y$]]),b$={components:{VsTextEditor:ES},props:{id:{type:String,default:()=>""},autofocus:{type:Boolean,default:()=>!0},options:Array},data(){return{isEditorOpen:!1,commentContent:""}},methods:{async addNewComment(){if(this.commentContent)try{await ct.post(`/api/widget/comment/${this.id}`,{body:this.commentContent}),this.commentContent="",this.$emit("list-update")}catch(t){console.error(t)}},setNewContent(t){this.commentContent=t}}},x$={class:"flex flex-col items-start w-full widget-comment-form"},v$={class:"w-full mb-4 bg-white border-gray-200 dark:bg-gray-800 dark:border-gray-700"},w$={class:"flex"};function k$(t,e,n,i,r,a){const u=f.resolveComponent("VsTextEditor");return f.openBlock(),f.createElementBlock("div",x$,[f.createElementVNode("div",v$,[f.createVNode(u,{modelValue:r.commentContent,"onUpdate:modelValue":e[0]||(e[0]=l=>r.commentContent=l),options:n.options},null,8,["modelValue","options"])]),f.createElementVNode("div",w$,[f.createElementVNode("button",{ref:"buttonAdd",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white",onClick:e[1]||(e[1]=(...l)=>a.addNewComment&&a.addNewComment(...l))}," Відправити коментар ",512)])])}const S$={components:{VsWidgetCommentsList:_$,VsWidgetCommentsAddForm:$e(b$,[["render",k$]])},props:{id:{type:String,default(){return""}},prefilledData:{type:Object,default:null}},data(){return{activeAddFormEditor:"",comments:[],totalComment:"0",options:[]}},mounted(){this.comments=this.$refs.commentListRef.comments,this.getUsersList()},watch:{comments(t){this.$emit("count-change",t.length)}},methods:{async getUsersList(){try{const{data:t}=await ct.get("/api/suggest/core.user_mentioned");this.options=t}catch(t){console.log(t)}},listUpdate(){this.$refs.commentListRef.getComments()},updateCommentCount(){this.totalComment=this.$refs.commentListRef.comments.length||"0"}}},E$={class:"w-full bg-white-200"};function C$(t,e,n,i,r,a){const u=f.resolveComponent("VsWidgetCommentsAddForm"),l=f.resolveComponent("VsWidgetCommentsList");return f.openBlock(),f.createElementBlock("div",E$,[e[2]||(e[2]=f.createElementVNode("div",{class:"flex items-center justify-between w-full mb-4 gap-x-2"},null,-1)),f.createVNode(u,{options:r.options,class:"mb-6",id:n.id,onListUpdate:e[0]||(e[0]=g=>a.listUpdate())},null,8,["options","id"]),f.createVNode(l,{options:r.options,id:n.id,onUpdateCommentCount:e[1]||(e[1]=g=>a.updateCommentCount()),"prefilled-data":n.prefilledData,ref:"commentListRef"},null,8,["options","id","prefilled-data"])])}const CS=$e(S$,[["render",C$]]),TS=t=>new Date(t).toLocaleDateString("uk-UK",{day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric"}),T$=t=>new Date(t).toLocaleDateString("uk-UK",{day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric"}),M$=t=>{const e=/(\b\S)?/g,n=t.match(e);return n?n.join("").toUpperCase():""},A$=f.defineComponent({props:{username:{type:String,default:()=>""}},computed:{inItials(){return M$(this.username)}}}),I$={class:"flex flex-shrink-0 items-center justify-center w-8 h-8 bg-gray-500 text-xs text-white rounded-full"};function P$(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",I$,f.toDisplayString(t.inItials),1)}const D$=$e(A$,[["render",P$]]),K0={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(i=>typeof i!="function").reduce((i,r)=>i.concat(r),[]).filter(i=>i&&!window.headLoadedFiles[i.url||i.split("?")[0]]);Promise.all(n.map(i=>this.loadFile1(i))).then(()=>{e&&e()})}catch(t){console.log(t)}},promise(t){return new Promise((e,n)=>{K0.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((i,r)=>{function a(l){delete window.headLoadedFiles[`_${n}`],window.headLoadedFiles[n]=l.type,i(l.type)}let u;window.headLoadedFiles[`_${n}`]?u=window.headLoadedFiles[`_${n}`]:(n.includes(".css")?(u=document.createElement("link"),u.href=t,u.type="text/css",u.rel="stylesheet"):(u=document.createElement("script"),u.type="text/javascript",u.src=t,e&&(u.type=e)),window.headLoadedFiles[`_${n}`]=u,document.head.appendChild(u)),u.addEventListener("load",a),u.addEventListener("error",a)})}},O$={props:{point:{type:String,default:()=>""}},data(){return{zoom:18}},computed:{parsedPoint(){return JSON.parse(this.point)},tooltipText(){return this.parsedPoint.coordinates.join(", ")},coordinates(){return[...this.parsedPoint.coordinates].reverse()}},async mounted(){typeof window>"u"||(window!=null&&window.L||(await K0.promise("https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.js"),await K0.promise("https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.js")),this.initMap())},methods:{initMap(){const t=window.L.map("map",{center:this.coordinates,zoom:this.zoom});window.L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png").addTo(t),window.L.circle(this.coordinates,{color:"red",fillColor:"red",fillOpacity:.2,radius:10}).addTo(t).bindTooltip(this.tooltipText)}}},z$={id:"map",style:{height:"9rem",width:"24rem"}};function B$(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",z$)}const N$=$e(O$,[["render",B$]]),R$=f.defineComponent({components:{VsWidgetHistoryItemAvatar:D$,VsWidgetHistoryItemMap:N$},props:{item:{type:Object,default:()=>{}}},methods:{getTitle(t){return t.title||t.attr},getOldValue(t){return t.old||"Не вказано"},getNewValue(t){return t.new||"Не вказано"},getDate(t){return T$(t.cdate)}}}),L$={class:"relative [&_p]:m-0"},V$={class:"flex items-center gap-3"},F$={class:"w-full flex justify-between"},$$={class:"text-gray-500"},j$={class:"text-gray-800 font-medium"},U$={class:"text-gray-500 text-sm"},H$={class:"mt-2 pl-10"},q$={key:0},W$={key:1,class:"flex items-center gap-2 text-gray-700 text-sm"},G$={class:"font-medium"},Z$={class:"font-medium"};function Y$(t,e,n,i,r,a){const u=f.resolveComponent("VsWidgetHistoryItemAvatar"),l=f.resolveComponent("VsWidgetHistoryItemMap");return f.openBlock(),f.createElementBlock("div",L$,[f.createElementVNode("div",V$,[f.createVNode(u,{username:t.item.username},null,8,["username"]),f.createElementVNode("div",F$,[f.createElementVNode("p",$$,[f.createElementVNode("span",j$,f.toDisplayString(t.item.username),1),e[0]||(e[0]=f.createTextVNode(" змінив данні: "))]),f.createElementVNode("p",U$,f.toDisplayString(t.getDate(t.item)),1)])]),f.createElementVNode("div",H$,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(t.item.changes,(g,b)=>(f.openBlock(),f.createElementBlock("div",{key:b},[g.attr==="geom"?(f.openBlock(),f.createElementBlock("div",q$,[e[1]||(e[1]=f.createElementVNode("p",null,"Додана геометрія:",-1)),g.new?(f.openBlock(),f.createBlock(l,{key:0,point:g.new},null,8,["point"])):f.createCommentVNode("",!0)])):(f.openBlock(),f.createElementBlock("div",W$,[f.createElementVNode("p",null,f.toDisplayString(`- ${t.getTitle(g)}:`),1),f.createElementVNode("p",G$,f.toDisplayString(t.getOldValue(g)),1),e[2]||(e[2]=f.createElementVNode("i",{class:"ti ti-arrow-right"},null,-1)),f.createElementVNode("p",Z$,f.toDisplayString(t.getNewValue(g)),1)]))]))),128))])])}const X$=$e(R$,[["render",Y$]]),K$=f.defineComponent({components:{VsWidgetHistoryItem:X$,VsEmptyWidget:Uv},props:{id:{type:String,default:""},prefilledData:{type:Object,default:null}},data:()=>({history:{}}),computed:{createdDate(){return this.history.data?TS(this.history.data.cdate):""},lastEditDate(){return this.history.data?TS(this.history.data.edate):""},authorName(){return this.history.data?this.history.data.author:""}},methods:{async getHistoryData(){if(this.prefilledData){this.history=this.prefilledData;return}try{const{data:t}=await ct.get(`/api/widget/history/${this.id}`);this.history=t}catch(t){console.error(t)}}},async mounted(){await this.getHistoryData()},watch:{"history.rows":function(t){this.$emit("count-change",t.length)}}}),J$={class:"bg-white"},Q$={key:0,class:"space-y-6 list-none relative !px-0 sm:before:absolute sm:before:top-2 sm:before:bottom-0 sm:before:w-0.5 sm:before:left-4 before:bg-gray-200 max-h-[400px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},e8={key:1,class:"w-full h-[330px] flex items-center justify-center"};function t8(t,e,n,i,r,a){var l;const u=f.resolveComponent("VsWidgetHistoryItem");return f.openBlock(),f.createElementBlock("div",J$,[e[0]||(e[0]=f.createElementVNode("div",{class:"flex items-center justify-between mb-4 gap-x-2"},null,-1)),(l=t.history.rows)!=null&&l.length?(f.openBlock(),f.createElementBlock("ul",Q$,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(t.history.rows,g=>(f.openBlock(),f.createElementBlock("li",{class:"list-none mr-[10px]",key:g.uid},[f.createVNode(u,{item:g},null,8,["item"])]))),128))])):(f.openBlock(),f.createElementBlock("div",e8," Історія відсутні "))])}const n8={"vs-widget-map":W1,"vs-widget-gallery":DN,"vs-widget-comments":CS,"vs-widget-file":qv,"vs-widget-history":$e(K$,[["render",t8]])},i8={"table-format-text":yp,"table-format-select":$x,"table-format-badge":Vx,"table-format-swetch":_p,"table-format-check":_p,"table-format-html":yp,"table-format-tags":jx,"table-format-date":oy,"table-format-number":F1,"table-format-slot":$1},r8={style:{width:"calc(100vw - 300px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 flex items-center justify-center"},s8={__name:"vs-dashboard",setup(t){return(e,n)=>(f.openBlock(),f.createElementBlock("div",r8,n[0]||(n[0]=[f.createElementVNode("div",{class:"p-5 md:p-8 bg-white border border-gray-200 shadow-sm rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[f.createElementVNode("div",{class:"mb-4 xl:mb-8"},[f.createElementVNode("h1",{class:"text-lg font-semibold text-gray-800 dark:text-neutral-200"}," Members "),f.createElementVNode("p",{class:"text-sm text-gray-500 dark:text-neutral-500"}," Manage members and users of your workspace and set their access level. ")]),f.createElementVNode("div",{class:"space-y-5"},[f.createElementVNode("div",{class:"flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5"},[f.createElementVNode("div",{class:"relative w-full"},[f.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-20 ps-3.5"},[f.createElementVNode("svg",{class:"shrink-0 size-4 text-gray-500 dark:text-neutral-400",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"},[f.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),f.createElementVNode("path",{d:"m21 21-4.3-4.3"})])]),f.createElementVNode("input",{type:"text",class:"py-2 ps-10 pe-8 block w-full bg-gray-100 border-transparent rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Search by name or email"}),f.createElementVNode("div",{class:"hidden absolute inset-y-0 end-0 flex items-center pointer-events-none z-20 pe-1"},[f.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-6 rounded-full text-gray-500 hover:text-blue-600 focus:outline-none focus:text-blue-600 dark:text-neutral-500 dark:hover:text-blue-500 dark:focus:text-blue-500","aria-label":"Close"},[f.createElementVNode("span",{class:"sr-only"},"Close"),f.createElementVNode("svg",{class:"shrink-0 size-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"},[f.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),f.createElementVNode("path",{d:"m15 9-6 6"}),f.createElementVNode("path",{d:"m9 9 6 6"})])])])]),f.createElementVNode("div",{class:"flex justify-end items-center gap-x-2"},[f.createElementVNode("button",{type:"button",class:"p-2.5 sm:py-2 sm:px-3 inline-flex items-center 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 focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[f.createElementVNode("svg",{class:"shrink-0 sm:me-2 size-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"},[f.createElementVNode("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),f.createElementVNode("polyline",{points:"7 10 12 15 17 10"}),f.createElementVNode("line",{x1:"12",x2:"12",y1:"15",y2:"3"})]),f.createElementVNode("span",{class:"hidden sm:block"}," Download CSV ")]),f.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-1 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-2 focus:ring-blue-500","data-hs-overlay":"#hs-pro-dshm"},[f.createElementVNode("span",{class:"hidden sm:block"},"Send"),f.createTextVNode("Invite ")])])]),f.createElementVNode("div",{class:"grid sm:grid-cols-2 lg:grid-cols-4 gap-2 xl:gap-4"},[f.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[f.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[f.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}),f.createElementVNode("div",{class:"flex items-center -space-x-2"},[f.createElementVNode("img",{class:"shrink-0 size-7 rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Avatar"})])]),f.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Admin")]),f.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[f.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[f.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 5 "),f.createElementVNode("div",{class:"flex items-center -space-x-2"},[f.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),f.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),f.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1679412330254-90cb240038c5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),f.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1659482634023-2c4fda99ac0c?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),f.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," O ")])]),f.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[f.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Members"),f.createElementVNode("div",{class:"hs-tooltip inline-block"},[f.createElementVNode("svg",{class:"hs-tooltip-toggle shrink-0 size-3.5 text-gray-500 dark:text-neutral-500",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},[f.createElementVNode("path",{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"}),f.createElementVNode("path",{d:"m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})]),f.createElementVNode("div",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 w-60 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded dark:bg-neutral-700",role:"tooltip","data-popper-placement":"top",style:{position:"fixed",inset:"auto auto 0px 0px",margin:"0px",transform:"translate(689px, -708px)"}}," Limited Access Members can only access the projects, tasks, and messages explicitly shared with them. ")])])]),f.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[f.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[f.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 2 "),f.createElementVNode("div",{class:"flex items-center -space-x-2"},[f.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),f.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," 0 ")])]),f.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[f.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"}," Limited access members "),f.createElementVNode("div",{class:"hs-tooltip inline-block"},[f.createElementVNode("svg",{class:"hs-tooltip-toggle shrink-0 size-3.5 text-gray-500 dark:text-neutral-500",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},[f.createElementVNode("path",{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"}),f.createElementVNode("path",{d:"m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})]),f.createElementVNode("div",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 w-60 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded dark:bg-neutral-700",role:"tooltip","data-popper-placement":"top",style:{position:"fixed",inset:"auto auto 0px 0px",margin:"0px",transform:"translate(1198px, -708px)"}}," Limited Access Members can only access the projects, tasks, and messages explicitly shared with them. ")])])]),f.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[f.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[f.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 0 "),f.createElementVNode("div",{class:"flex items-center -space-x-2"})]),f.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Pending invites")])]),f.createElementVNode("div",{class:"overflow-x-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},[f.createElementVNode("div",{class:"min-w-full inline-block align-middle"},[f.createElementVNode("table",{class:"min-w-full divide-y divide-gray-200 dark:divide-neutral-700"},[f.createElementVNode("thead",null,[f.createElementVNode("tr",null,[f.createElementVNode("th",{scope:"col",class:"min-w-[250px]"},[f.createElementVNode("div",{class:"pe-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Member ")]),f.createElementVNode("th",{scope:"col",class:"min-w-48"},[f.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Role ")]),f.createElementVNode("th",{scope:"col"},[f.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Email ")]),f.createElementVNode("th",{scope:"col",class:"min-w-36"},[f.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Last activity ")]),f.createElementVNode("th",{scope:"col"},[f.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Status ")])])]),f.createElementVNode("tbody",{class:"divide-y divide-gray-200 dark:divide-neutral-700"},[f.createElementVNode("tr",null,[f.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[f.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[f.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Avatar"}),f.createElementVNode("div",{class:"grow"},[f.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Admin ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," james@site.com ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"inline-flex items-center gap-x-1.5 py-1.5 px-2.5 text-xs font-medium bg-teal-100 text-teal-800 rounded-full dark:bg-teal-500/10 dark:text-teal-500"},[f.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),f.createTextVNode(" Active ")])])]),f.createElementVNode("tr",null,[f.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[f.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[f.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-[38px] bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),f.createElementVNode("div",{class:"grow"},[f.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," liza@site.com ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 2 days ago ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[f.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),f.createTextVNode(" Inactive ")])])]),f.createElementVNode("tr",null,[f.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[f.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[f.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1601935111741-ae98b2b230b0?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),f.createElementVNode("div",{class:"grow"},[f.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Daniel Hobbs ")])])]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," dhobbs@site.com ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[f.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),f.createTextVNode(" Inactive ")])])]),f.createElementVNode("tr",null,[f.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[f.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[f.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1679412330254-90cb240038c5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),f.createElementVNode("div",{class:"grow"},[f.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Brian Warner ")])])]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," brian@site.com ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 1 months ago ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"inline-flex items-center gap-x-1.5 py-1.5 px-2.5 text-xs font-medium bg-teal-100 text-teal-800 rounded-full dark:bg-teal-500/10 dark:text-teal-500"},[f.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),f.createTextVNode(" Active ")])])]),f.createElementVNode("tr",null,[f.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[f.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[f.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-[38px] bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," O "),f.createElementVNode("div",{class:"grow"},[f.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Ols Shols ")])])]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," olsshols@site.com ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 6 days ago ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[f.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),f.createTextVNode(" Inactive ")])])])])])])])])],-1)])))}},o8={},a8={class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50"};function l8(t,e){return f.openBlock(),f.createElementBlock("div",a8," Custom component ")}const c8=$e(o8,[["render",l8]]),u8={},h8={class:"shrink-0 size-4 text-gray-400 dark:text-white/60",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function d8(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",h8,e[0]||(e[0]=[f.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),f.createElementVNode("path",{d:"m21 21-4.3-4.3"},null,-1)]))}const J0=$e(u8,[["render",d8]]),p8={components:{IconSearch:J0},data(){return{link:null,color:void 0,data:null,searchValue:""}},mounted(){this.link="/admin.user-cls",this.getData()},computed:{rows(){var t,e;return((e=(t=this.data)==null?void 0:t.rows)==null?void 0:e.filter(n=>{var i;return(i=n==null?void 0:n.name)==null?void 0:i.includes(this.searchValue)}))||null}},methods:{async getData(){try{const{data:t}=await ct.get("/api/user-cls?type=json");this.data=t}catch{}}}},f8={class:"w-[300px] border-r",style:{height:"calc(100vh - 60px)"}},m8={class:"relative"},g8={class:"flex flex-col w-[300px] gap-[4px] overflow-y-auto overflow-x-hidden p-[10px] pr-0 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300",style:{height:"calc(100vh - 100px)"}},y8={class:"w-[99%] overflow-hidden overflow-ellipsis"},_8={class:"ml-auto text-[10px] h-[16px] px-[6px] flex items-center justify-center rounded-full bg-gray-200"};function b8(t,e,n,i,r,a){const u=f.resolveComponent("IconSearch"),l=f.resolveComponent("VsText"),g=f.resolveComponent("router-link");return f.openBlock(),f.createElementBlock("div",f8,[f.createElementVNode("div",m8,[f.createVNode(u,{height:"16",width:"16",class:"absolute top-[12px] left-[30px] text-gray-500 z-[1]"}),f.createVNode(l,{type:"text",modelValue:r.searchValue,"onUpdate:modelValue":e[0]||(e[0]=b=>r.searchValue=b),clearable:!0,placeholder:"Пошук по меню",class:"[&>input]:h-[40px] [&>input]:block [&>input]:rounded-none [&>input]:border-x-0 [&>input]:pl-[60px] [&>input:focus]:outline-none [&>input:focus]:focus:ring-0 [&>input:focus]:border-y-gray-200 [&>input:focus]:border-y-1 [&>input:focus]:border-x-0"},null,8,["modelValue"])]),f.createElementVNode("ul",g8,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.rows,b=>{var S,E;return f.openBlock(),f.createElementBlock("li",{key:b==null?void 0:b.id,class:"w-full pr-[10px]"},[f.createVNode(g,{to:r.link+"?name="+((b==null?void 0:b.name)||(b==null?void 0:b.id)),class:f.normalizeClass(["py-2 px-5 group pr-[10px] flex items-center gap-x-3 w-full flex justify-between hover:bg-gray-100 rounded-lg duration-300",{"bg-gray-100":((E=(S=t.$route)==null?void 0:S.query)==null?void 0:E.name)===(b==null?void 0:b.name)}])},{default:f.withCtx(()=>[f.createElementVNode("span",y8,f.toDisplayString((b==null?void 0:b.name)||(b==null?void 0:b.id)),1),f.createElementVNode("span",_8,f.toDisplayString((b==null?void 0:b.children)||0),1)]),_:2},1032,["to","class"])])}),128))])])}const x8=$e(p8,[["render",b8]]),v8={props:{title:{type:String,default:()=>"Дані для відображення відсутні"},text:{type:String,default:()=>"Змініть параметри пошуку або спробуйте пізніше"}}},w8={class:"w-full"},k8={class:"p-5 min-h-[500px] flex flex-col justify-center items-center text-center"},S8={class:"max-w-sm mx-auto mt-6"},E8={class:"font-medium text-gray-800 dark:text-neutral-200"},C8={class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"};function T8(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",w8,[f.createElementVNode("div",k8,[e[0]||(e[0]=f.createStaticVNode('<svg class="w-48 mx-auto" viewBox="0 0 178 90" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs></svg>',1)),f.createElementVNode("div",S8,[f.createElementVNode("p",E8,f.toDisplayString(n.title),1),f.createElementVNode("p",C8,f.toDisplayString(n.text),1)])])])}const MS=$e(v8,[["render",T8]]),M8={props:{modelValue:{type:String,default:()=>"#172B4D"},colors:{type:Array,default:()=>["#172B4D","#0055CC","#206A83","#216E4E","#E56910","#AE2E24","#5E4DB2","#758195","#FF0000","#008000","#28A9AB","#AB7222"]}},methods:{updateColor(t){this.$emit("update:modelValue",t),this.$refs.popover.togglePopover()}}},A8={class:"flex w-[160px] flex-wrap gap-[4px]"},I8=["onClick"];function P8(t,e,n,i,r,a){const u=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(u,{ref:"popover",placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",{class:"h-[37px] w-[37px] rounded-lg flex items-center justify-center",style:f.normalizeStyle({backgroundColor:n.modelValue})},null,4)]),default:f.withCtx(()=>[f.createElementVNode("div",null,[f.createElementVNode("ul",A8,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.colors,l=>(f.openBlock(),f.createElementBlock("li",{class:"h-[37px] w-[37px] rounded",style:f.normalizeStyle({backgroundColor:l}),onClick:g=>a.updateColor(l),key:l},null,12,I8))),128))])])]),_:1},512)}const AS=$e(M8,[["render",P8]]),D8={components:{VsChoceColor:AS},props:{item:Object},data(){var t,e,n;return{color:((t=this.item)==null?void 0:t.color)||"#D1D5DB",text:((e=this.item)==null?void 0:e.text)||"",id:(n=this.item)==null?void 0:n.id}},watch:{color(t){this.$emit("update-item",{...this.item,color:t})},text(t){this.$emit("update-item",{...this.item,text:t})},id(t){this.$emit("update-item",{...this.item},t)}}},O8={class:"relative flex items-center p-3 bg-white border border-gray-200 group gap-x-3 rounded-xl"},z8={class:"flex flex-col"},B8={class:"flex gap-[30px]"},N8={class:"block text-sm font-semibold text-gray-800 text-start z-[10] cursor-pointer"},R8={class:"block text-sm font-semibold text-gray-400 text-start z-[10] cursor-pointer"},L8={class:"block text-xs text-gray-500 truncate dark:text-neutral-500"};function V8(t,e,n,i,r,a){var g;const u=f.resolveComponent("VsChoceColor"),l=f.resolveComponent("VsInlineEdit");return f.openBlock(),f.createElementBlock("div",O8,[f.createVNode(u,{modelValue:r.color,"onUpdate:modelValue":e[0]||(e[0]=b=>r.color=b)},null,8,["modelValue"]),f.createElementVNode("div",z8,[f.createElementVNode("div",B8,[f.createVNode(l,{modelValue:r.text,"onUpdate:modelValue":e[1]||(e[1]=b=>r.text=b),onUpdateValue:e[2]||(e[2]=b=>r.text=b)},{default:f.withCtx(()=>[f.createElementVNode("p",N8,f.toDisplayString(r.text),1)]),_:1},8,["modelValue"]),f.createVNode(l,{modelValue:r.id,"onUpdate:modelValue":e[3]||(e[3]=b=>r.id=b),onUpdateValue:e[4]||(e[4]=b=>r.id=b)},{default:f.withCtx(()=>[f.createElementVNode("p",R8,f.toDisplayString(r.id),1)]),_:1},8,["modelValue"])]),f.createElementVNode("p",L8,f.toDisplayString((g=n.item)==null?void 0:g.parent),1)])])}const F8={components:{VsReesterUsersItem:$e(D8,[["render",V8]])},props:{list:Array},data(){return{draggedItemIndex:null}},methods:{dragStart(t,e){this.draggedItemIndex=e,t.dataTransfer.effectAllowed="move"},dragOver(t){t.preventDefault()},drop(t,e){t.preventDefault();const n=this.draggedItemIndex;if(n!==e){const i=[...this.list],r=i[n];i.splice(n,1),i.splice(e,0,r),this.$emit("update-list",i)}this.draggedItemIndex=null},dragEnd(){this.draggedItemIndex=null},updateItem(t,e){var i;const n=(i=this.list)==null?void 0:i.findIndex(r=>(r==null?void 0:r.id)===(t==null?void 0:t.id));this.list[n]=t,e&&(this.list[n].id=e),this.$emit("update-list",this.list)}}},$8={class:"flex flex w-full flex-col gap-[10px] p-[10px] pt-[40px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300",style:{width:"calc(100vw - 1000px)","max-height":"calc(100vh - 430px)"}},j8=["onDragstart","onDrop"];function U8(t,e,n,i,r,a){const u=f.resolveComponent("VsReesterUsersItem");return f.openBlock(),f.createElementBlock("ul",$8,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.list,(l,g)=>(f.openBlock(),f.createElementBlock("li",{key:l==null?void 0:l.id,draggable:!0,onDragstart:b=>a.dragStart(b,g),onDragover:e[0]||(e[0]=b=>a.dragOver(b)),onDrop:b=>a.drop(b,g),onDragend:e[1]||(e[1]=(...b)=>a.dragEnd&&a.dragEnd(...b))},[f.createVNode(u,{item:l,onUpdateItem:a.updateItem},null,8,["item","onUpdateItem"])],40,j8))),128))])}const H8={components:{VsNoData:MS,VsChoceColor:AS,IconCheck:Fx,VsReesterUsersList:$e(F8,[["render",U8],["__scopeId","data-v-87c0b333"]])},data(){return{scheme:{text:{type:"Text",ua:"Ім'я",validators:["required"]}},formVisible:!0,formValues:{},color:"#172B4D",data:null}},watch:{$route:{handler(t,e){var n,i;((n=t==null?void 0:t.query)==null?void 0:n.name)!==((i=e==null?void 0:e.query)==null?void 0:i.name)&&this.getData()}}},mounted(){this.getData()},methods:{async getData(){var t;this.data=null;try{const{data:e}=await ct.get(`/api/user-cls/${(t=this.$route.query)==null?void 0:t.name}`);this.data=e}catch{}},async addOneChild(){var t,e,n,i;try{const{form:r}=this.$refs;await r.doValidation(),await ct.post("/api/user-cls",{name:(t=this.$route.query)==null?void 0:t.name,children:[...((e=this.data)==null?void 0:e.children)||[],{...this.formValues,color:this.color,id:(((i=(n=this.data)==null?void 0:n.children)==null?void 0:i.length)||0)+1}]}),this.formVisible=!1,this.formValues={},setTimeout(()=>this.formVisible=!0),await this.getData()}catch(r){console.log(r)}},async updateChildren(t){var e,n;this.data.children=t;try{await ct.post("/api/user-cls",{name:(e=this.$route.query)==null?void 0:e.name,children:[...((n=this.data)==null?void 0:n.children)||[]]}),await this.getData()}catch(i){console.log(i)}}}},q8={class:"flex justify-center bg-gray-50",style:{height:"calc(100vh - 60px)",width:"calc(100vw - 560px)"}},W8={key:0,class:"mt-[100px] p-[10px]",style:{"max-height":"calc(100vh - 300px)",width:"calc(100vw - 1000px)"}},G8={class:"flex items-end w-full gap-[4px]"};function Z8(t,e,n,i,r,a){var E,C,P,D,R;const u=f.resolveComponent("VsForm"),l=f.resolveComponent("VsChoceColor"),g=f.resolveComponent("IconCheck"),b=f.resolveComponent("VsReesterUsersList"),S=f.resolveComponent("VsNoData");return f.openBlock(),f.createElementBlock("div",q8,[(C=(E=t.$route)==null?void 0:E.query)!=null&&C.name?(f.openBlock(),f.createElementBlock("div",W8,[e[3]||(e[3]=f.createElementVNode("h2",{class:"font-bold mb-[10px]"},"Створити",-1)),f.createElementVNode("div",G8,[r.formVisible?(f.openBlock(),f.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[0]||(e[0]=j=>r.formValues=j),class:"p-0 m-0 h-[65px] w-full"},null,8,["scheme","modelValue"])):f.createCommentVNode("",!0),f.createVNode(l,{modelValue:r.color,"onUpdate:modelValue":e[1]||(e[1]=j=>r.color=j)},null,8,["modelValue"]),f.createElementVNode("button",{onClick:e[2]||(e[2]=(...j)=>a.addOneChild&&a.addOneChild(...j)),class:"h-[37px] w-[37px] rounded-lg bg-blue-600 ml-[6px] flex items-center justify-center text-white hover:bg-blue-700 duration-300"},[f.createVNode(g,{height:"20",width:"20"})])]),(D=(P=r.data)==null?void 0:P.children)!=null&&D.length?(f.openBlock(),f.createBlock(b,{key:0,list:(R=r.data)==null?void 0:R.children,onUpdateList:a.updateChildren},null,8,["list","onUpdateList"])):f.createCommentVNode("",!0)])):(f.openBlock(),f.createBlock(S,{key:1,class:"mt-[100px]",text:"Оберіть один з пунктів меню для відображення"}))])}const Y8={components:{VsReesterNavList:x8,VsReesterContent:$e(H8,[["render",Z8]])}},X8={class:"flex items-start gap-0"};function K8(t,e,n,i,r,a){const u=f.resolveComponent("VsReesterNavList"),l=f.resolveComponent("VsReesterContent");return f.openBlock(),f.createElementBlock("div",X8,[f.createVNode(u),f.createVNode(l)])}const Q0={...n8,...i8,"vs-dashboard":s8,"vs-custom-button":c8,...{"user-cls-page":$e(Y8,[["render",K8]])}},IS=t=>{const e=[];return t.forEach(n=>{n.menu?e.push(...IS(n.menu)):e.push(n)}),e},Ss=f.ref(null),J8=async()=>{try{const{data:t}=await ct.get("/api/user-menu");return Ss.value=t,IS(t)}catch(t){return console.error(t),[]}},Q8=(t,e)=>{Object.entries(e).forEach(([n,i])=>{t.component(n,i)})},ej={async install(t,{componentsApp:e={},settings:n}){hl.value={...hl,...n};try{const r=(await J8()).filter(u=>u==null?void 0:u.component).map(u=>({...u,component:{...Q0,...e}[u==null?void 0:u.component]}));Q8(t,{...Q0,...e}),t.component("admin",HT);const{router:a}=await CA(r);window.app=t,t.config.globalProperties={...t.config.globalProperties,$componentsConfig:{...bz,componentsApp:e},$router:a},t.use(a)}catch(i){console.error(i)}},components:Q0},tj={data(){return{formValues:{},scheme:null,table:"",token:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){var i,r;const t=this.flattenMenu(Ss.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.query)==null?void 0:l.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const{data:{form:a}}=await ct.get(`/api/template/table/${n}`),{data:u}=await ct.get(`/api/table/${this.table}/${(r=(i=this.$route)==null?void 0:i.query)==null?void 0:r.id}`);this.token=(u==null?void 0:u.token)||"",this.formValues=u||{};const{data:l}=await ct.get(`/api/template/form/${a}`);this.scheme=(l==null?void 0:l.schema)||l}catch{}},async onlyEditObject(){try{await this.$refs.form.doValidation(),await ct.put(`/api/table/${this.token}`,this.formValues),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},async editObjectAndRedirect(){try{await this.$refs.form.doValidation(),await ct.put(`/api/table/${this.token}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},nj={style:{width:"calc(100vw - 260px)"},class:"bg-gray-50"},ij={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},rj={class:"flex items-center gap-[6px]"},sj={style:{height:"calc(100vh - 155px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},oj={class:"bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function aj(t,e,n,i,r,a){const u=f.resolveComponent("VsForm");return f.openBlock(),f.createElementBlock("div",nj,[f.createElementVNode("div",ij,[e[4]||(e[4]=f.createElementVNode("h2",{class:"text-xl font-medium"},"Редагувати",-1)),f.createElementVNode("div",rj,[f.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"flex items-center px-3 py-2 text-sm font-medium text-gray-800 duration-300 bg-white border border-gray-100 rounded-lg shadow gap-x-2 focus:outline-none hover:bg-gray-50 hover:border-gray-100"}," Повернутися "),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.onlyEditObject&&a.onlyEditObject(...l)),class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"}," Зберегти "),f.createElementVNode("button",{onClick:e[2]||(e[2]=(...l)=>a.editObjectAndRedirect&&a.editObjectAndRedirect(...l)),class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"}," Зберегти і повернутися ")])]),f.createElementVNode("div",sj,[f.createElementVNode("div",oj,[r.scheme?(f.openBlock(),f.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[3]||(e[3]=l=>r.formValues=l),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):f.createCommentVNode("",!0)])])])}const lj=Object.freeze(Object.defineProperty({__proto__:null,default:$e(tj,[["render",aj]])},Symbol.toStringTag,{value:"Module"})),cj={data(){return{formValues:{},scheme:null,table:"",token:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){var i,r;const t=this.flattenMenu(Ss.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.query)==null?void 0:l.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const a=await ct.get(`/api/table-data/${n}`),{data:u}=await ct.get(`/api/template/form/${(i=a==null?void 0:a.data)==null?void 0:i.form}`);this.scheme=(u==null?void 0:u.schema)||u,this.token=(r=a==null?void 0:a.data)==null?void 0:r.addToken}catch{}},async createObject(){var e,n,i,r,a,u,l,g;const t=this.$refs.form;try{await t.doValidation(),await ct.post(`/api/table/${this.token}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{let S=((r=(i=(n=(e=Object.entries(t==null?void 0:t.formErrors))==null?void 0:e[0])==null?void 0:n[1])==null?void 0:i[0])==null?void 0:r.message)==="Це поле обов'язкове"?"Заповніть обов'язкові поля":(g=(l=(u=(a=Object.entries(t==null?void 0:t.formErrors))==null?void 0:a[0])==null?void 0:u[1])==null?void 0:l[0])==null?void 0:g.message;this.$notify({title:"Помилка!",message:S||"Сталася помилка валідаціі",type:"error"})}}}},uj={style:{width:"calc(100vw - 260px)"},class:"bg-gray-50"},hj={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},dj={class:"flex items-center gap-[6px]"},pj={style:{height:"calc(100vh - 165px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},fj={class:"bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function mj(t,e,n,i,r,a){const u=f.resolveComponent("VsForm");return f.openBlock(),f.createElementBlock("div",uj,[f.createElementVNode("div",hj,[e[3]||(e[3]=f.createElementVNode("h2",{class:"text-xl font-medium"},"Створити",-1)),f.createElementVNode("div",dj,[f.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"flex items-center px-3 py-2 text-sm font-medium text-gray-800 duration-300 bg-white border border-gray-100 rounded-lg shadow gap-x-2 focus:outline-none hover:bg-gray-50 hover:border-gray-100"}," Скасувати "),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.createObject&&a.createObject(...l)),class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"}," Зберегти ")])]),f.createElementVNode("div",pj,[f.createElementVNode("div",fj,[r.scheme?(f.openBlock(),f.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[2]||(e[2]=l=>r.formValues=l),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):f.createCommentVNode("",!0)])])])}const gj=Object.freeze(Object.defineProperty({__proto__:null,default:$e(cj,[["render",mj]])},Symbol.toStringTag,{value:"Module"})),yj={};function _j(t,e,n,i,r,a){const u=f.resolveComponent("router-view");return f.openBlock(),f.createBlock(u)}const PS=Object.freeze(Object.defineProperty({__proto__:null,default:$e(yj,[["render",_j]])},Symbol.toStringTag,{value:"Module"})),bj={class:"h-[76px] bg-white border rounded-xl flex items-center justify-between px-[20px] mb-[16px]"},xj={class:"text-lg font-semibold md:text-xl text-stone-800 dark:text-neutral-200"},vj={class:"flex items-center gap-[6px]"},wj={components:{AdminCardHeader:{__name:"admin-card-header",props:{title:{type:String},getRoute:{type:String,required:!0}},setup(t){const e=t,n=_A(),i=bA(),r=()=>{n.back()},a=f.computed(()=>{var u;return`/edit?table=${e.getRoute}&id=${(u=i==null?void 0:i.params)==null?void 0:u.id}`});return(u,l)=>{const g=f.resolveComponent("router-link");return f.openBlock(),f.createElementBlock("div",bj,[f.createElementVNode("div",null,[f.createElementVNode("button",{onClick:r,class:"text-sm h-[20px] text-blue-600 font-medium hover:border-b-2 hover:border-b-blue-500"}," До таблиці "),f.createElementVNode("h2",xj,f.toDisplayString(t.title),1)]),f.createElementVNode("div",vj,[f.createVNode(g,{to:a.value,class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"},{default:f.withCtx(()=>l[0]||(l[0]=[f.createTextVNode(" Редагувати ")])),_:1},8,["to"])])])}}}},data(){return{objectData:null,component:""}},computed:{getRoute(){const t=this.flattenMenu(Ss.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(n=>{var i,r;return(n==null?void 0:n.table)==((r=(i=this.$route)==null?void 0:i.params)==null?void 0:r.table)});return e||this.$router.replace("/404"),e==null?void 0:e.path},getTitle(){var t,e,n,i,r,a,u,l,g,b,S,E,C,P,D;if((n=(e=(t=this.objectData)==null?void 0:t.rows)==null?void 0:e[0])!=null&&n.name)return((u=(a=(r=(i=this.objectData)==null?void 0:i.rows)==null?void 0:r[0])==null?void 0:a.name)==null?void 0:u.length)<35?(b=(g=(l=this.objectData)==null?void 0:l.rows)==null?void 0:g[0])==null?void 0:b.name:((P=(C=(E=(S=this.objectData)==null?void 0:S.rows)==null?void 0:E[0])==null?void 0:C.name)==null?void 0:P.slice(0,35))+" ...";{const R=(D=this.flattenMenu(Ss.value))==null?void 0:D.find(j=>{var W,ee;return(j==null?void 0:j.table)===((ee=(W=this.$route)==null?void 0:W.params)==null?void 0:ee.table)});return R==null?void 0:R.ua}}},async mounted(){await this.getObjectData(),await this.checkActiveComponent()},watch:{component(t){this.$router.replace({...this.$route,query:{tab:t}})}},methods:{async getObjectData(){var n;const{table:t,id:e}=(n=this.$route)==null?void 0:n.params;(!t||!e)&&this.$router.replace("/404");try{const{data:i}=await ct.get(`/api/table-data/${t}/${e}`);this.objectData=i}catch(i){console.error(i)}},getColClass(t){return`col-span-${t||12}`},getGridClass(){return"grid-cols-12"},checkActiveComponent(){var t,e,n,i,r,a,u,l,g;if((e=(t=this.$route)==null?void 0:t.query)!=null&&e.tab)this.component=(i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.tab;else{const b=(a=(r=this.objectData)==null?void 0:r.panels)==null?void 0:a.find(S=>(S==null?void 0:S.type)==="tabs");(u=b==null?void 0:b.items)!=null&&u.length&&(this.component=((l=b.items[0])==null?void 0:l.component)||((g=b.items[0])==null?void 0:g.name))}},flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e}}},kj={style:{width:"calc(100vw - 260px)",height:"calc(100vh - 60px)"},class:"p-4 overflow-y-auto bg-gray-50"},Sj={key:0,class:"bg-white border rounded-xl"},Ej={class:"p-[10px] pl-[20px] text-md font-[500]"},Cj=["innerHTML"],Tj={key:1},Mj={key:0,class:"p-[10px] pl-[20px] text-md font-[500]"},Aj={key:2,class:"p-[20px] border-t"},Ij=["innerHTML"],Pj={class:"flex space-x-1 w-full bg-white border border-b-0 rounded-tr-xl rounded-tl-xl h-[60px] items-center pl-[20px]"},Dj=["onClick"],Oj={key:0,class:"bg-white border border-t-0 rounded-bl-xl rounded-br-xl"},zj={key:0,class:"p-[20px] border-t"},Bj={key:1,class:"p-[20px] border-t"},Nj=["innerHTML"],Rj={key:3,class:"flex"},Lj={class:"flex flex-col space-y-2 w-[200px] border rounded-xl mr-4 h-auto items-start pl-[10px] bg-white py-[20px]"},Vj=["onClick"],Fj={class:"flex-grow"},$j={key:0,class:"h-full bg-white border rounded-xl"},jj={key:0,class:"p-[20px]"},Uj={key:1,class:"p-[20px] border-t"},Hj=["innerHTML"];function qj(t,e,n,i,r,a){var l,g;const u=f.resolveComponent("AdminCardHeader");return f.openBlock(),f.createElementBlock("div",kj,[((l=r.objectData)==null?void 0:l.isHeader)!==!1?(f.openBlock(),f.createBlock(u,{key:0,title:a.getTitle,"get-route":a.getRoute},null,8,["title","get-route"])):f.createCommentVNode("",!0),f.createElementVNode("div",{class:f.normalizeClass(["grid gap-[20px]",a.getGridClass()])},[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((g=r.objectData)==null?void 0:g.panels,(b,S)=>{var E;return f.openBlock(),f.createElementBlock("div",{key:S,class:f.normalizeClass(a.getColClass(b.col))},[b!=null&&b.name?(f.openBlock(),f.createElementBlock("div",Sj,[f.createElementVNode("h2",Ej,f.toDisplayString((b==null?void 0:b.title)||"Панель"),1),f.createElementVNode("div",{class:"p-[20px] border-t",innerHTML:(E=r.objectData)==null?void 0:E.data[b==null?void 0:b.name]},null,8,Cj)])):b.type==="container"?(f.openBlock(),f.createElementBlock("div",Tj,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(b.items,(C,P)=>{var D,R,j,W,ee;return f.openBlock(),f.createElementBlock("div",{key:P,class:f.normalizeClass([{"mb-[20px]":b.items.length>1},"bg-white border rounded-xl"])},[C!=null&&C.title?(f.openBlock(),f.createElementBlock("h2",Mj,f.toDisplayString((C==null?void 0:C.title)||"Панель"),1)):f.createCommentVNode("",!0),C!=null&&C.component?(f.openBlock(),f.createElementBlock("div",{key:1,class:f.normalizeClass(["p-[20px]",{"border-t":C==null?void 0:C.title}])},[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(C.component),{geometry:(R=(D=r.objectData)==null?void 0:D.rows[0])==null?void 0:R.geom,zoom:16,id:(W=(j=t.$route)==null?void 0:j.params)==null?void 0:W.id},null,8,["geometry","id"]))],2)):f.createCommentVNode("",!0),C!=null&&C.name?(f.openBlock(),f.createElementBlock("div",Aj,[f.createElementVNode("div",{innerHTML:(ee=r.objectData)==null?void 0:ee.data[C==null?void 0:C.name]},null,8,Ij)])):f.createCommentVNode("",!0)],2)}),128))])):f.createCommentVNode("",!0),(b==null?void 0:b.type)==="tabs"?(f.openBlock(),f.createElementBlock(f.Fragment,{key:2},[f.createElementVNode("nav",Pj,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(b==null?void 0:b.items,C=>(f.openBlock(),f.createElementBlock("button",{key:(C==null?void 0:C.name)||(C==null?void 0:C.component),onClick:P=>r.component=(C==null?void 0:C.component)||(C==null?void 0:C.name),class:f.normalizeClass(["px-2.5 h-[30px] py-1.5 relative inline-flex items-center gap-x-2 text-gray-500 hover:bg-gray-100 focus:bg-gray-100 hover:text-gray-800 text-sm whitespace-nowrap rounded-lg focus:outline-none",{" font-semibold after:absolute after:bottom-[-14px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:bg-gray-800":r.component===(C==null?void 0:C.component)||r.component===(C==null?void 0:C.name),"":r.component!==(C==null?void 0:C.component)&&r.component!==(C==null?void 0:C.name)}])},f.toDisplayString(C==null?void 0:C.title),11,Dj))),128))]),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(b.items,(C,P)=>{var D,R,j,W,ee;return f.openBlock(),f.createElementBlock(f.Fragment,{key:P},[r.component===(C==null?void 0:C.component)||r.component===(C==null?void 0:C.name)?(f.openBlock(),f.createElementBlock("div",Oj,[C!=null&&C.component?(f.openBlock(),f.createElementBlock("div",zj,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(C.component),{geometry:(R=(D=r.objectData)==null?void 0:D.rows[0])==null?void 0:R.geom,zoom:16,id:(W=(j=t.$route)==null?void 0:j.params)==null?void 0:W.id},null,8,["geometry","id"]))])):f.createCommentVNode("",!0),C!=null&&C.name?(f.openBlock(),f.createElementBlock("div",Bj,[f.createElementVNode("div",{innerHTML:(ee=r.objectData)==null?void 0:ee.data[C==null?void 0:C.name]},null,8,Nj)])):f.createCommentVNode("",!0)])):f.createCommentVNode("",!0)],64)}),128))],64)):f.createCommentVNode("",!0),(b==null?void 0:b.type)==="vertical-tabs"?(f.openBlock(),f.createElementBlock("div",Rj,[f.createElementVNode("nav",Lj,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(b==null?void 0:b.items,C=>(f.openBlock(),f.createElementBlock("button",{key:(C==null?void 0:C.name)||(C==null?void 0:C.component),onClick:P=>r.component=(C==null?void 0:C.component)||(C==null?void 0:C.name),class:f.normalizeClass(["relative inline-flex items-center w-full py-1 text-sm border-transparent pe-4 gap-x-2 border-e-2 whitespace-nowrap hover:text-blue-600 focus:outline-none focus:text-blue-600",{"font-semibold after:absolute after:top-[0] after:right-[-1px] after:h-full text-blue-600 after:w-[2px] after:bg-blue-600 ":r.component===(C==null?void 0:C.component)||r.component===(C==null?void 0:C.name),"text-gray-500":r.component!==(C==null?void 0:C.component)&&r.component!==(C==null?void 0:C.name)}])},f.toDisplayString(C==null?void 0:C.title),11,Vj))),128))]),f.createElementVNode("div",Fj,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(b.items,(C,P)=>{var D,R,j,W,ee;return f.openBlock(),f.createElementBlock(f.Fragment,{key:P},[r.component===(C==null?void 0:C.component)||r.component===(C==null?void 0:C.name)?(f.openBlock(),f.createElementBlock("div",$j,[C!=null&&C.component?(f.openBlock(),f.createElementBlock("div",jj,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(C.component),{geometry:(R=(D=r.objectData)==null?void 0:D.rows[0])==null?void 0:R.geom,zoom:16,id:(W=(j=t.$route)==null?void 0:j.params)==null?void 0:W.id},null,8,["geometry","id"]))])):f.createCommentVNode("",!0),C!=null&&C.name?(f.openBlock(),f.createElementBlock("div",Uj,[f.createElementVNode("div",{innerHTML:(ee=r.objectData)==null?void 0:ee.data[C==null?void 0:C.name]},null,8,Hj)])):f.createCommentVNode("",!0)])):f.createCommentVNode("",!0)],64)}),128))])])):f.createCommentVNode("",!0)],2)}),128))],2)])}const Wj=Object.freeze(Object.defineProperty({__proto__:null,default:$e(wj,[["render",qj],["__scopeId","data-v-3dcf3635"]])},Symbol.toStringTag,{value:"Module"})),Gj={},Zj={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-logout"};function Yj(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",Zj,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"},null,-1),f.createElementVNode("path",{d:"M9 12h12l-3 -3"},null,-1),f.createElementVNode("path",{d:"M18 15l3 -3"},null,-1)]))}const Xj=$e(Gj,[["render",Yj]]),Kj={},Jj={viewBox:"0 0 1823 249",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Qj(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",Jj,e[0]||(e[0]=[f.createStaticVNode('<path d="M218.88 96.05C223.55 99.19 228.69 101.56 234.09 103.07V145.42C212.05 151.54 195.83 171.79 195.83 195.75C195.83 200.22 196.41 204.65 197.53 208.94L160.92 230.08C156.82 226.06 152.08 222.73 146.91 220.24V171.62C164.83 163.13 176.59 145.06 176.59 124.48C176.59 123.17 176.54 121.86 176.44 120.56L218.88 96.05ZM220.32 79.09L160.97 113.36C162.04 116.88 162.61 120.61 162.61 124.48C162.61 142.66 149.93 157.87 132.93 161.76V230.05C143.4 232.46 152.23 239.16 157.46 248.21L215 214.99C211.7 209.34 209.81 202.77 209.81 195.75C209.81 174.62 226.94 157.49 248.07 157.49V91.02C237.14 91.02 227.29 86.43 220.32 79.09Z" fill="#CE3936"></path><path d="M161.39 19.13L197.44 39.94C196.39 44.11 195.84 48.42 195.84 52.75C195.84 54.21 195.9 55.65 196.02 57.1L153.9 81.42C145.27 75.5 134.95 72.24 124.36 72.24C113.83 72.24 103.57 75.47 94.96 81.32L52.71 56.93C52.82 55.55 52.88 54.16 52.88 52.76C52.88 48.43 52.34 44.12 51.28 39.95L87.3 19.16C96.98 28.89 110.26 34.58 124.34 34.58C138.42 34.57 151.7 28.87 161.39 19.13ZM157.77 0.919983C151.24 12.66 138.71 20.6 124.33 20.6C109.95 20.6 97.44 12.67 90.9 0.939983L33.9 33.85C37.08 39.43 38.91 45.88 38.91 52.76C38.91 56.71 38.31 60.52 37.2 64.11L96.46 98.32C103.44 90.87 113.36 86.22 124.37 86.22C135.44 86.22 145.41 90.93 152.39 98.44L211.59 64.27C210.45 60.64 209.83 56.78 209.83 52.77C209.83 45.89 211.65 39.44 214.84 33.86L157.77 0.919983Z" fill="#CE3936"></path><path d="M29.97 95.95L72.28 120.38C72.17 121.74 72.12 123.1 72.12 124.47C72.12 145.02 83.86 163.08 101.74 171.58V220.23C96.58 222.71 91.84 226.04 87.75 230.05L51.17 208.93C52.29 204.64 52.87 200.21 52.87 195.74C52.87 171.78 36.65 151.53 14.61 145.41V103.06C20.07 101.55 25.27 99.14 29.97 95.95ZM28.5 78.97C21.52 86.38 11.63 91.02 0.640015 91.02V157.49C21.77 157.49 38.9 174.62 38.9 195.75C38.9 202.77 37 209.33 33.71 214.99L91.2 248.18C96.43 239.14 105.25 232.45 115.71 230.04V161.73C98.74 157.81 86.09 142.62 86.09 124.46C86.09 120.54 86.68 116.75 87.78 113.18L28.5 78.97Z" fill="#CE3936"></path><path d="M498.39 177.5V144.88C498.39 128.55 485.11 115.27 468.78 115.27H343.22C342.69 115.27 342.18 115.32 341.67 115.4H337.19C332.35 115.4 328.42 111.46 328.42 106.63V74C328.42 69.16 332.36 65.23 337.19 65.23H486.33C492.08 65.23 496.75 60.57 496.75 54.81C496.75 49.06 492.08 44.39 486.33 44.39H337.19C320.86 44.39 307.58 57.67 307.58 74V106.62C307.58 122.95 320.86 136.23 337.19 136.23H462.75C463.28 136.23 463.79 136.18 464.3 136.1H468.78C473.62 136.1 477.55 140.04 477.55 144.87V177.49C477.55 182.33 473.61 186.26 468.78 186.26H319.64C313.89 186.26 309.22 190.92 309.22 196.68C309.22 202.43 313.89 207.1 319.64 207.1H468.78C485.11 207.11 498.39 193.83 498.39 177.5Z" fill="#CE3935"></path><path d="M710.7 177.32V75.24C710.7 58.91 697.42 45.63 681.09 45.63H550.05C533.72 45.63 520.44 58.91 520.44 75.24V177.32C520.44 193.65 533.72 206.93 550.05 206.93H681.1C697.42 206.93 710.7 193.65 710.7 177.32ZM541.27 75.24C541.27 70.4 545.21 66.47 550.04 66.47H681.09C685.93 66.47 689.86 70.41 689.86 75.24V177.32C689.86 182.16 685.92 186.09 681.09 186.09H550.05C545.21 186.09 541.28 182.15 541.28 177.32V75.24H541.27Z" fill="#CE3935"></path><path d="M1823 177.32V75.24C1823 58.91 1809.72 45.63 1793.39 45.63H1662.34C1646.01 45.63 1632.73 58.91 1632.73 75.24V177.32C1632.73 193.65 1646.01 206.93 1662.34 206.93H1793.39C1809.72 206.93 1823 193.65 1823 177.32ZM1653.57 75.24C1653.57 70.4 1657.51 66.47 1662.34 66.47H1793.39C1798.23 66.47 1802.16 70.41 1802.16 75.24V177.32C1802.16 182.16 1798.22 186.09 1793.39 186.09H1662.34C1657.5 186.09 1653.57 182.15 1653.57 177.32V75.24Z" fill="#CE3935"></path><path d="M756.76 196.51V152H849.42C855.17 152 859.84 147.34 859.84 141.58C859.84 135.83 855.17 131.16 849.42 131.16H756.76V75.23C756.76 70.39 760.7 66.46 765.53 66.46H893.29C899.04 66.46 903.71 61.8 903.71 56.04C903.71 50.29 899.04 45.62 893.29 45.62H765.53C749.2 45.62 735.92 58.9 735.92 75.23V196.5C735.92 202.25 740.59 206.92 746.34 206.92C752.09 206.93 756.76 202.27 756.76 196.51Z" fill="#CE3935"></path><path d="M933.86 66.47H1006.51V194.32C1006.51 200.07 1011.18 204.74 1016.93 204.74C1022.68 204.74 1027.35 200.07 1027.35 194.32V66.47H1100C1105.75 66.47 1110.42 61.81 1110.42 56.05C1110.42 50.3 1105.76 45.63 1100 45.63H933.86C928.11 45.63 923.44 50.29 923.44 56.05C923.45 61.81 928.11 66.47 933.86 66.47Z" fill="#CE3935"></path><path d="M1218.44 204.19C1224.19 204.19 1228.86 199.53 1228.86 193.77V152H1368.13C1384.46 152 1397.74 138.72 1397.74 122.39V75.24C1397.74 58.91 1384.46 45.63 1368.13 45.63H1237.63C1221.3 45.63 1208.02 58.91 1208.02 75.24V193.77C1208.02 199.53 1212.68 204.19 1218.44 204.19ZM1237.63 66.47H1368.13C1372.97 66.47 1376.9 70.41 1376.9 75.24V122.39C1376.9 127.23 1372.96 131.16 1368.13 131.16H1228.86V75.23C1228.86 70.41 1232.79 66.47 1237.63 66.47Z" fill="#CE3935"></path><path d="M1430.64 204.19C1436.39 204.19 1441.06 199.53 1441.06 193.77V152H1523.95C1524.57 153.18 1525.42 154.26 1526.51 155.17L1581.89 201.23C1583.83 202.85 1586.2 203.64 1588.55 203.64C1591.54 203.64 1594.5 202.36 1596.57 199.88C1600.25 195.46 1599.64 188.89 1595.22 185.21L1555.29 152H1580.33C1596.66 152 1609.94 138.72 1609.94 122.39V75.24C1609.94 58.91 1596.66 45.63 1580.33 45.63H1449.83C1433.5 45.63 1420.22 58.91 1420.22 75.24V193.77C1420.22 199.53 1424.88 204.19 1430.64 204.19ZM1449.83 66.47H1580.33C1585.17 66.47 1589.1 70.41 1589.1 75.24V122.39C1589.1 127.23 1585.17 131.16 1580.33 131.16H1441.06V75.23C1441.05 70.41 1444.99 66.47 1449.83 66.47Z" fill="#CE3935"></path>',10)]))}const e7=$e(Kj,[["render",Qj]]),t7={},n7={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function i7(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",n7,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const DS=$e(t7,[["render",i7]]),r7={components:{IconChevronDown:DS},props:{route:Object},mounted(){var t,e,n;(t=this.route)!=null&&t.menu&&(n=(e=this.route)==null?void 0:e.menu)!=null&&n.some(i=>{var r,a;return(i==null?void 0:i.path)===this.$route.path.replace("/","")||((a=(r=this.$route)==null?void 0:r.params)==null?void 0:a.table)===(i==null?void 0:i.table)&&(i==null?void 0:i.table)})&&(this.isOpen=!0)},data(){return{isOpen:!1}}},s7={key:0,class:""},o7={class:"ml-[30px] py-[6px] before:block before:absolute relative w-[196px] flex flex-col gap-[6px] inline-block before:w-[2px] before:h-[100%] before:bg-gray-100 before:left-[-14px] cursor-pointer"},a7={key:1};function l7(t,e,n,i,r,a){var g,b,S,E,C,P,D,R,j,W,ee,le,J;const u=f.resolveComponent("IconChevronDown"),l=f.resolveComponent("router-link");return(g=n.route)!=null&&g.menu?(f.openBlock(),f.createElementBlock("div",s7,[f.createElementVNode("button",{onClick:e[0]||(e[0]=Te=>r.isOpen=!r.isOpen),class:f.normalizeClass(["flex cursor-pointer gap-x-3 py-2 px-3 text-sm text-gray-800 justify-start w-full border-none focus:outline-none text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300",[((S=(b=n.route)==null?void 0:b.menu)==null?void 0:S.some(Te=>{var xe,Ae;return(Te==null?void 0:Te.path)===t.$route.path.replace("/","")||(Te==null?void 0:Te.table)===((Ae=(xe=t.$route)==null?void 0:xe.params)==null?void 0:Ae.table)&&(Te==null?void 0:Te.table)}))&&"bg-gray-100"]])},[f.createTextVNode(f.toDisplayString((E=n.route)==null?void 0:E.ua)+" ",1),f.createVNode(u,{class:f.normalizeClass([[r.isOpen&&"-rotate-180"],"ml-auto duration-300"]),width:"14",height:"14"},null,8,["class"])],2),f.createVNode(f.Transition,{name:"fade"},{default:f.withCtx(()=>{var Te;return[f.withDirectives(f.createElementVNode("ul",o7,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Te=n.route)==null?void 0:Te.menu,(xe,Ae)=>{var je,De;return f.openBlock(),f.createElementBlock("li",{key:Ae,class:"w-full"},[f.createVNode(l,{to:"/"+(xe==null?void 0:xe.path),class:f.normalizeClass([[((xe==null?void 0:xe.path)===t.$route.path.replace("/","")||((De=(je=t.$route)==null?void 0:je.params)==null?void 0:De.table)===(xe==null?void 0:xe.table)&&(xe==null?void 0:xe.table))&&"bg-gray-100"],"flex gap-x-4 py-2 px-3 text-sm text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100"])},{default:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(xe==null?void 0:xe.ua),1)]),_:2},1032,["to","class"])])}),128))],512),[[f.vShow,r.isOpen]])]}),_:1})])):(f.openBlock(),f.createElementBlock("div",a7,[f.createVNode(l,{to:((P=(C=n.route)==null?void 0:C.path)==null?void 0:P[0])==="/"?(D=n.route)==null?void 0:D.path:"/"+((R=n.route)==null?void 0:R.path),class:f.normalizeClass([[(((j=n.route)==null?void 0:j.path.replace("/",""))===t.$route.path.replace("/","")||((ee=(W=t.$route)==null?void 0:W.params)==null?void 0:ee.table)===((le=n.route)==null?void 0:le.table)&&((J=n.route)==null?void 0:J.table))&&"bg-gray-100"],"flex gap-x-3 py-2 w-full font-[400] px-3 text-sm text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300 hover:text-gray-800"])},{default:f.withCtx(()=>{var Te;return[f.createTextVNode(f.toDisplayString((Te=n.route)==null?void 0:Te.ua),1)]}),_:1},8,["to","class"])]))}const c7={components:{IconLogout:Xj,NavbarItem:$e(r7,[["render",l7]]),IconLogo:e7,IconSearch:J0},data(){return{activeIndex:null,searchValue:""}},computed:{data(){var t,e;return(t=this.searchValue)!=null&&t.trim()?(e=this.flattenMenu(Ss.value))==null?void 0:e.filter(n=>{var i,r,a;return(a=(i=n==null?void 0:n.ua)==null?void 0:i.toLowerCase())==null?void 0:a.includes((r=this.searchValue)==null?void 0:r.toLowerCase())}):Ss.value},logo(){var t;return((t=hl.value)==null?void 0:t.logo)||"/assets/logo.svg"}},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e}}},u7={class:"flex flex-col h-[100vh] border-r w-[260px] shrink-0"},h7=["src"],d7={class:"relative"},p7={class:"p-[16px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},f7={class:"flex flex-col flex-wrap w-full pb-3"},m7={key:0,class:"flex flex-col gap-[6px]"},g7={key:1,class:"text-gray-800 text-lg mt-[20px]"};function y7(t,e,n,i,r,a){var b;const u=f.resolveComponent("IconSearch"),l=f.resolveComponent("VsText"),g=f.resolveComponent("NavbarItem");return f.openBlock(),f.createElementBlock("div",u7,[f.createElementVNode("img",{src:a.logo,height:"40",width:"200",class:"my-[20px] ml-[20px]"},null,8,h7),f.createElementVNode("div",d7,[f.createVNode(u,{height:"16",width:"16",class:"absolute top-[12px] left-[30px] text-gray-500 z-[1]"}),f.createVNode(l,{type:"text",modelValue:r.searchValue,"onUpdate:modelValue":e[0]||(e[0]=S=>r.searchValue=S),clearable:!0,placeholder:"Пошук по меню",class:"[&>input]:h-[40px] [&>input]:block [&>input]:rounded-none [&>input]:border-x-0 [&>input]:pl-[60px] [&>input:focus]:outline-none [&>input:focus]:focus:ring-0 [&>input:focus]:border-y-gray-200 [&>input:focus]:border-y-1 [&>input:focus]:border-x-0"},null,8,["modelValue"])]),f.createElementVNode("div",p7,[f.createElementVNode("nav",f7,[(b=a.data)!=null&&b.length?(f.openBlock(),f.createElementBlock("ul",m7,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.data,(S,E)=>(f.openBlock(),f.createElementBlock("li",{key:E,class:"flex flex-col gap-[6px]"},[f.createVNode(g,{route:S},null,8,["route"])]))),128))])):(f.openBlock(),f.createElementBlock("div",g7,"Не знайдено"))])])])}const _7=$e(c7,[["render",y7]]),b7={},x7={class:"shrink-0",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"};function v7(t,e){return f.openBlock(),f.createElementBlock("svg",x7,e[0]||(e[0]=[f.createElementVNode("path",{d:"M18 6 7 17l-5-5"},null,-1),f.createElementVNode("path",{d:"m22 10-7.5 7.5L13 16"},null,-1)]))}const w7=$e(b7,[["render",v7]]),k7={},S7={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-user"};function E7(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",S7,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M12 2a5 5 0 1 1 -5 5l.005 -.217a5 5 0 0 1 4.995 -4.783z"},null,-1),f.createElementVNode("path",{d:"M14 14a5 5 0 0 1 5 5v1a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-1a5 5 0 0 1 5 -5h4z"},null,-1)]))}const OS=$e(k7,[["render",E7]]),C7={},T7={class:"shrink-0 size-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"};function M7(t,e){return f.openBlock(),f.createElementBlock("svg",T7,e[0]||(e[0]=[f.createElementVNode("polyline",{points:"9 11 12 14 22 4"},null,-1),f.createElementVNode("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"},null,-1)]))}const A7=$e(C7,[["render",M7]]),I7={class:"relative shrink-0"},P7=["src"],D7={key:1,class:"h-[38px] w-[38px] bg-gray-200 rounded-full flex items-center justify-center"},O7={key:2,class:"absolute top-4 -start-3 size-2 bg-blue-600 rounded-full dark:bg-blue-500"},z7={class:"grow"},B7={class:"text-xs text-gray-500 dark:text-neutral-500"},N7={class:"block text-sm font-medium text-gray-800 dark:text-neutral-300"},R7={class:"text-sm text-gray-500 dark:text-neutral-500"},L7={key:0,class:"sm:group-hover:opacity-100 sm:opacity-0 sm:absolute sm:top-5 sm:end-5 inline-block p-0.5 bg-white border border-gray-200 rounded-lg shadow-sm transition ease-out"},V7={__name:"admin-notification-item",props:{item:Object},emits:["update-notification"],setup(t,{emit:e}){const n=e,i=f.ref(!1),r=()=>i.value=!0,a=()=>i.value=!1,u=async()=>{var l;try{await ct.get(`/api/notification-read/${(l=t.item)==null?void 0:l.id}`),await n("update-notification")}catch{}};return(l,g)=>{var S,E,C,P,D,R;const b=f.resolveComponent("VsPopover");return f.openBlock(),f.createElementBlock("li",{class:f.normalizeClass(["relative group w-full flex gap-x-5 text-start p-5 border-b",[(S=t.item)!=null&&S.read?"bg-gray-100":"bg-white"]]),onMouseenter:r,onMouseleave:a},[f.createElementVNode("div",I7,[(E=t.item)!=null&&E.avatar?(f.openBlock(),f.createElementBlock("img",{key:0,class:"shrink-0 size-[38px] rounded-full",src:(C=t.item)==null?void 0:C.avatar,alt:"Avatar"},null,8,P7)):(f.openBlock(),f.createElementBlock("div",D7,[f.createVNode(OS)])),(P=t.item)!=null&&P.read?(f.openBlock(),f.createElementBlock("span",O7)):f.createCommentVNode("",!0)]),f.createElementVNode("div",z7,[f.createElementVNode("p",B7,[f.createVNode(oy,{name:"cdate",data:t.item},null,8,["data"])]),f.createElementVNode("span",N7,f.toDisplayString((D=t.item)==null?void 0:D.author),1),f.createElementVNode("p",R7,f.toDisplayString((R=t.item)==null?void 0:R.subject),1)]),i.value?(f.openBlock(),f.createElementBlock("div",L7,[f.createVNode(b,{trigger:"hover",placement:"left"},{reference:f.withCtx(()=>[f.createElementVNode("button",{onClick:u,type:"button",class:"hs-tooltip-toggle hs-tooltip relative inline-block size-7 flex shrink-0 justify-center items-center text-gray-500 hover:bg-gray-100 hover:text-gray-800 rounded"},[f.createVNode(A7)])]),default:f.withCtx(()=>[g[0]||(g[0]=f.createTextVNode(" Прочитати "))]),_:1})])):f.createCommentVNode("",!0)],34)}}},F7={},$7={class:"flex-shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function j7(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",$7,e[0]||(e[0]=[f.createElementVNode("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"},null,-1),f.createElementVNode("path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"},null,-1)]))}const U7=$e(F7,[["render",j7]]),H7={},q7={class:"shrink-0 size-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"};function W7(t,e){return f.openBlock(),f.createElementBlock("svg",q7,e[0]||(e[0]=[f.createElementVNode("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"},null,-1),f.createElementVNode("circle",{cx:"12",cy:"12",r:"3"},null,-1)]))}const G7=$e(H7,[["render",W7]]),Z7={key:0,class:"flex absolute top-0 end-0 -mt-1.5 -me-1.5"},Y7={class:"relative min-w-[18px] min-h-[18px] inline-flex justify-center items-center text-[10px] bg-red-500 text-white rounded-full px-1"},X7={key:0,class:"w-96 h-[100px] z-[11] absolute top-[40px] right-0"},K7={class:"h-[50px] px-[20px] border-b w-full flex items-center justify-between rounded-t-lg bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)]"},J7={class:"h-[30px] w-[30px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100"},Q7={class:"max-h-[400px] bg-white overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300"},e9={key:0},t9={__name:"admin-notification",setup(t){var b,S,E,C,P;const e=f.ref(0),n=f.ref([]),i=f.ref(!1),r=f.ref(null),a=(P=(C=(E=(S=(b=f.getCurrentInstance())==null?void 0:b.appContext)==null?void 0:S.app)==null?void 0:E.config)==null?void 0:C.globalProperties)==null?void 0:P.$notify,u=D=>{r.value&&!r.value.contains(D.target)&&(i.value=!1)};f.watch(i,D=>{D?window.addEventListener("click",u):window.removeEventListener("click",u)}),f.onBeforeUnmount(()=>{window.removeEventListener("click",u)});const l=async()=>{try{const{data:D}=await ct.get("/api/notification");n.value=(D==null?void 0:D.rows)||[]}catch{a({type:"error",message:"При спробі завантаження нотифікацій виникла помилка",title:"Помилка!"})}};l();const g=async()=>{try{await ct.get("/api/notification-read"),await l()}catch{a({type:"error",message:"Виникла помилка",title:"Помилка!"})}};return(D,R)=>(f.openBlock(),f.createElementBlock("div",{ref_key:"notificationRef",ref:r,class:"hs-tooltip [--placement:bottom] inline-block show relative"},[f.createElementVNode("button",{onClick:R[0]||(R[0]=j=>i.value=!i.value),class:"hs-tooltip-toggle relative size-[38px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100"},[f.createVNode(U7,{height:"24",width:"24"}),e.value?(f.openBlock(),f.createElementBlock("span",Z7,[R[1]||(R[1]=f.createElementVNode("span",{class:"absolute inline-flex bg-red-400 rounded-full opacity-75 animate-ping size-full dark:bg-red-600"},null,-1)),f.createElementVNode("span",Y7,f.toDisplayString(e.value),1)])):f.createCommentVNode("",!0)]),f.createVNode(f.Transition,null,{default:f.withCtx(()=>{var j;return[i.value?(f.openBlock(),f.createElementBlock("div",X7,[f.createElementVNode("div",K7,[R[2]||(R[2]=f.createElementVNode("nav",{class:"flex"},[f.createElementVNode("button",{type:"button",class:"px-2 py-1.5 relative inline-flex justify-center items-center gap-x-2 text-nowrap hover:bg-gray-100 text-gray-500 hover:text-gray-800 text-sm rounded-lg focus:outline-none focus:bg-gray-100 after:absolute after:bottom-[-9px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:bg-gray-800"}," Всі ")],-1)),f.createElementVNode("button",J7,[f.createVNode(G7)])]),f.createElementVNode("div",Q7,[(j=n.value)!=null&&j.length?(f.openBlock(),f.createElementBlock("ul",e9,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.value,W=>(f.openBlock(),f.createBlock(V7,{key:W==null?void 0:W.id,item:W,onUpdateNotification:l},null,8,["item"]))),128))])):f.createCommentVNode("",!0)]),f.createElementVNode("button",{onClick:g,class:"h-[50px] border-t w-full rounded-b-lg bg-white shadow p-4 flex justify-center items-center gap-x-2 text-sm text-gray-500 font-medium sm:rounded-b-lg hover:text-blue-600 focus:outline-none"},[f.createVNode(w7,{height:"16",width:"16"}),R[3]||(R[3]=f.createTextVNode(" Прочитати усі "))])])):f.createCommentVNode("",!0)]}),_:1})],512))}},n9={},i9={class:"flex-shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function r9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",i9,e[0]||(e[0]=[f.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),f.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"},null,-1),f.createElementVNode("path",{d:"M12 17h.01"},null,-1)]))}const s9={components:{IconQuestion:$e(n9,[["render",r9]]),IconUser:OS,AdminNotification:t9},mounted(){this.getUserData()},data(){return{userData:null,isVisible:!1}},watch:{isVisible(t){t?setTimeout(()=>window.addEventListener("click",this.closeOnOutsideClick),0):window.removeEventListener("click",this.closeOnOutsideClick)}},methods:{async getUserData(){try{const{data:t}=await ct.get("/user");this.userData=t}catch{}},async logout(){try{await ct.get("/logout"),await window.history.pushState({},"","/login"),await location.reload(),localStorage.removeItem("user")}catch{}},closeOnOutsideClick(){this.isVisible=!1}},beforeUnmount(){window.removeEventListener("click",this.closeOnOutsideClick)}},o9={class:"h-[60px] border-b flex justify-end px-[20px]",style:{width:"calc(100vw - 260px)"}},a9={class:"flex items-center gap-[6px]"},l9={href:"docs-softpro.com",class:"size-[38px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},c9={class:"relative"},u9=["src"],h9={key:1,class:"size-[40px] rounded-full bg-gray-200 flex items-center justify-center"},d9={class:"p-[10px] gap-[6px] items-center border-b flex justify-between"},p9=["src"],f9={key:1,class:"size-[40px] rounded-full bg-gray-200 flex items-center justify-center"},m9={class:"text-[14px] mr-[10px] text-gray-500"},g9={class:"flex flex-col p-[4px]"};function y9(t,e,n,i,r,a){var S,E,C,P,D,R,j,W,ee,le;const u=f.resolveComponent("IconQuestion"),l=f.resolveComponent("AdminNotification"),g=f.resolveComponent("IconUser"),b=f.resolveComponent("router-link");return f.openBlock(),f.createElementBlock("div",o9,[f.createElementVNode("div",a9,[f.createElementVNode("a",l9,[f.createVNode(u,{height:"24",width:"24"})]),f.createVNode(l),e[4]||(e[4]=f.createElementVNode("div",{class:"h-[30px] w-[1px] bg-gray-200 ml-[10px] mr-[10px]"},null,-1)),f.createElementVNode("div",c9,[f.createElementVNode("div",{onClick:e[0]||(e[0]=J=>r.isVisible=!0),class:"cursor-pointer"},[(E=(S=r.userData)==null?void 0:S.user)!=null&&E.avatar?(f.openBlock(),f.createElementBlock("img",{key:0,class:"flex-shrink-0 size-[30px] rounded-full",src:(P=(C=r.userData)==null?void 0:C.user)==null?void 0:P.avatar,alt:"Image Description"},null,8,u9)):(f.openBlock(),f.createElementBlock("div",h9,[f.createVNode(g)]))]),r.isVisible?(f.openBlock(),f.createElementBlock("div",{key:0,onClick:e[2]||(e[2]=f.withModifiers(()=>{},["stop"])),class:"fixed bg-white w-[180px] top-[55px] right-[20px] shadow-xl rounded-xl z-[1]"},[f.createElementVNode("div",d9,[(R=(D=r.userData)==null?void 0:D.user)!=null&&R.avatar?(f.openBlock(),f.createElementBlock("img",{key:0,class:"flex-shrink-0 size-[30px] rounded-full",src:(W=(j=r.userData)==null?void 0:j.user)==null?void 0:W.avatar,alt:"Image Description"},null,8,p9)):(f.openBlock(),f.createElementBlock("div",f9,[f.createVNode(g)])),f.createElementVNode("div",null,[f.createElementVNode("p",m9,f.toDisplayString((le=(ee=r.userData)==null?void 0:ee.user)==null?void 0:le.username),1)])]),f.createElementVNode("div",g9,[f.createVNode(b,{to:"profile",disabled:!0,class:"p-[8px] block rounded-lg w-full mb-[4px] text-start hover:bg-gray-100 !duration-300"},{default:f.withCtx(()=>e[3]||(e[3]=[f.createTextVNode("Профіль")])),_:1}),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...J)=>a.logout&&a.logout(...J)),class:"p-[8px] block rounded-lg w-full text-start hover:bg-gray-100 !duration-300"}," Вийти ")])])):f.createCommentVNode("",!0)])])])}const _9={components:{navbar:_7,AdminHeader:$e(s9,[["render",y9]])},computed:{isMenu(){return Ss.value||null}}},b9={class:"admin-wrapper"},x9={class:"flex flex-col"};function v9(t,e,n,i,r,a){const u=f.resolveComponent("navbar"),l=f.resolveComponent("admin-header"),g=f.resolveComponent("router-view");return f.openBlock(),f.createElementBlock("div",b9,[f.createVNode(u),f.createElementVNode("div",x9,[a.isMenu?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[f.createVNode(l),f.createVNode(g)],64)):f.createCommentVNode("",!0)])])}const w9=Object.freeze(Object.defineProperty({__proto__:null,default:$e(_9,[["render",v9],["__scopeId","data-v-a53a7af5"]])},Symbol.toStringTag,{value:"Module"})),k9={data(){return{currentSort:""}},props:{data:{type:Object,default:()=>null},activeColumn:{type:String}},computed:{label(){var t,e;return((t=this.data)==null?void 0:t.ua)||((e=this.data)==null?void 0:e.label)||this.data.title||"null"},selectedSortParam(){var t,e;return(e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort},getVisibleIcon(){return this.data.format!=="image"&&this.data.format!=="verify"}},watch:{activeColumn(t){t!==this.data.name&&(this.currentSort="")}},methods:{changeCurrentSort(t){switch(t){case"":return"asc";case"asc":return"desc";case"desc":return"";default:return""}},handleClickSortBtn(t){this.$emit("change-active",this.data.name),this.currentSort=this.changeCurrentSort(t);const e=this.$route.query,{sort:n,...i}=e,r=this.currentSort?`${this.data.name}-${this.currentSort}`:"";this.$router.replace({query:{...i,...r&&{sort:r}}})},isValueEqualToSelected(t){return`${this.data.name}-${t}`===this.selectedSortParam}}},S9={scope:"col",class:"text-start px-2 py-1"},E9={class:"flex-shrink-0 size-3.5",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"},C9={key:0,d:"m7 15 5 5 5-5"},T9={key:1,d:"m7 9 5-5 5 5"},M9={key:1,class:"text-sm text-stone-500 px-[4px] py-2.5 text-start font-normal text-gray-500"};function A9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("th",S9,[a.getVisibleIcon?(f.openBlock(),f.createElementBlock("button",{key:0,type:"button",class:"text-sm text-stone-500 px-[4px] py-2.5 text-start font-normal text-gray-500 flex items-center gap-[6px]",onClick:e[0]||(e[0]=u=>a.handleClickSortBtn(r.currentSort))},[f.createTextVNode(f.toDisplayString(a.label)+" ",1),(f.openBlock(),f.createElementBlock("svg",E9,[r.currentSort==="asc"||r.currentSort===""?(f.openBlock(),f.createElementBlock("path",C9)):f.createCommentVNode("",!0),r.currentSort==="desc"||r.currentSort===""?(f.openBlock(),f.createElementBlock("path",T9)):f.createCommentVNode("",!0)]))])):(f.openBlock(),f.createElementBlock("p",M9,f.toDisplayString(a.label),1))])}const I9=$e(k9,[["render",A9]]),P9={},D9={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function O9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",D9,e[0]||(e[0]=[f.createStaticVNode('<path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"></path><line x1="10" x2="10" y1="11" y2="17"></line><line x1="14" x2="14" y1="11" y2="17"></line>',5)]))}const z9=$e(P9,[["render",O9]]),B9={props:{height:{type:String,default:"16"},width:{type:String,default:"12"},color:{type:String,default:"black"}}},N9={style:{display:"none"}},R9=["height","width","fill"];function L9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock(f.Fragment,null,[(f.openBlock(),f.createElementBlock("svg",N9,e[0]||(e[0]=[f.createElementVNode("symbol",{id:"icon-pencil",viewBox:"0 0 32 32"},[f.createElementVNode("path",{d:"M27 0c2.761 0 5 2.239 5 5 0 1.126-0.372 2.164-1 3l-2 2-7-7 2-2c0.836-0.628 1.874-1 3-1zM2 23l-2 9 9-2 18.5-18.5-7-7-18.5 18.5zM22.362 11.362l-14 14-1.724-1.724 14-14 1.724 1.724z"})],-1)]))),(f.openBlock(),f.createElementBlock("svg",{height:n.height,width:n.width,fill:n.color},e[1]||(e[1]=[f.createElementVNode("use",{"xlink:href":"#icon-pencil"},null,-1)]),8,R9))],64)}const V9={components:{IconMore:SS,IconDelete:z9,IconEdit:$e(B9,[["render",L9]])},emits:["updateTable"],props:{item:Object,table:String,isForm:null,actions:Array,default:()=>[]},data(){return{formVisible:!1,isDeleteConfirm:!1,formValue:{},top:0,left:0}},methods:{openConfirm(){this.isDeleteConfirm=!0,document.querySelector("body").click()},async getData(){var t;try{const{data:e}=await ct.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);this.formValue=e}catch(e){console.error(e)}},doSomethingOnCancel(){this.formVisible=!1},async deleteElement(){var t;try{const{data:e}=await ct.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);await ct.delete(`/api/table/${e==null?void 0:e.token}`),await this.$notify({title:"Успішно!",message:"Об`єкт успішно видалeно",type:"success"}),await this.$emit("update-table")}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}finally{this.isDeleteConfirm=!1}}}},F9={class:"hs-dropdown [--placement:bottom-right] inline-flex"},$9={class:"inline-flex items-center justify-center bg-white border rounded-lg shadow-sm size-7 gap-x-2 border-stone-200 text-stone-800 hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-50"},j9={class:"flex flex-col items-start"},U9={key:1,class:"h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto"},H9={class:"p-4"},q9={class:"flex justify-end mt-4 gap-x-3"};function W9(t,e,n,i,r,a){const u=f.resolveComponent("IconMore"),l=f.resolveComponent("IconEdit"),g=f.resolveComponent("router-link"),b=f.resolveComponent("IconDelete"),S=f.resolveComponent("VsPopover"),E=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("div",F9,[f.createVNode(S,{trigger:"click",placement:"bottom-left"},{reference:f.withCtx(()=>[f.createElementVNode("button",$9,[f.createVNode(u,{height:"16",width:"16"})])]),default:f.withCtx(()=>{var C,P,D,R,j;return[f.createElementVNode("div",j9,[(C=n.actions)!=null&&C.includes("edit")&&n.isForm?(f.openBlock(),f.createBlock(g,{key:0,to:`/edit?table=${(D=(P=t.$route)==null?void 0:P.params)==null?void 0:D.catchAll}&id=${(R=n.item)==null?void 0:R.id}`,class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},{default:f.withCtx(()=>[f.createVNode(l,{color:"#000"}),e[4]||(e[4]=f.createTextVNode(" Редагувати "))]),_:1},8,["to"])):f.createCommentVNode("",!0),n.isForm?(f.openBlock(),f.createElementBlock("div",U9)):f.createCommentVNode("",!0),(j=n.actions)!=null&&j.includes("del")?(f.openBlock(),f.createElementBlock("button",{key:2,onClick:e[0]||(e[0]=f.withModifiers((...W)=>a.openConfirm&&a.openConfirm(...W),["stop"])),class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},[f.createVNode(b),e[5]||(e[5]=f.createElementVNode("span",{class:"text-gray-800"},"Видалити",-1))])):f.createCommentVNode("",!0)])]}),_:1})]),f.createVNode(E,{visible:r.isDeleteConfirm,"onUpdate:visible":e[3]||(e[3]=C=>r.isDeleteConfirm=C),size:"small",title:"Ви впевнені?"},{default:f.withCtx(()=>[f.createElementVNode("div",H9,[e[6]||(e[6]=f.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей об'єкт? ",-1)),f.createElementVNode("div",q9,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[1]||(e[1]=C=>r.isDeleteConfirm=!1)}," Скасувати "),f.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[2]||(e[2]=(...C)=>a.deleteElement&&a.deleteElement(...C))}," Так, я впевнена/ий ")])])]),_:1},8,["visible"])],64)}const G9=$e(V9,[["render",W9]]),Z9={},Y9={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function X9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",Y9,e[0]||(e[0]=[f.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),f.createElementVNode("path",{d:"M7 20V4"},null,-1),f.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),f.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const K9=$e(Z9,[["render",X9]]),J9={},Q9={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",class:"icon icon-tabler icons-tabler-outline icon-tabler-rosette-discount-check"};function eU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",Q9,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M5 7.2a2.2 2.2 0 0 1 2.2 -2.2h1a2.2 2.2 0 0 0 1.55 -.64l.7 -.7a2.2 2.2 0 0 1 3.12 0l.7 .7c.412 .41 .97 .64 1.55 .64h1a2.2 2.2 0 0 1 2.2 2.2v1c0 .58 .23 1.138 .64 1.55l.7 .7a2.2 2.2 0 0 1 0 3.12l-.7 .7a2.2 2.2 0 0 0 -.64 1.55v1a2.2 2.2 0 0 1 -2.2 2.2h-1a2.2 2.2 0 0 0 -1.55 .64l-.7 .7a2.2 2.2 0 0 1 -3.12 0l-.7 -.7a2.2 2.2 0 0 0 -1.55 -.64h-1a2.2 2.2 0 0 1 -2.2 -2.2v-1a2.2 2.2 0 0 0 -.64 -1.55l-.7 -.7a2.2 2.2 0 0 1 0 -3.12l.7 -.7a2.2 2.2 0 0 0 .64 -1.55v-1"},null,-1),f.createElementVNode("path",{d:"M9 12l2 2l4 -4"},null,-1)]))}const tU={components:{IconExport:K9,IconChevronDown:DS,IconSuccess:$e(J9,[["render",eU]])},props:{table:String,columns:Array,page:[String,Number],filterCustom:String,filterState:String,filters:String},data(){return{isOpen:!1,tableFormats:["json","csv","xlsx"],format:"",cols:[],activeAction:"",isSuccessTemplate:!1,actions:[{name:"choceAll",function:this.choceAll,label:"Вибрати усі"},{name:"choceVisible",function:this.choceVisible,label:"Вибрати поточні"},{name:"clearAll",function:this.clearAll,label:"Жодного"}]}},watch:{isOpen(t){t||(this.format="",this.cols=[],this.activeAction="",this.isSuccessTemplate=!1)}},methods:{async exportTable(){var t;if(!((t=this.cols)!=null&&t.length)){this.$notify({type:"error",title:"Помилка",message:"Оберіть колонки для експорту!"});return}if(!this.format){this.$notify({type:"error",title:"Помилка",message:"Оберіть формат!"});return}try{const e=await ct.get("/api/export",{params:{table:this.table,format:this.format,cols:this.cols.join(","),page:this.page,filter:this.filters||null,state:this.filterState||null,custom:this.filterCustom||null},responseType:"blob"}),n=new Blob([e.data],{type:"application/octet-stream"}),i=window.URL.createObjectURL(n),r=document.createElement("a");r.href=i,r.setAttribute("download",`${this.table.split(".")[0]}.${this.format}`),document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(i),this.$notify({type:"success",title:"Експорт",message:"Файл успішно експортовано!"}),this.isSuccessTemplate=!0}catch(e){console.error("Ошибка при экспорте файла:",e),this.$notify({type:"error",title:"Помилка",message:"Не вдалося експортувати файл."})}},selectFormat(t){this.format=t},choceAll(){var t;this.cols=(t=this.columns)==null?void 0:t.map(e=>e==null?void 0:e.name),this.activeAction="choceAll"},clearAll(){this.cols=[],this.activeAction="clearAll"},choceVisible(){var t,e;this.cols=(e=(t=this.columns)==null?void 0:t.filter(n=>(n==null?void 0:n.hidden)!==!0))==null?void 0:e.map(n=>n==null?void 0:n.name),this.activeAction="choceVisible"}}},nU={key:0,class:"flex flex-col items-center"},iU={key:1,class:"p-4"},rU={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},sU={class:"flex items-center"},oU={class:"flex items-center gap-[10px] ml-auto"},aU=["onClick"],lU={key:0,class:"block h-[8px] w-[8px] rounded-full bg-blue-500"},cU={class:"mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]"},uU={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},hU={class:"mt-2 space-y-2"},dU=["id","onChange"],pU=["for"],fU={key:0,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"},mU={key:1,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"};function gU(t,e,n,i,r,a){const u=f.resolveComponent("IconExport"),l=f.resolveComponent("IconChevronDown"),g=f.resolveComponent("IconSuccess"),b=f.resolveComponent("VsCheckbox"),S=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("button",{onClick:e[0]||(e[0]=E=>r.isOpen=!0),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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 focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[f.createVNode(u,{height:"16",width:"16"}),e[7]||(e[7]=f.createTextVNode(" Експорт ")),f.createVNode(l,{height:"12",width:"16"})]),f.createVNode(S,{visible:r.isOpen,"onUpdate:visible":e[6]||(e[6]=E=>r.isOpen=E),title:"Експорт таблиці",size:"small",closeClickBack:!0},{footer:f.withCtx(()=>[r.isSuccessTemplate?(f.openBlock(),f.createElementBlock("div",fU,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border border-gray-200 rounded-lg shadow-sm text-nowrap text-start hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[2]||(e[2]=E=>r.isOpen=!1)}," Закрити "),f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-white align-middle bg-blue-600 border border-blue-600 rounded-lg shadow-sm text-nowrap gap-x-2 text-start hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500",onClick:e[3]||(e[3]=E=>r.isSuccessTemplate=!1)}," Вигрузити ще ")])):(f.openBlock(),f.createElementBlock("div",mU,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border border-gray-200 rounded-lg shadow-sm text-nowrap text-start hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[4]||(e[4]=E=>r.isOpen=!1)}," Скасувати "),f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-white align-middle bg-blue-600 border border-blue-600 rounded-lg shadow-sm text-nowrap gap-x-2 text-start hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500",onClick:e[5]||(e[5]=(...E)=>a.exportTable&&a.exportTable(...E))}," Завантажити таблицю ")]))]),default:f.withCtx(()=>[r.isSuccessTemplate?(f.openBlock(),f.createElementBlock("div",nU,[f.createVNode(g,{height:"100",width:"100",class:"text-green-200 mb-[20px]"}),e[8]||(e[8]=f.createElementVNode("h2",null,"Звіт сформовано і збережено",-1))])):(f.openBlock(),f.createElementBlock("div",iU,[f.createElementVNode("div",rU,[f.createElementVNode("div",sU,[e[9]||(e[9]=f.createElementVNode("h2",{class:"text-sm text-gray-500"}," Виберіть стовпці таблиці для експорту: ",-1)),f.createElementVNode("div",oU,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.actions,E=>(f.openBlock(),f.createElementBlock("button",{key:E==null?void 0:E.name,onClick:E==null?void 0:E.function,class:"inline-flex items-center gap-[8px] justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border-gray-200 text-nowrap text-start"},[f.createElementVNode("span",{class:f.normalizeClass(["h-[14px] w-[14px] border rounded-full flex items-center justify-center",{"border-blue-500":(E==null?void 0:E.name)===r.activeAction}])},[(E==null?void 0:E.name)===r.activeAction?(f.openBlock(),f.createElementBlock("span",lU)):f.createCommentVNode("",!0)],2),f.createTextVNode(" "+f.toDisplayString(E==null?void 0:E.label),1)],8,aU))),128))])]),f.createElementVNode("div",cU,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,(E,C)=>(f.openBlock(),f.createElementBlock("div",{class:"flex items-center",key:C,style:{width:"calc((100% - 10px) / 2)"}},[f.createVNode(b,{class:"[&>label]:text-sm [&>label]:text-gray-800 [&>label]:ms-3 !gap-x-[1px] !p-0",modelValue:r.cols,"onUpdate:modelValue":e[1]||(e[1]=P=>r.cols=P),value:E==null?void 0:E.name,label:E==null?void 0:E.ua},null,8,["modelValue","value","label"])]))),128))])]),f.createElementVNode("div",uU,[e[10]||(e[10]=f.createElementVNode("h2",{class:"text-sm text-gray-500"},"Виберіть формат таблиці:",-1)),f.createElementVNode("div",hU,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.tableFormats,(E,C)=>(f.openBlock(),f.createElementBlock("div",{class:"flex items-center",key:C},[f.createElementVNode("input",{type:"radio",name:"hs-pro-duecmfm",class:"text-blue-600 border-gray-300 rounded-full shrink-0 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-500 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800",id:E,onChange:P=>a.selectFormat(E)},null,40,dU),f.createElementVNode("label",{for:E,class:"text-sm text-gray-800 ms-3 dark:text-neutral-400"}," Формат "+f.toDisplayString(E),9,pU)]))),128))])])]))]),_:1},8,["visible"])],64)}const yU=$e(tU,[["render",gU]]),_U={},bU={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-columns"};function xU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",bU,e[0]||(e[0]=[f.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 6l5.5 0"></path><path d="M4 10l5.5 0"></path><path d="M4 14l5.5 0"></path><path d="M4 18l5.5 0"></path><path d="M14.5 6l5.5 0"></path><path d="M14.5 10l5.5 0"></path><path d="M14.5 14l5.5 0"></path><path d="M14.5 18l5.5 0"></path>',9)]))}const vU=$e(_U,[["render",xU]]),wU={props:{column:Object},emits:["update-column"],data(){return{value:!1}},watch:{value(t){this.$emit("update-column",{...this.column,hidden:!t})}},mounted(){var t;((t=this.column)==null?void 0:t.hidden)!==!0&&(this.value=!0)}},kU={class:"flex w-full gap-[8px] items-centr"};function SU(t,e,n,i,r,a){var u,l;return f.openBlock(),f.createElementBlock("label",kU,[f.withDirectives(f.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=g=>r.value=g),type:"checkbox"},null,512),[[f.vModelCheckbox,r.value]]),f.createTextVNode(" "+f.toDisplayString(((u=n.column)==null?void 0:u.ua)||((l=n.column)==null?void 0:l.title)),1)])}const EU={components:{IconColumns:vU,AdminTableColumnsHiddenItem:$e(wU,[["render",SU]])},emits:["update-columns"],props:{columns:Array},methods:{updateColumn(t){const e=this.columns.findIndex(i=>(i==null?void 0:i.name)===(t==null?void 0:t.name)),n=this.columns;n[e]=t,this.$emit("update-columns",[...n])}}},CU={class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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 focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},TU={class:"py-[10px] px-[10px] w-[260px]"},MU={class:"flex flex-col gap-[3px] max-h-[400px] w-full overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function AU(t,e,n,i,r,a){const u=f.resolveComponent("IconColumns"),l=f.resolveComponent("AdminTableColumnsHiddenItem"),g=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(g,{trigger:"click",placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",CU,[f.createVNode(u,{height:"20",width:"16"})])]),default:f.withCtx(()=>[f.createElementVNode("div",TU,[e[0]||(e[0]=f.createElementVNode("h2",{class:"text-sm mb-[8px]"},"Оберіть колонки, щоб приховати",-1)),f.createElementVNode("ul",MU,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,(b,S)=>(f.openBlock(),f.createElementBlock("li",{key:S},[f.createVNode(l,{column:b,onUpdateColumn:a.updateColumn},null,8,["column","onUpdateColumn"])]))),128))])])]),_:1})}const IU=$e(EU,[["render",AU]]),PU={},DU={class:"hidden sm:block shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"};function OU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",DU,e[0]||(e[0]=[f.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 1C8.55228 1 9 1.44772 9 2V7L14 7C14.5523 7 15 7.44771 15 8C15 8.55228 14.5523 9 14 9L9 9V14C9 14.5523 8.55228 15 8 15C7.44772 15 7 14.5523 7 14V9.00001L2 9.00001C1.44772 9.00001 1 8.5523 1 8.00001C0.999999 7.44773 1.44771 7.00001 2 7.00001L7 7.00001V2C7 1.44772 7.44772 1 8 1Z"},null,-1)]))}const zS=$e(PU,[["render",OU]]),zU={},BU={class:"vs-table-interface__table-wrp w-full rounded h-fit overflow-hidden"};function NU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",BU,e[0]||(e[0]=[f.createStaticVNode('<div><div class="p-5 min-h-[500px] flex flex-col justify-center items-center text-center"><svg class="w-48 mx-auto" viewBox="0 0 178 90" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs></svg><div class="max-w-sm mx-auto mt-6"><p class="font-medium text-gray-800 dark:text-neutral-200"> Дані для відображення відсутні </p><p class="mt-2 text-sm text-gray-500 dark:text-neutral-500"> Змініть параметри пошуку або спробуйте пізніше </p></div></div></div>',1)]))}const RU=$e(zU,[["render",NU]]),LU={props:{row:Object,column:Object,table:String}};function VU(t,e,n,i,r,a){var u,l,g,b,S,E,C,P;return f.openBlock(),f.createBlock(f.resolveDynamicComponent(((u=n.column)==null?void 0:u.format)==="custom"?(l=n.column)==null?void 0:l.component:`table-format-${((b=(g=n.column)==null?void 0:g.format)==null?void 0:b.toLowerCase())||"text"}`),{onUpdateTable:e[0]||(e[0]=D=>t.$emit("update-table")),name:(S=n.column)==null?void 0:S.name,data:n.row,value:(C=n.row)==null?void 0:C[(E=n.column)==null?void 0:E.name],table:n.table,column:n.column,edit:(P=n.column)==null?void 0:P.edit},null,40,["name","data","value","table","column","edit"])}const BS=$e(LU,[["render",VU]]),FU={},$U={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-minus"};function jU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",$U,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M5 12l14 0"},null,-1)]))}const UU={components:{IconPlus:zS,IconMinus:$e(FU,[["render",jU]])},props:{title:String,defaultValue:{type:Boolean,default:()=>!1}},data(){return{expanded:this.defaultValue}}},HU={class:"hs-accordion"},qU={class:"py-0.5 flex items-center gap-x-0.5 w-full"},WU={class:"text-sm font-medium"},GU={class:"relative inline-block w-full duration-150 cursor-pointer before:block before:absolute b"};function ZU(t,e,n,i,r,a){const u=f.resolveComponent("IconPlus"),l=f.resolveComponent("IconMinus");return f.openBlock(),f.createElementBlock("div",null,[f.createElementVNode("div",null,[f.createElementVNode("div",HU,[f.createElementVNode("div",qU,[f.createElementVNode("div",{onClick:e[0]||(e[0]=g=>r.expanded=!r.expanded),class:"rounded-md cursor-pointer grow"},[f.createElementVNode("span",WU,f.toDisplayString(n.title),1)]),f.createElementVNode("button",{class:"flex items-center justify-center rounded-md size-6 hover:bg-gray-100",onClick:e[1]||(e[1]=g=>r.expanded=!r.expanded)},[r.expanded?(f.openBlock(),f.createBlock(l,{key:1,width:"14"})):(f.openBlock(),f.createBlock(u,{key:0}))])]),f.createVNode(f.Transition,{name:"fade"},{default:f.withCtx(()=>[f.withDirectives(f.createElementVNode("div",GU,[f.renderSlot(t.$slots,"default",{},void 0,!0)],512),[[f.vShow,r.expanded]])]),_:3})])])])}const YU={components:{AdminComponentIs:BS,AdminTree:$e(UU,[["render",ZU],["__scopeId","data-v-c6318482"]]),VsNoData:MS,VsWidgetComments:CS,VsWidgetMap:W1,VsWidgetFileList:qv},props:{table:String,columns:Array,row:Object}},XU={class:"hs-accordion border-gray-100 w-[360px] shrink-0 overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500",style:{height:"calc(100vh - 310px)"}},KU={class:"border-l",style:{height:"calc(100vh - 360px)"}},JU={class:"flex items-center justify-between py-1 gap-x-4"},QU={class:"col-span-1"},eH={class:"inline-flex items-center gap-x-2 text-[13px] text-gray-500 dark:text-neutral-500"},tH={class:"col-span-2"},nH={class:"font-medium text-[13px] text-gray-800 dark:text-neutral-200"},iH={class:"table-info-card"},rH={class:"table-info-card"};function sH(t,e,n,i,r,a){var C,P,D;const u=f.resolveComponent("AdminComponentIs"),l=f.resolveComponent("AdminTree"),g=f.resolveComponent("VsWidgetMap"),b=f.resolveComponent("VsNoData"),S=f.resolveComponent("VsWidgetComments"),E=f.resolveComponent("VsWidgetFileList");return f.openBlock(),f.createElementBlock("div",XU,[e[0]||(e[0]=f.createElementVNode("div",{class:"p-[10px] pl-[18px] pb-[18px] border-b"},[f.createElementVNode("h2",{class:"text-sm font-medium"},"Інформація про об'єкт")],-1)),f.createElementVNode("div",KU,[(P=(C=t.$route)==null?void 0:C.query)!=null&&P.card?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[n.row?(f.openBlock(),f.createBlock(l,{key:0,defaultValue:!0,title:"Основна інформація",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,R=>(f.openBlock(),f.createElementBlock("dl",JU,[f.createElementVNode("dt",QU,[f.createElementVNode("p",eH,f.toDisplayString((R==null?void 0:R.ua)||(R==null?void 0:R.title))+": ",1)]),f.createElementVNode("dd",tH,[f.createElementVNode("p",nH,[f.createVNode(u,{row:n.row,column:R,table:n.table},null,8,["row","column","table"])])])]))),256))]),_:1})):f.createCommentVNode("",!0),(D=n.row)!=null&&D.geom?(f.openBlock(),f.createBlock(l,{key:1,title:"Карта",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>{var R,j;return[(R=n.row)!=null&&R.geom?(f.openBlock(),f.createBlock(g,{key:0,geometry:(j=n.row)==null?void 0:j.geom,zoom:14},null,8,["geometry"])):(f.openBlock(),f.createBlock(b,{key:1,title:"У об'єкта відсутня геометрія",text:"",class:"[&>div]:h-[200px] [&>div]:min-h-[400px] h-[400px]"}))]}),_:1})):f.createCommentVNode("",!0),f.createVNode(l,{title:"Коментарі",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>{var R;return[f.createElementVNode("div",iH,[f.createVNode(S,{id:(R=n.row)==null?void 0:R.id},null,8,["id"])])]}),_:1}),f.createVNode(l,{title:"Файли",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>{var R;return[f.createElementVNode("div",rH,[f.createVNode(E,{id:(R=n.row)==null?void 0:R.id},null,8,["id"])])]}),_:1})],64)):(f.openBlock(),f.createBlock(b,{key:1,text:"Оберіть один з об'єктів в таблиці для відображення інформаціі про нього"}))])])}const oH=$e(YU,[["render",sH]]),aH={},lH={class:"hidden xl:block shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function cH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",lH,e[0]||(e[0]=[f.createElementVNode("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"},null,-1),f.createElementVNode("path",{d:"M15 3v18"},null,-1),f.createElementVNode("path",{d:"m8 9 3 3-3 3"},null,-1)]))}const uH=$e(aH,[["render",cH]]),hH={},dH={class:"h21yx vs0hq",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"};function pH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",dH,e[0]||(e[0]=[f.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)]))}const fH={emits:["filterChange"],props:{scheme:{type:Object},onFilters:{type:Number}},components:{IconFilter:$e(hH,[["render",pH]])},data(){return{isFilters:!1}},methods:{closeFilter({target:t}){this.isFilters&&t.classList.contains("filter-container")&&(this.isFilters=!1)}}},mH={key:0,class:"font-medium text-[10px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full dark:bg-neutral-500"},gH={class:"filter-content h-screen bg-white w-[400px] p-[20px] pt-[10px] overflow-x-auto bg-white [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function yH(t,e,n,i,r,a){const u=f.resolveComponent("IconFilter"),l=f.resolveComponent("VsFilter");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("button",{onClick:e[0]||(e[0]=g=>r.isFilters=!r.isFilters),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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 focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[f.createVNode(u,{height:"16",width:"16"}),e[4]||(e[4]=f.createTextVNode(" Фільтри ")),n.onFilters?(f.openBlock(),f.createElementBlock("span",mH,f.toDisplayString(n.onFilters),1)):f.createCommentVNode("",!0)]),f.createVNode(f.Transition,{name:"fade"},{default:f.withCtx(()=>{var g;return[f.withDirectives(f.createElementVNode("div",{onClick:e[3]||(e[3]=(...b)=>a.closeFilter&&a.closeFilter(...b)),style:{height:"100vh"},class:"fixed filter-container top-0 flex justify-end items-center z-[2] right-0 left-0 bottom-0 bg-[rgba(0,0,0,0.5)]"},[f.createElementVNode("div",gH,[(g=n.scheme)!=null&&g.length?(f.openBlock(),f.createBlock(l,{key:0,ref:"filter",scheme:n.scheme,layout:"default","apply-vue-router":"",history:"",name:"filter",onFilterChange:e[1]||(e[1]=b=>t.$emit("filterChange",b)),closeFilterBtn:!0,onFilterClose:e[2]||(e[2]=b=>r.isFilters=!1)},null,8,["scheme"])):f.createCommentVNode("",!0)])],512),[[f.vShow,r.isFilters]])]}),_:1})],64)}const _H=$e(fH,[["render",yH]]),bH={props:{tabsList:{type:Array,default:()=>[]},filterState:String}},xH={class:"relative flex space-x-1 mb-[20px] after:absolute after:w-[99%] after:bottom-0 after:inset-x-0 after:border-b-2 after:border-gray-200 dark:after:border-neutral-700","aria-label":"Tabs",role:"tablist","aria-orientation":"horizontal"},vH=["onClick"];function wH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("nav",xH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.tabsList,u=>(f.openBlock(),f.createElementBlock("button",{onClick:l=>t.$emit("update:filterState",u==null?void 0:u.name),class:f.normalizeClass(["hs-tab-active:after:bg-gray-800 hs-tab-active:text-gray-800 px-2.5 py-1.5 mb-2 relative inline-flex justify-center items-center gap-x-2 hover:bg-gray-100 text-gray-500 hover:text-gray-800 text-sm rounded-lg disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 after:absolute after:-bottom-2 after:inset-x-0 after:z-10 after:h-0.5 after:pointer-events-none dark:hs-tab-active:text-neutral-200 dark:hs-tab-active:after:bg-neutral-400 dark:text-neutral-500 dark:hover:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 active",{" font-semibold after:absolute after:bottom-[-8px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:bg-gray-800":(u==null?void 0:u.name)===n.filterState}])},f.toDisplayString(u==null?void 0:u.label),11,vH))),256))])}const kH=$e(bH,[["render",wH]]),SH={},EH={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-filter"};function CH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",EH,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z"},null,-1)]))}const TH={components:{IconFilter2:$e(SH,[["render",CH]])},props:{filterCustom:String,customList:Array}},MH={class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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 focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},AH={class:"flex flex-col gap-[4px]"},IH=["onClick"];function PH(t,e,n,i,r,a){const u=f.resolveComponent("IconFilter2"),l=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(l,{ref:"popover",placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",MH,[f.createVNode(u,{height:"20",width:"20"})])]),default:f.withCtx(()=>[f.createElementVNode("div",AH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.customList,(g,b)=>(f.openBlock(),f.createElementBlock("button",{onClick:S=>{var E;t.$emit("update:filterCustom",g==null?void 0:g.name),(E=t.$refs)==null||E.popover.togglePopover()},key:b,class:f.normalizeClass(["p-[8px] block rounded-lg w-[140px] text-start hover:bg-gray-100 !duration-300",{"bg-gray-100":n.filterCustom===(g==null?void 0:g.name)}])},f.toDisplayString(g==null?void 0:g.label),11,IH))),128)),f.createElementVNode("button",{class:"p-[8px] block rounded-lg w-[140px] text-start hover:bg-gray-100 !duration-300",onClick:e[0]||(e[0]=g=>{var b;t.$emit("update:filterCustom",void 0),(b=t.$refs)==null||b.popover.togglePopover()})}," Скинути фільтри ")])]),_:1},512)}const DH=$e(TH,[["render",PH]]),OH={class:"flex items-center gap-x-2"},zH={props:{table:String,title:String},components:{AdminTableControl:G9,AdminTableExport:yU,AdminTableColumnsHidden:IU,AdminTableColumn:I9,AdminNodata:RU,IconPlus:zS,IconSearch:J0,AdminTableCardInfo:oH,IconOpenCard:uH,AdminComponentIs:BS,AdminTableFilters:_H,AdminTableTabs:kH,AdminTableCustomFilters:DH,AdminTableCustomButtons:{__name:"admin-table-custom-buttons",props:{slots:Object},setup(t){var l,g,b,S,E;const{asyncTemplateSlot:e}=(E=(S=(b=(g=(l=f.getCurrentInstance())==null?void 0:l.appContext)==null?void 0:g.app)==null?void 0:b.config)==null?void 0:S.globalProperties)==null?void 0:E.utils,n=f.ref(""),i=f.ref(""),r=t,a=()=>{var C;if(r.slots.panelLeft.includes("<")){const P=e("PanelLeft",(C=r.slots)==null?void 0:C.panelLeft,["name"]);i.value=P}else i.value=r.slots.panelLeft},u=()=>{var C;if(r.slots.panelRight.includes("<")){const P=e("PanelRight",(C=r.slots)==null?void 0:C.panelRight,["name"]);n.value=P}else n.value=r.slots.panelRight};return a(),u(),(C,P)=>(f.openBlock(),f.createElementBlock("div",OH,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(i.value))),(f.openBlock(),f.createBlock(f.resolveDynamicComponent(n.value)))]))}}},data(){return{tableData:{},filterScheme:[],page:1,searchValue:"",limit:0,filters:null,activeColumn:"",isVisibleCardInfo:!1,onFilters:0,filterState:null,filterCustom:null,visibleColumns:[],initialHiddenColumns:""}},async mounted(){await this.checkUrlMounted(),await this.getTableData(),await this.getFilters()},computed:{defaultPage(){var t,e;return((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1},columns(){var t,e;return(e=(t=this.tableData)==null?void 0:t.columns)==null?void 0:e.filter(n=>(n==null?void 0:n.hidden)!==!0)},isForm(){var t;return(t=this.tableData)==null?void 0:t.form},isNoData(){var t,e;return!((t=this.tableData)!=null&&t.rows)||!((e=this.columns)!=null&&e.length)},activeCardRow(){var t,e;return((e=(t=this.tableData)==null?void 0:t.rows)==null?void 0:e.find(n=>{var i,r;return(n==null?void 0:n.id)===((r=(i=this.$route)==null?void 0:i.query)==null?void 0:r.card)}))||{}},getActions(){var t;return(t=this.tableData)==null?void 0:t.actions}},watch:{async table(){this.tableData=null,await this.getTableData()},searchValue:{handler:((t,e=300)=>{let n;return function(...i){clearTimeout(n),n=setTimeout(()=>{t.apply(this,i)},e)}})(async function(t){var e;await this.getTableData(),this.$router.push({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,search:t||void 0}})},500)},$route:{handler(t,e){var n,i;((n=t==null?void 0:t.params)==null?void 0:n.catchAll)!==((i=e==null?void 0:e.params)==null?void 0:i.catchAll)&&(this.visibleColumns=[],this.unmountedData(),this.getFilters())},deep:!0},limit(t){var e;this.$router.replace({query:{...(e=this.$route)==null?void 0:e.query,limit:t}})},filterState(t){var e;t&&(this.$router.replace({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,filterState:t}}),this.getTableData())},filterCustom(t){var e;this.$router.replace({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,custom:t}}),this.getTableData()},columns(t){var e,n,i,r;this.visibleColumns=t==null?void 0:t.map(a=>a==null?void 0:a.name),this.initialHiddenColumns===((e=this.visibleColumns)==null?void 0:e.join(","))&&(this.visibleColumns=[]),this.$router.replace({...this.$route,query:{...(n=this.$route)==null?void 0:n.query,columns:(i=this.visibleColumns)!=null&&i.length?(r=this.visibleColumns)==null?void 0:r.join(","):void 0}})}},methods:{async checkUrlMounted(){var t,e,n,i,r,a,u,l,g,b,S,E,C,P,D,R;this.page=((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1,this.limit=((i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.limit)||20,this.filters=decodeURI((a=(r=this.$route)==null?void 0:r.query)==null?void 0:a.filter)||void 0,this.filterState=((l=(u=this.$route)==null?void 0:u.query)==null?void 0:l.filterState)||null,this.filterCustom=((b=(g=this.$route)==null?void 0:g.query)==null?void 0:b.custom)||null,this.searchValue=((E=(S=this.$route)==null?void 0:S.query)==null?void 0:E.search)||"",this.visibleColumns=((D=(P=(C=this.$route)==null?void 0:C.query)==null?void 0:P.columns)==null?void 0:D.split(","))||[],(R=this.$route)!=null&&R.query.card&&(this.isVisibleCardInfo=!0)},rowWidth(t){var n,i;const e=(i=(n=this.tableData)==null?void 0:n.columns)==null?void 0:i.find(r=>r.name===t);if(e){const r=e==null?void 0:e.width;return r!=null&&r.includes("px")?r:`${r}px`}},unmountedData(){this.page=1,this.visibleColumns=[],this.filterCustom=null,this.filterState=null,this.isVisibleCardInfo=!1,this.filterScheme=null,this.filters=null,this.onFilters=0,this.searchValue=""},async getTableData(){var t,e,n,i,r,a,u,l,g,b,S;try{const{data:E}=await ct.get(`/api/template/table/${this.table}`),C=await ct.get(`/api/table-data/${this.table}`,{params:{page:this.page,search:this.searchValue||null,limit:this.limit,filter:this.filters||null,order:((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort)||null,state:this.filterState||null,custom:this.filterCustom||null}});this.tableData={...E,...(C==null?void 0:C.data)||{}},this.initialHiddenColumns=(a=(r=(i=(n=this.tableData)==null?void 0:n.columns)==null?void 0:i.filter(P=>(P==null?void 0:P.hidden)!==!0))==null?void 0:r.map(P=>P==null?void 0:P.name))==null?void 0:a.join(","),(u=this.visibleColumns)!=null&&u.length?(l=this.tableData)==null||l.columns.forEach(P=>{var D;(D=this.visibleColumns)!=null&&D.includes(P==null?void 0:P.name)?P.hidden=!1:P.hidden=!0}):this.visibleColumns=(S=(b=(g=this.tableData)==null?void 0:g.columns)==null?void 0:b.filter(P=>(P==null?void 0:P.hidden)!==!0))==null?void 0:S.map(P=>P==null?void 0:P.name)}catch{}},async getFilters(){var t;try{const{data:e}=await ct.get(`/api/table-filter/${this.table}`);this.filterScheme=(t=e==null?void 0:e.list)==null?void 0:t.map(n=>({...n,label:(n==null?void 0:n.label)||(n==null?void 0:n.ua)}))}catch{}},async handlePageChange(t){const e=this.$route.query;this.page=t,!(!(e!=null&&e.page)&&t===1||e.page===t)&&(await this.$router.replace({query:{...e,page:t}}),await this.getTableData())},async changeLimit(t){this.limit=await t,this.defaultPage=1,await this.getTableData()},async filterChange({url:t,state:e}){var n;this.filters=t!=="no-url"?t:null,this.onFilters=(n=Object.entries(e))==null?void 0:n.length,this.page=1,await this.getTableData()},changeActiveColumn(t){this.activeColumn=t,this.getTableData()},pushToCard(t){var e;((e=this.tableData)==null?void 0:e.card)===!1||this.$router.push(`/card/${this.table}/${t}`)},changeActiveCardInfo(t){var e;this.isVisibleCardInfo&&this.$router.push({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,card:t}})},toggleCardInfo(){var t;this.isVisibleCardInfo=!this.isVisibleCardInfo,this.isVisibleCardInfo||this.$router.push({...this.$route,query:{...(t=this.$route)==null?void 0:t.query,card:void 0}})}}},BH={class:"w-[calc(100vw - 320px)] bg-gray-50"},NH={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},RH={class:"text-xl font-medium"},LH={style:{height:"calc(100vh - 155px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex pt-[10px]"},VH={class:"bg-white w-full rounded-xl border p-[20px] pr-0"},FH={class:"flex"},$H={class:"flex gap-[6px] ml-auto"},jH={class:"inline-block w-full align-middle"},UH={key:0,class:"relative min-w-full divide-y divide-gray-200 table-fixed dark:divide-neutral-700"},HH={class:"sticky top-[-1px] bg-white w-full after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},qH={class:"right-0 border-t border-stone-200"},WH={key:0,class:"w-[70px] sticky right-0 top-0"},GH={class:"divide-y divide-gray-200"},ZH={class:"px-4 py-3 text-sm text-gray-600"},YH=["onClick"],XH=["onClick"],KH={class:"p-[20px] flex justify-start items-center w-full"},JH={class:"w-[200px]"},QH={class:"text-sm text-gray-600 dark:text-neutral-400"},eq={class:"font-semibold text-gray-800 dark:text-neutral-200"},tq={key:0},nq={key:0,class:"font-semibold text-gray-800 dark:text-neutral-200"};function iq(t,e,n,i,r,a){var Ae,je,De,Ke,rt,Rt,pt,zt,Xt,on,$t,Kt,Cn,dn,vn,pn,ti,Nn,Pn,Rn,Ee;const u=f.resolveComponent("IconPlus"),l=f.resolveComponent("router-link"),g=f.resolveComponent("AdminTableTabs"),b=f.resolveComponent("IconSearch"),S=f.resolveComponent("VsText"),E=f.resolveComponent("AdminTableCustomButtons"),C=f.resolveComponent("AdminTableCustomFilters"),P=f.resolveComponent("AdminTableColumnsHidden"),D=f.resolveComponent("AdminTableExport"),R=f.resolveComponent("AdminTableFilters"),j=f.resolveComponent("IconOpenCard"),W=f.resolveComponent("AdminTableColumn"),ee=f.resolveComponent("AdminComponentIs"),le=f.resolveComponent("AdminTableControl"),J=f.resolveComponent("AdminNodata"),Te=f.resolveComponent("VsPagination"),xe=f.resolveComponent("AdminTableCardInfo");return f.openBlock(),f.createElementBlock("div",BH,[f.createElementVNode("div",NH,[f.createElementVNode("h2",RH,f.toDisplayString(n.title),1),a.isForm?(f.openBlock(),f.createBlock(l,{key:0,to:`/add?table=${(je=(Ae=t.$route)==null?void 0:Ae.params)==null?void 0:je.catchAll}`,class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"},{default:f.withCtx(()=>[f.createVNode(u,{height:"16",width:"16"}),e[5]||(e[5]=f.createTextVNode(" Додати "))]),_:1},8,["to"])):f.createCommentVNode("",!0)]),f.createElementVNode("div",LH,[f.createElementVNode("div",VH,[(Ke=(De=r.tableData)==null?void 0:De.filterState)!=null&&Ke.length?(f.openBlock(),f.createBlock(g,{key:0,tabsList:(rt=r.tableData)==null?void 0:rt.filterState,filterState:r.filterState,"onUpdate:filterState":e[0]||(e[0]=Ie=>r.filterState=Ie)},null,8,["tabsList","filterState"])):f.createCommentVNode("",!0),f.createElementVNode("div",FH,[f.createElementVNode("div",{class:f.normalizeClass([r.isVisibleCardInfo?"w-[calc(100%-360px)]":"w-full"])},[f.createElementVNode("div",{class:f.normalizeClass(["flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5 mb-[10px] relative",{"pr-[20px]":!r.isVisibleCardInfo}])},[f.createVNode(b,{height:"14",width:"14",class:"absolute top-[10px] left-[14px] text-gray-500 z-[1]"}),f.createVNode(S,{modelValue:r.searchValue,"onUpdate:modelValue":e[1]||(e[1]=Ie=>r.searchValue=Ie),placeholder:"Пошук...",clearable:!0,class:"[&>input]:py-[7px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600"},null,8,["modelValue"]),f.createElementVNode("div",$H,[(Rt=r.tableData)!=null&&Rt.slots?(f.openBlock(),f.createBlock(E,{key:0,slots:(pt=r.tableData)==null?void 0:pt.slots},null,8,["slots"])):f.createCommentVNode("",!0),(Xt=(zt=r.tableData)==null?void 0:zt.filterCustom)!=null&&Xt.length?(f.openBlock(),f.createBlock(C,{key:1,customList:(on=r.tableData)==null?void 0:on.filterCustom,filterCustom:r.filterCustom,"onUpdate:filterCustom":e[2]||(e[2]=Ie=>r.filterCustom=Ie)},null,8,["customList","filterCustom"])):f.createCommentVNode("",!0),f.createVNode(P,{columns:($t=r.tableData)==null?void 0:$t.columns,onUpdateColumns:e[3]||(e[3]=Ie=>r.tableData.columns=Ie)},null,8,["columns"]),f.createVNode(D,{table:n.table,columns:(Kt=r.tableData)==null?void 0:Kt.columns,page:r.page,"filter-state":r.filterState,"filter-custom":r.filterCustom,filters:r.filters},null,8,["table","columns","page","filter-state","filter-custom","filters"]),(Cn=r.filterScheme)!=null&&Cn.length?(f.openBlock(),f.createBlock(R,{key:2,scheme:r.filterScheme,onFilters:r.onFilters,onFilterChange:a.filterChange},null,8,["scheme","onFilters","onFilterChange"])):f.createCommentVNode("",!0),f.createElementVNode("button",{onClick:e[4]||(e[4]=(...Ie)=>a.toggleCardInfo&&a.toggleCardInfo(...Ie)),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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 focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[f.createVNode(j,{class:f.normalizeClass({"rotate-180 duration-300":!r.isVisibleCardInfo})},null,8,["class"])])])],2),f.createElementVNode("div",{class:f.normalizeClass(["flex items-start justify-start w-full space-y-5",{"pr-[20px]":!r.isVisibleCardInfo}])},[f.createElementVNode("div",{style:f.normalizeStyle({height:(vn=(dn=r.tableData)==null?void 0:dn.filterState)!=null&&vn.length?"calc(100vh - 370px)":"calc(100vh - 330px)"}),class:"overflow-x-auto w-full [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},[f.createElementVNode("div",jH,[a.isNoData?(f.openBlock(),f.createBlock(J,{key:1})):(f.openBlock(),f.createElementBlock("table",UH,[f.createElementVNode("thead",HH,[f.createElementVNode("tr",qH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.columns,Ie=>(f.openBlock(),f.createBlock(W,{key:Ie.name,style:f.normalizeStyle({width:a.rowWidth(Ie==null?void 0:Ie.name),textAlign:Ie==null?void 0:Ie.align,wordBreak:Ie==null?void 0:Ie.wrap}),data:Ie,activeColumn:r.activeColumn,onChangeActive:a.changeActiveColumn},null,8,["style","data","activeColumn","onChangeActive"]))),128)),(ti=(pn=a.getActions)==null?void 0:pn.filter(Ie=>Ie!=="add"))!=null&&ti.length?(f.openBlock(),f.createElementBlock("th",WH)):f.createCommentVNode("",!0)])]),f.createElementVNode("tbody",GH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Nn=r.tableData)==null?void 0:Nn.rows,(Ie,Ze)=>{var st,Bt,Jt,Mt,Tt,rn,we,yn,pr,jt;return f.openBlock(),f.createElementBlock("tr",{key:Ze,class:f.normalizeClass({"bg-gray-50":((Bt=(st=t.$route)==null?void 0:st.query)==null?void 0:Bt.card)===(Ie==null?void 0:Ie.id)})},[f.createElementVNode("td",ZH,[f.createElementVNode("button",{onClick:()=>a.pushToCard(Ie==null?void 0:Ie.id),class:f.normalizeClass(["text-sm font-medium",[((Jt=r.tableData)==null?void 0:Jt.card)===!1?"":"text-blue-600 decoration-2 focus:outline-none focus:underline hover:text-blue-600 hover:underline"]])},[f.createVNode(ee,{row:Ie,column:a.columns[0],table:n.table,onUpdateTable:a.getTableData},null,8,["row","column","table","onUpdateTable"])],10,YH)]),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Mt=a.columns)==null?void 0:Mt.slice(1),Qt=>(f.openBlock(),f.createElementBlock("td",{onClick:Ui=>a.changeActiveCardInfo(Ie==null?void 0:Ie.id),class:f.normalizeClass(["px-3 py-3 text-sm text-gray-600 text-start whitespace-nowrap",{"cursor-pointer":r.isVisibleCardInfo}]),key:Qt.name},[f.createVNode(ee,{row:Ie,column:Qt,table:n.table,onUpdateTable:a.getTableData},null,8,["row","column","table","onUpdateTable"])],10,XH))),128)),(rn=(Tt=a.getActions)==null?void 0:Tt.filter(Qt=>Qt!=="add"))!=null&&rn.length?(f.openBlock(),f.createElementBlock("td",{key:0,class:f.normalizeClass(["text-center sticky right-0 w-[80px] px-[10px]",{"bg-gray-50":((yn=(we=t.$route)==null?void 0:we.query)==null?void 0:yn.card)===(Ie==null?void 0:Ie.id),"bg-white":((jt=(pr=t.$route)==null?void 0:pr.query)==null?void 0:jt.card)!==(Ie==null?void 0:Ie.id)}])},[f.createVNode(le,{actions:a.getActions,isForm:a.isForm,item:Ie,table:n.table,onUpdateTable:a.getTableData},null,8,["actions","isForm","item","table","onUpdateTable"])],2)):f.createCommentVNode("",!0)],2)}),128))])]))])],4)],2),f.createElementVNode("div",KH,[f.createElementVNode("div",JH,[f.createElementVNode("p",QH,[f.createElementVNode("span",eq,[f.createTextVNode(f.toDisplayString(r.filters||r.searchValue?"Знайдено":"Об'єктів")+" "+f.toDisplayString(((Pn=r.tableData)==null?void 0:Pn.count)||"0 ")+" ",1),r.filters||r.searchValue?(f.openBlock(),f.createElementBlock("span",tq," з")):f.createCommentVNode("",!0)]),r.filters||r.searchValue?(f.openBlock(),f.createElementBlock("span",nq,f.toDisplayString(" "+((Rn=r.tableData)==null?void 0:Rn.filtered)||0),1)):f.createCommentVNode("",!0)])]),r.limit?(f.openBlock(),f.createBlock(Te,{key:0,goTo:!1,class:"justify-end","default-page":parseInt(a.defaultPage),total:((Ee=r.tableData)==null?void 0:Ee.filtered)||0,pageSize:parseInt(r.limit),onPageChange:a.handlePageChange,pageSizes:[10,16,20],onPageSizeChange:a.changeLimit,backgroundColor:"#D6D3D1"},null,8,["default-page","total","pageSize","onPageChange","onPageSizeChange"])):f.createCommentVNode("",!0)])],2),f.createVNode(f.Transition,{name:"slide-fade"},{default:f.withCtx(()=>{var Ie;return[r.isVisibleCardInfo?(f.openBlock(),f.createBlock(xe,{key:0,table:n.table,columns:(Ie=r.tableData)==null?void 0:Ie.columns,row:a.activeCardRow},null,8,["table","columns","row"])):f.createCommentVNode("",!0)]}),_:1})])])])])}const rq={components:{AdminTable:$e(zH,[["render",iq],["__scopeId","data-v-f77b0b94"]])},data(){return{table:!1,interface:"",title:""}},watch:{$route:{async handler(){Ss!=null&&Ss.value||await this.getMenu(),await this.checkPageType()},deep:!0},title(t){var e;t&&(document.title=(((e=hl.value)==null?void 0:e.titlePrefix)||"")+t)}},async mounted(){await this.checkPageType()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async checkPageType(){var i,r;const t=this.flattenMenu(Ss.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.params)==null?void 0:l.catchAll)});this.title=e==null?void 0:e.ua,e||this.$router.replace("/404"),e!=null&&e.component&&this.$router.replace((r=(i=this.$route)==null?void 0:i.params)==null?void 0:r.catchAll);const n=e==null?void 0:e.table;this.table=n||!1,!n&&this.getInterface()},async getInterface(){var t,e;try{const{data:n}=await ct.get(`/api/template/interface/${((e=(t=this.$route)==null?void 0:t.params)==null?void 0:e.catchAll)||""}`);this.interface=n||""}catch{this.interface=""}}}},sq=["innerHTML"];function oq(t,e,n,i,r,a){const u=f.resolveComponent("AdminTable");return r.table?(f.openBlock(),f.createBlock(u,{key:0,table:r.table,title:r.title},null,8,["table","title"])):(f.openBlock(),f.createElementBlock("div",{key:1,class:"w-full bg-gray-50",style:{height:"calc(100vh - 120px)"},innerHTML:r.interface},null,8,sq))}const aq=Object.freeze(Object.defineProperty({__proto__:null,default:$e(rq,[["render",oq]])},Symbol.toStringTag,{value:"Module"}));return ej});
|
741
|
+
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:i})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:r,storedMarks:a}=n;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:u}=this.options,{splittableMarks:l}=i.extensionManager,g=a||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:b,dispatch:S})=>{if(S&&g&&u){const E=g.filter(C=>l.includes(C.type.name));b.ensureMarks(E)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),DF=xs.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,ci(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>A0({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Yf=200,Ii=function(){};Ii.prototype.append=function(e){return e.length?(e=Ii.from(e),!this.length&&e||e.length<Yf&&this.leafAppend(e)||this.length<Yf&&e.leafPrepend(this)||this.appendInner(e)):this},Ii.prototype.prepend=function(e){return e.length?Ii.from(e).append(this):this},Ii.prototype.appendInner=function(e){return new OF(this,e)},Ii.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ii.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},Ii.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ii.prototype.forEach=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=this.length),n<=i?this.forEachInner(e,n,i,0):this.forEachInvertedInner(e,n,i,0)},Ii.prototype.map=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=this.length);var r=[];return this.forEach(function(a,u){return r.push(e(a,u))},n,i),r},Ii.from=function(e){return e instanceof Ii?e:e&&e.length?new gS(e):Ii.empty};var gS=function(t){function e(i){t.call(this),this.values=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,a){return r==0&&a==this.length?this:new e(this.values.slice(r,a))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,a,u,l){for(var g=a;g<u;g++)if(r(this.values[g],l+g)===!1)return!1},e.prototype.forEachInvertedInner=function(r,a,u,l){for(var g=a-1;g>=u;g--)if(r(this.values[g],l+g)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=Yf)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=Yf)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Ii);Ii.empty=new gS([]);var OF=function(t){function e(n,i){t.call(this),this.left=n,this.right=i,this.length=n.length+i.length,this.depth=Math.max(n.depth,i.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(i){return i<this.left.length?this.left.get(i):this.right.get(i-this.left.length)},e.prototype.forEachInner=function(i,r,a,u){var l=this.left.length;if(r<l&&this.left.forEachInner(i,r,Math.min(a,l),u)===!1||a>l&&this.right.forEachInner(i,Math.max(r-l,0),Math.min(this.length,a)-l,u+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,r,a,u){var l=this.left.length;if(r>l&&this.right.forEachInvertedInner(i,r-l,Math.max(a,l)-l,u+l)===!1||a<l&&this.left.forEachInvertedInner(i,Math.min(r,l),a,u)===!1)return!1},e.prototype.sliceInner=function(i,r){if(i==0&&r==this.length)return this;var a=this.left.length;return r<=a?this.left.slice(i,r):i>=a?this.right.slice(i-a,r-a):this.left.slice(i,a).append(this.right.slice(0,r-a))},e.prototype.leafAppend=function(i){var r=this.right.leafAppend(i);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(i){var r=this.left.leafPrepend(i);if(r)return new e(r,this.right)},e.prototype.appendInner=function(i){return this.left.depth>=Math.max(this.right.depth,i.depth)+1?new e(this.left,new e(this.right,i)):new e(this,i)},e}(Ii);const zF=500;class Us{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}let r,a;n&&(r=this.remapping(i,this.items.length),a=r.maps.length);let u=e.tr,l,g,b=[],S=[];return this.items.forEach((E,C)=>{if(!E.step){r||(r=this.remapping(i,C+1),a=r.maps.length),a--,S.push(E);return}if(r){S.push(new uo(E.map));let P=E.step.map(r.slice(a)),D;P&&u.maybeStep(P).doc&&(D=u.mapping.maps[u.mapping.maps.length-1],b.push(new uo(D,void 0,void 0,b.length+S.length))),a--,D&&r.appendMap(D,a)}else u.maybeStep(E.step);if(E.selection)return l=r?E.selection.map(r.slice(a)):E.selection,g=new Us(this.items.slice(0,i).append(S.reverse().concat(b)),this.eventCount-1),!1},this.items.length,0),{remaining:g,transform:u,selection:l}}addTransform(e,n,i,r){let a=[],u=this.eventCount,l=this.items,g=!r&&l.length?l.get(l.length-1):null;for(let S=0;S<e.steps.length;S++){let E=e.steps[S].invert(e.docs[S]),C=new uo(e.mapping.maps[S],E,n),P;(P=g&&g.merge(C))&&(C=P,S?a.pop():l=l.slice(0,l.length-1)),a.push(C),n&&(u++,n=void 0),r||(g=C)}let b=u-i.depth;return b>NF&&(l=BF(l,b),u-=b),new Us(l.append(a),u)}remapping(e,n){let i=new Pc;return this.items.forEach((r,a)=>{let u=r.mirrorOffset!=null&&a-r.mirrorOffset>=e?i.maps.length-r.mirrorOffset:void 0;i.appendMap(r.map,u)},e,n),i}addMaps(e){return this.eventCount==0?this:new Us(this.items.append(e.map(n=>new uo(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let i=[],r=Math.max(0,this.items.length-n),a=e.mapping,u=e.steps.length,l=this.eventCount;this.items.forEach(C=>{C.selection&&l--},r);let g=n;this.items.forEach(C=>{let P=a.getMirror(--g);if(P==null)return;u=Math.min(u,P);let D=a.maps[P];if(C.step){let R=e.steps[P].invert(e.docs[P]),j=C.selection&&C.selection.map(a.slice(g+1,P));j&&l++,i.push(new uo(D,R,j))}else i.push(new uo(D))},r);let b=[];for(let C=n;C<u;C++)b.push(new uo(a.maps[C]));let S=this.items.slice(0,r).append(b).append(i),E=new Us(S,l);return E.emptyItemCount()>zF&&(E=E.compress(this.items.length-i.length)),E}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),i=n.maps.length,r=[],a=0;return this.items.forEach((u,l)=>{if(l>=e)r.push(u),u.selection&&a++;else if(u.step){let g=u.step.map(n.slice(i)),b=g&&g.getMap();if(i--,b&&n.appendMap(b,i),g){let S=u.selection&&u.selection.map(n.slice(i));S&&a++;let E=new uo(b.invert(),g,S),C,P=r.length-1;(C=r.length&&r[P].merge(E))?r[P]=C:r.push(E)}}else u.map&&i--},this.items.length,0),new Us(Ii.from(r.reverse()),a)}}Us.empty=new Us(Ii.empty,0);function BF(t,e){let n;return t.forEach((i,r)=>{if(i.selection&&e--==0)return n=r,!1}),t.slice(n)}class uo{constructor(e,n,i,r){this.map=e,this.step=n,this.selection=i,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new uo(n.getMap().invert(),n,this.selection)}}}class Ta{constructor(e,n,i,r,a){this.done=e,this.undone=n,this.prevRanges=i,this.prevTime=r,this.prevComposition=a}}const NF=20;function RF(t,e,n,i){let r=n.getMeta(Rl),a;if(r)return r.historyState;n.getMeta(FF)&&(t=new Ta(t.done,t.undone,null,0,-1));let u=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(u&&u.getMeta(Rl))return u.getMeta(Rl).redo?new Ta(t.done.addTransform(n,void 0,i,Xf(e)),t.undone,yS(n.mapping.maps),t.prevTime,t.prevComposition):new Ta(t.done,t.undone.addTransform(n,void 0,i,Xf(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(u&&u.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),g=t.prevTime==0||!u&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-i.newGroupDelay||!LF(n,t.prevRanges)),b=u?Y0(t.prevRanges,n.mapping):yS(n.mapping.maps);return new Ta(t.done.addTransform(n,g?e.selection.getBookmark():void 0,i,Xf(e)),Us.empty,b,n.time,l??t.prevComposition)}else return(a=n.getMeta("rebased"))?new Ta(t.done.rebased(n,a),t.undone.rebased(n,a),Y0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ta(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Y0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function LF(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((i,r)=>{for(let a=0;a<e.length;a+=2)i<=e[a+1]&&r>=e[a]&&(n=!0)}),n}function yS(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((i,r,a,u)=>e.push(a,u));return e}function Y0(t,e){if(!t)return null;let n=[];for(let i=0;i<t.length;i+=2){let r=e.map(t[i],1),a=e.map(t[i+1],-1);r<=a&&n.push(r,a)}return n}function VF(t,e,n){let i=Xf(e),r=Rl.get(e).spec.config,a=(n?t.undone:t.done).popEvent(e,i);if(!a)return null;let u=a.selection.resolve(a.transform.doc),l=(n?t.done:t.undone).addTransform(a.transform,e.selection.getBookmark(),r,i),g=new Ta(n?l:a.remaining,n?a.remaining:l,null,0,-1);return a.transform.setSelection(u).setMeta(Rl,{redo:n,historyState:g})}let X0=!1,_S=null;function Xf(t){let e=t.plugins;if(_S!=e){X0=!1,_S=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){X0=!0;break}}return X0}const Rl=new Ar("history"),FF=new Ar("closeHistory");function $F(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Fi({key:Rl,state:{init(){return new Ta(Us.empty,Us.empty,null,0,-1)},apply(e,n,i){return RF(n,i,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let i=n.inputType,r=i=="historyUndo"?xS:i=="historyRedo"?vS:null;return r?(n.preventDefault(),r(e.state,e.dispatch)):!1}}}})}function bS(t,e){return(n,i)=>{let r=Rl.getState(n);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(i){let a=VF(r,n,t);a&&i(e?a.scrollIntoView():a)}return!0}}const xS=bS(!1,!0),vS=bS(!0,!0),jF=Ai.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>xS(t,e),redo:()=>({state:t,dispatch:e})=>vS(t,e)}},addProseMirrorPlugins(){return[$F(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),UF=xs.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",ci(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{selection:n}=e,{$from:i,$to:r}=n,a=t();return i.parentOffset===0?a.insertContentAt({from:Math.max(i.pos-1,0),to:r.pos},{type:this.name}):w2(n)?a.insertContentAt(r.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({tr:u,dispatch:l})=>{var g;if(l){const{$to:b}=u.selection,S=b.end();if(b.nodeAfter)b.nodeAfter.isTextblock?u.setSelection(Vt.create(u.doc,b.pos+1)):b.nodeAfter.isBlock?u.setSelection(Ot.create(u.doc,b.pos)):u.setSelection(Vt.create(u.doc,b.pos));else{const E=(g=b.parent.type.contentMatch.defaultType)===null||g===void 0?void 0:g.create();E&&(u.insert(S,E),u.setSelection(Vt.create(u.doc,S+1)))}u.scrollIntoView()}return!0}).run()}}},addInputRules(){return[v4({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),HF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,qF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,WF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,GF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,ZF=oo.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",ci(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Wc({find:HF,type:this.type}),Wc({find:WF,type:this.type})]},addPasteRules(){return[Gc({find:qF,type:this.type}),Gc({find:GF,type:this.type})]}}),wS=/^(\d+)\.\s$/,YF=xs.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",ci(this.options.HTMLAttributes,n),0]:["ol",ci(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(G0.name,this.editor.getAttributes(Yh.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Lh({find:wS,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Lh({find:wS,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Yh.name)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),XF=xs.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",ci(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),KF=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,JF=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,QF=oo.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",ci(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Wc({find:KF,type:this.type})]},addPasteRules(){return[Gc({find:JF,type:this.type})]}}),kS=xs.create({name:"text",group:"inline"}),e6=Ai.create({name:"starterKit",addExtensions(){var t,e,n,i,r,a,u,l,g,b,S,E,C,P,D,R,j,W;const ee=[];return this.options.bold!==!1&&ee.push(dF.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&ee.push(aF.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&ee.push(pF.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&ee.push(gF.configure((i=this.options)===null||i===void 0?void 0:i.code)),this.options.codeBlock!==!1&&ee.push(mS.configure((r=this.options)===null||r===void 0?void 0:r.codeBlock)),this.options.document!==!1&&ee.push(bF.configure((a=this.options)===null||a===void 0?void 0:a.document)),this.options.dropcursor!==!1&&ee.push(wF.configure((u=this.options)===null||u===void 0?void 0:u.dropcursor)),this.options.gapcursor!==!1&&ee.push(IF.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&ee.push(PF.configure((g=this.options)===null||g===void 0?void 0:g.hardBreak)),this.options.heading!==!1&&ee.push(DF.configure((b=this.options)===null||b===void 0?void 0:b.heading)),this.options.history!==!1&&ee.push(jF.configure((S=this.options)===null||S===void 0?void 0:S.history)),this.options.horizontalRule!==!1&&ee.push(UF.configure((E=this.options)===null||E===void 0?void 0:E.horizontalRule)),this.options.italic!==!1&&ee.push(ZF.configure((C=this.options)===null||C===void 0?void 0:C.italic)),this.options.listItem!==!1&&ee.push(G0.configure((P=this.options)===null||P===void 0?void 0:P.listItem)),this.options.orderedList!==!1&&ee.push(YF.configure((D=this.options)===null||D===void 0?void 0:D.orderedList)),this.options.paragraph!==!1&&ee.push(XF.configure((R=this.options)===null||R===void 0?void 0:R.paragraph)),this.options.strike!==!1&&ee.push(QF.configure((j=this.options)===null||j===void 0?void 0:j.strike)),this.options.text!==!1&&ee.push(kS.configure((W=this.options)===null||W===void 0?void 0:W.text)),ee}}),t6=Ai.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;return(e=t.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}});function n6(t){var e;const{char:n,allowSpaces:i,allowedPrefixes:r,startOfLine:a,$position:u}=t,l=w4(n),g=new RegExp(`\\s${l}$`),b=a?"^":"",S=i?new RegExp(`${b}${l}.*?(?=\\s${l}|$)`,"gm"):new RegExp(`${b}(?:^)?${l}[^\\s${l}]*`,"gm"),E=((e=u.nodeBefore)===null||e===void 0?void 0:e.isText)&&u.nodeBefore.text;if(!E)return null;const C=u.pos-E.length,P=Array.from(E.matchAll(S)).pop();if(!P||P.input===void 0||P.index===void 0)return null;const D=P.input.slice(Math.max(0,P.index-1),P.index),R=new RegExp(`^[${r==null?void 0:r.join("")}\0]?$`).test(D);if(r!==null&&!R)return null;const j=C+P.index;let W=j+P[0].length;return i&&g.test(E.slice(W-1,W+1))&&(P[0]+=" ",W+=1),j<u.pos&&W>=u.pos?{range:{from:j,to:W},query:P[0].slice(n.length),text:P[0]}:null}const i6=new Ar("suggestion");function r6({pluginKey:t=i6,editor:e,char:n="@",allowSpaces:i=!1,allowedPrefixes:r=[" "],startOfLine:a=!1,decorationTag:u="span",decorationClass:l="suggestion",command:g=()=>null,items:b=()=>[],render:S=()=>({}),allow:E=()=>!0,findSuggestionMatch:C=n6}){let P;const D=S==null?void 0:S(),R=new Fi({key:t,view(){return{update:async(j,W)=>{var ee,le,J,Te,xe,Ae,je;const De=(ee=this.key)===null||ee===void 0?void 0:ee.getState(W),Ke=(le=this.key)===null||le===void 0?void 0:le.getState(j.state),rt=De.active&&Ke.active&&De.range.from!==Ke.range.from,Rt=!De.active&&Ke.active,pt=De.active&&!Ke.active,zt=!Rt&&!pt&&De.query!==Ke.query,Xt=Rt||rt&&zt,on=zt||rt,$t=pt||rt&&zt;if(!Xt&&!on&&!$t)return;const Kt=$t&&!Xt?De:Ke,Cn=j.dom.querySelector(`[data-decoration-id="${Kt.decorationId}"]`);P={editor:e,range:Kt.range,query:Kt.query,text:Kt.text,items:[],command:dn=>g({editor:e,range:Kt.range,props:dn}),decorationNode:Cn,clientRect:Cn?()=>{var dn;const{decorationId:vn}=(dn=this.key)===null||dn===void 0?void 0:dn.getState(e.state),pn=j.dom.querySelector(`[data-decoration-id="${vn}"]`);return(pn==null?void 0:pn.getBoundingClientRect())||null}:null},Xt&&((J=D==null?void 0:D.onBeforeStart)===null||J===void 0||J.call(D,P)),on&&((Te=D==null?void 0:D.onBeforeUpdate)===null||Te===void 0||Te.call(D,P)),(on||Xt)&&(P.items=await b({editor:e,query:Kt.query})),$t&&((xe=D==null?void 0:D.onExit)===null||xe===void 0||xe.call(D,P)),on&&((Ae=D==null?void 0:D.onUpdate)===null||Ae===void 0||Ae.call(D,P)),Xt&&((je=D==null?void 0:D.onStart)===null||je===void 0||je.call(D,P))},destroy:()=>{var j;P&&((j=D==null?void 0:D.onExit)===null||j===void 0||j.call(D,P))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(j,W,ee,le){const{isEditable:J}=e,{composing:Te}=e.view,{selection:xe}=j,{empty:Ae,from:je}=xe,De={...W};if(De.composing=Te,J&&(Ae||e.view.composing)){(je<W.range.from||je>W.range.to)&&!Te&&!W.composing&&(De.active=!1);const Ke=C({char:n,allowSpaces:i,allowedPrefixes:r,startOfLine:a,$position:xe.$from}),rt=`id_${Math.floor(Math.random()*4294967295)}`;Ke&&E({editor:e,state:le,range:Ke.range,isActive:W.active})?(De.active=!0,De.decorationId=W.decorationId?W.decorationId:rt,De.range=Ke.range,De.query=Ke.query,De.text=Ke.text):De.active=!1}else De.active=!1;return De.active||(De.decorationId=null,De.range={from:0,to:0},De.query=null,De.text=null),De}},props:{handleKeyDown(j,W){var ee;const{active:le,range:J}=R.getState(j.state);return le&&((ee=D==null?void 0:D.onKeyDown)===null||ee===void 0?void 0:ee.call(D,{view:j,event:W,range:J}))||!1},decorations(j){const{active:W,range:ee,decorationId:le}=R.getState(j);return W?pi.create(j.doc,[Zr.inline(ee.from,ee.to,{nodeName:u,class:l,"data-decoration-id":le})]):null}}});return R}const s6=new Ar("mention"),o6=xs.create({name:"mention",addOptions(){return{HTMLAttributes:{},renderText({options:t,node:e}){var n;return`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e}){var n;return["span",ci(this.HTMLAttributes,t.HTMLAttributes),`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`]},suggestion:{char:"@",pluginKey:s6,command:({editor:t,range:e,props:n})=>{var i,r,a;const u=t.view.state.selection.$to.nodeAfter;((i=u==null?void 0:u.text)===null||i===void 0?void 0:i.startsWith(" "))&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:this.name,attrs:n},{type:"text",text:" "}]).run(),(a=(r=t.view.dom.ownerDocument.defaultView)===null||r===void 0?void 0:r.getSelection())===null||a===void 0||a.collapseToEnd()},allow:({state:t,range:e})=>{const n=t.doc.resolve(e.from),i=t.schema.nodes[this.name];return!!n.parent.type.contentMatch.matchType(i)}}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",ci({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t})];const n={...this.options};n.HTMLAttributes=ci({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:n,node:t});return typeof i=="string"?["span",ci({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},renderText({node:t}){return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel({options:this.options,node:t})):this.options.renderText({options:this.options,node:t})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:i}=e,{empty:r,anchor:a}=i;return r?(e.doc.nodesBetween(a-1,a,(u,l)=>{if(u.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",l,l+u.nodeSize),!1}),n):!1})}},addProseMirrorPlugins(){return[r6({editor:this.editor,...this.options.suggestion})]}}),a6=oo.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",ci(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),l6={props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function c6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleBlockquote&&a.toggleBlockquote(...u)),class:"p-1.5 text-gray-500 rounded hover:text-gray-900 dark:hover:text-white focus:outline-none"},e[1]||(e[1]=[f.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[f.createElementVNode("path",{"fill-rule":"evenodd",d:"M6 6a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3H5a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2H6Zm9 0a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3h-1a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3Z"})],-1)]))}const u6=$e(l6,[["render",c6]]),h6={props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function d6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleBulletList&&a.toggleBulletList(...u)),class:"p-1.5 text-gray-500 rounded hover:text-gray-900 dark:hover:text-white focus:outline-none"},e[1]||(e[1]=[f.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[f.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 8h10M9 12h10M9 16h10M4.99 8H5m-.02 4h.01m0 4H5"})],-1)]))}const p6=$e(h6,[["render",d6]]),f6={props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function m6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleOrderedList&&a.toggleOrderedList(...u)),class:"p-1.5 text-gray-500 rounded hover:text-gray-900 dark:hover:text-white focus:outline-none"},e[1]||(e[1]=[f.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[f.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6h8m-8 6h8m-8 6h8M4 16a2 2 0 1 1 3.321 1.5L4 20h5M4 5l2-1v6m-2 0h4"})],-1)]))}const g6=$e(f6,[["render",m6]]),y6={props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function _6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleCodeBlock&&a.toggleCodeBlock(...u)),class:"p-1.5 text-gray-500 rounded hover:text-gray-900 dark:hover:text-white focus:outline-none"},e[1]||(e[1]=[f.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24"},[f.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8 8-4 4 4 4m8 0 4-4-4-4m-2-3-4 14"})],-1)]))}const b6=$e(y6,[["render",_6]]),x6={props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.chain().toggleBold().run()}}};function v6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleBold&&a.toggleBold(...u)),class:f.normalizeClass(["p-1.5 text-gray-500 rounded cursor-pointer hover:text-gray-900 hover:bg-gray-200",{"bg-gray-200 text-gray-900":n.editor.isActive("bold")}])},e[1]||(e[1]=[f.createElementVNode("svg",{class:"w-5 h-5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24"},[f.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 5h4.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0-7H6m2 7h6.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0 0H6"})],-1),f.createElementVNode("span",{class:"sr-only"},"Bold",-1)]),2)}const w6=$e(x6,[["render",v6]]),k6={props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function S6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleItalic&&a.toggleItalic(...u)),class:f.normalizeClass(["p-1.5 text-gray-500 rounded cursor-pointer hover:text-gray-900 hover:bg-gray-200",{"bg-gray-200 text-gray-900":n.editor.isActive("italic")}])},e[1]||(e[1]=[f.createElementVNode("svg",{class:"w-5 h-5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24"},[f.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8.874 19 6.143-14M6 19h6.33m-.66-14H18"})],-1),f.createElementVNode("span",{class:"sr-only"},"Italic",-1)]),2)}const E6=$e(k6,[["render",S6]]),C6={},T6={"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"};function M6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",T6,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 19.2H5.5c-.3 0-.5-.2-.5-.5V16c0-.2.2-.4.5-.4h13c.3 0 .5.2.5.4v2.7c0 .3-.2.5-.5.5H18m-6-1 1.4 1.8h.2l1.4-1.7m-7-5.4L12 4c0-.1 0-.1 0 0l4 8.8m-6-2.7h4m-7 2.7h2.5m5 0H17"},null,-1)]))}const A6={components:{IconA:$e(C6,[["render",M6]])},props:{editor:Object},data(){return{color:"#000000",colors:["#000000","#0055CC","#206A83","#216E4E","#E56910","#AE2E24","#5E4DB2","#758195","#FF0000","#008000","#28A9AB","#AB7222"]}},methods:{setColor(t){this.editor&&(this.editor.chain().focus().setColor(t).run(),this.$refs.popover.togglePopover(),this.color=t)}}},I6={class:"relative flex"},P6={class:"flex w-[160px] flex-wrap gap-[4px]"},D6=["onClick"];function O6(t,e,n,i,r,a){const u=f.resolveComponent("IconA"),l=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(l,{ref:"popover",placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",I6,[f.createVNode(u,{height:"20",width:"20",class:"text-gray-500"}),f.createElementVNode("span",{class:"absolute h-[4px] w-[80%] bottom-[2px] left-[2px]",style:f.normalizeStyle({backgroundColor:r.color})},null,4)])]),default:f.withCtx(()=>[f.createElementVNode("div",null,[f.createElementVNode("ul",P6,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.colors,g=>(f.openBlock(),f.createElementBlock("li",{class:"h-[37px] w-[37px] rounded",style:f.normalizeStyle({backgroundColor:g}),onClick:b=>a.setColor(g),key:g},null,12,D6))),128))])])]),_:1},512)}const z6=$e(A6,[["render",O6]]),B6={},N6={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-dots-vertical"};function R6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",N6,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),f.createElementVNode("path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),f.createElementVNode("path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)]))}const SS=$e(B6,[["render",R6]]),L6={components:{IconMore:SS},props:{editor:Object},methods:{toggleUnderline(){this.$refs.popover.togglePopover(),this.editor&&this.editor.chain().focus().toggleUnderline().run()},toggleStrike(){this.$refs.popover.togglePopover(),this.editor&&this.editor.chain().focus().toggleStrike().run()}}};function V6(t,e,n,i,r,a){const u=f.resolveComponent("IconMore"),l=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(l,{ref:"popover",placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",{class:f.normalizeClass(["p-1.5 text-gray-500 rounded cursor-pointer hover:text-gray-900 hover:bg-gray-200",{"bg-gray-200 text-gray-900":n.editor.isActive("underline")||n.editor.isActive("strike")}])},[f.createVNode(u,{height:"18",width:"18",class:"rotate-90"})],2)]),default:f.withCtx(()=>[f.createElementVNode("div",null,[f.createElementVNode("button",{onClick:e[0]||(e[0]=(...g)=>a.toggleUnderline&&a.toggleUnderline(...g)),class:f.normalizeClass(["p-[8px] block rounded-lg w-[140px] mb-[4px] text-start hover:bg-gray-100 !duration-300 underline underline-offset-1",{"bg-gray-100 text-gray-900":n.editor.isActive("underline")}])}," Підкресленний ",2),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...g)=>a.toggleStrike&&a.toggleStrike(...g)),class:f.normalizeClass(["p-[8px] block rounded-lg w-[140px] text-start hover:bg-gray-100 !duration-300 line-through",{"bg-gray-100 text-gray-900":n.editor.isActive("strike")}])}," Перекресленний ",2)])]),_:1},512)}const F6={bold:w6,italic:E6,text_more:$e(L6,[["render",V6]]),color:z6,bullet_list:p6,ordered_list:g6,blockquote:u6,codeblock:b6},$6={components:{EditorContent:sF},props:{controls:{type:Array,default:()=>["bold","italic","color","blockquote","bullet_list","ordered_list","codeblock","text_more"]},options:{type:Array,default:()=>[]},modelValue:{type:String,default:()=>""}},data(){return{editor:null}},computed:{controlsList(){return Object.entries(F6).filter(([t])=>this.controls.includes(t)).map(([t,e])=>e)}},watch:{modelValue(t){this.editor&&this.editor.getHTML()!==t&&this.editor.commands.setContent(t)},editor(t){t&&this.editor.on("update",({editor:e})=>{const n=e.getHTML();n!==this.modelValue&&this.$emit("update:modelValue",n)})}},mounted(){this.editor&&this.editor.destroy(),this.initEditor()},beforeDestroy(){this.editor&&this.editor.destroy()},methods:{initEditor(){this.editor=new rF({content:this.modelValue,extensions:[e6,mS,Yh,t6,a6,kS,o6.configure({HTMLAttributes:{class:"mention"},suggestion:{items:({query:t})=>{const e=this.options.filter(n=>{var i,r;return(r=(i=n==null?void 0:n.email)==null?void 0:i.toLowerCase())==null?void 0:r.includes(t==null?void 0:t.toLowerCase())}).slice(0,5);return e.length?e:[{id:null,text:"Данні відсутні",email:null}]},render:()=>{let t,e;return{onStart:n=>{t=document.createElement("div"),t.className="mention-popup",n.items.forEach(a=>{const u=document.createElement("div");u.className="mention-option",a.id===null?(u.textContent=a.text,u.style.pointerEvents="none",u.style.color="#999"):(u.textContent=a.text,u.addEventListener("click",()=>{n.command({id:a.id,label:a.email})})),t.appendChild(u)}),document.body.appendChild(t);const{from:i}=n.range,r=n.editor.view.coordsAtPos(i);t.style.position="absolute",t.style.left=`${r.left}px`,t.style.top=`${r.top-t.offsetHeight}px`,e=t},onUpdate:n=>{for(;t.firstChild;)t.removeChild(t.firstChild);n.items.forEach(a=>{const u=document.createElement("div");u.className="mention-option",a.id===null?(u.textContent=a.text,u.style.pointerEvents="none",u.style.color="#999"):(u.textContent=a.text,u.addEventListener("click",()=>{n.command({id:a.id,label:a.email})})),t.appendChild(u)});const{from:i}=n.range,r=n.editor.view.coordsAtPos(i);t.style.left=`${r.left}px`,t.style.top=`${r.top-t.offsetHeight}px`},onExit:()=>{e&&e.remove()}}}}})]})},focusEditor(){this.editor&&!this.editor.isFocused&&this.editor.commands.focus()}}},j6={class:"w-full border border-gray-200 rounded-lg editor-container bg-gray-50 dark:bg-gray-700 dark:border-gray-600"},U6={key:0,class:"flex flex-wrap items-center w-full gap-2 px-3 py-2 border-b editor-toolbar dark:border-gray-600"};function H6(t,e,n,i,r,a){const u=f.resolveComponent("EditorContent");return f.openBlock(),f.createElementBlock("div",j6,[r.editor?(f.openBlock(),f.createElementBlock("div",U6,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.controlsList,(l,g)=>(f.openBlock(),f.createBlock(f.resolveDynamicComponent(l),{key:g,editor:r.editor},null,8,["editor"]))),128))])):f.createCommentVNode("",!0),f.createElementVNode("div",{onClick:e[0]||(e[0]=(...l)=>a.focusEditor&&a.focusEditor(...l)),class:"relative w-full px-4 py-2 bg-white rounded-b-lg editor-content dark:bg-gray-800"},[f.createVNode(u,{editor:r.editor,class:"relative w-full"},null,8,["editor"])])])}const ES=$e($6,[["render",H6]]),q6=t=>{const e=/(\b\S)?/g,n=t.match(e);return n?n.join("").toUpperCase():""},W6={props:{name:{type:String,default(){return""}},avatar:{type:String,default(){return""}}},computed:{inItials(){return q6(this.name)}}},G6={class:"mr-2"},Z6=["src"],Y6={key:1,class:"flex flex-shrink-0 items-center justify-center w-6 h-6 bg-gray-500 text-xs text-white rounded-full"},X6={key:0},K6={key:1,class:"text-sm"};function J6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",G6,[n.avatar?(f.openBlock(),f.createElementBlock("img",{key:0,src:n.avatar,alt:"avatar",class:"flex flex-shrink-0 items-center justify-center w-6 h-6 rounded-full"},null,8,Z6)):n.name?(f.openBlock(),f.createElementBlock("div",Y6,[a.inItials.length?(f.openBlock(),f.createElementBlock("span",X6,f.toDisplayString(a.inItials),1)):(f.openBlock(),f.createElementBlock("span",K6,e[0]||(e[0]=[f.createElementVNode("i",{class:"ti ti-user"},null,-1)])))])):f.createCommentVNode("",!0)])}const Q6={components:{VsWidgetCommentsAvatar:$e(W6,[["render",J6]]),VsTextEditor:ES},props:{comment:{type:Object,default:()=>({})},user:{type:Object,default:()=>({})},id:{type:String,default:""},options:Array},data(){return{commentContent:this.comment.body,isCommentActionVisible:!1,isOpen:!1,textareaValue:""}},computed:{isUserAutor(){return this.user.uid===this.comment.uid},createDate(){try{const t=ut(this.comment.cdate,"YYYY-MM-DD");return new Date(t).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}},watch:{isOpen(t){t&&(this.textareaValue=this.comment.body)}},methods:{confirnDeleteComment(){document.body.click(),this.$emit("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей коментар?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:this.deleteComment,updateListOnConfirm:!0})},async updateComment(){try{await ct.post(`/api/widget/comment/${this.id}/${this.comment.communication_id}`,{body:this.textareaValue}),this.$emit("list-update"),this.isOpen=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},openEditModal(){document.body.click(),this.isOpen=!0},async deleteComment(){try{await ct.delete(`/api/widget/comment/${this.id}/${this.comment.communication_id}`),this.$emit("list-update"),this.isCommentActionVisible=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},toggleCommentAction(){this.isCommentActionVisible=!this.isCommentActionVisible}}},e$={class:"p-6 pl-1 text-base bg-white dark:bg-gray-900"},t$={class:"flex justify-between items-center mb-2"},n$={class:"flex items-center"},i$={class:"inline-flex items-center mr-3 text-sm text-gray-900 dark:text-white font-semibold"},r$={class:"text-sm text-gray-600 dark:text-gray-400"},s$={class:"flex flex-col items-center gap-[4px]"},o$=["innerHTML"],a$={class:"flex flex-col gap-[8px] text-sm font-medium text-gray-500"},l$={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function c$(t,e,n,i,r,a){const u=f.resolveComponent("VsWidgetCommentsAvatar"),l=f.resolveComponent("VsPopover"),g=f.resolveComponent("VsTextEditor"),b=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("div",e$,[f.createElementVNode("div",t$,[f.createElementVNode("div",n$,[f.createElementVNode("p",i$,[f.createVNode(u,{name:n.comment.username,avatar:n.comment.avatar},null,8,["name","avatar"]),f.createTextVNode(f.toDisplayString(n.comment.username),1)]),f.createElementVNode("p",r$,[f.createElementVNode("time",null,f.toDisplayString(a.createDate),1)])]),f.createVNode(l,{placement:"bottom"},{reference:f.withCtx(()=>e[6]||(e[6]=[f.createElementVNode("button",{class:"inline-flex items-center p-2 text-sm font-medium text-center text-gray-500 dark:text-gray-40 bg-white rounded-lg hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-50 dark:bg-gray-900 dark:hover:bg-gray-700 dark:focus:ring-gray-600",type:"button"},[f.createElementVNode("svg",{class:"w-4 h-4","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 3"},[f.createElementVNode("path",{d:"M2 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm6.041 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM14 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Z"})])],-1)])),default:f.withCtx(()=>[f.createElementVNode("div",s$,[f.createElementVNode("button",{type:"button",class:"block px-[12px] rounded-lg py-[4px] text-start w-[100px] duration-300 hover:bg-gray-100",onClick:e[0]||(e[0]=(...S)=>a.openEditModal&&a.openEditModal(...S))}," Редагувати "),f.createElementVNode("button",{type:"button",class:"block py-2 px-[12px] rounded-lg py-[6px] text-start duration-300 w-[100px] hover:bg-gray-100",onClick:e[1]||(e[1]=S=>a.confirnDeleteComment())}," Видалити ")])]),_:1})]),f.createElementVNode("p",{class:"text-gray-500 dark:text-gray-400",innerHTML:n.comment.body},null,8,o$)]),f.createVNode(b,{visible:r.isOpen,"onUpdate:visible":e[5]||(e[5]=S=>r.isOpen=S),title:"Редагувати",size:"small"},{footer:f.withCtx(()=>[f.createElementVNode("div",l$,[f.createElementVNode("button",{onClick:e[3]||(e[3]=S=>r.isOpen=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Відмінити "),f.createElementVNode("button",{onClick:e[4]||(e[4]=(...S)=>a.updateComment&&a.updateComment(...S)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:f.withCtx(()=>[f.createElementVNode("div",a$,[e[7]||(e[7]=f.createTextVNode(" Коментар ")),f.createVNode(g,{modelValue:r.textareaValue,"onUpdate:modelValue":e[2]||(e[2]=S=>r.textareaValue=S),options:n.options},null,8,["modelValue","options"])])]),_:1},8,["visible"])],64)}const u$={components:{VsWidgetCommentsItem:$e(Q6,[["render",c$]])},inject:["activeAddFormEditor"],props:{id:{type:String,default:()=>""},prefilledData:{type:Object,default:null},options:Array},data(){return{isLoaded:!1,isLoadFailed:!1,comments:[],user:{},modal:{title:"",message:"",cancel:"",confirm:"",cancelButtonText:"",confirmButtonText:""},isModalVisible:!1}},async created(){await this.getComments()},methods:{async getComments(){if(this.prefilledData){this.comments=this.prefilledData.rows,this.isLoaded=!0;return}try{const{data:t}=await ct.get(`/api/widget/comment/${this.id}`);this.comments=t.rows,this.user=t.user}catch(t){this.isLoadFailed=!0,console.error(t)}this.isLoaded=!0,this.$emit("update-comment-count")},prepareModal(t){const e={...t};return t.cancel||(e.cancel=()=>{this.isModalVisible=!1}),t.updateListOnConfirm&&(e.confirm=async()=>{await t.confirm(),this.isModalVisible=!1}),e},handleOpenModal(t){this.modal=this.prepareModal(t),this.isModalVisible=!0}}},h$={class:"flex flex-col"},d$={key:0,class:"max-h-[300px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},p$={key:1},f$={class:"p-4"},m$={class:"mt-1 text-gray-500 dark:text-neutral-500"},g$={class:"mt-4 flex justify-end gap-x-3"};function y$(t,e,n,i,r,a){const u=f.resolveComponent("VsErrorOnLoading"),l=f.resolveComponent("VsWidgetCommentsItem"),g=f.resolveComponent("VsLoader"),b=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock("div",h$,[r.isLoaded?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[r.isLoadFailed?(f.openBlock(),f.createBlock(u,{key:0})):(f.openBlock(),f.createElementBlock(f.Fragment,{key:1},[r.comments.length?(f.openBlock(),f.createElementBlock("div",d$,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.comments,(S,E)=>(f.openBlock(),f.createBlock(l,{key:E,comment:S,user:r.user,options:n.options,index:E,id:n.id,onListUpdate:a.getComments,class:"border-top",onOpenModal:e[0]||(e[0]=C=>a.handleOpenModal(C))},null,8,["comment","user","options","index","id","onListUpdate"]))),128))])):(f.openBlock(),f.createElementBlock("div",p$,e[4]||(e[4]=[f.createElementVNode("p",{class:"pl-3 text-sm font-medium text-gray-600"}," Коментарі відсутні ",-1)])))],64))],64)):(f.openBlock(),f.createBlock(g,{key:1,class:"justify-center",text:"Please wait..."})),f.createVNode(b,{title:r.modal.title,size:"small",visible:r.isModalVisible,"onUpdate:visible":e[3]||(e[3]=S=>r.isModalVisible=S)},{default:f.withCtx(()=>[f.createElementVNode("div",f$,[f.createElementVNode("p",m$,f.toDisplayString(r.modal.message),1),f.createElementVNode("div",g$,[f.createElementVNode("button",{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 focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[1]||(e[1]=(...S)=>r.modal.cancel&&r.modal.cancel(...S))},f.toDisplayString(r.modal.cancelButtonText),1),f.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[2]||(e[2]=(...S)=>r.modal.confirm&&r.modal.confirm(...S))},f.toDisplayString(r.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const _$=$e(u$,[["render",y$]]),b$={components:{VsTextEditor:ES},props:{id:{type:String,default:()=>""},autofocus:{type:Boolean,default:()=>!0},options:Array},data(){return{isEditorOpen:!1,commentContent:""}},methods:{async addNewComment(){if(this.commentContent)try{await ct.post(`/api/widget/comment/${this.id}`,{body:this.commentContent}),this.commentContent="",this.$emit("list-update")}catch(t){console.error(t)}},setNewContent(t){this.commentContent=t}}},x$={class:"flex flex-col items-start w-full widget-comment-form"},v$={class:"w-full mb-4 bg-white border-gray-200 dark:bg-gray-800 dark:border-gray-700"},w$={class:"flex"};function k$(t,e,n,i,r,a){const u=f.resolveComponent("VsTextEditor");return f.openBlock(),f.createElementBlock("div",x$,[f.createElementVNode("div",v$,[f.createVNode(u,{modelValue:r.commentContent,"onUpdate:modelValue":e[0]||(e[0]=l=>r.commentContent=l),options:n.options},null,8,["modelValue","options"])]),f.createElementVNode("div",w$,[f.createElementVNode("button",{ref:"buttonAdd",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white",onClick:e[1]||(e[1]=(...l)=>a.addNewComment&&a.addNewComment(...l))}," Відправити коментар ",512)])])}const S$={components:{VsWidgetCommentsList:_$,VsWidgetCommentsAddForm:$e(b$,[["render",k$]])},props:{id:{type:String,default(){return""}},prefilledData:{type:Object,default:null}},data(){return{activeAddFormEditor:"",comments:[],totalComment:"0",options:[]}},mounted(){this.comments=this.$refs.commentListRef.comments,this.getUsersList()},watch:{comments(t){this.$emit("count-change",t.length)}},methods:{async getUsersList(){try{const{data:t}=await ct.get("/api/suggest/core.user_mentioned");this.options=t}catch(t){console.log(t)}},listUpdate(){this.$refs.commentListRef.getComments()},updateCommentCount(){this.totalComment=this.$refs.commentListRef.comments.length||"0"}}},E$={class:"w-full bg-white-200"};function C$(t,e,n,i,r,a){const u=f.resolveComponent("VsWidgetCommentsAddForm"),l=f.resolveComponent("VsWidgetCommentsList");return f.openBlock(),f.createElementBlock("div",E$,[e[2]||(e[2]=f.createElementVNode("div",{class:"flex items-center justify-between w-full mb-4 gap-x-2"},null,-1)),f.createVNode(u,{options:r.options,class:"mb-6",id:n.id,onListUpdate:e[0]||(e[0]=g=>a.listUpdate())},null,8,["options","id"]),f.createVNode(l,{options:r.options,id:n.id,onUpdateCommentCount:e[1]||(e[1]=g=>a.updateCommentCount()),"prefilled-data":n.prefilledData,ref:"commentListRef"},null,8,["options","id","prefilled-data"])])}const CS=$e(S$,[["render",C$]]),TS=t=>new Date(t).toLocaleDateString("uk-UK",{day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric"}),T$=t=>new Date(t).toLocaleDateString("uk-UK",{day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric"}),M$=t=>{const e=/(\b\S)?/g,n=t.match(e);return n?n.join("").toUpperCase():""},A$=f.defineComponent({props:{username:{type:String,default:()=>""}},computed:{inItials(){return M$(this.username)}}}),I$={class:"flex flex-shrink-0 items-center justify-center w-8 h-8 bg-gray-500 text-xs text-white rounded-full"};function P$(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",I$,f.toDisplayString(t.inItials),1)}const D$=$e(A$,[["render",P$]]),K0={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(i=>typeof i!="function").reduce((i,r)=>i.concat(r),[]).filter(i=>i&&!window.headLoadedFiles[i.url||i.split("?")[0]]);Promise.all(n.map(i=>this.loadFile1(i))).then(()=>{e&&e()})}catch(t){console.log(t)}},promise(t){return new Promise((e,n)=>{K0.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((i,r)=>{function a(l){delete window.headLoadedFiles[`_${n}`],window.headLoadedFiles[n]=l.type,i(l.type)}let u;window.headLoadedFiles[`_${n}`]?u=window.headLoadedFiles[`_${n}`]:(n.includes(".css")?(u=document.createElement("link"),u.href=t,u.type="text/css",u.rel="stylesheet"):(u=document.createElement("script"),u.type="text/javascript",u.src=t,e&&(u.type=e)),window.headLoadedFiles[`_${n}`]=u,document.head.appendChild(u)),u.addEventListener("load",a),u.addEventListener("error",a)})}},O$={props:{point:{type:String,default:()=>""}},data(){return{zoom:18}},computed:{parsedPoint(){return JSON.parse(this.point)},tooltipText(){return this.parsedPoint.coordinates.join(", ")},coordinates(){return[...this.parsedPoint.coordinates].reverse()}},async mounted(){typeof window>"u"||(window!=null&&window.L||(await K0.promise("https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.js"),await K0.promise("https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.js")),this.initMap())},methods:{initMap(){const t=window.L.map("map",{center:this.coordinates,zoom:this.zoom});window.L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png").addTo(t),window.L.circle(this.coordinates,{color:"red",fillColor:"red",fillOpacity:.2,radius:10}).addTo(t).bindTooltip(this.tooltipText)}}},z$={id:"map",style:{height:"9rem",width:"24rem"}};function B$(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",z$)}const N$=$e(O$,[["render",B$]]),R$=f.defineComponent({components:{VsWidgetHistoryItemAvatar:D$,VsWidgetHistoryItemMap:N$},props:{item:{type:Object,default:()=>{}}},methods:{getTitle(t){return t.title||t.attr},getOldValue(t){return t.old||"Не вказано"},getNewValue(t){return t.new||"Не вказано"},getDate(t){return T$(t.cdate)}}}),L$={class:"relative [&_p]:m-0"},V$={class:"flex items-center gap-3"},F$={class:"w-full flex justify-between"},$$={class:"text-gray-500"},j$={class:"text-gray-800 font-medium"},U$={class:"text-gray-500 text-sm"},H$={class:"mt-2 pl-10"},q$={key:0},W$={key:1,class:"flex items-center gap-2 text-gray-700 text-sm"},G$={class:"font-medium"},Z$={class:"font-medium"};function Y$(t,e,n,i,r,a){const u=f.resolveComponent("VsWidgetHistoryItemAvatar"),l=f.resolveComponent("VsWidgetHistoryItemMap");return f.openBlock(),f.createElementBlock("div",L$,[f.createElementVNode("div",V$,[f.createVNode(u,{username:t.item.username},null,8,["username"]),f.createElementVNode("div",F$,[f.createElementVNode("p",$$,[f.createElementVNode("span",j$,f.toDisplayString(t.item.username),1),e[0]||(e[0]=f.createTextVNode(" змінив данні: "))]),f.createElementVNode("p",U$,f.toDisplayString(t.getDate(t.item)),1)])]),f.createElementVNode("div",H$,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(t.item.changes,(g,b)=>(f.openBlock(),f.createElementBlock("div",{key:b},[g.attr==="geom"?(f.openBlock(),f.createElementBlock("div",q$,[e[1]||(e[1]=f.createElementVNode("p",null,"Додана геометрія:",-1)),g.new?(f.openBlock(),f.createBlock(l,{key:0,point:g.new},null,8,["point"])):f.createCommentVNode("",!0)])):(f.openBlock(),f.createElementBlock("div",W$,[f.createElementVNode("p",null,f.toDisplayString(`- ${t.getTitle(g)}:`),1),f.createElementVNode("p",G$,f.toDisplayString(t.getOldValue(g)),1),e[2]||(e[2]=f.createElementVNode("i",{class:"ti ti-arrow-right"},null,-1)),f.createElementVNode("p",Z$,f.toDisplayString(t.getNewValue(g)),1)]))]))),128))])])}const X$=$e(R$,[["render",Y$]]),K$=f.defineComponent({components:{VsWidgetHistoryItem:X$,VsEmptyWidget:Uv},props:{id:{type:String,default:""},prefilledData:{type:Object,default:null}},data:()=>({history:{}}),computed:{createdDate(){return this.history.data?TS(this.history.data.cdate):""},lastEditDate(){return this.history.data?TS(this.history.data.edate):""},authorName(){return this.history.data?this.history.data.author:""}},methods:{async getHistoryData(){if(this.prefilledData){this.history=this.prefilledData;return}try{const{data:t}=await ct.get(`/api/widget/history/${this.id}`);this.history=t}catch(t){console.error(t)}}},async mounted(){await this.getHistoryData()},watch:{"history.rows":function(t){this.$emit("count-change",t.length)}}}),J$={class:"bg-white"},Q$={key:0,class:"space-y-6 list-none relative !px-0 sm:before:absolute sm:before:top-2 sm:before:bottom-0 sm:before:w-0.5 sm:before:left-4 before:bg-gray-200 max-h-[400px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},e8={key:1,class:"w-full h-[330px] flex items-center justify-center"};function t8(t,e,n,i,r,a){var l;const u=f.resolveComponent("VsWidgetHistoryItem");return f.openBlock(),f.createElementBlock("div",J$,[e[0]||(e[0]=f.createElementVNode("div",{class:"flex items-center justify-between mb-4 gap-x-2"},null,-1)),(l=t.history.rows)!=null&&l.length?(f.openBlock(),f.createElementBlock("ul",Q$,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(t.history.rows,g=>(f.openBlock(),f.createElementBlock("li",{class:"list-none mr-[10px]",key:g.uid},[f.createVNode(u,{item:g},null,8,["item"])]))),128))])):(f.openBlock(),f.createElementBlock("div",e8," Історія відсутні "))])}const n8={"vs-widget-map":W1,"vs-widget-gallery":DN,"vs-widget-comments":CS,"vs-widget-file":qv,"vs-widget-history":$e(K$,[["render",t8]])},i8={"table-format-text":yp,"table-format-select":$x,"table-format-badge":Vx,"table-format-swetch":_p,"table-format-check":_p,"table-format-html":yp,"table-format-tags":jx,"table-format-date":oy,"table-format-number":F1,"table-format-slot":$1},r8={style:{width:"calc(100vw - 300px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 flex items-center justify-center"},s8={__name:"vs-dashboard",setup(t){return(e,n)=>(f.openBlock(),f.createElementBlock("div",r8,n[0]||(n[0]=[f.createElementVNode("div",{class:"p-5 md:p-8 bg-white border border-gray-200 shadow-sm rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[f.createElementVNode("div",{class:"mb-4 xl:mb-8"},[f.createElementVNode("h1",{class:"text-lg font-semibold text-gray-800 dark:text-neutral-200"}," Members "),f.createElementVNode("p",{class:"text-sm text-gray-500 dark:text-neutral-500"}," Manage members and users of your workspace and set their access level. ")]),f.createElementVNode("div",{class:"space-y-5"},[f.createElementVNode("div",{class:"flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5"},[f.createElementVNode("div",{class:"relative w-full"},[f.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-20 ps-3.5"},[f.createElementVNode("svg",{class:"shrink-0 size-4 text-gray-500 dark:text-neutral-400",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"},[f.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),f.createElementVNode("path",{d:"m21 21-4.3-4.3"})])]),f.createElementVNode("input",{type:"text",class:"py-2 ps-10 pe-8 block w-full bg-gray-100 border-transparent rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Search by name or email"}),f.createElementVNode("div",{class:"hidden absolute inset-y-0 end-0 flex items-center pointer-events-none z-20 pe-1"},[f.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-6 rounded-full text-gray-500 hover:text-blue-600 focus:outline-none focus:text-blue-600 dark:text-neutral-500 dark:hover:text-blue-500 dark:focus:text-blue-500","aria-label":"Close"},[f.createElementVNode("span",{class:"sr-only"},"Close"),f.createElementVNode("svg",{class:"shrink-0 size-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"},[f.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),f.createElementVNode("path",{d:"m15 9-6 6"}),f.createElementVNode("path",{d:"m9 9 6 6"})])])])]),f.createElementVNode("div",{class:"flex justify-end items-center gap-x-2"},[f.createElementVNode("button",{type:"button",class:"p-2.5 sm:py-2 sm:px-3 inline-flex items-center 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 focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[f.createElementVNode("svg",{class:"shrink-0 sm:me-2 size-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"},[f.createElementVNode("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),f.createElementVNode("polyline",{points:"7 10 12 15 17 10"}),f.createElementVNode("line",{x1:"12",x2:"12",y1:"15",y2:"3"})]),f.createElementVNode("span",{class:"hidden sm:block"}," Download CSV ")]),f.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-1 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-2 focus:ring-blue-500","data-hs-overlay":"#hs-pro-dshm"},[f.createElementVNode("span",{class:"hidden sm:block"},"Send"),f.createTextVNode("Invite ")])])]),f.createElementVNode("div",{class:"grid sm:grid-cols-2 lg:grid-cols-4 gap-2 xl:gap-4"},[f.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[f.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[f.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}),f.createElementVNode("div",{class:"flex items-center -space-x-2"},[f.createElementVNode("img",{class:"shrink-0 size-7 rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Avatar"})])]),f.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Admin")]),f.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[f.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[f.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 5 "),f.createElementVNode("div",{class:"flex items-center -space-x-2"},[f.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),f.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),f.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1679412330254-90cb240038c5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),f.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1659482634023-2c4fda99ac0c?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),f.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," O ")])]),f.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[f.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Members"),f.createElementVNode("div",{class:"hs-tooltip inline-block"},[f.createElementVNode("svg",{class:"hs-tooltip-toggle shrink-0 size-3.5 text-gray-500 dark:text-neutral-500",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},[f.createElementVNode("path",{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"}),f.createElementVNode("path",{d:"m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})]),f.createElementVNode("div",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 w-60 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded dark:bg-neutral-700",role:"tooltip","data-popper-placement":"top",style:{position:"fixed",inset:"auto auto 0px 0px",margin:"0px",transform:"translate(689px, -708px)"}}," Limited Access Members can only access the projects, tasks, and messages explicitly shared with them. ")])])]),f.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[f.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[f.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 2 "),f.createElementVNode("div",{class:"flex items-center -space-x-2"},[f.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),f.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," 0 ")])]),f.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[f.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"}," Limited access members "),f.createElementVNode("div",{class:"hs-tooltip inline-block"},[f.createElementVNode("svg",{class:"hs-tooltip-toggle shrink-0 size-3.5 text-gray-500 dark:text-neutral-500",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},[f.createElementVNode("path",{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"}),f.createElementVNode("path",{d:"m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})]),f.createElementVNode("div",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 w-60 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded dark:bg-neutral-700",role:"tooltip","data-popper-placement":"top",style:{position:"fixed",inset:"auto auto 0px 0px",margin:"0px",transform:"translate(1198px, -708px)"}}," Limited Access Members can only access the projects, tasks, and messages explicitly shared with them. ")])])]),f.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[f.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[f.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 0 "),f.createElementVNode("div",{class:"flex items-center -space-x-2"})]),f.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Pending invites")])]),f.createElementVNode("div",{class:"overflow-x-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},[f.createElementVNode("div",{class:"min-w-full inline-block align-middle"},[f.createElementVNode("table",{class:"min-w-full divide-y divide-gray-200 dark:divide-neutral-700"},[f.createElementVNode("thead",null,[f.createElementVNode("tr",null,[f.createElementVNode("th",{scope:"col",class:"min-w-[250px]"},[f.createElementVNode("div",{class:"pe-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Member ")]),f.createElementVNode("th",{scope:"col",class:"min-w-48"},[f.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Role ")]),f.createElementVNode("th",{scope:"col"},[f.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Email ")]),f.createElementVNode("th",{scope:"col",class:"min-w-36"},[f.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Last activity ")]),f.createElementVNode("th",{scope:"col"},[f.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Status ")])])]),f.createElementVNode("tbody",{class:"divide-y divide-gray-200 dark:divide-neutral-700"},[f.createElementVNode("tr",null,[f.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[f.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[f.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Avatar"}),f.createElementVNode("div",{class:"grow"},[f.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Admin ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," james@site.com ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"inline-flex items-center gap-x-1.5 py-1.5 px-2.5 text-xs font-medium bg-teal-100 text-teal-800 rounded-full dark:bg-teal-500/10 dark:text-teal-500"},[f.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),f.createTextVNode(" Active ")])])]),f.createElementVNode("tr",null,[f.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[f.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[f.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-[38px] bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),f.createElementVNode("div",{class:"grow"},[f.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," liza@site.com ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 2 days ago ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[f.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),f.createTextVNode(" Inactive ")])])]),f.createElementVNode("tr",null,[f.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[f.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[f.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1601935111741-ae98b2b230b0?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),f.createElementVNode("div",{class:"grow"},[f.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Daniel Hobbs ")])])]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," dhobbs@site.com ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[f.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),f.createTextVNode(" Inactive ")])])]),f.createElementVNode("tr",null,[f.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[f.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[f.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1679412330254-90cb240038c5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),f.createElementVNode("div",{class:"grow"},[f.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Brian Warner ")])])]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," brian@site.com ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 1 months ago ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"inline-flex items-center gap-x-1.5 py-1.5 px-2.5 text-xs font-medium bg-teal-100 text-teal-800 rounded-full dark:bg-teal-500/10 dark:text-teal-500"},[f.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),f.createTextVNode(" Active ")])])]),f.createElementVNode("tr",null,[f.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[f.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[f.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-[38px] bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," O "),f.createElementVNode("div",{class:"grow"},[f.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Ols Shols ")])])]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," olsshols@site.com ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 6 days ago ")]),f.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[f.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[f.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),f.createTextVNode(" Inactive ")])])])])])])])])],-1)])))}},o8={},a8={class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50"};function l8(t,e){return f.openBlock(),f.createElementBlock("div",a8," Custom component ")}const c8=$e(o8,[["render",l8]]),u8={},h8={class:"shrink-0 size-4 text-gray-400 dark:text-white/60",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function d8(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",h8,e[0]||(e[0]=[f.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),f.createElementVNode("path",{d:"m21 21-4.3-4.3"},null,-1)]))}const J0=$e(u8,[["render",d8]]),p8={components:{IconSearch:J0},data(){return{link:null,color:void 0,data:null,searchValue:""}},mounted(){this.link="/admin.user-cls",this.getData()},computed:{rows(){var t,e;return((e=(t=this.data)==null?void 0:t.rows)==null?void 0:e.filter(n=>{var i;return(i=n==null?void 0:n.name)==null?void 0:i.includes(this.searchValue)}))||null}},methods:{async getData(){try{const{data:t}=await ct.get("/api/user-cls?type=json");this.data=t}catch{}}}},f8={class:"w-[300px] border-r",style:{height:"calc(100vh - 60px)"}},m8={class:"relative"},g8={class:"flex flex-col w-[300px] gap-[4px] overflow-y-auto overflow-x-hidden p-[10px] pr-0 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300",style:{height:"calc(100vh - 100px)"}},y8={class:"w-[99%] overflow-hidden overflow-ellipsis"},_8={class:"ml-auto text-[10px] h-[16px] px-[6px] flex items-center justify-center rounded-full bg-gray-200"};function b8(t,e,n,i,r,a){const u=f.resolveComponent("IconSearch"),l=f.resolveComponent("VsText"),g=f.resolveComponent("router-link");return f.openBlock(),f.createElementBlock("div",f8,[f.createElementVNode("div",m8,[f.createVNode(u,{height:"16",width:"16",class:"absolute top-[12px] left-[30px] text-gray-500 z-[1]"}),f.createVNode(l,{type:"text",modelValue:r.searchValue,"onUpdate:modelValue":e[0]||(e[0]=b=>r.searchValue=b),clearable:!0,placeholder:"Пошук по меню",class:"[&>input]:h-[40px] [&>input]:block [&>input]:rounded-none [&>input]:border-x-0 [&>input]:pl-[60px] [&>input:focus]:outline-none [&>input:focus]:focus:ring-0 [&>input:focus]:border-y-gray-200 [&>input:focus]:border-y-1 [&>input:focus]:border-x-0"},null,8,["modelValue"])]),f.createElementVNode("ul",g8,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.rows,b=>{var S,E;return f.openBlock(),f.createElementBlock("li",{key:b==null?void 0:b.id,class:"w-full pr-[10px]"},[f.createVNode(g,{to:r.link+"?name="+((b==null?void 0:b.name)||(b==null?void 0:b.id)),class:f.normalizeClass(["py-2 px-5 group pr-[10px] flex items-center gap-x-3 w-full flex justify-between hover:bg-gray-100 rounded-lg duration-300",{"bg-gray-100":((E=(S=t.$route)==null?void 0:S.query)==null?void 0:E.name)===(b==null?void 0:b.name)}])},{default:f.withCtx(()=>[f.createElementVNode("span",y8,f.toDisplayString((b==null?void 0:b.name)||(b==null?void 0:b.id)),1),f.createElementVNode("span",_8,f.toDisplayString((b==null?void 0:b.children)||0),1)]),_:2},1032,["to","class"])])}),128))])])}const x8=$e(p8,[["render",b8]]),v8={props:{title:{type:String,default:()=>"Дані для відображення відсутні"},text:{type:String,default:()=>"Змініть параметри пошуку або спробуйте пізніше"}}},w8={class:"w-full"},k8={class:"p-5 min-h-[500px] flex flex-col justify-center items-center text-center"},S8={class:"max-w-sm mx-auto mt-6"},E8={class:"font-medium text-gray-800 dark:text-neutral-200"},C8={class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"};function T8(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",w8,[f.createElementVNode("div",k8,[e[0]||(e[0]=f.createStaticVNode('<svg class="w-48 mx-auto" viewBox="0 0 178 90" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs></svg>',1)),f.createElementVNode("div",S8,[f.createElementVNode("p",E8,f.toDisplayString(n.title),1),f.createElementVNode("p",C8,f.toDisplayString(n.text),1)])])])}const MS=$e(v8,[["render",T8]]),M8={props:{modelValue:{type:String,default:()=>"#172B4D"},colors:{type:Array,default:()=>["#172B4D","#0055CC","#206A83","#216E4E","#E56910","#AE2E24","#5E4DB2","#758195","#FF0000","#008000","#28A9AB","#AB7222"]}},methods:{updateColor(t){this.$emit("update:modelValue",t),this.$refs.popover.togglePopover()}}},A8={class:"flex w-[160px] flex-wrap gap-[4px]"},I8=["onClick"];function P8(t,e,n,i,r,a){const u=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(u,{ref:"popover",placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",{class:"h-[37px] w-[37px] rounded-lg flex items-center justify-center",style:f.normalizeStyle({backgroundColor:n.modelValue})},null,4)]),default:f.withCtx(()=>[f.createElementVNode("div",null,[f.createElementVNode("ul",A8,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.colors,l=>(f.openBlock(),f.createElementBlock("li",{class:"h-[37px] w-[37px] rounded",style:f.normalizeStyle({backgroundColor:l}),onClick:g=>a.updateColor(l),key:l},null,12,I8))),128))])])]),_:1},512)}const AS=$e(M8,[["render",P8]]),D8={components:{VsChoceColor:AS},props:{item:Object},data(){var t,e,n;return{color:((t=this.item)==null?void 0:t.color)||"#D1D5DB",text:((e=this.item)==null?void 0:e.text)||"",id:(n=this.item)==null?void 0:n.id}},watch:{color(t){this.$emit("update-item",{...this.item,color:t})},text(t){this.$emit("update-item",{...this.item,text:t})},id(t){this.$emit("update-item",{...this.item},t)}}},O8={class:"relative flex items-center p-3 bg-white border border-gray-200 group gap-x-3 rounded-xl"},z8={class:"flex flex-col"},B8={class:"flex gap-[30px]"},N8={class:"block text-sm font-semibold text-gray-800 text-start z-[10] cursor-pointer"},R8={class:"block text-sm font-semibold text-gray-400 text-start z-[10] cursor-pointer"},L8={class:"block text-xs text-gray-500 truncate dark:text-neutral-500"};function V8(t,e,n,i,r,a){var g;const u=f.resolveComponent("VsChoceColor"),l=f.resolveComponent("VsInlineEdit");return f.openBlock(),f.createElementBlock("div",O8,[f.createVNode(u,{modelValue:r.color,"onUpdate:modelValue":e[0]||(e[0]=b=>r.color=b)},null,8,["modelValue"]),f.createElementVNode("div",z8,[f.createElementVNode("div",B8,[f.createVNode(l,{modelValue:r.text,"onUpdate:modelValue":e[1]||(e[1]=b=>r.text=b),onUpdateValue:e[2]||(e[2]=b=>r.text=b)},{default:f.withCtx(()=>[f.createElementVNode("p",N8,f.toDisplayString(r.text),1)]),_:1},8,["modelValue"]),f.createVNode(l,{modelValue:r.id,"onUpdate:modelValue":e[3]||(e[3]=b=>r.id=b),onUpdateValue:e[4]||(e[4]=b=>r.id=b)},{default:f.withCtx(()=>[f.createElementVNode("p",R8,f.toDisplayString(r.id),1)]),_:1},8,["modelValue"])]),f.createElementVNode("p",L8,f.toDisplayString((g=n.item)==null?void 0:g.parent),1)])])}const F8={components:{VsReesterUsersItem:$e(D8,[["render",V8]])},props:{list:Array},data(){return{draggedItemIndex:null}},methods:{dragStart(t,e){this.draggedItemIndex=e,t.dataTransfer.effectAllowed="move"},dragOver(t){t.preventDefault()},drop(t,e){t.preventDefault();const n=this.draggedItemIndex;if(n!==e){const i=[...this.list],r=i[n];i.splice(n,1),i.splice(e,0,r),this.$emit("update-list",i)}this.draggedItemIndex=null},dragEnd(){this.draggedItemIndex=null},updateItem(t,e){var i;const n=(i=this.list)==null?void 0:i.findIndex(r=>(r==null?void 0:r.id)===(t==null?void 0:t.id));this.list[n]=t,e&&(this.list[n].id=e),this.$emit("update-list",this.list)}}},$8={class:"flex flex w-full flex-col gap-[10px] p-[10px] pt-[40px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300",style:{width:"calc(100vw - 1000px)","max-height":"calc(100vh - 430px)"}},j8=["onDragstart","onDrop"];function U8(t,e,n,i,r,a){const u=f.resolveComponent("VsReesterUsersItem");return f.openBlock(),f.createElementBlock("ul",$8,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.list,(l,g)=>(f.openBlock(),f.createElementBlock("li",{key:l==null?void 0:l.id,draggable:!0,onDragstart:b=>a.dragStart(b,g),onDragover:e[0]||(e[0]=b=>a.dragOver(b)),onDrop:b=>a.drop(b,g),onDragend:e[1]||(e[1]=(...b)=>a.dragEnd&&a.dragEnd(...b))},[f.createVNode(u,{item:l,onUpdateItem:a.updateItem},null,8,["item","onUpdateItem"])],40,j8))),128))])}const H8={components:{VsNoData:MS,VsChoceColor:AS,IconCheck:Fx,VsReesterUsersList:$e(F8,[["render",U8],["__scopeId","data-v-293d7735"]])},data(){return{scheme:{text:{type:"Text",ua:"Ім'я",validators:["required"]}},formVisible:!0,formValues:{},color:"#172B4D",data:null}},watch:{$route:{handler(t,e){var n,i;((n=t==null?void 0:t.query)==null?void 0:n.name)!==((i=e==null?void 0:e.query)==null?void 0:i.name)&&this.getData()}}},mounted(){this.getData()},methods:{async getData(){var t;this.data=null;try{const{data:e}=await ct.get(`/api/user-cls/${(t=this.$route.query)==null?void 0:t.name}`);this.data=e}catch{}},async addOneChild(){var t,e,n,i;try{const{form:r}=this.$refs;await r.doValidation(),await ct.post("/api/user-cls",{name:(t=this.$route.query)==null?void 0:t.name,children:[...((e=this.data)==null?void 0:e.children)||[],{...this.formValues,color:this.color,id:(((i=(n=this.data)==null?void 0:n.children)==null?void 0:i.length)||0)+1}]}),this.formVisible=!1,this.formValues={},setTimeout(()=>this.formVisible=!0),await this.getData()}catch(r){console.log(r)}},async updateChildren(t){var e,n;this.data.children=t;try{await ct.post("/api/user-cls",{name:(e=this.$route.query)==null?void 0:e.name,children:[...((n=this.data)==null?void 0:n.children)||[]]}),await this.getData()}catch(i){console.log(i)}}}},q8={class:"flex justify-center bg-gray-50",style:{height:"calc(100vh - 60px)",width:"calc(100vw - 560px)"}},W8={key:0,class:"mt-[100px] p-[10px]",style:{"max-height":"calc(100vh - 300px)",width:"calc(100vw - 1000px)"}},G8={class:"flex items-end w-full gap-[4px]"};function Z8(t,e,n,i,r,a){var E,C,P,D,R;const u=f.resolveComponent("VsForm"),l=f.resolveComponent("VsChoceColor"),g=f.resolveComponent("IconCheck"),b=f.resolveComponent("VsReesterUsersList"),S=f.resolveComponent("VsNoData");return f.openBlock(),f.createElementBlock("div",q8,[(C=(E=t.$route)==null?void 0:E.query)!=null&&C.name?(f.openBlock(),f.createElementBlock("div",W8,[e[3]||(e[3]=f.createElementVNode("h2",{class:"font-bold mb-[10px]"},"Створити",-1)),f.createElementVNode("div",G8,[r.formVisible?(f.openBlock(),f.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[0]||(e[0]=j=>r.formValues=j),class:"p-0 m-0 h-[65px] w-full"},null,8,["scheme","modelValue"])):f.createCommentVNode("",!0),f.createVNode(l,{modelValue:r.color,"onUpdate:modelValue":e[1]||(e[1]=j=>r.color=j)},null,8,["modelValue"]),f.createElementVNode("button",{onClick:e[2]||(e[2]=(...j)=>a.addOneChild&&a.addOneChild(...j)),class:"h-[37px] w-[37px] rounded-lg bg-blue-600 ml-[6px] flex items-center justify-center text-white hover:bg-blue-700 duration-300"},[f.createVNode(g,{height:"20",width:"20"})])]),(D=(P=r.data)==null?void 0:P.children)!=null&&D.length?(f.openBlock(),f.createBlock(b,{key:0,list:(R=r.data)==null?void 0:R.children,onUpdateList:a.updateChildren},null,8,["list","onUpdateList"])):f.createCommentVNode("",!0)])):(f.openBlock(),f.createBlock(S,{key:1,class:"mt-[100px]",text:"Оберіть один з пунктів меню для відображення"}))])}const Y8={components:{VsReesterNavList:x8,VsReesterContent:$e(H8,[["render",Z8]])}},X8={class:"flex items-start gap-0"};function K8(t,e,n,i,r,a){const u=f.resolveComponent("VsReesterNavList"),l=f.resolveComponent("VsReesterContent");return f.openBlock(),f.createElementBlock("div",X8,[f.createVNode(u),f.createVNode(l)])}const Q0={...n8,...i8,"vs-dashboard":s8,"vs-custom-button":c8,...{"user-cls-page":$e(Y8,[["render",K8]])}},IS=t=>{const e=[];return t.forEach(n=>{n.menu?e.push(...IS(n.menu)):e.push(n)}),e},Ss=f.ref(null),J8=async()=>{try{const{data:t}=await ct.get("/api/user-menu");return Ss.value=t,IS(t)}catch(t){return console.error(t),[]}},Q8=(t,e)=>{Object.entries(e).forEach(([n,i])=>{t.component(n,i)})},ej={async install(t,{componentsApp:e={},settings:n}){hl.value={...hl,...n};try{const r=(await J8()).filter(u=>u==null?void 0:u.component).map(u=>({...u,component:{...Q0,...e}[u==null?void 0:u.component]}));Q8(t,{...Q0,...e}),t.component("admin",HT);const{router:a}=await CA(r);window.app=t,t.config.globalProperties={...t.config.globalProperties,$componentsConfig:{...bz,componentsApp:e},$router:a},t.use(a)}catch(i){console.error(i)}},components:Q0},tj={data(){return{formValues:{},scheme:null,table:"",token:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){var i,r;const t=this.flattenMenu(Ss.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.query)==null?void 0:l.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const{data:{form:a}}=await ct.get(`/api/template/table/${n}`),{data:u}=await ct.get(`/api/table/${this.table}/${(r=(i=this.$route)==null?void 0:i.query)==null?void 0:r.id}`);this.token=(u==null?void 0:u.token)||"",this.formValues=u||{};const{data:l}=await ct.get(`/api/template/form/${a}`);this.scheme=(l==null?void 0:l.schema)||l}catch{}},async onlyEditObject(){try{await this.$refs.form.doValidation(),await ct.put(`/api/table/${this.token}`,this.formValues),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},async editObjectAndRedirect(){try{await this.$refs.form.doValidation(),await ct.put(`/api/table/${this.token}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},nj={style:{width:"calc(100vw - 260px)"},class:"bg-gray-50"},ij={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},rj={class:"flex items-center gap-[6px]"},sj={style:{height:"calc(100vh - 155px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},oj={class:"bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function aj(t,e,n,i,r,a){const u=f.resolveComponent("VsForm");return f.openBlock(),f.createElementBlock("div",nj,[f.createElementVNode("div",ij,[e[4]||(e[4]=f.createElementVNode("h2",{class:"text-xl font-medium"},"Редагувати",-1)),f.createElementVNode("div",rj,[f.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"flex items-center px-3 py-2 text-sm font-medium text-gray-800 duration-300 bg-white border border-gray-100 rounded-lg shadow gap-x-2 focus:outline-none hover:bg-gray-50 hover:border-gray-100"}," Повернутися "),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.onlyEditObject&&a.onlyEditObject(...l)),class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"}," Зберегти "),f.createElementVNode("button",{onClick:e[2]||(e[2]=(...l)=>a.editObjectAndRedirect&&a.editObjectAndRedirect(...l)),class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"}," Зберегти і повернутися ")])]),f.createElementVNode("div",sj,[f.createElementVNode("div",oj,[r.scheme?(f.openBlock(),f.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[3]||(e[3]=l=>r.formValues=l),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):f.createCommentVNode("",!0)])])])}const lj=Object.freeze(Object.defineProperty({__proto__:null,default:$e(tj,[["render",aj]])},Symbol.toStringTag,{value:"Module"})),cj={data(){return{formValues:{},scheme:null,table:"",token:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){var i,r;const t=this.flattenMenu(Ss.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.query)==null?void 0:l.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const a=await ct.get(`/api/table-data/${n}`),{data:u}=await ct.get(`/api/template/form/${(i=a==null?void 0:a.data)==null?void 0:i.form}`);this.scheme=(u==null?void 0:u.schema)||u,this.token=(r=a==null?void 0:a.data)==null?void 0:r.addToken}catch{}},async createObject(){var e,n,i,r,a,u,l,g;const t=this.$refs.form;try{await t.doValidation(),await ct.post(`/api/table/${this.token}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{let S=((r=(i=(n=(e=Object.entries(t==null?void 0:t.formErrors))==null?void 0:e[0])==null?void 0:n[1])==null?void 0:i[0])==null?void 0:r.message)==="Це поле обов'язкове"?"Заповніть обов'язкові поля":(g=(l=(u=(a=Object.entries(t==null?void 0:t.formErrors))==null?void 0:a[0])==null?void 0:u[1])==null?void 0:l[0])==null?void 0:g.message;this.$notify({title:"Помилка!",message:S||"Сталася помилка валідаціі",type:"error"})}}}},uj={style:{width:"calc(100vw - 260px)"},class:"bg-gray-50"},hj={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},dj={class:"flex items-center gap-[6px]"},pj={style:{height:"calc(100vh - 165px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},fj={class:"bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function mj(t,e,n,i,r,a){const u=f.resolveComponent("VsForm");return f.openBlock(),f.createElementBlock("div",uj,[f.createElementVNode("div",hj,[e[3]||(e[3]=f.createElementVNode("h2",{class:"text-xl font-medium"},"Створити",-1)),f.createElementVNode("div",dj,[f.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"flex items-center px-3 py-2 text-sm font-medium text-gray-800 duration-300 bg-white border border-gray-100 rounded-lg shadow gap-x-2 focus:outline-none hover:bg-gray-50 hover:border-gray-100"}," Скасувати "),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.createObject&&a.createObject(...l)),class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"}," Зберегти ")])]),f.createElementVNode("div",pj,[f.createElementVNode("div",fj,[r.scheme?(f.openBlock(),f.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[2]||(e[2]=l=>r.formValues=l),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):f.createCommentVNode("",!0)])])])}const gj=Object.freeze(Object.defineProperty({__proto__:null,default:$e(cj,[["render",mj]])},Symbol.toStringTag,{value:"Module"})),yj={};function _j(t,e,n,i,r,a){const u=f.resolveComponent("router-view");return f.openBlock(),f.createBlock(u)}const PS=Object.freeze(Object.defineProperty({__proto__:null,default:$e(yj,[["render",_j]])},Symbol.toStringTag,{value:"Module"})),bj={class:"h-[76px] bg-white border rounded-xl flex items-center justify-between px-[20px] mb-[16px]"},xj={class:"text-lg font-semibold md:text-xl text-stone-800 dark:text-neutral-200"},vj={class:"flex items-center gap-[6px]"},wj={components:{AdminCardHeader:{__name:"admin-card-header",props:{title:{type:String},getRoute:{type:String,required:!0}},setup(t){const e=t,n=_A(),i=bA(),r=()=>{n.back()},a=f.computed(()=>{var u;return`/edit?table=${e.getRoute}&id=${(u=i==null?void 0:i.params)==null?void 0:u.id}`});return(u,l)=>{const g=f.resolveComponent("router-link");return f.openBlock(),f.createElementBlock("div",bj,[f.createElementVNode("div",null,[f.createElementVNode("button",{onClick:r,class:"text-sm h-[20px] text-blue-600 font-medium hover:border-b-2 hover:border-b-blue-500"}," До таблиці "),f.createElementVNode("h2",xj,f.toDisplayString(t.title),1)]),f.createElementVNode("div",vj,[f.createVNode(g,{to:a.value,class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"},{default:f.withCtx(()=>l[0]||(l[0]=[f.createTextVNode(" Редагувати ")])),_:1},8,["to"])])])}}}},data(){return{objectData:null,component:""}},computed:{getRoute(){const t=this.flattenMenu(Ss.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(n=>{var i,r;return(n==null?void 0:n.table)==((r=(i=this.$route)==null?void 0:i.params)==null?void 0:r.table)});return e||this.$router.replace("/404"),e==null?void 0:e.path},getTitle(){var t,e,n,i,r,a,u,l,g,b,S,E,C,P,D;if((n=(e=(t=this.objectData)==null?void 0:t.rows)==null?void 0:e[0])!=null&&n.name)return((u=(a=(r=(i=this.objectData)==null?void 0:i.rows)==null?void 0:r[0])==null?void 0:a.name)==null?void 0:u.length)<35?(b=(g=(l=this.objectData)==null?void 0:l.rows)==null?void 0:g[0])==null?void 0:b.name:((P=(C=(E=(S=this.objectData)==null?void 0:S.rows)==null?void 0:E[0])==null?void 0:C.name)==null?void 0:P.slice(0,35))+" ...";{const R=(D=this.flattenMenu(Ss.value))==null?void 0:D.find(j=>{var W,ee;return(j==null?void 0:j.table)===((ee=(W=this.$route)==null?void 0:W.params)==null?void 0:ee.table)});return R==null?void 0:R.ua}}},async mounted(){await this.getObjectData(),await this.checkActiveComponent()},watch:{component(t){this.$router.replace({...this.$route,query:{tab:t}})}},methods:{async getObjectData(){var n;const{table:t,id:e}=(n=this.$route)==null?void 0:n.params;(!t||!e)&&this.$router.replace("/404");try{const{data:i}=await ct.get(`/api/table-data/${t}/${e}`);this.objectData=i}catch(i){console.error(i)}},getColClass(t){return`col-span-${t||12}`},getGridClass(){return"grid-cols-12"},checkActiveComponent(){var t,e,n,i,r,a,u,l,g;if((e=(t=this.$route)==null?void 0:t.query)!=null&&e.tab)this.component=(i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.tab;else{const b=(a=(r=this.objectData)==null?void 0:r.panels)==null?void 0:a.find(S=>(S==null?void 0:S.type)==="tabs");(u=b==null?void 0:b.items)!=null&&u.length&&(this.component=((l=b.items[0])==null?void 0:l.component)||((g=b.items[0])==null?void 0:g.name))}},flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e}}},kj={style:{width:"calc(100vw - 260px)",height:"calc(100vh - 60px)"},class:"p-4 overflow-y-auto bg-gray-50"},Sj={key:0,class:"bg-white border rounded-xl"},Ej={class:"p-[10px] pl-[20px] text-md font-[500]"},Cj=["innerHTML"],Tj={key:1},Mj={key:0,class:"p-[10px] pl-[20px] text-md font-[500]"},Aj={key:2,class:"p-[20px] border-t"},Ij=["innerHTML"],Pj={class:"flex space-x-1 w-full bg-white border border-b-0 rounded-tr-xl rounded-tl-xl h-[60px] items-center pl-[20px]"},Dj=["onClick"],Oj={key:0,class:"bg-white border border-t-0 rounded-bl-xl rounded-br-xl"},zj={key:0,class:"p-[20px] border-t"},Bj={key:1,class:"p-[20px] border-t"},Nj=["innerHTML"],Rj={key:3,class:"flex"},Lj={class:"flex flex-col space-y-2 w-[200px] border rounded-xl mr-4 h-auto items-start pl-[10px] bg-white py-[20px]"},Vj=["onClick"],Fj={class:"flex-grow"},$j={key:0,class:"h-full bg-white border rounded-xl"},jj={key:0,class:"p-[20px]"},Uj={key:1,class:"p-[20px] border-t"},Hj=["innerHTML"];function qj(t,e,n,i,r,a){var l,g;const u=f.resolveComponent("AdminCardHeader");return f.openBlock(),f.createElementBlock("div",kj,[((l=r.objectData)==null?void 0:l.isHeader)!==!1?(f.openBlock(),f.createBlock(u,{key:0,title:a.getTitle,"get-route":a.getRoute},null,8,["title","get-route"])):f.createCommentVNode("",!0),f.createElementVNode("div",{class:f.normalizeClass(["grid gap-[20px]",a.getGridClass()])},[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((g=r.objectData)==null?void 0:g.panels,(b,S)=>{var E;return f.openBlock(),f.createElementBlock("div",{key:S,class:f.normalizeClass(a.getColClass(b.col))},[b!=null&&b.name?(f.openBlock(),f.createElementBlock("div",Sj,[f.createElementVNode("h2",Ej,f.toDisplayString((b==null?void 0:b.title)||"Панель"),1),f.createElementVNode("div",{class:"p-[20px] border-t",innerHTML:(E=r.objectData)==null?void 0:E.data[b==null?void 0:b.name]},null,8,Cj)])):b.type==="container"?(f.openBlock(),f.createElementBlock("div",Tj,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(b.items,(C,P)=>{var D,R,j,W,ee;return f.openBlock(),f.createElementBlock("div",{key:P,class:f.normalizeClass([{"mb-[20px]":b.items.length>1},"bg-white border rounded-xl"])},[C!=null&&C.title?(f.openBlock(),f.createElementBlock("h2",Mj,f.toDisplayString((C==null?void 0:C.title)||"Панель"),1)):f.createCommentVNode("",!0),C!=null&&C.component?(f.openBlock(),f.createElementBlock("div",{key:1,class:f.normalizeClass(["p-[20px]",{"border-t":C==null?void 0:C.title}])},[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(C.component),{geometry:(R=(D=r.objectData)==null?void 0:D.rows[0])==null?void 0:R.geom,zoom:16,id:(W=(j=t.$route)==null?void 0:j.params)==null?void 0:W.id},null,8,["geometry","id"]))],2)):f.createCommentVNode("",!0),C!=null&&C.name?(f.openBlock(),f.createElementBlock("div",Aj,[f.createElementVNode("div",{innerHTML:(ee=r.objectData)==null?void 0:ee.data[C==null?void 0:C.name]},null,8,Ij)])):f.createCommentVNode("",!0)],2)}),128))])):f.createCommentVNode("",!0),(b==null?void 0:b.type)==="tabs"?(f.openBlock(),f.createElementBlock(f.Fragment,{key:2},[f.createElementVNode("nav",Pj,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(b==null?void 0:b.items,C=>(f.openBlock(),f.createElementBlock("button",{key:(C==null?void 0:C.name)||(C==null?void 0:C.component),onClick:P=>r.component=(C==null?void 0:C.component)||(C==null?void 0:C.name),class:f.normalizeClass(["px-2.5 h-[30px] py-1.5 relative inline-flex items-center gap-x-2 text-gray-500 hover:bg-gray-100 focus:bg-gray-100 hover:text-gray-800 text-sm whitespace-nowrap rounded-lg focus:outline-none",{" font-semibold after:absolute after:bottom-[-14px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:bg-gray-800":r.component===(C==null?void 0:C.component)||r.component===(C==null?void 0:C.name),"":r.component!==(C==null?void 0:C.component)&&r.component!==(C==null?void 0:C.name)}])},f.toDisplayString(C==null?void 0:C.title),11,Dj))),128))]),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(b.items,(C,P)=>{var D,R,j,W,ee;return f.openBlock(),f.createElementBlock(f.Fragment,{key:P},[r.component===(C==null?void 0:C.component)||r.component===(C==null?void 0:C.name)?(f.openBlock(),f.createElementBlock("div",Oj,[C!=null&&C.component?(f.openBlock(),f.createElementBlock("div",zj,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(C.component),{geometry:(R=(D=r.objectData)==null?void 0:D.rows[0])==null?void 0:R.geom,zoom:16,id:(W=(j=t.$route)==null?void 0:j.params)==null?void 0:W.id},null,8,["geometry","id"]))])):f.createCommentVNode("",!0),C!=null&&C.name?(f.openBlock(),f.createElementBlock("div",Bj,[f.createElementVNode("div",{innerHTML:(ee=r.objectData)==null?void 0:ee.data[C==null?void 0:C.name]},null,8,Nj)])):f.createCommentVNode("",!0)])):f.createCommentVNode("",!0)],64)}),128))],64)):f.createCommentVNode("",!0),(b==null?void 0:b.type)==="vertical-tabs"?(f.openBlock(),f.createElementBlock("div",Rj,[f.createElementVNode("nav",Lj,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(b==null?void 0:b.items,C=>(f.openBlock(),f.createElementBlock("button",{key:(C==null?void 0:C.name)||(C==null?void 0:C.component),onClick:P=>r.component=(C==null?void 0:C.component)||(C==null?void 0:C.name),class:f.normalizeClass(["relative inline-flex items-center w-full py-1 text-sm border-transparent pe-4 gap-x-2 border-e-2 whitespace-nowrap hover:text-blue-600 focus:outline-none focus:text-blue-600",{"font-semibold after:absolute after:top-[0] after:right-[-1px] after:h-full text-blue-600 after:w-[2px] after:bg-blue-600 ":r.component===(C==null?void 0:C.component)||r.component===(C==null?void 0:C.name),"text-gray-500":r.component!==(C==null?void 0:C.component)&&r.component!==(C==null?void 0:C.name)}])},f.toDisplayString(C==null?void 0:C.title),11,Vj))),128))]),f.createElementVNode("div",Fj,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(b.items,(C,P)=>{var D,R,j,W,ee;return f.openBlock(),f.createElementBlock(f.Fragment,{key:P},[r.component===(C==null?void 0:C.component)||r.component===(C==null?void 0:C.name)?(f.openBlock(),f.createElementBlock("div",$j,[C!=null&&C.component?(f.openBlock(),f.createElementBlock("div",jj,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(C.component),{geometry:(R=(D=r.objectData)==null?void 0:D.rows[0])==null?void 0:R.geom,zoom:16,id:(W=(j=t.$route)==null?void 0:j.params)==null?void 0:W.id},null,8,["geometry","id"]))])):f.createCommentVNode("",!0),C!=null&&C.name?(f.openBlock(),f.createElementBlock("div",Uj,[f.createElementVNode("div",{innerHTML:(ee=r.objectData)==null?void 0:ee.data[C==null?void 0:C.name]},null,8,Hj)])):f.createCommentVNode("",!0)])):f.createCommentVNode("",!0)],64)}),128))])])):f.createCommentVNode("",!0)],2)}),128))],2)])}const Wj=Object.freeze(Object.defineProperty({__proto__:null,default:$e(wj,[["render",qj],["__scopeId","data-v-6f4173b5"]])},Symbol.toStringTag,{value:"Module"})),Gj={},Zj={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-logout"};function Yj(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",Zj,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"},null,-1),f.createElementVNode("path",{d:"M9 12h12l-3 -3"},null,-1),f.createElementVNode("path",{d:"M18 15l3 -3"},null,-1)]))}const Xj=$e(Gj,[["render",Yj]]),Kj={},Jj={viewBox:"0 0 1823 249",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Qj(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",Jj,e[0]||(e[0]=[f.createStaticVNode('<path d="M218.88 96.05C223.55 99.19 228.69 101.56 234.09 103.07V145.42C212.05 151.54 195.83 171.79 195.83 195.75C195.83 200.22 196.41 204.65 197.53 208.94L160.92 230.08C156.82 226.06 152.08 222.73 146.91 220.24V171.62C164.83 163.13 176.59 145.06 176.59 124.48C176.59 123.17 176.54 121.86 176.44 120.56L218.88 96.05ZM220.32 79.09L160.97 113.36C162.04 116.88 162.61 120.61 162.61 124.48C162.61 142.66 149.93 157.87 132.93 161.76V230.05C143.4 232.46 152.23 239.16 157.46 248.21L215 214.99C211.7 209.34 209.81 202.77 209.81 195.75C209.81 174.62 226.94 157.49 248.07 157.49V91.02C237.14 91.02 227.29 86.43 220.32 79.09Z" fill="#CE3936"></path><path d="M161.39 19.13L197.44 39.94C196.39 44.11 195.84 48.42 195.84 52.75C195.84 54.21 195.9 55.65 196.02 57.1L153.9 81.42C145.27 75.5 134.95 72.24 124.36 72.24C113.83 72.24 103.57 75.47 94.96 81.32L52.71 56.93C52.82 55.55 52.88 54.16 52.88 52.76C52.88 48.43 52.34 44.12 51.28 39.95L87.3 19.16C96.98 28.89 110.26 34.58 124.34 34.58C138.42 34.57 151.7 28.87 161.39 19.13ZM157.77 0.919983C151.24 12.66 138.71 20.6 124.33 20.6C109.95 20.6 97.44 12.67 90.9 0.939983L33.9 33.85C37.08 39.43 38.91 45.88 38.91 52.76C38.91 56.71 38.31 60.52 37.2 64.11L96.46 98.32C103.44 90.87 113.36 86.22 124.37 86.22C135.44 86.22 145.41 90.93 152.39 98.44L211.59 64.27C210.45 60.64 209.83 56.78 209.83 52.77C209.83 45.89 211.65 39.44 214.84 33.86L157.77 0.919983Z" fill="#CE3936"></path><path d="M29.97 95.95L72.28 120.38C72.17 121.74 72.12 123.1 72.12 124.47C72.12 145.02 83.86 163.08 101.74 171.58V220.23C96.58 222.71 91.84 226.04 87.75 230.05L51.17 208.93C52.29 204.64 52.87 200.21 52.87 195.74C52.87 171.78 36.65 151.53 14.61 145.41V103.06C20.07 101.55 25.27 99.14 29.97 95.95ZM28.5 78.97C21.52 86.38 11.63 91.02 0.640015 91.02V157.49C21.77 157.49 38.9 174.62 38.9 195.75C38.9 202.77 37 209.33 33.71 214.99L91.2 248.18C96.43 239.14 105.25 232.45 115.71 230.04V161.73C98.74 157.81 86.09 142.62 86.09 124.46C86.09 120.54 86.68 116.75 87.78 113.18L28.5 78.97Z" fill="#CE3936"></path><path d="M498.39 177.5V144.88C498.39 128.55 485.11 115.27 468.78 115.27H343.22C342.69 115.27 342.18 115.32 341.67 115.4H337.19C332.35 115.4 328.42 111.46 328.42 106.63V74C328.42 69.16 332.36 65.23 337.19 65.23H486.33C492.08 65.23 496.75 60.57 496.75 54.81C496.75 49.06 492.08 44.39 486.33 44.39H337.19C320.86 44.39 307.58 57.67 307.58 74V106.62C307.58 122.95 320.86 136.23 337.19 136.23H462.75C463.28 136.23 463.79 136.18 464.3 136.1H468.78C473.62 136.1 477.55 140.04 477.55 144.87V177.49C477.55 182.33 473.61 186.26 468.78 186.26H319.64C313.89 186.26 309.22 190.92 309.22 196.68C309.22 202.43 313.89 207.1 319.64 207.1H468.78C485.11 207.11 498.39 193.83 498.39 177.5Z" fill="#CE3935"></path><path d="M710.7 177.32V75.24C710.7 58.91 697.42 45.63 681.09 45.63H550.05C533.72 45.63 520.44 58.91 520.44 75.24V177.32C520.44 193.65 533.72 206.93 550.05 206.93H681.1C697.42 206.93 710.7 193.65 710.7 177.32ZM541.27 75.24C541.27 70.4 545.21 66.47 550.04 66.47H681.09C685.93 66.47 689.86 70.41 689.86 75.24V177.32C689.86 182.16 685.92 186.09 681.09 186.09H550.05C545.21 186.09 541.28 182.15 541.28 177.32V75.24H541.27Z" fill="#CE3935"></path><path d="M1823 177.32V75.24C1823 58.91 1809.72 45.63 1793.39 45.63H1662.34C1646.01 45.63 1632.73 58.91 1632.73 75.24V177.32C1632.73 193.65 1646.01 206.93 1662.34 206.93H1793.39C1809.72 206.93 1823 193.65 1823 177.32ZM1653.57 75.24C1653.57 70.4 1657.51 66.47 1662.34 66.47H1793.39C1798.23 66.47 1802.16 70.41 1802.16 75.24V177.32C1802.16 182.16 1798.22 186.09 1793.39 186.09H1662.34C1657.5 186.09 1653.57 182.15 1653.57 177.32V75.24Z" fill="#CE3935"></path><path d="M756.76 196.51V152H849.42C855.17 152 859.84 147.34 859.84 141.58C859.84 135.83 855.17 131.16 849.42 131.16H756.76V75.23C756.76 70.39 760.7 66.46 765.53 66.46H893.29C899.04 66.46 903.71 61.8 903.71 56.04C903.71 50.29 899.04 45.62 893.29 45.62H765.53C749.2 45.62 735.92 58.9 735.92 75.23V196.5C735.92 202.25 740.59 206.92 746.34 206.92C752.09 206.93 756.76 202.27 756.76 196.51Z" fill="#CE3935"></path><path d="M933.86 66.47H1006.51V194.32C1006.51 200.07 1011.18 204.74 1016.93 204.74C1022.68 204.74 1027.35 200.07 1027.35 194.32V66.47H1100C1105.75 66.47 1110.42 61.81 1110.42 56.05C1110.42 50.3 1105.76 45.63 1100 45.63H933.86C928.11 45.63 923.44 50.29 923.44 56.05C923.45 61.81 928.11 66.47 933.86 66.47Z" fill="#CE3935"></path><path d="M1218.44 204.19C1224.19 204.19 1228.86 199.53 1228.86 193.77V152H1368.13C1384.46 152 1397.74 138.72 1397.74 122.39V75.24C1397.74 58.91 1384.46 45.63 1368.13 45.63H1237.63C1221.3 45.63 1208.02 58.91 1208.02 75.24V193.77C1208.02 199.53 1212.68 204.19 1218.44 204.19ZM1237.63 66.47H1368.13C1372.97 66.47 1376.9 70.41 1376.9 75.24V122.39C1376.9 127.23 1372.96 131.16 1368.13 131.16H1228.86V75.23C1228.86 70.41 1232.79 66.47 1237.63 66.47Z" fill="#CE3935"></path><path d="M1430.64 204.19C1436.39 204.19 1441.06 199.53 1441.06 193.77V152H1523.95C1524.57 153.18 1525.42 154.26 1526.51 155.17L1581.89 201.23C1583.83 202.85 1586.2 203.64 1588.55 203.64C1591.54 203.64 1594.5 202.36 1596.57 199.88C1600.25 195.46 1599.64 188.89 1595.22 185.21L1555.29 152H1580.33C1596.66 152 1609.94 138.72 1609.94 122.39V75.24C1609.94 58.91 1596.66 45.63 1580.33 45.63H1449.83C1433.5 45.63 1420.22 58.91 1420.22 75.24V193.77C1420.22 199.53 1424.88 204.19 1430.64 204.19ZM1449.83 66.47H1580.33C1585.17 66.47 1589.1 70.41 1589.1 75.24V122.39C1589.1 127.23 1585.17 131.16 1580.33 131.16H1441.06V75.23C1441.05 70.41 1444.99 66.47 1449.83 66.47Z" fill="#CE3935"></path>',10)]))}const e7=$e(Kj,[["render",Qj]]),t7={},n7={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function i7(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",n7,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const DS=$e(t7,[["render",i7]]),r7={components:{IconChevronDown:DS},props:{route:Object},mounted(){var t,e,n;(t=this.route)!=null&&t.menu&&(n=(e=this.route)==null?void 0:e.menu)!=null&&n.some(i=>{var r,a;return(i==null?void 0:i.path)===this.$route.path.replace("/","")||((a=(r=this.$route)==null?void 0:r.params)==null?void 0:a.table)===(i==null?void 0:i.table)&&(i==null?void 0:i.table)})&&(this.isOpen=!0)},data(){return{isOpen:!1}}},s7={key:0,class:""},o7={class:"ml-[30px] py-[6px] before:block before:absolute relative w-[196px] flex flex-col gap-[6px] inline-block before:w-[2px] before:h-[100%] before:bg-gray-100 before:left-[-14px] cursor-pointer"},a7={key:1};function l7(t,e,n,i,r,a){var g,b,S,E,C,P,D,R,j,W,ee,le,J;const u=f.resolveComponent("IconChevronDown"),l=f.resolveComponent("router-link");return(g=n.route)!=null&&g.menu?(f.openBlock(),f.createElementBlock("div",s7,[f.createElementVNode("button",{onClick:e[0]||(e[0]=Te=>r.isOpen=!r.isOpen),class:f.normalizeClass(["flex cursor-pointer gap-x-3 py-2 px-3 text-sm text-gray-800 justify-start w-full border-none focus:outline-none text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300",[((S=(b=n.route)==null?void 0:b.menu)==null?void 0:S.some(Te=>{var xe,Ae;return(Te==null?void 0:Te.path)===t.$route.path.replace("/","")||(Te==null?void 0:Te.table)===((Ae=(xe=t.$route)==null?void 0:xe.params)==null?void 0:Ae.table)&&(Te==null?void 0:Te.table)}))&&"bg-gray-100"]])},[f.createTextVNode(f.toDisplayString((E=n.route)==null?void 0:E.ua)+" ",1),f.createVNode(u,{class:f.normalizeClass([[r.isOpen&&"-rotate-180"],"ml-auto duration-300"]),width:"14",height:"14"},null,8,["class"])],2),f.createVNode(f.Transition,{name:"fade"},{default:f.withCtx(()=>{var Te;return[f.withDirectives(f.createElementVNode("ul",o7,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Te=n.route)==null?void 0:Te.menu,(xe,Ae)=>{var je,De;return f.openBlock(),f.createElementBlock("li",{key:Ae,class:"w-full"},[f.createVNode(l,{to:"/"+(xe==null?void 0:xe.path),class:f.normalizeClass([[((xe==null?void 0:xe.path)===t.$route.path.replace("/","")||((De=(je=t.$route)==null?void 0:je.params)==null?void 0:De.table)===(xe==null?void 0:xe.table)&&(xe==null?void 0:xe.table))&&"bg-gray-100"],"flex gap-x-4 py-2 px-3 text-sm text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100"])},{default:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(xe==null?void 0:xe.ua),1)]),_:2},1032,["to","class"])])}),128))],512),[[f.vShow,r.isOpen]])]}),_:1})])):(f.openBlock(),f.createElementBlock("div",a7,[f.createVNode(l,{to:((P=(C=n.route)==null?void 0:C.path)==null?void 0:P[0])==="/"?(D=n.route)==null?void 0:D.path:"/"+((R=n.route)==null?void 0:R.path),class:f.normalizeClass([[(((j=n.route)==null?void 0:j.path.replace("/",""))===t.$route.path.replace("/","")||((ee=(W=t.$route)==null?void 0:W.params)==null?void 0:ee.table)===((le=n.route)==null?void 0:le.table)&&((J=n.route)==null?void 0:J.table))&&"bg-gray-100"],"flex gap-x-3 py-2 w-full font-[400] px-3 text-sm text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300 hover:text-gray-800"])},{default:f.withCtx(()=>{var Te;return[f.createTextVNode(f.toDisplayString((Te=n.route)==null?void 0:Te.ua),1)]}),_:1},8,["to","class"])]))}const c7={components:{IconLogout:Xj,NavbarItem:$e(r7,[["render",l7]]),IconLogo:e7,IconSearch:J0},data(){return{activeIndex:null,searchValue:""}},computed:{data(){var t,e;return(t=this.searchValue)!=null&&t.trim()?(e=this.flattenMenu(Ss.value))==null?void 0:e.filter(n=>{var i,r,a;return(a=(i=n==null?void 0:n.ua)==null?void 0:i.toLowerCase())==null?void 0:a.includes((r=this.searchValue)==null?void 0:r.toLowerCase())}):Ss.value},logo(){var t;return((t=hl.value)==null?void 0:t.logo)||"/assets/logo.svg"}},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e}}},u7={class:"flex flex-col h-[100vh] border-r w-[260px] shrink-0"},h7=["src"],d7={class:"relative"},p7={class:"p-[16px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},f7={class:"flex flex-col flex-wrap w-full pb-3"},m7={key:0,class:"flex flex-col gap-[6px]"},g7={key:1,class:"text-gray-800 text-lg mt-[20px]"};function y7(t,e,n,i,r,a){var b;const u=f.resolveComponent("IconSearch"),l=f.resolveComponent("VsText"),g=f.resolveComponent("NavbarItem");return f.openBlock(),f.createElementBlock("div",u7,[f.createElementVNode("img",{src:a.logo,height:"40",width:"200",class:"my-[20px] ml-[20px]"},null,8,h7),f.createElementVNode("div",d7,[f.createVNode(u,{height:"16",width:"16",class:"absolute top-[12px] left-[30px] text-gray-500 z-[1]"}),f.createVNode(l,{type:"text",modelValue:r.searchValue,"onUpdate:modelValue":e[0]||(e[0]=S=>r.searchValue=S),clearable:!0,placeholder:"Пошук по меню",class:"[&>input]:h-[40px] [&>input]:block [&>input]:rounded-none [&>input]:border-x-0 [&>input]:pl-[60px] [&>input:focus]:outline-none [&>input:focus]:focus:ring-0 [&>input:focus]:border-y-gray-200 [&>input:focus]:border-y-1 [&>input:focus]:border-x-0"},null,8,["modelValue"])]),f.createElementVNode("div",p7,[f.createElementVNode("nav",f7,[(b=a.data)!=null&&b.length?(f.openBlock(),f.createElementBlock("ul",m7,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.data,(S,E)=>(f.openBlock(),f.createElementBlock("li",{key:E,class:"flex flex-col gap-[6px]"},[f.createVNode(g,{route:S},null,8,["route"])]))),128))])):(f.openBlock(),f.createElementBlock("div",g7,"Не знайдено"))])])])}const _7=$e(c7,[["render",y7]]),b7={},x7={class:"shrink-0",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"};function v7(t,e){return f.openBlock(),f.createElementBlock("svg",x7,e[0]||(e[0]=[f.createElementVNode("path",{d:"M18 6 7 17l-5-5"},null,-1),f.createElementVNode("path",{d:"m22 10-7.5 7.5L13 16"},null,-1)]))}const w7=$e(b7,[["render",v7]]),k7={},S7={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-user"};function E7(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",S7,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M12 2a5 5 0 1 1 -5 5l.005 -.217a5 5 0 0 1 4.995 -4.783z"},null,-1),f.createElementVNode("path",{d:"M14 14a5 5 0 0 1 5 5v1a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-1a5 5 0 0 1 5 -5h4z"},null,-1)]))}const OS=$e(k7,[["render",E7]]),C7={},T7={class:"shrink-0 size-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"};function M7(t,e){return f.openBlock(),f.createElementBlock("svg",T7,e[0]||(e[0]=[f.createElementVNode("polyline",{points:"9 11 12 14 22 4"},null,-1),f.createElementVNode("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"},null,-1)]))}const A7=$e(C7,[["render",M7]]),I7={class:"relative shrink-0"},P7=["src"],D7={key:1,class:"h-[38px] w-[38px] bg-gray-200 rounded-full flex items-center justify-center"},O7={key:2,class:"absolute top-4 -start-3 size-2 bg-blue-600 rounded-full dark:bg-blue-500"},z7={class:"grow"},B7={class:"text-xs text-gray-500 dark:text-neutral-500"},N7={class:"block text-sm font-medium text-gray-800 dark:text-neutral-300"},R7={class:"text-sm text-gray-500 dark:text-neutral-500"},L7={key:0,class:"sm:group-hover:opacity-100 sm:opacity-0 sm:absolute sm:top-5 sm:end-5 inline-block p-0.5 bg-white border border-gray-200 rounded-lg shadow-sm transition ease-out"},V7={__name:"admin-notification-item",props:{item:Object},emits:["update-notification"],setup(t,{emit:e}){const n=e,i=f.ref(!1),r=()=>i.value=!0,a=()=>i.value=!1,u=async()=>{var l;try{await ct.get(`/api/notification-read/${(l=t.item)==null?void 0:l.id}`),await n("update-notification")}catch{}};return(l,g)=>{var S,E,C,P,D,R;const b=f.resolveComponent("VsPopover");return f.openBlock(),f.createElementBlock("li",{class:f.normalizeClass(["relative group w-full flex gap-x-5 text-start p-5 border-b",[(S=t.item)!=null&&S.read?"bg-gray-100":"bg-white"]]),onMouseenter:r,onMouseleave:a},[f.createElementVNode("div",I7,[(E=t.item)!=null&&E.avatar?(f.openBlock(),f.createElementBlock("img",{key:0,class:"shrink-0 size-[38px] rounded-full",src:(C=t.item)==null?void 0:C.avatar,alt:"Avatar"},null,8,P7)):(f.openBlock(),f.createElementBlock("div",D7,[f.createVNode(OS)])),(P=t.item)!=null&&P.read?(f.openBlock(),f.createElementBlock("span",O7)):f.createCommentVNode("",!0)]),f.createElementVNode("div",z7,[f.createElementVNode("p",B7,[f.createVNode(oy,{name:"cdate",data:t.item},null,8,["data"])]),f.createElementVNode("span",N7,f.toDisplayString((D=t.item)==null?void 0:D.author),1),f.createElementVNode("p",R7,f.toDisplayString((R=t.item)==null?void 0:R.subject),1)]),i.value?(f.openBlock(),f.createElementBlock("div",L7,[f.createVNode(b,{trigger:"hover",placement:"left"},{reference:f.withCtx(()=>[f.createElementVNode("button",{onClick:u,type:"button",class:"hs-tooltip-toggle hs-tooltip relative inline-block size-7 flex shrink-0 justify-center items-center text-gray-500 hover:bg-gray-100 hover:text-gray-800 rounded"},[f.createVNode(A7)])]),default:f.withCtx(()=>[g[0]||(g[0]=f.createTextVNode(" Прочитати "))]),_:1})])):f.createCommentVNode("",!0)],34)}}},F7={},$7={class:"flex-shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function j7(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",$7,e[0]||(e[0]=[f.createElementVNode("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"},null,-1),f.createElementVNode("path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"},null,-1)]))}const U7=$e(F7,[["render",j7]]),H7={},q7={class:"shrink-0 size-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"};function W7(t,e){return f.openBlock(),f.createElementBlock("svg",q7,e[0]||(e[0]=[f.createElementVNode("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"},null,-1),f.createElementVNode("circle",{cx:"12",cy:"12",r:"3"},null,-1)]))}const G7=$e(H7,[["render",W7]]),Z7={key:0,class:"flex absolute top-0 end-0 -mt-1.5 -me-1.5"},Y7={class:"relative min-w-[18px] min-h-[18px] inline-flex justify-center items-center text-[10px] bg-red-500 text-white rounded-full px-1"},X7={key:0,class:"w-96 h-[100px] z-[11] absolute top-[40px] right-0"},K7={class:"h-[50px] px-[20px] border-b w-full flex items-center justify-between rounded-t-lg bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)]"},J7={class:"h-[30px] w-[30px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100"},Q7={class:"max-h-[400px] bg-white overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300"},e9={key:0},t9={__name:"admin-notification",setup(t){var b,S,E,C,P;const e=f.ref(0),n=f.ref([]),i=f.ref(!1),r=f.ref(null),a=(P=(C=(E=(S=(b=f.getCurrentInstance())==null?void 0:b.appContext)==null?void 0:S.app)==null?void 0:E.config)==null?void 0:C.globalProperties)==null?void 0:P.$notify,u=D=>{r.value&&!r.value.contains(D.target)&&(i.value=!1)};f.watch(i,D=>{D?window.addEventListener("click",u):window.removeEventListener("click",u)}),f.onBeforeUnmount(()=>{window.removeEventListener("click",u)});const l=async()=>{try{const{data:D}=await ct.get("/api/notification");n.value=(D==null?void 0:D.rows)||[]}catch{a({type:"error",message:"При спробі завантаження нотифікацій виникла помилка",title:"Помилка!"})}};l();const g=async()=>{try{await ct.get("/api/notification-read"),await l()}catch{a({type:"error",message:"Виникла помилка",title:"Помилка!"})}};return(D,R)=>(f.openBlock(),f.createElementBlock("div",{ref_key:"notificationRef",ref:r,class:"hs-tooltip [--placement:bottom] inline-block show relative"},[f.createElementVNode("button",{onClick:R[0]||(R[0]=j=>i.value=!i.value),class:"hs-tooltip-toggle relative size-[38px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100"},[f.createVNode(U7,{height:"24",width:"24"}),e.value?(f.openBlock(),f.createElementBlock("span",Z7,[R[1]||(R[1]=f.createElementVNode("span",{class:"absolute inline-flex bg-red-400 rounded-full opacity-75 animate-ping size-full dark:bg-red-600"},null,-1)),f.createElementVNode("span",Y7,f.toDisplayString(e.value),1)])):f.createCommentVNode("",!0)]),f.createVNode(f.Transition,null,{default:f.withCtx(()=>{var j;return[i.value?(f.openBlock(),f.createElementBlock("div",X7,[f.createElementVNode("div",K7,[R[2]||(R[2]=f.createElementVNode("nav",{class:"flex"},[f.createElementVNode("button",{type:"button",class:"px-2 py-1.5 relative inline-flex justify-center items-center gap-x-2 text-nowrap hover:bg-gray-100 text-gray-500 hover:text-gray-800 text-sm rounded-lg focus:outline-none focus:bg-gray-100 after:absolute after:bottom-[-9px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:bg-gray-800"}," Всі ")],-1)),f.createElementVNode("button",J7,[f.createVNode(G7)])]),f.createElementVNode("div",Q7,[(j=n.value)!=null&&j.length?(f.openBlock(),f.createElementBlock("ul",e9,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.value,W=>(f.openBlock(),f.createBlock(V7,{key:W==null?void 0:W.id,item:W,onUpdateNotification:l},null,8,["item"]))),128))])):f.createCommentVNode("",!0)]),f.createElementVNode("button",{onClick:g,class:"h-[50px] border-t w-full rounded-b-lg bg-white shadow p-4 flex justify-center items-center gap-x-2 text-sm text-gray-500 font-medium sm:rounded-b-lg hover:text-blue-600 focus:outline-none"},[f.createVNode(w7,{height:"16",width:"16"}),R[3]||(R[3]=f.createTextVNode(" Прочитати усі "))])])):f.createCommentVNode("",!0)]}),_:1})],512))}},n9={},i9={class:"flex-shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function r9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",i9,e[0]||(e[0]=[f.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),f.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"},null,-1),f.createElementVNode("path",{d:"M12 17h.01"},null,-1)]))}const s9={components:{IconQuestion:$e(n9,[["render",r9]]),IconUser:OS,AdminNotification:t9},mounted(){this.getUserData()},data(){return{userData:null,isVisible:!1}},watch:{isVisible(t){t?setTimeout(()=>window.addEventListener("click",this.closeOnOutsideClick),0):window.removeEventListener("click",this.closeOnOutsideClick)}},methods:{async getUserData(){try{const{data:t}=await ct.get("/user");this.userData=t}catch{}},async logout(){try{await ct.get("/logout"),await window.history.pushState({},"","/login"),await location.reload(),localStorage.removeItem("user")}catch{}},closeOnOutsideClick(){this.isVisible=!1}},beforeUnmount(){window.removeEventListener("click",this.closeOnOutsideClick)}},o9={class:"h-[60px] border-b flex justify-end px-[20px]",style:{width:"calc(100vw - 260px)"}},a9={class:"flex items-center gap-[6px]"},l9={href:"docs-softpro.com",class:"size-[38px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},c9={class:"relative"},u9=["src"],h9={key:1,class:"size-[40px] rounded-full bg-gray-200 flex items-center justify-center"},d9={class:"p-[10px] gap-[6px] items-center border-b flex justify-between"},p9=["src"],f9={key:1,class:"size-[40px] rounded-full bg-gray-200 flex items-center justify-center"},m9={class:"text-[14px] mr-[10px] text-gray-500"},g9={class:"flex flex-col p-[4px]"};function y9(t,e,n,i,r,a){var S,E,C,P,D,R,j,W,ee,le;const u=f.resolveComponent("IconQuestion"),l=f.resolveComponent("AdminNotification"),g=f.resolveComponent("IconUser"),b=f.resolveComponent("router-link");return f.openBlock(),f.createElementBlock("div",o9,[f.createElementVNode("div",a9,[f.createElementVNode("a",l9,[f.createVNode(u,{height:"24",width:"24"})]),f.createVNode(l),e[4]||(e[4]=f.createElementVNode("div",{class:"h-[30px] w-[1px] bg-gray-200 ml-[10px] mr-[10px]"},null,-1)),f.createElementVNode("div",c9,[f.createElementVNode("div",{onClick:e[0]||(e[0]=J=>r.isVisible=!0),class:"cursor-pointer"},[(E=(S=r.userData)==null?void 0:S.user)!=null&&E.avatar?(f.openBlock(),f.createElementBlock("img",{key:0,class:"flex-shrink-0 size-[30px] rounded-full",src:(P=(C=r.userData)==null?void 0:C.user)==null?void 0:P.avatar,alt:"Image Description"},null,8,u9)):(f.openBlock(),f.createElementBlock("div",h9,[f.createVNode(g)]))]),r.isVisible?(f.openBlock(),f.createElementBlock("div",{key:0,onClick:e[2]||(e[2]=f.withModifiers(()=>{},["stop"])),class:"fixed bg-white w-[180px] top-[55px] right-[20px] shadow-xl rounded-xl z-[1]"},[f.createElementVNode("div",d9,[(R=(D=r.userData)==null?void 0:D.user)!=null&&R.avatar?(f.openBlock(),f.createElementBlock("img",{key:0,class:"flex-shrink-0 size-[30px] rounded-full",src:(W=(j=r.userData)==null?void 0:j.user)==null?void 0:W.avatar,alt:"Image Description"},null,8,p9)):(f.openBlock(),f.createElementBlock("div",f9,[f.createVNode(g)])),f.createElementVNode("div",null,[f.createElementVNode("p",m9,f.toDisplayString((le=(ee=r.userData)==null?void 0:ee.user)==null?void 0:le.username),1)])]),f.createElementVNode("div",g9,[f.createVNode(b,{to:"profile",disabled:!0,class:"p-[8px] block rounded-lg w-full mb-[4px] text-start hover:bg-gray-100 !duration-300"},{default:f.withCtx(()=>e[3]||(e[3]=[f.createTextVNode("Профіль")])),_:1}),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...J)=>a.logout&&a.logout(...J)),class:"p-[8px] block rounded-lg w-full text-start hover:bg-gray-100 !duration-300"}," Вийти ")])])):f.createCommentVNode("",!0)])])])}const _9={components:{navbar:_7,AdminHeader:$e(s9,[["render",y9]])},computed:{isMenu(){return Ss.value||null}}},b9={class:"admin-wrapper"},x9={class:"flex flex-col"};function v9(t,e,n,i,r,a){const u=f.resolveComponent("navbar"),l=f.resolveComponent("admin-header"),g=f.resolveComponent("router-view");return f.openBlock(),f.createElementBlock("div",b9,[f.createVNode(u),f.createElementVNode("div",x9,[a.isMenu?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[f.createVNode(l),f.createVNode(g)],64)):f.createCommentVNode("",!0)])])}const w9=Object.freeze(Object.defineProperty({__proto__:null,default:$e(_9,[["render",v9],["__scopeId","data-v-36fd7ac9"]])},Symbol.toStringTag,{value:"Module"})),k9={data(){return{currentSort:""}},props:{data:{type:Object,default:()=>null},activeColumn:{type:String}},computed:{label(){var t,e;return((t=this.data)==null?void 0:t.ua)||((e=this.data)==null?void 0:e.label)||this.data.title||"null"},selectedSortParam(){var t,e;return(e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort},getVisibleIcon(){return this.data.format!=="image"&&this.data.format!=="verify"}},watch:{activeColumn(t){t!==this.data.name&&(this.currentSort="")}},methods:{changeCurrentSort(t){switch(t){case"":return"asc";case"asc":return"desc";case"desc":return"";default:return""}},handleClickSortBtn(t){this.$emit("change-active",this.data.name),this.currentSort=this.changeCurrentSort(t);const e=this.$route.query,{sort:n,...i}=e,r=this.currentSort?`${this.data.name}-${this.currentSort}`:"";this.$router.replace({query:{...i,...r&&{sort:r}}})},isValueEqualToSelected(t){return`${this.data.name}-${t}`===this.selectedSortParam}}},S9={scope:"col",class:"text-start px-2 py-1"},E9={class:"flex-shrink-0 size-3.5",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"},C9={key:0,d:"m7 15 5 5 5-5"},T9={key:1,d:"m7 9 5-5 5 5"},M9={key:1,class:"text-sm text-stone-500 px-[4px] py-2.5 text-start font-normal text-gray-500"};function A9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("th",S9,[a.getVisibleIcon?(f.openBlock(),f.createElementBlock("button",{key:0,type:"button",class:"text-sm text-stone-500 px-[4px] py-2.5 text-start font-normal text-gray-500 flex items-center gap-[6px]",onClick:e[0]||(e[0]=u=>a.handleClickSortBtn(r.currentSort))},[f.createTextVNode(f.toDisplayString(a.label)+" ",1),(f.openBlock(),f.createElementBlock("svg",E9,[r.currentSort==="asc"||r.currentSort===""?(f.openBlock(),f.createElementBlock("path",C9)):f.createCommentVNode("",!0),r.currentSort==="desc"||r.currentSort===""?(f.openBlock(),f.createElementBlock("path",T9)):f.createCommentVNode("",!0)]))])):(f.openBlock(),f.createElementBlock("p",M9,f.toDisplayString(a.label),1))])}const I9=$e(k9,[["render",A9]]),P9={},D9={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function O9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",D9,e[0]||(e[0]=[f.createStaticVNode('<path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"></path><line x1="10" x2="10" y1="11" y2="17"></line><line x1="14" x2="14" y1="11" y2="17"></line>',5)]))}const z9=$e(P9,[["render",O9]]),B9={props:{height:{type:String,default:"16"},width:{type:String,default:"12"},color:{type:String,default:"black"}}},N9={style:{display:"none"}},R9=["height","width","fill"];function L9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock(f.Fragment,null,[(f.openBlock(),f.createElementBlock("svg",N9,e[0]||(e[0]=[f.createElementVNode("symbol",{id:"icon-pencil",viewBox:"0 0 32 32"},[f.createElementVNode("path",{d:"M27 0c2.761 0 5 2.239 5 5 0 1.126-0.372 2.164-1 3l-2 2-7-7 2-2c0.836-0.628 1.874-1 3-1zM2 23l-2 9 9-2 18.5-18.5-7-7-18.5 18.5zM22.362 11.362l-14 14-1.724-1.724 14-14 1.724 1.724z"})],-1)]))),(f.openBlock(),f.createElementBlock("svg",{height:n.height,width:n.width,fill:n.color},e[1]||(e[1]=[f.createElementVNode("use",{"xlink:href":"#icon-pencil"},null,-1)]),8,R9))],64)}const V9={components:{IconMore:SS,IconDelete:z9,IconEdit:$e(B9,[["render",L9]])},emits:["updateTable"],props:{item:Object,table:String,isForm:null,actions:Array,default:()=>[]},data(){return{formVisible:!1,isDeleteConfirm:!1,formValue:{},top:0,left:0}},methods:{openConfirm(){this.isDeleteConfirm=!0,document.querySelector("body").click()},async getData(){var t;try{const{data:e}=await ct.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);this.formValue=e}catch(e){console.error(e)}},doSomethingOnCancel(){this.formVisible=!1},async deleteElement(){var t;try{const{data:e}=await ct.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);await ct.delete(`/api/table/${e==null?void 0:e.token}`),await this.$notify({title:"Успішно!",message:"Об`єкт успішно видалeно",type:"success"}),await this.$emit("update-table")}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}finally{this.isDeleteConfirm=!1}}}},F9={class:"hs-dropdown [--placement:bottom-right] inline-flex"},$9={class:"inline-flex items-center justify-center bg-white border rounded-lg shadow-sm size-7 gap-x-2 border-stone-200 text-stone-800 hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-50"},j9={class:"flex flex-col items-start"},U9={key:1,class:"h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto"},H9={class:"p-4"},q9={class:"flex justify-end mt-4 gap-x-3"};function W9(t,e,n,i,r,a){const u=f.resolveComponent("IconMore"),l=f.resolveComponent("IconEdit"),g=f.resolveComponent("router-link"),b=f.resolveComponent("IconDelete"),S=f.resolveComponent("VsPopover"),E=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("div",F9,[f.createVNode(S,{trigger:"click",placement:"bottom-left"},{reference:f.withCtx(()=>[f.createElementVNode("button",$9,[f.createVNode(u,{height:"16",width:"16"})])]),default:f.withCtx(()=>{var C,P,D,R,j;return[f.createElementVNode("div",j9,[(C=n.actions)!=null&&C.includes("edit")&&n.isForm?(f.openBlock(),f.createBlock(g,{key:0,to:`/edit?table=${(D=(P=t.$route)==null?void 0:P.params)==null?void 0:D.catchAll}&id=${(R=n.item)==null?void 0:R.id}`,class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},{default:f.withCtx(()=>[f.createVNode(l,{color:"#000"}),e[4]||(e[4]=f.createTextVNode(" Редагувати "))]),_:1},8,["to"])):f.createCommentVNode("",!0),n.isForm?(f.openBlock(),f.createElementBlock("div",U9)):f.createCommentVNode("",!0),(j=n.actions)!=null&&j.includes("del")?(f.openBlock(),f.createElementBlock("button",{key:2,onClick:e[0]||(e[0]=f.withModifiers((...W)=>a.openConfirm&&a.openConfirm(...W),["stop"])),class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},[f.createVNode(b),e[5]||(e[5]=f.createElementVNode("span",{class:"text-gray-800"},"Видалити",-1))])):f.createCommentVNode("",!0)])]}),_:1})]),f.createVNode(E,{visible:r.isDeleteConfirm,"onUpdate:visible":e[3]||(e[3]=C=>r.isDeleteConfirm=C),size:"small",title:"Ви впевнені?"},{default:f.withCtx(()=>[f.createElementVNode("div",H9,[e[6]||(e[6]=f.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей об'єкт? ",-1)),f.createElementVNode("div",q9,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[1]||(e[1]=C=>r.isDeleteConfirm=!1)}," Скасувати "),f.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[2]||(e[2]=(...C)=>a.deleteElement&&a.deleteElement(...C))}," Так, я впевнена/ий ")])])]),_:1},8,["visible"])],64)}const G9=$e(V9,[["render",W9]]),Z9={},Y9={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function X9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",Y9,e[0]||(e[0]=[f.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),f.createElementVNode("path",{d:"M7 20V4"},null,-1),f.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),f.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const K9=$e(Z9,[["render",X9]]),J9={},Q9={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",class:"icon icon-tabler icons-tabler-outline icon-tabler-rosette-discount-check"};function eU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",Q9,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M5 7.2a2.2 2.2 0 0 1 2.2 -2.2h1a2.2 2.2 0 0 0 1.55 -.64l.7 -.7a2.2 2.2 0 0 1 3.12 0l.7 .7c.412 .41 .97 .64 1.55 .64h1a2.2 2.2 0 0 1 2.2 2.2v1c0 .58 .23 1.138 .64 1.55l.7 .7a2.2 2.2 0 0 1 0 3.12l-.7 .7a2.2 2.2 0 0 0 -.64 1.55v1a2.2 2.2 0 0 1 -2.2 2.2h-1a2.2 2.2 0 0 0 -1.55 .64l-.7 .7a2.2 2.2 0 0 1 -3.12 0l-.7 -.7a2.2 2.2 0 0 0 -1.55 -.64h-1a2.2 2.2 0 0 1 -2.2 -2.2v-1a2.2 2.2 0 0 0 -.64 -1.55l-.7 -.7a2.2 2.2 0 0 1 0 -3.12l.7 -.7a2.2 2.2 0 0 0 .64 -1.55v-1"},null,-1),f.createElementVNode("path",{d:"M9 12l2 2l4 -4"},null,-1)]))}const tU={components:{IconExport:K9,IconChevronDown:DS,IconSuccess:$e(J9,[["render",eU]])},props:{table:String,columns:Array,page:[String,Number],filterCustom:String,filterState:String,filters:String},data(){return{isOpen:!1,tableFormats:["json","csv","xlsx"],format:"",cols:[],activeAction:"",isSuccessTemplate:!1,actions:[{name:"choceAll",function:this.choceAll,label:"Вибрати усі"},{name:"choceVisible",function:this.choceVisible,label:"Вибрати поточні"},{name:"clearAll",function:this.clearAll,label:"Жодного"}]}},watch:{isOpen(t){t||(this.format="",this.cols=[],this.activeAction="",this.isSuccessTemplate=!1)}},methods:{async exportTable(){var t;if(!((t=this.cols)!=null&&t.length)){this.$notify({type:"error",title:"Помилка",message:"Оберіть колонки для експорту!"});return}if(!this.format){this.$notify({type:"error",title:"Помилка",message:"Оберіть формат!"});return}try{const e=await ct.get("/api/export",{params:{table:this.table,format:this.format,cols:this.cols.join(","),page:this.page,filter:this.filters||null,state:this.filterState||null,custom:this.filterCustom||null},responseType:"blob"}),n=new Blob([e.data],{type:"application/octet-stream"}),i=window.URL.createObjectURL(n),r=document.createElement("a");r.href=i,r.setAttribute("download",`${this.table.split(".")[0]}.${this.format}`),document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(i),this.$notify({type:"success",title:"Експорт",message:"Файл успішно експортовано!"}),this.isSuccessTemplate=!0}catch(e){console.error("Ошибка при экспорте файла:",e),this.$notify({type:"error",title:"Помилка",message:"Не вдалося експортувати файл."})}},selectFormat(t){this.format=t},choceAll(){var t;this.cols=(t=this.columns)==null?void 0:t.map(e=>e==null?void 0:e.name),this.activeAction="choceAll"},clearAll(){this.cols=[],this.activeAction="clearAll"},choceVisible(){var t,e;this.cols=(e=(t=this.columns)==null?void 0:t.filter(n=>(n==null?void 0:n.hidden)!==!0))==null?void 0:e.map(n=>n==null?void 0:n.name),this.activeAction="choceVisible"}}},nU={key:0,class:"flex flex-col items-center"},iU={key:1,class:"p-4"},rU={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},sU={class:"flex items-center"},oU={class:"flex items-center gap-[10px] ml-auto"},aU=["onClick"],lU={key:0,class:"block h-[8px] w-[8px] rounded-full bg-blue-500"},cU={class:"mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]"},uU={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},hU={class:"mt-2 space-y-2"},dU=["id","onChange"],pU=["for"],fU={key:0,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"},mU={key:1,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"};function gU(t,e,n,i,r,a){const u=f.resolveComponent("IconExport"),l=f.resolveComponent("IconChevronDown"),g=f.resolveComponent("IconSuccess"),b=f.resolveComponent("VsCheckbox"),S=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("button",{onClick:e[0]||(e[0]=E=>r.isOpen=!0),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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 focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[f.createVNode(u,{height:"16",width:"16"}),e[7]||(e[7]=f.createTextVNode(" Експорт ")),f.createVNode(l,{height:"12",width:"16"})]),f.createVNode(S,{visible:r.isOpen,"onUpdate:visible":e[6]||(e[6]=E=>r.isOpen=E),title:"Експорт таблиці",size:"small",closeClickBack:!0},{footer:f.withCtx(()=>[r.isSuccessTemplate?(f.openBlock(),f.createElementBlock("div",fU,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border border-gray-200 rounded-lg shadow-sm text-nowrap text-start hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[2]||(e[2]=E=>r.isOpen=!1)}," Закрити "),f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-white align-middle bg-blue-600 border border-blue-600 rounded-lg shadow-sm text-nowrap gap-x-2 text-start hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500",onClick:e[3]||(e[3]=E=>r.isSuccessTemplate=!1)}," Вигрузити ще ")])):(f.openBlock(),f.createElementBlock("div",mU,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border border-gray-200 rounded-lg shadow-sm text-nowrap text-start hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[4]||(e[4]=E=>r.isOpen=!1)}," Скасувати "),f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-white align-middle bg-blue-600 border border-blue-600 rounded-lg shadow-sm text-nowrap gap-x-2 text-start hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500",onClick:e[5]||(e[5]=(...E)=>a.exportTable&&a.exportTable(...E))}," Завантажити таблицю ")]))]),default:f.withCtx(()=>[r.isSuccessTemplate?(f.openBlock(),f.createElementBlock("div",nU,[f.createVNode(g,{height:"100",width:"100",class:"text-green-200 mb-[20px]"}),e[8]||(e[8]=f.createElementVNode("h2",null,"Звіт сформовано і збережено",-1))])):(f.openBlock(),f.createElementBlock("div",iU,[f.createElementVNode("div",rU,[f.createElementVNode("div",sU,[e[9]||(e[9]=f.createElementVNode("h2",{class:"text-sm text-gray-500"}," Виберіть стовпці таблиці для експорту: ",-1)),f.createElementVNode("div",oU,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.actions,E=>(f.openBlock(),f.createElementBlock("button",{key:E==null?void 0:E.name,onClick:E==null?void 0:E.function,class:"inline-flex items-center gap-[8px] justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border-gray-200 text-nowrap text-start"},[f.createElementVNode("span",{class:f.normalizeClass(["h-[14px] w-[14px] border rounded-full flex items-center justify-center",{"border-blue-500":(E==null?void 0:E.name)===r.activeAction}])},[(E==null?void 0:E.name)===r.activeAction?(f.openBlock(),f.createElementBlock("span",lU)):f.createCommentVNode("",!0)],2),f.createTextVNode(" "+f.toDisplayString(E==null?void 0:E.label),1)],8,aU))),128))])]),f.createElementVNode("div",cU,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,(E,C)=>(f.openBlock(),f.createElementBlock("div",{class:"flex items-center",key:C,style:{width:"calc((100% - 10px) / 2)"}},[f.createVNode(b,{class:"[&>label]:text-sm [&>label]:text-gray-800 [&>label]:ms-3 !gap-x-[1px] !p-0",modelValue:r.cols,"onUpdate:modelValue":e[1]||(e[1]=P=>r.cols=P),value:E==null?void 0:E.name,label:E==null?void 0:E.ua},null,8,["modelValue","value","label"])]))),128))])]),f.createElementVNode("div",uU,[e[10]||(e[10]=f.createElementVNode("h2",{class:"text-sm text-gray-500"},"Виберіть формат таблиці:",-1)),f.createElementVNode("div",hU,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.tableFormats,(E,C)=>(f.openBlock(),f.createElementBlock("div",{class:"flex items-center",key:C},[f.createElementVNode("input",{type:"radio",name:"hs-pro-duecmfm",class:"text-blue-600 border-gray-300 rounded-full shrink-0 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-500 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800",id:E,onChange:P=>a.selectFormat(E)},null,40,dU),f.createElementVNode("label",{for:E,class:"text-sm text-gray-800 ms-3 dark:text-neutral-400"}," Формат "+f.toDisplayString(E),9,pU)]))),128))])])]))]),_:1},8,["visible"])],64)}const yU=$e(tU,[["render",gU]]),_U={},bU={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-columns"};function xU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",bU,e[0]||(e[0]=[f.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 6l5.5 0"></path><path d="M4 10l5.5 0"></path><path d="M4 14l5.5 0"></path><path d="M4 18l5.5 0"></path><path d="M14.5 6l5.5 0"></path><path d="M14.5 10l5.5 0"></path><path d="M14.5 14l5.5 0"></path><path d="M14.5 18l5.5 0"></path>',9)]))}const vU=$e(_U,[["render",xU]]),wU={props:{column:Object},emits:["update-column"],data(){return{value:!1}},watch:{value(t){this.$emit("update-column",{...this.column,hidden:!t})}},mounted(){var t;((t=this.column)==null?void 0:t.hidden)!==!0&&(this.value=!0)}},kU={class:"flex w-full gap-[8px] items-centr"};function SU(t,e,n,i,r,a){var u,l;return f.openBlock(),f.createElementBlock("label",kU,[f.withDirectives(f.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=g=>r.value=g),type:"checkbox"},null,512),[[f.vModelCheckbox,r.value]]),f.createTextVNode(" "+f.toDisplayString(((u=n.column)==null?void 0:u.ua)||((l=n.column)==null?void 0:l.title)),1)])}const EU={components:{IconColumns:vU,AdminTableColumnsHiddenItem:$e(wU,[["render",SU]])},emits:["update-columns"],props:{columns:Array},methods:{updateColumn(t){const e=this.columns.findIndex(i=>(i==null?void 0:i.name)===(t==null?void 0:t.name)),n=this.columns;n[e]=t,this.$emit("update-columns",[...n])}}},CU={class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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 focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},TU={class:"py-[10px] px-[10px] w-[260px]"},MU={class:"flex flex-col gap-[3px] max-h-[400px] w-full overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function AU(t,e,n,i,r,a){const u=f.resolveComponent("IconColumns"),l=f.resolveComponent("AdminTableColumnsHiddenItem"),g=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(g,{trigger:"click",placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",CU,[f.createVNode(u,{height:"20",width:"16"})])]),default:f.withCtx(()=>[f.createElementVNode("div",TU,[e[0]||(e[0]=f.createElementVNode("h2",{class:"text-sm mb-[8px]"},"Оберіть колонки, щоб приховати",-1)),f.createElementVNode("ul",MU,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,(b,S)=>(f.openBlock(),f.createElementBlock("li",{key:S},[f.createVNode(l,{column:b,onUpdateColumn:a.updateColumn},null,8,["column","onUpdateColumn"])]))),128))])])]),_:1})}const IU=$e(EU,[["render",AU]]),PU={},DU={class:"hidden sm:block shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"};function OU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",DU,e[0]||(e[0]=[f.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 1C8.55228 1 9 1.44772 9 2V7L14 7C14.5523 7 15 7.44771 15 8C15 8.55228 14.5523 9 14 9L9 9V14C9 14.5523 8.55228 15 8 15C7.44772 15 7 14.5523 7 14V9.00001L2 9.00001C1.44772 9.00001 1 8.5523 1 8.00001C0.999999 7.44773 1.44771 7.00001 2 7.00001L7 7.00001V2C7 1.44772 7.44772 1 8 1Z"},null,-1)]))}const zS=$e(PU,[["render",OU]]),zU={},BU={class:"vs-table-interface__table-wrp w-full rounded h-fit overflow-hidden"};function NU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",BU,e[0]||(e[0]=[f.createStaticVNode('<div><div class="p-5 min-h-[500px] flex flex-col justify-center items-center text-center"><svg class="w-48 mx-auto" viewBox="0 0 178 90" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs></svg><div class="max-w-sm mx-auto mt-6"><p class="font-medium text-gray-800 dark:text-neutral-200"> Дані для відображення відсутні </p><p class="mt-2 text-sm text-gray-500 dark:text-neutral-500"> Змініть параметри пошуку або спробуйте пізніше </p></div></div></div>',1)]))}const RU=$e(zU,[["render",NU]]),LU={props:{row:Object,column:Object,table:String}};function VU(t,e,n,i,r,a){var u,l,g,b,S,E,C,P;return f.openBlock(),f.createBlock(f.resolveDynamicComponent(((u=n.column)==null?void 0:u.format)==="custom"?(l=n.column)==null?void 0:l.component:`table-format-${((b=(g=n.column)==null?void 0:g.format)==null?void 0:b.toLowerCase())||"text"}`),{onUpdateTable:e[0]||(e[0]=D=>t.$emit("update-table")),name:(S=n.column)==null?void 0:S.name,data:n.row,value:(C=n.row)==null?void 0:C[(E=n.column)==null?void 0:E.name],table:n.table,column:n.column,edit:(P=n.column)==null?void 0:P.edit},null,40,["name","data","value","table","column","edit"])}const BS=$e(LU,[["render",VU]]),FU={},$U={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-minus"};function jU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",$U,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M5 12l14 0"},null,-1)]))}const UU={components:{IconPlus:zS,IconMinus:$e(FU,[["render",jU]])},props:{title:String,defaultValue:{type:Boolean,default:()=>!1}},data(){return{expanded:this.defaultValue}}},HU={class:"hs-accordion"},qU={class:"py-0.5 flex items-center gap-x-0.5 w-full"},WU={class:"text-sm font-medium"},GU={class:"relative inline-block w-full duration-150 cursor-pointer before:block before:absolute b"};function ZU(t,e,n,i,r,a){const u=f.resolveComponent("IconPlus"),l=f.resolveComponent("IconMinus");return f.openBlock(),f.createElementBlock("div",null,[f.createElementVNode("div",null,[f.createElementVNode("div",HU,[f.createElementVNode("div",qU,[f.createElementVNode("div",{onClick:e[0]||(e[0]=g=>r.expanded=!r.expanded),class:"rounded-md cursor-pointer grow"},[f.createElementVNode("span",WU,f.toDisplayString(n.title),1)]),f.createElementVNode("button",{class:"flex items-center justify-center rounded-md size-6 hover:bg-gray-100",onClick:e[1]||(e[1]=g=>r.expanded=!r.expanded)},[r.expanded?(f.openBlock(),f.createBlock(l,{key:1,width:"14"})):(f.openBlock(),f.createBlock(u,{key:0}))])]),f.createVNode(f.Transition,{name:"fade"},{default:f.withCtx(()=>[f.withDirectives(f.createElementVNode("div",GU,[f.renderSlot(t.$slots,"default",{},void 0,!0)],512),[[f.vShow,r.expanded]])]),_:3})])])])}const YU={components:{AdminComponentIs:BS,AdminTree:$e(UU,[["render",ZU],["__scopeId","data-v-e1f274c9"]]),VsNoData:MS,VsWidgetComments:CS,VsWidgetMap:W1,VsWidgetFileList:qv},props:{table:String,columns:Array,row:Object}},XU={class:"hs-accordion border-gray-100 w-[360px] shrink-0 overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500",style:{height:"calc(100vh - 310px)"}},KU={class:"border-l",style:{height:"calc(100vh - 360px)"}},JU={class:"flex items-center justify-between py-1 gap-x-4"},QU={class:"col-span-1"},eH={class:"inline-flex items-center gap-x-2 text-[13px] text-gray-500 dark:text-neutral-500"},tH={class:"col-span-2"},nH={class:"font-medium text-[13px] text-gray-800 dark:text-neutral-200"},iH={class:"table-info-card"},rH={class:"table-info-card"};function sH(t,e,n,i,r,a){var C,P,D;const u=f.resolveComponent("AdminComponentIs"),l=f.resolveComponent("AdminTree"),g=f.resolveComponent("VsWidgetMap"),b=f.resolveComponent("VsNoData"),S=f.resolveComponent("VsWidgetComments"),E=f.resolveComponent("VsWidgetFileList");return f.openBlock(),f.createElementBlock("div",XU,[e[0]||(e[0]=f.createElementVNode("div",{class:"p-[10px] pl-[18px] pb-[18px] border-b"},[f.createElementVNode("h2",{class:"text-sm font-medium"},"Інформація про об'єкт")],-1)),f.createElementVNode("div",KU,[(P=(C=t.$route)==null?void 0:C.query)!=null&&P.card?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[n.row?(f.openBlock(),f.createBlock(l,{key:0,defaultValue:!0,title:"Основна інформація",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,R=>(f.openBlock(),f.createElementBlock("dl",JU,[f.createElementVNode("dt",QU,[f.createElementVNode("p",eH,f.toDisplayString((R==null?void 0:R.ua)||(R==null?void 0:R.title))+": ",1)]),f.createElementVNode("dd",tH,[f.createElementVNode("p",nH,[f.createVNode(u,{row:n.row,column:R,table:n.table},null,8,["row","column","table"])])])]))),256))]),_:1})):f.createCommentVNode("",!0),(D=n.row)!=null&&D.geom?(f.openBlock(),f.createBlock(l,{key:1,title:"Карта",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>{var R,j;return[(R=n.row)!=null&&R.geom?(f.openBlock(),f.createBlock(g,{key:0,geometry:(j=n.row)==null?void 0:j.geom,zoom:14},null,8,["geometry"])):(f.openBlock(),f.createBlock(b,{key:1,title:"У об'єкта відсутня геометрія",text:"",class:"[&>div]:h-[200px] [&>div]:min-h-[400px] h-[400px]"}))]}),_:1})):f.createCommentVNode("",!0),f.createVNode(l,{title:"Коментарі",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>{var R;return[f.createElementVNode("div",iH,[f.createVNode(S,{id:(R=n.row)==null?void 0:R.id},null,8,["id"])])]}),_:1}),f.createVNode(l,{title:"Файли",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>{var R;return[f.createElementVNode("div",rH,[f.createVNode(E,{id:(R=n.row)==null?void 0:R.id},null,8,["id"])])]}),_:1})],64)):(f.openBlock(),f.createBlock(b,{key:1,text:"Оберіть один з об'єктів в таблиці для відображення інформаціі про нього"}))])])}const oH=$e(YU,[["render",sH]]),aH={},lH={class:"hidden xl:block shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function cH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",lH,e[0]||(e[0]=[f.createElementVNode("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"},null,-1),f.createElementVNode("path",{d:"M15 3v18"},null,-1),f.createElementVNode("path",{d:"m8 9 3 3-3 3"},null,-1)]))}const uH=$e(aH,[["render",cH]]),hH={},dH={class:"h21yx vs0hq",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"};function pH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",dH,e[0]||(e[0]=[f.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)]))}const fH={emits:["filterChange"],props:{scheme:{type:Object},onFilters:{type:Number}},components:{IconFilter:$e(hH,[["render",pH]])},data(){return{isFilters:!1}},methods:{closeFilter({target:t}){this.isFilters&&t.classList.contains("filter-container")&&(this.isFilters=!1)}}},mH={key:0,class:"font-medium text-[10px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full dark:bg-neutral-500"},gH={class:"filter-content h-screen bg-white w-[400px] p-[20px] pt-[10px] overflow-x-auto bg-white [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function yH(t,e,n,i,r,a){const u=f.resolveComponent("IconFilter"),l=f.resolveComponent("VsFilter");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("button",{onClick:e[0]||(e[0]=g=>r.isFilters=!r.isFilters),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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 focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[f.createVNode(u,{height:"16",width:"16"}),e[4]||(e[4]=f.createTextVNode(" Фільтри ")),n.onFilters?(f.openBlock(),f.createElementBlock("span",mH,f.toDisplayString(n.onFilters),1)):f.createCommentVNode("",!0)]),f.createVNode(f.Transition,{name:"fade"},{default:f.withCtx(()=>{var g;return[f.withDirectives(f.createElementVNode("div",{onClick:e[3]||(e[3]=(...b)=>a.closeFilter&&a.closeFilter(...b)),style:{height:"100vh"},class:"fixed filter-container top-0 flex justify-end items-center z-[2] right-0 left-0 bottom-0 bg-[rgba(0,0,0,0.5)]"},[f.createElementVNode("div",gH,[(g=n.scheme)!=null&&g.length?(f.openBlock(),f.createBlock(l,{key:0,ref:"filter",scheme:n.scheme,layout:"default","apply-vue-router":"",history:"",name:"filter",onFilterChange:e[1]||(e[1]=b=>t.$emit("filterChange",b)),closeFilterBtn:!0,onFilterClose:e[2]||(e[2]=b=>r.isFilters=!1)},null,8,["scheme"])):f.createCommentVNode("",!0)])],512),[[f.vShow,r.isFilters]])]}),_:1})],64)}const _H=$e(fH,[["render",yH]]),bH={props:{tabsList:{type:Array,default:()=>[]},filterState:String}},xH={class:"relative flex space-x-1 mb-[20px] after:absolute after:w-[99%] after:bottom-0 after:inset-x-0 after:border-b-2 after:border-gray-200 dark:after:border-neutral-700","aria-label":"Tabs",role:"tablist","aria-orientation":"horizontal"},vH=["onClick"];function wH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("nav",xH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.tabsList,u=>(f.openBlock(),f.createElementBlock("button",{onClick:l=>t.$emit("update:filterState",u==null?void 0:u.name),class:f.normalizeClass(["hs-tab-active:after:bg-gray-800 hs-tab-active:text-gray-800 px-2.5 py-1.5 mb-2 relative inline-flex justify-center items-center gap-x-2 hover:bg-gray-100 text-gray-500 hover:text-gray-800 text-sm rounded-lg disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 after:absolute after:-bottom-2 after:inset-x-0 after:z-10 after:h-0.5 after:pointer-events-none dark:hs-tab-active:text-neutral-200 dark:hs-tab-active:after:bg-neutral-400 dark:text-neutral-500 dark:hover:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 active",{" font-semibold after:absolute after:bottom-[-8px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:bg-gray-800":(u==null?void 0:u.name)===n.filterState}])},f.toDisplayString(u==null?void 0:u.label),11,vH))),256))])}const kH=$e(bH,[["render",wH]]),SH={},EH={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-filter"};function CH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",EH,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z"},null,-1)]))}const TH={components:{IconFilter2:$e(SH,[["render",CH]])},props:{filterCustom:String,customList:Array}},MH={class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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 focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},AH={class:"flex flex-col gap-[4px]"},IH=["onClick"];function PH(t,e,n,i,r,a){const u=f.resolveComponent("IconFilter2"),l=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(l,{ref:"popover",placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",MH,[f.createVNode(u,{height:"20",width:"20"})])]),default:f.withCtx(()=>[f.createElementVNode("div",AH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.customList,(g,b)=>(f.openBlock(),f.createElementBlock("button",{onClick:S=>{var E;t.$emit("update:filterCustom",g==null?void 0:g.name),(E=t.$refs)==null||E.popover.togglePopover()},key:b,class:f.normalizeClass(["p-[8px] block rounded-lg w-[140px] text-start hover:bg-gray-100 !duration-300",{"bg-gray-100":n.filterCustom===(g==null?void 0:g.name)}])},f.toDisplayString(g==null?void 0:g.label),11,IH))),128)),f.createElementVNode("button",{class:"p-[8px] block rounded-lg w-[140px] text-start hover:bg-gray-100 !duration-300",onClick:e[0]||(e[0]=g=>{var b;t.$emit("update:filterCustom",void 0),(b=t.$refs)==null||b.popover.togglePopover()})}," Скинути фільтри ")])]),_:1},512)}const DH=$e(TH,[["render",PH]]),OH={class:"flex items-center gap-x-2"},zH={props:{table:String,title:String},components:{AdminTableControl:G9,AdminTableExport:yU,AdminTableColumnsHidden:IU,AdminTableColumn:I9,AdminNodata:RU,IconPlus:zS,IconSearch:J0,AdminTableCardInfo:oH,IconOpenCard:uH,AdminComponentIs:BS,AdminTableFilters:_H,AdminTableTabs:kH,AdminTableCustomFilters:DH,AdminTableCustomButtons:{__name:"admin-table-custom-buttons",props:{slots:Object},setup(t){var l,g,b,S,E;const{asyncTemplateSlot:e}=(E=(S=(b=(g=(l=f.getCurrentInstance())==null?void 0:l.appContext)==null?void 0:g.app)==null?void 0:b.config)==null?void 0:S.globalProperties)==null?void 0:E.utils,n=f.ref(""),i=f.ref(""),r=t,a=()=>{var C;if(r.slots.panelLeft.includes("<")){const P=e("PanelLeft",(C=r.slots)==null?void 0:C.panelLeft,["name"]);i.value=P}else i.value=r.slots.panelLeft},u=()=>{var C;if(r.slots.panelRight.includes("<")){const P=e("PanelRight",(C=r.slots)==null?void 0:C.panelRight,["name"]);n.value=P}else n.value=r.slots.panelRight};return a(),u(),(C,P)=>(f.openBlock(),f.createElementBlock("div",OH,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(i.value))),(f.openBlock(),f.createBlock(f.resolveDynamicComponent(n.value)))]))}}},data(){return{tableData:{},filterScheme:[],page:1,searchValue:"",limit:0,filters:null,activeColumn:"",isVisibleCardInfo:!1,onFilters:0,filterState:null,filterCustom:null,visibleColumns:[],initialHiddenColumns:""}},async mounted(){await this.checkUrlMounted(),await this.getTableData(),await this.getFilters()},computed:{defaultPage(){var t,e;return((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1},columns(){var t,e;return(e=(t=this.tableData)==null?void 0:t.columns)==null?void 0:e.filter(n=>(n==null?void 0:n.hidden)!==!0)},isForm(){var t;return(t=this.tableData)==null?void 0:t.form},isNoData(){var t,e;return!((t=this.tableData)!=null&&t.rows)||!((e=this.columns)!=null&&e.length)},activeCardRow(){var t,e;return((e=(t=this.tableData)==null?void 0:t.rows)==null?void 0:e.find(n=>{var i,r;return(n==null?void 0:n.id)===((r=(i=this.$route)==null?void 0:i.query)==null?void 0:r.card)}))||{}},getActions(){var t;return(t=this.tableData)==null?void 0:t.actions}},watch:{async table(){this.tableData=null,await this.getTableData()},searchValue:{handler:((t,e=300)=>{let n;return function(...i){clearTimeout(n),n=setTimeout(()=>{t.apply(this,i)},e)}})(async function(t){var e;await this.getTableData(),this.$router.push({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,search:t||void 0}})},500)},$route:{handler(t,e){var n,i;((n=t==null?void 0:t.params)==null?void 0:n.catchAll)!==((i=e==null?void 0:e.params)==null?void 0:i.catchAll)&&(this.visibleColumns=[],this.unmountedData(),this.getFilters())},deep:!0},limit(t){var e;this.$router.replace({query:{...(e=this.$route)==null?void 0:e.query,limit:t}})},filterState(t){var e;t&&(this.$router.replace({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,filterState:t}}),this.getTableData())},filterCustom(t){var e;this.$router.replace({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,custom:t}}),this.getTableData()},columns(t){var e,n,i,r;this.visibleColumns=t==null?void 0:t.map(a=>a==null?void 0:a.name),this.initialHiddenColumns===((e=this.visibleColumns)==null?void 0:e.join(","))&&(this.visibleColumns=[]),this.$router.replace({...this.$route,query:{...(n=this.$route)==null?void 0:n.query,columns:(i=this.visibleColumns)!=null&&i.length?(r=this.visibleColumns)==null?void 0:r.join(","):void 0}})}},methods:{async checkUrlMounted(){var t,e,n,i,r,a,u,l,g,b,S,E,C,P,D,R;this.page=((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1,this.limit=((i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.limit)||20,this.filters=decodeURI((a=(r=this.$route)==null?void 0:r.query)==null?void 0:a.filter)||void 0,this.filterState=((l=(u=this.$route)==null?void 0:u.query)==null?void 0:l.filterState)||null,this.filterCustom=((b=(g=this.$route)==null?void 0:g.query)==null?void 0:b.custom)||null,this.searchValue=((E=(S=this.$route)==null?void 0:S.query)==null?void 0:E.search)||"",this.visibleColumns=((D=(P=(C=this.$route)==null?void 0:C.query)==null?void 0:P.columns)==null?void 0:D.split(","))||[],(R=this.$route)!=null&&R.query.card&&(this.isVisibleCardInfo=!0)},rowWidth(t){var n,i;const e=(i=(n=this.tableData)==null?void 0:n.columns)==null?void 0:i.find(r=>r.name===t);if(e){const r=e==null?void 0:e.width;return r!=null&&r.includes("px")?r:`${r}px`}},unmountedData(){this.page=1,this.visibleColumns=[],this.filterCustom=null,this.filterState=null,this.isVisibleCardInfo=!1,this.filterScheme=null,this.filters=null,this.onFilters=0,this.searchValue=""},async getTableData(){var t,e,n,i,r,a,u,l,g,b,S;try{const{data:E}=await ct.get(`/api/template/table/${this.table}`),C=await ct.get(`/api/table-data/${this.table}`,{params:{page:this.page,search:this.searchValue||null,limit:this.limit,filter:this.filters||null,order:((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort)||null,state:this.filterState||null,custom:this.filterCustom||null}});this.tableData={...E,...(C==null?void 0:C.data)||{}},this.initialHiddenColumns=(a=(r=(i=(n=this.tableData)==null?void 0:n.columns)==null?void 0:i.filter(P=>(P==null?void 0:P.hidden)!==!0))==null?void 0:r.map(P=>P==null?void 0:P.name))==null?void 0:a.join(","),(u=this.visibleColumns)!=null&&u.length?(l=this.tableData)==null||l.columns.forEach(P=>{var D;(D=this.visibleColumns)!=null&&D.includes(P==null?void 0:P.name)?P.hidden=!1:P.hidden=!0}):this.visibleColumns=(S=(b=(g=this.tableData)==null?void 0:g.columns)==null?void 0:b.filter(P=>(P==null?void 0:P.hidden)!==!0))==null?void 0:S.map(P=>P==null?void 0:P.name)}catch{}},async getFilters(){var t;try{const{data:e}=await ct.get(`/api/table-filter/${this.table}`);this.filterScheme=(t=e==null?void 0:e.list)==null?void 0:t.map(n=>({...n,label:(n==null?void 0:n.label)||(n==null?void 0:n.ua)}))}catch{}},async handlePageChange(t){const e=this.$route.query;this.page=t,!(!(e!=null&&e.page)&&t===1||e.page===t)&&(await this.$router.replace({query:{...e,page:t}}),await this.getTableData())},async changeLimit(t){this.limit=await t,this.defaultPage=1,await this.getTableData()},async filterChange({url:t,state:e}){var n;this.filters=t!=="no-url"?t:null,this.onFilters=(n=Object.entries(e))==null?void 0:n.length,this.page=1,await this.getTableData()},changeActiveColumn(t){this.activeColumn=t,this.getTableData()},pushToCard(t){var e;((e=this.tableData)==null?void 0:e.card)===!1||this.$router.push(`/card/${this.table}/${t}`)},changeActiveCardInfo(t){var e;this.isVisibleCardInfo&&this.$router.push({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,card:t}})},toggleCardInfo(){var t;this.isVisibleCardInfo=!this.isVisibleCardInfo,this.isVisibleCardInfo||this.$router.push({...this.$route,query:{...(t=this.$route)==null?void 0:t.query,card:void 0}})}}},BH={class:"w-[calc(100vw - 320px)] bg-gray-50"},NH={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},RH={class:"text-xl font-medium"},LH={style:{height:"calc(100vh - 155px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex pt-[10px]"},VH={class:"bg-white w-full rounded-xl border p-[20px] pr-0"},FH={class:"flex"},$H={class:"flex gap-[6px] ml-auto"},jH={class:"inline-block w-full align-middle"},UH={key:0,class:"relative min-w-full divide-y divide-gray-200 table-fixed dark:divide-neutral-700"},HH={class:"sticky top-[-1px] bg-white w-full after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},qH={class:"right-0 border-t border-stone-200"},WH={key:0,class:"w-[70px] sticky right-0 top-0"},GH={class:"divide-y divide-gray-200"},ZH={class:"px-4 py-3 text-sm text-gray-600"},YH=["onClick"],XH=["onClick"],KH={class:"p-[20px] flex justify-start items-center w-full"},JH={class:"w-[200px]"},QH={class:"text-sm text-gray-600 dark:text-neutral-400"},eq={class:"font-semibold text-gray-800 dark:text-neutral-200"},tq={key:0},nq={key:0,class:"font-semibold text-gray-800 dark:text-neutral-200"};function iq(t,e,n,i,r,a){var Ae,je,De,Ke,rt,Rt,pt,zt,Xt,on,$t,Kt,Cn,dn,vn,pn,ti,Nn,Pn,Rn,Ee;const u=f.resolveComponent("IconPlus"),l=f.resolveComponent("router-link"),g=f.resolveComponent("AdminTableTabs"),b=f.resolveComponent("IconSearch"),S=f.resolveComponent("VsText"),E=f.resolveComponent("AdminTableCustomButtons"),C=f.resolveComponent("AdminTableCustomFilters"),P=f.resolveComponent("AdminTableColumnsHidden"),D=f.resolveComponent("AdminTableExport"),R=f.resolveComponent("AdminTableFilters"),j=f.resolveComponent("IconOpenCard"),W=f.resolveComponent("AdminTableColumn"),ee=f.resolveComponent("AdminComponentIs"),le=f.resolveComponent("AdminTableControl"),J=f.resolveComponent("AdminNodata"),Te=f.resolveComponent("VsPagination"),xe=f.resolveComponent("AdminTableCardInfo");return f.openBlock(),f.createElementBlock("div",BH,[f.createElementVNode("div",NH,[f.createElementVNode("h2",RH,f.toDisplayString(n.title),1),a.isForm?(f.openBlock(),f.createBlock(l,{key:0,to:`/add?table=${(je=(Ae=t.$route)==null?void 0:Ae.params)==null?void 0:je.catchAll}`,class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"},{default:f.withCtx(()=>[f.createVNode(u,{height:"16",width:"16"}),e[5]||(e[5]=f.createTextVNode(" Додати "))]),_:1},8,["to"])):f.createCommentVNode("",!0)]),f.createElementVNode("div",LH,[f.createElementVNode("div",VH,[(Ke=(De=r.tableData)==null?void 0:De.filterState)!=null&&Ke.length?(f.openBlock(),f.createBlock(g,{key:0,tabsList:(rt=r.tableData)==null?void 0:rt.filterState,filterState:r.filterState,"onUpdate:filterState":e[0]||(e[0]=Ie=>r.filterState=Ie)},null,8,["tabsList","filterState"])):f.createCommentVNode("",!0),f.createElementVNode("div",FH,[f.createElementVNode("div",{class:f.normalizeClass([r.isVisibleCardInfo?"w-[calc(100%-360px)]":"w-full"])},[f.createElementVNode("div",{class:f.normalizeClass(["flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5 mb-[10px] relative",{"pr-[20px]":!r.isVisibleCardInfo}])},[f.createVNode(b,{height:"14",width:"14",class:"absolute top-[10px] left-[14px] text-gray-500 z-[1]"}),f.createVNode(S,{modelValue:r.searchValue,"onUpdate:modelValue":e[1]||(e[1]=Ie=>r.searchValue=Ie),placeholder:"Пошук...",clearable:!0,class:"[&>input]:py-[7px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600"},null,8,["modelValue"]),f.createElementVNode("div",$H,[(Rt=r.tableData)!=null&&Rt.slots?(f.openBlock(),f.createBlock(E,{key:0,slots:(pt=r.tableData)==null?void 0:pt.slots},null,8,["slots"])):f.createCommentVNode("",!0),(Xt=(zt=r.tableData)==null?void 0:zt.filterCustom)!=null&&Xt.length?(f.openBlock(),f.createBlock(C,{key:1,customList:(on=r.tableData)==null?void 0:on.filterCustom,filterCustom:r.filterCustom,"onUpdate:filterCustom":e[2]||(e[2]=Ie=>r.filterCustom=Ie)},null,8,["customList","filterCustom"])):f.createCommentVNode("",!0),f.createVNode(P,{columns:($t=r.tableData)==null?void 0:$t.columns,onUpdateColumns:e[3]||(e[3]=Ie=>r.tableData.columns=Ie)},null,8,["columns"]),f.createVNode(D,{table:n.table,columns:(Kt=r.tableData)==null?void 0:Kt.columns,page:r.page,"filter-state":r.filterState,"filter-custom":r.filterCustom,filters:r.filters},null,8,["table","columns","page","filter-state","filter-custom","filters"]),(Cn=r.filterScheme)!=null&&Cn.length?(f.openBlock(),f.createBlock(R,{key:2,scheme:r.filterScheme,onFilters:r.onFilters,onFilterChange:a.filterChange},null,8,["scheme","onFilters","onFilterChange"])):f.createCommentVNode("",!0),f.createElementVNode("button",{onClick:e[4]||(e[4]=(...Ie)=>a.toggleCardInfo&&a.toggleCardInfo(...Ie)),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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 focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[f.createVNode(j,{class:f.normalizeClass({"rotate-180 duration-300":!r.isVisibleCardInfo})},null,8,["class"])])])],2),f.createElementVNode("div",{class:f.normalizeClass(["flex items-start justify-start w-full space-y-5",{"pr-[20px]":!r.isVisibleCardInfo}])},[f.createElementVNode("div",{style:f.normalizeStyle({height:(vn=(dn=r.tableData)==null?void 0:dn.filterState)!=null&&vn.length?"calc(100vh - 370px)":"calc(100vh - 330px)"}),class:"overflow-x-auto w-full [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},[f.createElementVNode("div",jH,[a.isNoData?(f.openBlock(),f.createBlock(J,{key:1})):(f.openBlock(),f.createElementBlock("table",UH,[f.createElementVNode("thead",HH,[f.createElementVNode("tr",qH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.columns,Ie=>(f.openBlock(),f.createBlock(W,{key:Ie.name,style:f.normalizeStyle({width:a.rowWidth(Ie==null?void 0:Ie.name),textAlign:Ie==null?void 0:Ie.align,wordBreak:Ie==null?void 0:Ie.wrap}),data:Ie,activeColumn:r.activeColumn,onChangeActive:a.changeActiveColumn},null,8,["style","data","activeColumn","onChangeActive"]))),128)),(ti=(pn=a.getActions)==null?void 0:pn.filter(Ie=>Ie!=="add"))!=null&&ti.length?(f.openBlock(),f.createElementBlock("th",WH)):f.createCommentVNode("",!0)])]),f.createElementVNode("tbody",GH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Nn=r.tableData)==null?void 0:Nn.rows,(Ie,Ze)=>{var st,Bt,Jt,Mt,Tt,rn,we,yn,pr,jt;return f.openBlock(),f.createElementBlock("tr",{key:Ze,class:f.normalizeClass({"bg-gray-50":((Bt=(st=t.$route)==null?void 0:st.query)==null?void 0:Bt.card)===(Ie==null?void 0:Ie.id)})},[f.createElementVNode("td",ZH,[f.createElementVNode("button",{onClick:()=>a.pushToCard(Ie==null?void 0:Ie.id),class:f.normalizeClass(["text-sm font-medium",[((Jt=r.tableData)==null?void 0:Jt.card)===!1?"":"text-blue-600 decoration-2 focus:outline-none focus:underline hover:text-blue-600 hover:underline"]])},[f.createVNode(ee,{row:Ie,column:a.columns[0],table:n.table,onUpdateTable:a.getTableData},null,8,["row","column","table","onUpdateTable"])],10,YH)]),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Mt=a.columns)==null?void 0:Mt.slice(1),Qt=>(f.openBlock(),f.createElementBlock("td",{onClick:Ui=>a.changeActiveCardInfo(Ie==null?void 0:Ie.id),class:f.normalizeClass(["px-3 py-3 text-sm text-gray-600 text-start whitespace-nowrap",{"cursor-pointer":r.isVisibleCardInfo}]),key:Qt.name},[f.createVNode(ee,{row:Ie,column:Qt,table:n.table,onUpdateTable:a.getTableData},null,8,["row","column","table","onUpdateTable"])],10,XH))),128)),(rn=(Tt=a.getActions)==null?void 0:Tt.filter(Qt=>Qt!=="add"))!=null&&rn.length?(f.openBlock(),f.createElementBlock("td",{key:0,class:f.normalizeClass(["text-center sticky right-0 w-[80px] px-[10px]",{"bg-gray-50":((yn=(we=t.$route)==null?void 0:we.query)==null?void 0:yn.card)===(Ie==null?void 0:Ie.id),"bg-white":((jt=(pr=t.$route)==null?void 0:pr.query)==null?void 0:jt.card)!==(Ie==null?void 0:Ie.id)}])},[f.createVNode(le,{actions:a.getActions,isForm:a.isForm,item:Ie,table:n.table,onUpdateTable:a.getTableData},null,8,["actions","isForm","item","table","onUpdateTable"])],2)):f.createCommentVNode("",!0)],2)}),128))])]))])],4)],2),f.createElementVNode("div",KH,[f.createElementVNode("div",JH,[f.createElementVNode("p",QH,[f.createElementVNode("span",eq,[f.createTextVNode(f.toDisplayString(r.filters||r.searchValue?"Знайдено":"Об'єктів")+" "+f.toDisplayString(((Pn=r.tableData)==null?void 0:Pn.count)||"0 ")+" ",1),r.filters||r.searchValue?(f.openBlock(),f.createElementBlock("span",tq," з")):f.createCommentVNode("",!0)]),r.filters||r.searchValue?(f.openBlock(),f.createElementBlock("span",nq,f.toDisplayString(" "+((Rn=r.tableData)==null?void 0:Rn.filtered)||0),1)):f.createCommentVNode("",!0)])]),r.limit?(f.openBlock(),f.createBlock(Te,{key:0,goTo:!1,class:"justify-end","default-page":parseInt(a.defaultPage),total:((Ee=r.tableData)==null?void 0:Ee.filtered)||0,pageSize:parseInt(r.limit),onPageChange:a.handlePageChange,pageSizes:[10,16,20],onPageSizeChange:a.changeLimit,backgroundColor:"#D6D3D1"},null,8,["default-page","total","pageSize","onPageChange","onPageSizeChange"])):f.createCommentVNode("",!0)])],2),f.createVNode(f.Transition,{name:"slide-fade"},{default:f.withCtx(()=>{var Ie;return[r.isVisibleCardInfo?(f.openBlock(),f.createBlock(xe,{key:0,table:n.table,columns:(Ie=r.tableData)==null?void 0:Ie.columns,row:a.activeCardRow},null,8,["table","columns","row"])):f.createCommentVNode("",!0)]}),_:1})])])])])}const rq={components:{AdminTable:$e(zH,[["render",iq],["__scopeId","data-v-33658824"]])},data(){return{table:!1,interface:"",title:""}},watch:{$route:{async handler(){Ss!=null&&Ss.value||await this.getMenu(),await this.checkPageType()},deep:!0},title(t){var e;t&&(document.title=(((e=hl.value)==null?void 0:e.titlePrefix)||"")+t)}},async mounted(){await this.checkPageType()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async checkPageType(){var i,r;const t=this.flattenMenu(Ss.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.params)==null?void 0:l.catchAll)});this.title=e==null?void 0:e.ua,e||this.$router.replace("/404"),e!=null&&e.component&&this.$router.replace((r=(i=this.$route)==null?void 0:i.params)==null?void 0:r.catchAll);const n=e==null?void 0:e.table;this.table=n||!1,!n&&this.getInterface()},async getInterface(){var t,e;try{const{data:n}=await ct.get(`/api/template/interface/${((e=(t=this.$route)==null?void 0:t.params)==null?void 0:e.catchAll)||""}`);this.interface=n||""}catch{this.interface=""}}}},sq=["innerHTML"];function oq(t,e,n,i,r,a){const u=f.resolveComponent("AdminTable");return r.table?(f.openBlock(),f.createBlock(u,{key:0,table:r.table,title:r.title},null,8,["table","title"])):(f.openBlock(),f.createElementBlock("div",{key:1,class:"w-full bg-gray-50",style:{height:"calc(100vh - 120px)"},innerHTML:r.interface},null,8,sq))}const aq=Object.freeze(Object.defineProperty({__proto__:null,default:$e(rq,[["render",oq]])},Symbol.toStringTag,{value:"Module"}));return ej});
|