@opengis/admin 0.1.84 → 0.1.86

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. package/README.md +29 -29
  2. package/config.js +4 -4
  3. package/dist/{IconChevronDown-DoqykhvB.js → IconChevronDown-BP50SBFz.js} +1 -1
  4. package/dist/{add-page-ChBpMfRU.js → add-page-DbjBxsHN.js} +1 -1
  5. package/dist/{admin-interface-SDtt7rqS.js → admin-interface-CNBVM_7D.js} +4 -4
  6. package/dist/{admin-view-CKTriO6z.js → admin-view-CyAXWfSU.js} +44 -44
  7. package/dist/admin.js +1 -1
  8. package/dist/admin.umd.cjs +8 -8
  9. package/dist/assets/logo.svg +41 -41
  10. package/dist/{card-page-BaSbgjMn.js → card-page-BNs9nE8c.js} +2 -2
  11. package/dist/{card-view-B8ohi0lw.js → card-view-Dyopcvx4.js} +1 -1
  12. package/dist/{edit-page-DLlbyyd_.js → edit-page-CtNICp9w.js} +1 -1
  13. package/dist/{import-file-CV5CU5lC.js → import-file-CBlObEWm.js} +858 -835
  14. package/dist/style.css +1 -1
  15. package/module/settings/card/admin.roles.table/access.hbs +27 -27
  16. package/module/settings/card/admin.roles.table/general_info.hbs +16 -16
  17. package/module/settings/card/admin.roles.table/index.yml +14 -14
  18. package/module/settings/card/admin.roles.table/users.hbs +27 -27
  19. package/module/settings/card/admin.routes.table/general_info.hbs +40 -40
  20. package/module/settings/card/admin.routes.table/index.yml +8 -8
  21. package/module/settings/card/admin.routes.table/users.hbs +33 -33
  22. package/module/settings/card/admin.users.table/general_info.hbs +25 -25
  23. package/module/settings/card/admin.users.table/index.yml +12 -12
  24. package/module/settings/card/admin.users.table/logs.hbs +30 -30
  25. package/module/settings/card/admin.users.table/user_roles.hbs +24 -24
  26. package/module/settings/cls/core.actions.json +17 -17
  27. package/module/settings/cls/core.scope.json +13 -13
  28. package/module/settings/cls/properties.site_status.json +13 -13
  29. package/module/settings/cls/properties.widget_status.json +13 -13
  30. package/module/settings/cls/users.user_type.json +13 -13
  31. package/module/settings/form/admin.access.form.json +36 -36
  32. package/module/settings/form/admin.custom_column.form.json +71 -71
  33. package/module/settings/form/admin.properties.form.json +15 -15
  34. package/module/settings/form/admin.roles.form.json +19 -19
  35. package/module/settings/form/admin.routes.form.json +25 -25
  36. package/module/settings/form/admin.user_properties.form.json +15 -15
  37. package/module/settings/form/admin.user_roles.form.json +21 -21
  38. package/module/settings/form/admin.users.form.json +153 -153
  39. package/module/settings/form/user.user_roles.form.json +13 -13
  40. package/module/settings/interface/admin.properties.json +4 -4
  41. package/module/settings/interface/admin.roles.json +4 -4
  42. package/module/settings/interface/admin.routes.json +4 -4
  43. package/module/settings/interface/admin.users.json +4 -4
  44. package/module/settings/menu.json +50 -50
  45. package/module/settings/select/core.roles.json +2 -2
  46. package/module/settings/select/core.routes.sql +1 -1
  47. package/module/settings/select/core.user_mentioned.sql +1 -1
  48. package/module/settings/select/core.user_uid.sql +1 -1
  49. package/module/settings/table/admin.access.table.json +83 -83
  50. package/module/settings/table/admin.custom_column.table.json +99 -99
  51. package/module/settings/table/admin.properties.table.json +39 -39
  52. package/module/settings/table/admin.roles.table.json +64 -64
  53. package/module/settings/table/admin.routes.table.json +68 -68
  54. package/module/settings/table/admin.user_properties.table.json +34 -34
  55. package/module/settings/table/admin.user_roles.table.json +72 -72
  56. package/module/settings/table/admin.users.table.json +121 -121
  57. package/package.json +82 -82
  58. package/plugin.js +29 -29
  59. package/server/helpers/controllers/badge.js +11 -11
  60. package/server/helpers/controllers/hb.js +2 -2
  61. package/server/helpers/controllers/map.js +2 -2
  62. package/server/helpers/controllers/mls.js +2 -2
  63. package/server/helpers/controllers/token.js +16 -16
  64. package/server/helpers/controllers/vue.js +2 -2
  65. package/server/helpers/index.mjs +29 -17
  66. package/server/helpers/list/buttonHelper.js +11 -0
  67. package/server/helpers/list/descriptionList.js +34 -0
  68. package/server/helpers/list/tableList.js +66 -0
  69. package/server/helpers/list/utils/button.js +6 -0
  70. package/server/plugins/access/funcs/getAdminAccess.js +14 -14
  71. package/server/plugins/access/index.mjs +6 -6
  72. package/server/plugins/adminHook.js +81 -93
  73. package/server/plugins/cron.js +10 -10
  74. package/server/plugins/docs.js +28 -28
  75. package/server/plugins/hook.js +226 -223
  76. package/server/plugins/vite.js +71 -71
  77. package/server/routes/access/controllers/access.group.js +29 -29
  78. package/server/routes/access/controllers/access.group.post.js +43 -43
  79. package/server/routes/access/index.mjs +63 -63
  80. package/server/routes/calendar/controllers/calendar.data.js +87 -87
  81. package/server/routes/calendar/index.mjs +7 -7
  82. package/server/routes/calendar/schema.js +21 -21
  83. package/server/routes/data/controllers/cardData.js +81 -81
  84. package/server/routes/data/controllers/cardTabData.js +49 -49
  85. package/server/routes/data/controllers/funcs/getFilterSQL/index.js +92 -92
  86. package/server/routes/data/controllers/funcs/getFilterSQL/util/formatValue.js +170 -170
  87. package/server/routes/data/controllers/funcs/getFilterSQL/util/getCustomQuery.js +13 -13
  88. package/server/routes/data/controllers/funcs/getFilterSQL/util/getFilterQuery.js +64 -64
  89. package/server/routes/data/controllers/funcs/getFilterSQL/util/getOptimizedQuery.js +12 -12
  90. package/server/routes/data/controllers/funcs/getFilterSQL/util/getTableSql.js +34 -34
  91. package/server/routes/data/controllers/tableData.js +20 -20
  92. package/server/routes/data/controllers/tableDataId.js +27 -27
  93. package/server/routes/data/controllers/tableFilter.js +63 -63
  94. package/server/routes/data/controllers/tokenInfo.js +9 -9
  95. package/server/routes/data/controllers/utils/assignTokens.js +30 -30
  96. package/server/routes/data/controllers/utils/getColumns.js +8 -8
  97. package/server/routes/data/index.mjs +17 -17
  98. package/server/routes/data/schema.js +54 -54
  99. package/server/routes/menu/controllers/getMenu.js +67 -67
  100. package/server/routes/menu/index.mjs +5 -5
  101. package/server/routes/notifications/controllers/readNotifications.js +27 -27
  102. package/server/routes/notifications/controllers/testEmail.js +35 -35
  103. package/server/routes/notifications/controllers/userNotifications.js +53 -53
  104. package/server/routes/notifications/funcs/addNotification.js +21 -21
  105. package/server/routes/notifications/funcs/sendNotification.js +105 -105
  106. package/server/routes/notifications/hook/onWidgetSet.js +57 -57
  107. package/server/routes/notifications/index.mjs +27 -27
  108. package/server/routes/notifications/schema.js +16 -16
  109. package/server/routes/properties/controllers/admin.properties.get.js +29 -29
  110. package/server/routes/properties/controllers/admin.properties.post.js +2 -2
  111. package/server/routes/properties/controllers/user.properties.get.js +30 -30
  112. package/server/routes/properties/controllers/user.properties.post.js +30 -30
  113. package/server/routes/properties/funcs/getSettings.js +56 -56
  114. package/server/routes/properties/funcs/setSettings.js +44 -44
  115. package/server/routes/properties/funcs/utils/dataInsert.js +26 -26
  116. package/server/routes/properties/index.mjs +14 -14
  117. package/server/routes/properties/schema.js +10 -10
  118. package/server/routes/root.mjs +3 -3
  119. package/server/routes/templates/controllers/getTemplate.js +26 -26
  120. package/server/routes/templates/index.mjs +16 -16
  121. package/server/routes/templates/schema.js +8 -8
  122. package/server/routes/user/controllers/user.cls.id.js +14 -14
  123. package/server/routes/user/controllers/user.cls.js +71 -71
  124. package/server/routes/user/controllers/user.cls.post.js +52 -52
  125. package/server/routes/user/controllers/user.info.js +17 -17
  126. package/server/routes/user/schema.js +14 -14
  127. package/server/routes/widget/controllers/utils/historyFormat.js +75 -75
  128. package/server/routes/widget/controllers/utils/obj2db.js +13 -13
  129. package/server/routes/widget/controllers/widget.del.js +41 -41
  130. package/server/routes/widget/controllers/widget.get.js +96 -96
  131. package/server/routes/widget/controllers/widget.set.js +76 -76
  132. package/server/routes/widget/index.mjs +11 -11
  133. package/server/routes/widget/schema.js +12 -12
  134. package/server/templates/cls/itree.recrzone_category.json +73 -73
  135. package/server/templates/cls/test.json +9 -9
  136. package/server/templates/form/admin.user_cls.data.form.json +49 -49
  137. package/server/templates/form/admin.user_group_rel.form.json +21 -21
  138. package/server/templates/form/cp_building.form.json +32 -32
  139. package/server/templates/form/form-user-pass.json +10 -10
  140. package/server/templates/form/form-user_group.json +39 -39
  141. package/server/templates/form/form-users.json +156 -156
  142. package/server/templates/form/user_group_access.form.json +22 -22
  143. package/server/templates/select/account_id.json +2 -2
  144. package/server/templates/table/gis.dataset.table.json +43 -43
  145. package/server/templates/table/management.user_group.table.json +112 -112
  146. package/server/templates/table/management.users.table.json +126 -126
  147. package/utils.js +29 -29
@@ -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:SC}=Object.prototype,{getPrototypeOf:eg}=Object,rp=(t=>e=>{const n=SC.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Bo=t=>(t=t.toLowerCase(),e=>rp(e)===t),op=t=>e=>typeof e===t,{isArray:hc}=Array,Yu=op("undefined");function EC(t){return t!==null&&!Yu(t)&&t.constructor!==null&&!Yu(t.constructor)&&Hr(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const vb=Bo("ArrayBuffer");function CC(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&vb(t.buffer),e}const TC=op("string"),Hr=op("function"),wb=op("number"),sp=t=>t!==null&&typeof t=="object",MC=t=>t===!0||t===!1,ap=t=>{if(rp(t)!=="object")return!1;const e=eg(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},AC=Bo("Date"),IC=Bo("File"),PC=Bo("Blob"),DC=Bo("FileList"),OC=t=>sp(t)&&Hr(t.pipe),BC=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]"))},zC=Bo("URLSearchParams"),[NC,RC,LC,VC]=["ReadableStream","Request","Response","Headers"].map(Bo),FC=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 kb(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,Sb=t=>!Yu(t)&&t!==ll;function tg(){const{caseless:t}=Sb(this)&&this||{},e={},n=(i,r)=>{const a=t&&kb(e,r)||r;ap(e[a])&&ap(i)?e[a]=tg(e[a],i):ap(i)?e[a]=tg({},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 $C=(t,e,n,{allOwnKeys:i}={})=>(Xu(e,(r,a)=>{n&&Hr(r)?t[a]=uc(r,n):t[a]=r},{allOwnKeys:i}),t),jC=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),UC=(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)},HC=(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&&eg(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},qC=(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},WC=t=>{if(!t)return null;if(hc(t))return t;let e=t.length;if(!wb(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},GC=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&eg(Uint8Array)),ZC=(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])}},YC=(t,e)=>{let n;const i=[];for(;(n=t.exec(e))!==null;)i.push(n);return i},XC=Bo("HTMLFormElement"),KC=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,i,r){return i.toUpperCase()+r}),Eb=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),JC=Bo("RegExp"),Cb=(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)},QC=t=>{Cb(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+"'")})}})},eT=(t,e)=>{const n={},i=r=>{r.forEach(a=>{n[a]=!0})};return hc(t)?i(t):i(String(t).split(e)),n},tT=()=>{},nT=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,ng="abcdefghijklmnopqrstuvwxyz",Tb="0123456789",Mb={DIGIT:Tb,ALPHA:ng,ALPHA_DIGIT:ng+ng.toUpperCase()+Tb},iT=(t=16,e=Mb.ALPHA_DIGIT)=>{let n="";const{length:i}=e;for(;t--;)n+=e[Math.random()*i|0];return n};function rT(t){return!!(t&&Hr(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const oT=t=>{const e=new Array(10),n=(i,r)=>{if(sp(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)},sT=Bo("AsyncFunction"),aT=t=>t&&(sp(t)||Hr(t))&&Hr(t.then)&&Hr(t.catch),Ab=((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)),lT=typeof queueMicrotask<"u"?queueMicrotask.bind(ll):typeof process<"u"&&process.nextTick||Ab,Pe={isArray:hc,isArrayBuffer:vb,isBuffer:EC,isFormData:BC,isArrayBufferView:CC,isString:TC,isNumber:wb,isBoolean:MC,isObject:sp,isPlainObject:ap,isReadableStream:NC,isRequest:RC,isResponse:LC,isHeaders:VC,isUndefined:Yu,isDate:AC,isFile:IC,isBlob:PC,isRegExp:JC,isFunction:Hr,isStream:OC,isURLSearchParams:zC,isTypedArray:GC,isFileList:DC,forEach:Xu,merge:tg,extend:$C,trim:FC,stripBOM:jC,inherits:UC,toFlatObject:HC,kindOf:rp,kindOfTest:Bo,endsWith:qC,toArray:WC,forEachEntry:ZC,matchAll:YC,isHTMLForm:XC,hasOwnProperty:Eb,hasOwnProp:Eb,reduceDescriptors:Cb,freezeMethods:QC,toObjectSet:eT,toCamelCase:KC,noop:tT,toFiniteNumber:nT,findKey:kb,global:ll,isContextDefined:Sb,ALPHABET:Mb,generateString:iT,isSpecCompliantForm:rT,toJSONObject:oT,isAsyncFn:sT,isThenable:aT,setImmediate:Ab,asap:lT};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 Ib=qt.prototype,Pb={};["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=>{Pb[t]={value:t}}),Object.defineProperties(qt,Pb),Object.defineProperty(Ib,"isAxiosError",{value:!0}),qt.from=(t,e,n,i,r,a)=>{const u=Object.create(Ib);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 cT=null;function ig(t){return Pe.isPlainObject(t)||Pe.isArray(t)}function Db(t){return Pe.endsWith(t,"[]")?t.slice(0,-2):t}function Ob(t,e,n){return t?t.concat(e).map(function(r,a){return r=Db(r),!n&&a?"["+r+"]":r}).join(n?".":""):e}function uT(t){return Pe.isArray(t)&&!t.some(ig)}const hT=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,$){return!Pe.isUndefined($[R])});const i=n.metaTokens,r=n.visitor||k,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 k(D,R,$){let G=D;if(D&&!$&&typeof D=="object"){if(Pe.endsWith(R,"{}"))R=i?R:R.slice(0,-2),D=JSON.stringify(D);else if(Pe.isArray(D)&&uT(D)||(Pe.isFileList(D)||Pe.endsWith(R,"[]"))&&(G=Pe.toArray(D)))return R=Db(R),G.forEach(function(se,Q){!(Pe.isUndefined(se)||se===null)&&e.append(u===!0?Ob([R],Q,a):u===null?R:R+"[]",b(se))}),!1}return ig(D)?!0:(e.append(Ob($,R,a),b(D)),!1)}const E=[],C=Object.assign(hT,{defaultVisitor:k,convertValue:b,isVisitable:ig});function I(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(G,q){(!(Pe.isUndefined(G)||G===null)&&r.call(e,G,Pe.isString(q)?q.trim():q,R,C))===!0&&I(G,R?R.concat(q):[q])}),E.pop()}}if(!Pe.isObject(t))throw new TypeError("data must be an object");return I(t),e}function Bb(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function rg(t,e){this._pairs=[],t&&lp(t,this,e)}const zb=rg.prototype;zb.append=function(e,n){this._pairs.push([e,n])},zb.toString=function(e){const n=e?function(i){return e.call(this,i,Bb)}:Bb;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function dT(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Nb(t,e,n){if(!e)return t;const i=n&&n.encode||dT,r=n&&n.serialize;let a;if(r?a=r(e,n):a=Pe.isURLSearchParams(e)?e.toString():new rg(e,n).toString(i),a){const u=t.indexOf("#");u!==-1&&(t=t.slice(0,u)),t+=(t.indexOf("?")===-1?"?":"&")+a}return t}class Rb{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 Lb={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},pT={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:rg,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},og=typeof window<"u"&&typeof document<"u",sg=typeof navigator=="object"&&navigator||void 0,fT=og&&(!sg||["ReactNative","NativeScript","NS"].indexOf(sg.product)<0),mT=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",gT=og&&window.location.href||"http://localhost",kr={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:og,hasStandardBrowserEnv:fT,hasStandardBrowserWebWorkerEnv:mT,navigator:sg,origin:gT},Symbol.toStringTag,{value:"Module"})),...pT};function yT(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 _T(t){return Pe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function bT(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 Vb(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]=bT(r[u])),!l)}if(Pe.isFormData(t)&&Pe.isFunction(t.entries)){const n={};return Pe.forEachEntry(t,(i,r)=>{e(_T(i),r,n,0)}),n}return null}function xT(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:Lb,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(Vb(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 yT(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),xT(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 vT=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"]),wT=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:SC}=Object.prototype,{getPrototypeOf:eg}=Object,rp=(t=>e=>{const n=SC.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Bo=t=>(t=t.toLowerCase(),e=>rp(e)===t),op=t=>e=>typeof e===t,{isArray:hc}=Array,Yu=op("undefined");function EC(t){return t!==null&&!Yu(t)&&t.constructor!==null&&!Yu(t.constructor)&&Hr(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const vb=Bo("ArrayBuffer");function CC(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&vb(t.buffer),e}const TC=op("string"),Hr=op("function"),wb=op("number"),sp=t=>t!==null&&typeof t=="object",MC=t=>t===!0||t===!1,ap=t=>{if(rp(t)!=="object")return!1;const e=eg(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},AC=Bo("Date"),IC=Bo("File"),PC=Bo("Blob"),DC=Bo("FileList"),OC=t=>sp(t)&&Hr(t.pipe),BC=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]"))},zC=Bo("URLSearchParams"),[NC,RC,LC,VC]=["ReadableStream","Request","Response","Headers"].map(Bo),FC=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 kb(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,Sb=t=>!Yu(t)&&t!==ll;function tg(){const{caseless:t}=Sb(this)&&this||{},e={},n=(i,r)=>{const a=t&&kb(e,r)||r;ap(e[a])&&ap(i)?e[a]=tg(e[a],i):ap(i)?e[a]=tg({},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 $C=(t,e,n,{allOwnKeys:i}={})=>(Xu(e,(r,a)=>{n&&Hr(r)?t[a]=uc(r,n):t[a]=r},{allOwnKeys:i}),t),jC=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),UC=(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)},HC=(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&&eg(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},qC=(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},WC=t=>{if(!t)return null;if(hc(t))return t;let e=t.length;if(!wb(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},GC=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&eg(Uint8Array)),ZC=(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])}},YC=(t,e)=>{let n;const i=[];for(;(n=t.exec(e))!==null;)i.push(n);return i},XC=Bo("HTMLFormElement"),KC=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,i,r){return i.toUpperCase()+r}),Eb=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),JC=Bo("RegExp"),Cb=(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)},QC=t=>{Cb(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+"'")})}})},eT=(t,e)=>{const n={},i=r=>{r.forEach(a=>{n[a]=!0})};return hc(t)?i(t):i(String(t).split(e)),n},tT=()=>{},nT=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,ng="abcdefghijklmnopqrstuvwxyz",Tb="0123456789",Mb={DIGIT:Tb,ALPHA:ng,ALPHA_DIGIT:ng+ng.toUpperCase()+Tb},iT=(t=16,e=Mb.ALPHA_DIGIT)=>{let n="";const{length:i}=e;for(;t--;)n+=e[Math.random()*i|0];return n};function rT(t){return!!(t&&Hr(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const oT=t=>{const e=new Array(10),n=(i,r)=>{if(sp(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)},sT=Bo("AsyncFunction"),aT=t=>t&&(sp(t)||Hr(t))&&Hr(t.then)&&Hr(t.catch),Ab=((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)),lT=typeof queueMicrotask<"u"?queueMicrotask.bind(ll):typeof process<"u"&&process.nextTick||Ab,Pe={isArray:hc,isArrayBuffer:vb,isBuffer:EC,isFormData:BC,isArrayBufferView:CC,isString:TC,isNumber:wb,isBoolean:MC,isObject:sp,isPlainObject:ap,isReadableStream:NC,isRequest:RC,isResponse:LC,isHeaders:VC,isUndefined:Yu,isDate:AC,isFile:IC,isBlob:PC,isRegExp:JC,isFunction:Hr,isStream:OC,isURLSearchParams:zC,isTypedArray:GC,isFileList:DC,forEach:Xu,merge:tg,extend:$C,trim:FC,stripBOM:jC,inherits:UC,toFlatObject:HC,kindOf:rp,kindOfTest:Bo,endsWith:qC,toArray:WC,forEachEntry:ZC,matchAll:YC,isHTMLForm:XC,hasOwnProperty:Eb,hasOwnProp:Eb,reduceDescriptors:Cb,freezeMethods:QC,toObjectSet:eT,toCamelCase:KC,noop:tT,toFiniteNumber:nT,findKey:kb,global:ll,isContextDefined:Sb,ALPHABET:Mb,generateString:iT,isSpecCompliantForm:rT,toJSONObject:oT,isAsyncFn:sT,isThenable:aT,setImmediate:Ab,asap:lT};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 Ib=qt.prototype,Pb={};["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=>{Pb[t]={value:t}}),Object.defineProperties(qt,Pb),Object.defineProperty(Ib,"isAxiosError",{value:!0}),qt.from=(t,e,n,i,r,a)=>{const u=Object.create(Ib);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 cT=null;function ig(t){return Pe.isPlainObject(t)||Pe.isArray(t)}function Db(t){return Pe.endsWith(t,"[]")?t.slice(0,-2):t}function Ob(t,e,n){return t?t.concat(e).map(function(r,a){return r=Db(r),!n&&a?"["+r+"]":r}).join(n?".":""):e}function uT(t){return Pe.isArray(t)&&!t.some(ig)}const hT=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,$){return!Pe.isUndefined($[R])});const i=n.metaTokens,r=n.visitor||k,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 k(D,R,$){let G=D;if(D&&!$&&typeof D=="object"){if(Pe.endsWith(R,"{}"))R=i?R:R.slice(0,-2),D=JSON.stringify(D);else if(Pe.isArray(D)&&uT(D)||(Pe.isFileList(D)||Pe.endsWith(R,"[]"))&&(G=Pe.toArray(D)))return R=Db(R),G.forEach(function(se,Q){!(Pe.isUndefined(se)||se===null)&&e.append(u===!0?Ob([R],Q,a):u===null?R:R+"[]",b(se))}),!1}return ig(D)?!0:(e.append(Ob($,R,a),b(D)),!1)}const E=[],C=Object.assign(hT,{defaultVisitor:k,convertValue:b,isVisitable:ig});function I(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(G,q){(!(Pe.isUndefined(G)||G===null)&&r.call(e,G,Pe.isString(q)?q.trim():q,R,C))===!0&&I(G,R?R.concat(q):[q])}),E.pop()}}if(!Pe.isObject(t))throw new TypeError("data must be an object");return I(t),e}function Bb(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function rg(t,e){this._pairs=[],t&&lp(t,this,e)}const zb=rg.prototype;zb.append=function(e,n){this._pairs.push([e,n])},zb.toString=function(e){const n=e?function(i){return e.call(this,i,Bb)}:Bb;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function dT(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Nb(t,e,n){if(!e)return t;const i=n&&n.encode||dT,r=n&&n.serialize;let a;if(r?a=r(e,n):a=Pe.isURLSearchParams(e)?e.toString():new rg(e,n).toString(i),a){const u=t.indexOf("#");u!==-1&&(t=t.slice(0,u)),t+=(t.indexOf("?")===-1?"?":"&")+a}return t}class Rb{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 Lb={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},pT={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:rg,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},og=typeof window<"u"&&typeof document<"u",sg=typeof navigator=="object"&&navigator||void 0,fT=og&&(!sg||["ReactNative","NativeScript","NS"].indexOf(sg.product)<0),mT=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",gT=og&&window.location.href||"http://localhost",kr={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:og,hasStandardBrowserEnv:fT,hasStandardBrowserWebWorkerEnv:mT,navigator:sg,origin:gT},Symbol.toStringTag,{value:"Module"})),...pT};function yT(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 _T(t){return Pe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function bT(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 Vb(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]=bT(r[u])),!l)}if(Pe.isFormData(t)&&Pe.isFunction(t.entries)){const n={};return Pe.forEachEntry(t,(i,r)=>{e(_T(i),r,n,0)}),n}return null}function xT(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:Lb,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(Vb(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 yT(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),xT(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 vT=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"]),wT=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]&&vT[n])&&(n==="set-cookie"?e[n]?e[n].push(i):e[n]=[i]:e[n]=e[n]?e[n]+", "+i:i)}),e},Fb=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 kT(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 ST=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function ag(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 ET(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,i)=>n.toUpperCase()+i)}function CT(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 k=Ju(g);if(!k)throw new Error("header name must be a non-empty string");const E=Pe.findKey(r,k);(!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,k)=>a(b,k,g));if(Pe.isPlainObject(e)||e instanceof this.constructor)u(e,n);else if(Pe.isString(e)&&(e=e.trim())&&!ST(e))u(wT(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 kT(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||ag(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||ag(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||ag(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?ET(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[Fb]=this[Fb]={accessors:{}}).accessors,r=this.prototype;function a(u){const l=Ju(u);i[l]||(CT(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 lg(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 $b(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 jb(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 TT(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function MT(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(),k=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 I=k&&b-k;return I?Math.round(C*1e3/I):void 0}}function AT(t,e){let n=0,i=1e3/e,r,a;const u=(b,k=Date.now())=>{n=k,r=null,a&&(clearTimeout(a),a=null),t.apply(null,b)};return[(...b)=>{const k=Date.now(),E=k-n;E>=i?u(b,k):(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=MT(50,250);return AT(a=>{const u=a.loaded,l=a.lengthComputable?a.total:void 0,g=u-i,b=r(g),k=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&&k?(l-u)/b:void 0,event:a,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(E)},n)},Ub=(t,e)=>{const n=t!=null;return[i=>e[0]({lengthComputable:n,total:t,loaded:i}),e[1]]},Hb=t=>(...e)=>Pe.asap(()=>t(...e)),IT=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}}(),PT=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 DT(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function OT(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function qb(t,e){return t&&!DT(e)?OT(t,e):e}const Wb=t=>t instanceof Sr?{...t}:t;function cl(t,e){e=e||{};const n={};function i(b,k,E){return Pe.isPlainObject(b)&&Pe.isPlainObject(k)?Pe.merge.call({caseless:E},b,k):Pe.isPlainObject(k)?Pe.merge({},k):Pe.isArray(k)?k.slice():k}function r(b,k,E){if(Pe.isUndefined(k)){if(!Pe.isUndefined(b))return i(void 0,b,E)}else return i(b,k,E)}function a(b,k){if(!Pe.isUndefined(k))return i(void 0,k)}function u(b,k){if(Pe.isUndefined(k)){if(!Pe.isUndefined(b))return i(void 0,b)}else return i(void 0,k)}function l(b,k,E){if(E in e)return i(b,k);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,k)=>r(Wb(b),Wb(k),!0)};return Pe.forEach(Object.keys(Object.assign({},t,e)),function(k){const E=g[k]||r,C=E(t[k],e[k],k);Pe.isUndefined(C)&&E!==l||(n[k]=C)}),n}const Gb=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=Nb(qb(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,...k]=g?g.split(";").map(E=>E.trim()).filter(Boolean):[];u.setContentType([b||"multipart/form-data",...k].join("; "))}}if(kr.hasStandardBrowserEnv&&(i&&Pe.isFunction(i)&&(i=i(e)),i||i!==!1&&IT(e.url))){const b=r&&a&&PT.read(a);b&&u.set(r,b)}return e},BT=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(n,i){const r=Gb(t);let a=r.data;const u=Sr.from(r.headers).normalize();let{responseType:l,onUploadProgress:g,onDownloadProgress:b}=r,k,E,C,I,D;function R(){I&&I(),D&&D(),r.cancelToken&&r.cancelToken.unsubscribe(k),r.signal&&r.signal.removeEventListener("abort",k)}let $=new XMLHttpRequest;$.open(r.method.toUpperCase(),r.url,!0),$.timeout=r.timeout;function G(){if(!$)return;const se=Sr.from("getAllResponseHeaders"in $&&$.getAllResponseHeaders()),Se={data:!l||l==="text"||l==="json"?$.responseText:$.response,status:$.status,statusText:$.statusText,headers:se,config:t,request:$};jb(function(Ce){n(Ce),R()},function(Ce){i(Ce),R()},Se),$=null}"onloadend"in $?$.onloadend=G:$.onreadystatechange=function(){!$||$.readyState!==4||$.status===0&&!($.responseURL&&$.responseURL.indexOf("file:")===0)||setTimeout(G)},$.onabort=function(){$&&(i(new qt("Request aborted",qt.ECONNABORTED,t,$)),$=null)},$.onerror=function(){i(new qt("Network Error",qt.ERR_NETWORK,t,$)),$=null},$.ontimeout=function(){let Q=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const Se=r.transitional||Lb;r.timeoutErrorMessage&&(Q=r.timeoutErrorMessage),i(new qt(Q,Se.clarifyTimeoutError?qt.ETIMEDOUT:qt.ECONNABORTED,t,$)),$=null},a===void 0&&u.setContentType(null),"setRequestHeader"in $&&Pe.forEach(u.toJSON(),function(Q,Se){$.setRequestHeader(Se,Q)}),Pe.isUndefined(r.withCredentials)||($.withCredentials=!!r.withCredentials),l&&l!=="json"&&($.responseType=r.responseType),b&&([C,D]=up(b,!0),$.addEventListener("progress",C)),g&&$.upload&&([E,I]=up(g),$.upload.addEventListener("progress",E),$.upload.addEventListener("loadend",I)),(r.cancelToken||r.signal)&&(k=se=>{$&&(i(!se||se.type?new dc(null,t,$):se),$.abort(),$=null)},r.cancelToken&&r.cancelToken.subscribe(k),r.signal&&(r.signal.aborted?k():r.signal.addEventListener("abort",k)));const q=TT(r.url);if(q&&kr.protocols.indexOf(q)===-1){i(new qt("Unsupported protocol "+q+":",qt.ERR_BAD_REQUEST,t));return}$.send(a||null)})},zT=(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 k=b instanceof Error?b:this.reason;i.abort(k instanceof qt?k:new dc(k instanceof Error?k.message:k))}};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}},NT=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},RT=async function*(t,e){for await(const n of LT(t))yield*NT(n,e)},LT=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()}},Zb=(t,e,n,i)=>{const r=RT(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:k}=await r.next();if(b){l(),g.close();return}let E=k.byteLength;if(n){let C=a+=E;n(C)}g.enqueue(new Uint8Array(k))}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",Yb=hp&&typeof ReadableStream=="function",VT=hp&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),Xb=(t,...e)=>{try{return!!t(...e)}catch{return!1}},FT=Yb&&Xb(()=>{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}),Kb=64*1024,cg=Yb&&Xb(()=>Pe.isReadableStream(new Response("").body)),dp={stream:cg&&(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 $T=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 VT(t)).byteLength},jT=async(t,e)=>{const n=Pe.toFiniteNumber(t.getContentLength());return n??$T(e)},ug={http:cT,xhr:BT,fetch:hp&&(async t=>{let{url:e,method:n,data:i,signal:r,cancelToken:a,timeout:u,onDownloadProgress:l,onUploadProgress:g,responseType:b,headers:k,withCredentials:E="same-origin",fetchOptions:C}=Gb(t);b=b?(b+"").toLowerCase():"text";let I=zT([r,a&&a.toAbortSignal()],u),D;const R=I&&I.unsubscribe&&(()=>{I.unsubscribe()});let $;try{if(g&&FT&&n!=="get"&&n!=="head"&&($=await jT(k,i))!==0){let Se=new Request(e,{method:"POST",body:i,duplex:"half"}),_e;if(Pe.isFormData(i)&&(_e=Se.headers.get("content-type"))&&k.setContentType(_e),Se.body){const[Ce,Le]=Ub($,up(Hb(g)));i=Zb(Se.body,Kb,Ce,Le)}}Pe.isString(E)||(E=E?"include":"omit");const G="credentials"in Request.prototype;D=new Request(e,{...C,signal:I,method:n.toUpperCase(),headers:k.normalize().toJSON(),body:i,duplex:"half",credentials:G?E:void 0});let q=await fetch(D);const se=cg&&(b==="stream"||b==="response");if(cg&&(l||se&&R)){const Se={};["status","statusText","headers"].forEach(Ie=>{Se[Ie]=q[Ie]});const _e=Pe.toFiniteNumber(q.headers.get("content-length")),[Ce,Le]=l&&Ub(_e,up(Hb(l),!0))||[];q=new Response(Zb(q.body,Kb,Ce,()=>{Le&&Le(),R&&R()}),Se)}b=b||"text";let Q=await dp[Pe.findKey(dp,b)||"text"](q,t);return!se&&R&&R(),await new Promise((Se,_e)=>{jb(Se,_e,{data:Q,headers:Sr.from(q.headers),status:q.status,statusText:q.statusText,config:t,request:D})})}catch(G){throw R&&R(),G&&G.name==="TypeError"&&/fetch/i.test(G.message)?Object.assign(new qt("Network Error",qt.ERR_NETWORK,t,D),{cause:G.cause||G}):qt.from(G,G&&G.code,t,D)}})};Pe.forEach(ug,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Jb=t=>`- ${t}`,UT=t=>Pe.isFunction(t)||t===null||t===!1,Qb={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,!UT(n)&&(i=ug[(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[Fb]=this[Fb]={accessors:{}}).accessors,r=this.prototype;function a(u){const l=Ju(u);i[l]||(CT(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 lg(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 $b(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 jb(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 TT(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function MT(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(),k=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 I=k&&b-k;return I?Math.round(C*1e3/I):void 0}}function AT(t,e){let n=0,i=1e3/e,r,a;const u=(b,k=Date.now())=>{n=k,r=null,a&&(clearTimeout(a),a=null),t.apply(null,b)};return[(...b)=>{const k=Date.now(),E=k-n;E>=i?u(b,k):(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=MT(50,250);return AT(a=>{const u=a.loaded,l=a.lengthComputable?a.total:void 0,g=u-i,b=r(g),k=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&&k?(l-u)/b:void 0,event:a,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(E)},n)},Ub=(t,e)=>{const n=t!=null;return[i=>e[0]({lengthComputable:n,total:t,loaded:i}),e[1]]},Hb=t=>(...e)=>Pe.asap(()=>t(...e)),IT=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}}(),PT=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 DT(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function OT(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function qb(t,e){return t&&!DT(e)?OT(t,e):e}const Wb=t=>t instanceof Sr?{...t}:t;function cl(t,e){e=e||{};const n={};function i(b,k,E){return Pe.isPlainObject(b)&&Pe.isPlainObject(k)?Pe.merge.call({caseless:E},b,k):Pe.isPlainObject(k)?Pe.merge({},k):Pe.isArray(k)?k.slice():k}function r(b,k,E){if(Pe.isUndefined(k)){if(!Pe.isUndefined(b))return i(void 0,b,E)}else return i(b,k,E)}function a(b,k){if(!Pe.isUndefined(k))return i(void 0,k)}function u(b,k){if(Pe.isUndefined(k)){if(!Pe.isUndefined(b))return i(void 0,b)}else return i(void 0,k)}function l(b,k,E){if(E in e)return i(b,k);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,k)=>r(Wb(b),Wb(k),!0)};return Pe.forEach(Object.keys(Object.assign({},t,e)),function(k){const E=g[k]||r,C=E(t[k],e[k],k);Pe.isUndefined(C)&&E!==l||(n[k]=C)}),n}const Gb=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=Nb(qb(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,...k]=g?g.split(";").map(E=>E.trim()).filter(Boolean):[];u.setContentType([b||"multipart/form-data",...k].join("; "))}}if(kr.hasStandardBrowserEnv&&(i&&Pe.isFunction(i)&&(i=i(e)),i||i!==!1&&IT(e.url))){const b=r&&a&&PT.read(a);b&&u.set(r,b)}return e},BT=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(n,i){const r=Gb(t);let a=r.data;const u=Sr.from(r.headers).normalize();let{responseType:l,onUploadProgress:g,onDownloadProgress:b}=r,k,E,C,I,D;function R(){I&&I(),D&&D(),r.cancelToken&&r.cancelToken.unsubscribe(k),r.signal&&r.signal.removeEventListener("abort",k)}let $=new XMLHttpRequest;$.open(r.method.toUpperCase(),r.url,!0),$.timeout=r.timeout;function G(){if(!$)return;const se=Sr.from("getAllResponseHeaders"in $&&$.getAllResponseHeaders()),Se={data:!l||l==="text"||l==="json"?$.responseText:$.response,status:$.status,statusText:$.statusText,headers:se,config:t,request:$};jb(function(Ce){n(Ce),R()},function(Ce){i(Ce),R()},Se),$=null}"onloadend"in $?$.onloadend=G:$.onreadystatechange=function(){!$||$.readyState!==4||$.status===0&&!($.responseURL&&$.responseURL.indexOf("file:")===0)||setTimeout(G)},$.onabort=function(){$&&(i(new qt("Request aborted",qt.ECONNABORTED,t,$)),$=null)},$.onerror=function(){i(new qt("Network Error",qt.ERR_NETWORK,t,$)),$=null},$.ontimeout=function(){let Q=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const Se=r.transitional||Lb;r.timeoutErrorMessage&&(Q=r.timeoutErrorMessage),i(new qt(Q,Se.clarifyTimeoutError?qt.ETIMEDOUT:qt.ECONNABORTED,t,$)),$=null},a===void 0&&u.setContentType(null),"setRequestHeader"in $&&Pe.forEach(u.toJSON(),function(Q,Se){$.setRequestHeader(Se,Q)}),Pe.isUndefined(r.withCredentials)||($.withCredentials=!!r.withCredentials),l&&l!=="json"&&($.responseType=r.responseType),b&&([C,D]=up(b,!0),$.addEventListener("progress",C)),g&&$.upload&&([E,I]=up(g),$.upload.addEventListener("progress",E),$.upload.addEventListener("loadend",I)),(r.cancelToken||r.signal)&&(k=se=>{$&&(i(!se||se.type?new dc(null,t,$):se),$.abort(),$=null)},r.cancelToken&&r.cancelToken.subscribe(k),r.signal&&(r.signal.aborted?k():r.signal.addEventListener("abort",k)));const q=TT(r.url);if(q&&kr.protocols.indexOf(q)===-1){i(new qt("Unsupported protocol "+q+":",qt.ERR_BAD_REQUEST,t));return}$.send(a||null)})},zT=(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 k=b instanceof Error?b:this.reason;i.abort(k instanceof qt?k:new dc(k instanceof Error?k.message:k))}};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}},NT=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},RT=async function*(t,e){for await(const n of LT(t))yield*NT(n,e)},LT=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()}},Zb=(t,e,n,i)=>{const r=RT(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:k}=await r.next();if(b){l(),g.close();return}let E=k.byteLength;if(n){let C=a+=E;n(C)}g.enqueue(new Uint8Array(k))}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",Yb=hp&&typeof ReadableStream=="function",VT=hp&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),Xb=(t,...e)=>{try{return!!t(...e)}catch{return!1}},FT=Yb&&Xb(()=>{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}),Kb=64*1024,cg=Yb&&Xb(()=>Pe.isReadableStream(new Response("").body)),dp={stream:cg&&(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 $T=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 VT(t)).byteLength},jT=async(t,e)=>{const n=Pe.toFiniteNumber(t.getContentLength());return n??$T(e)},ug={http:cT,xhr:BT,fetch:hp&&(async t=>{let{url:e,method:n,data:i,signal:r,cancelToken:a,timeout:u,onDownloadProgress:l,onUploadProgress:g,responseType:b,headers:k,withCredentials:E="same-origin",fetchOptions:C}=Gb(t);b=b?(b+"").toLowerCase():"text";let I=zT([r,a&&a.toAbortSignal()],u),D;const R=I&&I.unsubscribe&&(()=>{I.unsubscribe()});let $;try{if(g&&FT&&n!=="get"&&n!=="head"&&($=await jT(k,i))!==0){let Se=new Request(e,{method:"POST",body:i,duplex:"half"}),_e;if(Pe.isFormData(i)&&(_e=Se.headers.get("content-type"))&&k.setContentType(_e),Se.body){const[Ce,Le]=Ub($,up(Hb(g)));i=Zb(Se.body,Kb,Ce,Le)}}Pe.isString(E)||(E=E?"include":"omit");const G="credentials"in Request.prototype;D=new Request(e,{...C,signal:I,method:n.toUpperCase(),headers:k.normalize().toJSON(),body:i,duplex:"half",credentials:G?E:void 0});let q=await fetch(D);const se=cg&&(b==="stream"||b==="response");if(cg&&(l||se&&R)){const Se={};["status","statusText","headers"].forEach(Ie=>{Se[Ie]=q[Ie]});const _e=Pe.toFiniteNumber(q.headers.get("content-length")),[Ce,Le]=l&&Ub(_e,up(Hb(l),!0))||[];q=new Response(Zb(q.body,Kb,Ce,()=>{Le&&Le(),R&&R()}),Se)}b=b||"text";let Q=await dp[Pe.findKey(dp,b)||"text"](q,t);return!se&&R&&R(),await new Promise((Se,_e)=>{jb(Se,_e,{data:Q,headers:Sr.from(q.headers),status:q.status,statusText:q.statusText,config:t,request:D})})}catch(G){throw R&&R(),G&&G.name==="TypeError"&&/fetch/i.test(G.message)?Object.assign(new qt("Network Error",qt.ERR_NETWORK,t,D),{cause:G.cause||G}):qt.from(G,G&&G.code,t,D)}})};Pe.forEach(ug,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Jb=t=>`- ${t}`,UT=t=>Pe.isFunction(t)||t===null||t===!1,Qb={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,!UT(n)&&(i=ug[(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(Jb).join(`
5
5
  `):" "+Jb(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:ug};function hg(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new dc(null,t)}function ex(t){return hg(t),t.headers=Sr.from(t.headers),t.data=lg.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Qb.getAdapter(t.adapter||Ku.adapter)(t).then(function(i){return hg(t),i.data=lg.call(t,t.transformResponse,i),i.headers=Sr.from(i.headers),i},function(i){return $b(i)||(hg(t),i&&i.response&&(i.response.data=lg.call(t,t.transformResponse,i.response),i.response.headers=Sr.from(i.response.headers))),Promise.reject(i)})}const tx="1.7.7",dg={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{dg[t]=function(i){return typeof i===t||"a"+(e<1?"n ":" ")+t}});const nx={};dg.transitional=function(e,n,i){function r(a,u){return"[Axios v"+tx+"] 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&&!nx[u]&&(nx[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 HT(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 pg={assertOptions:HT,validators:dg},ia=pg.validators;class ul{constructor(e){this.defaults=e,this.interceptors={request:new Rb,response:new Rb}}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&&pg.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}:pg.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 k,E=0,C;if(!g){const D=[ex.bind(this),void 0];for(D.unshift.apply(D,l),D.push.apply(D,b),C=D.length,k=Promise.resolve(n);E<C;)k=k.then(D[E++],D[E++]);return k}C=l.length;let I=n;for(E=0;E<C;){const D=l[E++],R=l[E++];try{I=D(I)}catch($){R.call(this,$);break}}try{k=ex.call(this,I)}catch(D){return Promise.reject(D)}for(E=0,C=b.length;E<C;)k=k.then(b[E++],b[E++]);return k}getUri(e){e=cl(this.defaults,e);const n=qb(e.baseURL,e.url);return Nb(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 fg{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 fg(function(r){e=r}),cancel:e}}}function qT(t){return function(n){return t.apply(null,n)}}function WT(t){return Pe.isObject(t)&&t.isAxiosError===!0}const mg={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(mg).forEach(([t,e])=>{mg[e]=t});function ix(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 ix(cl(t,r))},n}const rt=ix(Ku);rt.Axios=ul,rt.CanceledError=dc,rt.CancelToken=fg,rt.isCancel=$b,rt.VERSION=tx,rt.toFormData=lp,rt.AxiosError=qt,rt.Cancel=rt.CanceledError,rt.all=function(e){return Promise.all(e)},rt.spread=qT,rt.isAxiosError=WT,rt.mergeConfig=cl,rt.AxiosHeaders=Sr,rt.formToJSON=t=>Vb(Pe.isHTMLForm(t)?new FormData(t):t),rt.getAdapter=Qb.getAdapter,rt.HttpStatusCode=mg,rt.default=rt;const hl=f.ref({}),GT={__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 ZT(){return rx().__VUE_DEVTOOLS_GLOBAL_HOOK__}function rx(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const YT=typeof Proxy=="function",XT="devtools-plugin:setup",KT="plugin:settings:set";let pc,gg;function JT(){var t;return pc!==void 0||(typeof window<"u"&&window.performance?(pc=!0,gg=window.performance):typeof globalThis<"u"&&(!((t=globalThis.perf_hooks)===null||t===void 0)&&t.performance)?(pc=!0,gg=globalThis.perf_hooks.performance):pc=!1),pc}function QT(){return JT()?gg.now():Date.now()}class eM{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 QT()}},n&&n.on(KT,(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 tM(t,e){const n=t,i=rx(),r=ZT(),a=YT&&n.enableEarlyProxy;if(r&&(i.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!a))r.emit(XT,t,e);else{const u=a?new eM(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_${Z};
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(o,d,m,y,x,M,P,O,N){this.context=o;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!==P||this.boundDynamicVertexBuffer2!==O||this.boundDynamicVertexBuffer3!==N?this.freshBind(d,m,y,x,M,P,O,N):(o.bindVertexArray.set(this.vao),P&&P.bind(),x&&x.dynamicDraw&&x.bind(),O&&O.bind(),N&&N.bind())}freshBind(o,d,m,y,x,M,P,O){const N=o.numAttributes,V=this.context,F=V.gl;this.vao&&this.destroy(),this.vao=V.createVertexArray(),V.bindVertexArray.set(this.vao),this.boundProgram=o,this.boundLayoutVertexBuffer=d,this.boundPaintVertexBuffers=m,this.boundIndexBuffer=y,this.boundVertexOffset=x,this.boundDynamicVertexBuffer=M,this.boundDynamicVertexBuffer2=P,this.boundDynamicVertexBuffer3=O,d.enableAttributes(F,o);for(const Z of m)Z.enableAttributes(F,o);M&&M.enableAttributes(F,o),P&&P.enableAttributes(F,o),O&&O.enableAttributes(F,o),d.bind(),d.setVertexAttribPointers(F,o,x);for(const Z of m)Z.bind(),Z.setVertexAttribPointers(F,o,x);M&&(M.bind(),M.setVertexAttribPointers(F,o,x)),y&&y.bind(),P&&(P.bind(),P.setVertexAttribPointers(F,o,x)),O&&(O.bind(),O.setVertexAttribPointers(F,o,x)),V.currentNumAttributes=N}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const ed=(v,o,d,m,y)=>({u_matrix:v,u_texture:0,u_ele_delta:o,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 o=[];for(let d=0;d<v.length;d++){if(v[d]===null)continue;const m=v[d].split(" ");o.push(m.pop())}return o}class td{constructor(o,d,m,y,x,M){const P=o.gl;this.program=P.createProgram();const O=Ia(d.staticAttributes),N=m?m.getBinderAttributes():[],V=O.concat(N),F=ds.prelude.staticUniforms?Ia(ds.prelude.staticUniforms):[],Z=d.staticUniforms?Ia(d.staticUniforms):[],J=m?m.getBinderUniforms():[],ee=F.concat(Z).concat(J),re=[];for(const ve of ee)re.indexOf(ve)<0&&re.push(ve);const le=m?m.defines():[];x&&le.push("#define OVERDRAW_INSPECTOR;"),M&&le.push("#define TERRAIN3D;");const ce=le.concat(ds.prelude.fragmentSource,d.fragmentSource).join(`
623
623
  `),he=le.concat(ds.prelude.vertexSource,d.vertexSource).join(`
624
- `),te=P.createShader(P.FRAGMENT_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(te,ce),P.compileShader(te),!P.getShaderParameter(te,P.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${P.getShaderInfoLog(te)}`);P.attachShader(this.program,te);const me=P.createShader(P.VERTEX_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(me,he),P.compileShader(me),!P.getShaderParameter(me,P.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${P.getShaderInfoLog(me)}`);P.attachShader(this.program,me),this.attributes={};const ge={};this.numAttributes=V.length;for(let ve=0;ve<this.numAttributes;ve++)V[ve]&&(P.bindAttribLocation(this.program,ve,V[ve]),this.attributes[V[ve]]=ve);if(P.linkProgram(this.program),!P.getProgramParameter(this.program,P.LINK_STATUS))throw new Error(`Program failed to link: ${P.getProgramInfoLog(this.program)}`);P.deleteShader(me),P.deleteShader(te);for(let ve=0;ve<re.length;ve++){const Be=re[ve];if(Be&&!ge[Be]){const Fe=P.getUniformLocation(this.program,Be);Fe&&(ge[Be]=Fe)}}this.fixedUniforms=y(o,ge),this.terrainUniforms=((ve,Be)=>({u_depth:new l.aH(ve,Be.u_depth),u_terrain:new l.aH(ve,Be.u_terrain),u_terrain_dim:new l.aI(ve,Be.u_terrain_dim),u_terrain_matrix:new l.aJ(ve,Be.u_terrain_matrix),u_terrain_unpack:new l.aK(ve,Be.u_terrain_unpack),u_terrain_exaggeration:new l.aI(ve,Be.u_terrain_exaggeration)}))(o,ge),this.binderUniforms=m?m.getUniforms(o,ge):[]}draw(o,d,m,y,x,M,P,O,N,V,F,Z,J,ee,re,le,ce,he){const te=o.gl;if(this.failedToCreate)return;if(o.program.set(this.program),o.setDepthMode(m),o.setStencilMode(y),o.setColorMode(x),o.setCullFace(M),O){o.activeTexture.set(te.TEXTURE2),te.bindTexture(te.TEXTURE_2D,O.depthTexture),o.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(P[ge]);re&&re.setUniforms(o,this.binderUniforms,J,{zoom:ee});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 Z.get()){const ve=ge.vaos||(ge.vaos={});(ve[N]||(ve[N]=new Qh)).bind(o,this,V,re?re.getPaintVertexBuffers():[],F,ge.vertexOffset,le,ce,he),te.drawElements(d,ge.primitiveLength*me,te.UNSIGNED_SHORT,ge.primitiveOffset*me*2)}}}function iu(v,o,d){const m=1/Zt(d,1,o.transform.tileZoom),y=Math.pow(2,d.tileID.overscaledZ),x=d.tileSize*Math.pow(2,o.transform.tileZoom)/y,M=x*(d.tileID.canonical.x+d.tileID.wrap*y),P=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,P>>16],u_pixel_coord_lower:[65535&M,65535&P]}}const Vl=(v,o,d,m)=>{const y=o.style.light,x=y.properties.get("position"),M=[x.x,x.y,x.z],P=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),Z=Math.cos(V);N[0]=Z,N[1]=F,N[2]=0,N[3]=-F,N[4]=Z,N[5]=0,N[6]=0,N[7]=0,N[8]=1}(P,-o.transform.angle),function(N,V,F){var Z=V[0],J=V[1],ee=V[2];N[0]=Z*F[0]+J*F[3]+ee*F[6],N[1]=Z*F[1]+J*F[4]+ee*F[7],N[2]=Z*F[2]+J*F[5]+ee*F[8]}(M,M,P);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,o,d,m,y,x,M)=>l.e(Vl(v,o,d,m),iu(x,o,M),{u_height_factor:-Math.pow(2,y.overscaledZ)/M.tileSize/8}),Pa=v=>({u_matrix:v}),Jf=(v,o,d,m)=>l.e(Pa(v),iu(d,o,m)),r_=(v,o)=>({u_matrix:v,u_world:o}),Qf=(v,o,d,m,y)=>l.e(Jf(v,o,d,m),{u_world:y}),o_=(v,o,d,m)=>{const y=v.transform;let x,M;if(m.paint.get("circle-pitch-alignment")==="map"){const P=Zt(d,1,y.zoom);x=!0,M=[P,P]}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(o.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}},js=(v,o,d)=>({u_matrix:v,u_inv_matrix:o,u_camera_to_center_distance:d.cameraToCenterDistance,u_viewport_size:[d.width,d.height]}),Fl=(v,o,d=1)=>({u_matrix:v,u_color:o,u_overlay:0,u_overlay_scale:d}),nr=v=>({u_matrix:v}),ir=(v,o,d,m)=>({u_matrix:v,u_extrude_scale:Zt(o,1,d),u_intensity:m}),ou=(v,o,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:o.paint.get("heatmap-opacity")}};function su(v,o){const d=Math.pow(2,o.canonical.z),m=o.canonical.y;return[new l.Z(0,m/d).toLngLat().lat,new l.Z(0,(m+1)/d).toLngLat().lat]}const au=(v,o,d,m)=>{const y=v.transform;return{u_matrix:nm(v,o,d,m),u_ratio:1/Zt(o,1,y.zoom),u_device_pixel_ratio:v.pixelRatio,u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]]}},em=(v,o,d,m,y)=>l.e(au(v,o,d,y),{u_image:0,u_image_height:m}),Da=(v,o,d,m,y)=>{const x=v.transform,M=tm(o,x);return{u_matrix:nm(v,o,d,y),u_texsize:o.imageAtlasTexture.size,u_ratio:1/Zt(o,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]]}},s_=(v,o,d,m,y,x)=>{const M=v.lineAtlas,P=tm(o,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,Z=V.width*y.toScale;return l.e(au(v,o,d,x),{u_patternscale_a:[P/F,-N.height/2],u_patternscale_b:[P/Z,-V.height/2],u_sdfgamma:M.width/(256*Math.min(F,Z)*v.pixelRatio)/2,u_image:0,u_tex_y_a:N.y,u_tex_y_b:V.y,u_mix:y.t})};function tm(v,o){return 1/Zt(v,1,o.tileZoom)}function nm(v,o,d,m){return v.translatePosMatrix(m?m.posMatrix:o.tileID.posMatrix,o,d.paint.get("line-translate"),d.paint.get("line-translate-anchor"))}const a_=(v,o,d,m,y)=>{return{u_matrix:v,u_tl_parent:o,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:l_(y.paint.get("raster-hue-rotate"))};var x,M};function l_(v){v*=Math.PI/180;const o=Math.sin(v),d=Math.cos(v);return[(2*d+1)/3,(-Math.sqrt(3)*o-d+1)/3,(Math.sqrt(3)*o-d+1)/3]}const im=(v,o,d,m,y,x,M,P,O,N,V,F,Z,J)=>{const ee=M.transform;return{u_is_size_zoom_constant:+(v==="constant"||v==="source"),u_is_size_feature_constant:+(v==="constant"||v==="camera"),u_size_t:o?o.uSizeT:0,u_size:o?o.uSize:0,u_camera_to_center_distance:ee.cameraToCenterDistance,u_pitch:ee.pitch/360*2*Math.PI,u_rotate_symbol:+d,u_aspect_ratio:ee.width/ee.height,u_fade_change:M.options.fadeDuration?M.symbolFadeChange:1,u_matrix:P,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:Z,u_texture:0,u_translation:V,u_pitched_scale:J}},$l=(v,o,d,m,y,x,M,P,O,N,V,F,Z,J,ee)=>{const re=M.transform;return l.e(im(v,o,d,m,y,x,M,P,O,N,V,F,Z,ee),{u_gamma_scale:m?Math.cos(re._pitch)*re.cameraToCenterDistance:1,u_device_pixel_ratio:M.pixelRatio,u_is_halo:+J})},nd=(v,o,d,m,y,x,M,P,O,N,V,F,Z,J)=>l.e($l(v,o,d,m,y,x,M,P,O,N,V,!0,F,!0,J),{u_texsize_icon:Z,u_texture_icon:1}),lu=(v,o,d)=>({u_matrix:v,u_opacity:o,u_color:d}),id=(v,o,d,m,y,x)=>l.e(function(M,P,O,N){const V=O.imageManager.getPattern(M.from.toString()),F=O.imageManager.getPattern(M.to.toString()),{width:Z,height:J}=O.imageManager.getPixelSize(),ee=Math.pow(2,N.tileID.overscaledZ),re=N.tileSize*Math.pow(2,O.transform.tileZoom)/ee,le=re*(N.tileID.canonical.x+N.tileID.wrap*ee),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:[Z,J],u_mix:P.t,u_pattern_size_a:V.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:P.fromScale,u_scale_b:P.toScale,u_tile_units_to_pixels:1/Zt(N,1,O.transform.tileZoom),u_pixel_coord_upper:[le>>16,ce>>16],u_pixel_coord_lower:[65535&le,65535&ce]}}(m,x,d,y),{u_matrix:v,u_opacity:o}),rd={fillExtrusion:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_lightpos:new l.aN(v,o.u_lightpos),u_lightintensity:new l.aI(v,o.u_lightintensity),u_lightcolor:new l.aN(v,o.u_lightcolor),u_vertical_gradient:new l.aI(v,o.u_vertical_gradient),u_opacity:new l.aI(v,o.u_opacity)}),fillExtrusionPattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_lightpos:new l.aN(v,o.u_lightpos),u_lightintensity:new l.aI(v,o.u_lightintensity),u_lightcolor:new l.aN(v,o.u_lightcolor),u_vertical_gradient:new l.aI(v,o.u_vertical_gradient),u_height_factor:new l.aI(v,o.u_height_factor),u_image:new l.aH(v,o.u_image),u_texsize:new l.aO(v,o.u_texsize),u_pixel_coord_upper:new l.aO(v,o.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,o.u_pixel_coord_lower),u_scale:new l.aN(v,o.u_scale),u_fade:new l.aI(v,o.u_fade),u_opacity:new l.aI(v,o.u_opacity)}),fill:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix)}),fillPattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_image:new l.aH(v,o.u_image),u_texsize:new l.aO(v,o.u_texsize),u_pixel_coord_upper:new l.aO(v,o.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,o.u_pixel_coord_lower),u_scale:new l.aN(v,o.u_scale),u_fade:new l.aI(v,o.u_fade)}),fillOutline:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_world:new l.aO(v,o.u_world)}),fillOutlinePattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_world:new l.aO(v,o.u_world),u_image:new l.aH(v,o.u_image),u_texsize:new l.aO(v,o.u_texsize),u_pixel_coord_upper:new l.aO(v,o.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,o.u_pixel_coord_lower),u_scale:new l.aN(v,o.u_scale),u_fade:new l.aI(v,o.u_fade)}),circle:(v,o)=>({u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_scale_with_map:new l.aH(v,o.u_scale_with_map),u_pitch_with_map:new l.aH(v,o.u_pitch_with_map),u_extrude_scale:new l.aO(v,o.u_extrude_scale),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_matrix:new l.aJ(v,o.u_matrix)}),collisionBox:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_pixel_extrude_scale:new l.aO(v,o.u_pixel_extrude_scale)}),collisionCircle:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_inv_matrix:new l.aJ(v,o.u_inv_matrix),u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_viewport_size:new l.aO(v,o.u_viewport_size)}),debug:(v,o)=>({u_color:new l.aL(v,o.u_color),u_matrix:new l.aJ(v,o.u_matrix),u_overlay:new l.aH(v,o.u_overlay),u_overlay_scale:new l.aI(v,o.u_overlay_scale)}),clippingMask:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix)}),heatmap:(v,o)=>({u_extrude_scale:new l.aI(v,o.u_extrude_scale),u_intensity:new l.aI(v,o.u_intensity),u_matrix:new l.aJ(v,o.u_matrix)}),heatmapTexture:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_world:new l.aO(v,o.u_world),u_image:new l.aH(v,o.u_image),u_color_ramp:new l.aH(v,o.u_color_ramp),u_opacity:new l.aI(v,o.u_opacity)}),hillshade:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_image:new l.aH(v,o.u_image),u_latrange:new l.aO(v,o.u_latrange),u_light:new l.aO(v,o.u_light),u_shadow:new l.aL(v,o.u_shadow),u_highlight:new l.aL(v,o.u_highlight),u_accent:new l.aL(v,o.u_accent)}),hillshadePrepare:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_image:new l.aH(v,o.u_image),u_dimension:new l.aO(v,o.u_dimension),u_zoom:new l.aI(v,o.u_zoom),u_unpack:new l.aK(v,o.u_unpack)}),line:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_ratio:new l.aI(v,o.u_ratio),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_units_to_pixels:new l.aO(v,o.u_units_to_pixels)}),lineGradient:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_ratio:new l.aI(v,o.u_ratio),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_units_to_pixels:new l.aO(v,o.u_units_to_pixels),u_image:new l.aH(v,o.u_image),u_image_height:new l.aI(v,o.u_image_height)}),linePattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_texsize:new l.aO(v,o.u_texsize),u_ratio:new l.aI(v,o.u_ratio),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_image:new l.aH(v,o.u_image),u_units_to_pixels:new l.aO(v,o.u_units_to_pixels),u_scale:new l.aN(v,o.u_scale),u_fade:new l.aI(v,o.u_fade)}),lineSDF:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_ratio:new l.aI(v,o.u_ratio),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_units_to_pixels:new l.aO(v,o.u_units_to_pixels),u_patternscale_a:new l.aO(v,o.u_patternscale_a),u_patternscale_b:new l.aO(v,o.u_patternscale_b),u_sdfgamma:new l.aI(v,o.u_sdfgamma),u_image:new l.aH(v,o.u_image),u_tex_y_a:new l.aI(v,o.u_tex_y_a),u_tex_y_b:new l.aI(v,o.u_tex_y_b),u_mix:new l.aI(v,o.u_mix)}),raster:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_tl_parent:new l.aO(v,o.u_tl_parent),u_scale_parent:new l.aI(v,o.u_scale_parent),u_buffer_scale:new l.aI(v,o.u_buffer_scale),u_fade_t:new l.aI(v,o.u_fade_t),u_opacity:new l.aI(v,o.u_opacity),u_image0:new l.aH(v,o.u_image0),u_image1:new l.aH(v,o.u_image1),u_brightness_low:new l.aI(v,o.u_brightness_low),u_brightness_high:new l.aI(v,o.u_brightness_high),u_saturation_factor:new l.aI(v,o.u_saturation_factor),u_contrast_factor:new l.aI(v,o.u_contrast_factor),u_spin_weights:new l.aN(v,o.u_spin_weights)}),symbolIcon:(v,o)=>({u_is_size_zoom_constant:new l.aH(v,o.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(v,o.u_is_size_feature_constant),u_size_t:new l.aI(v,o.u_size_t),u_size:new l.aI(v,o.u_size),u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_pitch:new l.aI(v,o.u_pitch),u_rotate_symbol:new l.aH(v,o.u_rotate_symbol),u_aspect_ratio:new l.aI(v,o.u_aspect_ratio),u_fade_change:new l.aI(v,o.u_fade_change),u_matrix:new l.aJ(v,o.u_matrix),u_label_plane_matrix:new l.aJ(v,o.u_label_plane_matrix),u_coord_matrix:new l.aJ(v,o.u_coord_matrix),u_is_text:new l.aH(v,o.u_is_text),u_pitch_with_map:new l.aH(v,o.u_pitch_with_map),u_is_along_line:new l.aH(v,o.u_is_along_line),u_is_variable_anchor:new l.aH(v,o.u_is_variable_anchor),u_texsize:new l.aO(v,o.u_texsize),u_texture:new l.aH(v,o.u_texture),u_translation:new l.aO(v,o.u_translation),u_pitched_scale:new l.aI(v,o.u_pitched_scale)}),symbolSDF:(v,o)=>({u_is_size_zoom_constant:new l.aH(v,o.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(v,o.u_is_size_feature_constant),u_size_t:new l.aI(v,o.u_size_t),u_size:new l.aI(v,o.u_size),u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_pitch:new l.aI(v,o.u_pitch),u_rotate_symbol:new l.aH(v,o.u_rotate_symbol),u_aspect_ratio:new l.aI(v,o.u_aspect_ratio),u_fade_change:new l.aI(v,o.u_fade_change),u_matrix:new l.aJ(v,o.u_matrix),u_label_plane_matrix:new l.aJ(v,o.u_label_plane_matrix),u_coord_matrix:new l.aJ(v,o.u_coord_matrix),u_is_text:new l.aH(v,o.u_is_text),u_pitch_with_map:new l.aH(v,o.u_pitch_with_map),u_is_along_line:new l.aH(v,o.u_is_along_line),u_is_variable_anchor:new l.aH(v,o.u_is_variable_anchor),u_texsize:new l.aO(v,o.u_texsize),u_texture:new l.aH(v,o.u_texture),u_gamma_scale:new l.aI(v,o.u_gamma_scale),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_is_halo:new l.aH(v,o.u_is_halo),u_translation:new l.aO(v,o.u_translation),u_pitched_scale:new l.aI(v,o.u_pitched_scale)}),symbolTextAndIcon:(v,o)=>({u_is_size_zoom_constant:new l.aH(v,o.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(v,o.u_is_size_feature_constant),u_size_t:new l.aI(v,o.u_size_t),u_size:new l.aI(v,o.u_size),u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_pitch:new l.aI(v,o.u_pitch),u_rotate_symbol:new l.aH(v,o.u_rotate_symbol),u_aspect_ratio:new l.aI(v,o.u_aspect_ratio),u_fade_change:new l.aI(v,o.u_fade_change),u_matrix:new l.aJ(v,o.u_matrix),u_label_plane_matrix:new l.aJ(v,o.u_label_plane_matrix),u_coord_matrix:new l.aJ(v,o.u_coord_matrix),u_is_text:new l.aH(v,o.u_is_text),u_pitch_with_map:new l.aH(v,o.u_pitch_with_map),u_is_along_line:new l.aH(v,o.u_is_along_line),u_is_variable_anchor:new l.aH(v,o.u_is_variable_anchor),u_texsize:new l.aO(v,o.u_texsize),u_texsize_icon:new l.aO(v,o.u_texsize_icon),u_texture:new l.aH(v,o.u_texture),u_texture_icon:new l.aH(v,o.u_texture_icon),u_gamma_scale:new l.aI(v,o.u_gamma_scale),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_is_halo:new l.aH(v,o.u_is_halo),u_translation:new l.aO(v,o.u_translation),u_pitched_scale:new l.aI(v,o.u_pitched_scale)}),background:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_opacity:new l.aI(v,o.u_opacity),u_color:new l.aL(v,o.u_color)}),backgroundPattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_opacity:new l.aI(v,o.u_opacity),u_image:new l.aH(v,o.u_image),u_pattern_tl_a:new l.aO(v,o.u_pattern_tl_a),u_pattern_br_a:new l.aO(v,o.u_pattern_br_a),u_pattern_tl_b:new l.aO(v,o.u_pattern_tl_b),u_pattern_br_b:new l.aO(v,o.u_pattern_br_b),u_texsize:new l.aO(v,o.u_texsize),u_mix:new l.aI(v,o.u_mix),u_pattern_size_a:new l.aO(v,o.u_pattern_size_a),u_pattern_size_b:new l.aO(v,o.u_pattern_size_b),u_scale_a:new l.aI(v,o.u_scale_a),u_scale_b:new l.aI(v,o.u_scale_b),u_pixel_coord_upper:new l.aO(v,o.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,o.u_pixel_coord_lower),u_tile_units_to_pixels:new l.aI(v,o.u_tile_units_to_pixels)}),terrain:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_texture:new l.aH(v,o.u_texture),u_ele_delta:new l.aI(v,o.u_ele_delta),u_fog_matrix:new l.aJ(v,o.u_fog_matrix),u_fog_color:new l.aL(v,o.u_fog_color),u_fog_ground_blend:new l.aI(v,o.u_fog_ground_blend),u_fog_ground_blend_opacity:new l.aI(v,o.u_fog_ground_blend_opacity),u_horizon_color:new l.aL(v,o.u_horizon_color),u_horizon_fog_blend:new l.aI(v,o.u_horizon_fog_blend)}),terrainDepth:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_ele_delta:new l.aI(v,o.u_ele_delta)}),terrainCoords:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_texture:new l.aH(v,o.u_texture),u_terrain_coords_id:new l.aI(v,o.u_terrain_coords_id),u_ele_delta:new l.aI(v,o.u_ele_delta)}),sky:(v,o)=>({u_sky_color:new l.aL(v,o.u_sky_color),u_horizon_color:new l.aL(v,o.u_horizon_color),u_horizon:new l.aI(v,o.u_horizon),u_sky_horizon_blend:new l.aI(v,o.u_sky_horizon_blend)})};class Mo{constructor(o,d,m){this.context=o;const y=o.gl;this.buffer=y.createBuffer(),this.dynamicDraw=!!m,this.context.unbindVAO(),o.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(o){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,o.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const c_={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class od{constructor(o,d,m,y){this.length=d.length,this.attributes=m,this.itemSize=d.bytesPerElement,this.dynamicDraw=y,this.context=o;const x=o.gl;this.buffer=x.createBuffer(),o.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(o){if(o.length!==this.length)throw new Error(`Length of new data is ${o.length}, which doesn't match current length of ${this.length}`);const d=this.context.gl;this.bind(),d.bufferSubData(d.ARRAY_BUFFER,0,o.arrayBuffer)}enableAttributes(o,d){for(let m=0;m<this.attributes.length;m++){const y=d.attributes[this.attributes[m].name];y!==void 0&&o.enableVertexAttribArray(y)}}setVertexAttribPointers(o,d,m){for(let y=0;y<this.attributes.length;y++){const x=this.attributes[y],M=d.attributes[x.name];M!==void 0&&o.vertexAttribPointer(M,x.components,o[c_[x.type]],!1,this.itemSize,x.offset+this.itemSize*(m||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Us=new WeakMap;function ps(v){var o;if(Us.has(v))return Us.get(v);{const d=(o=v.getParameter(v.VERSION))===null||o===void 0?void 0:o.startsWith("WebGL 2.0");return Us.set(v,d),d}}class _n{constructor(o){this.gl=o.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(o){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class cu extends _n{getDefault(){return l.aM.transparent}set(o){const d=this.current;(o.r!==d.r||o.g!==d.g||o.b!==d.b||o.a!==d.a||this.dirty)&&(this.gl.clearColor(o.r,o.g,o.b,o.a),this.current=o,this.dirty=!1)}}class u_ extends _n{getDefault(){return 1}set(o){(o!==this.current||this.dirty)&&(this.gl.clearDepth(o),this.current=o,this.dirty=!1)}}class Oa extends _n{getDefault(){return 0}set(o){(o!==this.current||this.dirty)&&(this.gl.clearStencil(o),this.current=o,this.dirty=!1)}}class h_ extends _n{getDefault(){return[!0,!0,!0,!0]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||o[2]!==d[2]||o[3]!==d[3]||this.dirty)&&(this.gl.colorMask(o[0],o[1],o[2],o[3]),this.current=o,this.dirty=!1)}}class rm extends _n{getDefault(){return!0}set(o){(o!==this.current||this.dirty)&&(this.gl.depthMask(o),this.current=o,this.dirty=!1)}}class d_ extends _n{getDefault(){return 255}set(o){(o!==this.current||this.dirty)&&(this.gl.stencilMask(o),this.current=o,this.dirty=!1)}}class om extends _n{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(o){const d=this.current;(o.func!==d.func||o.ref!==d.ref||o.mask!==d.mask||this.dirty)&&(this.gl.stencilFunc(o.func,o.ref,o.mask),this.current=o,this.dirty=!1)}}class sd extends _n{getDefault(){const o=this.gl;return[o.KEEP,o.KEEP,o.KEEP]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||o[2]!==d[2]||this.dirty)&&(this.gl.stencilOp(o[0],o[1],o[2]),this.current=o,this.dirty=!1)}}class sm extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;o?d.enable(d.STENCIL_TEST):d.disable(d.STENCIL_TEST),this.current=o,this.dirty=!1}}class am extends _n{getDefault(){return[0,1]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||this.dirty)&&(this.gl.depthRange(o[0],o[1]),this.current=o,this.dirty=!1)}}class lm extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;o?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),this.current=o,this.dirty=!1}}class cm extends _n{getDefault(){return this.gl.LESS}set(o){(o!==this.current||this.dirty)&&(this.gl.depthFunc(o),this.current=o,this.dirty=!1)}}class Hs extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;o?d.enable(d.BLEND):d.disable(d.BLEND),this.current=o,this.dirty=!1}}class um extends _n{getDefault(){const o=this.gl;return[o.ONE,o.ZERO]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||this.dirty)&&(this.gl.blendFunc(o[0],o[1]),this.current=o,this.dirty=!1)}}class p_ extends _n{getDefault(){return l.aM.transparent}set(o){const d=this.current;(o.r!==d.r||o.g!==d.g||o.b!==d.b||o.a!==d.a||this.dirty)&&(this.gl.blendColor(o.r,o.g,o.b,o.a),this.current=o,this.dirty=!1)}}class hm extends _n{getDefault(){return this.gl.FUNC_ADD}set(o){(o!==this.current||this.dirty)&&(this.gl.blendEquation(o),this.current=o,this.dirty=!1)}}class jl extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;o?d.enable(d.CULL_FACE):d.disable(d.CULL_FACE),this.current=o,this.dirty=!1}}class f_ extends _n{getDefault(){return this.gl.BACK}set(o){(o!==this.current||this.dirty)&&(this.gl.cullFace(o),this.current=o,this.dirty=!1)}}class uu extends _n{getDefault(){return this.gl.CCW}set(o){(o!==this.current||this.dirty)&&(this.gl.frontFace(o),this.current=o,this.dirty=!1)}}class m_ extends _n{getDefault(){return null}set(o){(o!==this.current||this.dirty)&&(this.gl.useProgram(o),this.current=o,this.dirty=!1)}}class g_ extends _n{getDefault(){return this.gl.TEXTURE0}set(o){(o!==this.current||this.dirty)&&(this.gl.activeTexture(o),this.current=o,this.dirty=!1)}}class dm extends _n{getDefault(){const o=this.gl;return[0,0,o.drawingBufferWidth,o.drawingBufferHeight]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||o[2]!==d[2]||o[3]!==d[3]||this.dirty)&&(this.gl.viewport(o[0],o[1],o[2],o[3]),this.current=o,this.dirty=!1)}}class pm extends _n{getDefault(){return null}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.bindFramebuffer(d.FRAMEBUFFER,o),this.current=o,this.dirty=!1}}class fm extends _n{getDefault(){return null}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.bindRenderbuffer(d.RENDERBUFFER,o),this.current=o,this.dirty=!1}}class ad extends _n{getDefault(){return null}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.bindTexture(d.TEXTURE_2D,o),this.current=o,this.dirty=!1}}class mm extends _n{getDefault(){return null}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.bindBuffer(d.ARRAY_BUFFER,o),this.current=o,this.dirty=!1}}class hu extends _n{getDefault(){return null}set(o){const d=this.gl;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o),this.current=o,this.dirty=!1}}class Ho extends _n{getDefault(){return null}set(o){var d;if(o===this.current&&!this.dirty)return;const m=this.gl;ps(m)?m.bindVertexArray(o):(d=m.getExtension("OES_vertex_array_object"))===null||d===void 0||d.bindVertexArrayOES(o),this.current=o,this.dirty=!1}}class ld extends _n{getDefault(){return 4}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_ALIGNMENT,o),this.current=o,this.dirty=!1}}class cd extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o),this.current=o,this.dirty=!1}}class ud extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL,o),this.current=o,this.dirty=!1}}class du extends _n{constructor(o,d){super(o),this.context=o,this.parent=d}getDefault(){return null}}class hd extends du{setDirty(){this.dirty=!0}set(o){if(o===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,o,0),this.current=o,this.dirty=!1}}class qs extends du{set(o){if(o===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,o),this.current=o,this.dirty=!1}}class dd extends du{set(o){if(o===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,o),this.current=o,this.dirty=!1}}class y_{constructor(o,d,m,y,x){this.context=o,this.width=d,this.height=m;const M=o.gl,P=this.framebuffer=M.createFramebuffer();if(this.colorAttachment=new hd(o,P),y)this.depthAttachment=x?new dd(o,P):new qs(o,P);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 o=this.context.gl,d=this.colorAttachment.get();if(d&&o.deleteTexture(d),this.depthAttachment){const m=this.depthAttachment.get();m&&o.deleteRenderbuffer(m)}o.deleteFramebuffer(this.framebuffer)}}class Jn{constructor(o,d,m){this.blendFunction=o,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 __{constructor(o){var d,m;if(this.gl=o,this.clearColor=new cu(this),this.clearDepth=new u_(this),this.clearStencil=new Oa(this),this.colorMask=new h_(this),this.depthMask=new rm(this),this.stencilMask=new d_(this),this.stencilFunc=new om(this),this.stencilOp=new sd(this),this.stencilTest=new sm(this),this.depthRange=new am(this),this.depthTest=new lm(this),this.depthFunc=new cm(this),this.blend=new Hs(this),this.blendFunc=new um(this),this.blendColor=new p_(this),this.blendEquation=new hm(this),this.cullFace=new jl(this),this.cullFaceSide=new f_(this),this.frontFace=new uu(this),this.program=new m_(this),this.activeTexture=new g_(this),this.viewport=new dm(this),this.bindFramebuffer=new pm(this),this.bindRenderbuffer=new fm(this),this.bindTexture=new ad(this),this.bindVertexBuffer=new mm(this),this.bindElementBuffer=new hu(this),this.bindVertexArray=new Ho(this),this.pixelStoreUnpack=new ld(this),this.pixelStoreUnpackPremultiplyAlpha=new cd(this),this.pixelStoreUnpackFlipY=new ud(this),this.extTextureFilterAnisotropic=o.getExtension("EXT_texture_filter_anisotropic")||o.getExtension("MOZ_EXT_texture_filter_anisotropic")||o.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=o.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=o.getParameter(o.MAX_TEXTURE_SIZE),ps(o)){this.HALF_FLOAT=o.HALF_FLOAT;const y=o.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(d=o.RGBA16F)!==null&&d!==void 0?d:y==null?void 0:y.RGBA16F_EXT,this.RGB16F=(m=o.RGB16F)!==null&&m!==void 0?m:y==null?void 0:y.RGB16F_EXT,o.getExtension("EXT_color_buffer_float")}else{o.getExtension("EXT_color_buffer_half_float"),o.getExtension("OES_texture_half_float_linear");const y=o.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(o,d){return new Mo(this,o,d)}createVertexBuffer(o,d,m){return new od(this,o,d,m)}createRenderbuffer(o,d,m){const y=this.gl,x=y.createRenderbuffer();return this.bindRenderbuffer.set(x),y.renderbufferStorage(y.RENDERBUFFER,o,d,m),this.bindRenderbuffer.set(null),x}createFramebuffer(o,d,m,y){return new y_(this,o,d,m,y)}clear({color:o,depth:d,stencil:m}){const y=this.gl;let x=0;o&&(x|=y.COLOR_BUFFER_BIT,this.clearColor.set(o),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(o){o.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(o.mode),this.frontFace.set(o.frontFace))}setDepthMode(o){o.func!==this.gl.ALWAYS||o.mask?(this.depthTest.set(!0),this.depthFunc.set(o.func),this.depthMask.set(o.mask),this.depthRange.set(o.range)):this.depthTest.set(!1)}setStencilMode(o){o.test.func!==this.gl.ALWAYS||o.mask?(this.stencilTest.set(!0),this.stencilMask.set(o.mask),this.stencilOp.set([o.fail,o.depthFail,o.pass]),this.stencilFunc.set({func:o.test.func,ref:o.ref,mask:o.test.mask})):this.stencilTest.set(!1)}setColorMode(o){l.aE(o.blendFunction,Jn.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(o.blendFunction),this.blendColor.set(o.blendColor)),this.colorMask.set(o.mask)}createVertexArray(){var o;return ps(this.gl)?this.gl.createVertexArray():(o=this.gl.getExtension("OES_vertex_array_object"))===null||o===void 0?void 0:o.createVertexArrayOES()}deleteVertexArray(o){var d;return ps(this.gl)?this.gl.deleteVertexArray(o):(d=this.gl.getExtension("OES_vertex_array_object"))===null||d===void 0?void 0:d.deleteVertexArrayOES(o)}unbindVAO(){this.bindVertexArray.set(null)}}class Ht{constructor(o,d,m){this.func=o,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(o,d,m,y,x,M){this.test=o,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(o,d,m){this.enable=o,this.mode=d,this.frontFace=m}}let Ws;function Ul(v,o,d,m,y){const x=v.context,M=x.gl,P=v.useProgram("collisionBox"),O=[];let N=0,V=0;for(let ce=0;ce<m.length;ce++){const he=m[ce],te=o.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&&P.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 Z=v.useProgram("collisionCircle"),J=new l.aR;J.resize(4*N),J._trim();let ee=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],Be=ce.circleArray[te+3];J.emplace(ee++,me,ge,ve,Be,0),J.emplace(ee++,me,ge,ve,Be,1),J.emplace(ee++,me,ge,ve,Be,2),J.emplace(ee++,me,ge,ve,Be,3)}(!Ws||Ws.length<2*N)&&(Ws=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(Ws,!0),le=x.createVertexBuffer(J,l.aS.members,!0);for(const ce of O){const he=js(ce.transform,ce.invTransform,v.transform);Z.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,le,re,l.a0.simpleSegment(0,2*ce.circleOffset,ce.circleArray.length,ce.circleArray.length/2),null,v.transform.zoom,null,null,null)}le.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,o,d,m,y,x){const{horizontalAlign:M,verticalAlign:P}=l.au(v);return new l.P((-(M-.5)*o/y+m[0])*x,(-(P-.5)*d/y+m[1])*x)}function Gs(v,o,d,m,y,x){const M=o.tileAnchorPoint.add(new l.P(o.translation[0],o.translation[1]));if(o.pitchWithMap){let P=m.mult(x);d||(P=P.rotate(-y));const O=M.add(P);return oe(O.x,O.y,o.labelPlaneMatrix,o.getElevation).point}if(d){const P=Ae(o.tileAnchorPoint.x+1,o.tileAnchorPoint.y,o).point.sub(v),O=Math.atan(P.y/P.x)+(P.x<0?Math.PI:0);return v.add(m.rotate(O))}return v.add(m)}function Ba(v,o,d,m,y,x,M,P,O,N,V,F,Z,J){const ee=v.text.placedSymbolArray,re=v.text.dynamicLayoutVertexArray,le=v.icon.dynamicLayoutVertexArray,ce={};re.clear();for(let he=0;he<ee.length;he++){const te=ee.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:J,width:y.width,height:y.height,labelPlaneMatrix:x,lineVertexArray:null,pitchWithMap:d,projection:V,projectionCache:null,tileAnchorPoint:ge,translation:F,unwrappedTileID:Z},Be=d?oe(ge.x,ge.y,M,J):Ae(ge.x,ge.y,ve),Fe=H(y.cameraToCenterDistance,Be.signedDistanceFromCamera);let Qe=l.ai(v.textSizeData,O,te)*Fe/l.ap;d&&(Qe*=v.tilePixelRatio/P);const{width:st,height:Ye,anchor:Ge,textOffset:mt,textBoxScale:Ot}=me,Xe=pd(Ge,st,Ye,mt,Ot,Qe),nt=V.getPitchedTextCorrection(y,ge.add(new l.P(F[0],F[1])),Z),Pt=Gs(Be.point,ve,o,Xe,y.angle,nt),Fn=v.allowVerticalPlacement&&te.placedOrientation===l.ah.vertical?Math.PI/2:0;for(let Lt=0;Lt<te.numGlyphs;Lt++)l.aj(re,Pt,Fn);N&&te.associatedIconIndex>=0&&(ce[te.associatedIconIndex]={shiftedAnchor:Pt,angle:Fn})}else kt(te.numGlyphs,re)}if(N){le.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,le);else{const ge=ce[te];if(ge)for(let ve=0;ve<me.numGlyphs;ve++)l.aj(le,ge.shiftedAnchor,ge.angle);else kt(me.numGlyphs,le)}}v.icon.dynamicLayoutVertexBuffer.updateData(le)}v.text.dynamicLayoutVertexBuffer.updateData(re)}function Rr(v,o,d){return d.iconsInText&&o?"symbolTextAndIcon":v?"symbolSDF":"symbolIcon"}function fd(v,o,d,m,y,x,M,P,O,N,V,F){const Z=v.context,J=Z.gl,ee=v.transform,re=Fs(),le=P==="map",ce=O==="map",he=P!=="viewport"&&d.layout.get("symbol-placement")!=="point",te=le&&!ce&&!he,me=!ce&&he,ge=!d.layout.get("symbol-sort-key").isConstant();let ve=!1;const Be=v.depthModeForSublayer(0,Ht.ReadOnly),Fe=d._unevaluatedLayout.hasValue("text-variable-anchor")||d._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Qe=[],st=re.getCircleRadiusCorrection(ee);for(const Ye of m){const Ge=o.getTile(Ye),mt=Ge.getBucket(d);if(!mt)continue;const Ot=y?mt.text:mt.icon;if(!Ot||!Ot.segments.get().length||!Ot.hasVisibleVertices)continue;const Xe=Ot.programConfigurations.get(d.id),nt=y||mt.sdfIcons,Pt=y?mt.textSizeData:mt.iconSizeData,Fn=ce||ee.pitch!==0,Lt=v.useProgram(Rr(nt,y,mt),Xe),Yt=l.ag(Pt,ee.zoom),$n=v.style.map.terrain&&v.style.map.terrain.getTerrainData(Ye);let Oi,no,jn,rr,Gi=[0,0],Bi=null;if(y)no=Ge.glyphAtlasTexture,jn=J.LINEAR,Oi=Ge.glyphAtlasTexture.size,mt.iconsInText&&(Gi=Ge.imageAtlasTexture.size,Bi=Ge.imageAtlasTexture,rr=Fn||v.options.rotating||v.options.zooming||Pt.kind==="composite"||Pt.kind==="camera"?J.LINEAR:J.NEAREST);else{const en=d.layout.get("icon-size").constantOr(0)!==1||mt.iconsNeedLinear;no=Ge.imageAtlasTexture,jn=nt||v.options.rotating||v.options.zooming||en||Fn?J.LINEAR:J.NEAREST,Oi=Ge.imageAtlasTexture.size}const Zi=Zt(Ge,1,v.transform.zoom),Po=me?Ye.posMatrix:Hl,Xa=qi(Po,ce,le,v.transform,Zi),Du=fr(Po,ce,le,v.transform,Zi),Ka=fr(Ye.posMatrix,ce,le,v.transform,Zi),Fr=re.translatePosition(v.transform,Ge,x,M),Ou=Fe&&mt.hasTextData(),Vd=d.layout.get("icon-text-fit")!=="none"&&Ou&&mt.hasIconData();if(he){const en=v.style.map.terrain?(Ja,Qa)=>v.style.map.terrain.getElevation(Ye,Ja,Qa):null,Js=d.layout.get("text-rotation-alignment")==="map";X(mt,Ye.posMatrix,v,y,Xa,Ka,ce,N,Js,re,Ye.toUnwrapped(),ee.width,ee.height,Fr,en)}const $r=Ye.posMatrix,jr=y&&Fe||Vd,fs=he||jr?Hl:Xa,io=Du,Si=nt&&d.paint.get(y?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let zi;zi=nt?mt.iconsInText?nd(Pt.kind,Yt,te,ce,he,jr,v,$r,fs,io,Fr,Oi,Gi,st):$l(Pt.kind,Yt,te,ce,he,jr,v,$r,fs,io,Fr,y,Oi,!0,st):im(Pt.kind,Yt,te,ce,he,jr,v,$r,fs,io,Fr,y,Oi,st);const xr={program:Lt,buffers:Ot,uniformValues:zi,atlasTexture:no,atlasTextureIcon:Bi,atlasInterpolation:jn,atlasInterpolationIcon:rr,isSDF:nt,hasHalo:Si};if(ge&&mt.canOverlap){ve=!0;const en=Ot.segments.get();for(const Js of en)Qe.push({segments:new l.a0([Js]),sortKey:Js.sortKey,state:xr,terrainData:$n})}else Qe.push({segments:Ot.segments,sortKey:0,state:xr,terrainData:$n})}ve&&Qe.sort((Ye,Ge)=>Ye.sortKey-Ge.sortKey);for(const Ye of Qe){const Ge=Ye.state;if(Z.activeTexture.set(J.TEXTURE0),Ge.atlasTexture.bind(Ge.atlasInterpolation,J.CLAMP_TO_EDGE),Ge.atlasTextureIcon&&(Z.activeTexture.set(J.TEXTURE1),Ge.atlasTextureIcon&&Ge.atlasTextureIcon.bind(Ge.atlasInterpolationIcon,J.CLAMP_TO_EDGE)),Ge.isSDF){const mt=Ge.uniformValues;Ge.hasHalo&&(mt.u_is_halo=1,md(Ge.buffers,Ye.segments,d,v,Ge.program,Be,V,F,mt,Ye.terrainData)),mt.u_is_halo=0}md(Ge.buffers,Ye.segments,d,v,Ge.program,Be,V,F,Ge.uniformValues,Ye.terrainData)}}function md(v,o,d,m,y,x,M,P,O,N){const V=m.context;y.draw(V,V.gl.TRIANGLES,x,M,P,Tn.disabled,O,N,d.id,v.layoutVertexBuffer,v.indexBuffer,o,d.paint,m.transform.zoom,v.programConfigurations.get(d.id),v.dynamicLayoutVertexBuffer,v.opacityVertexBuffer)}function gd(v,o,d,m){const y=v.context,x=y.gl,M=On.disabled,P=new Jn([x.ONE,x.ONE],l.aM.transparent,[!0,!0,!0,!0]),O=o.getBucket(d);if(!O)return;const N=m.key;let V=d.heatmapFbos.get(N);V||(V=ql(y,o.tileSize,o.tileSize),d.heatmapFbos.set(N,V)),y.bindFramebuffer.set(V.framebuffer),y.viewport.set([0,0,o.tileSize,o.tileSize]),y.clear({color:l.aM.transparent});const F=O.programConfigurations.get(d.id),Z=v.useProgram("heatmap",F),J=v.style.map.terrain.getTerrainData(m);Z.draw(y,x.TRIANGLES,Ht.disabled,M,P,Tn.disabled,ir(m.posMatrix,o,v.transform.zoom,d.paint.get("heatmap-intensity")),J,d.id,O.layoutVertexBuffer,O.indexBuffer,O.segments,d.paint,v.transform.zoom,F)}function Zs(v,o,d){const m=v.context,y=m.gl;m.setColorMode(v.colorModeForRenderPass());const x=Wl(m,o),M=d.key,P=o.heatmapFbos.get(M);P&&(m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,P.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,ou(v,o,0,1),null,o.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments,o.paint,v.transform.zoom),P.destroy(),o.heatmapFbos.delete(M))}function ql(v,o,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 P=(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,o,d,0,x.RGBA,P,null);const N=v.createFramebuffer(o,d,!1,!1);return N.colorAttachment.set(M),N}function Wl(v,o){return o.colorRampTexture||(o.colorRampTexture=new Je(v,o.colorRamp,v.gl.RGBA)),o.colorRampTexture}function za(v,o,d,m,y){if(!d||!m||!m.imageAtlas)return;const x=m.imageAtlas.patternPositions;let M=x[d.to.toString()],P=x[d.from.toString()];if(!M&&P&&(M=P),!P&&M&&(P=M),!M||!P){const O=y.getPaintProperty(o);M=x[O],P=x[O]}M&&P&&v.setConstantPatternPositions(M,P)}function Gl(v,o,d,m,y,x,M){const P=v.context.gl,O="fill-pattern",N=d.paint.get(O),V=N&&N.constantOr(1),F=d.getCrossfadeParameters();let Z,J,ee,re,le;M?(J=V&&!d.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Z=P.LINES):(J=V?"fillPattern":"fill",Z=P.TRIANGLES);const ce=N.constantOr(null);for(const he of m){const te=o.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(J,ge),Be=v.style.map.terrain&&v.style.map.terrain.getTerrainData(he);V&&(v.context.activeTexture.set(P.TEXTURE0),te.imageAtlasTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),ge.updatePaintBuffers(F)),za(ge,O,ce,te,d);const Fe=Be?he:null,Qe=v.translatePosMatrix(Fe?Fe.posMatrix:he.posMatrix,te,d.paint.get("fill-translate"),d.paint.get("fill-translate-anchor"));if(M){re=me.indexBuffer2,le=me.segments2;const st=[P.drawingBufferWidth,P.drawingBufferHeight];ee=J==="fillOutlinePattern"&&V?Qf(Qe,v,F,te,st):r_(Qe,st)}else re=me.indexBuffer,le=me.segments,ee=V?Jf(Qe,v,F,te):Pa(Qe);ve.draw(v.context,Z,y,v.stencilModeForClipping(he),x,Tn.disabled,ee,Be,d.id,me.layoutVertexBuffer,re,le,d.paint,v.transform.zoom,ge)}}function fu(v,o,d,m,y,x,M){const P=v.context,O=P.gl,N="fill-extrusion-pattern",V=d.paint.get(N),F=V.constantOr(1),Z=d.getCrossfadeParameters(),J=d.paint.get("fill-extrusion-opacity"),ee=V.constantOr(null);for(const re of m){const le=o.getTile(re),ce=le.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),le.imageAtlasTexture.bind(O.LINEAR,O.CLAMP_TO_EDGE),te.updatePaintBuffers(Z)),za(te,N,ee,le,d);const ge=v.translatePosMatrix(re.posMatrix,le,d.paint.get("fill-extrusion-translate"),d.paint.get("fill-extrusion-translate-anchor")),ve=d.paint.get("fill-extrusion-vertical-gradient"),Be=F?ru(ge,v,ve,J,re,Z,le):Vl(ge,v,ve,J);me.draw(P,P.gl.TRIANGLES,y,x,M,Tn.backCCW,Be,he,d.id,ce.layoutVertexBuffer,ce.indexBuffer,ce.segments,d.paint,v.transform.zoom,te,v.style.map.terrain&&ce.centroidVertexBuffer)}}function Na(v,o,d,m,y,x,M){const P=v.context,O=P.gl,N=d.fbo;if(!N)return;const V=v.useProgram("hillshade"),F=v.style.map.terrain&&v.style.map.terrain.getTerrainData(o);P.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,N.colorAttachment.get()),V.draw(P,O.TRIANGLES,y,x,M,Tn.disabled,((Z,J,ee,re)=>{const le=ee.paint.get("hillshade-shadow-color"),ce=ee.paint.get("hillshade-highlight-color"),he=ee.paint.get("hillshade-accent-color");let te=ee.paint.get("hillshade-illumination-direction")*(Math.PI/180);ee.paint.get("hillshade-illumination-anchor")==="viewport"&&(te-=Z.transform.angle);const me=!Z.options.moving;return{u_matrix:re?re.posMatrix:Z.transform.calculatePosMatrix(J.tileID.toUnwrapped(),me),u_image:0,u_latrange:su(0,J.tileID),u_light:[ee.paint.get("hillshade-exaggeration"),te],u_shadow:le,u_highlight:ce,u_accent:he}})(v,d,m,F?o:null),F,m.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments)}function Ra(v,o,d,m,y,x){const M=v.context,P=M.gl,O=o.dem;if(O&&O.data){const N=O.dim,V=O.stride,F=O.getPixels();if(M.activeTexture.set(P.TEXTURE1),M.pixelStoreUnpackPremultiplyAlpha.set(!1),o.demTexture=o.demTexture||v.getTileTexture(V),o.demTexture){const J=o.demTexture;J.update(F,{premultiply:!1}),J.bind(P.NEAREST,P.CLAMP_TO_EDGE)}else o.demTexture=new Je(M,F,P.RGBA,{premultiply:!1}),o.demTexture.bind(P.NEAREST,P.CLAMP_TO_EDGE);M.activeTexture.set(P.TEXTURE0);let Z=o.fbo;if(!Z){const J=new Je(M,{width:N,height:N,data:null},P.RGBA);J.bind(P.LINEAR,P.CLAMP_TO_EDGE),Z=o.fbo=M.createFramebuffer(N,N,!0,!1),Z.colorAttachment.set(J.texture)}M.bindFramebuffer.set(Z.framebuffer),M.viewport.set([0,0,N,N]),v.useProgram("hillshadePrepare").draw(M,P.TRIANGLES,m,y,x,Tn.disabled,((J,ee)=>{const re=ee.stride,le=l.H();return l.aP(le,0,l.X,-l.X,0,0,1),l.J(le,le,[0,-l.X,0]),{u_matrix:le,u_image:1,u_dimension:[re,re],u_zoom:J.overscaledZ,u_unpack:ee.getUnpackVector()}})(o.tileID,O),null,d.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments),o.needsHillshadePrepare=!1}}function gm(v,o,d,m,y,x){const M=m.paint.get("raster-fade-duration");if(!x&&M>0){const P=E.now(),O=(P-v.timeAdded)/M,N=o?(P-o.timeAdded)/M:-1,V=d.getSource(),F=y.coveringZoomLevel({tileSize:V.tileSize,roundZoom:V.roundZoom}),Z=!o||Math.abs(o.tileID.overscaledZ-F)>Math.abs(v.tileID.overscaledZ-F),J=Z&&v.refreshedUponExpiration?1:l.ac(Z?O:1-N,0,1);return v.refreshedUponExpiration&&O>=1&&(v.refreshedUponExpiration=!1),o?{opacity:1,mix:1-J}:{opacity:J,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),b_=new l.aM(1,0,1,1),ym=new l.aM(0,1,1,1);function La(v,o,d,m){gu(v,0,o+d/2,v.transform.width,d,m)}function _m(v,o,d,m){gu(v,o-d/2,0,d,v.transform.height,m)}function gu(v,o,d,m,y,x){const M=v.context,P=M.gl;P.enable(P.SCISSOR_TEST),P.scissor(o*v.pixelRatio,d*v.pixelRatio,m*v.pixelRatio,y*v.pixelRatio),M.clear({color:x}),P.disable(P.SCISSOR_TEST)}function bm(v,o,d){const m=v.context,y=m.gl,x=d.posMatrix,M=v.useProgram("debug"),P=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 Z=o.getTileByID(d.key).latestRawTileData,J=Math.floor((Z&&Z.byteLength||0)/1024),ee=o.getTile(d).tileSize,re=512/Math.min(ee,512)*(d.overscaledZ/v.transform.zoom)*.5;let le=d.canonical.toString();d.overscaledZ!==d.canonical.z&&(le+=` => ${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,`${le} ${J}kB`),M.draw(m,y.TRIANGLES,P,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,P,O,N,Tn.disabled,Fl(x,l.aM.red),F,V,v.debugBuffer,v.tileBorderIndexBuffer,v.debugSegments)}function xm(v,o,d){const m=v.context,y=m.gl,x=v.colorModeForRenderPass(),M=new Ht(y.LEQUAL,Ht.ReadWrite,v.depthRangeFor3D),P=v.useProgram("terrain"),O=o.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=o.getTerrainData(N.tileID);m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,V.texture);const Z=v.transform.calculatePosMatrix(N.tileID.toUnwrapped()),J=o.getMeshFrameDelta(v.transform.zoom),ee=v.transform.calculateFogMatrix(N.tileID.toUnwrapped()),re=ed(Z,J,ee,v.style.sky,v.transform.pitch);P.draw(m,y.TRIANGLES,M,On.disabled,x,Tn.backCCW,re,F,"terrain",O.vertexBuffer,O.indexBuffer,O.segments)}}class yu{constructor(o,d,m){this.vertexBuffer=o,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(o,d){this.context=new __(o),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(o,d,m){if(this.width=Math.floor(o*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 o=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=o.createVertexBuffer(d,$s.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=o.createVertexBuffer(m,$s.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=o.createVertexBuffer(y,Hi.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=o.createVertexBuffer(x,$s.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=o.createIndexBuffer(M);const P=new l.aY;P.emplaceBack(0,1,2),P.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=o.createIndexBuffer(P);const O=this.context.gl;this.stencilClearMode=new On({func:O.ALWAYS,mask:0},0,255,O.ZERO,O.ZERO,O.ZERO)}clearStencil(){const o=this.context,d=o.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(o,d.TRIANGLES,Ht.disabled,this.stencilClearMode,Jn.disabled,Tn.disabled,nr(m),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(o,d){if(this.currentStencilSource===o.source||!o.isTileClipped()||!d||!d.length)return;this.currentStencilSource=o.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 P=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},P,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 o=this.nextStencilID++,d=this.context.gl;return new On({func:d.NOTEQUAL,mask:255},o,255,d.KEEP,d.KEEP,d.REPLACE)}stencilModeForClipping(o){const d=this.context.gl;return new On({func:d.EQUAL,mask:255},this._tileClippingMaskIDs[o.key],0,d.KEEP,d.KEEP,d.REPLACE)}stencilConfigForOverlap(o){const d=this.context.gl,m=o.sort((M,P)=>P.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 P=0;P<x;P++)M[P+y]=new On({func:d.GEQUAL,mask:255},P+this.nextStencilID,255,d.KEEP,d.KEEP,d.REPLACE);return this.nextStencilID+=x,[M,m]}return[{[y]:On.disabled},m]}colorModeForRenderPass(){const o=this.context.gl;return this._showOverdrawInspector?new Jn([o.CONSTANT_COLOR,o.ONE],new l.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Jn.unblended:Jn.alphaBlended}depthModeForSublayer(o,d,m){if(!this.opaquePassEnabledForLayer())return Ht.disabled;const y=1-((1+this.currentLayer)*this.numSublayers+o)*this.depthEpsilon;return new Ht(m||this.context.gl.LEQUAL,d,[y,y])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(o,d){this.style=o,this.options=d,this.lineAtlas=o.lineAtlas,this.imageManager=o.imageManager,this.glyphManager=o.glyphManager,this.symbolFadeChange=o.placement.symbolFadeChange(E.now()),this.imageManager.beginFrame();const m=this.style._order,y=this.style.sourceCaches,x={},M={},P={};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(),P[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,Z=((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),J=new Ht(F.LEQUAL,Ht.ReadWrite,[0,1]),ee=On.disabled,re=O.colorModeForRenderPass(),le=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,$s.members),V.createIndexBuffer(he),l.a0.simpleSegment(0,0,ce.length,he.length))}le.draw(V,F.TRIANGLES,J,ee,re,Tn.disabled,Z,void 0,"sky",N.mesh.vertexBuffer,N.mesh.indexBuffer,N.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=d.showOverdrawInspector,this.depthRangeFor3D=[0,1-(o._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"?P: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 Z=Object.values(N._layers).flatMap(le=>le.source&&!le.isHidden(V)?[N.sourceCaches[le.source]]:[]),J=Z.filter(le=>le.getSource().type==="vector"),ee=Z.filter(le=>le.getSource().type!=="vector"),re=le=>{(!F||F.getSource().maxzoom<le.getSource().maxzoom)&&(F=le)};return J.forEach(le=>re(le)),F||ee.forEach(le=>re(le)),F}(this.style,this.transform.zoom);O&&function(N,V,F){for(let Z=0;Z<F.length;Z++)bm(N,V,F[Z])}(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),_m(O,N.left||0,3,mu),_m(O,O.transform.width-(N.right||0),3,b_);const V=O.transform.centerPoint;(function(F,Z,J,ee){gu(F,Z-1,J-10,2,20,ee),gu(F,Z-10,J-1,20,2,ee)})(O,V.x,O.transform.height-V.y,ym)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(o){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=o?!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 P=x.context,O=P.gl,N=Jn.unblended,V=new Ht(O.LEQUAL,Ht.ReadWrite,[0,1]),F=M.getTerrainMesh(),Z=M.sourceCache.getRenderableTiles(),J=x.useProgram("terrainDepth");P.bindFramebuffer.set(M.getFramebuffer("depth").framebuffer),P.viewport.set([0,0,x.width/devicePixelRatio,x.height/devicePixelRatio]),P.clear({color:l.aM.transparent,depth:1});for(const ee of Z){const re=M.getTerrainData(ee.tileID),le={u_matrix:x.transform.calculatePosMatrix(ee.tileID.toUnwrapped()),u_ele_delta:M.getMeshFrameDelta(x.transform.zoom)};J.draw(P,O.TRIANGLES,V,On.disabled,N,Tn.backCCW,le,re,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}P.bindFramebuffer.set(null),P.viewport.set([0,0,x.width,x.height])}(this,this.style.map.terrain),function(x,M){const P=x.context,O=P.gl,N=Jn.unblended,V=new Ht(O.LEQUAL,Ht.ReadWrite,[0,1]),F=M.getTerrainMesh(),Z=M.getCoordsTexture(),J=M.sourceCache.getRenderableTiles(),ee=x.useProgram("terrainCoords");P.bindFramebuffer.set(M.getFramebuffer("coords").framebuffer),P.viewport.set([0,0,x.width/devicePixelRatio,x.height/devicePixelRatio]),P.clear({color:l.aM.transparent,depth:1}),M.coordsIndex=[];for(const re of J){const le=M.getTerrainData(re.tileID);P.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,Z.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)};ee.draw(P,O.TRIANGLES,V,On.disabled,N,Tn.backCCW,ce,le,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),M.coordsIndex.push(re.tileID.key)}P.bindFramebuffer.set(null),P.viewport.set([0,0,x.width,x.height])}(this,this.style.map.terrain))}renderLayer(o,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,P,O,N){if(x.renderPass!=="translucent")return;const V=On.disabled,F=x.colorModeForRenderPass();(P._unevaluatedLayout.hasValue("text-variable-anchor")||P._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(Z,J,ee,re,le,ce,he,te,me){const ge=J.transform,ve=Fs(),Be=le==="map",Fe=ce==="map";for(const Qe of Z){const st=re.getTile(Qe),Ye=st.getBucket(ee);if(!Ye||!Ye.text||!Ye.text.segments.get().length)continue;const Ge=l.ag(Ye.textSizeData,ge.zoom),mt=Zt(st,1,J.transform.zoom),Ot=qi(Qe.posMatrix,Fe,Be,J.transform,mt),Xe=ee.layout.get("icon-text-fit")!=="none"&&Ye.hasIconData();if(Ge){const nt=Math.pow(2,ge.zoom-st.tileID.overscaledZ),Pt=J.style.map.terrain?(Lt,Yt)=>J.style.map.terrain.getElevation(Qe,Lt,Yt):null,Fn=ve.translatePosition(ge,st,he,te);Ba(Ye,Be,Fe,me,ge,Ot,Qe.posMatrix,nt,Ge,Xe,ve,Fn,Qe.toUnwrapped(),Pt)}}}(O,x,P,M,P.layout.get("text-rotation-alignment"),P.layout.get("text-pitch-alignment"),P.paint.get("text-translate"),P.paint.get("text-translate-anchor"),N),P.paint.get("icon-opacity").constantOr(1)!==0&&fd(x,M,P,O,!1,P.paint.get("icon-translate"),P.paint.get("icon-translate-anchor"),P.layout.get("icon-rotation-alignment"),P.layout.get("icon-pitch-alignment"),P.layout.get("icon-keep-upright"),V,F),P.paint.get("text-opacity").constantOr(1)!==0&&fd(x,M,P,O,!0,P.paint.get("text-translate"),P.paint.get("text-translate-anchor"),P.layout.get("text-rotation-alignment"),P.layout.get("text-pitch-alignment"),P.layout.get("text-keep-upright"),V,F),M.map.showCollisionBoxes&&(Ul(x,M,P,O,!0),Ul(x,M,P,O,!1))})(o,d,m,y,this.style.placement.variableOffsets);break;case"circle":(function(x,M,P,O){if(x.renderPass!=="translucent")return;const N=P.paint.get("circle-opacity"),V=P.paint.get("circle-stroke-width"),F=P.paint.get("circle-stroke-opacity"),Z=!P.layout.get("circle-sort-key").isConstant();if(N.constantOr(1)===0&&(V.constantOr(1)===0||F.constantOr(1)===0))return;const J=x.context,ee=J.gl,re=x.depthModeForSublayer(0,Ht.ReadOnly),le=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(P);if(!ve)continue;const Be=ve.programConfigurations.get(P.id),Fe=x.useProgram("circle",Be),Qe=ve.layoutVertexBuffer,st=ve.indexBuffer,Ye=x.style.map.terrain&&x.style.map.terrain.getTerrainData(me),Ge={programConfiguration:Be,program:Fe,layoutVertexBuffer:Qe,indexBuffer:st,uniformValues:o_(x,me,ge,P),terrainData:Ye};if(Z){const mt=ve.segments.get();for(const Ot of mt)he.push({segments:new l.a0([Ot]),sortKey:Ot.sortKey,state:Ge})}else he.push({segments:ve.segments,sortKey:0,state:Ge})}Z&&he.sort((te,me)=>te.sortKey-me.sortKey);for(const te of he){const{programConfiguration:me,program:ge,layoutVertexBuffer:ve,indexBuffer:Be,uniformValues:Fe,terrainData:Qe}=te.state;ge.draw(J,ee.TRIANGLES,re,le,ce,Tn.disabled,Fe,Qe,P.id,ve,Be,te.segments,P.paint,x.transform.zoom,me)}})(o,d,m,y);break;case"heatmap":(function(x,M,P,O){if(P.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,P,V):x.renderPass==="translucent"&&Zs(x,P,V))}N.viewport.set([0,0,x.width,x.height])}else x.renderPass==="offscreen"?function(V,F,Z,J){const ee=V.context,re=ee.gl,le=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))})(ee,V,Z),ee.clear({color:l.aM.transparent});for(let he=0;he<J.length;he++){const te=J[he];if(F.hasRenderableParent(te))continue;const me=F.getTile(te),ge=me.getBucket(Z);if(!ge)continue;const ve=ge.programConfigurations.get(Z.id),Be=V.useProgram("heatmap",ve),{zoom:Fe}=V.transform;Be.draw(ee,re.TRIANGLES,Ht.disabled,le,ce,Tn.disabled,ir(te.posMatrix,me,Fe,Z.paint.get("heatmap-intensity")),null,Z.id,ge.layoutVertexBuffer,ge.indexBuffer,ge.segments,Z.paint,V.transform.zoom,ve)}ee.viewport.set([0,0,V.width,V.height])}(x,M,P,O):x.renderPass==="translucent"&&function(V,F){const Z=V.context,J=Z.gl;Z.setColorMode(V.colorModeForRenderPass());const ee=F.heatmapFbos.get(l.aU);ee&&(Z.activeTexture.set(J.TEXTURE0),J.bindTexture(J.TEXTURE_2D,ee.colorAttachment.get()),Z.activeTexture.set(J.TEXTURE1),Wl(Z,F).bind(J.LINEAR,J.CLAMP_TO_EDGE),V.useProgram("heatmapTexture").draw(Z,J.TRIANGLES,Ht.disabled,On.disabled,V.colorModeForRenderPass(),Tn.disabled,ou(V,F,0,1),null,F.id,V.viewportBuffer,V.quadTriangleIndexBuffer,V.viewportSegments,F.paint,V.transform.zoom))}(x,P)})(o,d,m,y);break;case"line":(function(x,M,P,O){if(x.renderPass!=="translucent")return;const N=P.paint.get("line-opacity"),V=P.paint.get("line-width");if(N.constantOr(1)===0||V.constantOr(1)===0)return;const F=x.depthModeForSublayer(0,Ht.ReadOnly),Z=x.colorModeForRenderPass(),J=P.paint.get("line-dasharray"),ee=P.paint.get("line-pattern"),re=ee.constantOr(1),le=P.paint.get("line-gradient"),ce=P.getCrossfadeParameters(),he=re?"linePattern":J?"lineSDF":le?"lineGradient":"line",te=x.context,me=te.gl;let ge=!0;for(const ve of O){const Be=M.getTile(ve);if(re&&!Be.patternsLoaded())continue;const Fe=Be.getBucket(P);if(!Fe)continue;const Qe=Fe.programConfigurations.get(P.id),st=x.context.program.get(),Ye=x.useProgram(he,Qe),Ge=ge||Ye.program!==st,mt=x.style.map.terrain&&x.style.map.terrain.getTerrainData(ve),Ot=ee.constantOr(null);if(Ot&&Be.imageAtlas){const Pt=Be.imageAtlas,Fn=Pt.patternPositions[Ot.to.toString()],Lt=Pt.patternPositions[Ot.from.toString()];Fn&&Lt&&Qe.setConstantPatternPositions(Fn,Lt)}const Xe=mt?ve:null,nt=re?Da(x,Be,P,ce,Xe):J?s_(x,Be,P,J,ce,Xe):le?em(x,Be,P,Fe.lineClipsArray.length,Xe):au(x,Be,P,Xe);if(re)te.activeTexture.set(me.TEXTURE0),Be.imageAtlasTexture.bind(me.LINEAR,me.CLAMP_TO_EDGE),Qe.updatePaintBuffers(ce);else if(J&&(Ge||x.lineAtlas.dirty))te.activeTexture.set(me.TEXTURE0),x.lineAtlas.bind(te);else if(le){const Pt=Fe.gradients[P.id];let Fn=Pt.texture;if(P.gradientVersion!==Pt.version){let Lt=256;if(P.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(Fe.maxLineLength/l.X*1024*$n),256,te.maxTextureSize)}Pt.gradient=l.aW({expression:P.gradientExpression(),evaluationKey:"lineProgress",resolution:Lt,image:Pt.gradient||void 0,clips:Fe.lineClipsArray}),Pt.texture?Pt.texture.update(Pt.gradient):Pt.texture=new Je(te,Pt.gradient,me.RGBA),Pt.version=P.gradientVersion,Fn=Pt.texture}te.activeTexture.set(me.TEXTURE0),Fn.bind(P.stepInterpolant?me.NEAREST:me.LINEAR,me.CLAMP_TO_EDGE)}Ye.draw(te,me.TRIANGLES,F,x.stencilModeForClipping(ve),Z,Tn.disabled,nt,mt,P.id,Fe.layoutVertexBuffer,Fe.indexBuffer,Fe.segments,P.paint,x.transform.zoom,Qe,Fe.layoutVertexBuffer2),ge=!1}})(o,d,m,y);break;case"fill":(function(x,M,P,O){const N=P.paint.get("fill-color"),V=P.paint.get("fill-opacity");if(V.constantOr(1)===0)return;const F=x.colorModeForRenderPass(),Z=P.paint.get("fill-pattern"),J=x.opaquePassEnabledForLayer()&&!Z.constantOr(1)&&N.constantOr(l.aM.transparent).a===1&&V.constantOr(0)===1?"opaque":"translucent";if(x.renderPass===J){const ee=x.depthModeForSublayer(1,x.renderPass==="opaque"?Ht.ReadWrite:Ht.ReadOnly);Gl(x,M,P,O,ee,F,!1)}if(x.renderPass==="translucent"&&P.paint.get("fill-antialias")){const ee=x.depthModeForSublayer(P.getPaintProperty("fill-outline-color")?2:0,Ht.ReadOnly);Gl(x,M,P,O,ee,F,!0)}})(o,d,m,y);break;case"fill-extrusion":(function(x,M,P,O){const N=P.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||P.paint.get("fill-extrusion-pattern").constantOr(1))fu(x,M,P,O,V,On.disabled,Jn.disabled),fu(x,M,P,O,V,x.stencilModeFor3D(),x.colorModeForRenderPass());else{const F=x.colorModeForRenderPass();fu(x,M,P,O,V,On.disabled,F)}}})(o,d,m,y);break;case"hillshade":(function(x,M,P,O){if(x.renderPass!=="offscreen"&&x.renderPass!=="translucent")return;const N=x.context,V=x.depthModeForSublayer(0,Ht.ReadOnly),F=x.colorModeForRenderPass(),[Z,J]=x.renderPass==="translucent"?x.stencilConfigForOverlap(O):[{},O];for(const ee of J){const re=M.getTile(ee);re.needsHillshadePrepare!==void 0&&re.needsHillshadePrepare&&x.renderPass==="offscreen"?Ra(x,re,P,V,On.disabled,F):x.renderPass==="translucent"&&Na(x,ee,re,P,V,Z[ee.overscaledZ],F)}N.viewport.set([0,0,x.width,x.height])})(o,d,m,y);break;case"raster":(function(x,M,P,O){if(x.renderPass!=="translucent"||P.paint.get("raster-opacity")===0||!O.length)return;const N=x.context,V=N.gl,F=M.getSource(),Z=x.useProgram("raster"),J=x.colorModeForRenderPass(),[ee,re]=F instanceof xi?[{},O]:x.stencilConfigForOverlap(O),le=re[re.length-1].overscaledZ,ce=!x.options.moving;for(const he of re){const te=x.depthModeForSublayer(he.overscaledZ-le,P.paint.get("raster-opacity")===1?Ht.ReadWrite:Ht.ReadOnly,V.LESS),me=M.getTile(he);me.registerFadeDuration(P.paint.get("raster-fade-duration"));const ge=M.findLoadedParent(he,0),ve=M.findLoadedSibling(he),Be=gm(me,ge||ve||null,M,P,x.transform,x.style.map.terrain);let Fe,Qe;const st=P.paint.get("raster-resampling")==="nearest"?V.NEAREST:V.LINEAR;N.activeTexture.set(V.TEXTURE0),me.texture.bind(st,V.CLAMP_TO_EDGE,V.LINEAR_MIPMAP_NEAREST),N.activeTexture.set(V.TEXTURE1),ge?(ge.texture.bind(st,V.CLAMP_TO_EDGE,V.LINEAR_MIPMAP_NEAREST),Fe=Math.pow(2,ge.tileID.overscaledZ-me.tileID.overscaledZ),Qe=[me.tileID.canonical.x*Fe%1,me.tileID.canonical.y*Fe%1]):me.texture.bind(st,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 Ye=x.style.map.terrain&&x.style.map.terrain.getTerrainData(he),Ge=Ye?he:null,mt=Ge?Ge.posMatrix:x.transform.calculatePosMatrix(he.toUnwrapped(),ce),Ot=a_(mt,Qe||[0,0],Fe||1,Be,P);F instanceof xi?Z.draw(N,V.TRIANGLES,te,On.disabled,J,Tn.disabled,Ot,Ye,P.id,F.boundsBuffer,x.quadTriangleIndexBuffer,F.boundsSegments):Z.draw(N,V.TRIANGLES,te,ee[he.overscaledZ],J,Tn.disabled,Ot,Ye,P.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments)}})(o,d,m,y);break;case"background":(function(x,M,P,O){const N=P.paint.get("background-color"),V=P.paint.get("background-opacity");if(V===0)return;const F=x.context,Z=F.gl,J=x.transform,ee=J.tileSize,re=P.paint.get("background-pattern");if(x.isPatternMissing(re))return;const le=!re&&N.a===1&&V===1&&x.opaquePassEnabledForLayer()?"opaque":"translucent";if(x.renderPass!==le)return;const ce=On.disabled,he=x.depthModeForSublayer(0,le==="opaque"?Ht.ReadWrite:Ht.ReadOnly),te=x.colorModeForRenderPass(),me=x.useProgram(re?"backgroundPattern":"background"),ge=O||J.coveringTiles({tileSize:ee,terrain:x.style.map.terrain});re&&(F.activeTexture.set(Z.TEXTURE0),x.imageManager.bind(x.context));const ve=P.getCrossfadeParameters();for(const Be of ge){const Fe=O?Be.posMatrix:x.transform.calculatePosMatrix(Be.toUnwrapped()),Qe=re?id(Fe,V,x,re,{tileID:Be,tileSize:ee},ve):lu(Fe,V,N),st=x.style.map.terrain&&x.style.map.terrain.getTerrainData(Be);me.draw(F,Z.TRIANGLES,he,ce,te,Tn.disabled,Qe,st,P.id,x.tileExtentBuffer,x.quadTriangleIndexBuffer,x.tileExtentSegments)}})(o,0,m,y);break;case"custom":(function(x,M,P){const O=x.context,N=P.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)}})(o,0,m)}}translatePosMatrix(o,d,m,y,x){if(!m[0]&&!m[1])return o;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 P=[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,o,P),O}saveTileTexture(o){const d=this._tileTextures[o.size[0]];d?d.push(o):this._tileTextures[o.size[0]]=[o]}getTileTexture(o){const d=this._tileTextures[o];return d&&d.length>0?d.pop():null}isPatternMissing(o){if(!o)return!1;if(!o.from||!o.to)return!0;const d=this.imageManager.getPattern(o.from.toString()),m=this.imageManager.getPattern(o.to.toString());return!d||!m}useProgram(o,d){this.cache=this.cache||{};const m=o+(d?d.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[m]||(this.cache[m]=new td(this.context,ds[o],d,rd[o],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 o=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(o.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Je(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:o,drawingBufferHeight:d}=this.context.gl;return this.width!==o||this.height!==d}}class Va{constructor(o,d){this.points=o,this.planes=d}static fromInvProjectionMatrix(o,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(P=>{const O=1/(P=l.af([],P,o))[3]/d*y;return l.b1(P,P,[O,O,1/P[3],O])}),M=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(P=>{const O=function(Z,J){var ee=J[0],re=J[1],le=J[2],ce=ee*ee+re*re+le*le;return ce>0&&(ce=1/Math.sqrt(ce)),Z[0]=J[0]*ce,Z[1]=J[1]*ce,Z[2]=J[2]*ce,Z}([],function(Z,J,ee){var re=J[0],le=J[1],ce=J[2],he=ee[0],te=ee[1],me=ee[2];return Z[0]=le*me-ce*te,Z[1]=ce*he-re*me,Z[2]=re*te-le*he,Z}([],Ce([],x[P[0]],x[P[1]]),Ce([],x[P[2]],x[P[1]]))),N=-((V=O)[0]*(F=x[P[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(o,d){this.min=o,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(o){const d=[o%2==0,o<2],m=Se(this.min),y=Se(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(o){return Math.max(Math.min(this.max[0],o[0]),this.min[0])-o[0]}distanceY(o){return Math.max(Math.min(this.max[1],o[1]),this.min[1])-o[1]}intersects(o){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<o.planes.length;y++){const x=o.planes[y];let M=0;for(let P=0;P<d.length;P++)l.b2(x,d[P])>=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 P=0;P<o.points.length;P++){const O=o.points[P][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(o=0,d=0,m=0,y=0){if(isNaN(o)||o<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=o,this.bottom=d,this.left=m,this.right=y}interpolate(o,d,m){return d.top!=null&&o.top!=null&&(this.top=l.y.number(o.top,d.top,m)),d.bottom!=null&&o.bottom!=null&&(this.bottom=l.y.number(o.bottom,d.bottom,m)),d.left!=null&&o.left!=null&&(this.left=l.y.number(o.left,d.left,m)),d.right!=null&&o.right!=null&&(this.right=l.y.number(o.right,d.right,m)),this}getCenter(o,d){const m=l.ac((this.left+o-this.right)/2,0,o),y=l.ac((this.top+d-this.bottom)/2,0,d);return new l.P(m,y)}equals(o){return this.top===o.top&&this.bottom===o.bottom&&this.left===o.left&&this.right===o.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(o,d,m,y,x){this.tileSize=512,this._renderWorldCopies=x===void 0||!!x,this._minZoom=o||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 o=new ja(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return o.apply(this),o}apply(o){this.tileSize=o.tileSize,this.latRange=o.latRange,this.lngRange=o.lngRange,this.width=o.width,this.height=o.height,this._center=o._center,this._elevation=o._elevation,this.minElevationForCurrentTile=o.minElevationForCurrentTile,this.zoom=o.zoom,this.angle=o.angle,this._fov=o._fov,this._pitch=o._pitch,this._unmodified=o._unmodified,this._edgeInsets=o._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(o){this._minZoom!==o&&(this._minZoom=o,this.zoom=Math.max(this.zoom,o))}get maxZoom(){return this._maxZoom}set maxZoom(o){this._maxZoom!==o&&(this._maxZoom=o,this.zoom=Math.min(this.zoom,o))}get minPitch(){return this._minPitch}set minPitch(o){this._minPitch!==o&&(this._minPitch=o,this.pitch=Math.max(this.pitch,o))}get maxPitch(){return this._maxPitch}set maxPitch(o){this._maxPitch!==o&&(this._maxPitch=o,this.pitch=Math.min(this.pitch,o))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(o){o===void 0?o=!0:o===null&&(o=!1),this._renderWorldCopies=o}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(o){const d=-l.b3(o,-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],P=y[1],O=y[2],N=y[3],V=Math.sin(x),F=Math.cos(x);m[0]=M*F+O*V,m[1]=P*F+N*V,m[2]=M*-V+O*F,m[3]=P*-V+N*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(o){const d=l.ac(o,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(o){o=Math.max(.01,Math.min(60,o)),this._fov!==o&&(this._unmodified=!1,this._fov=o/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(o){const d=Math.min(Math.max(o,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(o){o.lat===this._center.lat&&o.lng===this._center.lng||(this._unmodified=!1,this._center=o,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(o){o!==this._elevation&&(this._elevation=o,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(o){this._edgeInsets.equals(o)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,o,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(o){return this._edgeInsets.equals(o)}interpolatePadding(o,d,m){this._unmodified=!1,this._edgeInsets.interpolate(o,d,m),this._constrain(),this._calcMatrices()}coveringZoomLevel(o){const d=(o.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/o.tileSize));return Math.max(0,d)}getVisibleUnwrappedCoordinates(o){const d=[new l.b4(0,o)];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)),P=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=P-N;V<=O+N;V++)V!==0&&d.push(new l.b4(V,o))}return d}coveringTiles(o){var d,m;let y=this.coveringZoomLevel(o);const x=y;if(o.minzoom!==void 0&&y<o.minzoom)return[];o.maxzoom!==void 0&&y>o.maxzoom&&(y=o.maxzoom);const M=this.pointCoordinate(this.getCameraPoint()),P=l.Z.fromLngLat(this.center),O=Math.pow(2,y),N=[O*M.x,O*M.y,0],V=[O*P.x,O*P.y,0],F=Va.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,y);let Z=o.minzoom||0;!o.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(Z=y);const J=o.terrain?2/Math.min(this.tileSize,o.tileSize)*this.tileSize:3,ee=te=>({aabb:new Fa([te*O,0,0],[(te+1)*O,O,0]),zoom:0,x:0,y:0,wrap:te,fullyVisible:!1}),re=[],le=[],ce=y,he=o.reparseOverscaled?x:y;if(this._renderWorldCopies)for(let te=1;te<=3;te++)re.push(ee(-te)),re.push(ee(te));for(re.push(ee(0));re.length>0;){const te=re.pop(),me=te.x,ge=te.y;let ve=te.fullyVisible;if(!ve){const Ye=te.aabb.intersects(F);if(Ye===0)continue;ve=Ye===2}const Be=o.terrain?N:V,Fe=te.aabb.distanceX(Be),Qe=te.aabb.distanceY(Be),st=Math.max(Math.abs(Fe),Math.abs(Qe));if(te.zoom===ce||st>J+(1<<ce-te.zoom)-2&&te.zoom>=Z){const Ye=ce-te.zoom,Ge=N[0]-.5-(me<<Ye),mt=N[1]-.5-(ge<<Ye);le.push({tileID:new l.S(te.zoom===ce?he:te.zoom,te.wrap,te.zoom,me,ge),distanceSq:Le([V[0]-.5-me,V[1]-.5-ge]),tileDistanceToCamera:Math.sqrt(Ge*Ge+mt*mt)})}else for(let Ye=0;Ye<4;Ye++){const Ge=(me<<1)+Ye%2,mt=(ge<<1)+(Ye>>1),Ot=te.zoom+1;let Xe=te.aabb.quadrant(Ye);if(o.terrain){const nt=new l.S(Ot,te.wrap,Ot,Ge,mt),Pt=o.terrain.getMinMaxElevation(nt),Fn=(d=Pt.minElevation)!==null&&d!==void 0?d:this.elevation,Lt=(m=Pt.maxElevation)!==null&&m!==void 0?m:this.elevation;Xe=new Fa([Xe.min[0],Xe.min[1],Fn],[Xe.max[0],Xe.max[1],Lt])}re.push({aabb:Xe,zoom:Ot,x:Ge,y:mt,wrap:te.wrap,fullyVisible:ve})}}return le.sort((te,me)=>te.distanceSq-me.distanceSq).map(te=>te.tileID)}resize(o,d){this.width=o,this.height=d,this.pixelsToGLUnits=[2/o,-2/d],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(o){return Math.pow(2,o)}scaleZoom(o){return Math.log(o)/Math.LN2}project(o){const d=l.ac(o.lat,-85.051129,_d);return new l.P(l.O(o.lng)*this.worldSize,l.Q(d)*this.worldSize)}unproject(o){return new l.Z(o.x/this.worldSize,o.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(o){const d=this.elevation,m=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,y=this.pointLocation(this.centerPoint,o),x=o.getElevationForLngLatZoom(y,this.tileZoom);if(!(this.elevation-x))return;const M=m+d-x,P=Math.cos(this._pitch)*this.cameraToCenterDistance/M/l.b5(1,y.lat),O=this.scaleZoom(P/this.tileSize);this._elevation=x,this._center=y,this.zoom=O}setLocationAtPoint(o,d){const m=this.pointCoordinate(d),y=this.pointCoordinate(this.centerPoint),x=this.locationCoordinate(o),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(o,d){return d?this.coordinatePoint(this.locationCoordinate(o),d.getElevationForLngLatZoom(o,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(o))}pointLocation(o,d){return this.coordinateLocation(this.pointCoordinate(o,d))}locationCoordinate(o){return l.Z.fromLngLat(o)}coordinateLocation(o){return o&&o.toLngLat()}pointCoordinate(o,d){if(d){const Z=d.pointCoordinate(o);if(Z!=null)return Z}const m=[o.x,o.y,0,1],y=[o.x,o.y,1,1];l.af(m,m,this.pixelMatrixInverse),l.af(y,y,this.pixelMatrixInverse);const x=m[3],M=y[3],P=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(P,O,F)/this.worldSize)}coordinatePoint(o,d=0,m=this.pixelMatrix){const y=[o.x*this.worldSize,o.y*this.worldSize,d,1];return l.af(y,y,m),new l.P(y[0]/y[3],y[1]/y[3])}getBounds(){const o=Math.max(0,this.height/2-this.getHorizon());return new we().extend(this.pointLocation(new l.P(0,o))).extend(this.pointLocation(new l.P(this.width,o))).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(o){o?(this.lngRange=[o.getWest(),o.getEast()],this.latRange=[o.getSouth(),o.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,_d])}calculateTileMatrix(o){const d=o.canonical,m=this.worldSize/this.zoomScale(d.z),y=d.x+Math.pow(2,d.z)*o.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(o,d=!1){const m=o.key,y=d?this._alignedPosMatrixCache:this._posMatrixCache;if(y[m])return y[m];const x=this.calculateTileMatrix(o);return l.L(x,d?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,x),y[m]=new Float32Array(x),y[m]}calculateFogMatrix(o){const d=o.key,m=this._fogMatrixCache;if(m[d])return m[d];const y=this.calculateTileMatrix(o);return l.L(y,this.fogMatrix,y),m[d]=new Float32Array(y),m[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(o,d){d=l.ac(+d,this.minZoom,this.maxZoom);const m={center:new l.N(o.lng,o.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,P=x,O=0,N=x,V=0,F=0;const{x:Z,y:J}=this.size;if(this.latRange){const te=this.latRange;M=l.Q(te[1])*x,P=l.Q(te[0])*x,P-M<J&&(V=J/(P-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<Z&&(F=Z/(N-O)));const{x:ee,y:re}=this.project.call({worldSize:x},o);let le,ce;const he=Math.max(F||0,V||0);if(he){const te=new l.P(F?(N+O)/2:ee,V?(P+M)/2:re);return m.center=this.unproject.call({worldSize:x},te).wrap(),m.zoom+=this.scaleZoom(he),m}if(this.latRange){const te=J/2;re-te<M&&(ce=M+te),re+te>P&&(ce=P-te)}if(y){const te=(O+N)/2;let me=ee;this._renderWorldCopies&&(me=l.b3(ee,te-x/2,te+x/2));const ge=Z/2;me-ge<O&&(le=O+ge),me+ge>N&&(le=N-ge)}if(le!==void 0||ce!==void 0){const te=new l.P(le??ee,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 o=this._unmodified,{center:d,zoom:m}=this.getConstrained(this.center,this.zoom);this.center=d,this.zoom=m,this._unmodified=o,this._constraining=!1}_calcMatrices(){if(!this.height)return;const o=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),P=x-M*this._pixelPerMeter/Math.cos(this._pitch),O=M<0?P:x,N=Math.PI/2+this._pitch,V=this._fov*(.5+o.y/this.height),F=Math.sin(V)*O/Math.sin(l.ac(Math.PI-N-V,.01,Math.PI-.01)),Z=this.getHorizon(),J=2*Math.atan(Z/this.cameraToCenterDistance)*(.5+o.y/(2*Z)),ee=Math.sin(J)*O/Math.sin(l.ac(Math.PI-N-J,.01,Math.PI-.01)),re=Math.min(F,ee);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*-o.x/this.width,y[9]=2*o.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*-o.x/this.width,this.fogMatrix[9]=2*o.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 le=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*le+te*ce,ge=m-Math.round(m)+he*ce+te*le,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 o=this.pointCoordinate(new l.P(0,0)),d=[o.x*this.worldSize,o.y*this.worldSize,0,1];return l.af(d,d,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const o=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.P(0,o))}getCameraQueryGeometry(o){const d=this.getCameraPoint();if(o.length===1)return[o[0],d];{let m=d.x,y=d.y,x=d.x,M=d.y;for(const P of o)m=Math.min(m,P.x),y=Math.min(y,P.y),x=Math.max(x,P.x),M=Math.max(M,P.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(o,d){const m=this.locationCoordinate(o),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,o){let d,m=!1,y=null,x=null;const M=()=>{y=null,m&&(v.apply(x,d),y=setTimeout(M,o),m=!1)};return(...P)=>(m=!0,x=this,d=P,y||M(),y)}class bu{constructor(o){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=o&&encodeURIComponent(o)}addTo(o){return this._map=o,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(o){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,P=Math.round(d.lat*x)/x,O=this._map.getBearing(),N=this._map.getPitch();let V="";if(V+=o?`/${M}/${P}/${m}`:`${m}/${P}/${M}`,(O||N)&&(V+="/"+Math.round(10*O)/10),N&&(V+=`/${Math.round(N)}`),this._hashName){const F=this._hashName;let Z=!1;const J=window.location.hash.slice(1).split("&").map(ee=>{const re=ee.split("=")[0];return re===F?(Z=!0,`${re}=${V}`):ee}).filter(ee=>ee);return Z||J.push(`${F}=${V}`),`#${J.join("&")}`}return`#${V}`}}const xu={linearity:.3,easing:l.b8(0,0,.3,1)},bd=l.e({deceleration:2500,maxSpeed:1400},xu),x_=l.e({deceleration:20,maxSpeed:1400},xu),vm=l.e({deceleration:1e3,maxSpeed:360},xu),vu=l.e({deceleration:1e3,maxSpeed:90},xu);class xd{constructor(o){this._map=o,this.clear()}clear(){this._inertiaBuffer=[]}record(o){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:E.now(),settings:o})}_drainInertiaBuffer(){const o=this._inertiaBuffer,d=E.now();for(;o.length>0&&d-o[0].time>160;)o.shift()}_onMoveEnd(o){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,o||{}));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,x_);y.zoom=this._map.transform.zoom+x.amount,Yl(y,x)}if(d.bearing){const x=Xl(d.bearing,m,vm);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,o){(!v.duration||v.duration<o.duration)&&(v.duration=o.duration,v.easing=o.easing)}function Xl(v,o,d){const{maxSpeed:m,linearity:y,deceleration:x}=d,M=l.ac(v*y/(o/1e3),-m,m),P=Math.abs(M)/(x*y);return{easing:d.easing,duration:1e3*P,amount:M*(P/2)}}class Di extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(o,d,m,y={}){const x=C.mousePos(d.getCanvas(),m),M=d.unproject(x);super(o,l.e({point:x,lngLat:M,originalEvent:m},y)),this._defaultPrevented=!1,this.target=d}}class Ys extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(o,d,m){const y=o==="touchend"?m.changedTouches:m.touches,x=C.touchPos(d.getCanvasContainer(),y),M=x.map(O=>d.unproject(O)),P=x.reduce((O,N,V,F)=>O.add(N.div(F.length)),new l.P(0,0));super(o,{points:x,point:P,lngLats:M,lngLat:d.unproject(P),originalEvent:m}),this._defaultPrevented=!1}}class wm extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(o,d,m){super(o,{originalEvent:m}),this._defaultPrevented=!1}}class km{constructor(o,d){this._map=o,this._clickTolerance=d.clickTolerance}reset(){delete this._mousedownPos}wheel(o){return this._firePreventable(new wm(o.type,this._map,o))}mousedown(o,d){return this._mousedownPos=d,this._firePreventable(new Di(o.type,this._map,o))}mouseup(o){this._map.fire(new Di(o.type,this._map,o))}click(o,d){this._mousedownPos&&this._mousedownPos.dist(d)>=this._clickTolerance||this._map.fire(new Di(o.type,this._map,o))}dblclick(o){return this._firePreventable(new Di(o.type,this._map,o))}mouseover(o){this._map.fire(new Di(o.type,this._map,o))}mouseout(o){this._map.fire(new Di(o.type,this._map,o))}touchstart(o){return this._firePreventable(new Ys(o.type,this._map,o))}touchmove(o){this._map.fire(new Ys(o.type,this._map,o))}touchend(o){this._map.fire(new Ys(o.type,this._map,o))}touchcancel(o){this._map.fire(new Ys(o.type,this._map,o))}_firePreventable(o){if(this._map.fire(o),o.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Qn{constructor(o){this._map=o}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(o){this._map.fire(new Di(o.type,this._map,o))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Di("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(o){this._delayContextMenu?this._contextMenuEvent=o:this._ignoreContextMenu||this._map.fire(new Di(o.type,this._map,o)),this._map.listens("contextmenu")&&o.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class eo{constructor(o){this._map=o}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(o){return this.transform.pointLocation(l.P.convert(o),this._map.terrain)}}class _r{constructor(o,d){this._map=o,this._tr=new eo(o),this._el=o.getCanvasContainer(),this._container=o.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(o,d){this.isEnabled()&&o.shiftKey&&o.button===0&&(C.disableDrag(),this._startPos=this._lastPos=d,this._active=!0)}mousemoveWindow(o,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",o));const x=Math.min(y.x,m.x),M=Math.max(y.x,m.x),P=Math.min(y.y,m.y),O=Math.max(y.y,m.y);C.setTransform(this._box,`translate(${x}px,${P}px)`),this._box.style.width=M-x+"px",this._box.style.height=O-P+"px"}mouseupWindow(o,d){if(!this._active||o.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:o})),{cameraAnimation:x=>x.fitScreenCoordinates(m,y,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",o)}keydown(o){this._active&&o.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",o))}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(o,d){return this._map.fire(new l.k(o,{originalEvent:d}))}}function Kl(v,o){if(v.length!==o.length)throw new Error(`The number of touches and points are not equal - touches ${v.length}, points ${o.length}`);const d={};for(let m=0;m<v.length;m++)d[v[m].identifier]=o[m];return d}class vd{constructor(o){this.reset(),this.numTouches=o.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(o,d,m){(this.centroid||m.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=o.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(o,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(o,d,m){if((!this.centroid||o.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(o){this.singleTap=new vd(o),this.numTaps=o.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(o,d,m){this.singleTap.touchstart(o,d,m)}touchmove(o,d,m){this.singleTap.touchmove(o,d,m)}touchend(o,d,m){const y=this.singleTap.touchend(o,d,m);if(y){const x=o.timeStamp-this.lastTime<500,M=!this.lastTap||this.lastTap.dist(y)<30;if(x&&M||this.reset(),this.count++,this.lastTime=o.timeStamp,this.lastTap=y,this.count===this.numTaps)return this.reset(),y}}}class Ua{constructor(o){this._tr=new eo(o),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(o,d,m){this._zoomIn.touchstart(o,d,m),this._zoomOut.touchstart(o,d,m)}touchmove(o,d,m){this._zoomIn.touchmove(o,d,m),this._zoomOut.touchmove(o,d,m)}touchend(o,d,m){const y=this._zoomIn.touchend(o,d,m),x=this._zoomOut.touchend(o,d,m),M=this._tr;return y?(this._active=!0,o.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:P=>P.easeTo({duration:300,zoom:M.zoom+1,around:M.unproject(y)},{originalEvent:o})}):x?(this._active=!0,o.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:P=>P.easeTo({duration:300,zoom:M.zoom-1,around:M.unproject(x)},{originalEvent:o})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qo{constructor(o){this._enabled=!!o.enable,this._moveStateManager=o.moveStateManager,this._clickTolerance=o.clickTolerance||1,this._moveFunction=o.move,this._activateOnStart=!!o.activateOnStart,o.assignEvents(this),this.reset()}reset(o){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(o)}_move(...o){const d=this._moveFunction(...o);if(d.bearingDelta||d.pitchDelta||d.around||d.panDelta)return this._active=!0,d}dragStart(o,d){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(o)&&(this._moveStateManager.startMove(o),this._lastPoint=d.length?d[0]:d,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(o,d){if(!this.isEnabled())return;const m=this._lastPoint;if(!m)return;if(o.preventDefault(),!this._moveStateManager.isValidMoveEvent(o))return void this.reset(o);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(o){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(o)&&(this._moved&&C.suppressClick(),this.reset(o))}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(o){this._correctEvent=o.checkCorrectEvent}startMove(o){const d=C.mouseButton(o);this._eventButton=d}endMove(o){delete this._eventButton}isValidStartEvent(o){return this._correctEvent(o)}isValidMoveEvent(o){return!function(d,m){const y=wd[m];return d.buttons===void 0||(d.buttons&y)!==y}(o,this._eventButton)}isValidEndEvent(o){return C.mouseButton(o)===this._eventButton}}class kd{constructor(){this._firstTouch=void 0}_isOneFingerTouch(o){return o.targetTouches.length===1}_isSameTouchEvent(o){return o.targetTouches[0].identifier===this._firstTouch}startMove(o){this._firstTouch=o.targetTouches[0].identifier}endMove(o){delete this._firstTouch}isValidStartEvent(o){return this._isOneFingerTouch(o)}isValidMoveEvent(o){return this._isOneFingerTouch(o)&&this._isSameTouchEvent(o)}isValidEndEvent(o){return this._isOneFingerTouch(o)&&this._isSameTouchEvent(o)}}const Su=v=>{v.mousedown=v.dragStart,v.mousemoveWindow=v.dragMove,v.mouseup=v.dragEnd,v.contextmenu=o=>{o.preventDefault()}},Sd=({enable:v,clickTolerance:o,bearingDegreesPerPixelMoved:d=.8})=>{const m=new ku({checkCorrectEvent:y=>C.mouseButton(y)===0&&y.ctrlKey||C.mouseButton(y)===2});return new qo({clickTolerance:o,move:(y,x)=>({bearingDelta:(x.x-y.x)*d}),moveStateManager:m,enable:v,assignEvents:Su})},Ed=({enable:v,clickTolerance:o,pitchDegreesPerPixelMoved:d=-.5})=>{const m=new ku({checkCorrectEvent:y=>C.mouseButton(y)===0&&y.ctrlKey||C.mouseButton(y)===2});return new qo({clickTolerance:o,move:(y,x)=>({pitchDelta:(x.y-y.y)*d}),moveStateManager:m,enable:v,assignEvents:Su})};class Xs{constructor(o,d){this._clickTolerance=o.clickTolerance||1,this._map=d,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.P(0,0)}_shouldBePrevented(o){return o<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(o,d,m){return this._calculateTransform(o,d,m)}touchmove(o,d,m){if(this._active){if(!this._shouldBePrevented(m.length))return o.preventDefault(),this._calculateTransform(o,d,m);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",o)}}touchend(o,d,m){this._calculateTransform(o,d,m),this._active&&this._shouldBePrevented(m.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(o,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 P=0;for(const N in y){const V=y[N],F=this._touches[N];F&&(x._add(V),M._add(V.sub(F)),P++,y[N]=V)}if(this._touches=y,this._shouldBePrevented(P)||!M.mag())return;const O=M.div(P);return this._sum._add(O),this._sum.mag()<this._clickTolerance?void 0:{around:x.div(P),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(o,d,m){this._firstTwoTouches||m.length<2||(this._firstTwoTouches=[m[0].identifier,m[1].identifier],this._start([d[0],d[1]]))}touchmove(o,d,m){if(!this._firstTwoTouches)return;o.preventDefault();const[y,x]=this._firstTwoTouches,M=Jl(m,d,y),P=Jl(m,d,x);if(!M||!P)return;const O=this._aroundCenter?null:M.add(P).div(2);return this._move([M,P],O,o)}touchend(o,d,m){if(!this._firstTwoTouches)return;const[y,x]=this._firstTwoTouches,M=Jl(m,d,y),P=Jl(m,d,x);M&&P||(this._active&&C.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(o){this._enabled=!0,this._aroundCenter=!!o&&o.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Jl(v,o,d){for(let m=0;m<v.length;m++)if(v[m].identifier===d)return o[m]}function Cd(v,o){return Math.log(v/o)/Math.LN2}class Td extends Eu{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(o){this._startDistance=this._distance=o[0].dist(o[1])}_move(o,d){const m=this._distance;if(this._distance=o[0].dist(o[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,o){return 180*v.angleWith(o)/Math.PI}class Ad extends Eu{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(o){this._startVector=this._vector=o[0].sub(o[1]),this._minDiameter=o[0].dist(o[1])}_move(o,d,m){const y=this._vector;if(this._vector=o[0].sub(o[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Md(this._vector,y),pinchAround:d}}_isBelowThreshold(o){this._minDiameter=Math.min(this._minDiameter,o.mag());const d=25/(Math.PI*this._minDiameter)*360,m=Md(o,this._startVector);return Math.abs(m)<d}}function Cu(v){return Math.abs(v.y)>Math.abs(v.x)}class Ha extends Eu{constructor(o){super(),this._currentTouchCount=0,this._map=o}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(o,d,m){super.touchstart(o,d,m),this._currentTouchCount=m.length}_start(o){this._lastPoints=o,Cu(o[0].sub(o[1]))&&(this._valid=!1)}_move(o,d,m){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const y=o[0].sub(this._lastPoints[0]),x=o[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(y,x,m.timeStamp),this._valid?(this._lastPoints=o,this._active=!0,{pitchDelta:(y.y+x.y)/2*-.5}):void 0}gestureBeginsVertically(o,d,m){if(this._valid!==void 0)return this._valid;const y=o.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=o.y>0==d.y>0;return Cu(o)&&Cu(d)&&M}}const Sm={panStep:100,bearingStep:15,pitchStep:10};class Lr{constructor(o){this._tr=new eo(o);const d=Sm;this._panStep=d.panStep,this._bearingStep=d.bearingStep,this._pitchStep=d.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(o){if(o.altKey||o.ctrlKey||o.metaKey)return;let d=0,m=0,y=0,x=0,M=0;switch(o.keyCode){case 61:case 107:case 171:case 187:d=1;break;case 189:case 109:case 173:d=-1;break;case 37:o.shiftKey?m=-1:(o.preventDefault(),x=-1);break;case 39:o.shiftKey?m=1:(o.preventDefault(),x=1);break;case 38:o.shiftKey?y=1:(o.preventDefault(),M=-1);break;case 40:o.shiftKey?y=-1:(o.preventDefault(),M=1);break;default:return}return this._rotationDisabled&&(m=0,y=0),{cameraAnimation:P=>{const O=this._tr;P.easeTo({duration:300,easeId:"keyboardHandler",easing:Ao,zoom:d?Math.round(O.zoom)+d*(o.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:o})}}}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 Ao(v){return v*(2-v)}const Id=4.000244140625;class to{constructor(o,d){this._onTimeout=m=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(m)},this._map=o,this._tr=new eo(o),this._triggerRenderFrame=d,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(o){this._defaultZoomRate=o}setWheelZoomRate(o){this._wheelZoomRate=o}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(o){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!o&&o.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(o){return!!this._map.cooperativeGestures.isEnabled()&&!(o.ctrlKey||this._map.cooperativeGestures.isBypassed(o))}wheel(o){if(!this.isEnabled())return;if(this._shouldBePrevented(o))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",o);let d=o.deltaMode===WheelEvent.DOM_DELTA_LINE?40*o.deltaY:o.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,o)):this._type||(this._type=Math.abs(y*d)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,d+=this._lastValue)),o.shiftKey&&d&&(d/=4),this._type&&(this._lastWheelEvent=o,this._delta-=d,this._active||this._start(o)),o.preventDefault()}_start(o){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(),o),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 o=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"?o.zoomScale(this._targetZoom):o.scale;this._targetZoom=Math.min(o.maxZoom,Math.max(o.minZoom,o.scaleZoom(V*N))),this._type==="wheel"&&(this._startZoom=o.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const d=typeof this._targetZoom=="number"?this._targetZoom:o.zoom,m=this._startZoom,y=this._easing;let x,M=!1;const P=E.now()-this._lastWheelEventTime;if(this._type==="wheel"&&m&&y&&P){const O=Math.min(P/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-o.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(o){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,P=Math.sqrt(.0729-M*M);d=l.b8(M,P,.25,1)}return this._prevEase={start:E.now(),duration:o,easing:d},d}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ks{constructor(o,d){this._clickZoom=o,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 v_{constructor(o){this._tr=new eo(o),this.reset()}reset(){this._active=!1}dblclick(o,d){return o.preventDefault(),{cameraAnimation:m=>{m.easeTo({duration:300,zoom:this._tr.zoom+(o.shiftKey?-1:1),around:this._tr.unproject(d)},{originalEvent:o})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class w_{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(o,d,m){if(!this._swipePoint)if(this._tapTime){const y=d[0],x=o.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(o,d,m)}touchmove(o,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,o.preventDefault(),this._active=!0,{zoomDelta:x/128}}}else this._tap.touchmove(o,d,m)}touchend(o,d,m){if(this._tapTime)this._swipePoint&&m.length===0&&this.reset();else{const y=this._tap.touchend(o,d,m);y&&(this._tapTime=o.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 Em{constructor(o,d,m){this._el=o,this._mousePan=d,this._touchPan=m}enable(o){this._inertiaOptions=o||{},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 Cm{constructor(o,d,m){this._pitchWithRotate=o.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(o,d,m,y){this._el=o,this._touchZoom=d,this._touchRotate=m,this._tapDragZoom=y,this._rotationDisabled=!1,this._enabled=!0}enable(o){this._touchZoom.enable(o),this._rotationDisabled||this._touchRotate.enable(o),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(o,d){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=o,this._options=d,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const o=this._map.getCanvasContainer();o.classList.add("maplibregl-cooperative-gestures"),this._container=C.create("div","maplibregl-cooperative-gesture-screen",o);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(o){return o[this._bypassKey]}notifyGestureBlocked(o,d){this._enabled&&(this._map.fire(new l.k("cooperativegestureprevented",{gestureType:o,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 ut extends l.k{}function Tu(v){return v.panDelta&&v.panDelta.mag()||v.zoomDelta||v.bearingDelta||v.pitchDelta}class Dd{constructor(o,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,P={needsRenderFrame:!1},O={},N={},V=y.touches,F=V?this._getMapTouches(V):void 0,Z=F?C.touchPos(this._map.getCanvas(),F):C.mousePos(this._map.getCanvas(),y);for(const{handlerName:re,handler:le,allowed:ce}of this._handlers){if(!le.isEnabled())continue;let he;this._blockedByActive(N,ce,re)?le.reset():le[x||y.type]&&(he=le[x||y.type](y,Z,F),this.mergeHandlerResult(P,O,he,re,M),he&&he.needsRenderFrame&&this._triggerRenderFrame()),(he||le.isActive())&&(N[re]=le)}const J={};for(const re in this._previousActiveHandlers)N[re]||(J[re]=M);this._previousActiveHandlers=N,(Object.keys(J).length||Tu(P))&&(this._changes.push([P,O,J]),this._triggerRenderFrame()),(Object.keys(N).length||Tu(P))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ee}=P;ee&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ee(this._map))},this._map=o,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new xd(o),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[o,d,m]of this._listeners)C.removeEventListener(o,d,o===document?this.handleWindowEvent:this.handleEvent,m)}_addDefaultHandlers(o){const d=this._map,m=d.getCanvasContainer();this._add("mapEvent",new km(d,o));const y=d.boxZoom=new _r(d,o);this._add("boxZoom",y),o.interactive&&o.boxZoom&&y.enable();const x=d.cooperativeGestures=new qa(d,o.cooperativeGestures);this._add("cooperativeGestures",x),o.cooperativeGestures&&x.enable();const M=new Ua(d),P=new v_(d);d.doubleClickZoom=new Ks(P,M),this._add("tapZoom",M),this._add("clickZoom",P),o.interactive&&o.doubleClickZoom&&d.doubleClickZoom.enable();const O=new w_;this._add("tapDragZoom",O);const N=d.touchPitch=new Ha(d);this._add("touchPitch",N),o.interactive&&o.touchPitch&&d.touchPitch.enable(o.touchPitch);const V=Sd(o),F=Ed(o);d.dragRotate=new Cm(o,V,F),this._add("mouseRotate",V,["mousePitch"]),this._add("mousePitch",F,["mouseRotate"]),o.interactive&&o.dragRotate&&d.dragRotate.enable();const Z=(({enable:he,clickTolerance:te})=>{const me=new ku({checkCorrectEvent:ge=>C.mouseButton(ge)===0&&!ge.ctrlKey});return new qo({clickTolerance:te,move:(ge,ve)=>({around:ve,panDelta:ve.sub(ge)}),activateOnStart:!0,moveStateManager:me,enable:he,assignEvents:Su})})(o),J=new Xs(o,d);d.dragPan=new Em(m,Z,J),this._add("mousePan",Z),this._add("touchPan",J,["touchZoom","touchRotate"]),o.interactive&&o.dragPan&&d.dragPan.enable(o.dragPan);const ee=new Ad,re=new Td;d.touchZoomRotate=new Pd(m,re,ee,O),this._add("touchRotate",ee,["touchPan","touchZoom"]),this._add("touchZoom",re,["touchPan","touchRotate"]),o.interactive&&o.touchZoomRotate&&d.touchZoomRotate.enable(o.touchZoomRotate);const le=d.scrollZoom=new to(d,()=>this._triggerRenderFrame());this._add("scrollZoom",le,["mousePan"]),o.interactive&&o.scrollZoom&&d.scrollZoom.enable(o.scrollZoom);const ce=d.keyboard=new Lr(d);this._add("keyboard",ce),o.interactive&&o.keyboard&&d.keyboard.enable(),this._add("blockableMapEvent",new Qn(d))}_add(o,d,m){this._handlers.push({handlerName:o,handler:d,allowed:m}),this._handlersById[o]=d}stop(o){if(!this._updatingCamera){for(const{handler:d}of this._handlers)d.reset();this._inertia.clear(),this._fireEvents({},{},o),this._changes=[]}}isActive(){for(const{handler:o}of this._handlers)if(o.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(o,d,m){for(const y in o)if(y!==m&&(!d||d.indexOf(y)<0))return!0;return!1}_getMapTouches(o){const d=[];for(const m of o)this._el.contains(m.target)&&d.push(m);return d}mergeHandlerResult(o,d,m,y,x){if(!m)return;l.e(o,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 o={},d={},m={};for(const[y,x,M]of this._changes)y.panDelta&&(o.panDelta=(o.panDelta||new l.P(0,0))._add(y.panDelta)),y.zoomDelta&&(o.zoomDelta=(o.zoomDelta||0)+y.zoomDelta),y.bearingDelta&&(o.bearingDelta=(o.bearingDelta||0)+y.bearingDelta),y.pitchDelta&&(o.pitchDelta=(o.pitchDelta||0)+y.pitchDelta),y.around!==void 0&&(o.around=y.around),y.pinchAround!==void 0&&(o.pinchAround=y.pinchAround),y.noInertia&&(o.noInertia=y.noInertia),l.e(d,x),l.e(m,M);this._updateMapTransform(o,d,m),this._changes=[]}_updateMapTransform(o,d,m){const y=this._map,x=y._getTransformForUpdate(),M=y.terrain;if(!(Tu(o)||M&&this._terrainMovement))return this._fireEvents(d,m,!0);let{panDelta:P,zoomDelta:O,bearingDelta:N,pitchDelta:V,around:F,pinchAround:Z}=o;Z!==void 0&&(F=Z),y._stop(!0),F=F||y.transform.centerPoint;const J=x.pointLocation(P?F.sub(P):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(P)):x.setLocationAtPoint(J,F):(this._terrainMovement=!0,this._map._elevationFreeze=!0,x.setLocationAtPoint(J,F)):x.setLocationAtPoint(J,F),y._applyUpdatedTransform(x),this._map._update(),o.noInertia||this._inertia.record(o),this._fireEvents(d,m,!0)}_fireEvents(o,d,m){const y=Vr(this._eventsInProgress),x=Vr(o),M={};for(const F in o){const{originalEvent:Z}=o[F];this._eventsInProgress[F]||(M[`${F}start`]=Z),this._eventsInProgress[F]=o[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 o){const{originalEvent:Z}=o[F];this._fireEvent(F,Z)}const P={};let O;for(const F in this._eventsInProgress){const{handlerName:Z,originalEvent:J}=this._eventsInProgress[F];this._handlersById[Z].isActive()||(delete this._eventsInProgress[F],O=d[Z]||J,P[`${F}end`]=O)}for(const F in P)this._fireEvent(F,P[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),Z=J=>J!==0&&-this._bearingSnap<J&&J<this._bearingSnap;!F||!F.essential&&E.prefersReducedMotion?(this._map.fire(new l.k("moveend",{originalEvent:O})),Z(this._map.getBearing())&&this._map.resetNorth()):(Z(F.bearing||this._map.getBearing())&&(F.bearing=0),F.freezeElevation=!0,this._map.easeTo(F,{originalEvent:O})),this._updatingCamera=!1}}_fireEvent(o,d){this._map.fire(new l.k(o,d?{originalEvent:d}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(o=>{delete this._frameId,this.handleEvent(new ut("renderFrame",{timeStamp:o})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Tm extends l.E{constructor(o,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=o,this._bearingSnap=d.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new l.N(this.transform.center.lng,this.transform.center.lat)}setCenter(o,d){return this.jumpTo({center:o},d)}panBy(o,d,m){return o=l.P.convert(o).mult(-1),this.panTo(this.transform.center,l.e({offset:o},d),m)}panTo(o,d,m){return this.easeTo(l.e({center:o},d),m)}getZoom(){return this.transform.zoom}setZoom(o,d){return this.jumpTo({zoom:o},d),this}zoomTo(o,d,m){return this.easeTo(l.e({zoom:o},d),m)}zoomIn(o,d){return this.zoomTo(this.getZoom()+1,o,d),this}zoomOut(o,d){return this.zoomTo(this.getZoom()-1,o,d),this}getBearing(){return this.transform.bearing}setBearing(o,d){return this.jumpTo({bearing:o},d),this}getPadding(){return this.transform.padding}setPadding(o,d){return this.jumpTo({padding:o},d),this}rotateTo(o,d,m){return this.easeTo(l.e({bearing:o},d),m)}resetNorth(o,d){return this.rotateTo(0,l.e({duration:1e3},o),d),this}resetNorthPitch(o,d){return this.easeTo(l.e({bearing:0,pitch:0,duration:1e3},o),d),this}snapToNorth(o,d){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(o,d):this}getPitch(){return this.transform.pitch}setPitch(o,d){return this.jumpTo({pitch:o},d),this}cameraForBounds(o,d){o=we.convert(o).adjustAntiMeridian();const m=d&&d.bearing||0;return this._cameraForBoxAndBearing(o.getNorthWest(),o.getSouthEast(),m,d)}_cameraForBoxAndBearing(o,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 Ye=y.padding;y.padding={top:Ye,bottom:Ye,right:Ye,left:Ye}}y.padding=l.e(x,y.padding);const M=this.transform,P=M.padding,O=new we(o,d),N=M.project(O.getNorthWest()),V=M.project(O.getNorthEast()),F=M.project(O.getSouthEast()),Z=M.project(O.getSouthWest()),J=l.ba(-m),ee=N.rotate(J),re=V.rotate(J),le=F.rotate(J),ce=Z.rotate(J),he=new l.P(Math.max(ee.x,re.x,ce.x,le.x),Math.max(ee.y,re.y,ce.y,le.y)),te=new l.P(Math.min(ee.x,re.x,ce.x,le.x),Math.min(ee.y,re.y,ce.y,le.y)),me=he.sub(te),ge=(M.width-(P.left+P.right+y.padding.left+y.padding.right))/me.x,ve=(M.height-(P.top+P.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 Be=Math.min(M.scaleZoom(M.scale*Math.min(ge,ve)),y.maxZoom),Fe=l.P.convert(y.offset),Qe=new l.P((y.padding.left-y.padding.right)/2,(y.padding.top-y.padding.bottom)/2).rotate(l.ba(m)),st=Fe.add(Qe).mult(M.scale/M.zoomScale(Be));return{center:M.unproject(N.add(F).div(2).sub(st)),zoom:Be,bearing:m}}fitBounds(o,d,m){return this._fitInternal(this.cameraForBounds(o,d),d,m)}fitScreenCoordinates(o,d,m,y,x){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(l.P.convert(o)),this.transform.pointLocation(l.P.convert(d)),m,y),y,x)}_fitInternal(o,d,m){return o?(delete(d=l.e(o,d)).padding,d.linear?this.easeTo(d,m):this.flyTo(d,m)):this}jumpTo(o,d){this.stop();const m=this._getTransformForUpdate();let y=!1,x=!1,M=!1;return"zoom"in o&&m.zoom!==+o.zoom&&(y=!0,m.zoom=+o.zoom),o.center!==void 0&&(m.center=l.N.convert(o.center)),"bearing"in o&&m.bearing!==+o.bearing&&(x=!0,m.bearing=+o.bearing),"pitch"in o&&m.pitch!==+o.pitch&&(M=!0,m.pitch=+o.pitch),o.padding==null||m.isPaddingEqual(o.padding)||(m.padding=o.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(o,d,m,y=0){const x=l.Z.fromLngLat(o,d),M=l.Z.fromLngLat(m,y),P=M.x-x.x,O=M.y-x.y,N=M.z-x.z,V=Math.hypot(P,O,N);if(V===0)throw new Error("Can't calculate camera options with same From and To");const F=Math.hypot(P,O),Z=this.transform.scaleZoom(this.transform.cameraToCenterDistance/V/this.transform.tileSize),J=180*Math.atan2(P,-O)/Math.PI;let ee=180*Math.acos(F/V)/Math.PI;return ee=N<0?90-ee:90+ee,{center:M.toLngLat(),zoom:Z,pitch:ee,bearing:J}}easeTo(o,d){var m;this._stop(!1,o.easeId),((o=l.e({offset:[0,0],duration:500,easing:l.b9},o)).animate===!1||!o.essential&&E.prefersReducedMotion)&&(o.duration=0);const y=this._getTransformForUpdate(),x=y.zoom,M=y.bearing,P=y.pitch,O=y.padding,N="bearing"in o?this._normalizeBearing(o.bearing,M):M,V="pitch"in o?+o.pitch:P,F="padding"in o?o.padding:y.padding,Z=l.P.convert(o.offset);let J=y.centerPoint.add(Z);const ee=y.pointLocation(J),{center:re,zoom:le}=y.getConstrained(l.N.convert(o.center||ee),(m=o.zoom)!==null&&m!==void 0?m:x);this._normalizeCenter(re,y);const ce=y.project(ee),he=y.project(re).sub(ce),te=y.zoomScale(le-x);let me,ge;o.around&&(me=l.N.convert(o.around),ge=y.locationPoint(me));const ve={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||le!==x,this._rotating=this._rotating||M!==N,this._pitching=this._pitching||V!==P,this._padding=!y.isPaddingEqual(F),this._easeId=o.easeId,this._prepareEase(d,o.noMoveStart,ve),this.terrain&&this._prepareElevation(re),this._ease(Be=>{if(this._zooming&&(y.zoom=l.y.number(x,le,Be)),this._rotating&&(y.bearing=l.y.number(M,N,Be)),this._pitching&&(y.pitch=l.y.number(P,V,Be)),this._padding&&(y.interpolatePadding(O,F,Be),J=y.centerPoint.add(Z)),this.terrain&&!o.freezeElevation&&this._updateElevation(Be),me)y.setLocationAtPoint(me,ge);else{const Fe=y.zoomScale(y.zoom-x),Qe=le>x?Math.min(2,te):Math.max(.5,te),st=Math.pow(Qe,1-Be),Ye=y.unproject(ce.add(he.mult(Be*st)).mult(Fe));y.setLocationAtPoint(y.renderWorldCopies?Ye.wrap():Ye,J)}this._applyUpdatedTransform(y),this._fireMoveEvents(d)},Be=>{this.terrain&&o.freezeElevation&&this._finalizeElevation(),this._afterEase(d,Be)},o),this}_prepareEase(o,d,m={}){this._moving=!0,d||m.moving||this.fire(new l.k("movestart",o)),this._zooming&&!m.zooming&&this.fire(new l.k("zoomstart",o)),this._rotating&&!m.rotating&&this.fire(new l.k("rotatestart",o)),this._pitching&&!m.pitching&&this.fire(new l.k("pitchstart",o))}_prepareElevation(o){this._elevationCenter=o,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(o,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(o){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const d=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(o<1&&d!==this._elevationTarget){const m=this._elevationTarget-this._elevationStart;this._elevationStart+=o*(m-(d-(m*o+this._elevationStart))/(1-o)),this._elevationTarget=d}this.transform.elevation=l.y.number(this._elevationStart,this._elevationTarget,o)}_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(o){const d=o.getCameraPosition(),m=this.terrain.getElevationForLngLatZoom(d.lngLat,o.zoom);if(d.altitude<m){const y=this.calculateCameraOptionsFromTo(d.lngLat,m,o.center,o.elevation);return{pitch:y.pitch,zoom:y.zoom}}return{}}_applyUpdatedTransform(o){const d=[];if(this.terrain&&d.push(y=>this._elevateCameraIfInsideTerrain(y)),this.transformCameraUpdate&&d.push(y=>this.transformCameraUpdate(y)),!d.length)return;const m=o.clone();for(const y of d){const x=m.clone(),{center:M,zoom:P,pitch:O,bearing:N,elevation:V}=y(x);M&&(x.center=M),P!==void 0&&(x.zoom=P),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(o){this.fire(new l.k("move",o)),this._zooming&&this.fire(new l.k("zoom",o)),this._rotating&&this.fire(new l.k("rotate",o)),this._pitching&&this.fire(new l.k("pitch",o))}_afterEase(o,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",o)),y&&this.fire(new l.k("rotateend",o)),x&&this.fire(new l.k("pitchend",o)),this.fire(new l.k("moveend",o))}flyTo(o,d){var m;if(!o.essential&&E.prefersReducedMotion){const nt=l.M(o,["center","zoom","bearing","pitch","around"]);return this.jumpTo(nt,d)}this.stop(),o=l.e({offset:[0,0],speed:1.2,curve:1.42,easing:l.b9},o);const y=this._getTransformForUpdate(),x=y.zoom,M=y.bearing,P=y.pitch,O=y.padding,N="bearing"in o?this._normalizeBearing(o.bearing,M):M,V="pitch"in o?+o.pitch:P,F="padding"in o?o.padding:y.padding,Z=l.P.convert(o.offset);let J=y.centerPoint.add(Z);const ee=y.pointLocation(J),{center:re,zoom:le}=y.getConstrained(l.N.convert(o.center||ee),(m=o.zoom)!==null&&m!==void 0?m:x);this._normalizeCenter(re,y);const ce=y.zoomScale(le-x),he=y.project(ee),te=y.project(re).sub(he);let me=o.curve;const ge=Math.max(y.width,y.height),ve=ge/ce,Be=te.mag();if("minZoom"in o){const nt=l.ac(Math.min(o.minZoom,x,le),y.minZoom,y.maxZoom),Pt=ge/y.zoomScale(nt-x);me=Math.sqrt(Pt/Be*2)}const Fe=me*me;function Qe(nt){const Pt=(ve*ve-ge*ge+(nt?-1:1)*Fe*Fe*Be*Be)/(2*(nt?ve:ge)*Fe*Be);return Math.log(Math.sqrt(Pt*Pt+1)-Pt)}function st(nt){return(Math.exp(nt)-Math.exp(-nt))/2}function Ye(nt){return(Math.exp(nt)+Math.exp(-nt))/2}const Ge=Qe(!1);let mt=function(nt){return Ye(Ge)/Ye(Ge+me*nt)},Ot=function(nt){return ge*((Ye(Ge)*(st(Pt=Ge+me*nt)/Ye(Pt))-st(Ge))/Fe)/Be;var Pt},Xe=(Qe(!0)-Ge)/me;if(Math.abs(Be)<1e-6||!isFinite(Xe)){if(Math.abs(ge-ve)<1e-6)return this.easeTo(o,d);const nt=ve<ge?-1:1;Xe=Math.abs(Math.log(ve/ge))/me,Ot=()=>0,mt=Pt=>Math.exp(nt*me*Pt)}return o.duration="duration"in o?+o.duration:1e3*Xe/("screenSpeed"in o?+o.screenSpeed/me:+o.speed),o.maxDuration&&o.duration>o.maxDuration&&(o.duration=0),this._zooming=!0,this._rotating=M!==N,this._pitching=V!==P,this._padding=!y.isPaddingEqual(F),this._prepareEase(d,!1),this.terrain&&this._prepareElevation(re),this._ease(nt=>{const Pt=nt*Xe,Fn=1/mt(Pt);y.zoom=nt===1?le:x+y.scaleZoom(Fn),this._rotating&&(y.bearing=l.y.number(M,N,nt)),this._pitching&&(y.pitch=l.y.number(P,V,nt)),this._padding&&(y.interpolatePadding(O,F,nt),J=y.centerPoint.add(Z)),this.terrain&&!o.freezeElevation&&this._updateElevation(nt);const Lt=nt===1?re:y.unproject(he.add(te.mult(Ot(Pt))).mult(Fn));y.setLocationAtPoint(y.renderWorldCopies?Lt.wrap():Lt,J),this._applyUpdatedTransform(y),this._fireMoveEvents(d)},()=>{this.terrain&&o.freezeElevation&&this._finalizeElevation(),this._afterEase(d)},o),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(o,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 o||(m=this.handlers)===null||m===void 0||m.stop(!1),this}_ease(o,d,m){m.animate===!1||m.duration===0?(o(1),d()):(this._easeStart=E.now(),this._easeOptions=m,this._onEaseFrame=o,this._onEaseEnd=d,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(o,d){o=l.b3(o,-180,180);const m=Math.abs(o-d);return Math.abs(o-360-d)<m&&(o-=360),Math.abs(o+360-d)<m&&(o+=360),o}_normalizeCenter(o,d){if(!d.renderWorldCopies||d.lngRange)return;const m=o.lng-d.center.lng;o.lng+=m>180?-360:m<-180?360:0}queryTerrainElevation(o){return this.terrain?this.terrain.getElevationForLngLatZoom(l.N.convert(o),this.transform.tileZoom)-this.transform.elevation:null}}const Wa={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Ga{constructor(o=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=o}getDefaultPosition(){return"bottom-right"}onAdd(o){return this._map=o,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(o,d){const m=this._map._getUIString(`AttributionControl.${d}`);o.title=m,o.setAttribute("aria-label",m)}_updateAttributions(){if(!this._map.style)return;let o=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?o=o.concat(this.options.customAttribution.map(y=>typeof y!="string"?"":y)):typeof this.options.customAttribution=="string"&&o.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&&o.indexOf(M.attribution)<0&&o.push(M.attribution)}}o=o.filter(y=>String(y).trim()),o.sort((y,x)=>y.length-x.length),o=o.filter((y,x)=>{for(let M=x+1;M<o.length;M++)if(o[M].indexOf(y)>=0)return!1;return!0});const m=o.join(" | ");m!==this._attribHTML&&(this._attribHTML=m,o.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(o={}){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=o}getDefaultPosition(){return"bottom-left"}onAdd(o){this._map=o,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 Qt{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(o){const d=++this._id;return this._queue.push({callback:o,id:d,cancelled:!1}),d}remove(o){const d=this._currentlyRunning,m=d?this._queue.concat(d):this._queue;for(const y of m)if(y.id===o)return void(y.cancelled=!0)}run(o=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(o),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Bd=l.Y([{name:"a_pos3d",type:"Int16",components:3}]);class k_ extends l.E{constructor(o){super(),this.sourceCache=o,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,o.usedForTerrain=!0,o.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(o,d){this.sourceCache.update(o,d),this._renderableTilesKeys=[];const m={};for(const y of o.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 To(y,this.tileSize));for(const y in this._tiles)m[y]||delete this._tiles[y]}freeRtt(o){for(const d in this._tiles){const m=this._tiles[d];(!o||m.tileID.equals(o)||m.tileID.isChildOf(o)||o.isChildOf(m.tileID))&&(m.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(o=>this.getTileByID(o))}getTileByID(o){return this._tiles[o]}getTerrainCoords(o){const d={};for(const m of this._renderableTilesKeys){const y=this._tiles[m].tileID;if(y.canonical.equals(o.canonical)){const x=o.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(o.canonical)){const x=o.clone();x.posMatrix=new Float64Array(16);const M=y.canonical.z-o.canonical.z,P=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,[-P*N,-O*N,0]),d[m]=x}else if(o.canonical.isChildOf(y.canonical)){const x=o.clone();x.posMatrix=new Float64Array(16);const M=o.canonical.z-y.canonical.z,P=o.canonical.x-(o.canonical.x>>M<<M),O=o.canonical.y-(o.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,[P*N,O*N,0]),l.K(x.posMatrix,x.posMatrix,[1/2**M,1/2**M,0]),d[m]=x}}return d}getSourceTile(o,d){const m=this.sourceCache._source;let y=o.overscaledZ-this.deltaZoom;if(y>m.maxzoom&&(y=m.maxzoom),y<m.minzoom)return null;this._sourceTileCache[o.key]||(this._sourceTileCache[o.key]=o.scaledTo(y).key);let x=this.sourceCache.getTileByID(this._sourceTileCache[o.key]);if((!x||!x.dem)&&d)for(;y>=m.minzoom&&(!x||!x.dem);)x=this.sourceCache.getTileByID(o.scaledTo(y--).key);return x}tilesAfterTime(o=Date.now()){return Object.values(this._tiles).filter(d=>d.timeAdded>=o)}}class zd{constructor(o,d,m){this.painter=o,this.sourceCache=new k_(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(o,d,m,y=l.X){var x;if(!(d>=0&&d<y&&m>=0&&m<y))return 0;const M=this.getTerrainData(o),P=(x=M.tile)===null||x===void 0?void 0:x.dem;if(!P)return 0;const O=function(ee,re,le){var ce=re[0],he=re[1];return ee[0]=le[0]*ce+le[4]*he+le[12],ee[1]=le[1]*ce+le[5]*he+le[13],ee}([],[d/y*l.X,m/y*l.X],M.u_terrain_matrix),N=[O[0]*P.dim,O[1]*P.dim],V=Math.floor(N[0]),F=Math.floor(N[1]),Z=N[0]-V,J=N[1]-F;return P.get(V,F)*(1-Z)*(1-J)+P.get(V+1,F)*Z*(1-J)+P.get(V,F+1)*(1-Z)*J+P.get(V+1,F+1)*Z*J}getElevationForLngLatZoom(o,d){if(!l.bb(d,o.wrap()))return 0;const{tileID:m,mercatorX:y,mercatorY:x}=this._getOverscaledTileIDFromLngLatZoom(o,d);return this.getElevation(m,y%l.X,x%l.X,l.X)}getElevation(o,d,m,y=l.X){return this.getDEMElevation(o,d,m,y)*this.exaggeration}getTerrainData(o){if(!this._emptyDemTexture){const y=this.painter.context,x=new l.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Je(y,x,y.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Je(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(o,!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 Je(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+o.key;if(m&&!this._demMatrixCache[m]){const y=this.sourceCache.sourceCache._source.maxzoom;let x=o.canonical.z-d.tileID.canonical.z;o.overscaledZ>o.canonical.z&&(o.canonical.z>=y?x=o.canonical.z-y:l.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const M=o.canonical.x-(o.canonical.x>>x<<x),P=o.canonical.y-(o.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,P*l.X,0]),this._demMatrixCache[o.key]={matrix:O,coord:o}}return{u_depth:2,u_terrain:3,u_terrain_dim:d&&d.dem&&d.dem.dim||1,u_terrain_matrix:m?this._demMatrixCache[o.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(o){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 Je(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 Je(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(o==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const o=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 P=0;P<this._coordsTextureSize;P++,M+=4)d[M+0]=255&P,d[M+1]=255&x,d[M+2]=P>>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 Je(o,m,o.gl.RGBA,{premultiply:!1});return y.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),this._coordsTexture=y,y}pointCoordinate(o){this.painter.maybeDrawDepthAndCoords(!0);const d=new Uint8Array(4),m=this.painter.context,y=m.gl,x=Math.round(o.x*this.painter.pixelRatio/devicePixelRatio),M=Math.round(o.y*this.painter.pixelRatio/devicePixelRatio),P=Math.round(this.painter.height/devicePixelRatio);m.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),y.readPixels(x,P-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 Z=this._coordsTextureSize,J=(1<<F.tileID.canonical.z)*Z;return new l.Z((F.tileID.canonical.x*Z+O)/J+F.tileID.wrap,(F.tileID.canonical.y*Z+N)/J,this.getElevation(F.tileID,O,N,Z))}depthAtPoint(o){const d=new Uint8Array(4),m=this.painter.context,y=m.gl;return m.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),y.readPixels(o.x,this.painter.height/devicePixelRatio-o.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 o=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 Z=0;Z<=y;Z++)d.emplaceBack(Z*x,F*x,0);for(let F=0;F<M;F+=y+1)for(let Z=0;Z<y;Z++)m.emplaceBack(Z+F,y+Z+F+1,y+Z+F+2),m.emplaceBack(Z+F,y+Z+F+2,Z+F+1);const P=d.length,O=P+2*(y+1);for(const F of[0,1])for(let Z=0;Z<=y;Z++)for(const J of[0,1])d.emplaceBack(Z*x,F*l.X,J);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(P+F,P+F+3,P+F+1),m.emplaceBack(P+F,P+F+2,P+F+3);const N=d.length,V=N+2*(y+1);for(const F of[0,1])for(let Z=0;Z<=y;Z++)for(const J of[0,1])d.emplaceBack(F*l.X,Z*x,J);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(o.createVertexBuffer(d,Bd.members),o.createIndexBuffer(m),l.a0.simpleSegment(0,0,d.length,m.length)),this._mesh}getMeshFrameDelta(o){return 2*Math.PI*l.be/Math.pow(2,o)/5}getMinTileElevationForLngLatZoom(o,d){var m;const{tileID:y}=this._getOverscaledTileIDFromLngLatZoom(o,d);return(m=this.getMinMaxElevation(y).minElevation)!==null&&m!==void 0?m:0}getMinMaxElevation(o){const d=this.getTerrainData(o).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(o,d){const m=l.Z.fromLngLat(o.wrap()),y=(1<<d)*l.X,x=m.x*y,M=m.y*y,P=Math.floor(x/l.X),O=Math.floor(M/l.X);return{tileID:new l.S(d,0,d,P,O),mercatorX:x,mercatorY:M}}}class S_{constructor(o,d,m){this._context=o,this._size=d,this._tileSize=m,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const o of this._objects)o.texture.destroy(),o.fbo.destroy()}_createObject(o){const d=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),m=new Je(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:o,fbo:d,texture:m,stamp:-1,inUse:!1}}getObjectForId(o){return this._objects[o]}useObject(o){o.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(d=>o.id!==d),this._recentlyUsed.push(o.id)}stampObject(o){o.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 o=this._createObject(this._objects.length);return this._objects.push(o),o}freeObject(o){o.inUse=!1}freeAllObjects(){for(const o of this._objects)this.freeObject(o)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(o=>!o.inUse)===!1}}const Za={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Mm{constructor(o,d){this.painter=o,this.terrain=d,this.pool=new S_(o.context,30,d.sourceCache.tileSize*d.qualityFactor)}destruct(){this.pool.destruct()}getTexture(o){return this.pool.getObjectForId(o.rtt[this._stacks.length-1].id).texture}prepareForRender(o,d){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=o._order.filter(m=>!o._layers[m].isHidden(d)),this._coordsDescendingInv={};for(const m in o.sourceCaches){this._coordsDescendingInv[m]={};const y=o.sourceCaches[m].getVisibleCoordinates();for(const x of y){const M=this.terrain.sourceCache.getTerrainCoords(x);for(const P in M)this._coordsDescendingInv[m][P]||(this._coordsDescendingInv[m][P]=[]),this._coordsDescendingInv[m][P].push(M[P])}}this._coordsDescendingInvStr={};for(const m of o._order){const y=o._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(P=>P.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(o){if(o.isHidden(this.painter.transform.zoom))return!1;const d=o.type,m=this.painter,y=this._renderableLayerIds[this._renderableLayerIds.length-1]===o.id;if(Za[d]&&(this._prevType&&Za[this._prevType]||this._stacks.push([]),this._prevType=d,this._stacks[this._stacks.length-1].push(o.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 P of this._renderableTiles){if(this.pool.isFull()&&(xm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(P),P.rtt[x]){const N=this.pool.getObjectForId(P.rtt[x].id);if(N.stamp===P.rtt[x].stamp){this.pool.useObject(N);continue}}const O=this.pool.getOrCreateFreeObject();this.pool.useObject(O),this.pool.stampObject(O),P.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][P.tileID.key]:[P.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&&(P.rttCoords[V.source]=this._coordsDescendingInvStr[V.source][P.tileID.key])}}return xm(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"},Am=g,E_={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},C_={showCompass:!0,showZoom:!0,visualizePitch:!1};class T_{constructor(o,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=o.dragRotate._mouseRotate.getClickTolerance(),x=o.dragRotate._mousePitch.getClickTolerance();this.element=d,this.mouseRotate=Sd({clickTolerance:y,enable:!0}),this.touchRotate=(({enable:M,clickTolerance:P,bearingDegreesPerPixelMoved:O=.8})=>{const N=new kd;return new qo({clickTolerance:P,move:(V,F)=>({bearingDelta:(F.x-V.x)*O}),moveStateManager:N,enable:M,assignEvents:Rd})})({clickTolerance:y,enable:!0}),this.map=o,m&&(this.mousePitch=Ed({clickTolerance:x,enable:!0}),this.touchPitch=(({enable:M,clickTolerance:P,pitchDegreesPerPixelMoved:O=-.5})=>{const N=new kd;return new qo({clickTolerance:P,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(o,d){this.mouseRotate.dragStart(o,d),this.mousePitch&&this.mousePitch.dragStart(o,d),C.disableDrag()}startTouch(o,d){this.touchRotate.dragStart(o,d),this.touchPitch&&this.touchPitch.dragStart(o,d),C.disableDrag()}moveMouse(o,d){const m=this.map,{bearingDelta:y}=this.mouseRotate.dragMove(o,d)||{};if(y&&m.setBearing(m.getBearing()+y),this.mousePitch){const{pitchDelta:x}=this.mousePitch.dragMove(o,d)||{};x&&m.setPitch(m.getPitch()+x)}}moveTouch(o,d){const m=this.map,{bearingDelta:y}=this.touchRotate.dragMove(o,d)||{};if(y&&m.setBearing(m.getBearing()+y),this.touchPitch){const{pitchDelta:x}=this.touchPitch.dragMove(o,d)||{};x&&m.setPitch(m.getPitch()+x)}}off(){const o=this.element;C.removeEventListener(o,"mousedown",this.mousedown),C.removeEventListener(o,"touchstart",this.touchstart,{passive:!1}),C.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.removeEventListener(window,"touchend",this.touchend),C.removeEventListener(o,"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,o,d){const m=new l.N(v.lng,v.lat);if(v=new l.N(v.lng,v.lat),o){const y=new l.N(v.lng-360,v.lat),x=new l.N(v.lng+360,v.lat),M=d.locationPoint(v).distSqr(o);d.locationPoint(y).distSqr(o)<M?v=y:d.locationPoint(x).distSqr(o)<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,o,d){const m=v.classList;for(const y in Ya)m.remove(`maplibregl-${d}-anchor-${y}`);m.add(`maplibregl-${d}-anchor-${o}`)}class Au extends l.E{constructor(o){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=o&&o.anchor||"center",this._color=o&&o.color||"#3FB1CE",this._scale=o&&o.scale||1,this._draggable=o&&o.draggable||!1,this._clickTolerance=o&&o.clickTolerance||0,this._subpixelPositioning=o&&o.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=o&&o.rotation||0,this._rotationAlignment=o&&o.rotationAlignment||"auto",this._pitchAlignment=o&&o.pitchAlignment&&o.pitchAlignment!=="auto"?o.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(o==null?void 0:o.opacity,o==null?void 0:o.opacityWhenCovered),o&&o.element)this._element=o.element,this._offset=l.P.convert(o&&o.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 P=C.createNS("http://www.w3.org/2000/svg","g");P.setAttributeNS(null,"transform","translate(3.0, 29.0)"),P.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),P.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 Z=C.createNS("http://www.w3.org/2000/svg","path");Z.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(Z);const J=C.createNS("http://www.w3.org/2000/svg","g");J.setAttributeNS(null,"transform","translate(6.0, 7.0)"),J.setAttributeNS(null,"fill","#FFFFFF");const ee=C.createNS("http://www.w3.org/2000/svg","g");ee.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 le=C.createNS("http://www.w3.org/2000/svg","circle");le.setAttributeNS(null,"fill","#FFFFFF"),le.setAttributeNS(null,"cx","5.5"),le.setAttributeNS(null,"cy","5.5"),le.setAttributeNS(null,"r","5.4999962"),ee.appendChild(re),ee.appendChild(le),M.appendChild(P),M.appendChild(N),M.appendChild(F),M.appendChild(J),M.appendChild(ee),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(o&&o.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"),o&&o.className)for(const d of o.className.split(" "))this._element.classList.add(d);this._popup=null}addTo(o){return this.remove(),this._map=o,this._element.setAttribute("aria-label",o._getUIString("Marker.Title")),o.getCanvasContainer().appendChild(this._element),o.on("move",this._update),o.on("moveend",this._update),o.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(o){return this._lngLat=l.N.convert(o),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(o){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),o){if(!("offset"in o.options)){const y=Math.abs(13.5)/Math.SQRT2;o.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=o,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(o){return this._subpixelPositioning=o,this}getPopup(){return this._popup}togglePopup(){const o=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:o?(o.isOpen()?o.remove():(o.setLngLat(this._lngLat),o.addTo(this._map)),this):this}_updateOpacity(o=!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(o)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 P=-this._offset.y/y.transform._pixelPerMeter,O=Math.sin(y.getPitch()*Math.PI/180)*P,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(o){return this._offset=l.P.convert(o),this._update(),this}addClassName(o){this._element.classList.add(o)}removeClassName(o){this._element.classList.remove(o)}toggleClassName(o){return this._element.classList.toggle(o)}setDraggable(o){return this._draggable=!!o,this._map&&(o?(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(o){return this._rotation=o||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(o){return this._rotationAlignment=o||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(o){return this._pitchAlignment=o&&o!=="auto"?o:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(o,d){return o===void 0&&d===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),o!==void 0&&(this._opacity=o),d!==void 0&&(this._opacityWhenCovered=d),this._map&&this._updateOpacity(!0),this}}const Im={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ql=0,ec=!1;const Io={maxWidth:100,unit:"metric"};function tc(v,o,d){const m=d&&d.maxWidth||100,y=v._container.clientHeight/2,x=v.unproject([0,y]),M=v.unproject([m,y]),P=x.distanceTo(M);if(d&&d.unit==="imperial"){const O=3.2808*P;O>5280?ft(o,m,O/5280,v._getUIString("ScaleControl.Miles")):ft(o,m,O,v._getUIString("ScaleControl.Feet"))}else d&&d.unit==="nautical"?ft(o,m,P/1852,v._getUIString("ScaleControl.NauticalMiles")):P>=1e3?ft(o,m,P/1e3,v._getUIString("ScaleControl.Kilometers")):ft(o,m,P,v._getUIString("ScaleControl.Meters"))}function ft(v,o,d,m){const y=function(x){const M=Math.pow(10,`${Math.floor(x)}`.length-1);let P=x/M;return P=P>=10?10:P>=5?5:P>=3?3:P>=2?2:P>=1?1:function(O){const N=Math.pow(10,Math.ceil(-Math.log(O)/Math.LN10));return Math.round(O*N)/N}(P),M*P}(d);v.style.width=o*(y/d)+"px",v.innerHTML=`${y}&nbsp;${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 o=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(o,o),"top-right":new l.P(-o,o),bottom:new l.P(0,-v),"bottom-left":new l.P(o,-o),"bottom-right":new l.P(-o,-o),left:new l.P(v,0),right:new l.P(-v,0)}}if(v instanceof l.P||Array.isArray(v)){const o=l.P.convert(v);return{center:o,top:o,"top-left":o,"top-right":o,bottom:o,"bottom-left":o,"bottom-right":o,left:o,right:o}}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=vi,u.CooperativeGesturesHandler=qa,u.DoubleClickZoomHandler=Ks,u.DragPanHandler=Em,u.DragRotateHandler=Cm,u.EdgeInsets=$a,u.FullscreenControl=class extends l.E{constructor(v={}){super(),this._onFullscreenChange=()=>{var o;let d=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((o=d==null?void 0:d.shadowRoot)===null||o===void 0)&&o.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=o=>{if(this._map){if(this._isOutOfMapMaxBounds(o))return this._setErrorState(),this.fire(new l.k("outofmaxbounds",o)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=o,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(o),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(o),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new l.k("geolocate",o)),this._finish()}},this._updateCamera=o=>{const d=new l.N(o.coords.longitude,o.coords.latitude),m=o.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=o=>{if(o){const d=new l.N(o.coords.longitude,o.coords.latitude);this._accuracyCircleMarker.setLngLat(d).addTo(this._map),this._userLocationDotMarker.setLngLat(d).addTo(this._map),this._accuracy=o.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=o=>{if(this._map){if(this.options.trackUserLocation)if(o.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(o.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",o)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",o=>o.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=o=>{if(this._map){if(o===!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({},Im,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*(o=!1){if(br!==void 0&&!o)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(o=>this._finishSetupUI(o)),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 o=this._map.getMaxBounds(),d=v.coords;return o&&(d.longitude<o.getWest()||d.longitude>o.getEast()||d.latitude<o.getSouth()||d.latitude>o.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(),o=v.getSouthEast(),d=v.getNorthEast(),m=o.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=xi,u.KeyboardHandler=Lr,u.LngLatBounds=we,u.LogoControl=Od,u.Map=class extends Tm{constructor(v){l.bf.mark(l.bg.create);const o=Object.assign(Object.assign({},E_),v);if(o.minZoom!=null&&o.maxZoom!=null&&o.minZoom>o.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(o.minPitch!=null&&o.maxPitch!=null&&o.minPitch>o.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(o.minPitch!=null&&o.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(o.maxPitch!=null&&o.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ja(o.minZoom,o.maxZoom,o.minPitch,o.maxPitch,o.renderWorldCopies),{bearingSnap:o.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Qt,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=o.interactive,this._maxTileCacheSize=o.maxTileCacheSize,this._maxTileCacheZoomLevels=o.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=o.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=o.preserveDrawingBuffer===!0,this._antialias=o.antialias===!0,this._trackResize=o.trackResize===!0,this._bearingSnap=o.bearingSnap,this._refreshExpiredTiles=o.refreshExpiredTiles===!0,this._fadeDuration=o.fadeDuration,this._crossSourceCollisions=o.crossSourceCollisions===!0,this._collectResourceTiming=o.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Nd),o.locale),this._clickTolerance=o.clickTolerance,this._overridePixelRatio=o.pixelRatio,this._maxCanvasSize=o.maxCanvasSize,this.transformCameraUpdate=o.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=o.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=se.addThrottleControl(()=>this.isMoving()),this._requestManager=new Q(o.transformRequest),typeof o.container=="string"){if(this._container=document.getElementById(o.container),!this._container)throw new Error(`Container '${o.container}' not found.`)}else{if(!(o.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=o.container}if(o.maxBounds&&this.setMaxBounds(o.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,o),this._hash=o.hash&&new bu(typeof o.hash=="string"&&o.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch}),o.bounds&&(this.resize(),this.fitBounds(o.bounds,l.e({},o.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=o.localIdeographFontFamily,this._validateStyle=o.validateStyle,o.style&&this.setStyle(o.style,{localIdeographFontFamily:o.localIdeographFontFamily}),o.attributionControl&&this.addControl(new Ga(typeof o.attributionControl=="boolean"?void 0:o.attributionControl)),o.maplibreLogo&&this.addControl(new Od,o.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,o){if(o===void 0&&(o=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[o];return o.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 o=this._controls.indexOf(v);return o>-1&&this._controls.splice(o,1),v.onRemove(this),this}hasControl(v){return this._controls.indexOf(v)>-1}calculateCameraOptionsFromTo(v,o,d,m){return m==null&&this.terrain&&(m=this.terrain.getElevationForLngLatZoom(d,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(v,o,d,m)}resize(v){var o;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 P=this.painter.context.gl;this._maxCanvasSize=[P.drawingBufferWidth,P.drawingBufferHeight];const O=this._getClampedPixelRatio(m,y);this._resizeCanvas(m,y,O),this.painter.resize(m,y,O)}this.transform.resize(m,y),(o=this._requestedCameraState)===null||o===void 0||o.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,o){const{0:d,1:m}=this._maxCanvasSize,y=this.getPixelRatio(),x=v*y,M=o*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,o,d){if(v==="mouseenter"||v==="mouseover"){let m=!1;return{layers:o,listener:d,delegates:{mousemove:x=>{const M=o.filter(O=>this.getLayer(O)),P=M.length!==0?this.queryRenderedFeatures(x.point,{layers:M}):[];P.length?m||(m=!0,d.call(this,new Di(v,this,x.originalEvent,{features:P}))):m=!1},mouseout:()=>{m=!1}}}}if(v==="mouseleave"||v==="mouseout"){let m=!1;return{layers:o,listener:d,delegates:{mousemove:M=>{const P=o.filter(O=>this.getLayer(O));(P.length!==0?this.queryRenderedFeatures(M.point,{layers:P}):[]).length?m=!0:m&&(m=!1,d.call(this,new Di(v,this,M.originalEvent)))},mouseout:M=>{m&&(m=!1,d.call(this,new Di(v,this,M.originalEvent)))}}}}{const m=y=>{const x=o.filter(P=>this.getLayer(P)),M=x.length!==0?this.queryRenderedFeatures(y.point,{layers:x}):[];M.length&&(y.features=M,d.call(this,y),delete y.features)};return{layers:o,listener:d,delegates:{[v]:m}}}}_saveDelegatedListener(v,o){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[v]=this._delegatedListeners[v]||[],this._delegatedListeners[v].push(o)}_removeDelegatedListener(v,o,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===o.length&&x.layers.every(M=>o.includes(M))){for(const M in x.delegates)this.off(M,x.delegates[M]);return void m.splice(y,1)}}}on(v,o,d){if(d===void 0)return super.on(v,o);const m=this._createDelegatedListener(v,typeof o=="string"?[o]:o,d);this._saveDelegatedListener(v,m);for(const y in m.delegates)this.on(y,m.delegates[y]);return this}once(v,o,d){if(d===void 0)return super.once(v,o);const m=typeof o=="string"?[o]:o,y=this._createDelegatedListener(v,m,d);for(const x in y.delegates){const M=y.delegates[x];y.delegates[x]=(...P)=>{this._removeDelegatedListener(v,m,d),M(...P)}}this._saveDelegatedListener(v,y);for(const x in y.delegates)this.once(x,y.delegates[x]);return this}off(v,o,d){return d===void 0?super.off(v,o):(this._removeDelegatedListener(v,typeof o=="string"?[o]:o,d),this)}queryRenderedFeatures(v,o){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(o=o||(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,o,this.transform)}querySourceFeatures(v,o){return this.style.querySourceFeatures(v,o)}setStyle(v,o){return(o=l.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},o)).diff!==!1&&o.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&v?(this._diffStyle(v,o),this):(this._localIdeographFontFamily=o.localIdeographFontFamily,this._updateStyle(v,o))}setTransformRequest(v){return this._requestManager.setTransformRequest(v),this}_getUIString(v){const o=this._locale[v];if(o==null)throw new Error(`Missing UI string '${v}'`);return o}_updateStyle(v,o){if(o.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(v,o));const d=this.style&&o.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!v)),v?(this.style=new nu(this,o||{}),this.style.setEventedParent(this,{style:this.style}),typeof v=="string"?this.style.loadURL(v,o,d):this.style.loadJSON(v,o,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,o){if(typeof v=="string"){const d=this._requestManager.transformRequest(v,"Style");l.h(d,new AbortController).then(m=>{this._updateDiff(m.data,o)}).catch(m=>{m&&this.fire(new l.j(m))})}else typeof v=="object"&&this._updateDiff(v,o)}_updateDiff(v,o){try{this.style.setState(v,o)&&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,o)}}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,o){return this._lazyInitEmptyStyle(),this.style.addSource(v,o),this._update(!0)}isSourceLoaded(v){const o=this.style&&this.style.sourceCaches[v];if(o!==void 0)return o.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 o=this.style.sourceCaches[v.source];if(!o)throw new Error(`cannot load terrain, because there exists no source with ID: ${v.source}`);this.terrain===null&&o.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 zd(this.painter,o,v),this.painter.renderToTexture=new Mm(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,o;return(o=(v=this.terrain)===null||v===void 0?void 0:v.options)!==null&&o!==void 0?o:null}areTilesLoaded(){const v=this.style&&this.style.sourceCaches;for(const o in v){const d=v[o]._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,o,d={}){const{pixelRatio:m=1,sdf:y=!1,stretchX:x,stretchY:M,content:P,textFitWidth:O,textFitHeight:N}=d;if(this._lazyInitEmptyStyle(),!(o instanceof HTMLImageElement||l.b(o))){if(o.width===void 0||o.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:Z}=o,J=o;return this.style.addImage(v,{data:new l.R({width:V,height:F},new Uint8Array(Z)),pixelRatio:m,stretchX:x,stretchY:M,content:P,textFitWidth:O,textFitHeight:N,sdf:y,version:0,userImage:J}),J.onAdd&&J.onAdd(this,v),this}}{const{width:V,height:F,data:Z}=E.getImageData(o);this.style.addImage(v,{data:new l.R({width:V,height:F},Z),pixelRatio:m,stretchX:x,stretchY:M,content:P,textFitWidth:O,textFitHeight:N,sdf:y,version:0})}}updateImage(v,o){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=o instanceof HTMLImageElement||l.b(o)?E.getImageData(o):o,{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 P=!(o instanceof HTMLImageElement||l.b(o));return d.data.replace(M,P),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 se.getImage(this._requestManager.transformRequest(v,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(v,o){return this._lazyInitEmptyStyle(),this.style.addLayer(v,o),this._update(!0)}moveLayer(v,o){return this.style.moveLayer(v,o),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,o,d){return this.style.setLayerZoomRange(v,o,d),this._update(!0)}setFilter(v,o,d={}){return this.style.setFilter(v,o,d),this._update(!0)}getFilter(v){return this.style.getFilter(v)}setPaintProperty(v,o,d,m={}){return this.style.setPaintProperty(v,o,d,m),this._update(!0)}getPaintProperty(v,o){return this.style.getPaintProperty(v,o)}setLayoutProperty(v,o,d,m={}){return this.style.setLayoutProperty(v,o,d,m),this._update(!0)}getLayoutProperty(v,o){return this.style.getLayoutProperty(v,o)}setGlyphs(v,o={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(v,o),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(v,o,d={}){return this._lazyInitEmptyStyle(),this.style.addSprite(v,o,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,o={}){return this._lazyInitEmptyStyle(),this.style.setSprite(v,o,d=>{d||this._update(!0)}),this}setLight(v,o={}){return this._lazyInitEmptyStyle(),this.style.setLight(v,o),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,o){return this.style.setFeatureState(v,o),this._update()}removeFeatureState(v,o){return this.style.removeFeatureState(v,o),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,o=0;return this._container&&(v=this._container.clientWidth||400,o=this._container.clientHeight||300),[v,o]}_setupContainer(){const v=this._container;v.classList.add("maplibregl-map");const o=this._canvasContainer=C.create("div","maplibregl-canvas-container",v);this._interactive&&o.classList.add("maplibregl-interactive"),this._canvas=C.create("canvas","maplibregl-canvas",o),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,o,d){this._canvas.width=Math.floor(d*v),this._canvas.height=Math.floor(d*o),this._canvas.style.width=`${v}px`,this._canvas.style.height=`${o}px`}_setupPainter(){const v={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let o=null;this._canvas.addEventListener("webglcontextcreationerror",m=>{o={requestedAttributes:v},m&&(o.statusMessage=m.statusMessage,o.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 o?(o.message=m,new Error(JSON.stringify(o))):new Error(m)}this.painter=new _u(d,this.transform),I.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 o=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:o,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),P=M.crossFadingFactor();P===1&&P===this._crossFadingFactor||(d=!0,this._crossFadingFactor=P),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,o,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:o,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),se.removeThrottleControl(this._imageQueueHandle),(v=this._resizeObserver)===null||v===void 0||v.disconnect();const o=this.painter.context.gl.getExtension("WEBGL_lose_context");o!=null&&o.loseContext&&o.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 Am}getCameraTargetElevation(){return this.transform.elevation}},u.MapMouseEvent=Di,u.MapTouchEvent=Ys,u.MapWheelEvent=wm,u.Marker=Au,u.NavigationControl=class{constructor(v){this._updateZoomButtons=()=>{const o=this._map.getZoom(),d=o===this._map.getMaxZoom(),m=o===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 o=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=o},this._setButtonTitle=(o,d)=>{const m=this._map._getUIString(`NavigationControl.${d}`);o.title=m,o.setAttribute("aria-label",m)},this.options=l.e({},C_,v),this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",o=>o.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",o=>this._map.zoomIn({},{originalEvent:o})),C.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",o=>this._map.zoomOut({},{originalEvent:o})),C.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",o=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:o}):this._map.resetNorth({},{originalEvent:o})}),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 T_(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,o){const d=C.create("button",v,this._container);return d.type="button",d.addEventListener("click",o),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=o=>{this._update(o.point)},this._onMouseMove=o=>{this._update(o.point)},this._onDrag=o=>{this._update(o.point)},this._update=o=>{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 P of this.options.className.split(" "))this._container.classList.add(P);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&&!o)return;const m=this._flatPos=this._pos=this._trackPointer&&o?o:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&o?o:this._map.transform.locationPoint(this._lngLat));let y=this.options.anchor;const x=Pu(this.options.offset);if(!y){const P=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<P/2?N.push("left"):m.x>this._map.transform.width-P/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 o=document.createDocumentFragment(),d=document.createElement("body");let m;for(d.innerHTML=v;m=d.firstChild,m;)o.appendChild(m);return this.setDOMContent(o)}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="&#215;",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=sn,u.RasterTileSource=jt,u.ScaleControl=class{constructor(v){this._onMove=()=>{tc(this._map,this._container,this.options)},this.setUnit=o=>{this.options.unit=o,tc(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Io),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=to,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,o)=>l._(void 0,void 0,void 0,function*(){if(Co(v))throw new Error(`A source type called "${v}" already exists.`);((d,m)=>{Eo[d]=m})(v,o)}),u.clearPrewarmedResources=function(){const v=Te;v&&(v.isPreloaded()&&v.numActive()===1?(v.release(Nn),Te=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 zr().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 Nt().broadcast("IS",v)},u.prewarm=function(){De().acquire(Nn)},u.setMaxParallelImageRequests=function(v){l.a.MAX_PARALLEL_IMAGE_REQUESTS=v},u.setRTLTextPlugin=function(v,o){return zr().setRTLTextPlugin(v,o)},u.setWorkerCount=function(v){Pn.workerCount=v},u.setWorkerUrl=function(v){l.a.WORKER_URL=v}});var a=n;return a})})(W1);var TB=W1.exports;const MB=EB(TB),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 AB(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,I,D,R,$,G,q,se,Q,Se,_e;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)||((I=t.style)==null?void 0:I.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=(Ce,Le)=>`${Ce==null?void 0:Ce.split("+")[0]}+${Le.replace("#","")}.png`;if(t.legendAuto={icon:[],color:[]},($=t.style)!=null&&$.iconAttr&&r){const Ce=(q=(G=t.meta)==null?void 0:G.columns)==null?void 0:q.find(Ie=>{var Ue;return Ie.name===((Ue=t==null?void 0:t.style)==null?void 0:Ue.iconAttr)}),Le=(Ce==null?void 0:Ce.values)||await rt.get(`/api-user/gis-ir/${t.id}/${(se=t.style)==null?void 0:se.iconAttr}`).then(Ie=>Ie.data.rows);if(Le!=null&&Le.length){const Ie=r.replace("{{color}}",l.length?l:AB(l)||[0]).split("+")[1].split(/[.-]/)[0];Le.forEach((Ue,Je)=>{var It;return Ue.icon=(It=Ue.icon)!=null&&It.includes("png")?Ue.icon:`${a}-${u}-${Ue.data||Ue.icon||`ub-${Je}`}+${r!=null&&r.includes("circle")?"ddd-222":Ie}.png`}),r=r!=null&&r.includes("{{")?`${a}-${u}-fa-question+0c53ad.png`:r,t.legendAuto.iconText=(Ce==null?void 0:Ce.title)||t.style.iconAttr,Le.forEach(Ue=>t.legendAuto.icon.push(Ue)),t.legendAuto.icon.push({icon:r,text:"Не визначено"}),t.style.iconArr=["match",["get",t.style.iconAttr]].concat(Le.filter(Ue=>Ue.id).reduce((Ue,Je)=>Ue.concat([Je.id,Je.icon]),[])).concat([r]),await Promise.all(Le.map(Ue=>Ue.icon).map(Ue=>$p(Ue,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 Ce=(Se=(Q=t.meta)==null?void 0:Q.columns)==null?void 0:Se.find(Ie=>Ie.name===i),Le=(Ce==null?void 0:Ce.values)||await rt.get(`/api-user/gis-ir/${t.id}/${i}`).then(Ie=>Ie.data.rows);t.style.color=Le!=null&&Le.length?["match",["get",i]].concat(Le.filter(Ie=>Ie.id).reduce((Ie,Ue,Je)=>Ie.concat([Ue.id,Ue.color||Fp[Je]]),[])).concat(["#aaa"]):l,t.style.colorArr=t.style.color,t.legendAuto.colorText=(Ce==null?void 0:Ce.title)||i,Le.forEach(Ie=>t.legendAuto.color.push(Ie)),t.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),!((_e=t.style)!=null&&_e.iconAttr)&&!(r!=null&&r.includes("+sdf"))&&r&&(Le.forEach((Ie,Ue)=>Ie.icon=b(r,Ie.color||Fp[Ue])),t.style.iconArr=["match",["get",i]].concat(Le.filter(Ie=>Ie.id).reduce((Ie,Ue)=>Ie.concat([Ue.id,Ue.icon]),[])).concat([b(r,g)]),await Promise.all(Le.map(Ie=>Ie.icon).map(Ie=>$p(Ie,n))))}if(r&&!(r!=null&&r.includes("{"))){const Ce=e!=null&&e.colorAttr?b(r,g):r;await $p(Ce,n)}const k=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}:{},...k?{"icon-size":k||!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(k=>k.name===i))==null?void 0:l.values)||await rt.get(`/api-user/gis-ir/${t.id}/${i}`).then(k=>k.data.rows);t.legendAuto={color:[]},b.forEach(k=>t.legendAuto.color.push(k)),t.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),t.style.color=b?["match",["get",i]].concat(b.filter(k=>k.id).reduce((k,E,C)=>k.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 IB(t,e,n){var l,g,b,k,E,C,I,D,R,$,G,q;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,se=>se.source).forEach(se=>{se.lsource=`${e.id}-${se.source}`});const i=((k=e==null?void 0:e.style)==null?void 0:k.type)||((G=((I=(C=(E=e==null?void 0:e.meta)==null?void 0:E.geom)==null?void 0:C.geometry)==null?void 0:I.length)>2?["point"]:[(($=(R=(D=e==null?void 0:e.meta)==null?void 0:D.geom)==null?void 0:R.geometry)==null?void 0:$[0].toLowerCase())||"point"])==null?void 0:G.map(se=>{var Q;return(Q=se==null?void 0:se.replace)==null?void 0:Q.call(se,"multi","")})),r=Array.isArray(i)?i:[i],a=(await Promise.all(Array.isArray(e==null?void 0:e.style)?e.style.map(async se=>{var Q;return(Q=Cr[se.type])==null?void 0:Q.call(Cr,e,se,n)}):r.map(async se=>{var Q;return(Q=Cr[se])==null?void 0:Q.call(Cr,e,e.style,n)}))).reduce((se,Q)=>Q?se.concat(Q):se,[]);a.forEach((se,Q)=>{se.id=`${se.id}-${Q}`});const u=a;return(e.service==="vtile"||(q=e.url)!=null&&q.includes(".vmt"))&&u.forEach(se=>{se.layout||(se.layout={}),se.layout.visibility="visible",se["source-layer"]=se.lsource||e.data||t}),u}const PB={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 rt.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 rt.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,k,E;const{map:i}=this,r=await IB(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 I={...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(I),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(I)});const u=r.map(C=>C.type).filter(C=>C&&C!=="symbol");(E=(k=t==null?void 0:t.meta)==null?void 0:k.geom)!=null&&E.geometry&&t.meta.geom.geometry.filter(I=>!u.includes(this.geometryByType(I,!0))).forEach(I=>{this.createStyleObj({type:I,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 rt.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 rt.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)}}},DB={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}}},OB={key:0,class:"vsTailwind map-popup__vertical"},BB={class:"mb-1"},zB={class:"text-sm"},NB={key:1,class:"map__popup-body"},RB=["innerHTML"],LB={key:1};function VB(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",OB,[(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",BB,f.toDisplayString(a.rowTitle(u)),1),f.createElementVNode("div",zB,f.toDisplayString(a.rowValue(u)),1)]))),128))])):(f.openBlock(),f.createElementBlock("table",NB,[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,RB)):(f.openBlock(),f.createElementBlock("td",LB,e[0]||(e[0]=[f.createElementVNode("div",{class:"text-red-500"}," Не визначено ",-1)])))])),[[f.vShow,!a.rowValue(u).includes("id")]])),128))])]))],4)}const FB=$e(DB,[["render",VB],["__scopeId","data-v-3f5a9aff"]]),G1={width:200,show:!0,position:"horizontal"},$B={components:{VsPopupBody:FB},props:{aviableFields:{type:Array,default:()=>[]},mapRef:{type:[Object,Array],default:()=>{}},object:{type:[Object,Array],default:()=>{}}},data(){return{objectData:[],popupSettings:G1}},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,k,E,C,I;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)||G1),!(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 se,Q,Se,_e;const R={},G=Object.assign({values:[]},i.find(Ce=>Ce.name===D));typeof G.values!="object"&&console.warn(`Warning: Layer ${t.source} has key "values" which is not an object in meta!`);const q=G!=null&&G.values&&((se=G==null?void 0:G.values)==null?void 0:se.find(Ce=>(Ce==null?void 0:Ce.id)==t.properties[D]))||null;return R.value=(G==null?void 0:G.format)==="select"?this.formatBadge({text:(q==null?void 0:q.text)||((Q=t.properties)==null?void 0:Q[`${D}__text`])||((Se=t.properties)==null?void 0:Se[D])||"-",color:(q==null?void 0:q.color)||"#1989FA"}):(q==null?void 0:q.text)||((_e=t.properties)==null?void 0:_e[`${D}__text`])||t.properties[D],R.column=D,R.title=(G==null?void 0:G[window==null?void 0:window.lang])||(G==null?void 0:G.ua)||(G==null?void 0:G.title)||D,R});this.objectData=[...r,{value:((k=t.properties)==null?void 0:k.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,...((I=n==null?void 0:n.popup)==null?void 0:I.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}}},jB={key:0},UB={key:0},HB=["src","alt"],qB={key:1},WB={class:"text-left text-sm m-b-sm"},GB={key:1,class:"text-center"};function ZB(t,e,n,i,r,a){var l,g,b,k,E,C,I,D,R,$,G;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(q=>q.column!=="image").length?(f.openBlock(),f.createElementBlock("div",jB,[a.getImage&&((g=a.getImage)!=null&&g.value)?(f.openBlock(),f.createElementBlock("div",UB,[f.createElementVNode("img",{class:"popup-image",src:"files/"+a.getImage.value,alt:a.getImage.column},null,8,HB)])):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",qB,[(b=a.noInfoObject())!=null&&b.column?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[f.createElementVNode("b",WB,f.toDisplayString(a.noInfoObject().title),1),f.createElementVNode("div",null,[f.createElementVNode("b",null,f.toDisplayString(((E=(k=a.noInfoObject())==null?void 0:k.column)==null?void 0:E.ua)||((I=(C=a.noInfoObject())==null?void 0:C.column)==null?void 0:I.title))+":",1),f.createTextVNode(" "+f.toDisplayString(((G=(D=n.object)==null?void 0:D.properties)==null?void 0:G[($=(R=a.noInfoObject())==null?void 0:R.column)==null?void 0:$.name])||"-"),1)])],64)):(f.openBlock(),f.createElementBlock("div",GB,f.toDisplayString(a.noInfoObject().title),1))]))],2)}const YB=$e($B,[["render",ZB],["__scopeId","data-v-deb51e0a"]]),{Map:XB,NavigationControl:KB,Popup:JB}=MB,QB={mixins:[PB],components:{VsMapPopup:YB},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 XB({container:this.mapId,style:t,center:[0,0],zoom:1,interactive:!0});e.addControl(new KB({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:"&copy; <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, &copy; <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 JB({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 k,E;const b=t.queryRenderedFeatures(g.point).filter(C=>{var R,$,G;const I=this.layerList.find(q=>q.id===C.source),D=(($=(R=I==null?void 0:I.setting)==null?void 0:R.popup)==null?void 0:$.show)===void 0?!0:I.setting.popup.show;if((this.interactiveSources.includes(C.source)&&!((G=C.properties)!=null&&G.cluster)&&D||!I&&Object.keys(C.properties).length)&&!e.includes(C.source))return C}).filter(C=>{var I,D;return!((D=(I=C.layer)==null?void 0:I.layout)!=null&&D["text-field"])});b.length&&this.popupVisible?(this.features=(b==null?void 0:b[0])||null,(k=this.popup.map)==null||k.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})}}},ez={class:"relative"},tz=["id"];function nz(t,e,n,i,r,a){const u=f.resolveComponent("VsMapPopup");return f.openBlock(),f.createElementBlock("div",ez,[f.createElementVNode("div",{id:r.mapId,style:f.normalizeStyle({height:n.height})},null,12,tz),f.createVNode(u,{ref:"popup",object:r.features,"map-ref":a.mapRef},null,8,["object","map-ref"])])}const iz=$e(QB,[["render",nz]]),Qo="widget-map-source",rz={components:{VsMap:iz},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(Qo);if(this.zoomToGeometry(e),n){n.setData(e);return}t.addSource(Qo,{type:"geojson",data:e}),t.addLayer({id:`${Qo}-point`,type:"circle",source:Qo,paint:{"circle-radius":10,"circle-color":"#F84C4C"},filter:["==","$type","Point"]}),t.addLayer({id:`${Qo}-polygon`,type:"fill",source:Qo,layout:{},paint:{"fill-color":"#0080ff","fill-opacity":.5},filter:["==","$type","Polygon"]}),t.addLayer({id:`${Qo}-polygon-line`,type:"line",source:Qo,layout:{},paint:{"line-color":"#0080ff","line-width":2},filter:["==","$type","Polygon"]}),t.addLayer({id:`${Qo}-line`,type:"line",source:Qo,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 q1(t);if(!n)throw new Error("Unknown geometry type!");return n==="FeatureCollection"?t:(n==="Feature"&&(e=[t]),!["FeatureCollection","Feature"].includes(n)&&(e=[CB(t)]),q1(e))},zoomToGeometry(t){const{map:e}=this,n=kB(t);e.fitBounds(n,{zoom:this.zoom,padding:30,duration:0})}}};function oz(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 Z1=$e(rz,[["render",oz]]),lt=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),ly=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)&&(ly(t)?t:jp(t.parentElement,e))},es=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},cy=t=>`${t||""}`.split(" ").filter(e=>!!e),ts=(t,e,n)=>{t&&cy(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 sz{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 Y1(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function X1(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const uy=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}),uy(u)?Object.assign(t[a],Tr(l,u)):Array.isArray(u)?Object.assign(t,{[a]:[...u]}):Object.assign(t,{[a]:u})})}return t},hy=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=hy(e,this.options);return i&&typeof i=="function"&&(i=i.call(this,this,...n)),i}optionFor(e,n,i,...r){let a=hy(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=hy(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 dy 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 Ps=["a","b","c","d","e","f"],K1={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"},az={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:K1},J1='<circle cx="25" cy="25" r="20"></circle>',py='<div class="f-spinner"><svg viewBox="0 0 50 50">'+J1+J1+"</svg></div>",Mr=t=>t&&t!==null&&t instanceof Element&&"nodeType"in t,En=(t,e)=>{t&&cy(e).forEach(n=>{t.classList.remove(n)})},Ct=(t,e)=>{t&&cy(e).forEach(n=>{t.classList.add(n)})},Hp={a:1,b:0,c:0,d:1,e:0,f:0},lz=1e5,qp=1e4,po="mousemove",Q1="drag",ev="content",fo="auto";let fy=null,my=null;class ua extends dy{get fits(){return this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1}get isTouchDevice(){return my===null&&(my=window.matchMedia("(hover: none)").matches),my}get isMobile(){return fy===null&&(fy=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),fy}get panMode(){return this.options.panMode!==po||this.isTouchDevice?Q1:po}get panOnlyZoomed(){const e=this.options.panOnlyZoomed;return e===fo?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 Ps){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=es(py);!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(ev);let i=this.option(ev)||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((k,E)=>k-E),b=g.findIndex(k=>k>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 sz(e,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener(po,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(po,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 Ps)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 Ps)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,k=l.max,E=g.min,C=g.max;let I=0,D=0;return b!==1/0&&r<b?I=b-r:k!==1/0&&r>k&&(I=k-r),E!==1/0&&a<E?D=E-a:C!==1/0&&a>C&&(D=C-a),Math.abs(I)<1e-4&&(I=0),Math.abs(D)<1e-4&&(D=0),Object.assign(Object.assign({},u),{xDiff:I,yDiff:D,inBounds:!I&&!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 k=!(n instanceof HTMLImageElement)&&(window.getComputedStyle(n).maxWidth==="none"||window.getComputedStyle(n).maxHeight==="none"),E=k?u:r,C=k?l:a,I=this.getMatrix(e),D=new DOMPoint(0,0).matrixTransform(I),R=new DOMPoint(0+E,0).matrixTransform(I),$=new DOMPoint(0+E,0+C).matrixTransform(I),G=new DOMPoint(0,0+C).matrixTransform(I),q=Math.abs($.x-D.x),se=Math.abs($.y-D.y),Q=Math.abs(G.x-R.x),Se=Math.abs(G.y-R.y);g=Math.max(q,Q),b=Math.max(se,Se)}return{contentWidth:g,contentHeight:b}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||this.panMode===po||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 Ps)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 I=window.getSelection();return I&&I.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 I=l.panzoomChange,D=l.panzoomAction;if((I||D)&&e.preventDefault(),I){let R={};try{R=JSON.parse(I)}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 k=I=>{this.option("zoom",e)&&I&&typeof I=="string"&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(I)&&typeof this[I]=="function"&&(e.preventDefault(),this[I]({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&&k(E)):(this.emit("dblClick",e),e.defaultPrevented||k(C)),this.clicks=0,this.clickTimer=null},350))):(this.emit("click",e),!e.defaultPrevented&&E&&k(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===po&&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&&lt(this.targetScale)<=lt(this.minScale)||(this.emit("touchMove",e),e.defaultPrevented))return;this.addTrackingPoint(n[0]);const{content:r}=this,a=X1(i[0],i[1]),u=X1(n[0],n[1]);let l=0,g=0;if(n.length>1){const se=r.getBoundingClientRect();l=a.clientX-se.left-.5*se.width,g=a.clientY-se.top-.5*se.height}const b=Y1(i[0],i[1]),k=Y1(n[0],n[1]);let E=b?k/b:1,C=u.clientX-a.clientX,I=u.clientY-a.clientY;this.dragOffset.x+=C,this.dragOffset.y+=I,this.dragOffset.time=Date.now()-this.dragStart.time;let D=lt(this.targetScale)===lt(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 se=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=se>45&&se<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,C=0,I=0}else this.lockedAxis=D;if(jp(e.target,this.content)&&(D="x",this.dragOffset.y=0),D&&D!=="xy"&&this.lockedAxis!==D&&lt(this.targetScale)===lt(this.minScale))return;e.cancelable&&e.preventDefault(),this.container.classList.add(this.cn("isDragging"));const R=this.checkBounds(C,I);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&&I<0||R.yDiff<0&&I>0)&&(I*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*R.yDiff)))):(R.xDiff&&(C=0),R.yDiff&&(I=0));const $=this.targetScale,G=this.minScale,q=this.maxScale;$<.5*G&&(E=Math.max(E,G)),$>1.5*q&&(E=Math.min(E,q)),this.lockedAxis==="y"&&lt($)===lt(G)&&(C=0),this.lockedAxis==="x"&&lt($)===lt(G)&&(I=0),this.applyChange({originX:l,originY:g,panX:C,panY:I,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 se of Ps)this.velocity[se]=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 k=0,E=0,C=0,I=0,D=this.option("decelFriction");const R=this.targetScale;if(g>0){C=Math.abs(u)>3?u/(g/30):0,I=Math.abs(l)>3?l/(g/30):0;const se=this.option("maxVelocity");se&&(C=Math.max(Math.min(C,se),-1*se),I=Math.max(Math.min(I,se),-1*se))}C&&(k=C/(1/(1-D)-1)),I&&(E=I/(1/(1-D)-1)),(this.option("lockAxis")==="y"||this.option("lockAxis")==="xy"&&this.lockedAxis==="y"&&lt(R)===this.minScale)&&(k=C=0),(this.option("lockAxis")==="x"||this.option("lockAxis")==="xy"&&this.lockedAxis==="x"&&lt(R)===this.minScale)&&(E=I=0);const $=this.dragOffset.x,G=this.dragOffset.y,q=this.option("dragMinThreshold")||0;Math.abs($)<q&&Math.abs(G)<q&&(k=E=0,C=I=0),(this.option("zoom")&&(R<this.minScale-1e-5||R>this.maxScale+1e-5)||n&&!k&&!E)&&(D=.35),this.applyChange({panX:k,panY:E,friction:D}),this.emit("decel",C,I,$,G)}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===po||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 $ of Ps){const G=$=="e"||$==="f"?qp:lz;a[$]=lt(e[$],G),Math.abs(n[$]-e[$])<($=="e"||$==="f"?.51:.001)&&(e[$]=n[$])}let{a:u,b:l,c:g,d:b,e:k,f:E}=a,C=`matrix(${u}, ${l}, ${g}, ${b}, ${k}, ${E})`,I=i.parentElement instanceof HTMLPictureElement?i.parentElement:i;if(this.option("transformParent")&&(I=I.parentElement||I),I.style.transform===C)return;I.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,k=l.height*i;const E=parseFloat(g.paddingTop)+parseFloat(g.paddingBottom),C=b-(parseFloat(g.paddingLeft)+parseFloat(g.paddingRight)),I=k-E;this.containerRect={width:b,height:k,innerWidth:C,innerHeight:I};const D=parseFloat(a.dataset.width||"")||(ot=>{let zt=0;return zt=ot instanceof HTMLImageElement?ot.naturalWidth:ot instanceof SVGElement?ot.width.baseVal.value:Math.max(ot.offsetWidth,ot.scrollWidth),zt||0})(a),R=parseFloat(a.dataset.height||"")||(ot=>{let zt=0;return zt=ot instanceof HTMLImageElement?ot.naturalHeight:ot instanceof SVGElement?ot.height.baseVal.value:Math.max(ot.offsetHeight,ot.scrollHeight),zt||0})(a);let $=this.option("width",D)||fo,G=this.option("height",R)||fo;const q=$===fo,se=G===fo;typeof $!="number"&&($=D),typeof G!="number"&&(G=R),q&&($=D*(G/R)),se&&(G=R/(D/$));let Q=a.parentElement instanceof HTMLPictureElement?a.parentElement:a;this.option("transformParent")&&(Q=Q.parentElement||Q);const Se=Q.getAttribute("style")||"";Q.style.setProperty("transform","none","important"),u&&(Q.style.width="",Q.style.height=""),Q.offsetHeight;const _e=a.getBoundingClientRect();let Ce=_e.width*i,Le=_e.height*i,Ie=Ce,Ue=Le;Ce=Math.min(Ce,$),Le=Math.min(Le,G),u?{width:Ce,height:Le}=((ot,zt,Xt,on)=>{const $t=Xt/ot,Kt=on/zt,Cn=Math.min($t,Kt);return{width:ot*=Cn,height:zt*=Cn}})($,G,Ce,Le):(Ce=Math.min(Ce,$),Le=Math.min(Le,G));let Je=.5*(Ue-Le),It=.5*(Ie-Ce);this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:_e.top-l.top+Je,bottom:l.bottom-_e.bottom+Je,left:_e.left-l.left+It,right:l.right-_e.right+It,fitWidth:Ce,fitHeight:Le,width:Ce,height:Le,fullWidth:$,fullHeight:G}),Q.style.cssText=Se,u&&(Q.style.width=`${Ce}px`,Q.style.height=`${Le}px`),this.setTransform(),e!==!0&&this.emit("refresh"),this.ignoreBounds||(lt(this.targetScale)<lt(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,k=0;const E=this.option("infinite");if(E===!0||r&&E===r)l=-1/0,b=1/0,g=-1/0,k=1/0;else{let{containerRect:C,contentRect:I}=this,D=lt(a*i,qp),R=lt(u*i,qp),{innerWidth:$,innerHeight:G}=C;if(C.width===D&&($=C.width),C.width===R&&(G=C.height),e>$){b=.5*(e-$),l=-1*b;let q=.5*(I.right-I.left);l+=q,b+=q}if(a>$&&e<$&&(l-=.5*(a-$),b-=.5*(a-$)),n>G){k=.5*(n-G),g=-1*k;let q=.5*(I.bottom-I.top);g+=q,k+=q}u>G&&n<G&&(l-=.5*(u-G),b-=.5*(u-G))}return{x:{min:l,max:b},y:{min:g,max:k}}}getBounds(){const e=this.option("bounds");return e!==fo?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(),k=e.canZoomOut(),E=i===Q1&&!!this.option("touch"),C=k&&E;if(E&&(lt(a)<lt(u)&&!this.panOnlyZoomed&&(C=!0),(lt(r.width,1)>lt(r.fitWidth,1)||lt(r.height,1)>lt(r.fitHeight,1))&&(C=!0)),lt(r.width*a,1)<lt(r.fitWidth,1)&&(C=!1),i===po&&(C=!1),ts(n,this.cn("isDraggable"),C),!this.option("zoom"))return;let I=b&&lt(l)>lt(a),D=!I&&!C&&k&&lt(l)<lt(a);ts(n,this.cn("canZoomIn"),I),ts(n,this.cn("canZoomOut"),D);for(const R of n.querySelectorAll("[data-panzoom-action]")){let $=!1,G=!1;switch(R.dataset.panzoomAction){case"zoomIn":b?$=!0:G=!0;break;case"zoomOut":k?$=!0:G=!0;break;case"toggleZoom":case"iterateZoom":b||k?$=!0:G=!0;const q=R.querySelector("g");q&&(q.style.display=b?"":"none")}$?(R.removeAttribute("disabled"),R.removeAttribute("tabindex")):G&&(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:k=!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:k})}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:k=!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=k;const{current:I}=this,D=I.e,R=I.f,$=this.getMatrix(this.target);let G=new DOMMatrix().translate(D,R).translate(a,u).translate(e,n);if(this.option("zoom")){if(!k){const q=this.targetScale,se=this.minScale,Q=this.maxScale;q*i<se&&(i=se/q),q*i>Q&&(i=Q/q)}G=G.scale(i)}G=G.translate(-a,-u).translate(-D,-R).multiply($),r&&(G=G.rotate(r)),g&&(G=G.scale(-1,1)),b&&(G=G.scale(1,-1));for(const q of Ps)q!=="e"&&q!=="f"&&(G[q]>this.minScale+1e-5||G[q]<this.minScale-1e-5)?this.target[q]=G[q]:this.target[q]=lt(G[q],qp);(this.targetScale<this.scale||Math.abs(i-1)>.1||this.panMode===po||E===!1)&&!k&&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 Ps)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!==po||!e||lt(this.targetScale)<=lt(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,k=(e.clientY||0)-g.top;let{contentWidth:E,contentHeight:C}=this.calculateContentDim(this.target);const I=this.option("mouseMoveFactor");I>1&&(E!==u&&(E*=I),C!==l&&(C*=I));let D=.5*(E-u)-b/u*100/100*(E-u);D+=.5*(a.right-a.left);let R=.5*(C-l)-k/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,k){return Math.abs(k)>Math.abs(b)?k:b});const r=Math.max(-1,Math.min(1,i)),{targetScale:a,maxScale:u,minScale:l}=this;let g=a*(100+45*r)/100;lt(g)<lt(l)&&lt(a)<=lt(l)?(this.cwd+=Math.abs(r),g=l):lt(g)>lt(u)&&lt(a)>=lt(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(),lt(g)!==lt(a)&&this.zoomTo(g,{event:e}))}canZoomIn(){return this.option("zoom")&&(lt(this.contentRect.width,1)<lt(this.contentRect.fitWidth,1)||lt(this.targetScale)<lt(this.maxScale))}canZoomOut(){return this.option("zoom")&&lt(this.targetScale)>lt(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=fo,originX:i=fo,originY:r=fo,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===po&&(a=this.pmme||a),a||i===fo||r===fo){const E=this.content.getBoundingClientRect(),C=this.container.getBoundingClientRect(),I=a?a.clientX:C.left+.5*C.width,D=a?a.clientY:C.top+.5*C.height;i=I-E.left-.5*E.width,r=D-E.top-.5*E.height}let k=1;typeof e=="number"?k=e:e==="full"?k=l:e==="cover"?k=b:e==="max"?k=g:e==="fit"?k=1:e==="next"&&(k=this.getNextScale("iterateZoom")),k=k/u||1,n=n===fo?k>1?.15:.25:n,this.applyChange({scale:k,originX:i,originY:r,friction:n}),a&&this.panMode===po&&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 Ps)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:az}),Object.defineProperty(ua,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const tv=function(t,e){let n=!0;return(...i)=>{n&&(n=!1,t(...i),setTimeout(()=>{n=!0},e))}},nv=(t,e)=>{let n=[];return t.childNodes.forEach(i=>{i.nodeType!==Node.ELEMENT_NODE||e&&!i.matches(e)||n.push(i)}),n},cz={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 di;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"})(di||(di={}));const gy=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)},uz=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class Vo extends Up{constructor(e,n){super(n),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:e})}attach(){}detach(){}}const hz={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 iv extends Vo{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(ts(g,this.cn("isDynamic"),!!u),l)for(let E=0;E<n;E++)g.append(this.createItem(E));let b,k=0;for(const E of[...g.children]){const C=k===this.instance.page;C&&(b=E),ts(E,this.cn("isCurrent"),C),(e=E.children[0])===null||e===void 0||e.setAttribute("aria-selected",C?"true":"false");for(const I of["isBeforePrev","isPrev","isNext","isAfterNext"])En(E,this.cn(I));k++}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 I=b.nextElementSibling,D=I&&I.nextElementSibling;Ct(I,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=es(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(iv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:hz});const Wp="disabled",Gp="next",rv="prev";class ov extends Vo{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?rv: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(rv)),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(ov,"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 sv extends Vo{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===di.Ready?this.onNavReady(e):e.on("ready",this.onNavReady),n.state===di.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 k=parseInt(b.dataset.index||"",10)||0,E=g.getPageForSlide(k),C=l.getPageForSlide(k);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(k)}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!==di.Ready||i.state!==di.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===di.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(sv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const dz={Navigation:ov,Dots:iv,Sync:sv},Zp="animationend",av="isSelected",Yp="slide";class ha extends dy{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===di.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:di.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=tv(this.slideNext.bind(this),150),this.slidePrev=tv(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&&uy(a))for(const[u,l]of Object.entries(a))window.matchMedia(u).matches&&uy(l)&&(r+=u,Tr(i,l));r===this.bp&&this.state!==di.Init||(this.bp=r,this.state===di.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!==di.Init&&this.destroy(),super.setOptions(i),this.option("enabled")===!1?this.attachEvents():setTimeout(()=>{this.init()},0))}init(){this.state=di.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=di.Ready,this.emit("ready")}initLayout(){const{container:e}=this,n=this.option("classes");Ct(e,this.cn("container")),ts(e,n.isLTR,!this.isRTL),ts(e,n.isRTL,this.isRTL),ts(e,n.isVertical,!this.isHorizontal),ts(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(...nv(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=[];[...nv(e,`.${this.cn(Yp)}`)].forEach(r=>{if(Mr(r)){const a=gy({el:r,isDom:!0,index:this.slides.length});i.push(a)}});for(let r of[...this.option("slides",[])||[],...n])i.push(gy(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(uz()),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((k,E)=>{var C;k.index=E,k.pos=((C=k.slides[0])===null||C===void 0?void 0:C.pos)||0,k.dim=0;for(const[I,D]of k.slides.entries())k.dim+=D.dim,I<k.slides.length-1&&(k.dim+=D.gap);l&&k.pos+.5*k.dim<.5*i?k.pos=0:l&&k.pos+.5*k.dim>=n-.5*i?k.pos=n-i:a&&(k.pos+=-.5*(i-k.dim))}),e.forEach(k=>{u&&!r&&n>i&&(k.pos=Math.max(k.pos,0),k.pos=Math.min(k.pos,n-i)),k.pos=lt(k.pos,1e3),k.dim=lt(k.dim,1e3),Math.abs(k.pos)<=.1&&(k.pos=0)}),r)return e;const g=[];let b;return e.forEach(k=>{const E=Object.assign({},k);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 k=l[this.isHorizontal?"offsetWidth":"offsetHeight"];k-1>a&&(a=k)}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:lt(a,1e3),gap:lt(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:k,panzoom:E}=this,C=0,I=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 se of k){const Q=se.el;Q?(e==="top"?(Q.style.right="",Q.style.left=""):Q.style.top="",se.index!==C?Q.style[e]=I===0?"":`${lt(I,1e3)}px`:Q.style[e]="",D+=se.dim+se.gap,C++):I+=se.dim+se.gap}if(r&&D&&a){let se=getComputedStyle(a),Q="padding",Se=n?"Right":"Bottom",_e=parseFloat(se[Q+(n?"Left":"Top")]);R-=_e,u+=_e,u+=parseFloat(se[Q+Se]);for(const Ce of k)Ce.el&&(lt(Ce.pos)<lt(u)&&lt(Ce.pos+Ce.dim+Ce.gap)<lt(R)&&lt(R)>lt(l-u)&&(Ce.el.style[e]=`${lt(I+D,1e3)}px`),lt(Ce.pos+Ce.gap)>=lt(l-u)&&lt(Ce.pos)>lt(R+u)&&lt(R)<lt(u)&&(Ce.el.style[e]=`-${lt(D,1e3)}px`))}let $,G,q=[...this.inTransition];if(q.length>1&&($=b[q[0]],G=b[q[1]]),$&&G){let se=0;for(const Q of k)Q.el?this.inTransition.has(Q.index)&&$.slides.indexOf(Q)<0&&(Q.el.style[e]=`${lt(se+($.pos-G.pos),1e3)}px`):se+=Q.dim+Q.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((k,E)=>{k.el&&u.push(E)});const l=e.index;let g=null;u.length&&(g=i[u.reduce((k,E)=>Math.abs(E-l)<Math.abs(k-l)?E:k)]);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(av);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 k=this.getPageFromIndex(e);if(!b||!g[k]||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[k].pos*(this.isRTL?1:-1);if(l===k&&Math.abs(C-b.target[this.axis])<1)return!1;this.clearTransitions();const I=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[k])===null||u===void 0?void 0:u.slides[0])||null;this.inTransition.add(R.index),this.createSlideEl(R);let $=D.el,G=R.el;I||n===Yp||(n="fadeFast",$=null);const q=this.isRTL?"next":"prev",se=this.isRTL?"prev":"next";return $&&(this.inTransition.add(D.index),D.transition=n,$.addEventListener(Zp,this.onAnimationEnd),$.classList.add(`f-${n}Out`,`to-${E>0?se:q}`)),G&&(R.transition=n,G.addEventListener(Zp,this.onAnimationEnd),G.classList.add(`f-${n}In`,`from-${E>0?q:se}`)),b.current[this.axis]=C,b.target[this.axis]=C,b.requestTick(),this.onChange(k),!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(av);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,k=0,E=.5*a;r&&n?(g<-E&&(k=-1,g+=u),g>u-E&&(k=1,g-=u)):(g>E&&(k=1,g-=u),g<-u+E&&(k=-1,g+=u)),k&&(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=es(py),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,k=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,!k)return;let I=this.page,D=u&&l?1:-1;const R=e.current[g]*D;let{pageIndex:$}=this.getPageFromPosition(R);Math.abs(C)>5?(b[I].dim<document.documentElement["client"+(this.isHorizontal?"Width":"Height")]-1&&(I=$),I=u&&l?C<0?I-1:I+1:C<0?I+1:I-1):I=r===0&&a===0?I:$,this.slideTo(I,{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=di.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===di.Destroy)return;e=parseInt((e||0).toString())||0;const r=this.getPageFromIndex(e),{axis:a,isHorizontal:u,isRTL:l,pages:g,panzoom:b}=this,k=g.length,E=l&&u?1:-1;if(!b||!k)return;if(this.page!==r){const I=new Event("beforeChange",{bubbles:!0,cancelable:!0});if(this.emit("beforeChange",I,e),I.defaultPrevented)return}if(this.transitionTo(e,i))return;let C=g[r].pos;if(this.isInfinite){const I=this.contentDim,D=b.target[a]*E;k===2?C+=I*Math.floor(parseFloat(e+"")/2):C=[C,C-I,C+I].reduce(function(R,$){return Math.abs($-D)<Math.abs(R-D)?$: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,k=this.contentDim<this.viewportDim;let E=Array.isArray(n)?n:[n];const C=[];for(const I of E)C.push(gy(I));this.slides.splice(e,0,...C);for(let I=0;I<this.slides.length;I++)this.slides[I].index=I;for(const I of C)this.emit("beforeInitSlide",I,I.index);if(this.page>=e&&(this.page+=C.length),this.updateMetrics(),l){const I=((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,$=this.isRTL?b-D:D-b,G=this.isRTL?g-I:I-g;k&&R===1?(e<=this.page&&(l.current[this.axis]-=$,l.target[this.axis]-=$),l.panTo({[this.isHorizontal?"x":"y"]:-1*I})):G&&e<=this.page&&(l.target[this.axis]-=G,l.current[this.axis]-=G,l.requestTick())}for(const I of C)this.emit("initSlide",I,I.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],lt(n.getBoundingClientRect()[l],1e3)),C=getComputedStyle(n),I="padding",D=a?"Right":"Bottom";E-=parseFloat(C[I+(a?"Left":"Top")])+parseFloat(C[I+D]),this.viewportDim=E}let b,k=0;for(const[E,C]of r.entries()){let I=0,D=0;!C.el&&b?(I=b.dim,D=b.gap):({dim:I,gap:D}=this.getSlideMetrics(C),b=C),I=lt(I,1e3),D=lt(D,1e3),C.dim=I,C.gap=D,C.pos=k,k+=I,(u||E<r.length-1)&&(k+=D)}k=lt(k,1e3),this.contentDim=k,e&&(e.contentRect[l]=k,e.contentRect[a?"fullWidth":"fullHeight"]=k),this.pages=this.createPages(),this.pages=this.processPages(),this.state===di.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=lt((g-l.pos)/(1*l.dim),1e3),k=b,E=b;this.isInfinite&&i!==!0&&(k=lt((g-l.pos+u)/(1*l.dim),1e3),E=lt((g-l.pos-u)/(1*l.dim),1e3));let C=[b,k,E].reduce(function(I,D){return Math.abs(D)<Math.abs(I)?D:I});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 k=b-u*e,E=b+u*(e+1),C=this.isInfinite?[-1,0,1]:[0];for(const I of this.slides)for(const D of C){const R=I.pos+D*a,$=R+I.dim+I.gap;R<E&&$>k&&i.add(I)}}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],k=r[g-1],E=this.option("center");let C=0,I=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*k.gap&&(R-=i,D=-1),R>k.pos+k.dim+.5*k.gap&&(R-=i,D=1)):R=Math.max(b.pos||0,Math.min(R,k.pos));let $=k,G=r.find(q=>{const se=q.pos-.5*$.gap,Q=q.pos+q.dim+.5*q.gap;return $=q,R>=se&&R<Q});return G||(G=k),I=this.getPageForSlide(G.index),C=I+D*l,{page:C,pageIndex:I}}setPageFromPosition(){const{pageIndex:e}=this.getPageFromPosition();this.onChange(e)}destroy(){if([di.Destroy].includes(this.state))return;this.state=di.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:cz}),Object.defineProperty(ha,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:dz});const lv=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 yy;const _y=["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(","),cv=t=>{if(t&&mh){yy===void 0&&document.createElement("div").focus({get preventScroll(){return yy=!0,!1}});try{if(yy)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{}}},uv=()=>{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},by={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({},K1),{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=P.createShader(P.FRAGMENT_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(te,ce),P.compileShader(te),!P.getShaderParameter(te,P.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${P.getShaderInfoLog(te)}`);P.attachShader(this.program,te);const me=P.createShader(P.VERTEX_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(me,he),P.compileShader(me),!P.getShaderParameter(me,P.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${P.getShaderInfoLog(me)}`);P.attachShader(this.program,me),this.attributes={};const ge={};this.numAttributes=V.length;for(let ve=0;ve<this.numAttributes;ve++)V[ve]&&(P.bindAttribLocation(this.program,ve,V[ve]),this.attributes[V[ve]]=ve);if(P.linkProgram(this.program),!P.getProgramParameter(this.program,P.LINK_STATUS))throw new Error(`Program failed to link: ${P.getProgramInfoLog(this.program)}`);P.deleteShader(me),P.deleteShader(te);for(let ve=0;ve<re.length;ve++){const Be=re[ve];if(Be&&!ge[Be]){const Fe=P.getUniformLocation(this.program,Be);Fe&&(ge[Be]=Fe)}}this.fixedUniforms=y(o,ge),this.terrainUniforms=((ve,Be)=>({u_depth:new l.aH(ve,Be.u_depth),u_terrain:new l.aH(ve,Be.u_terrain),u_terrain_dim:new l.aI(ve,Be.u_terrain_dim),u_terrain_matrix:new l.aJ(ve,Be.u_terrain_matrix),u_terrain_unpack:new l.aK(ve,Be.u_terrain_unpack),u_terrain_exaggeration:new l.aI(ve,Be.u_terrain_exaggeration)}))(o,ge),this.binderUniforms=m?m.getUniforms(o,ge):[]}draw(o,d,m,y,x,M,P,O,N,V,F,Z,J,ee,re,le,ce,he){const te=o.gl;if(this.failedToCreate)return;if(o.program.set(this.program),o.setDepthMode(m),o.setStencilMode(y),o.setColorMode(x),o.setCullFace(M),O){o.activeTexture.set(te.TEXTURE2),te.bindTexture(te.TEXTURE_2D,O.depthTexture),o.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(P[ge]);re&&re.setUniforms(o,this.binderUniforms,J,{zoom:ee});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 Z.get()){const ve=ge.vaos||(ge.vaos={});(ve[N]||(ve[N]=new Qh)).bind(o,this,V,re?re.getPaintVertexBuffers():[],F,ge.vertexOffset,le,ce,he),te.drawElements(d,ge.primitiveLength*me,te.UNSIGNED_SHORT,ge.primitiveOffset*me*2)}}}function iu(v,o,d){const m=1/Zt(d,1,o.transform.tileZoom),y=Math.pow(2,d.tileID.overscaledZ),x=d.tileSize*Math.pow(2,o.transform.tileZoom)/y,M=x*(d.tileID.canonical.x+d.tileID.wrap*y),P=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,P>>16],u_pixel_coord_lower:[65535&M,65535&P]}}const Vl=(v,o,d,m)=>{const y=o.style.light,x=y.properties.get("position"),M=[x.x,x.y,x.z],P=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),Z=Math.cos(V);N[0]=Z,N[1]=F,N[2]=0,N[3]=-F,N[4]=Z,N[5]=0,N[6]=0,N[7]=0,N[8]=1}(P,-o.transform.angle),function(N,V,F){var Z=V[0],J=V[1],ee=V[2];N[0]=Z*F[0]+J*F[3]+ee*F[6],N[1]=Z*F[1]+J*F[4]+ee*F[7],N[2]=Z*F[2]+J*F[5]+ee*F[8]}(M,M,P);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,o,d,m,y,x,M)=>l.e(Vl(v,o,d,m),iu(x,o,M),{u_height_factor:-Math.pow(2,y.overscaledZ)/M.tileSize/8}),Pa=v=>({u_matrix:v}),Jf=(v,o,d,m)=>l.e(Pa(v),iu(d,o,m)),r_=(v,o)=>({u_matrix:v,u_world:o}),Qf=(v,o,d,m,y)=>l.e(Jf(v,o,d,m),{u_world:y}),o_=(v,o,d,m)=>{const y=v.transform;let x,M;if(m.paint.get("circle-pitch-alignment")==="map"){const P=Zt(d,1,y.zoom);x=!0,M=[P,P]}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(o.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}},js=(v,o,d)=>({u_matrix:v,u_inv_matrix:o,u_camera_to_center_distance:d.cameraToCenterDistance,u_viewport_size:[d.width,d.height]}),Fl=(v,o,d=1)=>({u_matrix:v,u_color:o,u_overlay:0,u_overlay_scale:d}),nr=v=>({u_matrix:v}),ir=(v,o,d,m)=>({u_matrix:v,u_extrude_scale:Zt(o,1,d),u_intensity:m}),ou=(v,o,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:o.paint.get("heatmap-opacity")}};function su(v,o){const d=Math.pow(2,o.canonical.z),m=o.canonical.y;return[new l.Z(0,m/d).toLngLat().lat,new l.Z(0,(m+1)/d).toLngLat().lat]}const au=(v,o,d,m)=>{const y=v.transform;return{u_matrix:nm(v,o,d,m),u_ratio:1/Zt(o,1,y.zoom),u_device_pixel_ratio:v.pixelRatio,u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]]}},em=(v,o,d,m,y)=>l.e(au(v,o,d,y),{u_image:0,u_image_height:m}),Da=(v,o,d,m,y)=>{const x=v.transform,M=tm(o,x);return{u_matrix:nm(v,o,d,y),u_texsize:o.imageAtlasTexture.size,u_ratio:1/Zt(o,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]]}},s_=(v,o,d,m,y,x)=>{const M=v.lineAtlas,P=tm(o,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,Z=V.width*y.toScale;return l.e(au(v,o,d,x),{u_patternscale_a:[P/F,-N.height/2],u_patternscale_b:[P/Z,-V.height/2],u_sdfgamma:M.width/(256*Math.min(F,Z)*v.pixelRatio)/2,u_image:0,u_tex_y_a:N.y,u_tex_y_b:V.y,u_mix:y.t})};function tm(v,o){return 1/Zt(v,1,o.tileZoom)}function nm(v,o,d,m){return v.translatePosMatrix(m?m.posMatrix:o.tileID.posMatrix,o,d.paint.get("line-translate"),d.paint.get("line-translate-anchor"))}const a_=(v,o,d,m,y)=>{return{u_matrix:v,u_tl_parent:o,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:l_(y.paint.get("raster-hue-rotate"))};var x,M};function l_(v){v*=Math.PI/180;const o=Math.sin(v),d=Math.cos(v);return[(2*d+1)/3,(-Math.sqrt(3)*o-d+1)/3,(Math.sqrt(3)*o-d+1)/3]}const im=(v,o,d,m,y,x,M,P,O,N,V,F,Z,J)=>{const ee=M.transform;return{u_is_size_zoom_constant:+(v==="constant"||v==="source"),u_is_size_feature_constant:+(v==="constant"||v==="camera"),u_size_t:o?o.uSizeT:0,u_size:o?o.uSize:0,u_camera_to_center_distance:ee.cameraToCenterDistance,u_pitch:ee.pitch/360*2*Math.PI,u_rotate_symbol:+d,u_aspect_ratio:ee.width/ee.height,u_fade_change:M.options.fadeDuration?M.symbolFadeChange:1,u_matrix:P,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:Z,u_texture:0,u_translation:V,u_pitched_scale:J}},$l=(v,o,d,m,y,x,M,P,O,N,V,F,Z,J,ee)=>{const re=M.transform;return l.e(im(v,o,d,m,y,x,M,P,O,N,V,F,Z,ee),{u_gamma_scale:m?Math.cos(re._pitch)*re.cameraToCenterDistance:1,u_device_pixel_ratio:M.pixelRatio,u_is_halo:+J})},nd=(v,o,d,m,y,x,M,P,O,N,V,F,Z,J)=>l.e($l(v,o,d,m,y,x,M,P,O,N,V,!0,F,!0,J),{u_texsize_icon:Z,u_texture_icon:1}),lu=(v,o,d)=>({u_matrix:v,u_opacity:o,u_color:d}),id=(v,o,d,m,y,x)=>l.e(function(M,P,O,N){const V=O.imageManager.getPattern(M.from.toString()),F=O.imageManager.getPattern(M.to.toString()),{width:Z,height:J}=O.imageManager.getPixelSize(),ee=Math.pow(2,N.tileID.overscaledZ),re=N.tileSize*Math.pow(2,O.transform.tileZoom)/ee,le=re*(N.tileID.canonical.x+N.tileID.wrap*ee),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:[Z,J],u_mix:P.t,u_pattern_size_a:V.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:P.fromScale,u_scale_b:P.toScale,u_tile_units_to_pixels:1/Zt(N,1,O.transform.tileZoom),u_pixel_coord_upper:[le>>16,ce>>16],u_pixel_coord_lower:[65535&le,65535&ce]}}(m,x,d,y),{u_matrix:v,u_opacity:o}),rd={fillExtrusion:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_lightpos:new l.aN(v,o.u_lightpos),u_lightintensity:new l.aI(v,o.u_lightintensity),u_lightcolor:new l.aN(v,o.u_lightcolor),u_vertical_gradient:new l.aI(v,o.u_vertical_gradient),u_opacity:new l.aI(v,o.u_opacity)}),fillExtrusionPattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_lightpos:new l.aN(v,o.u_lightpos),u_lightintensity:new l.aI(v,o.u_lightintensity),u_lightcolor:new l.aN(v,o.u_lightcolor),u_vertical_gradient:new l.aI(v,o.u_vertical_gradient),u_height_factor:new l.aI(v,o.u_height_factor),u_image:new l.aH(v,o.u_image),u_texsize:new l.aO(v,o.u_texsize),u_pixel_coord_upper:new l.aO(v,o.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,o.u_pixel_coord_lower),u_scale:new l.aN(v,o.u_scale),u_fade:new l.aI(v,o.u_fade),u_opacity:new l.aI(v,o.u_opacity)}),fill:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix)}),fillPattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_image:new l.aH(v,o.u_image),u_texsize:new l.aO(v,o.u_texsize),u_pixel_coord_upper:new l.aO(v,o.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,o.u_pixel_coord_lower),u_scale:new l.aN(v,o.u_scale),u_fade:new l.aI(v,o.u_fade)}),fillOutline:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_world:new l.aO(v,o.u_world)}),fillOutlinePattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_world:new l.aO(v,o.u_world),u_image:new l.aH(v,o.u_image),u_texsize:new l.aO(v,o.u_texsize),u_pixel_coord_upper:new l.aO(v,o.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,o.u_pixel_coord_lower),u_scale:new l.aN(v,o.u_scale),u_fade:new l.aI(v,o.u_fade)}),circle:(v,o)=>({u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_scale_with_map:new l.aH(v,o.u_scale_with_map),u_pitch_with_map:new l.aH(v,o.u_pitch_with_map),u_extrude_scale:new l.aO(v,o.u_extrude_scale),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_matrix:new l.aJ(v,o.u_matrix)}),collisionBox:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_pixel_extrude_scale:new l.aO(v,o.u_pixel_extrude_scale)}),collisionCircle:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_inv_matrix:new l.aJ(v,o.u_inv_matrix),u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_viewport_size:new l.aO(v,o.u_viewport_size)}),debug:(v,o)=>({u_color:new l.aL(v,o.u_color),u_matrix:new l.aJ(v,o.u_matrix),u_overlay:new l.aH(v,o.u_overlay),u_overlay_scale:new l.aI(v,o.u_overlay_scale)}),clippingMask:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix)}),heatmap:(v,o)=>({u_extrude_scale:new l.aI(v,o.u_extrude_scale),u_intensity:new l.aI(v,o.u_intensity),u_matrix:new l.aJ(v,o.u_matrix)}),heatmapTexture:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_world:new l.aO(v,o.u_world),u_image:new l.aH(v,o.u_image),u_color_ramp:new l.aH(v,o.u_color_ramp),u_opacity:new l.aI(v,o.u_opacity)}),hillshade:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_image:new l.aH(v,o.u_image),u_latrange:new l.aO(v,o.u_latrange),u_light:new l.aO(v,o.u_light),u_shadow:new l.aL(v,o.u_shadow),u_highlight:new l.aL(v,o.u_highlight),u_accent:new l.aL(v,o.u_accent)}),hillshadePrepare:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_image:new l.aH(v,o.u_image),u_dimension:new l.aO(v,o.u_dimension),u_zoom:new l.aI(v,o.u_zoom),u_unpack:new l.aK(v,o.u_unpack)}),line:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_ratio:new l.aI(v,o.u_ratio),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_units_to_pixels:new l.aO(v,o.u_units_to_pixels)}),lineGradient:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_ratio:new l.aI(v,o.u_ratio),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_units_to_pixels:new l.aO(v,o.u_units_to_pixels),u_image:new l.aH(v,o.u_image),u_image_height:new l.aI(v,o.u_image_height)}),linePattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_texsize:new l.aO(v,o.u_texsize),u_ratio:new l.aI(v,o.u_ratio),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_image:new l.aH(v,o.u_image),u_units_to_pixels:new l.aO(v,o.u_units_to_pixels),u_scale:new l.aN(v,o.u_scale),u_fade:new l.aI(v,o.u_fade)}),lineSDF:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_ratio:new l.aI(v,o.u_ratio),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_units_to_pixels:new l.aO(v,o.u_units_to_pixels),u_patternscale_a:new l.aO(v,o.u_patternscale_a),u_patternscale_b:new l.aO(v,o.u_patternscale_b),u_sdfgamma:new l.aI(v,o.u_sdfgamma),u_image:new l.aH(v,o.u_image),u_tex_y_a:new l.aI(v,o.u_tex_y_a),u_tex_y_b:new l.aI(v,o.u_tex_y_b),u_mix:new l.aI(v,o.u_mix)}),raster:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_tl_parent:new l.aO(v,o.u_tl_parent),u_scale_parent:new l.aI(v,o.u_scale_parent),u_buffer_scale:new l.aI(v,o.u_buffer_scale),u_fade_t:new l.aI(v,o.u_fade_t),u_opacity:new l.aI(v,o.u_opacity),u_image0:new l.aH(v,o.u_image0),u_image1:new l.aH(v,o.u_image1),u_brightness_low:new l.aI(v,o.u_brightness_low),u_brightness_high:new l.aI(v,o.u_brightness_high),u_saturation_factor:new l.aI(v,o.u_saturation_factor),u_contrast_factor:new l.aI(v,o.u_contrast_factor),u_spin_weights:new l.aN(v,o.u_spin_weights)}),symbolIcon:(v,o)=>({u_is_size_zoom_constant:new l.aH(v,o.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(v,o.u_is_size_feature_constant),u_size_t:new l.aI(v,o.u_size_t),u_size:new l.aI(v,o.u_size),u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_pitch:new l.aI(v,o.u_pitch),u_rotate_symbol:new l.aH(v,o.u_rotate_symbol),u_aspect_ratio:new l.aI(v,o.u_aspect_ratio),u_fade_change:new l.aI(v,o.u_fade_change),u_matrix:new l.aJ(v,o.u_matrix),u_label_plane_matrix:new l.aJ(v,o.u_label_plane_matrix),u_coord_matrix:new l.aJ(v,o.u_coord_matrix),u_is_text:new l.aH(v,o.u_is_text),u_pitch_with_map:new l.aH(v,o.u_pitch_with_map),u_is_along_line:new l.aH(v,o.u_is_along_line),u_is_variable_anchor:new l.aH(v,o.u_is_variable_anchor),u_texsize:new l.aO(v,o.u_texsize),u_texture:new l.aH(v,o.u_texture),u_translation:new l.aO(v,o.u_translation),u_pitched_scale:new l.aI(v,o.u_pitched_scale)}),symbolSDF:(v,o)=>({u_is_size_zoom_constant:new l.aH(v,o.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(v,o.u_is_size_feature_constant),u_size_t:new l.aI(v,o.u_size_t),u_size:new l.aI(v,o.u_size),u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_pitch:new l.aI(v,o.u_pitch),u_rotate_symbol:new l.aH(v,o.u_rotate_symbol),u_aspect_ratio:new l.aI(v,o.u_aspect_ratio),u_fade_change:new l.aI(v,o.u_fade_change),u_matrix:new l.aJ(v,o.u_matrix),u_label_plane_matrix:new l.aJ(v,o.u_label_plane_matrix),u_coord_matrix:new l.aJ(v,o.u_coord_matrix),u_is_text:new l.aH(v,o.u_is_text),u_pitch_with_map:new l.aH(v,o.u_pitch_with_map),u_is_along_line:new l.aH(v,o.u_is_along_line),u_is_variable_anchor:new l.aH(v,o.u_is_variable_anchor),u_texsize:new l.aO(v,o.u_texsize),u_texture:new l.aH(v,o.u_texture),u_gamma_scale:new l.aI(v,o.u_gamma_scale),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_is_halo:new l.aH(v,o.u_is_halo),u_translation:new l.aO(v,o.u_translation),u_pitched_scale:new l.aI(v,o.u_pitched_scale)}),symbolTextAndIcon:(v,o)=>({u_is_size_zoom_constant:new l.aH(v,o.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(v,o.u_is_size_feature_constant),u_size_t:new l.aI(v,o.u_size_t),u_size:new l.aI(v,o.u_size),u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_pitch:new l.aI(v,o.u_pitch),u_rotate_symbol:new l.aH(v,o.u_rotate_symbol),u_aspect_ratio:new l.aI(v,o.u_aspect_ratio),u_fade_change:new l.aI(v,o.u_fade_change),u_matrix:new l.aJ(v,o.u_matrix),u_label_plane_matrix:new l.aJ(v,o.u_label_plane_matrix),u_coord_matrix:new l.aJ(v,o.u_coord_matrix),u_is_text:new l.aH(v,o.u_is_text),u_pitch_with_map:new l.aH(v,o.u_pitch_with_map),u_is_along_line:new l.aH(v,o.u_is_along_line),u_is_variable_anchor:new l.aH(v,o.u_is_variable_anchor),u_texsize:new l.aO(v,o.u_texsize),u_texsize_icon:new l.aO(v,o.u_texsize_icon),u_texture:new l.aH(v,o.u_texture),u_texture_icon:new l.aH(v,o.u_texture_icon),u_gamma_scale:new l.aI(v,o.u_gamma_scale),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_is_halo:new l.aH(v,o.u_is_halo),u_translation:new l.aO(v,o.u_translation),u_pitched_scale:new l.aI(v,o.u_pitched_scale)}),background:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_opacity:new l.aI(v,o.u_opacity),u_color:new l.aL(v,o.u_color)}),backgroundPattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_opacity:new l.aI(v,o.u_opacity),u_image:new l.aH(v,o.u_image),u_pattern_tl_a:new l.aO(v,o.u_pattern_tl_a),u_pattern_br_a:new l.aO(v,o.u_pattern_br_a),u_pattern_tl_b:new l.aO(v,o.u_pattern_tl_b),u_pattern_br_b:new l.aO(v,o.u_pattern_br_b),u_texsize:new l.aO(v,o.u_texsize),u_mix:new l.aI(v,o.u_mix),u_pattern_size_a:new l.aO(v,o.u_pattern_size_a),u_pattern_size_b:new l.aO(v,o.u_pattern_size_b),u_scale_a:new l.aI(v,o.u_scale_a),u_scale_b:new l.aI(v,o.u_scale_b),u_pixel_coord_upper:new l.aO(v,o.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,o.u_pixel_coord_lower),u_tile_units_to_pixels:new l.aI(v,o.u_tile_units_to_pixels)}),terrain:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_texture:new l.aH(v,o.u_texture),u_ele_delta:new l.aI(v,o.u_ele_delta),u_fog_matrix:new l.aJ(v,o.u_fog_matrix),u_fog_color:new l.aL(v,o.u_fog_color),u_fog_ground_blend:new l.aI(v,o.u_fog_ground_blend),u_fog_ground_blend_opacity:new l.aI(v,o.u_fog_ground_blend_opacity),u_horizon_color:new l.aL(v,o.u_horizon_color),u_horizon_fog_blend:new l.aI(v,o.u_horizon_fog_blend)}),terrainDepth:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_ele_delta:new l.aI(v,o.u_ele_delta)}),terrainCoords:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_texture:new l.aH(v,o.u_texture),u_terrain_coords_id:new l.aI(v,o.u_terrain_coords_id),u_ele_delta:new l.aI(v,o.u_ele_delta)}),sky:(v,o)=>({u_sky_color:new l.aL(v,o.u_sky_color),u_horizon_color:new l.aL(v,o.u_horizon_color),u_horizon:new l.aI(v,o.u_horizon),u_sky_horizon_blend:new l.aI(v,o.u_sky_horizon_blend)})};class Mo{constructor(o,d,m){this.context=o;const y=o.gl;this.buffer=y.createBuffer(),this.dynamicDraw=!!m,this.context.unbindVAO(),o.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(o){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,o.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const c_={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class od{constructor(o,d,m,y){this.length=d.length,this.attributes=m,this.itemSize=d.bytesPerElement,this.dynamicDraw=y,this.context=o;const x=o.gl;this.buffer=x.createBuffer(),o.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(o){if(o.length!==this.length)throw new Error(`Length of new data is ${o.length}, which doesn't match current length of ${this.length}`);const d=this.context.gl;this.bind(),d.bufferSubData(d.ARRAY_BUFFER,0,o.arrayBuffer)}enableAttributes(o,d){for(let m=0;m<this.attributes.length;m++){const y=d.attributes[this.attributes[m].name];y!==void 0&&o.enableVertexAttribArray(y)}}setVertexAttribPointers(o,d,m){for(let y=0;y<this.attributes.length;y++){const x=this.attributes[y],M=d.attributes[x.name];M!==void 0&&o.vertexAttribPointer(M,x.components,o[c_[x.type]],!1,this.itemSize,x.offset+this.itemSize*(m||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Us=new WeakMap;function ps(v){var o;if(Us.has(v))return Us.get(v);{const d=(o=v.getParameter(v.VERSION))===null||o===void 0?void 0:o.startsWith("WebGL 2.0");return Us.set(v,d),d}}class _n{constructor(o){this.gl=o.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(o){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class cu extends _n{getDefault(){return l.aM.transparent}set(o){const d=this.current;(o.r!==d.r||o.g!==d.g||o.b!==d.b||o.a!==d.a||this.dirty)&&(this.gl.clearColor(o.r,o.g,o.b,o.a),this.current=o,this.dirty=!1)}}class u_ extends _n{getDefault(){return 1}set(o){(o!==this.current||this.dirty)&&(this.gl.clearDepth(o),this.current=o,this.dirty=!1)}}class Oa extends _n{getDefault(){return 0}set(o){(o!==this.current||this.dirty)&&(this.gl.clearStencil(o),this.current=o,this.dirty=!1)}}class h_ extends _n{getDefault(){return[!0,!0,!0,!0]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||o[2]!==d[2]||o[3]!==d[3]||this.dirty)&&(this.gl.colorMask(o[0],o[1],o[2],o[3]),this.current=o,this.dirty=!1)}}class rm extends _n{getDefault(){return!0}set(o){(o!==this.current||this.dirty)&&(this.gl.depthMask(o),this.current=o,this.dirty=!1)}}class d_ extends _n{getDefault(){return 255}set(o){(o!==this.current||this.dirty)&&(this.gl.stencilMask(o),this.current=o,this.dirty=!1)}}class om extends _n{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(o){const d=this.current;(o.func!==d.func||o.ref!==d.ref||o.mask!==d.mask||this.dirty)&&(this.gl.stencilFunc(o.func,o.ref,o.mask),this.current=o,this.dirty=!1)}}class sd extends _n{getDefault(){const o=this.gl;return[o.KEEP,o.KEEP,o.KEEP]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||o[2]!==d[2]||this.dirty)&&(this.gl.stencilOp(o[0],o[1],o[2]),this.current=o,this.dirty=!1)}}class sm extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;o?d.enable(d.STENCIL_TEST):d.disable(d.STENCIL_TEST),this.current=o,this.dirty=!1}}class am extends _n{getDefault(){return[0,1]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||this.dirty)&&(this.gl.depthRange(o[0],o[1]),this.current=o,this.dirty=!1)}}class lm extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;o?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),this.current=o,this.dirty=!1}}class cm extends _n{getDefault(){return this.gl.LESS}set(o){(o!==this.current||this.dirty)&&(this.gl.depthFunc(o),this.current=o,this.dirty=!1)}}class Hs extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;o?d.enable(d.BLEND):d.disable(d.BLEND),this.current=o,this.dirty=!1}}class um extends _n{getDefault(){const o=this.gl;return[o.ONE,o.ZERO]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||this.dirty)&&(this.gl.blendFunc(o[0],o[1]),this.current=o,this.dirty=!1)}}class p_ extends _n{getDefault(){return l.aM.transparent}set(o){const d=this.current;(o.r!==d.r||o.g!==d.g||o.b!==d.b||o.a!==d.a||this.dirty)&&(this.gl.blendColor(o.r,o.g,o.b,o.a),this.current=o,this.dirty=!1)}}class hm extends _n{getDefault(){return this.gl.FUNC_ADD}set(o){(o!==this.current||this.dirty)&&(this.gl.blendEquation(o),this.current=o,this.dirty=!1)}}class jl extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;o?d.enable(d.CULL_FACE):d.disable(d.CULL_FACE),this.current=o,this.dirty=!1}}class f_ extends _n{getDefault(){return this.gl.BACK}set(o){(o!==this.current||this.dirty)&&(this.gl.cullFace(o),this.current=o,this.dirty=!1)}}class uu extends _n{getDefault(){return this.gl.CCW}set(o){(o!==this.current||this.dirty)&&(this.gl.frontFace(o),this.current=o,this.dirty=!1)}}class m_ extends _n{getDefault(){return null}set(o){(o!==this.current||this.dirty)&&(this.gl.useProgram(o),this.current=o,this.dirty=!1)}}class g_ extends _n{getDefault(){return this.gl.TEXTURE0}set(o){(o!==this.current||this.dirty)&&(this.gl.activeTexture(o),this.current=o,this.dirty=!1)}}class dm extends _n{getDefault(){const o=this.gl;return[0,0,o.drawingBufferWidth,o.drawingBufferHeight]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||o[2]!==d[2]||o[3]!==d[3]||this.dirty)&&(this.gl.viewport(o[0],o[1],o[2],o[3]),this.current=o,this.dirty=!1)}}class pm extends _n{getDefault(){return null}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.bindFramebuffer(d.FRAMEBUFFER,o),this.current=o,this.dirty=!1}}class fm extends _n{getDefault(){return null}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.bindRenderbuffer(d.RENDERBUFFER,o),this.current=o,this.dirty=!1}}class ad extends _n{getDefault(){return null}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.bindTexture(d.TEXTURE_2D,o),this.current=o,this.dirty=!1}}class mm extends _n{getDefault(){return null}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.bindBuffer(d.ARRAY_BUFFER,o),this.current=o,this.dirty=!1}}class hu extends _n{getDefault(){return null}set(o){const d=this.gl;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o),this.current=o,this.dirty=!1}}class Ho extends _n{getDefault(){return null}set(o){var d;if(o===this.current&&!this.dirty)return;const m=this.gl;ps(m)?m.bindVertexArray(o):(d=m.getExtension("OES_vertex_array_object"))===null||d===void 0||d.bindVertexArrayOES(o),this.current=o,this.dirty=!1}}class ld extends _n{getDefault(){return 4}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_ALIGNMENT,o),this.current=o,this.dirty=!1}}class cd extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o),this.current=o,this.dirty=!1}}class ud extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL,o),this.current=o,this.dirty=!1}}class du extends _n{constructor(o,d){super(o),this.context=o,this.parent=d}getDefault(){return null}}class hd extends du{setDirty(){this.dirty=!0}set(o){if(o===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,o,0),this.current=o,this.dirty=!1}}class qs extends du{set(o){if(o===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,o),this.current=o,this.dirty=!1}}class dd extends du{set(o){if(o===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,o),this.current=o,this.dirty=!1}}class y_{constructor(o,d,m,y,x){this.context=o,this.width=d,this.height=m;const M=o.gl,P=this.framebuffer=M.createFramebuffer();if(this.colorAttachment=new hd(o,P),y)this.depthAttachment=x?new dd(o,P):new qs(o,P);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 o=this.context.gl,d=this.colorAttachment.get();if(d&&o.deleteTexture(d),this.depthAttachment){const m=this.depthAttachment.get();m&&o.deleteRenderbuffer(m)}o.deleteFramebuffer(this.framebuffer)}}class Jn{constructor(o,d,m){this.blendFunction=o,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 __{constructor(o){var d,m;if(this.gl=o,this.clearColor=new cu(this),this.clearDepth=new u_(this),this.clearStencil=new Oa(this),this.colorMask=new h_(this),this.depthMask=new rm(this),this.stencilMask=new d_(this),this.stencilFunc=new om(this),this.stencilOp=new sd(this),this.stencilTest=new sm(this),this.depthRange=new am(this),this.depthTest=new lm(this),this.depthFunc=new cm(this),this.blend=new Hs(this),this.blendFunc=new um(this),this.blendColor=new p_(this),this.blendEquation=new hm(this),this.cullFace=new jl(this),this.cullFaceSide=new f_(this),this.frontFace=new uu(this),this.program=new m_(this),this.activeTexture=new g_(this),this.viewport=new dm(this),this.bindFramebuffer=new pm(this),this.bindRenderbuffer=new fm(this),this.bindTexture=new ad(this),this.bindVertexBuffer=new mm(this),this.bindElementBuffer=new hu(this),this.bindVertexArray=new Ho(this),this.pixelStoreUnpack=new ld(this),this.pixelStoreUnpackPremultiplyAlpha=new cd(this),this.pixelStoreUnpackFlipY=new ud(this),this.extTextureFilterAnisotropic=o.getExtension("EXT_texture_filter_anisotropic")||o.getExtension("MOZ_EXT_texture_filter_anisotropic")||o.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=o.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=o.getParameter(o.MAX_TEXTURE_SIZE),ps(o)){this.HALF_FLOAT=o.HALF_FLOAT;const y=o.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(d=o.RGBA16F)!==null&&d!==void 0?d:y==null?void 0:y.RGBA16F_EXT,this.RGB16F=(m=o.RGB16F)!==null&&m!==void 0?m:y==null?void 0:y.RGB16F_EXT,o.getExtension("EXT_color_buffer_float")}else{o.getExtension("EXT_color_buffer_half_float"),o.getExtension("OES_texture_half_float_linear");const y=o.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(o,d){return new Mo(this,o,d)}createVertexBuffer(o,d,m){return new od(this,o,d,m)}createRenderbuffer(o,d,m){const y=this.gl,x=y.createRenderbuffer();return this.bindRenderbuffer.set(x),y.renderbufferStorage(y.RENDERBUFFER,o,d,m),this.bindRenderbuffer.set(null),x}createFramebuffer(o,d,m,y){return new y_(this,o,d,m,y)}clear({color:o,depth:d,stencil:m}){const y=this.gl;let x=0;o&&(x|=y.COLOR_BUFFER_BIT,this.clearColor.set(o),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(o){o.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(o.mode),this.frontFace.set(o.frontFace))}setDepthMode(o){o.func!==this.gl.ALWAYS||o.mask?(this.depthTest.set(!0),this.depthFunc.set(o.func),this.depthMask.set(o.mask),this.depthRange.set(o.range)):this.depthTest.set(!1)}setStencilMode(o){o.test.func!==this.gl.ALWAYS||o.mask?(this.stencilTest.set(!0),this.stencilMask.set(o.mask),this.stencilOp.set([o.fail,o.depthFail,o.pass]),this.stencilFunc.set({func:o.test.func,ref:o.ref,mask:o.test.mask})):this.stencilTest.set(!1)}setColorMode(o){l.aE(o.blendFunction,Jn.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(o.blendFunction),this.blendColor.set(o.blendColor)),this.colorMask.set(o.mask)}createVertexArray(){var o;return ps(this.gl)?this.gl.createVertexArray():(o=this.gl.getExtension("OES_vertex_array_object"))===null||o===void 0?void 0:o.createVertexArrayOES()}deleteVertexArray(o){var d;return ps(this.gl)?this.gl.deleteVertexArray(o):(d=this.gl.getExtension("OES_vertex_array_object"))===null||d===void 0?void 0:d.deleteVertexArrayOES(o)}unbindVAO(){this.bindVertexArray.set(null)}}class Ht{constructor(o,d,m){this.func=o,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(o,d,m,y,x,M){this.test=o,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(o,d,m){this.enable=o,this.mode=d,this.frontFace=m}}let Ws;function Ul(v,o,d,m,y){const x=v.context,M=x.gl,P=v.useProgram("collisionBox"),O=[];let N=0,V=0;for(let ce=0;ce<m.length;ce++){const he=m[ce],te=o.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&&P.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 Z=v.useProgram("collisionCircle"),J=new l.aR;J.resize(4*N),J._trim();let ee=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],Be=ce.circleArray[te+3];J.emplace(ee++,me,ge,ve,Be,0),J.emplace(ee++,me,ge,ve,Be,1),J.emplace(ee++,me,ge,ve,Be,2),J.emplace(ee++,me,ge,ve,Be,3)}(!Ws||Ws.length<2*N)&&(Ws=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(Ws,!0),le=x.createVertexBuffer(J,l.aS.members,!0);for(const ce of O){const he=js(ce.transform,ce.invTransform,v.transform);Z.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,le,re,l.a0.simpleSegment(0,2*ce.circleOffset,ce.circleArray.length,ce.circleArray.length/2),null,v.transform.zoom,null,null,null)}le.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,o,d,m,y,x){const{horizontalAlign:M,verticalAlign:P}=l.au(v);return new l.P((-(M-.5)*o/y+m[0])*x,(-(P-.5)*d/y+m[1])*x)}function Gs(v,o,d,m,y,x){const M=o.tileAnchorPoint.add(new l.P(o.translation[0],o.translation[1]));if(o.pitchWithMap){let P=m.mult(x);d||(P=P.rotate(-y));const O=M.add(P);return oe(O.x,O.y,o.labelPlaneMatrix,o.getElevation).point}if(d){const P=Ae(o.tileAnchorPoint.x+1,o.tileAnchorPoint.y,o).point.sub(v),O=Math.atan(P.y/P.x)+(P.x<0?Math.PI:0);return v.add(m.rotate(O))}return v.add(m)}function Ba(v,o,d,m,y,x,M,P,O,N,V,F,Z,J){const ee=v.text.placedSymbolArray,re=v.text.dynamicLayoutVertexArray,le=v.icon.dynamicLayoutVertexArray,ce={};re.clear();for(let he=0;he<ee.length;he++){const te=ee.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:J,width:y.width,height:y.height,labelPlaneMatrix:x,lineVertexArray:null,pitchWithMap:d,projection:V,projectionCache:null,tileAnchorPoint:ge,translation:F,unwrappedTileID:Z},Be=d?oe(ge.x,ge.y,M,J):Ae(ge.x,ge.y,ve),Fe=H(y.cameraToCenterDistance,Be.signedDistanceFromCamera);let Qe=l.ai(v.textSizeData,O,te)*Fe/l.ap;d&&(Qe*=v.tilePixelRatio/P);const{width:st,height:Ye,anchor:Ge,textOffset:mt,textBoxScale:Ot}=me,Xe=pd(Ge,st,Ye,mt,Ot,Qe),nt=V.getPitchedTextCorrection(y,ge.add(new l.P(F[0],F[1])),Z),Pt=Gs(Be.point,ve,o,Xe,y.angle,nt),Fn=v.allowVerticalPlacement&&te.placedOrientation===l.ah.vertical?Math.PI/2:0;for(let Lt=0;Lt<te.numGlyphs;Lt++)l.aj(re,Pt,Fn);N&&te.associatedIconIndex>=0&&(ce[te.associatedIconIndex]={shiftedAnchor:Pt,angle:Fn})}else kt(te.numGlyphs,re)}if(N){le.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,le);else{const ge=ce[te];if(ge)for(let ve=0;ve<me.numGlyphs;ve++)l.aj(le,ge.shiftedAnchor,ge.angle);else kt(me.numGlyphs,le)}}v.icon.dynamicLayoutVertexBuffer.updateData(le)}v.text.dynamicLayoutVertexBuffer.updateData(re)}function Rr(v,o,d){return d.iconsInText&&o?"symbolTextAndIcon":v?"symbolSDF":"symbolIcon"}function fd(v,o,d,m,y,x,M,P,O,N,V,F){const Z=v.context,J=Z.gl,ee=v.transform,re=Fs(),le=P==="map",ce=O==="map",he=P!=="viewport"&&d.layout.get("symbol-placement")!=="point",te=le&&!ce&&!he,me=!ce&&he,ge=!d.layout.get("symbol-sort-key").isConstant();let ve=!1;const Be=v.depthModeForSublayer(0,Ht.ReadOnly),Fe=d._unevaluatedLayout.hasValue("text-variable-anchor")||d._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Qe=[],st=re.getCircleRadiusCorrection(ee);for(const Ye of m){const Ge=o.getTile(Ye),mt=Ge.getBucket(d);if(!mt)continue;const Ot=y?mt.text:mt.icon;if(!Ot||!Ot.segments.get().length||!Ot.hasVisibleVertices)continue;const Xe=Ot.programConfigurations.get(d.id),nt=y||mt.sdfIcons,Pt=y?mt.textSizeData:mt.iconSizeData,Fn=ce||ee.pitch!==0,Lt=v.useProgram(Rr(nt,y,mt),Xe),Yt=l.ag(Pt,ee.zoom),$n=v.style.map.terrain&&v.style.map.terrain.getTerrainData(Ye);let Oi,no,jn,rr,Gi=[0,0],Bi=null;if(y)no=Ge.glyphAtlasTexture,jn=J.LINEAR,Oi=Ge.glyphAtlasTexture.size,mt.iconsInText&&(Gi=Ge.imageAtlasTexture.size,Bi=Ge.imageAtlasTexture,rr=Fn||v.options.rotating||v.options.zooming||Pt.kind==="composite"||Pt.kind==="camera"?J.LINEAR:J.NEAREST);else{const en=d.layout.get("icon-size").constantOr(0)!==1||mt.iconsNeedLinear;no=Ge.imageAtlasTexture,jn=nt||v.options.rotating||v.options.zooming||en||Fn?J.LINEAR:J.NEAREST,Oi=Ge.imageAtlasTexture.size}const Zi=Zt(Ge,1,v.transform.zoom),Po=me?Ye.posMatrix:Hl,Xa=qi(Po,ce,le,v.transform,Zi),Du=fr(Po,ce,le,v.transform,Zi),Ka=fr(Ye.posMatrix,ce,le,v.transform,Zi),Fr=re.translatePosition(v.transform,Ge,x,M),Ou=Fe&&mt.hasTextData(),Vd=d.layout.get("icon-text-fit")!=="none"&&Ou&&mt.hasIconData();if(he){const en=v.style.map.terrain?(Ja,Qa)=>v.style.map.terrain.getElevation(Ye,Ja,Qa):null,Js=d.layout.get("text-rotation-alignment")==="map";X(mt,Ye.posMatrix,v,y,Xa,Ka,ce,N,Js,re,Ye.toUnwrapped(),ee.width,ee.height,Fr,en)}const $r=Ye.posMatrix,jr=y&&Fe||Vd,fs=he||jr?Hl:Xa,io=Du,Si=nt&&d.paint.get(y?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let zi;zi=nt?mt.iconsInText?nd(Pt.kind,Yt,te,ce,he,jr,v,$r,fs,io,Fr,Oi,Gi,st):$l(Pt.kind,Yt,te,ce,he,jr,v,$r,fs,io,Fr,y,Oi,!0,st):im(Pt.kind,Yt,te,ce,he,jr,v,$r,fs,io,Fr,y,Oi,st);const xr={program:Lt,buffers:Ot,uniformValues:zi,atlasTexture:no,atlasTextureIcon:Bi,atlasInterpolation:jn,atlasInterpolationIcon:rr,isSDF:nt,hasHalo:Si};if(ge&&mt.canOverlap){ve=!0;const en=Ot.segments.get();for(const Js of en)Qe.push({segments:new l.a0([Js]),sortKey:Js.sortKey,state:xr,terrainData:$n})}else Qe.push({segments:Ot.segments,sortKey:0,state:xr,terrainData:$n})}ve&&Qe.sort((Ye,Ge)=>Ye.sortKey-Ge.sortKey);for(const Ye of Qe){const Ge=Ye.state;if(Z.activeTexture.set(J.TEXTURE0),Ge.atlasTexture.bind(Ge.atlasInterpolation,J.CLAMP_TO_EDGE),Ge.atlasTextureIcon&&(Z.activeTexture.set(J.TEXTURE1),Ge.atlasTextureIcon&&Ge.atlasTextureIcon.bind(Ge.atlasInterpolationIcon,J.CLAMP_TO_EDGE)),Ge.isSDF){const mt=Ge.uniformValues;Ge.hasHalo&&(mt.u_is_halo=1,md(Ge.buffers,Ye.segments,d,v,Ge.program,Be,V,F,mt,Ye.terrainData)),mt.u_is_halo=0}md(Ge.buffers,Ye.segments,d,v,Ge.program,Be,V,F,Ge.uniformValues,Ye.terrainData)}}function md(v,o,d,m,y,x,M,P,O,N){const V=m.context;y.draw(V,V.gl.TRIANGLES,x,M,P,Tn.disabled,O,N,d.id,v.layoutVertexBuffer,v.indexBuffer,o,d.paint,m.transform.zoom,v.programConfigurations.get(d.id),v.dynamicLayoutVertexBuffer,v.opacityVertexBuffer)}function gd(v,o,d,m){const y=v.context,x=y.gl,M=On.disabled,P=new Jn([x.ONE,x.ONE],l.aM.transparent,[!0,!0,!0,!0]),O=o.getBucket(d);if(!O)return;const N=m.key;let V=d.heatmapFbos.get(N);V||(V=ql(y,o.tileSize,o.tileSize),d.heatmapFbos.set(N,V)),y.bindFramebuffer.set(V.framebuffer),y.viewport.set([0,0,o.tileSize,o.tileSize]),y.clear({color:l.aM.transparent});const F=O.programConfigurations.get(d.id),Z=v.useProgram("heatmap",F),J=v.style.map.terrain.getTerrainData(m);Z.draw(y,x.TRIANGLES,Ht.disabled,M,P,Tn.disabled,ir(m.posMatrix,o,v.transform.zoom,d.paint.get("heatmap-intensity")),J,d.id,O.layoutVertexBuffer,O.indexBuffer,O.segments,d.paint,v.transform.zoom,F)}function Zs(v,o,d){const m=v.context,y=m.gl;m.setColorMode(v.colorModeForRenderPass());const x=Wl(m,o),M=d.key,P=o.heatmapFbos.get(M);P&&(m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,P.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,ou(v,o,0,1),null,o.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments,o.paint,v.transform.zoom),P.destroy(),o.heatmapFbos.delete(M))}function ql(v,o,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 P=(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,o,d,0,x.RGBA,P,null);const N=v.createFramebuffer(o,d,!1,!1);return N.colorAttachment.set(M),N}function Wl(v,o){return o.colorRampTexture||(o.colorRampTexture=new Je(v,o.colorRamp,v.gl.RGBA)),o.colorRampTexture}function za(v,o,d,m,y){if(!d||!m||!m.imageAtlas)return;const x=m.imageAtlas.patternPositions;let M=x[d.to.toString()],P=x[d.from.toString()];if(!M&&P&&(M=P),!P&&M&&(P=M),!M||!P){const O=y.getPaintProperty(o);M=x[O],P=x[O]}M&&P&&v.setConstantPatternPositions(M,P)}function Gl(v,o,d,m,y,x,M){const P=v.context.gl,O="fill-pattern",N=d.paint.get(O),V=N&&N.constantOr(1),F=d.getCrossfadeParameters();let Z,J,ee,re,le;M?(J=V&&!d.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Z=P.LINES):(J=V?"fillPattern":"fill",Z=P.TRIANGLES);const ce=N.constantOr(null);for(const he of m){const te=o.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(J,ge),Be=v.style.map.terrain&&v.style.map.terrain.getTerrainData(he);V&&(v.context.activeTexture.set(P.TEXTURE0),te.imageAtlasTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),ge.updatePaintBuffers(F)),za(ge,O,ce,te,d);const Fe=Be?he:null,Qe=v.translatePosMatrix(Fe?Fe.posMatrix:he.posMatrix,te,d.paint.get("fill-translate"),d.paint.get("fill-translate-anchor"));if(M){re=me.indexBuffer2,le=me.segments2;const st=[P.drawingBufferWidth,P.drawingBufferHeight];ee=J==="fillOutlinePattern"&&V?Qf(Qe,v,F,te,st):r_(Qe,st)}else re=me.indexBuffer,le=me.segments,ee=V?Jf(Qe,v,F,te):Pa(Qe);ve.draw(v.context,Z,y,v.stencilModeForClipping(he),x,Tn.disabled,ee,Be,d.id,me.layoutVertexBuffer,re,le,d.paint,v.transform.zoom,ge)}}function fu(v,o,d,m,y,x,M){const P=v.context,O=P.gl,N="fill-extrusion-pattern",V=d.paint.get(N),F=V.constantOr(1),Z=d.getCrossfadeParameters(),J=d.paint.get("fill-extrusion-opacity"),ee=V.constantOr(null);for(const re of m){const le=o.getTile(re),ce=le.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),le.imageAtlasTexture.bind(O.LINEAR,O.CLAMP_TO_EDGE),te.updatePaintBuffers(Z)),za(te,N,ee,le,d);const ge=v.translatePosMatrix(re.posMatrix,le,d.paint.get("fill-extrusion-translate"),d.paint.get("fill-extrusion-translate-anchor")),ve=d.paint.get("fill-extrusion-vertical-gradient"),Be=F?ru(ge,v,ve,J,re,Z,le):Vl(ge,v,ve,J);me.draw(P,P.gl.TRIANGLES,y,x,M,Tn.backCCW,Be,he,d.id,ce.layoutVertexBuffer,ce.indexBuffer,ce.segments,d.paint,v.transform.zoom,te,v.style.map.terrain&&ce.centroidVertexBuffer)}}function Na(v,o,d,m,y,x,M){const P=v.context,O=P.gl,N=d.fbo;if(!N)return;const V=v.useProgram("hillshade"),F=v.style.map.terrain&&v.style.map.terrain.getTerrainData(o);P.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,N.colorAttachment.get()),V.draw(P,O.TRIANGLES,y,x,M,Tn.disabled,((Z,J,ee,re)=>{const le=ee.paint.get("hillshade-shadow-color"),ce=ee.paint.get("hillshade-highlight-color"),he=ee.paint.get("hillshade-accent-color");let te=ee.paint.get("hillshade-illumination-direction")*(Math.PI/180);ee.paint.get("hillshade-illumination-anchor")==="viewport"&&(te-=Z.transform.angle);const me=!Z.options.moving;return{u_matrix:re?re.posMatrix:Z.transform.calculatePosMatrix(J.tileID.toUnwrapped(),me),u_image:0,u_latrange:su(0,J.tileID),u_light:[ee.paint.get("hillshade-exaggeration"),te],u_shadow:le,u_highlight:ce,u_accent:he}})(v,d,m,F?o:null),F,m.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments)}function Ra(v,o,d,m,y,x){const M=v.context,P=M.gl,O=o.dem;if(O&&O.data){const N=O.dim,V=O.stride,F=O.getPixels();if(M.activeTexture.set(P.TEXTURE1),M.pixelStoreUnpackPremultiplyAlpha.set(!1),o.demTexture=o.demTexture||v.getTileTexture(V),o.demTexture){const J=o.demTexture;J.update(F,{premultiply:!1}),J.bind(P.NEAREST,P.CLAMP_TO_EDGE)}else o.demTexture=new Je(M,F,P.RGBA,{premultiply:!1}),o.demTexture.bind(P.NEAREST,P.CLAMP_TO_EDGE);M.activeTexture.set(P.TEXTURE0);let Z=o.fbo;if(!Z){const J=new Je(M,{width:N,height:N,data:null},P.RGBA);J.bind(P.LINEAR,P.CLAMP_TO_EDGE),Z=o.fbo=M.createFramebuffer(N,N,!0,!1),Z.colorAttachment.set(J.texture)}M.bindFramebuffer.set(Z.framebuffer),M.viewport.set([0,0,N,N]),v.useProgram("hillshadePrepare").draw(M,P.TRIANGLES,m,y,x,Tn.disabled,((J,ee)=>{const re=ee.stride,le=l.H();return l.aP(le,0,l.X,-l.X,0,0,1),l.J(le,le,[0,-l.X,0]),{u_matrix:le,u_image:1,u_dimension:[re,re],u_zoom:J.overscaledZ,u_unpack:ee.getUnpackVector()}})(o.tileID,O),null,d.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments),o.needsHillshadePrepare=!1}}function gm(v,o,d,m,y,x){const M=m.paint.get("raster-fade-duration");if(!x&&M>0){const P=E.now(),O=(P-v.timeAdded)/M,N=o?(P-o.timeAdded)/M:-1,V=d.getSource(),F=y.coveringZoomLevel({tileSize:V.tileSize,roundZoom:V.roundZoom}),Z=!o||Math.abs(o.tileID.overscaledZ-F)>Math.abs(v.tileID.overscaledZ-F),J=Z&&v.refreshedUponExpiration?1:l.ac(Z?O:1-N,0,1);return v.refreshedUponExpiration&&O>=1&&(v.refreshedUponExpiration=!1),o?{opacity:1,mix:1-J}:{opacity:J,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),b_=new l.aM(1,0,1,1),ym=new l.aM(0,1,1,1);function La(v,o,d,m){gu(v,0,o+d/2,v.transform.width,d,m)}function _m(v,o,d,m){gu(v,o-d/2,0,d,v.transform.height,m)}function gu(v,o,d,m,y,x){const M=v.context,P=M.gl;P.enable(P.SCISSOR_TEST),P.scissor(o*v.pixelRatio,d*v.pixelRatio,m*v.pixelRatio,y*v.pixelRatio),M.clear({color:x}),P.disable(P.SCISSOR_TEST)}function bm(v,o,d){const m=v.context,y=m.gl,x=d.posMatrix,M=v.useProgram("debug"),P=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 Z=o.getTileByID(d.key).latestRawTileData,J=Math.floor((Z&&Z.byteLength||0)/1024),ee=o.getTile(d).tileSize,re=512/Math.min(ee,512)*(d.overscaledZ/v.transform.zoom)*.5;let le=d.canonical.toString();d.overscaledZ!==d.canonical.z&&(le+=` => ${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,`${le} ${J}kB`),M.draw(m,y.TRIANGLES,P,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,P,O,N,Tn.disabled,Fl(x,l.aM.red),F,V,v.debugBuffer,v.tileBorderIndexBuffer,v.debugSegments)}function xm(v,o,d){const m=v.context,y=m.gl,x=v.colorModeForRenderPass(),M=new Ht(y.LEQUAL,Ht.ReadWrite,v.depthRangeFor3D),P=v.useProgram("terrain"),O=o.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=o.getTerrainData(N.tileID);m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,V.texture);const Z=v.transform.calculatePosMatrix(N.tileID.toUnwrapped()),J=o.getMeshFrameDelta(v.transform.zoom),ee=v.transform.calculateFogMatrix(N.tileID.toUnwrapped()),re=ed(Z,J,ee,v.style.sky,v.transform.pitch);P.draw(m,y.TRIANGLES,M,On.disabled,x,Tn.backCCW,re,F,"terrain",O.vertexBuffer,O.indexBuffer,O.segments)}}class yu{constructor(o,d,m){this.vertexBuffer=o,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(o,d){this.context=new __(o),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(o,d,m){if(this.width=Math.floor(o*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 o=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=o.createVertexBuffer(d,$s.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=o.createVertexBuffer(m,$s.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=o.createVertexBuffer(y,Hi.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=o.createVertexBuffer(x,$s.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=o.createIndexBuffer(M);const P=new l.aY;P.emplaceBack(0,1,2),P.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=o.createIndexBuffer(P);const O=this.context.gl;this.stencilClearMode=new On({func:O.ALWAYS,mask:0},0,255,O.ZERO,O.ZERO,O.ZERO)}clearStencil(){const o=this.context,d=o.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(o,d.TRIANGLES,Ht.disabled,this.stencilClearMode,Jn.disabled,Tn.disabled,nr(m),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(o,d){if(this.currentStencilSource===o.source||!o.isTileClipped()||!d||!d.length)return;this.currentStencilSource=o.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 P=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},P,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 o=this.nextStencilID++,d=this.context.gl;return new On({func:d.NOTEQUAL,mask:255},o,255,d.KEEP,d.KEEP,d.REPLACE)}stencilModeForClipping(o){const d=this.context.gl;return new On({func:d.EQUAL,mask:255},this._tileClippingMaskIDs[o.key],0,d.KEEP,d.KEEP,d.REPLACE)}stencilConfigForOverlap(o){const d=this.context.gl,m=o.sort((M,P)=>P.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 P=0;P<x;P++)M[P+y]=new On({func:d.GEQUAL,mask:255},P+this.nextStencilID,255,d.KEEP,d.KEEP,d.REPLACE);return this.nextStencilID+=x,[M,m]}return[{[y]:On.disabled},m]}colorModeForRenderPass(){const o=this.context.gl;return this._showOverdrawInspector?new Jn([o.CONSTANT_COLOR,o.ONE],new l.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Jn.unblended:Jn.alphaBlended}depthModeForSublayer(o,d,m){if(!this.opaquePassEnabledForLayer())return Ht.disabled;const y=1-((1+this.currentLayer)*this.numSublayers+o)*this.depthEpsilon;return new Ht(m||this.context.gl.LEQUAL,d,[y,y])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(o,d){this.style=o,this.options=d,this.lineAtlas=o.lineAtlas,this.imageManager=o.imageManager,this.glyphManager=o.glyphManager,this.symbolFadeChange=o.placement.symbolFadeChange(E.now()),this.imageManager.beginFrame();const m=this.style._order,y=this.style.sourceCaches,x={},M={},P={};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(),P[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,Z=((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),J=new Ht(F.LEQUAL,Ht.ReadWrite,[0,1]),ee=On.disabled,re=O.colorModeForRenderPass(),le=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,$s.members),V.createIndexBuffer(he),l.a0.simpleSegment(0,0,ce.length,he.length))}le.draw(V,F.TRIANGLES,J,ee,re,Tn.disabled,Z,void 0,"sky",N.mesh.vertexBuffer,N.mesh.indexBuffer,N.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=d.showOverdrawInspector,this.depthRangeFor3D=[0,1-(o._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"?P: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 Z=Object.values(N._layers).flatMap(le=>le.source&&!le.isHidden(V)?[N.sourceCaches[le.source]]:[]),J=Z.filter(le=>le.getSource().type==="vector"),ee=Z.filter(le=>le.getSource().type!=="vector"),re=le=>{(!F||F.getSource().maxzoom<le.getSource().maxzoom)&&(F=le)};return J.forEach(le=>re(le)),F||ee.forEach(le=>re(le)),F}(this.style,this.transform.zoom);O&&function(N,V,F){for(let Z=0;Z<F.length;Z++)bm(N,V,F[Z])}(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),_m(O,N.left||0,3,mu),_m(O,O.transform.width-(N.right||0),3,b_);const V=O.transform.centerPoint;(function(F,Z,J,ee){gu(F,Z-1,J-10,2,20,ee),gu(F,Z-10,J-1,20,2,ee)})(O,V.x,O.transform.height-V.y,ym)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(o){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=o?!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 P=x.context,O=P.gl,N=Jn.unblended,V=new Ht(O.LEQUAL,Ht.ReadWrite,[0,1]),F=M.getTerrainMesh(),Z=M.sourceCache.getRenderableTiles(),J=x.useProgram("terrainDepth");P.bindFramebuffer.set(M.getFramebuffer("depth").framebuffer),P.viewport.set([0,0,x.width/devicePixelRatio,x.height/devicePixelRatio]),P.clear({color:l.aM.transparent,depth:1});for(const ee of Z){const re=M.getTerrainData(ee.tileID),le={u_matrix:x.transform.calculatePosMatrix(ee.tileID.toUnwrapped()),u_ele_delta:M.getMeshFrameDelta(x.transform.zoom)};J.draw(P,O.TRIANGLES,V,On.disabled,N,Tn.backCCW,le,re,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}P.bindFramebuffer.set(null),P.viewport.set([0,0,x.width,x.height])}(this,this.style.map.terrain),function(x,M){const P=x.context,O=P.gl,N=Jn.unblended,V=new Ht(O.LEQUAL,Ht.ReadWrite,[0,1]),F=M.getTerrainMesh(),Z=M.getCoordsTexture(),J=M.sourceCache.getRenderableTiles(),ee=x.useProgram("terrainCoords");P.bindFramebuffer.set(M.getFramebuffer("coords").framebuffer),P.viewport.set([0,0,x.width/devicePixelRatio,x.height/devicePixelRatio]),P.clear({color:l.aM.transparent,depth:1}),M.coordsIndex=[];for(const re of J){const le=M.getTerrainData(re.tileID);P.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,Z.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)};ee.draw(P,O.TRIANGLES,V,On.disabled,N,Tn.backCCW,ce,le,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),M.coordsIndex.push(re.tileID.key)}P.bindFramebuffer.set(null),P.viewport.set([0,0,x.width,x.height])}(this,this.style.map.terrain))}renderLayer(o,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,P,O,N){if(x.renderPass!=="translucent")return;const V=On.disabled,F=x.colorModeForRenderPass();(P._unevaluatedLayout.hasValue("text-variable-anchor")||P._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(Z,J,ee,re,le,ce,he,te,me){const ge=J.transform,ve=Fs(),Be=le==="map",Fe=ce==="map";for(const Qe of Z){const st=re.getTile(Qe),Ye=st.getBucket(ee);if(!Ye||!Ye.text||!Ye.text.segments.get().length)continue;const Ge=l.ag(Ye.textSizeData,ge.zoom),mt=Zt(st,1,J.transform.zoom),Ot=qi(Qe.posMatrix,Fe,Be,J.transform,mt),Xe=ee.layout.get("icon-text-fit")!=="none"&&Ye.hasIconData();if(Ge){const nt=Math.pow(2,ge.zoom-st.tileID.overscaledZ),Pt=J.style.map.terrain?(Lt,Yt)=>J.style.map.terrain.getElevation(Qe,Lt,Yt):null,Fn=ve.translatePosition(ge,st,he,te);Ba(Ye,Be,Fe,me,ge,Ot,Qe.posMatrix,nt,Ge,Xe,ve,Fn,Qe.toUnwrapped(),Pt)}}}(O,x,P,M,P.layout.get("text-rotation-alignment"),P.layout.get("text-pitch-alignment"),P.paint.get("text-translate"),P.paint.get("text-translate-anchor"),N),P.paint.get("icon-opacity").constantOr(1)!==0&&fd(x,M,P,O,!1,P.paint.get("icon-translate"),P.paint.get("icon-translate-anchor"),P.layout.get("icon-rotation-alignment"),P.layout.get("icon-pitch-alignment"),P.layout.get("icon-keep-upright"),V,F),P.paint.get("text-opacity").constantOr(1)!==0&&fd(x,M,P,O,!0,P.paint.get("text-translate"),P.paint.get("text-translate-anchor"),P.layout.get("text-rotation-alignment"),P.layout.get("text-pitch-alignment"),P.layout.get("text-keep-upright"),V,F),M.map.showCollisionBoxes&&(Ul(x,M,P,O,!0),Ul(x,M,P,O,!1))})(o,d,m,y,this.style.placement.variableOffsets);break;case"circle":(function(x,M,P,O){if(x.renderPass!=="translucent")return;const N=P.paint.get("circle-opacity"),V=P.paint.get("circle-stroke-width"),F=P.paint.get("circle-stroke-opacity"),Z=!P.layout.get("circle-sort-key").isConstant();if(N.constantOr(1)===0&&(V.constantOr(1)===0||F.constantOr(1)===0))return;const J=x.context,ee=J.gl,re=x.depthModeForSublayer(0,Ht.ReadOnly),le=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(P);if(!ve)continue;const Be=ve.programConfigurations.get(P.id),Fe=x.useProgram("circle",Be),Qe=ve.layoutVertexBuffer,st=ve.indexBuffer,Ye=x.style.map.terrain&&x.style.map.terrain.getTerrainData(me),Ge={programConfiguration:Be,program:Fe,layoutVertexBuffer:Qe,indexBuffer:st,uniformValues:o_(x,me,ge,P),terrainData:Ye};if(Z){const mt=ve.segments.get();for(const Ot of mt)he.push({segments:new l.a0([Ot]),sortKey:Ot.sortKey,state:Ge})}else he.push({segments:ve.segments,sortKey:0,state:Ge})}Z&&he.sort((te,me)=>te.sortKey-me.sortKey);for(const te of he){const{programConfiguration:me,program:ge,layoutVertexBuffer:ve,indexBuffer:Be,uniformValues:Fe,terrainData:Qe}=te.state;ge.draw(J,ee.TRIANGLES,re,le,ce,Tn.disabled,Fe,Qe,P.id,ve,Be,te.segments,P.paint,x.transform.zoom,me)}})(o,d,m,y);break;case"heatmap":(function(x,M,P,O){if(P.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,P,V):x.renderPass==="translucent"&&Zs(x,P,V))}N.viewport.set([0,0,x.width,x.height])}else x.renderPass==="offscreen"?function(V,F,Z,J){const ee=V.context,re=ee.gl,le=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))})(ee,V,Z),ee.clear({color:l.aM.transparent});for(let he=0;he<J.length;he++){const te=J[he];if(F.hasRenderableParent(te))continue;const me=F.getTile(te),ge=me.getBucket(Z);if(!ge)continue;const ve=ge.programConfigurations.get(Z.id),Be=V.useProgram("heatmap",ve),{zoom:Fe}=V.transform;Be.draw(ee,re.TRIANGLES,Ht.disabled,le,ce,Tn.disabled,ir(te.posMatrix,me,Fe,Z.paint.get("heatmap-intensity")),null,Z.id,ge.layoutVertexBuffer,ge.indexBuffer,ge.segments,Z.paint,V.transform.zoom,ve)}ee.viewport.set([0,0,V.width,V.height])}(x,M,P,O):x.renderPass==="translucent"&&function(V,F){const Z=V.context,J=Z.gl;Z.setColorMode(V.colorModeForRenderPass());const ee=F.heatmapFbos.get(l.aU);ee&&(Z.activeTexture.set(J.TEXTURE0),J.bindTexture(J.TEXTURE_2D,ee.colorAttachment.get()),Z.activeTexture.set(J.TEXTURE1),Wl(Z,F).bind(J.LINEAR,J.CLAMP_TO_EDGE),V.useProgram("heatmapTexture").draw(Z,J.TRIANGLES,Ht.disabled,On.disabled,V.colorModeForRenderPass(),Tn.disabled,ou(V,F,0,1),null,F.id,V.viewportBuffer,V.quadTriangleIndexBuffer,V.viewportSegments,F.paint,V.transform.zoom))}(x,P)})(o,d,m,y);break;case"line":(function(x,M,P,O){if(x.renderPass!=="translucent")return;const N=P.paint.get("line-opacity"),V=P.paint.get("line-width");if(N.constantOr(1)===0||V.constantOr(1)===0)return;const F=x.depthModeForSublayer(0,Ht.ReadOnly),Z=x.colorModeForRenderPass(),J=P.paint.get("line-dasharray"),ee=P.paint.get("line-pattern"),re=ee.constantOr(1),le=P.paint.get("line-gradient"),ce=P.getCrossfadeParameters(),he=re?"linePattern":J?"lineSDF":le?"lineGradient":"line",te=x.context,me=te.gl;let ge=!0;for(const ve of O){const Be=M.getTile(ve);if(re&&!Be.patternsLoaded())continue;const Fe=Be.getBucket(P);if(!Fe)continue;const Qe=Fe.programConfigurations.get(P.id),st=x.context.program.get(),Ye=x.useProgram(he,Qe),Ge=ge||Ye.program!==st,mt=x.style.map.terrain&&x.style.map.terrain.getTerrainData(ve),Ot=ee.constantOr(null);if(Ot&&Be.imageAtlas){const Pt=Be.imageAtlas,Fn=Pt.patternPositions[Ot.to.toString()],Lt=Pt.patternPositions[Ot.from.toString()];Fn&&Lt&&Qe.setConstantPatternPositions(Fn,Lt)}const Xe=mt?ve:null,nt=re?Da(x,Be,P,ce,Xe):J?s_(x,Be,P,J,ce,Xe):le?em(x,Be,P,Fe.lineClipsArray.length,Xe):au(x,Be,P,Xe);if(re)te.activeTexture.set(me.TEXTURE0),Be.imageAtlasTexture.bind(me.LINEAR,me.CLAMP_TO_EDGE),Qe.updatePaintBuffers(ce);else if(J&&(Ge||x.lineAtlas.dirty))te.activeTexture.set(me.TEXTURE0),x.lineAtlas.bind(te);else if(le){const Pt=Fe.gradients[P.id];let Fn=Pt.texture;if(P.gradientVersion!==Pt.version){let Lt=256;if(P.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(Fe.maxLineLength/l.X*1024*$n),256,te.maxTextureSize)}Pt.gradient=l.aW({expression:P.gradientExpression(),evaluationKey:"lineProgress",resolution:Lt,image:Pt.gradient||void 0,clips:Fe.lineClipsArray}),Pt.texture?Pt.texture.update(Pt.gradient):Pt.texture=new Je(te,Pt.gradient,me.RGBA),Pt.version=P.gradientVersion,Fn=Pt.texture}te.activeTexture.set(me.TEXTURE0),Fn.bind(P.stepInterpolant?me.NEAREST:me.LINEAR,me.CLAMP_TO_EDGE)}Ye.draw(te,me.TRIANGLES,F,x.stencilModeForClipping(ve),Z,Tn.disabled,nt,mt,P.id,Fe.layoutVertexBuffer,Fe.indexBuffer,Fe.segments,P.paint,x.transform.zoom,Qe,Fe.layoutVertexBuffer2),ge=!1}})(o,d,m,y);break;case"fill":(function(x,M,P,O){const N=P.paint.get("fill-color"),V=P.paint.get("fill-opacity");if(V.constantOr(1)===0)return;const F=x.colorModeForRenderPass(),Z=P.paint.get("fill-pattern"),J=x.opaquePassEnabledForLayer()&&!Z.constantOr(1)&&N.constantOr(l.aM.transparent).a===1&&V.constantOr(0)===1?"opaque":"translucent";if(x.renderPass===J){const ee=x.depthModeForSublayer(1,x.renderPass==="opaque"?Ht.ReadWrite:Ht.ReadOnly);Gl(x,M,P,O,ee,F,!1)}if(x.renderPass==="translucent"&&P.paint.get("fill-antialias")){const ee=x.depthModeForSublayer(P.getPaintProperty("fill-outline-color")?2:0,Ht.ReadOnly);Gl(x,M,P,O,ee,F,!0)}})(o,d,m,y);break;case"fill-extrusion":(function(x,M,P,O){const N=P.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||P.paint.get("fill-extrusion-pattern").constantOr(1))fu(x,M,P,O,V,On.disabled,Jn.disabled),fu(x,M,P,O,V,x.stencilModeFor3D(),x.colorModeForRenderPass());else{const F=x.colorModeForRenderPass();fu(x,M,P,O,V,On.disabled,F)}}})(o,d,m,y);break;case"hillshade":(function(x,M,P,O){if(x.renderPass!=="offscreen"&&x.renderPass!=="translucent")return;const N=x.context,V=x.depthModeForSublayer(0,Ht.ReadOnly),F=x.colorModeForRenderPass(),[Z,J]=x.renderPass==="translucent"?x.stencilConfigForOverlap(O):[{},O];for(const ee of J){const re=M.getTile(ee);re.needsHillshadePrepare!==void 0&&re.needsHillshadePrepare&&x.renderPass==="offscreen"?Ra(x,re,P,V,On.disabled,F):x.renderPass==="translucent"&&Na(x,ee,re,P,V,Z[ee.overscaledZ],F)}N.viewport.set([0,0,x.width,x.height])})(o,d,m,y);break;case"raster":(function(x,M,P,O){if(x.renderPass!=="translucent"||P.paint.get("raster-opacity")===0||!O.length)return;const N=x.context,V=N.gl,F=M.getSource(),Z=x.useProgram("raster"),J=x.colorModeForRenderPass(),[ee,re]=F instanceof xi?[{},O]:x.stencilConfigForOverlap(O),le=re[re.length-1].overscaledZ,ce=!x.options.moving;for(const he of re){const te=x.depthModeForSublayer(he.overscaledZ-le,P.paint.get("raster-opacity")===1?Ht.ReadWrite:Ht.ReadOnly,V.LESS),me=M.getTile(he);me.registerFadeDuration(P.paint.get("raster-fade-duration"));const ge=M.findLoadedParent(he,0),ve=M.findLoadedSibling(he),Be=gm(me,ge||ve||null,M,P,x.transform,x.style.map.terrain);let Fe,Qe;const st=P.paint.get("raster-resampling")==="nearest"?V.NEAREST:V.LINEAR;N.activeTexture.set(V.TEXTURE0),me.texture.bind(st,V.CLAMP_TO_EDGE,V.LINEAR_MIPMAP_NEAREST),N.activeTexture.set(V.TEXTURE1),ge?(ge.texture.bind(st,V.CLAMP_TO_EDGE,V.LINEAR_MIPMAP_NEAREST),Fe=Math.pow(2,ge.tileID.overscaledZ-me.tileID.overscaledZ),Qe=[me.tileID.canonical.x*Fe%1,me.tileID.canonical.y*Fe%1]):me.texture.bind(st,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 Ye=x.style.map.terrain&&x.style.map.terrain.getTerrainData(he),Ge=Ye?he:null,mt=Ge?Ge.posMatrix:x.transform.calculatePosMatrix(he.toUnwrapped(),ce),Ot=a_(mt,Qe||[0,0],Fe||1,Be,P);F instanceof xi?Z.draw(N,V.TRIANGLES,te,On.disabled,J,Tn.disabled,Ot,Ye,P.id,F.boundsBuffer,x.quadTriangleIndexBuffer,F.boundsSegments):Z.draw(N,V.TRIANGLES,te,ee[he.overscaledZ],J,Tn.disabled,Ot,Ye,P.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments)}})(o,d,m,y);break;case"background":(function(x,M,P,O){const N=P.paint.get("background-color"),V=P.paint.get("background-opacity");if(V===0)return;const F=x.context,Z=F.gl,J=x.transform,ee=J.tileSize,re=P.paint.get("background-pattern");if(x.isPatternMissing(re))return;const le=!re&&N.a===1&&V===1&&x.opaquePassEnabledForLayer()?"opaque":"translucent";if(x.renderPass!==le)return;const ce=On.disabled,he=x.depthModeForSublayer(0,le==="opaque"?Ht.ReadWrite:Ht.ReadOnly),te=x.colorModeForRenderPass(),me=x.useProgram(re?"backgroundPattern":"background"),ge=O||J.coveringTiles({tileSize:ee,terrain:x.style.map.terrain});re&&(F.activeTexture.set(Z.TEXTURE0),x.imageManager.bind(x.context));const ve=P.getCrossfadeParameters();for(const Be of ge){const Fe=O?Be.posMatrix:x.transform.calculatePosMatrix(Be.toUnwrapped()),Qe=re?id(Fe,V,x,re,{tileID:Be,tileSize:ee},ve):lu(Fe,V,N),st=x.style.map.terrain&&x.style.map.terrain.getTerrainData(Be);me.draw(F,Z.TRIANGLES,he,ce,te,Tn.disabled,Qe,st,P.id,x.tileExtentBuffer,x.quadTriangleIndexBuffer,x.tileExtentSegments)}})(o,0,m,y);break;case"custom":(function(x,M,P){const O=x.context,N=P.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)}})(o,0,m)}}translatePosMatrix(o,d,m,y,x){if(!m[0]&&!m[1])return o;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 P=[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,o,P),O}saveTileTexture(o){const d=this._tileTextures[o.size[0]];d?d.push(o):this._tileTextures[o.size[0]]=[o]}getTileTexture(o){const d=this._tileTextures[o];return d&&d.length>0?d.pop():null}isPatternMissing(o){if(!o)return!1;if(!o.from||!o.to)return!0;const d=this.imageManager.getPattern(o.from.toString()),m=this.imageManager.getPattern(o.to.toString());return!d||!m}useProgram(o,d){this.cache=this.cache||{};const m=o+(d?d.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[m]||(this.cache[m]=new td(this.context,ds[o],d,rd[o],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 o=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(o.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Je(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:o,drawingBufferHeight:d}=this.context.gl;return this.width!==o||this.height!==d}}class Va{constructor(o,d){this.points=o,this.planes=d}static fromInvProjectionMatrix(o,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(P=>{const O=1/(P=l.af([],P,o))[3]/d*y;return l.b1(P,P,[O,O,1/P[3],O])}),M=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(P=>{const O=function(Z,J){var ee=J[0],re=J[1],le=J[2],ce=ee*ee+re*re+le*le;return ce>0&&(ce=1/Math.sqrt(ce)),Z[0]=J[0]*ce,Z[1]=J[1]*ce,Z[2]=J[2]*ce,Z}([],function(Z,J,ee){var re=J[0],le=J[1],ce=J[2],he=ee[0],te=ee[1],me=ee[2];return Z[0]=le*me-ce*te,Z[1]=ce*he-re*me,Z[2]=re*te-le*he,Z}([],Ce([],x[P[0]],x[P[1]]),Ce([],x[P[2]],x[P[1]]))),N=-((V=O)[0]*(F=x[P[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(o,d){this.min=o,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(o){const d=[o%2==0,o<2],m=Se(this.min),y=Se(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(o){return Math.max(Math.min(this.max[0],o[0]),this.min[0])-o[0]}distanceY(o){return Math.max(Math.min(this.max[1],o[1]),this.min[1])-o[1]}intersects(o){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<o.planes.length;y++){const x=o.planes[y];let M=0;for(let P=0;P<d.length;P++)l.b2(x,d[P])>=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 P=0;P<o.points.length;P++){const O=o.points[P][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(o=0,d=0,m=0,y=0){if(isNaN(o)||o<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=o,this.bottom=d,this.left=m,this.right=y}interpolate(o,d,m){return d.top!=null&&o.top!=null&&(this.top=l.y.number(o.top,d.top,m)),d.bottom!=null&&o.bottom!=null&&(this.bottom=l.y.number(o.bottom,d.bottom,m)),d.left!=null&&o.left!=null&&(this.left=l.y.number(o.left,d.left,m)),d.right!=null&&o.right!=null&&(this.right=l.y.number(o.right,d.right,m)),this}getCenter(o,d){const m=l.ac((this.left+o-this.right)/2,0,o),y=l.ac((this.top+d-this.bottom)/2,0,d);return new l.P(m,y)}equals(o){return this.top===o.top&&this.bottom===o.bottom&&this.left===o.left&&this.right===o.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(o,d,m,y,x){this.tileSize=512,this._renderWorldCopies=x===void 0||!!x,this._minZoom=o||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 o=new ja(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return o.apply(this),o}apply(o){this.tileSize=o.tileSize,this.latRange=o.latRange,this.lngRange=o.lngRange,this.width=o.width,this.height=o.height,this._center=o._center,this._elevation=o._elevation,this.minElevationForCurrentTile=o.minElevationForCurrentTile,this.zoom=o.zoom,this.angle=o.angle,this._fov=o._fov,this._pitch=o._pitch,this._unmodified=o._unmodified,this._edgeInsets=o._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(o){this._minZoom!==o&&(this._minZoom=o,this.zoom=Math.max(this.zoom,o))}get maxZoom(){return this._maxZoom}set maxZoom(o){this._maxZoom!==o&&(this._maxZoom=o,this.zoom=Math.min(this.zoom,o))}get minPitch(){return this._minPitch}set minPitch(o){this._minPitch!==o&&(this._minPitch=o,this.pitch=Math.max(this.pitch,o))}get maxPitch(){return this._maxPitch}set maxPitch(o){this._maxPitch!==o&&(this._maxPitch=o,this.pitch=Math.min(this.pitch,o))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(o){o===void 0?o=!0:o===null&&(o=!1),this._renderWorldCopies=o}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(o){const d=-l.b3(o,-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],P=y[1],O=y[2],N=y[3],V=Math.sin(x),F=Math.cos(x);m[0]=M*F+O*V,m[1]=P*F+N*V,m[2]=M*-V+O*F,m[3]=P*-V+N*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(o){const d=l.ac(o,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(o){o=Math.max(.01,Math.min(60,o)),this._fov!==o&&(this._unmodified=!1,this._fov=o/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(o){const d=Math.min(Math.max(o,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(o){o.lat===this._center.lat&&o.lng===this._center.lng||(this._unmodified=!1,this._center=o,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(o){o!==this._elevation&&(this._elevation=o,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(o){this._edgeInsets.equals(o)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,o,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(o){return this._edgeInsets.equals(o)}interpolatePadding(o,d,m){this._unmodified=!1,this._edgeInsets.interpolate(o,d,m),this._constrain(),this._calcMatrices()}coveringZoomLevel(o){const d=(o.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/o.tileSize));return Math.max(0,d)}getVisibleUnwrappedCoordinates(o){const d=[new l.b4(0,o)];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)),P=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=P-N;V<=O+N;V++)V!==0&&d.push(new l.b4(V,o))}return d}coveringTiles(o){var d,m;let y=this.coveringZoomLevel(o);const x=y;if(o.minzoom!==void 0&&y<o.minzoom)return[];o.maxzoom!==void 0&&y>o.maxzoom&&(y=o.maxzoom);const M=this.pointCoordinate(this.getCameraPoint()),P=l.Z.fromLngLat(this.center),O=Math.pow(2,y),N=[O*M.x,O*M.y,0],V=[O*P.x,O*P.y,0],F=Va.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,y);let Z=o.minzoom||0;!o.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(Z=y);const J=o.terrain?2/Math.min(this.tileSize,o.tileSize)*this.tileSize:3,ee=te=>({aabb:new Fa([te*O,0,0],[(te+1)*O,O,0]),zoom:0,x:0,y:0,wrap:te,fullyVisible:!1}),re=[],le=[],ce=y,he=o.reparseOverscaled?x:y;if(this._renderWorldCopies)for(let te=1;te<=3;te++)re.push(ee(-te)),re.push(ee(te));for(re.push(ee(0));re.length>0;){const te=re.pop(),me=te.x,ge=te.y;let ve=te.fullyVisible;if(!ve){const Ye=te.aabb.intersects(F);if(Ye===0)continue;ve=Ye===2}const Be=o.terrain?N:V,Fe=te.aabb.distanceX(Be),Qe=te.aabb.distanceY(Be),st=Math.max(Math.abs(Fe),Math.abs(Qe));if(te.zoom===ce||st>J+(1<<ce-te.zoom)-2&&te.zoom>=Z){const Ye=ce-te.zoom,Ge=N[0]-.5-(me<<Ye),mt=N[1]-.5-(ge<<Ye);le.push({tileID:new l.S(te.zoom===ce?he:te.zoom,te.wrap,te.zoom,me,ge),distanceSq:Le([V[0]-.5-me,V[1]-.5-ge]),tileDistanceToCamera:Math.sqrt(Ge*Ge+mt*mt)})}else for(let Ye=0;Ye<4;Ye++){const Ge=(me<<1)+Ye%2,mt=(ge<<1)+(Ye>>1),Ot=te.zoom+1;let Xe=te.aabb.quadrant(Ye);if(o.terrain){const nt=new l.S(Ot,te.wrap,Ot,Ge,mt),Pt=o.terrain.getMinMaxElevation(nt),Fn=(d=Pt.minElevation)!==null&&d!==void 0?d:this.elevation,Lt=(m=Pt.maxElevation)!==null&&m!==void 0?m:this.elevation;Xe=new Fa([Xe.min[0],Xe.min[1],Fn],[Xe.max[0],Xe.max[1],Lt])}re.push({aabb:Xe,zoom:Ot,x:Ge,y:mt,wrap:te.wrap,fullyVisible:ve})}}return le.sort((te,me)=>te.distanceSq-me.distanceSq).map(te=>te.tileID)}resize(o,d){this.width=o,this.height=d,this.pixelsToGLUnits=[2/o,-2/d],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(o){return Math.pow(2,o)}scaleZoom(o){return Math.log(o)/Math.LN2}project(o){const d=l.ac(o.lat,-85.051129,_d);return new l.P(l.O(o.lng)*this.worldSize,l.Q(d)*this.worldSize)}unproject(o){return new l.Z(o.x/this.worldSize,o.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(o){const d=this.elevation,m=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,y=this.pointLocation(this.centerPoint,o),x=o.getElevationForLngLatZoom(y,this.tileZoom);if(!(this.elevation-x))return;const M=m+d-x,P=Math.cos(this._pitch)*this.cameraToCenterDistance/M/l.b5(1,y.lat),O=this.scaleZoom(P/this.tileSize);this._elevation=x,this._center=y,this.zoom=O}setLocationAtPoint(o,d){const m=this.pointCoordinate(d),y=this.pointCoordinate(this.centerPoint),x=this.locationCoordinate(o),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(o,d){return d?this.coordinatePoint(this.locationCoordinate(o),d.getElevationForLngLatZoom(o,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(o))}pointLocation(o,d){return this.coordinateLocation(this.pointCoordinate(o,d))}locationCoordinate(o){return l.Z.fromLngLat(o)}coordinateLocation(o){return o&&o.toLngLat()}pointCoordinate(o,d){if(d){const Z=d.pointCoordinate(o);if(Z!=null)return Z}const m=[o.x,o.y,0,1],y=[o.x,o.y,1,1];l.af(m,m,this.pixelMatrixInverse),l.af(y,y,this.pixelMatrixInverse);const x=m[3],M=y[3],P=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(P,O,F)/this.worldSize)}coordinatePoint(o,d=0,m=this.pixelMatrix){const y=[o.x*this.worldSize,o.y*this.worldSize,d,1];return l.af(y,y,m),new l.P(y[0]/y[3],y[1]/y[3])}getBounds(){const o=Math.max(0,this.height/2-this.getHorizon());return new we().extend(this.pointLocation(new l.P(0,o))).extend(this.pointLocation(new l.P(this.width,o))).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(o){o?(this.lngRange=[o.getWest(),o.getEast()],this.latRange=[o.getSouth(),o.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,_d])}calculateTileMatrix(o){const d=o.canonical,m=this.worldSize/this.zoomScale(d.z),y=d.x+Math.pow(2,d.z)*o.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(o,d=!1){const m=o.key,y=d?this._alignedPosMatrixCache:this._posMatrixCache;if(y[m])return y[m];const x=this.calculateTileMatrix(o);return l.L(x,d?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,x),y[m]=new Float32Array(x),y[m]}calculateFogMatrix(o){const d=o.key,m=this._fogMatrixCache;if(m[d])return m[d];const y=this.calculateTileMatrix(o);return l.L(y,this.fogMatrix,y),m[d]=new Float32Array(y),m[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(o,d){d=l.ac(+d,this.minZoom,this.maxZoom);const m={center:new l.N(o.lng,o.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,P=x,O=0,N=x,V=0,F=0;const{x:Z,y:J}=this.size;if(this.latRange){const te=this.latRange;M=l.Q(te[1])*x,P=l.Q(te[0])*x,P-M<J&&(V=J/(P-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<Z&&(F=Z/(N-O)));const{x:ee,y:re}=this.project.call({worldSize:x},o);let le,ce;const he=Math.max(F||0,V||0);if(he){const te=new l.P(F?(N+O)/2:ee,V?(P+M)/2:re);return m.center=this.unproject.call({worldSize:x},te).wrap(),m.zoom+=this.scaleZoom(he),m}if(this.latRange){const te=J/2;re-te<M&&(ce=M+te),re+te>P&&(ce=P-te)}if(y){const te=(O+N)/2;let me=ee;this._renderWorldCopies&&(me=l.b3(ee,te-x/2,te+x/2));const ge=Z/2;me-ge<O&&(le=O+ge),me+ge>N&&(le=N-ge)}if(le!==void 0||ce!==void 0){const te=new l.P(le??ee,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 o=this._unmodified,{center:d,zoom:m}=this.getConstrained(this.center,this.zoom);this.center=d,this.zoom=m,this._unmodified=o,this._constraining=!1}_calcMatrices(){if(!this.height)return;const o=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),P=x-M*this._pixelPerMeter/Math.cos(this._pitch),O=M<0?P:x,N=Math.PI/2+this._pitch,V=this._fov*(.5+o.y/this.height),F=Math.sin(V)*O/Math.sin(l.ac(Math.PI-N-V,.01,Math.PI-.01)),Z=this.getHorizon(),J=2*Math.atan(Z/this.cameraToCenterDistance)*(.5+o.y/(2*Z)),ee=Math.sin(J)*O/Math.sin(l.ac(Math.PI-N-J,.01,Math.PI-.01)),re=Math.min(F,ee);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*-o.x/this.width,y[9]=2*o.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*-o.x/this.width,this.fogMatrix[9]=2*o.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 le=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*le+te*ce,ge=m-Math.round(m)+he*ce+te*le,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 o=this.pointCoordinate(new l.P(0,0)),d=[o.x*this.worldSize,o.y*this.worldSize,0,1];return l.af(d,d,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const o=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.P(0,o))}getCameraQueryGeometry(o){const d=this.getCameraPoint();if(o.length===1)return[o[0],d];{let m=d.x,y=d.y,x=d.x,M=d.y;for(const P of o)m=Math.min(m,P.x),y=Math.min(y,P.y),x=Math.max(x,P.x),M=Math.max(M,P.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(o,d){const m=this.locationCoordinate(o),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,o){let d,m=!1,y=null,x=null;const M=()=>{y=null,m&&(v.apply(x,d),y=setTimeout(M,o),m=!1)};return(...P)=>(m=!0,x=this,d=P,y||M(),y)}class bu{constructor(o){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=o&&encodeURIComponent(o)}addTo(o){return this._map=o,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(o){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,P=Math.round(d.lat*x)/x,O=this._map.getBearing(),N=this._map.getPitch();let V="";if(V+=o?`/${M}/${P}/${m}`:`${m}/${P}/${M}`,(O||N)&&(V+="/"+Math.round(10*O)/10),N&&(V+=`/${Math.round(N)}`),this._hashName){const F=this._hashName;let Z=!1;const J=window.location.hash.slice(1).split("&").map(ee=>{const re=ee.split("=")[0];return re===F?(Z=!0,`${re}=${V}`):ee}).filter(ee=>ee);return Z||J.push(`${F}=${V}`),`#${J.join("&")}`}return`#${V}`}}const xu={linearity:.3,easing:l.b8(0,0,.3,1)},bd=l.e({deceleration:2500,maxSpeed:1400},xu),x_=l.e({deceleration:20,maxSpeed:1400},xu),vm=l.e({deceleration:1e3,maxSpeed:360},xu),vu=l.e({deceleration:1e3,maxSpeed:90},xu);class xd{constructor(o){this._map=o,this.clear()}clear(){this._inertiaBuffer=[]}record(o){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:E.now(),settings:o})}_drainInertiaBuffer(){const o=this._inertiaBuffer,d=E.now();for(;o.length>0&&d-o[0].time>160;)o.shift()}_onMoveEnd(o){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,o||{}));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,x_);y.zoom=this._map.transform.zoom+x.amount,Yl(y,x)}if(d.bearing){const x=Xl(d.bearing,m,vm);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,o){(!v.duration||v.duration<o.duration)&&(v.duration=o.duration,v.easing=o.easing)}function Xl(v,o,d){const{maxSpeed:m,linearity:y,deceleration:x}=d,M=l.ac(v*y/(o/1e3),-m,m),P=Math.abs(M)/(x*y);return{easing:d.easing,duration:1e3*P,amount:M*(P/2)}}class Di extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(o,d,m,y={}){const x=C.mousePos(d.getCanvas(),m),M=d.unproject(x);super(o,l.e({point:x,lngLat:M,originalEvent:m},y)),this._defaultPrevented=!1,this.target=d}}class Ys extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(o,d,m){const y=o==="touchend"?m.changedTouches:m.touches,x=C.touchPos(d.getCanvasContainer(),y),M=x.map(O=>d.unproject(O)),P=x.reduce((O,N,V,F)=>O.add(N.div(F.length)),new l.P(0,0));super(o,{points:x,point:P,lngLats:M,lngLat:d.unproject(P),originalEvent:m}),this._defaultPrevented=!1}}class wm extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(o,d,m){super(o,{originalEvent:m}),this._defaultPrevented=!1}}class km{constructor(o,d){this._map=o,this._clickTolerance=d.clickTolerance}reset(){delete this._mousedownPos}wheel(o){return this._firePreventable(new wm(o.type,this._map,o))}mousedown(o,d){return this._mousedownPos=d,this._firePreventable(new Di(o.type,this._map,o))}mouseup(o){this._map.fire(new Di(o.type,this._map,o))}click(o,d){this._mousedownPos&&this._mousedownPos.dist(d)>=this._clickTolerance||this._map.fire(new Di(o.type,this._map,o))}dblclick(o){return this._firePreventable(new Di(o.type,this._map,o))}mouseover(o){this._map.fire(new Di(o.type,this._map,o))}mouseout(o){this._map.fire(new Di(o.type,this._map,o))}touchstart(o){return this._firePreventable(new Ys(o.type,this._map,o))}touchmove(o){this._map.fire(new Ys(o.type,this._map,o))}touchend(o){this._map.fire(new Ys(o.type,this._map,o))}touchcancel(o){this._map.fire(new Ys(o.type,this._map,o))}_firePreventable(o){if(this._map.fire(o),o.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Qn{constructor(o){this._map=o}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(o){this._map.fire(new Di(o.type,this._map,o))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Di("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(o){this._delayContextMenu?this._contextMenuEvent=o:this._ignoreContextMenu||this._map.fire(new Di(o.type,this._map,o)),this._map.listens("contextmenu")&&o.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class eo{constructor(o){this._map=o}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(o){return this.transform.pointLocation(l.P.convert(o),this._map.terrain)}}class _r{constructor(o,d){this._map=o,this._tr=new eo(o),this._el=o.getCanvasContainer(),this._container=o.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(o,d){this.isEnabled()&&o.shiftKey&&o.button===0&&(C.disableDrag(),this._startPos=this._lastPos=d,this._active=!0)}mousemoveWindow(o,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",o));const x=Math.min(y.x,m.x),M=Math.max(y.x,m.x),P=Math.min(y.y,m.y),O=Math.max(y.y,m.y);C.setTransform(this._box,`translate(${x}px,${P}px)`),this._box.style.width=M-x+"px",this._box.style.height=O-P+"px"}mouseupWindow(o,d){if(!this._active||o.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:o})),{cameraAnimation:x=>x.fitScreenCoordinates(m,y,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",o)}keydown(o){this._active&&o.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",o))}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(o,d){return this._map.fire(new l.k(o,{originalEvent:d}))}}function Kl(v,o){if(v.length!==o.length)throw new Error(`The number of touches and points are not equal - touches ${v.length}, points ${o.length}`);const d={};for(let m=0;m<v.length;m++)d[v[m].identifier]=o[m];return d}class vd{constructor(o){this.reset(),this.numTouches=o.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(o,d,m){(this.centroid||m.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=o.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(o,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(o,d,m){if((!this.centroid||o.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(o){this.singleTap=new vd(o),this.numTaps=o.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(o,d,m){this.singleTap.touchstart(o,d,m)}touchmove(o,d,m){this.singleTap.touchmove(o,d,m)}touchend(o,d,m){const y=this.singleTap.touchend(o,d,m);if(y){const x=o.timeStamp-this.lastTime<500,M=!this.lastTap||this.lastTap.dist(y)<30;if(x&&M||this.reset(),this.count++,this.lastTime=o.timeStamp,this.lastTap=y,this.count===this.numTaps)return this.reset(),y}}}class Ua{constructor(o){this._tr=new eo(o),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(o,d,m){this._zoomIn.touchstart(o,d,m),this._zoomOut.touchstart(o,d,m)}touchmove(o,d,m){this._zoomIn.touchmove(o,d,m),this._zoomOut.touchmove(o,d,m)}touchend(o,d,m){const y=this._zoomIn.touchend(o,d,m),x=this._zoomOut.touchend(o,d,m),M=this._tr;return y?(this._active=!0,o.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:P=>P.easeTo({duration:300,zoom:M.zoom+1,around:M.unproject(y)},{originalEvent:o})}):x?(this._active=!0,o.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:P=>P.easeTo({duration:300,zoom:M.zoom-1,around:M.unproject(x)},{originalEvent:o})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qo{constructor(o){this._enabled=!!o.enable,this._moveStateManager=o.moveStateManager,this._clickTolerance=o.clickTolerance||1,this._moveFunction=o.move,this._activateOnStart=!!o.activateOnStart,o.assignEvents(this),this.reset()}reset(o){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(o)}_move(...o){const d=this._moveFunction(...o);if(d.bearingDelta||d.pitchDelta||d.around||d.panDelta)return this._active=!0,d}dragStart(o,d){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(o)&&(this._moveStateManager.startMove(o),this._lastPoint=d.length?d[0]:d,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(o,d){if(!this.isEnabled())return;const m=this._lastPoint;if(!m)return;if(o.preventDefault(),!this._moveStateManager.isValidMoveEvent(o))return void this.reset(o);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(o){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(o)&&(this._moved&&C.suppressClick(),this.reset(o))}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(o){this._correctEvent=o.checkCorrectEvent}startMove(o){const d=C.mouseButton(o);this._eventButton=d}endMove(o){delete this._eventButton}isValidStartEvent(o){return this._correctEvent(o)}isValidMoveEvent(o){return!function(d,m){const y=wd[m];return d.buttons===void 0||(d.buttons&y)!==y}(o,this._eventButton)}isValidEndEvent(o){return C.mouseButton(o)===this._eventButton}}class kd{constructor(){this._firstTouch=void 0}_isOneFingerTouch(o){return o.targetTouches.length===1}_isSameTouchEvent(o){return o.targetTouches[0].identifier===this._firstTouch}startMove(o){this._firstTouch=o.targetTouches[0].identifier}endMove(o){delete this._firstTouch}isValidStartEvent(o){return this._isOneFingerTouch(o)}isValidMoveEvent(o){return this._isOneFingerTouch(o)&&this._isSameTouchEvent(o)}isValidEndEvent(o){return this._isOneFingerTouch(o)&&this._isSameTouchEvent(o)}}const Su=v=>{v.mousedown=v.dragStart,v.mousemoveWindow=v.dragMove,v.mouseup=v.dragEnd,v.contextmenu=o=>{o.preventDefault()}},Sd=({enable:v,clickTolerance:o,bearingDegreesPerPixelMoved:d=.8})=>{const m=new ku({checkCorrectEvent:y=>C.mouseButton(y)===0&&y.ctrlKey||C.mouseButton(y)===2});return new qo({clickTolerance:o,move:(y,x)=>({bearingDelta:(x.x-y.x)*d}),moveStateManager:m,enable:v,assignEvents:Su})},Ed=({enable:v,clickTolerance:o,pitchDegreesPerPixelMoved:d=-.5})=>{const m=new ku({checkCorrectEvent:y=>C.mouseButton(y)===0&&y.ctrlKey||C.mouseButton(y)===2});return new qo({clickTolerance:o,move:(y,x)=>({pitchDelta:(x.y-y.y)*d}),moveStateManager:m,enable:v,assignEvents:Su})};class Xs{constructor(o,d){this._clickTolerance=o.clickTolerance||1,this._map=d,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.P(0,0)}_shouldBePrevented(o){return o<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(o,d,m){return this._calculateTransform(o,d,m)}touchmove(o,d,m){if(this._active){if(!this._shouldBePrevented(m.length))return o.preventDefault(),this._calculateTransform(o,d,m);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",o)}}touchend(o,d,m){this._calculateTransform(o,d,m),this._active&&this._shouldBePrevented(m.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(o,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 P=0;for(const N in y){const V=y[N],F=this._touches[N];F&&(x._add(V),M._add(V.sub(F)),P++,y[N]=V)}if(this._touches=y,this._shouldBePrevented(P)||!M.mag())return;const O=M.div(P);return this._sum._add(O),this._sum.mag()<this._clickTolerance?void 0:{around:x.div(P),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(o,d,m){this._firstTwoTouches||m.length<2||(this._firstTwoTouches=[m[0].identifier,m[1].identifier],this._start([d[0],d[1]]))}touchmove(o,d,m){if(!this._firstTwoTouches)return;o.preventDefault();const[y,x]=this._firstTwoTouches,M=Jl(m,d,y),P=Jl(m,d,x);if(!M||!P)return;const O=this._aroundCenter?null:M.add(P).div(2);return this._move([M,P],O,o)}touchend(o,d,m){if(!this._firstTwoTouches)return;const[y,x]=this._firstTwoTouches,M=Jl(m,d,y),P=Jl(m,d,x);M&&P||(this._active&&C.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(o){this._enabled=!0,this._aroundCenter=!!o&&o.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Jl(v,o,d){for(let m=0;m<v.length;m++)if(v[m].identifier===d)return o[m]}function Cd(v,o){return Math.log(v/o)/Math.LN2}class Td extends Eu{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(o){this._startDistance=this._distance=o[0].dist(o[1])}_move(o,d){const m=this._distance;if(this._distance=o[0].dist(o[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,o){return 180*v.angleWith(o)/Math.PI}class Ad extends Eu{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(o){this._startVector=this._vector=o[0].sub(o[1]),this._minDiameter=o[0].dist(o[1])}_move(o,d,m){const y=this._vector;if(this._vector=o[0].sub(o[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Md(this._vector,y),pinchAround:d}}_isBelowThreshold(o){this._minDiameter=Math.min(this._minDiameter,o.mag());const d=25/(Math.PI*this._minDiameter)*360,m=Md(o,this._startVector);return Math.abs(m)<d}}function Cu(v){return Math.abs(v.y)>Math.abs(v.x)}class Ha extends Eu{constructor(o){super(),this._currentTouchCount=0,this._map=o}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(o,d,m){super.touchstart(o,d,m),this._currentTouchCount=m.length}_start(o){this._lastPoints=o,Cu(o[0].sub(o[1]))&&(this._valid=!1)}_move(o,d,m){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const y=o[0].sub(this._lastPoints[0]),x=o[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(y,x,m.timeStamp),this._valid?(this._lastPoints=o,this._active=!0,{pitchDelta:(y.y+x.y)/2*-.5}):void 0}gestureBeginsVertically(o,d,m){if(this._valid!==void 0)return this._valid;const y=o.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=o.y>0==d.y>0;return Cu(o)&&Cu(d)&&M}}const Sm={panStep:100,bearingStep:15,pitchStep:10};class Lr{constructor(o){this._tr=new eo(o);const d=Sm;this._panStep=d.panStep,this._bearingStep=d.bearingStep,this._pitchStep=d.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(o){if(o.altKey||o.ctrlKey||o.metaKey)return;let d=0,m=0,y=0,x=0,M=0;switch(o.keyCode){case 61:case 107:case 171:case 187:d=1;break;case 189:case 109:case 173:d=-1;break;case 37:o.shiftKey?m=-1:(o.preventDefault(),x=-1);break;case 39:o.shiftKey?m=1:(o.preventDefault(),x=1);break;case 38:o.shiftKey?y=1:(o.preventDefault(),M=-1);break;case 40:o.shiftKey?y=-1:(o.preventDefault(),M=1);break;default:return}return this._rotationDisabled&&(m=0,y=0),{cameraAnimation:P=>{const O=this._tr;P.easeTo({duration:300,easeId:"keyboardHandler",easing:Ao,zoom:d?Math.round(O.zoom)+d*(o.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:o})}}}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 Ao(v){return v*(2-v)}const Id=4.000244140625;class to{constructor(o,d){this._onTimeout=m=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(m)},this._map=o,this._tr=new eo(o),this._triggerRenderFrame=d,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(o){this._defaultZoomRate=o}setWheelZoomRate(o){this._wheelZoomRate=o}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(o){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!o&&o.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(o){return!!this._map.cooperativeGestures.isEnabled()&&!(o.ctrlKey||this._map.cooperativeGestures.isBypassed(o))}wheel(o){if(!this.isEnabled())return;if(this._shouldBePrevented(o))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",o);let d=o.deltaMode===WheelEvent.DOM_DELTA_LINE?40*o.deltaY:o.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,o)):this._type||(this._type=Math.abs(y*d)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,d+=this._lastValue)),o.shiftKey&&d&&(d/=4),this._type&&(this._lastWheelEvent=o,this._delta-=d,this._active||this._start(o)),o.preventDefault()}_start(o){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(),o),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 o=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"?o.zoomScale(this._targetZoom):o.scale;this._targetZoom=Math.min(o.maxZoom,Math.max(o.minZoom,o.scaleZoom(V*N))),this._type==="wheel"&&(this._startZoom=o.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const d=typeof this._targetZoom=="number"?this._targetZoom:o.zoom,m=this._startZoom,y=this._easing;let x,M=!1;const P=E.now()-this._lastWheelEventTime;if(this._type==="wheel"&&m&&y&&P){const O=Math.min(P/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-o.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(o){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,P=Math.sqrt(.0729-M*M);d=l.b8(M,P,.25,1)}return this._prevEase={start:E.now(),duration:o,easing:d},d}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ks{constructor(o,d){this._clickZoom=o,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 v_{constructor(o){this._tr=new eo(o),this.reset()}reset(){this._active=!1}dblclick(o,d){return o.preventDefault(),{cameraAnimation:m=>{m.easeTo({duration:300,zoom:this._tr.zoom+(o.shiftKey?-1:1),around:this._tr.unproject(d)},{originalEvent:o})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class w_{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(o,d,m){if(!this._swipePoint)if(this._tapTime){const y=d[0],x=o.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(o,d,m)}touchmove(o,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,o.preventDefault(),this._active=!0,{zoomDelta:x/128}}}else this._tap.touchmove(o,d,m)}touchend(o,d,m){if(this._tapTime)this._swipePoint&&m.length===0&&this.reset();else{const y=this._tap.touchend(o,d,m);y&&(this._tapTime=o.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 Em{constructor(o,d,m){this._el=o,this._mousePan=d,this._touchPan=m}enable(o){this._inertiaOptions=o||{},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 Cm{constructor(o,d,m){this._pitchWithRotate=o.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(o,d,m,y){this._el=o,this._touchZoom=d,this._touchRotate=m,this._tapDragZoom=y,this._rotationDisabled=!1,this._enabled=!0}enable(o){this._touchZoom.enable(o),this._rotationDisabled||this._touchRotate.enable(o),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(o,d){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=o,this._options=d,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const o=this._map.getCanvasContainer();o.classList.add("maplibregl-cooperative-gestures"),this._container=C.create("div","maplibregl-cooperative-gesture-screen",o);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(o){return o[this._bypassKey]}notifyGestureBlocked(o,d){this._enabled&&(this._map.fire(new l.k("cooperativegestureprevented",{gestureType:o,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 ut extends l.k{}function Tu(v){return v.panDelta&&v.panDelta.mag()||v.zoomDelta||v.bearingDelta||v.pitchDelta}class Dd{constructor(o,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,P={needsRenderFrame:!1},O={},N={},V=y.touches,F=V?this._getMapTouches(V):void 0,Z=F?C.touchPos(this._map.getCanvas(),F):C.mousePos(this._map.getCanvas(),y);for(const{handlerName:re,handler:le,allowed:ce}of this._handlers){if(!le.isEnabled())continue;let he;this._blockedByActive(N,ce,re)?le.reset():le[x||y.type]&&(he=le[x||y.type](y,Z,F),this.mergeHandlerResult(P,O,he,re,M),he&&he.needsRenderFrame&&this._triggerRenderFrame()),(he||le.isActive())&&(N[re]=le)}const J={};for(const re in this._previousActiveHandlers)N[re]||(J[re]=M);this._previousActiveHandlers=N,(Object.keys(J).length||Tu(P))&&(this._changes.push([P,O,J]),this._triggerRenderFrame()),(Object.keys(N).length||Tu(P))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ee}=P;ee&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ee(this._map))},this._map=o,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new xd(o),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[o,d,m]of this._listeners)C.removeEventListener(o,d,o===document?this.handleWindowEvent:this.handleEvent,m)}_addDefaultHandlers(o){const d=this._map,m=d.getCanvasContainer();this._add("mapEvent",new km(d,o));const y=d.boxZoom=new _r(d,o);this._add("boxZoom",y),o.interactive&&o.boxZoom&&y.enable();const x=d.cooperativeGestures=new qa(d,o.cooperativeGestures);this._add("cooperativeGestures",x),o.cooperativeGestures&&x.enable();const M=new Ua(d),P=new v_(d);d.doubleClickZoom=new Ks(P,M),this._add("tapZoom",M),this._add("clickZoom",P),o.interactive&&o.doubleClickZoom&&d.doubleClickZoom.enable();const O=new w_;this._add("tapDragZoom",O);const N=d.touchPitch=new Ha(d);this._add("touchPitch",N),o.interactive&&o.touchPitch&&d.touchPitch.enable(o.touchPitch);const V=Sd(o),F=Ed(o);d.dragRotate=new Cm(o,V,F),this._add("mouseRotate",V,["mousePitch"]),this._add("mousePitch",F,["mouseRotate"]),o.interactive&&o.dragRotate&&d.dragRotate.enable();const Z=(({enable:he,clickTolerance:te})=>{const me=new ku({checkCorrectEvent:ge=>C.mouseButton(ge)===0&&!ge.ctrlKey});return new qo({clickTolerance:te,move:(ge,ve)=>({around:ve,panDelta:ve.sub(ge)}),activateOnStart:!0,moveStateManager:me,enable:he,assignEvents:Su})})(o),J=new Xs(o,d);d.dragPan=new Em(m,Z,J),this._add("mousePan",Z),this._add("touchPan",J,["touchZoom","touchRotate"]),o.interactive&&o.dragPan&&d.dragPan.enable(o.dragPan);const ee=new Ad,re=new Td;d.touchZoomRotate=new Pd(m,re,ee,O),this._add("touchRotate",ee,["touchPan","touchZoom"]),this._add("touchZoom",re,["touchPan","touchRotate"]),o.interactive&&o.touchZoomRotate&&d.touchZoomRotate.enable(o.touchZoomRotate);const le=d.scrollZoom=new to(d,()=>this._triggerRenderFrame());this._add("scrollZoom",le,["mousePan"]),o.interactive&&o.scrollZoom&&d.scrollZoom.enable(o.scrollZoom);const ce=d.keyboard=new Lr(d);this._add("keyboard",ce),o.interactive&&o.keyboard&&d.keyboard.enable(),this._add("blockableMapEvent",new Qn(d))}_add(o,d,m){this._handlers.push({handlerName:o,handler:d,allowed:m}),this._handlersById[o]=d}stop(o){if(!this._updatingCamera){for(const{handler:d}of this._handlers)d.reset();this._inertia.clear(),this._fireEvents({},{},o),this._changes=[]}}isActive(){for(const{handler:o}of this._handlers)if(o.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(o,d,m){for(const y in o)if(y!==m&&(!d||d.indexOf(y)<0))return!0;return!1}_getMapTouches(o){const d=[];for(const m of o)this._el.contains(m.target)&&d.push(m);return d}mergeHandlerResult(o,d,m,y,x){if(!m)return;l.e(o,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 o={},d={},m={};for(const[y,x,M]of this._changes)y.panDelta&&(o.panDelta=(o.panDelta||new l.P(0,0))._add(y.panDelta)),y.zoomDelta&&(o.zoomDelta=(o.zoomDelta||0)+y.zoomDelta),y.bearingDelta&&(o.bearingDelta=(o.bearingDelta||0)+y.bearingDelta),y.pitchDelta&&(o.pitchDelta=(o.pitchDelta||0)+y.pitchDelta),y.around!==void 0&&(o.around=y.around),y.pinchAround!==void 0&&(o.pinchAround=y.pinchAround),y.noInertia&&(o.noInertia=y.noInertia),l.e(d,x),l.e(m,M);this._updateMapTransform(o,d,m),this._changes=[]}_updateMapTransform(o,d,m){const y=this._map,x=y._getTransformForUpdate(),M=y.terrain;if(!(Tu(o)||M&&this._terrainMovement))return this._fireEvents(d,m,!0);let{panDelta:P,zoomDelta:O,bearingDelta:N,pitchDelta:V,around:F,pinchAround:Z}=o;Z!==void 0&&(F=Z),y._stop(!0),F=F||y.transform.centerPoint;const J=x.pointLocation(P?F.sub(P):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(P)):x.setLocationAtPoint(J,F):(this._terrainMovement=!0,this._map._elevationFreeze=!0,x.setLocationAtPoint(J,F)):x.setLocationAtPoint(J,F),y._applyUpdatedTransform(x),this._map._update(),o.noInertia||this._inertia.record(o),this._fireEvents(d,m,!0)}_fireEvents(o,d,m){const y=Vr(this._eventsInProgress),x=Vr(o),M={};for(const F in o){const{originalEvent:Z}=o[F];this._eventsInProgress[F]||(M[`${F}start`]=Z),this._eventsInProgress[F]=o[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 o){const{originalEvent:Z}=o[F];this._fireEvent(F,Z)}const P={};let O;for(const F in this._eventsInProgress){const{handlerName:Z,originalEvent:J}=this._eventsInProgress[F];this._handlersById[Z].isActive()||(delete this._eventsInProgress[F],O=d[Z]||J,P[`${F}end`]=O)}for(const F in P)this._fireEvent(F,P[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),Z=J=>J!==0&&-this._bearingSnap<J&&J<this._bearingSnap;!F||!F.essential&&E.prefersReducedMotion?(this._map.fire(new l.k("moveend",{originalEvent:O})),Z(this._map.getBearing())&&this._map.resetNorth()):(Z(F.bearing||this._map.getBearing())&&(F.bearing=0),F.freezeElevation=!0,this._map.easeTo(F,{originalEvent:O})),this._updatingCamera=!1}}_fireEvent(o,d){this._map.fire(new l.k(o,d?{originalEvent:d}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(o=>{delete this._frameId,this.handleEvent(new ut("renderFrame",{timeStamp:o})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Tm extends l.E{constructor(o,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=o,this._bearingSnap=d.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new l.N(this.transform.center.lng,this.transform.center.lat)}setCenter(o,d){return this.jumpTo({center:o},d)}panBy(o,d,m){return o=l.P.convert(o).mult(-1),this.panTo(this.transform.center,l.e({offset:o},d),m)}panTo(o,d,m){return this.easeTo(l.e({center:o},d),m)}getZoom(){return this.transform.zoom}setZoom(o,d){return this.jumpTo({zoom:o},d),this}zoomTo(o,d,m){return this.easeTo(l.e({zoom:o},d),m)}zoomIn(o,d){return this.zoomTo(this.getZoom()+1,o,d),this}zoomOut(o,d){return this.zoomTo(this.getZoom()-1,o,d),this}getBearing(){return this.transform.bearing}setBearing(o,d){return this.jumpTo({bearing:o},d),this}getPadding(){return this.transform.padding}setPadding(o,d){return this.jumpTo({padding:o},d),this}rotateTo(o,d,m){return this.easeTo(l.e({bearing:o},d),m)}resetNorth(o,d){return this.rotateTo(0,l.e({duration:1e3},o),d),this}resetNorthPitch(o,d){return this.easeTo(l.e({bearing:0,pitch:0,duration:1e3},o),d),this}snapToNorth(o,d){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(o,d):this}getPitch(){return this.transform.pitch}setPitch(o,d){return this.jumpTo({pitch:o},d),this}cameraForBounds(o,d){o=we.convert(o).adjustAntiMeridian();const m=d&&d.bearing||0;return this._cameraForBoxAndBearing(o.getNorthWest(),o.getSouthEast(),m,d)}_cameraForBoxAndBearing(o,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 Ye=y.padding;y.padding={top:Ye,bottom:Ye,right:Ye,left:Ye}}y.padding=l.e(x,y.padding);const M=this.transform,P=M.padding,O=new we(o,d),N=M.project(O.getNorthWest()),V=M.project(O.getNorthEast()),F=M.project(O.getSouthEast()),Z=M.project(O.getSouthWest()),J=l.ba(-m),ee=N.rotate(J),re=V.rotate(J),le=F.rotate(J),ce=Z.rotate(J),he=new l.P(Math.max(ee.x,re.x,ce.x,le.x),Math.max(ee.y,re.y,ce.y,le.y)),te=new l.P(Math.min(ee.x,re.x,ce.x,le.x),Math.min(ee.y,re.y,ce.y,le.y)),me=he.sub(te),ge=(M.width-(P.left+P.right+y.padding.left+y.padding.right))/me.x,ve=(M.height-(P.top+P.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 Be=Math.min(M.scaleZoom(M.scale*Math.min(ge,ve)),y.maxZoom),Fe=l.P.convert(y.offset),Qe=new l.P((y.padding.left-y.padding.right)/2,(y.padding.top-y.padding.bottom)/2).rotate(l.ba(m)),st=Fe.add(Qe).mult(M.scale/M.zoomScale(Be));return{center:M.unproject(N.add(F).div(2).sub(st)),zoom:Be,bearing:m}}fitBounds(o,d,m){return this._fitInternal(this.cameraForBounds(o,d),d,m)}fitScreenCoordinates(o,d,m,y,x){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(l.P.convert(o)),this.transform.pointLocation(l.P.convert(d)),m,y),y,x)}_fitInternal(o,d,m){return o?(delete(d=l.e(o,d)).padding,d.linear?this.easeTo(d,m):this.flyTo(d,m)):this}jumpTo(o,d){this.stop();const m=this._getTransformForUpdate();let y=!1,x=!1,M=!1;return"zoom"in o&&m.zoom!==+o.zoom&&(y=!0,m.zoom=+o.zoom),o.center!==void 0&&(m.center=l.N.convert(o.center)),"bearing"in o&&m.bearing!==+o.bearing&&(x=!0,m.bearing=+o.bearing),"pitch"in o&&m.pitch!==+o.pitch&&(M=!0,m.pitch=+o.pitch),o.padding==null||m.isPaddingEqual(o.padding)||(m.padding=o.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(o,d,m,y=0){const x=l.Z.fromLngLat(o,d),M=l.Z.fromLngLat(m,y),P=M.x-x.x,O=M.y-x.y,N=M.z-x.z,V=Math.hypot(P,O,N);if(V===0)throw new Error("Can't calculate camera options with same From and To");const F=Math.hypot(P,O),Z=this.transform.scaleZoom(this.transform.cameraToCenterDistance/V/this.transform.tileSize),J=180*Math.atan2(P,-O)/Math.PI;let ee=180*Math.acos(F/V)/Math.PI;return ee=N<0?90-ee:90+ee,{center:M.toLngLat(),zoom:Z,pitch:ee,bearing:J}}easeTo(o,d){var m;this._stop(!1,o.easeId),((o=l.e({offset:[0,0],duration:500,easing:l.b9},o)).animate===!1||!o.essential&&E.prefersReducedMotion)&&(o.duration=0);const y=this._getTransformForUpdate(),x=y.zoom,M=y.bearing,P=y.pitch,O=y.padding,N="bearing"in o?this._normalizeBearing(o.bearing,M):M,V="pitch"in o?+o.pitch:P,F="padding"in o?o.padding:y.padding,Z=l.P.convert(o.offset);let J=y.centerPoint.add(Z);const ee=y.pointLocation(J),{center:re,zoom:le}=y.getConstrained(l.N.convert(o.center||ee),(m=o.zoom)!==null&&m!==void 0?m:x);this._normalizeCenter(re,y);const ce=y.project(ee),he=y.project(re).sub(ce),te=y.zoomScale(le-x);let me,ge;o.around&&(me=l.N.convert(o.around),ge=y.locationPoint(me));const ve={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||le!==x,this._rotating=this._rotating||M!==N,this._pitching=this._pitching||V!==P,this._padding=!y.isPaddingEqual(F),this._easeId=o.easeId,this._prepareEase(d,o.noMoveStart,ve),this.terrain&&this._prepareElevation(re),this._ease(Be=>{if(this._zooming&&(y.zoom=l.y.number(x,le,Be)),this._rotating&&(y.bearing=l.y.number(M,N,Be)),this._pitching&&(y.pitch=l.y.number(P,V,Be)),this._padding&&(y.interpolatePadding(O,F,Be),J=y.centerPoint.add(Z)),this.terrain&&!o.freezeElevation&&this._updateElevation(Be),me)y.setLocationAtPoint(me,ge);else{const Fe=y.zoomScale(y.zoom-x),Qe=le>x?Math.min(2,te):Math.max(.5,te),st=Math.pow(Qe,1-Be),Ye=y.unproject(ce.add(he.mult(Be*st)).mult(Fe));y.setLocationAtPoint(y.renderWorldCopies?Ye.wrap():Ye,J)}this._applyUpdatedTransform(y),this._fireMoveEvents(d)},Be=>{this.terrain&&o.freezeElevation&&this._finalizeElevation(),this._afterEase(d,Be)},o),this}_prepareEase(o,d,m={}){this._moving=!0,d||m.moving||this.fire(new l.k("movestart",o)),this._zooming&&!m.zooming&&this.fire(new l.k("zoomstart",o)),this._rotating&&!m.rotating&&this.fire(new l.k("rotatestart",o)),this._pitching&&!m.pitching&&this.fire(new l.k("pitchstart",o))}_prepareElevation(o){this._elevationCenter=o,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(o,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(o){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const d=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(o<1&&d!==this._elevationTarget){const m=this._elevationTarget-this._elevationStart;this._elevationStart+=o*(m-(d-(m*o+this._elevationStart))/(1-o)),this._elevationTarget=d}this.transform.elevation=l.y.number(this._elevationStart,this._elevationTarget,o)}_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(o){const d=o.getCameraPosition(),m=this.terrain.getElevationForLngLatZoom(d.lngLat,o.zoom);if(d.altitude<m){const y=this.calculateCameraOptionsFromTo(d.lngLat,m,o.center,o.elevation);return{pitch:y.pitch,zoom:y.zoom}}return{}}_applyUpdatedTransform(o){const d=[];if(this.terrain&&d.push(y=>this._elevateCameraIfInsideTerrain(y)),this.transformCameraUpdate&&d.push(y=>this.transformCameraUpdate(y)),!d.length)return;const m=o.clone();for(const y of d){const x=m.clone(),{center:M,zoom:P,pitch:O,bearing:N,elevation:V}=y(x);M&&(x.center=M),P!==void 0&&(x.zoom=P),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(o){this.fire(new l.k("move",o)),this._zooming&&this.fire(new l.k("zoom",o)),this._rotating&&this.fire(new l.k("rotate",o)),this._pitching&&this.fire(new l.k("pitch",o))}_afterEase(o,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",o)),y&&this.fire(new l.k("rotateend",o)),x&&this.fire(new l.k("pitchend",o)),this.fire(new l.k("moveend",o))}flyTo(o,d){var m;if(!o.essential&&E.prefersReducedMotion){const nt=l.M(o,["center","zoom","bearing","pitch","around"]);return this.jumpTo(nt,d)}this.stop(),o=l.e({offset:[0,0],speed:1.2,curve:1.42,easing:l.b9},o);const y=this._getTransformForUpdate(),x=y.zoom,M=y.bearing,P=y.pitch,O=y.padding,N="bearing"in o?this._normalizeBearing(o.bearing,M):M,V="pitch"in o?+o.pitch:P,F="padding"in o?o.padding:y.padding,Z=l.P.convert(o.offset);let J=y.centerPoint.add(Z);const ee=y.pointLocation(J),{center:re,zoom:le}=y.getConstrained(l.N.convert(o.center||ee),(m=o.zoom)!==null&&m!==void 0?m:x);this._normalizeCenter(re,y);const ce=y.zoomScale(le-x),he=y.project(ee),te=y.project(re).sub(he);let me=o.curve;const ge=Math.max(y.width,y.height),ve=ge/ce,Be=te.mag();if("minZoom"in o){const nt=l.ac(Math.min(o.minZoom,x,le),y.minZoom,y.maxZoom),Pt=ge/y.zoomScale(nt-x);me=Math.sqrt(Pt/Be*2)}const Fe=me*me;function Qe(nt){const Pt=(ve*ve-ge*ge+(nt?-1:1)*Fe*Fe*Be*Be)/(2*(nt?ve:ge)*Fe*Be);return Math.log(Math.sqrt(Pt*Pt+1)-Pt)}function st(nt){return(Math.exp(nt)-Math.exp(-nt))/2}function Ye(nt){return(Math.exp(nt)+Math.exp(-nt))/2}const Ge=Qe(!1);let mt=function(nt){return Ye(Ge)/Ye(Ge+me*nt)},Ot=function(nt){return ge*((Ye(Ge)*(st(Pt=Ge+me*nt)/Ye(Pt))-st(Ge))/Fe)/Be;var Pt},Xe=(Qe(!0)-Ge)/me;if(Math.abs(Be)<1e-6||!isFinite(Xe)){if(Math.abs(ge-ve)<1e-6)return this.easeTo(o,d);const nt=ve<ge?-1:1;Xe=Math.abs(Math.log(ve/ge))/me,Ot=()=>0,mt=Pt=>Math.exp(nt*me*Pt)}return o.duration="duration"in o?+o.duration:1e3*Xe/("screenSpeed"in o?+o.screenSpeed/me:+o.speed),o.maxDuration&&o.duration>o.maxDuration&&(o.duration=0),this._zooming=!0,this._rotating=M!==N,this._pitching=V!==P,this._padding=!y.isPaddingEqual(F),this._prepareEase(d,!1),this.terrain&&this._prepareElevation(re),this._ease(nt=>{const Pt=nt*Xe,Fn=1/mt(Pt);y.zoom=nt===1?le:x+y.scaleZoom(Fn),this._rotating&&(y.bearing=l.y.number(M,N,nt)),this._pitching&&(y.pitch=l.y.number(P,V,nt)),this._padding&&(y.interpolatePadding(O,F,nt),J=y.centerPoint.add(Z)),this.terrain&&!o.freezeElevation&&this._updateElevation(nt);const Lt=nt===1?re:y.unproject(he.add(te.mult(Ot(Pt))).mult(Fn));y.setLocationAtPoint(y.renderWorldCopies?Lt.wrap():Lt,J),this._applyUpdatedTransform(y),this._fireMoveEvents(d)},()=>{this.terrain&&o.freezeElevation&&this._finalizeElevation(),this._afterEase(d)},o),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(o,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 o||(m=this.handlers)===null||m===void 0||m.stop(!1),this}_ease(o,d,m){m.animate===!1||m.duration===0?(o(1),d()):(this._easeStart=E.now(),this._easeOptions=m,this._onEaseFrame=o,this._onEaseEnd=d,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(o,d){o=l.b3(o,-180,180);const m=Math.abs(o-d);return Math.abs(o-360-d)<m&&(o-=360),Math.abs(o+360-d)<m&&(o+=360),o}_normalizeCenter(o,d){if(!d.renderWorldCopies||d.lngRange)return;const m=o.lng-d.center.lng;o.lng+=m>180?-360:m<-180?360:0}queryTerrainElevation(o){return this.terrain?this.terrain.getElevationForLngLatZoom(l.N.convert(o),this.transform.tileZoom)-this.transform.elevation:null}}const Wa={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Ga{constructor(o=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=o}getDefaultPosition(){return"bottom-right"}onAdd(o){return this._map=o,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(o,d){const m=this._map._getUIString(`AttributionControl.${d}`);o.title=m,o.setAttribute("aria-label",m)}_updateAttributions(){if(!this._map.style)return;let o=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?o=o.concat(this.options.customAttribution.map(y=>typeof y!="string"?"":y)):typeof this.options.customAttribution=="string"&&o.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&&o.indexOf(M.attribution)<0&&o.push(M.attribution)}}o=o.filter(y=>String(y).trim()),o.sort((y,x)=>y.length-x.length),o=o.filter((y,x)=>{for(let M=x+1;M<o.length;M++)if(o[M].indexOf(y)>=0)return!1;return!0});const m=o.join(" | ");m!==this._attribHTML&&(this._attribHTML=m,o.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(o={}){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=o}getDefaultPosition(){return"bottom-left"}onAdd(o){this._map=o,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 Qt{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(o){const d=++this._id;return this._queue.push({callback:o,id:d,cancelled:!1}),d}remove(o){const d=this._currentlyRunning,m=d?this._queue.concat(d):this._queue;for(const y of m)if(y.id===o)return void(y.cancelled=!0)}run(o=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(o),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Bd=l.Y([{name:"a_pos3d",type:"Int16",components:3}]);class k_ extends l.E{constructor(o){super(),this.sourceCache=o,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,o.usedForTerrain=!0,o.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(o,d){this.sourceCache.update(o,d),this._renderableTilesKeys=[];const m={};for(const y of o.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 To(y,this.tileSize));for(const y in this._tiles)m[y]||delete this._tiles[y]}freeRtt(o){for(const d in this._tiles){const m=this._tiles[d];(!o||m.tileID.equals(o)||m.tileID.isChildOf(o)||o.isChildOf(m.tileID))&&(m.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(o=>this.getTileByID(o))}getTileByID(o){return this._tiles[o]}getTerrainCoords(o){const d={};for(const m of this._renderableTilesKeys){const y=this._tiles[m].tileID;if(y.canonical.equals(o.canonical)){const x=o.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(o.canonical)){const x=o.clone();x.posMatrix=new Float64Array(16);const M=y.canonical.z-o.canonical.z,P=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,[-P*N,-O*N,0]),d[m]=x}else if(o.canonical.isChildOf(y.canonical)){const x=o.clone();x.posMatrix=new Float64Array(16);const M=o.canonical.z-y.canonical.z,P=o.canonical.x-(o.canonical.x>>M<<M),O=o.canonical.y-(o.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,[P*N,O*N,0]),l.K(x.posMatrix,x.posMatrix,[1/2**M,1/2**M,0]),d[m]=x}}return d}getSourceTile(o,d){const m=this.sourceCache._source;let y=o.overscaledZ-this.deltaZoom;if(y>m.maxzoom&&(y=m.maxzoom),y<m.minzoom)return null;this._sourceTileCache[o.key]||(this._sourceTileCache[o.key]=o.scaledTo(y).key);let x=this.sourceCache.getTileByID(this._sourceTileCache[o.key]);if((!x||!x.dem)&&d)for(;y>=m.minzoom&&(!x||!x.dem);)x=this.sourceCache.getTileByID(o.scaledTo(y--).key);return x}tilesAfterTime(o=Date.now()){return Object.values(this._tiles).filter(d=>d.timeAdded>=o)}}class zd{constructor(o,d,m){this.painter=o,this.sourceCache=new k_(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(o,d,m,y=l.X){var x;if(!(d>=0&&d<y&&m>=0&&m<y))return 0;const M=this.getTerrainData(o),P=(x=M.tile)===null||x===void 0?void 0:x.dem;if(!P)return 0;const O=function(ee,re,le){var ce=re[0],he=re[1];return ee[0]=le[0]*ce+le[4]*he+le[12],ee[1]=le[1]*ce+le[5]*he+le[13],ee}([],[d/y*l.X,m/y*l.X],M.u_terrain_matrix),N=[O[0]*P.dim,O[1]*P.dim],V=Math.floor(N[0]),F=Math.floor(N[1]),Z=N[0]-V,J=N[1]-F;return P.get(V,F)*(1-Z)*(1-J)+P.get(V+1,F)*Z*(1-J)+P.get(V,F+1)*(1-Z)*J+P.get(V+1,F+1)*Z*J}getElevationForLngLatZoom(o,d){if(!l.bb(d,o.wrap()))return 0;const{tileID:m,mercatorX:y,mercatorY:x}=this._getOverscaledTileIDFromLngLatZoom(o,d);return this.getElevation(m,y%l.X,x%l.X,l.X)}getElevation(o,d,m,y=l.X){return this.getDEMElevation(o,d,m,y)*this.exaggeration}getTerrainData(o){if(!this._emptyDemTexture){const y=this.painter.context,x=new l.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Je(y,x,y.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Je(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(o,!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 Je(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+o.key;if(m&&!this._demMatrixCache[m]){const y=this.sourceCache.sourceCache._source.maxzoom;let x=o.canonical.z-d.tileID.canonical.z;o.overscaledZ>o.canonical.z&&(o.canonical.z>=y?x=o.canonical.z-y:l.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const M=o.canonical.x-(o.canonical.x>>x<<x),P=o.canonical.y-(o.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,P*l.X,0]),this._demMatrixCache[o.key]={matrix:O,coord:o}}return{u_depth:2,u_terrain:3,u_terrain_dim:d&&d.dem&&d.dem.dim||1,u_terrain_matrix:m?this._demMatrixCache[o.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(o){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 Je(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 Je(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(o==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const o=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 P=0;P<this._coordsTextureSize;P++,M+=4)d[M+0]=255&P,d[M+1]=255&x,d[M+2]=P>>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 Je(o,m,o.gl.RGBA,{premultiply:!1});return y.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),this._coordsTexture=y,y}pointCoordinate(o){this.painter.maybeDrawDepthAndCoords(!0);const d=new Uint8Array(4),m=this.painter.context,y=m.gl,x=Math.round(o.x*this.painter.pixelRatio/devicePixelRatio),M=Math.round(o.y*this.painter.pixelRatio/devicePixelRatio),P=Math.round(this.painter.height/devicePixelRatio);m.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),y.readPixels(x,P-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 Z=this._coordsTextureSize,J=(1<<F.tileID.canonical.z)*Z;return new l.Z((F.tileID.canonical.x*Z+O)/J+F.tileID.wrap,(F.tileID.canonical.y*Z+N)/J,this.getElevation(F.tileID,O,N,Z))}depthAtPoint(o){const d=new Uint8Array(4),m=this.painter.context,y=m.gl;return m.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),y.readPixels(o.x,this.painter.height/devicePixelRatio-o.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 o=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 Z=0;Z<=y;Z++)d.emplaceBack(Z*x,F*x,0);for(let F=0;F<M;F+=y+1)for(let Z=0;Z<y;Z++)m.emplaceBack(Z+F,y+Z+F+1,y+Z+F+2),m.emplaceBack(Z+F,y+Z+F+2,Z+F+1);const P=d.length,O=P+2*(y+1);for(const F of[0,1])for(let Z=0;Z<=y;Z++)for(const J of[0,1])d.emplaceBack(Z*x,F*l.X,J);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(P+F,P+F+3,P+F+1),m.emplaceBack(P+F,P+F+2,P+F+3);const N=d.length,V=N+2*(y+1);for(const F of[0,1])for(let Z=0;Z<=y;Z++)for(const J of[0,1])d.emplaceBack(F*l.X,Z*x,J);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(o.createVertexBuffer(d,Bd.members),o.createIndexBuffer(m),l.a0.simpleSegment(0,0,d.length,m.length)),this._mesh}getMeshFrameDelta(o){return 2*Math.PI*l.be/Math.pow(2,o)/5}getMinTileElevationForLngLatZoom(o,d){var m;const{tileID:y}=this._getOverscaledTileIDFromLngLatZoom(o,d);return(m=this.getMinMaxElevation(y).minElevation)!==null&&m!==void 0?m:0}getMinMaxElevation(o){const d=this.getTerrainData(o).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(o,d){const m=l.Z.fromLngLat(o.wrap()),y=(1<<d)*l.X,x=m.x*y,M=m.y*y,P=Math.floor(x/l.X),O=Math.floor(M/l.X);return{tileID:new l.S(d,0,d,P,O),mercatorX:x,mercatorY:M}}}class S_{constructor(o,d,m){this._context=o,this._size=d,this._tileSize=m,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const o of this._objects)o.texture.destroy(),o.fbo.destroy()}_createObject(o){const d=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),m=new Je(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:o,fbo:d,texture:m,stamp:-1,inUse:!1}}getObjectForId(o){return this._objects[o]}useObject(o){o.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(d=>o.id!==d),this._recentlyUsed.push(o.id)}stampObject(o){o.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 o=this._createObject(this._objects.length);return this._objects.push(o),o}freeObject(o){o.inUse=!1}freeAllObjects(){for(const o of this._objects)this.freeObject(o)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(o=>!o.inUse)===!1}}const Za={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Mm{constructor(o,d){this.painter=o,this.terrain=d,this.pool=new S_(o.context,30,d.sourceCache.tileSize*d.qualityFactor)}destruct(){this.pool.destruct()}getTexture(o){return this.pool.getObjectForId(o.rtt[this._stacks.length-1].id).texture}prepareForRender(o,d){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=o._order.filter(m=>!o._layers[m].isHidden(d)),this._coordsDescendingInv={};for(const m in o.sourceCaches){this._coordsDescendingInv[m]={};const y=o.sourceCaches[m].getVisibleCoordinates();for(const x of y){const M=this.terrain.sourceCache.getTerrainCoords(x);for(const P in M)this._coordsDescendingInv[m][P]||(this._coordsDescendingInv[m][P]=[]),this._coordsDescendingInv[m][P].push(M[P])}}this._coordsDescendingInvStr={};for(const m of o._order){const y=o._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(P=>P.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(o){if(o.isHidden(this.painter.transform.zoom))return!1;const d=o.type,m=this.painter,y=this._renderableLayerIds[this._renderableLayerIds.length-1]===o.id;if(Za[d]&&(this._prevType&&Za[this._prevType]||this._stacks.push([]),this._prevType=d,this._stacks[this._stacks.length-1].push(o.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 P of this._renderableTiles){if(this.pool.isFull()&&(xm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(P),P.rtt[x]){const N=this.pool.getObjectForId(P.rtt[x].id);if(N.stamp===P.rtt[x].stamp){this.pool.useObject(N);continue}}const O=this.pool.getOrCreateFreeObject();this.pool.useObject(O),this.pool.stampObject(O),P.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][P.tileID.key]:[P.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&&(P.rttCoords[V.source]=this._coordsDescendingInvStr[V.source][P.tileID.key])}}return xm(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"},Am=g,E_={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},C_={showCompass:!0,showZoom:!0,visualizePitch:!1};class T_{constructor(o,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=o.dragRotate._mouseRotate.getClickTolerance(),x=o.dragRotate._mousePitch.getClickTolerance();this.element=d,this.mouseRotate=Sd({clickTolerance:y,enable:!0}),this.touchRotate=(({enable:M,clickTolerance:P,bearingDegreesPerPixelMoved:O=.8})=>{const N=new kd;return new qo({clickTolerance:P,move:(V,F)=>({bearingDelta:(F.x-V.x)*O}),moveStateManager:N,enable:M,assignEvents:Rd})})({clickTolerance:y,enable:!0}),this.map=o,m&&(this.mousePitch=Ed({clickTolerance:x,enable:!0}),this.touchPitch=(({enable:M,clickTolerance:P,pitchDegreesPerPixelMoved:O=-.5})=>{const N=new kd;return new qo({clickTolerance:P,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(o,d){this.mouseRotate.dragStart(o,d),this.mousePitch&&this.mousePitch.dragStart(o,d),C.disableDrag()}startTouch(o,d){this.touchRotate.dragStart(o,d),this.touchPitch&&this.touchPitch.dragStart(o,d),C.disableDrag()}moveMouse(o,d){const m=this.map,{bearingDelta:y}=this.mouseRotate.dragMove(o,d)||{};if(y&&m.setBearing(m.getBearing()+y),this.mousePitch){const{pitchDelta:x}=this.mousePitch.dragMove(o,d)||{};x&&m.setPitch(m.getPitch()+x)}}moveTouch(o,d){const m=this.map,{bearingDelta:y}=this.touchRotate.dragMove(o,d)||{};if(y&&m.setBearing(m.getBearing()+y),this.touchPitch){const{pitchDelta:x}=this.touchPitch.dragMove(o,d)||{};x&&m.setPitch(m.getPitch()+x)}}off(){const o=this.element;C.removeEventListener(o,"mousedown",this.mousedown),C.removeEventListener(o,"touchstart",this.touchstart,{passive:!1}),C.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.removeEventListener(window,"touchend",this.touchend),C.removeEventListener(o,"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,o,d){const m=new l.N(v.lng,v.lat);if(v=new l.N(v.lng,v.lat),o){const y=new l.N(v.lng-360,v.lat),x=new l.N(v.lng+360,v.lat),M=d.locationPoint(v).distSqr(o);d.locationPoint(y).distSqr(o)<M?v=y:d.locationPoint(x).distSqr(o)<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,o,d){const m=v.classList;for(const y in Ya)m.remove(`maplibregl-${d}-anchor-${y}`);m.add(`maplibregl-${d}-anchor-${o}`)}class Au extends l.E{constructor(o){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=o&&o.anchor||"center",this._color=o&&o.color||"#3FB1CE",this._scale=o&&o.scale||1,this._draggable=o&&o.draggable||!1,this._clickTolerance=o&&o.clickTolerance||0,this._subpixelPositioning=o&&o.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=o&&o.rotation||0,this._rotationAlignment=o&&o.rotationAlignment||"auto",this._pitchAlignment=o&&o.pitchAlignment&&o.pitchAlignment!=="auto"?o.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(o==null?void 0:o.opacity,o==null?void 0:o.opacityWhenCovered),o&&o.element)this._element=o.element,this._offset=l.P.convert(o&&o.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 P=C.createNS("http://www.w3.org/2000/svg","g");P.setAttributeNS(null,"transform","translate(3.0, 29.0)"),P.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),P.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 Z=C.createNS("http://www.w3.org/2000/svg","path");Z.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(Z);const J=C.createNS("http://www.w3.org/2000/svg","g");J.setAttributeNS(null,"transform","translate(6.0, 7.0)"),J.setAttributeNS(null,"fill","#FFFFFF");const ee=C.createNS("http://www.w3.org/2000/svg","g");ee.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 le=C.createNS("http://www.w3.org/2000/svg","circle");le.setAttributeNS(null,"fill","#FFFFFF"),le.setAttributeNS(null,"cx","5.5"),le.setAttributeNS(null,"cy","5.5"),le.setAttributeNS(null,"r","5.4999962"),ee.appendChild(re),ee.appendChild(le),M.appendChild(P),M.appendChild(N),M.appendChild(F),M.appendChild(J),M.appendChild(ee),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(o&&o.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"),o&&o.className)for(const d of o.className.split(" "))this._element.classList.add(d);this._popup=null}addTo(o){return this.remove(),this._map=o,this._element.setAttribute("aria-label",o._getUIString("Marker.Title")),o.getCanvasContainer().appendChild(this._element),o.on("move",this._update),o.on("moveend",this._update),o.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(o){return this._lngLat=l.N.convert(o),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(o){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),o){if(!("offset"in o.options)){const y=Math.abs(13.5)/Math.SQRT2;o.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=o,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(o){return this._subpixelPositioning=o,this}getPopup(){return this._popup}togglePopup(){const o=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:o?(o.isOpen()?o.remove():(o.setLngLat(this._lngLat),o.addTo(this._map)),this):this}_updateOpacity(o=!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(o)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 P=-this._offset.y/y.transform._pixelPerMeter,O=Math.sin(y.getPitch()*Math.PI/180)*P,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(o){return this._offset=l.P.convert(o),this._update(),this}addClassName(o){this._element.classList.add(o)}removeClassName(o){this._element.classList.remove(o)}toggleClassName(o){return this._element.classList.toggle(o)}setDraggable(o){return this._draggable=!!o,this._map&&(o?(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(o){return this._rotation=o||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(o){return this._rotationAlignment=o||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(o){return this._pitchAlignment=o&&o!=="auto"?o:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(o,d){return o===void 0&&d===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),o!==void 0&&(this._opacity=o),d!==void 0&&(this._opacityWhenCovered=d),this._map&&this._updateOpacity(!0),this}}const Im={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ql=0,ec=!1;const Io={maxWidth:100,unit:"metric"};function tc(v,o,d){const m=d&&d.maxWidth||100,y=v._container.clientHeight/2,x=v.unproject([0,y]),M=v.unproject([m,y]),P=x.distanceTo(M);if(d&&d.unit==="imperial"){const O=3.2808*P;O>5280?ft(o,m,O/5280,v._getUIString("ScaleControl.Miles")):ft(o,m,O,v._getUIString("ScaleControl.Feet"))}else d&&d.unit==="nautical"?ft(o,m,P/1852,v._getUIString("ScaleControl.NauticalMiles")):P>=1e3?ft(o,m,P/1e3,v._getUIString("ScaleControl.Kilometers")):ft(o,m,P,v._getUIString("ScaleControl.Meters"))}function ft(v,o,d,m){const y=function(x){const M=Math.pow(10,`${Math.floor(x)}`.length-1);let P=x/M;return P=P>=10?10:P>=5?5:P>=3?3:P>=2?2:P>=1?1:function(O){const N=Math.pow(10,Math.ceil(-Math.log(O)/Math.LN10));return Math.round(O*N)/N}(P),M*P}(d);v.style.width=o*(y/d)+"px",v.innerHTML=`${y}&nbsp;${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 o=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(o,o),"top-right":new l.P(-o,o),bottom:new l.P(0,-v),"bottom-left":new l.P(o,-o),"bottom-right":new l.P(-o,-o),left:new l.P(v,0),right:new l.P(-v,0)}}if(v instanceof l.P||Array.isArray(v)){const o=l.P.convert(v);return{center:o,top:o,"top-left":o,"top-right":o,bottom:o,"bottom-left":o,"bottom-right":o,left:o,right:o}}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=vi,u.CooperativeGesturesHandler=qa,u.DoubleClickZoomHandler=Ks,u.DragPanHandler=Em,u.DragRotateHandler=Cm,u.EdgeInsets=$a,u.FullscreenControl=class extends l.E{constructor(v={}){super(),this._onFullscreenChange=()=>{var o;let d=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((o=d==null?void 0:d.shadowRoot)===null||o===void 0)&&o.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=o=>{if(this._map){if(this._isOutOfMapMaxBounds(o))return this._setErrorState(),this.fire(new l.k("outofmaxbounds",o)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=o,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(o),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(o),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new l.k("geolocate",o)),this._finish()}},this._updateCamera=o=>{const d=new l.N(o.coords.longitude,o.coords.latitude),m=o.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=o=>{if(o){const d=new l.N(o.coords.longitude,o.coords.latitude);this._accuracyCircleMarker.setLngLat(d).addTo(this._map),this._userLocationDotMarker.setLngLat(d).addTo(this._map),this._accuracy=o.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=o=>{if(this._map){if(this.options.trackUserLocation)if(o.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(o.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",o)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",o=>o.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=o=>{if(this._map){if(o===!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({},Im,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*(o=!1){if(br!==void 0&&!o)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(o=>this._finishSetupUI(o)),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 o=this._map.getMaxBounds(),d=v.coords;return o&&(d.longitude<o.getWest()||d.longitude>o.getEast()||d.latitude<o.getSouth()||d.latitude>o.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(),o=v.getSouthEast(),d=v.getNorthEast(),m=o.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=xi,u.KeyboardHandler=Lr,u.LngLatBounds=we,u.LogoControl=Od,u.Map=class extends Tm{constructor(v){l.bf.mark(l.bg.create);const o=Object.assign(Object.assign({},E_),v);if(o.minZoom!=null&&o.maxZoom!=null&&o.minZoom>o.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(o.minPitch!=null&&o.maxPitch!=null&&o.minPitch>o.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(o.minPitch!=null&&o.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(o.maxPitch!=null&&o.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ja(o.minZoom,o.maxZoom,o.minPitch,o.maxPitch,o.renderWorldCopies),{bearingSnap:o.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Qt,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=o.interactive,this._maxTileCacheSize=o.maxTileCacheSize,this._maxTileCacheZoomLevels=o.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=o.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=o.preserveDrawingBuffer===!0,this._antialias=o.antialias===!0,this._trackResize=o.trackResize===!0,this._bearingSnap=o.bearingSnap,this._refreshExpiredTiles=o.refreshExpiredTiles===!0,this._fadeDuration=o.fadeDuration,this._crossSourceCollisions=o.crossSourceCollisions===!0,this._collectResourceTiming=o.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Nd),o.locale),this._clickTolerance=o.clickTolerance,this._overridePixelRatio=o.pixelRatio,this._maxCanvasSize=o.maxCanvasSize,this.transformCameraUpdate=o.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=o.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=se.addThrottleControl(()=>this.isMoving()),this._requestManager=new Q(o.transformRequest),typeof o.container=="string"){if(this._container=document.getElementById(o.container),!this._container)throw new Error(`Container '${o.container}' not found.`)}else{if(!(o.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=o.container}if(o.maxBounds&&this.setMaxBounds(o.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,o),this._hash=o.hash&&new bu(typeof o.hash=="string"&&o.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch}),o.bounds&&(this.resize(),this.fitBounds(o.bounds,l.e({},o.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=o.localIdeographFontFamily,this._validateStyle=o.validateStyle,o.style&&this.setStyle(o.style,{localIdeographFontFamily:o.localIdeographFontFamily}),o.attributionControl&&this.addControl(new Ga(typeof o.attributionControl=="boolean"?void 0:o.attributionControl)),o.maplibreLogo&&this.addControl(new Od,o.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,o){if(o===void 0&&(o=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[o];return o.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 o=this._controls.indexOf(v);return o>-1&&this._controls.splice(o,1),v.onRemove(this),this}hasControl(v){return this._controls.indexOf(v)>-1}calculateCameraOptionsFromTo(v,o,d,m){return m==null&&this.terrain&&(m=this.terrain.getElevationForLngLatZoom(d,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(v,o,d,m)}resize(v){var o;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 P=this.painter.context.gl;this._maxCanvasSize=[P.drawingBufferWidth,P.drawingBufferHeight];const O=this._getClampedPixelRatio(m,y);this._resizeCanvas(m,y,O),this.painter.resize(m,y,O)}this.transform.resize(m,y),(o=this._requestedCameraState)===null||o===void 0||o.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,o){const{0:d,1:m}=this._maxCanvasSize,y=this.getPixelRatio(),x=v*y,M=o*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,o,d){if(v==="mouseenter"||v==="mouseover"){let m=!1;return{layers:o,listener:d,delegates:{mousemove:x=>{const M=o.filter(O=>this.getLayer(O)),P=M.length!==0?this.queryRenderedFeatures(x.point,{layers:M}):[];P.length?m||(m=!0,d.call(this,new Di(v,this,x.originalEvent,{features:P}))):m=!1},mouseout:()=>{m=!1}}}}if(v==="mouseleave"||v==="mouseout"){let m=!1;return{layers:o,listener:d,delegates:{mousemove:M=>{const P=o.filter(O=>this.getLayer(O));(P.length!==0?this.queryRenderedFeatures(M.point,{layers:P}):[]).length?m=!0:m&&(m=!1,d.call(this,new Di(v,this,M.originalEvent)))},mouseout:M=>{m&&(m=!1,d.call(this,new Di(v,this,M.originalEvent)))}}}}{const m=y=>{const x=o.filter(P=>this.getLayer(P)),M=x.length!==0?this.queryRenderedFeatures(y.point,{layers:x}):[];M.length&&(y.features=M,d.call(this,y),delete y.features)};return{layers:o,listener:d,delegates:{[v]:m}}}}_saveDelegatedListener(v,o){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[v]=this._delegatedListeners[v]||[],this._delegatedListeners[v].push(o)}_removeDelegatedListener(v,o,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===o.length&&x.layers.every(M=>o.includes(M))){for(const M in x.delegates)this.off(M,x.delegates[M]);return void m.splice(y,1)}}}on(v,o,d){if(d===void 0)return super.on(v,o);const m=this._createDelegatedListener(v,typeof o=="string"?[o]:o,d);this._saveDelegatedListener(v,m);for(const y in m.delegates)this.on(y,m.delegates[y]);return this}once(v,o,d){if(d===void 0)return super.once(v,o);const m=typeof o=="string"?[o]:o,y=this._createDelegatedListener(v,m,d);for(const x in y.delegates){const M=y.delegates[x];y.delegates[x]=(...P)=>{this._removeDelegatedListener(v,m,d),M(...P)}}this._saveDelegatedListener(v,y);for(const x in y.delegates)this.once(x,y.delegates[x]);return this}off(v,o,d){return d===void 0?super.off(v,o):(this._removeDelegatedListener(v,typeof o=="string"?[o]:o,d),this)}queryRenderedFeatures(v,o){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(o=o||(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,o,this.transform)}querySourceFeatures(v,o){return this.style.querySourceFeatures(v,o)}setStyle(v,o){return(o=l.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},o)).diff!==!1&&o.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&v?(this._diffStyle(v,o),this):(this._localIdeographFontFamily=o.localIdeographFontFamily,this._updateStyle(v,o))}setTransformRequest(v){return this._requestManager.setTransformRequest(v),this}_getUIString(v){const o=this._locale[v];if(o==null)throw new Error(`Missing UI string '${v}'`);return o}_updateStyle(v,o){if(o.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(v,o));const d=this.style&&o.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!v)),v?(this.style=new nu(this,o||{}),this.style.setEventedParent(this,{style:this.style}),typeof v=="string"?this.style.loadURL(v,o,d):this.style.loadJSON(v,o,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,o){if(typeof v=="string"){const d=this._requestManager.transformRequest(v,"Style");l.h(d,new AbortController).then(m=>{this._updateDiff(m.data,o)}).catch(m=>{m&&this.fire(new l.j(m))})}else typeof v=="object"&&this._updateDiff(v,o)}_updateDiff(v,o){try{this.style.setState(v,o)&&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,o)}}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,o){return this._lazyInitEmptyStyle(),this.style.addSource(v,o),this._update(!0)}isSourceLoaded(v){const o=this.style&&this.style.sourceCaches[v];if(o!==void 0)return o.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 o=this.style.sourceCaches[v.source];if(!o)throw new Error(`cannot load terrain, because there exists no source with ID: ${v.source}`);this.terrain===null&&o.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 zd(this.painter,o,v),this.painter.renderToTexture=new Mm(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,o;return(o=(v=this.terrain)===null||v===void 0?void 0:v.options)!==null&&o!==void 0?o:null}areTilesLoaded(){const v=this.style&&this.style.sourceCaches;for(const o in v){const d=v[o]._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,o,d={}){const{pixelRatio:m=1,sdf:y=!1,stretchX:x,stretchY:M,content:P,textFitWidth:O,textFitHeight:N}=d;if(this._lazyInitEmptyStyle(),!(o instanceof HTMLImageElement||l.b(o))){if(o.width===void 0||o.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:Z}=o,J=o;return this.style.addImage(v,{data:new l.R({width:V,height:F},new Uint8Array(Z)),pixelRatio:m,stretchX:x,stretchY:M,content:P,textFitWidth:O,textFitHeight:N,sdf:y,version:0,userImage:J}),J.onAdd&&J.onAdd(this,v),this}}{const{width:V,height:F,data:Z}=E.getImageData(o);this.style.addImage(v,{data:new l.R({width:V,height:F},Z),pixelRatio:m,stretchX:x,stretchY:M,content:P,textFitWidth:O,textFitHeight:N,sdf:y,version:0})}}updateImage(v,o){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=o instanceof HTMLImageElement||l.b(o)?E.getImageData(o):o,{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 P=!(o instanceof HTMLImageElement||l.b(o));return d.data.replace(M,P),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 se.getImage(this._requestManager.transformRequest(v,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(v,o){return this._lazyInitEmptyStyle(),this.style.addLayer(v,o),this._update(!0)}moveLayer(v,o){return this.style.moveLayer(v,o),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,o,d){return this.style.setLayerZoomRange(v,o,d),this._update(!0)}setFilter(v,o,d={}){return this.style.setFilter(v,o,d),this._update(!0)}getFilter(v){return this.style.getFilter(v)}setPaintProperty(v,o,d,m={}){return this.style.setPaintProperty(v,o,d,m),this._update(!0)}getPaintProperty(v,o){return this.style.getPaintProperty(v,o)}setLayoutProperty(v,o,d,m={}){return this.style.setLayoutProperty(v,o,d,m),this._update(!0)}getLayoutProperty(v,o){return this.style.getLayoutProperty(v,o)}setGlyphs(v,o={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(v,o),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(v,o,d={}){return this._lazyInitEmptyStyle(),this.style.addSprite(v,o,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,o={}){return this._lazyInitEmptyStyle(),this.style.setSprite(v,o,d=>{d||this._update(!0)}),this}setLight(v,o={}){return this._lazyInitEmptyStyle(),this.style.setLight(v,o),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,o){return this.style.setFeatureState(v,o),this._update()}removeFeatureState(v,o){return this.style.removeFeatureState(v,o),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,o=0;return this._container&&(v=this._container.clientWidth||400,o=this._container.clientHeight||300),[v,o]}_setupContainer(){const v=this._container;v.classList.add("maplibregl-map");const o=this._canvasContainer=C.create("div","maplibregl-canvas-container",v);this._interactive&&o.classList.add("maplibregl-interactive"),this._canvas=C.create("canvas","maplibregl-canvas",o),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,o,d){this._canvas.width=Math.floor(d*v),this._canvas.height=Math.floor(d*o),this._canvas.style.width=`${v}px`,this._canvas.style.height=`${o}px`}_setupPainter(){const v={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let o=null;this._canvas.addEventListener("webglcontextcreationerror",m=>{o={requestedAttributes:v},m&&(o.statusMessage=m.statusMessage,o.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 o?(o.message=m,new Error(JSON.stringify(o))):new Error(m)}this.painter=new _u(d,this.transform),I.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 o=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:o,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),P=M.crossFadingFactor();P===1&&P===this._crossFadingFactor||(d=!0,this._crossFadingFactor=P),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,o,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:o,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),se.removeThrottleControl(this._imageQueueHandle),(v=this._resizeObserver)===null||v===void 0||v.disconnect();const o=this.painter.context.gl.getExtension("WEBGL_lose_context");o!=null&&o.loseContext&&o.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 Am}getCameraTargetElevation(){return this.transform.elevation}},u.MapMouseEvent=Di,u.MapTouchEvent=Ys,u.MapWheelEvent=wm,u.Marker=Au,u.NavigationControl=class{constructor(v){this._updateZoomButtons=()=>{const o=this._map.getZoom(),d=o===this._map.getMaxZoom(),m=o===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 o=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=o},this._setButtonTitle=(o,d)=>{const m=this._map._getUIString(`NavigationControl.${d}`);o.title=m,o.setAttribute("aria-label",m)},this.options=l.e({},C_,v),this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",o=>o.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",o=>this._map.zoomIn({},{originalEvent:o})),C.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",o=>this._map.zoomOut({},{originalEvent:o})),C.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",o=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:o}):this._map.resetNorth({},{originalEvent:o})}),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 T_(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,o){const d=C.create("button",v,this._container);return d.type="button",d.addEventListener("click",o),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=o=>{this._update(o.point)},this._onMouseMove=o=>{this._update(o.point)},this._onDrag=o=>{this._update(o.point)},this._update=o=>{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 P of this.options.className.split(" "))this._container.classList.add(P);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&&!o)return;const m=this._flatPos=this._pos=this._trackPointer&&o?o:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&o?o:this._map.transform.locationPoint(this._lngLat));let y=this.options.anchor;const x=Pu(this.options.offset);if(!y){const P=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<P/2?N.push("left"):m.x>this._map.transform.width-P/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 o=document.createDocumentFragment(),d=document.createElement("body");let m;for(d.innerHTML=v;m=d.firstChild,m;)o.appendChild(m);return this.setDOMContent(o)}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="&#215;",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=sn,u.RasterTileSource=jt,u.ScaleControl=class{constructor(v){this._onMove=()=>{tc(this._map,this._container,this.options)},this.setUnit=o=>{this.options.unit=o,tc(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Io),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=to,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,o)=>l._(void 0,void 0,void 0,function*(){if(Co(v))throw new Error(`A source type called "${v}" already exists.`);((d,m)=>{Eo[d]=m})(v,o)}),u.clearPrewarmedResources=function(){const v=Te;v&&(v.isPreloaded()&&v.numActive()===1?(v.release(Nn),Te=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 zr().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 Nt().broadcast("IS",v)},u.prewarm=function(){De().acquire(Nn)},u.setMaxParallelImageRequests=function(v){l.a.MAX_PARALLEL_IMAGE_REQUESTS=v},u.setRTLTextPlugin=function(v,o){return zr().setRTLTextPlugin(v,o)},u.setWorkerCount=function(v){Pn.workerCount=v},u.setWorkerUrl=function(v){l.a.WORKER_URL=v}});var a=n;return a})})(W1);var TB=W1.exports;const MB=EB(TB),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 AB(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,I,D,R,$,G,q,se,Q,Se,_e;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)||((I=t.style)==null?void 0:I.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=(Ce,Le)=>`${Ce==null?void 0:Ce.split("+")[0]}+${Le.replace("#","")}.png`;if(t.legendAuto={icon:[],color:[]},($=t.style)!=null&&$.iconAttr&&r){const Ce=(q=(G=t.meta)==null?void 0:G.columns)==null?void 0:q.find(Ie=>{var Ue;return Ie.name===((Ue=t==null?void 0:t.style)==null?void 0:Ue.iconAttr)}),Le=(Ce==null?void 0:Ce.values)||await rt.get(`/api-user/gis-ir/${t.id}/${(se=t.style)==null?void 0:se.iconAttr}`).then(Ie=>Ie.data.rows);if(Le!=null&&Le.length){const Ie=r.replace("{{color}}",l.length?l:AB(l)||[0]).split("+")[1].split(/[.-]/)[0];Le.forEach((Ue,Je)=>{var It;return Ue.icon=(It=Ue.icon)!=null&&It.includes("png")?Ue.icon:`${a}-${u}-${Ue.data||Ue.icon||`ub-${Je}`}+${r!=null&&r.includes("circle")?"ddd-222":Ie}.png`}),r=r!=null&&r.includes("{{")?`${a}-${u}-fa-question+0c53ad.png`:r,t.legendAuto.iconText=(Ce==null?void 0:Ce.title)||t.style.iconAttr,Le.forEach(Ue=>t.legendAuto.icon.push(Ue)),t.legendAuto.icon.push({icon:r,text:"Не визначено"}),t.style.iconArr=["match",["get",t.style.iconAttr]].concat(Le.filter(Ue=>Ue.id).reduce((Ue,Je)=>Ue.concat([Je.id,Je.icon]),[])).concat([r]),await Promise.all(Le.map(Ue=>Ue.icon).map(Ue=>$p(Ue,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 Ce=(Se=(Q=t.meta)==null?void 0:Q.columns)==null?void 0:Se.find(Ie=>Ie.name===i),Le=(Ce==null?void 0:Ce.values)||await rt.get(`/api-user/gis-ir/${t.id}/${i}`).then(Ie=>Ie.data.rows);t.style.color=Le!=null&&Le.length?["match",["get",i]].concat(Le.filter(Ie=>Ie.id).reduce((Ie,Ue,Je)=>Ie.concat([Ue.id,Ue.color||Fp[Je]]),[])).concat(["#aaa"]):l,t.style.colorArr=t.style.color,t.legendAuto.colorText=(Ce==null?void 0:Ce.title)||i,Le.forEach(Ie=>t.legendAuto.color.push(Ie)),t.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),!((_e=t.style)!=null&&_e.iconAttr)&&!(r!=null&&r.includes("+sdf"))&&r&&(Le.forEach((Ie,Ue)=>Ie.icon=b(r,Ie.color||Fp[Ue])),t.style.iconArr=["match",["get",i]].concat(Le.filter(Ie=>Ie.id).reduce((Ie,Ue)=>Ie.concat([Ue.id,Ue.icon]),[])).concat([b(r,g)]),await Promise.all(Le.map(Ie=>Ie.icon).map(Ie=>$p(Ie,n))))}if(r&&!(r!=null&&r.includes("{"))){const Ce=e!=null&&e.colorAttr?b(r,g):r;await $p(Ce,n)}const k=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}:{},...k?{"icon-size":k||!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(k=>k.name===i))==null?void 0:l.values)||await rt.get(`/api-user/gis-ir/${t.id}/${i}`).then(k=>k.data.rows);t.legendAuto={color:[]},b.forEach(k=>t.legendAuto.color.push(k)),t.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),t.style.color=b?["match",["get",i]].concat(b.filter(k=>k.id).reduce((k,E,C)=>k.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 IB(t,e,n){var l,g,b,k,E,C,I,D,R,$,G,q;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,se=>se.source).forEach(se=>{se.lsource=`${e.id}-${se.source}`});const i=((k=e==null?void 0:e.style)==null?void 0:k.type)||((G=((I=(C=(E=e==null?void 0:e.meta)==null?void 0:E.geom)==null?void 0:C.geometry)==null?void 0:I.length)>2?["point"]:[(($=(R=(D=e==null?void 0:e.meta)==null?void 0:D.geom)==null?void 0:R.geometry)==null?void 0:$[0].toLowerCase())||"point"])==null?void 0:G.map(se=>{var Q;return(Q=se==null?void 0:se.replace)==null?void 0:Q.call(se,"multi","")})),r=Array.isArray(i)?i:[i],a=(await Promise.all(Array.isArray(e==null?void 0:e.style)?e.style.map(async se=>{var Q;return(Q=Cr[se.type])==null?void 0:Q.call(Cr,e,se,n)}):r.map(async se=>{var Q;return(Q=Cr[se])==null?void 0:Q.call(Cr,e,e.style,n)}))).reduce((se,Q)=>Q?se.concat(Q):se,[]);a.forEach((se,Q)=>{se.id=`${se.id}-${Q}`});const u=a;return(e.service==="vtile"||(q=e.url)!=null&&q.includes(".vmt"))&&u.forEach(se=>{se.layout||(se.layout={}),se.layout.visibility="visible",se["source-layer"]=se.lsource||e.data||t}),u}const PB={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 rt.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 rt.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,k,E;const{map:i}=this,r=await IB(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 I={...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(I),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(I)});const u=r.map(C=>C.type).filter(C=>C&&C!=="symbol");(E=(k=t==null?void 0:t.meta)==null?void 0:k.geom)!=null&&E.geometry&&t.meta.geom.geometry.filter(I=>!u.includes(this.geometryByType(I,!0))).forEach(I=>{this.createStyleObj({type:I,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 rt.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 rt.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)}}},DB={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}}},OB={key:0,class:"vsTailwind map-popup__vertical"},BB={class:"mb-1"},zB={class:"text-sm"},NB={key:1,class:"map__popup-body"},RB=["innerHTML"],LB={key:1};function VB(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",OB,[(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",BB,f.toDisplayString(a.rowTitle(u)),1),f.createElementVNode("div",zB,f.toDisplayString(a.rowValue(u)),1)]))),128))])):(f.openBlock(),f.createElementBlock("table",NB,[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,RB)):(f.openBlock(),f.createElementBlock("td",LB,e[0]||(e[0]=[f.createElementVNode("div",{class:"text-red-500"}," Не визначено ",-1)])))])),[[f.vShow,!a.rowValue(u).includes("id")]])),128))])]))],4)}const FB=$e(DB,[["render",VB],["__scopeId","data-v-14698eb6"]]),G1={width:200,show:!0,position:"horizontal"},$B={components:{VsPopupBody:FB},props:{aviableFields:{type:Array,default:()=>[]},mapRef:{type:[Object,Array],default:()=>{}},object:{type:[Object,Array],default:()=>{}}},data(){return{objectData:[],popupSettings:G1}},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,k,E,C,I;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)||G1),!(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 se,Q,Se,_e;const R={},G=Object.assign({values:[]},i.find(Ce=>Ce.name===D));typeof G.values!="object"&&console.warn(`Warning: Layer ${t.source} has key "values" which is not an object in meta!`);const q=G!=null&&G.values&&((se=G==null?void 0:G.values)==null?void 0:se.find(Ce=>(Ce==null?void 0:Ce.id)==t.properties[D]))||null;return R.value=(G==null?void 0:G.format)==="select"?this.formatBadge({text:(q==null?void 0:q.text)||((Q=t.properties)==null?void 0:Q[`${D}__text`])||((Se=t.properties)==null?void 0:Se[D])||"-",color:(q==null?void 0:q.color)||"#1989FA"}):(q==null?void 0:q.text)||((_e=t.properties)==null?void 0:_e[`${D}__text`])||t.properties[D],R.column=D,R.title=(G==null?void 0:G[window==null?void 0:window.lang])||(G==null?void 0:G.ua)||(G==null?void 0:G.title)||D,R});this.objectData=[...r,{value:((k=t.properties)==null?void 0:k.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,...((I=n==null?void 0:n.popup)==null?void 0:I.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}}},jB={key:0},UB={key:0},HB=["src","alt"],qB={key:1},WB={class:"text-left text-sm m-b-sm"},GB={key:1,class:"text-center"};function ZB(t,e,n,i,r,a){var l,g,b,k,E,C,I,D,R,$,G;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(q=>q.column!=="image").length?(f.openBlock(),f.createElementBlock("div",jB,[a.getImage&&((g=a.getImage)!=null&&g.value)?(f.openBlock(),f.createElementBlock("div",UB,[f.createElementVNode("img",{class:"popup-image",src:"files/"+a.getImage.value,alt:a.getImage.column},null,8,HB)])):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",qB,[(b=a.noInfoObject())!=null&&b.column?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[f.createElementVNode("b",WB,f.toDisplayString(a.noInfoObject().title),1),f.createElementVNode("div",null,[f.createElementVNode("b",null,f.toDisplayString(((E=(k=a.noInfoObject())==null?void 0:k.column)==null?void 0:E.ua)||((I=(C=a.noInfoObject())==null?void 0:C.column)==null?void 0:I.title))+":",1),f.createTextVNode(" "+f.toDisplayString(((G=(D=n.object)==null?void 0:D.properties)==null?void 0:G[($=(R=a.noInfoObject())==null?void 0:R.column)==null?void 0:$.name])||"-"),1)])],64)):(f.openBlock(),f.createElementBlock("div",GB,f.toDisplayString(a.noInfoObject().title),1))]))],2)}const YB=$e($B,[["render",ZB],["__scopeId","data-v-180f4367"]]),{Map:XB,NavigationControl:KB,Popup:JB}=MB,QB={mixins:[PB],components:{VsMapPopup:YB},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 XB({container:this.mapId,style:t,center:[0,0],zoom:1,interactive:!0});e.addControl(new KB({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:"&copy; <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, &copy; <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 JB({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 k,E;const b=t.queryRenderedFeatures(g.point).filter(C=>{var R,$,G;const I=this.layerList.find(q=>q.id===C.source),D=(($=(R=I==null?void 0:I.setting)==null?void 0:R.popup)==null?void 0:$.show)===void 0?!0:I.setting.popup.show;if((this.interactiveSources.includes(C.source)&&!((G=C.properties)!=null&&G.cluster)&&D||!I&&Object.keys(C.properties).length)&&!e.includes(C.source))return C}).filter(C=>{var I,D;return!((D=(I=C.layer)==null?void 0:I.layout)!=null&&D["text-field"])});b.length&&this.popupVisible?(this.features=(b==null?void 0:b[0])||null,(k=this.popup.map)==null||k.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})}}},ez={class:"relative"},tz=["id"];function nz(t,e,n,i,r,a){const u=f.resolveComponent("VsMapPopup");return f.openBlock(),f.createElementBlock("div",ez,[f.createElementVNode("div",{id:r.mapId,style:f.normalizeStyle({height:n.height})},null,12,tz),f.createVNode(u,{ref:"popup",object:r.features,"map-ref":a.mapRef},null,8,["object","map-ref"])])}const iz=$e(QB,[["render",nz]]),Qo="widget-map-source",rz={components:{VsMap:iz},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(Qo);if(this.zoomToGeometry(e),n){n.setData(e);return}t.addSource(Qo,{type:"geojson",data:e}),t.addLayer({id:`${Qo}-point`,type:"circle",source:Qo,paint:{"circle-radius":10,"circle-color":"#F84C4C"},filter:["==","$type","Point"]}),t.addLayer({id:`${Qo}-polygon`,type:"fill",source:Qo,layout:{},paint:{"fill-color":"#0080ff","fill-opacity":.5},filter:["==","$type","Polygon"]}),t.addLayer({id:`${Qo}-polygon-line`,type:"line",source:Qo,layout:{},paint:{"line-color":"#0080ff","line-width":2},filter:["==","$type","Polygon"]}),t.addLayer({id:`${Qo}-line`,type:"line",source:Qo,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 q1(t);if(!n)throw new Error("Unknown geometry type!");return n==="FeatureCollection"?t:(n==="Feature"&&(e=[t]),!["FeatureCollection","Feature"].includes(n)&&(e=[CB(t)]),q1(e))},zoomToGeometry(t){const{map:e}=this,n=kB(t);e.fitBounds(n,{zoom:this.zoom,padding:30,duration:0})}}};function oz(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 Z1=$e(rz,[["render",oz]]),lt=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),ly=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)&&(ly(t)?t:jp(t.parentElement,e))},es=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},cy=t=>`${t||""}`.split(" ").filter(e=>!!e),ts=(t,e,n)=>{t&&cy(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 sz{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 Y1(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function X1(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const uy=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}),uy(u)?Object.assign(t[a],Tr(l,u)):Array.isArray(u)?Object.assign(t,{[a]:[...u]}):Object.assign(t,{[a]:u})})}return t},hy=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=hy(e,this.options);return i&&typeof i=="function"&&(i=i.call(this,this,...n)),i}optionFor(e,n,i,...r){let a=hy(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=hy(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 dy 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 Ps=["a","b","c","d","e","f"],K1={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"},az={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:K1},J1='<circle cx="25" cy="25" r="20"></circle>',py='<div class="f-spinner"><svg viewBox="0 0 50 50">'+J1+J1+"</svg></div>",Mr=t=>t&&t!==null&&t instanceof Element&&"nodeType"in t,En=(t,e)=>{t&&cy(e).forEach(n=>{t.classList.remove(n)})},Ct=(t,e)=>{t&&cy(e).forEach(n=>{t.classList.add(n)})},Hp={a:1,b:0,c:0,d:1,e:0,f:0},lz=1e5,qp=1e4,po="mousemove",Q1="drag",ev="content",fo="auto";let fy=null,my=null;class ua extends dy{get fits(){return this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1}get isTouchDevice(){return my===null&&(my=window.matchMedia("(hover: none)").matches),my}get isMobile(){return fy===null&&(fy=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),fy}get panMode(){return this.options.panMode!==po||this.isTouchDevice?Q1:po}get panOnlyZoomed(){const e=this.options.panOnlyZoomed;return e===fo?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 Ps){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=es(py);!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(ev);let i=this.option(ev)||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((k,E)=>k-E),b=g.findIndex(k=>k>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 sz(e,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener(po,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(po,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 Ps)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 Ps)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,k=l.max,E=g.min,C=g.max;let I=0,D=0;return b!==1/0&&r<b?I=b-r:k!==1/0&&r>k&&(I=k-r),E!==1/0&&a<E?D=E-a:C!==1/0&&a>C&&(D=C-a),Math.abs(I)<1e-4&&(I=0),Math.abs(D)<1e-4&&(D=0),Object.assign(Object.assign({},u),{xDiff:I,yDiff:D,inBounds:!I&&!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 k=!(n instanceof HTMLImageElement)&&(window.getComputedStyle(n).maxWidth==="none"||window.getComputedStyle(n).maxHeight==="none"),E=k?u:r,C=k?l:a,I=this.getMatrix(e),D=new DOMPoint(0,0).matrixTransform(I),R=new DOMPoint(0+E,0).matrixTransform(I),$=new DOMPoint(0+E,0+C).matrixTransform(I),G=new DOMPoint(0,0+C).matrixTransform(I),q=Math.abs($.x-D.x),se=Math.abs($.y-D.y),Q=Math.abs(G.x-R.x),Se=Math.abs(G.y-R.y);g=Math.max(q,Q),b=Math.max(se,Se)}return{contentWidth:g,contentHeight:b}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||this.panMode===po||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 Ps)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 I=window.getSelection();return I&&I.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 I=l.panzoomChange,D=l.panzoomAction;if((I||D)&&e.preventDefault(),I){let R={};try{R=JSON.parse(I)}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 k=I=>{this.option("zoom",e)&&I&&typeof I=="string"&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(I)&&typeof this[I]=="function"&&(e.preventDefault(),this[I]({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&&k(E)):(this.emit("dblClick",e),e.defaultPrevented||k(C)),this.clicks=0,this.clickTimer=null},350))):(this.emit("click",e),!e.defaultPrevented&&E&&k(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===po&&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&&lt(this.targetScale)<=lt(this.minScale)||(this.emit("touchMove",e),e.defaultPrevented))return;this.addTrackingPoint(n[0]);const{content:r}=this,a=X1(i[0],i[1]),u=X1(n[0],n[1]);let l=0,g=0;if(n.length>1){const se=r.getBoundingClientRect();l=a.clientX-se.left-.5*se.width,g=a.clientY-se.top-.5*se.height}const b=Y1(i[0],i[1]),k=Y1(n[0],n[1]);let E=b?k/b:1,C=u.clientX-a.clientX,I=u.clientY-a.clientY;this.dragOffset.x+=C,this.dragOffset.y+=I,this.dragOffset.time=Date.now()-this.dragStart.time;let D=lt(this.targetScale)===lt(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 se=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=se>45&&se<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,C=0,I=0}else this.lockedAxis=D;if(jp(e.target,this.content)&&(D="x",this.dragOffset.y=0),D&&D!=="xy"&&this.lockedAxis!==D&&lt(this.targetScale)===lt(this.minScale))return;e.cancelable&&e.preventDefault(),this.container.classList.add(this.cn("isDragging"));const R=this.checkBounds(C,I);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&&I<0||R.yDiff<0&&I>0)&&(I*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*R.yDiff)))):(R.xDiff&&(C=0),R.yDiff&&(I=0));const $=this.targetScale,G=this.minScale,q=this.maxScale;$<.5*G&&(E=Math.max(E,G)),$>1.5*q&&(E=Math.min(E,q)),this.lockedAxis==="y"&&lt($)===lt(G)&&(C=0),this.lockedAxis==="x"&&lt($)===lt(G)&&(I=0),this.applyChange({originX:l,originY:g,panX:C,panY:I,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 se of Ps)this.velocity[se]=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 k=0,E=0,C=0,I=0,D=this.option("decelFriction");const R=this.targetScale;if(g>0){C=Math.abs(u)>3?u/(g/30):0,I=Math.abs(l)>3?l/(g/30):0;const se=this.option("maxVelocity");se&&(C=Math.max(Math.min(C,se),-1*se),I=Math.max(Math.min(I,se),-1*se))}C&&(k=C/(1/(1-D)-1)),I&&(E=I/(1/(1-D)-1)),(this.option("lockAxis")==="y"||this.option("lockAxis")==="xy"&&this.lockedAxis==="y"&&lt(R)===this.minScale)&&(k=C=0),(this.option("lockAxis")==="x"||this.option("lockAxis")==="xy"&&this.lockedAxis==="x"&&lt(R)===this.minScale)&&(E=I=0);const $=this.dragOffset.x,G=this.dragOffset.y,q=this.option("dragMinThreshold")||0;Math.abs($)<q&&Math.abs(G)<q&&(k=E=0,C=I=0),(this.option("zoom")&&(R<this.minScale-1e-5||R>this.maxScale+1e-5)||n&&!k&&!E)&&(D=.35),this.applyChange({panX:k,panY:E,friction:D}),this.emit("decel",C,I,$,G)}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===po||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 $ of Ps){const G=$=="e"||$==="f"?qp:lz;a[$]=lt(e[$],G),Math.abs(n[$]-e[$])<($=="e"||$==="f"?.51:.001)&&(e[$]=n[$])}let{a:u,b:l,c:g,d:b,e:k,f:E}=a,C=`matrix(${u}, ${l}, ${g}, ${b}, ${k}, ${E})`,I=i.parentElement instanceof HTMLPictureElement?i.parentElement:i;if(this.option("transformParent")&&(I=I.parentElement||I),I.style.transform===C)return;I.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,k=l.height*i;const E=parseFloat(g.paddingTop)+parseFloat(g.paddingBottom),C=b-(parseFloat(g.paddingLeft)+parseFloat(g.paddingRight)),I=k-E;this.containerRect={width:b,height:k,innerWidth:C,innerHeight:I};const D=parseFloat(a.dataset.width||"")||(ot=>{let zt=0;return zt=ot instanceof HTMLImageElement?ot.naturalWidth:ot instanceof SVGElement?ot.width.baseVal.value:Math.max(ot.offsetWidth,ot.scrollWidth),zt||0})(a),R=parseFloat(a.dataset.height||"")||(ot=>{let zt=0;return zt=ot instanceof HTMLImageElement?ot.naturalHeight:ot instanceof SVGElement?ot.height.baseVal.value:Math.max(ot.offsetHeight,ot.scrollHeight),zt||0})(a);let $=this.option("width",D)||fo,G=this.option("height",R)||fo;const q=$===fo,se=G===fo;typeof $!="number"&&($=D),typeof G!="number"&&(G=R),q&&($=D*(G/R)),se&&(G=R/(D/$));let Q=a.parentElement instanceof HTMLPictureElement?a.parentElement:a;this.option("transformParent")&&(Q=Q.parentElement||Q);const Se=Q.getAttribute("style")||"";Q.style.setProperty("transform","none","important"),u&&(Q.style.width="",Q.style.height=""),Q.offsetHeight;const _e=a.getBoundingClientRect();let Ce=_e.width*i,Le=_e.height*i,Ie=Ce,Ue=Le;Ce=Math.min(Ce,$),Le=Math.min(Le,G),u?{width:Ce,height:Le}=((ot,zt,Xt,on)=>{const $t=Xt/ot,Kt=on/zt,Cn=Math.min($t,Kt);return{width:ot*=Cn,height:zt*=Cn}})($,G,Ce,Le):(Ce=Math.min(Ce,$),Le=Math.min(Le,G));let Je=.5*(Ue-Le),It=.5*(Ie-Ce);this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:_e.top-l.top+Je,bottom:l.bottom-_e.bottom+Je,left:_e.left-l.left+It,right:l.right-_e.right+It,fitWidth:Ce,fitHeight:Le,width:Ce,height:Le,fullWidth:$,fullHeight:G}),Q.style.cssText=Se,u&&(Q.style.width=`${Ce}px`,Q.style.height=`${Le}px`),this.setTransform(),e!==!0&&this.emit("refresh"),this.ignoreBounds||(lt(this.targetScale)<lt(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,k=0;const E=this.option("infinite");if(E===!0||r&&E===r)l=-1/0,b=1/0,g=-1/0,k=1/0;else{let{containerRect:C,contentRect:I}=this,D=lt(a*i,qp),R=lt(u*i,qp),{innerWidth:$,innerHeight:G}=C;if(C.width===D&&($=C.width),C.width===R&&(G=C.height),e>$){b=.5*(e-$),l=-1*b;let q=.5*(I.right-I.left);l+=q,b+=q}if(a>$&&e<$&&(l-=.5*(a-$),b-=.5*(a-$)),n>G){k=.5*(n-G),g=-1*k;let q=.5*(I.bottom-I.top);g+=q,k+=q}u>G&&n<G&&(l-=.5*(u-G),b-=.5*(u-G))}return{x:{min:l,max:b},y:{min:g,max:k}}}getBounds(){const e=this.option("bounds");return e!==fo?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(),k=e.canZoomOut(),E=i===Q1&&!!this.option("touch"),C=k&&E;if(E&&(lt(a)<lt(u)&&!this.panOnlyZoomed&&(C=!0),(lt(r.width,1)>lt(r.fitWidth,1)||lt(r.height,1)>lt(r.fitHeight,1))&&(C=!0)),lt(r.width*a,1)<lt(r.fitWidth,1)&&(C=!1),i===po&&(C=!1),ts(n,this.cn("isDraggable"),C),!this.option("zoom"))return;let I=b&&lt(l)>lt(a),D=!I&&!C&&k&&lt(l)<lt(a);ts(n,this.cn("canZoomIn"),I),ts(n,this.cn("canZoomOut"),D);for(const R of n.querySelectorAll("[data-panzoom-action]")){let $=!1,G=!1;switch(R.dataset.panzoomAction){case"zoomIn":b?$=!0:G=!0;break;case"zoomOut":k?$=!0:G=!0;break;case"toggleZoom":case"iterateZoom":b||k?$=!0:G=!0;const q=R.querySelector("g");q&&(q.style.display=b?"":"none")}$?(R.removeAttribute("disabled"),R.removeAttribute("tabindex")):G&&(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:k=!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:k})}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:k=!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=k;const{current:I}=this,D=I.e,R=I.f,$=this.getMatrix(this.target);let G=new DOMMatrix().translate(D,R).translate(a,u).translate(e,n);if(this.option("zoom")){if(!k){const q=this.targetScale,se=this.minScale,Q=this.maxScale;q*i<se&&(i=se/q),q*i>Q&&(i=Q/q)}G=G.scale(i)}G=G.translate(-a,-u).translate(-D,-R).multiply($),r&&(G=G.rotate(r)),g&&(G=G.scale(-1,1)),b&&(G=G.scale(1,-1));for(const q of Ps)q!=="e"&&q!=="f"&&(G[q]>this.minScale+1e-5||G[q]<this.minScale-1e-5)?this.target[q]=G[q]:this.target[q]=lt(G[q],qp);(this.targetScale<this.scale||Math.abs(i-1)>.1||this.panMode===po||E===!1)&&!k&&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 Ps)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!==po||!e||lt(this.targetScale)<=lt(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,k=(e.clientY||0)-g.top;let{contentWidth:E,contentHeight:C}=this.calculateContentDim(this.target);const I=this.option("mouseMoveFactor");I>1&&(E!==u&&(E*=I),C!==l&&(C*=I));let D=.5*(E-u)-b/u*100/100*(E-u);D+=.5*(a.right-a.left);let R=.5*(C-l)-k/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,k){return Math.abs(k)>Math.abs(b)?k:b});const r=Math.max(-1,Math.min(1,i)),{targetScale:a,maxScale:u,minScale:l}=this;let g=a*(100+45*r)/100;lt(g)<lt(l)&&lt(a)<=lt(l)?(this.cwd+=Math.abs(r),g=l):lt(g)>lt(u)&&lt(a)>=lt(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(),lt(g)!==lt(a)&&this.zoomTo(g,{event:e}))}canZoomIn(){return this.option("zoom")&&(lt(this.contentRect.width,1)<lt(this.contentRect.fitWidth,1)||lt(this.targetScale)<lt(this.maxScale))}canZoomOut(){return this.option("zoom")&&lt(this.targetScale)>lt(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=fo,originX:i=fo,originY:r=fo,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===po&&(a=this.pmme||a),a||i===fo||r===fo){const E=this.content.getBoundingClientRect(),C=this.container.getBoundingClientRect(),I=a?a.clientX:C.left+.5*C.width,D=a?a.clientY:C.top+.5*C.height;i=I-E.left-.5*E.width,r=D-E.top-.5*E.height}let k=1;typeof e=="number"?k=e:e==="full"?k=l:e==="cover"?k=b:e==="max"?k=g:e==="fit"?k=1:e==="next"&&(k=this.getNextScale("iterateZoom")),k=k/u||1,n=n===fo?k>1?.15:.25:n,this.applyChange({scale:k,originX:i,originY:r,friction:n}),a&&this.panMode===po&&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 Ps)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:az}),Object.defineProperty(ua,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const tv=function(t,e){let n=!0;return(...i)=>{n&&(n=!1,t(...i),setTimeout(()=>{n=!0},e))}},nv=(t,e)=>{let n=[];return t.childNodes.forEach(i=>{i.nodeType!==Node.ELEMENT_NODE||e&&!i.matches(e)||n.push(i)}),n},cz={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 di;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"})(di||(di={}));const gy=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)},uz=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class Vo extends Up{constructor(e,n){super(n),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:e})}attach(){}detach(){}}const hz={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 iv extends Vo{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(ts(g,this.cn("isDynamic"),!!u),l)for(let E=0;E<n;E++)g.append(this.createItem(E));let b,k=0;for(const E of[...g.children]){const C=k===this.instance.page;C&&(b=E),ts(E,this.cn("isCurrent"),C),(e=E.children[0])===null||e===void 0||e.setAttribute("aria-selected",C?"true":"false");for(const I of["isBeforePrev","isPrev","isNext","isAfterNext"])En(E,this.cn(I));k++}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 I=b.nextElementSibling,D=I&&I.nextElementSibling;Ct(I,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=es(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(iv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:hz});const Wp="disabled",Gp="next",rv="prev";class ov extends Vo{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?rv: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(rv)),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(ov,"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 sv extends Vo{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===di.Ready?this.onNavReady(e):e.on("ready",this.onNavReady),n.state===di.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 k=parseInt(b.dataset.index||"",10)||0,E=g.getPageForSlide(k),C=l.getPageForSlide(k);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(k)}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!==di.Ready||i.state!==di.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===di.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(sv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const dz={Navigation:ov,Dots:iv,Sync:sv},Zp="animationend",av="isSelected",Yp="slide";class ha extends dy{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===di.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:di.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=tv(this.slideNext.bind(this),150),this.slidePrev=tv(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&&uy(a))for(const[u,l]of Object.entries(a))window.matchMedia(u).matches&&uy(l)&&(r+=u,Tr(i,l));r===this.bp&&this.state!==di.Init||(this.bp=r,this.state===di.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!==di.Init&&this.destroy(),super.setOptions(i),this.option("enabled")===!1?this.attachEvents():setTimeout(()=>{this.init()},0))}init(){this.state=di.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=di.Ready,this.emit("ready")}initLayout(){const{container:e}=this,n=this.option("classes");Ct(e,this.cn("container")),ts(e,n.isLTR,!this.isRTL),ts(e,n.isRTL,this.isRTL),ts(e,n.isVertical,!this.isHorizontal),ts(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(...nv(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=[];[...nv(e,`.${this.cn(Yp)}`)].forEach(r=>{if(Mr(r)){const a=gy({el:r,isDom:!0,index:this.slides.length});i.push(a)}});for(let r of[...this.option("slides",[])||[],...n])i.push(gy(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(uz()),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((k,E)=>{var C;k.index=E,k.pos=((C=k.slides[0])===null||C===void 0?void 0:C.pos)||0,k.dim=0;for(const[I,D]of k.slides.entries())k.dim+=D.dim,I<k.slides.length-1&&(k.dim+=D.gap);l&&k.pos+.5*k.dim<.5*i?k.pos=0:l&&k.pos+.5*k.dim>=n-.5*i?k.pos=n-i:a&&(k.pos+=-.5*(i-k.dim))}),e.forEach(k=>{u&&!r&&n>i&&(k.pos=Math.max(k.pos,0),k.pos=Math.min(k.pos,n-i)),k.pos=lt(k.pos,1e3),k.dim=lt(k.dim,1e3),Math.abs(k.pos)<=.1&&(k.pos=0)}),r)return e;const g=[];let b;return e.forEach(k=>{const E=Object.assign({},k);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 k=l[this.isHorizontal?"offsetWidth":"offsetHeight"];k-1>a&&(a=k)}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:lt(a,1e3),gap:lt(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:k,panzoom:E}=this,C=0,I=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 se of k){const Q=se.el;Q?(e==="top"?(Q.style.right="",Q.style.left=""):Q.style.top="",se.index!==C?Q.style[e]=I===0?"":`${lt(I,1e3)}px`:Q.style[e]="",D+=se.dim+se.gap,C++):I+=se.dim+se.gap}if(r&&D&&a){let se=getComputedStyle(a),Q="padding",Se=n?"Right":"Bottom",_e=parseFloat(se[Q+(n?"Left":"Top")]);R-=_e,u+=_e,u+=parseFloat(se[Q+Se]);for(const Ce of k)Ce.el&&(lt(Ce.pos)<lt(u)&&lt(Ce.pos+Ce.dim+Ce.gap)<lt(R)&&lt(R)>lt(l-u)&&(Ce.el.style[e]=`${lt(I+D,1e3)}px`),lt(Ce.pos+Ce.gap)>=lt(l-u)&&lt(Ce.pos)>lt(R+u)&&lt(R)<lt(u)&&(Ce.el.style[e]=`-${lt(D,1e3)}px`))}let $,G,q=[...this.inTransition];if(q.length>1&&($=b[q[0]],G=b[q[1]]),$&&G){let se=0;for(const Q of k)Q.el?this.inTransition.has(Q.index)&&$.slides.indexOf(Q)<0&&(Q.el.style[e]=`${lt(se+($.pos-G.pos),1e3)}px`):se+=Q.dim+Q.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((k,E)=>{k.el&&u.push(E)});const l=e.index;let g=null;u.length&&(g=i[u.reduce((k,E)=>Math.abs(E-l)<Math.abs(k-l)?E:k)]);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(av);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 k=this.getPageFromIndex(e);if(!b||!g[k]||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[k].pos*(this.isRTL?1:-1);if(l===k&&Math.abs(C-b.target[this.axis])<1)return!1;this.clearTransitions();const I=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[k])===null||u===void 0?void 0:u.slides[0])||null;this.inTransition.add(R.index),this.createSlideEl(R);let $=D.el,G=R.el;I||n===Yp||(n="fadeFast",$=null);const q=this.isRTL?"next":"prev",se=this.isRTL?"prev":"next";return $&&(this.inTransition.add(D.index),D.transition=n,$.addEventListener(Zp,this.onAnimationEnd),$.classList.add(`f-${n}Out`,`to-${E>0?se:q}`)),G&&(R.transition=n,G.addEventListener(Zp,this.onAnimationEnd),G.classList.add(`f-${n}In`,`from-${E>0?q:se}`)),b.current[this.axis]=C,b.target[this.axis]=C,b.requestTick(),this.onChange(k),!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(av);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,k=0,E=.5*a;r&&n?(g<-E&&(k=-1,g+=u),g>u-E&&(k=1,g-=u)):(g>E&&(k=1,g-=u),g<-u+E&&(k=-1,g+=u)),k&&(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=es(py),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,k=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,!k)return;let I=this.page,D=u&&l?1:-1;const R=e.current[g]*D;let{pageIndex:$}=this.getPageFromPosition(R);Math.abs(C)>5?(b[I].dim<document.documentElement["client"+(this.isHorizontal?"Width":"Height")]-1&&(I=$),I=u&&l?C<0?I-1:I+1:C<0?I+1:I-1):I=r===0&&a===0?I:$,this.slideTo(I,{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=di.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===di.Destroy)return;e=parseInt((e||0).toString())||0;const r=this.getPageFromIndex(e),{axis:a,isHorizontal:u,isRTL:l,pages:g,panzoom:b}=this,k=g.length,E=l&&u?1:-1;if(!b||!k)return;if(this.page!==r){const I=new Event("beforeChange",{bubbles:!0,cancelable:!0});if(this.emit("beforeChange",I,e),I.defaultPrevented)return}if(this.transitionTo(e,i))return;let C=g[r].pos;if(this.isInfinite){const I=this.contentDim,D=b.target[a]*E;k===2?C+=I*Math.floor(parseFloat(e+"")/2):C=[C,C-I,C+I].reduce(function(R,$){return Math.abs($-D)<Math.abs(R-D)?$: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,k=this.contentDim<this.viewportDim;let E=Array.isArray(n)?n:[n];const C=[];for(const I of E)C.push(gy(I));this.slides.splice(e,0,...C);for(let I=0;I<this.slides.length;I++)this.slides[I].index=I;for(const I of C)this.emit("beforeInitSlide",I,I.index);if(this.page>=e&&(this.page+=C.length),this.updateMetrics(),l){const I=((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,$=this.isRTL?b-D:D-b,G=this.isRTL?g-I:I-g;k&&R===1?(e<=this.page&&(l.current[this.axis]-=$,l.target[this.axis]-=$),l.panTo({[this.isHorizontal?"x":"y"]:-1*I})):G&&e<=this.page&&(l.target[this.axis]-=G,l.current[this.axis]-=G,l.requestTick())}for(const I of C)this.emit("initSlide",I,I.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],lt(n.getBoundingClientRect()[l],1e3)),C=getComputedStyle(n),I="padding",D=a?"Right":"Bottom";E-=parseFloat(C[I+(a?"Left":"Top")])+parseFloat(C[I+D]),this.viewportDim=E}let b,k=0;for(const[E,C]of r.entries()){let I=0,D=0;!C.el&&b?(I=b.dim,D=b.gap):({dim:I,gap:D}=this.getSlideMetrics(C),b=C),I=lt(I,1e3),D=lt(D,1e3),C.dim=I,C.gap=D,C.pos=k,k+=I,(u||E<r.length-1)&&(k+=D)}k=lt(k,1e3),this.contentDim=k,e&&(e.contentRect[l]=k,e.contentRect[a?"fullWidth":"fullHeight"]=k),this.pages=this.createPages(),this.pages=this.processPages(),this.state===di.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=lt((g-l.pos)/(1*l.dim),1e3),k=b,E=b;this.isInfinite&&i!==!0&&(k=lt((g-l.pos+u)/(1*l.dim),1e3),E=lt((g-l.pos-u)/(1*l.dim),1e3));let C=[b,k,E].reduce(function(I,D){return Math.abs(D)<Math.abs(I)?D:I});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 k=b-u*e,E=b+u*(e+1),C=this.isInfinite?[-1,0,1]:[0];for(const I of this.slides)for(const D of C){const R=I.pos+D*a,$=R+I.dim+I.gap;R<E&&$>k&&i.add(I)}}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],k=r[g-1],E=this.option("center");let C=0,I=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*k.gap&&(R-=i,D=-1),R>k.pos+k.dim+.5*k.gap&&(R-=i,D=1)):R=Math.max(b.pos||0,Math.min(R,k.pos));let $=k,G=r.find(q=>{const se=q.pos-.5*$.gap,Q=q.pos+q.dim+.5*q.gap;return $=q,R>=se&&R<Q});return G||(G=k),I=this.getPageForSlide(G.index),C=I+D*l,{page:C,pageIndex:I}}setPageFromPosition(){const{pageIndex:e}=this.getPageFromPosition();this.onChange(e)}destroy(){if([di.Destroy].includes(this.state))return;this.state=di.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:cz}),Object.defineProperty(ha,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:dz});const lv=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 yy;const _y=["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(","),cv=t=>{if(t&&mh){yy===void 0&&document.createElement("div").focus({get preventScroll(){return yy=!0,!1}});try{if(yy)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{}}},uv=()=>{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},by={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({},K1),{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 Ci,Ji;(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"})(Ci||(Ci={})),function(t){t[t.Loading=0]="Loading",t[t.Opening=1]="Opening",t[t.Ready=2]="Ready",t[t.Closing=3]="Closing"}(Ji||(Ji={}));let hv="",gh=!1,Xp=!1,gl=null;const dv=()=>{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}},pv=()=>{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})))},fv=()=>{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}=dv();t&&(e===i?t.jumpTo(n-1):(gh=!0,t.close())),pv()},mv=()=>{gl&&clearTimeout(gl),queueMicrotask(()=>{fv()})},gv=()=>{window.addEventListener("hashchange",mv,!1),setTimeout(()=>{fv()},500)};mh&&(/complete|interactive|loaded/.test(document.readyState)?gv():document.addEventListener("DOMContentLoaded",gv));const Jp="is-zooming-in";class yv extends Vo{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=Ci.CustomClosing,i.classList.remove(Jp),i.classList.add("is-zooming-out"),u.style.backgroundImage=`url('${g}')`;const k=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:`${k.width}px`,height:`${k.height}px`,overflow:"hidden"});const{x:E,y:C,scale:I,opacity:D}=b;if(D){const R=(($,G,q,se)=>{const Q=G-$,Se=se-q;return _e=>q+((_e-$)/Q*Se||0)})(l.scale,I,1,0);l.on("afterTransform",()=>{u.style.opacity=R(l.scale)+""})}l.on("endAnimation",()=>{n.destroy()}),l.target.a=I,l.target.b=0,l.target.c=0,l.target.d=I,l.panTo({x:E,y:C,scale:I,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 I=null;!b.opacity&&C>1200&&(I=document.createElement("img"),Ct(I,"fancybox-ghost"),I.src=l,a.appendChild(I));const D=()=>{I&&(Ct(I,"f-fadeFastOut"),setTimeout(()=>{I&&(I.remove(),I=null)},200))};(k=l,new Promise((R,$)=>{const G=new Image;G.onload=R,G.onerror=$,G.src=k})).then(()=>{i.hideLoading(e),e.state=Ji.Opening,this.instance.emit("reveal",e),this.zoomIn(e).then(()=>{D(),this.instance.done(e)},()=>{}),I&&setTimeout(()=>{D()},C>2500?800:200)},()=>{i.hideLoading(e),i.revealContent(e)})}else{const E=this.optionFor(e,"initialSize"),C=this.optionFor(e,"zoom"),I={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(I):E==="cover"?r.zoomToCover(I):E==="max"?r.zoomToMax(I):R=!1,r.stop("current")),R&&D&&(D=r.isDragging?"f-fadeIn":""),i.hideLoading(e),i.revealContent(e,D)}var k},()=>{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=es(g)),!g||!Mr(g)){if(g=document.createElement("img"),g instanceof HTMLImageElement){let b="",k=e.caption;b=typeof k=="string"&&k?k.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,k)=>u.optionFor(e,"width","auto",k)||"auto",height:(b,k)=>u.optionFor(e,"height","auto",k)||"auto",wheel:()=>{const b=u.option("wheel");return(b==="zoom"||b=="pan")&&b},click:(b,k)=>{var E,C;if(u.isCompact||u.isClosing()||e.index!==((E=u.getSlide())===null||E===void 0?void 0:E.index))return!1;if(k){const D=k.composedPath()[0];if(["A","BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(D.nodeName))return!1}let I=!k||k.target&&((C=e.contentEl)===null||C===void 0?void 0:C.contains(k.target));return u.option(I?"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:k,y:E,scale:C,opacity:I}=b,D=()=>{e.state!==Ji.Closing&&(I&&(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=q=>{(q.scale<.99||q.scale>1.01)&&!q.isDragging||(En(a,Jp),l.style.opacity="",q.off("endAnimation",R),q.off("touchStart",R),q.off("afterTransform",D),n(q))};u.on("endAnimation",R),u.on("touchStart",R),u.on("afterTransform",D),u.on(["error","destroy"],()=>{i()}),u.panTo({x:k,y:E,scale:C,friction:0,ignoreBounds:!0}),u.stop("current");const $={event:u.panMode==="mousemove"?r.prevMouseMoveEvent||r.options.event:void 0},G=this.optionFor(e,"initialSize");Ct(a,Jp),r.hideLoading(e),G==="full"?u.zoomToFull($):G==="cover"?u.zoomToCover($):G==="max"?u.zoomToMax($):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||lv(r)<3||!this.optionFor(e,"zoom")||!l||u.state===Ci.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:k,width:E,height:C}=r.getBoundingClientRect(),{top:I,left:D,fitWidth:R,fitHeight:$}=a.contentRect;if(!(E&&C&&R&&$))return!1;const G=a.container.getBoundingClientRect();D+=G.left,I+=G.top;const q=-1*(D+.5*R-(k+.5*E)),se=-1*(I+.5*$-(b+.5*C)),Q=E/R;let Se=this.option("zoomOpacity")||!1;return Se==="auto"&&(Se=Math.abs(E/C-R/$)>.1),{x:q,y:se,scale:Q,opacity:Se}}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(yv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{initialSize:"fit",Panzoom:{maxScale:1},protected:!1,zoom:!0,zoomOpacity:"auto"}}),typeof SuppressedError=="function"&&SuppressedError;const xy="html",_v="image",vy="map",Ds="youtube",yl="vimeo",yh="html5video",bv=(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 k=b.match(/((\d*)m)?(\d*)s?/);k&&r.set("start",60*parseInt(k[2]||"0")+parseInt(k[3]||"0")+"")}else r.set(l,b)}let a=r+"",u=t.match(/#t=((.*)?\d+s)/);return u&&(a+=`#t=${u[1]}`),a},pz={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}},fz=["image","html","ajax","inline","clone","iframe","map","pdf","html5video","youtube","vimeo"];class xv extends Vo{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===Ji.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===Ds&&(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===Ci.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===Ds||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),k=parseFloat(b.paddingLeft)+parseFloat(b.paddingRight),E=parseFloat(b.paddingTop)+parseFloat(b.paddingBottom),C=i.contentWindow;if(C){const I=C.document,D=I.getElementsByTagName(xy)[0],R=I.body;g.width="",R.style.overflow="hidden",u=u||D.scrollWidth+k,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!==Ds&&e.type!==yl)return;const i=()=>{if(e.iframeEl&&e.iframeEl.contentWindow){let r;if(e.iframeEl.dataset.ready==="true")return r=e.type===Ds?{event:"command",func:"playVideo"}:{method:"play",value:"true"},r&&e.iframeEl.contentWindow.postMessage(JSON.stringify(r),"*"),void(e.poller=void 0);e.type===Ds&&(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=xy,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,Ds),{nocookie:u}=a,l=function(E,C){var I={};for(var D in E)Object.prototype.hasOwnProperty.call(E,D)&&C.indexOf(D)<0&&(I[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])&&(I[D[R]]=E[D[R]])}return I}(a,["nocookie"]),g=`www.youtube${u?"-nocookie":""}.com`,b=bv(n,l),k=encodeURIComponent(r[2]);e.videoId=k,e.src=`https://${g}/embed/${k}?${b}`,e.thumbSrc=e.thumbSrc||`https://i.ytimg.com/vi/${k}/mqdefault.jpg`,i=Ds}else if(r=n.match(/^.+vimeo.com\/(?:\/)?([\d]+)((\/|\?h=)([a-z0-9]+))?(.*)?/)){const a=bv(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;fz.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=_v: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=vy):(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=vy),i=i||this.instance.option("defaultType"),e.type=i,i===_v&&(e.thumbSrc=e.thumbSrc||e.src)}setContent(e){const n=this.instance.optionFor(e,"src")||"";if(e&&e.type&&n){switch(e.type){case xy: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 vy:case Ds: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&&[Ds,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(xv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:pz});const Qp="play",ef="pause",_h="ready";class vv extends Vo{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(vv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});class wv extends Vo{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)!==Ji.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)===Ji.Ready&&(!((g=(l=e.carousel)===null||l===void 0?void 0:l.panzoom)===null||g===void 0)&&g.isResting)||a.preventDefault()}}}),n.attachPlugins({Autoplay:vv}),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(wv,"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 kv={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 Os;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden"})(Os||(Os={}));const Sv="isResting",tf="thumbWidth",Tc="thumbHeight",ns="thumbClipWidth";let Ev=class extends Vo{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:Os.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[ns]=parseFloat(n[ns]||"")||e[ns]||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(Sv));let l=((t=r.pages[u])===null||t===void 0?void 0:t.pos)||0;l+=n.getProgress(u)*(this[ns]+this.thumbGap);let g=a.getBounds();-1*l>g.x.min&&-1*l<g.x.max&&a.panTo({x:-1*l,friction:.12})}else ts(e,this.cn(Sv),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[ns]&&t[Tc]?Math.round(this[Tc]*(t[ns]/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[ns]=e("clip-width")||40,this[Tc]=e("height")||40}build(){const t=this;if(t.state!==Os.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 k=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,k);E.on("createSlide",(C,I)=>{t.setProps(I.index),t.emit("createSlide",I,I.el)}),E.on("ready",()=>{t.shiftModern(),t.emit("ready")}),E.on("refresh",()=>{t.shiftModern()}),E.on("Panzoom.click",(C,I,D)=>{t.onClick(D)}),t.carousel=E,t.state=Os.Ready}onClick(t){t.preventDefault(),t.stopPropagation();const e=this.instance,{pages:n,page:i}=e,r=R=>{if(R){const $=R.closest("[data-carousel-index]");if($)return[parseInt($.dataset.carouselIndex||"",10)||0,$]}return[-1,void 0]},a=(R,$)=>{const G=document.elementFromPoint(R,$);return G?r(G):[-1,void 0]};let[u,l]=r(t.target);if(u>-1)return;const g=this[ns],b=t.clientX,k=t.clientY;let[E,C]=a(b-g,k),[I,D]=a(b+g,k);C&&D?(u=Math.abs(b-C.getBoundingClientRect().right)<Math.abs(b-D.getBoundingClientRect().left)?E:I,u===i&&(u=u===E?I:E)):C?u=E:D&&(u=I),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[ns],l=n.thumbGap,g=n.thumbExtraGap;if(!(!((e=r.slides[t])===null||e===void 0)&&e.el))return 0;const b=.5*(a-u),k=i.pages.length-1;let E=i.getProgress(0),C=i.getProgress(k),I=i.getProgress(t,!1,!0),D=0,R=b+g+l;const $=E<0&&E>-1,G=C>0&&C<1;return t===0?(D=R*Math.abs(E),G&&E===1&&(D-=R*Math.abs(C))):t===k?(D=R*Math.abs(C)*-1,$&&C===-1&&(D+=R*Math.abs(E))):$||G?(D=-1*R,D+=R*Math.abs(E),D+=R*(1-Math.abs(C))):D=R*I,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=lt(1-Math.abs(i.getProgress(t))),l=lt(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[ns]+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=Os.Init,En(t.instance.container,t.cn("hasThumbs"))}attach(){const t=this,e=t.instance;e.on("initSlide",t.onInitSlide),e.state===di.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(Ev,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:kv});const mz=Object.assign(Object.assign({},kv),{key:"t",showOnStart:!0,parentEl:null}),Cv="is-masked",Tv="aria-hidden";class Mv extends Vo{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:Ev}),n.ref=r.plugins.Thumbs,n.option("showOnStart")||(n.ref.state=Os.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===Os.Hidden?(e.state=Os.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(Tv),n.classList.remove(Cv),this.hidden=!1)}hide(){const e=this.ref,n=e&&e.container;n&&(this.refresh(),n.offsetHeight,n.classList.add(Cv),n.setAttribute(Tv,"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===Ci.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(Mv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:mz});const wy={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 gz={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},yz={tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Av="has-toolbar",ky="fancybox__toolbar";class Iv extends Vo{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 k=0;if(b)for(const E of b.slides)(E.panzoom||E.type==="image")&&k++;k||(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 k of i[b]){const E=this.createEl(k);E&&((n=l[b])===null||n===void 0||n.push(E),u++)}let g=null;if(u&&(g=this.createContainer()),g){for(const[b,k]of Object.entries(l)){const E=document.createElement("div");Ct(E,ky+"__column is-"+b);for(const C of k)E.appendChild(C);r!=="auto"||b!=="middle"||k.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,k=g.panzoomChange;if((k||b)&&(e.preventDefault(),e.stopPropagation()),k){let E={};try{E=JSON.parse(k)}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!==Ji.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("."+ky);return i||(i=document.createElement("div"),Ct(i,ky),n.prepend(i)),i.addEventListener("click",this.onClick,{passive:!1,capture:!0}),e&&Ct(e,Av),this.container=i,i}createEl(e){const n=this.instance,i=n.carousel;if(!i||e==="toggleFS"||e==="fullscreen"&&!uv())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(wy[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(wy[e]!==void 0){const b=wy[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(es(this.instance.localize(b.icon)))}else{const b=(this.option("items")||[])[e];b&&(r=es(this.instance.localize(b.tpl)),typeof b.click=="function"&&r.addEventListener("click",k=>{k.preventDefault(),k.stopPropagation(),typeof b.click=="function"&&b.click.call(this,this,k)}))}const g=r==null?void 0:r.querySelector("svg");if(g)for(const[b,k]of Object.entries(yz))g.getAttribute(b)||g.setAttribute(b,String(k));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,Av)}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(Iv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:gz});const _z={Hash:class extends Vo{onReady(){gh=!1}onChange(t){gl&&clearTimeout(gl);const{hash:e}=dv(),{hash:n}=Kp(),i=t.isOpeningSlide(t.getSlide());i&&(hv=n===e?"":n),e&&e!==n&&(gl=setTimeout(()=>{try{if(t.state===Ci.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+(hv||""))}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(){pv()}static destroy(){window.removeEventListener("hashchange",mv,!1)}},Html:xv,Images:yv,Slideshow:wv,Thumbs:Mv,Toolbar:Iv},Pv="with-fancybox",Sy="hide-scrollbar",Dv="--fancybox-scrollbar-compensate",Ov="--fancybox-body-margin",Ey="aria-hidden",Cy="is-using-tab",Ty="is-animated",Bv="is-compact",zv="is-loading",My="is-opening",nf="has-caption",Mc="disabled",bl="tabindex",Nv="download",Ay="href",Ac="src",da=t=>typeof t=="string",Rv=function(){var t=window.getSelection();return!!t&&t.type==="Range"};let mo,go=null,xl=null,Lv=0,Vv=0,Fv=0,$v=0;const Ic=new Map;let bz=0;class gn extends dy{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:Ci.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}),mo||(mo=uv()),this.id=n.id||++bz,Ic.set(this.id,this),this.userSlides=e,this.userPlugins=i,queueMicrotask(()=>{this.init()})}init(){if(this.state===Ci.Destroy)return;this.state=Ci.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(Sy))return;let a=window.innerWidth-r.getBoundingClientRect().width;const u=parseFloat(window.getComputedStyle(i).marginRight);a<0&&(a=0),r.style.setProperty(Dv,`${a}px`),u&&i.style.setProperty(Ov,`${u}px`),i.classList.add(Sy)})(),this.initLayout(),this.scale();const e=()=>{this.initCarousel(this.userSlides),this.state=Ci.Ready,this.attachEvents(),this.emit("ready"),setTimeout(()=>{this.container&&this.container.setAttribute(Ey,"false")},16)};this.option("Fullscreen.autoStart")&&mo&&!mo.isFullscreen()?mo.request().then(()=>{this.startedFs=!0,e()}).catch(()=>e()):e()}initLayout(){var e,n;const i=this.option("parentEl")||document.body,r=es(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(Bv,this.isCompact),Ct(r,this.option("mainClass")||""),Ct(r,My),this.container=r,this.footer=r.querySelector(".fancybox__footer"),i.appendChild(r),Ct(document.documentElement,Pv),go&&xl||(go=document.createElement("span"),Ct(go,"fancybox-focus-guard"),go.setAttribute(bl,"0"),go.setAttribute(Ey,"true"),go.setAttribute("aria-label","Focus guard"),xl=go.cloneNode(),(e=r.parentElement)===null||e===void 0||e.insertBefore(go,r),(n=r.parentElement)===null||n===void 0||n.append(xl)),r.addEventListener("mousedown",a=>{Lv=a.pageX,Vv=a.pageY,En(r,Cy)}),this.option("closeExisting"))for(const a of Ic.values())a.id!==this.id&&a.close();else this.option("animated")&&(Ct(r,Ty),setTimeout(()=>{this.isClosing()||En(r,Ty)},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&&ly(l.el))return;const g=this.container;if(g){const b=Math.abs(u.current.f),k=b<1?"":Math.max(.5,Math.min(1,1-b/u.contentRect.fitHeight*1.5));g.style.setProperty("--fancybox-ts",k?"0s":""),g.style.setProperty("--fancybox-opacity",k+"")}}),r.on("Panzoom.touchEnd",(a,u,l)=>{var g;const b=this.getSlide();if(b&&ly(b.el)||u.isMobile&&document.activeElement&&["TEXTAREA","INPUT"].indexOf((g=document.activeElement)===null||g===void 0?void 0:g.nodeName)!==-1)return;const k=Math.abs(u.dragOffset.y);u.lockedAxis==="y"&&(k>=200||k>=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 k=l.downloadFilename;g?(b.removeAttribute(Mc),b.removeAttribute(bl),b.setAttribute(Ay,g),b.setAttribute(Nv,k||g),b.setAttribute("target","_blank")):(b.setAttribute(Mc,""),b.setAttribute(bl,"-1"),b.removeAttribute(Ay),b.removeAttribute(Nv))}}),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-Lv)>30||Math.abs(e.pageY-Vv)>30)return;const u=document.activeElement;if(Rv()&&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(_y)||u.blur()}if(Rv())return;l=this.option("contentClick")}else a.closest(".fancybox__carousel")&&!a.matches(_y)&&(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(Fv,$v)}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,Cy):En(this.container,Cy),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(Bv,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=es(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 k=null;if(l){if(k=e.captionEl||null,g&&!k){const E=r+`_${this.id}_${e.index}`;k=document.createElement("div"),Ct(k,r),k.setAttribute("id",E),e.captionEl=g.appendChild(k),Ct(g,nf),g.setAttribute("aria-labelledby",E)}}else k=this.caption,k||(k=a.querySelector("."+r)),!k&&(k=document.createElement("div"),k.dataset.fancyboxCaption="",Ct(k,r),(this.footer||a).prepend(k)),Ct(a,nf),this.caption=k;k&&(k.innerHTML="",da(b)||typeof b=="number"?k.innerHTML=b+"":b instanceof HTMLElement&&k.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===Ji.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(_y));let k=[],E=null;for(let I of b){const D=!I.offsetParent||!!I.closest('[aria-hidden="true"]'),R=g&&g.contains(I),$=!u.contains(I);if(I===a||(R||$)&&!D){k.push(I);const G=I.dataset.origTabindex;G!==void 0&&G&&(I.tabIndex=parseFloat(G)),I.removeAttribute("data-orig-tabindex"),!I.hasAttribute("autoFocus")&&E||(E=I)}else{const G=I.dataset.origTabindex===void 0?I.getAttribute("tabindex")||"":I.dataset.origTabindex;G&&(I.dataset.origTabindex=G),I.tabIndex=-1}}let C=null;e?(!r||k.indexOf(r)<0)&&(C=E||a,k.length&&(i===xl?C=k[0]:this.lastFocus!==a&&i!==go||(C=k[k.length-1]))):C=l&&l.type==="image"?a:E||a,C&&cv(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=es(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=Ji.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=Ji.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,My),!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=Ji.Loading;const n=e.el;n&&(Ct(n,zv),this.emit("loading",e),e.spinnerEl||setTimeout(()=>{if(!this.isClosing()&&!e.spinnerEl&&e.state===Ji.Loading){let i=es(py);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,zv),i&&this.animate(i,"f-fadeOut",()=>{i.remove()}),e.state===Ji.Loading&&(this.emit("loaded",e),e.state=Ji.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&&mo&&mo.isFullscreen()?Promise.resolve(mo.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(){mo&&(mo.isFullscreen()?mo.exit():mo.request().then(()=>{this.startedFs=!0}))}isClosing(){return[Ci.Closing,Ci.CustomClosing,Ci.Destroy].includes(this.state)}proceedClose(e,n){var i,r;this.state=Ci.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&&(lv(g)?cv(g):g.focus()),a&&(En(a,My),Ct(a,"is-closing"),a.setAttribute(Ey,"true"),this.option("animated")&&Ct(a,Ty),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=Ji.Closing,this.hideLoading(b);const k=b.contentEl;k&&this.stop(k);const E=b==null?void 0:b.panzoom;E&&(E.stop(),E.detachEvents(),E.detachObserver()),this.isCurrentSlide(b)||u.emit("removeSlide",b)}}Fv=window.scrollX,$v=window.scrollY,window.addEventListener("scroll",this.onScroll),this.emit("close",e),this.state!==Ci.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===Ci.Destroy)return;window.removeEventListener("scroll",this.onScroll),this.state=Ci.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():(go&&(go.remove(),go=null),xl&&(xl.remove(),xl=null),En(document.documentElement,Pv),(()=>{if(!mh)return;const r=document,a=r.body;a.classList.remove(Sy),a.style.setProperty(Ov,""),r.documentElement.style.setProperty(Dv,"")})(),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}"]`),$=parseInt(i.dataset.fancyboxIndex||"",10)||0;n=R[$]||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(([$,G])=>{let q=n.closest($);return!!q&&(r=D,a=$,u=q,l=G,!0)}))),!r||!a||!u)return;l=l||{},e.preventDefault(),n=u;let g=[],b=Tr({},by,l);b.event=e,b.triggerEl=n,b.delegate=i;const k=b.groupAll,E=b.groupAttr,C=E&&n?n.getAttribute(`${E}`):"";if((!n||C||k)&&(g=[].slice.call(r.querySelectorAll(a))),n&&!k&&(g=C?g.filter(D=>D.getAttribute(`${E}`)===C):[n]),!g.length)return;const I=gn.getInstance();return I&&I.options.triggerEl&&g.indexOf(I.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({},by,n||{});const i=[];for(const r of e){const a=r.dataset||{},u=a[Ac]||r.getAttribute(Ay)||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 k={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),k[E]=C}i.push(k)}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:by}),Object.defineProperty(gn,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:_z}),Object.defineProperty(gn,"openers",{enumerable:!0,configurable:!0,writable:!0,value:new Map});const jv=Object.freeze(Object.defineProperty({__proto__:null,Carousel:ha,Fancybox:gn,Panzoom:ua},Symbol.toStringTag,{value:"Module"})),{Fancybox:rf}=jv,xz={props:{options:Object},mounted(){rf.defaults={...this.options||{}}},updated(){rf.close(),rf.defaults={...this.options||{}}},unmounted(){rf.close()}},vz={ref:"container"};function wz(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",vz,[f.renderSlot(t.$slots,"default")],512)}const kz=$e(xz,[["render",wz]]),Sz={},Ez={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 Cz(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",Ez,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 Tz={componens:{IconFile:$e(Sz,[["render",Cz]])},props:{item:null},computed:{createDate(){try{const t=ht(this.item.cdate,"YYYY-MM-DD");return new Date(t).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}}},Mz={style:{"max-width":"calc(50vw - 300px)"}},Az={class:"truncate text-sm font-semibold text-gray-800 dark:text-neutral-200"},Iz={class:"block truncate text-xs text-gray-500 dark:text-neutral-500"};function Pz(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",Mz,[f.createElementVNode("p",Az,f.toDisplayString(n.item.uploaded_name),1),f.createElementVNode("p",Iz,[f.createElementVNode("span",null,f.toDisplayString(n.item.username),1),f.createTextVNode(" "+f.toDisplayString(a.createDate),1)])])],64)}const Dz=$e(Tz,[["render",Pz]]),Oz={},Bz={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 zz(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",Bz,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 Uv=$e(Oz,[["render",zz]]),Nz={},Rz={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 Lz(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",Rz,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 Hv=$e(Nz,[["render",Lz]]),Vz={components:{Fancybox:kz,VsWidgetFileInfo:Dz,IconDownload:Uv,IconTrash:Hv},props:{item:null},data(){return{optionsFile:{defaultType:"iframe"}}},computed:{createDate(){try{const t=ht(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 rt.delete(`/api/widget/file/${this.item.entity_id}/${this.item.file_id}`),this.$emit("update")}catch(t){console.error(t)}}}},Fz={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-xl w-full"},$z={key:0,class:"flex"},jz=["href"],Uz={key:1,class:"flex"},Hz=["href"],qz={key:2,class:"flex gap-x-3 w-full"},Wz={class:"lg:absolute lg:top-3 lg:end-3 group-hover:opacity-100 lg:opacity-0"},Gz={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"},Zz={class:"hs-tooltip inline-block"},Yz={class:"hs-tooltip inline-block"};function Xz(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",Fz,[n.item.ext==="jpg"||n.item.ext==="png"?(f.openBlock(),f.createElementBlock("div",$z,[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,jz)]),_:1})])):a.isSupportedFile(n.item)?(f.openBlock(),f.createElementBlock("div",Uz,[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,Hz)]),_:1},8,["options"])])):(f.openBlock(),f.createElementBlock("div",qz,[f.createVNode(u,{item:n.item},null,8,["item"])])),f.createElementVNode("div",Wz,[f.createElementVNode("div",Gz,[f.createElementVNode("div",Zz,[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]=k=>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",Yz,[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]=k=>a.confirnDeleteFile())},[f.createVNode(b,{height:"14",width:"14"})])])])])])}const Kz=$e(Vz,[["render",Xz]]),Jz={props:["text"]},Qz={class:"pl-3 text-sm font-medium text-gray-600"};function eN(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",null,[f.createElementVNode("p",Qz,f.toDisplayString(n.text),1)])}const qv=$e(Jz,[["render",eN]]),tN={},nN={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 iN(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",nN,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 Wv=$e(tN,[["render",iN]]),rN={components:{VsWidgetFileItem:Kz,VsEmptyWidget:qv,IconUpload:Wv},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 rt.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 rt.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}}},oN={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700"},sN={class:"flex justify-between w-full pb-[10px] items-center gap-x-2"},aN={key:0,class:"font-semibold text-gray-800 dark:text-neutral-200"},lN={class:"ml-auto"},cN={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"},uN={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},hN={class:"relative"},dN={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"},pN={key:0},fN={class:"p-4"},mN={class:"mt-1 text-gray-500 dark:text-neutral-500"},gN={class:"flex justify-end mt-4 gap-x-3"};function yN(t,e,n,i,r,a){var k,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",oN,[f.createElementVNode("div",sN,[(k=r.files)!=null&&k.length?(f.openBlock(),f.createElementBlock("h2",aN," Кількість: "+f.toDisplayString(r.files.length),1)):f.createCommentVNode("",!0),f.createElementVNode("div",lN,[f.createElementVNode("label",null,[f.createElementVNode("input",{type:"file",class:"hidden",onChange:e[0]||(e[0]=I=>a.addFile(I))},null,32),f.createElementVNode("div",cN,[f.createVNode(u,{height:"20",width:"20"})])])])]),((E=r.files)==null?void 0:E.length)>4?(f.openBlock(),f.createElementBlock("div",uN,[f.createElementVNode("div",null,[f.createElementVNode("div",hN,[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]=I=>r.searchValue=I),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",dN,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.filteredFiles,(I,D)=>(f.openBlock(),f.createBlock(l,{key:D,id:n.id,item:I,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",pN,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]=I=>r.isModalVisible=I)},{default:f.withCtx(()=>[f.createElementVNode("div",fN,[f.createElementVNode("p",mN,f.toDisplayString(r.modal.message),1),f.createElementVNode("div",gN,[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]=(...I)=>r.modal.cancel&&r.modal.cancel(...I))},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]=(...I)=>r.modal.confirm&&r.modal.confirm(...I))},f.toDisplayString(r.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const Gv=$e(rN,[["render",yN]]),_N={class:"flex flex-col vs-widget-images xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700"},bN={class:"flex items-center justify-between mb-4 gap-x-2"},xN={class:"flex items-center justify-end gap-x-2"},vN={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"},wN={class:"flex flex-wrap gap-[16px]"},kN=["href","data-caption"],SN=["src","alt"],EN={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"},CN={class:"text-xs w-[180px] block overflow-hidden text-nowrap overflow-ellipsis"},TN={class:"flex flex-wrap items-center text-xs text-gray-600 widget-images__item-desc"},MN={class:"flex items-center"},AN={class:"text-xs"},IN=["onClick"],PN=["onClick"],DN={class:"p-4"},ON={class:"mt-1 text-gray-500 dark:text-neutral-500"},BN={class:"flex justify-end mt-4 gap-x-3"},zN={__name:"vs-widget-gallery",props:{id:{type:String,default:""},readonly:{type:Boolean,default:!1},prefilledData:{type:Array,default:()=>[]}},setup(t){const{Fancybox:e}=jv,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 rt.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 $;const R=Array.from(($=D.target)==null?void 0:$.files);await Promise.all(R.map(async G=>{const q=new FormData;q.append("file",G);try{await rt.post(`/api/widget/file/${n==null?void 0:n.id}`,q)}catch(se){console.error(se)}})),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()},k=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 rt.delete(`/api/widget/gallery/${(D=a.value)==null?void 0:D.entity_id}/${(R=a.value)==null?void 0:R.file_id}`)}catch($){console.error($)}},C=(D,R=2)=>{if(D===0)return"0 Bytes";const $=1024,G=R<0?0:R,q=["Bytes","KB","MB","GB","TB"],se=Math.floor(Math.log(D)/Math.log($));return`${parseFloat((D/$**se).toFixed(G))} ${q[se]}`},I=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 $=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock("div",_N,[f.createElementVNode("div",bN,[R[3]||(R[3]=f.createElementVNode("h2",{class:"inline-block font-semibold text-gray-800 dark:text-neutral-200"},null,-1)),f.createElementVNode("div",xN,[f.createElementVNode("div",null,[f.createElementVNode("label",null,[f.createElementVNode("input",{type:"file",class:"hidden",onChange:g},null,32),f.createElementVNode("div",vN,[f.createVNode(Wv,{height:"20",width:"20"})])])])])]),f.createElementVNode("div",wN,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(i.value,G=>(f.openBlock(),f.createElementBlock("div",{key:G.file_path,class:"relative cursor-pointer rounded-b-lg item hover:shadow-lg h-[200px] w-[300px]"},[f.createElementVNode("a",{href:G.file_path,"data-fancybox":"gallery","data-caption":G.uploaded_name,target:"_blank"},[f.createElementVNode("img",{class:"object-cover w-full h-full rounded-lg",src:G.file_path||"/icons/no-image.jpg",alt:G.uploaded_name},null,8,SN),f.createElementVNode("div",EN,[f.createElementVNode("div",null,[f.createElementVNode("span",CN,f.toDisplayString(G.uploaded_name),1),f.createElementVNode("div",TN,[f.createElementVNode("span",MN,f.toDisplayString(C(G.size)),1),f.createElementVNode("span",null,f.toDisplayString(I(G.cdate)),1)]),f.createElementVNode("span",AN,f.toDisplayString(G.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(q=>b(G),["prevent"])},[f.createVNode(Uv,{height:"14",width:"14"})],8,IN),f.createElementVNode("div",{class:"flex items-center gap-2 hover:bg-gray-200 p-[6px] rounded hover:cursor-pointer",onClick:f.withModifiers(q=>k(G),["prevent"])},[f.createVNode(Hv,{height:"14",width:"14"})],8,PN)])])],8,kN)]))),128))]),f.createVNode($,{title:u.value.title,size:"small",visible:r.value,"onUpdate:visible":R[2]||(R[2]=G=>r.value=G)},{default:f.withCtx(()=>[f.createElementVNode("div",DN,[f.createElementVNode("p",ON,f.toDisplayString(u.value.message),1),f.createElementVNode("div",BN,[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]=(...G)=>u.value.cancel&&u.value.cancel(...G))},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]=(...G)=>u.value.confirm&&u.value.confirm(...G))},f.toDisplayString(u.value.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}}};function Fi(t){this.content=t}Fi.prototype={constructor:Fi,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 Fi(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 Fi(n)},addToStart:function(t,e){return new Fi([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Fi(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 Fi(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=Fi.from(t),t.size?new Fi(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Fi.from(t),t.size?new Fi(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Fi.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}},Fi.from=function(t){if(t instanceof Fi)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Fi(e)};function Zv(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=Zv(r.content,a.content,n+1);if(u!=null)return u}n+=r.nodeSize}}function Yv(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,k=Math.min(u.text.length,l.text.length);for(;b<k&&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=Yv(u.content,l.content,n-1,i-1);if(b)return b}n-=g,i-=g}}class je{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 k=l+1;g.nodesBetween(Math.max(0,e-k),Math.min(g.content.size,n-k),i,r+k)}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 je(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 je(i,r)}cutByIndex(e,n){return e==n?je.empty:e==0&&n==this.content.length?this:new je(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 je(r,a)}addToStart(e){return new je([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new je(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 Zv(this,e,n)}findDiffEnd(e,n=this.size,i=e.size){return Yv(this,e,n,i)}findIndex(e,n=-1){if(e==0)return of(0,e);if(e==this.size)return of(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?of(i+1,u):of(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 je.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new je(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return je.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 je(n||e,i)}static from(e){if(!e)return je.empty;if(e instanceof je)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new je([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}je.empty=new je([],0);const Iy={index:0,offset:0};function of(t,e){return Iy.index=t,Iy.offset=e,Iy}function sf(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(!sf(t[i],e[i]))return!1}else{for(let i in t)if(!(i in e)||!sf(t[i],e[i]))return!1;for(let i in e)if(!(i in t))return!1}return!0}let Hn=class yb{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&&sf(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 yb.none;if(e instanceof yb)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 pt{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=Kv(this.content,e+this.openStart,n);return i&&new pt(i,this.openStart,this.openEnd)}removeBetween(e,n){return new pt(Xv(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 pt.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 pt(je.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 pt(e,i,r)}}pt.empty=new pt(je.empty,0,0);function Xv(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(Xv(a.content,e-r-1,n-r-1)))}function Kv(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=Kv(u.content,e-a-1,n);return l&&t.replaceChild(r,u.copy(l))}function NN(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 Jv(t,e,n,0)}function Jv(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=Jv(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}=RN(n,t);return wl(a,ew(t,u,l,e,i))}else return wl(a,lf(t,e,i))}function Qv(t,e){if(!e.type.compatibleContent(t.type))throw new af("Cannot join "+e.type.name+" onto "+t.type.name)}function Py(t,e,n){let i=t.node(n);return Qv(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 ew(t,e,n,i,r){let a=t.depth>r&&Py(t,e,r+1),u=i.depth>r&&Py(n,i,r+1),l=[];return bh(null,t,r,l),a&&u&&e.index(r)==n.index(r)?(Qv(a,u),vl(wl(a,ew(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 je(l)}function lf(t,e,n){let i=[];if(bh(null,t,n,i),t.depth>n){let r=Py(t,e,n+1);vl(wl(r,lf(t,e,n+1)),i)}return bh(e,null,n,i),new je(i)}function RN(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(je.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=tw.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 tw.set(e,i=new LN);let r=i.elts[i.i]=xh.resolve(e,n);return i.i=(i.i+1)%VN,r}}class LN{constructor(){this.elts=[],this.i=0}}const VN=12,tw=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 FN=Object.create(null);let kl=class _b{constructor(e,n,i,r=Hn.none){this.type=e,this.attrs=n,this.marks=r,this.content=i||je.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&&sf(this.attrs,n||e.defaultAttrs||FN)&&Hn.sameSet(this.marks,i||Hn.none)}copy(e=null){return e==this.content?this:new _b(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new _b(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 pt.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 pt(b,r.depth-u,a.depth-u)}replace(e,n,i){return NN(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()+")"),nw(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=je.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=je.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):nw(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 nw(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 $N(e,n);if(i.next==null)return Sl.empty;let r=iw(i);i.next&&i.err("Unexpected trailing text");let a=ZN(GN(r));return YN(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 je.from(l.map(b=>b.createAndFill()));for(let b=0;b<u.next.length;b++){let{type:k,next:E}=u.next[b];if(!(k.isText||k.hasRequiredAttrs())&&r.indexOf(E)==-1){r.push(E);let C=a(E,l.concat(k));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 $N{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 iw(t){let e=[];do e.push(jN(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function jN(t){let e=[];do e.push(UN(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function UN(t){let e=WN(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=HN(t,e);else break;return e}function rw(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function HN(t,e){let n=rw(t),i=n;return t.eat(",")&&(t.next!="}"?i=rw(t):i=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:i,expr:e}}function qN(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 WN(t){if(t.eat("(")){let e=iw(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=qN(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 GN(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 k=n();r(a(u.expr,g),k),g=k}if(u.max==-1)r(a(u.expr,g),g);else for(let b=u.min;b<u.max;b++){let k=n();i(g,k),r(a(u.expr,g),k),g=k}return[i(g)]}else{if(u.type=="name")return[i(l,void 0,u.value)];throw new Error("Unknown expr type")}}}}function ow(t,e){return e-t}function sw(t,e){let n=[];return i(e),n.sort(ow);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 ZN(t){let e=Object.create(null);return n(sw(t,0));function n(i){let r=[];i.forEach(u=>{t[u].forEach(({term:l,to:g})=>{if(!l)return;let b;for(let k=0;k<r.length;k++)r[k][0]==l&&(b=r[k][1]);sw(t,g).forEach(k=>{b||r.push([l,b=[]]),b.indexOf(k)==-1&&b.push(k)})})});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(ow);a.next.push({type:r[u][0],next:e[l.join(",")]||n(l)})}return a}}function YN(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 aw(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 lw(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 cw(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 uw(t,e){let n=Object.create(null);if(e)for(let i in e)n[i]=new KN(t,i,e[i]);return n}let hw=class kC{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=uw(e,i.attrs),this.defaultAttrs=aw(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:lw(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),je.from(n),Hn.setFrom(i))}createChecked(e=null,n,i){return n=je.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=je.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(je.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){cw(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 kC(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 XN(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 KN{constructor(e,n,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?XN(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=uw(e,r.attrs),this.excluded=null;let a=aw(this.attrs);this.instance=a?new Hn(this,a):null}create(e=null){return!e&&this.instance?this.instance:new Hn(this,lw(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){cw(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class dw{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=Fi.from(e.nodes),n.marks=Fi.from(e.marks||{}),this.nodes=hw.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?pw(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==""?[]:pw(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 hw){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 pw(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 JN(t){return t.tag!=null}function QN(t){return t.style!=null}let vh=class bb{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let i=this.matchedStyles=[];n.forEach(r=>{if(JN(r))this.tags.push(r);else if(QN(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 yw(this,n,!1);return i.addAll(e,Hn.none,n.from,n.to),i.finish()}parseSlice(e,n={}){let i=new yw(this,n,!0);return i.addAll(e,Hn.none,n.from,n.to),pt.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(n5(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=_w(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=_w(u)),u.node||u.ignore||u.mark||(u.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new bb(e,bb.schemaRules(e)))}};const fw={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},e5={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},mw={ol:!0,ul:!0},df=1,pf=2,wh=4;function gw(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(je.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=je.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(je.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&&!fw.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class yw{constructor(e,n,i){this.parser=e,this.options=n,this.isOpen=i,this.open=0;let r=n.topNode,a,u=gw(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 $N{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 iw(t){let e=[];do e.push(jN(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function jN(t){let e=[];do e.push(UN(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function UN(t){let e=WN(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=HN(t,e);else break;return e}function rw(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function HN(t,e){let n=rw(t),i=n;return t.eat(",")&&(t.next!="}"?i=rw(t):i=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:i,expr:e}}function qN(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 WN(t){if(t.eat("(")){let e=iw(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=qN(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 GN(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 k=n();r(a(u.expr,g),k),g=k}if(u.max==-1)r(a(u.expr,g),g);else for(let b=u.min;b<u.max;b++){let k=n();i(g,k),r(a(u.expr,g),k),g=k}return[i(g)]}else{if(u.type=="name")return[i(l,void 0,u.value)];throw new Error("Unknown expr type")}}}}function ow(t,e){return e-t}function sw(t,e){let n=[];return i(e),n.sort(ow);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 ZN(t){let e=Object.create(null);return n(sw(t,0));function n(i){let r=[];i.forEach(u=>{t[u].forEach(({term:l,to:g})=>{if(!l)return;let b;for(let k=0;k<r.length;k++)r[k][0]==l&&(b=r[k][1]);sw(t,g).forEach(k=>{b||r.push([l,b=[]]),b.indexOf(k)==-1&&b.push(k)})})});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(ow);a.next.push({type:r[u][0],next:e[l.join(",")]||n(l)})}return a}}function YN(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 aw(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 lw(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 cw(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 uw(t,e){let n=Object.create(null);if(e)for(let i in e)n[i]=new KN(t,i,e[i]);return n}let hw=class kC{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=uw(e,i.attrs),this.defaultAttrs=aw(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:lw(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),je.from(n),Hn.setFrom(i))}createChecked(e=null,n,i){return n=je.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=je.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(je.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){cw(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 kC(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 XN(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 KN{constructor(e,n,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?XN(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=uw(e,r.attrs),this.excluded=null;let a=aw(this.attrs);this.instance=a?new Hn(this,a):null}create(e=null){return!e&&this.instance?this.instance:new Hn(this,lw(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){cw(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class dw{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=Fi.from(e.nodes),n.marks=Fi.from(e.marks||{}),this.nodes=hw.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?pw(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==""?[]:pw(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 hw){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 pw(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 JN(t){return t.tag!=null}function QN(t){return t.style!=null}let vh=class bb{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let i=this.matchedStyles=[];n.forEach(r=>{if(JN(r))this.tags.push(r);else if(QN(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 yw(this,n,!1);return i.addAll(e,Hn.none,n.from,n.to),i.finish()}parseSlice(e,n={}){let i=new yw(this,n,!0);return i.addAll(e,Hn.none,n.from,n.to),pt.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(n5(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=_w(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=_w(u)),u.node||u.ignore||u.mark||(u.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new bb(e,bb.schemaRules(e)))}};const fw={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},e5={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},mw={ol:!0,ul:!0},df=1,pf=2,wh=4;function gw(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(je.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=je.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(je.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&&!fw.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class yw{constructor(e,n,i){this.parser=e,this.options=n,this.isOpen=i,this.open=0;let r=n.topNode,a,u=gw(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;mw.hasOwnProperty(r)&&this.parser.normalizeLists&&t5(e);let u=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,i));if(u?u.ignore:e5.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(fw.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 k=u&&u.skip?n:this.readStyles(e,n);k&&this.addAll(e,k),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):bw(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=gw(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):bw(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 k=g>0||g==0&&r?this.nodes[g].type:i&&g>=a?i.node(g-a).type:null;if(!k||k.name!=b&&k.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 t5(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&mw.hasOwnProperty(i)&&n?(n.appendChild(e),e=n):i=="li"?n=e:i&&(n=null)}}function n5(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function _w(t){let e={};for(let n in t)e[n]=t[n];return e}function bw(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:k}=l.edge(g);if(b==e||a.indexOf(k)<0&&u(k))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=Dy(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++],k=this.serializeMark(b,u.isInline,n);k&&(a.push([b,r]),r.appendChild(k.dom),r=k.contentDOM||k.dom)}}r.appendChild(this.serializeNodeInner(u,n))}),i}serializeNodeInner(e,n){let{dom:i,contentDOM:r}=mf(Dy(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(Dy(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=xw(e.nodes);return n.text||(n.text=i=>i.text),n}static marksFromSchema(e){return xw(e.marks)}}function xw(t){let e={};for(let n in t){let i=t[n].spec.toDOM;i&&(e[n]=i)}return e}function Dy(t){return t.document||window.document}const vw=new WeakMap;function i5(t){let e=vw.get(t);return e===void 0&&vw.set(t,e=r5(t)),e}function r5(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=i5(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],k=1;if(b&&typeof b=="object"&&b.nodeType==null&&!Array.isArray(b)){k=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=k;E<e.length;E++){let C=e[E];if(C===0){if(E<e.length-1||E>k)throw new RangeError("Content hole must be the only child of its parent node");return{dom:g,contentDOM:g}}else{let{dom:I,contentDOM:D}=mf(t,C,n,i);if(g.appendChild(I),D){if(l)throw new RangeError("Multiple content holes");l=D}}}return{dom:g,contentDOM:l}}const ww=65535,kw=Math.pow(2,16);function o5(t,e){return t+e*kw}function Sw(t){return t&ww}function s5(t){return(t-(t&ww))/kw}const Ew=1,Cw=2,gf=4,Tw=8;class Oy{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&Tw)>0}get deletedBefore(){return(this.delInfo&(Ew|gf))>0}get deletedAfter(){return(this.delInfo&(Cw|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=Sw(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+s5(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],k=this.ranges[l+u],E=g+b;if(e<=E){let C=b?e==g?-1:e==E?1:n:n,I=g+r+(C<0?0:k);if(i)return I;let D=e==(n<0?g:E)?null:o5(l/3,e-g),R=e==g?Cw:e==E?Ew:gf;return(n<0?e!=g:e!=E)&&(R|=Tw),new Oy(I,R,D)}r+=k-b}return i?e+r:new Oy(e+r,0,null)}touches(e,n){let i=0,r=Sw(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],k=g+b;if(e<=k&&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],k=this.ranges[r+i];e(l,l+b,g,g+k),a+=k-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 Oy(e,r,null)}}const By=Object.create(null);class Qi{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=By[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 By)throw new RangeError("Duplicate use of step JSON ID "+e);return By[e]=n,n.prototype.jsonID=e,n}}class pi{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new pi(e,null)}static fail(e){return new pi(null,e)}static fromReplace(e,n,i,r){try{return pi.ok(e.replace(n,i,r))}catch(a){if(a instanceof af)return pi.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 je.fromArray(i)}class pa extends Qi{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 pt(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 pi.fromReplace(e,this.from,this.to,a)}invert(){return new is(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))}}Qi.jsonID("addMark",pa);class is extends Qi{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 pt(zy(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return pi.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 is(n.pos,i.pos,this.mark)}merge(e){return e instanceof is&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new is(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 is(n.from,n.to,e.markFromJSON(n.mark))}}Qi.jsonID("removeMark",is);class fa extends Qi{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return pi.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return pi.fromReplace(e,this.pos,this.pos+1,new pt(je.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))}}Qi.jsonID("addNodeMark",fa);class Dc extends Qi{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return pi.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return pi.fromReplace(e,this.pos,this.pos+1,new pt(je.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))}}Qi.jsonID("removeNodeMark",Dc);class Ti extends Qi{constructor(e,n,i,r=!1){super(),this.from=e,this.to=n,this.slice=i,this.structure=r}apply(e){return this.structure&&Ny(e,this.from,this.to)?pi.fail("Structure replace would overwrite content"):pi.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 Ti(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 Ti(n.pos,Math.max(n.pos,i.pos),this.slice)}merge(e){if(!(e instanceof Ti)||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?pt.empty:new pt(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ti(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?pt.empty:new pt(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ti(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 Ti(n.from,n.to,pt.fromJSON(e,n.slice),!!n.structure)}}Qi.jsonID("replace",Ti);class Mi extends Qi{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&&(Ny(e,this.from,this.gapFrom)||Ny(e,this.gapTo,this.to)))return pi.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return pi.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,n.content);return i?pi.fromReplace(e,this.from,this.to,i):pi.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 Mi(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 Mi(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 Mi(n.from,n.to,n.gapFrom,n.gapTo,pt.fromJSON(e,n.slice),n.insert,!!n.structure)}}Qi.jsonID("replaceAround",Mi);function Ny(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 a5(t,e,n,i){let r=[],a=[],u,l;t.doc.nodesBetween(e,n,(g,b,k)=>{if(!g.isInline)return;let E=g.marks;if(!i.isInSet(E)&&k.type.allowsMarkType(i.type)){let C=Math.max(b,e),I=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=I:r.push(u=new is(C,I,E[R])));l&&l.to==C?l.to=I:a.push(l=new pa(C,I,i))}}),r.forEach(g=>t.step(g)),a.forEach(g=>t.step(g))}function l5(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,k;for(;k=i.isInSet(b);)(g||(g=[])).push(k),b=k.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 k=0;k<g.length;k++){let E=g[k],C;for(let I=0;I<r.length;I++){let D=r[I];D.step==a-1&&E.eq(r[I].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 is(u.from,u.to,u.style)))}function Mw(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),k=l+b.nodeSize,E=i.matchType(b.type);if(!E)u.push(new Ti(l,k,pt.empty));else{i=E;for(let C=0;C<b.marks.length;C++)n.allowsMarkType(b.marks[C].type)||t.step(new is(l,k,b.marks[C]));if(r&&b.isText&&n.whitespace!="pre"){let C,I=/\r?\n|\r/g,D;for(;C=I.exec(b.text);)D||(D=new pt(je.from(n.schema.text(" ",n.allowedMarks(b.marks))),0,0)),u.push(new Ti(l+C.index,l+C.index+C[0].length,D))}}l=k}if(!i.validEnd){let g=i.fillBefore(je.empty,!0);t.replace(l,l,new pt(g,0,0))}for(let g=u.length-1;g>=0;g--)t.step(u[g])}function c5(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||!c5(r,a,u))break}return null}function u5(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,k=je.empty,E=0;for(let D=a,R=!1;D>n;D--)R||i.index(D)>0?(R=!0,k=je.from(i.node(D).copy(k)),E++):g--;let C=je.empty,I=0;for(let D=a,R=!1;D>n;D--)R||r.after(D+1)<r.end(D)?(R=!0,C=je.from(r.node(D).copy(C)),I++):b++;t.step(new Mi(g,b,u,l,new pt(k.append(C),E,I),k.size-E,!0))}function Ry(t,e,n=null,i=t){let r=h5(t,e),a=r&&d5(i,e);return a?r.map(Aw).concat({type:e,attrs:n}).concat(a.map(Aw)):null}function Aw(t){return{type:t,attrs:null}}function h5(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 d5(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 p5(t,e,n){let i=je.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=je.from(n[u].type.create(n[u].attrs,i))}let r=e.start,a=e.end;t.step(new Mi(r,a,r,a,new pt(i,0,0),n.length,!0))}function f5(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)&&y5(t.doc,t.mapping.slice(a).map(l),i)){let b=null;if(i.schema.linebreakReplacement){let I=i.whitespace=="pre",D=!!i.contentMatch.matchType(i.schema.linebreakReplacement);I&&!D?b=!1:!I&&D&&(b=!0)}b===!1&&g5(t,u,l,a),Mw(t,t.mapping.slice(a).map(l,1),i,void 0,b===null);let k=t.mapping.slice(a),E=k.map(l,1),C=k.map(l+u.nodeSize,1);return t.step(new Mi(E,C,E+1,C-1,new pt(je.from(i.create(g,null,u.marks)),0,0),1,!0)),b===!0&&m5(t,u,l,a),!1}})}function m5(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 g5(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):bw(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=gw(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):bw(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 k=g>0||g==0&&r?this.nodes[g].type:i&&g>=a?i.node(g-a).type:null;if(!k||k.name!=b&&!k.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 t5(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&mw.hasOwnProperty(i)&&n?(n.appendChild(e),e=n):i=="li"?n=e:i&&(n=null)}}function n5(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function _w(t){let e={};for(let n in t)e[n]=t[n];return e}function bw(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:k}=l.edge(g);if(b==e||a.indexOf(k)<0&&u(k))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=Dy(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++],k=this.serializeMark(b,u.isInline,n);k&&(a.push([b,r]),r.appendChild(k.dom),r=k.contentDOM||k.dom)}}r.appendChild(this.serializeNodeInner(u,n))}),i}serializeNodeInner(e,n){let{dom:i,contentDOM:r}=mf(Dy(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(Dy(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=xw(e.nodes);return n.text||(n.text=i=>i.text),n}static marksFromSchema(e){return xw(e.marks)}}function xw(t){let e={};for(let n in t){let i=t[n].spec.toDOM;i&&(e[n]=i)}return e}function Dy(t){return t.document||window.document}const vw=new WeakMap;function i5(t){let e=vw.get(t);return e===void 0&&vw.set(t,e=r5(t)),e}function r5(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=i5(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],k=1;if(b&&typeof b=="object"&&b.nodeType==null&&!Array.isArray(b)){k=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=k;E<e.length;E++){let C=e[E];if(C===0){if(E<e.length-1||E>k)throw new RangeError("Content hole must be the only child of its parent node");return{dom:g,contentDOM:g}}else{let{dom:I,contentDOM:D}=mf(t,C,n,i);if(g.appendChild(I),D){if(l)throw new RangeError("Multiple content holes");l=D}}}return{dom:g,contentDOM:l}}const ww=65535,kw=Math.pow(2,16);function o5(t,e){return t+e*kw}function Sw(t){return t&ww}function s5(t){return(t-(t&ww))/kw}const Ew=1,Cw=2,gf=4,Tw=8;class Oy{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&Tw)>0}get deletedBefore(){return(this.delInfo&(Ew|gf))>0}get deletedAfter(){return(this.delInfo&(Cw|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=Sw(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+s5(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],k=this.ranges[l+u],E=g+b;if(e<=E){let C=b?e==g?-1:e==E?1:n:n,I=g+r+(C<0?0:k);if(i)return I;let D=e==(n<0?g:E)?null:o5(l/3,e-g),R=e==g?Cw:e==E?Ew:gf;return(n<0?e!=g:e!=E)&&(R|=Tw),new Oy(I,R,D)}r+=k-b}return i?e+r:new Oy(e+r,0,null)}touches(e,n){let i=0,r=Sw(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],k=g+b;if(e<=k&&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],k=this.ranges[r+i];e(l,l+b,g,g+k),a+=k-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 Oy(e,r,null)}}const By=Object.create(null);class Qi{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=By[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 By)throw new RangeError("Duplicate use of step JSON ID "+e);return By[e]=n,n.prototype.jsonID=e,n}}class pi{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new pi(e,null)}static fail(e){return new pi(null,e)}static fromReplace(e,n,i,r){try{return pi.ok(e.replace(n,i,r))}catch(a){if(a instanceof af)return pi.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 je.fromArray(i)}class pa extends Qi{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 pt(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 pi.fromReplace(e,this.from,this.to,a)}invert(){return new is(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))}}Qi.jsonID("addMark",pa);class is extends Qi{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 pt(zy(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return pi.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 is(n.pos,i.pos,this.mark)}merge(e){return e instanceof is&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new is(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 is(n.from,n.to,e.markFromJSON(n.mark))}}Qi.jsonID("removeMark",is);class fa extends Qi{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return pi.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return pi.fromReplace(e,this.pos,this.pos+1,new pt(je.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))}}Qi.jsonID("addNodeMark",fa);class Dc extends Qi{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return pi.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return pi.fromReplace(e,this.pos,this.pos+1,new pt(je.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))}}Qi.jsonID("removeNodeMark",Dc);class Ti extends Qi{constructor(e,n,i,r=!1){super(),this.from=e,this.to=n,this.slice=i,this.structure=r}apply(e){return this.structure&&Ny(e,this.from,this.to)?pi.fail("Structure replace would overwrite content"):pi.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 Ti(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 Ti(n.pos,Math.max(n.pos,i.pos),this.slice)}merge(e){if(!(e instanceof Ti)||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?pt.empty:new pt(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ti(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?pt.empty:new pt(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ti(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 Ti(n.from,n.to,pt.fromJSON(e,n.slice),!!n.structure)}}Qi.jsonID("replace",Ti);class Mi extends Qi{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&&(Ny(e,this.from,this.gapFrom)||Ny(e,this.gapTo,this.to)))return pi.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return pi.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,n.content);return i?pi.fromReplace(e,this.from,this.to,i):pi.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 Mi(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 Mi(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 Mi(n.from,n.to,n.gapFrom,n.gapTo,pt.fromJSON(e,n.slice),n.insert,!!n.structure)}}Qi.jsonID("replaceAround",Mi);function Ny(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 a5(t,e,n,i){let r=[],a=[],u,l;t.doc.nodesBetween(e,n,(g,b,k)=>{if(!g.isInline)return;let E=g.marks;if(!i.isInSet(E)&&k.type.allowsMarkType(i.type)){let C=Math.max(b,e),I=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=I:r.push(u=new is(C,I,E[R])));l&&l.to==C?l.to=I:a.push(l=new pa(C,I,i))}}),r.forEach(g=>t.step(g)),a.forEach(g=>t.step(g))}function l5(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,k;for(;k=i.isInSet(b);)(g||(g=[])).push(k),b=k.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 k=0;k<g.length;k++){let E=g[k],C;for(let I=0;I<r.length;I++){let D=r[I];D.step==a-1&&E.eq(r[I].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 is(u.from,u.to,u.style)))}function Mw(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),k=l+b.nodeSize,E=i.matchType(b.type);if(!E)u.push(new Ti(l,k,pt.empty));else{i=E;for(let C=0;C<b.marks.length;C++)n.allowsMarkType(b.marks[C].type)||t.step(new is(l,k,b.marks[C]));if(r&&b.isText&&n.whitespace!="pre"){let C,I=/\r?\n|\r/g,D;for(;C=I.exec(b.text);)D||(D=new pt(je.from(n.schema.text(" ",n.allowedMarks(b.marks))),0,0)),u.push(new Ti(l+C.index,l+C.index+C[0].length,D))}}l=k}if(!i.validEnd){let g=i.fillBefore(je.empty,!0);t.replace(l,l,new pt(g,0,0))}for(let g=u.length-1;g>=0;g--)t.step(u[g])}function c5(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||!c5(r,a,u))break}return null}function u5(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,k=je.empty,E=0;for(let D=a,R=!1;D>n;D--)R||i.index(D)>0?(R=!0,k=je.from(i.node(D).copy(k)),E++):g--;let C=je.empty,I=0;for(let D=a,R=!1;D>n;D--)R||r.after(D+1)<r.end(D)?(R=!0,C=je.from(r.node(D).copy(C)),I++):b++;t.step(new Mi(g,b,u,l,new pt(k.append(C),E,I),k.size-E,!0))}function Ry(t,e,n=null,i=t){let r=h5(t,e),a=r&&d5(i,e);return a?r.map(Aw).concat({type:e,attrs:n}).concat(a.map(Aw)):null}function Aw(t){return{type:t,attrs:null}}function h5(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 d5(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 p5(t,e,n){let i=je.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=je.from(n[u].type.create(n[u].attrs,i))}let r=e.start,a=e.end;t.step(new Mi(r,a,r,a,new pt(i,0,0),n.length,!0))}function f5(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)&&y5(t.doc,t.mapping.slice(a).map(l),i)){let b=null;if(i.schema.linebreakReplacement){let I=i.whitespace=="pre",D=!!i.contentMatch.matchType(i.schema.linebreakReplacement);I&&!D?b=!1:!I&&D&&(b=!0)}b===!1&&g5(t,u,l,a),Mw(t,t.mapping.slice(a).map(l,1),i,void 0,b===null);let k=t.mapping.slice(a),E=k.map(l,1),C=k.map(l+u.nodeSize,1);return t.step(new Mi(E,C,E+1,C-1,new pt(je.from(i.create(g,null,u.marks)),0,0),1,!0)),b===!0&&m5(t,u,l,a),!1}})}function m5(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 g5(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 y5(t,e,n){let i=t.resolve(e),r=i.index();return i.parent.canReplaceWith(r,r+1,n)}function _5(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 Mi(e,e+a.nodeSize,e+1,e+a.nodeSize-1,new pt(je.from(u),0,0),1,!0))}function Bc(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,k=n-2;b>a;b--,k--){let E=r.node(b),C=r.index(b);if(E.type.spec.isolating)return!1;let I=E.content.cutByIndex(C,E.childCount),D=i&&i[k+1];D&&(I=I.replaceChild(0,D.type.create(D.attrs)));let R=i&&i[k]||E;if(!E.canReplace(C+1,E.childCount)||!R.type.validContent(I))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 b5(t,e,n=1,i){let r=t.doc.resolve(e),a=je.empty,u=je.empty;for(let l=r.depth,g=r.depth-n,b=n-1;l>g;l--,b--){a=je.from(r.node(l).copy(a));let k=i&&i[b];u=je.from(k?k.type.create(k.attrs,u):r.node(l).copy(u))}t.step(new Ti(e,e,new pt(a.append(u),n,n),!0))}function ma(t,e){let n=t.resolve(e),i=n.index();return Iw(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(i,i+1)}function Iw(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&&Iw(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 x5(t,e,n){let i=new Ti(e-n,e+n,pt.empty,!0);t.step(i)}function v5(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 Pw(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),k=!1;if(a==1)k=b.canReplace(g,g,r);else{let E=b.contentMatchAt(g).findWrapping(r.firstChild.type);k=E&&b.canReplaceWith(g,g,E[0])}if(k)return l==0?i.pos:l<0?i.before(u+1):i.after(u+1)}return null}function _f(t,e,n=e,i=pt.empty){if(e==n&&!i.size)return null;let r=t.resolve(e),a=t.resolve(n);return Dw(r,a,i)?new Ti(e,n,i):new w5(r,a,i).fit()}function Dw(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class w5{constructor(e,n,i){this.$from=e,this.$to=n,this.unplaced=i,this.frontier=[],this.placed=je.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=je.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 pt(a,u,l);return e>-1?new Mi(i.pos,e,this.$to.pos,this.$to.end(),g,n):g.size||i.pos!=this.$to.pos?new Ti(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=Ly(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],k,E=null;if(n==1&&(u?b.matchType(u.type)||(E=b.fillBefore(je.from(u),!1)):a&&g.compatibleContent(a.type)))return{sliceDepth:i,frontierDepth:l,parent:a,inject:E};if(n==2&&u&&(k=b.findWrapping(u.type)))return{sliceDepth:i,frontierDepth:l,parent:a,wrap:k};if(a&&b.matchType(a.type))break}}}openMore(){let{content:e,openStart:n,openEnd:i}=this.unplaced,r=Ly(e,n);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new pt(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=Ly(e,n);if(r.childCount<=1&&n>0){let a=e.size-n<=n+r.size;this.unplaced=new pt(kh(e,n-1,1),n-1,a?n-1:i)}else this.unplaced=new pt(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,k=[],{match:E,type:C}=this.frontier[n];if(r){for(let R=0;R<r.childCount;R++)k.push(r.child(R));E=E.matchFragment(r)}let I=l.size+e-(u.content.size-u.openEnd);for(;b<l.childCount;){let R=l.child(b),$=E.matchType(R.type);if(!$)break;b++,(b>1||g==0||R.content.size)&&(E=$,k.push(Ow(R.mark(C.allowedMarks(R.marks)),b==1?g:0,b==l.childCount?I:-1)))}let D=b==l.childCount;D||(I=-1),this.placed=Sh(this.placed,n,je.from(k)),this.frontier[n].match=E,D&&I<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let R=0,$=l;R<I;R++){let G=$.lastChild;this.frontier.push({type:G.type,match:G.contentMatchAt(G.childCount)}),$=G.content}this.unplaced=D?e==0?pt.empty:new pt(kh(u.content,e-1,1),e-1,I<0?u.openEnd:e-1):new pt(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||!Vy(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=Vy(e,n,r,i,a);if(u){for(let l=n-1;l>=0;l--){let{match:g,type:b}=this.frontier[l],k=Vy(e,l,b,g,!0);if(!k||k.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,je.from(e.create(n,i))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(je.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 Ly(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Ow(t,e,n){if(e<=0)return t;let i=t.content;return e>1&&(i=i.replaceChild(0,Ow(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(je.empty,!0)))),t.copy(i)}function Vy(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&&!k5(n,a.content,u)?l:null}function k5(t,e,n){for(let i=n;i<e.childCount;i++)if(!t.allowsMarks(e.child(i).marks))return!0;return!1}function S5(t){return t.spec.defining||t.spec.definingForContent}function E5(t,e,n,i){if(!i.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),a=t.doc.resolve(n);if(Dw(r,a,i))return t.step(new Ti(e,n,i));let u=zw(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,I=r.pos-1;C>0;C--,I--){let D=r.node(C).type.spec;if(D.defining||D.definingAsContext||D.isolating)break;u.indexOf(C)>-1?l=C:r.before(C)==I&&u.splice(1,0,-C)}let g=u.indexOf(l),b=[],k=i.openStart;for(let C=i.content,I=0;;I++){let D=C.firstChild;if(b.push(D),I==i.openStart)break;C=D.content}for(let C=k-1;C>=0;C--){let I=b[C],D=S5(I.type);if(D&&!I.sameMarkup(r.node(Math.abs(l)-1)))k=C;else if(D||!I.type.isTextblock)break}for(let C=i.openStart;C>=0;C--){let I=(C+k+1)%(i.openStart+1),D=b[I];if(D)for(let R=0;R<u.length;R++){let $=u[(R+g)%u.length],G=!0;$<0&&(G=!1,$=-$);let q=r.node($-1),se=r.index($-1);if(q.canReplaceWith(se,se,D.type,D.marks))return t.replace(r.before($),G?a.after($):n,new pt(Bw(i.content,0,i.openStart,I),I,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 I=u[C];I<0||(e=r.before(I),n=a.after(I))}}function Bw(t,e,n,i,r){if(e<n){let a=t.firstChild;t=t.replaceChild(0,a.copy(Bw(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(je.empty,!0))}return t}function C5(t,e,n,i){if(!i.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let r=v5(t.doc,e,i.type);r!=null&&(e=n=r)}t.replaceRange(e,n,new pt(je.from(i),0,0))}function T5(t,e,n){let i=t.doc.resolve(e),r=t.doc.resolve(n),a=zw(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 zw(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 zc extends Qi{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 pi.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 pi.fromReplace(e,this.pos,this.pos+1,new pt(je.from(r),0,n.isLeaf?0:1))}getMap(){return Gr.empty}invert(e){return new zc(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 zc(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 zc(n.pos,n.attr,n.value)}}Qi.jsonID("attr",zc);class Eh extends Qi{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 pi.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)}}Qi.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 M5{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=pt.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 pt(je.from(i),0,0))}delete(e,n){return this.replace(e,n,pt.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,i){return E5(this,e,n,i),this}replaceRangeWith(e,n,i){return C5(this,e,n,i),this}deleteRange(e,n){return T5(this,e,n),this}lift(e,n){return u5(this,e,n),this}join(e,n=1){return x5(this,e,n),this}wrap(e,n){return p5(this,e,n),this}setBlockType(e,n=e,i,r=null){return f5(this,e,n,i,r),this}setNodeMarkup(e,n,i=null,r){return _5(this,e,n,i,r),this}setNodeAttribute(e,n,i){return this.step(new zc(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 b5(this,e,n,i),this}addMark(e,n,i){return a5(this,e,n,i),this}removeMark(e,n,i){return l5(this,e,n,i),this}clearIncompatible(e,n,i){return Mw(this,e,n,i),this}}const Fy=Object.create(null);class Gt{constructor(e,n,i){this.$anchor=e,this.$head=n,this.ranges=i||[new A5(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=pt.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],k=e.mapping.slice(a);e.replaceRange(k.map(g.pos),k.map(b.pos),l?pt.empty:n),l==0&&Lw(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),k=g.map(l.pos);a?e.deleteRange(b,k):(e.replaceRangeWith(b,k,n),Lw(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 Fo(e.node(0))}static atStart(e){return Rc(e,e,0,0,1)||new Fo(e)}static atEnd(e){return Rc(e,e,e.content.size,e.childCount,-1)||new Fo(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let i=Fy[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 Fy)throw new RangeError("Duplicate use of selection JSON ID "+e);return Fy[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Vt.between(this.$anchor,this.$head).getBookmark()}}Gt.prototype.visible=!0;class A5{constructor(e,n){this.$from=e,this.$to=n}}let Nw=!1;function Rw(t){!Nw&&!t.parent.inlineContent&&(Nw=!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){Rw(e),Rw(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=pt.empty){if(super.replace(e,n),n==pt.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 Bt 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 Bt(a)}content(){return new pt(je.from(this.node),0,0)}eq(e){return e instanceof Bt&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new $y(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Bt(e.resolve(n.anchor))}static create(e,n){return new Bt(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Bt.prototype.visible=!1,Gt.jsonID("node",Bt);class $y{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:i}=e.mapResult(this.anchor);return n?new bf(i,i):new $y(i)}resolve(e){let n=e.resolve(this.anchor),i=n.nodeAfter;return i&&Bt.isSelectable(i)?new Bt(n):Gt.near(n)}}class Fo extends Gt{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=pt.empty){if(n==pt.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 Fo(e)}map(e){return new Fo(e)}eq(e){return e instanceof Fo}getBookmark(){return I5}}Gt.jsonID("all",Fo);const I5={map(){return this},resolve(t){return new Fo(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&&Bt.isSelectable(l))return Bt.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 Lw(t,e,n){let i=t.steps.length-1;if(i<e)return;let r=t.steps[i];if(!(r instanceof Ti||r instanceof Mi))return;let a=t.mapping.maps[i],u;a.forEach((l,g,b,k)=>{u==null&&(u=k)}),t.setSelection(Gt.near(t.doc.resolve(u),n))}const Vw=1,xf=2,Fw=4;class P5 extends M5{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|Vw)&~xf,this.storedMarks=null,this}get selectionSet(){return(this.updated&Vw)>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|=Fw,this}get scrolledIntoView(){return(this.updated&Fw)>0}}function $w(t,e){return!e||!t?t:t.bind(e)}class Ch{constructor(e,n,i){this.name=e,this.init=$w(n.init,i),this.apply=$w(n.apply,i)}}const D5=[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 jy{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=D5.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,k=g<n.length&&l.spec.appendTransaction.call(l,g?n.slice(g):n,b,i);if(k&&i.filterTransaction(k,u)){if(k.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(k),i=i.applyInner(k),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 P5(this)}static create(e){let n=new jy(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 jy(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 jy(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 jw(t,e,n){for(let i in t){let r=t[i];r instanceof Function?r=r.bind(e):i=="handleDOMEvents"&&(r=jw(r,e,{})),n[i]=r}return n}class $i{constructor(e){this.spec=e,this.props={},e.props&&jw(e.props,this,this.props),this.key=e.key?e.key.key:Uw("plugin")}getState(e){return e[this.key]}}const Uy=Object.create(null);function Uw(t){return t in Uy?t+"$"+ ++Uy[t]:(Uy[t]=0,t+"$")}class Ar{constructor(e="key"){this.key=Uw(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ji=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 Hy=null;const Bs=function(t,e,n){let i=Hy||(Hy=document.createRange());return i.setEnd(t,n??t.nodeValue.length),i.setStart(t,e||0),i},O5=function(){Hy=null},Cl=function(t,e,n,i){return n&&(Hw(t,e,n,i,-1)||Hw(t,e,n,i,1))},B5=/^(img|br|input|textarea|hr)$/i;function Hw(t,e,n,i,r){for(;;){if(t==n&&e==i)return!0;if(e==(r<0?0:yo(t))){let a=t.parentNode;if(!a||a.nodeType!=1||Mh(t)||B5.test(t.nodeName)||t.contentEditable=="false")return!1;e=ji(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?yo(t):0}else return!1}}function yo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function z5(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=yo(t)}else if(t.parentNode&&!Mh(t))e=ji(t),t=t.parentNode;else return null}}function N5(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=ji(t)+1,t=t.parentNode;else return null}}function R5(t,e,n){for(let i=e==0,r=e==yo(t);i||r;){if(t==n)return!0;let a=ji(t);if(t=t.parentNode,!t)return!1;i=i&&a==0,r=r&&a==yo(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 L5(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function V5(t,e,n){if(t.caretPositionFromPoint)try{let i=t.caretPositionFromPoint(e,n);if(i)return{node:i.offsetNode,offset:Math.min(yo(i.offsetNode),i.offset)}}catch{}if(t.caretRangeFromPoint){let i=t.caretRangeFromPoint(e,n);if(i)return{node:i.startContainer,offset:Math.min(yo(i.startContainer),i.startOffset)}}}const rs=typeof navigator<"u"?navigator:null,qw=typeof document<"u"?document:null,ga=rs&&rs.userAgent||"",qy=/Edge\/(\d+)/.exec(ga),Ww=/MSIE \d/.exec(ga),Wy=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ga),Ir=!!(Ww||Wy||qy),ya=Ww?document.documentMode:Wy?+Wy[1]:qy?+qy[1]:0,$o=!Ir&&/gecko\/(\d+)/i.test(ga);$o&&+(/Firefox\/(\d+)/.exec(ga)||[0,0])[1];const Gy=!Ir&&/Chrome\/(\d+)/.exec(ga),er=!!Gy,Gw=Gy?+Gy[1]:0,ur=!Ir&&!!rs&&/Apple Computer/.test(rs.vendor),Vc=ur&&(/Mobile\/\w+/.test(ga)||!!rs&&rs.maxTouchPoints>2),_o=Vc||(rs?/Mac/.test(rs.platform):!1),F5=rs?/Win/.test(rs.platform):!1,jo=/Android \d/.test(ga),Ah=!!qw&&"webkitFontSmoothing"in qw.documentElement.style,$5=Ah?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function j5(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 zs(t,e){return typeof t=="number"?t:t[e]}function U5(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 Zw(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?j5(a):U5(l),k=0,E=0;if(e.top<b.top+zs(i,"top")?E=-(b.top-e.top+zs(r,"top")):e.bottom>b.bottom-zs(i,"bottom")&&(E=e.bottom-e.top>b.bottom-b.top?e.top+zs(r,"top")-b.top:e.bottom-b.bottom+zs(r,"bottom")),e.left<b.left+zs(i,"left")?k=-(b.left-e.left+zs(r,"left")):e.right>b.right-zs(i,"right")&&(k=e.right-b.right+zs(r,"right")),k||E)if(g)a.defaultView.scrollBy(k,E);else{let C=l.scrollLeft,I=l.scrollTop;E&&(l.scrollTop+=E),k&&(l.scrollLeft+=k);let D=l.scrollLeft-C,R=l.scrollTop-I;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 H5(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:Yw(t.dom)}}function Yw(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 q5({refDOM:t,refTop:e,stack:n}){let i=t?t.getBoundingClientRect().top:0;Xw(n,i==0?0:i-e)}function Xw(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 W5(t){if(t.setActive)return t.setActive();if(Fc)return t.focus(Fc);let e=Yw(t);t.focus(Fc==null?{get preventScroll(){return Fc={preventScroll:!0},!0}}:void 0),Fc||(Fc=!1,Xw(e,0))}function Kw(t,e){let n,i=2e8,r,a=0,u=e.top,l=e.top,g,b;for(let k=t.firstChild,E=0;k;k=k.nextSibling,E++){let C;if(k.nodeType==1)C=k.getClientRects();else if(k.nodeType==3)C=Bs(k).getClientRects();else continue;for(let I=0;I<C.length;I++){let D=C[I];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=k,i=R,r=R&&n.nodeType==3?{left:D.right<e.left?D.right:D.left,top:e.top}:e,k.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=k,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?G5(n,r):!n||i&&n.nodeType==1?{node:t,offset:a}:Kw(n,r)}function G5(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&&Zy(e,a))return{node:t,offset:r+(e.left>=(a.left+a.right)/2?1:0)}}return{node:t,offset:0}}function Zy(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Z5(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Y5(t,e,n){let{node:i,offset:r}=Kw(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 X5(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 Jw(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(Zy(e,b))return Jw(u,e,b)}}if((a=(a+1)%i)==r)break}return t}function K5(t,e){let n=t.dom.ownerDocument,i,r=0,a=V5(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(!Zy(e,b)||(u=Jw(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=Z5(u,e),i){if($o&&i.nodeType==1&&(r=Math.min(r,i.childNodes.length),r<i.childNodes.length)){let k=i.childNodes[r],E;k.nodeName=="IMG"&&(E=k.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=X5(t,i,r,e))}l==null&&(l=Y5(t,u,e));let g=t.docView.nearestDesc(u,!0);return{pos:l,inside:g?g.posAtStart-g.border:-1}}function Qw(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(Qw(i))return i}return Array.prototype.find.call(n,Qw)||t.getBoundingClientRect()}const J5=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ek(t,e,n){let{node:i,offset:r,atom:a}=t.docView.domFromPos(e,n<0?-1:1),u=Ah||$o;if(i.nodeType==3)if(u&&(J5.test(i.nodeValue)||(n<0?!r:r==i.nodeValue.length))){let g=_a(Bs(i,r,r),n);if($o&&r&&/\s/.test(i.nodeValue[r-1])&&r<i.nodeValue.length){let b=_a(Bs(i,r-1,r-1),-1);if(b.top==g.top){let k=_a(Bs(i,r,r+1),-1);if(k.top!=g.top)return Ih(k,k.left<b.left)}}return g}else{let g=r,b=r,k=n<0?1:-1;return n<0&&!r?(b++,k=-1):n>=0&&r==i.nodeValue.length?(g--,k=1):n<0?g--:b++,Ih(_a(Bs(i,g,b),k),k<0)}if(!t.state.doc.resolve(e-(a||0)).parent.inlineContent){if(a==null&&r&&(n<0||r==yo(i))){let g=i.childNodes[r-1];if(g.nodeType==1)return Yy(g.getBoundingClientRect(),!1)}if(a==null&&r<yo(i)){let g=i.childNodes[r];if(g.nodeType==1)return Yy(g.getBoundingClientRect(),!0)}return Yy(i.getBoundingClientRect(),n>=0)}if(a==null&&r&&(n<0||r==yo(i))){let g=i.childNodes[r-1],b=g.nodeType==3?Bs(g,yo(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<yo(i)){let g=i.childNodes[r];for(;g.pmViewDesc&&g.pmViewDesc.ignoreForCoords;)g=g.nextSibling;let b=g?g.nodeType==3?Bs(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?Bs(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 Yy(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 tk(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 Q5(t,e,n){let i=e.selection,r=n=="up"?i.$from:i.$to;return tk(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=ek(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=Bs(l,0,l.nodeValue.length).getClientRects();else continue;for(let b=0;b<g.length;b++){let k=g[b];if(k.bottom>k.top+1&&(n=="up"?u.top-k.top>(k.bottom-u.top)*2:k.bottom-u.bottom>(u.bottom-k.top)*2))return!1}}return!0})}const eR=/[\u0590-\u08ac]/;function tR(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?!eR.test(i.parent.textContent)||!l.modify?n=="left"||n=="backward"?a:u:tk(t,e,()=>{let{focusNode:g,focusOffset:b,anchorNode:k,anchorOffset:E}=t.domSelectionRange(),C=l.caretBidiLevel;l.modify("move",n,"character");let I=i.depth?t.docView.domAfterPos(i.before()):t.dom,{focusNode:D,focusOffset:R}=t.domSelectionRange(),$=D&&!I.contains(D.nodeType==1?D:D.parentNode)||g==D&&b==R;try{l.collapse(k,E),g&&(g!=k||b!=E)&&l.extend&&l.extend(g,b)}catch{}return C!=null&&(l.caretBidiLevel=C),$}):i.pos==i.start()||i.pos==i.end()}let nk=null,ik=null,rk=!1;function nR(t,e,n){return nk==e&&ik==n?rk:(nk=e,ik=n,rk=n=="up"||n=="down"?Q5(t,e,n):tR(t,e,n))}const bo=0,ok=1,Ml=2,ss=3;class Ph{constructor(e,n,i,r){this.parent=e,this.children=n,this.dom=i,this.contentDOM=r,this.dirty=bo,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>ji(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 lk){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 sk&&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?ji(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?ji(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 k=u+g.border;if(e>=k&&n<=b-g.border&&g.node&&g.contentDOM&&this.contentDOM.contains(g.contentDOM))return g.parseRange(e,n,k);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=ji(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 k=l+1;k<this.children.length;k++){let E=this.children[k];if(E.size&&E.dom.parentNode==this.contentDOM&&!E.emptyChildAt(-1)){a=ji(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,I=0;C<this.children.length;C++){let D=this.children[C],R=I+D.size;if(a>I&&u<R)return D.setSelection(e-I-D.border,n-I-D.border,i,r);I=R}let l=this.domFromPos(e,e?-1:1),g=n==e?l:this.domFromPos(n,n?-1:1),b=i.getSelection(),k=!1;if(($o||ur)&&e==n){let{node:C,offset:I}=l;if(C.nodeType==3){if(k=!!(I&&C.nodeValue[I-1]==`
634
634
  `),k&&I==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:ji(R)+1});break}let $=D.pmViewDesc;if($&&$.node&&$.node.isBlock)break}}else{let D=C.childNodes[I-1];k=D&&(D.nodeName=="BR"||D.contentEditable=="false")}}if($o&&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||k&&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)&&!k){b.collapse(l.node,l.offset);try{e!=n&&b.extend(g.node,g.offset),E=!0}catch{}}if(!E){if(e>n){let I=l;l=g,g=I}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:ok,e==l&&n==g&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=ss:a.markDirty(e-l,n-l);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?Ml:ss}i=u}this.dirty=Ml}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let i=e==1?Ml:ok;n.dirty<i&&(n.dirty=i)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class sk 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==bo&&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 iR 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&ss||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ss&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=bo){let i=this.parent;for(;!i.node;)i=i.parent;i.dirty<this.dirty&&(i.dirty=this.dirty),this.dirty=bo}}slice(e,n,i){let r=Al.create(this.parent,this.mark,!0,i),a=this.children,u=this.size;n<u&&(a=Ky(a,n,u,i)),e>0&&(a=Ky(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),k=b&&b.dom,E=b&&b.contentDOM;if(n.isText){if(!k)k=document.createTextNode(n.text);else if(k.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else k||({dom:k,contentDOM:E}=El.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!E&&!n.isText&&k.nodeName!="BR"&&(k.hasAttribute("contenteditable")||(k.contentEditable="false"),n.type.spec.draggable&&(k.draggable=!0));let C=k;return k=hk(k,i,n),b?g=new rR(e,n,i,r,k,E||null,C,b,a,u+1):n.isText?new wf(e,n,i,r,k,C,a):new ba(e,n,i,r,k,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=()=>je.empty)}return e}matchesNode(e,n,i){return this.dirty==bo&&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 sR(this,u&&u.node,e);cR(this.node,this.innerDeco,(b,k,E)=>{b.spec.marks?g.syncToMarks(b.spec.marks,i,e):b.type.side>=0&&!E&&g.syncToMarks(k==this.node.childCount?Hn.none:this.node.child(k).marks,i,e),g.placeWidget(b,e,r)},(b,k,E,C)=>{g.syncToMarks(b.marks,i,e);let I;g.findNodeMatch(b,k,E,C)||l&&e.state.selection.from>r&&e.state.selection.to<r+b.nodeSize&&(I=g.findIndexWithChild(a.node))>-1&&g.updateNodeAt(b,k,E,I,e)||g.updateNextNode(b,k,E,e,C,r)||g.addNode(b,k,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),ck(this.contentDOM,this.children,e),Vc&&uR(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=hR(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 iR(this,a,n,r);e.input.compositionNodes.push(u),this.children=Ky(this.children,i,i+r.length,e,u)}update(e,n,i,r){return this.dirty==ss||!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=bo}updateOuterDeco(e){if(kf(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,i=this.dom;this.dom=uk(this.dom,this.nodeDOM,Xy(this.outerDeco,this.node,n),Xy(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 ak(t,e,n,i,r){hk(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==ss||this.dirty!=bo&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=bo||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=bo,!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=ss)}get domAtom(){return!1}isText(e){return this.node.text==e}}class lk extends Ph{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==bo&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class rR extends ba{constructor(e,n,i,r,a,u,l,g,b,k){super(e,n,i,r,a,u,l,b,k),this.spec=g}update(e,n,i,r){if(this.dirty==ss)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 ck(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=dk(i),r=!0;i=i.nextSibling}else r=!0,t.insertBefore(l,i);if(u instanceof Al){let g=i?i.previousSibling:t.lastChild;ck(u.contentDOM,u.children,n),i=g?g.nextSibling:t.firstChild}}for(;i;)i=dk(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 Xy(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 uk(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}oR(r,l||Il[0],u)}return r}function oR(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 hk(t,e,n){return uk(t,t,Il,Xy(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 dk(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class sR{constructor(e,n,i){this.lock=n,this.view=i,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=aR(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=bo,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==ss&&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 k=g.dom,E,C=this.isLocked(k)&&!(e.isText&&g.node&&g.node.isText&&g.nodeDOM.nodeValue==e.text&&g.dirty!=ss&&kf(n,g.outerDeco));if(!C&&g.update(e,n,i,r))return this.destroyBetween(this.index,l),g.dom!=k&&(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=bo),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 sk(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||er)&&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 lk(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 aR(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 lR(t,e){return t.type.side-e.type.side}function cR(t,e,n,i){let r=e.locals(t),a=0;if(r.length==0){for(let b=0;b<t.childCount;b++){let k=t.child(b);i(k,r,e.forChild(a,k),b),a+=k.nodeSize}return}let u=0,l=[],g=null;for(let b=0;;){let k,E;for(;u<r.length&&r[u].to==a;){let $=r[u++];$.widget&&(k?(E||(E=[k])).push($):k=$)}if(k)if(E){E.sort(lR);for(let $=0;$<E.length;$++)n(E[$],b,!!g)}else n(k,b,!!g);let C,I;if(g)I=-1,C=g,g=null;else if(b<t.childCount)I=b,C=t.child(b++);else break;for(let $=0;$<l.length;$++)l[$].to<=a&&l.splice($--,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 $=D;u<r.length&&r[u].from<$&&($=r[u].from);for(let G=0;G<l.length;G++)l[G].to<$&&($=l[G].to);$<D&&(g=C.cut($-a),C=C.cut(0,$-a),D=$,I=-1)}else for(;u<r.length&&r[u].to<D;)u++;let R=C.isInline&&!C.isLeaf?l.filter($=>!$.inline):l.slice();i(C,R,e.forChild(a,C),I),a=D}}function uR(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 hR(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 Ky(t,e,n,i,r){let a=[];for(let u=0,l=0;u<t.length;u++){let g=t[u],b=l,k=l+=g.size;b>=n||k<=e?a.push(g):(b<e&&a.push(g.slice(0,e-b,i)),r&&(a.push(r),r=void 0),k>n&&a.push(g.slice(n-b,g.size,i)))}return a}function Jy(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&&Bt.isSelectable(E)&&r.parent&&!(E.isInline&&R5(n.focusNode,n.focusOffset,r.dom))){let C=r.posBefore;b=new Bt(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 I=0;I<n.rangeCount;I++){let D=n.getRangeAt(I);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 k=i.resolve(g);if(!b){let E=e=="pointer"||t.state.selection.head<l.pos&&!a?1:-1;b=e0(t,k,l,E)}return b}function pk(t){return t.editable?t.hasFocus():xk(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Ns(t,e=!1){let n=t.state.selection;if(yk(t,n),!!pk(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&er){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)pR(t);else{let{anchor:i,head:r}=n,a,u;fk&&!(n instanceof Vt)&&(n.$from.parent.inlineContent||(a=mk(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(u=mk(t,n.to))),t.docView.setSelection(i,r,t.root,e),fk&&(a&&gk(a),u&&gk(u)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&dR(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const fk=ur||er&&Gw<63;function mk(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 Qy(r);if((!r||r.contentEditable=="false")&&(!a||a.contentEditable=="false")){if(r)return Qy(r);if(a)return Qy(a)}}function Qy(t){return t.contentEditable="true",ur&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function gk(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function dR(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(()=>{(!pk(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function pR(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,ji(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 yk(t,e){if(e instanceof Bt){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(_k(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else _k(t)}function _k(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function e0(t,e,n,i){return t.someProp("createSelectionBetween",r=>r(t,e,n))||Vt.between(e,n,i)}function bk(t){return t.editable&&!t.hasFocus()?!1:xk(t)}function xk(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 fR(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 t0(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 vk(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=t0(t.state,e);return r&&r instanceof Bt?xa(t,r):!1}else if(!(_o&&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?Bt.isSelectable(a)?xa(t,new Bt(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 Bt&&i.node.isInline)return xa(t,new Vt(e>0?i.$to:i.$from));{let r=t0(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?mR(t):gR(t)}function mR(t){let e=t.domSelectionRange(),n=e.focusNode,i=e.focusOffset;if(!n)return;let r,a,u=!1;for($o&&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(wk(n))break;{let l=n.previousSibling;for(;l&&Oh(l,-1);)r=n.parentNode,a=ji(l),l=l.previousSibling;if(l)n=l,i=Sf(n);else{if(n=n.parentNode,n==t.dom)break;i=0}}}u?n0(t,n,i):r&&n0(t,r,a)}function gR(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(wk(n))break;{let l=n.nextSibling;for(;l&&Oh(l,1);)a=l.parentNode,u=ji(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&&n0(t,a,u)}function wk(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function yR(t,e){for(;t&&e==t.childNodes.length&&!Mh(t);)e=ji(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 _R(t,e){for(;t&&!e&&!Mh(t);)e=ji(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 n0(t,e,n){if(e.nodeType!=3){let a,u;(u=yR(e,n))?(e=u,n=0):(a=_R(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&&Ns(t)},50)}function kk(t,e){let n=t.state.doc.resolve(e);if(!(er||F5)&&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 Sk(t,e,n){let i=t.state.selection;if(i instanceof Vt&&!i.empty||n.indexOf("s")>-1||_o&&n.indexOf("m")>-1)return!1;let{$from:r,$to:a}=i;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let u=t0(t.state,e);if(u&&u instanceof Bt)return xa(t,u)}if(!r.parent.inlineContent){let u=e<0?r:a,l=i instanceof Fo?Gt.near(u,e):Gt.findFrom(u,e);return l?xa(t,l):!1}return!1}function Ek(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 Ck(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function bR(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;Ck(t,i,"true"),setTimeout(()=>Ck(t,i,"false"),20)}return!1}function xR(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function vR(t,e){let n=e.keyCode,i=xR(e);if(n==8||_o&&n==72&&i=="c")return Ek(t,-1)||$c(t,-1);if(n==46&&!e.shiftKey||_o&&n==68&&i=="c")return Ek(t,1)||$c(t,1);if(n==13||n==27)return!0;if(n==37||_o&&n==66&&i=="c"){let r=n==37?kk(t,t.state.selection.from)=="ltr"?-1:1:-1;return vk(t,r,i)||$c(t,r)}else if(n==39||_o&&n==70&&i=="c"){let r=n==39?kk(t,t.state.selection.from)=="ltr"?1:-1:1;return vk(t,r,i)||$c(t,r)}else{if(n==38||_o&&n==80&&i=="c")return Sk(t,-1,i)||$c(t,-1);if(n==40||_o&&n==78&&i=="c")return bR(t)||Sk(t,1,i)||$c(t,1);if(i==(_o?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Tk(t,e){t.someProp("transformCopied",I=>{e=I(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 I=i.firstChild;n.push(I.type.name,I.attrs!=I.type.defaultAttrs?I.attrs:null),i=I.content}let u=t.someProp("clipboardSerializer")||El.fromSchema(t.state.schema),l=zk(),g=l.createElement("div");g.appendChild(u.serializeFragment(i,{document:l}));let b=g.firstChild,k,E=0;for(;b&&b.nodeType==1&&(k=Ok[b.nodeName.toLowerCase()]);){for(let I=k.length-1;I>=0;I--){let D=l.createElement(k[I]);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",I=>I(e,t))||e.content.textBetween(0,e.content.size,`
635
635
 
@@ -738,7 +738,7 @@ 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[I0({find:xF,type:this.type,getAttributes:t=>({language:t[1]})}),I0({find:vF,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new $i({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}}})]}}),wF=xo.create({name:"doc",topNode:!0,content:"block+"});function kF(t={}){return new $i({view(e){return new SF(e,t)}})}class SF{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 k=b.getBoundingClientRect(),E=l?k.bottom:k.top;l&&g&&(E=(E+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),i={left:k.left,right:k.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=Pw(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 EF=Ii.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[kF(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 pt.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 Y0(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!CF(e)||!TF(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&&!Bt.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 Y0{constructor(e){this.pos=e}map(e){return new Y0(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ri.valid(n)?new ri(n):Gt.near(n)}}function CF(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 TF(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 MF(){return new $i({props:{decorations:DF,createSelectionBetween(t,e,n){return e.pos==n.pos&&ri.valid(n)?new ri(n):null},handleClick:IF,handleKeyDown:AF,handleDOMEvents:{beforeinput:PF}}})}const AF=i2({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 IF(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&&Bt.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ri(i))),!0)}function PF(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=je.empty;for(let u=i.length-1;u>=0;u--)r=je.from(i[u].createAndFill(null,r));let a=t.state.tr.replace(n.pos,n.pos,new pt(r,0,0));return a.setSelection(Vt.near(a.doc.resolve(n.pos+1))),t.dispatch(a),!1}function DF(t){if(!(t.selection instanceof ri))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",fi.create(t.doc,[Zr.widget(t.selection.head,e,{key:"gapcursor"})])}const OF=Ii.create({name:"gapCursor",addProseMirrorPlugins(){return[MF()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=rn(wt(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),BF=xo.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:k})=>{if(k&&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()}}}),zF=xo.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=>I0({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Yf=200,Pi=function(){};Pi.prototype.append=function(e){return e.length?(e=Pi.from(e),!this.length&&e||e.length<Yf&&this.leafAppend(e)||this.length<Yf&&e.leafPrepend(this)||this.appendInner(e)):this},Pi.prototype.prepend=function(e){return e.length?Pi.from(e).append(this):this},Pi.prototype.appendInner=function(e){return new NF(this,e)},Pi.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Pi.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},Pi.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Pi.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)},Pi.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},Pi.from=function(e){return e instanceof Pi?e:e&&e.length?new _S(e):Pi.empty};var _S=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}(Pi);Pi.empty=new _S([]);var NF=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}(Pi);const RF=500;class Uo{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=[],k=[];return this.items.forEach((E,C)=>{if(!E.step){r||(r=this.remapping(i,C+1),a=r.maps.length),a--,k.push(E);return}if(r){k.push(new hs(E.map));let I=E.step.map(r.slice(a)),D;I&&u.maybeStep(I).doc&&(D=u.mapping.maps[u.mapping.maps.length-1],b.push(new hs(D,void 0,void 0,b.length+k.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 Uo(this.items.slice(0,i).append(k.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 k=0;k<e.steps.length;k++){let E=e.steps[k].invert(e.docs[k]),C=new hs(e.mapping.maps[k],E,n),I;(I=g&&g.merge(C))&&(C=I,k?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>VF&&(l=LF(l,b),u-=b),new Uo(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 Uo(this.items.append(e.map(n=>new hs(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 I=a.getMirror(--g);if(I==null)return;u=Math.min(u,I);let D=a.maps[I];if(C.step){let R=e.steps[I].invert(e.docs[I]),$=C.selection&&C.selection.map(a.slice(g+1,I));$&&l++,i.push(new hs(D,R,$))}else i.push(new hs(D))},r);let b=[];for(let C=n;C<u;C++)b.push(new hs(a.maps[C]));let k=this.items.slice(0,r).append(b).append(i),E=new Uo(k,l);return E.emptyItemCount()>RF&&(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 k=u.selection&&u.selection.map(n.slice(i));k&&a++;let E=new hs(b.invert(),g,k),C,I=r.length-1;(C=r.length&&r[I].merge(E))?r[I]=C:r.push(E)}}else u.map&&i--},this.items.length,0),new Uo(Pi.from(r.reverse()),a)}}Uo.empty=new Uo(Pi.empty,0);function LF(t,e){let n;return t.forEach((i,r)=>{if(i.selection&&e--==0)return n=r,!1}),t.slice(n)}class hs{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 hs(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 VF=20;function FF(t,e,n,i){let r=n.getMeta(Rl),a;if(r)return r.historyState;n.getMeta(UF)&&(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,bS(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||!$F(n,t.prevRanges)),b=u?X0(t.prevRanges,n.mapping):bS(n.mapping.maps);return new Ta(t.done.addTransform(n,g?e.selection.getBookmark():void 0,i,Xf(e)),Uo.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),X0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ta(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),X0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function $F(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 bS(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 X0(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 jF(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 K0=!1,xS=null;function Xf(t){let e=t.plugins;if(xS!=e){K0=!1,xS=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){K0=!0;break}}return K0}const Rl=new Ar("history"),UF=new Ar("closeHistory");function HF(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new $i({key:Rl,state:{init(){return new Ta(Uo.empty,Uo.empty,null,0,-1)},apply(e,n,i){return FF(n,i,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let i=n.inputType,r=i=="historyUndo"?wS:i=="historyRedo"?kS:null;return r?(n.preventDefault(),r(e.state,e.dispatch)):!1}}}})}function vS(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=jF(r,n,t);a&&i(e?a.scrollIntoView():a)}return!0}}const wS=vS(!1,!0),kS=vS(!0,!0),qF=Ii.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>wS(t,e),redo:()=>({state:t,dispatch:e})=>kS(t,e)}},addProseMirrorPlugins(){return[HF(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()}}}),WF=xo.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}):S2(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,k=b.end();if(b.nodeAfter)b.nodeAfter.isTextblock?u.setSelection(Vt.create(u.doc,b.pos+1)):b.nodeAfter.isBlock?u.setSelection(Bt.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(k,E),u.setSelection(Vt.create(u.doc,k+1)))}u.scrollIntoView()}return!0}).run()}}},addInputRules(){return[S4({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),GF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,ZF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,YF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,XF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,KF=as.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:GF,type:this.type}),Wc({find:YF,type:this.type})]},addPasteRules(){return[Gc({find:ZF,type:this.type}),Gc({find:XF,type:this.type})]}}),SS=/^(\d+)\.\s$/,JF=xo.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(Z0.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:SS,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:SS,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]}}),QF=xo.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()}}}),e6=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,t6=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,n6=as.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:e6,type:this.type})]},addPasteRules(){return[Gc({find:t6,type:this.type})]}}),ES=xo.create({name:"text",group:"inline"}),i6=Ii.create({name:"starterKit",addExtensions(){var t,e,n,i,r,a,u,l,g,b,k,E,C,I,D,R,$,G;const q=[];return this.options.bold!==!1&&q.push(mF.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&q.push(uF.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&q.push(gF.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&q.push(bF.configure((i=this.options)===null||i===void 0?void 0:i.code)),this.options.codeBlock!==!1&&q.push(yS.configure((r=this.options)===null||r===void 0?void 0:r.codeBlock)),this.options.document!==!1&&q.push(wF.configure((a=this.options)===null||a===void 0?void 0:a.document)),this.options.dropcursor!==!1&&q.push(EF.configure((u=this.options)===null||u===void 0?void 0:u.dropcursor)),this.options.gapcursor!==!1&&q.push(OF.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&q.push(BF.configure((g=this.options)===null||g===void 0?void 0:g.hardBreak)),this.options.heading!==!1&&q.push(zF.configure((b=this.options)===null||b===void 0?void 0:b.heading)),this.options.history!==!1&&q.push(qF.configure((k=this.options)===null||k===void 0?void 0:k.history)),this.options.horizontalRule!==!1&&q.push(WF.configure((E=this.options)===null||E===void 0?void 0:E.horizontalRule)),this.options.italic!==!1&&q.push(KF.configure((C=this.options)===null||C===void 0?void 0:C.italic)),this.options.listItem!==!1&&q.push(Z0.configure((I=this.options)===null||I===void 0?void 0:I.listItem)),this.options.orderedList!==!1&&q.push(JF.configure((D=this.options)===null||D===void 0?void 0:D.orderedList)),this.options.paragraph!==!1&&q.push(QF.configure((R=this.options)===null||R===void 0?void 0:R.paragraph)),this.options.strike!==!1&&q.push(n6.configure(($=this.options)===null||$===void 0?void 0:$.strike)),this.options.text!==!1&&q.push(ES.configure((G=this.options)===null||G===void 0?void 0:G.text)),q}}),r6=Ii.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 o6(t){var e;const{char:n,allowSpaces:i,allowedPrefixes:r,startOfLine:a,$position:u}=t,l=E4(n),g=new RegExp(`\\s${l}$`),b=a?"^":"",k=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,I=Array.from(E.matchAll(k)).pop();if(!I||I.input===void 0||I.index===void 0)return null;const D=I.input.slice(Math.max(0,I.index-1),I.index),R=new RegExp(`^[${r==null?void 0:r.join("")}\0]?$`).test(D);if(r!==null&&!R)return null;const $=C+I.index;let G=$+I[0].length;return i&&g.test(E.slice(G-1,G+1))&&(I[0]+=" ",G+=1),$<u.pos&&G>=u.pos?{range:{from:$,to:G},query:I[0].slice(n.length),text:I[0]}:null}const s6=new Ar("suggestion");function a6({pluginKey:t=s6,editor:e,char:n="@",allowSpaces:i=!1,allowedPrefixes:r=[" "],startOfLine:a=!1,decorationTag:u="span",decorationClass:l="suggestion",command:g=()=>null,items:b=()=>[],render:k=()=>({}),allow:E=()=>!0,findSuggestionMatch:C=o6}){let I;const D=k==null?void 0:k(),R=new $i({key:t,view(){return{update:async($,G)=>{var q,se,Q,Se,_e,Ce,Le;const Ie=(q=this.key)===null||q===void 0?void 0:q.getState(G),Ue=(se=this.key)===null||se===void 0?void 0:se.getState($.state),Je=Ie.active&&Ue.active&&Ie.range.from!==Ue.range.from,It=!Ie.active&&Ue.active,ot=Ie.active&&!Ue.active,zt=!It&&!ot&&Ie.query!==Ue.query,Xt=It||Je&&zt,on=zt||Je,$t=ot||Je&&zt;if(!Xt&&!on&&!$t)return;const Kt=$t&&!Xt?Ie:Ue,Cn=$.dom.querySelector(`[data-decoration-id="${Kt.decorationId}"]`);I={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=$.dom.querySelector(`[data-decoration-id="${vn}"]`);return(pn==null?void 0:pn.getBoundingClientRect())||null}:null},Xt&&((Q=D==null?void 0:D.onBeforeStart)===null||Q===void 0||Q.call(D,I)),on&&((Se=D==null?void 0:D.onBeforeUpdate)===null||Se===void 0||Se.call(D,I)),(on||Xt)&&(I.items=await b({editor:e,query:Kt.query})),$t&&((_e=D==null?void 0:D.onExit)===null||_e===void 0||_e.call(D,I)),on&&((Ce=D==null?void 0:D.onUpdate)===null||Ce===void 0||Ce.call(D,I)),Xt&&((Le=D==null?void 0:D.onStart)===null||Le===void 0||Le.call(D,I))},destroy:()=>{var $;I&&(($=D==null?void 0:D.onExit)===null||$===void 0||$.call(D,I))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply($,G,q,se){const{isEditable:Q}=e,{composing:Se}=e.view,{selection:_e}=$,{empty:Ce,from:Le}=_e,Ie={...G};if(Ie.composing=Se,Q&&(Ce||e.view.composing)){(Le<G.range.from||Le>G.range.to)&&!Se&&!G.composing&&(Ie.active=!1);const Ue=C({char:n,allowSpaces:i,allowedPrefixes:r,startOfLine:a,$position:_e.$from}),Je=`id_${Math.floor(Math.random()*4294967295)}`;Ue&&E({editor:e,state:se,range:Ue.range,isActive:G.active})?(Ie.active=!0,Ie.decorationId=G.decorationId?G.decorationId:Je,Ie.range=Ue.range,Ie.query=Ue.query,Ie.text=Ue.text):Ie.active=!1}else Ie.active=!1;return Ie.active||(Ie.decorationId=null,Ie.range={from:0,to:0},Ie.query=null,Ie.text=null),Ie}},props:{handleKeyDown($,G){var q;const{active:se,range:Q}=R.getState($.state);return se&&((q=D==null?void 0:D.onKeyDown)===null||q===void 0?void 0:q.call(D,{view:$,event:G,range:Q}))||!1},decorations($){const{active:G,range:q,decorationId:se}=R.getState($);return G?fi.create($.doc,[Zr.inline(q.from,q.to,{nodeName:u,class:l,"data-decoration-id":se})]):null}}});return R}const l6=new Ar("mention"),c6=xo.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:l6,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[a6({editor:this.editor,...this.options.suggestion})]}}),u6=as.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()}}}),h6={props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function d6(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 p6=$e(h6,[["render",d6]]),f6={props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function m6(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 g6=$e(f6,[["render",m6]]),y6={props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function _6(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 b6=$e(y6,[["render",_6]]),x6={props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function v6(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 w6=$e(x6,[["render",v6]]),k6={props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.chain().toggleBold().run()}}};function S6(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 E6=$e(k6,[["render",S6]]),C6={props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function T6(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 M6=$e(C6,[["render",T6]]),A6={},I6={"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"};function P6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",I6,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 D6={components:{IconA:$e(A6,[["render",P6]])},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)}}},O6={class:"relative flex"},B6={class:"flex w-[160px] flex-wrap gap-[4px]"},z6=["onClick"];function N6(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",O6,[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",B6,[(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,z6))),128))])])]),_:1},512)}const R6=$e(D6,[["render",N6]]),L6={},V6={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 F6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",V6,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 CS=$e(L6,[["render",F6]]),$6={components:{IconMore:CS},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 j6(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 U6={bold:E6,italic:M6,text_more:$e($6,[["render",j6]]),color:R6,bullet_list:g6,ordered_list:b6,blockquote:p6,codeblock:w6},H6={components:{EditorContent:lF},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(U6).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 aF({content:this.modelValue,extensions:[i6,yS,Yh,r6,u6,ES,c6.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()}}},q6={class:"w-full border border-gray-200 rounded-lg editor-container bg-gray-50 dark:bg-gray-700 dark:border-gray-600"},W6={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 G6(t,e,n,i,r,a){const u=f.resolveComponent("EditorContent");return f.openBlock(),f.createElementBlock("div",q6,[r.editor?(f.openBlock(),f.createElementBlock("div",W6,[(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 TS=$e(H6,[["render",G6]]),Z6=t=>{const e=/(\b\S)?/g,n=t.match(e);return n?n.join("").toUpperCase():""},Y6={props:{name:{type:String,default(){return""}},avatar:{type:String,default(){return""}}},computed:{inItials(){return Z6(this.name)}}},X6={class:"mr-2"},K6=["src"],J6={key:1,class:"flex flex-shrink-0 items-center justify-center w-6 h-6 bg-gray-500 text-xs text-white rounded-full"},Q6={key:0},e$={key:1,class:"text-sm"};function t$(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",X6,[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,K6)):n.name?(f.openBlock(),f.createElementBlock("div",J6,[a.inItials.length?(f.openBlock(),f.createElementBlock("span",Q6,f.toDisplayString(a.inItials),1)):(f.openBlock(),f.createElementBlock("span",e$,e[0]||(e[0]=[f.createElementVNode("i",{class:"ti ti-user"},null,-1)])))])):f.createCommentVNode("",!0)])}const n$={components:{VsWidgetCommentsAvatar:$e(Y6,[["render",t$]]),VsTextEditor:TS},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=ht(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 rt.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 rt.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}}},i$={class:"p-6 pl-1 text-base bg-white dark:bg-gray-900"},r$={class:"flex justify-between items-center mb-2"},o$={class:"flex items-center"},s$={class:"inline-flex items-center mr-3 text-sm text-gray-900 dark:text-white font-semibold"},a$={class:"text-sm text-gray-600 dark:text-gray-400"},l$={class:"flex flex-col items-center gap-[4px]"},c$=["innerHTML"],u$={class:"flex flex-col gap-[8px] text-sm font-medium text-gray-500"},h$={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function d$(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",i$,[f.createElementVNode("div",r$,[f.createElementVNode("div",o$,[f.createElementVNode("p",s$,[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",a$,[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",l$,[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]=(...k)=>a.openEditModal&&a.openEditModal(...k))}," Редагувати "),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]=k=>a.confirnDeleteComment())}," Видалити ")])]),_:1})]),f.createElementVNode("p",{class:"text-gray-500 dark:text-gray-400",innerHTML:n.comment.body},null,8,c$)]),f.createVNode(b,{visible:r.isOpen,"onUpdate:visible":e[5]||(e[5]=k=>r.isOpen=k),title:"Редагувати",size:"small"},{footer:f.withCtx(()=>[f.createElementVNode("div",h$,[f.createElementVNode("button",{onClick:e[3]||(e[3]=k=>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]=(...k)=>a.updateComment&&a.updateComment(...k)),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",u$,[e[7]||(e[7]=f.createTextVNode(" Коментар ")),f.createVNode(g,{modelValue:r.textareaValue,"onUpdate:modelValue":e[2]||(e[2]=k=>r.textareaValue=k),options:n.options},null,8,["modelValue","options"])])]),_:1},8,["visible"])],64)}const p$={components:{VsWidgetCommentsItem:$e(n$,[["render",d$]])},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 rt.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}}},f$={class:"flex flex-col"},m$={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"},g$={key:1},y$={class:"p-4"},_$={class:"mt-1 text-gray-500 dark:text-neutral-500"},b$={class:"mt-4 flex justify-end gap-x-3"};function x$(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",f$,[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",m$,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.comments,(k,E)=>(f.openBlock(),f.createBlock(l,{key:E,comment:k,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",g$,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]=k=>r.isModalVisible=k)},{default:f.withCtx(()=>[f.createElementVNode("div",y$,[f.createElementVNode("p",_$,f.toDisplayString(r.modal.message),1),f.createElementVNode("div",b$,[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]=(...k)=>r.modal.cancel&&r.modal.cancel(...k))},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]=(...k)=>r.modal.confirm&&r.modal.confirm(...k))},f.toDisplayString(r.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const v$=$e(p$,[["render",x$]]),w$={components:{VsTextEditor:TS},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 rt.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}}},k$={class:"flex flex-col items-start w-full widget-comment-form"},S$={class:"w-full mb-4 bg-white border-gray-200 dark:bg-gray-800 dark:border-gray-700"},E$={class:"flex"};function C$(t,e,n,i,r,a){const u=f.resolveComponent("VsTextEditor");return f.openBlock(),f.createElementBlock("div",k$,[f.createElementVNode("div",S$,[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",E$,[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 T$={components:{VsWidgetCommentsList:v$,VsWidgetCommentsAddForm:$e(w$,[["render",C$]])},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 rt.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"}}},M$={class:"w-full bg-white-200"};function A$(t,e,n,i,r,a){const u=f.resolveComponent("VsWidgetCommentsAddForm"),l=f.resolveComponent("VsWidgetCommentsList");return f.openBlock(),f.createElementBlock("div",M$,[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 MS=$e(T$,[["render",A$]]),AS=t=>new Date(t).toLocaleDateString("uk-UK",{day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric"}),I$=t=>new Date(t).toLocaleDateString("uk-UK",{day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric"}),P$=t=>{const e=/(\b\S)?/g,n=t.match(e);return n?n.join("").toUpperCase():""},D$=f.defineComponent({props:{username:{type:String,default:()=>""}},computed:{inItials(){return P$(this.username)}}}),O$={class:"flex flex-shrink-0 items-center justify-center w-8 h-8 bg-gray-500 text-xs text-white rounded-full"};function B$(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",O$,f.toDisplayString(t.inItials),1)}const z$=$e(D$,[["render",B$]]),J0={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)=>{J0.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)})}},N$={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 J0.promise("https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.js"),await J0.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)}}},R$={id:"map",style:{height:"9rem",width:"24rem"}};function L$(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",R$)}const V$=$e(N$,[["render",L$]]),F$=f.defineComponent({components:{VsWidgetHistoryItemAvatar:z$,VsWidgetHistoryItemMap:V$},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 I$(t.cdate)}}}),$$={class:"relative [&_p]:m-0"},j$={class:"flex items-center gap-3"},U$={class:"w-full flex justify-between"},H$={class:"text-gray-500"},q$={class:"text-gray-800 font-medium"},W$={class:"text-gray-500 text-sm"},G$={class:"mt-2 pl-10"},Z$={key:0},Y$={key:1,class:"flex items-center gap-2 text-gray-700 text-sm"},X$={class:"font-medium"},K$={class:"font-medium"};function J$(t,e,n,i,r,a){const u=f.resolveComponent("VsWidgetHistoryItemAvatar"),l=f.resolveComponent("VsWidgetHistoryItemMap");return f.openBlock(),f.createElementBlock("div",$$,[f.createElementVNode("div",j$,[f.createVNode(u,{username:t.item.username},null,8,["username"]),f.createElementVNode("div",U$,[f.createElementVNode("p",H$,[f.createElementVNode("span",q$,f.toDisplayString(t.item.username),1),e[0]||(e[0]=f.createTextVNode(" змінив данні: "))]),f.createElementVNode("p",W$,f.toDisplayString(t.getDate(t.item)),1)])]),f.createElementVNode("div",G$,[(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",Z$,[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",Y$,[f.createElementVNode("p",null,f.toDisplayString(`- ${t.getTitle(g)}:`),1),f.createElementVNode("p",X$,f.toDisplayString(t.getOldValue(g)),1),e[2]||(e[2]=f.createElementVNode("i",{class:"ti ti-arrow-right"},null,-1)),f.createElementVNode("p",K$,f.toDisplayString(t.getNewValue(g)),1)]))]))),128))])])}const Q$=$e(F$,[["render",J$]]),e8=f.defineComponent({components:{VsWidgetHistoryItem:Q$,VsEmptyWidget:qv},props:{id:{type:String,default:""},prefilledData:{type:Object,default:null}},data:()=>({history:{}}),computed:{createdDate(){return this.history.data?AS(this.history.data.cdate):""},lastEditDate(){return this.history.data?AS(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 rt.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)}}}),t8={class:"bg-white"},n8={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"},i8={key:1,class:"w-full h-[330px] flex items-center justify-center"};function r8(t,e,n,i,r,a){var l;const u=f.resolveComponent("VsWidgetHistoryItem");return f.openBlock(),f.createElementBlock("div",t8,[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",n8,[(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",i8," Історія відсутні "))])}const o8=$e(e8,[["render",r8]]),s8={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"},a8={class:"inline-block w-full align-middle"},l8={class:"min-w-full divide-y divide-gray-200 dark:divide-neutral-700"},c8={class:"dark:bg-neutral-700"},u8={class:"divide-y divide-gray-200 dark:divide-neutral-700"},h8={key:1,class:"divide-y divide-gray-200 dark:divide-neutral-700"},Kf=10,d8={"vs-widget-map":Z1,"vs-widget-gallery":zN,"vs-widget-comments":MS,"vs-widget-file":Gv,"vs-widget-history":o8,"vs-widget-table":{__name:"vs-widget-table",props:{data:Object,columns:Array,token:String},setup(t){const e=t,n=f.ref([]),i=f.ref(1),r=async()=>{var l,g;if((l=e.data)!=null&&l.tokens[e.token])try{const{data:b}=await rt.get(`/api/table-data/${(g=e.data)==null?void 0:g.tokens[e.token]}`);n.value=b.rows}catch(b){console.error("Ошибка при загрузке данных таблицы:",b)}},a=l=>{i.value=l},u=f.computed(()=>{const l=(i.value-1)*Kf;return n.value.slice(l,l+Kf)});return f.onMounted(()=>{r()}),(l,g)=>{var k,E,C;const b=f.resolveComponent("VsPagination");return f.openBlock(),f.createElementBlock("div",s8,[f.createElementVNode("div",a8,[f.createElementVNode("table",l8,[(k=t.columns)!=null&&k.length?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[f.createElementVNode("thead",c8,[f.createElementVNode("tr",null,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(t.columns,(I,D)=>(f.openBlock(),f.createElementBlock("th",{key:D,scope:"col",class:"px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase dark:text-neutral-400 min-w-[200px]"},f.toDisplayString(I.title),1))),128))])]),f.createElementVNode("tbody",u8,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(u.value,(I,D)=>(f.openBlock(),f.createElementBlock("tr",{key:D},[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(t.columns,(R,$)=>(f.openBlock(),f.createElementBlock("td",{key:$,class:"px-6 py-4 text-sm font-medium text-gray-800 dark:text-neutral-200"},f.toDisplayString(I==null?void 0:I[R.name]),1))),128))]))),128))])],64)):(f.openBlock(),f.createElementBlock("tbody",h8,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(u.value,(I,D)=>(f.openBlock(),f.createElementBlock("tr",{key:D},[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(I,(R,$)=>(f.openBlock(),f.createElementBlock("td",{key:$,class:"px-6 py-4 text-sm font-medium text-gray-800 dark:text-neutral-200"},f.toDisplayString(R),1))),128))]))),128))]))])]),((E=n.value)==null?void 0:E.length)>Kf?(f.openBlock(),f.createBlock(b,{key:0,goTo:!1,"default-page":1,total:(C=n.value)==null?void 0:C.length,pageSize:Kf,onPageChange:a,backgroundColor:"#F3F4F6"},null,8,["total"])):f.createCommentVNode("",!0)])}}}},p8={"table-format-text":yp,"table-format-select":Ux,"table-format-badge":$x,"table-format-swetch":_p,"table-format-check":_p,"table-format-html":yp,"table-format-tags":Hx,"table-format-date":ay,"table-format-number":j1,"table-format-slot":U1},f8={style:{width:"calc(100vw - 300px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 flex items-center justify-center"},m8={__name:"vs-dashboard",setup(t){return(e,n)=>(f.openBlock(),f.createElementBlock("div",f8,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)])))}},g8={methods:{notify(){this.$notify({type:"error",title:"Тестова нотифікація",text:"Нотифікація для показу функціонала"})}}};function y8(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",{onClick:e[0]||(e[0]=(...u)=>a.notify&&a.notify(...u)),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"}," Custom component ")}const _8=$e(g8,[["render",y8]]),b8={props:{item:{type:Object},actionsLength:{type:Number}},data(){return{toggletMap:{}}},methods:{toggleHandler(t){this.toggletMap[t]=!this.toggletMap[t],this.$emit("on:toggled",{optionID:t,toggled:this.toggletMap[t]})}}},x8={class:"md:col-span-2"},v8={class:"font-semibold text-gray-800 dark:text-neutral-200"},w8={class:"md:block md:col-span-1 md:text-center"},k8=["onClick"];function S8(t,e,n,i,r,a){var u;return f.openBlock(),f.createElementBlock("ul",{class:f.normalizeClass(["grid md:gap-x-6 bg-gray-100 rounded-lg p-3 md:p-5 dark:bg-neutral-700",`grid-cols-${n.actionsLength+2}`])},[f.createElementVNode("li",x8,[f.createElementVNode("h3",v8,f.toDisplayString(n.item.ua),1)]),(u=n.item.menu)!=null&&u.length?(f.openBlock(!0),f.createElementBlock(f.Fragment,{key:0},f.renderList(n.actionsLength,l=>(f.openBlock(),f.createElementBlock("li",w8,[f.createElementVNode("button",{onClick:g=>a.toggleHandler(l),type:"button",class:"text-xs text-blue-600 decoration-2 hover:underline font-medium focus:outline-none focus:underline dark:text-blue-400 dark:hover:text-blue-500"}," Toggle all ",8,k8)]))),256)):f.createCommentVNode("",!0)],2)}const E8=$e(b8,[["render",S8]]),C8={props:{subitem:{type:Object},toggled:{type:Boolean},optionID:{type:Number},actions:{type:Array,default:()=>[]},routes:{type:Array}},data(){return{checkedInputMap:{}}},watch:{toggledAndOptionID:{handler([t,e]){this.updateCheckedInputs(t,e)},deep:!0,immediate:!0}},computed:{toggledAndOptionID(){return[this.toggled,this.optionID]}},methods:{updateCheckedInputs(){for(let t=1;t<=this.actions.length;t++)t===this.optionID&&(this.checkedInputMap[t]=this.toggled),t===this.optionID&&this.sendEmit(this.optionID)},inputHandler(t){this.checkedInputMap[t]=!this.checkedInputMap[t],this.sendEmit(t)},sendEmit(t){var e;this.$emit("on:checked",{subitemPath:(e=this.subitem)==null?void 0:e.path,checked:this.checkedInputMap[t],optionID:t-1})}},mounted(){var e;const t=(e=this.routes)==null?void 0:e.find(n=>n.path==this.subitem.path);if(t)for(let n=1;n<=this.actions.length;n++)t.actions.includes(this.actions[n])&&(this.checkedInputMap[n]=!0,this.sendEmit(n))}},T8={class:"md:col-span-2"},M8={class:"text-sm font-medium text-gray-800 dark:text-neutral-200"},A8={class:"text-sm text-gray-500 dark:text-neutral-500"},I8={class:"grid grid-cols-2 items-center md:block text-end md:text-center"},P8=["onInput","onUpdate:modelValue"];function D8(t,e,n,i,r,a){var u,l;return f.openBlock(),f.createElementBlock("ul",{class:f.normalizeClass(["grid md:items-center gap-1.5 md:gap-6 px-3 md:px-5 mt-3",`grid-cols-${n.actions.length+2}`])},[f.createElementVNode("li",T8,[f.createElementVNode("p",M8,f.toDisplayString(((u=n.subitem)==null?void 0:u.ua)||""),1),f.createElementVNode("p",A8,f.toDisplayString(((l=n.subitem)==null?void 0:l.path)||""),1)]),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.actions.length,g=>(f.openBlock(),f.createElementBlock("li",{class:"col-span-1",key:g},[f.createElementVNode("div",I8,[f.withDirectives(f.createElementVNode("input",{onInput:b=>a.inputHandler(g),type:"checkbox",class:"shrink-0 border-gray-300 rounded text-blue-600 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-600 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800","onUpdate:modelValue":b=>r.checkedInputMap[g]=b},null,40,P8),[[f.vModelCheckbox,r.checkedInputMap[g]]])])]))),128))],2)}const O8={props:{options:{type:String},routes:{type:Array,default:[]}},components:{VsGrouptFirstLevel:E8,VsGroupSecondLevel:$e(C8,[["render",D8]])},data(){return{list:[],history:this.routes,toggledInputs:!1}},methods:{async getData(){try{const t=await rt.get("/api/user-menu");this.list=t.data||{}}catch(t){console.error(t)}},toggleCheck(t,e){try{const n=this.options[t.optionID];this.list[e].menu.map(i=>(i.path==t.subitemPath&&(i[n]=t.checked),i)),this.pushToHistory()}catch(n){console.error(n)}},toggleAll(t,e){this.list[e].toggled=t.toggled,this.list[e].optionID=t.optionID},pushToHistory(){var t;try{this.history=[];const e=this.list.map(n=>{var i;return(i=n.menu)==null?void 0:i.filter(r=>this.options.some(a=>r[a])).map(r=>r.path)}).filter(n=>n&&n.length>0).flat();(t=this.list)==null||t.map(n=>{var i;(i=n.menu)==null||i.map(r=>{if(e.includes(r.path)){const a=this.options.filter(u=>r[u]);this.history.push({path:r.path,actions:a})}})}),this.$emit("on:change",this.history)}catch(e){console.error(e)}}},async mounted(){await this.getData()}},B8={class:"flex items-center justify-center"},z8={class:"p-5 md:p-8 bg-white border border-gray-200 shadow-sm rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},N8={class:"mt-2 text-sm font-medium text-gray-800 dark:text-neutral-200"},R8={class:"space-y-8"},L8={class:"space-y-5"};function V8(t,e,n,i,r,a){const u=f.resolveComponent("VsGrouptFirstLevel"),l=f.resolveComponent("VsGroupSecondLevel");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("div",B8,[f.createElementVNode("div",z8,[f.createElementVNode("div",{class:f.normalizeClass(["grid lg:gap-x-3 md:gap-x-6 p-3 md:p-5",`grid-cols-${n.options.length+2}`])},[e[0]||(e[0]=f.createElementVNode("div",{class:"col-span-2 self-center"},[f.createElementVNode("h2",{class:"font-semibold text-gray-800 dark:text-neutral-200"}," Групи ")],-1)),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.options,(g,b)=>(f.openBlock(),f.createElementBlock("div",{class:"col-span-1 text-center",key:b},[f.createElementVNode("h3",N8,f.toDisplayString(g),1)]))),128))],2),f.createElementVNode("div",R8,[f.createElementVNode("div",L8,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.list,(g,b)=>{var k;return f.openBlock(),f.createElementBlock("div",{key:b},[f.createVNode(u,{item:g,"onOn:toggled":E=>a.toggleAll(E,b),actionsLength:(k=n.options)==null?void 0:k.length},null,8,["item","onOn:toggled","actionsLength"]),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(g.menu,(E,C)=>(f.openBlock(),f.createBlock(l,{toggled:(g==null?void 0:g.toggled)||!1,optionID:g==null?void 0:g.optionID,key:C,subitem:E,actions:n.options,"onOn:checked":I=>a.toggleCheck(I,b),routes:n.routes},null,8,["toggled","optionID","subitem","actions","onOn:checked","routes"]))),128))])}),128))])])])]),f.createTextVNode(" "+f.toDisplayString(r.history),1)],64)}const F8=$e(O8,[["render",V8]]),$8={__name:"vs-group-interface-page",setup(t){const e=["view","add","edit","delete"],n=[{path:"rest_zone",actions:["view","add"]},{path:"itree.event_report",actions:["edit"]},{path:"itree.invent_street_furniture",actions:["edit","delete"]},{path:"itree.pictures",actions:["add"]},{path:"account_light2",actions:["view"]}];return(i,r)=>(f.openBlock(),f.createBlock(f.unref(F8),{options:e,routes:n}))}},j8={},U8={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 H8(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",U8,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 Q0=$e(j8,[["render",H8]]),q8={components:{IconSearch:Q0},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 rt.get("/api/user-cls?type=json");this.data=t}catch{}}}},W8={class:"w-[300px] border-r",style:{height:"calc(100vh - 60px)"}},G8={class:"relative"},Z8={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"},X8={class:"ml-auto text-[10px] h-[16px] px-[6px] flex items-center justify-center rounded-full bg-gray-200"};function K8(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",W8,[f.createElementVNode("div",G8,[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",Z8,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.rows,b=>{var k,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=(k=t.$route)==null?void 0:k.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",X8,f.toDisplayString((b==null?void 0:b.children)||0),1)]),_:2},1032,["to","class"])])}),128))])])}const J8=$e(q8,[["render",K8]]),Q8={props:{title:{type:String,default:()=>"Дані для відображення відсутні"},text:{type:String,default:()=>"Змініть параметри пошуку або спробуйте пізніше"}}},ej={class:"w-full"},tj={class:"p-5 min-h-[500px] flex flex-col justify-center items-center text-center"},nj={class:"max-w-sm mx-auto mt-6"},ij={class:"font-medium text-gray-800 dark:text-neutral-200"},rj={class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"};function oj(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",ej,[f.createElementVNode("div",tj,[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",nj,[f.createElementVNode("p",ij,f.toDisplayString(n.title),1),f.createElementVNode("p",rj,f.toDisplayString(n.text),1)])])])}const IS=$e(Q8,[["render",oj]]),sj={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()}}},aj={class:"flex w-[160px] flex-wrap gap-[4px]"},lj=["onClick"];function cj(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",aj,[(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,lj))),128))])])]),_:1},512)}const PS=$e(sj,[["render",cj]]),uj={components:{VsChoceColor:PS},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)}}},hj={class:"relative flex items-center p-3 bg-white border border-gray-200 group gap-x-3 rounded-xl"},dj={class:"flex flex-col"},pj={class:"flex gap-[30px]"},fj={class:"block text-sm font-semibold text-gray-800 text-start z-[10] cursor-pointer"},mj={class:"block text-sm font-semibold text-gray-400 text-start z-[10] cursor-pointer"},gj={class:"block text-xs text-gray-500 truncate dark:text-neutral-500"};function yj(t,e,n,i,r,a){var g;const u=f.resolveComponent("VsChoceColor"),l=f.resolveComponent("VsInlineEdit");return f.openBlock(),f.createElementBlock("div",hj,[f.createVNode(u,{modelValue:r.color,"onUpdate:modelValue":e[0]||(e[0]=b=>r.color=b)},null,8,["modelValue"]),f.createElementVNode("div",dj,[f.createElementVNode("div",pj,[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",fj,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",mj,f.toDisplayString(r.id),1)]),_:1},8,["modelValue"])]),f.createElementVNode("p",gj,f.toDisplayString((g=n.item)==null?void 0:g.parent),1)])])}const _j={components:{VsReesterUsersItem:$e(uj,[["render",yj]])},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)}}},bj={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)"}},xj=["onDragstart","onDrop"];function vj(t,e,n,i,r,a){const u=f.resolveComponent("VsReesterUsersItem");return f.openBlock(),f.createElementBlock("ul",bj,[(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,xj))),128))])}const wj={components:{VsNoData:IS,VsChoceColor:PS,IconCheck:jx,VsReesterUsersList:$e(_j,[["render",vj],["__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 rt.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 rt.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 rt.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)}}}},kj={class:"flex justify-center bg-gray-50",style:{height:"calc(100vh - 60px)",width:"calc(100vw - 560px)"}},Sj={key:0,class:"mt-[100px] p-[10px]",style:{"max-height":"calc(100vh - 300px)",width:"calc(100vw - 1000px)"}},Ej={class:"flex items-end w-full gap-[4px]"};function Cj(t,e,n,i,r,a){var E,C,I,D,R;const u=f.resolveComponent("VsForm"),l=f.resolveComponent("VsChoceColor"),g=f.resolveComponent("IconCheck"),b=f.resolveComponent("VsReesterUsersList"),k=f.resolveComponent("VsNoData");return f.openBlock(),f.createElementBlock("div",kj,[(C=(E=t.$route)==null?void 0:E.query)!=null&&C.name?(f.openBlock(),f.createElementBlock("div",Sj,[e[3]||(e[3]=f.createElementVNode("h2",{class:"font-bold mb-[10px]"},"Створити",-1)),f.createElementVNode("div",Ej,[r.formVisible?(f.openBlock(),f.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[0]||(e[0]=$=>r.formValues=$),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]=$=>r.color=$)},null,8,["modelValue"]),f.createElementVNode("button",{onClick:e[2]||(e[2]=(...$)=>a.addOneChild&&a.addOneChild(...$)),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=(I=r.data)==null?void 0:I.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(k,{key:1,class:"mt-[100px]",text:"Оберіть один з пунктів меню для відображення"}))])}const Tj={components:{VsReesterNavList:J8,VsReesterContent:$e(wj,[["render",Cj]])}},Mj={class:"flex items-start gap-0"};function Aj(t,e,n,i,r,a){const u=f.resolveComponent("VsReesterNavList"),l=f.resolveComponent("VsReesterContent");return f.openBlock(),f.createElementBlock("div",Mj,[f.createVNode(u),f.createVNode(l)])}const e_={...d8,...p8,"vs-dashboard":m8,"vs-custom-button":_8,"vs-group-interface":$8,...{"user-cls-page":$e(Tj,[["render",Aj]])}},DS=t=>{const e=[];return t.forEach(n=>{n.menu?e.push(...DS(n.menu)):e.push(n)}),e},So=f.ref(null),t_=f.ref(!1),OS={$form:({token:t,api:e,id:n,form:i})=>new Promise(r=>{var k,E;const{VsDialog:a,VsForm:u}=(E=(k=window.app)==null?void 0:k._context)==null?void 0:E.components,l=document.querySelector("#modal");if(!l){console.error('Modal root element with id "#modal" not found!');return}const g=document.createElement("div");l.appendChild(g);const b=f.createApp({components:{VsDialog:a,VsForm:u},data(){return{visible:!1,formValues:{},scheme:null}},methods:{close(C){this.visible=!1,this.$el.remove(),b.unmount(),r(C||"Success")},async getFormScheme(){try{if(t){const I=await rt.get(`/api/table/${t}`);this.formValues=I.data}const{data:C}=await rt.get(`/api/template/form/${t||i}`);this.scheme=(C==null?void 0:C.schema)||C}catch(C){console.error("Error fetching form scheme:",C)}finally{this.visible=!0}},async updateData(){const C=this.$refs.form;try{await C.doValidation();const{data:I}=await rt.put(`${e||"/api/table/"}${t||n}`,this.formValues);t_.value=!t_.value,this.visible=!1,this.close(I)}catch(I){console.error("Error updating data:",I)}}},mounted(){this.getFormScheme()},template:`
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:k})=>{if(k&&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()}}}),zF=xo.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=>I0({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Yf=200,Pi=function(){};Pi.prototype.append=function(e){return e.length?(e=Pi.from(e),!this.length&&e||e.length<Yf&&this.leafAppend(e)||this.length<Yf&&e.leafPrepend(this)||this.appendInner(e)):this},Pi.prototype.prepend=function(e){return e.length?Pi.from(e).append(this):this},Pi.prototype.appendInner=function(e){return new NF(this,e)},Pi.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Pi.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},Pi.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Pi.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)},Pi.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},Pi.from=function(e){return e instanceof Pi?e:e&&e.length?new _S(e):Pi.empty};var _S=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}(Pi);Pi.empty=new _S([]);var NF=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}(Pi);const RF=500;class Uo{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=[],k=[];return this.items.forEach((E,C)=>{if(!E.step){r||(r=this.remapping(i,C+1),a=r.maps.length),a--,k.push(E);return}if(r){k.push(new hs(E.map));let I=E.step.map(r.slice(a)),D;I&&u.maybeStep(I).doc&&(D=u.mapping.maps[u.mapping.maps.length-1],b.push(new hs(D,void 0,void 0,b.length+k.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 Uo(this.items.slice(0,i).append(k.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 k=0;k<e.steps.length;k++){let E=e.steps[k].invert(e.docs[k]),C=new hs(e.mapping.maps[k],E,n),I;(I=g&&g.merge(C))&&(C=I,k?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>VF&&(l=LF(l,b),u-=b),new Uo(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 Uo(this.items.append(e.map(n=>new hs(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 I=a.getMirror(--g);if(I==null)return;u=Math.min(u,I);let D=a.maps[I];if(C.step){let R=e.steps[I].invert(e.docs[I]),$=C.selection&&C.selection.map(a.slice(g+1,I));$&&l++,i.push(new hs(D,R,$))}else i.push(new hs(D))},r);let b=[];for(let C=n;C<u;C++)b.push(new hs(a.maps[C]));let k=this.items.slice(0,r).append(b).append(i),E=new Uo(k,l);return E.emptyItemCount()>RF&&(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 k=u.selection&&u.selection.map(n.slice(i));k&&a++;let E=new hs(b.invert(),g,k),C,I=r.length-1;(C=r.length&&r[I].merge(E))?r[I]=C:r.push(E)}}else u.map&&i--},this.items.length,0),new Uo(Pi.from(r.reverse()),a)}}Uo.empty=new Uo(Pi.empty,0);function LF(t,e){let n;return t.forEach((i,r)=>{if(i.selection&&e--==0)return n=r,!1}),t.slice(n)}class hs{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 hs(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 VF=20;function FF(t,e,n,i){let r=n.getMeta(Rl),a;if(r)return r.historyState;n.getMeta(UF)&&(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,bS(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||!$F(n,t.prevRanges)),b=u?X0(t.prevRanges,n.mapping):bS(n.mapping.maps);return new Ta(t.done.addTransform(n,g?e.selection.getBookmark():void 0,i,Xf(e)),Uo.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),X0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ta(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),X0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function $F(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 bS(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 X0(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 jF(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 K0=!1,xS=null;function Xf(t){let e=t.plugins;if(xS!=e){K0=!1,xS=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){K0=!0;break}}return K0}const Rl=new Ar("history"),UF=new Ar("closeHistory");function HF(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new $i({key:Rl,state:{init(){return new Ta(Uo.empty,Uo.empty,null,0,-1)},apply(e,n,i){return FF(n,i,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let i=n.inputType,r=i=="historyUndo"?wS:i=="historyRedo"?kS:null;return r?(n.preventDefault(),r(e.state,e.dispatch)):!1}}}})}function vS(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=jF(r,n,t);a&&i(e?a.scrollIntoView():a)}return!0}}const wS=vS(!1,!0),kS=vS(!0,!0),qF=Ii.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>wS(t,e),redo:()=>({state:t,dispatch:e})=>kS(t,e)}},addProseMirrorPlugins(){return[HF(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()}}}),WF=xo.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}):S2(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,k=b.end();if(b.nodeAfter)b.nodeAfter.isTextblock?u.setSelection(Vt.create(u.doc,b.pos+1)):b.nodeAfter.isBlock?u.setSelection(Bt.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(k,E),u.setSelection(Vt.create(u.doc,k+1)))}u.scrollIntoView()}return!0}).run()}}},addInputRules(){return[S4({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),GF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,ZF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,YF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,XF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,KF=as.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:GF,type:this.type}),Wc({find:YF,type:this.type})]},addPasteRules(){return[Gc({find:ZF,type:this.type}),Gc({find:XF,type:this.type})]}}),SS=/^(\d+)\.\s$/,JF=xo.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(Z0.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:SS,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:SS,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]}}),QF=xo.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()}}}),e6=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,t6=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,n6=as.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:e6,type:this.type})]},addPasteRules(){return[Gc({find:t6,type:this.type})]}}),ES=xo.create({name:"text",group:"inline"}),i6=Ii.create({name:"starterKit",addExtensions(){var t,e,n,i,r,a,u,l,g,b,k,E,C,I,D,R,$,G;const q=[];return this.options.bold!==!1&&q.push(mF.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&q.push(uF.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&q.push(gF.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&q.push(bF.configure((i=this.options)===null||i===void 0?void 0:i.code)),this.options.codeBlock!==!1&&q.push(yS.configure((r=this.options)===null||r===void 0?void 0:r.codeBlock)),this.options.document!==!1&&q.push(wF.configure((a=this.options)===null||a===void 0?void 0:a.document)),this.options.dropcursor!==!1&&q.push(EF.configure((u=this.options)===null||u===void 0?void 0:u.dropcursor)),this.options.gapcursor!==!1&&q.push(OF.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&q.push(BF.configure((g=this.options)===null||g===void 0?void 0:g.hardBreak)),this.options.heading!==!1&&q.push(zF.configure((b=this.options)===null||b===void 0?void 0:b.heading)),this.options.history!==!1&&q.push(qF.configure((k=this.options)===null||k===void 0?void 0:k.history)),this.options.horizontalRule!==!1&&q.push(WF.configure((E=this.options)===null||E===void 0?void 0:E.horizontalRule)),this.options.italic!==!1&&q.push(KF.configure((C=this.options)===null||C===void 0?void 0:C.italic)),this.options.listItem!==!1&&q.push(Z0.configure((I=this.options)===null||I===void 0?void 0:I.listItem)),this.options.orderedList!==!1&&q.push(JF.configure((D=this.options)===null||D===void 0?void 0:D.orderedList)),this.options.paragraph!==!1&&q.push(QF.configure((R=this.options)===null||R===void 0?void 0:R.paragraph)),this.options.strike!==!1&&q.push(n6.configure(($=this.options)===null||$===void 0?void 0:$.strike)),this.options.text!==!1&&q.push(ES.configure((G=this.options)===null||G===void 0?void 0:G.text)),q}}),r6=Ii.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 o6(t){var e;const{char:n,allowSpaces:i,allowedPrefixes:r,startOfLine:a,$position:u}=t,l=E4(n),g=new RegExp(`\\s${l}$`),b=a?"^":"",k=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,I=Array.from(E.matchAll(k)).pop();if(!I||I.input===void 0||I.index===void 0)return null;const D=I.input.slice(Math.max(0,I.index-1),I.index),R=new RegExp(`^[${r==null?void 0:r.join("")}\0]?$`).test(D);if(r!==null&&!R)return null;const $=C+I.index;let G=$+I[0].length;return i&&g.test(E.slice(G-1,G+1))&&(I[0]+=" ",G+=1),$<u.pos&&G>=u.pos?{range:{from:$,to:G},query:I[0].slice(n.length),text:I[0]}:null}const s6=new Ar("suggestion");function a6({pluginKey:t=s6,editor:e,char:n="@",allowSpaces:i=!1,allowedPrefixes:r=[" "],startOfLine:a=!1,decorationTag:u="span",decorationClass:l="suggestion",command:g=()=>null,items:b=()=>[],render:k=()=>({}),allow:E=()=>!0,findSuggestionMatch:C=o6}){let I;const D=k==null?void 0:k(),R=new $i({key:t,view(){return{update:async($,G)=>{var q,se,Q,Se,_e,Ce,Le;const Ie=(q=this.key)===null||q===void 0?void 0:q.getState(G),Ue=(se=this.key)===null||se===void 0?void 0:se.getState($.state),Je=Ie.active&&Ue.active&&Ie.range.from!==Ue.range.from,It=!Ie.active&&Ue.active,ot=Ie.active&&!Ue.active,zt=!It&&!ot&&Ie.query!==Ue.query,Xt=It||Je&&zt,on=zt||Je,$t=ot||Je&&zt;if(!Xt&&!on&&!$t)return;const Kt=$t&&!Xt?Ie:Ue,Cn=$.dom.querySelector(`[data-decoration-id="${Kt.decorationId}"]`);I={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=$.dom.querySelector(`[data-decoration-id="${vn}"]`);return(pn==null?void 0:pn.getBoundingClientRect())||null}:null},Xt&&((Q=D==null?void 0:D.onBeforeStart)===null||Q===void 0||Q.call(D,I)),on&&((Se=D==null?void 0:D.onBeforeUpdate)===null||Se===void 0||Se.call(D,I)),(on||Xt)&&(I.items=await b({editor:e,query:Kt.query})),$t&&((_e=D==null?void 0:D.onExit)===null||_e===void 0||_e.call(D,I)),on&&((Ce=D==null?void 0:D.onUpdate)===null||Ce===void 0||Ce.call(D,I)),Xt&&((Le=D==null?void 0:D.onStart)===null||Le===void 0||Le.call(D,I))},destroy:()=>{var $;I&&(($=D==null?void 0:D.onExit)===null||$===void 0||$.call(D,I))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply($,G,q,se){const{isEditable:Q}=e,{composing:Se}=e.view,{selection:_e}=$,{empty:Ce,from:Le}=_e,Ie={...G};if(Ie.composing=Se,Q&&(Ce||e.view.composing)){(Le<G.range.from||Le>G.range.to)&&!Se&&!G.composing&&(Ie.active=!1);const Ue=C({char:n,allowSpaces:i,allowedPrefixes:r,startOfLine:a,$position:_e.$from}),Je=`id_${Math.floor(Math.random()*4294967295)}`;Ue&&E({editor:e,state:se,range:Ue.range,isActive:G.active})?(Ie.active=!0,Ie.decorationId=G.decorationId?G.decorationId:Je,Ie.range=Ue.range,Ie.query=Ue.query,Ie.text=Ue.text):Ie.active=!1}else Ie.active=!1;return Ie.active||(Ie.decorationId=null,Ie.range={from:0,to:0},Ie.query=null,Ie.text=null),Ie}},props:{handleKeyDown($,G){var q;const{active:se,range:Q}=R.getState($.state);return se&&((q=D==null?void 0:D.onKeyDown)===null||q===void 0?void 0:q.call(D,{view:$,event:G,range:Q}))||!1},decorations($){const{active:G,range:q,decorationId:se}=R.getState($);return G?fi.create($.doc,[Zr.inline(q.from,q.to,{nodeName:u,class:l,"data-decoration-id":se})]):null}}});return R}const l6=new Ar("mention"),c6=xo.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:l6,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[a6({editor:this.editor,...this.options.suggestion})]}}),u6=as.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()}}}),h6={props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function d6(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 p6=$e(h6,[["render",d6]]),f6={props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function m6(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 g6=$e(f6,[["render",m6]]),y6={props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function _6(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 b6=$e(y6,[["render",_6]]),x6={props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function v6(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 w6=$e(x6,[["render",v6]]),k6={props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.chain().toggleBold().run()}}};function S6(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 E6=$e(k6,[["render",S6]]),C6={props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function T6(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 M6=$e(C6,[["render",T6]]),A6={},I6={"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"};function P6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",I6,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 D6={components:{IconA:$e(A6,[["render",P6]])},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)}}},O6={class:"relative flex"},B6={class:"flex w-[160px] flex-wrap gap-[4px]"},z6=["onClick"];function N6(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",O6,[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",B6,[(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,z6))),128))])])]),_:1},512)}const R6=$e(D6,[["render",N6]]),L6={},V6={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 F6(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",V6,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 CS=$e(L6,[["render",F6]]),$6={components:{IconMore:CS},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 j6(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 U6={bold:E6,italic:M6,text_more:$e($6,[["render",j6]]),color:R6,bullet_list:g6,ordered_list:b6,blockquote:p6,codeblock:w6},H6={components:{EditorContent:lF},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(U6).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 aF({content:this.modelValue,extensions:[i6,yS,Yh,r6,u6,ES,c6.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()}}},q6={class:"w-full border border-gray-200 rounded-lg editor-container bg-gray-50 dark:bg-gray-700 dark:border-gray-600"},W6={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 G6(t,e,n,i,r,a){const u=f.resolveComponent("EditorContent");return f.openBlock(),f.createElementBlock("div",q6,[r.editor?(f.openBlock(),f.createElementBlock("div",W6,[(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 TS=$e(H6,[["render",G6]]),Z6=t=>{const e=/(\b\S)?/g,n=t.match(e);return n?n.join("").toUpperCase():""},Y6={props:{name:{type:String,default(){return""}},avatar:{type:String,default(){return""}}},computed:{inItials(){return Z6(this.name)}}},X6={class:"mr-2"},K6=["src"],J6={key:1,class:"flex flex-shrink-0 items-center justify-center w-6 h-6 bg-gray-500 text-xs text-white rounded-full"},Q6={key:0},e$={key:1,class:"text-sm"};function t$(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",X6,[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,K6)):n.name?(f.openBlock(),f.createElementBlock("div",J6,[a.inItials.length?(f.openBlock(),f.createElementBlock("span",Q6,f.toDisplayString(a.inItials),1)):(f.openBlock(),f.createElementBlock("span",e$,e[0]||(e[0]=[f.createElementVNode("i",{class:"ti ti-user"},null,-1)])))])):f.createCommentVNode("",!0)])}const n$={components:{VsWidgetCommentsAvatar:$e(Y6,[["render",t$]]),VsTextEditor:TS},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=ht(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 rt.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 rt.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}}},i$={class:"p-6 pl-1 text-base bg-white dark:bg-gray-900"},r$={class:"flex justify-between items-center mb-2"},o$={class:"flex items-center"},s$={class:"inline-flex items-center mr-3 text-sm text-gray-900 dark:text-white font-semibold"},a$={class:"text-sm text-gray-600 dark:text-gray-400"},l$={class:"flex flex-col items-center gap-[4px]"},c$=["innerHTML"],u$={class:"flex flex-col gap-[8px] text-sm font-medium text-gray-500"},h$={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function d$(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",i$,[f.createElementVNode("div",r$,[f.createElementVNode("div",o$,[f.createElementVNode("p",s$,[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",a$,[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",l$,[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]=(...k)=>a.openEditModal&&a.openEditModal(...k))}," Редагувати "),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]=k=>a.confirnDeleteComment())}," Видалити ")])]),_:1})]),f.createElementVNode("p",{class:"text-gray-500 dark:text-gray-400",innerHTML:n.comment.body},null,8,c$)]),f.createVNode(b,{visible:r.isOpen,"onUpdate:visible":e[5]||(e[5]=k=>r.isOpen=k),title:"Редагувати",size:"small"},{footer:f.withCtx(()=>[f.createElementVNode("div",h$,[f.createElementVNode("button",{onClick:e[3]||(e[3]=k=>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]=(...k)=>a.updateComment&&a.updateComment(...k)),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",u$,[e[7]||(e[7]=f.createTextVNode(" Коментар ")),f.createVNode(g,{modelValue:r.textareaValue,"onUpdate:modelValue":e[2]||(e[2]=k=>r.textareaValue=k),options:n.options},null,8,["modelValue","options"])])]),_:1},8,["visible"])],64)}const p$={components:{VsWidgetCommentsItem:$e(n$,[["render",d$]])},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 rt.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}}},f$={class:"flex flex-col"},m$={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"},g$={key:1},y$={class:"p-4"},_$={class:"mt-1 text-gray-500 dark:text-neutral-500"},b$={class:"mt-4 flex justify-end gap-x-3"};function x$(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",f$,[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",m$,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.comments,(k,E)=>(f.openBlock(),f.createBlock(l,{key:E,comment:k,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",g$,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]=k=>r.isModalVisible=k)},{default:f.withCtx(()=>[f.createElementVNode("div",y$,[f.createElementVNode("p",_$,f.toDisplayString(r.modal.message),1),f.createElementVNode("div",b$,[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]=(...k)=>r.modal.cancel&&r.modal.cancel(...k))},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]=(...k)=>r.modal.confirm&&r.modal.confirm(...k))},f.toDisplayString(r.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const v$=$e(p$,[["render",x$]]),w$={components:{VsTextEditor:TS},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 rt.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}}},k$={class:"flex flex-col items-start w-full widget-comment-form"},S$={class:"w-full mb-4 bg-white border-gray-200 dark:bg-gray-800 dark:border-gray-700"},E$={class:"flex"};function C$(t,e,n,i,r,a){const u=f.resolveComponent("VsTextEditor");return f.openBlock(),f.createElementBlock("div",k$,[f.createElementVNode("div",S$,[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",E$,[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 T$={components:{VsWidgetCommentsList:v$,VsWidgetCommentsAddForm:$e(w$,[["render",C$]])},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 rt.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"}}},M$={class:"w-full bg-white-200"};function A$(t,e,n,i,r,a){const u=f.resolveComponent("VsWidgetCommentsAddForm"),l=f.resolveComponent("VsWidgetCommentsList");return f.openBlock(),f.createElementBlock("div",M$,[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 MS=$e(T$,[["render",A$]]),AS=t=>new Date(t).toLocaleDateString("uk-UK",{day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric"}),I$=t=>new Date(t).toLocaleDateString("uk-UK",{day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric"}),P$=t=>{const e=/(\b\S)?/g,n=t.match(e);return n?n.join("").toUpperCase():""},D$=f.defineComponent({props:{username:{type:String,default:()=>""}},computed:{inItials(){return P$(this.username)}}}),O$={class:"flex flex-shrink-0 items-center justify-center w-8 h-8 bg-gray-500 text-xs text-white rounded-full"};function B$(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",O$,f.toDisplayString(t.inItials),1)}const z$=$e(D$,[["render",B$]]),J0={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)=>{J0.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)})}},N$={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 J0.promise("https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.js"),await J0.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)}}},R$={id:"map",style:{height:"9rem",width:"24rem"}};function L$(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",R$)}const V$=$e(N$,[["render",L$]]),F$=f.defineComponent({components:{VsWidgetHistoryItemAvatar:z$,VsWidgetHistoryItemMap:V$},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 I$(t.cdate)}}}),$$={class:"relative [&_p]:m-0"},j$={class:"flex items-center gap-3"},U$={class:"w-full flex justify-between"},H$={class:"text-gray-500"},q$={class:"text-gray-800 font-medium"},W$={class:"text-gray-500 text-sm"},G$={class:"mt-2 pl-10"},Z$={key:0},Y$={key:1,class:"flex items-center gap-2 text-gray-700 text-sm"},X$={class:"font-medium"},K$={class:"font-medium"};function J$(t,e,n,i,r,a){const u=f.resolveComponent("VsWidgetHistoryItemAvatar"),l=f.resolveComponent("VsWidgetHistoryItemMap");return f.openBlock(),f.createElementBlock("div",$$,[f.createElementVNode("div",j$,[f.createVNode(u,{username:t.item.username},null,8,["username"]),f.createElementVNode("div",U$,[f.createElementVNode("p",H$,[f.createElementVNode("span",q$,f.toDisplayString(t.item.username),1),e[0]||(e[0]=f.createTextVNode(" змінив данні: "))]),f.createElementVNode("p",W$,f.toDisplayString(t.getDate(t.item)),1)])]),f.createElementVNode("div",G$,[(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",Z$,[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",Y$,[f.createElementVNode("p",null,f.toDisplayString(`- ${t.getTitle(g)}:`),1),f.createElementVNode("p",X$,f.toDisplayString(t.getOldValue(g)),1),e[2]||(e[2]=f.createElementVNode("i",{class:"ti ti-arrow-right"},null,-1)),f.createElementVNode("p",K$,f.toDisplayString(t.getNewValue(g)),1)]))]))),128))])])}const Q$=$e(F$,[["render",J$]]),e8=f.defineComponent({components:{VsWidgetHistoryItem:Q$,VsEmptyWidget:qv},props:{id:{type:String,default:""},prefilledData:{type:Object,default:null}},data:()=>({history:{}}),computed:{createdDate(){return this.history.data?AS(this.history.data.cdate):""},lastEditDate(){return this.history.data?AS(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 rt.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)}}}),t8={class:"bg-white"},n8={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"},i8={key:1,class:"w-full h-[330px] flex items-center justify-center"};function r8(t,e,n,i,r,a){var l;const u=f.resolveComponent("VsWidgetHistoryItem");return f.openBlock(),f.createElementBlock("div",t8,[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",n8,[(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",i8," Історія відсутні "))])}const o8=$e(e8,[["render",r8]]),s8={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"},a8={class:"inline-block w-full align-middle"},l8={class:"min-w-full divide-y divide-gray-200 dark:divide-neutral-700"},c8={class:"dark:bg-neutral-700"},u8={class:"divide-y divide-gray-200 dark:divide-neutral-700"},h8={key:1,class:"divide-y divide-gray-200 dark:divide-neutral-700"},Kf=10,d8={"vs-widget-map":Z1,"vs-widget-gallery":zN,"vs-widget-comments":MS,"vs-widget-file":Gv,"vs-widget-history":o8,"vs-widget-table":{__name:"vs-widget-table",props:{data:Object,columns:Array,token:String},setup(t){const e=t,n=f.ref([]),i=f.ref(1),r=async()=>{var l,g;if((l=e.data)!=null&&l.tokens[e.token])try{const{data:b}=await rt.get(`/api/table-data/${(g=e.data)==null?void 0:g.tokens[e.token]}`);n.value=b.rows}catch(b){console.error("Ошибка при загрузке данных таблицы:",b)}},a=l=>{i.value=l},u=f.computed(()=>{const l=(i.value-1)*Kf;return n.value.slice(l,l+Kf)});return f.onMounted(()=>{r()}),(l,g)=>{var k,E,C;const b=f.resolveComponent("VsPagination");return f.openBlock(),f.createElementBlock("div",s8,[f.createElementVNode("div",a8,[f.createElementVNode("table",l8,[(k=t.columns)!=null&&k.length?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[f.createElementVNode("thead",c8,[f.createElementVNode("tr",null,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(t.columns,(I,D)=>(f.openBlock(),f.createElementBlock("th",{key:D,scope:"col",class:"px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase dark:text-neutral-400 min-w-[200px]"},f.toDisplayString(I.title),1))),128))])]),f.createElementVNode("tbody",u8,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(u.value,(I,D)=>(f.openBlock(),f.createElementBlock("tr",{key:D},[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(t.columns,(R,$)=>(f.openBlock(),f.createElementBlock("td",{key:$,class:"px-6 py-4 text-sm font-medium text-gray-800 dark:text-neutral-200"},f.toDisplayString(I==null?void 0:I[R.name]),1))),128))]))),128))])],64)):(f.openBlock(),f.createElementBlock("tbody",h8,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(u.value,(I,D)=>(f.openBlock(),f.createElementBlock("tr",{key:D},[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(I,(R,$)=>(f.openBlock(),f.createElementBlock("td",{key:$,class:"px-6 py-4 text-sm font-medium text-gray-800 dark:text-neutral-200"},f.toDisplayString(R),1))),128))]))),128))]))])]),((E=n.value)==null?void 0:E.length)>Kf?(f.openBlock(),f.createBlock(b,{key:0,goTo:!1,"default-page":1,total:(C=n.value)==null?void 0:C.length,pageSize:Kf,onPageChange:a,backgroundColor:"#F3F4F6"},null,8,["total"])):f.createCommentVNode("",!0)])}}}},p8={"table-format-text":yp,"table-format-select":Ux,"table-format-badge":$x,"table-format-swetch":_p,"table-format-check":_p,"table-format-html":yp,"table-format-tags":Hx,"table-format-date":ay,"table-format-number":j1,"table-format-slot":U1},f8={style:{width:"calc(100vw - 300px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 flex items-center justify-center"},m8={__name:"vs-dashboard",setup(t){return(e,n)=>(f.openBlock(),f.createElementBlock("div",f8,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)])))}},g8={methods:{notify(){this.$notify({type:"error",title:"Тестова нотифікація",text:"Нотифікація для показу функціонала"})}}};function y8(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",{onClick:e[0]||(e[0]=(...u)=>a.notify&&a.notify(...u)),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"}," Custom component ")}const _8=$e(g8,[["render",y8]]),b8={props:{item:{type:Object},actionsLength:{type:Number}},data(){return{toggletMap:{}}},methods:{toggleHandler(t){this.toggletMap[t]=!this.toggletMap[t],this.$emit("on:toggled",{optionID:t,toggled:this.toggletMap[t]})}}},x8={class:"md:col-span-2"},v8={class:"font-semibold text-gray-800 dark:text-neutral-200"},w8={class:"md:block md:col-span-1 md:text-center"},k8=["onClick"];function S8(t,e,n,i,r,a){var u;return f.openBlock(),f.createElementBlock("ul",{class:f.normalizeClass(["grid md:gap-x-6 bg-gray-100 rounded-lg p-3 md:p-5 dark:bg-neutral-700",`grid-cols-${n.actionsLength+2}`])},[f.createElementVNode("li",x8,[f.createElementVNode("h3",v8,f.toDisplayString(n.item.ua),1)]),(u=n.item.menu)!=null&&u.length?(f.openBlock(!0),f.createElementBlock(f.Fragment,{key:0},f.renderList(n.actionsLength,l=>(f.openBlock(),f.createElementBlock("li",w8,[f.createElementVNode("button",{onClick:g=>a.toggleHandler(l),type:"button",class:"text-xs text-blue-600 decoration-2 hover:underline font-medium focus:outline-none focus:underline dark:text-blue-400 dark:hover:text-blue-500"}," Toggle all ",8,k8)]))),256)):f.createCommentVNode("",!0)],2)}const E8=$e(b8,[["render",S8]]),C8={props:{subitem:{type:Object},toggled:{type:Boolean},optionID:{type:Number},actions:{type:Array,default:()=>[]},routes:{type:Array}},data(){return{checkedInputMap:{}}},watch:{toggledAndOptionID:{handler([t,e]){this.updateCheckedInputs(t,e)},deep:!0,immediate:!0}},computed:{toggledAndOptionID(){return[this.toggled,this.optionID]}},methods:{updateCheckedInputs(){for(let t=1;t<=this.actions.length;t++)t===this.optionID&&(this.checkedInputMap[t]=this.toggled),t===this.optionID&&this.sendEmit(this.optionID)},inputHandler(t){this.checkedInputMap[t]=!this.checkedInputMap[t],this.sendEmit(t)},sendEmit(t){var e;this.$emit("on:checked",{subitemPath:(e=this.subitem)==null?void 0:e.path,checked:this.checkedInputMap[t],optionID:t-1})}},mounted(){var e;const t=(e=this.routes)==null?void 0:e.find(n=>n.path==this.subitem.path);if(t)for(let n=1;n<=this.actions.length;n++)t.actions.includes(this.actions[n])&&(this.checkedInputMap[n]=!0,this.sendEmit(n))}},T8={class:"md:col-span-2"},M8={class:"text-sm font-medium text-gray-800 dark:text-neutral-200"},A8={class:"text-sm text-gray-500 dark:text-neutral-500"},I8={class:"grid grid-cols-2 items-center md:block text-end md:text-center"},P8=["onInput","onUpdate:modelValue"];function D8(t,e,n,i,r,a){var u,l;return f.openBlock(),f.createElementBlock("ul",{class:f.normalizeClass(["grid md:items-center gap-1.5 md:gap-6 px-3 md:px-5 mt-3",`grid-cols-${n.actions.length+2}`])},[f.createElementVNode("li",T8,[f.createElementVNode("p",M8,f.toDisplayString(((u=n.subitem)==null?void 0:u.ua)||""),1),f.createElementVNode("p",A8,f.toDisplayString(((l=n.subitem)==null?void 0:l.path)||""),1)]),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.actions.length,g=>(f.openBlock(),f.createElementBlock("li",{class:"col-span-1",key:g},[f.createElementVNode("div",I8,[f.withDirectives(f.createElementVNode("input",{onInput:b=>a.inputHandler(g),type:"checkbox",class:"shrink-0 border-gray-300 rounded text-blue-600 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-600 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800","onUpdate:modelValue":b=>r.checkedInputMap[g]=b},null,40,P8),[[f.vModelCheckbox,r.checkedInputMap[g]]])])]))),128))],2)}const O8={props:{options:{type:String},routes:{type:Array,default:[]}},components:{VsGrouptFirstLevel:E8,VsGroupSecondLevel:$e(C8,[["render",D8]])},data(){return{list:[],history:this.routes,toggledInputs:!1}},methods:{async getData(){try{const t=await rt.get("/api/user-menu");this.list=t.data||{}}catch(t){console.error(t)}},toggleCheck(t,e){try{const n=this.options[t.optionID];this.list[e].menu.map(i=>(i.path==t.subitemPath&&(i[n]=t.checked),i)),this.pushToHistory()}catch(n){console.error(n)}},toggleAll(t,e){this.list[e].toggled=t.toggled,this.list[e].optionID=t.optionID},pushToHistory(){var t;try{this.history=[];const e=this.list.map(n=>{var i;return(i=n.menu)==null?void 0:i.filter(r=>this.options.some(a=>r[a])).map(r=>r.path)}).filter(n=>n&&n.length>0).flat();(t=this.list)==null||t.map(n=>{var i;(i=n.menu)==null||i.map(r=>{if(e.includes(r.path)){const a=this.options.filter(u=>r[u]);this.history.push({path:r.path,actions:a})}})}),this.$emit("on:change",this.history)}catch(e){console.error(e)}}},async mounted(){await this.getData()}},B8={class:"flex items-center justify-center"},z8={class:"p-5 md:p-8 bg-white border border-gray-200 shadow-sm rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},N8={class:"mt-2 text-sm font-medium text-gray-800 dark:text-neutral-200"},R8={class:"space-y-8"},L8={class:"space-y-5"};function V8(t,e,n,i,r,a){const u=f.resolveComponent("VsGrouptFirstLevel"),l=f.resolveComponent("VsGroupSecondLevel");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("div",B8,[f.createElementVNode("div",z8,[f.createElementVNode("div",{class:f.normalizeClass(["grid lg:gap-x-3 md:gap-x-6 p-3 md:p-5",`grid-cols-${n.options.length+2}`])},[e[0]||(e[0]=f.createElementVNode("div",{class:"col-span-2 self-center"},[f.createElementVNode("h2",{class:"font-semibold text-gray-800 dark:text-neutral-200"}," Групи ")],-1)),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.options,(g,b)=>(f.openBlock(),f.createElementBlock("div",{class:"col-span-1 text-center",key:b},[f.createElementVNode("h3",N8,f.toDisplayString(g),1)]))),128))],2),f.createElementVNode("div",R8,[f.createElementVNode("div",L8,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.list,(g,b)=>{var k;return f.openBlock(),f.createElementBlock("div",{key:b},[f.createVNode(u,{item:g,"onOn:toggled":E=>a.toggleAll(E,b),actionsLength:(k=n.options)==null?void 0:k.length},null,8,["item","onOn:toggled","actionsLength"]),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(g.menu,(E,C)=>(f.openBlock(),f.createBlock(l,{toggled:(g==null?void 0:g.toggled)||!1,optionID:g==null?void 0:g.optionID,key:C,subitem:E,actions:n.options,"onOn:checked":I=>a.toggleCheck(I,b),routes:n.routes},null,8,["toggled","optionID","subitem","actions","onOn:checked","routes"]))),128))])}),128))])])])]),f.createTextVNode(" "+f.toDisplayString(r.history),1)],64)}const F8=$e(O8,[["render",V8]]),$8={__name:"vs-group-interface-page",setup(t){const e=["view","add","edit","delete"],n=[{path:"rest_zone",actions:["view","add"]},{path:"itree.event_report",actions:["edit"]},{path:"itree.invent_street_furniture",actions:["edit","delete"]},{path:"itree.pictures",actions:["add"]},{path:"account_light2",actions:["view"]}];return(i,r)=>(f.openBlock(),f.createBlock(f.unref(F8),{options:e,routes:n}))}},j8={},U8={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 H8(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",U8,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 Q0=$e(j8,[["render",H8]]),q8={components:{IconSearch:Q0},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 rt.get("/api/user-cls?type=json");this.data=t}catch{}}}},W8={class:"w-[300px] border-r",style:{height:"calc(100vh - 60px)"}},G8={class:"relative"},Z8={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"},X8={class:"ml-auto text-[10px] h-[16px] px-[6px] flex items-center justify-center rounded-full bg-gray-200"};function K8(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",W8,[f.createElementVNode("div",G8,[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",Z8,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.rows,b=>{var k,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=(k=t.$route)==null?void 0:k.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",X8,f.toDisplayString((b==null?void 0:b.children)||0),1)]),_:2},1032,["to","class"])])}),128))])])}const J8=$e(q8,[["render",K8]]),Q8={props:{title:{type:String,default:()=>"Дані для відображення відсутні"},text:{type:String,default:()=>"Змініть параметри пошуку або спробуйте пізніше"}}},ej={class:"w-full"},tj={class:"p-5 min-h-[500px] flex flex-col justify-center items-center text-center"},nj={class:"max-w-sm mx-auto mt-6"},ij={class:"font-medium text-gray-800 dark:text-neutral-200"},rj={class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"};function oj(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",ej,[f.createElementVNode("div",tj,[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",nj,[f.createElementVNode("p",ij,f.toDisplayString(n.title),1),f.createElementVNode("p",rj,f.toDisplayString(n.text),1)])])])}const IS=$e(Q8,[["render",oj]]),sj={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()}}},aj={class:"flex w-[160px] flex-wrap gap-[4px]"},lj=["onClick"];function cj(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",aj,[(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,lj))),128))])])]),_:1},512)}const PS=$e(sj,[["render",cj]]),uj={components:{VsChoceColor:PS},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)}}},hj={class:"relative flex items-center p-3 bg-white border border-gray-200 group gap-x-3 rounded-xl"},dj={class:"flex flex-col"},pj={class:"flex gap-[30px]"},fj={class:"block text-sm font-semibold text-gray-800 text-start z-[10] cursor-pointer"},mj={class:"block text-sm font-semibold text-gray-400 text-start z-[10] cursor-pointer"},gj={class:"block text-xs text-gray-500 truncate dark:text-neutral-500"};function yj(t,e,n,i,r,a){var g;const u=f.resolveComponent("VsChoceColor"),l=f.resolveComponent("VsInlineEdit");return f.openBlock(),f.createElementBlock("div",hj,[f.createVNode(u,{modelValue:r.color,"onUpdate:modelValue":e[0]||(e[0]=b=>r.color=b)},null,8,["modelValue"]),f.createElementVNode("div",dj,[f.createElementVNode("div",pj,[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",fj,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",mj,f.toDisplayString(r.id),1)]),_:1},8,["modelValue"])]),f.createElementVNode("p",gj,f.toDisplayString((g=n.item)==null?void 0:g.parent),1)])])}const _j={components:{VsReesterUsersItem:$e(uj,[["render",yj]])},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)}}},bj={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)"}},xj=["onDragstart","onDrop"];function vj(t,e,n,i,r,a){const u=f.resolveComponent("VsReesterUsersItem");return f.openBlock(),f.createElementBlock("ul",bj,[(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,xj))),128))])}const wj={components:{VsNoData:IS,VsChoceColor:PS,IconCheck:jx,VsReesterUsersList:$e(_j,[["render",vj],["__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 rt.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 rt.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 rt.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)}}}},kj={class:"flex justify-center bg-gray-50",style:{height:"calc(100vh - 60px)",width:"calc(100vw - 560px)"}},Sj={key:0,class:"mt-[100px] p-[10px]",style:{"max-height":"calc(100vh - 300px)",width:"calc(100vw - 1000px)"}},Ej={class:"flex items-end w-full gap-[4px]"};function Cj(t,e,n,i,r,a){var E,C,I,D,R;const u=f.resolveComponent("VsForm"),l=f.resolveComponent("VsChoceColor"),g=f.resolveComponent("IconCheck"),b=f.resolveComponent("VsReesterUsersList"),k=f.resolveComponent("VsNoData");return f.openBlock(),f.createElementBlock("div",kj,[(C=(E=t.$route)==null?void 0:E.query)!=null&&C.name?(f.openBlock(),f.createElementBlock("div",Sj,[e[3]||(e[3]=f.createElementVNode("h2",{class:"font-bold mb-[10px]"},"Створити",-1)),f.createElementVNode("div",Ej,[r.formVisible?(f.openBlock(),f.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[0]||(e[0]=$=>r.formValues=$),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]=$=>r.color=$)},null,8,["modelValue"]),f.createElementVNode("button",{onClick:e[2]||(e[2]=(...$)=>a.addOneChild&&a.addOneChild(...$)),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=(I=r.data)==null?void 0:I.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(k,{key:1,class:"mt-[100px]",text:"Оберіть один з пунктів меню для відображення"}))])}const Tj={components:{VsReesterNavList:J8,VsReesterContent:$e(wj,[["render",Cj]])}},Mj={class:"flex items-start gap-0"};function Aj(t,e,n,i,r,a){const u=f.resolveComponent("VsReesterNavList"),l=f.resolveComponent("VsReesterContent");return f.openBlock(),f.createElementBlock("div",Mj,[f.createVNode(u),f.createVNode(l)])}const e_={...d8,...p8,"vs-dashboard":m8,"vs-custom-button":_8,"vs-group-interface":$8,...{"user-cls-page":$e(Tj,[["render",Aj]])}},DS=t=>{const e=[];return t.forEach(n=>{n.menu?e.push(...DS(n.menu)):e.push(n)}),e},So=f.ref(null),t_=f.ref(!1),OS={$form:({token:t,api:e,id:n,form:i})=>new Promise(r=>{var E,C,I,D;const{VsDialog:a,VsForm:u}=(C=(E=window.app)==null?void 0:E._context)==null?void 0:C.components,{$notify:l}=(D=(I=window.app)==null?void 0:I.config)==null?void 0:D.globalProperties,g=document.querySelector("#modal");if(!g){console.error('Modal root element with id "#modal" not found!');return}const b=document.createElement("div");g.appendChild(b);const k=f.createApp({components:{VsDialog:a,VsForm:u},data(){return{visible:!1,formValues:{},scheme:null}},methods:{close(R){this.visible=!1,this.$el.remove(),k.unmount(),r(R||"Success")},async getFormScheme(){try{if(t){const $=await rt.get(`/api/table/${t}`);this.formValues=$.data}const{data:R}=await rt.get(`/api/template/form/${t||i}`);this.scheme=(R==null?void 0:R.schema)||R}catch(R){console.error("Error fetching form scheme:",R)}finally{this.visible=!0}},async updateData(){const R=this.$refs.form;try{await R.doValidation();const{data:$}=await rt.put(`${e||"/api/table/"}${t||n}`,this.formValues);t_.value=!t_.value,this.visible=!1,this.close($),l({title:"Успішно!",type:"success",message:"Операція виконана успішно"})}catch{l({title:"Помилка!",type:"error",message:"Сталася помилка"})}}},mounted(){this.getFormScheme()},template:`
742
742
  <div style="position: relative; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000;">
743
743
  <VsDialog title="Редагувати" v-model:visible="visible">
744
744
  <VsForm ref="form" v-if="scheme" :scheme v-model="formValues" class="p-0"/>
@@ -756,7 +756,7 @@ img.ProseMirror-separator {
756
756
  </template>
757
757
  </VsDialog>
758
758
  </div>
759
- `});b.mount(g)}),$api:({api:t,confirm:e,method:n})=>new Promise(i=>{var g,b;const{VsDialog:r}=(b=(g=window.app)==null?void 0:g._context)==null?void 0:b.components,a=document.querySelector("#modal");if(!a){console.error('Modal root element with id "#modal" not found!');return}const u=document.createElement("div");a.appendChild(u);const l=f.createApp({components:{VsDialog:r},data(){return{visible:!1,getConfirm:e}},methods:{close(k){this.visible=!1,this.$el.remove(),l.unmount(),i(k||"Success")},async doRequest(){try{const{data:k}=await rt({url:t||"",method:n||"POST"});this.close(k)}catch(k){console.error("Error updating data:",k)}}},mounted(){e?this.visible=!0:this.doRequest()},template:`
759
+ `});k.mount(b)}),$api:({api:t,confirm:e,method:n})=>new Promise(i=>{var b,k,E,C;const{VsDialog:r}=(k=(b=window.app)==null?void 0:b._context)==null?void 0:k.components,{$notify:a}=(C=(E=window.app)==null?void 0:E.config)==null?void 0:C.globalProperties,u=document.querySelector("#modal");if(!u){console.error('Modal root element with id "#modal" not found!');return}const l=document.createElement("div");u.appendChild(l);const g=f.createApp({components:{VsDialog:r},data(){return{visible:!1,getConfirm:e}},methods:{close(I){this.visible=!1,this.$el.remove(),g.unmount(),i(I||"Success")},async doRequest(){try{const{data:I}=await rt({url:t||"",method:n||"POST"});this.close(I),a({title:"Успішно!",type:"success",message:"Операція виконана успішно"})}catch{a({title:"Помилка!",type:"error",message:"Сталася помилка"})}}},mounted(){e?this.visible=!0:this.doRequest()},template:`
760
760
  <div style="position: relative; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000;">
761
761
  <VsDialog v-model:visible="visible" size="small" :title="getConfirm?.title">
762
762
  <div class="p-4">
@@ -783,4 +783,4 @@ img.ProseMirror-separator {
783
783
  </div>
784
784
  </VsDialog>
785
785
  </div>
786
- `});l.mount(u)})},Ij=async()=>{try{const{data:t}=await rt.get("/api/user-menu");return So.value=t,DS(t)}catch(t){return console.error(t),[]}},Pj=(t,e)=>{Object.entries(e).forEach(([n,i])=>{t.component(n,i)})},Dj={async install(t,{componentsApp:e={},settings:n}){hl.value={...hl,...n};try{const r=(await Ij()).filter(u=>u==null?void 0:u.component).map(u=>({...u,component:{...e_,...e}[u==null?void 0:u.component]}));Pj(t,{...e_,...e}),t.component("admin",GT);const{router:a}=await AA(r);window.app={...t,router:a},window.v3plugin={...t.config.globalProperties,...OS},t.config.globalProperties={...t.config.globalProperties,$componentsConfig:{...wB,componentsApp:e},$router:a,$v3plugin:OS},t.use(a)}catch(i){console.error(i)}},components:e_},Oj={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(So.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 rt.get(`/api/template/table/${n}`),{data:u}=await rt.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 rt.get(`/api/template/form/${a}`);this.scheme=(l==null?void 0:l.schema)||l}catch{}},async onlyEditObject(){try{await this.$refs.form.doValidation(),await rt.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 rt.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"})}}}},Bj={style:{width:"calc(100vw - 260px)"},class:"bg-gray-50"},zj={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},Nj={class:"flex items-center gap-[6px]"},Rj={style:{height:"calc(100vh - 155px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},Lj={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 Vj(t,e,n,i,r,a){const u=f.resolveComponent("VsForm");return f.openBlock(),f.createElementBlock("div",Bj,[f.createElementVNode("div",zj,[e[4]||(e[4]=f.createElementVNode("h2",{class:"text-xl font-medium"},"Редагувати",-1)),f.createElementVNode("div",Nj,[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",Rj,[f.createElementVNode("div",Lj,[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 Fj=Object.freeze(Object.defineProperty({__proto__:null,default:$e(Oj,[["render",Vj]])},Symbol.toStringTag,{value:"Module"})),$j={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(So.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 rt.get(`/api/table-data/${n}`),{data:u}=await rt.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 rt.post(`/api/table/${this.token}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{let k=((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:k||"Сталася помилка валідаціі",type:"error"})}}}},jj={style:{width:"calc(100vw - 260px)"},class:"bg-gray-50"},Uj={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},Hj={class:"flex items-center gap-[6px]"},qj={style:{height:"calc(100vh - 165px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},Wj={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 Gj(t,e,n,i,r,a){const u=f.resolveComponent("VsForm");return f.openBlock(),f.createElementBlock("div",jj,[f.createElementVNode("div",Uj,[e[3]||(e[3]=f.createElementVNode("h2",{class:"text-xl font-medium"},"Створити",-1)),f.createElementVNode("div",Hj,[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",qj,[f.createElementVNode("div",Wj,[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 Zj=Object.freeze(Object.defineProperty({__proto__:null,default:$e($j,[["render",Gj]])},Symbol.toStringTag,{value:"Module"})),Yj={};function Xj(t,e,n,i,r,a){const u=f.resolveComponent("router-view");return f.openBlock(),f.createBlock(u)}const BS=Object.freeze(Object.defineProperty({__proto__:null,default:$e(Yj,[["render",Xj]])},Symbol.toStringTag,{value:"Module"})),Kj={class:"h-[76px] bg-white border rounded-xl flex items-center justify-start px-[20px] mb-[16px]"},Jj={class:"mr-[10px]"},Qj={class:"text-lg font-semibold md:text-xl text-stone-800 dark:text-neutral-200"},e7={class:"flex items-center gap-[6px] ml-auto"},t7={class:"mr-[10px]"},n7={components:{AdminCardHeader:{__name:"admin-card-header",props:{title:{type:String},getRoute:{type:String,required:!0},slots:{type:Object}},setup(t){var E,C,I,D,R;const{asyncTemplateSlot:e}=(R=(D=(I=(C=(E=f.getCurrentInstance())==null?void 0:E.appContext)==null?void 0:C.app)==null?void 0:I.config)==null?void 0:D.globalProperties)==null?void 0:R.utils,n=t,i=vA(),r=wA(),a=f.ref(""),u=f.ref(""),l=()=>{i.back()},g=f.computed(()=>{var $;return`/edit?table=${n.getRoute}&id=${($=r==null?void 0:r.params)==null?void 0:$.id}`}),b=()=>{var $,G,q,se;if(!(($=n.slots)!=null&&$.panelLeft))return"div";if((G=n.slots)!=null&&G.panelLeft.includes("<")){const Q=e("PanelLeft",(q=n.slots)==null?void 0:q.panelLeft,["name"]);u.value=Q}else u.value=(se=n.slots)==null?void 0:se.panelLeft},k=()=>{var $,G,q,se;if(!(($=n.slots)!=null&&$.panelRight))return"div";if((G=n.slots)!=null&&G.panelRight.includes("<")){const Q=e("PanelRight",(q=n.slots)==null?void 0:q.panelRight,["name"]);a.value=Q}else a.value=(se=n.slots)==null?void 0:se.panelRight};return b(),k(),($,G)=>{const q=f.resolveComponent("router-link");return f.openBlock(),f.createElementBlock("div",Kj,[f.createElementVNode("div",Jj,[f.createElementVNode("button",{onClick:l,class:"text-sm h-[20px] text-blue-600 font-medium hover:border-b-2 hover:border-b-blue-500"}," До таблиці "),f.createElementVNode("h2",Qj,f.toDisplayString(t.title),1)]),(f.openBlock(),f.createBlock(f.resolveDynamicComponent(u.value))),f.createElementVNode("div",e7,[f.createElementVNode("div",t7,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(a.value)))]),f.createVNode(q,{to:g.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(()=>G[0]||(G[0]=[f.createTextVNode(" Редагувати ")])),_:1},8,["to"])])])}}},AdminCardAsyncComponent:{__name:"admin-card-async-component",props:{slot:String,data:Object,objectData:Object},setup(t){var a,u,l,g,b;const{asyncTemplateSlot:e}=(b=(g=(l=(u=(a=f.getCurrentInstance())==null?void 0:a.appContext)==null?void 0:u.app)==null?void 0:l.config)==null?void 0:g.globalProperties)==null?void 0:b.utils,n=f.ref(""),i=t;return(()=>{const k=e("CustomComponent",i.slot,["data"]);n.value=k})(),(k,E)=>(f.openBlock(),f.createBlock(f.resolveDynamicComponent(n.value),{data:t.objectData},null,8,["data"]))}}},data(){return{objectData:null,component:""}},computed:{getRoute(){const t=this.flattenMenu(So.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,k,E,C,I,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:((I=(C=(E=(k=this.objectData)==null?void 0:k.rows)==null?void 0:E[0])==null?void 0:C.name)==null?void 0:I.slice(0,35))+" ...";{const R=(D=this.flattenMenu(So.value))==null?void 0:D.find($=>{var G,q;return($==null?void 0:$.table)===((q=(G=this.$route)==null?void 0:G.params)==null?void 0:q.table)});return R==null?void 0:R.ua}},reloadPageTrigger(){return t_.value}},async mounted(){await this.getObjectData(),await this.checkActiveComponent()},watch:{component(t){this.$router.replace({...this.$route,query:{tab:t}})},reloadPageTrigger(){this.getObjectData()}},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 rt.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(k=>(k==null?void 0:k.type)==="tabs"||(k==null?void 0:k.type)==="vertical-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}}},i7={style:{width:"calc(100vw - 260px)",height:"calc(100vh - 60px)"},class:"p-4 overflow-y-auto bg-gray-50"},r7={key:0,class:"bg-white border rounded-xl"},o7={class:"p-[10px] pl-[20px] text-md font-[500]"},s7=["innerHTML"],a7={key:1},l7={key:0,class:"p-[10px] pl-[20px] text-md font-[500]"},c7={key:2,class:"p-[20px] border-t"},u7=["innerHTML"],h7={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]"},d7=["onClick"],p7={key:0,class:"bg-white border border-t-0 rounded-bl-xl rounded-br-xl"},f7={key:0,class:"p-[20px] border-t"},m7={key:1,class:"p-[20px] border-t"},g7=["innerHTML"],y7={key:3,class:"flex"},_7={class:"flex flex-col space-y-2 max-w-[260px] w-full border rounded-xl mr-4 h-auto items-start pl-[10px] bg-white py-[20px]"},b7=["onClick"],x7={class:"flex-grow"},v7={key:0,class:"h-full bg-white border rounded-xl"},w7={key:0,class:"p-[20px]"},k7={key:1,class:"p-[20px] border-t"},S7=["innerHTML"];function E7(t,e,n,i,r,a){var g,b,k;const u=f.resolveComponent("AdminCardHeader"),l=f.resolveComponent("AdminCardAsyncComponent");return f.openBlock(),f.createElementBlock("div",i7,[r.objectData&&((g=r.objectData)==null?void 0:g.isHeader)!==!1?(f.openBlock(),f.createBlock(u,{key:0,title:a.getTitle,"get-route":a.getRoute,slots:(b=r.objectData)==null?void 0:b.slots},null,8,["title","get-route","slots"])):f.createCommentVNode("",!0),f.createElementVNode("div",{class:f.normalizeClass(["grid gap-[20px]",a.getGridClass()])},[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((k=r.objectData)==null?void 0:k.panels,(E,C)=>{var I,D,R,$,G;return f.openBlock(),f.createElementBlock("div",{key:C,class:f.normalizeClass(a.getColClass(E.col))},[E!=null&&E.name?(f.openBlock(),f.createElementBlock("div",r7,[f.createElementVNode("h2",o7,f.toDisplayString((E==null?void 0:E.title)||"Панель"),1),(I=r.objectData)!=null&&I.html[E==null?void 0:E.name]?(f.openBlock(),f.createElementBlock("div",{key:0,class:"p-[20px] border-t",innerHTML:(D=r.objectData)==null?void 0:D.html[E==null?void 0:E.name]},null,8,s7)):(f.openBlock(),f.createBlock(l,{key:1,slot:(R=r.objectData)==null?void 0:R.vue[E==null?void 0:E.name],data:(G=($=r.objectData)==null?void 0:$.rows)==null?void 0:G[0],objectData:r.objectData},null,8,["slot","data","objectData"]))])):E.type==="container"?(f.openBlock(),f.createElementBlock("div",a7,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(E.items,(q,se)=>{var Q,Se,_e,Ce,Le,Ie,Ue,Je,It,ot;return f.openBlock(),f.createElementBlock("div",{key:se,class:f.normalizeClass([{"mb-[20px]":E.items.length>1},"bg-white border rounded-xl"])},[q!=null&&q.title?(f.openBlock(),f.createElementBlock("h2",l7,f.toDisplayString((q==null?void 0:q.title)||"Панель"),1)):f.createCommentVNode("",!0),q!=null&&q.component?(f.openBlock(),f.createElementBlock("div",{key:1,class:f.normalizeClass(["p-[20px]",{"border-t":q==null?void 0:q.title}])},[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(q.component),{geometry:(Se=(Q=r.objectData)==null?void 0:Q.rows[0])==null?void 0:Se.geom,columns:q==null?void 0:q.columns,token:q==null?void 0:q.token,zoom:16,data:r.objectData,id:(Ce=(_e=t.$route)==null?void 0:_e.params)==null?void 0:Ce.id},null,8,["geometry","columns","token","data","id"]))],2)):f.createCommentVNode("",!0),q!=null&&q.name?(f.openBlock(),f.createElementBlock("div",c7,[(Ie=(Le=r.objectData)==null?void 0:Le.html)!=null&&Ie[q==null?void 0:q.name]?(f.openBlock(),f.createElementBlock("div",{key:0,innerHTML:(Ue=r.objectData)==null?void 0:Ue.html[q==null?void 0:q.name]},null,8,u7)):(f.openBlock(),f.createBlock(l,{key:1,slot:(Je=r.objectData)==null?void 0:Je.vue[q==null?void 0:q.name],data:(ot=(It=r.objectData)==null?void 0:It.rows)==null?void 0:ot[0],objectData:r.objectData},null,8,["slot","data","objectData"]))])):f.createCommentVNode("",!0)],2)}),128))])):f.createCommentVNode("",!0),(E==null?void 0:E.type)==="tabs"?(f.openBlock(),f.createElementBlock(f.Fragment,{key:2},[f.createElementVNode("nav",h7,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(E==null?void 0:E.items,q=>(f.openBlock(),f.createElementBlock("button",{key:(q==null?void 0:q.name)||(q==null?void 0:q.component),onClick:se=>r.component=(q==null?void 0:q.component)||(q==null?void 0:q.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===(q==null?void 0:q.component)||r.component===(q==null?void 0:q.name),"":r.component!==(q==null?void 0:q.component)&&r.component!==(q==null?void 0:q.name)}])},f.toDisplayString(q==null?void 0:q.title),11,d7))),128))]),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(E.items,(q,se)=>{var Q,Se,_e,Ce,Le,Ie,Ue,Je,It,ot;return f.openBlock(),f.createElementBlock(f.Fragment,{key:se},[r.component===(q==null?void 0:q.component)||r.component===(q==null?void 0:q.name)?(f.openBlock(),f.createElementBlock("div",p7,[q!=null&&q.component?(f.openBlock(),f.createElementBlock("div",f7,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(q.component),{data:r.objectData,token:q==null?void 0:q.token,columns:q==null?void 0:q.columns,geometry:(Se=(Q=r.objectData)==null?void 0:Q.rows[0])==null?void 0:Se.geom,zoom:16,id:(Ce=(_e=t.$route)==null?void 0:_e.params)==null?void 0:Ce.id},null,8,["data","token","columns","geometry","id"]))])):f.createCommentVNode("",!0),q!=null&&q.name?(f.openBlock(),f.createElementBlock("div",m7,[(Ie=(Le=r.objectData)==null?void 0:Le.html)!=null&&Ie[q==null?void 0:q.name]?(f.openBlock(),f.createElementBlock("div",{key:0,innerHTML:(Ue=r.objectData)==null?void 0:Ue.html[q==null?void 0:q.name]},null,8,g7)):(f.openBlock(),f.createBlock(l,{key:1,slot:(Je=r.objectData)==null?void 0:Je.vue[q==null?void 0:q.name],data:(ot=(It=r.objectData)==null?void 0:It.rows)==null?void 0:ot[0],objectData:r.objectData},null,8,["slot","data","objectData"]))])):f.createCommentVNode("",!0)])):f.createCommentVNode("",!0)],64)}),128))],64)):f.createCommentVNode("",!0),(E==null?void 0:E.type)==="vertical-tabs"?(f.openBlock(),f.createElementBlock("div",y7,[f.createElementVNode("nav",_7,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(E==null?void 0:E.items,q=>(f.openBlock(),f.createElementBlock("button",{key:(q==null?void 0:q.name)||(q==null?void 0:q.component),onClick:se=>r.component=(q==null?void 0:q.component)||(q==null?void 0:q.name),class:f.normalizeClass(["relative whitespace-pre-wrap text-left inline-flex items-center w-full py-1 text-sm border-transparent pe-4 gap-x-2 border-e-2 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===(q==null?void 0:q.component)||r.component===(q==null?void 0:q.name),"text-gray-500":r.component!==(q==null?void 0:q.component)&&r.component!==(q==null?void 0:q.name)}])},f.toDisplayString(q==null?void 0:q.title),11,b7))),128))]),f.createElementVNode("div",x7,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(E.items,(q,se)=>{var Q,Se,_e,Ce,Le,Ie,Ue,Je,It,ot;return f.openBlock(),f.createElementBlock(f.Fragment,{key:se},[r.component===(q==null?void 0:q.component)||r.component===(q==null?void 0:q.name)?(f.openBlock(),f.createElementBlock("div",v7,[q!=null&&q.component?(f.openBlock(),f.createElementBlock("div",w7,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(q.component),{token:q==null?void 0:q.token,data:r.objectData,columns:q==null?void 0:q.columns,geometry:(Se=(Q=r.objectData)==null?void 0:Q.rows[0])==null?void 0:Se.geom,zoom:16,id:(Ce=(_e=t.$route)==null?void 0:_e.params)==null?void 0:Ce.id},null,8,["token","data","columns","geometry","id"]))])):f.createCommentVNode("",!0),q!=null&&q.name?(f.openBlock(),f.createElementBlock("div",k7,[(Ie=(Le=r.objectData)==null?void 0:Le.html)!=null&&Ie[q==null?void 0:q.name]?(f.openBlock(),f.createElementBlock("div",{key:0,innerHTML:(Ue=r.objectData)==null?void 0:Ue.html[q==null?void 0:q.name]},null,8,S7)):(f.openBlock(),f.createBlock(l,{key:1,slot:(Je=r.objectData)==null?void 0:Je.vue[q==null?void 0:q.name],data:(ot=(It=r.objectData)==null?void 0:It.rows)==null?void 0:ot[0],objectData:r.objectData},null,8,["slot","data","objectData"]))])):f.createCommentVNode("",!0)])):f.createCommentVNode("",!0)],64)}),128))])])):f.createCommentVNode("",!0)],2)}),128))],2)])}const C7=Object.freeze(Object.defineProperty({__proto__:null,default:$e(n7,[["render",E7],["__scopeId","data-v-789a8149"]])},Symbol.toStringTag,{value:"Module"})),T7={},M7={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 A7(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",M7,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 I7=$e(T7,[["render",A7]]),P7={},D7={viewBox:"0 0 1823 249",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function O7(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",D7,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 B7=$e(P7,[["render",O7]]),z7={},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 R7(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 zS=$e(z7,[["render",R7]]),L7={components:{IconChevronDown:zS},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}}},V7={key:0,class:""},F7={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"},$7={key:1};function j7(t,e,n,i,r,a){var g,b,k,E,C,I,D,R,$,G,q,se,Q;const u=f.resolveComponent("IconChevronDown"),l=f.resolveComponent("router-link");return(g=n.route)!=null&&g.menu?(f.openBlock(),f.createElementBlock("div",V7,[f.createElementVNode("button",{onClick:e[0]||(e[0]=Se=>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-left rounded-lg items-center hover:bg-gray-100 duration-300",[((k=(b=n.route)==null?void 0:b.menu)==null?void 0:k.some(Se=>{var _e,Ce;return(Se==null?void 0:Se.path)===t.$route.path.replace("/","")||(Se==null?void 0:Se.table)===((Ce=(_e=t.$route)==null?void 0:_e.params)==null?void 0:Ce.table)&&(Se==null?void 0:Se.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 Se;return[f.withDirectives(f.createElementVNode("ul",F7,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Se=n.route)==null?void 0:Se.menu,(_e,Ce)=>{var Le,Ie;return f.openBlock(),f.createElementBlock("li",{key:Ce,class:"w-full"},[f.createVNode(l,{to:"/"+(_e==null?void 0:_e.path),class:f.normalizeClass([[((_e==null?void 0:_e.path)===t.$route.path.replace("/","")||((Ie=(Le=t.$route)==null?void 0:Le.params)==null?void 0:Ie.table)===(_e==null?void 0:_e.table)&&(_e==null?void 0:_e.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(_e==null?void 0:_e.ua),1)]),_:2},1032,["to","class"])])}),128))],512),[[f.vShow,r.isOpen]])]}),_:1})])):(f.openBlock(),f.createElementBlock("div",$7,[f.createVNode(l,{to:((I=(C=n.route)==null?void 0:C.path)==null?void 0:I[0])==="/"?(D=n.route)==null?void 0:D.path:"/"+((R=n.route)==null?void 0:R.path),class:f.normalizeClass([[((($=n.route)==null?void 0:$.path.replace("/",""))===t.$route.path.replace("/","")||((q=(G=t.$route)==null?void 0:G.params)==null?void 0:q.table)===((se=n.route)==null?void 0:se.table)&&((Q=n.route)==null?void 0:Q.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 Se;return[f.createTextVNode(f.toDisplayString((Se=n.route)==null?void 0:Se.ua),1)]}),_:1},8,["to","class"])]))}const U7={components:{IconLogout:I7,NavbarItem:$e(L7,[["render",j7]]),IconLogo:B7,IconSearch:Q0},data(){return{activeIndex:null,searchValue:""}},computed:{data(){var t,e;return(t=this.searchValue)!=null&&t.trim()?(e=this.flattenMenu(So.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())}):So.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}}},H7={class:"flex flex-col h-[100vh] border-r w-[260px] shrink-0"},q7=["src"],W7={class:"relative"},G7={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"},Z7={class:"flex flex-col flex-wrap w-full pb-3"},Y7={key:0,class:"flex flex-col gap-[6px]"},X7={key:1,class:"text-gray-800 text-lg mt-[20px]"};function K7(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",H7,[f.createElementVNode("img",{src:a.logo,height:"40",width:"200",class:"my-[20px] ml-[20px]"},null,8,q7),f.createElementVNode("div",W7,[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]=k=>r.searchValue=k),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",G7,[f.createElementVNode("nav",Z7,[(b=a.data)!=null&&b.length?(f.openBlock(),f.createElementBlock("ul",Y7,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.data,(k,E)=>(f.openBlock(),f.createElementBlock("li",{key:E,class:"flex flex-col gap-[6px]"},[f.createVNode(g,{route:k},null,8,["route"])]))),128))])):(f.openBlock(),f.createElementBlock("div",X7,"Не знайдено"))])])])}const J7=$e(U7,[["render",K7]]),Q7={},e9={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 t9(t,e){return f.openBlock(),f.createElementBlock("svg",e9,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 n9=$e(Q7,[["render",t9]]),i9={},r9={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 o9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",r9,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 NS=$e(i9,[["render",o9]]),s9={},a9={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 l9(t,e){return f.openBlock(),f.createElementBlock("svg",a9,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 c9=$e(s9,[["render",l9]]),u9={class:"relative shrink-0"},h9=["src"],d9={key:1,class:"h-[38px] w-[38px] bg-gray-200 rounded-full flex items-center justify-center"},p9={key:2,class:"absolute top-4 -start-3 size-2 bg-blue-600 rounded-full dark:bg-blue-500"},f9={class:"grow"},m9={class:"text-xs text-gray-500 dark:text-neutral-500"},g9={class:"block text-sm font-medium text-gray-800 dark:text-neutral-300"},y9={class:"text-sm text-gray-500 dark:text-neutral-500"},_9={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"},b9={__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 rt.get(`/api/notification-read/${(l=t.item)==null?void 0:l.id}`),await n("update-notification")}catch{}};return(l,g)=>{var k,E,C,I,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",[(k=t.item)!=null&&k.read?"bg-gray-100":"bg-white"]]),onMouseenter:r,onMouseleave:a},[f.createElementVNode("div",u9,[(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,h9)):(f.openBlock(),f.createElementBlock("div",d9,[f.createVNode(NS)])),(I=t.item)!=null&&I.read?(f.openBlock(),f.createElementBlock("span",p9)):f.createCommentVNode("",!0)]),f.createElementVNode("div",f9,[f.createElementVNode("p",m9,[f.createVNode(ay,{name:"cdate",data:t.item},null,8,["data"])]),f.createElementVNode("span",g9,f.toDisplayString((D=t.item)==null?void 0:D.author),1),f.createElementVNode("p",y9,f.toDisplayString((R=t.item)==null?void 0:R.subject),1)]),i.value?(f.openBlock(),f.createElementBlock("div",_9,[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(c9)])]),default:f.withCtx(()=>[g[0]||(g[0]=f.createTextVNode(" Прочитати "))]),_:1})])):f.createCommentVNode("",!0)],34)}}},x9={},v9={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 w9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",v9,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 k9=$e(x9,[["render",w9]]),S9={},E9={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 C9(t,e){return f.openBlock(),f.createElementBlock("svg",E9,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 T9=$e(S9,[["render",C9]]),M9={key:0,class:"flex absolute top-0 end-0 -mt-1.5 -me-1.5"},A9={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"},I9={key:0,class:"w-96 h-[100px] z-[11] absolute top-[40px] right-0"},P9={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)]"},D9={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"},O9={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"},B9={key:0},z9={__name:"admin-notification",setup(t){var b,k,E,C,I;const e=f.ref(0),n=f.ref([]),i=f.ref(!1),r=f.ref(null),a=(I=(C=(E=(k=(b=f.getCurrentInstance())==null?void 0:b.appContext)==null?void 0:k.app)==null?void 0:E.config)==null?void 0:C.globalProperties)==null?void 0:I.$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 rt.get("/api/notification");n.value=(D==null?void 0:D.rows)||[]}catch{a({type:"error",message:"При спробі завантаження нотифікацій виникла помилка",title:"Помилка!"})}};l();const g=async()=>{try{await rt.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]=$=>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(k9,{height:"24",width:"24"}),e.value?(f.openBlock(),f.createElementBlock("span",M9,[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",A9,f.toDisplayString(e.value),1)])):f.createCommentVNode("",!0)]),f.createVNode(f.Transition,null,{default:f.withCtx(()=>{var $;return[i.value?(f.openBlock(),f.createElementBlock("div",I9,[f.createElementVNode("div",P9,[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",D9,[f.createVNode(T9)])]),f.createElementVNode("div",O9,[($=n.value)!=null&&$.length?(f.openBlock(),f.createElementBlock("ul",B9,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.value,G=>(f.openBlock(),f.createBlock(b9,{key:G==null?void 0:G.id,item:G,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(n9,{height:"16",width:"16"}),R[3]||(R[3]=f.createTextVNode(" Прочитати усі "))])])):f.createCommentVNode("",!0)]}),_:1})],512))}},N9={},R9={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 L9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",R9,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 V9={components:{IconQuestion:$e(N9,[["render",L9]]),IconUser:NS,AdminNotification:z9},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 rt.get("/user");this.userData=t}catch{}},async logout(){try{await rt.get("/logout"),await window.history.pushState({},"","/login"),await location.reload(),localStorage.removeItem("user")}catch{}},closeOnOutsideClick(){this.isVisible=!1}},beforeUnmount(){window.removeEventListener("click",this.closeOnOutsideClick)}},F9={class:"h-[60px] border-b flex justify-end px-[20px]",style:{width:"calc(100vw - 260px)"}},$9={class:"flex items-center gap-[6px]"},j9={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"},U9={class:"relative"},H9=["src"],q9={key:1,class:"size-[40px] rounded-full bg-gray-200 flex items-center justify-center"},W9={class:"p-[10px] gap-[6px] items-center border-b flex justify-between"},G9=["src"],Z9={key:1,class:"size-[40px] rounded-full bg-gray-200 flex items-center justify-center"},Y9={class:"text-[14px] mr-[10px] text-gray-500"},X9={class:"flex flex-col p-[4px]"};function K9(t,e,n,i,r,a){var k,E,C,I,D,R,$,G,q,se;const u=f.resolveComponent("IconQuestion"),l=f.resolveComponent("AdminNotification"),g=f.resolveComponent("IconUser"),b=f.resolveComponent("router-link");return f.openBlock(),f.createElementBlock("div",F9,[f.createElementVNode("div",$9,[f.createElementVNode("a",j9,[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",U9,[f.createElementVNode("div",{onClick:e[0]||(e[0]=Q=>r.isVisible=!0),class:"cursor-pointer"},[(E=(k=r.userData)==null?void 0:k.user)!=null&&E.avatar?(f.openBlock(),f.createElementBlock("img",{key:0,class:"flex-shrink-0 size-[30px] rounded-full",src:(I=(C=r.userData)==null?void 0:C.user)==null?void 0:I.avatar,alt:"Image Description"},null,8,H9)):(f.openBlock(),f.createElementBlock("div",q9,[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",W9,[(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:(G=($=r.userData)==null?void 0:$.user)==null?void 0:G.avatar,alt:"Image Description"},null,8,G9)):(f.openBlock(),f.createElementBlock("div",Z9,[f.createVNode(g)])),f.createElementVNode("div",null,[f.createElementVNode("p",Y9,f.toDisplayString((se=(q=r.userData)==null?void 0:q.user)==null?void 0:se.username),1)])]),f.createElementVNode("div",X9,[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]=(...Q)=>a.logout&&a.logout(...Q)),class:"p-[8px] block rounded-lg w-full text-start hover:bg-gray-100 !duration-300"}," Вийти ")])])):f.createCommentVNode("",!0)])])])}const J9={components:{navbar:J7,AdminHeader:$e(V9,[["render",K9]])},computed:{isMenu(){return So.value||null}}},Q9={class:"admin-wrapper"},eU={class:"flex flex-col"};function tU(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",Q9,[f.createVNode(u),f.createElementVNode("div",eU,[a.isMenu?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[f.createVNode(l),f.createVNode(g)],64)):f.createCommentVNode("",!0)])])}const nU=Object.freeze(Object.defineProperty({__proto__:null,default:$e(J9,[["render",tU],["__scopeId","data-v-a53a7af5"]])},Symbol.toStringTag,{value:"Module"})),iU={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}}},rU={scope:"col",class:"text-start px-2 py-1"},oU={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"},sU={key:0,d:"m7 15 5 5 5-5"},aU={key:1,d:"m7 9 5-5 5 5"},lU={key:1,class:"text-sm text-stone-500 px-[4px] py-2.5 text-start font-normal text-gray-500"};function cU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("th",rU,[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",oU,[r.currentSort==="asc"||r.currentSort===""?(f.openBlock(),f.createElementBlock("path",sU)):f.createCommentVNode("",!0),r.currentSort==="desc"||r.currentSort===""?(f.openBlock(),f.createElementBlock("path",aU)):f.createCommentVNode("",!0)]))])):(f.openBlock(),f.createElementBlock("p",lU,f.toDisplayString(a.label),1))])}const uU=$e(iU,[["render",cU]]),hU={},dU={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 pU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",dU,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 fU=$e(hU,[["render",pU]]),mU={props:{height:{type:String,default:"16"},width:{type:String,default:"12"},color:{type:String,default:"black"}}},gU={style:{display:"none"}},yU=["height","width","fill"];function _U(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock(f.Fragment,null,[(f.openBlock(),f.createElementBlock("svg",gU,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,yU))],64)}const bU={components:{IconMore:CS,IconDelete:fU,IconEdit:$e(mU,[["render",_U]])},emits:["updateTable"],props:{item:Object,table:String,isForm:null,actions:Array,default:()=>[]},data(){return{formVisible:!1,isDeleteConfirm:!1,formValue:{},top:0,left:0}},computed:{getCustomActions(){return this.actions.filter(t=>typeof t=="object")}},methods:{openConfirm(){this.isDeleteConfirm=!0,document.querySelector("body").click()},async getData(){var t;try{const{data:e}=await rt.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 rt.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);await rt.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}},async customButtonAction(t){var e;document.querySelector("body").click(),t!=null&&t.form?(await this.$v3plugin.$form({form:t==null?void 0:t.form,id:(e=this.item)==null?void 0:e.id,api:t==null?void 0:t.api}),await this.$emit("update-table")):await this.$v3plugin.$api({confirm:t==null?void 0:t.confirm,api:t==null?void 0:t.api,method:t==null?void 0:t.method})}}},xU={class:"hs-dropdown [--placement:bottom-right] inline-flex"},vU={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"},wU={class:"flex flex-col items-start"},kU=["onClick"],SU={class:"text-gray-800"},EU={key:1,class:"h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto"},CU={class:"p-4"},TU={class:"flex justify-end mt-4 gap-x-3"};function MU(t,e,n,i,r,a){const u=f.resolveComponent("IconMore"),l=f.resolveComponent("IconEdit"),g=f.resolveComponent("router-link"),b=f.resolveComponent("IconDelete"),k=f.resolveComponent("VsPopover"),E=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("div",xU,[f.createVNode(k,{trigger:"click",placement:"bottom-left"},{reference:f.withCtx(()=>[f.createElementVNode("button",vU,[f.createVNode(u,{height:"16",width:"16"})])]),default:f.withCtx(()=>{var C,I,D,R,$;return[f.createElementVNode("div",wU,[(C=n.actions)!=null&&C.includes("edit")&&n.isForm?(f.openBlock(),f.createBlock(g,{key:0,to:`/edit?table=${(D=(I=t.$route)==null?void 0:I.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),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.getCustomActions,(G,q)=>(f.openBlock(),f.createElementBlock("button",{key:q,onClick:se=>a.customButtonAction(G),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,{class:"opacity-0"}),f.createElementVNode("span",SU,f.toDisplayString(G==null?void 0:G.label),1)],8,kU))),128)),n.isForm?(f.openBlock(),f.createElementBlock("div",EU)):f.createCommentVNode("",!0),($=n.actions)!=null&&$.includes("del")?(f.openBlock(),f.createElementBlock("button",{key:2,onClick:e[0]||(e[0]=f.withModifiers((...G)=>a.openConfirm&&a.openConfirm(...G),["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",CU,[e[6]||(e[6]=f.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей об'єкт? ",-1)),f.createElementVNode("div",TU,[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 AU=$e(bU,[["render",MU]]),IU={},PU={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 DU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",PU,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 OU=$e(IU,[["render",DU]]),BU={},zU={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 NU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",zU,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 RU={components:{IconExport:OU,IconChevronDown:zS,IconSuccess:$e(BU,[["render",NU]])},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 rt.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"}}},LU={key:0,class:"flex flex-col items-center"},VU={key:1,class:"p-4"},FU={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},$U={class:"flex items-center"},jU={class:"flex items-center gap-[10px] ml-auto"},UU=["onClick"],HU={key:0,class:"block h-[8px] w-[8px] rounded-full bg-blue-500"},qU={class:"mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]"},WU={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},GU={class:"mt-2 space-y-2"},ZU=["id","onChange"],YU=["for"],XU={key:0,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"},KU={key:1,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"};function JU(t,e,n,i,r,a){const u=f.resolveComponent("IconExport"),l=f.resolveComponent("IconChevronDown"),g=f.resolveComponent("IconSuccess"),b=f.resolveComponent("VsCheckbox"),k=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(k,{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",XU,[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",KU,[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",LU,[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",VU,[f.createElementVNode("div",FU,[f.createElementVNode("div",$U,[e[9]||(e[9]=f.createElementVNode("h2",{class:"text-sm text-gray-500"}," Виберіть стовпці таблиці для експорту: ",-1)),f.createElementVNode("div",jU,[(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",HU)):f.createCommentVNode("",!0)],2),f.createTextVNode(" "+f.toDisplayString(E==null?void 0:E.label),1)],8,UU))),128))])]),f.createElementVNode("div",qU,[(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]=I=>r.cols=I),value:E==null?void 0:E.name,label:E==null?void 0:E.ua},null,8,["modelValue","value","label"])]))),128))])]),f.createElementVNode("div",WU,[e[10]||(e[10]=f.createElementVNode("h2",{class:"text-sm text-gray-500"},"Виберіть формат таблиці:",-1)),f.createElementVNode("div",GU,[(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:I=>a.selectFormat(E)},null,40,ZU),f.createElementVNode("label",{for:E,class:"text-sm text-gray-800 ms-3 dark:text-neutral-400"}," Формат "+f.toDisplayString(E),9,YU)]))),128))])])]))]),_:1},8,["visible"])],64)}const QU=$e(RU,[["render",JU]]),eH={},tH={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 nH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",tH,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 iH=$e(eH,[["render",nH]]),rH={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)}},oH={class:"flex w-full gap-[8px] items-centr"};function sH(t,e,n,i,r,a){var u,l;return f.openBlock(),f.createElementBlock("label",oH,[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 aH={components:{IconColumns:iH,AdminTableColumnsHiddenItem:$e(rH,[["render",sH]])},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])}}},lH={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"},cH={class:"py-[10px] px-[10px] w-[260px]"},uH={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 hH(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",lH,[f.createVNode(u,{height:"20",width:"16"})])]),default:f.withCtx(()=>[f.createElementVNode("div",cH,[e[0]||(e[0]=f.createElementVNode("h2",{class:"text-sm mb-[8px]"},"Оберіть колонки, щоб приховати",-1)),f.createElementVNode("ul",uH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,(b,k)=>(f.openBlock(),f.createElementBlock("li",{key:k},[f.createVNode(l,{column:b,onUpdateColumn:a.updateColumn},null,8,["column","onUpdateColumn"])]))),128))])])]),_:1})}const dH=$e(aH,[["render",hH]]),pH={},fH={class:"hidden sm:block shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"};function mH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",fH,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 RS=$e(pH,[["render",mH]]),gH={},yH={class:"vs-table-interface__table-wrp w-full rounded h-fit overflow-hidden"};function _H(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",yH,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 bH=$e(gH,[["render",_H]]),xH={props:{row:Object,column:Object,table:String}};function vH(t,e,n,i,r,a){var u,l,g,b,k,E,C,I;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:(k=n.column)==null?void 0:k.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:(I=n.column)==null?void 0:I.edit},null,40,["name","data","value","table","column","edit"])}const LS=$e(xH,[["render",vH]]),wH={},kH={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 SH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",kH,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 EH={components:{IconPlus:RS,IconMinus:$e(wH,[["render",SH]])},props:{title:String,defaultValue:{type:Boolean,default:()=>!1}},data(){return{expanded:this.defaultValue}}},CH={class:"hs-accordion"},TH={class:"py-0.5 flex items-center gap-x-0.5 w-full"},MH={class:"text-sm font-medium"},AH={class:"relative inline-block w-full duration-150 cursor-pointer before:block before:absolute b"};function IH(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",CH,[f.createElementVNode("div",TH,[f.createElementVNode("div",{onClick:e[0]||(e[0]=g=>r.expanded=!r.expanded),class:"rounded-md cursor-pointer grow"},[f.createElementVNode("span",MH,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",AH,[f.renderSlot(t.$slots,"default",{},void 0,!0)],512),[[f.vShow,r.expanded]])]),_:3})])])])}const PH={components:{AdminComponentIs:LS,AdminTree:$e(EH,[["render",IH],["__scopeId","data-v-c6318482"]]),VsNoData:IS,VsWidgetComments:MS,VsWidgetMap:Z1,VsWidgetFileList:Gv},props:{table:String,columns:Array,row:Object}},DH={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)"}},OH={class:"border-l",style:{height:"calc(100vh - 360px)"}},BH={class:"flex items-center justify-between py-1 gap-x-4"},zH={class:"col-span-1"},NH={class:"inline-flex items-center gap-x-2 text-[13px] text-gray-500 dark:text-neutral-500"},RH={class:"col-span-2"},LH={class:"font-medium text-[13px] text-gray-800 dark:text-neutral-200"},VH={class:"table-info-card"},FH={class:"table-info-card"};function $H(t,e,n,i,r,a){var C,I,D;const u=f.resolveComponent("AdminComponentIs"),l=f.resolveComponent("AdminTree"),g=f.resolveComponent("VsWidgetMap"),b=f.resolveComponent("VsNoData"),k=f.resolveComponent("VsWidgetComments"),E=f.resolveComponent("VsWidgetFileList");return f.openBlock(),f.createElementBlock("div",DH,[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",OH,[(I=(C=t.$route)==null?void 0:C.query)!=null&&I.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",BH,[f.createElementVNode("dt",zH,[f.createElementVNode("p",NH,f.toDisplayString((R==null?void 0:R.ua)||(R==null?void 0:R.title))+": ",1)]),f.createElementVNode("dd",RH,[f.createElementVNode("p",LH,[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,$;return[(R=n.row)!=null&&R.geom?(f.openBlock(),f.createBlock(g,{key:0,geometry:($=n.row)==null?void 0:$.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",VH,[f.createVNode(k,{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",FH,[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 jH=$e(PH,[["render",$H]]),UH={},HH={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 qH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",HH,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 WH=$e(UH,[["render",qH]]),GH={},ZH={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 YH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",ZH,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 XH={emits:["filterChange"],props:{scheme:{type:Object},onFilters:{type:Number}},components:{IconFilter:$e(GH,[["render",YH]])},data(){return{isFilters:!1}},methods:{closeFilter({target:t}){this.isFilters&&t.classList.contains("filter-container")&&(this.isFilters=!1)}}},KH={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"},JH={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 QH(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",KH,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",JH,[(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 eq=$e(XH,[["render",QH]]),tq={props:{tabsList:{type:Array,default:()=>[]},filterState:String}},nq={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"},iq=["onClick"];function rq(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("nav",nq,[(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,iq))),256))])}const oq=$e(tq,[["render",rq]]),sq={},aq={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 lq(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",aq,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 cq={components:{IconFilter2:$e(sq,[["render",lq]])},props:{filterCustom:String,customList:Array}},uq={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"},hq={class:"flex flex-col gap-[4px]"},dq=["onClick"];function pq(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",uq,[f.createVNode(u,{height:"20",width:"20"})])]),default:f.withCtx(()=>[f.createElementVNode("div",hq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.customList,(g,b)=>(f.openBlock(),f.createElementBlock("button",{onClick:k=>{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,dq))),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 fq=$e(cq,[["render",pq]]),mq={class:"flex items-center gap-x-2"},gq={props:{table:String,title:String},components:{AdminTableControl:AU,AdminTableExport:QU,AdminTableColumnsHidden:dH,AdminTableColumn:uU,AdminNodata:bH,IconPlus:RS,IconSearch:Q0,AdminTableCardInfo:jH,IconOpenCard:WH,AdminComponentIs:LS,AdminTableFilters:eq,AdminTableTabs:oq,AdminTableCustomFilters:fq,AdminTableCustomButtons:{__name:"admin-table-custom-buttons",props:{slots:Object},setup(t){var l,g,b,k,E;const{asyncTemplateSlot:e}=(E=(k=(b=(g=(l=f.getCurrentInstance())==null?void 0:l.appContext)==null?void 0:g.app)==null?void 0:b.config)==null?void 0:k.globalProperties)==null?void 0:E.utils,n=f.ref(""),i=f.ref(""),r=t,a=()=>{var C,I,D,R,$;if((C=r.slots)!=null&&C.panelLeft||(i.value="div"),(D=(I=r.slots)==null?void 0:I.panelLeft)!=null&&D.includes("<")){const G=e("PanelLeft",(R=r.slots)==null?void 0:R.panelLeft,["name"]);i.value=G}else i.value=($=r.slots)==null?void 0:$.panelLeft},u=()=>{var C,I,D,R,$;if((C=r.slots)!=null&&C.panelRight||(n.value="div"),(D=(I=r.slots)==null?void 0:I.panelRight)!=null&&D.includes("<")){const G=e("PanelRight",(R=r.slots)==null?void 0:R.panelRight,["name"]);n.value=G}else n.value=($=r.slots)==null?void 0:$.panelRight};return a(),u(),(C,I)=>(f.openBlock(),f.createElementBlock("div",mq,[(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,k,E,C,I,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=((u=decodeURI((a=(r=this.$route)==null?void 0:r.query)==null?void 0:a.filter))==null?void 0:u.replaceAll("+"," "))||null,this.filterState=((g=(l=this.$route)==null?void 0:l.query)==null?void 0:g.filterState)||null,this.filterCustom=((k=(b=this.$route)==null?void 0:b.query)==null?void 0:k.custom)||null,this.searchValue=((C=(E=this.$route)==null?void 0:E.query)==null?void 0:C.search)||"",this.visibleColumns=((R=(D=(I=this.$route)==null?void 0:I.query)==null?void 0:D.columns)==null?void 0:R.split(","))||[],($=this.$route)!=null&&$.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,k;try{const{data:E}=await rt.get(`/api/template/table/${this.table}`),C=await rt.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(I=>(I==null?void 0:I.hidden)!==!0))==null?void 0:r.map(I=>I==null?void 0:I.name))==null?void 0:a.join(","),(u=this.visibleColumns)!=null&&u.length?(l=this.tableData)==null||l.columns.forEach(I=>{var D;(D=this.visibleColumns)!=null&&D.includes(I==null?void 0:I.name)?I.hidden=!1:I.hidden=!0}):this.visibleColumns=(k=(b=(g=this.tableData)==null?void 0:g.columns)==null?void 0:b.filter(I=>(I==null?void 0:I.hidden)!==!0))==null?void 0:k.map(I=>I==null?void 0:I.name)}catch{}},async getFilters(){var t;try{const{data:e}=await rt.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}})}}},yq={class:"w-[calc(100vw - 320px)] bg-gray-50"},_q={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},bq={class:"text-xl font-medium"},xq={style:{height:"calc(100vh - 155px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex pt-[10px]"},vq={class:"bg-white w-full rounded-xl border p-[20px] pr-0"},wq={class:"flex"},kq={class:"flex gap-[6px] ml-auto"},Sq={class:"inline-block w-full align-middle"},Eq={key:0,class:"relative min-w-full divide-y divide-gray-200 table-fixed dark:divide-neutral-700"},Cq={class:"sticky top-[-1px] bg-white w-full after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},Tq={class:"right-0 border-t border-stone-200"},Mq={key:0,class:"w-[70px] sticky right-0 top-0"},Aq={class:"divide-y divide-gray-200"},Iq={class:"px-4 py-3 text-sm text-gray-600"},Pq=["onClick"],Dq=["onClick"],Oq={class:"p-[20px] flex justify-start items-center w-full"},Bq={class:"w-[200px]"},zq={class:"text-sm text-gray-600 dark:text-neutral-400"},Nq={class:"font-semibold text-gray-800 dark:text-neutral-200"},Rq={key:0},Lq={key:0,class:"font-semibold text-gray-800 dark:text-neutral-200"};function Vq(t,e,n,i,r,a){var Ce,Le,Ie,Ue,Je,It,ot,zt,Xt,on,$t,Kt,Cn,dn,vn,pn,ti,Nn,Pn,Rn,Te,He;const u=f.resolveComponent("IconPlus"),l=f.resolveComponent("router-link"),g=f.resolveComponent("AdminTableTabs"),b=f.resolveComponent("IconSearch"),k=f.resolveComponent("VsText"),E=f.resolveComponent("AdminTableCustomButtons"),C=f.resolveComponent("AdminTableCustomFilters"),I=f.resolveComponent("AdminTableColumnsHidden"),D=f.resolveComponent("AdminTableExport"),R=f.resolveComponent("AdminTableFilters"),$=f.resolveComponent("IconOpenCard"),G=f.resolveComponent("AdminTableColumn"),q=f.resolveComponent("AdminComponentIs"),se=f.resolveComponent("AdminTableControl"),Q=f.resolveComponent("AdminNodata"),Se=f.resolveComponent("VsPagination"),_e=f.resolveComponent("AdminTableCardInfo");return f.openBlock(),f.createElementBlock("div",yq,[f.createElementVNode("div",_q,[f.createElementVNode("h2",bq,f.toDisplayString(n.title),1),a.isForm?(f.openBlock(),f.createBlock(l,{key:0,to:`/add?table=${(Le=(Ce=t.$route)==null?void 0:Ce.params)==null?void 0:Le.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",xq,[f.createElementVNode("div",vq,[(Ue=(Ie=r.tableData)==null?void 0:Ie.filterState)!=null&&Ue.length?(f.openBlock(),f.createBlock(g,{key:0,tabsList:(Je=r.tableData)==null?void 0:Je.filterState,filterState:r.filterState,"onUpdate:filterState":e[0]||(e[0]=De=>r.filterState=De)},null,8,["tabsList","filterState"])):f.createCommentVNode("",!0),f.createElementVNode("div",wq,[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(k,{modelValue:r.searchValue,"onUpdate:modelValue":e[1]||(e[1]=De=>r.searchValue=De),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",kq,[(It=r.tableData)!=null&&It.slots?(f.openBlock(),f.createBlock(E,{key:0,slots:(ot=r.tableData)==null?void 0:ot.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]=De=>r.filterCustom=De)},null,8,["customList","filterCustom"])):f.createCommentVNode("",!0),f.createVNode(I,{columns:($t=r.tableData)==null?void 0:$t.columns,onUpdateColumns:e[3]||(e[3]=De=>r.tableData.columns=De)},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]=(...De)=>a.toggleCardInfo&&a.toggleCardInfo(...De)),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($,{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",Sq,[a.isNoData?(f.openBlock(),f.createBlock(Q,{key:1})):(f.openBlock(),f.createElementBlock("table",Eq,[f.createElementVNode("thead",Cq,[f.createElementVNode("tr",Tq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.columns,De=>(f.openBlock(),f.createBlock(G,{key:De.name,style:f.normalizeStyle({width:a.rowWidth(De==null?void 0:De.name),textAlign:De==null?void 0:De.align,wordBreak:De==null?void 0:De.wrap}),data:De,activeColumn:r.activeColumn,onChangeActive:a.changeActiveColumn},null,8,["style","data","activeColumn","onChangeActive"]))),128)),(ti=(pn=a.getActions)==null?void 0:pn.filter(De=>De!=="add"))!=null&&ti.length?(f.openBlock(),f.createElementBlock("th",Mq)):f.createCommentVNode("",!0)])]),f.createElementVNode("tbody",Aq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Nn=r.tableData)==null?void 0:Nn.rows,(De,ct)=>{var Nt,Jt,Mt,Tt,nn,we,yn,pr,jt,sn;return f.openBlock(),f.createElementBlock("tr",{key:ct,class:f.normalizeClass({"bg-gray-50":((Jt=(Nt=t.$route)==null?void 0:Nt.query)==null?void 0:Jt.card)===(De==null?void 0:De.id)})},[f.createElementVNode("td",Iq,[f.createElementVNode("button",{onClick:()=>a.pushToCard(De==null?void 0:De.id),class:f.normalizeClass(["text-sm font-medium",[((Mt=r.tableData)==null?void 0:Mt.card)===!1?"":"text-blue-600 decoration-2 focus:outline-none focus:underline hover:text-blue-600 hover:underline"]])},[f.createVNode(q,{row:De,column:a.columns[0],table:n.table,onUpdateTable:a.getTableData},null,8,["row","column","table","onUpdateTable"])],10,Pq)]),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Tt=a.columns)==null?void 0:Tt.slice(1),ui=>(f.openBlock(),f.createElementBlock("td",{onClick:Hi=>a.changeActiveCardInfo(De==null?void 0:De.id),class:f.normalizeClass(["px-3 py-3 text-sm text-gray-600 text-start whitespace-nowrap",{"cursor-pointer":r.isVisibleCardInfo}]),key:ui.name},[f.createVNode(q,{row:De,column:ui,table:n.table,onUpdateTable:a.getTableData},null,8,["row","column","table","onUpdateTable"])],10,Dq))),128)),(we=(nn=a.getActions)==null?void 0:nn.filter(ui=>ui!=="add"))!=null&&we.length?(f.openBlock(),f.createElementBlock("td",{key:0,class:f.normalizeClass(["text-center sticky right-0 w-[80px] px-[10px]",{"bg-gray-50":((pr=(yn=t.$route)==null?void 0:yn.query)==null?void 0:pr.card)===(De==null?void 0:De.id),"bg-white":((sn=(jt=t.$route)==null?void 0:jt.query)==null?void 0:sn.card)!==(De==null?void 0:De.id)}])},[f.createVNode(se,{actions:a.getActions,isForm:a.isForm,item:De,table:n.table,onUpdateTable:a.getTableData},null,8,["actions","isForm","item","table","onUpdateTable"])],2)):f.createCommentVNode("",!0)],2)}),128))])]))])],4)],2),f.createElementVNode("div",Oq,[f.createElementVNode("div",Bq,[f.createElementVNode("p",zq,[f.createElementVNode("span",Nq,[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",Rq," з")):f.createCommentVNode("",!0)]),r.filters||r.searchValue?(f.openBlock(),f.createElementBlock("span",Lq,f.toDisplayString(" "+((Rn=r.tableData)==null?void 0:Rn.filtered)||0),1)):f.createCommentVNode("",!0)])]),Math.ceil(((Te=r.tableData)==null?void 0:Te.filtered)/r.limit)>1?(f.openBlock(),f.createBlock(Se,{key:0,goTo:!1,class:"justify-end","default-page":parseInt(a.defaultPage),total:((He=r.tableData)==null?void 0:He.filtered)||0,pageSize:parseInt(r.limit),onPageChange:a.handlePageChange,pageSizes:[10,16,20],onPageSizeChange:a.changeLimit,backgroundColor:"#F3F4F6"},null,8,["default-page","total","pageSize","onPageChange","onPageSizeChange"])):f.createCommentVNode("",!0)])],2),f.createVNode(f.Transition,{name:"slide-fade"},{default:f.withCtx(()=>{var De;return[r.isVisibleCardInfo?(f.openBlock(),f.createBlock(_e,{key:0,table:n.table,columns:(De=r.tableData)==null?void 0:De.columns,row:a.activeCardRow},null,8,["table","columns","row"])):f.createCommentVNode("",!0)]}),_:1})])])])])}const Fq={components:{AdminTable:$e(gq,[["render",Vq],["__scopeId","data-v-ef9b0865"]])},data(){return{table:!1,interface:"",title:""}},watch:{$route:{async handler(){So!=null&&So.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(So.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 rt.get(`/api/template/interface/${((e=(t=this.$route)==null?void 0:t.params)==null?void 0:e.catchAll)||""}`);this.interface=n||""}catch{this.interface=""}}}},$q=["innerHTML"];function jq(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,$q))}const Uq=Object.freeze(Object.defineProperty({__proto__:null,default:$e(Fq,[["render",jq]])},Symbol.toStringTag,{value:"Module"}));return Dj});
786
+ `});g.mount(l)})},Ij=async()=>{try{const{data:t}=await rt.get("/api/user-menu");return So.value=t,DS(t)}catch(t){return console.error(t),[]}},Pj=(t,e)=>{Object.entries(e).forEach(([n,i])=>{t.component(n,i)})},Dj={async install(t,{componentsApp:e={},settings:n}){hl.value={...hl,...n};try{const r=(await Ij()).filter(u=>u==null?void 0:u.component).map(u=>({...u,component:{...e_,...e}[u==null?void 0:u.component]}));Pj(t,{...e_,...e}),t.component("admin",GT);const{router:a}=await AA(r);window.app={...t,router:a},window.v3plugin={...t.config.globalProperties,...OS},t.config.globalProperties={...t.config.globalProperties,$componentsConfig:{...wB,componentsApp:e},$router:a,$v3plugin:OS},t.use(a)}catch(i){console.error(i)}},components:e_},Oj={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(So.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 rt.get(`/api/template/table/${n}`),{data:u}=await rt.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 rt.get(`/api/template/form/${a}`);this.scheme=(l==null?void 0:l.schema)||l}catch{}},async onlyEditObject(){try{await this.$refs.form.doValidation(),await rt.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 rt.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"})}}}},Bj={style:{width:"calc(100vw - 260px)"},class:"bg-gray-50"},zj={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},Nj={class:"flex items-center gap-[6px]"},Rj={style:{height:"calc(100vh - 155px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},Lj={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 Vj(t,e,n,i,r,a){const u=f.resolveComponent("VsForm");return f.openBlock(),f.createElementBlock("div",Bj,[f.createElementVNode("div",zj,[e[4]||(e[4]=f.createElementVNode("h2",{class:"text-xl font-medium"},"Редагувати",-1)),f.createElementVNode("div",Nj,[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",Rj,[f.createElementVNode("div",Lj,[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 Fj=Object.freeze(Object.defineProperty({__proto__:null,default:$e(Oj,[["render",Vj]])},Symbol.toStringTag,{value:"Module"})),$j={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(So.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 rt.get(`/api/table-data/${n}`),{data:u}=await rt.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 rt.post(`/api/table/${this.token}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{let k=((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:k||"Сталася помилка валідаціі",type:"error"})}}}},jj={style:{width:"calc(100vw - 260px)"},class:"bg-gray-50"},Uj={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},Hj={class:"flex items-center gap-[6px]"},qj={style:{height:"calc(100vh - 165px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},Wj={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 Gj(t,e,n,i,r,a){const u=f.resolveComponent("VsForm");return f.openBlock(),f.createElementBlock("div",jj,[f.createElementVNode("div",Uj,[e[3]||(e[3]=f.createElementVNode("h2",{class:"text-xl font-medium"},"Створити",-1)),f.createElementVNode("div",Hj,[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",qj,[f.createElementVNode("div",Wj,[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 Zj=Object.freeze(Object.defineProperty({__proto__:null,default:$e($j,[["render",Gj]])},Symbol.toStringTag,{value:"Module"})),Yj={};function Xj(t,e,n,i,r,a){const u=f.resolveComponent("router-view");return f.openBlock(),f.createBlock(u)}const BS=Object.freeze(Object.defineProperty({__proto__:null,default:$e(Yj,[["render",Xj]])},Symbol.toStringTag,{value:"Module"})),Kj={class:"h-[76px] bg-white border rounded-xl flex items-center justify-start px-[20px] mb-[16px]"},Jj={class:"mr-[10px]"},Qj={class:"text-lg font-semibold md:text-xl text-stone-800 dark:text-neutral-200"},e7={class:"flex items-center gap-[6px] ml-auto"},t7={class:"mr-[10px]"},n7={components:{AdminCardHeader:{__name:"admin-card-header",props:{title:{type:String},getRoute:{type:String,required:!0},slots:{type:Object}},setup(t){var E,C,I,D,R;const{asyncTemplateSlot:e}=(R=(D=(I=(C=(E=f.getCurrentInstance())==null?void 0:E.appContext)==null?void 0:C.app)==null?void 0:I.config)==null?void 0:D.globalProperties)==null?void 0:R.utils,n=t,i=vA(),r=wA(),a=f.ref(""),u=f.ref(""),l=()=>{i.back()},g=f.computed(()=>{var $;return`/edit?table=${n.getRoute}&id=${($=r==null?void 0:r.params)==null?void 0:$.id}`}),b=()=>{var $,G,q,se;if(!(($=n.slots)!=null&&$.panelLeft))return"div";if((G=n.slots)!=null&&G.panelLeft.includes("<")){const Q=e("PanelLeft",(q=n.slots)==null?void 0:q.panelLeft,["name"]);u.value=Q}else u.value=(se=n.slots)==null?void 0:se.panelLeft},k=()=>{var $,G,q,se;if(!(($=n.slots)!=null&&$.panelRight))return"div";if((G=n.slots)!=null&&G.panelRight.includes("<")){const Q=e("PanelRight",(q=n.slots)==null?void 0:q.panelRight,["name"]);a.value=Q}else a.value=(se=n.slots)==null?void 0:se.panelRight};return b(),k(),($,G)=>{const q=f.resolveComponent("router-link");return f.openBlock(),f.createElementBlock("div",Kj,[f.createElementVNode("div",Jj,[f.createElementVNode("button",{onClick:l,class:"text-sm h-[20px] text-blue-600 font-medium hover:border-b-2 hover:border-b-blue-500"}," До таблиці "),f.createElementVNode("h2",Qj,f.toDisplayString(t.title),1)]),(f.openBlock(),f.createBlock(f.resolveDynamicComponent(u.value))),f.createElementVNode("div",e7,[f.createElementVNode("div",t7,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(a.value)))]),f.createVNode(q,{to:g.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(()=>G[0]||(G[0]=[f.createTextVNode(" Редагувати ")])),_:1},8,["to"])])])}}},AdminCardAsyncComponent:{__name:"admin-card-async-component",props:{slot:String,data:Object,objectData:Object},setup(t){var a,u,l,g,b;const{asyncTemplateSlot:e}=(b=(g=(l=(u=(a=f.getCurrentInstance())==null?void 0:a.appContext)==null?void 0:u.app)==null?void 0:l.config)==null?void 0:g.globalProperties)==null?void 0:b.utils,n=f.ref(""),i=t;return(()=>{const k=e("CustomComponent",i.slot,["data"]);n.value=k})(),(k,E)=>(f.openBlock(),f.createBlock(f.resolveDynamicComponent(n.value),{data:t.objectData},null,8,["data"]))}}},data(){return{objectData:null,component:""}},computed:{getRoute(){const t=this.flattenMenu(So.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,k,E,C,I,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:((I=(C=(E=(k=this.objectData)==null?void 0:k.rows)==null?void 0:E[0])==null?void 0:C.name)==null?void 0:I.slice(0,35))+" ...";{const R=(D=this.flattenMenu(So.value))==null?void 0:D.find($=>{var G,q;return($==null?void 0:$.table)===((q=(G=this.$route)==null?void 0:G.params)==null?void 0:q.table)});return R==null?void 0:R.ua}},reloadPageTrigger(){return t_.value}},async mounted(){await this.getObjectData(),await this.checkActiveComponent()},watch:{component(t){this.$router.replace({...this.$route,query:{tab:t}})},reloadPageTrigger(){this.getObjectData()}},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 rt.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(k=>(k==null?void 0:k.type)==="tabs"||(k==null?void 0:k.type)==="vertical-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}}},i7={style:{width:"calc(100vw - 260px)",height:"calc(100vh - 60px)"},class:"p-4 overflow-y-auto bg-gray-50"},r7={key:0,class:"bg-white border rounded-xl"},o7={class:"p-[10px] pl-[20px] text-md font-[500]"},s7=["innerHTML"],a7={key:1},l7={key:0,class:"p-[10px] pl-[20px] text-md font-[500]"},c7={key:2,class:"p-[20px] border-t"},u7=["innerHTML"],h7={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]"},d7=["onClick"],p7={key:0,class:"bg-white border border-t-0 rounded-bl-xl rounded-br-xl"},f7={key:0,class:"p-[20px] border-t"},m7={key:1,class:"p-[20px] border-t"},g7=["innerHTML"],y7={key:3,class:"flex"},_7={class:"flex flex-col space-y-2 max-w-[260px] w-full border rounded-xl mr-4 h-auto items-start pl-[10px] bg-white py-[20px]"},b7=["onClick"],x7={class:"flex-grow"},v7={key:0,class:"h-full bg-white border rounded-xl"},w7={key:0,class:"p-[20px]"},k7={key:1,class:"p-[20px] border-t"},S7=["innerHTML"];function E7(t,e,n,i,r,a){var g,b,k;const u=f.resolveComponent("AdminCardHeader"),l=f.resolveComponent("AdminCardAsyncComponent");return f.openBlock(),f.createElementBlock("div",i7,[r.objectData&&((g=r.objectData)==null?void 0:g.isHeader)!==!1?(f.openBlock(),f.createBlock(u,{key:0,title:a.getTitle,"get-route":a.getRoute,slots:(b=r.objectData)==null?void 0:b.slots},null,8,["title","get-route","slots"])):f.createCommentVNode("",!0),f.createElementVNode("div",{class:f.normalizeClass(["grid gap-[20px]",a.getGridClass()])},[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((k=r.objectData)==null?void 0:k.panels,(E,C)=>{var I,D,R,$,G;return f.openBlock(),f.createElementBlock("div",{key:C,class:f.normalizeClass(a.getColClass(E.col))},[E!=null&&E.name?(f.openBlock(),f.createElementBlock("div",r7,[f.createElementVNode("h2",o7,f.toDisplayString((E==null?void 0:E.title)||"Панель"),1),(I=r.objectData)!=null&&I.html[E==null?void 0:E.name]?(f.openBlock(),f.createElementBlock("div",{key:0,class:"p-[20px] border-t",innerHTML:(D=r.objectData)==null?void 0:D.html[E==null?void 0:E.name]},null,8,s7)):(f.openBlock(),f.createBlock(l,{key:1,slot:(R=r.objectData)==null?void 0:R.vue[E==null?void 0:E.name],data:(G=($=r.objectData)==null?void 0:$.rows)==null?void 0:G[0],objectData:r.objectData},null,8,["slot","data","objectData"]))])):E.type==="container"?(f.openBlock(),f.createElementBlock("div",a7,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(E.items,(q,se)=>{var Q,Se,_e,Ce,Le,Ie,Ue,Je,It,ot;return f.openBlock(),f.createElementBlock("div",{key:se,class:f.normalizeClass([{"mb-[20px]":E.items.length>1},"bg-white border rounded-xl"])},[q!=null&&q.title?(f.openBlock(),f.createElementBlock("h2",l7,f.toDisplayString((q==null?void 0:q.title)||"Панель"),1)):f.createCommentVNode("",!0),q!=null&&q.component?(f.openBlock(),f.createElementBlock("div",{key:1,class:f.normalizeClass(["p-[20px]",{"border-t":q==null?void 0:q.title}])},[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(q.component),{geometry:(Se=(Q=r.objectData)==null?void 0:Q.rows[0])==null?void 0:Se.geom,columns:q==null?void 0:q.columns,token:q==null?void 0:q.token,zoom:16,data:r.objectData,id:(Ce=(_e=t.$route)==null?void 0:_e.params)==null?void 0:Ce.id},null,8,["geometry","columns","token","data","id"]))],2)):f.createCommentVNode("",!0),q!=null&&q.name?(f.openBlock(),f.createElementBlock("div",c7,[(Ie=(Le=r.objectData)==null?void 0:Le.html)!=null&&Ie[q==null?void 0:q.name]?(f.openBlock(),f.createElementBlock("div",{key:0,innerHTML:(Ue=r.objectData)==null?void 0:Ue.html[q==null?void 0:q.name]},null,8,u7)):(f.openBlock(),f.createBlock(l,{key:1,slot:(Je=r.objectData)==null?void 0:Je.vue[q==null?void 0:q.name],data:(ot=(It=r.objectData)==null?void 0:It.rows)==null?void 0:ot[0],objectData:r.objectData},null,8,["slot","data","objectData"]))])):f.createCommentVNode("",!0)],2)}),128))])):f.createCommentVNode("",!0),(E==null?void 0:E.type)==="tabs"?(f.openBlock(),f.createElementBlock(f.Fragment,{key:2},[f.createElementVNode("nav",h7,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(E==null?void 0:E.items,q=>(f.openBlock(),f.createElementBlock("button",{key:(q==null?void 0:q.name)||(q==null?void 0:q.component),onClick:se=>r.component=(q==null?void 0:q.component)||(q==null?void 0:q.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===(q==null?void 0:q.component)||r.component===(q==null?void 0:q.name),"":r.component!==(q==null?void 0:q.component)&&r.component!==(q==null?void 0:q.name)}])},f.toDisplayString(q==null?void 0:q.title),11,d7))),128))]),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(E.items,(q,se)=>{var Q,Se,_e,Ce,Le,Ie,Ue,Je,It,ot;return f.openBlock(),f.createElementBlock(f.Fragment,{key:se},[r.component===(q==null?void 0:q.component)||r.component===(q==null?void 0:q.name)?(f.openBlock(),f.createElementBlock("div",p7,[q!=null&&q.component?(f.openBlock(),f.createElementBlock("div",f7,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(q.component),{data:r.objectData,token:q==null?void 0:q.token,columns:q==null?void 0:q.columns,geometry:(Se=(Q=r.objectData)==null?void 0:Q.rows[0])==null?void 0:Se.geom,zoom:16,id:(Ce=(_e=t.$route)==null?void 0:_e.params)==null?void 0:Ce.id},null,8,["data","token","columns","geometry","id"]))])):f.createCommentVNode("",!0),q!=null&&q.name?(f.openBlock(),f.createElementBlock("div",m7,[(Ie=(Le=r.objectData)==null?void 0:Le.html)!=null&&Ie[q==null?void 0:q.name]?(f.openBlock(),f.createElementBlock("div",{key:0,innerHTML:(Ue=r.objectData)==null?void 0:Ue.html[q==null?void 0:q.name]},null,8,g7)):(f.openBlock(),f.createBlock(l,{key:1,slot:(Je=r.objectData)==null?void 0:Je.vue[q==null?void 0:q.name],data:(ot=(It=r.objectData)==null?void 0:It.rows)==null?void 0:ot[0],objectData:r.objectData},null,8,["slot","data","objectData"]))])):f.createCommentVNode("",!0)])):f.createCommentVNode("",!0)],64)}),128))],64)):f.createCommentVNode("",!0),(E==null?void 0:E.type)==="vertical-tabs"?(f.openBlock(),f.createElementBlock("div",y7,[f.createElementVNode("nav",_7,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(E==null?void 0:E.items,q=>(f.openBlock(),f.createElementBlock("button",{key:(q==null?void 0:q.name)||(q==null?void 0:q.component),onClick:se=>r.component=(q==null?void 0:q.component)||(q==null?void 0:q.name),class:f.normalizeClass(["relative whitespace-pre-wrap text-left inline-flex items-center w-full py-1 text-sm border-transparent pe-4 gap-x-2 border-e-2 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===(q==null?void 0:q.component)||r.component===(q==null?void 0:q.name),"text-gray-500":r.component!==(q==null?void 0:q.component)&&r.component!==(q==null?void 0:q.name)}])},f.toDisplayString(q==null?void 0:q.title),11,b7))),128))]),f.createElementVNode("div",x7,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(E.items,(q,se)=>{var Q,Se,_e,Ce,Le,Ie,Ue,Je,It,ot;return f.openBlock(),f.createElementBlock(f.Fragment,{key:se},[r.component===(q==null?void 0:q.component)||r.component===(q==null?void 0:q.name)?(f.openBlock(),f.createElementBlock("div",v7,[q!=null&&q.component?(f.openBlock(),f.createElementBlock("div",w7,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(q.component),{token:q==null?void 0:q.token,data:r.objectData,columns:q==null?void 0:q.columns,geometry:(Se=(Q=r.objectData)==null?void 0:Q.rows[0])==null?void 0:Se.geom,zoom:16,id:(Ce=(_e=t.$route)==null?void 0:_e.params)==null?void 0:Ce.id},null,8,["token","data","columns","geometry","id"]))])):f.createCommentVNode("",!0),q!=null&&q.name?(f.openBlock(),f.createElementBlock("div",k7,[(Ie=(Le=r.objectData)==null?void 0:Le.html)!=null&&Ie[q==null?void 0:q.name]?(f.openBlock(),f.createElementBlock("div",{key:0,innerHTML:(Ue=r.objectData)==null?void 0:Ue.html[q==null?void 0:q.name]},null,8,S7)):(f.openBlock(),f.createBlock(l,{key:1,slot:(Je=r.objectData)==null?void 0:Je.vue[q==null?void 0:q.name],data:(ot=(It=r.objectData)==null?void 0:It.rows)==null?void 0:ot[0],objectData:r.objectData},null,8,["slot","data","objectData"]))])):f.createCommentVNode("",!0)])):f.createCommentVNode("",!0)],64)}),128))])])):f.createCommentVNode("",!0)],2)}),128))],2)])}const C7=Object.freeze(Object.defineProperty({__proto__:null,default:$e(n7,[["render",E7],["__scopeId","data-v-e6a747cc"]])},Symbol.toStringTag,{value:"Module"})),T7={},M7={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 A7(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",M7,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 I7=$e(T7,[["render",A7]]),P7={},D7={viewBox:"0 0 1823 249",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function O7(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",D7,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 B7=$e(P7,[["render",O7]]),z7={},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 R7(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 zS=$e(z7,[["render",R7]]),L7={components:{IconChevronDown:zS},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}}},V7={key:0,class:""},F7={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"},$7={key:1};function j7(t,e,n,i,r,a){var g,b,k,E,C,I,D,R,$,G,q,se,Q;const u=f.resolveComponent("IconChevronDown"),l=f.resolveComponent("router-link");return(g=n.route)!=null&&g.menu?(f.openBlock(),f.createElementBlock("div",V7,[f.createElementVNode("button",{onClick:e[0]||(e[0]=Se=>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-left rounded-lg items-center hover:bg-gray-100 duration-300",[((k=(b=n.route)==null?void 0:b.menu)==null?void 0:k.some(Se=>{var _e,Ce;return(Se==null?void 0:Se.path)===t.$route.path.replace("/","")||(Se==null?void 0:Se.table)===((Ce=(_e=t.$route)==null?void 0:_e.params)==null?void 0:Ce.table)&&(Se==null?void 0:Se.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 Se;return[f.withDirectives(f.createElementVNode("ul",F7,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Se=n.route)==null?void 0:Se.menu,(_e,Ce)=>{var Le,Ie;return f.openBlock(),f.createElementBlock("li",{key:Ce,class:"w-full"},[f.createVNode(l,{to:"/"+(_e==null?void 0:_e.path),class:f.normalizeClass([[((_e==null?void 0:_e.path)===t.$route.path.replace("/","")||((Ie=(Le=t.$route)==null?void 0:Le.params)==null?void 0:Ie.table)===(_e==null?void 0:_e.table)&&(_e==null?void 0:_e.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(_e==null?void 0:_e.ua),1)]),_:2},1032,["to","class"])])}),128))],512),[[f.vShow,r.isOpen]])]}),_:1})])):(f.openBlock(),f.createElementBlock("div",$7,[f.createVNode(l,{to:((I=(C=n.route)==null?void 0:C.path)==null?void 0:I[0])==="/"?(D=n.route)==null?void 0:D.path:"/"+((R=n.route)==null?void 0:R.path),class:f.normalizeClass([[((($=n.route)==null?void 0:$.path.replace("/",""))===t.$route.path.replace("/","")||((q=(G=t.$route)==null?void 0:G.params)==null?void 0:q.table)===((se=n.route)==null?void 0:se.table)&&((Q=n.route)==null?void 0:Q.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 Se;return[f.createTextVNode(f.toDisplayString((Se=n.route)==null?void 0:Se.ua),1)]}),_:1},8,["to","class"])]))}const U7={components:{IconLogout:I7,NavbarItem:$e(L7,[["render",j7]]),IconLogo:B7,IconSearch:Q0},data(){return{activeIndex:null,searchValue:""}},computed:{data(){var t,e;return(t=this.searchValue)!=null&&t.trim()?(e=this.flattenMenu(So.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())}):So.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}}},H7={class:"flex flex-col h-[100vh] border-r w-[260px] shrink-0"},q7=["src"],W7={class:"relative"},G7={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"},Z7={class:"flex flex-col flex-wrap w-full pb-3"},Y7={key:0,class:"flex flex-col gap-[6px]"},X7={key:1,class:"text-gray-800 text-lg mt-[20px]"};function K7(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",H7,[f.createElementVNode("img",{src:a.logo,height:"40",width:"200",class:"my-[20px] ml-[20px]"},null,8,q7),f.createElementVNode("div",W7,[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]=k=>r.searchValue=k),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",G7,[f.createElementVNode("nav",Z7,[(b=a.data)!=null&&b.length?(f.openBlock(),f.createElementBlock("ul",Y7,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.data,(k,E)=>(f.openBlock(),f.createElementBlock("li",{key:E,class:"flex flex-col gap-[6px]"},[f.createVNode(g,{route:k},null,8,["route"])]))),128))])):(f.openBlock(),f.createElementBlock("div",X7,"Не знайдено"))])])])}const J7=$e(U7,[["render",K7]]),Q7={},e9={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 t9(t,e){return f.openBlock(),f.createElementBlock("svg",e9,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 n9=$e(Q7,[["render",t9]]),i9={},r9={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 o9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",r9,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 NS=$e(i9,[["render",o9]]),s9={},a9={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 l9(t,e){return f.openBlock(),f.createElementBlock("svg",a9,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 c9=$e(s9,[["render",l9]]),u9={class:"relative shrink-0"},h9=["src"],d9={key:1,class:"h-[38px] w-[38px] bg-gray-200 rounded-full flex items-center justify-center"},p9={key:2,class:"absolute top-4 -start-3 size-2 bg-blue-600 rounded-full dark:bg-blue-500"},f9={class:"grow"},m9={class:"text-xs text-gray-500 dark:text-neutral-500"},g9={class:"block text-sm font-medium text-gray-800 dark:text-neutral-300"},y9={class:"text-sm text-gray-500 dark:text-neutral-500"},_9={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"},b9={__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 rt.get(`/api/notification-read/${(l=t.item)==null?void 0:l.id}`),await n("update-notification")}catch{}};return(l,g)=>{var k,E,C,I,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",[(k=t.item)!=null&&k.read?"bg-gray-100":"bg-white"]]),onMouseenter:r,onMouseleave:a},[f.createElementVNode("div",u9,[(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,h9)):(f.openBlock(),f.createElementBlock("div",d9,[f.createVNode(NS)])),(I=t.item)!=null&&I.read?(f.openBlock(),f.createElementBlock("span",p9)):f.createCommentVNode("",!0)]),f.createElementVNode("div",f9,[f.createElementVNode("p",m9,[f.createVNode(ay,{name:"cdate",data:t.item},null,8,["data"])]),f.createElementVNode("span",g9,f.toDisplayString((D=t.item)==null?void 0:D.author),1),f.createElementVNode("p",y9,f.toDisplayString((R=t.item)==null?void 0:R.subject),1)]),i.value?(f.openBlock(),f.createElementBlock("div",_9,[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(c9)])]),default:f.withCtx(()=>[g[0]||(g[0]=f.createTextVNode(" Прочитати "))]),_:1})])):f.createCommentVNode("",!0)],34)}}},x9={},v9={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 w9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",v9,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 k9=$e(x9,[["render",w9]]),S9={},E9={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 C9(t,e){return f.openBlock(),f.createElementBlock("svg",E9,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 T9=$e(S9,[["render",C9]]),M9={key:0,class:"flex absolute top-0 end-0 -mt-1.5 -me-1.5"},A9={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"},I9={key:0,class:"w-96 h-[100px] z-[11] absolute top-[40px] right-0"},P9={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)]"},D9={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"},O9={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"},B9={key:0},z9={__name:"admin-notification",setup(t){var b,k,E,C,I;const e=f.ref(0),n=f.ref([]),i=f.ref(!1),r=f.ref(null),a=(I=(C=(E=(k=(b=f.getCurrentInstance())==null?void 0:b.appContext)==null?void 0:k.app)==null?void 0:E.config)==null?void 0:C.globalProperties)==null?void 0:I.$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 rt.get("/api/notification");n.value=(D==null?void 0:D.rows)||[]}catch{a({type:"error",message:"При спробі завантаження нотифікацій виникла помилка",title:"Помилка!"})}};l();const g=async()=>{try{await rt.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]=$=>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(k9,{height:"24",width:"24"}),e.value?(f.openBlock(),f.createElementBlock("span",M9,[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",A9,f.toDisplayString(e.value),1)])):f.createCommentVNode("",!0)]),f.createVNode(f.Transition,null,{default:f.withCtx(()=>{var $;return[i.value?(f.openBlock(),f.createElementBlock("div",I9,[f.createElementVNode("div",P9,[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",D9,[f.createVNode(T9)])]),f.createElementVNode("div",O9,[($=n.value)!=null&&$.length?(f.openBlock(),f.createElementBlock("ul",B9,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.value,G=>(f.openBlock(),f.createBlock(b9,{key:G==null?void 0:G.id,item:G,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(n9,{height:"16",width:"16"}),R[3]||(R[3]=f.createTextVNode(" Прочитати усі "))])])):f.createCommentVNode("",!0)]}),_:1})],512))}},N9={},R9={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 L9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",R9,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 V9={components:{IconQuestion:$e(N9,[["render",L9]]),IconUser:NS,AdminNotification:z9},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 rt.get("/user");this.userData=t}catch{}},async logout(){try{await rt.get("/logout"),await window.history.pushState({},"","/login"),await location.reload(),localStorage.removeItem("user")}catch{}},closeOnOutsideClick(){this.isVisible=!1}},beforeUnmount(){window.removeEventListener("click",this.closeOnOutsideClick)}},F9={class:"h-[60px] border-b flex justify-end px-[20px]",style:{width:"calc(100vw - 260px)"}},$9={class:"flex items-center gap-[6px]"},j9={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"},U9={class:"relative"},H9=["src"],q9={key:1,class:"size-[40px] rounded-full bg-gray-200 flex items-center justify-center"},W9={class:"p-[10px] gap-[6px] items-center border-b flex justify-between"},G9=["src"],Z9={key:1,class:"size-[40px] rounded-full bg-gray-200 flex items-center justify-center"},Y9={class:"text-[14px] mr-[10px] text-gray-500"},X9={class:"flex flex-col p-[4px]"};function K9(t,e,n,i,r,a){var k,E,C,I,D,R,$,G,q,se;const u=f.resolveComponent("IconQuestion"),l=f.resolveComponent("AdminNotification"),g=f.resolveComponent("IconUser"),b=f.resolveComponent("router-link");return f.openBlock(),f.createElementBlock("div",F9,[f.createElementVNode("div",$9,[f.createElementVNode("a",j9,[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",U9,[f.createElementVNode("div",{onClick:e[0]||(e[0]=Q=>r.isVisible=!0),class:"cursor-pointer"},[(E=(k=r.userData)==null?void 0:k.user)!=null&&E.avatar?(f.openBlock(),f.createElementBlock("img",{key:0,class:"flex-shrink-0 size-[30px] rounded-full",src:(I=(C=r.userData)==null?void 0:C.user)==null?void 0:I.avatar,alt:"Image Description"},null,8,H9)):(f.openBlock(),f.createElementBlock("div",q9,[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",W9,[(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:(G=($=r.userData)==null?void 0:$.user)==null?void 0:G.avatar,alt:"Image Description"},null,8,G9)):(f.openBlock(),f.createElementBlock("div",Z9,[f.createVNode(g)])),f.createElementVNode("div",null,[f.createElementVNode("p",Y9,f.toDisplayString((se=(q=r.userData)==null?void 0:q.user)==null?void 0:se.username),1)])]),f.createElementVNode("div",X9,[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]=(...Q)=>a.logout&&a.logout(...Q)),class:"p-[8px] block rounded-lg w-full text-start hover:bg-gray-100 !duration-300"}," Вийти ")])])):f.createCommentVNode("",!0)])])])}const J9={components:{navbar:J7,AdminHeader:$e(V9,[["render",K9]])},computed:{isMenu(){return So.value||null}}},Q9={class:"admin-wrapper"},eU={class:"flex flex-col"};function tU(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",Q9,[f.createVNode(u),f.createElementVNode("div",eU,[a.isMenu?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[f.createVNode(l),f.createVNode(g)],64)):f.createCommentVNode("",!0)])])}const nU=Object.freeze(Object.defineProperty({__proto__:null,default:$e(J9,[["render",tU],["__scopeId","data-v-36fd7ac9"]])},Symbol.toStringTag,{value:"Module"})),iU={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}}},rU={scope:"col",class:"text-start px-2 py-1"},oU={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"},sU={key:0,d:"m7 15 5 5 5-5"},aU={key:1,d:"m7 9 5-5 5 5"},lU={key:1,class:"text-sm text-stone-500 px-[4px] py-2.5 text-start font-normal text-gray-500"};function cU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("th",rU,[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",oU,[r.currentSort==="asc"||r.currentSort===""?(f.openBlock(),f.createElementBlock("path",sU)):f.createCommentVNode("",!0),r.currentSort==="desc"||r.currentSort===""?(f.openBlock(),f.createElementBlock("path",aU)):f.createCommentVNode("",!0)]))])):(f.openBlock(),f.createElementBlock("p",lU,f.toDisplayString(a.label),1))])}const uU=$e(iU,[["render",cU]]),hU={},dU={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 pU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",dU,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 fU=$e(hU,[["render",pU]]),mU={props:{height:{type:String,default:"16"},width:{type:String,default:"12"},color:{type:String,default:"black"}}},gU={style:{display:"none"}},yU=["height","width","fill"];function _U(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock(f.Fragment,null,[(f.openBlock(),f.createElementBlock("svg",gU,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,yU))],64)}const bU={components:{IconMore:CS,IconDelete:fU,IconEdit:$e(mU,[["render",_U]])},emits:["updateTable"],props:{item:Object,table:String,isForm:null,actions:Array,default:()=>[]},data(){return{formVisible:!1,isDeleteConfirm:!1,formValue:{},top:0,left:0}},computed:{getCustomActions(){return this.actions.filter(t=>typeof t=="object")}},methods:{openConfirm(){this.isDeleteConfirm=!0,document.querySelector("body").click()},async getData(){var t;try{const{data:e}=await rt.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 rt.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);await rt.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}},async customButtonAction(t){var e;document.querySelector("body").click(),t!=null&&t.form?(await this.$v3plugin.$form({form:t==null?void 0:t.form,id:(e=this.item)==null?void 0:e.id,api:t==null?void 0:t.api}),await this.$emit("update-table")):await this.$v3plugin.$api({confirm:t==null?void 0:t.confirm,api:t==null?void 0:t.api,method:t==null?void 0:t.method})}}},xU={class:"hs-dropdown [--placement:bottom-right] inline-flex"},vU={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"},wU={class:"flex flex-col items-start"},kU=["onClick"],SU={class:"text-gray-800"},EU={key:1,class:"h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto"},CU={class:"p-4"},TU={class:"flex justify-end mt-4 gap-x-3"};function MU(t,e,n,i,r,a){const u=f.resolveComponent("IconMore"),l=f.resolveComponent("IconEdit"),g=f.resolveComponent("router-link"),b=f.resolveComponent("IconDelete"),k=f.resolveComponent("VsPopover"),E=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("div",xU,[f.createVNode(k,{trigger:"click",placement:"bottom-left"},{reference:f.withCtx(()=>[f.createElementVNode("button",vU,[f.createVNode(u,{height:"16",width:"16"})])]),default:f.withCtx(()=>{var C,I,D,R,$;return[f.createElementVNode("div",wU,[(C=n.actions)!=null&&C.includes("edit")&&n.isForm?(f.openBlock(),f.createBlock(g,{key:0,to:`/edit?table=${(D=(I=t.$route)==null?void 0:I.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),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.getCustomActions,(G,q)=>(f.openBlock(),f.createElementBlock("button",{key:q,onClick:se=>a.customButtonAction(G),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,{class:"opacity-0"}),f.createElementVNode("span",SU,f.toDisplayString(G==null?void 0:G.label),1)],8,kU))),128)),n.isForm?(f.openBlock(),f.createElementBlock("div",EU)):f.createCommentVNode("",!0),($=n.actions)!=null&&$.includes("del")?(f.openBlock(),f.createElementBlock("button",{key:2,onClick:e[0]||(e[0]=f.withModifiers((...G)=>a.openConfirm&&a.openConfirm(...G),["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",CU,[e[6]||(e[6]=f.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей об'єкт? ",-1)),f.createElementVNode("div",TU,[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 AU=$e(bU,[["render",MU]]),IU={},PU={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 DU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",PU,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 OU=$e(IU,[["render",DU]]),BU={},zU={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 NU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",zU,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 RU={components:{IconExport:OU,IconChevronDown:zS,IconSuccess:$e(BU,[["render",NU]])},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 rt.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"}}},LU={key:0,class:"flex flex-col items-center"},VU={key:1,class:"p-4"},FU={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},$U={class:"flex items-center"},jU={class:"flex items-center gap-[10px] ml-auto"},UU=["onClick"],HU={key:0,class:"block h-[8px] w-[8px] rounded-full bg-blue-500"},qU={class:"mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]"},WU={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},GU={class:"mt-2 space-y-2"},ZU=["id","onChange"],YU=["for"],XU={key:0,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"},KU={key:1,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"};function JU(t,e,n,i,r,a){const u=f.resolveComponent("IconExport"),l=f.resolveComponent("IconChevronDown"),g=f.resolveComponent("IconSuccess"),b=f.resolveComponent("VsCheckbox"),k=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(k,{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",XU,[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",KU,[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",LU,[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",VU,[f.createElementVNode("div",FU,[f.createElementVNode("div",$U,[e[9]||(e[9]=f.createElementVNode("h2",{class:"text-sm text-gray-500"}," Виберіть стовпці таблиці для експорту: ",-1)),f.createElementVNode("div",jU,[(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",HU)):f.createCommentVNode("",!0)],2),f.createTextVNode(" "+f.toDisplayString(E==null?void 0:E.label),1)],8,UU))),128))])]),f.createElementVNode("div",qU,[(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]=I=>r.cols=I),value:E==null?void 0:E.name,label:E==null?void 0:E.ua},null,8,["modelValue","value","label"])]))),128))])]),f.createElementVNode("div",WU,[e[10]||(e[10]=f.createElementVNode("h2",{class:"text-sm text-gray-500"},"Виберіть формат таблиці:",-1)),f.createElementVNode("div",GU,[(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:I=>a.selectFormat(E)},null,40,ZU),f.createElementVNode("label",{for:E,class:"text-sm text-gray-800 ms-3 dark:text-neutral-400"}," Формат "+f.toDisplayString(E),9,YU)]))),128))])])]))]),_:1},8,["visible"])],64)}const QU=$e(RU,[["render",JU]]),eH={},tH={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 nH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",tH,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 iH=$e(eH,[["render",nH]]),rH={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)}},oH={class:"flex w-full gap-[8px] items-centr"};function sH(t,e,n,i,r,a){var u,l;return f.openBlock(),f.createElementBlock("label",oH,[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 aH={components:{IconColumns:iH,AdminTableColumnsHiddenItem:$e(rH,[["render",sH]])},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])}}},lH={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"},cH={class:"py-[10px] px-[10px] w-[260px]"},uH={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 hH(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",lH,[f.createVNode(u,{height:"20",width:"16"})])]),default:f.withCtx(()=>[f.createElementVNode("div",cH,[e[0]||(e[0]=f.createElementVNode("h2",{class:"text-sm mb-[8px]"},"Оберіть колонки, щоб приховати",-1)),f.createElementVNode("ul",uH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,(b,k)=>(f.openBlock(),f.createElementBlock("li",{key:k},[f.createVNode(l,{column:b,onUpdateColumn:a.updateColumn},null,8,["column","onUpdateColumn"])]))),128))])])]),_:1})}const dH=$e(aH,[["render",hH]]),pH={},fH={class:"hidden sm:block shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"};function mH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",fH,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 RS=$e(pH,[["render",mH]]),gH={},yH={class:"vs-table-interface__table-wrp w-full rounded h-fit overflow-hidden"};function _H(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",yH,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 bH=$e(gH,[["render",_H]]),xH={props:{row:Object,column:Object,table:String}};function vH(t,e,n,i,r,a){var u,l,g,b,k,E,C,I;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:(k=n.column)==null?void 0:k.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:(I=n.column)==null?void 0:I.edit},null,40,["name","data","value","table","column","edit"])}const LS=$e(xH,[["render",vH]]),wH={},kH={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 SH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",kH,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 EH={components:{IconPlus:RS,IconMinus:$e(wH,[["render",SH]])},props:{title:String,defaultValue:{type:Boolean,default:()=>!1}},data(){return{expanded:this.defaultValue}}},CH={class:"hs-accordion"},TH={class:"py-0.5 flex items-center gap-x-0.5 w-full"},MH={class:"text-sm font-medium"},AH={class:"relative inline-block w-full duration-150 cursor-pointer before:block before:absolute b"};function IH(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",CH,[f.createElementVNode("div",TH,[f.createElementVNode("div",{onClick:e[0]||(e[0]=g=>r.expanded=!r.expanded),class:"rounded-md cursor-pointer grow"},[f.createElementVNode("span",MH,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",AH,[f.renderSlot(t.$slots,"default",{},void 0,!0)],512),[[f.vShow,r.expanded]])]),_:3})])])])}const PH={components:{AdminComponentIs:LS,AdminTree:$e(EH,[["render",IH],["__scopeId","data-v-e1f274c9"]]),VsNoData:IS,VsWidgetComments:MS,VsWidgetMap:Z1,VsWidgetFileList:Gv},props:{table:String,columns:Array,row:Object}},DH={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)"}},OH={class:"border-l",style:{height:"calc(100vh - 360px)"}},BH={class:"flex items-center justify-between py-1 gap-x-4"},zH={class:"col-span-1"},NH={class:"inline-flex items-center gap-x-2 text-[13px] text-gray-500 dark:text-neutral-500"},RH={class:"col-span-2"},LH={class:"font-medium text-[13px] text-gray-800 dark:text-neutral-200"},VH={class:"table-info-card"},FH={class:"table-info-card"};function $H(t,e,n,i,r,a){var C,I,D;const u=f.resolveComponent("AdminComponentIs"),l=f.resolveComponent("AdminTree"),g=f.resolveComponent("VsWidgetMap"),b=f.resolveComponent("VsNoData"),k=f.resolveComponent("VsWidgetComments"),E=f.resolveComponent("VsWidgetFileList");return f.openBlock(),f.createElementBlock("div",DH,[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",OH,[(I=(C=t.$route)==null?void 0:C.query)!=null&&I.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",BH,[f.createElementVNode("dt",zH,[f.createElementVNode("p",NH,f.toDisplayString((R==null?void 0:R.ua)||(R==null?void 0:R.title))+": ",1)]),f.createElementVNode("dd",RH,[f.createElementVNode("p",LH,[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,$;return[(R=n.row)!=null&&R.geom?(f.openBlock(),f.createBlock(g,{key:0,geometry:($=n.row)==null?void 0:$.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",VH,[f.createVNode(k,{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",FH,[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 jH=$e(PH,[["render",$H]]),UH={},HH={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 qH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",HH,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 WH=$e(UH,[["render",qH]]),GH={},ZH={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 YH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",ZH,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 XH={emits:["filterChange"],props:{scheme:{type:Object},onFilters:{type:Number}},components:{IconFilter:$e(GH,[["render",YH]])},data(){return{isFilters:!1}},methods:{closeFilter({target:t}){this.isFilters&&t.classList.contains("filter-container")&&(this.isFilters=!1)}}},KH={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"},JH={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 QH(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",KH,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",JH,[(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 eq=$e(XH,[["render",QH]]),tq={props:{tabsList:{type:Array,default:()=>[]},filterState:String}},nq={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"},iq=["onClick"];function rq(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("nav",nq,[(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,iq))),256))])}const oq=$e(tq,[["render",rq]]),sq={},aq={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 lq(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",aq,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 cq={components:{IconFilter2:$e(sq,[["render",lq]])},props:{filterCustom:String,customList:Array}},uq={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"},hq={class:"flex flex-col gap-[4px]"},dq=["onClick"];function pq(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",uq,[f.createVNode(u,{height:"20",width:"20"})])]),default:f.withCtx(()=>[f.createElementVNode("div",hq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.customList,(g,b)=>(f.openBlock(),f.createElementBlock("button",{onClick:k=>{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,dq))),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 fq=$e(cq,[["render",pq]]),mq={class:"flex items-center gap-x-2"},gq={props:{table:String,title:String},components:{AdminTableControl:AU,AdminTableExport:QU,AdminTableColumnsHidden:dH,AdminTableColumn:uU,AdminNodata:bH,IconPlus:RS,IconSearch:Q0,AdminTableCardInfo:jH,IconOpenCard:WH,AdminComponentIs:LS,AdminTableFilters:eq,AdminTableTabs:oq,AdminTableCustomFilters:fq,AdminTableCustomButtons:{__name:"admin-table-custom-buttons",props:{slots:Object},setup(t){var l,g,b,k,E;const{asyncTemplateSlot:e}=(E=(k=(b=(g=(l=f.getCurrentInstance())==null?void 0:l.appContext)==null?void 0:g.app)==null?void 0:b.config)==null?void 0:k.globalProperties)==null?void 0:E.utils,n=f.ref(""),i=f.ref(""),r=t,a=()=>{var C,I,D,R,$;if((C=r.slots)!=null&&C.panelLeft||(i.value="div"),(D=(I=r.slots)==null?void 0:I.panelLeft)!=null&&D.includes("<")){const G=e("PanelLeft",(R=r.slots)==null?void 0:R.panelLeft,["name"]);i.value=G}else i.value=($=r.slots)==null?void 0:$.panelLeft},u=()=>{var C,I,D,R,$;if((C=r.slots)!=null&&C.panelRight||(n.value="div"),(D=(I=r.slots)==null?void 0:I.panelRight)!=null&&D.includes("<")){const G=e("PanelRight",(R=r.slots)==null?void 0:R.panelRight,["name"]);n.value=G}else n.value=($=r.slots)==null?void 0:$.panelRight};return a(),u(),(C,I)=>(f.openBlock(),f.createElementBlock("div",mq,[(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,k,E,C,I,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=((u=decodeURI((a=(r=this.$route)==null?void 0:r.query)==null?void 0:a.filter))==null?void 0:u.replaceAll("+"," "))||null,this.filterState=((g=(l=this.$route)==null?void 0:l.query)==null?void 0:g.filterState)||null,this.filterCustom=((k=(b=this.$route)==null?void 0:b.query)==null?void 0:k.custom)||null,this.searchValue=((C=(E=this.$route)==null?void 0:E.query)==null?void 0:C.search)||"",this.visibleColumns=((R=(D=(I=this.$route)==null?void 0:I.query)==null?void 0:D.columns)==null?void 0:R.split(","))||[],($=this.$route)!=null&&$.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,k;try{const{data:E}=await rt.get(`/api/template/table/${this.table}`),C=await rt.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(I=>(I==null?void 0:I.hidden)!==!0))==null?void 0:r.map(I=>I==null?void 0:I.name))==null?void 0:a.join(","),(u=this.visibleColumns)!=null&&u.length?(l=this.tableData)==null||l.columns.forEach(I=>{var D;(D=this.visibleColumns)!=null&&D.includes(I==null?void 0:I.name)?I.hidden=!1:I.hidden=!0}):this.visibleColumns=(k=(b=(g=this.tableData)==null?void 0:g.columns)==null?void 0:b.filter(I=>(I==null?void 0:I.hidden)!==!0))==null?void 0:k.map(I=>I==null?void 0:I.name)}catch{}},async getFilters(){var t;try{const{data:e}=await rt.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}})}}},yq={class:"w-[calc(100vw - 320px)] bg-gray-50"},_q={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},bq={class:"text-xl font-medium"},xq={style:{height:"calc(100vh - 155px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex pt-[10px]"},vq={class:"bg-white w-full rounded-xl border p-[20px] pr-0"},wq={class:"flex"},kq={class:"flex gap-[6px] ml-auto"},Sq={class:"inline-block w-full align-middle"},Eq={key:0,class:"relative min-w-full divide-y divide-gray-200 table-fixed dark:divide-neutral-700"},Cq={class:"sticky top-[-1px] bg-white w-full after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},Tq={class:"right-0 border-t border-stone-200"},Mq={key:0,class:"w-[70px] sticky right-0 top-0"},Aq={class:"divide-y divide-gray-200"},Iq={class:"px-4 py-3 text-sm text-gray-600"},Pq=["onClick"],Dq=["onClick"],Oq={class:"p-[20px] flex justify-start items-center w-full"},Bq={class:"w-[200px]"},zq={class:"text-sm text-gray-600 dark:text-neutral-400"},Nq={class:"font-semibold text-gray-800 dark:text-neutral-200"},Rq={key:0},Lq={key:0,class:"font-semibold text-gray-800 dark:text-neutral-200"};function Vq(t,e,n,i,r,a){var Ce,Le,Ie,Ue,Je,It,ot,zt,Xt,on,$t,Kt,Cn,dn,vn,pn,ti,Nn,Pn,Rn,Te,He;const u=f.resolveComponent("IconPlus"),l=f.resolveComponent("router-link"),g=f.resolveComponent("AdminTableTabs"),b=f.resolveComponent("IconSearch"),k=f.resolveComponent("VsText"),E=f.resolveComponent("AdminTableCustomButtons"),C=f.resolveComponent("AdminTableCustomFilters"),I=f.resolveComponent("AdminTableColumnsHidden"),D=f.resolveComponent("AdminTableExport"),R=f.resolveComponent("AdminTableFilters"),$=f.resolveComponent("IconOpenCard"),G=f.resolveComponent("AdminTableColumn"),q=f.resolveComponent("AdminComponentIs"),se=f.resolveComponent("AdminTableControl"),Q=f.resolveComponent("AdminNodata"),Se=f.resolveComponent("VsPagination"),_e=f.resolveComponent("AdminTableCardInfo");return f.openBlock(),f.createElementBlock("div",yq,[f.createElementVNode("div",_q,[f.createElementVNode("h2",bq,f.toDisplayString(n.title),1),a.isForm?(f.openBlock(),f.createBlock(l,{key:0,to:`/add?table=${(Le=(Ce=t.$route)==null?void 0:Ce.params)==null?void 0:Le.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",xq,[f.createElementVNode("div",vq,[(Ue=(Ie=r.tableData)==null?void 0:Ie.filterState)!=null&&Ue.length?(f.openBlock(),f.createBlock(g,{key:0,tabsList:(Je=r.tableData)==null?void 0:Je.filterState,filterState:r.filterState,"onUpdate:filterState":e[0]||(e[0]=De=>r.filterState=De)},null,8,["tabsList","filterState"])):f.createCommentVNode("",!0),f.createElementVNode("div",wq,[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(k,{modelValue:r.searchValue,"onUpdate:modelValue":e[1]||(e[1]=De=>r.searchValue=De),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",kq,[(It=r.tableData)!=null&&It.slots?(f.openBlock(),f.createBlock(E,{key:0,slots:(ot=r.tableData)==null?void 0:ot.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]=De=>r.filterCustom=De)},null,8,["customList","filterCustom"])):f.createCommentVNode("",!0),f.createVNode(I,{columns:($t=r.tableData)==null?void 0:$t.columns,onUpdateColumns:e[3]||(e[3]=De=>r.tableData.columns=De)},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]=(...De)=>a.toggleCardInfo&&a.toggleCardInfo(...De)),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($,{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",Sq,[a.isNoData?(f.openBlock(),f.createBlock(Q,{key:1})):(f.openBlock(),f.createElementBlock("table",Eq,[f.createElementVNode("thead",Cq,[f.createElementVNode("tr",Tq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.columns,De=>(f.openBlock(),f.createBlock(G,{key:De.name,style:f.normalizeStyle({width:a.rowWidth(De==null?void 0:De.name),textAlign:De==null?void 0:De.align,wordBreak:De==null?void 0:De.wrap}),data:De,activeColumn:r.activeColumn,onChangeActive:a.changeActiveColumn},null,8,["style","data","activeColumn","onChangeActive"]))),128)),(ti=(pn=a.getActions)==null?void 0:pn.filter(De=>De!=="add"))!=null&&ti.length?(f.openBlock(),f.createElementBlock("th",Mq)):f.createCommentVNode("",!0)])]),f.createElementVNode("tbody",Aq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Nn=r.tableData)==null?void 0:Nn.rows,(De,ct)=>{var Nt,Jt,Mt,Tt,nn,we,yn,pr,jt,sn;return f.openBlock(),f.createElementBlock("tr",{key:ct,class:f.normalizeClass({"bg-gray-50":((Jt=(Nt=t.$route)==null?void 0:Nt.query)==null?void 0:Jt.card)===(De==null?void 0:De.id)})},[f.createElementVNode("td",Iq,[f.createElementVNode("button",{onClick:()=>a.pushToCard(De==null?void 0:De.id),class:f.normalizeClass(["text-sm font-medium",[((Mt=r.tableData)==null?void 0:Mt.card)===!1?"":"text-blue-600 decoration-2 focus:outline-none focus:underline hover:text-blue-600 hover:underline"]])},[f.createVNode(q,{row:De,column:a.columns[0],table:n.table,onUpdateTable:a.getTableData},null,8,["row","column","table","onUpdateTable"])],10,Pq)]),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Tt=a.columns)==null?void 0:Tt.slice(1),ui=>(f.openBlock(),f.createElementBlock("td",{onClick:Hi=>a.changeActiveCardInfo(De==null?void 0:De.id),class:f.normalizeClass(["px-3 py-3 text-sm text-gray-600 text-start whitespace-nowrap",{"cursor-pointer":r.isVisibleCardInfo}]),key:ui.name},[f.createVNode(q,{row:De,column:ui,table:n.table,onUpdateTable:a.getTableData},null,8,["row","column","table","onUpdateTable"])],10,Dq))),128)),(we=(nn=a.getActions)==null?void 0:nn.filter(ui=>ui!=="add"))!=null&&we.length?(f.openBlock(),f.createElementBlock("td",{key:0,class:f.normalizeClass(["text-center sticky right-0 w-[80px] px-[10px]",{"bg-gray-50":((pr=(yn=t.$route)==null?void 0:yn.query)==null?void 0:pr.card)===(De==null?void 0:De.id),"bg-white":((sn=(jt=t.$route)==null?void 0:jt.query)==null?void 0:sn.card)!==(De==null?void 0:De.id)}])},[f.createVNode(se,{actions:a.getActions,isForm:a.isForm,item:De,table:n.table,onUpdateTable:a.getTableData},null,8,["actions","isForm","item","table","onUpdateTable"])],2)):f.createCommentVNode("",!0)],2)}),128))])]))])],4)],2),f.createElementVNode("div",Oq,[f.createElementVNode("div",Bq,[f.createElementVNode("p",zq,[f.createElementVNode("span",Nq,[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",Rq," з")):f.createCommentVNode("",!0)]),r.filters||r.searchValue?(f.openBlock(),f.createElementBlock("span",Lq,f.toDisplayString(" "+((Rn=r.tableData)==null?void 0:Rn.filtered)||0),1)):f.createCommentVNode("",!0)])]),Math.ceil(((Te=r.tableData)==null?void 0:Te.filtered)/r.limit)>1?(f.openBlock(),f.createBlock(Se,{key:0,goTo:!1,class:"justify-end","default-page":parseInt(a.defaultPage),total:((He=r.tableData)==null?void 0:He.filtered)||0,pageSize:parseInt(r.limit),onPageChange:a.handlePageChange,pageSizes:[10,16,20],onPageSizeChange:a.changeLimit,backgroundColor:"#F3F4F6"},null,8,["default-page","total","pageSize","onPageChange","onPageSizeChange"])):f.createCommentVNode("",!0)])],2),f.createVNode(f.Transition,{name:"slide-fade"},{default:f.withCtx(()=>{var De;return[r.isVisibleCardInfo?(f.openBlock(),f.createBlock(_e,{key:0,table:n.table,columns:(De=r.tableData)==null?void 0:De.columns,row:a.activeCardRow},null,8,["table","columns","row"])):f.createCommentVNode("",!0)]}),_:1})])])])])}const Fq={components:{AdminTable:$e(gq,[["render",Vq],["__scopeId","data-v-c62adcdb"]])},data(){return{table:!1,interface:"",title:""}},watch:{$route:{async handler(){So!=null&&So.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(So.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 rt.get(`/api/template/interface/${((e=(t=this.$route)==null?void 0:t.params)==null?void 0:e.catchAll)||""}`);this.interface=n||""}catch{this.interface=""}}}},$q=["innerHTML"];function jq(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,$q))}const Uq=Object.freeze(Object.defineProperty({__proto__:null,default:$e(Fq,[["render",jq]])},Symbol.toStringTag,{value:"Module"}));return Dj});