@opengis/admin 0.1.38 → 0.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -29
- package/config.js +4 -4
- package/dist/{add-page-C5g2yN5N.js → add-page-CYAz9FdO.js} +1 -1
- package/dist/{admin-interface-zpEN5ODZ.js → admin-interface-BfY0EPQi.js} +1 -1
- package/dist/{admin-view-DD8_bEjC.js → admin-view-CcyuPjSQ.js} +2 -2
- package/dist/admin.js +1 -1
- package/dist/admin.umd.cjs +5 -5
- package/dist/{card-page-BpMHxKbw.js → card-page-DV3pe4fv.js} +21 -21
- package/dist/{card-view-Ddro0nc4.js → card-view-pwoN8ZHo.js} +1 -1
- package/dist/{edit-page-BL9SogVY.js → edit-page-PNY_GQBC.js} +1 -1
- package/dist/{import-file-DBSDU17c.js → import-file-aqrl_bc7.js} +20 -13
- package/dist/style.css +1 -1
- package/module/settings/card/admin.roles.table/access.hbs +27 -27
- package/module/settings/card/admin.roles.table/general_info.hbs +16 -16
- package/module/settings/card/admin.roles.table/index.yml +14 -14
- package/module/settings/card/admin.roles.table/users.hbs +27 -27
- package/module/settings/card/admin.routes.table/general_info.hbs +40 -40
- package/module/settings/card/admin.routes.table/index.yml +8 -8
- package/module/settings/card/admin.routes.table/users.hbs +33 -33
- package/module/settings/card/admin.users.table/general_info.hbs +25 -25
- package/module/settings/card/admin.users.table/index.yml +12 -12
- package/module/settings/card/admin.users.table/logs.hbs +30 -30
- package/module/settings/card/admin.users.table/user_roles.hbs +24 -24
- package/module/settings/cls/core.actions.json +13 -13
- package/module/settings/cls/core.scope.json +13 -13
- package/module/settings/cls/properties.site_status.json +13 -13
- package/module/settings/cls/properties.widget_status.json +13 -13
- package/module/settings/cls/users.user_type.json +13 -13
- package/module/settings/form/admin.access.form.json +36 -36
- package/module/settings/form/admin.properties.form.json +15 -15
- package/module/settings/form/admin.roles.form.json +19 -19
- package/module/settings/form/admin.routes.form.json +25 -25
- package/module/settings/form/admin.table_properties.form.json +70 -70
- package/module/settings/form/admin.user_properties.form.json +15 -15
- package/module/settings/form/admin.user_roles.form.json +21 -21
- package/module/settings/form/admin.users.form.json +150 -150
- package/module/settings/form/user.user_roles.form.json +13 -13
- package/module/settings/interface/admin.properties.json +4 -4
- package/module/settings/interface/admin.roles.json +4 -4
- package/module/settings/interface/admin.routes.json +4 -4
- package/module/settings/interface/admin.users.json +4 -4
- package/module/settings/menu.json +50 -50
- package/module/settings/select/core.roles.json +2 -2
- package/module/settings/select/core.user_uid.sql +1 -1
- package/module/settings/table/admin.access.table.json +77 -77
- package/module/settings/table/admin.properties.table.json +33 -33
- package/module/settings/table/admin.roles.table.json +58 -58
- package/module/settings/table/admin.routes.table.json +55 -55
- package/module/settings/table/admin.table_properties.table.json +81 -81
- package/module/settings/table/admin.user_properties.table.json +28 -28
- package/module/settings/table/admin.user_roles.table.json +66 -66
- package/module/settings/table/admin.users.table.json +119 -119
- package/package.json +74 -74
- package/plugin.js +101 -101
- package/server/helpers/controllers/badge.js +11 -11
- package/server/helpers/controllers/hb.js +2 -2
- package/server/helpers/controllers/map.js +2 -2
- package/server/helpers/controllers/mls.js +2 -2
- package/server/helpers/controllers/vue.js +2 -2
- package/server/helpers/index.mjs +13 -13
- package/server/plugins/docs.js +28 -28
- package/server/plugins/hook.js +166 -166
- package/server/plugins/vite.js +69 -69
- package/server/routes/data/controllers/cardData.js +56 -56
- package/server/routes/data/controllers/cardTabData.js +39 -39
- package/server/routes/data/controllers/funcs/getFilterSQL/index.js +85 -85
- package/server/routes/data/controllers/funcs/getFilterSQL/util/formatValue.js +145 -142
- package/server/routes/data/controllers/funcs/getFilterSQL/util/getCustomQuery.js +13 -13
- package/server/routes/data/controllers/funcs/getFilterSQL/util/getFilterQuery.js +67 -67
- package/server/routes/data/controllers/funcs/getFilterSQL/util/getOptimizedQuery.js +12 -12
- package/server/routes/data/controllers/funcs/getFilterSQL/util/getTableSql.js +34 -34
- package/server/routes/data/controllers/tableData.js +121 -121
- package/server/routes/data/controllers/tableDataId.js +27 -27
- package/server/routes/data/controllers/tableFilter.js +55 -55
- package/server/routes/data/controllers/utils/assignTokens.js +30 -30
- package/server/routes/data/controllers/utils/getColumns.js +21 -21
- package/server/routes/data/index.mjs +12 -12
- package/server/routes/menu/controllers/getMenu.js +33 -33
- package/server/routes/menu/index.mjs +5 -5
- package/server/routes/properties/controllers/admin.properties.get.js +29 -29
- package/server/routes/properties/controllers/user.properties.get.js +34 -34
- package/server/routes/properties/controllers/user.properties.post.js +30 -30
- package/server/routes/properties/funcs/getSettings.js +56 -56
- package/server/routes/properties/funcs/setSettings.js +44 -44
- package/server/routes/properties/funcs/utils/dataInsert.js +26 -26
- package/server/routes/properties/index.mjs +26 -26
- package/server/routes/root.mjs +3 -3
- package/server/routes/templates/controllers/getTemplate.js +14 -14
- package/server/routes/templates/index.mjs +14 -14
- package/server/templates/cls/itree.recrzone_category.json +73 -73
- package/server/templates/cls/test.json +9 -9
- package/server/templates/form/admin.user_cls.data.form.json +49 -49
- package/server/templates/form/admin.user_group_rel.form.json +21 -21
- package/server/templates/form/cp_building.form.json +32 -32
- package/server/templates/form/form-user-pass.json +10 -10
- package/server/templates/form/form-user_group.json +39 -39
- package/server/templates/form/form-users.json +156 -156
- package/server/templates/form/user_group_access.form.json +22 -22
- package/server/templates/select/account_id.json +2 -2
- package/server/templates/table/gis.dataset.table.json +43 -43
- package/server/templates/table/management.user_group.table.json +112 -112
- package/server/templates/table/management.users.table.json +126 -126
- package/utils.js +8 -8
package/dist/admin.umd.cjs
CHANGED
|
@@ -42,7 +42,7 @@ var Nb;function lt(){return Nb.apply(null,arguments)}function BA(t){Nb=t}functio
|
|
|
42
42
|
[`+a+"] ";for(u in arguments[0])gn(arguments[0],u)&&(r+=u+": "+arguments[0][u]+", ");r=r.slice(0,-2)}else r=arguments[a];i.push(r)}Fb(t+`
|
|
43
43
|
Arguments: `+Array.prototype.slice.call(i).join("")+`
|
|
44
44
|
`+new Error().stack),n=!1}return e.apply(this,arguments)},e)}var $b={};function jb(t,e){lt.deprecationHandler!=null&<.deprecationHandler(t,e),$b[t]||(Fb(e),$b[t]=!0)}lt.suppressDeprecationWarnings=!1,lt.deprecationHandler=null;function Xs(t){return typeof Function<"u"&&t instanceof Function||Object.prototype.toString.call(t)==="[object Function]"}function FA(t){var e,n;for(n in t)gn(t,n)&&(e=t[n],Xs(e)?this[n]=e:this["_"+n]=e);this._config=t,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function Mg(t,e){var n=aa({},t),i;for(i in e)gn(e,i)&&(hl(t[i])&&hl(e[i])?(n[i]={},aa(n[i],t[i]),aa(n[i],e[i])):e[i]!=null?n[i]=e[i]:delete n[i]);for(i in t)gn(t,i)&&!gn(e,i)&&hl(t[i])&&(n[i]=aa({},n[i]));return n}function Ag(t){t!=null&&this.set(t)}var Pg;Object.keys?Pg=Object.keys:Pg=function(t){var e,n=[];for(e in t)gn(t,e)&&n.push(e);return n};var $A={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function jA(t,e,n){var i=this._calendar[t]||this._calendar.sameElse;return Xs(i)?i.call(e,n):i}function Ks(t,e,n){var i=""+Math.abs(t),r=e-i.length,a=t>=0;return(a?n?"+":"":"-")+Math.pow(10,Math.max(0,r)).toString().substr(1)+i}var Ig=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,mp=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Dg={},mc={};function Mt(t,e,n,i){var r=i;typeof i=="string"&&(r=function(){return this[i]()}),t&&(mc[t]=r),e&&(mc[e[0]]=function(){return Ks(r.apply(this,arguments),e[1],e[2])}),n&&(mc[n]=function(){return this.localeData().ordinal(r.apply(this,arguments),t)})}function UA(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function HA(t){var e=t.match(Ig),n,i;for(n=0,i=e.length;n<i;n++)mc[e[n]]?e[n]=mc[e[n]]:e[n]=UA(e[n]);return function(r){var a="",u;for(u=0;u<i;u++)a+=Xs(e[u])?e[u].call(r,t):e[u];return a}}function gp(t,e){return t.isValid()?(e=Ub(e,t.localeData()),Dg[e]=Dg[e]||HA(e),Dg[e](t)):t.localeData().invalidDate()}function Ub(t,e){var n=5;function i(r){return e.longDateFormat(r)||r}for(mp.lastIndex=0;n>=0&&mp.test(t);)t=t.replace(mp,i),mp.lastIndex=0,n-=1;return t}var qA={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function WA(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.match(Ig).map(function(i){return i==="MMMM"||i==="MM"||i==="DD"||i==="dddd"?i.slice(1):i}).join(""),this._longDateFormat[t])}var GA="Invalid date";function ZA(){return this._invalidDate}var YA="%d",XA=/\d{1,2}/;function KA(t){return this._ordinal.replace("%d",t)}var JA={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function QA(t,e,n,i){var r=this._relativeTime[n];return Xs(r)?r(t,e,n,i):r.replace(/%d/i,t)}function eP(t,e){var n=this._relativeTime[t>0?"future":"past"];return Xs(n)?n(e):n.replace(/%s/i,e)}var Hb={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function hs(t){return typeof t=="string"?Hb[t]||Hb[t.toLowerCase()]:void 0}function Og(t){var e={},n,i;for(i in t)gn(t,i)&&(n=hs(i),n&&(e[n]=t[i]));return e}var tP={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function nP(t){var e=[],n;for(n in t)gn(t,n)&&e.push({unit:n,priority:tP[n]});return e.sort(function(i,r){return i.priority-r.priority}),e}var qb=/\d/,qr=/\d\d/,Wb=/\d{3}/,zg=/\d{4}/,yp=/[+-]?\d{6}/,Hn=/\d\d?/,Gb=/\d\d\d\d?/,Zb=/\d\d\d\d\d\d?/,_p=/\d{1,3}/,Rg=/\d{1,4}/,xp=/[+-]?\d{1,6}/,gc=/\d+/,bp=/[+-]?\d+/,iP=/Z|[+-]\d\d:?\d\d/gi,vp=/Z|[+-]\d\d(?::?\d\d)?/gi,rP=/[+-]?\d+(\.\d{1,3})?/,sh=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,yc=/^[1-9]\d?/,Lg=/^([1-9]\d|\d)/,wp;wp={};function yt(t,e,n){wp[t]=Xs(e)?e:function(i,r){return i&&n?n:e}}function sP(t,e){return gn(wp,t)?wp[t](e._strict,e._locale):new RegExp(oP(t))}function oP(t){return wo(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,n,i,r,a){return n||i||r||a}))}function wo(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function ds(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function an(t){var e=+t,n=0;return e!==0&&isFinite(e)&&(n=ds(e)),n}var Ng={};function zn(t,e){var n,i=e,r;for(typeof t=="string"&&(t=[t]),vo(e)&&(i=function(a,u){u[e]=an(a)}),r=t.length,n=0;n<r;n++)Ng[t[n]]=i}function oh(t,e){zn(t,function(n,i,r,a){r._w=r._w||{},e(n,r._w,r,a)})}function aP(t,e,n){e!=null&&gn(Ng,t)&&Ng[t](e,n._a,n,t)}function kp(t){return t%4===0&&t%100!==0||t%400===0}var Yi=0,ko=1,Js=2,_i=3,Ns=4,So=5,dl=6,lP=7,cP=8;Mt("Y",0,0,function(){var t=this.year();return t<=9999?Ks(t,4):"+"+t}),Mt(0,["YY",2],0,function(){return this.year()%100}),Mt(0,["YYYY",4],0,"year"),Mt(0,["YYYYY",5],0,"year"),Mt(0,["YYYYYY",6,!0],0,"year"),yt("Y",bp),yt("YY",Hn,qr),yt("YYYY",Rg,zg),yt("YYYYY",xp,yp),yt("YYYYYY",xp,yp),zn(["YYYYY","YYYYYY"],Yi),zn("YYYY",function(t,e){e[Yi]=t.length===2?lt.parseTwoDigitYear(t):an(t)}),zn("YY",function(t,e){e[Yi]=lt.parseTwoDigitYear(t)}),zn("Y",function(t,e){e[Yi]=parseInt(t,10)});function ah(t){return kp(t)?366:365}lt.parseTwoDigitYear=function(t){return an(t)+(an(t)>68?1900:2e3)};var Yb=_c("FullYear",!0);function uP(){return kp(this.year())}function _c(t,e){return function(n){return n!=null?(Xb(this,t,n),lt.updateOffset(this,e),this):lh(this,t)}}function lh(t,e){if(!t.isValid())return NaN;var n=t._d,i=t._isUTC;switch(e){case"Milliseconds":return i?n.getUTCMilliseconds():n.getMilliseconds();case"Seconds":return i?n.getUTCSeconds():n.getSeconds();case"Minutes":return i?n.getUTCMinutes():n.getMinutes();case"Hours":return i?n.getUTCHours():n.getHours();case"Date":return i?n.getUTCDate():n.getDate();case"Day":return i?n.getUTCDay():n.getDay();case"Month":return i?n.getUTCMonth():n.getMonth();case"FullYear":return i?n.getUTCFullYear():n.getFullYear();default:return NaN}}function Xb(t,e,n){var i,r,a,u,l;if(!(!t.isValid()||isNaN(n))){switch(i=t._d,r=t._isUTC,e){case"Milliseconds":return void(r?i.setUTCMilliseconds(n):i.setMilliseconds(n));case"Seconds":return void(r?i.setUTCSeconds(n):i.setSeconds(n));case"Minutes":return void(r?i.setUTCMinutes(n):i.setMinutes(n));case"Hours":return void(r?i.setUTCHours(n):i.setHours(n));case"Date":return void(r?i.setUTCDate(n):i.setDate(n));case"FullYear":break;default:return}a=n,u=t.month(),l=t.date(),l=l===29&&u===1&&!kp(a)?28:l,r?i.setUTCFullYear(a,u,l):i.setFullYear(a,u,l)}}function hP(t){return t=hs(t),Xs(this[t])?this[t]():this}function dP(t,e){if(typeof t=="object"){t=Og(t);var n=nP(t),i,r=n.length;for(i=0;i<r;i++)this[n[i].unit](t[n[i].unit])}else if(t=hs(t),Xs(this[t]))return this[t](e);return this}function pP(t,e){return(t%e+e)%e}var ai;Array.prototype.indexOf?ai=Array.prototype.indexOf:ai=function(t){var e;for(e=0;e<this.length;++e)if(this[e]===t)return e;return-1};function Bg(t,e){if(isNaN(t)||isNaN(e))return NaN;var n=pP(e,12);return t+=(e-n)/12,n===1?kp(t)?29:28:31-n%7%2}Mt("M",["MM",2],"Mo",function(){return this.month()+1}),Mt("MMM",0,0,function(t){return this.localeData().monthsShort(this,t)}),Mt("MMMM",0,0,function(t){return this.localeData().months(this,t)}),yt("M",Hn,yc),yt("MM",Hn,qr),yt("MMM",function(t,e){return e.monthsShortRegex(t)}),yt("MMMM",function(t,e){return e.monthsRegex(t)}),zn(["M","MM"],function(t,e){e[ko]=an(t)-1}),zn(["MMM","MMMM"],function(t,e,n,i){var r=n._locale.monthsParse(t,i,n._strict);r!=null?e[ko]=r:Wt(n).invalidMonth=t});var fP="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Kb="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Jb=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,mP=sh,gP=sh;function yP(t,e){return t?Rs(this._months)?this._months[t.month()]:this._months[(this._months.isFormat||Jb).test(e)?"format":"standalone"][t.month()]:Rs(this._months)?this._months:this._months.standalone}function _P(t,e){return t?Rs(this._monthsShort)?this._monthsShort[t.month()]:this._monthsShort[Jb.test(e)?"format":"standalone"][t.month()]:Rs(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function xP(t,e,n){var i,r,a,u=t.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],i=0;i<12;++i)a=Ys([2e3,i]),this._shortMonthsParse[i]=this.monthsShort(a,"").toLocaleLowerCase(),this._longMonthsParse[i]=this.months(a,"").toLocaleLowerCase();return n?e==="MMM"?(r=ai.call(this._shortMonthsParse,u),r!==-1?r:null):(r=ai.call(this._longMonthsParse,u),r!==-1?r:null):e==="MMM"?(r=ai.call(this._shortMonthsParse,u),r!==-1?r:(r=ai.call(this._longMonthsParse,u),r!==-1?r:null)):(r=ai.call(this._longMonthsParse,u),r!==-1?r:(r=ai.call(this._shortMonthsParse,u),r!==-1?r:null))}function bP(t,e,n){var i,r,a;if(this._monthsParseExact)return xP.call(this,t,e,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),i=0;i<12;i++){if(r=Ys([2e3,i]),n&&!this._longMonthsParse[i]&&(this._longMonthsParse[i]=new RegExp("^"+this.months(r,"").replace(".","")+"$","i"),this._shortMonthsParse[i]=new RegExp("^"+this.monthsShort(r,"").replace(".","")+"$","i")),!n&&!this._monthsParse[i]&&(a="^"+this.months(r,"")+"|^"+this.monthsShort(r,""),this._monthsParse[i]=new RegExp(a.replace(".",""),"i")),n&&e==="MMMM"&&this._longMonthsParse[i].test(t))return i;if(n&&e==="MMM"&&this._shortMonthsParse[i].test(t))return i;if(!n&&this._monthsParse[i].test(t))return i}}function Qb(t,e){if(!t.isValid())return t;if(typeof e=="string"){if(/^\d+$/.test(e))e=an(e);else if(e=t.localeData().monthsParse(e),!vo(e))return t}var n=e,i=t.date();return i=i<29?i:Math.min(i,Bg(t.year(),n)),t._isUTC?t._d.setUTCMonth(n,i):t._d.setMonth(n,i),t}function e1(t){return t!=null?(Qb(this,t),lt.updateOffset(this,!0),this):lh(this,"Month")}function vP(){return Bg(this.year(),this.month())}function wP(t){return this._monthsParseExact?(gn(this,"_monthsRegex")||t1.call(this),t?this._monthsShortStrictRegex:this._monthsShortRegex):(gn(this,"_monthsShortRegex")||(this._monthsShortRegex=mP),this._monthsShortStrictRegex&&t?this._monthsShortStrictRegex:this._monthsShortRegex)}function kP(t){return this._monthsParseExact?(gn(this,"_monthsRegex")||t1.call(this),t?this._monthsStrictRegex:this._monthsRegex):(gn(this,"_monthsRegex")||(this._monthsRegex=gP),this._monthsStrictRegex&&t?this._monthsStrictRegex:this._monthsRegex)}function t1(){function t(g,_){return _.length-g.length}var e=[],n=[],i=[],r,a,u,l;for(r=0;r<12;r++)a=Ys([2e3,r]),u=wo(this.monthsShort(a,"")),l=wo(this.months(a,"")),e.push(u),n.push(l),i.push(l),i.push(u);e.sort(t),n.sort(t),i.sort(t),this._monthsRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+e.join("|")+")","i")}function SP(t,e,n,i,r,a,u){var l;return t<100&&t>=0?(l=new Date(t+400,e,n,i,r,a,u),isFinite(l.getFullYear())&&l.setFullYear(t)):l=new Date(t,e,n,i,r,a,u),l}function ch(t){var e,n;return t<100&&t>=0?(n=Array.prototype.slice.call(arguments),n[0]=t+400,e=new Date(Date.UTC.apply(null,n)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t)):e=new Date(Date.UTC.apply(null,arguments)),e}function Sp(t,e,n){var i=7+e-n,r=(7+ch(t,0,i).getUTCDay()-e)%7;return-r+i-1}function n1(t,e,n,i,r){var a=(7+n-i)%7,u=Sp(t,i,r),l=1+7*(e-1)+a+u,g,_;return l<=0?(g=t-1,_=ah(g)+l):l>ah(t)?(g=t+1,_=l-ah(t)):(g=t,_=l),{year:g,dayOfYear:_}}function uh(t,e,n){var i=Sp(t.year(),e,n),r=Math.floor((t.dayOfYear()-i-1)/7)+1,a,u;return r<1?(u=t.year()-1,a=r+Eo(u,e,n)):r>Eo(t.year(),e,n)?(a=r-Eo(t.year(),e,n),u=t.year()+1):(u=t.year(),a=r),{week:a,year:u}}function Eo(t,e,n){var i=Sp(t,e,n),r=Sp(t+1,e,n);return(ah(t)-i+r)/7}Mt("w",["ww",2],"wo","week"),Mt("W",["WW",2],"Wo","isoWeek"),yt("w",Hn,yc),yt("ww",Hn,qr),yt("W",Hn,yc),yt("WW",Hn,qr),oh(["w","ww","W","WW"],function(t,e,n,i){e[i.substr(0,1)]=an(t)});function EP(t){return uh(t,this._week.dow,this._week.doy).week}var CP={dow:0,doy:6};function TP(){return this._week.dow}function MP(){return this._week.doy}function AP(t){var e=this.localeData().week(this);return t==null?e:this.add((t-e)*7,"d")}function PP(t){var e=uh(this,1,4).week;return t==null?e:this.add((t-e)*7,"d")}Mt("d",0,"do","day"),Mt("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),Mt("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),Mt("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),Mt("e",0,0,"weekday"),Mt("E",0,0,"isoWeekday"),yt("d",Hn),yt("e",Hn),yt("E",Hn),yt("dd",function(t,e){return e.weekdaysMinRegex(t)}),yt("ddd",function(t,e){return e.weekdaysShortRegex(t)}),yt("dddd",function(t,e){return e.weekdaysRegex(t)}),oh(["dd","ddd","dddd"],function(t,e,n,i){var r=n._locale.weekdaysParse(t,i,n._strict);r!=null?e.d=r:Wt(n).invalidWeekday=t}),oh(["d","e","E"],function(t,e,n,i){e[i]=an(t)});function IP(t,e){return typeof t!="string"?t:isNaN(t)?(t=e.weekdaysParse(t),typeof t=="number"?t:null):parseInt(t,10)}function DP(t,e){return typeof t=="string"?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function Vg(t,e){return t.slice(e,7).concat(t.slice(0,e))}var OP="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),i1="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),zP="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),RP=sh,LP=sh,NP=sh;function BP(t,e){var n=Rs(this._weekdays)?this._weekdays:this._weekdays[t&&t!==!0&&this._weekdays.isFormat.test(e)?"format":"standalone"];return t===!0?Vg(n,this._week.dow):t?n[t.day()]:n}function VP(t){return t===!0?Vg(this._weekdaysShort,this._week.dow):t?this._weekdaysShort[t.day()]:this._weekdaysShort}function FP(t){return t===!0?Vg(this._weekdaysMin,this._week.dow):t?this._weekdaysMin[t.day()]:this._weekdaysMin}function $P(t,e,n){var i,r,a,u=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],i=0;i<7;++i)a=Ys([2e3,1]).day(i),this._minWeekdaysParse[i]=this.weekdaysMin(a,"").toLocaleLowerCase(),this._shortWeekdaysParse[i]=this.weekdaysShort(a,"").toLocaleLowerCase(),this._weekdaysParse[i]=this.weekdays(a,"").toLocaleLowerCase();return n?e==="dddd"?(r=ai.call(this._weekdaysParse,u),r!==-1?r:null):e==="ddd"?(r=ai.call(this._shortWeekdaysParse,u),r!==-1?r:null):(r=ai.call(this._minWeekdaysParse,u),r!==-1?r:null):e==="dddd"?(r=ai.call(this._weekdaysParse,u),r!==-1||(r=ai.call(this._shortWeekdaysParse,u),r!==-1)?r:(r=ai.call(this._minWeekdaysParse,u),r!==-1?r:null)):e==="ddd"?(r=ai.call(this._shortWeekdaysParse,u),r!==-1||(r=ai.call(this._weekdaysParse,u),r!==-1)?r:(r=ai.call(this._minWeekdaysParse,u),r!==-1?r:null)):(r=ai.call(this._minWeekdaysParse,u),r!==-1||(r=ai.call(this._weekdaysParse,u),r!==-1)?r:(r=ai.call(this._shortWeekdaysParse,u),r!==-1?r:null))}function jP(t,e,n){var i,r,a;if(this._weekdaysParseExact)return $P.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),i=0;i<7;i++){if(r=Ys([2e3,1]).day(i),n&&!this._fullWeekdaysParse[i]&&(this._fullWeekdaysParse[i]=new RegExp("^"+this.weekdays(r,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[i]=new RegExp("^"+this.weekdaysShort(r,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[i]=new RegExp("^"+this.weekdaysMin(r,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[i]||(a="^"+this.weekdays(r,"")+"|^"+this.weekdaysShort(r,"")+"|^"+this.weekdaysMin(r,""),this._weekdaysParse[i]=new RegExp(a.replace(".",""),"i")),n&&e==="dddd"&&this._fullWeekdaysParse[i].test(t))return i;if(n&&e==="ddd"&&this._shortWeekdaysParse[i].test(t))return i;if(n&&e==="dd"&&this._minWeekdaysParse[i].test(t))return i;if(!n&&this._weekdaysParse[i].test(t))return i}}function UP(t){if(!this.isValid())return t!=null?this:NaN;var e=lh(this,"Day");return t!=null?(t=IP(t,this.localeData()),this.add(t-e,"d")):e}function HP(t){if(!this.isValid())return t!=null?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return t==null?e:this.add(t-e,"d")}function qP(t){if(!this.isValid())return t!=null?this:NaN;if(t!=null){var e=DP(t,this.localeData());return this.day(this.day()%7?e:e-7)}else return this.day()||7}function WP(t){return this._weekdaysParseExact?(gn(this,"_weekdaysRegex")||Fg.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(gn(this,"_weekdaysRegex")||(this._weekdaysRegex=RP),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function GP(t){return this._weekdaysParseExact?(gn(this,"_weekdaysRegex")||Fg.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(gn(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=LP),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function ZP(t){return this._weekdaysParseExact?(gn(this,"_weekdaysRegex")||Fg.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(gn(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=NP),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Fg(){function t(S,E){return E.length-S.length}var e=[],n=[],i=[],r=[],a,u,l,g,_;for(a=0;a<7;a++)u=Ys([2e3,1]).day(a),l=wo(this.weekdaysMin(u,"")),g=wo(this.weekdaysShort(u,"")),_=wo(this.weekdays(u,"")),e.push(l),n.push(g),i.push(_),r.push(l),r.push(g),r.push(_);e.sort(t),n.sort(t),i.sort(t),r.sort(t),this._weekdaysRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+e.join("|")+")","i")}function $g(){return this.hours()%12||12}function YP(){return this.hours()||24}Mt("H",["HH",2],0,"hour"),Mt("h",["hh",2],0,$g),Mt("k",["kk",2],0,YP),Mt("hmm",0,0,function(){return""+$g.apply(this)+Ks(this.minutes(),2)}),Mt("hmmss",0,0,function(){return""+$g.apply(this)+Ks(this.minutes(),2)+Ks(this.seconds(),2)}),Mt("Hmm",0,0,function(){return""+this.hours()+Ks(this.minutes(),2)}),Mt("Hmmss",0,0,function(){return""+this.hours()+Ks(this.minutes(),2)+Ks(this.seconds(),2)});function r1(t,e){Mt(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}r1("a",!0),r1("A",!1);function s1(t,e){return e._meridiemParse}yt("a",s1),yt("A",s1),yt("H",Hn,Lg),yt("h",Hn,yc),yt("k",Hn,yc),yt("HH",Hn,qr),yt("hh",Hn,qr),yt("kk",Hn,qr),yt("hmm",Gb),yt("hmmss",Zb),yt("Hmm",Gb),yt("Hmmss",Zb),zn(["H","HH"],_i),zn(["k","kk"],function(t,e,n){var i=an(t);e[_i]=i===24?0:i}),zn(["a","A"],function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t}),zn(["h","hh"],function(t,e,n){e[_i]=an(t),Wt(n).bigHour=!0}),zn("hmm",function(t,e,n){var i=t.length-2;e[_i]=an(t.substr(0,i)),e[Ns]=an(t.substr(i)),Wt(n).bigHour=!0}),zn("hmmss",function(t,e,n){var i=t.length-4,r=t.length-2;e[_i]=an(t.substr(0,i)),e[Ns]=an(t.substr(i,2)),e[So]=an(t.substr(r)),Wt(n).bigHour=!0}),zn("Hmm",function(t,e,n){var i=t.length-2;e[_i]=an(t.substr(0,i)),e[Ns]=an(t.substr(i))}),zn("Hmmss",function(t,e,n){var i=t.length-4,r=t.length-2;e[_i]=an(t.substr(0,i)),e[Ns]=an(t.substr(i,2)),e[So]=an(t.substr(r))});function XP(t){return(t+"").toLowerCase().charAt(0)==="p"}var KP=/[ap]\.?m?\.?/i,JP=_c("Hours",!0);function QP(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"}var o1={calendar:$A,longDateFormat:qA,invalidDate:GA,ordinal:YA,dayOfMonthOrdinalParse:XA,relativeTime:JA,months:fP,monthsShort:Kb,week:CP,weekdays:OP,weekdaysMin:zP,weekdaysShort:i1,meridiemParse:KP},Xn={},hh={},dh;function eI(t,e){var n,i=Math.min(t.length,e.length);for(n=0;n<i;n+=1)if(t[n]!==e[n])return n;return i}function a1(t){return t&&t.toLowerCase().replace("_","-")}function tI(t){for(var e=0,n,i,r,a;e<t.length;){for(a=a1(t[e]).split("-"),n=a.length,i=a1(t[e+1]),i=i?i.split("-"):null;n>0;){if(r=Ep(a.slice(0,n).join("-")),r)return r;if(i&&i.length>=n&&eI(a,i)>=n-1)break;n--}e++}return dh}function nI(t){return!!(t&&t.match("^[^/\\\\]*$"))}function Ep(t){var e=null,n;if(Xn[t]===void 0&&typeof module<"u"&&module&&module.exports&&nI(t))try{e=dh._abbr,n=require,n("./locale/"+t),la(e)}catch{Xn[t]=null}return Xn[t]}function la(t,e){var n;return t&&(Sr(e)?n=Co(t):n=jg(t,e),n?dh=n:typeof console<"u"&&console.warn&&console.warn("Locale "+t+" not found. Did you forget to load it?")),dh._abbr}function jg(t,e){if(e!==null){var n,i=o1;if(e.abbr=t,Xn[t]!=null)jb("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),i=Xn[t]._config;else if(e.parentLocale!=null)if(Xn[e.parentLocale]!=null)i=Xn[e.parentLocale]._config;else if(n=Ep(e.parentLocale),n!=null)i=n._config;else return hh[e.parentLocale]||(hh[e.parentLocale]=[]),hh[e.parentLocale].push({name:t,config:e}),null;return Xn[t]=new Ag(Mg(i,e)),hh[t]&&hh[t].forEach(function(r){jg(r.name,r.config)}),la(t),Xn[t]}else return delete Xn[t],null}function iI(t,e){if(e!=null){var n,i,r=o1;Xn[t]!=null&&Xn[t].parentLocale!=null?Xn[t].set(Mg(Xn[t]._config,e)):(i=Ep(t),i!=null&&(r=i._config),e=Mg(r,e),i==null&&(e.abbr=t),n=new Ag(e),n.parentLocale=Xn[t],Xn[t]=n),la(t)}else Xn[t]!=null&&(Xn[t].parentLocale!=null?(Xn[t]=Xn[t].parentLocale,t===la()&&la(t)):Xn[t]!=null&&delete Xn[t]);return Xn[t]}function Co(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return dh;if(!Rs(t)){if(e=Ep(t),e)return e;t=[t]}return tI(t)}function rI(){return Pg(Xn)}function Ug(t){var e,n=t._a;return n&&Wt(t).overflow===-2&&(e=n[ko]<0||n[ko]>11?ko:n[Js]<1||n[Js]>Bg(n[Yi],n[ko])?Js:n[_i]<0||n[_i]>24||n[_i]===24&&(n[Ns]!==0||n[So]!==0||n[dl]!==0)?_i:n[Ns]<0||n[Ns]>59?Ns:n[So]<0||n[So]>59?So:n[dl]<0||n[dl]>999?dl:-1,Wt(t)._overflowDayOfYear&&(e<Yi||e>Js)&&(e=Js),Wt(t)._overflowWeeks&&e===-1&&(e=lP),Wt(t)._overflowWeekday&&e===-1&&(e=cP),Wt(t).overflow=e),t}var sI=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,oI=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,aI=/Z|[+-]\d\d(?::?\d\d)?/,Cp=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Hg=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],lI=/^\/?Date\((-?\d+)/i,cI=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,uI={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function l1(t){var e,n,i=t._i,r=sI.exec(i)||oI.exec(i),a,u,l,g,_=Cp.length,S=Hg.length;if(r){for(Wt(t).iso=!0,e=0,n=_;e<n;e++)if(Cp[e][1].exec(r[1])){u=Cp[e][0],a=Cp[e][2]!==!1;break}if(u==null){t._isValid=!1;return}if(r[3]){for(e=0,n=S;e<n;e++)if(Hg[e][1].exec(r[3])){l=(r[2]||" ")+Hg[e][0];break}if(l==null){t._isValid=!1;return}}if(!a&&l!=null){t._isValid=!1;return}if(r[4])if(aI.exec(r[4]))g="Z";else{t._isValid=!1;return}t._f=u+(l||"")+(g||""),Wg(t)}else t._isValid=!1}function hI(t,e,n,i,r,a){var u=[dI(t),Kb.indexOf(e),parseInt(n,10),parseInt(i,10),parseInt(r,10)];return a&&u.push(parseInt(a,10)),u}function dI(t){var e=parseInt(t,10);return e<=49?2e3+e:e<=999?1900+e:e}function pI(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function fI(t,e,n){if(t){var i=i1.indexOf(t),r=new Date(e[0],e[1],e[2]).getDay();if(i!==r)return Wt(n).weekdayMismatch=!0,n._isValid=!1,!1}return!0}function mI(t,e,n){if(t)return uI[t];if(e)return 0;var i=parseInt(n,10),r=i%100,a=(i-r)/100;return a*60+r}function c1(t){var e=cI.exec(pI(t._i)),n;if(e){if(n=hI(e[4],e[3],e[2],e[5],e[6],e[7]),!fI(e[1],n,t))return;t._a=n,t._tzm=mI(e[8],e[9],e[10]),t._d=ch.apply(null,t._a),t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),Wt(t).rfc2822=!0}else t._isValid=!1}function gI(t){var e=lI.exec(t._i);if(e!==null){t._d=new Date(+e[1]);return}if(l1(t),t._isValid===!1)delete t._isValid;else return;if(c1(t),t._isValid===!1)delete t._isValid;else return;t._strict?t._isValid=!1:lt.createFromInputFallback(t)}lt.createFromInputFallback=us("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(t){t._d=new Date(t._i+(t._useUTC?" UTC":""))});function xc(t,e,n){return t??e??n}function yI(t){var e=new Date(lt.now());return t._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function qg(t){var e,n,i=[],r,a,u;if(!t._d){for(r=yI(t),t._w&&t._a[Js]==null&&t._a[ko]==null&&_I(t),t._dayOfYear!=null&&(u=xc(t._a[Yi],r[Yi]),(t._dayOfYear>ah(u)||t._dayOfYear===0)&&(Wt(t)._overflowDayOfYear=!0),n=ch(u,0,t._dayOfYear),t._a[ko]=n.getUTCMonth(),t._a[Js]=n.getUTCDate()),e=0;e<3&&t._a[e]==null;++e)t._a[e]=i[e]=r[e];for(;e<7;e++)t._a[e]=i[e]=t._a[e]==null?e===2?1:0:t._a[e];t._a[_i]===24&&t._a[Ns]===0&&t._a[So]===0&&t._a[dl]===0&&(t._nextDay=!0,t._a[_i]=0),t._d=(t._useUTC?ch:SP).apply(null,i),a=t._useUTC?t._d.getUTCDay():t._d.getDay(),t._tzm!=null&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[_i]=24),t._w&&typeof t._w.d<"u"&&t._w.d!==a&&(Wt(t).weekdayMismatch=!0)}}function _I(t){var e,n,i,r,a,u,l,g,_;e=t._w,e.GG!=null||e.W!=null||e.E!=null?(a=1,u=4,n=xc(e.GG,t._a[Yi],uh(qn(),1,4).year),i=xc(e.W,1),r=xc(e.E,1),(r<1||r>7)&&(g=!0)):(a=t._locale._week.dow,u=t._locale._week.doy,_=uh(qn(),a,u),n=xc(e.gg,t._a[Yi],_.year),i=xc(e.w,_.week),e.d!=null?(r=e.d,(r<0||r>6)&&(g=!0)):e.e!=null?(r=e.e+a,(e.e<0||e.e>6)&&(g=!0)):r=a),i<1||i>Eo(n,a,u)?Wt(t)._overflowWeeks=!0:g!=null?Wt(t)._overflowWeekday=!0:(l=n1(n,i,r,a,u),t._a[Yi]=l.year,t._dayOfYear=l.dayOfYear)}lt.ISO_8601=function(){},lt.RFC_2822=function(){};function Wg(t){if(t._f===lt.ISO_8601){l1(t);return}if(t._f===lt.RFC_2822){c1(t);return}t._a=[],Wt(t).empty=!0;var e=""+t._i,n,i,r,a,u,l=e.length,g=0,_,S;for(r=Ub(t._f,t._locale).match(Ig)||[],S=r.length,n=0;n<S;n++)a=r[n],i=(e.match(sP(a,t))||[])[0],i&&(u=e.substr(0,e.indexOf(i)),u.length>0&&Wt(t).unusedInput.push(u),e=e.slice(e.indexOf(i)+i.length),g+=i.length),mc[a]?(i?Wt(t).empty=!1:Wt(t).unusedTokens.push(a),aP(a,i,t)):t._strict&&!i&&Wt(t).unusedTokens.push(a);Wt(t).charsLeftOver=l-g,e.length>0&&Wt(t).unusedInput.push(e),t._a[_i]<=12&&Wt(t).bigHour===!0&&t._a[_i]>0&&(Wt(t).bigHour=void 0),Wt(t).parsedDateParts=t._a.slice(0),Wt(t).meridiem=t._meridiem,t._a[_i]=xI(t._locale,t._a[_i],t._meridiem),_=Wt(t).era,_!==null&&(t._a[Yi]=t._locale.erasConvertYear(_,t._a[Yi])),qg(t),Ug(t)}function xI(t,e,n){var i;return n==null?e:t.meridiemHour!=null?t.meridiemHour(e,n):(t.isPM!=null&&(i=t.isPM(n),i&&e<12&&(e+=12),!i&&e===12&&(e=0)),e)}function bI(t){var e,n,i,r,a,u,l=!1,g=t._f.length;if(g===0){Wt(t).invalidFormat=!0,t._d=new Date(NaN);return}for(r=0;r<g;r++)a=0,u=!1,e=Tg({},t),t._useUTC!=null&&(e._useUTC=t._useUTC),e._f=t._f[r],Wg(e),Eg(e)&&(u=!0),a+=Wt(e).charsLeftOver,a+=Wt(e).unusedTokens.length*10,Wt(e).score=a,l?a<i&&(i=a,n=e):(i==null||a<i||u)&&(i=a,n=e,u&&(l=!0));aa(t,n||e)}function vI(t){if(!t._d){var e=Og(t._i),n=e.day===void 0?e.date:e.day;t._a=Bb([e.year,e.month,n,e.hour,e.minute,e.second,e.millisecond],function(i){return i&&parseInt(i,10)}),qg(t)}}function wI(t){var e=new rh(Ug(u1(t)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function u1(t){var e=t._i,n=t._f;return t._locale=t._locale||Co(t._l),e===null||n===void 0&&e===""?fp({nullInput:!0}):(typeof e=="string"&&(t._i=e=t._locale.preparse(e)),Ls(e)?new rh(Ug(e)):(ih(e)?t._d=e:Rs(n)?bI(t):n?Wg(t):kI(t),Eg(t)||(t._d=null),t))}function kI(t){var e=t._i;Sr(e)?t._d=new Date(lt.now()):ih(e)?t._d=new Date(e.valueOf()):typeof e=="string"?gI(t):Rs(e)?(t._a=Bb(e.slice(0),function(n){return parseInt(n,10)}),qg(t)):hl(e)?vI(t):vo(e)?t._d=new Date(e):lt.createFromInputFallback(t)}function h1(t,e,n,i,r){var a={};return(e===!0||e===!1)&&(i=e,e=void 0),(n===!0||n===!1)&&(i=n,n=void 0),(hl(t)&&kg(t)||Rs(t)&&t.length===0)&&(t=void 0),a._isAMomentObject=!0,a._useUTC=a._isUTC=r,a._l=n,a._i=t,a._f=e,a._strict=i,wI(a)}function qn(t,e,n,i){return h1(t,e,n,i,!1)}var SI=us("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=qn.apply(null,arguments);return this.isValid()&&t.isValid()?t<this?this:t:fp()}),EI=us("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=qn.apply(null,arguments);return this.isValid()&&t.isValid()?t>this?this:t:fp()});function d1(t,e){var n,i;if(e.length===1&&Rs(e[0])&&(e=e[0]),!e.length)return qn();for(n=e[0],i=1;i<e.length;++i)(!e[i].isValid()||e[i][t](n))&&(n=e[i]);return n}function CI(){var t=[].slice.call(arguments,0);return d1("isBefore",t)}function TI(){var t=[].slice.call(arguments,0);return d1("isAfter",t)}var MI=function(){return Date.now?Date.now():+new Date},ph=["year","quarter","month","week","day","hour","minute","second","millisecond"];function AI(t){var e,n=!1,i,r=ph.length;for(e in t)if(gn(t,e)&&!(ai.call(ph,e)!==-1&&(t[e]==null||!isNaN(t[e]))))return!1;for(i=0;i<r;++i)if(t[ph[i]]){if(n)return!1;parseFloat(t[ph[i]])!==an(t[ph[i]])&&(n=!0)}return!0}function PI(){return this._isValid}function II(){return Bs(NaN)}function Tp(t){var e=Og(t),n=e.year||0,i=e.quarter||0,r=e.month||0,a=e.week||e.isoWeek||0,u=e.day||0,l=e.hour||0,g=e.minute||0,_=e.second||0,S=e.millisecond||0;this._isValid=AI(e),this._milliseconds=+S+_*1e3+g*6e4+l*1e3*60*60,this._days=+u+a*7,this._months=+r+i*3+n*12,this._data={},this._locale=Co(),this._bubble()}function Mp(t){return t instanceof Tp}function Gg(t){return t<0?Math.round(-1*t)*-1:Math.round(t)}function DI(t,e,n){var i=Math.min(t.length,e.length),r=Math.abs(t.length-e.length),a=0,u;for(u=0;u<i;u++)an(t[u])!==an(e[u])&&a++;return a+r}function p1(t,e){Mt(t,0,0,function(){var n=this.utcOffset(),i="+";return n<0&&(n=-n,i="-"),i+Ks(~~(n/60),2)+e+Ks(~~n%60,2)})}p1("Z",":"),p1("ZZ",""),yt("Z",vp),yt("ZZ",vp),zn(["Z","ZZ"],function(t,e,n){n._useUTC=!0,n._tzm=Zg(vp,t)});var OI=/([\+\-]|\d\d)/gi;function Zg(t,e){var n=(e||"").match(t),i,r,a;return n===null?null:(i=n[n.length-1]||[],r=(i+"").match(OI)||["-",0,0],a=+(r[1]*60)+an(r[2]),a===0?0:r[0]==="+"?a:-a)}function Yg(t,e){var n,i;return e._isUTC?(n=e.clone(),i=(Ls(t)||ih(t)?t.valueOf():qn(t).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+i),lt.updateOffset(n,!1),n):qn(t).local()}function Xg(t){return-Math.round(t._d.getTimezoneOffset())}lt.updateOffset=function(){};function zI(t,e,n){var i=this._offset||0,r;if(!this.isValid())return t!=null?this:NaN;if(t!=null){if(typeof t=="string"){if(t=Zg(vp,t),t===null)return this}else Math.abs(t)<16&&!n&&(t=t*60);return!this._isUTC&&e&&(r=Xg(this)),this._offset=t,this._isUTC=!0,r!=null&&this.add(r,"m"),i!==t&&(!e||this._changeInProgress?y1(this,Bs(t-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,lt.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?i:Xg(this)}function RI(t,e){return t!=null?(typeof t!="string"&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()}function LI(t){return this.utcOffset(0,t)}function NI(t){return this._isUTC&&(this.utcOffset(0,t),this._isUTC=!1,t&&this.subtract(Xg(this),"m")),this}function BI(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var t=Zg(iP,this._i);t!=null?this.utcOffset(t):this.utcOffset(0,!0)}return this}function VI(t){return this.isValid()?(t=t?qn(t).utcOffset():0,(this.utcOffset()-t)%60===0):!1}function FI(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function $I(){if(!Sr(this._isDSTShifted))return this._isDSTShifted;var t={},e;return Tg(t,this),t=u1(t),t._a?(e=t._isUTC?Ys(t._a):qn(t._a),this._isDSTShifted=this.isValid()&&DI(t._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function jI(){return this.isValid()?!this._isUTC:!1}function UI(){return this.isValid()?this._isUTC:!1}function f1(){return this.isValid()?this._isUTC&&this._offset===0:!1}var HI=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,qI=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Bs(t,e){var n=t,i=null,r,a,u;return Mp(t)?n={ms:t._milliseconds,d:t._days,M:t._months}:vo(t)||!isNaN(+t)?(n={},e?n[e]=+t:n.milliseconds=+t):(i=HI.exec(t))?(r=i[1]==="-"?-1:1,n={y:0,d:an(i[Js])*r,h:an(i[_i])*r,m:an(i[Ns])*r,s:an(i[So])*r,ms:an(Gg(i[dl]*1e3))*r}):(i=qI.exec(t))?(r=i[1]==="-"?-1:1,n={y:pl(i[2],r),M:pl(i[3],r),w:pl(i[4],r),d:pl(i[5],r),h:pl(i[6],r),m:pl(i[7],r),s:pl(i[8],r)}):n==null?n={}:typeof n=="object"&&("from"in n||"to"in n)&&(u=WI(qn(n.from),qn(n.to)),n={},n.ms=u.milliseconds,n.M=u.months),a=new Tp(n),Mp(t)&&gn(t,"_locale")&&(a._locale=t._locale),Mp(t)&&gn(t,"_isValid")&&(a._isValid=t._isValid),a}Bs.fn=Tp.prototype,Bs.invalid=II;function pl(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function m1(t,e){var n={};return n.months=e.month()-t.month()+(e.year()-t.year())*12,t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function WI(t,e){var n;return t.isValid()&&e.isValid()?(e=Yg(e,t),t.isBefore(e)?n=m1(t,e):(n=m1(e,t),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function g1(t,e){return function(n,i){var r,a;return i!==null&&!isNaN(+i)&&(jb(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),a=n,n=i,i=a),r=Bs(n,i),y1(this,r,t),this}}function y1(t,e,n,i){var r=e._milliseconds,a=Gg(e._days),u=Gg(e._months);t.isValid()&&(i=i??!0,u&&Qb(t,lh(t,"Month")+u*n),a&&Xb(t,"Date",lh(t,"Date")+a*n),r&&t._d.setTime(t._d.valueOf()+r*n),i&<.updateOffset(t,a||u))}var GI=g1(1,"add"),ZI=g1(-1,"subtract");function _1(t){return typeof t=="string"||t instanceof String}function YI(t){return Ls(t)||ih(t)||_1(t)||vo(t)||KI(t)||XI(t)||t===null||t===void 0}function XI(t){var e=hl(t)&&!kg(t),n=!1,i=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],r,a,u=i.length;for(r=0;r<u;r+=1)a=i[r],n=n||gn(t,a);return e&&n}function KI(t){var e=Rs(t),n=!1;return e&&(n=t.filter(function(i){return!vo(i)&&_1(t)}).length===0),e&&n}function JI(t){var e=hl(t)&&!kg(t),n=!1,i=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],r,a;for(r=0;r<i.length;r+=1)a=i[r],n=n||gn(t,a);return e&&n}function QI(t,e){var n=t.diff(e,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"}function eD(t,e){arguments.length===1&&(arguments[0]?YI(arguments[0])?(t=arguments[0],e=void 0):JI(arguments[0])&&(e=arguments[0],t=void 0):(t=void 0,e=void 0));var n=t||qn(),i=Yg(n,this).startOf("day"),r=lt.calendarFormat(this,i)||"sameElse",a=e&&(Xs(e[r])?e[r].call(this,n):e[r]);return this.format(a||this.localeData().calendar(r,this,qn(n)))}function tD(){return new rh(this)}function nD(t,e){var n=Ls(t)?t:qn(t);return this.isValid()&&n.isValid()?(e=hs(e)||"millisecond",e==="millisecond"?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(e).valueOf()):!1}function iD(t,e){var n=Ls(t)?t:qn(t);return this.isValid()&&n.isValid()?(e=hs(e)||"millisecond",e==="millisecond"?this.valueOf()<n.valueOf():this.clone().endOf(e).valueOf()<n.valueOf()):!1}function rD(t,e,n,i){var r=Ls(t)?t:qn(t),a=Ls(e)?e:qn(e);return this.isValid()&&r.isValid()&&a.isValid()?(i=i||"()",(i[0]==="("?this.isAfter(r,n):!this.isBefore(r,n))&&(i[1]===")"?this.isBefore(a,n):!this.isAfter(a,n))):!1}function sD(t,e){var n=Ls(t)?t:qn(t),i;return this.isValid()&&n.isValid()?(e=hs(e)||"millisecond",e==="millisecond"?this.valueOf()===n.valueOf():(i=n.valueOf(),this.clone().startOf(e).valueOf()<=i&&i<=this.clone().endOf(e).valueOf())):!1}function oD(t,e){return this.isSame(t,e)||this.isAfter(t,e)}function aD(t,e){return this.isSame(t,e)||this.isBefore(t,e)}function lD(t,e,n){var i,r,a;if(!this.isValid())return NaN;if(i=Yg(t,this),!i.isValid())return NaN;switch(r=(i.utcOffset()-this.utcOffset())*6e4,e=hs(e),e){case"year":a=Ap(this,i)/12;break;case"month":a=Ap(this,i);break;case"quarter":a=Ap(this,i)/3;break;case"second":a=(this-i)/1e3;break;case"minute":a=(this-i)/6e4;break;case"hour":a=(this-i)/36e5;break;case"day":a=(this-i-r)/864e5;break;case"week":a=(this-i-r)/6048e5;break;default:a=this-i}return n?a:ds(a)}function Ap(t,e){if(t.date()<e.date())return-Ap(e,t);var n=(e.year()-t.year())*12+(e.month()-t.month()),i=t.clone().add(n,"months"),r,a;return e-i<0?(r=t.clone().add(n-1,"months"),a=(e-i)/(i-r)):(r=t.clone().add(n+1,"months"),a=(e-i)/(r-i)),-(n+a)||0}lt.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",lt.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function cD(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function uD(t){if(!this.isValid())return null;var e=t!==!0,n=e?this.clone().utc():this;return n.year()<0||n.year()>9999?gp(n,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):Xs(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",gp(n,"Z")):gp(n,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function hD(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t="moment",e="",n,i,r,a;return this.isLocal()||(t=this.utcOffset()===0?"moment.utc":"moment.parseZone",e="Z"),n="["+t+'("]',i=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",r="-MM-DD[T]HH:mm:ss.SSS",a=e+'[")]',this.format(n+i+r+a)}function dD(t){t||(t=this.isUtc()?lt.defaultFormatUtc:lt.defaultFormat);var e=gp(this,t);return this.localeData().postformat(e)}function pD(t,e){return this.isValid()&&(Ls(t)&&t.isValid()||qn(t).isValid())?Bs({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function fD(t){return this.from(qn(),t)}function mD(t,e){return this.isValid()&&(Ls(t)&&t.isValid()||qn(t).isValid())?Bs({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function gD(t){return this.to(qn(),t)}function x1(t){var e;return t===void 0?this._locale._abbr:(e=Co(t),e!=null&&(this._locale=e),this)}var b1=us("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return t===void 0?this.localeData():this.locale(t)});function v1(){return this._locale}var Pp=1e3,bc=60*Pp,Ip=60*bc,w1=(365*400+97)*24*Ip;function vc(t,e){return(t%e+e)%e}function k1(t,e,n){return t<100&&t>=0?new Date(t+400,e,n)-w1:new Date(t,e,n).valueOf()}function S1(t,e,n){return t<100&&t>=0?Date.UTC(t+400,e,n)-w1:Date.UTC(t,e,n)}function yD(t){var e,n;if(t=hs(t),t===void 0||t==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?S1:k1,t){case"year":e=n(this.year(),0,1);break;case"quarter":e=n(this.year(),this.month()-this.month()%3,1);break;case"month":e=n(this.year(),this.month(),1);break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":e=n(this.year(),this.month(),this.date());break;case"hour":e=this._d.valueOf(),e-=vc(e+(this._isUTC?0:this.utcOffset()*bc),Ip);break;case"minute":e=this._d.valueOf(),e-=vc(e,bc);break;case"second":e=this._d.valueOf(),e-=vc(e,Pp);break}return this._d.setTime(e),lt.updateOffset(this,!0),this}function _D(t){var e,n;if(t=hs(t),t===void 0||t==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?S1:k1,t){case"year":e=n(this.year()+1,0,1)-1;break;case"quarter":e=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":e=n(this.year(),this.month()+1,1)-1;break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":e=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":e=this._d.valueOf(),e+=Ip-vc(e+(this._isUTC?0:this.utcOffset()*bc),Ip)-1;break;case"minute":e=this._d.valueOf(),e+=bc-vc(e,bc)-1;break;case"second":e=this._d.valueOf(),e+=Pp-vc(e,Pp)-1;break}return this._d.setTime(e),lt.updateOffset(this,!0),this}function xD(){return this._d.valueOf()-(this._offset||0)*6e4}function bD(){return Math.floor(this.valueOf()/1e3)}function vD(){return new Date(this.valueOf())}function wD(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function kD(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function SD(){return this.isValid()?this.toISOString():null}function ED(){return Eg(this)}function CD(){return aa({},Wt(this))}function TD(){return Wt(this).overflow}function MD(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}Mt("N",0,0,"eraAbbr"),Mt("NN",0,0,"eraAbbr"),Mt("NNN",0,0,"eraAbbr"),Mt("NNNN",0,0,"eraName"),Mt("NNNNN",0,0,"eraNarrow"),Mt("y",["y",1],"yo","eraYear"),Mt("y",["yy",2],0,"eraYear"),Mt("y",["yyy",3],0,"eraYear"),Mt("y",["yyyy",4],0,"eraYear"),yt("N",Kg),yt("NN",Kg),yt("NNN",Kg),yt("NNNN",VD),yt("NNNNN",FD),zn(["N","NN","NNN","NNNN","NNNNN"],function(t,e,n,i){var r=n._locale.erasParse(t,i,n._strict);r?Wt(n).era=r:Wt(n).invalidEra=t}),yt("y",gc),yt("yy",gc),yt("yyy",gc),yt("yyyy",gc),yt("yo",$D),zn(["y","yy","yyy","yyyy"],Yi),zn(["yo"],function(t,e,n,i){var r;n._locale._eraYearOrdinalRegex&&(r=t.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?e[Yi]=n._locale.eraYearOrdinalParse(t,r):e[Yi]=parseInt(t,10)});function AD(t,e){var n,i,r,a=this._eras||Co("en")._eras;for(n=0,i=a.length;n<i;++n){switch(typeof a[n].since){case"string":r=lt(a[n].since).startOf("day"),a[n].since=r.valueOf();break}switch(typeof a[n].until){case"undefined":a[n].until=1/0;break;case"string":r=lt(a[n].until).startOf("day").valueOf(),a[n].until=r.valueOf();break}}return a}function PD(t,e,n){var i,r,a=this.eras(),u,l,g;for(t=t.toUpperCase(),i=0,r=a.length;i<r;++i)if(u=a[i].name.toUpperCase(),l=a[i].abbr.toUpperCase(),g=a[i].narrow.toUpperCase(),n)switch(e){case"N":case"NN":case"NNN":if(l===t)return a[i];break;case"NNNN":if(u===t)return a[i];break;case"NNNNN":if(g===t)return a[i];break}else if([u,l,g].indexOf(t)>=0)return a[i]}function ID(t,e){var n=t.since<=t.until?1:-1;return e===void 0?lt(t.since).year():lt(t.since).year()+(e-t.offset)*n}function DD(){var t,e,n,i=this.localeData().eras();for(t=0,e=i.length;t<e;++t)if(n=this.clone().startOf("day").valueOf(),i[t].since<=n&&n<=i[t].until||i[t].until<=n&&n<=i[t].since)return i[t].name;return""}function OD(){var t,e,n,i=this.localeData().eras();for(t=0,e=i.length;t<e;++t)if(n=this.clone().startOf("day").valueOf(),i[t].since<=n&&n<=i[t].until||i[t].until<=n&&n<=i[t].since)return i[t].narrow;return""}function zD(){var t,e,n,i=this.localeData().eras();for(t=0,e=i.length;t<e;++t)if(n=this.clone().startOf("day").valueOf(),i[t].since<=n&&n<=i[t].until||i[t].until<=n&&n<=i[t].since)return i[t].abbr;return""}function RD(){var t,e,n,i,r=this.localeData().eras();for(t=0,e=r.length;t<e;++t)if(n=r[t].since<=r[t].until?1:-1,i=this.clone().startOf("day").valueOf(),r[t].since<=i&&i<=r[t].until||r[t].until<=i&&i<=r[t].since)return(this.year()-lt(r[t].since).year())*n+r[t].offset;return this.year()}function LD(t){return gn(this,"_erasNameRegex")||Jg.call(this),t?this._erasNameRegex:this._erasRegex}function ND(t){return gn(this,"_erasAbbrRegex")||Jg.call(this),t?this._erasAbbrRegex:this._erasRegex}function BD(t){return gn(this,"_erasNarrowRegex")||Jg.call(this),t?this._erasNarrowRegex:this._erasRegex}function Kg(t,e){return e.erasAbbrRegex(t)}function VD(t,e){return e.erasNameRegex(t)}function FD(t,e){return e.erasNarrowRegex(t)}function $D(t,e){return e._eraYearOrdinalRegex||gc}function Jg(){var t=[],e=[],n=[],i=[],r,a,u,l,g,_=this.eras();for(r=0,a=_.length;r<a;++r)u=wo(_[r].name),l=wo(_[r].abbr),g=wo(_[r].narrow),e.push(u),t.push(l),n.push(g),i.push(u),i.push(l),i.push(g);this._erasRegex=new RegExp("^("+i.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+e.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+t.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+n.join("|")+")","i")}Mt(0,["gg",2],0,function(){return this.weekYear()%100}),Mt(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Dp(t,e){Mt(0,[t,t.length],0,e)}Dp("gggg","weekYear"),Dp("ggggg","weekYear"),Dp("GGGG","isoWeekYear"),Dp("GGGGG","isoWeekYear"),yt("G",bp),yt("g",bp),yt("GG",Hn,qr),yt("gg",Hn,qr),yt("GGGG",Rg,zg),yt("gggg",Rg,zg),yt("GGGGG",xp,yp),yt("ggggg",xp,yp),oh(["gggg","ggggg","GGGG","GGGGG"],function(t,e,n,i){e[i.substr(0,2)]=an(t)}),oh(["gg","GG"],function(t,e,n,i){e[i]=lt.parseTwoDigitYear(t)});function jD(t){return E1.call(this,t,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function UD(t){return E1.call(this,t,this.isoWeek(),this.isoWeekday(),1,4)}function HD(){return Eo(this.year(),1,4)}function qD(){return Eo(this.isoWeekYear(),1,4)}function WD(){var t=this.localeData()._week;return Eo(this.year(),t.dow,t.doy)}function GD(){var t=this.localeData()._week;return Eo(this.weekYear(),t.dow,t.doy)}function E1(t,e,n,i,r){var a;return t==null?uh(this,i,r).year:(a=Eo(t,i,r),e>a&&(e=a),ZD.call(this,t,e,n,i,r))}function ZD(t,e,n,i,r){var a=n1(t,e,n,i,r),u=ch(a.year,0,a.dayOfYear);return this.year(u.getUTCFullYear()),this.month(u.getUTCMonth()),this.date(u.getUTCDate()),this}Mt("Q",0,"Qo","quarter"),yt("Q",qb),zn("Q",function(t,e){e[ko]=(an(t)-1)*3});function YD(t){return t==null?Math.ceil((this.month()+1)/3):this.month((t-1)*3+this.month()%3)}Mt("D",["DD",2],"Do","date"),yt("D",Hn,yc),yt("DD",Hn,qr),yt("Do",function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient}),zn(["D","DD"],Js),zn("Do",function(t,e){e[Js]=an(t.match(Hn)[0])});var C1=_c("Date",!0);Mt("DDD",["DDDD",3],"DDDo","dayOfYear"),yt("DDD",_p),yt("DDDD",Wb),zn(["DDD","DDDD"],function(t,e,n){n._dayOfYear=an(t)});function XD(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return t==null?e:this.add(t-e,"d")}Mt("m",["mm",2],0,"minute"),yt("m",Hn,Lg),yt("mm",Hn,qr),zn(["m","mm"],Ns);var KD=_c("Minutes",!1);Mt("s",["ss",2],0,"second"),yt("s",Hn,Lg),yt("ss",Hn,qr),zn(["s","ss"],So);var JD=_c("Seconds",!1);Mt("S",0,0,function(){return~~(this.millisecond()/100)}),Mt(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),Mt(0,["SSS",3],0,"millisecond"),Mt(0,["SSSS",4],0,function(){return this.millisecond()*10}),Mt(0,["SSSSS",5],0,function(){return this.millisecond()*100}),Mt(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),Mt(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),Mt(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),Mt(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),yt("S",_p,qb),yt("SS",_p,qr),yt("SSS",_p,Wb);var ca,T1;for(ca="SSSS";ca.length<=9;ca+="S")yt(ca,gc);function QD(t,e){e[dl]=an(("0."+t)*1e3)}for(ca="S";ca.length<=9;ca+="S")zn(ca,QD);T1=_c("Milliseconds",!1),Mt("z",0,0,"zoneAbbr"),Mt("zz",0,0,"zoneName");function eO(){return this._isUTC?"UTC":""}function tO(){return this._isUTC?"Coordinated Universal Time":""}var $e=rh.prototype;$e.add=GI,$e.calendar=eD,$e.clone=tD,$e.diff=lD,$e.endOf=_D,$e.format=dD,$e.from=pD,$e.fromNow=fD,$e.to=mD,$e.toNow=gD,$e.get=hP,$e.invalidAt=TD,$e.isAfter=nD,$e.isBefore=iD,$e.isBetween=rD,$e.isSame=sD,$e.isSameOrAfter=oD,$e.isSameOrBefore=aD,$e.isValid=ED,$e.lang=b1,$e.locale=x1,$e.localeData=v1,$e.max=EI,$e.min=SI,$e.parsingFlags=CD,$e.set=dP,$e.startOf=yD,$e.subtract=ZI,$e.toArray=wD,$e.toObject=kD,$e.toDate=vD,$e.toISOString=uD,$e.inspect=hD,typeof Symbol<"u"&&Symbol.for!=null&&($e[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),$e.toJSON=SD,$e.toString=cD,$e.unix=bD,$e.valueOf=xD,$e.creationData=MD,$e.eraName=DD,$e.eraNarrow=OD,$e.eraAbbr=zD,$e.eraYear=RD,$e.year=Yb,$e.isLeapYear=uP,$e.weekYear=jD,$e.isoWeekYear=UD,$e.quarter=$e.quarters=YD,$e.month=e1,$e.daysInMonth=vP,$e.week=$e.weeks=AP,$e.isoWeek=$e.isoWeeks=PP,$e.weeksInYear=WD,$e.weeksInWeekYear=GD,$e.isoWeeksInYear=HD,$e.isoWeeksInISOWeekYear=qD,$e.date=C1,$e.day=$e.days=UP,$e.weekday=HP,$e.isoWeekday=qP,$e.dayOfYear=XD,$e.hour=$e.hours=JP,$e.minute=$e.minutes=KD,$e.second=$e.seconds=JD,$e.millisecond=$e.milliseconds=T1,$e.utcOffset=zI,$e.utc=LI,$e.local=NI,$e.parseZone=BI,$e.hasAlignedHourOffset=VI,$e.isDST=FI,$e.isLocal=jI,$e.isUtcOffset=UI,$e.isUtc=f1,$e.isUTC=f1,$e.zoneAbbr=eO,$e.zoneName=tO,$e.dates=us("dates accessor is deprecated. Use date instead.",C1),$e.months=us("months accessor is deprecated. Use month instead",e1),$e.years=us("years accessor is deprecated. Use year instead",Yb),$e.zone=us("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",RI),$e.isDSTShifted=us("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",$I);function nO(t){return qn(t*1e3)}function iO(){return qn.apply(null,arguments).parseZone()}function M1(t){return t}var yn=Ag.prototype;yn.calendar=jA,yn.longDateFormat=WA,yn.invalidDate=ZA,yn.ordinal=KA,yn.preparse=M1,yn.postformat=M1,yn.relativeTime=QA,yn.pastFuture=eP,yn.set=FA,yn.eras=AD,yn.erasParse=PD,yn.erasConvertYear=ID,yn.erasAbbrRegex=ND,yn.erasNameRegex=LD,yn.erasNarrowRegex=BD,yn.months=yP,yn.monthsShort=_P,yn.monthsParse=bP,yn.monthsRegex=kP,yn.monthsShortRegex=wP,yn.week=EP,yn.firstDayOfYear=MP,yn.firstDayOfWeek=TP,yn.weekdays=BP,yn.weekdaysMin=FP,yn.weekdaysShort=VP,yn.weekdaysParse=jP,yn.weekdaysRegex=WP,yn.weekdaysShortRegex=GP,yn.weekdaysMinRegex=ZP,yn.isPM=XP,yn.meridiem=QP;function Op(t,e,n,i){var r=Co(),a=Ys().set(i,e);return r[n](a,t)}function A1(t,e,n){if(vo(t)&&(e=t,t=void 0),t=t||"",e!=null)return Op(t,e,n,"month");var i,r=[];for(i=0;i<12;i++)r[i]=Op(t,i,n,"month");return r}function Qg(t,e,n,i){typeof t=="boolean"?(vo(e)&&(n=e,e=void 0),e=e||""):(e=t,n=e,t=!1,vo(e)&&(n=e,e=void 0),e=e||"");var r=Co(),a=t?r._week.dow:0,u,l=[];if(n!=null)return Op(e,(n+a)%7,i,"day");for(u=0;u<7;u++)l[u]=Op(e,(u+a)%7,i,"day");return l}function rO(t,e){return A1(t,e,"months")}function sO(t,e){return A1(t,e,"monthsShort")}function oO(t,e,n){return Qg(t,e,n,"weekdays")}function aO(t,e,n){return Qg(t,e,n,"weekdaysShort")}function lO(t,e,n){return Qg(t,e,n,"weekdaysMin")}la("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10,n=an(t%100/10)===1?"th":e===1?"st":e===2?"nd":e===3?"rd":"th";return t+n}}),lt.lang=us("moment.lang is deprecated. Use moment.locale instead.",la),lt.langData=us("moment.langData is deprecated. Use moment.localeData instead.",Co);var To=Math.abs;function cO(){var t=this._data;return this._milliseconds=To(this._milliseconds),this._days=To(this._days),this._months=To(this._months),t.milliseconds=To(t.milliseconds),t.seconds=To(t.seconds),t.minutes=To(t.minutes),t.hours=To(t.hours),t.months=To(t.months),t.years=To(t.years),this}function P1(t,e,n,i){var r=Bs(e,n);return t._milliseconds+=i*r._milliseconds,t._days+=i*r._days,t._months+=i*r._months,t._bubble()}function uO(t,e){return P1(this,t,e,1)}function hO(t,e){return P1(this,t,e,-1)}function I1(t){return t<0?Math.floor(t):Math.ceil(t)}function dO(){var t=this._milliseconds,e=this._days,n=this._months,i=this._data,r,a,u,l,g;return t>=0&&e>=0&&n>=0||t<=0&&e<=0&&n<=0||(t+=I1(ey(n)+e)*864e5,e=0,n=0),i.milliseconds=t%1e3,r=ds(t/1e3),i.seconds=r%60,a=ds(r/60),i.minutes=a%60,u=ds(a/60),i.hours=u%24,e+=ds(u/24),g=ds(D1(e)),n+=g,e-=I1(ey(g)),l=ds(n/12),n%=12,i.days=e,i.months=n,i.years=l,this}function D1(t){return t*4800/146097}function ey(t){return t*146097/4800}function pO(t){if(!this.isValid())return NaN;var e,n,i=this._milliseconds;if(t=hs(t),t==="month"||t==="quarter"||t==="year")switch(e=this._days+i/864e5,n=this._months+D1(e),t){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(e=this._days+Math.round(ey(this._months)),t){case"week":return e/7+i/6048e5;case"day":return e+i/864e5;case"hour":return e*24+i/36e5;case"minute":return e*1440+i/6e4;case"second":return e*86400+i/1e3;case"millisecond":return Math.floor(e*864e5)+i;default:throw new Error("Unknown unit "+t)}}function Mo(t){return function(){return this.as(t)}}var O1=Mo("ms"),fO=Mo("s"),mO=Mo("m"),gO=Mo("h"),yO=Mo("d"),_O=Mo("w"),xO=Mo("M"),bO=Mo("Q"),vO=Mo("y"),wO=O1;function kO(){return Bs(this)}function SO(t){return t=hs(t),this.isValid()?this[t+"s"]():NaN}function fl(t){return function(){return this.isValid()?this._data[t]:NaN}}var EO=fl("milliseconds"),CO=fl("seconds"),TO=fl("minutes"),MO=fl("hours"),AO=fl("days"),PO=fl("months"),IO=fl("years");function DO(){return ds(this.days()/7)}var Ao=Math.round,wc={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function OO(t,e,n,i,r){return r.relativeTime(e||1,!!n,t,i)}function zO(t,e,n,i){var r=Bs(t).abs(),a=Ao(r.as("s")),u=Ao(r.as("m")),l=Ao(r.as("h")),g=Ao(r.as("d")),_=Ao(r.as("M")),S=Ao(r.as("w")),E=Ao(r.as("y")),T=a<=n.ss&&["s",a]||a<n.s&&["ss",a]||u<=1&&["m"]||u<n.m&&["mm",u]||l<=1&&["h"]||l<n.h&&["hh",l]||g<=1&&["d"]||g<n.d&&["dd",g];return n.w!=null&&(T=T||S<=1&&["w"]||S<n.w&&["ww",S]),T=T||_<=1&&["M"]||_<n.M&&["MM",_]||E<=1&&["y"]||["yy",E],T[2]=e,T[3]=+t>0,T[4]=i,OO.apply(null,T)}function RO(t){return t===void 0?Ao:typeof t=="function"?(Ao=t,!0):!1}function LO(t,e){return wc[t]===void 0?!1:e===void 0?wc[t]:(wc[t]=e,t==="s"&&(wc.ss=e-1),!0)}function NO(t,e){if(!this.isValid())return this.localeData().invalidDate();var n=!1,i=wc,r,a;return typeof t=="object"&&(e=t,t=!1),typeof t=="boolean"&&(n=t),typeof e=="object"&&(i=Object.assign({},wc,e),e.s!=null&&e.ss==null&&(i.ss=e.s-1)),r=this.localeData(),a=zO(this,!n,i,r),n&&(a=r.pastFuture(+this,a)),r.postformat(a)}var ty=Math.abs;function kc(t){return(t>0)-(t<0)||+t}function zp(){if(!this.isValid())return this.localeData().invalidDate();var t=ty(this._milliseconds)/1e3,e=ty(this._days),n=ty(this._months),i,r,a,u,l=this.asSeconds(),g,_,S,E;return l?(i=ds(t/60),r=ds(i/60),t%=60,i%=60,a=ds(n/12),n%=12,u=t?t.toFixed(3).replace(/\.?0+$/,""):"",g=l<0?"-":"",_=kc(this._months)!==kc(l)?"-":"",S=kc(this._days)!==kc(l)?"-":"",E=kc(this._milliseconds)!==kc(l)?"-":"",g+"P"+(a?_+a+"Y":"")+(n?_+n+"M":"")+(e?S+e+"D":"")+(r||i||t?"T":"")+(r?E+r+"H":"")+(i?E+i+"M":"")+(t?E+u+"S":"")):"P0D"}var pn=Tp.prototype;pn.isValid=PI,pn.abs=cO,pn.add=uO,pn.subtract=hO,pn.as=pO,pn.asMilliseconds=O1,pn.asSeconds=fO,pn.asMinutes=mO,pn.asHours=gO,pn.asDays=yO,pn.asWeeks=_O,pn.asMonths=xO,pn.asQuarters=bO,pn.asYears=vO,pn.valueOf=wO,pn._bubble=dO,pn.clone=kO,pn.get=SO,pn.milliseconds=EO,pn.seconds=CO,pn.minutes=TO,pn.hours=MO,pn.days=AO,pn.weeks=DO,pn.months=PO,pn.years=IO,pn.humanize=NO,pn.toISOString=zp,pn.toString=zp,pn.toJSON=zp,pn.locale=x1,pn.localeData=v1,pn.toIsoString=us("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",zp),pn.lang=b1,Mt("X",0,0,"unix"),Mt("x",0,0,"valueOf"),yt("x",bp),yt("X",rP),zn("X",function(t,e,n){n._d=new Date(parseFloat(t)*1e3)}),zn("x",function(t,e,n){n._d=new Date(an(t))});//! moment.js
|
|
45
|
-
lt.version="2.30.1",BA(qn),lt.fn=$e,lt.min=CI,lt.max=TI,lt.now=MI,lt.utc=Ys,lt.unix=nO,lt.months=rO,lt.isDate=ih,lt.locale=la,lt.invalid=fp,lt.duration=Bs,lt.isMoment=Ls,lt.weekdays=oO,lt.parseZone=iO,lt.localeData=Co,lt.isDuration=Mp,lt.monthsShort=sO,lt.weekdaysMin=lO,lt.defineLocale=jg,lt.updateLocale=iI,lt.locales=rI,lt.weekdaysShort=aO,lt.normalizeUnits=hs,lt.relativeTimeRounding=RO,lt.relativeTimeThreshold=LO,lt.calendarFormat=QI,lt.prototype=$e,lt.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const BO={props:{data:Object,name:String,table:String,inline:{type:Boolean,default:()=>!1}},computed:{dateValue(){var t;if(!((t=this.data)!=null&&t[this.name]))return"-";try{const e=lt(this.data[this.name],"YYYY-MM-DD");return new Date(e).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return this.value}}},methods:{async changeData(t){var e;try{await xt.put(`/api/table/${this.table}/${(e=this.data)==null?void 0:e.id}`,{...this.data,[this.name]:t}),await this.$emit("update-table")}catch(n){console.log(n)}}}},VO={class:"whitespace-nowrap"},FO={key:1,class:"whitespace-nowrap"};function $O(t,e,n,i,r,a){var l;const u=v.resolveComponent("VsInlineEdit");return n.inline?(v.openBlock(),v.createBlock(u,{key:0,"model-value":((l=n.data)==null?void 0:l[n.name])||null,component:"vs-datepicker",onUpdateValue:a.changeData},{default:v.withCtx(()=>[v.createElementVNode("div",VO,v.toDisplayString(a.dateValue),1)]),_:1},8,["model-value","onUpdateValue"])):(v.openBlock(),v.createElementBlock("div",FO,v.toDisplayString(a.dateValue),1))}const jO=at(BO,[["render",$O]]),UO=v.defineComponent({name:"VsNumberValue",props:{data:{type:Object},name:String},computed:{formattedValue(){try{return new Intl.NumberFormat("ua",{notation:"compact"}).format(this.data[this.name])}catch(t){return console.error("Formatting error:",t.message),this.value}}}}),HO={class:"block w-full pr-[10px] text-left"};function qO(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("span",HO,v.toDisplayString(t.formattedValue),1)}const WO={"table-format-text":zb,"table-format-select":IA,"table-format-badge":yA,"table-format-swetch":Lb,"table-format-check":Lb,"table-format-html":zb,"table-format-tags":NA,"table-format-date":jO,"table-format-number":at(UO,[["render",qO]])},GO={},ZO={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 YO(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",ZO,e[0]||(e[0]=[v.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),v.createElementVNode("path",{d:"m21 21-4.3-4.3"},null,-1)]))}const ny=at(GO,[["render",YO]]),XO={components:{IconSearch:ny},data(){return{color:void 0,data:null,searchValue:""}},mounted(){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 createUser(){try{await xt.post("/api/user-cls",{name:"User1",color:"#000",children:[{name:"User2",id:"11212"}]})}catch{}},async getData(){try{const{data:t}=await xt.get("/api/user-cls");this.data=t}catch{}}}},KO={class:"w-[300px] border-r",style:{height:"calc(100vh - 60px)"}},JO={class:"relative"},QO={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)"}},ez={class:"w-[99%] overflow-hidden overflow-ellipsis"},tz={class:"ml-auto text-[10px] h-[16px] px-[6px] flex items-center justify-center rounded-full bg-gray-200"};function nz(t,e,n,i,r,a){const u=v.resolveComponent("IconSearch"),l=v.resolveComponent("VsText"),g=v.resolveComponent("router-link");return v.openBlock(),v.createElementBlock("div",KO,[v.createElementVNode("div",JO,[v.createVNode(u,{height:"16",width:"16",class:"absolute top-[12px] left-[30px] text-gray-500 z-[1]"}),v.createVNode(l,{type:"text",modelValue:r.searchValue,"onUpdate:modelValue":e[0]||(e[0]=_=>r.searchValue=_),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"])]),v.createElementVNode("ul",QO,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(a.rows,_=>{var S,E;return v.openBlock(),v.createElementBlock("li",{key:_==null?void 0:_.id,class:"w-full pr-[10px]"},[v.createVNode(g,{to:"/reester?name="+((_==null?void 0:_.name)||(_==null?void 0:_.id)),class:v.normalizeClass(["py-2 px-5 group pr-[10px] flex items-center gap-x-3 w-full flex justify-between hover:bg-gray-100 rounded-lg duration-300",{"bg-gray-100":((E=(S=t.$route)==null?void 0:S.query)==null?void 0:E.name)===(_==null?void 0:_.name)}])},{default:v.withCtx(()=>[v.createElementVNode("span",ez,v.toDisplayString((_==null?void 0:_.name)||(_==null?void 0:_.id)),1),v.createElementVNode("span",tz,v.toDisplayString((_==null?void 0:_.children)||0),1)]),_:2},1032,["to","class"])])}),128))])])}const iz=at(XO,[["render",nz]]),rz={props:{title:{type:String,default:()=>"Дані для відображення відсутні"},text:{type:String,default:()=>"Змініть параметри пошуку або спробуйте пізніше"}}},sz={class:"w-full"},oz={class:"p-5 min-h-[500px] flex flex-col justify-center items-center text-center"},az={class:"max-w-sm mx-auto mt-6"},lz={class:"font-medium text-gray-800 dark:text-neutral-200"},cz={class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"};function uz(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("div",sz,[v.createElementVNode("div",oz,[e[0]||(e[0]=v.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)),v.createElementVNode("div",az,[v.createElementVNode("p",lz,v.toDisplayString(n.title),1),v.createElementVNode("p",cz,v.toDisplayString(n.text),1)])])])}const hz=at(rz,[["render",uz]]),dz={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()}}},pz={class:"flex w-[160px] flex-wrap gap-[4px]"},fz=["onClick"];function mz(t,e,n,i,r,a){const u=v.resolveComponent("VsPopover");return v.openBlock(),v.createBlock(u,{ref:"popover",placement:"bottom"},{reference:v.withCtx(()=>[v.createElementVNode("button",{class:"h-[37px] w-[37px] rounded-lg flex items-center justify-center",style:v.normalizeStyle({backgroundColor:n.modelValue})},null,4)]),default:v.withCtx(()=>[v.createElementVNode("div",null,[v.createElementVNode("ul",pz,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(n.colors,l=>(v.openBlock(),v.createElementBlock("li",{class:"h-[37px] w-[37px] rounded",style:v.normalizeStyle({backgroundColor:l}),onClick:g=>a.updateColor(l),key:l},null,12,fz))),128))])])]),_:1},512)}const z1=at(dz,[["render",mz]]),gz={components:{VsChoceColor:z1},props:{item:Object},data(){var t,e;return{color:((t=this.item)==null?void 0:t.color)||"#000",text:((e=this.item)==null?void 0:e.text)||""}},watch:{color(t){this.$emit("update-item",{...this.item,color:t})},text(t){this.$emit("update-item",{...this.item,text:t})}}},yz={class:"p-3 relative group flex items-center gap-x-3 bg-white border border-gray-200 rounded-xl"},_z={class:"block text-sm font-semibold text-gray-800 min-w-[200px] z-[10] cursor-pointer"},xz={class:"block truncate text-xs text-gray-500 dark:text-neutral-500"};function bz(t,e,n,i,r,a){var g;const u=v.resolveComponent("VsChoceColor"),l=v.resolveComponent("VsInlineEdit");return v.openBlock(),v.createElementBlock("div",yz,[v.createVNode(u,{modelValue:r.color,"onUpdate:modelValue":e[0]||(e[0]=_=>r.color=_)},null,8,["modelValue"]),v.createElementVNode("div",null,[v.createVNode(l,{modelValue:r.text,"onUpdate:modelValue":e[1]||(e[1]=_=>r.text=_),onUpdateValue:e[2]||(e[2]=_=>r.text=_)},{default:v.withCtx(()=>[v.createElementVNode("p",_z,v.toDisplayString(r.text),1)]),_:1},8,["modelValue"]),v.createElementVNode("p",xz,v.toDisplayString((g=n.item)==null?void 0:g.parent),1)])])}const vz={components:{VsReesterUsersItem:at(gz,[["render",bz]])},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){var n;const e=(n=this.list)==null?void 0:n.findIndex(i=>(i==null?void 0:i.id)===(t==null?void 0:t.id));this.list[e]=t,this.$emit("update-list",this.list)}}},wz={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)"}},kz=["onDragstart","onDrop"];function Sz(t,e,n,i,r,a){const u=v.resolveComponent("VsReesterUsersItem");return v.openBlock(),v.createElementBlock("ul",wz,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(n.list,(l,g)=>(v.openBlock(),v.createElementBlock("li",{key:l==null?void 0:l.id,draggable:!0,onDragstart:_=>a.dragStart(_,g),onDragover:e[0]||(e[0]=_=>a.dragOver(_)),onDrop:_=>a.drop(_,g),onDragend:e[1]||(e[1]=(..._)=>a.dragEnd&&a.dragEnd(..._))},[v.createVNode(u,{item:l,onUpdateItem:a.updateItem},null,8,["item","onUpdateItem"])],40,kz))),128))])}const Ez={components:{VsNoData:hz,VsChoceColor:z1,IconCheck:Rb,VsReesterUsersList:at(vz,[["render",Sz],["__scopeId","data-v-95b2773a"]])},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;try{const{data:e}=await xt.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 xt.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 xt.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)}}}},Cz={class:"bg-gray-50 flex justify-center",style:{height:"calc(100vh - 60px)",width:"calc(100vw - 560px)"}},Tz={key:0,class:"mt-[100px] p-[10px]",style:{"max-height":"calc(100vh - 300px)",width:"calc(100vw - 1000px)"}},Mz={class:"flex items-end w-full gap-[4px]"};function Az(t,e,n,i,r,a){var E,T,I,z,F;const u=v.resolveComponent("VsForm"),l=v.resolveComponent("VsChoceColor"),g=v.resolveComponent("IconCheck"),_=v.resolveComponent("VsReesterUsersList"),S=v.resolveComponent("VsNoData");return v.openBlock(),v.createElementBlock("div",Cz,[(T=(E=t.$route)==null?void 0:E.query)!=null&&T.name?(v.openBlock(),v.createElementBlock("div",Tz,[e[3]||(e[3]=v.createElementVNode("h2",{class:"font-bold mb-[10px]"},"Створити",-1)),v.createElementVNode("div",Mz,[r.formVisible?(v.openBlock(),v.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[0]||(e[0]=j=>r.formValues=j),class:"p-0 m-0 h-[65px] w-full"},null,8,["scheme","modelValue"])):v.createCommentVNode("",!0),v.createVNode(l,{modelValue:r.color,"onUpdate:modelValue":e[1]||(e[1]=j=>r.color=j)},null,8,["modelValue"]),v.createElementVNode("button",{onClick:e[2]||(e[2]=(...j)=>a.addOneChild&&a.addOneChild(...j)),class:"h-[37px] w-[37px] rounded-lg bg-blue-600 ml-[6px] flex items-center justify-center text-white hover:bg-blue-700 duration-300"},[v.createVNode(g,{height:"20",width:"20"})])]),(z=(I=r.data)==null?void 0:I.children)!=null&&z.length?(v.openBlock(),v.createBlock(_,{key:0,list:(F=r.data)==null?void 0:F.children,onUpdateList:a.updateChildren},null,8,["list","onUpdateList"])):v.createCommentVNode("",!0)])):(v.openBlock(),v.createBlock(S,{key:1,class:"mt-[100px]",text:"Оберіть один з пунктів меню для відображення"}))])}const Pz={components:{VsReesterNavList:iz,VsReesterContent:at(Ez,[["render",Az]])},data(){return{}},methods:{}},Iz={class:"flex items-start gap-0"};function Dz(t,e,n,i,r,a){const u=v.resolveComponent("VsReesterNavList"),l=v.resolveComponent("VsReesterContent");return v.openBlock(),v.createElementBlock("div",Iz,[v.createVNode(u),v.createVNode(l)])}const Oz={"reester-page":at(Pz,[["render",Dz]])},R1=t=>{const e=[];return t.forEach(n=>{n.menu?e.push(...R1(n.menu)):e.push(n)}),e};function L1(t,e,n){if(t!==null)for(var i,r,a,u,l,g,_,S=0,E=0,T,I=t.type,z=I==="FeatureCollection",F=I==="Feature",j=z?t.features.length:1,Z=0;Z<j;Z++){_=z?t.features[Z].geometry:F?t.geometry:t,T=_?_.type==="GeometryCollection":!1,l=T?_.geometries.length:1;for(var ie=0;ie<l;ie++){var le=0,J=0;if(u=T?_.geometries[ie]:_,u!==null){g=u.coordinates;var Ee=u.type;switch(S=0,Ee){case null:break;case"Point":if(e(g,E,Z,le,J)===!1)return!1;E++,le++;break;case"LineString":case"MultiPoint":for(i=0;i<g.length;i++){if(e(g[i],E,Z,le,J)===!1)return!1;E++,Ee==="MultiPoint"&&le++}Ee==="LineString"&&le++;break;case"Polygon":case"MultiLineString":for(i=0;i<g.length;i++){for(r=0;r<g[i].length-S;r++){if(e(g[i][r],E,Z,le,J)===!1)return!1;E++}Ee==="MultiLineString"&&le++,Ee==="Polygon"&&J++}Ee==="Polygon"&&le++;break;case"MultiPolygon":for(i=0;i<g.length;i++){for(J=0,r=0;r<g[i].length;r++){for(a=0;a<g[i][r].length-S;a++){if(e(g[i][r][a],E,Z,le,J)===!1)return!1;E++}J++}le++}break;case"GeometryCollection":for(i=0;i<u.geometries.length;i++)if(L1(u.geometries[i],e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function N1(t,e={}){if(t.bbox!=null&&e.recompute!==!0)return t.bbox;const n=[1/0,1/0,-1/0,-1/0];return L1(t,i=>{n[0]>i[0]&&(n[0]=i[0]),n[1]>i[1]&&(n[1]=i[1]),n[2]<i[0]&&(n[2]=i[0]),n[3]<i[1]&&(n[3]=i[1])}),n}var zz=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rz(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Lz(t,e,n={}){const i={type:"Feature"};return(n.id===0||n.id)&&(i.id=n.id),n.bbox&&(i.bbox=n.bbox),i.properties={},i.geometry=t,i}function B1(t,e={}){const n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}var V1={exports:{}};/**
|
|
45
|
+
lt.version="2.30.1",BA(qn),lt.fn=$e,lt.min=CI,lt.max=TI,lt.now=MI,lt.utc=Ys,lt.unix=nO,lt.months=rO,lt.isDate=ih,lt.locale=la,lt.invalid=fp,lt.duration=Bs,lt.isMoment=Ls,lt.weekdays=oO,lt.parseZone=iO,lt.localeData=Co,lt.isDuration=Mp,lt.monthsShort=sO,lt.weekdaysMin=lO,lt.defineLocale=jg,lt.updateLocale=iI,lt.locales=rI,lt.weekdaysShort=aO,lt.normalizeUnits=hs,lt.relativeTimeRounding=RO,lt.relativeTimeThreshold=LO,lt.calendarFormat=QI,lt.prototype=$e,lt.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const BO={props:{data:Object,name:String,table:String,inline:{type:Boolean,default:()=>!1}},computed:{dateValue(){var t;if(!((t=this.data)!=null&&t[this.name]))return"-";try{const e=lt(this.data[this.name],"YYYY-MM-DD");return new Date(e).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return this.value}}},methods:{async changeData(t){var e;try{await xt.put(`/api/table/${this.table}/${(e=this.data)==null?void 0:e.id}`,{...this.data,[this.name]:t}),await this.$emit("update-table")}catch(n){console.log(n)}}}},VO={class:"whitespace-nowrap"},FO={key:1,class:"whitespace-nowrap"};function $O(t,e,n,i,r,a){var l;const u=v.resolveComponent("VsInlineEdit");return n.inline?(v.openBlock(),v.createBlock(u,{key:0,"model-value":((l=n.data)==null?void 0:l[n.name])||null,component:"vs-datepicker",onUpdateValue:a.changeData},{default:v.withCtx(()=>[v.createElementVNode("div",VO,v.toDisplayString(a.dateValue),1)]),_:1},8,["model-value","onUpdateValue"])):(v.openBlock(),v.createElementBlock("div",FO,v.toDisplayString(a.dateValue),1))}const jO=at(BO,[["render",$O]]),UO=v.defineComponent({name:"VsNumberValue",props:{data:{type:Object},name:String},computed:{formattedValue(){try{return new Intl.NumberFormat("ua",{notation:"compact"}).format(this.data[this.name])}catch(t){return console.error("Formatting error:",t.message),this.value}}}}),HO={class:"block w-full pr-[10px] text-left"};function qO(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("span",HO,v.toDisplayString(t.formattedValue),1)}const WO={"table-format-text":zb,"table-format-select":IA,"table-format-badge":yA,"table-format-swetch":Lb,"table-format-check":Lb,"table-format-html":zb,"table-format-tags":NA,"table-format-date":jO,"table-format-number":at(UO,[["render",qO]])},GO={},ZO={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 YO(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",ZO,e[0]||(e[0]=[v.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),v.createElementVNode("path",{d:"m21 21-4.3-4.3"},null,-1)]))}const ny=at(GO,[["render",YO]]),XO={components:{IconSearch:ny},data(){return{color:void 0,data:null,searchValue:""}},mounted(){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 createUser(){try{await xt.post("/api/user-cls",{name:"User1",color:"#000",children:[{name:"User2",id:"11212"}]})}catch{}},async getData(){try{const{data:t}=await xt.get("/api/user-cls");this.data=t}catch{}}}},KO={class:"w-[300px] border-r",style:{height:"calc(100vh - 60px)"}},JO={class:"relative"},QO={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)"}},ez={class:"w-[99%] overflow-hidden overflow-ellipsis"},tz={class:"ml-auto text-[10px] h-[16px] px-[6px] flex items-center justify-center rounded-full bg-gray-200"};function nz(t,e,n,i,r,a){const u=v.resolveComponent("IconSearch"),l=v.resolveComponent("VsText"),g=v.resolveComponent("router-link");return v.openBlock(),v.createElementBlock("div",KO,[v.createElementVNode("div",JO,[v.createVNode(u,{height:"16",width:"16",class:"absolute top-[12px] left-[30px] text-gray-500 z-[1]"}),v.createVNode(l,{type:"text",modelValue:r.searchValue,"onUpdate:modelValue":e[0]||(e[0]=_=>r.searchValue=_),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"])]),v.createElementVNode("ul",QO,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(a.rows,_=>{var S,E;return v.openBlock(),v.createElementBlock("li",{key:_==null?void 0:_.id,class:"w-full pr-[10px]"},[v.createVNode(g,{to:"/reester?name="+((_==null?void 0:_.name)||(_==null?void 0:_.id)),class:v.normalizeClass(["py-2 px-5 group pr-[10px] flex items-center gap-x-3 w-full flex justify-between hover:bg-gray-100 rounded-lg duration-300",{"bg-gray-100":((E=(S=t.$route)==null?void 0:S.query)==null?void 0:E.name)===(_==null?void 0:_.name)}])},{default:v.withCtx(()=>[v.createElementVNode("span",ez,v.toDisplayString((_==null?void 0:_.name)||(_==null?void 0:_.id)),1),v.createElementVNode("span",tz,v.toDisplayString((_==null?void 0:_.children)||0),1)]),_:2},1032,["to","class"])])}),128))])])}const iz=at(XO,[["render",nz]]),rz={props:{title:{type:String,default:()=>"Дані для відображення відсутні"},text:{type:String,default:()=>"Змініть параметри пошуку або спробуйте пізніше"}}},sz={class:"w-full"},oz={class:"p-5 min-h-[500px] flex flex-col justify-center items-center text-center"},az={class:"max-w-sm mx-auto mt-6"},lz={class:"font-medium text-gray-800 dark:text-neutral-200"},cz={class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"};function uz(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("div",sz,[v.createElementVNode("div",oz,[e[0]||(e[0]=v.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)),v.createElementVNode("div",az,[v.createElementVNode("p",lz,v.toDisplayString(n.title),1),v.createElementVNode("p",cz,v.toDisplayString(n.text),1)])])])}const hz=at(rz,[["render",uz]]),dz={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()}}},pz={class:"flex w-[160px] flex-wrap gap-[4px]"},fz=["onClick"];function mz(t,e,n,i,r,a){const u=v.resolveComponent("VsPopover");return v.openBlock(),v.createBlock(u,{ref:"popover",placement:"bottom"},{reference:v.withCtx(()=>[v.createElementVNode("button",{class:"h-[37px] w-[37px] rounded-lg flex items-center justify-center",style:v.normalizeStyle({backgroundColor:n.modelValue})},null,4)]),default:v.withCtx(()=>[v.createElementVNode("div",null,[v.createElementVNode("ul",pz,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(n.colors,l=>(v.openBlock(),v.createElementBlock("li",{class:"h-[37px] w-[37px] rounded",style:v.normalizeStyle({backgroundColor:l}),onClick:g=>a.updateColor(l),key:l},null,12,fz))),128))])])]),_:1},512)}const z1=at(dz,[["render",mz]]),gz={components:{VsChoceColor:z1},props:{item:Object},data(){var t,e;return{color:((t=this.item)==null?void 0:t.color)||"#000",text:((e=this.item)==null?void 0:e.text)||""}},watch:{color(t){this.$emit("update-item",{...this.item,color:t})},text(t){this.$emit("update-item",{...this.item,text:t})}}},yz={class:"p-3 relative group flex items-center gap-x-3 bg-white border border-gray-200 rounded-xl"},_z={class:"block text-sm font-semibold text-gray-800 min-w-[200px] z-[10] cursor-pointer"},xz={class:"block truncate text-xs text-gray-500 dark:text-neutral-500"};function bz(t,e,n,i,r,a){var g;const u=v.resolveComponent("VsChoceColor"),l=v.resolveComponent("VsInlineEdit");return v.openBlock(),v.createElementBlock("div",yz,[v.createVNode(u,{modelValue:r.color,"onUpdate:modelValue":e[0]||(e[0]=_=>r.color=_)},null,8,["modelValue"]),v.createElementVNode("div",null,[v.createVNode(l,{modelValue:r.text,"onUpdate:modelValue":e[1]||(e[1]=_=>r.text=_),onUpdateValue:e[2]||(e[2]=_=>r.text=_)},{default:v.withCtx(()=>[v.createElementVNode("p",_z,v.toDisplayString(r.text),1)]),_:1},8,["modelValue"]),v.createElementVNode("p",xz,v.toDisplayString((g=n.item)==null?void 0:g.parent),1)])])}const vz={components:{VsReesterUsersItem:at(gz,[["render",bz]])},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){var n;const e=(n=this.list)==null?void 0:n.findIndex(i=>(i==null?void 0:i.id)===(t==null?void 0:t.id));this.list[e]=t,this.$emit("update-list",this.list)}}},wz={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)"}},kz=["onDragstart","onDrop"];function Sz(t,e,n,i,r,a){const u=v.resolveComponent("VsReesterUsersItem");return v.openBlock(),v.createElementBlock("ul",wz,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(n.list,(l,g)=>(v.openBlock(),v.createElementBlock("li",{key:l==null?void 0:l.id,draggable:!0,onDragstart:_=>a.dragStart(_,g),onDragover:e[0]||(e[0]=_=>a.dragOver(_)),onDrop:_=>a.drop(_,g),onDragend:e[1]||(e[1]=(..._)=>a.dragEnd&&a.dragEnd(..._))},[v.createVNode(u,{item:l,onUpdateItem:a.updateItem},null,8,["item","onUpdateItem"])],40,kz))),128))])}const Ez={components:{VsNoData:hz,VsChoceColor:z1,IconCheck:Rb,VsReesterUsersList:at(vz,[["render",Sz],["__scopeId","data-v-d46b1d2e"]])},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;try{const{data:e}=await xt.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 xt.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 xt.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)}}}},Cz={class:"bg-gray-50 flex justify-center",style:{height:"calc(100vh - 60px)",width:"calc(100vw - 560px)"}},Tz={key:0,class:"mt-[100px] p-[10px]",style:{"max-height":"calc(100vh - 300px)",width:"calc(100vw - 1000px)"}},Mz={class:"flex items-end w-full gap-[4px]"};function Az(t,e,n,i,r,a){var E,T,I,z,F;const u=v.resolveComponent("VsForm"),l=v.resolveComponent("VsChoceColor"),g=v.resolveComponent("IconCheck"),_=v.resolveComponent("VsReesterUsersList"),S=v.resolveComponent("VsNoData");return v.openBlock(),v.createElementBlock("div",Cz,[(T=(E=t.$route)==null?void 0:E.query)!=null&&T.name?(v.openBlock(),v.createElementBlock("div",Tz,[e[3]||(e[3]=v.createElementVNode("h2",{class:"font-bold mb-[10px]"},"Створити",-1)),v.createElementVNode("div",Mz,[r.formVisible?(v.openBlock(),v.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[0]||(e[0]=j=>r.formValues=j),class:"p-0 m-0 h-[65px] w-full"},null,8,["scheme","modelValue"])):v.createCommentVNode("",!0),v.createVNode(l,{modelValue:r.color,"onUpdate:modelValue":e[1]||(e[1]=j=>r.color=j)},null,8,["modelValue"]),v.createElementVNode("button",{onClick:e[2]||(e[2]=(...j)=>a.addOneChild&&a.addOneChild(...j)),class:"h-[37px] w-[37px] rounded-lg bg-blue-600 ml-[6px] flex items-center justify-center text-white hover:bg-blue-700 duration-300"},[v.createVNode(g,{height:"20",width:"20"})])]),(z=(I=r.data)==null?void 0:I.children)!=null&&z.length?(v.openBlock(),v.createBlock(_,{key:0,list:(F=r.data)==null?void 0:F.children,onUpdateList:a.updateChildren},null,8,["list","onUpdateList"])):v.createCommentVNode("",!0)])):(v.openBlock(),v.createBlock(S,{key:1,class:"mt-[100px]",text:"Оберіть один з пунктів меню для відображення"}))])}const Pz={components:{VsReesterNavList:iz,VsReesterContent:at(Ez,[["render",Az]])},data(){return{}},methods:{}},Iz={class:"flex items-start gap-0"};function Dz(t,e,n,i,r,a){const u=v.resolveComponent("VsReesterNavList"),l=v.resolveComponent("VsReesterContent");return v.openBlock(),v.createElementBlock("div",Iz,[v.createVNode(u),v.createVNode(l)])}const Oz={"reester-page":at(Pz,[["render",Dz]])},R1=t=>{const e=[];return t.forEach(n=>{n.menu?e.push(...R1(n.menu)):e.push(n)}),e};function L1(t,e,n){if(t!==null)for(var i,r,a,u,l,g,_,S=0,E=0,T,I=t.type,z=I==="FeatureCollection",F=I==="Feature",j=z?t.features.length:1,Z=0;Z<j;Z++){_=z?t.features[Z].geometry:F?t.geometry:t,T=_?_.type==="GeometryCollection":!1,l=T?_.geometries.length:1;for(var ie=0;ie<l;ie++){var le=0,J=0;if(u=T?_.geometries[ie]:_,u!==null){g=u.coordinates;var Ee=u.type;switch(S=0,Ee){case null:break;case"Point":if(e(g,E,Z,le,J)===!1)return!1;E++,le++;break;case"LineString":case"MultiPoint":for(i=0;i<g.length;i++){if(e(g[i],E,Z,le,J)===!1)return!1;E++,Ee==="MultiPoint"&&le++}Ee==="LineString"&&le++;break;case"Polygon":case"MultiLineString":for(i=0;i<g.length;i++){for(r=0;r<g[i].length-S;r++){if(e(g[i][r],E,Z,le,J)===!1)return!1;E++}Ee==="MultiLineString"&&le++,Ee==="Polygon"&&J++}Ee==="Polygon"&&le++;break;case"MultiPolygon":for(i=0;i<g.length;i++){for(J=0,r=0;r<g[i].length;r++){for(a=0;a<g[i][r].length-S;a++){if(e(g[i][r][a],E,Z,le,J)===!1)return!1;E++}J++}le++}break;case"GeometryCollection":for(i=0;i<u.geometries.length;i++)if(L1(u.geometries[i],e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function N1(t,e={}){if(t.bbox!=null&&e.recompute!==!0)return t.bbox;const n=[1/0,1/0,-1/0,-1/0];return L1(t,i=>{n[0]>i[0]&&(n[0]=i[0]),n[1]>i[1]&&(n[1]=i[1]),n[2]<i[0]&&(n[2]=i[0]),n[3]<i[1]&&(n[3]=i[1])}),n}var zz=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rz(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Lz(t,e,n={}){const i={type:"Feature"};return(n.id===0||n.id)&&(i.id=n.id),n.bbox&&(i.bbox=n.bbox),i.properties={},i.geometry=t,i}function B1(t,e={}){const n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}var V1={exports:{}};/**
|
|
46
46
|
* MapLibre GL JS
|
|
47
47
|
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.0/LICENSE.txt
|
|
48
48
|
*/(function(t,e){(function(n,i){t.exports=i()})(zz,function(){var n={},i={};function r(u,l,g){if(i[u]=g,u==="index"){var _="var sharedModule = {}; ("+i.shared+")(sharedModule); ("+i.worker+")(sharedModule);",S={};return i.shared(S),i.index(n,S),typeof window<"u"&&n.setWorkerUrl(window.URL.createObjectURL(new Blob([_],{type:"text/javascript"}))),n}}r("shared",["exports"],function(u){function l(c,o,h,p){return new(h||(h=Promise))(function(y,w){function k(O){try{A(p.next(O))}catch(R){w(R)}}function C(O){try{A(p.throw(O))}catch(R){w(R)}}function A(O){var R;O.done?y(O.value):(R=O.value,R instanceof h?R:new h(function(N){N(R)})).then(k,C)}A((p=p.apply(c,o||[])).next())})}function g(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}typeof SuppressedError=="function"&&SuppressedError;var _=S;function S(c,o){this.x=c,this.y=o}S.prototype={clone:function(){return new S(this.x,this.y)},add:function(c){return this.clone()._add(c)},sub:function(c){return this.clone()._sub(c)},multByPoint:function(c){return this.clone()._multByPoint(c)},divByPoint:function(c){return this.clone()._divByPoint(c)},mult:function(c){return this.clone()._mult(c)},div:function(c){return this.clone()._div(c)},rotate:function(c){return this.clone()._rotate(c)},rotateAround:function(c,o){return this.clone()._rotateAround(c,o)},matMult:function(c){return this.clone()._matMult(c)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(c){return this.x===c.x&&this.y===c.y},dist:function(c){return Math.sqrt(this.distSqr(c))},distSqr:function(c){var o=c.x-this.x,h=c.y-this.y;return o*o+h*h},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(c){return Math.atan2(this.y-c.y,this.x-c.x)},angleWith:function(c){return this.angleWithSep(c.x,c.y)},angleWithSep:function(c,o){return Math.atan2(this.x*o-this.y*c,this.x*c+this.y*o)},_matMult:function(c){var o=c[2]*this.x+c[3]*this.y;return this.x=c[0]*this.x+c[1]*this.y,this.y=o,this},_add:function(c){return this.x+=c.x,this.y+=c.y,this},_sub:function(c){return this.x-=c.x,this.y-=c.y,this},_mult:function(c){return this.x*=c,this.y*=c,this},_div:function(c){return this.x/=c,this.y/=c,this},_multByPoint:function(c){return this.x*=c.x,this.y*=c.y,this},_divByPoint:function(c){return this.x/=c.x,this.y/=c.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var c=this.y;return this.y=this.x,this.x=-c,this},_rotate:function(c){var o=Math.cos(c),h=Math.sin(c),p=h*this.x+o*this.y;return this.x=o*this.x-h*this.y,this.y=p,this},_rotateAround:function(c,o){var h=Math.cos(c),p=Math.sin(c),y=o.y+p*(this.x-o.x)+h*(this.y-o.y);return this.x=o.x+h*(this.x-o.x)-p*(this.y-o.y),this.y=y,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},S.convert=function(c){return c instanceof S?c:Array.isArray(c)?new S(c[0],c[1]):c};var E=g(_),T=I;function I(c,o,h,p){this.cx=3*c,this.bx=3*(h-c)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(p-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=c,this.p1y=o,this.p2x=h,this.p2y=p}I.prototype={sampleCurveX:function(c){return((this.ax*c+this.bx)*c+this.cx)*c},sampleCurveY:function(c){return((this.ay*c+this.by)*c+this.cy)*c},sampleCurveDerivativeX:function(c){return(3*this.ax*c+2*this.bx)*c+this.cx},solveCurveX:function(c,o){if(o===void 0&&(o=1e-6),c<0)return 0;if(c>1)return 1;for(var h=c,p=0;p<8;p++){var y=this.sampleCurveX(h)-c;if(Math.abs(y)<o)return h;var w=this.sampleCurveDerivativeX(h);if(Math.abs(w)<1e-6)break;h-=y/w}var k=0,C=1;for(h=c,p=0;p<20&&(y=this.sampleCurveX(h),!(Math.abs(y-c)<o));p++)c>y?k=h:C=h,h=.5*(C-k)+k;return h},solve:function(c,o){return this.sampleCurveY(this.solveCurveX(c,o))}};var z=g(T);let F,j;function Z(){return F==null&&(F=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),F}function ie(){if(j==null&&(j=!1,Z())){const o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let p=0;p<5*5;p++){const y=4*p;o.fillStyle=`rgb(${y},${y+1},${y+2})`,o.fillRect(p%5,Math.floor(p/5),1,1)}const h=o.getImageData(0,0,5,5).data;for(let p=0;p<5*5*4;p++)if(p%4!=3&&h[p]!==p){j=!0;break}}}return j||!1}function le(c,o,h,p){const y=new z(c,o,h,p);return w=>y.solve(w)}const J=le(.25,.1,.25,1);function Ee(c,o,h){return Math.min(h,Math.max(o,c))}function be(c,o,h){const p=h-o,y=((c-o)%p+p)%p+o;return y===o?h:y}function Ae(c,...o){for(const h of o)for(const p in h)c[p]=h[p];return c}let Le=1;function Pe(c,o,h){const p={};for(const y in c)p[y]=o.call(this,c[y],y,c);return p}function Ye(c,o,h){const p={};for(const y in c)o.call(this,c[y],y,c)&&(p[y]=c[y]);return p}function it(c){return Array.isArray(c)?c.map(it):typeof c=="object"&&c?Pe(c,it):c}const Nt={};function dt(c){Nt[c]||(typeof console<"u"&&console.warn(c),Nt[c]=!0)}function Rt(c,o,h){return(h.y-c.y)*(o.x-c.x)>(o.y-c.y)*(h.x-c.x)}function Xt(c){return typeof WorkerGlobalScope<"u"&&c!==void 0&&c instanceof WorkerGlobalScope}let nn=null;function jt(c){return typeof ImageBitmap<"u"&&c instanceof ImageBitmap}const Tt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Sn(c,o,h,p,y){return l(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const w=new VideoFrame(c,{timestamp:0});try{const k=w==null?void 0:w.format;if(!k||!k.startsWith("BGR")&&!k.startsWith("RGB"))throw new Error(`Unrecognized format ${k}`);const C=k.startsWith("BGR"),A=new Uint8ClampedArray(p*y*4);if(yield w.copyTo(A,function(O,R,N,$,q){const G=4*Math.max(-R,0),X=(Math.max(0,N)-N)*$*4+G,ne=4*$,oe=Math.max(0,R),xe=Math.max(0,N);return{rect:{x:oe,y:xe,width:Math.min(O.width,R+$)-oe,height:Math.min(O.height,N+q)-xe},layout:[{offset:X,stride:ne}]}}(c,o,h,p,y)),C)for(let O=0;O<A.length;O+=4){const R=A[O];A[O]=A[O+2],A[O+2]=R}return A}finally{w.close()}})}let _n,In;const xn="AbortError";function pi(){return new Error(xn)}const Wn={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function jn(c){return Wn.REGISTERED_PROTOCOLS[c.substring(0,c.indexOf("://"))]}const Gn="global-dispatcher";class Te extends Error{constructor(o,h,p,y){super(`AJAXError: ${h} (${o}): ${p}`),this.status=o,this.statusText=h,this.url=p,this.body=y}}const je=()=>Xt(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Xe=function(c,o){if(/:\/\//.test(c.url)&&!/^https?:|^file:/.test(c.url)){const p=jn(c.url);if(p)return p(c,o);if(Xt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:c,targetMapId:Gn},o)}if(!(/^file:/.test(h=c.url)||/^file:/.test(je())&&!/^\w+:/.test(h))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(p,y){return l(this,void 0,void 0,function*(){const w=new Request(p.url,{method:p.method||"GET",body:p.body,credentials:p.credentials,headers:p.headers,cache:p.cache,referrer:je(),signal:y.signal});p.type!=="json"||w.headers.has("Accept")||w.headers.set("Accept","application/json");const k=yield fetch(w);if(!k.ok){const O=yield k.blob();throw new Te(k.status,k.statusText,p.url,O)}let C;C=p.type==="arrayBuffer"||p.type==="image"?k.arrayBuffer():p.type==="json"?k.json():k.text();const A=yield C;if(y.signal.aborted)throw pi();return{data:A,cacheControl:k.headers.get("Cache-Control"),expires:k.headers.get("Expires")}})}(c,o);if(Xt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:c,mustQueue:!0,targetMapId:Gn},o)}var h;return function(p,y){return new Promise((w,k)=>{var C;const A=new XMLHttpRequest;A.open(p.method||"GET",p.url,!0),p.type!=="arrayBuffer"&&p.type!=="image"||(A.responseType="arraybuffer");for(const O in p.headers)A.setRequestHeader(O,p.headers[O]);p.type==="json"&&(A.responseType="text",!((C=p.headers)===null||C===void 0)&&C.Accept||A.setRequestHeader("Accept","application/json")),A.withCredentials=p.credentials==="include",A.onerror=()=>{k(new Error(A.statusText))},A.onload=()=>{if(!y.signal.aborted)if((A.status>=200&&A.status<300||A.status===0)&&A.response!==null){let O=A.response;if(p.type==="json")try{O=JSON.parse(A.response)}catch(R){return void k(R)}w({data:O,cacheControl:A.getResponseHeader("Cache-Control"),expires:A.getResponseHeader("Expires")})}else{const O=new Blob([A.response],{type:A.getResponseHeader("Content-Type")});k(new Te(A.status,A.statusText,p.url,O))}},y.signal.addEventListener("abort",()=>{A.abort(),k(pi())}),A.send(p.body)})}(c,o)};function ct(c){if(!c||c.indexOf("://")<=0||c.indexOf("data:image/")===0||c.indexOf("blob:")===0)return!0;const o=new URL(c),h=window.location;return o.protocol===h.protocol&&o.host===h.host}function Bt(c,o,h){h[c]&&h[c].indexOf(o)!==-1||(h[c]=h[c]||[],h[c].push(o))}function rn(c,o,h){if(h&&h[c]){const p=h[c].indexOf(o);p!==-1&&h[c].splice(p,1)}}class Dt{constructor(o,h={}){Ae(this,h),this.type=o}}class At extends Dt{constructor(o,h={}){super("error",Ae({error:o},h))}}class ln{on(o,h){return this._listeners=this._listeners||{},Bt(o,h,this._listeners),this}off(o,h){return rn(o,h,this._listeners),rn(o,h,this._oneTimeListeners),this}once(o,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},Bt(o,h,this._oneTimeListeners),this):new Promise(p=>this.once(o,p))}fire(o,h){typeof o=="string"&&(o=new Dt(o,h||{}));const p=o.type;if(this.listens(p)){o.target=this;const y=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const C of y)C.call(this,o);const w=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const C of w)rn(p,C,this._oneTimeListeners),C.call(this,o);const k=this._eventedParent;k&&(Ae(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),k.fire(o))}else o instanceof At&&console.error(o.error);return this}listens(o){return this._listeners&&this._listeners[o]&&this._listeners[o].length>0||this._oneTimeListeners&&this._oneTimeListeners[o]&&this._oneTimeListeners[o].length>0||this._eventedParent&&this._eventedParent.listens(o)}setEventedParent(o,h){return this._eventedParent=o,this._eventedParentData=h,this}}var ke={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const En=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Ss(c,o){const h={};for(const p in c)p!=="ref"&&(h[p]=c[p]);return En.forEach(p=>{p in o&&(h[p]=o[p])}),h}function Kt(c,o){if(Array.isArray(c)){if(!Array.isArray(o)||c.length!==o.length)return!1;for(let h=0;h<c.length;h++)if(!Kt(c[h],o[h]))return!1;return!0}if(typeof c=="object"&&c!==null&&o!==null){if(typeof o!="object"||Object.keys(c).length!==Object.keys(o).length)return!1;for(const h in c)if(!Kt(c[h],o[h]))return!1;return!0}return c===o}function hn(c,o){c.push(o)}function er(c,o,h){hn(h,{command:"addSource",args:[c,o[c]]})}function tr(c,o,h){hn(o,{command:"removeSource",args:[c]}),h[c]=!0}function xi(c,o,h,p){tr(c,h,p),er(c,o,h)}function Dr(c,o,h){let p;for(p in c[h])if(Object.prototype.hasOwnProperty.call(c[h],p)&&p!=="data"&&!Kt(c[h][p],o[h][p]))return!1;for(p in o[h])if(Object.prototype.hasOwnProperty.call(o[h],p)&&p!=="data"&&!Kt(c[h][p],o[h][p]))return!1;return!0}function bi(c,o,h,p,y,w){c=c||{},o=o||{};for(const k in c)Object.prototype.hasOwnProperty.call(c,k)&&(Kt(c[k],o[k])||h.push({command:w,args:[p,k,o[k],y]}));for(const k in o)Object.prototype.hasOwnProperty.call(o,k)&&!Object.prototype.hasOwnProperty.call(c,k)&&(Kt(c[k],o[k])||h.push({command:w,args:[p,k,o[k],y]}))}function Es(c){return c.id}function Cs(c,o){return c[o.id]=o,c}class Be{constructor(o,h,p,y){this.message=(o?`${o}: `:"")+p,y&&(this.identifier=y),h!=null&&h.__line__&&(this.line=h.__line__)}}function Or(c,...o){for(const h of o)for(const p in h)c[p]=h[p];return c}class vi extends Error{constructor(o,h){super(h),this.message=h,this.key=o}}class zr{constructor(o,h=[]){this.parent=o,this.bindings={};for(const[p,y]of h)this.bindings[p]=y}concat(o){return new zr(this,o)}get(o){if(this.bindings[o])return this.bindings[o];if(this.parent)return this.parent.get(o);throw new Error(`${o} not found in scope.`)}has(o){return!!this.bindings[o]||!!this.parent&&this.parent.has(o)}}const Ts={kind:"null"},qe={kind:"number"},we={kind:"string"},Re={kind:"boolean"},vt={kind:"color"},Ut={kind:"object"},Je={kind:"value"},Rn={kind:"collator"},Kn={kind:"formatted"},Ui={kind:"padding"},pr={kind:"resolvedImage"},se={kind:"variableAnchorOffsetCollection"};function H(c,o){return{kind:"array",itemType:c,N:o}}function U(c){if(c.kind==="array"){const o=U(c.itemType);return typeof c.N=="number"?`array<${o}, ${c.N}>`:c.itemType.kind==="value"?"array":`array<${o}>`}return c.kind}const Y=[Ts,qe,we,Re,vt,Kn,Ut,H(Je),Ui,pr,se];function te(c,o){if(o.kind==="error")return null;if(c.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!te(c.itemType,o.itemType))&&(typeof c.N!="number"||c.N===o.N))return null}else{if(c.kind===o.kind)return null;if(c.kind==="value"){for(const h of Y)if(!te(h,o))return null}}return`Expected ${U(c)} but found ${U(o)} instead.`}function de(c,o){return o.some(h=>h.kind===c.kind)}function fe(c,o){return o.some(h=>h==="null"?c===null:h==="array"?Array.isArray(c):h==="object"?c&&!Array.isArray(c)&&typeof c=="object":h===typeof c)}function _e(c,o){return c.kind==="array"&&o.kind==="array"?c.itemType.kind===o.itemType.kind&&typeof c.N=="number":c.kind===o.kind}const ue=.96422,Me=.82521,ze=4/29,Se=6/29,Ue=3*Se*Se,bt=Se*Se*Se,kt=Math.PI/180,sn=180/Math.PI;function Lt(c){return(c%=360)<0&&(c+=360),c}function on([c,o,h,p]){let y,w;const k=ri((.2225045*(c=Zt(c))+.7168786*(o=Zt(o))+.0606169*(h=Zt(h)))/1);c===o&&o===h?y=w=k:(y=ri((.4360747*c+.3850649*o+.1430804*h)/ue),w=ri((.0139322*c+.0971045*o+.7141733*h)/Me));const C=116*k-16;return[C<0?0:C,500*(y-k),200*(k-w),p]}function Zt(c){return c<=.04045?c/12.92:Math.pow((c+.055)/1.055,2.4)}function ri(c){return c>bt?Math.pow(c,1/3):c/Ue+ze}function Zn([c,o,h,p]){let y=(c+16)/116,w=isNaN(o)?y:y+o/500,k=isNaN(h)?y:y-h/200;return y=1*bn(y),w=ue*bn(w),k=Me*bn(k),[$t(3.1338561*w-1.6168667*y-.4906146*k),$t(-.9787684*w+1.9161415*y+.033454*k),$t(.0719453*w-.2289914*y+1.4052427*k),p]}function $t(c){return(c=c<=.00304?12.92*c:1.055*Math.pow(c,1/2.4)-.055)<0?0:c>1?1:c}function bn(c){return c>Se?c*c*c:Ue*(c-ze)}function Un(c){return parseInt(c.padEnd(2,c),16)/255}function fi(c,o){return wi(o?c/100:c,0,1)}function wi(c,o,h){return Math.min(Math.max(o,c),h)}function Hi(c){return!c.some(Number.isNaN)}const Ma={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class vn{constructor(o,h,p,y=1,w=!0){this.r=o,this.g=h,this.b=p,this.a=y,w||(this.r*=y,this.g*=y,this.b*=y,y||this.overwriteGetter("rgb",[o,h,p,y]))}static parse(o){if(o instanceof vn)return o;if(typeof o!="string")return;const h=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const y=Ma[p];if(y){const[k,C,A]=y;return[k/255,C/255,A/255,1]}if(p.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(p)){const k=p.length<6?1:2;let C=1;return[Un(p.slice(C,C+=k)),Un(p.slice(C,C+=k)),Un(p.slice(C,C+=k)),Un(p.slice(C,C+k)||"ff")]}if(p.startsWith("rgb")){const k=p.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(k){const[C,A,O,R,N,$,q,G,X,ne,oe,xe]=k,pe=[R||" ",q||" ",ne].join("");if(pe===" "||pe===" /"||pe===",,"||pe===",,,"){const ye=[O,$,X].join(""),Ce=ye==="%%%"?100:ye===""?255:0;if(Ce){const Ne=[wi(+A/Ce,0,1),wi(+N/Ce,0,1),wi(+G/Ce,0,1),oe?fi(+oe,xe):1];if(Hi(Ne))return Ne}}return}}const w=p.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(w){const[k,C,A,O,R,N,$,q,G]=w,X=[A||" ",R||" ",$].join("");if(X===" "||X===" /"||X===",,"||X===",,,"){const ne=[+C,wi(+O,0,100),wi(+N,0,100),q?fi(+q,G):1];if(Hi(ne))return function([oe,xe,pe,ye]){function Ce(Ne){const tt=(Ne+oe/30)%12,St=xe*Math.min(pe,1-pe);return pe-St*Math.max(-1,Math.min(tt-3,9-tt,1))}return oe=Lt(oe),xe/=100,pe/=100,[Ce(0),Ce(8),Ce(4),ye]}(ne)}}}(o);return h?new vn(...h,!1):void 0}get rgb(){const{r:o,g:h,b:p,a:y}=this,w=y||1/0;return this.overwriteGetter("rgb",[o/w,h/w,p/w,y])}get hcl(){return this.overwriteGetter("hcl",function(o){const[h,p,y,w]=on(o),k=Math.sqrt(p*p+y*y);return[Math.round(1e4*k)?Lt(Math.atan2(y,p)*sn):NaN,k,h,w]}(this.rgb))}get lab(){return this.overwriteGetter("lab",on(this.rgb))}overwriteGetter(o,h){return Object.defineProperty(this,o,{value:h}),h}toString(){const[o,h,p,y]=this.rgb;return`rgba(${[o,h,p].map(w=>Math.round(255*w)).join(",")},${y})`}}vn.black=new vn(0,0,0,1),vn.white=new vn(1,1,1,1),vn.transparent=new vn(0,0,0,0),vn.red=new vn(1,0,0,1);class Zh{constructor(o,h,p){this.sensitivity=o?h?"variant":"case":h?"accent":"base",this.locale=p,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(o,h){return this.collator.compare(o,h)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Yh{constructor(o,h,p,y,w){this.text=o,this.image=h,this.scale=p,this.fontStack=y,this.textColor=w}}class fr{constructor(o){this.sections=o}static fromString(o){return new fr([new Yh(o,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(o=>o.text.length!==0||o.image&&o.image.name.length!==0)}static factory(o){return o instanceof fr?o:fr.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class mr{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof mr)return o;if(typeof o=="number")return new mr([o,o,o,o]);if(Array.isArray(o)&&!(o.length<1||o.length>4)){for(const h of o)if(typeof h!="number")return;switch(o.length){case 1:o=[o[0],o[0],o[0],o[0]];break;case 2:o=[o[0],o[1],o[0],o[1]];break;case 3:o=[o[0],o[1],o[2],o[1]]}return new mr(o)}}toString(){return JSON.stringify(this.values)}}const Y0=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Rr{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof Rr)return o;if(Array.isArray(o)&&!(o.length<1)&&o.length%2==0){for(let h=0;h<o.length;h+=2){const p=o[h],y=o[h+1];if(typeof p!="string"||!Y0.has(p)||!Array.isArray(y)||y.length!==2||typeof y[0]!="number"||typeof y[1]!="number")return}return new Rr(o)}}toString(){return JSON.stringify(this.values)}}class gr{constructor(o){this.name=o.name,this.available=o.available}toString(){return this.name}static fromString(o){return o?new gr({name:o,available:!1}):null}}function Aa(c,o,h,p){return typeof c=="number"&&c>=0&&c<=255&&typeof o=="number"&&o>=0&&o<=255&&typeof h=="number"&&h>=0&&h<=255?p===void 0||typeof p=="number"&&p>=0&&p<=1?null:`Invalid rgba value [${[c,o,h,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[c,o,h,p]:[c,o,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Fo(c){if(c===null||typeof c=="string"||typeof c=="boolean"||typeof c=="number"||c instanceof vn||c instanceof Zh||c instanceof fr||c instanceof mr||c instanceof Rr||c instanceof gr)return!0;if(Array.isArray(c)){for(const o of c)if(!Fo(o))return!1;return!0}if(typeof c=="object"){for(const o in c)if(!Fo(c[o]))return!1;return!0}return!1}function si(c){if(c===null)return Ts;if(typeof c=="string")return we;if(typeof c=="boolean")return Re;if(typeof c=="number")return qe;if(c instanceof vn)return vt;if(c instanceof Zh)return Rn;if(c instanceof fr)return Kn;if(c instanceof mr)return Ui;if(c instanceof Rr)return se;if(c instanceof gr)return pr;if(Array.isArray(c)){const o=c.length;let h;for(const p of c){const y=si(p);if(h){if(h===y)continue;h=Je;break}h=y}return H(h||Je,o)}return Ut}function Nl(c){const o=typeof c;return c===null?"":o==="string"||o==="number"||o==="boolean"?String(c):c instanceof vn||c instanceof fr||c instanceof mr||c instanceof Rr||c instanceof gr?c.toString():JSON.stringify(c)}class Kr{constructor(o,h){this.type=o,this.value=h}static parse(o,h){if(o.length!==2)return h.error(`'literal' expression requires exactly one argument, but found ${o.length-1} instead.`);if(!Fo(o[1]))return h.error("invalid value");const p=o[1];let y=si(p);const w=h.expectedType;return y.kind!=="array"||y.N!==0||!w||w.kind!=="array"||typeof w.N=="number"&&w.N!==0||(y=w),new Kr(y,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class ti{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const eu={string:we,number:qe,boolean:Re,object:Ut};class Jr{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");let p,y=1;const w=o[0];if(w==="array"){let C,A;if(o.length>2){const O=o[1];if(typeof O!="string"||!(O in eu)||O==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);C=eu[O],y++}else C=Je;if(o.length>3){if(o[2]!==null&&(typeof o[2]!="number"||o[2]<0||o[2]!==Math.floor(o[2])))return h.error('The length argument to "array" must be a positive integer literal',2);A=o[2],y++}p=H(C,A)}else{if(!eu[w])throw new Error(`Types doesn't contain name = ${w}`);p=eu[w]}const k=[];for(;y<o.length;y++){const C=h.parse(o[y],y,Je);if(!C)return null;k.push(C)}return new Jr(p,k)}evaluate(o){for(let h=0;h<this.args.length;h++){const p=this.args[h].evaluate(o);if(!te(this.type,si(p)))return p;if(h===this.args.length-1)throw new ti(`Expected value to be of type ${U(this.type)}, but found ${U(si(p))} instead.`)}throw new Error}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const Xh={"to-boolean":Re,"to-color":vt,"to-number":qe,"to-string":we};class Qr{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");const p=o[0];if(!Xh[p])throw new Error(`Can't parse ${p} as it is not part of the known types`);if((p==="to-boolean"||p==="to-string")&&o.length!==2)return h.error("Expected one argument.");const y=Xh[p],w=[];for(let k=1;k<o.length;k++){const C=h.parse(o[k],k,Je);if(!C)return null;w.push(C)}return new Qr(y,w)}evaluate(o){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(o);case"color":{let h,p;for(const y of this.args){if(h=y.evaluate(o),p=null,h instanceof vn)return h;if(typeof h=="string"){const w=o.parseColor(h);if(w)return w}else if(Array.isArray(h)&&(p=h.length<3||h.length>4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:Aa(h[0],h[1],h[2],h[3]),!p))return new vn(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new ti(p||`Could not parse color from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"padding":{let h;for(const p of this.args){h=p.evaluate(o);const y=mr.parse(h);if(y)return y}throw new ti(`Could not parse padding from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"variableAnchorOffsetCollection":{let h;for(const p of this.args){h=p.evaluate(o);const y=Rr.parse(h);if(y)return y}throw new ti(`Could not parse variableAnchorOffsetCollection from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"number":{let h=null;for(const p of this.args){if(h=p.evaluate(o),h===null)return 0;const y=Number(h);if(!isNaN(y))return y}throw new ti(`Could not convert ${JSON.stringify(h)} to number.`)}case"formatted":return fr.fromString(Nl(this.args[0].evaluate(o)));case"resolvedImage":return gr.fromString(Nl(this.args[0].evaluate(o)));default:return Nl(this.args[0].evaluate(o))}}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const X0=["Unknown","Point","LineString","Polygon"];class tu{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?X0[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(o){let h=this._parseColorCache[o];return h||(h=this._parseColorCache[o]=vn.parse(o)),h}}class $o{constructor(o,h,p=[],y,w=new zr,k=[]){this.registry=o,this.path=p,this.key=p.map(C=>`[${C}]`).join(""),this.scope=w,this.errors=k,this.expectedType=y,this._isConstant=h}parse(o,h,p,y,w={}){return h?this.concat(h,p,y)._parse(o,w):this._parse(o,w)}_parse(o,h){function p(y,w,k){return k==="assert"?new Jr(w,[y]):k==="coerce"?new Qr(w,[y]):y}if(o!==null&&typeof o!="string"&&typeof o!="boolean"&&typeof o!="number"||(o=["literal",o]),Array.isArray(o)){if(o.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const y=o[0];if(typeof y!="string")return this.error(`Expression name must be a string, but found ${typeof y} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const w=this.registry[y];if(w){let k=w.parse(o,this);if(!k)return null;if(this.expectedType){const C=this.expectedType,A=k.type;if(C.kind!=="string"&&C.kind!=="number"&&C.kind!=="boolean"&&C.kind!=="object"&&C.kind!=="array"||A.kind!=="value")if(C.kind!=="color"&&C.kind!=="formatted"&&C.kind!=="resolvedImage"||A.kind!=="value"&&A.kind!=="string")if(C.kind!=="padding"||A.kind!=="value"&&A.kind!=="number"&&A.kind!=="array")if(C.kind!=="variableAnchorOffsetCollection"||A.kind!=="value"&&A.kind!=="array"){if(this.checkSubtype(C,A))return null}else k=p(k,C,h.typeAnnotation||"coerce");else k=p(k,C,h.typeAnnotation||"coerce");else k=p(k,C,h.typeAnnotation||"coerce");else k=p(k,C,h.typeAnnotation||"assert")}if(!(k instanceof Kr)&&k.type.kind!=="resolvedImage"&&this._isConstant(k)){const C=new tu;try{k=new Kr(k.type,k.evaluate(C))}catch(A){return this.error(A.message),null}}return k}return this.error(`Unknown expression "${y}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(o===void 0?"'undefined' value invalid. Use null instead.":typeof o=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof o} instead.`)}concat(o,h,p){const y=typeof o=="number"?this.path.concat(o):this.path,w=p?this.scope.concat(p):this.scope;return new $o(this.registry,this._isConstant,y,h||null,w,this.errors)}error(o,...h){const p=`${this.key}${h.map(y=>`[${y}]`).join("")}`;this.errors.push(new vi(p,o))}checkSubtype(o,h){const p=te(o,h);return p&&this.error(p),p}}class uo{constructor(o,h){this.type=h.type,this.bindings=[].concat(o),this.result=h}evaluate(o){return this.result.evaluate(o)}eachChild(o){for(const h of this.bindings)o(h[1]);o(this.result)}static parse(o,h){if(o.length<4)return h.error(`Expected at least 3 arguments, but found ${o.length-1} instead.`);const p=[];for(let w=1;w<o.length-1;w+=2){const k=o[w];if(typeof k!="string")return h.error(`Expected string, but found ${typeof k} instead.`,w);if(/[^a-zA-Z0-9_]/.test(k))return h.error("Variable names must contain only alphanumeric characters or '_'.",w);const C=h.parse(o[w+1],w+1);if(!C)return null;p.push([k,C])}const y=h.parse(o[o.length-1],o.length-1,h.expectedType,p);return y?new uo(p,y):null}outputDefined(){return this.result.outputDefined()}}class dn{constructor(o,h){this.type=h.type,this.name=o,this.boundExpression=h}static parse(o,h){if(o.length!==2||typeof o[1]!="string")return h.error("'var' expression requires exactly one string literal argument.");const p=o[1];return h.scope.has(p)?new dn(p,h.scope.get(p)):h.error(`Unknown variable "${p}". Make sure "${p}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(o){return this.boundExpression.evaluate(o)}eachChild(){}outputDefined(){return!1}}class Kh{constructor(o,h,p){this.type=o,this.index=h,this.input=p}static parse(o,h){if(o.length!==3)return h.error(`Expected 2 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,qe),y=h.parse(o[2],2,H(h.expectedType||Je));return p&&y?new Kh(y.type.itemType,p,y):null}evaluate(o){const h=this.index.evaluate(o),p=this.input.evaluate(o);if(h<0)throw new ti(`Array index out of bounds: ${h} < 0.`);if(h>=p.length)throw new ti(`Array index out of bounds: ${h} > ${p.length-1}.`);if(h!==Math.floor(h))throw new ti(`Array index must be an integer, but found ${h} instead.`);return p[h]}eachChild(o){o(this.index),o(this.input)}outputDefined(){return!1}}class Jh{constructor(o,h){this.type=Re,this.needle=o,this.haystack=h}static parse(o,h){if(o.length!==3)return h.error(`Expected 2 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,Je),y=h.parse(o[2],2,Je);return p&&y?de(p.type,[Re,we,qe,Ts,Je])?new Jh(p,y):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${U(p.type)} instead`):null}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!p)return!1;if(!fe(h,["boolean","string","number","null"]))throw new ti(`Expected first argument to be of type boolean, string, number or null, but found ${U(si(h))} instead.`);if(!fe(p,["string","array"]))throw new ti(`Expected second argument to be of type array or string, but found ${U(si(p))} instead.`);return p.indexOf(h)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class Pa{constructor(o,h,p){this.type=qe,this.needle=o,this.haystack=h,this.fromIndex=p}static parse(o,h){if(o.length<=2||o.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,Je),y=h.parse(o[2],2,Je);if(!p||!y)return null;if(!de(p.type,[Re,we,qe,Ts,Je]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${U(p.type)} instead`);if(o.length===4){const w=h.parse(o[3],3,qe);return w?new Pa(p,y,w):null}return new Pa(p,y)}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!fe(h,["boolean","string","number","null"]))throw new ti(`Expected first argument to be of type boolean, string, number or null, but found ${U(si(h))} instead.`);let y;if(this.fromIndex&&(y=this.fromIndex.evaluate(o)),fe(p,["string"])){const w=p.indexOf(h,y);return w===-1?-1:[...p.slice(0,w)].length}if(fe(p,["array"]))return p.indexOf(h,y);throw new ti(`Expected second argument to be of type array or string, but found ${U(si(p))} instead.`)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class Qh{constructor(o,h,p,y,w,k){this.inputType=o,this.type=h,this.input=p,this.cases=y,this.outputs=w,this.otherwise=k}static parse(o,h){if(o.length<5)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if(o.length%2!=1)return h.error("Expected an even number of arguments.");let p,y;h.expectedType&&h.expectedType.kind!=="value"&&(y=h.expectedType);const w={},k=[];for(let O=2;O<o.length-1;O+=2){let R=o[O];const N=o[O+1];Array.isArray(R)||(R=[R]);const $=h.concat(O);if(R.length===0)return $.error("Expected at least one branch label.");for(const G of R){if(typeof G!="number"&&typeof G!="string")return $.error("Branch labels must be numbers or strings.");if(typeof G=="number"&&Math.abs(G)>Number.MAX_SAFE_INTEGER)return $.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof G=="number"&&Math.floor(G)!==G)return $.error("Numeric branch labels must be integer values.");if(p){if($.checkSubtype(p,si(G)))return null}else p=si(G);if(w[String(G)]!==void 0)return $.error("Branch labels must be unique.");w[String(G)]=k.length}const q=h.parse(N,O,y);if(!q)return null;y=y||q.type,k.push(q)}const C=h.parse(o[1],1,Je);if(!C)return null;const A=h.parse(o[o.length-1],o.length-1,y);return A?C.type.kind!=="value"&&h.concat(1).checkSubtype(p,C.type)?null:new Qh(p,y,C,w,k,A):null}evaluate(o){const h=this.input.evaluate(o);return(si(h)===this.inputType&&this.outputs[this.cases[h]]||this.otherwise).evaluate(o)}eachChild(o){o(this.input),this.outputs.forEach(o),o(this.otherwise)}outputDefined(){return this.outputs.every(o=>o.outputDefined())&&this.otherwise.outputDefined()}}class nu{constructor(o,h,p){this.type=o,this.branches=h,this.otherwise=p}static parse(o,h){if(o.length<4)return h.error(`Expected at least 3 arguments, but found only ${o.length-1}.`);if(o.length%2!=0)return h.error("Expected an odd number of arguments.");let p;h.expectedType&&h.expectedType.kind!=="value"&&(p=h.expectedType);const y=[];for(let k=1;k<o.length-1;k+=2){const C=h.parse(o[k],k,Re);if(!C)return null;const A=h.parse(o[k+1],k+1,p);if(!A)return null;y.push([C,A]),p=p||A.type}const w=h.parse(o[o.length-1],o.length-1,p);if(!w)return null;if(!p)throw new Error("Can't infer output type");return new nu(p,y,w)}evaluate(o){for(const[h,p]of this.branches)if(h.evaluate(o))return p.evaluate(o);return this.otherwise.evaluate(o)}eachChild(o){for(const[h,p]of this.branches)o(h),o(p);o(this.otherwise)}outputDefined(){return this.branches.every(([o,h])=>h.outputDefined())&&this.otherwise.outputDefined()}}class Bl{constructor(o,h,p,y){this.type=o,this.input=h,this.beginIndex=p,this.endIndex=y}static parse(o,h){if(o.length<=2||o.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,Je),y=h.parse(o[2],2,qe);if(!p||!y)return null;if(!de(p.type,[H(Je),we,Je]))return h.error(`Expected first argument to be of type array or string, but found ${U(p.type)} instead`);if(o.length===4){const w=h.parse(o[3],3,qe);return w?new Bl(p.type,p,y,w):null}return new Bl(p.type,p,y)}evaluate(o){const h=this.input.evaluate(o),p=this.beginIndex.evaluate(o);let y;if(this.endIndex&&(y=this.endIndex.evaluate(o)),fe(h,["string"]))return[...h].slice(p,y).join("");if(fe(h,["array"]))return h.slice(p,y);throw new ti(`Expected first argument to be of type array or string, but found ${U(si(h))} instead.`)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function iu(c,o){const h=c.length-1;let p,y,w=0,k=h,C=0;for(;w<=k;)if(C=Math.floor((w+k)/2),p=c[C],y=c[C+1],p<=o){if(C===h||o<y)return C;w=C+1}else{if(!(p>o))throw new ti("Input is not a number.");k=C-1}return 0}class Ia{constructor(o,h,p){this.type=o,this.input=h,this.labels=[],this.outputs=[];for(const[y,w]of p)this.labels.push(y),this.outputs.push(w)}static parse(o,h){if(o.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return h.error("Expected an even number of arguments.");const p=h.parse(o[1],1,qe);if(!p)return null;const y=[];let w=null;h.expectedType&&h.expectedType.kind!=="value"&&(w=h.expectedType);for(let k=1;k<o.length;k+=2){const C=k===1?-1/0:o[k],A=o[k+1],O=k,R=k+1;if(typeof C!="number")return h.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',O);if(y.length&&y[y.length-1][0]>=C)return h.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',O);const N=h.parse(A,R,w);if(!N)return null;w=w||N.type,y.push([C,N])}return new Ia(w,p,y)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const y=this.input.evaluate(o);if(y<=h[0])return p[0].evaluate(o);const w=h.length;return y>=h[w-1]?p[w-1].evaluate(o):p[iu(h,y)].evaluate(o)}eachChild(o){o(this.input);for(const h of this.outputs)o(h)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Gf(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var K0=Zf;function Zf(c,o,h,p){this.cx=3*c,this.bx=3*(h-c)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(p-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=c,this.p1y=o,this.p2x=h,this.p2y=p}Zf.prototype={sampleCurveX:function(c){return((this.ax*c+this.bx)*c+this.cx)*c},sampleCurveY:function(c){return((this.ay*c+this.by)*c+this.cy)*c},sampleCurveDerivativeX:function(c){return(3*this.ax*c+2*this.bx)*c+this.cx},solveCurveX:function(c,o){if(o===void 0&&(o=1e-6),c<0)return 0;if(c>1)return 1;for(var h=c,p=0;p<8;p++){var y=this.sampleCurveX(h)-c;if(Math.abs(y)<o)return h;var w=this.sampleCurveDerivativeX(h);if(Math.abs(w)<1e-6)break;h-=y/w}var k=0,C=1;for(h=c,p=0;p<20&&(y=this.sampleCurveX(h),!(Math.abs(y-c)<o));p++)c>y?k=h:C=h,h=.5*(C-k)+k;return h},solve:function(c,o){return this.sampleCurveY(this.solveCurveX(c,o))}};var J0=Gf(K0);function jo(c,o,h){return c+h*(o-c)}function Vl(c,o,h){return c.map((p,y)=>jo(p,o[y],h))}const nr={number:jo,color:function(c,o,h,p="rgb"){switch(p){case"rgb":{const[y,w,k,C]=Vl(c.rgb,o.rgb,h);return new vn(y,w,k,C,!1)}case"hcl":{const[y,w,k,C]=c.hcl,[A,O,R,N]=o.hcl;let $,q;if(isNaN(y)||isNaN(A))isNaN(y)?isNaN(A)?$=NaN:($=A,k!==1&&k!==0||(q=O)):($=y,R!==1&&R!==0||(q=w));else{let xe=A-y;A>y&&xe>180?xe-=360:A<y&&y-A>180&&(xe+=360),$=y+h*xe}const[G,X,ne,oe]=function([xe,pe,ye,Ce]){return xe=isNaN(xe)?0:xe*kt,Zn([ye,Math.cos(xe)*pe,Math.sin(xe)*pe,Ce])}([$,q??jo(w,O,h),jo(k,R,h),jo(C,N,h)]);return new vn(G,X,ne,oe,!1)}case"lab":{const[y,w,k,C]=Zn(Vl(c.lab,o.lab,h));return new vn(y,w,k,C,!1)}}},array:Vl,padding:function(c,o,h){return new mr(Vl(c.values,o.values,h))},variableAnchorOffsetCollection:function(c,o,h){const p=c.values,y=o.values;if(p.length!==y.length)throw new ti(`Cannot interpolate values of different length. from: ${c.toString()}, to: ${o.toString()}`);const w=[];for(let k=0;k<p.length;k+=2){if(p[k]!==y[k])throw new ti(`Cannot interpolate values containing mismatched anchors. from[${k}]: ${p[k]}, to[${k}]: ${y[k]}`);w.push(p[k]);const[C,A]=p[k+1],[O,R]=y[k+1];w.push([jo(C,O,h),jo(A,R,h)])}return new Rr(w)}};class ir{constructor(o,h,p,y,w){this.type=o,this.operator=h,this.interpolation=p,this.input=y,this.labels=[],this.outputs=[];for(const[k,C]of w)this.labels.push(k),this.outputs.push(C)}static interpolationFactor(o,h,p,y){let w=0;if(o.name==="exponential")w=ru(h,o.base,p,y);else if(o.name==="linear")w=ru(h,1,p,y);else if(o.name==="cubic-bezier"){const k=o.controlPoints;w=new J0(k[0],k[1],k[2],k[3]).solve(ru(h,1,p,y))}return w}static parse(o,h){let[p,y,w,...k]=o;if(!Array.isArray(y)||y.length===0)return h.error("Expected an interpolation type expression.",1);if(y[0]==="linear")y={name:"linear"};else if(y[0]==="exponential"){const O=y[1];if(typeof O!="number")return h.error("Exponential interpolation requires a numeric base.",1,1);y={name:"exponential",base:O}}else{if(y[0]!=="cubic-bezier")return h.error(`Unknown interpolation type ${String(y[0])}`,1,0);{const O=y.slice(1);if(O.length!==4||O.some(R=>typeof R!="number"||R<0||R>1))return h.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);y={name:"cubic-bezier",controlPoints:O}}}if(o.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return h.error("Expected an even number of arguments.");if(w=h.parse(w,2,qe),!w)return null;const C=[];let A=null;p==="interpolate-hcl"||p==="interpolate-lab"?A=vt:h.expectedType&&h.expectedType.kind!=="value"&&(A=h.expectedType);for(let O=0;O<k.length;O+=2){const R=k[O],N=k[O+1],$=O+3,q=O+4;if(typeof R!="number")return h.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',$);if(C.length&&C[C.length-1][0]>=R)return h.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',$);const G=h.parse(N,q,A);if(!G)return null;A=A||G.type,C.push([R,G])}return _e(A,qe)||_e(A,vt)||_e(A,Ui)||_e(A,se)||_e(A,H(qe))?new ir(A,p,y,w,C):h.error(`Type ${U(A)} is not interpolatable.`)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const y=this.input.evaluate(o);if(y<=h[0])return p[0].evaluate(o);const w=h.length;if(y>=h[w-1])return p[w-1].evaluate(o);const k=iu(h,y),C=ir.interpolationFactor(this.interpolation,y,h[k],h[k+1]),A=p[k].evaluate(o),O=p[k+1].evaluate(o);switch(this.operator){case"interpolate":return nr[this.type.kind](A,O,C);case"interpolate-hcl":return nr.color(A,O,C,"hcl");case"interpolate-lab":return nr.color(A,O,C,"lab")}}eachChild(o){o(this.input);for(const h of this.outputs)o(h)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function ru(c,o,h,p){const y=p-h,w=c-h;return y===0?0:o===1?w/y:(Math.pow(o,w)-1)/(Math.pow(o,y)-1)}class su{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expectected at least one argument.");let p=null;const y=h.expectedType;y&&y.kind!=="value"&&(p=y);const w=[];for(const C of o.slice(1)){const A=h.parse(C,1+w.length,p,void 0,{typeAnnotation:"omit"});if(!A)return null;p=p||A.type,w.push(A)}if(!p)throw new Error("No output type");const k=y&&w.some(C=>te(y,C.type));return new su(k?Je:p,w)}evaluate(o){let h,p=null,y=0;for(const w of this.args)if(y++,p=w.evaluate(o),p&&p instanceof gr&&!p.available&&(h||(h=p.name),p=null,y===this.args.length&&(p=h)),p!==null)break;return p}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}function ou(c,o){return c==="=="||c==="!="?o.kind==="boolean"||o.kind==="string"||o.kind==="number"||o.kind==="null"||o.kind==="value":o.kind==="string"||o.kind==="number"||o.kind==="value"}function Yf(c,o,h,p){return p.compare(o,h)===0}function Da(c,o,h){const p=c!=="=="&&c!=="!=";return class tC{constructor(w,k,C){this.type=Re,this.lhs=w,this.rhs=k,this.collator=C,this.hasUntypedArgument=w.type.kind==="value"||k.type.kind==="value"}static parse(w,k){if(w.length!==3&&w.length!==4)return k.error("Expected two or three arguments.");const C=w[0];let A=k.parse(w[1],1,Je);if(!A)return null;if(!ou(C,A.type))return k.concat(1).error(`"${C}" comparisons are not supported for type '${U(A.type)}'.`);let O=k.parse(w[2],2,Je);if(!O)return null;if(!ou(C,O.type))return k.concat(2).error(`"${C}" comparisons are not supported for type '${U(O.type)}'.`);if(A.type.kind!==O.type.kind&&A.type.kind!=="value"&&O.type.kind!=="value")return k.error(`Cannot compare types '${U(A.type)}' and '${U(O.type)}'.`);p&&(A.type.kind==="value"&&O.type.kind!=="value"?A=new Jr(O.type,[A]):A.type.kind!=="value"&&O.type.kind==="value"&&(O=new Jr(A.type,[O])));let R=null;if(w.length===4){if(A.type.kind!=="string"&&O.type.kind!=="string"&&A.type.kind!=="value"&&O.type.kind!=="value")return k.error("Cannot use collator to compare non-string types.");if(R=k.parse(w[3],3,Rn),!R)return null}return new tC(A,O,R)}evaluate(w){const k=this.lhs.evaluate(w),C=this.rhs.evaluate(w);if(p&&this.hasUntypedArgument){const A=si(k),O=si(C);if(A.kind!==O.kind||A.kind!=="string"&&A.kind!=="number")throw new ti(`Expected arguments for "${c}" to be (string, string) or (number, number), but found (${A.kind}, ${O.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const A=si(k),O=si(C);if(A.kind!=="string"||O.kind!=="string")return o(w,k,C)}return this.collator?h(w,k,C,this.collator.evaluate(w)):o(w,k,C)}eachChild(w){w(this.lhs),w(this.rhs),this.collator&&w(this.collator)}outputDefined(){return!0}}}const Q0=Da("==",function(c,o,h){return o===h},Yf),Xf=Da("!=",function(c,o,h){return o!==h},function(c,o,h,p){return!Yf(0,o,h,p)}),Kf=Da("<",function(c,o,h){return o<h},function(c,o,h,p){return p.compare(o,h)<0}),e_=Da(">",function(c,o,h){return o>h},function(c,o,h,p){return p.compare(o,h)>0}),t_=Da("<=",function(c,o,h){return o<=h},function(c,o,h,p){return p.compare(o,h)<=0}),Jf=Da(">=",function(c,o,h){return o>=h},function(c,o,h,p){return p.compare(o,h)>=0});class Fl{constructor(o,h,p){this.type=Rn,this.locale=p,this.caseSensitive=o,this.diacriticSensitive=h}static parse(o,h){if(o.length!==2)return h.error("Expected one argument.");const p=o[1];if(typeof p!="object"||Array.isArray(p))return h.error("Collator options argument must be an object.");const y=h.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,Re);if(!y)return null;const w=h.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,Re);if(!w)return null;let k=null;return p.locale&&(k=h.parse(p.locale,1,we),!k)?null:new Fl(y,w,k)}evaluate(o){return new Zh(this.caseSensitive.evaluate(o),this.diacriticSensitive.evaluate(o),this.locale?this.locale.evaluate(o):null)}eachChild(o){o(this.caseSensitive),o(this.diacriticSensitive),this.locale&&o(this.locale)}outputDefined(){return!1}}class ed{constructor(o,h,p,y,w){this.type=we,this.number=o,this.locale=h,this.currency=p,this.minFractionDigits=y,this.maxFractionDigits=w}static parse(o,h){if(o.length!==3)return h.error("Expected two arguments.");const p=h.parse(o[1],1,qe);if(!p)return null;const y=o[2];if(typeof y!="object"||Array.isArray(y))return h.error("NumberFormat options argument must be an object.");let w=null;if(y.locale&&(w=h.parse(y.locale,1,we),!w))return null;let k=null;if(y.currency&&(k=h.parse(y.currency,1,we),!k))return null;let C=null;if(y["min-fraction-digits"]&&(C=h.parse(y["min-fraction-digits"],1,qe),!C))return null;let A=null;return y["max-fraction-digits"]&&(A=h.parse(y["max-fraction-digits"],1,qe),!A)?null:new ed(p,w,k,C,A)}evaluate(o){return new Intl.NumberFormat(this.locale?this.locale.evaluate(o):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(o):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(o):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(o):void 0}).format(this.number.evaluate(o))}eachChild(o){o(this.number),this.locale&&o(this.locale),this.currency&&o(this.currency),this.minFractionDigits&&o(this.minFractionDigits),this.maxFractionDigits&&o(this.maxFractionDigits)}outputDefined(){return!1}}class au{constructor(o){this.type=Kn,this.sections=o}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");const p=o[1];if(!Array.isArray(p)&&typeof p=="object")return h.error("First argument must be an image or text section.");const y=[];let w=!1;for(let k=1;k<=o.length-1;++k){const C=o[k];if(w&&typeof C=="object"&&!Array.isArray(C)){w=!1;let A=null;if(C["font-scale"]&&(A=h.parse(C["font-scale"],1,qe),!A))return null;let O=null;if(C["text-font"]&&(O=h.parse(C["text-font"],1,H(we)),!O))return null;let R=null;if(C["text-color"]&&(R=h.parse(C["text-color"],1,vt),!R))return null;const N=y[y.length-1];N.scale=A,N.font=O,N.textColor=R}else{const A=h.parse(o[k],1,Je);if(!A)return null;const O=A.type.kind;if(O!=="string"&&O!=="value"&&O!=="null"&&O!=="resolvedImage")return h.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");w=!0,y.push({content:A,scale:null,font:null,textColor:null})}}return new au(y)}evaluate(o){return new fr(this.sections.map(h=>{const p=h.content.evaluate(o);return si(p)===pr?new Yh("",p,null,null,null):new Yh(Nl(p),null,h.scale?h.scale.evaluate(o):null,h.font?h.font.evaluate(o).join(","):null,h.textColor?h.textColor.evaluate(o):null)}))}eachChild(o){for(const h of this.sections)o(h.content),h.scale&&o(h.scale),h.font&&o(h.font),h.textColor&&o(h.textColor)}outputDefined(){return!1}}class td{constructor(o){this.type=pr,this.input=o}static parse(o,h){if(o.length!==2)return h.error("Expected two arguments.");const p=h.parse(o[1],1,we);return p?new td(p):h.error("No image name provided.")}evaluate(o){const h=this.input.evaluate(o),p=gr.fromString(h);return p&&o.availableImages&&(p.available=o.availableImages.indexOf(h)>-1),p}eachChild(o){o(this.input)}outputDefined(){return!1}}class nd{constructor(o){this.type=qe,this.input=o}static parse(o,h){if(o.length!==2)return h.error(`Expected 1 argument, but found ${o.length-1} instead.`);const p=h.parse(o[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?h.error(`Expected argument of type string or array, but found ${U(p.type)} instead.`):new nd(p):null}evaluate(o){const h=this.input.evaluate(o);if(typeof h=="string")return[...h].length;if(Array.isArray(h))return h.length;throw new ti(`Expected value to be of type string or array, but found ${U(si(h))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}const Ms=8192;function n_(c,o){const h=(180+c[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+c[1]*Math.PI/360)))/360,y=Math.pow(2,o.z);return[Math.round(h*y*Ms),Math.round(p*y*Ms)]}function id(c,o){const h=Math.pow(2,o.z);return[(y=(c[0]/Ms+o.x)/h,360*y-180),(p=(c[1]/Ms+o.y)/h,360/Math.PI*Math.atan(Math.exp((180-360*p)*Math.PI/180))-90)];var p,y}function Uo(c,o){c[0]=Math.min(c[0],o[0]),c[1]=Math.min(c[1],o[1]),c[2]=Math.max(c[2],o[0]),c[3]=Math.max(c[3],o[1])}function ho(c,o){return!(c[0]<=o[0]||c[2]>=o[2]||c[1]<=o[1]||c[3]>=o[3])}function mn(c,o,h){const p=c[0]-o[0],y=c[1]-o[1],w=c[0]-h[0],k=c[1]-h[1];return p*k-w*y==0&&p*w<=0&&y*k<=0}function lu(c,o,h,p){return(y=[p[0]-h[0],p[1]-h[1]])[0]*(w=[o[0]-c[0],o[1]-c[1]])[1]-y[1]*w[0]!=0&&!(!em(c,o,h,p)||!em(h,p,c,o));var y,w}function i_(c,o,h){for(const p of h)for(let y=0;y<p.length-1;++y)if(lu(c,o,p[y],p[y+1]))return!0;return!1}function Oa(c,o,h=!1){let p=!1;for(const C of o)for(let A=0;A<C.length-1;A++){if(mn(c,C[A],C[A+1]))return h;(w=C[A])[1]>(y=c)[1]!=(k=C[A+1])[1]>y[1]&&y[0]<(k[0]-w[0])*(y[1]-w[1])/(k[1]-w[1])+w[0]&&(p=!p)}var y,w,k;return p}function r_(c,o){for(const h of o)if(Oa(c,h))return!0;return!1}function Qf(c,o){for(const h of c)if(!Oa(h,o))return!1;for(let h=0;h<c.length-1;++h)if(i_(c[h],c[h+1],o))return!1;return!0}function s_(c,o){for(const h of o)if(Qf(c,h))return!0;return!1}function em(c,o,h,p){const y=p[0]-h[0],w=p[1]-h[1],k=(c[0]-h[0])*w-y*(c[1]-h[1]),C=(o[0]-h[0])*w-y*(o[1]-h[1]);return k>0&&C<0||k<0&&C>0}function rd(c,o,h){const p=[];for(let y=0;y<c.length;y++){const w=[];for(let k=0;k<c[y].length;k++){const C=n_(c[y][k],h);Uo(o,C),w.push(C)}p.push(w)}return p}function tm(c,o,h){const p=[];for(let y=0;y<c.length;y++){const w=rd(c[y],o,h);p.push(w)}return p}function nm(c,o,h,p){if(c[0]<h[0]||c[0]>h[2]){const y=.5*p;let w=c[0]-h[0]>y?-p:h[0]-c[0]>y?p:0;w===0&&(w=c[0]-h[2]>y?-p:h[2]-c[0]>y?p:0),c[0]+=w}Uo(o,c)}function im(c,o,h,p){const y=Math.pow(2,p.z)*Ms,w=[p.x*Ms,p.y*Ms],k=[];for(const C of c)for(const A of C){const O=[A.x+w[0],A.y+w[1]];nm(O,o,h,y),k.push(O)}return k}function rm(c,o,h,p){const y=Math.pow(2,p.z)*Ms,w=[p.x*Ms,p.y*Ms],k=[];for(const A of c){const O=[];for(const R of A){const N=[R.x+w[0],R.y+w[1]];Uo(o,N),O.push(N)}k.push(O)}if(o[2]-o[0]<=y/2){(C=o)[0]=C[1]=1/0,C[2]=C[3]=-1/0;for(const A of k)for(const O of A)nm(O,o,h,y)}var C;return k}class Ho{constructor(o,h){this.type=Re,this.geojson=o,this.geometries=h}static parse(o,h){if(o.length!==2)return h.error(`'within' expression requires exactly one argument, but found ${o.length-1} instead.`);if(Fo(o[1])){const p=o[1];if(p.type==="FeatureCollection"){const y=[];for(const w of p.features){const{type:k,coordinates:C}=w.geometry;k==="Polygon"&&y.push(C),k==="MultiPolygon"&&y.push(...C)}if(y.length)return new Ho(p,{type:"MultiPolygon",coordinates:y})}else if(p.type==="Feature"){const y=p.geometry.type;if(y==="Polygon"||y==="MultiPolygon")return new Ho(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new Ho(p,p)}return h.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(o){if(o.geometry()!=null&&o.canonicalID()!=null){if(o.geometryType()==="Point")return function(h,p){const y=[1/0,1/0,-1/0,-1/0],w=[1/0,1/0,-1/0,-1/0],k=h.canonicalID();if(p.type==="Polygon"){const C=rd(p.coordinates,w,k),A=im(h.geometry(),y,w,k);if(!ho(y,w))return!1;for(const O of A)if(!Oa(O,C))return!1}if(p.type==="MultiPolygon"){const C=tm(p.coordinates,w,k),A=im(h.geometry(),y,w,k);if(!ho(y,w))return!1;for(const O of A)if(!r_(O,C))return!1}return!0}(o,this.geometries);if(o.geometryType()==="LineString")return function(h,p){const y=[1/0,1/0,-1/0,-1/0],w=[1/0,1/0,-1/0,-1/0],k=h.canonicalID();if(p.type==="Polygon"){const C=rd(p.coordinates,w,k),A=rm(h.geometry(),y,w,k);if(!ho(y,w))return!1;for(const O of A)if(!Qf(O,C))return!1}if(p.type==="MultiPolygon"){const C=tm(p.coordinates,w,k),A=rm(h.geometry(),y,w,k);if(!ho(y,w))return!1;for(const O of A)if(!s_(O,C))return!1}return!0}(o,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let sm=class{constructor(c=[],o=(h,p)=>h<p?-1:h>p?1:0){if(this.data=c,this.length=this.data.length,this.compare=o,this.length>0)for(let h=(this.length>>1)-1;h>=0;h--)this._down(h)}push(c){this.data.push(c),this._up(this.length++)}pop(){if(this.length===0)return;const c=this.data[0],o=this.data.pop();return--this.length>0&&(this.data[0]=o,this._down(0)),c}peek(){return this.data[0]}_up(c){const{data:o,compare:h}=this,p=o[c];for(;c>0;){const y=c-1>>1,w=o[y];if(h(p,w)>=0)break;o[c]=w,c=y}o[c]=p}_down(c){const{data:o,compare:h}=this,p=this.length>>1,y=o[c];for(;c<p;){let w=1+(c<<1);const k=w+1;if(k<this.length&&h(o[k],o[w])<0&&(w=k),h(o[w],y)>=0)break;o[c]=o[w],c=w}o[c]=y}};function o_(c,o,h,p,y){om(c,o,h,p||c.length-1,y||a_)}function om(c,o,h,p,y){for(;p>h;){if(p-h>600){var w=p-h+1,k=o-h+1,C=Math.log(w),A=.5*Math.exp(2*C/3),O=.5*Math.sqrt(C*A*(w-A)/w)*(k-w/2<0?-1:1);om(c,o,Math.max(h,Math.floor(o-k*A/w+O)),Math.min(p,Math.floor(o+(w-k)*A/w+O)),y)}var R=c[o],N=h,$=p;for($l(c,h,o),y(c[p],R)>0&&$l(c,h,p);N<$;){for($l(c,N,$),N++,$--;y(c[N],R)<0;)N++;for(;y(c[$],R)>0;)$--}y(c[h],R)===0?$l(c,h,$):$l(c,++$,p),$<=o&&(h=$+1),o<=$&&(p=$-1)}}function $l(c,o,h){var p=c[o];c[o]=c[h],c[h]=p}function a_(c,o){return c<o?-1:c>o?1:0}function cu(c,o){if(c.length<=1)return[c];const h=[];let p,y;for(const w of c){const k=c_(w);k!==0&&(w.area=Math.abs(k),y===void 0&&(y=k<0),y===k<0?(p&&h.push(p),p=[w]):p.push(w))}if(p&&h.push(p),o>1)for(let w=0;w<h.length;w++)h[w].length<=o||(o_(h[w],o,1,h[w].length-1,l_),h[w]=h[w].slice(0,o));return h}function l_(c,o){return o.area-c.area}function c_(c){let o=0;for(let h,p,y=0,w=c.length,k=w-1;y<w;k=y++)h=c[y],p=c[k],o+=(p.x-h.x)*(h.y+p.y);return o}const am=1/298.257223563,lm=am*(2-am),cm=Math.PI/180;class sd{constructor(o){const h=6378.137*cm*1e3,p=Math.cos(o*cm),y=1/(1-lm*(1-p*p)),w=Math.sqrt(y);this.kx=h*w*p,this.ky=h*w*y*(1-lm)}distance(o,h){const p=this.wrap(o[0]-h[0])*this.kx,y=(o[1]-h[1])*this.ky;return Math.sqrt(p*p+y*y)}pointOnLine(o,h){let p,y,w,k,C=1/0;for(let A=0;A<o.length-1;A++){let O=o[A][0],R=o[A][1],N=this.wrap(o[A+1][0]-O)*this.kx,$=(o[A+1][1]-R)*this.ky,q=0;N===0&&$===0||(q=(this.wrap(h[0]-O)*this.kx*N+(h[1]-R)*this.ky*$)/(N*N+$*$),q>1?(O=o[A+1][0],R=o[A+1][1]):q>0&&(O+=N/this.kx*q,R+=$/this.ky*q)),N=this.wrap(h[0]-O)*this.kx,$=(h[1]-R)*this.ky;const G=N*N+$*$;G<C&&(C=G,p=O,y=R,w=A,k=q)}return{point:[p,y],index:w,t:Math.max(0,Math.min(1,k))}}wrap(o){for(;o<-180;)o+=360;for(;o>180;)o-=360;return o}}function um(c,o){return o[0]-c[0]}function uu(c){return c[1]-c[0]+1}function Hs(c,o){return c[1]>=c[0]&&c[1]<o}function od(c,o){if(c[0]>c[1])return[null,null];const h=uu(c);if(o){if(h===2)return[c,null];const y=Math.floor(h/2);return[[c[0],c[0]+y],[c[0]+y,c[1]]]}if(h===1)return[c,null];const p=Math.floor(h/2)-1;return[[c[0],c[0]+p],[c[0]+p+1,c[1]]]}function ad(c,o){if(!Hs(o,c.length))return[1/0,1/0,-1/0,-1/0];const h=[1/0,1/0,-1/0,-1/0];for(let p=o[0];p<=o[1];++p)Uo(h,c[p]);return h}function ld(c){const o=[1/0,1/0,-1/0,-1/0];for(const h of c)for(const p of h)Uo(o,p);return o}function hu(c){return c[0]!==-1/0&&c[1]!==-1/0&&c[2]!==1/0&&c[3]!==1/0}function cd(c,o,h){if(!hu(c)||!hu(o))return NaN;let p=0,y=0;return c[2]<o[0]&&(p=o[0]-c[2]),c[0]>o[2]&&(p=c[0]-o[2]),c[1]>o[3]&&(y=c[1]-o[3]),c[3]<o[1]&&(y=o[1]-c[3]),h.distance([0,0],[p,y])}function qo(c,o,h){const p=h.pointOnLine(o,c);return h.distance(c,p.point)}function ud(c,o,h,p,y){const w=Math.min(qo(c,[h,p],y),qo(o,[h,p],y)),k=Math.min(qo(h,[c,o],y),qo(p,[c,o],y));return Math.min(w,k)}function u_(c,o,h,p,y){if(!Hs(o,c.length)||!Hs(p,h.length))return 1/0;let w=1/0;for(let k=o[0];k<o[1];++k){const C=c[k],A=c[k+1];for(let O=p[0];O<p[1];++O){const R=h[O],N=h[O+1];if(lu(C,A,R,N))return 0;w=Math.min(w,ud(C,A,R,N,y))}}return w}function Jn(c,o,h,p,y){if(!Hs(o,c.length)||!Hs(p,h.length))return NaN;let w=1/0;for(let k=o[0];k<=o[1];++k)for(let C=p[0];C<=p[1];++C)if(w=Math.min(w,y.distance(c[k],h[C])),w===0)return w;return w}function h_(c,o,h){if(Oa(c,o,!0))return 0;let p=1/0;for(const y of o){const w=y[0],k=y[y.length-1];if(w!==k&&(p=Math.min(p,qo(c,[k,w],h)),p===0))return p;const C=h.pointOnLine(y,c);if(p=Math.min(p,h.distance(c,C.point)),p===0)return p}return p}function Ht(c,o,h,p){if(!Hs(o,c.length))return NaN;for(let w=o[0];w<=o[1];++w)if(Oa(c[w],h,!0))return 0;let y=1/0;for(let w=o[0];w<o[1];++w){const k=c[w],C=c[w+1];for(const A of h)for(let O=0,R=A.length,N=R-1;O<R;N=O++){const $=A[N],q=A[O];if(lu(k,C,$,q))return 0;y=Math.min(y,ud(k,C,$,q,p))}}return y}function du(c,o){for(const h of c)for(const p of h)if(Oa(p,o,!0))return!0;return!1}function Dn(c,o,h,p=1/0){const y=ld(c),w=ld(o);if(p!==1/0&&cd(y,w,h)>=p)return p;if(ho(y,w)){if(du(c,o))return 0}else if(du(o,c))return 0;let k=1/0;for(const C of c)for(let A=0,O=C.length,R=O-1;A<O;R=A++){const N=C[R],$=C[A];for(const q of o)for(let G=0,X=q.length,ne=X-1;G<X;ne=G++){const oe=q[ne],xe=q[G];if(lu(N,$,oe,xe))return 0;k=Math.min(k,ud(N,$,oe,xe,h))}}return k}function Cn(c,o,h,p,y,w){if(!w)return;const k=cd(ad(p,w),y,h);k<o&&c.push([k,w,[0,0]])}function Wo(c,o,h,p,y,w,k){if(!w||!k)return;const C=cd(ad(p,w),ad(y,k),h);C<o&&c.push([C,w,k])}function jl(c,o,h,p,y=1/0){let w=Math.min(p.distance(c[0],h[0][0]),y);if(w===0)return w;const k=new sm([[0,[0,c.length-1],[0,0]]],um),C=ld(h);for(;k.length>0;){const A=k.pop();if(A[0]>=w)continue;const O=A[1],R=o?50:100;if(uu(O)<=R){if(!Hs(O,c.length))return NaN;if(o){const N=Ht(c,O,h,p);if(isNaN(N)||N===0)return N;w=Math.min(w,N)}else for(let N=O[0];N<=O[1];++N){const $=h_(c[N],h,p);if(w=Math.min(w,$),w===0)return 0}}else{const N=od(O,o);Cn(k,w,p,c,C,N[0]),Cn(k,w,p,c,C,N[1])}}return w}function Ul(c,o,h,p,y,w=1/0){let k=Math.min(w,y.distance(c[0],h[0]));if(k===0)return k;const C=new sm([[0,[0,c.length-1],[0,h.length-1]]],um);for(;C.length>0;){const A=C.pop();if(A[0]>=k)continue;const O=A[1],R=A[2],N=o?50:100,$=p?50:100;if(uu(O)<=N&&uu(R)<=$){if(!Hs(O,c.length)&&Hs(R,h.length))return NaN;let q;if(o&&p)q=u_(c,O,h,R,y),k=Math.min(k,q);else if(o&&!p){const G=c.slice(O[0],O[1]+1);for(let X=R[0];X<=R[1];++X)if(q=qo(h[X],G,y),k=Math.min(k,q),k===0)return k}else if(!o&&p){const G=h.slice(R[0],R[1]+1);for(let X=O[0];X<=O[1];++X)if(q=qo(c[X],G,y),k=Math.min(k,q),k===0)return k}else q=Jn(c,O,h,R,y),k=Math.min(k,q)}else{const q=od(O,o),G=od(R,p);Wo(C,k,y,c,h,q[0],G[0]),Wo(C,k,y,c,h,q[0],G[1]),Wo(C,k,y,c,h,q[1],G[0]),Wo(C,k,y,c,h,q[1],G[1])}}return k}function hd(c){return c.type==="MultiPolygon"?c.coordinates.map(o=>({type:"Polygon",coordinates:o})):c.type==="MultiLineString"?c.coordinates.map(o=>({type:"LineString",coordinates:o})):c.type==="MultiPoint"?c.coordinates.map(o=>({type:"Point",coordinates:o})):[c]}class Go{constructor(o,h){this.type=qe,this.geojson=o,this.geometries=h}static parse(o,h){if(o.length!==2)return h.error(`'distance' expression requires exactly one argument, but found ${o.length-1} instead.`);if(Fo(o[1])){const p=o[1];if(p.type==="FeatureCollection")return new Go(p,p.features.map(y=>hd(y.geometry)).flat());if(p.type==="Feature")return new Go(p,hd(p.geometry));if("type"in p&&"coordinates"in p)return new Go(p,hd(p))}return h.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(o){if(o.geometry()!=null&&o.canonicalID()!=null){if(o.geometryType()==="Point")return function(h,p){const y=h.geometry(),w=y.flat().map(A=>id([A.x,A.y],h.canonical));if(y.length===0)return NaN;const k=new sd(w[0][1]);let C=1/0;for(const A of p){switch(A.type){case"Point":C=Math.min(C,Ul(w,!1,[A.coordinates],!1,k,C));break;case"LineString":C=Math.min(C,Ul(w,!1,A.coordinates,!0,k,C));break;case"Polygon":C=Math.min(C,jl(w,!1,A.coordinates,k,C))}if(C===0)return C}return C}(o,this.geometries);if(o.geometryType()==="LineString")return function(h,p){const y=h.geometry(),w=y.flat().map(A=>id([A.x,A.y],h.canonical));if(y.length===0)return NaN;const k=new sd(w[0][1]);let C=1/0;for(const A of p){switch(A.type){case"Point":C=Math.min(C,Ul(w,!0,[A.coordinates],!1,k,C));break;case"LineString":C=Math.min(C,Ul(w,!0,A.coordinates,!0,k,C));break;case"Polygon":C=Math.min(C,jl(w,!0,A.coordinates,k,C))}if(C===0)return C}return C}(o,this.geometries);if(o.geometryType()==="Polygon")return function(h,p){const y=h.geometry();if(y.length===0||y[0].length===0)return NaN;const w=cu(y,0).map(A=>A.map(O=>O.map(R=>id([R.x,R.y],h.canonical)))),k=new sd(w[0][0][0][1]);let C=1/0;for(const A of p)for(const O of w){switch(A.type){case"Point":C=Math.min(C,jl([A.coordinates],!1,O,k,C));break;case"LineString":C=Math.min(C,jl(A.coordinates,!0,O,k,C));break;case"Polygon":C=Math.min(C,Dn(O,A.coordinates,k,C))}if(C===0)return C}return C}(o,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const za={"==":Q0,"!=":Xf,">":e_,"<":Kf,">=":Jf,"<=":t_,array:Jr,at:Kh,boolean:Jr,case:nu,coalesce:su,collator:Fl,format:au,image:td,in:Jh,"index-of":Pa,interpolate:ir,"interpolate-hcl":ir,"interpolate-lab":ir,length:nd,let:uo,literal:Kr,match:Qh,number:Jr,"number-format":ed,object:Jr,slice:Bl,step:Ia,string:Jr,"to-boolean":Qr,"to-color":Qr,"to-number":Qr,"to-string":Qr,var:dn,within:Ho,distance:Go};class Lr{constructor(o,h,p,y){this.name=o,this.type=h,this._evaluate=p,this.args=y}evaluate(o){return this._evaluate(o,this.args)}eachChild(o){this.args.forEach(o)}outputDefined(){return!1}static parse(o,h){const p=o[0],y=Lr.definitions[p];if(!y)return h.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0);const w=Array.isArray(y)?y[0]:y.type,k=Array.isArray(y)?[[y[1],y[2]]]:y.overloads,C=k.filter(([O])=>!Array.isArray(O)||O.length===o.length-1);let A=null;for(const[O,R]of C){A=new $o(h.registry,Hl,h.path,null,h.scope);const N=[];let $=!1;for(let q=1;q<o.length;q++){const G=o[q],X=Array.isArray(O)?O[q-1]:O.type,ne=A.parse(G,1+N.length,X);if(!ne){$=!0;break}N.push(ne)}if(!$)if(Array.isArray(O)&&O.length!==N.length)A.error(`Expected ${O.length} arguments, but found ${N.length} instead.`);else{for(let q=0;q<N.length;q++){const G=Array.isArray(O)?O[q]:O.type,X=N[q];A.concat(q+1).checkSubtype(G,X.type)}if(A.errors.length===0)return new Lr(p,w,R,N)}}if(C.length===1)h.errors.push(...A.errors);else{const O=(C.length?C:k).map(([N])=>{return $=N,Array.isArray($)?`(${$.map(U).join(", ")})`:`(${U($.type)}...)`;var $}).join(" | "),R=[];for(let N=1;N<o.length;N++){const $=h.parse(o[N],1+R.length);if(!$)return null;R.push(U($.type))}h.error(`Expected arguments of type ${O}, but found (${R.join(", ")}) instead.`)}return null}static register(o,h){Lr.definitions=h;for(const p in h)o[p]=Lr}}function dd(c,[o,h,p,y]){o=o.evaluate(c),h=h.evaluate(c),p=p.evaluate(c);const w=y?y.evaluate(c):1,k=Aa(o,h,p,w);if(k)throw new ti(k);return new vn(o/255,h/255,p/255,w,!1)}function pd(c,o){return c in o}function fd(c,o){const h=o[c];return h===void 0?null:h}function Zo(c){return{type:c}}function Hl(c){if(c instanceof dn)return Hl(c.boundExpression);if(c instanceof Lr&&c.name==="error"||c instanceof Fl||c instanceof Ho||c instanceof Go)return!1;const o=c instanceof Qr||c instanceof Jr;let h=!0;return c.eachChild(p=>{h=o?h&&Hl(p):h&&p instanceof Kr}),!!h&&ql(c)&&Wl(c,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ql(c){if(c instanceof Lr&&(c.name==="get"&&c.args.length===1||c.name==="feature-state"||c.name==="has"&&c.args.length===1||c.name==="properties"||c.name==="geometry-type"||c.name==="id"||/^filter-/.test(c.name))||c instanceof Ho||c instanceof Go)return!1;let o=!0;return c.eachChild(h=>{o&&!ql(h)&&(o=!1)}),o}function Ra(c){if(c instanceof Lr&&c.name==="feature-state")return!1;let o=!0;return c.eachChild(h=>{o&&!Ra(h)&&(o=!1)}),o}function Wl(c,o){if(c instanceof Lr&&o.indexOf(c.name)>=0)return!1;let h=!0;return c.eachChild(p=>{h&&!Wl(p,o)&&(h=!1)}),h}function pu(c){return{result:"success",value:c}}function La(c){return{result:"error",value:c}}function Na(c){return c["property-type"]==="data-driven"||c["property-type"]==="cross-faded-data-driven"}function hm(c){return!!c.expression&&c.expression.parameters.indexOf("zoom")>-1}function md(c){return!!c.expression&&c.expression.interpolated}function cn(c){return c instanceof Number?"number":c instanceof String?"string":c instanceof Boolean?"boolean":Array.isArray(c)?"array":c===null?"null":typeof c}function fu(c){return typeof c=="object"&&c!==null&&!Array.isArray(c)}function d_(c){return c}function dm(c,o){const h=o.type==="color",p=c.stops&&typeof c.stops[0][0]=="object",y=p||!(p||c.property!==void 0),w=c.type||(md(o)?"exponential":"interval");if(h||o.type==="padding"){const R=h?vn.parse:mr.parse;(c=Or({},c)).stops&&(c.stops=c.stops.map(N=>[N[0],R(N[1])])),c.default=R(c.default?c.default:o.default)}if(c.colorSpace&&(k=c.colorSpace)!=="rgb"&&k!=="hcl"&&k!=="lab")throw new Error(`Unknown color space: "${c.colorSpace}"`);var k;let C,A,O;if(w==="exponential")C=fm;else if(w==="interval")C=mu;else if(w==="categorical"){C=pm,A=Object.create(null);for(const R of c.stops)A[R[0]]=R[1];O=typeof c.stops[0][0]}else{if(w!=="identity")throw new Error(`Unknown function type "${w}"`);C=mm}if(p){const R={},N=[];for(let G=0;G<c.stops.length;G++){const X=c.stops[G],ne=X[0].zoom;R[ne]===void 0&&(R[ne]={zoom:ne,type:c.type,property:c.property,default:c.default,stops:[]},N.push(ne)),R[ne].stops.push([X[0].value,X[1]])}const $=[];for(const G of N)$.push([R[G].zoom,dm(R[G],o)]);const q={name:"linear"};return{kind:"composite",interpolationType:q,interpolationFactor:ir.interpolationFactor.bind(void 0,q),zoomStops:$.map(G=>G[0]),evaluate:({zoom:G},X)=>fm({stops:$,base:c.base},o,G).evaluate(G,X)}}if(y){const R=w==="exponential"?{name:"exponential",base:c.base!==void 0?c.base:1}:null;return{kind:"camera",interpolationType:R,interpolationFactor:ir.interpolationFactor.bind(void 0,R),zoomStops:c.stops.map(N=>N[0]),evaluate:({zoom:N})=>C(c,o,N,A,O)}}return{kind:"source",evaluate(R,N){const $=N&&N.properties?N.properties[c.property]:void 0;return $===void 0?Ba(c.default,o.default):C(c,o,$,A,O)}}}function Ba(c,o,h){return c!==void 0?c:o!==void 0?o:h!==void 0?h:void 0}function pm(c,o,h,p,y){return Ba(typeof h===y?p[h]:void 0,c.default,o.default)}function mu(c,o,h){if(cn(h)!=="number")return Ba(c.default,o.default);const p=c.stops.length;if(p===1||h<=c.stops[0][0])return c.stops[0][1];if(h>=c.stops[p-1][0])return c.stops[p-1][1];const y=iu(c.stops.map(w=>w[0]),h);return c.stops[y][1]}function fm(c,o,h){const p=c.base!==void 0?c.base:1;if(cn(h)!=="number")return Ba(c.default,o.default);const y=c.stops.length;if(y===1||h<=c.stops[0][0])return c.stops[0][1];if(h>=c.stops[y-1][0])return c.stops[y-1][1];const w=iu(c.stops.map(R=>R[0]),h),k=function(R,N,$,q){const G=q-$,X=R-$;return G===0?0:N===1?X/G:(Math.pow(N,X)-1)/(Math.pow(N,G)-1)}(h,p,c.stops[w][0],c.stops[w+1][0]),C=c.stops[w][1],A=c.stops[w+1][1],O=nr[o.type]||d_;return typeof C.evaluate=="function"?{evaluate(...R){const N=C.evaluate.apply(void 0,R),$=A.evaluate.apply(void 0,R);if(N!==void 0&&$!==void 0)return O(N,$,k,c.colorSpace)}}:O(C,A,k,c.colorSpace)}function mm(c,o,h){switch(o.type){case"color":h=vn.parse(h);break;case"formatted":h=fr.fromString(h.toString());break;case"resolvedImage":h=gr.fromString(h.toString());break;case"padding":h=mr.parse(h);break;default:cn(h)===o.type||o.type==="enum"&&o.values[h]||(h=void 0)}return Ba(h,c.default,o.default)}Lr.register(za,{error:[{kind:"error"},[we],(c,[o])=>{throw new ti(o.evaluate(c))}],typeof:[we,[Je],(c,[o])=>U(si(o.evaluate(c)))],"to-rgba":[H(qe,4),[vt],(c,[o])=>{const[h,p,y,w]=o.evaluate(c).rgb;return[255*h,255*p,255*y,w]}],rgb:[vt,[qe,qe,qe],dd],rgba:[vt,[qe,qe,qe,qe],dd],has:{type:Re,overloads:[[[we],(c,[o])=>pd(o.evaluate(c),c.properties())],[[we,Ut],(c,[o,h])=>pd(o.evaluate(c),h.evaluate(c))]]},get:{type:Je,overloads:[[[we],(c,[o])=>fd(o.evaluate(c),c.properties())],[[we,Ut],(c,[o,h])=>fd(o.evaluate(c),h.evaluate(c))]]},"feature-state":[Je,[we],(c,[o])=>fd(o.evaluate(c),c.featureState||{})],properties:[Ut,[],c=>c.properties()],"geometry-type":[we,[],c=>c.geometryType()],id:[Je,[],c=>c.id()],zoom:[qe,[],c=>c.globals.zoom],"heatmap-density":[qe,[],c=>c.globals.heatmapDensity||0],"line-progress":[qe,[],c=>c.globals.lineProgress||0],accumulated:[Je,[],c=>c.globals.accumulated===void 0?null:c.globals.accumulated],"+":[qe,Zo(qe),(c,o)=>{let h=0;for(const p of o)h+=p.evaluate(c);return h}],"*":[qe,Zo(qe),(c,o)=>{let h=1;for(const p of o)h*=p.evaluate(c);return h}],"-":{type:qe,overloads:[[[qe,qe],(c,[o,h])=>o.evaluate(c)-h.evaluate(c)],[[qe],(c,[o])=>-o.evaluate(c)]]},"/":[qe,[qe,qe],(c,[o,h])=>o.evaluate(c)/h.evaluate(c)],"%":[qe,[qe,qe],(c,[o,h])=>o.evaluate(c)%h.evaluate(c)],ln2:[qe,[],()=>Math.LN2],pi:[qe,[],()=>Math.PI],e:[qe,[],()=>Math.E],"^":[qe,[qe,qe],(c,[o,h])=>Math.pow(o.evaluate(c),h.evaluate(c))],sqrt:[qe,[qe],(c,[o])=>Math.sqrt(o.evaluate(c))],log10:[qe,[qe],(c,[o])=>Math.log(o.evaluate(c))/Math.LN10],ln:[qe,[qe],(c,[o])=>Math.log(o.evaluate(c))],log2:[qe,[qe],(c,[o])=>Math.log(o.evaluate(c))/Math.LN2],sin:[qe,[qe],(c,[o])=>Math.sin(o.evaluate(c))],cos:[qe,[qe],(c,[o])=>Math.cos(o.evaluate(c))],tan:[qe,[qe],(c,[o])=>Math.tan(o.evaluate(c))],asin:[qe,[qe],(c,[o])=>Math.asin(o.evaluate(c))],acos:[qe,[qe],(c,[o])=>Math.acos(o.evaluate(c))],atan:[qe,[qe],(c,[o])=>Math.atan(o.evaluate(c))],min:[qe,Zo(qe),(c,o)=>Math.min(...o.map(h=>h.evaluate(c)))],max:[qe,Zo(qe),(c,o)=>Math.max(...o.map(h=>h.evaluate(c)))],abs:[qe,[qe],(c,[o])=>Math.abs(o.evaluate(c))],round:[qe,[qe],(c,[o])=>{const h=o.evaluate(c);return h<0?-Math.round(-h):Math.round(h)}],floor:[qe,[qe],(c,[o])=>Math.floor(o.evaluate(c))],ceil:[qe,[qe],(c,[o])=>Math.ceil(o.evaluate(c))],"filter-==":[Re,[we,Je],(c,[o,h])=>c.properties()[o.value]===h.value],"filter-id-==":[Re,[Je],(c,[o])=>c.id()===o.value],"filter-type-==":[Re,[we],(c,[o])=>c.geometryType()===o.value],"filter-<":[Re,[we,Je],(c,[o,h])=>{const p=c.properties()[o.value],y=h.value;return typeof p==typeof y&&p<y}],"filter-id-<":[Re,[Je],(c,[o])=>{const h=c.id(),p=o.value;return typeof h==typeof p&&h<p}],"filter->":[Re,[we,Je],(c,[o,h])=>{const p=c.properties()[o.value],y=h.value;return typeof p==typeof y&&p>y}],"filter-id->":[Re,[Je],(c,[o])=>{const h=c.id(),p=o.value;return typeof h==typeof p&&h>p}],"filter-<=":[Re,[we,Je],(c,[o,h])=>{const p=c.properties()[o.value],y=h.value;return typeof p==typeof y&&p<=y}],"filter-id-<=":[Re,[Je],(c,[o])=>{const h=c.id(),p=o.value;return typeof h==typeof p&&h<=p}],"filter->=":[Re,[we,Je],(c,[o,h])=>{const p=c.properties()[o.value],y=h.value;return typeof p==typeof y&&p>=y}],"filter-id->=":[Re,[Je],(c,[o])=>{const h=c.id(),p=o.value;return typeof h==typeof p&&h>=p}],"filter-has":[Re,[Je],(c,[o])=>o.value in c.properties()],"filter-has-id":[Re,[],c=>c.id()!==null&&c.id()!==void 0],"filter-type-in":[Re,[H(we)],(c,[o])=>o.value.indexOf(c.geometryType())>=0],"filter-id-in":[Re,[H(Je)],(c,[o])=>o.value.indexOf(c.id())>=0],"filter-in-small":[Re,[we,H(Je)],(c,[o,h])=>h.value.indexOf(c.properties()[o.value])>=0],"filter-in-large":[Re,[we,H(Je)],(c,[o,h])=>function(p,y,w,k){for(;w<=k;){const C=w+k>>1;if(y[C]===p)return!0;y[C]>p?k=C-1:w=C+1}return!1}(c.properties()[o.value],h.value,0,h.value.length-1)],all:{type:Re,overloads:[[[Re,Re],(c,[o,h])=>o.evaluate(c)&&h.evaluate(c)],[Zo(Re),(c,o)=>{for(const h of o)if(!h.evaluate(c))return!1;return!0}]]},any:{type:Re,overloads:[[[Re,Re],(c,[o,h])=>o.evaluate(c)||h.evaluate(c)],[Zo(Re),(c,o)=>{for(const h of o)if(h.evaluate(c))return!0;return!1}]]},"!":[Re,[Re],(c,[o])=>!o.evaluate(c)],"is-supported-script":[Re,[we],(c,[o])=>{const h=c.globals&&c.globals.isSupportedScript;return!h||h(o.evaluate(c))}],upcase:[we,[we],(c,[o])=>o.evaluate(c).toUpperCase()],downcase:[we,[we],(c,[o])=>o.evaluate(c).toLowerCase()],concat:[we,Zo(Je),(c,o)=>o.map(h=>Nl(h.evaluate(c))).join("")],"resolved-locale":[we,[Rn],(c,[o])=>o.evaluate(c).resolvedLocale()]});class gu{constructor(o,h){var p;this.expression=o,this._warningHistory={},this._evaluator=new tu,this._defaultValue=h?(p=h).type==="color"&&fu(p.default)?new vn(0,0,0,0):p.type==="color"?vn.parse(p.default)||null:p.type==="padding"?mr.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?Rr.parse(p.default)||null:p.default===void 0?null:p.default:null,this._enumValues=h&&h.type==="enum"?h.values:null}evaluateWithoutErrorHandling(o,h,p,y,w,k){return this._evaluator.globals=o,this._evaluator.feature=h,this._evaluator.featureState=p,this._evaluator.canonical=y,this._evaluator.availableImages=w||null,this._evaluator.formattedSection=k,this.expression.evaluate(this._evaluator)}evaluate(o,h,p,y,w,k){this._evaluator.globals=o,this._evaluator.feature=h||null,this._evaluator.featureState=p||null,this._evaluator.canonical=y,this._evaluator.availableImages=w||null,this._evaluator.formattedSection=k||null;try{const C=this.expression.evaluate(this._evaluator);if(C==null||typeof C=="number"&&C!=C)return this._defaultValue;if(this._enumValues&&!(C in this._enumValues))throw new ti(`Expected value to be one of ${Object.keys(this._enumValues).map(A=>JSON.stringify(A)).join(", ")}, but found ${JSON.stringify(C)} instead.`);return C}catch(C){return this._warningHistory[C.message]||(this._warningHistory[C.message]=!0,typeof console<"u"&&console.warn(C.message)),this._defaultValue}}}function yu(c){return Array.isArray(c)&&c.length>0&&typeof c[0]=="string"&&c[0]in za}function Va(c,o){const h=new $o(za,Hl,[],o?function(y){const w={color:vt,string:we,number:qe,enum:we,boolean:Re,formatted:Kn,padding:Ui,resolvedImage:pr,variableAnchorOffsetCollection:se};return y.type==="array"?H(w[y.value]||Je,y.length):w[y.type]}(o):void 0),p=h.parse(c,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?pu(new gu(p,o)):La(h.errors)}class Fa{constructor(o,h){this.kind=o,this._styleExpression=h,this.isStateDependent=o!=="constant"&&!Ra(h.expression)}evaluateWithoutErrorHandling(o,h,p,y,w,k){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,y,w,k)}evaluate(o,h,p,y,w,k){return this._styleExpression.evaluate(o,h,p,y,w,k)}}class $a{constructor(o,h,p,y){this.kind=o,this.zoomStops=p,this._styleExpression=h,this.isStateDependent=o!=="camera"&&!Ra(h.expression),this.interpolationType=y}evaluateWithoutErrorHandling(o,h,p,y,w,k){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,y,w,k)}evaluate(o,h,p,y,w,k){return this._styleExpression.evaluate(o,h,p,y,w,k)}interpolationFactor(o,h,p){return this.interpolationType?ir.interpolationFactor(this.interpolationType,o,h,p):0}}function gd(c,o){const h=Va(c,o);if(h.result==="error")return h;const p=h.value.expression,y=ql(p);if(!y&&!Na(o))return La([new vi("","data expressions not supported")]);const w=Wl(p,["zoom"]);if(!w&&!hm(o))return La([new vi("","zoom expressions not supported")]);const k=Gl(p);return k||w?k instanceof vi?La([k]):k instanceof ir&&!md(o)?La([new vi("",'"interpolate" expressions cannot be used with this property')]):pu(k?new $a(y?"camera":"composite",h.value,k.labels,k instanceof ir?k.interpolation:void 0):new Fa(y?"constant":"source",h.value)):La([new vi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ja{constructor(o,h){this._parameters=o,this._specification=h,Or(this,dm(this._parameters,this._specification))}static deserialize(o){return new ja(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function Gl(c){let o=null;if(c instanceof uo)o=Gl(c.result);else if(c instanceof su){for(const h of c.args)if(o=Gl(h),o)break}else(c instanceof Ia||c instanceof ir)&&c.input instanceof Lr&&c.input.name==="zoom"&&(o=c);return o instanceof vi||c.eachChild(h=>{const p=Gl(h);p instanceof vi?o=p:!o&&p?o=new vi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&p&&o!==p&&(o=new vi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function _u(c){if(c===!0||c===!1)return!0;if(!Array.isArray(c)||c.length===0)return!1;switch(c[0]){case"has":return c.length>=2&&c[1]!=="$id"&&c[1]!=="$type";case"in":return c.length>=3&&(typeof c[1]!="string"||Array.isArray(c[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return c.length!==3||Array.isArray(c[1])||Array.isArray(c[2]);case"any":case"all":for(const o of c.slice(1))if(!_u(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}const xu={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function yd(c){if(c==null)return{filter:()=>!0,needGeometry:!1};_u(c)||(c=bu(c));const o=Va(c,xu);if(o.result==="error")throw new Error(o.value.map(h=>`${h.key}: ${h.message}`).join(", "));return{filter:(h,p,y)=>o.value.evaluate(h,p,{},y),needGeometry:gm(c)}}function p_(c,o){return c<o?-1:c>o?1:0}function gm(c){if(!Array.isArray(c))return!1;if(c[0]==="within"||c[0]==="distance")return!0;for(let o=1;o<c.length;o++)if(gm(c[o]))return!0;return!1}function bu(c){if(!c)return!0;const o=c[0];return c.length<=1?o!=="any":o==="=="?_d(c[1],c[2],"=="):o==="!="?Pi(_d(c[1],c[2],"==")):o==="<"||o===">"||o==="<="||o===">="?_d(c[1],c[2],o):o==="any"?(h=c.slice(1),["any"].concat(h.map(bu))):o==="all"?["all"].concat(c.slice(1).map(bu)):o==="none"?["all"].concat(c.slice(1).map(bu).map(Pi)):o==="in"?Zl(c[1],c.slice(2)):o==="!in"?Pi(Zl(c[1],c.slice(2))):o==="has"?Yl(c[1]):o!=="!has"||Pi(Yl(c[1]));var h}function _d(c,o,h){switch(c){case"$type":return[`filter-type-${h}`,o];case"$id":return[`filter-id-${h}`,o];default:return[`filter-${h}`,c,o]}}function Zl(c,o){if(o.length===0)return!1;switch(c){case"$type":return["filter-type-in",["literal",o]];case"$id":return["filter-id-in",["literal",o]];default:return o.length>200&&!o.some(h=>typeof h!=typeof o[0])?["filter-in-large",c,["literal",o.sort(p_)]]:["filter-in-small",c,["literal",o]]}}function Yl(c){switch(c){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",c]}}function Pi(c){return["!",c]}function Yo(c){const o=typeof c;if(o==="number"||o==="boolean"||o==="string"||c==null)return JSON.stringify(c);if(Array.isArray(c)){let y="[";for(const w of c)y+=`${Yo(w)},`;return`${y}]`}const h=Object.keys(c).sort();let p="{";for(let y=0;y<h.length;y++)p+=`${JSON.stringify(h[y])}:${Yo(c[h[y]])},`;return`${p}}`}function ym(c){let o="";for(const h of En)o+=`/${Yo(c[h])}`;return o}function _m(c){const o=c.value;return o?[new Be(c.key,o,"constants have been deprecated as of v8")]:[]}function Qn(c){return c instanceof Number||c instanceof String||c instanceof Boolean?c.valueOf():c}function es(c){if(Array.isArray(c))return c.map(es);if(c instanceof Object&&!(c instanceof Number||c instanceof String||c instanceof Boolean)){const o={};for(const h in c)o[h]=es(c[h]);return o}return Qn(c)}function yr(c){const o=c.key,h=c.value,p=c.valueSpec||{},y=c.objectElementValidators||{},w=c.style,k=c.styleSpec,C=c.validateSpec;let A=[];const O=cn(h);if(O!=="object")return[new Be(o,h,`object expected, ${O} found`)];for(const R in h){const N=R.split(".")[0],$=p[N]||p["*"];let q;if(y[N])q=y[N];else if(p[N])q=C;else if(y["*"])q=y["*"];else{if(!p["*"]){A.push(new Be(o,h[R],`unknown property "${R}"`));continue}q=C}A=A.concat(q({key:(o&&`${o}.`)+R,value:h[R],valueSpec:$,style:w,styleSpec:k,object:h,objectKey:R,validateSpec:C},h))}for(const R in p)y[R]||p[R].required&&p[R].default===void 0&&h[R]===void 0&&A.push(new Be(o,h,`missing required property "${R}"`));return A}function Xl(c){const o=c.value,h=c.valueSpec,p=c.style,y=c.styleSpec,w=c.key,k=c.arrayElementValidator||c.validateSpec;if(cn(o)!=="array")return[new Be(w,o,`array expected, ${cn(o)} found`)];if(h.length&&o.length!==h.length)return[new Be(w,o,`array length ${h.length} expected, length ${o.length} found`)];if(h["min-length"]&&o.length<h["min-length"])return[new Be(w,o,`array length at least ${h["min-length"]} expected, length ${o.length} found`)];let C={type:h.value,values:h.values};y.$version<7&&(C.function=h.function),cn(h.value)==="object"&&(C=h.value);let A=[];for(let O=0;O<o.length;O++)A=A.concat(k({array:o,arrayIndex:O,value:o[O],valueSpec:C,validateSpec:c.validateSpec,style:p,styleSpec:y,key:`${w}[${O}]`}));return A}function xd(c){const o=c.key,h=c.value,p=c.valueSpec;let y=cn(h);return y==="number"&&h!=h&&(y="NaN"),y!=="number"?[new Be(o,h,`number expected, ${y} found`)]:"minimum"in p&&h<p.minimum?[new Be(o,h,`${h} is less than the minimum value ${p.minimum}`)]:"maximum"in p&&h>p.maximum?[new Be(o,h,`${h} is greater than the maximum value ${p.maximum}`)]:[]}function vu(c){const o=c.valueSpec,h=Qn(c.value.type);let p,y,w,k={};const C=h!=="categorical"&&c.value.property===void 0,A=!C,O=cn(c.value.stops)==="array"&&cn(c.value.stops[0])==="array"&&cn(c.value.stops[0][0])==="object",R=yr({key:c.key,value:c.value,valueSpec:c.styleSpec.function,validateSpec:c.validateSpec,style:c.style,styleSpec:c.styleSpec,objectElementValidators:{stops:function(q){if(h==="identity")return[new Be(q.key,q.value,'identity function may not have a "stops" property')];let G=[];const X=q.value;return G=G.concat(Xl({key:q.key,value:X,valueSpec:q.valueSpec,validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec,arrayElementValidator:N})),cn(X)==="array"&&X.length===0&&G.push(new Be(q.key,X,"array must have at least one stop")),G},default:function(q){return q.validateSpec({key:q.key,value:q.value,valueSpec:o,validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec})}}});return h==="identity"&&C&&R.push(new Be(c.key,c.value,'missing required property "property"')),h==="identity"||c.value.stops||R.push(new Be(c.key,c.value,'missing required property "stops"')),h==="exponential"&&c.valueSpec.expression&&!md(c.valueSpec)&&R.push(new Be(c.key,c.value,"exponential functions not supported")),c.styleSpec.$version>=8&&(A&&!Na(c.valueSpec)?R.push(new Be(c.key,c.value,"property functions not supported")):C&&!hm(c.valueSpec)&&R.push(new Be(c.key,c.value,"zoom functions not supported"))),h!=="categorical"&&!O||c.value.property!==void 0||R.push(new Be(c.key,c.value,'"property" property is required')),R;function N(q){let G=[];const X=q.value,ne=q.key;if(cn(X)!=="array")return[new Be(ne,X,`array expected, ${cn(X)} found`)];if(X.length!==2)return[new Be(ne,X,`array length 2 expected, length ${X.length} found`)];if(O){if(cn(X[0])!=="object")return[new Be(ne,X,`object expected, ${cn(X[0])} found`)];if(X[0].zoom===void 0)return[new Be(ne,X,"object stop key must have zoom")];if(X[0].value===void 0)return[new Be(ne,X,"object stop key must have value")];if(w&&w>Qn(X[0].zoom))return[new Be(ne,X[0].zoom,"stop zoom values must appear in ascending order")];Qn(X[0].zoom)!==w&&(w=Qn(X[0].zoom),y=void 0,k={}),G=G.concat(yr({key:`${ne}[0]`,value:X[0],valueSpec:{zoom:{}},validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec,objectElementValidators:{zoom:xd,value:$}}))}else G=G.concat($({key:`${ne}[0]`,value:X[0],valueSpec:{},validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec},X));return yu(es(X[1]))?G.concat([new Be(`${ne}[1]`,X[1],"expressions are not allowed in function stops.")]):G.concat(q.validateSpec({key:`${ne}[1]`,value:X[1],valueSpec:o,validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec}))}function $(q,G){const X=cn(q.value),ne=Qn(q.value),oe=q.value!==null?q.value:G;if(p){if(X!==p)return[new Be(q.key,oe,`${X} stop domain type must match previous stop domain type ${p}`)]}else p=X;if(X!=="number"&&X!=="string"&&X!=="boolean")return[new Be(q.key,oe,"stop domain value must be a number, string, or boolean")];if(X!=="number"&&h!=="categorical"){let xe=`number expected, ${X} found`;return Na(o)&&h===void 0&&(xe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Be(q.key,oe,xe)]}return h!=="categorical"||X!=="number"||isFinite(ne)&&Math.floor(ne)===ne?h!=="categorical"&&X==="number"&&y!==void 0&&ne<y?[new Be(q.key,oe,"stop domain values must appear in ascending order")]:(y=ne,h==="categorical"&&ne in k?[new Be(q.key,oe,"stop domain values must be unique")]:(k[ne]=!0,[])):[new Be(q.key,oe,`integer expected, found ${ne}`)]}}function Ua(c){const o=(c.expressionContext==="property"?gd:Va)(es(c.value),c.valueSpec);if(o.result==="error")return o.value.map(p=>new Be(`${c.key}${p.key}`,c.value,p.message));const h=o.value.expression||o.value._styleExpression.expression;if(c.expressionContext==="property"&&c.propertyKey==="text-font"&&!h.outputDefined())return[new Be(c.key,c.value,`Invalid data expression for "${c.propertyKey}". Output values must be contained as literals within the expression.`)];if(c.expressionContext==="property"&&c.propertyType==="layout"&&!Ra(h))return[new Be(c.key,c.value,'"feature-state" data expressions are not supported with layout properties.')];if(c.expressionContext==="filter"&&!Ra(h))return[new Be(c.key,c.value,'"feature-state" data expressions are not supported with filters.')];if(c.expressionContext&&c.expressionContext.indexOf("cluster")===0){if(!Wl(h,["zoom","feature-state"]))return[new Be(c.key,c.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(c.expressionContext==="cluster-initial"&&!ql(h))return[new Be(c.key,c.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function qs(c){const o=c.key,h=c.value,p=c.valueSpec,y=[];return Array.isArray(p.values)?p.values.indexOf(Qn(h))===-1&&y.push(new Be(o,h,`expected one of [${p.values.join(", ")}], ${JSON.stringify(h)} found`)):Object.keys(p.values).indexOf(Qn(h))===-1&&y.push(new Be(o,h,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(h)} found`)),y}function bd(c){return _u(es(c.value))?Ua(Or({},c,{expressionContext:"filter",valueSpec:{value:"boolean"}})):wu(c)}function wu(c){const o=c.value,h=c.key;if(cn(o)!=="array")return[new Be(h,o,`array expected, ${cn(o)} found`)];const p=c.styleSpec;let y,w=[];if(o.length<1)return[new Be(h,o,"filter array must have at least 1 element")];switch(w=w.concat(qs({key:`${h}[0]`,value:o[0],valueSpec:p.filter_operator,style:c.style,styleSpec:c.styleSpec})),Qn(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&Qn(o[1])==="$type"&&w.push(new Be(h,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&w.push(new Be(h,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(y=cn(o[1]),y!=="string"&&w.push(new Be(`${h}[1]`,o[1],`string expected, ${y} found`)));for(let k=2;k<o.length;k++)y=cn(o[k]),Qn(o[1])==="$type"?w=w.concat(qs({key:`${h}[${k}]`,value:o[k],valueSpec:p.geometry_type,style:c.style,styleSpec:c.styleSpec})):y!=="string"&&y!=="number"&&y!=="boolean"&&w.push(new Be(`${h}[${k}]`,o[k],`string, number, or boolean expected, ${y} found`));break;case"any":case"all":case"none":for(let k=1;k<o.length;k++)w=w.concat(wu({key:`${h}[${k}]`,value:o[k],style:c.style,styleSpec:c.styleSpec}));break;case"has":case"!has":y=cn(o[1]),o.length!==2?w.push(new Be(h,o,`filter array for "${o[0]}" operator must have 2 elements`)):y!=="string"&&w.push(new Be(`${h}[1]`,o[1],`string expected, ${y} found`))}return w}function vd(c,o){const h=c.key,p=c.validateSpec,y=c.style,w=c.styleSpec,k=c.value,C=c.objectKey,A=w[`${o}_${c.layerType}`];if(!A)return[];const O=C.match(/^(.*)-transition$/);if(o==="paint"&&O&&A[O[1]]&&A[O[1]].transition)return p({key:h,value:k,valueSpec:w.transition,style:y,styleSpec:w});const R=c.valueSpec||A[C];if(!R)return[new Be(h,k,`unknown property "${C}"`)];let N;if(cn(k)==="string"&&Na(R)&&!R.tokens&&(N=/^{([^}]+)}$/.exec(k)))return[new Be(h,k,`"${C}" does not support interpolation syntax
|
|
@@ -621,15 +621,15 @@ uniform ${B} ${V} u_${W};
|
|
|
621
621
|
#endif
|
|
622
622
|
`}),staticAttributes:f,staticUniforms:M}}class Kh{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(s,d,f,m,x,M,P,D,L){this.context=s;let B=this.boundPaintVertexBuffers.length!==m.length;for(let V=0;!B&&V<m.length;V++)this.boundPaintVertexBuffers[V]!==m[V]&&(B=!0);!this.vao||this.boundProgram!==d||this.boundLayoutVertexBuffer!==f||B||this.boundIndexBuffer!==x||this.boundVertexOffset!==M||this.boundDynamicVertexBuffer!==P||this.boundDynamicVertexBuffer2!==D||this.boundDynamicVertexBuffer3!==L?this.freshBind(d,f,m,x,M,P,D,L):(s.bindVertexArray.set(this.vao),P&&P.bind(),x&&x.dynamicDraw&&x.bind(),D&&D.bind(),L&&L.bind())}freshBind(s,d,f,m,x,M,P,D){const L=s.numAttributes,B=this.context,V=B.gl;this.vao&&this.destroy(),this.vao=B.createVertexArray(),B.bindVertexArray.set(this.vao),this.boundProgram=s,this.boundLayoutVertexBuffer=d,this.boundPaintVertexBuffers=f,this.boundIndexBuffer=m,this.boundVertexOffset=x,this.boundDynamicVertexBuffer=M,this.boundDynamicVertexBuffer2=P,this.boundDynamicVertexBuffer3=D,d.enableAttributes(V,s);for(const W of f)W.enableAttributes(V,s);M&&M.enableAttributes(V,s),P&&P.enableAttributes(V,s),D&&D.enableAttributes(V,s),d.bind(),d.setVertexAttribPointers(V,s,x);for(const W of f)W.bind(),W.setVertexAttribPointers(V,s,x);M&&(M.bind(),M.setVertexAttribPointers(V,s,x)),m&&m.bind(),P&&(P.bind(),P.setVertexAttribPointers(V,s,x)),D&&(D.bind(),D.setVertexAttribPointers(V,s,x)),B.currentNumAttributes=L}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const Jh=(b,s,d,f,m)=>({u_matrix:b,u_texture:0,u_ele_delta:s,u_fog_matrix:d,u_fog_color:f?f.properties.get("fog-color"):l.aM.white,u_fog_ground_blend:f?f.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:f?f.calculateFogBlendOpacity(m):0,u_horizon_color:f?f.properties.get("horizon-color"):l.aM.white,u_horizon_fog_blend:f?f.properties.get("horizon-fog-blend"):1});function Pa(b){const s=[];for(let d=0;d<b.length;d++){if(b[d]===null)continue;const f=b[d].split(" ");s.push(f.pop())}return s}class Qh{constructor(s,d,f,m,x,M){const P=s.gl;this.program=P.createProgram();const D=Pa(d.staticAttributes),L=f?f.getBinderAttributes():[],B=D.concat(L),V=uo.prelude.staticUniforms?Pa(uo.prelude.staticUniforms):[],W=d.staticUniforms?Pa(d.staticUniforms):[],K=f?f.getBinderUniforms():[],Q=V.concat(W).concat(K),re=[];for(const ve of Q)re.indexOf(ve)<0&&re.push(ve);const ae=f?f.defines():[];x&&ae.push("#define OVERDRAW_INSPECTOR;"),M&&ae.push("#define TERRAIN3D;");const ce=ae.concat(uo.prelude.fragmentSource,d.fragmentSource).join(`
|
|
623
623
|
`),he=ae.concat(uo.prelude.vertexSource,d.vertexSource).join(`
|
|
624
|
-
`),ee=P.createShader(P.FRAGMENT_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(ee,ce),P.compileShader(ee),!P.getShaderParameter(ee,P.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${P.getShaderInfoLog(ee)}`);P.attachShader(this.program,ee);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=B.length;for(let ve=0;ve<this.numAttributes;ve++)B[ve]&&(P.bindAttribLocation(this.program,ve,B[ve]),this.attributes[B[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(ee);for(let ve=0;ve<re.length;ve++){const Oe=re[ve];if(Oe&&!ge[Oe]){const Ve=P.getUniformLocation(this.program,Oe);Ve&&(ge[Oe]=Ve)}}this.fixedUniforms=m(s,ge),this.terrainUniforms=((ve,Oe)=>({u_depth:new l.aH(ve,Oe.u_depth),u_terrain:new l.aH(ve,Oe.u_terrain),u_terrain_dim:new l.aI(ve,Oe.u_terrain_dim),u_terrain_matrix:new l.aJ(ve,Oe.u_terrain_matrix),u_terrain_unpack:new l.aK(ve,Oe.u_terrain_unpack),u_terrain_exaggeration:new l.aI(ve,Oe.u_terrain_exaggeration)}))(s,ge),this.binderUniforms=f?f.getUniforms(s,ge):[]}draw(s,d,f,m,x,M,P,D,L,B,V,W,K,Q,re,ae,ce,he){const ee=s.gl;if(this.failedToCreate)return;if(s.program.set(this.program),s.setDepthMode(f),s.setStencilMode(m),s.setColorMode(x),s.setCullFace(M),D){s.activeTexture.set(ee.TEXTURE2),ee.bindTexture(ee.TEXTURE_2D,D.depthTexture),s.activeTexture.set(ee.TEXTURE3),ee.bindTexture(ee.TEXTURE_2D,D.texture);for(const ge in this.terrainUniforms)this.terrainUniforms[ge].set(D[ge])}for(const ge in this.fixedUniforms)this.fixedUniforms[ge].set(P[ge]);re&&re.setUniforms(s,this.binderUniforms,K,{zoom:Q});let me=0;switch(d){case ee.LINES:me=2;break;case ee.TRIANGLES:me=3;break;case ee.LINE_STRIP:me=1}for(const ge of W.get()){const ve=ge.vaos||(ge.vaos={});(ve[L]||(ve[L]=new Kh)).bind(s,this,B,re?re.getPaintVertexBuffers():[],V,ge.vertexOffset,ae,ce,he),ee.drawElements(d,ge.primitiveLength*me,ee.UNSIGNED_SHORT,ge.primitiveOffset*me*2)}}}function nu(b,s,d){const f=1/Zt(d,1,s.transform.tileZoom),m=Math.pow(2,d.tileID.overscaledZ),x=d.tileSize*Math.pow(2,s.transform.tileZoom)/m,M=x*(d.tileID.canonical.x+d.tileID.wrap*m),P=x*d.tileID.canonical.y;return{u_image:0,u_texsize:d.imageAtlasTexture.size,u_scale:[f,b.fromScale,b.toScale],u_fade:b.t,u_pixel_coord_upper:[M>>16,P>>16],u_pixel_coord_lower:[65535&M,65535&P]}}const Bl=(b,s,d,f)=>{const m=s.style.light,x=m.properties.get("position"),M=[x.x,x.y,x.z],P=function(){var L=new l.A(9);return l.A!=Float32Array&&(L[1]=0,L[2]=0,L[3]=0,L[5]=0,L[6]=0,L[7]=0),L[0]=1,L[4]=1,L[8]=1,L}();m.properties.get("anchor")==="viewport"&&function(L,B){var V=Math.sin(B),W=Math.cos(B);L[0]=W,L[1]=V,L[2]=0,L[3]=-V,L[4]=W,L[5]=0,L[6]=0,L[7]=0,L[8]=1}(P,-s.transform.angle),function(L,B,V){var W=B[0],K=B[1],Q=B[2];L[0]=W*V[0]+K*V[3]+Q*V[6],L[1]=W*V[1]+K*V[4]+Q*V[7],L[2]=W*V[2]+K*V[5]+Q*V[8]}(M,M,P);const D=m.properties.get("color");return{u_matrix:b,u_lightpos:M,u_lightintensity:m.properties.get("intensity"),u_lightcolor:[D.r,D.g,D.b],u_vertical_gradient:+d,u_opacity:f}},iu=(b,s,d,f,m,x,M)=>l.e(Bl(b,s,d,f),nu(x,s,M),{u_height_factor:-Math.pow(2,m.overscaledZ)/M.tileSize/8}),Ia=b=>({u_matrix:b}),Gf=(b,s,d,f)=>l.e(Ia(b),nu(d,s,f)),K0=(b,s)=>({u_matrix:b,u_world:s}),Zf=(b,s,d,f,m)=>l.e(Gf(b,s,d,f),{u_world:m}),J0=(b,s,d,f)=>{const m=b.transform;let x,M;if(f.paint.get("circle-pitch-alignment")==="map"){const P=Zt(d,1,m.zoom);x=!0,M=[P,P]}else x=!1,M=m.pixelsToGLUnits;return{u_camera_to_center_distance:m.cameraToCenterDistance,u_scale_with_map:+(f.paint.get("circle-pitch-scale")==="map"),u_matrix:b.translatePosMatrix(s.posMatrix,d,f.paint.get("circle-translate"),f.paint.get("circle-translate-anchor")),u_pitch_with_map:+x,u_device_pixel_ratio:b.pixelRatio,u_extrude_scale:M}},jo=(b,s,d)=>({u_matrix:b,u_inv_matrix:s,u_camera_to_center_distance:d.cameraToCenterDistance,u_viewport_size:[d.width,d.height]}),Vl=(b,s,d=1)=>({u_matrix:b,u_color:s,u_overlay:0,u_overlay_scale:d}),nr=b=>({u_matrix:b}),ir=(b,s,d,f)=>({u_matrix:b,u_extrude_scale:Zt(s,1,d),u_intensity:f}),ru=(b,s,d,f)=>{const m=l.H();l.aP(m,0,b.width,b.height,0,0,1);const x=b.context.gl;return{u_matrix:m,u_world:[x.drawingBufferWidth,x.drawingBufferHeight],u_image:d,u_color_ramp:f,u_opacity:s.paint.get("heatmap-opacity")}};function su(b,s){const d=Math.pow(2,s.canonical.z),f=s.canonical.y;return[new l.Z(0,f/d).toLngLat().lat,new l.Z(0,(f+1)/d).toLngLat().lat]}const ou=(b,s,d,f)=>{const m=b.transform;return{u_matrix:Kf(b,s,d,f),u_ratio:1/Zt(s,1,m.zoom),u_device_pixel_ratio:b.pixelRatio,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},Yf=(b,s,d,f,m)=>l.e(ou(b,s,d,m),{u_image:0,u_image_height:f}),Da=(b,s,d,f,m)=>{const x=b.transform,M=Xf(s,x);return{u_matrix:Kf(b,s,d,m),u_texsize:s.imageAtlasTexture.size,u_ratio:1/Zt(s,1,x.zoom),u_device_pixel_ratio:b.pixelRatio,u_image:0,u_scale:[M,f.fromScale,f.toScale],u_fade:f.t,u_units_to_pixels:[1/x.pixelsToGLUnits[0],1/x.pixelsToGLUnits[1]]}},Q0=(b,s,d,f,m,x)=>{const M=b.lineAtlas,P=Xf(s,b.transform),D=d.layout.get("line-cap")==="round",L=M.getDash(f.from,D),B=M.getDash(f.to,D),V=L.width*m.fromScale,W=B.width*m.toScale;return l.e(ou(b,s,d,x),{u_patternscale_a:[P/V,-L.height/2],u_patternscale_b:[P/W,-B.height/2],u_sdfgamma:M.width/(256*Math.min(V,W)*b.pixelRatio)/2,u_image:0,u_tex_y_a:L.y,u_tex_y_b:B.y,u_mix:m.t})};function Xf(b,s){return 1/Zt(b,1,s.tileZoom)}function Kf(b,s,d,f){return b.translatePosMatrix(f?f.posMatrix:s.tileID.posMatrix,s,d.paint.get("line-translate"),d.paint.get("line-translate-anchor"))}const e_=(b,s,d,f,m)=>{return{u_matrix:b,u_tl_parent:s,u_scale_parent:d,u_buffer_scale:1,u_fade_t:f.mix,u_opacity:f.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:(M=m.paint.get("raster-saturation"),M>0?1-1/(1.001-M):-M),u_contrast_factor:(x=m.paint.get("raster-contrast"),x>0?1/(1-x):1+x),u_spin_weights:t_(m.paint.get("raster-hue-rotate"))};var x,M};function t_(b){b*=Math.PI/180;const s=Math.sin(b),d=Math.cos(b);return[(2*d+1)/3,(-Math.sqrt(3)*s-d+1)/3,(Math.sqrt(3)*s-d+1)/3]}const Jf=(b,s,d,f,m,x,M,P,D,L,B,V,W,K)=>{const Q=M.transform;return{u_is_size_zoom_constant:+(b==="constant"||b==="source"),u_is_size_feature_constant:+(b==="constant"||b==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:Q.cameraToCenterDistance,u_pitch:Q.pitch/360*2*Math.PI,u_rotate_symbol:+d,u_aspect_ratio:Q.width/Q.height,u_fade_change:M.options.fadeDuration?M.symbolFadeChange:1,u_matrix:P,u_label_plane_matrix:D,u_coord_matrix:L,u_is_text:+V,u_pitch_with_map:+f,u_is_along_line:m,u_is_variable_anchor:x,u_texsize:W,u_texture:0,u_translation:B,u_pitched_scale:K}},Fl=(b,s,d,f,m,x,M,P,D,L,B,V,W,K,Q)=>{const re=M.transform;return l.e(Jf(b,s,d,f,m,x,M,P,D,L,B,V,W,Q),{u_gamma_scale:f?Math.cos(re._pitch)*re.cameraToCenterDistance:1,u_device_pixel_ratio:M.pixelRatio,u_is_halo:+K})},ed=(b,s,d,f,m,x,M,P,D,L,B,V,W,K)=>l.e(Fl(b,s,d,f,m,x,M,P,D,L,B,!0,V,!0,K),{u_texsize_icon:W,u_texture_icon:1}),au=(b,s,d)=>({u_matrix:b,u_opacity:s,u_color:d}),td=(b,s,d,f,m,x)=>l.e(function(M,P,D,L){const B=D.imageManager.getPattern(M.from.toString()),V=D.imageManager.getPattern(M.to.toString()),{width:W,height:K}=D.imageManager.getPixelSize(),Q=Math.pow(2,L.tileID.overscaledZ),re=L.tileSize*Math.pow(2,D.transform.tileZoom)/Q,ae=re*(L.tileID.canonical.x+L.tileID.wrap*Q),ce=re*L.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:B.tl,u_pattern_br_a:B.br,u_pattern_tl_b:V.tl,u_pattern_br_b:V.br,u_texsize:[W,K],u_mix:P.t,u_pattern_size_a:B.displaySize,u_pattern_size_b:V.displaySize,u_scale_a:P.fromScale,u_scale_b:P.toScale,u_tile_units_to_pixels:1/Zt(L,1,D.transform.tileZoom),u_pixel_coord_upper:[ae>>16,ce>>16],u_pixel_coord_lower:[65535&ae,65535&ce]}}(f,x,d,m),{u_matrix:b,u_opacity:s}),nd={fillExtrusion:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_lightpos:new l.aN(b,s.u_lightpos),u_lightintensity:new l.aI(b,s.u_lightintensity),u_lightcolor:new l.aN(b,s.u_lightcolor),u_vertical_gradient:new l.aI(b,s.u_vertical_gradient),u_opacity:new l.aI(b,s.u_opacity)}),fillExtrusionPattern:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_lightpos:new l.aN(b,s.u_lightpos),u_lightintensity:new l.aI(b,s.u_lightintensity),u_lightcolor:new l.aN(b,s.u_lightcolor),u_vertical_gradient:new l.aI(b,s.u_vertical_gradient),u_height_factor:new l.aI(b,s.u_height_factor),u_image:new l.aH(b,s.u_image),u_texsize:new l.aO(b,s.u_texsize),u_pixel_coord_upper:new l.aO(b,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(b,s.u_pixel_coord_lower),u_scale:new l.aN(b,s.u_scale),u_fade:new l.aI(b,s.u_fade),u_opacity:new l.aI(b,s.u_opacity)}),fill:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix)}),fillPattern:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_image:new l.aH(b,s.u_image),u_texsize:new l.aO(b,s.u_texsize),u_pixel_coord_upper:new l.aO(b,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(b,s.u_pixel_coord_lower),u_scale:new l.aN(b,s.u_scale),u_fade:new l.aI(b,s.u_fade)}),fillOutline:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_world:new l.aO(b,s.u_world)}),fillOutlinePattern:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_world:new l.aO(b,s.u_world),u_image:new l.aH(b,s.u_image),u_texsize:new l.aO(b,s.u_texsize),u_pixel_coord_upper:new l.aO(b,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(b,s.u_pixel_coord_lower),u_scale:new l.aN(b,s.u_scale),u_fade:new l.aI(b,s.u_fade)}),circle:(b,s)=>({u_camera_to_center_distance:new l.aI(b,s.u_camera_to_center_distance),u_scale_with_map:new l.aH(b,s.u_scale_with_map),u_pitch_with_map:new l.aH(b,s.u_pitch_with_map),u_extrude_scale:new l.aO(b,s.u_extrude_scale),u_device_pixel_ratio:new l.aI(b,s.u_device_pixel_ratio),u_matrix:new l.aJ(b,s.u_matrix)}),collisionBox:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_pixel_extrude_scale:new l.aO(b,s.u_pixel_extrude_scale)}),collisionCircle:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_inv_matrix:new l.aJ(b,s.u_inv_matrix),u_camera_to_center_distance:new l.aI(b,s.u_camera_to_center_distance),u_viewport_size:new l.aO(b,s.u_viewport_size)}),debug:(b,s)=>({u_color:new l.aL(b,s.u_color),u_matrix:new l.aJ(b,s.u_matrix),u_overlay:new l.aH(b,s.u_overlay),u_overlay_scale:new l.aI(b,s.u_overlay_scale)}),clippingMask:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix)}),heatmap:(b,s)=>({u_extrude_scale:new l.aI(b,s.u_extrude_scale),u_intensity:new l.aI(b,s.u_intensity),u_matrix:new l.aJ(b,s.u_matrix)}),heatmapTexture:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_world:new l.aO(b,s.u_world),u_image:new l.aH(b,s.u_image),u_color_ramp:new l.aH(b,s.u_color_ramp),u_opacity:new l.aI(b,s.u_opacity)}),hillshade:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_image:new l.aH(b,s.u_image),u_latrange:new l.aO(b,s.u_latrange),u_light:new l.aO(b,s.u_light),u_shadow:new l.aL(b,s.u_shadow),u_highlight:new l.aL(b,s.u_highlight),u_accent:new l.aL(b,s.u_accent)}),hillshadePrepare:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_image:new l.aH(b,s.u_image),u_dimension:new l.aO(b,s.u_dimension),u_zoom:new l.aI(b,s.u_zoom),u_unpack:new l.aK(b,s.u_unpack)}),line:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_ratio:new l.aI(b,s.u_ratio),u_device_pixel_ratio:new l.aI(b,s.u_device_pixel_ratio),u_units_to_pixels:new l.aO(b,s.u_units_to_pixels)}),lineGradient:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_ratio:new l.aI(b,s.u_ratio),u_device_pixel_ratio:new l.aI(b,s.u_device_pixel_ratio),u_units_to_pixels:new l.aO(b,s.u_units_to_pixels),u_image:new l.aH(b,s.u_image),u_image_height:new l.aI(b,s.u_image_height)}),linePattern:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_texsize:new l.aO(b,s.u_texsize),u_ratio:new l.aI(b,s.u_ratio),u_device_pixel_ratio:new l.aI(b,s.u_device_pixel_ratio),u_image:new l.aH(b,s.u_image),u_units_to_pixels:new l.aO(b,s.u_units_to_pixels),u_scale:new l.aN(b,s.u_scale),u_fade:new l.aI(b,s.u_fade)}),lineSDF:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_ratio:new l.aI(b,s.u_ratio),u_device_pixel_ratio:new l.aI(b,s.u_device_pixel_ratio),u_units_to_pixels:new l.aO(b,s.u_units_to_pixels),u_patternscale_a:new l.aO(b,s.u_patternscale_a),u_patternscale_b:new l.aO(b,s.u_patternscale_b),u_sdfgamma:new l.aI(b,s.u_sdfgamma),u_image:new l.aH(b,s.u_image),u_tex_y_a:new l.aI(b,s.u_tex_y_a),u_tex_y_b:new l.aI(b,s.u_tex_y_b),u_mix:new l.aI(b,s.u_mix)}),raster:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_tl_parent:new l.aO(b,s.u_tl_parent),u_scale_parent:new l.aI(b,s.u_scale_parent),u_buffer_scale:new l.aI(b,s.u_buffer_scale),u_fade_t:new l.aI(b,s.u_fade_t),u_opacity:new l.aI(b,s.u_opacity),u_image0:new l.aH(b,s.u_image0),u_image1:new l.aH(b,s.u_image1),u_brightness_low:new l.aI(b,s.u_brightness_low),u_brightness_high:new l.aI(b,s.u_brightness_high),u_saturation_factor:new l.aI(b,s.u_saturation_factor),u_contrast_factor:new l.aI(b,s.u_contrast_factor),u_spin_weights:new l.aN(b,s.u_spin_weights)}),symbolIcon:(b,s)=>({u_is_size_zoom_constant:new l.aH(b,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(b,s.u_is_size_feature_constant),u_size_t:new l.aI(b,s.u_size_t),u_size:new l.aI(b,s.u_size),u_camera_to_center_distance:new l.aI(b,s.u_camera_to_center_distance),u_pitch:new l.aI(b,s.u_pitch),u_rotate_symbol:new l.aH(b,s.u_rotate_symbol),u_aspect_ratio:new l.aI(b,s.u_aspect_ratio),u_fade_change:new l.aI(b,s.u_fade_change),u_matrix:new l.aJ(b,s.u_matrix),u_label_plane_matrix:new l.aJ(b,s.u_label_plane_matrix),u_coord_matrix:new l.aJ(b,s.u_coord_matrix),u_is_text:new l.aH(b,s.u_is_text),u_pitch_with_map:new l.aH(b,s.u_pitch_with_map),u_is_along_line:new l.aH(b,s.u_is_along_line),u_is_variable_anchor:new l.aH(b,s.u_is_variable_anchor),u_texsize:new l.aO(b,s.u_texsize),u_texture:new l.aH(b,s.u_texture),u_translation:new l.aO(b,s.u_translation),u_pitched_scale:new l.aI(b,s.u_pitched_scale)}),symbolSDF:(b,s)=>({u_is_size_zoom_constant:new l.aH(b,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(b,s.u_is_size_feature_constant),u_size_t:new l.aI(b,s.u_size_t),u_size:new l.aI(b,s.u_size),u_camera_to_center_distance:new l.aI(b,s.u_camera_to_center_distance),u_pitch:new l.aI(b,s.u_pitch),u_rotate_symbol:new l.aH(b,s.u_rotate_symbol),u_aspect_ratio:new l.aI(b,s.u_aspect_ratio),u_fade_change:new l.aI(b,s.u_fade_change),u_matrix:new l.aJ(b,s.u_matrix),u_label_plane_matrix:new l.aJ(b,s.u_label_plane_matrix),u_coord_matrix:new l.aJ(b,s.u_coord_matrix),u_is_text:new l.aH(b,s.u_is_text),u_pitch_with_map:new l.aH(b,s.u_pitch_with_map),u_is_along_line:new l.aH(b,s.u_is_along_line),u_is_variable_anchor:new l.aH(b,s.u_is_variable_anchor),u_texsize:new l.aO(b,s.u_texsize),u_texture:new l.aH(b,s.u_texture),u_gamma_scale:new l.aI(b,s.u_gamma_scale),u_device_pixel_ratio:new l.aI(b,s.u_device_pixel_ratio),u_is_halo:new l.aH(b,s.u_is_halo),u_translation:new l.aO(b,s.u_translation),u_pitched_scale:new l.aI(b,s.u_pitched_scale)}),symbolTextAndIcon:(b,s)=>({u_is_size_zoom_constant:new l.aH(b,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(b,s.u_is_size_feature_constant),u_size_t:new l.aI(b,s.u_size_t),u_size:new l.aI(b,s.u_size),u_camera_to_center_distance:new l.aI(b,s.u_camera_to_center_distance),u_pitch:new l.aI(b,s.u_pitch),u_rotate_symbol:new l.aH(b,s.u_rotate_symbol),u_aspect_ratio:new l.aI(b,s.u_aspect_ratio),u_fade_change:new l.aI(b,s.u_fade_change),u_matrix:new l.aJ(b,s.u_matrix),u_label_plane_matrix:new l.aJ(b,s.u_label_plane_matrix),u_coord_matrix:new l.aJ(b,s.u_coord_matrix),u_is_text:new l.aH(b,s.u_is_text),u_pitch_with_map:new l.aH(b,s.u_pitch_with_map),u_is_along_line:new l.aH(b,s.u_is_along_line),u_is_variable_anchor:new l.aH(b,s.u_is_variable_anchor),u_texsize:new l.aO(b,s.u_texsize),u_texsize_icon:new l.aO(b,s.u_texsize_icon),u_texture:new l.aH(b,s.u_texture),u_texture_icon:new l.aH(b,s.u_texture_icon),u_gamma_scale:new l.aI(b,s.u_gamma_scale),u_device_pixel_ratio:new l.aI(b,s.u_device_pixel_ratio),u_is_halo:new l.aH(b,s.u_is_halo),u_translation:new l.aO(b,s.u_translation),u_pitched_scale:new l.aI(b,s.u_pitched_scale)}),background:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_opacity:new l.aI(b,s.u_opacity),u_color:new l.aL(b,s.u_color)}),backgroundPattern:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_opacity:new l.aI(b,s.u_opacity),u_image:new l.aH(b,s.u_image),u_pattern_tl_a:new l.aO(b,s.u_pattern_tl_a),u_pattern_br_a:new l.aO(b,s.u_pattern_br_a),u_pattern_tl_b:new l.aO(b,s.u_pattern_tl_b),u_pattern_br_b:new l.aO(b,s.u_pattern_br_b),u_texsize:new l.aO(b,s.u_texsize),u_mix:new l.aI(b,s.u_mix),u_pattern_size_a:new l.aO(b,s.u_pattern_size_a),u_pattern_size_b:new l.aO(b,s.u_pattern_size_b),u_scale_a:new l.aI(b,s.u_scale_a),u_scale_b:new l.aI(b,s.u_scale_b),u_pixel_coord_upper:new l.aO(b,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(b,s.u_pixel_coord_lower),u_tile_units_to_pixels:new l.aI(b,s.u_tile_units_to_pixels)}),terrain:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_texture:new l.aH(b,s.u_texture),u_ele_delta:new l.aI(b,s.u_ele_delta),u_fog_matrix:new l.aJ(b,s.u_fog_matrix),u_fog_color:new l.aL(b,s.u_fog_color),u_fog_ground_blend:new l.aI(b,s.u_fog_ground_blend),u_fog_ground_blend_opacity:new l.aI(b,s.u_fog_ground_blend_opacity),u_horizon_color:new l.aL(b,s.u_horizon_color),u_horizon_fog_blend:new l.aI(b,s.u_horizon_fog_blend)}),terrainDepth:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_ele_delta:new l.aI(b,s.u_ele_delta)}),terrainCoords:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_texture:new l.aH(b,s.u_texture),u_terrain_coords_id:new l.aI(b,s.u_terrain_coords_id),u_ele_delta:new l.aI(b,s.u_ele_delta)}),sky:(b,s)=>({u_sky_color:new l.aL(b,s.u_sky_color),u_horizon_color:new l.aL(b,s.u_horizon_color),u_horizon:new l.aI(b,s.u_horizon),u_sky_horizon_blend:new l.aI(b,s.u_sky_horizon_blend)})};class Ms{constructor(s,d,f){this.context=s;const m=s.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!f,this.context.unbindVAO(),s.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(s){const d=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),d.bufferSubData(d.ELEMENT_ARRAY_BUFFER,0,s.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const n_={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class id{constructor(s,d,f,m){this.length=d.length,this.attributes=f,this.itemSize=d.bytesPerElement,this.dynamicDraw=m,this.context=s;const x=s.gl;this.buffer=x.createBuffer(),s.bindVertexBuffer.set(this.buffer),x.bufferData(x.ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?x.DYNAMIC_DRAW:x.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(s){if(s.length!==this.length)throw new Error(`Length of new data is ${s.length}, which doesn't match current length of ${this.length}`);const d=this.context.gl;this.bind(),d.bufferSubData(d.ARRAY_BUFFER,0,s.arrayBuffer)}enableAttributes(s,d){for(let f=0;f<this.attributes.length;f++){const m=d.attributes[this.attributes[f].name];m!==void 0&&s.enableVertexAttribArray(m)}}setVertexAttribPointers(s,d,f){for(let m=0;m<this.attributes.length;m++){const x=this.attributes[m],M=d.attributes[x.name];M!==void 0&&s.vertexAttribPointer(M,x.components,s[n_[x.type]],!1,this.itemSize,x.offset+this.itemSize*(f||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Uo=new WeakMap;function ho(b){var s;if(Uo.has(b))return Uo.get(b);{const d=(s=b.getParameter(b.VERSION))===null||s===void 0?void 0:s.startsWith("WebGL 2.0");return Uo.set(b,d),d}}class mn{constructor(s){this.gl=s.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(s){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class lu extends mn{getDefault(){return l.aM.transparent}set(s){const d=this.current;(s.r!==d.r||s.g!==d.g||s.b!==d.b||s.a!==d.a||this.dirty)&&(this.gl.clearColor(s.r,s.g,s.b,s.a),this.current=s,this.dirty=!1)}}class i_ extends mn{getDefault(){return 1}set(s){(s!==this.current||this.dirty)&&(this.gl.clearDepth(s),this.current=s,this.dirty=!1)}}class Oa extends mn{getDefault(){return 0}set(s){(s!==this.current||this.dirty)&&(this.gl.clearStencil(s),this.current=s,this.dirty=!1)}}class r_ extends mn{getDefault(){return[!0,!0,!0,!0]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||s[2]!==d[2]||s[3]!==d[3]||this.dirty)&&(this.gl.colorMask(s[0],s[1],s[2],s[3]),this.current=s,this.dirty=!1)}}class Qf extends mn{getDefault(){return!0}set(s){(s!==this.current||this.dirty)&&(this.gl.depthMask(s),this.current=s,this.dirty=!1)}}class s_ extends mn{getDefault(){return 255}set(s){(s!==this.current||this.dirty)&&(this.gl.stencilMask(s),this.current=s,this.dirty=!1)}}class em extends mn{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(s){const d=this.current;(s.func!==d.func||s.ref!==d.ref||s.mask!==d.mask||this.dirty)&&(this.gl.stencilFunc(s.func,s.ref,s.mask),this.current=s,this.dirty=!1)}}class rd extends mn{getDefault(){const s=this.gl;return[s.KEEP,s.KEEP,s.KEEP]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||s[2]!==d[2]||this.dirty)&&(this.gl.stencilOp(s[0],s[1],s[2]),this.current=s,this.dirty=!1)}}class tm extends mn{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;s?d.enable(d.STENCIL_TEST):d.disable(d.STENCIL_TEST),this.current=s,this.dirty=!1}}class nm extends mn{getDefault(){return[0,1]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||this.dirty)&&(this.gl.depthRange(s[0],s[1]),this.current=s,this.dirty=!1)}}class im extends mn{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;s?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),this.current=s,this.dirty=!1}}class rm extends mn{getDefault(){return this.gl.LESS}set(s){(s!==this.current||this.dirty)&&(this.gl.depthFunc(s),this.current=s,this.dirty=!1)}}class Ho extends mn{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;s?d.enable(d.BLEND):d.disable(d.BLEND),this.current=s,this.dirty=!1}}class sm extends mn{getDefault(){const s=this.gl;return[s.ONE,s.ZERO]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||this.dirty)&&(this.gl.blendFunc(s[0],s[1]),this.current=s,this.dirty=!1)}}class o_ extends mn{getDefault(){return l.aM.transparent}set(s){const d=this.current;(s.r!==d.r||s.g!==d.g||s.b!==d.b||s.a!==d.a||this.dirty)&&(this.gl.blendColor(s.r,s.g,s.b,s.a),this.current=s,this.dirty=!1)}}class om extends mn{getDefault(){return this.gl.FUNC_ADD}set(s){(s!==this.current||this.dirty)&&(this.gl.blendEquation(s),this.current=s,this.dirty=!1)}}class $l extends mn{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;s?d.enable(d.CULL_FACE):d.disable(d.CULL_FACE),this.current=s,this.dirty=!1}}class a_ extends mn{getDefault(){return this.gl.BACK}set(s){(s!==this.current||this.dirty)&&(this.gl.cullFace(s),this.current=s,this.dirty=!1)}}class cu extends mn{getDefault(){return this.gl.CCW}set(s){(s!==this.current||this.dirty)&&(this.gl.frontFace(s),this.current=s,this.dirty=!1)}}class l_ extends mn{getDefault(){return null}set(s){(s!==this.current||this.dirty)&&(this.gl.useProgram(s),this.current=s,this.dirty=!1)}}class c_ extends mn{getDefault(){return this.gl.TEXTURE0}set(s){(s!==this.current||this.dirty)&&(this.gl.activeTexture(s),this.current=s,this.dirty=!1)}}class am extends mn{getDefault(){const s=this.gl;return[0,0,s.drawingBufferWidth,s.drawingBufferHeight]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||s[2]!==d[2]||s[3]!==d[3]||this.dirty)&&(this.gl.viewport(s[0],s[1],s[2],s[3]),this.current=s,this.dirty=!1)}}class lm extends mn{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.bindFramebuffer(d.FRAMEBUFFER,s),this.current=s,this.dirty=!1}}class cm extends mn{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.bindRenderbuffer(d.RENDERBUFFER,s),this.current=s,this.dirty=!1}}class sd extends mn{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.bindTexture(d.TEXTURE_2D,s),this.current=s,this.dirty=!1}}class um extends mn{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.bindBuffer(d.ARRAY_BUFFER,s),this.current=s,this.dirty=!1}}class uu extends mn{getDefault(){return null}set(s){const d=this.gl;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,s),this.current=s,this.dirty=!1}}class Hs extends mn{getDefault(){return null}set(s){var d;if(s===this.current&&!this.dirty)return;const f=this.gl;ho(f)?f.bindVertexArray(s):(d=f.getExtension("OES_vertex_array_object"))===null||d===void 0||d.bindVertexArrayOES(s),this.current=s,this.dirty=!1}}class od extends mn{getDefault(){return 4}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_ALIGNMENT,s),this.current=s,this.dirty=!1}}class ad extends mn{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s),this.current=s,this.dirty=!1}}class ld extends mn{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL,s),this.current=s,this.dirty=!1}}class hu extends mn{constructor(s,d){super(s),this.context=s,this.parent=d}getDefault(){return null}}class cd extends hu{setDirty(){this.dirty=!0}set(s){if(s===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,s,0),this.current=s,this.dirty=!1}}class qo extends hu{set(s){if(s===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,s),this.current=s,this.dirty=!1}}class ud extends hu{set(s){if(s===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,s),this.current=s,this.dirty=!1}}class u_{constructor(s,d,f,m,x){this.context=s,this.width=d,this.height=f;const M=s.gl,P=this.framebuffer=M.createFramebuffer();if(this.colorAttachment=new cd(s,P),m)this.depthAttachment=x?new ud(s,P):new qo(s,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 s=this.context.gl,d=this.colorAttachment.get();if(d&&s.deleteTexture(d),this.depthAttachment){const f=this.depthAttachment.get();f&&s.deleteRenderbuffer(f)}s.deleteFramebuffer(this.framebuffer)}}class Jn{constructor(s,d,f){this.blendFunction=s,this.blendColor=d,this.mask=f}}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 h_{constructor(s){var d,f;if(this.gl=s,this.clearColor=new lu(this),this.clearDepth=new i_(this),this.clearStencil=new Oa(this),this.colorMask=new r_(this),this.depthMask=new Qf(this),this.stencilMask=new s_(this),this.stencilFunc=new em(this),this.stencilOp=new rd(this),this.stencilTest=new tm(this),this.depthRange=new nm(this),this.depthTest=new im(this),this.depthFunc=new rm(this),this.blend=new Ho(this),this.blendFunc=new sm(this),this.blendColor=new o_(this),this.blendEquation=new om(this),this.cullFace=new $l(this),this.cullFaceSide=new a_(this),this.frontFace=new cu(this),this.program=new l_(this),this.activeTexture=new c_(this),this.viewport=new am(this),this.bindFramebuffer=new lm(this),this.bindRenderbuffer=new cm(this),this.bindTexture=new sd(this),this.bindVertexBuffer=new um(this),this.bindElementBuffer=new uu(this),this.bindVertexArray=new Hs(this),this.pixelStoreUnpack=new od(this),this.pixelStoreUnpackPremultiplyAlpha=new ad(this),this.pixelStoreUnpackFlipY=new ld(this),this.extTextureFilterAnisotropic=s.getExtension("EXT_texture_filter_anisotropic")||s.getExtension("MOZ_EXT_texture_filter_anisotropic")||s.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=s.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=s.getParameter(s.MAX_TEXTURE_SIZE),ho(s)){this.HALF_FLOAT=s.HALF_FLOAT;const m=s.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(d=s.RGBA16F)!==null&&d!==void 0?d:m==null?void 0:m.RGBA16F_EXT,this.RGB16F=(f=s.RGB16F)!==null&&f!==void 0?f:m==null?void 0:m.RGB16F_EXT,s.getExtension("EXT_color_buffer_float")}else{s.getExtension("EXT_color_buffer_half_float"),s.getExtension("OES_texture_half_float_linear");const m=s.getExtension("OES_texture_half_float");this.HALF_FLOAT=m==null?void 0:m.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(s,d){return new Ms(this,s,d)}createVertexBuffer(s,d,f){return new id(this,s,d,f)}createRenderbuffer(s,d,f){const m=this.gl,x=m.createRenderbuffer();return this.bindRenderbuffer.set(x),m.renderbufferStorage(m.RENDERBUFFER,s,d,f),this.bindRenderbuffer.set(null),x}createFramebuffer(s,d,f,m){return new u_(this,s,d,f,m)}clear({color:s,depth:d,stencil:f}){const m=this.gl;let x=0;s&&(x|=m.COLOR_BUFFER_BIT,this.clearColor.set(s),this.colorMask.set([!0,!0,!0,!0])),d!==void 0&&(x|=m.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(d),this.depthMask.set(!0)),f!==void 0&&(x|=m.STENCIL_BUFFER_BIT,this.clearStencil.set(f),this.stencilMask.set(255)),m.clear(x)}setCullFace(s){s.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(s.mode),this.frontFace.set(s.frontFace))}setDepthMode(s){s.func!==this.gl.ALWAYS||s.mask?(this.depthTest.set(!0),this.depthFunc.set(s.func),this.depthMask.set(s.mask),this.depthRange.set(s.range)):this.depthTest.set(!1)}setStencilMode(s){s.test.func!==this.gl.ALWAYS||s.mask?(this.stencilTest.set(!0),this.stencilMask.set(s.mask),this.stencilOp.set([s.fail,s.depthFail,s.pass]),this.stencilFunc.set({func:s.test.func,ref:s.ref,mask:s.test.mask})):this.stencilTest.set(!1)}setColorMode(s){l.aE(s.blendFunction,Jn.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(s.blendFunction),this.blendColor.set(s.blendColor)),this.colorMask.set(s.mask)}createVertexArray(){var s;return ho(this.gl)?this.gl.createVertexArray():(s=this.gl.getExtension("OES_vertex_array_object"))===null||s===void 0?void 0:s.createVertexArrayOES()}deleteVertexArray(s){var d;return ho(this.gl)?this.gl.deleteVertexArray(s):(d=this.gl.getExtension("OES_vertex_array_object"))===null||d===void 0?void 0:d.deleteVertexArrayOES(s)}unbindVAO(){this.bindVertexArray.set(null)}}class Ht{constructor(s,d,f){this.func=s,this.mask=d,this.range=f}}Ht.ReadOnly=!1,Ht.ReadWrite=!0,Ht.disabled=new Ht(519,Ht.ReadOnly,[0,1]);const du=7680;class Dn{constructor(s,d,f,m,x,M){this.test=s,this.ref=d,this.mask=f,this.fail=m,this.depthFail=x,this.pass=M}}Dn.disabled=new Dn({func:519,mask:0},0,0,du,du,du);class Cn{constructor(s,d,f){this.enable=s,this.mode=d,this.frontFace=f}}let Wo;function jl(b,s,d,f,m){const x=b.context,M=x.gl,P=b.useProgram("collisionBox"),D=[];let L=0,B=0;for(let ce=0;ce<f.length;ce++){const he=f[ce],ee=s.getTile(he).getBucket(d);if(!ee)continue;const me=m?ee.textCollisionBox:ee.iconCollisionBox,ge=ee.collisionCircleArray;if(ge.length>0){const ve=l.H();l.aQ(ve,ee.placementInvProjMatrix,b.transform.glCoordMatrix),l.aQ(ve,ve,ee.placementViewportMatrix),D.push({circleArray:ge,circleOffset:B,transform:he.posMatrix,invTransform:ve,coord:he}),L+=ge.length/4,B=L}me&&P.draw(x,M.LINES,Ht.disabled,Dn.disabled,b.colorModeForRenderPass(),Cn.disabled,{u_matrix:he.posMatrix,u_pixel_extrude_scale:[1/(V=b.transform).width,1/V.height]},b.style.map.terrain&&b.style.map.terrain.getTerrainData(he),d.id,me.layoutVertexBuffer,me.indexBuffer,me.segments,null,b.transform.zoom,null,null,me.collisionVertexBuffer)}var V;if(!m||!D.length)return;const W=b.useProgram("collisionCircle"),K=new l.aR;K.resize(4*L),K._trim();let Q=0;for(const ce of D)for(let he=0;he<ce.circleArray.length/4;he++){const ee=4*he,me=ce.circleArray[ee+0],ge=ce.circleArray[ee+1],ve=ce.circleArray[ee+2],Oe=ce.circleArray[ee+3];K.emplace(Q++,me,ge,ve,Oe,0),K.emplace(Q++,me,ge,ve,Oe,1),K.emplace(Q++,me,ge,ve,Oe,2),K.emplace(Q++,me,ge,ve,Oe,3)}(!Wo||Wo.length<2*L)&&(Wo=function(ce){const he=2*ce,ee=new l.aT;ee.resize(he),ee._trim();for(let me=0;me<he;me++){const ge=6*me;ee.uint16[ge+0]=4*me+0,ee.uint16[ge+1]=4*me+1,ee.uint16[ge+2]=4*me+2,ee.uint16[ge+3]=4*me+2,ee.uint16[ge+4]=4*me+3,ee.uint16[ge+5]=4*me+0}return ee}(L));const re=x.createIndexBuffer(Wo,!0),ae=x.createVertexBuffer(K,l.aS.members,!0);for(const ce of D){const he=jo(ce.transform,ce.invTransform,b.transform);W.draw(x,M.TRIANGLES,Ht.disabled,Dn.disabled,b.colorModeForRenderPass(),Cn.disabled,he,b.style.map.terrain&&b.style.map.terrain.getTerrainData(ce.coord),d.id,ae,re,l.a0.simpleSegment(0,2*ce.circleOffset,ce.circleArray.length,ce.circleArray.length/2),null,b.transform.zoom,null,null,null)}ae.destroy(),re.destroy()}Cn.disabled=new Cn(!1,1029,2305),Cn.backCCW=new Cn(!0,1029,2305);const Ul=l.an(new Float32Array(16));function hd(b,s,d,f,m,x){const{horizontalAlign:M,verticalAlign:P}=l.au(b);return new l.P((-(M-.5)*s/m+f[0])*x,(-(P-.5)*d/m+f[1])*x)}function Go(b,s,d,f,m,x){const M=s.tileAnchorPoint.add(new l.P(s.translation[0],s.translation[1]));if(s.pitchWithMap){let P=f.mult(x);d||(P=P.rotate(-m));const D=M.add(P);return se(D.x,D.y,s.labelPlaneMatrix,s.getElevation).point}if(d){const P=Me(s.tileAnchorPoint.x+1,s.tileAnchorPoint.y,s).point.sub(b),D=Math.atan(P.y/P.x)+(P.x<0?Math.PI:0);return b.add(f.rotate(D))}return b.add(f)}function za(b,s,d,f,m,x,M,P,D,L,B,V,W,K){const Q=b.text.placedSymbolArray,re=b.text.dynamicLayoutVertexArray,ae=b.icon.dynamicLayoutVertexArray,ce={};re.clear();for(let he=0;he<Q.length;he++){const ee=Q.get(he),me=ee.hidden||!ee.crossTileID||b.allowVerticalPlacement&&!ee.placedOrientation?null:f[ee.crossTileID];if(me){const ge=new l.P(ee.anchorX,ee.anchorY),ve={getElevation:K,width:m.width,height:m.height,labelPlaneMatrix:x,lineVertexArray:null,pitchWithMap:d,projection:B,projectionCache:null,tileAnchorPoint:ge,translation:V,unwrappedTileID:W},Oe=d?se(ge.x,ge.y,M,K):Me(ge.x,ge.y,ve),Ve=H(m.cameraToCenterDistance,Oe.signedDistanceFromCamera);let Ke=l.ai(b.textSizeData,D,ee)*Ve/l.ap;d&&(Ke*=b.tilePixelRatio/P);const{width:nt,height:We,anchor:He,textOffset:ft,textBoxScale:Ot}=me,Ge=hd(He,nt,We,ft,Ot,Ke),et=B.getPitchedTextCorrection(m,ge.add(new l.P(V[0],V[1])),W),Pt=Go(Oe.point,ve,s,Ge,m.angle,et),Nn=b.allowVerticalPlacement&&ee.placedOrientation===l.ah.vertical?Math.PI/2:0;for(let Vt=0;Vt<ee.numGlyphs;Vt++)l.aj(re,Pt,Nn);L&&ee.associatedIconIndex>=0&&(ce[ee.associatedIconIndex]={shiftedAnchor:Pt,angle:Nn})}else kt(ee.numGlyphs,re)}if(L){ae.clear();const he=b.icon.placedSymbolArray;for(let ee=0;ee<he.length;ee++){const me=he.get(ee);if(me.hidden)kt(me.numGlyphs,ae);else{const ge=ce[ee];if(ge)for(let ve=0;ve<me.numGlyphs;ve++)l.aj(ae,ge.shiftedAnchor,ge.angle);else kt(me.numGlyphs,ae)}}b.icon.dynamicLayoutVertexBuffer.updateData(ae)}b.text.dynamicLayoutVertexBuffer.updateData(re)}function Lr(b,s,d){return d.iconsInText&&s?"symbolTextAndIcon":b?"symbolSDF":"symbolIcon"}function dd(b,s,d,f,m,x,M,P,D,L,B,V){const W=b.context,K=W.gl,Q=b.transform,re=Fo(),ae=P==="map",ce=D==="map",he=P!=="viewport"&&d.layout.get("symbol-placement")!=="point",ee=ae&&!ce&&!he,me=!ce&&he,ge=!d.layout.get("symbol-sort-key").isConstant();let ve=!1;const Oe=b.depthModeForSublayer(0,Ht.ReadOnly),Ve=d._unevaluatedLayout.hasValue("text-variable-anchor")||d._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Ke=[],nt=re.getCircleRadiusCorrection(Q);for(const We of f){const He=s.getTile(We),ft=He.getBucket(d);if(!ft)continue;const Ot=m?ft.text:ft.icon;if(!Ot||!Ot.segments.get().length||!Ot.hasVisibleVertices)continue;const Ge=Ot.programConfigurations.get(d.id),et=m||ft.sdfIcons,Pt=m?ft.textSizeData:ft.iconSizeData,Nn=ce||Q.pitch!==0,Vt=b.useProgram(Lr(et,m,ft),Ge),Yt=l.ag(Pt,Q.zoom),Bn=b.style.map.terrain&&b.style.map.terrain.getTerrainData(We);let Ii,ns,Vn,rr,qi=[0,0],Di=null;if(m)ns=He.glyphAtlasTexture,Vn=K.LINEAR,Ii=He.glyphAtlasTexture.size,ft.iconsInText&&(qi=He.imageAtlasTexture.size,Di=He.imageAtlasTexture,rr=Nn||b.options.rotating||b.options.zooming||Pt.kind==="composite"||Pt.kind==="camera"?K.LINEAR:K.NEAREST);else{const Qt=d.layout.get("icon-size").constantOr(0)!==1||ft.iconsNeedLinear;ns=He.imageAtlasTexture,Vn=et||b.options.rotating||b.options.zooming||Qt||Nn?K.LINEAR:K.NEAREST,Ii=He.imageAtlasTexture.size}const Wi=Zt(He,1,b.transform.zoom),Is=me?We.posMatrix:Ul,Xa=Ui(Is,ce,ae,b.transform,Wi),Iu=pr(Is,ce,ae,b.transform,Wi),Ka=pr(We.posMatrix,ce,ae,b.transform,Wi),Vr=re.translatePosition(b.transform,He,x,M),Du=Ve&&ft.hasTextData(),Nd=d.layout.get("icon-text-fit")!=="none"&&Du&&ft.hasIconData();if(he){const Qt=b.style.map.terrain?(Ja,Qa)=>b.style.map.terrain.getElevation(We,Ja,Qa):null,Jo=d.layout.get("text-rotation-alignment")==="map";Y(ft,We.posMatrix,b,m,Xa,Ka,ce,L,Jo,re,We.toUnwrapped(),Q.width,Q.height,Vr,Qt)}const Fr=We.posMatrix,$r=m&&Ve||Nd,po=he||$r?Ul:Xa,is=Iu,ki=et&&d.paint.get(m?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Oi;Oi=et?ft.iconsInText?ed(Pt.kind,Yt,ee,ce,he,$r,b,Fr,po,is,Vr,Ii,qi,nt):Fl(Pt.kind,Yt,ee,ce,he,$r,b,Fr,po,is,Vr,m,Ii,!0,nt):Jf(Pt.kind,Yt,ee,ce,he,$r,b,Fr,po,is,Vr,m,Ii,nt);const xr={program:Vt,buffers:Ot,uniformValues:Oi,atlasTexture:ns,atlasTextureIcon:Di,atlasInterpolation:Vn,atlasInterpolationIcon:rr,isSDF:et,hasHalo:ki};if(ge&&ft.canOverlap){ve=!0;const Qt=Ot.segments.get();for(const Jo of Qt)Ke.push({segments:new l.a0([Jo]),sortKey:Jo.sortKey,state:xr,terrainData:Bn})}else Ke.push({segments:Ot.segments,sortKey:0,state:xr,terrainData:Bn})}ve&&Ke.sort((We,He)=>We.sortKey-He.sortKey);for(const We of Ke){const He=We.state;if(W.activeTexture.set(K.TEXTURE0),He.atlasTexture.bind(He.atlasInterpolation,K.CLAMP_TO_EDGE),He.atlasTextureIcon&&(W.activeTexture.set(K.TEXTURE1),He.atlasTextureIcon&&He.atlasTextureIcon.bind(He.atlasInterpolationIcon,K.CLAMP_TO_EDGE)),He.isSDF){const ft=He.uniformValues;He.hasHalo&&(ft.u_is_halo=1,pd(He.buffers,We.segments,d,b,He.program,Oe,B,V,ft,We.terrainData)),ft.u_is_halo=0}pd(He.buffers,We.segments,d,b,He.program,Oe,B,V,He.uniformValues,We.terrainData)}}function pd(b,s,d,f,m,x,M,P,D,L){const B=f.context;m.draw(B,B.gl.TRIANGLES,x,M,P,Cn.disabled,D,L,d.id,b.layoutVertexBuffer,b.indexBuffer,s,d.paint,f.transform.zoom,b.programConfigurations.get(d.id),b.dynamicLayoutVertexBuffer,b.opacityVertexBuffer)}function fd(b,s,d,f){const m=b.context,x=m.gl,M=Dn.disabled,P=new Jn([x.ONE,x.ONE],l.aM.transparent,[!0,!0,!0,!0]),D=s.getBucket(d);if(!D)return;const L=f.key;let B=d.heatmapFbos.get(L);B||(B=Hl(m,s.tileSize,s.tileSize),d.heatmapFbos.set(L,B)),m.bindFramebuffer.set(B.framebuffer),m.viewport.set([0,0,s.tileSize,s.tileSize]),m.clear({color:l.aM.transparent});const V=D.programConfigurations.get(d.id),W=b.useProgram("heatmap",V),K=b.style.map.terrain.getTerrainData(f);W.draw(m,x.TRIANGLES,Ht.disabled,M,P,Cn.disabled,ir(f.posMatrix,s,b.transform.zoom,d.paint.get("heatmap-intensity")),K,d.id,D.layoutVertexBuffer,D.indexBuffer,D.segments,d.paint,b.transform.zoom,V)}function Zo(b,s,d){const f=b.context,m=f.gl;f.setColorMode(b.colorModeForRenderPass());const x=ql(f,s),M=d.key,P=s.heatmapFbos.get(M);P&&(f.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,P.colorAttachment.get()),f.activeTexture.set(m.TEXTURE1),x.bind(m.LINEAR,m.CLAMP_TO_EDGE),b.useProgram("heatmapTexture").draw(f,m.TRIANGLES,Ht.disabled,Dn.disabled,b.colorModeForRenderPass(),Cn.disabled,ru(b,s,0,1),null,s.id,b.rasterBoundsBuffer,b.quadTriangleIndexBuffer,b.rasterBoundsSegments,s.paint,b.transform.zoom),P.destroy(),s.heatmapFbos.delete(M))}function Hl(b,s,d){var f,m;const x=b.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=(f=b.HALF_FLOAT)!==null&&f!==void 0?f:x.UNSIGNED_BYTE,D=(m=b.RGBA16F)!==null&&m!==void 0?m:x.RGBA;x.texImage2D(x.TEXTURE_2D,0,D,s,d,0,x.RGBA,P,null);const L=b.createFramebuffer(s,d,!1,!1);return L.colorAttachment.set(M),L}function ql(b,s){return s.colorRampTexture||(s.colorRampTexture=new it(b,s.colorRamp,b.gl.RGBA)),s.colorRampTexture}function Ra(b,s,d,f,m){if(!d||!f||!f.imageAtlas)return;const x=f.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 D=m.getPaintProperty(s);M=x[D],P=x[D]}M&&P&&b.setConstantPatternPositions(M,P)}function Wl(b,s,d,f,m,x,M){const P=b.context.gl,D="fill-pattern",L=d.paint.get(D),B=L&&L.constantOr(1),V=d.getCrossfadeParameters();let W,K,Q,re,ae;M?(K=B&&!d.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",W=P.LINES):(K=B?"fillPattern":"fill",W=P.TRIANGLES);const ce=L.constantOr(null);for(const he of f){const ee=s.getTile(he);if(B&&!ee.patternsLoaded())continue;const me=ee.getBucket(d);if(!me)continue;const ge=me.programConfigurations.get(d.id),ve=b.useProgram(K,ge),Oe=b.style.map.terrain&&b.style.map.terrain.getTerrainData(he);B&&(b.context.activeTexture.set(P.TEXTURE0),ee.imageAtlasTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),ge.updatePaintBuffers(V)),Ra(ge,D,ce,ee,d);const Ve=Oe?he:null,Ke=b.translatePosMatrix(Ve?Ve.posMatrix:he.posMatrix,ee,d.paint.get("fill-translate"),d.paint.get("fill-translate-anchor"));if(M){re=me.indexBuffer2,ae=me.segments2;const nt=[P.drawingBufferWidth,P.drawingBufferHeight];Q=K==="fillOutlinePattern"&&B?Zf(Ke,b,V,ee,nt):K0(Ke,nt)}else re=me.indexBuffer,ae=me.segments,Q=B?Gf(Ke,b,V,ee):Ia(Ke);ve.draw(b.context,W,m,b.stencilModeForClipping(he),x,Cn.disabled,Q,Oe,d.id,me.layoutVertexBuffer,re,ae,d.paint,b.transform.zoom,ge)}}function pu(b,s,d,f,m,x,M){const P=b.context,D=P.gl,L="fill-extrusion-pattern",B=d.paint.get(L),V=B.constantOr(1),W=d.getCrossfadeParameters(),K=d.paint.get("fill-extrusion-opacity"),Q=B.constantOr(null);for(const re of f){const ae=s.getTile(re),ce=ae.getBucket(d);if(!ce)continue;const he=b.style.map.terrain&&b.style.map.terrain.getTerrainData(re),ee=ce.programConfigurations.get(d.id),me=b.useProgram(V?"fillExtrusionPattern":"fillExtrusion",ee);V&&(b.context.activeTexture.set(D.TEXTURE0),ae.imageAtlasTexture.bind(D.LINEAR,D.CLAMP_TO_EDGE),ee.updatePaintBuffers(W)),Ra(ee,L,Q,ae,d);const ge=b.translatePosMatrix(re.posMatrix,ae,d.paint.get("fill-extrusion-translate"),d.paint.get("fill-extrusion-translate-anchor")),ve=d.paint.get("fill-extrusion-vertical-gradient"),Oe=V?iu(ge,b,ve,K,re,W,ae):Bl(ge,b,ve,K);me.draw(P,P.gl.TRIANGLES,m,x,M,Cn.backCCW,Oe,he,d.id,ce.layoutVertexBuffer,ce.indexBuffer,ce.segments,d.paint,b.transform.zoom,ee,b.style.map.terrain&&ce.centroidVertexBuffer)}}function La(b,s,d,f,m,x,M){const P=b.context,D=P.gl,L=d.fbo;if(!L)return;const B=b.useProgram("hillshade"),V=b.style.map.terrain&&b.style.map.terrain.getTerrainData(s);P.activeTexture.set(D.TEXTURE0),D.bindTexture(D.TEXTURE_2D,L.colorAttachment.get()),B.draw(P,D.TRIANGLES,m,x,M,Cn.disabled,((W,K,Q,re)=>{const ae=Q.paint.get("hillshade-shadow-color"),ce=Q.paint.get("hillshade-highlight-color"),he=Q.paint.get("hillshade-accent-color");let ee=Q.paint.get("hillshade-illumination-direction")*(Math.PI/180);Q.paint.get("hillshade-illumination-anchor")==="viewport"&&(ee-=W.transform.angle);const me=!W.options.moving;return{u_matrix:re?re.posMatrix:W.transform.calculatePosMatrix(K.tileID.toUnwrapped(),me),u_image:0,u_latrange:su(0,K.tileID),u_light:[Q.paint.get("hillshade-exaggeration"),ee],u_shadow:ae,u_highlight:ce,u_accent:he}})(b,d,f,V?s:null),V,f.id,b.rasterBoundsBuffer,b.quadTriangleIndexBuffer,b.rasterBoundsSegments)}function Na(b,s,d,f,m,x){const M=b.context,P=M.gl,D=s.dem;if(D&&D.data){const L=D.dim,B=D.stride,V=D.getPixels();if(M.activeTexture.set(P.TEXTURE1),M.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||b.getTileTexture(B),s.demTexture){const K=s.demTexture;K.update(V,{premultiply:!1}),K.bind(P.NEAREST,P.CLAMP_TO_EDGE)}else s.demTexture=new it(M,V,P.RGBA,{premultiply:!1}),s.demTexture.bind(P.NEAREST,P.CLAMP_TO_EDGE);M.activeTexture.set(P.TEXTURE0);let W=s.fbo;if(!W){const K=new it(M,{width:L,height:L,data:null},P.RGBA);K.bind(P.LINEAR,P.CLAMP_TO_EDGE),W=s.fbo=M.createFramebuffer(L,L,!0,!1),W.colorAttachment.set(K.texture)}M.bindFramebuffer.set(W.framebuffer),M.viewport.set([0,0,L,L]),b.useProgram("hillshadePrepare").draw(M,P.TRIANGLES,f,m,x,Cn.disabled,((K,Q)=>{const re=Q.stride,ae=l.H();return l.aP(ae,0,l.X,-l.X,0,0,1),l.J(ae,ae,[0,-l.X,0]),{u_matrix:ae,u_image:1,u_dimension:[re,re],u_zoom:K.overscaledZ,u_unpack:Q.getUnpackVector()}})(s.tileID,D),null,d.id,b.rasterBoundsBuffer,b.quadTriangleIndexBuffer,b.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function hm(b,s,d,f,m,x){const M=f.paint.get("raster-fade-duration");if(!x&&M>0){const P=E.now(),D=(P-b.timeAdded)/M,L=s?(P-s.timeAdded)/M:-1,B=d.getSource(),V=m.coveringZoomLevel({tileSize:B.tileSize,roundZoom:B.roundZoom}),W=!s||Math.abs(s.tileID.overscaledZ-V)>Math.abs(b.tileID.overscaledZ-V),K=W&&b.refreshedUponExpiration?1:l.ac(W?D:1-L,0,1);return b.refreshedUponExpiration&&D>=1&&(b.refreshedUponExpiration=!1),s?{opacity:1,mix:1-K}:{opacity:K,mix:0}}return{opacity:1,mix:0}}const md=new l.aM(1,0,0,1),cn=new l.aM(0,1,0,1),fu=new l.aM(0,0,1,1),d_=new l.aM(1,0,1,1),dm=new l.aM(0,1,1,1);function Ba(b,s,d,f){mu(b,0,s+d/2,b.transform.width,d,f)}function pm(b,s,d,f){mu(b,s-d/2,0,d,b.transform.height,f)}function mu(b,s,d,f,m,x){const M=b.context,P=M.gl;P.enable(P.SCISSOR_TEST),P.scissor(s*b.pixelRatio,d*b.pixelRatio,f*b.pixelRatio,m*b.pixelRatio),M.clear({color:x}),P.disable(P.SCISSOR_TEST)}function fm(b,s,d){const f=b.context,m=f.gl,x=d.posMatrix,M=b.useProgram("debug"),P=Ht.disabled,D=Dn.disabled,L=b.colorModeForRenderPass(),B="$debug",V=b.style.map.terrain&&b.style.map.terrain.getTerrainData(d);f.activeTexture.set(m.TEXTURE0);const W=s.getTileByID(d.key).latestRawTileData,K=Math.floor((W&&W.byteLength||0)/1024),Q=s.getTile(d).tileSize,re=512/Math.min(Q,512)*(d.overscaledZ/b.transform.zoom)*.5;let ae=d.canonical.toString();d.overscaledZ!==d.canonical.z&&(ae+=` => ${d.overscaledZ}`),function(ce,he){ce.initDebugOverlayCanvas();const ee=ce.debugOverlayCanvas,me=ce.context.gl,ge=ce.debugOverlayCanvas.getContext("2d");ge.clearRect(0,0,ee.width,ee.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(ee),ce.debugOverlayTexture.bind(me.LINEAR,me.CLAMP_TO_EDGE)}(b,`${ae} ${K}kB`),M.draw(f,m.TRIANGLES,P,D,Jn.alphaBlended,Cn.disabled,Vl(x,l.aM.transparent,re),null,B,b.debugBuffer,b.quadTriangleIndexBuffer,b.debugSegments),M.draw(f,m.LINE_STRIP,P,D,L,Cn.disabled,Vl(x,l.aM.red),V,B,b.debugBuffer,b.tileBorderIndexBuffer,b.debugSegments)}function mm(b,s,d){const f=b.context,m=f.gl,x=b.colorModeForRenderPass(),M=new Ht(m.LEQUAL,Ht.ReadWrite,b.depthRangeFor3D),P=b.useProgram("terrain"),D=s.getTerrainMesh();f.bindFramebuffer.set(null),f.viewport.set([0,0,b.width,b.height]);for(const L of d){const B=b.renderToTexture.getTexture(L),V=s.getTerrainData(L.tileID);f.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,B.texture);const W=b.transform.calculatePosMatrix(L.tileID.toUnwrapped()),K=s.getMeshFrameDelta(b.transform.zoom),Q=b.transform.calculateFogMatrix(L.tileID.toUnwrapped()),re=Jh(W,K,Q,b.style.sky,b.transform.pitch);P.draw(f,m.TRIANGLES,M,Dn.disabled,x,Cn.backCCW,re,V,"terrain",D.vertexBuffer,D.indexBuffer,D.segments)}}class gu{constructor(s,d,f){this.vertexBuffer=s,this.indexBuffer=d,this.segments=f}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class yu{constructor(s,d){this.context=new h_(s),this.transform=d,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Re.maxUnderzooming+Re.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Xh}resize(s,d,f){if(this.width=Math.floor(s*f),this.height=Math.floor(d*f),this.pixelRatio=f,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const m of this.style._order)this.style._layers[m].resize()}setup(){const s=this.context,d=new l.aX;d.emplaceBack(0,0),d.emplaceBack(l.X,0),d.emplaceBack(0,l.X),d.emplaceBack(l.X,l.X),this.tileExtentBuffer=s.createVertexBuffer(d,$o.members),this.tileExtentSegments=l.a0.simpleSegment(0,0,4,2);const f=new l.aX;f.emplaceBack(0,0),f.emplaceBack(l.X,0),f.emplaceBack(0,l.X),f.emplaceBack(l.X,l.X),this.debugBuffer=s.createVertexBuffer(f,$o.members),this.debugSegments=l.a0.simpleSegment(0,0,4,5);const m=new l.$;m.emplaceBack(0,0,0,0),m.emplaceBack(l.X,0,l.X,0),m.emplaceBack(0,l.X,0,l.X),m.emplaceBack(l.X,l.X,l.X,l.X),this.rasterBoundsBuffer=s.createVertexBuffer(m,tr.members),this.rasterBoundsSegments=l.a0.simpleSegment(0,0,4,2);const x=new l.aX;x.emplaceBack(0,0),x.emplaceBack(1,0),x.emplaceBack(0,1),x.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(x,$o.members),this.viewportSegments=l.a0.simpleSegment(0,0,4,2);const M=new l.aZ;M.emplaceBack(0),M.emplaceBack(1),M.emplaceBack(3),M.emplaceBack(2),M.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(M);const P=new l.aY;P.emplaceBack(0,1,2),P.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(P);const D=this.context.gl;this.stencilClearMode=new Dn({func:D.ALWAYS,mask:0},0,255,D.ZERO,D.ZERO,D.ZERO)}clearStencil(){const s=this.context,d=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const f=l.H();l.aP(f,0,this.width,this.height,0,0,1),l.K(f,f,[d.drawingBufferWidth,d.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,d.TRIANGLES,Ht.disabled,this.stencilClearMode,Jn.disabled,Cn.disabled,nr(f),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(s,d){if(this.currentStencilSource===s.source||!s.isTileClipped()||!d||!d.length)return;this.currentStencilSource=s.source;const f=this.context,m=f.gl;this.nextStencilID+d.length>256&&this.clearStencil(),f.setColorMode(Jn.disabled),f.setDepthMode(Ht.disabled);const x=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const M of d){const P=this._tileClippingMaskIDs[M.key]=this.nextStencilID++,D=this.style.map.terrain&&this.style.map.terrain.getTerrainData(M);x.draw(f,m.TRIANGLES,Ht.disabled,new Dn({func:m.ALWAYS,mask:0},P,255,m.KEEP,m.KEEP,m.REPLACE),Jn.disabled,Cn.disabled,nr(M.posMatrix),D,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,d=this.context.gl;return new Dn({func:d.NOTEQUAL,mask:255},s,255,d.KEEP,d.KEEP,d.REPLACE)}stencilModeForClipping(s){const d=this.context.gl;return new Dn({func:d.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,d.KEEP,d.KEEP,d.REPLACE)}stencilConfigForOverlap(s){const d=this.context.gl,f=s.sort((M,P)=>P.overscaledZ-M.overscaledZ),m=f[f.length-1].overscaledZ,x=f[0].overscaledZ-m+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+m]=new Dn({func:d.GEQUAL,mask:255},P+this.nextStencilID,255,d.KEEP,d.KEEP,d.REPLACE);return this.nextStencilID+=x,[M,f]}return[{[m]:Dn.disabled},f]}colorModeForRenderPass(){const s=this.context.gl;return this._showOverdrawInspector?new Jn([s.CONSTANT_COLOR,s.ONE],new l.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Jn.unblended:Jn.alphaBlended}depthModeForSublayer(s,d,f){if(!this.opaquePassEnabledForLayer())return Ht.disabled;const m=1-((1+this.currentLayer)*this.numSublayers+s)*this.depthEpsilon;return new Ht(f||this.context.gl.LEQUAL,d,[m,m])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(s,d){this.style=s,this.options=d,this.lineAtlas=s.lineAtlas,this.imageManager=s.imageManager,this.glyphManager=s.glyphManager,this.symbolFadeChange=s.placement.symbolFadeChange(E.now()),this.imageManager.beginFrame();const f=this.style._order,m=this.style.sourceCaches,x={},M={},P={};for(const D in m){const L=m[D];L.used&&L.prepare(this.context),x[D]=L.getVisibleCoordinates(),M[D]=x[D].slice().reverse(),P[D]=L.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let D=0;D<f.length;D++)if(this.style._layers[f[D]].is3D()){this.opaquePassCutoff=D;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const D of f){const L=this.style._layers[D];if(!L.hasOffscreenPass()||L.isHidden(this.transform.zoom))continue;const B=M[L.source];(L.type==="custom"||B.length)&&this.renderLayer(this,m[L.source],L,B)}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(D,L){const B=D.context,V=B.gl,W=((ce,he,ee)=>({u_sky_color:ce.properties.get("sky-color"),u_horizon_color:ce.properties.get("horizon-color"),u_horizon:(he.height/2+he.getHorizon())*ee,u_sky_horizon_blend:ce.properties.get("sky-horizon-blend")*he.height/2*ee}))(L,D.style.map.transform,D.pixelRatio),K=new Ht(V.LEQUAL,Ht.ReadWrite,[0,1]),Q=Dn.disabled,re=D.colorModeForRenderPass(),ae=D.useProgram("sky");if(!L.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),L.mesh=new gu(B.createVertexBuffer(ce,$o.members),B.createIndexBuffer(he),l.a0.simpleSegment(0,0,ce.length,he.length))}ae.draw(B,V.TRIANGLES,K,Q,re,Cn.disabled,W,void 0,"sky",L.mesh.vertexBuffer,L.mesh.indexBuffer,L.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=d.showOverdrawInspector,this.depthRangeFor3D=[0,1-(s._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=f.length-1;this.currentLayer>=0;this.currentLayer--){const D=this.style._layers[f[this.currentLayer]],L=m[D.source],B=x[D.source];this._renderTileClippingMasks(D,B),this.renderLayer(this,L,D,B)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<f.length;this.currentLayer++){const D=this.style._layers[f[this.currentLayer]],L=m[D.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(D))continue;const B=(D.type==="symbol"?P:M)[D.source];this._renderTileClippingMasks(D,x[D.source]),this.renderLayer(this,L,D,B)}if(this.options.showTileBoundaries){const D=function(L,B){let V=null;const W=Object.values(L._layers).flatMap(ae=>ae.source&&!ae.isHidden(B)?[L.sourceCaches[ae.source]]:[]),K=W.filter(ae=>ae.getSource().type==="vector"),Q=W.filter(ae=>ae.getSource().type!=="vector"),re=ae=>{(!V||V.getSource().maxzoom<ae.getSource().maxzoom)&&(V=ae)};return K.forEach(ae=>re(ae)),V||Q.forEach(ae=>re(ae)),V}(this.style,this.transform.zoom);D&&function(L,B,V){for(let W=0;W<V.length;W++)fm(L,B,V[W])}(this,D,D.getVisibleCoordinates())}this.options.showPadding&&function(D){const L=D.transform.padding;Ba(D,D.transform.height-(L.top||0),3,md),Ba(D,L.bottom||0,3,cn),pm(D,L.left||0,3,fu),pm(D,D.transform.width-(L.right||0),3,d_);const B=D.transform.centerPoint;(function(V,W,K,Q){mu(V,W-1,K-10,2,20,Q),mu(V,W-10,K-1,20,2,Q)})(D,B.x,D.transform.height-B.y,dm)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(s){if(!this.style||!this.style.map||!this.style.map.terrain)return;const d=this.terrainFacilitator.matrix,f=this.transform.modelViewProjectionMatrix;let m=this.terrainFacilitator.dirty;m||(m=s?!l.a_(d,f):!l.a$(d,f)),m||(m=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),m&&(l.b0(d,f),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(x,M){const P=x.context,D=P.gl,L=Jn.unblended,B=new Ht(D.LEQUAL,Ht.ReadWrite,[0,1]),V=M.getTerrainMesh(),W=M.sourceCache.getRenderableTiles(),K=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 Q of W){const re=M.getTerrainData(Q.tileID),ae={u_matrix:x.transform.calculatePosMatrix(Q.tileID.toUnwrapped()),u_ele_delta:M.getMeshFrameDelta(x.transform.zoom)};K.draw(P,D.TRIANGLES,B,Dn.disabled,L,Cn.backCCW,ae,re,"terrain",V.vertexBuffer,V.indexBuffer,V.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,D=P.gl,L=Jn.unblended,B=new Ht(D.LEQUAL,Ht.ReadWrite,[0,1]),V=M.getTerrainMesh(),W=M.getCoordsTexture(),K=M.sourceCache.getRenderableTiles(),Q=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 K){const ae=M.getTerrainData(re.tileID);P.activeTexture.set(D.TEXTURE0),D.bindTexture(D.TEXTURE_2D,W.texture);const ce={u_matrix:x.transform.calculatePosMatrix(re.tileID.toUnwrapped()),u_terrain_coords_id:(255-M.coordsIndex.length)/255,u_texture:0,u_ele_delta:M.getMeshFrameDelta(x.transform.zoom)};Q.draw(P,D.TRIANGLES,B,Dn.disabled,L,Cn.backCCW,ce,ae,"terrain",V.vertexBuffer,V.indexBuffer,V.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(s,d,f,m){if(!f.isHidden(this.transform.zoom)&&(f.type==="background"||f.type==="custom"||(m||[]).length))switch(this.id=f.id,f.type){case"symbol":(function(x,M,P,D,L){if(x.renderPass!=="translucent")return;const B=Dn.disabled,V=x.colorModeForRenderPass();(P._unevaluatedLayout.hasValue("text-variable-anchor")||P._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(W,K,Q,re,ae,ce,he,ee,me){const ge=K.transform,ve=Fo(),Oe=ae==="map",Ve=ce==="map";for(const Ke of W){const nt=re.getTile(Ke),We=nt.getBucket(Q);if(!We||!We.text||!We.text.segments.get().length)continue;const He=l.ag(We.textSizeData,ge.zoom),ft=Zt(nt,1,K.transform.zoom),Ot=Ui(Ke.posMatrix,Ve,Oe,K.transform,ft),Ge=Q.layout.get("icon-text-fit")!=="none"&&We.hasIconData();if(He){const et=Math.pow(2,ge.zoom-nt.tileID.overscaledZ),Pt=K.style.map.terrain?(Vt,Yt)=>K.style.map.terrain.getElevation(Ke,Vt,Yt):null,Nn=ve.translatePosition(ge,nt,he,ee);za(We,Oe,Ve,me,ge,Ot,Ke.posMatrix,et,He,Ge,ve,Nn,Ke.toUnwrapped(),Pt)}}}(D,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"),L),P.paint.get("icon-opacity").constantOr(1)!==0&&dd(x,M,P,D,!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"),B,V),P.paint.get("text-opacity").constantOr(1)!==0&&dd(x,M,P,D,!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"),B,V),M.map.showCollisionBoxes&&(jl(x,M,P,D,!0),jl(x,M,P,D,!1))})(s,d,f,m,this.style.placement.variableOffsets);break;case"circle":(function(x,M,P,D){if(x.renderPass!=="translucent")return;const L=P.paint.get("circle-opacity"),B=P.paint.get("circle-stroke-width"),V=P.paint.get("circle-stroke-opacity"),W=!P.layout.get("circle-sort-key").isConstant();if(L.constantOr(1)===0&&(B.constantOr(1)===0||V.constantOr(1)===0))return;const K=x.context,Q=K.gl,re=x.depthModeForSublayer(0,Ht.ReadOnly),ae=Dn.disabled,ce=x.colorModeForRenderPass(),he=[];for(let ee=0;ee<D.length;ee++){const me=D[ee],ge=M.getTile(me),ve=ge.getBucket(P);if(!ve)continue;const Oe=ve.programConfigurations.get(P.id),Ve=x.useProgram("circle",Oe),Ke=ve.layoutVertexBuffer,nt=ve.indexBuffer,We=x.style.map.terrain&&x.style.map.terrain.getTerrainData(me),He={programConfiguration:Oe,program:Ve,layoutVertexBuffer:Ke,indexBuffer:nt,uniformValues:J0(x,me,ge,P),terrainData:We};if(W){const ft=ve.segments.get();for(const Ot of ft)he.push({segments:new l.a0([Ot]),sortKey:Ot.sortKey,state:He})}else he.push({segments:ve.segments,sortKey:0,state:He})}W&&he.sort((ee,me)=>ee.sortKey-me.sortKey);for(const ee of he){const{programConfiguration:me,program:ge,layoutVertexBuffer:ve,indexBuffer:Oe,uniformValues:Ve,terrainData:Ke}=ee.state;ge.draw(K,Q.TRIANGLES,re,ae,ce,Cn.disabled,Ve,Ke,P.id,ve,Oe,ee.segments,P.paint,x.transform.zoom,me)}})(s,d,f,m);break;case"heatmap":(function(x,M,P,D){if(P.paint.get("heatmap-opacity")===0)return;const L=x.context;if(x.style.map.terrain){for(const B of D){const V=M.getTile(B);M.hasRenderableParent(B)||(x.renderPass==="offscreen"?fd(x,V,P,B):x.renderPass==="translucent"&&Zo(x,P,B))}L.viewport.set([0,0,x.width,x.height])}else x.renderPass==="offscreen"?function(B,V,W,K){const Q=B.context,re=Q.gl,ae=Dn.disabled,ce=new Jn([re.ONE,re.ONE],l.aM.transparent,[!0,!0,!0,!0]);(function(he,ee,me){const ge=he.gl;he.activeTexture.set(ge.TEXTURE1),he.viewport.set([0,0,ee.width/4,ee.height/4]);let ve=me.heatmapFbos.get(l.aU);ve?(ge.bindTexture(ge.TEXTURE_2D,ve.colorAttachment.get()),he.bindFramebuffer.set(ve.framebuffer)):(ve=Hl(he,ee.width/4,ee.height/4),me.heatmapFbos.set(l.aU,ve))})(Q,B,W),Q.clear({color:l.aM.transparent});for(let he=0;he<K.length;he++){const ee=K[he];if(V.hasRenderableParent(ee))continue;const me=V.getTile(ee),ge=me.getBucket(W);if(!ge)continue;const ve=ge.programConfigurations.get(W.id),Oe=B.useProgram("heatmap",ve),{zoom:Ve}=B.transform;Oe.draw(Q,re.TRIANGLES,Ht.disabled,ae,ce,Cn.disabled,ir(ee.posMatrix,me,Ve,W.paint.get("heatmap-intensity")),null,W.id,ge.layoutVertexBuffer,ge.indexBuffer,ge.segments,W.paint,B.transform.zoom,ve)}Q.viewport.set([0,0,B.width,B.height])}(x,M,P,D):x.renderPass==="translucent"&&function(B,V){const W=B.context,K=W.gl;W.setColorMode(B.colorModeForRenderPass());const Q=V.heatmapFbos.get(l.aU);Q&&(W.activeTexture.set(K.TEXTURE0),K.bindTexture(K.TEXTURE_2D,Q.colorAttachment.get()),W.activeTexture.set(K.TEXTURE1),ql(W,V).bind(K.LINEAR,K.CLAMP_TO_EDGE),B.useProgram("heatmapTexture").draw(W,K.TRIANGLES,Ht.disabled,Dn.disabled,B.colorModeForRenderPass(),Cn.disabled,ru(B,V,0,1),null,V.id,B.viewportBuffer,B.quadTriangleIndexBuffer,B.viewportSegments,V.paint,B.transform.zoom))}(x,P)})(s,d,f,m);break;case"line":(function(x,M,P,D){if(x.renderPass!=="translucent")return;const L=P.paint.get("line-opacity"),B=P.paint.get("line-width");if(L.constantOr(1)===0||B.constantOr(1)===0)return;const V=x.depthModeForSublayer(0,Ht.ReadOnly),W=x.colorModeForRenderPass(),K=P.paint.get("line-dasharray"),Q=P.paint.get("line-pattern"),re=Q.constantOr(1),ae=P.paint.get("line-gradient"),ce=P.getCrossfadeParameters(),he=re?"linePattern":K?"lineSDF":ae?"lineGradient":"line",ee=x.context,me=ee.gl;let ge=!0;for(const ve of D){const Oe=M.getTile(ve);if(re&&!Oe.patternsLoaded())continue;const Ve=Oe.getBucket(P);if(!Ve)continue;const Ke=Ve.programConfigurations.get(P.id),nt=x.context.program.get(),We=x.useProgram(he,Ke),He=ge||We.program!==nt,ft=x.style.map.terrain&&x.style.map.terrain.getTerrainData(ve),Ot=Q.constantOr(null);if(Ot&&Oe.imageAtlas){const Pt=Oe.imageAtlas,Nn=Pt.patternPositions[Ot.to.toString()],Vt=Pt.patternPositions[Ot.from.toString()];Nn&&Vt&&Ke.setConstantPatternPositions(Nn,Vt)}const Ge=ft?ve:null,et=re?Da(x,Oe,P,ce,Ge):K?Q0(x,Oe,P,K,ce,Ge):ae?Yf(x,Oe,P,Ve.lineClipsArray.length,Ge):ou(x,Oe,P,Ge);if(re)ee.activeTexture.set(me.TEXTURE0),Oe.imageAtlasTexture.bind(me.LINEAR,me.CLAMP_TO_EDGE),Ke.updatePaintBuffers(ce);else if(K&&(He||x.lineAtlas.dirty))ee.activeTexture.set(me.TEXTURE0),x.lineAtlas.bind(ee);else if(ae){const Pt=Ve.gradients[P.id];let Nn=Pt.texture;if(P.gradientVersion!==Pt.version){let Vt=256;if(P.stepInterpolant){const Yt=M.getSource().maxzoom,Bn=ve.canonical.z===Yt?Math.ceil(1<<x.transform.maxZoom-ve.canonical.z):1;Vt=l.ac(l.aV(Ve.maxLineLength/l.X*1024*Bn),256,ee.maxTextureSize)}Pt.gradient=l.aW({expression:P.gradientExpression(),evaluationKey:"lineProgress",resolution:Vt,image:Pt.gradient||void 0,clips:Ve.lineClipsArray}),Pt.texture?Pt.texture.update(Pt.gradient):Pt.texture=new it(ee,Pt.gradient,me.RGBA),Pt.version=P.gradientVersion,Nn=Pt.texture}ee.activeTexture.set(me.TEXTURE0),Nn.bind(P.stepInterpolant?me.NEAREST:me.LINEAR,me.CLAMP_TO_EDGE)}We.draw(ee,me.TRIANGLES,V,x.stencilModeForClipping(ve),W,Cn.disabled,et,ft,P.id,Ve.layoutVertexBuffer,Ve.indexBuffer,Ve.segments,P.paint,x.transform.zoom,Ke,Ve.layoutVertexBuffer2),ge=!1}})(s,d,f,m);break;case"fill":(function(x,M,P,D){const L=P.paint.get("fill-color"),B=P.paint.get("fill-opacity");if(B.constantOr(1)===0)return;const V=x.colorModeForRenderPass(),W=P.paint.get("fill-pattern"),K=x.opaquePassEnabledForLayer()&&!W.constantOr(1)&&L.constantOr(l.aM.transparent).a===1&&B.constantOr(0)===1?"opaque":"translucent";if(x.renderPass===K){const Q=x.depthModeForSublayer(1,x.renderPass==="opaque"?Ht.ReadWrite:Ht.ReadOnly);Wl(x,M,P,D,Q,V,!1)}if(x.renderPass==="translucent"&&P.paint.get("fill-antialias")){const Q=x.depthModeForSublayer(P.getPaintProperty("fill-outline-color")?2:0,Ht.ReadOnly);Wl(x,M,P,D,Q,V,!0)}})(s,d,f,m);break;case"fill-extrusion":(function(x,M,P,D){const L=P.paint.get("fill-extrusion-opacity");if(L!==0&&x.renderPass==="translucent"){const B=new Ht(x.context.gl.LEQUAL,Ht.ReadWrite,x.depthRangeFor3D);if(L!==1||P.paint.get("fill-extrusion-pattern").constantOr(1))pu(x,M,P,D,B,Dn.disabled,Jn.disabled),pu(x,M,P,D,B,x.stencilModeFor3D(),x.colorModeForRenderPass());else{const V=x.colorModeForRenderPass();pu(x,M,P,D,B,Dn.disabled,V)}}})(s,d,f,m);break;case"hillshade":(function(x,M,P,D){if(x.renderPass!=="offscreen"&&x.renderPass!=="translucent")return;const L=x.context,B=x.depthModeForSublayer(0,Ht.ReadOnly),V=x.colorModeForRenderPass(),[W,K]=x.renderPass==="translucent"?x.stencilConfigForOverlap(D):[{},D];for(const Q of K){const re=M.getTile(Q);re.needsHillshadePrepare!==void 0&&re.needsHillshadePrepare&&x.renderPass==="offscreen"?Na(x,re,P,B,Dn.disabled,V):x.renderPass==="translucent"&&La(x,Q,re,P,B,W[Q.overscaledZ],V)}L.viewport.set([0,0,x.width,x.height])})(s,d,f,m);break;case"raster":(function(x,M,P,D){if(x.renderPass!=="translucent"||P.paint.get("raster-opacity")===0||!D.length)return;const L=x.context,B=L.gl,V=M.getSource(),W=x.useProgram("raster"),K=x.colorModeForRenderPass(),[Q,re]=V instanceof xi?[{},D]:x.stencilConfigForOverlap(D),ae=re[re.length-1].overscaledZ,ce=!x.options.moving;for(const he of re){const ee=x.depthModeForSublayer(he.overscaledZ-ae,P.paint.get("raster-opacity")===1?Ht.ReadWrite:Ht.ReadOnly,B.LESS),me=M.getTile(he);me.registerFadeDuration(P.paint.get("raster-fade-duration"));const ge=M.findLoadedParent(he,0),ve=M.findLoadedSibling(he),Oe=hm(me,ge||ve||null,M,P,x.transform,x.style.map.terrain);let Ve,Ke;const nt=P.paint.get("raster-resampling")==="nearest"?B.NEAREST:B.LINEAR;L.activeTexture.set(B.TEXTURE0),me.texture.bind(nt,B.CLAMP_TO_EDGE,B.LINEAR_MIPMAP_NEAREST),L.activeTexture.set(B.TEXTURE1),ge?(ge.texture.bind(nt,B.CLAMP_TO_EDGE,B.LINEAR_MIPMAP_NEAREST),Ve=Math.pow(2,ge.tileID.overscaledZ-me.tileID.overscaledZ),Ke=[me.tileID.canonical.x*Ve%1,me.tileID.canonical.y*Ve%1]):me.texture.bind(nt,B.CLAMP_TO_EDGE,B.LINEAR_MIPMAP_NEAREST),me.texture.useMipmap&&L.extTextureFilterAnisotropic&&x.transform.pitch>20&&B.texParameterf(B.TEXTURE_2D,L.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,L.extTextureFilterAnisotropicMax);const We=x.style.map.terrain&&x.style.map.terrain.getTerrainData(he),He=We?he:null,ft=He?He.posMatrix:x.transform.calculatePosMatrix(he.toUnwrapped(),ce),Ot=e_(ft,Ke||[0,0],Ve||1,Oe,P);V instanceof xi?W.draw(L,B.TRIANGLES,ee,Dn.disabled,K,Cn.disabled,Ot,We,P.id,V.boundsBuffer,x.quadTriangleIndexBuffer,V.boundsSegments):W.draw(L,B.TRIANGLES,ee,Q[he.overscaledZ],K,Cn.disabled,Ot,We,P.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments)}})(s,d,f,m);break;case"background":(function(x,M,P,D){const L=P.paint.get("background-color"),B=P.paint.get("background-opacity");if(B===0)return;const V=x.context,W=V.gl,K=x.transform,Q=K.tileSize,re=P.paint.get("background-pattern");if(x.isPatternMissing(re))return;const ae=!re&&L.a===1&&B===1&&x.opaquePassEnabledForLayer()?"opaque":"translucent";if(x.renderPass!==ae)return;const ce=Dn.disabled,he=x.depthModeForSublayer(0,ae==="opaque"?Ht.ReadWrite:Ht.ReadOnly),ee=x.colorModeForRenderPass(),me=x.useProgram(re?"backgroundPattern":"background"),ge=D||K.coveringTiles({tileSize:Q,terrain:x.style.map.terrain});re&&(V.activeTexture.set(W.TEXTURE0),x.imageManager.bind(x.context));const ve=P.getCrossfadeParameters();for(const Oe of ge){const Ve=D?Oe.posMatrix:x.transform.calculatePosMatrix(Oe.toUnwrapped()),Ke=re?td(Ve,B,x,re,{tileID:Oe,tileSize:Q},ve):au(Ve,B,L),nt=x.style.map.terrain&&x.style.map.terrain.getTerrainData(Oe);me.draw(V,W.TRIANGLES,he,ce,ee,Cn.disabled,Ke,nt,P.id,x.tileExtentBuffer,x.quadTriangleIndexBuffer,x.tileExtentSegments)}})(s,0,f,m);break;case"custom":(function(x,M,P){const D=x.context,L=P.implementation;if(x.renderPass==="offscreen"){const B=L.prerender;B&&(x.setCustomLayerDefaults(),D.setColorMode(x.colorModeForRenderPass()),B.call(L,D.gl,x.transform.customLayerMatrix()),D.setDirty(),x.setBaseState())}else if(x.renderPass==="translucent"){x.setCustomLayerDefaults(),D.setColorMode(x.colorModeForRenderPass()),D.setStencilMode(Dn.disabled);const B=L.renderingMode==="3d"?new Ht(x.context.gl.LEQUAL,Ht.ReadWrite,x.depthRangeFor3D):x.depthModeForSublayer(0,Ht.ReadOnly);D.setDepthMode(B),L.render(D.gl,x.transform.customLayerMatrix(),{farZ:x.transform.farZ,nearZ:x.transform.nearZ,fov:x.transform._fov,modelViewProjectionMatrix:x.transform.modelViewProjectionMatrix,projectionMatrix:x.transform.projectionMatrix}),D.setDirty(),x.setBaseState(),D.bindFramebuffer.set(null)}})(s,0,f)}}translatePosMatrix(s,d,f,m,x){if(!f[0]&&!f[1])return s;const M=x?m==="map"?this.transform.angle:0:m==="viewport"?-this.transform.angle:0;if(M){const L=Math.sin(M),B=Math.cos(M);f=[f[0]*B-f[1]*L,f[0]*L+f[1]*B]}const P=[x?f[0]:Zt(d,f[0],this.transform.zoom),x?f[1]:Zt(d,f[1],this.transform.zoom),0],D=new Float32Array(16);return l.J(D,s,P),D}saveTileTexture(s){const d=this._tileTextures[s.size[0]];d?d.push(s):this._tileTextures[s.size[0]]=[s]}getTileTexture(s){const d=this._tileTextures[s];return d&&d.length>0?d.pop():null}isPatternMissing(s){if(!s)return!1;if(!s.from||!s.to)return!0;const d=this.imageManager.getPattern(s.from.toString()),f=this.imageManager.getPattern(s.to.toString());return!d||!f}useProgram(s,d){this.cache=this.cache||{};const f=s+(d?d.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[f]||(this.cache[f]=new Qh(this.context,uo[s],d,nd[s],this._showOverdrawInspector,this.style.map.terrain)),this.cache[f]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const s=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(s.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new it(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:s,drawingBufferHeight:d}=this.context.gl;return this.width!==s||this.height!==d}}class Va{constructor(s,d){this.points=s,this.planes=d}static fromInvProjectionMatrix(s,d,f){const m=Math.pow(2,f),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 D=1/(P=l.af([],P,s))[3]/d*m;return l.b1(P,P,[D,D,1/P[3],D])}),M=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(P=>{const D=function(W,K){var Q=K[0],re=K[1],ae=K[2],ce=Q*Q+re*re+ae*ae;return ce>0&&(ce=1/Math.sqrt(ce)),W[0]=K[0]*ce,W[1]=K[1]*ce,W[2]=K[2]*ce,W}([],function(W,K,Q){var re=K[0],ae=K[1],ce=K[2],he=Q[0],ee=Q[1],me=Q[2];return W[0]=ae*me-ce*ee,W[1]=ce*he-re*me,W[2]=re*ee-ae*he,W}([],Ae([],x[P[0]],x[P[1]]),Ae([],x[P[2]],x[P[1]]))),L=-((B=D)[0]*(V=x[P[1]])[0]+B[1]*V[1]+B[2]*V[2]);var B,V;return D.concat(L)});return new Va(x,M)}}class Fa{constructor(s,d){this.min=s,this.max=d,this.center=function(f,m,x){return f[0]=.5*m[0],f[1]=.5*m[1],f[2]=.5*m[2],f}([],function(f,m,x){return f[0]=m[0]+x[0],f[1]=m[1]+x[1],f[2]=m[2]+x[2],f}([],this.min,this.max))}quadrant(s){const d=[s%2==0,s<2],f=Ee(this.min),m=Ee(this.max);for(let x=0;x<d.length;x++)f[x]=d[x]?this.min[x]:this.center[x],m[x]=d[x]?this.center[x]:this.max[x];return m[2]=this.max[2],new Fa(f,m)}distanceX(s){return Math.max(Math.min(this.max[0],s[0]),this.min[0])-s[0]}distanceY(s){return Math.max(Math.min(this.max[1],s[1]),this.min[1])-s[1]}intersects(s){const d=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let f=!0;for(let m=0;m<s.planes.length;m++){const x=s.planes[m];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&&(f=!1)}if(f)return 2;for(let m=0;m<3;m++){let x=Number.MAX_VALUE,M=-Number.MAX_VALUE;for(let P=0;P<s.points.length;P++){const D=s.points[P][m]-this.min[m];x=Math.min(x,D),M=Math.max(M,D)}if(M<0||x>this.max[m]-this.min[m])return 0}return 1}}class $a{constructor(s=0,d=0,f=0,m=0){if(isNaN(s)||s<0||isNaN(d)||d<0||isNaN(f)||f<0||isNaN(m)||m<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=d,this.left=f,this.right=m}interpolate(s,d,f){return d.top!=null&&s.top!=null&&(this.top=l.y.number(s.top,d.top,f)),d.bottom!=null&&s.bottom!=null&&(this.bottom=l.y.number(s.bottom,d.bottom,f)),d.left!=null&&s.left!=null&&(this.left=l.y.number(s.left,d.left,f)),d.right!=null&&s.right!=null&&(this.right=l.y.number(s.right,d.right,f)),this}getCenter(s,d){const f=l.ac((this.left+s-this.right)/2,0,s),m=l.ac((this.top+d-this.bottom)/2,0,d);return new l.P(f,m)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new $a(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const gd=85.051129;class ja{constructor(s,d,f,m,x){this.tileSize=512,this._renderWorldCopies=x===void 0||!!x,this._minZoom=s||0,this._maxZoom=d||22,this._minPitch=f??0,this._maxPitch=m??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new l.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new $a,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const s=new ja(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return s.apply(this),s}apply(s){this.tileSize=s.tileSize,this.latRange=s.latRange,this.lngRange=s.lngRange,this.width=s.width,this.height=s.height,this._center=s._center,this._elevation=s._elevation,this.minElevationForCurrentTile=s.minElevationForCurrentTile,this.zoom=s.zoom,this.angle=s.angle,this._fov=s._fov,this._pitch=s._pitch,this._unmodified=s._unmodified,this._edgeInsets=s._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(s){this._minZoom!==s&&(this._minZoom=s,this.zoom=Math.max(this.zoom,s))}get maxZoom(){return this._maxZoom}set maxZoom(s){this._maxZoom!==s&&(this._maxZoom=s,this.zoom=Math.min(this.zoom,s))}get minPitch(){return this._minPitch}set minPitch(s){this._minPitch!==s&&(this._minPitch=s,this.pitch=Math.max(this.pitch,s))}get maxPitch(){return this._maxPitch}set maxPitch(s){this._maxPitch!==s&&(this._maxPitch=s,this.pitch=Math.min(this.pitch,s))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(s){s===void 0?s=!0:s===null&&(s=!1),this._renderWorldCopies=s}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(s){const d=-l.b3(s,-180,180)*Math.PI/180;this.angle!==d&&(this._unmodified=!1,this.angle=d,this._calcMatrices(),this.rotationMatrix=function(){var f=new l.A(4);return l.A!=Float32Array&&(f[1]=0,f[2]=0),f[0]=1,f[3]=1,f}(),function(f,m,x){var M=m[0],P=m[1],D=m[2],L=m[3],B=Math.sin(x),V=Math.cos(x);f[0]=M*V+D*B,f[1]=P*V+L*B,f[2]=M*-B+D*V,f[3]=P*-B+L*V}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const d=l.ac(s,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==d&&(this._unmodified=!1,this._pitch=d,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(s){s=Math.max(.01,Math.min(60,s)),this._fov!==s&&(this._unmodified=!1,this._fov=s/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(s){const d=Math.min(Math.max(s,this.minZoom),this.maxZoom);this._zoom!==d&&(this._unmodified=!1,this._zoom=d,this.tileZoom=Math.max(0,Math.floor(d)),this.scale=this.zoomScale(d),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(s){s.lat===this._center.lat&&s.lng===this._center.lng||(this._unmodified=!1,this._center=s,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(s){s!==this._elevation&&(this._elevation=s,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(s){this._edgeInsets.equals(s)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,s,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(s){return this._edgeInsets.equals(s)}interpolatePadding(s,d,f){this._unmodified=!1,this._edgeInsets.interpolate(s,d,f),this._constrain(),this._calcMatrices()}coveringZoomLevel(s){const d=(s.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/s.tileSize));return Math.max(0,d)}getVisibleUnwrappedCoordinates(s){const d=[new l.b4(0,s)];if(this._renderWorldCopies){const f=this.pointCoordinate(new l.P(0,0)),m=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(f.x,m.x,x.x,M.x)),D=Math.floor(Math.max(f.x,m.x,x.x,M.x)),L=1;for(let B=P-L;B<=D+L;B++)B!==0&&d.push(new l.b4(B,s))}return d}coveringTiles(s){var d,f;let m=this.coveringZoomLevel(s);const x=m;if(s.minzoom!==void 0&&m<s.minzoom)return[];s.maxzoom!==void 0&&m>s.maxzoom&&(m=s.maxzoom);const M=this.pointCoordinate(this.getCameraPoint()),P=l.Z.fromLngLat(this.center),D=Math.pow(2,m),L=[D*M.x,D*M.y,0],B=[D*P.x,D*P.y,0],V=Va.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,m);let W=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(W=m);const K=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,Q=ee=>({aabb:new Fa([ee*D,0,0],[(ee+1)*D,D,0]),zoom:0,x:0,y:0,wrap:ee,fullyVisible:!1}),re=[],ae=[],ce=m,he=s.reparseOverscaled?x:m;if(this._renderWorldCopies)for(let ee=1;ee<=3;ee++)re.push(Q(-ee)),re.push(Q(ee));for(re.push(Q(0));re.length>0;){const ee=re.pop(),me=ee.x,ge=ee.y;let ve=ee.fullyVisible;if(!ve){const We=ee.aabb.intersects(V);if(We===0)continue;ve=We===2}const Oe=s.terrain?L:B,Ve=ee.aabb.distanceX(Oe),Ke=ee.aabb.distanceY(Oe),nt=Math.max(Math.abs(Ve),Math.abs(Ke));if(ee.zoom===ce||nt>K+(1<<ce-ee.zoom)-2&&ee.zoom>=W){const We=ce-ee.zoom,He=L[0]-.5-(me<<We),ft=L[1]-.5-(ge<<We);ae.push({tileID:new l.S(ee.zoom===ce?he:ee.zoom,ee.wrap,ee.zoom,me,ge),distanceSq:Le([B[0]-.5-me,B[1]-.5-ge]),tileDistanceToCamera:Math.sqrt(He*He+ft*ft)})}else for(let We=0;We<4;We++){const He=(me<<1)+We%2,ft=(ge<<1)+(We>>1),Ot=ee.zoom+1;let Ge=ee.aabb.quadrant(We);if(s.terrain){const et=new l.S(Ot,ee.wrap,Ot,He,ft),Pt=s.terrain.getMinMaxElevation(et),Nn=(d=Pt.minElevation)!==null&&d!==void 0?d:this.elevation,Vt=(f=Pt.maxElevation)!==null&&f!==void 0?f:this.elevation;Ge=new Fa([Ge.min[0],Ge.min[1],Nn],[Ge.max[0],Ge.max[1],Vt])}re.push({aabb:Ge,zoom:Ot,x:He,y:ft,wrap:ee.wrap,fullyVisible:ve})}}return ae.sort((ee,me)=>ee.distanceSq-me.distanceSq).map(ee=>ee.tileID)}resize(s,d){this.width=s,this.height=d,this.pixelsToGLUnits=[2/s,-2/d],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(s){return Math.pow(2,s)}scaleZoom(s){return Math.log(s)/Math.LN2}project(s){const d=l.ac(s.lat,-85.051129,gd);return new l.P(l.O(s.lng)*this.worldSize,l.Q(d)*this.worldSize)}unproject(s){return new l.Z(s.x/this.worldSize,s.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(s){const d=this.elevation,f=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,m=this.pointLocation(this.centerPoint,s),x=s.getElevationForLngLatZoom(m,this.tileZoom);if(!(this.elevation-x))return;const M=f+d-x,P=Math.cos(this._pitch)*this.cameraToCenterDistance/M/l.b5(1,m.lat),D=this.scaleZoom(P/this.tileSize);this._elevation=x,this._center=m,this.zoom=D}setLocationAtPoint(s,d){const f=this.pointCoordinate(d),m=this.pointCoordinate(this.centerPoint),x=this.locationCoordinate(s),M=new l.Z(x.x-(f.x-m.x),x.y-(f.y-m.y));this.center=this.coordinateLocation(M),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(s,d){return d?this.coordinatePoint(this.locationCoordinate(s),d.getElevationForLngLatZoom(s,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(s))}pointLocation(s,d){return this.coordinateLocation(this.pointCoordinate(s,d))}locationCoordinate(s){return l.Z.fromLngLat(s)}coordinateLocation(s){return s&&s.toLngLat()}pointCoordinate(s,d){if(d){const W=d.pointCoordinate(s);if(W!=null)return W}const f=[s.x,s.y,0,1],m=[s.x,s.y,1,1];l.af(f,f,this.pixelMatrixInverse),l.af(m,m,this.pixelMatrixInverse);const x=f[3],M=m[3],P=f[1]/x,D=m[1]/M,L=f[2]/x,B=m[2]/M,V=L===B?0:(0-L)/(B-L);return new l.Z(l.y.number(f[0]/x,m[0]/M,V)/this.worldSize,l.y.number(P,D,V)/this.worldSize)}coordinatePoint(s,d=0,f=this.pixelMatrix){const m=[s.x*this.worldSize,s.y*this.worldSize,d,1];return l.af(m,m,f),new l.P(m[0]/m[3],m[1]/m[3])}getBounds(){const s=Math.max(0,this.height/2-this.getHorizon());return new ke().extend(this.pointLocation(new l.P(0,s))).extend(this.pointLocation(new l.P(this.width,s))).extend(this.pointLocation(new l.P(this.width,this.height))).extend(this.pointLocation(new l.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ke([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(s){s?(this.lngRange=[s.getWest(),s.getEast()],this.latRange=[s.getSouth(),s.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,gd])}calculateTileMatrix(s){const d=s.canonical,f=this.worldSize/this.zoomScale(d.z),m=d.x+Math.pow(2,d.z)*s.wrap,x=l.an(new Float64Array(16));return l.J(x,x,[m*f,d.y*f,0]),l.K(x,x,[f/l.X,f/l.X,1]),x}calculatePosMatrix(s,d=!1){const f=s.key,m=d?this._alignedPosMatrixCache:this._posMatrixCache;if(m[f])return m[f];const x=this.calculateTileMatrix(s);return l.L(x,d?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,x),m[f]=new Float32Array(x),m[f]}calculateFogMatrix(s){const d=s.key,f=this._fogMatrixCache;if(f[d])return f[d];const m=this.calculateTileMatrix(s);return l.L(m,this.fogMatrix,m),f[d]=new Float32Array(m),f[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(s,d){d=l.ac(+d,this.minZoom,this.maxZoom);const f={center:new l.N(s.lng,s.lat),zoom:d};let m=this.lngRange;if(!this._renderWorldCopies&&m===null){const ee=179.9999999999;m=[-ee,ee]}const x=this.tileSize*this.zoomScale(f.zoom);let M=0,P=x,D=0,L=x,B=0,V=0;const{x:W,y:K}=this.size;if(this.latRange){const ee=this.latRange;M=l.Q(ee[1])*x,P=l.Q(ee[0])*x,P-M<K&&(B=K/(P-M))}m&&(D=l.b3(l.O(m[0])*x,0,x),L=l.b3(l.O(m[1])*x,0,x),L<D&&(L+=x),L-D<W&&(V=W/(L-D)));const{x:Q,y:re}=this.project.call({worldSize:x},s);let ae,ce;const he=Math.max(V||0,B||0);if(he){const ee=new l.P(V?(L+D)/2:Q,B?(P+M)/2:re);return f.center=this.unproject.call({worldSize:x},ee).wrap(),f.zoom+=this.scaleZoom(he),f}if(this.latRange){const ee=K/2;re-ee<M&&(ce=M+ee),re+ee>P&&(ce=P-ee)}if(m){const ee=(D+L)/2;let me=Q;this._renderWorldCopies&&(me=l.b3(Q,ee-x/2,ee+x/2));const ge=W/2;me-ge<D&&(ae=D+ge),me+ge>L&&(ae=L-ge)}if(ae!==void 0||ce!==void 0){const ee=new l.P(ae??Q,ce??re);f.center=this.unproject.call({worldSize:x},ee).wrap()}return f}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const s=this._unmodified,{center:d,zoom:f}=this.getConstrained(this.center,this.zoom);this.center=d,this.zoom=f,this._unmodified=s,this._constraining=!1}_calcMatrices(){if(!this.height)return;const s=this.centerOffset,d=this.point.x,f=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=l.b5(1,this.center.lat)*this.worldSize;let m=l.an(new Float64Array(16));l.K(m,m,[this.width/2,-this.height/2,1]),l.J(m,m,[1,-1,0]),this.labelPlaneMatrix=m,m=l.an(new Float64Array(16)),l.K(m,m,[1,-1,1]),l.J(m,m,[-1,-1,0]),l.K(m,m,[2/this.width,2/this.height,1]),this.glCoordMatrix=m;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),D=M<0?P:x,L=Math.PI/2+this._pitch,B=this._fov*(.5+s.y/this.height),V=Math.sin(B)*D/Math.sin(l.ac(Math.PI-L-B,.01,Math.PI-.01)),W=this.getHorizon(),K=2*Math.atan(W/this.cameraToCenterDistance)*(.5+s.y/(2*W)),Q=Math.sin(K)*D/Math.sin(l.ac(Math.PI-L-K,.01,Math.PI-.01)),re=Math.min(V,Q);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*re+D),this.nearZ=this.height/50,m=new Float64Array(16),l.b6(m,this._fov,this.width/this.height,this.nearZ,this.farZ),m[8]=2*-s.x/this.width,m[9]=2*s.y/this.height,this.projectionMatrix=l.ae(m),l.K(m,m,[1,-1,1]),l.J(m,m,[0,0,-this.cameraToCenterDistance]),l.b7(m,m,this._pitch),l.ad(m,m,this.angle),l.J(m,m,[-d,-f,0]),this.mercatorMatrix=l.K([],m,[this.worldSize,this.worldSize,this.worldSize]),l.K(m,m,[1,1,this._pixelPerMeter]),this.pixelMatrix=l.L(new Float64Array(16),this.labelPlaneMatrix,m),l.J(m,m,[0,0,-this.elevation]),this.modelViewProjectionMatrix=m,this.invModelViewProjectionMatrix=l.as([],m),this.fogMatrix=new Float64Array(16),l.b6(this.fogMatrix,this._fov,this.width/this.height,x,this.farZ),this.fogMatrix[8]=2*-s.x/this.width,this.fogMatrix[9]=2*s.y/this.height,l.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),l.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),l.b7(this.fogMatrix,this.fogMatrix,this._pitch),l.ad(this.fogMatrix,this.fogMatrix,this.angle),l.J(this.fogMatrix,this.fogMatrix,[-d,-f,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,m);const ae=this.width%2/2,ce=this.height%2/2,he=Math.cos(this.angle),ee=Math.sin(this.angle),me=d-Math.round(d)+he*ae+ee*ce,ge=f-Math.round(f)+he*ce+ee*ae,ve=new Float64Array(m);if(l.J(ve,ve,[me>.5?me-1:me,ge>.5?ge-1:ge,0]),this.alignedModelViewProjectionMatrix=ve,m=l.as(new Float64Array(16),this.pixelMatrix),!m)throw new Error("failed to invert matrix");this.pixelMatrixInverse=m,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const s=this.pointCoordinate(new l.P(0,0)),d=[s.x*this.worldSize,s.y*this.worldSize,0,1];return l.af(d,d,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.P(0,s))}getCameraQueryGeometry(s){const d=this.getCameraPoint();if(s.length===1)return[s[0],d];{let f=d.x,m=d.y,x=d.x,M=d.y;for(const P of s)f=Math.min(f,P.x),m=Math.min(m,P.y),x=Math.max(x,P.x),M=Math.max(M,P.y);return[new l.P(f,m),new l.P(x,m),new l.P(x,M),new l.P(f,M),new l.P(f,m)]}}lngLatToCameraDepth(s,d){const f=this.locationCoordinate(s),m=[f.x*this.worldSize,f.y*this.worldSize,d,1];return l.af(m,m,this.modelViewProjectionMatrix),m[2]/m[3]}}function Gl(b,s){let d,f=!1,m=null,x=null;const M=()=>{m=null,f&&(b.apply(x,d),m=setTimeout(M,s),f=!1)};return(...P)=>(f=!0,x=this,d=P,m||M(),m)}class _u{constructor(s){this._getCurrentHash=()=>{const d=window.location.hash.replace("#","");if(this._hashName){let f;return d.split("&").map(m=>m.split("=")).forEach(m=>{m[0]===this._hashName&&(f=m)}),(f&&f[1]||"").split("/")}return d.split("/")},this._onHashChange=()=>{const d=this._getCurrentHash();if(d.length>=3&&!d.some(f=>isNaN(f))){const f=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:f,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 f=d.join("/");let m=f;m.split("&").length>0&&(m=m.split("&")[0]),this._hashName&&(m=`${this._hashName}=${f}`);let x=window.location.hash.replace(m,"");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=Gl(this._updateHashUnthrottled,300),this._hashName=s&&encodeURIComponent(s)}addTo(s){return this._map=s,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(s){const d=this._map.getCenter(),f=Math.round(100*this._map.getZoom())/100,m=Math.ceil((f*Math.LN2+Math.log(512/360/.5))/Math.LN10),x=Math.pow(10,m),M=Math.round(d.lng*x)/x,P=Math.round(d.lat*x)/x,D=this._map.getBearing(),L=this._map.getPitch();let B="";if(B+=s?`/${M}/${P}/${f}`:`${f}/${P}/${M}`,(D||L)&&(B+="/"+Math.round(10*D)/10),L&&(B+=`/${Math.round(L)}`),this._hashName){const V=this._hashName;let W=!1;const K=window.location.hash.slice(1).split("&").map(Q=>{const re=Q.split("=")[0];return re===V?(W=!0,`${re}=${B}`):Q}).filter(Q=>Q);return W||K.push(`${V}=${B}`),`#${K.join("&")}`}return`#${B}`}}const xu={linearity:.3,easing:l.b8(0,0,.3,1)},yd=l.e({deceleration:2500,maxSpeed:1400},xu),p_=l.e({deceleration:20,maxSpeed:1400},xu),gm=l.e({deceleration:1e3,maxSpeed:360},xu),bu=l.e({deceleration:1e3,maxSpeed:90},xu);class _d{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:E.now(),settings:s})}_drainInertiaBuffer(){const s=this._inertiaBuffer,d=E.now();for(;s.length>0&&d-s[0].time>160;)s.shift()}_onMoveEnd(s){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const d={zoom:0,bearing:0,pitch:0,pan:new l.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:x}of this._inertiaBuffer)d.zoom+=x.zoomDelta||0,d.bearing+=x.bearingDelta||0,d.pitch+=x.pitchDelta||0,x.panDelta&&d.pan._add(x.panDelta),x.around&&(d.around=x.around),x.pinchAround&&(d.pinchAround=x.pinchAround);const f=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,m={};if(d.pan.mag()){const x=Yl(d.pan.mag(),f,l.e({},yd,s||{}));m.offset=d.pan.mult(x.amount/d.pan.mag()),m.center=this._map.transform.center,Zl(m,x)}if(d.zoom){const x=Yl(d.zoom,f,p_);m.zoom=this._map.transform.zoom+x.amount,Zl(m,x)}if(d.bearing){const x=Yl(d.bearing,f,gm);m.bearing=this._map.transform.bearing+l.ac(x.amount,-179,179),Zl(m,x)}if(d.pitch){const x=Yl(d.pitch,f,bu);m.pitch=this._map.transform.pitch+x.amount,Zl(m,x)}if(m.zoom||m.bearing){const x=d.pinchAround===void 0?d.around:d.pinchAround;m.around=x?this._map.unproject(x):this._map.getCenter()}return this.clear(),l.e(m,{noMoveStart:!0})}}function Zl(b,s){(!b.duration||b.duration<s.duration)&&(b.duration=s.duration,b.easing=s.easing)}function Yl(b,s,d){const{maxSpeed:f,linearity:m,deceleration:x}=d,M=l.ac(b*m/(s/1e3),-f,f),P=Math.abs(M)/(x*m);return{easing:d.easing,duration:1e3*P,amount:M*(P/2)}}class Pi extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,d,f,m={}){const x=T.mousePos(d.getCanvas(),f),M=d.unproject(x);super(s,l.e({point:x,lngLat:M,originalEvent:f},m)),this._defaultPrevented=!1,this.target=d}}class Yo extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,d,f){const m=s==="touchend"?f.changedTouches:f.touches,x=T.touchPos(d.getCanvasContainer(),m),M=x.map(D=>d.unproject(D)),P=x.reduce((D,L,B,V)=>D.add(L.div(V.length)),new l.P(0,0));super(s,{points:x,point:P,lngLats:M,lngLat:d.unproject(P),originalEvent:f}),this._defaultPrevented=!1}}class ym extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,d,f){super(s,{originalEvent:f}),this._defaultPrevented=!1}}class _m{constructor(s,d){this._map=s,this._clickTolerance=d.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new ym(s.type,this._map,s))}mousedown(s,d){return this._mousedownPos=d,this._firePreventable(new Pi(s.type,this._map,s))}mouseup(s){this._map.fire(new Pi(s.type,this._map,s))}click(s,d){this._mousedownPos&&this._mousedownPos.dist(d)>=this._clickTolerance||this._map.fire(new Pi(s.type,this._map,s))}dblclick(s){return this._firePreventable(new Pi(s.type,this._map,s))}mouseover(s){this._map.fire(new Pi(s.type,this._map,s))}mouseout(s){this._map.fire(new Pi(s.type,this._map,s))}touchstart(s){return this._firePreventable(new Yo(s.type,this._map,s))}touchmove(s){this._map.fire(new Yo(s.type,this._map,s))}touchend(s){this._map.fire(new Yo(s.type,this._map,s))}touchcancel(s){this._map.fire(new Yo(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Qn{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new Pi(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Pi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new Pi(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class es{constructor(s){this._map=s}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(s){return this.transform.pointLocation(l.P.convert(s),this._map.terrain)}}class yr{constructor(s,d){this._map=s,this._tr=new es(s),this._el=s.getCanvasContainer(),this._container=s.getContainer(),this._clickTolerance=d.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(s,d){this.isEnabled()&&s.shiftKey&&s.button===0&&(T.disableDrag(),this._startPos=this._lastPos=d,this._active=!0)}mousemoveWindow(s,d){if(!this._active)return;const f=d;if(this._lastPos.equals(f)||!this._box&&f.dist(this._startPos)<this._clickTolerance)return;const m=this._startPos;this._lastPos=f,this._box||(this._box=T.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",s));const x=Math.min(m.x,f.x),M=Math.max(m.x,f.x),P=Math.min(m.y,f.y),D=Math.max(m.y,f.y);T.setTransform(this._box,`translate(${x}px,${P}px)`),this._box.style.width=M-x+"px",this._box.style.height=D-P+"px"}mouseupWindow(s,d){if(!this._active||s.button!==0)return;const f=this._startPos,m=d;if(this.reset(),T.suppressClick(),f.x!==m.x||f.y!==m.y)return this._map.fire(new l.k("boxzoomend",{originalEvent:s})),{cameraAnimation:x=>x.fitScreenCoordinates(f,m,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",s)}keydown(s){this._active&&s.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",s))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(T.remove(this._box),this._box=null),T.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,d){return this._map.fire(new l.k(s,{originalEvent:d}))}}function Xl(b,s){if(b.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${b.length}, points ${s.length}`);const d={};for(let f=0;f<b.length;f++)d[b[f].identifier]=s[f];return d}class xd{constructor(s){this.reset(),this.numTouches=s.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(s,d,f){(this.centroid||f.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),f.length===this.numTouches&&(this.centroid=function(m){const x=new l.P(0,0);for(const M of m)x._add(M);return x.div(m.length)}(d),this.touches=Xl(f,d)))}touchmove(s,d,f){if(this.aborted||!this.centroid)return;const m=Xl(f,d);for(const x in this.touches){const M=m[x];(!M||M.dist(this.touches[x])>30)&&(this.aborted=!0)}}touchend(s,d,f){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),f.length===0){const m=!this.aborted&&this.centroid;if(this.reset(),m)return m}}}class vu{constructor(s){this.singleTap=new xd(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(s,d,f){this.singleTap.touchstart(s,d,f)}touchmove(s,d,f){this.singleTap.touchmove(s,d,f)}touchend(s,d,f){const m=this.singleTap.touchend(s,d,f);if(m){const x=s.timeStamp-this.lastTime<500,M=!this.lastTap||this.lastTap.dist(m)<30;if(x&&M||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=m,this.count===this.numTaps)return this.reset(),m}}}class Ua{constructor(s){this._tr=new es(s),this._zoomIn=new vu({numTouches:1,numTaps:2}),this._zoomOut=new vu({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,d,f){this._zoomIn.touchstart(s,d,f),this._zoomOut.touchstart(s,d,f)}touchmove(s,d,f){this._zoomIn.touchmove(s,d,f),this._zoomOut.touchmove(s,d,f)}touchend(s,d,f){const m=this._zoomIn.touchend(s,d,f),x=this._zoomOut.touchend(s,d,f),M=this._tr;return m?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:P=>P.easeTo({duration:300,zoom:M.zoom+1,around:M.unproject(m)},{originalEvent:s})}):x?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:P=>P.easeTo({duration:300,zoom:M.zoom-1,around:M.unproject(x)},{originalEvent:s})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qs{constructor(s){this._enabled=!!s.enable,this._moveStateManager=s.moveStateManager,this._clickTolerance=s.clickTolerance||1,this._moveFunction=s.move,this._activateOnStart=!!s.activateOnStart,s.assignEvents(this),this.reset()}reset(s){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(s)}_move(...s){const d=this._moveFunction(...s);if(d.bearingDelta||d.pitchDelta||d.around||d.panDelta)return this._active=!0,d}dragStart(s,d){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(s)&&(this._moveStateManager.startMove(s),this._lastPoint=d.length?d[0]:d,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(s,d){if(!this.isEnabled())return;const f=this._lastPoint;if(!f)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);const m=d.length?d[0]:d;return!this._moved&&m.dist(f)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=m,this._move(f,m))}dragEnd(s){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(s)&&(this._moved&&T.suppressClick(),this.reset(s))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const bd={0:1,2:2};class wu{constructor(s){this._correctEvent=s.checkCorrectEvent}startMove(s){const d=T.mouseButton(s);this._eventButton=d}endMove(s){delete this._eventButton}isValidStartEvent(s){return this._correctEvent(s)}isValidMoveEvent(s){return!function(d,f){const m=bd[f];return d.buttons===void 0||(d.buttons&m)!==m}(s,this._eventButton)}isValidEndEvent(s){return T.mouseButton(s)===this._eventButton}}class vd{constructor(){this._firstTouch=void 0}_isOneFingerTouch(s){return s.targetTouches.length===1}_isSameTouchEvent(s){return s.targetTouches[0].identifier===this._firstTouch}startMove(s){this._firstTouch=s.targetTouches[0].identifier}endMove(s){delete this._firstTouch}isValidStartEvent(s){return this._isOneFingerTouch(s)}isValidMoveEvent(s){return this._isOneFingerTouch(s)&&this._isSameTouchEvent(s)}isValidEndEvent(s){return this._isOneFingerTouch(s)&&this._isSameTouchEvent(s)}}const ku=b=>{b.mousedown=b.dragStart,b.mousemoveWindow=b.dragMove,b.mouseup=b.dragEnd,b.contextmenu=s=>{s.preventDefault()}},wd=({enable:b,clickTolerance:s,bearingDegreesPerPixelMoved:d=.8})=>{const f=new wu({checkCorrectEvent:m=>T.mouseButton(m)===0&&m.ctrlKey||T.mouseButton(m)===2});return new qs({clickTolerance:s,move:(m,x)=>({bearingDelta:(x.x-m.x)*d}),moveStateManager:f,enable:b,assignEvents:ku})},kd=({enable:b,clickTolerance:s,pitchDegreesPerPixelMoved:d=-.5})=>{const f=new wu({checkCorrectEvent:m=>T.mouseButton(m)===0&&m.ctrlKey||T.mouseButton(m)===2});return new qs({clickTolerance:s,move:(m,x)=>({pitchDelta:(x.y-m.y)*d}),moveStateManager:f,enable:b,assignEvents:ku})};class Xo{constructor(s,d){this._clickTolerance=s.clickTolerance||1,this._map=d,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.P(0,0)}_shouldBePrevented(s){return s<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(s,d,f){return this._calculateTransform(s,d,f)}touchmove(s,d,f){if(this._active){if(!this._shouldBePrevented(f.length))return s.preventDefault(),this._calculateTransform(s,d,f);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",s)}}touchend(s,d,f){this._calculateTransform(s,d,f),this._active&&this._shouldBePrevented(f.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(s,d,f){f.length>0&&(this._active=!0);const m=Xl(f,d),x=new l.P(0,0),M=new l.P(0,0);let P=0;for(const L in m){const B=m[L],V=this._touches[L];V&&(x._add(B),M._add(B.sub(V)),P++,m[L]=B)}if(this._touches=m,this._shouldBePrevented(P)||!M.mag())return;const D=M.div(P);return this._sum._add(D),this._sum.mag()<this._clickTolerance?void 0:{around:x.div(P),panDelta:D}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Su{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(s,d,f){this._firstTwoTouches||f.length<2||(this._firstTwoTouches=[f[0].identifier,f[1].identifier],this._start([d[0],d[1]]))}touchmove(s,d,f){if(!this._firstTwoTouches)return;s.preventDefault();const[m,x]=this._firstTwoTouches,M=Kl(f,d,m),P=Kl(f,d,x);if(!M||!P)return;const D=this._aroundCenter?null:M.add(P).div(2);return this._move([M,P],D,s)}touchend(s,d,f){if(!this._firstTwoTouches)return;const[m,x]=this._firstTwoTouches,M=Kl(f,d,m),P=Kl(f,d,x);M&&P||(this._active&&T.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(s){this._enabled=!0,this._aroundCenter=!!s&&s.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Kl(b,s,d){for(let f=0;f<b.length;f++)if(b[f].identifier===d)return s[f]}function Sd(b,s){return Math.log(b/s)/Math.LN2}class Ed extends Su{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(s){this._startDistance=this._distance=s[0].dist(s[1])}_move(s,d){const f=this._distance;if(this._distance=s[0].dist(s[1]),this._active||!(Math.abs(Sd(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Sd(this._distance,f),pinchAround:d}}}function Cd(b,s){return 180*b.angleWith(s)/Math.PI}class Td extends Su{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(s){this._startVector=this._vector=s[0].sub(s[1]),this._minDiameter=s[0].dist(s[1])}_move(s,d,f){const m=this._vector;if(this._vector=s[0].sub(s[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Cd(this._vector,m),pinchAround:d}}_isBelowThreshold(s){this._minDiameter=Math.min(this._minDiameter,s.mag());const d=25/(Math.PI*this._minDiameter)*360,f=Cd(s,this._startVector);return Math.abs(f)<d}}function Eu(b){return Math.abs(b.y)>Math.abs(b.x)}class Ha extends Su{constructor(s){super(),this._currentTouchCount=0,this._map=s}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(s,d,f){super.touchstart(s,d,f),this._currentTouchCount=f.length}_start(s){this._lastPoints=s,Eu(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,d,f){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const m=s[0].sub(this._lastPoints[0]),x=s[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(m,x,f.timeStamp),this._valid?(this._lastPoints=s,this._active=!0,{pitchDelta:(m.y+x.y)/2*-.5}):void 0}gestureBeginsVertically(s,d,f){if(this._valid!==void 0)return this._valid;const m=s.mag()>=2,x=d.mag()>=2;if(!m&&!x)return;if(!m||!x)return this._firstMove===void 0&&(this._firstMove=f),f-this._firstMove<100&&void 0;const M=s.y>0==d.y>0;return Eu(s)&&Eu(d)&&M}}const xm={panStep:100,bearingStep:15,pitchStep:10};class Nr{constructor(s){this._tr=new es(s);const d=xm;this._panStep=d.panStep,this._bearingStep=d.bearingStep,this._pitchStep=d.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(s){if(s.altKey||s.ctrlKey||s.metaKey)return;let d=0,f=0,m=0,x=0,M=0;switch(s.keyCode){case 61:case 107:case 171:case 187:d=1;break;case 189:case 109:case 173:d=-1;break;case 37:s.shiftKey?f=-1:(s.preventDefault(),x=-1);break;case 39:s.shiftKey?f=1:(s.preventDefault(),x=1);break;case 38:s.shiftKey?m=1:(s.preventDefault(),M=-1);break;case 40:s.shiftKey?m=-1:(s.preventDefault(),M=1);break;default:return}return this._rotationDisabled&&(f=0,m=0),{cameraAnimation:P=>{const D=this._tr;P.easeTo({duration:300,easeId:"keyboardHandler",easing:As,zoom:d?Math.round(D.zoom)+d*(s.shiftKey?2:1):D.zoom,bearing:D.bearing+f*this._bearingStep,pitch:D.pitch+m*this._pitchStep,offset:[-x*this._panStep,-M*this._panStep],center:D.center},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function As(b){return b*(2-b)}const Md=4.000244140625;class ts{constructor(s,d){this._onTimeout=f=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(f)},this._map=s,this._tr=new es(s),this._triggerRenderFrame=d,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(s){this._defaultZoomRate=s}setWheelZoomRate(s){this._wheelZoomRate=s}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(s){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!s&&s.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(s){return!!this._map.cooperativeGestures.isEnabled()&&!(s.ctrlKey||this._map.cooperativeGestures.isBypassed(s))}wheel(s){if(!this.isEnabled())return;if(this._shouldBePrevented(s))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",s);let d=s.deltaMode===WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const f=E.now(),m=f-(this._lastWheelEventTime||0);this._lastWheelEventTime=f,d!==0&&d%Md==0?this._type="wheel":d!==0&&Math.abs(d)<4?this._type="trackpad":m>400?(this._type=null,this._lastValue=d,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(m*d)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,d+=this._lastValue)),s.shiftKey&&d&&(d/=4),this._type&&(this._lastWheelEvent=s,this._delta-=d,this._active||this._start(s)),s.preventDefault()}_start(s){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const d=T.mousePos(this._map.getCanvas(),s),f=this._tr;this._around=d.y>f.transform.height/2-f.transform.getHorizon()?l.N.convert(this._aroundCenter?f.center:f.unproject(d)):l.N.convert(f.center),this._aroundPoint=f.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const s=this._tr.transform;if(this._delta!==0){const D=this._type==="wheel"&&Math.abs(this._delta)>Md?this._wheelZoomRate:this._defaultZoomRate;let L=2/(1+Math.exp(-Math.abs(this._delta*D)));this._delta<0&&L!==0&&(L=1/L);const B=typeof this._targetZoom=="number"?s.zoomScale(this._targetZoom):s.scale;this._targetZoom=Math.min(s.maxZoom,Math.max(s.minZoom,s.scaleZoom(B*L))),this._type==="wheel"&&(this._startZoom=s.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const d=typeof this._targetZoom=="number"?this._targetZoom:s.zoom,f=this._startZoom,m=this._easing;let x,M=!1;const P=E.now()-this._lastWheelEventTime;if(this._type==="wheel"&&f&&m&&P){const D=Math.min(P/200,1),L=m(D);x=l.y.number(f,d,L),D<1?this._frameId||(this._frameId=!0):M=!0}else x=d,M=!0;return this._active=!0,M&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!M,zoomDelta:x-s.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let d=l.b9;if(this._prevEase){const f=this._prevEase,m=(E.now()-f.start)/f.duration,x=f.easing(m+.01)-f.easing(m),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:s,easing:d},d}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ko{constructor(s,d){this._clickZoom=s,this._tapZoom=d}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class f_{constructor(s){this._tr=new es(s),this.reset()}reset(){this._active=!1}dblclick(s,d){return s.preventDefault(),{cameraAnimation:f=>{f.easeTo({duration:300,zoom:this._tr.zoom+(s.shiftKey?-1:1),around:this._tr.unproject(d)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class m_{constructor(){this._tap=new vu({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(s,d,f){if(!this._swipePoint)if(this._tapTime){const m=d[0],x=s.timeStamp-this._tapTime<500,M=this._tapPoint.dist(m)<30;x&&M?f.length>0&&(this._swipePoint=m,this._swipeTouch=f[0].identifier):this.reset()}else this._tap.touchstart(s,d,f)}touchmove(s,d,f){if(this._tapTime){if(this._swipePoint){if(f[0].identifier!==this._swipeTouch)return;const m=d[0],x=m.y-this._swipePoint.y;return this._swipePoint=m,s.preventDefault(),this._active=!0,{zoomDelta:x/128}}}else this._tap.touchmove(s,d,f)}touchend(s,d,f){if(this._tapTime)this._swipePoint&&f.length===0&&this.reset();else{const m=this._tap.touchend(s,d,f);m&&(this._tapTime=s.timeStamp,this._tapPoint=m)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class bm{constructor(s,d,f){this._el=s,this._mousePan=d,this._touchPan=f}enable(s){this._inertiaOptions=s||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class vm{constructor(s,d,f){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=d,this._mousePitch=f}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Ad{constructor(s,d,f,m){this._el=s,this._touchZoom=d,this._touchRotate=f,this._tapDragZoom=m,this._rotationDisabled=!1,this._enabled=!0}enable(s){this._touchZoom.enable(s),this._rotationDisabled||this._touchRotate.enable(s),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class qa{constructor(s,d){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=s,this._options=d,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const s=this._map.getCanvasContainer();s.classList.add("maplibregl-cooperative-gestures"),this._container=T.create("div","maplibregl-cooperative-gesture-screen",s);let d=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(d=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const f=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),m=document.createElement("div");m.className="maplibregl-desktop-message",m.textContent=d,this._container.appendChild(m);const x=document.createElement("div");x.className="maplibregl-mobile-message",x.textContent=f,this._container.appendChild(x),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(T.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(s){return s[this._bypassKey]}notifyGestureBlocked(s,d){this._enabled&&(this._map.fire(new l.k("cooperativegestureprevented",{gestureType:s,originalEvent:d})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Br=b=>b.zoom||b.drag||b.pitch||b.rotate;class ot extends l.k{}function Cu(b){return b.panDelta&&b.panDelta.mag()||b.zoomDelta||b.bearingDelta||b.pitchDelta}class Pd{constructor(s,d){this.handleWindowEvent=m=>{this.handleEvent(m,`${m.type}Window`)},this.handleEvent=(m,x)=>{if(m.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const M=m.type==="renderFrame"?void 0:m,P={needsRenderFrame:!1},D={},L={},B=m.touches,V=B?this._getMapTouches(B):void 0,W=V?T.touchPos(this._map.getCanvas(),V):T.mousePos(this._map.getCanvas(),m);for(const{handlerName:re,handler:ae,allowed:ce}of this._handlers){if(!ae.isEnabled())continue;let he;this._blockedByActive(L,ce,re)?ae.reset():ae[x||m.type]&&(he=ae[x||m.type](m,W,V),this.mergeHandlerResult(P,D,he,re,M),he&&he.needsRenderFrame&&this._triggerRenderFrame()),(he||ae.isActive())&&(L[re]=ae)}const K={};for(const re in this._previousActiveHandlers)L[re]||(K[re]=M);this._previousActiveHandlers=L,(Object.keys(K).length||Cu(P))&&(this._changes.push([P,D,K]),this._triggerRenderFrame()),(Object.keys(L).length||Cu(P))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:Q}=P;Q&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],Q(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new _d(s),this._bearingSnap=d.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(d);const f=this._el;this._listeners=[[f,"touchstart",{passive:!0}],[f,"touchmove",{passive:!1}],[f,"touchend",void 0],[f,"touchcancel",void 0],[f,"mousedown",void 0],[f,"mousemove",void 0],[f,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[f,"mouseover",void 0],[f,"mouseout",void 0],[f,"dblclick",void 0],[f,"click",void 0],[f,"keydown",{capture:!1}],[f,"keyup",void 0],[f,"wheel",{passive:!1}],[f,"contextmenu",void 0],[window,"blur",void 0]];for(const[m,x,M]of this._listeners)T.addEventListener(m,x,m===document?this.handleWindowEvent:this.handleEvent,M)}destroy(){for(const[s,d,f]of this._listeners)T.removeEventListener(s,d,s===document?this.handleWindowEvent:this.handleEvent,f)}_addDefaultHandlers(s){const d=this._map,f=d.getCanvasContainer();this._add("mapEvent",new _m(d,s));const m=d.boxZoom=new yr(d,s);this._add("boxZoom",m),s.interactive&&s.boxZoom&&m.enable();const x=d.cooperativeGestures=new qa(d,s.cooperativeGestures);this._add("cooperativeGestures",x),s.cooperativeGestures&&x.enable();const M=new Ua(d),P=new f_(d);d.doubleClickZoom=new Ko(P,M),this._add("tapZoom",M),this._add("clickZoom",P),s.interactive&&s.doubleClickZoom&&d.doubleClickZoom.enable();const D=new m_;this._add("tapDragZoom",D);const L=d.touchPitch=new Ha(d);this._add("touchPitch",L),s.interactive&&s.touchPitch&&d.touchPitch.enable(s.touchPitch);const B=wd(s),V=kd(s);d.dragRotate=new vm(s,B,V),this._add("mouseRotate",B,["mousePitch"]),this._add("mousePitch",V,["mouseRotate"]),s.interactive&&s.dragRotate&&d.dragRotate.enable();const W=(({enable:he,clickTolerance:ee})=>{const me=new wu({checkCorrectEvent:ge=>T.mouseButton(ge)===0&&!ge.ctrlKey});return new qs({clickTolerance:ee,move:(ge,ve)=>({around:ve,panDelta:ve.sub(ge)}),activateOnStart:!0,moveStateManager:me,enable:he,assignEvents:ku})})(s),K=new Xo(s,d);d.dragPan=new bm(f,W,K),this._add("mousePan",W),this._add("touchPan",K,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&d.dragPan.enable(s.dragPan);const Q=new Td,re=new Ed;d.touchZoomRotate=new Ad(f,re,Q,D),this._add("touchRotate",Q,["touchPan","touchZoom"]),this._add("touchZoom",re,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&d.touchZoomRotate.enable(s.touchZoomRotate);const ae=d.scrollZoom=new ts(d,()=>this._triggerRenderFrame());this._add("scrollZoom",ae,["mousePan"]),s.interactive&&s.scrollZoom&&d.scrollZoom.enable(s.scrollZoom);const ce=d.keyboard=new Nr(d);this._add("keyboard",ce),s.interactive&&s.keyboard&&d.keyboard.enable(),this._add("blockableMapEvent",new Qn(d))}_add(s,d,f){this._handlers.push({handlerName:s,handler:d,allowed:f}),this._handlersById[s]=d}stop(s){if(!this._updatingCamera){for(const{handler:d}of this._handlers)d.reset();this._inertia.clear(),this._fireEvents({},{},s),this._changes=[]}}isActive(){for(const{handler:s}of this._handlers)if(s.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Br(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,d,f){for(const m in s)if(m!==f&&(!d||d.indexOf(m)<0))return!0;return!1}_getMapTouches(s){const d=[];for(const f of s)this._el.contains(f.target)&&d.push(f);return d}mergeHandlerResult(s,d,f,m,x){if(!f)return;l.e(s,f);const M={handlerName:m,originalEvent:f.originalEvent||x};f.zoomDelta!==void 0&&(d.zoom=M),f.panDelta!==void 0&&(d.drag=M),f.pitchDelta!==void 0&&(d.pitch=M),f.bearingDelta!==void 0&&(d.rotate=M)}_applyChanges(){const s={},d={},f={};for(const[m,x,M]of this._changes)m.panDelta&&(s.panDelta=(s.panDelta||new l.P(0,0))._add(m.panDelta)),m.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+m.zoomDelta),m.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+m.bearingDelta),m.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+m.pitchDelta),m.around!==void 0&&(s.around=m.around),m.pinchAround!==void 0&&(s.pinchAround=m.pinchAround),m.noInertia&&(s.noInertia=m.noInertia),l.e(d,x),l.e(f,M);this._updateMapTransform(s,d,f),this._changes=[]}_updateMapTransform(s,d,f){const m=this._map,x=m._getTransformForUpdate(),M=m.terrain;if(!(Cu(s)||M&&this._terrainMovement))return this._fireEvents(d,f,!0);let{panDelta:P,zoomDelta:D,bearingDelta:L,pitchDelta:B,around:V,pinchAround:W}=s;W!==void 0&&(V=W),m._stop(!0),V=V||m.transform.centerPoint;const K=x.pointLocation(P?V.sub(P):V);L&&(x.bearing+=L),B&&(x.pitch+=B),D&&(x.zoom+=D),M?this._terrainMovement||!d.drag&&!d.zoom?d.drag&&this._terrainMovement?x.center=x.pointLocation(x.centerPoint.sub(P)):x.setLocationAtPoint(K,V):(this._terrainMovement=!0,this._map._elevationFreeze=!0,x.setLocationAtPoint(K,V)):x.setLocationAtPoint(K,V),m._applyUpdatedTransform(x),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(d,f,!0)}_fireEvents(s,d,f){const m=Br(this._eventsInProgress),x=Br(s),M={};for(const V in s){const{originalEvent:W}=s[V];this._eventsInProgress[V]||(M[`${V}start`]=W),this._eventsInProgress[V]=s[V]}!m&&x&&this._fireEvent("movestart",x.originalEvent);for(const V in M)this._fireEvent(V,M[V]);x&&this._fireEvent("move",x.originalEvent);for(const V in s){const{originalEvent:W}=s[V];this._fireEvent(V,W)}const P={};let D;for(const V in this._eventsInProgress){const{handlerName:W,originalEvent:K}=this._eventsInProgress[V];this._handlersById[W].isActive()||(delete this._eventsInProgress[V],D=d[W]||K,P[`${V}end`]=D)}for(const V in P)this._fireEvent(V,P[V]);const L=Br(this._eventsInProgress),B=(m||x)&&!L;if(B&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const V=this._map._getTransformForUpdate();V.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(V)}if(f&&B){this._updatingCamera=!0;const V=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),W=K=>K!==0&&-this._bearingSnap<K&&K<this._bearingSnap;!V||!V.essential&&E.prefersReducedMotion?(this._map.fire(new l.k("moveend",{originalEvent:D})),W(this._map.getBearing())&&this._map.resetNorth()):(W(V.bearing||this._map.getBearing())&&(V.bearing=0),V.freezeElevation=!0,this._map.easeTo(V,{originalEvent:D})),this._updatingCamera=!1}}_fireEvent(s,d){this._map.fire(new l.k(s,d?{originalEvent:d}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(s=>{delete this._frameId,this.handleEvent(new ot("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class wm extends l.E{constructor(s,d){super(),this._renderFrameCallback=()=>{const f=Math.min((E.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(f)),f<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=s,this._bearingSnap=d.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new l.N(this.transform.center.lng,this.transform.center.lat)}setCenter(s,d){return this.jumpTo({center:s},d)}panBy(s,d,f){return s=l.P.convert(s).mult(-1),this.panTo(this.transform.center,l.e({offset:s},d),f)}panTo(s,d,f){return this.easeTo(l.e({center:s},d),f)}getZoom(){return this.transform.zoom}setZoom(s,d){return this.jumpTo({zoom:s},d),this}zoomTo(s,d,f){return this.easeTo(l.e({zoom:s},d),f)}zoomIn(s,d){return this.zoomTo(this.getZoom()+1,s,d),this}zoomOut(s,d){return this.zoomTo(this.getZoom()-1,s,d),this}getBearing(){return this.transform.bearing}setBearing(s,d){return this.jumpTo({bearing:s},d),this}getPadding(){return this.transform.padding}setPadding(s,d){return this.jumpTo({padding:s},d),this}rotateTo(s,d,f){return this.easeTo(l.e({bearing:s},d),f)}resetNorth(s,d){return this.rotateTo(0,l.e({duration:1e3},s),d),this}resetNorthPitch(s,d){return this.easeTo(l.e({bearing:0,pitch:0,duration:1e3},s),d),this}snapToNorth(s,d){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(s,d):this}getPitch(){return this.transform.pitch}setPitch(s,d){return this.jumpTo({pitch:s},d),this}cameraForBounds(s,d){s=ke.convert(s).adjustAntiMeridian();const f=d&&d.bearing||0;return this._cameraForBoxAndBearing(s.getNorthWest(),s.getSouthEast(),f,d)}_cameraForBoxAndBearing(s,d,f,m){const x={top:0,bottom:0,right:0,left:0};if(typeof(m=l.e({padding:x,offset:[0,0],maxZoom:this.transform.maxZoom},m)).padding=="number"){const We=m.padding;m.padding={top:We,bottom:We,right:We,left:We}}m.padding=l.e(x,m.padding);const M=this.transform,P=M.padding,D=new ke(s,d),L=M.project(D.getNorthWest()),B=M.project(D.getNorthEast()),V=M.project(D.getSouthEast()),W=M.project(D.getSouthWest()),K=l.ba(-f),Q=L.rotate(K),re=B.rotate(K),ae=V.rotate(K),ce=W.rotate(K),he=new l.P(Math.max(Q.x,re.x,ce.x,ae.x),Math.max(Q.y,re.y,ce.y,ae.y)),ee=new l.P(Math.min(Q.x,re.x,ce.x,ae.x),Math.min(Q.y,re.y,ce.y,ae.y)),me=he.sub(ee),ge=(M.width-(P.left+P.right+m.padding.left+m.padding.right))/me.x,ve=(M.height-(P.top+P.bottom+m.padding.top+m.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 Oe=Math.min(M.scaleZoom(M.scale*Math.min(ge,ve)),m.maxZoom),Ve=l.P.convert(m.offset),Ke=new l.P((m.padding.left-m.padding.right)/2,(m.padding.top-m.padding.bottom)/2).rotate(l.ba(f)),nt=Ve.add(Ke).mult(M.scale/M.zoomScale(Oe));return{center:M.unproject(L.add(V).div(2).sub(nt)),zoom:Oe,bearing:f}}fitBounds(s,d,f){return this._fitInternal(this.cameraForBounds(s,d),d,f)}fitScreenCoordinates(s,d,f,m,x){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(l.P.convert(s)),this.transform.pointLocation(l.P.convert(d)),f,m),m,x)}_fitInternal(s,d,f){return s?(delete(d=l.e(s,d)).padding,d.linear?this.easeTo(d,f):this.flyTo(d,f)):this}jumpTo(s,d){this.stop();const f=this._getTransformForUpdate();let m=!1,x=!1,M=!1;return"zoom"in s&&f.zoom!==+s.zoom&&(m=!0,f.zoom=+s.zoom),s.center!==void 0&&(f.center=l.N.convert(s.center)),"bearing"in s&&f.bearing!==+s.bearing&&(x=!0,f.bearing=+s.bearing),"pitch"in s&&f.pitch!==+s.pitch&&(M=!0,f.pitch=+s.pitch),s.padding==null||f.isPaddingEqual(s.padding)||(f.padding=s.padding),this._applyUpdatedTransform(f),this.fire(new l.k("movestart",d)).fire(new l.k("move",d)),m&&this.fire(new l.k("zoomstart",d)).fire(new l.k("zoom",d)).fire(new l.k("zoomend",d)),x&&this.fire(new l.k("rotatestart",d)).fire(new l.k("rotate",d)).fire(new l.k("rotateend",d)),M&&this.fire(new l.k("pitchstart",d)).fire(new l.k("pitch",d)).fire(new l.k("pitchend",d)),this.fire(new l.k("moveend",d))}calculateCameraOptionsFromTo(s,d,f,m=0){const x=l.Z.fromLngLat(s,d),M=l.Z.fromLngLat(f,m),P=M.x-x.x,D=M.y-x.y,L=M.z-x.z,B=Math.hypot(P,D,L);if(B===0)throw new Error("Can't calculate camera options with same From and To");const V=Math.hypot(P,D),W=this.transform.scaleZoom(this.transform.cameraToCenterDistance/B/this.transform.tileSize),K=180*Math.atan2(P,-D)/Math.PI;let Q=180*Math.acos(V/B)/Math.PI;return Q=L<0?90-Q:90+Q,{center:M.toLngLat(),zoom:W,pitch:Q,bearing:K}}easeTo(s,d){var f;this._stop(!1,s.easeId),((s=l.e({offset:[0,0],duration:500,easing:l.b9},s)).animate===!1||!s.essential&&E.prefersReducedMotion)&&(s.duration=0);const m=this._getTransformForUpdate(),x=m.zoom,M=m.bearing,P=m.pitch,D=m.padding,L="bearing"in s?this._normalizeBearing(s.bearing,M):M,B="pitch"in s?+s.pitch:P,V="padding"in s?s.padding:m.padding,W=l.P.convert(s.offset);let K=m.centerPoint.add(W);const Q=m.pointLocation(K),{center:re,zoom:ae}=m.getConstrained(l.N.convert(s.center||Q),(f=s.zoom)!==null&&f!==void 0?f:x);this._normalizeCenter(re,m);const ce=m.project(Q),he=m.project(re).sub(ce),ee=m.zoomScale(ae-x);let me,ge;s.around&&(me=l.N.convert(s.around),ge=m.locationPoint(me));const ve={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||ae!==x,this._rotating=this._rotating||M!==L,this._pitching=this._pitching||B!==P,this._padding=!m.isPaddingEqual(V),this._easeId=s.easeId,this._prepareEase(d,s.noMoveStart,ve),this.terrain&&this._prepareElevation(re),this._ease(Oe=>{if(this._zooming&&(m.zoom=l.y.number(x,ae,Oe)),this._rotating&&(m.bearing=l.y.number(M,L,Oe)),this._pitching&&(m.pitch=l.y.number(P,B,Oe)),this._padding&&(m.interpolatePadding(D,V,Oe),K=m.centerPoint.add(W)),this.terrain&&!s.freezeElevation&&this._updateElevation(Oe),me)m.setLocationAtPoint(me,ge);else{const Ve=m.zoomScale(m.zoom-x),Ke=ae>x?Math.min(2,ee):Math.max(.5,ee),nt=Math.pow(Ke,1-Oe),We=m.unproject(ce.add(he.mult(Oe*nt)).mult(Ve));m.setLocationAtPoint(m.renderWorldCopies?We.wrap():We,K)}this._applyUpdatedTransform(m),this._fireMoveEvents(d)},Oe=>{this.terrain&&s.freezeElevation&&this._finalizeElevation(),this._afterEase(d,Oe)},s),this}_prepareEase(s,d,f={}){this._moving=!0,d||f.moving||this.fire(new l.k("movestart",s)),this._zooming&&!f.zooming&&this.fire(new l.k("zoomstart",s)),this._rotating&&!f.rotating&&this.fire(new l.k("rotatestart",s)),this._pitching&&!f.pitching&&this.fire(new l.k("pitchstart",s))}_prepareElevation(s){this._elevationCenter=s,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(s){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const d=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(s<1&&d!==this._elevationTarget){const f=this._elevationTarget-this._elevationStart;this._elevationStart+=s*(f-(d-(f*s+this._elevationStart))/(1-s)),this._elevationTarget=d}this.transform.elevation=l.y.number(this._elevationStart,this._elevationTarget,s)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(s){const d=s.getCameraPosition(),f=this.terrain.getElevationForLngLatZoom(d.lngLat,s.zoom);if(d.altitude<f){const m=this.calculateCameraOptionsFromTo(d.lngLat,f,s.center,s.elevation);return{pitch:m.pitch,zoom:m.zoom}}return{}}_applyUpdatedTransform(s){const d=[];if(this.terrain&&d.push(m=>this._elevateCameraIfInsideTerrain(m)),this.transformCameraUpdate&&d.push(m=>this.transformCameraUpdate(m)),!d.length)return;const f=s.clone();for(const m of d){const x=f.clone(),{center:M,zoom:P,pitch:D,bearing:L,elevation:B}=m(x);M&&(x.center=M),P!==void 0&&(x.zoom=P),D!==void 0&&(x.pitch=D),L!==void 0&&(x.bearing=L),B!==void 0&&(x.elevation=B),f.apply(x)}this.transform.apply(f)}_fireMoveEvents(s){this.fire(new l.k("move",s)),this._zooming&&this.fire(new l.k("zoom",s)),this._rotating&&this.fire(new l.k("rotate",s)),this._pitching&&this.fire(new l.k("pitch",s))}_afterEase(s,d){if(this._easeId&&d&&this._easeId===d)return;delete this._easeId;const f=this._zooming,m=this._rotating,x=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,f&&this.fire(new l.k("zoomend",s)),m&&this.fire(new l.k("rotateend",s)),x&&this.fire(new l.k("pitchend",s)),this.fire(new l.k("moveend",s))}flyTo(s,d){var f;if(!s.essential&&E.prefersReducedMotion){const et=l.M(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(et,d)}this.stop(),s=l.e({offset:[0,0],speed:1.2,curve:1.42,easing:l.b9},s);const m=this._getTransformForUpdate(),x=m.zoom,M=m.bearing,P=m.pitch,D=m.padding,L="bearing"in s?this._normalizeBearing(s.bearing,M):M,B="pitch"in s?+s.pitch:P,V="padding"in s?s.padding:m.padding,W=l.P.convert(s.offset);let K=m.centerPoint.add(W);const Q=m.pointLocation(K),{center:re,zoom:ae}=m.getConstrained(l.N.convert(s.center||Q),(f=s.zoom)!==null&&f!==void 0?f:x);this._normalizeCenter(re,m);const ce=m.zoomScale(ae-x),he=m.project(Q),ee=m.project(re).sub(he);let me=s.curve;const ge=Math.max(m.width,m.height),ve=ge/ce,Oe=ee.mag();if("minZoom"in s){const et=l.ac(Math.min(s.minZoom,x,ae),m.minZoom,m.maxZoom),Pt=ge/m.zoomScale(et-x);me=Math.sqrt(Pt/Oe*2)}const Ve=me*me;function Ke(et){const Pt=(ve*ve-ge*ge+(et?-1:1)*Ve*Ve*Oe*Oe)/(2*(et?ve:ge)*Ve*Oe);return Math.log(Math.sqrt(Pt*Pt+1)-Pt)}function nt(et){return(Math.exp(et)-Math.exp(-et))/2}function We(et){return(Math.exp(et)+Math.exp(-et))/2}const He=Ke(!1);let ft=function(et){return We(He)/We(He+me*et)},Ot=function(et){return ge*((We(He)*(nt(Pt=He+me*et)/We(Pt))-nt(He))/Ve)/Oe;var Pt},Ge=(Ke(!0)-He)/me;if(Math.abs(Oe)<1e-6||!isFinite(Ge)){if(Math.abs(ge-ve)<1e-6)return this.easeTo(s,d);const et=ve<ge?-1:1;Ge=Math.abs(Math.log(ve/ge))/me,Ot=()=>0,ft=Pt=>Math.exp(et*me*Pt)}return s.duration="duration"in s?+s.duration:1e3*Ge/("screenSpeed"in s?+s.screenSpeed/me:+s.speed),s.maxDuration&&s.duration>s.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=M!==L,this._pitching=B!==P,this._padding=!m.isPaddingEqual(V),this._prepareEase(d,!1),this.terrain&&this._prepareElevation(re),this._ease(et=>{const Pt=et*Ge,Nn=1/ft(Pt);m.zoom=et===1?ae:x+m.scaleZoom(Nn),this._rotating&&(m.bearing=l.y.number(M,L,et)),this._pitching&&(m.pitch=l.y.number(P,B,et)),this._padding&&(m.interpolatePadding(D,V,et),K=m.centerPoint.add(W)),this.terrain&&!s.freezeElevation&&this._updateElevation(et);const Vt=et===1?re:m.unproject(he.add(ee.mult(Ot(Pt))).mult(Nn));m.setLocationAtPoint(m.renderWorldCopies?Vt.wrap():Vt,K),this._applyUpdatedTransform(m),this._fireMoveEvents(d)},()=>{this.terrain&&s.freezeElevation&&this._finalizeElevation(),this._afterEase(d)},s),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(s,d){var f;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const m=this._onEaseEnd;delete this._onEaseEnd,m.call(this,d)}return s||(f=this.handlers)===null||f===void 0||f.stop(!1),this}_ease(s,d,f){f.animate===!1||f.duration===0?(s(1),d()):(this._easeStart=E.now(),this._easeOptions=f,this._onEaseFrame=s,this._onEaseEnd=d,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(s,d){s=l.b3(s,-180,180);const f=Math.abs(s-d);return Math.abs(s-360-d)<f&&(s-=360),Math.abs(s+360-d)<f&&(s+=360),s}_normalizeCenter(s,d){if(!d.renderWorldCopies||d.lngRange)return;const f=s.lng-d.center.lng;s.lng+=f>180?-360:f<-180?360:0}queryTerrainElevation(s){return this.terrain?this.terrain.getElevationForLngLatZoom(l.N.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}const Wa={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Ga{constructor(s=Wa){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=d=>{!d||d.sourceDataType!=="metadata"&&d.sourceDataType!=="visibility"&&d.dataType!=="style"&&d.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=s}getDefaultPosition(){return"bottom-right"}onAdd(s){return this._map=s,this._compact=this.options.compact,this._container=T.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=T.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=T.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(){T.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(s,d){const f=this._map._getUIString(`AttributionControl.${d}`);s.title=f,s.setAttribute("aria-label",f)}_updateAttributions(){if(!this._map.style)return;let s=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=s.concat(this.options.customAttribution.map(m=>typeof m!="string"?"":m)):typeof this.options.customAttribution=="string"&&s.push(this.options.customAttribution)),this._map.style.stylesheet){const m=this._map.style.stylesheet;this.styleOwner=m.owner,this.styleId=m.id}const d=this._map.style.sourceCaches;for(const m in d){const x=d[m];if(x.used||x.usedForTerrain){const M=x.getSource();M.attribution&&s.indexOf(M.attribution)<0&&s.push(M.attribution)}}s=s.filter(m=>String(m).trim()),s.sort((m,x)=>m.length-x.length),s=s.filter((m,x)=>{for(let M=x+1;M<s.length;M++)if(s[M].indexOf(m)>=0)return!1;return!0});const f=s.join(" | ");f!==this._attribHTML&&(this._attribHTML=f,s.length?(this._innerContainer.innerHTML=f,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Id{constructor(s={}){this._updateCompact=()=>{const d=this._container.children;if(d.length){const f=d[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&f.classList.add("maplibregl-compact"):f.classList.remove("maplibregl-compact")}},this.options=s}getDefaultPosition(){return"bottom-left"}onAdd(s){this._map=s,this._compact=this.options&&this.options.compact,this._container=T.create("div","maplibregl-ctrl");const d=T.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(){T.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Jt{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(s){const d=++this._id;return this._queue.push({callback:s,id:d,cancelled:!1}),d}remove(s){const d=this._currentlyRunning,f=d?this._queue.concat(d):this._queue;for(const m of f)if(m.id===s)return void(m.cancelled=!0)}run(s=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const d=this._currentlyRunning=this._queue;this._queue=[];for(const f of d)if(!f.cancelled&&(f.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Dd=l.Y([{name:"a_pos3d",type:"Int16",components:3}]);class g_ extends l.E{constructor(s){super(),this.sourceCache=s,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,s.usedForTerrain=!0,s.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(s,d){this.sourceCache.update(s,d),this._renderableTilesKeys=[];const f={};for(const m of s.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:d}))f[m.key]=!0,this._renderableTilesKeys.push(m.key),this._tiles[m.key]||(m.posMatrix=new Float64Array(16),l.aP(m.posMatrix,0,l.X,0,l.X,0,1),this._tiles[m.key]=new Ts(m,this.tileSize));for(const m in this._tiles)f[m]||delete this._tiles[m]}freeRtt(s){for(const d in this._tiles){const f=this._tiles[d];(!s||f.tileID.equals(s)||f.tileID.isChildOf(s)||s.isChildOf(f.tileID))&&(f.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(s=>this.getTileByID(s))}getTileByID(s){return this._tiles[s]}getTerrainCoords(s){const d={};for(const f of this._renderableTilesKeys){const m=this._tiles[f].tileID;if(m.canonical.equals(s.canonical)){const x=s.clone();x.posMatrix=new Float64Array(16),l.aP(x.posMatrix,0,l.X,0,l.X,0,1),d[f]=x}else if(m.canonical.isChildOf(s.canonical)){const x=s.clone();x.posMatrix=new Float64Array(16);const M=m.canonical.z-s.canonical.z,P=m.canonical.x-(m.canonical.x>>M<<M),D=m.canonical.y-(m.canonical.y>>M<<M),L=l.X>>M;l.aP(x.posMatrix,0,L,0,L,0,1),l.J(x.posMatrix,x.posMatrix,[-P*L,-D*L,0]),d[f]=x}else if(s.canonical.isChildOf(m.canonical)){const x=s.clone();x.posMatrix=new Float64Array(16);const M=s.canonical.z-m.canonical.z,P=s.canonical.x-(s.canonical.x>>M<<M),D=s.canonical.y-(s.canonical.y>>M<<M),L=l.X>>M;l.aP(x.posMatrix,0,l.X,0,l.X,0,1),l.J(x.posMatrix,x.posMatrix,[P*L,D*L,0]),l.K(x.posMatrix,x.posMatrix,[1/2**M,1/2**M,0]),d[f]=x}}return d}getSourceTile(s,d){const f=this.sourceCache._source;let m=s.overscaledZ-this.deltaZoom;if(m>f.maxzoom&&(m=f.maxzoom),m<f.minzoom)return null;this._sourceTileCache[s.key]||(this._sourceTileCache[s.key]=s.scaledTo(m).key);let x=this.sourceCache.getTileByID(this._sourceTileCache[s.key]);if((!x||!x.dem)&&d)for(;m>=f.minzoom&&(!x||!x.dem);)x=this.sourceCache.getTileByID(s.scaledTo(m--).key);return x}tilesAfterTime(s=Date.now()){return Object.values(this._tiles).filter(d=>d.timeAdded>=s)}}class Od{constructor(s,d,f){this.painter=s,this.sourceCache=new g_(d),this.options=f,this.exaggeration=typeof f.exaggeration=="number"?f.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(s,d,f,m=l.X){var x;if(!(d>=0&&d<m&&f>=0&&f<m))return 0;const M=this.getTerrainData(s),P=(x=M.tile)===null||x===void 0?void 0:x.dem;if(!P)return 0;const D=function(Q,re,ae){var ce=re[0],he=re[1];return Q[0]=ae[0]*ce+ae[4]*he+ae[12],Q[1]=ae[1]*ce+ae[5]*he+ae[13],Q}([],[d/m*l.X,f/m*l.X],M.u_terrain_matrix),L=[D[0]*P.dim,D[1]*P.dim],B=Math.floor(L[0]),V=Math.floor(L[1]),W=L[0]-B,K=L[1]-V;return P.get(B,V)*(1-W)*(1-K)+P.get(B+1,V)*W*(1-K)+P.get(B,V+1)*(1-W)*K+P.get(B+1,V+1)*W*K}getElevationForLngLatZoom(s,d){if(!l.bb(d,s.wrap()))return 0;const{tileID:f,mercatorX:m,mercatorY:x}=this._getOverscaledTileIDFromLngLatZoom(s,d);return this.getElevation(f,m%l.X,x%l.X,l.X)}getElevation(s,d,f,m=l.X){return this.getDEMElevation(s,d,f,m)*this.exaggeration}getTerrainData(s){if(!this._emptyDemTexture){const m=this.painter.context,x=new l.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new it(m,x,m.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new it(m,new l.R({width:1,height:1}),m.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(m.gl.NEAREST,m.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=l.an([])}const d=this.sourceCache.getSourceTile(s,!0);if(d&&d.dem&&(!d.demTexture||d.needsTerrainPrepare)){const m=this.painter.context;d.demTexture=this.painter.getTileTexture(d.dem.stride),d.demTexture?d.demTexture.update(d.dem.getPixels(),{premultiply:!1}):d.demTexture=new it(m,d.dem.getPixels(),m.gl.RGBA,{premultiply:!1}),d.demTexture.bind(m.gl.NEAREST,m.gl.CLAMP_TO_EDGE),d.needsTerrainPrepare=!1}const f=d&&d+d.tileID.key+s.key;if(f&&!this._demMatrixCache[f]){const m=this.sourceCache.sourceCache._source.maxzoom;let x=s.canonical.z-d.tileID.canonical.z;s.overscaledZ>s.canonical.z&&(s.canonical.z>=m?x=s.canonical.z-m:l.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const M=s.canonical.x-(s.canonical.x>>x<<x),P=s.canonical.y-(s.canonical.y>>x<<x),D=l.bc(new Float64Array(16),[1/(l.X<<x),1/(l.X<<x),0]);l.J(D,D,[M*l.X,P*l.X,0]),this._demMatrixCache[s.key]={matrix:D,coord:s}}return{u_depth:2,u_terrain:3,u_terrain_dim:d&&d.dem&&d.dem.dim||1,u_terrain_matrix:f?this._demMatrixCache[s.key].matrix:this._emptyDemMatrix,u_terrain_unpack:d&&d.dem&&d.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(d&&d.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:d}}getFramebuffer(s){const d=this.painter,f=d.width/devicePixelRatio,m=d.height/devicePixelRatio;return!this._fbo||this._fbo.width===f&&this._fbo.height===m||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new it(d.context,{width:f,height:m,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 it(d.context,{width:f,height:m,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(f,m,!0,!1),this._fbo.depthAttachment.set(d.context.createRenderbuffer(d.context.gl.DEPTH_COMPONENT16,f,m))),this._fbo.colorAttachment.set(s==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const s=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const d=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let x=0,M=0;x<this._coordsTextureSize;x++)for(let 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 f=new l.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(d.buffer)),m=new it(s,f,s.gl.RGBA,{premultiply:!1});return m.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._coordsTexture=m,m}pointCoordinate(s){this.painter.maybeDrawDepthAndCoords(!0);const d=new Uint8Array(4),f=this.painter.context,m=f.gl,x=Math.round(s.x*this.painter.pixelRatio/devicePixelRatio),M=Math.round(s.y*this.painter.pixelRatio/devicePixelRatio),P=Math.round(this.painter.height/devicePixelRatio);f.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),m.readPixels(x,P-M-1,1,1,m.RGBA,m.UNSIGNED_BYTE,d),f.bindFramebuffer.set(null);const D=d[0]+(d[2]>>4<<8),L=d[1]+((15&d[2])<<8),B=this.coordsIndex[255-d[3]],V=B&&this.sourceCache.getTileByID(B);if(!V)return null;const W=this._coordsTextureSize,K=(1<<V.tileID.canonical.z)*W;return new l.Z((V.tileID.canonical.x*W+D)/K+V.tileID.wrap,(V.tileID.canonical.y*W+L)/K,this.getElevation(V.tileID,D,L,W))}depthAtPoint(s){const d=new Uint8Array(4),f=this.painter.context,m=f.gl;return f.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),m.readPixels(s.x,this.painter.height/devicePixelRatio-s.y-1,1,1,m.RGBA,m.UNSIGNED_BYTE,d),f.bindFramebuffer.set(null),(d[0]/16777216+d[1]/65536+d[2]/256+d[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const s=this.painter.context,d=new l.bd,f=new l.aY,m=this.meshSize,x=l.X/m,M=m*m;for(let V=0;V<=m;V++)for(let W=0;W<=m;W++)d.emplaceBack(W*x,V*x,0);for(let V=0;V<M;V+=m+1)for(let W=0;W<m;W++)f.emplaceBack(W+V,m+W+V+1,m+W+V+2),f.emplaceBack(W+V,m+W+V+2,W+V+1);const P=d.length,D=P+2*(m+1);for(const V of[0,1])for(let W=0;W<=m;W++)for(const K of[0,1])d.emplaceBack(W*x,V*l.X,K);for(let V=0;V<2*m;V+=2)f.emplaceBack(D+V,D+V+1,D+V+3),f.emplaceBack(D+V,D+V+3,D+V+2),f.emplaceBack(P+V,P+V+3,P+V+1),f.emplaceBack(P+V,P+V+2,P+V+3);const L=d.length,B=L+2*(m+1);for(const V of[0,1])for(let W=0;W<=m;W++)for(const K of[0,1])d.emplaceBack(V*l.X,W*x,K);for(let V=0;V<2*m;V+=2)f.emplaceBack(L+V,L+V+1,L+V+3),f.emplaceBack(L+V,L+V+3,L+V+2),f.emplaceBack(B+V,B+V+3,B+V+1),f.emplaceBack(B+V,B+V+2,B+V+3);return this._mesh=new gu(s.createVertexBuffer(d,Dd.members),s.createIndexBuffer(f),l.a0.simpleSegment(0,0,d.length,f.length)),this._mesh}getMeshFrameDelta(s){return 2*Math.PI*l.be/Math.pow(2,s)/5}getMinTileElevationForLngLatZoom(s,d){var f;const{tileID:m}=this._getOverscaledTileIDFromLngLatZoom(s,d);return(f=this.getMinMaxElevation(m).minElevation)!==null&&f!==void 0?f:0}getMinMaxElevation(s){const d=this.getTerrainData(s).tile,f={minElevation:null,maxElevation:null};return d&&d.dem&&(f.minElevation=d.dem.min*this.exaggeration,f.maxElevation=d.dem.max*this.exaggeration),f}_getOverscaledTileIDFromLngLatZoom(s,d){const f=l.Z.fromLngLat(s.wrap()),m=(1<<d)*l.X,x=f.x*m,M=f.y*m,P=Math.floor(x/l.X),D=Math.floor(M/l.X);return{tileID:new l.S(d,0,d,P,D),mercatorX:x,mercatorY:M}}}class y_{constructor(s,d,f){this._context=s,this._size=d,this._tileSize=f,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const s of this._objects)s.texture.destroy(),s.fbo.destroy()}_createObject(s){const d=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),f=new it(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return f.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),d.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),d.colorAttachment.set(f.texture),{id:s,fbo:d,texture:f,stamp:-1,inUse:!1}}getObjectForId(s){return this._objects[s]}useObject(s){s.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(d=>s.id!==d),this._recentlyUsed.push(s.id)}stampObject(s){s.stamp=++this._stamp}getOrCreateFreeObject(){for(const d of this._recentlyUsed)if(!this._objects[d].inUse)return this._objects[d];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const s=this._createObject(this._objects.length);return this._objects.push(s),s}freeObject(s){s.inUse=!1}freeAllObjects(){for(const s of this._objects)this.freeObject(s)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(s=>!s.inUse)===!1}}const Za={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class km{constructor(s,d){this.painter=s,this.terrain=d,this.pool=new y_(s.context,30,d.sourceCache.tileSize*d.qualityFactor)}destruct(){this.pool.destruct()}getTexture(s){return this.pool.getObjectForId(s.rtt[this._stacks.length-1].id).texture}prepareForRender(s,d){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=s._order.filter(f=>!s._layers[f].isHidden(d)),this._coordsDescendingInv={};for(const f in s.sourceCaches){this._coordsDescendingInv[f]={};const m=s.sourceCaches[f].getVisibleCoordinates();for(const x of m){const M=this.terrain.sourceCache.getTerrainCoords(x);for(const P in M)this._coordsDescendingInv[f][P]||(this._coordsDescendingInv[f][P]=[]),this._coordsDescendingInv[f][P].push(M[P])}}this._coordsDescendingInvStr={};for(const f of s._order){const m=s._layers[f],x=m.source;if(Za[m.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 f of this._renderableTiles)for(const m in this._coordsDescendingInvStr){const x=this._coordsDescendingInvStr[m][f.tileID.key];x&&x!==f.rttCoords[m]&&(f.rtt=[])}}renderLayer(s){if(s.isHidden(this.painter.transform.zoom))return!1;const d=s.type,f=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===s.id;if(Za[d]&&(this._prevType&&Za[this._prevType]||this._stacks.push([]),this._prevType=d,this._stacks[this._stacks.length-1].push(s.id),!m))return!0;if(Za[this._prevType]||Za[d]&&m){this._prevType=d;const x=this._stacks.length-1,M=this._stacks[x]||[];for(const P of this._renderableTiles){if(this.pool.isFull()&&(mm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(P),P.rtt[x]){const L=this.pool.getObjectForId(P.rtt[x].id);if(L.stamp===P.rtt[x].stamp){this.pool.useObject(L);continue}}const D=this.pool.getOrCreateFreeObject();this.pool.useObject(D),this.pool.stampObject(D),P.rtt[x]={id:D.id,stamp:D.stamp},f.context.bindFramebuffer.set(D.fbo.framebuffer),f.context.clear({color:l.aM.transparent,stencil:0}),f.currentStencilSource=void 0;for(let L=0;L<M.length;L++){const B=f.style._layers[M[L]],V=B.source?this._coordsDescendingInv[B.source][P.tileID.key]:[P.tileID];f.context.viewport.set([0,0,D.fbo.width,D.fbo.height]),f._renderTileClippingMasks(B,V),f.renderLayer(f,f.style.sourceCaches[B.source],B,V),B.source&&(P.rttCoords[B.source]=this._coordsDescendingInvStr[B.source][P.tileID.key])}}return mm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Za[d]}return!1}}const zd={"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"},Sm=g,__={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=b=>{b.touchstart=b.dragStart,b.touchmoveWindow=b.dragMove,b.touchend=b.dragEnd},x_={showCompass:!0,showZoom:!0,visualizePitch:!1};class b_{constructor(s,d,f=!1){this.mousedown=M=>{this.startMouse(l.e({},M,{ctrlKey:!0,preventDefault:()=>M.preventDefault()}),T.mousePos(this.element,M)),T.addEventListener(window,"mousemove",this.mousemove),T.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=M=>{this.moveMouse(M,T.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=T.touchPos(this.element,M.targetTouches)[0],this.startTouch(M,this._startPos),T.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.addEventListener(window,"touchend",this.touchend))},this.touchmove=M=>{M.targetTouches.length!==1?this.reset():(this._lastPos=T.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 m=s.dragRotate._mouseRotate.getClickTolerance(),x=s.dragRotate._mousePitch.getClickTolerance();this.element=d,this.mouseRotate=wd({clickTolerance:m,enable:!0}),this.touchRotate=(({enable:M,clickTolerance:P,bearingDegreesPerPixelMoved:D=.8})=>{const L=new vd;return new qs({clickTolerance:P,move:(B,V)=>({bearingDelta:(V.x-B.x)*D}),moveStateManager:L,enable:M,assignEvents:Rd})})({clickTolerance:m,enable:!0}),this.map=s,f&&(this.mousePitch=kd({clickTolerance:x,enable:!0}),this.touchPitch=(({enable:M,clickTolerance:P,pitchDegreesPerPixelMoved:D=-.5})=>{const L=new vd;return new qs({clickTolerance:P,move:(B,V)=>({pitchDelta:(V.y-B.y)*D}),moveStateManager:L,enable:M,assignEvents:Rd})})({clickTolerance:x,enable:!0})),T.addEventListener(d,"mousedown",this.mousedown),T.addEventListener(d,"touchstart",this.touchstart,{passive:!1}),T.addEventListener(d,"touchcancel",this.reset)}startMouse(s,d){this.mouseRotate.dragStart(s,d),this.mousePitch&&this.mousePitch.dragStart(s,d),T.disableDrag()}startTouch(s,d){this.touchRotate.dragStart(s,d),this.touchPitch&&this.touchPitch.dragStart(s,d),T.disableDrag()}moveMouse(s,d){const f=this.map,{bearingDelta:m}=this.mouseRotate.dragMove(s,d)||{};if(m&&f.setBearing(f.getBearing()+m),this.mousePitch){const{pitchDelta:x}=this.mousePitch.dragMove(s,d)||{};x&&f.setPitch(f.getPitch()+x)}}moveTouch(s,d){const f=this.map,{bearingDelta:m}=this.touchRotate.dragMove(s,d)||{};if(m&&f.setBearing(f.getBearing()+m),this.touchPitch){const{pitchDelta:x}=this.touchPitch.dragMove(s,d)||{};x&&f.setPitch(f.getPitch()+x)}}off(){const s=this.element;T.removeEventListener(s,"mousedown",this.mousedown),T.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),T.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.removeEventListener(window,"touchend",this.touchend),T.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){T.enableDrag(),T.removeEventListener(window,"mousemove",this.mousemove),T.removeEventListener(window,"mouseup",this.mouseup),T.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.removeEventListener(window,"touchend",this.touchend)}}let _r;function Ln(b,s,d){const f=new l.N(b.lng,b.lat);if(b=new l.N(b.lng,b.lat),s){const m=new l.N(b.lng-360,b.lat),x=new l.N(b.lng+360,b.lat),M=d.locationPoint(b).distSqr(s);d.locationPoint(m).distSqr(s)<M?b=m:d.locationPoint(x).distSqr(s)<M&&(b=x)}for(;Math.abs(b.lng-d.center.lng)>180;){const m=d.locationPoint(b);if(m.x>=0&&m.y>=0&&m.x<=d.width&&m.y<=d.height)break;b.lng>d.center.lng?b.lng-=360:b.lng+=360}return b.lng!==f.lng&&d.locationPoint(b).y>d.height/2-d.getHorizon()?b:f}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 Tu(b,s,d){const f=b.classList;for(const m in Ya)f.remove(`maplibregl-${d}-anchor-${m}`);f.add(`maplibregl-${d}-anchor-${s}`)}class Mu extends l.E{constructor(s){if(super(),this._onKeyPress=d=>{const f=d.code,m=d.charCode||d.keyCode;f!=="Space"&&f!=="Enter"&&m!==32&&m!==13||this.togglePopup()},this._onMapClick=d=>{const f=d.originalEvent.target,m=this._element;this._popup&&(f===m||m.contains(f))&&this.togglePopup()},this._update=d=>{var f;if(!this._map)return;const m=this._map.loaded()&&!this._map.isMoving();((d==null?void 0:d.type)==="terrain"||(d==null?void 0:d.type)==="render"&&!m)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Ln(this._lngLat,this._flatPos,this._map.transform):(f=this._lngLat)===null||f===void 0?void 0:f.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let 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()),T.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 f=this._clickTolerance||this._map._clickTolerance;this._isDragging=d.point.dist(this._pointerdownPos)>=f}this._isDragging&&(this._pos=d.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new l.k("dragstart"))),this.fire(new l.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new l.k("dragend")),this._state="inactive"},this._addDragHandler=d=>{this._element.contains(d.originalEvent.target)&&(d.preventDefault(),this._positionDelta=d.point.sub(this._pos).add(this._offset),this._pointerdownPos=d.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=s&&s.anchor||"center",this._color=s&&s.color||"#3FB1CE",this._scale=s&&s.scale||1,this._draggable=s&&s.draggable||!1,this._clickTolerance=s&&s.clickTolerance||0,this._subpixelPositioning=s&&s.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=s&&s.rotation||0,this._rotationAlignment=s&&s.rotationAlignment||"auto",this._pitchAlignment=s&&s.pitchAlignment&&s.pitchAlignment!=="auto"?s.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(s==null?void 0:s.opacity,s==null?void 0:s.opacityWhenCovered),s&&s.element)this._element=s.element,this._offset=l.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=T.create("div");const d=T.createNS("http://www.w3.org/2000/svg","svg"),f=41,m=27;d.setAttributeNS(null,"display","block"),d.setAttributeNS(null,"height",`${f}px`),d.setAttributeNS(null,"width",`${m}px`),d.setAttributeNS(null,"viewBox",`0 0 ${m} ${f}`);const x=T.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=T.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"fill-rule","nonzero");const P=T.createNS("http://www.w3.org/2000/svg","g");P.setAttributeNS(null,"transform","translate(3.0, 29.0)"),P.setAttributeNS(null,"fill","#000000");const D=[{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 D){const he=T.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 L=T.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"fill",this._color);const B=T.createNS("http://www.w3.org/2000/svg","path");B.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"),L.appendChild(B);const V=T.createNS("http://www.w3.org/2000/svg","g");V.setAttributeNS(null,"opacity","0.25"),V.setAttributeNS(null,"fill","#000000");const W=T.createNS("http://www.w3.org/2000/svg","path");W.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),V.appendChild(W);const K=T.createNS("http://www.w3.org/2000/svg","g");K.setAttributeNS(null,"transform","translate(6.0, 7.0)"),K.setAttributeNS(null,"fill","#FFFFFF");const Q=T.createNS("http://www.w3.org/2000/svg","g");Q.setAttributeNS(null,"transform","translate(8.0, 8.0)");const re=T.createNS("http://www.w3.org/2000/svg","circle");re.setAttributeNS(null,"fill","#000000"),re.setAttributeNS(null,"opacity","0.25"),re.setAttributeNS(null,"cx","5.5"),re.setAttributeNS(null,"cy","5.5"),re.setAttributeNS(null,"r","5.4999962");const ae=T.createNS("http://www.w3.org/2000/svg","circle");ae.setAttributeNS(null,"fill","#FFFFFF"),ae.setAttributeNS(null,"cx","5.5"),ae.setAttributeNS(null,"cy","5.5"),ae.setAttributeNS(null,"r","5.4999962"),Q.appendChild(re),Q.appendChild(ae),M.appendChild(P),M.appendChild(L),M.appendChild(V),M.appendChild(K),M.appendChild(Q),d.appendChild(M),d.setAttributeNS(null,"height",f*this._scale+"px"),d.setAttributeNS(null,"width",m*this._scale+"px"),this._element.appendChild(d),this._offset=l.P.convert(s&&s.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",d=>{d.preventDefault()}),this._element.addEventListener("mousedown",d=>{d.preventDefault()}),Tu(this._element,this._anchor,"marker"),s&&s.className)for(const d of s.className.split(" "))this._element.classList.add(d);this._popup=null}addTo(s){return this.remove(),this._map=s,this._element.setAttribute("aria-label",s._getUIString("Marker.Title")),s.getCanvasContainer().appendChild(this._element),s.on("move",this._update),s.on("moveend",this._update),s.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),T.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=l.N.convert(s),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(s){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),s){if(!("offset"in s.options)){const m=Math.abs(13.5)/Math.SQRT2;s.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[m,-1*(38.1-13.5+m)],"bottom-right":[-m,-1*(38.1-13.5+m)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(s){return this._subpixelPositioning=s,this}getPopup(){return this._popup}togglePopup(){const s=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:s?(s.isOpen()?s.remove():(s.setLngLat(this._lngLat),s.addTo(this._map)),this):this}_updateOpacity(s=!1){var d,f;if(!(!((d=this._map)===null||d===void 0)&&d.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(s)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const m=this._map,x=m.terrain.depthAtPoint(this._pos),M=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,M)-x<.006)return void(this._element.style.opacity=this._opacity);const P=-this._offset.y/m.transform._pixelPerMeter,D=Math.sin(m.getPitch()*Math.PI/180)*P,L=m.terrain.depthAtPoint(new l.P(this._pos.x,this._pos.y-this._offset.y)),B=m.transform.lngLatToCameraDepth(this._lngLat,M+D)-L>.006;!((f=this._popup)===null||f===void 0)&&f.isOpen()&&B&&this._popup.remove(),this._element.style.opacity=B?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(s){return this._offset=l.P.convert(s),this._update(),this}addClassName(s){this._element.classList.add(s)}removeClassName(s){this._element.classList.remove(s)}toggleClassName(s){return this._element.classList.toggle(s)}setDraggable(s){return this._draggable=!!s,this._map&&(s?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(s){return this._rotation=s||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(s){return this._rotationAlignment=s||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(s){return this._pitchAlignment=s&&s!=="auto"?s:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(s,d){return s===void 0&&d===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),s!==void 0&&(this._opacity=s),d!==void 0&&(this._opacityWhenCovered=d),this._map&&this._updateOpacity(!0),this}}const Em={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Jl=0,Ql=!1;const Ps={maxWidth:100,unit:"metric"};function ec(b,s,d){const f=d&&d.maxWidth||100,m=b._container.clientHeight/2,x=b.unproject([0,m]),M=b.unproject([f,m]),P=x.distanceTo(M);if(d&&d.unit==="imperial"){const D=3.2808*P;D>5280?pt(s,f,D/5280,b._getUIString("ScaleControl.Miles")):pt(s,f,D,b._getUIString("ScaleControl.Feet"))}else d&&d.unit==="nautical"?pt(s,f,P/1852,b._getUIString("ScaleControl.NauticalMiles")):P>=1e3?pt(s,f,P/1e3,b._getUIString("ScaleControl.Kilometers")):pt(s,f,P,b._getUIString("ScaleControl.Meters"))}function pt(b,s,d,f){const m=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(D){const L=Math.pow(10,Math.ceil(-Math.log(D)/Math.LN10));return Math.round(D*L)/L}(P),M*P}(d);b.style.width=s*(m/d)+"px",b.innerHTML=`${m} ${f}`}const Et={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Au=["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(b){if(b){if(typeof b=="number"){const s=Math.round(Math.abs(b)/Math.SQRT2);return{center:new l.P(0,0),top:new l.P(0,b),"top-left":new l.P(s,s),"top-right":new l.P(-s,s),bottom:new l.P(0,-b),"bottom-left":new l.P(s,-s),"bottom-right":new l.P(-s,-s),left:new l.P(b,0),right:new l.P(-b,0)}}if(b instanceof l.P||Array.isArray(b)){const s=l.P.convert(b);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}return{center:l.P.convert(b.center||[0,0]),top:l.P.convert(b.top||[0,0]),"top-left":l.P.convert(b["top-left"]||[0,0]),"top-right":l.P.convert(b["top-right"]||[0,0]),bottom:l.P.convert(b.bottom||[0,0]),"bottom-left":l.P.convert(b["bottom-left"]||[0,0]),"bottom-right":l.P.convert(b["bottom-right"]||[0,0]),left:l.P.convert(b.left||[0,0]),right:l.P.convert(b.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=yr,u.CanvasSource=bi,u.CooperativeGesturesHandler=qa,u.DoubleClickZoomHandler=Ko,u.DragPanHandler=bm,u.DragRotateHandler=vm,u.EdgeInsets=$a,u.FullscreenControl=class extends l.E{constructor(b={}){super(),this._onFullscreenChange=()=>{var s;let d=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((s=d==null?void 0:d.shadowRoot)===null||s===void 0)&&s.fullscreenElement;)d=d.shadowRoot.fullscreenElement;d===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,b&&b.container&&(b.container instanceof HTMLElement?this._container=b.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(b){return this._map=b,this._container||(this._container=this._map.getContainer()),this._controlContainer=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){T.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const b=this._fullscreenButton=T.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);T.create("span","maplibregl-ctrl-icon",b).setAttribute("aria-hidden","true"),b.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const b=this._getTitle();this._fullscreenButton.setAttribute("aria-label",b),this._fullscreenButton.title=b}_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=er,u.GeolocateControl=class extends l.E{constructor(b){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new l.k("outofmaxbounds",s)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=s,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(s),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(s),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new l.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{const d=new l.N(s.coords.longitude,s.coords.latitude),f=s.coords.accuracy,m=this._map.getBearing(),x=l.e({bearing:m},this.options.fitBoundsOptions),M=ke.fromLngLat(d,f);this._map.fitBounds(M,x,{geolocateSource:!0})},this._updateMarker=s=>{if(s){const d=new l.N(s.coords.longitude,s.coords.latitude);this._accuracyCircleMarker.setLngLat(d).addTo(this._map),this._userLocationDotMarker.setLngLat(d).addTo(this._map),this._accuracy=s.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=s=>{if(this._map){if(this.options.trackUserLocation)if(s.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=d,this._geolocateButton.setAttribute("aria-label",d),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(s.code===3&&Ql)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new l.k("error",s)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",s=>s.preventDefault()),this._geolocateButton=T.create("button","maplibregl-ctrl-geolocate",this._container),T.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=s=>{if(this._map){if(s===!1){l.w("Geolocation support is not available so the GeolocateControl will be disabled.");const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=d,this._geolocateButton.setAttribute("aria-label",d)}else{const d=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=d,this._geolocateButton.setAttribute("aria-label",d)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=T.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Mu({element:this._dotElement}),this._circleElement=T.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Mu({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({},Em,b)}onAdd(b){return this._map=b,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return l._(this,arguments,void 0,function*(s=!1){if(_r!==void 0&&!s)return _r;if(window.navigator.permissions===void 0)return _r=!!window.navigator.geolocation,_r;try{_r=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{_r=!!window.navigator.geolocation}return _r})}().then(s=>this._finishSetupUI(s)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),T.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Jl=0,Ql=!1}_isOutOfMapMaxBounds(b){const s=this._map.getMaxBounds(),d=b.coords;return s&&(d.longitude<s.getWest()||d.longitude>s.getEast()||d.latitude<s.getSouth()||d.latitude>s.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const b=this._map.getBounds(),s=b.getSouthEast(),d=b.getNorthEast(),f=s.distanceTo(d),m=Math.ceil(this._accuracy/(f/this._map._container.clientHeight)*2);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}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":Jl--,Ql=!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 b;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Jl++,Jl>1?(b={maximumAge:6e5,timeout:0},Ql=!0):(b=this.options.positionOptions,Ql=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,b)}}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=_u,u.ImageSource=xi,u.KeyboardHandler=Nr,u.LngLatBounds=ke,u.LogoControl=Id,u.Map=class extends wm{constructor(b){l.bf.mark(l.bg.create);const s=Object.assign(Object.assign({},__),b);if(s.minZoom!=null&&s.maxZoom!=null&&s.minZoom>s.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(s.minPitch!=null&&s.maxPitch!=null&&s.minPitch>s.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(s.minPitch!=null&&s.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(s.maxPitch!=null&&s.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ja(s.minZoom,s.maxZoom,s.minPitch,s.maxPitch,s.renderWorldCopies),{bearingSnap:s.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Jt,this._controls=[],this._mapId=l.a4(),this._contextLost=d=>{d.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new l.k("webglcontextlost",{originalEvent:d}))},this._contextRestored=d=>{this._setupPainter(),this.resize(),this._update(),this.fire(new l.k("webglcontextrestored",{originalEvent:d}))},this._onMapScroll=d=>{if(d.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=s.interactive,this._maxTileCacheSize=s.maxTileCacheSize,this._maxTileCacheZoomLevels=s.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=s.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=s.preserveDrawingBuffer===!0,this._antialias=s.antialias===!0,this._trackResize=s.trackResize===!0,this._bearingSnap=s.bearingSnap,this._refreshExpiredTiles=s.refreshExpiredTiles===!0,this._fadeDuration=s.fadeDuration,this._crossSourceCollisions=s.crossSourceCollisions===!0,this._collectResourceTiming=s.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},zd),s.locale),this._clickTolerance=s.clickTolerance,this._overridePixelRatio=s.pixelRatio,this._maxCanvasSize=s.maxCanvasSize,this.transformCameraUpdate=s.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=s.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=le.addThrottleControl(()=>this.isMoving()),this._requestManager=new J(s.transformRequest),typeof s.container=="string"){if(this._container=document.getElementById(s.container),!this._container)throw new Error(`Container '${s.container}' not found.`)}else{if(!(s.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=s.container}if(s.maxBounds&&this.setMaxBounds(s.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let d=!1;const f=Gl(m=>{this._trackResize&&!this._removed&&(this.resize(m),this.redraw())},50);this._resizeObserver=new ResizeObserver(m=>{d?f(m):d=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Pd(this,s),this._hash=s.hash&&new _u(typeof s.hash=="string"&&s.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:s.center,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch}),s.bounds&&(this.resize(),this.fitBounds(s.bounds,l.e({},s.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=s.localIdeographFontFamily,this._validateStyle=s.validateStyle,s.style&&this.setStyle(s.style,{localIdeographFontFamily:s.localIdeographFontFamily}),s.attributionControl&&this.addControl(new Ga(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new Id,s.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",d=>{this._update(d.dataType==="style"),this.fire(new l.k(`${d.dataType}data`,d))}),this.on("dataloading",d=>{this.fire(new l.k(`${d.dataType}dataloading`,d))}),this.on("dataabort",d=>{this.fire(new l.k("sourcedataabort",d))})}_getMapId(){return this._mapId}addControl(b,s){if(s===void 0&&(s=b.getDefaultPosition?b.getDefaultPosition():"top-right"),!b||!b.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=b.onAdd(this);this._controls.push(b);const f=this._controlPositions[s];return s.indexOf("bottom")!==-1?f.insertBefore(d,f.firstChild):f.appendChild(d),this}removeControl(b){if(!b||!b.onRemove)return this.fire(new l.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(b);return s>-1&&this._controls.splice(s,1),b.onRemove(this),this}hasControl(b){return this._controls.indexOf(b)>-1}calculateCameraOptionsFromTo(b,s,d,f){return f==null&&this.terrain&&(f=this.terrain.getElevationForLngLatZoom(d,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(b,s,d,f)}resize(b){var s;const d=this._containerDimensions(),f=d[0],m=d[1],x=this._getClampedPixelRatio(f,m);if(this._resizeCanvas(f,m,x),this.painter.resize(f,m,x),this.painter.overLimit()){const P=this.painter.context.gl;this._maxCanvasSize=[P.drawingBufferWidth,P.drawingBufferHeight];const D=this._getClampedPixelRatio(f,m);this._resizeCanvas(f,m,D),this.painter.resize(f,m,D)}this.transform.resize(f,m),(s=this._requestedCameraState)===null||s===void 0||s.resize(f,m);const M=!this._moving;return M&&(this.stop(),this.fire(new l.k("movestart",b)).fire(new l.k("move",b))),this.fire(new l.k("resize",b)),M&&this.fire(new l.k("moveend",b)),this}_getClampedPixelRatio(b,s){const{0:d,1:f}=this._maxCanvasSize,m=this.getPixelRatio(),x=b*m,M=s*m;return Math.min(x>d?d/x:1,M>f?f/M:1)*m}getPixelRatio(){var b;return(b=this._overridePixelRatio)!==null&&b!==void 0?b:devicePixelRatio}setPixelRatio(b){this._overridePixelRatio=b,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(b){return this.transform.setMaxBounds(ke.convert(b)),this._update()}setMinZoom(b){if((b=b??-2)>=-2&&b<=this.transform.maxZoom)return this.transform.minZoom=b,this._update(),this.getZoom()<b&&this.setZoom(b),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(b){if((b=b??22)>=this.transform.minZoom)return this.transform.maxZoom=b,this._update(),this.getZoom()>b&&this.setZoom(b),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(b){if((b=b??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(b>=0&&b<=this.transform.maxPitch)return this.transform.minPitch=b,this._update(),this.getPitch()<b&&this.setPitch(b),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(b){if((b=b??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(b>=this.transform.minPitch)return this.transform.maxPitch=b,this._update(),this.getPitch()>b&&this.setPitch(b),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(b){return this.transform.renderWorldCopies=b,this._update()}project(b){return this.transform.locationPoint(l.N.convert(b),this.style&&this.terrain)}unproject(b){return this.transform.pointLocation(l.P.convert(b),this.terrain)}isMoving(){var b;return this._moving||((b=this.handlers)===null||b===void 0?void 0:b.isMoving())}isZooming(){var b;return this._zooming||((b=this.handlers)===null||b===void 0?void 0:b.isZooming())}isRotating(){var b;return this._rotating||((b=this.handlers)===null||b===void 0?void 0:b.isRotating())}_createDelegatedListener(b,s,d){if(b==="mouseenter"||b==="mouseover"){let f=!1;return{layers:s,listener:d,delegates:{mousemove:x=>{const M=s.filter(D=>this.getLayer(D)),P=M.length!==0?this.queryRenderedFeatures(x.point,{layers:M}):[];P.length?f||(f=!0,d.call(this,new Pi(b,this,x.originalEvent,{features:P}))):f=!1},mouseout:()=>{f=!1}}}}if(b==="mouseleave"||b==="mouseout"){let f=!1;return{layers:s,listener:d,delegates:{mousemove:M=>{const P=s.filter(D=>this.getLayer(D));(P.length!==0?this.queryRenderedFeatures(M.point,{layers:P}):[]).length?f=!0:f&&(f=!1,d.call(this,new Pi(b,this,M.originalEvent)))},mouseout:M=>{f&&(f=!1,d.call(this,new Pi(b,this,M.originalEvent)))}}}}{const f=m=>{const x=s.filter(P=>this.getLayer(P)),M=x.length!==0?this.queryRenderedFeatures(m.point,{layers:x}):[];M.length&&(m.features=M,d.call(this,m),delete m.features)};return{layers:s,listener:d,delegates:{[b]:f}}}}_saveDelegatedListener(b,s){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[b]=this._delegatedListeners[b]||[],this._delegatedListeners[b].push(s)}_removeDelegatedListener(b,s,d){if(!this._delegatedListeners||!this._delegatedListeners[b])return;const f=this._delegatedListeners[b];for(let m=0;m<f.length;m++){const x=f[m];if(x.listener===d&&x.layers.length===s.length&&x.layers.every(M=>s.includes(M))){for(const M in x.delegates)this.off(M,x.delegates[M]);return void f.splice(m,1)}}}on(b,s,d){if(d===void 0)return super.on(b,s);const f=this._createDelegatedListener(b,typeof s=="string"?[s]:s,d);this._saveDelegatedListener(b,f);for(const m in f.delegates)this.on(m,f.delegates[m]);return this}once(b,s,d){if(d===void 0)return super.once(b,s);const f=typeof s=="string"?[s]:s,m=this._createDelegatedListener(b,f,d);for(const x in m.delegates){const M=m.delegates[x];m.delegates[x]=(...P)=>{this._removeDelegatedListener(b,f,d),M(...P)}}this._saveDelegatedListener(b,m);for(const x in m.delegates)this.once(x,m.delegates[x]);return this}off(b,s,d){return d===void 0?super.off(b,s):(this._removeDelegatedListener(b,typeof s=="string"?[s]:s,d),this)}queryRenderedFeatures(b,s){if(!this.style)return[];let d;const f=b instanceof l.P||Array.isArray(b),m=f?b:[[0,0],[this.transform.width,this.transform.height]];if(s=s||(f?{}:b)||{},m instanceof l.P||typeof m[0]=="number")d=[l.P.convert(m)];else{const x=l.P.convert(m[0]),M=l.P.convert(m[1]);d=[x,new l.P(M.x,x.y),M,new l.P(x.x,M.y),x]}return this.style.queryRenderedFeatures(d,s,this.transform)}querySourceFeatures(b,s){return this.style.querySourceFeatures(b,s)}setStyle(b,s){return(s=l.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},s)).diff!==!1&&s.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&b?(this._diffStyle(b,s),this):(this._localIdeographFontFamily=s.localIdeographFontFamily,this._updateStyle(b,s))}setTransformRequest(b){return this._requestManager.setTransformRequest(b),this}_getUIString(b){const s=this._locale[b];if(s==null)throw new Error(`Missing UI string '${b}'`);return s}_updateStyle(b,s){if(s.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(b,s));const d=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!b)),b?(this.style=new tu(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof b=="string"?this.style.loadURL(b,s,d):this.style.loadJSON(b,s,d),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new tu(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(b,s){if(typeof b=="string"){const d=this._requestManager.transformRequest(b,"Style");l.h(d,new AbortController).then(f=>{this._updateDiff(f.data,s)}).catch(f=>{f&&this.fire(new l.j(f))})}else typeof b=="object"&&this._updateDiff(b,s)}_updateDiff(b,s){try{this.style.setState(b,s)&&this._update(!0)}catch(d){l.w(`Unable to perform style diff: ${d.message||d.error||d}. Rebuilding the style from scratch.`),this._updateStyle(b,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():l.w("There is no style added to the map.")}addSource(b,s){return this._lazyInitEmptyStyle(),this.style.addSource(b,s),this._update(!0)}isSourceLoaded(b){const s=this.style&&this.style.sourceCaches[b];if(s!==void 0)return s.loaded();this.fire(new l.j(new Error(`There is no source with ID '${b}'`)))}setTerrain(b){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),b){const s=this.style.sourceCaches[b.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${b.source}`);this.terrain===null&&s.reload();for(const d in this.style._layers){const f=this.style._layers[d];f.type==="hillshade"&&f.source===b.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 Od(this.painter,s,b),this.painter.renderToTexture=new km(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!==b.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:b})),this}getTerrain(){var b,s;return(s=(b=this.terrain)===null||b===void 0?void 0:b.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const b=this.style&&this.style.sourceCaches;for(const s in b){const d=b[s]._tiles;for(const f in d){const m=d[f];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}removeSource(b){return this.style.removeSource(b),this._update(!0)}getSource(b){return this.style.getSource(b)}addImage(b,s,d={}){const{pixelRatio:f=1,sdf:m=!1,stretchX:x,stretchY:M,content:P,textFitWidth:D,textFitHeight:L}=d;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||l.b(s))){if(s.width===void 0||s.height===void 0)return this.fire(new l.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:B,height:V,data:W}=s,K=s;return this.style.addImage(b,{data:new l.R({width:B,height:V},new Uint8Array(W)),pixelRatio:f,stretchX:x,stretchY:M,content:P,textFitWidth:D,textFitHeight:L,sdf:m,version:0,userImage:K}),K.onAdd&&K.onAdd(this,b),this}}{const{width:B,height:V,data:W}=E.getImageData(s);this.style.addImage(b,{data:new l.R({width:B,height:V},W),pixelRatio:f,stretchX:x,stretchY:M,content:P,textFitWidth:D,textFitHeight:L,sdf:m,version:0})}}updateImage(b,s){const d=this.style.getImage(b);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 f=s instanceof HTMLImageElement||l.b(s)?E.getImageData(s):s,{width:m,height:x,data:M}=f;if(m===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(m!==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=!(s instanceof HTMLImageElement||l.b(s));return d.data.replace(M,P),this.style.updateImage(b,d),this}getImage(b){return this.style.getImage(b)}hasImage(b){return b?!!this.style.getImage(b):(this.fire(new l.j(new Error("Missing required image id"))),!1)}removeImage(b){this.style.removeImage(b)}loadImage(b){return le.getImage(this._requestManager.transformRequest(b,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(b,s){return this._lazyInitEmptyStyle(),this.style.addLayer(b,s),this._update(!0)}moveLayer(b,s){return this.style.moveLayer(b,s),this._update(!0)}removeLayer(b){return this.style.removeLayer(b),this._update(!0)}getLayer(b){return this.style.getLayer(b)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(b,s,d){return this.style.setLayerZoomRange(b,s,d),this._update(!0)}setFilter(b,s,d={}){return this.style.setFilter(b,s,d),this._update(!0)}getFilter(b){return this.style.getFilter(b)}setPaintProperty(b,s,d,f={}){return this.style.setPaintProperty(b,s,d,f),this._update(!0)}getPaintProperty(b,s){return this.style.getPaintProperty(b,s)}setLayoutProperty(b,s,d,f={}){return this.style.setLayoutProperty(b,s,d,f),this._update(!0)}getLayoutProperty(b,s){return this.style.getLayoutProperty(b,s)}setGlyphs(b,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(b,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(b,s,d={}){return this._lazyInitEmptyStyle(),this.style.addSprite(b,s,d,f=>{f||this._update(!0)}),this}removeSprite(b){return this._lazyInitEmptyStyle(),this.style.removeSprite(b),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(b,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(b,s,d=>{d||this._update(!0)}),this}setLight(b,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(b,s),this._update(!0)}getLight(){return this.style.getLight()}setSky(b){return this._lazyInitEmptyStyle(),this.style.setSky(b),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(b,s){return this.style.setFeatureState(b,s),this._update()}removeFeatureState(b,s){return this.style.removeFeatureState(b,s),this._update()}getFeatureState(b){return this.style.getFeatureState(b)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let b=0,s=0;return this._container&&(b=this._container.clientWidth||400,s=this._container.clientHeight||300),[b,s]}_setupContainer(){const b=this._container;b.classList.add("maplibregl-map");const s=this._canvasContainer=T.create("div","maplibregl-canvas-container",b);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=T.create("canvas","maplibregl-canvas",s),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const d=this._containerDimensions(),f=this._getClampedPixelRatio(d[0],d[1]);this._resizeCanvas(d[0],d[1],f);const m=this._controlContainer=T.create("div","maplibregl-control-container",b),x=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(M=>{x[M]=T.create("div",`maplibregl-ctrl-${M} `,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(b,s,d){this._canvas.width=Math.floor(d*b),this._canvas.height=Math.floor(d*s),this._canvas.style.width=`${b}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const b={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let s=null;this._canvas.addEventListener("webglcontextcreationerror",f=>{s={requestedAttributes:b},f&&(s.statusMessage=f.statusMessage,s.type=f.type)},{once:!0});const d=this._canvas.getContext("webgl2",b)||this._canvas.getContext("webgl",b);if(!d){const f="Failed to initialize WebGL";throw s?(s.message=f,new Error(JSON.stringify(s))):new Error(f)}this.painter=new yu(d,this.transform),I.testSupport(d)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(b){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||b,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(b){return this._update(),this._renderTaskQueue.add(b)}_cancelRenderFrame(b){this._renderTaskQueue.remove(b)}_render(b){const s=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(b),this._removed)return;let d=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,x=E.now();this.style.zoomHistory.update(m,x);const M=new l.z(m,{now:x,fadeDuration:s,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,s,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new l.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.bf.mark(l.bg.load),this.fire(new l.k("load"))),this.style&&(this.style.hasTransitions()||d)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const f=this._sourcesDirty||this._styleDirty||this._placementDirty;return f||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.k("idle")),!this._loaded||this._fullyLoaded||f||(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 b;this._hash&&this._hash.remove();for(const d of this._controls)d.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),le.removeThrottleControl(this._imageQueueHandle),(b=this._resizeObserver)===null||b===void 0||b.disconnect();const s=this.painter.context.gl.getExtension("WEBGL_lose_context");s!=null&&s.loseContext&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),T.remove(this._canvasContainer),T.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(b=>{l.bf.frame(b),this._frameRequest=null,this._render(b)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(b){this._showTileBoundaries!==b&&(this._showTileBoundaries=b,this._update())}get showPadding(){return!!this._showPadding}set showPadding(b){this._showPadding!==b&&(this._showPadding=b,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(b){this._showCollisionBoxes!==b&&(this._showCollisionBoxes=b,b?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(b){this._showOverdrawInspector!==b&&(this._showOverdrawInspector=b,this._update())}get repaint(){return!!this._repaint}set repaint(b){this._repaint!==b&&(this._repaint=b,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(b){this._vertices=b,this._update()}get version(){return Sm}getCameraTargetElevation(){return this.transform.elevation}},u.MapMouseEvent=Pi,u.MapTouchEvent=Yo,u.MapWheelEvent=ym,u.Marker=Mu,u.NavigationControl=class{constructor(b){this._updateZoomButtons=()=>{const s=this._map.getZoom(),d=s===this._map.getMaxZoom(),f=s===this._map.getMinZoom();this._zoomInButton.disabled=d,this._zoomOutButton.disabled=f,this._zoomInButton.setAttribute("aria-disabled",d.toString()),this._zoomOutButton.setAttribute("aria-disabled",f.toString())},this._rotateCompassArrow=()=>{const s=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=s},this._setButtonTitle=(s,d)=>{const f=this._map._getUIString(`NavigationControl.${d}`);s.title=f,s.setAttribute("aria-label",f)},this.options=l.e({},x_,b),this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",s=>s.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",s=>this._map.zoomIn({},{originalEvent:s})),T.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",s=>this._map.zoomOut({},{originalEvent:s})),T.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",s=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:s}):this._map.resetNorth({},{originalEvent:s})}),this._compassIcon=T.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(b){return this._map=b,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 b_(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){T.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(b,s){const d=T.create("button",b,this._container);return d.type="button",d.addEventListener("click",s),d}},u.Popup=class extends l.E{constructor(b){super(),this.remove=()=>(this._content&&T.remove(this._content),this._container&&(T.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new l.k("close"))),this),this._onMouseUp=s=>{this._update(s.point)},this._onMouseMove=s=>{this._update(s.point)},this._onDrag=s=>{this._update(s.point)},this._update=s=>{var d;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=T.create("div","maplibregl-popup",this._map.getContainer()),this._tip=T.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?Ln(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.wrap(),this._trackPointer&&!s)return;const f=this._flatPos=this._pos=this._trackPointer&&s?s:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&s?s:this._map.transform.locationPoint(this._lngLat));let m=this.options.anchor;const x=Pu(this.options.offset);if(!m){const P=this._container.offsetWidth,D=this._container.offsetHeight;let L;L=f.y+x.bottom.y<D?["top"]:f.y>this._map.transform.height-D?["bottom"]:[],f.x<P/2?L.push("left"):f.x>this._map.transform.width-P/2&&L.push("right"),m=L.length===0?"bottom":L.join("-")}let M=f.add(x[m]);this.options.subpixelPositioning||(M=M.round()),T.setTransform(this._container,`${Ya[m]} translate(${M.x}px,${M.y}px)`),Tu(this._container,m,"popup")},this._onClose=()=>{this.remove()},this.options=l.e(Object.create(Et),b)}addTo(b){return this._map&&this.remove(),this._map=b,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(b){return this._lngLat=l.N.convert(b),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(b){return this.setDOMContent(document.createTextNode(b))}setHTML(b){const s=document.createDocumentFragment(),d=document.createElement("body");let f;for(d.innerHTML=b;f=d.firstChild,f;)s.appendChild(f);return this.setDOMContent(s)}getMaxWidth(){var b;return(b=this._container)===null||b===void 0?void 0:b.style.maxWidth}setMaxWidth(b){return this.options.maxWidth=b,this._update(),this}setDOMContent(b){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=T.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(b),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(b){return this._container&&this._container.classList.add(b),this}removeClassName(b){return this._container&&this._container.classList.remove(b),this}setOffset(b){return this.options.offset=b,this._update(),this}toggleClassName(b){if(this._container)return this._container.classList.toggle(b)}setSubpixelPositioning(b){this.options.subpixelPositioning=b}_createCloseButton(){this.options.closeButton&&(this._closeButton=T.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const b=this._container.querySelector(Au);b&&b.focus()}},u.RasterDEMTileSource=hn,u.RasterTileSource=Kt,u.ScaleControl=class{constructor(b){this._onMove=()=>{ec(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,ec(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Ps),b)}getDefaultPosition(){return"bottom-left"}onAdd(b){return this._map=b,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-scale",b.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){T.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},u.ScrollZoomHandler=ts,u.Style=tu,u.TerrainControl=class{constructor(b){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=b}onAdd(b){return this._map=b,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=T.create("button","maplibregl-ctrl-terrain",this._container),T.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(){T.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},u.TwoFingersTouchPitchHandler=Ha,u.TwoFingersTouchRotateHandler=Td,u.TwoFingersTouchZoomHandler=Ed,u.TwoFingersTouchZoomRotateHandler=Ad,u.VectorTileSource=Ss,u.VideoSource=Dr,u.addSourceType=(b,s)=>l._(void 0,void 0,void 0,function*(){if(Cs(b))throw new Error(`A source type called "${b}" already exists.`);((d,f)=>{Es[d]=f})(b,s)}),u.clearPrewarmedResources=function(){const b=Te;b&&(b.isPreloaded()&&b.numActive()===1?(b.release(Wn),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 jn.workerCount},u.getWorkerUrl=function(){return l.a.WORKER_URL},u.importScriptInWorkers=function(b){return Bt().broadcast("IS",b)},u.prewarm=function(){Xe().acquire(Wn)},u.setMaxParallelImageRequests=function(b){l.a.MAX_PARALLEL_IMAGE_REQUESTS=b},u.setRTLTextPlugin=function(b,s){return zr().setRTLTextPlugin(b,s)},u.setWorkerCount=function(b){jn.workerCount=b},u.setWorkerUrl=function(b){l.a.WORKER_URL=b}});var a=n;return a})})(V1);var Nz=V1.exports;const Bz=Rz(Nz),Rp=["#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"],Er={};async function Lp(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 Vz(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)}`}Er.point=async(t={},e={},n=null)=>{var E,T,I,z,F,j,Z,ie,le,J,Ee,be;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=((T=t.style)==null?void 0:T.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=((z=t.style)==null?void 0:z.color)||"blue";!((F=t.style)!=null&&F.iconAttr)&&(r!=null&&r.includes("{{marker}}"))&&(r=r.replace("{{marker}}","fa-star"));const g="gray",_=(Ae,Le)=>`${Ae==null?void 0:Ae.split("+")[0]}+${Le.replace("#","")}.png`;if(t.legendAuto={icon:[],color:[]},(j=t.style)!=null&&j.iconAttr&&r){const Ae=(ie=(Z=t.meta)==null?void 0:Z.columns)==null?void 0:ie.find(Pe=>{var Ye;return Pe.name===((Ye=t==null?void 0:t.style)==null?void 0:Ye.iconAttr)}),Le=(Ae==null?void 0:Ae.values)||await xt.get(`/api-user/gis-ir/${t.id}/${(le=t.style)==null?void 0:le.iconAttr}`).then(Pe=>Pe.data.rows);if(Le!=null&&Le.length){const Pe=r.replace("{{color}}",l.length?l:Vz(l)||[0]).split("+")[1].split(/[.-]/)[0];Le.forEach((Ye,it)=>{var Nt;return Ye.icon=(Nt=Ye.icon)!=null&&Nt.includes("png")?Ye.icon:`${a}-${u}-${Ye.data||Ye.icon||`ub-${it}`}+${r!=null&&r.includes("circle")?"ddd-222":Pe}.png`}),r=r!=null&&r.includes("{{")?`${a}-${u}-fa-question+0c53ad.png`:r,t.legendAuto.iconText=(Ae==null?void 0:Ae.title)||t.style.iconAttr,Le.forEach(Ye=>t.legendAuto.icon.push(Ye)),t.legendAuto.icon.push({icon:r,text:"Не визначено"}),t.style.iconArr=["match",["get",t.style.iconAttr]].concat(Le.filter(Ye=>Ye.id).reduce((Ye,it)=>Ye.concat([it.id,it.icon]),[])).concat([r]),await Promise.all(Le.map(Ye=>Ye.icon).map(Ye=>Lp(Ye,n))),await Lp(r,n)}else r=i?"pin6-m-fa-star+{{color}}.png":`pin6-m-fa-star+${l==null?void 0:l.replace("#","")}.png`}if(r!=null&&r.includes("{{color}}")?r=r.replace("{{color}}","222"):e!=null&&e.icon&&e.iconAttr,i){const Ae=(Ee=(J=t.meta)==null?void 0:J.columns)==null?void 0:Ee.find(Pe=>Pe.name===i),Le=(Ae==null?void 0:Ae.values)||await xt.get(`/api-user/gis-ir/${t.id}/${i}`).then(Pe=>Pe.data.rows);t.style.color=Le!=null&&Le.length?["match",["get",i]].concat(Le.filter(Pe=>Pe.id).reduce((Pe,Ye,it)=>Pe.concat([Ye.id,Ye.color||Rp[it]]),[])).concat(["#aaa"]):l,t.style.colorArr=t.style.color,t.legendAuto.colorText=(Ae==null?void 0:Ae.title)||i,Le.forEach(Pe=>t.legendAuto.color.push(Pe)),t.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),!((be=t.style)!=null&&be.iconAttr)&&!(r!=null&&r.includes("+sdf"))&&r&&(Le.forEach((Pe,Ye)=>Pe.icon=_(r,Pe.color||Rp[Ye])),t.style.iconArr=["match",["get",i]].concat(Le.filter(Pe=>Pe.id).reduce((Pe,Ye)=>Pe.concat([Ye.id,Ye.icon]),[])).concat([_(r,g)]),await Promise.all(Le.map(Pe=>Pe.icon).map(Pe=>Lp(Pe,n))))}if(r&&!(r!=null&&r.includes("{"))){const Ae=e!=null&&e.colorAttr?_(r,g):r;await Lp(Ae,n)}const S=r!=null&&r.includes("sdf")?["interpolate",["linear"],["zoom"],14,.1,18,.2]:["interpolate",["linear"],["zoom"],14,.7,16,1];return e.iconOffset=r!=null&&r.includes("pin")?[0,r!=null&&r.includes("+sdf")?-96:-20]:null,[{id:`${t.id}`,source:t.id,type:"circle",cluster:!0,lsource:e==null?void 0:e.lsource,minzoom:(e==null?void 0:e.minzoom)!==void 0?+(e==null?void 0:e.minzoom):4,maxzoom:(r!=null&&r.includes("+sdf")||!(r!=null&&r.includes("circle"))&&!(r!=null&&r.includes("none"))?+e.iconZoom:null)||+(e==null?void 0:e.maxzoom)||24,filter:["all",["==",["geometry-type"],"Point"],["!",["has","point_count"]]],paint:{"circle-stroke-width":["case",["boolean",["feature-state","select"],!1],(e==null?void 0:e.strokeWidth)||1,["boolean",["feature-state","hover"],!1],2,(e==null?void 0:e.strokeWidth)||1],"circle-stroke-color":["case",["boolean",["feature-state","select"],!1],(e==null?void 0:e.stroke)||(e==null?void 0:e.color)||"#fff",["boolean",["feature-state","hover"],!1],"maroon",(e==null?void 0:e.stroke)||(e==null?void 0:e.color)||"#fff"],"circle-opacity":(e.iconZoom?["interpolate",["exponential",.5],["zoom"],+e.iconZoom-1,1,+e.iconZoom,r!=null&&r.includes("none")?.3:0]:null)||e.opacity||1,"circle-color":e.color||["case",["boolean",["feature-state","hover"],!1],"red","blue"],"circle-radius":(Array.isArray(e.width)?{stops:e.width}:null)||e.width||{stops:e.iconZoom?[[+e.iconZoom,4],[+e.iconZoom,8],[18,16]]:[[13,4],[15,8],[18,12]]}}}].concat(e.iconArr||e.icon?[{id:`${t.id}-5`,source:t.id,lsource:e==null?void 0:e.lsource,type:"symbol",minzoom:+e.iconZoom||16,filter:["all",["!",["has","point_count"]]],layout:{"icon-image":e!=null&&e.colorAttr&&e.iconArr||r,"icon-allow-overlap":!0,...e.iconOffset?{"icon-offset":e.iconOffset||!1}:{},...S?{"icon-size":S||!1}:{}},paint:{"icon-opacity":["case",["boolean",["feature-state","hover"],!1],.5,["boolean",["feature-state","select"],!1],.5,(r!=null&&r.includes("+sdf")?1:null)||(r!=null&&r.includes("circle")?.6:1)],...r!=null&&r.includes("+sdf")?{"icon-color":["case",["boolean",["feature-state","hover"],!1],"#cd0bbf",["boolean",["feature-state","select"],!1],"#8517cf",e.color||"#aa0000"]}:{}}}]:[]).concat(e.label?[{id:`${t.id}-4`,source:t.id,lsource:e==null?void 0:e.lsource,type:"symbol",minzoom:14,filter:["!",["has","point_count"]],layout:{"text-field":e.label,"text-font":["Open Sans Regular"],"text-size":e["text-size"]||8},paint:{"text-color":e["text-color"]||"#ffffff","text-halo-color":e["text-halo-color"]||"black"}}]:[]).concat(t.cluster||e.clusterMaxZoom?[{id:`${t.id}-1`,source:t.id,lsource:e==null?void 0:e.lsource,type:"circle",filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],"#51bbd6",100,"#f1f075",750,"#f28cb1"],"circle-radius":["step",["get","point_count"],20,100,30,750,40]}},{id:`${t.id}-2`,source:t.id,lsource:e==null?void 0:e.lsource,type:"symbol",filter:["has","point_count"],layout:{"text-field":"{point_count_abbreviated}","text-font":["Open Sans Regular"],"text-size":12}}]:[])},Er.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"}}],Er.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 _=((l=(u=t.meta)==null?void 0:u.columns.find(S=>S.name===i))==null?void 0:l.values)||await xt.get(`/api-user/gis-ir/${t.id}/${i}`).then(S=>S.data.rows);t.legendAuto={color:[]},_.forEach(S=>t.legendAuto.color.push(S)),t.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),t.style.color=_?["match",["get",i]].concat(_.filter(S=>S.id).reduce((S,E,T)=>S.concat([E.id,E.color||Rp[T]]),[])).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]}}]:[])},Er.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}}]:[]),Er.linestring=Er.line,Er.circle=Er.point;async function Fz(t,e,n){var l,g,_,S,E,T,I,z,F,j,Z,ie;typeof e.style=="string"&&(e.style=e.style[0]==="{"?JSON.parse(e.style):(l=window.YAML.parse(e.style))==null?void 0:l.style),(_=(g=e.style)==null?void 0:g.filter)==null||_.call(g,le=>le.source).forEach(le=>{le.lsource=`${e.id}-${le.source}`});const i=((S=e==null?void 0:e.style)==null?void 0:S.type)||((Z=((I=(T=(E=e==null?void 0:e.meta)==null?void 0:E.geom)==null?void 0:T.geometry)==null?void 0:I.length)>2?["point"]:[((j=(F=(z=e==null?void 0:e.meta)==null?void 0:z.geom)==null?void 0:F.geometry)==null?void 0:j[0].toLowerCase())||"point"])==null?void 0:Z.map(le=>{var J;return(J=le==null?void 0:le.replace)==null?void 0:J.call(le,"multi","")})),r=Array.isArray(i)?i:[i],a=(await Promise.all(Array.isArray(e==null?void 0:e.style)?e.style.map(async le=>{var J;return(J=Er[le.type])==null?void 0:J.call(Er,e,le,n)}):r.map(async le=>{var J;return(J=Er[le])==null?void 0:J.call(Er,e,e.style,n)}))).reduce((le,J)=>J?le.concat(J):le,[]);a.forEach((le,J)=>{le.id=`${le.id}-${J}`});const u=a;return(e.service==="vtile"||(ie=e.url)!=null&&ie.includes(".vmt"))&&u.forEach(le=>{le.layout||(le.layout={}),le.layout.visibility="visible",le["source-layer"]=le.lsource||e.data||t}),u}const $z={data(){return{layerList:[],layerObj:{},colors:Rp,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(_=>_.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(_=>_.id===l.id?{..._,visible:e}:_),g.forEach(_=>{a.setLayoutProperty(_.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 xt.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 xt.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,_,S,E;const{map:i}=this,r=await Fz(t.id,this.layerList.find(T=>T.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}`:""}${(_=t==null?void 0:t.style)!=null&&_.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(T=>{var z;const I={...T,source:t.id,maxzoom:+(T==null?void 0:T.maxzoom)||24,minzoom:+(T==null?void 0:T.minzoom)||0,cluster:!1,clusterMaxZoom:2};i.addLayer(I),i.moveLayer(T.id),(z=T==null?void 0:T.layout)!=null&&z["text-field"]||this.apiLayersHover(T.id,t.id,i),this.addedLayersSettings=this.addedLayersSettings.concat(I)});const u=r.map(T=>T.type).filter(T=>T&&T!=="symbol");(E=(S=t==null?void 0:t.meta)==null?void 0:S.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 xt.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 xt.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)}}},jz={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}}},Uz={key:0,class:"vsTailwind map-popup__vertical"},Hz={class:"mb-1"},qz={class:"text-sm"},Wz={key:1,class:"map__popup-body"},Gz=["innerHTML"],Zz={key:1};function Yz(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("div",{class:"map-popup",style:v.normalizeStyle({"max-width":a.popupWidth,width:a.popupWidth})},[a.positionIsVertical?(v.openBlock(),v.createElementBlock("div",Uz,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(a.popupRows,u=>(v.openBlock(),v.createElementBlock("div",{class:"border-b py-1 last:border-none last:pt-1 last:pb-0",key:a.rowTitle(u)},[v.createElementVNode("strong",Hz,v.toDisplayString(a.rowTitle(u)),1),v.createElementVNode("div",qz,v.toDisplayString(a.rowValue(u)),1)]))),128))])):(v.openBlock(),v.createElementBlock("table",Wz,[v.createElementVNode("tbody",null,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(a.popupRows,u=>v.withDirectives((v.openBlock(),v.createElementBlock("tr",{key:a.rowTitle(u),class:"map__popup-body-item"},[v.createElementVNode("td",null,v.toDisplayString(a.rowTitle(u)),1),a.rowValue(u)?(v.openBlock(),v.createElementBlock("td",{key:0,innerHTML:a.rowValue(u)},null,8,Gz)):(v.openBlock(),v.createElementBlock("td",Zz,e[0]||(e[0]=[v.createElementVNode("div",{class:"text-red-500"}," Не визначено ",-1)])))])),[[v.vShow,!a.rowValue(u).includes("id")]])),128))])]))],4)}const Xz=at(jz,[["render",Yz],["__scopeId","data-v-3f5a9aff"]]),F1={width:200,show:!0,position:"horizontal"},Kz={components:{VsPopupBody:Xz},props:{aviableFields:{type:Array,default:()=>[]},mapRef:{type:[Object,Array],default:()=>{}},object:{type:[Object,Array],default:()=>{}}},data(){return{objectData:[],popupSettings:F1}},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,_,S,E,T,I;if(!t)return;const e=Object.keys(t.properties).filter(z=>!z.match("__text")&&!["id"].includes(z)),{currentLayer:n}=this;if((g=n==null?void 0:n.setting)!=null&&g.popup&&(this.popupSettings=(n==null?void 0:n.setting.popup)||F1),!(n!=null&&n.meta)){const z=e.map(F=>({title:F,value:t.properties[F]}));this.objectData=[...z,{value:((_=t.properties)==null?void 0:_.image)||"",title:"Фото",column:"image"}];return}const i=n.meta.columns,r=e.map(z=>{var le,J,Ee,be;const F={},Z=Object.assign({values:[]},i.find(Ae=>Ae.name===z));typeof Z.values!="object"&&console.warn(`Warning: Layer ${t.source} has key "values" which is not an object in meta!`);const ie=Z!=null&&Z.values&&((le=Z==null?void 0:Z.values)==null?void 0:le.find(Ae=>(Ae==null?void 0:Ae.id)==t.properties[z]))||null;return F.value=(Z==null?void 0:Z.format)==="select"?this.formatBadge({text:(ie==null?void 0:ie.text)||((J=t.properties)==null?void 0:J[`${z}__text`])||((Ee=t.properties)==null?void 0:Ee[z])||"-",color:(ie==null?void 0:ie.color)||"#1989FA"}):(ie==null?void 0:ie.text)||((be=t.properties)==null?void 0:be[`${z}__text`])||t.properties[z],F.column=z,F.title=(Z==null?void 0:Z[window==null?void 0:window.lang])||(Z==null?void 0:Z.ua)||(Z==null?void 0:Z.title)||z,F});this.objectData=[...r,{value:((S=t.properties)==null?void 0:S.image)||"",title:"Фото",column:"image"}];const a=(T=(E=n==null?void 0:n.setting)==null?void 0:E.popup)==null?void 0:T.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(z=>l.includes(z.column)||l.includes(z.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}}},Jz={key:0},Qz={key:0},eR=["src","alt"],tR={key:1},nR={class:"text-left text-sm m-b-sm"},iR={key:1,class:"text-center"};function rR(t,e,n,i,r,a){var l,g,_,S,E,T,I,z,F,j,Z;const u=v.resolveComponent("VsPopupBody");return v.openBlock(),v.createElementBlock("div",{class:v.normalizeClass((((l=r.popupSettings)==null?void 0:l.position)||"horizontal")+"-position")},[r.objectData.filter(ie=>ie.column!=="image").length?(v.openBlock(),v.createElementBlock("div",Jz,[a.getImage&&((g=a.getImage)!=null&&g.value)?(v.openBlock(),v.createElementBlock("div",Qz,[v.createElementVNode("img",{class:"popup-image",src:"files/"+a.getImage.value,alt:a.getImage.column},null,8,eR)])):v.createCommentVNode("",!0),v.createVNode(u,{"object-data":r.objectData,object:n.object,mapRef:n.mapRef},null,8,["object-data","object","mapRef"])])):(v.openBlock(),v.createElementBlock("div",tR,[(_=a.noInfoObject())!=null&&_.column?(v.openBlock(),v.createElementBlock(v.Fragment,{key:0},[v.createElementVNode("b",nR,v.toDisplayString(a.noInfoObject().title),1),v.createElementVNode("div",null,[v.createElementVNode("b",null,v.toDisplayString(((E=(S=a.noInfoObject())==null?void 0:S.column)==null?void 0:E.ua)||((I=(T=a.noInfoObject())==null?void 0:T.column)==null?void 0:I.title))+":",1),v.createTextVNode(" "+v.toDisplayString(((Z=(z=n.object)==null?void 0:z.properties)==null?void 0:Z[(j=(F=a.noInfoObject())==null?void 0:F.column)==null?void 0:j.name])||"-"),1)])],64)):(v.openBlock(),v.createElementBlock("div",iR,v.toDisplayString(a.noInfoObject().title),1))]))],2)}const sR=at(Kz,[["render",rR],["__scopeId","data-v-deb51e0a"]]),{Map:oR,NavigationControl:aR,Popup:lR}=Bz,cR={mixins:[$z],components:{VsMapPopup:sR},props:{popupVisible:{type:Boolean,default:()=>!0},map:{type:Object,default:()=>null},height:{type:String,default:()=>"400px"}},data(){var t,e,n,i;return{mapId:`gis-map-${Math.floor(Math.random()*1e3)}`,features:[],katottg:((e=(t=window==null?void 0:window.setting)==null?void 0:t.map)==null?void 0:e.katottg)||((i=(n=window==null?void 0:window.setting)==null?void 0:n.map)==null?void 0:i.city_katottg),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 oR({container:this.mapId,style:t,center:[0,0],zoom:1,interactive:!0});e.addControl(new aR({visualizePitch:!0})),window==null||window.addEventListener("resize",()=>{e.resize()}),e.on("load",this.onMapLoad)},async onMapLoad(t){const e=t.target;e.resize();const n={id:"graymap",name:"Сіра карта",url:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",attribution:"© <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, © <a href='https://carto.com/attributions'>CARTO</a>",bounds1:"ua",image:"https://basemaps.cartocdn.com/light_all/10/601/348.png",position:0,owner:"OSM",basemap:!0};await this.$emit("update:map",e),await this.setVisible(n,!0),this.$emit("load",e),this.createPopup(),this.createBoundsLayers(),this.createAtuLayer()},createPopup(){var n,i,r,a,u,l;const{map:t}=this,e=["measure","katottg","geometry","mapbox-gl-draw-hot","mapbox-gl-draw-cold"];this.popup.map=new lR({closeOnClick:!1}).setDOMContent((i=(n=this==null?void 0:this.$refs)==null?void 0:n.popup)==null?void 0:i.$el),t&&(t.on("mousemove",g=>{var S,E;const _=t.queryRenderedFeatures(g.point).filter(T=>{var F,j,Z;const I=this.layerList.find(ie=>ie.id===T.source),z=((j=(F=I==null?void 0:I.setting)==null?void 0:F.popup)==null?void 0:j.show)===void 0?!0:I.setting.popup.show;if((this.interactiveSources.includes(T.source)&&!((Z=T.properties)!=null&&Z.cluster)&&z||!I&&Object.keys(T.properties).length)&&!e.includes(T.source))return T}).filter(T=>{var I,z;return!((z=(I=T.layer)==null?void 0:I.layout)!=null&&z["text-field"])});_.length&&this.popupVisible?(this.features=(_==null?void 0:_[0])||null,(S=this.popup.map)==null||S.setLngLat(Object.values(g.lngLat)).addTo(t),t.getCanvas().style.cursor=_.length?"pointer":"grab"):(this.features=null,(E=this.popup.map)==null||E.remove()),this.$emit("mouseMove",{event:g,features:_})}),t.on("touchend",this.handleMapClick),t.on("click",this.handleMapClick),t.on("dblclick",g=>{const _=t.queryRenderedFeatures(g.point);this.$emit("dbclick",{features:_,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})},async createAtuLayer(){try{const t=this.katottg,{map:e}=this;if(!e){console.warn("Map error: Map hasn't loaded");return}const{data:n}=await xt.get(`https://data.gki.com.ua/api-user/atu/${t}`),i=N1(n);this.cityBbox=i,e.addSource("atu",{type:"geojson",data:n}),e.addLayer({id:"atu",type:"line",source:"atu",paint:{"line-color":"#3b82f6","line-width":2}})}catch(t){console.error(t)}}}},uR={class:"relative"},hR=["id"];function dR(t,e,n,i,r,a){const u=v.resolveComponent("VsMapPopup");return v.openBlock(),v.createElementBlock("div",uR,[v.createElementVNode("div",{id:r.mapId,style:v.normalizeStyle({height:n.height})},null,12,hR),v.createVNode(u,{ref:"popup",object:r.features,"map-ref":a.mapRef},null,8,["object","map-ref"])])}const pR=at(cR,[["render",dR]]),Qs="widget-map-source",fR={components:{VsMap:pR},props:{geometry:{type:Object,default:()=>null},zoom:{type:String,default:()=>"50"}},data(){return{map:null}},mounted(){this.geometry&&this.initGeometryLayer()},watch:{geometry(){console.log(this.zoom),this.initGeometryLayer()}},methods:{initMap(){this.geometry&&this.map&&this.initGeometryLayer()},handleMapLoad(){this.initMap()},initGeometryLayer(){const{map:t}=this;if(!t)return;const e=this.formatGeojson(this.geometry),n=t.getSource(Qs);if(this.zoomToGeometry(e),n){n.setData(e);return}t.addSource(Qs,{type:"geojson",data:e}),t.addLayer({id:`${Qs}-point`,type:"circle",source:Qs,paint:{"circle-radius":10,"circle-color":"#F84C4C"},filter:["==","$type","Point"]}),t.addLayer({id:`${Qs}-polygon`,type:"fill",source:Qs,layout:{},paint:{"fill-color":"#0080ff","fill-opacity":.5},filter:["==","$type","Polygon"]}),t.addLayer({id:`${Qs}-polygon-line`,type:"line",source:Qs,layout:{},paint:{"line-color":"#0080ff","line-width":2},filter:["==","$type","Polygon"]}),t.addLayer({id:`${Qs}-line`,type:"line",source:Qs,layout:{},paint:{"line-color":"#0080ff","line-width":3},filter:["==","$type","LineString"]})},formatGeojson(t){let e=t;const n=t==null?void 0:t.type;if(Array.isArray(t))return B1(t);if(!n)throw new Error("Unknown geometry type!");return n==="FeatureCollection"?t:(n==="Feature"&&(e=[t]),!["FeatureCollection","Feature"].includes(n)&&(e=[Lz(t)]),B1(e))},zoomToGeometry(t){const{map:e}=this,n=N1(t);e.fitBounds(n,{zoom:this.zoom,padding:30,duration:0})}}};function mR(t,e,n,i,r,a){const u=v.resolveComponent("VsMap");return v.openBlock(),v.createElementBlock("div",null,[v.createVNode(u,{map:r.map,"onUpdate:map":e[0]||(e[0]=l=>r.map=l),onLoad:a.handleMapLoad},null,8,["map","onLoad"])])}const gR=at(fR,[["render",mR]]),st=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),iy=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},Np=function(t,e=void 0){return!(!t||t===document.body||e&&t===e)&&(iy(t)?t:Np(t.parentElement,e))},eo=function(t){var e=new DOMParser().parseFromString(t,"text/html").body;if(e.childElementCount>1){for(var n=document.createElement("div");e.firstChild;)n.appendChild(e.firstChild);return n}return e.firstChild},ry=t=>`${t||""}`.split(" ").filter(e=>!!e),to=(t,e,n)=>{t&&ry(e).forEach(i=>{t.classList.toggle(i,n||!1)})};class Sc{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 Ec={passive:!1};class yR{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,Ec),this.element.addEventListener("touchstart",this.onTouchStart,Ec),this.element.addEventListener("touchmove",this.onMove,Ec),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd)}onPointerStart(e){if(!e.buttons||e.button!==0)return;const n=new Sc(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 Sc(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 Sc(a)):[new Sc(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 Sc(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 Sc(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,Ec),this.element.removeEventListener("touchstart",this.onTouchStart,Ec),this.element.removeEventListener("touchmove",this.onMove,Ec),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 $1(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function j1(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const sy=t=>typeof t=="object"&&t!==null&&t.constructor===Object&&Object.prototype.toString.call(t)==="[object Object]",Cr=(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}),sy(u)?Object.assign(t[a],Cr(l,u)):Array.isArray(u)?Object.assign(t,{[a]:[...u]}):Object.assign(t,{[a]:u})})}return t},oy=function(t,e){return t.split(".").reduce((n,i)=>typeof n=="object"?n[i]:void 0,e)};class Bp{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?Cr({},this.constructor.defaults,e):{};for(const[n,i]of Object.entries(this.option("on")||{}))this.on(n,i)}option(e,...n){let i=oy(e,this.options);return i&&typeof i=="function"&&(i=i.call(this,this,...n)),i}optionFor(e,n,i,...r){let a=oy(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=oy(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(Bp,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(Bp,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class ay extends Bp{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 An;(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"})(An||(An={}));const Po=["a","b","c","d","e","f"],U1={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"},_R={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:U1},H1='<circle cx="25" cy="25" r="20"></circle>',ly='<div class="f-spinner"><svg viewBox="0 0 50 50">'+H1+H1+"</svg></div>",Tr=t=>t&&t!==null&&t instanceof Element&&"nodeType"in t,kn=(t,e)=>{t&&ry(e).forEach(n=>{t.classList.remove(n)})},Ct=(t,e)=>{t&&ry(e).forEach(n=>{t.classList.add(n)})},Vp={a:1,b:0,c:0,d:1,e:0,f:0},xR=1e5,Fp=1e4,ps="mousemove",q1="drag",W1="content",fs="auto";let cy=null,uy=null;class ua extends ay{get fits(){return this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1}get isTouchDevice(){return uy===null&&(uy=window.matchMedia("(hover: none)").matches),uy}get isMobile(){return cy===null&&(cy=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),cy}get panMode(){return this.options.panMode!==ps||this.isTouchDevice?q1:ps}get panOnlyZoomed(){const e=this.options.panOnlyZoomed;return e===fs?this.isTouchDevice:e}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:e,b:n}=this.current;return Math.sqrt(e*e+n*n)||1}get targetScale(){const{a:e,b:n}=this.target;return Math.sqrt(e*e+n*n)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:e}=this;return e.fullWidth/e.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:e,contentRect:n}=this,i=Math.max(e.height/n.fitHeight,e.width/n.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const e=this.content;return!!(e&&e instanceof HTMLImageElement)&&!e.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const e of Po){const n=e=="e"||e==="f"?1e-4:1e-5;if(Math.abs(this.target[e]-this.current[e])>n)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(e,n={},i={}){var r;if(super(n),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pwt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"cwd",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"pmme",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:An.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({},Vp)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},Vp)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!e)throw new Error("Container Element Not Found");this.container=e,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},ua.Plugins),i)),this.emit("attachPlugins"),this.emit("init");const a=this.content;if(a.addEventListener("load",this.onLoad),a.addEventListener("error",this.onError),this.isContentLoading){if(this.option("spinner")){e.classList.add(this.cn("isLoading"));const u=eo(ly);!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(W1);let i=this.option(W1)||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===An.Init?this.enable():this.updateMetrics()}onError(){this.state!==An.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=An.Error,this.emit("error"))}getNextScale(e){const{fullScale:n,targetScale:i,coverScale:r,maxScale:a,minScale:u}=this;let l=u;switch(e){case"toggleMax":l=i-u<.5*(a-u)?a:u;break;case"toggleCover":l=i-u<.5*(r-u)?r:u;break;case"toggleZoom":l=i-u<.5*(n-u)?n:u;break;case"iterateZoom":let g=[1,n,a].sort((S,E)=>S-E),_=g.findIndex(S=>S>i+1e-5);l=g[_]||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 yR(e,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener(ps,this.onMouseMove)}detachEvents(){var e;const{container:n}=this;n.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),n.removeEventListener("wheel",this.onWheel,{passive:!1}),(e=this.pointerTracker)===null||e===void 0||e.stop(),this.pointerTracker=null,document.removeEventListener(ps,this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const e=this.friction,n=this.option("maxVelocity");for(const i of Po)e?(this.velocity[i]*=1-e,n&&!this.isScaling&&(this.velocity[i]=Math.max(Math.min(this.velocity[i],n),-1*n)),this.current[i]+=this.velocity[i]):this.current[i]=this.target[i];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame(()=>this.animate()):this.stop("current")}setTargetForce(){for(const e of Po)e==="e"&&this.isBouncingX||e==="f"&&this.isBouncingY||(this.velocity[e]=(1/(1-this.friction)-1)*(this.target[e]-this.current[e]))}checkBounds(e=0,n=0){const{current:i}=this,r=i.e+e,a=i.f+n,u=this.getBounds(),{x:l,y:g}=u,_=l.min,S=l.max,E=g.min,T=g.max;let I=0,z=0;return _!==1/0&&r<_?I=_-r:S!==1/0&&r>S&&(I=S-r),E!==1/0&&a<E?z=E-a:T!==1/0&&a>T&&(z=T-a),Math.abs(I)<1e-4&&(I=0),Math.abs(z)<1e-4&&(z=0),Object.assign(Object.assign({},u),{xDiff:I,yDiff:z,inBounds:!I&&!z})}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,_=l;if(this.option("zoom")||this.angle!==0){const S=!(n instanceof HTMLImageElement)&&(window.getComputedStyle(n).maxWidth==="none"||window.getComputedStyle(n).maxHeight==="none"),E=S?u:r,T=S?l:a,I=this.getMatrix(e),z=new DOMPoint(0,0).matrixTransform(I),F=new DOMPoint(0+E,0).matrixTransform(I),j=new DOMPoint(0+E,0+T).matrixTransform(I),Z=new DOMPoint(0,0+T).matrixTransform(I),ie=Math.abs(j.x-z.x),le=Math.abs(j.y-z.y),J=Math.abs(Z.x-F.x),Ee=Math.abs(Z.y-F.y);g=Math.max(ie,J),_=Math.max(le,Ee)}return{contentWidth:g,contentHeight:_}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||this.panMode===ps||this.targetScale<this.scale)return this.isBouncingX=!1,void(this.isBouncingY=!1);const{target:e}=this,{x:n,y:i,xDiff:r,yDiff:a}=this.checkBounds(),u=this.option("maxVelocity");let l=this.velocity.e,g=this.velocity.f;r!==0?(this.isBouncingX=!0,r*l<=0?l+=.14*r:(l=.14*r,n.min!==1/0&&(this.target.e=Math.max(e.e,n.min)),n.max!==1/0&&(this.target.e=Math.min(e.e,n.max))),u&&(l=Math.max(Math.min(l,u),-1*u))):this.isBouncingX=!1,a!==0?(this.isBouncingY=!0,a*g<=0?g+=.14*a:(g=.14*a,i.min!==1/0&&(this.target.f=Math.max(e.f,i.min)),i.max!==1/0&&(this.target.f=Math.min(e.f,i.max))),u&&(g=Math.max(Math.min(g,u),-1*u))):this.isBouncingY=!1,this.isBouncingX&&(this.velocity.e=l),this.isBouncingY&&(this.velocity.f=g)}enable(){const{content:e}=this,n=new DOMMatrixReadOnly(window.getComputedStyle(e).transform);for(const i of Po)this.current[i]=this.target[i]=n[i];this.updateMetrics(),this.attachObserver(),this.attachEvents(),this.state=An.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&&Tr(u)?u.dataset:null;if(l){const I=l.panzoomChange,z=l.panzoomAction;if((I||z)&&e.preventDefault(),I){let F={};try{F=JSON.parse(I)}catch{console&&console.warn("The given data was not valid JSON")}return void this.applyChange(F)}if(z)return void(this[z]&&this[z]())}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(),_=this.dragStart;if(_.time&&!this.canZoomOut()&&(Math.abs(g.x-_.x)>2||Math.abs(g.y-_.y)>2))return;this.dragStart.time=0;const S=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),T=this.option("dblClick",e);T?(this.clicks++,this.clicks==1&&(this.clickTimer=setTimeout(()=>{this.clicks===1?(this.emit("click",e),!e.defaultPrevented&&E&&S(E)):(this.emit("dblClick",e),e.defaultPrevented||S(T)),this.clicks=0,this.clickTimer=null},350))):(this.emit("click",e),!e.defaultPrevented&&E&&S(E))}addTrackingPoint(e){const n=this.trackingPoints.filter(i=>i.time>Date.now()-100);n.push(e),this.trackingPoints=n}onPointerDown(e,n,i){var r;if(this.option("touch",e)===!1)return!1;this.pwt=0,this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const a=this.content.getBoundingClientRect();if(this.dragStart={x:a.x,y:a.y,top:a.top,left:a.left,time:Date.now()},this.clickTimer)return!1;if(this.panMode===ps&&this.targetScale>1)return e.preventDefault(),e.stopPropagation(),!1;const u=e.composedPath()[0];if(!i.length){if(["TEXTAREA","OPTION","INPUT","SELECT","VIDEO","IFRAME"].includes(u.nodeName)||u.closest("[contenteditable],[data-selectable],[data-draggable],[data-clickable],[data-panzoom-change],[data-panzoom-action]"))return!1;(r=window.getSelection())===null||r===void 0||r.removeAllRanges()}if(e.type==="mousedown")["A","BUTTON"].includes(u.nodeName)||e.preventDefault();else if(Math.abs(this.velocity.a)>.3)return!1;return this.target.e=this.current.e,this.target.f=this.current.f,this.stop(),this.isDragging||(this.isDragging=!0,this.addTrackingPoint(n),this.emit("touchStart",e)),!0}onPointerMove(e,n,i){if(this.option("touch",e)===!1||!this.isDragging||n.length<2&&this.panOnlyZoomed&&st(this.targetScale)<=st(this.minScale)||(this.emit("touchMove",e),e.defaultPrevented))return;this.addTrackingPoint(n[0]);const{content:r}=this,a=j1(i[0],i[1]),u=j1(n[0],n[1]);let l=0,g=0;if(n.length>1){const le=r.getBoundingClientRect();l=a.clientX-le.left-.5*le.width,g=a.clientY-le.top-.5*le.height}const _=$1(i[0],i[1]),S=$1(n[0],n[1]);let E=_?S/_:1,T=u.clientX-a.clientX,I=u.clientY-a.clientY;this.dragOffset.x+=T,this.dragOffset.y+=I,this.dragOffset.time=Date.now()-this.dragStart.time;let z=st(this.targetScale)===st(this.minScale)&&this.option("lockAxis");if(z&&!this.lockedAxis)if(z==="xy"||z==="y"||e.type==="touchmove"){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void e.preventDefault();const le=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=le>45&&le<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,T=0,I=0}else this.lockedAxis=z;if(Np(e.target,this.content)&&(z="x",this.dragOffset.y=0),z&&z!=="xy"&&this.lockedAxis!==z&&st(this.targetScale)===st(this.minScale))return;e.cancelable&&e.preventDefault(),this.container.classList.add(this.cn("isDragging"));const F=this.checkBounds(T,I);this.option("rubberband")?(this.isInfinite!=="x"&&(F.xDiff>0&&T<0||F.xDiff<0&&T>0)&&(T*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*F.xDiff))),this.isInfinite!=="y"&&(F.yDiff>0&&I<0||F.yDiff<0&&I>0)&&(I*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*F.yDiff)))):(F.xDiff&&(T=0),F.yDiff&&(I=0));const j=this.targetScale,Z=this.minScale,ie=this.maxScale;j<.5*Z&&(E=Math.max(E,Z)),j>1.5*ie&&(E=Math.min(E,ie)),this.lockedAxis==="y"&&st(j)===st(Z)&&(T=0),this.lockedAxis==="x"&&st(j)===st(Z)&&(I=0),this.applyChange({originX:l,originY:g,panX:T,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=[]),Np(e.target,this.content)&&this.lockedAxis==="y"&&(this.trackingPoints=[]),this.emit("touchEnd",e),this.isDragging=!1,this.lockedAxis=!1,this.state!==An.Destroy&&(e.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){var e;const n=this.isScaling;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const le of Po)this.velocity[le]=0;this.target.e=this.current.e,this.target.f=this.current.f,kn(this.container,"is-scaling"),kn(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 _=((e=window.visualViewport)===null||e===void 0?void 0:e.scale)||1;_!==1&&(u*=_,l*=_);let S=0,E=0,T=0,I=0,z=this.option("decelFriction");const F=this.targetScale;if(g>0){T=Math.abs(u)>3?u/(g/30):0,I=Math.abs(l)>3?l/(g/30):0;const le=this.option("maxVelocity");le&&(T=Math.max(Math.min(T,le),-1*le),I=Math.max(Math.min(I,le),-1*le))}T&&(S=T/(1/(1-z)-1)),I&&(E=I/(1/(1-z)-1)),(this.option("lockAxis")==="y"||this.option("lockAxis")==="xy"&&this.lockedAxis==="y"&&st(F)===this.minScale)&&(S=T=0),(this.option("lockAxis")==="x"||this.option("lockAxis")==="xy"&&this.lockedAxis==="x"&&st(F)===this.minScale)&&(E=I=0);const j=this.dragOffset.x,Z=this.dragOffset.y,ie=this.option("dragMinThreshold")||0;Math.abs(j)<ie&&Math.abs(Z)<ie&&(S=E=0,T=I=0),(this.option("zoom")&&(F<this.minScale-1e-5||F>this.maxScale+1e-5)||n&&!S&&!E)&&(z=.35),this.applyChange({panX:S,panY:E,friction:z}),this.emit("decel",T,I,j,Z)}onWheel(e){var n=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(a,u){return Math.abs(u)>Math.abs(a)?u:a});const i=Math.max(-1,Math.min(1,n));if(this.emit("wheel",e,i),this.panMode===ps||e.defaultPrevented)return;const r=this.option("wheel");r==="pan"?(e.preventDefault(),this.panOnlyZoomed&&!this.canZoomOut()||this.applyChange({panX:2*-e.deltaX,panY:2*-e.deltaY,bounce:!1})):r==="zoom"&&this.option("zoom")!==!1&&this.zoomWithWheel(e)}onMouseMove(e){this.panWithMouse(e)}onKeydown(e){e.key==="Escape"&&this.toggleFS()}onResize(){this.updateMetrics(),this.checkBounds().inBounds||this.requestTick()}setTransform(){this.emit("beforeTransform");const{current:e,target:n,content:i,contentRect:r}=this,a=Object.assign({},Vp);for(const j of Po){const Z=j=="e"||j==="f"?Fp:xR;a[j]=st(e[j],Z),Math.abs(n[j]-e[j])<(j=="e"||j==="f"?.51:.001)&&(e[j]=n[j])}let{a:u,b:l,c:g,d:_,e:S,f:E}=a,T=`matrix(${u}, ${l}, ${g}, ${_}, ${S}, ${E})`,I=i.parentElement instanceof HTMLPictureElement?i.parentElement:i;if(this.option("transformParent")&&(I=I.parentElement||I),I.style.transform===T)return;I.style.transform=T;const{contentWidth:z,contentHeight:F}=this.calculateContentDim();r.width=z,r.height=F,this.emit("afterTransform")}updateMetrics(e=!1){var n;if(!this||this.state===An.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 _=l.width*i,S=l.height*i;const E=parseFloat(g.paddingTop)+parseFloat(g.paddingBottom),T=_-(parseFloat(g.paddingLeft)+parseFloat(g.paddingRight)),I=S-E;this.containerRect={width:_,height:S,innerWidth:T,innerHeight:I};const z=parseFloat(a.dataset.width||"")||(dt=>{let Rt=0;return Rt=dt instanceof HTMLImageElement?dt.naturalWidth:dt instanceof SVGElement?dt.width.baseVal.value:Math.max(dt.offsetWidth,dt.scrollWidth),Rt||0})(a),F=parseFloat(a.dataset.height||"")||(dt=>{let Rt=0;return Rt=dt instanceof HTMLImageElement?dt.naturalHeight:dt instanceof SVGElement?dt.height.baseVal.value:Math.max(dt.offsetHeight,dt.scrollHeight),Rt||0})(a);let j=this.option("width",z)||fs,Z=this.option("height",F)||fs;const ie=j===fs,le=Z===fs;typeof j!="number"&&(j=z),typeof Z!="number"&&(Z=F),ie&&(j=z*(Z/F)),le&&(Z=F/(z/j));let J=a.parentElement instanceof HTMLPictureElement?a.parentElement:a;this.option("transformParent")&&(J=J.parentElement||J);const Ee=J.getAttribute("style")||"";J.style.setProperty("transform","none","important"),u&&(J.style.width="",J.style.height=""),J.offsetHeight;const be=a.getBoundingClientRect();let Ae=be.width*i,Le=be.height*i,Pe=Ae,Ye=Le;Ae=Math.min(Ae,j),Le=Math.min(Le,Z),u?{width:Ae,height:Le}=((dt,Rt,Xt,nn)=>{const jt=Xt/dt,Tt=nn/Rt,Sn=Math.min(jt,Tt);return{width:dt*=Sn,height:Rt*=Sn}})(j,Z,Ae,Le):(Ae=Math.min(Ae,j),Le=Math.min(Le,Z));let it=.5*(Ye-Le),Nt=.5*(Pe-Ae);this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:be.top-l.top+it,bottom:l.bottom-be.bottom+it,left:be.left-l.left+Nt,right:l.right-be.right+Nt,fitWidth:Ae,fitHeight:Le,width:Ae,height:Le,fullWidth:j,fullHeight:Z}),J.style.cssText=Ee,u&&(J.style.width=`${Ae}px`,J.style.height=`${Le}px`),this.setTransform(),e!==!0&&this.emit("refresh"),this.ignoreBounds||(st(this.targetScale)<st(this.minScale)?this.zoomTo(this.minScale,{friction:0}):this.targetScale>this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===An.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,_=0,S=0;const E=this.option("infinite");if(E===!0||r&&E===r)l=-1/0,_=1/0,g=-1/0,S=1/0;else{let{containerRect:T,contentRect:I}=this,z=st(a*i,Fp),F=st(u*i,Fp),{innerWidth:j,innerHeight:Z}=T;if(T.width===z&&(j=T.width),T.width===F&&(Z=T.height),e>j){_=.5*(e-j),l=-1*_;let ie=.5*(I.right-I.left);l+=ie,_+=ie}if(a>j&&e<j&&(l-=.5*(a-j),_-=.5*(a-j)),n>Z){S=.5*(n-Z),g=-1*S;let ie=.5*(I.bottom-I.top);g+=ie,S+=ie}u>Z&&n<Z&&(l-=.5*(u-Z),_-=.5*(u-Z))}return{x:{min:l,max:_},y:{min:g,max:S}}}getBounds(){const e=this.option("bounds");return e!==fs?e:this.calculateBounds()}updateControls(){const e=this,n=e.container,{panMode:i,contentRect:r,targetScale:a,minScale:u}=e;let l=u,g=e.option("click")||!1;g&&(l=e.getNextScale(g));let _=e.canZoomIn(),S=e.canZoomOut(),E=i===q1&&!!this.option("touch"),T=S&&E;if(E&&(st(a)<st(u)&&!this.panOnlyZoomed&&(T=!0),(st(r.width,1)>st(r.fitWidth,1)||st(r.height,1)>st(r.fitHeight,1))&&(T=!0)),st(r.width*a,1)<st(r.fitWidth,1)&&(T=!1),i===ps&&(T=!1),to(n,this.cn("isDraggable"),T),!this.option("zoom"))return;let I=_&&st(l)>st(a),z=!I&&!T&&S&&st(l)<st(a);to(n,this.cn("canZoomIn"),I),to(n,this.cn("canZoomOut"),z);for(const F of n.querySelectorAll("[data-panzoom-action]")){let j=!1,Z=!1;switch(F.dataset.panzoomAction){case"zoomIn":_?j=!0:Z=!0;break;case"zoomOut":S?j=!0:Z=!0;break;case"toggleZoom":case"iterateZoom":_||S?j=!0:Z=!0;const ie=F.querySelector("g");ie&&(ie.style.display=_?"":"none")}j?(F.removeAttribute("disabled"),F.removeAttribute("tabindex")):Z&&(F.setAttribute("disabled",""),F.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:_=!1,ignoreBounds:S=!1}){this.state!==An.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:_,ignoreBounds:S})}applyChange({panX:e=0,panY:n=0,scale:i=1,angle:r=0,originX:a=-this.current.e,originY:u=-this.current.f,friction:l=this.option("friction"),flipX:g=!1,flipY:_=!1,ignoreBounds:S=!1,bounce:E=this.option("bounce")}){const T=this.state;if(T===An.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.friction=l||0,this.ignoreBounds=S;const{current:I}=this,z=I.e,F=I.f,j=this.getMatrix(this.target);let Z=new DOMMatrix().translate(z,F).translate(a,u).translate(e,n);if(this.option("zoom")){if(!S){const ie=this.targetScale,le=this.minScale,J=this.maxScale;ie*i<le&&(i=le/ie),ie*i>J&&(i=J/ie)}Z=Z.scale(i)}Z=Z.translate(-a,-u).translate(-z,-F).multiply(j),r&&(Z=Z.rotate(r)),g&&(Z=Z.scale(-1,1)),_&&(Z=Z.scale(1,-1));for(const ie of Po)ie!=="e"&&ie!=="f"&&(Z[ie]>this.minScale+1e-5||Z[ie]<this.minScale-1e-5)?this.target[ie]=Z[ie]:this.target[ie]=st(Z[ie],Fp);(this.targetScale<this.scale||Math.abs(i-1)>.1||this.panMode===ps||E===!1)&&!S&&this.clampTargetBounds(),T===An.Init?this.animate():this.isResting||(this.state=An.Panning,this.requestTick())}stop(e=!1){if(this.state===An.Init||this.state===An.Destroy)return;const n=this.isTicking;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const i of Po)this.velocity[i]=0,e==="current"?this.current[i]=this.target[i]:e==="target"&&(this.target[i]=this.current[i]);this.setTransform(),kn(this.container,"is-scaling"),kn(this.container,"is-animating"),this.isTicking=!1,this.state=An.Ready,n&&(this.emit("endAnimation"),this.updateControls())}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),Ct(this.container,"is-animating"),this.isScaling&&Ct(this.container,"is-scaling")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame(()=>this.animate()))}panWithMouse(e,n=this.option("mouseMoveFriction")){if(this.pmme=e,this.panMode!==ps||!e||st(this.targetScale)<=st(this.minScale))return;this.emit("mouseMove",e);const{container:i,containerRect:r,contentRect:a}=this,u=r.width,l=r.height,g=i.getBoundingClientRect(),_=(e.clientX||0)-g.left,S=(e.clientY||0)-g.top;let{contentWidth:E,contentHeight:T}=this.calculateContentDim(this.target);const I=this.option("mouseMoveFactor");I>1&&(E!==u&&(E*=I),T!==l&&(T*=I));let z=.5*(E-u)-_/u*100/100*(E-u);z+=.5*(a.right-a.left);let F=.5*(T-l)-S/l*100/100*(T-l);F+=.5*(a.bottom-a.top),this.applyChange({panX:z-this.target.e,panY:F-this.target.f,friction:n})}zoomWithWheel(e){if(this.state===An.Destroy||this.state===An.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(_,S){return Math.abs(S)>Math.abs(_)?S:_});const r=Math.max(-1,Math.min(1,i)),{targetScale:a,maxScale:u,minScale:l}=this;let g=a*(100+45*r)/100;st(g)<st(l)&&st(a)<=st(l)?(this.cwd+=Math.abs(r),g=l):st(g)>st(u)&&st(a)>=st(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(),st(g)!==st(a)&&this.zoomTo(g,{event:e}))}canZoomIn(){return this.option("zoom")&&(st(this.contentRect.width,1)<st(this.contentRect.fitWidth,1)||st(this.targetScale)<st(this.maxScale))}canZoomOut(){return this.option("zoom")&&st(this.targetScale)>st(this.minScale)}zoomIn(e=1.25,n){this.zoomTo(this.targetScale*e,n)}zoomOut(e=.8,n){this.zoomTo(this.targetScale*e,n)}zoomToFit(e){this.zoomTo("fit",e)}zoomToCover(e){this.zoomTo("cover",e)}zoomToFull(e){this.zoomTo("full",e)}zoomToMax(e){this.zoomTo("max",e)}toggleZoom(e){this.zoomTo(this.getNextScale("toggleZoom"),e)}toggleMax(e){this.zoomTo(this.getNextScale("toggleMax"),e)}toggleCover(e){this.zoomTo(this.getNextScale("toggleCover"),e)}iterateZoom(e){this.zoomTo("next",e)}zoomTo(e=1,{friction:n=fs,originX:i=fs,originY:r=fs,event:a}={}){if(this.isContentLoading||this.state===An.Destroy)return;const{targetScale:u,fullScale:l,maxScale:g,coverScale:_}=this;if(this.stop(),this.panMode===ps&&(a=this.pmme||a),a||i===fs||r===fs){const E=this.content.getBoundingClientRect(),T=this.container.getBoundingClientRect(),I=a?a.clientX:T.left+.5*T.width,z=a?a.clientY:T.top+.5*T.height;i=I-E.left-.5*E.width,r=z-E.top-.5*E.height}let S=1;typeof e=="number"?S=e:e==="full"?S=l:e==="cover"?S=_:e==="max"?S=g:e==="fit"?S=1:e==="next"&&(S=this.getNextScale("iterateZoom")),S=S/u||1,n=n===fs?S>1?.15:.25:n,this.applyChange({scale:S,originX:i,originY:r,friction:n}),a&&this.panMode===ps&&this.panWithMouse(a,n)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:e,contentRect:n,target:i}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-i.e,panY:.5*e.height-(n.top+.5*n.fitHeight)-i.f,scale:e.width/n.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:e,contentRect:n,target:i}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-i.e,panY:.5*e.innerHeight-(n.top+.5*n.fitHeight)-i.f,scale:e.height/n.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:e}=this,n=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");e.classList.toggle(n);const r=e.classList.contains(n);r?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(r?"enterFS":"exitFS")}getMatrix(e=this.current){const{a:n,b:i,c:r,d:a,e:u,f:l}=e;return new DOMMatrix([n,i,r,a,u,l])}reset(e){if(this.state!==An.Init&&this.state!==An.Destroy){this.stop("current");for(const n of Po)this.target[n]=Vp[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=An.Panning,this.requestTick())}}destroy(){this.stop(),this.state=An.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:_R}),Object.defineProperty(ua,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const G1=function(t,e){let n=!0;return(...i)=>{n&&(n=!1,t(...i),setTimeout(()=>{n=!0},e))}},Z1=(t,e)=>{let n=[];return t.childNodes.forEach(i=>{i.nodeType!==Node.ELEMENT_NODE||e&&!i.matches(e)||n.push(i)}),n},bR={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 ci;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"})(ci||(ci={}));const hy=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)},vR=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class Vs extends Bp{constructor(e,n){super(n),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:e})}attach(){}detach(){}}const wR={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 Y1 extends Vs{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let e=this.list;if(!e){e=document.createElement("ul"),Ct(e,this.cn("list")),e.setAttribute("role","tablist");const n=this.instance.container;n.appendChild(e),Ct(n,this.cn("hasDots")),this.list=e}return e}refresh(){var e;const n=this.instance.pages.length,i=Math.min(2,this.option("minCount")),r=Math.max(2e3,this.option("maxCount")),a=this.option("dynamicFrom");if(n<i||n>r)return void this.cleanup();const u=typeof a=="number"&&n>5&&n>=a,l=!this.list||this.isDynamic!==u||this.list.children.length!==n;l&&this.cleanup();const g=this.build();if(to(g,this.cn("isDynamic"),!!u),l)for(let E=0;E<n;E++)g.append(this.createItem(E));let _,S=0;for(const E of[...g.children]){const T=S===this.instance.page;T&&(_=E),to(E,this.cn("isCurrent"),T),(e=E.children[0])===null||e===void 0||e.setAttribute("aria-selected",T?"true":"false");for(const I of["isBeforePrev","isPrev","isNext","isAfterNext"])kn(E,this.cn(I));S++}if(_=_||g.firstChild,u&&_){const E=_.previousElementSibling,T=E&&E.previousElementSibling;Ct(E,this.cn("isPrev")),Ct(T,this.cn("isBeforePrev"));const I=_.nextElementSibling,z=I&&I.nextElementSibling;Ct(I,this.cn("isNext")),Ct(z,this.cn("isAfterNext"))}this.isDynamic=u}createItem(e=0){var n;const i=document.createElement("li");i.setAttribute("role","presentation");const r=eo(this.instance.localize(this.option("dotTpl"),[["%d",e+1]]).replace(/\%i/g,e+""));return i.appendChild(r),(n=i.children[0])===null||n===void 0||n.setAttribute("role","tab"),i}cleanup(){this.list&&(this.list.remove(),this.list=null),this.isDynamic=!1,kn(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(Y1,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:wR});const $p="disabled",jp="next",X1="prev";class K1 extends Vs{constructor(){super(...arguments),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prev",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"next",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isDom",{enumerable:!0,configurable:!0,writable:!0,value:!1})}onRefresh(){const e=this.instance,n=e.pages.length,i=e.page;if(n<2)return void this.cleanup();this.build();let r=this.prev,a=this.next;r&&a&&(r.removeAttribute($p),a.removeAttribute($p),e.isInfinite||(i<=0&&r.setAttribute($p,""),i>=n-1&&a.setAttribute($p,"")))}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===jp?"isNext":"isPrev"));const a=i.isRTL?e===jp?X1:jp: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(jp)),this.next=a,r||(r=i.querySelector("[data-carousel-prev]")),r||(r=this.addBtn(X1)),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(K1,"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 J1 extends Vs{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(e){this.target=this.instance,this.nav=e,this.attachEvents()}addAsNavFor(e){this.nav=this.instance,this.target=e,this.attachEvents()}attachEvents(){const{nav:e,target:n}=this;e&&n&&(e.options.initialSlide=n.options.initialPage,e.state===ci.Ready?this.onNavReady(e):e.on("ready",this.onNavReady),n.state===ci.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 _=u.closest("[data-index]");if(i.stopPropagation(),i.preventDefault(),!_)return;const S=parseInt(_.dataset.index||"",10)||0,E=g.getPageForSlide(S),T=l.getPageForSlide(S);l.slideTo(T),g.slideTo(E,{friction:((a=(r=this.nav)===null||r===void 0?void 0:r.plugins)===null||a===void 0?void 0:a.Sync.option("friction"))||0}),this.markSelectedSlide(S)}onNavCreateSlide(e,n){n.index===this.selectedIndex&&this.markSelectedSlide(n.index)}onTargetChange(){var e,n;const{target:i,nav:r}=this;if(!i||!r||r.state!==ci.Ready||i.state!==ci.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===ci.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(J1,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const kR={Navigation:K1,Dots:Y1,Sync:J1},Up="animationend",Q1="isSelected",Hp="slide";class ha extends ay{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===ci.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:ci.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||!Tr(e))throw new Error("No Element found");this.container=e,this.slideNext=G1(this.slideNext.bind(this),150),this.slidePrev=G1(this.slidePrev.bind(this),150),this.userOptions=n,this.userPlugins=i,queueMicrotask(()=>{this.processOptions()})}processOptions(){var e,n;const i=Cr({},ha.defaults,this.userOptions);let r="";const a=i.breakpoints;if(a&&sy(a))for(const[u,l]of Object.entries(a))window.matchMedia(u).matches&&sy(l)&&(r+=u,Cr(i,l));r===this.bp&&this.state!==ci.Init||(this.bp=r,this.state===ci.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!==ci.Init&&this.destroy(),super.setOptions(i),this.option("enabled")===!1?this.attachEvents():setTimeout(()=>{this.init()},0))}init(){this.state=ci.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=ci.Ready,this.emit("ready")}initLayout(){const{container:e}=this,n=this.option("classes");Ct(e,this.cn("container")),to(e,n.isLTR,!this.isRTL),to(e,n.isRTL,this.isRTL),to(e,n.isVertical,!this.isHorizontal),to(e,n.isHorizontal,this.isHorizontal);let i=this.option("viewport")||e.querySelector(`.${n.viewport}`);i||(i=document.createElement("div"),Ct(i,n.viewport),i.append(...Z1(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=[];[...Z1(e,`.${this.cn(Hp)}`)].forEach(r=>{if(Tr(r)){const a=hy({el:r,isDom:!0,index:this.slides.length});i.push(a)}});for(let r of[...this.option("slides",[])||[],...n])i.push(hy(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,Cr({},{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(vR()),a=e.length-1,u=0,l=0),e[a].slides.push(g),u+=g.dim+g.gap,l++;return e}processPages(){const e=this.pages,{contentDim:n,viewportDim:i,isInfinite:r}=this,a=this.option("center"),u=this.option("fill"),l=u&&a&&n>i&&!r;if(e.forEach((S,E)=>{var T;S.index=E,S.pos=((T=S.slides[0])===null||T===void 0?void 0:T.pos)||0,S.dim=0;for(const[I,z]of S.slides.entries())S.dim+=z.dim,I<S.slides.length-1&&(S.dim+=z.gap);l&&S.pos+.5*S.dim<.5*i?S.pos=0:l&&S.pos+.5*S.dim>=n-.5*i?S.pos=n-i:a&&(S.pos+=-.5*(i-S.dim))}),e.forEach(S=>{u&&!r&&n>i&&(S.pos=Math.max(S.pos,0),S.pos=Math.min(S.pos,n-i)),S.pos=st(S.pos,1e3),S.dim=st(S.dim,1e3),Math.abs(S.pos)<=.1&&(S.pos=0)}),r)return e;const g=[];let _;return e.forEach(S=>{const E=Object.assign({},S);_&&E.pos===_.pos?(_.dim+=E.dim,_.slides=[..._.slides,...E.slides]):(E.index=g.length,_=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(Hp)+" "+e.class+" "+e.customClass),a)l.style[r]=`${a}px`,l.style[r==="width"?"height":"width"]="";else{g&&(this.track||document.body).prepend(l),a=l.getBoundingClientRect()[r]*Math.max(1,((n=window.visualViewport)===null||n===void 0?void 0:n.scale)||1);let S=l[this.isHorizontal?"offsetWidth":"offsetHeight"];S-1>a&&(a=S)}const _=getComputedStyle(l);return _.boxSizing==="content-box"&&(this.isHorizontal?(a+=parseFloat(_.paddingLeft)||0,a+=parseFloat(_.paddingRight)||0):(a+=parseFloat(_.paddingTop)||0,a+=parseFloat(_.paddingBottom)||0)),u=parseFloat(_[this.isHorizontal?"marginRight":"marginBottom"])||0,g?(i=l.parentElement)===null||i===void 0||i.removeChild(l):e.el||l.remove(),{dim:st(a,1e3),gap:st(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:_,slides:S,panzoom:E}=this,T=0,I=0,z=0,F=0;E?F=-1*E.current[this.axis]:_[g]&&(F=_[g].pos||0),e=n?i?"right":"left":"top",i&&n&&(F*=-1);for(const le of S){const J=le.el;J?(e==="top"?(J.style.right="",J.style.left=""):J.style.top="",le.index!==T?J.style[e]=I===0?"":`${st(I,1e3)}px`:J.style[e]="",z+=le.dim+le.gap,T++):I+=le.dim+le.gap}if(r&&z&&a){let le=getComputedStyle(a),J="padding",Ee=n?"Right":"Bottom",be=parseFloat(le[J+(n?"Left":"Top")]);F-=be,u+=be,u+=parseFloat(le[J+Ee]);for(const Ae of S)Ae.el&&(st(Ae.pos)<st(u)&&st(Ae.pos+Ae.dim+Ae.gap)<st(F)&&st(F)>st(l-u)&&(Ae.el.style[e]=`${st(I+z,1e3)}px`),st(Ae.pos+Ae.gap)>=st(l-u)&&st(Ae.pos)>st(F+u)&&st(F)<st(u)&&(Ae.el.style[e]=`-${st(z,1e3)}px`))}let j,Z,ie=[...this.inTransition];if(ie.length>1&&(j=_[ie[0]],Z=_[ie[1]]),j&&Z){let le=0;for(const J of S)J.el?this.inTransition.has(J.index)&&j.slides.indexOf(J)<0&&(J.el.style[e]=`${st(le+(j.pos-Z.pos),1e3)}px`):le+=J.dim+J.gap}}createSlideEl(e){const{track:n,slides:i}=this;if(!n||!e||e.el&&e.el.parentNode)return;const r=e.el||document.createElement("div");Ct(r,this.cn(Hp)),Ct(r,e.class),Ct(r,e.customClass);const a=e.html;a&&(a instanceof HTMLElement?r.appendChild(a):r.innerHTML=e.html+"");const u=[];i.forEach((S,E)=>{S.el&&u.push(E)});const l=e.index;let g=null;u.length&&(g=i[u.reduce((S,E)=>Math.abs(E-l)<Math.abs(S-l)?E:S)]);const _=g&&g.el&&g.el.parentNode?g.index<e.index?g.el.nextSibling:g.el:null;n.insertBefore(r,n.contains(_)?_: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(Q1);if(i.classList.contains(r)&&(kn(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(Up);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:_}=this;e=parseInt((e||0).toString())||0;const S=this.getPageFromIndex(e);if(!_||!g[S]||g.length<2||Math.abs((((r=(i=g[l])===null||i===void 0?void 0:i.slides[0])===null||r===void 0?void 0:r.dim)||0)-this.viewportDim)>1)return!1;let E=e>l?1:-1;this.isInfinite&&(l===0&&e===g.length-1&&(E=-1),l===g.length-1&&e===0&&(E=1));const T=g[S].pos*(this.isRTL?1:-1);if(l===S&&Math.abs(T-_.target[this.axis])<1)return!1;this.clearTransitions();const I=_.isResting;Ct(this.container,this.cn("inTransition"));const z=((a=g[l])===null||a===void 0?void 0:a.slides[0])||null,F=((u=g[S])===null||u===void 0?void 0:u.slides[0])||null;this.inTransition.add(F.index),this.createSlideEl(F);let j=z.el,Z=F.el;I||n===Hp||(n="fadeFast",j=null);const ie=this.isRTL?"next":"prev",le=this.isRTL?"prev":"next";return j&&(this.inTransition.add(z.index),z.transition=n,j.addEventListener(Up,this.onAnimationEnd),j.classList.add(`f-${n}Out`,`to-${E>0?le:ie}`)),Z&&(F.transition=n,Z.addEventListener(Up,this.onAnimationEnd),Z.classList.add(`f-${n}In`,`from-${E>0?ie:le}`)),_.current[this.axis]=T,_.target[this.axis]=T,_.requestTick(),this.onChange(S),!0}manageSlideVisiblity(){const e=new Set,n=new Set,i=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const r of this.slides)i.has(r)?e.add(r):n.add(r);for(const r of this.inTransition)e.add(this.slides[r]);for(const r of e)this.createSlideEl(r),this.lazyLoadSlide(r);for(const r of n)e.has(r)||this.removeSlideEl(r);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const e="aria-hidden";let n=this.cn(Q1);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)&&(kn(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],_=l.target[e]-g,S=0,E=.5*a;r&&n?(g<-E&&(S=-1,g+=u),g>u-E&&(S=1,g-=u)):(g>E&&(S=1,g-=u),g<-u+E&&(S=-1,g+=u)),S&&(l.current[e]=g,l.target[e]=g+_)}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),kn(n,a),n.complete&&(Ct(n,r),setTimeout(()=>{kn(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 _=n.parentNode;_&&e.el&&(n.complete?g():u||(l=eo(ly),_.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:_}=this,S=_.length,E=Math.abs(Math.atan2(i,n)/(Math.PI/180));let T=0;if(T=E>45&&E<135?l?0:i:l?n:0,!S)return;let I=this.page,z=u&&l?1:-1;const F=e.current[g]*z;let{pageIndex:j}=this.getPageFromPosition(F);Math.abs(T)>5?(_[I].dim<document.documentElement["client"+(this.isHorizontal?"Width":"Height")]-1&&(I=j),I=u&&l?T<0?I-1:I+1:T<0?I+1:I-1):I=r===0&&a===0?I:j,this.slideTo(I,{transition:!1,friction:e.option("decelFriction")})}onClick(e){const n=e.target,i=n&&Tr(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=ci.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===ci.Destroy)return;e=parseInt((e||0).toString())||0;const r=this.getPageFromIndex(e),{axis:a,isHorizontal:u,isRTL:l,pages:g,panzoom:_}=this,S=g.length,E=l&&u?1:-1;if(!_||!S)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 T=g[r].pos;if(this.isInfinite){const I=this.contentDim,z=_.target[a]*E;S===2?T+=I*Math.floor(parseFloat(e+"")/2):T=[T,T-I,T+I].reduce(function(F,j){return Math.abs(j-z)<Math.abs(F-z)?j:F})}T*=E,Math.abs(_.target[a]-T)<1||(_.panTo({x:u?T:0,y:u?0:T,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(),kn(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(Up,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,_=((r=this.pages[this.page])===null||r===void 0?void 0:r.dim)||0,S=this.contentDim<this.viewportDim;let E=Array.isArray(n)?n:[n];const T=[];for(const I of E)T.push(hy(I));this.slides.splice(e,0,...T);for(let I=0;I<this.slides.length;I++)this.slides[I].index=I;for(const I of T)this.emit("beforeInitSlide",I,I.index);if(this.page>=e&&(this.page+=T.length),this.updateMetrics(),l){const I=((a=this.pages[this.page])===null||a===void 0?void 0:a.pos)||0,z=((u=this.pages[this.page])===null||u===void 0?void 0:u.dim)||0,F=this.pages.length||1,j=this.isRTL?_-z:z-_,Z=this.isRTL?g-I:I-g;S&&F===1?(e<=this.page&&(l.current[this.axis]-=j,l.target[this.axis]-=j),l.panTo({[this.isHorizontal?"x":"y"]:-1*I})):Z&&e<=this.page&&(l.target[this.axis]-=Z,l.current[this.axis]-=Z,l.requestTick())}for(const I of T)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],st(n.getBoundingClientRect()[l],1e3)),T=getComputedStyle(n),I="padding",z=a?"Right":"Bottom";E-=parseFloat(T[I+(a?"Left":"Top")])+parseFloat(T[I+z]),this.viewportDim=E}let _,S=0;for(const[E,T]of r.entries()){let I=0,z=0;!T.el&&_?(I=_.dim,z=_.gap):({dim:I,gap:z}=this.getSlideMetrics(T),_=T),I=st(I,1e3),z=st(z,1e3),T.dim=I,T.gap=z,T.pos=S,S+=I,(u||E<r.length-1)&&(S+=z)}S=st(S,1e3),this.contentDim=S,e&&(e.contentRect[l]=S,e.contentRect[a?"fullWidth":"fullHeight"]=S),this.pages=this.createPages(),this.pages=this.processPages(),this.state===ci.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,_=st((g-l.pos)/(1*l.dim),1e3),S=_,E=_;this.isInfinite&&i!==!0&&(S=st((g-l.pos+u)/(1*l.dim),1e3),E=st((g-l.pos-u)/(1*l.dim),1e3));let T=[_,S,E].reduce(function(I,z){return Math.abs(z)<Math.abs(I)?z:I});return n?T:T>1?1:T<-1?-1:T}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 _=0;_=r&&r.state!==An.Init&&r.state!==An.Destroy?-1*r.current[this.axis]:l[g]&&l[g].pos||0,this.isInfinite&&(_-=Math.floor(_/a)*a),this.isRTL&&this.isHorizontal&&(_*=-1);const S=_-u*e,E=_+u*(e+1),T=this.isInfinite?[-1,0,1]:[0];for(const I of this.slides)for(const z of T){const F=I.pos+z*a,j=F+I.dim+I.gap;F<E&&j>S&&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,_=r[0],S=r[g-1],E=this.option("center");let T=0,I=0,z=0,F=e===void 0?-1*((u==null?void 0:u.target[this.axis])||0):e;E&&(F+=.5*n),this.isInfinite?(F<_.pos-.5*S.gap&&(F-=i,z=-1),F>S.pos+S.dim+.5*S.gap&&(F-=i,z=1)):F=Math.max(_.pos||0,Math.min(F,S.pos));let j=S,Z=r.find(ie=>{const le=ie.pos-.5*j.gap,J=ie.pos+ie.dim+.5*ie.gap;return j=ie,F>=le&&F<J});return Z||(Z=S),I=this.getPageForSlide(Z.index),T=I+z*l,{page:T,pageIndex:I}}setPageFromPosition(){const{pageIndex:e}=this.getPageFromPosition();this.onChange(e)}destroy(){if([ci.Destroy].includes(this.state))return;this.state=ci.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,_]of Object.entries(u))g!=="container"&&_&&e.classList.remove(_);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:bR}),Object.defineProperty(ha,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:kR});const ev=function(t){if(!Tr(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 _=g/n*100;return Math.round(_)},fh=!(typeof window>"u"||!window.document||!window.document.createElement);let dy;const py=["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(","),tv=t=>{if(t&&fh){dy===void 0&&document.createElement("div").focus({get preventScroll(){return dy=!0,!1}});try{if(dy)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{}}},nv=()=>{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},fy={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({},U1),{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
|
+
`),ee=P.createShader(P.FRAGMENT_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(ee,ce),P.compileShader(ee),!P.getShaderParameter(ee,P.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${P.getShaderInfoLog(ee)}`);P.attachShader(this.program,ee);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=B.length;for(let ve=0;ve<this.numAttributes;ve++)B[ve]&&(P.bindAttribLocation(this.program,ve,B[ve]),this.attributes[B[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(ee);for(let ve=0;ve<re.length;ve++){const Oe=re[ve];if(Oe&&!ge[Oe]){const Ve=P.getUniformLocation(this.program,Oe);Ve&&(ge[Oe]=Ve)}}this.fixedUniforms=m(s,ge),this.terrainUniforms=((ve,Oe)=>({u_depth:new l.aH(ve,Oe.u_depth),u_terrain:new l.aH(ve,Oe.u_terrain),u_terrain_dim:new l.aI(ve,Oe.u_terrain_dim),u_terrain_matrix:new l.aJ(ve,Oe.u_terrain_matrix),u_terrain_unpack:new l.aK(ve,Oe.u_terrain_unpack),u_terrain_exaggeration:new l.aI(ve,Oe.u_terrain_exaggeration)}))(s,ge),this.binderUniforms=f?f.getUniforms(s,ge):[]}draw(s,d,f,m,x,M,P,D,L,B,V,W,K,Q,re,ae,ce,he){const ee=s.gl;if(this.failedToCreate)return;if(s.program.set(this.program),s.setDepthMode(f),s.setStencilMode(m),s.setColorMode(x),s.setCullFace(M),D){s.activeTexture.set(ee.TEXTURE2),ee.bindTexture(ee.TEXTURE_2D,D.depthTexture),s.activeTexture.set(ee.TEXTURE3),ee.bindTexture(ee.TEXTURE_2D,D.texture);for(const ge in this.terrainUniforms)this.terrainUniforms[ge].set(D[ge])}for(const ge in this.fixedUniforms)this.fixedUniforms[ge].set(P[ge]);re&&re.setUniforms(s,this.binderUniforms,K,{zoom:Q});let me=0;switch(d){case ee.LINES:me=2;break;case ee.TRIANGLES:me=3;break;case ee.LINE_STRIP:me=1}for(const ge of W.get()){const ve=ge.vaos||(ge.vaos={});(ve[L]||(ve[L]=new Kh)).bind(s,this,B,re?re.getPaintVertexBuffers():[],V,ge.vertexOffset,ae,ce,he),ee.drawElements(d,ge.primitiveLength*me,ee.UNSIGNED_SHORT,ge.primitiveOffset*me*2)}}}function nu(b,s,d){const f=1/Zt(d,1,s.transform.tileZoom),m=Math.pow(2,d.tileID.overscaledZ),x=d.tileSize*Math.pow(2,s.transform.tileZoom)/m,M=x*(d.tileID.canonical.x+d.tileID.wrap*m),P=x*d.tileID.canonical.y;return{u_image:0,u_texsize:d.imageAtlasTexture.size,u_scale:[f,b.fromScale,b.toScale],u_fade:b.t,u_pixel_coord_upper:[M>>16,P>>16],u_pixel_coord_lower:[65535&M,65535&P]}}const Bl=(b,s,d,f)=>{const m=s.style.light,x=m.properties.get("position"),M=[x.x,x.y,x.z],P=function(){var L=new l.A(9);return l.A!=Float32Array&&(L[1]=0,L[2]=0,L[3]=0,L[5]=0,L[6]=0,L[7]=0),L[0]=1,L[4]=1,L[8]=1,L}();m.properties.get("anchor")==="viewport"&&function(L,B){var V=Math.sin(B),W=Math.cos(B);L[0]=W,L[1]=V,L[2]=0,L[3]=-V,L[4]=W,L[5]=0,L[6]=0,L[7]=0,L[8]=1}(P,-s.transform.angle),function(L,B,V){var W=B[0],K=B[1],Q=B[2];L[0]=W*V[0]+K*V[3]+Q*V[6],L[1]=W*V[1]+K*V[4]+Q*V[7],L[2]=W*V[2]+K*V[5]+Q*V[8]}(M,M,P);const D=m.properties.get("color");return{u_matrix:b,u_lightpos:M,u_lightintensity:m.properties.get("intensity"),u_lightcolor:[D.r,D.g,D.b],u_vertical_gradient:+d,u_opacity:f}},iu=(b,s,d,f,m,x,M)=>l.e(Bl(b,s,d,f),nu(x,s,M),{u_height_factor:-Math.pow(2,m.overscaledZ)/M.tileSize/8}),Ia=b=>({u_matrix:b}),Gf=(b,s,d,f)=>l.e(Ia(b),nu(d,s,f)),K0=(b,s)=>({u_matrix:b,u_world:s}),Zf=(b,s,d,f,m)=>l.e(Gf(b,s,d,f),{u_world:m}),J0=(b,s,d,f)=>{const m=b.transform;let x,M;if(f.paint.get("circle-pitch-alignment")==="map"){const P=Zt(d,1,m.zoom);x=!0,M=[P,P]}else x=!1,M=m.pixelsToGLUnits;return{u_camera_to_center_distance:m.cameraToCenterDistance,u_scale_with_map:+(f.paint.get("circle-pitch-scale")==="map"),u_matrix:b.translatePosMatrix(s.posMatrix,d,f.paint.get("circle-translate"),f.paint.get("circle-translate-anchor")),u_pitch_with_map:+x,u_device_pixel_ratio:b.pixelRatio,u_extrude_scale:M}},jo=(b,s,d)=>({u_matrix:b,u_inv_matrix:s,u_camera_to_center_distance:d.cameraToCenterDistance,u_viewport_size:[d.width,d.height]}),Vl=(b,s,d=1)=>({u_matrix:b,u_color:s,u_overlay:0,u_overlay_scale:d}),nr=b=>({u_matrix:b}),ir=(b,s,d,f)=>({u_matrix:b,u_extrude_scale:Zt(s,1,d),u_intensity:f}),ru=(b,s,d,f)=>{const m=l.H();l.aP(m,0,b.width,b.height,0,0,1);const x=b.context.gl;return{u_matrix:m,u_world:[x.drawingBufferWidth,x.drawingBufferHeight],u_image:d,u_color_ramp:f,u_opacity:s.paint.get("heatmap-opacity")}};function su(b,s){const d=Math.pow(2,s.canonical.z),f=s.canonical.y;return[new l.Z(0,f/d).toLngLat().lat,new l.Z(0,(f+1)/d).toLngLat().lat]}const ou=(b,s,d,f)=>{const m=b.transform;return{u_matrix:Kf(b,s,d,f),u_ratio:1/Zt(s,1,m.zoom),u_device_pixel_ratio:b.pixelRatio,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},Yf=(b,s,d,f,m)=>l.e(ou(b,s,d,m),{u_image:0,u_image_height:f}),Da=(b,s,d,f,m)=>{const x=b.transform,M=Xf(s,x);return{u_matrix:Kf(b,s,d,m),u_texsize:s.imageAtlasTexture.size,u_ratio:1/Zt(s,1,x.zoom),u_device_pixel_ratio:b.pixelRatio,u_image:0,u_scale:[M,f.fromScale,f.toScale],u_fade:f.t,u_units_to_pixels:[1/x.pixelsToGLUnits[0],1/x.pixelsToGLUnits[1]]}},Q0=(b,s,d,f,m,x)=>{const M=b.lineAtlas,P=Xf(s,b.transform),D=d.layout.get("line-cap")==="round",L=M.getDash(f.from,D),B=M.getDash(f.to,D),V=L.width*m.fromScale,W=B.width*m.toScale;return l.e(ou(b,s,d,x),{u_patternscale_a:[P/V,-L.height/2],u_patternscale_b:[P/W,-B.height/2],u_sdfgamma:M.width/(256*Math.min(V,W)*b.pixelRatio)/2,u_image:0,u_tex_y_a:L.y,u_tex_y_b:B.y,u_mix:m.t})};function Xf(b,s){return 1/Zt(b,1,s.tileZoom)}function Kf(b,s,d,f){return b.translatePosMatrix(f?f.posMatrix:s.tileID.posMatrix,s,d.paint.get("line-translate"),d.paint.get("line-translate-anchor"))}const e_=(b,s,d,f,m)=>{return{u_matrix:b,u_tl_parent:s,u_scale_parent:d,u_buffer_scale:1,u_fade_t:f.mix,u_opacity:f.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:(M=m.paint.get("raster-saturation"),M>0?1-1/(1.001-M):-M),u_contrast_factor:(x=m.paint.get("raster-contrast"),x>0?1/(1-x):1+x),u_spin_weights:t_(m.paint.get("raster-hue-rotate"))};var x,M};function t_(b){b*=Math.PI/180;const s=Math.sin(b),d=Math.cos(b);return[(2*d+1)/3,(-Math.sqrt(3)*s-d+1)/3,(Math.sqrt(3)*s-d+1)/3]}const Jf=(b,s,d,f,m,x,M,P,D,L,B,V,W,K)=>{const Q=M.transform;return{u_is_size_zoom_constant:+(b==="constant"||b==="source"),u_is_size_feature_constant:+(b==="constant"||b==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:Q.cameraToCenterDistance,u_pitch:Q.pitch/360*2*Math.PI,u_rotate_symbol:+d,u_aspect_ratio:Q.width/Q.height,u_fade_change:M.options.fadeDuration?M.symbolFadeChange:1,u_matrix:P,u_label_plane_matrix:D,u_coord_matrix:L,u_is_text:+V,u_pitch_with_map:+f,u_is_along_line:m,u_is_variable_anchor:x,u_texsize:W,u_texture:0,u_translation:B,u_pitched_scale:K}},Fl=(b,s,d,f,m,x,M,P,D,L,B,V,W,K,Q)=>{const re=M.transform;return l.e(Jf(b,s,d,f,m,x,M,P,D,L,B,V,W,Q),{u_gamma_scale:f?Math.cos(re._pitch)*re.cameraToCenterDistance:1,u_device_pixel_ratio:M.pixelRatio,u_is_halo:+K})},ed=(b,s,d,f,m,x,M,P,D,L,B,V,W,K)=>l.e(Fl(b,s,d,f,m,x,M,P,D,L,B,!0,V,!0,K),{u_texsize_icon:W,u_texture_icon:1}),au=(b,s,d)=>({u_matrix:b,u_opacity:s,u_color:d}),td=(b,s,d,f,m,x)=>l.e(function(M,P,D,L){const B=D.imageManager.getPattern(M.from.toString()),V=D.imageManager.getPattern(M.to.toString()),{width:W,height:K}=D.imageManager.getPixelSize(),Q=Math.pow(2,L.tileID.overscaledZ),re=L.tileSize*Math.pow(2,D.transform.tileZoom)/Q,ae=re*(L.tileID.canonical.x+L.tileID.wrap*Q),ce=re*L.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:B.tl,u_pattern_br_a:B.br,u_pattern_tl_b:V.tl,u_pattern_br_b:V.br,u_texsize:[W,K],u_mix:P.t,u_pattern_size_a:B.displaySize,u_pattern_size_b:V.displaySize,u_scale_a:P.fromScale,u_scale_b:P.toScale,u_tile_units_to_pixels:1/Zt(L,1,D.transform.tileZoom),u_pixel_coord_upper:[ae>>16,ce>>16],u_pixel_coord_lower:[65535&ae,65535&ce]}}(f,x,d,m),{u_matrix:b,u_opacity:s}),nd={fillExtrusion:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_lightpos:new l.aN(b,s.u_lightpos),u_lightintensity:new l.aI(b,s.u_lightintensity),u_lightcolor:new l.aN(b,s.u_lightcolor),u_vertical_gradient:new l.aI(b,s.u_vertical_gradient),u_opacity:new l.aI(b,s.u_opacity)}),fillExtrusionPattern:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_lightpos:new l.aN(b,s.u_lightpos),u_lightintensity:new l.aI(b,s.u_lightintensity),u_lightcolor:new l.aN(b,s.u_lightcolor),u_vertical_gradient:new l.aI(b,s.u_vertical_gradient),u_height_factor:new l.aI(b,s.u_height_factor),u_image:new l.aH(b,s.u_image),u_texsize:new l.aO(b,s.u_texsize),u_pixel_coord_upper:new l.aO(b,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(b,s.u_pixel_coord_lower),u_scale:new l.aN(b,s.u_scale),u_fade:new l.aI(b,s.u_fade),u_opacity:new l.aI(b,s.u_opacity)}),fill:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix)}),fillPattern:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_image:new l.aH(b,s.u_image),u_texsize:new l.aO(b,s.u_texsize),u_pixel_coord_upper:new l.aO(b,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(b,s.u_pixel_coord_lower),u_scale:new l.aN(b,s.u_scale),u_fade:new l.aI(b,s.u_fade)}),fillOutline:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_world:new l.aO(b,s.u_world)}),fillOutlinePattern:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_world:new l.aO(b,s.u_world),u_image:new l.aH(b,s.u_image),u_texsize:new l.aO(b,s.u_texsize),u_pixel_coord_upper:new l.aO(b,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(b,s.u_pixel_coord_lower),u_scale:new l.aN(b,s.u_scale),u_fade:new l.aI(b,s.u_fade)}),circle:(b,s)=>({u_camera_to_center_distance:new l.aI(b,s.u_camera_to_center_distance),u_scale_with_map:new l.aH(b,s.u_scale_with_map),u_pitch_with_map:new l.aH(b,s.u_pitch_with_map),u_extrude_scale:new l.aO(b,s.u_extrude_scale),u_device_pixel_ratio:new l.aI(b,s.u_device_pixel_ratio),u_matrix:new l.aJ(b,s.u_matrix)}),collisionBox:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_pixel_extrude_scale:new l.aO(b,s.u_pixel_extrude_scale)}),collisionCircle:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_inv_matrix:new l.aJ(b,s.u_inv_matrix),u_camera_to_center_distance:new l.aI(b,s.u_camera_to_center_distance),u_viewport_size:new l.aO(b,s.u_viewport_size)}),debug:(b,s)=>({u_color:new l.aL(b,s.u_color),u_matrix:new l.aJ(b,s.u_matrix),u_overlay:new l.aH(b,s.u_overlay),u_overlay_scale:new l.aI(b,s.u_overlay_scale)}),clippingMask:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix)}),heatmap:(b,s)=>({u_extrude_scale:new l.aI(b,s.u_extrude_scale),u_intensity:new l.aI(b,s.u_intensity),u_matrix:new l.aJ(b,s.u_matrix)}),heatmapTexture:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_world:new l.aO(b,s.u_world),u_image:new l.aH(b,s.u_image),u_color_ramp:new l.aH(b,s.u_color_ramp),u_opacity:new l.aI(b,s.u_opacity)}),hillshade:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_image:new l.aH(b,s.u_image),u_latrange:new l.aO(b,s.u_latrange),u_light:new l.aO(b,s.u_light),u_shadow:new l.aL(b,s.u_shadow),u_highlight:new l.aL(b,s.u_highlight),u_accent:new l.aL(b,s.u_accent)}),hillshadePrepare:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_image:new l.aH(b,s.u_image),u_dimension:new l.aO(b,s.u_dimension),u_zoom:new l.aI(b,s.u_zoom),u_unpack:new l.aK(b,s.u_unpack)}),line:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_ratio:new l.aI(b,s.u_ratio),u_device_pixel_ratio:new l.aI(b,s.u_device_pixel_ratio),u_units_to_pixels:new l.aO(b,s.u_units_to_pixels)}),lineGradient:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_ratio:new l.aI(b,s.u_ratio),u_device_pixel_ratio:new l.aI(b,s.u_device_pixel_ratio),u_units_to_pixels:new l.aO(b,s.u_units_to_pixels),u_image:new l.aH(b,s.u_image),u_image_height:new l.aI(b,s.u_image_height)}),linePattern:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_texsize:new l.aO(b,s.u_texsize),u_ratio:new l.aI(b,s.u_ratio),u_device_pixel_ratio:new l.aI(b,s.u_device_pixel_ratio),u_image:new l.aH(b,s.u_image),u_units_to_pixels:new l.aO(b,s.u_units_to_pixels),u_scale:new l.aN(b,s.u_scale),u_fade:new l.aI(b,s.u_fade)}),lineSDF:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_ratio:new l.aI(b,s.u_ratio),u_device_pixel_ratio:new l.aI(b,s.u_device_pixel_ratio),u_units_to_pixels:new l.aO(b,s.u_units_to_pixels),u_patternscale_a:new l.aO(b,s.u_patternscale_a),u_patternscale_b:new l.aO(b,s.u_patternscale_b),u_sdfgamma:new l.aI(b,s.u_sdfgamma),u_image:new l.aH(b,s.u_image),u_tex_y_a:new l.aI(b,s.u_tex_y_a),u_tex_y_b:new l.aI(b,s.u_tex_y_b),u_mix:new l.aI(b,s.u_mix)}),raster:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_tl_parent:new l.aO(b,s.u_tl_parent),u_scale_parent:new l.aI(b,s.u_scale_parent),u_buffer_scale:new l.aI(b,s.u_buffer_scale),u_fade_t:new l.aI(b,s.u_fade_t),u_opacity:new l.aI(b,s.u_opacity),u_image0:new l.aH(b,s.u_image0),u_image1:new l.aH(b,s.u_image1),u_brightness_low:new l.aI(b,s.u_brightness_low),u_brightness_high:new l.aI(b,s.u_brightness_high),u_saturation_factor:new l.aI(b,s.u_saturation_factor),u_contrast_factor:new l.aI(b,s.u_contrast_factor),u_spin_weights:new l.aN(b,s.u_spin_weights)}),symbolIcon:(b,s)=>({u_is_size_zoom_constant:new l.aH(b,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(b,s.u_is_size_feature_constant),u_size_t:new l.aI(b,s.u_size_t),u_size:new l.aI(b,s.u_size),u_camera_to_center_distance:new l.aI(b,s.u_camera_to_center_distance),u_pitch:new l.aI(b,s.u_pitch),u_rotate_symbol:new l.aH(b,s.u_rotate_symbol),u_aspect_ratio:new l.aI(b,s.u_aspect_ratio),u_fade_change:new l.aI(b,s.u_fade_change),u_matrix:new l.aJ(b,s.u_matrix),u_label_plane_matrix:new l.aJ(b,s.u_label_plane_matrix),u_coord_matrix:new l.aJ(b,s.u_coord_matrix),u_is_text:new l.aH(b,s.u_is_text),u_pitch_with_map:new l.aH(b,s.u_pitch_with_map),u_is_along_line:new l.aH(b,s.u_is_along_line),u_is_variable_anchor:new l.aH(b,s.u_is_variable_anchor),u_texsize:new l.aO(b,s.u_texsize),u_texture:new l.aH(b,s.u_texture),u_translation:new l.aO(b,s.u_translation),u_pitched_scale:new l.aI(b,s.u_pitched_scale)}),symbolSDF:(b,s)=>({u_is_size_zoom_constant:new l.aH(b,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(b,s.u_is_size_feature_constant),u_size_t:new l.aI(b,s.u_size_t),u_size:new l.aI(b,s.u_size),u_camera_to_center_distance:new l.aI(b,s.u_camera_to_center_distance),u_pitch:new l.aI(b,s.u_pitch),u_rotate_symbol:new l.aH(b,s.u_rotate_symbol),u_aspect_ratio:new l.aI(b,s.u_aspect_ratio),u_fade_change:new l.aI(b,s.u_fade_change),u_matrix:new l.aJ(b,s.u_matrix),u_label_plane_matrix:new l.aJ(b,s.u_label_plane_matrix),u_coord_matrix:new l.aJ(b,s.u_coord_matrix),u_is_text:new l.aH(b,s.u_is_text),u_pitch_with_map:new l.aH(b,s.u_pitch_with_map),u_is_along_line:new l.aH(b,s.u_is_along_line),u_is_variable_anchor:new l.aH(b,s.u_is_variable_anchor),u_texsize:new l.aO(b,s.u_texsize),u_texture:new l.aH(b,s.u_texture),u_gamma_scale:new l.aI(b,s.u_gamma_scale),u_device_pixel_ratio:new l.aI(b,s.u_device_pixel_ratio),u_is_halo:new l.aH(b,s.u_is_halo),u_translation:new l.aO(b,s.u_translation),u_pitched_scale:new l.aI(b,s.u_pitched_scale)}),symbolTextAndIcon:(b,s)=>({u_is_size_zoom_constant:new l.aH(b,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(b,s.u_is_size_feature_constant),u_size_t:new l.aI(b,s.u_size_t),u_size:new l.aI(b,s.u_size),u_camera_to_center_distance:new l.aI(b,s.u_camera_to_center_distance),u_pitch:new l.aI(b,s.u_pitch),u_rotate_symbol:new l.aH(b,s.u_rotate_symbol),u_aspect_ratio:new l.aI(b,s.u_aspect_ratio),u_fade_change:new l.aI(b,s.u_fade_change),u_matrix:new l.aJ(b,s.u_matrix),u_label_plane_matrix:new l.aJ(b,s.u_label_plane_matrix),u_coord_matrix:new l.aJ(b,s.u_coord_matrix),u_is_text:new l.aH(b,s.u_is_text),u_pitch_with_map:new l.aH(b,s.u_pitch_with_map),u_is_along_line:new l.aH(b,s.u_is_along_line),u_is_variable_anchor:new l.aH(b,s.u_is_variable_anchor),u_texsize:new l.aO(b,s.u_texsize),u_texsize_icon:new l.aO(b,s.u_texsize_icon),u_texture:new l.aH(b,s.u_texture),u_texture_icon:new l.aH(b,s.u_texture_icon),u_gamma_scale:new l.aI(b,s.u_gamma_scale),u_device_pixel_ratio:new l.aI(b,s.u_device_pixel_ratio),u_is_halo:new l.aH(b,s.u_is_halo),u_translation:new l.aO(b,s.u_translation),u_pitched_scale:new l.aI(b,s.u_pitched_scale)}),background:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_opacity:new l.aI(b,s.u_opacity),u_color:new l.aL(b,s.u_color)}),backgroundPattern:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_opacity:new l.aI(b,s.u_opacity),u_image:new l.aH(b,s.u_image),u_pattern_tl_a:new l.aO(b,s.u_pattern_tl_a),u_pattern_br_a:new l.aO(b,s.u_pattern_br_a),u_pattern_tl_b:new l.aO(b,s.u_pattern_tl_b),u_pattern_br_b:new l.aO(b,s.u_pattern_br_b),u_texsize:new l.aO(b,s.u_texsize),u_mix:new l.aI(b,s.u_mix),u_pattern_size_a:new l.aO(b,s.u_pattern_size_a),u_pattern_size_b:new l.aO(b,s.u_pattern_size_b),u_scale_a:new l.aI(b,s.u_scale_a),u_scale_b:new l.aI(b,s.u_scale_b),u_pixel_coord_upper:new l.aO(b,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(b,s.u_pixel_coord_lower),u_tile_units_to_pixels:new l.aI(b,s.u_tile_units_to_pixels)}),terrain:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_texture:new l.aH(b,s.u_texture),u_ele_delta:new l.aI(b,s.u_ele_delta),u_fog_matrix:new l.aJ(b,s.u_fog_matrix),u_fog_color:new l.aL(b,s.u_fog_color),u_fog_ground_blend:new l.aI(b,s.u_fog_ground_blend),u_fog_ground_blend_opacity:new l.aI(b,s.u_fog_ground_blend_opacity),u_horizon_color:new l.aL(b,s.u_horizon_color),u_horizon_fog_blend:new l.aI(b,s.u_horizon_fog_blend)}),terrainDepth:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_ele_delta:new l.aI(b,s.u_ele_delta)}),terrainCoords:(b,s)=>({u_matrix:new l.aJ(b,s.u_matrix),u_texture:new l.aH(b,s.u_texture),u_terrain_coords_id:new l.aI(b,s.u_terrain_coords_id),u_ele_delta:new l.aI(b,s.u_ele_delta)}),sky:(b,s)=>({u_sky_color:new l.aL(b,s.u_sky_color),u_horizon_color:new l.aL(b,s.u_horizon_color),u_horizon:new l.aI(b,s.u_horizon),u_sky_horizon_blend:new l.aI(b,s.u_sky_horizon_blend)})};class Ms{constructor(s,d,f){this.context=s;const m=s.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!f,this.context.unbindVAO(),s.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(s){const d=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),d.bufferSubData(d.ELEMENT_ARRAY_BUFFER,0,s.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const n_={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class id{constructor(s,d,f,m){this.length=d.length,this.attributes=f,this.itemSize=d.bytesPerElement,this.dynamicDraw=m,this.context=s;const x=s.gl;this.buffer=x.createBuffer(),s.bindVertexBuffer.set(this.buffer),x.bufferData(x.ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?x.DYNAMIC_DRAW:x.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(s){if(s.length!==this.length)throw new Error(`Length of new data is ${s.length}, which doesn't match current length of ${this.length}`);const d=this.context.gl;this.bind(),d.bufferSubData(d.ARRAY_BUFFER,0,s.arrayBuffer)}enableAttributes(s,d){for(let f=0;f<this.attributes.length;f++){const m=d.attributes[this.attributes[f].name];m!==void 0&&s.enableVertexAttribArray(m)}}setVertexAttribPointers(s,d,f){for(let m=0;m<this.attributes.length;m++){const x=this.attributes[m],M=d.attributes[x.name];M!==void 0&&s.vertexAttribPointer(M,x.components,s[n_[x.type]],!1,this.itemSize,x.offset+this.itemSize*(f||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Uo=new WeakMap;function ho(b){var s;if(Uo.has(b))return Uo.get(b);{const d=(s=b.getParameter(b.VERSION))===null||s===void 0?void 0:s.startsWith("WebGL 2.0");return Uo.set(b,d),d}}class mn{constructor(s){this.gl=s.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(s){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class lu extends mn{getDefault(){return l.aM.transparent}set(s){const d=this.current;(s.r!==d.r||s.g!==d.g||s.b!==d.b||s.a!==d.a||this.dirty)&&(this.gl.clearColor(s.r,s.g,s.b,s.a),this.current=s,this.dirty=!1)}}class i_ extends mn{getDefault(){return 1}set(s){(s!==this.current||this.dirty)&&(this.gl.clearDepth(s),this.current=s,this.dirty=!1)}}class Oa extends mn{getDefault(){return 0}set(s){(s!==this.current||this.dirty)&&(this.gl.clearStencil(s),this.current=s,this.dirty=!1)}}class r_ extends mn{getDefault(){return[!0,!0,!0,!0]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||s[2]!==d[2]||s[3]!==d[3]||this.dirty)&&(this.gl.colorMask(s[0],s[1],s[2],s[3]),this.current=s,this.dirty=!1)}}class Qf extends mn{getDefault(){return!0}set(s){(s!==this.current||this.dirty)&&(this.gl.depthMask(s),this.current=s,this.dirty=!1)}}class s_ extends mn{getDefault(){return 255}set(s){(s!==this.current||this.dirty)&&(this.gl.stencilMask(s),this.current=s,this.dirty=!1)}}class em extends mn{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(s){const d=this.current;(s.func!==d.func||s.ref!==d.ref||s.mask!==d.mask||this.dirty)&&(this.gl.stencilFunc(s.func,s.ref,s.mask),this.current=s,this.dirty=!1)}}class rd extends mn{getDefault(){const s=this.gl;return[s.KEEP,s.KEEP,s.KEEP]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||s[2]!==d[2]||this.dirty)&&(this.gl.stencilOp(s[0],s[1],s[2]),this.current=s,this.dirty=!1)}}class tm extends mn{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;s?d.enable(d.STENCIL_TEST):d.disable(d.STENCIL_TEST),this.current=s,this.dirty=!1}}class nm extends mn{getDefault(){return[0,1]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||this.dirty)&&(this.gl.depthRange(s[0],s[1]),this.current=s,this.dirty=!1)}}class im extends mn{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;s?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),this.current=s,this.dirty=!1}}class rm extends mn{getDefault(){return this.gl.LESS}set(s){(s!==this.current||this.dirty)&&(this.gl.depthFunc(s),this.current=s,this.dirty=!1)}}class Ho extends mn{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;s?d.enable(d.BLEND):d.disable(d.BLEND),this.current=s,this.dirty=!1}}class sm extends mn{getDefault(){const s=this.gl;return[s.ONE,s.ZERO]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||this.dirty)&&(this.gl.blendFunc(s[0],s[1]),this.current=s,this.dirty=!1)}}class o_ extends mn{getDefault(){return l.aM.transparent}set(s){const d=this.current;(s.r!==d.r||s.g!==d.g||s.b!==d.b||s.a!==d.a||this.dirty)&&(this.gl.blendColor(s.r,s.g,s.b,s.a),this.current=s,this.dirty=!1)}}class om extends mn{getDefault(){return this.gl.FUNC_ADD}set(s){(s!==this.current||this.dirty)&&(this.gl.blendEquation(s),this.current=s,this.dirty=!1)}}class $l extends mn{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;s?d.enable(d.CULL_FACE):d.disable(d.CULL_FACE),this.current=s,this.dirty=!1}}class a_ extends mn{getDefault(){return this.gl.BACK}set(s){(s!==this.current||this.dirty)&&(this.gl.cullFace(s),this.current=s,this.dirty=!1)}}class cu extends mn{getDefault(){return this.gl.CCW}set(s){(s!==this.current||this.dirty)&&(this.gl.frontFace(s),this.current=s,this.dirty=!1)}}class l_ extends mn{getDefault(){return null}set(s){(s!==this.current||this.dirty)&&(this.gl.useProgram(s),this.current=s,this.dirty=!1)}}class c_ extends mn{getDefault(){return this.gl.TEXTURE0}set(s){(s!==this.current||this.dirty)&&(this.gl.activeTexture(s),this.current=s,this.dirty=!1)}}class am extends mn{getDefault(){const s=this.gl;return[0,0,s.drawingBufferWidth,s.drawingBufferHeight]}set(s){const d=this.current;(s[0]!==d[0]||s[1]!==d[1]||s[2]!==d[2]||s[3]!==d[3]||this.dirty)&&(this.gl.viewport(s[0],s[1],s[2],s[3]),this.current=s,this.dirty=!1)}}class lm extends mn{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.bindFramebuffer(d.FRAMEBUFFER,s),this.current=s,this.dirty=!1}}class cm extends mn{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.bindRenderbuffer(d.RENDERBUFFER,s),this.current=s,this.dirty=!1}}class sd extends mn{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.bindTexture(d.TEXTURE_2D,s),this.current=s,this.dirty=!1}}class um extends mn{getDefault(){return null}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.bindBuffer(d.ARRAY_BUFFER,s),this.current=s,this.dirty=!1}}class uu extends mn{getDefault(){return null}set(s){const d=this.gl;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,s),this.current=s,this.dirty=!1}}class Hs extends mn{getDefault(){return null}set(s){var d;if(s===this.current&&!this.dirty)return;const f=this.gl;ho(f)?f.bindVertexArray(s):(d=f.getExtension("OES_vertex_array_object"))===null||d===void 0||d.bindVertexArrayOES(s),this.current=s,this.dirty=!1}}class od extends mn{getDefault(){return 4}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_ALIGNMENT,s),this.current=s,this.dirty=!1}}class ad extends mn{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s),this.current=s,this.dirty=!1}}class ld extends mn{getDefault(){return!1}set(s){if(s===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL,s),this.current=s,this.dirty=!1}}class hu extends mn{constructor(s,d){super(s),this.context=s,this.parent=d}getDefault(){return null}}class cd extends hu{setDirty(){this.dirty=!0}set(s){if(s===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,s,0),this.current=s,this.dirty=!1}}class qo extends hu{set(s){if(s===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,s),this.current=s,this.dirty=!1}}class ud extends hu{set(s){if(s===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,s),this.current=s,this.dirty=!1}}class u_{constructor(s,d,f,m,x){this.context=s,this.width=d,this.height=f;const M=s.gl,P=this.framebuffer=M.createFramebuffer();if(this.colorAttachment=new cd(s,P),m)this.depthAttachment=x?new ud(s,P):new qo(s,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 s=this.context.gl,d=this.colorAttachment.get();if(d&&s.deleteTexture(d),this.depthAttachment){const f=this.depthAttachment.get();f&&s.deleteRenderbuffer(f)}s.deleteFramebuffer(this.framebuffer)}}class Jn{constructor(s,d,f){this.blendFunction=s,this.blendColor=d,this.mask=f}}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 h_{constructor(s){var d,f;if(this.gl=s,this.clearColor=new lu(this),this.clearDepth=new i_(this),this.clearStencil=new Oa(this),this.colorMask=new r_(this),this.depthMask=new Qf(this),this.stencilMask=new s_(this),this.stencilFunc=new em(this),this.stencilOp=new rd(this),this.stencilTest=new tm(this),this.depthRange=new nm(this),this.depthTest=new im(this),this.depthFunc=new rm(this),this.blend=new Ho(this),this.blendFunc=new sm(this),this.blendColor=new o_(this),this.blendEquation=new om(this),this.cullFace=new $l(this),this.cullFaceSide=new a_(this),this.frontFace=new cu(this),this.program=new l_(this),this.activeTexture=new c_(this),this.viewport=new am(this),this.bindFramebuffer=new lm(this),this.bindRenderbuffer=new cm(this),this.bindTexture=new sd(this),this.bindVertexBuffer=new um(this),this.bindElementBuffer=new uu(this),this.bindVertexArray=new Hs(this),this.pixelStoreUnpack=new od(this),this.pixelStoreUnpackPremultiplyAlpha=new ad(this),this.pixelStoreUnpackFlipY=new ld(this),this.extTextureFilterAnisotropic=s.getExtension("EXT_texture_filter_anisotropic")||s.getExtension("MOZ_EXT_texture_filter_anisotropic")||s.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=s.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=s.getParameter(s.MAX_TEXTURE_SIZE),ho(s)){this.HALF_FLOAT=s.HALF_FLOAT;const m=s.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(d=s.RGBA16F)!==null&&d!==void 0?d:m==null?void 0:m.RGBA16F_EXT,this.RGB16F=(f=s.RGB16F)!==null&&f!==void 0?f:m==null?void 0:m.RGB16F_EXT,s.getExtension("EXT_color_buffer_float")}else{s.getExtension("EXT_color_buffer_half_float"),s.getExtension("OES_texture_half_float_linear");const m=s.getExtension("OES_texture_half_float");this.HALF_FLOAT=m==null?void 0:m.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(s,d){return new Ms(this,s,d)}createVertexBuffer(s,d,f){return new id(this,s,d,f)}createRenderbuffer(s,d,f){const m=this.gl,x=m.createRenderbuffer();return this.bindRenderbuffer.set(x),m.renderbufferStorage(m.RENDERBUFFER,s,d,f),this.bindRenderbuffer.set(null),x}createFramebuffer(s,d,f,m){return new u_(this,s,d,f,m)}clear({color:s,depth:d,stencil:f}){const m=this.gl;let x=0;s&&(x|=m.COLOR_BUFFER_BIT,this.clearColor.set(s),this.colorMask.set([!0,!0,!0,!0])),d!==void 0&&(x|=m.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(d),this.depthMask.set(!0)),f!==void 0&&(x|=m.STENCIL_BUFFER_BIT,this.clearStencil.set(f),this.stencilMask.set(255)),m.clear(x)}setCullFace(s){s.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(s.mode),this.frontFace.set(s.frontFace))}setDepthMode(s){s.func!==this.gl.ALWAYS||s.mask?(this.depthTest.set(!0),this.depthFunc.set(s.func),this.depthMask.set(s.mask),this.depthRange.set(s.range)):this.depthTest.set(!1)}setStencilMode(s){s.test.func!==this.gl.ALWAYS||s.mask?(this.stencilTest.set(!0),this.stencilMask.set(s.mask),this.stencilOp.set([s.fail,s.depthFail,s.pass]),this.stencilFunc.set({func:s.test.func,ref:s.ref,mask:s.test.mask})):this.stencilTest.set(!1)}setColorMode(s){l.aE(s.blendFunction,Jn.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(s.blendFunction),this.blendColor.set(s.blendColor)),this.colorMask.set(s.mask)}createVertexArray(){var s;return ho(this.gl)?this.gl.createVertexArray():(s=this.gl.getExtension("OES_vertex_array_object"))===null||s===void 0?void 0:s.createVertexArrayOES()}deleteVertexArray(s){var d;return ho(this.gl)?this.gl.deleteVertexArray(s):(d=this.gl.getExtension("OES_vertex_array_object"))===null||d===void 0?void 0:d.deleteVertexArrayOES(s)}unbindVAO(){this.bindVertexArray.set(null)}}class Ht{constructor(s,d,f){this.func=s,this.mask=d,this.range=f}}Ht.ReadOnly=!1,Ht.ReadWrite=!0,Ht.disabled=new Ht(519,Ht.ReadOnly,[0,1]);const du=7680;class Dn{constructor(s,d,f,m,x,M){this.test=s,this.ref=d,this.mask=f,this.fail=m,this.depthFail=x,this.pass=M}}Dn.disabled=new Dn({func:519,mask:0},0,0,du,du,du);class Cn{constructor(s,d,f){this.enable=s,this.mode=d,this.frontFace=f}}let Wo;function jl(b,s,d,f,m){const x=b.context,M=x.gl,P=b.useProgram("collisionBox"),D=[];let L=0,B=0;for(let ce=0;ce<f.length;ce++){const he=f[ce],ee=s.getTile(he).getBucket(d);if(!ee)continue;const me=m?ee.textCollisionBox:ee.iconCollisionBox,ge=ee.collisionCircleArray;if(ge.length>0){const ve=l.H();l.aQ(ve,ee.placementInvProjMatrix,b.transform.glCoordMatrix),l.aQ(ve,ve,ee.placementViewportMatrix),D.push({circleArray:ge,circleOffset:B,transform:he.posMatrix,invTransform:ve,coord:he}),L+=ge.length/4,B=L}me&&P.draw(x,M.LINES,Ht.disabled,Dn.disabled,b.colorModeForRenderPass(),Cn.disabled,{u_matrix:he.posMatrix,u_pixel_extrude_scale:[1/(V=b.transform).width,1/V.height]},b.style.map.terrain&&b.style.map.terrain.getTerrainData(he),d.id,me.layoutVertexBuffer,me.indexBuffer,me.segments,null,b.transform.zoom,null,null,me.collisionVertexBuffer)}var V;if(!m||!D.length)return;const W=b.useProgram("collisionCircle"),K=new l.aR;K.resize(4*L),K._trim();let Q=0;for(const ce of D)for(let he=0;he<ce.circleArray.length/4;he++){const ee=4*he,me=ce.circleArray[ee+0],ge=ce.circleArray[ee+1],ve=ce.circleArray[ee+2],Oe=ce.circleArray[ee+3];K.emplace(Q++,me,ge,ve,Oe,0),K.emplace(Q++,me,ge,ve,Oe,1),K.emplace(Q++,me,ge,ve,Oe,2),K.emplace(Q++,me,ge,ve,Oe,3)}(!Wo||Wo.length<2*L)&&(Wo=function(ce){const he=2*ce,ee=new l.aT;ee.resize(he),ee._trim();for(let me=0;me<he;me++){const ge=6*me;ee.uint16[ge+0]=4*me+0,ee.uint16[ge+1]=4*me+1,ee.uint16[ge+2]=4*me+2,ee.uint16[ge+3]=4*me+2,ee.uint16[ge+4]=4*me+3,ee.uint16[ge+5]=4*me+0}return ee}(L));const re=x.createIndexBuffer(Wo,!0),ae=x.createVertexBuffer(K,l.aS.members,!0);for(const ce of D){const he=jo(ce.transform,ce.invTransform,b.transform);W.draw(x,M.TRIANGLES,Ht.disabled,Dn.disabled,b.colorModeForRenderPass(),Cn.disabled,he,b.style.map.terrain&&b.style.map.terrain.getTerrainData(ce.coord),d.id,ae,re,l.a0.simpleSegment(0,2*ce.circleOffset,ce.circleArray.length,ce.circleArray.length/2),null,b.transform.zoom,null,null,null)}ae.destroy(),re.destroy()}Cn.disabled=new Cn(!1,1029,2305),Cn.backCCW=new Cn(!0,1029,2305);const Ul=l.an(new Float32Array(16));function hd(b,s,d,f,m,x){const{horizontalAlign:M,verticalAlign:P}=l.au(b);return new l.P((-(M-.5)*s/m+f[0])*x,(-(P-.5)*d/m+f[1])*x)}function Go(b,s,d,f,m,x){const M=s.tileAnchorPoint.add(new l.P(s.translation[0],s.translation[1]));if(s.pitchWithMap){let P=f.mult(x);d||(P=P.rotate(-m));const D=M.add(P);return se(D.x,D.y,s.labelPlaneMatrix,s.getElevation).point}if(d){const P=Me(s.tileAnchorPoint.x+1,s.tileAnchorPoint.y,s).point.sub(b),D=Math.atan(P.y/P.x)+(P.x<0?Math.PI:0);return b.add(f.rotate(D))}return b.add(f)}function za(b,s,d,f,m,x,M,P,D,L,B,V,W,K){const Q=b.text.placedSymbolArray,re=b.text.dynamicLayoutVertexArray,ae=b.icon.dynamicLayoutVertexArray,ce={};re.clear();for(let he=0;he<Q.length;he++){const ee=Q.get(he),me=ee.hidden||!ee.crossTileID||b.allowVerticalPlacement&&!ee.placedOrientation?null:f[ee.crossTileID];if(me){const ge=new l.P(ee.anchorX,ee.anchorY),ve={getElevation:K,width:m.width,height:m.height,labelPlaneMatrix:x,lineVertexArray:null,pitchWithMap:d,projection:B,projectionCache:null,tileAnchorPoint:ge,translation:V,unwrappedTileID:W},Oe=d?se(ge.x,ge.y,M,K):Me(ge.x,ge.y,ve),Ve=H(m.cameraToCenterDistance,Oe.signedDistanceFromCamera);let Ke=l.ai(b.textSizeData,D,ee)*Ve/l.ap;d&&(Ke*=b.tilePixelRatio/P);const{width:nt,height:We,anchor:He,textOffset:ft,textBoxScale:Ot}=me,Ge=hd(He,nt,We,ft,Ot,Ke),et=B.getPitchedTextCorrection(m,ge.add(new l.P(V[0],V[1])),W),Pt=Go(Oe.point,ve,s,Ge,m.angle,et),Nn=b.allowVerticalPlacement&&ee.placedOrientation===l.ah.vertical?Math.PI/2:0;for(let Vt=0;Vt<ee.numGlyphs;Vt++)l.aj(re,Pt,Nn);L&&ee.associatedIconIndex>=0&&(ce[ee.associatedIconIndex]={shiftedAnchor:Pt,angle:Nn})}else kt(ee.numGlyphs,re)}if(L){ae.clear();const he=b.icon.placedSymbolArray;for(let ee=0;ee<he.length;ee++){const me=he.get(ee);if(me.hidden)kt(me.numGlyphs,ae);else{const ge=ce[ee];if(ge)for(let ve=0;ve<me.numGlyphs;ve++)l.aj(ae,ge.shiftedAnchor,ge.angle);else kt(me.numGlyphs,ae)}}b.icon.dynamicLayoutVertexBuffer.updateData(ae)}b.text.dynamicLayoutVertexBuffer.updateData(re)}function Lr(b,s,d){return d.iconsInText&&s?"symbolTextAndIcon":b?"symbolSDF":"symbolIcon"}function dd(b,s,d,f,m,x,M,P,D,L,B,V){const W=b.context,K=W.gl,Q=b.transform,re=Fo(),ae=P==="map",ce=D==="map",he=P!=="viewport"&&d.layout.get("symbol-placement")!=="point",ee=ae&&!ce&&!he,me=!ce&&he,ge=!d.layout.get("symbol-sort-key").isConstant();let ve=!1;const Oe=b.depthModeForSublayer(0,Ht.ReadOnly),Ve=d._unevaluatedLayout.hasValue("text-variable-anchor")||d._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Ke=[],nt=re.getCircleRadiusCorrection(Q);for(const We of f){const He=s.getTile(We),ft=He.getBucket(d);if(!ft)continue;const Ot=m?ft.text:ft.icon;if(!Ot||!Ot.segments.get().length||!Ot.hasVisibleVertices)continue;const Ge=Ot.programConfigurations.get(d.id),et=m||ft.sdfIcons,Pt=m?ft.textSizeData:ft.iconSizeData,Nn=ce||Q.pitch!==0,Vt=b.useProgram(Lr(et,m,ft),Ge),Yt=l.ag(Pt,Q.zoom),Bn=b.style.map.terrain&&b.style.map.terrain.getTerrainData(We);let Ii,ns,Vn,rr,qi=[0,0],Di=null;if(m)ns=He.glyphAtlasTexture,Vn=K.LINEAR,Ii=He.glyphAtlasTexture.size,ft.iconsInText&&(qi=He.imageAtlasTexture.size,Di=He.imageAtlasTexture,rr=Nn||b.options.rotating||b.options.zooming||Pt.kind==="composite"||Pt.kind==="camera"?K.LINEAR:K.NEAREST);else{const Qt=d.layout.get("icon-size").constantOr(0)!==1||ft.iconsNeedLinear;ns=He.imageAtlasTexture,Vn=et||b.options.rotating||b.options.zooming||Qt||Nn?K.LINEAR:K.NEAREST,Ii=He.imageAtlasTexture.size}const Wi=Zt(He,1,b.transform.zoom),Is=me?We.posMatrix:Ul,Xa=Ui(Is,ce,ae,b.transform,Wi),Iu=pr(Is,ce,ae,b.transform,Wi),Ka=pr(We.posMatrix,ce,ae,b.transform,Wi),Vr=re.translatePosition(b.transform,He,x,M),Du=Ve&&ft.hasTextData(),Nd=d.layout.get("icon-text-fit")!=="none"&&Du&&ft.hasIconData();if(he){const Qt=b.style.map.terrain?(Ja,Qa)=>b.style.map.terrain.getElevation(We,Ja,Qa):null,Jo=d.layout.get("text-rotation-alignment")==="map";Y(ft,We.posMatrix,b,m,Xa,Ka,ce,L,Jo,re,We.toUnwrapped(),Q.width,Q.height,Vr,Qt)}const Fr=We.posMatrix,$r=m&&Ve||Nd,po=he||$r?Ul:Xa,is=Iu,ki=et&&d.paint.get(m?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Oi;Oi=et?ft.iconsInText?ed(Pt.kind,Yt,ee,ce,he,$r,b,Fr,po,is,Vr,Ii,qi,nt):Fl(Pt.kind,Yt,ee,ce,he,$r,b,Fr,po,is,Vr,m,Ii,!0,nt):Jf(Pt.kind,Yt,ee,ce,he,$r,b,Fr,po,is,Vr,m,Ii,nt);const xr={program:Vt,buffers:Ot,uniformValues:Oi,atlasTexture:ns,atlasTextureIcon:Di,atlasInterpolation:Vn,atlasInterpolationIcon:rr,isSDF:et,hasHalo:ki};if(ge&&ft.canOverlap){ve=!0;const Qt=Ot.segments.get();for(const Jo of Qt)Ke.push({segments:new l.a0([Jo]),sortKey:Jo.sortKey,state:xr,terrainData:Bn})}else Ke.push({segments:Ot.segments,sortKey:0,state:xr,terrainData:Bn})}ve&&Ke.sort((We,He)=>We.sortKey-He.sortKey);for(const We of Ke){const He=We.state;if(W.activeTexture.set(K.TEXTURE0),He.atlasTexture.bind(He.atlasInterpolation,K.CLAMP_TO_EDGE),He.atlasTextureIcon&&(W.activeTexture.set(K.TEXTURE1),He.atlasTextureIcon&&He.atlasTextureIcon.bind(He.atlasInterpolationIcon,K.CLAMP_TO_EDGE)),He.isSDF){const ft=He.uniformValues;He.hasHalo&&(ft.u_is_halo=1,pd(He.buffers,We.segments,d,b,He.program,Oe,B,V,ft,We.terrainData)),ft.u_is_halo=0}pd(He.buffers,We.segments,d,b,He.program,Oe,B,V,He.uniformValues,We.terrainData)}}function pd(b,s,d,f,m,x,M,P,D,L){const B=f.context;m.draw(B,B.gl.TRIANGLES,x,M,P,Cn.disabled,D,L,d.id,b.layoutVertexBuffer,b.indexBuffer,s,d.paint,f.transform.zoom,b.programConfigurations.get(d.id),b.dynamicLayoutVertexBuffer,b.opacityVertexBuffer)}function fd(b,s,d,f){const m=b.context,x=m.gl,M=Dn.disabled,P=new Jn([x.ONE,x.ONE],l.aM.transparent,[!0,!0,!0,!0]),D=s.getBucket(d);if(!D)return;const L=f.key;let B=d.heatmapFbos.get(L);B||(B=Hl(m,s.tileSize,s.tileSize),d.heatmapFbos.set(L,B)),m.bindFramebuffer.set(B.framebuffer),m.viewport.set([0,0,s.tileSize,s.tileSize]),m.clear({color:l.aM.transparent});const V=D.programConfigurations.get(d.id),W=b.useProgram("heatmap",V),K=b.style.map.terrain.getTerrainData(f);W.draw(m,x.TRIANGLES,Ht.disabled,M,P,Cn.disabled,ir(f.posMatrix,s,b.transform.zoom,d.paint.get("heatmap-intensity")),K,d.id,D.layoutVertexBuffer,D.indexBuffer,D.segments,d.paint,b.transform.zoom,V)}function Zo(b,s,d){const f=b.context,m=f.gl;f.setColorMode(b.colorModeForRenderPass());const x=ql(f,s),M=d.key,P=s.heatmapFbos.get(M);P&&(f.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,P.colorAttachment.get()),f.activeTexture.set(m.TEXTURE1),x.bind(m.LINEAR,m.CLAMP_TO_EDGE),b.useProgram("heatmapTexture").draw(f,m.TRIANGLES,Ht.disabled,Dn.disabled,b.colorModeForRenderPass(),Cn.disabled,ru(b,s,0,1),null,s.id,b.rasterBoundsBuffer,b.quadTriangleIndexBuffer,b.rasterBoundsSegments,s.paint,b.transform.zoom),P.destroy(),s.heatmapFbos.delete(M))}function Hl(b,s,d){var f,m;const x=b.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=(f=b.HALF_FLOAT)!==null&&f!==void 0?f:x.UNSIGNED_BYTE,D=(m=b.RGBA16F)!==null&&m!==void 0?m:x.RGBA;x.texImage2D(x.TEXTURE_2D,0,D,s,d,0,x.RGBA,P,null);const L=b.createFramebuffer(s,d,!1,!1);return L.colorAttachment.set(M),L}function ql(b,s){return s.colorRampTexture||(s.colorRampTexture=new it(b,s.colorRamp,b.gl.RGBA)),s.colorRampTexture}function Ra(b,s,d,f,m){if(!d||!f||!f.imageAtlas)return;const x=f.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 D=m.getPaintProperty(s);M=x[D],P=x[D]}M&&P&&b.setConstantPatternPositions(M,P)}function Wl(b,s,d,f,m,x,M){const P=b.context.gl,D="fill-pattern",L=d.paint.get(D),B=L&&L.constantOr(1),V=d.getCrossfadeParameters();let W,K,Q,re,ae;M?(K=B&&!d.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",W=P.LINES):(K=B?"fillPattern":"fill",W=P.TRIANGLES);const ce=L.constantOr(null);for(const he of f){const ee=s.getTile(he);if(B&&!ee.patternsLoaded())continue;const me=ee.getBucket(d);if(!me)continue;const ge=me.programConfigurations.get(d.id),ve=b.useProgram(K,ge),Oe=b.style.map.terrain&&b.style.map.terrain.getTerrainData(he);B&&(b.context.activeTexture.set(P.TEXTURE0),ee.imageAtlasTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),ge.updatePaintBuffers(V)),Ra(ge,D,ce,ee,d);const Ve=Oe?he:null,Ke=b.translatePosMatrix(Ve?Ve.posMatrix:he.posMatrix,ee,d.paint.get("fill-translate"),d.paint.get("fill-translate-anchor"));if(M){re=me.indexBuffer2,ae=me.segments2;const nt=[P.drawingBufferWidth,P.drawingBufferHeight];Q=K==="fillOutlinePattern"&&B?Zf(Ke,b,V,ee,nt):K0(Ke,nt)}else re=me.indexBuffer,ae=me.segments,Q=B?Gf(Ke,b,V,ee):Ia(Ke);ve.draw(b.context,W,m,b.stencilModeForClipping(he),x,Cn.disabled,Q,Oe,d.id,me.layoutVertexBuffer,re,ae,d.paint,b.transform.zoom,ge)}}function pu(b,s,d,f,m,x,M){const P=b.context,D=P.gl,L="fill-extrusion-pattern",B=d.paint.get(L),V=B.constantOr(1),W=d.getCrossfadeParameters(),K=d.paint.get("fill-extrusion-opacity"),Q=B.constantOr(null);for(const re of f){const ae=s.getTile(re),ce=ae.getBucket(d);if(!ce)continue;const he=b.style.map.terrain&&b.style.map.terrain.getTerrainData(re),ee=ce.programConfigurations.get(d.id),me=b.useProgram(V?"fillExtrusionPattern":"fillExtrusion",ee);V&&(b.context.activeTexture.set(D.TEXTURE0),ae.imageAtlasTexture.bind(D.LINEAR,D.CLAMP_TO_EDGE),ee.updatePaintBuffers(W)),Ra(ee,L,Q,ae,d);const ge=b.translatePosMatrix(re.posMatrix,ae,d.paint.get("fill-extrusion-translate"),d.paint.get("fill-extrusion-translate-anchor")),ve=d.paint.get("fill-extrusion-vertical-gradient"),Oe=V?iu(ge,b,ve,K,re,W,ae):Bl(ge,b,ve,K);me.draw(P,P.gl.TRIANGLES,m,x,M,Cn.backCCW,Oe,he,d.id,ce.layoutVertexBuffer,ce.indexBuffer,ce.segments,d.paint,b.transform.zoom,ee,b.style.map.terrain&&ce.centroidVertexBuffer)}}function La(b,s,d,f,m,x,M){const P=b.context,D=P.gl,L=d.fbo;if(!L)return;const B=b.useProgram("hillshade"),V=b.style.map.terrain&&b.style.map.terrain.getTerrainData(s);P.activeTexture.set(D.TEXTURE0),D.bindTexture(D.TEXTURE_2D,L.colorAttachment.get()),B.draw(P,D.TRIANGLES,m,x,M,Cn.disabled,((W,K,Q,re)=>{const ae=Q.paint.get("hillshade-shadow-color"),ce=Q.paint.get("hillshade-highlight-color"),he=Q.paint.get("hillshade-accent-color");let ee=Q.paint.get("hillshade-illumination-direction")*(Math.PI/180);Q.paint.get("hillshade-illumination-anchor")==="viewport"&&(ee-=W.transform.angle);const me=!W.options.moving;return{u_matrix:re?re.posMatrix:W.transform.calculatePosMatrix(K.tileID.toUnwrapped(),me),u_image:0,u_latrange:su(0,K.tileID),u_light:[Q.paint.get("hillshade-exaggeration"),ee],u_shadow:ae,u_highlight:ce,u_accent:he}})(b,d,f,V?s:null),V,f.id,b.rasterBoundsBuffer,b.quadTriangleIndexBuffer,b.rasterBoundsSegments)}function Na(b,s,d,f,m,x){const M=b.context,P=M.gl,D=s.dem;if(D&&D.data){const L=D.dim,B=D.stride,V=D.getPixels();if(M.activeTexture.set(P.TEXTURE1),M.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||b.getTileTexture(B),s.demTexture){const K=s.demTexture;K.update(V,{premultiply:!1}),K.bind(P.NEAREST,P.CLAMP_TO_EDGE)}else s.demTexture=new it(M,V,P.RGBA,{premultiply:!1}),s.demTexture.bind(P.NEAREST,P.CLAMP_TO_EDGE);M.activeTexture.set(P.TEXTURE0);let W=s.fbo;if(!W){const K=new it(M,{width:L,height:L,data:null},P.RGBA);K.bind(P.LINEAR,P.CLAMP_TO_EDGE),W=s.fbo=M.createFramebuffer(L,L,!0,!1),W.colorAttachment.set(K.texture)}M.bindFramebuffer.set(W.framebuffer),M.viewport.set([0,0,L,L]),b.useProgram("hillshadePrepare").draw(M,P.TRIANGLES,f,m,x,Cn.disabled,((K,Q)=>{const re=Q.stride,ae=l.H();return l.aP(ae,0,l.X,-l.X,0,0,1),l.J(ae,ae,[0,-l.X,0]),{u_matrix:ae,u_image:1,u_dimension:[re,re],u_zoom:K.overscaledZ,u_unpack:Q.getUnpackVector()}})(s.tileID,D),null,d.id,b.rasterBoundsBuffer,b.quadTriangleIndexBuffer,b.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function hm(b,s,d,f,m,x){const M=f.paint.get("raster-fade-duration");if(!x&&M>0){const P=E.now(),D=(P-b.timeAdded)/M,L=s?(P-s.timeAdded)/M:-1,B=d.getSource(),V=m.coveringZoomLevel({tileSize:B.tileSize,roundZoom:B.roundZoom}),W=!s||Math.abs(s.tileID.overscaledZ-V)>Math.abs(b.tileID.overscaledZ-V),K=W&&b.refreshedUponExpiration?1:l.ac(W?D:1-L,0,1);return b.refreshedUponExpiration&&D>=1&&(b.refreshedUponExpiration=!1),s?{opacity:1,mix:1-K}:{opacity:K,mix:0}}return{opacity:1,mix:0}}const md=new l.aM(1,0,0,1),cn=new l.aM(0,1,0,1),fu=new l.aM(0,0,1,1),d_=new l.aM(1,0,1,1),dm=new l.aM(0,1,1,1);function Ba(b,s,d,f){mu(b,0,s+d/2,b.transform.width,d,f)}function pm(b,s,d,f){mu(b,s-d/2,0,d,b.transform.height,f)}function mu(b,s,d,f,m,x){const M=b.context,P=M.gl;P.enable(P.SCISSOR_TEST),P.scissor(s*b.pixelRatio,d*b.pixelRatio,f*b.pixelRatio,m*b.pixelRatio),M.clear({color:x}),P.disable(P.SCISSOR_TEST)}function fm(b,s,d){const f=b.context,m=f.gl,x=d.posMatrix,M=b.useProgram("debug"),P=Ht.disabled,D=Dn.disabled,L=b.colorModeForRenderPass(),B="$debug",V=b.style.map.terrain&&b.style.map.terrain.getTerrainData(d);f.activeTexture.set(m.TEXTURE0);const W=s.getTileByID(d.key).latestRawTileData,K=Math.floor((W&&W.byteLength||0)/1024),Q=s.getTile(d).tileSize,re=512/Math.min(Q,512)*(d.overscaledZ/b.transform.zoom)*.5;let ae=d.canonical.toString();d.overscaledZ!==d.canonical.z&&(ae+=` => ${d.overscaledZ}`),function(ce,he){ce.initDebugOverlayCanvas();const ee=ce.debugOverlayCanvas,me=ce.context.gl,ge=ce.debugOverlayCanvas.getContext("2d");ge.clearRect(0,0,ee.width,ee.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(ee),ce.debugOverlayTexture.bind(me.LINEAR,me.CLAMP_TO_EDGE)}(b,`${ae} ${K}kB`),M.draw(f,m.TRIANGLES,P,D,Jn.alphaBlended,Cn.disabled,Vl(x,l.aM.transparent,re),null,B,b.debugBuffer,b.quadTriangleIndexBuffer,b.debugSegments),M.draw(f,m.LINE_STRIP,P,D,L,Cn.disabled,Vl(x,l.aM.red),V,B,b.debugBuffer,b.tileBorderIndexBuffer,b.debugSegments)}function mm(b,s,d){const f=b.context,m=f.gl,x=b.colorModeForRenderPass(),M=new Ht(m.LEQUAL,Ht.ReadWrite,b.depthRangeFor3D),P=b.useProgram("terrain"),D=s.getTerrainMesh();f.bindFramebuffer.set(null),f.viewport.set([0,0,b.width,b.height]);for(const L of d){const B=b.renderToTexture.getTexture(L),V=s.getTerrainData(L.tileID);f.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,B.texture);const W=b.transform.calculatePosMatrix(L.tileID.toUnwrapped()),K=s.getMeshFrameDelta(b.transform.zoom),Q=b.transform.calculateFogMatrix(L.tileID.toUnwrapped()),re=Jh(W,K,Q,b.style.sky,b.transform.pitch);P.draw(f,m.TRIANGLES,M,Dn.disabled,x,Cn.backCCW,re,V,"terrain",D.vertexBuffer,D.indexBuffer,D.segments)}}class gu{constructor(s,d,f){this.vertexBuffer=s,this.indexBuffer=d,this.segments=f}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class yu{constructor(s,d){this.context=new h_(s),this.transform=d,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Re.maxUnderzooming+Re.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Xh}resize(s,d,f){if(this.width=Math.floor(s*f),this.height=Math.floor(d*f),this.pixelRatio=f,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const m of this.style._order)this.style._layers[m].resize()}setup(){const s=this.context,d=new l.aX;d.emplaceBack(0,0),d.emplaceBack(l.X,0),d.emplaceBack(0,l.X),d.emplaceBack(l.X,l.X),this.tileExtentBuffer=s.createVertexBuffer(d,$o.members),this.tileExtentSegments=l.a0.simpleSegment(0,0,4,2);const f=new l.aX;f.emplaceBack(0,0),f.emplaceBack(l.X,0),f.emplaceBack(0,l.X),f.emplaceBack(l.X,l.X),this.debugBuffer=s.createVertexBuffer(f,$o.members),this.debugSegments=l.a0.simpleSegment(0,0,4,5);const m=new l.$;m.emplaceBack(0,0,0,0),m.emplaceBack(l.X,0,l.X,0),m.emplaceBack(0,l.X,0,l.X),m.emplaceBack(l.X,l.X,l.X,l.X),this.rasterBoundsBuffer=s.createVertexBuffer(m,tr.members),this.rasterBoundsSegments=l.a0.simpleSegment(0,0,4,2);const x=new l.aX;x.emplaceBack(0,0),x.emplaceBack(1,0),x.emplaceBack(0,1),x.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(x,$o.members),this.viewportSegments=l.a0.simpleSegment(0,0,4,2);const M=new l.aZ;M.emplaceBack(0),M.emplaceBack(1),M.emplaceBack(3),M.emplaceBack(2),M.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(M);const P=new l.aY;P.emplaceBack(0,1,2),P.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(P);const D=this.context.gl;this.stencilClearMode=new Dn({func:D.ALWAYS,mask:0},0,255,D.ZERO,D.ZERO,D.ZERO)}clearStencil(){const s=this.context,d=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const f=l.H();l.aP(f,0,this.width,this.height,0,0,1),l.K(f,f,[d.drawingBufferWidth,d.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,d.TRIANGLES,Ht.disabled,this.stencilClearMode,Jn.disabled,Cn.disabled,nr(f),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(s,d){if(this.currentStencilSource===s.source||!s.isTileClipped()||!d||!d.length)return;this.currentStencilSource=s.source;const f=this.context,m=f.gl;this.nextStencilID+d.length>256&&this.clearStencil(),f.setColorMode(Jn.disabled),f.setDepthMode(Ht.disabled);const x=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const M of d){const P=this._tileClippingMaskIDs[M.key]=this.nextStencilID++,D=this.style.map.terrain&&this.style.map.terrain.getTerrainData(M);x.draw(f,m.TRIANGLES,Ht.disabled,new Dn({func:m.ALWAYS,mask:0},P,255,m.KEEP,m.KEEP,m.REPLACE),Jn.disabled,Cn.disabled,nr(M.posMatrix),D,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,d=this.context.gl;return new Dn({func:d.NOTEQUAL,mask:255},s,255,d.KEEP,d.KEEP,d.REPLACE)}stencilModeForClipping(s){const d=this.context.gl;return new Dn({func:d.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,d.KEEP,d.KEEP,d.REPLACE)}stencilConfigForOverlap(s){const d=this.context.gl,f=s.sort((M,P)=>P.overscaledZ-M.overscaledZ),m=f[f.length-1].overscaledZ,x=f[0].overscaledZ-m+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+m]=new Dn({func:d.GEQUAL,mask:255},P+this.nextStencilID,255,d.KEEP,d.KEEP,d.REPLACE);return this.nextStencilID+=x,[M,f]}return[{[m]:Dn.disabled},f]}colorModeForRenderPass(){const s=this.context.gl;return this._showOverdrawInspector?new Jn([s.CONSTANT_COLOR,s.ONE],new l.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Jn.unblended:Jn.alphaBlended}depthModeForSublayer(s,d,f){if(!this.opaquePassEnabledForLayer())return Ht.disabled;const m=1-((1+this.currentLayer)*this.numSublayers+s)*this.depthEpsilon;return new Ht(f||this.context.gl.LEQUAL,d,[m,m])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(s,d){this.style=s,this.options=d,this.lineAtlas=s.lineAtlas,this.imageManager=s.imageManager,this.glyphManager=s.glyphManager,this.symbolFadeChange=s.placement.symbolFadeChange(E.now()),this.imageManager.beginFrame();const f=this.style._order,m=this.style.sourceCaches,x={},M={},P={};for(const D in m){const L=m[D];L.used&&L.prepare(this.context),x[D]=L.getVisibleCoordinates(),M[D]=x[D].slice().reverse(),P[D]=L.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let D=0;D<f.length;D++)if(this.style._layers[f[D]].is3D()){this.opaquePassCutoff=D;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const D of f){const L=this.style._layers[D];if(!L.hasOffscreenPass()||L.isHidden(this.transform.zoom))continue;const B=M[L.source];(L.type==="custom"||B.length)&&this.renderLayer(this,m[L.source],L,B)}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(D,L){const B=D.context,V=B.gl,W=((ce,he,ee)=>({u_sky_color:ce.properties.get("sky-color"),u_horizon_color:ce.properties.get("horizon-color"),u_horizon:(he.height/2+he.getHorizon())*ee,u_sky_horizon_blend:ce.properties.get("sky-horizon-blend")*he.height/2*ee}))(L,D.style.map.transform,D.pixelRatio),K=new Ht(V.LEQUAL,Ht.ReadWrite,[0,1]),Q=Dn.disabled,re=D.colorModeForRenderPass(),ae=D.useProgram("sky");if(!L.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),L.mesh=new gu(B.createVertexBuffer(ce,$o.members),B.createIndexBuffer(he),l.a0.simpleSegment(0,0,ce.length,he.length))}ae.draw(B,V.TRIANGLES,K,Q,re,Cn.disabled,W,void 0,"sky",L.mesh.vertexBuffer,L.mesh.indexBuffer,L.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=d.showOverdrawInspector,this.depthRangeFor3D=[0,1-(s._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=f.length-1;this.currentLayer>=0;this.currentLayer--){const D=this.style._layers[f[this.currentLayer]],L=m[D.source],B=x[D.source];this._renderTileClippingMasks(D,B),this.renderLayer(this,L,D,B)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<f.length;this.currentLayer++){const D=this.style._layers[f[this.currentLayer]],L=m[D.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(D))continue;const B=(D.type==="symbol"?P:M)[D.source];this._renderTileClippingMasks(D,x[D.source]),this.renderLayer(this,L,D,B)}if(this.options.showTileBoundaries){const D=function(L,B){let V=null;const W=Object.values(L._layers).flatMap(ae=>ae.source&&!ae.isHidden(B)?[L.sourceCaches[ae.source]]:[]),K=W.filter(ae=>ae.getSource().type==="vector"),Q=W.filter(ae=>ae.getSource().type!=="vector"),re=ae=>{(!V||V.getSource().maxzoom<ae.getSource().maxzoom)&&(V=ae)};return K.forEach(ae=>re(ae)),V||Q.forEach(ae=>re(ae)),V}(this.style,this.transform.zoom);D&&function(L,B,V){for(let W=0;W<V.length;W++)fm(L,B,V[W])}(this,D,D.getVisibleCoordinates())}this.options.showPadding&&function(D){const L=D.transform.padding;Ba(D,D.transform.height-(L.top||0),3,md),Ba(D,L.bottom||0,3,cn),pm(D,L.left||0,3,fu),pm(D,D.transform.width-(L.right||0),3,d_);const B=D.transform.centerPoint;(function(V,W,K,Q){mu(V,W-1,K-10,2,20,Q),mu(V,W-10,K-1,20,2,Q)})(D,B.x,D.transform.height-B.y,dm)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(s){if(!this.style||!this.style.map||!this.style.map.terrain)return;const d=this.terrainFacilitator.matrix,f=this.transform.modelViewProjectionMatrix;let m=this.terrainFacilitator.dirty;m||(m=s?!l.a_(d,f):!l.a$(d,f)),m||(m=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),m&&(l.b0(d,f),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(x,M){const P=x.context,D=P.gl,L=Jn.unblended,B=new Ht(D.LEQUAL,Ht.ReadWrite,[0,1]),V=M.getTerrainMesh(),W=M.sourceCache.getRenderableTiles(),K=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 Q of W){const re=M.getTerrainData(Q.tileID),ae={u_matrix:x.transform.calculatePosMatrix(Q.tileID.toUnwrapped()),u_ele_delta:M.getMeshFrameDelta(x.transform.zoom)};K.draw(P,D.TRIANGLES,B,Dn.disabled,L,Cn.backCCW,ae,re,"terrain",V.vertexBuffer,V.indexBuffer,V.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,D=P.gl,L=Jn.unblended,B=new Ht(D.LEQUAL,Ht.ReadWrite,[0,1]),V=M.getTerrainMesh(),W=M.getCoordsTexture(),K=M.sourceCache.getRenderableTiles(),Q=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 K){const ae=M.getTerrainData(re.tileID);P.activeTexture.set(D.TEXTURE0),D.bindTexture(D.TEXTURE_2D,W.texture);const ce={u_matrix:x.transform.calculatePosMatrix(re.tileID.toUnwrapped()),u_terrain_coords_id:(255-M.coordsIndex.length)/255,u_texture:0,u_ele_delta:M.getMeshFrameDelta(x.transform.zoom)};Q.draw(P,D.TRIANGLES,B,Dn.disabled,L,Cn.backCCW,ce,ae,"terrain",V.vertexBuffer,V.indexBuffer,V.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(s,d,f,m){if(!f.isHidden(this.transform.zoom)&&(f.type==="background"||f.type==="custom"||(m||[]).length))switch(this.id=f.id,f.type){case"symbol":(function(x,M,P,D,L){if(x.renderPass!=="translucent")return;const B=Dn.disabled,V=x.colorModeForRenderPass();(P._unevaluatedLayout.hasValue("text-variable-anchor")||P._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(W,K,Q,re,ae,ce,he,ee,me){const ge=K.transform,ve=Fo(),Oe=ae==="map",Ve=ce==="map";for(const Ke of W){const nt=re.getTile(Ke),We=nt.getBucket(Q);if(!We||!We.text||!We.text.segments.get().length)continue;const He=l.ag(We.textSizeData,ge.zoom),ft=Zt(nt,1,K.transform.zoom),Ot=Ui(Ke.posMatrix,Ve,Oe,K.transform,ft),Ge=Q.layout.get("icon-text-fit")!=="none"&&We.hasIconData();if(He){const et=Math.pow(2,ge.zoom-nt.tileID.overscaledZ),Pt=K.style.map.terrain?(Vt,Yt)=>K.style.map.terrain.getElevation(Ke,Vt,Yt):null,Nn=ve.translatePosition(ge,nt,he,ee);za(We,Oe,Ve,me,ge,Ot,Ke.posMatrix,et,He,Ge,ve,Nn,Ke.toUnwrapped(),Pt)}}}(D,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"),L),P.paint.get("icon-opacity").constantOr(1)!==0&&dd(x,M,P,D,!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"),B,V),P.paint.get("text-opacity").constantOr(1)!==0&&dd(x,M,P,D,!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"),B,V),M.map.showCollisionBoxes&&(jl(x,M,P,D,!0),jl(x,M,P,D,!1))})(s,d,f,m,this.style.placement.variableOffsets);break;case"circle":(function(x,M,P,D){if(x.renderPass!=="translucent")return;const L=P.paint.get("circle-opacity"),B=P.paint.get("circle-stroke-width"),V=P.paint.get("circle-stroke-opacity"),W=!P.layout.get("circle-sort-key").isConstant();if(L.constantOr(1)===0&&(B.constantOr(1)===0||V.constantOr(1)===0))return;const K=x.context,Q=K.gl,re=x.depthModeForSublayer(0,Ht.ReadOnly),ae=Dn.disabled,ce=x.colorModeForRenderPass(),he=[];for(let ee=0;ee<D.length;ee++){const me=D[ee],ge=M.getTile(me),ve=ge.getBucket(P);if(!ve)continue;const Oe=ve.programConfigurations.get(P.id),Ve=x.useProgram("circle",Oe),Ke=ve.layoutVertexBuffer,nt=ve.indexBuffer,We=x.style.map.terrain&&x.style.map.terrain.getTerrainData(me),He={programConfiguration:Oe,program:Ve,layoutVertexBuffer:Ke,indexBuffer:nt,uniformValues:J0(x,me,ge,P),terrainData:We};if(W){const ft=ve.segments.get();for(const Ot of ft)he.push({segments:new l.a0([Ot]),sortKey:Ot.sortKey,state:He})}else he.push({segments:ve.segments,sortKey:0,state:He})}W&&he.sort((ee,me)=>ee.sortKey-me.sortKey);for(const ee of he){const{programConfiguration:me,program:ge,layoutVertexBuffer:ve,indexBuffer:Oe,uniformValues:Ve,terrainData:Ke}=ee.state;ge.draw(K,Q.TRIANGLES,re,ae,ce,Cn.disabled,Ve,Ke,P.id,ve,Oe,ee.segments,P.paint,x.transform.zoom,me)}})(s,d,f,m);break;case"heatmap":(function(x,M,P,D){if(P.paint.get("heatmap-opacity")===0)return;const L=x.context;if(x.style.map.terrain){for(const B of D){const V=M.getTile(B);M.hasRenderableParent(B)||(x.renderPass==="offscreen"?fd(x,V,P,B):x.renderPass==="translucent"&&Zo(x,P,B))}L.viewport.set([0,0,x.width,x.height])}else x.renderPass==="offscreen"?function(B,V,W,K){const Q=B.context,re=Q.gl,ae=Dn.disabled,ce=new Jn([re.ONE,re.ONE],l.aM.transparent,[!0,!0,!0,!0]);(function(he,ee,me){const ge=he.gl;he.activeTexture.set(ge.TEXTURE1),he.viewport.set([0,0,ee.width/4,ee.height/4]);let ve=me.heatmapFbos.get(l.aU);ve?(ge.bindTexture(ge.TEXTURE_2D,ve.colorAttachment.get()),he.bindFramebuffer.set(ve.framebuffer)):(ve=Hl(he,ee.width/4,ee.height/4),me.heatmapFbos.set(l.aU,ve))})(Q,B,W),Q.clear({color:l.aM.transparent});for(let he=0;he<K.length;he++){const ee=K[he];if(V.hasRenderableParent(ee))continue;const me=V.getTile(ee),ge=me.getBucket(W);if(!ge)continue;const ve=ge.programConfigurations.get(W.id),Oe=B.useProgram("heatmap",ve),{zoom:Ve}=B.transform;Oe.draw(Q,re.TRIANGLES,Ht.disabled,ae,ce,Cn.disabled,ir(ee.posMatrix,me,Ve,W.paint.get("heatmap-intensity")),null,W.id,ge.layoutVertexBuffer,ge.indexBuffer,ge.segments,W.paint,B.transform.zoom,ve)}Q.viewport.set([0,0,B.width,B.height])}(x,M,P,D):x.renderPass==="translucent"&&function(B,V){const W=B.context,K=W.gl;W.setColorMode(B.colorModeForRenderPass());const Q=V.heatmapFbos.get(l.aU);Q&&(W.activeTexture.set(K.TEXTURE0),K.bindTexture(K.TEXTURE_2D,Q.colorAttachment.get()),W.activeTexture.set(K.TEXTURE1),ql(W,V).bind(K.LINEAR,K.CLAMP_TO_EDGE),B.useProgram("heatmapTexture").draw(W,K.TRIANGLES,Ht.disabled,Dn.disabled,B.colorModeForRenderPass(),Cn.disabled,ru(B,V,0,1),null,V.id,B.viewportBuffer,B.quadTriangleIndexBuffer,B.viewportSegments,V.paint,B.transform.zoom))}(x,P)})(s,d,f,m);break;case"line":(function(x,M,P,D){if(x.renderPass!=="translucent")return;const L=P.paint.get("line-opacity"),B=P.paint.get("line-width");if(L.constantOr(1)===0||B.constantOr(1)===0)return;const V=x.depthModeForSublayer(0,Ht.ReadOnly),W=x.colorModeForRenderPass(),K=P.paint.get("line-dasharray"),Q=P.paint.get("line-pattern"),re=Q.constantOr(1),ae=P.paint.get("line-gradient"),ce=P.getCrossfadeParameters(),he=re?"linePattern":K?"lineSDF":ae?"lineGradient":"line",ee=x.context,me=ee.gl;let ge=!0;for(const ve of D){const Oe=M.getTile(ve);if(re&&!Oe.patternsLoaded())continue;const Ve=Oe.getBucket(P);if(!Ve)continue;const Ke=Ve.programConfigurations.get(P.id),nt=x.context.program.get(),We=x.useProgram(he,Ke),He=ge||We.program!==nt,ft=x.style.map.terrain&&x.style.map.terrain.getTerrainData(ve),Ot=Q.constantOr(null);if(Ot&&Oe.imageAtlas){const Pt=Oe.imageAtlas,Nn=Pt.patternPositions[Ot.to.toString()],Vt=Pt.patternPositions[Ot.from.toString()];Nn&&Vt&&Ke.setConstantPatternPositions(Nn,Vt)}const Ge=ft?ve:null,et=re?Da(x,Oe,P,ce,Ge):K?Q0(x,Oe,P,K,ce,Ge):ae?Yf(x,Oe,P,Ve.lineClipsArray.length,Ge):ou(x,Oe,P,Ge);if(re)ee.activeTexture.set(me.TEXTURE0),Oe.imageAtlasTexture.bind(me.LINEAR,me.CLAMP_TO_EDGE),Ke.updatePaintBuffers(ce);else if(K&&(He||x.lineAtlas.dirty))ee.activeTexture.set(me.TEXTURE0),x.lineAtlas.bind(ee);else if(ae){const Pt=Ve.gradients[P.id];let Nn=Pt.texture;if(P.gradientVersion!==Pt.version){let Vt=256;if(P.stepInterpolant){const Yt=M.getSource().maxzoom,Bn=ve.canonical.z===Yt?Math.ceil(1<<x.transform.maxZoom-ve.canonical.z):1;Vt=l.ac(l.aV(Ve.maxLineLength/l.X*1024*Bn),256,ee.maxTextureSize)}Pt.gradient=l.aW({expression:P.gradientExpression(),evaluationKey:"lineProgress",resolution:Vt,image:Pt.gradient||void 0,clips:Ve.lineClipsArray}),Pt.texture?Pt.texture.update(Pt.gradient):Pt.texture=new it(ee,Pt.gradient,me.RGBA),Pt.version=P.gradientVersion,Nn=Pt.texture}ee.activeTexture.set(me.TEXTURE0),Nn.bind(P.stepInterpolant?me.NEAREST:me.LINEAR,me.CLAMP_TO_EDGE)}We.draw(ee,me.TRIANGLES,V,x.stencilModeForClipping(ve),W,Cn.disabled,et,ft,P.id,Ve.layoutVertexBuffer,Ve.indexBuffer,Ve.segments,P.paint,x.transform.zoom,Ke,Ve.layoutVertexBuffer2),ge=!1}})(s,d,f,m);break;case"fill":(function(x,M,P,D){const L=P.paint.get("fill-color"),B=P.paint.get("fill-opacity");if(B.constantOr(1)===0)return;const V=x.colorModeForRenderPass(),W=P.paint.get("fill-pattern"),K=x.opaquePassEnabledForLayer()&&!W.constantOr(1)&&L.constantOr(l.aM.transparent).a===1&&B.constantOr(0)===1?"opaque":"translucent";if(x.renderPass===K){const Q=x.depthModeForSublayer(1,x.renderPass==="opaque"?Ht.ReadWrite:Ht.ReadOnly);Wl(x,M,P,D,Q,V,!1)}if(x.renderPass==="translucent"&&P.paint.get("fill-antialias")){const Q=x.depthModeForSublayer(P.getPaintProperty("fill-outline-color")?2:0,Ht.ReadOnly);Wl(x,M,P,D,Q,V,!0)}})(s,d,f,m);break;case"fill-extrusion":(function(x,M,P,D){const L=P.paint.get("fill-extrusion-opacity");if(L!==0&&x.renderPass==="translucent"){const B=new Ht(x.context.gl.LEQUAL,Ht.ReadWrite,x.depthRangeFor3D);if(L!==1||P.paint.get("fill-extrusion-pattern").constantOr(1))pu(x,M,P,D,B,Dn.disabled,Jn.disabled),pu(x,M,P,D,B,x.stencilModeFor3D(),x.colorModeForRenderPass());else{const V=x.colorModeForRenderPass();pu(x,M,P,D,B,Dn.disabled,V)}}})(s,d,f,m);break;case"hillshade":(function(x,M,P,D){if(x.renderPass!=="offscreen"&&x.renderPass!=="translucent")return;const L=x.context,B=x.depthModeForSublayer(0,Ht.ReadOnly),V=x.colorModeForRenderPass(),[W,K]=x.renderPass==="translucent"?x.stencilConfigForOverlap(D):[{},D];for(const Q of K){const re=M.getTile(Q);re.needsHillshadePrepare!==void 0&&re.needsHillshadePrepare&&x.renderPass==="offscreen"?Na(x,re,P,B,Dn.disabled,V):x.renderPass==="translucent"&&La(x,Q,re,P,B,W[Q.overscaledZ],V)}L.viewport.set([0,0,x.width,x.height])})(s,d,f,m);break;case"raster":(function(x,M,P,D){if(x.renderPass!=="translucent"||P.paint.get("raster-opacity")===0||!D.length)return;const L=x.context,B=L.gl,V=M.getSource(),W=x.useProgram("raster"),K=x.colorModeForRenderPass(),[Q,re]=V instanceof xi?[{},D]:x.stencilConfigForOverlap(D),ae=re[re.length-1].overscaledZ,ce=!x.options.moving;for(const he of re){const ee=x.depthModeForSublayer(he.overscaledZ-ae,P.paint.get("raster-opacity")===1?Ht.ReadWrite:Ht.ReadOnly,B.LESS),me=M.getTile(he);me.registerFadeDuration(P.paint.get("raster-fade-duration"));const ge=M.findLoadedParent(he,0),ve=M.findLoadedSibling(he),Oe=hm(me,ge||ve||null,M,P,x.transform,x.style.map.terrain);let Ve,Ke;const nt=P.paint.get("raster-resampling")==="nearest"?B.NEAREST:B.LINEAR;L.activeTexture.set(B.TEXTURE0),me.texture.bind(nt,B.CLAMP_TO_EDGE,B.LINEAR_MIPMAP_NEAREST),L.activeTexture.set(B.TEXTURE1),ge?(ge.texture.bind(nt,B.CLAMP_TO_EDGE,B.LINEAR_MIPMAP_NEAREST),Ve=Math.pow(2,ge.tileID.overscaledZ-me.tileID.overscaledZ),Ke=[me.tileID.canonical.x*Ve%1,me.tileID.canonical.y*Ve%1]):me.texture.bind(nt,B.CLAMP_TO_EDGE,B.LINEAR_MIPMAP_NEAREST),me.texture.useMipmap&&L.extTextureFilterAnisotropic&&x.transform.pitch>20&&B.texParameterf(B.TEXTURE_2D,L.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,L.extTextureFilterAnisotropicMax);const We=x.style.map.terrain&&x.style.map.terrain.getTerrainData(he),He=We?he:null,ft=He?He.posMatrix:x.transform.calculatePosMatrix(he.toUnwrapped(),ce),Ot=e_(ft,Ke||[0,0],Ve||1,Oe,P);V instanceof xi?W.draw(L,B.TRIANGLES,ee,Dn.disabled,K,Cn.disabled,Ot,We,P.id,V.boundsBuffer,x.quadTriangleIndexBuffer,V.boundsSegments):W.draw(L,B.TRIANGLES,ee,Q[he.overscaledZ],K,Cn.disabled,Ot,We,P.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments)}})(s,d,f,m);break;case"background":(function(x,M,P,D){const L=P.paint.get("background-color"),B=P.paint.get("background-opacity");if(B===0)return;const V=x.context,W=V.gl,K=x.transform,Q=K.tileSize,re=P.paint.get("background-pattern");if(x.isPatternMissing(re))return;const ae=!re&&L.a===1&&B===1&&x.opaquePassEnabledForLayer()?"opaque":"translucent";if(x.renderPass!==ae)return;const ce=Dn.disabled,he=x.depthModeForSublayer(0,ae==="opaque"?Ht.ReadWrite:Ht.ReadOnly),ee=x.colorModeForRenderPass(),me=x.useProgram(re?"backgroundPattern":"background"),ge=D||K.coveringTiles({tileSize:Q,terrain:x.style.map.terrain});re&&(V.activeTexture.set(W.TEXTURE0),x.imageManager.bind(x.context));const ve=P.getCrossfadeParameters();for(const Oe of ge){const Ve=D?Oe.posMatrix:x.transform.calculatePosMatrix(Oe.toUnwrapped()),Ke=re?td(Ve,B,x,re,{tileID:Oe,tileSize:Q},ve):au(Ve,B,L),nt=x.style.map.terrain&&x.style.map.terrain.getTerrainData(Oe);me.draw(V,W.TRIANGLES,he,ce,ee,Cn.disabled,Ke,nt,P.id,x.tileExtentBuffer,x.quadTriangleIndexBuffer,x.tileExtentSegments)}})(s,0,f,m);break;case"custom":(function(x,M,P){const D=x.context,L=P.implementation;if(x.renderPass==="offscreen"){const B=L.prerender;B&&(x.setCustomLayerDefaults(),D.setColorMode(x.colorModeForRenderPass()),B.call(L,D.gl,x.transform.customLayerMatrix()),D.setDirty(),x.setBaseState())}else if(x.renderPass==="translucent"){x.setCustomLayerDefaults(),D.setColorMode(x.colorModeForRenderPass()),D.setStencilMode(Dn.disabled);const B=L.renderingMode==="3d"?new Ht(x.context.gl.LEQUAL,Ht.ReadWrite,x.depthRangeFor3D):x.depthModeForSublayer(0,Ht.ReadOnly);D.setDepthMode(B),L.render(D.gl,x.transform.customLayerMatrix(),{farZ:x.transform.farZ,nearZ:x.transform.nearZ,fov:x.transform._fov,modelViewProjectionMatrix:x.transform.modelViewProjectionMatrix,projectionMatrix:x.transform.projectionMatrix}),D.setDirty(),x.setBaseState(),D.bindFramebuffer.set(null)}})(s,0,f)}}translatePosMatrix(s,d,f,m,x){if(!f[0]&&!f[1])return s;const M=x?m==="map"?this.transform.angle:0:m==="viewport"?-this.transform.angle:0;if(M){const L=Math.sin(M),B=Math.cos(M);f=[f[0]*B-f[1]*L,f[0]*L+f[1]*B]}const P=[x?f[0]:Zt(d,f[0],this.transform.zoom),x?f[1]:Zt(d,f[1],this.transform.zoom),0],D=new Float32Array(16);return l.J(D,s,P),D}saveTileTexture(s){const d=this._tileTextures[s.size[0]];d?d.push(s):this._tileTextures[s.size[0]]=[s]}getTileTexture(s){const d=this._tileTextures[s];return d&&d.length>0?d.pop():null}isPatternMissing(s){if(!s)return!1;if(!s.from||!s.to)return!0;const d=this.imageManager.getPattern(s.from.toString()),f=this.imageManager.getPattern(s.to.toString());return!d||!f}useProgram(s,d){this.cache=this.cache||{};const f=s+(d?d.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[f]||(this.cache[f]=new Qh(this.context,uo[s],d,nd[s],this._showOverdrawInspector,this.style.map.terrain)),this.cache[f]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const s=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(s.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new it(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:s,drawingBufferHeight:d}=this.context.gl;return this.width!==s||this.height!==d}}class Va{constructor(s,d){this.points=s,this.planes=d}static fromInvProjectionMatrix(s,d,f){const m=Math.pow(2,f),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 D=1/(P=l.af([],P,s))[3]/d*m;return l.b1(P,P,[D,D,1/P[3],D])}),M=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(P=>{const D=function(W,K){var Q=K[0],re=K[1],ae=K[2],ce=Q*Q+re*re+ae*ae;return ce>0&&(ce=1/Math.sqrt(ce)),W[0]=K[0]*ce,W[1]=K[1]*ce,W[2]=K[2]*ce,W}([],function(W,K,Q){var re=K[0],ae=K[1],ce=K[2],he=Q[0],ee=Q[1],me=Q[2];return W[0]=ae*me-ce*ee,W[1]=ce*he-re*me,W[2]=re*ee-ae*he,W}([],Ae([],x[P[0]],x[P[1]]),Ae([],x[P[2]],x[P[1]]))),L=-((B=D)[0]*(V=x[P[1]])[0]+B[1]*V[1]+B[2]*V[2]);var B,V;return D.concat(L)});return new Va(x,M)}}class Fa{constructor(s,d){this.min=s,this.max=d,this.center=function(f,m,x){return f[0]=.5*m[0],f[1]=.5*m[1],f[2]=.5*m[2],f}([],function(f,m,x){return f[0]=m[0]+x[0],f[1]=m[1]+x[1],f[2]=m[2]+x[2],f}([],this.min,this.max))}quadrant(s){const d=[s%2==0,s<2],f=Ee(this.min),m=Ee(this.max);for(let x=0;x<d.length;x++)f[x]=d[x]?this.min[x]:this.center[x],m[x]=d[x]?this.center[x]:this.max[x];return m[2]=this.max[2],new Fa(f,m)}distanceX(s){return Math.max(Math.min(this.max[0],s[0]),this.min[0])-s[0]}distanceY(s){return Math.max(Math.min(this.max[1],s[1]),this.min[1])-s[1]}intersects(s){const d=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let f=!0;for(let m=0;m<s.planes.length;m++){const x=s.planes[m];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&&(f=!1)}if(f)return 2;for(let m=0;m<3;m++){let x=Number.MAX_VALUE,M=-Number.MAX_VALUE;for(let P=0;P<s.points.length;P++){const D=s.points[P][m]-this.min[m];x=Math.min(x,D),M=Math.max(M,D)}if(M<0||x>this.max[m]-this.min[m])return 0}return 1}}class $a{constructor(s=0,d=0,f=0,m=0){if(isNaN(s)||s<0||isNaN(d)||d<0||isNaN(f)||f<0||isNaN(m)||m<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=d,this.left=f,this.right=m}interpolate(s,d,f){return d.top!=null&&s.top!=null&&(this.top=l.y.number(s.top,d.top,f)),d.bottom!=null&&s.bottom!=null&&(this.bottom=l.y.number(s.bottom,d.bottom,f)),d.left!=null&&s.left!=null&&(this.left=l.y.number(s.left,d.left,f)),d.right!=null&&s.right!=null&&(this.right=l.y.number(s.right,d.right,f)),this}getCenter(s,d){const f=l.ac((this.left+s-this.right)/2,0,s),m=l.ac((this.top+d-this.bottom)/2,0,d);return new l.P(f,m)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new $a(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const gd=85.051129;class ja{constructor(s,d,f,m,x){this.tileSize=512,this._renderWorldCopies=x===void 0||!!x,this._minZoom=s||0,this._maxZoom=d||22,this._minPitch=f??0,this._maxPitch=m??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new l.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new $a,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const s=new ja(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return s.apply(this),s}apply(s){this.tileSize=s.tileSize,this.latRange=s.latRange,this.lngRange=s.lngRange,this.width=s.width,this.height=s.height,this._center=s._center,this._elevation=s._elevation,this.minElevationForCurrentTile=s.minElevationForCurrentTile,this.zoom=s.zoom,this.angle=s.angle,this._fov=s._fov,this._pitch=s._pitch,this._unmodified=s._unmodified,this._edgeInsets=s._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(s){this._minZoom!==s&&(this._minZoom=s,this.zoom=Math.max(this.zoom,s))}get maxZoom(){return this._maxZoom}set maxZoom(s){this._maxZoom!==s&&(this._maxZoom=s,this.zoom=Math.min(this.zoom,s))}get minPitch(){return this._minPitch}set minPitch(s){this._minPitch!==s&&(this._minPitch=s,this.pitch=Math.max(this.pitch,s))}get maxPitch(){return this._maxPitch}set maxPitch(s){this._maxPitch!==s&&(this._maxPitch=s,this.pitch=Math.min(this.pitch,s))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(s){s===void 0?s=!0:s===null&&(s=!1),this._renderWorldCopies=s}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(s){const d=-l.b3(s,-180,180)*Math.PI/180;this.angle!==d&&(this._unmodified=!1,this.angle=d,this._calcMatrices(),this.rotationMatrix=function(){var f=new l.A(4);return l.A!=Float32Array&&(f[1]=0,f[2]=0),f[0]=1,f[3]=1,f}(),function(f,m,x){var M=m[0],P=m[1],D=m[2],L=m[3],B=Math.sin(x),V=Math.cos(x);f[0]=M*V+D*B,f[1]=P*V+L*B,f[2]=M*-B+D*V,f[3]=P*-B+L*V}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const d=l.ac(s,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==d&&(this._unmodified=!1,this._pitch=d,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(s){s=Math.max(.01,Math.min(60,s)),this._fov!==s&&(this._unmodified=!1,this._fov=s/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(s){const d=Math.min(Math.max(s,this.minZoom),this.maxZoom);this._zoom!==d&&(this._unmodified=!1,this._zoom=d,this.tileZoom=Math.max(0,Math.floor(d)),this.scale=this.zoomScale(d),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(s){s.lat===this._center.lat&&s.lng===this._center.lng||(this._unmodified=!1,this._center=s,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(s){s!==this._elevation&&(this._elevation=s,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(s){this._edgeInsets.equals(s)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,s,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(s){return this._edgeInsets.equals(s)}interpolatePadding(s,d,f){this._unmodified=!1,this._edgeInsets.interpolate(s,d,f),this._constrain(),this._calcMatrices()}coveringZoomLevel(s){const d=(s.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/s.tileSize));return Math.max(0,d)}getVisibleUnwrappedCoordinates(s){const d=[new l.b4(0,s)];if(this._renderWorldCopies){const f=this.pointCoordinate(new l.P(0,0)),m=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(f.x,m.x,x.x,M.x)),D=Math.floor(Math.max(f.x,m.x,x.x,M.x)),L=1;for(let B=P-L;B<=D+L;B++)B!==0&&d.push(new l.b4(B,s))}return d}coveringTiles(s){var d,f;let m=this.coveringZoomLevel(s);const x=m;if(s.minzoom!==void 0&&m<s.minzoom)return[];s.maxzoom!==void 0&&m>s.maxzoom&&(m=s.maxzoom);const M=this.pointCoordinate(this.getCameraPoint()),P=l.Z.fromLngLat(this.center),D=Math.pow(2,m),L=[D*M.x,D*M.y,0],B=[D*P.x,D*P.y,0],V=Va.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,m);let W=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(W=m);const K=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,Q=ee=>({aabb:new Fa([ee*D,0,0],[(ee+1)*D,D,0]),zoom:0,x:0,y:0,wrap:ee,fullyVisible:!1}),re=[],ae=[],ce=m,he=s.reparseOverscaled?x:m;if(this._renderWorldCopies)for(let ee=1;ee<=3;ee++)re.push(Q(-ee)),re.push(Q(ee));for(re.push(Q(0));re.length>0;){const ee=re.pop(),me=ee.x,ge=ee.y;let ve=ee.fullyVisible;if(!ve){const We=ee.aabb.intersects(V);if(We===0)continue;ve=We===2}const Oe=s.terrain?L:B,Ve=ee.aabb.distanceX(Oe),Ke=ee.aabb.distanceY(Oe),nt=Math.max(Math.abs(Ve),Math.abs(Ke));if(ee.zoom===ce||nt>K+(1<<ce-ee.zoom)-2&&ee.zoom>=W){const We=ce-ee.zoom,He=L[0]-.5-(me<<We),ft=L[1]-.5-(ge<<We);ae.push({tileID:new l.S(ee.zoom===ce?he:ee.zoom,ee.wrap,ee.zoom,me,ge),distanceSq:Le([B[0]-.5-me,B[1]-.5-ge]),tileDistanceToCamera:Math.sqrt(He*He+ft*ft)})}else for(let We=0;We<4;We++){const He=(me<<1)+We%2,ft=(ge<<1)+(We>>1),Ot=ee.zoom+1;let Ge=ee.aabb.quadrant(We);if(s.terrain){const et=new l.S(Ot,ee.wrap,Ot,He,ft),Pt=s.terrain.getMinMaxElevation(et),Nn=(d=Pt.minElevation)!==null&&d!==void 0?d:this.elevation,Vt=(f=Pt.maxElevation)!==null&&f!==void 0?f:this.elevation;Ge=new Fa([Ge.min[0],Ge.min[1],Nn],[Ge.max[0],Ge.max[1],Vt])}re.push({aabb:Ge,zoom:Ot,x:He,y:ft,wrap:ee.wrap,fullyVisible:ve})}}return ae.sort((ee,me)=>ee.distanceSq-me.distanceSq).map(ee=>ee.tileID)}resize(s,d){this.width=s,this.height=d,this.pixelsToGLUnits=[2/s,-2/d],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(s){return Math.pow(2,s)}scaleZoom(s){return Math.log(s)/Math.LN2}project(s){const d=l.ac(s.lat,-85.051129,gd);return new l.P(l.O(s.lng)*this.worldSize,l.Q(d)*this.worldSize)}unproject(s){return new l.Z(s.x/this.worldSize,s.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(s){const d=this.elevation,f=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,m=this.pointLocation(this.centerPoint,s),x=s.getElevationForLngLatZoom(m,this.tileZoom);if(!(this.elevation-x))return;const M=f+d-x,P=Math.cos(this._pitch)*this.cameraToCenterDistance/M/l.b5(1,m.lat),D=this.scaleZoom(P/this.tileSize);this._elevation=x,this._center=m,this.zoom=D}setLocationAtPoint(s,d){const f=this.pointCoordinate(d),m=this.pointCoordinate(this.centerPoint),x=this.locationCoordinate(s),M=new l.Z(x.x-(f.x-m.x),x.y-(f.y-m.y));this.center=this.coordinateLocation(M),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(s,d){return d?this.coordinatePoint(this.locationCoordinate(s),d.getElevationForLngLatZoom(s,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(s))}pointLocation(s,d){return this.coordinateLocation(this.pointCoordinate(s,d))}locationCoordinate(s){return l.Z.fromLngLat(s)}coordinateLocation(s){return s&&s.toLngLat()}pointCoordinate(s,d){if(d){const W=d.pointCoordinate(s);if(W!=null)return W}const f=[s.x,s.y,0,1],m=[s.x,s.y,1,1];l.af(f,f,this.pixelMatrixInverse),l.af(m,m,this.pixelMatrixInverse);const x=f[3],M=m[3],P=f[1]/x,D=m[1]/M,L=f[2]/x,B=m[2]/M,V=L===B?0:(0-L)/(B-L);return new l.Z(l.y.number(f[0]/x,m[0]/M,V)/this.worldSize,l.y.number(P,D,V)/this.worldSize)}coordinatePoint(s,d=0,f=this.pixelMatrix){const m=[s.x*this.worldSize,s.y*this.worldSize,d,1];return l.af(m,m,f),new l.P(m[0]/m[3],m[1]/m[3])}getBounds(){const s=Math.max(0,this.height/2-this.getHorizon());return new ke().extend(this.pointLocation(new l.P(0,s))).extend(this.pointLocation(new l.P(this.width,s))).extend(this.pointLocation(new l.P(this.width,this.height))).extend(this.pointLocation(new l.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ke([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(s){s?(this.lngRange=[s.getWest(),s.getEast()],this.latRange=[s.getSouth(),s.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,gd])}calculateTileMatrix(s){const d=s.canonical,f=this.worldSize/this.zoomScale(d.z),m=d.x+Math.pow(2,d.z)*s.wrap,x=l.an(new Float64Array(16));return l.J(x,x,[m*f,d.y*f,0]),l.K(x,x,[f/l.X,f/l.X,1]),x}calculatePosMatrix(s,d=!1){const f=s.key,m=d?this._alignedPosMatrixCache:this._posMatrixCache;if(m[f])return m[f];const x=this.calculateTileMatrix(s);return l.L(x,d?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,x),m[f]=new Float32Array(x),m[f]}calculateFogMatrix(s){const d=s.key,f=this._fogMatrixCache;if(f[d])return f[d];const m=this.calculateTileMatrix(s);return l.L(m,this.fogMatrix,m),f[d]=new Float32Array(m),f[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(s,d){d=l.ac(+d,this.minZoom,this.maxZoom);const f={center:new l.N(s.lng,s.lat),zoom:d};let m=this.lngRange;if(!this._renderWorldCopies&&m===null){const ee=179.9999999999;m=[-ee,ee]}const x=this.tileSize*this.zoomScale(f.zoom);let M=0,P=x,D=0,L=x,B=0,V=0;const{x:W,y:K}=this.size;if(this.latRange){const ee=this.latRange;M=l.Q(ee[1])*x,P=l.Q(ee[0])*x,P-M<K&&(B=K/(P-M))}m&&(D=l.b3(l.O(m[0])*x,0,x),L=l.b3(l.O(m[1])*x,0,x),L<D&&(L+=x),L-D<W&&(V=W/(L-D)));const{x:Q,y:re}=this.project.call({worldSize:x},s);let ae,ce;const he=Math.max(V||0,B||0);if(he){const ee=new l.P(V?(L+D)/2:Q,B?(P+M)/2:re);return f.center=this.unproject.call({worldSize:x},ee).wrap(),f.zoom+=this.scaleZoom(he),f}if(this.latRange){const ee=K/2;re-ee<M&&(ce=M+ee),re+ee>P&&(ce=P-ee)}if(m){const ee=(D+L)/2;let me=Q;this._renderWorldCopies&&(me=l.b3(Q,ee-x/2,ee+x/2));const ge=W/2;me-ge<D&&(ae=D+ge),me+ge>L&&(ae=L-ge)}if(ae!==void 0||ce!==void 0){const ee=new l.P(ae??Q,ce??re);f.center=this.unproject.call({worldSize:x},ee).wrap()}return f}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const s=this._unmodified,{center:d,zoom:f}=this.getConstrained(this.center,this.zoom);this.center=d,this.zoom=f,this._unmodified=s,this._constraining=!1}_calcMatrices(){if(!this.height)return;const s=this.centerOffset,d=this.point.x,f=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=l.b5(1,this.center.lat)*this.worldSize;let m=l.an(new Float64Array(16));l.K(m,m,[this.width/2,-this.height/2,1]),l.J(m,m,[1,-1,0]),this.labelPlaneMatrix=m,m=l.an(new Float64Array(16)),l.K(m,m,[1,-1,1]),l.J(m,m,[-1,-1,0]),l.K(m,m,[2/this.width,2/this.height,1]),this.glCoordMatrix=m;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),D=M<0?P:x,L=Math.PI/2+this._pitch,B=this._fov*(.5+s.y/this.height),V=Math.sin(B)*D/Math.sin(l.ac(Math.PI-L-B,.01,Math.PI-.01)),W=this.getHorizon(),K=2*Math.atan(W/this.cameraToCenterDistance)*(.5+s.y/(2*W)),Q=Math.sin(K)*D/Math.sin(l.ac(Math.PI-L-K,.01,Math.PI-.01)),re=Math.min(V,Q);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*re+D),this.nearZ=this.height/50,m=new Float64Array(16),l.b6(m,this._fov,this.width/this.height,this.nearZ,this.farZ),m[8]=2*-s.x/this.width,m[9]=2*s.y/this.height,this.projectionMatrix=l.ae(m),l.K(m,m,[1,-1,1]),l.J(m,m,[0,0,-this.cameraToCenterDistance]),l.b7(m,m,this._pitch),l.ad(m,m,this.angle),l.J(m,m,[-d,-f,0]),this.mercatorMatrix=l.K([],m,[this.worldSize,this.worldSize,this.worldSize]),l.K(m,m,[1,1,this._pixelPerMeter]),this.pixelMatrix=l.L(new Float64Array(16),this.labelPlaneMatrix,m),l.J(m,m,[0,0,-this.elevation]),this.modelViewProjectionMatrix=m,this.invModelViewProjectionMatrix=l.as([],m),this.fogMatrix=new Float64Array(16),l.b6(this.fogMatrix,this._fov,this.width/this.height,x,this.farZ),this.fogMatrix[8]=2*-s.x/this.width,this.fogMatrix[9]=2*s.y/this.height,l.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),l.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),l.b7(this.fogMatrix,this.fogMatrix,this._pitch),l.ad(this.fogMatrix,this.fogMatrix,this.angle),l.J(this.fogMatrix,this.fogMatrix,[-d,-f,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,m);const ae=this.width%2/2,ce=this.height%2/2,he=Math.cos(this.angle),ee=Math.sin(this.angle),me=d-Math.round(d)+he*ae+ee*ce,ge=f-Math.round(f)+he*ce+ee*ae,ve=new Float64Array(m);if(l.J(ve,ve,[me>.5?me-1:me,ge>.5?ge-1:ge,0]),this.alignedModelViewProjectionMatrix=ve,m=l.as(new Float64Array(16),this.pixelMatrix),!m)throw new Error("failed to invert matrix");this.pixelMatrixInverse=m,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const s=this.pointCoordinate(new l.P(0,0)),d=[s.x*this.worldSize,s.y*this.worldSize,0,1];return l.af(d,d,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.P(0,s))}getCameraQueryGeometry(s){const d=this.getCameraPoint();if(s.length===1)return[s[0],d];{let f=d.x,m=d.y,x=d.x,M=d.y;for(const P of s)f=Math.min(f,P.x),m=Math.min(m,P.y),x=Math.max(x,P.x),M=Math.max(M,P.y);return[new l.P(f,m),new l.P(x,m),new l.P(x,M),new l.P(f,M),new l.P(f,m)]}}lngLatToCameraDepth(s,d){const f=this.locationCoordinate(s),m=[f.x*this.worldSize,f.y*this.worldSize,d,1];return l.af(m,m,this.modelViewProjectionMatrix),m[2]/m[3]}}function Gl(b,s){let d,f=!1,m=null,x=null;const M=()=>{m=null,f&&(b.apply(x,d),m=setTimeout(M,s),f=!1)};return(...P)=>(f=!0,x=this,d=P,m||M(),m)}class _u{constructor(s){this._getCurrentHash=()=>{const d=window.location.hash.replace("#","");if(this._hashName){let f;return d.split("&").map(m=>m.split("=")).forEach(m=>{m[0]===this._hashName&&(f=m)}),(f&&f[1]||"").split("/")}return d.split("/")},this._onHashChange=()=>{const d=this._getCurrentHash();if(d.length>=3&&!d.some(f=>isNaN(f))){const f=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:f,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 f=d.join("/");let m=f;m.split("&").length>0&&(m=m.split("&")[0]),this._hashName&&(m=`${this._hashName}=${f}`);let x=window.location.hash.replace(m,"");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=Gl(this._updateHashUnthrottled,300),this._hashName=s&&encodeURIComponent(s)}addTo(s){return this._map=s,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(s){const d=this._map.getCenter(),f=Math.round(100*this._map.getZoom())/100,m=Math.ceil((f*Math.LN2+Math.log(512/360/.5))/Math.LN10),x=Math.pow(10,m),M=Math.round(d.lng*x)/x,P=Math.round(d.lat*x)/x,D=this._map.getBearing(),L=this._map.getPitch();let B="";if(B+=s?`/${M}/${P}/${f}`:`${f}/${P}/${M}`,(D||L)&&(B+="/"+Math.round(10*D)/10),L&&(B+=`/${Math.round(L)}`),this._hashName){const V=this._hashName;let W=!1;const K=window.location.hash.slice(1).split("&").map(Q=>{const re=Q.split("=")[0];return re===V?(W=!0,`${re}=${B}`):Q}).filter(Q=>Q);return W||K.push(`${V}=${B}`),`#${K.join("&")}`}return`#${B}`}}const xu={linearity:.3,easing:l.b8(0,0,.3,1)},yd=l.e({deceleration:2500,maxSpeed:1400},xu),p_=l.e({deceleration:20,maxSpeed:1400},xu),gm=l.e({deceleration:1e3,maxSpeed:360},xu),bu=l.e({deceleration:1e3,maxSpeed:90},xu);class _d{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:E.now(),settings:s})}_drainInertiaBuffer(){const s=this._inertiaBuffer,d=E.now();for(;s.length>0&&d-s[0].time>160;)s.shift()}_onMoveEnd(s){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const d={zoom:0,bearing:0,pitch:0,pan:new l.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:x}of this._inertiaBuffer)d.zoom+=x.zoomDelta||0,d.bearing+=x.bearingDelta||0,d.pitch+=x.pitchDelta||0,x.panDelta&&d.pan._add(x.panDelta),x.around&&(d.around=x.around),x.pinchAround&&(d.pinchAround=x.pinchAround);const f=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,m={};if(d.pan.mag()){const x=Yl(d.pan.mag(),f,l.e({},yd,s||{}));m.offset=d.pan.mult(x.amount/d.pan.mag()),m.center=this._map.transform.center,Zl(m,x)}if(d.zoom){const x=Yl(d.zoom,f,p_);m.zoom=this._map.transform.zoom+x.amount,Zl(m,x)}if(d.bearing){const x=Yl(d.bearing,f,gm);m.bearing=this._map.transform.bearing+l.ac(x.amount,-179,179),Zl(m,x)}if(d.pitch){const x=Yl(d.pitch,f,bu);m.pitch=this._map.transform.pitch+x.amount,Zl(m,x)}if(m.zoom||m.bearing){const x=d.pinchAround===void 0?d.around:d.pinchAround;m.around=x?this._map.unproject(x):this._map.getCenter()}return this.clear(),l.e(m,{noMoveStart:!0})}}function Zl(b,s){(!b.duration||b.duration<s.duration)&&(b.duration=s.duration,b.easing=s.easing)}function Yl(b,s,d){const{maxSpeed:f,linearity:m,deceleration:x}=d,M=l.ac(b*m/(s/1e3),-f,f),P=Math.abs(M)/(x*m);return{easing:d.easing,duration:1e3*P,amount:M*(P/2)}}class Pi extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,d,f,m={}){const x=T.mousePos(d.getCanvas(),f),M=d.unproject(x);super(s,l.e({point:x,lngLat:M,originalEvent:f},m)),this._defaultPrevented=!1,this.target=d}}class Yo extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,d,f){const m=s==="touchend"?f.changedTouches:f.touches,x=T.touchPos(d.getCanvasContainer(),m),M=x.map(D=>d.unproject(D)),P=x.reduce((D,L,B,V)=>D.add(L.div(V.length)),new l.P(0,0));super(s,{points:x,point:P,lngLats:M,lngLat:d.unproject(P),originalEvent:f}),this._defaultPrevented=!1}}class ym extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,d,f){super(s,{originalEvent:f}),this._defaultPrevented=!1}}class _m{constructor(s,d){this._map=s,this._clickTolerance=d.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new ym(s.type,this._map,s))}mousedown(s,d){return this._mousedownPos=d,this._firePreventable(new Pi(s.type,this._map,s))}mouseup(s){this._map.fire(new Pi(s.type,this._map,s))}click(s,d){this._mousedownPos&&this._mousedownPos.dist(d)>=this._clickTolerance||this._map.fire(new Pi(s.type,this._map,s))}dblclick(s){return this._firePreventable(new Pi(s.type,this._map,s))}mouseover(s){this._map.fire(new Pi(s.type,this._map,s))}mouseout(s){this._map.fire(new Pi(s.type,this._map,s))}touchstart(s){return this._firePreventable(new Yo(s.type,this._map,s))}touchmove(s){this._map.fire(new Yo(s.type,this._map,s))}touchend(s){this._map.fire(new Yo(s.type,this._map,s))}touchcancel(s){this._map.fire(new Yo(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Qn{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new Pi(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Pi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new Pi(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class es{constructor(s){this._map=s}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(s){return this.transform.pointLocation(l.P.convert(s),this._map.terrain)}}class yr{constructor(s,d){this._map=s,this._tr=new es(s),this._el=s.getCanvasContainer(),this._container=s.getContainer(),this._clickTolerance=d.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(s,d){this.isEnabled()&&s.shiftKey&&s.button===0&&(T.disableDrag(),this._startPos=this._lastPos=d,this._active=!0)}mousemoveWindow(s,d){if(!this._active)return;const f=d;if(this._lastPos.equals(f)||!this._box&&f.dist(this._startPos)<this._clickTolerance)return;const m=this._startPos;this._lastPos=f,this._box||(this._box=T.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",s));const x=Math.min(m.x,f.x),M=Math.max(m.x,f.x),P=Math.min(m.y,f.y),D=Math.max(m.y,f.y);T.setTransform(this._box,`translate(${x}px,${P}px)`),this._box.style.width=M-x+"px",this._box.style.height=D-P+"px"}mouseupWindow(s,d){if(!this._active||s.button!==0)return;const f=this._startPos,m=d;if(this.reset(),T.suppressClick(),f.x!==m.x||f.y!==m.y)return this._map.fire(new l.k("boxzoomend",{originalEvent:s})),{cameraAnimation:x=>x.fitScreenCoordinates(f,m,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",s)}keydown(s){this._active&&s.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",s))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(T.remove(this._box),this._box=null),T.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,d){return this._map.fire(new l.k(s,{originalEvent:d}))}}function Xl(b,s){if(b.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${b.length}, points ${s.length}`);const d={};for(let f=0;f<b.length;f++)d[b[f].identifier]=s[f];return d}class xd{constructor(s){this.reset(),this.numTouches=s.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(s,d,f){(this.centroid||f.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),f.length===this.numTouches&&(this.centroid=function(m){const x=new l.P(0,0);for(const M of m)x._add(M);return x.div(m.length)}(d),this.touches=Xl(f,d)))}touchmove(s,d,f){if(this.aborted||!this.centroid)return;const m=Xl(f,d);for(const x in this.touches){const M=m[x];(!M||M.dist(this.touches[x])>30)&&(this.aborted=!0)}}touchend(s,d,f){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),f.length===0){const m=!this.aborted&&this.centroid;if(this.reset(),m)return m}}}class vu{constructor(s){this.singleTap=new xd(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(s,d,f){this.singleTap.touchstart(s,d,f)}touchmove(s,d,f){this.singleTap.touchmove(s,d,f)}touchend(s,d,f){const m=this.singleTap.touchend(s,d,f);if(m){const x=s.timeStamp-this.lastTime<500,M=!this.lastTap||this.lastTap.dist(m)<30;if(x&&M||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=m,this.count===this.numTaps)return this.reset(),m}}}class Ua{constructor(s){this._tr=new es(s),this._zoomIn=new vu({numTouches:1,numTaps:2}),this._zoomOut=new vu({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,d,f){this._zoomIn.touchstart(s,d,f),this._zoomOut.touchstart(s,d,f)}touchmove(s,d,f){this._zoomIn.touchmove(s,d,f),this._zoomOut.touchmove(s,d,f)}touchend(s,d,f){const m=this._zoomIn.touchend(s,d,f),x=this._zoomOut.touchend(s,d,f),M=this._tr;return m?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:P=>P.easeTo({duration:300,zoom:M.zoom+1,around:M.unproject(m)},{originalEvent:s})}):x?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:P=>P.easeTo({duration:300,zoom:M.zoom-1,around:M.unproject(x)},{originalEvent:s})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qs{constructor(s){this._enabled=!!s.enable,this._moveStateManager=s.moveStateManager,this._clickTolerance=s.clickTolerance||1,this._moveFunction=s.move,this._activateOnStart=!!s.activateOnStart,s.assignEvents(this),this.reset()}reset(s){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(s)}_move(...s){const d=this._moveFunction(...s);if(d.bearingDelta||d.pitchDelta||d.around||d.panDelta)return this._active=!0,d}dragStart(s,d){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(s)&&(this._moveStateManager.startMove(s),this._lastPoint=d.length?d[0]:d,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(s,d){if(!this.isEnabled())return;const f=this._lastPoint;if(!f)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);const m=d.length?d[0]:d;return!this._moved&&m.dist(f)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=m,this._move(f,m))}dragEnd(s){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(s)&&(this._moved&&T.suppressClick(),this.reset(s))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const bd={0:1,2:2};class wu{constructor(s){this._correctEvent=s.checkCorrectEvent}startMove(s){const d=T.mouseButton(s);this._eventButton=d}endMove(s){delete this._eventButton}isValidStartEvent(s){return this._correctEvent(s)}isValidMoveEvent(s){return!function(d,f){const m=bd[f];return d.buttons===void 0||(d.buttons&m)!==m}(s,this._eventButton)}isValidEndEvent(s){return T.mouseButton(s)===this._eventButton}}class vd{constructor(){this._firstTouch=void 0}_isOneFingerTouch(s){return s.targetTouches.length===1}_isSameTouchEvent(s){return s.targetTouches[0].identifier===this._firstTouch}startMove(s){this._firstTouch=s.targetTouches[0].identifier}endMove(s){delete this._firstTouch}isValidStartEvent(s){return this._isOneFingerTouch(s)}isValidMoveEvent(s){return this._isOneFingerTouch(s)&&this._isSameTouchEvent(s)}isValidEndEvent(s){return this._isOneFingerTouch(s)&&this._isSameTouchEvent(s)}}const ku=b=>{b.mousedown=b.dragStart,b.mousemoveWindow=b.dragMove,b.mouseup=b.dragEnd,b.contextmenu=s=>{s.preventDefault()}},wd=({enable:b,clickTolerance:s,bearingDegreesPerPixelMoved:d=.8})=>{const f=new wu({checkCorrectEvent:m=>T.mouseButton(m)===0&&m.ctrlKey||T.mouseButton(m)===2});return new qs({clickTolerance:s,move:(m,x)=>({bearingDelta:(x.x-m.x)*d}),moveStateManager:f,enable:b,assignEvents:ku})},kd=({enable:b,clickTolerance:s,pitchDegreesPerPixelMoved:d=-.5})=>{const f=new wu({checkCorrectEvent:m=>T.mouseButton(m)===0&&m.ctrlKey||T.mouseButton(m)===2});return new qs({clickTolerance:s,move:(m,x)=>({pitchDelta:(x.y-m.y)*d}),moveStateManager:f,enable:b,assignEvents:ku})};class Xo{constructor(s,d){this._clickTolerance=s.clickTolerance||1,this._map=d,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.P(0,0)}_shouldBePrevented(s){return s<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(s,d,f){return this._calculateTransform(s,d,f)}touchmove(s,d,f){if(this._active){if(!this._shouldBePrevented(f.length))return s.preventDefault(),this._calculateTransform(s,d,f);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",s)}}touchend(s,d,f){this._calculateTransform(s,d,f),this._active&&this._shouldBePrevented(f.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(s,d,f){f.length>0&&(this._active=!0);const m=Xl(f,d),x=new l.P(0,0),M=new l.P(0,0);let P=0;for(const L in m){const B=m[L],V=this._touches[L];V&&(x._add(B),M._add(B.sub(V)),P++,m[L]=B)}if(this._touches=m,this._shouldBePrevented(P)||!M.mag())return;const D=M.div(P);return this._sum._add(D),this._sum.mag()<this._clickTolerance?void 0:{around:x.div(P),panDelta:D}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Su{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(s,d,f){this._firstTwoTouches||f.length<2||(this._firstTwoTouches=[f[0].identifier,f[1].identifier],this._start([d[0],d[1]]))}touchmove(s,d,f){if(!this._firstTwoTouches)return;s.preventDefault();const[m,x]=this._firstTwoTouches,M=Kl(f,d,m),P=Kl(f,d,x);if(!M||!P)return;const D=this._aroundCenter?null:M.add(P).div(2);return this._move([M,P],D,s)}touchend(s,d,f){if(!this._firstTwoTouches)return;const[m,x]=this._firstTwoTouches,M=Kl(f,d,m),P=Kl(f,d,x);M&&P||(this._active&&T.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(s){this._enabled=!0,this._aroundCenter=!!s&&s.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Kl(b,s,d){for(let f=0;f<b.length;f++)if(b[f].identifier===d)return s[f]}function Sd(b,s){return Math.log(b/s)/Math.LN2}class Ed extends Su{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(s){this._startDistance=this._distance=s[0].dist(s[1])}_move(s,d){const f=this._distance;if(this._distance=s[0].dist(s[1]),this._active||!(Math.abs(Sd(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Sd(this._distance,f),pinchAround:d}}}function Cd(b,s){return 180*b.angleWith(s)/Math.PI}class Td extends Su{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(s){this._startVector=this._vector=s[0].sub(s[1]),this._minDiameter=s[0].dist(s[1])}_move(s,d,f){const m=this._vector;if(this._vector=s[0].sub(s[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Cd(this._vector,m),pinchAround:d}}_isBelowThreshold(s){this._minDiameter=Math.min(this._minDiameter,s.mag());const d=25/(Math.PI*this._minDiameter)*360,f=Cd(s,this._startVector);return Math.abs(f)<d}}function Eu(b){return Math.abs(b.y)>Math.abs(b.x)}class Ha extends Su{constructor(s){super(),this._currentTouchCount=0,this._map=s}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(s,d,f){super.touchstart(s,d,f),this._currentTouchCount=f.length}_start(s){this._lastPoints=s,Eu(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,d,f){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const m=s[0].sub(this._lastPoints[0]),x=s[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(m,x,f.timeStamp),this._valid?(this._lastPoints=s,this._active=!0,{pitchDelta:(m.y+x.y)/2*-.5}):void 0}gestureBeginsVertically(s,d,f){if(this._valid!==void 0)return this._valid;const m=s.mag()>=2,x=d.mag()>=2;if(!m&&!x)return;if(!m||!x)return this._firstMove===void 0&&(this._firstMove=f),f-this._firstMove<100&&void 0;const M=s.y>0==d.y>0;return Eu(s)&&Eu(d)&&M}}const xm={panStep:100,bearingStep:15,pitchStep:10};class Nr{constructor(s){this._tr=new es(s);const d=xm;this._panStep=d.panStep,this._bearingStep=d.bearingStep,this._pitchStep=d.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(s){if(s.altKey||s.ctrlKey||s.metaKey)return;let d=0,f=0,m=0,x=0,M=0;switch(s.keyCode){case 61:case 107:case 171:case 187:d=1;break;case 189:case 109:case 173:d=-1;break;case 37:s.shiftKey?f=-1:(s.preventDefault(),x=-1);break;case 39:s.shiftKey?f=1:(s.preventDefault(),x=1);break;case 38:s.shiftKey?m=1:(s.preventDefault(),M=-1);break;case 40:s.shiftKey?m=-1:(s.preventDefault(),M=1);break;default:return}return this._rotationDisabled&&(f=0,m=0),{cameraAnimation:P=>{const D=this._tr;P.easeTo({duration:300,easeId:"keyboardHandler",easing:As,zoom:d?Math.round(D.zoom)+d*(s.shiftKey?2:1):D.zoom,bearing:D.bearing+f*this._bearingStep,pitch:D.pitch+m*this._pitchStep,offset:[-x*this._panStep,-M*this._panStep],center:D.center},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function As(b){return b*(2-b)}const Md=4.000244140625;class ts{constructor(s,d){this._onTimeout=f=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(f)},this._map=s,this._tr=new es(s),this._triggerRenderFrame=d,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(s){this._defaultZoomRate=s}setWheelZoomRate(s){this._wheelZoomRate=s}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(s){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!s&&s.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(s){return!!this._map.cooperativeGestures.isEnabled()&&!(s.ctrlKey||this._map.cooperativeGestures.isBypassed(s))}wheel(s){if(!this.isEnabled())return;if(this._shouldBePrevented(s))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",s);let d=s.deltaMode===WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const f=E.now(),m=f-(this._lastWheelEventTime||0);this._lastWheelEventTime=f,d!==0&&d%Md==0?this._type="wheel":d!==0&&Math.abs(d)<4?this._type="trackpad":m>400?(this._type=null,this._lastValue=d,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(m*d)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,d+=this._lastValue)),s.shiftKey&&d&&(d/=4),this._type&&(this._lastWheelEvent=s,this._delta-=d,this._active||this._start(s)),s.preventDefault()}_start(s){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const d=T.mousePos(this._map.getCanvas(),s),f=this._tr;this._around=d.y>f.transform.height/2-f.transform.getHorizon()?l.N.convert(this._aroundCenter?f.center:f.unproject(d)):l.N.convert(f.center),this._aroundPoint=f.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const s=this._tr.transform;if(this._delta!==0){const D=this._type==="wheel"&&Math.abs(this._delta)>Md?this._wheelZoomRate:this._defaultZoomRate;let L=2/(1+Math.exp(-Math.abs(this._delta*D)));this._delta<0&&L!==0&&(L=1/L);const B=typeof this._targetZoom=="number"?s.zoomScale(this._targetZoom):s.scale;this._targetZoom=Math.min(s.maxZoom,Math.max(s.minZoom,s.scaleZoom(B*L))),this._type==="wheel"&&(this._startZoom=s.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const d=typeof this._targetZoom=="number"?this._targetZoom:s.zoom,f=this._startZoom,m=this._easing;let x,M=!1;const P=E.now()-this._lastWheelEventTime;if(this._type==="wheel"&&f&&m&&P){const D=Math.min(P/200,1),L=m(D);x=l.y.number(f,d,L),D<1?this._frameId||(this._frameId=!0):M=!0}else x=d,M=!0;return this._active=!0,M&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!M,zoomDelta:x-s.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let d=l.b9;if(this._prevEase){const f=this._prevEase,m=(E.now()-f.start)/f.duration,x=f.easing(m+.01)-f.easing(m),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:s,easing:d},d}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ko{constructor(s,d){this._clickZoom=s,this._tapZoom=d}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class f_{constructor(s){this._tr=new es(s),this.reset()}reset(){this._active=!1}dblclick(s,d){return s.preventDefault(),{cameraAnimation:f=>{f.easeTo({duration:300,zoom:this._tr.zoom+(s.shiftKey?-1:1),around:this._tr.unproject(d)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class m_{constructor(){this._tap=new vu({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(s,d,f){if(!this._swipePoint)if(this._tapTime){const m=d[0],x=s.timeStamp-this._tapTime<500,M=this._tapPoint.dist(m)<30;x&&M?f.length>0&&(this._swipePoint=m,this._swipeTouch=f[0].identifier):this.reset()}else this._tap.touchstart(s,d,f)}touchmove(s,d,f){if(this._tapTime){if(this._swipePoint){if(f[0].identifier!==this._swipeTouch)return;const m=d[0],x=m.y-this._swipePoint.y;return this._swipePoint=m,s.preventDefault(),this._active=!0,{zoomDelta:x/128}}}else this._tap.touchmove(s,d,f)}touchend(s,d,f){if(this._tapTime)this._swipePoint&&f.length===0&&this.reset();else{const m=this._tap.touchend(s,d,f);m&&(this._tapTime=s.timeStamp,this._tapPoint=m)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class bm{constructor(s,d,f){this._el=s,this._mousePan=d,this._touchPan=f}enable(s){this._inertiaOptions=s||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class vm{constructor(s,d,f){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=d,this._mousePitch=f}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Ad{constructor(s,d,f,m){this._el=s,this._touchZoom=d,this._touchRotate=f,this._tapDragZoom=m,this._rotationDisabled=!1,this._enabled=!0}enable(s){this._touchZoom.enable(s),this._rotationDisabled||this._touchRotate.enable(s),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class qa{constructor(s,d){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=s,this._options=d,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const s=this._map.getCanvasContainer();s.classList.add("maplibregl-cooperative-gestures"),this._container=T.create("div","maplibregl-cooperative-gesture-screen",s);let d=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(d=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const f=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),m=document.createElement("div");m.className="maplibregl-desktop-message",m.textContent=d,this._container.appendChild(m);const x=document.createElement("div");x.className="maplibregl-mobile-message",x.textContent=f,this._container.appendChild(x),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(T.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(s){return s[this._bypassKey]}notifyGestureBlocked(s,d){this._enabled&&(this._map.fire(new l.k("cooperativegestureprevented",{gestureType:s,originalEvent:d})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Br=b=>b.zoom||b.drag||b.pitch||b.rotate;class ot extends l.k{}function Cu(b){return b.panDelta&&b.panDelta.mag()||b.zoomDelta||b.bearingDelta||b.pitchDelta}class Pd{constructor(s,d){this.handleWindowEvent=m=>{this.handleEvent(m,`${m.type}Window`)},this.handleEvent=(m,x)=>{if(m.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const M=m.type==="renderFrame"?void 0:m,P={needsRenderFrame:!1},D={},L={},B=m.touches,V=B?this._getMapTouches(B):void 0,W=V?T.touchPos(this._map.getCanvas(),V):T.mousePos(this._map.getCanvas(),m);for(const{handlerName:re,handler:ae,allowed:ce}of this._handlers){if(!ae.isEnabled())continue;let he;this._blockedByActive(L,ce,re)?ae.reset():ae[x||m.type]&&(he=ae[x||m.type](m,W,V),this.mergeHandlerResult(P,D,he,re,M),he&&he.needsRenderFrame&&this._triggerRenderFrame()),(he||ae.isActive())&&(L[re]=ae)}const K={};for(const re in this._previousActiveHandlers)L[re]||(K[re]=M);this._previousActiveHandlers=L,(Object.keys(K).length||Cu(P))&&(this._changes.push([P,D,K]),this._triggerRenderFrame()),(Object.keys(L).length||Cu(P))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:Q}=P;Q&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],Q(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new _d(s),this._bearingSnap=d.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(d);const f=this._el;this._listeners=[[f,"touchstart",{passive:!0}],[f,"touchmove",{passive:!1}],[f,"touchend",void 0],[f,"touchcancel",void 0],[f,"mousedown",void 0],[f,"mousemove",void 0],[f,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[f,"mouseover",void 0],[f,"mouseout",void 0],[f,"dblclick",void 0],[f,"click",void 0],[f,"keydown",{capture:!1}],[f,"keyup",void 0],[f,"wheel",{passive:!1}],[f,"contextmenu",void 0],[window,"blur",void 0]];for(const[m,x,M]of this._listeners)T.addEventListener(m,x,m===document?this.handleWindowEvent:this.handleEvent,M)}destroy(){for(const[s,d,f]of this._listeners)T.removeEventListener(s,d,s===document?this.handleWindowEvent:this.handleEvent,f)}_addDefaultHandlers(s){const d=this._map,f=d.getCanvasContainer();this._add("mapEvent",new _m(d,s));const m=d.boxZoom=new yr(d,s);this._add("boxZoom",m),s.interactive&&s.boxZoom&&m.enable();const x=d.cooperativeGestures=new qa(d,s.cooperativeGestures);this._add("cooperativeGestures",x),s.cooperativeGestures&&x.enable();const M=new Ua(d),P=new f_(d);d.doubleClickZoom=new Ko(P,M),this._add("tapZoom",M),this._add("clickZoom",P),s.interactive&&s.doubleClickZoom&&d.doubleClickZoom.enable();const D=new m_;this._add("tapDragZoom",D);const L=d.touchPitch=new Ha(d);this._add("touchPitch",L),s.interactive&&s.touchPitch&&d.touchPitch.enable(s.touchPitch);const B=wd(s),V=kd(s);d.dragRotate=new vm(s,B,V),this._add("mouseRotate",B,["mousePitch"]),this._add("mousePitch",V,["mouseRotate"]),s.interactive&&s.dragRotate&&d.dragRotate.enable();const W=(({enable:he,clickTolerance:ee})=>{const me=new wu({checkCorrectEvent:ge=>T.mouseButton(ge)===0&&!ge.ctrlKey});return new qs({clickTolerance:ee,move:(ge,ve)=>({around:ve,panDelta:ve.sub(ge)}),activateOnStart:!0,moveStateManager:me,enable:he,assignEvents:ku})})(s),K=new Xo(s,d);d.dragPan=new bm(f,W,K),this._add("mousePan",W),this._add("touchPan",K,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&d.dragPan.enable(s.dragPan);const Q=new Td,re=new Ed;d.touchZoomRotate=new Ad(f,re,Q,D),this._add("touchRotate",Q,["touchPan","touchZoom"]),this._add("touchZoom",re,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&d.touchZoomRotate.enable(s.touchZoomRotate);const ae=d.scrollZoom=new ts(d,()=>this._triggerRenderFrame());this._add("scrollZoom",ae,["mousePan"]),s.interactive&&s.scrollZoom&&d.scrollZoom.enable(s.scrollZoom);const ce=d.keyboard=new Nr(d);this._add("keyboard",ce),s.interactive&&s.keyboard&&d.keyboard.enable(),this._add("blockableMapEvent",new Qn(d))}_add(s,d,f){this._handlers.push({handlerName:s,handler:d,allowed:f}),this._handlersById[s]=d}stop(s){if(!this._updatingCamera){for(const{handler:d}of this._handlers)d.reset();this._inertia.clear(),this._fireEvents({},{},s),this._changes=[]}}isActive(){for(const{handler:s}of this._handlers)if(s.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Br(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,d,f){for(const m in s)if(m!==f&&(!d||d.indexOf(m)<0))return!0;return!1}_getMapTouches(s){const d=[];for(const f of s)this._el.contains(f.target)&&d.push(f);return d}mergeHandlerResult(s,d,f,m,x){if(!f)return;l.e(s,f);const M={handlerName:m,originalEvent:f.originalEvent||x};f.zoomDelta!==void 0&&(d.zoom=M),f.panDelta!==void 0&&(d.drag=M),f.pitchDelta!==void 0&&(d.pitch=M),f.bearingDelta!==void 0&&(d.rotate=M)}_applyChanges(){const s={},d={},f={};for(const[m,x,M]of this._changes)m.panDelta&&(s.panDelta=(s.panDelta||new l.P(0,0))._add(m.panDelta)),m.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+m.zoomDelta),m.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+m.bearingDelta),m.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+m.pitchDelta),m.around!==void 0&&(s.around=m.around),m.pinchAround!==void 0&&(s.pinchAround=m.pinchAround),m.noInertia&&(s.noInertia=m.noInertia),l.e(d,x),l.e(f,M);this._updateMapTransform(s,d,f),this._changes=[]}_updateMapTransform(s,d,f){const m=this._map,x=m._getTransformForUpdate(),M=m.terrain;if(!(Cu(s)||M&&this._terrainMovement))return this._fireEvents(d,f,!0);let{panDelta:P,zoomDelta:D,bearingDelta:L,pitchDelta:B,around:V,pinchAround:W}=s;W!==void 0&&(V=W),m._stop(!0),V=V||m.transform.centerPoint;const K=x.pointLocation(P?V.sub(P):V);L&&(x.bearing+=L),B&&(x.pitch+=B),D&&(x.zoom+=D),M?this._terrainMovement||!d.drag&&!d.zoom?d.drag&&this._terrainMovement?x.center=x.pointLocation(x.centerPoint.sub(P)):x.setLocationAtPoint(K,V):(this._terrainMovement=!0,this._map._elevationFreeze=!0,x.setLocationAtPoint(K,V)):x.setLocationAtPoint(K,V),m._applyUpdatedTransform(x),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(d,f,!0)}_fireEvents(s,d,f){const m=Br(this._eventsInProgress),x=Br(s),M={};for(const V in s){const{originalEvent:W}=s[V];this._eventsInProgress[V]||(M[`${V}start`]=W),this._eventsInProgress[V]=s[V]}!m&&x&&this._fireEvent("movestart",x.originalEvent);for(const V in M)this._fireEvent(V,M[V]);x&&this._fireEvent("move",x.originalEvent);for(const V in s){const{originalEvent:W}=s[V];this._fireEvent(V,W)}const P={};let D;for(const V in this._eventsInProgress){const{handlerName:W,originalEvent:K}=this._eventsInProgress[V];this._handlersById[W].isActive()||(delete this._eventsInProgress[V],D=d[W]||K,P[`${V}end`]=D)}for(const V in P)this._fireEvent(V,P[V]);const L=Br(this._eventsInProgress),B=(m||x)&&!L;if(B&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const V=this._map._getTransformForUpdate();V.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(V)}if(f&&B){this._updatingCamera=!0;const V=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),W=K=>K!==0&&-this._bearingSnap<K&&K<this._bearingSnap;!V||!V.essential&&E.prefersReducedMotion?(this._map.fire(new l.k("moveend",{originalEvent:D})),W(this._map.getBearing())&&this._map.resetNorth()):(W(V.bearing||this._map.getBearing())&&(V.bearing=0),V.freezeElevation=!0,this._map.easeTo(V,{originalEvent:D})),this._updatingCamera=!1}}_fireEvent(s,d){this._map.fire(new l.k(s,d?{originalEvent:d}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(s=>{delete this._frameId,this.handleEvent(new ot("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class wm extends l.E{constructor(s,d){super(),this._renderFrameCallback=()=>{const f=Math.min((E.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(f)),f<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=s,this._bearingSnap=d.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new l.N(this.transform.center.lng,this.transform.center.lat)}setCenter(s,d){return this.jumpTo({center:s},d)}panBy(s,d,f){return s=l.P.convert(s).mult(-1),this.panTo(this.transform.center,l.e({offset:s},d),f)}panTo(s,d,f){return this.easeTo(l.e({center:s},d),f)}getZoom(){return this.transform.zoom}setZoom(s,d){return this.jumpTo({zoom:s},d),this}zoomTo(s,d,f){return this.easeTo(l.e({zoom:s},d),f)}zoomIn(s,d){return this.zoomTo(this.getZoom()+1,s,d),this}zoomOut(s,d){return this.zoomTo(this.getZoom()-1,s,d),this}getBearing(){return this.transform.bearing}setBearing(s,d){return this.jumpTo({bearing:s},d),this}getPadding(){return this.transform.padding}setPadding(s,d){return this.jumpTo({padding:s},d),this}rotateTo(s,d,f){return this.easeTo(l.e({bearing:s},d),f)}resetNorth(s,d){return this.rotateTo(0,l.e({duration:1e3},s),d),this}resetNorthPitch(s,d){return this.easeTo(l.e({bearing:0,pitch:0,duration:1e3},s),d),this}snapToNorth(s,d){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(s,d):this}getPitch(){return this.transform.pitch}setPitch(s,d){return this.jumpTo({pitch:s},d),this}cameraForBounds(s,d){s=ke.convert(s).adjustAntiMeridian();const f=d&&d.bearing||0;return this._cameraForBoxAndBearing(s.getNorthWest(),s.getSouthEast(),f,d)}_cameraForBoxAndBearing(s,d,f,m){const x={top:0,bottom:0,right:0,left:0};if(typeof(m=l.e({padding:x,offset:[0,0],maxZoom:this.transform.maxZoom},m)).padding=="number"){const We=m.padding;m.padding={top:We,bottom:We,right:We,left:We}}m.padding=l.e(x,m.padding);const M=this.transform,P=M.padding,D=new ke(s,d),L=M.project(D.getNorthWest()),B=M.project(D.getNorthEast()),V=M.project(D.getSouthEast()),W=M.project(D.getSouthWest()),K=l.ba(-f),Q=L.rotate(K),re=B.rotate(K),ae=V.rotate(K),ce=W.rotate(K),he=new l.P(Math.max(Q.x,re.x,ce.x,ae.x),Math.max(Q.y,re.y,ce.y,ae.y)),ee=new l.P(Math.min(Q.x,re.x,ce.x,ae.x),Math.min(Q.y,re.y,ce.y,ae.y)),me=he.sub(ee),ge=(M.width-(P.left+P.right+m.padding.left+m.padding.right))/me.x,ve=(M.height-(P.top+P.bottom+m.padding.top+m.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 Oe=Math.min(M.scaleZoom(M.scale*Math.min(ge,ve)),m.maxZoom),Ve=l.P.convert(m.offset),Ke=new l.P((m.padding.left-m.padding.right)/2,(m.padding.top-m.padding.bottom)/2).rotate(l.ba(f)),nt=Ve.add(Ke).mult(M.scale/M.zoomScale(Oe));return{center:M.unproject(L.add(V).div(2).sub(nt)),zoom:Oe,bearing:f}}fitBounds(s,d,f){return this._fitInternal(this.cameraForBounds(s,d),d,f)}fitScreenCoordinates(s,d,f,m,x){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(l.P.convert(s)),this.transform.pointLocation(l.P.convert(d)),f,m),m,x)}_fitInternal(s,d,f){return s?(delete(d=l.e(s,d)).padding,d.linear?this.easeTo(d,f):this.flyTo(d,f)):this}jumpTo(s,d){this.stop();const f=this._getTransformForUpdate();let m=!1,x=!1,M=!1;return"zoom"in s&&f.zoom!==+s.zoom&&(m=!0,f.zoom=+s.zoom),s.center!==void 0&&(f.center=l.N.convert(s.center)),"bearing"in s&&f.bearing!==+s.bearing&&(x=!0,f.bearing=+s.bearing),"pitch"in s&&f.pitch!==+s.pitch&&(M=!0,f.pitch=+s.pitch),s.padding==null||f.isPaddingEqual(s.padding)||(f.padding=s.padding),this._applyUpdatedTransform(f),this.fire(new l.k("movestart",d)).fire(new l.k("move",d)),m&&this.fire(new l.k("zoomstart",d)).fire(new l.k("zoom",d)).fire(new l.k("zoomend",d)),x&&this.fire(new l.k("rotatestart",d)).fire(new l.k("rotate",d)).fire(new l.k("rotateend",d)),M&&this.fire(new l.k("pitchstart",d)).fire(new l.k("pitch",d)).fire(new l.k("pitchend",d)),this.fire(new l.k("moveend",d))}calculateCameraOptionsFromTo(s,d,f,m=0){const x=l.Z.fromLngLat(s,d),M=l.Z.fromLngLat(f,m),P=M.x-x.x,D=M.y-x.y,L=M.z-x.z,B=Math.hypot(P,D,L);if(B===0)throw new Error("Can't calculate camera options with same From and To");const V=Math.hypot(P,D),W=this.transform.scaleZoom(this.transform.cameraToCenterDistance/B/this.transform.tileSize),K=180*Math.atan2(P,-D)/Math.PI;let Q=180*Math.acos(V/B)/Math.PI;return Q=L<0?90-Q:90+Q,{center:M.toLngLat(),zoom:W,pitch:Q,bearing:K}}easeTo(s,d){var f;this._stop(!1,s.easeId),((s=l.e({offset:[0,0],duration:500,easing:l.b9},s)).animate===!1||!s.essential&&E.prefersReducedMotion)&&(s.duration=0);const m=this._getTransformForUpdate(),x=m.zoom,M=m.bearing,P=m.pitch,D=m.padding,L="bearing"in s?this._normalizeBearing(s.bearing,M):M,B="pitch"in s?+s.pitch:P,V="padding"in s?s.padding:m.padding,W=l.P.convert(s.offset);let K=m.centerPoint.add(W);const Q=m.pointLocation(K),{center:re,zoom:ae}=m.getConstrained(l.N.convert(s.center||Q),(f=s.zoom)!==null&&f!==void 0?f:x);this._normalizeCenter(re,m);const ce=m.project(Q),he=m.project(re).sub(ce),ee=m.zoomScale(ae-x);let me,ge;s.around&&(me=l.N.convert(s.around),ge=m.locationPoint(me));const ve={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||ae!==x,this._rotating=this._rotating||M!==L,this._pitching=this._pitching||B!==P,this._padding=!m.isPaddingEqual(V),this._easeId=s.easeId,this._prepareEase(d,s.noMoveStart,ve),this.terrain&&this._prepareElevation(re),this._ease(Oe=>{if(this._zooming&&(m.zoom=l.y.number(x,ae,Oe)),this._rotating&&(m.bearing=l.y.number(M,L,Oe)),this._pitching&&(m.pitch=l.y.number(P,B,Oe)),this._padding&&(m.interpolatePadding(D,V,Oe),K=m.centerPoint.add(W)),this.terrain&&!s.freezeElevation&&this._updateElevation(Oe),me)m.setLocationAtPoint(me,ge);else{const Ve=m.zoomScale(m.zoom-x),Ke=ae>x?Math.min(2,ee):Math.max(.5,ee),nt=Math.pow(Ke,1-Oe),We=m.unproject(ce.add(he.mult(Oe*nt)).mult(Ve));m.setLocationAtPoint(m.renderWorldCopies?We.wrap():We,K)}this._applyUpdatedTransform(m),this._fireMoveEvents(d)},Oe=>{this.terrain&&s.freezeElevation&&this._finalizeElevation(),this._afterEase(d,Oe)},s),this}_prepareEase(s,d,f={}){this._moving=!0,d||f.moving||this.fire(new l.k("movestart",s)),this._zooming&&!f.zooming&&this.fire(new l.k("zoomstart",s)),this._rotating&&!f.rotating&&this.fire(new l.k("rotatestart",s)),this._pitching&&!f.pitching&&this.fire(new l.k("pitchstart",s))}_prepareElevation(s){this._elevationCenter=s,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(s){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const d=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(s<1&&d!==this._elevationTarget){const f=this._elevationTarget-this._elevationStart;this._elevationStart+=s*(f-(d-(f*s+this._elevationStart))/(1-s)),this._elevationTarget=d}this.transform.elevation=l.y.number(this._elevationStart,this._elevationTarget,s)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(s){const d=s.getCameraPosition(),f=this.terrain.getElevationForLngLatZoom(d.lngLat,s.zoom);if(d.altitude<f){const m=this.calculateCameraOptionsFromTo(d.lngLat,f,s.center,s.elevation);return{pitch:m.pitch,zoom:m.zoom}}return{}}_applyUpdatedTransform(s){const d=[];if(this.terrain&&d.push(m=>this._elevateCameraIfInsideTerrain(m)),this.transformCameraUpdate&&d.push(m=>this.transformCameraUpdate(m)),!d.length)return;const f=s.clone();for(const m of d){const x=f.clone(),{center:M,zoom:P,pitch:D,bearing:L,elevation:B}=m(x);M&&(x.center=M),P!==void 0&&(x.zoom=P),D!==void 0&&(x.pitch=D),L!==void 0&&(x.bearing=L),B!==void 0&&(x.elevation=B),f.apply(x)}this.transform.apply(f)}_fireMoveEvents(s){this.fire(new l.k("move",s)),this._zooming&&this.fire(new l.k("zoom",s)),this._rotating&&this.fire(new l.k("rotate",s)),this._pitching&&this.fire(new l.k("pitch",s))}_afterEase(s,d){if(this._easeId&&d&&this._easeId===d)return;delete this._easeId;const f=this._zooming,m=this._rotating,x=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,f&&this.fire(new l.k("zoomend",s)),m&&this.fire(new l.k("rotateend",s)),x&&this.fire(new l.k("pitchend",s)),this.fire(new l.k("moveend",s))}flyTo(s,d){var f;if(!s.essential&&E.prefersReducedMotion){const et=l.M(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(et,d)}this.stop(),s=l.e({offset:[0,0],speed:1.2,curve:1.42,easing:l.b9},s);const m=this._getTransformForUpdate(),x=m.zoom,M=m.bearing,P=m.pitch,D=m.padding,L="bearing"in s?this._normalizeBearing(s.bearing,M):M,B="pitch"in s?+s.pitch:P,V="padding"in s?s.padding:m.padding,W=l.P.convert(s.offset);let K=m.centerPoint.add(W);const Q=m.pointLocation(K),{center:re,zoom:ae}=m.getConstrained(l.N.convert(s.center||Q),(f=s.zoom)!==null&&f!==void 0?f:x);this._normalizeCenter(re,m);const ce=m.zoomScale(ae-x),he=m.project(Q),ee=m.project(re).sub(he);let me=s.curve;const ge=Math.max(m.width,m.height),ve=ge/ce,Oe=ee.mag();if("minZoom"in s){const et=l.ac(Math.min(s.minZoom,x,ae),m.minZoom,m.maxZoom),Pt=ge/m.zoomScale(et-x);me=Math.sqrt(Pt/Oe*2)}const Ve=me*me;function Ke(et){const Pt=(ve*ve-ge*ge+(et?-1:1)*Ve*Ve*Oe*Oe)/(2*(et?ve:ge)*Ve*Oe);return Math.log(Math.sqrt(Pt*Pt+1)-Pt)}function nt(et){return(Math.exp(et)-Math.exp(-et))/2}function We(et){return(Math.exp(et)+Math.exp(-et))/2}const He=Ke(!1);let ft=function(et){return We(He)/We(He+me*et)},Ot=function(et){return ge*((We(He)*(nt(Pt=He+me*et)/We(Pt))-nt(He))/Ve)/Oe;var Pt},Ge=(Ke(!0)-He)/me;if(Math.abs(Oe)<1e-6||!isFinite(Ge)){if(Math.abs(ge-ve)<1e-6)return this.easeTo(s,d);const et=ve<ge?-1:1;Ge=Math.abs(Math.log(ve/ge))/me,Ot=()=>0,ft=Pt=>Math.exp(et*me*Pt)}return s.duration="duration"in s?+s.duration:1e3*Ge/("screenSpeed"in s?+s.screenSpeed/me:+s.speed),s.maxDuration&&s.duration>s.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=M!==L,this._pitching=B!==P,this._padding=!m.isPaddingEqual(V),this._prepareEase(d,!1),this.terrain&&this._prepareElevation(re),this._ease(et=>{const Pt=et*Ge,Nn=1/ft(Pt);m.zoom=et===1?ae:x+m.scaleZoom(Nn),this._rotating&&(m.bearing=l.y.number(M,L,et)),this._pitching&&(m.pitch=l.y.number(P,B,et)),this._padding&&(m.interpolatePadding(D,V,et),K=m.centerPoint.add(W)),this.terrain&&!s.freezeElevation&&this._updateElevation(et);const Vt=et===1?re:m.unproject(he.add(ee.mult(Ot(Pt))).mult(Nn));m.setLocationAtPoint(m.renderWorldCopies?Vt.wrap():Vt,K),this._applyUpdatedTransform(m),this._fireMoveEvents(d)},()=>{this.terrain&&s.freezeElevation&&this._finalizeElevation(),this._afterEase(d)},s),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(s,d){var f;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const m=this._onEaseEnd;delete this._onEaseEnd,m.call(this,d)}return s||(f=this.handlers)===null||f===void 0||f.stop(!1),this}_ease(s,d,f){f.animate===!1||f.duration===0?(s(1),d()):(this._easeStart=E.now(),this._easeOptions=f,this._onEaseFrame=s,this._onEaseEnd=d,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(s,d){s=l.b3(s,-180,180);const f=Math.abs(s-d);return Math.abs(s-360-d)<f&&(s-=360),Math.abs(s+360-d)<f&&(s+=360),s}_normalizeCenter(s,d){if(!d.renderWorldCopies||d.lngRange)return;const f=s.lng-d.center.lng;s.lng+=f>180?-360:f<-180?360:0}queryTerrainElevation(s){return this.terrain?this.terrain.getElevationForLngLatZoom(l.N.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}const Wa={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Ga{constructor(s=Wa){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=d=>{!d||d.sourceDataType!=="metadata"&&d.sourceDataType!=="visibility"&&d.dataType!=="style"&&d.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=s}getDefaultPosition(){return"bottom-right"}onAdd(s){return this._map=s,this._compact=this.options.compact,this._container=T.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=T.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=T.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(){T.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(s,d){const f=this._map._getUIString(`AttributionControl.${d}`);s.title=f,s.setAttribute("aria-label",f)}_updateAttributions(){if(!this._map.style)return;let s=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=s.concat(this.options.customAttribution.map(m=>typeof m!="string"?"":m)):typeof this.options.customAttribution=="string"&&s.push(this.options.customAttribution)),this._map.style.stylesheet){const m=this._map.style.stylesheet;this.styleOwner=m.owner,this.styleId=m.id}const d=this._map.style.sourceCaches;for(const m in d){const x=d[m];if(x.used||x.usedForTerrain){const M=x.getSource();M.attribution&&s.indexOf(M.attribution)<0&&s.push(M.attribution)}}s=s.filter(m=>String(m).trim()),s.sort((m,x)=>m.length-x.length),s=s.filter((m,x)=>{for(let M=x+1;M<s.length;M++)if(s[M].indexOf(m)>=0)return!1;return!0});const f=s.join(" | ");f!==this._attribHTML&&(this._attribHTML=f,s.length?(this._innerContainer.innerHTML=f,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Id{constructor(s={}){this._updateCompact=()=>{const d=this._container.children;if(d.length){const f=d[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&f.classList.add("maplibregl-compact"):f.classList.remove("maplibregl-compact")}},this.options=s}getDefaultPosition(){return"bottom-left"}onAdd(s){this._map=s,this._compact=this.options&&this.options.compact,this._container=T.create("div","maplibregl-ctrl");const d=T.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(){T.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Jt{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(s){const d=++this._id;return this._queue.push({callback:s,id:d,cancelled:!1}),d}remove(s){const d=this._currentlyRunning,f=d?this._queue.concat(d):this._queue;for(const m of f)if(m.id===s)return void(m.cancelled=!0)}run(s=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const d=this._currentlyRunning=this._queue;this._queue=[];for(const f of d)if(!f.cancelled&&(f.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Dd=l.Y([{name:"a_pos3d",type:"Int16",components:3}]);class g_ extends l.E{constructor(s){super(),this.sourceCache=s,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,s.usedForTerrain=!0,s.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(s,d){this.sourceCache.update(s,d),this._renderableTilesKeys=[];const f={};for(const m of s.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:d}))f[m.key]=!0,this._renderableTilesKeys.push(m.key),this._tiles[m.key]||(m.posMatrix=new Float64Array(16),l.aP(m.posMatrix,0,l.X,0,l.X,0,1),this._tiles[m.key]=new Ts(m,this.tileSize));for(const m in this._tiles)f[m]||delete this._tiles[m]}freeRtt(s){for(const d in this._tiles){const f=this._tiles[d];(!s||f.tileID.equals(s)||f.tileID.isChildOf(s)||s.isChildOf(f.tileID))&&(f.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(s=>this.getTileByID(s))}getTileByID(s){return this._tiles[s]}getTerrainCoords(s){const d={};for(const f of this._renderableTilesKeys){const m=this._tiles[f].tileID;if(m.canonical.equals(s.canonical)){const x=s.clone();x.posMatrix=new Float64Array(16),l.aP(x.posMatrix,0,l.X,0,l.X,0,1),d[f]=x}else if(m.canonical.isChildOf(s.canonical)){const x=s.clone();x.posMatrix=new Float64Array(16);const M=m.canonical.z-s.canonical.z,P=m.canonical.x-(m.canonical.x>>M<<M),D=m.canonical.y-(m.canonical.y>>M<<M),L=l.X>>M;l.aP(x.posMatrix,0,L,0,L,0,1),l.J(x.posMatrix,x.posMatrix,[-P*L,-D*L,0]),d[f]=x}else if(s.canonical.isChildOf(m.canonical)){const x=s.clone();x.posMatrix=new Float64Array(16);const M=s.canonical.z-m.canonical.z,P=s.canonical.x-(s.canonical.x>>M<<M),D=s.canonical.y-(s.canonical.y>>M<<M),L=l.X>>M;l.aP(x.posMatrix,0,l.X,0,l.X,0,1),l.J(x.posMatrix,x.posMatrix,[P*L,D*L,0]),l.K(x.posMatrix,x.posMatrix,[1/2**M,1/2**M,0]),d[f]=x}}return d}getSourceTile(s,d){const f=this.sourceCache._source;let m=s.overscaledZ-this.deltaZoom;if(m>f.maxzoom&&(m=f.maxzoom),m<f.minzoom)return null;this._sourceTileCache[s.key]||(this._sourceTileCache[s.key]=s.scaledTo(m).key);let x=this.sourceCache.getTileByID(this._sourceTileCache[s.key]);if((!x||!x.dem)&&d)for(;m>=f.minzoom&&(!x||!x.dem);)x=this.sourceCache.getTileByID(s.scaledTo(m--).key);return x}tilesAfterTime(s=Date.now()){return Object.values(this._tiles).filter(d=>d.timeAdded>=s)}}class Od{constructor(s,d,f){this.painter=s,this.sourceCache=new g_(d),this.options=f,this.exaggeration=typeof f.exaggeration=="number"?f.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(s,d,f,m=l.X){var x;if(!(d>=0&&d<m&&f>=0&&f<m))return 0;const M=this.getTerrainData(s),P=(x=M.tile)===null||x===void 0?void 0:x.dem;if(!P)return 0;const D=function(Q,re,ae){var ce=re[0],he=re[1];return Q[0]=ae[0]*ce+ae[4]*he+ae[12],Q[1]=ae[1]*ce+ae[5]*he+ae[13],Q}([],[d/m*l.X,f/m*l.X],M.u_terrain_matrix),L=[D[0]*P.dim,D[1]*P.dim],B=Math.floor(L[0]),V=Math.floor(L[1]),W=L[0]-B,K=L[1]-V;return P.get(B,V)*(1-W)*(1-K)+P.get(B+1,V)*W*(1-K)+P.get(B,V+1)*(1-W)*K+P.get(B+1,V+1)*W*K}getElevationForLngLatZoom(s,d){if(!l.bb(d,s.wrap()))return 0;const{tileID:f,mercatorX:m,mercatorY:x}=this._getOverscaledTileIDFromLngLatZoom(s,d);return this.getElevation(f,m%l.X,x%l.X,l.X)}getElevation(s,d,f,m=l.X){return this.getDEMElevation(s,d,f,m)*this.exaggeration}getTerrainData(s){if(!this._emptyDemTexture){const m=this.painter.context,x=new l.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new it(m,x,m.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new it(m,new l.R({width:1,height:1}),m.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(m.gl.NEAREST,m.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=l.an([])}const d=this.sourceCache.getSourceTile(s,!0);if(d&&d.dem&&(!d.demTexture||d.needsTerrainPrepare)){const m=this.painter.context;d.demTexture=this.painter.getTileTexture(d.dem.stride),d.demTexture?d.demTexture.update(d.dem.getPixels(),{premultiply:!1}):d.demTexture=new it(m,d.dem.getPixels(),m.gl.RGBA,{premultiply:!1}),d.demTexture.bind(m.gl.NEAREST,m.gl.CLAMP_TO_EDGE),d.needsTerrainPrepare=!1}const f=d&&d+d.tileID.key+s.key;if(f&&!this._demMatrixCache[f]){const m=this.sourceCache.sourceCache._source.maxzoom;let x=s.canonical.z-d.tileID.canonical.z;s.overscaledZ>s.canonical.z&&(s.canonical.z>=m?x=s.canonical.z-m:l.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const M=s.canonical.x-(s.canonical.x>>x<<x),P=s.canonical.y-(s.canonical.y>>x<<x),D=l.bc(new Float64Array(16),[1/(l.X<<x),1/(l.X<<x),0]);l.J(D,D,[M*l.X,P*l.X,0]),this._demMatrixCache[s.key]={matrix:D,coord:s}}return{u_depth:2,u_terrain:3,u_terrain_dim:d&&d.dem&&d.dem.dim||1,u_terrain_matrix:f?this._demMatrixCache[s.key].matrix:this._emptyDemMatrix,u_terrain_unpack:d&&d.dem&&d.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(d&&d.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:d}}getFramebuffer(s){const d=this.painter,f=d.width/devicePixelRatio,m=d.height/devicePixelRatio;return!this._fbo||this._fbo.width===f&&this._fbo.height===m||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new it(d.context,{width:f,height:m,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 it(d.context,{width:f,height:m,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(f,m,!0,!1),this._fbo.depthAttachment.set(d.context.createRenderbuffer(d.context.gl.DEPTH_COMPONENT16,f,m))),this._fbo.colorAttachment.set(s==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const s=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const d=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let x=0,M=0;x<this._coordsTextureSize;x++)for(let 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 f=new l.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(d.buffer)),m=new it(s,f,s.gl.RGBA,{premultiply:!1});return m.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._coordsTexture=m,m}pointCoordinate(s){this.painter.maybeDrawDepthAndCoords(!0);const d=new Uint8Array(4),f=this.painter.context,m=f.gl,x=Math.round(s.x*this.painter.pixelRatio/devicePixelRatio),M=Math.round(s.y*this.painter.pixelRatio/devicePixelRatio),P=Math.round(this.painter.height/devicePixelRatio);f.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),m.readPixels(x,P-M-1,1,1,m.RGBA,m.UNSIGNED_BYTE,d),f.bindFramebuffer.set(null);const D=d[0]+(d[2]>>4<<8),L=d[1]+((15&d[2])<<8),B=this.coordsIndex[255-d[3]],V=B&&this.sourceCache.getTileByID(B);if(!V)return null;const W=this._coordsTextureSize,K=(1<<V.tileID.canonical.z)*W;return new l.Z((V.tileID.canonical.x*W+D)/K+V.tileID.wrap,(V.tileID.canonical.y*W+L)/K,this.getElevation(V.tileID,D,L,W))}depthAtPoint(s){const d=new Uint8Array(4),f=this.painter.context,m=f.gl;return f.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),m.readPixels(s.x,this.painter.height/devicePixelRatio-s.y-1,1,1,m.RGBA,m.UNSIGNED_BYTE,d),f.bindFramebuffer.set(null),(d[0]/16777216+d[1]/65536+d[2]/256+d[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const s=this.painter.context,d=new l.bd,f=new l.aY,m=this.meshSize,x=l.X/m,M=m*m;for(let V=0;V<=m;V++)for(let W=0;W<=m;W++)d.emplaceBack(W*x,V*x,0);for(let V=0;V<M;V+=m+1)for(let W=0;W<m;W++)f.emplaceBack(W+V,m+W+V+1,m+W+V+2),f.emplaceBack(W+V,m+W+V+2,W+V+1);const P=d.length,D=P+2*(m+1);for(const V of[0,1])for(let W=0;W<=m;W++)for(const K of[0,1])d.emplaceBack(W*x,V*l.X,K);for(let V=0;V<2*m;V+=2)f.emplaceBack(D+V,D+V+1,D+V+3),f.emplaceBack(D+V,D+V+3,D+V+2),f.emplaceBack(P+V,P+V+3,P+V+1),f.emplaceBack(P+V,P+V+2,P+V+3);const L=d.length,B=L+2*(m+1);for(const V of[0,1])for(let W=0;W<=m;W++)for(const K of[0,1])d.emplaceBack(V*l.X,W*x,K);for(let V=0;V<2*m;V+=2)f.emplaceBack(L+V,L+V+1,L+V+3),f.emplaceBack(L+V,L+V+3,L+V+2),f.emplaceBack(B+V,B+V+3,B+V+1),f.emplaceBack(B+V,B+V+2,B+V+3);return this._mesh=new gu(s.createVertexBuffer(d,Dd.members),s.createIndexBuffer(f),l.a0.simpleSegment(0,0,d.length,f.length)),this._mesh}getMeshFrameDelta(s){return 2*Math.PI*l.be/Math.pow(2,s)/5}getMinTileElevationForLngLatZoom(s,d){var f;const{tileID:m}=this._getOverscaledTileIDFromLngLatZoom(s,d);return(f=this.getMinMaxElevation(m).minElevation)!==null&&f!==void 0?f:0}getMinMaxElevation(s){const d=this.getTerrainData(s).tile,f={minElevation:null,maxElevation:null};return d&&d.dem&&(f.minElevation=d.dem.min*this.exaggeration,f.maxElevation=d.dem.max*this.exaggeration),f}_getOverscaledTileIDFromLngLatZoom(s,d){const f=l.Z.fromLngLat(s.wrap()),m=(1<<d)*l.X,x=f.x*m,M=f.y*m,P=Math.floor(x/l.X),D=Math.floor(M/l.X);return{tileID:new l.S(d,0,d,P,D),mercatorX:x,mercatorY:M}}}class y_{constructor(s,d,f){this._context=s,this._size=d,this._tileSize=f,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const s of this._objects)s.texture.destroy(),s.fbo.destroy()}_createObject(s){const d=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),f=new it(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return f.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),d.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),d.colorAttachment.set(f.texture),{id:s,fbo:d,texture:f,stamp:-1,inUse:!1}}getObjectForId(s){return this._objects[s]}useObject(s){s.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(d=>s.id!==d),this._recentlyUsed.push(s.id)}stampObject(s){s.stamp=++this._stamp}getOrCreateFreeObject(){for(const d of this._recentlyUsed)if(!this._objects[d].inUse)return this._objects[d];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const s=this._createObject(this._objects.length);return this._objects.push(s),s}freeObject(s){s.inUse=!1}freeAllObjects(){for(const s of this._objects)this.freeObject(s)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(s=>!s.inUse)===!1}}const Za={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class km{constructor(s,d){this.painter=s,this.terrain=d,this.pool=new y_(s.context,30,d.sourceCache.tileSize*d.qualityFactor)}destruct(){this.pool.destruct()}getTexture(s){return this.pool.getObjectForId(s.rtt[this._stacks.length-1].id).texture}prepareForRender(s,d){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=s._order.filter(f=>!s._layers[f].isHidden(d)),this._coordsDescendingInv={};for(const f in s.sourceCaches){this._coordsDescendingInv[f]={};const m=s.sourceCaches[f].getVisibleCoordinates();for(const x of m){const M=this.terrain.sourceCache.getTerrainCoords(x);for(const P in M)this._coordsDescendingInv[f][P]||(this._coordsDescendingInv[f][P]=[]),this._coordsDescendingInv[f][P].push(M[P])}}this._coordsDescendingInvStr={};for(const f of s._order){const m=s._layers[f],x=m.source;if(Za[m.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 f of this._renderableTiles)for(const m in this._coordsDescendingInvStr){const x=this._coordsDescendingInvStr[m][f.tileID.key];x&&x!==f.rttCoords[m]&&(f.rtt=[])}}renderLayer(s){if(s.isHidden(this.painter.transform.zoom))return!1;const d=s.type,f=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===s.id;if(Za[d]&&(this._prevType&&Za[this._prevType]||this._stacks.push([]),this._prevType=d,this._stacks[this._stacks.length-1].push(s.id),!m))return!0;if(Za[this._prevType]||Za[d]&&m){this._prevType=d;const x=this._stacks.length-1,M=this._stacks[x]||[];for(const P of this._renderableTiles){if(this.pool.isFull()&&(mm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(P),P.rtt[x]){const L=this.pool.getObjectForId(P.rtt[x].id);if(L.stamp===P.rtt[x].stamp){this.pool.useObject(L);continue}}const D=this.pool.getOrCreateFreeObject();this.pool.useObject(D),this.pool.stampObject(D),P.rtt[x]={id:D.id,stamp:D.stamp},f.context.bindFramebuffer.set(D.fbo.framebuffer),f.context.clear({color:l.aM.transparent,stencil:0}),f.currentStencilSource=void 0;for(let L=0;L<M.length;L++){const B=f.style._layers[M[L]],V=B.source?this._coordsDescendingInv[B.source][P.tileID.key]:[P.tileID];f.context.viewport.set([0,0,D.fbo.width,D.fbo.height]),f._renderTileClippingMasks(B,V),f.renderLayer(f,f.style.sourceCaches[B.source],B,V),B.source&&(P.rttCoords[B.source]=this._coordsDescendingInvStr[B.source][P.tileID.key])}}return mm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Za[d]}return!1}}const zd={"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"},Sm=g,__={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=b=>{b.touchstart=b.dragStart,b.touchmoveWindow=b.dragMove,b.touchend=b.dragEnd},x_={showCompass:!0,showZoom:!0,visualizePitch:!1};class b_{constructor(s,d,f=!1){this.mousedown=M=>{this.startMouse(l.e({},M,{ctrlKey:!0,preventDefault:()=>M.preventDefault()}),T.mousePos(this.element,M)),T.addEventListener(window,"mousemove",this.mousemove),T.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=M=>{this.moveMouse(M,T.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=T.touchPos(this.element,M.targetTouches)[0],this.startTouch(M,this._startPos),T.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.addEventListener(window,"touchend",this.touchend))},this.touchmove=M=>{M.targetTouches.length!==1?this.reset():(this._lastPos=T.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 m=s.dragRotate._mouseRotate.getClickTolerance(),x=s.dragRotate._mousePitch.getClickTolerance();this.element=d,this.mouseRotate=wd({clickTolerance:m,enable:!0}),this.touchRotate=(({enable:M,clickTolerance:P,bearingDegreesPerPixelMoved:D=.8})=>{const L=new vd;return new qs({clickTolerance:P,move:(B,V)=>({bearingDelta:(V.x-B.x)*D}),moveStateManager:L,enable:M,assignEvents:Rd})})({clickTolerance:m,enable:!0}),this.map=s,f&&(this.mousePitch=kd({clickTolerance:x,enable:!0}),this.touchPitch=(({enable:M,clickTolerance:P,pitchDegreesPerPixelMoved:D=-.5})=>{const L=new vd;return new qs({clickTolerance:P,move:(B,V)=>({pitchDelta:(V.y-B.y)*D}),moveStateManager:L,enable:M,assignEvents:Rd})})({clickTolerance:x,enable:!0})),T.addEventListener(d,"mousedown",this.mousedown),T.addEventListener(d,"touchstart",this.touchstart,{passive:!1}),T.addEventListener(d,"touchcancel",this.reset)}startMouse(s,d){this.mouseRotate.dragStart(s,d),this.mousePitch&&this.mousePitch.dragStart(s,d),T.disableDrag()}startTouch(s,d){this.touchRotate.dragStart(s,d),this.touchPitch&&this.touchPitch.dragStart(s,d),T.disableDrag()}moveMouse(s,d){const f=this.map,{bearingDelta:m}=this.mouseRotate.dragMove(s,d)||{};if(m&&f.setBearing(f.getBearing()+m),this.mousePitch){const{pitchDelta:x}=this.mousePitch.dragMove(s,d)||{};x&&f.setPitch(f.getPitch()+x)}}moveTouch(s,d){const f=this.map,{bearingDelta:m}=this.touchRotate.dragMove(s,d)||{};if(m&&f.setBearing(f.getBearing()+m),this.touchPitch){const{pitchDelta:x}=this.touchPitch.dragMove(s,d)||{};x&&f.setPitch(f.getPitch()+x)}}off(){const s=this.element;T.removeEventListener(s,"mousedown",this.mousedown),T.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),T.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.removeEventListener(window,"touchend",this.touchend),T.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){T.enableDrag(),T.removeEventListener(window,"mousemove",this.mousemove),T.removeEventListener(window,"mouseup",this.mouseup),T.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.removeEventListener(window,"touchend",this.touchend)}}let _r;function Ln(b,s,d){const f=new l.N(b.lng,b.lat);if(b=new l.N(b.lng,b.lat),s){const m=new l.N(b.lng-360,b.lat),x=new l.N(b.lng+360,b.lat),M=d.locationPoint(b).distSqr(s);d.locationPoint(m).distSqr(s)<M?b=m:d.locationPoint(x).distSqr(s)<M&&(b=x)}for(;Math.abs(b.lng-d.center.lng)>180;){const m=d.locationPoint(b);if(m.x>=0&&m.y>=0&&m.x<=d.width&&m.y<=d.height)break;b.lng>d.center.lng?b.lng-=360:b.lng+=360}return b.lng!==f.lng&&d.locationPoint(b).y>d.height/2-d.getHorizon()?b:f}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 Tu(b,s,d){const f=b.classList;for(const m in Ya)f.remove(`maplibregl-${d}-anchor-${m}`);f.add(`maplibregl-${d}-anchor-${s}`)}class Mu extends l.E{constructor(s){if(super(),this._onKeyPress=d=>{const f=d.code,m=d.charCode||d.keyCode;f!=="Space"&&f!=="Enter"&&m!==32&&m!==13||this.togglePopup()},this._onMapClick=d=>{const f=d.originalEvent.target,m=this._element;this._popup&&(f===m||m.contains(f))&&this.togglePopup()},this._update=d=>{var f;if(!this._map)return;const m=this._map.loaded()&&!this._map.isMoving();((d==null?void 0:d.type)==="terrain"||(d==null?void 0:d.type)==="render"&&!m)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Ln(this._lngLat,this._flatPos,this._map.transform):(f=this._lngLat)===null||f===void 0?void 0:f.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let 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()),T.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 f=this._clickTolerance||this._map._clickTolerance;this._isDragging=d.point.dist(this._pointerdownPos)>=f}this._isDragging&&(this._pos=d.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new l.k("dragstart"))),this.fire(new l.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new l.k("dragend")),this._state="inactive"},this._addDragHandler=d=>{this._element.contains(d.originalEvent.target)&&(d.preventDefault(),this._positionDelta=d.point.sub(this._pos).add(this._offset),this._pointerdownPos=d.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=s&&s.anchor||"center",this._color=s&&s.color||"#3FB1CE",this._scale=s&&s.scale||1,this._draggable=s&&s.draggable||!1,this._clickTolerance=s&&s.clickTolerance||0,this._subpixelPositioning=s&&s.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=s&&s.rotation||0,this._rotationAlignment=s&&s.rotationAlignment||"auto",this._pitchAlignment=s&&s.pitchAlignment&&s.pitchAlignment!=="auto"?s.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(s==null?void 0:s.opacity,s==null?void 0:s.opacityWhenCovered),s&&s.element)this._element=s.element,this._offset=l.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=T.create("div");const d=T.createNS("http://www.w3.org/2000/svg","svg"),f=41,m=27;d.setAttributeNS(null,"display","block"),d.setAttributeNS(null,"height",`${f}px`),d.setAttributeNS(null,"width",`${m}px`),d.setAttributeNS(null,"viewBox",`0 0 ${m} ${f}`);const x=T.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=T.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"fill-rule","nonzero");const P=T.createNS("http://www.w3.org/2000/svg","g");P.setAttributeNS(null,"transform","translate(3.0, 29.0)"),P.setAttributeNS(null,"fill","#000000");const D=[{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 D){const he=T.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 L=T.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"fill",this._color);const B=T.createNS("http://www.w3.org/2000/svg","path");B.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"),L.appendChild(B);const V=T.createNS("http://www.w3.org/2000/svg","g");V.setAttributeNS(null,"opacity","0.25"),V.setAttributeNS(null,"fill","#000000");const W=T.createNS("http://www.w3.org/2000/svg","path");W.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),V.appendChild(W);const K=T.createNS("http://www.w3.org/2000/svg","g");K.setAttributeNS(null,"transform","translate(6.0, 7.0)"),K.setAttributeNS(null,"fill","#FFFFFF");const Q=T.createNS("http://www.w3.org/2000/svg","g");Q.setAttributeNS(null,"transform","translate(8.0, 8.0)");const re=T.createNS("http://www.w3.org/2000/svg","circle");re.setAttributeNS(null,"fill","#000000"),re.setAttributeNS(null,"opacity","0.25"),re.setAttributeNS(null,"cx","5.5"),re.setAttributeNS(null,"cy","5.5"),re.setAttributeNS(null,"r","5.4999962");const ae=T.createNS("http://www.w3.org/2000/svg","circle");ae.setAttributeNS(null,"fill","#FFFFFF"),ae.setAttributeNS(null,"cx","5.5"),ae.setAttributeNS(null,"cy","5.5"),ae.setAttributeNS(null,"r","5.4999962"),Q.appendChild(re),Q.appendChild(ae),M.appendChild(P),M.appendChild(L),M.appendChild(V),M.appendChild(K),M.appendChild(Q),d.appendChild(M),d.setAttributeNS(null,"height",f*this._scale+"px"),d.setAttributeNS(null,"width",m*this._scale+"px"),this._element.appendChild(d),this._offset=l.P.convert(s&&s.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",d=>{d.preventDefault()}),this._element.addEventListener("mousedown",d=>{d.preventDefault()}),Tu(this._element,this._anchor,"marker"),s&&s.className)for(const d of s.className.split(" "))this._element.classList.add(d);this._popup=null}addTo(s){return this.remove(),this._map=s,this._element.setAttribute("aria-label",s._getUIString("Marker.Title")),s.getCanvasContainer().appendChild(this._element),s.on("move",this._update),s.on("moveend",this._update),s.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),T.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=l.N.convert(s),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(s){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),s){if(!("offset"in s.options)){const m=Math.abs(13.5)/Math.SQRT2;s.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[m,-1*(38.1-13.5+m)],"bottom-right":[-m,-1*(38.1-13.5+m)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(s){return this._subpixelPositioning=s,this}getPopup(){return this._popup}togglePopup(){const s=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:s?(s.isOpen()?s.remove():(s.setLngLat(this._lngLat),s.addTo(this._map)),this):this}_updateOpacity(s=!1){var d,f;if(!(!((d=this._map)===null||d===void 0)&&d.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(s)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const m=this._map,x=m.terrain.depthAtPoint(this._pos),M=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,M)-x<.006)return void(this._element.style.opacity=this._opacity);const P=-this._offset.y/m.transform._pixelPerMeter,D=Math.sin(m.getPitch()*Math.PI/180)*P,L=m.terrain.depthAtPoint(new l.P(this._pos.x,this._pos.y-this._offset.y)),B=m.transform.lngLatToCameraDepth(this._lngLat,M+D)-L>.006;!((f=this._popup)===null||f===void 0)&&f.isOpen()&&B&&this._popup.remove(),this._element.style.opacity=B?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(s){return this._offset=l.P.convert(s),this._update(),this}addClassName(s){this._element.classList.add(s)}removeClassName(s){this._element.classList.remove(s)}toggleClassName(s){return this._element.classList.toggle(s)}setDraggable(s){return this._draggable=!!s,this._map&&(s?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(s){return this._rotation=s||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(s){return this._rotationAlignment=s||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(s){return this._pitchAlignment=s&&s!=="auto"?s:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(s,d){return s===void 0&&d===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),s!==void 0&&(this._opacity=s),d!==void 0&&(this._opacityWhenCovered=d),this._map&&this._updateOpacity(!0),this}}const Em={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Jl=0,Ql=!1;const Ps={maxWidth:100,unit:"metric"};function ec(b,s,d){const f=d&&d.maxWidth||100,m=b._container.clientHeight/2,x=b.unproject([0,m]),M=b.unproject([f,m]),P=x.distanceTo(M);if(d&&d.unit==="imperial"){const D=3.2808*P;D>5280?pt(s,f,D/5280,b._getUIString("ScaleControl.Miles")):pt(s,f,D,b._getUIString("ScaleControl.Feet"))}else d&&d.unit==="nautical"?pt(s,f,P/1852,b._getUIString("ScaleControl.NauticalMiles")):P>=1e3?pt(s,f,P/1e3,b._getUIString("ScaleControl.Kilometers")):pt(s,f,P,b._getUIString("ScaleControl.Meters"))}function pt(b,s,d,f){const m=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(D){const L=Math.pow(10,Math.ceil(-Math.log(D)/Math.LN10));return Math.round(D*L)/L}(P),M*P}(d);b.style.width=s*(m/d)+"px",b.innerHTML=`${m} ${f}`}const Et={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Au=["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(b){if(b){if(typeof b=="number"){const s=Math.round(Math.abs(b)/Math.SQRT2);return{center:new l.P(0,0),top:new l.P(0,b),"top-left":new l.P(s,s),"top-right":new l.P(-s,s),bottom:new l.P(0,-b),"bottom-left":new l.P(s,-s),"bottom-right":new l.P(-s,-s),left:new l.P(b,0),right:new l.P(-b,0)}}if(b instanceof l.P||Array.isArray(b)){const s=l.P.convert(b);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}return{center:l.P.convert(b.center||[0,0]),top:l.P.convert(b.top||[0,0]),"top-left":l.P.convert(b["top-left"]||[0,0]),"top-right":l.P.convert(b["top-right"]||[0,0]),bottom:l.P.convert(b.bottom||[0,0]),"bottom-left":l.P.convert(b["bottom-left"]||[0,0]),"bottom-right":l.P.convert(b["bottom-right"]||[0,0]),left:l.P.convert(b.left||[0,0]),right:l.P.convert(b.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=yr,u.CanvasSource=bi,u.CooperativeGesturesHandler=qa,u.DoubleClickZoomHandler=Ko,u.DragPanHandler=bm,u.DragRotateHandler=vm,u.EdgeInsets=$a,u.FullscreenControl=class extends l.E{constructor(b={}){super(),this._onFullscreenChange=()=>{var s;let d=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((s=d==null?void 0:d.shadowRoot)===null||s===void 0)&&s.fullscreenElement;)d=d.shadowRoot.fullscreenElement;d===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,b&&b.container&&(b.container instanceof HTMLElement?this._container=b.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(b){return this._map=b,this._container||(this._container=this._map.getContainer()),this._controlContainer=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){T.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const b=this._fullscreenButton=T.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);T.create("span","maplibregl-ctrl-icon",b).setAttribute("aria-hidden","true"),b.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const b=this._getTitle();this._fullscreenButton.setAttribute("aria-label",b),this._fullscreenButton.title=b}_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=er,u.GeolocateControl=class extends l.E{constructor(b){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new l.k("outofmaxbounds",s)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=s,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(s),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(s),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new l.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{const d=new l.N(s.coords.longitude,s.coords.latitude),f=s.coords.accuracy,m=this._map.getBearing(),x=l.e({bearing:m},this.options.fitBoundsOptions),M=ke.fromLngLat(d,f);this._map.fitBounds(M,x,{geolocateSource:!0})},this._updateMarker=s=>{if(s){const d=new l.N(s.coords.longitude,s.coords.latitude);this._accuracyCircleMarker.setLngLat(d).addTo(this._map),this._userLocationDotMarker.setLngLat(d).addTo(this._map),this._accuracy=s.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=s=>{if(this._map){if(this.options.trackUserLocation)if(s.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=d,this._geolocateButton.setAttribute("aria-label",d),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(s.code===3&&Ql)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new l.k("error",s)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",s=>s.preventDefault()),this._geolocateButton=T.create("button","maplibregl-ctrl-geolocate",this._container),T.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=s=>{if(this._map){if(s===!1){l.w("Geolocation support is not available so the GeolocateControl will be disabled.");const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=d,this._geolocateButton.setAttribute("aria-label",d)}else{const d=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=d,this._geolocateButton.setAttribute("aria-label",d)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=T.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Mu({element:this._dotElement}),this._circleElement=T.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Mu({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({},Em,b)}onAdd(b){return this._map=b,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return l._(this,arguments,void 0,function*(s=!1){if(_r!==void 0&&!s)return _r;if(window.navigator.permissions===void 0)return _r=!!window.navigator.geolocation,_r;try{_r=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{_r=!!window.navigator.geolocation}return _r})}().then(s=>this._finishSetupUI(s)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),T.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Jl=0,Ql=!1}_isOutOfMapMaxBounds(b){const s=this._map.getMaxBounds(),d=b.coords;return s&&(d.longitude<s.getWest()||d.longitude>s.getEast()||d.latitude<s.getSouth()||d.latitude>s.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const b=this._map.getBounds(),s=b.getSouthEast(),d=b.getNorthEast(),f=s.distanceTo(d),m=Math.ceil(this._accuracy/(f/this._map._container.clientHeight)*2);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}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":Jl--,Ql=!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 b;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Jl++,Jl>1?(b={maximumAge:6e5,timeout:0},Ql=!0):(b=this.options.positionOptions,Ql=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,b)}}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=_u,u.ImageSource=xi,u.KeyboardHandler=Nr,u.LngLatBounds=ke,u.LogoControl=Id,u.Map=class extends wm{constructor(b){l.bf.mark(l.bg.create);const s=Object.assign(Object.assign({},__),b);if(s.minZoom!=null&&s.maxZoom!=null&&s.minZoom>s.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(s.minPitch!=null&&s.maxPitch!=null&&s.minPitch>s.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(s.minPitch!=null&&s.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(s.maxPitch!=null&&s.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ja(s.minZoom,s.maxZoom,s.minPitch,s.maxPitch,s.renderWorldCopies),{bearingSnap:s.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Jt,this._controls=[],this._mapId=l.a4(),this._contextLost=d=>{d.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new l.k("webglcontextlost",{originalEvent:d}))},this._contextRestored=d=>{this._setupPainter(),this.resize(),this._update(),this.fire(new l.k("webglcontextrestored",{originalEvent:d}))},this._onMapScroll=d=>{if(d.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=s.interactive,this._maxTileCacheSize=s.maxTileCacheSize,this._maxTileCacheZoomLevels=s.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=s.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=s.preserveDrawingBuffer===!0,this._antialias=s.antialias===!0,this._trackResize=s.trackResize===!0,this._bearingSnap=s.bearingSnap,this._refreshExpiredTiles=s.refreshExpiredTiles===!0,this._fadeDuration=s.fadeDuration,this._crossSourceCollisions=s.crossSourceCollisions===!0,this._collectResourceTiming=s.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},zd),s.locale),this._clickTolerance=s.clickTolerance,this._overridePixelRatio=s.pixelRatio,this._maxCanvasSize=s.maxCanvasSize,this.transformCameraUpdate=s.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=s.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=le.addThrottleControl(()=>this.isMoving()),this._requestManager=new J(s.transformRequest),typeof s.container=="string"){if(this._container=document.getElementById(s.container),!this._container)throw new Error(`Container '${s.container}' not found.`)}else{if(!(s.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=s.container}if(s.maxBounds&&this.setMaxBounds(s.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let d=!1;const f=Gl(m=>{this._trackResize&&!this._removed&&(this.resize(m),this.redraw())},50);this._resizeObserver=new ResizeObserver(m=>{d?f(m):d=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Pd(this,s),this._hash=s.hash&&new _u(typeof s.hash=="string"&&s.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:s.center,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch}),s.bounds&&(this.resize(),this.fitBounds(s.bounds,l.e({},s.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=s.localIdeographFontFamily,this._validateStyle=s.validateStyle,s.style&&this.setStyle(s.style,{localIdeographFontFamily:s.localIdeographFontFamily}),s.attributionControl&&this.addControl(new Ga(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new Id,s.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",d=>{this._update(d.dataType==="style"),this.fire(new l.k(`${d.dataType}data`,d))}),this.on("dataloading",d=>{this.fire(new l.k(`${d.dataType}dataloading`,d))}),this.on("dataabort",d=>{this.fire(new l.k("sourcedataabort",d))})}_getMapId(){return this._mapId}addControl(b,s){if(s===void 0&&(s=b.getDefaultPosition?b.getDefaultPosition():"top-right"),!b||!b.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=b.onAdd(this);this._controls.push(b);const f=this._controlPositions[s];return s.indexOf("bottom")!==-1?f.insertBefore(d,f.firstChild):f.appendChild(d),this}removeControl(b){if(!b||!b.onRemove)return this.fire(new l.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(b);return s>-1&&this._controls.splice(s,1),b.onRemove(this),this}hasControl(b){return this._controls.indexOf(b)>-1}calculateCameraOptionsFromTo(b,s,d,f){return f==null&&this.terrain&&(f=this.terrain.getElevationForLngLatZoom(d,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(b,s,d,f)}resize(b){var s;const d=this._containerDimensions(),f=d[0],m=d[1],x=this._getClampedPixelRatio(f,m);if(this._resizeCanvas(f,m,x),this.painter.resize(f,m,x),this.painter.overLimit()){const P=this.painter.context.gl;this._maxCanvasSize=[P.drawingBufferWidth,P.drawingBufferHeight];const D=this._getClampedPixelRatio(f,m);this._resizeCanvas(f,m,D),this.painter.resize(f,m,D)}this.transform.resize(f,m),(s=this._requestedCameraState)===null||s===void 0||s.resize(f,m);const M=!this._moving;return M&&(this.stop(),this.fire(new l.k("movestart",b)).fire(new l.k("move",b))),this.fire(new l.k("resize",b)),M&&this.fire(new l.k("moveend",b)),this}_getClampedPixelRatio(b,s){const{0:d,1:f}=this._maxCanvasSize,m=this.getPixelRatio(),x=b*m,M=s*m;return Math.min(x>d?d/x:1,M>f?f/M:1)*m}getPixelRatio(){var b;return(b=this._overridePixelRatio)!==null&&b!==void 0?b:devicePixelRatio}setPixelRatio(b){this._overridePixelRatio=b,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(b){return this.transform.setMaxBounds(ke.convert(b)),this._update()}setMinZoom(b){if((b=b??-2)>=-2&&b<=this.transform.maxZoom)return this.transform.minZoom=b,this._update(),this.getZoom()<b&&this.setZoom(b),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(b){if((b=b??22)>=this.transform.minZoom)return this.transform.maxZoom=b,this._update(),this.getZoom()>b&&this.setZoom(b),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(b){if((b=b??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(b>=0&&b<=this.transform.maxPitch)return this.transform.minPitch=b,this._update(),this.getPitch()<b&&this.setPitch(b),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(b){if((b=b??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(b>=this.transform.minPitch)return this.transform.maxPitch=b,this._update(),this.getPitch()>b&&this.setPitch(b),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(b){return this.transform.renderWorldCopies=b,this._update()}project(b){return this.transform.locationPoint(l.N.convert(b),this.style&&this.terrain)}unproject(b){return this.transform.pointLocation(l.P.convert(b),this.terrain)}isMoving(){var b;return this._moving||((b=this.handlers)===null||b===void 0?void 0:b.isMoving())}isZooming(){var b;return this._zooming||((b=this.handlers)===null||b===void 0?void 0:b.isZooming())}isRotating(){var b;return this._rotating||((b=this.handlers)===null||b===void 0?void 0:b.isRotating())}_createDelegatedListener(b,s,d){if(b==="mouseenter"||b==="mouseover"){let f=!1;return{layers:s,listener:d,delegates:{mousemove:x=>{const M=s.filter(D=>this.getLayer(D)),P=M.length!==0?this.queryRenderedFeatures(x.point,{layers:M}):[];P.length?f||(f=!0,d.call(this,new Pi(b,this,x.originalEvent,{features:P}))):f=!1},mouseout:()=>{f=!1}}}}if(b==="mouseleave"||b==="mouseout"){let f=!1;return{layers:s,listener:d,delegates:{mousemove:M=>{const P=s.filter(D=>this.getLayer(D));(P.length!==0?this.queryRenderedFeatures(M.point,{layers:P}):[]).length?f=!0:f&&(f=!1,d.call(this,new Pi(b,this,M.originalEvent)))},mouseout:M=>{f&&(f=!1,d.call(this,new Pi(b,this,M.originalEvent)))}}}}{const f=m=>{const x=s.filter(P=>this.getLayer(P)),M=x.length!==0?this.queryRenderedFeatures(m.point,{layers:x}):[];M.length&&(m.features=M,d.call(this,m),delete m.features)};return{layers:s,listener:d,delegates:{[b]:f}}}}_saveDelegatedListener(b,s){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[b]=this._delegatedListeners[b]||[],this._delegatedListeners[b].push(s)}_removeDelegatedListener(b,s,d){if(!this._delegatedListeners||!this._delegatedListeners[b])return;const f=this._delegatedListeners[b];for(let m=0;m<f.length;m++){const x=f[m];if(x.listener===d&&x.layers.length===s.length&&x.layers.every(M=>s.includes(M))){for(const M in x.delegates)this.off(M,x.delegates[M]);return void f.splice(m,1)}}}on(b,s,d){if(d===void 0)return super.on(b,s);const f=this._createDelegatedListener(b,typeof s=="string"?[s]:s,d);this._saveDelegatedListener(b,f);for(const m in f.delegates)this.on(m,f.delegates[m]);return this}once(b,s,d){if(d===void 0)return super.once(b,s);const f=typeof s=="string"?[s]:s,m=this._createDelegatedListener(b,f,d);for(const x in m.delegates){const M=m.delegates[x];m.delegates[x]=(...P)=>{this._removeDelegatedListener(b,f,d),M(...P)}}this._saveDelegatedListener(b,m);for(const x in m.delegates)this.once(x,m.delegates[x]);return this}off(b,s,d){return d===void 0?super.off(b,s):(this._removeDelegatedListener(b,typeof s=="string"?[s]:s,d),this)}queryRenderedFeatures(b,s){if(!this.style)return[];let d;const f=b instanceof l.P||Array.isArray(b),m=f?b:[[0,0],[this.transform.width,this.transform.height]];if(s=s||(f?{}:b)||{},m instanceof l.P||typeof m[0]=="number")d=[l.P.convert(m)];else{const x=l.P.convert(m[0]),M=l.P.convert(m[1]);d=[x,new l.P(M.x,x.y),M,new l.P(x.x,M.y),x]}return this.style.queryRenderedFeatures(d,s,this.transform)}querySourceFeatures(b,s){return this.style.querySourceFeatures(b,s)}setStyle(b,s){return(s=l.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},s)).diff!==!1&&s.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&b?(this._diffStyle(b,s),this):(this._localIdeographFontFamily=s.localIdeographFontFamily,this._updateStyle(b,s))}setTransformRequest(b){return this._requestManager.setTransformRequest(b),this}_getUIString(b){const s=this._locale[b];if(s==null)throw new Error(`Missing UI string '${b}'`);return s}_updateStyle(b,s){if(s.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(b,s));const d=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!b)),b?(this.style=new tu(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof b=="string"?this.style.loadURL(b,s,d):this.style.loadJSON(b,s,d),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new tu(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(b,s){if(typeof b=="string"){const d=this._requestManager.transformRequest(b,"Style");l.h(d,new AbortController).then(f=>{this._updateDiff(f.data,s)}).catch(f=>{f&&this.fire(new l.j(f))})}else typeof b=="object"&&this._updateDiff(b,s)}_updateDiff(b,s){try{this.style.setState(b,s)&&this._update(!0)}catch(d){l.w(`Unable to perform style diff: ${d.message||d.error||d}. Rebuilding the style from scratch.`),this._updateStyle(b,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():l.w("There is no style added to the map.")}addSource(b,s){return this._lazyInitEmptyStyle(),this.style.addSource(b,s),this._update(!0)}isSourceLoaded(b){const s=this.style&&this.style.sourceCaches[b];if(s!==void 0)return s.loaded();this.fire(new l.j(new Error(`There is no source with ID '${b}'`)))}setTerrain(b){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),b){const s=this.style.sourceCaches[b.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${b.source}`);this.terrain===null&&s.reload();for(const d in this.style._layers){const f=this.style._layers[d];f.type==="hillshade"&&f.source===b.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 Od(this.painter,s,b),this.painter.renderToTexture=new km(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!==b.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:b})),this}getTerrain(){var b,s;return(s=(b=this.terrain)===null||b===void 0?void 0:b.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const b=this.style&&this.style.sourceCaches;for(const s in b){const d=b[s]._tiles;for(const f in d){const m=d[f];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}removeSource(b){return this.style.removeSource(b),this._update(!0)}getSource(b){return this.style.getSource(b)}addImage(b,s,d={}){const{pixelRatio:f=1,sdf:m=!1,stretchX:x,stretchY:M,content:P,textFitWidth:D,textFitHeight:L}=d;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||l.b(s))){if(s.width===void 0||s.height===void 0)return this.fire(new l.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:B,height:V,data:W}=s,K=s;return this.style.addImage(b,{data:new l.R({width:B,height:V},new Uint8Array(W)),pixelRatio:f,stretchX:x,stretchY:M,content:P,textFitWidth:D,textFitHeight:L,sdf:m,version:0,userImage:K}),K.onAdd&&K.onAdd(this,b),this}}{const{width:B,height:V,data:W}=E.getImageData(s);this.style.addImage(b,{data:new l.R({width:B,height:V},W),pixelRatio:f,stretchX:x,stretchY:M,content:P,textFitWidth:D,textFitHeight:L,sdf:m,version:0})}}updateImage(b,s){const d=this.style.getImage(b);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 f=s instanceof HTMLImageElement||l.b(s)?E.getImageData(s):s,{width:m,height:x,data:M}=f;if(m===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(m!==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=!(s instanceof HTMLImageElement||l.b(s));return d.data.replace(M,P),this.style.updateImage(b,d),this}getImage(b){return this.style.getImage(b)}hasImage(b){return b?!!this.style.getImage(b):(this.fire(new l.j(new Error("Missing required image id"))),!1)}removeImage(b){this.style.removeImage(b)}loadImage(b){return le.getImage(this._requestManager.transformRequest(b,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(b,s){return this._lazyInitEmptyStyle(),this.style.addLayer(b,s),this._update(!0)}moveLayer(b,s){return this.style.moveLayer(b,s),this._update(!0)}removeLayer(b){return this.style.removeLayer(b),this._update(!0)}getLayer(b){return this.style.getLayer(b)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(b,s,d){return this.style.setLayerZoomRange(b,s,d),this._update(!0)}setFilter(b,s,d={}){return this.style.setFilter(b,s,d),this._update(!0)}getFilter(b){return this.style.getFilter(b)}setPaintProperty(b,s,d,f={}){return this.style.setPaintProperty(b,s,d,f),this._update(!0)}getPaintProperty(b,s){return this.style.getPaintProperty(b,s)}setLayoutProperty(b,s,d,f={}){return this.style.setLayoutProperty(b,s,d,f),this._update(!0)}getLayoutProperty(b,s){return this.style.getLayoutProperty(b,s)}setGlyphs(b,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(b,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(b,s,d={}){return this._lazyInitEmptyStyle(),this.style.addSprite(b,s,d,f=>{f||this._update(!0)}),this}removeSprite(b){return this._lazyInitEmptyStyle(),this.style.removeSprite(b),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(b,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(b,s,d=>{d||this._update(!0)}),this}setLight(b,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(b,s),this._update(!0)}getLight(){return this.style.getLight()}setSky(b){return this._lazyInitEmptyStyle(),this.style.setSky(b),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(b,s){return this.style.setFeatureState(b,s),this._update()}removeFeatureState(b,s){return this.style.removeFeatureState(b,s),this._update()}getFeatureState(b){return this.style.getFeatureState(b)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let b=0,s=0;return this._container&&(b=this._container.clientWidth||400,s=this._container.clientHeight||300),[b,s]}_setupContainer(){const b=this._container;b.classList.add("maplibregl-map");const s=this._canvasContainer=T.create("div","maplibregl-canvas-container",b);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=T.create("canvas","maplibregl-canvas",s),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const d=this._containerDimensions(),f=this._getClampedPixelRatio(d[0],d[1]);this._resizeCanvas(d[0],d[1],f);const m=this._controlContainer=T.create("div","maplibregl-control-container",b),x=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(M=>{x[M]=T.create("div",`maplibregl-ctrl-${M} `,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(b,s,d){this._canvas.width=Math.floor(d*b),this._canvas.height=Math.floor(d*s),this._canvas.style.width=`${b}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const b={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let s=null;this._canvas.addEventListener("webglcontextcreationerror",f=>{s={requestedAttributes:b},f&&(s.statusMessage=f.statusMessage,s.type=f.type)},{once:!0});const d=this._canvas.getContext("webgl2",b)||this._canvas.getContext("webgl",b);if(!d){const f="Failed to initialize WebGL";throw s?(s.message=f,new Error(JSON.stringify(s))):new Error(f)}this.painter=new yu(d,this.transform),I.testSupport(d)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(b){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||b,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(b){return this._update(),this._renderTaskQueue.add(b)}_cancelRenderFrame(b){this._renderTaskQueue.remove(b)}_render(b){const s=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(b),this._removed)return;let d=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,x=E.now();this.style.zoomHistory.update(m,x);const M=new l.z(m,{now:x,fadeDuration:s,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,s,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new l.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.bf.mark(l.bg.load),this.fire(new l.k("load"))),this.style&&(this.style.hasTransitions()||d)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const f=this._sourcesDirty||this._styleDirty||this._placementDirty;return f||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.k("idle")),!this._loaded||this._fullyLoaded||f||(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 b;this._hash&&this._hash.remove();for(const d of this._controls)d.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),le.removeThrottleControl(this._imageQueueHandle),(b=this._resizeObserver)===null||b===void 0||b.disconnect();const s=this.painter.context.gl.getExtension("WEBGL_lose_context");s!=null&&s.loseContext&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),T.remove(this._canvasContainer),T.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(b=>{l.bf.frame(b),this._frameRequest=null,this._render(b)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(b){this._showTileBoundaries!==b&&(this._showTileBoundaries=b,this._update())}get showPadding(){return!!this._showPadding}set showPadding(b){this._showPadding!==b&&(this._showPadding=b,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(b){this._showCollisionBoxes!==b&&(this._showCollisionBoxes=b,b?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(b){this._showOverdrawInspector!==b&&(this._showOverdrawInspector=b,this._update())}get repaint(){return!!this._repaint}set repaint(b){this._repaint!==b&&(this._repaint=b,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(b){this._vertices=b,this._update()}get version(){return Sm}getCameraTargetElevation(){return this.transform.elevation}},u.MapMouseEvent=Pi,u.MapTouchEvent=Yo,u.MapWheelEvent=ym,u.Marker=Mu,u.NavigationControl=class{constructor(b){this._updateZoomButtons=()=>{const s=this._map.getZoom(),d=s===this._map.getMaxZoom(),f=s===this._map.getMinZoom();this._zoomInButton.disabled=d,this._zoomOutButton.disabled=f,this._zoomInButton.setAttribute("aria-disabled",d.toString()),this._zoomOutButton.setAttribute("aria-disabled",f.toString())},this._rotateCompassArrow=()=>{const s=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=s},this._setButtonTitle=(s,d)=>{const f=this._map._getUIString(`NavigationControl.${d}`);s.title=f,s.setAttribute("aria-label",f)},this.options=l.e({},x_,b),this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",s=>s.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",s=>this._map.zoomIn({},{originalEvent:s})),T.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",s=>this._map.zoomOut({},{originalEvent:s})),T.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",s=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:s}):this._map.resetNorth({},{originalEvent:s})}),this._compassIcon=T.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(b){return this._map=b,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 b_(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){T.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(b,s){const d=T.create("button",b,this._container);return d.type="button",d.addEventListener("click",s),d}},u.Popup=class extends l.E{constructor(b){super(),this.remove=()=>(this._content&&T.remove(this._content),this._container&&(T.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new l.k("close"))),this),this._onMouseUp=s=>{this._update(s.point)},this._onMouseMove=s=>{this._update(s.point)},this._onDrag=s=>{this._update(s.point)},this._update=s=>{var d;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=T.create("div","maplibregl-popup",this._map.getContainer()),this._tip=T.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?Ln(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.wrap(),this._trackPointer&&!s)return;const f=this._flatPos=this._pos=this._trackPointer&&s?s:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&s?s:this._map.transform.locationPoint(this._lngLat));let m=this.options.anchor;const x=Pu(this.options.offset);if(!m){const P=this._container.offsetWidth,D=this._container.offsetHeight;let L;L=f.y+x.bottom.y<D?["top"]:f.y>this._map.transform.height-D?["bottom"]:[],f.x<P/2?L.push("left"):f.x>this._map.transform.width-P/2&&L.push("right"),m=L.length===0?"bottom":L.join("-")}let M=f.add(x[m]);this.options.subpixelPositioning||(M=M.round()),T.setTransform(this._container,`${Ya[m]} translate(${M.x}px,${M.y}px)`),Tu(this._container,m,"popup")},this._onClose=()=>{this.remove()},this.options=l.e(Object.create(Et),b)}addTo(b){return this._map&&this.remove(),this._map=b,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(b){return this._lngLat=l.N.convert(b),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(b){return this.setDOMContent(document.createTextNode(b))}setHTML(b){const s=document.createDocumentFragment(),d=document.createElement("body");let f;for(d.innerHTML=b;f=d.firstChild,f;)s.appendChild(f);return this.setDOMContent(s)}getMaxWidth(){var b;return(b=this._container)===null||b===void 0?void 0:b.style.maxWidth}setMaxWidth(b){return this.options.maxWidth=b,this._update(),this}setDOMContent(b){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=T.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(b),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(b){return this._container&&this._container.classList.add(b),this}removeClassName(b){return this._container&&this._container.classList.remove(b),this}setOffset(b){return this.options.offset=b,this._update(),this}toggleClassName(b){if(this._container)return this._container.classList.toggle(b)}setSubpixelPositioning(b){this.options.subpixelPositioning=b}_createCloseButton(){this.options.closeButton&&(this._closeButton=T.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const b=this._container.querySelector(Au);b&&b.focus()}},u.RasterDEMTileSource=hn,u.RasterTileSource=Kt,u.ScaleControl=class{constructor(b){this._onMove=()=>{ec(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,ec(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Ps),b)}getDefaultPosition(){return"bottom-left"}onAdd(b){return this._map=b,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-scale",b.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){T.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},u.ScrollZoomHandler=ts,u.Style=tu,u.TerrainControl=class{constructor(b){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=b}onAdd(b){return this._map=b,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=T.create("button","maplibregl-ctrl-terrain",this._container),T.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(){T.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},u.TwoFingersTouchPitchHandler=Ha,u.TwoFingersTouchRotateHandler=Td,u.TwoFingersTouchZoomHandler=Ed,u.TwoFingersTouchZoomRotateHandler=Ad,u.VectorTileSource=Ss,u.VideoSource=Dr,u.addSourceType=(b,s)=>l._(void 0,void 0,void 0,function*(){if(Cs(b))throw new Error(`A source type called "${b}" already exists.`);((d,f)=>{Es[d]=f})(b,s)}),u.clearPrewarmedResources=function(){const b=Te;b&&(b.isPreloaded()&&b.numActive()===1?(b.release(Wn),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 jn.workerCount},u.getWorkerUrl=function(){return l.a.WORKER_URL},u.importScriptInWorkers=function(b){return Bt().broadcast("IS",b)},u.prewarm=function(){Xe().acquire(Wn)},u.setMaxParallelImageRequests=function(b){l.a.MAX_PARALLEL_IMAGE_REQUESTS=b},u.setRTLTextPlugin=function(b,s){return zr().setRTLTextPlugin(b,s)},u.setWorkerCount=function(b){jn.workerCount=b},u.setWorkerUrl=function(b){l.a.WORKER_URL=b}});var a=n;return a})})(V1);var Nz=V1.exports;const Bz=Rz(Nz),Rp=["#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"],Er={};async function Lp(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 Vz(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)}`}Er.point=async(t={},e={},n=null)=>{var E,T,I,z,F,j,Z,ie,le,J,Ee,be;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=((T=t.style)==null?void 0:T.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=((z=t.style)==null?void 0:z.color)||"blue";!((F=t.style)!=null&&F.iconAttr)&&(r!=null&&r.includes("{{marker}}"))&&(r=r.replace("{{marker}}","fa-star"));const g="gray",_=(Ae,Le)=>`${Ae==null?void 0:Ae.split("+")[0]}+${Le.replace("#","")}.png`;if(t.legendAuto={icon:[],color:[]},(j=t.style)!=null&&j.iconAttr&&r){const Ae=(ie=(Z=t.meta)==null?void 0:Z.columns)==null?void 0:ie.find(Pe=>{var Ye;return Pe.name===((Ye=t==null?void 0:t.style)==null?void 0:Ye.iconAttr)}),Le=(Ae==null?void 0:Ae.values)||await xt.get(`/api-user/gis-ir/${t.id}/${(le=t.style)==null?void 0:le.iconAttr}`).then(Pe=>Pe.data.rows);if(Le!=null&&Le.length){const Pe=r.replace("{{color}}",l.length?l:Vz(l)||[0]).split("+")[1].split(/[.-]/)[0];Le.forEach((Ye,it)=>{var Nt;return Ye.icon=(Nt=Ye.icon)!=null&&Nt.includes("png")?Ye.icon:`${a}-${u}-${Ye.data||Ye.icon||`ub-${it}`}+${r!=null&&r.includes("circle")?"ddd-222":Pe}.png`}),r=r!=null&&r.includes("{{")?`${a}-${u}-fa-question+0c53ad.png`:r,t.legendAuto.iconText=(Ae==null?void 0:Ae.title)||t.style.iconAttr,Le.forEach(Ye=>t.legendAuto.icon.push(Ye)),t.legendAuto.icon.push({icon:r,text:"Не визначено"}),t.style.iconArr=["match",["get",t.style.iconAttr]].concat(Le.filter(Ye=>Ye.id).reduce((Ye,it)=>Ye.concat([it.id,it.icon]),[])).concat([r]),await Promise.all(Le.map(Ye=>Ye.icon).map(Ye=>Lp(Ye,n))),await Lp(r,n)}else r=i?"pin6-m-fa-star+{{color}}.png":`pin6-m-fa-star+${l==null?void 0:l.replace("#","")}.png`}if(r!=null&&r.includes("{{color}}")?r=r.replace("{{color}}","222"):e!=null&&e.icon&&e.iconAttr,i){const Ae=(Ee=(J=t.meta)==null?void 0:J.columns)==null?void 0:Ee.find(Pe=>Pe.name===i),Le=(Ae==null?void 0:Ae.values)||await xt.get(`/api-user/gis-ir/${t.id}/${i}`).then(Pe=>Pe.data.rows);t.style.color=Le!=null&&Le.length?["match",["get",i]].concat(Le.filter(Pe=>Pe.id).reduce((Pe,Ye,it)=>Pe.concat([Ye.id,Ye.color||Rp[it]]),[])).concat(["#aaa"]):l,t.style.colorArr=t.style.color,t.legendAuto.colorText=(Ae==null?void 0:Ae.title)||i,Le.forEach(Pe=>t.legendAuto.color.push(Pe)),t.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),!((be=t.style)!=null&&be.iconAttr)&&!(r!=null&&r.includes("+sdf"))&&r&&(Le.forEach((Pe,Ye)=>Pe.icon=_(r,Pe.color||Rp[Ye])),t.style.iconArr=["match",["get",i]].concat(Le.filter(Pe=>Pe.id).reduce((Pe,Ye)=>Pe.concat([Ye.id,Ye.icon]),[])).concat([_(r,g)]),await Promise.all(Le.map(Pe=>Pe.icon).map(Pe=>Lp(Pe,n))))}if(r&&!(r!=null&&r.includes("{"))){const Ae=e!=null&&e.colorAttr?_(r,g):r;await Lp(Ae,n)}const S=r!=null&&r.includes("sdf")?["interpolate",["linear"],["zoom"],14,.1,18,.2]:["interpolate",["linear"],["zoom"],14,.7,16,1];return e.iconOffset=r!=null&&r.includes("pin")?[0,r!=null&&r.includes("+sdf")?-96:-20]:null,[{id:`${t.id}`,source:t.id,type:"circle",cluster:!0,lsource:e==null?void 0:e.lsource,minzoom:(e==null?void 0:e.minzoom)!==void 0?+(e==null?void 0:e.minzoom):4,maxzoom:(r!=null&&r.includes("+sdf")||!(r!=null&&r.includes("circle"))&&!(r!=null&&r.includes("none"))?+e.iconZoom:null)||+(e==null?void 0:e.maxzoom)||24,filter:["all",["==",["geometry-type"],"Point"],["!",["has","point_count"]]],paint:{"circle-stroke-width":["case",["boolean",["feature-state","select"],!1],(e==null?void 0:e.strokeWidth)||1,["boolean",["feature-state","hover"],!1],2,(e==null?void 0:e.strokeWidth)||1],"circle-stroke-color":["case",["boolean",["feature-state","select"],!1],(e==null?void 0:e.stroke)||(e==null?void 0:e.color)||"#fff",["boolean",["feature-state","hover"],!1],"maroon",(e==null?void 0:e.stroke)||(e==null?void 0:e.color)||"#fff"],"circle-opacity":(e.iconZoom?["interpolate",["exponential",.5],["zoom"],+e.iconZoom-1,1,+e.iconZoom,r!=null&&r.includes("none")?.3:0]:null)||e.opacity||1,"circle-color":e.color||["case",["boolean",["feature-state","hover"],!1],"red","blue"],"circle-radius":(Array.isArray(e.width)?{stops:e.width}:null)||e.width||{stops:e.iconZoom?[[+e.iconZoom,4],[+e.iconZoom,8],[18,16]]:[[13,4],[15,8],[18,12]]}}}].concat(e.iconArr||e.icon?[{id:`${t.id}-5`,source:t.id,lsource:e==null?void 0:e.lsource,type:"symbol",minzoom:+e.iconZoom||16,filter:["all",["!",["has","point_count"]]],layout:{"icon-image":e!=null&&e.colorAttr&&e.iconArr||r,"icon-allow-overlap":!0,...e.iconOffset?{"icon-offset":e.iconOffset||!1}:{},...S?{"icon-size":S||!1}:{}},paint:{"icon-opacity":["case",["boolean",["feature-state","hover"],!1],.5,["boolean",["feature-state","select"],!1],.5,(r!=null&&r.includes("+sdf")?1:null)||(r!=null&&r.includes("circle")?.6:1)],...r!=null&&r.includes("+sdf")?{"icon-color":["case",["boolean",["feature-state","hover"],!1],"#cd0bbf",["boolean",["feature-state","select"],!1],"#8517cf",e.color||"#aa0000"]}:{}}}]:[]).concat(e.label?[{id:`${t.id}-4`,source:t.id,lsource:e==null?void 0:e.lsource,type:"symbol",minzoom:14,filter:["!",["has","point_count"]],layout:{"text-field":e.label,"text-font":["Open Sans Regular"],"text-size":e["text-size"]||8},paint:{"text-color":e["text-color"]||"#ffffff","text-halo-color":e["text-halo-color"]||"black"}}]:[]).concat(t.cluster||e.clusterMaxZoom?[{id:`${t.id}-1`,source:t.id,lsource:e==null?void 0:e.lsource,type:"circle",filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],"#51bbd6",100,"#f1f075",750,"#f28cb1"],"circle-radius":["step",["get","point_count"],20,100,30,750,40]}},{id:`${t.id}-2`,source:t.id,lsource:e==null?void 0:e.lsource,type:"symbol",filter:["has","point_count"],layout:{"text-field":"{point_count_abbreviated}","text-font":["Open Sans Regular"],"text-size":12}}]:[])},Er.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"}}],Er.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 _=((l=(u=t.meta)==null?void 0:u.columns.find(S=>S.name===i))==null?void 0:l.values)||await xt.get(`/api-user/gis-ir/${t.id}/${i}`).then(S=>S.data.rows);t.legendAuto={color:[]},_.forEach(S=>t.legendAuto.color.push(S)),t.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),t.style.color=_?["match",["get",i]].concat(_.filter(S=>S.id).reduce((S,E,T)=>S.concat([E.id,E.color||Rp[T]]),[])).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]}}]:[])},Er.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}}]:[]),Er.linestring=Er.line,Er.circle=Er.point;async function Fz(t,e,n){var l,g,_,S,E,T,I,z,F,j,Z,ie;typeof e.style=="string"&&(e.style=e.style[0]==="{"?JSON.parse(e.style):(l=window.YAML.parse(e.style))==null?void 0:l.style),(_=(g=e.style)==null?void 0:g.filter)==null||_.call(g,le=>le.source).forEach(le=>{le.lsource=`${e.id}-${le.source}`});const i=((S=e==null?void 0:e.style)==null?void 0:S.type)||((Z=((I=(T=(E=e==null?void 0:e.meta)==null?void 0:E.geom)==null?void 0:T.geometry)==null?void 0:I.length)>2?["point"]:[((j=(F=(z=e==null?void 0:e.meta)==null?void 0:z.geom)==null?void 0:F.geometry)==null?void 0:j[0].toLowerCase())||"point"])==null?void 0:Z.map(le=>{var J;return(J=le==null?void 0:le.replace)==null?void 0:J.call(le,"multi","")})),r=Array.isArray(i)?i:[i],a=(await Promise.all(Array.isArray(e==null?void 0:e.style)?e.style.map(async le=>{var J;return(J=Er[le.type])==null?void 0:J.call(Er,e,le,n)}):r.map(async le=>{var J;return(J=Er[le])==null?void 0:J.call(Er,e,e.style,n)}))).reduce((le,J)=>J?le.concat(J):le,[]);a.forEach((le,J)=>{le.id=`${le.id}-${J}`});const u=a;return(e.service==="vtile"||(ie=e.url)!=null&&ie.includes(".vmt"))&&u.forEach(le=>{le.layout||(le.layout={}),le.layout.visibility="visible",le["source-layer"]=le.lsource||e.data||t}),u}const $z={data(){return{layerList:[],layerObj:{},colors:Rp,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(_=>_.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(_=>_.id===l.id?{..._,visible:e}:_),g.forEach(_=>{a.setLayoutProperty(_.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 xt.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 xt.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,_,S,E;const{map:i}=this,r=await Fz(t.id,this.layerList.find(T=>T.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}`:""}${(_=t==null?void 0:t.style)!=null&&_.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(T=>{var z;const I={...T,source:t.id,maxzoom:+(T==null?void 0:T.maxzoom)||24,minzoom:+(T==null?void 0:T.minzoom)||0,cluster:!1,clusterMaxZoom:2};i.addLayer(I),i.moveLayer(T.id),(z=T==null?void 0:T.layout)!=null&&z["text-field"]||this.apiLayersHover(T.id,t.id,i),this.addedLayersSettings=this.addedLayersSettings.concat(I)});const u=r.map(T=>T.type).filter(T=>T&&T!=="symbol");(E=(S=t==null?void 0:t.meta)==null?void 0:S.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 xt.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 xt.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)}}},jz={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}}},Uz={key:0,class:"vsTailwind map-popup__vertical"},Hz={class:"mb-1"},qz={class:"text-sm"},Wz={key:1,class:"map__popup-body"},Gz=["innerHTML"],Zz={key:1};function Yz(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("div",{class:"map-popup",style:v.normalizeStyle({"max-width":a.popupWidth,width:a.popupWidth})},[a.positionIsVertical?(v.openBlock(),v.createElementBlock("div",Uz,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(a.popupRows,u=>(v.openBlock(),v.createElementBlock("div",{class:"border-b py-1 last:border-none last:pt-1 last:pb-0",key:a.rowTitle(u)},[v.createElementVNode("strong",Hz,v.toDisplayString(a.rowTitle(u)),1),v.createElementVNode("div",qz,v.toDisplayString(a.rowValue(u)),1)]))),128))])):(v.openBlock(),v.createElementBlock("table",Wz,[v.createElementVNode("tbody",null,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(a.popupRows,u=>v.withDirectives((v.openBlock(),v.createElementBlock("tr",{key:a.rowTitle(u),class:"map__popup-body-item"},[v.createElementVNode("td",null,v.toDisplayString(a.rowTitle(u)),1),a.rowValue(u)?(v.openBlock(),v.createElementBlock("td",{key:0,innerHTML:a.rowValue(u)},null,8,Gz)):(v.openBlock(),v.createElementBlock("td",Zz,e[0]||(e[0]=[v.createElementVNode("div",{class:"text-red-500"}," Не визначено ",-1)])))])),[[v.vShow,!a.rowValue(u).includes("id")]])),128))])]))],4)}const Xz=at(jz,[["render",Yz],["__scopeId","data-v-14698eb6"]]),F1={width:200,show:!0,position:"horizontal"},Kz={components:{VsPopupBody:Xz},props:{aviableFields:{type:Array,default:()=>[]},mapRef:{type:[Object,Array],default:()=>{}},object:{type:[Object,Array],default:()=>{}}},data(){return{objectData:[],popupSettings:F1}},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,_,S,E,T,I;if(!t)return;const e=Object.keys(t.properties).filter(z=>!z.match("__text")&&!["id"].includes(z)),{currentLayer:n}=this;if((g=n==null?void 0:n.setting)!=null&&g.popup&&(this.popupSettings=(n==null?void 0:n.setting.popup)||F1),!(n!=null&&n.meta)){const z=e.map(F=>({title:F,value:t.properties[F]}));this.objectData=[...z,{value:((_=t.properties)==null?void 0:_.image)||"",title:"Фото",column:"image"}];return}const i=n.meta.columns,r=e.map(z=>{var le,J,Ee,be;const F={},Z=Object.assign({values:[]},i.find(Ae=>Ae.name===z));typeof Z.values!="object"&&console.warn(`Warning: Layer ${t.source} has key "values" which is not an object in meta!`);const ie=Z!=null&&Z.values&&((le=Z==null?void 0:Z.values)==null?void 0:le.find(Ae=>(Ae==null?void 0:Ae.id)==t.properties[z]))||null;return F.value=(Z==null?void 0:Z.format)==="select"?this.formatBadge({text:(ie==null?void 0:ie.text)||((J=t.properties)==null?void 0:J[`${z}__text`])||((Ee=t.properties)==null?void 0:Ee[z])||"-",color:(ie==null?void 0:ie.color)||"#1989FA"}):(ie==null?void 0:ie.text)||((be=t.properties)==null?void 0:be[`${z}__text`])||t.properties[z],F.column=z,F.title=(Z==null?void 0:Z[window==null?void 0:window.lang])||(Z==null?void 0:Z.ua)||(Z==null?void 0:Z.title)||z,F});this.objectData=[...r,{value:((S=t.properties)==null?void 0:S.image)||"",title:"Фото",column:"image"}];const a=(T=(E=n==null?void 0:n.setting)==null?void 0:E.popup)==null?void 0:T.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(z=>l.includes(z.column)||l.includes(z.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}}},Jz={key:0},Qz={key:0},eR=["src","alt"],tR={key:1},nR={class:"text-left text-sm m-b-sm"},iR={key:1,class:"text-center"};function rR(t,e,n,i,r,a){var l,g,_,S,E,T,I,z,F,j,Z;const u=v.resolveComponent("VsPopupBody");return v.openBlock(),v.createElementBlock("div",{class:v.normalizeClass((((l=r.popupSettings)==null?void 0:l.position)||"horizontal")+"-position")},[r.objectData.filter(ie=>ie.column!=="image").length?(v.openBlock(),v.createElementBlock("div",Jz,[a.getImage&&((g=a.getImage)!=null&&g.value)?(v.openBlock(),v.createElementBlock("div",Qz,[v.createElementVNode("img",{class:"popup-image",src:"files/"+a.getImage.value,alt:a.getImage.column},null,8,eR)])):v.createCommentVNode("",!0),v.createVNode(u,{"object-data":r.objectData,object:n.object,mapRef:n.mapRef},null,8,["object-data","object","mapRef"])])):(v.openBlock(),v.createElementBlock("div",tR,[(_=a.noInfoObject())!=null&&_.column?(v.openBlock(),v.createElementBlock(v.Fragment,{key:0},[v.createElementVNode("b",nR,v.toDisplayString(a.noInfoObject().title),1),v.createElementVNode("div",null,[v.createElementVNode("b",null,v.toDisplayString(((E=(S=a.noInfoObject())==null?void 0:S.column)==null?void 0:E.ua)||((I=(T=a.noInfoObject())==null?void 0:T.column)==null?void 0:I.title))+":",1),v.createTextVNode(" "+v.toDisplayString(((Z=(z=n.object)==null?void 0:z.properties)==null?void 0:Z[(j=(F=a.noInfoObject())==null?void 0:F.column)==null?void 0:j.name])||"-"),1)])],64)):(v.openBlock(),v.createElementBlock("div",iR,v.toDisplayString(a.noInfoObject().title),1))]))],2)}const sR=at(Kz,[["render",rR],["__scopeId","data-v-180f4367"]]),{Map:oR,NavigationControl:aR,Popup:lR}=Bz,cR={mixins:[$z],components:{VsMapPopup:sR},props:{popupVisible:{type:Boolean,default:()=>!0},map:{type:Object,default:()=>null},height:{type:String,default:()=>"400px"}},data(){var t,e,n,i;return{mapId:`gis-map-${Math.floor(Math.random()*1e3)}`,features:[],katottg:((e=(t=window==null?void 0:window.setting)==null?void 0:t.map)==null?void 0:e.katottg)||((i=(n=window==null?void 0:window.setting)==null?void 0:n.map)==null?void 0:i.city_katottg),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 oR({container:this.mapId,style:t,center:[0,0],zoom:1,interactive:!0});e.addControl(new aR({visualizePitch:!0})),window==null||window.addEventListener("resize",()=>{e.resize()}),e.on("load",this.onMapLoad)},async onMapLoad(t){const e=t.target;e.resize();const n={id:"graymap",name:"Сіра карта",url:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",attribution:"© <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, © <a href='https://carto.com/attributions'>CARTO</a>",bounds1:"ua",image:"https://basemaps.cartocdn.com/light_all/10/601/348.png",position:0,owner:"OSM",basemap:!0};await this.$emit("update:map",e),await this.setVisible(n,!0),this.$emit("load",e),this.createPopup(),this.createBoundsLayers(),this.createAtuLayer()},createPopup(){var n,i,r,a,u,l;const{map:t}=this,e=["measure","katottg","geometry","mapbox-gl-draw-hot","mapbox-gl-draw-cold"];this.popup.map=new lR({closeOnClick:!1}).setDOMContent((i=(n=this==null?void 0:this.$refs)==null?void 0:n.popup)==null?void 0:i.$el),t&&(t.on("mousemove",g=>{var S,E;const _=t.queryRenderedFeatures(g.point).filter(T=>{var F,j,Z;const I=this.layerList.find(ie=>ie.id===T.source),z=((j=(F=I==null?void 0:I.setting)==null?void 0:F.popup)==null?void 0:j.show)===void 0?!0:I.setting.popup.show;if((this.interactiveSources.includes(T.source)&&!((Z=T.properties)!=null&&Z.cluster)&&z||!I&&Object.keys(T.properties).length)&&!e.includes(T.source))return T}).filter(T=>{var I,z;return!((z=(I=T.layer)==null?void 0:I.layout)!=null&&z["text-field"])});_.length&&this.popupVisible?(this.features=(_==null?void 0:_[0])||null,(S=this.popup.map)==null||S.setLngLat(Object.values(g.lngLat)).addTo(t),t.getCanvas().style.cursor=_.length?"pointer":"grab"):(this.features=null,(E=this.popup.map)==null||E.remove()),this.$emit("mouseMove",{event:g,features:_})}),t.on("touchend",this.handleMapClick),t.on("click",this.handleMapClick),t.on("dblclick",g=>{const _=t.queryRenderedFeatures(g.point);this.$emit("dbclick",{features:_,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})},async createAtuLayer(){try{const t=this.katottg,{map:e}=this;if(!e){console.warn("Map error: Map hasn't loaded");return}const{data:n}=await xt.get(`https://data.gki.com.ua/api-user/atu/${t}`),i=N1(n);this.cityBbox=i,e.addSource("atu",{type:"geojson",data:n}),e.addLayer({id:"atu",type:"line",source:"atu",paint:{"line-color":"#3b82f6","line-width":2}})}catch(t){console.error(t)}}}},uR={class:"relative"},hR=["id"];function dR(t,e,n,i,r,a){const u=v.resolveComponent("VsMapPopup");return v.openBlock(),v.createElementBlock("div",uR,[v.createElementVNode("div",{id:r.mapId,style:v.normalizeStyle({height:n.height})},null,12,hR),v.createVNode(u,{ref:"popup",object:r.features,"map-ref":a.mapRef},null,8,["object","map-ref"])])}const pR=at(cR,[["render",dR]]),Qs="widget-map-source",fR={components:{VsMap:pR},props:{geometry:{type:Object,default:()=>null},zoom:{type:String,default:()=>"50"}},data(){return{map:null}},mounted(){this.geometry&&this.initGeometryLayer()},watch:{geometry(){console.log(this.zoom),this.initGeometryLayer()}},methods:{initMap(){this.geometry&&this.map&&this.initGeometryLayer()},handleMapLoad(){this.initMap()},initGeometryLayer(){const{map:t}=this;if(!t)return;const e=this.formatGeojson(this.geometry),n=t.getSource(Qs);if(this.zoomToGeometry(e),n){n.setData(e);return}t.addSource(Qs,{type:"geojson",data:e}),t.addLayer({id:`${Qs}-point`,type:"circle",source:Qs,paint:{"circle-radius":10,"circle-color":"#F84C4C"},filter:["==","$type","Point"]}),t.addLayer({id:`${Qs}-polygon`,type:"fill",source:Qs,layout:{},paint:{"fill-color":"#0080ff","fill-opacity":.5},filter:["==","$type","Polygon"]}),t.addLayer({id:`${Qs}-polygon-line`,type:"line",source:Qs,layout:{},paint:{"line-color":"#0080ff","line-width":2},filter:["==","$type","Polygon"]}),t.addLayer({id:`${Qs}-line`,type:"line",source:Qs,layout:{},paint:{"line-color":"#0080ff","line-width":3},filter:["==","$type","LineString"]})},formatGeojson(t){let e=t;const n=t==null?void 0:t.type;if(Array.isArray(t))return B1(t);if(!n)throw new Error("Unknown geometry type!");return n==="FeatureCollection"?t:(n==="Feature"&&(e=[t]),!["FeatureCollection","Feature"].includes(n)&&(e=[Lz(t)]),B1(e))},zoomToGeometry(t){const{map:e}=this,n=N1(t);e.fitBounds(n,{zoom:this.zoom,padding:30,duration:0})}}};function mR(t,e,n,i,r,a){const u=v.resolveComponent("VsMap");return v.openBlock(),v.createElementBlock("div",null,[v.createVNode(u,{map:r.map,"onUpdate:map":e[0]||(e[0]=l=>r.map=l),onLoad:a.handleMapLoad},null,8,["map","onLoad"])])}const gR=at(fR,[["render",mR]]),st=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),iy=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},Np=function(t,e=void 0){return!(!t||t===document.body||e&&t===e)&&(iy(t)?t:Np(t.parentElement,e))},eo=function(t){var e=new DOMParser().parseFromString(t,"text/html").body;if(e.childElementCount>1){for(var n=document.createElement("div");e.firstChild;)n.appendChild(e.firstChild);return n}return e.firstChild},ry=t=>`${t||""}`.split(" ").filter(e=>!!e),to=(t,e,n)=>{t&&ry(e).forEach(i=>{t.classList.toggle(i,n||!1)})};class Sc{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 Ec={passive:!1};class yR{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,Ec),this.element.addEventListener("touchstart",this.onTouchStart,Ec),this.element.addEventListener("touchmove",this.onMove,Ec),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd)}onPointerStart(e){if(!e.buttons||e.button!==0)return;const n=new Sc(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 Sc(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 Sc(a)):[new Sc(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 Sc(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 Sc(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,Ec),this.element.removeEventListener("touchstart",this.onTouchStart,Ec),this.element.removeEventListener("touchmove",this.onMove,Ec),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 $1(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function j1(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const sy=t=>typeof t=="object"&&t!==null&&t.constructor===Object&&Object.prototype.toString.call(t)==="[object Object]",Cr=(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}),sy(u)?Object.assign(t[a],Cr(l,u)):Array.isArray(u)?Object.assign(t,{[a]:[...u]}):Object.assign(t,{[a]:u})})}return t},oy=function(t,e){return t.split(".").reduce((n,i)=>typeof n=="object"?n[i]:void 0,e)};class Bp{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?Cr({},this.constructor.defaults,e):{};for(const[n,i]of Object.entries(this.option("on")||{}))this.on(n,i)}option(e,...n){let i=oy(e,this.options);return i&&typeof i=="function"&&(i=i.call(this,this,...n)),i}optionFor(e,n,i,...r){let a=oy(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=oy(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(Bp,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(Bp,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class ay extends Bp{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 An;(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"})(An||(An={}));const Po=["a","b","c","d","e","f"],U1={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"},_R={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:U1},H1='<circle cx="25" cy="25" r="20"></circle>',ly='<div class="f-spinner"><svg viewBox="0 0 50 50">'+H1+H1+"</svg></div>",Tr=t=>t&&t!==null&&t instanceof Element&&"nodeType"in t,kn=(t,e)=>{t&&ry(e).forEach(n=>{t.classList.remove(n)})},Ct=(t,e)=>{t&&ry(e).forEach(n=>{t.classList.add(n)})},Vp={a:1,b:0,c:0,d:1,e:0,f:0},xR=1e5,Fp=1e4,ps="mousemove",q1="drag",W1="content",fs="auto";let cy=null,uy=null;class ua extends ay{get fits(){return this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1}get isTouchDevice(){return uy===null&&(uy=window.matchMedia("(hover: none)").matches),uy}get isMobile(){return cy===null&&(cy=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),cy}get panMode(){return this.options.panMode!==ps||this.isTouchDevice?q1:ps}get panOnlyZoomed(){const e=this.options.panOnlyZoomed;return e===fs?this.isTouchDevice:e}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:e,b:n}=this.current;return Math.sqrt(e*e+n*n)||1}get targetScale(){const{a:e,b:n}=this.target;return Math.sqrt(e*e+n*n)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:e}=this;return e.fullWidth/e.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:e,contentRect:n}=this,i=Math.max(e.height/n.fitHeight,e.width/n.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const e=this.content;return!!(e&&e instanceof HTMLImageElement)&&!e.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const e of Po){const n=e=="e"||e==="f"?1e-4:1e-5;if(Math.abs(this.target[e]-this.current[e])>n)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(e,n={},i={}){var r;if(super(n),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pwt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"cwd",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"pmme",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:An.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({},Vp)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},Vp)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!e)throw new Error("Container Element Not Found");this.container=e,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},ua.Plugins),i)),this.emit("attachPlugins"),this.emit("init");const a=this.content;if(a.addEventListener("load",this.onLoad),a.addEventListener("error",this.onError),this.isContentLoading){if(this.option("spinner")){e.classList.add(this.cn("isLoading"));const u=eo(ly);!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(W1);let i=this.option(W1)||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===An.Init?this.enable():this.updateMetrics()}onError(){this.state!==An.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=An.Error,this.emit("error"))}getNextScale(e){const{fullScale:n,targetScale:i,coverScale:r,maxScale:a,minScale:u}=this;let l=u;switch(e){case"toggleMax":l=i-u<.5*(a-u)?a:u;break;case"toggleCover":l=i-u<.5*(r-u)?r:u;break;case"toggleZoom":l=i-u<.5*(n-u)?n:u;break;case"iterateZoom":let g=[1,n,a].sort((S,E)=>S-E),_=g.findIndex(S=>S>i+1e-5);l=g[_]||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 yR(e,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener(ps,this.onMouseMove)}detachEvents(){var e;const{container:n}=this;n.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),n.removeEventListener("wheel",this.onWheel,{passive:!1}),(e=this.pointerTracker)===null||e===void 0||e.stop(),this.pointerTracker=null,document.removeEventListener(ps,this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const e=this.friction,n=this.option("maxVelocity");for(const i of Po)e?(this.velocity[i]*=1-e,n&&!this.isScaling&&(this.velocity[i]=Math.max(Math.min(this.velocity[i],n),-1*n)),this.current[i]+=this.velocity[i]):this.current[i]=this.target[i];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame(()=>this.animate()):this.stop("current")}setTargetForce(){for(const e of Po)e==="e"&&this.isBouncingX||e==="f"&&this.isBouncingY||(this.velocity[e]=(1/(1-this.friction)-1)*(this.target[e]-this.current[e]))}checkBounds(e=0,n=0){const{current:i}=this,r=i.e+e,a=i.f+n,u=this.getBounds(),{x:l,y:g}=u,_=l.min,S=l.max,E=g.min,T=g.max;let I=0,z=0;return _!==1/0&&r<_?I=_-r:S!==1/0&&r>S&&(I=S-r),E!==1/0&&a<E?z=E-a:T!==1/0&&a>T&&(z=T-a),Math.abs(I)<1e-4&&(I=0),Math.abs(z)<1e-4&&(z=0),Object.assign(Object.assign({},u),{xDiff:I,yDiff:z,inBounds:!I&&!z})}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,_=l;if(this.option("zoom")||this.angle!==0){const S=!(n instanceof HTMLImageElement)&&(window.getComputedStyle(n).maxWidth==="none"||window.getComputedStyle(n).maxHeight==="none"),E=S?u:r,T=S?l:a,I=this.getMatrix(e),z=new DOMPoint(0,0).matrixTransform(I),F=new DOMPoint(0+E,0).matrixTransform(I),j=new DOMPoint(0+E,0+T).matrixTransform(I),Z=new DOMPoint(0,0+T).matrixTransform(I),ie=Math.abs(j.x-z.x),le=Math.abs(j.y-z.y),J=Math.abs(Z.x-F.x),Ee=Math.abs(Z.y-F.y);g=Math.max(ie,J),_=Math.max(le,Ee)}return{contentWidth:g,contentHeight:_}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||this.panMode===ps||this.targetScale<this.scale)return this.isBouncingX=!1,void(this.isBouncingY=!1);const{target:e}=this,{x:n,y:i,xDiff:r,yDiff:a}=this.checkBounds(),u=this.option("maxVelocity");let l=this.velocity.e,g=this.velocity.f;r!==0?(this.isBouncingX=!0,r*l<=0?l+=.14*r:(l=.14*r,n.min!==1/0&&(this.target.e=Math.max(e.e,n.min)),n.max!==1/0&&(this.target.e=Math.min(e.e,n.max))),u&&(l=Math.max(Math.min(l,u),-1*u))):this.isBouncingX=!1,a!==0?(this.isBouncingY=!0,a*g<=0?g+=.14*a:(g=.14*a,i.min!==1/0&&(this.target.f=Math.max(e.f,i.min)),i.max!==1/0&&(this.target.f=Math.min(e.f,i.max))),u&&(g=Math.max(Math.min(g,u),-1*u))):this.isBouncingY=!1,this.isBouncingX&&(this.velocity.e=l),this.isBouncingY&&(this.velocity.f=g)}enable(){const{content:e}=this,n=new DOMMatrixReadOnly(window.getComputedStyle(e).transform);for(const i of Po)this.current[i]=this.target[i]=n[i];this.updateMetrics(),this.attachObserver(),this.attachEvents(),this.state=An.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&&Tr(u)?u.dataset:null;if(l){const I=l.panzoomChange,z=l.panzoomAction;if((I||z)&&e.preventDefault(),I){let F={};try{F=JSON.parse(I)}catch{console&&console.warn("The given data was not valid JSON")}return void this.applyChange(F)}if(z)return void(this[z]&&this[z]())}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(),_=this.dragStart;if(_.time&&!this.canZoomOut()&&(Math.abs(g.x-_.x)>2||Math.abs(g.y-_.y)>2))return;this.dragStart.time=0;const S=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),T=this.option("dblClick",e);T?(this.clicks++,this.clicks==1&&(this.clickTimer=setTimeout(()=>{this.clicks===1?(this.emit("click",e),!e.defaultPrevented&&E&&S(E)):(this.emit("dblClick",e),e.defaultPrevented||S(T)),this.clicks=0,this.clickTimer=null},350))):(this.emit("click",e),!e.defaultPrevented&&E&&S(E))}addTrackingPoint(e){const n=this.trackingPoints.filter(i=>i.time>Date.now()-100);n.push(e),this.trackingPoints=n}onPointerDown(e,n,i){var r;if(this.option("touch",e)===!1)return!1;this.pwt=0,this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const a=this.content.getBoundingClientRect();if(this.dragStart={x:a.x,y:a.y,top:a.top,left:a.left,time:Date.now()},this.clickTimer)return!1;if(this.panMode===ps&&this.targetScale>1)return e.preventDefault(),e.stopPropagation(),!1;const u=e.composedPath()[0];if(!i.length){if(["TEXTAREA","OPTION","INPUT","SELECT","VIDEO","IFRAME"].includes(u.nodeName)||u.closest("[contenteditable],[data-selectable],[data-draggable],[data-clickable],[data-panzoom-change],[data-panzoom-action]"))return!1;(r=window.getSelection())===null||r===void 0||r.removeAllRanges()}if(e.type==="mousedown")["A","BUTTON"].includes(u.nodeName)||e.preventDefault();else if(Math.abs(this.velocity.a)>.3)return!1;return this.target.e=this.current.e,this.target.f=this.current.f,this.stop(),this.isDragging||(this.isDragging=!0,this.addTrackingPoint(n),this.emit("touchStart",e)),!0}onPointerMove(e,n,i){if(this.option("touch",e)===!1||!this.isDragging||n.length<2&&this.panOnlyZoomed&&st(this.targetScale)<=st(this.minScale)||(this.emit("touchMove",e),e.defaultPrevented))return;this.addTrackingPoint(n[0]);const{content:r}=this,a=j1(i[0],i[1]),u=j1(n[0],n[1]);let l=0,g=0;if(n.length>1){const le=r.getBoundingClientRect();l=a.clientX-le.left-.5*le.width,g=a.clientY-le.top-.5*le.height}const _=$1(i[0],i[1]),S=$1(n[0],n[1]);let E=_?S/_:1,T=u.clientX-a.clientX,I=u.clientY-a.clientY;this.dragOffset.x+=T,this.dragOffset.y+=I,this.dragOffset.time=Date.now()-this.dragStart.time;let z=st(this.targetScale)===st(this.minScale)&&this.option("lockAxis");if(z&&!this.lockedAxis)if(z==="xy"||z==="y"||e.type==="touchmove"){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void e.preventDefault();const le=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=le>45&&le<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,T=0,I=0}else this.lockedAxis=z;if(Np(e.target,this.content)&&(z="x",this.dragOffset.y=0),z&&z!=="xy"&&this.lockedAxis!==z&&st(this.targetScale)===st(this.minScale))return;e.cancelable&&e.preventDefault(),this.container.classList.add(this.cn("isDragging"));const F=this.checkBounds(T,I);this.option("rubberband")?(this.isInfinite!=="x"&&(F.xDiff>0&&T<0||F.xDiff<0&&T>0)&&(T*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*F.xDiff))),this.isInfinite!=="y"&&(F.yDiff>0&&I<0||F.yDiff<0&&I>0)&&(I*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*F.yDiff)))):(F.xDiff&&(T=0),F.yDiff&&(I=0));const j=this.targetScale,Z=this.minScale,ie=this.maxScale;j<.5*Z&&(E=Math.max(E,Z)),j>1.5*ie&&(E=Math.min(E,ie)),this.lockedAxis==="y"&&st(j)===st(Z)&&(T=0),this.lockedAxis==="x"&&st(j)===st(Z)&&(I=0),this.applyChange({originX:l,originY:g,panX:T,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=[]),Np(e.target,this.content)&&this.lockedAxis==="y"&&(this.trackingPoints=[]),this.emit("touchEnd",e),this.isDragging=!1,this.lockedAxis=!1,this.state!==An.Destroy&&(e.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){var e;const n=this.isScaling;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const le of Po)this.velocity[le]=0;this.target.e=this.current.e,this.target.f=this.current.f,kn(this.container,"is-scaling"),kn(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 _=((e=window.visualViewport)===null||e===void 0?void 0:e.scale)||1;_!==1&&(u*=_,l*=_);let S=0,E=0,T=0,I=0,z=this.option("decelFriction");const F=this.targetScale;if(g>0){T=Math.abs(u)>3?u/(g/30):0,I=Math.abs(l)>3?l/(g/30):0;const le=this.option("maxVelocity");le&&(T=Math.max(Math.min(T,le),-1*le),I=Math.max(Math.min(I,le),-1*le))}T&&(S=T/(1/(1-z)-1)),I&&(E=I/(1/(1-z)-1)),(this.option("lockAxis")==="y"||this.option("lockAxis")==="xy"&&this.lockedAxis==="y"&&st(F)===this.minScale)&&(S=T=0),(this.option("lockAxis")==="x"||this.option("lockAxis")==="xy"&&this.lockedAxis==="x"&&st(F)===this.minScale)&&(E=I=0);const j=this.dragOffset.x,Z=this.dragOffset.y,ie=this.option("dragMinThreshold")||0;Math.abs(j)<ie&&Math.abs(Z)<ie&&(S=E=0,T=I=0),(this.option("zoom")&&(F<this.minScale-1e-5||F>this.maxScale+1e-5)||n&&!S&&!E)&&(z=.35),this.applyChange({panX:S,panY:E,friction:z}),this.emit("decel",T,I,j,Z)}onWheel(e){var n=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(a,u){return Math.abs(u)>Math.abs(a)?u:a});const i=Math.max(-1,Math.min(1,n));if(this.emit("wheel",e,i),this.panMode===ps||e.defaultPrevented)return;const r=this.option("wheel");r==="pan"?(e.preventDefault(),this.panOnlyZoomed&&!this.canZoomOut()||this.applyChange({panX:2*-e.deltaX,panY:2*-e.deltaY,bounce:!1})):r==="zoom"&&this.option("zoom")!==!1&&this.zoomWithWheel(e)}onMouseMove(e){this.panWithMouse(e)}onKeydown(e){e.key==="Escape"&&this.toggleFS()}onResize(){this.updateMetrics(),this.checkBounds().inBounds||this.requestTick()}setTransform(){this.emit("beforeTransform");const{current:e,target:n,content:i,contentRect:r}=this,a=Object.assign({},Vp);for(const j of Po){const Z=j=="e"||j==="f"?Fp:xR;a[j]=st(e[j],Z),Math.abs(n[j]-e[j])<(j=="e"||j==="f"?.51:.001)&&(e[j]=n[j])}let{a:u,b:l,c:g,d:_,e:S,f:E}=a,T=`matrix(${u}, ${l}, ${g}, ${_}, ${S}, ${E})`,I=i.parentElement instanceof HTMLPictureElement?i.parentElement:i;if(this.option("transformParent")&&(I=I.parentElement||I),I.style.transform===T)return;I.style.transform=T;const{contentWidth:z,contentHeight:F}=this.calculateContentDim();r.width=z,r.height=F,this.emit("afterTransform")}updateMetrics(e=!1){var n;if(!this||this.state===An.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 _=l.width*i,S=l.height*i;const E=parseFloat(g.paddingTop)+parseFloat(g.paddingBottom),T=_-(parseFloat(g.paddingLeft)+parseFloat(g.paddingRight)),I=S-E;this.containerRect={width:_,height:S,innerWidth:T,innerHeight:I};const z=parseFloat(a.dataset.width||"")||(dt=>{let Rt=0;return Rt=dt instanceof HTMLImageElement?dt.naturalWidth:dt instanceof SVGElement?dt.width.baseVal.value:Math.max(dt.offsetWidth,dt.scrollWidth),Rt||0})(a),F=parseFloat(a.dataset.height||"")||(dt=>{let Rt=0;return Rt=dt instanceof HTMLImageElement?dt.naturalHeight:dt instanceof SVGElement?dt.height.baseVal.value:Math.max(dt.offsetHeight,dt.scrollHeight),Rt||0})(a);let j=this.option("width",z)||fs,Z=this.option("height",F)||fs;const ie=j===fs,le=Z===fs;typeof j!="number"&&(j=z),typeof Z!="number"&&(Z=F),ie&&(j=z*(Z/F)),le&&(Z=F/(z/j));let J=a.parentElement instanceof HTMLPictureElement?a.parentElement:a;this.option("transformParent")&&(J=J.parentElement||J);const Ee=J.getAttribute("style")||"";J.style.setProperty("transform","none","important"),u&&(J.style.width="",J.style.height=""),J.offsetHeight;const be=a.getBoundingClientRect();let Ae=be.width*i,Le=be.height*i,Pe=Ae,Ye=Le;Ae=Math.min(Ae,j),Le=Math.min(Le,Z),u?{width:Ae,height:Le}=((dt,Rt,Xt,nn)=>{const jt=Xt/dt,Tt=nn/Rt,Sn=Math.min(jt,Tt);return{width:dt*=Sn,height:Rt*=Sn}})(j,Z,Ae,Le):(Ae=Math.min(Ae,j),Le=Math.min(Le,Z));let it=.5*(Ye-Le),Nt=.5*(Pe-Ae);this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:be.top-l.top+it,bottom:l.bottom-be.bottom+it,left:be.left-l.left+Nt,right:l.right-be.right+Nt,fitWidth:Ae,fitHeight:Le,width:Ae,height:Le,fullWidth:j,fullHeight:Z}),J.style.cssText=Ee,u&&(J.style.width=`${Ae}px`,J.style.height=`${Le}px`),this.setTransform(),e!==!0&&this.emit("refresh"),this.ignoreBounds||(st(this.targetScale)<st(this.minScale)?this.zoomTo(this.minScale,{friction:0}):this.targetScale>this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===An.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,_=0,S=0;const E=this.option("infinite");if(E===!0||r&&E===r)l=-1/0,_=1/0,g=-1/0,S=1/0;else{let{containerRect:T,contentRect:I}=this,z=st(a*i,Fp),F=st(u*i,Fp),{innerWidth:j,innerHeight:Z}=T;if(T.width===z&&(j=T.width),T.width===F&&(Z=T.height),e>j){_=.5*(e-j),l=-1*_;let ie=.5*(I.right-I.left);l+=ie,_+=ie}if(a>j&&e<j&&(l-=.5*(a-j),_-=.5*(a-j)),n>Z){S=.5*(n-Z),g=-1*S;let ie=.5*(I.bottom-I.top);g+=ie,S+=ie}u>Z&&n<Z&&(l-=.5*(u-Z),_-=.5*(u-Z))}return{x:{min:l,max:_},y:{min:g,max:S}}}getBounds(){const e=this.option("bounds");return e!==fs?e:this.calculateBounds()}updateControls(){const e=this,n=e.container,{panMode:i,contentRect:r,targetScale:a,minScale:u}=e;let l=u,g=e.option("click")||!1;g&&(l=e.getNextScale(g));let _=e.canZoomIn(),S=e.canZoomOut(),E=i===q1&&!!this.option("touch"),T=S&&E;if(E&&(st(a)<st(u)&&!this.panOnlyZoomed&&(T=!0),(st(r.width,1)>st(r.fitWidth,1)||st(r.height,1)>st(r.fitHeight,1))&&(T=!0)),st(r.width*a,1)<st(r.fitWidth,1)&&(T=!1),i===ps&&(T=!1),to(n,this.cn("isDraggable"),T),!this.option("zoom"))return;let I=_&&st(l)>st(a),z=!I&&!T&&S&&st(l)<st(a);to(n,this.cn("canZoomIn"),I),to(n,this.cn("canZoomOut"),z);for(const F of n.querySelectorAll("[data-panzoom-action]")){let j=!1,Z=!1;switch(F.dataset.panzoomAction){case"zoomIn":_?j=!0:Z=!0;break;case"zoomOut":S?j=!0:Z=!0;break;case"toggleZoom":case"iterateZoom":_||S?j=!0:Z=!0;const ie=F.querySelector("g");ie&&(ie.style.display=_?"":"none")}j?(F.removeAttribute("disabled"),F.removeAttribute("tabindex")):Z&&(F.setAttribute("disabled",""),F.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:_=!1,ignoreBounds:S=!1}){this.state!==An.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:_,ignoreBounds:S})}applyChange({panX:e=0,panY:n=0,scale:i=1,angle:r=0,originX:a=-this.current.e,originY:u=-this.current.f,friction:l=this.option("friction"),flipX:g=!1,flipY:_=!1,ignoreBounds:S=!1,bounce:E=this.option("bounce")}){const T=this.state;if(T===An.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.friction=l||0,this.ignoreBounds=S;const{current:I}=this,z=I.e,F=I.f,j=this.getMatrix(this.target);let Z=new DOMMatrix().translate(z,F).translate(a,u).translate(e,n);if(this.option("zoom")){if(!S){const ie=this.targetScale,le=this.minScale,J=this.maxScale;ie*i<le&&(i=le/ie),ie*i>J&&(i=J/ie)}Z=Z.scale(i)}Z=Z.translate(-a,-u).translate(-z,-F).multiply(j),r&&(Z=Z.rotate(r)),g&&(Z=Z.scale(-1,1)),_&&(Z=Z.scale(1,-1));for(const ie of Po)ie!=="e"&&ie!=="f"&&(Z[ie]>this.minScale+1e-5||Z[ie]<this.minScale-1e-5)?this.target[ie]=Z[ie]:this.target[ie]=st(Z[ie],Fp);(this.targetScale<this.scale||Math.abs(i-1)>.1||this.panMode===ps||E===!1)&&!S&&this.clampTargetBounds(),T===An.Init?this.animate():this.isResting||(this.state=An.Panning,this.requestTick())}stop(e=!1){if(this.state===An.Init||this.state===An.Destroy)return;const n=this.isTicking;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const i of Po)this.velocity[i]=0,e==="current"?this.current[i]=this.target[i]:e==="target"&&(this.target[i]=this.current[i]);this.setTransform(),kn(this.container,"is-scaling"),kn(this.container,"is-animating"),this.isTicking=!1,this.state=An.Ready,n&&(this.emit("endAnimation"),this.updateControls())}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),Ct(this.container,"is-animating"),this.isScaling&&Ct(this.container,"is-scaling")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame(()=>this.animate()))}panWithMouse(e,n=this.option("mouseMoveFriction")){if(this.pmme=e,this.panMode!==ps||!e||st(this.targetScale)<=st(this.minScale))return;this.emit("mouseMove",e);const{container:i,containerRect:r,contentRect:a}=this,u=r.width,l=r.height,g=i.getBoundingClientRect(),_=(e.clientX||0)-g.left,S=(e.clientY||0)-g.top;let{contentWidth:E,contentHeight:T}=this.calculateContentDim(this.target);const I=this.option("mouseMoveFactor");I>1&&(E!==u&&(E*=I),T!==l&&(T*=I));let z=.5*(E-u)-_/u*100/100*(E-u);z+=.5*(a.right-a.left);let F=.5*(T-l)-S/l*100/100*(T-l);F+=.5*(a.bottom-a.top),this.applyChange({panX:z-this.target.e,panY:F-this.target.f,friction:n})}zoomWithWheel(e){if(this.state===An.Destroy||this.state===An.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(_,S){return Math.abs(S)>Math.abs(_)?S:_});const r=Math.max(-1,Math.min(1,i)),{targetScale:a,maxScale:u,minScale:l}=this;let g=a*(100+45*r)/100;st(g)<st(l)&&st(a)<=st(l)?(this.cwd+=Math.abs(r),g=l):st(g)>st(u)&&st(a)>=st(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(),st(g)!==st(a)&&this.zoomTo(g,{event:e}))}canZoomIn(){return this.option("zoom")&&(st(this.contentRect.width,1)<st(this.contentRect.fitWidth,1)||st(this.targetScale)<st(this.maxScale))}canZoomOut(){return this.option("zoom")&&st(this.targetScale)>st(this.minScale)}zoomIn(e=1.25,n){this.zoomTo(this.targetScale*e,n)}zoomOut(e=.8,n){this.zoomTo(this.targetScale*e,n)}zoomToFit(e){this.zoomTo("fit",e)}zoomToCover(e){this.zoomTo("cover",e)}zoomToFull(e){this.zoomTo("full",e)}zoomToMax(e){this.zoomTo("max",e)}toggleZoom(e){this.zoomTo(this.getNextScale("toggleZoom"),e)}toggleMax(e){this.zoomTo(this.getNextScale("toggleMax"),e)}toggleCover(e){this.zoomTo(this.getNextScale("toggleCover"),e)}iterateZoom(e){this.zoomTo("next",e)}zoomTo(e=1,{friction:n=fs,originX:i=fs,originY:r=fs,event:a}={}){if(this.isContentLoading||this.state===An.Destroy)return;const{targetScale:u,fullScale:l,maxScale:g,coverScale:_}=this;if(this.stop(),this.panMode===ps&&(a=this.pmme||a),a||i===fs||r===fs){const E=this.content.getBoundingClientRect(),T=this.container.getBoundingClientRect(),I=a?a.clientX:T.left+.5*T.width,z=a?a.clientY:T.top+.5*T.height;i=I-E.left-.5*E.width,r=z-E.top-.5*E.height}let S=1;typeof e=="number"?S=e:e==="full"?S=l:e==="cover"?S=_:e==="max"?S=g:e==="fit"?S=1:e==="next"&&(S=this.getNextScale("iterateZoom")),S=S/u||1,n=n===fs?S>1?.15:.25:n,this.applyChange({scale:S,originX:i,originY:r,friction:n}),a&&this.panMode===ps&&this.panWithMouse(a,n)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:e,contentRect:n,target:i}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-i.e,panY:.5*e.height-(n.top+.5*n.fitHeight)-i.f,scale:e.width/n.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:e,contentRect:n,target:i}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-i.e,panY:.5*e.innerHeight-(n.top+.5*n.fitHeight)-i.f,scale:e.height/n.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:e}=this,n=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");e.classList.toggle(n);const r=e.classList.contains(n);r?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(r?"enterFS":"exitFS")}getMatrix(e=this.current){const{a:n,b:i,c:r,d:a,e:u,f:l}=e;return new DOMMatrix([n,i,r,a,u,l])}reset(e){if(this.state!==An.Init&&this.state!==An.Destroy){this.stop("current");for(const n of Po)this.target[n]=Vp[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=An.Panning,this.requestTick())}}destroy(){this.stop(),this.state=An.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:_R}),Object.defineProperty(ua,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const G1=function(t,e){let n=!0;return(...i)=>{n&&(n=!1,t(...i),setTimeout(()=>{n=!0},e))}},Z1=(t,e)=>{let n=[];return t.childNodes.forEach(i=>{i.nodeType!==Node.ELEMENT_NODE||e&&!i.matches(e)||n.push(i)}),n},bR={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 ci;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"})(ci||(ci={}));const hy=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)},vR=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class Vs extends Bp{constructor(e,n){super(n),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:e})}attach(){}detach(){}}const wR={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 Y1 extends Vs{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let e=this.list;if(!e){e=document.createElement("ul"),Ct(e,this.cn("list")),e.setAttribute("role","tablist");const n=this.instance.container;n.appendChild(e),Ct(n,this.cn("hasDots")),this.list=e}return e}refresh(){var e;const n=this.instance.pages.length,i=Math.min(2,this.option("minCount")),r=Math.max(2e3,this.option("maxCount")),a=this.option("dynamicFrom");if(n<i||n>r)return void this.cleanup();const u=typeof a=="number"&&n>5&&n>=a,l=!this.list||this.isDynamic!==u||this.list.children.length!==n;l&&this.cleanup();const g=this.build();if(to(g,this.cn("isDynamic"),!!u),l)for(let E=0;E<n;E++)g.append(this.createItem(E));let _,S=0;for(const E of[...g.children]){const T=S===this.instance.page;T&&(_=E),to(E,this.cn("isCurrent"),T),(e=E.children[0])===null||e===void 0||e.setAttribute("aria-selected",T?"true":"false");for(const I of["isBeforePrev","isPrev","isNext","isAfterNext"])kn(E,this.cn(I));S++}if(_=_||g.firstChild,u&&_){const E=_.previousElementSibling,T=E&&E.previousElementSibling;Ct(E,this.cn("isPrev")),Ct(T,this.cn("isBeforePrev"));const I=_.nextElementSibling,z=I&&I.nextElementSibling;Ct(I,this.cn("isNext")),Ct(z,this.cn("isAfterNext"))}this.isDynamic=u}createItem(e=0){var n;const i=document.createElement("li");i.setAttribute("role","presentation");const r=eo(this.instance.localize(this.option("dotTpl"),[["%d",e+1]]).replace(/\%i/g,e+""));return i.appendChild(r),(n=i.children[0])===null||n===void 0||n.setAttribute("role","tab"),i}cleanup(){this.list&&(this.list.remove(),this.list=null),this.isDynamic=!1,kn(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(Y1,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:wR});const $p="disabled",jp="next",X1="prev";class K1 extends Vs{constructor(){super(...arguments),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prev",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"next",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isDom",{enumerable:!0,configurable:!0,writable:!0,value:!1})}onRefresh(){const e=this.instance,n=e.pages.length,i=e.page;if(n<2)return void this.cleanup();this.build();let r=this.prev,a=this.next;r&&a&&(r.removeAttribute($p),a.removeAttribute($p),e.isInfinite||(i<=0&&r.setAttribute($p,""),i>=n-1&&a.setAttribute($p,"")))}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===jp?"isNext":"isPrev"));const a=i.isRTL?e===jp?X1:jp: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(jp)),this.next=a,r||(r=i.querySelector("[data-carousel-prev]")),r||(r=this.addBtn(X1)),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(K1,"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 J1 extends Vs{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(e){this.target=this.instance,this.nav=e,this.attachEvents()}addAsNavFor(e){this.nav=this.instance,this.target=e,this.attachEvents()}attachEvents(){const{nav:e,target:n}=this;e&&n&&(e.options.initialSlide=n.options.initialPage,e.state===ci.Ready?this.onNavReady(e):e.on("ready",this.onNavReady),n.state===ci.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 _=u.closest("[data-index]");if(i.stopPropagation(),i.preventDefault(),!_)return;const S=parseInt(_.dataset.index||"",10)||0,E=g.getPageForSlide(S),T=l.getPageForSlide(S);l.slideTo(T),g.slideTo(E,{friction:((a=(r=this.nav)===null||r===void 0?void 0:r.plugins)===null||a===void 0?void 0:a.Sync.option("friction"))||0}),this.markSelectedSlide(S)}onNavCreateSlide(e,n){n.index===this.selectedIndex&&this.markSelectedSlide(n.index)}onTargetChange(){var e,n;const{target:i,nav:r}=this;if(!i||!r||r.state!==ci.Ready||i.state!==ci.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===ci.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(J1,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const kR={Navigation:K1,Dots:Y1,Sync:J1},Up="animationend",Q1="isSelected",Hp="slide";class ha extends ay{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===ci.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:ci.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||!Tr(e))throw new Error("No Element found");this.container=e,this.slideNext=G1(this.slideNext.bind(this),150),this.slidePrev=G1(this.slidePrev.bind(this),150),this.userOptions=n,this.userPlugins=i,queueMicrotask(()=>{this.processOptions()})}processOptions(){var e,n;const i=Cr({},ha.defaults,this.userOptions);let r="";const a=i.breakpoints;if(a&&sy(a))for(const[u,l]of Object.entries(a))window.matchMedia(u).matches&&sy(l)&&(r+=u,Cr(i,l));r===this.bp&&this.state!==ci.Init||(this.bp=r,this.state===ci.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!==ci.Init&&this.destroy(),super.setOptions(i),this.option("enabled")===!1?this.attachEvents():setTimeout(()=>{this.init()},0))}init(){this.state=ci.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=ci.Ready,this.emit("ready")}initLayout(){const{container:e}=this,n=this.option("classes");Ct(e,this.cn("container")),to(e,n.isLTR,!this.isRTL),to(e,n.isRTL,this.isRTL),to(e,n.isVertical,!this.isHorizontal),to(e,n.isHorizontal,this.isHorizontal);let i=this.option("viewport")||e.querySelector(`.${n.viewport}`);i||(i=document.createElement("div"),Ct(i,n.viewport),i.append(...Z1(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=[];[...Z1(e,`.${this.cn(Hp)}`)].forEach(r=>{if(Tr(r)){const a=hy({el:r,isDom:!0,index:this.slides.length});i.push(a)}});for(let r of[...this.option("slides",[])||[],...n])i.push(hy(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,Cr({},{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(vR()),a=e.length-1,u=0,l=0),e[a].slides.push(g),u+=g.dim+g.gap,l++;return e}processPages(){const e=this.pages,{contentDim:n,viewportDim:i,isInfinite:r}=this,a=this.option("center"),u=this.option("fill"),l=u&&a&&n>i&&!r;if(e.forEach((S,E)=>{var T;S.index=E,S.pos=((T=S.slides[0])===null||T===void 0?void 0:T.pos)||0,S.dim=0;for(const[I,z]of S.slides.entries())S.dim+=z.dim,I<S.slides.length-1&&(S.dim+=z.gap);l&&S.pos+.5*S.dim<.5*i?S.pos=0:l&&S.pos+.5*S.dim>=n-.5*i?S.pos=n-i:a&&(S.pos+=-.5*(i-S.dim))}),e.forEach(S=>{u&&!r&&n>i&&(S.pos=Math.max(S.pos,0),S.pos=Math.min(S.pos,n-i)),S.pos=st(S.pos,1e3),S.dim=st(S.dim,1e3),Math.abs(S.pos)<=.1&&(S.pos=0)}),r)return e;const g=[];let _;return e.forEach(S=>{const E=Object.assign({},S);_&&E.pos===_.pos?(_.dim+=E.dim,_.slides=[..._.slides,...E.slides]):(E.index=g.length,_=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(Hp)+" "+e.class+" "+e.customClass),a)l.style[r]=`${a}px`,l.style[r==="width"?"height":"width"]="";else{g&&(this.track||document.body).prepend(l),a=l.getBoundingClientRect()[r]*Math.max(1,((n=window.visualViewport)===null||n===void 0?void 0:n.scale)||1);let S=l[this.isHorizontal?"offsetWidth":"offsetHeight"];S-1>a&&(a=S)}const _=getComputedStyle(l);return _.boxSizing==="content-box"&&(this.isHorizontal?(a+=parseFloat(_.paddingLeft)||0,a+=parseFloat(_.paddingRight)||0):(a+=parseFloat(_.paddingTop)||0,a+=parseFloat(_.paddingBottom)||0)),u=parseFloat(_[this.isHorizontal?"marginRight":"marginBottom"])||0,g?(i=l.parentElement)===null||i===void 0||i.removeChild(l):e.el||l.remove(),{dim:st(a,1e3),gap:st(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:_,slides:S,panzoom:E}=this,T=0,I=0,z=0,F=0;E?F=-1*E.current[this.axis]:_[g]&&(F=_[g].pos||0),e=n?i?"right":"left":"top",i&&n&&(F*=-1);for(const le of S){const J=le.el;J?(e==="top"?(J.style.right="",J.style.left=""):J.style.top="",le.index!==T?J.style[e]=I===0?"":`${st(I,1e3)}px`:J.style[e]="",z+=le.dim+le.gap,T++):I+=le.dim+le.gap}if(r&&z&&a){let le=getComputedStyle(a),J="padding",Ee=n?"Right":"Bottom",be=parseFloat(le[J+(n?"Left":"Top")]);F-=be,u+=be,u+=parseFloat(le[J+Ee]);for(const Ae of S)Ae.el&&(st(Ae.pos)<st(u)&&st(Ae.pos+Ae.dim+Ae.gap)<st(F)&&st(F)>st(l-u)&&(Ae.el.style[e]=`${st(I+z,1e3)}px`),st(Ae.pos+Ae.gap)>=st(l-u)&&st(Ae.pos)>st(F+u)&&st(F)<st(u)&&(Ae.el.style[e]=`-${st(z,1e3)}px`))}let j,Z,ie=[...this.inTransition];if(ie.length>1&&(j=_[ie[0]],Z=_[ie[1]]),j&&Z){let le=0;for(const J of S)J.el?this.inTransition.has(J.index)&&j.slides.indexOf(J)<0&&(J.el.style[e]=`${st(le+(j.pos-Z.pos),1e3)}px`):le+=J.dim+J.gap}}createSlideEl(e){const{track:n,slides:i}=this;if(!n||!e||e.el&&e.el.parentNode)return;const r=e.el||document.createElement("div");Ct(r,this.cn(Hp)),Ct(r,e.class),Ct(r,e.customClass);const a=e.html;a&&(a instanceof HTMLElement?r.appendChild(a):r.innerHTML=e.html+"");const u=[];i.forEach((S,E)=>{S.el&&u.push(E)});const l=e.index;let g=null;u.length&&(g=i[u.reduce((S,E)=>Math.abs(E-l)<Math.abs(S-l)?E:S)]);const _=g&&g.el&&g.el.parentNode?g.index<e.index?g.el.nextSibling:g.el:null;n.insertBefore(r,n.contains(_)?_: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(Q1);if(i.classList.contains(r)&&(kn(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(Up);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:_}=this;e=parseInt((e||0).toString())||0;const S=this.getPageFromIndex(e);if(!_||!g[S]||g.length<2||Math.abs((((r=(i=g[l])===null||i===void 0?void 0:i.slides[0])===null||r===void 0?void 0:r.dim)||0)-this.viewportDim)>1)return!1;let E=e>l?1:-1;this.isInfinite&&(l===0&&e===g.length-1&&(E=-1),l===g.length-1&&e===0&&(E=1));const T=g[S].pos*(this.isRTL?1:-1);if(l===S&&Math.abs(T-_.target[this.axis])<1)return!1;this.clearTransitions();const I=_.isResting;Ct(this.container,this.cn("inTransition"));const z=((a=g[l])===null||a===void 0?void 0:a.slides[0])||null,F=((u=g[S])===null||u===void 0?void 0:u.slides[0])||null;this.inTransition.add(F.index),this.createSlideEl(F);let j=z.el,Z=F.el;I||n===Hp||(n="fadeFast",j=null);const ie=this.isRTL?"next":"prev",le=this.isRTL?"prev":"next";return j&&(this.inTransition.add(z.index),z.transition=n,j.addEventListener(Up,this.onAnimationEnd),j.classList.add(`f-${n}Out`,`to-${E>0?le:ie}`)),Z&&(F.transition=n,Z.addEventListener(Up,this.onAnimationEnd),Z.classList.add(`f-${n}In`,`from-${E>0?ie:le}`)),_.current[this.axis]=T,_.target[this.axis]=T,_.requestTick(),this.onChange(S),!0}manageSlideVisiblity(){const e=new Set,n=new Set,i=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const r of this.slides)i.has(r)?e.add(r):n.add(r);for(const r of this.inTransition)e.add(this.slides[r]);for(const r of e)this.createSlideEl(r),this.lazyLoadSlide(r);for(const r of n)e.has(r)||this.removeSlideEl(r);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const e="aria-hidden";let n=this.cn(Q1);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)&&(kn(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],_=l.target[e]-g,S=0,E=.5*a;r&&n?(g<-E&&(S=-1,g+=u),g>u-E&&(S=1,g-=u)):(g>E&&(S=1,g-=u),g<-u+E&&(S=-1,g+=u)),S&&(l.current[e]=g,l.target[e]=g+_)}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),kn(n,a),n.complete&&(Ct(n,r),setTimeout(()=>{kn(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 _=n.parentNode;_&&e.el&&(n.complete?g():u||(l=eo(ly),_.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:_}=this,S=_.length,E=Math.abs(Math.atan2(i,n)/(Math.PI/180));let T=0;if(T=E>45&&E<135?l?0:i:l?n:0,!S)return;let I=this.page,z=u&&l?1:-1;const F=e.current[g]*z;let{pageIndex:j}=this.getPageFromPosition(F);Math.abs(T)>5?(_[I].dim<document.documentElement["client"+(this.isHorizontal?"Width":"Height")]-1&&(I=j),I=u&&l?T<0?I-1:I+1:T<0?I+1:I-1):I=r===0&&a===0?I:j,this.slideTo(I,{transition:!1,friction:e.option("decelFriction")})}onClick(e){const n=e.target,i=n&&Tr(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=ci.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===ci.Destroy)return;e=parseInt((e||0).toString())||0;const r=this.getPageFromIndex(e),{axis:a,isHorizontal:u,isRTL:l,pages:g,panzoom:_}=this,S=g.length,E=l&&u?1:-1;if(!_||!S)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 T=g[r].pos;if(this.isInfinite){const I=this.contentDim,z=_.target[a]*E;S===2?T+=I*Math.floor(parseFloat(e+"")/2):T=[T,T-I,T+I].reduce(function(F,j){return Math.abs(j-z)<Math.abs(F-z)?j:F})}T*=E,Math.abs(_.target[a]-T)<1||(_.panTo({x:u?T:0,y:u?0:T,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(),kn(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(Up,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,_=((r=this.pages[this.page])===null||r===void 0?void 0:r.dim)||0,S=this.contentDim<this.viewportDim;let E=Array.isArray(n)?n:[n];const T=[];for(const I of E)T.push(hy(I));this.slides.splice(e,0,...T);for(let I=0;I<this.slides.length;I++)this.slides[I].index=I;for(const I of T)this.emit("beforeInitSlide",I,I.index);if(this.page>=e&&(this.page+=T.length),this.updateMetrics(),l){const I=((a=this.pages[this.page])===null||a===void 0?void 0:a.pos)||0,z=((u=this.pages[this.page])===null||u===void 0?void 0:u.dim)||0,F=this.pages.length||1,j=this.isRTL?_-z:z-_,Z=this.isRTL?g-I:I-g;S&&F===1?(e<=this.page&&(l.current[this.axis]-=j,l.target[this.axis]-=j),l.panTo({[this.isHorizontal?"x":"y"]:-1*I})):Z&&e<=this.page&&(l.target[this.axis]-=Z,l.current[this.axis]-=Z,l.requestTick())}for(const I of T)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],st(n.getBoundingClientRect()[l],1e3)),T=getComputedStyle(n),I="padding",z=a?"Right":"Bottom";E-=parseFloat(T[I+(a?"Left":"Top")])+parseFloat(T[I+z]),this.viewportDim=E}let _,S=0;for(const[E,T]of r.entries()){let I=0,z=0;!T.el&&_?(I=_.dim,z=_.gap):({dim:I,gap:z}=this.getSlideMetrics(T),_=T),I=st(I,1e3),z=st(z,1e3),T.dim=I,T.gap=z,T.pos=S,S+=I,(u||E<r.length-1)&&(S+=z)}S=st(S,1e3),this.contentDim=S,e&&(e.contentRect[l]=S,e.contentRect[a?"fullWidth":"fullHeight"]=S),this.pages=this.createPages(),this.pages=this.processPages(),this.state===ci.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,_=st((g-l.pos)/(1*l.dim),1e3),S=_,E=_;this.isInfinite&&i!==!0&&(S=st((g-l.pos+u)/(1*l.dim),1e3),E=st((g-l.pos-u)/(1*l.dim),1e3));let T=[_,S,E].reduce(function(I,z){return Math.abs(z)<Math.abs(I)?z:I});return n?T:T>1?1:T<-1?-1:T}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 _=0;_=r&&r.state!==An.Init&&r.state!==An.Destroy?-1*r.current[this.axis]:l[g]&&l[g].pos||0,this.isInfinite&&(_-=Math.floor(_/a)*a),this.isRTL&&this.isHorizontal&&(_*=-1);const S=_-u*e,E=_+u*(e+1),T=this.isInfinite?[-1,0,1]:[0];for(const I of this.slides)for(const z of T){const F=I.pos+z*a,j=F+I.dim+I.gap;F<E&&j>S&&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,_=r[0],S=r[g-1],E=this.option("center");let T=0,I=0,z=0,F=e===void 0?-1*((u==null?void 0:u.target[this.axis])||0):e;E&&(F+=.5*n),this.isInfinite?(F<_.pos-.5*S.gap&&(F-=i,z=-1),F>S.pos+S.dim+.5*S.gap&&(F-=i,z=1)):F=Math.max(_.pos||0,Math.min(F,S.pos));let j=S,Z=r.find(ie=>{const le=ie.pos-.5*j.gap,J=ie.pos+ie.dim+.5*ie.gap;return j=ie,F>=le&&F<J});return Z||(Z=S),I=this.getPageForSlide(Z.index),T=I+z*l,{page:T,pageIndex:I}}setPageFromPosition(){const{pageIndex:e}=this.getPageFromPosition();this.onChange(e)}destroy(){if([ci.Destroy].includes(this.state))return;this.state=ci.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,_]of Object.entries(u))g!=="container"&&_&&e.classList.remove(_);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:bR}),Object.defineProperty(ha,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:kR});const ev=function(t){if(!Tr(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 _=g/n*100;return Math.round(_)},fh=!(typeof window>"u"||!window.document||!window.document.createElement);let dy;const py=["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(","),tv=t=>{if(t&&fh){dy===void 0&&document.createElement("div").focus({get preventScroll(){return dy=!0,!1}});try{if(dy)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{}}},nv=()=>{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},fy={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({},U1),{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}),parentEl:null,placeFocusBack:!0,showClass:"f-zoomInUp",startIndex:0,tpl:{closeButton:'<button data-fancybox-close class="f-button is-close-btn" title="{{CLOSE}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M20 20L4 4m16 0L4 20"/></svg></button>',main:`<div class="fancybox__container" role="dialog" aria-modal="true" aria-label="{{MODAL}}" tabindex="-1">
|
|
625
625
|
<div class="fancybox__backdrop"></div>
|
|
626
626
|
<div class="fancybox__carousel"></div>
|
|
627
627
|
<div class="fancybox__footer"></div>
|
|
628
628
|
</div>`},trapFocus:!0,wheel:"zoom"};var Ei,Xi;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Closing=2]="Closing",t[t.CustomClosing=3]="CustomClosing",t[t.Destroy=4]="Destroy"})(Ei||(Ei={})),function(t){t[t.Loading=0]="Loading",t[t.Opening=1]="Opening",t[t.Ready=2]="Ready",t[t.Closing=3]="Closing"}(Xi||(Xi={}));let iv="",mh=!1,qp=!1,ml=null;const rv=()=>{let t="",e="";const n=fn.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}},Wp=()=>{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}},sv=()=>{const{slug:t,index:e}=Wp();if(!t)return;let n=document.querySelector(`[data-slug="${t}"]`);if(n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),fn.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})))},ov=()=>{if(fn.defaults.Hash===!1)return;const t=fn.getInstance();if((t==null?void 0:t.options.Hash)===!1)return;const{slug:e,index:n}=Wp(),{slug:i}=rv();t&&(e===i?t.jumpTo(n-1):(mh=!0,t.close())),sv()},av=()=>{ml&&clearTimeout(ml),queueMicrotask(()=>{ov()})},lv=()=>{window.addEventListener("hashchange",av,!1),setTimeout(()=>{ov()},500)};fh&&(/complete|interactive|loaded/.test(document.readyState)?lv():document.addEventListener("DOMContentLoaded",lv));const Gp="is-zooming-in";class cv extends Vs{onCreateSlide(e,n,i){const r=this.instance.optionFor(i,"src")||"";i.el&&i.type==="image"&&typeof r=="string"&&this.setImage(i,r)}onRemoveSlide(e,n,i){i.panzoom&&i.panzoom.destroy(),i.panzoom=void 0,i.imageEl=void 0}onChange(e,n,i,r){kn(this.instance.container,Gp);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===An.Init||l.state===An.Destroy)return;l.updateMetrics();let _=this.getZoomInfo(r);if(!_)return;this.instance.state=Ei.CustomClosing,i.classList.remove(Gp),i.classList.add("is-zooming-out"),u.style.backgroundImage=`url('${g}')`;const S=i.getBoundingClientRect();(((e=window.visualViewport)===null||e===void 0?void 0:e.scale)||1)===1&&Object.assign(i.style,{position:"absolute",top:`${i.offsetTop+window.scrollY}px`,left:`${i.offsetLeft+window.scrollX}px`,bottom:"auto",right:"auto",width:`${S.width}px`,height:`${S.height}px`,overflow:"hidden"});const{x:E,y:T,scale:I,opacity:z}=_;if(z){const F=((j,Z,ie,le)=>{const J=Z-j,Ee=le-ie;return be=>ie+((be-j)/J*Ee||0)})(l.scale,I,1,0);l.on("afterTransform",()=>{u.style.opacity=F(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:T,scale:I,friction:z?.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 _=!!i.isOpeningSlide(e)&&this.getZoomInfo(e);if(this.option("protected")&&g){g.addEventListener("contextmenu",T=>{T.preventDefault()});const E=document.createElement("div");Ct(E,"fancybox-protected"),a.appendChild(E)}if(l&&_){const E=r.contentRect,T=Math.max(E.fullWidth,E.fullHeight);let I=null;!_.opacity&&T>1200&&(I=document.createElement("img"),Ct(I,"fancybox-ghost"),I.src=l,a.appendChild(I));const z=()=>{I&&(Ct(I,"f-fadeFastOut"),setTimeout(()=>{I&&(I.remove(),I=null)},200))};(S=l,new Promise((F,j)=>{const Z=new Image;Z.onload=F,Z.onerror=j,Z.src=S})).then(()=>{i.hideLoading(e),e.state=Xi.Opening,this.instance.emit("reveal",e),this.zoomIn(e).then(()=>{z(),this.instance.done(e)},()=>{}),I&&setTimeout(()=>{z()},T>2500?800:200)},()=>{i.hideLoading(e),i.revealContent(e)})}else{const E=this.optionFor(e,"initialSize"),T=this.optionFor(e,"zoom"),I={event:i.prevMouseMoveEvent||i.options.event,friction:T?.12:0};let z=i.optionFor(e,"showClass")||void 0,F=!0;i.isOpeningSlide(e)&&(E==="full"?r.zoomToFull(I):E==="cover"?r.zoomToCover(I):E==="max"?r.zoomToMax(I):F=!1,r.stop("current")),F&&z&&(z=r.isDragging?"f-fadeIn":""),i.hideLoading(e),i.revealContent(e,z)}var S},()=>{i.setError(e,"{{IMAGE_ERROR}}")})}process(e,n){return new Promise((i,r)=>{var a;const u=this.instance,l=e.el;u.clearContent(e),u.showLoading(e);let g=this.optionFor(e,"content");if(typeof g=="string"&&(g=eo(g)),!g||!Tr(g)){if(g=document.createElement("img"),g instanceof HTMLImageElement){let _="",S=e.caption;_=typeof S=="string"&&S?S.replace(/<[^>]+>/gi,"").substring(0,1e3):`Image ${e.index+1} of ${((a=u.carousel)===null||a===void 0?void 0:a.pages.length)||1}`,g.src=n||"",g.alt=_,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,Cr({transformParent:!0},this.option("Panzoom")||{},{content:g,width:(_,S)=>u.optionFor(e,"width","auto",S)||"auto",height:(_,S)=>u.optionFor(e,"height","auto",S)||"auto",wheel:()=>{const _=u.option("wheel");return(_==="zoom"||_=="pan")&&_},click:(_,S)=>{var E,T;if(u.isCompact||u.isClosing()||e.index!==((E=u.getSlide())===null||E===void 0?void 0:E.index))return!1;if(S){const z=S.composedPath()[0];if(["A","BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(z.nodeName))return!1}let I=!S||S.target&&((T=e.contentEl)===null||T===void 0?void 0:T.contains(S.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:_=>{i(_)},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 _=this.getZoomInfo(e);if(!(_&&g&&l&&u&&a))return void i();const{x:S,y:E,scale:T,opacity:I}=_,z=()=>{e.state!==Xi.Closing&&(I&&(l.style.opacity=Math.max(Math.min(1,1-(1-u.scale)/(1-T)),0)+""),u.scale>=1&&u.scale>u.targetScale-.1&&n(u))},F=ie=>{(ie.scale<.99||ie.scale>1.01)&&!ie.isDragging||(kn(a,Gp),l.style.opacity="",ie.off("endAnimation",F),ie.off("touchStart",F),ie.off("afterTransform",z),n(ie))};u.on("endAnimation",F),u.on("touchStart",F),u.on("afterTransform",z),u.on(["error","destroy"],()=>{i()}),u.panTo({x:S,y:E,scale:T,friction:0,ignoreBounds:!0}),u.stop("current");const j={event:u.panMode==="mousemove"?r.prevMouseMoveEvent||r.options.event:void 0},Z=this.optionFor(e,"initialSize");Ct(a,Gp),r.hideLoading(e),Z==="full"?u.zoomToFull(j):Z==="cover"?u.zoomToCover(j):Z==="max"?u.zoomToMax(j):u.reset(.172)})}getZoomInfo(e){const{el:n,imageEl:i,thumbEl:r,panzoom:a}=e,u=this.instance,l=u.container;if(!n||!i||!r||!a||ev(r)<3||!this.optionFor(e,"zoom")||!l||u.state===Ei.Destroy||getComputedStyle(l).getPropertyValue("--f-images-zoom")==="0")return!1;const g=window.visualViewport||null;if((g?g.scale:1)!==1)return!1;let{top:_,left:S,width:E,height:T}=r.getBoundingClientRect(),{top:I,left:z,fitWidth:F,fitHeight:j}=a.contentRect;if(!(E&&T&&F&&j))return!1;const Z=a.container.getBoundingClientRect();z+=Z.left,I+=Z.top;const ie=-1*(z+.5*F-(S+.5*E)),le=-1*(I+.5*j-(_+.5*T)),J=E/F;let Ee=this.option("zoomOpacity")||!1;return Ee==="auto"&&(Ee=Math.abs(E/T-F/j)>.1),{x:ie,y:le,scale:J,opacity:Ee}}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(cv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{initialSize:"fit",Panzoom:{maxScale:1},protected:!1,zoom:!0,zoomOpacity:"auto"}}),typeof SuppressedError=="function"&&SuppressedError;const my="html",uv="image",gy="map",Io="youtube",gl="vimeo",gh="html5video",hv=(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 _=g+"";if(l==="t"){let S=_.match(/((\d*)m)?(\d*)s?/);S&&r.set("start",60*parseInt(S[2]||"0")+parseInt(S[3]||"0")+"")}else r.set(l,_)}let a=r+"",u=t.match(/#t=((.*)?\d+s)/);return u&&(a+=`#t=${u[1]}`),a},SR={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}},ER=["image","html","ajax","inline","clone","iframe","map","pdf","html5video","youtube","vimeo"];class dv extends Vs{onBeforeInitSlide(e,n,i){this.processType(i)}onCreateSlide(e,n,i){this.setContent(i)}onClearContent(e,n){n.xhr&&(n.xhr.abort(),n.xhr=null);const i=n.iframeEl;i&&(i.onload=i.onerror=null,i.src="//about:blank",n.iframeEl=null);const r=n.contentEl,a=n.placeholderEl;if(n.type==="inline"&&r&&a)r.classList.remove("fancybox__content"),getComputedStyle(r).getPropertyValue("display")!=="none"&&(r.style.display="none"),setTimeout(()=>{a&&(r&&a.parentNode&&a.parentNode.insertBefore(r,a),a.remove())},0),n.contentEl=void 0,n.placeholderEl=void 0;else for(;n.el&&n.el.firstChild;)n.el.removeChild(n.el.firstChild)}onSelectSlide(e,n,i){i.state===Xi.Ready&&this.playVideo()}onUnselectSlide(e,n,i){var r,a;if(i.type===gh){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===gl?u={method:"pause",value:"true"}:i.type===Io&&(u={event:"command",func:"pauseVideo"}),u&&i.iframeEl&&i.iframeEl.contentWindow&&i.iframeEl.contentWindow.postMessage(JSON.stringify(u),"*"),i.poller&&clearTimeout(i.poller)}onDone(e,n){e.isCurrentSlide(n)&&!e.isClosing()&&this.playVideo()}onRefresh(e,n){n.slides.forEach(i=>{i.el&&(this.resizeIframe(i),this.setAspectRatio(i))})}onMessage(e){try{let n=JSON.parse(e.data);if(e.origin==="https://player.vimeo.com"){if(n.event==="ready")for(let i of Array.from(document.getElementsByClassName("fancybox__iframe")))i instanceof HTMLIFrameElement&&i.contentWindow===e.source&&(i.dataset.ready="true")}else if(e.origin.match(/^https:\/\/(www.)?youtube(-nocookie)?.com$/)&&n.event==="onReady"){const i=document.getElementById(n.id);i&&(i.dataset.ready="true")}}catch{}}loadAjaxContent(e){const n=this.instance.optionFor(e,"src")||"";this.instance.showLoading(e);const i=this.instance,r=new XMLHttpRequest;i.showLoading(e),r.onreadystatechange=function(){r.readyState===XMLHttpRequest.DONE&&i.state===Ei.Ready&&(i.hideLoading(e),r.status===200?i.setContent(e,r.responseText):i.setError(e,r.status===404?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};const a=e.ajax||null;r.open(a?"POST":"GET",n+""),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.setRequestHeader("X-Requested-With","XMLHttpRequest"),r.send(a),e.xhr=r}setInlineContent(e){let n=null;if(Tr(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===Io||n===gl)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 _=window.getComputedStyle(r),S=parseFloat(_.paddingLeft)+parseFloat(_.paddingRight),E=parseFloat(_.paddingTop)+parseFloat(_.paddingBottom),T=i.contentWindow;if(T){const I=T.document,z=I.getElementsByTagName(my)[0],F=I.body;g.width="",F.style.overflow="hidden",u=u||z.scrollWidth+S,g.width=`${u}px`,F.style.overflow="",g.flex="0 0 auto",g.height=`${F.scrollHeight}px`,l=z.scrollHeight+E}}catch{}if(u||l){const _={flex:"0 1 auto",width:"",height:""};u&&u!=="auto"&&(_.width=`${u}px`),l&&l!=="auto"&&(_.height=`${l}px`),Object.assign(g,_)}}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===gh)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!==Io&&e.type!==gl)return;const i=()=>{if(e.iframeEl&&e.iframeEl.contentWindow){let r;if(e.iframeEl.dataset.ready==="true")return r=e.type===Io?{event:"command",func:"playVideo"}:{method:"play",value:"true"},r&&e.iframeEl.contentWindow.postMessage(JSON.stringify(r),"*"),void(e.poller=void 0);e.type===Io&&(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=my,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,Io),{nocookie:u}=a,l=function(E,T){var I={};for(var z in E)Object.prototype.hasOwnProperty.call(E,z)&&T.indexOf(z)<0&&(I[z]=E[z]);if(E!=null&&typeof Object.getOwnPropertySymbols=="function"){var F=0;for(z=Object.getOwnPropertySymbols(E);F<z.length;F++)T.indexOf(z[F])<0&&Object.prototype.propertyIsEnumerable.call(E,z[F])&&(I[z[F]]=E[z[F]])}return I}(a,["nocookie"]),g=`www.youtube${u?"-nocookie":""}.com`,_=hv(n,l),S=encodeURIComponent(r[2]);e.videoId=S,e.src=`https://${g}/embed/${S}?${_}`,e.thumbSrc=e.thumbSrc||`https://i.ytimg.com/vi/${S}/mqdefault.jpg`,i=Io}else if(r=n.match(/^.+vimeo.com\/(?:\/)?([\d]+)((\/|\?h=)([a-z0-9]+))?(.*)?/)){const a=hv(n,this.optionFor(e,gl)),u=encodeURIComponent(r[1]),l=r[4]||"";e.videoId=u,e.src=`https://player.vimeo.com/video/${u}?${l?`h=${l}${a?"&":""}`:""}${a}`,i=gl}if(!i&&e.triggerEl){const a=e.triggerEl.dataset.type;ER.includes(a)&&(i=a)}i||typeof n=="string"&&(n.charAt(0)==="#"?i="inline":(r=n.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(i=gh,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=uv: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=gy):(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=gy),i=i||this.instance.option("defaultType"),e.type=i,i===uv&&(e.thumbSrc=e.thumbSrc||e.src)}setContent(e){const n=this.instance.optionFor(e,"src")||"";if(e&&e.type&&n){switch(e.type){case my:this.instance.setContent(e,n);break;case gh: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 gy:case Io:case gl:e.preload=!1;case"iframe":this.setIframeContent(e)}this.setAspectRatio(e)}}setAspectRatio(e){const n=e.contentEl;if(!(e.el&&n&&e.type&&[Io,gl,gh].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 _=(i+"").match(/(\d+)\s*\/\s?(\d+)/);i=_&&_.length>2?parseFloat(_[1])/parseFloat(_[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(dv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:SR});const Zp="play",Yp="pause",yh="ready";class pv extends Vs{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:yh}),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!==yh}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=Zp,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!==yh){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=yh,i.removeEventListener("mouseenter",e.onMouseEnter,!1),i.removeEventListener("mouseleave",e.onMouseLeave,!1),document.removeEventListener("visibilitychange",e.onVisibilityChange,!1),kn(i,"has-autoplay"),n!==yh&&e.emit("stop")}pause(){const e=this;e.state===Zp&&(e.state=Yp,e.clear(),e.emit(Yp))}resume(){const e=this,n=e.instance;if(n.isInfinite||n.page!==n.pages.length-1)if(e.state!==Zp){if(e.state===Yp&&!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===Zp||this.state===Yp?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(pv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});class fv extends Vs{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null})}onPrepare(e){const n=e.carousel;if(!n)return;const i=e.container;i&&(n.options.Autoplay=Cr({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)!==Xi.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)===Xi.Ready&&(!((g=(l=e.carousel)===null||l===void 0?void 0:l.panzoom)===null||g===void 0)&&g.isResting)||a.preventDefault()}}}),n.attachPlugins({Autoplay:pv}),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(fv,"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 mv={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 Do;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden"})(Do||(Do={}));const gv="isResting",Xp="thumbWidth",Cc="thumbHeight",no="thumbClipWidth";let yv=class extends Vs{constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Do.Init})}get isModern(){return this.type==="modern"}onInitSlide(t,e){const n=e.el?e.el.dataset:void 0;n&&(e.thumbSrc=n.thumbSrc||e.thumbSrc||"",e[no]=parseFloat(n[no]||"")||e[no]||0,e[Cc]=parseFloat(n.thumbHeight||"")||e[Cc]||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){kn(e,this.cn(gv));let l=((t=r.pages[u])===null||t===void 0?void 0:t.pos)||0;l+=n.getProgress(u)*(this[no]+this.thumbGap);let g=a.getBounds();-1*l>g.x.min&&-1*l<g.x.max&&a.panTo({x:-1*l,friction:.12})}else to(e,this.cn(gv),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[Xp]=t[no]&&t[Cc]?Math.round(this[Cc]*(t[no]/t[Cc])):this[Xp])}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[Xp]=e("width")||40,this[no]=e("clip-width")||40,this[Cc]=e("height")||40}build(){const t=this;if(t.state!==Do.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 _=g.querySelector("."+l);_||(_=document.createElement("div"),Ct(_,t.cn("track")),g.appendChild(_)),t.track=_;const S=Cr({},{track:_,infinite:!1,center:!0,fill:r==="classic",dragFree:!0,slidesPerPage:1,transition:!1,preload:.25,friction:.12,Panzoom:{maxVelocity:0},Dots:!1,Navigation:!1,classes:{container:"f-thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide"}},t.option("Carousel")||{},{Sync:{target:e},slides:i}),E=new e.constructor(g,S);E.on("createSlide",(T,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",(T,I,z)=>{t.onClick(z)}),t.carousel=E,t.state=Do.Ready}onClick(t){t.preventDefault(),t.stopPropagation();const e=this.instance,{pages:n,page:i}=e,r=F=>{if(F){const j=F.closest("[data-carousel-index]");if(j)return[parseInt(j.dataset.carouselIndex||"",10)||0,j]}return[-1,void 0]},a=(F,j)=>{const Z=document.elementFromPoint(F,j);return Z?r(Z):[-1,void 0]};let[u,l]=r(t.target);if(u>-1)return;const g=this[no],_=t.clientX,S=t.clientY;let[E,T]=a(_-g,S),[I,z]=a(_+g,S);T&&z?(u=Math.abs(_-T.getBoundingClientRect().right)<Math.abs(_-z.getBoundingClientRect().left)?E:I,u===i&&(u=u===E?I:E)):T?u=E:z&&(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[Xp],u=n[no],l=n.thumbGap,g=n.thumbExtraGap;if(!(!((e=r.slides[t])===null||e===void 0)&&e.el))return 0;const _=.5*(a-u),S=i.pages.length-1;let E=i.getProgress(0),T=i.getProgress(S),I=i.getProgress(t,!1,!0),z=0,F=_+g+l;const j=E<0&&E>-1,Z=T>0&&T<1;return t===0?(z=F*Math.abs(E),Z&&E===1&&(z-=F*Math.abs(T))):t===S?(z=F*Math.abs(T)*-1,j&&T===-1&&(z+=F*Math.abs(E))):j||Z?(z=-1*F,z+=F*Math.abs(E),z+=F*(1-Math.abs(T))):z=F*I,z}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=st(1-Math.abs(i.getProgress(t))),l=st(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===An.Init||i.state===An.Destroy)return;for(const u of e.slides)t.setProps(u.index);let a=(t[no]+t.thumbGap)*(r.slides.length||0);n.style.setProperty("--width",a+"")}cleanup(){const t=this;t.carousel&&t.carousel.destroy(),t.carousel=null,t.container&&t.container.remove(),t.container=null,t.track&&t.track.remove(),t.track=null,t.state=Do.Init,kn(t.instance.container,t.cn("hasThumbs"))}attach(){const t=this,e=t.instance;e.on("initSlide",t.onInitSlide),e.state===ci.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(yv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:mv});const CR=Object.assign(Object.assign({},mv),{key:"t",showOnStart:!0,parentEl:null}),_v="is-masked",xv="aria-hidden";class bv extends Vs{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hidden",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get isEnabled(){const e=this.ref;return e&&!e.isDisabled()}get isHidden(){return this.hidden}onClick(e,n){n.stopPropagation()}onCreateSlide(e,n){var i,r,a;const u=((a=(r=(i=this.instance)===null||i===void 0?void 0:i.carousel)===null||r===void 0?void 0:r.slides[n.index])===null||a===void 0?void 0:a.type)||"",l=n.el;if(l&&u){let g=`for-${u}`;["video","youtube","vimeo","html5video"].includes(u)&&(g+=" for-video"),Ct(l,g)}}onInit(){var e;const n=this,i=n.instance,r=i.carousel;if(n.ref||!r)return;const a=n.option("parentEl")||i.footer||i.container;if(!a)return;const u=Cr({},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=Cr(((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:yv}),n.ref=r.plugins.Thumbs,n.option("showOnStart")||(n.ref.state=Do.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===Do.Hidden?(e.state=Do.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(xv),n.classList.remove(_v),this.hidden=!1)}hide(){const e=this.ref,n=e&&e.container;n&&(this.refresh(),n.offsetHeight,n.classList.add(_v),n.setAttribute(xv,"true")),this.hidden=!0}refresh(){const e=this.ref;if(!e||!e.state)return;const n=e.container,i=(n==null?void 0:n.firstChild)||null;n&&i&&i.childNodes.length&&(n.style.maxHeight=`${i.getBoundingClientRect().height}px`)}attach(){const e=this,n=e.instance;n.state===Ei.Init?n.on("Carousel.init",e.onInit):e.onInit(),n.on("resize",e.onResize),n.on("keydown",e.onKeydown)}detach(){var e;const n=this,i=n.instance;i.off("Carousel.init",n.onInit),i.off("resize",n.onResize),i.off("keydown",n.onKeydown),(e=i.carousel)===null||e===void 0||e.detachPlugins(["Thumbs"]),n.ref=null}}Object.defineProperty(bv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:CR});const yy={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 yl;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Disabled=2]="Disabled"})(yl||(yl={}));const TR={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},MR={tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},vv="has-toolbar",_y="fancybox__toolbar";class wv extends Vs{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:yl.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 _=this.instance.carousel;let S=0;if(_)for(const E of _.slides)(E.panzoom||E.type==="image")&&S++;S||(a=!1)}a||(i=void 0);let u=0;const l={left:[],middle:[],right:[]};if(i)for(const _ of["left","middle","right"])for(const S of i[_]){const E=this.createEl(S);E&&((n=l[_])===null||n===void 0||n.push(E),u++)}let g=null;if(u&&(g=this.createContainer()),g){for(const[_,S]of Object.entries(l)){const E=document.createElement("div");Ct(E,_y+"__column is-"+_);for(const T of S)E.appendChild(T);r!=="auto"||_!=="middle"||S.length||(r=!0),g.appendChild(E)}r===!0&&Ct(g,"is-absolute"),this.state=yl.Ready,this.onRefresh()}else this.state=yl.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&&Tr(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 T=E.isActive;return u&&u.panMode==="mousemove"&&!T&&u.reset(),void(T?E.stop():E.start())}const _=g.panzoomAction,S=g.panzoomChange;if((S||_)&&(e.preventDefault(),e.stopPropagation()),S){let E={};try{E=JSON.parse(S)}catch{}u&&u.applyChange(E)}else _&&u&&u[_]&&u[_]()}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!==Xi.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("."+_y);return i||(i=document.createElement("div"),Ct(i,_y),n.prepend(i)),i.addEventListener("click",this.onClick,{passive:!1,capture:!0}),e&&Ct(e,vv),this.container=i,i}createEl(e){const n=this.instance,i=n.carousel;if(!i||e==="toggleFS"||e==="fullscreen"&&!nv())return null;let r=null;const a=i.slides.length||0;let u=0,l=0;for(const _ of i.slides)(_.panzoom||_.type==="image")&&u++,(_.type==="image"||_.downloadSrc)&&l++;if(a<2&&["infobar","prev","next"].includes(e))return r;if(yy[e]!==void 0&&!u||e==="download"&&!l)return null;if(e==="thumbs"){const _=n.plugins.Thumbs;if(!_||!_.isEnabled)return null}if(e==="slideshow"&&(!i.plugins.Autoplay||a<2))return null;if(yy[e]!==void 0){const _=yy[e];r=document.createElement("button"),r.setAttribute("title",this.instance.localize(`{{${e.toUpperCase()}}}`)),Ct(r,"f-button"),_.action&&(r.dataset.panzoomAction=_.action),_.change&&(r.dataset.panzoomChange=JSON.stringify(_.change)),r.appendChild(eo(this.instance.localize(_.icon)))}else{const _=(this.option("items")||[])[e];_&&(r=eo(this.instance.localize(_.tpl)),typeof _.click=="function"&&r.addEventListener("click",S=>{S.preventDefault(),S.stopPropagation(),typeof _.click=="function"&&_.click.call(this,this,S)}))}const g=r==null?void 0:r.querySelector("svg");if(g)for(const[_,S]of Object.entries(MR))g.getAttribute(_)||g.setAttribute(_,String(S));return r}removeContainer(){const e=this.container;e&&e.remove(),this.container=null,this.state=yl.Disabled;const n=this.instance.container;n&&kn(n,vv)}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(wv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:TR});const AR={Hash:class extends Vs{onReady(){mh=!1}onChange(t){ml&&clearTimeout(ml);const{hash:e}=rv(),{hash:n}=Wp(),i=t.isOpeningSlide(t.getSlide());i&&(iv=n===e?"":n),e&&e!==n&&(ml=setTimeout(()=>{try{if(t.state===Ei.Ready){let r="replaceState";i&&!qp&&(r="pushState",qp=!0),window.history[r]({},document.title,window.location.pathname+window.location.search+e)}}catch{}},300))}onClose(t){if(ml&&clearTimeout(ml),!mh&&qp)return qp=!1,mh=!1,void window.history.back();if(!mh)try{window.history.replaceState({},document.title,window.location.pathname+window.location.search+(iv||""))}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 Wp()}static startFromUrl(){sv()}static destroy(){window.removeEventListener("hashchange",av,!1)}},Html:dv,Images:cv,Slideshow:fv,Thumbs:bv,Toolbar:wv},kv="with-fancybox",xy="hide-scrollbar",Sv="--fancybox-scrollbar-compensate",Ev="--fancybox-body-margin",by="aria-hidden",vy="is-using-tab",wy="is-animated",Cv="is-compact",Tv="is-loading",ky="is-opening",Kp="has-caption",Tc="disabled",_l="tabindex",Mv="download",Sy="href",Mc="src",da=t=>typeof t=="string",Av=function(){var t=window.getSelection();return!!t&&t.type==="Range"};let ms,gs=null,xl=null,Pv=0,Iv=0,Dv=0,Ov=0;const Ac=new Map;let PR=0;class fn extends ay{get isIdle(){return this.idle}get isCompact(){return this.option("compact")}constructor(e=[],n={},i={}){super(n),Object.defineProperty(this,"userSlides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"idle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"idleTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pwt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreFocusChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"startedFs",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Ei.Init}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"lastFocus",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),ms||(ms=nv()),this.id=n.id||++PR,Ac.set(this.id,this),this.userSlides=e,this.userPlugins=i,queueMicrotask(()=>{this.init()})}init(){if(this.state===Ei.Destroy)return;this.state=Ei.Init,this.attachPlugins(Object.assign(Object.assign({},fn.Plugins),this.userPlugins)),this.emit("init"),this.emit("attachPlugins"),this.option("hideScrollbar")===!0&&(()=>{if(!fh)return;const n=document,i=n.body,r=n.documentElement;if(i.classList.contains(xy))return;let a=window.innerWidth-r.getBoundingClientRect().width;const u=parseFloat(window.getComputedStyle(i).marginRight);a<0&&(a=0),r.style.setProperty(Sv,`${a}px`),u&&i.style.setProperty(Ev,`${u}px`),i.classList.add(xy)})(),this.initLayout(),this.scale();const e=()=>{this.initCarousel(this.userSlides),this.state=Ei.Ready,this.attachEvents(),this.emit("ready"),setTimeout(()=>{this.container&&this.container.setAttribute(by,"false")},16)};this.option("Fullscreen.autoStart")&&ms&&!ms.isFullscreen()?ms.request().then(()=>{this.startedFs=!0,e()}).catch(()=>e()):e()}initLayout(){var e,n;const i=this.option("parentEl")||document.body,r=eo(this.localize(this.option("tpl.main")||""));if(r){if(r.setAttribute("id",`fancybox-${this.id}`),r.setAttribute("aria-label",this.localize("{{MODAL}}")),r.classList.toggle(Cv,this.isCompact),Ct(r,this.option("mainClass")||""),Ct(r,ky),this.container=r,this.footer=r.querySelector(".fancybox__footer"),i.appendChild(r),Ct(document.documentElement,kv),gs&&xl||(gs=document.createElement("span"),Ct(gs,"fancybox-focus-guard"),gs.setAttribute(_l,"0"),gs.setAttribute(by,"true"),gs.setAttribute("aria-label","Focus guard"),xl=gs.cloneNode(),(e=r.parentElement)===null||e===void 0||e.insertBefore(gs,r),(n=r.parentElement)===null||n===void 0||n.append(xl)),r.addEventListener("mousedown",a=>{Pv=a.pageX,Iv=a.pageY,kn(r,vy)}),this.option("closeExisting"))for(const a of Ac.values())a.id!==this.id&&a.close();else this.option("animated")&&(Ct(r,wy),setTimeout(()=>{this.isClosing()||kn(r,wy)},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,Cr({},{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&&iy(l.el))return;const g=this.container;if(g){const _=Math.abs(u.current.f),S=_<1?"":Math.max(.5,Math.min(1,1-_/u.contentRect.fitHeight*1.5));g.style.setProperty("--fancybox-ts",S?"0s":""),g.style.setProperty("--fancybox-opacity",S+"")}}),r.on("Panzoom.touchEnd",(a,u,l)=>{var g;const _=this.getSlide();if(_&&iy(_.el)||u.isMobile&&document.activeElement&&["TEXTAREA","INPUT"].indexOf((g=document.activeElement)===null||g===void 0?void 0:g.nodeName)!==-1)return;const S=Math.abs(u.dragOffset.y);u.lockedAxis==="y"&&(S>=200||S>=50&&u.dragOffset.time<300)&&(l&&l.cancelable&&l.preventDefault(),this.close(l,"f-throwOut"+(u.current.f<0?"Up":"Down")))})),r.on("change",a=>{var u;let l=(u=this.getSlide())===null||u===void 0?void 0:u.triggerEl;if(l){const g=new CustomEvent("slideTo",{bubbles:!0,cancelable:!0,detail:a.page});l.dispatchEvent(g)}}),r.on(["refresh","change"],a=>{const u=this.container;if(!u)return;for(const _ of u.querySelectorAll("[data-fancybox-current-index]"))_.innerHTML=a.page+1;for(const _ of u.querySelectorAll("[data-fancybox-count]"))_.innerHTML=a.pages.length;if(!a.isInfinite){for(const _ of u.querySelectorAll("[data-fancybox-next]"))a.page<a.pages.length-1?(_.removeAttribute(Tc),_.removeAttribute(_l)):(_.setAttribute(Tc,""),_.setAttribute(_l,"-1"));for(const _ of u.querySelectorAll("[data-fancybox-prev]"))a.page>0?(_.removeAttribute(Tc),_.removeAttribute(_l)):(_.setAttribute(Tc,""),_.setAttribute(_l,"-1"))}const l=this.getSlide();if(!l)return;let g=l.downloadSrc||"";g||l.type!=="image"||l.error||!da(l[Mc])||(g=l[Mc]);for(const _ of u.querySelectorAll("[data-fancybox-download]")){const S=l.downloadFilename;g?(_.removeAttribute(Tc),_.removeAttribute(_l),_.setAttribute(Sy,g),_.setAttribute(Mv,S||g),_.setAttribute("target","_blank")):(_.setAttribute(Tc,""),_.setAttribute(_l,"-1"),_.removeAttribute(Sy),_.removeAttribute(Mv))}}),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-Pv)>30||Math.abs(e.pageY-Iv)>30)return;const u=document.activeElement;if(Av()&&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(py)||u.blur()}if(Av())return;l=this.option("contentClick")}else a.closest(".fancybox__carousel")&&!a.matches(py)&&(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,_){return Math.abs(_)>Math.abs(g)?_: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"&&(Np(n)||(e.preventDefault(),this[u>0?"prev":"next"]()))))}onScroll(){window.scrollTo(Dv,Ov)}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&&Tr(r)&&(r.isContentEditable||["TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(r.nodeName)!==-1)||(e.key==="Tab"?Ct(this.container,vy):kn(this.container,vy),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(Cv,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===yl.Ready)return}if(!n||!e.contentEl||e.closeBtnEl)return;const i=this.option("tpl.closeButton");if(i){const r=eo(this.localize(i));e.closeBtnEl=e.contentEl.appendChild(r),e.el&&Ct(e.el,"has-close-btn")}}manageCaption(e=void 0){var n,i;const r="fancybox__caption",a=this.container;if(!a)return;kn(a,Kp);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,kn(E.el,Kp),(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 _=this.optionFor(e,"caption","");if(!_)return void(u&&this.caption&&this.animate(this.caption,"f-fadeOut",()=>{this.caption&&(this.caption.innerHTML="")}));let S=null;if(l){if(S=e.captionEl||null,g&&!S){const E=r+`_${this.id}_${e.index}`;S=document.createElement("div"),Ct(S,r),S.setAttribute("id",E),e.captionEl=g.appendChild(S),Ct(g,Kp),g.setAttribute("aria-labelledby",E)}}else S=this.caption,S||(S=a.querySelector("."+r)),!S&&(S=document.createElement("div"),S.dataset.fancyboxCaption="",Ct(S,r),(this.footer||a).prepend(S)),Ct(a,Kp),this.caption=S;S&&(S.innerHTML="",da(_)||typeof _=="number"?S.innerHTML=_+"":_ instanceof HTMLElement&&S.appendChild(_))}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===Xi.Ready?l.el:null;if(!g||g.contains(i)||a===i)return;e&&e.cancelable&&e.preventDefault(),this.ignoreFocusChange=!0;const _=Array.from(a.querySelectorAll(py));let S=[],E=null;for(let I of _){const z=!I.offsetParent||!!I.closest('[aria-hidden="true"]'),F=g&&g.contains(I),j=!u.contains(I);if(I===a||(F||j)&&!z){S.push(I);const Z=I.dataset.origTabindex;Z!==void 0&&Z&&(I.tabIndex=parseFloat(Z)),I.removeAttribute("data-orig-tabindex"),!I.hasAttribute("autoFocus")&&E||(E=I)}else{const Z=I.dataset.origTabindex===void 0?I.getAttribute("tabindex")||"":I.dataset.origTabindex;Z&&(I.dataset.origTabindex=Z),I.tabIndex=-1}}let T=null;e?(!r||S.indexOf(r)<0)&&(T=E||a,S.length&&(i===xl?T=S[0]:this.lastFocus!==a&&i!==gs||(T=S[S.length-1]))):T=l&&l.type==="image"?a:E||a,T&&tv(T),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=fn.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(),kn(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(Tr(n)?a=n:(a=eo(n+""),Tr(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}Tr(a)&&e.filter&&!e.error&&(a=a.querySelector(e.filter)),a&&Tr(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=Xi.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=Xi.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)&&(kn(this.container,ky),!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=Xi.Loading;const n=e.el;n&&(Ct(n,Tv),this.emit("loading",e),e.spinnerEl||setTimeout(()=>{if(!this.isClosing()&&!e.spinnerEl&&e.state===Xi.Loading){let i=eo(ly);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():(kn(n,Tv),i&&this.animate(i,"f-fadeOut",()=>{i.remove()}),e.state===Xi.Loading&&(this.emit("loaded",e),e.state=Xi.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&&(kn(n,"has-error"),kn(n,"has-unknown"),kn(n,`has-${e.type||"unknown"}`)),e.closeBtnEl&&e.closeBtnEl.remove(),e.closeBtnEl=void 0,e.captionEl&&e.captionEl.remove(),e.captionEl=void 0,e.spinnerEl&&e.spinnerEl.remove(),e.spinnerEl=void 0}getSlide(){var e;const n=this.carousel;return((e=n==null?void 0:n.pages[n==null?void 0:n.page])===null||e===void 0?void 0:e.slides[0])||void 0}close(e,n){if(this.isClosing())return;const i=new Event("shouldClose",{bubbles:!0,cancelable:!0});if(this.emit("shouldClose",i,e),i.defaultPrevented)return;e&&e.cancelable&&(e.preventDefault(),e.stopPropagation());const r=()=>{this.proceedClose(e,n)};this.startedFs&&ms&&ms.isFullscreen()?Promise.resolve(ms.exit()).then(()=>r()):r()}clearIdle(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=null}setIdle(e=!1){const n=()=>{this.clearIdle(),this.idle=!0,Ct(this.container,"is-idle"),this.emit("setIdle")};if(this.clearIdle(),!this.isClosing())if(e)n();else{const i=this.option("idle");i&&(this.idleTimer=setTimeout(n,i))}}endIdle(){this.clearIdle(),this.idle&&!this.isClosing()&&(this.idle=!1,kn(this.container,"is-idle"),this.emit("endIdle"))}resetIdle(){this.endIdle(),this.setIdle()}toggleIdle(){this.idle?this.endIdle():this.setIdle(!0)}toggleFullscreen(){ms&&(ms.isFullscreen()?ms.exit():ms.request().then(()=>{this.startedFs=!0}))}isClosing(){return[Ei.Closing,Ei.CustomClosing,Ei.Destroy].includes(this.state)}proceedClose(e,n){var i,r;this.state=Ei.Closing,this.clearIdle(),this.detachEvents();const a=this.container,u=this.carousel,l=this.getSlide(),g=l&&this.option("placeFocusBack")?l.triggerEl||this.option("triggerEl"):null;if(g&&(ev(g)?tv(g):g.focus()),a&&(kn(a,ky),Ct(a,"is-closing"),a.setAttribute(by,"true"),this.option("animated")&&Ct(a,wy),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 _ of u.slides){_.state=Xi.Closing,this.hideLoading(_);const S=_.contentEl;S&&this.stop(S);const E=_==null?void 0:_.panzoom;E&&(E.stop(),E.detachEvents(),E.detachObserver()),this.isCurrentSlide(_)||u.emit("removeSlide",_)}}Dv=window.scrollX,Ov=window.scrollY,window.addEventListener("scroll",this.onScroll),this.emit("close",e),this.state!==Ei.CustomClosing?(n===void 0&&l&&(n=this.optionFor(l,"hideClass")),n&&l?(this.animate(l.contentEl,n,()=>{u&&u.emit("removeSlide",l)}),setTimeout(()=>{this.destroy()},500)):this.destroy()):setTimeout(()=>{this.destroy()},500)}destroy(){var e;if(this.state===Ei.Destroy)return;window.removeEventListener("scroll",this.onScroll),this.state=Ei.Destroy,(e=this.carousel)===null||e===void 0||e.destroy();const n=this.container;n&&n.remove(),Ac.delete(this.id);const i=fn.getInstance();i?i.focus():(gs&&(gs.remove(),gs=null),xl&&(xl.remove(),xl=null),kn(document.documentElement,kv),(()=>{if(!fh)return;const r=document,a=r.body;a.classList.remove(xy),a.style.setProperty(Ev,""),r.documentElement.style.setProperty(Sv,"")})(),this.emit("destroy"))}static bind(e,n,i){if(!fh)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||!Tr(r))return;a=a||"[data-fancybox]";const l=fn.openers.get(r)||new Map;l.set(a,u),fn.openers.set(r,l),l.size===1&&r.addEventListener("click",fn.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=fn.openers.get(i);a&&r&&a.delete(r),r&&a||(fn.openers.delete(i),i.removeEventListener("click",fn.fromEvent))}static destroy(){let e;for(;e=fn.getInstance();)e.destroy();for(const n of fn.openers.keys())n.removeEventListener("click",fn.fromEvent);fn.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 z=i.dataset.fancyboxTrigger||"",F=document.querySelectorAll(`[data-fancybox="${z}"]`),j=parseInt(i.dataset.fancyboxIndex||"",10)||0;n=F[j]||n}if(!(n&&n instanceof Element))return;let r,a,u,l;if([...fn.openers].reverse().find(([z,F])=>!(!z.contains(n)||![...F].reverse().find(([j,Z])=>{let ie=n.closest(j);return!!ie&&(r=z,a=j,u=ie,l=Z,!0)}))),!r||!a||!u)return;l=l||{},e.preventDefault(),n=u;let g=[],_=Cr({},fy,l);_.event=e,_.triggerEl=n,_.delegate=i;const S=_.groupAll,E=_.groupAttr,T=E&&n?n.getAttribute(`${E}`):"";if((!n||T||S)&&(g=[].slice.call(r.querySelectorAll(a))),n&&!S&&(g=T?g.filter(z=>z.getAttribute(`${E}`)===T):[n]),!g.length)return;const I=fn.getInstance();return I&&I.options.triggerEl&&g.indexOf(I.options.triggerEl)>-1?void 0:(n&&(_.startIndex=g.indexOf(n)),fn.fromNodes(g,_))}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=fn.openers.get(r);return!!l&&(u=Cr({},l.get(a)||{},u),!!u&&fn.fromNodes(Array.from(r.querySelectorAll(a)),u))}static fromNodes(e,n){n=Cr({},fy,n||{});const i=[];for(const r of e){const a=r.dataset||{},u=a[Mc]||r.getAttribute(Sy)||r.getAttribute("currentSrc")||r.getAttribute(Mc)||void 0;let l;const g=n.delegate;let _;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&&(_=l.currentSrc||l[Mc]||void 0,!_&&l.dataset&&(_=l.dataset.lazySrc||l.dataset[Mc]||void 0));const S={src:u,triggerEl:r,thumbEl:l,thumbElSrc:_,thumbSrc:_};for(const E in a){let T=a[E]+"";T=T!=="false"&&(T==="true"||T),S[E]=T}i.push(S)}return new fn(i,n)}static getInstance(e){return e?Ac.get(e):Array.from(Ac.values()).reverse().find(n=>!n.isClosing()&&n)||null}static getSlide(){var e;return((e=fn.getInstance())===null||e===void 0?void 0:e.getSlide())||null}static show(e=[],n={}){return new fn(e,n)}static next(){const e=fn.getInstance();e&&e.next()}static prev(){const e=fn.getInstance();e&&e.prev()}static close(e=!0,...n){if(e)for(const i of Ac.values())i.close(...n);else{const i=fn.getInstance();i&&i.close(...n)}}}Object.defineProperty(fn,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(fn,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:fy}),Object.defineProperty(fn,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:AR}),Object.defineProperty(fn,"openers",{enumerable:!0,configurable:!0,writable:!0,value:new Map});const IR=Object.freeze(Object.defineProperty({__proto__:null,Carousel:ha,Fancybox:fn,Panzoom:ua},Symbol.toStringTag,{value:"Module"})),{Fancybox:Jp}=IR,DR={props:{options:Object},mounted(){Jp.defaults={...this.options||{}}},updated(){Jp.close(),Jp.defaults={...this.options||{}}},unmounted(){Jp.close()}},OR={ref:"container"};function zR(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("div",OR,[v.renderSlot(t.$slots,"default")],512)}const zv=at(DR,[["render",zR]]),RR={},LR={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 NR(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",LR,e[0]||(e[0]=[v.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),v.createElementVNode("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"},null,-1),v.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 BR={componens:{IconFile:at(RR,[["render",NR]])},props:{item:null},computed:{createDate(){try{const t=lt(this.item.cdate,"YYYY-MM-DD");return new Date(t).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}}},VR={style:{"max-width":"calc(50vw - 300px)"}},FR={class:"truncate text-sm font-semibold text-gray-800 dark:text-neutral-200"},$R={class:"block truncate text-xs text-gray-500 dark:text-neutral-500"};function jR(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock(v.Fragment,null,[e[0]||(e[0]=v.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)),v.createElementVNode("div",VR,[v.createElementVNode("p",FR,v.toDisplayString(n.item.uploaded_name),1),v.createElementVNode("p",$R,[v.createElementVNode("span",null,v.toDisplayString(n.item.username),1),v.createTextVNode(" "+v.toDisplayString(a.createDate),1)])])],64)}const UR=at(BR,[["render",jR]]),HR={},qR={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 WR(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",qR,e[0]||(e[0]=[v.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),v.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),v.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),v.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Rv=at(HR,[["render",WR]]),GR={},ZR={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 YR(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",ZR,e[0]||(e[0]=[v.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 Lv=at(GR,[["render",YR]]),XR={components:{Fancybox:zv,VsWidgetFileInfo:UR,IconDownload:Rv,IconTrash:Lv},props:{item:null},data(){return{optionsFile:{defaultType:"iframe"}}},computed:{createDate(){try{const t=lt(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 xt.delete(`/api/widget/file/${this.item.entity_id}/${this.item.file_id}`),this.$emit("update")}catch(t){console.error(t)}}}},KR={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-xl w-full"},JR={key:0,class:"flex"},QR=["href"],eL={key:1,class:"flex"},tL=["href"],nL={key:2,class:"flex gap-x-3 w-full"},iL={class:"lg:absolute lg:top-3 lg:end-3 group-hover:opacity-100 lg:opacity-0"},rL={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"},sL={class:"hs-tooltip inline-block"},oL={class:"hs-tooltip inline-block"};function aL(t,e,n,i,r,a){const u=v.resolveComponent("VsWidgetFileInfo"),l=v.resolveComponent("Fancybox"),g=v.resolveComponent("IconDownload"),_=v.resolveComponent("IconTrash");return v.openBlock(),v.createElementBlock("div",KR,[n.item.ext==="jpg"||n.item.ext==="png"?(v.openBlock(),v.createElementBlock("div",JR,[v.createVNode(l,null,{default:v.withCtx(()=>[v.createElementVNode("a",{"data-fancybox":"gallery",href:n.item.file_path,target:"_blank",class:"flex gap-x-3 w-full"},[v.createVNode(u,{item:n.item},null,8,["item"])],8,QR)]),_:1})])):a.isSupportedFile(n.item)?(v.openBlock(),v.createElementBlock("div",eL,[v.createVNode(l,{options:r.optionsFile},{default:v.withCtx(()=>[v.createElementVNode("a",{"data-fancybox":"gallery",href:n.item.file_path,target:"_blank",class:"flex gap-x-3 w-full"},[v.createVNode(u,{item:n.item},null,8,["item"])],8,tL)]),_:1},8,["options"])])):(v.openBlock(),v.createElementBlock("div",nL,[v.createVNode(u,{item:n.item},null,8,["item"])])),v.createElementVNode("div",iL,[v.createElementVNode("div",rL,[v.createElementVNode("div",sL,[v.createElementVNode("button",{class:"hs-tooltip-toggle inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[0]||(e[0]=S=>a.downloadFile(n.item))},[v.createVNode(g,{height:"14",width:"14"})])]),e[2]||(e[2]=v.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),v.createElementVNode("div",oL,[v.createElementVNode("button",{type:"button",class:"hs-tooltip-toggle size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20","data-hs-overlay":"#hs-pro-dupfmdl",onClick:e[1]||(e[1]=S=>a.confirnDeleteFile())},[v.createVNode(_,{height:"14",width:"14"})])])])])])}const lL=at(XR,[["render",aL]]),cL={props:["text"]},uL={class:"pl-3 text-sm font-medium text-gray-600"};function hL(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("div",null,[v.createElementVNode("p",uL,v.toDisplayString(n.text),1)])}const Ey=at(cL,[["render",hL]]),dL={},pL={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 fL(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",pL,e[0]||(e[0]=[v.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),v.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),v.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),v.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Nv=at(dL,[["render",fL]]),mL={components:{VsWidgetFileItem:lL,VsEmptyWidget:Ey,IconUpload:Nv},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 xt.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 xt.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}}},gL={class:"widget-file flex flex-col xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700"},yL={class:"flex justify-between w-full pb-[10px] items-center gap-x-2"},_L={key:0,class:"font-semibold text-gray-800 dark:text-neutral-200"},xL={class:"ml-auto"},bL={class:"p-2 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"},vL={key:0,class:"py-4 space-y-4 mb-4 border-y border-gray-200 dark:border-neutral-700"},wL={class:"relative"},kL={key:1,class:"space-y-3 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"},SL={key:0},EL={class:"p-4"},CL={class:"mt-1 text-gray-500 dark:text-neutral-500"},TL={class:"mt-4 flex justify-end gap-x-3"};function ML(t,e,n,i,r,a){var S,E,T;const u=v.resolveComponent("IconUpload"),l=v.resolveComponent("VsWidgetFileItem"),g=v.resolveComponent("VsEmptyWidget"),_=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock("div",gL,[v.createElementVNode("div",yL,[(S=r.files)!=null&&S.length?(v.openBlock(),v.createElementBlock("h2",_L," Кількість: "+v.toDisplayString(r.files.length),1)):v.createCommentVNode("",!0),v.createElementVNode("div",xL,[v.createElementVNode("label",null,[v.createElementVNode("input",{type:"file",class:"hidden",onChange:e[0]||(e[0]=I=>a.addFile(I))},null,32),v.createElementVNode("div",bL,[v.createVNode(u,{height:"20",width:"20"})])])])]),((E=r.files)==null?void 0:E.length)>4?(v.openBlock(),v.createElementBlock("div",vL,[v.createElementVNode("div",null,[v.createElementVNode("div",wL,[e[7]||(e[7]=v.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-20 ps-3.5"},[v.createElementVNode("svg",{class:"flex-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"},[v.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),v.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),v.withDirectives(v.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),[[v.vModelText,r.searchValue,void 0,{trim:!0}]])])])])):v.createCommentVNode("",!0),(T=r.files)!=null&&T.length?(v.openBlock(),v.createElementBlock("div",kL,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(a.filteredFiles,(I,z)=>(v.openBlock(),v.createBlock(l,{key:z,id:n.id,item:I,onUpdate:e[2]||(e[2]=F=>t.$emit("update","file-list")),onOpenModal:e[3]||(e[3]=F=>a.handleOpenModal(F))},null,8,["id","item"]))),128)),a.filteredFiles.length?v.createCommentVNode("",!0):(v.openBlock(),v.createElementBlock("div",SL,e[8]||(e[8]=[v.createElementVNode("p",{class:"text-sm font-sm text-gray-600"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):(v.openBlock(),v.createBlock(g,{key:2,text:"Файли відсутні"})),v.createVNode(_,{title:r.modal.title,size:"small",visible:r.isModalVisible,"onUpdate:visible":e[6]||(e[6]=I=>r.isModalVisible=I)},{default:v.withCtx(()=>[v.createElementVNode("div",EL,[v.createElementVNode("p",CL,v.toDisplayString(r.modal.message),1),v.createElementVNode("div",TL,[v.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[4]||(e[4]=(...I)=>r.modal.cancel&&r.modal.cancel(...I))},v.toDisplayString(r.modal.cancelButtonText),1),v.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[5]||(e[5]=(...I)=>r.modal.confirm&&r.modal.confirm(...I))},v.toDisplayString(r.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const AL=at(mL,[["render",ML]]),PL={components:{Fancybox:zv,VsEmptyWidget:Ey,IconUpload:Nv,IconTrash:Lv,IconDownload:Rv},props:{id:{type:String,default:""},readonly:{type:Boolean,default:!1},prefilledData:{type:Array,default:()=>null}},data(){return{carouselOptions:{Carousel:{infinite:!1}},isModalVisible:!1,modal:{},images:[],editAction:!1,selectedFile:null,imageExtensions:["png","jpg","jpeg","gif"]}},watch:{id(){this.getFiles()}},mounted(){this.getFiles()},methods:{async downloadFile(t){const e=document.createElement("a");e.setAttribute("download",t.uploaded_name),e.href=t.file_path,e.click()},handleOpenModal(t){this.selectedFile=t,this.modal=this.prepareModal({title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити це зображення?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:this.deleteFile,updateListOnConfirm:!0}),this.isModalVisible=!0},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.getFiles()}),e},async deleteFile(){try{await xt.delete(`/api/widget/gallery/${this.selectedFile.entity_id}/${this.selectedFile.file_id}`),this.isModalVisible=!1,this.selectedFile="",this.$emit("update","images"),this.getFiles()}catch(t){console.log(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 xt.post(i,n),this.$emit("update","file-list"),e}catch(i){return console.error(i),null}})),await this.getFiles()},async getFiles(){if(this.prefilledData){this.images=this.prefilledData;return}try{const{data:t}=await xt.get(`/api/widget/gallery/${this.id}`);this.images=t.rows}catch(t){console.error(t)}},size(t,e=2){if(t===0)return"0 Bytes";const n=1024,i=e<0?0:e,r=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],a=Math.floor(Math.log(t)/Math.log(n));return`${parseFloat((t/n**a).toFixed(i))} ${r[a]}`},dateFormat(t){const e={day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric"};return new Date(t).toLocaleDateString("uk-UK",e)}}},IL={class:"vs-widget-images flex flex-col xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700"},DL={class:"flex justify-between items-center gap-x-2 mb-4"},OL={class:"flex justify-end items-center gap-x-2"},zL={class:"p-2 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"},RL=["href"],LL=["src","alt"],NL={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"},BL={class:"text-xs w-[180px] block overflow-hidden overflow-ellipsis"},VL={class:"widget-images__item-desc flex items-center text-xs text-gray-600 flex-wrap"},FL={class:"flex items-center"},$L={class:"text-xs"},jL=["onClick"],UL=["onClick"],HL={class:"p-4"},qL={class:"mt-1 text-gray-500 dark:text-neutral-500"},WL={class:"mt-4 flex justify-end gap-x-3"};function GL(t,e,n,i,r,a){var T;const u=v.resolveComponent("IconUpload"),l=v.resolveComponent("IconDownload"),g=v.resolveComponent("IconTrash"),_=v.resolveComponent("Fancybox"),S=v.resolveComponent("VsEmptyWidget"),E=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock("div",IL,[v.createElementVNode("div",DL,[e[4]||(e[4]=v.createElementVNode("h2",{class:"inline-block font-semibold text-gray-800 dark:text-neutral-200"},null,-1)),v.createElementVNode("div",OL,[v.createElementVNode("div",null,[v.createElementVNode("label",null,[v.createElementVNode("input",{type:"file",class:"hidden",onChange:e[0]||(e[0]=I=>a.addFile(I))},null,32),v.createElementVNode("div",zL,[v.createVNode(u,{height:"20",width:"20"})])])])])]),(T=r.images)!=null&&T.length?(v.openBlock(),v.createBlock(_,{key:0,options:r.carouselOptions,class:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 overflow-auto max-h-[400px] [&::-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"},{default:v.withCtx(()=>[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(r.images,I=>(v.openBlock(),v.createElementBlock("div",{key:I.file_path,class:"relative cursor-pointer rounded-b-lg item hover:shadow-lg h-[200px]"},[v.createElementVNode("a",{"data-fancybox":"gallery",href:I.file_path},[v.createElementVNode("img",{class:"h-full w-full rounded-lg",src:I.file_path||"/icons/no-image.jpg",alt:I.uploaded_name,width:"100%",height:"100%"},null,8,LL),v.createElementVNode("div",NL,[v.createElementVNode("div",null,[v.createElementVNode("span",BL,v.toDisplayString(I.uploaded_name),1),v.createElementVNode("div",VL,[v.createElementVNode("span",FL,v.toDisplayString(a.size(I.size)),1),v.createElementVNode("span",null,v.toDisplayString(a.dateFormat(I.cdate)),1)]),v.createElementVNode("span",$L,v.toDisplayString(I.username),1)]),v.createElementVNode("div",null,[v.createElementVNode("div",{class:v.normalizeClass(["flex items-center justify-center gap-2 hover:bg-gray-200 p-[6px] rounded",{disabled:n.readonly,"hover:cursor-pointer":!n.readonly}]),onClick:v.withModifiers(z=>a.downloadFile(I),["prevent"])},[v.createVNode(l,{height:"14",width:"14"})],10,jL),v.createElementVNode("div",{class:"flex items-center gap-2 hover:bg-gray-200 p-[6px] rounded hover:cursor-pointer",onClick:v.withModifiers(z=>a.handleOpenModal(I),["prevent"])},[v.createVNode(g,{height:"14",width:"14"})],8,UL)])])],8,RL)]))),128))]),_:1},8,["options"])):(v.openBlock(),v.createBlock(S,{key:1,text:"Зображення відсутні"})),v.createVNode(E,{title:r.modal.title,size:"small",visible:r.isModalVisible,"onUpdate:visible":e[3]||(e[3]=I=>r.isModalVisible=I)},{default:v.withCtx(()=>[v.createElementVNode("div",HL,[v.createElementVNode("p",qL,v.toDisplayString(r.modal.message),1),v.createElementVNode("div",WL,[v.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]=(...I)=>r.modal.cancel&&r.modal.cancel(...I))},v.toDisplayString(r.modal.cancelButtonText),1),v.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]=(...I)=>r.modal.confirm&&r.modal.confirm(...I))},v.toDisplayString(r.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const ZL=at(PL,[["render",GL]]);function Bi(t){this.content=t}Bi.prototype={constructor:Bi,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 Bi(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 Bi(n)},addToStart:function(t,e){return new Bi([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Bi(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 Bi(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=Bi.from(t),t.size?new Bi(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Bi.from(t),t.size?new Bi(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Bi.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}},Bi.from=function(t){if(t instanceof Bi)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Bi(e)};function Bv(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=Bv(r.content,a.content,n+1);if(u!=null)return u}n+=r.nodeSize}}function Vv(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 _=0,S=Math.min(u.text.length,l.text.length);for(;_<S&&u.text[u.text.length-_-1]==l.text[l.text.length-_-1];)_++,n--,i--;return{a:n,b:i}}if(u.content.size||l.content.size){let _=Vv(u.content,l.content,n-1,i-1);if(_)return _}n-=g,i-=g}}class Fe{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let i=0;i<e.length;i++)this.size+=e[i].nodeSize}nodesBetween(e,n,i,r=0,a){for(let u=0,l=0;l<n;u++){let g=this.content[u],_=l+g.nodeSize;if(_>e&&i(g,r+l,a||null,u)!==!1&&g.content.size){let S=l+1;g.nodesBetween(Math.max(0,e-S),Math.min(g.content.size,n-S),i,r+S)}l=_}}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 _=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&&_||l.isTextblock)&&i&&(u?u=!1:a+=i),a+=_},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,i=e.firstChild,r=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(i)&&(r[r.length-1]=n.withText(n.text+i.text),a=1);a<e.content.length;a++)r.push(e.content[a]);return new Fe(r,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let i=[],r=0;if(n>e)for(let a=0,u=0;u<n;a++){let l=this.content[a],g=u+l.nodeSize;g>e&&((u<e||g>n)&&(l.isText?l=l.cut(Math.max(0,e-u),Math.min(l.text.length,n-u)):l=l.cut(Math.max(0,e-u-1),Math.min(l.content.size,n-u-1))),i.push(l),r+=l.nodeSize),u=g}return new Fe(i,r)}cutByIndex(e,n){return e==n?Fe.empty:e==0&&n==this.content.length?this:new Fe(this.content.slice(e,n))}replaceChild(e,n){let i=this.content[e];if(i==n)return this;let r=this.content.slice(),a=this.size+n.nodeSize-i.nodeSize;return r[e]=n,new Fe(r,a)}addToStart(e){return new Fe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Fe(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,i=0;n<this.content.length;n++){let r=this.content[n];e(r,i,n),i+=r.nodeSize}}findDiffStart(e,n=0){return Bv(this,e,n)}findDiffEnd(e,n=this.size,i=e.size){return Vv(this,e,n,i)}findIndex(e,n=-1){if(e==0)return Qp(0,e);if(e==this.size)return Qp(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?Qp(i+1,u):Qp(i,r);r=u}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Fe.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Fe(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Fe.empty;let n,i=0;for(let r=0;r<e.length;r++){let a=e[r];i+=a.nodeSize,r&&a.isText&&e[r-1].sameMarkup(a)?(n||(n=e.slice(0,r)),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new Fe(n||e,i)}static from(e){if(!e)return Fe.empty;if(e instanceof Fe)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Fe([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Fe.empty=new Fe([],0);const Cy={index:0,offset:0};function Qp(t,e){return Cy.index=t,Cy.offset=e,Cy}function ef(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(!ef(t[i],e[i]))return!1}else{for(let i in t)if(!(i in e)||!ef(t[i],e[i]))return!1;for(let i in e)if(!(i in t))return!1}return!0}let $n=class ux{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&&ef(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 ux.none;if(e instanceof ux)return[e];let n=e.slice();return n.sort((i,r)=>i.type.rank-r.type.rank),n}};$n.none=[];class tf extends Error{}class ht{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=$v(this.content,e+this.openStart,n);return i&&new ht(i,this.openStart,this.openEnd)}removeBetween(e,n){return new ht(Fv(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 ht.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 ht(Fe.fromJSON(e,n.content),i,r)}static maxOpen(e,n=!0){let i=0,r=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)i++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)r++;return new ht(e,i,r)}}ht.empty=new ht(Fe.empty,0,0);function Fv(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(Fv(a.content,e-r-1,n-r-1)))}function $v(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=$v(u.content,e-a-1,n);return l&&t.replaceChild(r,u.copy(l))}function YL(t,e,n){if(n.openStart>t.depth)throw new tf("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new tf("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 vl(u,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:u,end:l}=XL(n,t);return vl(a,Hv(t,u,l,e,i))}else return vl(a,nf(t,e,i))}function Uv(t,e){if(!e.type.compatibleContent(t.type))throw new tf("Cannot join "+e.type.name+" onto "+t.type.name)}function Ty(t,e,n){let i=t.node(n);return Uv(i,e.node(n)),i}function bl(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 _h(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&&(bl(t.nodeAfter,i),a++));for(let l=a;l<u;l++)bl(r.child(l),i);e&&e.depth==n&&e.textOffset&&bl(e.nodeBefore,i)}function vl(t,e){return t.type.checkContent(e),t.copy(e)}function Hv(t,e,n,i,r){let a=t.depth>r&&Ty(t,e,r+1),u=i.depth>r&&Ty(n,i,r+1),l=[];return _h(null,t,r,l),a&&u&&e.index(r)==n.index(r)?(Uv(a,u),bl(vl(a,Hv(t,e,n,i,r+1)),l)):(a&&bl(vl(a,nf(t,e,r+1)),l),_h(e,n,r,l),u&&bl(vl(u,nf(n,i,r+1)),l)),_h(i,null,r,l),new Fe(l)}function nf(t,e,n){let i=[];if(_h(null,t,n,i),t.depth>n){let r=Ty(t,e,n+1);bl(vl(r,nf(t,e,n+1)),i)}return _h(e,null,n,i),new Fe(i)}function XL(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)r=e.node(a).copy(Fe.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class xh{constructor(e,n,i){this.pos=e,this.path=n,this.parentOffset=i,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let i=this.pos-this.path[this.path.length-1],r=e.child(n);return i?e.child(n).cut(i):r}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let i=this.path[n*3],r=n==0?0:this.path[n*3-1]+1;for(let a=0;a<e;a++)r+=i.child(a).nodeSize;return r}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return $n.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 rf(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),_=a-g;if(i.push(u,l,r+g),!_||(u=u.child(l),u.isText))break;a=_-1,r+=g+1}return new xh(n,i,a)}static resolveCached(e,n){let i=qv.get(e);if(i)for(let a=0;a<i.elts.length;a++){let u=i.elts[a];if(u.pos==n)return u}else qv.set(e,i=new KL);let r=i.elts[i.i]=xh.resolve(e,n);return i.i=(i.i+1)%JL,r}}class KL{constructor(){this.elts=[],this.i=0}}const JL=12,qv=new WeakMap;class rf{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 QL=Object.create(null);let wl=class hx{constructor(e,n,i,r=$n.none){this.type=e,this.attrs=n,this.marks=r,this.content=i||Fe.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,i,r=0){this.content.nodesBetween(e,n,i,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,i,r){return this.content.textBetween(e,n,i,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,i){return this.type==e&&ef(this.attrs,n||e.defaultAttrs||QL)&&$n.sameSet(this.marks,i||$n.none)}copy(e=null){return e==this.content?this:new hx(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new hx(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 ht.empty;let r=this.resolve(e),a=this.resolve(n),u=i?0:r.sharedDepth(n),l=r.start(u),_=r.node(u).content.cut(r.pos-l,a.pos-l);return new ht(_,r.depth-u,a.depth-u)}replace(e,n,i){return YL(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()+")"),Wv(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,i=Fe.empty,r=0,a=i.childCount){let u=this.contentMatchAt(e).matchFragment(i,r,a),l=u&&u.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let g=r;g<a;g++)if(!this.type.allowsMarks(i.child(g).marks))return!1;return!0}canReplaceWith(e,n,i,r){if(r&&!this.type.allowsMarks(r))return!1;let a=this.contentMatchAt(e).matchType(i),u=a&&a.matchFragment(this.content,n);return u?u.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=$n.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(!$n.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let i;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");i=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,i)}let r=Fe.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,r,i);return a.type.checkAttrs(a.attrs),a}};wl.prototype.text=void 0;class sf extends wl{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):Wv(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 sf(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new sf(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 Wv(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class kl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let i=new eN(e,n);if(i.next==null)return kl.empty;let r=Gv(i);i.next&&i.err("Unexpected trailing text");let a=aN(oN(r));return lN(a,i),a}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,i=e.childCount){let r=this;for(let a=n;r&&a<i;a++)r=r.matchType(e.child(a).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let i=0;i<e.next.length;i++)if(this.next[n].type==e.next[i].type)return!0;return!1}fillBefore(e,n=!1,i=0){let r=[this];function a(u,l){let g=u.matchFragment(e,i);if(g&&(!n||g.validEnd))return Fe.from(l.map(_=>_.createAndFill()));for(let _=0;_<u.next.length;_++){let{type:S,next:E}=u.next[_];if(!(S.isText||S.hasRequiredAttrs())&&r.indexOf(E)==-1){r.push(E);let T=a(E,l.concat(S));if(T)return T}}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
|
-
`)}}kl.empty=new kl(!0);class eN{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 Gv(t){let e=[];do e.push(tN(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function tN(t){let e=[];do e.push(nN(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function nN(t){let e=sN(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=iN(t,e);else break;return e}function Zv(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function iN(t,e){let n=Zv(t),i=n;return t.eat(",")&&(t.next!="}"?i=Zv(t):i=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:i,expr:e}}function rN(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 sN(t){if(t.eat("(")){let e=Gv(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=rN(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 oN(t){let e=[[]];return r(a(t,0),n()),e;function n(){return e.push([])-1}function i(u,l,g){let _={term:g,to:l};return e[u].push(_),_}function r(u,l){u.forEach(g=>g.to=l)}function a(u,l){if(u.type=="choice")return u.exprs.reduce((g,_)=>g.concat(a(_,l)),[]);if(u.type=="seq")for(let g=0;;g++){let _=a(u.exprs[g],l);if(g==u.exprs.length-1)return _;r(_,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 _=0;_<u.min;_++){let S=n();r(a(u.expr,g),S),g=S}if(u.max==-1)r(a(u.expr,g),g);else for(let _=u.min;_<u.max;_++){let S=n();i(g,S),r(a(u.expr,g),S),g=S}return[i(g)]}else{if(u.type=="name")return[i(l,void 0,u.value)];throw new Error("Unknown expr type")}}}}function Yv(t,e){return e-t}function Xv(t,e){let n=[];return i(e),n.sort(Yv);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 aN(t){let e=Object.create(null);return n(Xv(t,0));function n(i){let r=[];i.forEach(u=>{t[u].forEach(({term:l,to:g})=>{if(!l)return;let _;for(let S=0;S<r.length;S++)r[S][0]==l&&(_=r[S][1]);Xv(t,g).forEach(S=>{_||r.push([l,_=[]]),_.indexOf(S)==-1&&_.push(S)})})});let a=e[i.join(",")]=new kl(i.indexOf(t.length-1)>-1);for(let u=0;u<r.length;u++){let l=r[u][1].sort(Yv);a.next.push({type:r[u][0],next:e[l.join(",")]||n(l)})}return a}}function lN(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:_}=r.next[l];u.push(g.name),a&&!(g.isText||g.hasRequiredAttrs())&&(a=!1),i.indexOf(_)==-1&&i.push(_)}a&&e.err("Only non-generatable nodes ("+u.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Kv(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 Jv(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 Qv(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 ew(t,e){let n=Object.create(null);if(e)for(let i in e)n[i]=new uN(t,i,e[i]);return n}let tw=class nC{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=ew(e,i.attrs),this.defaultAttrs=Kv(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==kl.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:Jv(this.attrs,e)}create(e=null,n,i){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new wl(this,this.computeAttrs(e),Fe.from(n),$n.setFrom(i))}createChecked(e=null,n,i){return n=Fe.from(n),this.checkContent(n),new wl(this,this.computeAttrs(e),n,$n.setFrom(i))}createAndFill(e=null,n,i){if(e=this.computeAttrs(e),n=Fe.from(n),n.size){let u=this.contentMatch.fillBefore(n);if(!u)return null;n=u.append(n)}let r=this.contentMatch.matchFragment(n),a=r&&r.fillBefore(Fe.empty,!0);return a?new wl(this,e,n.append(a),$n.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){Qv(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:$n.none:e}static compile(e,n){let i=Object.create(null);e.forEach((a,u)=>i[a]=new nC(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 cN(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 uN{constructor(e,n,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?cN(e,n,i.validate):i.validate}get isRequired(){return!this.hasDefault}}class of{constructor(e,n,i,r){this.name=e,this.rank=n,this.schema=i,this.spec=r,this.attrs=ew(e,r.attrs),this.excluded=null;let a=Kv(this.attrs);this.instance=a?new $n(this,a):null}create(e=null){return!e&&this.instance?this.instance:new $n(this,Jv(this.attrs,e))}static compile(e,n){let i=Object.create(null),r=0;return e.forEach((a,u)=>i[a]=new of(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){Qv(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class nw{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=Bi.from(e.nodes),n.marks=Bi.from(e.marks||{}),this.nodes=tw.compile(this.spec.nodes,this),this.marks=of.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]=kl.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?iw(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==""?[]:iw(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 tw){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 sf(i,i.defaultAttrs,e,$n.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return wl.fromJSON(this,e)}markFromJSON(e){return $n.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function iw(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 hN(t){return t.tag!=null}function dN(t){return t.style!=null}let bh=class dx{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let i=this.matchedStyles=[];n.forEach(r=>{if(hN(r))this.tags.push(r);else if(dN(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 aw(this,n,!1);return i.addAll(e,$n.none,n.from,n.to),i.finish()}parseSlice(e,n={}){let i=new aw(this,n,!0);return i.addAll(e,$n.none,n.from,n.to),ht.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(mN(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=lw(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=lw(u)),u.node||u.ignore||u.mark||(u.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new dx(e,dx.schemaRules(e)))}};const rw={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},pN={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},sw={ol:!0,ul:!0},af=1,lf=2,vh=4;function ow(t,e,n){return e!=null?(e?af:0)|(e==="full"?lf:0):t&&t.whitespace=="pre"?af|lf:n&~vh}class cf{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=$n.none,this.match=a||(u&vh?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Fe.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let i=this.type.contentMatch,r;return(r=i.findWrapping(e.type))?(this.match=i,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&af)){let i=this.content[this.content.length-1],r;if(i&&i.isText&&(r=/[ \t\r\n\u000c]+$/.exec(i.text))){let a=i;i.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-r[0].length))}}let n=Fe.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Fe.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!rw.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class aw{constructor(e,n,i){this.parser=e,this.options=n,this.isOpen=i,this.open=0;let r=n.topNode,a,u=ow(null,n.preserveWhitespace,0)|(i?vh:0);r?a=new cf(r.type,r.attrs,$n.none,!0,n.topMatch||r.type.contentMatch,u):i?a=new cf(null,null,$n.none,!0,null,u):a=new cf(e.schema.topNodeType,null,$n.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&lf||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(i)){if(r.options&af)r.options&lf?i=i.replace(/\r\n?/g,`
|
|
630
|
+
`)}}kl.empty=new kl(!0);class eN{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 Gv(t){let e=[];do e.push(tN(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function tN(t){let e=[];do e.push(nN(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function nN(t){let e=sN(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=iN(t,e);else break;return e}function Zv(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function iN(t,e){let n=Zv(t),i=n;return t.eat(",")&&(t.next!="}"?i=Zv(t):i=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:i,expr:e}}function rN(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 sN(t){if(t.eat("(")){let e=Gv(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=rN(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 oN(t){let e=[[]];return r(a(t,0),n()),e;function n(){return e.push([])-1}function i(u,l,g){let _={term:g,to:l};return e[u].push(_),_}function r(u,l){u.forEach(g=>g.to=l)}function a(u,l){if(u.type=="choice")return u.exprs.reduce((g,_)=>g.concat(a(_,l)),[]);if(u.type=="seq")for(let g=0;;g++){let _=a(u.exprs[g],l);if(g==u.exprs.length-1)return _;r(_,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 _=0;_<u.min;_++){let S=n();r(a(u.expr,g),S),g=S}if(u.max==-1)r(a(u.expr,g),g);else for(let _=u.min;_<u.max;_++){let S=n();i(g,S),r(a(u.expr,g),S),g=S}return[i(g)]}else{if(u.type=="name")return[i(l,void 0,u.value)];throw new Error("Unknown expr type")}}}}function Yv(t,e){return e-t}function Xv(t,e){let n=[];return i(e),n.sort(Yv);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 aN(t){let e=Object.create(null);return n(Xv(t,0));function n(i){let r=[];i.forEach(u=>{t[u].forEach(({term:l,to:g})=>{if(!l)return;let _;for(let S=0;S<r.length;S++)r[S][0]==l&&(_=r[S][1]);Xv(t,g).forEach(S=>{_||r.push([l,_=[]]),_.indexOf(S)==-1&&_.push(S)})})});let a=e[i.join(",")]=new kl(i.indexOf(t.length-1)>-1);for(let u=0;u<r.length;u++){let l=r[u][1].sort(Yv);a.next.push({type:r[u][0],next:e[l.join(",")]||n(l)})}return a}}function lN(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:_}=r.next[l];u.push(g.name),a&&!(g.isText||g.hasRequiredAttrs())&&(a=!1),i.indexOf(_)==-1&&i.push(_)}a&&e.err("Only non-generatable nodes ("+u.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Kv(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 Jv(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 Qv(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 ew(t,e){let n=Object.create(null);if(e)for(let i in e)n[i]=new uN(t,i,e[i]);return n}let tw=class nC{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=ew(e,i.attrs),this.defaultAttrs=Kv(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==kl.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:Jv(this.attrs,e)}create(e=null,n,i){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new wl(this,this.computeAttrs(e),Fe.from(n),$n.setFrom(i))}createChecked(e=null,n,i){return n=Fe.from(n),this.checkContent(n),new wl(this,this.computeAttrs(e),n,$n.setFrom(i))}createAndFill(e=null,n,i){if(e=this.computeAttrs(e),n=Fe.from(n),n.size){let u=this.contentMatch.fillBefore(n);if(!u)return null;n=u.append(n)}let r=this.contentMatch.matchFragment(n),a=r&&r.fillBefore(Fe.empty,!0);return a?new wl(this,e,n.append(a),$n.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){Qv(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:$n.none:e}static compile(e,n){let i=Object.create(null);e.forEach((a,u)=>i[a]=new nC(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 cN(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 uN{constructor(e,n,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?cN(e,n,i.validate):i.validate}get isRequired(){return!this.hasDefault}}class of{constructor(e,n,i,r){this.name=e,this.rank=n,this.schema=i,this.spec=r,this.attrs=ew(e,r.attrs),this.excluded=null;let a=Kv(this.attrs);this.instance=a?new $n(this,a):null}create(e=null){return!e&&this.instance?this.instance:new $n(this,Jv(this.attrs,e))}static compile(e,n){let i=Object.create(null),r=0;return e.forEach((a,u)=>i[a]=new of(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){Qv(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class nw{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=Bi.from(e.nodes),n.marks=Bi.from(e.marks||{}),this.nodes=tw.compile(this.spec.nodes,this),this.marks=of.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]=kl.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?iw(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==""?[]:iw(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 tw){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 sf(i,i.defaultAttrs,e,$n.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return wl.fromJSON(this,e)}markFromJSON(e){return $n.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function iw(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 hN(t){return t.tag!=null}function dN(t){return t.style!=null}let bh=class dx{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let i=this.matchedStyles=[];n.forEach(r=>{if(hN(r))this.tags.push(r);else if(dN(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 aw(this,n,!1);return i.addAll(e,$n.none,n.from,n.to),i.finish()}parseSlice(e,n={}){let i=new aw(this,n,!0);return i.addAll(e,$n.none,n.from,n.to),ht.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(mN(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=lw(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=lw(u)),u.node||u.ignore||u.mark||(u.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new dx(e,dx.schemaRules(e)))}};const rw={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},pN={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},sw={ol:!0,ul:!0},af=1,lf=2,vh=4;function ow(t,e,n){return e!=null?(e?af:0)|(e==="full"?lf:0):t&&t.whitespace=="pre"?af|lf:n&~vh}class cf{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=$n.none,this.match=a||(u&vh?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Fe.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let i=this.type.contentMatch,r;return(r=i.findWrapping(e.type))?(this.match=i,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&af)){let i=this.content[this.content.length-1],r;if(i&&i.isText&&(r=/[ \t\r\n\u000c]+$/.exec(i.text))){let a=i;i.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-r[0].length))}}let n=Fe.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Fe.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!rw.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class aw{constructor(e,n,i){this.parser=e,this.options=n,this.isOpen=i,this.open=0;let r=n.topNode,a,u=ow(null,n.preserveWhitespace,0)|(i?vh:0);r?a=new cf(r.type,r.attrs,$n.none,!0,n.topMatch||r.type.contentMatch,u):i?a=new cf(null,null,$n.none,!0,null,u):a=new cf(e.schema.topNodeType,null,$n.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&lf||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(i)){if(r.options&af)r.options&lf?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;sw.hasOwnProperty(r)&&this.parser.normalizeLists&&fN(e);let u=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,i));if(u?u.ignore:pN.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,_=this.needsBlock;if(rw.hasOwnProperty(r))g.content.length&&g.content[0].isInline&&this.open&&(this.open--,g=this.top),l=!0,g.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);return}let S=u&&u.skip?n:this.readStyles(e,n);S&&this.addAll(e,S),l&&this.sync(g),this.needsBlock=_}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(_=>!g.clearMark(_)):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=$n.none;for(let u of i.concat(e.marks))(r.type?r.type.allowsMarkType(u.type):cw(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=ow(e,a,u.options);u.options&vh&&u.content.length==0&&(l|=vh);let g=$n.none;return i=i.filter(_=>(u.type?u.type.allowsMarkType(_.type):cw(_.type,e))?(g=_.addToSet(g),!1):!0),this.nodes.push(new cf(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 _=n[l];if(_==""){if(l==n.length-1||l==0)continue;for(;g>=a;g--)if(u(l-1,g))return!0;return!1}else{let S=g>0||g==0&&r?this.nodes[g].type:i&&g>=a?i.node(g-a).type:null;if(!S||S.name!=_&&S.groups.indexOf(_)==-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 fN(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&sw.hasOwnProperty(i)&&n?(n.appendChild(e),e=n):i=="li"?n=e:i&&(n=null)}}function mN(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function lw(t){let e={};for(let n in t)e[n]=t[n];return e}function cw(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:_,next:S}=l.edge(g);if(_==e||a.indexOf(S)<0&&u(S))return!0}};if(u(r.contentMatch))return!0}}class Sl{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},i){i||(i=My(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 _=u.marks[g];if(!this.marks[_.type.name]){g++;continue}if(!_.eq(a[l][0])||_.type.spec.spanning===!1)break;l++,g++}for(;l<a.length;)r=a.pop()[1];for(;g<u.marks.length;){let _=u.marks[g++],S=this.serializeMark(_,u.isInline,n);S&&(a.push([_,r]),r.appendChild(S.dom),r=S.contentDOM||S.dom)}}r.appendChild(this.serializeNodeInner(u,n))}),i}serializeNodeInner(e,n){let{dom:i,contentDOM:r}=uf(My(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&&uf(My(i),r(e,n),null,e.attrs)}static renderSpec(e,n,i=null,r){return uf(e,n,i,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Sl(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=uw(e.nodes);return n.text||(n.text=i=>i.text),n}static marksFromSchema(e){return uw(e.marks)}}function uw(t){let e={};for(let n in t){let i=t[n].spec.toDOM;i&&(e[n]=i)}return e}function My(t){return t.document||window.document}const hw=new WeakMap;function gN(t){let e=hw.get(t);return e===void 0&&hw.set(t,e=yN(t)),e}function yN(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 uf(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=gN(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),_=e[1],S=1;if(_&&typeof _=="object"&&_.nodeType==null&&!Array.isArray(_)){S=2;for(let E in _)if(_[E]!=null){let T=E.indexOf(" ");T>0?g.setAttributeNS(E.slice(0,T),E.slice(T+1),_[E]):g.setAttribute(E,_[E])}}for(let E=S;E<e.length;E++){let T=e[E];if(T===0){if(E<e.length-1||E>S)throw new RangeError("Content hole must be the only child of its parent node");return{dom:g,contentDOM:g}}else{let{dom:I,contentDOM:z}=uf(t,T,n,i);if(g.appendChild(I),z){if(l)throw new RangeError("Multiple content holes");l=z}}}return{dom:g,contentDOM:l}}const dw=65535,pw=Math.pow(2,16);function _N(t,e){return t+e*pw}function fw(t){return t&dw}function xN(t){return(t-(t&dw))/pw}const mw=1,gw=2,hf=4,yw=8;class Ay{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&yw)>0}get deletedBefore(){return(this.delInfo&(mw|hf))>0}get deletedAfter(){return(this.delInfo&(gw|hf))>0}get deletedAcross(){return(this.delInfo&hf)>0}}class Wr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Wr.empty)return Wr.empty}recover(e){let n=0,i=fw(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+xN(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 _=this.ranges[l+a],S=this.ranges[l+u],E=g+_;if(e<=E){let T=_?e==g?-1:e==E?1:n:n,I=g+r+(T<0?0:S);if(i)return I;let z=e==(n<0?g:E)?null:_N(l/3,e-g),F=e==g?gw:e==E?mw:hf;return(n<0?e!=g:e!=E)&&(F|=yw),new Ay(I,F,z)}r+=S-_}return i?e+r:new Ay(e+r,0,null)}touches(e,n){let i=0,r=fw(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 _=this.ranges[l+a],S=g+_;if(e<=S&&l==r*3)return!0;i+=this.ranges[l+u]-_}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),_=this.ranges[r+n],S=this.ranges[r+i];e(l,l+_,g,g+S),a+=S-_}}invert(){return new Wr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Wr.empty:new Wr(e<0?[0,-e,0]:[0,0,e])}}Wr.empty=new Wr([]);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 Ay(e,r,null)}}const Py=Object.create(null);class Ki{getMap(){return Wr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=Py[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 Py)throw new RangeError("Duplicate use of step JSON ID "+e);return Py[e]=n,n.prototype.jsonID=e,n}}class ui{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new ui(e,null)}static fail(e){return new ui(null,e)}static fromReplace(e,n,i,r){try{return ui.ok(e.replace(n,i,r))}catch(a){if(a instanceof tf)return ui.fail(a.message);throw a}}}function Iy(t,e,n){let i=[];for(let r=0;r<t.childCount;r++){let a=t.child(r);a.content.size&&(a=a.copy(Iy(a.content,e,a))),a.isInline&&(a=e(a,n,r)),i.push(a)}return Fe.fromArray(i)}class pa extends Ki{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 ht(Iy(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 ui.fromReplace(e,this.from,this.to,a)}invert(){return new io(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new pa(n.pos,i.pos,this.mark)}merge(e){return e instanceof pa&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new pa(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new pa(n.from,n.to,e.markFromJSON(n.mark))}}Ki.jsonID("addMark",pa);class io extends Ki{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 ht(Iy(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return ui.fromReplace(e,this.from,this.to,i)}invert(){return new pa(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new io(n.pos,i.pos,this.mark)}merge(e){return e instanceof io&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new io(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new io(n.from,n.to,e.markFromJSON(n.mark))}}Ki.jsonID("removeMark",io);class fa extends Ki{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ui.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return ui.fromReplace(e,this.pos,this.pos+1,new ht(Fe.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let i=this.mark.addToSet(n.marks);if(i.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(i))return new fa(this.pos,n.marks[r]);return new fa(this.pos,this.mark)}}return new Ic(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))}}Ki.jsonID("addNodeMark",fa);class Ic extends Ki{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ui.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return ui.fromReplace(e,this.pos,this.pos+1,new ht(Fe.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new fa(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ic(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 Ic(n.pos,e.markFromJSON(n.mark))}}Ki.jsonID("removeNodeMark",Ic);class Ci extends Ki{constructor(e,n,i,r=!1){super(),this.from=e,this.to=n,this.slice=i,this.structure=r}apply(e){return this.structure&&Dy(e,this.from,this.to)?ui.fail("Structure replace would overwrite content"):ui.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Wr([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ci(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deletedAcross&&i.deletedAcross?null:new Ci(n.pos,Math.max(n.pos,i.pos),this.slice)}merge(e){if(!(e instanceof Ci)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?ht.empty:new ht(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ci(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?ht.empty:new ht(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ci(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ci(n.from,n.to,ht.fromJSON(e,n.slice),!!n.structure)}}Ki.jsonID("replace",Ci);class Ti extends Ki{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&&(Dy(e,this.from,this.gapFrom)||Dy(e,this.gapTo,this.to)))return ui.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return ui.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,n.content);return i?ui.fromReplace(e,this.from,this.to,i):ui.fail("Content does not fit in gap")}getMap(){return new Wr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Ti(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return n.deletedAcross&&i.deletedAcross||r<n.pos||a>i.pos?null:new Ti(n.pos,i.pos,r,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ti(n.from,n.to,n.gapFrom,n.gapTo,ht.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ki.jsonID("replaceAround",Ti);function Dy(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 bN(t,e,n,i){let r=[],a=[],u,l;t.doc.nodesBetween(e,n,(g,_,S)=>{if(!g.isInline)return;let E=g.marks;if(!i.isInSet(E)&&S.type.allowsMarkType(i.type)){let T=Math.max(_,e),I=Math.min(_+g.nodeSize,n),z=i.addToSet(E);for(let F=0;F<E.length;F++)E[F].isInSet(z)||(u&&u.to==T&&u.mark.eq(E[F])?u.to=I:r.push(u=new io(T,I,E[F])));l&&l.to==T?l.to=I:a.push(l=new pa(T,I,i))}}),r.forEach(g=>t.step(g)),a.forEach(g=>t.step(g))}function vN(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 of){let _=u.marks,S;for(;S=i.isInSet(_);)(g||(g=[])).push(S),_=S.removeFromSet(_)}else i?i.isInSet(u.marks)&&(g=[i]):g=u.marks;if(g&&g.length){let _=Math.min(l+u.nodeSize,n);for(let S=0;S<g.length;S++){let E=g[S],T;for(let I=0;I<r.length;I++){let z=r[I];z.step==a-1&&E.eq(r[I].style)&&(T=z)}T?(T.to=_,T.step=a):r.push({style:E,from:Math.max(l,e),to:_,step:a})}}}),r.forEach(u=>t.step(new io(u.from,u.to,u.style)))}function _w(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 _=a.child(g),S=l+_.nodeSize,E=i.matchType(_.type);if(!E)u.push(new Ci(l,S,ht.empty));else{i=E;for(let T=0;T<_.marks.length;T++)n.allowsMarkType(_.marks[T].type)||t.step(new io(l,S,_.marks[T]));if(r&&_.isText&&n.whitespace!="pre"){let T,I=/\r?\n|\r/g,z;for(;T=I.exec(_.text);)z||(z=new ht(Fe.from(n.schema.text(" ",n.allowedMarks(_.marks))),0,0)),u.push(new Ci(l+T.index,l+T.index+T[0].length,z))}}l=S}if(!i.validEnd){let g=i.fillBefore(Fe.empty,!0);t.replace(l,l,new ht(g,0,0))}for(let g=u.length-1;g>=0;g--)t.step(u[g])}function wN(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Dc(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||!wN(r,a,u))break}return null}function kN(t,e,n){let{$from:i,$to:r,depth:a}=e,u=i.before(a+1),l=r.after(a+1),g=u,_=l,S=Fe.empty,E=0;for(let z=a,F=!1;z>n;z--)F||i.index(z)>0?(F=!0,S=Fe.from(i.node(z).copy(S)),E++):g--;let T=Fe.empty,I=0;for(let z=a,F=!1;z>n;z--)F||r.after(z+1)<r.end(z)?(F=!0,T=Fe.from(r.node(z).copy(T)),I++):_++;t.step(new Ti(g,_,u,l,new ht(S.append(T),E,I),S.size-E,!0))}function Oy(t,e,n=null,i=t){let r=SN(t,e),a=r&&EN(i,e);return a?r.map(xw).concat({type:e,attrs:n}).concat(a.map(xw)):null}function xw(t){return{type:t,attrs:null}}function SN(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 EN(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 _=i;g&&_<r;_++)g=g.matchType(n.child(_).type);return!g||!g.validEnd?null:u}function CN(t,e,n){let i=Fe.empty;for(let u=n.length-1;u>=0;u--){if(i.size){let l=n[u].type.contentMatch.matchFragment(i);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=Fe.from(n[u].type.create(n[u].attrs,i))}let r=e.start,a=e.end;t.step(new Ti(r,a,r,a,new ht(i,0,0),n.length,!0))}function TN(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)&&PN(t.doc,t.mapping.slice(a).map(l),i)){let _=null;if(i.schema.linebreakReplacement){let I=i.whitespace=="pre",z=!!i.contentMatch.matchType(i.schema.linebreakReplacement);I&&!z?_=!1:!I&&z&&(_=!0)}_===!1&&AN(t,u,l,a),_w(t,t.mapping.slice(a).map(l,1),i,void 0,_===null);let S=t.mapping.slice(a),E=S.map(l,1),T=S.map(l+u.nodeSize,1);return t.step(new Ti(E,T,E+1,T-1,new ht(Fe.from(i.create(g,null,u.marks)),0,0),1,!0)),_===!0&&MN(t,u,l,a),!1}})}function MN(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 AN(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(_=>!g.clearMark(_)):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=$n.none;for(let u of i.concat(e.marks))(r.type?r.type.allowsMarkType(u.type):cw(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=ow(e,a,u.options);u.options&vh&&u.content.length==0&&(l|=vh);let g=$n.none;return i=i.filter(_=>(u.type?u.type.allowsMarkType(_.type):cw(_.type,e))?(g=_.addToSet(g),!1):!0),this.nodes.push(new cf(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 _=n[l];if(_==""){if(l==n.length-1||l==0)continue;for(;g>=a;g--)if(u(l-1,g))return!0;return!1}else{let S=g>0||g==0&&r?this.nodes[g].type:i&&g>=a?i.node(g-a).type:null;if(!S||S.name!=_&&!S.isInGroup(_))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 fN(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&sw.hasOwnProperty(i)&&n?(n.appendChild(e),e=n):i=="li"?n=e:i&&(n=null)}}function mN(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function lw(t){let e={};for(let n in t)e[n]=t[n];return e}function cw(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:_,next:S}=l.edge(g);if(_==e||a.indexOf(S)<0&&u(S))return!0}};if(u(r.contentMatch))return!0}}class Sl{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},i){i||(i=My(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 _=u.marks[g];if(!this.marks[_.type.name]){g++;continue}if(!_.eq(a[l][0])||_.type.spec.spanning===!1)break;l++,g++}for(;l<a.length;)r=a.pop()[1];for(;g<u.marks.length;){let _=u.marks[g++],S=this.serializeMark(_,u.isInline,n);S&&(a.push([_,r]),r.appendChild(S.dom),r=S.contentDOM||S.dom)}}r.appendChild(this.serializeNodeInner(u,n))}),i}serializeNodeInner(e,n){let{dom:i,contentDOM:r}=uf(My(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&&uf(My(i),r(e,n),null,e.attrs)}static renderSpec(e,n,i=null,r){return uf(e,n,i,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Sl(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=uw(e.nodes);return n.text||(n.text=i=>i.text),n}static marksFromSchema(e){return uw(e.marks)}}function uw(t){let e={};for(let n in t){let i=t[n].spec.toDOM;i&&(e[n]=i)}return e}function My(t){return t.document||window.document}const hw=new WeakMap;function gN(t){let e=hw.get(t);return e===void 0&&hw.set(t,e=yN(t)),e}function yN(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 uf(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=gN(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),_=e[1],S=1;if(_&&typeof _=="object"&&_.nodeType==null&&!Array.isArray(_)){S=2;for(let E in _)if(_[E]!=null){let T=E.indexOf(" ");T>0?g.setAttributeNS(E.slice(0,T),E.slice(T+1),_[E]):g.setAttribute(E,_[E])}}for(let E=S;E<e.length;E++){let T=e[E];if(T===0){if(E<e.length-1||E>S)throw new RangeError("Content hole must be the only child of its parent node");return{dom:g,contentDOM:g}}else{let{dom:I,contentDOM:z}=uf(t,T,n,i);if(g.appendChild(I),z){if(l)throw new RangeError("Multiple content holes");l=z}}}return{dom:g,contentDOM:l}}const dw=65535,pw=Math.pow(2,16);function _N(t,e){return t+e*pw}function fw(t){return t&dw}function xN(t){return(t-(t&dw))/pw}const mw=1,gw=2,hf=4,yw=8;class Ay{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&yw)>0}get deletedBefore(){return(this.delInfo&(mw|hf))>0}get deletedAfter(){return(this.delInfo&(gw|hf))>0}get deletedAcross(){return(this.delInfo&hf)>0}}class Wr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Wr.empty)return Wr.empty}recover(e){let n=0,i=fw(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+xN(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 _=this.ranges[l+a],S=this.ranges[l+u],E=g+_;if(e<=E){let T=_?e==g?-1:e==E?1:n:n,I=g+r+(T<0?0:S);if(i)return I;let z=e==(n<0?g:E)?null:_N(l/3,e-g),F=e==g?gw:e==E?mw:hf;return(n<0?e!=g:e!=E)&&(F|=yw),new Ay(I,F,z)}r+=S-_}return i?e+r:new Ay(e+r,0,null)}touches(e,n){let i=0,r=fw(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 _=this.ranges[l+a],S=g+_;if(e<=S&&l==r*3)return!0;i+=this.ranges[l+u]-_}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),_=this.ranges[r+n],S=this.ranges[r+i];e(l,l+_,g,g+S),a+=S-_}}invert(){return new Wr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Wr.empty:new Wr(e<0?[0,-e,0]:[0,0,e])}}Wr.empty=new Wr([]);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 Ay(e,r,null)}}const Py=Object.create(null);class Ki{getMap(){return Wr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=Py[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 Py)throw new RangeError("Duplicate use of step JSON ID "+e);return Py[e]=n,n.prototype.jsonID=e,n}}class ui{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new ui(e,null)}static fail(e){return new ui(null,e)}static fromReplace(e,n,i,r){try{return ui.ok(e.replace(n,i,r))}catch(a){if(a instanceof tf)return ui.fail(a.message);throw a}}}function Iy(t,e,n){let i=[];for(let r=0;r<t.childCount;r++){let a=t.child(r);a.content.size&&(a=a.copy(Iy(a.content,e,a))),a.isInline&&(a=e(a,n,r)),i.push(a)}return Fe.fromArray(i)}class pa extends Ki{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 ht(Iy(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 ui.fromReplace(e,this.from,this.to,a)}invert(){return new io(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new pa(n.pos,i.pos,this.mark)}merge(e){return e instanceof pa&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new pa(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new pa(n.from,n.to,e.markFromJSON(n.mark))}}Ki.jsonID("addMark",pa);class io extends Ki{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 ht(Iy(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return ui.fromReplace(e,this.from,this.to,i)}invert(){return new pa(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new io(n.pos,i.pos,this.mark)}merge(e){return e instanceof io&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new io(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new io(n.from,n.to,e.markFromJSON(n.mark))}}Ki.jsonID("removeMark",io);class fa extends Ki{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ui.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return ui.fromReplace(e,this.pos,this.pos+1,new ht(Fe.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let i=this.mark.addToSet(n.marks);if(i.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(i))return new fa(this.pos,n.marks[r]);return new fa(this.pos,this.mark)}}return new Ic(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))}}Ki.jsonID("addNodeMark",fa);class Ic extends Ki{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ui.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return ui.fromReplace(e,this.pos,this.pos+1,new ht(Fe.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new fa(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ic(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 Ic(n.pos,e.markFromJSON(n.mark))}}Ki.jsonID("removeNodeMark",Ic);class Ci extends Ki{constructor(e,n,i,r=!1){super(),this.from=e,this.to=n,this.slice=i,this.structure=r}apply(e){return this.structure&&Dy(e,this.from,this.to)?ui.fail("Structure replace would overwrite content"):ui.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Wr([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ci(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deletedAcross&&i.deletedAcross?null:new Ci(n.pos,Math.max(n.pos,i.pos),this.slice)}merge(e){if(!(e instanceof Ci)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?ht.empty:new ht(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ci(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?ht.empty:new ht(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ci(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ci(n.from,n.to,ht.fromJSON(e,n.slice),!!n.structure)}}Ki.jsonID("replace",Ci);class Ti extends Ki{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&&(Dy(e,this.from,this.gapFrom)||Dy(e,this.gapTo,this.to)))return ui.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return ui.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,n.content);return i?ui.fromReplace(e,this.from,this.to,i):ui.fail("Content does not fit in gap")}getMap(){return new Wr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Ti(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return n.deletedAcross&&i.deletedAcross||r<n.pos||a>i.pos?null:new Ti(n.pos,i.pos,r,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ti(n.from,n.to,n.gapFrom,n.gapTo,ht.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ki.jsonID("replaceAround",Ti);function Dy(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 bN(t,e,n,i){let r=[],a=[],u,l;t.doc.nodesBetween(e,n,(g,_,S)=>{if(!g.isInline)return;let E=g.marks;if(!i.isInSet(E)&&S.type.allowsMarkType(i.type)){let T=Math.max(_,e),I=Math.min(_+g.nodeSize,n),z=i.addToSet(E);for(let F=0;F<E.length;F++)E[F].isInSet(z)||(u&&u.to==T&&u.mark.eq(E[F])?u.to=I:r.push(u=new io(T,I,E[F])));l&&l.to==T?l.to=I:a.push(l=new pa(T,I,i))}}),r.forEach(g=>t.step(g)),a.forEach(g=>t.step(g))}function vN(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 of){let _=u.marks,S;for(;S=i.isInSet(_);)(g||(g=[])).push(S),_=S.removeFromSet(_)}else i?i.isInSet(u.marks)&&(g=[i]):g=u.marks;if(g&&g.length){let _=Math.min(l+u.nodeSize,n);for(let S=0;S<g.length;S++){let E=g[S],T;for(let I=0;I<r.length;I++){let z=r[I];z.step==a-1&&E.eq(r[I].style)&&(T=z)}T?(T.to=_,T.step=a):r.push({style:E,from:Math.max(l,e),to:_,step:a})}}}),r.forEach(u=>t.step(new io(u.from,u.to,u.style)))}function _w(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 _=a.child(g),S=l+_.nodeSize,E=i.matchType(_.type);if(!E)u.push(new Ci(l,S,ht.empty));else{i=E;for(let T=0;T<_.marks.length;T++)n.allowsMarkType(_.marks[T].type)||t.step(new io(l,S,_.marks[T]));if(r&&_.isText&&n.whitespace!="pre"){let T,I=/\r?\n|\r/g,z;for(;T=I.exec(_.text);)z||(z=new ht(Fe.from(n.schema.text(" ",n.allowedMarks(_.marks))),0,0)),u.push(new Ci(l+T.index,l+T.index+T[0].length,z))}}l=S}if(!i.validEnd){let g=i.fillBefore(Fe.empty,!0);t.replace(l,l,new ht(g,0,0))}for(let g=u.length-1;g>=0;g--)t.step(u[g])}function wN(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Dc(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||!wN(r,a,u))break}return null}function kN(t,e,n){let{$from:i,$to:r,depth:a}=e,u=i.before(a+1),l=r.after(a+1),g=u,_=l,S=Fe.empty,E=0;for(let z=a,F=!1;z>n;z--)F||i.index(z)>0?(F=!0,S=Fe.from(i.node(z).copy(S)),E++):g--;let T=Fe.empty,I=0;for(let z=a,F=!1;z>n;z--)F||r.after(z+1)<r.end(z)?(F=!0,T=Fe.from(r.node(z).copy(T)),I++):_++;t.step(new Ti(g,_,u,l,new ht(S.append(T),E,I),S.size-E,!0))}function Oy(t,e,n=null,i=t){let r=SN(t,e),a=r&&EN(i,e);return a?r.map(xw).concat({type:e,attrs:n}).concat(a.map(xw)):null}function xw(t){return{type:t,attrs:null}}function SN(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 EN(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 _=i;g&&_<r;_++)g=g.matchType(n.child(_).type);return!g||!g.validEnd?null:u}function CN(t,e,n){let i=Fe.empty;for(let u=n.length-1;u>=0;u--){if(i.size){let l=n[u].type.contentMatch.matchFragment(i);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=Fe.from(n[u].type.create(n[u].attrs,i))}let r=e.start,a=e.end;t.step(new Ti(r,a,r,a,new ht(i,0,0),n.length,!0))}function TN(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)&&PN(t.doc,t.mapping.slice(a).map(l),i)){let _=null;if(i.schema.linebreakReplacement){let I=i.whitespace=="pre",z=!!i.contentMatch.matchType(i.schema.linebreakReplacement);I&&!z?_=!1:!I&&z&&(_=!0)}_===!1&&AN(t,u,l,a),_w(t,t.mapping.slice(a).map(l,1),i,void 0,_===null);let S=t.mapping.slice(a),E=S.map(l,1),T=S.map(l+u.nodeSize,1);return t.step(new Ti(E,T,E+1,T-1,new ht(Fe.from(i.create(g,null,u.marks)),0,0),1,!0)),_===!0&&MN(t,u,l,a),!1}})}function MN(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 AN(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 PN(t,e,n){let i=t.resolve(e),r=i.index();return i.parent.canReplaceWith(r,r+1,n)}function IN(t,e,n,i,r){let a=t.doc.nodeAt(e);if(!a)throw new RangeError("No node at given position");n||(n=a.type);let u=n.create(i,null,r||a.marks);if(a.isLeaf)return t.replaceWith(e,e+a.nodeSize,u);if(!n.validContent(a.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Ti(e,e+a.nodeSize,e+1,e+a.nodeSize-1,new ht(Fe.from(u),0,0),1,!0))}function Oc(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 _=r.depth-1,S=n-2;_>a;_--,S--){let E=r.node(_),T=r.index(_);if(E.type.spec.isolating)return!1;let I=E.content.cutByIndex(T,E.childCount),z=i&&i[S+1];z&&(I=I.replaceChild(0,z.type.create(z.attrs)));let F=i&&i[S]||E;if(!E.canReplace(T+1,E.childCount)||!F.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 DN(t,e,n=1,i){let r=t.doc.resolve(e),a=Fe.empty,u=Fe.empty;for(let l=r.depth,g=r.depth-n,_=n-1;l>g;l--,_--){a=Fe.from(r.node(l).copy(a));let S=i&&i[_];u=Fe.from(S?S.type.create(S.attrs,u):r.node(l).copy(u))}t.step(new Ci(e,e,new ht(a.append(u),n,n),!0))}function ma(t,e){let n=t.resolve(e),i=n.index();return bw(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(i,i+1)}function bw(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function df(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&&bw(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 ON(t,e,n){let i=new Ci(e-n,e+n,ht.empty,!0);t.step(i)}function zN(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 vw(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),_=i.node(u),S=!1;if(a==1)S=_.canReplace(g,g,r);else{let E=_.contentMatchAt(g).findWrapping(r.firstChild.type);S=E&&_.canReplaceWith(g,g,E[0])}if(S)return l==0?i.pos:l<0?i.before(u+1):i.after(u+1)}return null}function pf(t,e,n=e,i=ht.empty){if(e==n&&!i.size)return null;let r=t.resolve(e),a=t.resolve(n);return ww(r,a,i)?new Ci(e,n,i):new RN(r,a,i).fit()}function ww(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class RN{constructor(e,n,i){this.$from=e,this.$to=n,this.unplaced=i,this.frontier=[],this.placed=Fe.empty;for(let r=0;r<=e.depth;r++){let a=e.node(r);this.frontier.push({type:a.type,match:a.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=Fe.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let _=this.findFittable();_?this.placeNodes(_):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 ht(a,u,l);return e>-1?new Ti(i.pos,e,this.$to.pos,this.$to.end(),g,n):g.size||i.pos!=this.$to.pos?new Ci(i.pos,r.pos,g):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,i=0,r=this.unplaced.openEnd;i<e;i++){let a=n.firstChild;if(n.childCount>1&&(r=0),a.type.spec.isolating&&r<=i){e=i;break}n=a.content}for(let n=1;n<=2;n++)for(let i=n==1?e:this.unplaced.openStart;i>=0;i--){let r,a=null;i?(a=zy(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:_}=this.frontier[l],S,E=null;if(n==1&&(u?_.matchType(u.type)||(E=_.fillBefore(Fe.from(u),!1)):a&&g.compatibleContent(a.type)))return{sliceDepth:i,frontierDepth:l,parent:a,inject:E};if(n==2&&u&&(S=_.findWrapping(u.type)))return{sliceDepth:i,frontierDepth:l,parent:a,wrap:S};if(a&&_.matchType(a.type))break}}}openMore(){let{content:e,openStart:n,openEnd:i}=this.unplaced,r=zy(e,n);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new ht(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=zy(e,n);if(r.childCount<=1&&n>0){let a=e.size-n<=n+r.size;this.unplaced=new ht(wh(e,n-1,1),n-1,a?n-1:i)}else this.unplaced=new ht(wh(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 F=0;F<a.length;F++)this.openFrontierNode(a[F]);let u=this.unplaced,l=i?i.content:u.content,g=u.openStart-e,_=0,S=[],{match:E,type:T}=this.frontier[n];if(r){for(let F=0;F<r.childCount;F++)S.push(r.child(F));E=E.matchFragment(r)}let I=l.size+e-(u.content.size-u.openEnd);for(;_<l.childCount;){let F=l.child(_),j=E.matchType(F.type);if(!j)break;_++,(_>1||g==0||F.content.size)&&(E=j,S.push(kw(F.mark(T.allowedMarks(F.marks)),_==1?g:0,_==l.childCount?I:-1)))}let z=_==l.childCount;z||(I=-1),this.placed=kh(this.placed,n,Fe.from(S)),this.frontier[n].match=E,z&&I<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let F=0,j=l;F<I;F++){let Z=j.lastChild;this.frontier.push({type:Z.type,match:Z.contentMatchAt(Z.childCount)}),j=Z.content}this.unplaced=z?e==0?ht.empty:new ht(wh(u.content,e-1,1),e-1,I<0?u.openEnd:e-1):new ht(wh(u.content,e,_),u.openStart,u.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Ry(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=Ry(e,n,r,i,a);if(u){for(let l=n-1;l>=0;l--){let{match:g,type:_}=this.frontier[l],S=Ry(e,l,_,g,!0);if(!S||S.childCount)continue e}return{depth:n,fit:u,move:a?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=kh(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=kh(this.placed,this.depth,Fe.from(e.create(n,i))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Fe.empty,!0);n.childCount&&(this.placed=kh(this.placed,this.frontier.length,n))}}function wh(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(wh(t.firstChild.content,e-1,n)))}function kh(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(kh(t.lastChild.content,e-1,n)))}function zy(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function kw(t,e,n){if(e<=0)return t;let i=t.content;return e>1&&(i=i.replaceChild(0,kw(i.firstChild,e-1,i.childCount==1?n-1:0))),e>0&&(i=t.type.contentMatch.fillBefore(i).append(i),n<=0&&(i=i.append(t.type.contentMatch.matchFragment(i).fillBefore(Fe.empty,!0)))),t.copy(i)}function Ry(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&&!LN(n,a.content,u)?l:null}function LN(t,e,n){for(let i=n;i<e.childCount;i++)if(!t.allowsMarks(e.child(i).marks))return!0;return!1}function NN(t){return t.spec.defining||t.spec.definingForContent}function BN(t,e,n,i){if(!i.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),a=t.doc.resolve(n);if(ww(r,a,i))return t.step(new Ci(e,n,i));let u=Ew(r,t.doc.resolve(n));u[u.length-1]==0&&u.pop();let l=-(r.depth+1);u.unshift(l);for(let T=r.depth,I=r.pos-1;T>0;T--,I--){let z=r.node(T).type.spec;if(z.defining||z.definingAsContext||z.isolating)break;u.indexOf(T)>-1?l=T:r.before(T)==I&&u.splice(1,0,-T)}let g=u.indexOf(l),_=[],S=i.openStart;for(let T=i.content,I=0;;I++){let z=T.firstChild;if(_.push(z),I==i.openStart)break;T=z.content}for(let T=S-1;T>=0;T--){let I=_[T],z=NN(I.type);if(z&&!I.sameMarkup(r.node(Math.abs(l)-1)))S=T;else if(z||!I.type.isTextblock)break}for(let T=i.openStart;T>=0;T--){let I=(T+S+1)%(i.openStart+1),z=_[I];if(z)for(let F=0;F<u.length;F++){let j=u[(F+g)%u.length],Z=!0;j<0&&(Z=!1,j=-j);let ie=r.node(j-1),le=r.index(j-1);if(ie.canReplaceWith(le,le,z.type,z.marks))return t.replace(r.before(j),Z?a.after(j):n,new ht(Sw(i.content,0,i.openStart,I),I,i.openEnd))}}let E=t.steps.length;for(let T=u.length-1;T>=0&&(t.replace(e,n,i),!(t.steps.length>E));T--){let I=u[T];I<0||(e=r.before(I),n=a.after(I))}}function Sw(t,e,n,i,r){if(e<n){let a=t.firstChild;t=t.replaceChild(0,a.copy(Sw(a.content,e+1,n,i,a)))}if(e>i){let a=r.contentMatchAt(0),u=a.fillBefore(t).append(t);t=u.append(a.matchFragment(u).fillBefore(Fe.empty,!0))}return t}function VN(t,e,n,i){if(!i.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let r=zN(t.doc,e,i.type);r!=null&&(e=n=r)}t.replaceRange(e,n,new ht(Fe.from(i),0,0))}function FN(t,e,n){let i=t.doc.resolve(e),r=t.doc.resolve(n),a=Ew(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 Ew(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 Ki{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 ui.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 ui.fromReplace(e,this.pos,this.pos+1,new ht(Fe.from(r),0,n.isLeaf?0:1))}getMap(){return Wr.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)}}Ki.jsonID("attr",zc);class Sh extends Ki{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 ui.ok(i)}getMap(){return Wr.empty}invert(e){return new Sh(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 Sh(n.attr,n.value)}}Ki.jsonID("docAttr",Sh);let Rc=class extends Error{};Rc=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},Rc.prototype=Object.create(Error.prototype),Rc.prototype.constructor=Rc,Rc.prototype.name="TransformError";class $N{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 Rc(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=ht.empty){let r=pf(this.doc,e,n,i);return r&&this.step(r),this}replaceWith(e,n,i){return this.replace(e,n,new ht(Fe.from(i),0,0))}delete(e,n){return this.replace(e,n,ht.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,i){return BN(this,e,n,i),this}replaceRangeWith(e,n,i){return VN(this,e,n,i),this}deleteRange(e,n){return FN(this,e,n),this}lift(e,n){return kN(this,e,n),this}join(e,n=1){return ON(this,e,n),this}wrap(e,n){return CN(this,e,n),this}setBlockType(e,n=e,i,r=null){return TN(this,e,n,i,r),this}setNodeMarkup(e,n,i=null,r){return IN(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 Sh(e,n)),this}addNodeMark(e,n){return this.step(new fa(e,n)),this}removeNodeMark(e,n){if(!(n instanceof $n)){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 Ic(e,n)),this}split(e,n=1,i){return DN(this,e,n,i),this}addMark(e,n,i){return bN(this,e,n,i),this}removeMark(e,n,i){return vN(this,e,n,i),this}clearIncompatible(e,n,i){return _w(this,e,n,i),this}}const Ly=Object.create(null);class Gt{constructor(e,n,i){this.$anchor=e,this.$head=n,this.ranges=i||[new jN(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=ht.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:_}=u[l],S=e.mapping.slice(a);e.replaceRange(S.map(g.pos),S.map(_.pos),l?ht.empty:n),l==0&&Mw(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),_=g.map(u.pos),S=g.map(l.pos);a?e.deleteRange(_,S):(e.replaceRangeWith(_,S,n),Mw(e,i,n.isInline?-1:1))}}static findFrom(e,n,i=!1){let r=e.parent.inlineContent?new Ft(e):Lc(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?Lc(e.node(0),e.node(a),e.before(a+1),e.index(a),n,i):Lc(e.node(0),e.node(a),e.after(a+1),e.index(a)+1,n,i);if(u)return u}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Fs(e.node(0))}static atStart(e){return Lc(e,e,0,0,1)||new Fs(e)}static atEnd(e){return Lc(e,e,e.content.size,e.childCount,-1)||new Fs(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let i=Ly[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 Ly)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ly[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Ft.between(this.$anchor,this.$head).getBookmark()}}Gt.prototype.visible=!0;class jN{constructor(e,n){this.$from=e,this.$to=n}}let Cw=!1;function Tw(t){!Cw&&!t.parent.inlineContent&&(Cw=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Ft extends Gt{constructor(e,n=e){Tw(e),Tw(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 Ft(r.parent.inlineContent?r:i,i)}replace(e,n=ht.empty){if(super.replace(e,n),n==ht.empty){let i=this.$from.marksAcross(this.$to);i&&e.ensureMarks(i)}}eq(e){return e instanceof Ft&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ff(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 Ft(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 Ft(e,n)}}Gt.jsonID("text",Ft);class ff{constructor(e,n){this.anchor=e,this.head=n}map(e){return new ff(e.map(this.anchor),e.map(this.head))}resolve(e){return Ft.between(e.resolve(this.anchor),e.resolve(this.head))}}class zt 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 zt(a)}content(){return new ht(Fe.from(this.node),0,0)}eq(e){return e instanceof zt&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ny(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new zt(e.resolve(n.anchor))}static create(e,n){return new zt(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}zt.prototype.visible=!1,Gt.jsonID("node",zt);class Ny{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:i}=e.mapResult(this.anchor);return n?new ff(i,i):new Ny(i)}resolve(e){let n=e.resolve(this.anchor),i=n.nodeAfter;return i&&zt.isSelectable(i)?new zt(n):Gt.near(n)}}class Fs extends Gt{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ht.empty){if(n==ht.empty){e.delete(0,e.doc.content.size);let i=Gt.atStart(e.doc);i.eq(e.selection)||e.setSelection(i)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Fs(e)}map(e){return new Fs(e)}eq(e){return e instanceof Fs}getBookmark(){return UN}}Gt.jsonID("all",Fs);const UN={map(){return this},resolve(t){return new Fs(t)}};function Lc(t,e,n,i,r,a=!1){if(e.inlineContent)return Ft.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&&zt.isSelectable(l))return zt.create(t,n-(r<0?l.nodeSize:0))}else{let g=Lc(t,l,n+r,r<0?l.childCount:0,r,a);if(g)return g}n+=l.nodeSize*r}return null}function Mw(t,e,n){let i=t.steps.length-1;if(i<e)return;let r=t.steps[i];if(!(r instanceof Ci||r instanceof Ti))return;let a=t.mapping.maps[i],u;a.forEach((l,g,_,S)=>{u==null&&(u=S)}),t.setSelection(Gt.near(t.doc.resolve(u),n))}const Aw=1,mf=2,Pw=4;class HN extends $N{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|Aw)&~mf,this.storedMarks=null,this}get selectionSet(){return(this.updated&Aw)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=mf,this}ensureMarks(e){return $n.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&mf)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~mf,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)||$n.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|=Pw,this}get scrolledIntoView(){return(this.updated&Pw)>0}}function Iw(t,e){return!e||!t?t:t.bind(e)}class Eh{constructor(e,n,i){this.name=e,this.init=Iw(n.init,i),this.apply=Iw(n.apply,i)}}const qN=[new Eh("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Eh("selection",{init(t,e){return t.selection||Gt.atStart(e.doc)},apply(t){return t.selection}}),new Eh("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,i){return i.selection.$cursor?t.storedMarks:null}}),new Eh("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class By{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=qN.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 Eh(i.key,i.spec.state,i))})}}class Nc{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,_=r?r[u].state:this,S=g<n.length&&l.spec.appendTransaction.call(l,g?n.slice(g):n,_,i);if(S&&i.filterTransaction(S,u)){if(S.setMeta("appendedTransaction",e),!r){r=[];for(let E=0;E<this.config.plugins.length;E++)r.push(E<u?{state:i,n:n.length}:{state:this,n:0})}n.push(S),i=i.applyInner(S),a=!0}r&&(r[u]={state:i,n:n.length})}}if(!a)return{state:i,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Nc(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 HN(this)}static create(e){let n=new By(e.doc?e.doc.type.schema:e.schema,e.plugins),i=new Nc(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 By(this.schema,e.plugins),i=n.fields,r=new Nc(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 By(e.schema,e.plugins),a=new Nc(r);return r.fields.forEach(u=>{if(u.name=="doc")a.doc=wl.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],_=g.spec.state;if(g.key==u.name&&_&&_.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){a[u.name]=_.fromJSON.call(g,e,n[l],a);return}}a[u.name]=u.init(e,a)}}),a}}function Dw(t,e,n){for(let i in t){let r=t[i];r instanceof Function?r=r.bind(e):i=="handleDOMEvents"&&(r=Dw(r,e,{})),n[i]=r}return n}class Vi{constructor(e){this.spec=e,this.props={},e.props&&Dw(e.props,this,this.props),this.key=e.key?e.key.key:Ow("plugin")}getState(e){return e[this.key]}}const Vy=Object.create(null);function Ow(t){return t in Vy?t+"$"+ ++Vy[t]:(Vy[t]=0,t+"$")}class Mr{constructor(e="key"){this.key=Ow(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Fi=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ch=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Fy=null;const Oo=function(t,e,n){let i=Fy||(Fy=document.createRange());return i.setEnd(t,n??t.nodeValue.length),i.setStart(t,e||0),i},WN=function(){Fy=null},El=function(t,e,n,i){return n&&(zw(t,e,n,i,-1)||zw(t,e,n,i,1))},GN=/^(img|br|input|textarea|hr)$/i;function zw(t,e,n,i,r){for(;;){if(t==n&&e==i)return!0;if(e==(r<0?0:ys(t))){let a=t.parentNode;if(!a||a.nodeType!=1||Th(t)||GN.test(t.nodeName)||t.contentEditable=="false")return!1;e=Fi(t)+(r<0?0:1),t=a}else if(t.nodeType==1){if(t=t.childNodes[e+(r<0?-1:0)],t.contentEditable=="false")return!1;e=r<0?ys(t):0}else return!1}}function ys(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ZN(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=ys(t)}else if(t.parentNode&&!Th(t))e=Fi(t),t=t.parentNode;else return null}}function YN(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&&!Th(t))e=Fi(t)+1,t=t.parentNode;else return null}}function XN(t,e,n){for(let i=e==0,r=e==ys(t);i||r;){if(t==n)return!0;let a=Fi(t);if(t=t.parentNode,!t)return!1;i=i&&a==0,r=r&&a==ys(t)}}function Th(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 gf=function(t){return t.focusNode&&El(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Cl(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function KN(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function JN(t,e,n){if(t.caretPositionFromPoint)try{let i=t.caretPositionFromPoint(e,n);if(i)return{node:i.offsetNode,offset:Math.min(ys(i.offsetNode),i.offset)}}catch{}if(t.caretRangeFromPoint){let i=t.caretRangeFromPoint(e,n);if(i)return{node:i.startContainer,offset:Math.min(ys(i.startContainer),i.startOffset)}}}const ro=typeof navigator<"u"?navigator:null,Rw=typeof document<"u"?document:null,ga=ro&&ro.userAgent||"",$y=/Edge\/(\d+)/.exec(ga),Lw=/MSIE \d/.exec(ga),jy=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ga),Ar=!!(Lw||jy||$y),ya=Lw?document.documentMode:jy?+jy[1]:$y?+$y[1]:0,$s=!Ar&&/gecko\/(\d+)/i.test(ga);$s&&+(/Firefox\/(\d+)/.exec(ga)||[0,0])[1];const Uy=!Ar&&/Chrome\/(\d+)/.exec(ga),Ji=!!Uy,Nw=Uy?+Uy[1]:0,ur=!Ar&&!!ro&&/Apple Computer/.test(ro.vendor),Bc=ur&&(/Mobile\/\w+/.test(ga)||!!ro&&ro.maxTouchPoints>2),_s=Bc||(ro?/Mac/.test(ro.platform):!1),QN=ro?/Win/.test(ro.platform):!1,js=/Android \d/.test(ga),Mh=!!Rw&&"webkitFontSmoothing"in Rw.documentElement.style,eB=Mh?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function tB(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 zo(t,e){return typeof t=="number"?t:t[e]}function nB(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 Bw(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=Ch(u)){if(u.nodeType!=1)continue;let l=u,g=l==a.body,_=g?tB(a):nB(l),S=0,E=0;if(e.top<_.top+zo(i,"top")?E=-(_.top-e.top+zo(r,"top")):e.bottom>_.bottom-zo(i,"bottom")&&(E=e.bottom-e.top>_.bottom-_.top?e.top+zo(r,"top")-_.top:e.bottom-_.bottom+zo(r,"bottom")),e.left<_.left+zo(i,"left")?S=-(_.left-e.left+zo(r,"left")):e.right>_.right-zo(i,"right")&&(S=e.right-_.right+zo(r,"right")),S||E)if(g)a.defaultView.scrollBy(S,E);else{let T=l.scrollLeft,I=l.scrollTop;E&&(l.scrollTop+=E),S&&(l.scrollLeft+=S);let z=l.scrollLeft-T,F=l.scrollTop-I;e={left:e.left-z,top:e.top-F,right:e.right-z,bottom:e.bottom-F}}if(g||/^(fixed|sticky)$/.test(getComputedStyle(u).position))break}}function iB(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:Vw(t.dom)}}function Vw(t){let e=[],n=t.ownerDocument;for(let i=t;i&&(e.push({dom:i,top:i.scrollTop,left:i.scrollLeft}),t!=n);i=Ch(i));return e}function rB({refDOM:t,refTop:e,stack:n}){let i=t?t.getBoundingClientRect().top:0;Fw(n,i==0?0:i-e)}function Fw(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 Vc=null;function sB(t){if(t.setActive)return t.setActive();if(Vc)return t.focus(Vc);let e=Vw(t);t.focus(Vc==null?{get preventScroll(){return Vc={preventScroll:!0},!0}}:void 0),Vc||(Vc=!1,Fw(e,0))}function $w(t,e){let n,i=2e8,r,a=0,u=e.top,l=e.top,g,_;for(let S=t.firstChild,E=0;S;S=S.nextSibling,E++){let T;if(S.nodeType==1)T=S.getClientRects();else if(S.nodeType==3)T=Oo(S).getClientRects();else continue;for(let I=0;I<T.length;I++){let z=T[I];if(z.top<=u&&z.bottom>=l){u=Math.max(z.bottom,u),l=Math.min(z.top,l);let F=z.left>e.left?z.left-e.left:z.right<e.left?e.left-z.right:0;if(F<i){n=S,i=F,r=F&&n.nodeType==3?{left:z.right<e.left?z.right:z.left,top:e.top}:e,S.nodeType==1&&F&&(a=E+(e.left>=(z.left+z.right)/2?1:0));continue}}else z.top>e.top&&!g&&z.left<=e.left&&z.right>=e.left&&(g=S,_={left:Math.max(z.left,Math.min(z.right,e.left)),top:z.top});!n&&(e.left>=z.right&&e.top>=z.top||e.left>=z.left&&e.top>=z.bottom)&&(a=E+1)}}return!n&&g&&(n=g,r=_,i=0),n&&n.nodeType==3?oB(n,r):!n||i&&n.nodeType==1?{node:t,offset:a}:$w(n,r)}function oB(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&&Hy(e,a))return{node:t,offset:r+(e.left>=(a.left+a.right)/2?1:0)}}return{node:t,offset:0}}function Hy(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function aB(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function lB(t,e,n){let{node:i,offset:r}=$w(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 cB(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 _=l[g];if(Hy(e,_))return jw(u,e,_)}}if((a=(a+1)%i)==r)break}return t}function uB(t,e){let n=t.dom.ownerDocument,i,r=0,a=JN(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 _=t.dom.getBoundingClientRect();if(!Hy(e,_)||(u=jw(t.dom,e,_),!u))return null}if(ur)for(let _=u;i&&_;_=Ch(_))_.draggable&&(i=void 0);if(u=aB(u,e),i){if($s&&i.nodeType==1&&(r=Math.min(r,i.childNodes.length),r<i.childNodes.length)){let S=i.childNodes[r],E;S.nodeName=="IMG"&&(E=S.getBoundingClientRect()).right<=e.left&&E.bottom>e.top&&r++}let _;Mh&&r&&i.nodeType==1&&(_=i.childNodes[r-1]).nodeType==1&&_.contentEditable=="false"&&_.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=cB(t,i,r,e))}l==null&&(l=lB(t,u,e));let g=t.docView.nearestDesc(u,!0);return{pos:l,inside:g?g.posAtStart-g.border:-1}}function Uw(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(Uw(i))return i}return Array.prototype.find.call(n,Uw)||t.getBoundingClientRect()}const hB=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Hw(t,e,n){let{node:i,offset:r,atom:a}=t.docView.domFromPos(e,n<0?-1:1),u=Mh||$s;if(i.nodeType==3)if(u&&(hB.test(i.nodeValue)||(n<0?!r:r==i.nodeValue.length))){let g=_a(Oo(i,r,r),n);if($s&&r&&/\s/.test(i.nodeValue[r-1])&&r<i.nodeValue.length){let _=_a(Oo(i,r-1,r-1),-1);if(_.top==g.top){let S=_a(Oo(i,r,r+1),-1);if(S.top!=g.top)return Ah(S,S.left<_.left)}}return g}else{let g=r,_=r,S=n<0?1:-1;return n<0&&!r?(_++,S=-1):n>=0&&r==i.nodeValue.length?(g--,S=1):n<0?g--:_++,Ah(_a(Oo(i,g,_),S),S<0)}if(!t.state.doc.resolve(e-(a||0)).parent.inlineContent){if(a==null&&r&&(n<0||r==ys(i))){let g=i.childNodes[r-1];if(g.nodeType==1)return qy(g.getBoundingClientRect(),!1)}if(a==null&&r<ys(i)){let g=i.childNodes[r];if(g.nodeType==1)return qy(g.getBoundingClientRect(),!0)}return qy(i.getBoundingClientRect(),n>=0)}if(a==null&&r&&(n<0||r==ys(i))){let g=i.childNodes[r-1],_=g.nodeType==3?Oo(g,ys(g)-(u?0:1)):g.nodeType==1&&(g.nodeName!="BR"||!g.nextSibling)?g:null;if(_)return Ah(_a(_,1),!1)}if(a==null&&r<ys(i)){let g=i.childNodes[r];for(;g.pmViewDesc&&g.pmViewDesc.ignoreForCoords;)g=g.nextSibling;let _=g?g.nodeType==3?Oo(g,0,u?0:1):g.nodeType==1?g:null:null;if(_)return Ah(_a(_,-1),!0)}return Ah(_a(i.nodeType==3?Oo(i):i,-n),n>=0)}function Ah(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 qy(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function qw(t,e,n){let i=t.state,r=t.root.activeElement;i!=e&&t.updateState(e),r!=t.dom&&t.focus();try{return n()}finally{i!=e&&t.updateState(i),r!=t.dom&&r&&r.focus()}}function dB(t,e,n){let i=e.selection,r=n=="up"?i.$from:i.$to;return qw(t,e,()=>{let{node:a}=t.docView.domFromPos(r.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(a,!0);if(!l)break;if(l.node.isBlock){a=l.contentDOM||l.dom;break}a=l.dom.parentNode}let u=Hw(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=Oo(l,0,l.nodeValue.length).getClientRects();else continue;for(let _=0;_<g.length;_++){let S=g[_];if(S.bottom>S.top+1&&(n=="up"?u.top-S.top>(S.bottom-u.top)*2:S.bottom-u.bottom>(u.bottom-S.top)*2))return!1}}return!0})}const pB=/[\u0590-\u08ac]/;function fB(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?!pB.test(i.parent.textContent)||!l.modify?n=="left"||n=="backward"?a:u:qw(t,e,()=>{let{focusNode:g,focusOffset:_,anchorNode:S,anchorOffset:E}=t.domSelectionRange(),T=l.caretBidiLevel;l.modify("move",n,"character");let I=i.depth?t.docView.domAfterPos(i.before()):t.dom,{focusNode:z,focusOffset:F}=t.domSelectionRange(),j=z&&!I.contains(z.nodeType==1?z:z.parentNode)||g==z&&_==F;try{l.collapse(S,E),g&&(g!=S||_!=E)&&l.extend&&l.extend(g,_)}catch{}return T!=null&&(l.caretBidiLevel=T),j}):i.pos==i.start()||i.pos==i.end()}let Ww=null,Gw=null,Zw=!1;function mB(t,e,n){return Ww==e&&Gw==n?Zw:(Ww=e,Gw=n,Zw=n=="up"||n=="down"?dB(t,e,n):fB(t,e,n))}const xs=0,Yw=1,Tl=2,so=3;class Ph{constructor(e,n,i,r){this.parent=e,this.children=n,this.dom=i,this.contentDOM=r,this.dirty=xs,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>Fi(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 Jw){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 Xw&&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?Fi(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?Fi(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],_=u+g.size;if(r==-1&&e<=_){let S=u+g.border;if(e>=S&&n<=_-g.border&&g.node&&g.contentDOM&&this.contentDOM.contains(g.contentDOM))return g.parseRange(e,n,S);e=u;for(let E=l;E>0;E--){let T=this.children[E-1];if(T.size&&T.dom.parentNode==this.contentDOM&&!T.emptyChildAt(1)){r=Fi(T.dom)+1;break}e-=T.size}r==-1&&(r=0)}if(r>-1&&(_>n||l==this.children.length-1)){n=_;for(let S=l+1;S<this.children.length;S++){let E=this.children[S];if(E.size&&E.dom.parentNode==this.contentDOM&&!E.emptyChildAt(-1)){a=Fi(E.dom);break}n+=E.size}a==-1&&(a=this.contentDOM.childNodes.length);break}u=_}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 T=0,I=0;T<this.children.length;T++){let z=this.children[T],F=I+z.size;if(a>I&&u<F)return z.setSelection(e-I-z.border,n-I-z.border,i,r);I=F}let l=this.domFromPos(e,e?-1:1),g=n==e?l:this.domFromPos(n,n?-1:1),_=i.getSelection(),S=!1;if(($s||ur)&&e==n){let{node:T,offset:I}=l;if(T.nodeType==3){if(S=!!(I&&T.nodeValue[I-1]==`
|
|
634
634
|
`),S&&I==T.nodeValue.length)for(let z=T,F;z;z=z.parentNode){if(F=z.nextSibling){F.nodeName=="BR"&&(l=g={node:F.parentNode,offset:Fi(F)+1});break}let j=z.pmViewDesc;if(j&&j.node&&j.node.isBlock)break}}else{let z=T.childNodes[I-1];S=z&&(z.nodeName=="BR"||z.contentEditable=="false")}}if($s&&_.focusNode&&_.focusNode!=g.node&&_.focusNode.nodeType==1){let T=_.focusNode.childNodes[_.focusOffset];T&&T.contentEditable=="false"&&(r=!0)}if(!(r||S&&ur)&&El(l.node,l.offset,_.anchorNode,_.anchorOffset)&&El(g.node,g.offset,_.focusNode,_.focusOffset))return;let E=!1;if((_.extend||e==n)&&!S){_.collapse(l.node,l.offset);try{e!=n&&_.extend(g.node,g.offset),E=!0}catch{}}if(!E){if(e>n){let I=l;l=g,g=I}let T=document.createRange();T.setEnd(g.node,g.offset),T.setStart(l.node,l.offset),_.removeAllRanges(),_.addRange(T)}}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?Tl:Yw,e==l&&n==g&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=so:a.markDirty(e-l,n-l);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?Tl:so}i=u}this.dirty=Tl}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let i=e==1?Tl:Yw;n.dirty<i&&(n.dirty=i)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class Xw 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==xs&&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 gB 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 Ml 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=Sl.renderSpec(document,n.type.spec.toDOM(n,i),null,n.attrs)),new Ml(e,n,u.dom,u.contentDOM||u.dom)}parseRule(){return this.dirty&so||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=so&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=xs){let i=this.parent;for(;!i.node;)i=i.parent;i.dirty<this.dirty&&(i.dirty=this.dirty),this.dirty=xs}}slice(e,n,i){let r=Ml.create(this.parent,this.mark,!0,i),a=this.children,u=this.size;n<u&&(a=Gy(a,n,u,i)),e>0&&(a=Gy(a,0,e,i));for(let l=0;l<a.length;l++)a[l].parent=r;return r.children=a,r}}class xa extends Ph{constructor(e,n,i,r,a,u,l,g,_){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,_=l&&l(n,a,()=>{if(!g)return u;if(g.parent)return g.parent.posBeforeChild(g)},i,r),S=_&&_.dom,E=_&&_.contentDOM;if(n.isText){if(!S)S=document.createTextNode(n.text);else if(S.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else S||({dom:S,contentDOM:E}=Sl.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!E&&!n.isText&&S.nodeName!="BR"&&(S.hasAttribute("contenteditable")||(S.contentEditable="false"),n.type.spec.draggable&&(S.draggable=!0));let T=S;return S=tk(S,i,n),_?g=new yB(e,n,i,r,S,E||null,T,_,a,u+1):n.isText?new yf(e,n,i,r,S,T,a):new xa(e,n,i,r,S,E||null,T,a,u+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let i=this.children[n];if(this.dom.contains(i.dom.parentNode)){e.contentElement=i.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Fe.empty)}return e}matchesNode(e,n,i){return this.dirty==xs&&e.eq(this.node)&&_f(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 xB(this,u&&u.node,e);wB(this.node,this.innerDeco,(_,S,E)=>{_.spec.marks?g.syncToMarks(_.spec.marks,i,e):_.type.side>=0&&!E&&g.syncToMarks(S==this.node.childCount?$n.none:this.node.child(S).marks,i,e),g.placeWidget(_,e,r)},(_,S,E,T)=>{g.syncToMarks(_.marks,i,e);let I;g.findNodeMatch(_,S,E,T)||l&&e.state.selection.from>r&&e.state.selection.to<r+_.nodeSize&&(I=g.findIndexWithChild(a.node))>-1&&g.updateNodeAt(_,S,E,I,e)||g.updateNextNode(_,S,E,e,T,r)||g.addNode(_,S,E,e,r),r+=_.nodeSize}),g.syncToMarks([],i,e),this.node.isTextblock&&g.addTextblockHacks(),g.destroyRest(),(g.changed||this.dirty==Tl)&&(u&&this.protectLocalComposition(e,u),Qw(this.contentDOM,this.children,e),Bc&&kB(this.dom))}localCompositionInfo(e,n){let{from:i,to:r}=e.state.selection;if(!(e.state.selection instanceof Ft)||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=SB(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 gB(this,a,n,r);e.input.compositionNodes.push(u),this.children=Gy(this.children,i,i+r.length,e,u)}update(e,n,i,r){return this.dirty==so||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,i,r),!0)}updateInner(e,n,i,r){this.updateOuterDeco(n),this.node=e,this.innerDeco=i,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=xs}updateOuterDeco(e){if(_f(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,i=this.dom;this.dom=ek(this.dom,this.nodeDOM,Wy(this.outerDeco,this.node,n),Wy(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 Kw(t,e,n,i,r){tk(i,e,t);let a=new xa(void 0,t,e,n,i,i,i,r,0);return a.contentDOM&&a.updateChildren(r,0),a}class yf extends xa{constructor(e,n,i,r,a,u,l){super(e,n,i,r,a,null,u,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,i,r){return this.dirty==so||this.dirty!=xs&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=xs||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=xs,!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 yf(this.parent,r,this.outerDeco,this.innerDeco,a,a,i)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=so)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Jw extends Ph{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==xs&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class yB extends xa{constructor(e,n,i,r,a,u,l,g,_,S){super(e,n,i,r,a,u,l,_,S),this.spec=g}update(e,n,i,r){if(this.dirty==so)return!1;if(this.spec.update){let a=this.spec.update(e,n,i);return a&&this.updateInner(e,n,i,r),a}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,i,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,i,r){this.spec.setSelection?this.spec.setSelection(e,n,i):super.setSelection(e,n,i,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Qw(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=nk(i),r=!0;i=i.nextSibling}else r=!0,t.insertBefore(l,i);if(u instanceof Ml){let g=i?i.previousSibling:t.lastChild;Qw(u.contentDOM,u.children,n),i=g?g.nextSibling:t.firstChild}}for(;i;)i=nk(i),r=!0;r&&n.trackWrites==t&&(n.trackWrites=null)}const Ih=function(t){t&&(this.nodeName=t)};Ih.prototype=Object.create(null);const Al=[new Ih];function Wy(t,e,n){if(t.length==0)return Al;let i=n?Al[0]:new Ih,r=[i];for(let a=0;a<t.length;a++){let u=t[a].type.attrs;if(u){u.nodeName&&r.push(i=new Ih(u.nodeName));for(let l in u){let g=u[l];g!=null&&(n&&r.length==1&&r.push(i=new Ih(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 ek(t,e,n,i){if(n==Al&&i==Al)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=Al[0]),r=g}_B(r,l||Al[0],u)}return r}function _B(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 tk(t,e,n){return ek(t,t,Al,Wy(e,n,t.nodeType!=1))}function _f(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 nk(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class xB{constructor(e,n,i){this.lock=n,this.view=i,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=bB(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=xs,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 _=this.top.children[g];if(_.matchesMark(e[a])&&!this.isLocked(_.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=Ml.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 _=this.top.children[l];if(_.matchesNode(e,n,i)&&!this.preMatch.matched.has(_)){a=l;break}}return a<0?!1:(this.destroyBetween(this.index,a),this.index++,!0)}updateNodeAt(e,n,i,r,a){let u=this.top.children[r];return u.dirty==so&&u.dom==u.contentDOM&&(u.dirty=Tl),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 xa){let _=this.preMatch.matched.get(g);if(_!=null&&_!=a)return!1;let S=g.dom,E,T=this.isLocked(S)&&!(e.isText&&g.node&&g.node.isText&&g.nodeDOM.nodeValue==e.text&&g.dirty!=so&&_f(n,g.outerDeco));if(!T&&g.update(e,n,i,r))return this.destroyBetween(this.index,l),g.dom!=S&&(this.changed=!0),this.index++,!0;if(!T&&(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=Tl,E.updateChildren(r,u+1),E.dirty=xs),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)||!_f(i,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=xa.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=xa.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 Xw(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 Ml;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof yf)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ur||Ji)&&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 Jw(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 bB(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 _=n.children[i-1];if(_ instanceof Ml)n=_,i=_.children.length;else{l=_,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 vB(t,e){return t.type.side-e.type.side}function wB(t,e,n,i){let r=e.locals(t),a=0;if(r.length==0){for(let _=0;_<t.childCount;_++){let S=t.child(_);i(S,r,e.forChild(a,S),_),a+=S.nodeSize}return}let u=0,l=[],g=null;for(let _=0;;){let S,E;for(;u<r.length&&r[u].to==a;){let j=r[u++];j.widget&&(S?(E||(E=[S])).push(j):S=j)}if(S)if(E){E.sort(vB);for(let j=0;j<E.length;j++)n(E[j],_,!!g)}else n(S,_,!!g);let T,I;if(g)I=-1,T=g,g=null;else if(_<t.childCount)I=_,T=t.child(_++);else break;for(let j=0;j<l.length;j++)l[j].to<=a&&l.splice(j--,1);for(;u<r.length&&r[u].from<=a&&r[u].to>a;)l.push(r[u++]);let z=a+T.nodeSize;if(T.isText){let j=z;u<r.length&&r[u].from<j&&(j=r[u].from);for(let Z=0;Z<l.length;Z++)l[Z].to<j&&(j=l[Z].to);j<z&&(g=T.cut(j-a),T=T.cut(0,j-a),z=j,I=-1)}else for(;u<r.length&&r[u].to<z;)u++;let F=T.isInline&&!T.isLeaf?l.filter(j=>!j.inline):l.slice();i(T,F,e.forChild(a,T),I),a=z}}function kB(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 SB(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 _=t.child(r++);if(a+=_.nodeSize,!_.isText)break;g+=_.text}if(a>=n){if(a>=i&&g.slice(i-e.length-l,i-l)==e)return i-e.length;let _=l<i?g.lastIndexOf(e,i-l-1):-1;if(_>=0&&_+e.length+l>=n)return l+_;if(n==i&&g.length>=i+e.length-l&&g.slice(i-l,i-l+e.length)==e)return i}}return-1}function Gy(t,e,n,i,r){let a=[];for(let u=0,l=0;u<t.length;u++){let g=t[u],_=l,S=l+=g.size;_>=n||S<=e?a.push(g):(_<e&&a.push(g.slice(0,e-_,i)),r&&(a.push(r),r=void 0),S>n&&a.push(g.slice(n-_,g.size,i)))}return a}function Zy(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,_;if(gf(n)){for(g=u;r&&!r.node;)r=r.parent;let E=r.node;if(r&&E.isAtom&&zt.isSelectable(E)&&r.parent&&!(E.isInline&&XN(n.focusNode,n.focusOffset,r.dom))){let T=r.posBefore;_=new zt(u==T?l:i.resolve(T))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let E=u,T=u;for(let I=0;I<n.rangeCount;I++){let z=n.getRangeAt(I);E=Math.min(E,t.docView.posFromDOM(z.startContainer,z.startOffset,1)),T=Math.max(T,t.docView.posFromDOM(z.endContainer,z.endOffset,-1))}if(E<0)return null;[g,u]=T==t.state.selection.anchor?[T,E]:[E,T],l=i.resolve(u)}else g=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(g<0)return null}let S=i.resolve(g);if(!_){let E=e=="pointer"||t.state.selection.head<l.pos&&!a?1:-1;_=Xy(t,S,l,E)}return _}function ik(t){return t.editable?t.hasFocus():uk(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Ro(t,e=!1){let n=t.state.selection;if(ak(t,n),!!ik(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Ji){let i=t.domSelectionRange(),r=t.domObserver.currentSelection;if(i.anchorNode&&r.anchorNode&&El(i.anchorNode,i.anchorOffset,r.anchorNode,r.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)CB(t);else{let{anchor:i,head:r}=n,a,u;rk&&!(n instanceof Ft)&&(n.$from.parent.inlineContent||(a=sk(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(u=sk(t,n.to))),t.docView.setSelection(i,r,t.root,e),rk&&(a&&ok(a),u&&ok(u)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&EB(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const rk=ur||Ji&&Nw<63;function sk(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 Yy(r);if((!r||r.contentEditable=="false")&&(!a||a.contentEditable=="false")){if(r)return Yy(r);if(a)return Yy(a)}}function Yy(t){return t.contentEditable="true",ur&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function ok(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function EB(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(()=>{(!ik(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function CB(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,Fi(i)+1):n.setStart(i,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!r&&!t.state.selection.visible&&Ar&&ya<=11&&(i.disabled=!0,i.disabled=!1)}function ak(t,e){if(e instanceof zt){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(lk(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else lk(t)}function lk(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Xy(t,e,n,i){return t.someProp("createSelectionBetween",r=>r(t,e,n))||Ft.between(e,n,i)}function ck(t){return t.editable&&!t.hasFocus()?!1:uk(t)}function uk(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 TB(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return El(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Ky(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 ba(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function hk(t,e,n){let i=t.state.selection;if(i instanceof Ft)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 ba(t,new Ft(i.$anchor,u))}else if(i.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let r=Ky(t.state,e);return r&&r instanceof zt?ba(t,r):!1}else if(!(_s&&n.indexOf("m")>-1)){let r=i.$head,a=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,u;if(!a||a.isText)return!1;let l=e<0?r.pos-a.nodeSize:r.pos;return a.isAtom||(u=t.docView.descAt(l))&&!u.contentDOM?zt.isSelectable(a)?ba(t,new zt(e<0?t.state.doc.resolve(r.pos-a.nodeSize):r)):Mh?ba(t,new Ft(t.state.doc.resolve(e<0?l:l+a.nodeSize))):!1:!1}}else return!1;else{if(i instanceof zt&&i.node.isInline)return ba(t,new Ft(e>0?i.$to:i.$from));{let r=Ky(t.state,e);return r?ba(t,r):!1}}}function xf(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Dh(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Fc(t,e){return e<0?MB(t):AB(t)}function MB(t){let e=t.domSelectionRange(),n=e.focusNode,i=e.focusOffset;if(!n)return;let r,a,u=!1;for($s&&n.nodeType==1&&i<xf(n)&&Dh(n.childNodes[i],-1)&&(u=!0);;)if(i>0){if(n.nodeType!=1)break;{let l=n.childNodes[i-1];if(Dh(l,-1))r=n,a=--i;else if(l.nodeType==3)n=l,i=n.nodeValue.length;else break}}else{if(dk(n))break;{let l=n.previousSibling;for(;l&&Dh(l,-1);)r=n.parentNode,a=Fi(l),l=l.previousSibling;if(l)n=l,i=xf(n);else{if(n=n.parentNode,n==t.dom)break;i=0}}}u?Jy(t,n,i):r&&Jy(t,r,a)}function AB(t){let e=t.domSelectionRange(),n=e.focusNode,i=e.focusOffset;if(!n)return;let r=xf(n),a,u;for(;;)if(i<r){if(n.nodeType!=1)break;let l=n.childNodes[i];if(Dh(l,1))a=n,u=++i;else break}else{if(dk(n))break;{let l=n.nextSibling;for(;l&&Dh(l,1);)a=l.parentNode,u=Fi(l)+1,l=l.nextSibling;if(l)n=l,i=0,r=xf(n);else{if(n=n.parentNode,n==t.dom)break;i=r=0}}}a&&Jy(t,a,u)}function dk(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function PB(t,e){for(;t&&e==t.childNodes.length&&!Th(t);)e=Fi(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 IB(t,e){for(;t&&!e&&!Th(t);)e=Fi(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 Jy(t,e,n){if(e.nodeType!=3){let a,u;(u=PB(e,n))?(e=u,n=0):(a=IB(e,n))&&(e=a,n=a.nodeValue.length)}let i=t.domSelection();if(!i)return;if(gf(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&&Ro(t)},50)}function pk(t,e){let n=t.state.doc.resolve(e);if(!(Ji||QN)&&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 fk(t,e,n){let i=t.state.selection;if(i instanceof Ft&&!i.empty||n.indexOf("s")>-1||_s&&n.indexOf("m")>-1)return!1;let{$from:r,$to:a}=i;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let u=Ky(t.state,e);if(u&&u instanceof zt)return ba(t,u)}if(!r.parent.inlineContent){let u=e<0?r:a,l=i instanceof Fs?Gt.near(u,e):Gt.findFrom(u,e);return l?ba(t,l):!1}return!1}function mk(t,e){if(!(t.state.selection instanceof Ft))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 gk(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function DB(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;gk(t,i,"true"),setTimeout(()=>gk(t,i,"false"),20)}return!1}function OB(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function zB(t,e){let n=e.keyCode,i=OB(e);if(n==8||_s&&n==72&&i=="c")return mk(t,-1)||Fc(t,-1);if(n==46&&!e.shiftKey||_s&&n==68&&i=="c")return mk(t,1)||Fc(t,1);if(n==13||n==27)return!0;if(n==37||_s&&n==66&&i=="c"){let r=n==37?pk(t,t.state.selection.from)=="ltr"?-1:1:-1;return hk(t,r,i)||Fc(t,r)}else if(n==39||_s&&n==70&&i=="c"){let r=n==39?pk(t,t.state.selection.from)=="ltr"?1:-1:1;return hk(t,r,i)||Fc(t,r)}else{if(n==38||_s&&n==80&&i=="c")return fk(t,-1,i)||Fc(t,-1);if(n==40||_s&&n==78&&i=="c")return DB(t)||fk(t,1,i)||Fc(t,1);if(i==(_s?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function yk(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")||Sl.fromSchema(t.state.schema),l=Ek(),g=l.createElement("div");g.appendChild(u.serializeFragment(i,{document:l}));let _=g.firstChild,S,E=0;for(;_&&_.nodeType==1&&(S=kk[_.nodeName.toLowerCase()]);){for(let I=S.length-1;I>=0;I--){let z=l.createElement(S[I]);for(;g.firstChild;)z.appendChild(g.firstChild);g.appendChild(z),E++}_=g.firstChild}_&&_.nodeType==1&&_.setAttribute("data-pm-slice",`${r} ${a}${E?` -${E}`:""} ${JSON.stringify(n)}`);let T=t.someProp("clipboardTextSerializer",I=>I(e,t))||e.content.textBetween(0,e.content.size,`
|
|
635
635
|
|
|
@@ -738,4 +738,4 @@ img.ProseMirror-separator {
|
|
|
738
738
|
|
|
739
739
|
`);return!a||!u?!1:t.chain().command(({tr:l})=>(l.delete(i.pos-2,i.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:i}=e,{$from:r,empty:a}=n;if(!a||r.parent.type!==this.type||!(r.parentOffset===r.parent.nodeSize-2))return!1;const l=r.after();return l===void 0?!1:i.nodeAt(l)?t.commands.command(({tr:_})=>(_.setSelection(Gt.near(i.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[C0({find:OF,type:this.type,getAttributes:t=>({language:t[1]})}),C0({find:zF,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Vi({key:new Mr("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(Ft.near(u.doc.resolve(Math.max(0,u.selection.from-2)))),u.setMeta("paste",!0),t.dispatch(u),!0}}})]}}),RF=bs.create({name:"doc",topNode:!0,content:"block+"});function LF(t={}){return new Vi({view(e){return new NF(e,t)}})}class NF{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 _=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(_){let S=_.getBoundingClientRect(),E=l?S.bottom:S.top;l&&g&&(E=(E+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),i={left:S.left,right:S.right,top:E-this.width/2,bottom:E+this.width/2}}}}if(!i){let l=this.editorView.coordsAtPos(this.cursorPos);i={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let r=this.editorView.dom.offsetParent;this.element||(this.element=r.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let a,u;if(!r||r==document.body&&getComputedStyle(r).position=="static")a=-pageXOffset,u=-pageYOffset;else{let l=r.getBoundingClientRect();a=l.left-r.scrollLeft,u=l.top-r.scrollTop}this.element.style.left=i.left-a+"px",this.element.style.top=i.top-u+"px",this.element.style.width=i.right-i.left+"px",this.element.style.height=i.bottom-i.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),i=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),r=i&&i.type.spec.disableDropCursor,a=typeof r=="function"?r(this.editorView,n,e):r;if(n&&!a){let u=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=vw(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 BF=ji.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[LF(this.options)]}});class ii extends Gt{constructor(e){super(e,e)}map(e,n){let i=e.resolve(n.map(this.head));return ii.valid(i)?new ii(i):Gt.near(i)}content(){return ht.empty}eq(e){return e instanceof ii&&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 ii(e.resolve(n.pos))}getBookmark(){return new q0(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!VF(e)||!FF(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&&ii.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(ii.valid(g))return g}for(;;){let u=n>0?a.firstChild:a.lastChild;if(!u){if(a.isAtom&&!a.isText&&!zt.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(ii.valid(l))return l}return null}}}ii.prototype.visible=!1,ii.findFrom=ii.findGapCursorFrom,Gt.jsonID("gapcursor",ii);class q0{constructor(e){this.pos=e}map(e){return new q0(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ii.valid(n)?new ii(n):Gt.near(n)}}function VF(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 FF(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 $F(){return new Vi({props:{decorations:qF,createSelectionBetween(t,e,n){return e.pos==n.pos&&ii.valid(n)?new ii(n):null},handleClick:UF,handleKeyDown:jF,handleDOMEvents:{beforeinput:HF}}})}const jF=Gk({ArrowLeft:Hf("horiz",-1),ArrowRight:Hf("horiz",1),ArrowUp:Hf("vert",-1),ArrowDown:Hf("vert",1)});function Hf(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 Ft){if(!a.endOfTextblock(n)||l.depth==0)return!1;g=!1,l=i.doc.resolve(e>0?l.after():l.before())}let _=ii.findGapCursorFrom(l,e,g);return _?(r&&r(i.tr.setSelection(new ii(_))),!0):!1}}function UF(t,e,n){if(!t||!t.editable)return!1;let i=t.state.doc.resolve(e);if(!ii.valid(i))return!1;let r=t.posAtCoords({left:n.clientX,top:n.clientY});return r&&r.inside>-1&&zt.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ii(i))),!0)}function HF(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ii))return!1;let{$from:n}=t.state.selection,i=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!i)return!1;let r=Fe.empty;for(let u=i.length-1;u>=0;u--)r=Fe.from(i[u].createAndFill(null,r));let a=t.state.tr.replace(n.pos,n.pos,new ht(r,0,0));return a.setSelection(Ft.near(a.doc.resolve(n.pos+1))),t.dispatch(a),!1}function qF(t){if(!(t.selection instanceof ii))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",hi.create(t.doc,[Gr.widget(t.selection.head,e,{key:"gapcursor"})])}const WF=ji.create({name:"gapCursor",addProseMirrorPlugins(){return[$F()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=tn(wt(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),GF=bs.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",di(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:_,dispatch:S})=>{if(S&&g&&u){const E=g.filter(T=>l.includes(T.type.name));_.ensureMarks(E)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),ZF=bs.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]}`,di(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=>C0({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var qf=200,Ai=function(){};Ai.prototype.append=function(e){return e.length?(e=Ai.from(e),!this.length&&e||e.length<qf&&this.leafAppend(e)||this.length<qf&&e.leafPrepend(this)||this.appendInner(e)):this},Ai.prototype.prepend=function(e){return e.length?Ai.from(e).append(this):this},Ai.prototype.appendInner=function(e){return new YF(this,e)},Ai.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ai.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},Ai.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ai.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)},Ai.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},Ai.from=function(e){return e instanceof Ai?e:e&&e.length?new lS(e):Ai.empty};var lS=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<=qf)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=qf)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}(Ai);Ai.empty=new lS([]);var YF=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}(Ai);const XF=500;class Us{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}let r,a;n&&(r=this.remapping(i,this.items.length),a=r.maps.length);let u=e.tr,l,g,_=[],S=[];return this.items.forEach((E,T)=>{if(!E.step){r||(r=this.remapping(i,T+1),a=r.maps.length),a--,S.push(E);return}if(r){S.push(new co(E.map));let I=E.step.map(r.slice(a)),z;I&&u.maybeStep(I).doc&&(z=u.mapping.maps[u.mapping.maps.length-1],_.push(new co(z,void 0,void 0,_.length+S.length))),a--,z&&r.appendMap(z,a)}else u.maybeStep(E.step);if(E.selection)return l=r?E.selection.map(r.slice(a)):E.selection,g=new Us(this.items.slice(0,i).append(S.reverse().concat(_)),this.eventCount-1),!1},this.items.length,0),{remaining:g,transform:u,selection:l}}addTransform(e,n,i,r){let a=[],u=this.eventCount,l=this.items,g=!r&&l.length?l.get(l.length-1):null;for(let S=0;S<e.steps.length;S++){let E=e.steps[S].invert(e.docs[S]),T=new co(e.mapping.maps[S],E,n),I;(I=g&&g.merge(T))&&(T=I,S?a.pop():l=l.slice(0,l.length-1)),a.push(T),n&&(u++,n=void 0),r||(g=T)}let _=u-i.depth;return _>JF&&(l=KF(l,_),u-=_),new Us(l.append(a),u)}remapping(e,n){let i=new Pc;return this.items.forEach((r,a)=>{let u=r.mirrorOffset!=null&&a-r.mirrorOffset>=e?i.maps.length-r.mirrorOffset:void 0;i.appendMap(r.map,u)},e,n),i}addMaps(e){return this.eventCount==0?this:new Us(this.items.append(e.map(n=>new co(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(T=>{T.selection&&l--},r);let g=n;this.items.forEach(T=>{let I=a.getMirror(--g);if(I==null)return;u=Math.min(u,I);let z=a.maps[I];if(T.step){let F=e.steps[I].invert(e.docs[I]),j=T.selection&&T.selection.map(a.slice(g+1,I));j&&l++,i.push(new co(z,F,j))}else i.push(new co(z))},r);let _=[];for(let T=n;T<u;T++)_.push(new co(a.maps[T]));let S=this.items.slice(0,r).append(_).append(i),E=new Us(S,l);return E.emptyItemCount()>XF&&(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)),_=g&&g.getMap();if(i--,_&&n.appendMap(_,i),g){let S=u.selection&&u.selection.map(n.slice(i));S&&a++;let E=new co(_.invert(),g,S),T,I=r.length-1;(T=r.length&&r[I].merge(E))?r[I]=T:r.push(E)}}else u.map&&i--},this.items.length,0),new Us(Ai.from(r.reverse()),a)}}Us.empty=new Us(Ai.empty,0);function KF(t,e){let n;return t.forEach((i,r)=>{if(i.selection&&e--==0)return n=r,!1}),t.slice(n)}class co{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 co(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 JF=20;function QF(t,e,n,i){let r=n.getMeta(Ll),a;if(r)return r.historyState;n.getMeta(n6)&&(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(Ll))return u.getMeta(Ll).redo?new Ta(t.done.addTransform(n,void 0,i,Wf(e)),t.undone,cS(n.mapping.maps),t.prevTime,t.prevComposition):new Ta(t.done,t.undone.addTransform(n,void 0,i,Wf(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||!e6(n,t.prevRanges)),_=u?W0(t.prevRanges,n.mapping):cS(n.mapping.maps);return new Ta(t.done.addTransform(n,g?e.selection.getBookmark():void 0,i,Wf(e)),Us.empty,_,n.time,l??t.prevComposition)}else return(a=n.getMeta("rebased"))?new Ta(t.done.rebased(n,a),t.undone.rebased(n,a),W0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ta(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),W0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function e6(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 cS(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 W0(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 t6(t,e,n){let i=Wf(e),r=Ll.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(Ll,{redo:n,historyState:g})}let G0=!1,uS=null;function Wf(t){let e=t.plugins;if(uS!=e){G0=!1,uS=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){G0=!0;break}}return G0}const Ll=new Mr("history"),n6=new Mr("closeHistory");function i6(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Vi({key:Ll,state:{init(){return new Ta(Us.empty,Us.empty,null,0,-1)},apply(e,n,i){return QF(n,i,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let i=n.inputType,r=i=="historyUndo"?dS:i=="historyRedo"?pS:null;return r?(n.preventDefault(),r(e.state,e.dispatch)):!1}}}})}function hS(t,e){return(n,i)=>{let r=Ll.getState(n);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(i){let a=t6(r,n,t);a&&i(e?a.scrollIntoView():a)}return!0}}const dS=hS(!1,!0),pS=hS(!0,!0),r6=ji.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>dS(t,e),redo:()=>({state:t,dispatch:e})=>pS(t,e)}},addProseMirrorPlugins(){return[i6(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()}}}),s6=bs.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",di(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}):f2(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:_}=u.selection,S=_.end();if(_.nodeAfter)_.nodeAfter.isTextblock?u.setSelection(Ft.create(u.doc,_.pos+1)):_.nodeAfter.isBlock?u.setSelection(zt.create(u.doc,_.pos)):u.setSelection(Ft.create(u.doc,_.pos));else{const E=(g=_.parent.type.contentMatch.defaultType)===null||g===void 0?void 0:g.create();E&&(u.insert(S,E),u.setSelection(Ft.create(u.doc,S+1)))}u.scrollIntoView()}return!0}).run()}}},addInputRules(){return[N4({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),o6=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,a6=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,l6=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,c6=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,u6=Lo.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",di(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[qc({find:o6,type:this.type}),qc({find:l6,type:this.type})]},addPasteRules(){return[Wc({find:a6,type:this.type}),Wc({find:c6,type:this.type})]}}),fS=/^(\d+)\.\s$/,h6=bs.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",di(this.options.HTMLAttributes,n),0]:["ol",di(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(H0.name,this.editor.getAttributes(Uf.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Nh({find:fS,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=Nh({find:fS,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Uf.name)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),d6=bs.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",di(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),p6=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,f6=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,m6=Lo.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",di(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[qc({find:p6,type:this.type})]},addPasteRules(){return[Wc({find:f6,type:this.type})]}}),g6=bs.create({name:"text",group:"inline"}),y6=ji.create({name:"starterKit",addExtensions(){var t,e,n,i,r,a,u,l,g,_,S,E,T,I,z,F,j,Z;const ie=[];return this.options.bold!==!1&&ie.push(MF.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&ie.push(kF.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&ie.push(AF.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&ie.push(DF.configure((i=this.options)===null||i===void 0?void 0:i.code)),this.options.codeBlock!==!1&&ie.push(aS.configure((r=this.options)===null||r===void 0?void 0:r.codeBlock)),this.options.document!==!1&&ie.push(RF.configure((a=this.options)===null||a===void 0?void 0:a.document)),this.options.dropcursor!==!1&&ie.push(BF.configure((u=this.options)===null||u===void 0?void 0:u.dropcursor)),this.options.gapcursor!==!1&&ie.push(WF.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&ie.push(GF.configure((g=this.options)===null||g===void 0?void 0:g.hardBreak)),this.options.heading!==!1&&ie.push(ZF.configure((_=this.options)===null||_===void 0?void 0:_.heading)),this.options.history!==!1&&ie.push(r6.configure((S=this.options)===null||S===void 0?void 0:S.history)),this.options.horizontalRule!==!1&&ie.push(s6.configure((E=this.options)===null||E===void 0?void 0:E.horizontalRule)),this.options.italic!==!1&&ie.push(u6.configure((T=this.options)===null||T===void 0?void 0:T.italic)),this.options.listItem!==!1&&ie.push(H0.configure((I=this.options)===null||I===void 0?void 0:I.listItem)),this.options.orderedList!==!1&&ie.push(h6.configure((z=this.options)===null||z===void 0?void 0:z.orderedList)),this.options.paragraph!==!1&&ie.push(d6.configure((F=this.options)===null||F===void 0?void 0:F.paragraph)),this.options.strike!==!1&&ie.push(m6.configure((j=this.options)===null||j===void 0?void 0:j.strike)),this.options.text!==!1&&ie.push(g6.configure((Z=this.options)===null||Z===void 0?void 0:Z.text)),ie}});function _6(t){var e;const{char:n,allowSpaces:i,allowedPrefixes:r,startOfLine:a,$position:u}=t,l=B4(n),g=new RegExp(`\\s${l}$`),_=a?"^":"",S=i?new RegExp(`${_}${l}.*?(?=\\s${l}|$)`,"gm"):new RegExp(`${_}(?:^)?${l}[^\\s${l}]*`,"gm"),E=((e=u.nodeBefore)===null||e===void 0?void 0:e.isText)&&u.nodeBefore.text;if(!E)return null;const T=u.pos-E.length,I=Array.from(E.matchAll(S)).pop();if(!I||I.input===void 0||I.index===void 0)return null;const z=I.input.slice(Math.max(0,I.index-1),I.index),F=new RegExp(`^[${r==null?void 0:r.join("")}\0]?$`).test(z);if(r!==null&&!F)return null;const j=T+I.index;let Z=j+I[0].length;return i&&g.test(E.slice(Z-1,Z+1))&&(I[0]+=" ",Z+=1),j<u.pos&&Z>=u.pos?{range:{from:j,to:Z},query:I[0].slice(n.length),text:I[0]}:null}const x6=new Mr("suggestion");function b6({pluginKey:t=x6,editor:e,char:n="@",allowSpaces:i=!1,allowedPrefixes:r=[" "],startOfLine:a=!1,decorationTag:u="span",decorationClass:l="suggestion",command:g=()=>null,items:_=()=>[],render:S=()=>({}),allow:E=()=>!0,findSuggestionMatch:T=_6}){let I;const z=S==null?void 0:S(),F=new Vi({key:t,view(){return{update:async(j,Z)=>{var ie,le,J,Ee,be,Ae,Le;const Pe=(ie=this.key)===null||ie===void 0?void 0:ie.getState(Z),Ye=(le=this.key)===null||le===void 0?void 0:le.getState(j.state),it=Pe.active&&Ye.active&&Pe.range.from!==Ye.range.from,Nt=!Pe.active&&Ye.active,dt=Pe.active&&!Ye.active,Rt=!Nt&&!dt&&Pe.query!==Ye.query,Xt=Nt||it&&Rt,nn=Rt||it,jt=dt||it&&Rt;if(!Xt&&!nn&&!jt)return;const Tt=jt&&!Xt?Pe:Ye,Sn=j.dom.querySelector(`[data-decoration-id="${Tt.decorationId}"]`);I={editor:e,range:Tt.range,query:Tt.query,text:Tt.text,items:[],command:_n=>g({editor:e,range:Tt.range,props:_n}),decorationNode:Sn,clientRect:Sn?()=>{var _n;const{decorationId:In}=(_n=this.key)===null||_n===void 0?void 0:_n.getState(e.state),xn=j.dom.querySelector(`[data-decoration-id="${In}"]`);return(xn==null?void 0:xn.getBoundingClientRect())||null}:null},Xt&&((J=z==null?void 0:z.onBeforeStart)===null||J===void 0||J.call(z,I)),nn&&((Ee=z==null?void 0:z.onBeforeUpdate)===null||Ee===void 0||Ee.call(z,I)),(nn||Xt)&&(I.items=await _({editor:e,query:Tt.query})),jt&&((be=z==null?void 0:z.onExit)===null||be===void 0||be.call(z,I)),nn&&((Ae=z==null?void 0:z.onUpdate)===null||Ae===void 0||Ae.call(z,I)),Xt&&((Le=z==null?void 0:z.onStart)===null||Le===void 0||Le.call(z,I))},destroy:()=>{var j;I&&((j=z==null?void 0:z.onExit)===null||j===void 0||j.call(z,I))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(j,Z,ie,le){const{isEditable:J}=e,{composing:Ee}=e.view,{selection:be}=j,{empty:Ae,from:Le}=be,Pe={...Z};if(Pe.composing=Ee,J&&(Ae||e.view.composing)){(Le<Z.range.from||Le>Z.range.to)&&!Ee&&!Z.composing&&(Pe.active=!1);const Ye=T({char:n,allowSpaces:i,allowedPrefixes:r,startOfLine:a,$position:be.$from}),it=`id_${Math.floor(Math.random()*4294967295)}`;Ye&&E({editor:e,state:le,range:Ye.range,isActive:Z.active})?(Pe.active=!0,Pe.decorationId=Z.decorationId?Z.decorationId:it,Pe.range=Ye.range,Pe.query=Ye.query,Pe.text=Ye.text):Pe.active=!1}else Pe.active=!1;return Pe.active||(Pe.decorationId=null,Pe.range={from:0,to:0},Pe.query=null,Pe.text=null),Pe}},props:{handleKeyDown(j,Z){var ie;const{active:le,range:J}=F.getState(j.state);return le&&((ie=z==null?void 0:z.onKeyDown)===null||ie===void 0?void 0:ie.call(z,{view:j,event:Z,range:J}))||!1},decorations(j){const{active:Z,range:ie,decorationId:le}=F.getState(j);return Z?hi.create(j.doc,[Gr.inline(ie.from,ie.to,{nodeName:u,class:l,"data-decoration-id":le})]):null}}});return F}const v6=new Mr("mention"),w6=bs.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",di(this.HTMLAttributes,t.HTMLAttributes),`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`]},suggestion:{char:"@",pluginKey:v6,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",di({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t})];const n={...this.options};n.HTMLAttributes=di({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:n,node:t});return typeof i=="string"?["span",di({"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[b6({editor:this.editor,...this.options.suggestion})]}}),k6={props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function S6(t,e,n,i,r,a){return v.openBlock(),v.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]=[v.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[v.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 E6=at(k6,[["render",S6]]),C6={props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function T6(t,e,n,i,r,a){return v.openBlock(),v.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]=[v.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[v.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 8h10M9 12h10M9 16h10M4.99 8H5m-.02 4h.01m0 4H5"})],-1)]))}const M6=at(C6,[["render",T6]]),A6={props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function P6(t,e,n,i,r,a){return v.openBlock(),v.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]=[v.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[v.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 I6=at(A6,[["render",P6]]),D6={props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function O6(t,e,n,i,r,a){return v.openBlock(),v.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]=[v.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"},[v.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 z6=at(D6,[["render",O6]]),R6={props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.chain().toggleBold().run()}}};function L6(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleBold&&a.toggleBold(...u)),class:v.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]=[v.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"},[v.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),v.createElementVNode("span",{class:"sr-only"},"Bold",-1)]),2)}const N6=at(R6,[["render",L6]]),B6={props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function V6(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleItalic&&a.toggleItalic(...u)),class:v.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]=[v.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"},[v.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),v.createElementVNode("span",{class:"sr-only"},"Italic",-1)]),2)}const F6={bold:N6,italic:at(B6,[["render",V6]]),bullet_list:M6,ordered_list:I6,blockquote:E6,codeblock:z6},$6={components:{EditorContent:vF},props:{controls:{type:Array,default:()=>["bold","italic","blockquote","bullet_list","ordered_list","codeblock"]},options:{type:Array,default:()=>[]},modelValue:{type:String,default:()=>""}},data(){return{editor:null}},computed:{controlsList(){return Object.entries(F6).filter(([t])=>this.controls.includes(t)).map(([t,e])=>e)}},watch:{modelValue(t){this.editor&&this.editor.getHTML()!==t&&this.editor.commands.setContent(t)},editor(t){t&&this.editor.on("update",({editor:e})=>{const n=e.getHTML();n!==this.modelValue&&this.$emit("update:modelValue",n)})}},mounted(){this.editor&&this.editor.destroy(),this.initEditor()},beforeDestroy(){this.editor&&this.editor.destroy()},methods:{initEditor(){this.editor=new bF({content:this.modelValue,extensions:[y6,aS,w6.configure({HTMLAttributes:{class:"mention"},suggestion:{items:({query:t})=>{const e=this.options.filter(n=>{var i,r;return(r=(i=n==null?void 0:n.email)==null?void 0:i.toLowerCase())==null?void 0:r.includes(t==null?void 0:t.toLowerCase())}).slice(0,5);return e.length?e:[{id:null,text:"Данні відсутні",email:null}]},render:()=>{let t,e;return{onStart:n=>{t=document.createElement("div"),t.className="mention-popup",n.items.forEach(a=>{const u=document.createElement("div");u.className="mention-option",a.id===null?(u.textContent=a.text,u.style.pointerEvents="none",u.style.color="#999"):(u.textContent=a.text,u.addEventListener("click",()=>{n.command({id:a.id,label:a.email})})),t.appendChild(u)}),document.body.appendChild(t);const{from:i}=n.range,r=n.editor.view.coordsAtPos(i);t.style.position="absolute",t.style.left=`${r.left}px`,t.style.top=`${r.top-t.offsetHeight}px`,e=t},onUpdate:n=>{for(;t.firstChild;)t.removeChild(t.firstChild);n.items.forEach(a=>{const u=document.createElement("div");u.className="mention-option",a.id===null?(u.textContent=a.text,u.style.pointerEvents="none",u.style.color="#999"):(u.textContent=a.text,u.addEventListener("click",()=>{n.command({id:a.id,label:a.email})})),t.appendChild(u)});const{from:i}=n.range,r=n.editor.view.coordsAtPos(i);t.style.left=`${r.left}px`,t.style.top=`${r.top-t.offsetHeight}px`},onExit:()=>{e&&e.remove()}}}}})]})},focusEditor(){this.editor&&!this.editor.isFocused&&this.editor.commands.focus()}}},j6={class:"editor-container w-full border border-gray-200 rounded-lg bg-gray-50 dark:bg-gray-700 dark:border-gray-600"},U6={key:0,class:"editor-toolbar px-3 py-2 border-b dark:border-gray-600 flex items-center gap-2"};function H6(t,e,n,i,r,a){const u=v.resolveComponent("EditorContent");return v.openBlock(),v.createElementBlock("div",j6,[r.editor?(v.openBlock(),v.createElementBlock("div",U6,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(a.controlsList,(l,g)=>(v.openBlock(),v.createBlock(v.resolveDynamicComponent(l),{key:g,editor:r.editor},null,8,["editor"]))),128))])):v.createCommentVNode("",!0),v.createElementVNode("div",{onClick:e[0]||(e[0]=(...l)=>a.focusEditor&&a.focusEditor(...l)),class:"editor-content px-4 py-2 bg-white rounded-b-lg dark:bg-gray-800 relative"},[v.createVNode(u,{editor:r.editor,class:"relative"},null,8,["editor"])])])}const mS=at($6,[["render",H6]]),q6=t=>{const e=/(\b\S)?/g,n=t.match(e);return n?n.join("").toUpperCase():""},W6={props:{name:{type:String,default(){return""}},avatar:{type:String,default(){return""}}},computed:{inItials(){return q6(this.name)}}},G6={class:"mr-2"},Z6=["src"],Y6={key:1,class:"flex flex-shrink-0 items-center justify-center w-6 h-6 bg-gray-500 text-xs text-white rounded-full"},X6={key:0},K6={key:1,class:"text-sm"};function J6(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("div",G6,[n.avatar?(v.openBlock(),v.createElementBlock("img",{key:0,src:n.avatar,alt:"avatar",class:"flex flex-shrink-0 items-center justify-center w-6 h-6 rounded-full"},null,8,Z6)):n.name?(v.openBlock(),v.createElementBlock("div",Y6,[a.inItials.length?(v.openBlock(),v.createElementBlock("span",X6,v.toDisplayString(a.inItials),1)):(v.openBlock(),v.createElementBlock("span",K6,e[0]||(e[0]=[v.createElementVNode("i",{class:"ti ti-user"},null,-1)])))])):v.createCommentVNode("",!0)])}const Q6={components:{VsWidgetCommentsAvatar:at(W6,[["render",J6]]),VsTextEditor:mS},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=lt(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 xt.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"})}},async deleteComment(){try{await xt.delete(`/api/widget/comment/${this.id}/${this.comment.communication_id}`),this.$emit("list-update"),this.isCommentActionVisible=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},toggleCommentAction(){this.isCommentActionVisible=!this.isCommentActionVisible}}},e$={class:"p-6 text-base bg-white dark:bg-gray-900"},t$={class:"flex justify-between items-center mb-2"},n$={class:"flex items-center"},i$={class:"inline-flex items-center mr-3 text-sm text-gray-900 dark:text-white font-semibold capitalize"},r$={class:"text-sm text-gray-600 dark:text-gray-400"},s$=["innerHTML"],o$={class:"flex items-center gap-[4px]"},a$={class:"flex flex-col gap-[8px] text-sm font-medium text-gray-500"},l$={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function c$(t,e,n,i,r,a){const u=v.resolveComponent("VsWidgetCommentsAvatar"),l=v.resolveComponent("VsTextEditor"),g=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock(v.Fragment,null,[v.createElementVNode("div",e$,[v.createElementVNode("div",t$,[v.createElementVNode("div",n$,[v.createElementVNode("p",i$,[v.createVNode(u,{name:n.comment.username,avatar:n.comment.avatar},null,8,["name","avatar"]),v.createTextVNode(v.toDisplayString(n.comment.username),1)]),v.createElementVNode("div",r$,v.toDisplayString(a.createDate),1)])]),v.createElementVNode("p",{class:"text-gray-500 dark:text-gray-400",innerHTML:n.comment.body},null,8,s$),v.createElementVNode("div",o$,[v.createElementVNode("button",{type:"button",class:"block py-2 dark:hover:bg-gray-600 hover:underline dark:hover:text-white text-start duration-300",onClick:e[0]||(e[0]=_=>r.isOpen=!0)}," Редагувати "),v.createElementVNode("button",{type:"button",class:"block py-2 dark:hover:bg-gray-600 hover:underline dark:hover:text-white text-start duration-300",onClick:e[1]||(e[1]=_=>a.confirnDeleteComment())}," Видалити ")])]),v.createVNode(g,{visible:r.isOpen,"onUpdate:visible":e[5]||(e[5]=_=>r.isOpen=_),title:"Редагувати",size:"small"},{footer:v.withCtx(()=>[v.createElementVNode("div",l$,[v.createElementVNode("button",{onClick:e[3]||(e[3]=_=>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"}," Відмінити "),v.createElementVNode("button",{onClick:e[4]||(e[4]=(..._)=>a.updateComment&&a.updateComment(..._)),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:v.withCtx(()=>[v.createElementVNode("div",a$,[e[6]||(e[6]=v.createTextVNode(" Коментар ")),v.createVNode(l,{modelValue:r.textareaValue,"onUpdate:modelValue":e[2]||(e[2]=_=>r.textareaValue=_),options:n.options},null,8,["modelValue","options"])])]),_:1},8,["visible"])],64)}const u$={components:{VsWidgetCommentsItem:at(Q6,[["render",c$]])},inject:["activeAddFormEditor"],props:{id:{type:String,default:()=>""},prefilledData:{type:Object,default:null},options:Array},data(){return{isLoaded:!1,isLoadFailed:!1,comments:[],user:{},modal:{title:"",message:"",cancel:"",confirm:"",cancelButtonText:"",confirmButtonText:""},isModalVisible:!1}},async created(){await this.getComments()},methods:{async getComments(){if(this.prefilledData){this.comments=this.prefilledData.rows,this.isLoaded=!0;return}try{const{data:t}=await xt.get(`/api/widget/comment/${this.id}`);this.comments=t.rows,this.user=t.user}catch(t){this.isLoadFailed=!0,console.error(t)}this.isLoaded=!0,this.$emit("update-comment-count")},prepareModal(t){const e={...t};return t.cancel||(e.cancel=()=>{this.isModalVisible=!1}),t.updateListOnConfirm&&(e.confirm=async()=>{await t.confirm(),this.isModalVisible=!1}),e},handleOpenModal(t){this.modal=this.prepareModal(t),this.isModalVisible=!0}}},h$={class:"flex flex-col divide-y"},d$={key:0,class:"max-h-[300px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},p$={key:1},f$={class:"p-4"},m$={class:"mt-1 text-gray-500 dark:text-neutral-500"},g$={class:"mt-4 flex justify-end gap-x-3"};function y$(t,e,n,i,r,a){const u=v.resolveComponent("VsErrorOnLoading"),l=v.resolveComponent("VsWidgetCommentsItem"),g=v.resolveComponent("VsLoader"),_=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock("div",h$,[r.isLoaded?(v.openBlock(),v.createElementBlock(v.Fragment,{key:0},[r.isLoadFailed?(v.openBlock(),v.createBlock(u,{key:0})):(v.openBlock(),v.createElementBlock(v.Fragment,{key:1},[r.comments.length?(v.openBlock(),v.createElementBlock("div",d$,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(r.comments,(S,E)=>(v.openBlock(),v.createBlock(l,{key:E,comment:S,user:r.user,options:n.options,index:E,id:n.id,onListUpdate:a.getComments,class:"border-top",onOpenModal:e[0]||(e[0]=T=>a.handleOpenModal(T))},null,8,["comment","user","options","index","id","onListUpdate"]))),128))])):(v.openBlock(),v.createElementBlock("div",p$,e[4]||(e[4]=[v.createElementVNode("p",{class:"pl-3 text-sm font-medium text-gray-600"}," Коментарі відсутні ",-1)])))],64))],64)):(v.openBlock(),v.createBlock(g,{key:1,class:"justify-center",text:"Please wait..."})),v.createVNode(_,{title:r.modal.title,size:"small",visible:r.isModalVisible,"onUpdate:visible":e[3]||(e[3]=S=>r.isModalVisible=S)},{default:v.withCtx(()=>[v.createElementVNode("div",f$,[v.createElementVNode("p",m$,v.toDisplayString(r.modal.message),1),v.createElementVNode("div",g$,[v.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[1]||(e[1]=(...S)=>r.modal.cancel&&r.modal.cancel(...S))},v.toDisplayString(r.modal.cancelButtonText),1),v.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[2]||(e[2]=(...S)=>r.modal.confirm&&r.modal.confirm(...S))},v.toDisplayString(r.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const _$=at(u$,[["render",y$]]),x$={components:{VsTextEditor:mS},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 xt.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}}},b$={class:"w-full widget-comment-form"},v$={class:"mb-4 bg-white border-gray-200 dark:bg-gray-800 dark:border-gray-700"},w$={class:"flex"};function k$(t,e,n,i,r,a){const u=v.resolveComponent("VsTextEditor");return v.openBlock(),v.createElementBlock("div",b$,[v.createElementVNode("div",v$,[v.createVNode(u,{modelValue:r.commentContent,"onUpdate:modelValue":e[0]||(e[0]=l=>r.commentContent=l),options:n.options},null,8,["modelValue","options"])]),v.createElementVNode("div",w$,[v.createElementVNode("button",{ref:"buttonAdd",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300",onClick:e[1]||(e[1]=(...l)=>a.addNewComment&&a.addNewComment(...l))}," Відправити коментар ",512)])])}const S$={components:{VsWidgetCommentsList:_$,VsWidgetCommentsAddForm:at(x$,[["render",k$]])},props:{id:{type:String,default(){return""}},prefilledData:{type:Object,default:null}},data(){return{activeAddFormEditor:"",comments:[],totalComment:"0",options:[]}},mounted(){this.comments=this.$refs.commentListRef.comments,this.getUsersList()},watch:{comments(t){this.$emit("count-change",t.length)}},methods:{async getUsersList(){try{const{data:t}=await xt.get("/api/suggest/core.user_mentioned");this.options=t}catch(t){console.log(t)}},listUpdate(){this.$refs.commentListRef.getComments()},updateCommentCount(){this.totalComment=this.$refs.commentListRef.comments.length||"0"}}},E$={class:"bg-white-200"};function C$(t,e,n,i,r,a){const u=v.resolveComponent("VsWidgetCommentsAddForm"),l=v.resolveComponent("VsWidgetCommentsList");return v.openBlock(),v.createElementBlock("div",E$,[e[2]||(e[2]=v.createElementVNode("div",{class:"flex justify-between items-center gap-x-2 mb-4"},null,-1)),v.createVNode(u,{options:r.options,class:"mb-6",id:n.id,onListUpdate:e[0]||(e[0]=g=>a.listUpdate())},null,8,["options","id"]),v.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 T$=at(S$,[["render",C$]]),gS=t=>new Date(t).toLocaleDateString("uk-UK",{day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric"}),M$=t=>new Date(t).toLocaleDateString("uk-UK",{day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric"}),A$=t=>{const e=/(\b\S)?/g,n=t.match(e);return n?n.join("").toUpperCase():""},P$=v.defineComponent({props:{username:{type:String,default:()=>""}},computed:{inItials(){return A$(this.username)}}}),I$={class:"flex flex-shrink-0 items-center justify-center w-8 h-8 bg-gray-500 text-xs text-white rounded-full"};function D$(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("div",I$,v.toDisplayString(t.inItials),1)}const O$=at(P$,[["render",D$]]),Z0={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)=>{Z0.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)})}},z$={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 Z0.promise("https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.js"),await Z0.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 v.openBlock(),v.createElementBlock("div",R$)}const N$=at(z$,[["render",L$]]),B$=v.defineComponent({components:{VsWidgetHistoryItemAvatar:O$,VsWidgetHistoryItemMap:N$},props:{item:{type:Object,default:()=>{}}},methods:{getTitle(t){return t.title||t.attr},getOldValue(t){return t.old||"Не вказано"},getNewValue(t){return t.new||"Не вказано"},getDate(t){return M$(t.cdate)}}}),V$={class:"relative [&_p]:m-0"},F$={class:"flex items-center gap-3"},$$={class:"w-full flex justify-between"},j$={class:"text-gray-500"},U$={class:"text-gray-800 font-medium"},H$={class:"text-gray-500 text-sm"},q$={class:"mt-2 pl-10"},W$={key:0},G$={key:1,class:"flex items-center gap-2 text-gray-700 text-sm"},Z$={class:"font-medium"},Y$={class:"font-medium"};function X$(t,e,n,i,r,a){const u=v.resolveComponent("VsWidgetHistoryItemAvatar"),l=v.resolveComponent("VsWidgetHistoryItemMap");return v.openBlock(),v.createElementBlock("div",V$,[v.createElementVNode("div",F$,[v.createVNode(u,{username:t.item.username},null,8,["username"]),v.createElementVNode("div",$$,[v.createElementVNode("p",j$,[v.createElementVNode("span",U$,v.toDisplayString(t.item.username),1),e[0]||(e[0]=v.createTextVNode(" змінив данні: "))]),v.createElementVNode("p",H$,v.toDisplayString(t.getDate(t.item)),1)])]),v.createElementVNode("div",q$,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(t.item.changes,(g,_)=>(v.openBlock(),v.createElementBlock("div",{key:_},[g.attr==="geom"?(v.openBlock(),v.createElementBlock("div",W$,[e[1]||(e[1]=v.createElementVNode("p",null,"Додана геометрія:",-1)),g.new?(v.openBlock(),v.createBlock(l,{key:0,point:g.new},null,8,["point"])):v.createCommentVNode("",!0)])):(v.openBlock(),v.createElementBlock("div",G$,[v.createElementVNode("p",null,v.toDisplayString(`- ${t.getTitle(g)}:`),1),v.createElementVNode("p",Z$,v.toDisplayString(t.getOldValue(g)),1),e[2]||(e[2]=v.createElementVNode("i",{class:"ti ti-arrow-right"},null,-1)),v.createElementVNode("p",Y$,v.toDisplayString(t.getNewValue(g)),1)]))]))),128))])])}const K$=at(B$,[["render",X$]]),J$=v.defineComponent({components:{VsWidgetHistoryItem:K$,VsEmptyWidget:Ey},props:{id:{type:String,default:""},prefilledData:{type:Object,default:null}},data:()=>({history:{}}),computed:{createdDate(){return this.history.data?gS(this.history.data.cdate):""},lastEditDate(){return this.history.data?gS(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 xt.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)}}}),Q$={class:"bg-white"},e8={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"},t8={key:1,class:"w-full h-[330px] flex items-center justify-center"};function n8(t,e,n,i,r,a){var l;const u=v.resolveComponent("VsWidgetHistoryItem");return v.openBlock(),v.createElementBlock("div",Q$,[e[0]||(e[0]=v.createElementVNode("div",{class:"flex justify-between items-center gap-x-2 mb-4"},null,-1)),(l=t.history.rows)!=null&&l.length?(v.openBlock(),v.createElementBlock("ul",e8,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(t.history.rows,g=>(v.openBlock(),v.createElementBlock("li",{class:"list-none",key:g.uid},[v.createVNode(u,{item:g},null,8,["item"])]))),128))])):(v.openBlock(),v.createElementBlock("div",t8," Історія відсутні "))])}const i8={"vs-widget-map":gR,"vs-widget-gallery":ZL,"vs-widget-comments":T$,"vs-widget-file":AL,"vs-widget-history":at(J$,[["render",n8]])},r8={},s8={style:{width:"calc(100vw - 300px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 flex items-center justify-center"},o8={...i8,...r8,"vs-dashboard":{__name:"vs-dashboard",setup(t){return(e,n)=>(v.openBlock(),v.createElementBlock("div",s8,n[0]||(n[0]=[v.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"},[v.createElementVNode("div",{class:"mb-4 xl:mb-8"},[v.createElementVNode("h1",{class:"text-lg font-semibold text-gray-800 dark:text-neutral-200"}," Members "),v.createElementVNode("p",{class:"text-sm text-gray-500 dark:text-neutral-500"}," Manage members and users of your workspace and set their access level. ")]),v.createElementVNode("div",{class:"space-y-5"},[v.createElementVNode("div",{class:"flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5"},[v.createElementVNode("div",{class:"relative w-full"},[v.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-20 ps-3.5"},[v.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"},[v.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),v.createElementVNode("path",{d:"m21 21-4.3-4.3"})])]),v.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"}),v.createElementVNode("div",{class:"hidden absolute inset-y-0 end-0 flex items-center pointer-events-none z-20 pe-1"},[v.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"},[v.createElementVNode("span",{class:"sr-only"},"Close"),v.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"},[v.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),v.createElementVNode("path",{d:"m15 9-6 6"}),v.createElementVNode("path",{d:"m9 9 6 6"})])])])]),v.createElementVNode("div",{class:"flex justify-end items-center gap-x-2"},[v.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"},[v.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"},[v.createElementVNode("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),v.createElementVNode("polyline",{points:"7 10 12 15 17 10"}),v.createElementVNode("line",{x1:"12",x2:"12",y1:"15",y2:"3"})]),v.createElementVNode("span",{class:"hidden sm:block"}," Download CSV ")]),v.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"},[v.createElementVNode("span",{class:"hidden sm:block"},"Send"),v.createTextVNode("Invite ")])])]),v.createElementVNode("div",{class:"grid sm:grid-cols-2 lg:grid-cols-4 gap-2 xl:gap-4"},[v.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[v.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[v.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}),v.createElementVNode("div",{class:"flex items-center -space-x-2"},[v.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"})])]),v.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Admin")]),v.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[v.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[v.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 5 "),v.createElementVNode("div",{class:"flex items-center -space-x-2"},[v.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"}),v.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 "),v.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"}),v.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"}),v.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 ")])]),v.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[v.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Members"),v.createElementVNode("div",{class:"hs-tooltip inline-block"},[v.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"},[v.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"}),v.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"})]),v.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. ")])])]),v.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[v.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[v.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 2 "),v.createElementVNode("div",{class:"flex items-center -space-x-2"},[v.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 "),v.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 ")])]),v.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[v.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"}," Limited access members "),v.createElementVNode("div",{class:"hs-tooltip inline-block"},[v.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"},[v.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"}),v.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"})]),v.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. ")])])]),v.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[v.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[v.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 0 "),v.createElementVNode("div",{class:"flex items-center -space-x-2"})]),v.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Pending invites")])]),v.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"},[v.createElementVNode("div",{class:"min-w-full inline-block align-middle"},[v.createElementVNode("table",{class:"min-w-full divide-y divide-gray-200 dark:divide-neutral-700"},[v.createElementVNode("thead",null,[v.createElementVNode("tr",null,[v.createElementVNode("th",{scope:"col",class:"min-w-[250px]"},[v.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 ")]),v.createElementVNode("th",{scope:"col",class:"min-w-48"},[v.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 ")]),v.createElementVNode("th",{scope:"col"},[v.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 ")]),v.createElementVNode("th",{scope:"col",class:"min-w-36"},[v.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 ")]),v.createElementVNode("th",{scope:"col"},[v.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 ")])])]),v.createElementVNode("tbody",{class:"divide-y divide-gray-200 dark:divide-neutral-700"},[v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.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"}),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Admin ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," james@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.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"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),v.createTextVNode(" Active ")])])]),v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.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 "),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," liza@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 2 days ago ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.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"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),v.createTextVNode(" Inactive ")])])]),v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.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"}),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Daniel Hobbs ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," dhobbs@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.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"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),v.createTextVNode(" Inactive ")])])]),v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.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"}),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Brian Warner ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," brian@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 1 months ago ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.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"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),v.createTextVNode(" Active ")])])]),v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.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 "),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Ols Shols ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," olsshols@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 6 days ago ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.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"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),v.createTextVNode(" Inactive ")])])])])])])])])],-1)])))}}},a8={install(t,{componentsApp:e={},menu:n=[]}){var a;xt.defaults.baseURL&&(xt.defaults.baseURL=xt.defaults.baseURL);const i=(a=R1(n))==null?void 0:a.filter(u=>u==null?void 0:u.component).map(u=>({...u,component:{...e,...Oz}[u==null?void 0:u.component]}));console.log(i);const{router:r}=lA(i);Object.entries({...o8,...e}).forEach(([u,l])=>{t.component(u,l)}),t.component("admin",MT),t.config.globalProperties={...t.config.globalProperties,$componentsConfig:{...WO,componentsApp:e},$router:r},t.use(r)}},Xr=v.ref(null),l8={data(){return{formValues:{},scheme:null,table:""}},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(Xr.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 xt.get(`/api/template/table/${n}`),{data:{rows:u}}=await xt.get(`/api/table-data/${this.table}/${(r=(i=this.$route)==null?void 0:i.query)==null?void 0:r.id}`);this.formValues=u==null?void 0:u[0];const{data:l}=await xt.get(`/api/template/form/${a}`);this.scheme=(l==null?void 0:l.schema)||l}catch{}},async editObject(){var t,e;try{await this.$refs.form.doValidation(),await xt.put(`/api/table/${this.table}/${(e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.id}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},c8={style:{width:"calc(100vw - 260px)"}},u8={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},h8={class:"flex items-center gap-[6px]"},d8={style:{height:"calc(100vh - 140px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},p8={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 f8(t,e,n,i,r,a){const u=v.resolveComponent("VsForm");return v.openBlock(),v.createElementBlock("div",c8,[v.createElementVNode("div",u8,[e[3]||(e[3]=v.createElementVNode("h2",{class:"text-xl font-medium"},"Редагувати",-1)),v.createElementVNode("div",h8,[v.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"py-2 px-3 flex items-center gap-x-2 text-sm font-medium rounded-lg border bg-white border-gray-100 text-gray-800 shadow focus:outline-none hover:bg-gray-50 hover:border-gray-100 duration-300"}," Скасувати "),v.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.editObject&&a.editObject(...l)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"}," Зберегти ")])]),v.createElementVNode("div",d8,[v.createElementVNode("div",p8,[r.scheme?(v.openBlock(),v.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"])):v.createCommentVNode("",!0)])])])}const m8=Object.freeze(Object.defineProperty({__proto__:null,default:at(l8,[["render",f8]])},Symbol.toStringTag,{value:"Module"})),g8={data(){return{formValues:{},scheme:null,table:""}},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(){const t=this.flattenMenu(Xr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(i=>{var r,a;return(i==null?void 0:i.path)==((a=(r=this.$route)==null?void 0:r.query)==null?void 0:a.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const{data:{form:i}}=await xt.get(`/api/template/table/${n}`),{data:r}=await xt.get(`/api/template/form/${i}`);this.scheme=(r==null?void 0:r.schema)||r}catch{}},async createObject(){try{await this.$refs.form.doValidation(),await xt.post(`/api/table/${this.table}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},y8={style:{width:"calc(100vw - 260px)"}},_8={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},x8={class:"flex items-center gap-[6px]"},b8={style:{height:"calc(100vh - 150px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},v8={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 w8(t,e,n,i,r,a){const u=v.resolveComponent("VsForm");return v.openBlock(),v.createElementBlock("div",y8,[v.createElementVNode("div",_8,[e[3]||(e[3]=v.createElementVNode("h2",{class:"text-xl font-medium"},"Створити",-1)),v.createElementVNode("div",x8,[v.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"py-2 px-3 flex items-center gap-x-2 text-sm font-medium rounded-lg border bg-white border-gray-100 text-gray-800 shadow focus:outline-none hover:bg-gray-50 hover:border-gray-100 duration-300"}," Скасувати "),v.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.createObject&&a.createObject(...l)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"}," Зберегти ")])]),v.createElementVNode("div",b8,[v.createElementVNode("div",v8,[r.scheme?(v.openBlock(),v.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"])):v.createCommentVNode("",!0)])])])}const k8=Object.freeze(Object.defineProperty({__proto__:null,default:at(g8,[["render",w8]])},Symbol.toStringTag,{value:"Module"})),S8={};function E8(t,e,n,i,r,a){const u=v.resolveComponent("router-view");return v.openBlock(),v.createBlock(u)}const yS=Object.freeze(Object.defineProperty({__proto__:null,default:at(S8,[["render",E8]])},Symbol.toStringTag,{value:"Module"})),C8={data(){return{objectData:null,component:""}},computed:{getRoute(){const t=this.flattenMenu(Xr.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,_,S,E,T,I,z;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?(_=(g=(l=this.objectData)==null?void 0:l.rows)==null?void 0:g[0])==null?void 0:_.name:((I=(T=(E=(S=this.objectData)==null?void 0:S.rows)==null?void 0:E[0])==null?void 0:T.name)==null?void 0:I.slice(0,35))+" ...";{const F=(z=this.flattenMenu(Xr.value))==null?void 0:z.find(j=>{var Z,ie;return(j==null?void 0:j.table)===((ie=(Z=this.$route)==null?void 0:Z.params)==null?void 0:ie.table)});return F==null?void 0:F.ua}}},async mounted(){await this.getObjectData(),await this.checkActiveComponent()},watch:{component(t){this.$router.replace({...this.$route,query:{tab:t}})}},methods:{async getObjectData(){var n;const{table:t,id:e}=(n=this.$route)==null?void 0:n.params;(!t||!e)&&this.$router.replace("/404");try{const{data:i}=await xt.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 _=(a=(r=this.objectData)==null?void 0:r.panels)==null?void 0:a.find(S=>(S==null?void 0:S.type)==="tabs");(u=_==null?void 0:_.items)!=null&&u.length&&(this.component=((l=_.items[0])==null?void 0:l.component)||((g=_.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}}},T8={style:{width:"calc(100vw - 260px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 overflow-y-auto"},M8={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},A8={class:""},P8={class:"text-lg md:text-xl font-semibold text-stone-800 dark:text-neutral-200"},I8={class:"flex items-center gap-[6px]"},D8={key:0,class:"border rounded-xl bg-white"},O8={class:"p-[10px] pl-[20px] text-xl"},z8=["innerHTML"],R8={key:1},L8={class:"p-[10px] pl-[20px] text-xl"},N8={key:0,class:"p-[20px] border-t"},B8={key:1,class:"p-[20px] border-t"},V8=["innerHTML"],F8={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]"},$8=["onClick"],j8={key:0,class:"border rounded-bl-xl border-t-0 rounded-br-xl bg-white"},U8={key:0,class:"p-[20px] border-t"},H8={key:1,class:"p-[20px] border-t"},q8=["innerHTML"];function W8(t,e,n,i,r,a){var l,g,_;const u=v.resolveComponent("router-link");return v.openBlock(),v.createElementBlock("div",T8,[v.createElementVNode("div",M8,[v.createElementVNode("div",A8,[v.createElementVNode("button",{onClick:e[0]||(e[0]=S=>t.$router.back()),class:"text-sm h-[20px] text-blue-600 font-medium hover:border-b hover:border-b-2 hover:border-b-blue-500"}," До таблиці "),v.createElementVNode("h2",P8,v.toDisplayString(a.getTitle),1)]),v.createElementVNode("div",I8,[v.createVNode(u,{to:`/edit?table=${a.getRoute}&id=${(g=(l=t.$route)==null?void 0:l.params)==null?void 0:g.id}`,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"},{default:v.withCtx(()=>e[1]||(e[1]=[v.createTextVNode(" Редагувати ")])),_:1},8,["to"])])]),v.createElementVNode("div",{class:v.normalizeClass(["grid gap-[20px]",a.getGridClass()])},[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList((_=r.objectData)==null?void 0:_.panels,(S,E)=>{var T;return v.openBlock(),v.createElementBlock("div",{key:E,class:v.normalizeClass([a.getColClass(S.col),"p-4"])},[S!=null&&S.name?(v.openBlock(),v.createElementBlock("div",D8,[v.createElementVNode("h2",O8,v.toDisplayString((S==null?void 0:S.title)||"Панель"),1),v.createElementVNode("div",{class:"p-[20px] border-t",innerHTML:(T=r.objectData)==null?void 0:T.data[S==null?void 0:S.name]},null,8,z8)])):S.type==="container"?(v.openBlock(),v.createElementBlock("div",R8,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(S.items,(I,z)=>{var F,j,Z,ie,le;return v.openBlock(),v.createElementBlock("div",{key:z,class:"border rounded-xl bg-white mb-[20px]"},[v.createElementVNode("h2",L8,v.toDisplayString((I==null?void 0:I.title)||"Панель"),1),I!=null&&I.component?(v.openBlock(),v.createElementBlock("div",N8,[(v.openBlock(),v.createBlock(v.resolveDynamicComponent(I.component),{geometry:(j=(F=r.objectData)==null?void 0:F.rows[0])==null?void 0:j.geom,zoom:16,id:(ie=(Z=t.$route)==null?void 0:Z.params)==null?void 0:ie.id},null,8,["geometry","id"]))])):v.createCommentVNode("",!0),I!=null&&I.name?(v.openBlock(),v.createElementBlock("div",B8,[v.createElementVNode("div",{innerHTML:(le=r.objectData)==null?void 0:le.data[I==null?void 0:I.name]},null,8,V8)])):v.createCommentVNode("",!0)])}),128))])):v.createCommentVNode("",!0),(S==null?void 0:S.type)==="tabs"?(v.openBlock(),v.createElementBlock(v.Fragment,{key:2},[v.createElementVNode("nav",F8,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(S==null?void 0:S.items,I=>(v.openBlock(),v.createElementBlock("button",{key:(I==null?void 0:I.name)||(I==null?void 0:I.component),onClick:z=>r.component=(I==null?void 0:I.component)||(I==null?void 0:I.name),class:v.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===(I==null?void 0:I.component)||r.component===(I==null?void 0:I.name),"":r.component!==(I==null?void 0:I.component)&&r.component!==(I==null?void 0:I.name)}])},v.toDisplayString(I==null?void 0:I.title),11,$8))),128))]),(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(S.items,(I,z)=>{var F,j,Z,ie,le;return v.openBlock(),v.createElementBlock(v.Fragment,{key:z},[r.component===(I==null?void 0:I.component)||r.component===(I==null?void 0:I.name)?(v.openBlock(),v.createElementBlock("div",j8,[I!=null&&I.component?(v.openBlock(),v.createElementBlock("div",U8,[(v.openBlock(),v.createBlock(v.resolveDynamicComponent(I.component),{geometry:(j=(F=r.objectData)==null?void 0:F.rows[0])==null?void 0:j.geom,zoom:16,id:(ie=(Z=t.$route)==null?void 0:Z.params)==null?void 0:ie.id},null,8,["geometry","id"]))])):v.createCommentVNode("",!0),I!=null&&I.name?(v.openBlock(),v.createElementBlock("div",H8,[v.createElementVNode("div",{innerHTML:(le=r.objectData)==null?void 0:le.data[I==null?void 0:I.name]},null,8,q8)])):v.createCommentVNode("",!0)])):v.createCommentVNode("",!0)],64)}),128))],64)):v.createCommentVNode("",!0)],2)}),128))],2)])}const G8=Object.freeze(Object.defineProperty({__proto__:null,default:at(C8,[["render",W8],["__scopeId","data-v-9b7dd8fb"]])},Symbol.toStringTag,{value:"Module"})),Z8={},Y8={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 X8(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",Y8,e[0]||(e[0]=[v.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),v.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),v.createElementVNode("path",{d:"M9 12h12l-3 -3"},null,-1),v.createElementVNode("path",{d:"M18 15l3 -3"},null,-1)]))}const K8=at(Z8,[["render",X8]]),J8={},Q8={viewBox:"0 0 1823 249",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function ej(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",Q8,e[0]||(e[0]=[v.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 tj=at(J8,[["render",ej]]),nj={},ij={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 rj(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",ij,e[0]||(e[0]=[v.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),v.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const sj={components:{IconChevronDown:at(nj,[["render",rj]])},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}}},oj={key:0,class:""},aj={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"},lj={key:1};function cj(t,e,n,i,r,a){var g,_,S,E,T,I,z,F,j,Z,ie,le,J;const u=v.resolveComponent("IconChevronDown"),l=v.resolveComponent("router-link");return(g=n.route)!=null&&g.menu?(v.openBlock(),v.createElementBlock("div",oj,[v.createElementVNode("button",{onClick:e[0]||(e[0]=Ee=>r.isOpen=!r.isOpen),class:v.normalizeClass(["flex cursor-pointer gap-x-3 py-2 px-3 text-sm text-gray-800 justify-start w-full border-none focus:outline-none text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300",[((S=(_=n.route)==null?void 0:_.menu)==null?void 0:S.some(Ee=>{var be,Ae;return(Ee==null?void 0:Ee.path)===t.$route.path.replace("/","")||(Ee==null?void 0:Ee.table)===((Ae=(be=t.$route)==null?void 0:be.params)==null?void 0:Ae.table)&&(Ee==null?void 0:Ee.table)}))&&"bg-gray-100"]])},[v.createTextVNode(v.toDisplayString((E=n.route)==null?void 0:E.ua)+" ",1),v.createVNode(u,{class:v.normalizeClass([[r.isOpen&&"-rotate-180"],"ml-auto duration-300"]),width:"14",height:"14"},null,8,["class"])],2),v.createVNode(v.Transition,{name:"fade"},{default:v.withCtx(()=>{var Ee;return[v.withDirectives(v.createElementVNode("ul",aj,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList((Ee=n.route)==null?void 0:Ee.menu,(be,Ae)=>{var Le,Pe;return v.openBlock(),v.createElementBlock("li",{key:Ae,class:"w-full"},[v.createVNode(l,{to:"/"+(be==null?void 0:be.path),class:v.normalizeClass([[((be==null?void 0:be.path)===t.$route.path.replace("/","")||((Pe=(Le=t.$route)==null?void 0:Le.params)==null?void 0:Pe.table)===(be==null?void 0:be.table)&&(be==null?void 0:be.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:v.withCtx(()=>[v.createTextVNode(v.toDisplayString(be==null?void 0:be.ua),1)]),_:2},1032,["to","class"])])}),128))],512),[[v.vShow,r.isOpen]])]}),_:1})])):(v.openBlock(),v.createElementBlock("div",lj,[v.createVNode(l,{to:((I=(T=n.route)==null?void 0:T.path)==null?void 0:I[0])==="/"?(z=n.route)==null?void 0:z.path:"/"+((F=n.route)==null?void 0:F.path),class:v.normalizeClass([[(((j=n.route)==null?void 0:j.path.replace("/",""))===t.$route.path.replace("/","")||((ie=(Z=t.$route)==null?void 0:Z.params)==null?void 0:ie.table)===((le=n.route)==null?void 0:le.table)&&((J=n.route)==null?void 0:J.table))&&"bg-gray-100"],"flex gap-x-3 py-2 w-full font-[400] px-3 text-sm text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300 hover:text-gray-800"])},{default:v.withCtx(()=>{var Ee;return[v.createTextVNode(v.toDisplayString((Ee=n.route)==null?void 0:Ee.ua),1)]}),_:1},8,["to","class"])]))}const uj={components:{IconLogout:K8,NavbarItem:at(sj,[["render",cj]]),IconLogo:tj,IconSearch:ny},data(){return{activeIndex:null,data:null,searchValue:""}},computed:{data(){var t,e;return(t=this.searchValue)!=null&&t.trim()?(e=this.flattenMenu(Xr.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())}):Xr.value}},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e}}},hj={class:"flex flex-col h-[100vh] border-r w-[260px] shrink-0"},dj={class:"relative"},pj={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"},fj={class:"pb-3 w-full flex flex-col flex-wrap"},mj={key:0,class:"flex flex-col gap-[6px]"},gj={key:1,class:"text-gray-800 text-lg mt-[20px]"};function yj(t,e,n,i,r,a){var S;const u=v.resolveComponent("IconLogo"),l=v.resolveComponent("IconSearch"),g=v.resolveComponent("VsText"),_=v.resolveComponent("NavbarItem");return v.openBlock(),v.createElementBlock("div",hj,[v.createVNode(u,{height:"40",width:"200",class:"my-[20px] ml-[20px]"}),v.createElementVNode("div",dj,[v.createVNode(l,{height:"16",width:"16",class:"absolute top-[12px] left-[30px] text-gray-500 z-[1]"}),v.createVNode(g,{type:"text",modelValue:r.searchValue,"onUpdate:modelValue":e[0]||(e[0]=E=>r.searchValue=E),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"])]),v.createElementVNode("div",pj,[v.createElementVNode("nav",fj,[(S=a.data)!=null&&S.length?(v.openBlock(),v.createElementBlock("ul",mj,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(a.data,(E,T)=>(v.openBlock(),v.createElementBlock("li",{key:T,class:"flex flex-col gap-[6px]"},[v.createVNode(_,{route:E},null,8,["route"])]))),128))])):(v.openBlock(),v.createElementBlock("div",gj,"Не знайдено"))])])])}const _j=at(uj,[["render",yj]]),xj={},bj={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 vj(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",bj,e[0]||(e[0]=[v.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),v.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"},null,-1),v.createElementVNode("path",{d:"M12 17h.01"},null,-1)]))}const wj=at(xj,[["render",vj]]),kj={},Sj={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 Ej(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",Sj,e[0]||(e[0]=[v.createElementVNode("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"},null,-1),v.createElementVNode("path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"},null,-1)]))}const Cj={components:{IconQuestion:wj,IconMessage:at(kj,[["render",Ej]])}},Tj={class:"h-[60px] border-b flex justify-end px-[20px]",style:{width:"calc(100vw - 260px)"}},Mj={class:"flex items-center gap-[6px]"},Aj={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"},Pj={class:"hs-tooltip [--placement:bottom] inline-block show"},Ij={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"};function Dj(t,e,n,i,r,a){const u=v.resolveComponent("IconQuestion"),l=v.resolveComponent("IconMessage");return v.openBlock(),v.createElementBlock("div",Tj,[v.createElementVNode("div",Mj,[v.createElementVNode("a",Aj,[v.createVNode(u,{height:"24",width:"24"})]),v.createElementVNode("div",Pj,[v.createElementVNode("button",Ij,[v.createVNode(l,{height:"24",width:"24"}),e[0]||(e[0]=v.createElementVNode("span",{class:"flex absolute top-0 end-0 -mt-1.5 -me-1.5"},[v.createElementVNode("span",{class:"animate-ping absolute inline-flex size-full rounded-full bg-red-400 opacity-75 dark:bg-red-600"}),v.createElementVNode("span",{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"}," 1 ")],-1))]),e[1]||(e[1]=v.createElementVNode("span",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded-lg dark:bg-neutral-700 hidden",role:"tooltip","data-popper-placement":"bottom",style:{position:"fixed",inset:"0px auto auto 0px",margin:"0px",transform:"translate(1686px, 53px)"}},null,-1))]),e[2]||(e[2]=v.createElementVNode("div",{class:"h-[30px] w-[1px] bg-gray-200 ml-[10px] mr-[10px]"},null,-1)),e[3]||(e[3]=v.createElementVNode("img",{class:"flex-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:"Image Description"},null,-1))])])}const Oj={components:{navbar:_j,AdminHeader:at(Cj,[["render",Dj]])},mounted(){this.getMenu()},computed:{isMenu(){return Xr.value}},methods:{async getMenu(){try{const{data:t}=await xt.get("/api/user-menu");Xr.value=t}catch{}}}},zj={class:"admin-wrapper"},Rj={class:"flex flex-col"};function Lj(t,e,n,i,r,a){const u=v.resolveComponent("navbar"),l=v.resolveComponent("admin-header"),g=v.resolveComponent("router-view");return v.openBlock(),v.createElementBlock("div",zj,[v.createVNode(u),v.createElementVNode("div",Rj,[a.isMenu?(v.openBlock(),v.createElementBlock(v.Fragment,{key:0},[v.createVNode(l),v.createVNode(g)],64)):v.createCommentVNode("",!0)])])}const Nj=Object.freeze(Object.defineProperty({__proto__:null,default:at(Oj,[["render",Lj],["__scopeId","data-v-3d7ecdff"]])},Symbol.toStringTag,{value:"Module"})),Bj={},Vj={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 Fj(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",Vj,e[0]||(e[0]=[v.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 $j=at(Bj,[["render",Fj]]),jj={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}}},Uj={scope:"col",class:"text-start"},Hj={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"},qj={key:0,d:"m7 15 5 5 5-5"},Wj={key:1,d:"m7 9 5-5 5 5"},Gj={key:1,class:"text-sm text-gray-800 px-[4px] py-2.5 text-start font-normal text-gray-500"};function Zj(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("th",Uj,[a.getVisibleIcon?(v.openBlock(),v.createElementBlock("button",{key:0,type:"button",class:"text-sm text-gray-800 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))},[v.createTextVNode(v.toDisplayString(a.label)+" ",1),(v.openBlock(),v.createElementBlock("svg",Hj,[r.currentSort==="asc"||r.currentSort===""?(v.openBlock(),v.createElementBlock("path",qj)):v.createCommentVNode("",!0),r.currentSort==="desc"||r.currentSort===""?(v.openBlock(),v.createElementBlock("path",Wj)):v.createCommentVNode("",!0)]))])):(v.openBlock(),v.createElementBlock("p",Gj,v.toDisplayString(a.label),1))])}const Yj=at(jj,[["render",Zj]]),Xj={},Kj={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 Jj(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",Kj,e[0]||(e[0]=[v.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),v.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),v.createElementVNode("path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),v.createElementVNode("path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)]))}const Qj=at(Xj,[["render",Jj]]),e7={},t7={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 n7(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",t7,e[0]||(e[0]=[v.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 i7=at(e7,[["render",n7]]),r7={props:{height:{type:String,default:"16"},width:{type:String,default:"12"},color:{type:String,default:"black"}}},s7={style:{display:"none"}},o7=["height","width","fill"];function a7(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock(v.Fragment,null,[(v.openBlock(),v.createElementBlock("svg",s7,e[0]||(e[0]=[v.createElementVNode("symbol",{id:"icon-pencil",viewBox:"0 0 32 32"},[v.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)]))),(v.openBlock(),v.createElementBlock("svg",{height:n.height,width:n.width,fill:n.color},e[1]||(e[1]=[v.createElementVNode("use",{"xlink:href":"#icon-pencil"},null,-1)]),8,o7))],64)}const l7={components:{IconMore:Qj,IconDelete:i7,IconEdit:at(r7,[["render",a7]])},emits:["updateTable"],props:{item:Object,table:String,isForm:null},data(){return{formVisible:!1,isDeleteConfirm:!1,formValue:{},top:0,left:0}},methods:{openConfirm(){this.isDeleteConfirm=!0,document.querySelector("body").click()},async getData(){var t;try{const{data:e}=await xt.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{xt.delete(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`),this.$notify({title:"Успішно!",message:"Об`єкт успішно видалeно",type:"success"}),await this.$emit("update-table"),this.isDeleteConfirm=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},c7={class:"hs-dropdown [--placement:bottom-right] inline-flex"},u7={class:"gap-x-2 p-[4px] rounded-lg shadow-sm hover:border-transparent border focus:outline-none text-black hover:bg-gray-50"},h7={class:"flex flex-col items-start"},d7={key:1,class:"h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto"},p7={class:"p-4"},f7={class:"mt-4 flex justify-end gap-x-3"};function m7(t,e,n,i,r,a){const u=v.resolveComponent("IconMore"),l=v.resolveComponent("IconEdit"),g=v.resolveComponent("router-link"),_=v.resolveComponent("IconDelete"),S=v.resolveComponent("VsPopover"),E=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock(v.Fragment,null,[v.createElementVNode("div",c7,[v.createVNode(S,{trigger:"click",placement:"bottom-left"},{reference:v.withCtx(()=>[v.createElementVNode("button",u7,[v.createVNode(u,{height:"16",width:"16"})])]),default:v.withCtx(()=>{var T,I,z;return[v.createElementVNode("div",h7,[n.isForm?(v.openBlock(),v.createBlock(g,{key:0,to:`/edit?table=${(I=(T=t.$route)==null?void 0:T.params)==null?void 0:I.catchAll}&id=${(z=n.item)==null?void 0:z.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:v.withCtx(()=>[v.createVNode(l,{color:"#000"}),e[4]||(e[4]=v.createTextVNode(" Редагувати "))]),_:1},8,["to"])):v.createCommentVNode("",!0),n.isForm?(v.openBlock(),v.createElementBlock("div",d7)):v.createCommentVNode("",!0),v.createElementVNode("button",{onClick:e[0]||(e[0]=v.withModifiers((...F)=>a.openConfirm&&a.openConfirm(...F),["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"},[v.createVNode(_),e[5]||(e[5]=v.createElementVNode("span",{class:"text-gray-800"},"Видалити",-1))])])]}),_:1})]),v.createVNode(E,{visible:r.isDeleteConfirm,"onUpdate:visible":e[3]||(e[3]=T=>r.isDeleteConfirm=T),title:"Ви впевнені?"},{default:v.withCtx(()=>[v.createElementVNode("div",p7,[e[6]||(e[6]=v.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей об'єкт? ",-1)),v.createElementVNode("div",f7,[v.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]=T=>r.isDeleteConfirm=!1)}," Скасувати "),v.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]=(...T)=>a.deleteElement&&a.deleteElement(...T))}," Так, я впевнена/ий ")])])]),_:1},8,["visible"])],64)}const g7=at(l7,[["render",m7]]),y7={},_7={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 x7(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",_7,e[0]||(e[0]=[v.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),v.createElementVNode("path",{d:"M7 20V4"},null,-1),v.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),v.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const b7={components:{IconExport:at(y7,[["render",x7]])},props:{table:String,columns:Array},data(){return{isOpen:!1,tableFormats:["json","csv","xlsx"],format:"",cols:[]}},methods:{async exportTable(){try{const t=await xt.get("/api/export",{params:{table:this.table,format:this.format,cols:this.cols.join(",")},responseType:"blob"}),e=new Blob([t.data],{type:"application/octet-stream"}),n=window.URL.createObjectURL(e),i=document.createElement("a");i.href=n,i.setAttribute("download",`${this.table.split(".")[0]}.${this.format}`),document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(n),this.$notify({type:"success",title:"Експорт",message:"Файл успішно експортовано!"})}catch(t){console.error("Ошибка при экспорте файла:",t),this.$notify({type:"error",title:"Помилка",message:"Не вдалося експортувати файл."})}},selectFormat(t){this.format=t}}},v7={class:"p-4"},w7={class:"pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},k7={class:"mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]"},S7={class:"pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},E7={class:"mt-2 space-y-2"},C7=["id","onChange"],T7=["for"],M7={class:"flex w-full justify-end p-[20px] gap-[6px] border-t"};function A7(t,e,n,i,r,a){const u=v.resolveComponent("IconExport"),l=v.resolveComponent("VsCheckbox"),g=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock(v.Fragment,null,[v.createElementVNode("button",{onClick:e[0]||(e[0]=_=>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"},[v.createVNode(u,{height:"16",width:"16"}),e[4]||(e[4]=v.createTextVNode(" Експорт ")),e[5]||(e[5]=v.createElementVNode("svg",{class:"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"},[v.createElementVNode("path",{d:"m6 9 6 6 6-6"})],-1))]),v.createVNode(g,{visible:r.isOpen,"onUpdate:visible":e[3]||(e[3]=_=>r.isOpen=_),title:"Експорт таблиці",size:"small"},{footer:v.withCtx(()=>[v.createElementVNode("div",M7,[e[8]||(e[8]=v.createElementVNode("button",{type:"button",class:"py-2 px-3 text-nowrap inline-flex justify-center items-center text-start bg-white border border-gray-200 text-gray-800 text-sm font-medium rounded-lg shadow-sm align-middle 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","data-hs-overlay":"#hs-pro-decm"}," Скасувати ",-1)),v.createElementVNode("button",{type:"button",class:"py-2 px-3 text-nowrap inline-flex justify-center items-center gap-x-2 text-start bg-blue-600 border border-blue-600 text-white text-sm font-medium rounded-lg shadow-sm align-middle 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[2]||(e[2]=(..._)=>a.exportTable&&a.exportTable(..._))}," Завантажити таблицю ")])]),default:v.withCtx(()=>[e[9]||(e[9]=v.createElementVNode("div",{class:"dark:border-neutral-700"},null,-1)),v.createElementVNode("div",v7,[v.createElementVNode("div",w7,[e[6]||(e[6]=v.createElementVNode("h2",{class:"text-sm text-gray-500"}," Виберіть стовпці таблиці для експорту: ",-1)),v.createElementVNode("div",k7,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(n.columns,(_,S)=>(v.openBlock(),v.createElementBlock("div",{class:"flex items-center",key:S,style:{width:"calc((100% - 10px) / 2)"}},[v.createVNode(l,{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]=E=>r.cols=E),value:_==null?void 0:_.name,label:_==null?void 0:_.ua},null,8,["modelValue","value","label"])]))),128))])]),v.createElementVNode("div",S7,[e[7]||(e[7]=v.createElementVNode("h2",{class:"text-sm text-gray-500"},"Виберіть формат таблиці:",-1)),v.createElementVNode("div",E7,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(r.tableFormats,(_,S)=>(v.openBlock(),v.createElementBlock("div",{class:"flex items-center",key:S},[v.createElementVNode("input",{type:"radio",name:"hs-pro-duecmfm",class:"shrink-0 border-gray-300 rounded-full text-blue-600 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:_,onChange:E=>a.selectFormat(_)},null,40,C7),v.createElementVNode("label",{for:_,class:"text-sm text-gray-800 ms-3 dark:text-neutral-400"}," Формат "+v.toDisplayString(_),9,T7)]))),128))])])])]),_:1},8,["visible"])],64)}const P7=at(b7,[["render",A7]]),I7={},D7={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 O7(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",D7,e[0]||(e[0]=[v.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 z7=at(I7,[["render",O7]]),R7={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)}},L7={class:"flex w-full gap-[8px] items-centr"};function N7(t,e,n,i,r,a){var u,l;return v.openBlock(),v.createElementBlock("label",L7,[v.withDirectives(v.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=g=>r.value=g),type:"checkbox"},null,512),[[v.vModelCheckbox,r.value]]),v.createTextVNode(" "+v.toDisplayString(((u=n.column)==null?void 0:u.ua)||((l=n.column)==null?void 0:l.title)),1)])}const B7={components:{IconColumns:z7,AdminTableColumnsHiddenItem:at(R7,[["render",N7]])},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])}}},V7={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"},F7={class:"py-[10px] px-[10px] w-[260px]"},$7={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 j7(t,e,n,i,r,a){const u=v.resolveComponent("IconColumns"),l=v.resolveComponent("AdminTableColumnsHiddenItem"),g=v.resolveComponent("VsPopover");return v.openBlock(),v.createBlock(g,{trigger:"click",placement:"bottom"},{reference:v.withCtx(()=>[v.createElementVNode("button",V7,[v.createVNode(u,{height:"20",width:"16"})])]),default:v.withCtx(()=>[v.createElementVNode("div",F7,[e[0]||(e[0]=v.createElementVNode("h2",{class:"text-sm mb-[8px]"},"Оберіть колонки, щоб приховати",-1)),v.createElementVNode("ul",$7,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(n.columns,(_,S)=>(v.openBlock(),v.createElementBlock("li",{key:S},[v.createVNode(l,{column:_,onUpdateColumn:a.updateColumn},null,8,["column","onUpdateColumn"])]))),128))])])]),_:1})}const U7=at(B7,[["render",j7]]),H7={},q7={class:"hidden sm:block shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"};function W7(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",q7,e[0]||(e[0]=[v.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 G7=at(H7,[["render",W7]]),Z7={},Y7={class:"vs-table-interface__table-wrp w-full rounded h-fit overflow-hidden"};function X7(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("div",Y7,e[0]||(e[0]=[v.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 K7={props:{table:String,title:String},components:{IconFilter:$j,AdminTableControl:g7,AdminTableExport:P7,AdminTableColumnsHidden:U7,AdminTableColumn:Yj,AdminNodata:at(Z7,[["render",X7]]),IconPlus:G7,IconSearch:ny},data(){return{tableData:{},isFilters:!1,filterScheme:[],page:1,searchValue:"",limit:0,filters:null,activeColumn:"",onFilters:0}},mounted(){var t,e,n,i;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.getTableData(),this.getFilters()},computed:{defaultPage(){var t,e;return((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1},getFilterScheme(){var t;return(t=this.tableData)==null?void 0:t.filters},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)},rowWidth(){var t;return((t=this.tableData)==null?void 0:t.width)||"100px"}},watch:{async table(){this.tableData=null,await this.getTableData()},searchValue(){this.getTableData()},$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.filterScheme=null,this.filters=null,this.onFilters=0,this.getFilters())},deep:!0},limit(t){var e;this.$router.push({query:{...(e=this.$route)==null?void 0:e.query,limit:t}})}},methods:{async getTableData(){var t,e;try{const{data:n}=await xt.get(`/api/template/table/${this.table}`),i=await xt.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}});this.tableData={...n,...(i==null?void 0:i.data)||{}}}catch{}},async getFilters(){var t;try{const{data:e}=await xt.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()},closeFilter({target:t}){this.isFilters&&t.classList.contains("filter-container")&&(this.isFilters=!1)},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}`)}}},J7={class:"w-[calc(100vw - 320px)]"},Q7={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},e9={class:"text-xl font-medium h-[20px]"},t9={style:{height:"calc(100vh - 140px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex pt-[10px]"},n9={class:"bg-white w-full rounded-xl border p-[20px]"},i9={class:"flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5 mb-[10px] relative"},r9={class:"flex gap-[6px] ml-auto"},s9={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"},o9={class:"space-y-5 flex items-start w-full justify-start"},a9={style:{height:"calc(100vh - 310px)"},class:"overflow-x-auto w-full border-t [&::-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"},l9={class:"inline-block w-full align-middle"},c9={key:0,class:"divide-y divide-gray-200 min-w-full dark:divide-neutral-700 relative table-fixed"},u9={class:"sticky top-0 bg-white w-full relative after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},h9={class:"border-stone-200 right-0 z-[1]"},d9={class:"divide-y divide-gray-200"},p9=["onClick"],f9={class:"text-center sticky right-0 bg-white w-[80px] px-[10px]"},m9={class:"p-[20px] flex justify-end w-full"},g9={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 y9(t,e,n,i,r,a){var ie,le,J,Ee,be,Ae;const u=v.resolveComponent("IconPlus"),l=v.resolveComponent("router-link"),g=v.resolveComponent("IconSearch"),_=v.resolveComponent("VsText"),S=v.resolveComponent("AdminTableColumnsHidden"),E=v.resolveComponent("AdminTableExport"),T=v.resolveComponent("IconFilter"),I=v.resolveComponent("AdminTableColumn"),z=v.resolveComponent("AdminTableControl"),F=v.resolveComponent("AdminNodata"),j=v.resolveComponent("VsPagination"),Z=v.resolveComponent("VsFilter");return v.openBlock(),v.createElementBlock(v.Fragment,null,[v.createElementVNode("div",J7,[v.createElementVNode("div",Q7,[v.createElementVNode("h2",e9,v.toDisplayString(n.title),1),a.isForm?(v.openBlock(),v.createBlock(l,{key:0,to:`/add?table=${(le=(ie=t.$route)==null?void 0:ie.params)==null?void 0:le.catchAll}`,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"},{default:v.withCtx(()=>[v.createVNode(u,{height:"16",width:"16"}),e[5]||(e[5]=v.createTextVNode(" Додати "))]),_:1},8,["to"])):v.createCommentVNode("",!0)]),v.createElementVNode("div",t9,[v.createElementVNode("div",n9,[v.createElementVNode("div",i9,[v.createVNode(g,{height:"14",width:"14",class:"absolute top-[10px] left-[14px] text-gray-500 z-[1]"}),v.createVNode(_,{modelValue:r.searchValue,"onUpdate:modelValue":e[0]||(e[0]=Le=>r.searchValue=Le),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"]),v.createElementVNode("div",r9,[v.createVNode(S,{columns:(J=r.tableData)==null?void 0:J.columns,onUpdateColumns:e[1]||(e[1]=Le=>r.tableData.columns=Le)},null,8,["columns"]),v.createVNode(E,{table:n.table,columns:(Ee=r.tableData)==null?void 0:Ee.columns},null,8,["table","columns"]),v.createElementVNode("button",{onClick:e[2]||(e[2]=Le=>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"},[v.createVNode(T,{height:"16",width:"16"}),e[6]||(e[6]=v.createTextVNode(" Фільтри ")),r.onFilters?(v.openBlock(),v.createElementBlock("span",s9,v.toDisplayString(r.onFilters),1)):v.createCommentVNode("",!0)])])]),v.createElementVNode("div",o9,[v.createElementVNode("div",a9,[v.createElementVNode("div",l9,[a.isNoData?(v.openBlock(),v.createBlock(F,{key:1})):(v.openBlock(),v.createElementBlock("table",c9,[v.createElementVNode("thead",u9,[v.createElementVNode("tr",h9,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(a.columns,Le=>(v.openBlock(),v.createBlock(I,{key:Le.name,style:v.normalizeStyle({minWidth:a.rowWidth,maxWidth:a.rowWidth}),data:Le,activeColumn:r.activeColumn,onChangeActive:a.changeActiveColumn},null,8,["style","data","activeColumn","onChangeActive"]))),128)),e[7]||(e[7]=v.createElementVNode("th",{class:"w-[70px] sticky right-0 top-0 bg-white"},null,-1))])]),v.createElementVNode("tbody",d9,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList((be=r.tableData)==null?void 0:be.rows,(Le,Pe)=>{var Ye,it,Nt,dt,Rt,Xt,nn,jt;return v.openBlock(),v.createElementBlock("tr",{key:Pe},[v.createElementVNode("td",{class:"text-sm text-gray-600",style:v.normalizeStyle({minWidth:a.rowWidth,maxWidth:a.rowWidth})},[v.createElementVNode("button",{onClick:()=>a.pushToCard(Le==null?void 0:Le.id),class:v.normalizeClass(["text-sm font-medium",[((Ye=r.tableData)==null?void 0:Ye.card)===!1?"":"text-blue-600 decoration-2 focus:outline-none focus:underline hover:text-blue-600 hover:underline"]])},[(v.openBlock(),v.createBlock(v.resolveDynamicComponent(((it=a.columns[0])==null?void 0:it.format)==="custom"?(Nt=a.columns[0])==null?void 0:Nt.component:t.$componentsConfig[`table-format-${((Rt=(dt=a.columns[0])==null?void 0:dt.format)==null?void 0:Rt.toLowerCase())||"text"}`]),{name:(Xt=a.columns[0])==null?void 0:Xt.name,data:Le,value:Le==null?void 0:Le[(nn=a.columns[0])==null?void 0:nn.name],table:n.table},null,8,["name","data","value","table"]))],10,p9)],4),(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList((jt=a.columns)==null?void 0:jt.slice(1),Tt=>{var Sn;return v.openBlock(),v.createElementBlock("td",{class:"text-start px-[4px] py-3 text-sm text-gray-600",style:v.normalizeStyle({minWidth:a.rowWidth,maxWidth:a.rowWidth}),key:Tt.name},[(v.openBlock(),v.createBlock(v.resolveDynamicComponent((Tt==null?void 0:Tt.format)==="custom"?Tt==null?void 0:Tt.component:t.$componentsConfig[`table-format-${((Sn=Tt==null?void 0:Tt.format)==null?void 0:Sn.toLowerCase())||"text"}`]),{onUpdateTable:a.getTableData,name:Tt==null?void 0:Tt.name,data:Le,value:Le==null?void 0:Le[Tt==null?void 0:Tt.name],table:n.table,inline:(Tt==null?void 0:Tt.inline)||!1},null,40,["onUpdateTable","name","data","value","table","inline"]))],4)}),128)),v.createElementVNode("td",f9,[v.createVNode(z,{isForm:a.isForm,item:Le,table:n.table,onUpdateTable:a.getTableData},null,8,["isForm","item","table","onUpdateTable"])])])}),128))])]))])])]),v.createElementVNode("div",m9,[r.limit?(v.openBlock(),v.createBlock(j,{key:0,goTo:!1,class:"justify-end","default-page":a.defaultPage,total:((Ae=r.tableData)==null?void 0:Ae.total)||0,pageSize:r.limit,onPageChange:a.handlePageChange,pageSizes:[10,16,20],onPageSizeChange:a.changeLimit},null,8,["default-page","total","pageSize","onPageChange","onPageSizeChange"])):v.createCommentVNode("",!0)])])])]),v.createVNode(v.Transition,{name:"fade"},{default:v.withCtx(()=>{var Le;return[v.withDirectives(v.createElementVNode("div",{onClick:e[4]||(e[4]=(...Pe)=>a.closeFilter&&a.closeFilter(...Pe)),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)]"},[v.createElementVNode("div",g9,[(Le=r.filterScheme)!=null&&Le.length?(v.openBlock(),v.createBlock(Z,{key:0,ref:"filter",scheme:r.filterScheme,layout:"default","apply-vue-router":"",history:"",name:"filter",onFilterChange:a.filterChange,closeFilterBtn:!0,onFilterClose:e[3]||(e[3]=Pe=>r.isFilters=!1)},null,8,["scheme","onFilterChange"])):v.createCommentVNode("",!0)])],512),[[v.vShow,r.isFilters]])]}),_:1})],64)}const _9={components:{AdminTable:at(K7,[["render",y9]])},data(){return{table:!1,interface:"",title:""}},watch:{$route:{async handler(){Xr!=null&&Xr.value||await this.getMenu(),await this.checkPageType()},deep:!0},title(t){t&&(document.title=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 getMenu(){try{const{data:t}=await xt.get("/api/user-menu");Xr.value=t}catch{}},async checkPageType(){const t=this.flattenMenu(Xr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(i=>{var r,a;return(i==null?void 0:i.path)==((a=(r=this.$route)==null?void 0:r.params)==null?void 0:a.catchAll)});this.title=e==null?void 0:e.ua,e||this.$router.replace("/404");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 xt.get(`/api/template/interface/${((e=(t=this.$route)==null?void 0:t.params)==null?void 0:e.catchAll)||""}`);this.interface=n||""}catch{this.interface=""}}}},x9=["innerHTML"];function b9(t,e,n,i,r,a){const u=v.resolveComponent("AdminTable");return r.table?(v.openBlock(),v.createBlock(u,{key:0,table:r.table,title:r.title},null,8,["table","title"])):(v.openBlock(),v.createElementBlock("div",{key:1,class:"w-full bg-gray-50",style:{height:"calc(100vh - 120px)"},innerHTML:r.interface},null,8,x9))}const v9=Object.freeze(Object.defineProperty({__proto__:null,default:at(_9,[["render",b9]])},Symbol.toStringTag,{value:"Module"}));return a8});
|
|
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:_,dispatch:S})=>{if(S&&g&&u){const E=g.filter(T=>l.includes(T.type.name));_.ensureMarks(E)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),ZF=bs.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]}`,di(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=>C0({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var qf=200,Ai=function(){};Ai.prototype.append=function(e){return e.length?(e=Ai.from(e),!this.length&&e||e.length<qf&&this.leafAppend(e)||this.length<qf&&e.leafPrepend(this)||this.appendInner(e)):this},Ai.prototype.prepend=function(e){return e.length?Ai.from(e).append(this):this},Ai.prototype.appendInner=function(e){return new YF(this,e)},Ai.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ai.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},Ai.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ai.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)},Ai.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},Ai.from=function(e){return e instanceof Ai?e:e&&e.length?new lS(e):Ai.empty};var lS=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<=qf)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=qf)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}(Ai);Ai.empty=new lS([]);var YF=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}(Ai);const XF=500;class Us{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}let r,a;n&&(r=this.remapping(i,this.items.length),a=r.maps.length);let u=e.tr,l,g,_=[],S=[];return this.items.forEach((E,T)=>{if(!E.step){r||(r=this.remapping(i,T+1),a=r.maps.length),a--,S.push(E);return}if(r){S.push(new co(E.map));let I=E.step.map(r.slice(a)),z;I&&u.maybeStep(I).doc&&(z=u.mapping.maps[u.mapping.maps.length-1],_.push(new co(z,void 0,void 0,_.length+S.length))),a--,z&&r.appendMap(z,a)}else u.maybeStep(E.step);if(E.selection)return l=r?E.selection.map(r.slice(a)):E.selection,g=new Us(this.items.slice(0,i).append(S.reverse().concat(_)),this.eventCount-1),!1},this.items.length,0),{remaining:g,transform:u,selection:l}}addTransform(e,n,i,r){let a=[],u=this.eventCount,l=this.items,g=!r&&l.length?l.get(l.length-1):null;for(let S=0;S<e.steps.length;S++){let E=e.steps[S].invert(e.docs[S]),T=new co(e.mapping.maps[S],E,n),I;(I=g&&g.merge(T))&&(T=I,S?a.pop():l=l.slice(0,l.length-1)),a.push(T),n&&(u++,n=void 0),r||(g=T)}let _=u-i.depth;return _>JF&&(l=KF(l,_),u-=_),new Us(l.append(a),u)}remapping(e,n){let i=new Pc;return this.items.forEach((r,a)=>{let u=r.mirrorOffset!=null&&a-r.mirrorOffset>=e?i.maps.length-r.mirrorOffset:void 0;i.appendMap(r.map,u)},e,n),i}addMaps(e){return this.eventCount==0?this:new Us(this.items.append(e.map(n=>new co(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(T=>{T.selection&&l--},r);let g=n;this.items.forEach(T=>{let I=a.getMirror(--g);if(I==null)return;u=Math.min(u,I);let z=a.maps[I];if(T.step){let F=e.steps[I].invert(e.docs[I]),j=T.selection&&T.selection.map(a.slice(g+1,I));j&&l++,i.push(new co(z,F,j))}else i.push(new co(z))},r);let _=[];for(let T=n;T<u;T++)_.push(new co(a.maps[T]));let S=this.items.slice(0,r).append(_).append(i),E=new Us(S,l);return E.emptyItemCount()>XF&&(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)),_=g&&g.getMap();if(i--,_&&n.appendMap(_,i),g){let S=u.selection&&u.selection.map(n.slice(i));S&&a++;let E=new co(_.invert(),g,S),T,I=r.length-1;(T=r.length&&r[I].merge(E))?r[I]=T:r.push(E)}}else u.map&&i--},this.items.length,0),new Us(Ai.from(r.reverse()),a)}}Us.empty=new Us(Ai.empty,0);function KF(t,e){let n;return t.forEach((i,r)=>{if(i.selection&&e--==0)return n=r,!1}),t.slice(n)}class co{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 co(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 JF=20;function QF(t,e,n,i){let r=n.getMeta(Ll),a;if(r)return r.historyState;n.getMeta(n6)&&(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(Ll))return u.getMeta(Ll).redo?new Ta(t.done.addTransform(n,void 0,i,Wf(e)),t.undone,cS(n.mapping.maps),t.prevTime,t.prevComposition):new Ta(t.done,t.undone.addTransform(n,void 0,i,Wf(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||!e6(n,t.prevRanges)),_=u?W0(t.prevRanges,n.mapping):cS(n.mapping.maps);return new Ta(t.done.addTransform(n,g?e.selection.getBookmark():void 0,i,Wf(e)),Us.empty,_,n.time,l??t.prevComposition)}else return(a=n.getMeta("rebased"))?new Ta(t.done.rebased(n,a),t.undone.rebased(n,a),W0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ta(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),W0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function e6(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 cS(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 W0(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 t6(t,e,n){let i=Wf(e),r=Ll.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(Ll,{redo:n,historyState:g})}let G0=!1,uS=null;function Wf(t){let e=t.plugins;if(uS!=e){G0=!1,uS=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){G0=!0;break}}return G0}const Ll=new Mr("history"),n6=new Mr("closeHistory");function i6(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Vi({key:Ll,state:{init(){return new Ta(Us.empty,Us.empty,null,0,-1)},apply(e,n,i){return QF(n,i,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let i=n.inputType,r=i=="historyUndo"?dS:i=="historyRedo"?pS:null;return r?(n.preventDefault(),r(e.state,e.dispatch)):!1}}}})}function hS(t,e){return(n,i)=>{let r=Ll.getState(n);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(i){let a=t6(r,n,t);a&&i(e?a.scrollIntoView():a)}return!0}}const dS=hS(!1,!0),pS=hS(!0,!0),r6=ji.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>dS(t,e),redo:()=>({state:t,dispatch:e})=>pS(t,e)}},addProseMirrorPlugins(){return[i6(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()}}}),s6=bs.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",di(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}):f2(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:_}=u.selection,S=_.end();if(_.nodeAfter)_.nodeAfter.isTextblock?u.setSelection(Ft.create(u.doc,_.pos+1)):_.nodeAfter.isBlock?u.setSelection(zt.create(u.doc,_.pos)):u.setSelection(Ft.create(u.doc,_.pos));else{const E=(g=_.parent.type.contentMatch.defaultType)===null||g===void 0?void 0:g.create();E&&(u.insert(S,E),u.setSelection(Ft.create(u.doc,S+1)))}u.scrollIntoView()}return!0}).run()}}},addInputRules(){return[N4({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),o6=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,a6=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,l6=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,c6=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,u6=Lo.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",di(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[qc({find:o6,type:this.type}),qc({find:l6,type:this.type})]},addPasteRules(){return[Wc({find:a6,type:this.type}),Wc({find:c6,type:this.type})]}}),fS=/^(\d+)\.\s$/,h6=bs.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",di(this.options.HTMLAttributes,n),0]:["ol",di(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(H0.name,this.editor.getAttributes(Uf.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Nh({find:fS,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=Nh({find:fS,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Uf.name)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),d6=bs.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",di(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),p6=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,f6=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,m6=Lo.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",di(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[qc({find:p6,type:this.type})]},addPasteRules(){return[Wc({find:f6,type:this.type})]}}),g6=bs.create({name:"text",group:"inline"}),y6=ji.create({name:"starterKit",addExtensions(){var t,e,n,i,r,a,u,l,g,_,S,E,T,I,z,F,j,Z;const ie=[];return this.options.bold!==!1&&ie.push(MF.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&ie.push(kF.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&ie.push(AF.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&ie.push(DF.configure((i=this.options)===null||i===void 0?void 0:i.code)),this.options.codeBlock!==!1&&ie.push(aS.configure((r=this.options)===null||r===void 0?void 0:r.codeBlock)),this.options.document!==!1&&ie.push(RF.configure((a=this.options)===null||a===void 0?void 0:a.document)),this.options.dropcursor!==!1&&ie.push(BF.configure((u=this.options)===null||u===void 0?void 0:u.dropcursor)),this.options.gapcursor!==!1&&ie.push(WF.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&ie.push(GF.configure((g=this.options)===null||g===void 0?void 0:g.hardBreak)),this.options.heading!==!1&&ie.push(ZF.configure((_=this.options)===null||_===void 0?void 0:_.heading)),this.options.history!==!1&&ie.push(r6.configure((S=this.options)===null||S===void 0?void 0:S.history)),this.options.horizontalRule!==!1&&ie.push(s6.configure((E=this.options)===null||E===void 0?void 0:E.horizontalRule)),this.options.italic!==!1&&ie.push(u6.configure((T=this.options)===null||T===void 0?void 0:T.italic)),this.options.listItem!==!1&&ie.push(H0.configure((I=this.options)===null||I===void 0?void 0:I.listItem)),this.options.orderedList!==!1&&ie.push(h6.configure((z=this.options)===null||z===void 0?void 0:z.orderedList)),this.options.paragraph!==!1&&ie.push(d6.configure((F=this.options)===null||F===void 0?void 0:F.paragraph)),this.options.strike!==!1&&ie.push(m6.configure((j=this.options)===null||j===void 0?void 0:j.strike)),this.options.text!==!1&&ie.push(g6.configure((Z=this.options)===null||Z===void 0?void 0:Z.text)),ie}});function _6(t){var e;const{char:n,allowSpaces:i,allowedPrefixes:r,startOfLine:a,$position:u}=t,l=B4(n),g=new RegExp(`\\s${l}$`),_=a?"^":"",S=i?new RegExp(`${_}${l}.*?(?=\\s${l}|$)`,"gm"):new RegExp(`${_}(?:^)?${l}[^\\s${l}]*`,"gm"),E=((e=u.nodeBefore)===null||e===void 0?void 0:e.isText)&&u.nodeBefore.text;if(!E)return null;const T=u.pos-E.length,I=Array.from(E.matchAll(S)).pop();if(!I||I.input===void 0||I.index===void 0)return null;const z=I.input.slice(Math.max(0,I.index-1),I.index),F=new RegExp(`^[${r==null?void 0:r.join("")}\0]?$`).test(z);if(r!==null&&!F)return null;const j=T+I.index;let Z=j+I[0].length;return i&&g.test(E.slice(Z-1,Z+1))&&(I[0]+=" ",Z+=1),j<u.pos&&Z>=u.pos?{range:{from:j,to:Z},query:I[0].slice(n.length),text:I[0]}:null}const x6=new Mr("suggestion");function b6({pluginKey:t=x6,editor:e,char:n="@",allowSpaces:i=!1,allowedPrefixes:r=[" "],startOfLine:a=!1,decorationTag:u="span",decorationClass:l="suggestion",command:g=()=>null,items:_=()=>[],render:S=()=>({}),allow:E=()=>!0,findSuggestionMatch:T=_6}){let I;const z=S==null?void 0:S(),F=new Vi({key:t,view(){return{update:async(j,Z)=>{var ie,le,J,Ee,be,Ae,Le;const Pe=(ie=this.key)===null||ie===void 0?void 0:ie.getState(Z),Ye=(le=this.key)===null||le===void 0?void 0:le.getState(j.state),it=Pe.active&&Ye.active&&Pe.range.from!==Ye.range.from,Nt=!Pe.active&&Ye.active,dt=Pe.active&&!Ye.active,Rt=!Nt&&!dt&&Pe.query!==Ye.query,Xt=Nt||it&&Rt,nn=Rt||it,jt=dt||it&&Rt;if(!Xt&&!nn&&!jt)return;const Tt=jt&&!Xt?Pe:Ye,Sn=j.dom.querySelector(`[data-decoration-id="${Tt.decorationId}"]`);I={editor:e,range:Tt.range,query:Tt.query,text:Tt.text,items:[],command:_n=>g({editor:e,range:Tt.range,props:_n}),decorationNode:Sn,clientRect:Sn?()=>{var _n;const{decorationId:In}=(_n=this.key)===null||_n===void 0?void 0:_n.getState(e.state),xn=j.dom.querySelector(`[data-decoration-id="${In}"]`);return(xn==null?void 0:xn.getBoundingClientRect())||null}:null},Xt&&((J=z==null?void 0:z.onBeforeStart)===null||J===void 0||J.call(z,I)),nn&&((Ee=z==null?void 0:z.onBeforeUpdate)===null||Ee===void 0||Ee.call(z,I)),(nn||Xt)&&(I.items=await _({editor:e,query:Tt.query})),jt&&((be=z==null?void 0:z.onExit)===null||be===void 0||be.call(z,I)),nn&&((Ae=z==null?void 0:z.onUpdate)===null||Ae===void 0||Ae.call(z,I)),Xt&&((Le=z==null?void 0:z.onStart)===null||Le===void 0||Le.call(z,I))},destroy:()=>{var j;I&&((j=z==null?void 0:z.onExit)===null||j===void 0||j.call(z,I))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(j,Z,ie,le){const{isEditable:J}=e,{composing:Ee}=e.view,{selection:be}=j,{empty:Ae,from:Le}=be,Pe={...Z};if(Pe.composing=Ee,J&&(Ae||e.view.composing)){(Le<Z.range.from||Le>Z.range.to)&&!Ee&&!Z.composing&&(Pe.active=!1);const Ye=T({char:n,allowSpaces:i,allowedPrefixes:r,startOfLine:a,$position:be.$from}),it=`id_${Math.floor(Math.random()*4294967295)}`;Ye&&E({editor:e,state:le,range:Ye.range,isActive:Z.active})?(Pe.active=!0,Pe.decorationId=Z.decorationId?Z.decorationId:it,Pe.range=Ye.range,Pe.query=Ye.query,Pe.text=Ye.text):Pe.active=!1}else Pe.active=!1;return Pe.active||(Pe.decorationId=null,Pe.range={from:0,to:0},Pe.query=null,Pe.text=null),Pe}},props:{handleKeyDown(j,Z){var ie;const{active:le,range:J}=F.getState(j.state);return le&&((ie=z==null?void 0:z.onKeyDown)===null||ie===void 0?void 0:ie.call(z,{view:j,event:Z,range:J}))||!1},decorations(j){const{active:Z,range:ie,decorationId:le}=F.getState(j);return Z?hi.create(j.doc,[Gr.inline(ie.from,ie.to,{nodeName:u,class:l,"data-decoration-id":le})]):null}}});return F}const v6=new Mr("mention"),w6=bs.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",di(this.HTMLAttributes,t.HTMLAttributes),`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`]},suggestion:{char:"@",pluginKey:v6,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",di({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t})];const n={...this.options};n.HTMLAttributes=di({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:n,node:t});return typeof i=="string"?["span",di({"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[b6({editor:this.editor,...this.options.suggestion})]}}),k6={props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function S6(t,e,n,i,r,a){return v.openBlock(),v.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]=[v.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[v.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 E6=at(k6,[["render",S6]]),C6={props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function T6(t,e,n,i,r,a){return v.openBlock(),v.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]=[v.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[v.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 8h10M9 12h10M9 16h10M4.99 8H5m-.02 4h.01m0 4H5"})],-1)]))}const M6=at(C6,[["render",T6]]),A6={props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function P6(t,e,n,i,r,a){return v.openBlock(),v.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]=[v.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[v.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 I6=at(A6,[["render",P6]]),D6={props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function O6(t,e,n,i,r,a){return v.openBlock(),v.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]=[v.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"},[v.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 z6=at(D6,[["render",O6]]),R6={props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.chain().toggleBold().run()}}};function L6(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleBold&&a.toggleBold(...u)),class:v.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]=[v.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"},[v.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),v.createElementVNode("span",{class:"sr-only"},"Bold",-1)]),2)}const N6=at(R6,[["render",L6]]),B6={props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function V6(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleItalic&&a.toggleItalic(...u)),class:v.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]=[v.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"},[v.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),v.createElementVNode("span",{class:"sr-only"},"Italic",-1)]),2)}const F6={bold:N6,italic:at(B6,[["render",V6]]),bullet_list:M6,ordered_list:I6,blockquote:E6,codeblock:z6},$6={components:{EditorContent:vF},props:{controls:{type:Array,default:()=>["bold","italic","blockquote","bullet_list","ordered_list","codeblock"]},options:{type:Array,default:()=>[]},modelValue:{type:String,default:()=>""}},data(){return{editor:null}},computed:{controlsList(){return Object.entries(F6).filter(([t])=>this.controls.includes(t)).map(([t,e])=>e)}},watch:{modelValue(t){this.editor&&this.editor.getHTML()!==t&&this.editor.commands.setContent(t)},editor(t){t&&this.editor.on("update",({editor:e})=>{const n=e.getHTML();n!==this.modelValue&&this.$emit("update:modelValue",n)})}},mounted(){this.editor&&this.editor.destroy(),this.initEditor()},beforeDestroy(){this.editor&&this.editor.destroy()},methods:{initEditor(){this.editor=new bF({content:this.modelValue,extensions:[y6,aS,w6.configure({HTMLAttributes:{class:"mention"},suggestion:{items:({query:t})=>{const e=this.options.filter(n=>{var i,r;return(r=(i=n==null?void 0:n.email)==null?void 0:i.toLowerCase())==null?void 0:r.includes(t==null?void 0:t.toLowerCase())}).slice(0,5);return e.length?e:[{id:null,text:"Данні відсутні",email:null}]},render:()=>{let t,e;return{onStart:n=>{t=document.createElement("div"),t.className="mention-popup",n.items.forEach(a=>{const u=document.createElement("div");u.className="mention-option",a.id===null?(u.textContent=a.text,u.style.pointerEvents="none",u.style.color="#999"):(u.textContent=a.text,u.addEventListener("click",()=>{n.command({id:a.id,label:a.email})})),t.appendChild(u)}),document.body.appendChild(t);const{from:i}=n.range,r=n.editor.view.coordsAtPos(i);t.style.position="absolute",t.style.left=`${r.left}px`,t.style.top=`${r.top-t.offsetHeight}px`,e=t},onUpdate:n=>{for(;t.firstChild;)t.removeChild(t.firstChild);n.items.forEach(a=>{const u=document.createElement("div");u.className="mention-option",a.id===null?(u.textContent=a.text,u.style.pointerEvents="none",u.style.color="#999"):(u.textContent=a.text,u.addEventListener("click",()=>{n.command({id:a.id,label:a.email})})),t.appendChild(u)});const{from:i}=n.range,r=n.editor.view.coordsAtPos(i);t.style.left=`${r.left}px`,t.style.top=`${r.top-t.offsetHeight}px`},onExit:()=>{e&&e.remove()}}}}})]})},focusEditor(){this.editor&&!this.editor.isFocused&&this.editor.commands.focus()}}},j6={class:"editor-container w-full border border-gray-200 rounded-lg bg-gray-50 dark:bg-gray-700 dark:border-gray-600"},U6={key:0,class:"editor-toolbar px-3 py-2 border-b dark:border-gray-600 flex items-center gap-2"};function H6(t,e,n,i,r,a){const u=v.resolveComponent("EditorContent");return v.openBlock(),v.createElementBlock("div",j6,[r.editor?(v.openBlock(),v.createElementBlock("div",U6,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(a.controlsList,(l,g)=>(v.openBlock(),v.createBlock(v.resolveDynamicComponent(l),{key:g,editor:r.editor},null,8,["editor"]))),128))])):v.createCommentVNode("",!0),v.createElementVNode("div",{onClick:e[0]||(e[0]=(...l)=>a.focusEditor&&a.focusEditor(...l)),class:"editor-content px-4 py-2 bg-white rounded-b-lg dark:bg-gray-800 relative"},[v.createVNode(u,{editor:r.editor,class:"relative"},null,8,["editor"])])])}const mS=at($6,[["render",H6]]),q6=t=>{const e=/(\b\S)?/g,n=t.match(e);return n?n.join("").toUpperCase():""},W6={props:{name:{type:String,default(){return""}},avatar:{type:String,default(){return""}}},computed:{inItials(){return q6(this.name)}}},G6={class:"mr-2"},Z6=["src"],Y6={key:1,class:"flex flex-shrink-0 items-center justify-center w-6 h-6 bg-gray-500 text-xs text-white rounded-full"},X6={key:0},K6={key:1,class:"text-sm"};function J6(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("div",G6,[n.avatar?(v.openBlock(),v.createElementBlock("img",{key:0,src:n.avatar,alt:"avatar",class:"flex flex-shrink-0 items-center justify-center w-6 h-6 rounded-full"},null,8,Z6)):n.name?(v.openBlock(),v.createElementBlock("div",Y6,[a.inItials.length?(v.openBlock(),v.createElementBlock("span",X6,v.toDisplayString(a.inItials),1)):(v.openBlock(),v.createElementBlock("span",K6,e[0]||(e[0]=[v.createElementVNode("i",{class:"ti ti-user"},null,-1)])))])):v.createCommentVNode("",!0)])}const Q6={components:{VsWidgetCommentsAvatar:at(W6,[["render",J6]]),VsTextEditor:mS},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=lt(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 xt.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"})}},async deleteComment(){try{await xt.delete(`/api/widget/comment/${this.id}/${this.comment.communication_id}`),this.$emit("list-update"),this.isCommentActionVisible=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},toggleCommentAction(){this.isCommentActionVisible=!this.isCommentActionVisible}}},e$={class:"p-6 text-base bg-white dark:bg-gray-900"},t$={class:"flex justify-between items-center mb-2"},n$={class:"flex items-center"},i$={class:"inline-flex items-center mr-3 text-sm text-gray-900 dark:text-white font-semibold capitalize"},r$={class:"text-sm text-gray-600 dark:text-gray-400"},s$=["innerHTML"],o$={class:"flex items-center gap-[4px]"},a$={class:"flex flex-col gap-[8px] text-sm font-medium text-gray-500"},l$={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function c$(t,e,n,i,r,a){const u=v.resolveComponent("VsWidgetCommentsAvatar"),l=v.resolveComponent("VsTextEditor"),g=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock(v.Fragment,null,[v.createElementVNode("div",e$,[v.createElementVNode("div",t$,[v.createElementVNode("div",n$,[v.createElementVNode("p",i$,[v.createVNode(u,{name:n.comment.username,avatar:n.comment.avatar},null,8,["name","avatar"]),v.createTextVNode(v.toDisplayString(n.comment.username),1)]),v.createElementVNode("div",r$,v.toDisplayString(a.createDate),1)])]),v.createElementVNode("p",{class:"text-gray-500 dark:text-gray-400",innerHTML:n.comment.body},null,8,s$),v.createElementVNode("div",o$,[v.createElementVNode("button",{type:"button",class:"block py-2 dark:hover:bg-gray-600 hover:underline dark:hover:text-white text-start duration-300",onClick:e[0]||(e[0]=_=>r.isOpen=!0)}," Редагувати "),v.createElementVNode("button",{type:"button",class:"block py-2 dark:hover:bg-gray-600 hover:underline dark:hover:text-white text-start duration-300",onClick:e[1]||(e[1]=_=>a.confirnDeleteComment())}," Видалити ")])]),v.createVNode(g,{visible:r.isOpen,"onUpdate:visible":e[5]||(e[5]=_=>r.isOpen=_),title:"Редагувати",size:"small"},{footer:v.withCtx(()=>[v.createElementVNode("div",l$,[v.createElementVNode("button",{onClick:e[3]||(e[3]=_=>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"}," Відмінити "),v.createElementVNode("button",{onClick:e[4]||(e[4]=(..._)=>a.updateComment&&a.updateComment(..._)),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:v.withCtx(()=>[v.createElementVNode("div",a$,[e[6]||(e[6]=v.createTextVNode(" Коментар ")),v.createVNode(l,{modelValue:r.textareaValue,"onUpdate:modelValue":e[2]||(e[2]=_=>r.textareaValue=_),options:n.options},null,8,["modelValue","options"])])]),_:1},8,["visible"])],64)}const u$={components:{VsWidgetCommentsItem:at(Q6,[["render",c$]])},inject:["activeAddFormEditor"],props:{id:{type:String,default:()=>""},prefilledData:{type:Object,default:null},options:Array},data(){return{isLoaded:!1,isLoadFailed:!1,comments:[],user:{},modal:{title:"",message:"",cancel:"",confirm:"",cancelButtonText:"",confirmButtonText:""},isModalVisible:!1}},async created(){await this.getComments()},methods:{async getComments(){if(this.prefilledData){this.comments=this.prefilledData.rows,this.isLoaded=!0;return}try{const{data:t}=await xt.get(`/api/widget/comment/${this.id}`);this.comments=t.rows,this.user=t.user}catch(t){this.isLoadFailed=!0,console.error(t)}this.isLoaded=!0,this.$emit("update-comment-count")},prepareModal(t){const e={...t};return t.cancel||(e.cancel=()=>{this.isModalVisible=!1}),t.updateListOnConfirm&&(e.confirm=async()=>{await t.confirm(),this.isModalVisible=!1}),e},handleOpenModal(t){this.modal=this.prepareModal(t),this.isModalVisible=!0}}},h$={class:"flex flex-col divide-y"},d$={key:0,class:"max-h-[300px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},p$={key:1},f$={class:"p-4"},m$={class:"mt-1 text-gray-500 dark:text-neutral-500"},g$={class:"mt-4 flex justify-end gap-x-3"};function y$(t,e,n,i,r,a){const u=v.resolveComponent("VsErrorOnLoading"),l=v.resolveComponent("VsWidgetCommentsItem"),g=v.resolveComponent("VsLoader"),_=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock("div",h$,[r.isLoaded?(v.openBlock(),v.createElementBlock(v.Fragment,{key:0},[r.isLoadFailed?(v.openBlock(),v.createBlock(u,{key:0})):(v.openBlock(),v.createElementBlock(v.Fragment,{key:1},[r.comments.length?(v.openBlock(),v.createElementBlock("div",d$,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(r.comments,(S,E)=>(v.openBlock(),v.createBlock(l,{key:E,comment:S,user:r.user,options:n.options,index:E,id:n.id,onListUpdate:a.getComments,class:"border-top",onOpenModal:e[0]||(e[0]=T=>a.handleOpenModal(T))},null,8,["comment","user","options","index","id","onListUpdate"]))),128))])):(v.openBlock(),v.createElementBlock("div",p$,e[4]||(e[4]=[v.createElementVNode("p",{class:"pl-3 text-sm font-medium text-gray-600"}," Коментарі відсутні ",-1)])))],64))],64)):(v.openBlock(),v.createBlock(g,{key:1,class:"justify-center",text:"Please wait..."})),v.createVNode(_,{title:r.modal.title,size:"small",visible:r.isModalVisible,"onUpdate:visible":e[3]||(e[3]=S=>r.isModalVisible=S)},{default:v.withCtx(()=>[v.createElementVNode("div",f$,[v.createElementVNode("p",m$,v.toDisplayString(r.modal.message),1),v.createElementVNode("div",g$,[v.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[1]||(e[1]=(...S)=>r.modal.cancel&&r.modal.cancel(...S))},v.toDisplayString(r.modal.cancelButtonText),1),v.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[2]||(e[2]=(...S)=>r.modal.confirm&&r.modal.confirm(...S))},v.toDisplayString(r.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const _$=at(u$,[["render",y$]]),x$={components:{VsTextEditor:mS},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 xt.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}}},b$={class:"w-full widget-comment-form"},v$={class:"mb-4 bg-white border-gray-200 dark:bg-gray-800 dark:border-gray-700"},w$={class:"flex"};function k$(t,e,n,i,r,a){const u=v.resolveComponent("VsTextEditor");return v.openBlock(),v.createElementBlock("div",b$,[v.createElementVNode("div",v$,[v.createVNode(u,{modelValue:r.commentContent,"onUpdate:modelValue":e[0]||(e[0]=l=>r.commentContent=l),options:n.options},null,8,["modelValue","options"])]),v.createElementVNode("div",w$,[v.createElementVNode("button",{ref:"buttonAdd",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300",onClick:e[1]||(e[1]=(...l)=>a.addNewComment&&a.addNewComment(...l))}," Відправити коментар ",512)])])}const S$={components:{VsWidgetCommentsList:_$,VsWidgetCommentsAddForm:at(x$,[["render",k$]])},props:{id:{type:String,default(){return""}},prefilledData:{type:Object,default:null}},data(){return{activeAddFormEditor:"",comments:[],totalComment:"0",options:[]}},mounted(){this.comments=this.$refs.commentListRef.comments,this.getUsersList()},watch:{comments(t){this.$emit("count-change",t.length)}},methods:{async getUsersList(){try{const{data:t}=await xt.get("/api/suggest/core.user_mentioned");this.options=t}catch(t){console.log(t)}},listUpdate(){this.$refs.commentListRef.getComments()},updateCommentCount(){this.totalComment=this.$refs.commentListRef.comments.length||"0"}}},E$={class:"bg-white-200"};function C$(t,e,n,i,r,a){const u=v.resolveComponent("VsWidgetCommentsAddForm"),l=v.resolveComponent("VsWidgetCommentsList");return v.openBlock(),v.createElementBlock("div",E$,[e[2]||(e[2]=v.createElementVNode("div",{class:"flex justify-between items-center gap-x-2 mb-4"},null,-1)),v.createVNode(u,{options:r.options,class:"mb-6",id:n.id,onListUpdate:e[0]||(e[0]=g=>a.listUpdate())},null,8,["options","id"]),v.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 T$=at(S$,[["render",C$]]),gS=t=>new Date(t).toLocaleDateString("uk-UK",{day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric"}),M$=t=>new Date(t).toLocaleDateString("uk-UK",{day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric"}),A$=t=>{const e=/(\b\S)?/g,n=t.match(e);return n?n.join("").toUpperCase():""},P$=v.defineComponent({props:{username:{type:String,default:()=>""}},computed:{inItials(){return A$(this.username)}}}),I$={class:"flex flex-shrink-0 items-center justify-center w-8 h-8 bg-gray-500 text-xs text-white rounded-full"};function D$(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("div",I$,v.toDisplayString(t.inItials),1)}const O$=at(P$,[["render",D$]]),Z0={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)=>{Z0.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)})}},z$={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 Z0.promise("https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.js"),await Z0.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 v.openBlock(),v.createElementBlock("div",R$)}const N$=at(z$,[["render",L$]]),B$=v.defineComponent({components:{VsWidgetHistoryItemAvatar:O$,VsWidgetHistoryItemMap:N$},props:{item:{type:Object,default:()=>{}}},methods:{getTitle(t){return t.title||t.attr},getOldValue(t){return t.old||"Не вказано"},getNewValue(t){return t.new||"Не вказано"},getDate(t){return M$(t.cdate)}}}),V$={class:"relative [&_p]:m-0"},F$={class:"flex items-center gap-3"},$$={class:"w-full flex justify-between"},j$={class:"text-gray-500"},U$={class:"text-gray-800 font-medium"},H$={class:"text-gray-500 text-sm"},q$={class:"mt-2 pl-10"},W$={key:0},G$={key:1,class:"flex items-center gap-2 text-gray-700 text-sm"},Z$={class:"font-medium"},Y$={class:"font-medium"};function X$(t,e,n,i,r,a){const u=v.resolveComponent("VsWidgetHistoryItemAvatar"),l=v.resolveComponent("VsWidgetHistoryItemMap");return v.openBlock(),v.createElementBlock("div",V$,[v.createElementVNode("div",F$,[v.createVNode(u,{username:t.item.username},null,8,["username"]),v.createElementVNode("div",$$,[v.createElementVNode("p",j$,[v.createElementVNode("span",U$,v.toDisplayString(t.item.username),1),e[0]||(e[0]=v.createTextVNode(" змінив данні: "))]),v.createElementVNode("p",H$,v.toDisplayString(t.getDate(t.item)),1)])]),v.createElementVNode("div",q$,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(t.item.changes,(g,_)=>(v.openBlock(),v.createElementBlock("div",{key:_},[g.attr==="geom"?(v.openBlock(),v.createElementBlock("div",W$,[e[1]||(e[1]=v.createElementVNode("p",null,"Додана геометрія:",-1)),g.new?(v.openBlock(),v.createBlock(l,{key:0,point:g.new},null,8,["point"])):v.createCommentVNode("",!0)])):(v.openBlock(),v.createElementBlock("div",G$,[v.createElementVNode("p",null,v.toDisplayString(`- ${t.getTitle(g)}:`),1),v.createElementVNode("p",Z$,v.toDisplayString(t.getOldValue(g)),1),e[2]||(e[2]=v.createElementVNode("i",{class:"ti ti-arrow-right"},null,-1)),v.createElementVNode("p",Y$,v.toDisplayString(t.getNewValue(g)),1)]))]))),128))])])}const K$=at(B$,[["render",X$]]),J$=v.defineComponent({components:{VsWidgetHistoryItem:K$,VsEmptyWidget:Ey},props:{id:{type:String,default:""},prefilledData:{type:Object,default:null}},data:()=>({history:{}}),computed:{createdDate(){return this.history.data?gS(this.history.data.cdate):""},lastEditDate(){return this.history.data?gS(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 xt.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)}}}),Q$={class:"bg-white"},e8={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"},t8={key:1,class:"w-full h-[330px] flex items-center justify-center"};function n8(t,e,n,i,r,a){var l;const u=v.resolveComponent("VsWidgetHistoryItem");return v.openBlock(),v.createElementBlock("div",Q$,[e[0]||(e[0]=v.createElementVNode("div",{class:"flex justify-between items-center gap-x-2 mb-4"},null,-1)),(l=t.history.rows)!=null&&l.length?(v.openBlock(),v.createElementBlock("ul",e8,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(t.history.rows,g=>(v.openBlock(),v.createElementBlock("li",{class:"list-none",key:g.uid},[v.createVNode(u,{item:g},null,8,["item"])]))),128))])):(v.openBlock(),v.createElementBlock("div",t8," Історія відсутні "))])}const i8={"vs-widget-map":gR,"vs-widget-gallery":ZL,"vs-widget-comments":T$,"vs-widget-file":AL,"vs-widget-history":at(J$,[["render",n8]])},r8={},s8={style:{width:"calc(100vw - 300px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 flex items-center justify-center"},o8={...i8,...r8,"vs-dashboard":{__name:"vs-dashboard",setup(t){return(e,n)=>(v.openBlock(),v.createElementBlock("div",s8,n[0]||(n[0]=[v.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"},[v.createElementVNode("div",{class:"mb-4 xl:mb-8"},[v.createElementVNode("h1",{class:"text-lg font-semibold text-gray-800 dark:text-neutral-200"}," Members "),v.createElementVNode("p",{class:"text-sm text-gray-500 dark:text-neutral-500"}," Manage members and users of your workspace and set their access level. ")]),v.createElementVNode("div",{class:"space-y-5"},[v.createElementVNode("div",{class:"flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5"},[v.createElementVNode("div",{class:"relative w-full"},[v.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-20 ps-3.5"},[v.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"},[v.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),v.createElementVNode("path",{d:"m21 21-4.3-4.3"})])]),v.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"}),v.createElementVNode("div",{class:"hidden absolute inset-y-0 end-0 flex items-center pointer-events-none z-20 pe-1"},[v.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"},[v.createElementVNode("span",{class:"sr-only"},"Close"),v.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"},[v.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),v.createElementVNode("path",{d:"m15 9-6 6"}),v.createElementVNode("path",{d:"m9 9 6 6"})])])])]),v.createElementVNode("div",{class:"flex justify-end items-center gap-x-2"},[v.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"},[v.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"},[v.createElementVNode("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),v.createElementVNode("polyline",{points:"7 10 12 15 17 10"}),v.createElementVNode("line",{x1:"12",x2:"12",y1:"15",y2:"3"})]),v.createElementVNode("span",{class:"hidden sm:block"}," Download CSV ")]),v.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"},[v.createElementVNode("span",{class:"hidden sm:block"},"Send"),v.createTextVNode("Invite ")])])]),v.createElementVNode("div",{class:"grid sm:grid-cols-2 lg:grid-cols-4 gap-2 xl:gap-4"},[v.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[v.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[v.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}),v.createElementVNode("div",{class:"flex items-center -space-x-2"},[v.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"})])]),v.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Admin")]),v.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[v.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[v.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 5 "),v.createElementVNode("div",{class:"flex items-center -space-x-2"},[v.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"}),v.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 "),v.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"}),v.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"}),v.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 ")])]),v.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[v.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Members"),v.createElementVNode("div",{class:"hs-tooltip inline-block"},[v.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"},[v.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"}),v.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"})]),v.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. ")])])]),v.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[v.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[v.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 2 "),v.createElementVNode("div",{class:"flex items-center -space-x-2"},[v.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 "),v.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 ")])]),v.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[v.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"}," Limited access members "),v.createElementVNode("div",{class:"hs-tooltip inline-block"},[v.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"},[v.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"}),v.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"})]),v.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. ")])])]),v.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[v.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[v.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 0 "),v.createElementVNode("div",{class:"flex items-center -space-x-2"})]),v.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Pending invites")])]),v.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"},[v.createElementVNode("div",{class:"min-w-full inline-block align-middle"},[v.createElementVNode("table",{class:"min-w-full divide-y divide-gray-200 dark:divide-neutral-700"},[v.createElementVNode("thead",null,[v.createElementVNode("tr",null,[v.createElementVNode("th",{scope:"col",class:"min-w-[250px]"},[v.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 ")]),v.createElementVNode("th",{scope:"col",class:"min-w-48"},[v.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 ")]),v.createElementVNode("th",{scope:"col"},[v.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 ")]),v.createElementVNode("th",{scope:"col",class:"min-w-36"},[v.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 ")]),v.createElementVNode("th",{scope:"col"},[v.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 ")])])]),v.createElementVNode("tbody",{class:"divide-y divide-gray-200 dark:divide-neutral-700"},[v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.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"}),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Admin ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," james@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.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"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),v.createTextVNode(" Active ")])])]),v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.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 "),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," liza@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 2 days ago ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.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"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),v.createTextVNode(" Inactive ")])])]),v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.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"}),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Daniel Hobbs ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," dhobbs@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.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"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),v.createTextVNode(" Inactive ")])])]),v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.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"}),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Brian Warner ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," brian@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 1 months ago ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.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"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),v.createTextVNode(" Active ")])])]),v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.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 "),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Ols Shols ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," olsshols@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 6 days ago ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.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"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),v.createTextVNode(" Inactive ")])])])])])])])])],-1)])))}}},a8={install(t,{componentsApp:e={},menu:n=[]}){var a;xt.defaults.baseURL&&(xt.defaults.baseURL=xt.defaults.baseURL);const i=(a=R1(n))==null?void 0:a.filter(u=>u==null?void 0:u.component).map(u=>({...u,component:{...e,...Oz}[u==null?void 0:u.component]}));console.log(i);const{router:r}=lA(i);Object.entries({...o8,...e}).forEach(([u,l])=>{t.component(u,l)}),t.component("admin",MT),t.config.globalProperties={...t.config.globalProperties,$componentsConfig:{...WO,componentsApp:e},$router:r},t.use(r)}},Xr=v.ref(null),l8={data(){return{formValues:{},scheme:null,table:""}},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(Xr.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 xt.get(`/api/template/table/${n}`),{data:{rows:u}}=await xt.get(`/api/table-data/${this.table}/${(r=(i=this.$route)==null?void 0:i.query)==null?void 0:r.id}`);this.formValues=u==null?void 0:u[0];const{data:l}=await xt.get(`/api/template/form/${a}`);this.scheme=(l==null?void 0:l.schema)||l}catch{}},async editObject(){var t,e;try{await this.$refs.form.doValidation(),await xt.put(`/api/table/${this.table}/${(e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.id}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},c8={style:{width:"calc(100vw - 260px)"}},u8={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},h8={class:"flex items-center gap-[6px]"},d8={style:{height:"calc(100vh - 140px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},p8={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 f8(t,e,n,i,r,a){const u=v.resolveComponent("VsForm");return v.openBlock(),v.createElementBlock("div",c8,[v.createElementVNode("div",u8,[e[3]||(e[3]=v.createElementVNode("h2",{class:"text-xl font-medium"},"Редагувати",-1)),v.createElementVNode("div",h8,[v.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"py-2 px-3 flex items-center gap-x-2 text-sm font-medium rounded-lg border bg-white border-gray-100 text-gray-800 shadow focus:outline-none hover:bg-gray-50 hover:border-gray-100 duration-300"}," Скасувати "),v.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.editObject&&a.editObject(...l)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"}," Зберегти ")])]),v.createElementVNode("div",d8,[v.createElementVNode("div",p8,[r.scheme?(v.openBlock(),v.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"])):v.createCommentVNode("",!0)])])])}const m8=Object.freeze(Object.defineProperty({__proto__:null,default:at(l8,[["render",f8]])},Symbol.toStringTag,{value:"Module"})),g8={data(){return{formValues:{},scheme:null,table:""}},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(){const t=this.flattenMenu(Xr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(i=>{var r,a;return(i==null?void 0:i.path)==((a=(r=this.$route)==null?void 0:r.query)==null?void 0:a.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const{data:{form:i}}=await xt.get(`/api/template/table/${n}`),{data:r}=await xt.get(`/api/template/form/${i}`);this.scheme=(r==null?void 0:r.schema)||r}catch{}},async createObject(){try{await this.$refs.form.doValidation(),await xt.post(`/api/table/${this.table}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},y8={style:{width:"calc(100vw - 260px)"}},_8={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},x8={class:"flex items-center gap-[6px]"},b8={style:{height:"calc(100vh - 150px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},v8={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 w8(t,e,n,i,r,a){const u=v.resolveComponent("VsForm");return v.openBlock(),v.createElementBlock("div",y8,[v.createElementVNode("div",_8,[e[3]||(e[3]=v.createElementVNode("h2",{class:"text-xl font-medium"},"Створити",-1)),v.createElementVNode("div",x8,[v.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"py-2 px-3 flex items-center gap-x-2 text-sm font-medium rounded-lg border bg-white border-gray-100 text-gray-800 shadow focus:outline-none hover:bg-gray-50 hover:border-gray-100 duration-300"}," Скасувати "),v.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.createObject&&a.createObject(...l)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"}," Зберегти ")])]),v.createElementVNode("div",b8,[v.createElementVNode("div",v8,[r.scheme?(v.openBlock(),v.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"])):v.createCommentVNode("",!0)])])])}const k8=Object.freeze(Object.defineProperty({__proto__:null,default:at(g8,[["render",w8]])},Symbol.toStringTag,{value:"Module"})),S8={};function E8(t,e,n,i,r,a){const u=v.resolveComponent("router-view");return v.openBlock(),v.createBlock(u)}const yS=Object.freeze(Object.defineProperty({__proto__:null,default:at(S8,[["render",E8]])},Symbol.toStringTag,{value:"Module"})),C8={data(){return{objectData:null,component:""}},computed:{getRoute(){const t=this.flattenMenu(Xr.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,_,S,E,T,I,z;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?(_=(g=(l=this.objectData)==null?void 0:l.rows)==null?void 0:g[0])==null?void 0:_.name:((I=(T=(E=(S=this.objectData)==null?void 0:S.rows)==null?void 0:E[0])==null?void 0:T.name)==null?void 0:I.slice(0,35))+" ...";{const F=(z=this.flattenMenu(Xr.value))==null?void 0:z.find(j=>{var Z,ie;return(j==null?void 0:j.table)===((ie=(Z=this.$route)==null?void 0:Z.params)==null?void 0:ie.table)});return F==null?void 0:F.ua}}},async mounted(){await this.getObjectData(),await this.checkActiveComponent()},watch:{component(t){this.$router.replace({...this.$route,query:{tab:t}})}},methods:{async getObjectData(){var n;const{table:t,id:e}=(n=this.$route)==null?void 0:n.params;(!t||!e)&&this.$router.replace("/404");try{const{data:i}=await xt.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 _=(a=(r=this.objectData)==null?void 0:r.panels)==null?void 0:a.find(S=>(S==null?void 0:S.type)==="tabs");(u=_==null?void 0:_.items)!=null&&u.length&&(this.component=((l=_.items[0])==null?void 0:l.component)||((g=_.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}}},T8={style:{width:"calc(100vw - 260px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 overflow-y-auto"},M8={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},A8={class:""},P8={class:"text-lg md:text-xl font-semibold text-stone-800 dark:text-neutral-200"},I8={class:"flex items-center gap-[6px]"},D8={key:0,class:"border rounded-xl bg-white"},O8={class:"p-[10px] pl-[20px] text-xl"},z8=["innerHTML"],R8={key:1},L8={class:"p-[10px] pl-[20px] text-xl"},N8={key:0,class:"p-[20px] border-t"},B8={key:1,class:"p-[20px] border-t"},V8=["innerHTML"],F8={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]"},$8=["onClick"],j8={key:0,class:"border rounded-bl-xl border-t-0 rounded-br-xl bg-white"},U8={key:0,class:"p-[20px] border-t"},H8={key:1,class:"p-[20px] border-t"},q8=["innerHTML"];function W8(t,e,n,i,r,a){var l,g,_;const u=v.resolveComponent("router-link");return v.openBlock(),v.createElementBlock("div",T8,[v.createElementVNode("div",M8,[v.createElementVNode("div",A8,[v.createElementVNode("button",{onClick:e[0]||(e[0]=S=>t.$router.back()),class:"text-sm h-[20px] text-blue-600 font-medium hover:border-b hover:border-b-2 hover:border-b-blue-500"}," До таблиці "),v.createElementVNode("h2",P8,v.toDisplayString(a.getTitle),1)]),v.createElementVNode("div",I8,[v.createVNode(u,{to:`/edit?table=${a.getRoute}&id=${(g=(l=t.$route)==null?void 0:l.params)==null?void 0:g.id}`,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"},{default:v.withCtx(()=>e[1]||(e[1]=[v.createTextVNode(" Редагувати ")])),_:1},8,["to"])])]),v.createElementVNode("div",{class:v.normalizeClass(["grid gap-[20px]",a.getGridClass()])},[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList((_=r.objectData)==null?void 0:_.panels,(S,E)=>{var T;return v.openBlock(),v.createElementBlock("div",{key:E,class:v.normalizeClass([a.getColClass(S.col),"p-4"])},[S!=null&&S.name?(v.openBlock(),v.createElementBlock("div",D8,[v.createElementVNode("h2",O8,v.toDisplayString((S==null?void 0:S.title)||"Панель"),1),v.createElementVNode("div",{class:"p-[20px] border-t",innerHTML:(T=r.objectData)==null?void 0:T.data[S==null?void 0:S.name]},null,8,z8)])):S.type==="container"?(v.openBlock(),v.createElementBlock("div",R8,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(S.items,(I,z)=>{var F,j,Z,ie,le;return v.openBlock(),v.createElementBlock("div",{key:z,class:"border rounded-xl bg-white mb-[20px]"},[v.createElementVNode("h2",L8,v.toDisplayString((I==null?void 0:I.title)||"Панель"),1),I!=null&&I.component?(v.openBlock(),v.createElementBlock("div",N8,[(v.openBlock(),v.createBlock(v.resolveDynamicComponent(I.component),{geometry:(j=(F=r.objectData)==null?void 0:F.rows[0])==null?void 0:j.geom,zoom:16,id:(ie=(Z=t.$route)==null?void 0:Z.params)==null?void 0:ie.id},null,8,["geometry","id"]))])):v.createCommentVNode("",!0),I!=null&&I.name?(v.openBlock(),v.createElementBlock("div",B8,[v.createElementVNode("div",{innerHTML:(le=r.objectData)==null?void 0:le.data[I==null?void 0:I.name]},null,8,V8)])):v.createCommentVNode("",!0)])}),128))])):v.createCommentVNode("",!0),(S==null?void 0:S.type)==="tabs"?(v.openBlock(),v.createElementBlock(v.Fragment,{key:2},[v.createElementVNode("nav",F8,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(S==null?void 0:S.items,I=>(v.openBlock(),v.createElementBlock("button",{key:(I==null?void 0:I.name)||(I==null?void 0:I.component),onClick:z=>r.component=(I==null?void 0:I.component)||(I==null?void 0:I.name),class:v.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===(I==null?void 0:I.component)||r.component===(I==null?void 0:I.name),"":r.component!==(I==null?void 0:I.component)&&r.component!==(I==null?void 0:I.name)}])},v.toDisplayString(I==null?void 0:I.title),11,$8))),128))]),(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(S.items,(I,z)=>{var F,j,Z,ie,le;return v.openBlock(),v.createElementBlock(v.Fragment,{key:z},[r.component===(I==null?void 0:I.component)||r.component===(I==null?void 0:I.name)?(v.openBlock(),v.createElementBlock("div",j8,[I!=null&&I.component?(v.openBlock(),v.createElementBlock("div",U8,[(v.openBlock(),v.createBlock(v.resolveDynamicComponent(I.component),{geometry:(j=(F=r.objectData)==null?void 0:F.rows[0])==null?void 0:j.geom,zoom:16,id:(ie=(Z=t.$route)==null?void 0:Z.params)==null?void 0:ie.id},null,8,["geometry","id"]))])):v.createCommentVNode("",!0),I!=null&&I.name?(v.openBlock(),v.createElementBlock("div",H8,[v.createElementVNode("div",{innerHTML:(le=r.objectData)==null?void 0:le.data[I==null?void 0:I.name]},null,8,q8)])):v.createCommentVNode("",!0)])):v.createCommentVNode("",!0)],64)}),128))],64)):v.createCommentVNode("",!0)],2)}),128))],2)])}const G8=Object.freeze(Object.defineProperty({__proto__:null,default:at(C8,[["render",W8],["__scopeId","data-v-908a7e3b"]])},Symbol.toStringTag,{value:"Module"})),Z8={},Y8={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 X8(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",Y8,e[0]||(e[0]=[v.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),v.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),v.createElementVNode("path",{d:"M9 12h12l-3 -3"},null,-1),v.createElementVNode("path",{d:"M18 15l3 -3"},null,-1)]))}const K8=at(Z8,[["render",X8]]),J8={},Q8={viewBox:"0 0 1823 249",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function ej(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",Q8,e[0]||(e[0]=[v.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 tj=at(J8,[["render",ej]]),nj={},ij={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 rj(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",ij,e[0]||(e[0]=[v.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),v.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const sj={components:{IconChevronDown:at(nj,[["render",rj]])},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}}},oj={key:0,class:""},aj={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"},lj={key:1};function cj(t,e,n,i,r,a){var g,_,S,E,T,I,z,F,j,Z,ie,le,J;const u=v.resolveComponent("IconChevronDown"),l=v.resolveComponent("router-link");return(g=n.route)!=null&&g.menu?(v.openBlock(),v.createElementBlock("div",oj,[v.createElementVNode("button",{onClick:e[0]||(e[0]=Ee=>r.isOpen=!r.isOpen),class:v.normalizeClass(["flex cursor-pointer gap-x-3 py-2 px-3 text-sm text-gray-800 justify-start w-full border-none focus:outline-none text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300",[((S=(_=n.route)==null?void 0:_.menu)==null?void 0:S.some(Ee=>{var be,Ae;return(Ee==null?void 0:Ee.path)===t.$route.path.replace("/","")||(Ee==null?void 0:Ee.table)===((Ae=(be=t.$route)==null?void 0:be.params)==null?void 0:Ae.table)&&(Ee==null?void 0:Ee.table)}))&&"bg-gray-100"]])},[v.createTextVNode(v.toDisplayString((E=n.route)==null?void 0:E.ua)+" ",1),v.createVNode(u,{class:v.normalizeClass([[r.isOpen&&"-rotate-180"],"ml-auto duration-300"]),width:"14",height:"14"},null,8,["class"])],2),v.createVNode(v.Transition,{name:"fade"},{default:v.withCtx(()=>{var Ee;return[v.withDirectives(v.createElementVNode("ul",aj,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList((Ee=n.route)==null?void 0:Ee.menu,(be,Ae)=>{var Le,Pe;return v.openBlock(),v.createElementBlock("li",{key:Ae,class:"w-full"},[v.createVNode(l,{to:"/"+(be==null?void 0:be.path),class:v.normalizeClass([[((be==null?void 0:be.path)===t.$route.path.replace("/","")||((Pe=(Le=t.$route)==null?void 0:Le.params)==null?void 0:Pe.table)===(be==null?void 0:be.table)&&(be==null?void 0:be.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:v.withCtx(()=>[v.createTextVNode(v.toDisplayString(be==null?void 0:be.ua),1)]),_:2},1032,["to","class"])])}),128))],512),[[v.vShow,r.isOpen]])]}),_:1})])):(v.openBlock(),v.createElementBlock("div",lj,[v.createVNode(l,{to:((I=(T=n.route)==null?void 0:T.path)==null?void 0:I[0])==="/"?(z=n.route)==null?void 0:z.path:"/"+((F=n.route)==null?void 0:F.path),class:v.normalizeClass([[(((j=n.route)==null?void 0:j.path.replace("/",""))===t.$route.path.replace("/","")||((ie=(Z=t.$route)==null?void 0:Z.params)==null?void 0:ie.table)===((le=n.route)==null?void 0:le.table)&&((J=n.route)==null?void 0:J.table))&&"bg-gray-100"],"flex gap-x-3 py-2 w-full font-[400] px-3 text-sm text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300 hover:text-gray-800"])},{default:v.withCtx(()=>{var Ee;return[v.createTextVNode(v.toDisplayString((Ee=n.route)==null?void 0:Ee.ua),1)]}),_:1},8,["to","class"])]))}const uj={components:{IconLogout:K8,NavbarItem:at(sj,[["render",cj]]),IconLogo:tj,IconSearch:ny},data(){return{activeIndex:null,data:null,searchValue:""}},computed:{data(){var t,e;return(t=this.searchValue)!=null&&t.trim()?(e=this.flattenMenu(Xr.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())}):Xr.value}},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e}}},hj={class:"flex flex-col h-[100vh] border-r w-[260px] shrink-0"},dj={class:"relative"},pj={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"},fj={class:"pb-3 w-full flex flex-col flex-wrap"},mj={key:0,class:"flex flex-col gap-[6px]"},gj={key:1,class:"text-gray-800 text-lg mt-[20px]"};function yj(t,e,n,i,r,a){var S;const u=v.resolveComponent("IconLogo"),l=v.resolveComponent("IconSearch"),g=v.resolveComponent("VsText"),_=v.resolveComponent("NavbarItem");return v.openBlock(),v.createElementBlock("div",hj,[v.createVNode(u,{height:"40",width:"200",class:"my-[20px] ml-[20px]"}),v.createElementVNode("div",dj,[v.createVNode(l,{height:"16",width:"16",class:"absolute top-[12px] left-[30px] text-gray-500 z-[1]"}),v.createVNode(g,{type:"text",modelValue:r.searchValue,"onUpdate:modelValue":e[0]||(e[0]=E=>r.searchValue=E),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"])]),v.createElementVNode("div",pj,[v.createElementVNode("nav",fj,[(S=a.data)!=null&&S.length?(v.openBlock(),v.createElementBlock("ul",mj,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(a.data,(E,T)=>(v.openBlock(),v.createElementBlock("li",{key:T,class:"flex flex-col gap-[6px]"},[v.createVNode(_,{route:E},null,8,["route"])]))),128))])):(v.openBlock(),v.createElementBlock("div",gj,"Не знайдено"))])])])}const _j=at(uj,[["render",yj]]),xj={},bj={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 vj(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",bj,e[0]||(e[0]=[v.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),v.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"},null,-1),v.createElementVNode("path",{d:"M12 17h.01"},null,-1)]))}const wj=at(xj,[["render",vj]]),kj={},Sj={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 Ej(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",Sj,e[0]||(e[0]=[v.createElementVNode("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"},null,-1),v.createElementVNode("path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"},null,-1)]))}const Cj={components:{IconQuestion:wj,IconMessage:at(kj,[["render",Ej]])}},Tj={class:"h-[60px] border-b flex justify-end px-[20px]",style:{width:"calc(100vw - 260px)"}},Mj={class:"flex items-center gap-[6px]"},Aj={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"},Pj={class:"hs-tooltip [--placement:bottom] inline-block show"},Ij={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"};function Dj(t,e,n,i,r,a){const u=v.resolveComponent("IconQuestion"),l=v.resolveComponent("IconMessage");return v.openBlock(),v.createElementBlock("div",Tj,[v.createElementVNode("div",Mj,[v.createElementVNode("a",Aj,[v.createVNode(u,{height:"24",width:"24"})]),v.createElementVNode("div",Pj,[v.createElementVNode("button",Ij,[v.createVNode(l,{height:"24",width:"24"}),e[0]||(e[0]=v.createElementVNode("span",{class:"flex absolute top-0 end-0 -mt-1.5 -me-1.5"},[v.createElementVNode("span",{class:"animate-ping absolute inline-flex size-full rounded-full bg-red-400 opacity-75 dark:bg-red-600"}),v.createElementVNode("span",{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"}," 1 ")],-1))]),e[1]||(e[1]=v.createElementVNode("span",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded-lg dark:bg-neutral-700 hidden",role:"tooltip","data-popper-placement":"bottom",style:{position:"fixed",inset:"0px auto auto 0px",margin:"0px",transform:"translate(1686px, 53px)"}},null,-1))]),e[2]||(e[2]=v.createElementVNode("div",{class:"h-[30px] w-[1px] bg-gray-200 ml-[10px] mr-[10px]"},null,-1)),e[3]||(e[3]=v.createElementVNode("img",{class:"flex-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:"Image Description"},null,-1))])])}const Oj={components:{navbar:_j,AdminHeader:at(Cj,[["render",Dj]])},mounted(){this.getMenu()},computed:{isMenu(){return Xr.value}},methods:{async getMenu(){try{const{data:t}=await xt.get("/api/user-menu");Xr.value=t}catch{}}}},zj={class:"admin-wrapper"},Rj={class:"flex flex-col"};function Lj(t,e,n,i,r,a){const u=v.resolveComponent("navbar"),l=v.resolveComponent("admin-header"),g=v.resolveComponent("router-view");return v.openBlock(),v.createElementBlock("div",zj,[v.createVNode(u),v.createElementVNode("div",Rj,[a.isMenu?(v.openBlock(),v.createElementBlock(v.Fragment,{key:0},[v.createVNode(l),v.createVNode(g)],64)):v.createCommentVNode("",!0)])])}const Nj=Object.freeze(Object.defineProperty({__proto__:null,default:at(Oj,[["render",Lj],["__scopeId","data-v-c3c91323"]])},Symbol.toStringTag,{value:"Module"})),Bj={},Vj={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 Fj(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",Vj,e[0]||(e[0]=[v.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 $j=at(Bj,[["render",Fj]]),jj={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}}},Uj={scope:"col",class:"text-start"},Hj={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"},qj={key:0,d:"m7 15 5 5 5-5"},Wj={key:1,d:"m7 9 5-5 5 5"},Gj={key:1,class:"text-sm text-gray-800 px-[4px] py-2.5 text-start font-normal text-gray-500"};function Zj(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("th",Uj,[a.getVisibleIcon?(v.openBlock(),v.createElementBlock("button",{key:0,type:"button",class:"text-sm text-gray-800 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))},[v.createTextVNode(v.toDisplayString(a.label)+" ",1),(v.openBlock(),v.createElementBlock("svg",Hj,[r.currentSort==="asc"||r.currentSort===""?(v.openBlock(),v.createElementBlock("path",qj)):v.createCommentVNode("",!0),r.currentSort==="desc"||r.currentSort===""?(v.openBlock(),v.createElementBlock("path",Wj)):v.createCommentVNode("",!0)]))])):(v.openBlock(),v.createElementBlock("p",Gj,v.toDisplayString(a.label),1))])}const Yj=at(jj,[["render",Zj]]),Xj={},Kj={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 Jj(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",Kj,e[0]||(e[0]=[v.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),v.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),v.createElementVNode("path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),v.createElementVNode("path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)]))}const Qj=at(Xj,[["render",Jj]]),e7={},t7={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 n7(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",t7,e[0]||(e[0]=[v.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 i7=at(e7,[["render",n7]]),r7={props:{height:{type:String,default:"16"},width:{type:String,default:"12"},color:{type:String,default:"black"}}},s7={style:{display:"none"}},o7=["height","width","fill"];function a7(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock(v.Fragment,null,[(v.openBlock(),v.createElementBlock("svg",s7,e[0]||(e[0]=[v.createElementVNode("symbol",{id:"icon-pencil",viewBox:"0 0 32 32"},[v.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)]))),(v.openBlock(),v.createElementBlock("svg",{height:n.height,width:n.width,fill:n.color},e[1]||(e[1]=[v.createElementVNode("use",{"xlink:href":"#icon-pencil"},null,-1)]),8,o7))],64)}const l7={components:{IconMore:Qj,IconDelete:i7,IconEdit:at(r7,[["render",a7]])},emits:["updateTable"],props:{item:Object,table:String,isForm:null},data(){return{formVisible:!1,isDeleteConfirm:!1,formValue:{},top:0,left:0}},methods:{openConfirm(){this.isDeleteConfirm=!0,document.querySelector("body").click()},async getData(){var t;try{const{data:e}=await xt.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{xt.delete(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`),this.$notify({title:"Успішно!",message:"Об`єкт успішно видалeно",type:"success"}),await this.$emit("update-table"),this.isDeleteConfirm=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},c7={class:"hs-dropdown [--placement:bottom-right] inline-flex"},u7={class:"gap-x-2 p-[4px] rounded-lg shadow-sm hover:border-transparent border focus:outline-none text-black hover:bg-gray-50"},h7={class:"flex flex-col items-start"},d7={key:1,class:"h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto"},p7={class:"p-4"},f7={class:"mt-4 flex justify-end gap-x-3"};function m7(t,e,n,i,r,a){const u=v.resolveComponent("IconMore"),l=v.resolveComponent("IconEdit"),g=v.resolveComponent("router-link"),_=v.resolveComponent("IconDelete"),S=v.resolveComponent("VsPopover"),E=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock(v.Fragment,null,[v.createElementVNode("div",c7,[v.createVNode(S,{trigger:"click",placement:"bottom-left"},{reference:v.withCtx(()=>[v.createElementVNode("button",u7,[v.createVNode(u,{height:"16",width:"16"})])]),default:v.withCtx(()=>{var T,I,z;return[v.createElementVNode("div",h7,[n.isForm?(v.openBlock(),v.createBlock(g,{key:0,to:`/edit?table=${(I=(T=t.$route)==null?void 0:T.params)==null?void 0:I.catchAll}&id=${(z=n.item)==null?void 0:z.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:v.withCtx(()=>[v.createVNode(l,{color:"#000"}),e[4]||(e[4]=v.createTextVNode(" Редагувати "))]),_:1},8,["to"])):v.createCommentVNode("",!0),n.isForm?(v.openBlock(),v.createElementBlock("div",d7)):v.createCommentVNode("",!0),v.createElementVNode("button",{onClick:e[0]||(e[0]=v.withModifiers((...F)=>a.openConfirm&&a.openConfirm(...F),["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"},[v.createVNode(_),e[5]||(e[5]=v.createElementVNode("span",{class:"text-gray-800"},"Видалити",-1))])])]}),_:1})]),v.createVNode(E,{visible:r.isDeleteConfirm,"onUpdate:visible":e[3]||(e[3]=T=>r.isDeleteConfirm=T),title:"Ви впевнені?"},{default:v.withCtx(()=>[v.createElementVNode("div",p7,[e[6]||(e[6]=v.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей об'єкт? ",-1)),v.createElementVNode("div",f7,[v.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]=T=>r.isDeleteConfirm=!1)}," Скасувати "),v.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]=(...T)=>a.deleteElement&&a.deleteElement(...T))}," Так, я впевнена/ий ")])])]),_:1},8,["visible"])],64)}const g7=at(l7,[["render",m7]]),y7={},_7={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 x7(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",_7,e[0]||(e[0]=[v.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),v.createElementVNode("path",{d:"M7 20V4"},null,-1),v.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),v.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const b7={components:{IconExport:at(y7,[["render",x7]])},props:{table:String,columns:Array},data(){return{isOpen:!1,tableFormats:["json","csv","xlsx"],format:"",cols:[]}},methods:{async exportTable(){try{const t=await xt.get("/api/export",{params:{table:this.table,format:this.format,cols:this.cols.join(",")},responseType:"blob"}),e=new Blob([t.data],{type:"application/octet-stream"}),n=window.URL.createObjectURL(e),i=document.createElement("a");i.href=n,i.setAttribute("download",`${this.table.split(".")[0]}.${this.format}`),document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(n),this.$notify({type:"success",title:"Експорт",message:"Файл успішно експортовано!"})}catch(t){console.error("Ошибка при экспорте файла:",t),this.$notify({type:"error",title:"Помилка",message:"Не вдалося експортувати файл."})}},selectFormat(t){this.format=t}}},v7={class:"p-4"},w7={class:"pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},k7={class:"mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]"},S7={class:"pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},E7={class:"mt-2 space-y-2"},C7=["id","onChange"],T7=["for"],M7={class:"flex w-full justify-end p-[20px] gap-[6px] border-t"};function A7(t,e,n,i,r,a){const u=v.resolveComponent("IconExport"),l=v.resolveComponent("VsCheckbox"),g=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock(v.Fragment,null,[v.createElementVNode("button",{onClick:e[0]||(e[0]=_=>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"},[v.createVNode(u,{height:"16",width:"16"}),e[4]||(e[4]=v.createTextVNode(" Експорт ")),e[5]||(e[5]=v.createElementVNode("svg",{class:"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"},[v.createElementVNode("path",{d:"m6 9 6 6 6-6"})],-1))]),v.createVNode(g,{visible:r.isOpen,"onUpdate:visible":e[3]||(e[3]=_=>r.isOpen=_),title:"Експорт таблиці",size:"small"},{footer:v.withCtx(()=>[v.createElementVNode("div",M7,[e[8]||(e[8]=v.createElementVNode("button",{type:"button",class:"py-2 px-3 text-nowrap inline-flex justify-center items-center text-start bg-white border border-gray-200 text-gray-800 text-sm font-medium rounded-lg shadow-sm align-middle 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","data-hs-overlay":"#hs-pro-decm"}," Скасувати ",-1)),v.createElementVNode("button",{type:"button",class:"py-2 px-3 text-nowrap inline-flex justify-center items-center gap-x-2 text-start bg-blue-600 border border-blue-600 text-white text-sm font-medium rounded-lg shadow-sm align-middle 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[2]||(e[2]=(..._)=>a.exportTable&&a.exportTable(..._))}," Завантажити таблицю ")])]),default:v.withCtx(()=>[e[9]||(e[9]=v.createElementVNode("div",{class:"dark:border-neutral-700"},null,-1)),v.createElementVNode("div",v7,[v.createElementVNode("div",w7,[e[6]||(e[6]=v.createElementVNode("h2",{class:"text-sm text-gray-500"}," Виберіть стовпці таблиці для експорту: ",-1)),v.createElementVNode("div",k7,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(n.columns,(_,S)=>(v.openBlock(),v.createElementBlock("div",{class:"flex items-center",key:S,style:{width:"calc((100% - 10px) / 2)"}},[v.createVNode(l,{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]=E=>r.cols=E),value:_==null?void 0:_.name,label:_==null?void 0:_.ua},null,8,["modelValue","value","label"])]))),128))])]),v.createElementVNode("div",S7,[e[7]||(e[7]=v.createElementVNode("h2",{class:"text-sm text-gray-500"},"Виберіть формат таблиці:",-1)),v.createElementVNode("div",E7,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(r.tableFormats,(_,S)=>(v.openBlock(),v.createElementBlock("div",{class:"flex items-center",key:S},[v.createElementVNode("input",{type:"radio",name:"hs-pro-duecmfm",class:"shrink-0 border-gray-300 rounded-full text-blue-600 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:_,onChange:E=>a.selectFormat(_)},null,40,C7),v.createElementVNode("label",{for:_,class:"text-sm text-gray-800 ms-3 dark:text-neutral-400"}," Формат "+v.toDisplayString(_),9,T7)]))),128))])])])]),_:1},8,["visible"])],64)}const P7=at(b7,[["render",A7]]),I7={},D7={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 O7(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",D7,e[0]||(e[0]=[v.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 z7=at(I7,[["render",O7]]),R7={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)}},L7={class:"flex w-full gap-[8px] items-centr"};function N7(t,e,n,i,r,a){var u,l;return v.openBlock(),v.createElementBlock("label",L7,[v.withDirectives(v.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=g=>r.value=g),type:"checkbox"},null,512),[[v.vModelCheckbox,r.value]]),v.createTextVNode(" "+v.toDisplayString(((u=n.column)==null?void 0:u.ua)||((l=n.column)==null?void 0:l.title)),1)])}const B7={components:{IconColumns:z7,AdminTableColumnsHiddenItem:at(R7,[["render",N7]])},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])}}},V7={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"},F7={class:"py-[10px] px-[10px] w-[260px]"},$7={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 j7(t,e,n,i,r,a){const u=v.resolveComponent("IconColumns"),l=v.resolveComponent("AdminTableColumnsHiddenItem"),g=v.resolveComponent("VsPopover");return v.openBlock(),v.createBlock(g,{trigger:"click",placement:"bottom"},{reference:v.withCtx(()=>[v.createElementVNode("button",V7,[v.createVNode(u,{height:"20",width:"16"})])]),default:v.withCtx(()=>[v.createElementVNode("div",F7,[e[0]||(e[0]=v.createElementVNode("h2",{class:"text-sm mb-[8px]"},"Оберіть колонки, щоб приховати",-1)),v.createElementVNode("ul",$7,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(n.columns,(_,S)=>(v.openBlock(),v.createElementBlock("li",{key:S},[v.createVNode(l,{column:_,onUpdateColumn:a.updateColumn},null,8,["column","onUpdateColumn"])]))),128))])])]),_:1})}const U7=at(B7,[["render",j7]]),H7={},q7={class:"hidden sm:block shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"};function W7(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("svg",q7,e[0]||(e[0]=[v.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 G7=at(H7,[["render",W7]]),Z7={},Y7={class:"vs-table-interface__table-wrp w-full rounded h-fit overflow-hidden"};function X7(t,e,n,i,r,a){return v.openBlock(),v.createElementBlock("div",Y7,e[0]||(e[0]=[v.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 K7={props:{table:String,title:String},components:{IconFilter:$j,AdminTableControl:g7,AdminTableExport:P7,AdminTableColumnsHidden:U7,AdminTableColumn:Yj,AdminNodata:at(Z7,[["render",X7]]),IconPlus:G7,IconSearch:ny},data(){return{tableData:{},isFilters:!1,filterScheme:[],page:1,searchValue:"",limit:0,filters:null,activeColumn:"",onFilters:0}},mounted(){var t,e,n,i;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.getTableData(),this.getFilters()},computed:{defaultPage(){var t,e;return((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1},getFilterScheme(){var t;return(t=this.tableData)==null?void 0:t.filters},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)},rowWidth(){var t;return((t=this.tableData)==null?void 0:t.width)||"100px"}},watch:{async table(){this.tableData=null,await this.getTableData()},searchValue(){this.getTableData()},$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.filterScheme=null,this.filters=null,this.onFilters=0,this.getFilters())},deep:!0},limit(t){var e;this.$router.push({query:{...(e=this.$route)==null?void 0:e.query,limit:t}})}},methods:{async getTableData(){var t,e;try{const{data:n}=await xt.get(`/api/template/table/${this.table}`),i=await xt.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}});this.tableData={...n,...(i==null?void 0:i.data)||{}}}catch{}},async getFilters(){var t;try{const{data:e}=await xt.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()},closeFilter({target:t}){this.isFilters&&t.classList.contains("filter-container")&&(this.isFilters=!1)},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}`)}}},J7={class:"w-[calc(100vw - 320px)]"},Q7={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},e9={class:"text-xl font-medium h-[20px]"},t9={style:{height:"calc(100vh - 140px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex pt-[10px]"},n9={class:"bg-white w-full rounded-xl border p-[20px]"},i9={class:"flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5 mb-[10px] relative"},r9={class:"flex gap-[6px] ml-auto"},s9={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"},o9={class:"space-y-5 flex items-start w-full justify-start"},a9={style:{height:"calc(100vh - 310px)"},class:"overflow-x-auto w-full border-t [&::-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"},l9={class:"inline-block w-full align-middle"},c9={key:0,class:"divide-y divide-gray-200 min-w-full dark:divide-neutral-700 relative table-fixed"},u9={class:"sticky top-0 bg-white w-full relative after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},h9={class:"border-stone-200 right-0 z-[1]"},d9={class:"divide-y divide-gray-200"},p9=["onClick"],f9={class:"text-center sticky right-0 bg-white w-[80px] px-[10px]"},m9={class:"p-[20px] flex justify-end w-full"},g9={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 y9(t,e,n,i,r,a){var ie,le,J,Ee,be,Ae;const u=v.resolveComponent("IconPlus"),l=v.resolveComponent("router-link"),g=v.resolveComponent("IconSearch"),_=v.resolveComponent("VsText"),S=v.resolveComponent("AdminTableColumnsHidden"),E=v.resolveComponent("AdminTableExport"),T=v.resolveComponent("IconFilter"),I=v.resolveComponent("AdminTableColumn"),z=v.resolveComponent("AdminTableControl"),F=v.resolveComponent("AdminNodata"),j=v.resolveComponent("VsPagination"),Z=v.resolveComponent("VsFilter");return v.openBlock(),v.createElementBlock(v.Fragment,null,[v.createElementVNode("div",J7,[v.createElementVNode("div",Q7,[v.createElementVNode("h2",e9,v.toDisplayString(n.title),1),a.isForm?(v.openBlock(),v.createBlock(l,{key:0,to:`/add?table=${(le=(ie=t.$route)==null?void 0:ie.params)==null?void 0:le.catchAll}`,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"},{default:v.withCtx(()=>[v.createVNode(u,{height:"16",width:"16"}),e[5]||(e[5]=v.createTextVNode(" Додати "))]),_:1},8,["to"])):v.createCommentVNode("",!0)]),v.createElementVNode("div",t9,[v.createElementVNode("div",n9,[v.createElementVNode("div",i9,[v.createVNode(g,{height:"14",width:"14",class:"absolute top-[10px] left-[14px] text-gray-500 z-[1]"}),v.createVNode(_,{modelValue:r.searchValue,"onUpdate:modelValue":e[0]||(e[0]=Le=>r.searchValue=Le),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"]),v.createElementVNode("div",r9,[v.createVNode(S,{columns:(J=r.tableData)==null?void 0:J.columns,onUpdateColumns:e[1]||(e[1]=Le=>r.tableData.columns=Le)},null,8,["columns"]),v.createVNode(E,{table:n.table,columns:(Ee=r.tableData)==null?void 0:Ee.columns},null,8,["table","columns"]),v.createElementVNode("button",{onClick:e[2]||(e[2]=Le=>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"},[v.createVNode(T,{height:"16",width:"16"}),e[6]||(e[6]=v.createTextVNode(" Фільтри ")),r.onFilters?(v.openBlock(),v.createElementBlock("span",s9,v.toDisplayString(r.onFilters),1)):v.createCommentVNode("",!0)])])]),v.createElementVNode("div",o9,[v.createElementVNode("div",a9,[v.createElementVNode("div",l9,[a.isNoData?(v.openBlock(),v.createBlock(F,{key:1})):(v.openBlock(),v.createElementBlock("table",c9,[v.createElementVNode("thead",u9,[v.createElementVNode("tr",h9,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(a.columns,Le=>(v.openBlock(),v.createBlock(I,{key:Le.name,style:v.normalizeStyle({minWidth:a.rowWidth,maxWidth:a.rowWidth}),data:Le,activeColumn:r.activeColumn,onChangeActive:a.changeActiveColumn},null,8,["style","data","activeColumn","onChangeActive"]))),128)),e[7]||(e[7]=v.createElementVNode("th",{class:"w-[70px] sticky right-0 top-0 bg-white"},null,-1))])]),v.createElementVNode("tbody",d9,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList((be=r.tableData)==null?void 0:be.rows,(Le,Pe)=>{var Ye,it,Nt,dt,Rt,Xt,nn,jt;return v.openBlock(),v.createElementBlock("tr",{key:Pe},[v.createElementVNode("td",{class:"text-sm text-gray-600",style:v.normalizeStyle({minWidth:a.rowWidth,maxWidth:a.rowWidth})},[v.createElementVNode("button",{onClick:()=>a.pushToCard(Le==null?void 0:Le.id),class:v.normalizeClass(["text-sm font-medium",[((Ye=r.tableData)==null?void 0:Ye.card)===!1?"":"text-blue-600 decoration-2 focus:outline-none focus:underline hover:text-blue-600 hover:underline"]])},[(v.openBlock(),v.createBlock(v.resolveDynamicComponent(((it=a.columns[0])==null?void 0:it.format)==="custom"?(Nt=a.columns[0])==null?void 0:Nt.component:t.$componentsConfig[`table-format-${((Rt=(dt=a.columns[0])==null?void 0:dt.format)==null?void 0:Rt.toLowerCase())||"text"}`]),{name:(Xt=a.columns[0])==null?void 0:Xt.name,data:Le,value:Le==null?void 0:Le[(nn=a.columns[0])==null?void 0:nn.name],table:n.table},null,8,["name","data","value","table"]))],10,p9)],4),(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList((jt=a.columns)==null?void 0:jt.slice(1),Tt=>{var Sn;return v.openBlock(),v.createElementBlock("td",{class:"text-start px-[4px] py-3 text-sm text-gray-600",style:v.normalizeStyle({minWidth:a.rowWidth,maxWidth:a.rowWidth}),key:Tt.name},[(v.openBlock(),v.createBlock(v.resolveDynamicComponent((Tt==null?void 0:Tt.format)==="custom"?Tt==null?void 0:Tt.component:t.$componentsConfig[`table-format-${((Sn=Tt==null?void 0:Tt.format)==null?void 0:Sn.toLowerCase())||"text"}`]),{onUpdateTable:a.getTableData,name:Tt==null?void 0:Tt.name,data:Le,value:Le==null?void 0:Le[Tt==null?void 0:Tt.name],table:n.table,inline:(Tt==null?void 0:Tt.inline)||!1},null,40,["onUpdateTable","name","data","value","table","inline"]))],4)}),128)),v.createElementVNode("td",f9,[v.createVNode(z,{isForm:a.isForm,item:Le,table:n.table,onUpdateTable:a.getTableData},null,8,["isForm","item","table","onUpdateTable"])])])}),128))])]))])])]),v.createElementVNode("div",m9,[r.limit?(v.openBlock(),v.createBlock(j,{key:0,goTo:!1,class:"justify-end","default-page":a.defaultPage,total:((Ae=r.tableData)==null?void 0:Ae.total)||0,pageSize:r.limit,onPageChange:a.handlePageChange,pageSizes:[10,16,20],onPageSizeChange:a.changeLimit},null,8,["default-page","total","pageSize","onPageChange","onPageSizeChange"])):v.createCommentVNode("",!0)])])])]),v.createVNode(v.Transition,{name:"fade"},{default:v.withCtx(()=>{var Le;return[v.withDirectives(v.createElementVNode("div",{onClick:e[4]||(e[4]=(...Pe)=>a.closeFilter&&a.closeFilter(...Pe)),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)]"},[v.createElementVNode("div",g9,[(Le=r.filterScheme)!=null&&Le.length?(v.openBlock(),v.createBlock(Z,{key:0,ref:"filter",scheme:r.filterScheme,layout:"default","apply-vue-router":"",history:"",name:"filter",onFilterChange:a.filterChange,closeFilterBtn:!0,onFilterClose:e[3]||(e[3]=Pe=>r.isFilters=!1)},null,8,["scheme","onFilterChange"])):v.createCommentVNode("",!0)])],512),[[v.vShow,r.isFilters]])]}),_:1})],64)}const _9={components:{AdminTable:at(K7,[["render",y9]])},data(){return{table:!1,interface:"",title:""}},watch:{$route:{async handler(){Xr!=null&&Xr.value||await this.getMenu(),await this.checkPageType()},deep:!0},title(t){t&&(document.title=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 getMenu(){try{const{data:t}=await xt.get("/api/user-menu");Xr.value=t}catch{}},async checkPageType(){const t=this.flattenMenu(Xr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(i=>{var r,a;return(i==null?void 0:i.path)==((a=(r=this.$route)==null?void 0:r.params)==null?void 0:a.catchAll)});this.title=e==null?void 0:e.ua,e||this.$router.replace("/404");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 xt.get(`/api/template/interface/${((e=(t=this.$route)==null?void 0:t.params)==null?void 0:e.catchAll)||""}`);this.interface=n||""}catch{this.interface=""}}}},x9=["innerHTML"];function b9(t,e,n,i,r,a){const u=v.resolveComponent("AdminTable");return r.table?(v.openBlock(),v.createBlock(u,{key:0,table:r.table,title:r.title},null,8,["table","title"])):(v.openBlock(),v.createElementBlock("div",{key:1,class:"w-full bg-gray-50",style:{height:"calc(100vh - 120px)"},innerHTML:r.interface},null,8,x9))}const v9=Object.freeze(Object.defineProperty({__proto__:null,default:at(_9,[["render",b9]])},Symbol.toStringTag,{value:"Module"}));return a8});
|