@dartcom/ui-kit 10.0.7 → 10.0.8
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/dist/components/layers/leaflet/layers/traffic-sign/constants.d.ts +14 -7
- package/dist/components/layers/leaflet/layers/traffic-sign/constants.d.ts.map +1 -1
- package/dist/components/layers/leaflet/layers/traffic-sign/types.d.ts +2 -1
- package/dist/components/layers/leaflet/layers/traffic-sign/types.d.ts.map +1 -1
- package/dist/components/layers/leaflet/layers/traffic-sign/utils.d.ts +4 -0
- package/dist/components/layers/leaflet/layers/traffic-sign/utils.d.ts.map +1 -1
- package/dist/index.cjs +167 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import n,{useLayoutEffect as i,useEffect as s,useRef as o,useMemo as a,useCallback as l,useState as u,createContext as c,memo as h,useReducer as d,useContext as f,use as p,Component as m,createElement as _,forwardRef as g,cloneElement as y,isValidElement as v}from"react";import{Typography as b,Box as x,List as w,ListItem as A,Slide as E,IconButton as T,Dialog as S,DialogTitle as k,DialogContent as O,DialogContentText as R,DialogActions as C,Button as N,TextField as P,CircularProgress as M}from"@mui/material";import D from"@mui/icons-material/Delete";import z from"@mui/icons-material/Edit";import I from"@mui/material/IconButton";import F from"@mui/material/Checkbox";import L from"@mui/material/FormControlLabel";import{styled as j,createTheme as U,ThemeProvider as B}from"@mui/material/styles";import V from"@mui/material/Typography";import G from"@mui/material/Autocomplete";import{unstable_batchedUpdates as $,createPortal as q}from"react-dom";import W from"@mui/material/Box";import H from"@mui/material/Modal";import{LocalizationProvider as Z}from"@mui/x-date-pickers";import{AdapterDateFns as K}from"@mui/x-date-pickers/AdapterDateFns";import{DateField as X}from"@mui/x-date-pickers/DateField";const Y=({text:t="Нет данных"})=>e(b,{variant:"body2",sx:{textAlign:"center",color:"var(--gray-light-color)"},children:t});function Q({items:n,columnsCount:i=1,getContent:s,title:o,getKey:a,onClick:l,sx:u,isShowNoData:c=!0}){const h=0===n.length;return t(x,{sx:{display:"grid",gridTemplateColumns:"1fr",gap:"15px",...u?.root},children:[o?e(b,{variant:"h6",noWrap:!0,sx:{textAlign:"center",fontWeight:700,...u?.title},children:o}):null,h?e(r.Fragment,{children:c?e(Y,{}):null}):e(w,{sx:{display:"grid",gridTemplateColumns:`repeat(${i}, 1fr)`,gap:"15px",...u?.list},disablePadding:!0,children:n.map((t,r)=>e(A,{onClick:()=>l?.(t,r),sx:{...u?.item},disablePadding:!0,children:s(t,r)},a(t,r)))})]})}const J=r.forwardRef(function(t,r){return e(E,{direction:"up",ref:r,...t})}),ee=({notification:n,onDelete:i})=>{const s=r.useId(),[o,a]=r.useState(!1),l=()=>{a(!1)};return t(r.Fragment,{children:[e(T,{onClick:()=>{n?a(!0):i()},children:e(D,{fontSize:"small",color:"error"})}),n?t(S,{slots:{transition:J},open:o,onClose:l,children:[e(k,{id:`${s}-dialog-title`,children:n.title}),e(O,{children:e(R,{id:`${s}-dialog-text`,children:n.description})}),t(C,{children:[e(N,{variant:"contained",color:"error",sx:{textTransform:"none"},onClick:l,children:"Отмена"}),e(N,{variant:"contained",sx:{textTransform:"none"},onClick:()=>{i(),l()},children:"Подтвердить"})]})]}):null]})},te=t=>{const n=r.useId();return e(r.Fragment,{children:e(T,{id:n,...t,children:e(z,{fontSize:"small",color:"primary"})})})},re=t=>{const{children:r,variant:n="contained",loading:i,icon:s,sx:o,...a}=t;return s?e(I,{...a,loading:i,children:s}):e(N,{sx:{whiteSpace:"nowrap",padding:"5px 15px",textTransform:"none",...o},loading:i,loadingPosition:"start",variant:n,...a,children:r})};var ne=e=>"checkbox"===e.type,ie=e=>e instanceof Date,se=e=>null==e;const oe=e=>"object"==typeof e;var ae=e=>!se(e)&&!Array.isArray(e)&&oe(e)&&!ie(e),le=e=>ae(e)&&e.target?ne(e.target)?e.target.checked:e.target.value:e,ue=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),ce="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function he(e){if(e instanceof Date)return new Date(e);const t="undefined"!=typeof FileList&&e instanceof FileList;if(ce&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!(r||ae(e)&&(e=>{const t=e.constructor&&e.constructor.prototype;return ae(t)&&t.hasOwnProperty("isPrototypeOf")})(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=he(e[t]));return n}var de=e=>/^\w*$/.test(e),fe=e=>void 0===e,pe=e=>Array.isArray(e)?e.filter(Boolean):[],me=e=>pe(e.replace(/["|']|\]/g,"").split(/\.|\[/)),_e=(e,t,r)=>{if(!t||!ae(e))return r;const n=(de(t)?[t]:me(t)).reduce((e,t)=>se(e)?e:e[t],e);return fe(n)||n===e?fe(e[t])?r:e[t]:n},ge=e=>"boolean"==typeof e,ye=e=>"function"==typeof e,ve=(e,t,r)=>{let n=-1;const i=de(t)?[t]:me(t),s=i.length,o=s-1;for(;++n<s;){const t=i[n];let s=r;if(n!==o){const r=e[t];s=ae(r)||Array.isArray(r)?r:isNaN(+i[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=s,e=e[t]}};const be="blur",xe="focusout",we="change",Ae="onBlur",Ee="onChange",Te="onSubmit",Se="onTouched",ke="all",Oe="max",Re="min",Ce="maxLength",Ne="minLength",Pe="pattern",Me="required",De="validate",ze=n.createContext(null);ze.displayName="HookFormContext";const Ie=()=>n.useContext(ze),Fe=e=>{const{children:t,...r}=e;return n.createElement(ze.Provider,{value:r},t)};var Le=(e,t,r,n=!0)=>{const i={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(i,s,{get:()=>{const i=s;return t._proxyFormState[i]!==ke&&(t._proxyFormState[i]=!n||ke),r&&(r[i]=!0),e[i]}});return i};const je="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;var Ue=e=>"string"==typeof e,Be=(e,t,r,n,i)=>Ue(e)?(n&&t.watch.add(e),_e(r,e,i)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),_e(r,e))):(n&&(t.watchAll=!0),r),Ve=e=>se(e)||!oe(e);function Ge(e,t,r=new WeakSet){if(Ve(e)||Ve(t))return Object.is(e,t);if(ie(e)&&ie(t))return e.getTime()===t.getTime();const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const s of n){const n=e[s];if(!i.includes(s))return!1;if("ref"!==s){const e=t[s];if(ie(n)&&ie(e)||ae(n)&&ae(e)||Array.isArray(n)&&Array.isArray(e)?!Ge(n,e,r):!Object.is(n,e))return!1}}return!0}function $e(e){const t=Ie(),{name:r,disabled:i,control:s=t.control,shouldUnregister:o,defaultValue:a,exact:l=!0}=e,u=ue(s._names.array,r),c=n.useMemo(()=>_e(s._formValues,r,_e(s._defaultValues,r,a)),[s,r,a]),h=function(e){const t=Ie(),{control:r=t.control,name:i,defaultValue:s,disabled:o,exact:a,compute:l}=e||{},u=n.useRef(s),c=n.useRef(l),h=n.useRef(void 0),d=n.useRef(r),f=n.useRef(i);c.current=l;const[p,m]=n.useState(()=>{const e=r._getWatch(i,u.current);return c.current?c.current(e):e}),_=n.useCallback(e=>{const t=Be(i,r._names,e||r._formValues,!1,u.current);return c.current?c.current(t):t},[r._formValues,r._names,i]),g=n.useCallback(e=>{if(!o){const t=Be(i,r._names,e||r._formValues,!1,u.current);if(c.current){const e=c.current(t);Ge(e,h.current)||(m(e),h.current=e)}else m(t)}},[r._formValues,r._names,o,i]);je(()=>(d.current===r&&Ge(f.current,i)||(d.current=r,f.current=i,g()),r._subscribe({name:i,formState:{values:!0},exact:a,callback:e=>{g(e.values)}})),[r,a,i,g]),n.useEffect(()=>r._removeUnmounted());const y=d.current!==r,v=f.current,b=n.useMemo(()=>{if(o)return null;const e=!y&&!Ge(v,i);return y||e?_():null},[o,y,i,v,_]);return null!==b?b:p}({control:s,name:r,defaultValue:c,exact:l}),d=function(e){const t=Ie(),{control:r=t.control,disabled:i,name:s,exact:o}=e||{},[a,l]=n.useState(r._formState),u=n.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return je(()=>r._subscribe({name:s,formState:u.current,exact:o,callback:e=>{!i&&l({...r._formState,...e})}}),[s,i,o]),n.useEffect(()=>{u.current.isValid&&r._setValid(!0)},[r]),n.useMemo(()=>Le(a,r,u.current,!1),[a,r])}({control:s,name:r,exact:l}),f=n.useRef(e),p=n.useRef(void 0),m=n.useRef(s.register(r,{...e.rules,value:h,...ge(e.disabled)?{disabled:e.disabled}:{}}));f.current=e;const _=n.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!_e(d.errors,r)},isDirty:{enumerable:!0,get:()=>!!_e(d.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!_e(d.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!_e(d.validatingFields,r)},error:{enumerable:!0,get:()=>_e(d.errors,r)}}),[d,r]),g=n.useCallback(e=>m.current.onChange({target:{value:le(e),name:r},type:we}),[r]),y=n.useCallback(()=>m.current.onBlur({target:{value:_e(s._formValues,r),name:r},type:be}),[r,s._formValues]),v=n.useCallback(e=>{const t=_e(s._fields,r);t&&t._f&&e&&(t._f.ref={focus:()=>ye(e.focus)&&e.focus(),select:()=>ye(e.select)&&e.select(),setCustomValidity:t=>ye(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>ye(e.reportValidity)&&e.reportValidity()})},[s._fields,r]),b=n.useMemo(()=>({name:r,value:h,...ge(i)||d.disabled?{disabled:d.disabled||i}:{},onChange:g,onBlur:y,ref:v}),[r,i,d.disabled,g,y,v,h]);return n.useEffect(()=>{const e=s._options.shouldUnregister||o,t=p.current;t&&t!==r&&!u&&s.unregister(t),s.register(r,{...f.current.rules,...ge(f.current.disabled)?{disabled:f.current.disabled}:{}});const n=(e,t)=>{const r=_e(s._fields,e);r&&r._f&&(r._f.mount=t)};if(n(r,!0),e){const e=he(_e(s._options.defaultValues,r,f.current.defaultValue));ve(s._defaultValues,r,e),fe(_e(s._formValues,r))&&ve(s._formValues,r,e)}return!u&&s.register(r),p.current=r,()=>{(u?e&&!s._state.action:e)?s.unregister(r):n(r,!1)}},[r,s,u,o]),n.useEffect(()=>{s._setDisabledField({disabled:i,name:r})},[i,r,s]),n.useMemo(()=>({field:b,formState:d,fieldState:_}),[b,d,_])}const qe=e=>e.render($e(e));var We=(e,t,r,n,i)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:i||!0}}:{},He=e=>Array.isArray(e)?e:[e],Ze=()=>{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function Ke(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],s=t[n];if(i&&ae(i)&&s){const e=Ke(i,s);ae(e)&&(r[n]=e)}else e[n]&&(r[n]=s)}return r}var Xe=e=>ae(e)&&!Object.keys(e).length,Ye=e=>"file"===e.type,Qe=e=>{if(!ce)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Je=e=>"select-multiple"===e.type,et=e=>"radio"===e.type,tt=e=>Qe(e)&&e.isConnected;function rt(e,t){const r=Array.isArray(t)?t:de(t)?[t]:me(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=fe(e)?n++:e[t[n++]];return e}(e,r),i=r.length-1,s=r[i];return n&&delete n[s],0!==i&&(ae(n)&&Xe(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!fe(e[t]))return!1;return!0}(n))&&rt(e,r.slice(0,-1)),e}function nt(e){return Array.isArray(e)||ae(e)&&!(e=>{for(const t in e)if(ye(e[t]))return!0;return!1})(e)}function it(e,t={}){for(const r in e){const n=e[r];nt(n)?(t[r]=Array.isArray(n)?[]:{},it(n,t[r])):fe(n)||(t[r]=!0)}return t}function st(e,t,r){r||(r=it(t));for(const n in e){const i=e[n];if(nt(i))fe(t)||Ve(r[n])?r[n]=it(i,Array.isArray(i)?[]:{}):st(i,se(t)?{}:t[n],r[n]);else{const e=t[n];r[n]=!Ge(i,e)}}return r}const ot={value:!1,isValid:!1},at={value:!0,isValid:!0};var lt=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!fe(e[0].attributes.value)?fe(e[0].value)||""===e[0].value?at:{value:e[0].value,isValid:!0}:at:ot}return ot},ut=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>fe(e)?e:t?""===e?NaN:e?+e:e:r&&Ue(e)?new Date(e):n?n(e):e;const ct={isValid:!1,value:null};var ht=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,ct):ct;function dt(e){const t=e.ref;return Ye(t)?t.files:et(t)?ht(e.refs).value:Je(t)?[...t.selectedOptions].map(({value:e})=>e):ne(t)?lt(e.refs).value:ut(fe(t.value)?e.ref.value:t.value,e)}var ft=e=>e instanceof RegExp,pt=e=>fe(e)?e:ft(e)?e.source:ae(e)?ft(e.value)?e.value.source:e.value:e,mt=e=>({isOnSubmit:!e||e===Te,isOnBlur:e===Ae,isOnChange:e===Ee,isOnAll:e===ke,isOnTouch:e===Se});const _t="AsyncFunction";var gt=e=>!!e&&!!e.validate&&!!(ye(e.validate)&&e.validate.constructor.name===_t||ae(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===_t)),yt=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const vt=(e,t,r,n)=>{for(const i of r||Object.keys(e)){const r=_e(e,i);if(r){const{_f:e,...s}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!n)return!0;if(e.ref&&t(e.ref,e.name)&&!n)return!0;if(vt(s,t))break}else if(ae(s)&&vt(s,t))break}}};function bt(e,t,r){const n=_e(e,r);if(n||de(r))return{error:n,name:r};const i=r.split(".");for(;i.length;){const n=i.join("."),s=_e(t,n),o=_e(e,n);if(s&&!Array.isArray(s)&&r!==n)return{name:r};if(o&&o.type)return{name:n,error:o};if(o&&o.root&&o.root.type)return{name:`${n}.root`,error:o.root};i.pop()}return{name:r}}var xt=(e,t,r)=>{const n=He(_e(e,r));return ve(n,"root",t[r]),ve(e,r,n),e};function wt(e,t,r="validate"){if(Ue(e)||Array.isArray(e)&&e.every(Ue)||ge(e)&&!e)return{type:r,message:Ue(e)?e:"",ref:t}}var At=e=>ae(e)&&!ft(e)?e:{value:e,message:""},Et=async(e,t,r,n,i,s)=>{const{ref:o,refs:a,required:l,maxLength:u,minLength:c,min:h,max:d,pattern:f,validate:p,name:m,valueAsNumber:_,mount:g}=e._f,y=_e(r,m);if(!g||t.has(m))return{};const v=a?a[0]:o,b=e=>{i&&v.reportValidity&&(v.setCustomValidity(ge(e)?"":e||""),v.reportValidity())},x={},w=et(o),A=ne(o),E=w||A,T=(_||Ye(o))&&fe(o.value)&&fe(y)||Qe(o)&&""===o.value||""===y||Array.isArray(y)&&!y.length,S=We.bind(null,m,n,x),k=(e,t,r,n=Ce,i=Ne)=>{const s=e?t:r;x[m]={type:e?n:i,message:s,ref:o,...S(e?n:i,s)}};if(s?!Array.isArray(y)||!y.length:l&&(!E&&(T||se(y))||ge(y)&&!y||A&&!lt(a).isValid||w&&!ht(a).isValid)){const{value:e,message:t}=Ue(l)?{value:!!l,message:l}:At(l);if(e&&(x[m]={type:Me,message:t,ref:v,...S(Me,t)},!n))return b(t),x}if(!(T||se(h)&&se(d))){let e,t;const r=At(d),i=At(h);if(se(y)||isNaN(y)){const n=o.valueAsDate||new Date(y),s=e=>new Date((new Date).toDateString()+" "+e),a="time"==o.type,l="week"==o.type;Ue(r.value)&&y&&(e=a?s(y)>s(r.value):l?y>r.value:n>new Date(r.value)),Ue(i.value)&&y&&(t=a?s(y)<s(i.value):l?y<i.value:n<new Date(i.value))}else{const n=o.valueAsNumber||(y?+y:y);se(r.value)||(e=n>r.value),se(i.value)||(t=n<i.value)}if((e||t)&&(k(!!e,r.message,i.message,Oe,Re),!n))return b(x[m].message),x}if((u||c)&&!T&&(Ue(y)||s&&Array.isArray(y))){const e=At(u),t=At(c),r=!se(e.value)&&y.length>+e.value,i=!se(t.value)&&y.length<+t.value;if((r||i)&&(k(r,e.message,t.message),!n))return b(x[m].message),x}if(f&&!T&&Ue(y)){const{value:e,message:t}=At(f);if(ft(e)&&!y.match(e)&&(x[m]={type:Pe,message:t,ref:o,...S(Pe,t)},!n))return b(t),x}if(p)if(ye(p)){const e=wt(await p(y,r),v);if(e&&(x[m]={...e,...S(De,e.message)},!n))return b(e.message),x}else if(ae(p)){let e={};for(const t in p){if(!Xe(e)&&!n)break;const i=wt(await p[t](y,r),v,t);i&&(e={...i,...S(t,i.message)},b(i.message),n&&(x[m]=e))}if(!Xe(e)&&(x[m]={ref:v,...e},!n))return x}return b(!0),x};const Tt={mode:Te,reValidateMode:Ee,shouldFocusError:!0};function St(e={}){let t,r={...Tt,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:ye(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},i={},s=(ae(r.defaultValues)||ae(r.values))&&he(r.defaultValues||r.values)||{},o=r.shouldUnregister?{}:he(s),a={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},u=0;const c={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},h={...c};let d={...h};const f={array:Ze(),state:Ze()},p=r.criteriaMode===ke,m=async e=>{if(!a.keepIsValid&&!r.disabled&&(h.isValid||d.isValid||e)){let e;r.resolver?(e=Xe((await b()).errors),_()):e=await x(i,!0),e!==n.isValid&&f.state.next({isValid:e})}},_=(e,t)=>{!r.disabled&&(h.isValidating||h.validatingFields||d.isValidating||d.validatingFields)&&((e||Array.from(l.mount)).forEach(e=>{e&&(t?ve(n.validatingFields,e,t):rt(n.validatingFields,e))}),f.state.next({validatingFields:n.validatingFields,isValidating:!Xe(n.validatingFields)}))},g=(e,t,r,n)=>{const l=_e(i,e);if(l){const i=_e(o,e,fe(r)?_e(s,e):r);fe(i)||n&&n.defaultChecked||t?ve(o,e,t?i:dt(l._f)):E(e,i),a.mount&&!a.action&&m()}},y=(e,t,i,o,a)=>{let l=!1,u=!1;const c={name:e};if(!r.disabled){if(!i||o){(h.isDirty||d.isDirty)&&(u=n.isDirty,n.isDirty=c.isDirty=w(),l=u!==c.isDirty);const r=Ge(_e(s,e),t);u=!!_e(n.dirtyFields,e),r?rt(n.dirtyFields,e):ve(n.dirtyFields,e,!0),c.dirtyFields=n.dirtyFields,l=l||(h.dirtyFields||d.dirtyFields)&&u!==!r}if(i){const t=_e(n.touchedFields,e);t||(ve(n.touchedFields,e,i),c.touchedFields=n.touchedFields,l=l||(h.touchedFields||d.touchedFields)&&t!==i)}l&&a&&f.state.next(c)}return l?c:{}},v=(e,i,s,o)=>{const a=_e(n.errors,e),l=(h.isValid||d.isValid)&&ge(i)&&n.isValid!==i;var c;if(r.delayError&&s?(c=()=>((e,t)=>{ve(n.errors,e,t),f.state.next({errors:n.errors})})(e,s),t=e=>{clearTimeout(u),u=setTimeout(c,e)},t(r.delayError)):(clearTimeout(u),t=null,s?ve(n.errors,e,s):rt(n.errors,e)),(s?!Ge(a,s):a)||!Xe(o)||l){const t={...o,...l&&ge(i)?{isValid:i}:{},errors:n.errors,name:e};n={...n,...t},f.state.next(t)}},b=async e=>{_(e,!0);const t=await r.resolver(o,r.context,((e,t,r,n)=>{const i={};for(const r of e){const e=_e(t,r);e&&ve(i,r,e._f)}return{criteriaMode:r,names:[...e],fields:i,shouldUseNativeValidation:n}})(e||l.mount,i,r.criteriaMode,r.shouldUseNativeValidation));return t},x=async(e,t,i={valid:!0})=>{for(const s in e){const a=e[s];if(a){const{_f:e,...s}=a;if(e){const s=l.array.has(e.name),u=a._f&>(a._f);u&&h.validatingFields&&_([e.name],!0);const c=await Et(a,l.disabled,o,p,r.shouldUseNativeValidation&&!t,s);if(u&&h.validatingFields&&_([e.name]),c[e.name]&&(i.valid=!1,t))break;!t&&(_e(c,e.name)?s?xt(n.errors,c,e.name):ve(n.errors,e.name,c[e.name]):rt(n.errors,e.name))}!Xe(s)&&await x(s,t,i)}}return i.valid},w=(e,t)=>!r.disabled&&(e&&t&&ve(o,e,t),!Ge(C(),s)),A=(e,t,r)=>Be(e,l,{...a.mount?o:fe(t)?s:Ue(e)?{[e]:t}:t},r,t),E=(e,t,r={})=>{const n=_e(i,e);let s=t;if(n){const r=n._f;r&&(!r.disabled&&ve(o,e,ut(t,r)),s=Qe(r.ref)&&se(t)?"":t,Je(r.ref)?[...r.ref.options].forEach(e=>e.selected=s.includes(e.value)):r.refs?ne(r.ref)?r.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(s)?e.checked=!!s.find(t=>t===e.value):e.checked=s===e.value||!!s)}):r.refs.forEach(e=>e.checked=e.value===s):Ye(r.ref)?r.ref.value="":(r.ref.value=s,r.ref.type||f.state.next({name:e,values:he(o)})))}(r.shouldDirty||r.shouldTouch)&&y(e,s,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&R(e)},T=(e,t,r)=>{for(const n in t){if(!t.hasOwnProperty(n))return;const s=t[n],o=e+"."+n,a=_e(i,o);(l.array.has(e)||ae(s)||a&&!a._f)&&!ie(s)?T(o,s,r):E(o,s,r)}},S=(e,t,r={})=>{const u=_e(i,e),c=l.array.has(e),p=he(t);ve(o,e,p),c?(f.array.next({name:e,values:he(o)}),(h.isDirty||h.dirtyFields||d.isDirty||d.dirtyFields)&&r.shouldDirty&&f.state.next({name:e,dirtyFields:st(s,o),isDirty:w(e,p)})):!u||u._f||se(p)?E(e,p,r):T(e,p,r),yt(e,l)&&f.state.next({...n,name:e}),f.state.next({name:a.mount?e:void 0,values:he(o)})},k=async e=>{a.mount=!0;const s=e.target;let u=s.name,c=!0;const g=_e(i,u),w=e=>{c=Number.isNaN(e)||ie(e)&&isNaN(e.getTime())||Ge(e,_e(o,u,e))},A=mt(r.mode),E=mt(r.reValidateMode);if(g){let a,S;const k=s.type?dt(g._f):le(e),O=e.type===be||e.type===xe,C=!((T=g._f).mount&&(T.required||T.min||T.max||T.maxLength||T.minLength||T.pattern||T.validate)||r.resolver||_e(n.errors,u)||g._f.deps)||((e,t,r,n,i)=>!i.isOnAll&&(!r&&i.isOnTouch?!(t||e):(r?n.isOnBlur:i.isOnBlur)?!e:!(r?n.isOnChange:i.isOnChange)||e))(O,_e(n.touchedFields,u),n.isSubmitted,E,A),N=yt(u,l,O);ve(o,u,k),O?s&&s.readOnly||(g._f.onBlur&&g._f.onBlur(e),t&&t(0)):g._f.onChange&&g._f.onChange(e);const P=y(u,k,O),M=!Xe(P)||N;if(!O&&f.state.next({name:u,type:e.type,values:he(o)}),C)return(h.isValid||d.isValid)&&("onBlur"===r.mode?O&&m():O||m()),M&&f.state.next({name:u,...N?{}:P});if(!O&&N&&f.state.next({...n}),r.resolver){const{errors:e}=await b([u]);if(_([u]),w(k),c){const t=bt(n.errors,i,u),r=bt(e,i,t.name||u);a=r.error,u=r.name,S=Xe(e)}}else _([u],!0),a=(await Et(g,l.disabled,o,p,r.shouldUseNativeValidation))[u],_([u]),w(k),c&&(a?S=!1:(h.isValid||d.isValid)&&(S=await x(i,!0)));c&&(g._f.deps&&(!Array.isArray(g._f.deps)||g._f.deps.length>0)&&R(g._f.deps),v(u,S,a,P))}var T},O=(e,t)=>{if(_e(n.errors,t)&&e.focus)return e.focus(),1},R=async(e,t={})=>{let s,o;const a=He(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await b(e);if(_(e),e)for(const r of e){const e=_e(t,r);e?ve(n.errors,r,e):rt(n.errors,r)}else n.errors=t;return t})(fe(e)?e:a);s=Xe(t),o=e?!a.some(e=>_e(t,e)):s}else e?(o=(await Promise.all(a.map(async e=>{const t=_e(i,e);return await x(t&&t._f?{[e]:t}:t)}))).every(Boolean),(o||n.isValid)&&m()):o=s=await x(i);return f.state.next({...!Ue(e)||(h.isValid||d.isValid)&&s!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:s}:{},errors:n.errors}),t.shouldFocus&&!o&&vt(i,O,e?a:l.mount),o},C=(e,t)=>{let r={...a.mount?o:s};return t&&(r=Ke(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),fe(e)?r:Ue(e)?_e(r,e):e.map(e=>_e(r,e))},N=(e,t)=>({invalid:!!_e((t||n).errors,e),isDirty:!!_e((t||n).dirtyFields,e),error:_e((t||n).errors,e),isValidating:!!_e(n.validatingFields,e),isTouched:!!_e((t||n).touchedFields,e)}),P=(e,t,r)=>{const s=(_e(i,e,{_f:{}})._f||{}).ref,o=_e(n.errors,e)||{},{ref:a,message:l,type:u,...c}=o;ve(n.errors,e,{...c,...t,ref:s}),f.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&s&&s.focus&&s.focus()},M=e=>f.state.subscribe({next:t=>{var r,i,a;r=e.name,i=t.name,a=e.exact,r&&i&&r!==i&&!He(r).some(e=>e&&(a?e===i:e.startsWith(i)||i.startsWith(e)))||!((e,t,r,n)=>{r(e);const{name:i,...s}=e;return Xe(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(e=>t[e]===(!n||ke))})(t,e.formState||h,B,e.reRenderRoot)||e.callback({values:{...o},...n,...t,defaultValues:s})}}).unsubscribe,D=(e,t={})=>{for(const a of e?He(e):l.mount)l.mount.delete(a),l.array.delete(a),t.keepValue||(rt(i,a),rt(o,a)),!t.keepError&&rt(n.errors,a),!t.keepDirty&&rt(n.dirtyFields,a),!t.keepTouched&&rt(n.touchedFields,a),!t.keepIsValidating&&rt(n.validatingFields,a),!r.shouldUnregister&&!t.keepDefaultValue&&rt(s,a);f.state.next({values:he(o)}),f.state.next({...n,...t.keepDirty?{isDirty:w()}:{}}),!t.keepIsValid&&m()},z=({disabled:e,name:t})=>{(ge(e)&&a.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t))},I=(e,t={})=>{let n=_e(i,e);const o=ge(t.disabled)||ge(r.disabled);return ve(i,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),l.mount.add(e),n?z({disabled:ge(t.disabled)?t.disabled:r.disabled,name:e}):g(e,!0,t.value),{...o?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:pt(t.min),max:pt(t.max),minLength:pt(t.minLength),maxLength:pt(t.maxLength),pattern:pt(t.pattern)}:{},name:e,onChange:k,onBlur:k,ref:o=>{if(o){I(e,t),n=_e(i,e);const r=fe(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,a=(e=>et(e)||ne(e))(r),l=n._f.refs||[];if(a?l.find(e=>e===r):r===n._f.ref)return;ve(i,e,{_f:{...n._f,...a?{refs:[...l.filter(tt),r,...Array.isArray(_e(s,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),g(e,!1,void 0,r)}else n=_e(i,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!ue(l.array,e)||!a.action)&&l.unMount.add(e)}}},F=()=>r.shouldFocusError&&vt(i,O,l.mount),L=(e,t)=>async s=>{let a;s&&(s.preventDefault&&s.preventDefault(),s.persist&&s.persist());let u=he(o);if(f.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await b();_(),n.errors=e,u=he(t)}else await x(i);if(l.disabled.size)for(const e of l.disabled)rt(u,e);if(rt(n.errors,"root"),Xe(n.errors)){f.state.next({errors:{}});try{await e(u,s)}catch(e){a=e}}else t&&await t({...n.errors},s),F(),setTimeout(F);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Xe(n.errors)&&!a,submitCount:n.submitCount+1,errors:n.errors}),a)throw a},j=(e,t={})=>{const u=e?he(e):s,c=he(u),d=Xe(e),p=d?s:c;if(t.keepDefaultValues||(s=u),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(st(s,o))]);for(const t of Array.from(e))_e(n.dirtyFields,t)?ve(p,t,_e(o,t)):S(t,_e(p,t))}else{if(ce&&fe(e))for(const e of l.mount){const t=_e(i,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(Qe(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of l.mount)S(e,_e(p,e));else i={}}o=r.shouldUnregister?t.keepDefaultValues?he(s):{}:he(p),f.array.next({values:{...p}}),f.state.next({values:{...p}})}l={mount:t.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!h.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!r.shouldUnregister&&!Xe(p),a.watch=!!r.shouldUnregister,a.keepIsValid=!!t.keepIsValid,a.action=!1,t.keepErrors||(n.errors={}),f.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!d&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||Ge(e,s))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:d?{}:t.keepDirtyValues?t.keepDefaultValues&&o?st(s,o):n.dirtyFields:t.keepDefaultValues&&e?st(s,e):t.keepDirty?n.dirtyFields:{},touchedFields:t.keepTouched?n.touchedFields:{},errors:t.keepErrors?n.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1,defaultValues:s})},U=(e,t)=>j(ye(e)?e(o):e,{...r.resetOptions,...t}),B=e=>{n={...n,...e}},V={control:{register:I,unregister:D,getFieldState:N,handleSubmit:L,setError:P,_subscribe:M,_runSchema:b,_updateIsValidating:_,_focusError:F,_getWatch:A,_getDirty:w,_setValid:m,_setFieldArray:(e,t=[],l,u,c=!0,p=!0)=>{if(u&&l&&!r.disabled){if(a.action=!0,p&&Array.isArray(_e(i,e))){const t=l(_e(i,e),u.argA,u.argB);c&&ve(i,e,t)}if(p&&Array.isArray(_e(n.errors,e))){const t=l(_e(n.errors,e),u.argA,u.argB);c&&ve(n.errors,e,t),((e,t)=>{!pe(_e(e,t)).length&&rt(e,t)})(n.errors,e)}if((h.touchedFields||d.touchedFields)&&p&&Array.isArray(_e(n.touchedFields,e))){const t=l(_e(n.touchedFields,e),u.argA,u.argB);c&&ve(n.touchedFields,e,t)}(h.dirtyFields||d.dirtyFields)&&(n.dirtyFields=st(s,o)),f.state.next({name:e,isDirty:w(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else ve(o,e,t)},_setDisabledField:z,_setErrors:e=>{n.errors=e,f.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>pe(_e(a.mount?o:s,e,r.shouldUnregister?_e(s,e,[]):[])),_reset:j,_resetDefaultValues:()=>ye(r.defaultValues)&&r.defaultValues().then(e=>{U(e,r.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of l.unMount){const t=_e(i,e);t&&(t._f.refs?t._f.refs.every(e=>!tt(e)):!tt(t._f.ref))&&D(e)}l.unMount=new Set},_disableForm:e=>{ge(e)&&(f.state.next({disabled:e}),vt(i,(t,r)=>{const n=_e(i,r);n&&(t.disabled=n._f.disabled||e,Array.isArray(n._f.refs)&&n._f.refs.forEach(t=>{t.disabled=n._f.disabled||e}))},0,!1))},_subjects:f,_proxyFormState:h,get _fields(){return i},get _formValues(){return o},get _state(){return a},set _state(e){a=e},get _defaultValues(){return s},get _names(){return l},set _names(e){l=e},get _formState(){return n},get _options(){return r},set _options(e){r={...r,...e}}},subscribe:e=>(a.mount=!0,d={...d,...e.formState},M({...e,formState:{...c,...e.formState}})),trigger:R,register:I,handleSubmit:L,watch:(e,t)=>ye(e)?f.state.subscribe({next:r=>"values"in r&&e(A(void 0,t),r)}):A(e,t,!0),setValue:S,getValues:C,reset:U,resetField:(e,t={})=>{_e(i,e)&&(fe(t.defaultValue)?S(e,he(_e(s,e))):(S(e,t.defaultValue),ve(s,e,he(t.defaultValue))),t.keepTouched||rt(n.touchedFields,e),t.keepDirty||(rt(n.dirtyFields,e),n.isDirty=t.defaultValue?w(e,he(_e(s,e))):w()),t.keepError||(rt(n.errors,e),h.isValid&&m()),f.state.next({...n}))},clearErrors:e=>{e&&He(e).forEach(e=>rt(n.errors,e)),f.state.next({errors:e?n.errors:{}})},unregister:D,setError:P,setFocus:(e,t={})=>{const r=_e(i,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&ye(e.select)&&e.select()})}},getFieldState:N};return{...V,formControl:V}}const kt=({sx:t,...r})=>e(V,{variant:"body1",sx:{color:"var(--color-white)",cursor:"default",...t},...r}),Ot=j(F)({padding:0,marginRight:"5px",marginLeft:"10px","& .MuiSvgIcon-root":{color:"var(--color-orange-medium)"}});function Rt({label:t,name:n,...i}){const s=r.useId(),{control:o,setValue:a,watch:l}=Ie(),u=l(n),c=`${s}-${n}-${String(u)}`;return e(qe,{control:o,name:n,render:({field:r})=>{const{value:n,name:s}=r;return t?e(L,{color:"white",control:e(Ot,{...i,checked:n,onChange:(e,t)=>{a(s,t,{shouldValidate:!0})}}),label:e(kt,{children:t})}):e(Ot,{...i,checked:n,onChange:(e,t)=>{a(s,t,{shouldValidate:!0})}})}},c)}function Ct({form:t,sx:r={},onSubmit:n,children:i}){const{handleSubmit:s}=t;return e(Fe,{...t,children:e(x,{component:"form",sx:{display:"grid",gap:"15px",...r},onSubmit:s(n),children:i})})}const Nt=()=>Ie(),Pt=t=>e(P,{size:"small",...t});function Mt({name:t,items:n,label:i,sx:s,getLabel:o,getValue:a,getKey:l}){const{watch:u,resetField:c,setValue:h}=Ie(),d=u(t),f=r.useId(),p=n.find(e=>a(e)===d);return e(G,{value:p,options:n,id:f,getOptionLabel:e=>o(e),getOptionKey:e=>l(e),sx:{minWidth:150,...s},size:"small",onChange:(e,r)=>{r?h(t,a(r)):c(t)},renderInput:t=>e(Pt,{...t,label:i})})}function Dt(t){const{name:n,type:i}=t,s=r.useId(),{control:o}=Ie();return e(qe,{name:n,control:o,render:({field:r})=>e(Pt,{id:s,size:"small",...t,...r,onChange:e=>{const{target:t}=e,{value:n}=t;if("number"===i)""===n?r.onChange():r.onChange(Number(n));else r.onChange(e)}})})}const zt="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function It(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function Ft(e){return"nodeType"in e}function Lt(e){var t,r;return e?It(e)?e:Ft(e)&&null!=(t=null==(r=e.ownerDocument)?void 0:r.defaultView)?t:window:window}function jt(e){const{Document:t}=Lt(e);return e instanceof t}function Ut(e){return!It(e)&&e instanceof Lt(e).HTMLElement}function Bt(e){return e instanceof Lt(e).SVGElement}function Vt(e){return e?It(e)?e.document:Ft(e)?jt(e)?e:Ut(e)||Bt(e)?e.ownerDocument:document:document:document}const Gt=zt?i:s;function $t(e){const t=o(e);return Gt(()=>{t.current=e}),l(function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return null==t.current?void 0:t.current(...r)},[])}function qt(e,t){void 0===t&&(t=[e]);const r=o(e);return Gt(()=>{r.current!==e&&(r.current=e)},t),r}function Wt(e,t){const r=o();return a(()=>{const t=e(r.current);return r.current=t,t},[...t])}function Ht(e){const t=$t(e),r=o(null),n=l(e=>{e!==r.current&&(null==t||t(e,r.current)),r.current=e},[]);return[r,n]}function Zt(e){const t=o();return s(()=>{t.current=e},[e]),t.current}let Kt={};function Xt(e,t){return a(()=>{if(t)return t;const r=null==Kt[e]?0:Kt[e]+1;return Kt[e]=r,e+"-"+r},[e,t])}function Yt(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.reduce((t,r)=>{const n=Object.entries(r);for(const[r,i]of n){const n=t[r];null!=n&&(t[r]=n+e*i)}return t},{...t})}}const Qt=Yt(1),Jt=Yt(-1);function er(e){if(!e)return!1;const{KeyboardEvent:t}=Lt(e.target);return t&&e instanceof t}function tr(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=Lt(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const rr=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[rr.Translate.toString(e),rr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),nr="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function ir(e){return e.matches(nr)?e:e.querySelector(nr)}const sr={display:"none"};function or(e){let{id:t,value:r}=e;return n.createElement("div",{id:t,style:sr},r)}function ar(e){let{id:t,announcement:r,ariaLiveType:i="assertive"}=e;return n.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":i,"aria-atomic":!0},r)}const lr=c(null);const ur={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},cr={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function hr(e){let{announcements:t=cr,container:r,hiddenTextDescribedById:i,screenReaderInstructions:o=ur}=e;const{announce:c,announcement:h}=function(){const[e,t]=u("");return{announce:l(e=>{null!=e&&t(e)},[]),announcement:e}}(),d=Xt("DndLiveRegion"),[p,m]=u(!1);if(s(()=>{m(!0)},[]),function(e){const t=f(lr);s(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}(a(()=>({onDragStart(e){let{active:r}=e;c(t.onDragStart({active:r}))},onDragMove(e){let{active:r,over:n}=e;t.onDragMove&&c(t.onDragMove({active:r,over:n}))},onDragOver(e){let{active:r,over:n}=e;c(t.onDragOver({active:r,over:n}))},onDragEnd(e){let{active:r,over:n}=e;c(t.onDragEnd({active:r,over:n}))},onDragCancel(e){let{active:r,over:n}=e;c(t.onDragCancel({active:r,over:n}))}}),[c,t])),!p)return null;const _=n.createElement(n.Fragment,null,n.createElement(or,{id:i,value:o.draggable}),n.createElement(ar,{id:d,announcement:h}));return r?q(_,r):_}var dr;function fr(){}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(dr||(dr={}));const pr=Object.freeze({x:0,y:0});function mr(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function _r(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function gr(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function yr(e,t,r){return void 0===t&&(t=e.left),void 0===r&&(r=e.top),{x:t+.5*e.width,y:r+.5*e.height}}const vr=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const i=yr(t,t.left,t.top),s=[];for(const e of n){const{id:t}=e,n=r.get(t);if(n){const r=mr(yr(n),i);s.push({id:t,data:{droppableContainer:e,value:r}})}}return s.sort(_r)};function br(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),o=i-n,a=s-r;if(n<i&&r<s){const r=t.width*t.height,n=e.width*e.height,i=o*a;return Number((i/(r+n-i)).toFixed(4))}return 0}const xr=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const i=[];for(const e of n){const{id:n}=e,s=r.get(n);if(s){const r=br(s,t);r>0&&i.push({id:n,data:{droppableContainer:e,value:r}})}}return i.sort(gr)};function wr(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:pr}function Ar(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.reduce((t,r)=>({...t,top:t.top+e*r.y,bottom:t.bottom+e*r.y,left:t.left+e*r.x,right:t.right+e*r.x}),{...t})}}const Er=Ar(1);const Tr={ignoreTransform:!1};function Sr(e,t){void 0===t&&(t=Tr);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:n}=Lt(e).getComputedStyle(e);t&&(r=function(e,t,r){const n=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!n)return e;const{scaleX:i,scaleY:s,x:o,y:a}=n,l=e.left-o-(1-i)*parseFloat(r),u=e.top-a-(1-s)*parseFloat(r.slice(r.indexOf(" ")+1)),c=i?e.width/i:e.width,h=s?e.height/s:e.height;return{width:c,height:h,top:u,right:l+c,bottom:u+h,left:l}}(r,t,n))}const{top:n,left:i,width:s,height:o,bottom:a,right:l}=r;return{top:n,left:i,width:s,height:o,bottom:a,right:l}}function kr(e){return Sr(e,{ignoreTransform:!0})}function Or(e,t){const r=[];return e?function n(i){if(null!=t&&r.length>=t)return r;if(!i)return r;if(jt(i)&&null!=i.scrollingElement&&!r.includes(i.scrollingElement))return r.push(i.scrollingElement),r;if(!Ut(i)||Bt(i))return r;if(r.includes(i))return r;const s=Lt(e).getComputedStyle(i);return i!==e&&function(e,t){void 0===t&&(t=Lt(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{const n=t[e];return"string"==typeof n&&r.test(n)})}(i,s)&&r.push(i),function(e,t){return void 0===t&&(t=Lt(e).getComputedStyle(e)),"fixed"===t.position}(i,s)?r:n(i.parentNode)}(e):r}function Rr(e){const[t]=Or(e,1);return null!=t?t:null}function Cr(e){return zt&&e?It(e)?e:Ft(e)?jt(e)||e===Vt(e).scrollingElement?window:Ut(e)?e:null:null:null}function Nr(e){return It(e)?e.scrollX:e.scrollLeft}function Pr(e){return It(e)?e.scrollY:e.scrollTop}function Mr(e){return{x:Nr(e),y:Pr(e)}}var Dr;function zr(e){return!(!zt||!e)&&e===document.scrollingElement}function Ir(e){const t={x:0,y:0},r=zr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=n.y,isRight:e.scrollLeft>=n.x,maxScroll:n,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(Dr||(Dr={}));const Fr={x:.2,y:.2};function Lr(e,t,r,n,i){let{top:s,left:o,right:a,bottom:l}=r;void 0===n&&(n=10),void 0===i&&(i=Fr);const{isTop:u,isBottom:c,isLeft:h,isRight:d}=Ir(e),f={x:0,y:0},p={x:0,y:0},m=t.height*i.y,_=t.width*i.x;return!u&&s<=t.top+m?(f.y=Dr.Backward,p.y=n*Math.abs((t.top+m-s)/m)):!c&&l>=t.bottom-m&&(f.y=Dr.Forward,p.y=n*Math.abs((t.bottom-m-l)/m)),!d&&a>=t.right-_?(f.x=Dr.Forward,p.x=n*Math.abs((t.right-_-a)/_)):!h&&o<=t.left+_&&(f.x=Dr.Backward,p.x=n*Math.abs((t.left+_-o)/_)),{direction:f,speed:p}}function jr(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:r,right:n,bottom:i}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Ur(e){return e.reduce((e,t)=>Qt(e,Mr(t)),pr)}const Br=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+Nr(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+Pr(t),0)}]];class Vr{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Or(t),n=Ur(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,i]of Br)for(const s of t)Object.defineProperty(this,s,{get:()=>{const t=i(r),o=n[e]-t;return this.rect[s]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Gr{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,r){var n;null==(n=this.target)||n.addEventListener(e,t,r),this.listeners.push([e,t,r])}}function $r(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return"number"==typeof t?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t&&n>t.y}var qr,Wr;function Hr(e){e.preventDefault()}function Zr(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(qr||(qr={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"}(Wr||(Wr={}));const Kr={start:[Wr.Space,Wr.Enter],cancel:[Wr.Esc],end:[Wr.Space,Wr.Enter,Wr.Tab]},Xr=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Wr.Right:return{...r,x:r.x+25};case Wr.Left:return{...r,x:r.x-25};case Wr.Down:return{...r,y:r.y+25};case Wr.Up:return{...r,y:r.y-25}}};class Yr{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new Gr(Vt(t)),this.windowListeners=new Gr(Lt(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(qr.Resize,this.handleCancel),this.windowListeners.add(qr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(qr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,r=e.node.current;r&&function(e,t){if(void 0===t&&(t=Sr),!e)return;const{top:r,left:n,bottom:i,right:s}=t(e);Rr(e)&&(i<=0||s<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(r),t(pr)}handleKeyDown(e){if(er(e)){const{active:t,context:r,options:n}=this.props,{keyboardCodes:i=Kr,coordinateGetter:s=Xr,scrollBehavior:o="smooth"}=n,{code:a}=e;if(i.end.includes(a))return void this.handleEnd(e);if(i.cancel.includes(a))return void this.handleCancel(e);const{collisionRect:l}=r.current,u=l?{x:l.left,y:l.top}:pr;this.referenceCoordinates||(this.referenceCoordinates=u);const c=s(e,{active:t,context:r.current,currentCoordinates:u});if(c){const t=Jt(c,u),n={x:0,y:0},{scrollableAncestors:i}=r.current;for(const r of i){const i=e.code,{isTop:s,isRight:a,isLeft:l,isBottom:u,maxScroll:h,minScroll:d}=Ir(r),f=jr(r),p={x:Math.min(i===Wr.Right?f.right-f.width/2:f.right,Math.max(i===Wr.Right?f.left:f.left+f.width/2,c.x)),y:Math.min(i===Wr.Down?f.bottom-f.height/2:f.bottom,Math.max(i===Wr.Down?f.top:f.top+f.height/2,c.y))},m=i===Wr.Right&&!a||i===Wr.Left&&!l,_=i===Wr.Down&&!u||i===Wr.Up&&!s;if(m&&p.x!==c.x){const e=r.scrollLeft+t.x,s=i===Wr.Right&&e<=h.x||i===Wr.Left&&e>=d.x;if(s&&!t.y)return void r.scrollTo({left:e,behavior:o});n.x=s?r.scrollLeft-e:i===Wr.Right?r.scrollLeft-h.x:r.scrollLeft-d.x,n.x&&r.scrollBy({left:-n.x,behavior:o});break}if(_&&p.y!==c.y){const e=r.scrollTop+t.y,s=i===Wr.Down&&e<=h.y||i===Wr.Up&&e>=d.y;if(s&&!t.x)return void r.scrollTo({top:e,behavior:o});n.y=s?r.scrollTop-e:i===Wr.Down?r.scrollTop-h.y:r.scrollTop-d.y,n.y&&r.scrollBy({top:-n.y,behavior:o});break}}this.handleMove(e,Qt(Jt(c,this.referenceCoordinates),n))}}}handleMove(e,t){const{onMove:r}=this.props;e.preventDefault(),r(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function Qr(e){return Boolean(e&&"distance"in e)}function Jr(e){return Boolean(e&&"delay"in e)}Yr.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Kr,onActivation:i}=t,{active:s}=r;const{code:o}=e.nativeEvent;if(n.start.includes(o)){const t=s.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==i||i({event:e.nativeEvent}),!0)}return!1}}];class en{constructor(e,t,r){var n;void 0===r&&(r=function(e){const{EventTarget:t}=Lt(e);return e instanceof t?e:Vt(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:i}=e,{target:s}=i;this.props=e,this.events=t,this.document=Vt(s),this.documentListeners=new Gr(this.document),this.listeners=new Gr(r),this.windowListeners=new Gr(Lt(s)),this.initialCoordinates=null!=(n=tr(i))?n:pr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(qr.Resize,this.handleCancel),this.windowListeners.add(qr.DragStart,Hr),this.windowListeners.add(qr.VisibilityChange,this.handleCancel),this.windowListeners.add(qr.ContextMenu,Hr),this.documentListeners.add(qr.Keydown,this.handleKeydown),t){if(null!=r&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Jr(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(Qr(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:r,onPending:n}=this.props;n(r,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(qr.Click,Zr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(qr.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:r,initialCoordinates:n,props:i}=this,{onMove:s,options:{activationConstraint:o}}=i;if(!n)return;const a=null!=(t=tr(e))?t:pr,l=Jt(n,a);if(!r&&o){if(Qr(o)){if(null!=o.tolerance&&$r(l,o.tolerance))return this.handleCancel();if($r(l,o.distance))return this.handleStart()}return Jr(o)&&$r(l,o.tolerance)?this.handleCancel():void this.handlePending(o,l)}e.cancelable&&e.preventDefault(),s(a)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Wr.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const tn={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class rn extends en{constructor(e){const{event:t}=e,r=Vt(t.target);super(e,tn,r)}}rn.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!(!r.isPrimary||0!==r.button)&&(null==n||n({event:r}),!0)}}];const nn={move:{name:"mousemove"},end:{name:"mouseup"}};var sn;!function(e){e[e.RightClick=2]="RightClick"}(sn||(sn={}));(class extends en{constructor(e){super(e,nn,Vt(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button!==sn.RightClick&&(null==n||n({event:r}),!0)}}];const on={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var an,ln;function un(e){let{acceleration:t,activator:r=an.Pointer,canScroll:n,draggingRect:i,enabled:u,interval:c=5,order:h=ln.TreeOrder,pointerCoordinates:d,scrollableAncestors:f,scrollableAncestorRects:p,delta:m,threshold:_}=e;const g=function(e){let{delta:t,disabled:r}=e;const n=Zt(t);return Wt(e=>{if(r||!n||!e)return cn;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[Dr.Backward]:e.x[Dr.Backward]||-1===i.x,[Dr.Forward]:e.x[Dr.Forward]||1===i.x},y:{[Dr.Backward]:e.y[Dr.Backward]||-1===i.y,[Dr.Forward]:e.y[Dr.Forward]||1===i.y}}},[r,t,n])}({delta:m,disabled:!u}),[y,v]=function(){const e=o(null);return[l((t,r)=>{e.current=setInterval(t,r)},[]),l(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}(),b=o({x:0,y:0}),x=o({x:0,y:0}),w=a(()=>{switch(r){case an.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case an.DraggableRect:return i}},[r,i,d]),A=o(null),E=l(()=>{const e=A.current;if(!e)return;const t=b.current.x*x.current.x,r=b.current.y*x.current.y;e.scrollBy(t,r)},[]),T=a(()=>h===ln.TreeOrder?[...f].reverse():f,[h,f]);s(()=>{if(u&&f.length&&w){for(const e of T){if(!1===(null==n?void 0:n(e)))continue;const r=f.indexOf(e),i=p[r];if(!i)continue;const{direction:s,speed:o}=Lr(e,i,w,t,_);for(const e of["x","y"])g[e][s[e]]||(o[e]=0,s[e]=0);if(o.x>0||o.y>0)return v(),A.current=e,y(E,c),b.current=o,void(x.current=s)}b.current={x:0,y:0},x.current={x:0,y:0},v()}else v()},[t,E,n,v,u,c,JSON.stringify(w),JSON.stringify(g),y,f,T,p,JSON.stringify(_)])}(class extends en{constructor(e){super(e,on)}static setup(){return window.addEventListener(on.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(on.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:i}=r;return!(i.length>1)&&(null==n||n({event:r}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(an||(an={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(ln||(ln={}));const cn={x:{[Dr.Backward]:!1,[Dr.Forward]:!1},y:{[Dr.Backward]:!1,[Dr.Forward]:!1}};var hn,dn;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(hn||(hn={})),function(e){e.Optimized="optimized"}(dn||(dn={}));const fn=new Map;function pn(e,t){return Wt(r=>e?r||("function"==typeof t?t(e):e):null,[t,e])}function mn(e){let{callback:t,disabled:r}=e;const n=$t(t),i=a(()=>{if(r||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(n)},[r]);return s(()=>()=>null==i?void 0:i.disconnect(),[i]),i}function _n(e){return new Vr(Sr(e),e)}function gn(e,t,r){void 0===t&&(t=_n);const[n,i]=u(null);function o(){i(n=>{if(!e)return null;var i;if(!1===e.isConnected)return null!=(i=null!=n?n:r)?i:null;const s=t(e);return JSON.stringify(n)===JSON.stringify(s)?n:s})}const l=function(e){let{callback:t,disabled:r}=e;const n=$t(t),i=a(()=>{if(r||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(n)},[n,r]);return s(()=>()=>null==i?void 0:i.disconnect(),[i]),i}({callback(t){if(e)for(const r of t){const{type:t,target:n}=r;if("childList"===t&&n instanceof HTMLElement&&n.contains(e)){o();break}}}}),c=mn({callback:o});return Gt(()=>{o(),e?(null==c||c.observe(e),null==l||l.observe(document.body,{childList:!0,subtree:!0})):(null==c||c.disconnect(),null==l||l.disconnect())},[e]),n}const yn=[];function vn(e,t){void 0===t&&(t=[]);const r=o(null);return s(()=>{r.current=null},t),s(()=>{const t=e!==pr;t&&!r.current&&(r.current=e),!t&&r.current&&(r.current=null)},[e]),r.current?Jt(e,r.current):pr}function bn(e){return a(()=>e?function(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}(e):null,[e])}const xn=[];function wn(e){let{measure:t}=e;const[r,n]=u(null),i=l(e=>{for(const{target:r}of e)if(Ut(r)){n(e=>{const n=t(r);return e?{...e,width:n.width,height:n.height}:n});break}},[t]),s=mn({callback:i}),o=l(e=>{const r=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ut(t)?t:e}(e);null==s||s.disconnect(),r&&(null==s||s.observe(r)),n(r?t(r):null)},[t,s]),[c,h]=Ht(o);return a(()=>({nodeRef:c,rect:r,setRef:h}),[r,c,h])}const An=[{sensor:rn,options:{}},{sensor:Yr,options:{}}],En={current:{}},Tn={draggable:{measure:kr},droppable:{measure:kr,strategy:hn.WhileDragging,frequency:dn.Optimized},dragOverlay:{measure:Sr}};class Sn extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,r;return null!=(t=null==(r=this.get(e))?void 0:r.node.current)?t:void 0}}const kn={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Sn,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:fr},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Tn,measureDroppableContainers:fr,windowRect:null,measuringScheduled:!1},On=c({activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:fr,draggableNodes:new Map,over:null,measureDroppableContainers:fr}),Rn=c(kn);function Cn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Sn}}}function Nn(e,t){switch(t.type){case dr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case dr.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case dr.DragEnd:case dr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case dr.RegisterDroppable:{const{element:r}=t,{id:n}=r,i=new Sn(e.droppable.containers);return i.set(n,r),{...e,droppable:{...e.droppable,containers:i}}}case dr.SetDroppableDisabled:{const{id:r,key:n,disabled:i}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const o=new Sn(e.droppable.containers);return o.set(r,{...s,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case dr.UnregisterDroppable:{const{id:r,key:n}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;const s=new Sn(e.droppable.containers);return s.delete(r),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function Pn(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:i}=f(On),o=Zt(n),a=Zt(null==r?void 0:r.id);return s(()=>{if(!t&&!n&&o&&null!=a){if(!er(o))return;if(document.activeElement===o.target)return;const e=i.get(a);if(!e)return;const{activatorNode:t,node:r}=e;if(!t.current&&!r.current)return;requestAnimationFrame(()=>{for(const e of[t.current,r.current]){if(!e)continue;const t=ir(e);if(t){t.focus();break}}})}},[n,t,i,a,o]),null}const Mn=c({...pr,scaleX:1,scaleY:1});var Dn;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(Dn||(Dn={}));const zn=h(function(e){var t,r,i,c;let{id:h,accessibility:f,autoScroll:p=!0,children:m,sensors:_=An,collisionDetection:g=xr,measuring:y,modifiers:v,...b}=e;const x=d(Nn,void 0,Cn),[w,A]=x,[E,T]=function(){const[e]=u(()=>new Set),t=l(t=>(e.add(t),()=>e.delete(t)),[e]);return[l(t=>{let{type:r,event:n}=t;e.forEach(e=>{var t;return null==(t=e[r])?void 0:t.call(e,n)})},[e]),t]}(),[S,k]=u(Dn.Uninitialized),O=S===Dn.Initialized,{draggable:{active:R,nodes:C,translate:N},droppable:{containers:P}}=w,M=null!=R?C.get(R):null,D=o({initial:null,translated:null}),z=a(()=>{var e;return null!=R?{id:R,data:null!=(e=null==M?void 0:M.data)?e:En,rect:D}:null},[R,M]),I=o(null),[F,L]=u(null),[j,U]=u(null),B=qt(b,Object.values(b)),V=Xt("DndDescribedBy",h),G=a(()=>P.getEnabled(),[P]),q=a(()=>({draggable:{...Tn.draggable,...null==W?void 0:W.draggable},droppable:{...Tn.droppable,...null==W?void 0:W.droppable},dragOverlay:{...Tn.dragOverlay,...null==W?void 0:W.dragOverlay}}),[null==(W=y)?void 0:W.draggable,null==W?void 0:W.droppable,null==W?void 0:W.dragOverlay]);var W;const{droppableRects:H,measureDroppableContainers:Z,measuringScheduled:K}=function(e,t){let{dragging:r,dependencies:n,config:i}=t;const[a,c]=u(null),{frequency:h,measure:d,strategy:f}=i,p=o(e),m=function(){switch(f){case hn.Always:return!1;case hn.BeforeDragging:return r;default:return!r}}(),_=qt(m),g=l(function(e){void 0===e&&(e=[]),_.current||c(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[_]),y=o(null),v=Wt(t=>{if(m&&!r)return fn;if(!t||t===fn||p.current!==e||null!=a){const t=new Map;for(let r of e){if(!r)continue;if(a&&a.length>0&&!a.includes(r.id)&&r.rect.current){t.set(r.id,r.rect.current);continue}const e=r.node.current,n=e?new Vr(d(e),e):null;r.rect.current=n,n&&t.set(r.id,n)}return t}return t},[e,a,r,m,d]);return s(()=>{p.current=e},[e]),s(()=>{m||g()},[r,m]),s(()=>{a&&a.length>0&&c(null)},[JSON.stringify(a)]),s(()=>{m||"number"!=typeof h||null!==y.current||(y.current=setTimeout(()=>{g(),y.current=null},h))},[h,m,g,...n]),{droppableRects:v,measureDroppableContainers:g,measuringScheduled:null!=a}}(G,{dragging:O,dependencies:[N.x,N.y],config:q.droppable}),X=function(e,t){const r=null!=t?e.get(t):void 0,n=r?r.node.current:null;return Wt(e=>{var r;return null==t?null:null!=(r=null!=n?n:e)?r:null},[n,t])}(C,R),Y=a(()=>j?tr(j):null,[j]),Q=function(){const e=!1===(null==F?void 0:F.autoScrollEnabled),t="object"==typeof p?!1===p.enabled:!1===p,r=O&&!e&&!t;if("object"==typeof p)return{...p,enabled:r};return{enabled:r}}(),J=function(e,t){return pn(e,t)}(X,q.draggable.measure);!function(e){let{activeNode:t,measure:r,initialRect:n,config:i=!0}=e;const s=o(!1),{x:a,y:l}="boolean"==typeof i?{x:i,y:i}:i;Gt(()=>{if(!a&&!l||!t)return void(s.current=!1);if(s.current||!n)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const i=wr(r(e),n);if(a||(i.x=0),l||(i.y=0),s.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){const t=Rr(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,a,l,n,r])}({activeNode:null!=R?C.get(R):null,config:Q.layoutShiftCompensation,initialRect:J,measure:q.draggable.measure});const ee=gn(X,q.draggable.measure,J),te=gn(X?X.parentElement:null),re=o({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:H,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=P.getNodeFor(null==(t=re.current.over)?void 0:t.id),ie=wn({measure:q.dragOverlay.measure}),se=null!=(r=ie.nodeRef.current)?r:X,oe=O?null!=(i=ie.rect)?i:ee:null,ae=Boolean(ie.nodeRef.current&&ie.rect),le=wr(ue=ae?null:ee,pn(ue));var ue;const ce=bn(se?Lt(se):null),he=function(e){const t=o(e),r=Wt(r=>e?r&&r!==yn&&e&&t.current&&e.parentNode===t.current.parentNode?r:Or(e):yn,[e]);return s(()=>{t.current=e},[e]),r}(O?null!=ne?ne:X:null),de=function(e,t){void 0===t&&(t=Sr);const[r]=e,n=bn(r?Lt(r):null),[i,s]=u(xn);function o(){s(()=>e.length?e.map(e=>zr(e)?n:new Vr(t(e),e)):xn)}const a=mn({callback:o});return Gt(()=>{null==a||a.disconnect(),o(),e.forEach(e=>null==a?void 0:a.observe(e))},[e]),i}(he),fe=function(e,t){let{transform:r,...n}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...n}),r):r}(v,{transform:{x:N.x-le.x,y:N.y-le.y,scaleX:1,scaleY:1},activatorEvent:j,active:z,activeNodeRect:ee,containerNodeRect:te,draggingNodeRect:oe,over:re.current.over,overlayNodeRect:ie.rect,scrollableAncestors:he,scrollableAncestorRects:de,windowRect:ce}),pe=Y?Qt(Y,N):null,me=function(e){const[t,r]=u(null),n=o(e),i=l(e=>{const t=Cr(e.target);t&&r(e=>e?(e.set(t,Mr(t)),new Map(e)):null)},[]);return s(()=>{const t=n.current;if(e!==t){s(t);const o=e.map(e=>{const t=Cr(e);return t?(t.addEventListener("scroll",i,{passive:!0}),[t,Mr(t)]):null}).filter(e=>null!=e);r(o.length?new Map(o):null),n.current=e}return()=>{s(e),s(t)};function s(e){e.forEach(e=>{const t=Cr(e);null==t||t.removeEventListener("scroll",i)})}},[i,e]),a(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Qt(e,t),pr):Ur(e):pr,[e,t])}(he),_e=vn(me),ge=vn(me,[ee]),ye=Qt(fe,_e),ve=oe?Er(oe,fe):null,be=z&&ve?g({active:z,collisionRect:ve,droppableRects:H,droppableContainers:G,pointerCoordinates:pe}):null,xe=function(e,t){if(!e||0===e.length)return null;const[r]=e;return r[t]}(be,"id"),[we,Ae]=u(null),Ee=function(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}(ae?fe:Qt(fe,ge),null!=(c=null==we?void 0:we.rect)?c:null,ee),Te=o(null),Se=l((e,t)=>{let{sensor:r,options:n}=t;if(null==I.current)return;const i=C.get(I.current);if(!i)return;const s=e.nativeEvent,o=new r({active:I.current,activeNode:i,event:s,options:n,context:re,onAbort(e){if(!C.get(e))return;const{onDragAbort:t}=B.current,r={id:e};null==t||t(r),E({type:"onDragAbort",event:r})},onPending(e,t,r,n){if(!C.get(e))return;const{onDragPending:i}=B.current,s={id:e,constraint:t,initialCoordinates:r,offset:n};null==i||i(s),E({type:"onDragPending",event:s})},onStart(e){const t=I.current;if(null==t)return;const r=C.get(t);if(!r)return;const{onDragStart:n}=B.current,i={activatorEvent:s,active:{id:t,data:r.data,rect:D}};$(()=>{null==n||n(i),k(Dn.Initializing),A({type:dr.DragStart,initialCoordinates:e,active:t}),E({type:"onDragStart",event:i}),L(Te.current),U(s)})},onMove(e){A({type:dr.DragMove,coordinates:e})},onEnd:a(dr.DragEnd),onCancel:a(dr.DragCancel)});function a(e){return async function(){const{active:t,collisions:r,over:n,scrollAdjustedTranslate:i}=re.current;let o=null;if(t&&i){const{cancelDrop:a}=B.current;if(o={activatorEvent:s,active:t,collisions:r,delta:i,over:n},e===dr.DragEnd&&"function"==typeof a){await Promise.resolve(a(o))&&(e=dr.DragCancel)}}I.current=null,$(()=>{A({type:e}),k(Dn.Uninitialized),Ae(null),L(null),U(null),Te.current=null;const t=e===dr.DragEnd?"onDragEnd":"onDragCancel";if(o){const e=B.current[t];null==e||e(o),E({type:t,event:o})}})}}Te.current=o},[C]),ke=l((e,t)=>(r,n)=>{const i=r.nativeEvent,s=C.get(n);if(null!==I.current||!s||i.dndKit||i.defaultPrevented)return;const o={active:s};!0===e(r,t.options,o)&&(i.dndKit={capturedBy:t.sensor},I.current=n,Se(r,t))},[C,Se]),Oe=function(e,t){return a(()=>e.reduce((e,r)=>{const{sensor:n}=r;return[...e,...n.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,r)}))]},[]),[e,t])}(_,ke);!function(e){s(()=>{if(!zt)return;const t=e.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(const e of t)null==e||e()}},e.map(e=>{let{sensor:t}=e;return t}))}(_),Gt(()=>{ee&&S===Dn.Initializing&&k(Dn.Initialized)},[ee,S]),s(()=>{const{onDragMove:e}=B.current,{active:t,activatorEvent:r,collisions:n,over:i}=re.current;if(!t||!r)return;const s={active:t,activatorEvent:r,collisions:n,delta:{x:ye.x,y:ye.y},over:i};$(()=>{null==e||e(s),E({type:"onDragMove",event:s})})},[ye.x,ye.y]),s(()=>{const{active:e,activatorEvent:t,collisions:r,droppableContainers:n,scrollAdjustedTranslate:i}=re.current;if(!e||null==I.current||!t||!i)return;const{onDragOver:s}=B.current,o=n.get(xe),a=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,l={active:e,activatorEvent:t,collisions:r,delta:{x:i.x,y:i.y},over:a};$(()=>{Ae(a),null==s||s(l),E({type:"onDragOver",event:l})})},[xe]),Gt(()=>{re.current={activatorEvent:j,active:z,activeNode:X,collisionRect:ve,collisions:be,droppableRects:H,draggableNodes:C,draggingNode:se,draggingNodeRect:oe,droppableContainers:P,over:we,scrollableAncestors:he,scrollAdjustedTranslate:ye},D.current={initial:oe,translated:ve}},[z,X,be,ve,C,se,oe,H,P,we,he,ye]),un({...Q,delta:N,draggingRect:ve,pointerCoordinates:pe,scrollableAncestors:he,scrollableAncestorRects:de});const Re=a(()=>({active:z,activeNode:X,activeNodeRect:ee,activatorEvent:j,collisions:be,containerNodeRect:te,dragOverlay:ie,draggableNodes:C,droppableContainers:P,droppableRects:H,over:we,measureDroppableContainers:Z,scrollableAncestors:he,scrollableAncestorRects:de,measuringConfiguration:q,measuringScheduled:K,windowRect:ce}),[z,X,ee,j,be,te,ie,C,P,H,we,Z,he,de,q,K,ce]),Ce=a(()=>({activatorEvent:j,activators:Oe,active:z,activeNodeRect:ee,ariaDescribedById:{draggable:V},dispatch:A,draggableNodes:C,over:we,measureDroppableContainers:Z}),[j,Oe,z,ee,A,V,C,we,Z]);return n.createElement(lr.Provider,{value:T},n.createElement(On.Provider,{value:Ce},n.createElement(Rn.Provider,{value:Re},n.createElement(Mn.Provider,{value:Ee},m)),n.createElement(Pn,{disabled:!1===(null==f?void 0:f.restoreFocus)})),n.createElement(hr,{...f,hiddenTextDescribedById:V}))}),In=c(null),Fn="button";function Ln(e){let{id:t,data:r,disabled:n=!1,attributes:i}=e;const s=Xt("Draggable"),{activators:o,activatorEvent:l,active:u,activeNodeRect:c,ariaDescribedById:h,draggableNodes:d,over:p}=f(On),{role:m=Fn,roleDescription:_="draggable",tabIndex:g=0}=null!=i?i:{},y=(null==u?void 0:u.id)===t,v=f(y?Mn:In),[b,x]=Ht(),[w,A]=Ht(),E=function(e,t){return a(()=>e.reduce((e,r)=>{let{eventName:n,handler:i}=r;return e[n]=e=>{i(e,t)},e},{}),[e,t])}(o,t),T=qt(r);Gt(()=>(d.set(t,{id:t,key:s,node:b,activatorNode:w,data:T}),()=>{const e=d.get(t);e&&e.key===s&&d.delete(t)}),[d,t]);return{active:u,activatorEvent:l,activeNodeRect:c,attributes:a(()=>({role:m,tabIndex:g,"aria-disabled":n,"aria-pressed":!(!y||m!==Fn)||void 0,"aria-roledescription":_,"aria-describedby":h.draggable}),[n,m,g,y,_,h.draggable]),isDragging:y,listeners:n?void 0:E,node:b,over:p,setNodeRef:x,setActivatorNodeRef:A,transform:v}}const jn={timeout:25};function Un(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function Bn(e,t){return e.reduce((e,r,n)=>{const i=t.get(r);return i&&(e[n]=i),e},Array(e.length))}function Vn(e){return null!==e&&e>=0}const Gn=e=>{let{rects:t,activeIndex:r,overIndex:n,index:i}=e;const s=Un(t,n,r),o=t[i],a=s[i];return a&&o?{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}:null},$n={scaleX:1,scaleY:1},qn=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:i,rects:s,overIndex:o}=e;const a=null!=(t=s[r])?t:n;if(!a)return null;if(i===r){const e=s[o];return e?{x:0,y:r<o?e.top+e.height-(a.top+a.height):e.top-a.top,...$n}:null}const l=function(e,t,r){const n=e[t],i=e[t-1],s=e[t+1];if(!n)return 0;if(r<t)return i?n.top-(i.top+i.height):s?s.top-(n.top+n.height):0;return s?s.top-(n.top+n.height):i?n.top-(i.top+i.height):0}(s,i,r);return i>r&&i<=o?{x:0,y:-a.height-l,...$n}:i<r&&i>=o?{x:0,y:a.height+l,...$n}:{x:0,y:0,...$n}};const Wn="Sortable",Hn=n.createContext({activeIndex:-1,containerId:Wn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Gn,disabled:{draggable:!1,droppable:!1}});function Zn(e){let{children:t,id:r,items:i,strategy:l=Gn,disabled:u=!1}=e;const{active:c,dragOverlay:h,droppableRects:d,over:p,measureDroppableContainers:m}=f(Rn),_=Xt(Wn,r),g=Boolean(null!==h.rect),y=a(()=>i.map(e=>"object"==typeof e&&"id"in e?e.id:e),[i]),v=null!=c,b=c?y.indexOf(c.id):-1,x=p?y.indexOf(p.id):-1,w=o(y),A=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}(y,w.current),E=-1!==x&&-1===b||A,T=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(u);Gt(()=>{A&&v&&m(y)},[A,y,v,m]),s(()=>{w.current=y},[y]);const S=a(()=>({activeIndex:b,containerId:_,disabled:T,disableTransforms:E,items:y,overIndex:x,useDragOverlay:g,sortedRects:Bn(y,d),strategy:l}),[b,_,T.draggable,T.droppable,E,y,x,d,g,l]);return n.createElement(Hn.Provider,{value:S},t)}const Kn=e=>{let{id:t,items:r,activeIndex:n,overIndex:i}=e;return Un(r,n,i).indexOf(t)},Xn=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:i,items:s,newIndex:o,previousItems:a,previousContainerId:l,transition:u}=e;return!(!u||!n)&&((a===s||i!==o)&&(!!r||o!==i&&t===l))},Yn={duration:200,easing:"ease"},Qn="transform",Jn=rr.Transition.toString({property:Qn,duration:0,easing:"linear"}),ei={roleDescription:"sortable"};function ti(e){let{animateLayoutChanges:t=Xn,attributes:r,disabled:n,data:i,getNewIndex:c=Kn,id:h,strategy:d,resizeObserverConfig:p,transition:m=Yn}=e;const{items:_,containerId:g,activeIndex:y,disabled:v,disableTransforms:b,sortedRects:x,overIndex:w,useDragOverlay:A,strategy:E}=f(Hn),T=function(e,t){var r,n;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(r=null==e?void 0:e.draggable)?r:t.draggable,droppable:null!=(n=null==e?void 0:e.droppable)?n:t.droppable}}(n,v),S=_.indexOf(h),k=a(()=>({sortable:{containerId:g,index:S,items:_},...i}),[g,i,S,_]),O=a(()=>_.slice(_.indexOf(h)),[_,h]),{rect:R,node:C,isOver:N,setNodeRef:P}=function(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:i}=e;const a=Xt("Droppable"),{active:u,dispatch:c,over:h,measureDroppableContainers:d}=f(On),p=o({disabled:r}),m=o(!1),_=o(null),g=o(null),{disabled:y,updateMeasurementsFor:v,timeout:b}={...jn,...i},x=qt(null!=v?v:n),w=mn({callback:l(()=>{m.current?(null!=g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{d(Array.isArray(x.current)?x.current:[x.current]),g.current=null},b)):m.current=!0},[b]),disabled:y||!u}),A=l((e,t)=>{w&&(t&&(w.unobserve(t),m.current=!1),e&&w.observe(e))},[w]),[E,T]=Ht(A),S=qt(t);return s(()=>{w&&E.current&&(w.disconnect(),m.current=!1,w.observe(E.current))},[E,w]),s(()=>(c({type:dr.RegisterDroppable,element:{id:n,key:a,disabled:r,node:E,rect:_,data:S}}),()=>c({type:dr.UnregisterDroppable,key:a,id:n})),[n]),s(()=>{r!==p.current.disabled&&(c({type:dr.SetDroppableDisabled,id:n,key:a,disabled:r}),p.current.disabled=r)},[n,a,r,c]),{active:u,rect:_,isOver:(null==h?void 0:h.id)===n,node:E,over:h,setNodeRef:T}}({id:h,data:k,disabled:T.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...p}}),{active:M,activatorEvent:D,activeNodeRect:z,attributes:I,setNodeRef:F,listeners:L,isDragging:j,over:U,setActivatorNodeRef:B,transform:V}=Ln({id:h,data:k,attributes:{...ei,...r},disabled:T.draggable}),G=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return a(()=>e=>{t.forEach(t=>t(e))},t)}(P,F),$=Boolean(M),q=$&&!b&&Vn(y)&&Vn(w),W=!A&&j,H=W&&q?V:null,Z=q?null!=H?H:(null!=d?d:E)({rects:x,activeNodeRect:z,activeIndex:y,overIndex:w,index:S}):null,K=Vn(y)&&Vn(w)?c({id:h,items:_,activeIndex:y,overIndex:w}):S,X=null==M?void 0:M.id,Y=o({activeId:X,items:_,newIndex:K,containerId:g}),Q=_!==Y.current.items,J=t({active:M,containerId:g,isDragging:j,isSorting:$,id:h,index:S,items:_,newIndex:Y.current.newIndex,previousItems:Y.current.items,previousContainerId:Y.current.containerId,transition:m,wasDragging:null!=Y.current.activeId}),ee=function(e){let{disabled:t,index:r,node:n,rect:i}=e;const[a,l]=u(null),c=o(r);return Gt(()=>{if(!t&&r!==c.current&&n.current){const e=i.current;if(e){const t=Sr(n.current,{ignoreTransform:!0}),r={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(r.x||r.y)&&l(r)}}r!==c.current&&(c.current=r)},[t,r,n,i]),s(()=>{a&&l(null)},[a]),a}({disabled:!J,index:S,node:C,rect:R});return s(()=>{$&&Y.current.newIndex!==K&&(Y.current.newIndex=K),g!==Y.current.containerId&&(Y.current.containerId=g),_!==Y.current.items&&(Y.current.items=_)},[$,K,g,_]),s(()=>{if(X===Y.current.activeId)return;if(null!=X&&null==Y.current.activeId)return void(Y.current.activeId=X);const e=setTimeout(()=>{Y.current.activeId=X},50);return()=>clearTimeout(e)},[X]),{active:M,activeIndex:y,attributes:I,data:k,rect:R,index:S,newIndex:K,items:_,isOver:N,isSorting:$,isDragging:j,listeners:L,node:C,overIndex:w,over:U,setNodeRef:G,setActivatorNodeRef:B,setDroppableNodeRef:P,setDraggableNodeRef:F,transform:null!=ee?ee:Z,transition:function(){if(ee||Q&&Y.current.newIndex===S)return Jn;if(W&&!er(D)||!m)return;if($||J)return rr.Transition.toString({...m,property:Qn});return}()}}Wr.Down,Wr.Right,Wr.Up,Wr.Left;const ri=({id:t,sx:r,children:n})=>{const{isDragging:i}=Ln({id:t}),{attributes:s,listeners:o,setNodeRef:a,transform:l,transition:u}=ti({id:t,strategy:qn,transition:{duration:300,easing:"cubic-bezier(0.25, 1, 0.5, 1)"}}),c={...r?.default,...i?r?.dragging:{},transform:rr.Translate.toString(l),transition:u,cursor:"pointer"};return e(x,{ref:a,style:c,...o,...s,children:n})};function ni({items:t,getItem:r,getId:n,onDragEnd:i,sx:s,title:o,draggableSx:l}){const u=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return a(()=>[...t].filter(e=>null!=e),[...t])}(a(()=>({sensor:c,options:null!=h?h:{}}),[c=rn,h={activationConstraint:{distance:8}}]));var c,h;return e(zn,{sensors:u,collisionDetection:vr,onDragEnd:e=>{const{active:r,over:s}=e,o=t.findIndex(e=>n(e)===r.id),a=t.findIndex(e=>n(e)===s?.id),l=Un(t,o,a);i(l)},children:e(Zn,{items:t.map(n),strategy:qn,children:e(Q,{items:t,sx:s,title:o,getKey:n,getContent:(t,i)=>{const s=n(t);return e(ri,{id:s,sx:l,children:r(t,i)},s)}})})})}const ii=c(null);function si(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function oi(){return function(){const e=p(ii);if(null==e)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return e}().map}function ai(e,t){return function(){return e.apply(t,arguments)}}const{toString:li}=Object.prototype,{getPrototypeOf:ui}=Object,{iterator:ci,toStringTag:hi}=Symbol,di=(fi=Object.create(null),e=>{const t=li.call(e);return fi[t]||(fi[t]=t.slice(8,-1).toLowerCase())});var fi;const pi=e=>(e=e.toLowerCase(),t=>di(t)===e),mi=e=>t=>typeof t===e,{isArray:_i}=Array,gi=mi("undefined");function yi(e){return null!==e&&!gi(e)&&null!==e.constructor&&!gi(e.constructor)&&xi(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const vi=pi("ArrayBuffer");const bi=mi("string"),xi=mi("function"),wi=mi("number"),Ai=e=>null!==e&&"object"==typeof e,Ei=e=>{if("object"!==di(e))return!1;const t=ui(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||hi in e||ci in e)},Ti=pi("Date"),Si=pi("File"),ki=pi("Blob"),Oi=pi("FileList"),Ri=pi("URLSearchParams"),[Ci,Ni,Pi,Mi]=["ReadableStream","Request","Response","Headers"].map(pi);function Di(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),_i(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(yi(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),s=i.length;let o;for(n=0;n<s;n++)o=i[n],t.call(null,e[o],o,e)}}function zi(e,t){if(yi(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const Ii="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Fi=e=>!gi(e)&&e!==Ii;const Li=(ji="undefined"!=typeof Uint8Array&&ui(Uint8Array),e=>ji&&e instanceof ji);var ji;const Ui=pi("HTMLFormElement"),Bi=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Vi=pi("RegExp"),Gi=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Di(r,(r,i)=>{let s;!1!==(s=t(r,i,e))&&(n[i]=s||r)}),Object.defineProperties(e,n)};const $i=pi("AsyncFunction"),qi=(Wi="function"==typeof setImmediate,Hi=xi(Ii.postMessage),Wi?setImmediate:Hi?(Zi=`axios@${Math.random()}`,Ki=[],Ii.addEventListener("message",({source:e,data:t})=>{e===Ii&&t===Zi&&Ki.length&&Ki.shift()()},!1),e=>{Ki.push(e),Ii.postMessage(Zi,"*")}):e=>setTimeout(e));var Wi,Hi,Zi,Ki;const Xi="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Ii):"undefined"!=typeof process&&process.nextTick||qi;var Yi={isArray:_i,isArrayBuffer:vi,isBuffer:yi,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||xi(e.append)&&("formdata"===(t=di(e))||"object"===t&&xi(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&vi(e.buffer),t},isString:bi,isNumber:wi,isBoolean:e=>!0===e||!1===e,isObject:Ai,isPlainObject:Ei,isEmptyObject:e=>{if(!Ai(e)||yi(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Ci,isRequest:Ni,isResponse:Pi,isHeaders:Mi,isUndefined:gi,isDate:Ti,isFile:Si,isBlob:ki,isRegExp:Vi,isFunction:xi,isStream:e=>Ai(e)&&xi(e.pipe),isURLSearchParams:Ri,isTypedArray:Li,isFileList:Oi,forEach:Di,merge:function e(){const{caseless:t,skipUndefined:r}=Fi(this)&&this||{},n={},i=(i,s)=>{const o=t&&zi(n,s)||s;Ei(n[o])&&Ei(i)?n[o]=e(n[o],i):Ei(i)?n[o]=e({},i):_i(i)?n[o]=i.slice():r&&gi(i)||(n[o]=i)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Di(arguments[e],i);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(Di(t,(t,n)=>{r&&xi(t)?e[n]=ai(t,r):e[n]=t},{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let i,s,o;const a={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)o=i[s],n&&!n(o,e,t)||a[o]||(t[o]=e[o],a[o]=!0);e=!1!==r&&ui(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:di,kindOfTest:pi,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(_i(e))return e;let t=e.length;if(!wi(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[ci]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:Ui,hasOwnProperty:Bi,hasOwnProp:Bi,reduceDescriptors:Gi,freezeMethods:e=>{Gi(e,(t,r)=>{if(xi(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];xi(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach(e=>{r[e]=!0})};return _i(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:zi,global:Ii,isContextDefined:Fi,isSpecCompliantForm:function(e){return!!(e&&xi(e.append)&&"FormData"===e[hi]&&e[ci])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(Ai(e)){if(t.indexOf(e)>=0)return;if(yi(e))return e;if(!("toJSON"in e)){t[n]=e;const i=_i(e)?[]:{};return Di(e,(e,t)=>{const s=r(e,n+1);!gi(s)&&(i[t]=s)}),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:$i,isThenable:e=>e&&(Ai(e)||xi(e))&&xi(e.then)&&xi(e.catch),setImmediate:qi,asap:Xi,isIterable:e=>null!=e&&xi(e[ci])};function Qi(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Yi.inherits(Qi,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Yi.toJSONObject(this.config),code:this.code,status:this.status}}});const Ji=Qi.prototype,es={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{es[e]={value:e}}),Object.defineProperties(Qi,es),Object.defineProperty(Ji,"isAxiosError",{value:!0}),Qi.from=(e,t,r,n,i,s)=>{const o=Object.create(Ji);Yi.toFlatObject(e,o,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",l=null==t&&e?e.code:t;return Qi.call(o,a,l,r,n,i),e&&null==o.cause&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",s&&Object.assign(o,s),o};function ts(e){return Yi.isPlainObject(e)||Yi.isArray(e)}function rs(e){return Yi.endsWith(e,"[]")?e.slice(0,-2):e}function ns(e,t,r){return e?e.concat(t).map(function(e,t){return e=rs(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const is=Yi.toFlatObject(Yi,{},null,function(e){return/^is[A-Z]/.test(e)});function ss(e,t,r){if(!Yi.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=Yi.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Yi.isUndefined(t[e])})).metaTokens,i=r.visitor||u,s=r.dots,o=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Yi.isSpecCompliantForm(t);if(!Yi.isFunction(i))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(Yi.isDate(e))return e.toISOString();if(Yi.isBoolean(e))return e.toString();if(!a&&Yi.isBlob(e))throw new Qi("Blob is not supported. Use a Buffer instead.");return Yi.isArrayBuffer(e)||Yi.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,i){let a=e;if(e&&!i&&"object"==typeof e)if(Yi.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(Yi.isArray(e)&&function(e){return Yi.isArray(e)&&!e.some(ts)}(e)||(Yi.isFileList(e)||Yi.endsWith(r,"[]"))&&(a=Yi.toArray(e)))return r=rs(r),a.forEach(function(e,n){!Yi.isUndefined(e)&&null!==e&&t.append(!0===o?ns([r],n,s):null===o?r:r+"[]",l(e))}),!1;return!!ts(e)||(t.append(ns(i,r,s),l(e)),!1)}const c=[],h=Object.assign(is,{defaultVisitor:u,convertValue:l,isVisitable:ts});if(!Yi.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!Yi.isUndefined(r)){if(-1!==c.indexOf(r))throw Error("Circular reference detected in "+n.join("."));c.push(r),Yi.forEach(r,function(r,s){!0===(!(Yi.isUndefined(r)||null===r)&&i.call(t,r,Yi.isString(s)?s.trim():s,n,h))&&e(r,n?n.concat(s):[s])}),c.pop()}}(e),t}function os(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function as(e,t){this._pairs=[],e&&ss(e,this,t)}const ls=as.prototype;function us(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function cs(e,t,r){if(!t)return e;const n=r&&r.encode||us;Yi.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(s=i?i(t,r):Yi.isURLSearchParams(t)?t.toString():new as(t,r).toString(n),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}ls.append=function(e,t){this._pairs.push([e,t])},ls.toString=function(e){const t=e?function(t){return e.call(this,t,os)}:os;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class hs{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Yi.forEach(this.handlers,function(t){null!==t&&e(t)})}}var ds={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},fs={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:as,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ps="undefined"!=typeof window&&"undefined"!=typeof document,ms="object"==typeof navigator&&navigator||void 0,_s=ps&&(!ms||["ReactNative","NativeScript","NS"].indexOf(ms.product)<0),gs="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ys=ps&&window.location.href||"http://localhost";var vs={...Object.freeze({__proto__:null,hasBrowserEnv:ps,hasStandardBrowserEnv:_s,hasStandardBrowserWebWorkerEnv:gs,navigator:ms,origin:ys}),...fs};function bs(e){function t(e,r,n,i){let s=e[i++];if("__proto__"===s)return!0;const o=Number.isFinite(+s),a=i>=e.length;if(s=!s&&Yi.isArray(n)?n.length:s,a)return Yi.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!o;n[s]&&Yi.isObject(n[s])||(n[s]=[]);return t(e,r,n[s],i)&&Yi.isArray(n[s])&&(n[s]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let s;for(n=0;n<i;n++)s=r[n],t[s]=e[s];return t}(n[s])),!o}if(Yi.isFormData(e)&&Yi.isFunction(e.entries)){const r={};return Yi.forEachEntry(e,(e,n)=>{t(function(e){return Yi.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const xs={transitional:ds,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=Yi.isObject(e);i&&Yi.isHTMLForm(e)&&(e=new FormData(e));if(Yi.isFormData(e))return n?JSON.stringify(bs(e)):e;if(Yi.isArrayBuffer(e)||Yi.isBuffer(e)||Yi.isStream(e)||Yi.isFile(e)||Yi.isBlob(e)||Yi.isReadableStream(e))return e;if(Yi.isArrayBufferView(e))return e.buffer;if(Yi.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ss(e,new vs.classes.URLSearchParams,{visitor:function(e,t,r,n){return vs.isNode&&Yi.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((s=Yi.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ss(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(Yi.isString(e))try{return(t||JSON.parse)(e),Yi.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||xs.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(Yi.isResponse(e)||Yi.isReadableStream(e))return e;if(e&&Yi.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e,this.parseReviver)}catch(e){if(r){if("SyntaxError"===e.name)throw Qi.from(e,Qi.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:vs.classes.FormData,Blob:vs.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Yi.forEach(["delete","get","head","post","put","patch"],e=>{xs.headers[e]={}});const ws=Yi.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const As=Symbol("internals");function Es(e){return e&&String(e).trim().toLowerCase()}function Ts(e){return!1===e||null==e?e:Yi.isArray(e)?e.map(Ts):String(e)}function Ss(e,t,r,n,i){return Yi.isFunction(n)?n.call(this,t,r):(i&&(t=r),Yi.isString(t)?Yi.isString(n)?-1!==t.indexOf(n):Yi.isRegExp(n)?n.test(t):void 0:void 0)}let ks=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=Es(t);if(!i)throw new Error("header name must be a non-empty string");const s=Yi.findKey(n,i);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||t]=Ts(e))}const s=(e,t)=>Yi.forEach(e,(e,r)=>i(e,r,t));if(Yi.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(Yi.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach(function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&ws[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t})(e),t);else if(Yi.isObject(e)&&Yi.isIterable(e)){let r,n,i={};for(const t of e){if(!Yi.isArray(t))throw TypeError("Object iterator must return a key-value pair");i[n=t[0]]=(r=i[n])?Yi.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}s(i,t)}else null!=e&&i(t,e,r);return this}get(e,t){if(e=Es(e)){const r=Yi.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(Yi.isFunction(t))return t.call(this,e,r);if(Yi.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Es(e)){const r=Yi.findKey(this,e);return!(!r||void 0===this[r]||t&&!Ss(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=Es(e)){const i=Yi.findKey(r,e);!i||t&&!Ss(0,r[i],i,t)||(delete r[i],n=!0)}}return Yi.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!Ss(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return Yi.forEach(this,(n,i)=>{const s=Yi.findKey(r,i);if(s)return t[s]=Ts(n),void delete t[i];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(i):String(i).trim();o!==i&&delete t[i],t[o]=Ts(n),r[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Yi.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&Yi.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){const t=(this[As]=this[As]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Es(e);t[n]||(!function(e,t){const r=Yi.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})})}(r,e),t[n]=!0)}return Yi.isArray(e)?e.forEach(n):n(e),this}};function Os(e,t){const r=this||xs,n=t||r,i=ks.from(n.headers);let s=n.data;return Yi.forEach(e,function(e){s=e.call(r,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function Rs(e){return!(!e||!e.__CANCEL__)}function Cs(e,t,r){Qi.call(this,null==e?"canceled":e,Qi.ERR_CANCELED,t,r),this.name="CanceledError"}function Ns(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new Qi("Request failed with status code "+r.status,[Qi.ERR_BAD_REQUEST,Qi.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}ks.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Yi.reduceDescriptors(ks.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),Yi.freezeMethods(ks),Yi.inherits(Cs,Qi,{__CANCEL__:!0});const Ps=(e,t,r=3)=>{let n=0;const i=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,s=0,o=0;return t=void 0!==t?t:1e3,function(a){const l=Date.now(),u=n[o];i||(i=l),r[s]=a,n[s]=l;let c=o,h=0;for(;c!==s;)h+=r[c++],c%=e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),l-i<t)return;const d=u&&l-u;return d?Math.round(1e3*h/d):void 0}}(50,250);return function(e,t){let r,n,i=0,s=1e3/t;const o=(t,s=Date.now())=>{i=s,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-i;a>=s?o(e,t):(r=e,n||(n=setTimeout(()=>{n=null,o(r)},s-a)))},()=>r&&o(r)]}(r=>{const s=r.loaded,o=r.lengthComputable?r.total:void 0,a=s-n,l=i(a);n=s;e({loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:l||void 0,estimated:l&&o&&s<=o?(o-s)/l:void 0,event:r,lengthComputable:null!=o,[t?"download":"upload"]:!0})},r)},Ms=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Ds=e=>(...t)=>Yi.asap(()=>e(...t));var zs=vs.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,vs.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(vs.origin),vs.navigator&&/(msie|trident)/i.test(vs.navigator.userAgent)):()=>!0,Is=vs.hasStandardBrowserEnv?{write(e,t,r,n,i,s,o){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];Yi.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),Yi.isString(n)&&a.push(`path=${n}`),Yi.isString(i)&&a.push(`domain=${i}`),!0===s&&a.push("secure"),Yi.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function Fs(e,t,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Ls=e=>e instanceof ks?{...e}:e;function js(e,t){t=t||{};const r={};function n(e,t,r,n){return Yi.isPlainObject(e)&&Yi.isPlainObject(t)?Yi.merge.call({caseless:n},e,t):Yi.isPlainObject(t)?Yi.merge({},t):Yi.isArray(t)?t.slice():t}function i(e,t,r,i){return Yi.isUndefined(t)?Yi.isUndefined(e)?void 0:n(void 0,e,0,i):n(e,t,0,i)}function s(e,t){if(!Yi.isUndefined(t))return n(void 0,t)}function o(e,t){return Yi.isUndefined(t)?Yi.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,i,s){return s in t?n(r,i):s in e?n(void 0,r):void 0}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(e,t,r)=>i(Ls(e),Ls(t),0,!0)};return Yi.forEach(Object.keys({...e,...t}),function(n){const s=l[n]||i,o=s(e[n],t[n],n);Yi.isUndefined(o)&&s!==a||(r[n]=o)}),r}var Us=e=>{const t=js({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=t;if(t.headers=o=ks.from(o),t.url=cs(Fs(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),Yi.isFormData(r))if(vs.hasStandardBrowserEnv||vs.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(Yi.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&o.set(e,r)})}if(vs.hasStandardBrowserEnv&&(n&&Yi.isFunction(n)&&(n=n(t)),n||!1!==n&&zs(t.url))){const e=i&&s&&Is.read(s);e&&o.set(i,e)}return t};var Bs="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=Us(e);let i=n.data;const s=ks.from(n.headers).normalize();let o,a,l,u,c,{responseType:h,onUploadProgress:d,onDownloadProgress:f}=n;function p(){u&&u(),c&&c(),n.cancelToken&&n.cancelToken.unsubscribe(o),n.signal&&n.signal.removeEventListener("abort",o)}let m=new XMLHttpRequest;function _(){if(!m)return;const n=ks.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Ns(function(e){t(e),p()},function(e){r(e),p()},{data:h&&"text"!==h&&"json"!==h?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:n,config:e,request:m}),m=null}m.open(n.method.toUpperCase(),n.url,!0),m.timeout=n.timeout,"onloadend"in m?m.onloadend=_:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(_)},m.onabort=function(){m&&(r(new Qi("Request aborted",Qi.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const n=new Qi(t&&t.message?t.message:"Network Error",Qi.ERR_NETWORK,e,m);n.event=t||null,r(n),m=null},m.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const i=n.transitional||ds;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new Qi(t,i.clarifyTimeoutError?Qi.ETIMEDOUT:Qi.ECONNABORTED,e,m)),m=null},void 0===i&&s.setContentType(null),"setRequestHeader"in m&&Yi.forEach(s.toJSON(),function(e,t){m.setRequestHeader(t,e)}),Yi.isUndefined(n.withCredentials)||(m.withCredentials=!!n.withCredentials),h&&"json"!==h&&(m.responseType=n.responseType),f&&([l,c]=Ps(f,!0),m.addEventListener("progress",l)),d&&m.upload&&([a,u]=Ps(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(n.cancelToken||n.signal)&&(o=t=>{m&&(r(!t||t.type?new Cs(null,e,m):t),m.abort(),m=null)},n.cancelToken&&n.cancelToken.subscribe(o),n.signal&&(n.signal.aborted?o():n.signal.addEventListener("abort",o)));const g=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);g&&-1===vs.protocols.indexOf(g)?r(new Qi("Unsupported protocol "+g+":",Qi.ERR_BAD_REQUEST,e)):m.send(i||null)})};const Vs=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const i=function(e){if(!r){r=!0,o();const t=e instanceof Error?e:this.reason;n.abort(t instanceof Qi?t:new Cs(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,i(new Qi(`timeout ${t} of ms exceeded`,Qi.ETIMEDOUT))},t);const o=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener("abort",i)}),e=null)};e.forEach(e=>e.addEventListener("abort",i));const{signal:a}=n;return a.unsubscribe=()=>Yi.asap(o),a}},Gs=function*(e,t){let r=e.byteLength;if(r<t)return void(yield e);let n,i=0;for(;i<r;)n=i+t,yield e.slice(i,n),i=n},$s=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},qs=(e,t,r,n)=>{const i=async function*(e,t){for await(const r of $s(e))yield*Gs(r,t)}(e,t);let s,o=0,a=e=>{s||(s=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await i.next();if(t)return a(),void e.close();let s=n.byteLength;if(r){let e=o+=s;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw a(e),e}},cancel:e=>(a(e),i.return())},{highWaterMark:2})},{isFunction:Ws}=Yi,Hs=(({Request:e,Response:t})=>({Request:e,Response:t}))(Yi.global),{ReadableStream:Zs,TextEncoder:Ks}=Yi.global,Xs=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Ys=e=>{e=Yi.merge.call({skipUndefined:!0},Hs,e);const{fetch:t,Request:r,Response:n}=e,i=t?Ws(t):"function"==typeof fetch,s=Ws(r),o=Ws(n);if(!i)return!1;const a=i&&Ws(Zs),l=i&&("function"==typeof Ks?(u=new Ks,e=>u.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var u;const c=s&&a&&Xs(()=>{let e=!1;const t=new r(vs.origin,{body:new Zs,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),h=o&&a&&Xs(()=>Yi.isReadableStream(new n("").body)),d={stream:h&&(e=>e.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!d[e]&&(d[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new Qi(`Response type '${e}' is not supported`,Qi.ERR_NOT_SUPPORT,r)})});const f=async(e,t)=>{const n=Yi.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(Yi.isBlob(e))return e.size;if(Yi.isSpecCompliantForm(e)){const t=new r(vs.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Yi.isArrayBufferView(e)||Yi.isArrayBuffer(e)?e.byteLength:(Yi.isURLSearchParams(e)&&(e+=""),Yi.isString(e)?(await l(e)).byteLength:void 0)})(t):n};return async e=>{let{url:i,method:o,data:a,signal:l,cancelToken:u,timeout:p,onDownloadProgress:m,onUploadProgress:_,responseType:g,headers:y,withCredentials:v="same-origin",fetchOptions:b}=Us(e),x=t||fetch;g=g?(g+"").toLowerCase():"text";let w=Vs([l,u&&u.toAbortSignal()],p),A=null;const E=w&&w.unsubscribe&&(()=>{w.unsubscribe()});let T;try{if(_&&c&&"get"!==o&&"head"!==o&&0!==(T=await f(y,a))){let e,t=new r(i,{method:"POST",body:a,duplex:"half"});if(Yi.isFormData(a)&&(e=t.headers.get("content-type"))&&y.setContentType(e),t.body){const[e,r]=Ms(T,Ps(Ds(_)));a=qs(t.body,65536,e,r)}}Yi.isString(v)||(v=v?"include":"omit");const t=s&&"credentials"in r.prototype,l={...b,signal:w,method:o.toUpperCase(),headers:y.normalize().toJSON(),body:a,duplex:"half",credentials:t?v:void 0};A=s&&new r(i,l);let u=await(s?x(A,b):x(i,l));const p=h&&("stream"===g||"response"===g);if(h&&(m||p&&E)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=u[t]});const t=Yi.toFiniteNumber(u.headers.get("content-length")),[r,i]=m&&Ms(t,Ps(Ds(m),!0))||[];u=new n(qs(u.body,65536,r,()=>{i&&i(),E&&E()}),e)}g=g||"text";let S=await d[Yi.findKey(d,g)||"text"](u,e);return!p&&E&&E(),await new Promise((t,r)=>{Ns(t,r,{data:S,headers:ks.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:A})})}catch(t){if(E&&E(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Qi("Network Error",Qi.ERR_NETWORK,e,A),{cause:t.cause||t});throw Qi.from(t,t&&t.code,e,A)}}},Qs=new Map,Js=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:i}=t,s=[n,i,r];let o,a,l=s.length,u=Qs;for(;l--;)o=s[l],a=u.get(o),void 0===a&&u.set(o,a=l?new Map:Ys(t)),u=a;return a};Js();const eo={http:null,xhr:Bs,fetch:{get:Js}};Yi.forEach(eo,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const to=e=>`- ${e}`,ro=e=>Yi.isFunction(e)||null===e||!1===e;var no={getAdapter:function(e,t){e=Yi.isArray(e)?e:[e];const{length:r}=e;let n,i;const s={};for(let o=0;o<r;o++){let r;if(n=e[o],i=n,!ro(n)&&(i=eo[(r=String(n)).toLowerCase()],void 0===i))throw new Qi(`Unknown adapter '${r}'`);if(i&&(Yi.isFunction(i)||(i=i.get(t))))break;s[r||"#"+o]=i}if(!i){const e=Object.entries(s).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new Qi("There is no suitable adapter to dispatch the request "+(r?e.length>1?"since :\n"+e.map(to).join("\n"):" "+to(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return i},adapters:eo};function io(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Cs(null,e)}function so(e){io(e),e.headers=ks.from(e.headers),e.data=Os.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return no.getAdapter(e.adapter||xs.adapter,e)(e).then(function(t){return io(e),t.data=Os.call(e,e.transformResponse,t),t.headers=ks.from(t.headers),t},function(t){return Rs(t)||(io(e),t&&t.response&&(t.response.data=Os.call(e,e.transformResponse,t.response),t.response.headers=ks.from(t.response.headers))),Promise.reject(t)})}const oo="1.13.2",ao={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ao[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const lo={};ao.transitional=function(e,t,r){function n(e,t){return"[Axios v"+oo+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,s)=>{if(!1===e)throw new Qi(n(i," has been removed"+(t?" in "+t:"")),Qi.ERR_DEPRECATED);return t&&!lo[i]&&(lo[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,s)}},ao.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var uo={assertOptions:function(e,t,r){if("object"!=typeof e)throw new Qi("options must be an object",Qi.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const s=n[i],o=t[s];if(o){const t=e[s],r=void 0===t||o(t,s,e);if(!0!==r)throw new Qi("option "+s+" must be "+r,Qi.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new Qi("Unknown option "+s,Qi.ERR_BAD_OPTION)}},validators:ao};const co=uo.validators;let ho=class{constructor(e){this.defaults=e||{},this.interceptors={request:new hs,response:new hs}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=js(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;void 0!==r&&uo.assertOptions(r,{silentJSONParsing:co.transitional(co.boolean),forcedJSONParsing:co.transitional(co.boolean),clarifyTimeoutError:co.transitional(co.boolean)},!1),null!=n&&(Yi.isFunction(n)?t.paramsSerializer={serialize:n}:uo.assertOptions(n,{encode:co.function,serialize:co.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),uo.assertOptions(t,{baseUrl:co.spelling("baseURL"),withXsrfToken:co.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=i&&Yi.merge(i.common,i[t.method]);i&&Yi.forEach(["delete","get","head","post","put","patch","common"],e=>{delete i[e]}),t.headers=ks.concat(s,i);const o=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,o.unshift(e.fulfilled,e.rejected))});const l=[];let u;this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let c,h=0;if(!a){const e=[so.bind(this),void 0];for(e.unshift(...o),e.push(...l),c=e.length,u=Promise.resolve(t);h<c;)u=u.then(e[h++],e[h++]);return u}c=o.length;let d=t;for(;h<c;){const e=o[h++],t=o[h++];try{d=e(d)}catch(e){t.call(this,e);break}}try{u=so.call(this,d)}catch(e){return Promise.reject(e)}for(h=0,c=l.length;h<c;)u=u.then(l[h++],l[h++]);return u}getUri(e){return cs(Fs((e=js(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};Yi.forEach(["delete","get","head","options"],function(e){ho.prototype[e]=function(t,r){return this.request(js(r||{},{method:e,url:t,data:(r||{}).data}))}}),Yi.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,i){return this.request(js(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}ho.prototype[e]=t(),ho.prototype[e+"Form"]=t(!0)});const fo={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(fo).forEach(([e,t])=>{fo[t]=e});const po=function e(t){const r=new ho(t),n=ai(ho.prototype.request,r);return Yi.extend(n,ho.prototype,r,{allOwnKeys:!0}),Yi.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(js(t,r))},n}(xs);po.Axios=ho,po.CanceledError=Cs,po.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t;const n=new Promise(e=>{r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,n,i){r.reason||(r.reason=new Cs(e,n,i),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;const r=new e(function(e){t=e});return{token:r,cancel:t}}},po.isCancel=Rs,po.VERSION=oo,po.toFormData=ss,po.AxiosError=Qi,po.Cancel=po.CanceledError,po.all=function(e){return Promise.all(e)},po.spread=function(e){return function(t){return e.apply(null,t)}},po.isAxiosError=function(e){return Yi.isObject(e)&&!0===e.isAxiosError},po.mergeConfig=js,po.AxiosHeaders=ks,po.formToJSON=e=>bs(Yi.isHTMLForm(e)?new FormData(e):e),po.getAdapter=no.getAdapter,po.HttpStatusCode=fo,po.default=po;const{Axios:mo,AxiosError:_o,CanceledError:go,isCancel:yo,CancelToken:vo,VERSION:bo,all:xo,Cancel:wo,isAxiosError:Ao,spread:Eo,toFormData:To,AxiosHeaders:So,HttpStatusCode:ko,formToJSON:Oo,getAdapter:Ro,mergeConfig:Co}=po;var No="production"!==process.env.NODE_ENV?{0:"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'",1:function(e,t){return"Cannot apply '"+e+"' to '"+t.toString()+"': Field not found."},5:"'keys()' can only be used on observable objects, arrays, sets and maps",6:"'values()' can only be used on observable objects, arrays, sets and maps",7:"'entries()' can only be used on observable objects, arrays and maps",8:"'set()' can only be used on observable objects, arrays and maps",9:"'remove()' can only be used on observable objects, arrays and maps",10:"'has()' can only be used on observable objects, arrays and maps",11:"'get()' can only be used on observable objects, arrays and maps",12:"Invalid annotation",13:"Dynamic observable objects cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",14:"Intercept handlers should return nothing or a change object",15:"Observable arrays cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",16:"Modification exception: the internal structure of an observable array was changed.",17:function(e,t){return"[mobx.array] Index out of bounds, "+e+" is larger than "+t},18:"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js",19:function(e){return"Cannot initialize from classes that inherit from Map: "+e.constructor.name},20:function(e){return"Cannot initialize map from "+e},21:function(e){return"Cannot convert to map from '"+e+"'"},22:"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js",23:"It is not possible to get index atoms from arrays",24:function(e){return"Cannot obtain administration from "+e},25:function(e,t){return"the entry '"+e+"' does not exist in the observable map '"+t+"'"},26:"please specify a property",27:function(e,t){return"no observable property '"+e.toString()+"' found on the observable object '"+t+"'"},28:function(e){return"Cannot obtain atom from "+e},29:"Expecting some object",30:"invalid action stack. did you forget to finish an action?",31:"missing option for computed: get",32:function(e,t){return"Cycle detected in computation "+e+": "+t},33:function(e){return"The setter of computed value '"+e+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"},34:function(e){return"[ComputedValue '"+e+"'] It is not possible to assign a new value to a computed value."},35:"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`",36:"isolateGlobalState should be called before MobX is running any reactions",37:function(e){return"[mobx] `observableArray."+e+"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice()."+e+"()` instead"},38:"'ownKeys()' can only be used on observable objects",39:"'defineProperty()' can only be used on observable objects"}:{};function Po(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if("production"!==process.env.NODE_ENV){var i="string"==typeof e?e:No[e];throw"function"==typeof i&&(i=i.apply(null,r)),new Error("[MobX] "+i)}throw new Error("number"==typeof e?"[MobX] minified error nr: "+e+(r.length?" "+r.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var Mo={};function Do(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:Mo}var zo=Object.assign,Io=Object.getOwnPropertyDescriptor,Fo=Object.defineProperty,Lo=Object.prototype,jo=[];Object.freeze(jo);var Uo={};Object.freeze(Uo);var Bo="undefined"!=typeof Proxy,Vo=Object.toString();function Go(){Bo||Po("production"!==process.env.NODE_ENV?"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`":"Proxy not available")}function $o(e){"production"!==process.env.NODE_ENV&&Hl.verifyProxies&&Po("MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to "+e)}function qo(){return++Hl.mobxGuid}function Wo(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Ho=function(){};function Zo(e){return"function"==typeof e}function Ko(e){switch(typeof e){case"string":case"symbol":case"number":return!0}return!1}function Xo(e){return null!==e&&"object"==typeof e}function Yo(e){if(!Xo(e))return!1;var t=Object.getPrototypeOf(e);if(null==t)return!0;var r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r.toString()===Vo}function Qo(e){var t=null==e?void 0:e.constructor;return!!t&&("GeneratorFunction"===t.name||"GeneratorFunction"===t.displayName)}function Jo(e,t,r){Fo(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function ea(e,t,r){Fo(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function ta(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(e){return Xo(e)&&!0===e[r]}}function ra(e){return null!=e&&"[object Map]"===Object.prototype.toString.call(e)}function na(e){return null!=e&&"[object Set]"===Object.prototype.toString.call(e)}var ia=void 0!==Object.getOwnPropertySymbols;var sa="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:ia?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function oa(e){return"string"==typeof e?e:"symbol"==typeof e?e.toString():new String(e).toString()}function aa(e){return null===e?null:"object"==typeof e?""+e:e}function la(e,t){return Lo.hasOwnProperty.call(e,t)}var ua=Object.getOwnPropertyDescriptors||function(e){var t={};return sa(e).forEach(function(r){t[r]=Io(e,r)}),t};function ca(e,t){return!!(e&t)}function ha(e,t,r){return r?e|=t:e&=~t,e}function da(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function fa(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ya(n.key),n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function pa(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return da(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?da(e,t):void 0}}(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ma(){return ma=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ma.apply(null,arguments)}function _a(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ga(e,t)}function ga(e,t){return ga=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ga(e,t)}function ya(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}var va=Symbol("mobx-stored-annotations");function ba(e){return Object.assign(function(t,r){if(wa(r))return e.decorate_20223_(t,r);xa(t,r,e)},e)}function xa(e,t,r){(la(e,va)||Jo(e,va,ma({},e[va])),"production"!==process.env.NODE_ENV&&Pa(r)&&!la(e[va],t))&&Po("'"+(e.constructor.name+".prototype."+t.toString())+"' is decorated with 'override', but no such decorated member was found on prototype.");!function(e,t,r){if("production"!==process.env.NODE_ENV&&!Pa(t)&&la(e[va],r)){var n=e.constructor.name+".prototype."+r.toString(),i=e[va][r].annotationType_;Po("Cannot apply '@"+t.annotationType_+"' to '"+n+"':\nThe field is already decorated with '@"+i+"'.\nRe-decorating fields is not allowed.\nUse '@override' decorator for methods overridden by subclass.")}}(e,r,t),Pa(r)||(e[va][t]=r)}function wa(e){return"object"==typeof e&&"string"==typeof e.kind}function Aa(e,t){"production"===process.env.NODE_ENV||t.includes(e.kind)||Po("The decorator applied to '"+String(e.name)+"' cannot be used on a "+e.kind+" element")}var Ea=Symbol("mobx administration"),Ta=function(){function e(e){void 0===e&&(e="production"!==process.env.NODE_ENV?"Atom@"+qo():"Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=Rl.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.reportObserved=function(){return Jl(this)},t.reportChanged=function(){Yl(),eu(this),Ql()},t.toString=function(){return this.name_},fa(e,[{key:"isBeingObserved",get:function(){return ca(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=ha(this.flags_,e.isBeingObservedMask_,t)}},{key:"isPendingUnobservation",get:function(){return ca(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=ha(this.flags_,e.isPendingUnobservationMask_,t)}},{key:"diffValue",get:function(){return ca(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=ha(this.flags_,e.diffValueMask_,1===t)}}])}();Ta.isBeingObservedMask_=1,Ta.isPendingUnobservationMask_=2,Ta.diffValueMask_=4;var Sa=ta("Atom",Ta);function ka(e,t,r){void 0===t&&(t=Ho),void 0===r&&(r=Ho);var n,i=new Ta(e);return t!==Ho&&Ou(Tu,i,t,n),r!==Ho&&ku(i,r),i}var Oa={structural:function(e,t){return Hc(e,t)},default:function(e,t){return Object.is?Object.is(e,t):e===t?0!==e||1/e==1/t:e!=e&&t!=t}};function Ra(e,t,r){return Bu(e)?e:Array.isArray(e)?ml.array(e,{name:r}):Yo(e)?ml.object(e,void 0,{name:r}):ra(e)?ml.map(e,{name:r}):na(e)?ml.set(e,{name:r}):"function"!=typeof e||Au(e)||Uu(e)?e:Qo(e)?Lu(e):wu(r,e)}function Ca(e){return e}var Na="override";function Pa(e){return e.annotationType_===Na}function Ma(e,t){return{annotationType_:e,options_:t,make_:Da,extend_:za,decorate_20223_:Ia}}function Da(e,t,r,n){var i;if(null!=(i=this.options_)&&i.bound)return null===this.extend_(e,t,r,!1)?0:1;if(n===e.target_)return null===this.extend_(e,t,r,!1)?0:2;if(Au(r.value))return 1;var s=Fa(e,this,t,r,!1);return Fo(n,t,s),2}function za(e,t,r,n){var i=Fa(e,this,t,r);return e.defineProperty_(t,i,n)}function Ia(e,t){"production"!==process.env.NODE_ENV&&Aa(t,["method","field"]);var r,n=t.kind,i=t.name,s=t.addInitializer,o=this,a=function(e){var t,r,n,s;return El(null!=(t=null==(r=o.options_)?void 0:r.name)?t:i.toString(),e,null!=(n=null==(s=o.options_)?void 0:s.autoAction)&&n)};return"field"==n?function(e){var t,r=e;return Au(r)||(r=a(r)),null!=(t=o.options_)&&t.bound&&((r=r.bind(this)).isMobxAction=!0),r}:"method"==n?(Au(e)||(e=a(e)),null!=(r=this.options_)&&r.bound&&s(function(){var e=this,t=e[i].bind(e);t.isMobxAction=!0,e[i]=t}),e):void Po("Cannot apply '"+o.annotationType_+"' to '"+String(i)+"' (kind: "+n+"):\n'"+o.annotationType_+"' can only be used on properties with a function value.")}function Fa(e,t,r,n,i){var s,o,a,l,u,c,h;void 0===i&&(i=Hl.safeDescriptors),function(e,t,r,n){var i=t.annotationType_,s=n.value;"production"===process.env.NODE_ENV||Zo(s)||Po("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':\n'"+i+"' can only be used on properties with a function value.")}(e,t,r,n);var d,f=n.value;null!=(s=t.options_)&&s.bound&&(f=f.bind(null!=(d=e.proxy_)?d:e.target_));return{value:El(null!=(o=null==(a=t.options_)?void 0:a.name)?o:r.toString(),f,null!=(l=null==(u=t.options_)?void 0:u.autoAction)&&l,null!=(c=t.options_)&&c.bound?null!=(h=e.proxy_)?h:e.target_:void 0),configurable:!i||e.isPlainObject_,enumerable:!1,writable:!i}}function La(e,t){return{annotationType_:e,options_:t,make_:ja,extend_:Ua,decorate_20223_:Ba}}function ja(e,t,r,n){var i;if(n===e.target_)return null===this.extend_(e,t,r,!1)?0:2;if(null!=(i=this.options_)&&i.bound&&(!la(e.target_,t)||!Uu(e.target_[t]))&&null===this.extend_(e,t,r,!1))return 0;if(Uu(r.value))return 1;var s=Va(e,this,t,r,!1,!1);return Fo(n,t,s),2}function Ua(e,t,r,n){var i,s=Va(e,this,t,r,null==(i=this.options_)?void 0:i.bound);return e.defineProperty_(t,s,n)}function Ba(e,t){var r;"production"!==process.env.NODE_ENV&&Aa(t,["method"]);var n=t.name,i=t.addInitializer;return Uu(e)||(e=Lu(e)),null!=(r=this.options_)&&r.bound&&i(function(){var e=this,t=e[n].bind(e);t.isMobXFlow=!0,e[n]=t}),e}function Va(e,t,r,n,i,s){void 0===s&&(s=Hl.safeDescriptors),function(e,t,r,n){var i=t.annotationType_,s=n.value;"production"===process.env.NODE_ENV||Zo(s)||Po("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':\n'"+i+"' can only be used on properties with a generator function value.")}(e,t,r,n);var o,a=n.value;(Uu(a)||(a=Lu(a)),i)&&((a=a.bind(null!=(o=e.proxy_)?o:e.target_)).isMobXFlow=!0);return{value:a,configurable:!s||e.isPlainObject_,enumerable:!1,writable:!s}}function Ga(e,t){return{annotationType_:e,options_:t,make_:$a,extend_:qa,decorate_20223_:Wa}}function $a(e,t,r){return null===this.extend_(e,t,r,!1)?0:1}function qa(e,t,r,n){return function(e,t,r,n){var i=t.annotationType_,s=n.get;"production"===process.env.NODE_ENV||s||Po("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':\n'"+i+"' can only be used on getter(+setter) properties.")}(e,this,t,r),e.defineComputedProperty_(t,ma({},this.options_,{get:r.get,set:r.set}),n)}function Wa(e,t){"production"!==process.env.NODE_ENV&&Aa(t,["getter"]);var r=this,n=t.name;return(0,t.addInitializer)(function(){var t=Ec(this)[Ea],i=ma({},r.options_,{get:e,context:this});i.name||(i.name="production"!==process.env.NODE_ENV?t.name_+"."+n.toString():"ObservableObject."+n.toString()),t.values_.set(n,new Ol(i))}),function(){return this[Ea].getObservablePropValue_(n)}}function Ha(e,t){return{annotationType_:e,options_:t,make_:Za,extend_:Ka,decorate_20223_:Xa}}function Za(e,t,r){return null===this.extend_(e,t,r,!1)?0:1}function Ka(e,t,r,n){var i,s;return function(e,t,r,n){var i=t.annotationType_;"production"===process.env.NODE_ENV||"value"in n||Po("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':\n'"+i+"' cannot be used on getter/setter properties")}(e,this,t,r),e.defineObservableProperty_(t,r.value,null!=(i=null==(s=this.options_)?void 0:s.enhancer)?i:Ra,n)}function Xa(e,t){if("production"!==process.env.NODE_ENV){if("field"===t.kind)throw Po("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");Aa(t,["accessor"])}var r=this,n=t.kind,i=t.name,s=new WeakSet;function o(e,t){var n,o,a=Ec(e)[Ea],l=new kl(t,null!=(n=null==(o=r.options_)?void 0:o.enhancer)?n:Ra,"production"!==process.env.NODE_ENV?a.name_+"."+i.toString():"ObservableObject."+i.toString(),!1);a.values_.set(i,l),s.add(e)}if("accessor"==n)return{get:function(){return s.has(this)||o(this,e.get.call(this)),this[Ea].getObservablePropValue_(i)},set:function(e){return s.has(this)||o(this,e),this[Ea].setObservablePropValue_(i,e)},init:function(e){return s.has(this)||o(this,e),e}}}var Ya="true",Qa=Ja();function Ja(e){return{annotationType_:Ya,options_:e,make_:el,extend_:tl,decorate_20223_:rl}}function el(e,t,r,n){var i,s,o,a;if(r.get)return vl.make_(e,t,r,n);if(r.set){var l=Au(r.set)?r.set:El(t.toString(),r.set);return n===e.target_?null===e.defineProperty_(t,{configurable:!Hl.safeDescriptors||e.isPlainObject_,set:l})?0:2:(Fo(n,t,{configurable:!0,set:l}),2)}if(n!==e.target_&&"function"==typeof r.value)return Qo(r.value)?(null!=(a=this.options_)&&a.autoBind?Lu.bound:Lu).make_(e,t,r,n):(null!=(o=this.options_)&&o.autoBind?wu.bound:wu).make_(e,t,r,n);var u,c=!1===(null==(i=this.options_)?void 0:i.deep)?ml.ref:ml;"function"==typeof r.value&&null!=(s=this.options_)&&s.autoBind&&(r.value=r.value.bind(null!=(u=e.proxy_)?u:e.target_));return c.make_(e,t,r,n)}function tl(e,t,r,n){var i,s,o;if(r.get)return vl.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:!Hl.safeDescriptors||e.isPlainObject_,set:El(t.toString(),r.set)},n);"function"==typeof r.value&&null!=(i=this.options_)&&i.autoBind&&(r.value=r.value.bind(null!=(o=e.proxy_)?o:e.target_));return(!1===(null==(s=this.options_)?void 0:s.deep)?ml.ref:ml).extend_(e,t,r,n)}function rl(e,t){Po("'"+this.annotationType_+"' cannot be used as a decorator")}var nl={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};function il(e){return e||nl}Object.freeze(nl);var sl=Ha("observable"),ol=Ha("observable.ref",{enhancer:Ca}),al=Ha("observable.shallow",{enhancer:function(e,t,r){return null==e||kc(e)||cc(e)||mc(e)||vc(e)?e:Array.isArray(e)?ml.array(e,{name:r,deep:!1}):Yo(e)?ml.object(e,void 0,{name:r,deep:!1}):ra(e)?ml.map(e,{name:r,deep:!1}):na(e)?ml.set(e,{name:r,deep:!1}):void("production"!==process.env.NODE_ENV&&Po("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets"))}}),ll=Ha("observable.struct",{enhancer:function(e,t){return"production"!==process.env.NODE_ENV&&Bu(e)&&Po("observable.struct should not be used with observable values"),Hc(e,t)?t:e}}),ul=ba(sl);function cl(e){return!0===e.deep?Ra:!1===e.deep?Ca:(t=e.defaultDecorator)&&null!=(r=null==(n=t.options_)?void 0:n.enhancer)?r:Ra;var t,r,n}function hl(e,t,r){return wa(t)?sl.decorate_20223_(e,t):Ko(t)?void xa(e,t,sl):Bu(e)?e:Yo(e)?ml.object(e,t,r):Array.isArray(e)?ml.array(e,t):ra(e)?ml.map(e,t):na(e)?ml.set(e,t):"object"==typeof e&&null!==e?e:ml.box(e,t)}zo(hl,ul);var dl,fl,pl={box:function(e,t){var r=il(t);return new kl(e,cl(r),r.name,!0,r.equals)},array:function(e,t){var r=il(t);return(!1===Hl.useProxies||!1===r.proxy?Uc:nc)(e,cl(r),r.name)},map:function(e,t){var r=il(t);return new pc(e,cl(r),r.name)},set:function(e,t){var r=il(t);return new yc(e,cl(r),r.name)},object:function(e,t,r){return $c(function(){return Nu(!1===Hl.useProxies||!1===(null==r?void 0:r.proxy)?Ec({},r):function(e,t){var r,n;return Go(),e=Ec(e,t),null!=(n=(r=e[Ea]).proxy_)?n:r.proxy_=new Proxy(e,$u)}({},r),e,t)})},ref:ba(ol),shallow:ba(al),deep:ul,struct:ba(ll)},ml=zo(hl,pl),_l="computed",gl=Ga(_l),yl=Ga("computed.struct",{equals:Oa.structural}),vl=function(e,t){if(wa(t))return gl.decorate_20223_(e,t);if(Ko(t))return xa(e,t,gl);if(Yo(e))return ba(Ga(_l,e));"production"!==process.env.NODE_ENV&&(Zo(e)||Po("First argument to `computed` should be an expression."),Zo(t)&&Po("A setter as second argument is no longer supported, use `{ set: fn }` option instead"));var r=Yo(t)?t:{};return r.get=e,r.name||(r.name=e.name||""),new Ol(r)};Object.assign(vl,gl),vl.struct=ba(yl);var bl=0,xl=1,wl=null!=(dl=null==(fl=Io(function(){},"name"))?void 0:fl.configurable)&&dl,Al={value:"action",configurable:!0,writable:!1,enumerable:!1};function El(e,t,r,n){function i(){return function(e,t,r,n,i){var s=function(e,t,r,n){var i="production"!==process.env.NODE_ENV&&uu()&&!!e,s=0;if("production"!==process.env.NODE_ENV&&i){s=Date.now();var o=n?Array.from(n):jo;hu({type:pu,name:e,object:r,arguments:o})}var a=Hl.trackingDerivation,l=!t||!a;Yl();var u=Hl.allowStateChanges;l&&(jl(),u=Tl(!0));var c=Bl(!0),h={runAsAction_:l,prevDerivation_:a,prevAllowStateChanges_:u,prevAllowStateReads_:c,notifySpy_:i,startTime_:s,actionId_:xl++,parentActionId_:bl};return bl=h.actionId_,h}(e,t,n,i);try{return r.apply(n,i)}catch(e){throw s.error_=e,e}finally{!function(e){bl!==e.actionId_&&Po(30);bl=e.parentActionId_,void 0!==e.error_&&(Hl.suppressReactionErrors=!0);Sl(e.prevAllowStateChanges_),Vl(e.prevAllowStateReads_),Ql(),e.runAsAction_&&Ul(e.prevDerivation_);"production"!==process.env.NODE_ENV&&e.notifySpy_&&fu({time:Date.now()-e.startTime_});Hl.suppressReactionErrors=!1}(s)}}(e,r,t,n||this,arguments)}return void 0===r&&(r=!1),"production"!==process.env.NODE_ENV&&(Zo(t)||Po("`action` can only be invoked on functions"),"string"==typeof e&&e||Po("actions should have valid names, got: '"+e+"'")),i.isMobxAction=!0,i.toString=function(){return t.toString()},wl&&(Al.value=e,Fo(i,"name",Al)),i}function Tl(e){var t=Hl.allowStateChanges;return Hl.allowStateChanges=e,t}function Sl(e){Hl.allowStateChanges=e}var kl=function(e){function t(t,r,n,i,s){var o,a;(void 0===n&&(n="production"!==process.env.NODE_ENV?"ObservableValue@"+qo():"ObservableValue"),void 0===i&&(i=!0),void 0===s&&(s=Oa.default),(o=e.call(this,n)||this).enhancer=void 0,o.name_=void 0,o.equals=void 0,o.hasUnreportedChange_=!1,o.interceptors_=void 0,o.changeListeners_=void 0,o.value_=void 0,o.dehancer=void 0,o.enhancer=r,o.name_=n,o.equals=s,o.value_=r(t,void 0,n),"production"!==process.env.NODE_ENV&&i&&uu())&&cu({type:"create",object:o,observableKind:"value",debugObjectName:o.name_,newValue:""+(null==(a=o.value_)?void 0:a.toString())});return o}_a(t,e);var r=t.prototype;return r.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},r.set=function(e){var t=this.value_;if((e=this.prepareNewValue_(e))!==Hl.UNCHANGED){var r=uu();"production"!==process.env.NODE_ENV&&r&&hu({type:ec,object:this,observableKind:"value",debugObjectName:this.name_,newValue:e,oldValue:t}),this.setNewValue_(e),"production"!==process.env.NODE_ENV&&r&&fu()}},r.prepareNewValue_=function(e){if(zl(this),qu(this)){var t=Hu(this,{object:this,type:ec,newValue:e});if(!t)return Hl.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value_,this.name_),this.equals(this.value_,e)?Hl.UNCHANGED:e},r.setNewValue_=function(e){var t=this.value_;this.value_=e,this.reportChanged(),Zu(this)&&Xu(this,{type:ec,object:this,newValue:e,oldValue:t})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(e){return Wu(this,e)},r.observe_=function(e,t){return t&&e({observableKind:"value",debugObjectName:this.name_,object:this,type:ec,newValue:this.value_,oldValue:void 0}),Ku(this,e)},r.raw=function(){return this.value_},r.toJSON=function(){return this.get()},r.toString=function(){return this.name_+"["+this.value_+"]"},r.valueOf=function(){return aa(this.get())},r[Symbol.toPrimitive]=function(){return this.valueOf()},t}(Ta),Ol=function(){function e(e){this.dependenciesState_=Rl.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Rl.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Pl(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Cl.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,e.get||Po(31),this.derivation=e.get,this.name_=e.name||("production"!==process.env.NODE_ENV?"ComputedValue@"+qo():"ComputedValue"),e.set&&(this.setter_=El("production"!==process.env.NODE_ENV?this.name_+"-setter":"ComputedValue-setter",e.set)),this.equals_=e.equals||(e.compareStructural||e.struct?Oa.structural:Oa.default),this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){!function(e){if(e.lowestObserverState_!==Rl.UP_TO_DATE_)return;e.lowestObserverState_=Rl.POSSIBLY_STALE_,e.observers_.forEach(function(e){e.dependenciesState_===Rl.UP_TO_DATE_&&(e.dependenciesState_=Rl.POSSIBLY_STALE_,e.onBecomeStale_())})}(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.get=function(){if(this.isComputing&&Po(32,this.name_,this.derivation),0!==Hl.inBatch||0!==this.observers_.size||this.keepAlive_){if(Jl(this),Dl(this)){var e=Hl.trackingContext;this.keepAlive_&&!e&&(Hl.trackingContext=this),this.trackAndCompute()&&function(e){if(e.lowestObserverState_===Rl.STALE_)return;e.lowestObserverState_=Rl.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Rl.POSSIBLY_STALE_?(t.dependenciesState_=Rl.STALE_,"production"!==process.env.NODE_ENV&&t.isTracing_!==Cl.NONE&&tu(t,e)):t.dependenciesState_===Rl.UP_TO_DATE_&&(e.lowestObserverState_=Rl.UP_TO_DATE_)})}(this),Hl.trackingContext=e}}else Dl(this)&&(this.warnAboutUntrackedRead_(),Yl(),this.value_=this.computeValue_(!1),Ql());var t=this.value_;if(Ml(t))throw t.cause;return t},t.set=function(e){if(this.setter_){this.isRunningSetter&&Po(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter=!1}}else Po(34,this.name_)},t.trackAndCompute=function(){var e=this.value_,t=this.dependenciesState_===Rl.NOT_TRACKING_,r=this.computeValue_(!0),n=t||Ml(e)||Ml(r)||!this.equals_(e,r);return n&&(this.value_=r,"production"!==process.env.NODE_ENV&&uu()&&cu({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:e,newValue:r})),n},t.computeValue_=function(e){this.isComputing=!0;var t,r=Tl(!1);if(e)t=Il(this,this.derivation,this.scope_);else if(!0===Hl.disableErrorBoundaries)t=this.derivation.call(this.scope_);else try{t=this.derivation.call(this.scope_)}catch(e){t=new Pl(e)}return Sl(r),this.isComputing=!1,t},t.suspend_=function(){this.keepAlive_||(Fl(this),this.value_=void 0,"production"!==process.env.NODE_ENV&&this.isTracing_!==Cl.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' was suspended and it will recompute on the next access."))},t.observe_=function(e,t){var r=this,n=!0,i=void 0;return function(e,t){var r,n,i,s;void 0===t&&(t=Uo);"production"!==process.env.NODE_ENV&&(Zo(e)||Po("Autorun expects a function as first argument"),Au(e)&&Po("Autorun does not accept actions since actions are untrackable"));var o,a=null!=(r=null==(n=t)?void 0:n.name)?r:"production"!==process.env.NODE_ENV?e.name||"Autorun@"+qo():"Autorun";if(t.scheduler||t.delay){var l=function(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Eu}(t),u=!1;o=new nu(a,function(){u||(u=!0,l(function(){u=!1,o.isDisposed||o.track(c)}))},t.onError,t.requiresObservable)}else o=new nu(a,function(){this.track(c)},t.onError,t.requiresObservable);function c(){e(o)}null!=(i=t)&&null!=(i=i.signal)&&i.aborted||o.schedule_();return o.getDisposer_(null==(s=t)?void 0:s.signal)}(function(){var s=r.get();if(!n||t){var o=jl();e({observableKind:"computed",debugObjectName:r.name_,type:ec,object:r,newValue:s,oldValue:i}),Ul(o)}n=!1,i=s})},t.warnAboutUntrackedRead_=function(){"production"!==process.env.NODE_ENV&&(this.isTracing_!==Cl.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute."),("boolean"==typeof this.requiresReaction_?this.requiresReaction_:Hl.computedRequiresReaction)&&console.warn("[mobx] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute."))},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return aa(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},fa(e,[{key:"isComputing",get:function(){return ca(this.flags_,e.isComputingMask_)},set:function(t){this.flags_=ha(this.flags_,e.isComputingMask_,t)}},{key:"isRunningSetter",get:function(){return ca(this.flags_,e.isRunningSetterMask_)},set:function(t){this.flags_=ha(this.flags_,e.isRunningSetterMask_,t)}},{key:"isBeingObserved",get:function(){return ca(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=ha(this.flags_,e.isBeingObservedMask_,t)}},{key:"isPendingUnobservation",get:function(){return ca(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=ha(this.flags_,e.isPendingUnobservationMask_,t)}},{key:"diffValue",get:function(){return ca(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=ha(this.flags_,e.diffValueMask_,1===t)}}])}();Ol.isComputingMask_=1,Ol.isRunningSetterMask_=2,Ol.isBeingObservedMask_=4,Ol.isPendingUnobservationMask_=8,Ol.diffValueMask_=16;var Rl,Cl,Nl=ta("ComputedValue",Ol);!function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"}(Rl||(Rl={})),function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(Cl||(Cl={}));var Pl=function(e){this.cause=void 0,this.cause=e};function Ml(e){return e instanceof Pl}function Dl(e){switch(e.dependenciesState_){case Rl.UP_TO_DATE_:return!1;case Rl.NOT_TRACKING_:case Rl.STALE_:return!0;case Rl.POSSIBLY_STALE_:for(var t=Bl(!0),r=jl(),n=e.observing_,i=n.length,s=0;s<i;s++){var o=n[s];if(Nl(o)){if(Hl.disableErrorBoundaries)o.get();else try{o.get()}catch(e){return Ul(r),Vl(t),!0}if(e.dependenciesState_===Rl.STALE_)return Ul(r),Vl(t),!0}}return Gl(e),Ul(r),Vl(t),!1}}function zl(e){if("production"!==process.env.NODE_ENV){var t=e.observers_.size>0;Hl.allowStateChanges||!t&&"always"!==Hl.enforceActions||console.warn("[MobX] "+(Hl.enforceActions?"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: ":"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ")+e.name_)}}function Il(e,t,r){var n=Bl(!0);Gl(e),e.newObserving_=new Array(0===e.runId_?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++Hl.runId;var i,s=Hl.trackingDerivation;if(Hl.trackingDerivation=e,Hl.inBatch++,!0===Hl.disableErrorBoundaries)i=t.call(r);else try{i=t.call(r)}catch(e){i=new Pl(e)}return Hl.inBatch--,Hl.trackingDerivation=s,function(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=Rl.UP_TO_DATE_,i=0,s=e.unboundDepsCount_,o=0;o<s;o++){var a=r[o];0===a.diffValue&&(a.diffValue=1,i!==o&&(r[i]=a),i++),a.dependenciesState_>n&&(n=a.dependenciesState_)}r.length=i,e.newObserving_=null,s=t.length;for(;s--;){var l=t[s];0===l.diffValue&&Kl(l,e),l.diffValue=0}for(;i--;){var u=r[i];1===u.diffValue&&(u.diffValue=0,Zl(u,e))}n!==Rl.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),function(e){if("production"===process.env.NODE_ENV)return;if(0!==e.observing_.length)return;("boolean"==typeof e.requiresObservable_?e.requiresObservable_:Hl.reactionRequiresObservable)&&console.warn("[mobx] Derivation '"+e.name_+"' is created/updated without reading any observable value.")}(e),Vl(n),i}function Fl(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)Kl(t[r],e);e.dependenciesState_=Rl.NOT_TRACKING_}function Ll(e){var t=jl();try{return e()}finally{Ul(t)}}function jl(){var e=Hl.trackingDerivation;return Hl.trackingDerivation=null,e}function Ul(e){Hl.trackingDerivation=e}function Bl(e){var t=Hl.allowStateReads;return Hl.allowStateReads=e,t}function Vl(e){Hl.allowStateReads=e}function Gl(e){if(e.dependenciesState_!==Rl.UP_TO_DATE_){e.dependenciesState_=Rl.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Rl.UP_TO_DATE_}}var $l=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},ql=!0,Wl=!1,Hl=function(){var e=Do();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ql=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new $l).version&&(ql=!1),ql?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new $l):(setTimeout(function(){Wl||Po(35)},1),new $l)}();function Zl(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Kl(e,t){e.observers_.delete(t),0===e.observers_.size&&Xl(e)}function Xl(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,Hl.pendingUnobservations.push(e))}function Yl(){Hl.inBatch++}function Ql(){if(0===--Hl.inBatch){ou();for(var e=Hl.pendingUnobservations,t=0;t<e.length;t++){var r=e[t];r.isPendingUnobservation=!1,0===r.observers_.size&&(r.isBeingObserved&&(r.isBeingObserved=!1,r.onBUO()),r instanceof Ol&&r.suspend_())}Hl.pendingUnobservations=[]}}function Jl(e){!function(e){"production"!==process.env.NODE_ENV&&!Hl.allowStateReads&&Hl.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}(e);var t=Hl.trackingDerivation;return null!==t?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&Hl.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(0===e.observers_.size&&Hl.inBatch>0&&Xl(e),!1)}function eu(e){e.lowestObserverState_!==Rl.STALE_&&(e.lowestObserverState_=Rl.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Rl.UP_TO_DATE_&&("production"!==process.env.NODE_ENV&&t.isTracing_!==Cl.NONE&&tu(t,e),t.onBecomeStale_()),t.dependenciesState_=Rl.STALE_}))}function tu(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===Cl.BREAK){var r=[];ru(Pu(e),r,1),new Function("debugger;\n/*\nTracing '"+e.name_+"'\n\nYou are entering this break point because derivation '"+e.name_+"' is being traced and '"+t.name_+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(e instanceof Ol?e.derivation.toString().replace(/[*]\//g,"/"):"")+"\n\nThe dependencies for this derivation are:\n\n"+r.join("\n")+"\n*/\n ")()}}function ru(e,t,r){t.length>=1e3?t.push("(and many more)"):(t.push(""+"\t".repeat(r-1)+e.name),e.dependencies&&e.dependencies.forEach(function(e){return ru(e,t,r+1)}))}var nu=function(){function e(e,t,r,n){void 0===e&&(e="production"!==process.env.NODE_ENV?"Reaction@"+qo():"Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Rl.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=Cl.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,Hl.pendingReactions.push(this),ou())},t.runReaction_=function(){if(!this.isDisposed){Yl(),this.isScheduled=!1;var e=Hl.trackingContext;if(Hl.trackingContext=this,Dl(this)){this.isTrackPending=!0;try{this.onInvalidate_(),"production"!==process.env.NODE_ENV&&this.isTrackPending&&uu()&&cu({name:this.name_,type:"scheduled-reaction"})}catch(e){this.reportExceptionInDerivation_(e)}}Hl.trackingContext=e,Ql()}},t.track=function(e){if(!this.isDisposed){Yl();var t,r=uu();"production"!==process.env.NODE_ENV&&r&&(t=Date.now(),hu({name:this.name_,type:"reaction"})),this.isRunning=!0;var n=Hl.trackingContext;Hl.trackingContext=this;var i=Il(this,e,void 0);Hl.trackingContext=n,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Fl(this),Ml(i)&&this.reportExceptionInDerivation_(i.cause),"production"!==process.env.NODE_ENV&&r&&fu({time:Date.now()-t}),Ql()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(Hl.disableErrorBoundaries)throw e;var r="production"!==process.env.NODE_ENV?"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'":"[mobx] uncaught error in '"+this+"'";Hl.suppressReactionErrors?"production"!==process.env.NODE_ENV&&console.warn("[mobx] (error in reaction '"+this.name_+"' suppressed, fix error of causing action below)"):console.error(r,e),"production"!==process.env.NODE_ENV&&uu()&&cu({type:"error",name:this.name_,message:r,error:""+e}),Hl.globalReactionErrorHandlers.forEach(function(r){return r(e,t)})}},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Yl(),Fl(this),Ql()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[Ea]=this,"dispose"in Symbol&&"symbol"==typeof Symbol.dispose&&(r[Symbol.dispose]=r),r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1),function(){if("production"===process.env.NODE_ENV)return;for(var e=!1,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];"boolean"==typeof r[r.length-1]&&(e=r.pop());var i=function(e){switch(e.length){case 0:return Hl.trackingDerivation;case 1:return Bc(e[0]);case 2:return Bc(e[0],e[1])}}(r);if(!i)return Po("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");i.isTracing_===Cl.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled");i.isTracing_=e?Cl.BREAK:Cl.LOG}(this,e)},fa(e,[{key:"isDisposed",get:function(){return ca(this.flags_,e.isDisposedMask_)},set:function(t){this.flags_=ha(this.flags_,e.isDisposedMask_,t)}},{key:"isScheduled",get:function(){return ca(this.flags_,e.isScheduledMask_)},set:function(t){this.flags_=ha(this.flags_,e.isScheduledMask_,t)}},{key:"isTrackPending",get:function(){return ca(this.flags_,e.isTrackPendingMask_)},set:function(t){this.flags_=ha(this.flags_,e.isTrackPendingMask_,t)}},{key:"isRunning",get:function(){return ca(this.flags_,e.isRunningMask_)},set:function(t){this.flags_=ha(this.flags_,e.isRunningMask_,t)}},{key:"diffValue",get:function(){return ca(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=ha(this.flags_,e.diffValueMask_,1===t)}}])}();nu.isDisposedMask_=1,nu.isScheduledMask_=2,nu.isTrackPendingMask_=4,nu.isRunningMask_=8,nu.diffValueMask_=16;var iu=100,su=function(e){return e()};function ou(){Hl.inBatch>0||Hl.isRunningReactions||su(au)}function au(){Hl.isRunningReactions=!0;for(var e=Hl.pendingReactions,t=0;e.length>0;){++t===iu&&(console.error("production"!==process.env.NODE_ENV?"Reaction doesn't converge to a stable state after "+iu+" iterations. Probably there is a cycle in the reactive function: "+e[0]:"[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n<i;n++)r[n].runReaction_()}Hl.isRunningReactions=!1}var lu=ta("Reaction",nu);function uu(){return"production"!==process.env.NODE_ENV&&!!Hl.spyListeners.length}function cu(e){if("production"!==process.env.NODE_ENV&&Hl.spyListeners.length)for(var t=Hl.spyListeners,r=0,n=t.length;r<n;r++)t[r](e)}function hu(e){"production"!==process.env.NODE_ENV&&cu(ma({},e,{spyReportStart:!0}))}var du={type:"report-end",spyReportEnd:!0};function fu(e){"production"!==process.env.NODE_ENV&&cu(e?ma({},e,{type:"report-end",spyReportEnd:!0}):du)}var pu="action",mu="autoAction",_u=Ma(pu),gu=Ma("action.bound",{bound:!0}),yu=Ma(mu,{autoAction:!0}),vu=Ma("autoAction.bound",{autoAction:!0,bound:!0});function bu(e){return function(t,r){return Zo(t)?El(t.name||"<unnamed action>",t,e):Zo(r)?El(t,r,e):wa(r)?(e?yu:_u).decorate_20223_(t,r):Ko(r)?xa(t,r,e?yu:_u):Ko(t)?ba(Ma(e?mu:pu,{name:t,autoAction:e})):void("production"!==process.env.NODE_ENV&&Po("Invalid arguments for `action`"))}}var xu=bu(!1);Object.assign(xu,_u);var wu=bu(!0);function Au(e){return Zo(e)&&!0===e.isMobxAction}Object.assign(wu,yu),xu.bound=ba(gu),wu.bound=ba(vu);var Eu=function(e){return e()};var Tu="onBO",Su="onBUO";function ku(e,t,r){return Ou(Su,e,t,r)}function Ou(e,t,r,n){var i=Bc(t),s=Zo(n)?n:r,o=e+"L";return i[o]?i[o].add(s):i[o]=new Set([s]),function(){var e=i[o];e&&(e.delete(s),0===e.size&&delete i[o])}}var Ru="always";function Cu(e){!0===e.isolateGlobalState&&function(){if((Hl.pendingReactions.length||Hl.inBatch||Hl.isRunningReactions)&&Po(36),Wl=!0,ql){var e=Do();0===--e.__mobxInstanceCount&&(e.__mobxGlobals=void 0),Hl=new $l}}();var t,r,n=e.useProxies,i=e.enforceActions;if(void 0!==n&&(Hl.useProxies=n===Ru||"never"!==n&&"undefined"!=typeof Proxy),"ifavailable"===n&&(Hl.verifyProxies=!0),void 0!==i){var s=i===Ru?Ru:"observed"===i;Hl.enforceActions=s,Hl.allowStateChanges=!0!==s&&s!==Ru}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(t){t in e&&(Hl[t]=!!e[t])}),Hl.allowStateReads=!Hl.observableRequiresReaction,"production"!==process.env.NODE_ENV&&!0===Hl.disableErrorBoundaries&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&(t=e.reactionScheduler,r=su,su=function(e){return t(function(){return r(e)})})}function Nu(e,t,r,n){"production"!==process.env.NODE_ENV&&(arguments.length>4&&Po("'extendObservable' expected 2-4 arguments"),"object"!=typeof e&&Po("'extendObservable' expects an object as first argument"),mc(e)&&Po("'extendObservable' should not be used on maps, use map.merge instead"),Yo(t)||Po("'extendObservable' only accepts plain objects as second argument"),(Bu(t)||Bu(r))&&Po("Extending an object with another observable (object) is not supported"));var i=ua(t);return $c(function(){var t=Ec(e,n)[Ea];sa(i).forEach(function(e){t.extend_(e,i[e],!r||(!(e in r)||r[e]))})}),e}function Pu(e,t){return Mu(Bc(e,t))}function Mu(e){var t,r={name:e.name_};return e.observing_&&e.observing_.length>0&&(r.dependencies=(t=e.observing_,Array.from(new Set(t))).map(Mu)),r}var Du=0;function zu(){this.message="FLOW_CANCELLED"}zu.prototype=Object.create(Error.prototype);var Iu=La("flow"),Fu=La("flow.bound",{bound:!0}),Lu=Object.assign(function(e,t){if(wa(t))return Iu.decorate_20223_(e,t);if(Ko(t))return xa(e,t,Iu);"production"!==process.env.NODE_ENV&&1!==arguments.length&&Po("Flow expects single argument with generator function");var r=e,n=r.name||"<unnamed flow>",i=function(){var e,t=arguments,i=++Du,s=xu(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,a=new Promise(function(t,r){var a=0;function l(e){var t;o=void 0;try{t=xu(n+" - runid: "+i+" - yield "+a++,s.next).call(s,e)}catch(e){return r(e)}c(t)}function u(e){var t;o=void 0;try{t=xu(n+" - runid: "+i+" - yield "+a++,s.throw).call(s,e)}catch(e){return r(e)}c(t)}function c(e){if(!Zo(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(l,u);e.then(c,r)}e=r,l(void 0)});return a.cancel=xu(n+" - runid: "+i+" - cancel",function(){try{o&&ju(o);var t=s.return(void 0),r=Promise.resolve(t.value);r.then(Ho,Ho),ju(r),e(new zu)}catch(t){e(t)}}),a};return i.isMobXFlow=!0,i},Iu);function ju(e){Zo(e.cancel)&&e.cancel()}function Uu(e){return!0===(null==e?void 0:e.isMobXFlow)}function Bu(e){return"production"!==process.env.NODE_ENV&&1!==arguments.length&&Po("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),function(e){return!!e&&(kc(e)||!!e[Ea]||Sa(e)||lu(e)||Nl(e))}(e)}function Vu(e,t){void 0===t&&(t=void 0),Yl();try{return e.apply(t)}finally{Ql()}}function Gu(e){return e[Ea]}Lu.bound=ba(Fu);var $u={has:function(e,t){return"production"!==process.env.NODE_ENV&&Hl.trackingDerivation&&$o("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),Gu(e).has_(t)},get:function(e,t){return Gu(e).get_(t)},set:function(e,t,r){var n;return!!Ko(t)&&("production"===process.env.NODE_ENV||Gu(e).values_.has(t)||$o("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),null==(n=Gu(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return"production"!==process.env.NODE_ENV&&$o("delete properties from an observable object. Use 'remove' from 'mobx' instead."),!!Ko(t)&&(null==(r=Gu(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return"production"!==process.env.NODE_ENV&&$o("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),null==(n=Gu(e).defineProperty_(t,r))||n},ownKeys:function(e){return"production"!==process.env.NODE_ENV&&Hl.trackingDerivation&&$o("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),Gu(e).ownKeys_()},preventExtensions:function(e){Po(13)}};function qu(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function Wu(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),Wo(function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)})}function Hu(e,t){var r=jl();try{for(var n=[].concat(e.interceptors_||[]),i=0,s=n.length;i<s&&((t=n[i](t))&&!t.type&&Po(14),t);i++);return t}finally{Ul(r)}}function Zu(e){return void 0!==e.changeListeners_&&e.changeListeners_.length>0}function Ku(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),Wo(function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)})}function Xu(e,t){var r=jl(),n=e.changeListeners_;if(n){for(var i=0,s=(n=n.slice()).length;i<s;i++)n[i](t);Ul(r)}}var Yu=Symbol("mobx-keys");function Qu(e,t,r){return"production"!==process.env.NODE_ENV&&(Yo(e)||Yo(Object.getPrototypeOf(e))||Po("'makeAutoObservable' can only be used for classes that don't have a superclass"),kc(e)&&Po("makeAutoObservable can only be used on objects not already made observable")),Yo(e)?Nu(e,e,t,r):($c(function(){var n=Ec(e,r)[Ea];if(!e[Yu]){var i=Object.getPrototypeOf(e),s=new Set([].concat(sa(e),sa(i)));s.delete("constructor"),s.delete(Ea),Jo(i,Yu,s)}e[Yu].forEach(function(e){return n.make_(e,!t||(!(e in t)||t[e]))})}),e)}var Ju="splice",ec="update",tc={get:function(e,t){var r=e[Ea];return t===Ea?r:"length"===t?r.getArrayLength_():"string"!=typeof t||isNaN(t)?la(ic,t)?ic[t]:e[t]:r.get_(parseInt(t))},set:function(e,t,r){var n=e[Ea];return"length"===t&&n.setArrayLength_(r),"symbol"==typeof t||isNaN(t)?e[t]=r:n.set_(parseInt(t),r),!0},preventExtensions:function(){Po(15)}},rc=function(){function e(e,t,r,n){void 0===e&&(e="production"!==process.env.NODE_ENV?"ObservableArray@"+qo():"ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=r,this.legacyMode_=n,this.atom_=new Ta(e),this.enhancer_=function(r,n){return t(r,n,"production"!==process.env.NODE_ENV?e+"[..]":"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.dehanceValues_=function(e){return void 0!==this.dehancer&&e.length>0?e.map(this.dehancer):e},t.intercept_=function(e){return Wu(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Ku(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&Po("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var r=new Array(e-t),n=0;n<e-t;n++)r[n]=void 0;this.spliceWithArray_(t,0,r)}else this.spliceWithArray_(e,t-e)},t.updateArrayLength_=function(e,t){e!==this.lastKnownLength_&&Po(16),this.lastKnownLength_+=t,this.legacyMode_&&t>0&&jc(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;zl(this.atom_);var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=jo),qu(this)){var s=Hu(this,{object:this.proxy_,type:Ju,index:e,removedCount:t,added:r});if(!s)return jo;t=s.removedCount,r=s.added}if(r=0===r.length?r:r.map(function(e){return n.enhancer_(e,void 0)}),this.legacyMode_||"production"!==process.env.NODE_ENV){var o=r.length-t;this.updateArrayLength_(i,o)}var a=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,a),this.dehanceValues_(a)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),s=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o<r.length;o++)this.values_[e+o]=r[o];for(var a=0;a<s.length;a++)this.values_[e+r.length+a]=s[a];return i},t.notifyArrayChildUpdate_=function(e,t,r){var n=!this.owned_&&uu(),i=Zu(this),s=i||n?{observableKind:"array",object:this.proxy_,type:ec,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:r}:null;"production"!==process.env.NODE_ENV&&n&&hu(s),this.atom_.reportChanged(),i&&Xu(this,s),"production"!==process.env.NODE_ENV&&n&&fu()},t.notifyArraySplice_=function(e,t,r){var n=!this.owned_&&uu(),i=Zu(this),s=i||n?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Ju,index:e,removed:r,added:t,removedCount:r.length,addedCount:t.length}:null;"production"!==process.env.NODE_ENV&&n&&hu(s),this.atom_.reportChanged(),i&&Xu(this,s),"production"!==process.env.NODE_ENV&&n&&fu()},t.get_=function(e){if(!(this.legacyMode_&&e>=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("production"!==process.env.NODE_ENV?"[mobx.array] Attempt to read an array index ("+e+") that is out of bounds ("+this.values_.length+"). Please check length first. Out of bound indices will not be tracked by MobX":"[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var r=this.values_;if(this.legacyMode_&&e>r.length&&Po(17,e,r.length),e<r.length){zl(this.atom_);var n=r[e];if(qu(this)){var i=Hu(this,{type:ec,object:this.proxy_,index:e,newValue:t});if(!i)return;t=i.newValue}(t=this.enhancer_(t,n))!==n&&(r[e]=t,this.notifyArrayChildUpdate_(e,t,n))}else{for(var s=new Array(e+1-r.length),o=0;o<s.length-1;o++)s[o]=void 0;s[s.length-1]=t,this.spliceWithArray_(r.length,0,s)}},e}();function nc(e,t,r,n){return void 0===r&&(r="production"!==process.env.NODE_ENV?"ObservableArray@"+qo():"ObservableArray"),void 0===n&&(n=!1),Go(),$c(function(){var i=new rc(r,t,n,!1);ea(i.values_,Ea,i);var s=new Proxy(i.values_,tc);return i.proxy_=s,e&&e.length&&i.spliceWithArray_(0,0,e),s})}var ic={clear:function(){return this.splice(0)},replace:function(e){var t=this[Ea];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];var s=this[Ea];switch(arguments.length){case 0:return[];case 1:return s.spliceWithArray_(e);case 2:return s.spliceWithArray_(e,t)}return s.spliceWithArray_(e,t,n)},spliceWithArray:function(e,t,r){return this[Ea].spliceWithArray_(e,t,r)},push:function(){for(var e=this[Ea],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.spliceWithArray_(e.values_.length,0,r),e.values_.length},pop:function(){return this.splice(Math.max(this[Ea].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[Ea],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.spliceWithArray_(0,0,r),e.values_.length},reverse:function(){return Hl.trackingDerivation&&Po(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Hl.trackingDerivation&&Po(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[Ea],r=t.dehanceValues_(t.values_).indexOf(e);return r>-1&&(this.splice(r,1),!0)}};function sc(e,t){"function"==typeof Array.prototype[e]&&(ic[e]=t(e))}function oc(e){return function(){var t=this[Ea];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function ac(e){return function(t,r){var n=this,i=this[Ea];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e](function(e,i){return t.call(r,e,i,n)})}}function lc(e){return function(){var t=this,r=this[Ea];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}sc("at",oc),sc("concat",oc),sc("flat",oc),sc("includes",oc),sc("indexOf",oc),sc("join",oc),sc("lastIndexOf",oc),sc("slice",oc),sc("toString",oc),sc("toLocaleString",oc),sc("toSorted",oc),sc("toSpliced",oc),sc("with",oc),sc("every",ac),sc("filter",ac),sc("find",ac),sc("findIndex",ac),sc("findLast",ac),sc("findLastIndex",ac),sc("flatMap",ac),sc("forEach",ac),sc("map",ac),sc("some",ac),sc("toReversed",ac),sc("reduce",lc),sc("reduceRight",lc);var uc=ta("ObservableArrayAdministration",rc);function cc(e){return Xo(e)&&uc(e[Ea])}var hc={},dc="add",fc="delete",pc=function(){function e(e,t,r){var n=this;void 0===t&&(t=Ra),void 0===r&&(r="production"!==process.env.NODE_ENV?"ObservableMap@"+qo():"ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[Ea]=hc,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=r,Zo(Map)||Po(18),$c(function(){n.keysAtom_=ka("production"!==process.env.NODE_ENV?n.name_+".keys()":"ObservableMap.keys()"),n.data_=new Map,n.hasMap_=new Map,e&&n.merge(e)})}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!Hl.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new kl(this.has_(e),Ca,"production"!==process.env.NODE_ENV?this.name_+"."+oa(e)+"?":"ObservableMap.key?",!1);this.hasMap_.set(e,n),ku(n,function(){return t.hasMap_.delete(e)})}return r.get()},t.set=function(e,t){var r=this.has_(e);if(qu(this)){var n=Hu(this,{type:r?ec:dc,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if((zl(this.keysAtom_),qu(this))&&!Hu(this,{type:fc,object:this,name:e}))return!1;if(this.has_(e)){var r=uu(),n=Zu(this),i=n||r?{observableKind:"map",debugObjectName:this.name_,type:fc,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return"production"!==process.env.NODE_ENV&&r&&hu(i),Vu(function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)}),n&&Xu(this,i),"production"!==process.env.NODE_ENV&&r&&fu(),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==Hl.UNCHANGED){var n=uu(),i=Zu(this),s=i||n?{observableKind:"map",debugObjectName:this.name_,type:ec,object:this,oldValue:r.value_,name:e,newValue:t}:null;"production"!==process.env.NODE_ENV&&n&&hu(s),r.setNewValue_(t),i&&Xu(this,s),"production"!==process.env.NODE_ENV&&n&&fu()}},t.addValue_=function(e,t){var r=this;zl(this.keysAtom_),Vu(function(){var n,i=new kl(t,r.enhancer_,"production"!==process.env.NODE_ENV?r.name_+"."+oa(e):"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()});var n=uu(),i=Zu(this),s=i||n?{observableKind:"map",debugObjectName:this.name_,type:dc,object:this,name:e,newValue:t}:null;"production"!==process.env.NODE_ENV&&n&&hu(s),i&&Xu(this,s),"production"!==process.env.NODE_ENV&&n&&fu()},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return _c({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return _c({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=pa(this);!(r=n()).done;){var i=r.value,s=i[0],o=i[1];e.call(t,o,s,this)}},t.merge=function(e){var t=this;return mc(e)&&(e=new Map(e)),Vu(function(){var r,n,i;Yo(e)?function(e){var t=Object.keys(e);if(!ia)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(t){return Lo.propertyIsEnumerable.call(e,t)})):t}(e).forEach(function(r){return t.set(r,e[r])}):Array.isArray(e)?e.forEach(function(e){var r=e[0],n=e[1];return t.set(r,n)}):ra(e)?(r=e,n=Object.getPrototypeOf(r),i=Object.getPrototypeOf(n),null!==Object.getPrototypeOf(i)&&Po(19,e),e.forEach(function(e,r){return t.set(r,e)})):null!=e&&Po(20,e)}),this},t.clear=function(){var e=this;Vu(function(){Ll(function(){for(var t,r=pa(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}})})},t.replace=function(e){var t=this;return Vu(function(){for(var r,n=function(e){if(ra(e)||mc(e))return e;if(Array.isArray(e))return new Map(e);if(Yo(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}return Po(21,e)}(e),i=new Map,s=!1,o=pa(t.data_.keys());!(r=o()).done;){var a=r.value;if(!n.has(a))if(t.delete(a))s=!0;else{var l=t.data_.get(a);i.set(a,l)}}for(var u,c=pa(n.entries());!(u=c()).done;){var h=u.value,d=h[0],f=h[1],p=t.data_.has(d);if(t.set(d,f),t.data_.has(d)){var m=t.data_.get(d);i.set(d,m),p||(s=!0)}}if(!s)if(t.data_.size!==i.size)t.keysAtom_.reportChanged();else for(var _=t.data_.keys(),g=i.keys(),y=_.next(),v=g.next();!y.done;){if(y.value!==v.value){t.keysAtom_.reportChanged();break}y=_.next(),v=g.next()}t.data_=i}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return"production"!==process.env.NODE_ENV&&!0===t&&Po("`observe` doesn't support fireImmediately=true in combination with maps."),Ku(this,e)},t.intercept_=function(e){return Wu(this,e)},fa(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),mc=ta("ObservableMap",pc);function _c(e){return e[Symbol.toStringTag]="MapIterator",Yc(e)}var gc={},yc=function(){function e(e,t,r){var n=this;void 0===t&&(t=Ra),void 0===r&&(r="production"!==process.env.NODE_ENV?"ObservableSet@"+qo():"ObservableSet"),this.name_=void 0,this[Ea]=gc,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,Zo(Set)||Po(22),this.enhancer_=function(e,n){return t(e,n,r)},$c(function(){n.atom_=ka(n.name_),e&&n.replace(e)})}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;Vu(function(){Ll(function(){for(var t,r=pa(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}})})},t.forEach=function(e,t){for(var r,n=pa(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(zl(this.atom_),qu(this)){var r=Hu(this,{type:dc,object:this,newValue:e});if(!r)return this;e=r.newValue}if(!this.has(e)){Vu(function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()});var n="production"!==process.env.NODE_ENV&&uu(),i=Zu(this),s=i||n?{observableKind:"set",debugObjectName:this.name_,type:dc,object:this,newValue:e}:null;n&&"production"!==process.env.NODE_ENV&&hu(s),i&&Xu(this,s),n&&"production"!==process.env.NODE_ENV&&fu()}return this},t.delete=function(e){var t=this;if(qu(this)&&!Hu(this,{type:fc,object:this,oldValue:e}))return!1;if(this.has(e)){var r="production"!==process.env.NODE_ENV&&uu(),n=Zu(this),i=n||r?{observableKind:"set",debugObjectName:this.name_,type:fc,object:this,oldValue:e}:null;return r&&"production"!==process.env.NODE_ENV&&hu(i),Vu(function(){t.atom_.reportChanged(),t.data_.delete(e)}),n&&Xu(this,i),r&&"production"!==process.env.NODE_ENV&&fu(),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=this.values();return bc({next:function(){var t=e.next(),r=t.value,n=t.done;return n?{value:void 0,done:n}:{value:[r,r],done:n}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var e=this,t=this.data_.values();return bc({next:function(){var r=t.next(),n=r.value,i=r.done;return i?{value:void 0,done:i}:{value:e.dehanceValue_(n),done:i}}})},t.intersection=function(e){return na(e)&&!vc(e)?e.intersection(this):new Set(this).intersection(e)},t.union=function(e){return na(e)&&!vc(e)?e.union(this):new Set(this).union(e)},t.difference=function(e){return new Set(this).difference(e)},t.symmetricDifference=function(e){return na(e)&&!vc(e)?e.symmetricDifference(this):new Set(this).symmetricDifference(e)},t.isSubsetOf=function(e){return new Set(this).isSubsetOf(e)},t.isSupersetOf=function(e){return new Set(this).isSupersetOf(e)},t.isDisjointFrom=function(e){return na(e)&&!vc(e)?e.isDisjointFrom(this):new Set(this).isDisjointFrom(e)},t.replace=function(e){var t=this;return vc(e)&&(e=new Set(e)),Vu(function(){Array.isArray(e)||na(e)?(t.clear(),e.forEach(function(e){return t.add(e)})):null!=e&&Po("Cannot initialize set from "+e)}),this},t.observe_=function(e,t){return"production"!==process.env.NODE_ENV&&!0===t&&Po("`observe` doesn't support fireImmediately=true in combination with sets."),Ku(this,e)},t.intercept_=function(e){return Wu(this,e)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},fa(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),vc=ta("ObservableSet",yc);function bc(e){return e[Symbol.toStringTag]="SetIterator",Yc(e)}var xc=Object.create(null),wc="remove",Ac=function(){function e(e,t,r,n){void 0===t&&(t=new Map),void 0===n&&(n=Qa),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=e,this.values_=t,this.name_=r,this.defaultAnnotation_=n,this.keysAtom_=new Ta("production"!==process.env.NODE_ENV?this.name_+".keys":"ObservableObject.keys"),this.isPlainObject_=Yo(this.target_),"production"===process.env.NODE_ENV||Jc(this.defaultAnnotation_)||Po("defaultAnnotation must be valid annotation"),"production"!==process.env.NODE_ENV&&(this.appliedAnnotations_={})}var t=e.prototype;return t.getObservablePropValue_=function(e){return this.values_.get(e).get()},t.setObservablePropValue_=function(e,t){var r=this.values_.get(e);if(r instanceof Ol)return r.set(t),!0;if(qu(this)){var n=Hu(this,{type:ec,object:this.proxy_||this.target_,name:e,newValue:t});if(!n)return null;t=n.newValue}if((t=r.prepareNewValue_(t))!==Hl.UNCHANGED){var i=Zu(this),s="production"!==process.env.NODE_ENV&&uu(),o=i||s?{type:ec,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:r.value_,name:e,newValue:t}:null;"production"!==process.env.NODE_ENV&&s&&hu(o),r.setNewValue_(t),i&&Xu(this,o),"production"!==process.env.NODE_ENV&&s&&fu()}return!0},t.get_=function(e){return Hl.trackingDerivation&&!la(this.target_,e)&&this.has_(e),this.target_[e]},t.set_=function(e,t,r){return void 0===r&&(r=!1),la(this.target_,e)?this.values_.has(e)?this.setObservablePropValue_(e,t):r?Reflect.set(this.target_,e,t):(this.target_[e]=t,!0):this.extend_(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,r)},t.has_=function(e){if(!Hl.trackingDerivation)return e in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var t=this.pendingKeys_.get(e);return t||(t=new kl(e in this.target_,Ca,"production"!==process.env.NODE_ENV?this.name_+"."+oa(e)+"?":"ObservableObject.key?",!1),this.pendingKeys_.set(e,t)),t.get()},t.make_=function(e,t){if(!0===t&&(t=this.defaultAnnotation_),!1!==t){if(Rc(this,t,e),!(e in this.target_)){var r;if(null!=(r=this.target_[va])&&r[e])return;Po(1,t.annotationType_,this.name_+"."+e.toString())}for(var n=this.target_;n&&n!==Lo;){var i=Io(n,e);if(i){var s=t.make_(this,e,i,n);if(0===s)return;if(1===s)break}n=Object.getPrototypeOf(n)}Oc(this,t,e)}},t.extend_=function(e,t,r,n){if(void 0===n&&(n=!1),!0===r&&(r=this.defaultAnnotation_),!1===r)return this.defineProperty_(e,t,n);Rc(this,r,e);var i=r.extend_(this,e,t,n);return i&&Oc(this,r,e),i},t.defineProperty_=function(e,t,r){void 0===r&&(r=!1),zl(this.keysAtom_);try{Yl();var n=this.delete_(e);if(!n)return n;if(qu(this)){var i=Hu(this,{object:this.proxy_||this.target_,name:e,type:dc,newValue:t.value});if(!i)return null;var s=i.newValue;t.value!==s&&(t=ma({},t,{value:s}))}if(r){if(!Reflect.defineProperty(this.target_,e,t))return!1}else Fo(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{Ql()}return!0},t.defineObservableProperty_=function(e,t,r,n){void 0===n&&(n=!1),zl(this.keysAtom_);try{Yl();var i=this.delete_(e);if(!i)return i;if(qu(this)){var s=Hu(this,{object:this.proxy_||this.target_,name:e,type:dc,newValue:t});if(!s)return null;t=s.newValue}var o=Sc(e),a={configurable:!Hl.safeDescriptors||this.isPlainObject_,enumerable:!0,get:o.get,set:o.set};if(n){if(!Reflect.defineProperty(this.target_,e,a))return!1}else Fo(this.target_,e,a);var l=new kl(t,r,"production"!==process.env.NODE_ENV?this.name_+"."+e.toString():"ObservableObject.key",!1);this.values_.set(e,l),this.notifyPropertyAddition_(e,l.value_)}finally{Ql()}return!0},t.defineComputedProperty_=function(e,t,r){void 0===r&&(r=!1),zl(this.keysAtom_);try{Yl();var n=this.delete_(e);if(!n)return n;if(qu(this))if(!Hu(this,{object:this.proxy_||this.target_,name:e,type:dc,newValue:void 0}))return null;t.name||(t.name="production"!==process.env.NODE_ENV?this.name_+"."+e.toString():"ObservableObject.key"),t.context=this.proxy_||this.target_;var i=Sc(e),s={configurable:!Hl.safeDescriptors||this.isPlainObject_,enumerable:!1,get:i.get,set:i.set};if(r){if(!Reflect.defineProperty(this.target_,e,s))return!1}else Fo(this.target_,e,s);this.values_.set(e,new Ol(t)),this.notifyPropertyAddition_(e,void 0)}finally{Ql()}return!0},t.delete_=function(e,t){if(void 0===t&&(t=!1),zl(this.keysAtom_),!la(this.target_,e))return!0;if(qu(this)&&!Hu(this,{object:this.proxy_||this.target_,name:e,type:wc}))return null;try{var r;Yl();var n,i=Zu(this),s="production"!==process.env.NODE_ENV&&uu(),o=this.values_.get(e),a=void 0;if(!o&&(i||s))a=null==(n=Io(this.target_,e))?void 0:n.value;if(t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if("production"!==process.env.NODE_ENV&&delete this.appliedAnnotations_[e],o&&(this.values_.delete(e),o instanceof kl&&(a=o.value_),eu(o)),this.keysAtom_.reportChanged(),null==(r=this.pendingKeys_)||null==(r=r.get(e))||r.set(e in this.target_),i||s){var l={type:wc,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:a,name:e};"production"!==process.env.NODE_ENV&&s&&hu(l),i&&Xu(this,l),"production"!==process.env.NODE_ENV&&s&&fu()}}finally{Ql()}return!0},t.observe_=function(e,t){return"production"!==process.env.NODE_ENV&&!0===t&&Po("`observe` doesn't support the fire immediately property for observable objects."),Ku(this,e)},t.intercept_=function(e){return Wu(this,e)},t.notifyPropertyAddition_=function(e,t){var r,n=Zu(this),i="production"!==process.env.NODE_ENV&&uu();if(n||i){var s=n||i?{type:dc,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;"production"!==process.env.NODE_ENV&&i&&hu(s),n&&Xu(this,s),"production"!==process.env.NODE_ENV&&i&&fu()}null==(r=this.pendingKeys_)||null==(r=r.get(e))||r.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),sa(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Ec(e,t){var r;if("production"!==process.env.NODE_ENV&&t&&kc(e)&&Po("Options can't be provided for already observable objects."),la(e,Ea))return"production"===process.env.NODE_ENV||Vc(e)instanceof Ac||Po("Cannot convert '"+Gc(e)+"' into observable object:\nThe target is already observable of different type.\nExtending builtins is not supported."),e;"production"===process.env.NODE_ENV||Object.isExtensible(e)||Po("Cannot make the designated object observable; it is not extensible");var n=null!=(r=null==t?void 0:t.name)?r:"production"!==process.env.NODE_ENV?(Yo(e)?"ObservableObject":e.constructor.name)+"@"+qo():"ObservableObject",i=new Ac(e,new Map,String(n),function(e){var t;return e?null!=(t=e.defaultDecorator)?t:Ja(e):void 0}(t));return Jo(e,Ea,i),e}var Tc=ta("ObservableObjectAdministration",Ac);function Sc(e){return xc[e]||(xc[e]={get:function(){return this[Ea].getObservablePropValue_(e)},set:function(t){return this[Ea].setObservablePropValue_(e,t)}})}function kc(e){return!!Xo(e)&&Tc(e[Ea])}function Oc(e,t,r){var n;"production"!==process.env.NODE_ENV&&(e.appliedAnnotations_[r]=t),null==(n=e.target_[va])||delete n[r]}function Rc(e,t,r){if("production"===process.env.NODE_ENV||Jc(t)||Po("Cannot annotate '"+e.name_+"."+r.toString()+"': Invalid annotation."),"production"!==process.env.NODE_ENV&&!Pa(t)&&la(e.appliedAnnotations_,r)){var n=e.name_+"."+r.toString(),i=e.appliedAnnotations_[r].annotationType_;Po("Cannot apply '"+t.annotationType_+"' to '"+n+"':\nThe field is already annotated with '"+i+"'.\nRe-annotating fields is not allowed.\nUse 'override' annotation for methods overridden by subclass.")}}var Cc,Nc,Pc=Fc(0),Mc=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,!1===e}(),Dc=0,zc=function(){};Cc=zc,Nc=Array.prototype,Object.setPrototypeOf?Object.setPrototypeOf(Cc.prototype,Nc):void 0!==Cc.prototype.__proto__?Cc.prototype.__proto__=Nc:Cc.prototype=Nc;var Ic=function(e){function t(t,r,n,i){var s;return void 0===n&&(n="production"!==process.env.NODE_ENV?"ObservableArray@"+qo():"ObservableArray"),void 0===i&&(i=!1),s=e.call(this)||this,$c(function(){var e=new rc(n,r,i,!0);e.proxy_=s,ea(s,Ea,e),t&&t.length&&s.spliceWithArray(0,0,t),Mc&&Object.defineProperty(s,"0",Pc)}),s}_a(t,e);var r=t.prototype;return r.concat=function(){this[Ea].atom_.reportObserved();for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Array.prototype.concat.apply(this.slice(),t.map(function(e){return cc(e)?e.slice():e}))},r[Symbol.iterator]=function(){var e=this,t=0;return Yc({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})},fa(t,[{key:"length",get:function(){return this[Ea].getArrayLength_()},set:function(e){this[Ea].setArrayLength_(e)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(zc);function Fc(e){return{enumerable:!1,configurable:!0,get:function(){return this[Ea].get_(e)},set:function(t){this[Ea].set_(e,t)}}}function Lc(e){Fo(Ic.prototype,""+e,Fc(e))}function jc(e){if(e>Dc){for(var t=Dc;t<e+100;t++)Lc(t);Dc=e}}function Uc(e,t,r){return new Ic(e,t,r)}function Bc(e,t){if("object"==typeof e&&null!==e){if(cc(e))return void 0!==t&&Po(23),e[Ea].atom_;if(vc(e))return e.atom_;if(mc(e)){if(void 0===t)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||Po(25,t,Gc(e)),r}if(kc(e)){if(!t)return Po(26);var n=e[Ea].values_.get(t);return n||Po(27,t,Gc(e)),n}if(Sa(e)||Nl(e)||lu(e))return e}else if(Zo(e)&&lu(e[Ea]))return e[Ea];Po(28)}function Vc(e,t){return e||Po(29),Sa(e)||Nl(e)||lu(e)||mc(e)||vc(e)?e:e[Ea]?e[Ea]:void Po(24,e)}function Gc(e,t){var r;if(void 0!==t)r=Bc(e,t);else{if(Au(e))return e.name;r=kc(e)||mc(e)||vc(e)?Vc(e):Bc(e)}return r.name_}function $c(e){var t=jl(),r=Tl(!0);Yl();try{return e()}finally{Ql(),Sl(r),Ul(t)}}Object.entries(ic).forEach(function(e){var t=e[0],r=e[1];"concat"!==t&&Jo(Ic.prototype,t,r)}),jc(1e3);var qc,Wc=Lo.toString;function Hc(e,t,r){return void 0===r&&(r=-1),Zc(e,t,r)}function Zc(e,t,r,n,i){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!=e)return t!=t;var s=typeof e;if("function"!==s&&"object"!==s&&"object"!=typeof t)return!1;var o=Wc.call(e);if(o!==Wc.call(t))return!1;switch(o){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0===+e?1/+e==1/t:+e===+t;case"[object Date]":case"[object Boolean]":return+e===+t;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":r>=0&&r++}e=Kc(e),t=Kc(t);var a="[object Array]"===o;if(!a){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,u=t.constructor;if(l!==u&&!(Zo(l)&&l instanceof l&&Zo(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),a){if((c=e.length)!==t.length)return!1;for(;c--;)if(!Zc(e[c],t[c],r-1,n,i))return!1}else{var h=Object.keys(e),d=h.length;if(Object.keys(t).length!==d)return!1;for(var f=0;f<d;f++){var p=h[f];if(!la(t,p)||!Zc(e[p],t[p],r-1,n,i))return!1}}return n.pop(),i.pop(),!0}function Kc(e){return cc(e)?e.slice():ra(e)||mc(e)||na(e)||vc(e)?Array.from(e.entries()):e}var Xc=(null==(qc=Do().Iterator)?void 0:qc.prototype)||{};function Yc(e){return e[Symbol.iterator]=Qc,Object.assign(Object.create(Xc),e)}function Qc(){return this}function Jc(e){return e instanceof Object&&"string"==typeof e.annotationType_&&Zo(e.make_)&&Zo(e.extend_)}["Symbol","Map","Set"].forEach(function(e){void 0===Do()[e]&&Po("MobX requires global '"+e+"' to be available or polyfilled")}),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return"production"===process.env.NODE_ENV?(console.warn("[mobx.spy] Is a no-op in production builds"),function(){}):(Hl.spyListeners.push(e),Wo(function(){Hl.spyListeners=Hl.spyListeners.filter(function(t){return t!==e})}))},extras:{getDebugName:Gc},$mobx:Ea});class eh{constructor(){Qu(this)}_visible=ml.map();getIsVisible(e){return this._visible.get(e)??!1}_setVisible({name:e,value:t}){this._visible.set(e,t)}openModal(e){this._setVisible({name:e,value:!0})}closeModal(e){this._setVisible({name:e,value:!1})}closeAllModals(){this._visible.clear()}}class th{constructor(){Qu(this)}_isUnauthorized=!1;get isUnauthorized(){return this._isUnauthorized}set isUnauthorized(e){this._isUnauthorized=e}}const rh=new class{authStore=new th;modalStore=new eh},nh=r.createContext(rh),ih=({children:t})=>e(nh.Provider,{value:rh,children:t}),sh=()=>{const e=r.useContext(nh);if(null===e)throw new Error("You have forgotten to wrap your root component with RootStoreProvider");return e};class oh{client;constructor(e){this.client=po.create({baseURL:e,timeout:1e4,headers:{"Content-Type":"application/json"}}),this.setupInterceptors()}setupInterceptors(){this.client.interceptors.request.use(e=>(rh.authStore.isUnauthorized=!1,e),e=>Promise.reject(e)),this.client.interceptors.response.use(e=>e,e=>(401===e.status&&(rh.authStore.isUnauthorized=!0),Promise.reject(e)))}async get({url:e,config:t}){return(await this.client.get(e,t)).data}async post({url:e,body:t,config:r}){return(await this.client.post(e,t,r)).data}async put({url:e,body:t,config:r}){return(await this.client.put(e,t,r)).data}async delete({url:e,config:t}){return(await this.client.delete(e,t)).data}}const ah=e=>new oh(e);class lh{_apiService;get apiService(){return this._apiService}static _instance=null;static get instance(){if(!lh._instance)throw new Error("Dartcom Config не инициализирован с приватным ключом. Вызовите Config.initialize(...) первым, чтобы иметь возможность пользоваться компонентами нашей библиотеки");return lh._instance}static initialize(e){lh._instance||(lh._instance=new lh(e))}static deactivate(){this._instance=null}constructor({apiKey:e,backendUrl:t,onCheck:r}){this._apiKey=e,this._apiService=ah(t),this._getCheckKeyData().then(e=>{if(e){const{valid:t}=e;r?.(e),this.isValidApiKey=t}})}_apiKey="";_isValidApiKey=!1;get isValidApiKey(){return this._isValidApiKey}set isValidApiKey(e){this._isValidApiKey=e}async _getCheckKeyData(){const e=await this._apiService.get({url:"check_tile_token",config:{params:{tile_token:this._apiKey}}}).then(e=>e).catch(({response:e})=>{if(e){const{data:{detail:t}}=e;return t}});return e}}const uh={valid:"18c38ab326d12f428e90be50a5141fc8949de497df7f7e0c1796d58e99d006f3",dateExpired:"8cbc5e15e61e649daf57c3a08422ae372c101afb4759036a3864a9fa588ef717",off:"b1520018920b33a4c1f8100c4f3bb3eb93661db829faa99c9cd75537f6300ba9",invalid:"abcdefghijklmnopqrstuvwxyz0123456789"};var ch,hh;var dh,fh,ph=(hh||(hh=1,ch=function(){const e=["a","b","c","d","e","f","0","1","2","3","4","5","6","7","8","9"];let t=[];for(let r=0;r<36;r++)t[r]=8===r||13===r||18===r||23===r?"-":e[Math.ceil(Math.random()*e.length-1)];return t.join("")}),ch),mh=si(ph);!function(e){e.GET="GET",e.DELETE="DELETE",e.PUT="PUT",e.POST="POST"}(dh||(dh={})),function(e){e.TOP_RIGHT="top-right",e.BOTTOM_RIGHT="bottom-right",e.BOTTOM_LEFT="bottom-left",e.TOP_LEFT="top-left"}(fh||(fh={}));const _h="https://dalganmap.ru/api";var gh,yh;!function(e){e.ONE_WAY='"OneWay"',e.POINT_ADDRESS='"PointAddress"',e.BUILDING_AREA='"MapBuildingECArea"',e.BUILTUP_AREA='"MapAdminBuiltupArea"',e.ADMIN_AREA='"MapAdminArea"',e.OCEAN_AREA='"MapOceanArea"',e.OCEAN_AREA_LABEL='"MapOceanAreaLabel"',e.FACILITY_AREA='"MapFacilityArea"',e.FACILITY_AREA_LABEL='"MapFacilityAreaLabel"',e.LANDUSE_AREA='"MapLanduseArea"',e.LANDUSE_AREA_LABEL='"MapLanduseAreaLabel"',e.NATURE_FIELD='"MapNatureField"',e.NATURE_FOREST='"MapNatureForest"',e.LINK='"Link"',e.RAILROAD_LINK='"MapRailroadLink"',e.WATER_LINK='"MapWaterLink"',e.WATER_AREA='"MapWaterArea"',e.WATER_AREA_LABEL='"MapWaterAreaLabel"',e.WATER_LAKE_LABEL='"MapWaterLakeLabel"',e.POI='"POI"',e.CITY_POI='"CityPOI"',e.CONDITIONS='"Conditions"',e.ROAD_POLY='"RoadPoly"',e.PARKING_LINE='"ParkingLine"',e.LINE_MARKING_LINE='"LaneMarkingLine"',e.LINE_MARKING_POLY='"LaneMarkingPoly"',e.TRAFFIC_SIGN='"TrafficSign"',e.TRAFFIC_SIGNAL='"TrafficSignal"',e.CAMERA='"Camera"',e.PILLAR='"Pillar"'}(gh||(gh={})),function(e){e.TILE="tile",e.NATURE_TILE="nature_tile",e.MSK="msk"}(yh||(yh={}));const vh=256,bh="https://dalganmap.ru/api-image/images",xh={[yh.TILE]:`${_h}/tiles/get_tile/{z}/{x}/{y}.mvt`,[yh.NATURE_TILE]:`${_h}/tiles/get_nature_tile/{z}/{x}/{y}.mvt`,[yh.MSK]:"http://89.108.118.23:3070/tiles/get_tile/{z}/{x}/{y}.mvt"},wh=e=>{const t=[],r={source:e,layer:gh.ROAD_POLY},n={id:mh(),data:r,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'Road';\n\n return isFilter;\n }",draw:{polygons:{color:"#BABCC2"}}},i={id:mh(),data:r,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'Tram';\n\n return isFilter;\n }",draw:{polygons:{color:"#ADA8A8"}}},s={id:mh(),data:r,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'Curb';\n\n return isFilter;\n }",draw:{polygons:{color:"#D2D9E6"}}},o={id:mh(),data:r,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'Bridge';\n\n return isFilter;\n }",draw:{polygons:{color:"#E1DFDD"}}};return t.push(n,i,s,o),t},Ah=e=>{const t=[],r={source:e,layer:gh.LINE_MARKING_POLY},n={id:mh(),data:r,filter:"function() {\n const { poly_number } = feature;\n\n const isFilter = poly_number === '1.14.1';\n\n return isFilter;\n }",draw:{styles:{zebra_crossing:{attributes:{a_angle:"function() {\n return feature.angle;\n }"}}}}},i={id:mh(),data:r,filter:"function() {\n const { poly_number } = feature;\n\n const isFilter = poly_number === '1.18';\n\n return isFilter;\n }",draw:{polygons:{color:"white"}}};return t.push(i,n),t},Eh=e=>{const t=[],r={source:e,layer:gh.LINE_MARKING_LINE},n="white",i=.5,s={id:mh(),data:r,sublayers:{1.1:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.1';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i}}},1.5:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.5';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,dash:[4,10]}}},1.6:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.6';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,dash:[5,5]}}},"1.16.1":{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.16.1';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i}}},1.7:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.7';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,dash:[4,10]}}},"1.7-blue":{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.7blue';\n\n return isFilter;\n }",draw:{lines:{color:"blue",width:i,dash:[4,10]}}},"1.14.3":{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.14.3';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,dash:[3,8]}}},1.12:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.12';\n\n return isFilter;\n }",draw:{lines:{color:n,width:1.5}}},"1.17.1":{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.17.1';\n\n return isFilter;\n }",draw:{lines:{color:"yellow",width:i}}},1.26:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.26';\n\n return isFilter;\n }",draw:{lines:{color:"yellow",width:i}}}}},o={"1.3-left":{id:mh(),data:r,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.3';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,offset:-.5}}},"1.3-right":{id:mh(),data:r,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.3';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,offset:i}}},"1.11r-left":{id:mh(),data:r,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11r';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,offset:-.5}}},"1.11r-right":{id:mh(),data:r,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11r';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,offset:i,dash:[5,5]}}},"1.11l-left":{id:mh(),data:r,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11l';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,offset:-.5,dash:[5,5]}}},"1.11l-right":{id:mh(),data:r,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11l';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,offset:i}}},"1.25-left":{id:mh(),data:r,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.25';\n\n return isFilter;\n }",draw:{lines:{color:n,width:1,offset:-.5,dash:[1,1],dash_background_color:[0,0,0,0]}}},"1.25-right":{id:mh(),data:r,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.25';\n\n return isFilter;\n }",draw:{lines:{color:"rgba(0,0,0,0)",width:1,offset:.5,dash:[1,1],dash_background_color:[1,1,1]}}}};return t.push(s,...Object.values(o)),t},Th=e=>{const t=[],r={source:e,layer:gh.PARKING_LINE},n={id:mh(),data:r,draw:{lines:{color:"white",width:1}}};return t.push(n),t};var Sh={global:{links:{getIsConstruction:"function (feature) {\n const { construction } = feature;\n\n return construction;\n}\n",getIsFunctionalClass:"function (feature) {\n const { functional_class, access_id } = feature;\n\n return functional_class === 5 && access_id === 32;\n}\n",getIsLowMobility:"function (feature) {\n const { functional_class, low_mobility } = feature;\n\n return functional_class === 5 && low_mobility === 1;\n}\n"}},cameras:{camera1:{type:"perspective",vanishing_point:[0,-500]}},textures:{arrow:{url:"https://dalganmap.ru/api-image/images/arrow-20.png",sprites:{base:[0,0,20,20]}},"traffic-signal":{url:"https://dalganmap.ru/api-image/images/conditions/traffic-signal.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},pedestrian_crossing:{url:"https://dalganmap.ru/api-image/images/conditions/pedestrian_crossing.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},physical:{url:"https://dalganmap.ru/api-image/images/conditions/physical.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},gate:{url:"https://dalganmap.ru/api-image/images/conditions/gate.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_3578:{url:"https://dalganmap.ru/api-image/images/POI/3578.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5813:{url:"https://dalganmap.ru/api-image/images/POI/5813.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5541:{url:"https://dalganmap.ru/api-image/images/POI/5541.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5540:{url:"https://dalganmap.ru/api-image/images/POI/5540.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9530(Mail)":{url:"https://dalganmap.ru/api-image/images/POI/mail.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9530(Delivery)":{url:"https://dalganmap.ru/api-image/images/POI/delivery.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5400:{url:"https://dalganmap.ru/api-image/images/POI/5400.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_6000:{url:"https://dalganmap.ru/api-image/images/POI/6000.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9565:{url:"https://dalganmap.ru/api-image/images/POI/9565.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9583:{url:"https://dalganmap.ru/api-image/images/POI/9583.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_8060:{url:"https://dalganmap.ru/api-image/images/POI/8060.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5511:{url:"https://dalganmap.ru/api-image/images/POI/5511.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5512:{url:"https://dalganmap.ru/api-image/images/POI/5512.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5800:{url:"https://dalganmap.ru/api-image/images/POI/5800.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5999:{url:"https://dalganmap.ru/api-image/images/POI/5999.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7011:{url:"https://dalganmap.ru/api-image/images/POI/7011.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7389:{url:"https://dalganmap.ru/api-image/images/POI/7389.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7832:{url:"https://dalganmap.ru/api-image/images/POI/7832.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7929:{url:"https://dalganmap.ru/api-image/images/POI/7929.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7990:{url:"https://dalganmap.ru/api-image/images/POI/7990.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7999:{url:"https://dalganmap.ru/api-image/images/POI/7999.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_8410:{url:"https://dalganmap.ru/api-image/images/POI/8410.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9517:{url:"https://dalganmap.ru/api-image/images/POI/9517.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9718:{url:"https://dalganmap.ru/api-image/images/POI/9718.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(mosque)":{url:"https://dalganmap.ru/api-image/images/POI/9992_mosque.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(church)":{url:"https://dalganmap.ru/api-image/images/POI/9992_church.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(temple)":{url:"https://dalganmap.ru/api-image/images/POI/9992_temple.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(davidStar)":{url:"https://dalganmap.ru/api-image/images/POI/9992_davidStar.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(mortar)":{url:"https://dalganmap.ru/api-image/images/POI/9992_mortar.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_4100(metro)":{url:"https://dalganmap.ru/api-image/images/POI/4100_metro.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_4100(diameter)":{url:"https://dalganmap.ru/api-image/images/POI/4100_diameter.png",filtering:"mipmap",sprites:{base:[0,0,41,15]}},POI_4013:{url:"https://dalganmap.ru/api-image/images/POI/4013.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}}},layers:null,styles:{buildings:{base:"polygons",shaders:{blocks:{color:"color.rgb;\n"}}}},lights:{light1:{type:"directional",direction:[.1,.5,-1],diffuse:.7,ambient:.5}},sources:null};const kh=e=>{const t=[],r={source:e,layer:gh.BUILTUP_AREA},n={id:mh(),data:r,draw:{polygons:{color:"#CFC8C8"}}};return t.push(n),t},Oh=e=>{const t=[],r={source:e,layer:gh.POINT_ADDRESS,minzoom:15},n={id:mh(),data:r,draw:{text:{text_source:"address",font:{fill:"black",size:"12px"}}}};return t.push(n),t},Rh='function() {\n const { poi_name, cat_id } = feature;\n\n switch (+cat_id) {\n case 4100: {\n const text = poi_name.replaceAll(/(Метро-|Станция-|МЦД-)/g, "");\n\n return text;\n }\n\n default: {\n return poi_name;\n }\n }\n}',Ch=[3578,4013,4100,5400,5511,5512,5540,5541,5800,5813,5999,6e3,7011,7389,7832,7929,7990,8060,8410,9517,9530,9565,9583,9718,9992],Nh=e=>{const t={};switch(e){case 4100:t[`_${e}-metro`]={filter:`function() {\n const { poi_name, cat_id } = feature;\n\n const isMetro = poi_name.startsWith('Метро-');\n const isStation = poi_name.startsWith('Станция-');\n\n const isCatId = +cat_id === ${e};\n\n const isFilter = isCatId && (isMetro || isStation);\n\n return isFilter;\n }`,draw:{points:Ph({texture:`POI_${e}(metro)`})}},t[`_${e}-diameter`]={filter:`function() {\n const { cat_id, poi_name } = feature;\n\n const isDiameter = poi_name.startsWith('МЦД-');\n\n const isCatId = +cat_id === ${e};\n\n const isFilter = isCatId && isDiameter;\n\n return isFilter;\n }`,draw:{points:Ph({texture:`POI_${e}(diameter)`,size:[41,15]})}};break;case 9530:t[`_${e}-mail`]={filter:`function() {\n const { cat_id, poi_name = '' } = feature;\n\n const isCatId = +cat_id === ${e};\n\n const isMail = poi_name.startsWith('Почта');\n\n const isFilter = isCatId && isMail;\n\n return isFilter;\n }`,draw:{points:Ph({texture:`POI_${e}(Mail)`})}},t[`_${e}-delivery`]={filter:`function() {\n const { cat_id, poi_name = '' } = feature;\n\n const isCatId = +cat_id === ${e};\n \n const isMail = poi_name.startsWith('Почта');\n\n const isFilter = isCatId && !isMail;\n\n return isFilter;\n }`,draw:{points:Ph({texture:`POI_${e}(Delivery)`})}};break;case 9992:{const r={mosque:1,church:2,temple:3,davidStar:4,mortar:6};Object.entries(r).forEach(([r,n])=>{t[`_${e}-${r}`]={filter:`function() {\n const { cat_id, subcat_id } = feature;\n\n const isCatId = +cat_id === ${e};\n const isSubcatId = +subcat_id === ${n};\n\n const isFilter = isCatId && isSubcatId;\n\n return isFilter;\n }`,draw:{points:Ph({texture:`POI_${e}(${r})`})}}});break}default:t[`_${e}`]={filter:`function() {\n const { cat_id } = feature;\n\n const isFilter = +cat_id === ${e};\n\n return isFilter;\n }`,draw:{points:Ph({texture:`POI_${e}`})}}}return t},Ph=({texture:e,size:t=20})=>({texture:e,size:t,sprite:"base",placement:"midpoint"}),Mh=Ch.reduce((e,t)=>({...e,...Nh(t)}),{}),Dh=e=>{const t=[],r={id:mh(),data:{source:e,layer:gh.POI},draw:{points:{text:{text_source:Rh,font:{fill:"#464544",size:"12px"}}}},sublayers:Mh};return t.push(r),t},zh=e=>{const t=[],r={source:e,layer:gh.CITY_POI},n={id:mh(),data:r,filter:"function() {\n const { capital_order8, capital_order2, capital_order1, poi_name, priority } = feature;\n\n if ($zoom >= 9 && $zoom < 13) {\n return priority < 8;\n }\n\n if ($zoom <= 11) {\n return capital_order8 === 'Y';\n }\n\n if ($zoom >= 15) {\n return capital_order2 !== 'Y';\n }\n\n return true;\n }\n ",draw:{text:{text_source:"poi_name",priority:"function () {\n const { priority } = feature;\n\n if ($zoom <= 15) {\n return priority;\n }\n\n return 1;\n }\n ",font:{fill:"black",size:"function() {\n const { capital_order8 } = feature;\n\n if (capital_order8 === 'Y') {\n return '16px';\n }\n\n return '12px';\n }",weight:"function() {\n const { capital_order2 } = feature;\n\n if (capital_order2 === 'Y') {\n return 'bold';\n }\n\n return 'normal';\n }",stroke:{color:"white",width:"2px"}}}}};return t.push(n),t},Ih=e=>{const t=[],r={id:mh(),data:{source:e,layer:gh.ONE_WAY},draw:{points:{texture:"arrow",sprite:"base",angle:"function() {\n const { bearing } = feature;\n \n return bearing;\n }\n "}}};return t.push(r),t};var Fh;!function(e){e.traffic_signal="traffic_signal",e.pedestrian_crossing="pedestrian_crossing",e.physical="physical",e.gate="gate"}(Fh||(Fh={}));const Lh=e=>{const t=[],r={},n={source:e,layer:gh.CONDITIONS},i={id:mh(),data:n};return Object.values(Fh).forEach(e=>{r[`_${e}`]={filter:`function() {\n const { type } = feature;\n\n const isShow = type === '${e}';\n\n return isShow;\n }`,draw:{points:{texture:e,sprite:"base",placement:"midpoint"}}}}),i.sublayers=r,t.push(i),t},jh=e=>{const t=[],r={source:e,layer:gh.RAILROAD_LINK},n={id:mh(),data:r,draw:{lines:{color:"#A3A8A",width:5,dash:[1,2],dash_background_color:[0,0,0],join:"round"}}};return t.push(n),t},Uh=e=>{const t=[],r={id:mh(),data:{source:e,layer:gh.WATER_AREA},draw:{polygons:{color:"#7DBEE4"},lines:{color:"#7DBEE4",width:20,cap:"round",join:"round"}}},n={id:mh(),data:{source:e,layer:gh.WATER_AREA_LABEL},filter:"function() {\n const { display_class } = feature;\n\n if ($zoom >= 14) {\n return true;\n } else {\n return display_class <= 4;\n }\n }",draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"14px",stroke:{color:"white",width:"3px"}}}}},i={id:mh(),data:{source:e,layer:gh.WATER_LAKE_LABEL},filter:"function() {\n const { display_class } = feature;\n\n if ($zoom >= 14) {\n return true;\n } else {\n return display_class <= 4;\n }\n }",draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"14px",stroke:{color:"white",width:"3px"}}}}};return t.push(r,n,i),t},Bh=e=>{const t=[],r={},n={source:e,layer:gh.WATER_LINK},i={id:mh(),data:n};return r.geometry={draw:{lines:{color:"#7DBEE4",width:5,cap:"round",join:"round"}}},r.text={filter:"function() {\n return $zoom >= 10;\n }",draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"14px",stroke:{color:"white",width:"3px"}}}}},i.sublayers=r,t.push(i),t},Vh=e=>{const t=[],r={id:mh(),data:{source:e,layer:gh.OCEAN_AREA},draw:{polygons:{color:"#7DBEE4"}}},n={id:mh(),data:{source:e,layer:gh.OCEAN_AREA_LABEL},draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"18px",stroke:{color:"white",width:"3px"}}}}};return t.push(r,n),t},Gh=e=>{const t=[],r={id:mh(),data:{source:e,layer:gh.LANDUSE_AREA},draw:{polygons:{color:"function() {\n const { feature_type } = feature;\n\n switch (feature_type) {\n case '509998': {\n return '#ECD175';\n }\n\n case '600102':\n case '900140': {\n return '#3E9A8C';\n }\n\n case '900202':\n case '900130':\n case '900150':\n case '900103': {\n return '#96BE7D';\n }\n\n case '9997010': {\n return null;\n }\n }\n }",order:"function() {\n const { feature_type } = feature;\n\n switch(feature_type) {\n case '900150':\n case '900130':\n case '509998': {\n return 300;\n }\n\n default: {\n return 299;\n }\n }\n }"}}},n={id:mh(),data:{source:e,layer:gh.LANDUSE_AREA_LABEL},filter:"function() {\n return $zoom >= 15;\n }",draw:{text:{text_source:"name",font:{size:"13px",fill:"function() {\n const { feature_type } = feature;\n\n switch(feature_type) {\n case '509998': {\n return '#CD7F32';\n }\n\n default: {\n return '#00541F';\n }\n }\n }",stroke:{color:"white",width:"3px"}}}}};return t.push(r,n),t},$h=e=>{const t=[],r={source:e,layer:gh.BUILDING_AREA,minzoom:15},n={id:mh(),data:r,extruded:{draw:{polygons:{style:"buildings",extrude:"function() {\n return $zoom >= 17;\n }"}}},draw:{polygons:{color:"#DDB07B",height:{property:"height"}},lines:{color:"#DB933F",width:"2px",cap:"round",join:"round"}}};return t.push(n),t},qh=e=>{const t=[],r={id:mh(),data:{source:e,layer:gh.FACILITY_AREA},draw:{polygons:{color:"function() {\n const { feature_type } = feature;\n\n switch (feature_type) {\n case '2000408': {\n return '#DBBAC4';\n }\n\n case '1900403': {\n return '#B6C3C7';\n }\n\n case '1907403': {\n return '#A3B9C0';\n }\n\n case '2000123': {\n return '#E4BA7D';\n }\n\n case '2000124': {\n return '#BFE6E3';\n }\n\n case '2000200': {\n return '#A0A9A8';\n }\n\n case '2000403': {\n return '#AF7136';\n }\n\n case '2000420': {\n return '#89AC76';\n }\n\n case '2000457': {\n return '#9494C0';\n }\n\n default: {\n return '#E1D4D4';\n }\n }\n }",order:"function() {\n const { feature_type } = feature;\n\n switch (feature_type) {\n case '1907403': {\n return 301;\n }\n\n default: {\n return 300;\n }\n }\n }"},lines:{color:"#857F7F",width:"2px",cap:"round",join:"round"}}},n={id:mh(),data:{source:e,layer:gh.FACILITY_AREA_LABEL},draw:{text:{text_source:"name",font:{fill:"function() {\n const { feature_type } = feature;\n\n switch(feature_type) {\n case '1900403':\n case '1907403': {\n return '#256D7B';\n }\n\n case '2000420':\n case '2000460':\n case '2000123': {\n return '#00541F';\n }\n\n case '2000408': {\n return '#5E2129';\n }\n\n case '2000124': {\n return '#3E5F8A';\n }\n\n case '2000200': {\n return '#464451';\n }\n\n case '2000403': {\n return '#B03F35';\n }\n\n case '2000457': {\n return '#6A5ACD';\n }\n\n case '1700215':\n case '900159':\n case '900158': {\n return '#474A51';\n }\n\n default: {\n return black;\n }\n }\n }",size:"12px",stroke:{color:"white",width:"3px"}}}}};return t.push(r,n),t},Wh=e=>{const t=[],r={source:e,layer:gh.ADMIN_AREA},n={id:mh(),data:r,draw:{polygons:{color:"#D3D2CF"}}},i={id:mh(),data:r,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'R';\n\n return isFilter;\n }",draw:{lines:{color:"#696969",width:"1px",cap:"round",join:"round"}}},s={id:mh(),data:r,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'D' && $zoom >= 12;\n\n return isFilter;\n }",draw:{lines:{color:"#696969",dash:[4,7],width:"1px",cap:"round",join:"round"}}};return t.push(n,i,s),t},Hh=()=>{const e=[],t={source:yh.NATURE_TILE,layer:gh.NATURE_FIELD},r={id:mh(),data:t,draw:{polygons:{color:"#EBEEC7"}}};return e.push(r),e},Zh=[-1,-.5,-.3,0,.3,.5,.7,1,1.5,2],Kh=[[5],[4,3],[2,1]],Xh="function() {\n const { functional_class, tunnel, tollway } = feature;\n\n const alpha = tunnel ? 0.89 : 1;\n\n const getRGB = (hex, alpha) => {\n const r = +(parseInt(hex.slice(1, 3), 16) / 255).toFixed(2);\n const g = +(parseInt(hex.slice(3, 5), 16) / 255).toFixed(2);\n const b = +(parseInt(hex.slice(5, 7), 16) / 255).toFixed(2);\n\n return [r, g, b, alpha];\n }\n\n if (tollway) {\n return '#D72740';\n }\n\n switch (functional_class) {\n case 1:\n case 2: {\n const color = getRGB('#D1747F', alpha);\n\n return color;\n }\n\n case 3:\n case 4: {\n const color = getRGB('#B1A7AA', alpha);\n\n return color;\n }\n\n case 5: {\n const color = getRGB('#D5CEC3', alpha);\n\n return color;\n }\n }\n}",Yh="function() {\n const { functional_class, road_number } = feature;\n\n const getScale = () => {\n if ($zoom <= 15 && $zoom >= 14) { return 7; }\n\n if ($zoom <= 13 && $zoom >= 12) { return 9; }\n\n if ($zoom <= 5) { return 400; }\n\n if ($zoom <= 7) { return 200; }\n\n if ($zoom < 12) { return 50; }\n\n return 1;\n }\n\n const scale = getScale();\n\n switch(functional_class) {\n case 1:\n case 2: {\n return 8 * scale;\n }\n\n case 3:\n case 4: {\n return 7 * scale;\n }\n\n case 5: {\n if (Boolean(road_number)) {\n return 7 * scale;\n }\n\n return 6;\n }\n }\n}",Qh=e=>{const t=[],r={source:e,layer:gh.LINK},n={id:mh(),data:r,draw:{text:{text_source:"road_number",font:{fill:"#181bff",size:"16px",weight:"bold",underline:!0,background:{color:"black"}}}}};t.push(n);const i={text_source:"street_name",font:{fill:"black",size:"14px",stroke:{color:"white",width:"3px"}}},s=()=>({text:i,lines:{color:Xh,width:Yh,cap:"round",join:"round"}}),o=()=>({lines:{color:Xh,width:Yh,outline:{color:"function() {\n const { functional_class, access_id, tollway } = feature;\n\n if (tollway) {\n return '#B9263B';\n }\n\n switch(functional_class) {\n case 5: {\n return '#989898';\n }\n\n case 3:\n case 4: {\n return '#8F6E78';\n }\n\n case 1:\n case 2: {\n return '#9A414B';\n }\n }\n}",width:"function() {\n const { functional_class, access_id } = feature;\n\n switch(functional_class) {\n case 5: {\n switch (access_id) {\n case 32: {\n return 0;\n }\n\n default: {\n return 1;\n }\n }\n }\n\n default: {\n return 1;\n }\n }\n}"}}});return Zh.forEach(e=>{const n=[],i=[];if(0===e)Kh.forEach(t=>{const a=[],l=[];t.forEach(t=>{const n={id:mh(),data:r,filter:`function() {\n const { functional_class, z_lvl = 0.0 } = feature;\n\n const isFilter = +z_lvl === ${e} && +functional_class === ${t};\n\n return isFilter;\n }`,draw:s(),sublayers:{construction:{filter:"function() {\n return global.links.getIsConstruction(feature);\n }",draw:{lines:{width:3,color:"#9AA096",dash:[2,1]}}},functionalClassAccessId32:{filter:"function() {\n return global.links.getIsFunctionalClass(feature);\n }",draw:{lines:{width:2,color:"#9AA096",dash:[2,1]}}},lowMobility:{filter:"function() {\n return global.links.getIsLowMobility(feature);\n }",draw:{lines:{width:4}}}}},i={id:mh(),data:r,filter:`function() {\n const { functional_class, z_lvl = 0.0 } = feature;\n\n const isFilter = +z_lvl === ${e} && +functional_class === ${t} && !global.links.getIsConstruction(feature) && !global.links.getIsFunctionalClass(feature);\n\n\n return isFilter;\n }`,draw:o(),sublayers:{lowMobility:{filter:"function() {\n return global.links.getIsLowMobility(feature);\n }",draw:{lines:{width:4}}}}};a.push(n),l.push(i)}),n.push(...a),i.push(...l)});else{const t=(e=>`function() {\n const { z_lvl = 0.0 } = feature;\n\n const isFilter = +z_lvl === ${e};\n\n return isFilter;\n }`)(e),a={id:mh(),data:r,filter:t,draw:s()},l={id:mh(),data:r,filter:t,draw:o()};n.push(a),i.push(l)}t.push(...i,...n)}),t},Jh=()=>{const e=[],t={source:yh.NATURE_TILE,layer:gh.NATURE_FOREST},r={id:mh(),data:t,draw:{polygons:{color:"function() {\n const { feature_type } = feature;\n\n switch (feature_type) {\n case '900202': {\n return '#96BE7D';\n }\n\n default : {\n return null;\n }\n }\n }"}}};return e.push(r),e};var ed;!function(e){e.ACTIVE="Действующий",e.INACTIVE="Недействующий",e.TEMPORARY="Временный"}(ed||(ed={}));const td=["1.1","1.10","1.11.1","1.11.2","1.12.1","1.12.2","1.13","1.14","1.15","1.16","1.17","1.18","1.19","1.2","1.20.1","1.20.2","1.20.3","1.21","1.22","1.23","1.24","1.25","1.26","1.27","1.28","1.29","1.3.1","1.3.2","1.30","1.31","1.32","1.33","1.34.1 A","1.34.1 B","1.34.1 C","1.34.2 A","1.34.2 B","1.34.2 C","1.34.3 A","1.34.3 B","1.35","1.4.1","1.4.2","1.4.3","1.4.4","1.4.5","1.4.6","1.5","1.6","1.7","1.8","1.9","2.1","2.2","2.3.1","2.3.2","2.3.3","2.3.4","2.3.5","2.3.6","2.3.7","2.4","2.5","2.6","2.7","3.1","3.10","3.11","3.12","3.13","3.14","3.15","3.16","3.17.1","3.17.2","3.17.3","3.18.1","3.18.2","3.19","3.2","3.20","3.21","3.22","3.23","3.24-50","3.25-50","3.26","3.27","3.28","3.29","3.3","3.30","3.31","3.32","3.33","3.34","3.35","3.4","3.5","3.6","3.7","3.8","3.9","4.1.1","4.1.2","4.1.3","4.1.4","4.1.5","4.1.6","4.2.1","4.2.2","4.2.3","4.3","4.4.1","4.4.2","4.5.1","4.5.2","4.5.3","4.5.4","4.5.5","4.5.6","4.5.7","4.6-50","4.7-50","4.8.1","4.8.2","4.8.3","5.1","5.10","5.11.1","5.11.2","5.12.1","5.12.2","5.13.1","5.13.2","5.13.3","5.13.4","5.14.1","5.14.2","5.14.3","5.14.4","5.15.1","5.15.2 A","5.15.2 B","5.15.2 C","5.15.2 D","5.15.2 E","5.15.2 F","5.15.2 G","5.15.2 H","5.15.2 I","5.15.2 K","5.15.3 A","5.15.3 B","5.15.3 C","5.15.4 A","5.15.4 B","5.15.5","5.15.6","5.15.7 A","5.15.7 B","5.15.7 C","5.15.8","5.16","5.17","5.18","5.19.1","5.19.2","5.19.3","5.19.4 A","5.19.4 B","5.2","5.20","5.21","5.22","5.23.1","5.23.2","5.24.1","5.24.2","5.25","5.26","5.27","5.28","5.29","5.3","5.30","5.31","5.32","5.33","5.34","5.35","5.36","5.37 A","5.37 B","5.38 A","5.38 B","5.39","5.4","5.40","5.5","5.6","5.7.1","5.7.2","5.8","5.9","6.1","6.10.1 A","6.10.1 B","6.10.1 C","6.10.1 D","6.10.1 E","6.10.1 F","6.10.1 G","6.10.2 A","6.10.2 B","6.11 A","6.11 B","6.11 C","6.11 D","6.12 A","6.12 B","6.12 C","6.13 A","6.13 B","6.13 C","6.13 D","6.13 E","6.14.1 A","6.14.1 B","6.14.1 C","6.14.1 D","6.14.2 A","6.14.2 B","6.14.2 C","6.15.1","6.15.2","6.15.3","6.16","6.17","6.18.1","6.18.2","6.18.3","6.19.1","6.19.2","6.2-50","6.20.1","6.20.2","6.21.1","6.21.2","6.22","6.3.1","6.3.2","6.4 A","6.4 B","6.4 C","6.5","6.6","6.7","6.8.1","6.8.2","6.8.3","6.9.1 A","6.9.1 B","6.9.1 C","6.9.1 D","6.9.1 E","6.9.1 F","6.9.2 A","6.9.2 B","6.9.2 C","6.9.3","7.1","7.10","7.11","7.12","7.13","7.14.1","7.14.2","7.15","7.16","7.17","7.18","7.19","7.2","7.20","7.21","7.3","7.4","7.5","7.6","7.7","7.8","7.9","8.1.1","8.1.2","8.1.3","8.1.4","8.10","8.11","8.12","8.13 B","8.13","8.14","8.15","8.16","8.17","8.18","8.19","8.2.1","8.2.2","8.2.3","8.2.4","8.2.5","8.2.6","8.20.1","8.20.2","8.21.1","8.21.2","8.21.3","8.22.1","8.22.2","8.22.3","8.24","8.25","8.26","8.3.1","8.3.2","8.3.3","8.4.1","8.4.10","8.4.11","8.4.12","8.4.13","8.4.14","8.4.15","8.4.2","8.4.3.1","8.4.3.2","8.4.4","8.4.5","8.4.6","8.4.7","8.4.8","8.4.9","8.5.1","8.5.2","8.5.3","8.5.4","8.5.5","8.5.6","8.5.7","8.6.1","8.6.2","8.6.3","8.6.4","8.6.5","8.6.6","8.6.7","8.6.8","8.6.9","8.7","8.8","8.9.1","8.9.2","8.9.3"],rd={map:20,preview:40},nd="traffic-sign",id="svg",sd=new Map,od={20:["1.1","1.10","1.11.1","1.11.2","1.12.1","1.12.2","1.13","1.14","1.15","1.16","1.17","1.18","1.19","1.2","1.20.1","1.20.2","1.20.3","1.21","1.22","1.23","1.24","1.25","1.26","1.27","1.28","1.29","1.3.1","1.3.2","1.30","1.31","1.32","1.33","1.34.1 A","1.34.1 B","1.34.1 C","1.34.2 A","1.34.2 B","1.34.2 C","1.34.3 A","1.34.3 B","1.35","1.5","1.6","1.7","1.8","1.9","2.1","2.2","2.3.1","2.3.2","2.3.3","2.3.4","2.3.5","2.3.6","2.3.7","2.4","2.5","2.6","2.7","3.1","3.10","3.11","3.12","3.13","3.14","3.15","3.16","3.17.1","3.17.2","3.17.3","3.18.1","3.18.2","3.19","3.2","3.20","3.21","3.22","3.23","3.24-50","3.25-50","3.26","3.27","3.28","3.29","3.3","3.30","3.31","3.32","3.33","3.34","3.35","3.4","3.5","3.6","3.7","3.8","3.9","4.1.1","4.1.2","4.1.3","4.1.4","4.1.5","4.1.6","4.2.1","4.2.2","4.2.3","4.3","4.4.1","4.4.2","4.5.1","4.5.2","4.5.3","4.5.4","4.5.5","4.5.6","4.5.7","4.6-50","4.7-50","5.10","5.11.1","5.11.2","5.12.1","5.12.2","5.13.1","5.13.2","5.13.3","5.13.4","5.14.1","5.14.2","5.14.3","5.14.4","5.15.1","5.15.2 A","5.15.2 B","5.15.2 C","5.15.2 D","5.15.2 E","5.15.2 F","5.15.2 G","5.15.2 H","5.15.2 I","5.15.2 K","5.15.3 A","5.15.3 B","5.15.3 C","5.15.4 A","5.15.4 B","5.15.5","5.15.6","5.15.7 A","5.15.7 B","5.15.7 C","5.15.8","5.19.1","5.19.2","5.19.3","5.19.4 A","5.19.4 B","5.20","5.23.1","5.23.2","5.24.1","5.24.2","5.25","5.26","5.5","5.6","5.7.1","5.7.2","5.8","5.9","6.10.1 A","6.10.1 B","6.10.1 C","6.10.1 D","6.10.1 E","6.10.1 F","6.10.1 G","6.10.2 A","6.10.2 B","6.11 A","6.11 B","6.11 C","6.11 D","6.12 A","6.12 B","6.12 C","6.13 A","6.13 B","6.13 C","6.13 D","6.13 E","6.14.1 A","6.14.1 B","6.14.1 C","6.14.1 D","6.14.2 A","6.14.2 B","6.14.2 C","6.15.1","6.15.2","6.15.3","6.16","6.18.1","6.18.2","6.18.3","6.2 - 50","6.20.1","6.20.2","6.21.1","6.21.2","6.22","6.3.1","6.3.2","6.4 A","6.4 B","6.4 C","6.5","6.6","6.7","6.8.1","6.8.2","6.8.3","6.9.1 A","6.9.1 B","6.9.1 C","6.9.1 D","6.9.1 E","6.9.1 F","6.9.2 A","6.9.2 B","6.9.2 C","6.9.3","8.1.1","8.1.2","8.1.3","8.1.4","8.10","8.11","8.12","8.13 B","8.13","8.14","8.15","8.16","8.17","8.18","8.19","8.2.1","8.2.5","8.2.6","8.20.1","8.20.2","8.21.1","8.21.2","8.21.3","8.24","8.25","8.26","8.3.1","8.3.2","8.3.3","8.4.1","8.4.10","8.4.11","8.4.12","8.4.13","8.4.14","8.4.15","8.4.2","8.4.3.1","8.4.3.2","8.4.4","8.4.5","8.4.6","8.4.7","8.4.8","8.4.9","8.5.1","8.5.2","8.5.3","8.5.4","8.5.5","8.5.6","8.5.7","8.6.1","8.6.2","8.6.3","8.6.4","8.6.5","8.6.6","8.6.7","8.6.8","8.6.9","8.7","8.8","8.9.1","8.9.2","8.9.3"],25:["6.17","6.19.1","6.19.2"],30:["4.8.1","4.8.2","4.8.3","5.1","5.16","5.17","5.18","5.2","5.21","5.22","5.27","5.28","5.29","5.3","5.30","5.31","5.32","5.33","5.34","5.35","5.36","5.37 A","5.37 B","5.38 A","5.38 B","5.39","5.4","5.40","6.1","7.1","7.10","7.11","7.12","7.13","7.14.1","7.14.2","7.15","7.16","7.17","7.18","7.19","7.2","7.20","7.21","7.3","7.4","7.5","7.6","7.7","7.8","7.9"],40:["1.4.1","1.4.2","1.4.3","1.4.4","1.4.5","1.4.6","8.2.2","8.2.3","8.2.4"],68:["8.22.1","8.22.2","8.22.3"]};Object.entries(od).forEach(([e,t])=>{t.forEach(t=>{sd.set(t,{width:rd.map,height:+e})})});const ad={"Предупреждающие знаки":[],"Знаки приоритета":[],"Запрещающие знаки":[],"Предписывающие знаки":[],"Знаки особых предписаний":[],"Информационные знаки":[],"Знаки сервиса":[]},ld=Object.keys(ad).map(e=>({label:e,value:e})),ud=Object.values(ed).map(e=>({label:e,value:e})),cd={traffic_sign_id:"",dit_id:"",tsodd_id:"",pillar_id:"",dops:"",comment:"Комментарий",direction:"Направление",traffic_sign_number:"Номер знака",traffic_sign_title:"Название знака",traffic_sign_value:"Название знака",traffic_sign_type:"Тип знака",lat:"Широта",lon:"Долгота",future_maintanance_date:"Дата следующего обслуживания",placement_date:"Дата установки",rapair_performed_date:"Дата последнего ремонта",verification_date:"Дата поверки",warranty_expr_date:"Дата окончания гарантии",status:"Статус"},hd=e=>{const t=[],r={source:e,layer:gh.TRAFFIC_SIGN},n={},i={};td.forEach(e=>{const t=`${nd}-${e}`,r=sd.get(e);if(r){const{width:s,height:o}=r,a=dd({type:"map",number:e});n[t]={url:a,filtering:"mipmap",sprites:{base:[0,0,s,o]}},i[t]={filter:`function() {\n const { traffic_sign_number } = feature;\n\n const isFilter = traffic_sign_number === '${e}';\n\n return isFilter;\n }`,draw:{points:{collide:!1,texture:t,size:[s,o],sprite:"base",placement:"midpoint"}}}}});const s={id:mh(),data:r,textures:n,sublayers:i};return t.push(s),t},dd=({type:e,number:t})=>`${bh}/msk/${nd}_${rd[e]}/${t}.svg`,fd=e=>{const t=[],r={source:e,layer:gh.TRAFFIC_SIGNAL},n={},i="traffic_signal";n[i]={url:`https://dalganmap.ru/api-image/images/msk/${i}/${i}_20.svg`,filtering:"mipmap",sprites:{base:[0,0,20,20]}};const s={id:mh(),data:r,draw:{points:{collide:!1,texture:i,size:20,sprite:"base",placement:"midpoint"}},textures:n,sublayers:{}};return t.push(s),t},pd=e=>{const t=[],r={source:e,layer:gh.CAMERA},n={},i="camera";n[i]={url:`https://dalganmap.ru/api-image/images/msk/${i}/${i}_20.png`,filtering:"mipmap",sprites:{base:[0,0,20,20]}};const s={id:mh(),data:r,draw:{points:{collide:!1,texture:i,size:20,sprite:"base",placement:"midpoint"}},textures:n,sublayers:{}};return t.push(s),t},md=e=>{const t=[],r={source:e,layer:gh.PILLAR},n={},i="pillar";n[i]={url:`https://dalganmap.ru/api-image/images/msk/${i}/${i}_20.png`,filtering:"mipmap",sprites:{base:[0,0,20,20]}};const s={id:mh(),data:r,draw:{points:{collide:!1,texture:i,size:20,sprite:"base",placement:"midpoint"}},textures:n,sublayers:{}};return t.push(s),t},_d=({id:e,data:{source:t,layer:r}})=>`${e}-${t}-${r}`,gd=({layer:e,order:t,eventHandlers:r})=>{const n=structuredClone(e),{draw:i,sublayers:s}=n,o=Boolean(r?.[e.data.layer]);if(i){const{points:e,lines:r,polygons:s,text:a,styles:l}=i;e&&(i.points={...structuredClone(e),order:t,interactive:o}),r&&(i.lines={...structuredClone(r),order:t,interactive:o}),s&&(i.polygons={...structuredClone(s),order:t,interactive:o}),a&&(i.text={...structuredClone(a),order:t,interactive:o}),l&&(i.styles=Object.entries(l).reduce((e,[r,n])=>({...e,[r]:{...structuredClone(n),order:t}}),{})),n.draw=structuredClone(i)}return s&&(Object.entries(s).forEach(([e,r])=>{if(r){const{draw:n}=r;if(n){const{points:e,lines:i,polygons:s,text:a}=n;a&&(n.text={...structuredClone(a),order:t,interactive:o}),e&&(n.points={...structuredClone(e),order:t,interactive:o}),i&&(n.lines={...structuredClone(i),order:t,interactive:o}),s&&(n.polygons={...structuredClone(s),order:t,interactive:o}),r.draw=structuredClone(n)}s[e]=structuredClone(r)}}),n.sublayers=structuredClone(s)),n},yd=e=>{const t=Wh(e),r=Hh(),n=Jh(),i=kh(e),s=qh(e),o=Gh(e),a=Uh(e),l=Vh(e),u=[];if(e===yh.MSK)u.push(...t,...i,...s,...o,...a,...l);else u.push(...t,...i,...s,...r,...n,...o,...a,...l);return u},vd=e=>{const t=Qh(e),r=jh(e),n=Bh(e),i=Ih(e),s=Lh(e),o=[...n,...r,...t];if(e===yh.MSK);else o.push(...i,...s);return o},bd=e=>{const t=Dh(e),r=zh(e);return[...t,...Oh(e),...r,...hd(e),...fd(e),...pd(e),...md(e)]},xd=e=>{const t=[],r=$h(e),n=yd(e),i=vd(e),s=bd(e),o=wh(e),a=Ah(e),l=Eh(e),u=Th(e);if(e===yh.MSK)t.push(...n,...i,...o,...a,...l,...u,...r,...s);else t.push(...n,...i,...r,...s);return t},wd=({eventHandlers:e})=>{const{instance:{isValidApiKey:t}}=lh,[n,i]=r.useState(null),s=r.useMemo(()=>{if(n){const{scene:e}=n;return e}return null},[n]),[o,a]=r.useState(null),l=r.useCallback(()=>{Promise.resolve().then(function(){return Xg}).then(()=>{if(window.Tangram){const t=window.Tangram.leafletLayer({scene:Sh}),{scene:r}=t;r.subscribe({load:({config:e})=>{a(e)}}),t.on("load",()=>{t.setSelectionEvents({click:({feature:t,leaflet_event:r})=>{if(t){const{source_layer:n,properties:i}=t;e?.[n]?.click?.({leaflet_event:r,properties:i})}},hover:({feature:t,leaflet_event:r})=>{if(t){const{source_layer:n,properties:i}=t;e?.[n]?.hover?.({leaflet_event:r,properties:i})}}})}),i(t)}})},[e]),u=r.useCallback(e=>{if(!s)return void console.warn("Scene не инициализирована");if(!o)return void console.warn("Config не инициализирована");const{name:t}=e;return o.sources[t]=structuredClone(e),s.updateConfig({rebuild:!0}),v()},[s,o]),c=r.useCallback(e=>{if(o)return structuredClone(o.sources[e]);console.warn("Config не инициализирована")},[o]),h=r.useCallback((e,t)=>{if(s){if(o)return o.sources[e].url=t,s.updateConfig({rebuild:!0}),v();console.warn("Config не инициализирована")}else console.warn("Scene не инициализирована")},[o,s]),d=r.useCallback(t=>{if(!s)return void console.warn("Scene не инициализирован");if(!o)return void console.warn("Config не инициализирован");const r=g().length+1,n=gd({layer:t,order:r,eventHandlers:e}),i=_d(n),{sublayers:a,draw:l,textures:u}=n;if(l){const{styles:e}=l;e&&(n.draw={...structuredClone(n.draw),...structuredClone(e)})}return o.layers[i]={...structuredClone(n),...structuredClone(a)},o.textures={...structuredClone(o.textures),...structuredClone(u)},s.updateConfig({rebuild:!0}),g()},[o,s,e]),f=r.useCallback(e=>{if(!s)return void console.warn("Scene не инициализирован");if(!o)return void console.warn("Config не инициализирован");const t=_d(e);return o.layers[t]&&delete o.layers[t],s.updateConfig({rebuild:!0}),g()},[o,s]),p=r.useCallback(({name:e,style:t})=>{s?o?(o.styles[e]=structuredClone(t),s.updateConfig({rebuild:!0})):console.warn("Config не инициализирована"):console.warn("Scene не инициализирована")},[o,s]),m=r.useCallback(e=>{if(!o)return void console.warn("Config не инициализирована");const t=_d(e),{visible:r}=o.layers[t];return r},[o]),_=r.useCallback(({layer:e,visible:t})=>{if(!s)return void console.warn("Scene не инициализирована");if(!o)return void console.warn("Config не инициализирована");const r=_d(e);return o.layers[r].visible=t,s.updateConfig(),m(e)},[o,s]),g=r.useCallback(()=>{if(!o)return[];const{layers:e}=o;return Object.keys(e)},[o]),y=r.useCallback(()=>{if(!o)return[];const{layers:e}=o;Object.values(e).forEach(f)},[o]),v=r.useCallback(()=>{if(!o)return[];const{sources:e}=o;return Object.keys(e)},[o]);return r.useEffect(()=>(t&&l(),()=>{i(null),a(null)}),[t]),r.useEffect(()=>{p({name:"zebra_crossing",style:{base:"polygons",lighting:!1,shaders:{attributes:{a_angle:{type:"float",default:0}},uniforms:{u_stripe_width:1},blocks:{filter:"\n vec3 pos = worldPosition().xyz;\n\n float ang = radians(a_angle);\n\n vec2 dir = vec2(sin(ang), cos(ang));\n\n float positionAlongLine = dot(pos.xy, dir);\n\n float stripe = step(1.0, mod(positionAlongLine / u_stripe_width, 2.0));\n\n color.rgb = mix(vec3(1.0, 1.0, 1.0), vec3(1.0, 0.8, 0.0), stripe);\n \n color.a = 1.0;\n "}}}}),Object.values(yh).forEach(e=>{u({tile_size:256,name:e,url:xh[e],type:"MVT"})})},[p,u]),{layer:n,scene:s,config:o,addSource:u,getSource:c,updateSource:h,addLayer:d,removeLayer:f,addStyle:p,getLayerVisibility:m,toggleLayerVisibility:_,getSources:v,getLayers:g,removeLayers:y}},Ad=({source:e})=>{const{layer:t,addLayer:n}=wd({}),i=oi();return r.useEffect(()=>{t&&i.addLayer(t)},[t]),r.useEffect(()=>{xd(e).map(n)},[n,e]),null},Ed=({children:t,sx:r={},...n})=>e(x,{...n,sx:{padding:"20px 15px",borderRadius:"10px",boxShadow:"0px 8px 24px 0px rgba(0,0,0,0.3)",maxHeight:"80vh",maxWidth:"90vw",overflowX:"auto",...r},children:t}),Td=({color:t="inherit"})=>e(M,{color:t}),Sd=c(null),kd={didCatch:!1,error:null};class Od extends m{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=kd}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(null!==e){for(var t,r,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];null===(t=(r=this.props).onReset)||void 0===t||t.call(r,{args:i,reason:"imperative-api"}),this.setState(kd)}}componentDidCatch(e,t){var r,n;null===(r=(n=this.props).onError)||void 0===r||r.call(n,e,t)}componentDidUpdate(e,t){const{didCatch:r}=this.state,{resetKeys:n}=this.props;var i,s;r&&null!==t.error&&function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some((e,r)=>!Object.is(e,t[r]))}(e.resetKeys,n)&&(null===(i=(s=this.props).onReset)||void 0===i||i.call(s,{next:n,prev:e.resetKeys,reason:"keys"}),this.setState(kd))}render(){const{children:e,fallbackRender:t,FallbackComponent:r,fallback:n}=this.props,{didCatch:i,error:s}=this.state;let o=e;if(i){const e={error:s,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)o=t(e);else if(r)o=_(r,e);else{if(void 0===n)throw s;o=n}}return _(Sd.Provider,{value:{didCatch:i,error:s,resetErrorBoundary:this.resetErrorBoundary}},o)}}const Rd=({error:r,resetErrorBoundary:n})=>t(x,{role:"alert",sx:{padding:"20px",background:"#fee"},children:[e(b,{variant:"h2",children:"Ошибка приложения"}),e(b,{variant:"body1",color:"error",children:r.message}),e(re,{onClick:n,children:"Попробовать снова"})]}),Cd=({children:t,FallbackComponent:r=Rd})=>e(Od,{FallbackComponent:r,children:t});if(!u)throw new Error("mobx-react-lite requires React with Hooks support");if(!function(e,t,r){return $c(function(){var n=Ec(e,r)[Ea];"production"!==process.env.NODE_ENV&&t&&e[va]&&Po("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),null!=t||(t=function(e){return la(e,va)||Jo(e,va,ma({},e[va])),e[va]}(e)),sa(t).forEach(function(e){return n.make_(e,t[e])})}),e})throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function Nd(e){e()}function Pd(e){return Pu(e)}var Md,Dd=function(){function e(e){var t=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=1e4),clearTimeout(t.sweepTimeout),t.sweepTimeout=void 0;var r=Date.now();t.registrations.forEach(function(n,i){r-n.registeredAt>=e&&(t.finalize(n.value),t.registrations.delete(i))}),t.registrations.size>0&&t.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){t.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this.registrations.set(r,{value:t,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.registrations.delete(e)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){void 0===this.sweepTimeout&&(this.sweepTimeout=setTimeout(this.sweep,1e4))}}),e}(),zd=new("undefined"!=typeof FinalizationRegistry?FinalizationRegistry:Dd)(function(e){var t;null===(t=e.reaction)||void 0===t||t.dispose(),e.reaction=null}),Id={exports:{}},Fd={};var Ld,jd,Ud={};
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import n,{useLayoutEffect as i,useEffect as s,useRef as o,useMemo as a,useCallback as l,useState as u,createContext as c,memo as h,useReducer as d,useContext as f,use as p,Component as m,createElement as _,forwardRef as g,cloneElement as y,isValidElement as v}from"react";import{Typography as b,Box as x,List as w,ListItem as A,Slide as E,IconButton as T,Dialog as S,DialogTitle as k,DialogContent as O,DialogContentText as R,DialogActions as C,Button as N,TextField as P,CircularProgress as M}from"@mui/material";import D from"@mui/icons-material/Delete";import z from"@mui/icons-material/Edit";import I from"@mui/material/IconButton";import F from"@mui/material/Checkbox";import L from"@mui/material/FormControlLabel";import{styled as j,createTheme as U,ThemeProvider as B}from"@mui/material/styles";import V from"@mui/material/Typography";import G from"@mui/material/Autocomplete";import{unstable_batchedUpdates as $,createPortal as q}from"react-dom";import W from"@mui/material/Box";import H from"@mui/material/Modal";import{LocalizationProvider as Z}from"@mui/x-date-pickers";import{AdapterDateFns as K}from"@mui/x-date-pickers/AdapterDateFns";import{DateField as X}from"@mui/x-date-pickers/DateField";const Y=({text:t="Нет данных"})=>e(b,{variant:"body2",sx:{textAlign:"center",color:"var(--gray-light-color)"},children:t});function Q({items:n,columnsCount:i=1,getContent:s,title:o,getKey:a,onClick:l,sx:u,isShowNoData:c=!0}){const h=0===n.length;return t(x,{sx:{display:"grid",gridTemplateColumns:"1fr",gap:"15px",...u?.root},children:[o?e(b,{variant:"h6",noWrap:!0,sx:{textAlign:"center",fontWeight:700,...u?.title},children:o}):null,h?e(r.Fragment,{children:c?e(Y,{}):null}):e(w,{sx:{display:"grid",gridTemplateColumns:`repeat(${i}, 1fr)`,gap:"15px",...u?.list},disablePadding:!0,children:n.map((t,r)=>e(A,{onClick:()=>l?.(t,r),sx:{...u?.item},disablePadding:!0,children:s(t,r)},a(t,r)))})]})}const J=r.forwardRef(function(t,r){return e(E,{direction:"up",ref:r,...t})}),ee=({notification:n,onDelete:i})=>{const s=r.useId(),[o,a]=r.useState(!1),l=()=>{a(!1)};return t(r.Fragment,{children:[e(T,{onClick:()=>{n?a(!0):i()},children:e(D,{fontSize:"small",color:"error"})}),n?t(S,{slots:{transition:J},open:o,onClose:l,children:[e(k,{id:`${s}-dialog-title`,children:n.title}),e(O,{children:e(R,{id:`${s}-dialog-text`,children:n.description})}),t(C,{children:[e(N,{variant:"contained",color:"error",sx:{textTransform:"none"},onClick:l,children:"Отмена"}),e(N,{variant:"contained",sx:{textTransform:"none"},onClick:()=>{i(),l()},children:"Подтвердить"})]})]}):null]})},te=t=>{const n=r.useId();return e(r.Fragment,{children:e(T,{id:n,...t,children:e(z,{fontSize:"small",color:"primary"})})})},re=t=>{const{children:r,variant:n="contained",loading:i,icon:s,sx:o,...a}=t;return s?e(I,{...a,loading:i,children:s}):e(N,{sx:{whiteSpace:"nowrap",padding:"5px 15px",textTransform:"none",...o},loading:i,loadingPosition:"start",variant:n,...a,children:r})};var ne=e=>"checkbox"===e.type,ie=e=>e instanceof Date,se=e=>null==e;const oe=e=>"object"==typeof e;var ae=e=>!se(e)&&!Array.isArray(e)&&oe(e)&&!ie(e),le=e=>ae(e)&&e.target?ne(e.target)?e.target.checked:e.target.value:e,ue=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),ce="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function he(e){if(e instanceof Date)return new Date(e);const t="undefined"!=typeof FileList&&e instanceof FileList;if(ce&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!(r||ae(e)&&(e=>{const t=e.constructor&&e.constructor.prototype;return ae(t)&&t.hasOwnProperty("isPrototypeOf")})(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=he(e[t]));return n}var de=e=>/^\w*$/.test(e),fe=e=>void 0===e,pe=e=>Array.isArray(e)?e.filter(Boolean):[],me=e=>pe(e.replace(/["|']|\]/g,"").split(/\.|\[/)),_e=(e,t,r)=>{if(!t||!ae(e))return r;const n=(de(t)?[t]:me(t)).reduce((e,t)=>se(e)?e:e[t],e);return fe(n)||n===e?fe(e[t])?r:e[t]:n},ge=e=>"boolean"==typeof e,ye=e=>"function"==typeof e,ve=(e,t,r)=>{let n=-1;const i=de(t)?[t]:me(t),s=i.length,o=s-1;for(;++n<s;){const t=i[n];let s=r;if(n!==o){const r=e[t];s=ae(r)||Array.isArray(r)?r:isNaN(+i[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=s,e=e[t]}};const be="blur",xe="focusout",we="change",Ae="onBlur",Ee="onChange",Te="onSubmit",Se="onTouched",ke="all",Oe="max",Re="min",Ce="maxLength",Ne="minLength",Pe="pattern",Me="required",De="validate",ze=n.createContext(null);ze.displayName="HookFormContext";const Ie=()=>n.useContext(ze),Fe=e=>{const{children:t,...r}=e;return n.createElement(ze.Provider,{value:r},t)};var Le=(e,t,r,n=!0)=>{const i={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(i,s,{get:()=>{const i=s;return t._proxyFormState[i]!==ke&&(t._proxyFormState[i]=!n||ke),r&&(r[i]=!0),e[i]}});return i};const je="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;var Ue=e=>"string"==typeof e,Be=(e,t,r,n,i)=>Ue(e)?(n&&t.watch.add(e),_e(r,e,i)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),_e(r,e))):(n&&(t.watchAll=!0),r),Ve=e=>se(e)||!oe(e);function Ge(e,t,r=new WeakSet){if(Ve(e)||Ve(t))return Object.is(e,t);if(ie(e)&&ie(t))return e.getTime()===t.getTime();const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const s of n){const n=e[s];if(!i.includes(s))return!1;if("ref"!==s){const e=t[s];if(ie(n)&&ie(e)||ae(n)&&ae(e)||Array.isArray(n)&&Array.isArray(e)?!Ge(n,e,r):!Object.is(n,e))return!1}}return!0}function $e(e){const t=Ie(),{name:r,disabled:i,control:s=t.control,shouldUnregister:o,defaultValue:a,exact:l=!0}=e,u=ue(s._names.array,r),c=n.useMemo(()=>_e(s._formValues,r,_e(s._defaultValues,r,a)),[s,r,a]),h=function(e){const t=Ie(),{control:r=t.control,name:i,defaultValue:s,disabled:o,exact:a,compute:l}=e||{},u=n.useRef(s),c=n.useRef(l),h=n.useRef(void 0),d=n.useRef(r),f=n.useRef(i);c.current=l;const[p,m]=n.useState(()=>{const e=r._getWatch(i,u.current);return c.current?c.current(e):e}),_=n.useCallback(e=>{const t=Be(i,r._names,e||r._formValues,!1,u.current);return c.current?c.current(t):t},[r._formValues,r._names,i]),g=n.useCallback(e=>{if(!o){const t=Be(i,r._names,e||r._formValues,!1,u.current);if(c.current){const e=c.current(t);Ge(e,h.current)||(m(e),h.current=e)}else m(t)}},[r._formValues,r._names,o,i]);je(()=>(d.current===r&&Ge(f.current,i)||(d.current=r,f.current=i,g()),r._subscribe({name:i,formState:{values:!0},exact:a,callback:e=>{g(e.values)}})),[r,a,i,g]),n.useEffect(()=>r._removeUnmounted());const y=d.current!==r,v=f.current,b=n.useMemo(()=>{if(o)return null;const e=!y&&!Ge(v,i);return y||e?_():null},[o,y,i,v,_]);return null!==b?b:p}({control:s,name:r,defaultValue:c,exact:l}),d=function(e){const t=Ie(),{control:r=t.control,disabled:i,name:s,exact:o}=e||{},[a,l]=n.useState(r._formState),u=n.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return je(()=>r._subscribe({name:s,formState:u.current,exact:o,callback:e=>{!i&&l({...r._formState,...e})}}),[s,i,o]),n.useEffect(()=>{u.current.isValid&&r._setValid(!0)},[r]),n.useMemo(()=>Le(a,r,u.current,!1),[a,r])}({control:s,name:r,exact:l}),f=n.useRef(e),p=n.useRef(void 0),m=n.useRef(s.register(r,{...e.rules,value:h,...ge(e.disabled)?{disabled:e.disabled}:{}}));f.current=e;const _=n.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!_e(d.errors,r)},isDirty:{enumerable:!0,get:()=>!!_e(d.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!_e(d.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!_e(d.validatingFields,r)},error:{enumerable:!0,get:()=>_e(d.errors,r)}}),[d,r]),g=n.useCallback(e=>m.current.onChange({target:{value:le(e),name:r},type:we}),[r]),y=n.useCallback(()=>m.current.onBlur({target:{value:_e(s._formValues,r),name:r},type:be}),[r,s._formValues]),v=n.useCallback(e=>{const t=_e(s._fields,r);t&&t._f&&e&&(t._f.ref={focus:()=>ye(e.focus)&&e.focus(),select:()=>ye(e.select)&&e.select(),setCustomValidity:t=>ye(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>ye(e.reportValidity)&&e.reportValidity()})},[s._fields,r]),b=n.useMemo(()=>({name:r,value:h,...ge(i)||d.disabled?{disabled:d.disabled||i}:{},onChange:g,onBlur:y,ref:v}),[r,i,d.disabled,g,y,v,h]);return n.useEffect(()=>{const e=s._options.shouldUnregister||o,t=p.current;t&&t!==r&&!u&&s.unregister(t),s.register(r,{...f.current.rules,...ge(f.current.disabled)?{disabled:f.current.disabled}:{}});const n=(e,t)=>{const r=_e(s._fields,e);r&&r._f&&(r._f.mount=t)};if(n(r,!0),e){const e=he(_e(s._options.defaultValues,r,f.current.defaultValue));ve(s._defaultValues,r,e),fe(_e(s._formValues,r))&&ve(s._formValues,r,e)}return!u&&s.register(r),p.current=r,()=>{(u?e&&!s._state.action:e)?s.unregister(r):n(r,!1)}},[r,s,u,o]),n.useEffect(()=>{s._setDisabledField({disabled:i,name:r})},[i,r,s]),n.useMemo(()=>({field:b,formState:d,fieldState:_}),[b,d,_])}const qe=e=>e.render($e(e));var We=(e,t,r,n,i)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:i||!0}}:{},He=e=>Array.isArray(e)?e:[e],Ze=()=>{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function Ke(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],s=t[n];if(i&&ae(i)&&s){const e=Ke(i,s);ae(e)&&(r[n]=e)}else e[n]&&(r[n]=s)}return r}var Xe=e=>ae(e)&&!Object.keys(e).length,Ye=e=>"file"===e.type,Qe=e=>{if(!ce)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Je=e=>"select-multiple"===e.type,et=e=>"radio"===e.type,tt=e=>Qe(e)&&e.isConnected;function rt(e,t){const r=Array.isArray(t)?t:de(t)?[t]:me(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=fe(e)?n++:e[t[n++]];return e}(e,r),i=r.length-1,s=r[i];return n&&delete n[s],0!==i&&(ae(n)&&Xe(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!fe(e[t]))return!1;return!0}(n))&&rt(e,r.slice(0,-1)),e}function nt(e){return Array.isArray(e)||ae(e)&&!(e=>{for(const t in e)if(ye(e[t]))return!0;return!1})(e)}function it(e,t={}){for(const r in e){const n=e[r];nt(n)?(t[r]=Array.isArray(n)?[]:{},it(n,t[r])):fe(n)||(t[r]=!0)}return t}function st(e,t,r){r||(r=it(t));for(const n in e){const i=e[n];if(nt(i))fe(t)||Ve(r[n])?r[n]=it(i,Array.isArray(i)?[]:{}):st(i,se(t)?{}:t[n],r[n]);else{const e=t[n];r[n]=!Ge(i,e)}}return r}const ot={value:!1,isValid:!1},at={value:!0,isValid:!0};var lt=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!fe(e[0].attributes.value)?fe(e[0].value)||""===e[0].value?at:{value:e[0].value,isValid:!0}:at:ot}return ot},ut=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>fe(e)?e:t?""===e?NaN:e?+e:e:r&&Ue(e)?new Date(e):n?n(e):e;const ct={isValid:!1,value:null};var ht=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,ct):ct;function dt(e){const t=e.ref;return Ye(t)?t.files:et(t)?ht(e.refs).value:Je(t)?[...t.selectedOptions].map(({value:e})=>e):ne(t)?lt(e.refs).value:ut(fe(t.value)?e.ref.value:t.value,e)}var ft=e=>e instanceof RegExp,pt=e=>fe(e)?e:ft(e)?e.source:ae(e)?ft(e.value)?e.value.source:e.value:e,mt=e=>({isOnSubmit:!e||e===Te,isOnBlur:e===Ae,isOnChange:e===Ee,isOnAll:e===ke,isOnTouch:e===Se});const _t="AsyncFunction";var gt=e=>!!e&&!!e.validate&&!!(ye(e.validate)&&e.validate.constructor.name===_t||ae(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===_t)),yt=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const vt=(e,t,r,n)=>{for(const i of r||Object.keys(e)){const r=_e(e,i);if(r){const{_f:e,...s}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!n)return!0;if(e.ref&&t(e.ref,e.name)&&!n)return!0;if(vt(s,t))break}else if(ae(s)&&vt(s,t))break}}};function bt(e,t,r){const n=_e(e,r);if(n||de(r))return{error:n,name:r};const i=r.split(".");for(;i.length;){const n=i.join("."),s=_e(t,n),o=_e(e,n);if(s&&!Array.isArray(s)&&r!==n)return{name:r};if(o&&o.type)return{name:n,error:o};if(o&&o.root&&o.root.type)return{name:`${n}.root`,error:o.root};i.pop()}return{name:r}}var xt=(e,t,r)=>{const n=He(_e(e,r));return ve(n,"root",t[r]),ve(e,r,n),e};function wt(e,t,r="validate"){if(Ue(e)||Array.isArray(e)&&e.every(Ue)||ge(e)&&!e)return{type:r,message:Ue(e)?e:"",ref:t}}var At=e=>ae(e)&&!ft(e)?e:{value:e,message:""},Et=async(e,t,r,n,i,s)=>{const{ref:o,refs:a,required:l,maxLength:u,minLength:c,min:h,max:d,pattern:f,validate:p,name:m,valueAsNumber:_,mount:g}=e._f,y=_e(r,m);if(!g||t.has(m))return{};const v=a?a[0]:o,b=e=>{i&&v.reportValidity&&(v.setCustomValidity(ge(e)?"":e||""),v.reportValidity())},x={},w=et(o),A=ne(o),E=w||A,T=(_||Ye(o))&&fe(o.value)&&fe(y)||Qe(o)&&""===o.value||""===y||Array.isArray(y)&&!y.length,S=We.bind(null,m,n,x),k=(e,t,r,n=Ce,i=Ne)=>{const s=e?t:r;x[m]={type:e?n:i,message:s,ref:o,...S(e?n:i,s)}};if(s?!Array.isArray(y)||!y.length:l&&(!E&&(T||se(y))||ge(y)&&!y||A&&!lt(a).isValid||w&&!ht(a).isValid)){const{value:e,message:t}=Ue(l)?{value:!!l,message:l}:At(l);if(e&&(x[m]={type:Me,message:t,ref:v,...S(Me,t)},!n))return b(t),x}if(!(T||se(h)&&se(d))){let e,t;const r=At(d),i=At(h);if(se(y)||isNaN(y)){const n=o.valueAsDate||new Date(y),s=e=>new Date((new Date).toDateString()+" "+e),a="time"==o.type,l="week"==o.type;Ue(r.value)&&y&&(e=a?s(y)>s(r.value):l?y>r.value:n>new Date(r.value)),Ue(i.value)&&y&&(t=a?s(y)<s(i.value):l?y<i.value:n<new Date(i.value))}else{const n=o.valueAsNumber||(y?+y:y);se(r.value)||(e=n>r.value),se(i.value)||(t=n<i.value)}if((e||t)&&(k(!!e,r.message,i.message,Oe,Re),!n))return b(x[m].message),x}if((u||c)&&!T&&(Ue(y)||s&&Array.isArray(y))){const e=At(u),t=At(c),r=!se(e.value)&&y.length>+e.value,i=!se(t.value)&&y.length<+t.value;if((r||i)&&(k(r,e.message,t.message),!n))return b(x[m].message),x}if(f&&!T&&Ue(y)){const{value:e,message:t}=At(f);if(ft(e)&&!y.match(e)&&(x[m]={type:Pe,message:t,ref:o,...S(Pe,t)},!n))return b(t),x}if(p)if(ye(p)){const e=wt(await p(y,r),v);if(e&&(x[m]={...e,...S(De,e.message)},!n))return b(e.message),x}else if(ae(p)){let e={};for(const t in p){if(!Xe(e)&&!n)break;const i=wt(await p[t](y,r),v,t);i&&(e={...i,...S(t,i.message)},b(i.message),n&&(x[m]=e))}if(!Xe(e)&&(x[m]={ref:v,...e},!n))return x}return b(!0),x};const Tt={mode:Te,reValidateMode:Ee,shouldFocusError:!0};function St(e={}){let t,r={...Tt,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:ye(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},i={},s=(ae(r.defaultValues)||ae(r.values))&&he(r.defaultValues||r.values)||{},o=r.shouldUnregister?{}:he(s),a={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},u=0;const c={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},h={...c};let d={...h};const f={array:Ze(),state:Ze()},p=r.criteriaMode===ke,m=async e=>{if(!a.keepIsValid&&!r.disabled&&(h.isValid||d.isValid||e)){let e;r.resolver?(e=Xe((await b()).errors),_()):e=await x(i,!0),e!==n.isValid&&f.state.next({isValid:e})}},_=(e,t)=>{!r.disabled&&(h.isValidating||h.validatingFields||d.isValidating||d.validatingFields)&&((e||Array.from(l.mount)).forEach(e=>{e&&(t?ve(n.validatingFields,e,t):rt(n.validatingFields,e))}),f.state.next({validatingFields:n.validatingFields,isValidating:!Xe(n.validatingFields)}))},g=(e,t,r,n)=>{const l=_e(i,e);if(l){const i=_e(o,e,fe(r)?_e(s,e):r);fe(i)||n&&n.defaultChecked||t?ve(o,e,t?i:dt(l._f)):E(e,i),a.mount&&!a.action&&m()}},y=(e,t,i,o,a)=>{let l=!1,u=!1;const c={name:e};if(!r.disabled){if(!i||o){(h.isDirty||d.isDirty)&&(u=n.isDirty,n.isDirty=c.isDirty=w(),l=u!==c.isDirty);const r=Ge(_e(s,e),t);u=!!_e(n.dirtyFields,e),r?rt(n.dirtyFields,e):ve(n.dirtyFields,e,!0),c.dirtyFields=n.dirtyFields,l=l||(h.dirtyFields||d.dirtyFields)&&u!==!r}if(i){const t=_e(n.touchedFields,e);t||(ve(n.touchedFields,e,i),c.touchedFields=n.touchedFields,l=l||(h.touchedFields||d.touchedFields)&&t!==i)}l&&a&&f.state.next(c)}return l?c:{}},v=(e,i,s,o)=>{const a=_e(n.errors,e),l=(h.isValid||d.isValid)&&ge(i)&&n.isValid!==i;var c;if(r.delayError&&s?(c=()=>((e,t)=>{ve(n.errors,e,t),f.state.next({errors:n.errors})})(e,s),t=e=>{clearTimeout(u),u=setTimeout(c,e)},t(r.delayError)):(clearTimeout(u),t=null,s?ve(n.errors,e,s):rt(n.errors,e)),(s?!Ge(a,s):a)||!Xe(o)||l){const t={...o,...l&&ge(i)?{isValid:i}:{},errors:n.errors,name:e};n={...n,...t},f.state.next(t)}},b=async e=>{_(e,!0);const t=await r.resolver(o,r.context,((e,t,r,n)=>{const i={};for(const r of e){const e=_e(t,r);e&&ve(i,r,e._f)}return{criteriaMode:r,names:[...e],fields:i,shouldUseNativeValidation:n}})(e||l.mount,i,r.criteriaMode,r.shouldUseNativeValidation));return t},x=async(e,t,i={valid:!0})=>{for(const s in e){const a=e[s];if(a){const{_f:e,...s}=a;if(e){const s=l.array.has(e.name),u=a._f&>(a._f);u&&h.validatingFields&&_([e.name],!0);const c=await Et(a,l.disabled,o,p,r.shouldUseNativeValidation&&!t,s);if(u&&h.validatingFields&&_([e.name]),c[e.name]&&(i.valid=!1,t))break;!t&&(_e(c,e.name)?s?xt(n.errors,c,e.name):ve(n.errors,e.name,c[e.name]):rt(n.errors,e.name))}!Xe(s)&&await x(s,t,i)}}return i.valid},w=(e,t)=>!r.disabled&&(e&&t&&ve(o,e,t),!Ge(C(),s)),A=(e,t,r)=>Be(e,l,{...a.mount?o:fe(t)?s:Ue(e)?{[e]:t}:t},r,t),E=(e,t,r={})=>{const n=_e(i,e);let s=t;if(n){const r=n._f;r&&(!r.disabled&&ve(o,e,ut(t,r)),s=Qe(r.ref)&&se(t)?"":t,Je(r.ref)?[...r.ref.options].forEach(e=>e.selected=s.includes(e.value)):r.refs?ne(r.ref)?r.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(s)?e.checked=!!s.find(t=>t===e.value):e.checked=s===e.value||!!s)}):r.refs.forEach(e=>e.checked=e.value===s):Ye(r.ref)?r.ref.value="":(r.ref.value=s,r.ref.type||f.state.next({name:e,values:he(o)})))}(r.shouldDirty||r.shouldTouch)&&y(e,s,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&R(e)},T=(e,t,r)=>{for(const n in t){if(!t.hasOwnProperty(n))return;const s=t[n],o=e+"."+n,a=_e(i,o);(l.array.has(e)||ae(s)||a&&!a._f)&&!ie(s)?T(o,s,r):E(o,s,r)}},S=(e,t,r={})=>{const u=_e(i,e),c=l.array.has(e),p=he(t);ve(o,e,p),c?(f.array.next({name:e,values:he(o)}),(h.isDirty||h.dirtyFields||d.isDirty||d.dirtyFields)&&r.shouldDirty&&f.state.next({name:e,dirtyFields:st(s,o),isDirty:w(e,p)})):!u||u._f||se(p)?E(e,p,r):T(e,p,r),yt(e,l)&&f.state.next({...n,name:e}),f.state.next({name:a.mount?e:void 0,values:he(o)})},k=async e=>{a.mount=!0;const s=e.target;let u=s.name,c=!0;const g=_e(i,u),w=e=>{c=Number.isNaN(e)||ie(e)&&isNaN(e.getTime())||Ge(e,_e(o,u,e))},A=mt(r.mode),E=mt(r.reValidateMode);if(g){let a,S;const k=s.type?dt(g._f):le(e),O=e.type===be||e.type===xe,C=!((T=g._f).mount&&(T.required||T.min||T.max||T.maxLength||T.minLength||T.pattern||T.validate)||r.resolver||_e(n.errors,u)||g._f.deps)||((e,t,r,n,i)=>!i.isOnAll&&(!r&&i.isOnTouch?!(t||e):(r?n.isOnBlur:i.isOnBlur)?!e:!(r?n.isOnChange:i.isOnChange)||e))(O,_e(n.touchedFields,u),n.isSubmitted,E,A),N=yt(u,l,O);ve(o,u,k),O?s&&s.readOnly||(g._f.onBlur&&g._f.onBlur(e),t&&t(0)):g._f.onChange&&g._f.onChange(e);const P=y(u,k,O),M=!Xe(P)||N;if(!O&&f.state.next({name:u,type:e.type,values:he(o)}),C)return(h.isValid||d.isValid)&&("onBlur"===r.mode?O&&m():O||m()),M&&f.state.next({name:u,...N?{}:P});if(!O&&N&&f.state.next({...n}),r.resolver){const{errors:e}=await b([u]);if(_([u]),w(k),c){const t=bt(n.errors,i,u),r=bt(e,i,t.name||u);a=r.error,u=r.name,S=Xe(e)}}else _([u],!0),a=(await Et(g,l.disabled,o,p,r.shouldUseNativeValidation))[u],_([u]),w(k),c&&(a?S=!1:(h.isValid||d.isValid)&&(S=await x(i,!0)));c&&(g._f.deps&&(!Array.isArray(g._f.deps)||g._f.deps.length>0)&&R(g._f.deps),v(u,S,a,P))}var T},O=(e,t)=>{if(_e(n.errors,t)&&e.focus)return e.focus(),1},R=async(e,t={})=>{let s,o;const a=He(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await b(e);if(_(e),e)for(const r of e){const e=_e(t,r);e?ve(n.errors,r,e):rt(n.errors,r)}else n.errors=t;return t})(fe(e)?e:a);s=Xe(t),o=e?!a.some(e=>_e(t,e)):s}else e?(o=(await Promise.all(a.map(async e=>{const t=_e(i,e);return await x(t&&t._f?{[e]:t}:t)}))).every(Boolean),(o||n.isValid)&&m()):o=s=await x(i);return f.state.next({...!Ue(e)||(h.isValid||d.isValid)&&s!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:s}:{},errors:n.errors}),t.shouldFocus&&!o&&vt(i,O,e?a:l.mount),o},C=(e,t)=>{let r={...a.mount?o:s};return t&&(r=Ke(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),fe(e)?r:Ue(e)?_e(r,e):e.map(e=>_e(r,e))},N=(e,t)=>({invalid:!!_e((t||n).errors,e),isDirty:!!_e((t||n).dirtyFields,e),error:_e((t||n).errors,e),isValidating:!!_e(n.validatingFields,e),isTouched:!!_e((t||n).touchedFields,e)}),P=(e,t,r)=>{const s=(_e(i,e,{_f:{}})._f||{}).ref,o=_e(n.errors,e)||{},{ref:a,message:l,type:u,...c}=o;ve(n.errors,e,{...c,...t,ref:s}),f.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&s&&s.focus&&s.focus()},M=e=>f.state.subscribe({next:t=>{var r,i,a;r=e.name,i=t.name,a=e.exact,r&&i&&r!==i&&!He(r).some(e=>e&&(a?e===i:e.startsWith(i)||i.startsWith(e)))||!((e,t,r,n)=>{r(e);const{name:i,...s}=e;return Xe(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(e=>t[e]===(!n||ke))})(t,e.formState||h,B,e.reRenderRoot)||e.callback({values:{...o},...n,...t,defaultValues:s})}}).unsubscribe,D=(e,t={})=>{for(const a of e?He(e):l.mount)l.mount.delete(a),l.array.delete(a),t.keepValue||(rt(i,a),rt(o,a)),!t.keepError&&rt(n.errors,a),!t.keepDirty&&rt(n.dirtyFields,a),!t.keepTouched&&rt(n.touchedFields,a),!t.keepIsValidating&&rt(n.validatingFields,a),!r.shouldUnregister&&!t.keepDefaultValue&&rt(s,a);f.state.next({values:he(o)}),f.state.next({...n,...t.keepDirty?{isDirty:w()}:{}}),!t.keepIsValid&&m()},z=({disabled:e,name:t})=>{(ge(e)&&a.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t))},I=(e,t={})=>{let n=_e(i,e);const o=ge(t.disabled)||ge(r.disabled);return ve(i,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),l.mount.add(e),n?z({disabled:ge(t.disabled)?t.disabled:r.disabled,name:e}):g(e,!0,t.value),{...o?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:pt(t.min),max:pt(t.max),minLength:pt(t.minLength),maxLength:pt(t.maxLength),pattern:pt(t.pattern)}:{},name:e,onChange:k,onBlur:k,ref:o=>{if(o){I(e,t),n=_e(i,e);const r=fe(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,a=(e=>et(e)||ne(e))(r),l=n._f.refs||[];if(a?l.find(e=>e===r):r===n._f.ref)return;ve(i,e,{_f:{...n._f,...a?{refs:[...l.filter(tt),r,...Array.isArray(_e(s,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),g(e,!1,void 0,r)}else n=_e(i,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!ue(l.array,e)||!a.action)&&l.unMount.add(e)}}},F=()=>r.shouldFocusError&&vt(i,O,l.mount),L=(e,t)=>async s=>{let a;s&&(s.preventDefault&&s.preventDefault(),s.persist&&s.persist());let u=he(o);if(f.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await b();_(),n.errors=e,u=he(t)}else await x(i);if(l.disabled.size)for(const e of l.disabled)rt(u,e);if(rt(n.errors,"root"),Xe(n.errors)){f.state.next({errors:{}});try{await e(u,s)}catch(e){a=e}}else t&&await t({...n.errors},s),F(),setTimeout(F);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Xe(n.errors)&&!a,submitCount:n.submitCount+1,errors:n.errors}),a)throw a},j=(e,t={})=>{const u=e?he(e):s,c=he(u),d=Xe(e),p=d?s:c;if(t.keepDefaultValues||(s=u),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(st(s,o))]);for(const t of Array.from(e))_e(n.dirtyFields,t)?ve(p,t,_e(o,t)):S(t,_e(p,t))}else{if(ce&&fe(e))for(const e of l.mount){const t=_e(i,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(Qe(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of l.mount)S(e,_e(p,e));else i={}}o=r.shouldUnregister?t.keepDefaultValues?he(s):{}:he(p),f.array.next({values:{...p}}),f.state.next({values:{...p}})}l={mount:t.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!h.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!r.shouldUnregister&&!Xe(p),a.watch=!!r.shouldUnregister,a.keepIsValid=!!t.keepIsValid,a.action=!1,t.keepErrors||(n.errors={}),f.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!d&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||Ge(e,s))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:d?{}:t.keepDirtyValues?t.keepDefaultValues&&o?st(s,o):n.dirtyFields:t.keepDefaultValues&&e?st(s,e):t.keepDirty?n.dirtyFields:{},touchedFields:t.keepTouched?n.touchedFields:{},errors:t.keepErrors?n.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1,defaultValues:s})},U=(e,t)=>j(ye(e)?e(o):e,{...r.resetOptions,...t}),B=e=>{n={...n,...e}},V={control:{register:I,unregister:D,getFieldState:N,handleSubmit:L,setError:P,_subscribe:M,_runSchema:b,_updateIsValidating:_,_focusError:F,_getWatch:A,_getDirty:w,_setValid:m,_setFieldArray:(e,t=[],l,u,c=!0,p=!0)=>{if(u&&l&&!r.disabled){if(a.action=!0,p&&Array.isArray(_e(i,e))){const t=l(_e(i,e),u.argA,u.argB);c&&ve(i,e,t)}if(p&&Array.isArray(_e(n.errors,e))){const t=l(_e(n.errors,e),u.argA,u.argB);c&&ve(n.errors,e,t),((e,t)=>{!pe(_e(e,t)).length&&rt(e,t)})(n.errors,e)}if((h.touchedFields||d.touchedFields)&&p&&Array.isArray(_e(n.touchedFields,e))){const t=l(_e(n.touchedFields,e),u.argA,u.argB);c&&ve(n.touchedFields,e,t)}(h.dirtyFields||d.dirtyFields)&&(n.dirtyFields=st(s,o)),f.state.next({name:e,isDirty:w(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else ve(o,e,t)},_setDisabledField:z,_setErrors:e=>{n.errors=e,f.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>pe(_e(a.mount?o:s,e,r.shouldUnregister?_e(s,e,[]):[])),_reset:j,_resetDefaultValues:()=>ye(r.defaultValues)&&r.defaultValues().then(e=>{U(e,r.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of l.unMount){const t=_e(i,e);t&&(t._f.refs?t._f.refs.every(e=>!tt(e)):!tt(t._f.ref))&&D(e)}l.unMount=new Set},_disableForm:e=>{ge(e)&&(f.state.next({disabled:e}),vt(i,(t,r)=>{const n=_e(i,r);n&&(t.disabled=n._f.disabled||e,Array.isArray(n._f.refs)&&n._f.refs.forEach(t=>{t.disabled=n._f.disabled||e}))},0,!1))},_subjects:f,_proxyFormState:h,get _fields(){return i},get _formValues(){return o},get _state(){return a},set _state(e){a=e},get _defaultValues(){return s},get _names(){return l},set _names(e){l=e},get _formState(){return n},get _options(){return r},set _options(e){r={...r,...e}}},subscribe:e=>(a.mount=!0,d={...d,...e.formState},M({...e,formState:{...c,...e.formState}})),trigger:R,register:I,handleSubmit:L,watch:(e,t)=>ye(e)?f.state.subscribe({next:r=>"values"in r&&e(A(void 0,t),r)}):A(e,t,!0),setValue:S,getValues:C,reset:U,resetField:(e,t={})=>{_e(i,e)&&(fe(t.defaultValue)?S(e,he(_e(s,e))):(S(e,t.defaultValue),ve(s,e,he(t.defaultValue))),t.keepTouched||rt(n.touchedFields,e),t.keepDirty||(rt(n.dirtyFields,e),n.isDirty=t.defaultValue?w(e,he(_e(s,e))):w()),t.keepError||(rt(n.errors,e),h.isValid&&m()),f.state.next({...n}))},clearErrors:e=>{e&&He(e).forEach(e=>rt(n.errors,e)),f.state.next({errors:e?n.errors:{}})},unregister:D,setError:P,setFocus:(e,t={})=>{const r=_e(i,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&ye(e.select)&&e.select()})}},getFieldState:N};return{...V,formControl:V}}const kt=({sx:t,...r})=>e(V,{variant:"body1",sx:{color:"var(--color-white)",cursor:"default",...t},...r}),Ot=j(F)({padding:0,marginRight:"5px",marginLeft:"10px","& .MuiSvgIcon-root":{color:"var(--color-orange-medium)"}});function Rt({label:t,name:n,...i}){const s=r.useId(),{control:o,setValue:a,watch:l}=Ie(),u=l(n),c=`${s}-${n}-${String(u)}`;return e(qe,{control:o,name:n,render:({field:r})=>{const{value:n,name:s}=r;return t?e(L,{color:"white",control:e(Ot,{...i,checked:n,onChange:(e,t)=>{a(s,t,{shouldValidate:!0})}}),label:e(kt,{children:t})}):e(Ot,{...i,checked:n,onChange:(e,t)=>{a(s,t,{shouldValidate:!0})}})}},c)}function Ct({form:t,sx:r={},onSubmit:n,children:i}){const{handleSubmit:s}=t;return e(Fe,{...t,children:e(x,{component:"form",sx:{display:"grid",gap:"15px",...r},onSubmit:s(n),children:i})})}const Nt=()=>Ie(),Pt=t=>e(P,{size:"small",...t});function Mt({name:t,items:n,label:i,sx:s,getLabel:o,getValue:a,getKey:l}){const{watch:u,resetField:c,setValue:h}=Ie(),d=u(t),f=r.useId(),p=n.find(e=>a(e)===d);return e(G,{value:p,options:n,id:f,getOptionLabel:e=>o(e),getOptionKey:e=>l(e),sx:{minWidth:150,...s},size:"small",onChange:(e,r)=>{r?h(t,a(r)):c(t)},renderInput:t=>e(Pt,{...t,label:i})})}function Dt(t){const{name:n,type:i}=t,s=r.useId(),{control:o}=Ie();return e(qe,{name:n,control:o,render:({field:r})=>e(Pt,{id:s,size:"small",...t,...r,onChange:e=>{const{target:t}=e,{value:n}=t;if("number"===i)""===n?r.onChange():r.onChange(Number(n));else r.onChange(e)}})})}const zt="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function It(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function Ft(e){return"nodeType"in e}function Lt(e){var t,r;return e?It(e)?e:Ft(e)&&null!=(t=null==(r=e.ownerDocument)?void 0:r.defaultView)?t:window:window}function jt(e){const{Document:t}=Lt(e);return e instanceof t}function Ut(e){return!It(e)&&e instanceof Lt(e).HTMLElement}function Bt(e){return e instanceof Lt(e).SVGElement}function Vt(e){return e?It(e)?e.document:Ft(e)?jt(e)?e:Ut(e)||Bt(e)?e.ownerDocument:document:document:document}const Gt=zt?i:s;function $t(e){const t=o(e);return Gt(()=>{t.current=e}),l(function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return null==t.current?void 0:t.current(...r)},[])}function qt(e,t){void 0===t&&(t=[e]);const r=o(e);return Gt(()=>{r.current!==e&&(r.current=e)},t),r}function Wt(e,t){const r=o();return a(()=>{const t=e(r.current);return r.current=t,t},[...t])}function Ht(e){const t=$t(e),r=o(null),n=l(e=>{e!==r.current&&(null==t||t(e,r.current)),r.current=e},[]);return[r,n]}function Zt(e){const t=o();return s(()=>{t.current=e},[e]),t.current}let Kt={};function Xt(e,t){return a(()=>{if(t)return t;const r=null==Kt[e]?0:Kt[e]+1;return Kt[e]=r,e+"-"+r},[e,t])}function Yt(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.reduce((t,r)=>{const n=Object.entries(r);for(const[r,i]of n){const n=t[r];null!=n&&(t[r]=n+e*i)}return t},{...t})}}const Qt=Yt(1),Jt=Yt(-1);function er(e){if(!e)return!1;const{KeyboardEvent:t}=Lt(e.target);return t&&e instanceof t}function tr(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=Lt(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const rr=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[rr.Translate.toString(e),rr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),nr="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function ir(e){return e.matches(nr)?e:e.querySelector(nr)}const sr={display:"none"};function or(e){let{id:t,value:r}=e;return n.createElement("div",{id:t,style:sr},r)}function ar(e){let{id:t,announcement:r,ariaLiveType:i="assertive"}=e;return n.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":i,"aria-atomic":!0},r)}const lr=c(null);const ur={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},cr={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function hr(e){let{announcements:t=cr,container:r,hiddenTextDescribedById:i,screenReaderInstructions:o=ur}=e;const{announce:c,announcement:h}=function(){const[e,t]=u("");return{announce:l(e=>{null!=e&&t(e)},[]),announcement:e}}(),d=Xt("DndLiveRegion"),[p,m]=u(!1);if(s(()=>{m(!0)},[]),function(e){const t=f(lr);s(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}(a(()=>({onDragStart(e){let{active:r}=e;c(t.onDragStart({active:r}))},onDragMove(e){let{active:r,over:n}=e;t.onDragMove&&c(t.onDragMove({active:r,over:n}))},onDragOver(e){let{active:r,over:n}=e;c(t.onDragOver({active:r,over:n}))},onDragEnd(e){let{active:r,over:n}=e;c(t.onDragEnd({active:r,over:n}))},onDragCancel(e){let{active:r,over:n}=e;c(t.onDragCancel({active:r,over:n}))}}),[c,t])),!p)return null;const _=n.createElement(n.Fragment,null,n.createElement(or,{id:i,value:o.draggable}),n.createElement(ar,{id:d,announcement:h}));return r?q(_,r):_}var dr;function fr(){}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(dr||(dr={}));const pr=Object.freeze({x:0,y:0});function mr(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function _r(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function gr(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function yr(e,t,r){return void 0===t&&(t=e.left),void 0===r&&(r=e.top),{x:t+.5*e.width,y:r+.5*e.height}}const vr=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const i=yr(t,t.left,t.top),s=[];for(const e of n){const{id:t}=e,n=r.get(t);if(n){const r=mr(yr(n),i);s.push({id:t,data:{droppableContainer:e,value:r}})}}return s.sort(_r)};function br(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),o=i-n,a=s-r;if(n<i&&r<s){const r=t.width*t.height,n=e.width*e.height,i=o*a;return Number((i/(r+n-i)).toFixed(4))}return 0}const xr=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const i=[];for(const e of n){const{id:n}=e,s=r.get(n);if(s){const r=br(s,t);r>0&&i.push({id:n,data:{droppableContainer:e,value:r}})}}return i.sort(gr)};function wr(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:pr}function Ar(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.reduce((t,r)=>({...t,top:t.top+e*r.y,bottom:t.bottom+e*r.y,left:t.left+e*r.x,right:t.right+e*r.x}),{...t})}}const Er=Ar(1);const Tr={ignoreTransform:!1};function Sr(e,t){void 0===t&&(t=Tr);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:n}=Lt(e).getComputedStyle(e);t&&(r=function(e,t,r){const n=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!n)return e;const{scaleX:i,scaleY:s,x:o,y:a}=n,l=e.left-o-(1-i)*parseFloat(r),u=e.top-a-(1-s)*parseFloat(r.slice(r.indexOf(" ")+1)),c=i?e.width/i:e.width,h=s?e.height/s:e.height;return{width:c,height:h,top:u,right:l+c,bottom:u+h,left:l}}(r,t,n))}const{top:n,left:i,width:s,height:o,bottom:a,right:l}=r;return{top:n,left:i,width:s,height:o,bottom:a,right:l}}function kr(e){return Sr(e,{ignoreTransform:!0})}function Or(e,t){const r=[];return e?function n(i){if(null!=t&&r.length>=t)return r;if(!i)return r;if(jt(i)&&null!=i.scrollingElement&&!r.includes(i.scrollingElement))return r.push(i.scrollingElement),r;if(!Ut(i)||Bt(i))return r;if(r.includes(i))return r;const s=Lt(e).getComputedStyle(i);return i!==e&&function(e,t){void 0===t&&(t=Lt(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{const n=t[e];return"string"==typeof n&&r.test(n)})}(i,s)&&r.push(i),function(e,t){return void 0===t&&(t=Lt(e).getComputedStyle(e)),"fixed"===t.position}(i,s)?r:n(i.parentNode)}(e):r}function Rr(e){const[t]=Or(e,1);return null!=t?t:null}function Cr(e){return zt&&e?It(e)?e:Ft(e)?jt(e)||e===Vt(e).scrollingElement?window:Ut(e)?e:null:null:null}function Nr(e){return It(e)?e.scrollX:e.scrollLeft}function Pr(e){return It(e)?e.scrollY:e.scrollTop}function Mr(e){return{x:Nr(e),y:Pr(e)}}var Dr;function zr(e){return!(!zt||!e)&&e===document.scrollingElement}function Ir(e){const t={x:0,y:0},r=zr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=n.y,isRight:e.scrollLeft>=n.x,maxScroll:n,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(Dr||(Dr={}));const Fr={x:.2,y:.2};function Lr(e,t,r,n,i){let{top:s,left:o,right:a,bottom:l}=r;void 0===n&&(n=10),void 0===i&&(i=Fr);const{isTop:u,isBottom:c,isLeft:h,isRight:d}=Ir(e),f={x:0,y:0},p={x:0,y:0},m=t.height*i.y,_=t.width*i.x;return!u&&s<=t.top+m?(f.y=Dr.Backward,p.y=n*Math.abs((t.top+m-s)/m)):!c&&l>=t.bottom-m&&(f.y=Dr.Forward,p.y=n*Math.abs((t.bottom-m-l)/m)),!d&&a>=t.right-_?(f.x=Dr.Forward,p.x=n*Math.abs((t.right-_-a)/_)):!h&&o<=t.left+_&&(f.x=Dr.Backward,p.x=n*Math.abs((t.left+_-o)/_)),{direction:f,speed:p}}function jr(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:r,right:n,bottom:i}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Ur(e){return e.reduce((e,t)=>Qt(e,Mr(t)),pr)}const Br=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+Nr(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+Pr(t),0)}]];class Vr{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Or(t),n=Ur(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,i]of Br)for(const s of t)Object.defineProperty(this,s,{get:()=>{const t=i(r),o=n[e]-t;return this.rect[s]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Gr{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,r){var n;null==(n=this.target)||n.addEventListener(e,t,r),this.listeners.push([e,t,r])}}function $r(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return"number"==typeof t?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t&&n>t.y}var qr,Wr;function Hr(e){e.preventDefault()}function Zr(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(qr||(qr={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"}(Wr||(Wr={}));const Kr={start:[Wr.Space,Wr.Enter],cancel:[Wr.Esc],end:[Wr.Space,Wr.Enter,Wr.Tab]},Xr=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Wr.Right:return{...r,x:r.x+25};case Wr.Left:return{...r,x:r.x-25};case Wr.Down:return{...r,y:r.y+25};case Wr.Up:return{...r,y:r.y-25}}};class Yr{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new Gr(Vt(t)),this.windowListeners=new Gr(Lt(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(qr.Resize,this.handleCancel),this.windowListeners.add(qr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(qr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,r=e.node.current;r&&function(e,t){if(void 0===t&&(t=Sr),!e)return;const{top:r,left:n,bottom:i,right:s}=t(e);Rr(e)&&(i<=0||s<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(r),t(pr)}handleKeyDown(e){if(er(e)){const{active:t,context:r,options:n}=this.props,{keyboardCodes:i=Kr,coordinateGetter:s=Xr,scrollBehavior:o="smooth"}=n,{code:a}=e;if(i.end.includes(a))return void this.handleEnd(e);if(i.cancel.includes(a))return void this.handleCancel(e);const{collisionRect:l}=r.current,u=l?{x:l.left,y:l.top}:pr;this.referenceCoordinates||(this.referenceCoordinates=u);const c=s(e,{active:t,context:r.current,currentCoordinates:u});if(c){const t=Jt(c,u),n={x:0,y:0},{scrollableAncestors:i}=r.current;for(const r of i){const i=e.code,{isTop:s,isRight:a,isLeft:l,isBottom:u,maxScroll:h,minScroll:d}=Ir(r),f=jr(r),p={x:Math.min(i===Wr.Right?f.right-f.width/2:f.right,Math.max(i===Wr.Right?f.left:f.left+f.width/2,c.x)),y:Math.min(i===Wr.Down?f.bottom-f.height/2:f.bottom,Math.max(i===Wr.Down?f.top:f.top+f.height/2,c.y))},m=i===Wr.Right&&!a||i===Wr.Left&&!l,_=i===Wr.Down&&!u||i===Wr.Up&&!s;if(m&&p.x!==c.x){const e=r.scrollLeft+t.x,s=i===Wr.Right&&e<=h.x||i===Wr.Left&&e>=d.x;if(s&&!t.y)return void r.scrollTo({left:e,behavior:o});n.x=s?r.scrollLeft-e:i===Wr.Right?r.scrollLeft-h.x:r.scrollLeft-d.x,n.x&&r.scrollBy({left:-n.x,behavior:o});break}if(_&&p.y!==c.y){const e=r.scrollTop+t.y,s=i===Wr.Down&&e<=h.y||i===Wr.Up&&e>=d.y;if(s&&!t.x)return void r.scrollTo({top:e,behavior:o});n.y=s?r.scrollTop-e:i===Wr.Down?r.scrollTop-h.y:r.scrollTop-d.y,n.y&&r.scrollBy({top:-n.y,behavior:o});break}}this.handleMove(e,Qt(Jt(c,this.referenceCoordinates),n))}}}handleMove(e,t){const{onMove:r}=this.props;e.preventDefault(),r(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function Qr(e){return Boolean(e&&"distance"in e)}function Jr(e){return Boolean(e&&"delay"in e)}Yr.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Kr,onActivation:i}=t,{active:s}=r;const{code:o}=e.nativeEvent;if(n.start.includes(o)){const t=s.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==i||i({event:e.nativeEvent}),!0)}return!1}}];class en{constructor(e,t,r){var n;void 0===r&&(r=function(e){const{EventTarget:t}=Lt(e);return e instanceof t?e:Vt(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:i}=e,{target:s}=i;this.props=e,this.events=t,this.document=Vt(s),this.documentListeners=new Gr(this.document),this.listeners=new Gr(r),this.windowListeners=new Gr(Lt(s)),this.initialCoordinates=null!=(n=tr(i))?n:pr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(qr.Resize,this.handleCancel),this.windowListeners.add(qr.DragStart,Hr),this.windowListeners.add(qr.VisibilityChange,this.handleCancel),this.windowListeners.add(qr.ContextMenu,Hr),this.documentListeners.add(qr.Keydown,this.handleKeydown),t){if(null!=r&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Jr(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(Qr(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:r,onPending:n}=this.props;n(r,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(qr.Click,Zr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(qr.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:r,initialCoordinates:n,props:i}=this,{onMove:s,options:{activationConstraint:o}}=i;if(!n)return;const a=null!=(t=tr(e))?t:pr,l=Jt(n,a);if(!r&&o){if(Qr(o)){if(null!=o.tolerance&&$r(l,o.tolerance))return this.handleCancel();if($r(l,o.distance))return this.handleStart()}return Jr(o)&&$r(l,o.tolerance)?this.handleCancel():void this.handlePending(o,l)}e.cancelable&&e.preventDefault(),s(a)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Wr.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const tn={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class rn extends en{constructor(e){const{event:t}=e,r=Vt(t.target);super(e,tn,r)}}rn.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!(!r.isPrimary||0!==r.button)&&(null==n||n({event:r}),!0)}}];const nn={move:{name:"mousemove"},end:{name:"mouseup"}};var sn;!function(e){e[e.RightClick=2]="RightClick"}(sn||(sn={}));(class extends en{constructor(e){super(e,nn,Vt(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button!==sn.RightClick&&(null==n||n({event:r}),!0)}}];const on={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var an,ln;function un(e){let{acceleration:t,activator:r=an.Pointer,canScroll:n,draggingRect:i,enabled:u,interval:c=5,order:h=ln.TreeOrder,pointerCoordinates:d,scrollableAncestors:f,scrollableAncestorRects:p,delta:m,threshold:_}=e;const g=function(e){let{delta:t,disabled:r}=e;const n=Zt(t);return Wt(e=>{if(r||!n||!e)return cn;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[Dr.Backward]:e.x[Dr.Backward]||-1===i.x,[Dr.Forward]:e.x[Dr.Forward]||1===i.x},y:{[Dr.Backward]:e.y[Dr.Backward]||-1===i.y,[Dr.Forward]:e.y[Dr.Forward]||1===i.y}}},[r,t,n])}({delta:m,disabled:!u}),[y,v]=function(){const e=o(null);return[l((t,r)=>{e.current=setInterval(t,r)},[]),l(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}(),b=o({x:0,y:0}),x=o({x:0,y:0}),w=a(()=>{switch(r){case an.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case an.DraggableRect:return i}},[r,i,d]),A=o(null),E=l(()=>{const e=A.current;if(!e)return;const t=b.current.x*x.current.x,r=b.current.y*x.current.y;e.scrollBy(t,r)},[]),T=a(()=>h===ln.TreeOrder?[...f].reverse():f,[h,f]);s(()=>{if(u&&f.length&&w){for(const e of T){if(!1===(null==n?void 0:n(e)))continue;const r=f.indexOf(e),i=p[r];if(!i)continue;const{direction:s,speed:o}=Lr(e,i,w,t,_);for(const e of["x","y"])g[e][s[e]]||(o[e]=0,s[e]=0);if(o.x>0||o.y>0)return v(),A.current=e,y(E,c),b.current=o,void(x.current=s)}b.current={x:0,y:0},x.current={x:0,y:0},v()}else v()},[t,E,n,v,u,c,JSON.stringify(w),JSON.stringify(g),y,f,T,p,JSON.stringify(_)])}(class extends en{constructor(e){super(e,on)}static setup(){return window.addEventListener(on.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(on.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:i}=r;return!(i.length>1)&&(null==n||n({event:r}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(an||(an={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(ln||(ln={}));const cn={x:{[Dr.Backward]:!1,[Dr.Forward]:!1},y:{[Dr.Backward]:!1,[Dr.Forward]:!1}};var hn,dn;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(hn||(hn={})),function(e){e.Optimized="optimized"}(dn||(dn={}));const fn=new Map;function pn(e,t){return Wt(r=>e?r||("function"==typeof t?t(e):e):null,[t,e])}function mn(e){let{callback:t,disabled:r}=e;const n=$t(t),i=a(()=>{if(r||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(n)},[r]);return s(()=>()=>null==i?void 0:i.disconnect(),[i]),i}function _n(e){return new Vr(Sr(e),e)}function gn(e,t,r){void 0===t&&(t=_n);const[n,i]=u(null);function o(){i(n=>{if(!e)return null;var i;if(!1===e.isConnected)return null!=(i=null!=n?n:r)?i:null;const s=t(e);return JSON.stringify(n)===JSON.stringify(s)?n:s})}const l=function(e){let{callback:t,disabled:r}=e;const n=$t(t),i=a(()=>{if(r||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(n)},[n,r]);return s(()=>()=>null==i?void 0:i.disconnect(),[i]),i}({callback(t){if(e)for(const r of t){const{type:t,target:n}=r;if("childList"===t&&n instanceof HTMLElement&&n.contains(e)){o();break}}}}),c=mn({callback:o});return Gt(()=>{o(),e?(null==c||c.observe(e),null==l||l.observe(document.body,{childList:!0,subtree:!0})):(null==c||c.disconnect(),null==l||l.disconnect())},[e]),n}const yn=[];function vn(e,t){void 0===t&&(t=[]);const r=o(null);return s(()=>{r.current=null},t),s(()=>{const t=e!==pr;t&&!r.current&&(r.current=e),!t&&r.current&&(r.current=null)},[e]),r.current?Jt(e,r.current):pr}function bn(e){return a(()=>e?function(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}(e):null,[e])}const xn=[];function wn(e){let{measure:t}=e;const[r,n]=u(null),i=l(e=>{for(const{target:r}of e)if(Ut(r)){n(e=>{const n=t(r);return e?{...e,width:n.width,height:n.height}:n});break}},[t]),s=mn({callback:i}),o=l(e=>{const r=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ut(t)?t:e}(e);null==s||s.disconnect(),r&&(null==s||s.observe(r)),n(r?t(r):null)},[t,s]),[c,h]=Ht(o);return a(()=>({nodeRef:c,rect:r,setRef:h}),[r,c,h])}const An=[{sensor:rn,options:{}},{sensor:Yr,options:{}}],En={current:{}},Tn={draggable:{measure:kr},droppable:{measure:kr,strategy:hn.WhileDragging,frequency:dn.Optimized},dragOverlay:{measure:Sr}};class Sn extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,r;return null!=(t=null==(r=this.get(e))?void 0:r.node.current)?t:void 0}}const kn={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Sn,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:fr},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Tn,measureDroppableContainers:fr,windowRect:null,measuringScheduled:!1},On=c({activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:fr,draggableNodes:new Map,over:null,measureDroppableContainers:fr}),Rn=c(kn);function Cn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Sn}}}function Nn(e,t){switch(t.type){case dr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case dr.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case dr.DragEnd:case dr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case dr.RegisterDroppable:{const{element:r}=t,{id:n}=r,i=new Sn(e.droppable.containers);return i.set(n,r),{...e,droppable:{...e.droppable,containers:i}}}case dr.SetDroppableDisabled:{const{id:r,key:n,disabled:i}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const o=new Sn(e.droppable.containers);return o.set(r,{...s,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case dr.UnregisterDroppable:{const{id:r,key:n}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;const s=new Sn(e.droppable.containers);return s.delete(r),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function Pn(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:i}=f(On),o=Zt(n),a=Zt(null==r?void 0:r.id);return s(()=>{if(!t&&!n&&o&&null!=a){if(!er(o))return;if(document.activeElement===o.target)return;const e=i.get(a);if(!e)return;const{activatorNode:t,node:r}=e;if(!t.current&&!r.current)return;requestAnimationFrame(()=>{for(const e of[t.current,r.current]){if(!e)continue;const t=ir(e);if(t){t.focus();break}}})}},[n,t,i,a,o]),null}const Mn=c({...pr,scaleX:1,scaleY:1});var Dn;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(Dn||(Dn={}));const zn=h(function(e){var t,r,i,c;let{id:h,accessibility:f,autoScroll:p=!0,children:m,sensors:_=An,collisionDetection:g=xr,measuring:y,modifiers:v,...b}=e;const x=d(Nn,void 0,Cn),[w,A]=x,[E,T]=function(){const[e]=u(()=>new Set),t=l(t=>(e.add(t),()=>e.delete(t)),[e]);return[l(t=>{let{type:r,event:n}=t;e.forEach(e=>{var t;return null==(t=e[r])?void 0:t.call(e,n)})},[e]),t]}(),[S,k]=u(Dn.Uninitialized),O=S===Dn.Initialized,{draggable:{active:R,nodes:C,translate:N},droppable:{containers:P}}=w,M=null!=R?C.get(R):null,D=o({initial:null,translated:null}),z=a(()=>{var e;return null!=R?{id:R,data:null!=(e=null==M?void 0:M.data)?e:En,rect:D}:null},[R,M]),I=o(null),[F,L]=u(null),[j,U]=u(null),B=qt(b,Object.values(b)),V=Xt("DndDescribedBy",h),G=a(()=>P.getEnabled(),[P]),q=a(()=>({draggable:{...Tn.draggable,...null==W?void 0:W.draggable},droppable:{...Tn.droppable,...null==W?void 0:W.droppable},dragOverlay:{...Tn.dragOverlay,...null==W?void 0:W.dragOverlay}}),[null==(W=y)?void 0:W.draggable,null==W?void 0:W.droppable,null==W?void 0:W.dragOverlay]);var W;const{droppableRects:H,measureDroppableContainers:Z,measuringScheduled:K}=function(e,t){let{dragging:r,dependencies:n,config:i}=t;const[a,c]=u(null),{frequency:h,measure:d,strategy:f}=i,p=o(e),m=function(){switch(f){case hn.Always:return!1;case hn.BeforeDragging:return r;default:return!r}}(),_=qt(m),g=l(function(e){void 0===e&&(e=[]),_.current||c(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[_]),y=o(null),v=Wt(t=>{if(m&&!r)return fn;if(!t||t===fn||p.current!==e||null!=a){const t=new Map;for(let r of e){if(!r)continue;if(a&&a.length>0&&!a.includes(r.id)&&r.rect.current){t.set(r.id,r.rect.current);continue}const e=r.node.current,n=e?new Vr(d(e),e):null;r.rect.current=n,n&&t.set(r.id,n)}return t}return t},[e,a,r,m,d]);return s(()=>{p.current=e},[e]),s(()=>{m||g()},[r,m]),s(()=>{a&&a.length>0&&c(null)},[JSON.stringify(a)]),s(()=>{m||"number"!=typeof h||null!==y.current||(y.current=setTimeout(()=>{g(),y.current=null},h))},[h,m,g,...n]),{droppableRects:v,measureDroppableContainers:g,measuringScheduled:null!=a}}(G,{dragging:O,dependencies:[N.x,N.y],config:q.droppable}),X=function(e,t){const r=null!=t?e.get(t):void 0,n=r?r.node.current:null;return Wt(e=>{var r;return null==t?null:null!=(r=null!=n?n:e)?r:null},[n,t])}(C,R),Y=a(()=>j?tr(j):null,[j]),Q=function(){const e=!1===(null==F?void 0:F.autoScrollEnabled),t="object"==typeof p?!1===p.enabled:!1===p,r=O&&!e&&!t;if("object"==typeof p)return{...p,enabled:r};return{enabled:r}}(),J=function(e,t){return pn(e,t)}(X,q.draggable.measure);!function(e){let{activeNode:t,measure:r,initialRect:n,config:i=!0}=e;const s=o(!1),{x:a,y:l}="boolean"==typeof i?{x:i,y:i}:i;Gt(()=>{if(!a&&!l||!t)return void(s.current=!1);if(s.current||!n)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const i=wr(r(e),n);if(a||(i.x=0),l||(i.y=0),s.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){const t=Rr(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,a,l,n,r])}({activeNode:null!=R?C.get(R):null,config:Q.layoutShiftCompensation,initialRect:J,measure:q.draggable.measure});const ee=gn(X,q.draggable.measure,J),te=gn(X?X.parentElement:null),re=o({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:H,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=P.getNodeFor(null==(t=re.current.over)?void 0:t.id),ie=wn({measure:q.dragOverlay.measure}),se=null!=(r=ie.nodeRef.current)?r:X,oe=O?null!=(i=ie.rect)?i:ee:null,ae=Boolean(ie.nodeRef.current&&ie.rect),le=wr(ue=ae?null:ee,pn(ue));var ue;const ce=bn(se?Lt(se):null),he=function(e){const t=o(e),r=Wt(r=>e?r&&r!==yn&&e&&t.current&&e.parentNode===t.current.parentNode?r:Or(e):yn,[e]);return s(()=>{t.current=e},[e]),r}(O?null!=ne?ne:X:null),de=function(e,t){void 0===t&&(t=Sr);const[r]=e,n=bn(r?Lt(r):null),[i,s]=u(xn);function o(){s(()=>e.length?e.map(e=>zr(e)?n:new Vr(t(e),e)):xn)}const a=mn({callback:o});return Gt(()=>{null==a||a.disconnect(),o(),e.forEach(e=>null==a?void 0:a.observe(e))},[e]),i}(he),fe=function(e,t){let{transform:r,...n}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...n}),r):r}(v,{transform:{x:N.x-le.x,y:N.y-le.y,scaleX:1,scaleY:1},activatorEvent:j,active:z,activeNodeRect:ee,containerNodeRect:te,draggingNodeRect:oe,over:re.current.over,overlayNodeRect:ie.rect,scrollableAncestors:he,scrollableAncestorRects:de,windowRect:ce}),pe=Y?Qt(Y,N):null,me=function(e){const[t,r]=u(null),n=o(e),i=l(e=>{const t=Cr(e.target);t&&r(e=>e?(e.set(t,Mr(t)),new Map(e)):null)},[]);return s(()=>{const t=n.current;if(e!==t){s(t);const o=e.map(e=>{const t=Cr(e);return t?(t.addEventListener("scroll",i,{passive:!0}),[t,Mr(t)]):null}).filter(e=>null!=e);r(o.length?new Map(o):null),n.current=e}return()=>{s(e),s(t)};function s(e){e.forEach(e=>{const t=Cr(e);null==t||t.removeEventListener("scroll",i)})}},[i,e]),a(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Qt(e,t),pr):Ur(e):pr,[e,t])}(he),_e=vn(me),ge=vn(me,[ee]),ye=Qt(fe,_e),ve=oe?Er(oe,fe):null,be=z&&ve?g({active:z,collisionRect:ve,droppableRects:H,droppableContainers:G,pointerCoordinates:pe}):null,xe=function(e,t){if(!e||0===e.length)return null;const[r]=e;return r[t]}(be,"id"),[we,Ae]=u(null),Ee=function(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}(ae?fe:Qt(fe,ge),null!=(c=null==we?void 0:we.rect)?c:null,ee),Te=o(null),Se=l((e,t)=>{let{sensor:r,options:n}=t;if(null==I.current)return;const i=C.get(I.current);if(!i)return;const s=e.nativeEvent,o=new r({active:I.current,activeNode:i,event:s,options:n,context:re,onAbort(e){if(!C.get(e))return;const{onDragAbort:t}=B.current,r={id:e};null==t||t(r),E({type:"onDragAbort",event:r})},onPending(e,t,r,n){if(!C.get(e))return;const{onDragPending:i}=B.current,s={id:e,constraint:t,initialCoordinates:r,offset:n};null==i||i(s),E({type:"onDragPending",event:s})},onStart(e){const t=I.current;if(null==t)return;const r=C.get(t);if(!r)return;const{onDragStart:n}=B.current,i={activatorEvent:s,active:{id:t,data:r.data,rect:D}};$(()=>{null==n||n(i),k(Dn.Initializing),A({type:dr.DragStart,initialCoordinates:e,active:t}),E({type:"onDragStart",event:i}),L(Te.current),U(s)})},onMove(e){A({type:dr.DragMove,coordinates:e})},onEnd:a(dr.DragEnd),onCancel:a(dr.DragCancel)});function a(e){return async function(){const{active:t,collisions:r,over:n,scrollAdjustedTranslate:i}=re.current;let o=null;if(t&&i){const{cancelDrop:a}=B.current;if(o={activatorEvent:s,active:t,collisions:r,delta:i,over:n},e===dr.DragEnd&&"function"==typeof a){await Promise.resolve(a(o))&&(e=dr.DragCancel)}}I.current=null,$(()=>{A({type:e}),k(Dn.Uninitialized),Ae(null),L(null),U(null),Te.current=null;const t=e===dr.DragEnd?"onDragEnd":"onDragCancel";if(o){const e=B.current[t];null==e||e(o),E({type:t,event:o})}})}}Te.current=o},[C]),ke=l((e,t)=>(r,n)=>{const i=r.nativeEvent,s=C.get(n);if(null!==I.current||!s||i.dndKit||i.defaultPrevented)return;const o={active:s};!0===e(r,t.options,o)&&(i.dndKit={capturedBy:t.sensor},I.current=n,Se(r,t))},[C,Se]),Oe=function(e,t){return a(()=>e.reduce((e,r)=>{const{sensor:n}=r;return[...e,...n.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,r)}))]},[]),[e,t])}(_,ke);!function(e){s(()=>{if(!zt)return;const t=e.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(const e of t)null==e||e()}},e.map(e=>{let{sensor:t}=e;return t}))}(_),Gt(()=>{ee&&S===Dn.Initializing&&k(Dn.Initialized)},[ee,S]),s(()=>{const{onDragMove:e}=B.current,{active:t,activatorEvent:r,collisions:n,over:i}=re.current;if(!t||!r)return;const s={active:t,activatorEvent:r,collisions:n,delta:{x:ye.x,y:ye.y},over:i};$(()=>{null==e||e(s),E({type:"onDragMove",event:s})})},[ye.x,ye.y]),s(()=>{const{active:e,activatorEvent:t,collisions:r,droppableContainers:n,scrollAdjustedTranslate:i}=re.current;if(!e||null==I.current||!t||!i)return;const{onDragOver:s}=B.current,o=n.get(xe),a=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,l={active:e,activatorEvent:t,collisions:r,delta:{x:i.x,y:i.y},over:a};$(()=>{Ae(a),null==s||s(l),E({type:"onDragOver",event:l})})},[xe]),Gt(()=>{re.current={activatorEvent:j,active:z,activeNode:X,collisionRect:ve,collisions:be,droppableRects:H,draggableNodes:C,draggingNode:se,draggingNodeRect:oe,droppableContainers:P,over:we,scrollableAncestors:he,scrollAdjustedTranslate:ye},D.current={initial:oe,translated:ve}},[z,X,be,ve,C,se,oe,H,P,we,he,ye]),un({...Q,delta:N,draggingRect:ve,pointerCoordinates:pe,scrollableAncestors:he,scrollableAncestorRects:de});const Re=a(()=>({active:z,activeNode:X,activeNodeRect:ee,activatorEvent:j,collisions:be,containerNodeRect:te,dragOverlay:ie,draggableNodes:C,droppableContainers:P,droppableRects:H,over:we,measureDroppableContainers:Z,scrollableAncestors:he,scrollableAncestorRects:de,measuringConfiguration:q,measuringScheduled:K,windowRect:ce}),[z,X,ee,j,be,te,ie,C,P,H,we,Z,he,de,q,K,ce]),Ce=a(()=>({activatorEvent:j,activators:Oe,active:z,activeNodeRect:ee,ariaDescribedById:{draggable:V},dispatch:A,draggableNodes:C,over:we,measureDroppableContainers:Z}),[j,Oe,z,ee,A,V,C,we,Z]);return n.createElement(lr.Provider,{value:T},n.createElement(On.Provider,{value:Ce},n.createElement(Rn.Provider,{value:Re},n.createElement(Mn.Provider,{value:Ee},m)),n.createElement(Pn,{disabled:!1===(null==f?void 0:f.restoreFocus)})),n.createElement(hr,{...f,hiddenTextDescribedById:V}))}),In=c(null),Fn="button";function Ln(e){let{id:t,data:r,disabled:n=!1,attributes:i}=e;const s=Xt("Draggable"),{activators:o,activatorEvent:l,active:u,activeNodeRect:c,ariaDescribedById:h,draggableNodes:d,over:p}=f(On),{role:m=Fn,roleDescription:_="draggable",tabIndex:g=0}=null!=i?i:{},y=(null==u?void 0:u.id)===t,v=f(y?Mn:In),[b,x]=Ht(),[w,A]=Ht(),E=function(e,t){return a(()=>e.reduce((e,r)=>{let{eventName:n,handler:i}=r;return e[n]=e=>{i(e,t)},e},{}),[e,t])}(o,t),T=qt(r);Gt(()=>(d.set(t,{id:t,key:s,node:b,activatorNode:w,data:T}),()=>{const e=d.get(t);e&&e.key===s&&d.delete(t)}),[d,t]);return{active:u,activatorEvent:l,activeNodeRect:c,attributes:a(()=>({role:m,tabIndex:g,"aria-disabled":n,"aria-pressed":!(!y||m!==Fn)||void 0,"aria-roledescription":_,"aria-describedby":h.draggable}),[n,m,g,y,_,h.draggable]),isDragging:y,listeners:n?void 0:E,node:b,over:p,setNodeRef:x,setActivatorNodeRef:A,transform:v}}const jn={timeout:25};function Un(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function Bn(e,t){return e.reduce((e,r,n)=>{const i=t.get(r);return i&&(e[n]=i),e},Array(e.length))}function Vn(e){return null!==e&&e>=0}const Gn=e=>{let{rects:t,activeIndex:r,overIndex:n,index:i}=e;const s=Un(t,n,r),o=t[i],a=s[i];return a&&o?{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}:null},$n={scaleX:1,scaleY:1},qn=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:i,rects:s,overIndex:o}=e;const a=null!=(t=s[r])?t:n;if(!a)return null;if(i===r){const e=s[o];return e?{x:0,y:r<o?e.top+e.height-(a.top+a.height):e.top-a.top,...$n}:null}const l=function(e,t,r){const n=e[t],i=e[t-1],s=e[t+1];if(!n)return 0;if(r<t)return i?n.top-(i.top+i.height):s?s.top-(n.top+n.height):0;return s?s.top-(n.top+n.height):i?n.top-(i.top+i.height):0}(s,i,r);return i>r&&i<=o?{x:0,y:-a.height-l,...$n}:i<r&&i>=o?{x:0,y:a.height+l,...$n}:{x:0,y:0,...$n}};const Wn="Sortable",Hn=n.createContext({activeIndex:-1,containerId:Wn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Gn,disabled:{draggable:!1,droppable:!1}});function Zn(e){let{children:t,id:r,items:i,strategy:l=Gn,disabled:u=!1}=e;const{active:c,dragOverlay:h,droppableRects:d,over:p,measureDroppableContainers:m}=f(Rn),_=Xt(Wn,r),g=Boolean(null!==h.rect),y=a(()=>i.map(e=>"object"==typeof e&&"id"in e?e.id:e),[i]),v=null!=c,b=c?y.indexOf(c.id):-1,x=p?y.indexOf(p.id):-1,w=o(y),A=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}(y,w.current),E=-1!==x&&-1===b||A,T=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(u);Gt(()=>{A&&v&&m(y)},[A,y,v,m]),s(()=>{w.current=y},[y]);const S=a(()=>({activeIndex:b,containerId:_,disabled:T,disableTransforms:E,items:y,overIndex:x,useDragOverlay:g,sortedRects:Bn(y,d),strategy:l}),[b,_,T.draggable,T.droppable,E,y,x,d,g,l]);return n.createElement(Hn.Provider,{value:S},t)}const Kn=e=>{let{id:t,items:r,activeIndex:n,overIndex:i}=e;return Un(r,n,i).indexOf(t)},Xn=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:i,items:s,newIndex:o,previousItems:a,previousContainerId:l,transition:u}=e;return!(!u||!n)&&((a===s||i!==o)&&(!!r||o!==i&&t===l))},Yn={duration:200,easing:"ease"},Qn="transform",Jn=rr.Transition.toString({property:Qn,duration:0,easing:"linear"}),ei={roleDescription:"sortable"};function ti(e){let{animateLayoutChanges:t=Xn,attributes:r,disabled:n,data:i,getNewIndex:c=Kn,id:h,strategy:d,resizeObserverConfig:p,transition:m=Yn}=e;const{items:_,containerId:g,activeIndex:y,disabled:v,disableTransforms:b,sortedRects:x,overIndex:w,useDragOverlay:A,strategy:E}=f(Hn),T=function(e,t){var r,n;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(r=null==e?void 0:e.draggable)?r:t.draggable,droppable:null!=(n=null==e?void 0:e.droppable)?n:t.droppable}}(n,v),S=_.indexOf(h),k=a(()=>({sortable:{containerId:g,index:S,items:_},...i}),[g,i,S,_]),O=a(()=>_.slice(_.indexOf(h)),[_,h]),{rect:R,node:C,isOver:N,setNodeRef:P}=function(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:i}=e;const a=Xt("Droppable"),{active:u,dispatch:c,over:h,measureDroppableContainers:d}=f(On),p=o({disabled:r}),m=o(!1),_=o(null),g=o(null),{disabled:y,updateMeasurementsFor:v,timeout:b}={...jn,...i},x=qt(null!=v?v:n),w=mn({callback:l(()=>{m.current?(null!=g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{d(Array.isArray(x.current)?x.current:[x.current]),g.current=null},b)):m.current=!0},[b]),disabled:y||!u}),A=l((e,t)=>{w&&(t&&(w.unobserve(t),m.current=!1),e&&w.observe(e))},[w]),[E,T]=Ht(A),S=qt(t);return s(()=>{w&&E.current&&(w.disconnect(),m.current=!1,w.observe(E.current))},[E,w]),s(()=>(c({type:dr.RegisterDroppable,element:{id:n,key:a,disabled:r,node:E,rect:_,data:S}}),()=>c({type:dr.UnregisterDroppable,key:a,id:n})),[n]),s(()=>{r!==p.current.disabled&&(c({type:dr.SetDroppableDisabled,id:n,key:a,disabled:r}),p.current.disabled=r)},[n,a,r,c]),{active:u,rect:_,isOver:(null==h?void 0:h.id)===n,node:E,over:h,setNodeRef:T}}({id:h,data:k,disabled:T.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...p}}),{active:M,activatorEvent:D,activeNodeRect:z,attributes:I,setNodeRef:F,listeners:L,isDragging:j,over:U,setActivatorNodeRef:B,transform:V}=Ln({id:h,data:k,attributes:{...ei,...r},disabled:T.draggable}),G=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return a(()=>e=>{t.forEach(t=>t(e))},t)}(P,F),$=Boolean(M),q=$&&!b&&Vn(y)&&Vn(w),W=!A&&j,H=W&&q?V:null,Z=q?null!=H?H:(null!=d?d:E)({rects:x,activeNodeRect:z,activeIndex:y,overIndex:w,index:S}):null,K=Vn(y)&&Vn(w)?c({id:h,items:_,activeIndex:y,overIndex:w}):S,X=null==M?void 0:M.id,Y=o({activeId:X,items:_,newIndex:K,containerId:g}),Q=_!==Y.current.items,J=t({active:M,containerId:g,isDragging:j,isSorting:$,id:h,index:S,items:_,newIndex:Y.current.newIndex,previousItems:Y.current.items,previousContainerId:Y.current.containerId,transition:m,wasDragging:null!=Y.current.activeId}),ee=function(e){let{disabled:t,index:r,node:n,rect:i}=e;const[a,l]=u(null),c=o(r);return Gt(()=>{if(!t&&r!==c.current&&n.current){const e=i.current;if(e){const t=Sr(n.current,{ignoreTransform:!0}),r={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(r.x||r.y)&&l(r)}}r!==c.current&&(c.current=r)},[t,r,n,i]),s(()=>{a&&l(null)},[a]),a}({disabled:!J,index:S,node:C,rect:R});return s(()=>{$&&Y.current.newIndex!==K&&(Y.current.newIndex=K),g!==Y.current.containerId&&(Y.current.containerId=g),_!==Y.current.items&&(Y.current.items=_)},[$,K,g,_]),s(()=>{if(X===Y.current.activeId)return;if(null!=X&&null==Y.current.activeId)return void(Y.current.activeId=X);const e=setTimeout(()=>{Y.current.activeId=X},50);return()=>clearTimeout(e)},[X]),{active:M,activeIndex:y,attributes:I,data:k,rect:R,index:S,newIndex:K,items:_,isOver:N,isSorting:$,isDragging:j,listeners:L,node:C,overIndex:w,over:U,setNodeRef:G,setActivatorNodeRef:B,setDroppableNodeRef:P,setDraggableNodeRef:F,transform:null!=ee?ee:Z,transition:function(){if(ee||Q&&Y.current.newIndex===S)return Jn;if(W&&!er(D)||!m)return;if($||J)return rr.Transition.toString({...m,property:Qn});return}()}}Wr.Down,Wr.Right,Wr.Up,Wr.Left;const ri=({id:t,sx:r,children:n})=>{const{isDragging:i}=Ln({id:t}),{attributes:s,listeners:o,setNodeRef:a,transform:l,transition:u}=ti({id:t,strategy:qn,transition:{duration:300,easing:"cubic-bezier(0.25, 1, 0.5, 1)"}}),c={...r?.default,...i?r?.dragging:{},transform:rr.Translate.toString(l),transition:u,cursor:"pointer"};return e(x,{ref:a,style:c,...o,...s,children:n})};function ni({items:t,getItem:r,getId:n,onDragEnd:i,sx:s,title:o,draggableSx:l}){const u=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return a(()=>[...t].filter(e=>null!=e),[...t])}(a(()=>({sensor:c,options:null!=h?h:{}}),[c=rn,h={activationConstraint:{distance:8}}]));var c,h;return e(zn,{sensors:u,collisionDetection:vr,onDragEnd:e=>{const{active:r,over:s}=e,o=t.findIndex(e=>n(e)===r.id),a=t.findIndex(e=>n(e)===s?.id),l=Un(t,o,a);i(l)},children:e(Zn,{items:t.map(n),strategy:qn,children:e(Q,{items:t,sx:s,title:o,getKey:n,getContent:(t,i)=>{const s=n(t);return e(ri,{id:s,sx:l,children:r(t,i)},s)}})})})}const ii=c(null);function si(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function oi(){return function(){const e=p(ii);if(null==e)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return e}().map}function ai(e,t){return function(){return e.apply(t,arguments)}}const{toString:li}=Object.prototype,{getPrototypeOf:ui}=Object,{iterator:ci,toStringTag:hi}=Symbol,di=(fi=Object.create(null),e=>{const t=li.call(e);return fi[t]||(fi[t]=t.slice(8,-1).toLowerCase())});var fi;const pi=e=>(e=e.toLowerCase(),t=>di(t)===e),mi=e=>t=>typeof t===e,{isArray:_i}=Array,gi=mi("undefined");function yi(e){return null!==e&&!gi(e)&&null!==e.constructor&&!gi(e.constructor)&&xi(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const vi=pi("ArrayBuffer");const bi=mi("string"),xi=mi("function"),wi=mi("number"),Ai=e=>null!==e&&"object"==typeof e,Ei=e=>{if("object"!==di(e))return!1;const t=ui(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||hi in e||ci in e)},Ti=pi("Date"),Si=pi("File"),ki=pi("Blob"),Oi=pi("FileList"),Ri=pi("URLSearchParams"),[Ci,Ni,Pi,Mi]=["ReadableStream","Request","Response","Headers"].map(pi);function Di(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),_i(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(yi(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),s=i.length;let o;for(n=0;n<s;n++)o=i[n],t.call(null,e[o],o,e)}}function zi(e,t){if(yi(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const Ii="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Fi=e=>!gi(e)&&e!==Ii;const Li=(ji="undefined"!=typeof Uint8Array&&ui(Uint8Array),e=>ji&&e instanceof ji);var ji;const Ui=pi("HTMLFormElement"),Bi=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Vi=pi("RegExp"),Gi=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Di(r,(r,i)=>{let s;!1!==(s=t(r,i,e))&&(n[i]=s||r)}),Object.defineProperties(e,n)};const $i=pi("AsyncFunction"),qi=(Wi="function"==typeof setImmediate,Hi=xi(Ii.postMessage),Wi?setImmediate:Hi?(Zi=`axios@${Math.random()}`,Ki=[],Ii.addEventListener("message",({source:e,data:t})=>{e===Ii&&t===Zi&&Ki.length&&Ki.shift()()},!1),e=>{Ki.push(e),Ii.postMessage(Zi,"*")}):e=>setTimeout(e));var Wi,Hi,Zi,Ki;const Xi="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Ii):"undefined"!=typeof process&&process.nextTick||qi;var Yi={isArray:_i,isArrayBuffer:vi,isBuffer:yi,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||xi(e.append)&&("formdata"===(t=di(e))||"object"===t&&xi(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&vi(e.buffer),t},isString:bi,isNumber:wi,isBoolean:e=>!0===e||!1===e,isObject:Ai,isPlainObject:Ei,isEmptyObject:e=>{if(!Ai(e)||yi(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Ci,isRequest:Ni,isResponse:Pi,isHeaders:Mi,isUndefined:gi,isDate:Ti,isFile:Si,isBlob:ki,isRegExp:Vi,isFunction:xi,isStream:e=>Ai(e)&&xi(e.pipe),isURLSearchParams:Ri,isTypedArray:Li,isFileList:Oi,forEach:Di,merge:function e(){const{caseless:t,skipUndefined:r}=Fi(this)&&this||{},n={},i=(i,s)=>{const o=t&&zi(n,s)||s;Ei(n[o])&&Ei(i)?n[o]=e(n[o],i):Ei(i)?n[o]=e({},i):_i(i)?n[o]=i.slice():r&&gi(i)||(n[o]=i)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Di(arguments[e],i);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(Di(t,(t,n)=>{r&&xi(t)?e[n]=ai(t,r):e[n]=t},{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let i,s,o;const a={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)o=i[s],n&&!n(o,e,t)||a[o]||(t[o]=e[o],a[o]=!0);e=!1!==r&&ui(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:di,kindOfTest:pi,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(_i(e))return e;let t=e.length;if(!wi(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[ci]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:Ui,hasOwnProperty:Bi,hasOwnProp:Bi,reduceDescriptors:Gi,freezeMethods:e=>{Gi(e,(t,r)=>{if(xi(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];xi(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach(e=>{r[e]=!0})};return _i(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:zi,global:Ii,isContextDefined:Fi,isSpecCompliantForm:function(e){return!!(e&&xi(e.append)&&"FormData"===e[hi]&&e[ci])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(Ai(e)){if(t.indexOf(e)>=0)return;if(yi(e))return e;if(!("toJSON"in e)){t[n]=e;const i=_i(e)?[]:{};return Di(e,(e,t)=>{const s=r(e,n+1);!gi(s)&&(i[t]=s)}),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:$i,isThenable:e=>e&&(Ai(e)||xi(e))&&xi(e.then)&&xi(e.catch),setImmediate:qi,asap:Xi,isIterable:e=>null!=e&&xi(e[ci])};function Qi(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Yi.inherits(Qi,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Yi.toJSONObject(this.config),code:this.code,status:this.status}}});const Ji=Qi.prototype,es={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{es[e]={value:e}}),Object.defineProperties(Qi,es),Object.defineProperty(Ji,"isAxiosError",{value:!0}),Qi.from=(e,t,r,n,i,s)=>{const o=Object.create(Ji);Yi.toFlatObject(e,o,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",l=null==t&&e?e.code:t;return Qi.call(o,a,l,r,n,i),e&&null==o.cause&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",s&&Object.assign(o,s),o};function ts(e){return Yi.isPlainObject(e)||Yi.isArray(e)}function rs(e){return Yi.endsWith(e,"[]")?e.slice(0,-2):e}function ns(e,t,r){return e?e.concat(t).map(function(e,t){return e=rs(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const is=Yi.toFlatObject(Yi,{},null,function(e){return/^is[A-Z]/.test(e)});function ss(e,t,r){if(!Yi.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=Yi.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Yi.isUndefined(t[e])})).metaTokens,i=r.visitor||u,s=r.dots,o=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Yi.isSpecCompliantForm(t);if(!Yi.isFunction(i))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(Yi.isDate(e))return e.toISOString();if(Yi.isBoolean(e))return e.toString();if(!a&&Yi.isBlob(e))throw new Qi("Blob is not supported. Use a Buffer instead.");return Yi.isArrayBuffer(e)||Yi.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,i){let a=e;if(e&&!i&&"object"==typeof e)if(Yi.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(Yi.isArray(e)&&function(e){return Yi.isArray(e)&&!e.some(ts)}(e)||(Yi.isFileList(e)||Yi.endsWith(r,"[]"))&&(a=Yi.toArray(e)))return r=rs(r),a.forEach(function(e,n){!Yi.isUndefined(e)&&null!==e&&t.append(!0===o?ns([r],n,s):null===o?r:r+"[]",l(e))}),!1;return!!ts(e)||(t.append(ns(i,r,s),l(e)),!1)}const c=[],h=Object.assign(is,{defaultVisitor:u,convertValue:l,isVisitable:ts});if(!Yi.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!Yi.isUndefined(r)){if(-1!==c.indexOf(r))throw Error("Circular reference detected in "+n.join("."));c.push(r),Yi.forEach(r,function(r,s){!0===(!(Yi.isUndefined(r)||null===r)&&i.call(t,r,Yi.isString(s)?s.trim():s,n,h))&&e(r,n?n.concat(s):[s])}),c.pop()}}(e),t}function os(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function as(e,t){this._pairs=[],e&&ss(e,this,t)}const ls=as.prototype;function us(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function cs(e,t,r){if(!t)return e;const n=r&&r.encode||us;Yi.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(s=i?i(t,r):Yi.isURLSearchParams(t)?t.toString():new as(t,r).toString(n),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}ls.append=function(e,t){this._pairs.push([e,t])},ls.toString=function(e){const t=e?function(t){return e.call(this,t,os)}:os;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class hs{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Yi.forEach(this.handlers,function(t){null!==t&&e(t)})}}var ds={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},fs={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:as,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ps="undefined"!=typeof window&&"undefined"!=typeof document,ms="object"==typeof navigator&&navigator||void 0,_s=ps&&(!ms||["ReactNative","NativeScript","NS"].indexOf(ms.product)<0),gs="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ys=ps&&window.location.href||"http://localhost";var vs={...Object.freeze({__proto__:null,hasBrowserEnv:ps,hasStandardBrowserEnv:_s,hasStandardBrowserWebWorkerEnv:gs,navigator:ms,origin:ys}),...fs};function bs(e){function t(e,r,n,i){let s=e[i++];if("__proto__"===s)return!0;const o=Number.isFinite(+s),a=i>=e.length;if(s=!s&&Yi.isArray(n)?n.length:s,a)return Yi.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!o;n[s]&&Yi.isObject(n[s])||(n[s]=[]);return t(e,r,n[s],i)&&Yi.isArray(n[s])&&(n[s]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let s;for(n=0;n<i;n++)s=r[n],t[s]=e[s];return t}(n[s])),!o}if(Yi.isFormData(e)&&Yi.isFunction(e.entries)){const r={};return Yi.forEachEntry(e,(e,n)=>{t(function(e){return Yi.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const xs={transitional:ds,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=Yi.isObject(e);i&&Yi.isHTMLForm(e)&&(e=new FormData(e));if(Yi.isFormData(e))return n?JSON.stringify(bs(e)):e;if(Yi.isArrayBuffer(e)||Yi.isBuffer(e)||Yi.isStream(e)||Yi.isFile(e)||Yi.isBlob(e)||Yi.isReadableStream(e))return e;if(Yi.isArrayBufferView(e))return e.buffer;if(Yi.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ss(e,new vs.classes.URLSearchParams,{visitor:function(e,t,r,n){return vs.isNode&&Yi.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((s=Yi.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ss(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(Yi.isString(e))try{return(t||JSON.parse)(e),Yi.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||xs.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(Yi.isResponse(e)||Yi.isReadableStream(e))return e;if(e&&Yi.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e,this.parseReviver)}catch(e){if(r){if("SyntaxError"===e.name)throw Qi.from(e,Qi.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:vs.classes.FormData,Blob:vs.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Yi.forEach(["delete","get","head","post","put","patch"],e=>{xs.headers[e]={}});const ws=Yi.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const As=Symbol("internals");function Es(e){return e&&String(e).trim().toLowerCase()}function Ts(e){return!1===e||null==e?e:Yi.isArray(e)?e.map(Ts):String(e)}function Ss(e,t,r,n,i){return Yi.isFunction(n)?n.call(this,t,r):(i&&(t=r),Yi.isString(t)?Yi.isString(n)?-1!==t.indexOf(n):Yi.isRegExp(n)?n.test(t):void 0:void 0)}let ks=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=Es(t);if(!i)throw new Error("header name must be a non-empty string");const s=Yi.findKey(n,i);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||t]=Ts(e))}const s=(e,t)=>Yi.forEach(e,(e,r)=>i(e,r,t));if(Yi.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(Yi.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach(function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&ws[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t})(e),t);else if(Yi.isObject(e)&&Yi.isIterable(e)){let r,n,i={};for(const t of e){if(!Yi.isArray(t))throw TypeError("Object iterator must return a key-value pair");i[n=t[0]]=(r=i[n])?Yi.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}s(i,t)}else null!=e&&i(t,e,r);return this}get(e,t){if(e=Es(e)){const r=Yi.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(Yi.isFunction(t))return t.call(this,e,r);if(Yi.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Es(e)){const r=Yi.findKey(this,e);return!(!r||void 0===this[r]||t&&!Ss(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=Es(e)){const i=Yi.findKey(r,e);!i||t&&!Ss(0,r[i],i,t)||(delete r[i],n=!0)}}return Yi.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!Ss(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return Yi.forEach(this,(n,i)=>{const s=Yi.findKey(r,i);if(s)return t[s]=Ts(n),void delete t[i];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(i):String(i).trim();o!==i&&delete t[i],t[o]=Ts(n),r[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Yi.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&Yi.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){const t=(this[As]=this[As]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Es(e);t[n]||(!function(e,t){const r=Yi.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})})}(r,e),t[n]=!0)}return Yi.isArray(e)?e.forEach(n):n(e),this}};function Os(e,t){const r=this||xs,n=t||r,i=ks.from(n.headers);let s=n.data;return Yi.forEach(e,function(e){s=e.call(r,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function Rs(e){return!(!e||!e.__CANCEL__)}function Cs(e,t,r){Qi.call(this,null==e?"canceled":e,Qi.ERR_CANCELED,t,r),this.name="CanceledError"}function Ns(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new Qi("Request failed with status code "+r.status,[Qi.ERR_BAD_REQUEST,Qi.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}ks.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Yi.reduceDescriptors(ks.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),Yi.freezeMethods(ks),Yi.inherits(Cs,Qi,{__CANCEL__:!0});const Ps=(e,t,r=3)=>{let n=0;const i=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,s=0,o=0;return t=void 0!==t?t:1e3,function(a){const l=Date.now(),u=n[o];i||(i=l),r[s]=a,n[s]=l;let c=o,h=0;for(;c!==s;)h+=r[c++],c%=e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),l-i<t)return;const d=u&&l-u;return d?Math.round(1e3*h/d):void 0}}(50,250);return function(e,t){let r,n,i=0,s=1e3/t;const o=(t,s=Date.now())=>{i=s,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-i;a>=s?o(e,t):(r=e,n||(n=setTimeout(()=>{n=null,o(r)},s-a)))},()=>r&&o(r)]}(r=>{const s=r.loaded,o=r.lengthComputable?r.total:void 0,a=s-n,l=i(a);n=s;e({loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:l||void 0,estimated:l&&o&&s<=o?(o-s)/l:void 0,event:r,lengthComputable:null!=o,[t?"download":"upload"]:!0})},r)},Ms=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Ds=e=>(...t)=>Yi.asap(()=>e(...t));var zs=vs.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,vs.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(vs.origin),vs.navigator&&/(msie|trident)/i.test(vs.navigator.userAgent)):()=>!0,Is=vs.hasStandardBrowserEnv?{write(e,t,r,n,i,s,o){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];Yi.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),Yi.isString(n)&&a.push(`path=${n}`),Yi.isString(i)&&a.push(`domain=${i}`),!0===s&&a.push("secure"),Yi.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function Fs(e,t,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Ls=e=>e instanceof ks?{...e}:e;function js(e,t){t=t||{};const r={};function n(e,t,r,n){return Yi.isPlainObject(e)&&Yi.isPlainObject(t)?Yi.merge.call({caseless:n},e,t):Yi.isPlainObject(t)?Yi.merge({},t):Yi.isArray(t)?t.slice():t}function i(e,t,r,i){return Yi.isUndefined(t)?Yi.isUndefined(e)?void 0:n(void 0,e,0,i):n(e,t,0,i)}function s(e,t){if(!Yi.isUndefined(t))return n(void 0,t)}function o(e,t){return Yi.isUndefined(t)?Yi.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,i,s){return s in t?n(r,i):s in e?n(void 0,r):void 0}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(e,t,r)=>i(Ls(e),Ls(t),0,!0)};return Yi.forEach(Object.keys({...e,...t}),function(n){const s=l[n]||i,o=s(e[n],t[n],n);Yi.isUndefined(o)&&s!==a||(r[n]=o)}),r}var Us=e=>{const t=js({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=t;if(t.headers=o=ks.from(o),t.url=cs(Fs(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),Yi.isFormData(r))if(vs.hasStandardBrowserEnv||vs.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(Yi.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&o.set(e,r)})}if(vs.hasStandardBrowserEnv&&(n&&Yi.isFunction(n)&&(n=n(t)),n||!1!==n&&zs(t.url))){const e=i&&s&&Is.read(s);e&&o.set(i,e)}return t};var Bs="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=Us(e);let i=n.data;const s=ks.from(n.headers).normalize();let o,a,l,u,c,{responseType:h,onUploadProgress:d,onDownloadProgress:f}=n;function p(){u&&u(),c&&c(),n.cancelToken&&n.cancelToken.unsubscribe(o),n.signal&&n.signal.removeEventListener("abort",o)}let m=new XMLHttpRequest;function _(){if(!m)return;const n=ks.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Ns(function(e){t(e),p()},function(e){r(e),p()},{data:h&&"text"!==h&&"json"!==h?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:n,config:e,request:m}),m=null}m.open(n.method.toUpperCase(),n.url,!0),m.timeout=n.timeout,"onloadend"in m?m.onloadend=_:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(_)},m.onabort=function(){m&&(r(new Qi("Request aborted",Qi.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const n=new Qi(t&&t.message?t.message:"Network Error",Qi.ERR_NETWORK,e,m);n.event=t||null,r(n),m=null},m.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const i=n.transitional||ds;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new Qi(t,i.clarifyTimeoutError?Qi.ETIMEDOUT:Qi.ECONNABORTED,e,m)),m=null},void 0===i&&s.setContentType(null),"setRequestHeader"in m&&Yi.forEach(s.toJSON(),function(e,t){m.setRequestHeader(t,e)}),Yi.isUndefined(n.withCredentials)||(m.withCredentials=!!n.withCredentials),h&&"json"!==h&&(m.responseType=n.responseType),f&&([l,c]=Ps(f,!0),m.addEventListener("progress",l)),d&&m.upload&&([a,u]=Ps(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(n.cancelToken||n.signal)&&(o=t=>{m&&(r(!t||t.type?new Cs(null,e,m):t),m.abort(),m=null)},n.cancelToken&&n.cancelToken.subscribe(o),n.signal&&(n.signal.aborted?o():n.signal.addEventListener("abort",o)));const g=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);g&&-1===vs.protocols.indexOf(g)?r(new Qi("Unsupported protocol "+g+":",Qi.ERR_BAD_REQUEST,e)):m.send(i||null)})};const Vs=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const i=function(e){if(!r){r=!0,o();const t=e instanceof Error?e:this.reason;n.abort(t instanceof Qi?t:new Cs(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,i(new Qi(`timeout ${t} of ms exceeded`,Qi.ETIMEDOUT))},t);const o=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener("abort",i)}),e=null)};e.forEach(e=>e.addEventListener("abort",i));const{signal:a}=n;return a.unsubscribe=()=>Yi.asap(o),a}},Gs=function*(e,t){let r=e.byteLength;if(r<t)return void(yield e);let n,i=0;for(;i<r;)n=i+t,yield e.slice(i,n),i=n},$s=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},qs=(e,t,r,n)=>{const i=async function*(e,t){for await(const r of $s(e))yield*Gs(r,t)}(e,t);let s,o=0,a=e=>{s||(s=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await i.next();if(t)return a(),void e.close();let s=n.byteLength;if(r){let e=o+=s;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw a(e),e}},cancel:e=>(a(e),i.return())},{highWaterMark:2})},{isFunction:Ws}=Yi,Hs=(({Request:e,Response:t})=>({Request:e,Response:t}))(Yi.global),{ReadableStream:Zs,TextEncoder:Ks}=Yi.global,Xs=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Ys=e=>{e=Yi.merge.call({skipUndefined:!0},Hs,e);const{fetch:t,Request:r,Response:n}=e,i=t?Ws(t):"function"==typeof fetch,s=Ws(r),o=Ws(n);if(!i)return!1;const a=i&&Ws(Zs),l=i&&("function"==typeof Ks?(u=new Ks,e=>u.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var u;const c=s&&a&&Xs(()=>{let e=!1;const t=new r(vs.origin,{body:new Zs,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),h=o&&a&&Xs(()=>Yi.isReadableStream(new n("").body)),d={stream:h&&(e=>e.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!d[e]&&(d[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new Qi(`Response type '${e}' is not supported`,Qi.ERR_NOT_SUPPORT,r)})});const f=async(e,t)=>{const n=Yi.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(Yi.isBlob(e))return e.size;if(Yi.isSpecCompliantForm(e)){const t=new r(vs.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Yi.isArrayBufferView(e)||Yi.isArrayBuffer(e)?e.byteLength:(Yi.isURLSearchParams(e)&&(e+=""),Yi.isString(e)?(await l(e)).byteLength:void 0)})(t):n};return async e=>{let{url:i,method:o,data:a,signal:l,cancelToken:u,timeout:p,onDownloadProgress:m,onUploadProgress:_,responseType:g,headers:y,withCredentials:v="same-origin",fetchOptions:b}=Us(e),x=t||fetch;g=g?(g+"").toLowerCase():"text";let w=Vs([l,u&&u.toAbortSignal()],p),A=null;const E=w&&w.unsubscribe&&(()=>{w.unsubscribe()});let T;try{if(_&&c&&"get"!==o&&"head"!==o&&0!==(T=await f(y,a))){let e,t=new r(i,{method:"POST",body:a,duplex:"half"});if(Yi.isFormData(a)&&(e=t.headers.get("content-type"))&&y.setContentType(e),t.body){const[e,r]=Ms(T,Ps(Ds(_)));a=qs(t.body,65536,e,r)}}Yi.isString(v)||(v=v?"include":"omit");const t=s&&"credentials"in r.prototype,l={...b,signal:w,method:o.toUpperCase(),headers:y.normalize().toJSON(),body:a,duplex:"half",credentials:t?v:void 0};A=s&&new r(i,l);let u=await(s?x(A,b):x(i,l));const p=h&&("stream"===g||"response"===g);if(h&&(m||p&&E)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=u[t]});const t=Yi.toFiniteNumber(u.headers.get("content-length")),[r,i]=m&&Ms(t,Ps(Ds(m),!0))||[];u=new n(qs(u.body,65536,r,()=>{i&&i(),E&&E()}),e)}g=g||"text";let S=await d[Yi.findKey(d,g)||"text"](u,e);return!p&&E&&E(),await new Promise((t,r)=>{Ns(t,r,{data:S,headers:ks.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:A})})}catch(t){if(E&&E(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Qi("Network Error",Qi.ERR_NETWORK,e,A),{cause:t.cause||t});throw Qi.from(t,t&&t.code,e,A)}}},Qs=new Map,Js=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:i}=t,s=[n,i,r];let o,a,l=s.length,u=Qs;for(;l--;)o=s[l],a=u.get(o),void 0===a&&u.set(o,a=l?new Map:Ys(t)),u=a;return a};Js();const eo={http:null,xhr:Bs,fetch:{get:Js}};Yi.forEach(eo,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const to=e=>`- ${e}`,ro=e=>Yi.isFunction(e)||null===e||!1===e;var no={getAdapter:function(e,t){e=Yi.isArray(e)?e:[e];const{length:r}=e;let n,i;const s={};for(let o=0;o<r;o++){let r;if(n=e[o],i=n,!ro(n)&&(i=eo[(r=String(n)).toLowerCase()],void 0===i))throw new Qi(`Unknown adapter '${r}'`);if(i&&(Yi.isFunction(i)||(i=i.get(t))))break;s[r||"#"+o]=i}if(!i){const e=Object.entries(s).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new Qi("There is no suitable adapter to dispatch the request "+(r?e.length>1?"since :\n"+e.map(to).join("\n"):" "+to(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return i},adapters:eo};function io(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Cs(null,e)}function so(e){io(e),e.headers=ks.from(e.headers),e.data=Os.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return no.getAdapter(e.adapter||xs.adapter,e)(e).then(function(t){return io(e),t.data=Os.call(e,e.transformResponse,t),t.headers=ks.from(t.headers),t},function(t){return Rs(t)||(io(e),t&&t.response&&(t.response.data=Os.call(e,e.transformResponse,t.response),t.response.headers=ks.from(t.response.headers))),Promise.reject(t)})}const oo="1.13.2",ao={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ao[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const lo={};ao.transitional=function(e,t,r){function n(e,t){return"[Axios v"+oo+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,s)=>{if(!1===e)throw new Qi(n(i," has been removed"+(t?" in "+t:"")),Qi.ERR_DEPRECATED);return t&&!lo[i]&&(lo[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,s)}},ao.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var uo={assertOptions:function(e,t,r){if("object"!=typeof e)throw new Qi("options must be an object",Qi.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const s=n[i],o=t[s];if(o){const t=e[s],r=void 0===t||o(t,s,e);if(!0!==r)throw new Qi("option "+s+" must be "+r,Qi.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new Qi("Unknown option "+s,Qi.ERR_BAD_OPTION)}},validators:ao};const co=uo.validators;let ho=class{constructor(e){this.defaults=e||{},this.interceptors={request:new hs,response:new hs}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=js(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;void 0!==r&&uo.assertOptions(r,{silentJSONParsing:co.transitional(co.boolean),forcedJSONParsing:co.transitional(co.boolean),clarifyTimeoutError:co.transitional(co.boolean)},!1),null!=n&&(Yi.isFunction(n)?t.paramsSerializer={serialize:n}:uo.assertOptions(n,{encode:co.function,serialize:co.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),uo.assertOptions(t,{baseUrl:co.spelling("baseURL"),withXsrfToken:co.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=i&&Yi.merge(i.common,i[t.method]);i&&Yi.forEach(["delete","get","head","post","put","patch","common"],e=>{delete i[e]}),t.headers=ks.concat(s,i);const o=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,o.unshift(e.fulfilled,e.rejected))});const l=[];let u;this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let c,h=0;if(!a){const e=[so.bind(this),void 0];for(e.unshift(...o),e.push(...l),c=e.length,u=Promise.resolve(t);h<c;)u=u.then(e[h++],e[h++]);return u}c=o.length;let d=t;for(;h<c;){const e=o[h++],t=o[h++];try{d=e(d)}catch(e){t.call(this,e);break}}try{u=so.call(this,d)}catch(e){return Promise.reject(e)}for(h=0,c=l.length;h<c;)u=u.then(l[h++],l[h++]);return u}getUri(e){return cs(Fs((e=js(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};Yi.forEach(["delete","get","head","options"],function(e){ho.prototype[e]=function(t,r){return this.request(js(r||{},{method:e,url:t,data:(r||{}).data}))}}),Yi.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,i){return this.request(js(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}ho.prototype[e]=t(),ho.prototype[e+"Form"]=t(!0)});const fo={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(fo).forEach(([e,t])=>{fo[t]=e});const po=function e(t){const r=new ho(t),n=ai(ho.prototype.request,r);return Yi.extend(n,ho.prototype,r,{allOwnKeys:!0}),Yi.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(js(t,r))},n}(xs);po.Axios=ho,po.CanceledError=Cs,po.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t;const n=new Promise(e=>{r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,n,i){r.reason||(r.reason=new Cs(e,n,i),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;const r=new e(function(e){t=e});return{token:r,cancel:t}}},po.isCancel=Rs,po.VERSION=oo,po.toFormData=ss,po.AxiosError=Qi,po.Cancel=po.CanceledError,po.all=function(e){return Promise.all(e)},po.spread=function(e){return function(t){return e.apply(null,t)}},po.isAxiosError=function(e){return Yi.isObject(e)&&!0===e.isAxiosError},po.mergeConfig=js,po.AxiosHeaders=ks,po.formToJSON=e=>bs(Yi.isHTMLForm(e)?new FormData(e):e),po.getAdapter=no.getAdapter,po.HttpStatusCode=fo,po.default=po;const{Axios:mo,AxiosError:_o,CanceledError:go,isCancel:yo,CancelToken:vo,VERSION:bo,all:xo,Cancel:wo,isAxiosError:Ao,spread:Eo,toFormData:To,AxiosHeaders:So,HttpStatusCode:ko,formToJSON:Oo,getAdapter:Ro,mergeConfig:Co}=po;var No="production"!==process.env.NODE_ENV?{0:"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'",1:function(e,t){return"Cannot apply '"+e+"' to '"+t.toString()+"': Field not found."},5:"'keys()' can only be used on observable objects, arrays, sets and maps",6:"'values()' can only be used on observable objects, arrays, sets and maps",7:"'entries()' can only be used on observable objects, arrays and maps",8:"'set()' can only be used on observable objects, arrays and maps",9:"'remove()' can only be used on observable objects, arrays and maps",10:"'has()' can only be used on observable objects, arrays and maps",11:"'get()' can only be used on observable objects, arrays and maps",12:"Invalid annotation",13:"Dynamic observable objects cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",14:"Intercept handlers should return nothing or a change object",15:"Observable arrays cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",16:"Modification exception: the internal structure of an observable array was changed.",17:function(e,t){return"[mobx.array] Index out of bounds, "+e+" is larger than "+t},18:"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js",19:function(e){return"Cannot initialize from classes that inherit from Map: "+e.constructor.name},20:function(e){return"Cannot initialize map from "+e},21:function(e){return"Cannot convert to map from '"+e+"'"},22:"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js",23:"It is not possible to get index atoms from arrays",24:function(e){return"Cannot obtain administration from "+e},25:function(e,t){return"the entry '"+e+"' does not exist in the observable map '"+t+"'"},26:"please specify a property",27:function(e,t){return"no observable property '"+e.toString()+"' found on the observable object '"+t+"'"},28:function(e){return"Cannot obtain atom from "+e},29:"Expecting some object",30:"invalid action stack. did you forget to finish an action?",31:"missing option for computed: get",32:function(e,t){return"Cycle detected in computation "+e+": "+t},33:function(e){return"The setter of computed value '"+e+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"},34:function(e){return"[ComputedValue '"+e+"'] It is not possible to assign a new value to a computed value."},35:"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`",36:"isolateGlobalState should be called before MobX is running any reactions",37:function(e){return"[mobx] `observableArray."+e+"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice()."+e+"()` instead"},38:"'ownKeys()' can only be used on observable objects",39:"'defineProperty()' can only be used on observable objects"}:{};function Po(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if("production"!==process.env.NODE_ENV){var i="string"==typeof e?e:No[e];throw"function"==typeof i&&(i=i.apply(null,r)),new Error("[MobX] "+i)}throw new Error("number"==typeof e?"[MobX] minified error nr: "+e+(r.length?" "+r.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var Mo={};function Do(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:Mo}var zo=Object.assign,Io=Object.getOwnPropertyDescriptor,Fo=Object.defineProperty,Lo=Object.prototype,jo=[];Object.freeze(jo);var Uo={};Object.freeze(Uo);var Bo="undefined"!=typeof Proxy,Vo=Object.toString();function Go(){Bo||Po("production"!==process.env.NODE_ENV?"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`":"Proxy not available")}function $o(e){"production"!==process.env.NODE_ENV&&Hl.verifyProxies&&Po("MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to "+e)}function qo(){return++Hl.mobxGuid}function Wo(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Ho=function(){};function Zo(e){return"function"==typeof e}function Ko(e){switch(typeof e){case"string":case"symbol":case"number":return!0}return!1}function Xo(e){return null!==e&&"object"==typeof e}function Yo(e){if(!Xo(e))return!1;var t=Object.getPrototypeOf(e);if(null==t)return!0;var r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r.toString()===Vo}function Qo(e){var t=null==e?void 0:e.constructor;return!!t&&("GeneratorFunction"===t.name||"GeneratorFunction"===t.displayName)}function Jo(e,t,r){Fo(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function ea(e,t,r){Fo(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function ta(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(e){return Xo(e)&&!0===e[r]}}function ra(e){return null!=e&&"[object Map]"===Object.prototype.toString.call(e)}function na(e){return null!=e&&"[object Set]"===Object.prototype.toString.call(e)}var ia=void 0!==Object.getOwnPropertySymbols;var sa="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:ia?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function oa(e){return"string"==typeof e?e:"symbol"==typeof e?e.toString():new String(e).toString()}function aa(e){return null===e?null:"object"==typeof e?""+e:e}function la(e,t){return Lo.hasOwnProperty.call(e,t)}var ua=Object.getOwnPropertyDescriptors||function(e){var t={};return sa(e).forEach(function(r){t[r]=Io(e,r)}),t};function ca(e,t){return!!(e&t)}function ha(e,t,r){return r?e|=t:e&=~t,e}function da(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function fa(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ya(n.key),n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function pa(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return da(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?da(e,t):void 0}}(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ma(){return ma=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ma.apply(null,arguments)}function _a(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ga(e,t)}function ga(e,t){return ga=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ga(e,t)}function ya(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}var va=Symbol("mobx-stored-annotations");function ba(e){return Object.assign(function(t,r){if(wa(r))return e.decorate_20223_(t,r);xa(t,r,e)},e)}function xa(e,t,r){(la(e,va)||Jo(e,va,ma({},e[va])),"production"!==process.env.NODE_ENV&&Pa(r)&&!la(e[va],t))&&Po("'"+(e.constructor.name+".prototype."+t.toString())+"' is decorated with 'override', but no such decorated member was found on prototype.");!function(e,t,r){if("production"!==process.env.NODE_ENV&&!Pa(t)&&la(e[va],r)){var n=e.constructor.name+".prototype."+r.toString(),i=e[va][r].annotationType_;Po("Cannot apply '@"+t.annotationType_+"' to '"+n+"':\nThe field is already decorated with '@"+i+"'.\nRe-decorating fields is not allowed.\nUse '@override' decorator for methods overridden by subclass.")}}(e,r,t),Pa(r)||(e[va][t]=r)}function wa(e){return"object"==typeof e&&"string"==typeof e.kind}function Aa(e,t){"production"===process.env.NODE_ENV||t.includes(e.kind)||Po("The decorator applied to '"+String(e.name)+"' cannot be used on a "+e.kind+" element")}var Ea=Symbol("mobx administration"),Ta=function(){function e(e){void 0===e&&(e="production"!==process.env.NODE_ENV?"Atom@"+qo():"Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=Rl.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.reportObserved=function(){return Jl(this)},t.reportChanged=function(){Yl(),eu(this),Ql()},t.toString=function(){return this.name_},fa(e,[{key:"isBeingObserved",get:function(){return ca(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=ha(this.flags_,e.isBeingObservedMask_,t)}},{key:"isPendingUnobservation",get:function(){return ca(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=ha(this.flags_,e.isPendingUnobservationMask_,t)}},{key:"diffValue",get:function(){return ca(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=ha(this.flags_,e.diffValueMask_,1===t)}}])}();Ta.isBeingObservedMask_=1,Ta.isPendingUnobservationMask_=2,Ta.diffValueMask_=4;var Sa=ta("Atom",Ta);function ka(e,t,r){void 0===t&&(t=Ho),void 0===r&&(r=Ho);var n,i=new Ta(e);return t!==Ho&&Ou(Tu,i,t,n),r!==Ho&&ku(i,r),i}var Oa={structural:function(e,t){return Hc(e,t)},default:function(e,t){return Object.is?Object.is(e,t):e===t?0!==e||1/e==1/t:e!=e&&t!=t}};function Ra(e,t,r){return Bu(e)?e:Array.isArray(e)?ml.array(e,{name:r}):Yo(e)?ml.object(e,void 0,{name:r}):ra(e)?ml.map(e,{name:r}):na(e)?ml.set(e,{name:r}):"function"!=typeof e||Au(e)||Uu(e)?e:Qo(e)?Lu(e):wu(r,e)}function Ca(e){return e}var Na="override";function Pa(e){return e.annotationType_===Na}function Ma(e,t){return{annotationType_:e,options_:t,make_:Da,extend_:za,decorate_20223_:Ia}}function Da(e,t,r,n){var i;if(null!=(i=this.options_)&&i.bound)return null===this.extend_(e,t,r,!1)?0:1;if(n===e.target_)return null===this.extend_(e,t,r,!1)?0:2;if(Au(r.value))return 1;var s=Fa(e,this,t,r,!1);return Fo(n,t,s),2}function za(e,t,r,n){var i=Fa(e,this,t,r);return e.defineProperty_(t,i,n)}function Ia(e,t){"production"!==process.env.NODE_ENV&&Aa(t,["method","field"]);var r,n=t.kind,i=t.name,s=t.addInitializer,o=this,a=function(e){var t,r,n,s;return El(null!=(t=null==(r=o.options_)?void 0:r.name)?t:i.toString(),e,null!=(n=null==(s=o.options_)?void 0:s.autoAction)&&n)};return"field"==n?function(e){var t,r=e;return Au(r)||(r=a(r)),null!=(t=o.options_)&&t.bound&&((r=r.bind(this)).isMobxAction=!0),r}:"method"==n?(Au(e)||(e=a(e)),null!=(r=this.options_)&&r.bound&&s(function(){var e=this,t=e[i].bind(e);t.isMobxAction=!0,e[i]=t}),e):void Po("Cannot apply '"+o.annotationType_+"' to '"+String(i)+"' (kind: "+n+"):\n'"+o.annotationType_+"' can only be used on properties with a function value.")}function Fa(e,t,r,n,i){var s,o,a,l,u,c,h;void 0===i&&(i=Hl.safeDescriptors),function(e,t,r,n){var i=t.annotationType_,s=n.value;"production"===process.env.NODE_ENV||Zo(s)||Po("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':\n'"+i+"' can only be used on properties with a function value.")}(e,t,r,n);var d,f=n.value;null!=(s=t.options_)&&s.bound&&(f=f.bind(null!=(d=e.proxy_)?d:e.target_));return{value:El(null!=(o=null==(a=t.options_)?void 0:a.name)?o:r.toString(),f,null!=(l=null==(u=t.options_)?void 0:u.autoAction)&&l,null!=(c=t.options_)&&c.bound?null!=(h=e.proxy_)?h:e.target_:void 0),configurable:!i||e.isPlainObject_,enumerable:!1,writable:!i}}function La(e,t){return{annotationType_:e,options_:t,make_:ja,extend_:Ua,decorate_20223_:Ba}}function ja(e,t,r,n){var i;if(n===e.target_)return null===this.extend_(e,t,r,!1)?0:2;if(null!=(i=this.options_)&&i.bound&&(!la(e.target_,t)||!Uu(e.target_[t]))&&null===this.extend_(e,t,r,!1))return 0;if(Uu(r.value))return 1;var s=Va(e,this,t,r,!1,!1);return Fo(n,t,s),2}function Ua(e,t,r,n){var i,s=Va(e,this,t,r,null==(i=this.options_)?void 0:i.bound);return e.defineProperty_(t,s,n)}function Ba(e,t){var r;"production"!==process.env.NODE_ENV&&Aa(t,["method"]);var n=t.name,i=t.addInitializer;return Uu(e)||(e=Lu(e)),null!=(r=this.options_)&&r.bound&&i(function(){var e=this,t=e[n].bind(e);t.isMobXFlow=!0,e[n]=t}),e}function Va(e,t,r,n,i,s){void 0===s&&(s=Hl.safeDescriptors),function(e,t,r,n){var i=t.annotationType_,s=n.value;"production"===process.env.NODE_ENV||Zo(s)||Po("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':\n'"+i+"' can only be used on properties with a generator function value.")}(e,t,r,n);var o,a=n.value;(Uu(a)||(a=Lu(a)),i)&&((a=a.bind(null!=(o=e.proxy_)?o:e.target_)).isMobXFlow=!0);return{value:a,configurable:!s||e.isPlainObject_,enumerable:!1,writable:!s}}function Ga(e,t){return{annotationType_:e,options_:t,make_:$a,extend_:qa,decorate_20223_:Wa}}function $a(e,t,r){return null===this.extend_(e,t,r,!1)?0:1}function qa(e,t,r,n){return function(e,t,r,n){var i=t.annotationType_,s=n.get;"production"===process.env.NODE_ENV||s||Po("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':\n'"+i+"' can only be used on getter(+setter) properties.")}(e,this,t,r),e.defineComputedProperty_(t,ma({},this.options_,{get:r.get,set:r.set}),n)}function Wa(e,t){"production"!==process.env.NODE_ENV&&Aa(t,["getter"]);var r=this,n=t.name;return(0,t.addInitializer)(function(){var t=Ec(this)[Ea],i=ma({},r.options_,{get:e,context:this});i.name||(i.name="production"!==process.env.NODE_ENV?t.name_+"."+n.toString():"ObservableObject."+n.toString()),t.values_.set(n,new Ol(i))}),function(){return this[Ea].getObservablePropValue_(n)}}function Ha(e,t){return{annotationType_:e,options_:t,make_:Za,extend_:Ka,decorate_20223_:Xa}}function Za(e,t,r){return null===this.extend_(e,t,r,!1)?0:1}function Ka(e,t,r,n){var i,s;return function(e,t,r,n){var i=t.annotationType_;"production"===process.env.NODE_ENV||"value"in n||Po("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':\n'"+i+"' cannot be used on getter/setter properties")}(e,this,t,r),e.defineObservableProperty_(t,r.value,null!=(i=null==(s=this.options_)?void 0:s.enhancer)?i:Ra,n)}function Xa(e,t){if("production"!==process.env.NODE_ENV){if("field"===t.kind)throw Po("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");Aa(t,["accessor"])}var r=this,n=t.kind,i=t.name,s=new WeakSet;function o(e,t){var n,o,a=Ec(e)[Ea],l=new kl(t,null!=(n=null==(o=r.options_)?void 0:o.enhancer)?n:Ra,"production"!==process.env.NODE_ENV?a.name_+"."+i.toString():"ObservableObject."+i.toString(),!1);a.values_.set(i,l),s.add(e)}if("accessor"==n)return{get:function(){return s.has(this)||o(this,e.get.call(this)),this[Ea].getObservablePropValue_(i)},set:function(e){return s.has(this)||o(this,e),this[Ea].setObservablePropValue_(i,e)},init:function(e){return s.has(this)||o(this,e),e}}}var Ya="true",Qa=Ja();function Ja(e){return{annotationType_:Ya,options_:e,make_:el,extend_:tl,decorate_20223_:rl}}function el(e,t,r,n){var i,s,o,a;if(r.get)return vl.make_(e,t,r,n);if(r.set){var l=Au(r.set)?r.set:El(t.toString(),r.set);return n===e.target_?null===e.defineProperty_(t,{configurable:!Hl.safeDescriptors||e.isPlainObject_,set:l})?0:2:(Fo(n,t,{configurable:!0,set:l}),2)}if(n!==e.target_&&"function"==typeof r.value)return Qo(r.value)?(null!=(a=this.options_)&&a.autoBind?Lu.bound:Lu).make_(e,t,r,n):(null!=(o=this.options_)&&o.autoBind?wu.bound:wu).make_(e,t,r,n);var u,c=!1===(null==(i=this.options_)?void 0:i.deep)?ml.ref:ml;"function"==typeof r.value&&null!=(s=this.options_)&&s.autoBind&&(r.value=r.value.bind(null!=(u=e.proxy_)?u:e.target_));return c.make_(e,t,r,n)}function tl(e,t,r,n){var i,s,o;if(r.get)return vl.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:!Hl.safeDescriptors||e.isPlainObject_,set:El(t.toString(),r.set)},n);"function"==typeof r.value&&null!=(i=this.options_)&&i.autoBind&&(r.value=r.value.bind(null!=(o=e.proxy_)?o:e.target_));return(!1===(null==(s=this.options_)?void 0:s.deep)?ml.ref:ml).extend_(e,t,r,n)}function rl(e,t){Po("'"+this.annotationType_+"' cannot be used as a decorator")}var nl={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};function il(e){return e||nl}Object.freeze(nl);var sl=Ha("observable"),ol=Ha("observable.ref",{enhancer:Ca}),al=Ha("observable.shallow",{enhancer:function(e,t,r){return null==e||kc(e)||cc(e)||mc(e)||vc(e)?e:Array.isArray(e)?ml.array(e,{name:r,deep:!1}):Yo(e)?ml.object(e,void 0,{name:r,deep:!1}):ra(e)?ml.map(e,{name:r,deep:!1}):na(e)?ml.set(e,{name:r,deep:!1}):void("production"!==process.env.NODE_ENV&&Po("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets"))}}),ll=Ha("observable.struct",{enhancer:function(e,t){return"production"!==process.env.NODE_ENV&&Bu(e)&&Po("observable.struct should not be used with observable values"),Hc(e,t)?t:e}}),ul=ba(sl);function cl(e){return!0===e.deep?Ra:!1===e.deep?Ca:(t=e.defaultDecorator)&&null!=(r=null==(n=t.options_)?void 0:n.enhancer)?r:Ra;var t,r,n}function hl(e,t,r){return wa(t)?sl.decorate_20223_(e,t):Ko(t)?void xa(e,t,sl):Bu(e)?e:Yo(e)?ml.object(e,t,r):Array.isArray(e)?ml.array(e,t):ra(e)?ml.map(e,t):na(e)?ml.set(e,t):"object"==typeof e&&null!==e?e:ml.box(e,t)}zo(hl,ul);var dl,fl,pl={box:function(e,t){var r=il(t);return new kl(e,cl(r),r.name,!0,r.equals)},array:function(e,t){var r=il(t);return(!1===Hl.useProxies||!1===r.proxy?Uc:nc)(e,cl(r),r.name)},map:function(e,t){var r=il(t);return new pc(e,cl(r),r.name)},set:function(e,t){var r=il(t);return new yc(e,cl(r),r.name)},object:function(e,t,r){return $c(function(){return Nu(!1===Hl.useProxies||!1===(null==r?void 0:r.proxy)?Ec({},r):function(e,t){var r,n;return Go(),e=Ec(e,t),null!=(n=(r=e[Ea]).proxy_)?n:r.proxy_=new Proxy(e,$u)}({},r),e,t)})},ref:ba(ol),shallow:ba(al),deep:ul,struct:ba(ll)},ml=zo(hl,pl),_l="computed",gl=Ga(_l),yl=Ga("computed.struct",{equals:Oa.structural}),vl=function(e,t){if(wa(t))return gl.decorate_20223_(e,t);if(Ko(t))return xa(e,t,gl);if(Yo(e))return ba(Ga(_l,e));"production"!==process.env.NODE_ENV&&(Zo(e)||Po("First argument to `computed` should be an expression."),Zo(t)&&Po("A setter as second argument is no longer supported, use `{ set: fn }` option instead"));var r=Yo(t)?t:{};return r.get=e,r.name||(r.name=e.name||""),new Ol(r)};Object.assign(vl,gl),vl.struct=ba(yl);var bl=0,xl=1,wl=null!=(dl=null==(fl=Io(function(){},"name"))?void 0:fl.configurable)&&dl,Al={value:"action",configurable:!0,writable:!1,enumerable:!1};function El(e,t,r,n){function i(){return function(e,t,r,n,i){var s=function(e,t,r,n){var i="production"!==process.env.NODE_ENV&&uu()&&!!e,s=0;if("production"!==process.env.NODE_ENV&&i){s=Date.now();var o=n?Array.from(n):jo;hu({type:pu,name:e,object:r,arguments:o})}var a=Hl.trackingDerivation,l=!t||!a;Yl();var u=Hl.allowStateChanges;l&&(jl(),u=Tl(!0));var c=Bl(!0),h={runAsAction_:l,prevDerivation_:a,prevAllowStateChanges_:u,prevAllowStateReads_:c,notifySpy_:i,startTime_:s,actionId_:xl++,parentActionId_:bl};return bl=h.actionId_,h}(e,t,n,i);try{return r.apply(n,i)}catch(e){throw s.error_=e,e}finally{!function(e){bl!==e.actionId_&&Po(30);bl=e.parentActionId_,void 0!==e.error_&&(Hl.suppressReactionErrors=!0);Sl(e.prevAllowStateChanges_),Vl(e.prevAllowStateReads_),Ql(),e.runAsAction_&&Ul(e.prevDerivation_);"production"!==process.env.NODE_ENV&&e.notifySpy_&&fu({time:Date.now()-e.startTime_});Hl.suppressReactionErrors=!1}(s)}}(e,r,t,n||this,arguments)}return void 0===r&&(r=!1),"production"!==process.env.NODE_ENV&&(Zo(t)||Po("`action` can only be invoked on functions"),"string"==typeof e&&e||Po("actions should have valid names, got: '"+e+"'")),i.isMobxAction=!0,i.toString=function(){return t.toString()},wl&&(Al.value=e,Fo(i,"name",Al)),i}function Tl(e){var t=Hl.allowStateChanges;return Hl.allowStateChanges=e,t}function Sl(e){Hl.allowStateChanges=e}var kl=function(e){function t(t,r,n,i,s){var o,a;(void 0===n&&(n="production"!==process.env.NODE_ENV?"ObservableValue@"+qo():"ObservableValue"),void 0===i&&(i=!0),void 0===s&&(s=Oa.default),(o=e.call(this,n)||this).enhancer=void 0,o.name_=void 0,o.equals=void 0,o.hasUnreportedChange_=!1,o.interceptors_=void 0,o.changeListeners_=void 0,o.value_=void 0,o.dehancer=void 0,o.enhancer=r,o.name_=n,o.equals=s,o.value_=r(t,void 0,n),"production"!==process.env.NODE_ENV&&i&&uu())&&cu({type:"create",object:o,observableKind:"value",debugObjectName:o.name_,newValue:""+(null==(a=o.value_)?void 0:a.toString())});return o}_a(t,e);var r=t.prototype;return r.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},r.set=function(e){var t=this.value_;if((e=this.prepareNewValue_(e))!==Hl.UNCHANGED){var r=uu();"production"!==process.env.NODE_ENV&&r&&hu({type:ec,object:this,observableKind:"value",debugObjectName:this.name_,newValue:e,oldValue:t}),this.setNewValue_(e),"production"!==process.env.NODE_ENV&&r&&fu()}},r.prepareNewValue_=function(e){if(zl(this),qu(this)){var t=Hu(this,{object:this,type:ec,newValue:e});if(!t)return Hl.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value_,this.name_),this.equals(this.value_,e)?Hl.UNCHANGED:e},r.setNewValue_=function(e){var t=this.value_;this.value_=e,this.reportChanged(),Zu(this)&&Xu(this,{type:ec,object:this,newValue:e,oldValue:t})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(e){return Wu(this,e)},r.observe_=function(e,t){return t&&e({observableKind:"value",debugObjectName:this.name_,object:this,type:ec,newValue:this.value_,oldValue:void 0}),Ku(this,e)},r.raw=function(){return this.value_},r.toJSON=function(){return this.get()},r.toString=function(){return this.name_+"["+this.value_+"]"},r.valueOf=function(){return aa(this.get())},r[Symbol.toPrimitive]=function(){return this.valueOf()},t}(Ta),Ol=function(){function e(e){this.dependenciesState_=Rl.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Rl.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Pl(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Cl.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,e.get||Po(31),this.derivation=e.get,this.name_=e.name||("production"!==process.env.NODE_ENV?"ComputedValue@"+qo():"ComputedValue"),e.set&&(this.setter_=El("production"!==process.env.NODE_ENV?this.name_+"-setter":"ComputedValue-setter",e.set)),this.equals_=e.equals||(e.compareStructural||e.struct?Oa.structural:Oa.default),this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){!function(e){if(e.lowestObserverState_!==Rl.UP_TO_DATE_)return;e.lowestObserverState_=Rl.POSSIBLY_STALE_,e.observers_.forEach(function(e){e.dependenciesState_===Rl.UP_TO_DATE_&&(e.dependenciesState_=Rl.POSSIBLY_STALE_,e.onBecomeStale_())})}(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.get=function(){if(this.isComputing&&Po(32,this.name_,this.derivation),0!==Hl.inBatch||0!==this.observers_.size||this.keepAlive_){if(Jl(this),Dl(this)){var e=Hl.trackingContext;this.keepAlive_&&!e&&(Hl.trackingContext=this),this.trackAndCompute()&&function(e){if(e.lowestObserverState_===Rl.STALE_)return;e.lowestObserverState_=Rl.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Rl.POSSIBLY_STALE_?(t.dependenciesState_=Rl.STALE_,"production"!==process.env.NODE_ENV&&t.isTracing_!==Cl.NONE&&tu(t,e)):t.dependenciesState_===Rl.UP_TO_DATE_&&(e.lowestObserverState_=Rl.UP_TO_DATE_)})}(this),Hl.trackingContext=e}}else Dl(this)&&(this.warnAboutUntrackedRead_(),Yl(),this.value_=this.computeValue_(!1),Ql());var t=this.value_;if(Ml(t))throw t.cause;return t},t.set=function(e){if(this.setter_){this.isRunningSetter&&Po(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter=!1}}else Po(34,this.name_)},t.trackAndCompute=function(){var e=this.value_,t=this.dependenciesState_===Rl.NOT_TRACKING_,r=this.computeValue_(!0),n=t||Ml(e)||Ml(r)||!this.equals_(e,r);return n&&(this.value_=r,"production"!==process.env.NODE_ENV&&uu()&&cu({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:e,newValue:r})),n},t.computeValue_=function(e){this.isComputing=!0;var t,r=Tl(!1);if(e)t=Il(this,this.derivation,this.scope_);else if(!0===Hl.disableErrorBoundaries)t=this.derivation.call(this.scope_);else try{t=this.derivation.call(this.scope_)}catch(e){t=new Pl(e)}return Sl(r),this.isComputing=!1,t},t.suspend_=function(){this.keepAlive_||(Fl(this),this.value_=void 0,"production"!==process.env.NODE_ENV&&this.isTracing_!==Cl.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' was suspended and it will recompute on the next access."))},t.observe_=function(e,t){var r=this,n=!0,i=void 0;return function(e,t){var r,n,i,s;void 0===t&&(t=Uo);"production"!==process.env.NODE_ENV&&(Zo(e)||Po("Autorun expects a function as first argument"),Au(e)&&Po("Autorun does not accept actions since actions are untrackable"));var o,a=null!=(r=null==(n=t)?void 0:n.name)?r:"production"!==process.env.NODE_ENV?e.name||"Autorun@"+qo():"Autorun";if(t.scheduler||t.delay){var l=function(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Eu}(t),u=!1;o=new nu(a,function(){u||(u=!0,l(function(){u=!1,o.isDisposed||o.track(c)}))},t.onError,t.requiresObservable)}else o=new nu(a,function(){this.track(c)},t.onError,t.requiresObservable);function c(){e(o)}null!=(i=t)&&null!=(i=i.signal)&&i.aborted||o.schedule_();return o.getDisposer_(null==(s=t)?void 0:s.signal)}(function(){var s=r.get();if(!n||t){var o=jl();e({observableKind:"computed",debugObjectName:r.name_,type:ec,object:r,newValue:s,oldValue:i}),Ul(o)}n=!1,i=s})},t.warnAboutUntrackedRead_=function(){"production"!==process.env.NODE_ENV&&(this.isTracing_!==Cl.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute."),("boolean"==typeof this.requiresReaction_?this.requiresReaction_:Hl.computedRequiresReaction)&&console.warn("[mobx] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute."))},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return aa(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},fa(e,[{key:"isComputing",get:function(){return ca(this.flags_,e.isComputingMask_)},set:function(t){this.flags_=ha(this.flags_,e.isComputingMask_,t)}},{key:"isRunningSetter",get:function(){return ca(this.flags_,e.isRunningSetterMask_)},set:function(t){this.flags_=ha(this.flags_,e.isRunningSetterMask_,t)}},{key:"isBeingObserved",get:function(){return ca(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=ha(this.flags_,e.isBeingObservedMask_,t)}},{key:"isPendingUnobservation",get:function(){return ca(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=ha(this.flags_,e.isPendingUnobservationMask_,t)}},{key:"diffValue",get:function(){return ca(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=ha(this.flags_,e.diffValueMask_,1===t)}}])}();Ol.isComputingMask_=1,Ol.isRunningSetterMask_=2,Ol.isBeingObservedMask_=4,Ol.isPendingUnobservationMask_=8,Ol.diffValueMask_=16;var Rl,Cl,Nl=ta("ComputedValue",Ol);!function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"}(Rl||(Rl={})),function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(Cl||(Cl={}));var Pl=function(e){this.cause=void 0,this.cause=e};function Ml(e){return e instanceof Pl}function Dl(e){switch(e.dependenciesState_){case Rl.UP_TO_DATE_:return!1;case Rl.NOT_TRACKING_:case Rl.STALE_:return!0;case Rl.POSSIBLY_STALE_:for(var t=Bl(!0),r=jl(),n=e.observing_,i=n.length,s=0;s<i;s++){var o=n[s];if(Nl(o)){if(Hl.disableErrorBoundaries)o.get();else try{o.get()}catch(e){return Ul(r),Vl(t),!0}if(e.dependenciesState_===Rl.STALE_)return Ul(r),Vl(t),!0}}return Gl(e),Ul(r),Vl(t),!1}}function zl(e){if("production"!==process.env.NODE_ENV){var t=e.observers_.size>0;Hl.allowStateChanges||!t&&"always"!==Hl.enforceActions||console.warn("[MobX] "+(Hl.enforceActions?"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: ":"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ")+e.name_)}}function Il(e,t,r){var n=Bl(!0);Gl(e),e.newObserving_=new Array(0===e.runId_?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++Hl.runId;var i,s=Hl.trackingDerivation;if(Hl.trackingDerivation=e,Hl.inBatch++,!0===Hl.disableErrorBoundaries)i=t.call(r);else try{i=t.call(r)}catch(e){i=new Pl(e)}return Hl.inBatch--,Hl.trackingDerivation=s,function(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=Rl.UP_TO_DATE_,i=0,s=e.unboundDepsCount_,o=0;o<s;o++){var a=r[o];0===a.diffValue&&(a.diffValue=1,i!==o&&(r[i]=a),i++),a.dependenciesState_>n&&(n=a.dependenciesState_)}r.length=i,e.newObserving_=null,s=t.length;for(;s--;){var l=t[s];0===l.diffValue&&Kl(l,e),l.diffValue=0}for(;i--;){var u=r[i];1===u.diffValue&&(u.diffValue=0,Zl(u,e))}n!==Rl.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),function(e){if("production"===process.env.NODE_ENV)return;if(0!==e.observing_.length)return;("boolean"==typeof e.requiresObservable_?e.requiresObservable_:Hl.reactionRequiresObservable)&&console.warn("[mobx] Derivation '"+e.name_+"' is created/updated without reading any observable value.")}(e),Vl(n),i}function Fl(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)Kl(t[r],e);e.dependenciesState_=Rl.NOT_TRACKING_}function Ll(e){var t=jl();try{return e()}finally{Ul(t)}}function jl(){var e=Hl.trackingDerivation;return Hl.trackingDerivation=null,e}function Ul(e){Hl.trackingDerivation=e}function Bl(e){var t=Hl.allowStateReads;return Hl.allowStateReads=e,t}function Vl(e){Hl.allowStateReads=e}function Gl(e){if(e.dependenciesState_!==Rl.UP_TO_DATE_){e.dependenciesState_=Rl.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Rl.UP_TO_DATE_}}var $l=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},ql=!0,Wl=!1,Hl=function(){var e=Do();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ql=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new $l).version&&(ql=!1),ql?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new $l):(setTimeout(function(){Wl||Po(35)},1),new $l)}();function Zl(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Kl(e,t){e.observers_.delete(t),0===e.observers_.size&&Xl(e)}function Xl(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,Hl.pendingUnobservations.push(e))}function Yl(){Hl.inBatch++}function Ql(){if(0===--Hl.inBatch){ou();for(var e=Hl.pendingUnobservations,t=0;t<e.length;t++){var r=e[t];r.isPendingUnobservation=!1,0===r.observers_.size&&(r.isBeingObserved&&(r.isBeingObserved=!1,r.onBUO()),r instanceof Ol&&r.suspend_())}Hl.pendingUnobservations=[]}}function Jl(e){!function(e){"production"!==process.env.NODE_ENV&&!Hl.allowStateReads&&Hl.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}(e);var t=Hl.trackingDerivation;return null!==t?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&Hl.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(0===e.observers_.size&&Hl.inBatch>0&&Xl(e),!1)}function eu(e){e.lowestObserverState_!==Rl.STALE_&&(e.lowestObserverState_=Rl.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Rl.UP_TO_DATE_&&("production"!==process.env.NODE_ENV&&t.isTracing_!==Cl.NONE&&tu(t,e),t.onBecomeStale_()),t.dependenciesState_=Rl.STALE_}))}function tu(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===Cl.BREAK){var r=[];ru(Pu(e),r,1),new Function("debugger;\n/*\nTracing '"+e.name_+"'\n\nYou are entering this break point because derivation '"+e.name_+"' is being traced and '"+t.name_+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(e instanceof Ol?e.derivation.toString().replace(/[*]\//g,"/"):"")+"\n\nThe dependencies for this derivation are:\n\n"+r.join("\n")+"\n*/\n ")()}}function ru(e,t,r){t.length>=1e3?t.push("(and many more)"):(t.push(""+"\t".repeat(r-1)+e.name),e.dependencies&&e.dependencies.forEach(function(e){return ru(e,t,r+1)}))}var nu=function(){function e(e,t,r,n){void 0===e&&(e="production"!==process.env.NODE_ENV?"Reaction@"+qo():"Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Rl.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=Cl.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,Hl.pendingReactions.push(this),ou())},t.runReaction_=function(){if(!this.isDisposed){Yl(),this.isScheduled=!1;var e=Hl.trackingContext;if(Hl.trackingContext=this,Dl(this)){this.isTrackPending=!0;try{this.onInvalidate_(),"production"!==process.env.NODE_ENV&&this.isTrackPending&&uu()&&cu({name:this.name_,type:"scheduled-reaction"})}catch(e){this.reportExceptionInDerivation_(e)}}Hl.trackingContext=e,Ql()}},t.track=function(e){if(!this.isDisposed){Yl();var t,r=uu();"production"!==process.env.NODE_ENV&&r&&(t=Date.now(),hu({name:this.name_,type:"reaction"})),this.isRunning=!0;var n=Hl.trackingContext;Hl.trackingContext=this;var i=Il(this,e,void 0);Hl.trackingContext=n,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Fl(this),Ml(i)&&this.reportExceptionInDerivation_(i.cause),"production"!==process.env.NODE_ENV&&r&&fu({time:Date.now()-t}),Ql()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(Hl.disableErrorBoundaries)throw e;var r="production"!==process.env.NODE_ENV?"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'":"[mobx] uncaught error in '"+this+"'";Hl.suppressReactionErrors?"production"!==process.env.NODE_ENV&&console.warn("[mobx] (error in reaction '"+this.name_+"' suppressed, fix error of causing action below)"):console.error(r,e),"production"!==process.env.NODE_ENV&&uu()&&cu({type:"error",name:this.name_,message:r,error:""+e}),Hl.globalReactionErrorHandlers.forEach(function(r){return r(e,t)})}},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Yl(),Fl(this),Ql()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[Ea]=this,"dispose"in Symbol&&"symbol"==typeof Symbol.dispose&&(r[Symbol.dispose]=r),r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1),function(){if("production"===process.env.NODE_ENV)return;for(var e=!1,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];"boolean"==typeof r[r.length-1]&&(e=r.pop());var i=function(e){switch(e.length){case 0:return Hl.trackingDerivation;case 1:return Bc(e[0]);case 2:return Bc(e[0],e[1])}}(r);if(!i)return Po("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");i.isTracing_===Cl.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled");i.isTracing_=e?Cl.BREAK:Cl.LOG}(this,e)},fa(e,[{key:"isDisposed",get:function(){return ca(this.flags_,e.isDisposedMask_)},set:function(t){this.flags_=ha(this.flags_,e.isDisposedMask_,t)}},{key:"isScheduled",get:function(){return ca(this.flags_,e.isScheduledMask_)},set:function(t){this.flags_=ha(this.flags_,e.isScheduledMask_,t)}},{key:"isTrackPending",get:function(){return ca(this.flags_,e.isTrackPendingMask_)},set:function(t){this.flags_=ha(this.flags_,e.isTrackPendingMask_,t)}},{key:"isRunning",get:function(){return ca(this.flags_,e.isRunningMask_)},set:function(t){this.flags_=ha(this.flags_,e.isRunningMask_,t)}},{key:"diffValue",get:function(){return ca(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=ha(this.flags_,e.diffValueMask_,1===t)}}])}();nu.isDisposedMask_=1,nu.isScheduledMask_=2,nu.isTrackPendingMask_=4,nu.isRunningMask_=8,nu.diffValueMask_=16;var iu=100,su=function(e){return e()};function ou(){Hl.inBatch>0||Hl.isRunningReactions||su(au)}function au(){Hl.isRunningReactions=!0;for(var e=Hl.pendingReactions,t=0;e.length>0;){++t===iu&&(console.error("production"!==process.env.NODE_ENV?"Reaction doesn't converge to a stable state after "+iu+" iterations. Probably there is a cycle in the reactive function: "+e[0]:"[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n<i;n++)r[n].runReaction_()}Hl.isRunningReactions=!1}var lu=ta("Reaction",nu);function uu(){return"production"!==process.env.NODE_ENV&&!!Hl.spyListeners.length}function cu(e){if("production"!==process.env.NODE_ENV&&Hl.spyListeners.length)for(var t=Hl.spyListeners,r=0,n=t.length;r<n;r++)t[r](e)}function hu(e){"production"!==process.env.NODE_ENV&&cu(ma({},e,{spyReportStart:!0}))}var du={type:"report-end",spyReportEnd:!0};function fu(e){"production"!==process.env.NODE_ENV&&cu(e?ma({},e,{type:"report-end",spyReportEnd:!0}):du)}var pu="action",mu="autoAction",_u=Ma(pu),gu=Ma("action.bound",{bound:!0}),yu=Ma(mu,{autoAction:!0}),vu=Ma("autoAction.bound",{autoAction:!0,bound:!0});function bu(e){return function(t,r){return Zo(t)?El(t.name||"<unnamed action>",t,e):Zo(r)?El(t,r,e):wa(r)?(e?yu:_u).decorate_20223_(t,r):Ko(r)?xa(t,r,e?yu:_u):Ko(t)?ba(Ma(e?mu:pu,{name:t,autoAction:e})):void("production"!==process.env.NODE_ENV&&Po("Invalid arguments for `action`"))}}var xu=bu(!1);Object.assign(xu,_u);var wu=bu(!0);function Au(e){return Zo(e)&&!0===e.isMobxAction}Object.assign(wu,yu),xu.bound=ba(gu),wu.bound=ba(vu);var Eu=function(e){return e()};var Tu="onBO",Su="onBUO";function ku(e,t,r){return Ou(Su,e,t,r)}function Ou(e,t,r,n){var i=Bc(t),s=Zo(n)?n:r,o=e+"L";return i[o]?i[o].add(s):i[o]=new Set([s]),function(){var e=i[o];e&&(e.delete(s),0===e.size&&delete i[o])}}var Ru="always";function Cu(e){!0===e.isolateGlobalState&&function(){if((Hl.pendingReactions.length||Hl.inBatch||Hl.isRunningReactions)&&Po(36),Wl=!0,ql){var e=Do();0===--e.__mobxInstanceCount&&(e.__mobxGlobals=void 0),Hl=new $l}}();var t,r,n=e.useProxies,i=e.enforceActions;if(void 0!==n&&(Hl.useProxies=n===Ru||"never"!==n&&"undefined"!=typeof Proxy),"ifavailable"===n&&(Hl.verifyProxies=!0),void 0!==i){var s=i===Ru?Ru:"observed"===i;Hl.enforceActions=s,Hl.allowStateChanges=!0!==s&&s!==Ru}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(t){t in e&&(Hl[t]=!!e[t])}),Hl.allowStateReads=!Hl.observableRequiresReaction,"production"!==process.env.NODE_ENV&&!0===Hl.disableErrorBoundaries&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&(t=e.reactionScheduler,r=su,su=function(e){return t(function(){return r(e)})})}function Nu(e,t,r,n){"production"!==process.env.NODE_ENV&&(arguments.length>4&&Po("'extendObservable' expected 2-4 arguments"),"object"!=typeof e&&Po("'extendObservable' expects an object as first argument"),mc(e)&&Po("'extendObservable' should not be used on maps, use map.merge instead"),Yo(t)||Po("'extendObservable' only accepts plain objects as second argument"),(Bu(t)||Bu(r))&&Po("Extending an object with another observable (object) is not supported"));var i=ua(t);return $c(function(){var t=Ec(e,n)[Ea];sa(i).forEach(function(e){t.extend_(e,i[e],!r||(!(e in r)||r[e]))})}),e}function Pu(e,t){return Mu(Bc(e,t))}function Mu(e){var t,r={name:e.name_};return e.observing_&&e.observing_.length>0&&(r.dependencies=(t=e.observing_,Array.from(new Set(t))).map(Mu)),r}var Du=0;function zu(){this.message="FLOW_CANCELLED"}zu.prototype=Object.create(Error.prototype);var Iu=La("flow"),Fu=La("flow.bound",{bound:!0}),Lu=Object.assign(function(e,t){if(wa(t))return Iu.decorate_20223_(e,t);if(Ko(t))return xa(e,t,Iu);"production"!==process.env.NODE_ENV&&1!==arguments.length&&Po("Flow expects single argument with generator function");var r=e,n=r.name||"<unnamed flow>",i=function(){var e,t=arguments,i=++Du,s=xu(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,a=new Promise(function(t,r){var a=0;function l(e){var t;o=void 0;try{t=xu(n+" - runid: "+i+" - yield "+a++,s.next).call(s,e)}catch(e){return r(e)}c(t)}function u(e){var t;o=void 0;try{t=xu(n+" - runid: "+i+" - yield "+a++,s.throw).call(s,e)}catch(e){return r(e)}c(t)}function c(e){if(!Zo(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(l,u);e.then(c,r)}e=r,l(void 0)});return a.cancel=xu(n+" - runid: "+i+" - cancel",function(){try{o&&ju(o);var t=s.return(void 0),r=Promise.resolve(t.value);r.then(Ho,Ho),ju(r),e(new zu)}catch(t){e(t)}}),a};return i.isMobXFlow=!0,i},Iu);function ju(e){Zo(e.cancel)&&e.cancel()}function Uu(e){return!0===(null==e?void 0:e.isMobXFlow)}function Bu(e){return"production"!==process.env.NODE_ENV&&1!==arguments.length&&Po("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),function(e){return!!e&&(kc(e)||!!e[Ea]||Sa(e)||lu(e)||Nl(e))}(e)}function Vu(e,t){void 0===t&&(t=void 0),Yl();try{return e.apply(t)}finally{Ql()}}function Gu(e){return e[Ea]}Lu.bound=ba(Fu);var $u={has:function(e,t){return"production"!==process.env.NODE_ENV&&Hl.trackingDerivation&&$o("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),Gu(e).has_(t)},get:function(e,t){return Gu(e).get_(t)},set:function(e,t,r){var n;return!!Ko(t)&&("production"===process.env.NODE_ENV||Gu(e).values_.has(t)||$o("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),null==(n=Gu(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return"production"!==process.env.NODE_ENV&&$o("delete properties from an observable object. Use 'remove' from 'mobx' instead."),!!Ko(t)&&(null==(r=Gu(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return"production"!==process.env.NODE_ENV&&$o("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),null==(n=Gu(e).defineProperty_(t,r))||n},ownKeys:function(e){return"production"!==process.env.NODE_ENV&&Hl.trackingDerivation&&$o("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),Gu(e).ownKeys_()},preventExtensions:function(e){Po(13)}};function qu(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function Wu(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),Wo(function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)})}function Hu(e,t){var r=jl();try{for(var n=[].concat(e.interceptors_||[]),i=0,s=n.length;i<s&&((t=n[i](t))&&!t.type&&Po(14),t);i++);return t}finally{Ul(r)}}function Zu(e){return void 0!==e.changeListeners_&&e.changeListeners_.length>0}function Ku(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),Wo(function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)})}function Xu(e,t){var r=jl(),n=e.changeListeners_;if(n){for(var i=0,s=(n=n.slice()).length;i<s;i++)n[i](t);Ul(r)}}var Yu=Symbol("mobx-keys");function Qu(e,t,r){return"production"!==process.env.NODE_ENV&&(Yo(e)||Yo(Object.getPrototypeOf(e))||Po("'makeAutoObservable' can only be used for classes that don't have a superclass"),kc(e)&&Po("makeAutoObservable can only be used on objects not already made observable")),Yo(e)?Nu(e,e,t,r):($c(function(){var n=Ec(e,r)[Ea];if(!e[Yu]){var i=Object.getPrototypeOf(e),s=new Set([].concat(sa(e),sa(i)));s.delete("constructor"),s.delete(Ea),Jo(i,Yu,s)}e[Yu].forEach(function(e){return n.make_(e,!t||(!(e in t)||t[e]))})}),e)}var Ju="splice",ec="update",tc={get:function(e,t){var r=e[Ea];return t===Ea?r:"length"===t?r.getArrayLength_():"string"!=typeof t||isNaN(t)?la(ic,t)?ic[t]:e[t]:r.get_(parseInt(t))},set:function(e,t,r){var n=e[Ea];return"length"===t&&n.setArrayLength_(r),"symbol"==typeof t||isNaN(t)?e[t]=r:n.set_(parseInt(t),r),!0},preventExtensions:function(){Po(15)}},rc=function(){function e(e,t,r,n){void 0===e&&(e="production"!==process.env.NODE_ENV?"ObservableArray@"+qo():"ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=r,this.legacyMode_=n,this.atom_=new Ta(e),this.enhancer_=function(r,n){return t(r,n,"production"!==process.env.NODE_ENV?e+"[..]":"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.dehanceValues_=function(e){return void 0!==this.dehancer&&e.length>0?e.map(this.dehancer):e},t.intercept_=function(e){return Wu(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Ku(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&Po("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var r=new Array(e-t),n=0;n<e-t;n++)r[n]=void 0;this.spliceWithArray_(t,0,r)}else this.spliceWithArray_(e,t-e)},t.updateArrayLength_=function(e,t){e!==this.lastKnownLength_&&Po(16),this.lastKnownLength_+=t,this.legacyMode_&&t>0&&jc(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;zl(this.atom_);var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=jo),qu(this)){var s=Hu(this,{object:this.proxy_,type:Ju,index:e,removedCount:t,added:r});if(!s)return jo;t=s.removedCount,r=s.added}if(r=0===r.length?r:r.map(function(e){return n.enhancer_(e,void 0)}),this.legacyMode_||"production"!==process.env.NODE_ENV){var o=r.length-t;this.updateArrayLength_(i,o)}var a=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,a),this.dehanceValues_(a)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),s=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o<r.length;o++)this.values_[e+o]=r[o];for(var a=0;a<s.length;a++)this.values_[e+r.length+a]=s[a];return i},t.notifyArrayChildUpdate_=function(e,t,r){var n=!this.owned_&&uu(),i=Zu(this),s=i||n?{observableKind:"array",object:this.proxy_,type:ec,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:r}:null;"production"!==process.env.NODE_ENV&&n&&hu(s),this.atom_.reportChanged(),i&&Xu(this,s),"production"!==process.env.NODE_ENV&&n&&fu()},t.notifyArraySplice_=function(e,t,r){var n=!this.owned_&&uu(),i=Zu(this),s=i||n?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Ju,index:e,removed:r,added:t,removedCount:r.length,addedCount:t.length}:null;"production"!==process.env.NODE_ENV&&n&&hu(s),this.atom_.reportChanged(),i&&Xu(this,s),"production"!==process.env.NODE_ENV&&n&&fu()},t.get_=function(e){if(!(this.legacyMode_&&e>=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("production"!==process.env.NODE_ENV?"[mobx.array] Attempt to read an array index ("+e+") that is out of bounds ("+this.values_.length+"). Please check length first. Out of bound indices will not be tracked by MobX":"[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var r=this.values_;if(this.legacyMode_&&e>r.length&&Po(17,e,r.length),e<r.length){zl(this.atom_);var n=r[e];if(qu(this)){var i=Hu(this,{type:ec,object:this.proxy_,index:e,newValue:t});if(!i)return;t=i.newValue}(t=this.enhancer_(t,n))!==n&&(r[e]=t,this.notifyArrayChildUpdate_(e,t,n))}else{for(var s=new Array(e+1-r.length),o=0;o<s.length-1;o++)s[o]=void 0;s[s.length-1]=t,this.spliceWithArray_(r.length,0,s)}},e}();function nc(e,t,r,n){return void 0===r&&(r="production"!==process.env.NODE_ENV?"ObservableArray@"+qo():"ObservableArray"),void 0===n&&(n=!1),Go(),$c(function(){var i=new rc(r,t,n,!1);ea(i.values_,Ea,i);var s=new Proxy(i.values_,tc);return i.proxy_=s,e&&e.length&&i.spliceWithArray_(0,0,e),s})}var ic={clear:function(){return this.splice(0)},replace:function(e){var t=this[Ea];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];var s=this[Ea];switch(arguments.length){case 0:return[];case 1:return s.spliceWithArray_(e);case 2:return s.spliceWithArray_(e,t)}return s.spliceWithArray_(e,t,n)},spliceWithArray:function(e,t,r){return this[Ea].spliceWithArray_(e,t,r)},push:function(){for(var e=this[Ea],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.spliceWithArray_(e.values_.length,0,r),e.values_.length},pop:function(){return this.splice(Math.max(this[Ea].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[Ea],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.spliceWithArray_(0,0,r),e.values_.length},reverse:function(){return Hl.trackingDerivation&&Po(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Hl.trackingDerivation&&Po(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[Ea],r=t.dehanceValues_(t.values_).indexOf(e);return r>-1&&(this.splice(r,1),!0)}};function sc(e,t){"function"==typeof Array.prototype[e]&&(ic[e]=t(e))}function oc(e){return function(){var t=this[Ea];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function ac(e){return function(t,r){var n=this,i=this[Ea];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e](function(e,i){return t.call(r,e,i,n)})}}function lc(e){return function(){var t=this,r=this[Ea];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}sc("at",oc),sc("concat",oc),sc("flat",oc),sc("includes",oc),sc("indexOf",oc),sc("join",oc),sc("lastIndexOf",oc),sc("slice",oc),sc("toString",oc),sc("toLocaleString",oc),sc("toSorted",oc),sc("toSpliced",oc),sc("with",oc),sc("every",ac),sc("filter",ac),sc("find",ac),sc("findIndex",ac),sc("findLast",ac),sc("findLastIndex",ac),sc("flatMap",ac),sc("forEach",ac),sc("map",ac),sc("some",ac),sc("toReversed",ac),sc("reduce",lc),sc("reduceRight",lc);var uc=ta("ObservableArrayAdministration",rc);function cc(e){return Xo(e)&&uc(e[Ea])}var hc={},dc="add",fc="delete",pc=function(){function e(e,t,r){var n=this;void 0===t&&(t=Ra),void 0===r&&(r="production"!==process.env.NODE_ENV?"ObservableMap@"+qo():"ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[Ea]=hc,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=r,Zo(Map)||Po(18),$c(function(){n.keysAtom_=ka("production"!==process.env.NODE_ENV?n.name_+".keys()":"ObservableMap.keys()"),n.data_=new Map,n.hasMap_=new Map,e&&n.merge(e)})}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!Hl.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new kl(this.has_(e),Ca,"production"!==process.env.NODE_ENV?this.name_+"."+oa(e)+"?":"ObservableMap.key?",!1);this.hasMap_.set(e,n),ku(n,function(){return t.hasMap_.delete(e)})}return r.get()},t.set=function(e,t){var r=this.has_(e);if(qu(this)){var n=Hu(this,{type:r?ec:dc,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if((zl(this.keysAtom_),qu(this))&&!Hu(this,{type:fc,object:this,name:e}))return!1;if(this.has_(e)){var r=uu(),n=Zu(this),i=n||r?{observableKind:"map",debugObjectName:this.name_,type:fc,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return"production"!==process.env.NODE_ENV&&r&&hu(i),Vu(function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)}),n&&Xu(this,i),"production"!==process.env.NODE_ENV&&r&&fu(),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==Hl.UNCHANGED){var n=uu(),i=Zu(this),s=i||n?{observableKind:"map",debugObjectName:this.name_,type:ec,object:this,oldValue:r.value_,name:e,newValue:t}:null;"production"!==process.env.NODE_ENV&&n&&hu(s),r.setNewValue_(t),i&&Xu(this,s),"production"!==process.env.NODE_ENV&&n&&fu()}},t.addValue_=function(e,t){var r=this;zl(this.keysAtom_),Vu(function(){var n,i=new kl(t,r.enhancer_,"production"!==process.env.NODE_ENV?r.name_+"."+oa(e):"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()});var n=uu(),i=Zu(this),s=i||n?{observableKind:"map",debugObjectName:this.name_,type:dc,object:this,name:e,newValue:t}:null;"production"!==process.env.NODE_ENV&&n&&hu(s),i&&Xu(this,s),"production"!==process.env.NODE_ENV&&n&&fu()},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return _c({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return _c({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=pa(this);!(r=n()).done;){var i=r.value,s=i[0],o=i[1];e.call(t,o,s,this)}},t.merge=function(e){var t=this;return mc(e)&&(e=new Map(e)),Vu(function(){var r,n,i;Yo(e)?function(e){var t=Object.keys(e);if(!ia)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(t){return Lo.propertyIsEnumerable.call(e,t)})):t}(e).forEach(function(r){return t.set(r,e[r])}):Array.isArray(e)?e.forEach(function(e){var r=e[0],n=e[1];return t.set(r,n)}):ra(e)?(r=e,n=Object.getPrototypeOf(r),i=Object.getPrototypeOf(n),null!==Object.getPrototypeOf(i)&&Po(19,e),e.forEach(function(e,r){return t.set(r,e)})):null!=e&&Po(20,e)}),this},t.clear=function(){var e=this;Vu(function(){Ll(function(){for(var t,r=pa(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}})})},t.replace=function(e){var t=this;return Vu(function(){for(var r,n=function(e){if(ra(e)||mc(e))return e;if(Array.isArray(e))return new Map(e);if(Yo(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}return Po(21,e)}(e),i=new Map,s=!1,o=pa(t.data_.keys());!(r=o()).done;){var a=r.value;if(!n.has(a))if(t.delete(a))s=!0;else{var l=t.data_.get(a);i.set(a,l)}}for(var u,c=pa(n.entries());!(u=c()).done;){var h=u.value,d=h[0],f=h[1],p=t.data_.has(d);if(t.set(d,f),t.data_.has(d)){var m=t.data_.get(d);i.set(d,m),p||(s=!0)}}if(!s)if(t.data_.size!==i.size)t.keysAtom_.reportChanged();else for(var _=t.data_.keys(),g=i.keys(),y=_.next(),v=g.next();!y.done;){if(y.value!==v.value){t.keysAtom_.reportChanged();break}y=_.next(),v=g.next()}t.data_=i}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return"production"!==process.env.NODE_ENV&&!0===t&&Po("`observe` doesn't support fireImmediately=true in combination with maps."),Ku(this,e)},t.intercept_=function(e){return Wu(this,e)},fa(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),mc=ta("ObservableMap",pc);function _c(e){return e[Symbol.toStringTag]="MapIterator",Yc(e)}var gc={},yc=function(){function e(e,t,r){var n=this;void 0===t&&(t=Ra),void 0===r&&(r="production"!==process.env.NODE_ENV?"ObservableSet@"+qo():"ObservableSet"),this.name_=void 0,this[Ea]=gc,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,Zo(Set)||Po(22),this.enhancer_=function(e,n){return t(e,n,r)},$c(function(){n.atom_=ka(n.name_),e&&n.replace(e)})}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;Vu(function(){Ll(function(){for(var t,r=pa(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}})})},t.forEach=function(e,t){for(var r,n=pa(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(zl(this.atom_),qu(this)){var r=Hu(this,{type:dc,object:this,newValue:e});if(!r)return this;e=r.newValue}if(!this.has(e)){Vu(function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()});var n="production"!==process.env.NODE_ENV&&uu(),i=Zu(this),s=i||n?{observableKind:"set",debugObjectName:this.name_,type:dc,object:this,newValue:e}:null;n&&"production"!==process.env.NODE_ENV&&hu(s),i&&Xu(this,s),n&&"production"!==process.env.NODE_ENV&&fu()}return this},t.delete=function(e){var t=this;if(qu(this)&&!Hu(this,{type:fc,object:this,oldValue:e}))return!1;if(this.has(e)){var r="production"!==process.env.NODE_ENV&&uu(),n=Zu(this),i=n||r?{observableKind:"set",debugObjectName:this.name_,type:fc,object:this,oldValue:e}:null;return r&&"production"!==process.env.NODE_ENV&&hu(i),Vu(function(){t.atom_.reportChanged(),t.data_.delete(e)}),n&&Xu(this,i),r&&"production"!==process.env.NODE_ENV&&fu(),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=this.values();return bc({next:function(){var t=e.next(),r=t.value,n=t.done;return n?{value:void 0,done:n}:{value:[r,r],done:n}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var e=this,t=this.data_.values();return bc({next:function(){var r=t.next(),n=r.value,i=r.done;return i?{value:void 0,done:i}:{value:e.dehanceValue_(n),done:i}}})},t.intersection=function(e){return na(e)&&!vc(e)?e.intersection(this):new Set(this).intersection(e)},t.union=function(e){return na(e)&&!vc(e)?e.union(this):new Set(this).union(e)},t.difference=function(e){return new Set(this).difference(e)},t.symmetricDifference=function(e){return na(e)&&!vc(e)?e.symmetricDifference(this):new Set(this).symmetricDifference(e)},t.isSubsetOf=function(e){return new Set(this).isSubsetOf(e)},t.isSupersetOf=function(e){return new Set(this).isSupersetOf(e)},t.isDisjointFrom=function(e){return na(e)&&!vc(e)?e.isDisjointFrom(this):new Set(this).isDisjointFrom(e)},t.replace=function(e){var t=this;return vc(e)&&(e=new Set(e)),Vu(function(){Array.isArray(e)||na(e)?(t.clear(),e.forEach(function(e){return t.add(e)})):null!=e&&Po("Cannot initialize set from "+e)}),this},t.observe_=function(e,t){return"production"!==process.env.NODE_ENV&&!0===t&&Po("`observe` doesn't support fireImmediately=true in combination with sets."),Ku(this,e)},t.intercept_=function(e){return Wu(this,e)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},fa(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),vc=ta("ObservableSet",yc);function bc(e){return e[Symbol.toStringTag]="SetIterator",Yc(e)}var xc=Object.create(null),wc="remove",Ac=function(){function e(e,t,r,n){void 0===t&&(t=new Map),void 0===n&&(n=Qa),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=e,this.values_=t,this.name_=r,this.defaultAnnotation_=n,this.keysAtom_=new Ta("production"!==process.env.NODE_ENV?this.name_+".keys":"ObservableObject.keys"),this.isPlainObject_=Yo(this.target_),"production"===process.env.NODE_ENV||Jc(this.defaultAnnotation_)||Po("defaultAnnotation must be valid annotation"),"production"!==process.env.NODE_ENV&&(this.appliedAnnotations_={})}var t=e.prototype;return t.getObservablePropValue_=function(e){return this.values_.get(e).get()},t.setObservablePropValue_=function(e,t){var r=this.values_.get(e);if(r instanceof Ol)return r.set(t),!0;if(qu(this)){var n=Hu(this,{type:ec,object:this.proxy_||this.target_,name:e,newValue:t});if(!n)return null;t=n.newValue}if((t=r.prepareNewValue_(t))!==Hl.UNCHANGED){var i=Zu(this),s="production"!==process.env.NODE_ENV&&uu(),o=i||s?{type:ec,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:r.value_,name:e,newValue:t}:null;"production"!==process.env.NODE_ENV&&s&&hu(o),r.setNewValue_(t),i&&Xu(this,o),"production"!==process.env.NODE_ENV&&s&&fu()}return!0},t.get_=function(e){return Hl.trackingDerivation&&!la(this.target_,e)&&this.has_(e),this.target_[e]},t.set_=function(e,t,r){return void 0===r&&(r=!1),la(this.target_,e)?this.values_.has(e)?this.setObservablePropValue_(e,t):r?Reflect.set(this.target_,e,t):(this.target_[e]=t,!0):this.extend_(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,r)},t.has_=function(e){if(!Hl.trackingDerivation)return e in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var t=this.pendingKeys_.get(e);return t||(t=new kl(e in this.target_,Ca,"production"!==process.env.NODE_ENV?this.name_+"."+oa(e)+"?":"ObservableObject.key?",!1),this.pendingKeys_.set(e,t)),t.get()},t.make_=function(e,t){if(!0===t&&(t=this.defaultAnnotation_),!1!==t){if(Rc(this,t,e),!(e in this.target_)){var r;if(null!=(r=this.target_[va])&&r[e])return;Po(1,t.annotationType_,this.name_+"."+e.toString())}for(var n=this.target_;n&&n!==Lo;){var i=Io(n,e);if(i){var s=t.make_(this,e,i,n);if(0===s)return;if(1===s)break}n=Object.getPrototypeOf(n)}Oc(this,t,e)}},t.extend_=function(e,t,r,n){if(void 0===n&&(n=!1),!0===r&&(r=this.defaultAnnotation_),!1===r)return this.defineProperty_(e,t,n);Rc(this,r,e);var i=r.extend_(this,e,t,n);return i&&Oc(this,r,e),i},t.defineProperty_=function(e,t,r){void 0===r&&(r=!1),zl(this.keysAtom_);try{Yl();var n=this.delete_(e);if(!n)return n;if(qu(this)){var i=Hu(this,{object:this.proxy_||this.target_,name:e,type:dc,newValue:t.value});if(!i)return null;var s=i.newValue;t.value!==s&&(t=ma({},t,{value:s}))}if(r){if(!Reflect.defineProperty(this.target_,e,t))return!1}else Fo(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{Ql()}return!0},t.defineObservableProperty_=function(e,t,r,n){void 0===n&&(n=!1),zl(this.keysAtom_);try{Yl();var i=this.delete_(e);if(!i)return i;if(qu(this)){var s=Hu(this,{object:this.proxy_||this.target_,name:e,type:dc,newValue:t});if(!s)return null;t=s.newValue}var o=Sc(e),a={configurable:!Hl.safeDescriptors||this.isPlainObject_,enumerable:!0,get:o.get,set:o.set};if(n){if(!Reflect.defineProperty(this.target_,e,a))return!1}else Fo(this.target_,e,a);var l=new kl(t,r,"production"!==process.env.NODE_ENV?this.name_+"."+e.toString():"ObservableObject.key",!1);this.values_.set(e,l),this.notifyPropertyAddition_(e,l.value_)}finally{Ql()}return!0},t.defineComputedProperty_=function(e,t,r){void 0===r&&(r=!1),zl(this.keysAtom_);try{Yl();var n=this.delete_(e);if(!n)return n;if(qu(this))if(!Hu(this,{object:this.proxy_||this.target_,name:e,type:dc,newValue:void 0}))return null;t.name||(t.name="production"!==process.env.NODE_ENV?this.name_+"."+e.toString():"ObservableObject.key"),t.context=this.proxy_||this.target_;var i=Sc(e),s={configurable:!Hl.safeDescriptors||this.isPlainObject_,enumerable:!1,get:i.get,set:i.set};if(r){if(!Reflect.defineProperty(this.target_,e,s))return!1}else Fo(this.target_,e,s);this.values_.set(e,new Ol(t)),this.notifyPropertyAddition_(e,void 0)}finally{Ql()}return!0},t.delete_=function(e,t){if(void 0===t&&(t=!1),zl(this.keysAtom_),!la(this.target_,e))return!0;if(qu(this)&&!Hu(this,{object:this.proxy_||this.target_,name:e,type:wc}))return null;try{var r;Yl();var n,i=Zu(this),s="production"!==process.env.NODE_ENV&&uu(),o=this.values_.get(e),a=void 0;if(!o&&(i||s))a=null==(n=Io(this.target_,e))?void 0:n.value;if(t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if("production"!==process.env.NODE_ENV&&delete this.appliedAnnotations_[e],o&&(this.values_.delete(e),o instanceof kl&&(a=o.value_),eu(o)),this.keysAtom_.reportChanged(),null==(r=this.pendingKeys_)||null==(r=r.get(e))||r.set(e in this.target_),i||s){var l={type:wc,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:a,name:e};"production"!==process.env.NODE_ENV&&s&&hu(l),i&&Xu(this,l),"production"!==process.env.NODE_ENV&&s&&fu()}}finally{Ql()}return!0},t.observe_=function(e,t){return"production"!==process.env.NODE_ENV&&!0===t&&Po("`observe` doesn't support the fire immediately property for observable objects."),Ku(this,e)},t.intercept_=function(e){return Wu(this,e)},t.notifyPropertyAddition_=function(e,t){var r,n=Zu(this),i="production"!==process.env.NODE_ENV&&uu();if(n||i){var s=n||i?{type:dc,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;"production"!==process.env.NODE_ENV&&i&&hu(s),n&&Xu(this,s),"production"!==process.env.NODE_ENV&&i&&fu()}null==(r=this.pendingKeys_)||null==(r=r.get(e))||r.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),sa(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Ec(e,t){var r;if("production"!==process.env.NODE_ENV&&t&&kc(e)&&Po("Options can't be provided for already observable objects."),la(e,Ea))return"production"===process.env.NODE_ENV||Vc(e)instanceof Ac||Po("Cannot convert '"+Gc(e)+"' into observable object:\nThe target is already observable of different type.\nExtending builtins is not supported."),e;"production"===process.env.NODE_ENV||Object.isExtensible(e)||Po("Cannot make the designated object observable; it is not extensible");var n=null!=(r=null==t?void 0:t.name)?r:"production"!==process.env.NODE_ENV?(Yo(e)?"ObservableObject":e.constructor.name)+"@"+qo():"ObservableObject",i=new Ac(e,new Map,String(n),function(e){var t;return e?null!=(t=e.defaultDecorator)?t:Ja(e):void 0}(t));return Jo(e,Ea,i),e}var Tc=ta("ObservableObjectAdministration",Ac);function Sc(e){return xc[e]||(xc[e]={get:function(){return this[Ea].getObservablePropValue_(e)},set:function(t){return this[Ea].setObservablePropValue_(e,t)}})}function kc(e){return!!Xo(e)&&Tc(e[Ea])}function Oc(e,t,r){var n;"production"!==process.env.NODE_ENV&&(e.appliedAnnotations_[r]=t),null==(n=e.target_[va])||delete n[r]}function Rc(e,t,r){if("production"===process.env.NODE_ENV||Jc(t)||Po("Cannot annotate '"+e.name_+"."+r.toString()+"': Invalid annotation."),"production"!==process.env.NODE_ENV&&!Pa(t)&&la(e.appliedAnnotations_,r)){var n=e.name_+"."+r.toString(),i=e.appliedAnnotations_[r].annotationType_;Po("Cannot apply '"+t.annotationType_+"' to '"+n+"':\nThe field is already annotated with '"+i+"'.\nRe-annotating fields is not allowed.\nUse 'override' annotation for methods overridden by subclass.")}}var Cc,Nc,Pc=Fc(0),Mc=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,!1===e}(),Dc=0,zc=function(){};Cc=zc,Nc=Array.prototype,Object.setPrototypeOf?Object.setPrototypeOf(Cc.prototype,Nc):void 0!==Cc.prototype.__proto__?Cc.prototype.__proto__=Nc:Cc.prototype=Nc;var Ic=function(e){function t(t,r,n,i){var s;return void 0===n&&(n="production"!==process.env.NODE_ENV?"ObservableArray@"+qo():"ObservableArray"),void 0===i&&(i=!1),s=e.call(this)||this,$c(function(){var e=new rc(n,r,i,!0);e.proxy_=s,ea(s,Ea,e),t&&t.length&&s.spliceWithArray(0,0,t),Mc&&Object.defineProperty(s,"0",Pc)}),s}_a(t,e);var r=t.prototype;return r.concat=function(){this[Ea].atom_.reportObserved();for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Array.prototype.concat.apply(this.slice(),t.map(function(e){return cc(e)?e.slice():e}))},r[Symbol.iterator]=function(){var e=this,t=0;return Yc({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})},fa(t,[{key:"length",get:function(){return this[Ea].getArrayLength_()},set:function(e){this[Ea].setArrayLength_(e)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(zc);function Fc(e){return{enumerable:!1,configurable:!0,get:function(){return this[Ea].get_(e)},set:function(t){this[Ea].set_(e,t)}}}function Lc(e){Fo(Ic.prototype,""+e,Fc(e))}function jc(e){if(e>Dc){for(var t=Dc;t<e+100;t++)Lc(t);Dc=e}}function Uc(e,t,r){return new Ic(e,t,r)}function Bc(e,t){if("object"==typeof e&&null!==e){if(cc(e))return void 0!==t&&Po(23),e[Ea].atom_;if(vc(e))return e.atom_;if(mc(e)){if(void 0===t)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||Po(25,t,Gc(e)),r}if(kc(e)){if(!t)return Po(26);var n=e[Ea].values_.get(t);return n||Po(27,t,Gc(e)),n}if(Sa(e)||Nl(e)||lu(e))return e}else if(Zo(e)&&lu(e[Ea]))return e[Ea];Po(28)}function Vc(e,t){return e||Po(29),Sa(e)||Nl(e)||lu(e)||mc(e)||vc(e)?e:e[Ea]?e[Ea]:void Po(24,e)}function Gc(e,t){var r;if(void 0!==t)r=Bc(e,t);else{if(Au(e))return e.name;r=kc(e)||mc(e)||vc(e)?Vc(e):Bc(e)}return r.name_}function $c(e){var t=jl(),r=Tl(!0);Yl();try{return e()}finally{Ql(),Sl(r),Ul(t)}}Object.entries(ic).forEach(function(e){var t=e[0],r=e[1];"concat"!==t&&Jo(Ic.prototype,t,r)}),jc(1e3);var qc,Wc=Lo.toString;function Hc(e,t,r){return void 0===r&&(r=-1),Zc(e,t,r)}function Zc(e,t,r,n,i){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!=e)return t!=t;var s=typeof e;if("function"!==s&&"object"!==s&&"object"!=typeof t)return!1;var o=Wc.call(e);if(o!==Wc.call(t))return!1;switch(o){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0===+e?1/+e==1/t:+e===+t;case"[object Date]":case"[object Boolean]":return+e===+t;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":r>=0&&r++}e=Kc(e),t=Kc(t);var a="[object Array]"===o;if(!a){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,u=t.constructor;if(l!==u&&!(Zo(l)&&l instanceof l&&Zo(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),a){if((c=e.length)!==t.length)return!1;for(;c--;)if(!Zc(e[c],t[c],r-1,n,i))return!1}else{var h=Object.keys(e),d=h.length;if(Object.keys(t).length!==d)return!1;for(var f=0;f<d;f++){var p=h[f];if(!la(t,p)||!Zc(e[p],t[p],r-1,n,i))return!1}}return n.pop(),i.pop(),!0}function Kc(e){return cc(e)?e.slice():ra(e)||mc(e)||na(e)||vc(e)?Array.from(e.entries()):e}var Xc=(null==(qc=Do().Iterator)?void 0:qc.prototype)||{};function Yc(e){return e[Symbol.iterator]=Qc,Object.assign(Object.create(Xc),e)}function Qc(){return this}function Jc(e){return e instanceof Object&&"string"==typeof e.annotationType_&&Zo(e.make_)&&Zo(e.extend_)}["Symbol","Map","Set"].forEach(function(e){void 0===Do()[e]&&Po("MobX requires global '"+e+"' to be available or polyfilled")}),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return"production"===process.env.NODE_ENV?(console.warn("[mobx.spy] Is a no-op in production builds"),function(){}):(Hl.spyListeners.push(e),Wo(function(){Hl.spyListeners=Hl.spyListeners.filter(function(t){return t!==e})}))},extras:{getDebugName:Gc},$mobx:Ea});class eh{constructor(){Qu(this)}_visible=ml.map();getIsVisible(e){return this._visible.get(e)??!1}_setVisible({name:e,value:t}){this._visible.set(e,t)}openModal(e){this._setVisible({name:e,value:!0})}closeModal(e){this._setVisible({name:e,value:!1})}closeAllModals(){this._visible.clear()}}class th{constructor(){Qu(this)}_isUnauthorized=!1;get isUnauthorized(){return this._isUnauthorized}set isUnauthorized(e){this._isUnauthorized=e}}const rh=new class{authStore=new th;modalStore=new eh},nh=r.createContext(rh),ih=({children:t})=>e(nh.Provider,{value:rh,children:t}),sh=()=>{const e=r.useContext(nh);if(null===e)throw new Error("You have forgotten to wrap your root component with RootStoreProvider");return e};class oh{client;constructor(e){this.client=po.create({baseURL:e,timeout:1e4,headers:{"Content-Type":"application/json"}}),this.setupInterceptors()}setupInterceptors(){this.client.interceptors.request.use(e=>(rh.authStore.isUnauthorized=!1,e),e=>Promise.reject(e)),this.client.interceptors.response.use(e=>e,e=>(401===e.status&&(rh.authStore.isUnauthorized=!0),Promise.reject(e)))}async get({url:e,config:t}){return(await this.client.get(e,t)).data}async post({url:e,body:t,config:r}){return(await this.client.post(e,t,r)).data}async put({url:e,body:t,config:r}){return(await this.client.put(e,t,r)).data}async delete({url:e,config:t}){return(await this.client.delete(e,t)).data}}const ah=e=>new oh(e);class lh{_apiService;get apiService(){return this._apiService}static _instance=null;static get instance(){if(!lh._instance)throw new Error("Dartcom Config не инициализирован с приватным ключом. Вызовите Config.initialize(...) первым, чтобы иметь возможность пользоваться компонентами нашей библиотеки");return lh._instance}static initialize(e){lh._instance||(lh._instance=new lh(e))}static deactivate(){this._instance=null}constructor({apiKey:e,backendUrl:t,onCheck:r}){this._apiKey=e,this._apiService=ah(t),this._getCheckKeyData().then(e=>{if(e){const{valid:t}=e;r?.(e),this.isValidApiKey=t}})}_apiKey="";_isValidApiKey=!1;get isValidApiKey(){return this._isValidApiKey}set isValidApiKey(e){this._isValidApiKey=e}async _getCheckKeyData(){const e=await this._apiService.get({url:"check_tile_token",config:{params:{tile_token:this._apiKey}}}).then(e=>e).catch(({response:e})=>{if(e){const{data:{detail:t}}=e;return t}});return e}}const uh={valid:"18c38ab326d12f428e90be50a5141fc8949de497df7f7e0c1796d58e99d006f3",dateExpired:"8cbc5e15e61e649daf57c3a08422ae372c101afb4759036a3864a9fa588ef717",off:"b1520018920b33a4c1f8100c4f3bb3eb93661db829faa99c9cd75537f6300ba9",invalid:"abcdefghijklmnopqrstuvwxyz0123456789"};var ch,hh;var dh,fh,ph=(hh||(hh=1,ch=function(){const e=["a","b","c","d","e","f","0","1","2","3","4","5","6","7","8","9"];let t=[];for(let r=0;r<36;r++)t[r]=8===r||13===r||18===r||23===r?"-":e[Math.ceil(Math.random()*e.length-1)];return t.join("")}),ch),mh=si(ph);!function(e){e.GET="GET",e.DELETE="DELETE",e.PUT="PUT",e.POST="POST"}(dh||(dh={})),function(e){e.TOP_RIGHT="top-right",e.BOTTOM_RIGHT="bottom-right",e.BOTTOM_LEFT="bottom-left",e.TOP_LEFT="top-left"}(fh||(fh={}));const _h="https://dalganmap.ru/api";var gh,yh;!function(e){e.ONE_WAY='"OneWay"',e.POINT_ADDRESS='"PointAddress"',e.BUILDING_AREA='"MapBuildingECArea"',e.BUILTUP_AREA='"MapAdminBuiltupArea"',e.ADMIN_AREA='"MapAdminArea"',e.OCEAN_AREA='"MapOceanArea"',e.OCEAN_AREA_LABEL='"MapOceanAreaLabel"',e.FACILITY_AREA='"MapFacilityArea"',e.FACILITY_AREA_LABEL='"MapFacilityAreaLabel"',e.LANDUSE_AREA='"MapLanduseArea"',e.LANDUSE_AREA_LABEL='"MapLanduseAreaLabel"',e.NATURE_FIELD='"MapNatureField"',e.NATURE_FOREST='"MapNatureForest"',e.LINK='"Link"',e.RAILROAD_LINK='"MapRailroadLink"',e.WATER_LINK='"MapWaterLink"',e.WATER_AREA='"MapWaterArea"',e.WATER_AREA_LABEL='"MapWaterAreaLabel"',e.WATER_LAKE_LABEL='"MapWaterLakeLabel"',e.POI='"POI"',e.CITY_POI='"CityPOI"',e.CONDITIONS='"Conditions"',e.ROAD_POLY='"RoadPoly"',e.PARKING_LINE='"ParkingLine"',e.LINE_MARKING_LINE='"LaneMarkingLine"',e.LINE_MARKING_POLY='"LaneMarkingPoly"',e.TRAFFIC_SIGN='"TrafficSign"',e.TRAFFIC_SIGNAL='"TrafficSignal"',e.CAMERA='"Camera"',e.PILLAR='"Pillar"'}(gh||(gh={})),function(e){e.TILE="tile",e.NATURE_TILE="nature_tile",e.MSK="msk"}(yh||(yh={}));const vh=256,bh="https://dalganmap.ru/api-image/images",xh={[yh.TILE]:`${_h}/tiles/get_tile/{z}/{x}/{y}.mvt`,[yh.NATURE_TILE]:`${_h}/tiles/get_nature_tile/{z}/{x}/{y}.mvt`,[yh.MSK]:"http://89.108.118.23:3070/tiles/get_tile/{z}/{x}/{y}.mvt"},wh=e=>{const t=[],r={source:e,layer:gh.ROAD_POLY},n={id:mh(),data:r,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'Road';\n\n return isFilter;\n }",draw:{polygons:{color:"#BABCC2"}}},i={id:mh(),data:r,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'Tram';\n\n return isFilter;\n }",draw:{polygons:{color:"#ADA8A8"}}},s={id:mh(),data:r,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'Curb';\n\n return isFilter;\n }",draw:{polygons:{color:"#D2D9E6"}}},o={id:mh(),data:r,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'Bridge';\n\n return isFilter;\n }",draw:{polygons:{color:"#E1DFDD"}}};return t.push(n,i,s,o),t},Ah=e=>{const t=[],r={source:e,layer:gh.LINE_MARKING_POLY},n={id:mh(),data:r,filter:"function() {\n const { poly_number } = feature;\n\n const isFilter = poly_number === '1.14.1';\n\n return isFilter;\n }",draw:{styles:{zebra_crossing:{attributes:{a_angle:"function() {\n return feature.angle;\n }"}}}}},i={id:mh(),data:r,filter:"function() {\n const { poly_number } = feature;\n\n const isFilter = poly_number === '1.18';\n\n return isFilter;\n }",draw:{polygons:{color:"white"}}};return t.push(i,n),t},Eh=e=>{const t=[],r={source:e,layer:gh.LINE_MARKING_LINE},n="white",i=.5,s={id:mh(),data:r,sublayers:{1.1:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.1';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i}}},1.5:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.5';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,dash:[4,10]}}},1.6:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.6';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,dash:[5,5]}}},"1.16.1":{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.16.1';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i}}},1.7:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.7';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,dash:[4,10]}}},"1.7-blue":{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.7blue';\n\n return isFilter;\n }",draw:{lines:{color:"blue",width:i,dash:[4,10]}}},"1.14.3":{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.14.3';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,dash:[3,8]}}},1.12:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.12';\n\n return isFilter;\n }",draw:{lines:{color:n,width:1.5}}},"1.17.1":{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.17.1';\n\n return isFilter;\n }",draw:{lines:{color:"yellow",width:i}}},1.26:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.26';\n\n return isFilter;\n }",draw:{lines:{color:"yellow",width:i}}}}},o={"1.3-left":{id:mh(),data:r,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.3';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,offset:-.5}}},"1.3-right":{id:mh(),data:r,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.3';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,offset:i}}},"1.11r-left":{id:mh(),data:r,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11r';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,offset:-.5}}},"1.11r-right":{id:mh(),data:r,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11r';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,offset:i,dash:[5,5]}}},"1.11l-left":{id:mh(),data:r,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11l';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,offset:-.5,dash:[5,5]}}},"1.11l-right":{id:mh(),data:r,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11l';\n\n return isFilter;\n }",draw:{lines:{color:n,width:i,offset:i}}},"1.25-left":{id:mh(),data:r,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.25';\n\n return isFilter;\n }",draw:{lines:{color:n,width:1,offset:-.5,dash:[1,1],dash_background_color:[0,0,0,0]}}},"1.25-right":{id:mh(),data:r,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.25';\n\n return isFilter;\n }",draw:{lines:{color:"rgba(0,0,0,0)",width:1,offset:.5,dash:[1,1],dash_background_color:[1,1,1]}}}};return t.push(s,...Object.values(o)),t},Th=e=>{const t=[],r={source:e,layer:gh.PARKING_LINE},n={id:mh(),data:r,draw:{lines:{color:"white",width:1}}};return t.push(n),t};var Sh={global:{links:{getIsConstruction:"function (feature) {\n const { construction } = feature;\n\n return construction;\n}\n",getIsFunctionalClass:"function (feature) {\n const { functional_class, access_id } = feature;\n\n return functional_class === 5 && access_id === 32;\n}\n",getIsLowMobility:"function (feature) {\n const { functional_class, low_mobility } = feature;\n\n return functional_class === 5 && low_mobility === 1;\n}\n"}},cameras:{camera1:{type:"perspective",vanishing_point:[0,-500]}},textures:{arrow:{url:"https://dalganmap.ru/api-image/images/arrow-20.png",sprites:{base:[0,0,20,20]}},"traffic-signal":{url:"https://dalganmap.ru/api-image/images/conditions/traffic-signal.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},pedestrian_crossing:{url:"https://dalganmap.ru/api-image/images/conditions/pedestrian_crossing.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},physical:{url:"https://dalganmap.ru/api-image/images/conditions/physical.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},gate:{url:"https://dalganmap.ru/api-image/images/conditions/gate.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_3578:{url:"https://dalganmap.ru/api-image/images/POI/3578.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5813:{url:"https://dalganmap.ru/api-image/images/POI/5813.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5541:{url:"https://dalganmap.ru/api-image/images/POI/5541.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5540:{url:"https://dalganmap.ru/api-image/images/POI/5540.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9530(Mail)":{url:"https://dalganmap.ru/api-image/images/POI/mail.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9530(Delivery)":{url:"https://dalganmap.ru/api-image/images/POI/delivery.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5400:{url:"https://dalganmap.ru/api-image/images/POI/5400.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_6000:{url:"https://dalganmap.ru/api-image/images/POI/6000.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9565:{url:"https://dalganmap.ru/api-image/images/POI/9565.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9583:{url:"https://dalganmap.ru/api-image/images/POI/9583.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_8060:{url:"https://dalganmap.ru/api-image/images/POI/8060.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5511:{url:"https://dalganmap.ru/api-image/images/POI/5511.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5512:{url:"https://dalganmap.ru/api-image/images/POI/5512.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5800:{url:"https://dalganmap.ru/api-image/images/POI/5800.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5999:{url:"https://dalganmap.ru/api-image/images/POI/5999.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7011:{url:"https://dalganmap.ru/api-image/images/POI/7011.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7389:{url:"https://dalganmap.ru/api-image/images/POI/7389.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7832:{url:"https://dalganmap.ru/api-image/images/POI/7832.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7929:{url:"https://dalganmap.ru/api-image/images/POI/7929.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7990:{url:"https://dalganmap.ru/api-image/images/POI/7990.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7999:{url:"https://dalganmap.ru/api-image/images/POI/7999.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_8410:{url:"https://dalganmap.ru/api-image/images/POI/8410.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9517:{url:"https://dalganmap.ru/api-image/images/POI/9517.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9718:{url:"https://dalganmap.ru/api-image/images/POI/9718.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(mosque)":{url:"https://dalganmap.ru/api-image/images/POI/9992_mosque.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(church)":{url:"https://dalganmap.ru/api-image/images/POI/9992_church.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(temple)":{url:"https://dalganmap.ru/api-image/images/POI/9992_temple.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(davidStar)":{url:"https://dalganmap.ru/api-image/images/POI/9992_davidStar.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(mortar)":{url:"https://dalganmap.ru/api-image/images/POI/9992_mortar.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_4100(metro)":{url:"https://dalganmap.ru/api-image/images/POI/4100_metro.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_4100(diameter)":{url:"https://dalganmap.ru/api-image/images/POI/4100_diameter.png",filtering:"mipmap",sprites:{base:[0,0,41,15]}},POI_4013:{url:"https://dalganmap.ru/api-image/images/POI/4013.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}}},layers:null,styles:{buildings:{base:"polygons",shaders:{blocks:{color:"color.rgb;\n"}}}},lights:{light1:{type:"directional",direction:[.1,.5,-1],diffuse:.7,ambient:.5}},sources:null};const kh=e=>{const t=[],r={source:e,layer:gh.BUILTUP_AREA},n={id:mh(),data:r,draw:{polygons:{color:"#CFC8C8"}}};return t.push(n),t},Oh=e=>{const t=[],r={source:e,layer:gh.POINT_ADDRESS,minzoom:15},n={id:mh(),data:r,draw:{text:{text_source:"address",font:{fill:"black",size:"12px"}}}};return t.push(n),t},Rh='function() {\n const { poi_name, cat_id } = feature;\n\n switch (+cat_id) {\n case 4100: {\n const text = poi_name.replaceAll(/(Метро-|Станция-|МЦД-)/g, "");\n\n return text;\n }\n\n default: {\n return poi_name;\n }\n }\n}',Ch=[3578,4013,4100,5400,5511,5512,5540,5541,5800,5813,5999,6e3,7011,7389,7832,7929,7990,8060,8410,9517,9530,9565,9583,9718,9992],Nh=e=>{const t={};switch(e){case 4100:t[`_${e}-metro`]={filter:`function() {\n const { poi_name, cat_id } = feature;\n\n const isMetro = poi_name.startsWith('Метро-');\n const isStation = poi_name.startsWith('Станция-');\n\n const isCatId = +cat_id === ${e};\n\n const isFilter = isCatId && (isMetro || isStation);\n\n return isFilter;\n }`,draw:{points:Ph({texture:`POI_${e}(metro)`})}},t[`_${e}-diameter`]={filter:`function() {\n const { cat_id, poi_name } = feature;\n\n const isDiameter = poi_name.startsWith('МЦД-');\n\n const isCatId = +cat_id === ${e};\n\n const isFilter = isCatId && isDiameter;\n\n return isFilter;\n }`,draw:{points:Ph({texture:`POI_${e}(diameter)`,size:[41,15]})}};break;case 9530:t[`_${e}-mail`]={filter:`function() {\n const { cat_id, poi_name = '' } = feature;\n\n const isCatId = +cat_id === ${e};\n\n const isMail = poi_name.startsWith('Почта');\n\n const isFilter = isCatId && isMail;\n\n return isFilter;\n }`,draw:{points:Ph({texture:`POI_${e}(Mail)`})}},t[`_${e}-delivery`]={filter:`function() {\n const { cat_id, poi_name = '' } = feature;\n\n const isCatId = +cat_id === ${e};\n \n const isMail = poi_name.startsWith('Почта');\n\n const isFilter = isCatId && !isMail;\n\n return isFilter;\n }`,draw:{points:Ph({texture:`POI_${e}(Delivery)`})}};break;case 9992:{const r={mosque:1,church:2,temple:3,davidStar:4,mortar:6};Object.entries(r).forEach(([r,n])=>{t[`_${e}-${r}`]={filter:`function() {\n const { cat_id, subcat_id } = feature;\n\n const isCatId = +cat_id === ${e};\n const isSubcatId = +subcat_id === ${n};\n\n const isFilter = isCatId && isSubcatId;\n\n return isFilter;\n }`,draw:{points:Ph({texture:`POI_${e}(${r})`})}}});break}default:t[`_${e}`]={filter:`function() {\n const { cat_id } = feature;\n\n const isFilter = +cat_id === ${e};\n\n return isFilter;\n }`,draw:{points:Ph({texture:`POI_${e}`})}}}return t},Ph=({texture:e,size:t=20})=>({texture:e,size:t,sprite:"base",placement:"midpoint"}),Mh=Ch.reduce((e,t)=>({...e,...Nh(t)}),{}),Dh=e=>{const t=[],r={id:mh(),data:{source:e,layer:gh.POI},draw:{points:{text:{text_source:Rh,font:{fill:"#464544",size:"12px"}}}},sublayers:Mh};return t.push(r),t},zh=e=>{const t=[],r={source:e,layer:gh.CITY_POI},n={id:mh(),data:r,filter:"function() {\n const { capital_order8, capital_order2, capital_order1, poi_name, priority } = feature;\n\n if ($zoom >= 9 && $zoom < 13) {\n return priority < 8;\n }\n\n if ($zoom <= 11) {\n return capital_order8 === 'Y';\n }\n\n if ($zoom >= 15) {\n return capital_order2 !== 'Y';\n }\n\n return true;\n }\n ",draw:{text:{text_source:"poi_name",priority:"function () {\n const { priority } = feature;\n\n if ($zoom <= 15) {\n return priority;\n }\n\n return 1;\n }\n ",font:{fill:"black",size:"function() {\n const { capital_order8 } = feature;\n\n if (capital_order8 === 'Y') {\n return '16px';\n }\n\n return '12px';\n }",weight:"function() {\n const { capital_order2 } = feature;\n\n if (capital_order2 === 'Y') {\n return 'bold';\n }\n\n return 'normal';\n }",stroke:{color:"white",width:"2px"}}}}};return t.push(n),t},Ih=e=>{const t=[],r={id:mh(),data:{source:e,layer:gh.ONE_WAY},draw:{points:{texture:"arrow",sprite:"base",angle:"function() {\n const { bearing } = feature;\n \n return bearing;\n }\n "}}};return t.push(r),t};var Fh;!function(e){e.traffic_signal="traffic_signal",e.pedestrian_crossing="pedestrian_crossing",e.physical="physical",e.gate="gate"}(Fh||(Fh={}));const Lh=e=>{const t=[],r={},n={source:e,layer:gh.CONDITIONS},i={id:mh(),data:n};return Object.values(Fh).forEach(e=>{r[`_${e}`]={filter:`function() {\n const { type } = feature;\n\n const isShow = type === '${e}';\n\n return isShow;\n }`,draw:{points:{texture:e,sprite:"base",placement:"midpoint"}}}}),i.sublayers=r,t.push(i),t},jh=e=>{const t=[],r={source:e,layer:gh.RAILROAD_LINK},n={id:mh(),data:r,draw:{lines:{color:"#A3A8A",width:5,dash:[1,2],dash_background_color:[0,0,0],join:"round"}}};return t.push(n),t},Uh=e=>{const t=[],r={id:mh(),data:{source:e,layer:gh.WATER_AREA},draw:{polygons:{color:"#7DBEE4"},lines:{color:"#7DBEE4",width:20,cap:"round",join:"round"}}},n={id:mh(),data:{source:e,layer:gh.WATER_AREA_LABEL},filter:"function() {\n const { display_class } = feature;\n\n if ($zoom >= 14) {\n return true;\n } else {\n return display_class <= 4;\n }\n }",draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"14px",stroke:{color:"white",width:"3px"}}}}},i={id:mh(),data:{source:e,layer:gh.WATER_LAKE_LABEL},filter:"function() {\n const { display_class } = feature;\n\n if ($zoom >= 14) {\n return true;\n } else {\n return display_class <= 4;\n }\n }",draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"14px",stroke:{color:"white",width:"3px"}}}}};return t.push(r,n,i),t},Bh=e=>{const t=[],r={},n={source:e,layer:gh.WATER_LINK},i={id:mh(),data:n};return r.geometry={draw:{lines:{color:"#7DBEE4",width:5,cap:"round",join:"round"}}},r.text={filter:"function() {\n return $zoom >= 10;\n }",draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"14px",stroke:{color:"white",width:"3px"}}}}},i.sublayers=r,t.push(i),t},Vh=e=>{const t=[],r={id:mh(),data:{source:e,layer:gh.OCEAN_AREA},draw:{polygons:{color:"#7DBEE4"}}},n={id:mh(),data:{source:e,layer:gh.OCEAN_AREA_LABEL},draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"18px",stroke:{color:"white",width:"3px"}}}}};return t.push(r,n),t},Gh=e=>{const t=[],r={id:mh(),data:{source:e,layer:gh.LANDUSE_AREA},draw:{polygons:{color:"function() {\n const { feature_type } = feature;\n\n switch (feature_type) {\n case '509998': {\n return '#ECD175';\n }\n\n case '600102':\n case '900140': {\n return '#3E9A8C';\n }\n\n case '900202':\n case '900130':\n case '900150':\n case '900103': {\n return '#96BE7D';\n }\n\n case '9997010': {\n return null;\n }\n }\n }",order:"function() {\n const { feature_type } = feature;\n\n switch(feature_type) {\n case '900150':\n case '900130':\n case '509998': {\n return 300;\n }\n\n default: {\n return 299;\n }\n }\n }"}}},n={id:mh(),data:{source:e,layer:gh.LANDUSE_AREA_LABEL},filter:"function() {\n return $zoom >= 15;\n }",draw:{text:{text_source:"name",font:{size:"13px",fill:"function() {\n const { feature_type } = feature;\n\n switch(feature_type) {\n case '509998': {\n return '#CD7F32';\n }\n\n default: {\n return '#00541F';\n }\n }\n }",stroke:{color:"white",width:"3px"}}}}};return t.push(r,n),t},$h=e=>{const t=[],r={source:e,layer:gh.BUILDING_AREA,minzoom:15},n={id:mh(),data:r,extruded:{draw:{polygons:{style:"buildings",extrude:"function() {\n return $zoom >= 17;\n }"}}},draw:{polygons:{color:"#DDB07B",height:{property:"height"}},lines:{color:"#DB933F",width:"2px",cap:"round",join:"round"}}};return t.push(n),t},qh=e=>{const t=[],r={id:mh(),data:{source:e,layer:gh.FACILITY_AREA},draw:{polygons:{color:"function() {\n const { feature_type } = feature;\n\n switch (feature_type) {\n case '2000408': {\n return '#DBBAC4';\n }\n\n case '1900403': {\n return '#B6C3C7';\n }\n\n case '1907403': {\n return '#A3B9C0';\n }\n\n case '2000123': {\n return '#E4BA7D';\n }\n\n case '2000124': {\n return '#BFE6E3';\n }\n\n case '2000200': {\n return '#A0A9A8';\n }\n\n case '2000403': {\n return '#AF7136';\n }\n\n case '2000420': {\n return '#89AC76';\n }\n\n case '2000457': {\n return '#9494C0';\n }\n\n default: {\n return '#E1D4D4';\n }\n }\n }",order:"function() {\n const { feature_type } = feature;\n\n switch (feature_type) {\n case '1907403': {\n return 301;\n }\n\n default: {\n return 300;\n }\n }\n }"},lines:{color:"#857F7F",width:"2px",cap:"round",join:"round"}}},n={id:mh(),data:{source:e,layer:gh.FACILITY_AREA_LABEL},draw:{text:{text_source:"name",font:{fill:"function() {\n const { feature_type } = feature;\n\n switch(feature_type) {\n case '1900403':\n case '1907403': {\n return '#256D7B';\n }\n\n case '2000420':\n case '2000460':\n case '2000123': {\n return '#00541F';\n }\n\n case '2000408': {\n return '#5E2129';\n }\n\n case '2000124': {\n return '#3E5F8A';\n }\n\n case '2000200': {\n return '#464451';\n }\n\n case '2000403': {\n return '#B03F35';\n }\n\n case '2000457': {\n return '#6A5ACD';\n }\n\n case '1700215':\n case '900159':\n case '900158': {\n return '#474A51';\n }\n\n default: {\n return black;\n }\n }\n }",size:"12px",stroke:{color:"white",width:"3px"}}}}};return t.push(r,n),t},Wh=e=>{const t=[],r={source:e,layer:gh.ADMIN_AREA},n={id:mh(),data:r,draw:{polygons:{color:"#D3D2CF"}}},i={id:mh(),data:r,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'R';\n\n return isFilter;\n }",draw:{lines:{color:"#696969",width:"1px",cap:"round",join:"round"}}},s={id:mh(),data:r,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'D' && $zoom >= 12;\n\n return isFilter;\n }",draw:{lines:{color:"#696969",dash:[4,7],width:"1px",cap:"round",join:"round"}}};return t.push(n,i,s),t},Hh=()=>{const e=[],t={source:yh.NATURE_TILE,layer:gh.NATURE_FIELD},r={id:mh(),data:t,draw:{polygons:{color:"#EBEEC7"}}};return e.push(r),e},Zh=[-1,-.5,-.3,0,.3,.5,.7,1,1.5,2],Kh=[[5],[4,3],[2,1]],Xh="function() {\n const { functional_class, tunnel, tollway } = feature;\n\n const alpha = tunnel ? 0.89 : 1;\n\n const getRGB = (hex, alpha) => {\n const r = +(parseInt(hex.slice(1, 3), 16) / 255).toFixed(2);\n const g = +(parseInt(hex.slice(3, 5), 16) / 255).toFixed(2);\n const b = +(parseInt(hex.slice(5, 7), 16) / 255).toFixed(2);\n\n return [r, g, b, alpha];\n }\n\n if (tollway) {\n return '#D72740';\n }\n\n switch (functional_class) {\n case 1:\n case 2: {\n const color = getRGB('#D1747F', alpha);\n\n return color;\n }\n\n case 3:\n case 4: {\n const color = getRGB('#B1A7AA', alpha);\n\n return color;\n }\n\n case 5: {\n const color = getRGB('#D5CEC3', alpha);\n\n return color;\n }\n }\n}",Yh="function() {\n const { functional_class, road_number } = feature;\n\n const getScale = () => {\n if ($zoom <= 15 && $zoom >= 14) { return 7; }\n\n if ($zoom <= 13 && $zoom >= 12) { return 9; }\n\n if ($zoom <= 5) { return 400; }\n\n if ($zoom <= 7) { return 200; }\n\n if ($zoom < 12) { return 50; }\n\n return 1;\n }\n\n const scale = getScale();\n\n switch(functional_class) {\n case 1:\n case 2: {\n return 8 * scale;\n }\n\n case 3:\n case 4: {\n return 7 * scale;\n }\n\n case 5: {\n if (Boolean(road_number)) {\n return 7 * scale;\n }\n\n return 6;\n }\n }\n}",Qh=e=>{const t=[],r={source:e,layer:gh.LINK},n={id:mh(),data:r,draw:{text:{text_source:"road_number",font:{fill:"#181bff",size:"16px",weight:"bold",underline:!0,background:{color:"black"}}}}};t.push(n);const i={text_source:"street_name",font:{fill:"black",size:"14px",stroke:{color:"white",width:"3px"}}},s=()=>({text:i,lines:{color:Xh,width:Yh,cap:"round",join:"round"}}),o=()=>({lines:{color:Xh,width:Yh,outline:{color:"function() {\n const { functional_class, access_id, tollway } = feature;\n\n if (tollway) {\n return '#B9263B';\n }\n\n switch(functional_class) {\n case 5: {\n return '#989898';\n }\n\n case 3:\n case 4: {\n return '#8F6E78';\n }\n\n case 1:\n case 2: {\n return '#9A414B';\n }\n }\n}",width:"function() {\n const { functional_class, access_id } = feature;\n\n switch(functional_class) {\n case 5: {\n switch (access_id) {\n case 32: {\n return 0;\n }\n\n default: {\n return 1;\n }\n }\n }\n\n default: {\n return 1;\n }\n }\n}"}}});return Zh.forEach(e=>{const n=[],i=[];if(0===e)Kh.forEach(t=>{const a=[],l=[];t.forEach(t=>{const n={id:mh(),data:r,filter:`function() {\n const { functional_class, z_lvl = 0.0 } = feature;\n\n const isFilter = +z_lvl === ${e} && +functional_class === ${t};\n\n return isFilter;\n }`,draw:s(),sublayers:{construction:{filter:"function() {\n return global.links.getIsConstruction(feature);\n }",draw:{lines:{width:3,color:"#9AA096",dash:[2,1]}}},functionalClassAccessId32:{filter:"function() {\n return global.links.getIsFunctionalClass(feature);\n }",draw:{lines:{width:2,color:"#9AA096",dash:[2,1]}}},lowMobility:{filter:"function() {\n return global.links.getIsLowMobility(feature);\n }",draw:{lines:{width:4}}}}},i={id:mh(),data:r,filter:`function() {\n const { functional_class, z_lvl = 0.0 } = feature;\n\n const isFilter = +z_lvl === ${e} && +functional_class === ${t} && !global.links.getIsConstruction(feature) && !global.links.getIsFunctionalClass(feature);\n\n\n return isFilter;\n }`,draw:o(),sublayers:{lowMobility:{filter:"function() {\n return global.links.getIsLowMobility(feature);\n }",draw:{lines:{width:4}}}}};a.push(n),l.push(i)}),n.push(...a),i.push(...l)});else{const t=(e=>`function() {\n const { z_lvl = 0.0 } = feature;\n\n const isFilter = +z_lvl === ${e};\n\n return isFilter;\n }`)(e),a={id:mh(),data:r,filter:t,draw:s()},l={id:mh(),data:r,filter:t,draw:o()};n.push(a),i.push(l)}t.push(...i,...n)}),t},Jh=()=>{const e=[],t={source:yh.NATURE_TILE,layer:gh.NATURE_FOREST},r={id:mh(),data:t,draw:{polygons:{color:"function() {\n const { feature_type } = feature;\n\n switch (feature_type) {\n case '900202': {\n return '#96BE7D';\n }\n\n default : {\n return null;\n }\n }\n }"}}};return e.push(r),e};var ed;!function(e){e.ACTIVE="Действующий",e.INACTIVE="Недействующий",e.TEMPORARY="Временный"}(ed||(ed={}));const td={1.1:{title:"Железнодорожный переезд со шлагбаумом",height:20},1.2:{title:"Железнодорожный переезд без шлагбаума",height:20},"1.3.1":{title:"Однопутная железная дорога",height:20},"1.3.2":{title:"Многопутная железная дорога",height:20},"1.4.1":{title:"Приближение к железнодорожному переезду",height:40},"1.4.2":{title:"Приближение к железнодорожному переезду",height:40},"1.4.3":{title:"Приближение к железнодорожному переезду",height:40},"1.4.4":{title:"Приближение к железнодорожному переезду",height:40},"1.4.5":{title:"Приближение к железнодорожному переезду",height:40},"1.4.6":{title:"Приближение к железнодорожному переезду",height:40},1.5:{title:"Пересечение с трамвайной линией",height:20},1.6:{title:"Пересечение равнозначных дорог",height:20},1.7:{title:"Пересечение с круговым движением",height:20},1.8:{title:"Светофорное регулирование",height:20},1.9:{title:"Разводной мост",height:20},"1.10":{title:"Выезд на набережную",height:20},"1.11.1":{title:"Опасный поворот (правый)",height:20},"1.11.2":{title:"Опасный поворот (левый)",height:20},"1.12.1":{title:"Опасные повороты",height:20},"1.12.2":{title:"Опасные повороты",height:20},1.13:{title:"Крутой спуск",height:20},1.14:{title:"Крутой подъём",height:20},1.15:{title:"Скользская дорога",height:20},1.16:{title:"Неровная дорога",height:20},1.17:{title:"Искусственная неровность",height:20}},rd=[...Object.keys(td),"1.18","1.19","1.20.1","1.20.2","1.20.3","1.21","1.22","1.23","1.24","1.25","1.26","1.27","1.28","1.29","1.30","1.31","1.32","1.33","1.34.1 A","1.34.1 B","1.34.1 C","1.34.2 A","1.34.2 B","1.34.2 C","1.34.3 A","1.34.3 B","1.35","2.1","2.2","2.3.1","2.3.2","2.3.3","2.3.4","2.3.5","2.3.6","2.3.7","2.4","2.5","2.6","2.7","3.1","3.10","3.11","3.12","3.13","3.14","3.15","3.16","3.17.1","3.17.2","3.17.3","3.18.1","3.18.2","3.19","3.2","3.20","3.21","3.22","3.23","3.24-50","3.25-50","3.26","3.27","3.28","3.29","3.3","3.30","3.31","3.32","3.33","3.34","3.35","3.4","3.5","3.6","3.7","3.8","3.9","4.1.1","4.1.2","4.1.3","4.1.4","4.1.5","4.1.6","4.2.1","4.2.2","4.2.3","4.3","4.4.1","4.4.2","4.5.1","4.5.2","4.5.3","4.5.4","4.5.5","4.5.6","4.5.7","4.6-50","4.7-50","4.8.1","4.8.2","4.8.3","5.1","5.10","5.11.1","5.11.2","5.12.1","5.12.2","5.13.1","5.13.2","5.13.3","5.13.4","5.14.1","5.14.2","5.14.3","5.14.4","5.15.1","5.15.2 A","5.15.2 B","5.15.2 C","5.15.2 D","5.15.2 E","5.15.2 F","5.15.2 G","5.15.2 H","5.15.2 I","5.15.2 K","5.15.3 A","5.15.3 B","5.15.3 C","5.15.4 A","5.15.4 B","5.15.5","5.15.6","5.15.7 A","5.15.7 B","5.15.7 C","5.15.8","5.16","5.17","5.18","5.19.1","5.19.2","5.19.3","5.19.4 A","5.19.4 B","5.2","5.20","5.21","5.22","5.23.1","5.23.2","5.24.1","5.24.2","5.25","5.26","5.27","5.28","5.29","5.3","5.30","5.31","5.32","5.33","5.34","5.35","5.36","5.37 A","5.37 B","5.38 A","5.38 B","5.39","5.4","5.40","5.5","5.6","5.7.1","5.7.2","5.8","5.9","6.1","6.10.1 A","6.10.1 B","6.10.1 C","6.10.1 D","6.10.1 E","6.10.1 F","6.10.1 G","6.10.2 A","6.10.2 B","6.11 A","6.11 B","6.11 C","6.11 D","6.12 A","6.12 B","6.12 C","6.13 A","6.13 B","6.13 C","6.13 D","6.13 E","6.14.1 A","6.14.1 B","6.14.1 C","6.14.1 D","6.14.2 A","6.14.2 B","6.14.2 C","6.15.1","6.15.2","6.15.3","6.16","6.17","6.18.1","6.18.2","6.18.3","6.19.1","6.19.2","6.2-50","6.20.1","6.20.2","6.21.1","6.21.2","6.22","6.3.1","6.3.2","6.4 A","6.4 B","6.4 C","6.5","6.6","6.7","6.8.1","6.8.2","6.8.3","6.9.1 A","6.9.1 B","6.9.1 C","6.9.1 D","6.9.1 E","6.9.1 F","6.9.2 A","6.9.2 B","6.9.2 C","6.9.3","7.1","7.10","7.11","7.12","7.13","7.14.1","7.14.2","7.15","7.16","7.17","7.18","7.19","7.2","7.20","7.21","7.3","7.4","7.5","7.6","7.7","7.8","7.9","8.1.1","8.1.2","8.1.3","8.1.4","8.10","8.11","8.12","8.13 B","8.13","8.14","8.15","8.16","8.17","8.18","8.19","8.2.1","8.2.2","8.2.3","8.2.4","8.2.5","8.2.6","8.20.1","8.20.2","8.21.1","8.21.2","8.21.3","8.22.1","8.22.2","8.22.3","8.24","8.25","8.26","8.3.1","8.3.2","8.3.3","8.4.1","8.4.10","8.4.11","8.4.12","8.4.13","8.4.14","8.4.15","8.4.2","8.4.3.1","8.4.3.2","8.4.4","8.4.5","8.4.6","8.4.7","8.4.8","8.4.9","8.5.1","8.5.2","8.5.3","8.5.4","8.5.5","8.5.6","8.5.7","8.6.1","8.6.2","8.6.3","8.6.4","8.6.5","8.6.6","8.6.7","8.6.8","8.6.9","8.7","8.8","8.9.1","8.9.2","8.9.3"],nd={map:20,preview:40},id="traffic-sign",sd="svg",od=new Map,ad={20:["1.1","1.10","1.11.1","1.11.2","1.12.1","1.12.2","1.13","1.14","1.15","1.16","1.17","1.18","1.19","1.2","1.20.1","1.20.2","1.20.3","1.21","1.22","1.23","1.24","1.25","1.26","1.27","1.28","1.29","1.3.1","1.3.2","1.30","1.31","1.32","1.33","1.34.1 A","1.34.1 B","1.34.1 C","1.34.2 A","1.34.2 B","1.34.2 C","1.34.3 A","1.34.3 B","1.35","1.5","1.6","1.7","1.8","1.9","2.1","2.2","2.3.1","2.3.2","2.3.3","2.3.4","2.3.5","2.3.6","2.3.7","2.4","2.5","2.6","2.7","3.1","3.10","3.11","3.12","3.13","3.14","3.15","3.16","3.17.1","3.17.2","3.17.3","3.18.1","3.18.2","3.19","3.2","3.20","3.21","3.22","3.23","3.24-50","3.25-50","3.26","3.27","3.28","3.29","3.3","3.30","3.31","3.32","3.33","3.34","3.35","3.4","3.5","3.6","3.7","3.8","3.9","4.1.1","4.1.2","4.1.3","4.1.4","4.1.5","4.1.6","4.2.1","4.2.2","4.2.3","4.3","4.4.1","4.4.2","4.5.1","4.5.2","4.5.3","4.5.4","4.5.5","4.5.6","4.5.7","4.6-50","4.7-50","5.10","5.11.1","5.11.2","5.12.1","5.12.2","5.13.1","5.13.2","5.13.3","5.13.4","5.14.1","5.14.2","5.14.3","5.14.4","5.15.1","5.15.2 A","5.15.2 B","5.15.2 C","5.15.2 D","5.15.2 E","5.15.2 F","5.15.2 G","5.15.2 H","5.15.2 I","5.15.2 K","5.15.3 A","5.15.3 B","5.15.3 C","5.15.4 A","5.15.4 B","5.15.5","5.15.6","5.15.7 A","5.15.7 B","5.15.7 C","5.15.8","5.19.1","5.19.2","5.19.3","5.19.4 A","5.19.4 B","5.20","5.23.1","5.23.2","5.24.1","5.24.2","5.25","5.26","5.5","5.6","5.7.1","5.7.2","5.8","5.9","6.10.1 A","6.10.1 B","6.10.1 C","6.10.1 D","6.10.1 E","6.10.1 F","6.10.1 G","6.10.2 A","6.10.2 B","6.11 A","6.11 B","6.11 C","6.11 D","6.12 A","6.12 B","6.12 C","6.13 A","6.13 B","6.13 C","6.13 D","6.13 E","6.14.1 A","6.14.1 B","6.14.1 C","6.14.1 D","6.14.2 A","6.14.2 B","6.14.2 C","6.15.1","6.15.2","6.15.3","6.16","6.18.1","6.18.2","6.18.3","6.2 - 50","6.20.1","6.20.2","6.21.1","6.21.2","6.22","6.3.1","6.3.2","6.4 A","6.4 B","6.4 C","6.5","6.6","6.7","6.8.1","6.8.2","6.8.3","6.9.1 A","6.9.1 B","6.9.1 C","6.9.1 D","6.9.1 E","6.9.1 F","6.9.2 A","6.9.2 B","6.9.2 C","6.9.3","8.1.1","8.1.2","8.1.3","8.1.4","8.10","8.11","8.12","8.13 B","8.13","8.14","8.15","8.16","8.17","8.18","8.19","8.2.1","8.2.5","8.2.6","8.20.1","8.20.2","8.21.1","8.21.2","8.21.3","8.24","8.25","8.26","8.3.1","8.3.2","8.3.3","8.4.1","8.4.10","8.4.11","8.4.12","8.4.13","8.4.14","8.4.15","8.4.2","8.4.3.1","8.4.3.2","8.4.4","8.4.5","8.4.6","8.4.7","8.4.8","8.4.9","8.5.1","8.5.2","8.5.3","8.5.4","8.5.5","8.5.6","8.5.7","8.6.1","8.6.2","8.6.3","8.6.4","8.6.5","8.6.6","8.6.7","8.6.8","8.6.9","8.7","8.8","8.9.1","8.9.2","8.9.3"],25:["6.17","6.19.1","6.19.2"],30:["4.8.1","4.8.2","4.8.3","5.1","5.16","5.17","5.18","5.2","5.21","5.22","5.27","5.28","5.29","5.3","5.30","5.31","5.32","5.33","5.34","5.35","5.36","5.37 A","5.37 B","5.38 A","5.38 B","5.39","5.4","5.40","6.1","7.1","7.10","7.11","7.12","7.13","7.14.1","7.14.2","7.15","7.16","7.17","7.18","7.19","7.2","7.20","7.21","7.3","7.4","7.5","7.6","7.7","7.8","7.9"],40:["1.4.1","1.4.2","1.4.3","1.4.4","1.4.5","1.4.6","8.2.2","8.2.3","8.2.4"],68:["8.22.1","8.22.2","8.22.3"]};Object.entries(ad).forEach(([e,t])=>{t.forEach(t=>{od.set(t,{width:nd.map,height:+e})})});const ld=rd.reduce((e,t)=>{const r=pd(t);return r?{...e,[r]:[...e[r],t]}:e},{"Предупреждающие знаки":[],"Знаки приоритета":[],"Запрещающие знаки":[],"Предписывающие знаки":[],"Знаки особых предписаний":[],"Информационные знаки":[],"Знаки сервиса":[],"Знаки дополнительной информации":[]}),ud=Object.keys(ld).map(e=>({label:e,value:e})).filter(({label:e})=>"Знаки дополнительной информации"!==e),cd=Object.values(ed).map(e=>({label:e,value:e})),hd={traffic_sign_id:"",dit_id:"",tsodd_id:"",pillar_id:"",dops:"",comment:"Комментарий",direction:"Направление",traffic_sign_number:"Номер знака",traffic_sign_title:"Название знака",traffic_sign_value:"Название знака",traffic_sign_type:"Тип знака",lat:"Широта",lon:"Долгота",future_maintanance_date:"Дата следующего обслуживания",placement_date:"Дата установки",rapair_performed_date:"Дата последнего ремонта",verification_date:"Дата поверки",warranty_expr_date:"Дата окончания гарантии",status:"Статус"},dd=e=>{const t=[],r={source:e,layer:gh.TRAFFIC_SIGN},n={},i={};rd.forEach(e=>{const t=`${id}-${e}`,r=od.get(e);if(r){const{width:s,height:o}=r,a=fd({type:"map",number:e});n[t]={url:a,filtering:"mipmap",sprites:{base:[0,0,s,o]}},i[t]={filter:`function() {\n const { traffic_sign_number } = feature;\n\n const isFilter = traffic_sign_number === '${e}';\n\n return isFilter;\n }`,draw:{points:{collide:!1,texture:t,size:[s,o],sprite:"base",placement:"midpoint"}}}}});const s={id:mh(),data:r,textures:n,sublayers:i};return t.push(s),t},fd=({type:e,number:t})=>`${bh}/msk/${id}_${nd[e]}/${t}.svg`,pd=e=>{switch(Number(e[0])){case 1:return"Предупреждающие знаки";case 2:return"Знаки приоритета";case 3:return"Запрещающие знаки";case 4:return"Предписывающие знаки";case 5:return"Знаки особых предписаний";case 6:return"Информационные знаки";case 7:return"Знаки сервиса";case 8:return"Знаки дополнительной информации";default:return null}},md=()=>{const e=new Set,t=[];return Object.values(td).forEach(({title:t})=>{e.add(t)}),e.forEach(e=>{t.push({label:e,value:e})}),t},_d=e=>{const t=[],r={source:e,layer:gh.TRAFFIC_SIGNAL},n={},i="traffic_signal";n[i]={url:`https://dalganmap.ru/api-image/images/msk/${i}/${i}_20.svg`,filtering:"mipmap",sprites:{base:[0,0,20,20]}};const s={id:mh(),data:r,draw:{points:{collide:!1,texture:i,size:20,sprite:"base",placement:"midpoint"}},textures:n,sublayers:{}};return t.push(s),t},gd=e=>{const t=[],r={source:e,layer:gh.CAMERA},n={},i="camera";n[i]={url:`https://dalganmap.ru/api-image/images/msk/${i}/${i}_20.png`,filtering:"mipmap",sprites:{base:[0,0,20,20]}};const s={id:mh(),data:r,draw:{points:{collide:!1,texture:i,size:20,sprite:"base",placement:"midpoint"}},textures:n,sublayers:{}};return t.push(s),t},yd=e=>{const t=[],r={source:e,layer:gh.PILLAR},n={},i="pillar";n[i]={url:`https://dalganmap.ru/api-image/images/msk/${i}/${i}_20.png`,filtering:"mipmap",sprites:{base:[0,0,20,20]}};const s={id:mh(),data:r,draw:{points:{collide:!1,texture:i,size:20,sprite:"base",placement:"midpoint"}},textures:n,sublayers:{}};return t.push(s),t},vd=({id:e,data:{source:t,layer:r}})=>`${e}-${t}-${r}`,bd=({layer:e,order:t,eventHandlers:r})=>{const n=structuredClone(e),{draw:i,sublayers:s}=n,o=Boolean(r?.[e.data.layer]);if(i){const{points:e,lines:r,polygons:s,text:a,styles:l}=i;e&&(i.points={...structuredClone(e),order:t,interactive:o}),r&&(i.lines={...structuredClone(r),order:t,interactive:o}),s&&(i.polygons={...structuredClone(s),order:t,interactive:o}),a&&(i.text={...structuredClone(a),order:t,interactive:o}),l&&(i.styles=Object.entries(l).reduce((e,[r,n])=>({...e,[r]:{...structuredClone(n),order:t}}),{})),n.draw=structuredClone(i)}return s&&(Object.entries(s).forEach(([e,r])=>{if(r){const{draw:n}=r;if(n){const{points:e,lines:i,polygons:s,text:a}=n;a&&(n.text={...structuredClone(a),order:t,interactive:o}),e&&(n.points={...structuredClone(e),order:t,interactive:o}),i&&(n.lines={...structuredClone(i),order:t,interactive:o}),s&&(n.polygons={...structuredClone(s),order:t,interactive:o}),r.draw=structuredClone(n)}s[e]=structuredClone(r)}}),n.sublayers=structuredClone(s)),n},xd=e=>{const t=Wh(e),r=Hh(),n=Jh(),i=kh(e),s=qh(e),o=Gh(e),a=Uh(e),l=Vh(e),u=[];if(e===yh.MSK)u.push(...t,...i,...s,...o,...a,...l);else u.push(...t,...i,...s,...r,...n,...o,...a,...l);return u},wd=e=>{const t=Qh(e),r=jh(e),n=Bh(e),i=Ih(e),s=Lh(e),o=[...n,...r,...t];if(e===yh.MSK);else o.push(...i,...s);return o},Ad=e=>{const t=Dh(e),r=zh(e);return[...t,...Oh(e),...r,...dd(e),..._d(e),...gd(e),...yd(e)]},Ed=e=>{const t=[],r=$h(e),n=xd(e),i=wd(e),s=Ad(e),o=wh(e),a=Ah(e),l=Eh(e),u=Th(e);if(e===yh.MSK)t.push(...n,...i,...o,...a,...l,...u,...r,...s);else t.push(...n,...i,...r,...s);return t},Td=({eventHandlers:e})=>{const{instance:{isValidApiKey:t}}=lh,[n,i]=r.useState(null),s=r.useMemo(()=>{if(n){const{scene:e}=n;return e}return null},[n]),[o,a]=r.useState(null),l=r.useCallback(()=>{Promise.resolve().then(function(){return Jg}).then(()=>{if(window.Tangram){const t=window.Tangram.leafletLayer({scene:Sh}),{scene:r}=t;r.subscribe({load:({config:e})=>{a(e)}}),t.on("load",()=>{t.setSelectionEvents({click:({feature:t,leaflet_event:r})=>{if(t){const{source_layer:n,properties:i}=t;e?.[n]?.click?.({leaflet_event:r,properties:i})}},hover:({feature:t,leaflet_event:r})=>{if(t){const{source_layer:n,properties:i}=t;e?.[n]?.hover?.({leaflet_event:r,properties:i})}}})}),i(t)}})},[e]),u=r.useCallback(e=>{if(!s)return void console.warn("Scene не инициализирована");if(!o)return void console.warn("Config не инициализирована");const{name:t}=e;return o.sources[t]=structuredClone(e),s.updateConfig({rebuild:!0}),v()},[s,o]),c=r.useCallback(e=>{if(o)return structuredClone(o.sources[e]);console.warn("Config не инициализирована")},[o]),h=r.useCallback((e,t)=>{if(s){if(o)return o.sources[e].url=t,s.updateConfig({rebuild:!0}),v();console.warn("Config не инициализирована")}else console.warn("Scene не инициализирована")},[o,s]),d=r.useCallback(t=>{if(!s)return void console.warn("Scene не инициализирован");if(!o)return void console.warn("Config не инициализирован");const r=g().length+1,n=bd({layer:t,order:r,eventHandlers:e}),i=vd(n),{sublayers:a,draw:l,textures:u}=n;if(l){const{styles:e}=l;e&&(n.draw={...structuredClone(n.draw),...structuredClone(e)})}return o.layers[i]={...structuredClone(n),...structuredClone(a)},o.textures={...structuredClone(o.textures),...structuredClone(u)},s.updateConfig({rebuild:!0}),g()},[o,s,e]),f=r.useCallback(e=>{if(!s)return void console.warn("Scene не инициализирован");if(!o)return void console.warn("Config не инициализирован");const t=vd(e);return o.layers[t]&&delete o.layers[t],s.updateConfig({rebuild:!0}),g()},[o,s]),p=r.useCallback(({name:e,style:t})=>{s?o?(o.styles[e]=structuredClone(t),s.updateConfig({rebuild:!0})):console.warn("Config не инициализирована"):console.warn("Scene не инициализирована")},[o,s]),m=r.useCallback(e=>{if(!o)return void console.warn("Config не инициализирована");const t=vd(e),{visible:r}=o.layers[t];return r},[o]),_=r.useCallback(({layer:e,visible:t})=>{if(!s)return void console.warn("Scene не инициализирована");if(!o)return void console.warn("Config не инициализирована");const r=vd(e);return o.layers[r].visible=t,s.updateConfig(),m(e)},[o,s]),g=r.useCallback(()=>{if(!o)return[];const{layers:e}=o;return Object.keys(e)},[o]),y=r.useCallback(()=>{if(!o)return[];const{layers:e}=o;Object.values(e).forEach(f)},[o]),v=r.useCallback(()=>{if(!o)return[];const{sources:e}=o;return Object.keys(e)},[o]);return r.useEffect(()=>(t&&l(),()=>{i(null),a(null)}),[t]),r.useEffect(()=>{p({name:"zebra_crossing",style:{base:"polygons",lighting:!1,shaders:{attributes:{a_angle:{type:"float",default:0}},uniforms:{u_stripe_width:1},blocks:{filter:"\n vec3 pos = worldPosition().xyz;\n\n float ang = radians(a_angle);\n\n vec2 dir = vec2(sin(ang), cos(ang));\n\n float positionAlongLine = dot(pos.xy, dir);\n\n float stripe = step(1.0, mod(positionAlongLine / u_stripe_width, 2.0));\n\n color.rgb = mix(vec3(1.0, 1.0, 1.0), vec3(1.0, 0.8, 0.0), stripe);\n \n color.a = 1.0;\n "}}}}),Object.values(yh).forEach(e=>{u({tile_size:256,name:e,url:xh[e],type:"MVT"})})},[p,u]),{layer:n,scene:s,config:o,addSource:u,getSource:c,updateSource:h,addLayer:d,removeLayer:f,addStyle:p,getLayerVisibility:m,toggleLayerVisibility:_,getSources:v,getLayers:g,removeLayers:y}},Sd=({source:e})=>{const{layer:t,addLayer:n}=Td({}),i=oi();return r.useEffect(()=>{t&&i.addLayer(t)},[t]),r.useEffect(()=>{Ed(e).map(n)},[n,e]),null},kd=({children:t,sx:r={},...n})=>e(x,{...n,sx:{padding:"20px 15px",borderRadius:"10px",boxShadow:"0px 8px 24px 0px rgba(0,0,0,0.3)",maxHeight:"80vh",maxWidth:"90vw",overflowX:"auto",...r},children:t}),Od=({color:t="inherit"})=>e(M,{color:t}),Rd=c(null),Cd={didCatch:!1,error:null};class Nd extends m{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Cd}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(null!==e){for(var t,r,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];null===(t=(r=this.props).onReset)||void 0===t||t.call(r,{args:i,reason:"imperative-api"}),this.setState(Cd)}}componentDidCatch(e,t){var r,n;null===(r=(n=this.props).onError)||void 0===r||r.call(n,e,t)}componentDidUpdate(e,t){const{didCatch:r}=this.state,{resetKeys:n}=this.props;var i,s;r&&null!==t.error&&function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some((e,r)=>!Object.is(e,t[r]))}(e.resetKeys,n)&&(null===(i=(s=this.props).onReset)||void 0===i||i.call(s,{next:n,prev:e.resetKeys,reason:"keys"}),this.setState(Cd))}render(){const{children:e,fallbackRender:t,FallbackComponent:r,fallback:n}=this.props,{didCatch:i,error:s}=this.state;let o=e;if(i){const e={error:s,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)o=t(e);else if(r)o=_(r,e);else{if(void 0===n)throw s;o=n}}return _(Rd.Provider,{value:{didCatch:i,error:s,resetErrorBoundary:this.resetErrorBoundary}},o)}}const Pd=({error:r,resetErrorBoundary:n})=>t(x,{role:"alert",sx:{padding:"20px",background:"#fee"},children:[e(b,{variant:"h2",children:"Ошибка приложения"}),e(b,{variant:"body1",color:"error",children:r.message}),e(re,{onClick:n,children:"Попробовать снова"})]}),Md=({children:t,FallbackComponent:r=Pd})=>e(Nd,{FallbackComponent:r,children:t});if(!u)throw new Error("mobx-react-lite requires React with Hooks support");if(!function(e,t,r){return $c(function(){var n=Ec(e,r)[Ea];"production"!==process.env.NODE_ENV&&t&&e[va]&&Po("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),null!=t||(t=function(e){return la(e,va)||Jo(e,va,ma({},e[va])),e[va]}(e)),sa(t).forEach(function(e){return n.make_(e,t[e])})}),e})throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function Dd(e){e()}function zd(e){return Pu(e)}var Id,Fd=function(){function e(e){var t=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=1e4),clearTimeout(t.sweepTimeout),t.sweepTimeout=void 0;var r=Date.now();t.registrations.forEach(function(n,i){r-n.registeredAt>=e&&(t.finalize(n.value),t.registrations.delete(i))}),t.registrations.size>0&&t.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){t.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this.registrations.set(r,{value:t,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.registrations.delete(e)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){void 0===this.sweepTimeout&&(this.sweepTimeout=setTimeout(this.sweep,1e4))}}),e}(),Ld=new("undefined"!=typeof FinalizationRegistry?FinalizationRegistry:Fd)(function(e){var t;null===(t=e.reaction)||void 0===t||t.dispose(),e.reaction=null}),jd={exports:{}},Ud={};var Bd,Vd,Gd={};
|
|
2
2
|
/**
|
|
3
3
|
* @license React
|
|
4
4
|
* use-sync-external-store-shim.development.js
|
|
@@ -7,5 +7,5 @@ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var Bd,Vd,Gd=(jd||(jd=1,"production"===process.env.NODE_ENV?Id.exports=function(){if(Md)return Fd;Md=1;var e=n,t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=e.useState,i=e.useEffect,s=e.useLayoutEffect,o=e.useDebugValue;function a(e){var r=e.getSnapshot;e=e.value;try{var n=r();return!t(e,n)}catch(e){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),l=r({inst:{value:n,getSnapshot:t}}),u=l[0].inst,c=l[1];return s(function(){u.value=n,u.getSnapshot=t,a(u)&&c({inst:u})},[e,n,t]),i(function(){return a(u)&&c({inst:u}),e(function(){a(u)&&c({inst:u})})},[e]),o(n),n};return Fd.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:l,Fd}():Id.exports=(Ld||(Ld=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=n,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=t.useState,s=t.useEffect,o=t.useLayoutEffect,a=t.useDebugValue,l=!1,u=!1,c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(n,c){l||void 0===t.startTransition||(l=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var h=c();if(!u){var d=c();r(h,d)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}var f=(d=i({inst:{value:h,getSnapshot:c}}))[0].inst,p=d[1];return o(function(){f.value=h,f.getSnapshot=c,e(f)&&p({inst:f})},[n,h,c]),s(function(){return e(f)&&p({inst:f}),n(function(){e(f)&&p({inst:f})})},[n]),a(h),h};Ud.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:c,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Ud)),Id.exports);function $d(e){e.reaction=new nu("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),null===(t=e.onStoreChange)||void 0===t||t.call(e)})}var qd=!0,Wd="function"==typeof Symbol&&Symbol.for,Hd=null!==(Vd=null===(Bd=Object.getOwnPropertyDescriptor(function(){},"name"))||void 0===Bd?void 0:Bd.configurable)&&void 0!==Vd&&Vd,Zd=Wd?Symbol.for("react.forward_ref"):"function"==typeof g&&g(function(e){return null}).$$typeof,Kd=Wd?Symbol.for("react.memo"):"function"==typeof h&&h(function(e){return null}).$$typeof;function Xd(e,t){if(process.env.NODE_ENV,Kd&&e.$$typeof===Kd)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var r=!1,i=e,s=e.displayName||e.name;if(Zd&&e.$$typeof===Zd&&(r=!0,"function"!=typeof(i=e.render)))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var o,a,l=function(e,t){return function(e,t){void 0===t&&(t="observed");var r=n.useRef(null);if(!r.current){var i={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(e){return zd.unregister(i),i.onStoreChange=e,i.reaction||($d(i),i.stateVersion=Symbol()),function(){var e;i.onStoreChange=null,null===(e=i.reaction)||void 0===e||e.dispose(),i.reaction=null}},getSnapshot:function(){return i.stateVersion}};r.current=i}var s,o,a=r.current;if(a.reaction||($d(a),zd.register(r,a,a)),n.useDebugValue(a.reaction,Pd),Gd.useSyncExternalStore(a.subscribe,a.getSnapshot,a.getSnapshot),a.reaction.track(function(){try{s=e()}catch(e){o=e}}),o)throw o;return s}(function(){return i(e,t)},s)};return l.displayName=e.displayName,Hd&&Object.defineProperty(l,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(l.contextTypes=e.contextTypes,"production"!==process.env.NODE_ENV&&qd&&(qd=!1,console.warn("[mobx-react-lite] Support for Legacy Context in function components will be removed in the next major release."))),r&&(l=g(l)),l=h(l),o=e,a=l,Object.keys(o).forEach(function(e){Yd[e]||Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(o,e))}),"production"!==process.env.NODE_ENV&&Object.defineProperty(l,"contextTypes",{set:function(){var e,t;throw new Error("[mobx-react-lite] `".concat(this.displayName||(null===(e=this.type)||void 0===e?void 0:e.displayName)||(null===(t=this.type)||void 0===t?void 0:t.name)||"Component",".contextTypes` must be set before applying `observer`."))}}),l}var Yd={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};process.env.NODE_ENV,function(e){e||(e=Nd,"production"!==process.env.NODE_ENV&&console.warn("[MobX] Failed to get unstable_batched updates from react-dom / react-native")),Cu({reactionScheduler:e})}($),zd.finalizeAllImmediately;var Qd=Xd(({onUnauthorized:t,children:n})=>{const{authStore:i}=sh();return r.useEffect(()=>{i.isUnauthorized&&t()},[i.isUnauthorized]),e(r.Fragment,{children:n})}),Jd=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ef={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},tf=new class{#e=ef;#t=!1;setTimeoutProvider(e){"production"!==process.env.NODE_ENV&&this.#t&&e!==this.#e&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#e,provider:e}),this.#e=e,"production"!==process.env.NODE_ENV&&(this.#t=!1)}setTimeout(e,t){return"production"!==process.env.NODE_ENV&&(this.#t=!0),this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return"production"!==process.env.NODE_ENV&&(this.#t=!0),this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};var rf="undefined"==typeof window||"Deno"in globalThis;function nf(){}function sf(e){return"number"==typeof e&&e>=0&&e!==1/0}function of(e,t){return Math.max(e+(t||0)-Date.now(),0)}function af(e,t){return"function"==typeof e?e(t):e}function lf(e,t){return"function"==typeof e?e(t):e}function uf(e,t){const{type:r="all",exact:n,fetchStatus:i,predicate:s,queryKey:o,stale:a}=e;if(o)if(n){if(t.queryHash!==hf(o,t.options))return!1}else if(!ff(t.queryKey,o))return!1;if("all"!==r){const e=t.isActive();if("active"===r&&!e)return!1;if("inactive"===r&&e)return!1}return("boolean"!=typeof a||t.isStale()===a)&&((!i||i===t.state.fetchStatus)&&!(s&&!s(t)))}function cf(e,t){const{exact:r,status:n,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(r){if(df(t.options.mutationKey)!==df(s))return!1}else if(!ff(t.options.mutationKey,s))return!1}return(!n||t.state.status===n)&&!(i&&!i(t))}function hf(e,t){return(t?.queryKeyHashFn||df)(e)}function df(e){return JSON.stringify(e,(e,t)=>yf(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function ff(e,t){return e===t||typeof e==typeof t&&(!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&Object.keys(t).every(r=>ff(e[r],t[r])))}var pf=Object.prototype.hasOwnProperty;function mf(e,t){if(e===t)return e;const r=gf(e)&&gf(t);if(!(r||yf(e)&&yf(t)))return t;const n=(r?e:Object.keys(e)).length,i=r?t:Object.keys(t),s=i.length,o=r?new Array(s):{};let a=0;for(let l=0;l<s;l++){const s=r?l:i[l],u=e[s],c=t[s];if(u===c){o[s]=u,(r?l<n:pf.call(e,s))&&a++;continue}if(null===u||null===c||"object"!=typeof u||"object"!=typeof c){o[s]=c;continue}const h=mf(u,c);o[s]=h,h===u&&a++}return n===s&&a===n?e:o}function _f(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function gf(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function yf(e){if(!vf(e))return!1;const t=e.constructor;if(void 0===t)return!0;const r=t.prototype;return!!vf(r)&&(!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype)}function vf(e){return"[object Object]"===Object.prototype.toString.call(e)}function bf(e,t,r){if("function"==typeof r.structuralSharing)return r.structuralSharing(e,t);if(!1!==r.structuralSharing){if("production"!==process.env.NODE_ENV)try{return mf(e,t)}catch(e){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${e}`),e}return mf(e,t)}return t}function xf(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function wf(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Af=Symbol();function Ef(e,t){return"production"!==process.env.NODE_ENV&&e.queryFn===Af&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==Af?e.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`))}function Tf(e,t){return"function"==typeof e?e(...t):!!e}var Sf=new class extends Jd{#r;#n;#i;constructor(){super(),this.#i=e=>{if(!rf&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#n||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#n?.(),this.#n=void 0)}setEventListener(e){this.#i=e,this.#n?.(),this.#n=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#r!==e&&(this.#r=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#r?this.#r:"hidden"!==globalThis.document?.visibilityState}};function kf(){let e,t;const r=new Promise((r,n)=>{e=r,t=n});function n(e){Object.assign(r,e),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=t=>{n({status:"fulfilled",value:t}),e(t)},r.reject=e=>{n({status:"rejected",reason:e}),t(e)},r}var Of=function(e){setTimeout(e,0)};var Rf=function(){let e=[],t=0,r=e=>{e()},n=e=>{e()},i=Of;const s=n=>{t?e.push(n):i(()=>{r(n)})};return{batch:s=>{let o;t++;try{o=s()}finally{t--,t||(()=>{const t=e;e=[],t.length&&i(()=>{n(()=>{t.forEach(e=>{r(e)})})})})()}return o},batchCalls:e=>(...t)=>{s(()=>{e(...t)})},schedule:s,setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{n=e},setScheduler:e=>{i=e}}}(),Cf=new class extends Jd{#s=!0;#n;#i;constructor(){super(),this.#i=e=>{if(!rf&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#n||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#n?.(),this.#n=void 0)}setEventListener(e){this.#i=e,this.#n?.(),this.#n=e(this.setOnline.bind(this))}setOnline(e){this.#s!==e&&(this.#s=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#s}};function Nf(e){return Math.min(1e3*2**e,3e4)}function Pf(e){return"online"!==(e??"online")||Cf.isOnline()}var Mf=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Df(e){let t,r=!1,n=0;const i=kf(),s=()=>"pending"!==i.status,o=()=>Sf.isFocused()&&("always"===e.networkMode||Cf.isOnline())&&e.canRun(),a=()=>Pf(e.networkMode)&&e.canRun(),l=e=>{s()||(t?.(),i.resolve(e))},u=e=>{s()||(t?.(),i.reject(e))},c=()=>new Promise(r=>{t=e=>{(s()||o())&&r(e)},e.onPause?.()}).then(()=>{t=void 0,s()||e.onContinue?.()}),h=()=>{if(s())return;let t;const i=0===n?e.initialPromise:void 0;try{t=i??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(l).catch(t=>{if(s())return;const i=e.retry??(rf?0:3),a=e.retryDelay??Nf,l="function"==typeof a?a(n,t):a,d=!0===i||"number"==typeof i&&n<i||"function"==typeof i&&i(n,t);!r&&d?(n++,e.onFail?.(n,t),function(e){return new Promise(t=>{tf.setTimeout(t,e)})}(l).then(()=>o()?void 0:c()).then(()=>{r?u(t):h()})):u(t)})};return{promise:i,status:()=>i.status,cancel:t=>{if(!s()){const r=new Mf(t);u(r),e.onCancel?.(r)}},continue:()=>(t?.(),i),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:a,start:()=>(a()?h():c().then(h),i)}}var zf=class{#o;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),sf(this.gcTime)&&(this.#o=tf.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(rf?1/0:3e5))}clearGcTimeout(){this.#o&&(tf.clearTimeout(this.#o),this.#o=void 0)}},If=class extends zf{#a;#l;#u;#c;#h;#d;#f;constructor(e){super(),this.#f=!1,this.#d=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#c=e.client,this.#u=this.#c.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#a=jf(this.options),this.state=e.state??this.#a,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#h?.promise}setOptions(e){if(this.options={...this.#d,...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){const e=jf(this.options);void 0!==e.data&&(this.setState(Lf(e.data,e.dataUpdatedAt)),this.#a=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,t){const r=bf(this.state.data,e,this.options);return this.#p({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#p({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#h?.promise;return this.#h?.cancel(e),t?t.then(nf).catch(nf):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#a)}isActive(){return this.observers.some(e=>!1!==lf(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Af||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===af(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!of(this.state.dataUpdatedAt,e))}onFocus(){const e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#h?.continue()}onOnline(){const e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#h?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#h&&(this.#f?this.#h.cancel({revert:!0}):this.#h.cancelRetry()),this.scheduleGc()),this.#u.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#p({type:"invalidate"})}async fetch(e,t){if("idle"!==this.state.fetchStatus&&"rejected"!==this.#h?.status())if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#h)return this.#h.continueRetry(),this.#h.promise;if(e&&this.setOptions(e),!this.options.queryFn){const e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}"production"!==process.env.NODE_ENV&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,n=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#f=!0,r.signal)})},i=()=>{const e=Ef(this.options,t),r=(()=>{const e={client:this.#c,queryKey:this.queryKey,meta:this.meta};return n(e),e})();return this.#f=!1,this.options.persister?this.options.persister(e,r,this):e(r)},s=(()=>{const e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#c,state:this.state,fetchFn:i};return n(e),e})();this.options.behavior?.onFetch(s,this),this.#l=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===s.fetchOptions?.meta||this.#p({type:"fetch",meta:s.fetchOptions?.meta}),this.#h=Df({initialPromise:t?.initialPromise,fn:s.fetchFn,onCancel:e=>{e instanceof Mf&&e.revert&&this.setState({...this.#l,fetchStatus:"idle"}),r.abort()},onFail:(e,t)=>{this.#p({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#p({type:"pause"})},onContinue:()=>{this.#p({type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0});try{const e=await this.#h.start();if(void 0===e)throw"production"!==process.env.NODE_ENV&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#u.config.onSuccess?.(e,this),this.#u.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Mf){if(e.silent)return this.#h.promise;if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw this.#p({type:"error",error:e}),this.#u.config.onError?.(e,this),this.#u.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#p(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...Ff(t.data,this.options),fetchMeta:e.meta??null};case"success":const r={...t,...Lf(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=e.manual?r:void 0,r;case"error":const n=e.error;return{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),Rf.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function Ff(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Pf(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function Lf(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function jf(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,n=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Uf=class extends Jd{constructor(e,t){super(),this.options=t,this.#c=e,this.#m=null,this.#_=kf(),this.bindMethods(),this.setOptions(t)}#c;#g=void 0;#y=void 0;#v=void 0;#b;#x;#_;#m;#w;#A;#E;#T;#S;#k;#O=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#g.addObserver(this),Bf(this.#g,this.options)?this.#R():this.updateResult(),this.#C())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Vf(this.#g,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Vf(this.#g,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#N(),this.#P(),this.#g.removeObserver(this)}setOptions(e){const t=this.options,r=this.#g;if(this.options=this.#c.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof lf(this.options.enabled,this.#g))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#M(),this.#g.setOptions(this.options),t._defaulted&&!_f(this.options,t)&&this.#c.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#g,observer:this});const n=this.hasListeners();n&&Gf(this.#g,r,this.options,t)&&this.#R(),this.updateResult(),!n||this.#g===r&&lf(this.options.enabled,this.#g)===lf(t.enabled,this.#g)&&af(this.options.staleTime,this.#g)===af(t.staleTime,this.#g)||this.#D();const i=this.#z();!n||this.#g===r&&lf(this.options.enabled,this.#g)===lf(t.enabled,this.#g)&&i===this.#k||this.#I(i)}getOptimisticResult(e){const t=this.#c.getQueryCache().build(this.#c,e),r=this.createResult(t,e);return function(e,t){if(!_f(e.getCurrentResult(),t))return!0;return!1}(this,r)&&(this.#v=r,this.#x=this.options,this.#b=this.#g.state),r}getCurrentResult(){return this.#v}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#_.status||this.#_.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#O.add(e)}getCurrentQuery(){return this.#g}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#c.defaultQueryOptions(e),r=this.#c.getQueryCache().build(this.#c,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#R({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#v))}#R(e){this.#M();let t=this.#g.fetch(this.options,e);return e?.throwOnError||(t=t.catch(nf)),t}#D(){this.#N();const e=af(this.options.staleTime,this.#g);if(rf||this.#v.isStale||!sf(e))return;const t=of(this.#v.dataUpdatedAt,e)+1;this.#T=tf.setTimeout(()=>{this.#v.isStale||this.updateResult()},t)}#z(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#g):this.options.refetchInterval)??!1}#I(e){this.#P(),this.#k=e,!rf&&!1!==lf(this.options.enabled,this.#g)&&sf(this.#k)&&0!==this.#k&&(this.#S=tf.setInterval(()=>{(this.options.refetchIntervalInBackground||Sf.isFocused())&&this.#R()},this.#k))}#C(){this.#D(),this.#I(this.#z())}#N(){this.#T&&(tf.clearTimeout(this.#T),this.#T=void 0)}#P(){this.#S&&(tf.clearInterval(this.#S),this.#S=void 0)}createResult(e,t){const r=this.#g,n=this.options,i=this.#v,s=this.#b,o=this.#x,a=e!==r?e.state:this.#y,{state:l}=e;let u,c={...l},h=!1;if(t._optimisticResults){const i=this.hasListeners(),s=!i&&Bf(e,t),o=i&&Gf(e,r,t,n);(s||o)&&(c={...c,...Ff(l.data,e.options)}),"isRestoring"===t._optimisticResults&&(c.fetchStatus="idle")}let{error:d,errorUpdatedAt:f,status:p}=c;u=c.data;let m=!1;if(void 0!==t.placeholderData&&void 0===u&&"pending"===p){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,m=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#E?.state.data,this.#E):t.placeholderData,void 0!==e&&(p="success",u=bf(i?.data,e,t),h=!0)}if(t.select&&void 0!==u&&!m)if(i&&u===s?.data&&t.select===this.#w)u=this.#A;else try{this.#w=t.select,u=t.select(u),u=bf(i?.data,u,t),this.#A=u,this.#m=null}catch(e){this.#m=e}this.#m&&(d=this.#m,u=this.#A,f=Date.now(),p="error");const _="fetching"===c.fetchStatus,g="pending"===p,y="error"===p,v=g&&_,b=void 0!==u,x={status:p,fetchStatus:c.fetchStatus,isPending:g,isSuccess:"success"===p,isError:y,isInitialLoading:v,isLoading:v,data:u,dataUpdatedAt:c.dataUpdatedAt,error:d,errorUpdatedAt:f,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>a.dataUpdateCount||c.errorUpdateCount>a.errorUpdateCount,isFetching:_,isRefetching:_&&!g,isLoadingError:y&&!b,isPaused:"paused"===c.fetchStatus,isPlaceholderData:h,isRefetchError:y&&b,isStale:$f(e,t),refetch:this.refetch,promise:this.#_,isEnabled:!1!==lf(t.enabled,e)};if(this.options.experimental_prefetchInRender){const t=e=>{"error"===x.status?e.reject(x.error):void 0!==x.data&&e.resolve(x.data)},n=()=>{const e=this.#_=x.promise=kf();t(e)},i=this.#_;switch(i.status){case"pending":e.queryHash===r.queryHash&&t(i);break;case"fulfilled":"error"!==x.status&&x.data===i.value||n();break;case"rejected":"error"===x.status&&x.error===i.reason||n()}}return x}updateResult(){const e=this.#v,t=this.createResult(this.#g,this.options);if(this.#b=this.#g.state,this.#x=this.options,void 0!==this.#b.data&&(this.#E=this.#g),_f(t,e))return;this.#v=t;this.#F({listeners:(()=>{if(!e)return!0;const{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#O.size)return!0;const n=new Set(r??this.#O);return this.options.throwOnError&&n.add("error"),Object.keys(this.#v).some(t=>{const r=t;return this.#v[r]!==e[r]&&n.has(r)})})()})}#M(){const e=this.#c.getQueryCache().build(this.#c,this.options);if(e===this.#g)return;const t=this.#g;this.#g=e,this.#y=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#C()}#F(e){Rf.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#v)}),this.#c.getQueryCache().notify({query:this.#g,type:"observerResultsUpdated"})})}};function Bf(e,t){return function(e,t){return!1!==lf(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===t.retryOnMount)}(e,t)||void 0!==e.state.data&&Vf(e,t,t.refetchOnMount)}function Vf(e,t,r){if(!1!==lf(t.enabled,e)&&"static"!==af(t.staleTime,e)){const n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&$f(e,t)}return!1}function Gf(e,t,r,n){return(e!==t||!1===lf(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&$f(e,r)}function $f(e,t){return!1!==lf(t.enabled,e)&&e.isStaleByTime(af(t.staleTime,e))}function qf(e){return{onFetch:(t,r)=>{const n=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],o=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let r=!1;const u=Ef(t.options,t.fetchOptions),c=async(e,n,i)=>{if(r)return Promise.reject();if(null==n&&e.pages.length)return Promise.resolve(e);const s=(()=>{const e={client:t.client,queryKey:t.queryKey,pageParam:n,direction:i?"backward":"forward",meta:t.options.meta};return(e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)})})(e),e})(),o=await u(s),{maxPages:a}=t.options,l=i?wf:xf;return{pages:l(e.pages,o,a),pageParams:l(e.pageParams,n,a)}};if(i&&s.length){const e="backward"===i,t={pages:s,pageParams:o},r=(e?Hf:Wf)(n,t);a=await c(t,r,e)}else{const t=e??s.length;do{const e=0===l?o[0]??n.initialPageParam:Wf(n,a);if(l>0&&null==e)break;a=await c(a,e),l++}while(l<t)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function Wf(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function Hf(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Zf=class extends zf{#c;#L;#j;#h;constructor(e){super(),this.#c=e.client,this.mutationId=e.mutationId,this.#j=e.mutationCache,this.#L=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#L.includes(e)||(this.#L.push(e),this.clearGcTimeout(),this.#j.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#L=this.#L.filter(t=>t!==e),this.scheduleGc(),this.#j.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#L.length||("pending"===this.state.status?this.scheduleGc():this.#j.remove(this))}continue(){return this.#h?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#p({type:"continue"})},r={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#h=Df({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(e,t)=>{this.#p({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#p({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#j.canRun(this)});const n="pending"===this.state.status,i=!this.#h.canStart();try{if(n)t();else{this.#p({type:"pending",variables:e,isPaused:i}),await(this.#j.config.onMutate?.(e,this,r));const t=await(this.options.onMutate?.(e,r));t!==this.state.context&&this.#p({type:"pending",context:t,variables:e,isPaused:i})}const s=await this.#h.start();return await(this.#j.config.onSuccess?.(s,e,this.state.context,this,r)),await(this.options.onSuccess?.(s,e,this.state.context,r)),await(this.#j.config.onSettled?.(s,null,this.state.variables,this.state.context,this,r)),await(this.options.onSettled?.(s,null,e,this.state.context,r)),this.#p({type:"success",data:s}),s}catch(t){try{throw await(this.#j.config.onError?.(t,e,this.state.context,this,r)),await(this.options.onError?.(t,e,this.state.context,r)),await(this.#j.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r)),await(this.options.onSettled?.(void 0,t,e,this.state.context,r)),t}finally{this.#p({type:"error",error:t})}}finally{this.#j.runNext(this)}}#p(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),Rf.batch(()=>{this.#L.forEach(t=>{t.onMutationUpdate(e)}),this.#j.notify({mutation:this,type:"updated",action:e})})}};var Kf=class extends Jd{constructor(e={}){super(),this.config=e,this.#U=new Set,this.#B=new Map,this.#V=0}#U;#B;#V;build(e,t,r){const n=new Zf({client:e,mutationCache:this,mutationId:++this.#V,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#U.add(e);const t=Xf(e);if("string"==typeof t){const r=this.#B.get(t);r?r.push(e):this.#B.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#U.delete(e)){const t=Xf(e);if("string"==typeof t){const r=this.#B.get(t);if(r)if(r.length>1){const t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#B.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Xf(e);if("string"==typeof t){const r=this.#B.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}return!0}runNext(e){const t=Xf(e);if("string"==typeof t){const r=this.#B.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}return Promise.resolve()}clear(){Rf.batch(()=>{this.#U.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#U.clear(),this.#B.clear()})}getAll(){return Array.from(this.#U)}find(e){const t={exact:!0,...e};return this.getAll().find(e=>cf(t,e))}findAll(e={}){return this.getAll().filter(t=>cf(e,t))}notify(e){Rf.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(e=>e.state.isPaused);return Rf.batch(()=>Promise.all(e.map(e=>e.continue().catch(nf))))}};function Xf(e){return e.options.scope?.id}var Yf=class extends Jd{#c;#v=void 0;#G;#$;constructor(e,t){super(),this.#c=e,this.setOptions(t),this.bindMethods(),this.#q()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#c.defaultMutationOptions(e),_f(this.options,t)||this.#c.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#G,observer:this}),t?.mutationKey&&this.options.mutationKey&&df(t.mutationKey)!==df(this.options.mutationKey)?this.reset():"pending"===this.#G?.state.status&&this.#G.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#G?.removeObserver(this)}onMutationUpdate(e){this.#q(),this.#F(e)}getCurrentResult(){return this.#v}reset(){this.#G?.removeObserver(this),this.#G=void 0,this.#q(),this.#F()}mutate(e,t){return this.#$=t,this.#G?.removeObserver(this),this.#G=this.#c.getMutationCache().build(this.#c,this.options),this.#G.addObserver(this),this.#G.execute(e)}#q(){const e=this.#G?.state??{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0};this.#v={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#F(e){Rf.batch(()=>{if(this.#$&&this.hasListeners()){const t=this.#v.variables,r=this.#v.context,n={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};"success"===e?.type?(this.#$.onSuccess?.(e.data,t,r,n),this.#$.onSettled?.(e.data,null,t,r,n)):"error"===e?.type&&(this.#$.onError?.(e.error,t,r,n),this.#$.onSettled?.(void 0,e.error,t,r,n))}this.listeners.forEach(e=>{e(this.#v)})})}},Qf=class extends Jd{constructor(e={}){super(),this.config=e,this.#W=new Map}#W;build(e,t,r){const n=t.queryKey,i=t.queryHash??hf(n,t);let s=this.get(i);return s||(s=new If({client:e,queryKey:n,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(s)),s}add(e){this.#W.has(e.queryHash)||(this.#W.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#W.get(e.queryHash);t&&(e.destroy(),t===e&&this.#W.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Rf.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#W.get(e)}getAll(){return[...this.#W.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(e=>uf(t,e))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(t=>uf(e,t)):t}notify(e){Rf.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Rf.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Rf.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Jf=r.createContext(void 0),ep=e=>{const t=r.useContext(Jf);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},tp=({client:t,children:n})=>(r.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),e(Jf.Provider,{value:t,children:n})),rp=r.createContext(!1);rp.Provider;var np=r.createContext(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),ip=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function sp(e,t,n){if("production"!==process.env.NODE_ENV&&("object"!=typeof e||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const i=r.useContext(rp),s=r.useContext(np),o=ep(),a=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(a),"production"!==process.env.NODE_ENV&&(a.queryFn||console.error(`[${a.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),a._optimisticResults=i?"isRestoring":"optimistic",(e=>{if(e.suspense){const t=1e3,r=e=>"static"===e?e:Math.max(e??t,t),n=e.staleTime;e.staleTime="function"==typeof n?(...e)=>r(n(...e)):r(n),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,t))}})(a),((e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))})(a,s),(e=>{r.useEffect(()=>{e.clearReset()},[e])})(s);const l=!o.getQueryCache().get(a.queryHash),[u]=r.useState(()=>new t(o,a)),c=u.getOptimisticResult(a),h=!i&&!1!==e.subscribed;if(r.useSyncExternalStore(r.useCallback(e=>{const t=h?u.subscribe(Rf.batchCalls(e)):nf;return u.updateResult(),t},[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),r.useEffect(()=>{u.setOptions(a)},[a,u]),((e,t)=>e?.suspense&&t.isPending)(a,c))throw ip(a,u,s);if((({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(i&&void 0===e.data||Tf(r,[e.error,n])))({result:c,errorResetBoundary:s,throwOnError:a.throwOnError,query:o.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw c.error;if(o.getDefaultOptions().queries?._experimental_afterQuery?.(a,c),a.experimental_prefetchInRender&&!rf&&((e,t)=>e.isLoading&&e.isFetching&&!t)(c,i)){const e=l?ip(a,u,s):o.getQueryCache().get(a.queryHash)?.promise;e?.catch(nf).finally(()=>{u.updateResult()})}return a.notifyOnChangeProps?c:u.trackResult(c)}function op(e,t){const n=ep(),[i]=r.useState(()=>new Yf(n,e));r.useEffect(()=>{i.setOptions(e)},[i,e]);const s=r.useSyncExternalStore(r.useCallback(e=>i.subscribe(Rf.batchCalls(e)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),o=r.useCallback((e,t)=>{i.mutate(e,t).catch(nf)},[i]);if(s.error&&Tf(i.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}const ap=new class{#H;#j;#d;#Z;#K;#X;#Y;#Q;constructor(e={}){this.#H=e.queryCache||new Qf,this.#j=e.mutationCache||new Kf,this.#d=e.defaultOptions||{},this.#Z=new Map,this.#K=new Map,this.#X=0}mount(){this.#X++,1===this.#X&&(this.#Y=Sf.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#H.onFocus())}),this.#Q=Cf.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#H.onOnline())}))}unmount(){this.#X--,0===this.#X&&(this.#Y?.(),this.#Y=void 0,this.#Q?.(),this.#Q=void 0)}isFetching(e){return this.#H.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#j.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#H.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=this.#H.build(this,t),n=r.state.data;return void 0===n?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(af(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#H.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),i=this.#H.get(n.queryHash),s=i?.state.data,o=function(e,t){return"function"==typeof e?e(t):e}(t,s);if(void 0!==o)return this.#H.build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return Rf.batch(()=>this.#H.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#H.get(t.queryHash)?.state}removeQueries(e){const t=this.#H;Rf.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){const r=this.#H;return Rf.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=Rf.batch(()=>this.#H.findAll(e).map(e=>e.cancel(r)));return Promise.all(n).then(nf).catch(nf)}invalidateQueries(e,t={}){return Rf.batch(()=>(this.#H.findAll(e).forEach(e=>{e.invalidate()}),"none"===e?.refetchType?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=Rf.batch(()=>this.#H.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(nf)),"paused"===e.state.fetchStatus?Promise.resolve():t}));return Promise.all(n).then(nf)}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const r=this.#H.build(this,t);return r.isStaleByTime(af(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(nf).catch(nf)}fetchInfiniteQuery(e){return e.behavior=qf(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(nf).catch(nf)}ensureInfiniteQueryData(e){return e.behavior=qf(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Cf.isOnline()?this.#j.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#H}getMutationCache(){return this.#j}getDefaultOptions(){return this.#d}setDefaultOptions(e){this.#d=e}setQueryDefaults(e,t){this.#Z.set(df(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#Z.values()],r={};return t.forEach(t=>{ff(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#K.set(df(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#K.values()],r={};return t.forEach(t=>{ff(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#d.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=hf(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Af&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#d.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#H.clear(),this.#j.clear()}},lp=t=>e(tp,{...t,client:ap});function up(e,t){if(void 0!==e.one&&1===t)return e.one;const r=t%10,n=t%100;return 1===r&&11!==n?e.singularNominative.replace("{{count}}",String(t)):r>=2&&r<=4&&(n<10||n>20)?e.singularGenitive.replace("{{count}}",String(t)):e.pluralGenitive.replace("{{count}}",String(t))}function cp(e){return(t,r)=>r?.addSuffix?r.comparison&&r.comparison>0?e.future?up(e.future,t):"через "+up(e.regular,t):e.past?up(e.past,t):up(e.regular,t)+" назад":up(e.regular,t)}const hp={lessThanXSeconds:cp({regular:{one:"меньше секунды",singularNominative:"меньше {{count}} секунды",singularGenitive:"меньше {{count}} секунд",pluralGenitive:"меньше {{count}} секунд"},future:{one:"меньше, чем через секунду",singularNominative:"меньше, чем через {{count}} секунду",singularGenitive:"меньше, чем через {{count}} секунды",pluralGenitive:"меньше, чем через {{count}} секунд"}}),xSeconds:cp({regular:{singularNominative:"{{count}} секунда",singularGenitive:"{{count}} секунды",pluralGenitive:"{{count}} секунд"},past:{singularNominative:"{{count}} секунду назад",singularGenitive:"{{count}} секунды назад",pluralGenitive:"{{count}} секунд назад"},future:{singularNominative:"через {{count}} секунду",singularGenitive:"через {{count}} секунды",pluralGenitive:"через {{count}} секунд"}}),halfAMinute:(e,t)=>t?.addSuffix?t.comparison&&t.comparison>0?"через полминуты":"полминуты назад":"полминуты",lessThanXMinutes:cp({regular:{one:"меньше минуты",singularNominative:"меньше {{count}} минуты",singularGenitive:"меньше {{count}} минут",pluralGenitive:"меньше {{count}} минут"},future:{one:"меньше, чем через минуту",singularNominative:"меньше, чем через {{count}} минуту",singularGenitive:"меньше, чем через {{count}} минуты",pluralGenitive:"меньше, чем через {{count}} минут"}}),xMinutes:cp({regular:{singularNominative:"{{count}} минута",singularGenitive:"{{count}} минуты",pluralGenitive:"{{count}} минут"},past:{singularNominative:"{{count}} минуту назад",singularGenitive:"{{count}} минуты назад",pluralGenitive:"{{count}} минут назад"},future:{singularNominative:"через {{count}} минуту",singularGenitive:"через {{count}} минуты",pluralGenitive:"через {{count}} минут"}}),aboutXHours:cp({regular:{singularNominative:"около {{count}} часа",singularGenitive:"около {{count}} часов",pluralGenitive:"около {{count}} часов"},future:{singularNominative:"приблизительно через {{count}} час",singularGenitive:"приблизительно через {{count}} часа",pluralGenitive:"приблизительно через {{count}} часов"}}),xHours:cp({regular:{singularNominative:"{{count}} час",singularGenitive:"{{count}} часа",pluralGenitive:"{{count}} часов"}}),xDays:cp({regular:{singularNominative:"{{count}} день",singularGenitive:"{{count}} дня",pluralGenitive:"{{count}} дней"}}),aboutXWeeks:cp({regular:{singularNominative:"около {{count}} недели",singularGenitive:"около {{count}} недель",pluralGenitive:"около {{count}} недель"},future:{singularNominative:"приблизительно через {{count}} неделю",singularGenitive:"приблизительно через {{count}} недели",pluralGenitive:"приблизительно через {{count}} недель"}}),xWeeks:cp({regular:{singularNominative:"{{count}} неделя",singularGenitive:"{{count}} недели",pluralGenitive:"{{count}} недель"}}),aboutXMonths:cp({regular:{singularNominative:"около {{count}} месяца",singularGenitive:"около {{count}} месяцев",pluralGenitive:"около {{count}} месяцев"},future:{singularNominative:"приблизительно через {{count}} месяц",singularGenitive:"приблизительно через {{count}} месяца",pluralGenitive:"приблизительно через {{count}} месяцев"}}),xMonths:cp({regular:{singularNominative:"{{count}} месяц",singularGenitive:"{{count}} месяца",pluralGenitive:"{{count}} месяцев"}}),aboutXYears:cp({regular:{singularNominative:"около {{count}} года",singularGenitive:"около {{count}} лет",pluralGenitive:"около {{count}} лет"},future:{singularNominative:"приблизительно через {{count}} год",singularGenitive:"приблизительно через {{count}} года",pluralGenitive:"приблизительно через {{count}} лет"}}),xYears:cp({regular:{singularNominative:"{{count}} год",singularGenitive:"{{count}} года",pluralGenitive:"{{count}} лет"}}),overXYears:cp({regular:{singularNominative:"больше {{count}} года",singularGenitive:"больше {{count}} лет",pluralGenitive:"больше {{count}} лет"},future:{singularNominative:"больше, чем через {{count}} год",singularGenitive:"больше, чем через {{count}} года",pluralGenitive:"больше, чем через {{count}} лет"}}),almostXYears:cp({regular:{singularNominative:"почти {{count}} год",singularGenitive:"почти {{count}} года",pluralGenitive:"почти {{count}} лет"},future:{singularNominative:"почти через {{count}} год",singularGenitive:"почти через {{count}} года",pluralGenitive:"почти через {{count}} лет"}})};function dp(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const fp={date:dp({formats:{full:"EEEE, d MMMM y 'г.'",long:"d MMMM y 'г.'",medium:"d MMM y 'г.'",short:"dd.MM.y"},defaultWidth:"full"}),time:dp({formats:{full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},defaultWidth:"full"}),dateTime:dp({formats:{any:"{{date}}, {{time}}"},defaultWidth:"any"})},pp=Symbol.for("constructDateFrom");function mp(e,t){return"function"==typeof e?e(t):e&&"object"==typeof e&&pp in e?e[pp](t):e instanceof Date?new e.constructor(t):new Date(t)}let _p={};function gp(){return _p}function yp(e,t){const r=gp(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,i=(s=e,o=t?.in,mp(o||s,s));var s,o;const a=i.getDay(),l=(a<n?7:0)+a-n;return i.setDate(i.getDate()-l),i.setHours(0,0,0,0),i}function vp(e,t,r){const[n,i]=function(e,...t){const r=mp.bind(null,e||t.find(e=>"object"==typeof e));return t.map(r)}(r?.in,e,t);return+yp(n,r)===+yp(i,r)}const bp=["воскресенье","понедельник","вторник","среду","четверг","пятницу","субботу"];function xp(e){const t=bp[e];return 2===e?"'во "+t+" в' p":"'в "+t+" в' p"}const wp={lastWeek:(e,t,r)=>{const n=e.getDay();return vp(e,t,r)?xp(n):function(e){const t=bp[e];switch(e){case 0:return"'в прошлое "+t+" в' p";case 1:case 2:case 4:return"'в прошлый "+t+" в' p";case 3:case 5:case 6:return"'в прошлую "+t+" в' p"}}(n)},yesterday:"'вчера в' p",today:"'сегодня в' p",tomorrow:"'завтра в' p",nextWeek:(e,t,r)=>{const n=e.getDay();return vp(e,t,r)?xp(n):function(e){const t=bp[e];switch(e){case 0:return"'в следующее "+t+" в' p";case 1:case 2:case 4:return"'в следующий "+t+" в' p";case 3:case 5:case 6:return"'в следующую "+t+" в' p"}}(n)},other:"P"};function Ap(e){return(t,r)=>{let n;if("formatting"===(r?.context?String(r.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=r?.width?String(r.width):t;n=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=r?.width?String(r.width):e.defaultWidth;n=e.values[i]||e.values[t]}return n[e.argumentCallback?e.argumentCallback(t):t]}}const Ep={ordinalNumber:(e,t)=>{const r=Number(e),n=t?.unit;let i;return i="date"===n?"-е":"week"===n||"minute"===n||"second"===n?"-я":"-й",r+i},era:Ap({values:{narrow:["до н.э.","н.э."],abbreviated:["до н. э.","н. э."],wide:["до нашей эры","нашей эры"]},defaultWidth:"wide"}),quarter:Ap({values:{narrow:["1","2","3","4"],abbreviated:["1-й кв.","2-й кв.","3-й кв.","4-й кв."],wide:["1-й квартал","2-й квартал","3-й квартал","4-й квартал"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:Ap({values:{narrow:["Я","Ф","М","А","М","И","И","А","С","О","Н","Д"],abbreviated:["янв.","фев.","март","апр.","май","июнь","июль","авг.","сент.","окт.","нояб.","дек."],wide:["январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"]},defaultWidth:"wide",formattingValues:{narrow:["Я","Ф","М","А","М","И","И","А","С","О","Н","Д"],abbreviated:["янв.","фев.","мар.","апр.","мая","июн.","июл.","авг.","сент.","окт.","нояб.","дек."],wide:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"]},defaultFormattingWidth:"wide"}),day:Ap({values:{narrow:["В","П","В","С","Ч","П","С"],short:["вс","пн","вт","ср","чт","пт","сб"],abbreviated:["вск","пнд","втр","срд","чтв","птн","суб"],wide:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"]},defaultWidth:"wide"}),dayPeriod:Ap({values:{narrow:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утро",afternoon:"день",evening:"веч.",night:"ночь"},abbreviated:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утро",afternoon:"день",evening:"веч.",night:"ночь"},wide:{am:"ДП",pm:"ПП",midnight:"полночь",noon:"полдень",morning:"утро",afternoon:"день",evening:"вечер",night:"ночь"}},defaultWidth:"any",formattingValues:{narrow:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утра",afternoon:"дня",evening:"веч.",night:"ночи"},abbreviated:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утра",afternoon:"дня",evening:"веч.",night:"ночи"},wide:{am:"ДП",pm:"ПП",midnight:"полночь",noon:"полдень",morning:"утра",afternoon:"дня",evening:"вечера",night:"ночи"}},defaultFormattingWidth:"wide"})};function Tp(e){return(t,r={})=>{const n=r.width,i=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],s=t.match(i);if(!s)return null;const o=s[0],a=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?function(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r;return}(a,e=>e.test(o)):function(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r;return}(a,e=>e.test(o));let u;u=e.valueCallback?e.valueCallback(l):l,u=r.valueCallback?r.valueCallback(u):u;return{value:u,rest:t.slice(o.length)}}}const Sp={ordinalNumber:(kp={matchPattern:/^(\d+)(-?(е|я|й|ое|ье|ая|ья|ый|ой|ий|ый))?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const r=e.match(kp.matchPattern);if(!r)return null;const n=r[0],i=e.match(kp.parsePattern);if(!i)return null;let s=kp.valueCallback?kp.valueCallback(i[0]):i[0];return s=t.valueCallback?t.valueCallback(s):s,{value:s,rest:e.slice(n.length)}}),era:Tp({matchPatterns:{narrow:/^((до )?н\.?\s?э\.?)/i,abbreviated:/^((до )?н\.?\s?э\.?)/i,wide:/^(до нашей эры|нашей эры|наша эра)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^д/i,/^н/i]},defaultParseWidth:"any"}),quarter:Tp({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^[1234](-?[ыои]?й?)? кв.?/i,wide:/^[1234](-?[ыои]?й?)? квартал/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:Tp({matchPatterns:{narrow:/^[яфмаисонд]/i,abbreviated:/^(янв|фев|март?|апр|ма[йя]|июн[ья]?|июл[ья]?|авг|сент?|окт|нояб?|дек)\.?/i,wide:/^(январ[ья]|феврал[ья]|марта?|апрел[ья]|ма[йя]|июн[ья]|июл[ья]|августа?|сентябр[ья]|октябр[ья]|октябр[ья]|ноябр[ья]|декабр[ья])/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^я/i,/^ф/i,/^м/i,/^а/i,/^м/i,/^и/i,/^и/i,/^а/i,/^с/i,/^о/i,/^н/i,/^я/i],any:[/^я/i,/^ф/i,/^мар/i,/^ап/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^ав/i,/^с/i,/^о/i,/^н/i,/^д/i]},defaultParseWidth:"any"}),day:Tp({matchPatterns:{narrow:/^[впсч]/i,short:/^(вс|во|пн|по|вт|ср|чт|че|пт|пя|сб|су)\.?/i,abbreviated:/^(вск|вос|пнд|пон|втр|вто|срд|сре|чтв|чет|птн|пят|суб).?/i,wide:/^(воскресень[ея]|понедельника?|вторника?|сред[аы]|четверга?|пятниц[аы]|суббот[аы])/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^в/i,/^п/i,/^в/i,/^с/i,/^ч/i,/^п/i,/^с/i],any:[/^в[ос]/i,/^п[он]/i,/^в/i,/^ср/i,/^ч/i,/^п[ят]/i,/^с[уб]/i]},defaultParseWidth:"any"}),dayPeriod:Tp({matchPatterns:{narrow:/^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,abbreviated:/^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,wide:/^([дп]п|полночь|полдень|утр[оа]|день|дня|вечера?|ноч[ьи])/i},defaultMatchWidth:"wide",parsePatterns:{any:{am:/^дп/i,pm:/^пп/i,midnight:/^полн/i,noon:/^полд/i,morning:/^у/i,afternoon:/^д[ен]/i,evening:/^в/i,night:/^н/i}},defaultParseWidth:"any"})};var kp;const Op={code:"ru",formatDistance:(e,t,r)=>hp[e](t,r),formatLong:fp,formatRelative:(e,t,r,n)=>{const i=wp[e];return"function"==typeof i?i(t,r,n):i},localize:Ep,match:Sp,options:{weekStartsOn:1,firstWeekContainsDate:1}},Rp=t=>e(Z,{...t,dateAdapter:K,adapterLocale:Op});function Cp(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=Cp(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function Np(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=Cp(e))&&(n&&(n+=" "),n+=t);return n}let Pp={data:""},Mp=e=>{if("object"==typeof window){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||Pp},Dp=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,zp=/\/\*[^]*?\*\/| +/g,Ip=/\n+/g,Fp=(e,t)=>{let r="",n="",i="";for(let s in e){let o=e[s];"@"==s[0]?"i"==s[1]?r=s+" "+o+";":n+="f"==s[1]?Fp(o,s):s+"{"+Fp(o,"k"==s[1]?"":t)+"}":"object"==typeof o?n+=Fp(o,t?t.replace(/([^,])+/g,e=>s.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):s):null!=o&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=Fp.p?Fp.p(s,o):s+":"+o+";")}return r+(t&&i?t+"{"+i+"}":i)+n},Lp={},jp=e=>{if("object"==typeof e){let t="";for(let r in e)t+=r+jp(e[r]);return t}return e},Up=(e,t,r,n,i)=>{let s=jp(e),o=Lp[s]||(Lp[s]=(e=>{let t=0,r=11;for(;t<e.length;)r=101*r+e.charCodeAt(t++)>>>0;return"go"+r})(s));if(!Lp[o]){let t=s!==e?e:(e=>{let t,r,n=[{}];for(;t=Dp.exec(e.replace(zp,""));)t[4]?n.shift():t[3]?(r=t[3].replace(Ip," ").trim(),n.unshift(n[0][r]=n[0][r]||{})):n[0][t[1]]=t[2].replace(Ip," ").trim();return n[0]})(e);Lp[o]=Fp(i?{["@keyframes "+o]:t}:t,r?"":"."+o)}let a=r&&Lp.g?Lp.g:null;return r&&(Lp.g=Lp[o]),((e,t,r,n)=>{n?t.data=t.data.replace(n,e):-1===t.data.indexOf(e)&&(t.data=r?e+t.data:t.data+e)})(Lp[o],t,n,a),o};function Bp(e){let t=this||{},r=e.call?e(t.p):e;return Up(r.unshift?r.raw?((e,t,r)=>e.reduce((e,n,i)=>{let s=t[i];if(s&&s.call){let e=s(r),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;s=t?"."+t:e&&"object"==typeof e?e.props?"":Fp(e,""):!1===e?"":e}return e+n+(null==s?"":s)},""))(r,[].slice.call(arguments,1),t.p):r.reduce((e,r)=>Object.assign(e,r&&r.call?r(t.p):r),{}):r,Mp(t.target),t.g,t.o,t.k)}function Vp(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function Gp(){return Gp=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Gp.apply(this,arguments)}function $p(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function qp(e,t){if(null==e)return{};var r,n,i={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}function Wp(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}Bp.bind({g:1}),Bp.bind({k:1});var Hp=function(){return""},Zp=n.createContext({enqueueSnackbar:Hp,closeSnackbar:Hp}),Kp="@media (max-width:599.95px)",Xp="@media (min-width:600px)",Yp=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},Qp=function(e){return""+Yp(e.vertical)+Yp(e.horizontal)},Jp=function(e){return!!e||0===e},em="unmounted",tm="exited",rm="entering",nm="entered",im="exiting",sm=function(e){function t(t){var r;r=e.call(this,t)||this;var n,i=t.appear;return r.appearStatus=null,t.in?i?(n=tm,r.appearStatus=rm):n=nm:n=t.unmountOnExit||t.mountOnEnter?em:tm,r.state={status:n},r.nextCallback=null,r}$p(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===em?{status:tm}:null};var r=t.prototype;return r.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},r.componentDidUpdate=function(e){var t=null;if(e!==this.props){var r=this.state.status;this.props.in?r!==rm&&r!==nm&&(t=rm):r!==rm&&r!==nm||(t=im)}this.updateStatus(!1,t)},r.componentWillUnmount=function(){this.cancelNextCallback()},r.getTimeouts=function(){var e=this.props.timeout,t=e,r=e;return null!=e&&"number"!=typeof e&&"string"!=typeof e&&(r=e.exit,t=e.enter),{exit:r,enter:t}},r.updateStatus=function(e,t){void 0===e&&(e=!1),null!==t?(this.cancelNextCallback(),t===rm?this.performEnter(e):this.performExit()):this.props.unmountOnExit&&this.state.status===tm&&this.setState({status:em})},r.performEnter=function(e){var t=this,r=this.props.enter,n=e,i=this.getTimeouts();e||r?(this.props.onEnter&&this.props.onEnter(this.node,n),this.safeSetState({status:rm},function(){t.props.onEntering&&t.props.onEntering(t.node,n),t.onTransitionEnd(i.enter,function(){t.safeSetState({status:nm},function(){t.props.onEntered&&t.props.onEntered(t.node,n)})})})):this.safeSetState({status:nm},function(){t.props.onEntered&&t.props.onEntered(t.node,n)})},r.performExit=function(){var e=this,t=this.props.exit,r=this.getTimeouts();t?(this.props.onExit&&this.props.onExit(this.node),this.safeSetState({status:im},function(){e.props.onExiting&&e.props.onExiting(e.node),e.onTransitionEnd(r.exit,function(){e.safeSetState({status:tm},function(){e.props.onExited&&e.props.onExited(e.node)})})})):this.safeSetState({status:tm},function(){e.props.onExited&&e.props.onExited(e.node)})},r.cancelNextCallback=function(){null!==this.nextCallback&&this.nextCallback.cancel&&(this.nextCallback.cancel(),this.nextCallback=null)},r.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},r.setNextCallback=function(e){var t=this,r=!0;return this.nextCallback=function(){r&&(r=!1,t.nextCallback=null,e())},this.nextCallback.cancel=function(){r=!1},this.nextCallback},r.onTransitionEnd=function(e,t){this.setNextCallback(t);var r=null==e&&!this.props.addEndListener;this.node&&!r?(this.props.addEndListener&&this.props.addEndListener(this.node,this.nextCallback),null!=e&&setTimeout(this.nextCallback,e)):setTimeout(this.nextCallback,0)},r.render=function(){var e=this.state.status;if(e===em)return null;var t=this.props;return(0,t.children)(e,qp(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]))},Vp(t,[{key:"node",get:function(){var e,t=null===(e=this.props.nodeRef)||void 0===e?void 0:e.current;if(!t)throw new Error("notistack - Custom snackbar is not refForwarding");return t}}]),t}(n.Component);function om(){}function am(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function lm(e,t){return a(function(){return null==e&&null==t?null:function(r){am(e,r),am(t,r)}},[e,t])}function um(e){var t=e.timeout,r=e.style,n=void 0===r?{}:r,i=e.mode;return{duration:"object"==typeof t?t[i]||0:t,easing:n.transitionTimingFunction,delay:n.transitionDelay}}sm.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:om,onEntering:om,onEntered:om,onExit:om,onExiting:om,onExited:om};var cm="cubic-bezier(0.4, 0, 0.2, 1)",hm="cubic-bezier(0.0, 0, 0.2, 1)",dm="cubic-bezier(0.4, 0, 0.6, 1)",fm=function(e){e.scrollTop=e.scrollTop},pm=function(e){return Math.round(e)+"ms"};function mm(e,t){void 0===e&&(e=["all"]);var r=t||{},n=r.duration,i=void 0===n?300:n,s=r.easing,o=void 0===s?cm:s,a=r.delay,l=void 0===a?0:a;return(Array.isArray(e)?e:[e]).map(function(e){var t="string"==typeof i?i:pm(i),r="string"==typeof l?l:pm(l);return e+" "+t+" "+o+" "+r}).join(",")}function _m(e){var t=function(e){return e&&e.ownerDocument||document}(e);return t.defaultView||window}function gm(e,t){if(t){var r=function(e,t){var r,n=t.getBoundingClientRect(),i=_m(t);if(t.fakeTransform)r=t.fakeTransform;else{var s=i.getComputedStyle(t);r=s.getPropertyValue("-webkit-transform")||s.getPropertyValue("transform")}var o=0,a=0;if(r&&"none"!==r&&"string"==typeof r){var l=r.split("(")[1].split(")")[0].split(",");o=parseInt(l[4],10),a=parseInt(l[5],10)}switch(e){case"left":return"translateX("+(i.innerWidth+o-n.left)+"px)";case"right":return"translateX(-"+(n.left+n.width-o)+"px)";case"up":return"translateY("+(i.innerHeight+a-n.top)+"px)";default:return"translateY(-"+(n.top+n.height-a)+"px)"}}(e,t);r&&(t.style.webkitTransform=r,t.style.transform=r)}}var ym=g(function(e,t){var r=e.children,n=e.direction,i=void 0===n?"down":n,a=e.in,u=e.style,c=e.timeout,h=void 0===c?0:c,d=e.onEnter,f=e.onEntered,p=e.onExit,m=e.onExited,g=qp(e,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),v=o(null),b=lm(r.ref,v),x=lm(b,t),w=l(function(){v.current&&gm(i,v.current)},[i]);return s(function(){if(!a&&"down"!==i&&"right"!==i){var e=function(e,t){var r;function n(){for(var n=this,i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];clearTimeout(r),r=setTimeout(function(){e.apply(n,s)},t)}return void 0===t&&(t=166),n.clear=function(){clearTimeout(r)},n}(function(){v.current&&gm(i,v.current)}),t=_m(v.current);return t.addEventListener("resize",e),function(){e.clear(),t.removeEventListener("resize",e)}}},[i,a]),s(function(){a||w()},[a,w]),_(sm,Object.assign({appear:!0,nodeRef:v,onEnter:function(e,t){gm(i,e),fm(e),d&&d(e,t)},onEntered:f,onEntering:function(e){var t=(null==u?void 0:u.transitionTimingFunction)||hm,r=um({timeout:h,mode:"enter",style:Gp({},u,{transitionTimingFunction:t})});e.style.webkitTransition=mm("-webkit-transform",r),e.style.transition=mm("transform",r),e.style.webkitTransform="none",e.style.transform="none"},onExit:function(e){var t=(null==u?void 0:u.transitionTimingFunction)||dm,r=um({timeout:h,mode:"exit",style:Gp({},u,{transitionTimingFunction:t})});e.style.webkitTransition=mm("-webkit-transform",r),e.style.transition=mm("transform",r),gm(i,e),p&&p(e)},onExited:function(e){e.style.webkitTransition="",e.style.transition="",m&&m(e)},in:a,timeout:h},g),function(e,t){return y(r,Gp({ref:x,style:Gp({visibility:"exited"!==e||a?void 0:"hidden"},u,{},r.props.style)},t))})});ym.displayName="Slide";var vm=function(e){return n.createElement("svg",Object.assign({viewBox:"0 0 24 24",focusable:"false",style:{fontSize:20,marginInlineEnd:8,userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:"currentColor",flexShrink:0}},e))},bm=function(){return n.createElement(vm,null,n.createElement("path",{d:"M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41\n 10.59L10 14.17L17.59 6.58L19 8L10 17Z"}))},xm=function(){return n.createElement(vm,null,n.createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},wm=function(){return n.createElement(vm,null,n.createElement("path",{d:"M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,\n 6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,\n 13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z"}))},Am=function(){return n.createElement(vm,null,n.createElement("path",{d:"M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,\n 0 22,12A10,10 0 0,0 12,2Z"}))},Em={maxSnack:3,persist:!1,hideIconVariant:!1,disableWindowBlurListener:!1,variant:"default",autoHideDuration:5e3,iconVariant:{default:void 0,success:n.createElement(bm,null),warning:n.createElement(xm,null),error:n.createElement(wm,null),info:n.createElement(Am,null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:ym,transitionDuration:{enter:225,exit:195}},Tm=function(e,t){return function(r,n){return void 0===n&&(n=!1),n?Gp({},Em[r],{},t[r],{},e[r]):"autoHideDuration"===r?(i=e.autoHideDuration,s=t.autoHideDuration,(o=function(e){return"number"==typeof e||null===e})(i)?i:o(s)?s:Em.autoHideDuration):"transitionDuration"===r?function(e,t){var r=function(e,t){return t.some(function(t){return typeof e===t})};return r(e,["string","number"])?e:r(e,["object"])?Gp({},Em.transitionDuration,{},r(t,["object"])&&t,{},e):r(t,["string","number"])?t:r(t,["object"])?Gp({},Em.transitionDuration,{},t):Em.transitionDuration}(e.transitionDuration,t.transitionDuration):e[r]||t[r]||Em[r];var i,s,o}};function Sm(e){return Object.entries(e).reduce(function(e,t){var r,n=t[0],i=t[1];return Gp({},e,((r={})[n]=Bp(i),r))},{})}var km="notistack-SnackbarContainer",Om="notistack-Snackbar",Rm="notistack-CollapseWrapper",Cm="notistack-MuiContent",Nm=function(e){return"notistack-MuiContent-"+e},Pm=Sm({root:{height:0},entered:{height:"auto"}}),Mm="0px",Dm=g(function(e,t){var r=e.children,n=e.in,i=e.onExited,s=o(null),a=o(null),l=lm(t,a),u=function(){return s.current?s.current.clientHeight:0};return _(sm,{in:n,unmountOnExit:!0,onEnter:function(e){e.style.height=Mm},onEntered:function(e){e.style.height="auto"},onEntering:function(e){var t=u(),r=um({timeout:175,mode:"enter"}),n=r.duration,i=r.easing;e.style.transitionDuration="string"==typeof n?n:n+"ms",e.style.height=t+"px",e.style.transitionTimingFunction=i||""},onExit:function(e){e.style.height=u()+"px"},onExited:i,onExiting:function(e){fm(e);var t=um({timeout:175,mode:"exit"}),r=t.duration,n=t.easing;e.style.transitionDuration="string"==typeof r?r:r+"ms",e.style.height=Mm,e.style.transitionTimingFunction=n||""},nodeRef:a,timeout:175},function(e,t){return _("div",Object.assign({ref:l,className:Np(Pm.root,"entered"===e&&Pm.entered),style:Gp({pointerEvents:"all",overflow:"hidden",minHeight:Mm,transition:mm("height")},"entered"===e&&{overflow:"visible"},{},"exited"===e&&!n&&{visibility:"hidden"})},t),_("div",{ref:s,className:Rm,style:{display:"flex",width:"100%"}},r))})});Dm.displayName="Collapse";var zm={right:"left",left:"right",bottom:"up",top:"down"},Im=function(e){return"anchorOrigin"+Qp(e)},Fm=function(){};function Lm(e,t){return e.reduce(function(e,r){return null==r?e:function(){for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];var o=[].concat(i);t&&-1===o.indexOf(t)&&o.push(t),e.apply(this,o),r.apply(this,o)}},Fm)}var jm="undefined"!=typeof window?i:s;function Um(e){var t=o(e);return jm(function(){t.current=e}),l(function(){return t.current.apply(void 0,arguments)},[])}var Bm,Vm=g(function(e,t){var r=e.children,n=e.className,i=e.autoHideDuration,a=e.disableWindowBlurListener,u=void 0!==a&&a,c=e.onClose,h=e.id,d=e.open,f=e.SnackbarProps,p=void 0===f?{}:f,m=o(),g=Um(function(){c&&c.apply(void 0,arguments)}),y=Um(function(e){c&&null!=e&&(m.current&&clearTimeout(m.current),m.current=setTimeout(function(){g(null,"timeout",h)},e))});s(function(){return d&&y(i),function(){m.current&&clearTimeout(m.current)}},[d,i,y]);var v=function(){m.current&&clearTimeout(m.current)},b=l(function(){null!=i&&y(.5*i)},[i,y]);return s(function(){if(!u&&d)return window.addEventListener("focus",b),window.addEventListener("blur",v),function(){window.removeEventListener("focus",b),window.removeEventListener("blur",v)}},[u,b,d]),_("div",Object.assign({ref:t},p,{className:Np(Om,n),onMouseEnter:function(e){p.onMouseEnter&&p.onMouseEnter(e),v()},onMouseLeave:function(e){p.onMouseLeave&&p.onMouseLeave(e),b()}}),r)});Vm.displayName="Snackbar";var Gm=Sm({root:(Bm={display:"flex",flexWrap:"wrap",flexGrow:1},Bm[Xp]={flexGrow:"initial",minWidth:"288px"},Bm)}),$m=g(function(e,t){var r=e.className,i=qp(e,["className"]);return n.createElement("div",Object.assign({ref:t,className:Np(Gm.root,r)},i))});$m.displayName="SnackbarContent";var qm=Sm({root:{backgroundColor:"#313131",fontSize:"0.875rem",lineHeight:1.43,letterSpacing:"0.01071em",color:"#fff",alignItems:"center",padding:"6px 16px",borderRadius:"4px",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"},lessPadding:{paddingLeft:"20px"},default:{backgroundColor:"#313131"},success:{backgroundColor:"#43a047"},error:{backgroundColor:"#d32f2f"},warning:{backgroundColor:"#ff9800"},info:{backgroundColor:"#2196f3"},message:{display:"flex",alignItems:"center",padding:"8px 0"},action:{display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:"16px",marginRight:"-8px"}}),Wm="notistack-snackbar",Hm=g(function(e,t){var r=e.id,i=e.message,s=e.action,o=e.iconVariant,a=e.variant,l=e.hideIconVariant,u=e.style,c=e.className,h=o[a],d=s;return"function"==typeof d&&(d=d(r)),n.createElement($m,{ref:t,role:"alert","aria-describedby":Wm,style:u,className:Np(Cm,Nm(a),qm.root,qm[a],c,!l&&h&&qm.lessPadding)},n.createElement("div",{id:Wm,className:qm.message},l?null:h,i),d&&n.createElement("div",{className:qm.action},d))});Hm.displayName="MaterialDesignContent";var Zm,Km,Xm,Ym,Qm,Jm=h(Hm),e_=Sm({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),t_=function(e){var t=o(),r=u(!0),i=r[0],c=r[1],h=Lm([e.snack.onClose,e.onClose]),d=l(function(){t.current=setTimeout(function(){c(function(e){return!e})},125)},[]);s(function(){return function(){t.current&&clearTimeout(t.current)}},[]);var f,p=e.snack,m=e.classes,_=e.Component,g=void 0===_?Jm:_,y=a(function(){return function(e){void 0===e&&(e={});var t={containerRoot:!0,containerAnchorOriginTopCenter:!0,containerAnchorOriginBottomCenter:!0,containerAnchorOriginTopRight:!0,containerAnchorOriginBottomRight:!0,containerAnchorOriginTopLeft:!0,containerAnchorOriginBottomLeft:!0};return Object.keys(e).filter(function(e){return!t[e]}).reduce(function(t,r){var n;return Gp({},t,((n={})[r]=e[r],n))},{})}(m)},[m]),v=p.open,b=p.SnackbarProps,x=p.TransitionComponent,w=p.TransitionProps,A=p.transitionDuration,E=p.disableWindowBlurListener,T=p.content,S=qp(p,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),k=Gp({direction:(f=S.anchorOrigin,"center"!==f.horizontal?zm[f.horizontal]:zm[f.vertical]),timeout:A},w),O=T;"function"==typeof O&&(O=O(S.id,S.message));var R=["onEnter","onEntered","onExit","onExited"].reduce(function(t,r){var n;return Gp({},t,((n={})[r]=Lm([e.snack[r],e[r]],S.id),n))},{});return n.createElement(Dm,{in:i,onExited:R.onExited},n.createElement(Vm,{open:v,id:S.id,disableWindowBlurListener:E,autoHideDuration:S.autoHideDuration,className:Np(e_.wrappedRoot,y.root,y[Im(S.anchorOrigin)]),SnackbarProps:b,onClose:h},n.createElement(x,Object.assign({},k,{appear:!0,in:v,onExit:R.onExit,onExited:d,onEnter:R.onEnter,onEntered:Lm([R.onEntered,function(){e.snack.requestClose&&h(null,"instructed",e.snack.id)}],S.id)}),O||n.createElement(g,Object.assign({},S)))))},r_={default:20},n_={default:6,dense:2},i_="."+Rm,s_=Sm({root:(Zm={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:mm(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"},Zm[i_]={padding:n_.default+"px 0px",transition:"padding 300ms ease 0ms"},Zm.maxWidth="calc(100% - "+2*r_.default+"px)",Zm[Kp]={width:"100%",maxWidth:"calc(100% - 32px)"},Zm),rootDense:(Km={},Km[i_]={padding:n_.dense+"px 0px"},Km),top:{top:r_.default-n_.default+"px",flexDirection:"column"},bottom:{bottom:r_.default-n_.default+"px",flexDirection:"column-reverse"},left:(Xm={left:r_.default+"px"},Xm[Xp]={alignItems:"flex-start"},Xm[Kp]={left:"16px"},Xm),right:(Ym={right:r_.default+"px"},Ym[Xp]={alignItems:"flex-end"},Ym[Kp]={right:"16px"},Ym),center:(Qm={left:"50%",transform:"translateX(-50%)"},Qm[Xp]={alignItems:"center"},Qm)}),o_=function(e){var t=e.classes,r=void 0===t?{}:t,i=e.anchorOrigin,s=e.dense,o=e.children,a=Np(km,s_[i.vertical],s_[i.horizontal],s_.root,r.containerRoot,r["containerAnchorOrigin"+Qp(i)],s&&s_.rootDense);return n.createElement("div",{className:a},o)},a_=h(o_),l_="production"!==process.env.NODE_ENV,u_={NO_PERSIST_ALL:"Reached maxSnack while all enqueued snackbars have 'persist' flag. Notistack will dismiss the oldest snackbar anyway to allow other ones in the queue to be presented."},c_=function(e){return!("string"==typeof e||v(e))},h_=function(e){function t(t){var r;return(r=e.call(this,t)||this).enqueueSnackbar=function(e,t){if(void 0===t&&(t={}),null==e)throw new Error("enqueueSnackbar called with invalid argument");var n=c_(e)?e:t,i=c_(e)?e.message:e,s=n.key,o=n.preventDuplicate,a=qp(n,["key","preventDuplicate"]),l=Jp(s),u=l?s:(new Date).getTime()+Math.random(),c=Tm(a,r.props),h=Gp({id:u},a,{message:i,open:!0,entered:!1,requestClose:!1,persist:c("persist"),action:c("action"),content:c("content"),variant:c("variant"),anchorOrigin:c("anchorOrigin"),disableWindowBlurListener:c("disableWindowBlurListener"),autoHideDuration:c("autoHideDuration"),hideIconVariant:c("hideIconVariant"),TransitionComponent:c("TransitionComponent"),transitionDuration:c("transitionDuration"),TransitionProps:c("TransitionProps",!0),iconVariant:c("iconVariant",!0),style:c("style",!0),SnackbarProps:c("SnackbarProps",!0),className:Np(r.props.className,a.className)});return h.persist&&(h.autoHideDuration=void 0),r.setState(function(e){if(void 0===o&&r.props.preventDuplicate||o){var t=function(e){return l?e.id===u:e.message===i},n=e.queue.findIndex(t)>-1,s=e.snacks.findIndex(t)>-1;if(n||s)return e}return r.handleDisplaySnack(Gp({},e,{queue:[].concat(e.queue,[h])}))}),u},r.handleDisplaySnack=function(e){return e.snacks.length>=r.maxSnack?r.handleDismissOldest(e):r.processQueue(e)},r.processQueue=function(e){var t=e.queue,r=e.snacks;return t.length>0?Gp({},e,{snacks:[].concat(r,[t[0]]),queue:t.slice(1,t.length)}):e},r.handleDismissOldest=function(e){if(e.snacks.some(function(e){return!e.open||e.requestClose}))return e;var t=!1,n=!1;e.snacks.reduce(function(e,t){return e+(t.open&&t.persist?1:0)},0)===r.maxSnack&&("production"!==process.env.NODE_ENV&&function(e){if(l_){var t=u_[e];"undefined"!=typeof console&&console.error("WARNING - notistack: "+t);try{throw new Error(t)}catch(e){}}}("NO_PERSIST_ALL"),n=!0);var i=e.snacks.map(function(e){return t||e.persist&&!n?Gp({},e):(t=!0,e.entered?(e.onClose&&e.onClose(null,"maxsnack",e.id),r.props.onClose&&r.props.onClose(null,"maxsnack",e.id),Gp({},e,{open:!1})):Gp({},e,{requestClose:!0}))});return Gp({},e,{snacks:i})},r.handleEnteredSnack=function(e,t,n){if(!Jp(n))throw new Error("handleEnteredSnack Cannot be called with undefined key");r.setState(function(e){return{snacks:e.snacks.map(function(e){return e.id===n?Gp({},e,{entered:!0}):Gp({},e)})}})},r.handleCloseSnack=function(e,t,n){r.props.onClose&&r.props.onClose(e,t,n);var i=void 0===n;r.setState(function(e){var t=e.snacks,r=e.queue;return{snacks:t.map(function(e){return i||e.id===n?e.entered?Gp({},e,{open:!1}):Gp({},e,{requestClose:!0}):Gp({},e)}),queue:r.filter(function(e){return e.id!==n})}})},r.closeSnackbar=function(e){var t=r.state.snacks.find(function(t){return t.id===e});Jp(e)&&t&&t.onClose&&t.onClose(null,"instructed",e),r.handleCloseSnack(null,"instructed",e)},r.handleExitedSnack=function(e,t){if(!Jp(t))throw new Error("handleExitedSnack Cannot be called with undefined key");r.setState(function(e){var n=r.processQueue(Gp({},e,{snacks:e.snacks.filter(function(e){return e.id!==t})}));return 0===n.queue.length?n:r.handleDismissOldest(n)})},r.enqueueSnackbar,r.closeSnackbar,r.state={snacks:[],queue:[],contextValue:{enqueueSnackbar:r.enqueueSnackbar.bind(Wp(r)),closeSnackbar:r.closeSnackbar.bind(Wp(r))}},r}return $p(t,e),t.prototype.render=function(){var e=this,t=this.state.contextValue,r=this.props,i=r.domRoot,s=r.children,o=r.dense,a=void 0!==o&&o,l=r.Components,u=void 0===l?{}:l,c=r.classes,h=this.state.snacks.reduce(function(e,t){var r,n=Qp(t.anchorOrigin),i=e[n]||[];return Gp({},e,((r={})[n]=[].concat(i,[t]),r))},{}),d=Object.keys(h).map(function(t){var r=h[t],i=r[0];return n.createElement(a_,{key:t,dense:a,anchorOrigin:i.anchorOrigin,classes:c},r.map(function(t){return n.createElement(t_,{key:t.id,snack:t,classes:c,Component:u[t.variant],onClose:e.handleCloseSnack,onEnter:e.props.onEnter,onExit:e.props.onExit,onExited:Lm([e.handleExitedSnack,e.props.onExited],t.id),onEntered:Lm([e.handleEnteredSnack,e.props.onEntered],t.id)})}))});return n.createElement(Zp.Provider,{value:t},s,i?q(d,i):d)},Vp(t,[{key:"maxSnack",get:function(){return this.props.maxSnack||Em.maxSnack}}]),t}(m);const d_=({children:t,configOptions:n})=>{const[i,s]=r.useState(null),[o,a]=r.useState("");return r.useEffect(()=>(lh.initialize({...n,onCheck:e=>{const{valid:t,reason:r}=e;a(r),s(t),n.onCheck?.(e)}}),()=>{lh.deactivate()}),[n]),null===i?e(Td,{color:"primary"}):i?e(r.Fragment,{children:t}):e(b,{color:"error",children:o})},f_=({children:t,themeOptions:r})=>{const n=U(r);return e(B,{theme:n,children:t})},p_=({children:t,configOptions:r,themeOptions:n})=>e(h_,{children:e(lp,{children:e(ih,{children:e(f_,{themeOptions:n,children:e(Rp,{children:e(d_,{configOptions:r,children:t})})})})})}),m_={position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",bgcolor:"background.paper",border:"2px solid #000",boxShadow:24,p:4,maxHeight:"90vh",overflowX:"auto",overflowY:"auto"};var __=Xd(({name:t,children:n,onClose:i,onOpen:s})=>{const o=r.useId(),{modalStore:a}=sh(),l=a.getIsVisible(t);return r.useEffect(()=>{l&&s?.({name:t})},[l]),e(H,{open:l,onClose:()=>{a.closeModal(t),i?.({name:t})},"aria-labelledby":`modal-${o}-title`,"aria-describedby":`modal-${o}-description`,children:e(W,{sx:({breakpoints:e})=>({...m_,[e.up("sm")]:{minWidth:400},[e.down("sm")]:{minWidth:"80vw"}}),children:n})})});function g_({name:t,label:n}){const{control:i}=Ie(),s=r.useId();return e(qe,{control:i,name:t,render:({field:t})=>e(X,{...t,id:s,label:n,slots:{field:Pt}})})}const y_=()=>{const{enqueueSnackbar:e}=f(Zp);return({variant:t,message:r})=>{e({variant:t,message:r,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:3e3,hideIconVariant:!0})}},v_=()=>{const e=y_();return t=>{const{response:r}=t;if(r){const{data:t}=r;if(t){const{detail:r}=t;r&&r.forEach(t=>{e({variant:"error",message:t})})}}}},b_=e=>{const t=(new Date).getUTCHours();return encodeURIComponent([...e].reduce((r,n,i)=>{const s=(e.charCodeAt(i)-32+t)%95+32;return r+String.fromCharCode(s)},""))},x_=e=>Object.keys(e).reduce((t,r,n)=>`${t}${0===n?"":"&"}${r}=${e[r]}`,""),w_=()=>op({mutationKey:["sign-in-mutation"],mutationFn:async({body:{username:e,password:t}})=>{const r=x_({username:e,password:b_(t)});return await lh.instance.apiService.post({url:"token",body:r,config:{headers:{"Content-Type":"application/x-www-form-urlencoded"}}})}}),A_=()=>op({mutationKey:["logout-mutation"],mutationFn:async e=>await lh.instance.apiService.post({url:"logout"}),onError:v_(),onSuccess:()=>{ap.invalidateQueries({queryKey:["user"]})}}),E_=()=>sp({queryKey:["user"],queryFn:async()=>await lh.instance.apiService.get({url:"user/",config:{baseURL:"http://89.108.118.23:2292"}}),staleTime:3e5},Uf),T_=(e,t,r)=>{if(e&&"reportValidity"in e){const n=_e(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},S_=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?T_(n.ref,r,e):n&&n.refs&&n.refs.forEach(t=>T_(t,r,e))}},k_=(e,t)=>{t.shouldUseNativeValidation&&S_(e,t);const r={};for(const n in e){const i=_e(t.fields,n),s=Object.assign(e[n]||{},{ref:i&&i.ref});if(O_(t.names||Object.keys(e),n)){const e=Object.assign({},_e(r,n));ve(e,"root",s),ve(r,n,e)}else ve(r,n,s)}return r},O_=(e,t)=>{const r=R_(t);return e.some(e=>R_(e).match(`^${r}\\.\\d+`))};function R_(e){return e.replace(/\]|\[/g,"")}function C_(e,t,r){return void 0===r&&(r={}),function(n,i,s){try{return Promise.resolve(function(o,a){try{var l=(null!=t&&t.context&&"development"===process.env.NODE_ENV&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(e["sync"===r.mode?"validateSync":"validate"](n,Object.assign({abortEarly:!1},t,{context:i}))).then(function(e){return s.shouldUseNativeValidation&&S_({},s),{values:r.raw?Object.assign({},n):e,errors:{}}}))}catch(e){return a(e)}return l&&l.then?l.then(void 0,a):l}(0,function(e){if(!e.inner)throw e;return{values:{},errors:k_((t=e,r=!s.shouldUseNativeValidation&&"all"===s.criteriaMode,(t.inner||[]).reduce(function(e,t){if(e[t.path]||(e[t.path]={message:t.message,type:t.type}),r){var n=e[t.path].types,i=n&&n[t.type];e[t.path]=We(t.path,r,e,t.type,i?[].concat(i,t.message):t.message)}return e},{})),s)};var t,r}))}catch(e){return Promise.reject(e)}}}const N_=({children:t})=>e(x,{sx:{display:"flex",alignItems:"center",height:"100vh",width:"100vw",overflow:"hidden"},children:e(x,{sx:{margin:"auto",maxWidth:"400px",width:"100%"},children:e(Ed,{children:t})})});var P_,M_;var D_,z_,I_=function(){if(M_)return P_;function e(e){this._maxSize=e,this.clear()}M_=1,e.prototype.clear=function(){this._size=0,this._values=Object.create(null)},e.prototype.get=function(e){return this._values[e]},e.prototype.set=function(e,t){return this._size>=this._maxSize&&this.clear(),e in this._values||this._size++,this._values[e]=t};var t=/[^.^\]^[]+|(?=\[\]|\.\.)/g,r=/^\d+$/,n=/^\d/,i=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,s=/^\s*(['"]?)(.*?)(\1)\s*$/,o=new e(512),a=new e(512),l=new e(512);function u(e){return o.get(e)||o.set(e,c(e).map(function(e){return e.replace(s,"$2")}))}function c(e){return e.match(t)||[""]}function h(e){return"string"==typeof e&&e&&-1!==["'",'"'].indexOf(e.charAt(0))}function d(e){return!h(e)&&(function(e){return e.match(n)&&!e.match(r)}(e)||function(e){return i.test(e)}(e))}return P_={Cache:e,split:c,normalizePath:u,setter:function(e){var t=u(e);return a.get(e)||a.set(e,function(e,r){for(var n=0,i=t.length,s=e;n<i-1;){var o=t[n];if("__proto__"===o||"constructor"===o||"prototype"===o)return e;s=s[t[n++]]}s[t[n]]=r})},getter:function(e,t){var r=u(e);return l.get(e)||l.set(e,function(e){for(var n=0,i=r.length;n<i;){if(null==e&&t)return;e=e[r[n++]]}return e})},join:function(e){return e.reduce(function(e,t){return e+(h(t)||r.test(t)?"["+t+"]":(e?".":"")+t)},"")},forEach:function(e,t,r){!function(e,t,r){var n,i,s,o,a=e.length;for(i=0;i<a;i++)(n=e[i])&&(d(n)&&(n='"'+n+'"'),s=!(o=h(n))&&/^\d+$/.test(n),t.call(r,n,o,s,i,e))}(Array.isArray(e)?e:c(e),t,r)}},P_}();var F_,L_=function(){if(z_)return D_;z_=1;const e=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,t=t=>t.match(e)||[],r=e=>e[0].toUpperCase()+e.slice(1),n=(e,r)=>t(e).join(r).toLowerCase(),i=e=>t(e).reduce((e,t)=>`${e}${e?t[0].toUpperCase()+t.slice(1).toLowerCase():t.toLowerCase()}`,"");return D_={words:t,upperFirst:r,camelCase:i,pascalCase:e=>r(i(e)),snakeCase:e=>n(e,"_"),kebabCase:e=>n(e,"-"),sentenceCase:e=>r(n(e," ")),titleCase:e=>t(e).map(r).join(" ")}}(),j_={exports:{}};var U_=function(){if(F_)return j_.exports;function e(e,t){var r=e.length,n=new Array(r),i={},s=r,o=function(e){for(var t=new Map,r=0,n=e.length;r<n;r++){var i=e[r];t.has(i[0])||t.set(i[0],new Set),t.has(i[1])||t.set(i[1],new Set),t.get(i[0]).add(i[1])}return t}(t),a=function(e){for(var t=new Map,r=0,n=e.length;r<n;r++)t.set(e[r],r);return t}(e);for(t.forEach(function(e){if(!a.has(e[0])||!a.has(e[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});s--;)i[s]||l(e[s],s,new Set);return n;function l(e,t,s){if(s.has(e)){var u;try{u=", node was:"+JSON.stringify(e)}catch(e){u=""}throw new Error("Cyclic dependency"+u)}if(!a.has(e))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(e));if(!i[t]){i[t]=!0;var c=o.get(e)||new Set;if(t=(c=Array.from(c)).length){s.add(e);do{var h=c[--t];l(h,a.get(h),s)}while(t);s.delete(e)}n[--r]=e}}}return F_=1,j_.exports=function(t){return e(function(e){for(var t=new Set,r=0,n=e.length;r<n;r++){var i=e[r];t.add(i[0]),t.add(i[1])}return Array.from(t)}(t),t)},j_.exports.array=e,j_.exports}(),B_=si(U_);const V_=Object.prototype.toString,G_=Error.prototype.toString,$_=RegExp.prototype.toString,q_="undefined"!=typeof Symbol?Symbol.prototype.toString:()=>"",W_=/^Symbol\((.*)\)(.*)$/;function H_(e,t=!1){if(null==e||!0===e||!1===e)return""+e;const r=typeof e;if("number"===r)return function(e){return e!=+e?"NaN":0===e&&1/e<0?"-0":""+e}(e);if("string"===r)return t?`"${e}"`:e;if("function"===r)return"[Function "+(e.name||"anonymous")+"]";if("symbol"===r)return q_.call(e).replace(W_,"Symbol($1)");const n=V_.call(e).slice(8,-1);return"Date"===n?isNaN(e.getTime())?""+e:e.toISOString(e):"Error"===n||e instanceof Error?"["+G_.call(e)+"]":"RegExp"===n?$_.call(e):null}function Z_(e,t){let r=H_(e,t);return null!==r?r:JSON.stringify(e,function(e,r){let n=H_(this[e],t);return null!==n?n:r},2)}function K_(e){return null==e?[]:[].concat(e)}let X_,Y_,Q_,J_=/\$\{\s*(\w+)\s*\}/g;X_=Symbol.toStringTag;class eg{constructor(e,t,r,n){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[X_]="Error",this.name="ValidationError",this.value=t,this.path=r,this.type=n,this.errors=[],this.inner=[],K_(e).forEach(e=>{if(tg.isError(e)){this.errors.push(...e.errors);const t=e.inner.length?e.inner:[e];this.inner.push(...t)}else this.errors.push(e)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}Y_=Symbol.hasInstance,Q_=Symbol.toStringTag;class tg extends Error{static formatError(e,t){const r=t.label||t.path||"this";return t=Object.assign({},t,{path:r,originalPath:t.path}),"string"==typeof e?e.replace(J_,(e,r)=>Z_(t[r])):"function"==typeof e?e(t):e}static isError(e){return e&&"ValidationError"===e.name}constructor(e,t,r,n,i){const s=new eg(e,t,r,n);if(i)return s;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[Q_]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,tg)}static[Y_](e){return eg[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let rg={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:r,originalValue:n})=>{const i=null!=n&&n!==r?` (cast from the value \`${Z_(n,!0)}\`).`:".";return"mixed"!==t?`${e} must be a \`${t}\` type, but the final value was: \`${Z_(r,!0)}\``+i:`${e} must match the configured type. The validated value was: \`${Z_(r,!0)}\``+i}},ng={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},ig={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},sg={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},og={notType:e=>{const{path:t,value:r,spec:n}=e,i=n.types.length;if(Array.isArray(r)){if(r.length<i)return`${t} tuple value has too few items, expected a length of ${i} but got ${r.length} for value: \`${Z_(r,!0)}\``;if(r.length>i)return`${t} tuple value has too many items, expected a length of ${i} but got ${r.length} for value: \`${Z_(r,!0)}\``}return tg.formatError(rg.notType,e)}};Object.assign(Object.create(null),{mixed:rg,string:ng,number:{min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},date:ig,object:sg,array:{min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},boolean:{isValue:"${path} field must be ${value}"},tuple:og});const ag=e=>e&&e.__isYupSchema__;class lg{static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:n,otherwise:i}=t,s="function"==typeof r?r:(...e)=>e.every(e=>e===r);return new lg(e,(e,t)=>{var r;let o=s(...e)?n:i;return null!=(r=null==o?void 0:o(t))?r:t})}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let r=this.refs.map(e=>e.getValue(null==t?void 0:t.value,null==t?void 0:t.parent,null==t?void 0:t.context)),n=this.fn(r,e,t);if(void 0===n||n===e)return e;if(!ag(n))throw new TypeError("conditions must return a schema object");return n.resolve(t)}}const ug="$",cg=".";class hg{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,"string"!=typeof e)throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),""===e)throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===ug,this.isValue=this.key[0]===cg,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?ug:this.isValue?cg:"";this.path=this.key.slice(r.length),this.getter=this.path&&I_.getter(this.path,!0),this.map=t.map}getValue(e,t,r){let n=this.isContext?r:this.isValue?e:t;return this.getter&&(n=this.getter(n||{})),this.map&&(n=this.map(n)),n}cast(e,t){return this.getValue(e,null==t?void 0:t.parent,null==t?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}hg.prototype.__isYupRef=!0;const dg=e=>null==e;function fg(e){function t({value:t,path:r="",options:n,originalValue:i,schema:s},o,a){const{name:l,test:u,params:c,message:h,skipAbsent:d}=e;let{parent:f,context:p,abortEarly:m=s.spec.abortEarly,disableStackTrace:_=s.spec.disableStackTrace}=n;const g={value:t,parent:f,context:p};function y(e={}){const n=pg(Object.assign({value:t,originalValue:i,label:s.spec.label,path:e.path||r,spec:s.spec,disableStackTrace:e.disableStackTrace||_},c,e.params),g),o=new tg(tg.formatError(e.message||h,n),t,n.path,e.type||l,n.disableStackTrace);return o.params=n,o}const v=m?o:a;let b={path:r,parent:f,type:l,from:n.from,createError:y,resolve:e=>mg(e,g),options:n,originalValue:i,schema:s};const x=e=>{tg.isError(e)?v(e):e?a(null):v(y())},w=e=>{tg.isError(e)?v(e):o(e)};if(d&&dg(t))return x(!0);let A;try{var E;if(A=u.call(b,t,b),"function"==typeof(null==(E=A)?void 0:E.then)){if(n.sync)throw new Error(`Validation test of type: "${b.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(A).then(x,w)}}catch(e){return void w(e)}x(A)}return t.OPTIONS=e,t}function pg(e,t){if(!e)return e;for(const r of Object.keys(e))e[r]=mg(e[r],t);return e}function mg(e,t){return hg.isRef(e)?e.getValue(t.value,t.parent,t.context):e}function _g(e,t,r,n=r){let i,s,o;return t?(I_.forEach(t,(a,l,u)=>{let c=l?a.slice(1,a.length-1):a,h="tuple"===(e=e.resolve({context:n,parent:i,value:r})).type,d=u?parseInt(c,10):0;if(e.innerType||h){if(h&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${o}" must contain an index to the tuple element, e.g. "${o}[0]"`);if(r&&d>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${t}. because there is no value at that index. `);i=r,r=r&&r[d],e=h?e.spec.types[d]:e.innerType}if(!u){if(!e.fields||!e.fields[c])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${o} which is a type: "${e.type}")`);i=r,r=r&&r[c],e=e.fields[c]}s=c,o=l?"["+a+"]":"."+a}),{schema:e,parent:i,parentPath:s}):{parent:i,parentPath:t,schema:e}}class gg extends Set{describe(){const e=[];for(const t of this.values())e.push(hg.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const r of this.values())t.push(e(r));return t}clone(){return new gg(this.values())}merge(e,t){const r=this.clone();return e.forEach(e=>r.add(e)),t.forEach(e=>r.delete(e)),r}}function yg(e,t=new Map){if(ag(e)||!e||"object"!=typeof e)return e;if(t.has(e))return t.get(e);let r;if(e instanceof Date)r=new Date(e.getTime()),t.set(e,r);else if(e instanceof RegExp)r=new RegExp(e),t.set(e,r);else if(Array.isArray(e)){r=new Array(e.length),t.set(e,r);for(let n=0;n<e.length;n++)r[n]=yg(e[n],t)}else if(e instanceof Map){r=new Map,t.set(e,r);for(const[n,i]of e.entries())r.set(n,yg(i,t))}else if(e instanceof Set){r=new Set,t.set(e,r);for(const n of e)r.add(yg(n,t))}else{if(!(e instanceof Object))throw Error(`Unable to clone ${e}`);r={},t.set(e,r);for(const[n,i]of Object.entries(e))r[n]=yg(i,t)}return r}function vg(e){if(null==e||!e.length)return;const t=[];let r="",n=!1,i=!1;for(let s=0;s<e.length;s++){const o=e[s];"["!==o||i?"]"!==o||i?'"'!==o?"."!==o||n||i?r+=o:r&&(t.push(r),r=""):i=!i:(r&&(/^\d+$/.test(r)?t.push(r):t.push(r.replace(/^"|"$/g,"")),r=""),n=!1):(r&&(t.push(...r.split(".").filter(Boolean)),r=""),n=!0)}return r&&t.push(...r.split(".").filter(Boolean)),t}function bg(e,t){var r;if((null==(r=e.inner)||!r.length)&&e.errors.length)return function(e,t){const r=t?`${t}.${e.path}`:e.path;return e.errors.map(e=>({message:e,path:vg(r)}))}(e,t);const n=t?`${t}.${e.path}`:e.path;return e.inner.flatMap(e=>bg(e,n))}class xg{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new gg,this._blacklist=new gg,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(rg.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},null==e?void 0:e.spec),this.withMutation(e=>{e.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=yg(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(0===e.length)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=t,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&"mixed"!==this.type)throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,r=e.clone();const n=Object.assign({},t.spec,r.spec);return r.spec=n,r.internalTests=Object.assign({},t.internalTests,r.internalTests),r._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),r.tests=t.tests,r.exclusiveTests=t.exclusiveTests,r.withMutation(t=>{e.tests.forEach(e=>{t.test(e.OPTIONS)})}),r.transforms=[...t.transforms,...r.transforms],r}isType(e){return null==e?!(!this.spec.nullable||null!==e)||!(!this.spec.optional||void 0!==e):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let r=t.conditions;t=t.clone(),t.conditions=[],t=r.reduce((t,r)=>r.resolve(t,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,r,n,i;return Object.assign({},e,{from:e.from||[],strict:null!=(t=e.strict)?t:this.spec.strict,abortEarly:null!=(r=e.abortEarly)?r:this.spec.abortEarly,recursive:null!=(n=e.recursive)?n:this.spec.recursive,disableStackTrace:null!=(i=e.disableStackTrace)?i:this.spec.disableStackTrace})}cast(e,t={}){let r=this.resolve(Object.assign({},t,{value:e})),n="ignore-optionality"===t.assert,i=r._cast(e,t);if(!1!==t.assert&&!r.isType(i)){if(n&&dg(i))return i;let s=Z_(e),o=Z_(i);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}". \n\nattempted value: ${s} \n`+(o!==s?`result of cast: ${o}`:""))}return i}_cast(e,t){let r=void 0===e?e:this.transforms.reduce((r,n)=>n.call(this,r,e,this,t),e);return void 0===r&&(r=this.getDefault(t)),r}_validate(e,t={},r,n){let{path:i,originalValue:s=e,strict:o=this.spec.strict}=t,a=e;o||(a=this._cast(a,Object.assign({assert:!1},t)));let l=[];for(let e of Object.values(this.internalTests))e&&l.push(e);this.runTests({path:i,value:a,originalValue:s,options:t,tests:l},r,e=>{if(e.length)return n(e,a);this.runTests({path:i,value:a,originalValue:s,options:t,tests:this.tests},r,n)})}runTests(e,t,r){let n=!1,{tests:i,value:s,originalValue:o,path:a,options:l}=e,u=e=>{n||(n=!0,t(e,s))},c=e=>{n||(n=!0,r(e,s))},h=i.length,d=[];if(!h)return c([]);let f={value:s,originalValue:o,path:a,options:l,schema:this};for(let e=0;e<i.length;e++){(0,i[e])(f,u,function(e){e&&(Array.isArray(e)?d.push(...e):d.push(e)),--h<=0&&c(d)})}}asNestedTest({key:e,index:t,parent:r,parentPath:n,originalParent:i,options:s}){const o=null!=e?e:t;if(null==o)throw TypeError("Must include `key` or `index` for nested validations");const a="number"==typeof o;let l=r[o];const u=Object.assign({},s,{strict:!0,parent:r,value:l,originalValue:i[o],key:void 0,[a?"index":"key"]:o,path:a||o.includes(".")?`${n||""}[${a?o:`"${o}"`}]`:(n?`${n}.`:"")+e});return(e,t,r)=>this.resolve(u)._validate(l,u,t,r)}validate(e,t){var r;let n=this.resolve(Object.assign({},t,{value:e})),i=null!=(r=null==t?void 0:t.disableStackTrace)?r:n.spec.disableStackTrace;return new Promise((r,s)=>n._validate(e,t,(e,t)=>{tg.isError(e)&&(e.value=t),s(e)},(e,t)=>{e.length?s(new tg(e,t,void 0,void 0,i)):r(t)}))}validateSync(e,t){var r;let n,i=this.resolve(Object.assign({},t,{value:e})),s=null!=(r=null==t?void 0:t.disableStackTrace)?r:i.spec.disableStackTrace;return i._validate(e,Object.assign({},t,{sync:!0}),(e,t)=>{throw tg.isError(e)&&(e.value=t),e},(t,r)=>{if(t.length)throw new tg(t,e,void 0,void 0,s);n=r}),n}isValid(e,t){return this.validate(e,t).then(()=>!0,e=>{if(tg.isError(e))return!1;throw e})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(e){if(tg.isError(e))return!1;throw e}}_getDefault(e){let t=this.spec.default;return null==t?t:"function"==typeof t?t.call(this,e):yg(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){if(0===arguments.length)return this._getDefault();return this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const r=this.clone({nullable:e});return r.internalTests.nullable=fg({message:t,name:"nullable",test(e){return null!==e||this.schema.spec.nullable}}),r}optionality(e,t){const r=this.clone({optional:e});return r.internalTests.optionality=fg({message:t,name:"optionality",test(e){return void 0!==e||this.schema.spec.optional}}),r}optional(){return this.optionality(!0)}defined(e=rg.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=rg.notNull){return this.nullability(!1,e)}required(e=rg.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(t=1===e.length?"function"==typeof e[0]?{test:e[0]}:e[0]:2===e.length?{name:e[0],test:e[1]}:{name:e[0],message:e[1],test:e[2]},void 0===t.message&&(t.message=rg.default),"function"!=typeof t.test)throw new TypeError("`test` is a required parameters");let r=this.clone(),n=fg(t),i=t.exclusive||t.name&&!0===r.exclusiveTests[t.name];if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(r.exclusiveTests[t.name]=!!t.exclusive),r.tests=r.tests.filter(e=>{if(e.OPTIONS.name===t.name){if(i)return!1;if(e.OPTIONS.test===n.OPTIONS.test)return!1}return!0}),r.tests.push(n),r}when(e,t){Array.isArray(e)||"string"==typeof e||(t=e,e=".");let r=this.clone(),n=K_(e).map(e=>new hg(e));return n.forEach(e=>{e.isSibling&&r.deps.push(e.key)}),r.conditions.push("function"==typeof t?new lg(n,t):lg.fromOptions(n,t)),r}typeError(e){let t=this.clone();return t.internalTests.typeError=fg({message:e,name:"typeError",skipAbsent:!0,test(e){return!!this.schema._typeCheck(e)||this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=rg.oneOf){let r=this.clone();return e.forEach(e=>{r._whitelist.add(e),r._blacklist.delete(e)}),r.internalTests.whiteList=fg({message:t,name:"oneOf",skipAbsent:!0,test(e){let t=this.schema._whitelist,r=t.resolveAll(this.resolve);return!!r.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:r}})}}),r}notOneOf(e,t=rg.notOneOf){let r=this.clone();return e.forEach(e=>{r._blacklist.add(e),r._whitelist.delete(e)}),r.internalTests.blacklist=fg({message:t,name:"notOneOf",test(e){let t=this.schema._blacklist,r=t.resolveAll(this.resolve);return!r.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:r}})}}),r}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:r,meta:n,optional:i,nullable:s}=t.spec,o={meta:n,label:r,optional:i,nullable:s,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.filter((e,t,r)=>r.findIndex(t=>t.OPTIONS.name===e.OPTIONS.name)===t).map(t=>{const r=t.OPTIONS.params&&e?pg(Object.assign({},t.OPTIONS.params),e):t.OPTIONS.params;return{name:t.OPTIONS.name,params:r}})};return o}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(t){try{return{value:await e.validate(t,{abortEarly:!1})}}catch(e){if(e instanceof tg)return{issues:bg(e)};throw e}}}}}xg.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])xg.prototype[`${e}At`]=function(t,r,n={}){const{parent:i,parentPath:s,schema:o}=_g(this,t,r,n.context);return o[e](i&&i[s],Object.assign({},n,{parent:i,path:t}))};for(const e of["equals","is"])xg.prototype[e]=xg.prototype.oneOf;for(const e of["not","nope"])xg.prototype[e]=xg.prototype.notOneOf;const wg=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Ag(e){var t,r;const n=wg.exec(e);return n?{year:Eg(n[1]),month:Eg(n[2],1)-1,day:Eg(n[3],1),hour:Eg(n[4]),minute:Eg(n[5]),second:Eg(n[6]),millisecond:n[7]?Eg(n[7].substring(0,3)):0,precision:null!=(t=null==(r=n[7])?void 0:r.length)?t:void 0,z:n[8]||void 0,plusMinus:n[9]||void 0,hourOffset:Eg(n[10]),minuteOffset:Eg(n[11])}:null}function Eg(e,t=0){return Number(e)||t}let Tg=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Sg=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,kg=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Og=new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"),Rg=e=>dg(e)||e===e.trim(),Cg={}.toString();function Ng(){return new Pg}class Pg extends xg{constructor(){super({type:"string",check:e=>(e instanceof String&&(e=e.valueOf()),"string"==typeof e)}),this.withMutation(()=>{this.transform((e,t)=>{if(!this.spec.coerce||this.isType(e))return e;if(Array.isArray(e))return e;const r=null!=e&&e.toString?e.toString():e;return r===Cg?e:r})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||rg.required,name:"required",skipAbsent:!0,test:e=>!!e.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(e=>"required"!==e.OPTIONS.name),e))}length(e,t=ng.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(t){return t.length===this.resolve(e)}})}min(e,t=ng.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t.length>=this.resolve(e)}})}max(e,t=ng.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(t){return t.length<=this.resolve(e)}})}matches(e,t){let r,n,i=!1;return t&&("object"==typeof t?({excludeEmptyString:i=!1,message:r,name:n}=t):r=t),this.test({name:n||"matches",message:r||ng.matches,params:{regex:e},skipAbsent:!0,test:t=>""===t&&i||-1!==t.search(e)})}email(e=ng.email){return this.matches(Tg,{name:"email",message:e,excludeEmptyString:!0})}url(e=ng.url){return this.matches(Sg,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=ng.uuid){return this.matches(kg,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t,r,n="";return e&&("object"==typeof e?({message:n="",allowOffset:t=!1,precision:r}=e):n=e),this.matches(Og,{name:"datetime",message:n||ng.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||ng.datetime_offset,params:{allowOffset:t},skipAbsent:!0,test:e=>{if(!e||t)return!0;const r=Ag(e);return!!r&&!!r.z}}).test({name:"datetime_precision",message:n||ng.datetime_precision,params:{precision:r},skipAbsent:!0,test:e=>{if(!e||null==r)return!0;const t=Ag(e);return!!t&&t.precision===r}})}ensure(){return this.default("").transform(e=>null===e?"":e)}trim(e=ng.trim){return this.transform(e=>null!=e?e.trim():e).test({message:e,name:"trim",test:Rg})}lowercase(e=ng.lowercase){return this.transform(e=>dg(e)?e:e.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>dg(e)||e===e.toLowerCase()})}uppercase(e=ng.uppercase){return this.transform(e=>dg(e)?e:e.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>dg(e)||e===e.toUpperCase()})}}Ng.prototype=Pg.prototype;let Mg=new Date("");class Dg extends xg{constructor(){super({type:"date",check(e){return t=e,"[object Date]"===Object.prototype.toString.call(t)&&!isNaN(e.getTime());var t}}),this.withMutation(()=>{this.transform((e,t)=>!this.spec.coerce||this.isType(e)||null===e?e:(e=function(e){const t=Ag(e);if(!t)return Date.parse?Date.parse(e):Number.NaN;if(void 0===t.z&&void 0===t.plusMinus)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let r=0;return"Z"!==t.z&&void 0!==t.plusMinus&&(r=60*t.hourOffset+t.minuteOffset,"+"===t.plusMinus&&(r=0-r)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+r,t.second,t.millisecond)}(e),isNaN(e)?Dg.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let r;if(hg.isRef(e))r=e;else{let n=this.cast(e);if(!this._typeCheck(n))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);r=n}return r}min(e,t=ig.min){let r=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(e){return e>=this.resolve(r)}})}max(e,t=ig.max){let r=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(e){return e<=this.resolve(r)}})}}function zg(e,t){let r=1/0;return e.some((e,n)=>{var i;if(null!=(i=t.path)&&i.includes(e))return r=n,!0}),r}function Ig(e){return(t,r)=>zg(e,t)-zg(e,r)}Dg.INVALID_DATE=Mg;const Fg=(e,t,r)=>{if("string"!=typeof e)return e;let n=e;try{n=JSON.parse(e)}catch(e){}return r.isType(n)?n:e};function Lg(e){if("fields"in e){const t={};for(const[r,n]of Object.entries(e.fields))t[r]=Lg(n);return e.setFields(t)}if("array"===e.type){const t=e.optional();return t.innerType&&(t.innerType=Lg(t.innerType)),t}return"tuple"===e.type?e.optional().clone({types:e.spec.types.map(Lg)}):"optional"in e?e.optional():e}let jg=e=>"[object Object]"===Object.prototype.toString.call(e);function Ug(e,t){let r=Object.keys(e.fields);return Object.keys(t).filter(e=>-1===r.indexOf(e))}const Bg=Ig([]);function Vg(e){return new Gg(e)}class Gg extends xg{constructor(e){super({type:"object",check:e=>jg(e)||"function"==typeof e}),this.fields=Object.create(null),this._sortErrors=Bg,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var r;let n=super._cast(e,t);if(void 0===n)return this.getDefault(t);if(!this._typeCheck(n))return n;let i=this.fields,s=null!=(r=t.stripUnknown)?r:this.spec.noUnknown,o=[].concat(this._nodes,Object.keys(n).filter(e=>!this._nodes.includes(e))),a={},l=Object.assign({},t,{parent:a,__validating:t.__validating||!1}),u=!1;for(const e of o){let r=i[e],o=e in n,c=n[e];if(r){let i;l.path=(t.path?`${t.path}.`:"")+e,r=r.resolve({value:c,context:t.context,parent:a});let s=r instanceof xg?r.spec:void 0,o=null==s?void 0:s.strict;if(null!=s&&s.strip){u=u||e in n;continue}i=t.__validating&&o?c:r.cast(c,l),void 0!==i&&(a[e]=i)}else o&&!s&&(a[e]=c);o===e in a&&a[e]===c||(u=!0)}return u?a:n}_validate(e,t={},r,n){let{from:i=[],originalValue:s=e,recursive:o=this.spec.recursive}=t;t.from=[{schema:this,value:s},...i],t.__validating=!0,t.originalValue=s,super._validate(e,t,r,(e,i)=>{if(!o||!jg(i))return void n(e,i);s=s||i;let a=[];for(let e of this._nodes){let r=this.fields[e];r&&!hg.isRef(r)&&a.push(r.asNestedTest({options:t,key:e,parent:i,parentPath:t.path,originalParent:s}))}this.runTests({tests:a,value:i,originalValue:s,options:t},r,t=>{n(t.sort(this._sortErrors).concat(e),i)})})}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),r=t.fields;for(let[e,t]of Object.entries(this.fields)){const n=r[e];r[e]=void 0===n?t:n}return t.withMutation(t=>t.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach(r=>{var n;const i=this.fields[r];let s=e;null!=(n=s)&&n.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[r]})),t[r]=i&&"getDefault"in i?i.getDefault(s):void 0}),t}setFields(e,t){let r=this.clone();return r.fields=e,r._nodes=function(e,t=[]){let r=[],n=new Set,i=new Set(t.map(([e,t])=>`${e}-${t}`));function s(e,t){let s=I_.split(e)[0];n.add(s),i.has(`${t}-${s}`)||r.push([t,s])}for(const t of Object.keys(e)){let r=e[t];n.add(t),hg.isRef(r)&&r.isSibling?s(r.path,t):ag(r)&&"deps"in r&&r.deps.forEach(e=>s(e,t))}return B_.array(Array.from(n),r).reverse()}(e,t),r._sortErrors=Ig(Object.keys(e)),t&&(r._excludedEdges=t),r}shape(e,t=[]){return this.clone().withMutation(r=>{let n=r._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),n=[...r._excludedEdges,...t]),r.setFields(Object.assign(r.fields,e),n)})}partial(){const e={};for(const[t,r]of Object.entries(this.fields))e[t]="optional"in r&&r.optional instanceof Function?r.optional():r;return this.setFields(e)}deepPartial(){return Lg(this)}pick(e){const t={};for(const r of e)this.fields[r]&&(t[r]=this.fields[r]);return this.setFields(t,this._excludedEdges.filter(([t,r])=>e.includes(t)&&e.includes(r)))}omit(e){const t=[];for(const r of Object.keys(this.fields))e.includes(r)||t.push(r);return this.pick(t)}from(e,t,r){let n=I_.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return((e,t)=>{const r=[...I_.normalizePath(t)];if(1===r.length)return r[0]in e;let n=r.pop(),i=I_.getter(I_.join(r),!0)(e);return!(!i||!(n in i))})(i,e)&&(s=Object.assign({},i),r||delete s[e],s[t]=n(i)),s})}json(){return this.transform(Fg)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||sg.exact,test(e){if(null==e)return!0;const t=Ug(this.schema,e);return 0===t.length||this.createError({params:{properties:t.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=sg.noUnknown){"boolean"!=typeof e&&(t=e,e=!0);let r=this.test({name:"noUnknown",exclusive:!0,message:t,test(t){if(null==t)return!0;const r=Ug(this.schema,t);return!e||0===r.length||this.createError({params:{unknown:r.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,t=sg.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;const r={};for(const n of Object.keys(t))r[e(n)]=t[n];return r})}camelCase(){return this.transformKeys(L_.camelCase)}snakeCase(){return this.transformKeys(L_.snakeCase)}constantCase(){return this.transformKeys(e=>L_.snakeCase(e).toUpperCase())}describe(e){const t=(e?this.resolve(e):this).clone(),r=super.describe(e);r.fields={};for(const[i,s]of Object.entries(t.fields)){var n;let t=e;null!=(n=t)&&n.value&&(t=Object.assign({},t,{parent:t.value,value:t.value[i]})),r.fields[i]=s.describe(t)}return r}}Vg.prototype=Gg.prototype;const $g=Vg().shape({username:Ng().required(),password:Ng().required()}),qg=({onSuccessSignIn:i})=>{const s=A_(),o=w_(),a=y_(),l=function(e={}){const t=n.useRef(void 0),r=n.useRef(void 0),[i,s]=n.useState({isDirty:!1,isValidating:!1,isLoading:ye(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:ye(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:i},e.defaultValues&&!ye(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:r,...n}=St(e);t.current={...n,formState:i}}const o=t.current.control;return o._options=e,je(()=>{const e=o._subscribe({formState:o._proxyFormState,callback:()=>s({...o._formState}),reRenderRoot:!0});return s(e=>({...e,isReady:!0})),o._formState.isReady=!0,e},[o]),n.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),n.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),n.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),n.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),n.useEffect(()=>{if(o._proxyFormState.isDirty){const e=o._getDirty();e!==i.isDirty&&o._subjects.state.next({isDirty:e})}},[o,i.isDirty]),n.useEffect(()=>{var t;e.values&&!Ge(e.values,r.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),(null===(t=o._options.resetOptions)||void 0===t?void 0:t.keepIsValid)||o._setValid(),r.current=e.values,s(e=>({...e}))):o._resetDefaultValues()},[o,e.values]),n.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=Le(i,o),t.current}({defaultValues:{username:"",password:""},resolver:C_($g)}),{register:u,formState:{isValid:c}}=l;return r.useEffect(()=>{s.mutate()},[]),r.useEffect(()=>{if(o.error){const{response:e}=o.error;if(e){const{data:{detail:t}}=e;a({message:t,variant:"error"})}}},[o.error]),r.useEffect(()=>{o.data&&i(o.data)},[o.data]),e(N_,{children:t(Ct,{form:l,onSubmit:e=>{o.mutate({body:e})},sx:{justifyContent:"center",justifyItems:"center",alignContent:"center",alignItems:"center"},children:[e(b,{variant:"h4",children:"Authorization"}),e(Dt,{...u("username"),label:"Login",placeholder:"Enter your login"}),e(Dt,{...u("password"),label:"Password",placeholder:"Enter your password",type:"password"}),e(re,{type:"submit",disabled:!c,children:"Sign in"})]})})};var Wg,Hg,Zg={};function Kg(e,t){if(Wg)if(Hg){var r="var shared_chunk = {}; ("+Wg+")(shared_chunk); ("+Hg+")(shared_chunk);",n={};Wg(n),(Zg=t(n)).workerURL=window.URL.createObjectURL(new Blob([r],{type:"text/javascript"}))}else Hg=t;else Wg=t}Kg(0,function(e){const t={};try{window instanceof Window&&window.document instanceof HTMLDocument&&(t.is_worker=!1,t.is_main=!0)}catch(e){t.is_worker=!0,t.is_main=!1,self.window={document:{}},self.document=self.window.document}function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function n(e){var t=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==r(t)?t:t+""}function i(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s,o="v0.22.0",a=s={},l=0,u={};function c(e){var t=[];"string"==typeof e&&(t=e.split("."),e=t.pop());var r=s.targets;for(let e=0;e<t.length;e++){if(!r[t[e]])return[];r=r[t[e]]}return[e,r]}function h(e,t=null,r=null,n=[]){if(!e)return n;if(Array.isArray(e))e.forEach((t,r)=>h(t,e,r,n));else if("object"==typeof e)if(e instanceof ArrayBuffer)n.push({object:e,parent:t,property:r});else if(e.buffer instanceof ArrayBuffer)n.push({object:e.buffer,parent:t,property:r});else for(let t in e)h(e[t],e,t,n);return n}function d(e){Array.isArray(e)&&e.filter(e=>e.parent&&e.property).forEach(e=>delete e.parent[e.property])}s.targets={},s.addTarget=function(e,t){s.targets[e]=t},s.removeTarget=function(e){e&&delete s.targets[e]},s.withTransferables=function(...e){if(!(this instanceof s.withTransferables))return new s.withTransferables(...e);this.value=e,this.transferables=h(this.value)},t.is_main&&(s.postMessage=function(e,t,...r){if(Array.isArray(e))return Promise.all(e.map(e=>s.postMessage(e,t,...r)));let n={};"object"==typeof t&&(n=t,t=t.method);var i=new Promise((e,n)=>{u[l]={method:t,message:r,resolve:e,reject:n}});let o,a=[];return r&&1===r.length&&r[0]instanceof s.withTransferables&&(a=r[0].transferables,r=r[0].value),o={type:"main_send",message_id:l,method:t,message:r},n.stringify&&(o=JSON.stringify(o)),e.postMessage(o,a.map(e=>e.object)),d(a),a.length>0&&_("trace",`'${t}' transferred ${a.length} objects to worker thread`),l++,i},s.addWorker=function(e){if(!(e instanceof Worker))throw Error("Worker broker could not add non-Worker object",e);e.addEventListener("message",function(t){let r="string"==typeof t.data?JSON.parse(t.data):t.data,n=r.message_id;if("worker_reply"===r.type)u[n]&&(r.error?u[n].reject(r.error):u[n].resolve(r.message),delete u[n]);else if("worker_send"===r.type&&null!=n){let t,i,o,a,l;try{if([a,o]=c(r.method),!o)throw Error(`Worker broker could not dispatch message type ${r.method} on target ${r.target} because no object with that name is registered on main thread`);if(l="function"==typeof o[a]&&o[a],!l)throw Error(`Worker broker could not dispatch message type ${r.method} on target ${r.target} because object has no method with that name`);t=l.apply(o,r.message)}catch(e){i=e}let u,h=[];t instanceof Promise?t.then(t=>{t instanceof s.withTransferables&&(h=t.transferables,t=t.value[0]),u={type:"main_reply",message_id:n,message:t},e.postMessage(u,h.map(e=>e.object)),d(h),h.length>0&&_("trace",`'${a}' transferred ${h.length} objects to worker thread`)},t=>{e.postMessage({type:"main_reply",message_id:n,error:t instanceof Error?`${t.message}: ${t.stack}`:t})}):(t instanceof s.withTransferables&&(h=t.transferables,t=t.value[0]),u={type:"main_reply",message_id:n,message:t,error:i instanceof Error?`${i.message}: ${i.stack}`:i},e.postMessage(u,h.map(e=>e.object)),d(h),h.length>0&&_("trace",`'${a}' transferred ${h.length} objects to worker thread`))}})},s.getMessages=function(){return u},s.getMessageId=function(){return l}),t.is_worker&&(s.postMessage=function(e,...t){let r={};"object"==typeof e&&(r=e,e=e.method);var n=new Promise((r,n)=>{u[l]={method:e,message:t,resolve:r,reject:n}});let i,o=[];return t&&1===t.length&&t[0]instanceof s.withTransferables&&(o=t[0].transferables,t=t[0].value),i={type:"worker_send",message_id:l,method:e,message:t},r.stringify&&(i=JSON.stringify(i)),self.postMessage(i,o.map(e=>e.object)),d(o),o.length>0&&_("trace",`'${e}' transferred ${o.length} objects to main thread`),l++,n},self.addEventListener("message",function(e){let t="string"==typeof e.data?JSON.parse(e.data):e.data,r=t.message_id;if("main_reply"===t.type)u[r]&&(t.error?u[r].reject(t.error):u[r].resolve(t.message),delete u[r]);else if("main_send"===t.type&&null!=r){let n,i,o,a,l;try{if([a,o]=c(t.method),!o)throw Error(`Worker broker could not dispatch message type ${t.method} on target ${t.target} because no object with that name is registered on main thread`);if(l="function"==typeof o[a]&&o[a],!l)throw Error(`Worker broker could not dispatch message type ${t.method} because worker has no method with that name`);n=l.apply(o,t.message)}catch(e){i=e}let u,h=[];n instanceof Promise?n.then(e=>{e instanceof s.withTransferables&&(h=e.transferables,e=e.value[0]),u={type:"worker_reply",message_id:r,message:e},self.postMessage(u,h.map(e=>e.object)),d(h),h.length>0&&_("trace",`'${a}' transferred ${h.length} objects to main thread`)},e=>{self.postMessage({type:"worker_reply",message_id:r,error:e instanceof Error?`${e.message}: ${e.stack}`:e})}):(n instanceof s.withTransferables&&(h=n.transferables,n=n.value[0]),u={type:"worker_reply",message_id:r,message:n,error:i instanceof Error?`${i.message}: ${i.stack}`:i},self.postMessage(u,h.map(e=>e.object)),d(h),h.length>0&&_("trace",`'${a}' transferred ${h.length} objects to main thread`))}}));const f={silent:-1,error:0,warn:1,info:2,debug:3,trace:4},p={};let m={};function _(e,...r){let n="object"==typeof e?e.level:e;if(f[n]<=f[_.level]){if(t.is_worker)return a.postMessage({method:"_logProxy",stringify:!0},e,...r);{if("object"==typeof e&&!0===e.once){if(m[JSON.stringify(r)])return Promise.resolve(!1);m[JSON.stringify(r)]=!0}let i=function(e){if(t.is_main)return p[e]=p[e]||(console[e]?console[e]:console.log).bind(console),p[e]}(n);r.length>1?i(`Tangram ${o} [${n}]: ${r[0]}`,...r.slice(1)):i(`Tangram ${o} [${n}]: ${r[0]}`)}return Promise.resolve(!0)}return Promise.resolve(!1)}_.level="info",_.workers=null,_.setLevel=function(e){_.level=e,t.is_main&&Array.isArray(_.workers)&&a.postMessage(_.workers,"_logSetLevelProxy",e)},t.is_main&&(_.setWorkers=function(e){_.workers=e},_.reset=function(){m={}}),a.addTarget("_logProxy",_),a.addTarget("_logSetLevelProxy",_.setLevel);const g={};let y;a.addTarget("Utils",g),g.isSafari=function(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)},g.isMicrosoft=function(){return/(Trident\/7.0|Edge[ /](\d+[.\d]+))/i.test(navigator.userAgent)},g._requests={},g._proxy_requests={},g.io=function(e,r=6e4,n="text",i="GET",s={},o=null,l=!1){if(t.is_worker&&g.isMicrosoft())return _("debug","Proxying request for URL to worker",e),o&&(g._proxy_requests[o]=!0),a.postMessage("Utils.io",e,r,n,i,s,o,!0);var u=new XMLHttpRequest,c=new Promise((t,o)=>{if(u.open(i,e,!0),u.timeout=r,u.responseType=n,s&&"object"==typeof s)for(let e in s)u.setRequestHeader(e,s[e]);u.onload=()=>{200===u.status?["text","json"].indexOf(u.responseType)>-1?t({body:u.responseText,status:u.status}):t({body:u.response,status:u.status}):204===u.status?t({body:null,status:u.status}):o(Error("Request error with a status of "+u.statusText))},u.onerror=e=>{o(Error("There was a network error"+e.toString()))},u.ontimeout=e=>{o(Error("timeout "+e.toString()))},u.send()});return c=c.then(e=>(o&&delete g._requests[o],l?a.withTransferables(e):e)),o&&(g._requests[o]=u),c},g.cancelRequest=function(e){if(t.is_worker&&g._proxy_requests[e])return a.postMessage("Utils.cancelRequest",e);g._requests[e]?(_("trace",`Cancelling network request key '${e}'`),g._requests[e].abort(),delete g._requests[e]):_("trace",`Could not find network request key '${e}'`)},g.serializeWithFunctions=function(e){return"function"==typeof e?e.toString():JSON.stringify(e,function(e,t){return"function"==typeof t?t.toString():t})},g.use_high_density_display=!0,g.updateDevicePixelRatio=function(){let e=g.device_pixel_ratio;return g.device_pixel_ratio=g.use_high_density_display&&window.devicePixelRatio||1,g.device_pixel_ratio!==e},t.is_main&&g.updateDevicePixelRatio(),g.isPowerOf2=function(e){return!(e&e-1)},g.interpolate=function(e,t,r){if(!Array.isArray(t)||!Array.isArray(t[0]))return t;if(t.length<1)return t;var n,i,s,o,a;if(e<=t[0][0])o=t[0][1],"function"==typeof r&&(o=r(o));else if(e>=t[t.length-1][0])o=t[t.length-1][1],"function"==typeof r&&(o=r(o));else for(var l=0;l<t.length-1;l++)if(e>=t[l][0]&&e<t[l+1][0]){if(n=t[l][0],i=t[l+1][0],Array.isArray(t[l][1])){o=[];for(var u=0;u<t[l][1].length;u++)"function"==typeof r?(a=r(t[l][1][u]),s=r(t[l+1][1][u])-a,o[u]=s*(e-n)/(i-n)+a):(s=t[l+1][1][u]-t[l][1][u],o[u]=s*(e-n)/(i-n)+t[l][1][u])}else"function"==typeof r?(a=r(t[l][1]),o=(s=r(t[l+1][1])-a)*(e-n)/(i-n)+a):o=(s=t[l+1][1]-t[l][1])*(e-n)/(i-n)+t[l][1];break}return o},g.toCSSColor=function(e){if(null!=e)return 1===e[3]?`rgb(${e.slice(0,3).map(e=>Math.round(255*e)).join(", ")})`:`rgba(${e.map((e,t)=>t<3&&Math.round(255*e)||e).join(", ")})`};var v=y={draw_label_collision_boxes:!1,draw_label_texture_boxes:!1,suppress_label_fade_in:!1,suppress_label_snap_animation:!1,show_hidden_labels:!1,layer_stats:!1,wireframe:!1};function b(e){if("string"==typeof e&&-1===e.search(/^(data|blob):/)){let t=e.indexOf("?");t>-1&&(e=e.substr(0,t));let r=e.indexOf("#");return r>-1&&(e=e.substr(0,r)),e.substr(0,e.lastIndexOf("/")+1)||""}return""}function x(e){if("string"==typeof e)return!(e.search(/^(http|https|data|blob):/)>-1||"//"===e.substr(0,2))}let w;function A(e,t){e=e.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var r=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===r?"":decodeURIComponent(r[1].replace(/\+/g," "))}const E={id:0,queue:[],max_time:20,start_time:null,state:{},add(e){e.id=E.id++,e.max_time=e.max_time||E.max_time,e.pause_factor=e.pause_factor||1;let t=new Promise((t,r)=>{e.resolve=t,e.reject=r});return e.promise=t,e.elapsed=0,e.total_elapsed=0,e.stats={calls:0},this.queue.push(e),this.start_time=this.start_time||performance.now(),this.elapsed=performance.now()-this.start_time,(this.elapsed<E.max_time||e.immediate)&&this.process(e),e.promise},remove(e){let t=this.queue.indexOf(e);t>-1&&this.queue.splice(t,1)},process(e){if(!this.state.user_moving_view||!1!==e.user_moving_view)return e.pause?(e.pause--,!0):(e.stats.calls++,e.start_time=performance.now(),e.run(e))},processAll(){this.start_time=this.start_time||performance.now();for(let e=0;e<this.queue.length;e++){let t=this.queue[e];if(!0!==this.process(t)&&(t.pause||(t.pause=t.elapsed>t.max_time?t.pause_factor:0),t.total_elapsed+=t.elapsed),this.elapsed=performance.now()-this.start_time,this.elapsed>=E.max_time){this.start_time=null;break}}},finish(e,t){return e.elapsed=performance.now()-e.start_time,e.total_elapsed+=e.elapsed,this.remove(e),e.resolve(t),e.promise},cancel(e){let t;e.cancel instanceof Function&&(t=e.cancel(e)),e.resolve(t)},shouldContinue(e){return e.elapsed=performance.now()-e.start_time,this.elapsed=performance.now()-this.start_time,e.elapsed<e.max_time&&this.elapsed<E.max_time},removeForTile(e){for(let t=this.queue.length-1;t>=0;t--)this.queue[t].tile_id===e&&(this.cancel(this.queue[t]),this.queue.splice(t,1))},setState(e){this.state=e}};function T(e){let t=[];return Object.assign(e,{subscribe(e){-1===t.indexOf(e)&&t.push(e)},unsubscribe(e){let r=t.indexOf(e);r>-1&&t.splice(r,1)},unsubscribeAll(){t=[]},trigger(e,...r){t.forEach(t=>{if("function"==typeof t[e])try{t[e](...r)}catch(t){_("warn",`Caught exception in listener for event '${e}':`,t)}})},hasSubscribersFor(e){let r=!1;return t.forEach(t=>{"function"==typeof t[e]&&(r=!0)}),r}})}function S(e,t){let r={};return t.forEach(t=>r[t]=e[t]),r}class k{constructor(e,t,r={}){r=k.sliceOptions(r),this.gl=e,this.texture=e.createTexture(),this.texture&&(this.valid=!0),this.bind(),this.name=t,this.retain_count=0,this.config_type=null,this.loading=null,this.loaded=!1,this.filtering=r.filtering,this.density=r.density||1,this.sprites=r.sprites,this.texcoords={},this.sizes={},this.css_sizes={},this.aspects={},this.setData(1,1,new Uint8Array([0,0,0,0]),{filtering:"nearest"}),this.loaded=!1,k.textures[this.name]&&(this.retain_count=k.textures[this.name].retain_count,k.textures[this.name].retain_count=0,k.textures[this.name].destroy()),k.textures[this.name]=this,k.texture_configs[this.name]=JSON.stringify(Object.assign({name:t},r)),this.load(r),_("trace",`creating Texture ${this.name}`)}destroy({force:e}={}){this.retain_count>0&&!e?_("error",`Texture '${this.name}': destroying texture with retain count of '${this.retain_count}'`):this.valid&&(this.gl.deleteTexture(this.texture),this.texture=null,k.textures[this.name]===this&&(delete k.textures[this.name],delete k.texture_configs[this.name]),this.valid=!1,_("trace",`destroying Texture ${this.name}`))}retain(){this.retain_count++}release(){this.retain_count<=0&&_("error",`Texture '${this.name}': releasing texture with retain count of '${this.retain_count}'`),this.retain_count--,this.retain_count<=0&&this.destroy()}bind(e=0){this.valid&&(k.activeUnit!==e&&(this.gl.activeTexture(this.gl.TEXTURE0+e),k.activeUnit=e,k.boundTexture=null),k.boundTexture!==this.texture&&(this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture),k.boundTexture=this.texture))}load(e){return e?(this.loading=null,"string"==typeof e.url?(this.config_type="url",this.setUrl(e.url,e)):e.element?(this.config_type="element",this.setElement(e.element,e)):e.data&&e.width&&e.height&&(this.config_type="data",this.setData(e.width,e.height,e.data,e)),this.loading=this.loading&&this.loading.then(()=>(this.calculateSprites(),this))||Promise.resolve(this),this.loading):this.loading||Promise.resolve(this)}setUrl(e,t={}){if(this.valid)return this.url=e,this.loading=new Promise(e=>{let r=new Image;r.onload=()=>{try{if("data:"===this.url.slice(0,5)){const e=document.createElement("canvas"),n=e.getContext("2d");e.width=r.width,e.height=r.height,n.drawImage(r,0,0),this.setElement(e,t)}else this.setElement(r,t)}catch(e){this.loaded=!1,_("warn",`Texture '${this.name}': failed to load url: '${this.url}'`,e,t),k.trigger("warning",{message:`Failed to load texture from ${this.url}`,error:e,texture:t})}this.loaded=!0,e(this)},r.onerror=r=>{this.loaded=!1,_("warn",`Texture '${this.name}': failed to load url: '${this.url}'`,r,t),k.trigger("warning",{message:`Failed to load texture from ${this.url}`,error:r,texture:t}),e(this)},g.isSafari()&&"data:"===this.url.slice(0,5)||(r.crossOrigin="anonymous"),r.src=this.url}),this.loading}setData(e,t,r,n={}){return this.width=e,this.height=t,Array.isArray(r)&&(r=new Uint8Array(r)),this.update(r,n),this.setFiltering(n),this.loaded=!0,this.loading=Promise.resolve(this),this.loading}setElement(e,t){let r=e;if("string"==typeof e&&(e=document.querySelector(e)),e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement)this.update(e,t),this.setFiltering(t);else{this.loaded=!1;let e=`the 'element' parameter (\`element: ${JSON.stringify(r)}\`) must be a CSS `;e+="selector string, or a <canvas>, <image> or <video> object",_("warn",`Texture '${this.name}': ${e}`,t),k.trigger("warning",{message:`Failed to load texture because ${e}`,texture:t})}return this.loaded=!0,this.loading=Promise.resolve(this),this.loading}update(e,t={}){this.valid&&(this.bind(),e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLImageElement&&e.complete?(this.width=e.width,this.height=e.height,this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1!==t.UNPACK_FLIP_Y_WEBGL),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.UNPACK_PREMULTIPLY_ALPHA_WEBGL||!1),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e)):(this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,null),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,null),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.width,this.height,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e)),k.trigger("update",this))}setFiltering(e={}){if(this.valid){e.filtering=e.filtering||"linear";var t=this.gl;this.bind(),g.isPowerOf2(this.width)&&g.isPowerOf2(this.height)?(this.power_of_2=!0,t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,e.TEXTURE_WRAP_S||e.repeat&&t.REPEAT||t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,e.TEXTURE_WRAP_T||e.repeat&&t.REPEAT||t.CLAMP_TO_EDGE),"mipmap"===e.filtering?(this.filtering="mipmap",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.generateMipmap(t.TEXTURE_2D)):"linear"===e.filtering?(this.filtering="linear",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):"nearest"===e.filtering&&(this.filtering="nearest",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST))):(this.power_of_2=!1,t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),"nearest"===e.filtering?(this.filtering="nearest",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)):(this.filtering="linear",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR))),k.trigger("update",this)}}calculateSprites(){if(this.sprites)for(let e in this.sprites){let t=this.sprites[e];this.texcoords[e]=k.getTexcoordsForSprite([t[0],t[1]],[t[2],t[3]],[this.width,this.height]),this.sizes[e]=[t[2],t[3]],this.css_sizes[e]=[t[2]/this.density,t[3]/this.density],this.aspects[e]=t[2]/t[3]}}byteSize(){return Math.round(this.width*this.height*4*("mipmap"==this.filtering?1.33:1))}}k.create=function(e,t,r){return new k(e,t,r)},k.retain=function(e){k.textures[e]&&k.textures[e].retain()},k.release=function(e){k.textures[e]&&k.textures[e].release()},k.destroy=function(e){Object.keys(k.textures).forEach(t=>{var r=k.textures[t];r.gl===e&&r.destroy({force:!0})})},k.getSpriteInfo=function(e,t){let r=k.textures[e];return r&&{size:r.sizes[t],css_size:r.css_sizes[t],aspect:r.aspects[t],texcoords:r.texcoords[t]}},k.getTexcoordsForSprite=function(e,t,r){var n=r[1]-e[1]-t[1];return[e[0]/r[0],n/r[1],(t[0]+e[0])/r[0],(t[1]+n)/r[1]]},k.createFromObject=function(e,t){let r=[];if(t)for(let n in t){let i=t[n];if(i.skip_create)continue;if(!k.changed(n,i))continue;let s=k.create(e,n,i);r.push(s.loading)}return Promise.all(r)},k.default="__default",k.createDefault=function(e){return k.create(e,k.default)},k.sliceOptions=function(e){return{filtering:e.filtering,sprites:e.sprites,url:e.url,element:e.element,data:e.data,width:e.width,height:e.height,density:e.density,repeat:e.repeat,TEXTURE_WRAP_S:e.TEXTURE_WRAP_S,TEXTURE_WRAP_T:e.TEXTURE_WRAP_T,UNPACK_FLIP_Y_WEBGL:e.UNPACK_FLIP_Y_WEBGL,UNPACK_PREMULTIPLY_ALPHA_WEBGL:e.UNPACK_PREMULTIPLY_ALPHA_WEBGL}},k.changed=function(e,t){let r=k.textures[e];if(r){if("element"===r.config_type||null!=t.element)return!0;if(t=k.sliceOptions(t),k.texture_configs[e]===JSON.stringify(Object.assign({name:e},t)))return!1}return!0},k.getInfo=function(e){if(e||(e=Object.keys(k.textures)),Array.isArray(e))return Promise.all(e.map(e=>k.getInfo(e)));var t=k.textures[e];return t?(t.loading||Promise.resolve(t)).then(()=>({name:t.name,width:t.width,height:t.height,density:t.density,css_size:[t.width/t.density,t.height/t.density],aspect:t.width/t.height,sprites:t.sprites,texcoords:t.texcoords,sizes:t.sizes,css_sizes:t.css_sizes,aspects:t.aspects,filtering:t.filtering,power_of_2:t.power_of_2,valid:t.valid})):Promise.resolve(null)},k.syncTexturesToWorker=function(e){return a.postMessage("Texture.getInfo",e).then(e=>(e&&e.filter(e=>e).forEach(e=>k.textures[e.name]=e),k.textures))},k.getMaxTextureSize=function(e){return e.getParameter(e.MAX_TEXTURE_SIZE)},k.textures={},k.texture_configs={},k.boundTexture=null,k.activeUnit=null,a.addTarget("Texture",k),T(k);var O={parseUniforms:function(e={}){var t=[];for(const[r,n]of Object.entries(e))if("number"==typeof n)t.push({type:"float",method:"1f",name:r,value:n,path:[r]});else if(Array.isArray(n)){if("number"==typeof n[0])n.length>=2&&n.length<=4?t.push({type:"vec"+n.length,method:n.length+"fv",name:r,value:n,path:[r]}):n.length>4&&t.push({type:"float[]",method:"1fv",name:r+"[0]",value:n,path:[r]});else if("string"==typeof n[0])for(let e=0;e<n.length;e++)t.push({type:"sampler2D",method:"1i",name:r+"["+e+"]",value:n[e],path:[r,e]});else if(Array.isArray(n[0])&&"number"==typeof n[0][0]&&n[0].length>=2&&n[0].length<=4)for(let e=0;e<n.length;e++)t.push({type:"vec"+n[0].length,method:n[0].length+"fv",name:r+"["+e+"]",value:n[e],path:[r,e]})}else"boolean"==typeof n?t.push({type:"bool",method:"1i",name:r,value:n,path:[r]}):"string"==typeof n&&t.push({type:"sampler2D",method:"1i",name:r,value:n,path:[r]});return t},defineVariable:function(e,t){var r,n;if("number"==typeof t)r="float";else if(Array.isArray(t))"number"==typeof t[0]?t.length>=2&&t.length<=4?r="vec"+t.length:(r="float",n=t.length):"string"==typeof t[0]?(r="sampler2D",n=t.length):Array.isArray(t[0])&&"number"==typeof t[0][0]&&t[0].length>=2&&t[0].length<=4&&(r="vec"+t[0].length,n=t.length);else if("boolean"==typeof t)r="bool";else{if("string"!=typeof t)return;r="sampler2D"}var i="";return i+=`${r} ${e}`,n&&(i+=`[${n}]`),i+";\n"},defineUniform:function(e,t){var r=O.defineVariable(e,t);if(r)return"uniform "+r},expandVec3:function(e,t=1){let r;if(Array.isArray(e)){if(2!==e.length)return e;r=[...e,t].map(parseFloat)}else r=[e,e,e].map(parseFloat);if(r&&r.every(e=>"number"==typeof e&&!isNaN(e)))return r},expandVec4:function(e,t=1){let r;if(Array.isArray(e)){if(3!==e.length)return e;r=[...e,t].map(parseFloat)}else r=[e,e,e,t].map(parseFloat);if(r&&r.every(e=>"number"==typeof e&&!isNaN(e)))return r}};let R=[];function C(e,t){let r=R.filter(t=>t[0]===e)[0];return r=r&&r[1],r||(R.push([e,{}]),r=R[R.length-1][1]),r[t]||(r[t]=e.getExtension(t)),r[t]}function N(e){var t,r,n=0;if(0===e.length)return n;for(t=0,r=e.length;t<r;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return n}function P(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var M,D,z=(D||(D=1,M=function(e){e=String(e);for(var t,r=[];t=e.match(/ERROR\:([^\n]+)/);){e=e.slice(t.index+1);var n=(o=t[1].trim()).split(":"),i=n.slice(2).join(":").trim(),s=parseInt(n[0],10),o=parseInt(n[1],10);r.push({message:i,file:s,line:o})}return r}),M),I=P(z);const F=/^\s*#pragma.*$/gm,L=/\\\s*\n/gm;class j{constructor(e,t,r,n){n=n||{},this.gl=e,this.program=null,this.compiled=!1,this.compiling=!1,this.error=null,this.defines=Object.assign({},n.defines||{}),this.blocks=Object.assign({},n.blocks||{}),this.block_scopes=Object.assign({},n.block_scopes||{}),this.extensions=n.extensions||[],this.dependent_uniforms=n.uniforms,this.uniforms={},this.attribs={},this.vertex_source=t,this.fragment_source=r,this.id=j.id++,this.name=n.name}destroy(){this.gl.useProgram(null),this.gl.deleteProgram(this.program),this.program=null,this.uniforms={},this.attribs={},this.compiled=!1}use(){this.compiled&&(j.current!==this&&this.gl.useProgram(this.program),j.current=this)}compile(){if(this.compiling)throw new Error(`ShaderProgram.compile(): skipping for ${this.id} (${this.name}) because already compiling`);this.compiling=!0,this.compiled=!1,this.error=null,this.computed_vertex_source=this.vertex_source,this.computed_fragment_source=this.fragment_source;let e=this.checkExtensions();var t,r=this.buildDefineList(),n=this.buildShaderBlockList();for(var i in n){var s=n[i];if(s&&(!Array.isArray(s)||0!==s.length)){t=new RegExp("^\\s*#pragma\\s+tangram:\\s+"+i+"\\s*$","m");var o=this.computed_vertex_source.match(t),a=this.computed_fragment_source.match(t);if(null!=o||null!=a){var l="";s.forEach(e=>{let t=`${e.scope}, ${e.key}, ${e.num}`;l+=`\n// tangram-block-start: ${t}\n`,l+=e.source,l+=`\n// tangram-block-end: ${t}\n`}),null!=o&&(this.computed_vertex_source=this.computed_vertex_source.replace(t,l)),null!=a&&(this.computed_fragment_source=this.computed_fragment_source.replace(t,l)),r["TANGRAM_BLOCK_"+i.replace(/[\s-]+/g,"_").toUpperCase()]=!0}}}this.computed_vertex_source=this.computed_vertex_source.replace(F,""),this.computed_fragment_source=this.computed_fragment_source.replace(F,""),this.ensureUniforms(this.dependent_uniforms);let u="",c=this.gl.getShaderPrecisionFormat(this.gl.FRAGMENT_SHADER,this.gl.HIGH_FLOAT);u=c&&c.precision>0?"precision highp float;\n":"precision mediump float;\n",r.TANGRAM_VERTEX_SHADER=!0,r.TANGRAM_FRAGMENT_SHADER=!1,this.computed_vertex_source=u+j.buildDefineString(r)+this.computed_vertex_source,r.TANGRAM_VERTEX_SHADER=!1,r.TANGRAM_FRAGMENT_SHADER=!0,this.computed_fragment_source=j.buildExtensionString(e)+u+j.buildDefineString(r)+this.computed_fragment_source,this.computed_vertex_source=this.computed_vertex_source.replace(L,""),this.computed_fragment_source=this.computed_fragment_source.replace(L,"");try{this.program=j.updateProgram(this.gl,this.program,this.computed_vertex_source,this.computed_fragment_source),this.compiled=!0,this.compiling=!1}catch(e){throw this.program=null,this.compiled=!1,this.compiling=!1,this.error=e,this.error.vertex_shader_source=this.computed_vertex_source,this.error.fragment_shader_source=this.computed_fragment_source,"vertex"!==e.type&&"fragment"!==e.type||(this.shader_errors=e.errors,this.shader_errors.forEach(t=>{t.type=e.type,t.block=this.block(e.type,t.line),t.line=this.block(e.type,t.line)}),this.error.shader_errors=this.shader_errors),e}this.computed_vertex_source=null,this.computed_fragment_source=null,this.use(),this.refreshUniforms(),this.refreshAttributes()}buildDefineList(){var e,t={};for(e in j.defines)t[e]=j.defines[e];for(e in this.defines)t[e]=this.defines[e];return t}buildShaderBlockList(){let e,t={};for(e in j.blocks)t[e]=[],Array.isArray(j.blocks[e])?t[e].push(...j.blocks[e].map((t,r)=>({key:e,source:t,num:r,scope:"ShaderProgram"}))):t[e]=[{key:e,source:j.blocks[e],num:0,scope:"ShaderProgram"}];for(e in this.blocks)if(t[e]=t[e]||[],Array.isArray(this.blocks[e])){let r=this.block_scopes&&this.block_scopes[e]||[],n=null,i=0;for(let s=0;s<this.blocks[e].length;s++)r[s]!==n&&(n=r[s],i=0),t[e].push({key:e,source:this.blocks[e][s],num:i,scope:n||this.name}),i++}else t[e].push({key:e,source:this.blocks[e],num:0,scope:this.name});return t}ensureUniforms(e){if(!e)return;const t=Object.entries(e).map(([e,t])=>O.defineUniform(e,t)).filter(e=>e);this.computed_vertex_source=t.join("\n")+this.computed_vertex_source,this.computed_fragment_source=t.join("\n")+this.computed_fragment_source}setUniforms(e,t=!0){this.compiled&&(t&&(this.texture_unit=0),O.parseUniforms(e).forEach(({name:e,type:t,value:r,method:n})=>{"sampler2D"===t?this.setTextureUniform(e,r):this.uniform(n,e,r)}))}saveUniforms(e){let t=e||this.uniforms;for(let e in t){let t=this.uniforms[e];t&&(t.saved_value=t.value)}this.saved_texture_unit=this.texture_unit||0}restoreUniforms(e){let t=e||this.uniforms;for(let e in t){let t=this.uniforms[e];t&&t.saved_value&&(t.value=t.saved_value,this.updateUniform(t))}this.texture_unit=this.saved_texture_unit||0}setTextureUniform(e,t){var r=k.textures[t];null!=r?(r.bind(this.texture_unit),this.uniform("1i",e,this.texture_unit),this.texture_unit++):_("warn",`Cannot find texture '${t}'`)}uniform(e,t,r){if(!this.compiled)return;this.uniforms[t]=this.uniforms[t]||{};let n=this.uniforms[t];n.name=t,void 0===n.location&&(n.location=this.gl.getUniformLocation(this.program,t)),n.method=e,n.value=r,this.updateUniform(n)}updateUniform(e){this.compiled&&e&&null!=e.location&&(this.use(),this.commitUniform(e))}commitUniform(e){let t=e.location,r=e.value;switch(e.method){case"1i":this.gl.uniform1i(t,r);break;case"1f":this.gl.uniform1f(t,r);break;case"2f":this.gl.uniform2f(t,r[0],r[1]);break;case"3f":this.gl.uniform3f(t,r[0],r[1],r[2]);break;case"4f":this.gl.uniform4f(t,r[0],r[1],r[2],r[3]);break;case"1iv":this.gl.uniform1iv(t,r);break;case"3iv":this.gl.uniform3iv(t,r);break;case"1fv":this.gl.uniform1fv(t,r);break;case"2fv":this.gl.uniform2fv(t,r);break;case"3fv":this.gl.uniform3fv(t,r);break;case"4fv":this.gl.uniform4fv(t,r);break;case"Matrix3fv":this.gl.uniformMatrix3fv(t,!1,r);break;case"Matrix4fv":this.gl.uniformMatrix4fv(t,!1,r)}}refreshUniforms(){if(this.compiled)for(var e in this.uniforms){let t=this.uniforms[e];t.location=this.gl.getUniformLocation(this.program,e),this.updateUniform(t)}}refreshAttributes(){this.attribs={}}attribute(e){if(this.compiled){var t=this.attribs[e]=this.attribs[e]||{};return null!=t.location||(t.name=e,t.location=this.gl.getAttribLocation(this.program,e)),t}}source(e){return"vertex"===e?this.computed_vertex_source:"fragment"===e?this.computed_fragment_source:void 0}lines(e){let t=this.source(e);return t?t.split("\n"):[]}line(e,t){let r=this.lines(e);if(r)return r[t]}block(e,t){let r,n=this.lines(e);for(let e=0;e<t&&e<n.length;e++){let t=n[e],i=t.match(/\/\/ tangram-block-start: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/);i&&i.length>1?r={scope:i[1],name:i[2],num:i[3]}:(i=t.match(/\/\/ tangram-block-end: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/),i&&i.length>1&&(r=null)),r&&(r.line=null==r.line?-1:r.line+1,r.source=t)}return r}checkExtensions(){let e=[];return this.extensions.forEach(t=>{let r=C(this.gl,t),n=`TANGRAM_EXTENSION_${t}`;this.defines[n]=null!=r,r?e.push(t):_("debug",`Could not enable extension '${t}'`)}),e}}j.id=0,j.current=null,j.defines={},j.blocks={},j.reset=function(){j.programs_by_source={},j.shaders_by_source={}},j.reset(),j.buildDefineString=function(e){var t="";for(var r in e)null!=e[r]&&!1!==e[r]&&("boolean"==typeof e[r]&&!0===e[r]?t+="#define "+r+"\n":"number"==typeof e[r]&&Math.floor(e[r])===e[r]?t+="#define "+r+" "+e[r].toFixed(1)+"\n":t+="#define "+r+" "+e[r]+"\n");return t},j.buildExtensionString=function(e){let t="";return(e=e||[]).forEach(e=>{t+=`#ifdef GL_${e}\n#extension GL_${e} : enable\n#endif\n`}),t},j.addBlock=function(e,...t){j.blocks[e]=j.blocks[e]||[],j.blocks[e].push(...t)},j.removeBlock=function(e){j.blocks[e]=[]},j.replaceBlock=function(e,...t){j.removeBlock(e),j.addBlock(e,...t)},j.updateProgram=function(e,t,r,n){let i=N(e._tangram_id+"::"+r+"::"+n);if(j.programs_by_source[i])return _("trace","Reusing identical source GL program object"),j.programs_by_source[i];var s=j.createShader(e,r,e.VERTEX_SHADER),o=j.createShader(e,n,e.FRAGMENT_SHADER);if(e.useProgram(null),null!=t)for(var a=e.getAttachedShaders(t),l=0;l<a.length;l++)e.detachShader(t,a[l]);else t=e.createProgram();if(null==s||null==o)return t;if(e.attachShader(t,s),e.attachShader(t,o),e.bindAttribLocation(t,0,"a_position"),e.linkProgram(t),!e.getProgramParameter(t,e.LINK_STATUS)){let i=new Error(`WebGL program error:\n VALIDATE_STATUS: ${e.getProgramParameter(t,e.VALIDATE_STATUS)}\n ERROR: ${e.getError()}\n --- Vertex Shader ---\n ${r}\n --- Fragment Shader ---\n ${n}`);throw Object.assign(new Error(i),{type:"program"})}return j.programs_by_source[i]=t,t},j.createShader=function(e,t,r){let n=N(e._tangram_id+"::"+t);if(j.shaders_by_source[n])return _("trace","Reusing identical source GL shader object"),j.shaders_by_source[n];let i=e.createShader(r);if(e.shaderSource(i,t),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)){let t=r===e.VERTEX_SHADER?"vertex":"fragment",n=e.getShaderInfoLog(i),s=I(n);throw Object.assign(new Error(n),{type:t,errors:s})}return j.shaders_by_source[n]=i,i};var U,B={disabled:!1,bound_vao:[],init(e){let t;!0!==this.disabled&&(t=C(e,"OES_vertex_array_object")),null!=t?_("info","Vertex Array Object extension available"):!0!==this.disabled?_("warn","Vertex Array Object extension NOT available"):_("warn","Vertex Array Object extension force disabled")},getExtension(e,t){if(!0!==this.disabled)return C(e,t)},create(e,t,r){let n={};n.setup=t,n.teardown=r;let i=this.getExtension(e,"OES_vertex_array_object");return null!=i&&(n._vao=i.createVertexArrayOES(),i.bindVertexArrayOES(n._vao)),n.setup(),n},getCurrentBinding(e){let t=this.bound_vao.filter(t=>t[0]===e)[0];return t&&t[1]},setCurrentBinding(e,t){let r=this.bound_vao,n=r.filter(t=>t[0]===e)[0];null==n?r.push([e,t]):n[1]=t},bind(e,t){let r=this.getExtension(e,"OES_vertex_array_object");if(null!=t)null!=r&&null!=t._vao?(r.bindVertexArrayOES(t._vao),this.setCurrentBinding(e,t)):t.setup();else{let t=this.getCurrentBinding(e);null!=r?r.bindVertexArrayOES(null):null!=t&&"function"==typeof t.teardown&&t.teardown(),this.setCurrentBinding(e,null)}},destroy(e,t){let r=this.getExtension(e,"OES_vertex_array_object");null!=r&&null!=t&&null!=t._vao&&(r.deleteVertexArrayOES(t._vao),t._vao=null)}};function V(e,...t){for(let r=0;r<t.length;r++){let n=t[r];if(n)for(let t in n){let r=n[t];null===r||"object"!=typeof r||Array.isArray(r)?void 0!==r&&(e[t]=r):null===e[t]||"object"!=typeof e[t]||Array.isArray(e[t])?e[t]=V({},r):e[t]=V(e[t],r)}}return e}var G=U={};U.default_source_max_zoom=18,U.default_view_max_zoom=20,U.max_style_zoom=25,U.tile_size=256,U.half_circumference_meters=20037508.342789244,U.circumference_meters=2*U.half_circumference_meters,U.min_zoom_meters_per_pixel=U.circumference_meters/U.tile_size;let $=[];U.metersPerPixel=function(e){return $[e]=$[e]||U.min_zoom_meters_per_pixel/Math.pow(2,e),$[e]};let q=[];U.metersPerTile=function(e){return q[e]=q[e]||U.circumference_meters/Math.pow(2,e),q[e]},U.tile_scale=4096,U.units_per_pixel=U.tile_scale/U.tile_size,U.height_scale=16;let W=[];U.unitsPerMeter=function(e){return W[e]=W[e]||U.tile_scale/(U.tile_size*U.metersPerPixel(e)),W[e]},U.metersForTile=function(e){return{x:e.x*U.circumference_meters/Math.pow(2,e.z)-U.half_circumference_meters,y:-(e.y*U.circumference_meters/Math.pow(2,e.z)-U.half_circumference_meters)}},U.tileForMeters=function([e,t],r){return{x:Math.floor((e+U.half_circumference_meters)/(U.circumference_meters/Math.pow(2,r))),y:Math.floor((-t+U.half_circumference_meters)/(U.circumference_meters/Math.pow(2,r))),z:r}},U.wrapTile=function({x:e,y:t,z:r},n={x:!0,y:!1}){var i=(1<<r)-1;return n.x&&(e&=i),n.y&&(t&=i),{x:e,y:t,z:r}},U.metersToLatLng=function(e){return e[0]/=U.half_circumference_meters,e[1]/=U.half_circumference_meters,e[1]=(2*Math.atan(Math.exp(e[1]*Math.PI))-Math.PI/2)/Math.PI,e[0]*=180,e[1]*=180,e},U.latLngToMeters=function(e){return e[1]=Math.log(Math.tan(e[1]*Math.PI/360+Math.PI/4))/Math.PI,e[1]*=U.half_circumference_meters,e[0]*=U.half_circumference_meters/180,e},U.tileSpaceToLatlng=function(e,t,r){const n=U.unitsPerMeter(t);return U.transformGeometry(e,e=>{e[0]=e[0]/n+r.x,e[1]=e[1]/n+r.y,U.metersToLatLng(e)}),e},U.copyGeometry=function(e){if(null==e)return;let t={type:e.type};return"Point"===e.type?t.coordinates=[e.coordinates[0],e.coordinates[1]]:"LineString"===e.type||"MultiPoint"===e.type?t.coordinates=e.coordinates.map(e=>[e[0],e[1]]):"Polygon"===e.type||"MultiLineString"===e.type?t.coordinates=e.coordinates.map(e=>e.map(e=>[e[0],e[1]])):"MultiPolygon"===e.type&&(t.coordinates=e.coordinates.map(e=>e.map(e=>e.map(e=>[e[0],e[1]])))),t},U.transformGeometry=function(e,t){null!=e&&("Point"===e.type?t(e.coordinates):"LineString"===e.type||"MultiPoint"===e.type?e.coordinates.forEach(t):"Polygon"===e.type||"MultiLineString"===e.type?e.coordinates.forEach(e=>e.forEach(t)):"MultiPolygon"===e.type&&e.coordinates.forEach(e=>{e.forEach(e=>e.forEach(t))}))},U.boxIntersect=function(e,t){return!(t.sw.x>e.ne.x||t.ne.x<e.sw.x||t.sw.y>e.ne.y||t.ne.y<e.sw.y)},U.findBoundingBox=function(e){for(var t=1/0,r=-1/0,n=1/0,i=-1/0,s=e[0].length,o=0;o<s;o++){var a=e[0][o];a[0]<t&&(t=a[0]),a[1]<n&&(n=a[1]),a[0]>r&&(r=a[0]),a[1]>i&&(i=a[1])}return[t,n,r,i]},U.geometryType=function(e){return"Polygon"===e||"MultiPolygon"===e?"polygon":"LineString"===e||"MultiLineString"===e?"line":"Point"===e||"MultiPoint"===e?"point":void 0},U.centroid=function(e,t=!0){if(!e||0===e.length)return;let r,n=0,i=0,s=0,o=e[0],a=o.length;t&&(r=o[0],o=o.map(e=>[e[0]-r[0],e[1]-r[1]]));for(let e=0,t=a-1;e<a;t=e,e++){let r=o[e],a=o[t],l=r[1]*a[0]-a[1]*r[0];n+=(r[0]+a[0])*l,i+=(r[1]+a[1])*l,s+=3*l}if(!s)return;let l=[n/s,i/s];return t&&(l[0]+=r[0],l[1]+=r[1]),l},U.multiCentroid=function(e){let t=0,r=null;for(let n=0;n<e.length;n++){let i=U.centroid(e[n]);i&&(r=r||[0,0],r[0]+=i[0],r[1]+=i[1],t++)}return t>0&&(r[0]/=t,r[1]/=t),r},U.signedPolygonRingAreaSum=function(e){let t=0,r=e.length;for(let n=0;n<r-1;n++){let r=e[n],i=e[n+1];t+=r[0]*i[1]-i[0]*r[1]}return t+=e[r-1][0]*e[0][1]-e[0][0]*e[r-1][1],t},U.polygonRingArea=function(e){return Math.abs(U.signedPolygonRingAreaSum(e))/2},U.polygonArea=function(e){if(e)return U.polygonRingArea(e[0])},U.multiPolygonArea=function(e){let t=0;for(let r=0;r<e.length;r++)t+=U.polygonArea(e[r]);return t},U.ringWinding=function(e){let t=U.signedPolygonRingAreaSum(e);return t>0?"CW":t<0?"CCW":void 0};const H={functions:{},num_functions:0,num_cached:0};function Z(e,t){if("string"==typeof e)e=K(e,t);else if(null!=e&&"object"==typeof e)for(let r in e)e[r]=Z(e[r],t);return e}function K(e,t){let r="string"==typeof e&&e.match(/^\s*function[^(]*\(([^)]*)\)\s*?\{([\s\S]*)\}$/m);if(r&&r.length>2)try{const e=r[2],n="function"==typeof t?t(e):e,i=N(n);if(void 0===H.functions[i]){let t=r[1].length>0&&r[1].split(",").map(e=>e.trim()).filter(e=>e);t=t.length>0?t:["context"],H.functions[i]=new Function(t.toString(),n),H.functions[i].source=e,H.num_functions++}else H.num_cached++;return H.functions[i]}catch(t){return e}return e}var X,Y={},Q=P(function(){if(X)return Y;X=1;var e={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function t(e){return(e=Math.round(e))<0?0:e>255?255:e}function r(e){return e<0?0:e>1?1:e}function n(e){return"%"===e[e.length-1]?t(parseFloat(e)/100*255):t(parseInt(e))}function i(e){return"%"===e[e.length-1]?r(parseFloat(e)/100):r(parseFloat(e))}function s(e,t,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?e+(t-e)*r*6:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e}try{Y.parseCSSColor=function(r){var o,a=r.replace(/ /g,"").toLowerCase();if(a in e)return e[a].slice();if("#"===a[0])return 4===a.length?(o=parseInt(a.substr(1),16))>=0&&o<=4095?[(3840&o)>>4|(3840&o)>>8,240&o|(240&o)>>4,15&o|(15&o)<<4,1]:null:7===a.length&&(o=parseInt(a.substr(1),16))>=0&&o<=16777215?[(16711680&o)>>16,(65280&o)>>8,255&o,1]:null;var l=a.indexOf("("),u=a.indexOf(")");if(-1!==l&&u+1===a.length){var c=a.substr(0,l),h=a.substr(l+1,u-(l+1)).split(","),d=1;switch(c){case"rgba":if(4!==h.length)return null;d=i(h.pop());case"rgb":return 3!==h.length?null:[n(h[0]),n(h[1]),n(h[2]),d];case"hsla":if(4!==h.length)return null;d=i(h.pop());case"hsl":if(3!==h.length)return null;var f=(parseFloat(h[0])%360+360)%360/360,p=i(h[1]),m=i(h[2]),_=m<=.5?m*(p+1):m+p-m*p,g=2*m-_;return[t(255*s(g,_,f+1/3)),t(255*s(g,_,f)),t(255*s(g,_,f-1/3)),d];default:return null}}return null}}catch(e){}return Y}());const J={},ee=e=>Math.max(e,0),te=e=>isNaN(e)?0:e,re=e=>Array.isArray(e)?e.map(parseFloat).map(te):te(parseFloat(e)),ne=e=>Array.isArray(e)?e.map(re).map(ee):ee(re(e));Object.assign(J,{clampPositive:ee,noNaN:te,parseNumber:re,parsePositiveNumber:ne}),J.wrapFunction=function(e){return`\n var feature = context.feature.properties;\n var global = context.global;\n var $zoom = context.zoom;\n var $layer = context.layer;\n var $source = context.source;\n var $geometry = context.geometry;\n var $meters_per_pixel = context.meters_per_pixel;\n var $id = context.id;\n\n var val = (function(){ ${e} }());\n\n if (typeof val === 'number' && isNaN(val)) {\n val = null; // convert NaNs to nulls\n }\n\n return val;\n `},J.zeroPair=Object.freeze([0,0]),J.defaults={color:[1,1,1,1],width:1,size:1,extrude:!1,height:20,min_height:0,order:0,z:0,outline:{color:[0,0,0,0],width:0},material:{ambient:1,diffuse:1}},J.macros={"Style.color.pseudoRandomColor":function(){return[parseInt(feature.id,16)/100%1*.7,parseInt(feature.id,16)/1e4%1*.7,parseInt(feature.id,16)/1e6%1*.7,1]},"Style.color.randomColor":function(){return[.7*Math.random(),.7*Math.random(),.7*Math.random(),1]}},J.getFeatureParseContext=function(e,t,r){return{feature:e,id:e.id,tile:t,global:r,zoom:t.style_z,geometry:G.geometryType(e.geometry.type),meters_per_pixel:t.meters_per_pixel,meters_per_pixel_sq:t.meters_per_pixel_sq,units_per_meter_overzoom:t.units_per_meter_overzoom}};const ie={STATIC:0,DYNAMIC:1,ZOOM:2};J.CACHE_TYPE=ie,J.createPropertyCache=function(e,t=null,r=null){if(null==e)return;if(e.value)return{value:e.value,zoom:e.zoom?{}:null,type:e.type};let n={value:e,type:ie.STATIC};return Array.isArray(n.value)&&Array.isArray(n.value[0])?(n.zoom={},n.type=ie.ZOOM):"function"==typeof n.value&&(n.type=ie.DYNAMIC,n.dynamic_transform="function"==typeof r?r:null),"function"==typeof t&&(n.zoom?n.value=n.value.map((e,r)=>[e[0],t(e[1],r)]):"function"!=typeof n.value&&(n.value=t(n.value,0))),n},J.createColorPropertyCache=function(e){return J.createPropertyCache(e,e=>"Style.color.pseudoRandomColor"===e?K(J.wrapFunction(J.macros["Style.color.pseudoRandomColor"])):"Style.color.randomColor"===e?J.macros["Style.color.randomColor"]:e)};const se=e=>"string"==typeof e&&"%"===e[e.length-1],oe=e=>"auto"===e,ae=e=>se(e)||oe(e),le="'size' can specify either width or height as derived from aspect ratio, but not both";function ue(e,t){return J.createPropertyCache(e.value,(r,n)=>(Array.isArray(r)?(r=r.map((t,r)=>e.has_ratio[n][r]?t:ne(t)).map((r,i)=>e.has_pct[n][i]?t.css_size[i]*r/100:r),e.has_ratio[n][0]?r[0]=r[1]*t.aspect:e.has_ratio[n][1]&&(r[1]=r[0]/t.aspect)):(r=ne(r),r=e.has_pct[n]?t.css_size.map(e=>e*r/100):[r,r]),r))}function ce(e,t){try{return e(t)}catch(r){_("warn",`Property function in layer '${t.layers[t.layers.length-1]}' failed with\n`,`error ${r.stack}\n`,`function '${e.source}'\n`,t.feature,t)}}J.createPointSizePropertyCache=function(e,t){let r=null,n=null;if(se(e))r=[!0];else if(Array.isArray(e)){if(Array.isArray(e[0])){if(e.some(e=>Array.isArray(e[1])?e[1].some(e=>ae(e)):se(e[1]))&&(r=e.map(e=>Array.isArray(e[1])?e[1].map(e=>se(e)):se(e[1])),n=e.map(e=>Array.isArray(e[1])&&e[1].map(e=>oe(e))),n.some(e=>Array.isArray(e)&&e.every(e=>e))))throw le}else if(e.some(ae)&&(r=[e.map(se)],n=[e.map(oe)],n[0].every(e=>e)))throw le}else if(oe(e))throw"this value only allowed as half of an array, eg [16px, auto]:";if(r||n){if(!t)throw"% or 'auto' keywords can only be used to specify point size when a texture is defined";(e={value:e}).has_pct=r,e.has_ratio=n,e.sprites={}}else e=J.createPropertyCache(e,ne);return e},J.evalCachedPointSizeProperty=function(e,t,r,n){if(null!=e)return e.has_pct||e.has_ratio?t?(e.sprites[t.sprite]||(e.sprites[t.sprite]=ue(e,t)),J.evalCachedProperty(e.sprites[t.sprite],n)):(e.texture=e.texture||ue(e,r),J.evalCachedProperty(e.texture,n)):J.evalCachedProperty(e,n)},J.evalCachedProperty=function(e,t){return null==e?void 0:e.dynamic?ce(e.dynamic,t):e.static?e.static:e.zoom&&e.zoom[t.zoom]?e.zoom[t.zoom]:"function"==typeof e.value?(e.dynamic_transform?e.dynamic=function(t){return e.dynamic_transform(e.value(t))}:e.dynamic=e.value,ce(e.dynamic,t)):Array.isArray(e.value)&&Array.isArray(e.value[0])?(e.zoom=e.zoom||{},e.zoom[t.zoom]=g.interpolate(t.zoom,e.value),e.zoom[t.zoom]):(e.static=e.value,e.static)},J.convertUnits=function(e,t){if(null!=e.value)return"px"===e.units?e.value*G.metersPerPixel(t.zoom):e.value;if("string"==typeof e)"px"===e.trim().slice(-2)?(e=re(e),e*=G.metersPerPixel(t.zoom)):e=re(e);else if(Array.isArray(e))return Array.isArray(e[0])?e.map(e=>[e[0],J.convertUnits(e[1],t)]):e.map(e=>J.convertUnits(e,t));return e},J.parseUnits=function(e){var t={value:re(e)};return 0!==t.value&&"string"==typeof e&&"px"===e.trim().slice(-2)&&(t.units="px"),t},J.evalCachedDistanceProperty=function(e,t){return null==e?void 0:e.dynamic?ce(e.dynamic,t):e.zoom&&e.zoom[t.zoom]?e.zoom[t.zoom]:"function"==typeof e.value?(e.dynamic=e.value,ce(e.dynamic,t)):e.zoom?(e.zoom[t.zoom]=g.interpolate(t.zoom,e.value,e=>J.convertUnits(e,t)),e.zoom[t.zoom]):J.convertUnits(e.value,t)},J.string_colors={},J.colorForString=function(e){if(J.string_colors[e])return J.string_colors[e];let t=Q.parseCSSColor(e);return t&&4===t.length?(t[0]/=255,t[1]/=255,t[2]/=255):t=J.defaults.color,J.string_colors[e]=t,t},J.evalCachedColorProperty=function(e,t={}){if(null!=e){if(e.dynamic){let r=ce(e.dynamic,t);return"string"==typeof r&&(r=J.colorForString(r)),r&&null==r[3]&&(r[3]=1),r}if(e.static)return e.static;if(e.zoom&&e.zoom[t.zoom])return e.zoom[t.zoom];if("function"==typeof e.value){e.dynamic=e.value;let r=ce(e.dynamic,t);return"string"==typeof r&&(r=J.colorForString(r)),r&&null==r[3]&&(r[3]=1),r}if("string"==typeof e.value)return e.static=J.colorForString(e.value),e.static;if(e.zoom){if(!e.zoom_preprocessed){for(let t=0;t<e.value.length;t++){let r=e.value[t];r&&"string"==typeof r[1]&&(r[1]=J.colorForString(r[1]))}e.zoom_preprocessed=!0}return e.zoom[t.zoom]=g.interpolate(t.zoom,e.value),e.zoom[t.zoom][3]=e.zoom[t.zoom][3]||1,e.zoom[t.zoom]}return e.static=e.value.map(e=>e),e.static&&null==e.static[3]&&(e.static[3]=1),e.static}},J.evalCachedColorPropertyWithAlpha=function(e,t,r){const n=J.evalCachedColorProperty(e,r);if(null!=n&&null!=t){const e=J.evalCachedProperty(t,r);if(null!=e)return[n[0],n[1],n[2],e]}return n},J.parseColor=function(e,t={}){if("function"==typeof e&&(e=ce(e,t)),"string"==typeof e)e=J.colorForString(e);else if(Array.isArray(e)&&Array.isArray(e[0])){for(let t=0;t<e.length;t++){let r=e[t];"string"==typeof r[1]&&(r[1]=J.colorForString(r[1]))}t.zoom&&(e=g.interpolate(t.zoom,e))}return Array.isArray(e)?null==(e=e.map(e=>e))[3]&&(e[3]=1):e=[0,0,0,1],e},J.calculateOrder=function(e,t){return"function"==typeof e?e=ce(e,t):"string"==typeof e&&(e=t.feature.properties[e]?t.feature.properties[e]:ne(e)),e},J.evalProperty=function(e,t){return"function"==typeof e?ce(e,t):e};class he{constructor(e,t,r){this.gl=e,this.workers=t,this._lock_fn="function"==typeof r&&r,this.init()}init(){this.requests={},this.feature=null,this.read_delay=0,this.read_delay_timer=null,this.pixels=null,this.fbo=this.gl.createFramebuffer(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.fbo_size={width:256,height:256};var e=k.create(this.gl,"__selection_fbo",{filtering:"nearest"});e.setData(this.fbo_size.width,this.fbo_size.height,null,{filtering:"nearest"}),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,e.texture,0);var t=this.gl.createRenderbuffer();this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,t),this.gl.renderbufferStorage(this.gl.RENDERBUFFER,this.gl.DEPTH_COMPONENT16,this.fbo_size.width,this.fbo_size.height),this.gl.framebufferRenderbuffer(this.gl.FRAMEBUFFER,this.gl.DEPTH_ATTACHMENT,this.gl.RENDERBUFFER,t),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null)}destroy(){this.gl&&this.fbo&&(this.gl.deleteFramebuffer(this.fbo),this.fbo=null,this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null))}get locked(){return this._lock_fn&&this._lock_fn()||!1}bind(){this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.gl.viewport(0,0,this.fbo_size.width,this.fbo_size.height),this.gl.clearColor(...he.defaultColor)}getFeatureAt(e,{radius:t}){return!e||e.x<0||e.y<0||e.x>1||e.y>1?Promise.resolve({feature:null,changed:!1}):new Promise((r,n)=>{this.selection_request_id=this.selection_request_id+1||0,this.requests[this.selection_request_id]={id:this.selection_request_id,point:e,radius:t,resolve:r,reject:n}})}pendingRequests(){return Object.keys(this.requests).length?this.requests:null}hasPendingRequests(){return null!=this.pendingRequests()}clearPendingRequests(){for(var e in this.requests){var t=this.requests[e];t.sent||(t.reject({request:t}),delete this.requests[e])}}read(){null!=this.read_delay_timer&&clearTimeout(this.read_delay_timer),this.read_delay_timer=setTimeout(()=>{if(!this.locked){var e=this.gl;for(var t in e.bindFramebuffer(e.FRAMEBUFFER,this.fbo),this.requests){var r=this.requests[t];if(r.sent)continue;let n,i,s=255,{point:o,radius:l}=r;if(l){let e=Math.min(this.fbo_size.width,this.fbo_size.height);i={x:Math.min(Math.ceil(2*l.x*this.fbo_size.width),e),y:Math.min(Math.ceil(2*l.y*this.fbo_size.height),e)}}else l={x:0,y:0},i={x:1,y:1};if((null==this.pixels||this.pixels.byteLength<i.x*i.y*4)&&(this.pixels=new Uint8Array(i.x*i.y*4)),this.pixels.fill instanceof Function)this.pixels.fill(0);else for(let e=0;e<this.pixels.length;e++)this.pixels[e]=0;e.readPixels(Math.round((o.x-l.x)*this.fbo_size.width),Math.round((1-o.y-l.y)*this.fbo_size.height),i.x,i.y,e.RGBA,e.UNSIGNED_BYTE,this.pixels);let u=4*(Math.round(i.y/2)*i.x+Math.round(i.x/2)),c=this.pixels[u]+(this.pixels[u+1]<<8)+(this.pixels[u+2]<<16);if(c>0)n=c+(this.pixels[u+3]<<24)>>>0,s=this.pixels[u+3];else{let e=-1>>>0;u=0;for(let t=0;t<i.y;t++)for(let r=0;r<i.x;r++,u+=4)if(c=this.pixels[u]+(this.pixels[u+1]<<8)+(this.pixels[u+2]<<16),c>0){let o=(r-i.x/2)*(r-i.x/2)+(t-i.y/2)*(t-i.y/2);o<=e&&(n=c+(this.pixels[u+3]<<24)>>>0,s=this.pixels[u+3],e=o)}}255!==s?null!=this.workers[s]&&a.postMessage(this.workers[s],"self.getFeatureSelection",{id:r.id,key:n}).then(e=>{this.finishRead(e)}):this.finishRead({id:r.id}),r.sent=!0}e.bindFramebuffer(e.FRAMEBUFFER,null)}},this.read_delay)}finishRead(e){var t=this.requests[e.id];if(t){var r=e.feature,n=!1;(null!=r&&null==this.feature||null==r&&null!=this.feature||null!=r&&null!=this.feature&&JSON.stringify(r)!==JSON.stringify(this.feature))&&(n=!0),this.feature=r,t.resolve({feature:r,changed:n,request:t}),delete this.requests[e.id]}else _("error","FeatureSelection.finishRead(): could not find message",e)}static makeEntry(e){this.map_entry++;var t=255&this.map_entry,r=this.map_entry>>8&255,n=this.map_entry>>16&255,i=this.map_prefix,s=t/255,o=r/255,a=n/255,l=i/255,u=t+(r<<8)+(n<<16)+(i<<24)>>>0;return this.map[u]={color:[s,o,a,l]},this.map_size++,this.tiles[e.key]||(this.tiles[e.key]={entries:[],tile:{key:e.key,coords:e.coords,style_z:e.style_z,source:e.source,generation:e.generation}}),this.tiles[e.key].entries.push(u),this.map[u]}static makeColor(e,t,r){var n=this.makeEntry(t);return n.feature={id:e.id,properties:e.properties,source_name:r.source,source_layer:r.layer,layers:r.layers,tile:this.tiles[t.key].tile},n.color}static reset(e){Array.isArray(e)?e.forEach(e=>this.clearSource(e)):(this.tiles={},this.map={},this.map_size=0,this.map_entry=0)}static clearSource(e){for(let t in this.tiles)this.tiles[t].tile.source===e&&this.clearTile(t)}static clearTile(e){this.tiles[e]&&(this.tiles[e].entries.forEach(e=>delete this.map[e]),this.map_size-=this.tiles[e].entries.length,delete this.tiles[e])}static getMapSize(){return this.map_size}static setPrefix(e){this.map_prefix=e}}var de;he.map={},he.tiles={},he.map_size=0,he.map_entry=0,he.map_prefix=0,he.defaultColor=[0,0,0,1];var fe=de={};de.BYTE=5120,de.UNSIGNED_BYTE=5121,de.SHORT=5122,de.UNSIGNED_SHORT=5123,de.INT=5124,de.UNSIGNED_INT=5125,de.FLOAT=5126;class pe{constructor(e,t,r,n,i){i=i||{},this.gl=e,this.vertex_data=t,this.element_data=r,this.vertex_layout=n,this.vertex_buffer=this.gl.createBuffer(),this.buffer_size=this.vertex_data.byteLength,this.draw_mode=i.draw_mode||this.gl.TRIANGLES,this.data_usage=i.data_usage||this.gl.STATIC_DRAW,this.vertices_per_geometry=3,this.uniforms=i.uniforms,this.textures=i.textures,this.retain=i.retain||!1,this.created_at=+new Date,this.fade_in_time=i.fade_in_time||0,this.vertex_count=this.vertex_data.byteLength/this.vertex_layout.stride,this.element_count=0,this.vaos={},this.toggle_element_array=!1,this.element_data?(this.toggle_element_array=!0,this.element_count=this.element_data.length,this.geometry_count=this.element_count/this.vertices_per_geometry,this.element_type=this.element_data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT,this.element_buffer=this.gl.createBuffer(),this.buffer_size+=this.element_data.byteLength,this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.element_buffer),this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER,this.element_data,this.data_usage)):this.geometry_count=this.vertex_count/this.vertices_per_geometry,this.upload(),this.retain||(delete this.vertex_data,delete this.element_data),this.valid=!0}render(e={}){if(!this.valid)return!1;var t=e.program||j.current;t.use(),this.uniforms&&(t.saveUniforms(this.uniforms),t.setUniforms(this.uniforms,!1));let r=(+new Date-this.created_at)/1e3;return t.uniform("1f","u_visible_time",r),this.bind(t),this.toggle_element_array?this.gl.drawElements(this.draw_mode,this.element_count,this.element_type,0):this.gl.drawArrays(this.draw_mode,0,this.vertex_count),B.bind(this.gl,null),this.uniforms&&t.restoreUniforms(this.uniforms),r<this.fade_in_time}bind(e){let t=this.vaos[e.id];t?B.bind(this.gl,t):this.vaos[e.id]=B.create(this.gl,()=>{this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.toggle_element_array&&this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.element_buffer),this.vertex_layout.enableDynamicAttributes(this.gl,e)}),this.vertex_layout.enableStaticAttributes(this.gl,e)}upload(){this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.vertex_data,this.data_usage)}destroy(){if(!this.valid)return!1;this.valid=!1;for(let e in this.vaos)B.destroy(this.gl,this.vaos[e]);return this.gl.deleteBuffer(this.vertex_buffer),this.vertex_buffer=null,this.element_buffer&&(this.gl.deleteBuffer(this.element_buffer),this.element_buffer=null),delete this.vertex_data,delete this.element_data,this.textures&&this.textures.forEach(e=>k.release(e)),!0}}const me=["emission","ambient","diffuse","specular"];class _e{constructor(e){e=e||{},me.forEach(t=>{const r=e[t];null!=r&&(r.texture?this[t]={texture:r.texture,mapping:r.mapping||"spheremap",scale:O.expandVec3(null!=r.scale?r.scale:1),amount:O.expandVec4(null!=r.amount?r.amount:1)}:"number"==typeof r||Array.isArray(r)?this[t]={amount:O.expandVec4(r)}:this[t]="string"==typeof r?{amount:J.parseColor(r)}:r)}),this.specular&&(this.specular.shininess=e.shininess?parseFloat(e.shininess):.2),null!=e.normal&&(this.normal={texture:e.normal.texture,mapping:e.normal.mapping||"triplanar",scale:O.expandVec3(null!=e.normal.scale?e.normal.scale:1),amount:null!=e.normal.amount?e.normal.amount:1})}static isValid(e){return null!=e&&(null!=e.emission||null!=e.ambient||null!=e.diffuse||null!=e.specular)}inject(e){me.forEach(t=>{let r=`TANGRAM_MATERIAL_${t.toUpperCase()}`,n=r+"_TEXTURE";e.defines[r]=null!=this[t],this[t]&&this[t].texture&&(e.defines[n]=!0,e.defines[n+"_"+this[t].mapping.toUpperCase()]=!0,e.defines[`TANGRAM_MATERIAL_TEXTURE_${this[t].mapping.toUpperCase()}`]=!0,e.texcoords=e.texcoords||"uv"===this[t].mapping)}),this.normal&&this.normal.texture&&(e.defines.TANGRAM_MATERIAL_NORMAL_TEXTURE=!0,e.defines["TANGRAM_MATERIAL_NORMAL_TEXTURE_"+this.normal.mapping.toUpperCase()]=!0,e.defines[`TANGRAM_MATERIAL_TEXTURE_${this.normal.mapping.toUpperCase()}`]=!0,e.texcoords=e.texcoords||"uv"===this.normal.mapping),e.replaceShaderBlock(_e.block,"/*\n\nDefines globals:\nmaterial\nlight_accumulator_*\n\n*/\n\n\n// MATERIALS\n//\nstruct Material {\n #ifdef TANGRAM_MATERIAL_EMISSION\n vec4 emission;\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\n vec3 emissionScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT\n vec4 ambient;\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\n vec3 ambientScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n vec4 diffuse;\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\n vec3 diffuseScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n vec4 specular;\n float shininess;\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\n vec3 specularScale;\n #endif\n #endif\n\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\n vec3 normalScale;\n float normalAmount;\n #endif\n};\n\n// Note: uniform is copied to a global instance to allow modification\nuniform Material u_material;\nMaterial material;\n\n#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\nuniform sampler2D u_material_emission_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\nuniform sampler2D u_material_ambient_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\nuniform sampler2D u_material_diffuse_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\nuniform sampler2D u_material_specular_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\nuniform sampler2D u_material_normal_texture;\n#endif\n\n// Global light accumulators for each property\nvec4 light_accumulator_ambient = vec4(vec3(0.0), 1.);\nvec4 light_accumulator_diffuse = vec4(vec3(0.0), 1.);\n#ifdef TANGRAM_MATERIAL_SPECULAR\n vec4 light_accumulator_specular = vec4(vec3(0.0), 1.);\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_SPHEREMAP\nvec4 getSphereMap (in sampler2D _tex, in vec3 _eyeToPoint, in vec3 _normal, in vec2 _skew) {\n // Normalized vector from camera to surface\n vec3 eye = normalize(_eyeToPoint);\n\n // Adjust for camera skew\n eye.xy -= _skew;\n eye = normalize(eye);\n\n // Reflection of eye off of surface normal\n vec3 r = reflect(eye, _normal);\n\n // Map reflected vector onto the surface of a sphere\n r.z += 1.0;\n float m = 2. * length(r);\n\n // Adjust xy to account for spherical shape, and center in middle of texture\n vec2 uv = r.xy / m + .5;\n\n // Sample the environment map\n return texture2D(_tex, uv);\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_TRIPLANAR\nvec3 getTriPlanarBlend (in vec3 _normal) {\n vec3 blending = abs(_normal);\n blending = normalize(max(blending, 0.00001));\n float b = (blending.x + blending.y + blending.z);\n return blending / b;\n}\n\nvec4 getTriPlanar (in sampler2D _tex, in vec3 _pos, in vec3 _normal, in vec3 _scale) {\n vec3 blending = getTriPlanarBlend(_normal);\n vec4 xaxis = texture2D(_tex, fract(_pos.yz * _scale.x));\n vec4 yaxis = texture2D(_tex, fract(_pos.xz * _scale.y));\n vec4 zaxis = texture2D(_tex, fract(_pos.xy * _scale.z));\n return xaxis * blending.x + yaxis * blending.y + zaxis * blending.z;\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_PLANAR\nvec4 getPlanar (in sampler2D _tex, in vec3 _pos, in vec2 _scale) {\n return texture2D( _tex, fract(_pos.xy * _scale.x) );\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\nvoid calculateNormal (inout vec3 _normal) {\n // Get NORMALMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_UV\n _normal += texture2D(u_material_normal_texture, fract(v_texcoord*material.normalScale.xy)).rgb*2.0-1.0;\n #endif\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_PLANAR\n vec3 normalTex = getPlanar(u_material_normal_texture, v_world_position.xyz, material.normalScale.xy).rgb*2.0-1.0;\n _normal += normalTex;\n #endif\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_TRIPLANAR\n vec3 normalTex = getTriPlanar(u_material_normal_texture, v_world_position.xyz, _normal, material.normalScale).rgb*2.0-1.0;\n _normal += normalTex;\n #endif\n\n _normal = normalize(_normal);\n}\n#endif\n\nvoid calculateMaterial (in vec3 _eyeToPoint, inout vec3 _normal) {\n // get EMISSION TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_UV\n material.emission *= texture2D(u_material_emission_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_PLANAR\n material.emission *= getPlanar(u_material_emission_texture, v_world_position.xyz, material.emissionScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_TRIPLANAR\n material.emission *= getTriPlanar(u_material_emission_texture, v_world_position.xyz, _normal, material.emissionScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_SPHEREMAP\n material.emission *= getSphereMap(u_material_emission_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get AMBIENT TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_UV\n material.ambient *= texture2D(u_material_ambient_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_PLANAR\n material.ambient *= getPlanar(u_material_ambient_texture, v_world_position.xyz, material.ambientScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_TRIPLANAR\n material.ambient *= getTriPlanar(u_material_ambient_texture, v_world_position.xyz, _normal, material.ambientScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_SPHEREMAP\n material.ambient *= getSphereMap(u_material_ambient_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get DIFFUSE TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_UV\n material.diffuse *= texture2D(u_material_diffuse_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_PLANAR\n material.diffuse *= getPlanar(u_material_diffuse_texture, v_world_position.xyz, material.diffuseScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_TRIPLANAR\n material.diffuse *= getTriPlanar(u_material_diffuse_texture, v_world_position.xyz, _normal, material.diffuseScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_SPHEREMAP\n material.diffuse *= getSphereMap(u_material_diffuse_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get SPECULAR TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_UV\n material.specular *= texture2D(u_material_specular_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_PLANAR\n material.specular *= getPlanar(u_material_specular_texture, v_world_position.xyz, material.specularScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_TRIPLANAR\n material.specular *= getTriPlanar(u_material_specular_texture, v_world_position.xyz, _normal, material.specularScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_SPHEREMAP\n material.specular *= getSphereMap(u_material_specular_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n}\n","Material"),e.addShaderBlock("setup","\nmaterial = u_material;\n","Material")}setupProgram(e){me.forEach(t=>{this[t]&&(this[t].texture?(e.setTextureUniform(`u_material_${t}_texture`,this[t].texture),e.uniform("3fv",`u_material.${t}Scale`,this[t].scale),e.uniform("4fv",`u_material.${t}`,this[t].amount)):this[t].amount&&e.uniform("4fv",`u_material.${t}`,this[t].amount))}),this.specular&&e.uniform("1f","u_material.shininess",this.specular.shininess),this.normal&&this.normal.texture&&(e.setTextureUniform("u_material_normal_texture",this.normal.texture),e.uniform("3fv","u_material.normalScale",this.normal.scale),e.uniform("1f","u_material.normalAmount",this.normal.amount))}}var ge;_e.block="material";var ye=ge={};ge.copy=function(e){for(var t=[],r=e.length,n=0;n<r;n++)t[n]=e[n];return t},ge.neg=function(e){for(var t=[],r=e.length,n=0;n<r;n++)t[n]=-e[n];return t},ge.add=function(e,t){for(var r=[],n=Math.min(e.length,t.length),i=0;i<n;i++)r[i]=e[i]+t[i];return r},ge.sub=function(e,t){for(var r=[],n=Math.min(e.length,t.length),i=0;i<n;i++)r[i]=e[i]-t[i];return r},ge.signed_area=function(e,t,r){return(t[0]-e[0])*(r[1]-e[1])-(r[0]-e[0])*(t[1]-e[1])},ge.mult=function(e,t){var r,n=[],i=e.length;if("number"==typeof t)for(r=0;r<i;r++)n[r]=e[r]*t;else for(i=Math.min(e.length,t.length),r=0;r<i;r++)n[r]=e[r]*t[r];return n},ge.div=function(e,t){var r,n=[];if("number"==typeof t)for(r=0;r<e.length;r++)n[r]=e[r]/t;else{var i=Math.min(e.length,t.length);for(r=0;r<i;r++)n[r]=e[r]/t[r]}return n},ge.perp=function(e,t){return[t[1]-e[1],e[0]-t[0]]},ge.rot=function(e,t){var r=Math.cos(t),n=Math.sin(t);return[e[0]*r-e[1]*n,e[0]*n+e[1]*r]},ge.angle=function([e,t]){return Math.atan2(t,e)},ge.angleBetween=function(e,t){var r=ge.dot(ge.normalize(ge.copy(e)),ge.normalize(ge.copy(t)));return r>1&&(r=1),Math.acos(r)},ge.isEqual=function(e,t){for(var r=e.length,n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0},ge.lengthSq=function(e){return 2===e.length?e[0]*e[0]+e[1]*e[1]:e.length>=3?e[0]*e[0]+e[1]*e[1]+e[2]*e[2]:0},ge.length=function(e){return Math.sqrt(ge.lengthSq(e))},ge.normalize=function(e){var t;if(2===e.length){if(1===(t=e[0]*e[0]+e[1]*e[1]))return e;0!==(t=Math.sqrt(t))?(e[0]/=t,e[1]/=t):(e[0]=0,e[1]=0)}else if(e.length>=3){if(1===(t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2]))return e;0!==(t=Math.sqrt(t))?(e[0]/=t,e[1]/=t,e[2]/=t):(e[0]=0,e[1]=0,e[2]=0)}return e},ge.cross=function(e,t){return 2===e.length?e[0]*t[1]-e[1]*t[0]:3===e.length?[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]:void 0},ge.dot=function(e,t){for(var r=0,n=Math.min(e.length,t.length),i=0;i<n;i++)r+=e[i]*t[i];return r};class ve{constructor(e,t){this.name=t.name,this.view=e,null==t.ambient||"number"==typeof t.ambient?this.ambient=O.expandVec3(t.ambient||0):this.ambient=J.parseColor(t.ambient).slice(0,3),null==t.diffuse||"number"==typeof t.diffuse?this.diffuse=O.expandVec3(null!=t.diffuse?t.diffuse:1):this.diffuse=J.parseColor(t.diffuse).slice(0,3),null==t.specular||"number"==typeof t.specular?this.specular=O.expandVec3(t.specular||0):this.specular=J.parseColor(t.specular).slice(0,3)}static create(e,t){if(ve.types[t.type])return new ve.types[t.type](e,t)}static setMode(e,t){!0===e&&(e="fragment"),e=ve.enabled&&(null!=e?e:"fragment"),t.defines.TANGRAM_LIGHTING_FRAGMENT="fragment"===e,t.defines.TANGRAM_LIGHTING_VERTEX="vertex"===e}static inject(e){if(j.removeBlock(ve.block),!ve.enabled)return;let t="";if(e&&Object.keys(e).length>0){let r={};for(let t in e)r[e[t].type]=!0;for(let e in r)ve.types[e].inject();for(let r in e)e[r].inject(),t+=`calculateLight(${r}, _eyeToPoint, _normal);\n`}let r=`\n vec4 calculateLighting(in vec3 _eyeToPoint, in vec3 _normal, in vec4 _color) {\n\n // Do initial material calculations over normal, emission, ambient, diffuse and specular values\n calculateMaterial(_eyeToPoint,_normal);\n\n // Un roll the loop of individual ligths to calculate\n ${t}\n\n // Final light intensity calculation\n vec4 color = vec4(vec3(0.), _color.a); // start with vertex color alpha\n\n #ifdef TANGRAM_MATERIAL_EMISSION\n color.rgb = material.emission.rgb;\n color.a *= material.emission.a;\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT\n color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.ambient.rgb;\n color.a *= material.ambient.a;\n #else\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.diffuse.rgb;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n color.rgb += light_accumulator_diffuse.rgb * _color.rgb * material.diffuse.rgb;\n color.a *= material.diffuse.a;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n color.rgb += light_accumulator_specular.rgb * material.specular.rgb;\n color.a *= material.specular.a;\n #endif\n\n // Clamp final color\n color = clamp(color, 0.0, 1.0);\n\n return color;\n }`;j.addBlock(ve.block,r)}inject(){let e=`\n uniform ${this.struct_name} u_${this.name};\n ${this.struct_name} ${this.name};\n `,t=`\n ${this.name} = u_${this.name};\n\n `;j.addBlock(ve.block,e),j.addBlock("setup",t)}update(){}setupProgram(e){e.uniform("3fv",`u_${this.name}.ambient`,this.ambient),e.uniform("3fv",`u_${this.name}.diffuse`,this.diffuse),e.uniform("3fv",`u_${this.name}.specular`,this.specular)}}ve.types={},ve.block="lighting",ve.enabled=!0,ve.types.ambient=class extends ve{constructor(e,t){super(e,t),this.type="ambient",this.struct_name="AmbientLight"}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nlight_accumulator_*\n\n*/\n\nstruct AmbientLight {\n vec3 ambient;\n};\n\nvoid calculateLight(in AmbientLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n light_accumulator_ambient.rgb += _light.ambient;\n}\n")}setupProgram(e){e.uniform("3fv",`u_${this.name}.ambient`,this.ambient)}},ve.types.directional=class extends ve{constructor(e,t){if(super(e,t),this.type="directional",this.struct_name="DirectionalLight",t.direction)this._direction=t.direction;else{let e=135,r=Math.sin(60*Math.PI/180);this._direction=[Math.cos(Math.PI*e/180)*r,Math.sin(Math.PI*e/180)*r,-.5],null==t.ambient&&(this.ambient=O.expandVec3(.5))}this.direction=this._direction.map(parseFloat)}get direction(){return this._direction}set direction(e){this._direction=ye.normalize(ye.copy(e))}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct DirectionalLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec3 direction;\n};\n\nvoid calculateLight(in DirectionalLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n light_accumulator_ambient.rgb += _light.ambient;\n\n float nDotVP = clamp(dot(_normal, -_light.direction), 0.0, 1.0);\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n float pf = 0.0;\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(_light.direction, _normal);\n float eyeDotR = max(dot(normalize(_eyeToPoint), reflectVector), 0.0);\n pf = pow(eyeDotR, material.shininess);\n }\n light_accumulator_specular.rgb += _light.specular * pf;\n #endif\n}\n")}setupProgram(e){super.setupProgram(e),e.uniform("3fv",`u_${this.name}.direction`,this.direction)}};class be extends ve{constructor(e,t){super(e,t),this.type="point",this.struct_name="PointLight",this.position=t.position||[0,0,"100px"],this.position_eye=[],this.origin=t.origin||"ground",this.attenuation=isNaN(parseFloat(t.attenuation))?0:parseFloat(t.attenuation),t.radius?Array.isArray(t.radius)&&2===t.radius.length?this.radius=t.radius:this.radius=[null,t.radius]:this.radius=null}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct PointLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec4 position;\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float attenuationExponent;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n float innerRadius;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float outerRadius;\n#endif\n};\n\nvoid calculateLight(in PointLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n float dist = length(_light.position.xyz - _eyeToPoint);\n\n // Compute vector from surface to light position\n vec3 VP = (_light.position.xyz - _eyeToPoint) / dist;\n\n // Normalize the vector from surface to light position\n float nDotVP = clamp(dot(VP, _normal), 0.0, 1.0);\n\n // Attenuation defaults\n float attenuation = 1.0;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float Rin = 1.0;\n float e = _light.attenuationExponent;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #endif\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-(pow(d,e));\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/(pow(d,e)), 0.0, 1.0);\n #endif\n #else\n float Rin = 0.0;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/d, 0.0, 1.0);\n #endif\n #else\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float d = clamp(dist/_light.outerRadius, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n attenuation = 1.0;\n #endif\n #endif\n #endif\n\n // Computer accumulators\n light_accumulator_ambient.rgb += _light.ambient * attenuation;\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP * attenuation;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n float pf = 0.0; // power factor for shiny speculars\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(-VP, _normal);\n float eyeDotR = max(0.0, dot(-normalize(_eyeToPoint), reflectVector));\n pf = pow(eyeDotR, material.shininess);\n }\n\n light_accumulator_specular.rgb += _light.specular * pf * attenuation;\n #endif\n}\n")}inject(){super.inject(),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT=0!==this.attenuation,j.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS=null!=this.radius&&null!=this.radius[0],j.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS=null!=this.radius}update(){this.updateEyePosition()}updateEyePosition(){if("world"===this.origin){const e=G.latLngToMeters([...this.position]);this.position_eye[0]=e[0]-this.view.camera.position_meters[0],this.position_eye[1]=e[1]-this.view.camera.position_meters[1],this.position_eye[2]=J.convertUnits(this.position[2],{zoom:this.view.zoom,meters_per_pixel:G.metersPerPixel(this.view.zoom)}),this.position_eye[2]=this.position_eye[2]-this.view.camera.position_meters[2]}else"ground"!==this.origin&&"camera"!==this.origin||(this.position_eye=J.convertUnits(this.position,{zoom:this.view.zoom,meters_per_pixel:G.metersPerPixel(this.view.zoom)}),"ground"===this.origin&&(this.position_eye[2]=this.position_eye[2]-this.view.camera.position_meters[2]));this.position_eye[3]=1}setupProgram(e){super.setupProgram(e),e.uniform("4fv",`u_${this.name}.position`,this.position_eye),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT&&e.uniform("1f",`u_${this.name}.attenuationExponent`,this.attenuation),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS&&e.uniform("1f",`u_${this.name}.innerRadius`,J.convertUnits(this.radius[0],{zoom:this.view.zoom,meters_per_pixel:G.metersPerPixel(this.view.zoom)})),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS&&e.uniform("1f",`u_${this.name}.outerRadius`,J.convertUnits(this.radius[1],{zoom:this.view.zoom,meters_per_pixel:G.metersPerPixel(this.view.zoom)}))}}ve.types.point=be,ve.types.spotlight=class extends be{constructor(e,t){super(e,t),this.type="spotlight",this.struct_name="SpotLight",this.direction=this._direction=(t.direction||[0,0,-1]).map(parseFloat),this.exponent=t.exponent?parseFloat(t.exponent):.2,this.angle=t.angle?parseFloat(t.angle):20}get direction(){return this._direction}set direction(e){this._direction=ye.normalize(ye.copy(e))}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct SpotLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec4 position;\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float attenuationExponent;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n float innerRadius;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float outerRadius;\n#endif\n\n vec3 direction;\n float spotCosCutoff;\n float spotExponent;\n};\n\nvoid calculateLight(in SpotLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n float dist = length(_light.position.xyz - _eyeToPoint);\n\n // Compute vector from surface to light position\n vec3 VP = (_light.position.xyz - _eyeToPoint) / dist;\n\n // normal . light direction\n float nDotVP = clamp(dot(_normal, VP), 0.0, 1.0);\n\n // Attenuation defaults\n float attenuation = 1.0;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float Rin = 1.0;\n float e = _light.attenuationExponent;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #endif\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-(pow(d,e));\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/(pow(d,e)), 0.0, 1.0);\n #endif\n #else\n float Rin = 0.0;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/d, 0.0, 1.0);\n #endif\n #else\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float d = clamp(dist/_light.outerRadius, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n attenuation = 1.0;\n #endif\n #endif\n #endif\n\n // spotlight attenuation factor\n float spotAttenuation = 0.0;\n\n // See if point on surface is inside cone of illumination\n float spotDot = clamp(dot(-VP, _light.direction), 0.0, 1.0);\n\n if (spotDot >= _light.spotCosCutoff) {\n spotAttenuation = pow(spotDot, _light.spotExponent);\n }\n\n light_accumulator_ambient.rgb += _light.ambient * attenuation * spotAttenuation;\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP * attenuation * spotAttenuation;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n // Power factor for shiny speculars\n float pf = 0.0;\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(-VP, _normal);\n float eyeDotR = max(dot(-normalize(_eyeToPoint), reflectVector), 0.0);\n pf = pow(eyeDotR, material.shininess);\n }\n light_accumulator_specular.rgb += _light.specular * pf * attenuation * spotAttenuation;\n #endif\n}\n")}setupProgram(e){super.setupProgram(e),e.uniform("3fv",`u_${this.name}.direction`,this.direction),e.uniform("1f",`u_${this.name}.spotCosCutoff`,Math.cos(3.14159*this.angle/180)),e.uniform("1f",`u_${this.name}.spotExponent`,this.exponent)}};class xe extends Error{constructor(e){super(),this.name="MethodNotImplemented",this.message="Method "+e+" must be implemented in subclass"}}class we{constructor(e,t){this.validate(e),this.config=e,this.sources=t,this.id=e.id,this.name=e.name,this.pad_scale=e.pad_scale||1e-5,this.default_winding=null,this.rasters=[],Array.isArray(e.rasters)&&e.rasters.forEach(e=>{-1===this.rasters.indexOf(e)&&this.rasters.push(e)}),this.preprocess=e.preprocess,"function"==typeof this.preprocess&&this.preprocess.bind(this),this.transform=e.transform,"function"==typeof this.transform&&this.transform.bind(this),this.extra_data=e.extra_data,this.scripts=e.scripts,this.setZooms(e),this.zoom_offset=null!=e.zoom_offset?e.zoom_offset:0,this.zoom_offset<0&&(_({level:"warn",once:!0},`Data source '${this.name}' zoom_offset must not be negative – setting to 0.`),this.zoom_offset=0),this.setTileSize(e.tile_size),this.min_display_zoom=Math.max(e.min_display_zoom||0,this.zooms[0]),this.max_display_zoom=null!=e.max_display_zoom?e.max_display_zoom:null}static register(e,t){e&&t&&(we.types[e]=t)}static create(e,t){if("function"==typeof we.types[e.type]){const r=we.types[e.type](e);if(r)return new r(e,t)}}static tileLayoutChanged(e,t){if(!e||!t)return!0;const r=["max_zoom","zooms","min_display_zoom","max_display_zoom","bounds","tile_size","zoom_offset"],n=S(e.config,r),i=S(t.config,r);return JSON.stringify(n)!==JSON.stringify(i)}static projectData(e){var t=+new Date;for(var r in e.layers)for(var n=e.layers[r].features.length,i=0;i<n;i++){var s=e.layers[r].features[i];G.transformGeometry(s.geometry,this.projectCoord)}void 0!==e.debug&&(e.debug.projection=+new Date-t)}static projectCoord(e){G.latLngToMeters(e)}static scaleData(e,{coords:{z:t},min:r}){let n=G.unitsPerMeter(t);for(var i in e.layers)for(var s=e.layers[i].features.length,o=0;o<s;o++){var a=e.layers[i].features[o];G.transformGeometry(a.geometry,e=>{e[0]=(e[0]-r.x)*n,e[1]=(e[1]-r.y)*n*-1})}}load(e){return e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=[...this.rasters],this._load(e).then(e=>{for(let t in e.source_data.layers){let r=e.source_data.layers[t];r&&r.features&&r.features.forEach(e=>{G.transformGeometry(e.geometry,e=>{e[1]=-e[1],this.pad_scale&&(e[0]=Math.round(e[0]*(1+this.pad_scale)-G.tile_scale*this.pad_scale/2),e[1]=Math.round(e[1]*(1+this.pad_scale)-G.tile_scale*this.pad_scale/2))}),this.updateDefaultWinding(e.geometry)})}return e.default_winding=this.default_winding||"CCW",e})}_load(){throw new xe("_load")}copyTileData(e,t){return _("trace",`Copy tile data from ${e.key} to ${t.key}`),t.source_data={layers:e.source_data.layers},t.rasters=[...e.rasters],t.pad_scale=e.pad_scale,t.default_winding=e.default_winding,t}setZooms({max_zoom:e,zooms:t}){if(this.max_zoom=null!=e?e:G.default_source_max_zoom,Array.isArray(t))this.zooms=t,this.max_zoom=this.zooms[this.zooms.length-1];else{this.zooms=[];for(let e=0;e<=this.max_zoom;e++)this.zooms[e]=e}}setTileSize(e){this.tile_size=e||256,("number"!=typeof this.tile_size||this.tile_size<256||!g.isPowerOf2(this.tile_size))&&(_({level:"warn",once:!0},`Data source '${this.name}': 'tile_size' parameter must be a number that is a power of 2 greater than or equal to 256, but was '${e}'`),this.tile_size=256),this.zoom_bias=Math.log2(this.tile_size)-8+this.zoom_offset}updateDefaultWinding(e){return null==this.default_winding&&("Polygon"===e.type?this.default_winding=G.ringWinding(e.coordinates[0]):"MultiPolygon"===e.type&&(this.default_winding=G.ringWinding(e.coordinates[0][0]))),this.default_winding}includesTile(e,t){if(e.z<this.min_display_zoom||null!=this.max_display_zoom&&t>this.max_display_zoom)return!1;for(let t=0;t<this.rasters.length;t++){const r=this.rasters[t];if(this.sources[r]&&this.sources[r]!==this&&!this.sources[r].includesTile(e,e.z))return!1}return!0}validate(){}}we.types={};let Ae=0;class Ee extends we{constructor(e,t){super(e,t),this.response_type="";let[r,n]=function(e,t){if(!t||0===Object.keys(t).length)return[e,[]];var r=e.indexOf("?"),n=e.indexOf("#"),i="";n>-1&&(i=e.slice(n),e=e.slice(0,n)),-1===r&&(r=e.length,e+="?"),r++;var s="",o=[];for(var a in t)""===A(a,e)?s+=`${a}=${t[a]}&`:o.push([a,t[a]]);return[e=e.slice(0,r)+s+e.slice(r)+i,o]}(e.url,e.url_params);this.url=r,n.forEach(([t,r])=>{_({level:"warn",once:!0},`Data source '${this.name}': parameter '${t}' already present in URL '${e.url}', skipping value '${t}=${r}' specified in 'url_params'`)}),e.request_headers&&"object"==typeof e.request_headers&&(this.request_headers=e.request_headers)}_load(e){let t=this.formatURL(this.url,e),r=e.source_data;return r.url=t,e.debug=e.debug||{},e.debug.network=+new Date,new Promise(n=>{let i=Ae+++"-"+t,s=g.io(t,6e4,this.response_type,"GET",this.request_headers,i);r.request_id=i,r.error=null,s.then(({body:t})=>{e.debug.response_size=t&&(t.length||t.byteLength),e.debug.network=+new Date-e.debug.network,e.debug.parsing=+new Date,null!=t&&"function"==typeof this.preprocess&&(t=this.preprocess(t)),(t=t instanceof Promise?t:Promise.resolve(t)).then(t=>{null!=t?this.parseSourceData(e,r,t):r.layers={},e.debug.parsing=+new Date-e.debug.parsing,n(e)})}).catch(t=>{r.error=t.stack,n(e)})})}validate(e){if("string"!=typeof e.url)throw Error("Network data source must provide a string `url` property")}formatURL(){throw new xe("formatURL")}parseSourceData(){throw new xe("parseSourceData")}}class Te extends Ee{constructor(e,t){super(e,t),this.tiled=!0,this.bounds=this.parseBounds(e),this.builds_geometry_tiles=!1,this.tms=!0===e.tms,this.url&&this.url.search("{s}")>-1&&(Array.isArray(e.url_subdomains)&&e.url_subdomains.length>0?(this.url_subdomains=e.url_subdomains,this.next_url_subdomain=0):_({level:"warn",once:!0},`Data source '${this.name}': source URL includes '{s}' subdomain marker ('${this.url}'), but no subdomains were specified in 'url_subdomains' parameter`)),this.url&&this.url.search("{r}")>-1&&(Array.isArray(e.url_density_scales)&&e.url_density_scales.length>0?this.url_density_scales=e.url_density_scales:this.url_density_scales=[1,2])}parseBounds(e){if(Array.isArray(e.bounds)&&4===e.bounds.length){const[t,r,n,i]=e.bounds;return{latlng:[...e.bounds],meters:{min:G.latLngToMeters([t,i]),max:G.latLngToMeters([n,r])},tiles:{min:{},max:{}}}}}checkBounds(e,t){if(t){e=G.wrapTile(e);let r=t.tiles.min[e.z];r||(r=t.tiles.min[e.z]=G.tileForMeters(t.meters.min,e.z));let n=t.tiles.max[e.z];if(n||(n=t.tiles.max[e.z]=G.tileForMeters(t.meters.max,e.z)),e.y<r.y||e.y>n.y)return!1;if(r.x<=n.x){if(e.x<r.x||e.x>n.x)return!1}else if(e.x>n.x&&e.x<r.x)return!1}return!0}includesTile(e,t){return!!super.includesTile(e,t)&&!!this.checkBounds(e,this.bounds)}formatURL(e,t){let r=G.wrapTile(t.coords,{x:!0});this.tms&&(r.y=Math.pow(2,r.z)-1-r.y);let n=e.replace("{x}",r.x).replace("{y}",r.y).replace("{z}",r.z).replace("{r}",this.getDensityModifier()).replace("{q}",this.toQuadKey(r));return null!=this.url_subdomains&&(n=n.replace("{s}",this.url_subdomains[this.next_url_subdomain]),this.next_url_subdomain=(this.next_url_subdomain+1)%this.url_subdomains.length),n}getDensityModifier(){if(this.url_density_scales){const e=g.device_pixel_ratio;let t=this.url_density_scales.filter(t=>e>=t).reverse()[0];if(t=null!=t?t:this.url_density_scales[0],t>1)return`@${t}x`}return""}toQuadKey({x:e,y:t,z:r}){let n="";for(let i=r;i>0;i--){let r=0,s=1<<i-1;e&s&&r++,t&s&&(r+=2),n+=r.toString()}return n}static urlHasTilePattern(e){return e&&(e.search("{x}")>-1&&e.search("{y}")>-1&&e.search("{z}")>-1||e.search("{q}")>-1)}}const Se={coord(e){return{x:e.x,y:e.y,z:e.z,key:this.coordKey(e)}},coordKey:({x:e,y:t,z:r})=>e+"/"+t+"/"+r,key(e,t,r){if(!(e.y<0||e.y>=1<<e.z||e.z<0))return[t.name,e.x,e.y,e.z,r].join("/")},normalizedKey(e,t,r){return this.key(this.normalizedCoord(e,t),t,r)},normalizedCoord(e,t){return t.zoom_bias&&(e=this.coordAtZoom(e,Math.max(e.z-t.zoom_bias,t.zooms[0]))),this.coordForTileZooms(e,t.zooms)},coordAtZoom({x:e,y:t,z:r},n){if(r!==(n=Math.max(0,n))){let i=Math.pow(2,r-n);e=Math.floor(e/i),t=Math.floor(t/i),r=n}return this.coord({x:e,y:t,z:r})},coordForTileZooms({x:e,y:t,z:r},n){const i=this.findZoomInRange(r,n);return i!==r?this.coordAtZoom({x:e,y:t,z:r},i):this.coord({x:e,y:t,z:r})},findZoomInRange:(e,t)=>t.filter(t=>e>=t).reverse()[0]||t[0],isDescendant(e,t){if(t.z>e.z){let{x:r,y:n}=this.coordAtZoom(t,e.z);return e.x===r&&e.y===n}return!1},parent({coords:e,source:t,style_z:r}){if(r>0){r--;const n=Math.max(r-t.zoom_bias,t.zooms[0]),i=this.coordForTileZooms(this.coordAtZoom(e,n),t.zooms);return i.z>r?null:{key:this.key(i,t,r),coords:i,style_z:r,source:t}}},children({coords:e,source:t,style_z:r},n={}){r++;const i=this.coordForTileZooms(this.coordAtZoom(e,r-t.zoom_bias),t.zooms);if(i.z===e.z)return[{key:this.key(i,t,r),coords:i,style_z:r,source:t}];{const s=this.key(i,t,r);if(n[t.id]=n[t.id]||{},null==n[t.id][s]){const o=Math.pow(2,i.z-e.z),a=e.x*o,l=e.y*o;let u=[];for(let e=a;e<a+o;e++)for(let n=l;n<l+o;n++){let s=this.coord({x:e,y:n,z:i.z});u.push({key:this.key(s,t,r),coords:s,style_z:r,source:t})}n[t.id][s]=u}return n[t.id][s]}}};class ke extends Te{constructor(e,t){super(e,t),-1===this.rasters.indexOf(this.name)&&this.rasters.unshift(this.name),this.filtering=e.filtering,this.textures={}}async load(e){e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=[...this.rasters];let t=G.tile_scale;return e.source_data.layers={_default:{type:"FeatureCollection",features:[{geometry:{type:"Polygon",coordinates:[[[0,0],[t,0],[t,-t],[0,-t],[0,0]]]},properties:{}}]}},e.default_winding="CW",e}async tileTexture(e){let t=this.adjustRasterTileZoom(e),r=t.key;if(!this.textures[r]){let e=this.formatURL(this.url,{coords:t});this.textures[r]={name:e,url:e,filtering:this.filtering,coords:t}}return this.textures[r]}adjustRasterTileZoom(e){let t=e.coords;const r=this.sources[e.source];if(r!==this){let n=this.zoom_bias-r.zoom_bias;n>0?t=Se.normalizedCoord(e.coords,{zoom_bias:n,zooms:this.zooms}):(n<0&&_({level:"warn",once:!0},`Raster source '${this.name}' supports higher zoom detail than source '${r.name}' it's attached to. Downsampling this source ${-n} extra zoom levels to match.`),t=Se.coordForTileZooms(t,this.zooms))}return t}}class Oe extends ke{constructor(e,t){super(e,t),this.load_image={},this.alpha=null!=e.alpha?Math.max(Math.min(e.alpha,1),0):null,this.mask_alpha=!0,this.preserve_tiles_within_zoom=0,this.max_display_density=e.max_display_density,Array.isArray(e.composite)?this.images=e.composite.map(e=>({url:e.url,bounds:this.parseBounds(e),alpha:null!=e.alpha?Math.max(Math.min(e.alpha,1),0):null})):this.images=[{url:this.url,bounds:this.bounds,alpha:this.alpha}]}async tileTexture(e,{blend:t,generation:r}){let n=this.adjustRasterTileZoom(e);const i="opaque"!==t,s=`raster-${this.name}-${n.key}-${i?"alpha":"opaque"}-${r}`;if(k.textures[s])return{name:s,coords:n,skip_create:!0};let o=g.device_pixel_ratio;this.max_display_density&&(o=Math.min(o,this.max_display_density)),o*=2;const a=document.createElement("canvas"),l=a.getContext("2d");a.width=this.tile_size*o,a.height=this.tile_size*o,l.imageSmoothingEnabled="nearest"!==this.filtering;const u=this.images.filter(t=>this.checkBounds(e.coords,t.bounds));return await Promise.all(u.map(t=>{const r=i?null!=t.alpha?t.alpha:this.alpha:1;return this.drawImage(t.url,t.bounds,r,e,o,l)})),{name:s,element:a,filtering:this.filtering,coords:n}}async drawImage(e,t,r,n,i,s){const o=N(e);this.load_image[o]=this.load_image[o]||this.loadImage(e);const a=await this.load_image[o],l=G.metersPerPixel(n.coords.z)/i/(this.tile_size/G.tile_size),u=(t.meters.min[0]-n.min.x)/l,c=-(t.meters.min[1]-n.min.y)/l,h=(t.meters.max[0]-t.meters.min[0])/l,d=-(t.meters.max[1]-t.meters.min[1])/l;s.globalAlpha=null!=r?r:1,s.drawImage(a,u,c,h,d)}loadImage(e){return new Promise(t=>{let r=new Image;r.onload=()=>t(r),r.onerror=r=>{_("warn",`Raster source '${this.name}': failed to load url: '${e}'`,r),t(null)},g.isSafari()&&"data:"===e.slice(0,5)||(r.crossOrigin="anonymous"),r.src=e})}includesTile(e,t){return!!we.prototype.includesTile.call(this,e,t)&&this.images.some(t=>this.checkBounds(e,t.bounds))}validate(e){let t="Raster data source must provide a string `url` parameter, or an array of `composite` raster ";t+="image objects that each have a `url` parameter";let r="Raster data source must provide a `bounds` parameter, or an array of `composite` raster ";if(r+="image objects that each have a `bounds` parameter",Array.isArray(e.composite)){if(e.composite.some(e=>"string"!=typeof e.url))throw Error(t);if(e.composite.some(e=>!(Array.isArray(e.bounds)&&4===e.bounds.length)))throw Error(r);if(null!=e.url||null!=e.bounds)throw Error("Raster data source must have *either* a single image specified as `url` and `bounds `parameters, or an array of `composite` raster image objects, each with `url` and `bounds`.")}else{if("string"!=typeof e.url)throw Error(t);if(!Array.isArray(e.bounds)||4!==e.bounds.length)throw Error(r)}}}function Re(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Ce(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Re(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Re(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}we.register("Raster",e=>ke.urlHasTilePattern(e.url)?ke:Oe);var Ne={init({generation:e,styles:t,sources:r={},introspection:n}={}){this.setGeneration(e),this.styles=t,this.sources=r,this.defines=Object.prototype.hasOwnProperty.call(this,"defines")&&this.defines||{},this.shaders=Object.prototype.hasOwnProperty.call(this,"shaders")&&this.shaders||{},this.introspection=n||!1,this.selection=this.selection||this.introspection||!1,this.compile_setup=!1,this.program=null,this.selection_program=null,this.feature_style={},this.vertex_template=[],this.tile_data={},this.stencil_proxy_tiles=!0,this.variants={},this.vertex_layouts={},this.defines.TANGRAM_WORLD_POSITION_WRAP=1e5,this.blend=this.blend||"opaque","opaque"!==this.blend?null==this.blend_order&&(this.blend_order=this.default_blend_orders[this.blend]):this.blend_order=this.default_blend_orders[this.blend],this.defines[`TANGRAM_BLEND_${this.blend.toUpperCase()}`]=!0,this.removeShaderBlock("setup"),this.material instanceof _e||(_e.isValid(this.material)||(this.material=J.defaults.material),this.material=new _e(this.material)),this.material.inject(this),ve.setMode(this.lighting,this),this.setupRasters(),this.setupCustomAttributes(),this.initialized=!0},destroy(){this.program&&(this.program.destroy(),this.program=null),this.selection_program&&(this.selection_program.destroy(),this.selection_program=null),a.removeTarget(this.main_thread_target),this.gl=null,this.initialized=!1},reset(){},baseStyle(){return this.base||this.name},setGeneration(e){this.generation=e,this.main_thread_target=["Style",this.name,this.generation].join("_"),t.is_main&&a.addTarget(this.main_thread_target,this)},startData(e){this.tile_data[e.id]=this.tile_data[e.id]||{meshes:{},uniforms:{},textures:[]}},async endData(e){var t=this.tile_data[e.id];if(this.tile_data[e.id]=null,t&&Object.keys(t.meshes).length>0){for(let e in t.meshes){let r=t.meshes[e];0!==r.vertex_data.vertex_count?(r.vertex_data.end(),r.vertex_elements=r.vertex_data.element_buffer,r.vertex_data=r.vertex_data.vertex_buffer):delete t.meshes[e]}return this.buildRasterTextures(e,t)}return null},hasDataForTile(e){return null!=this.tile_data[e.id]},getTileMesh(e,t){const r=this.tile_data[e.id].meshes;if(null==r[t.key]){const e=this.vertexLayoutForMeshVariant(t);r[t.key]={variant:t,vertex_data:e.createVertexData()}}return r[t.key]},vertexLayoutForMeshVariant(){},meshVariantTypeForDraw(){},addFeature(e,t,r){let n=r.tile;if(n.generation!==this.generation)return;this.tile_data[n.id]||this.startData(n);let i=this.parseFeature(e,t,r);i&&this.buildGeometry(e.geometry,i,r)>0&&(e.generation=this.generation)},buildGeometry(e,t,r){let n;if("Polygon"===e.type?n=this.buildPolygons([e.coordinates],t,r):"MultiPolygon"===e.type?n=this.buildPolygons(e.coordinates,t,r):"LineString"===e.type?n=this.buildLines([e.coordinates],t,r):"MultiLineString"===e.type?n=this.buildLines(e.coordinates,t,r):"Point"===e.type?n=this.buildPoints([e.coordinates],t,r):"MultiPoint"===e.type&&(n=this.buildPoints(e.coordinates,t,r)),n>0&&v.layer_stats){let e=r.tile;e.debug.layers=e.debug.layers||{list:{},tree:{}};let t=e.debug.layers.list,i=e.debug.layers.tree,s={};r.layers.forEach(e=>{Pe(t,e,1,n,{[this.name]:n},{[this.baseStyle()]:n});let r=i,o=s,a=e.split(":");for(let e=0;e<a.length;e++){let t=a[e];r[t]=r[t]||{features:0,geoms:0,styles:{},base:{}},null==o[t]&&(o[t]={},Pe(r,t,1,n,{[this.name]:n},{[this.baseStyle()]:n})),e<a.length-1&&(r[t].layers=r[t].layers||{}),r=r[t].layers,o=o[t]}})}return n},parseFeature(e,t,r){try{var n=this.feature_style;if(n.order=this.parseOrder(t.order,r),null==n.order&&"overlay"!==this.blend){let e=`Layer '${t.layers.join(", ")}', draw group '${t.group}': `;return e+="'order' parameter is required unless blend mode is 'overlay'",null!=t.order&&(e+="; 'order' was set to a dynamic value (e.g. string tied to feature property, ",e+="or JS function), but evaluated to null for one or more features"),void _({level:"warn",once:!0},e)}if(!(n=this._parseFeature(e,t,r)))return;if(this.shaders.attributes){n.attributes=n.attributes||{};for(const e in this.shaders.attributes)n.attributes[e]=J.evalCachedProperty(t.attributes&&t.attributes[e],r),"number"!=typeof n.attributes[e]&&(n.attributes[e]=0)}return this.selection?n.interactive=J.evalProperty(t.interactive,r):n.interactive=!1,!0===n.interactive?n.selection_color=he.makeColor(e,r.tile,r):n.selection_color=he.defaultColor,n}catch(t){_("error","Style.parseFeature: style parsing error",e,n,t.stack)}},_parseFeature(){return this.feature_style},preprocess(e){if(!e.preprocessed){if(this.draw)for(let t in this.draw){let r=this.draw[t];"object"!=typeof r||Array.isArray(r)?null==e[t]&&(e[t]=r):e[t]=V({},r,e[t])}if(this.selection?this.introspection&&(e.interactive=!0):e.interactive=!1,!(e=this._preprocess(e)))return;if(this.shaders.attributes){e.attributes=e.attributes||{};for(const t in this.shaders.attributes)e.attributes[t]=J.createPropertyCache(null!=e.attributes[t]?e.attributes[t]:0)}e.preprocessed=!0}return e},_preprocess:e=>e,parseOrder:(e,t)=>"number"!=typeof e?J.calculateOrder(e,t):e,scaleOrder:e=>2*e,parseColor(e,t){return e?J.evalCachedColorProperty(e,t):this.shaders.blocks.color||this.shaders.blocks.filter?J.defaults.color:void 0},buildPolygons:()=>0,buildLines:()=>0,buildPoints:()=>0,setGL(e){this.gl=e,this.max_texture_size=k.getMaxTextureSize(this.gl)},makeMesh(e,t,r={}){let n=this.vertexLayoutForMeshVariant(r.variant);return v.wireframe?(t=function(e){const t=new Uint16Array(2*e.length);for(let r=0;r<e.length;r+=3)t.set([e[r],e[r+1],e[r+1],e[r+2],e[r+2],e[r]],2*r);return t}(t),new pe(this.gl,e,t,n,Ce(Ce({},r),{},{draw_mode:this.gl.LINES}))):new pe(this.gl,e,t,n,r)},render:e=>e.render(),getProgram(e="program"){this.compileSetup();const t=this[e];if(t&&!t.error){if(!t.compiled){_("debug",`Compiling style '${this.name}', program key '${e}'`);try{t.compile()}catch(t){throw _("error",`Style: error compiling program for style '${this.name}' (program key '${e}')`,this,t.stack,t.type,t.shader_errors),t}}return t}},compileSetup(){if(!this.compile_setup){if(!this.gl)throw new Error(`style.compile(): skipping for ${this.name} because no GL context`);var e=this.buildDefineList();if(this.selection){var t=Object.assign({},e);t.TANGRAM_FEATURE_SELECTION=!0}var r=this.shaders&&this.shaders.blocks,n=this.shaders&&this.shaders.block_scopes,i=Object.assign({},this.shaders&&this.shaders.uniforms);for(let e in i)null==i[e]&&_({level:"warn",once:!0},`Style '${this.name}' has invalid uniform '${e}': uniform values must be non-null`);var s=this.shaders&&this.shaders.extensions;"string"==typeof s&&(s=[s]),this.program=new j(this.gl,this.vertex_shader_src,this.fragment_shader_src,{name:this.name,defines:e,uniforms:i,blocks:r,block_scopes:n,extensions:s}),this.selection?this.selection_program=new j(this.gl,this.vertex_shader_src,"// Fragment shader for feature selection passes\n// Renders in silhouette according to selection (picking) color, or black if none defined\n\n#ifdef TANGRAM_FEATURE_SELECTION\n varying vec4 v_selection_color;\n#endif\n\nvoid main (void) {\n #ifdef TANGRAM_FEATURE_SELECTION\n gl_FragColor = v_selection_color;\n #else\n gl_FragColor = vec4(0., 0., 0., 1.);\n #endif\n}\n",{name:this.name+" (selection)",defines:t,uniforms:i,blocks:r,block_scopes:n,extensions:s}):this.selection_program=null,this.compile_setup=!0}},addShaderBlock(e,t,r=null){this.shaders.blocks=this.shaders.blocks||{},this.shaders.blocks[e]=this.shaders.blocks[e]||[],this.shaders.blocks[e].push(t),this.shaders.block_scopes=this.shaders.block_scopes||{},this.shaders.block_scopes[e]=this.shaders.block_scopes[e]||[],this.shaders.block_scopes[e].push(r)},removeShaderBlock(e){this.shaders.blocks&&(this.shaders.blocks[e]=null),this.shaders.block_scopes&&(this.shaders.block_scopes[e]=null)},replaceShaderBlock(e,t,r=null){this.removeShaderBlock(e),this.addShaderBlock(e,t,r)},buildDefineList(){var e={};if(null!=this.defines)for(var t in this.defines)e[t]=this.defines[t];if(null!=this.shaders&&null!=this.shaders.defines)for(t in this.shaders.defines)e[t]=this.shaders.defines[t];return e},hasRasters(){return["color","normal","custom"].indexOf(this.raster)>-1},setupRasters(){if(!this.hasRasters())return;"color"===this.raster?this.defines.TANGRAM_RASTER_TEXTURE_COLOR=!0:"normal"===this.raster&&(this.defines.TANGRAM_RASTER_TEXTURE_NORMAL=!0);let e=Object.keys(this.sources).filter(e=>this.sources[e]instanceof ke).length;if(this.defines.TANGRAM_NUM_RASTER_SOURCES=`${e}`,e>0){const t=Object.keys(this.sources).filter(e=>this.sources[e].mask_alpha).length;this.defines.TANGRAM_HAS_MASKED_RASTERS=t>0,this.defines.TANGRAM_ALL_MASKED_RASTERS=t===e,this.defines.TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING=!0,this.replaceShaderBlock("raster","// Uniforms defining raster textures and macros for accessing them\n\n#ifdef TANGRAM_FRAGMENT_SHADER\nuniform sampler2D u_rasters[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture samplers\nuniform vec2 u_raster_sizes[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture sizes (width/height in pixels)\nuniform vec3 u_raster_offsets[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture UV starting offset for tile\n\n// Raster sources can optionally mask by the alpha channel (render with only full or no alpha, based on a threshold),\n// which is used for handling transparency outside the raster image when rendering with opaque blending\n#if defined(TANGRAM_HAS_MASKED_RASTERS) && !defined(TANGRAM_ALL_MASKED_RASTERS) // only add uniform if we need it\nuniform bool u_raster_mask_alpha;\n#endif\n\n// Note: the raster accessors below are #defines rather than functions to\n// avoid issues with constant integer expressions for array indices\n\n// Adjusts UVs in model space to account for raster tile texture overzooming\n// (applies scale and offset adjustments)\n#define adjustRasterUV(raster_index, uv) \\\n ((uv) * u_raster_offsets[raster_index].z + u_raster_offsets[raster_index].xy)\n\n// Returns the UVs of the current model position for a raster sampler\n#define currentRasterUV(raster_index) \\\n (adjustRasterUV(raster_index, v_modelpos_base_zoom.xy))\n\n// Returns pixel location in raster tile texture at current model position\n#define currentRasterPixel(raster_index) \\\n (currentRasterUV(raster_index) * rasterPixelSize(raster_index))\n\n// Samples a raster tile texture for the current model position\n#define sampleRaster(raster_index) \\\n (texture2D(u_rasters[raster_index], currentRasterUV(raster_index)))\n\n// Samples a raster tile texture for a given pixel\n#define sampleRasterAtPixel(raster_index, pixel) \\\n (texture2D(u_rasters[raster_index], (pixel) / rasterPixelSize(raster_index)))\n\n// Returns size of raster sampler in pixels\n#define rasterPixelSize(raster_index) \\\n (u_raster_sizes[raster_index])\n\n#endif\n","Raster")}},async buildRasterTextures(e,t){if(!this.hasRasters())return t;if(0===e.rasters.length)return t;let r;try{r=await a.postMessage(`${this.main_thread_target}.loadTextures`,{coords:e.coords,source:e.source,rasters:e.rasters,min:e.min,max:e.max})}catch(e){return t}if(!r||r.length<1)return t;if(r.some(e=>!e.loaded))return null;t.uniforms.u_raster_mask_alpha=!0===this.sources[e.rasters[0]].mask_alpha;const n=t.uniforms.u_rasters=[],i=t.uniforms.u_raster_sizes=[],s=t.uniforms.u_raster_offsets=[];return r.forEach(r=>{const o=r.index;if(n[o]=r.name,t.textures.push(r.name),i[o]=[r.width,r.height],e.coords.z>r.coords.z){let t=e.coords.z-r.coords.z,n=Math.pow(2,t);s[o]=[(e.coords.x%n+n)%n/n,(n-1-e.coords.y%n)/n,1/n]}else s[o]=[0,0,1]}),t},async loadTextures(e){let t={},r={},n=[];e.rasters.map(e=>this.sources[e]).filter(e=>e).forEach((i,s)=>{i instanceof ke&&n.push(i.tileTexture(e,this).then(e=>{t[e.name]=e,r[e.name]=s}))}),await Promise.all(n),await k.createFromObject(this.gl,t);let i=await Promise.all(Object.keys(t).map(e=>k.textures[e]&&k.textures[e].load()).filter(e=>e));return i.forEach(e=>e.retain()),i.map(e=>({name:e.name,width:e.width,height:e.height,loaded:e.loaded,index:r[e.name],coords:t[e.name].coords}))},setupCustomAttributes(){if(this.shaders.attributes)for(const[e,t]of Object.entries(this.shaders.attributes))"float"===t.type&&(!1!==t.varying?(this.addShaderBlock("attributes",`\n #ifdef TANGRAM_VERTEX_SHADER\n attribute float a_${e};\n varying float v_${e};\n #define ${e} a_${e}\n #else\n varying float v_${e};\n #define ${e} v_${e}\n #endif\n `),this.addShaderBlock("setup",`#ifdef TANGRAM_VERTEX_SHADER\nv_${e} = a_${e};\n#endif`)):this.addShaderBlock("attributes",`\n #ifdef TANGRAM_VERTEX_SHADER\n attribute float a_${e};\n #define ${e} a_${e}\n #endif\n `))},addCustomAttributesToAttributeList(e){if(this.shaders.attributes)for(const[t,r]of Object.entries(this.shaders.attributes))"float"===r.type&&e.push({name:`a_${t}`,size:1,type:fe.FLOAT,normalized:!1});return e},addCustomAttributesToVertexTemplate(e,t){if(this.shaders.attributes)for(let r in this.shaders.attributes)this.vertex_template[t++]=null!=e.attributes[r]?e.attributes[r]:0},setup(){this.setUniforms(),this.material.setupProgram(j.current)},setUniforms(){var e,t=j.current;t&&t.setUniforms(null===(e=this.shaders)||void 0===e?void 0:e.uniforms,!0)},render_states:{opaque:{depth_test:!0,depth_write:!0},translucent:{depth_test:!0,depth_write:!0},add:{depth_test:!0,depth_write:!1},multiply:{depth_test:!0,depth_write:!1},inlay:{depth_test:!0,depth_write:!1},overlay:{depth_test:!1,depth_write:!1}},default_blend_orders:{opaque:Number.MIN_SAFE_INTEGER,add:1,multiply:2,inlay:3,translucent:4,overlay:5},getBlendOrderForDraw(e){return"opaque"!==this.blend&&null!=e.blend_order?e.blend_order:this.blend_order}};function Pe(e,t,r,n,i,s){e[t]=e[t]||{features:0,geoms:0,styles:{},base:{}},e[t].features+=r,e[t].geoms+=n;for(let r in i)e[t].styles[r]=e[t].styles[r]||0,e[t].styles[r]+=i[r];for(let r in s)e[t].base[r]=e[t].base[r]||0,e[t].base[r]+=s[r]}let Me=Math.pow(2,16)-1,De=!1;class ze{constructor(){this.array=[],this.has_overflown=!1}push(e){this.has_overflown&&!De||e>Me&&(this.has_overflown=!0,!De)||this.array.push(e)}end(){if(this.array.length){let t=(e=this.array,new(this.has_overflown&&De?Uint32Array:Uint16Array)(e));return this.array=[],this.has_overflown=!1,t}return!1;var e}}ze.setElementIndexUint=function(e){De=e};let Ie={[fe.FLOAT]:Float32Array,[fe.BYTE]:Int8Array,[fe.UNSIGNED_BYTE]:Uint8Array,[fe.INT]:Int32Array,[fe.UNSIGNED_INT]:Uint32Array,[fe.SHORT]:Int16Array,[fe.UNSIGNED_SHORT]:Uint16Array};class Fe{constructor(e,{prealloc:t=500}={}){this.vertex_layout=e,this.vertex_elements=new ze,this.stride=this.vertex_layout.stride,Fe.array_pool.length>0?(this.vertex_buffer=Fe.array_pool.pop(),this.byte_length=this.vertex_buffer.byteLength,this.size=Math.floor(this.byte_length/this.stride),_("trace",`VertexData: reused buffer of bytes ${this.byte_length}, ${this.size} vertices`)):(this.size=t,this.byte_length=this.stride*this.size,this.vertex_buffer=new Uint8Array(this.byte_length)),this.offset=0,this.vertex_count=0,this.realloc_count=0,this.setBufferViews(),this.setAddVertexFunction()}setBufferViews(){this.views={},this.views[fe.UNSIGNED_BYTE]=this.vertex_buffer,this.vertex_layout.dynamic_attribs.forEach(e=>{if(null==this.views[e.type]){var t=Ie[e.type];this.views[e.type]=new t(this.vertex_buffer.buffer)}})}checkBufferSize(){if(this.offset+this.stride>this.byte_length){this.size=Math.floor(1.5*this.size),this.size-=this.size%4,this.byte_length=this.stride*this.size;var e=new Uint8Array(this.byte_length);e.set(this.vertex_buffer),Fe.array_pool.push(this.vertex_buffer),this.vertex_buffer=e,this.setBufferViews(),this.realloc_count++}}setAddVertexFunction(){this.vertexLayoutAddVertex=this.vertex_layout.getAddVertexFunction()}addVertex(e){this.checkBufferSize(),this.vertexLayoutAddVertex(e,this.views,this.offset),this.offset+=this.stride,this.vertex_count++}end(){return this.vertex_buffer=this.vertex_buffer.subarray(0,this.offset),this.element_buffer=this.vertex_elements.end(),_("trace",`VertexData: ${this.size} vertices total, realloc count ${this.realloc_count}`),this}}Fe.array_pool=[];class Le{constructor(e){this.attribs=e,this.dynamic_attribs=this.attribs.filter(e=>null==e.static),this.static_attribs=this.attribs.filter(e=>null!=e.static),this.components=[],this.index={},this.offset={},this.stride=0;let t=0,r=0;for(let e=0;e<this.attribs.length;e++){let n=this.attribs[e];if(null==n.static){n.offset=this.stride,n.byte_size=n.size;let e=0;switch(n.type){case fe.FLOAT:case fe.INT:case fe.UNSIGNED_INT:n.byte_size*=4,e=2;break;case fe.SHORT:case fe.UNSIGNED_SHORT:n.byte_size*=2,e=1}3&n.byte_size&&(n.byte_size+=4-(3&n.byte_size)),this.stride+=n.byte_size;let i=n.offset>>e;for(let t=0;t<n.size;t++)this.components.push({type:n.type,shift:e,offset:i++,index:r++});this.index[n.name]=t,t+=n.size,this.offset[n.name]=n.offset}else n.static=Array.isArray(n.static)?n.static:[n.static],n.method=`vertexAttrib${n.static.length}fv`}}enableDynamicAttributes(e,t){for(const t in Le.enabled_attribs)e.disableVertexAttribArray(t);Le.enabled_attribs={},this.dynamic_attribs.forEach(r=>{const n=t.attribute(r.name).location;-1!==n&&(e.enableVertexAttribArray(n),e.vertexAttribPointer(n,r.size,r.type,r.normalized,this.stride,r.offset),Le.enabled_attribs[n]=t)})}enableStaticAttributes(e,t){this.static_attribs.forEach(r=>{const n=t.attribute(r.name).location;-1!==n&&e[r.method]instanceof Function&&(e.enableVertexAttribArray(n),e[r.method](n,r.static),e.disableVertexAttribArray(n))})}createVertexData(){return new Fe(this)}getAddVertexFunction(){return null==this.addVertex&&this.createAddVertexFunction(),this.addVertex}createAddVertexFunction(){let e=N(JSON.stringify(this.attribs));if(null==Le.add_vertex_funcs[e]){let t,r=["var t, o;"],n=[...this.components];n.sort((e,t)=>e.type!==t.type?e.type-t.type:e.index-t.index);for(let e=0;e<n.length;e++){let i=n[e];t!==i.type&&(r.push(`t = vs[${i.type}];`),r.push(`o = off${i.shift?" >> "+i.shift:""};`),t=i.type),r.push(`t[o + ${i.offset}] = v[${i.index}];`)}r=r.join("\n");let i=new Function("v","vs","off",r);Le.add_vertex_funcs[e]=i}this.addVertex=Le.add_vertex_funcs[e]}}Le.enabled_attribs={},Le.add_vertex_funcs={};const je=[{x:0,y:0},{x:G.tile_scale,y:-G.tile_scale}],Ue=[0,0,1,1];function Be(e,t,r){let n=je[0],i=je[1];return e[0]<=n.x+r&&t[0]<=n.x+r||e[0]>=i.x-r&&t[0]>=i.x-r||e[1]>=n.y-r&&t[1]>=n.y-r||e[1]<=i.y+r&&t[1]<=i.y+r}function Ve(e,t){t=t||0;let r=je[0],n=je[1];return e[0]<=r.x+t||e[0]>=n.x-t||e[1]>=r.y-t||e[1]<=n.y+t}var Ge,$e={exports:{}},qe=function(){if(Ge)return $e.exports;function e(e,i,s){s=s||2;var o,a,c,h,f,p,m,_=i&&i.length,g=_?i[0]*s:e.length,y=t(e,0,g,s,!0),v=[];if(!y||y.next===y.prev)return v;if(_&&(y=function(e,n,i,s){var o,a,c,h=[];for(o=0,a=n.length;o<a;o++)(c=t(e,n[o]*s,o<a-1?n[o+1]*s:e.length,s,!1))===c.next&&(c.steiner=!0),h.push(d(c));for(h.sort(l),o=0;o<h.length;o++)u(h[o],i),i=r(i,i.next);return i}(e,i,y,s)),e.length>80*s){o=c=e[0],a=h=e[1];for(var b=s;b<g;b+=s)(f=e[b])<o&&(o=f),(p=e[b+1])<a&&(a=p),f>c&&(c=f),p>h&&(h=p);m=0!==(m=Math.max(c-o,h-a))?1/m:0}return n(y,v,s,o,a,m),v}function t(e,t,r,n,i){var s,o;if(i===T(e,t,r,n)>0)for(s=t;s<r;s+=n)o=w(s,e[s],e[s+1],o);else for(s=r-n;s>=t;s-=n)o=w(s,e[s],e[s+1],o);return o&&_(o,o.next)&&(A(o),o=o.next),o}function r(e,t){if(!e)return e;t||(t=e);var r,n=e;do{if(r=!1,n.steiner||!_(n,n.next)&&0!==m(n.prev,n,n.next))n=n.next;else{if(A(n),(n=t=n.prev)===n.next)break;r=!0}}while(r||n!==t);return t}function n(e,t,l,u,c,d,f){if(e){!f&&d&&function(e,t,r,n){var i=e;do{null===i.z&&(i.z=h(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,r,n,i,s,o,a,l,u=1;do{for(r=e,e=null,s=null,o=0;r;){for(o++,n=r,a=0,t=0;t<u&&(a++,n=n.nextZ);t++);for(l=u;a>0||l>0&&n;)0!==a&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,a--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:e=i,i.prevZ=s,s=i;r=n}s.nextZ=null,u*=2}while(o>1)}(i)}(e,u,c,d);for(var p,m,_=e;e.prev!==e.next;)if(p=e.prev,m=e.next,d?s(e,u,c,d):i(e))t.push(p.i/l),t.push(e.i/l),t.push(m.i/l),A(e),e=m.next,_=m.next;else if((e=m)===_){f?1===f?n(e=o(r(e),t,l),t,l,u,c,d,2):2===f&&a(e,t,l,u,c,d):n(r(e),t,l,u,c,d,1);break}}}function i(e){var t=e.prev,r=e,n=e.next;if(m(t,r,n)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(f(t.x,t.y,r.x,r.y,n.x,n.y,i.x,i.y)&&m(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function s(e,t,r,n){var i=e.prev,s=e,o=e.next;if(m(i,s,o)>=0)return!1;for(var a=i.x<s.x?i.x<o.x?i.x:o.x:s.x<o.x?s.x:o.x,l=i.y<s.y?i.y<o.y?i.y:o.y:s.y<o.y?s.y:o.y,u=i.x>s.x?i.x>o.x?i.x:o.x:s.x>o.x?s.x:o.x,c=i.y>s.y?i.y>o.y?i.y:o.y:s.y>o.y?s.y:o.y,d=h(a,l,t,r,n),p=h(u,c,t,r,n),_=e.prevZ,g=e.nextZ;_&&_.z>=d&&g&&g.z<=p;){if(_!==e.prev&&_!==e.next&&f(i.x,i.y,s.x,s.y,o.x,o.y,_.x,_.y)&&m(_.prev,_,_.next)>=0)return!1;if(_=_.prevZ,g!==e.prev&&g!==e.next&&f(i.x,i.y,s.x,s.y,o.x,o.y,g.x,g.y)&&m(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;_&&_.z>=d;){if(_!==e.prev&&_!==e.next&&f(i.x,i.y,s.x,s.y,o.x,o.y,_.x,_.y)&&m(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;g&&g.z<=p;){if(g!==e.prev&&g!==e.next&&f(i.x,i.y,s.x,s.y,o.x,o.y,g.x,g.y)&&m(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function o(e,t,n){var i=e;do{var s=i.prev,o=i.next.next;!_(s,o)&&g(s,i,i.next,o)&&b(s,o)&&b(o,s)&&(t.push(s.i/n),t.push(i.i/n),t.push(o.i/n),A(i),A(i.next),i=e=o),i=i.next}while(i!==e);return r(i)}function a(e,t,i,s,o,a){var l=e;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&p(l,u)){var c=x(l,u);return l=r(l,l.next),c=r(c,c.next),n(l,t,i,s,o,a),void n(c,t,i,s,o,a)}u=u.next}l=l.next}while(l!==e)}function l(e,t){return e.x-t.x}function u(e,t){if(t=function(e,t){var r,n=t,i=e.x,s=e.y,o=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){var a=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>o){if(o=a,a===i){if(s===n.y)return n;if(s===n.next.y)return n.next}r=n.x<n.next.x?n:n.next}}n=n.next}while(n!==t);if(!r)return null;if(i===o)return r;var l,u=r,h=r.x,d=r.y,p=1/0;n=r;do{i>=n.x&&n.x>=h&&i!==n.x&&f(s<d?i:o,s,h,d,s<d?o:i,s,n.x,n.y)&&(l=Math.abs(s-n.y)/(i-n.x),b(n,e)&&(l<p||l===p&&(n.x>r.x||n.x===r.x&&c(r,n)))&&(r=n,p=l)),n=n.next}while(n!==u);return r}(e,t),t){var n=x(t,e);r(t,t.next),r(n,n.next)}}function c(e,t){return m(e.prev,e,t.prev)<0&&m(t.next,e,e.next)<0}function h(e,t,r,n,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function d(e){var t=e,r=e;do{(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next}while(t!==e);return r}function f(e,t,r,n,i,s,o,a){return(i-o)*(t-a)-(e-o)*(s-a)>=0&&(e-o)*(n-a)-(r-o)*(t-a)>=0&&(r-o)*(s-a)-(i-o)*(n-a)>=0}function p(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&g(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&(b(e,t)&&b(t,e)&&function(e,t){var r=e,n=!1,i=(e.x+t.x)/2,s=(e.y+t.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&i<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==e);return n}(e,t)&&(m(e.prev,e,t.prev)||m(e,t.prev,t))||_(e,t)&&m(e.prev,e,e.next)>0&&m(t.prev,t,t.next)>0)}function m(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function _(e,t){return e.x===t.x&&e.y===t.y}function g(e,t,r,n){var i=v(m(e,t,r)),s=v(m(e,t,n)),o=v(m(r,n,e)),a=v(m(r,n,t));return i!==s&&o!==a||!(0!==i||!y(e,r,t))||!(0!==s||!y(e,n,t))||!(0!==o||!y(r,e,n))||!(0!==a||!y(r,t,n))}function y(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function v(e){return e>0?1:e<0?-1:0}function b(e,t){return m(e.prev,e,e.next)<0?m(e,t,e.next)>=0&&m(e,e.prev,t)>=0:m(e,t,e.prev)<0||m(e,e.next,t)<0}function x(e,t){var r=new E(e.i,e.x,e.y),n=new E(t.i,t.x,t.y),i=e.next,s=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,s.next=n,n.prev=s,n}function w(e,t,r,n){var i=new E(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function A(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function E(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function T(e,t,r,n){for(var i=0,s=t,o=r-n;s<r;s+=n)i+=(e[o]-e[s])*(e[s+1]+e[o+1]),o=s;return i}return Ge=1,$e.exports=e,$e.exports.default=e,e.deviation=function(e,t,r,n){var i=t&&t.length,s=i?t[0]*r:e.length,o=Math.abs(T(e,0,s,r));if(i)for(var a=0,l=t.length;a<l;a++){var u=t[a]*r,c=a<l-1?t[a+1]*r:e.length;o-=Math.abs(T(e,u,c,r))}var h=0;for(a=0;a<n.length;a+=3){var d=n[a]*r,f=n[a+1]*r,p=n[a+2]*r;h+=Math.abs((e[d]-e[p])*(e[f+1]-e[d+1])-(e[d]-e[f])*(e[p+1]-e[d+1]))}return 0===o&&0===h?0:Math.abs((h-o)/o)},e.flatten=function(e){for(var t=e[0][0].length,r={vertices:[],holes:[],dimensions:t},n=0,i=0;i<e.length;i++){for(var s=0;s<e[i].length;s++)for(var o=0;o<t;o++)r.vertices.push(e[i][s][o]);i>0&&(n+=e[i-1].length,r.holes.push(n))}return r},$e.exports}(),We=P(qe);function He(e,t,r=0,n=e.length-1,i=Ke){for(;n>r;){if(n-r>600){const s=n-r+1,o=t-r+1,a=Math.log(s),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);He(e,t,Math.max(r,Math.floor(t-o*l/s+u)),Math.min(n,Math.floor(t+(s-o)*l/s+u)),i)}const s=e[t];let o=r,a=n;for(Ze(e,r,t),i(e[n],s)>0&&Ze(e,r,n);o<a;){for(Ze(e,o,a),o++,a--;i(e[o],s)<0;)o++;for(;i(e[a],s)>0;)a--}0===i(e[r],s)?Ze(e,r,a):(a++,Ze(e,a,n)),a<=t&&(r=a+1),t<=a&&(n=a-1)}}function Ze(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function Ke(e,t){return e<t?-1:e>t?1:0}const Xe=[0,0,1];function Ye(e,t,r,{texcoord_index:n,texcoord_scale:i,texcoord_normalize:s}){let o,a,l,u,c,h,d,f,p,m,_,g,y=t.vertex_elements,v=e.length,b=0;n&&(s=s||1,[o,a,l,u]=i||Ue);for(let i=0;i<v;i++){const v=500;let w=e[i];w.length>v&&(w=[...w],He(w,v,1,w.length-1,(e,t)=>t.area-e.area),w=w.slice(0,v));const A=(x=We.flatten(w),We(x.vertices,x.holes,x.dimensions)),E=A.length,T=t.vertex_count;if(E){n&&([c,h,d,f]=G.findBoundingBox(w),p=d-c,m=f-h,_=(l-o)/p,g=(u-a)/m);for(let e=0;e<w.length;e++){let i=w[e];for(let e=0;e<i.length;e++){let l=i[e];r[0]=l[0],r[1]=l[1],n&&(r[n+0]=((l[0]-c)*_+o)*s,r[n+1]=((l[1]-h)*g+a)*s),t.addVertex(r)}}for(let e=0;e<E;e++)y.push(T+A[e]);b+=E/3}}var x;return b}var Qe='uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_tile_proxy_order_offset;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\n\nuniform mat4 u_model;\nuniform mat4 u_modelView;\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nattribute vec4 a_position;\nattribute vec4 a_color;\n\n// Optional normal attribute, otherwise default to up\n#ifdef TANGRAM_NORMAL_ATTRIBUTE\n attribute vec3 a_normal;\n #define TANGRAM_NORMAL a_normal\n#else\n #define TANGRAM_NORMAL vec3(0., 0., 1.)\n#endif\n\n// Optional dynamic line extrusion\n#ifdef TANGRAM_EXTRUDE_LINES\n attribute vec2 a_extrude; // extrusion direction in xy plane\n attribute vec2 a_offset; // offset direction in xy plane\n\n // Polygon and line styles have slightly different VBO layouts, saving memory by optimizing vertex packing.\n // All lines have a width scaling factor, but only some have a height (position.z) or offset.\n // The vertex height is stored in different attributes to account for this.\n attribute vec2 a_z_and_offset_scale; // stores vertex height in x, and offset scaling factor in y\n #define TANGRAM_POSITION_Z a_z_and_offset_scale.x // vertex height is stored in separate line-specific attrib\n #define TANGRAM_OFFSET_SCALING a_z_and_offset_scale.y // zoom scaling factor for line offset\n #define TANGRAM_WIDTH_SCALING a_position.z // zoom scaling factor for line width (stored in position attrib)\n\n uniform float u_v_scale_adjust; // scales texture UVs for line dash patterns w/fractional pixel width\n#else\n #define TANGRAM_POSITION_Z a_position.z // vertex height\n#endif\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n// Optional texture UVs\n#if defined(TANGRAM_TEXTURE_COORDS) || defined(TANGRAM_EXTRUDE_LINES)\n attribute vec2 a_texcoord;\n varying vec2 v_texcoord;\n#endif\n\n// Optional model position varying for tile coordinate zoom\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(TANGRAM_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#define TANGRAM_UNPACK_SCALING(x) (x / 1024.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main() {\n // Initialize globals\n #pragma tangram: setup\n\n // Texture UVs\n #ifdef TANGRAM_TEXTURE_COORDS\n v_texcoord = a_texcoord;\n #ifdef TANGRAM_EXTRUDE_LINES\n v_texcoord.y *= u_v_scale_adjust;\n #endif\n #endif\n\n // Pass model position to fragment shader\n #ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n v_modelpos_base_zoom = modelPositionBaseZoom();\n #endif\n\n // Position\n vec4 position = vec4(a_position.xy, TANGRAM_POSITION_Z / TANGRAM_HEIGHT_SCALE, 1.); // convert height back to meters\n\n #ifdef TANGRAM_EXTRUDE_LINES\n vec2 _extrude = a_extrude.xy;\n vec2 _offset = a_offset.xy;\n\n // Adjust line width based on zoom level, to prevent proxied lines\n // from being either too small or too big.\n // "Flattens" the zoom between 1-2 to peg it to 1 (keeps lines from\n // prematurely shrinking), then interpolate and clamp to 4 (keeps lines\n // from becoming too small when far away).\n float _dz = clamp(u_map_position.z - u_tile_origin.z, 0., 4.);\n _dz += step(1., _dz) * (1. - _dz) + mix(0., 2., clamp((_dz - 2.) / 2., 0., 1.));\n\n // Interpolate line width between zooms\n float _mdz = (_dz - 0.5) * 2.; // zoom from mid-point\n _extrude -= _extrude * TANGRAM_UNPACK_SCALING(TANGRAM_WIDTH_SCALING) * _mdz;\n\n // Interpolate line offset between zooms\n // Scales from the larger value to the smaller one\n float _dwdz = TANGRAM_UNPACK_SCALING(TANGRAM_OFFSET_SCALING);\n float _sdwdz = sign(step(0., _dwdz) - 0.5); // sign indicates "direction" of scaling\n _offset -= _offset * abs(_dwdz) * ((1.-step(0., _sdwdz)) - (_dz * -_sdwdz)); // scale "up" or "down"\n\n // Scale line width and offset to be consistent in screen space\n float _ssz = exp2(-_dz - (u_tile_origin.z - u_tile_origin.w));\n _extrude *= _ssz;\n _offset *= _ssz;\n\n // Modify line width before extrusion\n #ifdef TANGRAM_BLOCK_WIDTH\n float width = 1.;\n #pragma tangram: width\n _extrude *= width;\n #endif\n\n position.xy += _extrude + _offset;\n #endif\n\n // World coordinates for 3d procedural textures\n v_world_position = wrapWorldPosition(u_model * position);\n\n // Adjust for tile and view position\n position = u_modelView * position;\n\n // Modify position before camera projection\n #pragma tangram: position\n\n // Setup varyings\n v_position = position;\n v_normal = normalize(u_normalMatrix * TANGRAM_NORMAL);\n v_color = a_color;\n\n #if defined(TANGRAM_LIGHTING_VERTEX)\n // Vertex lighting\n vec3 normal = v_normal;\n\n // Modify normal before lighting\n #pragma tangram: normal\n\n // Pass lighting intensity to fragment shader\n v_lighting = calculateLighting(position.xyz - u_eye, normal, vec4(1.));\n #endif\n\n // Camera\n cameraProjection(position);\n\n // +1 is to keep all layers including proxies > 0\n applyLayerOrder(a_position.w + u_tile_proxy_order_offset + 1., position);\n\n gl_Position = position;\n}\n',Je="uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n#ifdef TANGRAM_EXTRUDE_LINES\n uniform bool u_has_line_texture;\n uniform sampler2D u_texture;\n uniform float u_texture_ratio;\n uniform vec4 u_dash_background_color;\n uniform float u_has_dash;\n#endif\n\n#define TANGRAM_NORMAL v_normal\n\n#if defined(TANGRAM_TEXTURE_COORDS) || defined(TANGRAM_EXTRUDE_LINES)\n varying vec2 v_texcoord;\n#endif\n\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(TANGRAM_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n vec3 normal = TANGRAM_NORMAL;\n\n // Apply raster to vertex color\n #ifdef TANGRAM_RASTER_TEXTURE_COLOR\n vec4 _raster_color = sampleRaster(0);\n\n #if defined(TANGRAM_BLEND_OPAQUE) || defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n // Raster sources can optionally mask by the alpha channel, which will render with only full or no alpha.\n // This is used for handling transparency outside the raster image in some blend modes,\n // which either don't support alpha, or would cause transparent pixels to write to the depth buffer,\n // obscuring geometry underneath.\n #ifdef TANGRAM_HAS_MASKED_RASTERS // skip masking logic if no masked raster sources\n #ifndef TANGRAM_ALL_MASKED_RASTERS // skip source check for masking if *all* raster sources are masked\n if (u_raster_mask_alpha) {\n #else\n {\n #endif\n #if defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n if (_raster_color.a < TANGRAM_EPSILON) {\n discard;\n }\n #else // TANGRAM_BLEND_OPAQUE\n if (_raster_color.a < 1. - TANGRAM_EPSILON) {\n discard;\n }\n // only allow full alpha in opaque blend mode (avoids artifacts blending w/canvas tile background)\n _raster_color.a = 1.;\n #endif\n }\n #endif\n #endif\n\n color *= _raster_color; // multiplied to tint texture color\n #endif\n\n // Apply line texture\n #ifdef TANGRAM_EXTRUDE_LINES\n { // enclose in scope to avoid leakage of internal variables\n if (u_has_line_texture) {\n vec2 _line_st = vec2(v_texcoord.x, fract(v_texcoord.y / u_texture_ratio));\n vec4 _line_color = texture2D(u_texture, _line_st);\n\n // If the line has a dash pattern, the line texture indicates if the current fragment should be\n // the dash foreground or background color. If the line doesn't have a dash pattern,\n // the line texture color is used directly (but also tinted by the vertex color).\n color = mix(\n color * _line_color, // no dash: tint the line texture with the vertex color\n mix(u_dash_background_color, color, _line_color.a), // choose dash foreground or background color\n u_has_dash // 0 if no dash, 1 if has dash\n );\n\n // Use alpha discard test as a lower-quality substitute for blending\n #if defined(TANGRAM_BLEND_OPAQUE)\n if (color.a < TANGRAM_ALPHA_TEST) {\n discard;\n }\n #endif\n }\n }\n #endif\n\n // First, get normal from raster tile (if applicable)\n #ifdef TANGRAM_RASTER_TEXTURE_NORMAL\n normal = normalize(sampleRaster(0).rgb * 2. - 1.);\n #endif\n\n // Second, alter normal with normal map texture (if applicable)\n #if defined(TANGRAM_LIGHTING_FRAGMENT) && defined(TANGRAM_MATERIAL_NORMAL_TEXTURE)\n calculateNormal(normal);\n #endif\n\n // Normal modification applied here for fragment lighting or no lighting,\n // and in vertex shader for vertex lighting\n #if !defined(TANGRAM_LIGHTING_VERTEX)\n #pragma tangram: normal\n #endif\n\n // Color modification before lighting is applied\n #pragma tangram: color\n\n #if defined(TANGRAM_LIGHTING_FRAGMENT)\n // Calculate per-fragment lighting\n color = calculateLighting(v_position.xyz - u_eye, normal, color);\n #elif defined(TANGRAM_LIGHTING_VERTEX)\n // Apply lighting intensity interpolated from vertex shader\n color *= v_lighting;\n #endif\n\n // Post-processing effects (modify color after lighting)\n #pragma tangram: filter\n\n gl_FragColor = color;\n}\n";const et=Object.create(Ne);Object.assign(et,{name:"polygons",built_in:!0,vertex_shader_src:Qe,fragment_shader_src:Je,selection:!0,init(){Ne.init.apply(this,arguments),this.defines.TANGRAM_NORMAL_ATTRIBUTE=!0,this.defines.TANGRAM_TEXTURE_COORDS=this.texcoords},_parseFeature(e,t,r){var n=this.feature_style;return n.color=this.parseColor(t.color,r),n.color?(n.alpha=J.evalCachedProperty(t.alpha,r),n.variant=t.variant,n.z=J.evalCachedDistanceProperty(t.z,r)||J.defaults.z,n.z*=G.height_scale,n.extrude=J.evalProperty(t.extrude,r),n.extrude&&(!0===n.extrude?(n.height=e.properties.height||J.defaults.height,n.min_height=e.properties.min_height||J.defaults.min_height):"number"==typeof n.extrude?(n.height=n.extrude,n.min_height=0):Array.isArray(n.extrude)&&(n.min_height=n.extrude[0],n.height=n.extrude[1]),n.height*=G.height_scale,n.min_height*=G.height_scale),n.tile_edges=t.tile_edges,n):null},_preprocess(e){return e.color=J.createColorPropertyCache(e.color),e.alpha=J.createPropertyCache(e.alpha),e.z=J.createPropertyCache(e.z,J.parseUnits),this.computeVariant(e),e},computeVariant(e){const t=e.interactive?1:0,r=null!=e.extrude?1:0,n=this.texcoords?1:0,i=this.getBlendOrderForDraw(e),s=[t,r,n,i].join("/");e.variant=s,null==this.variants[s]&&(this.variants[s]={key:s,blend_order:i,mesh_order:0,selection:t,normal:r,texcoords:n})},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.key]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_normal",size:3,type:fe.BYTE,normalized:!0,static:e.normal?null:[0,0,1]},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0,static:e.texcoords?null:[0,0]}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.key]=new Le(t)}return this.vertex_layouts[e.key]},meshVariantTypeForDraw(e){return this.variants[e.variant]},makeVertexTemplate(e,t){let r=0;return this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=e.z||0,this.vertex_template[r++]=this.scaleOrder(e.order),t.variant.normal&&(this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=127),this.vertex_template[r++]=255*e.color[0],this.vertex_template[r++]=255*e.color[1],this.vertex_template[r++]=255*e.color[2],this.vertex_template[r++]=255*(null!=e.alpha?e.alpha:e.color[3]),t.variant.selection&&(this.vertex_template[r++]=255*e.selection_color[0],this.vertex_template[r++]=255*e.selection_color[1],this.vertex_template[r++]=255*e.selection_color[2],this.vertex_template[r++]=255*e.selection_color[3]),t.variant.texcoords&&(this.vertex_template[r++]=0,this.vertex_template[r++]=0),this.addCustomAttributesToVertexTemplate(e,r),this.vertex_template},buildPolygons(e,t,r){let n=this.getTileMesh(r.tile,this.meshVariantTypeForDraw(t)),i=n.vertex_data,s=i.vertex_layout,o=this.makeVertexTemplate(t,n),a={texcoord_index:s.index.a_texcoord,texcoord_normalize:65535,remove_tile_edges:!t.tile_edges,tile_edge_tolerance:G.tile_scale*r.tile.pad_scale*4,winding:r.winding};return t.extrude&&t.height?function(e,t,r,n,i,s,o,a,{remove_tile_edges:l,tile_edge_tolerance:u,texcoord_index:c,texcoord_scale:h,texcoord_normalize:d,winding:f}){var p=t+(n||0),m=t+r;s[2]=m;var _=Ye(e,i,s,{texcoord_index:c,texcoord_scale:h,texcoord_normalize:d}),g=i.vertex_elements,y=i.vertex_count;if(c){d=d||1;var[v,b,x,w]=h||Ue,A=[[v,w],[v,b],[x,b],[x,w]]}for(var E=e.length,T=0;T<E;T++)for(var S=e[T],k=0;k<S.length;k++)for(var O=S[k],R=0;R<O.length-1;R++){if(l&&Be(O[R],O[R+1],u))continue;let e,t;"CCW"===f?(e=R,t=R+1):(e=R+1,t=R);var C=[[O[t][0],O[t][1],m],[O[t][0],O[t][1],p],[O[e][0],O[e][1],p],[O[e][0],O[e][1],m]];let r=ye.normalize([O[t][0]-O[e][0],O[t][1]-O[e][1],0]),n=ye.cross(Xe,r);s[o+0]=n[0]*a,s[o+1]=n[1]*a,s[o+2]=n[2]*a;for(var N=0;N<C.length;N++)s[0]=C[N][0],s[1]=C[N][1],s[2]=C[N][2],c&&(s[c+0]=A[N][0]*d,s[c+1]=A[N][1]*d),i.addVertex(s);g.push(y+0),g.push(y+1),g.push(y+2),g.push(y+2),g.push(y+3),g.push(y+0),y+=4,_+=2}return _}(e,t.z,t.height,t.min_height,i,o,s.index.a_normal,127,a):Ye(e,i,o,a)}});const tt=[0,0],rt={butt:0,square:1,round:2},nt={miter:0,bevel:1,round:2},it=G.tile_scale,st=[0,0],ot=[1,0],at=[.5,0];function lt(e,t){if(!(e.length<2)){var r,n,i,s,{join_type:o,cap_type:a,closed_polygon:l,remove_tile_edges:u,tile_edge_tolerance:c,v_scale:h,miter_len_sq:d}=t,f=null!=t.texcoord_index,p=0;if(l&&o===nt.miter){var m=function(e){if(Ve(e[0]))return 0;for(var t=0;t<e.length;t++)if(Ve(e[e.length-1-t]))return e.length-1-t;return 0}(e);if(0!==m){var _=function(e,t){var r=[];for(let i=0;i<e.length;i++){var n=(i+t)%e.length;0!==n&&r.push(e[n])}return r.push(r[0]),r}(e,m);return t.extra_lines=t.extra_lines||[],void t.extra_lines.push(_)}}var g=0,y=e.length-1,v=0;for(r=e[g],n=e[g+1];ye.isEqual(r,n);)if(r=n,n=e[1+ ++g],v++,g===e.length-1)return;for(;ye.isEqual(e[y],e[y-1]);)if(v++,0===--y)return;if(!(e.length<2+v))if(s=ye.normalize(ye.perp(r,n)),u&&Be(r,n,c)){var b=ut(e,g,c);b&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(b))}else{l?function(e,t,r,n,i){if(void 0===n||Ve(e))pt(e,r,r,1,0,i,1),pt(e,r,r,0,0,i,-1);else{n===nt.miter?ht(0,e,t,r,i.miter_len_sq,!0,i):dt(n,0,e,t,r,!0,i)}}(r,i=ye.normalize(ye.perp(e[y-1],r)),s,o,t):(Ve(r)||(gt(r,p,s,a,!0,t),f&&a!==rt.butt&&(p+=.5*h*t.texcoord_width)),pt(r,s,s,1,p,t,1),pt(r,s,s,0,p,t,-1)),f&&(p+=h*ye.length(ye.sub(n,r)));for(var x=g+1;x<y;x++){var w=x,A=x+1;if(r=e[w],n=e[A],!ye.isEqual(r,n)){if(u&&Be(r,n,c)){pt(r,s,s,1,p,t,1),pt(r,s,s,0,p,t,-1),ft(1,t);var E=ut(e,w+1,c);return void(E&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(E)))}i=s,s=ye.normalize(ye.perp(r,n)),o===nt.miter?ht(p,r,i,s,d,!1,t):dt(o,p,r,i,s,!1,t),f&&(p+=h*ye.length(ye.sub(n,r)))}}r=n,i=s,l?function(e,t,r,n,i,s){if(Ve(e))pt(e,t,t,1,i,s,1),pt(e,t,t,0,i,s,-1),ft(1,s);else{var o=ct(t,r);n===nt.miter&&ye.lengthSq(o)>s.miter_len_sq&&(n=nt.bevel),n===nt.miter?(pt(e,o,t,1,i,s,1),pt(e,o,t,0,i,s,-1),ft(1,s)):(pt(e,t,t,1,i,s,1),pt(e,t,t,0,i,s,-1),ft(1,s))}}(r,i,s=ye.normalize(ye.perp(r,e[1])),o,p,t):(pt(r,i,s,1,p,t,1),pt(r,i,s,0,p,t,-1),ft(1,t),Ve(r)||gt(r,p,i,a,!1,t))}}}function ut(e,t,r){for(var n=t;e[n+1]&&Be(e[n],e[n+1],r);)n++;return e.length-n>=2&&e.slice(n)}function ct(e,t){var r=ye.normalize(ye.add(e,t)),n=2/(1+Math.abs(ye.dot(e,r)));return ye.mult(r,n*n)}function ht(e,t,r,n,i,s,o){var a=ct(r,n);ye.lengthSq(a)>i?dt(nt.bevel,e,t,r,n,s,o):(pt(t,a,a,1,e,o,1),pt(t,a,a,0,e,o,-1),s||ft(1,o))}function dt(e,t,r,n,i,s,o){var a=ct(n,i),l=i[0]*n[1]-i[1]*n[0]>0;null!=o.texcoord_index&&(st[1]=t,ot[1]=t),l?(pt(r,a,a,1,t,o,1),pt(r,n,a,0,t,o,-1),s||ft(1,o),_t(r,ye.neg(n),a,ye.neg(i),a,st,ot,st,!1,e===nt.bevel,o),pt(r,a,a,1,t,o,1),pt(r,i,a,0,t,o,-1)):(pt(r,n,a,1,t,o,1),pt(r,a,a,0,t,o,-1),s||ft(1,o),_t(r,n,ye.neg(a),i,a,ot,st,ot,!1,e===nt.bevel,o),pt(r,i,a,1,t,o,1),pt(r,a,a,0,t,o,-1))}function ft(e,t){for(var r=t.vertex_data.vertex_elements,n=t.vertex_data.vertex_count-2*e-2,i=0;i<e;i++)r.push(n+2*i+2),r.push(n+2*i+1),r.push(n+2*i+0),r.push(n+2*i+2),r.push(n+2*i+3),r.push(n+2*i+1),t.geom_count+=2}function pt(e,t,r,n,i,s,o){var a=s.vertex_template,l=s.vertex_data;a[0]=e[0],a[1]=e[1];let u=s.half_width*o;a[s.extrude_index+0]=t[0]*u,a[s.extrude_index+1]=t[1]*u,s.offset&&(a[s.offset_index+0]=r[0]*s.offset,a[s.offset_index+1]=r[1]*s.offset),null!=s.texcoord_index&&(a[s.texcoord_index+0]=65535*n,a[s.texcoord_index+1]=65535*i),l.addVertex(a)}var mt=[0,0];function _t(e,t,r,n,i,s,o,a,l,u,c){for(var h=t[0]*n[1]-t[1]*n[0],d=ye.dot(t,n),f=Math.atan2(h,d);f>=Math.PI;)f-=2*Math.PI;if(u)p=1;else{var p=function(e,t){e<0&&(e=-e);var r=t>10?Math.log2(t/5):1;return Math.ceil(e/Math.PI*r)}(f,c.half_width);if(p<1)return}var m=c.vertex_data.vertex_count,_=c.vertex_data.vertex_elements;pt(e,r,i,o[0],o[1],c,1),pt(e,t,i,s[0],s[1],c,1);var g=t,y=null!=c.texcoord_index;if(y)if(l)var v=ye.sub(s,o);else{mt=ye.copy(s);var b=ye.div(ye.sub(a,s),p)}var x=f/p;let w,A,E=f<0?-1:1;h>0?(w=2,A=1):(w=1,A=2);for(var T=0;T<p;T++)0===T&&f<0&&(g=ye.neg(g)),g=ye.rot(g,x),y&&(l?(v=ye.rot(v,x),mt[0]=v[0]+o[0],mt[1]=v[1]*c.texcoord_width*c.v_scale+o[1]):mt=ye.add(mt,b)),pt(e,g,i,mt[0],mt[1],c,E),_.push(m+T+w),_.push(m),_.push(m+T+A)}function gt(e,t,r,n,i,s){var o=ye.neg(r),a=null!=s.texcoord_index;switch(n){case rt.square:var l;i?(l=[r[1],-r[0]],pt(e,ye.add(r,l),r,1,t,s,1),pt(e,ye.add(o,l),r,0,t,s,1),a&&(t+=.5*s.texcoord_width*s.v_scale),pt(e,r,r,1,t,s,1),pt(e,o,r,0,t,s,1)):(l=[-r[1],r[0]],pt(e,r,r,1,t,s,1),pt(e,o,r,0,t,s,1),a&&(t+=.5*s.texcoord_width*s.v_scale),pt(e,ye.add(r,l),r,1,t,s,1),pt(e,ye.add(o,l),r,0,t,s,1)),ft(1,s);break;case rt.round:var u,c,h=st,d=ot,f=at;i?(u=r,c=o,a&&(t+=.5*s.texcoord_width*s.v_scale,h=ot,d=st,f=at)):(u=o,c=r),a&&(st[1]=t,ot[1]=t,at[1]=t),_t(e,u,tt,c,r,h,f,d,!0,!1,s);break;case rt.butt:return}}const yt=[255,255,255,255],vt=[0,0,0,0],bt=Object.create(Ne);Object.assign(bt,{name:"lines",built_in:!0,vertex_shader_src:Qe,fragment_shader_src:Je,selection:!0,init(){Ne.init.apply(this,arguments),this.defines.TANGRAM_EXTRUDE_LINES=!0,this.defines.TANGRAM_TEXTURE_COORDS=!0,this.outline_feature_style={},this.inline_feature_style=this.feature_style,this.dash_textures={}},calcDistance:(e,t)=>J.evalCachedDistanceProperty(e,t)||0,calcDistanceNextZoom(e,t){t.zoom++;let r=this.calcDistance(e,t);return t.zoom--,r},calcWidth(e,t,r){let n,i=this.calcDistance(e.width,r);if(!(i<0)){if(n=e.next_width?this.calcDistanceNextZoom(e.next_width,r):i/2,0===i&&0===n||n<0)return!1;if(t.width_unscaled=i,t.next_width_unscaled=n,e.next_width){n*=2;let e=.5*(i+n);t.width=e*r.units_per_meter_overzoom,t.width_scale=1-n/e}else t.width=i*r.units_per_meter_overzoom,t.width_scale=0;return e.texcoords&&(e.inline_texcoord_width?t.texcoord_width=e.inline_texcoord_width:t.texcoord_width=(t.width_unscaled||t.next_width_unscaled)*r.units_per_meter_overzoom/r.tile.overzoom2),!0}},calcOffset(e,t,r){if(e.offset_precalc)t.offset=e.offset_precalc,t.offset_scale=e.offset_scale_precalc;else if(e.offset){let n=this.calcDistance(e.offset,r);if(e.next_offset){let i=2*this.calcDistanceNextZoom(e.next_offset,r);Math.abs(n)>=Math.abs(i)?(t.offset=n*r.units_per_meter_overzoom,t.offset_scale=0!==n?1-i/n:0):(t.offset=i*r.units_per_meter_overzoom,t.offset_scale=0!==i?-1*(1-n/i):0)}else t.offset=n*r.units_per_meter_overzoom,t.offset_scale=0}else t.offset=0,t.offset_scale=0},_parseFeature(e,t,r){var n=this.feature_style;if(!1!==this.calcWidth(t,n,r)&&(this.calcOffset(t,n,r),n.color=this.parseColor(t.color,r),n.color)){if(n.alpha=J.evalCachedProperty(t.alpha,r),n.variant=t.variant,n.z=J.evalCachedDistanceProperty(t.z,r)||J.defaults.z,n.height=e.properties.height||J.defaults.height,n.extrude=J.evalProperty(t.extrude,r),n.extrude&&("number"==typeof n.extrude?n.height=n.extrude:Array.isArray(n.extrude)&&(n.height=n.extrude[1])),n.extrude&&n.height&&(n.z+=n.height),n.z*=G.height_scale,n.cap=t.cap,n.join=t.join,n.miter_limit=t.miter_limit,n.tile_edges=t.tile_edges,n.outline=n.outline||{width:{},next_width:{},preprocessed:!0},t.outline&&!1!==t.outline.visible&&t.outline.color&&t.outline.width){let e=2*this.calcDistance(t.outline.width,r),i=2*this.calcDistanceNextZoom(t.outline.next_width,r);0===e&&0===i||e<0||i<0?(n.outline.width.value=null,n.outline.next_width.value=null,n.outline.color=null,n.outline.inline_texcoord_width=null,n.outline.texcoords=!1):(n.outline.width.value=e+n.width_unscaled,n.outline.next_width.value=i+n.next_width_unscaled,n.outline.inline_texcoord_width=n.texcoord_width,n.outline.offset_precalc=n.offset,n.outline.offset_scale_precalc=n.offset_scale,n.outline.color=t.outline.color,n.outline.alpha=t.outline.alpha,n.outline.interactive=t.outline.interactive,n.outline.cap=t.outline.cap,n.outline.join=t.outline.join,n.outline.miter_limit=t.outline.miter_limit,n.outline.texcoords=t.outline.texcoords,n.outline.extrude=t.outline.extrude,n.outline.z=t.outline.z,n.outline.style=t.outline.style,n.outline.variant=t.outline.variant,t.outline.order?n.outline.order=this.parseOrder(t.outline.order,r):n.outline.order=n.order,n.outline.order>n.order&&(n.outline.order=n.order),n.outline.order-=.5)}else n.outline.width.value=null,n.outline.next_width.value=null,n.outline.color=null,n.outline.inline_texcoord_width=null;return n}},_preprocess(e){if(e.color=J.createColorPropertyCache(e.color),e.alpha=J.createPropertyCache(e.alpha),e.width=J.createPropertyCache(e.width,J.parseUnits),e.width&&e.width.type!==J.CACHE_TYPE.STATIC&&(e.next_width=J.createPropertyCache(e.width,J.parseUnits)),e.offset=e.offset&&J.createPropertyCache(e.offset,J.parseUnits),e.offset&&e.offset.type!==J.CACHE_TYPE.STATIC&&(e.next_offset=J.createPropertyCache(e.offset,J.parseUnits)),e.z=J.createPropertyCache(e.z,J.parseUnits),e.dash=void 0!==e.dash?e.dash:this.dash,e.dash_key=e.dash&&this.dashTextureKey(e.dash),e.dash_background_color=void 0!==e.dash_background_color?e.dash_background_color:this.dash_background_color,e.dash_background_color=e.dash_background_color&&J.parseColor(e.dash_background_color),e.texture_merged=e.dash_key||(void 0!==e.texture?e.texture:this.texture),e.texcoords=this.texcoords||e.texture_merged?1:0,this.computeVariant(e),e.outline){e.outline.is_outline=!0,e.outline.style=e.outline.style||this.name,e.outline.color=J.createColorPropertyCache(e.outline.color),e.outline.alpha=J.createPropertyCache(e.outline.alpha),e.outline.width=J.createPropertyCache(e.outline.width,J.parseUnits),e.outline.next_width=J.createPropertyCache(e.outline.width,J.parseUnits),e.outline.interactive=null!=e.outline.interactive?e.outline.interactive:e.interactive,e.outline.cap=e.outline.cap||e.cap,e.outline.join=e.outline.join||e.join,e.outline.miter_limit=null!=e.outline.miter_limit?e.outline.miter_limit:e.miter_limit,e.outline.offset=e.offset,e.outline.extrude=e.extrude,e.outline.z=e.z;let t=this.styles[e.outline.style];t?(e.outline.dash=void 0!==e.outline.dash?e.outline.dash:t.dash,e.outline.texture=void 0!==e.outline.texture?e.outline.texture:t.texture,null!=e.outline.dash?(e.outline.dash_key=e.outline.dash&&this.dashTextureKey(e.outline.dash),e.outline.texture_merged=e.outline.dash_key):null===e.outline.dash||null!=e.outline.texture?(e.outline.dash_key=null,e.outline.texture_merged=e.outline.texture):(e.outline.dash=e.dash,e.outline.dash_key=e.outline.dash&&this.dashTextureKey(e.outline.dash),e.outline.texture_merged=e.outline.dash_key),e.outline.dash_background_color=void 0!==e.outline.dash_background_color?e.outline.dash_background_color:t.dash_background_color,e.outline.dash_background_color=void 0!==e.outline.dash_background_color?e.outline.dash_background_color:e.dash_background_color,e.outline.dash_background_color=e.outline.dash_background_color&&J.parseColor(e.outline.dash_background_color),e.outline.texcoords=t.texcoords||e.outline.texture_merged?1:0,void 0===e.outline.blend_order&&null!=e.blend_order&&(e.outline.blend_order=e.blend_order),t.computeVariant(e.outline)):(_({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': line 'outline' specifies non-existent draw style '${e.outline.style}' (or maybe the style is defined but is missing a 'base' or has another error), skipping outlines for features matching this layer group`),e.outline=null)}return e},dashTextureKey:e=>"__dash_"+JSON.stringify(e),getDashTexture(e){let t=this.dashTextureKey(e);if(null==this.dash_textures[t]){this.dash_textures[t]=!0;const r=function(e,t={}){const r=t.dash_color||yt,n=t.background_color||vt,i=e,s=t.scale||1;i.length%2==1&&Array.prototype.push.apply(i,i);let o=!0,a=[];for(let e=0;e<i.length;e++){let t=Math.floor(i[e]*s);for(let e=0;e<t;e++)Array.prototype.push.apply(a,o?r:n);o=!o}return a.reverse(),a=new Uint8Array(a),{pixels:a,length:a.length/4}}(e,{scale:20});k.create(this.gl,t,{data:r.pixels,height:r.length,width:1,filtering:"nearest"})}},async endData(e){const t=await Ne.endData.call(this,e);if(t){t.uniforms.u_has_line_texture=!1,t.uniforms.u_texture=k.default,t.uniforms.u_v_scale_adjust=G.tile_scale;let r=[];for(let n in t.meshes){let i=t.meshes[n].variant;if(i.texture){let s=t.meshes[n].uniforms=t.meshes[n].uniforms||{};if(s.u_has_line_texture=!0,s.u_texture=i.texture,s.u_texture_ratio=1,i.dash&&(s.u_v_scale_adjust=20*G.tile_scale,s.u_has_dash=null!=i.dash_background_color?1:0,s.u_dash_background_color=i.dash_background_color||[0,0,0,0]),i.dash_key&&null==this.dash_textures[i.dash_key]){this.dash_textures[i.dash_key]=!0;try{await a.postMessage(this.main_thread_target+".getDashTexture",i.dash)}catch(e){_("trace",`${this.name}: line dash texture create failed because style no longer on main thread`)}}if(null==k.textures[i.texture])r.push(k.syncTexturesToWorker([i.texture]).then(e=>{let t=e[i.texture];t&&(s.u_texture_ratio=t.height/t.width)}));else{let e=k.textures[i.texture];s.u_texture_ratio=e.height/e.width}}}await Promise.all(r)}return t},computeVariant(e){let t=e.offset?1:0;t+="/"+e.texcoords,t+="/"+(e.interactive?1:0),t+="/"+(e.extrude||e.z?1:0),t+="/"+e.is_outline,e.dash_key&&(t+=e.dash_key,e.dash_background_color&&(t+=e.dash_background_color)),e.texture_merged&&(t+=e.texture_merged);const r=this.getBlendOrderForDraw(e);t+="/"+r,t=N(t),e.variant=t,null==this.variants[t]&&(this.variants[t]={key:t,blend_order:r,mesh_order:e.is_outline?0:1,selection:e.interactive?1:0,offset:e.offset?1:0,z_or_offset:e.offset||e.extrude||e.z?1:0,texcoords:e.texcoords,texture:e.texture_merged,dash:e.dash,dash_key:e.dash_key,dash_background_color:e.dash_background_color})},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.key]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_extrude",size:2,type:fe.SHORT,normalized:!1},{name:"a_offset",size:2,type:fe.SHORT,normalized:!1,static:e.offset?null:[0,0]},{name:"a_z_and_offset_scale",size:2,type:fe.SHORT,normalized:!1,static:e.z_or_offset?null:[0,0]},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0,static:e.texcoords?null:[0,0]},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.key]=new Le(t)}return this.vertex_layouts[e.key]},meshVariantTypeForDraw(e){return this.variants[e.variant]},makeVertexTemplate(e,t){let r=0;return this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=1024*e.width_scale,this.vertex_template[r++]=this.scaleOrder(e.order),this.vertex_template[r++]=0,this.vertex_template[r++]=0,t.variant.offset&&(this.vertex_template[r++]=0,this.vertex_template[r++]=0),t.variant.z_or_offset&&(this.vertex_template[r++]=e.z||0,this.vertex_template[r++]=1024*e.offset_scale),t.variant.texcoords&&(this.vertex_template[r++]=0,this.vertex_template[r++]=0),this.vertex_template[r++]=255*e.color[0],this.vertex_template[r++]=255*e.color[1],this.vertex_template[r++]=255*e.color[2],this.vertex_template[r++]=255*(null!=e.alpha?e.alpha:e.color[3]),t.variant.selection&&(this.vertex_template[r++]=255*e.selection_color[0],this.vertex_template[r++]=255*e.selection_color[1],this.vertex_template[r++]=255*e.selection_color[2],this.vertex_template[r++]=255*e.selection_color[3]),this.addCustomAttributesToVertexTemplate(e,r),this.vertex_template},buildLines(e,t,r,n){if(this.feature_style=this.outline_feature_style,t.outline&&null!=t.outline.color&&null!=t.outline.width.value){var i=this.styles[t.outline.style];i&&i.addFeature(r.feature,t.outline,r)}this.feature_style=this.inline_feature_style;let s=this.getTileMesh(r.tile,this.meshVariantTypeForDraw(t)),o=s.vertex_data,a=o.vertex_layout;return function(e,t,r,n,i,s,o,a){var l,u=t.cap?rt[t.cap]:rt.butt,c=t.join?nt[t.join]:nt.miter;if(c===nt.miter){const e=t.miter_limit||3;var h=e*e}i.a_texcoord&&(l=1/(t.texcoord_width*it));var d={closed_polygon:s,remove_tile_edges:o,tile_edge_tolerance:a,miter_len_sq:h,join_type:c,cap_type:u,vertex_data:r,vertex_template:n,half_width:t.width/2,extrude_index:i.a_extrude,offset_index:i.a_offset,v_scale:l,texcoord_index:i.a_texcoord,texcoord_width:t.texcoord_width,offset:t.offset,geom_count:0};for(let t=0;t<e.length;t++)lt(e[t],d);if(d.extra_lines)for(let e=0;e<d.extra_lines.length;e++)lt(d.extra_lines[e],d);return d.geom_count}(e,t,o,this.makeVertexTemplate(t,s),a.index,n&&n.closed_polygon,!t.tile_edges&&n&&n.remove_tile_edges,G.tile_scale*r.tile.pad_scale*2)},buildPolygons(e,t,r){let n=0;for(let i=0;i<e.length;i++)n+=this.buildLines(e[i],t,r,{closed_polygon:!0,remove_tile_edges:!0});return n}});const xt=128/Math.PI,wt=16384/Math.PI,At=[0,2,2,0],Et=[1,1,3,3],Tt=new Array(4),St=["left","top-left","bottom-left"],kt=["right","top-right","bottom-right"],Ot=["top","top-left","top-right"],Rt=["bottom","bottom-left","bottom-right"],Ct={computeOffset(e,t,r,n=null){if(!r||"center"===r)return e;let i=[e[0],e[1]];return n=n||this.default_buffer,this.isLeftAnchor(r)?(i[0]-=t[0]/2,"left"===r&&(i[0]-=n[0])):this.isRightAnchor(r)&&(i[0]+=t[0]/2,"right"===r&&(i[0]+=n[1])),this.isTopAnchor(r)?(i[1]-=t[1]/2,"top"===r&&(i[1]-=n[2])):this.isBottomAnchor(r)&&(i[1]+=t[1]/2,"bottom"===r&&(i[1]+=n[3])),i},alignForAnchor(e){if(e&&"center"!==e){if(this.isLeftAnchor(e))return"right";if(this.isRightAnchor(e))return"left"}return"center"},isLeftAnchor:e=>St.indexOf(e)>-1,isRightAnchor:e=>kt.indexOf(e)>-1,isTopAnchor:e=>Ot.indexOf(e)>-1,isBottomAnchor:e=>Rt.indexOf(e)>-1,default_buffer:[2.5,2.5,1.5,.75],zero_buffer:[0,0,0,0]};function Nt(e,t){return!(e[2]<t[0]||e[0]>t[2]||e[3]<t[1]||e[1]>t[3])}const Pt=[[1,0],[0,1]],Mt=[],Dt=[];let zt,It,Ft,Lt;class jt{constructor(e,t,r,n,i){this.dimension=[n/2,i/2],this.angle=r,this.centroid=[e,t],this.quad=null,this.axis_0=null,this.axis_1=null,this.update()}toJSON(){return{x:this.centroid[0],y:this.centroid[1],a:this.angle,w:this.dimension[0],h:this.dimension[1]}}getExtent(){return 0===this.angle?[this.quad[0],this.quad[1],this.quad[4],this.quad[5]]:[Math.min(this.quad[0],this.quad[2],this.quad[4],this.quad[6]),Math.min(this.quad[1],this.quad[3],this.quad[5],this.quad[7]),Math.max(this.quad[0],this.quad[2],this.quad[4],this.quad[6]),Math.max(this.quad[1],this.quad[3],this.quad[5],this.quad[7])]}updateAxes(){this.axis_0=ye.normalize([this.quad[4]-this.quad[6],this.quad[5]-this.quad[7]]),this.axis_1=ye.normalize([this.quad[4]-this.quad[2],this.quad[5]-this.quad[3]])}update(){const e=this.centroid,t=this.dimension[0],r=this.dimension[1];if(0===this.angle)this.quad=[e[0]-t,e[1]-r,e[0]+t,e[1]-r,e[0]+t,e[1]+r,e[0]-t,e[1]+r],this.axis_0=Pt[0],this.axis_1=Pt[1];else{let n=Math.cos(this.angle)*t,i=Math.sin(this.angle)*t,s=-Math.sin(this.angle)*r,o=Math.cos(this.angle)*r;this.quad=[e[0]-n-s,e[1]-i-o,e[0]+n-s,e[1]+i-o,e[0]+n+s,e[1]+i+o,e[0]-n+s,e[1]-i+o],this.updateAxes()}}static projectToAxis(e,t,r){let n=e.quad;return zt=n[0]*t[0]+n[1]*t[1],It=n[2]*t[0]+n[3]*t[1],Ft=n[4]*t[0]+n[5]*t[1],Lt=n[6]*t[0]+n[7]*t[1],r[0]=Math.min(zt,It,Ft,Lt),r[1]=Math.max(zt,It,Ft,Lt),r}static axisCollide(e,t,r,n){return jt.projectToAxis(e,r,Mt),jt.projectToAxis(t,r,Dt),!(Dt[0]>Mt[1]||Dt[1]<Mt[0]||(jt.projectToAxis(e,n,Mt),jt.projectToAxis(t,n,Dt),Dt[0]>Mt[1]||Dt[1]<Mt[0]))}static intersect(e,t){return jt.axisCollide(e,t,e.axis_0,e.axis_1)&&jt.axisCollide(e,t,t.axis_0,t.axis_1)}}class Ut{constructor(e,t={}){this.id=Ut.nextLabelId(),this.type="",this.size=e,this.layout=t,this.position=null,this.angle=0,this.anchor=Array.isArray(this.layout.anchor)?this.layout.anchor[0]:this.layout.anchor,this.placed=null,this.offset=t.offset,this.unit_scale=this.layout.units_per_pixel,this.aabb=null,this.obb=null,this.align="center",this.throw_away=!1}toJSON(){return{id:this.id,type:this.type,obb:this.obb.toJSON(),position:this.position,angle:this.angle,size:this.size,offset:this.offset,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Bt(this.layout)}}update(){this.align=this.layout.align||Ct.alignForAnchor(this.anchor)}occluded(e,t=null){let r=!1,n=e.aabb,i=e.obb;return n.length>0&&function(e,t,r){for(let n=0;n<t.length&&(!Nt(e,t[n])||null==r(n));n++);}(this.aabb,n,e=>{if(!t||n[e]!==t.aabb)return 0===this.obb.angle&&0===i[e].angle||jt.intersect(this.obb,i[e])?(r=!0,!0):void 0}),r}inTileBounds(){return this.aabb[0]>=0&&this.aabb[1]>-G.tile_scale&&this.aabb[0]<G.tile_scale&&this.aabb[1]<=0||this.aabb[2]>=0&&this.aabb[3]>-G.tile_scale&&this.aabb[2]<G.tile_scale&&this.aabb[3]<=0}mayRepeatAcrossTiles(){if(this.layout.collide)return!0;const e=this.layout.repeat_distance;return 0!==e&&(Math.abs(this.position[0])<e||Math.abs(this.position[0]-G.tile_scale)<e||Math.abs(this.position[1])<e||Math.abs(-(this.position[1]-G.tile_scale))<e)}discard(e,t=null){return!!this.throw_away||this.occluded(e,t)}}function Bt(e){return{priority:e.priority,collide:e.collide,repeat_distance:e.repeat_distance,repeat_group:e.repeat_group,buffer:e.buffer,italic:e.italic}}Ut.add=function(e,t){if(e.placed=!0,e.aabb&&(t.aabb.push(e.aabb),t.obb.push(e.obb)),e.aabbs)for(let r=0;r<e.aabbs.length;r++)t.aabb.push(e.aabbs[r]),t.obb.push(e.obbs[r])},Ut.id=0,Ut.id_prefix=0,Ut.id_multiplier=0,Ut.nextLabelId=function(){return Ut.id_prefix+Ut.id++*Ut.id_multiplier},Ut.epsilon=.9999;class Vt{constructor(e,t){this.key=e,this.repeat_dist=t,this.repeat_dist_sq=this.repeat_dist*this.repeat_dist,this.positions=[]}check(e){let t=e.position;for(let e=0;e<this.positions.length;e++){let r=this.positions[e],n=t[0]-r[0],i=t[1]-r[1];if(n*n+i*i<this.repeat_dist_sq)return!0}}add(e){e&&e.position&&this.positions.push(e.position)}static clear(e){this.groups[e]={}}static check(e,t,r){if(t.repeat_distance&&t.repeat_group&&this.groups[r][t.repeat_group])return this.groups[r][t.repeat_group].check(e)}static add(e,t,r){t.repeat_distance&&t.repeat_group&&(null==this.groups[r][t.repeat_group]&&(this.groups[r][t.repeat_group]=new Vt(t.repeat_group,t.repeat_distance*t.repeat_scale)),this.groups[r][t.repeat_group].add(e))}}Vt.groups={};class Gt{constructor(e,t){this.anchor=e,this.span=t,this.cells={}}addLabel(e){e.aabb&&this.addLabelBboxes(e,e.aabb),e.aabbs&&e.aabbs.forEach(t=>this.addLabelBboxes(e,t))}addLabelBboxes(e,t){const r=[Math.max(Math.floor((t[0]-this.anchor.x)/this.span),0),Math.max(Math.floor(-(t[1]-this.anchor.y)/this.span),0),Math.max(Math.floor((t[2]-this.anchor.x)/this.span),0),Math.max(Math.floor(-(t[3]-this.anchor.y)/this.span),0)];e.cells=[];for(let t=r[1];t<=r[3];t++){this.cells[t]=this.cells[t]||{};for(let n=r[0];n<=r[2];n++)this.cells[t][n]=this.cells[t][n]||{aabb:[],obb:[]},e.cells.push(this.cells[t][n])}}}const $t={tiles:{},grid:null,initGrid(e){this.grid=null==e?null:new Gt(e.anchor,e.span)},startTile(e,{apply_repeat_groups:t=!0,return_hidden:r=!1}={}){let n=this.tiles[e]={bboxes:{aabb:[],obb:[]},objects:{},labels:{},styles:{},repeat:t,return_hidden:r};null==n.complete&&(n.complete=new Promise((e,t)=>{n.resolve=e,n.reject=t}))},resetTile(e){delete this.tiles[e]},abortTile(e){this.tiles[e]&&this.tiles[e].resolve&&this.tiles[e].resolve([]),this.resetTile(e)},addStyle(e,t){this.tiles[t].styles[e]=!0},collide(e,t,r){let n=this.tiles[r];if(!n)return _("trace","Collision.collide() called with null tile",r,this.tiles,t,e),Promise.resolve([]);let i=n.objects;for(let r=0;r<e.length;r++){let n=e[r],s=n.label.layout.priority;i[s]=i[s]||{},i[s][t]=i[s][t]||[],i[s][t].push(n)}return delete n.styles[t],0===Object.keys(n.styles).length&&this.endTile(r),n.complete.then(()=>(n.resolve=null,n.labels[t]||[]))},endTile(e){let t=this.tiles[e],r=t.labels;this.grid&&this.addLabelsToGrid(e),t.repeat&&Vt.clear(e);let n=Object.keys(t.objects).sort((e,t)=>e-t);for(let i=0;i<n.length;i++){let s=t.objects[n[i]];if(s)for(let n in s){let i=s[n];r[n]=r[n]||[];for(let s=0;s<i.length;s++){let o=i[s];this.canBePlaced(o,e,o.linked,t)?o.linked?this.canBePlaced(o.linked,e,o,t)?(o.show=!0,(o.label.breach||o.linked.label.breach)&&(o.label.breach=!0,o.linked.label.breach=!0),(o.label.may_repeat_across_tiles||o.linked.label.may_repeat_across_tiles)&&(o.label.may_repeat_across_tiles=!0,o.linked.label.may_repeat_across_tiles=!0),r[n].push(o),this.place(o,e,t),this.place(o.linked,e,t)):t.return_hidden&&(o.show=!1,r[n].push(o)):(o.show=!0,r[n].push(o),this.place(o,e,t)):t.return_hidden&&(o.show=!1,r[n].push(o))}}}delete this.tiles[e],t.resolve()},addLabelsToGrid(e){const t=this.tiles[e];for(const e in t.objects){const r=t.objects[e];if(r)for(const e in r)r[e].forEach(e=>this.grid.addLabel(e.label))}},canBePlaced(e,t,r=null,{repeat:n=!0}={}){let i=e.label,s=e.label.layout;if(null!=i.placed)return i.placed;let o=!s.collide;if(o||(o=this.grid&&i.cells?i.cells.reduce((e,t)=>(e&&i.discard(t,r&&r.label)&&(e=!1),e),!0):!i.discard(this.tiles[t].bboxes,r&&r.label)),o){if(!n||!Vt.check(i,s,t))return!0;i.placed=!1}else s.collide&&(i.placed=!1);return i.placed},place({label:e},t,{repeat:r=!0}){null==e.placed&&(r&&Vt.add(e,e.layout,t),this.grid&&e.cells?e.cells.forEach(t=>Ut.add(e,t)):Ut.add(e,this.tiles[t].bboxes))}};class qt extends Ut{constructor(e,t,r,n=0){super(t,r),this.type="point",this.position=[e[0],e[1]],this.angle=n,this.parent=this.layout.parent,this.update(),this.start_anchor_index=1,this.degenerate=!(this.size[0]||this.size[1]||this.layout.buffer[0]||this.layout.buffer[1]),this.throw_away=!1}update(){super.update(),this.computeOffset(),this.updateBBoxes()}computeOffset(){if(this.offset=[this.layout.offset[0],this.layout.offset[1]],this.parent){let e=this.parent;this.offset=Ct.computeOffset(this.offset,e.size,e.anchor,Ct.zero_buffer),this.offset=Ct.computeOffset(this.offset,e.size,this.anchor,Ct.zero_buffer),e.offset!==J.zeroPair&&(this.offset===J.zeroPair?this.offset=e.offset:(this.offset[0]+=e.offset[0],this.offset[1]+=e.offset[1]))}this.offset=Ct.computeOffset(this.offset,this.size,this.anchor)}updateBBoxes(){let e=(this.size[0]+2*this.layout.buffer[0])*this.unit_scale*Ut.epsilon,t=(this.size[1]+2*this.layout.buffer[1])*this.unit_scale*Ut.epsilon;this.layout.italic&&(e+=5*this.unit_scale),this.obb=new jt(this.position[0]+this.offset[0]*this.unit_scale,this.position[1]-this.offset[1]*this.unit_scale,-this.angle,e,t),this.aabb=this.obb.getExtent(),this.inTileBounds&&(this.breach=!this.inTileBounds()),this.mayRepeatAcrossTiles&&(this.may_repeat_across_tiles=this.mayRepeatAcrossTiles())}discard(e,t=null){if(this.degenerate)return!1;if(super.discard(e,t)){if(Array.isArray(this.layout.anchor))for(let r=this.start_anchor_index;r<this.layout.anchor.length;r++)if(this.anchor=this.layout.anchor[r],this.update(),!super.discard(e,t))return!1;return!0}return!1}}qt.PLACEMENT={VERTEX:0,MIDPOINT:1,SPACED:2,CENTROID:3};const Wt=qt.PLACEMENT;function Ht(e,t,r){const n=[],i=r.placement,s=Math.max(t[0],t[1])*r.placement_min_length_ratio*r.units_per_pixel;if(i===Wt.SPACED){let i=function(e,t,r){let n=r.units_per_pixel,i=(r.placement_spacing||80)*n,s=function(e){let t=0;for(let r=0;r<e.length-1;r++)t+=Kt(e[r],e[r+1]);return t}(e);if(s<=t)return!1;let o=Math.max(Math.floor(s/i),1),a=[],l=[],u=.5*(s-(o-1)*i);for(let n=0;n<o;n++){let{position:n,angle:s}=Xt(e,u,t,r);null!=n&&null!=s&&(a.push(n),l.push(s)),u+=i}return{positions:a,angles:l}}(e,s,r);if(!i)return[];let o=i.positions,a=i.angles;for(let e=0;e<o.length;e++){let i=o[e],s=a[e];!0!==r.tile_edges&&Ve(i)||n.push(new qt(i,t,r,s))}}else if(i===Wt.VERTEX){let i,s;for(let o=0;o<e.length-1;o++)if(i=e[o],s=e[o+1],!0===r.tile_edges||!Ve(i)){const e=Zt(i,s,r.angle);n.push(new qt(i,t,r,e))}const o=Zt(i,s,r.angle);n.push(new qt(s,t,r,o))}else if(i===Wt.MIDPOINT)for(let i=0;i<e.length-1;i++){let o=e[i],a=e[i+1],l=[.5*(o[0]+a[0]),.5*(o[1]+a[1])];if((!0===r.tile_edges||!Ve(l))&&(!s||Kt(o,a)>s)){const e=Zt(o,a,r.angle);n.push(new qt(l,t,r,e))}}return n}function Zt(e,t,r=0){return"auto"===r?Math.atan2(t[0]-e[0],t[1]-e[1]):r}function Kt(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))}function Xt(e,t,r,n){let i,s,o=0;for(let a=0;a<e.length-1;a++){let l=e[a],u=e[a+1];const c=Kt(l,u);if(!(c<=r)&&(o+=c,o>t)){i=Yt(l,u,o-t),s=Zt(l,u,n.angle);break}}return{position:i,angle:s}}function Yt(e,t,r){let n=r/Kt(e,t);return[n*e[0]+(1-n)*t[0],n*e[1]+(1-n)*t[1]]}const Qt={key:e=>[e.style,e.weight,e.family,e.px_size,e.fill,e.stroke,e.stroke_width,e.underline_width,e.background_color,e.background_width,e.background_stroke_color,e.background_stroke_width,e.transform,e.text_wrap,e.max_lines,e.supersample,g.device_pixel_ratio].join("/"),defaults:{style:"normal",weight:"normal",size:"12px",px_size:12,family:"Helvetica",fill:[1,1,1,1],text_wrap:15,max_lines:5,align:"center"},compute(e,t){const r={};e.font=e.font||this.defaults,r.supersample=e.supersample_text?1.5:1,r.can_articulate=e.can_articulate,r.fill=J.evalCachedColorPropertyWithAlpha(e.font.fill,e.font.alpha,t),r.fill=g.toCSSColor(r.fill),e.font.stroke&&e.font.stroke.color&&(r.stroke=J.evalCachedColorPropertyWithAlpha(e.font.stroke.color,e.font.stroke.alpha,t),r.stroke=g.toCSSColor(r.stroke),r.stroke_width=J.evalCachedProperty(e.font.stroke.width,t)),!0!==e.font.underline||r.can_articulate||(r.underline_width=1.5*r.supersample),e.font.background&&!r.can_articulate&&(r.background_color=J.evalCachedColorPropertyWithAlpha(e.font.background.color,e.font.background.alpha,t),r.background_color=g.toCSSColor(r.background_color),r.background_color&&(r.background_width=J.evalCachedProperty(e.font.background.width,t)),r.background_stroke_color=e.font.background.stroke&&e.font.background.stroke.color&&J.evalCachedColorPropertyWithAlpha(e.font.background.stroke.color,e.font.background.stroke.alpha,t),r.background_stroke_color&&(r.background_stroke_color=g.toCSSColor(r.background_stroke_color),r.background_stroke_width=null!=e.font.background.stroke.width?J.evalCachedProperty(e.font.background.stroke.width,t):1)),r.weight=J.evalCachedProperty(e.font.weight,t)||this.defaults.weight,"number"==typeof r.weight&&(r.weight=Math.min(Math.max(r.weight,1),1e3)),e.font.family?(r.family=e.font.family,r.family!==this.defaults.family&&(r.family+=", "+this.defaults.family)):r.family=this.defaults.family,r.style=e.font.style||this.defaults.style,r.transform=e.font.transform,r.px_size=J.evalCachedProperty(e.font.px_size,t)*r.supersample,r.font_css=this.fontCSS(r);let n=e.text_wrap;return null!=n||r.can_articulate||(n=!0),!0===n&&(n=this.defaults.text_wrap),r.text_wrap=n,r.max_lines=e.max_lines||this.defaults.max_lines,r},fontCSS:({style:e,weight:t,px_size:r,family:n})=>[e,t,r+"px",n].filter(e=>e).join(" ")};var Jt,er,tr={exports:{}},rr=P((Jt||(Jt=1,er=tr,function(){function e(e,t){document.addEventListener?e.addEventListener("scroll",t,!1):e.attachEvent("scroll",t)}function t(e){this.a=document.createElement("div"),this.a.setAttribute("aria-hidden","true"),this.a.appendChild(document.createTextNode(e)),this.b=document.createElement("span"),this.c=document.createElement("span"),this.h=document.createElement("span"),this.f=document.createElement("span"),this.g=-1,this.b.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.c.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.f.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.h.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.b.appendChild(this.h),this.c.appendChild(this.f),this.a.appendChild(this.b),this.a.appendChild(this.c)}function r(e,t){e.a.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;left:-999px;white-space:nowrap;font:"+t+";"}function n(e){var t=e.a.offsetWidth,r=t+100;return e.f.style.width=r+"px",e.c.scrollLeft=r,e.b.scrollLeft=e.b.scrollWidth+100,e.g!==t&&(e.g=t,!0)}function i(t,r){function i(){var e=s;n(e)&&e.a.parentNode&&r(e.g)}var s=t;e(t.b,i),e(t.c,i),n(t)}function s(e,t){var r=t||{};this.family=e,this.style=r.style||"normal",this.weight=r.weight||"normal",this.stretch=r.stretch||"normal"}var o=null,a=null,l=null,u=null;function c(){if(null===l){var e=document.createElement("div");try{e.style.font="condensed 100px sans-serif"}catch(e){}l=""!==e.style.font}return l}function h(e,t){return[e.style,e.weight,c()?e.stretch:"","100px",t].join(" ")}s.prototype.load=function(e,n){var s=this,l=e||"BESbswy",c=0,d=n||3e3,f=(new Date).getTime();return new Promise(function(e,n){var p;if(null===u&&(u=!!document.fonts),(p=u)&&(null===a&&(a=/OS X.*Version\/10\..*Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor)),p=!a),p){p=new Promise(function(e,t){!function r(){(new Date).getTime()-f>=d?t():document.fonts.load(h(s,'"'+s.family+'"'),l).then(function(t){1<=t.length?e():setTimeout(r,25)},function(){t()})}()});var m=new Promise(function(e,t){c=setTimeout(t,d)});Promise.race([m,p]).then(function(){clearTimeout(c),e(s)},function(){n(s)})}else!function(e){document.body?e():document.addEventListener?document.addEventListener("DOMContentLoaded",function t(){document.removeEventListener("DOMContentLoaded",t),e()}):document.attachEvent("onreadystatechange",function t(){"interactive"!=document.readyState&&"complete"!=document.readyState||(document.detachEvent("onreadystatechange",t),e())})}(function(){function a(){var t;(t=-1!=_&&-1!=g||-1!=_&&-1!=y||-1!=g&&-1!=y)&&((t=_!=g&&_!=y&&g!=y)||(null===o&&(t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),o=!!t&&(536>parseInt(t[1],10)||536===parseInt(t[1],10)&&11>=parseInt(t[2],10))),t=o&&(_==v&&g==v&&y==v||_==b&&g==b&&y==b||_==x&&g==x&&y==x)),t=!t),t&&(w.parentNode&&w.parentNode.removeChild(w),clearTimeout(c),e(s))}var u=new t(l),p=new t(l),m=new t(l),_=-1,g=-1,y=-1,v=-1,b=-1,x=-1,w=document.createElement("div");w.dir="ltr",r(u,h(s,"sans-serif")),r(p,h(s,"serif")),r(m,h(s,"monospace")),w.appendChild(u.a),w.appendChild(p.a),w.appendChild(m.a),document.body.appendChild(w),v=u.a.offsetWidth,b=p.a.offsetWidth,x=m.a.offsetWidth,function e(){if((new Date).getTime()-f>=d)w.parentNode&&w.parentNode.removeChild(w),n(s);else{var t=document.hidden;!0!==t&&void 0!==t||(_=u.a.offsetWidth,g=p.a.offsetWidth,y=m.a.offsetWidth,a()),c=setTimeout(e,50)}}(),i(u,function(e){_=e,a()}),r(u,h(s,'"'+s.family+'",sans-serif')),i(p,function(e){g=e,a()}),r(p,h(s,'"'+s.family+'",serif')),i(m,function(e){y=e,a()}),r(m,h(s,'"'+s.family+'",monospace'))})})},er.exports=s}()),tr.exports));const nr={fonts_loaded:Promise.resolve(),last_loaded:null,loadFonts(e){const t=JSON.stringify(e)===this.last_loaded;if(e&&!t){const t=[];for(const r in e)Array.isArray(e[r])?e[r].forEach(e=>t.push(this.loadFontFace(r,e))):t.push(this.loadFontFace(r,e[r]));this.last_loaded=JSON.stringify(e),this.fonts_loaded=Promise.all(t.filter(e=>e))}return this.fonts_loaded},async loadFontFace(e,t){if(null==t||"object"!=typeof t&&"external"!==t)return;const r={family:e};"object"==typeof t&&(Object.assign(r,t),"string"==typeof t.url&&await this.injectFontFace(r));try{r.weight="string"==typeof r.weight?r.weight.split(" ")[0]:r.weight;const t=new rr(e,r);await t.load(),_("debug",`Font face '${e}' is available`,r)}catch(t){_("warn",`Font face '${e}' is NOT available`,r,t)}},async injectFontFace({family:e,url:t,weight:r,style:n}){void 0===this.supports_native_font_loading&&(this.supports_native_font_loading=void 0!==window.FontFace);let i=t;if("blob:"===t.slice(0,5)){i=(await g.io(t,6e4,"arraybuffer")).body;let e=new Uint8Array(i);if(this.supports_native_font_loading)i=e;else{let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);i="data:font/opentype;base64,"+btoa(t)}}if(this.supports_native_font_loading){let t;"string"==typeof i?t=new FontFace(e,`url(${encodeURI(i)})`,{weight:r,style:n}):i instanceof Uint8Array&&(t=new FontFace(e,i,{weight:r,style:n})),document.fonts.add(t),_("trace","Adding FontFace to document.fonts:",t)}else{let t=`\n @font-face {\n font-family: '${e}';\n font-weight: ${r||"normal"};\n font-style: ${n||"normal"};\n src: url(${encodeURI(i)});\n }`,s=document.createElement("style");s.appendChild(document.createTextNode("")),document.head.appendChild(s),s.sheet.insertRule(t,0),_("trace","Injecting CSS font face:",t)}}},ir=new RegExp("[֑-߿יִ-﷽ﹰ-ﻼ]");function sr(e){return ir.test(e)}const or="\0-/:-@[-`{-¿×÷ʹ-˿ -⯿‐-\u2029 -⯿",ar=new RegExp("["+or+"]+");function lr(e){return ar.test(e)}const ur=new RegExp("^["+or+"-ۿ]+"),cr=new RegExp("["+or+"آ-إاد-زوٱ-ٷڈ-ڙۄ-ۋۏےۓۮۯ]"),hr=new RegExp("^[ؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ۭ]+"),dr="[̀-֑ͯ-ׇֽֿׁׂׅׄަ-ްऀ-ःऺ-ौॎॏ॑-ॗॢॣঁ-ঃ়া-ৌৗৢৣਁ-ਃ਼-ੌੑઁ-ઃ઼ા-ૌૢૣଁ-ଃ଼ା-ୌୖୗୢୣஂா-்ௗఀ-ఃా-ౌౕౖౢౣಁ-ಃ಼ಾ-ೌೕೖೢೣഁ-ഃാ-ൌൎൗൢൣංඃ්-ෟෲෳัิ-ฺ็-๎ັິ-ຼ່-ໍ༹༘༙༵༷༾༿ཱ-ྃ྆྇ྍ-ྼ࿆ါ-း်-ှၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏႚ-ႝ឴-៑៓ᩕ-ᩞᩡ-᩼᷀-᷿⃐-]",fr=new RegExp(`^.(?:${dr}+)?([्্੍્୍్್്྄္្᩠᩿]\\W(?:${dr}+)?)*`),pr={Mongolian:"᠀-"},mr=Object.keys(pr).map(e=>pr[e]).join(""),_r=new RegExp("["+mr+"]");function gr(e,t,r){const n=t?1:2;if(e.length<n)return[e];let i=e;if(r.segment[i])return r.stats.segment_hits++,r.segment[i];let s=[];if(ur.exec(e)){s=e.split(cr);let t=-1;for(var o=0;o<s.length-1;o++){if(o>0){let e=hr.exec(s[o]);e&&(s[o]=s[o].substring(e[0].length),s[o-1]+=e[0],t+=e[0].length)}t+=1+s[o].length,s[o]+=e.slice(t,t+1)}e=""}for(;e.length;){let t="",r=e,i=0;for(;i<n&&r.length;i++){let e=(fr.exec(r)||r)[0];t+=e,r=r.substring(e.length)}s.push(t),e=e.substring(t.length)}return t&&s.reverse(),r.stats.segment_misses++,r.segment[i]=s,s}class yr{constructor(e,t=1/0,r=1/0){this.width=0,this.height=0,this.lines=[],this.max_lines=t,this.text_wrap=r,this.context=e}createLine(e){return this.lines.length<this.max_lines&&new vr(e,this.text_wrap)}push(e){if(this.lines.length<this.max_lines){let t=this.context.measureText(e.text).width;return e.width=t,t>this.width&&(this.width=Math.ceil(t)),this.lines.push(e),this.height+=e.height,!0}return this.addEllipsis(),!1}advance(e,t){return!!this.push(e)&&this.createLine(t)}addEllipsis(){let e=this.lines[this.lines.length-1],t=Math.ceil(this.context.measureText(yr.ellipsis).width);e.append(yr.ellipsis),e.width+=t,e.width>this.width&&(this.width=e.width)}finish(e){e?this.push(e):this.addEllipsis()}static parse(e,t,r,n,i){let s;s="number"==typeof t?e.split(" "):[e];let o=new yr(i,r,t),a=o.createLine(n);for(let e=0;e<s.length;e++){let r=s[e].split("\n"),i=0===e;for(let s=0;s<r.length&&a;s++){let l=r[s];sr(l)&&lr(l[l.length-1])&&(l+="");let u=i?l:" "+l;if(t&&e>0&&a.exceedsTextwrap(u)){if(a=o.advance(a,n),!a)break;a.append(l),i=!0}else a.append(u);s<r.length-1&&(a=o.advance(a,n),i=!0)}e===s.length-1&&o.finish(a)}return o}}yr.ellipsis="...";class vr{constructor(e=0,t=0){this.chars=0,this.text="",this.height=Math.ceil(e),this.text_wrap=t}append(e){this.chars+=e.length,this.text+=e}exceedsTextwrap(e){return e.length+this.chars>this.text_wrap}}function br(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function xr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?br(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):br(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}class wr{constructor(){this.createCanvas(),this.vertical_text_buffer=8,this.horizontal_text_buffer=4,this.background_size=4}createCanvas(){this.canvas=document.createElement("canvas"),this.canvas.style.backgroundColor="transparent",this.context=this.canvas.getContext("2d")}resize(e,t){this.canvas.width=e,this.canvas.height=t,this.context.clearRect(0,0,e,t)}setFont({font_css:e,fill:t,stroke:r,stroke_width:n,px_size:i,supersample:s}){this.px_size=i;let o=this.context,a=g.device_pixel_ratio*s;r&&n>0&&(o.strokeStyle=r,o.lineWidth=n*a),o.fillStyle=t,o.font=e,o.miterLimit=2}async textSizes(e,t){return await nr.loadFonts(),E.add({type:"textSizes",run:this.processTextSizesTask.bind(this),texts:t,tile_id:e,cursor:{styles:Object.keys(t),texts:null,style_idx:null,text_idx:null}})}processTextSizesTask(e){let{cursor:t,texts:r}=e;for(t.style_idx=t.style_idx||0;t.style_idx<t.styles.length;){let i=t.styles[t.style_idx];null==t.text_idx&&(t.text_idx=0,t.texts=Object.keys(r[i]));let s=r[i],o=!0;for(;t.text_idx<t.texts.length;){let r=t.texts[t.text_idx],a=s[r],l=a.text_settings;if(o&&(this.setFont(l),o=!1),a.size=this.textSize(i,r,l).size,l.can_articulate){let e=!1,t=!1;if(sr(r)&&(lr(r)?e=!0:t=!0),a.isRTL=e,a.no_curving=t||(n=r,_r.test(n)),a.vertical_buffer=this.vertical_text_buffer,a.segment_sizes=[],!a.no_curving){let t=gr(r,e,wr.cache);a.segments=t;for(let e=0;e<t.length;e++)a.segment_sizes.push(this.textSize(i,t[e],l).size)}}if(t.text_idx++,!E.shouldContinue(e))return!1}t.text_idx=null,t.style_idx++}var n;return E.finish(e,r),!0}textSize(e,t,{transform:r,text_wrap:n,max_lines:i,stroke_width:s=0,background_color:o,background_stroke_width:a=0,background_width:l,underline_width:u=0,supersample:c}){if(wr.cache.text[e]=wr.cache.text[e]||{},wr.cache.text[e][t])return wr.cache.stats.text_hits++,wr.cache.text[e][t];wr.cache.stats.text_misses++,wr.cache.text_count++;const h=g.device_pixel_ratio*c,d=this.applyTextTransform(t,r),f=this.context,p=this.vertical_text_buffer*h,m=(s+this.horizontal_text_buffer)*h;l=null!=l?l:this.background_size;const _=o||a?(l+a)*h:0,y=(2+u+(u?s+1:0))*h,v=this.px_size+y;let{width:b,height:x,lines:w}=yr.parse(d,n,i,v,f);b+=2*_,x+=2*_;let A=[b/h,x/h],E=[b+2*m,x+2*p],T=[E[0]/h,E[1]/h];return wr.cache.text[e][t]={lines:w,size:{collision_size:A,texture_size:E,logical_size:T,horizontal_buffer:m,vertical_buffer:p,dpr:h,line_height:v,background_size:_}},wr.cache.text[e][t]}drawTextMultiLine(e,[t,r],n,i,s){const{dpr:o,collision_size:a,texture_size:l,line_height:u,horizontal_buffer:c,vertical_buffer:h}=n;if(i.background_color||i.background_stroke_color){const e=i.background_stroke_color,n=(i.background_stroke_width||0)*o;this.context.save(),i.background_color&&(this.context.fillStyle=i.background_color,this.context.fillRect(t+c+("curved"===s?l[0]:0)+n,r+h+n,o*a[0]-2*n,o*a[1]-2*n)),e&&n&&(this.context.strokeStyle=e,this.context.lineWidth=n,this.context.strokeRect(t+c+("curved"===s?l[0]:0)+.5*n,r+h+.5*n,o*a[0]-n,o*a[1]-n)),this.context.restore()}const d=i.underline_width||0,f=i.stroke_width||0;let p=r-(d?.5*(d+f+1)*o:0);for(let r=0;r<e.length;r++){let o=e[r];this.drawTextLine(o,[t,p],n,i,s),p+=u}this.drawTextDebug([t,r],n,s)}drawTextLine(e,[t,r],n,i,s){const{stroke:o,stroke_width:a,transform:l,align:u="center"}=i,{horizontal_buffer:c,vertical_buffer:h,texture_size:d,background_size:f,line_height:p,dpr:m}=n,_=(i.underline_width||0)*m,g=this.applyTextTransform(e.text,l);let y;"left"===u?y=t+c+f:"center"===u?y=t+d[0]/2-e.width/2:"right"===u&&(y=t+d[0]-e.width-c-f);const v=r+.75*h+p+f-.5*_,b=o&&a>0&&"curved"===s?d[0]:0;if(_){this.context.save(),this.context.strokeStyle=this.context.fillStyle,this.context.lineWidth=_;const t=v+(.5*a+2)*m+.5*this.context.lineWidth;this.context.beginPath(),this.context.moveTo(y+b,t),this.context.lineTo(y+b+e.width,t),this.context.stroke(),this.context.restore()}o&&a>0&&this.context.strokeText(g,y+b,v),this.context.fillText(g,y,v)}drawTextDebug([e,t],r,n){const{dpr:i,horizontal_buffer:s,vertical_buffer:o,texture_size:a,collision_size:l}=r;v.draw_label_collision_boxes&&(this.context.save(),this.context.strokeStyle="blue",this.context.lineWidth=2,this.context.strokeRect(e+s,t+o,i*l[0],i*l[1]),"curved"===n&&this.context.strokeRect(e+a[0]+s,t+o,i*l[0],i*l[1]),this.context.restore()),v.draw_label_texture_boxes&&(this.context.save(),this.context.strokeStyle="green",this.context.lineWidth=2,this.context.strokeRect(e+2,t+2,a[0]-4,a[1]-4),"curved"===n&&this.context.strokeRect(e+2+a[0],t+2,a[0]-4,a[1]-4),this.context.restore())}rasterize(e,t,r,n,i){return E.add({type:"rasterizeLabels",run:this.processRasterizeTask.bind(this),cancel:this.cancelRasterizeTask.bind(this),pause_factor:2,user_moving_view:!1,texts:e,textures:t,texture_prefix:n,gl:i,tile_id:r,cursor:{styles:Object.keys(e),texts:null,style_idx:0,text_idx:null,texture_idx:0,texture_resize:!0,texture_names:[]}})}processRasterizeTask(e){let t,{cursor:r,texts:n,textures:i}=e;for(;r.texture_idx<e.textures.length;){for(t=i[r.texture_idx],r.texture_resize&&(r.texture_resize=!1,this.resize(...t.texture_size));r.style_idx<r.styles.length;){let i=r.styles[r.style_idx];null==r.text_idx&&(r.text_idx=0,r.texts=Object.keys(n[i]));let s=n[i],o=!0;for(;r.text_idx<r.texts.length;){let n=r.texts[r.text_idx],a=s[n],l=a.text_settings;if(o&&(this.setFont(l),o=!1),l.can_articulate){a.texcoords=a.texcoords||{};for(let e=0;e<a.type.length;e++){let s=a.type[e];if("straight"===s){if(a.textures[e]!==r.texture_idx)continue;let o,u=a.isRTL?n.split().reverse().join():n,c=t.texcoord_cache[i][u];if(c.texcoord)o=c.texcoord;else{let e=c.texture_position,{size:r,lines:n}=this.textSize(i,u,l);this.drawTextMultiLine(n,e,r,l,s),o=k.getTexcoordsForSprite(e,r.texture_size,t.texture_size),c.texcoord=o}a.texcoords[s]={texcoord:o,texture_id:c.texture_id}}else if("curved"===s){let n=a.segments;a.texcoords.curved=a.texcoords.curved||[],a.texcoords_stroke=a.texcoords_stroke||[];for(let o=0;o<n.length;o++){if(a.textures[e][o]!==r.texture_idx)continue;let u,c,h=n[o],d=t.texcoord_cache[i][h];if(d.texcoord)u=d.texcoord,c=d.texcoord_stroke,a.texcoords_stroke.push(c);else{let e=d.texture_position,{size:r,lines:n}=this.textSize(i,h,l);this.drawTextMultiLine(n,e,r,l,s),u=k.getTexcoordsForSprite(e,r.texture_size,t.texture_size);let o=[e[0]+r.texture_size[0],e[1]];c=k.getTexcoordsForSprite(o,r.texture_size,t.texture_size),d.texcoord=u,d.texcoord_stroke=c,a.texcoords_stroke.push(c)}a.texcoords.curved.push({texcoord:u,texture_id:d.texture_id})}}}}else{let e=this.textSize(i,n,l).lines;const s=xr({},l);for(let n in a.align)a.align[n].texture_id===r.texture_idx&&(s.align=n,this.drawTextMultiLine(e,a.align[n].texture_position,a.size,s),a.align[n].texcoords=k.getTexcoordsForSprite(a.align[n].texture_position,a.size.texture_size,t.texture_size))}if(r.text_idx++,!E.shouldContinue(e))return!1}r.text_idx=null,r.style_idx++}let s=e.texture_prefix+r.texture_idx;k.create(e.gl,s,{element:this.canvas,filtering:"linear",UNPACK_PREMULTIPLY_ALPHA_WEBGL:!0}),k.retain(s),r.texture_names.push(s),r.texture_idx++,r.texture_resize=!0,r.style_idx=0}return E.finish(e,r.texture_names),!0}cancelRasterizeTask(e){_("trace",`RasterizeTask: release textures [${e.cursor.texture_names.join(", ")}]`),e.cursor.texture_names.forEach(e=>k.release(e))}setTextureTextPositions(e,t){let r={cx:0,cy:0,width:0,height:0,column_width:0,texture_id:0,texcoord_cache:{}},n=[];for(let i in e){let s=e[i];for(let e in s){let o,a=s[e];if(a.text_settings.can_articulate){a.textures=[],r.texcoord_cache[i]=r.texcoord_cache[i]||{};for(let s=0;s<a.type.length;s++){let l=a.type[s];if("straight"===l){let l=a.isRTL?e.split().reverse().join():e;if(!r.texcoord_cache[i][l]){let e=a.size.texture_size;o=this.placeText(e[0],e[1],i,r,n,t),r.texcoord_cache[i][l]={texture_id:r.texture_id,texture_position:o}}a.textures[s]=r.texture_id}else if("curved"===l){a.textures[s]=[];for(let e=0;e<a.segment_sizes.length;e++){let l=a.segments[e];if(!r.texcoord_cache[i][l]){let s=a.segment_sizes[e].texture_size,u=2*s[0];o=this.placeText(u,s[1],i,r,n,t),r.texcoord_cache[i][l]={texture_id:r.texture_id,texture_position:o}}a.textures[s].push(r.texture_id)}}}}else{let e=a.size.texture_size;for(let s in a.align)o=this.placeText(e[0],e[1],i,r,n,t),a.align[s].texture_id=r.texture_id,a.align[s].texture_position=o}}}return r.column_width>0&&r.height>0&&(n[r.texture_id]={texture_size:[r.width,r.height],texcoord_cache:r.texcoord_cache}),n}placeText(e,t,r,n,i,s){let o;return n.cy+t>s?(n.cx+=n.column_width,n.cy=0,n.column_width=e):n.column_width=Math.max(n.column_width,e),n.cx+n.column_width<=s?(o=[n.cx,n.cy],n.cy+=t,n.height=Math.max(n.height,n.cy),n.width=Math.max(n.width,n.cx+n.column_width)):(i[n.texture_id]={texture_size:[n.width,n.height],texcoord_cache:n.texcoord_cache},n.texcoord_cache={},n.texcoord_cache[r]={},n.texture_id++,n.cx=0,n.cy=t,n.column_width=e,n.width=e,n.height=t,o=[0,0]),o}applyTextTransform(e,t){return"capitalize"===t?e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1)}):"uppercase"===t?e.toUpperCase():"lowercase"===t?e.toLowerCase():e}static fontPixelSize(e){if(null==e)return;e="string"==typeof e?e:String(e);let[,t,r]=e.match(wr.font_size_re)||[];return r=r||"px","em"===r?t*=16:"pt"===r?t/=.75:"%"===r&&(t/=6.25),t=J.parsePositiveNumber(t),t*=g.device_pixel_ratio,t}static pruneTextCache(){wr.cache.text_count>wr.cache.text_count_max&&(wr.cache.text={},wr.cache.text_count=0,_("debug","TextCanvas: pruning text cache")),Object.keys(wr.cache.segment).length>wr.cache.segment_count_max&&(wr.cache.segment={},_("debug","TextCanvas: pruning segment cache"))}}function Ar(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}wr.font_size_re=/((?:[0-9]*\.)?[0-9]+)\s*(px|pt|em|%)?/,wr.cache={text:{},text_count:0,text_count_max:2e3,segment:{},segment_count_max:2e3,stats:{text_hits:0,text_misses:0,segment_hits:0,segment_misses:0}};let Er=0;const Tr={resetText(){t.is_main?this.canvas=new wr:t.is_worker&&(this.texts={})},freeText(e){delete this.texts[e.id]},parseTextFeature(e,t,r,n){let i=this.parseTextSource(e,t,r);if(null==i||""===i)return;let s=Qt.compute(t,r),o=Qt.key(s);this.texts[n.id]=this.texts[n.id]||{};let a=this.texts[n.id][o]=this.texts[n.id][o]||{};if(i instanceof Object){let l=[],u=i.left+"-"+i.right;for(let c in i){let h=i[c];if(!h)continue;let d=this.computeTextLayout({},e,t,r,n,h,s,u,c);a[h]||(a[h]={text_settings:s,ref:0}),l.push({draw:t,text:h,text_settings_key:o,layout:d})}return l.length>0&&l}{let l=this.computeTextLayout({},e,t,r,n,i,s);return a[i]||(a[i]={text_settings:s,ref:0}),{draw:t,text:i,text_settings_key:o,layout:l}}},parseTextSource(e,t,r){let n,i=t.text_source||"name";if(null==i||Array.isArray(i)||"object"!=typeof i)n=this.parseTextSourceValue(i,e,r);else{n={};for(let t in i)n[t]=this.parseTextSourceValue(i[t],e,r)}return n},parseTextSourceValue(e,t,r){let n;if(Array.isArray(e)){for(let i=0;i<e.length;i++)if("string"==typeof e[i]?n=t.properties[e[i]]:"function"==typeof e[i]&&(n=e[i](r)),n)return n}else"string"==typeof e?n=t.properties[e]:e instanceof Function&&(n=e(r));return n},async prepareTextLabels(e,t){if(0===Object.keys(this.texts[e.id]||{}).length)return[];try{const r=await a.postMessage(this.main_thread_target+".calcTextSizes",e.id,this.texts[e.id]);return e.canceled?(_("trace",`Style ${this.name}: stop tile build because tile was canceled: ${e.key}, post-calcTextSizes()`),[]):(this.texts[e.id]=r||[],r?this.buildTextLabels(e,t):($t.abortTile(e.id),[]))}catch(t){return $t.abortTile(e.id),[]}},async collideAndRenderTextLabels(e,t,r){let n=await this.prepareTextLabels(e,r);if(0===n.length)return $t.collide([],t,e.id),{};if(n=await $t.collide(n,t,e.id),e.canceled)return _("trace",`stop tile build because tile was canceled: ${e.key}, post-collide()`),{};let s=this.texts[e.id];if(null==s||0===n.length)return{};this.cullTextStyles(s,n),n.forEach(e=>{let t=e.text_settings_key,r=s[t]&&s[t][e.text];r.text_settings.can_articulate?(r.type||(r.type=[]),-1===r.type.indexOf(e.label.type)&&r.type.push(e.label.type)):(r.align=r.align||{},r.align[e.label.align]={})});try{const t=await a.postMessage(this.main_thread_target+".rasterizeTexts",e.id,e.key,s);return e.canceled?(_("trace",`stop tile build because tile was canceled: ${e.key}, post-rasterizeTexts()`),{}):function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ar(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ar(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({labels:n},t)}catch(e){return{}}},cullTextStyles(e,t){for(let r=0;r<t.length;r++){let n=t[r];e[n.text_settings_key][n.text].ref++}for(let t in e)for(let r in e[t])e[t][r].ref<1&&delete e[t][r];for(let t in e)0===Object.keys(e[t]).length&&delete e[t]},calcTextSizes(e,t){return this.canvas.textSizes(e,t)},async rasterizeTexts(e,t,r){let n=new wr,i=Math.min(this.max_texture_size,2048),s=n.setTextureTextPositions(r,i),o=["labels",this.name,t,e,Er,""].join("-");return Er++,s=await n.rasterize(r,s,e,o,this.gl),s?{texts:r,textures:s}:{}},preprocessText(e){if(e&&e.font&&"object"==typeof e.font)return e.font.weight=J.createPropertyCache(e.font.weight),e.font.fill=J.createPropertyCache(e.font.fill||Qt.defaults.fill),e.font.alpha=J.createPropertyCache(e.font.alpha),e.font.stroke&&(e.font.stroke.color=J.createPropertyCache(e.font.stroke.color),e.font.stroke.alpha=J.createPropertyCache(e.font.stroke.alpha)),e.font.background&&(e.font.background.color=J.createPropertyCache(e.font.background.color),e.font.background.alpha=J.createPropertyCache(e.font.background.alpha),e.font.background.width=J.createPropertyCache(e.font.background.width,J.parsePositiveNumber),e.font.background.stroke&&(e.font.background.stroke.color=J.createPropertyCache(e.font.background.stroke.color),e.font.background.stroke.alpha=J.createPropertyCache(e.font.background.stroke.alpha))),e.font.px_size=J.createPropertyCache(e.font.size||Qt.defaults.size,wr.fontPixelSize,wr.fontPixelSize),e.font.stroke&&null!=e.font.stroke.width&&(e.font.stroke.width=J.createPropertyCache(e.font.stroke.width,J.parsePositiveNumber)),e.font.background&&e.font.background.stroke&&null!=e.font.background.stroke.width&&(e.font.background.stroke.width=J.createPropertyCache(e.font.background.stroke.width,J.parsePositiveNumber)),e.offset=J.createPropertyCache(e.offset,e=>Array.isArray(e)&&e.map(J.parseNumber)),e.buffer=J.createPropertyCache(e.buffer,e=>(Array.isArray(e)?e:[e,e]).map(J.parsePositiveNumber)),e.repeat_distance=J.createPropertyCache(e.repeat_distance,J.parsePositiveNumber),e},computeTextLayout(e,t,r,n,i,s,o,a,l){let u=e||{};return u=this.computeLayout(u,t,r,n,i),null==r.repeat_distance&&(u.repeat_distance="point"===n.geometry?0:G.tile_size,u.repeat_distance&&(u.repeat_distance*=u.units_per_pixel,u.repeat_scale=1,"function"==typeof r.repeat_group?u.repeat_group=r.repeat_group(n):u.repeat_group=r.repeat_group)),u.repeat_distance&&(a&&(u.repeat_group+="/"+a),u.repeat_group+="/"+s),u.subdiv=i.overzoom2,u.align=r.align,u.italic="normal"!==o.style,"right"===l?u.orientation=1:"left"===l&&(u.orientation=-1),u}};var Sr,kr,Or,Rr,Cr,Nr,Pr,Mr,Dr,zr,Ir,Fr,Lr,jr,Ur,Br,Vr=P(kr?Sr:(kr=1,Sr=function(e,t){var r=t[0],n=t[1],i=t[2],s=t[3],o=t[4],a=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],f=t[11],p=t[12],m=t[13],_=t[14],g=t[15],y=r*a-n*o,v=r*l-i*o,b=r*u-s*o,x=n*l-i*a,w=n*u-s*a,A=i*u-s*l,E=c*m-h*p,T=c*_-d*p,S=c*g-f*p,k=h*_-d*m,O=h*g-f*m,R=d*g-f*_,C=y*R-v*O+b*k+x*S-w*T+A*E;return C?(C=1/C,e[0]=(a*R-l*O+u*k)*C,e[1]=(l*S-o*R-u*T)*C,e[2]=(o*O-a*S+u*E)*C,e[3]=(i*O-n*R-s*k)*C,e[4]=(r*R-i*S+s*T)*C,e[5]=(n*S-r*O-s*E)*C,e[6]=(m*A-_*w+g*x)*C,e[7]=(_*b-p*A-g*v)*C,e[8]=(p*w-m*b+g*y)*C,e):null})),Gr=P(Rr?Or:(Rr=1,Or=function(e,t){var r=t[0],n=t[1],i=t[2],s=t[3],o=t[4],a=t[5],l=t[6],u=t[7],c=t[8],h=c*o-a*u,d=-c*s+a*l,f=u*s-o*l,p=r*h+n*d+i*f;return p?(p=1/p,e[0]=h*p,e[1]=(-c*n+i*u)*p,e[2]=(a*n-i*o)*p,e[3]=d*p,e[4]=(c*r-i*l)*p,e[5]=(-a*r+i*s)*p,e[6]=f*p,e[7]=(-u*r+n*l)*p,e[8]=(o*r-n*s)*p,e):null})),$r=P(Nr?Cr:(Nr=1,Cr=function(e,t,r){var n=t[0],i=t[1],s=t[2],o=t[3],a=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=t[9],f=t[10],p=t[11],m=t[12],_=t[13],g=t[14],y=t[15],v=r[0],b=r[1],x=r[2],w=r[3];return e[0]=v*n+b*a+x*h+w*m,e[1]=v*i+b*l+x*d+w*_,e[2]=v*s+b*u+x*f+w*g,e[3]=v*o+b*c+x*p+w*y,v=r[4],b=r[5],x=r[6],w=r[7],e[4]=v*n+b*a+x*h+w*m,e[5]=v*i+b*l+x*d+w*_,e[6]=v*s+b*u+x*f+w*g,e[7]=v*o+b*c+x*p+w*y,v=r[8],b=r[9],x=r[10],w=r[11],e[8]=v*n+b*a+x*h+w*m,e[9]=v*i+b*l+x*d+w*_,e[10]=v*s+b*u+x*f+w*g,e[11]=v*o+b*c+x*p+w*y,v=r[12],b=r[13],x=r[14],w=r[15],e[12]=v*n+b*a+x*h+w*m,e[13]=v*i+b*l+x*d+w*_,e[14]=v*s+b*u+x*f+w*g,e[15]=v*o+b*c+x*p+w*y,e})),qr=P(Mr?Pr:(Mr=1,Pr=function(e,t,r){var n,i,s,o,a,l,u,c,h,d,f,p,m=r[0],_=r[1],g=r[2];return t===e?(e[12]=t[0]*m+t[4]*_+t[8]*g+t[12],e[13]=t[1]*m+t[5]*_+t[9]*g+t[13],e[14]=t[2]*m+t[6]*_+t[10]*g+t[14],e[15]=t[3]*m+t[7]*_+t[11]*g+t[15]):(n=t[0],i=t[1],s=t[2],o=t[3],a=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=t[9],f=t[10],p=t[11],e[0]=n,e[1]=i,e[2]=s,e[3]=o,e[4]=a,e[5]=l,e[6]=u,e[7]=c,e[8]=h,e[9]=d,e[10]=f,e[11]=p,e[12]=n*m+a*_+h*g+t[12],e[13]=i*m+l*_+d*g+t[13],e[14]=s*m+u*_+f*g+t[14],e[15]=o*m+c*_+p*g+t[15]),e})),Wr=P(zr?Dr:(zr=1,Dr=function(e,t,r){var n=r[0],i=r[1],s=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*s,e[9]=t[9]*s,e[10]=t[10]*s,e[11]=t[11]*s,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e})),Hr=P(Fr?Ir:(Fr=1,Ir=function(e,t,r,n,i){var s=1/Math.tan(t/2),o=1/(n-i);return e[0]=s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=(i+n)*o,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*i*n*o,e[15]=0,e}));function Zr(){return jr?Lr:(jr=1,Lr=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e})}var Kr,Xr,Yr=function(){if(Br)return Ur;Br=1;var e=Zr();return Ur=function(t,r,n,i){var s,o,a,l,u,c,h,d,f,p,m=r[0],_=r[1],g=r[2],y=i[0],v=i[1],b=i[2],x=n[0],w=n[1],A=n[2];return Math.abs(m-x)<1e-6&&Math.abs(_-w)<1e-6&&Math.abs(g-A)<1e-6?e(t):(h=m-x,d=_-w,f=g-A,s=v*(f*=p=1/Math.sqrt(h*h+d*d+f*f))-b*(d*=p),o=b*(h*=p)-y*f,a=y*d-v*h,(p=Math.sqrt(s*s+o*o+a*a))?(s*=p=1/p,o*=p,a*=p):(s=0,o=0,a=0),l=d*a-f*o,u=f*s-h*a,c=h*o-d*s,(p=Math.sqrt(l*l+u*u+c*c))?(l*=p=1/p,u*=p,c*=p):(l=0,u=0,c=0),t[0]=s,t[1]=l,t[2]=h,t[3]=0,t[4]=o,t[5]=u,t[6]=d,t[7]=0,t[8]=a,t[9]=c,t[10]=f,t[11]=0,t[12]=-(s*m+o*_+a*g),t[13]=-(l*m+u*_+c*g),t[14]=-(h*m+d*_+f*g),t[15]=1,t)}}(),Qr=P(Yr),Jr=P(Zr()),en=P(Xr?Kr:(Xr=1,Kr=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}));const tn={fromValues(e,t,r){var n=new Float64Array(3);return n[0]=e,n[1]=t,n[2]=r,n}},rn={normalFromMat4:Vr,invert:Gr},nn={multiply:$r,translate:qr,scale:Wr,perspective:Hr,lookAt:Qr,identity:Jr,copy:en};class sn{constructor(e,t,r={}){this.view=t,this.position=r.position,this.zoom=r.zoom}static create(e,t,r){switch(r.type){case"isometric":return new an(e,t,r);case"flat":return new ln(e,t,r);default:return new on(e,t,r)}}update(){}setupProgram(){}updateView(){if(this.position||this.zoom){var e={};this.position&&(e={lng:this.position[0],lat:this.position[1],zoom:this.position[2]}),this.zoom&&(e.zoom=this.zoom),this.view.setView(e)}}setupMatrices(e,t){nn.multiply(e.model_view32,this.view_matrix,e.model),t.uniform("Matrix4fv","u_modelView",e.model_view32),rn.normalFromMat4(e.normal32,e.model_view32),rn.invert(e.inverse_normal32,e.normal32),t.uniform("Matrix3fv","u_normalMatrix",e.normal32),t.uniform("Matrix3fv","u_inverseNormalMatrix",e.inverse_normal32)}}class on extends sn{constructor(e,t,r={}){super(e,t,r),this.type="perspective",this.focal_length=r.focal_length,this.fov=r.fov,this.focal_length||this.fov||(this.focal_length=[[16,2],[17,2.5],[18,3],[19,4],[20,6]]),this.vanishing_point=r.vanishing_point||[0,0],this.vanishing_point=this.vanishing_point.map(parseFloat),this.vanishing_point_skew=[],this.position_meters=null,this.view_matrix=new Float64Array(16),this.projection_matrix=new Float32Array(16),j.replaceBlock("camera","\n uniform mat4 u_projection;\n uniform vec3 u_eye;\n uniform vec2 u_vanishing_point;\n\n void cameraProjection (inout vec4 position) {\n position = u_projection * position;\n }")}constrainCamera({view_height:e,height:t,focal_length:r,fov:n}){return t?(r=2*t/e,n=2*Math.atan(1/r)):(r?n=2*Math.atan(1/r):n&&(n=n*Math.PI/180,r=1/Math.tan(n/2)),t=e/2*r),{view_height:e,height:t,focal_length:r,fov:n}}updateMatrices(){var e=this.view.size.css.height*this.view.meters_per_pixel,{height:t,fov:r}=this.constrainCamera({view_height:e,focal_length:g.interpolate(this.view.zoom,this.focal_length),fov:g.interpolate(this.view.zoom,this.fov)}),n=[this.view.center.meters.x,this.view.center.meters.y,t];this.position_meters=n,nn.lookAt(this.view_matrix,tn.fromValues(n[0],n[1],0),tn.fromValues(n[0],n[1],-1),tn.fromValues(0,1,0)),nn.perspective(this.projection_matrix,r,this.view.aspect,1,2*t),this.vanishing_point_skew[0]=this.vanishing_point[0]/this.view.size.css.width,this.vanishing_point_skew[1]=this.vanishing_point[1]/this.view.size.css.height,this.projection_matrix[8]=2*-this.vanishing_point_skew[0],this.projection_matrix[9]=2*-this.vanishing_point_skew[1],nn.translate(this.projection_matrix,this.projection_matrix,tn.fromValues(e/2*this.view.aspect*(2*-this.vanishing_point_skew[0]),e/2*(2*-this.vanishing_point_skew[1]),0)),nn.translate(this.projection_matrix,this.projection_matrix,tn.fromValues(0,0,-t))}update(){super.update(),this.updateMatrices()}setupProgram(e){e.uniform("Matrix4fv","u_projection",this.projection_matrix),e.uniform("3f","u_eye",[0,0,this.position_meters[2]]),e.uniform("2fv","u_vanishing_point",this.vanishing_point_skew)}}class an extends sn{constructor(e,t,r={}){super(e,t,r),this.type="isometric",this.axis=r.axis||{x:0,y:1},2===this.axis.length&&(this.axis={x:this.axis[0],y:this.axis[1]}),this.position_meters=null,this.viewport_height=null,this.view_matrix=new Float64Array(16),this.projection_matrix=new Float32Array(16),j.replaceBlock("camera","\n uniform mat4 u_projection;\n uniform vec3 u_eye;\n uniform vec2 u_vanishing_point;\n\n void cameraProjection (inout vec4 position) {\n position = u_projection * position;\n // position.xy += position.z * u_isometric_axis;\n\n // Reverse z for depth buffer so up is negative,\n // and scale down values so objects higher than one screen height will not get clipped\n // pull forward slightly to avoid going past far clipping plane\n position.z = -position.z / 100. + 1. - 0.001;\n }")}update(){super.update(),this.viewport_height=this.view.size.css.height*this.view.meters_per_pixel;var e=[this.view.center.meters.x,this.view.center.meters.y,this.viewport_height];this.position_meters=e,nn.identity(this.view_matrix),nn.translate(this.view_matrix,this.view_matrix,tn.fromValues(-e[0],-e[1],0)),nn.identity(this.projection_matrix),this.projection_matrix[8]=this.axis.x/this.view.aspect,this.projection_matrix[9]=this.axis.y,nn.scale(this.projection_matrix,this.projection_matrix,tn.fromValues(2/this.view.size.meters.x,2/this.view.size.meters.y,2/this.view.size.meters.y))}setupProgram(e){e.uniform("Matrix4fv","u_projection",this.projection_matrix),e.uniform("3fv","u_eye",[0,0,this.viewport_height]),e.uniform("2fv","u_vanishing_point",[0,0])}}class ln extends an{constructor(e,t,r={}){super(e,t,r),this.type="flat"}update(){this.axis.x=0,this.axis.y=0,super.update()}}const un=qt.PLACEMENT,cn=Object.create(Ne),hn="__shader_point";Object.assign(cn,Tr),Object.assign(cn,{name:"points",built_in:!0,vertex_shader_src:"uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_tile_proxy_order_offset;\nuniform bool u_tile_fade_in;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\nuniform bool u_view_panning;\nuniform float u_view_pan_snap_timer;\n\nuniform mat4 u_model;\nuniform mat4 u_modelView;\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nattribute vec4 a_position;\nattribute vec4 a_shape;\nattribute vec4 a_color;\nattribute vec2 a_texcoord;\nattribute vec2 a_offset;\n\nuniform float u_point_type;\n\n#ifdef TANGRAM_CURVED_LABEL\n attribute vec4 a_offsets;\n attribute vec4 a_pre_angles;\n attribute vec4 a_angles;\n#endif\n\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying vec4 v_world_position;\nvarying float v_alpha_factor;\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n attribute float a_outline_edge;\n attribute vec4 a_outline_color;\n\n varying float v_outline_edge;\n varying vec4 v_outline_color;\n varying float v_aa_offset;\n#endif\n\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\n varying float v_label_hidden;\n#endif\n\n#define TANGRAM_PI 3.14159265359\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvec2 rotate2D(vec2 _st, float _angle) {\n return mat2(cos(_angle),-sin(_angle),\n sin(_angle),cos(_angle)) * _st;\n}\n\n#ifdef TANGRAM_CURVED_LABEL\n // Assumes stops are [0, 0.33, 0.66, 0.99];\n float mix4linear(vec4 v, float x) {\n x = clamp(x, 0., 1.);\n return mix(mix(v[0], v[1], 3. * x),\n mix(v[1],\n mix(v[2], v[3], 3. * (max(x, .66) - .66)),\n 3. * (clamp(x, .33, .66) - .33)),\n step(0.33, x)\n );\n }\n#endif\n\nvoid main() {\n // Initialize globals\n #pragma tangram: setup\n\n // discard hidden labels by collapsing into degenerate triangle\n #ifndef TANGRAM_SHOW_HIDDEN_LABELS\n if (a_shape.w == 0.) {\n gl_Position = vec4(0., 0., 0., 1.);\n return;\n }\n #else\n // highlight hidden label in fragment shader for debugging\n if (a_shape.w == 0.) {\n v_label_hidden = 1.; // label debug testing\n }\n else {\n v_label_hidden = 0.;\n }\n #endif\n\n v_alpha_factor = 1.0;\n v_color = a_color;\n v_texcoord = a_texcoord; // UV from vertex attribute\n\n #ifdef TANGRAM_HAS_SHADER_POINTS\n v_outline_color = a_outline_color;\n v_outline_edge = a_outline_edge;\n\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // use point dimensions for UVs instead (ignore attribute), add antialiasing info for fragment shader\n float _size = abs(a_shape.x / 128.); // radius in pixels\n v_texcoord = sign(a_shape.xy) * (_size + 1.) / _size;\n _size += 2.;\n v_aa_offset = 2. / _size;\n }\n #endif\n\n // Position\n vec4 position = u_modelView * vec4(a_position.xyz, 1.);\n\n // Apply positioning and scaling in screen space\n vec2 _shape = a_shape.xy / 256.; // values have an 8-bit fraction\n vec2 _offset = vec2(a_offset.x, -a_offset.y); // flip y to make it point down\n float _theta = a_shape.z / 4096.;\n\n #ifdef TANGRAM_CURVED_LABEL\n //TODO: potential bug? null is passed in for non-curved labels, otherwise the first offset will be 0\n if (a_offsets[0] != 0.){\n vec4 _angles_scaled = (TANGRAM_PI / 16384.) * a_angles;\n vec4 _pre_angles_scaled = (TANGRAM_PI / 128.) * a_pre_angles;\n vec4 _offsets_scaled = (1. / 64.) * a_offsets;\n\n float _zoom = clamp(u_map_position.z - u_tile_origin.z, 0., 1.); //fract(u_map_position.z);\n float _pre_angle = mix4linear(_pre_angles_scaled, _zoom);\n float _angle = mix4linear(_angles_scaled, _zoom);\n float _offset_curve = mix4linear(_offsets_scaled, _zoom);\n\n _shape = rotate2D(_shape, _pre_angle); // rotate in place\n _shape.x += _offset_curve; // offset for curved label segment\n _shape = rotate2D(_shape, _angle); // rotate relative to curved label anchor\n _shape += rotate2D(_offset, _theta); // offset if specified in the scene file\n }\n else {\n _shape = rotate2D(_shape + _offset, _theta);\n }\n #else\n _shape = rotate2D(_shape + _offset, _theta);\n #endif\n\n // Fade in (if requested) based on time mesh has been visible.\n // Value passed to fragment shader in the v_alpha_factor varying\n #ifdef TANGRAM_FADE_IN_RATE\n if (u_tile_fade_in) {\n v_alpha_factor *= clamp(u_visible_time * TANGRAM_FADE_IN_RATE, 0., 1.);\n }\n #endif\n\n // World coordinates for 3d procedural textures\n v_world_position = u_model * position;\n v_world_position.xy += _shape * u_meters_per_pixel;\n v_world_position = wrapWorldPosition(v_world_position);\n\n // Modify position before camera projection\n #pragma tangram: position\n\n cameraProjection(position);\n\n #ifdef TANGRAM_LAYER_ORDER\n // +1 is to keep all layers including proxies > 0\n applyLayerOrder(a_position.w + u_tile_proxy_order_offset + 1., position);\n #endif\n\n // Apply pixel offset in screen-space\n // Multiply by 2 is because screen is 2 units wide Normalized Device Coords (and u_resolution device pixels wide)\n // Device pixel ratio adjustment is because shape is in logical pixels\n position.xy += _shape * position.w * 2. * u_device_pixel_ratio / u_resolution;\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // enlarge by 1px to catch missed MSAA fragments\n position.xy += sign(_shape) * position.w * u_device_pixel_ratio / u_resolution;\n }\n #endif\n\n // Snap to pixel grid\n // Only applied to fully upright sprites/labels (not shader-drawn points), while panning is not active\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (!u_view_panning && (abs(_theta) < TANGRAM_EPSILON) && u_point_type != TANGRAM_POINT_TYPE_SHADER) {\n #else\n if (!u_view_panning && (abs(_theta) < TANGRAM_EPSILON)) {\n #endif\n vec2 _position_fract = fract((((position.xy / position.w) + 1.) * .5) * u_resolution);\n vec2 _position_snap = position.xy + ((step(0.5, _position_fract) - _position_fract) * position.w * 2. / u_resolution);\n\n // Animate the snapping to smooth the transition and make it less noticeable\n #ifdef TANGRAM_VIEW_PAN_SNAP_RATE\n position.xy = mix(position.xy, _position_snap, clamp(u_view_pan_snap_timer * TANGRAM_VIEW_PAN_SNAP_RATE, 0., 1.));\n #else\n position.xy = _position_snap;\n #endif\n }\n\n gl_Position = position;\n}\n",fragment_shader_src:"uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nuniform sampler2D u_texture;\nuniform float u_point_type;\nuniform bool u_apply_color_blocks;\n\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying vec4 v_world_position;\nvarying float v_alpha_factor;\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n varying vec4 v_outline_color;\n varying float v_outline_edge;\n varying float v_aa_offset;\n#endif\n\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\n varying float v_label_hidden;\n#endif\n\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n //l is the distance from the center to the fragment, R is the radius of the drawn point\n float _tangram_antialias(float l, float R){\n float low = R - v_aa_offset;\n float high = R + v_aa_offset;\n return 1. - smoothstep(low, high, l);\n }\n#endif\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n\n #ifdef TANGRAM_HAS_SHADER_POINTS\n // Only apply shader blocks to point, not to attached text (N.B.: for compatibility with ES)\n if (u_point_type == TANGRAM_POINT_TYPE_TEXTURE) { // sprite texture\n color *= texture2D(u_texture, v_texcoord);\n }\n else if (u_point_type == TANGRAM_POINT_TYPE_LABEL) { // label texture\n color = texture2D(u_texture, v_texcoord);\n color.rgb /= max(color.a, 0.001); // un-multiply canvas texture\n }\n else if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // Mask of outermost circle, either outline or point boundary\n float _d = length(v_texcoord); // distance to this fragment from the point center\n float _outer_alpha = _tangram_antialias(_d, 1.);\n float _fill_alpha = _tangram_antialias(_d, 1. - (v_outline_edge * 0.5)) * color.a;\n float _stroke_alpha = (_outer_alpha - _tangram_antialias(_d, 1. - v_outline_edge)) * v_outline_color.a;\n\n // Apply alpha compositing with stroke 'over' fill.\n #ifdef TANGRAM_BLEND_ADD\n color.a = _stroke_alpha + _fill_alpha;\n color.rgb = color.rgb * _fill_alpha + v_outline_color.rgb * _stroke_alpha;\n #else // TANGRAM_BLEND_OVERLAY (and fallback for not implemented blending modes)\n color.a = _stroke_alpha + _fill_alpha * (1. - _stroke_alpha);\n color.rgb = mix(color.rgb * _fill_alpha, v_outline_color.rgb, _stroke_alpha) / max(color.a, 0.001); // avoid divide by zero\n #endif\n }\n #else\n // If shader points not supported, assume label texture\n color = texture2D(u_texture, v_texcoord);\n color.rgb /= max(color.a, 0.001); // un-multiply canvas texture\n #endif\n\n // Shader blocks for color/filter are only applied for sprites, shader points, and standalone text,\n // NOT for text attached to a point (N.B.: for compatibility with ES)\n if (u_apply_color_blocks) {\n #pragma tangram: color\n #pragma tangram: filter\n }\n\n color.a *= v_alpha_factor;\n\n // highlight hidden label in fragment shader for debugging\n #ifdef TANGRAM_SHOW_HIDDEN_LABELS\n if (v_label_hidden > 0.) {\n color.a *= 0.5;\n color.rgb = vec3(1., 0., 0.);\n }\n #endif\n\n // Use alpha test as a lower-quality substitute\n // For opaque and translucent: avoid transparent pixels writing to depth buffer, obscuring geometry underneath\n // For multiply: avoid transparent pixels multiplying geometry underneath to zero/full black\n #if defined(TANGRAM_BLEND_OPAQUE) || defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n if (color.a < TANGRAM_ALPHA_TEST) {\n discard;\n }\n #endif\n\n // Make points more visible in wireframe debug mode\n #ifdef TANGRAM_WIREFRAME\n color = vec4(vec3(0.5), 1.); // use gray outline for textured points\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) {\n color = vec4(v_color.rgb, 1.); // use original vertex color outline for shader points\n }\n #endif\n #endif\n\n gl_FragColor = color;\n}\n",selection:!0,collision:!0,blend:"overlay",init(e={}){Ne.init.call(this,e),this.setupDefines(),this.defines.TANGRAM_HAS_SHADER_POINTS=!0,this.defines.TANGRAM_POINT_TYPE_TEXTURE=1,this.defines.TANGRAM_POINT_TYPE_LABEL=2,this.defines.TANGRAM_POINT_TYPE_SHADER=3,this.collision_group_points=this.name+"-points",this.collision_group_text=this.name+"-text",this.stencil_proxy_tiles=!1,this.reset()},setupDefines(){"overlay"!==this.blend&&(this.defines.TANGRAM_LAYER_ORDER=!0),!0===v.suppress_label_fade_in?(this.fade_in_time=0,this.defines.TANGRAM_FADE_IN_RATE=null):(this.fade_in_time=.15,this.defines.TANGRAM_FADE_IN_RATE=1/this.fade_in_time),!0!==v.suppress_label_snap_animation&&(this.defines.TANGRAM_VIEW_PAN_SNAP_RATE=2),!0===v.show_hidden_labels&&(this.defines.TANGRAM_SHOW_HIDDEN_LABELS=!0),!0===v.wireframe&&(this.defines.TANGRAM_WIREFRAME=!0)},reset(){this.queues={},this.resetText(),this.texture_missing_sprites={}},addFeature(e,t,r){let n=r.tile;if(n.generation!==this.generation)return;let i,s={};if(s.color=this.parseColor(t.color,r),s.texture=t.texture,s.label_texture=null,s.blend_order=t.blend_order,!s.color&&!s.texture)return;if(s.alpha=J.evalCachedProperty(t.alpha,r),this.hasSprites(s)){if(i=this.parseSprite(s,t,r),!i)return void _({level:"debug",once:!0},`Layer group '${t.layers.join(", ")}' uses a texture '${s.texture}', but doesn't specify which sprite to draw. Features that match this layer group won't be drawn without specifying the sprite with the 'sprite' or 'sprite_default' properties. The merged draw parameters for this layer group are:`,t).then(r=>{r&&_("debug",`Example feature for layer group '${t.layers.join(", ")}'`,e)});s.texcoords=i.texcoords}else if(t.sprite)return void _({level:"warn",once:!0},`Layer group '${t.layers.join(", ")}' specifies sprite '${t.sprite}', but the texture '${t.texture}' doesn't define any sprites. Features that match this layer group won't be drawn. The merged draw parameters for this layer group are:`,t);if(this.calcSize(t,s,i,r),t.outline&&(s.outline_width=J.evalCachedProperty(t.outline.width,r)||J.defaults.outline.width,s.outline_color=this.parseColor(t.outline.color,r)),s.outline_edge_pct=0,s.outline_width&&s.outline_color){let e=s.outline_width;s.size[0]+=e,s.size[1]+=e,s.outline_edge_pct=e/Math.min(s.size[0],s.size[1])*2,s.outline_alpha=J.evalCachedProperty(t.outline.alpha,r)}s.size[0]=Math.min(s.size[0],256),s.size[1]=Math.min(s.size[1],256),s.placement=t.placement,s.placement_min_length_ratio=J.evalCachedProperty(t.placement_min_length_ratio,r),s.placement===un.SPACED&&t.placement_spacing&&(s.placement_spacing=J.evalCachedProperty(t.placement_spacing,r)),s.angle=J.evalProperty(t.angle,r)||0,s.z=J.evalCachedDistanceProperty(t.z,r)||J.defaults.z,s.tile_edges=t.tile_edges,this.computeLayout(s,e,t,r,n);let o=t.text&&!1!==t.text.visible&&this.parseTextFeature(e,t.text,r,n);Array.isArray(o)&&(o=null,_({level:"warn",once:!0},`Layer group '${t.layers.join(", ")}': cannot use boundary labels (e.g. 'text_source: { left: ..., right: ... }') for 'text' labels attached to 'points'; provided 'text_source' value was ${JSON.stringify(t.text.text_source)}`)),o&&(o.layout.parent=s,o.layout.priority=t.text.priority?Math.max(o.layout.priority,s.priority+.5):s.priority+.5,$t.addStyle(this.collision_group_text,n.id)),this.queueFeature({feature:e,draw:t,context:r,style:s,text_feature:o},n),$t.addStyle(this.collision_group_points,n.id)},calcSize(e,t,r,n){if(t.size=e.size,t.size){if(t.size=J.evalCachedPointSizeProperty(e.size,r,k.textures[t.texture],n),null==t.size)return void _({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': 'size' (${JSON.stringify(e.size.value)}) couldn't be interpreted, features that match this layer group won't be drawn`);"number"==typeof t.size&&(t.size=[t.size,t.size])}else t.size=r&&r.css_size||[16,16]},hasSprites:e=>e.texture&&k.textures[e.texture]&&k.textures[e.texture].sprites,getSpriteInfo(e,t){let r=k.textures[e.texture].sprites[t]&&k.getSpriteInfo(e.texture,t);return t&&!r?(this.texture_missing_sprites[e.texture]=this.texture_missing_sprites[e.texture]||{},this.texture_missing_sprites[e.texture][t]||(_("debug",`Style: in style '${this.name}', could not find sprite '${t}' for texture '${e.texture}'`),this.texture_missing_sprites[e.texture][t]=!0)):r&&(r.sprite=t),r},parseSprite(e,t,r){let n=J.evalProperty(t.sprite,r);return this.getSpriteInfo(e,n)||this.getSpriteInfo(e,t.sprite_default)},queueFeature(e,t){this.tile_data[t.id]&&this.queues[t.id]||this.startData(t),this.queues[t.id]=this.queues[t.id]||[],this.queues[t.id].push(e)},async endData(e){if(e.canceled)return _("trace",`Style ${this.name}: stop tile build because tile was canceled: ${e.key}`),null;let t=this.queues[e.id];delete this.queues[e.id];let r=[],n=[];t.forEach(e=>{let t=e.style,i=e.feature,s=i.geometry,o=this.buildLabels(t.size,s,t);for(let s=0;s<o.length;s++){let a=o[s],l={feature:i,draw:e.draw,context:e.context,style:t,label:a};if(n.push(l),e.text_feature){let t={feature:i,draw:e.text_feature.draw,context:e.context,text:e.text_feature.text,text_settings_key:e.text_feature.text_settings_key,layout:e.text_feature.layout,point_label:a,linked:l};r.push(t),e.draw.text.optional||(l.linked=t)}}});const[,{labels:i,texts:s,textures:o}]=await Promise.all([$t.collide(n,this.collision_group_points,e.id).then(e=>{e.forEach(e=>{this.feature_style=e.style,this.feature_style.label=e.label,this.feature_style.linked=e.linked,Ne.addFeature.call(this,e.feature,e.draw,e.context)})}),this.collideAndRenderTextLabels(e,this.collision_group_text,r)]);i&&s&&i.forEach(e=>{let t=e.text_settings_key,r=s[t]&&s[t][e.text],n=this.feature_style;n.label=e.label,n.linked=e.linked,n.size=r.size.logical_size,n.texcoords=r.align[e.label.align].texcoords,n.label_texture=o[r.align[e.label.align].texture_id],n.blend_order=e.draw.blend_order,Ne.addFeature.call(this,e.feature,e.draw,e.context)}),this.freeText(e);const a=await Ne.endData.call(this,e);return a&&o&&o.length&&(a.textures=a.textures||[],a.textures.push(...o)),a},_preprocess(e){e.color=J.createColorPropertyCache(e.color),e.alpha=J.createPropertyCache(e.alpha),e.texture=void 0!==e.texture?e.texture:this.texture,e.blend_order=this.getBlendOrderForDraw(e),e.outline&&(e.outline.color=J.createColorPropertyCache(e.outline.color),e.outline.alpha=J.createPropertyCache(e.outline.alpha),e.outline.width=J.createPropertyCache(e.outline.width,J.parsePositiveNumber)),e.z=J.createPropertyCache(e.z,J.parseUnits);try{e.size=J.createPointSizePropertyCache(e.size,e.texture)}catch(t){return _({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': ${t} (${JSON.stringify(e.size)}), features that match this layer group won't be drawn.`),null}if(e.offset=J.createPropertyCache(e.offset,e=>Array.isArray(e)&&e.map(J.parseNumber)),e.buffer=J.createPropertyCache(e.buffer,e=>(Array.isArray(e)?e:[e,e]).map(J.parsePositiveNumber)),e.repeat_distance=J.createPropertyCache(e.repeat_distance,J.parseNumber),e.placement=un[e.placement&&e.placement.toUpperCase()],null==e.placement&&(e.placement=un.VERTEX),e.placement_spacing=null!=e.placement_spacing?e.placement_spacing:80,e.placement_spacing=J.createPropertyCache(e.placement_spacing,J.parsePositiveNumber),e.placement_min_length_ratio=null!=e.placement_min_length_ratio?e.placement_min_length_ratio:1,e.placement_min_length_ratio=J.createPropertyCache(e.placement_min_length_ratio,J.parsePositiveNumber),"number"==typeof e.angle)e.angle=e.angle*Math.PI/180;else if("function"==typeof e.angle){const t=e.angle;e.angle=e=>t(e)*Math.PI/180}else e.angle=e.angle||0;return e.text=this.preprocessText(e.text),e.text&&(e.text.key=e.key,e.text.group=e.group,e.text.layers=e.layers,e.text.order=e.order,e.text.blend_order=e.blend_order,e.text.repeat_group=null!=e.text.repeat_group?e.text.repeat_group:e.repeat_group,e.text.anchor=e.text.anchor||this.default_anchor,e.text.optional="boolean"==typeof e.text.optional&&e.text.optional,e.text.interactive=e.text.interactive||e.interactive),e},default_anchor:["bottom","top","right","left"],computeLayout(e,t,r,n,i){let s=e||{};s.id=t,s.units_per_pixel=i.units_per_pixel||1,s.collide=!1!==r.collide,s.anchor=r.anchor,s.offset=J.evalCachedProperty(r.offset,n)||J.zeroPair,s.buffer=J.evalCachedProperty(r.buffer,n)||J.zeroPair,s.repeat_distance=J.evalCachedProperty(r.repeat_distance,n),s.repeat_distance&&(s.repeat_distance*=s.units_per_pixel,s.repeat_scale=1,"function"==typeof r.repeat_group?s.repeat_group=r.repeat_group(n):s.repeat_group=r.repeat_group||n.layer);let o=r.priority;return null!=o?"function"==typeof o&&(o=o(n)):o=-1>>>0,s.priority=o,s},buildTextLabels(e,t){let r=[];for(let n=0;n<t.length;n++){let i=t[n],s=this.texts[e.id][i.text_settings_key][i.text].size.collision_size;i.label=new qt(i.point_label.position,s,i.layout),r.push(i)}return r},buildLabels(e,t,r){let n=[];if("Point"===t.type)n.push(new qt(t.coordinates,e,r,r.angle));else if("MultiPoint"===t.type){let i=t.coordinates;for(let t=0;t<i.length;++t){let s=i[t];n.push(new qt(s,e,r,r.angle))}}else if("LineString"===t.type){let i=Ht(t.coordinates,e,r);for(let e=0;e<i.length;++e)n.push(i[e])}else if("MultiLineString"===t.type){let i=t.coordinates;for(let t=0;t<i.length;t++){let s=Ht(i[t],e,r);for(let e=0;e<s.length;++e)n.push(s[e])}}else if("Polygon"===t.type)if(r.placement===un.CENTROID){let i=G.centroid(t.coordinates);i&&n.push(new qt(i,e,r,r.angle))}else{let i=t.coordinates;for(let t=0;t<i.length;t++){let s=Ht(i[t],e,r);for(let e=0;e<s.length;++e)n.push(s[e])}}else if("MultiPolygon"===t.type)if(r.placement===un.CENTROID){let i=G.multiCentroid(t.coordinates);i&&n.push(new qt(i,e,r,r.angle))}else{let i=t.coordinates;for(let t=0;t<i.length;t++){let s=i[t];for(let t=0;t<s.length;t++){let i=Ht(s[t],e,r);for(let e=0;e<i.length;++e)n.push(i[e])}}}return n},makeVertexTemplate(e,t,r=!0){let n=0;this.vertex_template[n++]=0,this.vertex_template[n++]=0,this.vertex_template[n++]=e.z||0,this.vertex_template[n++]=this.scaleOrder(e.order),this.vertex_template[n++]=0,this.vertex_template[n++]=0,this.vertex_template[n++]=0,this.vertex_template[n++]=e.label.layout.collide?0:1,t.variant.shader_point||(this.vertex_template[n++]=0,this.vertex_template[n++]=0),this.vertex_template[n++]=0,this.vertex_template[n++]=0;const i=e.color||J.defaults.color;if(this.vertex_template[n++]=255*i[0],this.vertex_template[n++]=255*i[1],this.vertex_template[n++]=255*i[2],this.vertex_template[n++]=255*(null!=e.alpha?e.alpha:i[3]),t.variant.selection&&(this.vertex_template[n++]=255*e.selection_color[0],this.vertex_template[n++]=255*e.selection_color[1],this.vertex_template[n++]=255*e.selection_color[2],this.vertex_template[n++]=255*e.selection_color[3]),t.variant.shader_point){const t=e.outline_color||J.defaults.outline.color;this.vertex_template[n++]=255*t[0],this.vertex_template[n++]=255*t[1],this.vertex_template[n++]=255*t[2],this.vertex_template[n++]=255*(null!=e.outline_alpha?e.outline_alpha:t[3]),this.vertex_template[n++]=e.outline_edge_pct||J.defaults.outline.width}return r&&this.addCustomAttributesToVertexTemplate(e,n),this.vertex_template},buildQuad:(e,t,r,n,i,s,o,a,l,u,c)=>t[0]<=0||t[1]<=0?0:function(e,t,r,n,i,s,o,a,l,u,c,h){const d=128*i[0],f=128*i[1];Tt[0]=-d,Tt[1]=-f,Tt[2]=d,Tt[3]=f;const p=c||Ue,m=t.vertex_elements;let _=t.vertex_count;for(let i=0;i<4;i++)r[n.a_position+0]=e[0],r[n.a_position+1]=e[1],r[n.a_shape+0]=Tt[At[i]],r[n.a_shape+1]=Tt[Et[i]],r[n.a_shape+2]=l,r[n.a_offset+0]=s[0],r[n.a_offset+1]=s[1],n.a_texcoord&&(r[n.a_texcoord+0]=65535*p[At[i]],r[n.a_texcoord+1]=65535*p[Et[i]]),h&&(r[n.a_pre_angles+0]=xt*a[0],r[n.a_pre_angles+1]=xt*a[1],r[n.a_pre_angles+2]=xt*a[2],r[n.a_pre_angles+3]=xt*a[3],r[n.a_angles+0]=wt*u[0],r[n.a_angles+1]=wt*u[1],r[n.a_angles+2]=wt*u[2],r[n.a_angles+3]=wt*u[3],r[n.a_offsets+0]=64*o[0],r[n.a_offsets+1]=64*o[1],r[n.a_offsets+2]=64*o[2],r[n.a_offsets+3]=64*o[3]),t.addVertex(r);return m.push(_+0),m.push(_+1),m.push(_+2),m.push(_+2),m.push(_+3),m.push(_+0),2}(e,u,c,u.vertex_layout.index,t,s,o,i,4096*r,n,a,l),build(e,t){let r=e.label;return"curved"===r.type?this.buildCurvedLabel(r,e,t):this.buildStraightLabel(r,e,t)},buildStraightLabel(e,t,r){let n,i,s=this.getTileMesh(r.tile,this.meshVariantTypeForDraw(t)),o=this.makeVertexTemplate(t,s);"point"!==e.type?(n=t.size[e.type],i=t.texcoords[e.type].texcoord):(n=t.size,i=t.texcoords),s.uniforms=s.uniforms||{},t.label_texture?(s.uniforms.u_texture=t.label_texture,s.uniforms.u_point_type=2,s.uniforms.u_apply_color_blocks=!1):t.texture?(s.uniforms.u_texture=t.texture,s.uniforms.u_point_type=1,s.uniforms.u_apply_color_blocks=!0):(s.uniforms.u_texture=k.default,s.uniforms.u_point_type=3,s.uniforms.u_apply_color_blocks=!0);let a=e.offset,l=this.buildQuad(e.position,n,e.angle,null,null,a,null,i,!1,s.vertex_data,o);const u=t.linked&&t.linked.label.id;return this.trackLabel(e,u,s,l,r),l},buildCurvedLabel(e,t,r){let n,i,s=0;for(let o=0;o<e.num_segments;o++){let a=t.size[e.type][o],l=t.texcoords_stroke[o];t.label_texture=t.label_textures[o],n=this.getTileMesh(r.tile,this.meshVariantTypeForDraw(t)),i=this.makeVertexTemplate(t,n),n.uniforms=n.uniforms||{},n.uniforms.u_texture=t.label_texture,n.uniforms.u_point_type=2,n.uniforms.u_apply_color_blocks=!1;let u=e.offset||[0,0],c=e.position,h=e.angles[o],d=e.offsets[o],f=e.pre_angles[o],p=this.buildQuad(c,a,e.angle,h,f,u,d,l,!0,n.vertex_data,i);s+=p;const m=t.linked&&t.linked.label.id;this.trackLabel(e,m,n,p,r)}for(let o=0;o<e.num_segments;o++){let a=t.size[e.type][o],l=t.texcoords[e.type][o].texcoord;t.label_texture=t.label_textures[o],n=this.getTileMesh(r.tile,this.meshVariantTypeForDraw(t)),i=this.makeVertexTemplate(t,n),n.uniforms=n.uniforms||{},n.uniforms.u_texture=t.label_texture,n.uniforms.u_point_type=2,n.uniforms.u_apply_color_blocks=!1;let u=e.offset||[0,0],c=e.position,h=e.angles[o],d=e.offsets[o],f=e.pre_angles[o],p=this.buildQuad(c,a,e.angle,h,f,u,d,l,!0,n.vertex_data,i);s+=p;const m=t.linked&&t.linked.label.id;this.trackLabel(e,m,n,p,r)}return s},trackLabel(e,t,r,n){if(e.layout.collide||e.may_repeat_across_tiles){r.labels=r.labels||{},r.labels[e.id]=r.labels[e.id]||{container:{label:e.toJSON(),linked:t},ranges:[]};const i=2*n,s=r.vertex_data.offset-r.vertex_data.stride*i;r.labels[e.id].ranges.push([s,i])}},buildLines(e,t,r){return this.build(t,r)},buildPoints(e,t,r){return this.build(t,r)},buildPolygons(e,t,r){return this.build(t,r)},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.shader_point]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_shape",size:4,type:fe.SHORT,normalized:!1},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0,static:e.shader_point?[0,0]:null},{name:"a_offset",size:2,type:fe.SHORT,normalized:!1},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_outline_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.shader_point?null:[0,0,0,0]},{name:"a_outline_edge",size:1,type:fe.FLOAT,normalized:!1,static:e.shader_point?null:0}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.shader_point]=new Le(t)}return this.vertex_layouts[e.shader_point]},meshVariantTypeForDraw(e){const t=e.label_texture||e.texture||hn,r=t+"/"+e.blend_order;return null==this.variants[r]&&(this.variants[r]={key:r,selection:1,shader_point:t===hn,blend_order:e.blend_order,mesh_order:e.label_texture?1:0}),this.variants[r]},makeMesh(e,t,r={}){return r=Object.assign({},r,{fade_in_time:this.fade_in_time}),Ne.makeMesh.call(this,e,t,r)}});const dn=[0,.33,.66,.99];let fn=function(e,t,r,n){const i=[{type:"straight",tolerance:n.no_curving?1.8:1.5},{type:"curved"},{type:"straight",tolerance:2.3}];for(let s=0;s<i.length;s++){let o,a=i[s];if("straight"===a.type?o=new mn(t,r,n,a.tolerance):"curved"===a.type&&!n.no_curving&&r.length>2&&(o=new _n(e,r,n)),o&&!o.throw_away)return o}return!1};class pn{constructor(e){this.id=Ut.nextLabelId(),this.layout=e,this.position=[],this.angle=0,this.offset=e.offset.slice(),this.unit_scale=this.layout.units_per_pixel,this.obbs=[],this.aabbs=[],this.type="",this.throw_away=!1}toJSON(){return{id:this.id,type:this.type,position:this.position,size:this.size,offset:this.offset,angle:this.angle,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Bt(this.layout)}}static splitLineByOrientation(e){let t=[e[0]],r=0,n=0,i=0,s=t,o=!1;for(let a=1;a<e.length;a++){let l=e[a],u=e[a-1],c=ye.length(ye.sub(l,u));l[0]>u[0]?1===i?(t.push(l),r+=c,r>n&&(s=t,n=r,o=!1)):(t=[u,l],r=c,r>n&&(s=t,n=r,o=!1),i=1):l[0]<u[0]?-1===i?(t.unshift(l),r+=c,r>n&&(s=t,n=r,o=!0)):(t=[l,u],r=c,r>n&&(s=t,n=r,o=!0),i=-1):(-1===i?t.unshift(l):(t.push(l),i=1),r+=c,r>n&&(s=t,n=r,o=-1===i))}return[s,o]}discard(e,t=null){if(this.throw_away)return!0;for(let r=0;r<this.obbs.length;r++){let n={aabb:this.aabbs[r],obb:this.obbs[r]};if(Ut.prototype.occluded.call(n,e,t))return!0}return!1}inTileBounds(){for(let e=0;e<this.aabbs.length;e++){let t={aabb:this.aabbs[e]};if(!Ut.prototype.inTileBounds.call(t))return!1}return!0}static createOBB(e,t,r,n,i,s,o){let a=e[0],l=e[1];return!s||0===s[0]&&0===s[1]||(a+=(s=ye.rot(s,i))[0]*o,l-=s[1]*o),new jt(a,l,-n,t,r)}}class mn extends pn{constructor(e,t,r,n){super(r),this.type="straight",this.size=e,this.throw_away=!this.fit(e,t,r,n)}fit(e,t,r,n){let i,s=this.unit_scale;[t,i]=pn.splitLineByOrientation(t),"number"==typeof r.orientation&&(this.offset[1]+=1.2*(e[1]-r.vertical_buffer),i&&(this.offset[1]*=-1),-1===r.orientation&&(this.offset[1]*=-1));let o=vn(t),a=e[0]*s;for(let i=0;i<t.length-1;i++){let s,l=t[i],u=0,c=0,h=i+1;for(;h<t.length;){let d=t[h-1],f=t[h],p=yn(d,f);if(h!==i+1&&(u+=bn(p,s)),Math.abs(u)>.1)break;if(c+=o[h-1],gn(c,a)<n){let t=ye.mult(ye.add(l,f),.5);return this.angle=-p,Math.abs(this.angle-Math.PI/2)<.01&&(this.angle=-Math.PI/2,"number"==typeof r.orientation&&(this.offset[1]*=-1)),this.position=t,this.updateBBoxes(this.position,e,this.angle,this.angle,this.offset),!0}s=p,h++}}return!1}updateBBoxes(e,t,r,n,i){let s=this.unit_scale;this.obbs=[],this.aabbs=[];let o=(t[0]+2*this.layout.buffer[0])*s*Ut.epsilon,a=(t[1]+2*this.layout.buffer[1])*s*Ut.epsilon,l=pn.createOBB(e,o,a,r,n,i,s),u=l.getExtent();this.obbs.push(l),this.aabbs.push(u),this.inTileBounds&&(this.breach=!this.inTileBounds()),this.mayRepeatAcrossTiles&&(this.may_repeat_across_tiles=this.mayRepeatAcrossTiles())}}class _n extends pn{constructor(e,t,r){super(r),this.type="curved",this.angles=[],this.pre_angles=[],this.offsets=[],this.num_segments=e.length,this.sizes=e,this.throw_away=!this.fit(this.sizes,t,r)}toJSON(){return{id:this.id,type:this.type,obbs:this.obbs.map(e=>e.toJSON()),position:this.position,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Bt(this.layout)}}fit(e,t,r){let n,i=this.unit_scale,s=Math.max(...e.map(e=>e[1])),o=s*i;[t,n]=pn.splitLineByOrientation(t),"number"==typeof r.orientation&&(this.offset[1]+=1.2*(s-r.vertical_buffer),n&&(this.offset[1]*=-1),-1===r.orientation&&(this.offset[1]*=-1));let a=vn(t),l=e.map(e=>e[0]*i),u=a.reduce((e,t)=>e+t,0),c=l.reduce((e,t)=>e+t,0);if(c>u)return!1;let h=t.length-1;if(h-0<2)return!1;let d=_n.curvaturePlacement(t,u,a,c,0,h),f=t[d];if(-1===d||h-d<2)return!1;this.position=f;for(var p=0;p<l.length;p++){this.offsets[p]=[],this.angles[p]=[],this.pre_angles[p]=[];for(var m=0;m<dn.length;m++){let e=dn[m],[r,n]=_n.scaleLine(e,t);f=r[d];let{positions:s,offsets:a,angles:u,pre_angles:c}=_n.placeAtIndex(d,r,n,l),h=a.map(e=>Math.sqrt(e[0]*e[0]+e[1]*e[1])/i);if(0===e){this.angle=1/u.length*u.reduce((e,t)=>e+t);for(let e=0;e<s.length;e++){let t=s[e],r=c[e],n=l[e],a=r+u[e],h=this.angle,d=pn.createOBB(t,n,o,a,h,this.offset,i),f=d.getExtent();this.obbs.push(d),this.aabbs.push(f)}}this.offsets[p].push(h[p]),this.angles[p].push(u[p]),this.pre_angles[p].push(c[p])}}return!0}static curvaturePlacement(e,t,r,n,i,s){i=i||0,s=s||e.length-1;var o=[];for(let t=i+1;t<s;t++){var a=e[t-1],l=e[t],u=e[t+1],c=ye.perp(l,a),h=ye.perp(u,l),d=ye.angleBetween(c,h);d>1&&(d=1/0),o.push(d)}o.push(1/0);var f=[],p=[],m=i,_=0;for(let e=0;e<i;e++)_+=r[e];for(;_+n<t;){for(var g=_+n,y=_,v=m,b=0;v<s&&y+r[v]<g&&(b+=o[v])!==1/0;)y+=r[v],v++;if(0===b)return m;var x=b/(v-m);f.push(b),p.push(x),_+=r[m],m++}if(0===f.length)return-1;var w=Math.min.apply(null,f),A=p[f.indexOf(w)];return w<1.3&&A<.4?f.indexOf(w):-1}static scaleLine(e,t){var r=[t[0]],n=[];return t.forEach((i,s)=>{if(s!==t.length-1){var o=ye.sub(t[s+1],t[s]),a=ye.mult(o,1+e);r.push(ye.add(r[s],a)),n.push(ye.length(a))}}),[r,n]}static placeAtIndex(e,t,r,n){let i=t[e],[s,o]=_n.getIndicesAndOffsets(e,r,n),a=_n.getPositionsFromIndicesAndOffsets(t,s,o),[l,u,c]=_n.getAnglesFromIndicesAndOffsets(i,s,t,a);return{positions:a,offsets:l,angles:u,pre_angles:c}}static getIndicesAndOffsets(e,t,r){let n=r.length,i=[],s=[],o=0,a=0,l=0;for(;o<n;){let u=r[o];for(;o<n&&a+.5*u<=l+t[e];){let t=a-l+.5*u;s.push(t),i.push(e),a+=u,o++,u=r[o]}l+=t[e],e++}return[i,s]}static getPositionsFromIndicesAndOffsets(e,t,r){let n=[];for(let i=0;i<t.length;i++){let s=t[i],o=r[i],a=yn(e[s],e[s+1]),l=ye.rot([o,0],a),u=ye.add(e[s],l);n.push(u)}return n}static getAnglesFromIndicesAndOffsets(e,t,r,n){let i=[],s=[],o=[];for(let a=0;a<n.length;a++){let l=n[a],u=t[a],c=ye.sub(l,e),h=-ye.angle(c),d=-yn(r[u],r[u+1])-h;if(a>0){let e=i[a-1],t=s[a-1];Math.abs(h-e)>Math.PI&&(h+=h>e?-2*Math.PI:2*Math.PI),Math.abs(t-d)>Math.PI&&(d+=d>t?-2*Math.PI:2*Math.PI)}i.push(h),s.push(d),o.push(c)}return[o,i,s]}}function gn(e,t){return t/e}function yn(e,t){let r=ye.sub(t,e);return ye.angle(r)}function vn(e){let t=[];for(let r=0;r<e.length-1;r++){let n=e[r],i=e[r+1],s=Math.hypot(n[0]-i[0],n[1]-i[1]);t.push(s)}return t}function bn(e,t){let r,n;for(e>t?(r=t,n=e):(r=e,n=t);n-r>Math.PI;)r+=2*Math.PI;return Math.abs(n-r)}let xn=Object.create(cn);Object.assign(xn,{name:"text",super:cn,built_in:!0,init(e={}){Ne.init.call(this,e),this.setupDefines(),this.defines.TANGRAM_HAS_SHADER_POINTS=!1,this.defines.TANGRAM_CURVED_LABEL=!0,this.reset()},makeVertexTemplate(e,t){this.super.makeVertexTemplate.call(this,e,t,!1);let r=t.vertex_data.vertex_layout.index.a_pre_angles;for(let e=0;e<12;e++)this.vertex_template[r++]=0;return this.addCustomAttributesToVertexTemplate(e,r),this.vertex_template},reset(){this.queues={},this.resetText()},addFeature(e,t,r){let n=r.tile;if(n.generation!==this.generation)return;let i=e.geometry.type;t.can_articulate="LineString"===i||"MultiLineString"===i,t.supersample_text="LineString"===i||"MultiLineString"===i;let s=this.parseTextFeature(e,t,r,n);s&&(s instanceof Array?s.forEach(t=>{t.feature=e,t.context=r,t.layout.vertex=!1,this.queueFeature(t,n)}):(s.feature=e,s.context=r,s.layout.vertex=!1,this.queueFeature(s,n)),$t.addStyle(this.name,n.id))},async endData(e){let t=this.queues[e.id];delete this.queues[e.id];const{labels:r,texts:n,textures:i}=await this.collideAndRenderTextLabels(e,this.name,t);r&&n&&(this.texts[e.id]=n,r.forEach(t=>{let r=t.text_settings_key,n=this.texts[e.id][r]&&this.texts[e.id][r][t.text],s=this.feature_style;s.label=t.label,n.text_settings.can_articulate?(s.size={},s.texcoords={},"straight"===t.label.type?(s.size.straight=n.size.logical_size,s.texcoords.straight=n.texcoords.straight,s.label_texture=i[n.texcoords.straight.texture_id]):(s.size.curved=n.segment_sizes.map(function(e){return e.logical_size}),s.texcoords_stroke=n.texcoords_stroke,s.texcoords.curved=n.texcoords.curved,s.label_textures=n.texcoords.curved.map(e=>i[e.texture_id]))):(s.size=n.size.logical_size,s.texcoords=n.align[t.label.align].texcoords,s.label_texture=i[n.align[t.label.align].texture_id]),s.blend_order=t.draw.blend_order,Ne.addFeature.call(this,t.feature,t.draw,t.context)})),this.freeText(e);const s=await Ne.endData.call(this,e);if(s){i&&i.length&&s.textures.push(...i);for(let e in s.meshes)s.meshes[e].uniforms.u_apply_color_blocks=!0}return s},_preprocess(e){return e.blend_order=this.getBlendOrderForDraw(e),this.preprocessText(e)},buildTextLabels(e,t){let r=[];for(let i=0;i<t.length;i++){let s,o=t[i],a=this.texts[e.id][o.text_settings_key][o.text];if(o.layout.vertical_buffer=a.vertical_buffer,a.text_settings.can_articulate){var n=a.segment_sizes.map(e=>e.collision_size);o.layout.no_curving=a.no_curving,s=this.buildLabels(n,o.feature.geometry,o.layout,a.size.collision_size)}else s=this.buildLabels(a.size.collision_size,o.feature.geometry,o.layout);for(let e=0;e<s.length;e++){let t=Object.create(o);t.label=s[e],r.push(t)}}return r},buildLabels(e,t,r,n){let i=[];if("LineString"===t.type)Array.prototype.push.apply(i,this.buildLineLabels(t.coordinates,e,r,n));else if("MultiLineString"===t.type){let s=t.coordinates;for(let t=0;t<s.length;++t)Array.prototype.push.apply(i,this.buildLineLabels(s[t],e,r,n))}else if("Point"===t.type)i.push(new qt(t.coordinates,e,r));else if("MultiPoint"===t.type){let n=t.coordinates;for(let t=0;t<n.length;++t)i.push(new qt(n[t],e,r))}else if("Polygon"===t.type){let n=G.centroid(t.coordinates);n&&i.push(new qt(n,e,r))}else if("MultiPolygon"===t.type){let n=G.multiCentroid(t.coordinates);n&&i.push(new qt(n,e,r))}return i},buildLineLabels(e,t,r,n){let i=[],s=Math.min(r.subdiv,e.length-1);if(s>1){let o=(e.length-1)/s;for(let a=0;a<s;a++){let s=Math.floor(a*o),l=Math.floor((a+1)*o)+1,u=e.slice(s,l),c=fn(t,n,u,r);c&&i.push(c)}}if(i.length<s){let s=fn(t,n,e,r);s&&i.push(s)}return i},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.shader_point]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_shape",size:4,type:fe.SHORT,normalized:!1},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0},{name:"a_offset",size:2,type:fe.SHORT,normalized:!1},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_pre_angles",size:4,type:fe.BYTE,normalized:!1},{name:"a_angles",size:4,type:fe.SHORT,normalized:!1},{name:"a_offsets",size:4,type:fe.UNSIGNED_SHORT,normalized:!1}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.shader_point]=new Le(t)}return this.vertex_layouts[e.shader_point]}}),xn.texture_id=0;let wn=Object.create(et);function An(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function En(e){return null!=e}function Tn(e){return"("+e+")"}function Sn(e){return"string"==typeof e?'"'+e+'"':e}function kn(e){return"$"===e[0]?"context['"+e.substring(1)+"']":e.indexOf(".")>-1?-1===e.indexOf("\\.")?`context.feature.properties${e.split(".").map(e=>"['"+e+"']").join("")}`:`context.feature.properties${e.replace(/\\\./g,"__TANGRAM_DELIMITER__").split(".").map(e=>e.replace(/__TANGRAM_DELIMITER__/g,".")).map(e=>"['"+e+"']").join("")}`:"context.feature.properties['"+e+"']"}function On(e,t){return Tn(Sn(t)+" === "+kn(e))}function Rn(e,t){return Tn(`${"["+t.map(Sn).join(",")+"]"}.indexOf(${kn(e)}) > -1`)}function Cn(e,t){return Tn(e.filter(En).map(function(e){return Tn(e.join(" && "))}).join(" "+t+" "))}function Nn(e,t,r){return t&&t.length>0?Cn(t.map(function(e){return Ln(e,r)}),"||"):"true"}function Pn(e,t,r){return t&&t.length>0?Cn(t.map(function(e){return Ln(e,r)}),"&&"):"true"}function Mn(e,t,r){return"!"+Tn(Ln(t,r).join(" && "))}function Dn(e,t,r){return"!"+Tn(Nn(0,t,r))}function zn(e,t){return Tn(kn(e)+(t?" != ":" == ")+"null")}function In(e,t,r){var n=[],i=r&&"function"==typeof r.rangeTransform&&r.rangeTransform;if(t.max){var s=i?i(t.max):t.max;n.push(kn(e)+" < "+s)}if(t.min){var o=i?o=i(t.min):t.min;n.push(kn(e)+" >= "+o)}return Tn(n.join(" && "))}function Fn(e,t){let r=[];if(t.includes_any){const n="["+(Array.isArray(t.includes_any)?t.includes_any:[t.includes_any]).map(Sn).join(",")+"]";r.push(`${kn(e)} != null && ${n}.some(function(v) { return ${kn(e)}.indexOf(v) > -1 })`)}if(t.includes_all){const n="["+(Array.isArray(t.includes_all)?t.includes_all:[t.includes_all]).map(Sn).join(",")+"]";r.push(`${kn(e)} != null && ${n}.every(function(v) { return ${kn(e)}.indexOf(v) > -1 })`)}return Tn(r.join(" && "))}function Ln(e,t){var r=[];if("function"==typeof e)return[Tn(e.toString()+"(context)")];if(Array.isArray(e))return[Nn(0,e,t)];if(null==e)return["true"];for(var n=Object.keys(e),i=0;i<n.length;i++){var s=n[i],o=e[s],a=typeof o;if("string"===a||"number"===a)r.push(On(s,o));else if("boolean"===a)r.push(zn(s,o));else if("not"===s)r.push(Mn(0,o,t));else if("any"===s)r.push(Nn(0,o,t));else if("all"===s)r.push(Pn(0,o,t));else if("none"===s)r.push(Dn(0,o,t));else if(Array.isArray(o))r.push(Rn(s,o));else if("object"===a&&null!=o)o.max||o.min?r.push(In(s,o,t)):(o.includes_any||o.includes_all)&&r.push(Fn(s,o));else{if(null!=o)throw new Error("Unknown Query syntax: "+o);r.push(" true ")}}return 0===n.length?["true"]:r}function jn(e,t){return null==e?function(){return!0}:new Function("context","return "+Tn(Ln(e,t).join(" && "))+";")}Object.assign(wn,{name:"raster",super:et,built_in:!0,init(){this.raster=this.raster||"color",this.super.init.apply(this,arguments),this.selection=!1},_preprocess(e){return e.color=e.color||J.defaults.color,this.super._preprocess.apply(this,arguments)}});const Un=["filter","draw","visible","enabled","data","exclusive","priority"];let Bn={};function Vn(e,t){let r,n=0;for(let t=0;t<e.length;t++)e[t].length>n&&(n=e[t].length);if(0===n)return null;let i={visible:!0};for(let s=0;s<n;s++)r=[],e.forEach(e=>{e[s]&&e[s][t]&&-1===r.indexOf(e[s][t])&&r.push(e[s][t])}),0!==r.length&&V(i,...r);return!1===i.visible?null:i}const Gn=["any","all","not","none"];class $n{constructor({layer:e,name:t,parent:r,draw:n,visible:i,enabled:s,filter:o,exclusive:a,priority:l,styles:u}){if(this.id=$n.id++,this.config_data=e.data,this.parent=r,this.name=t,this.full_name=this.parent?this.parent.full_name+":"+this.name:this.name,this.draw=n,this.filter=o,this.exclusive=!0===a,this.priority=null!=l?l:Number.MAX_SAFE_INTEGER,this.styles=u,this.is_built=!1,s=void 0===s?i:s,this.enabled=!1!==s,this.draw)for(let e in this.draw)if(this.draw[e]=null==this.draw[e]?{}:this.draw[e],"object"!=typeof this.draw[e]){let t=`Draw group '${e}' for layer ${this.full_name} is invalid, must be an object, `;t+=`but was set to \`${e}: ${this.draw[e]}\` instead`,_("warn",t),delete this.draw[e]}}build(){_("trace",`Building layer '${this.full_name}'`),this.buildFilter(),this.buildDraw(),this.is_built=!0}buildDraw(){this.draw=Z(this.draw,J.wrapFunction),this.calculatedDraw=function(e){let t=[];if(e.parent){let r=e.parent.calculatedDraw||[];t.push(...r)}return t.push(e.draw),t}(this)}buildFilter(){this.filter_original=this.filter,this.filter=Z(this.filter,J.wrapFunction);let e=typeof this.filter;if(null!=this.filter&&"object"!==e&&"function"!==e){let e=`Filter for layer ${this.full_name} is invalid, filter value must be an object or function, `;return e+=`but was set to \`filter: ${this.filter}\` instead`,void _("warn",e)}try{this.buildZooms(),this.buildPropMatches(),null!=this.filter&&("function"==typeof this.filter||Object.keys(this.filter).length>0)?this.filter=jn(this.filter,Hn):this.filter=null}catch(e){let t=`Filter for layer ${this.full_name} is invalid, \`filter: ${JSON.stringify(this.filter)}\` `;t+=`failed with error '${e.message}', stack trace: ${e.stack}`,_("warn",t)}}buildZooms(){let e=this.filter&&this.filter.$zoom,t=typeof e;if(null!=e){if(this.zooms={},"number"===t)this.zooms[e]=!0;else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.zooms[e[t]]=!0;else if("object"===t&&(null!=e.min||null!=e.max)){let t=e.min||0,r=e.max||G.max_style_zoom;for(let e=t;e<r;e++)this.zooms[e]=!0}delete this.filter.$zoom}}buildPropMatches(){this.filter&&!Array.isArray(this.filter)&&"function"!=typeof this.filter&&Object.keys(this.filter).forEach(e=>{if(-1===Gn.indexOf(e)){let t=this.filter[e],r=typeof t,n=Array.isArray(t);if(!n&&"string"!==r&&"number"!==r)return;"$"===e[0]?(this.context_prop_matches=this.context_prop_matches||[],this.context_prop_matches.push([e.substring(1),n?t:[t]]),delete this.filter[e]):-1===e.indexOf(".")&&(this.feature_prop_matches=this.feature_prop_matches||[],this.feature_prop_matches.push([e,n?t:[t]]),delete this.filter[e])}})}doPropMatches(e){if(this.feature_prop_matches)for(let t=0;t<this.feature_prop_matches.length;t++){let r=this.feature_prop_matches[t],n=e.feature.properties[r[0]];if(null==n||-1===r[1].indexOf(n))return!1}if(this.context_prop_matches)for(let t=0;t<this.context_prop_matches.length;t++){let r=this.context_prop_matches[t],n=e[r[0]];if(null==n||-1===r[1].indexOf(n))return!1}return!0}doesMatch(e){if(!this.enabled)return!1;if(this.is_built||this.build(),null!=this.zooms&&!this.zooms[e.zoom])return!1;if(!this.doPropMatches(e))return!1;let t;if(this.filter instanceof Function)try{t=this.filter(e)}catch(t){let r=`Filter for this ${this.full_name}: \`filter: ${this.filter_original}\` `;r+=`failed with error '${t.message}', stack trace: ${t.stack}`,_("error",r,e.feature)}else t=null==this.filter;return!!t&&(this.children_to_parse&&(function(e,t,r){for(let n in t){let i=t[n];if("object"!=typeof i||Array.isArray(i)){let t=`Layer value must be an object: cannot create layer '${n}: ${JSON.stringify(i)}'`;t+=`, under parent layer '${e.full_name}'.`,r[e.name]&&(t+=` The parent name '${e.name}' is also the name of a style, did you mean to create a 'draw' group`,e.parent&&(t+=` under '${e.parent.name}'`),t+=" instead?"),_("warn",t)}else Kn(n,i,e,r)}e.layers.sort((e,t)=>{if(e.exclusive<t.exclusive)return 1;if(e.exclusive>t.exclusive)return-1;const r=e.exclusive?1:-1;return e.priority>t.priority?r:e.priority<t.priority?-r:e.full_name<t.full_name?r:e.full_name>t.full_name?-r:void 0})}(this,this.children_to_parse,this.styles),delete this.children_to_parse),!0)}}$n.id=0;class qn extends $n{constructor(e){super(e),this.is_leaf=!0}}class Wn extends $n{constructor(e){super(e),this.is_tree=!0,this.layers=e.layers||[]}addLayer(e){this.layers.push(e)}buildDrawGroups(e){let t=[],r=[];if(Xn(e,[this],t,r),t.length>0){let e=function(e){if(e.length>1){for(var t=e[0],r=1;r<e.length;r++)t+="/"+e[r];return t}return e[0]}(r);if(void 0===Bn[e]){let r=t.map(e=>e&&!1!==e.visible&&e.calculatedDraw),n={};for(let e=0;e<r.length;e++){let t=r[e];if(t)for(let e=0;e<t.length;e++){let r=t[e];for(let e in r)n[e]=!0}}for(let i in n)Bn[e]=Bn[e]||{},Bn[e][i]=Vn(r,i),Bn[e][i]?(Bn[e][i].key=e+"/"+i,Bn[e][i].layers=t.map(e=>e&&e.full_name),Bn[e][i].group=i):delete Bn[e][i];Bn[e]&&0===Object.keys(Bn[e]).length&&(Bn[e]=null)}return Bn[e]}}}const Hn={rangeTransform:e=>"string"==typeof e&&"px2"===e.trim().slice(-3)?`${parseFloat(e)} * context.meters_per_pixel_sq`:e};function Zn(e){return Un.indexOf(e)>-1}function Kn(e,t,r,n){let i={name:e,layer:t=null==t?{}:t,parent:r,styles:n},[s,o]=function(e){let t={},r={};for(let n in e)Zn(n)?t[n]=e[n]:r[n]=e[n];return[t,r]}(t),a=(l=o,0===Object.keys(l).length);var l;let u;u=a&&null!=r?qn:Wn;let c=new u(Object.assign(i,s));return c.enabled&&(r&&r.addLayer(c),c.children_to_parse=a?null:o),c}function Xn(e,t,r,n){let i=!1,s=!1;if(0!==t.length){for(let o=0;o<t.length;o++){let a=t[o];if(a.is_leaf){if(a.doesMatch(e)&&(i=!0,r.push(a),n.push(a.id),a.exclusive))break}else if(a.is_tree&&a.doesMatch(e)&&(i=!0,s=Xn(e,a.layers,r,n),s||(r.push(a),n.push(a.id)),a.exclusive))break}return i}}function Yn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Qn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Yn(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yn(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}let Jn=0,ei=0;class ti{constructor({coords:e,style_z:t,source:r,workers:n,view:i}){this.id=Jn++,this.view=i,this.source=r,this.generation=null,this.valid=!0,this.visible=!1,this.proxy_for=null,this.proxied_as=null,this.proxy_level=0,this.proxy_order_offset=0,this.fade_in=!0,this.loading=!1,this.loaded=!1,this.built=!1,this.labeled=!1,this.error=null,this.debug={},this.style_z=t,this.coords=Se.normalizedCoord(e,this.source),this.key=Se.key(this.coords,this.source,this.style_z),this.overzoom=Math.max(this.style_z-this.coords.z,0),this.overzoom2=Math.pow(2,this.overzoom),this.min=G.metersForTile(this.coords),this.max=G.metersForTile({x:this.coords.x+1,y:this.coords.y+1,z:this.coords.z}),this.span={x:this.max.x-this.min.x,y:-(this.max.y-this.min.y)},this.bounds={sw:{x:this.min.x,y:this.max.y},ne:{x:this.max.x,y:this.min.y}},this.meters_per_pixel=G.metersPerPixel(this.style_z),this.meters_per_pixel_sq=this.meters_per_pixel*this.meters_per_pixel,this.units_per_pixel=G.units_per_pixel/this.overzoom2,this.units_per_meter_overzoom=G.unitsPerMeter(this.coords.z)*this.overzoom2,this.preserve_tiles_within_zoom=this.source.preserve_tiles_within_zoom,this.meshes={},this.new_mesh_styles=[],this.pending_label_meshes=null,this.setWorker(n)}freeResources(){for(let e in this.meshes)this.meshes[e].forEach(e=>e.destroy());if(this.meshes={},this.pending_label_meshes)for(let e in this.pending_label_meshes)this.pending_label_meshes[e].forEach(e=>e.destroy());this.pending_label_meshes=null}destroy(){E.removeForTile(this.id),this.workerMessage("self.removeTile",this.key),this.freeResources(),this.worker=null,this.valid=!1}buildAsMessage(){return{id:this.id,key:this.key,source:this.source.name,coords:this.coords,min:this.min,max:this.max,units_per_pixel:this.units_per_pixel,meters_per_pixel:this.meters_per_pixel,meters_per_pixel_sq:this.meters_per_pixel_sq,units_per_meter_overzoom:this.units_per_meter_overzoom,style_z:this.style_z,overzoom:this.overzoom,overzoom2:this.overzoom2,generation:this.generation,debug:this.debug}}setWorker(e){this.source.tiled?this.worker_id=Math.abs(this.coords.x+this.coords.y+this.coords.z)%e.length:this.worker_id=this.source.id%e.length,this.worker=e[this.worker_id]}workerMessage(...e){return a.postMessage(this.worker,...e)}build(e,{fade_in:t=!0}={}){return this.generation=e,this.fade_in=t,this.loaded||(this.loading=!0,this.built=!1,this.labeled=!1),this.workerMessage("self.buildTile",{tile:this.buildAsMessage()}).catch(e=>{throw e})}static cancel(e){e&&(e.canceled=!0,e.source_data&&e.source_data.request_id&&(g.cancelRequest(e.source_data.request_id),e.source_data.request_id=null),ti.abortBuild(e))}static buildGeometry(e,{scene_id:t,layers:r,styles:n,global:i}){let s=e.source_data;e.debug.building=+new Date,e.debug.feature_count=0,e.debug.layers=null,$t.startTile(e.id,{apply_repeat_groups:!0});for(let t in r){let o=r[t];if(!o||!o.config_data){_("warn",`Layer ${t} was defined without a geometry data source and will not be rendered.`);continue}if(o.config_data.source!==e.source)continue;let a=ti.getDataForSource(s,o.config_data,t);for(let r=0;r<a.length;r++){let s=a[r],l=s.geom;if(l)for(let r=0;r<l.features.length;r++){let a=l.features[r];if(null==a.geometry)continue;let u=J.getFeatureParseContext(a,e,i);u.winding=e.default_winding,u.source=e.source,u.layer=s.layer;let c=o.buildDrawGroups(u,!0);if(c){for(let e in c){let r=c[e],i=r.style||e,s=n[i];s?(r=s.preprocess(r),null!=r&&!1!==r.visible&&(u.layers=r.layers,s.addFeature(a,r,u))):_("warn",`Style '${i}' not found, skipping layer '${t}':`,r,a)}e.debug.feature_count++}}}}e.debug.building=+new Date-e.debug.building;let o=this.stylesForTile(e,n).map(e=>n[e]);ti.buildStyleGroups(e,o,t,e=>e.collision?"collision":"non-collision")}static stylesForTile(e,t){let r=[];for(let n in t)t[n].hasDataForTile(e)&&r.push(n);return r}static buildStyleGroups(e,t,r,n){const i=t.reduce((e,t)=>{const r=n(t);return e[r]=e[r]||[],e[r].push(t),e},{});if(0===Object.keys(i).length)return a.postMessage(`TileManager_${r}.buildTileStylesCompleted`,a.withTransferables({tile:ti.slice(e),progress:{start:!0,done:!0}})),void $t.resetTile(e.id);const s={};for(const t in i)ti.buildStyleGroup({group_name:t,groups:i,tile:e,progress:s,scene_id:r})}static async buildStyleGroup({group_name:e,groups:t,tile:r,progress:n,scene_id:i}){const s=t[e],o={};try{await Promise.all(s.map(async function(e){const t=await e.endData(r);t&&(o[e.name]=t)})),_("trace",`Finished style group '${e}' for tile ${r.key}`),t[e]=null,Object.keys(t).every(e=>null==t[e])&&(n.done=!0),a.postMessage(`TileManager_${i}.buildTileStylesCompleted`,a.withTransferables({tile:Qn(Qn({},ti.slice(r)),{},{mesh_data:o}),progress:n})),n.done&&$t.resetTile(r.id)}catch(t){_("error",`Error for style group '${e}' for tile ${r.key}`,t&&t.stack||t)}}static getDataForSource(e,t,r){var n=[];if(null!=t&&null!=e&&null!=e.layers)if(!0===t.all_layers){null!=t.layer&&_({level:"warn",once:!0},`Layer ${r} includes both 'all_layers: true' and an explicit 'layer' keyword in its 'data' block. 'all_layers: true' takes precedence, 'layer' will be ignored.`);for(const t in e.layers)n.push({layer:t,geom:e.layers[t]})}else!t.layer&&e.layers._default?n.push({geom:e.layers._default}):!t.layer&&r?n.push({layer:r,geom:e.layers[r]}):"string"==typeof t.layer?n.push({layer:t.layer,geom:e.layers[t.layer]}):Array.isArray(t.layer)&&t.layer.forEach(t=>{n.push({layer:t,geom:e.layers[t]})});return n}buildMeshes(e,t){if(this.error)return;this.build_id=ei++,t.start&&(this.debug.geometry_count=0,this.debug.buffer_size=0);let r={},n=this.mesh_data;if(n)for(let t in n){for(let i in n[t].meshes){let s=n[t].meshes[i];if(s.vertex_data){if(!e[t]){_("warn",`Could not create mesh because style '${t}' not found, for tile ${this.key}, aborting tile`);break}let i=Object.assign({},n[t]);i.uniforms=Object.assign({},i.uniforms,s.uniforms),i.variant=s.variant,s.labels&&(i.retain=!0);let o=e[t].makeMesh(s.vertex_data,s.vertex_elements,i);o.variant=i.variant,o.labels=s.labels,r[t]=r[t]||[],r[t].push(o),null==o.variant.mesh_order&&(o.variant.mesh_order=r[t].length-1),this.debug.buffer_size+=o.buffer_size,this.debug.geometry_count+=o.geometry_count}}r[t]&&r[t].sort((e,t)=>{let r=e.variant.mesh_order,n=t.variant.mesh_order;return null==r?1:null==n||r<n?-1:1})}delete this.mesh_data;for(let t in r)e[t].collision?(this.pending_label_meshes=this.pending_label_meshes||{},this.pending_label_meshes[t]=r[t]):(this.meshes[t]&&this.meshes[t].forEach(e=>e.destroy()),this.meshes[t]=r[t],this.new_mesh_styles.push(t));if(t.done){for(let e in this.meshes)-1!==this.new_mesh_styles.indexOf(e)||this.pending_label_meshes&&null!=this.pending_label_meshes[e]||(this.meshes[e].forEach(e=>e.destroy()),delete this.meshes[e]);this.new_mesh_styles=[],this.debug.geometry_ratio=(this.debug.geometry_count/this.debug.feature_count).toFixed(1)}this.printDebug(t)}pendingLabelStyleCount(){return this.pending_label_meshes?Object.keys(this.pending_label_meshes).length:0}swapPendingLabels(){if(this.labeled=!0,this.pending_label_meshes){for(let e in this.pending_label_meshes)this.meshes[e]&&this.meshes[e].forEach(e=>e.destroy()),this.meshes[e]=this.pending_label_meshes[e];this.pending_label_meshes=null}}static abortBuild(e){if(E.removeForTile(e.id),$t.abortTile(e.id),e.mesh_data)for(let t in e.mesh_data){let r=e.mesh_data[t].textures;r&&r.forEach(t=>{let r=k.textures[t];r&&(_("trace",`releasing texture ${t} for tile ${e.key}`),r.release())})}}setProxyFor(e){e?(this.visible=!0,this.proxy_for=this.proxy_for||[],this.proxy_for.push(e),this.proxy_order_offset=1,e.proxied_as=e.style_z>this.style_z?"child":"parent",this.proxy_level=Math.abs(e.style_z-this.style_z)):(this.proxy_for=null,this.proxy_order_offset=0,this.proxy_level=0)}isProxy(){return null!=this.proxy_for}shouldProxyForStyle(e){return!this.proxy_for||this.proxy_for.some(t=>null==t.meshes[e])}setupProgram({model:e,model32:t},r){r.uniform("4fv","u_tile_origin",[this.min.x,this.min.y,this.style_z,this.coords.z]),r.uniform("1f","u_tile_proxy_order_offset",this.proxy_order_offset),nn.identity(e),nn.translate(e,e,tn.fromValues(this.min.x,this.min.y,0)),nn.scale(e,e,tn.fromValues(this.span.x/G.tile_scale,this.span.y/G.tile_scale,1)),nn.copy(t,e),r.uniform("Matrix4fv","u_model",t),r.uniform("1i","u_tile_fade_in",this.fade_in&&"child"!==this.proxied_as)}static slice(e,t){let r=["id","key","loading","loaded","generation","error","debug"];Array.isArray(t)&&r.push(...t);var n={};for(let t=0;t<r.length;t++){const i=r[t];n[i]=e[i]}return n}merge(e){return this.loading=e.loading,this.loaded=e.loaded,this.generation=e.generation,this.error=e.error,this.mesh_data=e.mesh_data,this.debug=V(this.debug,e.debug),this}printDebug(e){const t=["layers"];let r={};for(let e in this.debug)-1===t.indexOf(e)&&(r[e]=this.debug[e]);_("debug",`Tile ${e.done?"(done)":""}: debug for ${this.key}: [ ${JSON.stringify(r)} ]`)}}function ri(e,t){for(let r in e){let n=e[r];Pe(t,r,n.features,n.geoms,n.styles,n.base),n.layers&&(t[r].layers=t[r].layers||{},ri(n.layers,t[r].layers))}}ti.coord_children={};var ni,ii,si,oi={};var ai,li,ui,ci,hi,di,fi,pi,mi,_i=function(){if(si)return ii;si=1,ii=t;var e=(ni||(ni=1,oi.read=function(e,t,r,n,i){var s,o,a=8*i-n-1,l=(1<<a)-1,u=l>>1,c=-7,h=r?i-1:0,d=r?-1:1,f=e[t+h];for(h+=d,s=f&(1<<-c)-1,f>>=-c,c+=a;c>0;s=256*s+e[t+h],h+=d,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+e[t+h],h+=d,c-=8);if(0===s)s=1-u;else{if(s===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),s-=u}return(f?-1:1)*o*Math.pow(2,s-n)},oi.write=function(e,t,r,n,i,s){var o,a,l,u=8*s-i-1,c=(1<<u)-1,h=c>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,p=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(o++,l/=2),o+h>=c?(a=0,o=c):o+h>=1?(a=(t*l-1)*Math.pow(2,i),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[r+f]=255&a,f+=p,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;e[r+f]=255&o,f+=p,o/=256,u-=8);e[r+f-p]|=128*m}),oi);function t(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var r=4294967296,n=1/r;function i(e){return e.type===t.Bytes?e.readVarint()+e.pos:e.pos+1}function s(e,t,r){return r?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function o(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.ceil(Math.log(t)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=e;i--)r.buf[i+n]=r.buf[i]}function a(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function l(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function u(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function c(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function h(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function d(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function f(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function p(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function m(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function _(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function g(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function y(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,s=this.pos;this.type=7&n,e(i,t,this),this.pos===s&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=_(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=y(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=_(this.buf,this.pos)+_(this.buf,this.pos+4)*r;return this.pos+=8,e},readSFixed64:function(){var e=_(this.buf,this.pos)+y(this.buf,this.pos+4)*r;return this.pos+=8,e},readFloat:function(){var t=e.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=e.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(e){var t,r,n=this.buf;return t=127&(r=n[this.pos++]),r<128?t:(t|=(127&(r=n[this.pos++]))<<7,r<128?t:(t|=(127&(r=n[this.pos++]))<<14,r<128?t:(t|=(127&(r=n[this.pos++]))<<21,r<128?t:function(e,t,r){var n,i,o=r.buf;if(n=(112&(i=o[r.pos++]))>>4,i<128)return s(e,n,t);if(n|=(127&(i=o[r.pos++]))<<3,i<128)return s(e,n,t);if(n|=(127&(i=o[r.pos++]))<<10,i<128)return s(e,n,t);if(n|=(127&(i=o[r.pos++]))<<17,i<128)return s(e,n,t);if(n|=(127&(i=o[r.pos++]))<<24,i<128)return s(e,n,t);if(n|=(1&(i=o[r.pos++]))<<31,i<128)return s(e,n,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(r=n[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=function(e,t,r){for(var n="",i=t;i<r;){var s,o,a,l=e[i],u=null,c=l>239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(s=e[i+1]))&&(u=(31&l)<<6|63&s)<=127&&(u=null):3===c?(s=e[i+1],o=e[i+2],128==(192&s)&&128==(192&o)&&((u=(15&l)<<12|(63&s)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(s=e[i+1],o=e[i+2],a=e[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&((u=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c}return n}(this.buf,this.pos,e);return this.pos=e,t},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){var r=i(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var r=7&e;if(r===t.Varint)for(;this.buf[this.pos++]>127;);else if(r===t.Bytes)this.pos=this.readVarint()+this.pos;else if(r===t.Fixed32)this.pos+=4;else{if(r!==t.Fixed64)throw new Error("Unimplemented type: "+r);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),g(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),g(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),g(this.buf,-1&e,this.pos),g(this.buf,Math.floor(e*n),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),g(this.buf,-1&e,this.pos),g(this.buf,Math.floor(e*n),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(n=~(-e/4294967296),4294967295^(r=~(-e%4294967296))?r=r+1|0:(r=0,n=n+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,r){r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos]=127&e}(r,0,t),function(e,t){var r=(7&e)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(n,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,r){for(var n,i,s=0;s<t.length;s++){if((n=t.charCodeAt(s))>55295&&n<57344){if(!i){n>56319||s+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):i=n;continue}if(n<56320){e[r++]=239,e[r++]=191,e[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(e[r++]=239,e[r++]=191,e[r++]=189,i=null);n<128?e[r++]=n:(n<2048?e[r++]=n>>6|192:(n<65536?e[r++]=n>>12|224:(e[r++]=n>>18|240,e[r++]=n>>12&63|128),e[r++]=n>>6&63|128),e[r++]=63&n|128)}return r}(this.buf,e,this.pos);var r=this.pos-t;r>=128&&o(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),e.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),e.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var n=this.pos-r;n>=128&&o(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,r,n){this.writeTag(e,t.Bytes),this.writeRawMessage(r,n)},writePackedVarint:function(e,t){this.writeMessage(e,a,t)},writePackedSVarint:function(e,t){this.writeMessage(e,l,t)},writePackedBoolean:function(e,t){this.writeMessage(e,h,t)},writePackedFloat:function(e,t){this.writeMessage(e,u,t)},writePackedDouble:function(e,t){this.writeMessage(e,c,t)},writePackedFixed32:function(e,t){this.writeMessage(e,d,t)},writePackedSFixed32:function(e,t){this.writeMessage(e,f,t)},writePackedFixed64:function(e,t){this.writeMessage(e,p,t)},writePackedSFixed64:function(e,t){this.writeMessage(e,m,t)},writeBytesField:function(e,r){this.writeTag(e,t.Bytes),this.writeBytes(r)},writeFixed32Field:function(e,r){this.writeTag(e,t.Fixed32),this.writeFixed32(r)},writeSFixed32Field:function(e,r){this.writeTag(e,t.Fixed32),this.writeSFixed32(r)},writeFixed64Field:function(e,r){this.writeTag(e,t.Fixed64),this.writeFixed64(r)},writeSFixed64Field:function(e,r){this.writeTag(e,t.Fixed64),this.writeSFixed64(r)},writeVarintField:function(e,r){this.writeTag(e,t.Varint),this.writeVarint(r)},writeSVarintField:function(e,r){this.writeTag(e,t.Varint),this.writeSVarint(r)},writeStringField:function(e,r){this.writeTag(e,t.Bytes),this.writeString(r)},writeFloatField:function(e,r){this.writeTag(e,t.Fixed32),this.writeFloat(r)},writeDoubleField:function(e,r){this.writeTag(e,t.Fixed64),this.writeDouble(r)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}},ii}(),gi=P(_i),yi={};function vi(){if(ci)return ui;ci=1;var e=function(){if(li)return ai;function e(e,t){this.x=e,this.y=t}return li=1,ai=e,e.prototype={clone:function(){return new e(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,r=e.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,r=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=r,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),r=Math.sin(e),n=t*this.x-r*this.y,i=r*this.x+t*this.y;return this.x=n,this.y=i,this},_rotateAround:function(e,t){var r=Math.cos(e),n=Math.sin(e),i=t.x+r*(this.x-t.x)-n*(this.y-t.y),s=t.y+n*(this.x-t.x)+r*(this.y-t.y);return this.x=i,this.y=s,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},e.convert=function(t){return t instanceof e?t:Array.isArray(t)?new e(t[0],t[1]):t},ai}();function t(e,t,n,i,s){this.properties={},this.extent=n,this.type=0,this._pbf=e,this._geometry=-1,this._keys=i,this._values=s,e.readFields(r,this,t)}function r(e,t,r){1==e?t.id=r.readVarint():2==e?function(e,t){for(var r=e.readVarint()+e.pos;e.pos<r;){var n=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[n]=i}}(r,t):3==e?t.type=r.readVarint():4==e&&(t._geometry=r.pos)}function n(e){for(var t,r,n=0,i=0,s=e.length,o=s-1;i<s;o=i++)t=e[i],n+=((r=e[o]).x-t.x)*(t.y+r.y);return n}return ui=t,t.types=["Unknown","Point","LineString","Polygon"],t.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var r,n=t.readVarint()+t.pos,i=1,s=0,o=0,a=0,l=[];t.pos<n;){if(!s){var u=t.readVarint();i=7&u,s=u>>3}if(s--,1===i||2===i)o+=t.readSVarint(),a+=t.readSVarint(),1===i&&(r&&l.push(r),r=[]),r.push(new e(o,a));else{if(7!==i)throw new Error("unknown command "+i);r&&r.push(r[0].clone())}}return r&&l.push(r),l},t.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,r=1,n=0,i=0,s=0,o=1/0,a=-1/0,l=1/0,u=-1/0;e.pos<t;){if(!n){var c=e.readVarint();r=7&c,n=c>>3}if(n--,1===r||2===r)(i+=e.readSVarint())<o&&(o=i),i>a&&(a=i),(s+=e.readSVarint())<l&&(l=s),s>u&&(u=s);else if(7!==r)throw new Error("unknown command "+r)}return[o,l,a,u]},t.prototype.toGeoJSON=function(e,r,i){var s,o,a=this.extent*Math.pow(2,i),l=this.extent*e,u=this.extent*r,c=this.loadGeometry(),h=t.types[this.type];function d(e){for(var t=0;t<e.length;t++){var r=e[t],n=180-360*(r.y+u)/a;e[t]=[360*(r.x+l)/a-180,360/Math.PI*Math.atan(Math.exp(n*Math.PI/180))-90]}}switch(this.type){case 1:var f=[];for(s=0;s<c.length;s++)f[s]=c[s][0];d(c=f);break;case 2:for(s=0;s<c.length;s++)d(c[s]);break;case 3:for(c=function(e){var t=e.length;if(t<=1)return[e];for(var r,i,s=[],o=0;o<t;o++){var a=n(e[o]);0!==a&&(void 0===i&&(i=a<0),i===a<0?(r&&s.push(r),r=[e[o]]):r.push(e[o]))}return r&&s.push(r),s}(c),s=0;s<c.length;s++)for(o=0;o<c[s].length;o++)d(c[s][o])}1===c.length?c=c[0]:h="Multi"+h;var p={type:"Feature",geometry:{type:h,coordinates:c},properties:this.properties};return"id"in this&&(p.id=this.id),p},ui}function bi(){if(di)return hi;di=1;var e=vi();function t(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(r,this,t),this.length=this._features.length}function r(e,t,r){15===e?t.version=r.readVarint():1===e?t.name=r.readString():5===e?t.extent=r.readVarint():2===e?t._features.push(r.pos):3===e?t._keys.push(r.readString()):4===e&&t._values.push(function(e){for(var t=null,r=e.readVarint()+e.pos;e.pos<r;){var n=e.readVarint()>>3;t=1===n?e.readString():2===n?e.readFloat():3===n?e.readDouble():4===n?e.readVarint64():5===n?e.readVarint():6===n?e.readSVarint():7===n?e.readBoolean():null}return t}(r))}return hi=t,t.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var r=this._pbf.readVarint()+this._pbf.pos;return new e(this._pbf,r,this.extent,this._keys,this._values)},hi}var xi=(mi||(mi=1,yi.VectorTile=function(){if(pi)return fi;pi=1;var e=bi();function t(t,r,n){if(3===t){var i=new e(n,n.readVarint()+n.pos);i.length&&(r[i.name]=i)}}return fi=function(e,r){this.layers=e.readFields(t,{},r)},fi}(),yi.VectorTileFeature=vi(),yi.VectorTileLayer=bi()),yi);const wi=["{","["];class Ai extends Te{constructor(e,t){super(e,t),this.response_type="arraybuffer",!0===e.parse_json?this.parse_json_type=1:Array.isArray(e.parse_json)?(this.parse_json_type=2,this.parse_json_prop_list=e.parse_json):(null!=e.parse_json&&_({level:"warn",once:!0},`Data source '${this.name}': 'parse_json' parameter should be 'true', or an array of property names (was '${JSON.stringify(e.parse_json)}')`),this.parse_json_type=0)}parseSourceData(e,t,r){var n=new Uint8Array(r),i=new gi(n);if(t.data=new xi.VectorTile(i),t.layers=this.toGeoJSON(t.data),"function"==typeof this.transform){const r={min:Object.assign({},e.min),max:Object.assign({},e.max),coords:Object.assign({},e.coords)};t.layers=this.transform(t.layers,this.extra_data,r)}delete t.data}toGeoJSON(e){var t={};for(var r in e.layers){for(var n=e.layers[r],i=G.tile_scale/n.extent,s={type:"FeatureCollection",features:[]},o=0;o<n.length;o++){var a=n.feature(o),l={type:"Feature",geometry:{},id:a.id,properties:a.properties};this.parseJSONProperties(l);for(var u=l.geometry,c=a.loadGeometry(),h=0;h<c.length;h++)for(var d=c[h],f=0;f<d.length;f++)d[f]=[d[f].x*i,d[f].y*i];u.coordinates=c,"Point"===xi.VectorTileFeature.types[a.type]?1===c.length?(u.type="Point",u.coordinates=u.coordinates[0][0]):(u.type="MultiPoint",u.coordinates=u.coordinates[0]):"LineString"===xi.VectorTileFeature.types[a.type]?1===c.length?(u.type="LineString",u.coordinates=u.coordinates[0]):u.type="MultiLineString":"Polygon"===xi.VectorTileFeature.types[a.type]&&(u=Ei(u)),s.features.push(l)}t[r]=s}return t}parseJSONProperties(e){if(0!==this.parse_json_type){const t=e.properties;if(2===this.parse_json_type)this.parse_json_prop_list.forEach(e=>{try{t[e]=JSON.parse(t[e])}catch(e){}});else for(const r in t)if(wi.indexOf(t[r][0])>-1)try{t[r]=JSON.parse(t[r])}catch(e){}}}}function Ei(e){let t,r=[],n=[];for(let i=0;i<e.coordinates.length;i++){let s=e.coordinates[i],o=G.ringWinding(s);null!=o&&(t=t||o,o===t&&n.length>0&&(r.push(n),n=[]),n.push(s))}return n.length>0&&r.push(n),1===r.length?(e.type="Polygon",e.coordinates=r[0]):r.length>1?(e.type="MultiPolygon",e.coordinates=r):e=null,e}function Ti(e,t,r,n){for(var i,s=n,o=r-t>>1,a=r-t,l=e[t],u=e[t+1],c=e[r],h=e[r+1],d=t+3;d<r;d+=3){var f=Si(e[d],e[d+1],l,u,c,h);if(f>s)i=d,s=f;else if(f===s){var p=Math.abs(d-o);p<a&&(i=d,a=p)}}s>n&&(i-t>3&&Ti(e,t,i,n),e[i+2]=s,r-i>3&&Ti(e,i,r,n))}function Si(e,t,r,n,i,s){var o=i-r,a=s-n;if(0!==o||0!==a){var l=((e-r)*o+(t-n)*a)/(o*o+a*a);l>1?(r=i,n=s):l>0&&(r+=o*l,n+=a*l)}return(o=e-r)*o+(a=t-n)*a}function ki(e,t,r,n){var i={id:void 0===e?null:e,type:t,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,r=e.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)Oi(e,t);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n<t.length;n++)Oi(e,t[n]);else if("MultiPolygon"===r)for(n=0;n<t.length;n++)for(var i=0;i<t[n].length;i++)Oi(e,t[n][i])}(i),i}function Oi(e,t){for(var r=0;r<t.length;r+=3)e.minX=Math.min(e.minX,t[r]),e.minY=Math.min(e.minY,t[r+1]),e.maxX=Math.max(e.maxX,t[r]),e.maxY=Math.max(e.maxY,t[r+1])}function Ri(e,t,r,n){if(t.geometry){var i=t.geometry.coordinates,s=t.geometry.type,o=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),a=[],l=t.id;if(r.promoteId?l=t.properties[r.promoteId]:r.generateId&&(l=n||0),"Point"===s)Ci(i,a);else if("MultiPoint"===s)for(var u=0;u<i.length;u++)Ci(i[u],a);else if("LineString"===s)Ni(i,a,o,!1);else if("MultiLineString"===s){if(r.lineMetrics){for(u=0;u<i.length;u++)a=[],Ni(i[u],a,o,!1),e.push(ki(l,"LineString",a,t.properties));return}Pi(i,a,o,!1)}else if("Polygon"===s)Pi(i,a,o,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<t.geometry.geometries.length;u++)Ri(e,{id:l,geometry:t.geometry.geometries[u],properties:t.properties},r,n);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<i.length;u++){var c=[];Pi(i[u],c,o,!0),a.push(c)}}e.push(ki(l,s,a,t.properties))}}function Ci(e,t){t.push(Mi(e[0])),t.push(Di(e[1])),t.push(0)}function Ni(e,t,r,n){for(var i,s,o=0,a=0;a<e.length;a++){var l=Mi(e[a][0]),u=Di(e[a][1]);t.push(l),t.push(u),t.push(0),a>0&&(o+=n?(i*u-l*s)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(u-s,2))),i=l,s=u}var c=t.length-3;t[2]=1,Ti(t,0,c,r),t[c+2]=1,t.size=Math.abs(o),t.start=0,t.end=t.size}function Pi(e,t,r,n){for(var i=0;i<e.length;i++){var s=[];Ni(e[i],s,r,n),t.push(s)}}function Mi(e){return e/360+.5}function Di(e){var t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function zi(e,t,r,n,i,s,o,a){if(n/=t,s>=(r/=t)&&o<n)return e;if(o<r||s>=n)return null;for(var l=[],u=0;u<e.length;u++){var c=e[u],h=c.geometry,d=c.type,f=0===i?c.minX:c.minY,p=0===i?c.maxX:c.maxY;if(f>=r&&p<n)l.push(c);else if(!(p<r||f>=n)){var m=[];if("Point"===d||"MultiPoint"===d)Ii(h,m,r,n,i);else if("LineString"===d)Fi(h,m,r,n,i,!1,a.lineMetrics);else if("MultiLineString"===d)ji(h,m,r,n,i,!1);else if("Polygon"===d)ji(h,m,r,n,i,!0);else if("MultiPolygon"===d)for(var _=0;_<h.length;_++){var g=[];ji(h[_],g,r,n,i,!0),g.length&&m.push(g)}if(m.length){if(a.lineMetrics&&"LineString"===d){for(_=0;_<m.length;_++)l.push(ki(c.id,d,m[_],c.tags));continue}"LineString"!==d&&"MultiLineString"!==d||(1===m.length?(d="LineString",m=m[0]):d="MultiLineString"),"Point"!==d&&"MultiPoint"!==d||(d=3===m.length?"Point":"MultiPoint"),l.push(ki(c.id,d,m,c.tags))}}}return l.length?l:null}function Ii(e,t,r,n,i){for(var s=0;s<e.length;s+=3){var o=e[s+i];o>=r&&o<=n&&(t.push(e[s]),t.push(e[s+1]),t.push(e[s+2]))}}function Fi(e,t,r,n,i,s,o){for(var a,l,u=Li(e),c=0===i?Bi:Vi,h=e.start,d=0;d<e.length-3;d+=3){var f=e[d],p=e[d+1],m=e[d+2],_=e[d+3],g=e[d+4],y=0===i?f:p,v=0===i?_:g,b=!1;o&&(a=Math.sqrt(Math.pow(f-_,2)+Math.pow(p-g,2))),y<r?v>r&&(l=c(u,f,p,_,g,r),o&&(u.start=h+a*l)):y>n?v<n&&(l=c(u,f,p,_,g,n),o&&(u.start=h+a*l)):Ui(u,f,p,m),v<r&&y>=r&&(l=c(u,f,p,_,g,r),b=!0),v>n&&y<=n&&(l=c(u,f,p,_,g,n),b=!0),!s&&b&&(o&&(u.end=h+a*l),t.push(u),u=Li(e)),o&&(h+=a)}var x=e.length-3;f=e[x],p=e[x+1],m=e[x+2],(y=0===i?f:p)>=r&&y<=n&&Ui(u,f,p,m),x=u.length-3,s&&x>=3&&(u[x]!==u[0]||u[x+1]!==u[1])&&Ui(u,u[0],u[1],u[2]),u.length&&t.push(u)}function Li(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function ji(e,t,r,n,i,s){for(var o=0;o<e.length;o++)Fi(e[o],t,r,n,i,s,!1)}function Ui(e,t,r,n){e.push(t),e.push(r),e.push(n)}function Bi(e,t,r,n,i,s){var o=(s-t)/(n-t);return e.push(s),e.push(r+(i-r)*o),e.push(1),o}function Vi(e,t,r,n,i,s){var o=(s-r)/(i-r);return e.push(t+(n-t)*o),e.push(s),e.push(1),o}function Gi(e,t){for(var r=[],n=0;n<e.length;n++){var i,s=e[n],o=s.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)i=$i(s.geometry,t);else if("MultiLineString"===o||"Polygon"===o){i=[];for(var a=0;a<s.geometry.length;a++)i.push($i(s.geometry[a],t))}else if("MultiPolygon"===o)for(i=[],a=0;a<s.geometry.length;a++){for(var l=[],u=0;u<s.geometry[a].length;u++)l.push($i(s.geometry[a][u],t));i.push(l)}r.push(ki(s.id,o,i,s.tags))}return r}function $i(e,t){var r=[];r.size=e.size,void 0!==e.start&&(r.start=e.start,r.end=e.end);for(var n=0;n<e.length;n+=3)r.push(e[n]+t,e[n+1],e[n+2]);return r}function qi(e,t){if(e.transformed)return e;var r,n,i,s=1<<e.z,o=e.x,a=e.y;for(r=0;r<e.features.length;r++){var l=e.features[r],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(n=0;n<u.length;n+=2)l.geometry.push(Wi(u[n],u[n+1],t,s,o,a));else for(n=0;n<u.length;n++){var h=[];for(i=0;i<u[n].length;i+=2)h.push(Wi(u[n][i],u[n][i+1],t,s,o,a));l.geometry.push(h)}}return e.transformed=!0,e}function Wi(e,t,r,n,i,s){return[Math.round(r*(e*n-i)),Math.round(r*(t*n-s))]}function Hi(e,t,r,n,i){for(var s=t===i.maxZoom?0:i.tolerance/((1<<t)*i.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<e.length;a++){o.numFeatures++,Zi(o,e[a],s,i);var l=e[a].minX,u=e[a].minY,c=e[a].maxX,h=e[a].maxY;l<o.minX&&(o.minX=l),u<o.minY&&(o.minY=u),c>o.maxX&&(o.maxX=c),h>o.maxY&&(o.maxY=h)}return o}function Zi(e,t,r,n){var i=t.geometry,s=t.type,o=[];if("Point"===s||"MultiPoint"===s)for(var a=0;a<i.length;a+=3)o.push(i[a]),o.push(i[a+1]),e.numPoints++,e.numSimplified++;else if("LineString"===s)Ki(o,i,e,r,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(a=0;a<i.length;a++)Ki(o,i[a],e,r,"Polygon"===s,0===a);else if("MultiPolygon"===s)for(var l=0;l<i.length;l++){var u=i[l];for(a=0;a<u.length;a++)Ki(o,u[a],e,r,!0,0===a)}if(o.length){var c=t.tags||null;if("LineString"===s&&n.lineMetrics){for(var h in c={},t.tags)c[h]=t.tags[h];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var d={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:c};null!==t.id&&(d.id=t.id),e.features.push(d)}}function Ki(e,t,r,n,i,s){var o=n*n;if(n>0&&t.size<(i?o:n))r.numPoints+=t.length/3;else{for(var a=[],l=0;l<t.length;l+=3)(0===n||t[l+2]>o)&&(r.numSimplified++,a.push(t[l]),a.push(t[l+1])),r.numPoints++;i&&function(e,t){for(var r=0,n=0,i=e.length,s=i-2;n<i;s=n,n+=2)r+=(e[n]-e[s])*(e[n+1]+e[s+1]);if(r>0===t)for(n=0,i=e.length;n<i/2;n+=2){var o=e[n],a=e[n+1];e[n]=e[i-2-n],e[n+1]=e[i-1-n],e[i-2-n]=o,e[i-1-n]=a}}(a,s),e.push(a)}}function Xi(e,t){return new Yi(e,t)}function Yi(e,t){var r=(t=this.options=function(e,t){for(var r in t)e[r]=t[r];return e}(Object.create(this.options),t)).debug;if(r&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(e,t){var r=[];if("FeatureCollection"===e.type)for(var n=0;n<e.features.length;n++)Ri(r,e.features[n],t,n);else"Feature"===e.type?Ri(r,e,t):Ri(r,{geometry:e},t);return r}(e,t);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=function(e,t){var r=t.buffer/t.extent,n=e,i=zi(e,1,-1-r,r,0,-1,2,t),s=zi(e,1,1-r,2+r,0,-1,2,t);return(i||s)&&(n=zi(e,1,-r,1+r,0,-1,2,t)||[],i&&(n=Gi(i,1).concat(n)),s&&(n=n.concat(Gi(s,-1)))),n}(n,t),n.length&&this.splitTile(n,0,0,0),r&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Qi(e,t,r){return 32*((1<<e)*r+t)+e}we.register("MVT",()=>Ai),Yi.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Yi.prototype.splitTile=function(e,t,r,n,i,s,o){for(var a=[e,t,r,n],l=this.options,u=l.debug;a.length;){n=a.pop(),r=a.pop(),t=a.pop(),e=a.pop();var c=1<<t,h=Qi(t,r,n),d=this.tiles[h];if(!d&&(u>1&&console.time("creation"),d=this.tiles[h]=Hi(e,t,r,n,l),this.tileCoords.push({z:t,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,r,n,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));var f="z"+t;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(d.source=e,i){if(t===l.maxZoom||t===i)continue;var p=1<<i-t;if(r!==Math.floor(s/p)||n!==Math.floor(o/p))continue}else if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue;if(d.source=null,0!==e.length){u>1&&console.time("clipping");var m,_,g,y,v,b,x=.5*l.buffer/l.extent,w=.5-x,A=.5+x,E=1+x;m=_=g=y=null,v=zi(e,c,r-x,r+A,0,d.minX,d.maxX,l),b=zi(e,c,r+w,r+E,0,d.minX,d.maxX,l),e=null,v&&(m=zi(v,c,n-x,n+A,1,d.minY,d.maxY,l),_=zi(v,c,n+w,n+E,1,d.minY,d.maxY,l),v=null),b&&(g=zi(b,c,n-x,n+A,1,d.minY,d.maxY,l),y=zi(b,c,n+w,n+E,1,d.minY,d.maxY,l),b=null),u>1&&console.timeEnd("clipping"),a.push(m||[],t+1,2*r,2*n),a.push(_||[],t+1,2*r,2*n+1),a.push(g||[],t+1,2*r+1,2*n),a.push(y||[],t+1,2*r+1,2*n+1)}}},Yi.prototype.getTile=function(e,t,r){var n=this.options,i=n.extent,s=n.debug;if(e<0||e>24)return null;var o=1<<e,a=Qi(e,t=(t%o+o)%o,r);if(this.tiles[a])return qi(this.tiles[a],i);s>1&&console.log("drilling down to z%d-%d-%d",e,t,r);for(var l,u=e,c=t,h=r;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[Qi(u,c,h)];return l&&l.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,c,h),s>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,e,t,r),s>1&&console.timeEnd("drilling down"),this.tiles[a]?qi(this.tiles[a],i):null):null};class Ji extends Ee{constructor(e,t){super(e,t),this.load_data=null,this.tile_indexes={},this.setTileSize(512),this.pad_scale=0}_load(e){return this.load_data||(this.load_data=super._load({source_data:{layers:{}}}).then(e=>{e.source_data.error&&_("warn",`data source load error(s) for source '${this.name}', URL '${this.url}': ${e.source_data.error}`);let t=e.source_data.layers;for(let e in t)this.tile_indexes[e]=Xi(t[e],{maxZoom:this.max_zoom,tolerance:1.5,extent:G.tile_scale,buffer:1e-4});return this.loaded=!0,e})),this.load_data.then(()=>{for(let t in this.tile_indexes)e.source_data.layers[t]=this.getTileFeatures(e,t);return e})}getTileFeatures(e,t){let r,n=G.wrapTile(e.coords,{x:!0}),i=this.tile_indexes[t].getTile(n.z,n.x,n.y);if(i&&i.features){r={type:"FeatureCollection",features:[]};for(let e=0;e<i.features.length;e++){const t=i.features[e];let n={type:"Feature",geometry:{},id:t.id,properties:t.tags};if(1===t.type)n.geometry.coordinates=t.geometry.map(e=>[e[0],e[1]]),n.geometry.type="MultiPoint";else{if(2!==t.type&&3!==t.type)continue;if(n.geometry.coordinates=t.geometry.map(e=>e.map(e=>[e[0],e[1]])),2===t.type)n.geometry.type="MultiLineString";else if(n.geometry=Ei(n.geometry),null==n.geometry)continue}r.features.push(n)}}return r}formatURL(){return this.url}parseSourceData(e,t,r){let n="string"==typeof r?JSON.parse(r):r,i=this.getLayers(n);t.layers=this.preprocessLayers(i,e)}preprocessLayers(e,t){for(let t in e){let r=e[t];r.features=this.preprocessFeatures(r.features)}if("function"==typeof this.transform){const r={min:Object.assign({},t.min),max:Object.assign({},t.max),coords:Object.assign({},t.coords)};1===Object.keys(e).length&&e._default?e._default=this.transform(e._default,this.extra_data,r):e=this.transform(e,this.extra_data,r)}return e}preprocessFeatures(e){if(e=e.filter(e=>null!=e.geometry),this.config.generate_label_centroids){let t=[],r={label_placement:!0};e.forEach(e=>{let n,i;if("Polygon"===e.geometry.type)n=e.geometry.coordinates,i=ts(n,e.id,e.properties,r),t.push(i);else if("MultiPolygon"===e.geometry.type){n=e.geometry.coordinates;let s=-1/0,o=0;for(let e=0;e<n.length;e++){let t=G.polygonArea(n[e]);t>s&&(s=t,o=e)}i=ts(n[o],e.id,e.properties,r),t.push(i)}}),t=t.filter(e=>e),Array.prototype.push.apply(e,t)}return e}getLayers(e){return"Feature"===e.type?{_default:{type:"FeatureCollection",features:[e]}}:"FeatureCollection"===e.type?{_default:e}:e}}class es extends Te{constructor(e,t){super(e,t)}parseSourceData(e,t,r){let n="string"==typeof r?JSON.parse(r):r;this.prepareGeoJSON(n,e,t)}prepareGeoJSON(e,t,r){if("function"==typeof this.transform){const r={min:Object.assign({},t.min),max:Object.assign({},t.max),coords:Object.assign({},t.coords)};e=this.transform(e,this.extra_data,r)}r.layers=Ji.prototype.getLayers(e);let n={coords:t.coords,min:G.metersForTile(G.wrapTile(t.coords,{x:!0}))};we.projectData(r),we.scaleData(r,n)}}function ts(e,t,r,n){let i=G.centroid(e);if(!i)return;let s={};return Object.assign(s,r,n),{type:"Feature",id:t,properties:s,geometry:{type:"Point",coordinates:i}}}function rs(e){return e}function ns(e,t){var r=t.id,n=t.bbox,i=null==t.properties?{}:t.properties,s=function(e,t){var r=function(e){if(null==(t=e.transform))return rs;var t,r,n,i=t.scale[0],s=t.scale[1],o=t.translate[0],a=t.translate[1];return function(e,t){return t||(r=n=0),e[0]=(r+=e[0])*i+o,e[1]=(n+=e[1])*s+a,e}}(e),n=e.arcs;function i(e,t){t.length&&t.pop();for(var i=n[e<0?~e:e],s=0,o=i.length;s<o;++s)t.push(r(i[s].slice(),s));e<0&&function(e,t){for(var r,n=e.length,i=n-t;i<--n;)r=e[i],e[i++]=e[n],e[n]=r}(t,o)}function s(e){return r(e.slice())}function o(e){for(var t=[],r=0,n=e.length;r<n;++r)i(e[r],t);return t.length<2&&t.push(t[0].slice()),t}function a(e){for(var t=o(e);t.length<4;)t.push(t[0].slice());return t}function l(e){return e.map(a)}return function e(t){var r,n=t.type;switch(n){case"GeometryCollection":return{type:n,geometries:t.geometries.map(e)};case"Point":r=s(t.coordinates);break;case"MultiPoint":r=t.coordinates.map(s);break;case"LineString":r=o(t.arcs);break;case"MultiLineString":r=t.arcs.map(o);break;case"Polygon":r=l(t.arcs);break;case"MultiPolygon":r=t.arcs.map(l);break;default:return null}return{type:n,coordinates:r}}(t)}(e,t);return null==r&&null==n?{type:"Feature",properties:i,geometry:s}:null==n?{type:"Feature",id:r,properties:i,geometry:s}:{type:"Feature",id:r,bbox:n,properties:i,geometry:s}}we.register("GeoJSON",e=>es.urlHasTilePattern(e.url)?es:Ji);class is extends Ji{parseSourceData(e,t,r){let n="string"==typeof r?JSON.parse(r):r;n=this.toGeoJSON(n);let i=this.getLayers(n);super.preprocessLayers(i,e),t.layers=i}toGeoJSON(e){if(e.objects&&1===Object.keys(e.objects).length){let t=Object.keys(e.objects)[0];e=ss(e,e.objects[t])}else{let t={};for(let r in e.objects)t[r]=ss(e,e.objects[r]);e=t}return e}}function ss(e,t){let r=function(e,t){return"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return ns(e,t)})}:ns(e,t)}(e,t);return"Feature"===r.type&&(r={type:"FeatureCollection",features:[r]}),r}class os extends es{constructor(e,t){super(e,t)}parseSourceData(e,t,r){let n="string"==typeof r?JSON.parse(r):r;n=is.prototype.toGeoJSON(n),this.prepareGeoJSON(n,e,t)}}we.register("TopoJSON",e=>os.urlHasTilePattern(e.url)?os:is),e.Collision=$t,e.DataSource=we,e.FeatureSelection=he,e.FilterOptions=Hn,e.FontManager=nr,e.GLSL=O,e.Geo=G,e.Label=Ut,e.LabelLineStraight=mn,e.LabelPoint=qt,e.Light=ve,e.Material=_e,e.OBB=jt,e.ShaderProgram=j,e.Style=Ne,e.StyleManager=class{constructor(){this.styles={},this.base_styles={},this.active_styles=[],this.active_blend_orders=[],this.register(Object.create(et)),this.register(Object.create(bt)),this.register(Object.create(cn)),this.register(Object.create(xn)),this.register(Object.create(wn))}init(){j.removeBlock("global"),j.removeBlock("setup"),j.addBlock("global","#ifdef TANGRAM_VERTEX_SHADER\n\n// Apply layer ordering to avoid z-fighting\nvoid applyLayerOrder (float layer, inout vec4 position) {\n position.z -= layer * TANGRAM_LAYER_DELTA * position.w;\n}\n\n// Vertex position in model space: [0, 1] range over the local tile\n// Note positions can be outside that range due to unclipped geometry, geometry higher than a unit cube, etc.\nvec4 modelPosition() {\n return\n vec4(\n a_position.xyz / TANGRAM_TILE_SCALE // scale coords to ~0-1 range\n * exp2(u_tile_origin.z - u_tile_origin.w), // adjust for tile overzooming\n 1.)\n + vec4(0., 1., 0., 0.);\n // NB: additional offset to account for unusual Tangram JS y coords,\n // should be refactored to remove\n}\n\n// Position in model space as above, but according to tile coordinate (as opposed to style) zoom\n// e.g. unadjusted for tile overzooming\nvec4 modelPositionBaseZoom() {\n return\n vec4(\n a_position.xyz / TANGRAM_TILE_SCALE, // scale coords to ~0-1 range\n 1.)\n + vec4(0., 1., 0., 0.); // see note on offset above\n}\n\n#endif\n\n// Vertex position in world coordinates, useful for 3d procedural textures, etc.\nvec4 worldPosition() {\n return v_world_position;\n}\n\n// Optionally wrap world coordinates (allows more precision at higher zooms)\n// e.g. at wrap 1000, the world space will wrap every 1000 meters\n#ifdef TANGRAM_VERTEX_SHADER\n\nvec4 wrapWorldPosition(vec4 world_position) {\n #if defined(TANGRAM_WORLD_POSITION_WRAP)\n vec2 anchor = u_tile_origin.xy - mod(u_tile_origin.xy, TANGRAM_WORLD_POSITION_WRAP);\n world_position.xy -= anchor;\n #endif\n return world_position;\n}\n\n#endif\n\n// Normal in world space\n#if defined(TANGRAM_VERTEX_SHADER)\n\nvec3 worldNormal() {\n return TANGRAM_NORMAL;\n}\n\n#elif defined(TANGRAM_FRAGMENT_SHADER)\n\nvec3 worldNormal() {\n return u_inverseNormalMatrix * TANGRAM_NORMAL;\n}\n\n#endif\n"),j.addBlock("global","// Vertex attribute + varying for feature selection\n#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)\n attribute vec4 a_selection_color;\n varying vec4 v_selection_color;\n#endif\n"),j.replaceBlock("setup","// Selection pass-specific rendering\n#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)\n if (a_selection_color.rgb == vec3(0.)) {\n // Discard by forcing invalid triangle if we're in the feature\n // selection pass but have no selection info\n // TODO: in some cases we may actually want non-selectable features to occlude selectable ones?\n gl_Position = vec4(0., 0., 0., 1.);\n return;\n }\n v_selection_color = a_selection_color;\n#endif\n"),j.defines.TANGRAM_EPSILON=1e-5,j.defines.TANGRAM_LAYER_DELTA=1/16384,j.defines.TANGRAM_TILE_SCALE=`vec3(${G.tile_scale}., ${G.tile_scale}., u_meters_per_pixel * ${G.tile_size}.)`,j.defines.TANGRAM_HEIGHT_SCALE=G.height_scale,j.defines.TANGRAM_ALPHA_TEST=.5}destroy(e){Object.keys(this.styles).forEach(t=>{let r=this.styles[t];r.gl===e&&(_("trace",`StyleManager.destroy: destroying render style ${r.name}`),r.base&&this.remove(r.name),r.destroy())})}register(e){this.styles[e.name]=e,this.base_styles[e.name]=e}remove(e){delete this.styles[e]}getActiveStyles(){return this.active_styles}updateActiveStyles(e){return this.active_styles=Object.keys(e.reduce((e,t)=>(Object.keys(t.meshes).forEach(t=>e[t]=!0),e),{})),this.active_styles}getActiveBlendOrders(){return this.active_blend_orders}updateActiveBlendOrders(e){const t=[];e.forEach(e=>{Object.entries(e.meshes).forEach(([e,r])=>{r.forEach(r=>{const n=r.variant.blend_order;let i=t.findIndex(e=>e.blend_order===n);i=i>-1?i:t.push({blend_order:n,styles:[]})-1,-1===t[i].styles.indexOf(e)&&t[i].styles.push(e)})})}),this.active_blend_orders=t.sort((e,t)=>e.blend_order-t.blend_order)}mix(e,t){if(e.mixed)return e;e.mixed={};let r=[];e.mix&&(Array.isArray(e.mix)?r.push(...e.mix):r.push(e.mix),r=r.map(e=>t[e]).filter(t=>t&&t!==e),r.forEach(t=>e.mixed[t.name]=!0)),r.push(e),e.animated=r.some(e=>e&&e.animated),e.texcoords=r.some(e=>e&&e.texcoords),e.base=r.map(e=>e.base).filter(e=>e).pop(),e.lighting=r.map(e=>e.lighting).filter(e=>null!=e).pop(),e.texture=r.map(e=>e.texture).filter(e=>e).pop(),e.raster=r.map(e=>e.raster).filter(e=>null!=e).pop(),e.dash=r.map(e=>e.dash).filter(e=>null!=e).pop(),e.dash_background_color=r.map(e=>e.dash_background_color).filter(e=>null!=e).pop(),r.some(e=>Object.prototype.hasOwnProperty.call(e,"blend")&&e.blend)&&(e.blend=r.map(e=>Object.prototype.hasOwnProperty.call(e,"blend")&&e.blend).filter(e=>e).pop()),e.blend_order=r.map(e=>e.blend_order).filter(e=>null!=e).pop(),e.defines=Object.assign({},...r.map(e=>e.defines).filter(e=>e)),e.material=Object.assign({},...r.map(e=>e.material).filter(e=>e));let n=r.map(e=>e.draw).filter(e=>e);return n.length>0&&(e.draw=V({},...n)),this.mixShaders(e,t,r),e}mixShaders(e,t,r){let n={},i=r.map(e=>e.shaders).filter(e=>e);if(n.defines=Object.assign({},...i.map(e=>e.defines).filter(e=>e)),n.attributes=Object.assign({},...i.map(e=>e.attributes).filter(e=>e)),n.uniforms={},n._uniforms=e.shaders&&e.shaders.uniforms||{},n._uniform_scopes={},r.filter(e=>e.shaders&&e.shaders.uniforms).forEach(e=>{for(let r in e.shaders.uniforms)n._uniform_scopes[r]=e.name,Object.defineProperty(n.uniforms,r,{enumerable:!0,configurable:!0,get:function(){return void 0!==n._uniforms[r]?n._uniforms[r]:t[n._uniform_scopes[r]].shaders.uniforms!==n.uniforms?t[n._uniform_scopes[r]].shaders.uniforms[r]:void 0},set:function(e){n._uniforms[r]=e}})}),n.extensions=Object.keys(i.map(e=>e.extensions).filter(e=>e).reduce((e,t)=>("string"==typeof t?e[t]=!0:t.forEach(t=>e[t]=!0),e),{})||{}),e.shaders&&e.shaders.blocks){e.shaders.block_scopes=e.shaders.block_scopes||{};for(let t in e.shaders.blocks){let r=e.shaders.blocks[t];e.shaders.block_scopes[t]=e.shaders.block_scopes[t]||[],Array.isArray(r)?e.shaders.block_scopes[t].push(...r.map(()=>e.name)):e.shaders.block_scopes[t].push(e.name)}}let s={};return i.forEach(e=>{if(!e.blocks)return;n.blocks=n.blocks||{},n.block_scopes=n.block_scopes||{};let t={};for(let r in e.blocks){let i=e.blocks[r],o=e.block_scopes[r];n.blocks[r]=n.blocks[r]||[],n.block_scopes[r]=n.block_scopes[r]||[],i=Array.isArray(i)?i:[i],o=Array.isArray(o)?o:[o];for(let e=0;e<i.length;e++)s[o[e]]||(t[o[e]]=!0,n.blocks[r].push(i[e]),n.block_scopes[r].push(o[e]))}Object.assign(s,t)}),Object.assign(e.mixed,s),e.shaders=n,e}create(e,t,r={}){let n=V({},t);return n.name=e,n=this.mix(n,r),n.base&&this.base_styles[n.base]?this.styles[e]=n=Object.assign(Object.create(this.base_styles[n.base]),n):n.base=null,n}build(e){const t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?An(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):An(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},e);this.styles&&Object.values(this.styles).forEach(e=>a.removeTarget(e.main_thread_target));const r=["opaque","add","multiply","overlay","inlay","translucent"],n=["polygons","lines","points","text","raster"];for(const e of r)for(const r of n){const n=e+"_"+r;null==t[n]&&(t[n]={base:r,blend:e})}let s=Object.keys(t).sort((e,r)=>this.inheritanceDepth(e,t)-this.inheritanceDepth(r,t));for(let e in this.styles)this.base_styles[e]?this.styles[e].reset():delete this.styles[e];let o={};return s.forEach(e=>{o[e]=this.create(e,t[e],o)}),this.styles}initStyles(e={}){for(let t in this.styles)this.styles[t].init(e)}inheritanceDepth(e,t){let r=0;for(;;){let n=t[e];if(!n)break;if(!n.mix)break;if(r++,Array.isArray(n.mix)){r+=Math.max(...n.mix.map(r=>{if(e!==r)return this.inheritanceDepth(r,t)}));break}if(e===n.mix)break;e=n.mix}return r}},e.StyleParser=J,e.Task=E,e.TextCanvas=wr,e.Texture=k,e.Thread=t,e.Tile=ti,e.TileID=Se,e.Utils=g,e.Vector=ye,e.VertexArrayObject=B,e.VertexData=Fe,e.VertexElements=ze,e.View=class{constructor(e,t){T(this),this.scene=e,this.createMatrices(),this.zoom=null,this.center=null,this.bounds=null,this.meters_per_pixel=null,this.panning=!1,this.panning_stop_at=0,this.pan_snap_timer=0,this.zoom_direction=0,this.user_input_at=0,this.user_input_timeout=50,this.user_input_active=!1,this.size={css:{},device:{},meters:{}},this.aspect=null,this.buffer=0,this.continuous_zoom="boolean"!=typeof t.continuousZoom||t.continuousZoom,this.wrap=!1!==t.wrapView,this.preserve_tiles_within_zoom=1,this.reset()}reset(){this.createCamera()}createCamera(){let e=this.getActiveCamera();e&&(this.camera=sn.create(e,this,this.scene.config.cameras[e]),this.camera.updateView())}getActiveCamera(){if(this.scene.config&&this.scene.config.cameras){for(let e in this.scene.config.cameras)if(this.scene.config.cameras[e].active)return e;let e=Object.keys(this.scene.config.cameras);return e.length&&e[0]}}setActiveCamera(e){let t=this.getActiveCamera();return t===e?e:(this.scene.config.cameras[e]&&(this.scene.config.cameras[e].active=!0,t&&this.scene.config.cameras[t]&&delete this.scene.config.cameras[t].active),this.scene.updateConfig({rebuild:!1,normalize:!1}),this.getActiveCamera())}update(){null!=this.camera&&this.ready()&&this.camera.update(),this.pan_snap_timer=(+new Date-this.panning_stop_at)/1e3,this.user_input_active=+new Date-this.user_input_at<this.user_input_timeout}setViewportSize(e,t){this.size.css={width:e,height:t},this.size.device={width:Math.round(this.size.css.width*g.device_pixel_ratio),height:Math.round(this.size.css.height*g.device_pixel_ratio)},this.aspect=this.size.css.width/this.size.css.height,this.updateBounds()}setView({lng:e,lat:t,zoom:r}={}){var n=!1;return"number"==typeof e&&"number"==typeof t&&(this.center&&e===this.center.lng&&t===this.center.lat||(n=!0,this.center={lng:e,lat:t})),"number"==typeof r&&r!==this.zoom&&(n=!0,this.setZoom(r)),n&&this.updateBounds(),n}setZoom(e){let t=this.tile_zoom,r=this.baseZoom(e);this.continuous_zoom||(e=r),r!==t&&(this.zoom_direction=r>t?1:-1),this.zoom=e,this.tile_zoom=r,this.updateBounds(),this.scene.requestRedraw()}baseZoom(e){return Math.floor(e)}setPanning(e){this.panning=e,this.panning||(this.panning_stop_at=+new Date)}markUserInput(){this.user_input_at=+new Date}ready(){return"number"==typeof this.size.css.width&&"number"==typeof this.size.css.height&&null!=this.center&&"number"==typeof this.zoom}updateBounds(){if(!this.ready())return;this.meters_per_pixel=G.metersPerPixel(this.zoom),this.size.meters={x:this.size.css.width*this.meters_per_pixel,y:this.size.css.height*this.meters_per_pixel};const e=G.latLngToMeters([this.center.lng,this.center.lat]);this.center.meters={x:e[0],y:e[1]},this.center.tile=G.tileForMeters([this.center.meters.x,this.center.meters.y],this.tile_zoom),this.bounds={sw:{x:this.center.meters.x-this.size.meters.x/2,y:this.center.meters.y-this.size.meters.y/2},ne:{x:this.center.meters.x+this.size.meters.x/2,y:this.center.meters.y+this.size.meters.y/2}},this.scene.tile_manager.updateTilesForView(),this.trigger("move"),this.scene.requestRedraw()}findVisibleTileCoordinates(){if(!this.bounds)return[];let e=this.tile_zoom,t=G.tileForMeters([this.bounds.sw.x,this.bounds.sw.y],e),r=G.tileForMeters([this.bounds.ne.x,this.bounds.ne.y],e),n=[t.x-this.buffer,r.x+this.buffer,r.y-this.buffer,t.y+this.buffer];if(!1===this.wrap){let t=(1<<e)-1;n=n.map(e=>Math.min(Math.max(0,e),t))}let i=[];for(let t=n[0];t<=n[1];t++)for(let r=n[2];r<=n[3];r++)i.push(Se.coord({x:t,y:r,z:e}));return i}pruneTilesForView(){this.ready()&&this.scene.tile_manager.removeTiles(e=>{if(e.visible||e.isProxy())return!1;if(e.loading&&e.style_z!==this.tile_zoom)return!0;if(Math.abs(e.style_z-this.tile_zoom)>(null!=e.preserve_tiles_within_zoom?e.preserve_tiles_within_zoom:this.preserve_tiles_within_zoom))return!0;const t=this.meters_per_pixel*G.tile_size,r=Se.coordAtZoom(G.tileForMeters([this.center.meters.x-this.size.meters.x/2-t,this.center.meters.y+this.size.meters.y/2+t],this.tile_zoom),e.coords.z),n=Se.coordAtZoom(G.tileForMeters([this.center.meters.x+this.size.meters.x/2+t,this.center.meters.y-this.size.meters.y/2-t],this.tile_zoom),e.coords.z);return(e.coords.x<r.x||e.coords.x>n.x||e.coords.y<r.y||e.coords.y>n.y)&&(_("trace",`View: remove tile ${e.key} (as ${e.coords.key}) for being too far out of visible area (${r.key}, ${n.key})`),!0)})}createMatrices(){this.matrices={},this.matrices.model=new Float64Array(16),this.matrices.model32=new Float32Array(16),this.matrices.model_view=new Float64Array(16),this.matrices.model_view32=new Float32Array(16),this.matrices.normal=new Float64Array(9),this.matrices.normal32=new Float32Array(9),this.matrices.inverse_normal32=new Float32Array(9)}setupTile(e,t){e.setupProgram(this.matrices,t),this.camera.setupMatrices(this.matrices,t)}setupProgram(e){e.uniform("2fv","u_resolution",[this.size.device.width,this.size.device.height]),e.uniform("3fv","u_map_position",[this.center.meters.x,this.center.meters.y,this.zoom]),e.uniform("1f","u_meters_per_pixel",this.meters_per_pixel),e.uniform("1f","u_device_pixel_ratio",g.device_pixel_ratio),e.uniform("1f","u_view_pan_snap_timer",this.pan_snap_timer),e.uniform("1i","u_view_panning",this.panning),this.camera.setupProgram(e)}isAnimating(){return this.pan_snap_timer<=.5}},e.WorkerBroker=a,e._defineProperty=i,e.addBaseURL=function(e,t){if(!e||!x(e))return e;var r,n="/"!==e[0];if(t?(r=document.createElement("a")).href=t:r=window.location,n)e=b(r.href)+e;else{let t=r.origin;t||(t=r.protocol+"//"+r.host),e=t+e}return e},e.buildFilter=jn,e.cache=H,e.clearFunctionStringCache=function(){H.functions={},H.num_functions=0,H.num_cached=0},e.compileFunctionStrings=Z,e.createObjectURL=function(e){return void 0===w&&(w=window.URL&&window.URL.createObjectURL||window.webkitURL&&window.webkitURL.createObjectURL,"function"!=typeof w&&(w=null,_("warn","window.URL.createObjectURL (or vendor prefix) not found, unable to create local blob URLs"))),w?w(e):e},e.debugSettings=v,e.debugSumLayerStats=function(e){let t={},r={};return e.filter(e=>e.debug.layers).forEach(e=>{Object.keys(e.debug.layers.list).forEach(r=>{let n=e.debug.layers.list[r];Pe(t,r,n.features,n.geoms,n.styles,n.base)}),ri(e.debug.layers.tree,r)}),{list:t,tree:r}},e.extensionForURL=function(e){let t=(e=e.split("/").pop()).lastIndexOf(".");if(t>-1)return e.substring(t+1)},e.flattenRelativeURL=function(e){let t=(e||"").split("/");for(let e=1;e<t.length;e++)"."===t[e]?(t.splice(e,1),e--):".."===t[e]&&(e+=0,t.splice(e-1,2),e--);return t.join("/")},e.getAugmentedNamespace=function(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r},e.getDefaultExportFromCjs=P,e.isLocalURL=function(e){if("string"==typeof e)return e.search(/^(data|blob):/)>-1},e.isRelativeURL=x,e.isReserved=Zn,e.layerCache=function(){return Bn},e.log=_,e.mergeDebugSettings=function(e){Object.assign(y,e)},e.mergeObjects=V,e.parseLayers=function(e,t){Bn={};let r={};for(let n in e){let i=e[n];i&&(r[n]=Kn(n,i,null,t))}return r},e.pathForURL=b,e.sliceObject=S,e.subscribeMixin=T,e.version=o}),Kg(0,function(e){const t=Object.assign(self,{FeatureSelection:e.FeatureSelection,sources:{},styles:{},layers:{},tiles:{},init(t,r,n,i,s,o,a){return this.scene_id=t,this._worker_id=r,this.num_workers=n,e.log.setLevel(i),e.Utils.device_pixel_ratio=s,e.VertexElements.setElementIndexUint(o),e.FeatureSelection.setPrefix(this._worker_id),this.style_manager=new e.StyleManager,this.importExternalScripts(a),e.Label.id_prefix=r,e.Label.id_multiplier=n,r},importExternalScripts(t){if(0===t.length)return;e.log("debug","loading custom data source scripts in worker:",t);let r=Object.getOwnPropertyNames(window);importScripts(...t),Object.getOwnPropertyNames(window).forEach(e=>{-1===r.indexOf(e)&&(this[e]=window[e])})},updateConfig({config:t,generation:r,introspection:n},i){return t=JSON.parse(t),e.mergeDebugSettings(i),this.generation=r,this.introspection=n,this.global=e.compileFunctionStrings(t.global),this.createDataSources(t),t.styles=e.compileFunctionStrings(t.styles,e.StyleParser.wrapFunction),this.styles=this.style_manager.build(t.styles),this.style_manager.initStyles({generation:this.generation,styles:this.styles,sources:this.sources,introspection:this.introspection}),this.layers=e.parseLayers(t.layers,this.style_manager.styles),this.syncing_textures=this.syncTextures(t.textures),this.configuring=this.syncing_textures.then(()=>{e.log("debug","updated config")}),this.configuring},createDataSources(t){this.last_config_sources=this.config_sources||{},this.config_sources=e.mergeObjects({},t.sources);let r=this.sources,n=[];this.sources={};for(let i in t.sources){if(JSON.stringify(this.last_config_sources[i])===JSON.stringify(t.sources[i])){this.sources[i]=r[i];continue}let s;t.sources[i]=e.compileFunctionStrings(t.sources[i]);try{s=e.DataSource.create(Object.assign({},t.sources[i],{name:i}),this.sources)}catch(e){continue}s&&(this.sources[i]=s,n.push(i))}n.forEach(e=>{for(let t in this.tiles)this.tiles[t].source===e&&delete this.tiles[t]})},awaitConfiguration(){return this.configuring},buildTile({tile:t}){if(null==this.getTile(t.key)||!0!==this.getTile(t.key).loading)return t=this.tiles[t.key]=Object.assign(this.getTile(t.key)||{},t),this.awaitConfiguration().then(()=>{if(!0!==t.loaded)t.loading=!0,t.loaded=!1,t.error=null,this.loadTileSourceData(t).then(()=>{this.getTile(t.key)?(t.source_data.error&&e.log("warn",`tile load error(s) for ${t.key}: ${t.source_data.error}`),t.loading=!1,t.loaded=!0,e.Tile.buildGeometry(t,this)):e.log("trace",`stop tile build after data source load because tile was removed: ${t.key}`)}).catch(r=>{t.loading=!1,t.loaded=!1,t.error=r.stack,e.log("error",`tile load error for ${t.key}: ${t.error}`),e.WorkerBroker.postMessage(`TileManager_${this.scene_id}.buildTileError`,e.Tile.slice(t))});else{e.log("trace",`used worker cache for tile ${t.key}`);try{e.Tile.buildGeometry(t,this)}catch(r){t.error=r.toString(),e.WorkerBroker.postMessage(`TileManager_${this.scene_id}.buildTileError`,e.Tile.slice(t))}}})},loadTileSourceData(e){const t=this.sources[e.source];if(t){for(const r in this.tiles){const n=this.tiles[r];if(n.source===e.source&&n.coords.key===e.coords.key&&n.loaded)return Promise.resolve(t.copyTileData(n,e))}return t.load(e)}return e.source_data={},Promise.resolve(e)},getTile(e){return this.tiles[e]},removeTile(t){var r=this.tiles[t];null!=r&&(!0===r.loading&&(e.log("trace",`cancel tile load for ${t}`),r.loading=!1,e.Tile.cancel(r)),e.FeatureSelection.clearTile(t),delete this.tiles[t],e.log("trace",`remove tile from cache for ${t}`))},queryFeatures({filter:t,visible:r,geometry:n,tile_keys:i}){let s=[],o=i.map(e=>this.tiles[e]).filter(e=>e&&e.loaded);return null!=t&&(t=["{","["].indexOf(t[0])>-1?JSON.parse(t):t,t=e.compileFunctionStrings(t,e.StyleParser.wrapFunction)),t=e.buildFilter(t,e.FilterOptions),o.forEach(i=>{for(let o in i.source_data.layers){let a=i.source_data.layers[o];if(null==a)return;a.features.forEach(a=>{const l=a.generation===this.generation;if(!0===r&&!l||!1===r&&l)return;let u=e.StyleParser.getFeatureParseContext(a,i,this.global);if(u.source=i.source,u.layer=o,u.id=a.id,!t(u))return;let c={type:a.type,id:a.id,properties:Object.assign({},a.properties,{$source:u.source,$layer:u.layer,$geometry:u.geometry,$visible:l})};!0===n&&(c.geometry=e.Geo.copyGeometry(a.geometry),e.Geo.tileSpaceToLatlng(c.geometry,i.coords.z,i.min)),s.push(c)})}}),s},getFeatureSelection({id:t,key:r}={}){var n=e.FeatureSelection.map[r];return{id:t,feature:n&&n.feature}},resetFeatureSelection(t=null){e.FeatureSelection.reset(t)},getFeatureSelectionMapSize:()=>e.FeatureSelection.getMapSize(),syncTextures(t){let r=[];return t&&r.push(...Object.keys(t)),e.log("trace","sync textures to worker:",r),r.length>0?e.Texture.syncTexturesToWorker(r):Promise.resolve()},updateDevicePixelRatio(t){e.Utils.device_pixel_ratio=t},clearFunctionStringCache(){e.clearFunctionStringCache()},profile(e){console.profile(`worker ${this._worker_id}: ${e}`)},profileEnd(e){console.profileEnd(`worker ${this._worker_id}: ${e}`)},debug:{debugSettings:e.debugSettings,layerCache:e.layerCache,functionStringCache:e.cache}});e.WorkerBroker.addTarget("self",t)}),Kg(0,function(e){var t,r=t={};let n=0;function i(e,t){var r;const n=t[t.length-1];return null===(r=o(e,t))||void 0===r?void 0:r[n]}function s(e,t,r){const n=t[t.length-1],i=o(e,t);i&&(i[n]=r)}function o(e,t){if(0===t.length)return;let r=e;for(let e=0;e<t.length-1;e++)if(r=r[t[e]],null==r)return;return r}t.getContext=function(e,r){var i=!1;null==e&&((e=document.createElement("canvas")).style.position="absolute",e.style.top=0,e.style.left=0,e.style.zIndex=-1,document.body.appendChild(e),i=!0),e.addEventListener("webglcontextlost",()=>{}),e.addEventListener("webglcontextrestored",()=>{});var s=e.getContext("webgl",r)||e.getContext("experimental-webgl",r);if(!s)throw new Error("Couldn't create WebGL context.");return s._tangram_id=n++,i?(t.resize(s,window.innerWidth,window.innerHeight,r.device_pixel_ratio),window.addEventListener("resize",function(){t.resize(s,window.innerWidth,window.innerHeight,r.device_pixel_ratio)})):t.resize(s,parseFloat(e.style.width),parseFloat(e.style.height),r.device_pixel_ratio),s},t.resize=function(e,t,r,n){n=n||window.devicePixelRatio||1,e.canvas.style.width=t+"px",e.canvas.style.height=r+"px",e.canvas.width=Math.round(t*n),e.canvas.height=Math.round(r*n),e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,e.canvas.width,e.canvas.height)};const a="global.",l="__global_prop";function u(e){return(null==e?void 0:e.slice(0,7))===a}function c(e,t){var r;const n=Array.isArray(t)?t:[t],i=o(e,n),s=n[n.length-1];return void 0!==(null==i||null===(r=i[l])||void 0===r?void 0:r[s])}function h(e,t=null,r={}){t=t?t+".":a;for(const n in e){const i=t+n,s=e[n];r[i]=s,"object"!=typeof s||Array.isArray(s)||h(s,i,r)}return r}function d(t,r,n,i){var s;let o;if(null!=n&&null!==(s=n[l])&&void 0!==s&&s[i]?o=n[l][i]:"string"==typeof r&&r.slice(0,7)===a&&(o=r),o){null==n[l]&&Object.defineProperty(n,l,{value:{}}),n[l][i]=o;let r,s=t[o];for(;"string"==typeof s&&s.slice(0,7)===a;){if(r=r||[o],r.indexOf(s)>-1){e.log({level:"warn",once:!0},"Global properties: cyclical reference detected",r),s=null;break}r.push(s),s=t[s]}Object.defineProperty(n,i,{enumerable:!0,get:function(){return s},set:function(e){delete n[l][i],delete n[i],n[i]=e}})}else if(Array.isArray(r))for(let e=0;e<r.length;e++)d(t,r[e],r,e);else if("object"==typeof r)for(const e in r)d(t,r[e],r,e);return r}var f="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},p=[],m=[],_="undefined"!=typeof Uint8Array?Uint8Array:Array,g=!1;function y(){g=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)p[t]=e[t],m[e.charCodeAt(t)]=t;m["-".charCodeAt(0)]=62,m["_".charCodeAt(0)]=63}function v(e,t,r){for(var n,i,s=[],o=t;o<r;o+=3)n=(e[o]<<16)+(e[o+1]<<8)+e[o+2],s.push(p[(i=n)>>18&63]+p[i>>12&63]+p[i>>6&63]+p[63&i]);return s.join("")}function b(e){var t;g||y();for(var r=e.length,n=r%3,i="",s=[],o=16383,a=0,l=r-n;a<l;a+=o)s.push(v(e,a,a+o>l?l:a+o));return 1===n?(t=e[r-1],i+=p[t>>2],i+=p[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=p[t>>10],i+=p[t>>4&63],i+=p[t<<2&63],i+="="),s.push(i),s.join("")}function x(e,t,r,n,i){var s,o,a=8*i-n-1,l=(1<<a)-1,u=l>>1,c=-7,h=r?i-1:0,d=r?-1:1,f=e[t+h];for(h+=d,s=f&(1<<-c)-1,f>>=-c,c+=a;c>0;s=256*s+e[t+h],h+=d,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+e[t+h],h+=d,c-=8);if(0===s)s=1-u;else{if(s===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),s-=u}return(f?-1:1)*o*Math.pow(2,s-n)}function w(e,t,r,n,i,s){var o,a,l,u=8*s-i-1,c=(1<<u)-1,h=c>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,p=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(o++,l/=2),o+h>=c?(a=0,o=c):o+h>=1?(a=(t*l-1)*Math.pow(2,i),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[r+f]=255&a,f+=p,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;e[r+f]=255&o,f+=p,o/=256,u-=8);e[r+f-p]|=128*m}var A={}.toString,E=Array.isArray||function(e){return"[object Array]"==A.call(e)};O.TYPED_ARRAY_SUPPORT=void 0===f.TYPED_ARRAY_SUPPORT||f.TYPED_ARRAY_SUPPORT;var T=S();function S(){return O.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function k(e,t){if(S()<t)throw new RangeError("Invalid typed array length");return O.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=O.prototype:(null===e&&(e=new O(t)),e.length=t),e}function O(e,t,r){if(!(O.TYPED_ARRAY_SUPPORT||this instanceof O))return new O(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return N(this,e)}return R(this,e,t,r)}function R(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),O.TYPED_ARRAY_SUPPORT?(e=t).__proto__=O.prototype:e=P(e,t),e}(e,t,r,n):"string"==typeof t?function(e,t,r){if("string"==typeof r&&""!==r||(r="utf8"),!O.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|z(t,r),i=(e=k(e,n)).write(t,r);return i!==n&&(e=e.slice(0,i)),e}(e,t,r):function(e,t){if(D(t)){var r=0|M(t.length);return 0===(e=k(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?k(e,0):P(e,t);if("Buffer"===t.type&&E(t.data))return P(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function C(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function N(e,t){if(C(t),e=k(e,t<0?0:0|M(t)),!O.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function P(e,t){var r=t.length<0?0:0|M(t.length);e=k(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function M(e){if(e>=S())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+S().toString(16)+" bytes");return 0|e}function D(e){return!(null==e||!e._isBuffer)}function z(e,t){if(D(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return le(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return ue(e).length;default:if(n)return le(e).length;t=(""+t).toLowerCase(),n=!0}}function I(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Y(this,t,r);case"utf8":case"utf-8":return H(this,t,r);case"ascii":return K(this,t,r);case"latin1":case"binary":return X(this,t,r);case"base64":return W(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function F(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function L(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=O.from(t,n)),D(t))return 0===t.length?-1:j(e,t,r,n,i);if("number"==typeof t)return t&=255,O.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):j(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function j(e,t,r,n,i){var s,o=1,a=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,a/=2,l/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(s=r;s<a;s++)if(u(e,s)===u(t,-1===c?0:s-c)){if(-1===c&&(c=s),s-c+1===l)return c*o}else-1!==c&&(s-=s-c),c=-1}else for(r+l>a&&(r=a-l),s=r;s>=0;s--){for(var h=!0,d=0;d<l;d++)if(u(e,s+d)!==u(t,d)){h=!1;break}if(h)return s}return-1}function U(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var o=0;o<n;++o){var a=parseInt(t.substr(2*o,2),16);if(isNaN(a))return o;e[r+o]=a}return o}function B(e,t,r,n){return ce(le(t,e.length-r),e,r,n)}function V(e,t,r,n){return ce(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function G(e,t,r,n){return V(e,t,r,n)}function $(e,t,r,n){return ce(ue(t),e,r,n)}function q(e,t,r,n){return ce(function(e,t){for(var r,n,i,s=[],o=0;o<e.length&&!((t-=2)<0);++o)n=(r=e.charCodeAt(o))>>8,i=r%256,s.push(i),s.push(n);return s}(t,e.length-r),e,r,n)}function W(e,t,r){return 0===t&&r===e.length?b(e):b(e.slice(t,r))}function H(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var s,o,a,l,u=e[i],c=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h<=r)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(s=e[i+1]))&&(l=(31&u)<<6|63&s)>127&&(c=l);break;case 3:s=e[i+1],o=e[i+2],128==(192&s)&&128==(192&o)&&(l=(15&u)<<12|(63&s)<<6|63&o)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:s=e[i+1],o=e[i+2],a=e[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&u)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=h}return function(e){var t=e.length;if(t<=Z)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Z));return r}(n)}O.poolSize=8192,O._augment=function(e){return e.__proto__=O.prototype,e},O.from=function(e,t,r){return R(null,e,t,r)},O.TYPED_ARRAY_SUPPORT&&(O.prototype.__proto__=Uint8Array.prototype,O.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&O[Symbol.species]),O.alloc=function(e,t,r){return function(e,t,r,n){return C(t),t<=0?k(e,t):void 0!==r?"string"==typeof n?k(e,t).fill(r,n):k(e,t).fill(r):k(e,t)}(null,e,t,r)},O.allocUnsafe=function(e){return N(null,e)},O.allocUnsafeSlow=function(e){return N(null,e)},O.isBuffer=he,O.compare=function(e,t){if(!D(e)||!D(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},O.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},O.concat=function(e,t){if(!E(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return O.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=O.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(!D(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},O.byteLength=z,O.prototype._isBuffer=!0,O.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)F(this,t,t+1);return this},O.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)F(this,t,t+3),F(this,t+1,t+2);return this},O.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)F(this,t,t+7),F(this,t+1,t+6),F(this,t+2,t+5),F(this,t+3,t+4);return this},O.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?H(this,0,e):I.apply(this,arguments)},O.prototype.equals=function(e){if(!D(e))throw new TypeError("Argument must be a Buffer");return this===e||0===O.compare(this,e)},O.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},O.prototype.compare=function(e,t,r,n,i){if(!D(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var s=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),a=Math.min(s,o),l=this.slice(n,i),u=e.slice(t,r),c=0;c<a;++c)if(l[c]!==u[c]){s=l[c],o=u[c];break}return s<o?-1:o<s?1:0},O.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},O.prototype.indexOf=function(e,t,r){return L(this,e,t,r,!0)},O.prototype.lastIndexOf=function(e,t,r){return L(this,e,t,r,!1)},O.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return U(this,e,t,r);case"utf8":case"utf-8":return B(this,e,t,r);case"ascii":return V(this,e,t,r);case"latin1":case"binary":return G(this,e,t,r);case"base64":return $(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},O.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;function K(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function X(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function Y(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",s=t;s<r;++s)i+=ae(e[s]);return i}function Q(e,t,r){for(var n=e.slice(t,r),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);return i}function J(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function ee(e,t,r,n,i,s){if(!D(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function te(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(e.length-r,2);i<s;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function re(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(e.length-r,4);i<s;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function ne(e,t,r,n,i,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function ie(e,t,r,n,i){return i||ne(e,0,r,4),w(e,t,r,n,23,4),r+4}function se(e,t,r,n,i){return i||ne(e,0,r,8),w(e,t,r,n,52,8),r+8}O.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),O.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=O.prototype;else{var i=t-e;r=new O(i,void 0);for(var s=0;s<i;++s)r[s]=this[s+e]}return r},O.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||J(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n},O.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||J(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},O.prototype.readUInt8=function(e,t){return t||J(e,1,this.length),this[e]},O.prototype.readUInt16LE=function(e,t){return t||J(e,2,this.length),this[e]|this[e+1]<<8},O.prototype.readUInt16BE=function(e,t){return t||J(e,2,this.length),this[e]<<8|this[e+1]},O.prototype.readUInt32LE=function(e,t){return t||J(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},O.prototype.readUInt32BE=function(e,t){return t||J(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},O.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||J(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},O.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||J(e,t,this.length);for(var n=t,i=1,s=this[e+--n];n>0&&(i*=256);)s+=this[e+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},O.prototype.readInt8=function(e,t){return t||J(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},O.prototype.readInt16LE=function(e,t){t||J(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},O.prototype.readInt16BE=function(e,t){t||J(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},O.prototype.readInt32LE=function(e,t){return t||J(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},O.prototype.readInt32BE=function(e,t){return t||J(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},O.prototype.readFloatLE=function(e,t){return t||J(e,4,this.length),x(this,e,!0,23,4)},O.prototype.readFloatBE=function(e,t){return t||J(e,4,this.length),x(this,e,!1,23,4)},O.prototype.readDoubleLE=function(e,t){return t||J(e,8,this.length),x(this,e,!0,52,8)},O.prototype.readDoubleBE=function(e,t){return t||J(e,8,this.length),x(this,e,!1,52,8)},O.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||ee(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,s=0;for(this[t]=255&e;++s<r&&(i*=256);)this[t+s]=e/i&255;return t+r},O.prototype.writeUIntBE=function(e,t,r,n){e=+e,t|=0,r|=0,n||ee(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},O.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,1,255,0),O.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},O.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,2,65535,0),O.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):te(this,e,t,!0),t+2},O.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,2,65535,0),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):te(this,e,t,!1),t+2},O.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,4,4294967295,0),O.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):re(this,e,t,!0),t+4},O.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,4,4294967295,0),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):re(this,e,t,!1),t+4},O.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);ee(this,e,t,r,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s<r&&(o*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+r},O.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);ee(this,e,t,r,i-1,-i)}var s=r-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+r},O.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,1,127,-128),O.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},O.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,2,32767,-32768),O.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):te(this,e,t,!0),t+2},O.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,2,32767,-32768),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):te(this,e,t,!1),t+2},O.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,4,2147483647,-2147483648),O.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):re(this,e,t,!0),t+4},O.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):re(this,e,t,!1),t+4},O.prototype.writeFloatLE=function(e,t,r){return ie(this,e,t,!0,r)},O.prototype.writeFloatBE=function(e,t,r){return ie(this,e,t,!1,r)},O.prototype.writeDoubleLE=function(e,t,r){return se(this,e,t,!0,r)},O.prototype.writeDoubleBE=function(e,t,r){return se(this,e,t,!1,r)},O.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,s=n-r;if(this===e&&r<t&&t<n)for(i=s-1;i>=0;--i)e[i+t]=this[i+r];else if(s<1e3||!O.TYPED_ARRAY_SUPPORT)for(i=0;i<s;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+s),t);return s},O.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!O.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var s;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s<r;++s)this[s]=e;else{var o=D(e)?e:le(new O(e,n).toString()),a=o.length;for(s=0;s<r-t;++s)this[s+t]=o[s%a]}return this};var oe=/[^+\/0-9A-Za-z-_]/g;function ae(e){return e<16?"0"+e.toString(16):e.toString(16)}function le(e,t){var r;t=t||1/0;for(var n=e.length,i=null,s=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function ue(e){return function(e){var t,r,n,i,s,o;g||y();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s="="===e[a-2]?2:"="===e[a-1]?1:0,o=new _(3*a/4-s),n=s>0?a-4:a;var l=0;for(t=0,r=0;t<n;t+=4,r+=3)i=m[e.charCodeAt(t)]<<18|m[e.charCodeAt(t+1)]<<12|m[e.charCodeAt(t+2)]<<6|m[e.charCodeAt(t+3)],o[l++]=i>>16&255,o[l++]=i>>8&255,o[l++]=255&i;return 2===s?(i=m[e.charCodeAt(t)]<<2|m[e.charCodeAt(t+1)]>>4,o[l++]=255&i):1===s&&(i=m[e.charCodeAt(t)]<<10|m[e.charCodeAt(t+1)]<<4|m[e.charCodeAt(t+2)]>>2,o[l++]=i>>8&255,o[l++]=255&i),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(oe,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ce(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function he(e){return null!=e&&(!!e._isBuffer||de(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&de(e.slice(0,0))}(e))}function de(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var fe=Object.freeze({__proto__:null,Buffer:O,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),O.alloc(+e)},isBuffer:he,kMaxLength:T});function pe(){throw new Error("setTimeout has not been defined")}function me(){throw new Error("clearTimeout has not been defined")}var _e=pe,ge=me;function ye(e){if(_e===setTimeout)return setTimeout(e,0);if((_e===pe||!_e)&&setTimeout)return _e=setTimeout,setTimeout(e,0);try{return _e(e,0)}catch(t){try{return _e.call(null,e,0)}catch(t){return _e.call(this,e,0)}}}"function"==typeof f.setTimeout&&(_e=setTimeout),"function"==typeof f.clearTimeout&&(ge=clearTimeout);var ve,be=[],xe=!1,we=-1;function Ae(){xe&&ve&&(xe=!1,ve.length?be=ve.concat(be):we=-1,be.length&&Ee())}function Ee(){if(!xe){var e=ye(Ae);xe=!0;for(var t=be.length;t;){for(ve=be,be=[];++we<t;)ve&&ve[we].run();we=-1,t=be.length}ve=null,xe=!1,function(e){if(ge===clearTimeout)return clearTimeout(e);if((ge===me||!ge)&&clearTimeout)return ge=clearTimeout,clearTimeout(e);try{return ge(e)}catch(t){try{return ge.call(null,e)}catch(t){return ge.call(this,e)}}}(e)}}function Te(e,t){this.fun=e,this.array=t}Te.prototype.run=function(){this.fun.apply(null,this.array)};var Se=f.performance||{};function ke(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}Se.now||Se.mozNow||Se.msNow||Se.oNow||Se.webkitNow;var Oe,Re,Ce,Ne,Pe,Me,De,ze,Ie,Fe,Le,je,Ue,Be,Ve,Ge,$e,qe,We,He,Ze,Ke,Xe,Ye,Qe,Je,et,tt,rt,nt,it,st,ot,at,lt={exports:{}},ut=(Oe||(Oe=1,lt.exports=function e(t,r,n){function i(o,a){if(!r[o]){if(!t[o]){if(!a&&ke)return ke(o);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var u=r[o]={exports:{}};t[o][0].call(u.exports,function(e){return i(t[o][1][e]||e)},u,u.exports,e,t,r,n)}return r[o].exports}for(var s=ke,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,t,r){var n=e("./utils"),i=e("./support"),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(e){for(var t,r,i,o,a,l,u,c=[],h=0,d=e.length,f=d,p="string"!==n.getTypeOf(e);h<e.length;)f=d-h,i=p?(t=e[h++],r=h<d?e[h++]:0,h<d?e[h++]:0):(t=e.charCodeAt(h++),r=h<d?e.charCodeAt(h++):0,h<d?e.charCodeAt(h++):0),o=t>>2,a=(3&t)<<4|r>>4,l=1<f?(15&r)<<2|i>>6:64,u=2<f?63&i:64,c.push(s.charAt(o)+s.charAt(a)+s.charAt(l)+s.charAt(u));return c.join("")},r.decode=function(e){var t,r,n,o,a,l,u=0,c=0,h="data:";if(e.substr(0,5)===h)throw new Error("Invalid base64 input, it looks like a data url.");var d,f=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===s.charAt(64)&&f--,e.charAt(e.length-2)===s.charAt(64)&&f--,f%1!=0)throw new Error("Invalid base64 input, bad content length.");for(d=i.uint8array?new Uint8Array(0|f):new Array(0|f);u<e.length;)t=s.indexOf(e.charAt(u++))<<2|(o=s.indexOf(e.charAt(u++)))>>4,r=(15&o)<<4|(a=s.indexOf(e.charAt(u++)))>>2,n=(3&a)<<6|(l=s.indexOf(e.charAt(u++))),d[c++]=t,64!==a&&(d[c++]=r),64!==l&&(d[c++]=n);return d}},{"./support":30,"./utils":32}],2:[function(e,t,r){var n=e("./external"),i=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function a(e,t,r,n,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=n,this.compressedContent=i}a.prototype={getContentWorker:function(){var e=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,r){return e.pipe(new s).pipe(new o("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){var n=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){var n=e("./utils"),i=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==n.getTypeOf(e)?function(e,t,r){var n=i,s=0+r;e^=-1;for(var o=0;o<s;o++)e=e>>>8^n[255&(e^t[o])];return~e}(0|t,e,e.length):function(e,t,r){var n=i,s=0+r;e^=-1;for(var o=0;o<s;o++)e=e>>>8^n[255&(e^t.charCodeAt(o))];return~e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,r){r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){var n;n="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:n}},{lie:37}],7:[function(e,t,r){var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=e("pako"),s=e("./utils"),o=e("./stream/GenericWorker"),a=n?"uint8array":"array";function l(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}r.magic="\b\0",s.inherits(l,o),l.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(a,e.data),!1)},l.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},r.compressWorker=function(e){return new l("Deflate",e)},r.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){function n(e,t){var r,n="";for(r=0;r<t;r++)n+=String.fromCharCode(255&e),e>>>=8;return n}function i(e,t,r,i,o,c){var h,d,f=e.file,p=e.compression,m=c!==a.utf8encode,_=s.transformTo("string",c(f.name)),g=s.transformTo("string",a.utf8encode(f.name)),y=f.comment,v=s.transformTo("string",c(y)),b=s.transformTo("string",a.utf8encode(y)),x=g.length!==f.name.length,w=b.length!==y.length,A="",E="",T="",S=f.dir,k=f.date,O={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(O.crc32=e.crc32,O.compressedSize=e.compressedSize,O.uncompressedSize=e.uncompressedSize);var R=0;t&&(R|=8),m||!x&&!w||(R|=2048);var C=0,N=0;S&&(C|=16),"UNIX"===o?(N=798,C|=function(e,t){var r=e;return e||(r=t?16893:33204),(65535&r)<<16}(f.unixPermissions,S)):(N=20,C|=function(e){return 63&(e||0)}(f.dosPermissions)),h=k.getUTCHours(),h<<=6,h|=k.getUTCMinutes(),h<<=5,h|=k.getUTCSeconds()/2,d=k.getUTCFullYear()-1980,d<<=4,d|=k.getUTCMonth()+1,d<<=5,d|=k.getUTCDate(),x&&(E=n(1,1)+n(l(_),4)+g,A+="up"+n(E.length,2)+E),w&&(T=n(1,1)+n(l(v),4)+b,A+="uc"+n(T.length,2)+T);var P="";return P+="\n\0",P+=n(R,2),P+=p.magic,P+=n(h,2),P+=n(d,2),P+=n(O.crc32,4),P+=n(O.compressedSize,4),P+=n(O.uncompressedSize,4),P+=n(_.length,2),P+=n(A.length,2),{fileRecord:u.LOCAL_FILE_HEADER+P+_+A,dirRecord:u.CENTRAL_FILE_HEADER+n(N,2)+P+n(v.length,2)+"\0\0\0\0"+n(C,4)+n(i,4)+_+A+v}}var s=e("../utils"),o=e("../stream/GenericWorker"),a=e("../utf8"),l=e("../crc32"),u=e("../signature");function c(e,t,r,n){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=n,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(c,o),c.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-n-1))/r:100}}))},c.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},c.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:function(e){return u.DATA_DESCRIPTOR+n(e.crc32,4)+n(e.compressedSize,4)+n(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},c.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var r=this.bytesWritten-e,i=function(e,t,r,i,o){var a=s.transformTo("string",o(i));return u.CENTRAL_DIRECTORY_END+"\0\0\0\0"+n(e,2)+n(e,2)+n(t,4)+n(r,4)+n(a.length,2)+a}(this.dirRecords.length,r,e,this.zipComment,this.encodeFileName);this.push({data:i,meta:{percent:100}})},c.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},c.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(e){t.error(e)}),this},c.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},c.prototype.error=function(e){var t=this._sources;if(!o.prototype.error.call(this,e))return!1;for(var r=0;r<t.length;r++)try{t[r].error(e)}catch(e){}return!0},c.prototype.lock=function(){o.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=c},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,r){var n=e("../compressions"),i=e("./ZipFileWorker");r.generateWorker=function(e,t,r){var s=new i(t.streamFiles,r,t.platform,t.encodeFileName),o=0;try{e.forEach(function(e,r){o++;var i=function(e,t){var r=e||t,i=n[r];if(!i)throw new Error(r+" is not a valid compression method !");return i}(r.options.compression,t.compression),a=r.options.compressionOptions||t.compressionOptions||{},l=r.dir,u=r.date;r._compressWorker(i,a).withStreamInfo("file",{name:e,dir:l,date:u,comment:r.comment||"",unixPermissions:r.unixPermissions,dosPermissions:r.dosPermissions}).pipe(s)}),s.entriesCount=o}catch(e){s.error(e)}return s}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,r){function n(){if(!(this instanceof n))return new n;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new n;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(n.prototype=e("./object")).loadAsync=e("./load"),n.support=e("./support"),n.defaults=e("./defaults"),n.version="3.10.1",n.loadAsync=function(e,t){return(new n).loadAsync(e,t)},n.external=e("./external"),t.exports=n},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,r){var n=e("./utils"),i=e("./external"),s=e("./utf8"),o=e("./zipEntries"),a=e("./stream/Crc32Probe"),l=e("./nodejsUtils");function u(e){return new i.Promise(function(t,r){var n=e.decompressed.getContentWorker().pipe(new a);n.on("error",function(e){r(e)}).on("end",function(){n.streamInfo.crc32!==e.decompressed.crc32?r(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}t.exports=function(e,t){var r=this;return t=n.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:s.utf8decode}),l.isNode&&l.isStream(e)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(e){var r=new o(t);return r.load(e),r}).then(function(e){var r=[i.Promise.resolve(e)],n=e.files;if(t.checkCRC32)for(var s=0;s<n.length;s++)r.push(u(n[s]));return i.Promise.all(r)}).then(function(e){for(var i=e.shift(),s=i.files,o=0;o<s.length;o++){var a=s[o],l=a.fileNameStr,u=n.resolve(a.fileNameStr);r.file(u,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:t.createFolders}),a.dir||(r.file(u).unsafeOriginalName=l)}return i.zipComment.length&&(r.comment=i.zipComment),r})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,r){var n=e("../utils"),i=e("../stream/GenericWorker");function s(e,t){i.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}n.inherits(s,i),s.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},s.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=s},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,r){var n=e("readable-stream").Readable;function i(e,t,r){n.call(this,t),this._helper=e;var i=this;e.on("data",function(e,t){i.push(e)||i._helper.pause(),r&&r(t)}).on("error",function(e){i.emit("error",e)}).on("end",function(){i.push(null)})}e("../utils").inherits(i,n),i.prototype._read=function(){this._helper.resume()},t.exports=i},{"../utils":32,"readable-stream":16}],14:[function(e,t,r){t.exports={isNode:void 0!==O,newBufferFrom:function(e,t){if(O.from&&O.from!==Uint8Array.from)return O.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new O(e,t)},allocBuffer:function(e){if(O.alloc)return O.alloc(e);var t=new O(e);return t.fill(0),t},isBuffer:function(e){return he(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,r){function n(e,t,r){var n,i=s.getTypeOf(t),a=s.extend(r||{},l);a.date=a.date||new Date,null!==a.compression&&(a.compression=a.compression.toUpperCase()),"string"==typeof a.unixPermissions&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&16384&a.unixPermissions&&(a.dir=!0),a.dosPermissions&&16&a.dosPermissions&&(a.dir=!0),a.dir&&(e=m(e)),a.createFolders&&(n=p(e))&&_.call(this,n,!0);var h="string"===i&&!1===a.binary&&!1===a.base64;r&&void 0!==r.binary||(a.binary=!h),(t instanceof u&&0===t.uncompressedSize||a.dir||!t||0===t.length)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",i="string");var g;g=t instanceof u||t instanceof o?t:d.isNode&&d.isStream(t)?new f(e,t):s.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var y=new c(e,g,a);this.files[e]=y}var i=e("./utf8"),s=e("./utils"),o=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),l=e("./defaults"),u=e("./compressedObject"),c=e("./zipObject"),h=e("./generate"),d=e("./nodejsUtils"),f=e("./nodejs/NodejsStreamInputAdapter"),p=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},m=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},_=function(e,t){return t=void 0!==t?t:l.createFolders,e=m(e),this.files[e]||n.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function g(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var y={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,r,n;for(t in this.files)n=this.files[t],(r=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(r,n)},filter:function(e){var t=[];return this.forEach(function(r,n){e(r,n)&&t.push(n)}),t},file:function(e,t,r){if(1!==arguments.length)return e=this.root+e,n.call(this,e,t,r),this;if(g(e)){var i=e;return this.filter(function(e,t){return!t.dir&&i.test(e)})}var s=this.files[this.root+e];return s&&!s.dir?s:null},folder:function(e){if(!e)return this;if(g(e))return this.filter(function(t,r){return r.dir&&e.test(t)});var t=this.root+e,r=_.call(this,t),n=this.clone();return n.root=r.name,n},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var r=this.filter(function(t,r){return r.name.slice(0,e.length)===e}),n=0;n<r.length;n++)delete this.files[r[n].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,r={};try{if((r=s.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),"binarystring"===r.type&&(r.type="string"),!r.type)throw new Error("No output type specified.");s.checkSupport(r.type),"darwin"!==r.platform&&"freebsd"!==r.platform&&"linux"!==r.platform&&"sunos"!==r.platform||(r.platform="UNIX"),"win32"===r.platform&&(r.platform="DOS");var n=r.comment||this.comment||"";t=h.generateWorker(this,r,n)}catch(e){(t=new o("error")).error(e)}return new a(t,r.type||"string",r.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=y},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,r){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,r){var n=e("./DataReader");function i(e){n.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(i,n),i.prototype.byteAt=function(e){return this.data[this.zero+e]},i.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),i=e.charCodeAt(3),s=this.length-4;0<=s;--s)if(this.data[s]===t&&this.data[s+1]===r&&this.data[s+2]===n&&this.data[s+3]===i)return s-this.zero;return-1},i.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),i=e.charCodeAt(3),s=this.readData(4);return t===s[0]&&r===s[1]&&n===s[2]&&i===s[3]},i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],18:[function(e,t,r){var n=e("../utils");function i(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,r=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return n.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,r){var n=e("./Uint8ArrayReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){var n=e("./DataReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){var n=e("./ArrayReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){var n=e("../utils"),i=e("../support"),s=e("./ArrayReader"),o=e("./StringReader"),a=e("./NodeBufferReader"),l=e("./Uint8ArrayReader");t.exports=function(e){var t=n.getTypeOf(e);return n.checkSupport(t),"string"!==t||i.uint8array?"nodebuffer"===t?new a(e):i.uint8array?new l(n.transformTo("uint8array",e)):new s(n.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,r){var n=e("./GenericWorker"),i=e("../utils");function s(e){n.call(this,"ConvertWorker to "+e),this.destType=e}i.inherits(s,n),s.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){var n=e("./GenericWorker"),i=e("../crc32");function s(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(s,n),s.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){var n=e("../utils"),i=e("./GenericWorker");function s(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}n.inherits(s,i),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){var n=e("../utils"),i=e("./GenericWorker");function s(e){i.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=n.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}n.inherits(s,i),s.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){function n(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r<this._listeners[e].length;r++)this._listeners[e][r].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=n},{}],29:[function(e,t,r){var n=e("../utils"),i=e("./ConvertWorker"),s=e("./GenericWorker"),o=e("../base64"),a=e("../support"),l=e("../external"),u=null;if(a.nodestream)try{u=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function c(e,t,r){var o=t;switch(t){case"blob":case"arraybuffer":o="uint8array";break;case"base64":o="string"}try{this._internalType=o,this._outputType=t,this._mimeType=r,n.checkSupport(o),this._worker=e.pipe(new i(o)),e.lock()}catch(e){this._worker=new s("error"),this._worker.error(e)}}c.prototype={accumulate:function(e){return function(e,t){return new l.Promise(function(r,i){var s=[],a=e._internalType,l=e._outputType,u=e._mimeType;e.on("data",function(e,r){s.push(e),t&&t(r)}).on("error",function(e){s=[],i(e)}).on("end",function(){try{var e=function(e,t,r){switch(e){case"blob":return n.newBlob(n.transformTo("arraybuffer",t),r);case"base64":return o.encode(t);default:return n.transformTo(e,t)}}(l,function(e,t){var r,n=0,i=null,s=0;for(r=0;r<t.length;r++)s+=t[r].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(i=new Uint8Array(s),r=0;r<t.length;r++)i.set(t[r],n),n+=t[r].length;return i;case"nodebuffer":return O.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(a,s),u);r(e)}catch(e){i(e)}s=[]}).resume()})}(this,e)},on:function(e,t){var r=this;return"data"===e?this._worker.on(e,function(e){t.call(r,e.data,e.meta)}):this._worker.on(e,function(){n.delay(t,arguments,r)}),this},resume:function(){return n.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(n.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new u(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=c},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,r){if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,r.nodebuffer=void 0!==O,r.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)r.blob=!1;else{var n=new ArrayBuffer(0);try{r.blob=0===new Blob([n],{type:"application/zip"}).size}catch(e){try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(n),r.blob=0===i.getBlob("application/zip").size}catch(e){r.blob=!1}}}try{r.nodestream=!!e("readable-stream").Readable}catch(e){r.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,r){for(var n=e("./utils"),i=e("./support"),s=e("./nodejsUtils"),o=e("./stream/GenericWorker"),a=new Array(256),l=0;l<256;l++)a[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function u(){o.call(this,"utf-8 decode"),this.leftOver=null}function c(){o.call(this,"utf-8 encode")}a[254]=a[254]=1,r.utf8encode=function(e){return i.nodebuffer?s.newBufferFrom(e,"utf-8"):function(e){var t,r,n,s,o,a=e.length,l=0;for(s=0;s<a;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(n-56320),s++),l+=r<128?1:r<2048?2:r<65536?3:4;for(t=i.uint8array?new Uint8Array(l):new Array(l),s=o=0;o<l;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(n-56320),s++),r<128?t[o++]=r:(r<2048?t[o++]=192|r>>>6:(r<65536?t[o++]=224|r>>>12:(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63),t[o++]=128|r>>>6&63),t[o++]=128|63&r);return t}(e)},r.utf8decode=function(e){return i.nodebuffer?n.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,r,i,s,o=e.length,l=new Array(2*o);for(t=r=0;t<o;)if((i=e[t++])<128)l[r++]=i;else if(4<(s=a[i]))l[r++]=65533,t+=s-1;else{for(i&=2===s?31:3===s?15:7;1<s&&t<o;)i=i<<6|63&e[t++],s--;1<s?l[r++]=65533:i<65536?l[r++]=i:(i-=65536,l[r++]=55296|i>>10&1023,l[r++]=56320|1023&i)}return l.length!==r&&(l.subarray?l=l.subarray(0,r):l.length=r),n.applyFromCharCode(l)}(e=n.transformTo(i.uint8array?"uint8array":"array",e))},n.inherits(u,o),u.prototype.processChunk=function(e){var t=n.transformTo(i.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var s=t;(t=new Uint8Array(s.length+this.leftOver.length)).set(this.leftOver,0),t.set(s,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0||0===r?t:r+a[e[r]]>t?r:t}(t),l=t;o!==t.length&&(i.uint8array?(l=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(l=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:r.utf8decode(l),meta:e.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=u,n.inherits(c,o),c.prototype.processChunk=function(e){this.push({data:r.utf8encode(e.data),meta:e.meta})},r.Utf8EncodeWorker=c},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,r){var n=e("./support"),i=e("./base64"),s=e("./nodejsUtils"),o=e("./external");function a(e){return e}function l(e,t){for(var r=0;r<e.length;++r)t[r]=255&e.charCodeAt(r);return t}e("setimmediate"),r.newBlob=function(e,t){r.checkSupport("blob");try{return new Blob([e],{type:t})}catch(r){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return n.append(e),n.getBlob(t)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var u={stringifyByChunk:function(e,t,r){var n=[],i=0,s=e.length;if(s<=r)return String.fromCharCode.apply(null,e);for(;i<s;)"array"===t||"nodebuffer"===t?n.push(String.fromCharCode.apply(null,e.slice(i,Math.min(i+r,s)))):n.push(String.fromCharCode.apply(null,e.subarray(i,Math.min(i+r,s)))),i+=r;return n.join("")},stringifyByChar:function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},applyCanBeUsed:{uint8array:function(){try{return n.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return n.nodebuffer&&1===String.fromCharCode.apply(null,s.allocBuffer(1)).length}catch(e){return!1}}()}};function c(e){var t=65536,n=r.getTypeOf(e),i=!0;if("uint8array"===n?i=u.applyCanBeUsed.uint8array:"nodebuffer"===n&&(i=u.applyCanBeUsed.nodebuffer),i)for(;1<t;)try{return u.stringifyByChunk(e,n,t)}catch(e){t=Math.floor(t/2)}return u.stringifyByChar(e)}function h(e,t){for(var r=0;r<e.length;r++)t[r]=e[r];return t}r.applyFromCharCode=c;var d={};d.string={string:a,array:function(e){return l(e,new Array(e.length))},arraybuffer:function(e){return d.string.uint8array(e).buffer},uint8array:function(e){return l(e,new Uint8Array(e.length))},nodebuffer:function(e){return l(e,s.allocBuffer(e.length))}},d.array={string:c,array:a,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return s.newBufferFrom(e)}},d.arraybuffer={string:function(e){return c(new Uint8Array(e))},array:function(e){return h(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:a,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return s.newBufferFrom(new Uint8Array(e))}},d.uint8array={string:c,array:function(e){return h(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:a,nodebuffer:function(e){return s.newBufferFrom(e)}},d.nodebuffer={string:c,array:function(e){return h(e,new Array(e.length))},arraybuffer:function(e){return d.nodebuffer.uint8array(e).buffer},uint8array:function(e){return h(e,new Uint8Array(e.length))},nodebuffer:a},r.transformTo=function(e,t){if(t=t||"",!e)return t;r.checkSupport(e);var n=r.getTypeOf(t);return d[n][e](t)},r.resolve=function(e){for(var t=e.split("/"),r=[],n=0;n<t.length;n++){var i=t[n];"."===i||""===i&&0!==n&&n!==t.length-1||(".."===i?r.pop():r.push(i))}return r.join("/")},r.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":n.nodebuffer&&s.isBuffer(e)?"nodebuffer":n.uint8array&&e instanceof Uint8Array?"uint8array":n.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},r.checkSupport=function(e){if(!n[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(e){var t,r,n="";for(r=0;r<(e||"").length;r++)n+="\\x"+((t=e.charCodeAt(r))<16?"0":"")+t.toString(16).toUpperCase();return n},r.delay=function(e,t,r){setImmediate(function(){e.apply(r||null,t||[])})},r.inherits=function(e,t){function r(){}r.prototype=t.prototype,e.prototype=new r},r.extend=function(){var e,t,r={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===r[t]&&(r[t]=arguments[e][t]);return r},r.prepareContent=function(e,t,s,a,u){return o.Promise.resolve(t).then(function(e){return n.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new o.Promise(function(t,r){var n=new FileReader;n.onload=function(e){t(e.target.result)},n.onerror=function(e){r(e.target.error)},n.readAsArrayBuffer(e)}):e}).then(function(t){var c=r.getTypeOf(t);return c?("arraybuffer"===c?t=r.transformTo("uint8array",t):"string"===c&&(u?t=i.decode(t):s&&!0!==a&&(t=function(e){return l(e,n.uint8array?new Uint8Array(e.length):new Array(e.length))}(t))),t):o.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,r){var n=e("./reader/readerFor"),i=e("./utils"),s=e("./signature"),o=e("./zipEntry"),a=e("./support");function l(e){this.files=[],this.loadOptions=e}l.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(t)+", expected "+i.pretty(e)+")")}},isSignature:function(e,t){var r=this.reader.index;this.reader.setIndex(e);var n=this.reader.readString(4)===t;return this.reader.setIndex(r),n},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=a.uint8array?"uint8array":"array",r=i.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(r)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,r,n=this.zip64EndOfCentralSize-44;0<n;)e=this.reader.readInt(2),t=this.reader.readInt(4),r=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:r}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER);)(e=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,s.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(e);var t=e;if(this.checkSignature(s.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,s.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var r=this.centralDirOffset+this.centralDirSize;this.zip64&&(r+=20,r+=12+this.zip64EndOfCentralSize);var n=t-r;if(0<n)this.isSignature(t,s.CENTRAL_FILE_HEADER)||(this.reader.zero=n);else if(n<0)throw new Error("Corrupted zip: missing "+Math.abs(n)+" bytes.")},prepareReader:function(e){this.reader=n(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=l},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,r){var n=e("./reader/readerFor"),i=e("./utils"),s=e("./compressedObject"),o=e("./crc32"),a=e("./utf8"),l=e("./compressions"),u=e("./support");function c(e,t){this.options=e,this.loadOptions=t}c.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(e){var t,r;if(e.skip(22),this.fileNameLength=e.readInt(2),r=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(r),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in l)if(Object.prototype.hasOwnProperty.call(l,t)&&l[t].magic===e)return l[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new s(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=n(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,r,n,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<i;)t=e.readInt(2),r=e.readInt(2),n=e.readData(r),this.extraFields[t]={id:t,length:r,value:n};e.setIndex(i)},handleUTF8:function(){var e=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var r=i.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var n=this.findExtraFieldUnicodeComment();if(null!==n)this.fileCommentStr=n;else{var s=i.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(s)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=n(e.value);return 1!==t.readInt(1)||o(this.fileName)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=n(e.value);return 1!==t.readInt(1)||o(this.fileComment)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null}},t.exports=c},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,r){function n(e,t,r){this.name=e,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=t,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}}var i=e("./stream/StreamHelper"),s=e("./stream/DataWorker"),o=e("./utf8"),a=e("./compressedObject"),l=e("./stream/GenericWorker");n.prototype={internalStream:function(e){var t=null,r="string";try{if(!e)throw new Error("No output type specified.");var n="string"===(r=e.toLowerCase())||"text"===r;"binarystring"!==r&&"text"!==r||(r="string"),t=this._decompressWorker();var s=!this._dataBinary;s&&!n&&(t=t.pipe(new o.Utf8EncodeWorker)),!s&&n&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(e){(t=new l("error")).error(e)}return new i(t,r,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof a&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new o.Utf8EncodeWorker)),a.createWorkerFrom(r,e,t)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof l?this._data:new s(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],c=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},h=0;h<u.length;h++)n.prototype[u[h]]=c;t.exports=n},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,r){(function(e){var r,n,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var s=0,o=new i(c),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),r=function(){a.data=s=++s%2}}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){c(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(c,0)};else{var l=new e.MessageChannel;l.port1.onmessage=c,r=function(){l.port2.postMessage(0)}}var u=[];function c(){var e,t;n=!0;for(var r=u.length;r;){for(t=u,u=[],e=-1;++e<r;)t[e]();r=u.length}n=!1}t.exports=function(e){1!==u.push(e)||n||r()}}).call(this,void 0!==f?f:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,r){var n=e("immediate");function i(){}var s={},o=["REJECTED"],a=["FULFILLED"],l=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==i&&f(this,e)}function c(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function h(e,t,r){n(function(){var n;try{n=t(r)}catch(n){return s.reject(e,n)}n===e?s.reject(e,new TypeError("Cannot resolve promise with itself")):s.resolve(e,n)})}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function f(e,t){var r=!1;function n(t){r||(r=!0,s.reject(e,t))}function i(t){r||(r=!0,s.resolve(e,t))}var o=p(function(){t(i,n)});"error"===o.status&&n(o.value)}function p(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}(t.exports=u).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then(function(r){return t.resolve(e()).then(function(){return r})},function(r){return t.resolve(e()).then(function(){throw r})})},u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var r=new this.constructor(i);return this.state!==l?h(r,this.state===a?e:t,this.outcome):this.queue.push(new c(r,e,t)),r},c.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},c.prototype.otherCallFulfilled=function(e){h(this.promise,this.onFulfilled,e)},c.prototype.callRejected=function(e){s.reject(this.promise,e)},c.prototype.otherCallRejected=function(e){h(this.promise,this.onRejected,e)},s.resolve=function(e,t){var r=p(d,t);if("error"===r.status)return s.reject(e,r.value);var n=r.value;if(n)f(e,n);else{e.state=a,e.outcome=t;for(var i=-1,o=e.queue.length;++i<o;)e.queue[i].callFulfilled(t)}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},u.resolve=function(e){return e instanceof this?e:s.resolve(new this(i),e)},u.reject=function(e){var t=new this(i);return s.reject(t,e)},u.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var o=new Array(r),a=0,l=-1,u=new this(i);++l<r;)c(e[l],l);return u;function c(e,i){t.resolve(e).then(function(e){o[i]=e,++a!==r||n||(n=!0,s.resolve(u,o))},function(e){n||(n=!0,s.reject(u,e))})}},u.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,r=!1;if(!t)return this.resolve([]);for(var n,o=-1,a=new this(i);++o<t;)n=e[o],this.resolve(n).then(function(e){r||(r=!0,s.resolve(a,e))},function(e){r||(r=!0,s.reject(a,e))});return a}},{immediate:36}],38:[function(e,t,r){var n={};(0,e("./lib/utils/common").assign)(n,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=n},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,r){var n=e("./zlib/deflate"),i=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/messages"),a=e("./zlib/zstream"),l=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=i.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var r=n.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(o[r]);if(t.header&&n.deflateSetHeader(this.strm,t.header),t.dictionary){var c;if(c="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=n.deflateSetDictionary(this.strm,c)))throw new Error(o[r]);this._dict_set=!0}}function c(e,t){var r=new u(t);if(r.push(e,!0),r.err)throw r.msg||o[r.err];return r.result}u.prototype.push=function(e,t){var r,o,a=this.strm,u=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=s.string2buf(e):"[object ArrayBuffer]"===l.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new i.Buf8(u),a.next_out=0,a.avail_out=u),1!==(r=n.deflate(a,o))&&0!==r)return this.onEnd(r),!(this.ended=!0);0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(s.buf2binstring(i.shrinkBuf(a.output,a.next_out))):this.onData(i.shrinkBuf(a.output,a.next_out)))}while((0<a.avail_in||0===a.avail_out)&&1!==r);return 4===o?(r=n.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==o||(this.onEnd(0),!(a.avail_out=0))},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Deflate=u,r.deflate=c,r.deflateRaw=function(e,t){return(t=t||{}).raw=!0,c(e,t)},r.gzip=function(e,t){return(t=t||{}).gzip=!0,c(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,r){var n=e("./zlib/inflate"),i=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/constants"),a=e("./zlib/messages"),l=e("./zlib/zstream"),u=e("./zlib/gzheader"),c=Object.prototype.toString;function h(e){if(!(this instanceof h))return new h(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var r=n.inflateInit2(this.strm,t.windowBits);if(r!==o.Z_OK)throw new Error(a[r]);this.header=new u,n.inflateGetHeader(this.strm,this.header)}function d(e,t){var r=new h(t);if(r.push(e,!0),r.err)throw r.msg||a[r.err];return r.result}h.prototype.push=function(e,t){var r,a,l,u,h,d,f=this.strm,p=this.options.chunkSize,m=this.options.dictionary,_=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?f.input=s.binstring2buf(e):"[object ArrayBuffer]"===c.call(e)?f.input=new Uint8Array(e):f.input=e,f.next_in=0,f.avail_in=f.input.length;do{if(0===f.avail_out&&(f.output=new i.Buf8(p),f.next_out=0,f.avail_out=p),(r=n.inflate(f,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&m&&(d="string"==typeof m?s.string2buf(m):"[object ArrayBuffer]"===c.call(m)?new Uint8Array(m):m,r=n.inflateSetDictionary(this.strm,d)),r===o.Z_BUF_ERROR&&!0===_&&(r=o.Z_OK,_=!1),r!==o.Z_STREAM_END&&r!==o.Z_OK)return this.onEnd(r),!(this.ended=!0);f.next_out&&(0!==f.avail_out&&r!==o.Z_STREAM_END&&(0!==f.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(l=s.utf8border(f.output,f.next_out),u=f.next_out-l,h=s.buf2string(f.output,l),f.next_out=u,f.avail_out=p-u,u&&i.arraySet(f.output,f.output,l,u,0),this.onData(h)):this.onData(i.shrinkBuf(f.output,f.next_out)))),0===f.avail_in&&0===f.avail_out&&(_=!0)}while((0<f.avail_in||0===f.avail_out)&&r!==o.Z_STREAM_END);return r===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(r=n.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(f.avail_out=0))},h.prototype.onData=function(e){this.chunks.push(e)},h.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Inflate=h,r.inflate=d,r.inflateRaw=function(e,t){return(t=t||{}).raw=!0,d(e,t)},r.ungzip=d},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,r){var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;r.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])}}return e},r.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var s=0;s<n;s++)e[i+s]=t[r+s]},flattenChunks:function(e){var t,r,n,i,s,o;for(t=n=0,r=e.length;t<r;t++)n+=e[t].length;for(o=new Uint8Array(n),t=i=0,r=e.length;t<r;t++)s=e[t],o.set(s,i),i+=s.length;return o}},s={arraySet:function(e,t,r,n,i){for(var s=0;s<n;s++)e[i+s]=t[r+s]},flattenChunks:function(e){return[].concat.apply([],e)}};r.setTyped=function(e){e?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,i)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,s))},r.setTyped(n)},{}],42:[function(e,t,r){var n=e("./common"),i=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var o=new n.Buf8(256),a=0;a<256;a++)o[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function l(e,t){if(t<65537&&(e.subarray&&s||!e.subarray&&i))return String.fromCharCode.apply(null,n.shrinkBuf(e,t));for(var r="",o=0;o<t;o++)r+=String.fromCharCode(e[o]);return r}o[254]=o[254]=1,r.string2buf=function(e){var t,r,i,s,o,a=e.length,l=0;for(s=0;s<a;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(i-56320),s++),l+=r<128?1:r<2048?2:r<65536?3:4;for(t=new n.Buf8(l),s=o=0;o<l;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(i-56320),s++),r<128?t[o++]=r:(r<2048?t[o++]=192|r>>>6:(r<65536?t[o++]=224|r>>>12:(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63),t[o++]=128|r>>>6&63),t[o++]=128|63&r);return t},r.buf2binstring=function(e){return l(e,e.length)},r.binstring2buf=function(e){for(var t=new n.Buf8(e.length),r=0,i=t.length;r<i;r++)t[r]=e.charCodeAt(r);return t},r.buf2string=function(e,t){var r,n,i,s,a=t||e.length,u=new Array(2*a);for(r=n=0;r<a;)if((i=e[r++])<128)u[n++]=i;else if(4<(s=o[i]))u[n++]=65533,r+=s-1;else{for(i&=2===s?31:3===s?15:7;1<s&&r<a;)i=i<<6|63&e[r++],s--;1<s?u[n++]=65533:i<65536?u[n++]=i:(i-=65536,u[n++]=55296|i>>10&1023,u[n++]=56320|1023&i)}return l(u,n)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0||0===r?t:r+o[e[r]]>t?r:t}},{"./common":41}],43:[function(e,t,r){t.exports=function(e,t,r,n){for(var i=65535&e,s=e>>>16&65535,o=0;0!==r;){for(r-=o=2e3<r?2e3:r;s=s+(i=i+t[n++]|0)|0,--o;);i%=65521,s%=65521}return i|s<<16}},{}],44:[function(e,t,r){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,r){var n=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t,r,i){var s=n,o=i+r;e^=-1;for(var a=i;a<o;a++)e=e>>>8^s[255&(e^t[a])];return~e}},{}],46:[function(e,t,r){var n,i=e("../utils/common"),s=e("./trees"),o=e("./adler32"),a=e("./crc32"),l=e("./messages"),u=-2,c=258,h=262,d=113;function f(e,t){return e.msg=l[t],t}function p(e){return(e<<1)-(4<e?9:0)}function m(e){for(var t=e.length;0<=--t;)e[t]=0}function _(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(i.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function g(e,t){s._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,_(e.strm)}function y(e,t){e.pending_buf[e.pending++]=t}function v(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function b(e,t){var r,n,i=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-h?e.strstart-(e.w_size-h):0,u=e.window,d=e.w_mask,f=e.prev,p=e.strstart+c,m=u[s+o-1],_=u[s+o];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+o]===_&&u[r+o-1]===m&&u[r]===u[s]&&u[++r]===u[s+1]){s+=2,r++;do{}while(u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&s<p);if(n=c-(p-s),s=p-c,o<n){if(e.match_start=t,a<=(o=n))break;m=u[s+o-1],_=u[s+o]}}}while((t=f[t&d])>l&&0!=--i);return o<=e.lookahead?o:e.lookahead}function x(e){var t,r,n,s,l,u,c,d,f,p,m=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-h)){for(i.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=r=e.hash_size;n=e.head[--t],e.head[t]=m<=n?n-m:0,--r;);for(t=r=m;n=e.prev[--t],e.prev[t]=m<=n?n-m:0,--r;);s+=m}if(0===e.strm.avail_in)break;if(u=e.strm,c=e.window,d=e.strstart+e.lookahead,p=void 0,(f=s)<(p=u.avail_in)&&(p=f),r=0===p?0:(u.avail_in-=p,i.arraySet(c,u.input,u.next_in,p,d),1===u.state.wrap?u.adler=o(u.adler,c,p,d):2===u.state.wrap&&(u.adler=a(u.adler,c,p,d)),u.next_in+=p,u.total_in+=p,p),e.lookahead+=r,e.lookahead+e.insert>=3)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+3-1])&e.hash_mask,e.prev[l&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=l,l++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<h&&0!==e.strm.avail_in)}function w(e,t){for(var r,n;;){if(e.lookahead<h){if(x(e),e.lookahead<h&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-h&&(e.match_length=b(e,r)),e.match_length>=3)if(n=s._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}function A(e,t){for(var r,n,i;;){if(e.lookahead<h){if(x(e),e.lookahead<h&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-h&&(e.match_length=b(e,r),e.match_length<=5&&(1===e.strategy||3===e.match_length&&4096<e.strstart-e.match_start)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-3,n=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(g(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=s._tr_tally(e,0,e.window[e.strstart-1]))&&g(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=s._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}function E(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function T(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(1146),this.dyn_dtree=new i.Buf16(122),this.bl_tree=new i.Buf16(78),m(this.dyn_ltree),m(this.dyn_dtree),m(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(16),this.heap=new i.Buf16(573),m(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(573),m(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function S(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:d,e.adler=2===t.wrap?0:1,t.last_flush=0,s._tr_init(t),0):f(e,u)}function k(e){var t=S(e);return 0===t&&function(e){e.window_size=2*e.w_size,m(e.head),e.max_lazy_match=n[e.level].max_lazy,e.good_match=n[e.level].good_length,e.nice_match=n[e.level].nice_length,e.max_chain_length=n[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0}(e.state),t}function O(e,t,r,n,s,o){if(!e)return u;var a=1;if(-1===t&&(t=6),n<0?(a=0,n=-n):15<n&&(a=2,n-=16),s<1||9<s||8!==r||n<8||15<n||t<0||9<t||o<0||4<o)return f(e,u);8===n&&(n=9);var l=new T;return(e.state=l).strm=e,l.wrap=a,l.gzhead=null,l.w_bits=n,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=s+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+3-1)/3),l.window=new i.Buf8(2*l.w_size),l.head=new i.Buf16(l.hash_size),l.prev=new i.Buf16(l.w_size),l.lit_bufsize=1<<s+6,l.pending_buf_size=4*l.lit_bufsize,l.pending_buf=new i.Buf8(l.pending_buf_size),l.d_buf=1*l.lit_bufsize,l.l_buf=3*l.lit_bufsize,l.level=t,l.strategy=o,l.method=r,k(e)}n=[new E(0,0,0,0,function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(x(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,g(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-h&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(g(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(g(e,!1),e.strm.avail_out),1)}),new E(4,4,8,4,w),new E(4,5,16,8,w),new E(4,6,32,32,w),new E(4,4,16,16,A),new E(8,16,32,32,A),new E(8,16,128,128,A),new E(8,32,128,256,A),new E(32,128,258,1024,A),new E(32,258,258,4096,A)],r.deflateInit=function(e,t){return O(e,t,8,15,8,0)},r.deflateInit2=O,r.deflateReset=k,r.deflateResetKeep=S,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?u:(e.state.gzhead=t,0):u},r.deflate=function(e,t){var r,i,o,l;if(!e||!e.state||5<t||t<0)return e?f(e,u):u;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||666===i.status&&4!==t)return f(e,0===e.avail_out?-5:u);if(i.strm=e,r=i.last_flush,i.last_flush=t,42===i.status)if(2===i.wrap)e.adler=0,y(i,31),y(i,139),y(i,8),i.gzhead?(y(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),y(i,255&i.gzhead.time),y(i,i.gzhead.time>>8&255),y(i,i.gzhead.time>>16&255),y(i,i.gzhead.time>>24&255),y(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),y(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(y(i,255&i.gzhead.extra.length),y(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=a(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(y(i,0),y(i,0),y(i,0),y(i,0),y(i,0),y(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),y(i,3),i.status=d);else{var h=8+(i.w_bits-8<<4)<<8;h|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(h|=32),h+=31-h%31,i.status=d,v(i,h),0!==i.strstart&&(v(i,e.adler>>>16),v(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),_(e),o=i.pending,i.pending!==i.pending_buf_size));)y(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),_(e),o=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,y(i,l)}while(0!==l);i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),0===l&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),_(e),o=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,y(i,l)}while(0!==l);i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),0===l&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&_(e),i.pending+2<=i.pending_buf_size&&(y(i,255&e.adler),y(i,e.adler>>8&255),e.adler=0,i.status=d)):i.status=d),0!==i.pending){if(_(e),0===e.avail_out)return i.last_flush=-1,0}else if(0===e.avail_in&&p(t)<=p(r)&&4!==t)return f(e,-5);if(666===i.status&&0!==e.avail_in)return f(e,-5);if(0!==e.avail_in||0!==i.lookahead||0!==t&&666!==i.status){var b=2===i.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(x(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}(i,t):3===i.strategy?function(e,t){for(var r,n,i,o,a=e.window;;){if(e.lookahead<=c){if(x(e),e.lookahead<=c&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&0<e.strstart&&(n=a[i=e.strstart-1])===a[++i]&&n===a[++i]&&n===a[++i]){o=e.strstart+c;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=c-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=s._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}(i,t):n[i.level].func(i,t);if(3!==b&&4!==b||(i.status=666),1===b||3===b)return 0===e.avail_out&&(i.last_flush=-1),0;if(2===b&&(1===t?s._tr_align(i):5!==t&&(s._tr_stored_block(i,0,0,!1),3===t&&(m(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),_(e),0===e.avail_out))return i.last_flush=-1,0}return 4!==t?0:i.wrap<=0?1:(2===i.wrap?(y(i,255&e.adler),y(i,e.adler>>8&255),y(i,e.adler>>16&255),y(i,e.adler>>24&255),y(i,255&e.total_in),y(i,e.total_in>>8&255),y(i,e.total_in>>16&255),y(i,e.total_in>>24&255)):(v(i,e.adler>>>16),v(i,65535&e.adler)),_(e),0<i.wrap&&(i.wrap=-i.wrap),0!==i.pending?0:1)},r.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&t!==d&&666!==t?f(e,u):(e.state=null,t===d?f(e,-3):0):u},r.deflateSetDictionary=function(e,t){var r,n,s,a,l,c,h,d,f=t.length;if(!e||!e.state)return u;if(2===(a=(r=e.state).wrap)||1===a&&42!==r.status||r.lookahead)return u;for(1===a&&(e.adler=o(e.adler,t,f,0)),r.wrap=0,f>=r.w_size&&(0===a&&(m(r.head),r.strstart=0,r.block_start=0,r.insert=0),d=new i.Buf8(r.w_size),i.arraySet(d,t,f-r.w_size,r.w_size,0),t=d,f=r.w_size),l=e.avail_in,c=e.next_in,h=e.input,e.avail_in=f,e.next_in=0,e.input=t,x(r);r.lookahead>=3;){for(n=r.strstart,s=r.lookahead-2;r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++,--s;);r.strstart=n,r.lookahead=2,x(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=c,e.input=h,e.avail_in=l,r.wrap=a,0},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,r){t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,r){t.exports=function(e,t){var r,n,i,s,o,a,l,u,c,h,d,f,p,m,_,g,y,v,b,x,w,A,E,T,S;r=e.state,n=e.next_in,T=e.input,i=n+(e.avail_in-5),s=e.next_out,S=e.output,o=s-(t-e.avail_out),a=s+(e.avail_out-257),l=r.dmax,u=r.wsize,c=r.whave,h=r.wnext,d=r.window,f=r.hold,p=r.bits,m=r.lencode,_=r.distcode,g=(1<<r.lenbits)-1,y=(1<<r.distbits)-1;e:do{p<15&&(f+=T[n++]<<p,p+=8,f+=T[n++]<<p,p+=8),v=m[f&g];t:for(;;){if(f>>>=b=v>>>24,p-=b,0==(b=v>>>16&255))S[s++]=65535&v;else{if(!(16&b)){if(!(64&b)){v=m[(65535&v)+(f&(1<<b)-1)];continue t}if(32&b){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}x=65535&v,(b&=15)&&(p<b&&(f+=T[n++]<<p,p+=8),x+=f&(1<<b)-1,f>>>=b,p-=b),p<15&&(f+=T[n++]<<p,p+=8,f+=T[n++]<<p,p+=8),v=_[f&y];r:for(;;){if(f>>>=b=v>>>24,p-=b,!(16&(b=v>>>16&255))){if(!(64&b)){v=_[(65535&v)+(f&(1<<b)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(w=65535&v,p<(b&=15)&&(f+=T[n++]<<p,(p+=8)<b&&(f+=T[n++]<<p,p+=8)),l<(w+=f&(1<<b)-1)){e.msg="invalid distance too far back",r.mode=30;break e}if(f>>>=b,p-=b,(b=s-o)<w){if(c<(b=w-b)&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(E=d,(A=0)===h){if(A+=u-b,b<x){for(x-=b;S[s++]=d[A++],--b;);A=s-w,E=S}}else if(h<b){if(A+=u+h-b,(b-=h)<x){for(x-=b;S[s++]=d[A++],--b;);if(A=0,h<x){for(x-=b=h;S[s++]=d[A++],--b;);A=s-w,E=S}}}else if(A+=h-b,b<x){for(x-=b;S[s++]=d[A++],--b;);A=s-w,E=S}for(;2<x;)S[s++]=E[A++],S[s++]=E[A++],S[s++]=E[A++],x-=3;x&&(S[s++]=E[A++],1<x&&(S[s++]=E[A++]))}else{for(A=s-w;S[s++]=S[A++],S[s++]=S[A++],S[s++]=S[A++],2<(x-=3););x&&(S[s++]=S[A++],1<x&&(S[s++]=S[A++]))}break}}break}}while(n<i&&s<a);n-=x=p>>3,f&=(1<<(p-=x<<3))-1,e.next_in=n,e.next_out=s,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=s<a?a-s+257:257-(s-a),r.hold=f,r.bits=p}},{}],49:[function(e,t,r){var n=e("../utils/common"),i=e("./adler32"),s=e("./crc32"),o=e("./inffast"),a=e("./inftrees"),l=-2;function u(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function c(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function h(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new n.Buf32(852),t.distcode=t.distdyn=new n.Buf32(592),t.sane=1,t.back=-1,0):l}function d(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,h(e)):l}function f(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?l:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,d(e))):l}function p(e,t){var r,n;return e?(n=new c,(e.state=n).window=null,0!==(r=f(e,t))&&(e.state=null),r):l}var m,_,g=!0;function y(e){if(g){var t;for(m=new n.Buf32(512),_=new n.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(1,e.lens,0,288,m,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(2,e.lens,0,32,_,0,e.work,{bits:5}),g=!1}e.lencode=m,e.lenbits=9,e.distcode=_,e.distbits=5}function v(e,t,r,i){var s,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new n.Buf8(o.wsize)),i>=o.wsize?(n.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i<(s=o.wsize-o.wnext)&&(s=i),n.arraySet(o.window,t,r-i,s,o.wnext),(i-=s)?(n.arraySet(o.window,t,r-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=s))),0}r.inflateReset=d,r.inflateReset2=f,r.inflateResetKeep=h,r.inflateInit=function(e){return p(e,15)},r.inflateInit2=p,r.inflate=function(e,t){var r,c,h,d,f,p,m,_,g,b,x,w,A,E,T,S,k,O,R,C,N,P,M,D,z=0,I=new n.Buf8(4),F=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return l;12===(r=e.state).mode&&(r.mode=13),f=e.next_out,h=e.output,m=e.avail_out,d=e.next_in,c=e.input,p=e.avail_in,_=r.hold,g=r.bits,b=p,x=m,P=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;g<16;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(2&r.wrap&&35615===_){I[r.check=0]=255&_,I[1]=_>>>8&255,r.check=s(r.check,I,2,0),g=_=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&_)<<8)+(_>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&_)){e.msg="unknown compression method",r.mode=30;break}if(g-=4,N=8+(15&(_>>>=4)),0===r.wbits)r.wbits=N;else if(N>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<<N,e.adler=r.check=1,r.mode=512&_?10:12,g=_=0;break;case 2:for(;g<16;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(r.flags=_,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=_>>8&1),512&r.flags&&(I[0]=255&_,I[1]=_>>>8&255,r.check=s(r.check,I,2,0)),g=_=0,r.mode=3;case 3:for(;g<32;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}r.head&&(r.head.time=_),512&r.flags&&(I[0]=255&_,I[1]=_>>>8&255,I[2]=_>>>16&255,I[3]=_>>>24&255,r.check=s(r.check,I,4,0)),g=_=0,r.mode=4;case 4:for(;g<16;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}r.head&&(r.head.xflags=255&_,r.head.os=_>>8),512&r.flags&&(I[0]=255&_,I[1]=_>>>8&255,r.check=s(r.check,I,2,0)),g=_=0,r.mode=5;case 5:if(1024&r.flags){for(;g<16;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}r.length=_,r.head&&(r.head.extra_len=_),512&r.flags&&(I[0]=255&_,I[1]=_>>>8&255,r.check=s(r.check,I,2,0)),g=_=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(p<(w=r.length)&&(w=p),w&&(r.head&&(N=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),n.arraySet(r.head.extra,c,d,w,N)),512&r.flags&&(r.check=s(r.check,c,w,d)),p-=w,d+=w,r.length-=w),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===p)break e;for(w=0;N=c[d+w++],r.head&&N&&r.length<65536&&(r.head.name+=String.fromCharCode(N)),N&&w<p;);if(512&r.flags&&(r.check=s(r.check,c,w,d)),p-=w,d+=w,N)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===p)break e;for(w=0;N=c[d+w++],r.head&&N&&r.length<65536&&(r.head.comment+=String.fromCharCode(N)),N&&w<p;);if(512&r.flags&&(r.check=s(r.check,c,w,d)),p-=w,d+=w,N)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;g<16;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(_!==(65535&r.check)){e.msg="header crc mismatch",r.mode=30;break}g=_=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;g<32;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}e.adler=r.check=u(_),g=_=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=f,e.avail_out=m,e.next_in=d,e.avail_in=p,r.hold=_,r.bits=g,2;e.adler=r.check=1,r.mode=12;case 12:if(5===t||6===t)break e;case 13:if(r.last){_>>>=7&g,g-=7&g,r.mode=27;break}for(;g<3;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}switch(r.last=1&_,g-=1,3&(_>>>=1)){case 0:r.mode=14;break;case 1:if(y(r),r.mode=20,6!==t)break;_>>>=2,g-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}_>>>=2,g-=2;break;case 14:for(_>>>=7&g,g-=7&g;g<32;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if((65535&_)!=(_>>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&_,g=_=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(w=r.length){if(p<w&&(w=p),m<w&&(w=m),0===w)break e;n.arraySet(h,c,d,w,f),p-=w,d+=w,m-=w,f+=w,r.length-=w;break}r.mode=12;break;case 17:for(;g<14;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(r.nlen=257+(31&_),_>>>=5,g-=5,r.ndist=1+(31&_),_>>>=5,g-=5,r.ncode=4+(15&_),_>>>=4,g-=4,286<r.nlen||30<r.ndist){e.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;g<3;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}r.lens[F[r.have++]]=7&_,_>>>=3,g-=3}for(;r.have<19;)r.lens[F[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,M={bits:r.lenbits},P=a(0,r.lens,0,19,r.lencode,0,r.work,M),r.lenbits=M.bits,P){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;S=(z=r.lencode[_&(1<<r.lenbits)-1])>>>16&255,k=65535&z,!((T=z>>>24)<=g);){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(k<16)_>>>=T,g-=T,r.lens[r.have++]=k;else{if(16===k){for(D=T+2;g<D;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(_>>>=T,g-=T,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}N=r.lens[r.have-1],w=3+(3&_),_>>>=2,g-=2}else if(17===k){for(D=T+3;g<D;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}g-=T,N=0,w=3+(7&(_>>>=T)),_>>>=3,g-=3}else{for(D=T+7;g<D;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}g-=T,N=0,w=11+(127&(_>>>=T)),_>>>=7,g-=7}if(r.have+w>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;w--;)r.lens[r.have++]=N}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,M={bits:r.lenbits},P=a(1,r.lens,0,r.nlen,r.lencode,0,r.work,M),r.lenbits=M.bits,P){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,M={bits:r.distbits},P=a(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,M),r.distbits=M.bits,P){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=p&&258<=m){e.next_out=f,e.avail_out=m,e.next_in=d,e.avail_in=p,r.hold=_,r.bits=g,o(e,x),f=e.next_out,h=e.output,m=e.avail_out,d=e.next_in,c=e.input,p=e.avail_in,_=r.hold,g=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;S=(z=r.lencode[_&(1<<r.lenbits)-1])>>>16&255,k=65535&z,!((T=z>>>24)<=g);){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(S&&!(240&S)){for(O=T,R=S,C=k;S=(z=r.lencode[C+((_&(1<<O+R)-1)>>O)])>>>16&255,k=65535&z,!(O+(T=z>>>24)<=g);){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}_>>>=O,g-=O,r.back+=O}if(_>>>=T,g-=T,r.back+=T,r.length=k,0===S){r.mode=26;break}if(32&S){r.back=-1,r.mode=12;break}if(64&S){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&S,r.mode=22;case 22:if(r.extra){for(D=r.extra;g<D;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}r.length+=_&(1<<r.extra)-1,_>>>=r.extra,g-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;S=(z=r.distcode[_&(1<<r.distbits)-1])>>>16&255,k=65535&z,!((T=z>>>24)<=g);){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(!(240&S)){for(O=T,R=S,C=k;S=(z=r.distcode[C+((_&(1<<O+R)-1)>>O)])>>>16&255,k=65535&z,!(O+(T=z>>>24)<=g);){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}_>>>=O,g-=O,r.back+=O}if(_>>>=T,g-=T,r.back+=T,64&S){e.msg="invalid distance code",r.mode=30;break}r.offset=k,r.extra=15&S,r.mode=24;case 24:if(r.extra){for(D=r.extra;g<D;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}r.offset+=_&(1<<r.extra)-1,_>>>=r.extra,g-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===m)break e;if(w=x-m,r.offset>w){if((w=r.offset-w)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}A=w>r.wnext?(w-=r.wnext,r.wsize-w):r.wnext-w,w>r.length&&(w=r.length),E=r.window}else E=h,A=f-r.offset,w=r.length;for(m<w&&(w=m),m-=w,r.length-=w;h[f++]=E[A++],--w;);0===r.length&&(r.mode=21);break;case 26:if(0===m)break e;h[f++]=r.length,m--,r.mode=21;break;case 27:if(r.wrap){for(;g<32;){if(0===p)break e;p--,_|=c[d++]<<g,g+=8}if(x-=m,e.total_out+=x,r.total+=x,x&&(e.adler=r.check=r.flags?s(r.check,h,x,f-x):i(r.check,h,x,f-x)),x=m,(r.flags?_:u(_))!==r.check){e.msg="incorrect data check",r.mode=30;break}g=_=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;g<32;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(_!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=30;break}g=_=0}r.mode=29;case 29:P=1;break e;case 30:P=-3;break e;case 31:return-4;default:return l}return e.next_out=f,e.avail_out=m,e.next_in=d,e.avail_in=p,r.hold=_,r.bits=g,(r.wsize||x!==e.avail_out&&r.mode<30&&(r.mode<27||4!==t))&&v(e,e.output,e.next_out,x-e.avail_out)?(r.mode=31,-4):(b-=e.avail_in,x-=e.avail_out,e.total_in+=b,e.total_out+=x,r.total+=x,r.wrap&&x&&(e.adler=r.check=r.flags?s(r.check,h,x,e.next_out-x):i(r.check,h,x,e.next_out-x)),e.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0==b&&0===x||4===t)&&0===P&&(P=-5),P)},r.inflateEnd=function(e){if(!e||!e.state)return l;var t=e.state;return t.window&&(t.window=null),e.state=null,0},r.inflateGetHeader=function(e,t){var r;return e&&e.state&&2&(r=e.state).wrap?((r.head=t).done=!1,0):l},r.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?l:11===r.mode&&i(1,t,n,0)!==r.check?-3:v(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):l},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,r){var n=e("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],s=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],o=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,r,l,u,c,h,d){var f,p,m,_,g,y,v,b,x,w=d.bits,A=0,E=0,T=0,S=0,k=0,O=0,R=0,C=0,N=0,P=0,M=null,D=0,z=new n.Buf16(16),I=new n.Buf16(16),F=null,L=0;for(A=0;A<=15;A++)z[A]=0;for(E=0;E<l;E++)z[t[r+E]]++;for(k=w,S=15;1<=S&&0===z[S];S--);if(S<k&&(k=S),0===S)return u[c++]=20971520,u[c++]=20971520,d.bits=1,0;for(T=1;T<S&&0===z[T];T++);for(k<T&&(k=T),A=C=1;A<=15;A++)if(C<<=1,(C-=z[A])<0)return-1;if(0<C&&(0===e||1!==S))return-1;for(I[1]=0,A=1;A<15;A++)I[A+1]=I[A]+z[A];for(E=0;E<l;E++)0!==t[r+E]&&(h[I[t[r+E]]++]=E);if(y=0===e?(M=F=h,19):1===e?(M=i,D-=257,F=s,L-=257,256):(M=o,F=a,-1),A=T,g=c,R=E=P=0,m=-1,_=(N=1<<(O=k))-1,1===e&&852<N||2===e&&592<N)return 1;for(;;){for(v=A-R,x=h[E]<y?(b=0,h[E]):h[E]>y?(b=F[L+h[E]],M[D+h[E]]):(b=96,0),f=1<<A-R,T=p=1<<O;u[g+(P>>R)+(p-=f)]=v<<24|b<<16|x,0!==p;);for(f=1<<A-1;P&f;)f>>=1;if(0!==f?(P&=f-1,P+=f):P=0,E++,0==--z[A]){if(A===S)break;A=t[r+h[E]]}if(k<A&&(P&_)!==m){for(0===R&&(R=k),g+=T,C=1<<(O=A-R);O+R<S&&!((C-=z[O+R])<=0);)O++,C<<=1;if(N+=1<<O,1===e&&852<N||2===e&&592<N)return 1;u[m=P&_]=k<<24|O<<16|g-c}}return 0!==P&&(u[g+P]=A-R<<24|64<<16),d.bits=k,0}},{"../utils/common":41}],51:[function(e,t,r){t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,r){var n=e("../utils/common");function i(e){for(var t=e.length;0<=--t;)e[t]=0}var s=256,o=286,a=30,l=15,u=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],c=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],h=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],d=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],f=new Array(576);i(f);var p=new Array(60);i(p);var m=new Array(512);i(m);var _=new Array(256);i(_);var g=new Array(29);i(g);var y,v,b,x=new Array(a);function w(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function A(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function E(e){return e<256?m[e]:m[256+(e>>>7)]}function T(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function S(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,T(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function k(e,t,r){S(e,r[2*t],r[2*t+1])}function O(e,t){for(var r=0;r|=1&e,e>>>=1,r<<=1,0<--t;);return r>>>1}function R(e,t,r){var n,i,s=new Array(16),o=0;for(n=1;n<=l;n++)s[n]=o=o+r[n-1]<<1;for(i=0;i<=t;i++){var a=e[2*i+1];0!==a&&(e[2*i]=O(s[a]++,a))}}function C(e){var t;for(t=0;t<o;t++)e.dyn_ltree[2*t]=0;for(t=0;t<a;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function N(e){8<e.bi_valid?T(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function P(e,t,r,n){var i=2*t,s=2*r;return e[i]<e[s]||e[i]===e[s]&&n[t]<=n[r]}function M(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&P(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!P(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function D(e,t,r){var n,i,o,a,l=0;if(0!==e.last_lit)for(;n=e.pending_buf[e.d_buf+2*l]<<8|e.pending_buf[e.d_buf+2*l+1],i=e.pending_buf[e.l_buf+l],l++,0===n?k(e,i,t):(k(e,(o=_[i])+s+1,t),0!==(a=u[o])&&S(e,i-=g[o],a),k(e,o=E(--n),r),0!==(a=c[o])&&S(e,n-=x[o],a)),l<e.last_lit;);k(e,256,t)}function z(e,t){var r,n,i,s=t.dyn_tree,o=t.stat_desc.static_tree,a=t.stat_desc.has_stree,u=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<u;r++)0!==s[2*r]?(e.heap[++e.heap_len]=c=r,e.depth[r]=0):s[2*r+1]=0;for(;e.heap_len<2;)s[2*(i=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[i]=0,e.opt_len--,a&&(e.static_len-=o[2*i+1]);for(t.max_code=c,r=e.heap_len>>1;1<=r;r--)M(e,s,r);for(i=u;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],M(e,s,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,s[2*i]=s[2*r]+s[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,s[2*r+1]=s[2*n+1]=i,e.heap[1]=i++,M(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,s,o,a,u=t.dyn_tree,c=t.max_code,h=t.stat_desc.static_tree,d=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,m=t.stat_desc.max_length,_=0;for(s=0;s<=l;s++)e.bl_count[s]=0;for(u[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)m<(s=u[2*u[2*(n=e.heap[r])+1]+1]+1)&&(s=m,_++),u[2*n+1]=s,c<n||(e.bl_count[s]++,o=0,p<=n&&(o=f[n-p]),a=u[2*n],e.opt_len+=a*(s+o),d&&(e.static_len+=a*(h[2*n+1]+o)));if(0!==_){do{for(s=m-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[m]--,_-=2}while(0<_);for(s=m;0!==s;s--)for(n=e.bl_count[s];0!==n;)c<(i=e.heap[--r])||(u[2*i+1]!==s&&(e.opt_len+=(s-u[2*i+1])*u[2*i],u[2*i+1]=s),n--)}}(e,t),R(s,c,e.bl_count)}function I(e,t,r){var n,i,s=-1,o=t[1],a=0,l=7,u=4;for(0===o&&(l=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=o,o=t[2*(n+1)+1],++a<l&&i===o||(a<u?e.bl_tree[2*i]+=a:0!==i?(i!==s&&e.bl_tree[2*i]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=i,u=(a=0)===o?(l=138,3):i===o?(l=6,3):(l=7,4))}function F(e,t,r){var n,i,s=-1,o=t[1],a=0,l=7,u=4;for(0===o&&(l=138,u=3),n=0;n<=r;n++)if(i=o,o=t[2*(n+1)+1],!(++a<l&&i===o)){if(a<u)for(;k(e,i,e.bl_tree),0!=--a;);else 0!==i?(i!==s&&(k(e,i,e.bl_tree),a--),k(e,16,e.bl_tree),S(e,a-3,2)):a<=10?(k(e,17,e.bl_tree),S(e,a-3,3)):(k(e,18,e.bl_tree),S(e,a-11,7));s=i,u=(a=0)===o?(l=138,3):i===o?(l=6,3):(l=7,4)}}i(x);var L=!1;function j(e,t,r,i){S(e,0+(i?1:0),3),function(e,t,r){N(e),T(e,r),T(e,~r),n.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r)}r._tr_init=function(e){L||(function(){var e,t,r,n,i,s=new Array(16);for(n=r=0;n<28;n++)for(g[n]=r,e=0;e<1<<u[n];e++)_[r++]=n;for(_[r-1]=n,n=i=0;n<16;n++)for(x[n]=i,e=0;e<1<<c[n];e++)m[i++]=n;for(i>>=7;n<a;n++)for(x[n]=i<<7,e=0;e<1<<c[n]-7;e++)m[256+i++]=n;for(t=0;t<=l;t++)s[t]=0;for(e=0;e<=143;)f[2*e+1]=8,e++,s[8]++;for(;e<=255;)f[2*e+1]=9,e++,s[9]++;for(;e<=279;)f[2*e+1]=7,e++,s[7]++;for(;e<=287;)f[2*e+1]=8,e++,s[8]++;for(R(f,287,s),e=0;e<a;e++)p[2*e+1]=5,p[2*e]=O(e,5);y=new w(f,u,257,o,l),v=new w(p,c,0,a,l),b=new w(new Array(0),h,0,19,7)}(),L=!0),e.l_desc=new A(e.dyn_ltree,y),e.d_desc=new A(e.dyn_dtree,v),e.bl_desc=new A(e.bl_tree,b),e.bi_buf=0,e.bi_valid=0,C(e)},r._tr_stored_block=j,r._tr_flush_block=function(e,t,r,n){var i,o,a=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<s;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),z(e,e.l_desc),z(e,e.d_desc),a=function(e){var t;for(I(e,e.dyn_ltree,e.l_desc.max_code),I(e,e.dyn_dtree,e.d_desc.max_code),z(e,e.bl_desc),t=18;3<=t&&0===e.bl_tree[2*d[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?j(e,t,r,n):4===e.strategy||o===i?(S(e,2+(n?1:0),3),D(e,f,p)):(S(e,4+(n?1:0),3),function(e,t,r,n){var i;for(S(e,t-257,5),S(e,r-1,5),S(e,n-4,4),i=0;i<n;i++)S(e,e.bl_tree[2*d[i]+1],3);F(e,e.dyn_ltree,t-1),F(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),D(e,e.dyn_ltree,e.dyn_dtree)),C(e),n&&N(e)},r._tr_tally=function(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(_[r]+s+1)]++,e.dyn_dtree[2*E(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){S(e,2,3),k(e,256,f),function(e){16===e.bi_valid?(T(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,r){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){(function(e){!function(e){if(!e.setImmediate){var t,r,n,i,s=1,o={},a=!1,l=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,t="[object process]"==={}.toString.call(e.process)?function(e){!function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];be.push(new Te(e,t)),1!==be.length||xe||ye(Ee)}(function(){h(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?(i="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",d,!1):e.attachEvent("onmessage",d),function(t){e.postMessage(i+t,"*")}):e.MessageChannel?((n=new MessageChannel).port1.onmessage=function(e){h(e.data)},function(e){n.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(r=l.documentElement,function(e){var t=l.createElement("script");t.onreadystatechange=function(){h(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):function(e){setTimeout(h,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var r=new Array(arguments.length-1),n=0;n<r.length;n++)r[n]=arguments[n+1];var i={callback:e,args:r};return o[s]=i,t(s),s++},u.clearImmediate=c}function c(e){delete o[e]}function h(e){if(a)setTimeout(h,0,e);else{var t=o[e];if(t){a=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(undefined,r)}}(t)}finally{c(e),a=!1}}}}function d(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(i)&&h(+t.data.slice(i.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,void 0!==f?f:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)),lt.exports),ct=e.getDefaultExportFromCjs(ut),ht={},dt={},ft={};function pt(){if(Re)return ft;function e(e){return null==e}return Re=1,ft.isNothing=e,ft.isObject=function(e){return"object"==typeof e&&null!==e},ft.toArray=function(t){return Array.isArray(t)?t:e(t)?[]:[t]},ft.repeat=function(e,t){var r,n="";for(r=0;r<t;r+=1)n+=e;return n},ft.isNegativeZero=function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},ft.extend=function(e,t){var r,n,i,s;if(t)for(r=0,n=(s=Object.keys(t)).length;r<n;r+=1)e[i=s[r]]=t[i];return e},ft}function mt(){if(Ne)return Ce;function e(e,t){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||"",this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():"")}return Ne=1,e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t},Ce=e}function _t(){if(ze)return De;ze=1;var e=mt(),t=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],r=["scalar","sequence","mapping"];return De=function(n,i){if(i=i||{},Object.keys(i).forEach(function(r){if(-1===t.indexOf(r))throw new e('Unknown option "'+r+'" is met in definition of "'+n+'" YAML type.')}),this.tag=n,this.kind=i.kind||null,this.resolve=i.resolve||function(){return!0},this.construct=i.construct||function(e){return e},this.instanceOf=i.instanceOf||null,this.predicate=i.predicate||null,this.represent=i.represent||null,this.defaultStyle=i.defaultStyle||null,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach(function(r){e[r].forEach(function(e){t[String(e)]=r})}),t}(i.styleAliases||null),-1===r.indexOf(this.kind))throw new e('Unknown kind "'+this.kind+'" is specified for "'+n+'" YAML type.')},De}function gt(){if(Fe)return Ie;Fe=1;var e=pt(),t=mt(),r=_t();function n(e,t,r){var i=[];return e.include.forEach(function(e){r=n(e,t,r)}),e[t].forEach(function(e){r.forEach(function(t,r){t.tag===e.tag&&i.push(r)}),r.push(e)}),r.filter(function(e,t){return-1===i.indexOf(t)})}function i(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new t("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=n(this,"implicit",[]),this.compiledExplicit=n(this,"explicit",[]),this.compiledTypeMap=function(){var e,t,r={};function n(e){r[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(n);return r}(this.compiledImplicit,this.compiledExplicit)}return i.DEFAULT=null,i.create=function(){var n,s;switch(arguments.length){case 1:n=i.DEFAULT,s=arguments[0];break;case 2:n=arguments[0],s=arguments[1];break;default:throw new t("Wrong number of arguments for Schema.create function")}if(n=e.toArray(n),s=e.toArray(s),!n.every(function(e){return e instanceof i}))throw new t("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!s.every(function(e){return e instanceof r}))throw new t("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new i({include:n,explicit:s})},Ie=i}function yt(){if(je)return Le;je=1;var e=_t();return Le=new e("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})}function vt(){if(Be)return Ue;Be=1;var e=_t();return Ue=new e("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})}function bt(){if(Ge)return Ve;Ge=1;var e=_t();return Ve=new e("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})}function xt(){if(qe)return $e;qe=1;var e=gt();return $e=new e({explicit:[yt(),vt(),bt()]})}function wt(){if(He)return We;He=1;var e=_t();return We=new e("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})}function At(){if(Ke)return Ze;Ke=1;var e=_t();return Ze=new e("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})}function Et(){if(Ye)return Xe;Ye=1;var e=pt(),t=_t();function r(e){return 48<=e&&e<=55}function n(e){return 48<=e&&e<=57}return Xe=new t("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,i,s=e.length,o=0,a=!1;if(!s)return!1;if("-"!==(t=e[o])&&"+"!==t||(t=e[++o]),"0"===t){if(o+1===s)return!0;if("b"===(t=e[++o])){for(o++;o<s;o++)if("_"!==(t=e[o])){if("0"!==t&&"1"!==t)return!1;a=!0}return a}if("x"===t){for(o++;o<s;o++)if("_"!==(t=e[o])){if(!(48<=(i=e.charCodeAt(o))&&i<=57||65<=i&&i<=70||97<=i&&i<=102))return!1;a=!0}return a}for(;o<s;o++)if("_"!==(t=e[o])){if(!r(e.charCodeAt(o)))return!1;a=!0}return a}for(;o<s;o++)if("_"!==(t=e[o])){if(":"===t)break;if(!n(e.charCodeAt(o)))return!1;a=!0}return!!a&&(":"!==t||/^(:[0-5]?[0-9])+$/.test(e.slice(o)))},construct:function(e){var t,r,n=e,i=1,s=[];return-1!==n.indexOf("_")&&(n=n.replace(/_/g,"")),"-"!==(t=n[0])&&"+"!==t||("-"===t&&(i=-1),t=(n=n.slice(1))[0]),"0"===n?0:"0"===t?"b"===n[1]?i*parseInt(n.slice(2),2):"x"===n[1]?i*parseInt(n,16):i*parseInt(n,8):-1!==n.indexOf(":")?(n.split(":").forEach(function(e){s.unshift(parseInt(e,10))}),n=0,r=1,s.forEach(function(e){n+=e*r,r*=60}),i*n):i*parseInt(n,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&t%1==0&&!e.isNegativeZero(t)},represent:{binary:function(e){return"0b"+e.toString(2)},octal:function(e){return"0"+e.toString(8)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return"0x"+e.toString(16).toUpperCase()}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Xe}function Tt(){if(Je)return Qe;Je=1;var e=pt(),t=_t(),r=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?|\\.[0-9_]+(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),n=/^[-+]?[0-9]+e/;return Qe=new t("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!!r.test(e)},construct:function(e){var t,r,n,i;return r="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,i=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===r?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach(function(e){i.unshift(parseFloat(e,10))}),t=0,n=1,i.forEach(function(e){t+=e*n,n*=60}),r*t):r*parseFloat(t,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||e.isNegativeZero(t))},represent:function(t,r){var i;if(isNaN(t))switch(r){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(r){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(r){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(e.isNegativeZero(t))return"-0.0";return i=t.toString(10),n.test(i)?i.replace("e",".e"):i},defaultStyle:"lowercase"})}function St(){if(tt)return et;tt=1;var e=gt();return et=new e({include:[xt()],implicit:[wt(),At(),Et(),Tt()]})}function kt(){if(nt)return rt;nt=1;var e=gt();return rt=new e({include:[St()]})}function Ot(){if(st)return it;st=1;var e=_t(),t=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?)?$");return it=new e("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&null!==t.exec(e)},construct:function(e){var r,n,i,s,o,a,l,u,c=0,h=null;if(null===(r=t.exec(e)))throw new Error("Date resolve error");if(n=+r[1],i=+r[2]-1,s=+r[3],!r[4])return new Date(Date.UTC(n,i,s));if(o=+r[4],a=+r[5],l=+r[6],r[7]){for(c=r[7].slice(0,3);c.length<3;)c+="0";c=+c}return r[9]&&(h=6e4*(60*+r[10]+ +(r[11]||0)),"-"===r[9]&&(h=-h)),u=new Date(Date.UTC(n,i,s,o,a,l,c)),h&&u.setTime(u.getTime()-h),u},instanceOf:Date,represent:function(e){return e.toISOString()}})}function Rt(){if(at)return ot;at=1;var e=_t();return ot=new e("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})}var Ct,Nt,Pt,Mt,Dt,zt,It,Ft,Lt,jt,Ut,Bt,Vt,Gt,$t,qt,Wt,Ht,Zt,Kt,Xt,Yt,Qt=e.getAugmentedNamespace(fe);function Jt(){if(Nt)return Ct;Nt=1;var e=Qt.Buffer,t=_t(),r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";return Ct=new t("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i=0,s=e.length,o=r;for(n=0;n<s;n++)if(!((t=o.indexOf(e.charAt(n)))>64)){if(t<0)return!1;i+=6}return i%8==0},construct:function(t){var n,i,s=t.replace(/[\r\n=]/g,""),o=s.length,a=r,l=0,u=[];for(n=0;n<o;n++)n%4==0&&n&&(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)),l=l<<6|a.indexOf(s.charAt(n));return 0==(i=o%4*6)?(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)):18===i?(u.push(l>>10&255),u.push(l>>2&255)):12===i&&u.push(l>>4&255),e?new e(u):u},predicate:function(t){return e&&e.isBuffer(t)},represent:function(e){var t,n,i="",s=0,o=e.length,a=r;for(t=0;t<o;t++)t%3==0&&t&&(i+=a[s>>18&63],i+=a[s>>12&63],i+=a[s>>6&63],i+=a[63&s]),s=(s<<8)+e[t];return 0==(n=o%3)?(i+=a[s>>18&63],i+=a[s>>12&63],i+=a[s>>6&63],i+=a[63&s]):2===n?(i+=a[s>>10&63],i+=a[s>>4&63],i+=a[s<<2&63],i+=a[64]):1===n&&(i+=a[s>>2&63],i+=a[s<<4&63],i+=a[64],i+=a[64]),i}}),Ct}function er(){if(Mt)return Pt;Mt=1;var e=_t(),t=Object.prototype.hasOwnProperty,r=Object.prototype.toString;return Pt=new e("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var n,i,s,o,a,l=[],u=e;for(n=0,i=u.length;n<i;n+=1){if(s=u[n],a=!1,"[object Object]"!==r.call(s))return!1;for(o in s)if(t.call(s,o)){if(a)return!1;a=!0}if(!a)return!1;if(-1!==l.indexOf(o))return!1;l.push(o)}return!0},construct:function(e){return null!==e?e:[]}}),Pt}function tr(){if(zt)return Dt;zt=1;var e=_t(),t=Object.prototype.toString;return Dt=new e("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var r,n,i,s,o,a=e;for(o=new Array(a.length),r=0,n=a.length;r<n;r+=1){if(i=a[r],"[object Object]"!==t.call(i))return!1;if(1!==(s=Object.keys(i)).length)return!1;o[r]=[s[0],i[s[0]]]}return!0},construct:function(e){if(null===e)return[];var t,r,n,i,s,o=e;for(s=new Array(o.length),t=0,r=o.length;t<r;t+=1)n=o[t],i=Object.keys(n),s[t]=[i[0],n[i[0]]];return s}}),Dt}function rr(){if(Ft)return It;Ft=1;var e=_t(),t=Object.prototype.hasOwnProperty;return It=new e("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var r,n=e;for(r in n)if(t.call(n,r)&&null!==n[r])return!1;return!0},construct:function(e){return null!==e?e:{}}})}function nr(){if(jt)return Lt;jt=1;var e=gt();return Lt=new e({include:[kt()],implicit:[Ot(),Rt()],explicit:[Jt(),er(),tr(),rr()]})}function ir(){if(Bt)return Ut;Bt=1;var e=_t();return Ut=new e("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:function(){return!0},construct:function(){},predicate:function(e){return void 0===e},represent:function(){return""}})}function sr(){if(Gt)return Vt;Gt=1;var e=_t();return Vt=new e("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:function(e){if(null===e)return!1;if(0===e.length)return!1;var t=e,r=/\/([gim]*)$/.exec(e),n="";if("/"===t[0]){if(r&&(n=r[1]),n.length>3)return!1;if("/"!==t[t.length-n.length-1])return!1}return!0},construct:function(e){var t=e,r=/\/([gim]*)$/.exec(e),n="";return"/"===t[0]&&(r&&(n=r[1]),t=t.slice(1,t.length-n.length-1)),new RegExp(t,n)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})}function or(){if(qt)return $t;var e;qt=1;try{e=ke("esprima")}catch(t){"undefined"!=typeof window&&(e=window.esprima)}var t=_t();return $t=new t("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(t){if(null===t)return!1;try{var r="("+t+")",n=e.parse(r,{range:!0});return"Program"===n.type&&1===n.body.length&&"ExpressionStatement"===n.body[0].type&&"FunctionExpression"===n.body[0].expression.type}catch(e){return!1}},construct:function(t){var r,n="("+t+")",i=e.parse(n,{range:!0}),s=[];if("Program"!==i.type||1!==i.body.length||"ExpressionStatement"!==i.body[0].type||"FunctionExpression"!==i.body[0].expression.type)throw new Error("Failed to resolve function");return i.body[0].expression.params.forEach(function(e){s.push(e.name)}),r=i.body[0].expression.body.range,new Function(s,n.slice(r[0]+1,r[1]-1))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})}function ar(){if(Ht)return Wt;Ht=1;var e=gt();return Wt=e.DEFAULT=new e({include:[nr()],explicit:[ir(),sr(),or()]})}var lr=function(){if(Yt)return Xt;Yt=1;var e=function(){if(Kt)return ht;Kt=1;var e=function(){if(Zt)return dt;Zt=1;var e=pt(),t=mt(),r=function(){if(Me)return Pe;Me=1;var e=pt();function t(e,t,r,n,i){this.name=e,this.buffer=t,this.position=r,this.line=n,this.column=i}return t.prototype.getSnippet=function(t,r){var n,i,s,o,a;if(!this.buffer)return null;for(t=t||4,r=r||75,n="",i=this.position;i>0&&-1==="\0\r\n
\u2028\u2029".indexOf(this.buffer.charAt(i-1));)if(i-=1,this.position-i>r/2-1){n=" ... ",i+=5;break}for(s="",o=this.position;o<this.buffer.length&&-1==="\0\r\n
\u2028\u2029".indexOf(this.buffer.charAt(o));)if((o+=1)-this.position>r/2-1){s=" ... ",o-=5;break}return a=this.buffer.slice(i,o),e.repeat(" ",t)+n+a+s+"\n"+e.repeat(" ",t+this.position-i+n.length)+"^"},t.prototype.toString=function(e){var t,r="";return this.name&&(r+='in "'+this.name+'" '),r+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(r+=":\n"+t),r},Pe=t}(),n=nr(),i=ar(),s=Object.prototype.hasOwnProperty,o=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,a=/[\x85\u2028\u2029]/,l=/[,\[\]\{\}]/,u=/^(?:!|!!|![a-z\-]+!)$/i,c=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function h(e){return 10===e||13===e}function d(e){return 9===e||32===e}function f(e){return 9===e||32===e||10===e||13===e}function p(e){return 44===e||91===e||93===e||123===e||125===e}function m(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function _(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"
":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function g(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var y=new Array(256),v=new Array(256),b=0;b<256;b++)y[b]=_(b)?1:0,v[b]=_(b);function x(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||i,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function w(e,n){return new t(n,new r(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function A(e,t){throw w(e,t)}function E(e,t){e.onWarning&&e.onWarning.call(null,w(e,t))}var T={YAML:function(e,t,r){var n,i,s;null!==e.version&&A(e,"duplication of %YAML directive"),1!==r.length&&A(e,"YAML directive accepts exactly one argument"),null===(n=/^([0-9]+)\.([0-9]+)$/.exec(r[0]))&&A(e,"ill-formed argument of the YAML directive"),i=parseInt(n[1],10),s=parseInt(n[2],10),1!==i&&A(e,"unacceptable YAML version of the document"),e.version=r[0],e.checkLineBreaks=s<2,1!==s&&2!==s&&E(e,"unsupported YAML version of the document")},TAG:function(e,t,r){var n,i;2!==r.length&&A(e,"TAG directive accepts exactly two arguments"),n=r[0],i=r[1],u.test(n)||A(e,"ill-formed tag handle (first argument) of the TAG directive"),s.call(e.tagMap,n)&&A(e,'there is a previously declared suffix for "'+n+'" tag handle'),c.test(i)||A(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[n]=i}};function S(e,t,r,n){var i,s,a,l;if(t<r){if(l=e.input.slice(t,r),n)for(i=0,s=l.length;i<s;i+=1)9===(a=l.charCodeAt(i))||32<=a&&a<=1114111||A(e,"expected valid JSON character");else o.test(l)&&A(e,"the stream contains non-printable characters");e.result+=l}}function k(t,r,n,i){var o,a,l,u;for(e.isObject(n)||A(t,"cannot merge mappings; the provided source object is unacceptable"),l=0,u=(o=Object.keys(n)).length;l<u;l+=1)a=o[l],s.call(r,a)||(r[a]=n[a],i[a]=!0)}function O(e,t,r,n,i,o){var a,l;if(i=String(i),null===t&&(t={}),"tag:yaml.org,2002:merge"===n)if(Array.isArray(o))for(a=0,l=o.length;a<l;a+=1)k(e,t,o[a],r);else k(e,t,o,r);else e.json||s.call(r,i)||!s.call(t,i)||A(e,"duplicated mapping key"),t[i]=o,delete r[i];return t}function R(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):A(e,"a line break is expected"),e.line+=1,e.lineStart=e.position}function C(e,t,r){for(var n=0,i=e.input.charCodeAt(e.position);0!==i;){for(;d(i);)i=e.input.charCodeAt(++e.position);if(t&&35===i)do{i=e.input.charCodeAt(++e.position)}while(10!==i&&13!==i&&0!==i);if(!h(i))break;for(R(e),i=e.input.charCodeAt(e.position),n++,e.lineIndent=0;32===i;)e.lineIndent++,i=e.input.charCodeAt(++e.position)}return-1!==r&&0!==n&&e.lineIndent<r&&E(e,"deficient indentation"),n}function N(e){var t,r=e.position;return!(45!==(t=e.input.charCodeAt(r))&&46!==t||t!==e.input.charCodeAt(r+1)||t!==e.input.charCodeAt(r+2)||(r+=3,0!==(t=e.input.charCodeAt(r))&&!f(t)))}function P(t,r){1===r?t.result+=" ":r>1&&(t.result+=e.repeat("\n",r-1))}function M(e,t){var r,n,i=e.tag,s=e.anchor,o=[],a=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),n=e.input.charCodeAt(e.position);0!==n&&45===n&&f(e.input.charCodeAt(e.position+1));)if(a=!0,e.position++,C(e,!0,-1)&&e.lineIndent<=t)o.push(null),n=e.input.charCodeAt(e.position);else if(r=e.line,I(e,t,3,!1,!0),o.push(e.result),C(e,!0,-1),n=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&0!==n)A(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!a&&(e.tag=i,e.anchor=s,e.kind="sequence",e.result=o,!0)}function D(e){var t,r,n,i,o=!1,a=!1;if(33!==(i=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&A(e,"duplication of a tag property"),60===(i=e.input.charCodeAt(++e.position))?(o=!0,i=e.input.charCodeAt(++e.position)):33===i?(a=!0,r="!!",i=e.input.charCodeAt(++e.position)):r="!",t=e.position,o){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&62!==i);e.position<e.length?(n=e.input.slice(t,e.position),i=e.input.charCodeAt(++e.position)):A(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==i&&!f(i);)33===i&&(a?A(e,"tag suffix cannot contain exclamation marks"):(r=e.input.slice(t-1,e.position+1),u.test(r)||A(e,"named tag handle cannot contain such characters"),a=!0,t=e.position+1)),i=e.input.charCodeAt(++e.position);n=e.input.slice(t,e.position),l.test(n)&&A(e,"tag suffix cannot contain flow indicator characters")}return n&&!c.test(n)&&A(e,"tag name cannot contain such characters: "+n),o?e.tag=n:s.call(e.tagMap,r)?e.tag=e.tagMap[r]+n:"!"===r?e.tag="!"+n:"!!"===r?e.tag="tag:yaml.org,2002:"+n:A(e,'undeclared tag handle "'+r+'"'),!0}function z(e){var t,r;if(38!==(r=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&A(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!f(r)&&!p(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&A(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function I(t,r,n,i,o){var a,l,u,c,_,b,x,w,E=1,T=!1,k=!1;if(null!==t.listener&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,a=l=u=4===n||3===n,i&&C(t,!0,-1)&&(T=!0,t.lineIndent>r?E=1:t.lineIndent===r?E=0:t.lineIndent<r&&(E=-1)),1===E)for(;D(t)||z(t);)C(t,!0,-1)?(T=!0,u=a,t.lineIndent>r?E=1:t.lineIndent===r?E=0:t.lineIndent<r&&(E=-1)):u=!1;if(u&&(u=T||o),1!==E&&4!==n||(x=1===n||2===n?r:r+1,w=t.position-t.lineStart,1===E?u&&(M(t,w)||function(e,t,r){var n,i,s,o,a=e.tag,l=e.anchor,u={},c={},h=null,p=null,m=null,_=!1,g=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=u),o=e.input.charCodeAt(e.position);0!==o;){if(n=e.input.charCodeAt(e.position+1),s=e.line,63!==o&&58!==o||!f(n)){if(!I(e,r,2,!1,!0))break;if(e.line===s){for(o=e.input.charCodeAt(e.position);d(o);)o=e.input.charCodeAt(++e.position);if(58===o)f(o=e.input.charCodeAt(++e.position))||A(e,"a whitespace character is expected after the key-value separator within a block mapping"),_&&(O(e,u,c,h,p,null),h=p=m=null),g=!0,_=!1,i=!1,h=e.tag,p=e.result;else{if(!g)return e.tag=a,e.anchor=l,!0;A(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!g)return e.tag=a,e.anchor=l,!0;A(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===o?(_&&(O(e,u,c,h,p,null),h=p=m=null),g=!0,_=!0,i=!0):_?(_=!1,i=!0):A(e,"incomplete explicit mapping pair; a key node is missed"),e.position+=1,o=n;if((e.line===s||e.lineIndent>t)&&(I(e,t,4,!0,i)&&(_?p=e.result:m=e.result),_||(O(e,u,c,h,p,m),h=p=m=null),C(e,!0,-1),o=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==o)A(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return _&&O(e,u,c,h,p,null),g&&(e.tag=a,e.anchor=l,e.kind="mapping",e.result=u),g}(t,w,x))||function(e,t){var r,n,i,s,o,a,l,u,c,h,d=!0,p=e.tag,m=e.anchor,_={};if(91===(h=e.input.charCodeAt(e.position)))i=93,a=!1,n=[];else{if(123!==h)return!1;i=125,a=!0,n={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=n),h=e.input.charCodeAt(++e.position);0!==h;){if(C(e,!0,t),(h=e.input.charCodeAt(e.position))===i)return e.position++,e.tag=p,e.anchor=m,e.kind=a?"mapping":"sequence",e.result=n,!0;d||A(e,"missed comma between flow collection entries"),c=null,s=o=!1,63===h&&f(e.input.charCodeAt(e.position+1))&&(s=o=!0,e.position++,C(e,!0,t)),r=e.line,I(e,t,1,!1,!0),u=e.tag,l=e.result,C(e,!0,t),h=e.input.charCodeAt(e.position),!o&&e.line!==r||58!==h||(s=!0,h=e.input.charCodeAt(++e.position),C(e,!0,t),I(e,t,1,!1,!0),c=e.result),a?O(e,n,_,u,l,c):s?n.push(O(e,null,_,u,l,c)):n.push(l),C(e,!0,t),44===(h=e.input.charCodeAt(e.position))?(d=!0,h=e.input.charCodeAt(++e.position)):d=!1}A(e,"unexpected end of the stream within a flow collection")}(t,x)?k=!0:(l&&function(t,r){var n,i,s,o,a,l=1,u=!1,c=r,f=0,p=!1;if(124===(o=t.input.charCodeAt(t.position)))i=!1;else{if(62!==o)return!1;i=!0}for(t.kind="scalar",t.result="";0!==o;)if(43===(o=t.input.charCodeAt(++t.position))||45===o)1===l?l=43===o?3:2:A(t,"repeat of a chomping mode identifier");else{if(!((s=48<=(a=o)&&a<=57?a-48:-1)>=0))break;0===s?A(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?A(t,"repeat of an indentation width identifier"):(c=r+s-1,u=!0)}if(d(o)){do{o=t.input.charCodeAt(++t.position)}while(d(o));if(35===o)do{o=t.input.charCodeAt(++t.position)}while(!h(o)&&0!==o)}for(;0!==o;){for(R(t),t.lineIndent=0,o=t.input.charCodeAt(t.position);(!u||t.lineIndent<c)&&32===o;)t.lineIndent++,o=t.input.charCodeAt(++t.position);if(!u&&t.lineIndent>c&&(c=t.lineIndent),h(o))f++;else{if(t.lineIndent<c){3===l?t.result+=e.repeat("\n",f):1===l&&u&&(t.result+="\n");break}for(i?d(o)?(p=!0,t.result+=e.repeat("\n",f+1)):p?(p=!1,t.result+=e.repeat("\n",f+1)):0===f?u&&(t.result+=" "):t.result+=e.repeat("\n",f):t.result+=u?e.repeat("\n",f+1):e.repeat("\n",f),u=!0,f=0,n=t.position;!h(o)&&0!==o;)o=t.input.charCodeAt(++t.position);S(t,n,t.position,!1)}}return!0}(t,x)||function(e,t){var r,n,i;if(39!==(r=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;0!==(r=e.input.charCodeAt(e.position));)if(39===r){if(S(e,n,e.position,!0),39!==(r=e.input.charCodeAt(++e.position)))return!0;n=i=e.position,e.position++}else h(r)?(S(e,n,i,!0),P(e,C(e,!1,t)),n=i=e.position):e.position===e.lineStart&&N(e)?A(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);A(e,"unexpected end of the stream within a single quoted scalar")}(t,x)||function(e,t){var r,n,i,s,o,a,l;if(34!==(a=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;0!==(a=e.input.charCodeAt(e.position));){if(34===a)return S(e,r,e.position,!0),e.position++,!0;if(92===a){if(S(e,r,e.position,!0),h(a=e.input.charCodeAt(++e.position)))C(e,!1,t);else if(a<256&&y[a])e.result+=v[a],e.position++;else if((o=120===(l=a)?2:117===l?4:85===l?8:0)>0){for(i=o,s=0;i>0;i--)(o=m(a=e.input.charCodeAt(++e.position)))>=0?s=(s<<4)+o:A(e,"expected hexadecimal character");e.result+=g(s),e.position++}else A(e,"unknown escape sequence");r=n=e.position}else h(a)?(S(e,r,n,!0),P(e,C(e,!1,t)),r=n=e.position):e.position===e.lineStart&&N(e)?A(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}A(e,"unexpected end of the stream within a double quoted scalar")}(t,x)?k=!0:function(e){var t,r,n;if(42!==(n=e.input.charCodeAt(e.position)))return!1;for(n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!f(n)&&!p(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&A(e,"name of an alias node must contain at least one character"),r=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(r)||A(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],C(e,!0,-1),!0}(t)?(k=!0,null===t.tag&&null===t.anchor||A(t,"alias node should not have any properties")):function(e,t,r){var n,i,s,o,a,l,u,c,m=e.kind,_=e.result;if(f(c=e.input.charCodeAt(e.position))||p(c)||35===c||38===c||42===c||33===c||124===c||62===c||39===c||34===c||37===c||64===c||96===c)return!1;if((63===c||45===c)&&(f(n=e.input.charCodeAt(e.position+1))||r&&p(n)))return!1;for(e.kind="scalar",e.result="",i=s=e.position,o=!1;0!==c;){if(58===c){if(f(n=e.input.charCodeAt(e.position+1))||r&&p(n))break}else if(35===c){if(f(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&N(e)||r&&p(c))break;if(h(c)){if(a=e.line,l=e.lineStart,u=e.lineIndent,C(e,!1,-1),e.lineIndent>=t){o=!0,c=e.input.charCodeAt(e.position);continue}e.position=s,e.line=a,e.lineStart=l,e.lineIndent=u;break}}o&&(S(e,i,s,!1),P(e,e.line-a),i=s=e.position,o=!1),d(c)||(s=e.position+1),c=e.input.charCodeAt(++e.position)}return S(e,i,s,!1),!!e.result||(e.kind=m,e.result=_,!1)}(t,x,1===n)&&(k=!0,null===t.tag&&(t.tag="?")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===E&&(k=u&&M(t,w))),null!==t.tag&&"!"!==t.tag)if("?"===t.tag){for(c=0,_=t.implicitTypes.length;c<_;c+=1)if((b=t.implicitTypes[c]).resolve(t.result)){t.result=b.construct(t.result),t.tag=b.tag,null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);break}}else s.call(t.typeMap,t.tag)?(b=t.typeMap[t.tag],null!==t.result&&b.kind!==t.kind&&A(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+b.kind+'", not "'+t.kind+'"'),b.resolve(t.result)?(t.result=b.construct(t.result),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):A(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")):A(t,"unknown tag !<"+t.tag+">");return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||k}function F(e){var t,r,n,i,o=e.position,l=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(i=e.input.charCodeAt(e.position))&&(C(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(l=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!f(i);)i=e.input.charCodeAt(++e.position);for(n=[],(r=e.input.slice(t,e.position)).length<1&&A(e,"directive name must not be less than one character in length");0!==i;){for(;d(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!h(i));break}if(h(i))break;for(t=e.position;0!==i&&!f(i);)i=e.input.charCodeAt(++e.position);n.push(e.input.slice(t,e.position))}0!==i&&R(e),s.call(T,r)?T[r](e,r,n):E(e,'unknown document directive "'+r+'"')}C(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,C(e,!0,-1)):l&&A(e,"directives end mark is expected"),I(e,e.lineIndent-1,4,!1,!0),C(e,!0,-1),e.checkLineBreaks&&a.test(e.input.slice(o,e.position))&&E(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&N(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,C(e,!0,-1)):e.position<e.length-1&&A(e,"end of the stream or a document separator is expected")}function L(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var r=new x(e,t);for(r.input+="\0";32===r.input.charCodeAt(r.position);)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)F(r);return r.documents}function j(e,t,r){var n,i,s=L(e,r);for(n=0,i=s.length;n<i;n+=1)t(s[n])}function U(e,r){var n=L(e,r);if(0!==n.length){if(1===n.length)return n[0];throw new t("expected a single document in the stream, but found more")}}return dt.loadAll=j,dt.load=U,dt.safeLoadAll=function(t,r,i){j(t,r,e.extend({schema:n},i))},dt.safeLoad=function(t,r){return U(t,e.extend({schema:n},r))},dt}();function t(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}return ht.Type=_t(),ht.Schema=gt(),ht.FAILSAFE_SCHEMA=xt(),ht.JSON_SCHEMA=St(),ht.CORE_SCHEMA=kt(),ht.DEFAULT_SAFE_SCHEMA=nr(),ht.DEFAULT_FULL_SCHEMA=ar(),ht.load=e.load,ht.loadAll=e.loadAll,ht.safeLoad=e.safeLoad,ht.safeLoadAll=e.safeLoadAll,ht.YAMLException=mt(),ht.MINIMAL_SCHEMA=xt(),ht.SAFE_SCHEMA=nr(),ht.DEFAULT_SCHEMA=ar(),ht.scan=t("scan"),ht.parse=t("parse"),ht.compose=t("compose"),ht.addConstructor=t("addConstructor"),ht}();return Xt=e}(),ur=e.getDefaultExportFromCjs(lr);class cr{constructor(t,r,n=null){this.url=t,!r||e.isRelativeURL(r)&&!e.isRelativeURL(this.url)?this.path=e.pathForURL(this.url):this.path=r,this.path_for_parent=r||this.path,this.parent=n,this.container=null,this.parent&&(this.parent.container?this.container=this.parent.container:this.parent.isContainer()&&(this.container=this.parent))}load(){return dr(this.url)}resourceFor(e){return{url:this.urlFor(e),path:this.pathFor(e),type:this.typeFor(e)}}urlFor(t){return u(t)?t:e.isRelativeURL(t)&&this.container?this.parent.urlFor(this.path_for_parent+t):e.addBaseURL(t,this.path)}pathFor(t){return e.pathForURL(t)}typeFor(t){return e.extensionForURL(t)}isContainer(){return!1}}class hr extends cr{constructor(e,t,r){super(e,t,r),this.zip=null,this.files={},this.root=null,this.path=""}isContainer(){return!0}async load(){if(this.zip=new ct,"string"==typeof this.url){const{body:t}=await e.Utils.io(this.url,6e4,"arraybuffer");return await this.zip.loadAsync(t),await this.parseZipFiles(),this.loadRoot()}return this}urlFor(t){return u(t)?t:e.isRelativeURL(t)?this.urlForZipFile(e.flattenRelativeURL(t)):super.urlFor(t)}typeFor(t){return e.isRelativeURL(t)?this.typeForZipFile(t):super.typeFor(t)}loadRoot(){return this.findRoot(),dr(this.urlForZipFile(this.root))}findRoot(){const t=Object.keys(this.files).filter(e=>0===this.files[e].depth).filter(t=>"yaml"===e.extensionForURL(t));if(1===t.length&&(this.root=t[0]),!this.root){let e=`Could not find root scene for bundle '${this.url}': `;throw e+="The zip archive's root level must contain a single scene file with the '.yaml' extension. ",t.length>0?e+=`Found multiple YAML files at the root level: ${t.map(e=>"'"+e+"'").join(", ")}.`:e+="Found NO YAML files at the root level.",Error(e)}}async parseZipFiles(){let t=[],r=[];this.zip.forEach((e,n)=>{n.dir||(t.push(e),r.push(n.async("arraybuffer")))});const n=await Promise.all(r);for(let r=0;r<n.length;r++){let i=t[r],s=i.split("/").length-1;this.files[i]={data:n[r],type:e.extensionForURL(i),depth:s}}}urlForZipFile(t){if(this.files[t])return this.files[t].url||(this.files[t].url=e.createObjectURL(new Blob([this.files[t].data]))),this.files[t].url}typeForZipFile(e){return this.files[e]&&this.files[e].type}}function dr(t){return new Promise((r,n)=>{"string"==typeof t?e.Utils.io(t).then(({body:e})=>{try{r(function(e){return ur.safeLoad(e,{json:!0})}(e))}catch(e){n(e)}},n):(t=Object.assign({},t),r(t))})}const fr={async loadScene(t,{path:r,type:n}={}){const i=[],s={},o=await this.loadSceneRecursive({url:t,path:r,type:n},null,s,i),{config:a,bundle:l}=this.finalize(o);if(!a)throw i[0];return i.length>0&&i.forEach(t=>{const r=`Failed to import scene: ${t.url}`;e.log("error",r,t),this.trigger("error",{type:"scene_import",message:r,error:t,url:t.url})}),{config:a,bundle:l,texture_nodes:s}},async loadSceneRecursive({url:t,path:r,type:n},i,s={},o=[]){if(!t)return{};const a=function(t,r,n,i=null){return null!=i&&"zip"===i||"string"==typeof t&&!e.isLocalURL(t)&&"zip"===e.extensionForURL(t)?new hr(t,r,n):new cr(t,r,n)}(t,r,i,n);try{let t=await a.load();if(null==t.import)return this.normalize(t,a,s),{config:t,bundle:a};Array.isArray(t.import)||(t.import=[t.import]);const r=[];t.import.forEach(t=>{"object"==typeof t&&(t=e.createObjectURL(new Blob([JSON.stringify(t)]))),r.push(a.resourceFor(t))}),delete t.import;const n=r.map(e=>this.loadSceneRecursive(e,a,s,o)),i=(await Promise.all(n)).map(e=>this.normalize(e.config,e.bundle,s)).map(e=>e.config);return this.normalize(t,a,s),t=e.mergeObjects(...i,t),{config:t,bundle:a,texture_nodes:s}}catch(e){return e.url=t,o.push(e),{}}},normalize(e,t,r={}){return this.normalizeDataSources(e,t),this.normalizeFonts(e,t),this.normalizeTextures(e,t),this.collectTextures(e,t,r),{config:e,bundle:t,texture_nodes:r}},normalizeDataSources(e,t){e.sources=e.sources||{};for(const r in e.sources)this.normalizeDataSource(e.sources[r],t);return e},normalizeDataSource(e,t){if(e.url=t.urlFor(e.url),Array.isArray(e.composite)&&e.composite.forEach(e=>e.url=t.urlFor(e.url)),e.scripts){Array.isArray(e.scripts)&&(e.scripts=e.scripts.reduce((e,t)=>(e[t]=t,e),{}));for(const r in e.scripts)e.scripts[r]=t.urlFor(e.scripts[r])}return e},normalizeFonts(e,t){e.fonts=e.fonts||{};const r=Object.values(e.fonts).filter(e=>"external"!==e);for(const e of r)(Array.isArray(e)?e:[e]).forEach(e=>e.url=t.urlFor(e.url));return e},normalizeTextures(e,t){if(e.textures=e.textures||{},e.textures)for(const r in e.textures){const n=e.textures[r];n.url&&(n.url=t.urlFor(n.url))}},collectTextures(t,r,n){if(t.styles)for(const e in t.styles){const i=t.styles[e],s=i.texture;if("string"==typeof s&&!t.textures[s]){const t=["styles",e,"texture"];this.addTextureNode(t,r,n)}i.material&&["emission","ambient","diffuse","specular","normal"].forEach(s=>{const o=null!=i.material[s]&&i.material[s].texture;if("string"==typeof o&&!t.textures[o]){const t=["styles",e,"material",s,"texture"];this.addTextureNode(t,r,n)}})}if(t.styles)for(const i in t.styles){const s=t.styles[i];s.shaders&&s.shaders.uniforms&&e.GLSL.parseUniforms(s.shaders.uniforms).forEach(({type:e,value:s,path:o})=>{if("sampler2D"===e&&"string"==typeof s&&!t.textures[s]){const e=["styles",i,"shaders","uniforms",...o];this.addTextureNode(e,r,n)}})}if(t.layers){const i=[t.layers],s=[["layers"]];for(;i.length>0;){const o=i.pop(),a=s.pop();if("object"==typeof o&&!Array.isArray(o))for(const l in o)if("draw"===l){const e=o[l];for(const i in e){if(e[i].texture){const s=e[i].texture;if("string"==typeof s&&!t.textures[s]){const e=[...a,l,"draw",i,"texture"];this.addTextureNode(e,r,n)}}if(e[i].outline&&e[i].outline.texture){const s=e[i].outline.texture;if("string"==typeof s&&!t.textures[s]){const e=[...a,l,"draw",i,"outline","texture"];this.addTextureNode(e,r,n)}}}}else{if(e.isReserved(l))continue;i.push(o[l]),s.push([...a,l])}}}},addTextureNode(e,t,r){r[JSON.stringify(e)]={path:e,bundle:t}},hoistTextureNodes(e,t,r={}){for(const{path:n,bundle:o}of Object.values(r)){const r=i(e,n);if("string"==typeof r&&null==e.textures[r])if(c(e,n)){const n=t.urlFor(r);e.textures[r]={url:n}}else{const t=o.urlFor(r);e.textures[t]={url:t},s(e,n,t)}}},applyGlobalProperties:e=>e.global&&0!==Object.keys(e.global).length?d(h(e.global),e):e,finalize:({config:e,bundle:t})=>e?(e.global=e.global||{},e.scene=e.scene||{},e.cameras=e.cameras||{},e.lights=e.lights||{},e.styles=e.styles||{},e.layers=e.layers||{},e.camera&&(e.cameras.default=e.camera),0===Object.keys(e.cameras).length&&(e.cameras.default={}),(0===Object.keys(e.lights).length||Object.keys(e.lights).every(t=>!1===e.lights[t].visible))&&(e.lights.default_light={type:"directional"}),{config:e,bundle:t}):{}};e.subscribeMixin(fr);class pr{constructor(){this.tiles={},this.max_proxy_descendant_depth=6,this.max_proxy_ancestor_depth=7,this.children_cache={}}addTile(t){for(this.tiles[t.key]=this.tiles[t.key]||{descendants:0},this.tiles[t.key].tile=t;t.style_z>=0;){if(!(t=e.TileID.parent(t)))return;this.tiles[t.key]||(this.tiles[t.key]={descendants:0}),this.tiles[t.key].descendants++}}removeTile(t){for(this.tiles[t.key]&&(delete this.tiles[t.key].tile,0===this.tiles[t.key].descendants&&delete this.tiles[t.key]);t.style_z>=0;){if(!(t=e.TileID.parent(t)))return;this.tiles[t.key]&&this.tiles[t.key].descendants>0&&(this.tiles[t.key].descendants--,0!==this.tiles[t.key].descendants||this.tiles[t.key].tile||delete this.tiles[t.key])}}getAncestor(t){let r=0;for(;r<this.max_proxy_ancestor_depth;){if(!(t=e.TileID.parent(t)))return;if(this.tiles[t.key]&&this.tiles[t.key].tile&&this.tiles[t.key].tile.loaded)return this.tiles[t.key].tile;r++}}getDescendants(t,r=0){let n=[];if(r<this.max_proxy_descendant_depth){let i=e.TileID.children(t,this.children_cache);if(!i)return;i.forEach(e=>{this.tiles[e.key]&&(this.tiles[e.key].tile&&this.tiles[e.key].tile.loaded?n.push(this.tiles[e.key].tile):this.tiles[e.key].descendants>0&&n.push(...this.getDescendants(e,r+1)))})}return n}}let mr={},_r={};function gr(t,r=null){if(this.obb)return e.Label.prototype.occluded.call(this,t,r);if(this.obbs)for(let n=0;n<this.obbs.length;n++){let i={aabb:this.aabbs[n],obb:this.obbs[n]};if(e.Label.prototype.occluded.call(i,t,r))return!0}return!1}class yr{constructor({scene:t}){this.scene=t,this.tiles={},this.pyramid=new pr,this.visible_coords={},this.queued_coords=[],this.building_tiles=null,this.renderable_tiles=[],this.collision={tile_keys:null,mesh_set:null,zoom:null,zoom_steps:3},this.main_thread_target=["TileManager",this.scene.id].join("_"),e.WorkerBroker.addTarget(this.main_thread_target,this)}destroy(){this.forEachTile(e=>e.destroy()),this.tiles={},this.pyramid=null,this.visible_coords={},this.queued_coords=[],this.scene=null,e.WorkerBroker.removeTarget(this.main_thread_target)}get view(){return this.scene.view}get style_manager(){return this.scene.style_manager}keepTile(e){this.tiles[e.key]=e,this.pyramid.addTile(e)}hasTile(e){return void 0!==this.tiles[e]}forgetTile(e){if(this.hasTile(e)){let t=this.tiles[e];this.pyramid.removeTile(t)}delete this.tiles[e],this.tileBuildStop(e)}removeTile(t){e.log("trace",`tile unload for ${t}`);var r=this.tiles[t];null!=r&&r.destroy(),this.forgetTile(r.key),this.scene.requestRedraw()}forEachTile(e){for(let t in this.tiles)e(this.tiles[t])}removeTiles(e){let t=[];for(let r in this.tiles)e(this.tiles[r])&&t.push(r);for(let e=0;e<t.length;e++){let r=t[e];this.removeTile(r)}}updateTilesForView(){this.visible_coords={};let e=this.view.findVisibleTileCoordinates();for(let t=0;t<e.length;t++){const r=e[t];this.queueCoordinate(r),this.visible_coords[r.key]=r}this.updateTileStates()}updateTileStates(){return this.forEachTile(e=>{this.updateVisibility(e)}),this.loadQueuedCoordinates(),this.updateProxyTiles(),this.view.pruneTilesForView(),this.updateRenderableTiles(),this.style_manager.updateActiveStyles(this.renderable_tiles),this.style_manager.updateActiveBlendOrders(this.renderable_tiles),this.updateLabels()}updateLabels(){var t=this;if(this.scene.building&&!this.scene.building.initial)return Promise.resolve({});const r=this.renderable_tiles.filter(e=>e.valid).filter(e=>e.built);return 0===r.length?Promise.resolve({}):(r.sort((e,t)=>e.build_id<t.build_id?-1:e.build_id>t.build_id?1:0),this.collision.zoom===vr(this.view.zoom,this.collision.zoom_steps)&&this.collision.tile_keys===JSON.stringify(r.map(e=>e.key))&&this.collision.mesh_set===br(r)?Promise.resolve({}):(this.collision.task||(this.collision.zoom=vr(this.view.zoom,this.collision.zoom_steps),this.collision.tile_keys=JSON.stringify(r.map(e=>e.key)),this.collision.mesh_set=br(r),this.collision.task={type:"tileManagerUpdateLabels",run:async function(n){const i=await async function(t,r,n=!1){_r=mr,mr={};let i=function(t,r){let n={};t.forEach(t=>{const i=e.Geo.unitsPerMeter(t.coords.z),s=Math.pow(2,r-t.style_z),o=i*s,a=e.Geo.metersPerPixel(r),l=Object.assign({},t.meshes,t.pending_label_meshes);for(let r in l)l[r].forEach(r=>{if(r.labels)for(let s in r.labels){if(t.isProxy()&&!_r[s])continue;const l=r.labels[s].container.label,u=r.labels[s].container.linked,c=r.labels[s].ranges;let h={};if(h.discard=gr.bind(h),h.build_id=t.build_id,Object.assign(h,l),h.layout=Object.assign({},l.layout),h.layout.repeat_scale=.75,h.layout.repeat_distance=h.layout.repeat_distance||0,h.layout.repeat_distance/=o,h.position=[h.position[0]/i+t.min.x,h.position[1]/i+t.min.y],h.unit_scale=a,"point"===h.type)e.LabelPoint.prototype.updateBBoxes.call(h);else if("straight"===h.type)e.LabelLineStraight.prototype.updateBBoxes.call(h,h.position,h.size,h.angle,h.angle,h.offset);else if(l.obbs){const r=l.obbs.map(r=>{let{x:n,y:s,a:a,w:l,h:u}=r;return n=n/i+t.min.x,s=s/i+t.min.y,l/=o,u/=o,new e.OBB(n,s,a,l,u)});h.obbs=r,h.aabbs=r.map(e=>e.getExtent())}n[s]={label:h,linked:u,ranges:c,mesh:r}}})});for(let e in n){const t=n[e];t.linked&&(t.linked=n[t.linked])}return n=Object.keys(n).map(e=>n[e]),n}(t,r);e.Collision.startTile("main",{apply_repeat_groups:!0,return_hidden:!0}),e.Collision.addStyle("main","main");const s=Math.max(0,...Object.values(t).map(e=>Object.values(e.meshes)).flat().map(e=>Math.max(0,...e.map(e=>e.labels?Object.keys(e.labels).length:0)))),o=Math.floor(s/e.Geo.tile_size);o>0?e.Collision.initGrid({anchor:{x:Math.min(...t.map(e=>e.min.x)),y:Math.min(...t.map(e=>e.min.y))},span:t[0].span.x/o}):e.Collision.initGrid();const a=await e.Collision.collide(i,"main","main");let l=[];return a.forEach(e=>{let t=0;!0!==e.show||n&&e.label.breach&&!_r[e.label.id]||(t=1),t&&(mr[e.label.id]=!0);let r=!0;e.ranges.forEach(n=>{if(!r)return;let i=e.mesh;if(!i.valid)return;let s=i.vertex_layout.offset.a_shape,o=i.vertex_layout.stride;for(let e=0;e<n[1];e++){if(i.vertex_data[n[0]+e*o+s+6]===t)return void(r=!1);i.vertex_data[n[0]+e*o+s+6]=t}-1===l.indexOf(i)&&l.push(i)})}),l.forEach(e=>e.upload()),t.forEach(e=>e.swapPendingLabels()),{labels:a,containers:i}}(r,t.collision.zoom,t.isLoadingVisibleTiles());t.scene.requestRedraw(),t.collision.task=null,e.Task.finish(n,i),t.updateTileStates()},immediate:!0},e.Task.add(this.collision.task)),this.collision.task.promise))}updateProxyTiles(){if(0===this.view.zoom_direction)return;this.forEachTile(e=>e.setProxyFor(null));let e=!1;this.forEachTile(t=>{if(t.visible&&!t.labeled){const r=this.pyramid.getAncestor(t);if(r)r.setProxyFor(t),e=!0;else{const r=this.pyramid.getDescendants(t);for(let n=0;n<r.length;n++)r[n].setProxyFor(t),e=!0}}}),e||(this.view.zoom_direction=0)}updateVisibility(t){if(t.visible=!1,t.style_z===this.view.tile_zoom)if(this.visible_coords[t.coords.key])t.visible=!0;else for(let r in this.visible_coords)if(e.TileID.isDescendant(t.coords,this.visible_coords[r])){t.visible=!0;break}}pruneToVisibleTiles(){this.removeTiles(e=>!e.visible)}getRenderableTiles(){return this.renderable_tiles}updateRenderableTiles(){this.renderable_tiles=[];for(let e in this.tiles){let t=this.tiles[e];t.visible&&t.loaded&&this.renderable_tiles.push(t)}return this.renderable_tiles}isLoadingVisibleTiles(){return Object.keys(this.tiles).some(e=>this.tiles[e].visible&&!this.tiles[e].built)}allVisibleTilesLabeled(){return this.renderable_tiles.every(e=>e.labeled)}queueCoordinate(e){this.queued_coords[this.queued_coords.length]=e}loadQueuedCoordinates(){0!==this.queued_coords.length&&(this.queued_coords.sort((t,r)=>{let n=this.view.center.meters,i=e.Geo.metersPerTile(t.z)/2,s=e.Geo.metersForTile(t);s.x+=i,s.y-=i;let o=e.Geo.metersForTile(r);o.x+=i,o.y-=i;let a=Math.abs(n.x-s.x)+Math.abs(n.y-s.y),l=Math.abs(n.x-o.x)+Math.abs(n.y-o.y);return t.center_dist=a,r.center_dist=l,l>a?-1:l===a?0:1}),this.queued_coords.forEach(e=>this.loadCoordinate(e)),this.queued_coords=[])}loadCoordinate(t){if(t.z===this.view.center.tile.z)for(let r in this.scene.sources){let n=this.scene.sources[r];if(!n.builds_geometry_tiles||!n.includesTile(t,this.view.tile_zoom))continue;let i=e.TileID.normalizedKey(t,n,this.view.tile_zoom);if(i&&!this.hasTile(i)){e.log("trace",`load tile ${i}, distance from view center: ${t.center_dist}`);let r=new e.Tile({source:n,coords:t,workers:this.scene.workers,style_z:this.view.baseZoom(t.z),view:this.view});this.keepTile(r),this.buildTile(r)}}}buildTile(e,t){this.tileBuildStart(e.key),this.updateVisibility(e),e.build(this.scene.generation,t)}buildTileStylesCompleted({tile:t,progress:r}){if(null==this.tiles[t.key])e.log("trace",`discarded tile ${t.key} in TileManager.buildTileStylesCompleted because previously removed`),e.Tile.abortBuild(t),this.updateTileStates();else if(t.generation!==this.scene.generation)e.log("trace",`discarded tile ${t.key} in TileManager.buildTileStylesCompleted because built with scene config gen ${t.generation}, current ${this.scene.generation}`),e.Tile.abortBuild(t),this.updateTileStates();else{if(this.tiles[t.key]){if(t.id<this.tiles[t.key].id)return e.log("trace",`discarded tile ${t.key} for id ${t.id} in TileManager.buildTileStylesCompleted because built for discarded tile id`),void e.Tile.abortBuild(t);t=this.tiles[t.key].merge(t)}r.done&&(t.built=!0),t.buildMeshes(this.scene.styles,r),this.updateTileStates(),this.scene.requestRedraw()}r.done&&this.tileBuildStop(t.key)}buildTileError(t){e.log("error",`Error building tile ${t.key}:`,t.error),this.forgetTile(t.key),e.Tile.abortBuild(t)}tileBuildStart(t){this.building_tiles=this.building_tiles||{},this.building_tiles[t]=!0,e.log("trace",`tileBuildStart for ${t}: ${Object.keys(this.building_tiles).length}`)}tileBuildStop(t){this.building_tiles&&(e.log("trace",`tileBuildStop for ${t}: ${Object.keys(this.building_tiles).length}`),delete this.building_tiles[t],this.checkBuildQueue())}checkBuildQueue(){this.building_tiles&&0!==Object.keys(this.building_tiles).length||(this.building_tiles=null,this.scene.tileManagerBuildDone())}getDebugProp(e,t){var r=[];for(var n in this.tiles)null==this.tiles[n].debug[e]||"function"==typeof t&&!0!==t(this.tiles[n])||r.push(this.tiles[n].debug[e]);return r}getDebugSum(e,t){var r=0;for(var n in this.tiles)null==this.tiles[n].debug[e]||"function"==typeof t&&!0!==t(this.tiles[n])||(r+=this.tiles[n].debug[e]);return r}getDebugAverage(e,t){return this.getDebugSum(e,t)/Object.keys(this.tiles).length}}function vr(e,t,r=2){return(Math.floor(e*t)/t).toFixed(r)}function br(e){return JSON.stringify(Object.entries(e).map(([,e])=>Object.entries(e.meshes).map(([,e])=>e.map(e=>e.created_at))))}class xr{constructor(e,t){t(e),this.value=e,this.setup=t}set(e){JSON.stringify(this.value)!==JSON.stringify(e)&&(this.setup(e),this.value=e)}}class wr{constructor(e){this.defaults={},this.defaults.culling=!0,this.defaults.culling_face=e.BACK,this.defaults.blending=!1,this.defaults.blending_src=e.ONE_MINUS_SRC_ALPHA,this.defaults.blending_dst=e.ONE_MINUS_SRC_ALPHA,this.defaults.blending_src_alpha=e.ONE,this.defaults.blending_dst_alpha=e.ONE_MINUS_SRC_ALPHA,this.defaults.depth_write=!0,this.defaults.depth_test=!0,e.depthFunc(e.LESS),this.culling=new xr({cull:this.defaults.culling,face:this.defaults.culling_face},t=>{t.cull?(e.enable(e.CULL_FACE),e.cullFace(t.face)):e.disable(e.CULL_FACE)}),this.blending=new xr({blend:this.defaults.blending,src:this.defaults.blending_src,dst:this.defaults.blending_dst,src_alpha:this.defaults.blending_src_alpha,dst_alpha:this.defaults.blending_dst_alpha},t=>{t.blend?(e.enable(e.BLEND),t.src_alpha&&t.dst_alpha?e.blendFuncSeparate(t.src,t.dst,t.src_alpha,t.dst_alpha):e.blendFunc(t.src,t.dst)):e.disable(e.BLEND)}),this.depth_write=new xr({depth_write:this.defaults.depth_write},t=>{e.depthMask(t.depth_write)}),this.depth_test=new xr({depth_test:this.defaults.depth_test},t=>{t.depth_test?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST)})}}class Ar{constructor(){this.canvas=null,this.gl=null,this.screenshot_canvas=null,this.screenshot_context=null,this.queue_screenshot=null,this.video_capture=null}setCanvas(e,t){this.canvas=e,this.gl=t}screenshot({background:e}={}){return null!=this.queue_screenshot||(this.queue_screenshot={background:e},this.queue_screenshot.promise=new Promise((e,t)=>{this.queue_screenshot.resolve=e,this.queue_screenshot.reject=t})),this.queue_screenshot.promise}completeScreenshot(){if(null!=this.queue_screenshot){let t=this.canvas.width,r=this.canvas.height,n=new Uint8Array(t*r*4);this.gl.readPixels(0,0,t,r,this.gl.RGBA,this.gl.UNSIGNED_BYTE,n);let i=this.queue_screenshot.background;i=i&&"transparent"!==i?e.StyleParser.parseColor(i).slice(0,3).map(e=>255*e):null;let s=new Uint8ClampedArray(t*r*4);for(let e=0;e<r;e++)for(let o=0;o<t;o++){let a=4*((r-e-1)*t+o),l=4*(e*t+o),u=n[a+3];s[l+0]=255*n[a+0]/u,s[l+1]=255*n[a+1]/u,s[l+2]=255*n[a+2]/u,s[l+3]=u,i&&(u/=255,s[l+0]=s[l+0]*u+i[0]*(1-u),s[l+1]=s[l+1]*u+i[1]*(1-u),s[l+2]=s[l+2]*u+i[2]*(1-u),s[l+3]=255)}this.screenshot_canvas=this.screenshot_canvas||document.createElement("canvas");let o=this.screenshot_canvas;o.width=t,o.height=r,this.screenshot_context=this.screenshot_context||o.getContext("2d");let a=this.screenshot_context,l=new ImageData(s,t,r);a.putImageData(l,0,0);const u=o.toDataURL("image/png"),c=atob(u.slice(22)),h=new Uint8Array(c.length);for(let e=0;e<c.length;++e)h[e]=c.charCodeAt(e);const d=new Blob([h],{type:"image/png"});this.queue_screenshot.resolve({url:u,blob:d,type:"png"}),this.queue_screenshot=null}}startVideoCapture(){if("function"!=typeof window.MediaRecorder||!this.canvas||"function"!=typeof this.canvas.captureStream)return e.log("warn","Video capture (Canvas.captureStream and/or MediaRecorder APIs) not supported by browser"),!1;if(this.video_capture)return e.log("warn","Video capture already in progress, call Scene.stopVideoCapture() first"),!1;try{let t=this.video_capture={};t.chunks=[],t.stream=this.canvas.captureStream(),t.options={mimeType:"video/webm"},t.media_recorder=new MediaRecorder(t.stream,t.options),t.media_recorder.ondataavailable=r=>{if(r.data.size>0&&t.chunks.push(r.data),t.resolve){let r=new Blob(t.chunks,{type:t.options.mimeType}),n=e.createObjectURL(r);t.stream&&(t.stream.getTracks()||[]).forEach(e=>{e.stop(),t.stream.removeTrack(e)}),t.stream=null,t.media_recorder=null,this.video_capture=null,t.resolve({url:n,blob:r,type:"webm"})}},t.media_recorder.start()}catch(t){return this.video_capture=null,e.log("error","Scene video capture failed",t),!1}return!0}stopVideoCapture(){return this.video_capture?(this.video_capture.promise=new Promise((e,t)=>{this.video_capture.resolve=e,this.video_capture.reject=t}),this.video_capture.media_recorder.stop(),this.video_capture.promise):(e.log("warn","No scene video capture in progress, call Scene.startVideoCapture() first"),Promise.resolve({}))}}function Er(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Tr(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?Er(Object(n),!0).forEach(function(r){e._defineProperty(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Er(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}class Sr{constructor(t,r){var n;r=r||{},e.subscribeMixin(this),this.id=Sr.id++,this.initialized=!1,this.initializing=null,this.sources={},this.view=new e.View(this,r),this.tile_manager=new yr({scene:this}),this.num_workers=r.numWorkers||2,!0===r.disableVertexArrayObjects&&(e.VertexArrayObject.disabled=!0),e.Utils.use_high_density_display=void 0===r.highDensityDisplay||r.highDensityDisplay,e.Utils.updateDevicePixelRatio(),this.config=null,this.config_source=t,this.config_bundle=null,this.last_valid_config_source=null,this.styles=null,this.style_manager=new e.StyleManager,this.building=null,this.dirty=!0,r.preUpdate&&this.subscribe({pre_update:r.preUpdate}),r.postUpdate&&this.subscribe({post_update:r.postUpdate}),this.render_loop=!r.disableRenderLoop,this.render_loop_active=!1,this.render_loop_stop=!1,this.render_count=0,this.last_render_count=0,this.render_count_changed=!1,this.frame=0,this.last_main_render=-1,this.last_selection_render=-1,this.media_capture=new Ar,this.selection=null,this.selection_feature_count=0,this.fetching_selection_map=null,this.prev_textures=null,this.introspection=!0===r.introspection,this.times={},this.resetTime(),this.container=r.container,this.canvas=null,this.contextOptions=r.webGLContextOptions,this.lights=null,this.background=null,this.createListeners(),this.updating=0,this.generation=Sr.generation,this.last_complete_generation=Sr.generation,(n=this).debug={profile(t){console.profile(`main thread: ${t}`),e.WorkerBroker.postMessage(n.workers,"self.profile",t)},profileEnd(t){console.profileEnd(`main thread: ${t}`),e.WorkerBroker.postMessage(n.workers,"self.profileEnd",t)},timeRebuild(t=1,r={}){let i=[],s=()=>{let o=+new Date;n.rebuild(r).then(()=>{if(i.push(+new Date-o),i.length<t)s();else{let r=~~(i.reduce((e,t)=>e+t)/i.length);e.log("info",`Profiled rebuild ${t} times: ${r} avg (${Math.min(...i)} min, ${Math.max(...i)} max)`)}})};s()},geometryCountByStyle(){let e={};return n.tile_manager.getRenderableTiles().forEach(t=>{for(let r in t.meshes)e[r]=e[r]||0,t.meshes[r].forEach(t=>{e[r]+=t.geometry_count})}),e},geometryCountByBaseStyle(){let e=n.debug.geometryCountByStyle(),t={};for(let r in e){let i=n.styles[r].baseStyle();t[i]=t[i]||0,t[i]+=e[r]}return t},geometryCountTotal(){const e=n.debug.geometryCountByStyle();return Object.keys(e).reduce((t,r)=>e[r]+t,0)},geometrySizeByStyle(){let e={};return n.tile_manager.getRenderableTiles().forEach(t=>{for(let r in t.meshes)e[r]=e[r]||0,t.meshes[r].forEach(t=>{e[r]+=t.buffer_size})}),e},geometrySizeByBaseStyle(){let e=n.debug.geometrySizeByStyle(),t={};for(let r in e){let i=n.styles[r].baseStyle();t[i]=t[i]||0,t[i]+=e[r]}return t},geometrySizeTotal(){const e=n.debug.geometrySizeByStyle();return Object.keys(e).reduce((t,r)=>e[r]+t,0)},textureSizeTotal:()=>Object.values(e.Texture.textures).map(e=>e.byteSize()).reduce((e,t)=>e+t),layerStats:()=>e.debugSettings.layer_stats?e.debugSumLayerStats(n.tile_manager.getRenderableTiles()):(e.log("warn","Enable the 'layer_stats' debug setting to collect layer stats"),{}),renderableTilesCount:()=>n.tile_manager.getRenderableTiles().length},this.log_level=r.logLevel||"warn",e.log.setLevel(this.log_level),e.log.reset()}static create(e,t={}){return new Sr(e,t)}load(t=null,r={}){var n=this;return this.initializing||(e.log.reset(),this.updating++,this.initialized=!1,this.view_complete=!1,this.times.frame=null,this.times.build=null,(r="string"==typeof r?{base_path:r}:r).blocking=void 0===r.blocking||r.blocking,!1!==this.render_loop&&this.setupRenderLoop(),this.createCanvas(),this.prev_textures=this.config&&Object.keys(this.config.textures),this.initializing=this.loadScene(t,r).then(async function({texture_nodes:t}){await n.createWorkers(),n.destroyFeatureSelection(),e.WorkerBroker.postMessage(n.workers,"self.clearFunctionStringCache");const i="object"==typeof n.config_source||n.hasSubscribersFor("load"),s=n.updateConfig({texture_nodes:t,serialize_funcs:i,normalize:!1,loading:!0,fade_in:!0});!0===r.blocking&&await s,n.freePreviousTextures(),n.updating--,n.initializing=null,n.initialized=!0,n.last_valid_config_source=n.config_source,n.last_valid_options={base_path:r.base_path,file_type:r.file_type},n.requestRedraw()}).catch(t=>{let r,n;if(this.initializing=null,this.updating=0,"YAMLException"===t.name?(r="yaml",n="Error parsing scene YAML"):n="Error initializing scene",this.trigger("error",{type:r,message:n,error:t,url:this.config_source}),n=`Scene.load() failed to load ${JSON.stringify(this.config_source)}: ${t.message}`,this.last_valid_config_source)return e.log("warn",n,t),e.log("info","Scene.load() reverting to last valid configuration"),this.load(this.last_valid_config_source,this.last_valid_base_path);throw e.log("error",n,t),t})),this.initializing}destroy(){if(this.initialized=!1,this.render_loop_stop=!0,this.destroyListeners(),this.destroyFeatureSelection(),this.canvas&&this.canvas.parentNode&&(this.canvas.parentNode.removeChild(this.canvas),this.canvas=null),this.container=null,this.gl){e.Texture.destroy(this.gl),this.style_manager.destroy(this.gl),this.styles={},e.ShaderProgram.reset();let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.gl=null}this.sources={},this.destroyWorkers(),this.tile_manager.destroy(),this.tile_manager=null,e.log.reset()}createCanvas(){if(!this.canvas){this.container=this.container||document.body,this.canvas=document.createElement("canvas"),this.canvas.style.position="absolute",this.canvas.style.top=0,this.canvas.style.left=0,this.container.style.backgroundColor="transparent",this.container.appendChild(this.canvas);try{this.gl=r.getContext(this.canvas,Object.assign({alpha:!0,premultipliedAlpha:!0,stencil:!0,device_pixel_ratio:e.Utils.device_pixel_ratio,powerPreference:"high-performance"},this.contextOptions))}catch(e){throw new Error("Couldn't create WebGL context. Your browser may not support WebGL, or it's turned off? Visit http://webglreport.com/ for more info.")}this.resizeMap(this.container.clientWidth,this.container.clientHeight),e.VertexArrayObject.init(this.gl),this.render_states=new wr(this.gl),this.media_capture.setCanvas(this.canvas,this.gl)}}updateExternalScripts(){let e=[...this.external_scripts||[]],t=[];if(this.config.scene.scripts)for(let e in this.config.scene.scripts)-1===t.indexOf(this.config.scene.scripts[e])&&t.push(this.config.scene.scripts[e]);for(let e in this.config.sources){let r=this.config.sources[e];if(r.scripts)for(let e in r.scripts)-1===t.indexOf(r.scripts[e])&&t.push(r.scripts[e])}return this.external_scripts=t,!(this.external_scripts.length===e.length&&this.external_scripts.every((t,r)=>t===e[r]))}createWorkers(){return this.updateExternalScripts()&&this.destroyWorkers(),this.workers?Promise.resolve():this.makeWorkers()}makeWorkers(){let t=!!this.gl.getExtension("OES_element_index_uint"),r=[];this.workers=[];for(let n=0;n<this.num_workers;n++){let i=new Worker(Zg.workerURL);this.workers[n]=i,e.WorkerBroker.addWorker(i),e.log("debug",`Scene.makeWorkers: initializing worker ${n}`);let s=n;r.push(e.WorkerBroker.postMessage(i,"self.init",this.id,n,this.num_workers,this.log_level,e.Utils.device_pixel_ratio,t,this.external_scripts).then(t=>(e.log("debug",`Scene.makeWorkers: initialized worker ${t}`),t),t=>(e.log("error",`Scene.makeWorkers: failed to initialize worker ${s}:`,t),Promise.reject(t))))}return this.next_worker=0,Promise.all(r).then(()=>{e.log.setWorkers(this.workers)})}destroyWorkers(){this.selection=null,Array.isArray(this.workers)&&(e.log.setWorkers(null),this.workers.forEach(e=>{e.terminate()}),this.workers=null)}ready(){return!(!this.view.ready()||0===Object.keys(this.sources).length)}updateDevicePixelRatio(){e.Utils.updateDevicePixelRatio()&&e.WorkerBroker.postMessage(this.workers,"self.updateDevicePixelRatio",e.Utils.device_pixel_ratio).then(()=>this.rebuild()).then(()=>this.resizeMap(this.view.size.css.width,this.view.size.css.height))}resizeMap(t,n){0===t&&0===n||(this.dirty=!0,this.view.setViewportSize(t,n),this.gl&&r.resize(this.gl,t,n,e.Utils.device_pixel_ratio))}requestRedraw(){this.dirty=!0}immediateRedraw(){this.dirty=!0,this.update()}renderLoop(){this.render_loop_active=!0,this.update(),e.Task.setState({user_moving_view:this.view.user_input_active}),e.Task.processAll(),this.render_loop_stop?(this.render_loop_stop=!1,this.render_loop_active=!1):window.requestAnimationFrame(this.renderLoop.bind(this))}setupRenderLoop(){this.render_loop_active||setTimeout(()=>{this.renderLoop()},0)}update(){let t=this.dirty,r=!!this.selection&&this.selection.hasPendingRequests();var n=!(!1===t&&!1===r||!1===this.initialized||this.updating>0||!1===this.ready());return this.trigger("pre_update",n),this.view.update(),!!n&&(this.dirty=!1,this.updateDevicePixelRatio(),this.render({main:t,selection:r}),this.updateViewComplete(),this.media_capture.completeScreenshot(),this.trigger("post_update",n),(!0===this.animated||this.view.isAnimating())&&(this.dirty=!0),this.frame++,e.log("trace","Scene.render()"),!0)}render({main:t,selection:r}){var n=this.gl;if(this.updateBackground(),Object.keys(this.lights).forEach(e=>this.lights[e].update()),this.render_count_changed=!1,t&&(this.render_count=this.renderPass(),this.last_main_render=this.frame,this.render_count!==this.last_render_count&&(this.render_count_changed=!0,this.logFirstFrame(),this.getFeatureSelectionMapSize().then(t=>{this.selection_feature_count=t,e.log("info",`Scene: rendered ${this.render_count} primitives (${t} features in selection map)`)})),this.last_render_count=this.render_count),r){if(this.view.panning||this.view.user_input_active)return void this.selection.clearPendingRequests();!this.selection.locked&&this.last_selection_render<this.last_main_render&&(this.selection.bind(),this.renderPass("selection_program",{allow_blend:!1}),n.bindFramebuffer(n.FRAMEBUFFER,null),n.viewport(0,0,this.canvas.width,this.canvas.height),n.clearColor(...this.background.computed_color),this.last_selection_render=this.frame),this.selection.read()}return!0}renderPass(t="program",{allow_blend:r}={}){r=null==r||r,this.clearFrame();let n,i=0;const s=this.style_manager.getActiveBlendOrders();for(const{blend_order:o,styles:a}of s)for(let s=0;s<a.length;s++){let l=this.styles[a[s]];if(null==l)continue;if(l.blend!==n){let t=Object.assign({},e.Style.render_states[l.blend],{blend:r&&l.blend});this.setRenderState(t)}const u=r&&l.blend;if("translucent"===u)this.gl.colorMask(!1,!1,!1,!1),this.renderStyle(l.name,t,o),this.gl.colorMask(!0,!0,!0,!0),this.gl.depthFunc(this.gl.EQUAL),this.gl.enable(this.gl.STENCIL_TEST),this.gl.clearStencil(0),this.gl.clear(this.gl.STENCIL_BUFFER_BIT),this.gl.stencilFunc(this.gl.EQUAL,this.gl.ZERO,255),this.gl.stencilOp(this.gl.KEEP,this.gl.KEEP,this.gl.INCR),i+=this.renderStyle(l.name,t,o),this.gl.disable(this.gl.STENCIL_TEST),this.gl.depthFunc(this.gl.LESS);else if("opaque"!==u&&!0===l.stencil_proxy_tiles){const e=this.tile_manager.getRenderableTiles().filter(e=>e.meshes[l.name]).map(e=>e.proxy_level).reduce((e,t)=>(e.indexOf(t)>-1||e.push(t),e),[]).sort();if(e.length>1){this.gl.enable(this.gl.STENCIL_TEST),this.gl.clearStencil(0),this.gl.clear(this.gl.STENCIL_BUFFER_BIT),this.gl.stencilOp(this.gl.KEEP,this.gl.KEEP,this.gl.REPLACE);for(let r=0;r<e.length;r++)this.gl.stencilFunc(this.gl.GEQUAL,e.length-r,255),i+=this.renderStyle(l.name,t,o,e[r]);this.gl.disable(this.gl.STENCIL_TEST)}else i+=this.renderStyle(l.name,t,o)}else i+=this.renderStyle(l.name,t,o);n=l.blend}return i}renderStyle(e,t,r,n=null){let i,s=this.styles[e],o=!0,a=0,l=this.tile_manager.getRenderableTiles().filter(e=>"number"!=typeof n||e.proxy_level===n).map(t=>{if(t.meshes[e])return[t,t.meshes[e].filter(e=>e.variant.blend_order===r)]}).filter(e=>e),u=Math.max(...l.map(([,e])=>Math.max(...e.map(e=>e.variant.mesh_order))));for(let r=0;r<u+1;r++)for(let[n,u]of l){let l=!0;if(!n.shouldProxyForStyle(e))continue;const c=u.filter(e=>e.variant.mesh_order===r);if(0!==c.length){if(!0===o&&(o=!1,i=this.setupStyle(s,t),!i))return 0;c.forEach(e=>{!0===l&&(l=!1,this.view.setupTile(n,i)),s.render(e)&&this.requestRedraw(),a+=e.geometry_count})}}return a}setupStyle(e,t){let r;try{if(r=e.getProgram(t),!r)return}catch(t){return void this.trigger("warning",{type:"styles",message:`Error compiling style ${e.name}`,style:e,shader_errors:e.program&&e.program.shader_errors})}r.use(),e.setup(),r.uniform("1f","u_time",this.animated?(+new Date-this.start_time)/1e3:0),this.view.setupProgram(r);for(let e in this.lights)this.lights[e].setupProgram(r);return r}clearFrame(){this.initialized&&(this.render_states.depth_write.set({depth_write:!0}),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT|this.gl.STENCIL_BUFFER_BIT))}setRenderState({depth_test:e,depth_write:t,cull_face:r,blend:n}={}){if(!this.initialized)return;let i=this.render_states;e=!1!==e&&i.defaults.depth_test,t=!1!==t&&i.defaults.depth_write,r=!1!==r&&i.defaults.culling,n=null!=n?n:i.defaults.blending;let s=this.gl;i.depth_test.set({depth_test:e}),i.depth_write.set({depth_write:t}),i.culling.set({cull:r,face:i.defaults.culling_face}),n?"opaque"===n?i.blending.set({blend:!1}):"overlay"===n||"inlay"===n||"translucent"===n?i.blending.set({blend:!0,src:s.SRC_ALPHA,dst:s.ONE_MINUS_SRC_ALPHA,src_alpha:s.ONE,dst_alpha:s.ONE_MINUS_SRC_ALPHA}):"add"===n?i.blending.set({blend:!0,src:s.ONE,dst:s.ONE}):"multiply"===n&&i.blending.set({blend:!0,src:s.ZERO,dst:s.SRC_COLOR}):i.blending.set({blend:!1})}getFeatureAt(t,{radius:r}={}){if(!this.initialized)return e.log("debug","Scene.getFeatureAt() called before scene was initialized"),Promise.resolve();if(0===this.selection_feature_count)return Promise.resolve();this.selection||this.resetFeatureSelection();let n={x:t.x/this.view.size.css.width,y:t.y/this.view.size.css.height};return r=r>0?{x:r/this.view.size.css.width,y:r/this.view.size.css.height}:null,this.selection.getFeatureAt(n,{radius:r}).then(e=>Object.assign(e,{pixel:t})).catch(e=>Promise.resolve({error:e}))}async queryFeatures({filter:t,unique:r=!0,group_by:n=null,visible:i=null,geometry:s=!1}={}){if(!this.initialized)return[];t=e.Utils.serializeWithFunctions(t);const o=!0===(r="string"==typeof r?[r]:r)||Array.isArray(r)&&r.indexOf("$id")>-1,a=r&&(t=>{const n=Array.isArray(r)?e.sliceObject(t.properties,r):t.properties,i=o?t.id:null;return s?JSON.stringify({geometry:t.geometry,properties:n,id:i}):JSON.stringify({properties:n,id:i})}),l=(n=("string"==typeof n||Array.isArray(n))&&n)&&(t=>Array.isArray(n)?JSON.stringify(e.sliceObject(t,n)):t[n]),u=this.tile_manager.getRenderableTiles().map(e=>e.key),c=await e.WorkerBroker.postMessage(this.workers,"self.queryFeatures",{filter:t,visible:i,geometry:s,tile_keys:u}),h=[],d={},f={};return c.forEach(e=>e.forEach(e=>{if(a){const t=a(e);if(d[t])return;d[t]=!0}if(l){const t=l(e.properties);f[t]=f[t]||[],f[t].push(e)}else h.push(e)})),l?f:h}rebuild({initial:t=!1,new_generation:r=!0,sources:n=null,serialize_funcs:i,profile:s=!1,fade_in:o=!1}={}){return new Promise((a,l)=>{if(this.building){this.building.queued&&this.building.queued.reject&&(e.log("debug","Scene.rebuild: request superceded by a newer call"),this.building.queued.resolve(!1));let u={initial:t,new_generation:r,sources:n,serialize_funcs:i,profile:s,fade_in:o};return this.building.queued={resolve:a,reject:l,options:u},void e.log("trace","Scene.rebuild(): queuing request")}if(this.building={resolve:a,reject:l,initial:t},s&&this.debug.profile("Scene.rebuild"),r){this.generation=++Sr.generation;for(let e in this.styles)this.styles[e].setGeneration(this.generation)}this.syncConfigToWorker({serialize_funcs:i}),this.resetWorkerFeatureSelection(n),this.resetTime(),this.tile_manager.pruneToVisibleTiles(),this.tile_manager.forEachTile(e=>{(!n||n.indexOf(e.source.name)>-1)&&this.tile_manager.buildTile(e,{fade_in:o})}),this.tile_manager.updateTilesForView(),this.tile_manager.checkBuildQueue()}).then(()=>{s&&this.debug.profileEnd("Scene.rebuild")})}tileManagerBuildDone(){if(e.TextCanvas.pruneTextCache(),this.building){e.log("info","Scene: build geometry finished"),this.building.resolve&&(this.logFirstBuild(),this.building.resolve(!0));var t=this.building.queued;this.building=null,t?(e.log("debug","Scene: starting queued rebuild() request"),this.rebuild(t.options).then(t.resolve,t.reject)):this.tile_manager.updateLabels()}}async loadScene(t=null,{base_path:r,file_type:n}={}){this.config_source=t||this.config_source,"string"==typeof this.config_source?this.base_path=e.pathForURL(r||this.config_source):this.base_path=e.pathForURL(r),this.config_path=this.base_path;const{config:i,bundle:s,texture_nodes:o}=await fr.loadScene(this.config_source,{path:this.base_path,type:n});return this.config=i,this.config_bundle=s,{texture_nodes:o}}setDataSource(t,r){if(!t||!r||!r.type||!r.url&&!r.data)return void e.log("error","No name provided or not a valid config:",t,r);let n=null==this.config.sources[t],i=this.config.sources[t]=Object.assign({},r);return i.data&&"object"==typeof i.data&&(i.url=e.createObjectURL(new Blob([JSON.stringify(i.data)],{type:"application/json"})),delete i.data),n?this.updateConfig({rebuild:{sources:[t]}}):this.rebuild({sources:[t]})}createDataSources(t=!1){const r=[],n=Object.keys(this.sources);let i=0;for(var s in this.config.sources){const n=this.config.sources[s],o=this.sources[s];try{const t=Tr(Tr({},n),{},{name:s,id:i++});if(this.sources[s]=e.DataSource.create(t,this.sources),!this.sources[s])throw{}}catch(t){delete this.sources[s];const r=`Could not create data source: ${t.message}`;e.log("warn",`Scene: ${r}`,n),this.trigger("warning",{type:"sources",source:n,message:r})}(t||e.DataSource.tileLayoutChanged(this.sources[s],o))&&r.push(s)}n.forEach(e=>{this.config.sources[e]||(delete this.sources[e],r.push(e))}),r.length>0&&this.tile_manager.removeTiles(e=>r.indexOf(e.source.name)>-1);for(let e in this.config.layers){let t=this.config.layers[e];!1!==t.enabled&&t.data&&this.sources[t.data.source]&&(this.sources[t.data.source].builds_geometry_tiles=!0)}}loadTextures(){return e.Texture.createFromObject(this.gl,this.config.textures).then(()=>e.Texture.createDefault(this.gl))}freePreviousTextures(){this.prev_textures&&(this.prev_textures.forEach(t=>{!this.config.textures[t]&&e.Texture.textures[t]&&e.Texture.textures[t].destroy()}),this.prev_textures=null)}updateStyles(){if(!this.initialized&&!this.initializing)throw new Error("Scene.updateStyles() called before scene was initialized");this.styles=this.style_manager.build(this.config.styles),this.style_manager.initStyles(this);for(let e in this.styles)this.styles[e].setGL(this.gl);this.dirty=!0}get animated(){return!1!==this.config.scene.animated&&this.style_manager.getActiveStyles().some(e=>this.styles[e].animated)}getActiveCamera(){return this.view.getActiveCamera()}setActiveCamera(e){return this.view.setActiveCamera(e)}createLights(){this.lights={},e.debugSettings.wireframe&&(e.Light.enabled=!1);for(let t in this.config.lights){if(!this.config.lights[t]||"object"!=typeof this.config.lights[t])continue;let r=this.config.lights[t];r.name=t.replace("-","_"),r.visible=!1!==r.visible,r.visible&&(this.lights[r.name]=e.Light.create(this.view,r))}e.Light.inject(this.lights)}setBackground(){const t=this.config.scene.background;this.background={},t&&t.color&&(this.background.color=e.StyleParser.createColorPropertyCache(t.color)),this.background.color||(this.background.color=e.StyleParser.createColorPropertyCache([0,0,0,0]))}updateBackground(){const t=this.background.computed_color,r=this.background.computed_color=e.StyleParser.evalCachedColorProperty(this.background.color,{zoom:this.view.tile_zoom});t&&!r.some((e,r)=>t[r]!==e)||(1===r[3]?this.canvas.style.backgroundColor=`rgba(${r.map(e=>Math.floor(255*e)).join(", ")})`:this.canvas.style.backgroundColor="transparent",this.gl.clearColor(...r))}setIntrospection(e){return e!==this.introspection?(this.introspection=null!=e&&e,this.updating++,this.updateConfig({normalize:!1}).then(()=>this.updating--)):Promise.resolve()}updateConfig({loading:t=!1,rebuild:r=!0,serialize_funcs:n,texture_nodes:i={},normalize:s=!0,fade_in:o=!1}={}){this.generation=++Sr.generation,this.updating++,this.config=fr.applyGlobalProperties(this.config),s&&fr.normalize(this.config,this.config_bundle,i),fr.hoistTextureNodes(this.config,this.config_bundle,i),this.trigger(t?"load":"update",{config:this.config}),this.style_manager.init(),this.view.reset(),this.createLights(),this.createDataSources(t),this.loadTextures(),this.setBackground(),e.FontManager.loadFonts(this.config.fonts),this.updateStyles();let a=r?this.rebuild(Object.assign({initial:t,new_generation:!1,serialize_funcs:n,fade_in:o},"object"==typeof r&&r)):this.syncConfigToWorker({serialize_funcs:n});return this.updating--,this.view.updateBounds(),this.requestRedraw(),a.then(()=>{this.last_render_count=0,this.requestRedraw()})}syncConfigToWorker({serialize_funcs:t=!0}={}){let r=t?e.Utils.serializeWithFunctions(this.config):JSON.stringify(this.config);return e.WorkerBroker.postMessage(this.workers,"self.updateConfig",{config:r,generation:this.generation,introspection:this.introspection},e.debugSettings)}createListeners(){this.listeners={},this.listeners.view={move:()=>this.trigger("move")},this.view.subscribe(this.listeners.view),this.listeners.texture={update:()=>this.dirty=!0,warning:e=>this.trigger("warning",Object.assign({type:"textures"},e))},e.Texture.subscribe(this.listeners.texture),this.listeners.scene_loader={error:e=>this.trigger("error",Object.assign({type:"scene"},e))},fr.subscribe(this.listeners.scene_loader)}destroyListeners(){this.unsubscribeAll(),this.view.unsubscribe(this.listeners.view),e.Texture.unsubscribe(this.listeners.texture),fr.unsubscribe(this.listeners.scene_loader),this.listeners=null}destroyFeatureSelection(){this.selection&&(this.selection.destroy(),this.selection=null)}resetFeatureSelection(){this.selection=new e.FeatureSelection(this.gl,this.workers,()=>this.building),this.last_render_count=0}resetWorkerFeatureSelection(t=null){this.workers&&e.WorkerBroker.postMessage(this.workers,"self.resetFeatureSelection",t)}getFeatureSelectionMapSize(){return null==this.fetching_selection_map&&(this.fetching_selection_map=e.WorkerBroker.postMessage(this.workers,"self.getFeatureSelectionMapSize").then(e=>(this.fetching_selection_map=null,e.reduce((e,t)=>e+t)))),this.fetching_selection_map}resetTime(){this.start_time=+new Date}updateViewComplete(){!this.render_count_changed&&this.generation===this.last_complete_generation||this.building||this.tile_manager.isLoadingVisibleTiles()||!this.tile_manager.allVisibleTilesLabeled()||(this.tile_manager.updateLabels(),this.last_complete_generation=this.generation,this.trigger("view_complete",{first:!0!==this.view_complete}),this.view_complete=!0)}resetViewComplete(){this.last_complete_generation=null}screenshot({background:e="white"}={}){return this.requestRedraw(),this.media_capture.screenshot({background:e})}startVideoCapture(){return this.requestRedraw(),this.media_capture.startVideoCapture()}stopVideoCapture(){return this.media_capture.stopVideoCapture()}logFirstFrame(){0!==this.last_render_count||this.times.first_frame||(this.times.first_frame=+new Date-this.start_time,e.log("debug",`Scene: initial frame time: ${this.times.first_frame}`))}logFirstBuild(){null==this.times.first_build&&(this.times.first_build=+new Date-this.start_time,e.log("debug",`Scene: initial build time: ${this.times.first_build}`))}}var kr;Sr.id=0,Sr.generation=0;const Or={map:{},scrollWheelZoom:{},doubleClickZoom:{}};var Rr={leafletLayer:function(t){return function(t){if(void 0!==kr)return new kr(t);if(e.Thread.is_main){let r,n=t.leaflet||window.L,i=n.GridLayer?n.GridLayer:n.TileLayer,s=i===n.GridLayer?"1.x":"0.7.x",o={};return i===n.TileLayer&&(o._addTile=function(){},o._removeTile=function(){},o._reset=function(){i.prototype._reset.apply(this,arguments),this.scene&&this.scene.container&&this.scene.canvas&&this.scene.container.appendChild(this.scene.canvas)}),Object.assign(o,{initialize(e){e.showDebug=!!e.showDebug,n.setOptions(this,e),this.updateTangramDebugSettings(),this.createScene(),this.hooks={},this._updating_tangram=!1},createScene(){this.scene=Sr.create(this.options.scene,{numWorkers:this.options.numWorkers,preUpdate:this.options.preUpdate,postUpdate:this.options.postUpdate,continuousZoom:"1.x"===kr.leafletVersion,wrapView:!0!==this.options.noWrap,highDensityDisplay:this.options.highDensityDisplay,logLevel:this.options.logLevel,introspection:this.options.introspection,webGLContextOptions:this.options.webGLContextOptions,disableRenderLoop:this.options.disableRenderLoop})},onAdd(t){this.scene||this.createScene(),i.prototype.onAdd.apply(this,arguments),this.hooks.resize=()=>{this._updating_tangram=!0,this.updateSize(),this._updating_tangram=!1},t.on("resize",this.hooks.resize),this.hooks.move=()=>{if(!this._updating_tangram){this._updating_tangram=!0,this.scene.view.setPanning(!0);var r=t.getCenter();r.zoom=Math.max(Math.min(t.getZoom(),t.getMaxZoom()||e.Geo.default_view_max_zoom),t.getMinZoom()),this.scene.view.setView(r),this._mapLayerCount>1&&this.scene.immediateRedraw(),this._updating_tangram=!1}},t.on("move",this.hooks.move),this.hooks.moveend=()=>{this.scene.view.setPanning(!1),this.scene.requestRedraw()},t.on("moveend",this.hooks.moveend),this.hooks.drag=()=>{this.scene.view.markUserInput()},t.on("drag",this.hooks.drag),this._map_pane_observer=new MutationObserver(e=>{e.forEach(()=>this.reverseTransform())}),this._map_pane_observer.observe(t.getPanes().mapPane,{attributes:!0}),this.modifyScrollWheelBehavior(t),this.modifyZoomBehavior(t),this.trackMapLayerCounts(t),this.setupSelectionEventHandlers(t),this.setSelectionEvents(this.options.events,{radius:this.options.selectionRadius}),this.scene.container=this.getContainer(),this.updateSize(),this.updateView(),this.resizeOnFirstVisible(),this.scene.subscribe({move:this.onTangramViewUpdate.bind(this)}),this.scene.load(this.options.scene,{base_path:this.options.sceneBasePath,file_type:this.options.sceneFileType,blocking:!1}).then(()=>{if(!this.options.attribution)for(const[,e]of Object.entries(this.scene.config.sources))e.attribution&&t.attributionControl.addAttribution(e.attribution);this._updating_tangram=!0,this.updateSize(),this.updateView(),this.reverseTransform(),this._updating_tangram=!1,this.fire("init")}).catch(e=>{this.fire("error",e)})},onRemove(e){i.prototype.onRemove.apply(this,arguments),e.off("layeradd layerremove overlayadd overlayremove",this._updateMapLayerCount),e.off("resize",this.hooks.resize),e.off("move",this.hooks.move),e.off("moveend",this.hooks.moveend),e.off("drag",this.hooks.drag),e.off("click",this.hooks.click),e.off("mousemove",this.hooks.mousemove),e.off("mouseout",this.hooks.mouseout),document.removeEventListener("visibilitychange",this.hooks.visibilitychange),this.hooks={},this._map_pane_observer.disconnect(),this.scene&&(this.scene.destroy(),this.scene=null)},createTile(e){var t=e.x+"/"+e.y+"/"+e.z,r=document.createElement("div");if(r.setAttribute("data-tile-key",t),r.style.width="256px",r.style.height="256px",this.options.showDebug){var n=document.createElement("div");n.textContent=t,n.style.position="absolute",n.style.left=0,n.style.top=0,n.style.color="white",n.style.fontSize="16px",n.style.textOutline="1px #000000",n.style.padding="8px",r.appendChild(n),r.style.borderStyle="solid",r.style.borderColor="white",r.style.borderWidth="1px"}return r},modifyScrollWheelBehavior(e){if(this.scene.view.continuous_zoom&&e.scrollWheelZoom&&!1!==this.options.modifyScrollWheel){e.options.zoomSnap=0;const a=e.scrollWheelZoom.enabled();e.scrollWheelZoom.disable(),n.Browser.chrome||n.Browser.safari?e.scrollWheelZoom._onWheelScroll=function(e){var t=n.DomEvent.getWheelDelta(e);this._delta+=t,this._lastMousePos=this._map.mouseEventToContainerPoint(e),this._performZoom(),n.DomEvent.stop(e)}:e.options.wheelDebounceTime=20;const l=(i=function(e){e._moveEnd(!0),e.fire("viewreset")},s=2*e.options.wheelDebounceTime,function(){var e=this,t=arguments;clearTimeout(o),o=setTimeout(function(){o=null,i.apply(e,t)},s)});Or.scrollWheelZoom._performZoom||(Or.scrollWheelZoom._performZoom=e.scrollWheelZoom._performZoom);var t=this;e.scrollWheelZoom._performZoom=function(){if(this._map===t._map){var e=this._map,n=e.getZoom();e._stop();var i=this._delta/(4*this._map.options.wheelPxPerZoomLevel);this._delta=0,n+i>=this._map.getMaxZoom()?i=this._map.getMaxZoom()-n:n+i<=this._map.getMinZoom()&&(i=this._map.getMinZoom()-n),i&&("center"===e.options.scrollWheelZoom?r(t,e.getCenter(),n+i):r(t,this._lastMousePos,n+i),l(e))}else Or.scrollWheelZoom._performZoom.call(this)},a&&e.scrollWheelZoom.enable()}var i,s,o},modifyZoomBehavior(e){if(this.scene.view.continuous_zoom&&!1!==this.options.modifyZoomBehavior){var t=this;const i=function(t,i,s){e._stop();var o=e._zoom;i=n.latLng(i),s=void 0===s?o:s,s=Math.min(s,e.getMaxZoom());var a=Date.now();return e._moveStart(!0),function l(){var u=(Date.now()-a)/75;u<=1?(e._flyToFrame=n.Util.requestAnimFrame(l,e),r(t,i,o+(s-o)*u)):r(t,i,s)._moveEnd(!0)}.call(e),e};if(e.doubleClickZoom){const r=e.doubleClickZoom.enabled();e.doubleClickZoom.disable(),Or.doubleClickZoom._onDoubleClick||(Or.doubleClickZoom._onDoubleClick=e.doubleClickZoom._onDoubleClick),e.doubleClickZoom._onDoubleClick=function(e){if(this._map===t._map){var r=this._map,n=r.getZoom(),s=r.options.zoomDelta,o=e.originalEvent.shiftKey?n-s:n+s;"center"===r.options.doubleClickZoom?i(t,r.getCenter(),o):i(t,r.containerPointToLatLng(e.containerPoint),o)}else Or.doubleClickZoom._onDoubleClick.call(this,e)},r&&e.doubleClickZoom.enable()}e._zoomAnimated&&(Or.map._animateZoom||(Or.map._animateZoom=e._animateZoom),e._animateZoom=function(e,r,s,o){this===t._map?(s&&(this._animatingZoom=!0,this._animateToCenter=e,this._animateToZoom=r,i(t,e,r)),setTimeout(n.Util.bind(this._onZoomTransitionEnd,this),250)):Or.map._animateZoom.call(this,e,r,s,o)})}},updateView(){var t=this._map.getCenter();t.zoom=Math.max(Math.min(this._map.getZoom(),this._map.getMaxZoom()||e.Geo.default_view_max_zoom),this._map.getMinZoom()),this.scene.view.setView(t)},updateSize(){var e=this._map.getSize();this.scene.resizeMap(e.x,e.y)},resizeOnFirstVisible(){let e=!0;this.hooks.visibilitychange=()=>{e&&(e=!1,this.updateSize())},document.addEventListener("visibilitychange",this.hooks.visibilitychange)},onTangramViewUpdate(){if(!this._map||this._updating_tangram)return;let e=this._map.getCenter(),t=this.scene.view.center;e.lng===t.lng&&e.lat===t.lat&&this._map.getZoom()===this.scene.view.zoom||(this._updating_tangram=!0,this._map.setView([this.scene.view.center.lat,this.scene.view.center.lng],this.scene.view.zoom,{animate:!1}),this._updating_tangram=!1)},render(){this.scene&&this.scene.update()},reverseTransform(){if(this._map&&this.scene&&this.scene.container){var e=this._map.containerPointToLayerPoint([0,0]);n.DomUtil.setPosition(this.scene.container,e)}},setupSelectionEventHandlers(e){this._selection_events={},this._selection_radius=null,this.hooks.click=e=>{"function"==typeof this._selection_events.click&&this.scene.getFeatureAt(e.containerPoint,{radius:this._selection_radius}).then(t=>{let r=Object.assign({},t,{leaflet_event:e});this._selection_events.click(r)})},e.on("click",this.hooks.click),this.hooks.mousemove=e=>{"function"==typeof this._selection_events.hover&&this.scene.getFeatureAt(e.containerPoint,{radius:this._selection_radius}).then(t=>{let r=Object.assign({},t,{leaflet_event:e});this._selection_events.hover(r)})},e.on("mousemove",this.hooks.mousemove),this.hooks.mouseout=e=>{"function"==typeof this._selection_events.hover&&this._selection_events.hover({changed:!0,leaflet_event:e})},e.on("mouseout",this.hooks.mouseout)},setSelectionEvents(e,{radius:t}={}){this._selection_events=Object.assign(this._selection_events,e),this._selection_radius=void 0!==t?t:this._selection_radius},trackMapLayerCounts(e){this._updateMapLayerCount=()=>{let t=e.getPanes().mapPane.childNodes;this._mapLayerCount=0;for(let e=0;e<t.length;e++)this._mapLayerCount+=t[e].childNodes.length},e.on("layeradd layerremove overlayadd overlayremove",this._updateMapLayerCount),this._updateMapLayerCount()},updateTangramDebugSettings(){e.mergeDebugSettings(this.options.debug||{})}}),r=function(e,t,r){var i=e._map,s=e.scene,o=i.getZoomScale(r),a=i.getSize().divideBy(2),l=(t instanceof n.Point?t:i.latLngToContainerPoint(t)).subtract(a).multiplyBy(1-1/o),u=i.containerPointToLatLng(a.add(l));return s&&s.view.markUserInput(),i._move(u,r,{flyTo:!0})},"function"!=typeof(kr=i.extend(o)).remove&&(kr.prototype.remove=function(){this._map&&this._map.removeLayer(this),this.fire("remove")}),kr.layerBaseClass=i,kr.leafletVersion=s,new kr(t)}}(t)},debug:{log:e.log,yaml:ur,Utils:e.Utils,Geo:e.Geo,Vector:e.Vector,DataSource:e.DataSource,GLSL:e.GLSL,ShaderProgram:e.ShaderProgram,VertexData:e.VertexData,Texture:e.Texture,Material:e.Material,Light:e.Light,Scene:Sr,WorkerBroker:e.WorkerBroker,Task:e.Task,StyleManager:e.StyleManager,StyleParser:e.StyleParser,TileID:e.TileID,Collision:e.Collision,FeatureSelection:e.FeatureSelection,TextCanvas:e.TextCanvas,debugSettings:e.debugSettings},version:e.version};return Rr});try{Zg.debug.ESM=!0,Zg.debug.SHA="d0b887d09a3645aad91a18bd3bd0362d74627da3","object"==typeof window&&(window.Tangram=Zg)}catch(Pp){}var Xg=Object.freeze({__proto__:null});export{dh as API_METHODS,oh as ApiService,qg as AuthPage,th as AuthStore,re as Button,Ed as Card,Rt as Checkbox,Qd as DartcomAuthProvider,ih as DartcomMobxProvider,p_ as DartcomProviders,g_ as DateField,ee as DeleteButton,ni as DragList,te as EditButton,Cd as ErrorBoundary,Ct as Form,lh as GlobalConfig,Dt as Input,Ad as LeafletLayer,Q as List,Td as Loader,Rp as LocalizationProvider,__ as Modal,eh as ModalStore,Y as NoData,fh as PanelsNames,lp as QueryProvider,Mt as Select,gh as SourceLayers,nh as StoreContext,yh as TangramSourceNames,ed as TrafficSignStatus,_h as _backendUrl,uh as _testApiKeys,Ch as catIds,ah as createApiService,b_ as encodeString,Wh as getAdminAreaLayers,xd as getAllLayers,bd as getAllPointLayers,yd as getAllPolygonLayers,vd as getAllPolylineLayers,$h as getBuildingLayers,kh as getBuiltupAreaLayers,pd as getCameraLayers,zh as getCityPOILayers,Lh as getConditionLayers,Nh as getDefaultPOI,qh as getFacilityAreaLayers,Gh as getLanduseAreaLayers,Eh as getLaneMarkingLineLayers,Ah as getLaneMarkingPolyLayers,_d as getLayerName,Qh as getLinkLayers,Hh as getNatureFieldLayers,Jh as getNatureForestLayers,Vh as getOceanAreaLayers,Ih as getOneWayLayers,Dh as getPOILayers,Ph as getPOITypeLayer,Th as getParkingLineLayers,md as getPillarLayers,Oh as getPointAddressLayers,jh as getRailroadLayers,wh as getRoadPolyLayers,dd as getTrafficSignImgSrc,hd as getTrafficSignLayers,fd as getTrafficSignalLayers,x_ as getUrlencodedBody,gd as getValidLayer,Uh as getWaterAreaLayers,Bh as getWaterLinkLayers,bh as imagesPath,m_ as modalStyle,ap as queryClient,rh as rootStore,xh as sourceUrl,Rh as text_source,vh as tile_size,id as trafficSignExtension,cd as trafficSignFieldsTitles,od as trafficSignHeights,nd as trafficSignLayerName,td as trafficSignNumbers,sd as trafficSignNumbersSizes,ud as trafficSignStatusOptions,ad as trafficSignTypes,ld as trafficSignTypesOptions,rd as trafficSignWidths,Nt as useFormContext,wd as useGetLeafletLayer,E_ as useGetUser,A_ as useLogout,sh as useRootStore,v_ as useShowErrorSnackbar,y_ as useShowSnackbar,w_ as useSignIn};
|
|
10
|
+
*/var $d,qd,Wd=(Vd||(Vd=1,"production"===process.env.NODE_ENV?jd.exports=function(){if(Id)return Ud;Id=1;var e=n,t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=e.useState,i=e.useEffect,s=e.useLayoutEffect,o=e.useDebugValue;function a(e){var r=e.getSnapshot;e=e.value;try{var n=r();return!t(e,n)}catch(e){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),l=r({inst:{value:n,getSnapshot:t}}),u=l[0].inst,c=l[1];return s(function(){u.value=n,u.getSnapshot=t,a(u)&&c({inst:u})},[e,n,t]),i(function(){return a(u)&&c({inst:u}),e(function(){a(u)&&c({inst:u})})},[e]),o(n),n};return Ud.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:l,Ud}():jd.exports=(Bd||(Bd=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=n,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=t.useState,s=t.useEffect,o=t.useLayoutEffect,a=t.useDebugValue,l=!1,u=!1,c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(n,c){l||void 0===t.startTransition||(l=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var h=c();if(!u){var d=c();r(h,d)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}var f=(d=i({inst:{value:h,getSnapshot:c}}))[0].inst,p=d[1];return o(function(){f.value=h,f.getSnapshot=c,e(f)&&p({inst:f})},[n,h,c]),s(function(){return e(f)&&p({inst:f}),n(function(){e(f)&&p({inst:f})})},[n]),a(h),h};Gd.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:c,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Gd)),jd.exports);function Hd(e){e.reaction=new nu("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),null===(t=e.onStoreChange)||void 0===t||t.call(e)})}var Zd=!0,Kd="function"==typeof Symbol&&Symbol.for,Xd=null!==(qd=null===($d=Object.getOwnPropertyDescriptor(function(){},"name"))||void 0===$d?void 0:$d.configurable)&&void 0!==qd&&qd,Yd=Kd?Symbol.for("react.forward_ref"):"function"==typeof g&&g(function(e){return null}).$$typeof,Qd=Kd?Symbol.for("react.memo"):"function"==typeof h&&h(function(e){return null}).$$typeof;function Jd(e,t){if(process.env.NODE_ENV,Qd&&e.$$typeof===Qd)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var r=!1,i=e,s=e.displayName||e.name;if(Yd&&e.$$typeof===Yd&&(r=!0,"function"!=typeof(i=e.render)))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var o,a,l=function(e,t){return function(e,t){void 0===t&&(t="observed");var r=n.useRef(null);if(!r.current){var i={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(e){return Ld.unregister(i),i.onStoreChange=e,i.reaction||(Hd(i),i.stateVersion=Symbol()),function(){var e;i.onStoreChange=null,null===(e=i.reaction)||void 0===e||e.dispose(),i.reaction=null}},getSnapshot:function(){return i.stateVersion}};r.current=i}var s,o,a=r.current;if(a.reaction||(Hd(a),Ld.register(r,a,a)),n.useDebugValue(a.reaction,zd),Wd.useSyncExternalStore(a.subscribe,a.getSnapshot,a.getSnapshot),a.reaction.track(function(){try{s=e()}catch(e){o=e}}),o)throw o;return s}(function(){return i(e,t)},s)};return l.displayName=e.displayName,Xd&&Object.defineProperty(l,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(l.contextTypes=e.contextTypes,"production"!==process.env.NODE_ENV&&Zd&&(Zd=!1,console.warn("[mobx-react-lite] Support for Legacy Context in function components will be removed in the next major release."))),r&&(l=g(l)),l=h(l),o=e,a=l,Object.keys(o).forEach(function(e){ef[e]||Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(o,e))}),"production"!==process.env.NODE_ENV&&Object.defineProperty(l,"contextTypes",{set:function(){var e,t;throw new Error("[mobx-react-lite] `".concat(this.displayName||(null===(e=this.type)||void 0===e?void 0:e.displayName)||(null===(t=this.type)||void 0===t?void 0:t.name)||"Component",".contextTypes` must be set before applying `observer`."))}}),l}var ef={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};process.env.NODE_ENV,function(e){e||(e=Dd,"production"!==process.env.NODE_ENV&&console.warn("[MobX] Failed to get unstable_batched updates from react-dom / react-native")),Cu({reactionScheduler:e})}($),Ld.finalizeAllImmediately;var tf=Jd(({onUnauthorized:t,children:n})=>{const{authStore:i}=sh();return r.useEffect(()=>{i.isUnauthorized&&t()},[i.isUnauthorized]),e(r.Fragment,{children:n})}),rf=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},nf={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},sf=new class{#e=nf;#t=!1;setTimeoutProvider(e){"production"!==process.env.NODE_ENV&&this.#t&&e!==this.#e&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#e,provider:e}),this.#e=e,"production"!==process.env.NODE_ENV&&(this.#t=!1)}setTimeout(e,t){return"production"!==process.env.NODE_ENV&&(this.#t=!0),this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return"production"!==process.env.NODE_ENV&&(this.#t=!0),this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};var of="undefined"==typeof window||"Deno"in globalThis;function af(){}function lf(e){return"number"==typeof e&&e>=0&&e!==1/0}function uf(e,t){return Math.max(e+(t||0)-Date.now(),0)}function cf(e,t){return"function"==typeof e?e(t):e}function hf(e,t){return"function"==typeof e?e(t):e}function df(e,t){const{type:r="all",exact:n,fetchStatus:i,predicate:s,queryKey:o,stale:a}=e;if(o)if(n){if(t.queryHash!==pf(o,t.options))return!1}else if(!_f(t.queryKey,o))return!1;if("all"!==r){const e=t.isActive();if("active"===r&&!e)return!1;if("inactive"===r&&e)return!1}return("boolean"!=typeof a||t.isStale()===a)&&((!i||i===t.state.fetchStatus)&&!(s&&!s(t)))}function ff(e,t){const{exact:r,status:n,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(r){if(mf(t.options.mutationKey)!==mf(s))return!1}else if(!_f(t.options.mutationKey,s))return!1}return(!n||t.state.status===n)&&!(i&&!i(t))}function pf(e,t){return(t?.queryKeyHashFn||mf)(e)}function mf(e){return JSON.stringify(e,(e,t)=>xf(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function _f(e,t){return e===t||typeof e==typeof t&&(!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&Object.keys(t).every(r=>_f(e[r],t[r])))}var gf=Object.prototype.hasOwnProperty;function yf(e,t){if(e===t)return e;const r=bf(e)&&bf(t);if(!(r||xf(e)&&xf(t)))return t;const n=(r?e:Object.keys(e)).length,i=r?t:Object.keys(t),s=i.length,o=r?new Array(s):{};let a=0;for(let l=0;l<s;l++){const s=r?l:i[l],u=e[s],c=t[s];if(u===c){o[s]=u,(r?l<n:gf.call(e,s))&&a++;continue}if(null===u||null===c||"object"!=typeof u||"object"!=typeof c){o[s]=c;continue}const h=yf(u,c);o[s]=h,h===u&&a++}return n===s&&a===n?e:o}function vf(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function bf(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function xf(e){if(!wf(e))return!1;const t=e.constructor;if(void 0===t)return!0;const r=t.prototype;return!!wf(r)&&(!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype)}function wf(e){return"[object Object]"===Object.prototype.toString.call(e)}function Af(e,t,r){if("function"==typeof r.structuralSharing)return r.structuralSharing(e,t);if(!1!==r.structuralSharing){if("production"!==process.env.NODE_ENV)try{return yf(e,t)}catch(e){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${e}`),e}return yf(e,t)}return t}function Ef(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function Tf(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Sf=Symbol();function kf(e,t){return"production"!==process.env.NODE_ENV&&e.queryFn===Sf&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==Sf?e.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`))}function Of(e,t){return"function"==typeof e?e(...t):!!e}var Rf=new class extends rf{#r;#n;#i;constructor(){super(),this.#i=e=>{if(!of&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#n||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#n?.(),this.#n=void 0)}setEventListener(e){this.#i=e,this.#n?.(),this.#n=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#r!==e&&(this.#r=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#r?this.#r:"hidden"!==globalThis.document?.visibilityState}};function Cf(){let e,t;const r=new Promise((r,n)=>{e=r,t=n});function n(e){Object.assign(r,e),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=t=>{n({status:"fulfilled",value:t}),e(t)},r.reject=e=>{n({status:"rejected",reason:e}),t(e)},r}var Nf=function(e){setTimeout(e,0)};var Pf=function(){let e=[],t=0,r=e=>{e()},n=e=>{e()},i=Nf;const s=n=>{t?e.push(n):i(()=>{r(n)})};return{batch:s=>{let o;t++;try{o=s()}finally{t--,t||(()=>{const t=e;e=[],t.length&&i(()=>{n(()=>{t.forEach(e=>{r(e)})})})})()}return o},batchCalls:e=>(...t)=>{s(()=>{e(...t)})},schedule:s,setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{n=e},setScheduler:e=>{i=e}}}(),Mf=new class extends rf{#s=!0;#n;#i;constructor(){super(),this.#i=e=>{if(!of&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#n||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#n?.(),this.#n=void 0)}setEventListener(e){this.#i=e,this.#n?.(),this.#n=e(this.setOnline.bind(this))}setOnline(e){this.#s!==e&&(this.#s=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#s}};function Df(e){return Math.min(1e3*2**e,3e4)}function zf(e){return"online"!==(e??"online")||Mf.isOnline()}var If=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Ff(e){let t,r=!1,n=0;const i=Cf(),s=()=>"pending"!==i.status,o=()=>Rf.isFocused()&&("always"===e.networkMode||Mf.isOnline())&&e.canRun(),a=()=>zf(e.networkMode)&&e.canRun(),l=e=>{s()||(t?.(),i.resolve(e))},u=e=>{s()||(t?.(),i.reject(e))},c=()=>new Promise(r=>{t=e=>{(s()||o())&&r(e)},e.onPause?.()}).then(()=>{t=void 0,s()||e.onContinue?.()}),h=()=>{if(s())return;let t;const i=0===n?e.initialPromise:void 0;try{t=i??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(l).catch(t=>{if(s())return;const i=e.retry??(of?0:3),a=e.retryDelay??Df,l="function"==typeof a?a(n,t):a,d=!0===i||"number"==typeof i&&n<i||"function"==typeof i&&i(n,t);!r&&d?(n++,e.onFail?.(n,t),function(e){return new Promise(t=>{sf.setTimeout(t,e)})}(l).then(()=>o()?void 0:c()).then(()=>{r?u(t):h()})):u(t)})};return{promise:i,status:()=>i.status,cancel:t=>{if(!s()){const r=new If(t);u(r),e.onCancel?.(r)}},continue:()=>(t?.(),i),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:a,start:()=>(a()?h():c().then(h),i)}}var Lf=class{#o;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),lf(this.gcTime)&&(this.#o=sf.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(of?1/0:3e5))}clearGcTimeout(){this.#o&&(sf.clearTimeout(this.#o),this.#o=void 0)}},jf=class extends Lf{#a;#l;#u;#c;#h;#d;#f;constructor(e){super(),this.#f=!1,this.#d=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#c=e.client,this.#u=this.#c.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#a=Vf(this.options),this.state=e.state??this.#a,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#h?.promise}setOptions(e){if(this.options={...this.#d,...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){const e=Vf(this.options);void 0!==e.data&&(this.setState(Bf(e.data,e.dataUpdatedAt)),this.#a=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,t){const r=Af(this.state.data,e,this.options);return this.#p({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#p({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#h?.promise;return this.#h?.cancel(e),t?t.then(af).catch(af):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#a)}isActive(){return this.observers.some(e=>!1!==hf(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Sf||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===cf(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!uf(this.state.dataUpdatedAt,e))}onFocus(){const e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#h?.continue()}onOnline(){const e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#h?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#h&&(this.#f?this.#h.cancel({revert:!0}):this.#h.cancelRetry()),this.scheduleGc()),this.#u.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#p({type:"invalidate"})}async fetch(e,t){if("idle"!==this.state.fetchStatus&&"rejected"!==this.#h?.status())if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#h)return this.#h.continueRetry(),this.#h.promise;if(e&&this.setOptions(e),!this.options.queryFn){const e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}"production"!==process.env.NODE_ENV&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,n=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#f=!0,r.signal)})},i=()=>{const e=kf(this.options,t),r=(()=>{const e={client:this.#c,queryKey:this.queryKey,meta:this.meta};return n(e),e})();return this.#f=!1,this.options.persister?this.options.persister(e,r,this):e(r)},s=(()=>{const e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#c,state:this.state,fetchFn:i};return n(e),e})();this.options.behavior?.onFetch(s,this),this.#l=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===s.fetchOptions?.meta||this.#p({type:"fetch",meta:s.fetchOptions?.meta}),this.#h=Ff({initialPromise:t?.initialPromise,fn:s.fetchFn,onCancel:e=>{e instanceof If&&e.revert&&this.setState({...this.#l,fetchStatus:"idle"}),r.abort()},onFail:(e,t)=>{this.#p({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#p({type:"pause"})},onContinue:()=>{this.#p({type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0});try{const e=await this.#h.start();if(void 0===e)throw"production"!==process.env.NODE_ENV&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#u.config.onSuccess?.(e,this),this.#u.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof If){if(e.silent)return this.#h.promise;if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw this.#p({type:"error",error:e}),this.#u.config.onError?.(e,this),this.#u.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#p(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...Uf(t.data,this.options),fetchMeta:e.meta??null};case"success":const r={...t,...Bf(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=e.manual?r:void 0,r;case"error":const n=e.error;return{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),Pf.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function Uf(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:zf(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function Bf(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Vf(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,n=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Gf=class extends rf{constructor(e,t){super(),this.options=t,this.#c=e,this.#m=null,this.#_=Cf(),this.bindMethods(),this.setOptions(t)}#c;#g=void 0;#y=void 0;#v=void 0;#b;#x;#_;#m;#w;#A;#E;#T;#S;#k;#O=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#g.addObserver(this),$f(this.#g,this.options)?this.#R():this.updateResult(),this.#C())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return qf(this.#g,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return qf(this.#g,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#N(),this.#P(),this.#g.removeObserver(this)}setOptions(e){const t=this.options,r=this.#g;if(this.options=this.#c.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof hf(this.options.enabled,this.#g))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#M(),this.#g.setOptions(this.options),t._defaulted&&!vf(this.options,t)&&this.#c.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#g,observer:this});const n=this.hasListeners();n&&Wf(this.#g,r,this.options,t)&&this.#R(),this.updateResult(),!n||this.#g===r&&hf(this.options.enabled,this.#g)===hf(t.enabled,this.#g)&&cf(this.options.staleTime,this.#g)===cf(t.staleTime,this.#g)||this.#D();const i=this.#z();!n||this.#g===r&&hf(this.options.enabled,this.#g)===hf(t.enabled,this.#g)&&i===this.#k||this.#I(i)}getOptimisticResult(e){const t=this.#c.getQueryCache().build(this.#c,e),r=this.createResult(t,e);return function(e,t){if(!vf(e.getCurrentResult(),t))return!0;return!1}(this,r)&&(this.#v=r,this.#x=this.options,this.#b=this.#g.state),r}getCurrentResult(){return this.#v}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#_.status||this.#_.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#O.add(e)}getCurrentQuery(){return this.#g}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#c.defaultQueryOptions(e),r=this.#c.getQueryCache().build(this.#c,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#R({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#v))}#R(e){this.#M();let t=this.#g.fetch(this.options,e);return e?.throwOnError||(t=t.catch(af)),t}#D(){this.#N();const e=cf(this.options.staleTime,this.#g);if(of||this.#v.isStale||!lf(e))return;const t=uf(this.#v.dataUpdatedAt,e)+1;this.#T=sf.setTimeout(()=>{this.#v.isStale||this.updateResult()},t)}#z(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#g):this.options.refetchInterval)??!1}#I(e){this.#P(),this.#k=e,!of&&!1!==hf(this.options.enabled,this.#g)&&lf(this.#k)&&0!==this.#k&&(this.#S=sf.setInterval(()=>{(this.options.refetchIntervalInBackground||Rf.isFocused())&&this.#R()},this.#k))}#C(){this.#D(),this.#I(this.#z())}#N(){this.#T&&(sf.clearTimeout(this.#T),this.#T=void 0)}#P(){this.#S&&(sf.clearInterval(this.#S),this.#S=void 0)}createResult(e,t){const r=this.#g,n=this.options,i=this.#v,s=this.#b,o=this.#x,a=e!==r?e.state:this.#y,{state:l}=e;let u,c={...l},h=!1;if(t._optimisticResults){const i=this.hasListeners(),s=!i&&$f(e,t),o=i&&Wf(e,r,t,n);(s||o)&&(c={...c,...Uf(l.data,e.options)}),"isRestoring"===t._optimisticResults&&(c.fetchStatus="idle")}let{error:d,errorUpdatedAt:f,status:p}=c;u=c.data;let m=!1;if(void 0!==t.placeholderData&&void 0===u&&"pending"===p){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,m=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#E?.state.data,this.#E):t.placeholderData,void 0!==e&&(p="success",u=Af(i?.data,e,t),h=!0)}if(t.select&&void 0!==u&&!m)if(i&&u===s?.data&&t.select===this.#w)u=this.#A;else try{this.#w=t.select,u=t.select(u),u=Af(i?.data,u,t),this.#A=u,this.#m=null}catch(e){this.#m=e}this.#m&&(d=this.#m,u=this.#A,f=Date.now(),p="error");const _="fetching"===c.fetchStatus,g="pending"===p,y="error"===p,v=g&&_,b=void 0!==u,x={status:p,fetchStatus:c.fetchStatus,isPending:g,isSuccess:"success"===p,isError:y,isInitialLoading:v,isLoading:v,data:u,dataUpdatedAt:c.dataUpdatedAt,error:d,errorUpdatedAt:f,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>a.dataUpdateCount||c.errorUpdateCount>a.errorUpdateCount,isFetching:_,isRefetching:_&&!g,isLoadingError:y&&!b,isPaused:"paused"===c.fetchStatus,isPlaceholderData:h,isRefetchError:y&&b,isStale:Hf(e,t),refetch:this.refetch,promise:this.#_,isEnabled:!1!==hf(t.enabled,e)};if(this.options.experimental_prefetchInRender){const t=e=>{"error"===x.status?e.reject(x.error):void 0!==x.data&&e.resolve(x.data)},n=()=>{const e=this.#_=x.promise=Cf();t(e)},i=this.#_;switch(i.status){case"pending":e.queryHash===r.queryHash&&t(i);break;case"fulfilled":"error"!==x.status&&x.data===i.value||n();break;case"rejected":"error"===x.status&&x.error===i.reason||n()}}return x}updateResult(){const e=this.#v,t=this.createResult(this.#g,this.options);if(this.#b=this.#g.state,this.#x=this.options,void 0!==this.#b.data&&(this.#E=this.#g),vf(t,e))return;this.#v=t;this.#F({listeners:(()=>{if(!e)return!0;const{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#O.size)return!0;const n=new Set(r??this.#O);return this.options.throwOnError&&n.add("error"),Object.keys(this.#v).some(t=>{const r=t;return this.#v[r]!==e[r]&&n.has(r)})})()})}#M(){const e=this.#c.getQueryCache().build(this.#c,this.options);if(e===this.#g)return;const t=this.#g;this.#g=e,this.#y=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#C()}#F(e){Pf.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#v)}),this.#c.getQueryCache().notify({query:this.#g,type:"observerResultsUpdated"})})}};function $f(e,t){return function(e,t){return!1!==hf(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===t.retryOnMount)}(e,t)||void 0!==e.state.data&&qf(e,t,t.refetchOnMount)}function qf(e,t,r){if(!1!==hf(t.enabled,e)&&"static"!==cf(t.staleTime,e)){const n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&Hf(e,t)}return!1}function Wf(e,t,r,n){return(e!==t||!1===hf(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&Hf(e,r)}function Hf(e,t){return!1!==hf(t.enabled,e)&&e.isStaleByTime(cf(t.staleTime,e))}function Zf(e){return{onFetch:(t,r)=>{const n=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],o=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let r=!1;const u=kf(t.options,t.fetchOptions),c=async(e,n,i)=>{if(r)return Promise.reject();if(null==n&&e.pages.length)return Promise.resolve(e);const s=(()=>{const e={client:t.client,queryKey:t.queryKey,pageParam:n,direction:i?"backward":"forward",meta:t.options.meta};return(e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)})})(e),e})(),o=await u(s),{maxPages:a}=t.options,l=i?Tf:Ef;return{pages:l(e.pages,o,a),pageParams:l(e.pageParams,n,a)}};if(i&&s.length){const e="backward"===i,t={pages:s,pageParams:o},r=(e?Xf:Kf)(n,t);a=await c(t,r,e)}else{const t=e??s.length;do{const e=0===l?o[0]??n.initialPageParam:Kf(n,a);if(l>0&&null==e)break;a=await c(a,e),l++}while(l<t)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function Kf(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function Xf(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Yf=class extends Lf{#c;#L;#j;#h;constructor(e){super(),this.#c=e.client,this.mutationId=e.mutationId,this.#j=e.mutationCache,this.#L=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#L.includes(e)||(this.#L.push(e),this.clearGcTimeout(),this.#j.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#L=this.#L.filter(t=>t!==e),this.scheduleGc(),this.#j.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#L.length||("pending"===this.state.status?this.scheduleGc():this.#j.remove(this))}continue(){return this.#h?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#p({type:"continue"})},r={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#h=Ff({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(e,t)=>{this.#p({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#p({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#j.canRun(this)});const n="pending"===this.state.status,i=!this.#h.canStart();try{if(n)t();else{this.#p({type:"pending",variables:e,isPaused:i}),await(this.#j.config.onMutate?.(e,this,r));const t=await(this.options.onMutate?.(e,r));t!==this.state.context&&this.#p({type:"pending",context:t,variables:e,isPaused:i})}const s=await this.#h.start();return await(this.#j.config.onSuccess?.(s,e,this.state.context,this,r)),await(this.options.onSuccess?.(s,e,this.state.context,r)),await(this.#j.config.onSettled?.(s,null,this.state.variables,this.state.context,this,r)),await(this.options.onSettled?.(s,null,e,this.state.context,r)),this.#p({type:"success",data:s}),s}catch(t){try{throw await(this.#j.config.onError?.(t,e,this.state.context,this,r)),await(this.options.onError?.(t,e,this.state.context,r)),await(this.#j.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r)),await(this.options.onSettled?.(void 0,t,e,this.state.context,r)),t}finally{this.#p({type:"error",error:t})}}finally{this.#j.runNext(this)}}#p(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),Pf.batch(()=>{this.#L.forEach(t=>{t.onMutationUpdate(e)}),this.#j.notify({mutation:this,type:"updated",action:e})})}};var Qf=class extends rf{constructor(e={}){super(),this.config=e,this.#U=new Set,this.#B=new Map,this.#V=0}#U;#B;#V;build(e,t,r){const n=new Yf({client:e,mutationCache:this,mutationId:++this.#V,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#U.add(e);const t=Jf(e);if("string"==typeof t){const r=this.#B.get(t);r?r.push(e):this.#B.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#U.delete(e)){const t=Jf(e);if("string"==typeof t){const r=this.#B.get(t);if(r)if(r.length>1){const t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#B.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Jf(e);if("string"==typeof t){const r=this.#B.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}return!0}runNext(e){const t=Jf(e);if("string"==typeof t){const r=this.#B.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}return Promise.resolve()}clear(){Pf.batch(()=>{this.#U.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#U.clear(),this.#B.clear()})}getAll(){return Array.from(this.#U)}find(e){const t={exact:!0,...e};return this.getAll().find(e=>ff(t,e))}findAll(e={}){return this.getAll().filter(t=>ff(e,t))}notify(e){Pf.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(e=>e.state.isPaused);return Pf.batch(()=>Promise.all(e.map(e=>e.continue().catch(af))))}};function Jf(e){return e.options.scope?.id}var ep=class extends rf{#c;#v=void 0;#G;#$;constructor(e,t){super(),this.#c=e,this.setOptions(t),this.bindMethods(),this.#q()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#c.defaultMutationOptions(e),vf(this.options,t)||this.#c.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#G,observer:this}),t?.mutationKey&&this.options.mutationKey&&mf(t.mutationKey)!==mf(this.options.mutationKey)?this.reset():"pending"===this.#G?.state.status&&this.#G.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#G?.removeObserver(this)}onMutationUpdate(e){this.#q(),this.#F(e)}getCurrentResult(){return this.#v}reset(){this.#G?.removeObserver(this),this.#G=void 0,this.#q(),this.#F()}mutate(e,t){return this.#$=t,this.#G?.removeObserver(this),this.#G=this.#c.getMutationCache().build(this.#c,this.options),this.#G.addObserver(this),this.#G.execute(e)}#q(){const e=this.#G?.state??{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0};this.#v={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#F(e){Pf.batch(()=>{if(this.#$&&this.hasListeners()){const t=this.#v.variables,r=this.#v.context,n={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};"success"===e?.type?(this.#$.onSuccess?.(e.data,t,r,n),this.#$.onSettled?.(e.data,null,t,r,n)):"error"===e?.type&&(this.#$.onError?.(e.error,t,r,n),this.#$.onSettled?.(void 0,e.error,t,r,n))}this.listeners.forEach(e=>{e(this.#v)})})}},tp=class extends rf{constructor(e={}){super(),this.config=e,this.#W=new Map}#W;build(e,t,r){const n=t.queryKey,i=t.queryHash??pf(n,t);let s=this.get(i);return s||(s=new jf({client:e,queryKey:n,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(s)),s}add(e){this.#W.has(e.queryHash)||(this.#W.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#W.get(e.queryHash);t&&(e.destroy(),t===e&&this.#W.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Pf.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#W.get(e)}getAll(){return[...this.#W.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(e=>df(t,e))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(t=>df(e,t)):t}notify(e){Pf.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Pf.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Pf.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},rp=r.createContext(void 0),np=e=>{const t=r.useContext(rp);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},ip=({client:t,children:n})=>(r.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),e(rp.Provider,{value:t,children:n})),sp=r.createContext(!1);sp.Provider;var op=r.createContext(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),ap=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function lp(e,t,n){if("production"!==process.env.NODE_ENV&&("object"!=typeof e||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const i=r.useContext(sp),s=r.useContext(op),o=np(),a=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(a),"production"!==process.env.NODE_ENV&&(a.queryFn||console.error(`[${a.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),a._optimisticResults=i?"isRestoring":"optimistic",(e=>{if(e.suspense){const t=1e3,r=e=>"static"===e?e:Math.max(e??t,t),n=e.staleTime;e.staleTime="function"==typeof n?(...e)=>r(n(...e)):r(n),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,t))}})(a),((e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))})(a,s),(e=>{r.useEffect(()=>{e.clearReset()},[e])})(s);const l=!o.getQueryCache().get(a.queryHash),[u]=r.useState(()=>new t(o,a)),c=u.getOptimisticResult(a),h=!i&&!1!==e.subscribed;if(r.useSyncExternalStore(r.useCallback(e=>{const t=h?u.subscribe(Pf.batchCalls(e)):af;return u.updateResult(),t},[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),r.useEffect(()=>{u.setOptions(a)},[a,u]),((e,t)=>e?.suspense&&t.isPending)(a,c))throw ap(a,u,s);if((({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(i&&void 0===e.data||Of(r,[e.error,n])))({result:c,errorResetBoundary:s,throwOnError:a.throwOnError,query:o.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw c.error;if(o.getDefaultOptions().queries?._experimental_afterQuery?.(a,c),a.experimental_prefetchInRender&&!of&&((e,t)=>e.isLoading&&e.isFetching&&!t)(c,i)){const e=l?ap(a,u,s):o.getQueryCache().get(a.queryHash)?.promise;e?.catch(af).finally(()=>{u.updateResult()})}return a.notifyOnChangeProps?c:u.trackResult(c)}function up(e,t){const n=np(),[i]=r.useState(()=>new ep(n,e));r.useEffect(()=>{i.setOptions(e)},[i,e]);const s=r.useSyncExternalStore(r.useCallback(e=>i.subscribe(Pf.batchCalls(e)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),o=r.useCallback((e,t)=>{i.mutate(e,t).catch(af)},[i]);if(s.error&&Of(i.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}const cp=new class{#H;#j;#d;#Z;#K;#X;#Y;#Q;constructor(e={}){this.#H=e.queryCache||new tp,this.#j=e.mutationCache||new Qf,this.#d=e.defaultOptions||{},this.#Z=new Map,this.#K=new Map,this.#X=0}mount(){this.#X++,1===this.#X&&(this.#Y=Rf.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#H.onFocus())}),this.#Q=Mf.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#H.onOnline())}))}unmount(){this.#X--,0===this.#X&&(this.#Y?.(),this.#Y=void 0,this.#Q?.(),this.#Q=void 0)}isFetching(e){return this.#H.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#j.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#H.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=this.#H.build(this,t),n=r.state.data;return void 0===n?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(cf(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#H.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),i=this.#H.get(n.queryHash),s=i?.state.data,o=function(e,t){return"function"==typeof e?e(t):e}(t,s);if(void 0!==o)return this.#H.build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return Pf.batch(()=>this.#H.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#H.get(t.queryHash)?.state}removeQueries(e){const t=this.#H;Pf.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){const r=this.#H;return Pf.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=Pf.batch(()=>this.#H.findAll(e).map(e=>e.cancel(r)));return Promise.all(n).then(af).catch(af)}invalidateQueries(e,t={}){return Pf.batch(()=>(this.#H.findAll(e).forEach(e=>{e.invalidate()}),"none"===e?.refetchType?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=Pf.batch(()=>this.#H.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(af)),"paused"===e.state.fetchStatus?Promise.resolve():t}));return Promise.all(n).then(af)}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const r=this.#H.build(this,t);return r.isStaleByTime(cf(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(af).catch(af)}fetchInfiniteQuery(e){return e.behavior=Zf(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(af).catch(af)}ensureInfiniteQueryData(e){return e.behavior=Zf(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Mf.isOnline()?this.#j.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#H}getMutationCache(){return this.#j}getDefaultOptions(){return this.#d}setDefaultOptions(e){this.#d=e}setQueryDefaults(e,t){this.#Z.set(mf(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#Z.values()],r={};return t.forEach(t=>{_f(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#K.set(mf(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#K.values()],r={};return t.forEach(t=>{_f(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#d.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=pf(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Sf&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#d.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#H.clear(),this.#j.clear()}},hp=t=>e(ip,{...t,client:cp});function dp(e,t){if(void 0!==e.one&&1===t)return e.one;const r=t%10,n=t%100;return 1===r&&11!==n?e.singularNominative.replace("{{count}}",String(t)):r>=2&&r<=4&&(n<10||n>20)?e.singularGenitive.replace("{{count}}",String(t)):e.pluralGenitive.replace("{{count}}",String(t))}function fp(e){return(t,r)=>r?.addSuffix?r.comparison&&r.comparison>0?e.future?dp(e.future,t):"через "+dp(e.regular,t):e.past?dp(e.past,t):dp(e.regular,t)+" назад":dp(e.regular,t)}const pp={lessThanXSeconds:fp({regular:{one:"меньше секунды",singularNominative:"меньше {{count}} секунды",singularGenitive:"меньше {{count}} секунд",pluralGenitive:"меньше {{count}} секунд"},future:{one:"меньше, чем через секунду",singularNominative:"меньше, чем через {{count}} секунду",singularGenitive:"меньше, чем через {{count}} секунды",pluralGenitive:"меньше, чем через {{count}} секунд"}}),xSeconds:fp({regular:{singularNominative:"{{count}} секунда",singularGenitive:"{{count}} секунды",pluralGenitive:"{{count}} секунд"},past:{singularNominative:"{{count}} секунду назад",singularGenitive:"{{count}} секунды назад",pluralGenitive:"{{count}} секунд назад"},future:{singularNominative:"через {{count}} секунду",singularGenitive:"через {{count}} секунды",pluralGenitive:"через {{count}} секунд"}}),halfAMinute:(e,t)=>t?.addSuffix?t.comparison&&t.comparison>0?"через полминуты":"полминуты назад":"полминуты",lessThanXMinutes:fp({regular:{one:"меньше минуты",singularNominative:"меньше {{count}} минуты",singularGenitive:"меньше {{count}} минут",pluralGenitive:"меньше {{count}} минут"},future:{one:"меньше, чем через минуту",singularNominative:"меньше, чем через {{count}} минуту",singularGenitive:"меньше, чем через {{count}} минуты",pluralGenitive:"меньше, чем через {{count}} минут"}}),xMinutes:fp({regular:{singularNominative:"{{count}} минута",singularGenitive:"{{count}} минуты",pluralGenitive:"{{count}} минут"},past:{singularNominative:"{{count}} минуту назад",singularGenitive:"{{count}} минуты назад",pluralGenitive:"{{count}} минут назад"},future:{singularNominative:"через {{count}} минуту",singularGenitive:"через {{count}} минуты",pluralGenitive:"через {{count}} минут"}}),aboutXHours:fp({regular:{singularNominative:"около {{count}} часа",singularGenitive:"около {{count}} часов",pluralGenitive:"около {{count}} часов"},future:{singularNominative:"приблизительно через {{count}} час",singularGenitive:"приблизительно через {{count}} часа",pluralGenitive:"приблизительно через {{count}} часов"}}),xHours:fp({regular:{singularNominative:"{{count}} час",singularGenitive:"{{count}} часа",pluralGenitive:"{{count}} часов"}}),xDays:fp({regular:{singularNominative:"{{count}} день",singularGenitive:"{{count}} дня",pluralGenitive:"{{count}} дней"}}),aboutXWeeks:fp({regular:{singularNominative:"около {{count}} недели",singularGenitive:"около {{count}} недель",pluralGenitive:"около {{count}} недель"},future:{singularNominative:"приблизительно через {{count}} неделю",singularGenitive:"приблизительно через {{count}} недели",pluralGenitive:"приблизительно через {{count}} недель"}}),xWeeks:fp({regular:{singularNominative:"{{count}} неделя",singularGenitive:"{{count}} недели",pluralGenitive:"{{count}} недель"}}),aboutXMonths:fp({regular:{singularNominative:"около {{count}} месяца",singularGenitive:"около {{count}} месяцев",pluralGenitive:"около {{count}} месяцев"},future:{singularNominative:"приблизительно через {{count}} месяц",singularGenitive:"приблизительно через {{count}} месяца",pluralGenitive:"приблизительно через {{count}} месяцев"}}),xMonths:fp({regular:{singularNominative:"{{count}} месяц",singularGenitive:"{{count}} месяца",pluralGenitive:"{{count}} месяцев"}}),aboutXYears:fp({regular:{singularNominative:"около {{count}} года",singularGenitive:"около {{count}} лет",pluralGenitive:"около {{count}} лет"},future:{singularNominative:"приблизительно через {{count}} год",singularGenitive:"приблизительно через {{count}} года",pluralGenitive:"приблизительно через {{count}} лет"}}),xYears:fp({regular:{singularNominative:"{{count}} год",singularGenitive:"{{count}} года",pluralGenitive:"{{count}} лет"}}),overXYears:fp({regular:{singularNominative:"больше {{count}} года",singularGenitive:"больше {{count}} лет",pluralGenitive:"больше {{count}} лет"},future:{singularNominative:"больше, чем через {{count}} год",singularGenitive:"больше, чем через {{count}} года",pluralGenitive:"больше, чем через {{count}} лет"}}),almostXYears:fp({regular:{singularNominative:"почти {{count}} год",singularGenitive:"почти {{count}} года",pluralGenitive:"почти {{count}} лет"},future:{singularNominative:"почти через {{count}} год",singularGenitive:"почти через {{count}} года",pluralGenitive:"почти через {{count}} лет"}})};function mp(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const _p={date:mp({formats:{full:"EEEE, d MMMM y 'г.'",long:"d MMMM y 'г.'",medium:"d MMM y 'г.'",short:"dd.MM.y"},defaultWidth:"full"}),time:mp({formats:{full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},defaultWidth:"full"}),dateTime:mp({formats:{any:"{{date}}, {{time}}"},defaultWidth:"any"})},gp=Symbol.for("constructDateFrom");function yp(e,t){return"function"==typeof e?e(t):e&&"object"==typeof e&&gp in e?e[gp](t):e instanceof Date?new e.constructor(t):new Date(t)}let vp={};function bp(){return vp}function xp(e,t){const r=bp(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,i=(s=e,o=t?.in,yp(o||s,s));var s,o;const a=i.getDay(),l=(a<n?7:0)+a-n;return i.setDate(i.getDate()-l),i.setHours(0,0,0,0),i}function wp(e,t,r){const[n,i]=function(e,...t){const r=yp.bind(null,e||t.find(e=>"object"==typeof e));return t.map(r)}(r?.in,e,t);return+xp(n,r)===+xp(i,r)}const Ap=["воскресенье","понедельник","вторник","среду","четверг","пятницу","субботу"];function Ep(e){const t=Ap[e];return 2===e?"'во "+t+" в' p":"'в "+t+" в' p"}const Tp={lastWeek:(e,t,r)=>{const n=e.getDay();return wp(e,t,r)?Ep(n):function(e){const t=Ap[e];switch(e){case 0:return"'в прошлое "+t+" в' p";case 1:case 2:case 4:return"'в прошлый "+t+" в' p";case 3:case 5:case 6:return"'в прошлую "+t+" в' p"}}(n)},yesterday:"'вчера в' p",today:"'сегодня в' p",tomorrow:"'завтра в' p",nextWeek:(e,t,r)=>{const n=e.getDay();return wp(e,t,r)?Ep(n):function(e){const t=Ap[e];switch(e){case 0:return"'в следующее "+t+" в' p";case 1:case 2:case 4:return"'в следующий "+t+" в' p";case 3:case 5:case 6:return"'в следующую "+t+" в' p"}}(n)},other:"P"};function Sp(e){return(t,r)=>{let n;if("formatting"===(r?.context?String(r.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=r?.width?String(r.width):t;n=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=r?.width?String(r.width):e.defaultWidth;n=e.values[i]||e.values[t]}return n[e.argumentCallback?e.argumentCallback(t):t]}}const kp={ordinalNumber:(e,t)=>{const r=Number(e),n=t?.unit;let i;return i="date"===n?"-е":"week"===n||"minute"===n||"second"===n?"-я":"-й",r+i},era:Sp({values:{narrow:["до н.э.","н.э."],abbreviated:["до н. э.","н. э."],wide:["до нашей эры","нашей эры"]},defaultWidth:"wide"}),quarter:Sp({values:{narrow:["1","2","3","4"],abbreviated:["1-й кв.","2-й кв.","3-й кв.","4-й кв."],wide:["1-й квартал","2-й квартал","3-й квартал","4-й квартал"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:Sp({values:{narrow:["Я","Ф","М","А","М","И","И","А","С","О","Н","Д"],abbreviated:["янв.","фев.","март","апр.","май","июнь","июль","авг.","сент.","окт.","нояб.","дек."],wide:["январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"]},defaultWidth:"wide",formattingValues:{narrow:["Я","Ф","М","А","М","И","И","А","С","О","Н","Д"],abbreviated:["янв.","фев.","мар.","апр.","мая","июн.","июл.","авг.","сент.","окт.","нояб.","дек."],wide:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"]},defaultFormattingWidth:"wide"}),day:Sp({values:{narrow:["В","П","В","С","Ч","П","С"],short:["вс","пн","вт","ср","чт","пт","сб"],abbreviated:["вск","пнд","втр","срд","чтв","птн","суб"],wide:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"]},defaultWidth:"wide"}),dayPeriod:Sp({values:{narrow:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утро",afternoon:"день",evening:"веч.",night:"ночь"},abbreviated:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утро",afternoon:"день",evening:"веч.",night:"ночь"},wide:{am:"ДП",pm:"ПП",midnight:"полночь",noon:"полдень",morning:"утро",afternoon:"день",evening:"вечер",night:"ночь"}},defaultWidth:"any",formattingValues:{narrow:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утра",afternoon:"дня",evening:"веч.",night:"ночи"},abbreviated:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утра",afternoon:"дня",evening:"веч.",night:"ночи"},wide:{am:"ДП",pm:"ПП",midnight:"полночь",noon:"полдень",morning:"утра",afternoon:"дня",evening:"вечера",night:"ночи"}},defaultFormattingWidth:"wide"})};function Op(e){return(t,r={})=>{const n=r.width,i=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],s=t.match(i);if(!s)return null;const o=s[0],a=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?function(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r;return}(a,e=>e.test(o)):function(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r;return}(a,e=>e.test(o));let u;u=e.valueCallback?e.valueCallback(l):l,u=r.valueCallback?r.valueCallback(u):u;return{value:u,rest:t.slice(o.length)}}}const Rp={ordinalNumber:(Cp={matchPattern:/^(\d+)(-?(е|я|й|ое|ье|ая|ья|ый|ой|ий|ый))?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const r=e.match(Cp.matchPattern);if(!r)return null;const n=r[0],i=e.match(Cp.parsePattern);if(!i)return null;let s=Cp.valueCallback?Cp.valueCallback(i[0]):i[0];return s=t.valueCallback?t.valueCallback(s):s,{value:s,rest:e.slice(n.length)}}),era:Op({matchPatterns:{narrow:/^((до )?н\.?\s?э\.?)/i,abbreviated:/^((до )?н\.?\s?э\.?)/i,wide:/^(до нашей эры|нашей эры|наша эра)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^д/i,/^н/i]},defaultParseWidth:"any"}),quarter:Op({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^[1234](-?[ыои]?й?)? кв.?/i,wide:/^[1234](-?[ыои]?й?)? квартал/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:Op({matchPatterns:{narrow:/^[яфмаисонд]/i,abbreviated:/^(янв|фев|март?|апр|ма[йя]|июн[ья]?|июл[ья]?|авг|сент?|окт|нояб?|дек)\.?/i,wide:/^(январ[ья]|феврал[ья]|марта?|апрел[ья]|ма[йя]|июн[ья]|июл[ья]|августа?|сентябр[ья]|октябр[ья]|октябр[ья]|ноябр[ья]|декабр[ья])/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^я/i,/^ф/i,/^м/i,/^а/i,/^м/i,/^и/i,/^и/i,/^а/i,/^с/i,/^о/i,/^н/i,/^я/i],any:[/^я/i,/^ф/i,/^мар/i,/^ап/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^ав/i,/^с/i,/^о/i,/^н/i,/^д/i]},defaultParseWidth:"any"}),day:Op({matchPatterns:{narrow:/^[впсч]/i,short:/^(вс|во|пн|по|вт|ср|чт|че|пт|пя|сб|су)\.?/i,abbreviated:/^(вск|вос|пнд|пон|втр|вто|срд|сре|чтв|чет|птн|пят|суб).?/i,wide:/^(воскресень[ея]|понедельника?|вторника?|сред[аы]|четверга?|пятниц[аы]|суббот[аы])/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^в/i,/^п/i,/^в/i,/^с/i,/^ч/i,/^п/i,/^с/i],any:[/^в[ос]/i,/^п[он]/i,/^в/i,/^ср/i,/^ч/i,/^п[ят]/i,/^с[уб]/i]},defaultParseWidth:"any"}),dayPeriod:Op({matchPatterns:{narrow:/^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,abbreviated:/^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,wide:/^([дп]п|полночь|полдень|утр[оа]|день|дня|вечера?|ноч[ьи])/i},defaultMatchWidth:"wide",parsePatterns:{any:{am:/^дп/i,pm:/^пп/i,midnight:/^полн/i,noon:/^полд/i,morning:/^у/i,afternoon:/^д[ен]/i,evening:/^в/i,night:/^н/i}},defaultParseWidth:"any"})};var Cp;const Np={code:"ru",formatDistance:(e,t,r)=>pp[e](t,r),formatLong:_p,formatRelative:(e,t,r,n)=>{const i=Tp[e];return"function"==typeof i?i(t,r,n):i},localize:kp,match:Rp,options:{weekStartsOn:1,firstWeekContainsDate:1}},Pp=t=>e(Z,{...t,dateAdapter:K,adapterLocale:Np});function Mp(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=Mp(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function Dp(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=Mp(e))&&(n&&(n+=" "),n+=t);return n}let zp={data:""},Ip=e=>{if("object"==typeof window){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||zp},Fp=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Lp=/\/\*[^]*?\*\/| +/g,jp=/\n+/g,Up=(e,t)=>{let r="",n="",i="";for(let s in e){let o=e[s];"@"==s[0]?"i"==s[1]?r=s+" "+o+";":n+="f"==s[1]?Up(o,s):s+"{"+Up(o,"k"==s[1]?"":t)+"}":"object"==typeof o?n+=Up(o,t?t.replace(/([^,])+/g,e=>s.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):s):null!=o&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=Up.p?Up.p(s,o):s+":"+o+";")}return r+(t&&i?t+"{"+i+"}":i)+n},Bp={},Vp=e=>{if("object"==typeof e){let t="";for(let r in e)t+=r+Vp(e[r]);return t}return e},Gp=(e,t,r,n,i)=>{let s=Vp(e),o=Bp[s]||(Bp[s]=(e=>{let t=0,r=11;for(;t<e.length;)r=101*r+e.charCodeAt(t++)>>>0;return"go"+r})(s));if(!Bp[o]){let t=s!==e?e:(e=>{let t,r,n=[{}];for(;t=Fp.exec(e.replace(Lp,""));)t[4]?n.shift():t[3]?(r=t[3].replace(jp," ").trim(),n.unshift(n[0][r]=n[0][r]||{})):n[0][t[1]]=t[2].replace(jp," ").trim();return n[0]})(e);Bp[o]=Up(i?{["@keyframes "+o]:t}:t,r?"":"."+o)}let a=r&&Bp.g?Bp.g:null;return r&&(Bp.g=Bp[o]),((e,t,r,n)=>{n?t.data=t.data.replace(n,e):-1===t.data.indexOf(e)&&(t.data=r?e+t.data:t.data+e)})(Bp[o],t,n,a),o};function $p(e){let t=this||{},r=e.call?e(t.p):e;return Gp(r.unshift?r.raw?((e,t,r)=>e.reduce((e,n,i)=>{let s=t[i];if(s&&s.call){let e=s(r),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;s=t?"."+t:e&&"object"==typeof e?e.props?"":Up(e,""):!1===e?"":e}return e+n+(null==s?"":s)},""))(r,[].slice.call(arguments,1),t.p):r.reduce((e,r)=>Object.assign(e,r&&r.call?r(t.p):r),{}):r,Ip(t.target),t.g,t.o,t.k)}function qp(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function Wp(){return Wp=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Wp.apply(this,arguments)}function Hp(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function Zp(e,t){if(null==e)return{};var r,n,i={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}function Kp(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}$p.bind({g:1}),$p.bind({k:1});var Xp=function(){return""},Yp=n.createContext({enqueueSnackbar:Xp,closeSnackbar:Xp}),Qp="@media (max-width:599.95px)",Jp="@media (min-width:600px)",em=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},tm=function(e){return""+em(e.vertical)+em(e.horizontal)},rm=function(e){return!!e||0===e},nm="unmounted",im="exited",sm="entering",om="entered",am="exiting",lm=function(e){function t(t){var r;r=e.call(this,t)||this;var n,i=t.appear;return r.appearStatus=null,t.in?i?(n=im,r.appearStatus=sm):n=om:n=t.unmountOnExit||t.mountOnEnter?nm:im,r.state={status:n},r.nextCallback=null,r}Hp(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===nm?{status:im}:null};var r=t.prototype;return r.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},r.componentDidUpdate=function(e){var t=null;if(e!==this.props){var r=this.state.status;this.props.in?r!==sm&&r!==om&&(t=sm):r!==sm&&r!==om||(t=am)}this.updateStatus(!1,t)},r.componentWillUnmount=function(){this.cancelNextCallback()},r.getTimeouts=function(){var e=this.props.timeout,t=e,r=e;return null!=e&&"number"!=typeof e&&"string"!=typeof e&&(r=e.exit,t=e.enter),{exit:r,enter:t}},r.updateStatus=function(e,t){void 0===e&&(e=!1),null!==t?(this.cancelNextCallback(),t===sm?this.performEnter(e):this.performExit()):this.props.unmountOnExit&&this.state.status===im&&this.setState({status:nm})},r.performEnter=function(e){var t=this,r=this.props.enter,n=e,i=this.getTimeouts();e||r?(this.props.onEnter&&this.props.onEnter(this.node,n),this.safeSetState({status:sm},function(){t.props.onEntering&&t.props.onEntering(t.node,n),t.onTransitionEnd(i.enter,function(){t.safeSetState({status:om},function(){t.props.onEntered&&t.props.onEntered(t.node,n)})})})):this.safeSetState({status:om},function(){t.props.onEntered&&t.props.onEntered(t.node,n)})},r.performExit=function(){var e=this,t=this.props.exit,r=this.getTimeouts();t?(this.props.onExit&&this.props.onExit(this.node),this.safeSetState({status:am},function(){e.props.onExiting&&e.props.onExiting(e.node),e.onTransitionEnd(r.exit,function(){e.safeSetState({status:im},function(){e.props.onExited&&e.props.onExited(e.node)})})})):this.safeSetState({status:im},function(){e.props.onExited&&e.props.onExited(e.node)})},r.cancelNextCallback=function(){null!==this.nextCallback&&this.nextCallback.cancel&&(this.nextCallback.cancel(),this.nextCallback=null)},r.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},r.setNextCallback=function(e){var t=this,r=!0;return this.nextCallback=function(){r&&(r=!1,t.nextCallback=null,e())},this.nextCallback.cancel=function(){r=!1},this.nextCallback},r.onTransitionEnd=function(e,t){this.setNextCallback(t);var r=null==e&&!this.props.addEndListener;this.node&&!r?(this.props.addEndListener&&this.props.addEndListener(this.node,this.nextCallback),null!=e&&setTimeout(this.nextCallback,e)):setTimeout(this.nextCallback,0)},r.render=function(){var e=this.state.status;if(e===nm)return null;var t=this.props;return(0,t.children)(e,Zp(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]))},qp(t,[{key:"node",get:function(){var e,t=null===(e=this.props.nodeRef)||void 0===e?void 0:e.current;if(!t)throw new Error("notistack - Custom snackbar is not refForwarding");return t}}]),t}(n.Component);function um(){}function cm(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function hm(e,t){return a(function(){return null==e&&null==t?null:function(r){cm(e,r),cm(t,r)}},[e,t])}function dm(e){var t=e.timeout,r=e.style,n=void 0===r?{}:r,i=e.mode;return{duration:"object"==typeof t?t[i]||0:t,easing:n.transitionTimingFunction,delay:n.transitionDelay}}lm.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:um,onEntering:um,onEntered:um,onExit:um,onExiting:um,onExited:um};var fm="cubic-bezier(0.4, 0, 0.2, 1)",pm="cubic-bezier(0.0, 0, 0.2, 1)",mm="cubic-bezier(0.4, 0, 0.6, 1)",_m=function(e){e.scrollTop=e.scrollTop},gm=function(e){return Math.round(e)+"ms"};function ym(e,t){void 0===e&&(e=["all"]);var r=t||{},n=r.duration,i=void 0===n?300:n,s=r.easing,o=void 0===s?fm:s,a=r.delay,l=void 0===a?0:a;return(Array.isArray(e)?e:[e]).map(function(e){var t="string"==typeof i?i:gm(i),r="string"==typeof l?l:gm(l);return e+" "+t+" "+o+" "+r}).join(",")}function vm(e){var t=function(e){return e&&e.ownerDocument||document}(e);return t.defaultView||window}function bm(e,t){if(t){var r=function(e,t){var r,n=t.getBoundingClientRect(),i=vm(t);if(t.fakeTransform)r=t.fakeTransform;else{var s=i.getComputedStyle(t);r=s.getPropertyValue("-webkit-transform")||s.getPropertyValue("transform")}var o=0,a=0;if(r&&"none"!==r&&"string"==typeof r){var l=r.split("(")[1].split(")")[0].split(",");o=parseInt(l[4],10),a=parseInt(l[5],10)}switch(e){case"left":return"translateX("+(i.innerWidth+o-n.left)+"px)";case"right":return"translateX(-"+(n.left+n.width-o)+"px)";case"up":return"translateY("+(i.innerHeight+a-n.top)+"px)";default:return"translateY(-"+(n.top+n.height-a)+"px)"}}(e,t);r&&(t.style.webkitTransform=r,t.style.transform=r)}}var xm=g(function(e,t){var r=e.children,n=e.direction,i=void 0===n?"down":n,a=e.in,u=e.style,c=e.timeout,h=void 0===c?0:c,d=e.onEnter,f=e.onEntered,p=e.onExit,m=e.onExited,g=Zp(e,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),v=o(null),b=hm(r.ref,v),x=hm(b,t),w=l(function(){v.current&&bm(i,v.current)},[i]);return s(function(){if(!a&&"down"!==i&&"right"!==i){var e=function(e,t){var r;function n(){for(var n=this,i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];clearTimeout(r),r=setTimeout(function(){e.apply(n,s)},t)}return void 0===t&&(t=166),n.clear=function(){clearTimeout(r)},n}(function(){v.current&&bm(i,v.current)}),t=vm(v.current);return t.addEventListener("resize",e),function(){e.clear(),t.removeEventListener("resize",e)}}},[i,a]),s(function(){a||w()},[a,w]),_(lm,Object.assign({appear:!0,nodeRef:v,onEnter:function(e,t){bm(i,e),_m(e),d&&d(e,t)},onEntered:f,onEntering:function(e){var t=(null==u?void 0:u.transitionTimingFunction)||pm,r=dm({timeout:h,mode:"enter",style:Wp({},u,{transitionTimingFunction:t})});e.style.webkitTransition=ym("-webkit-transform",r),e.style.transition=ym("transform",r),e.style.webkitTransform="none",e.style.transform="none"},onExit:function(e){var t=(null==u?void 0:u.transitionTimingFunction)||mm,r=dm({timeout:h,mode:"exit",style:Wp({},u,{transitionTimingFunction:t})});e.style.webkitTransition=ym("-webkit-transform",r),e.style.transition=ym("transform",r),bm(i,e),p&&p(e)},onExited:function(e){e.style.webkitTransition="",e.style.transition="",m&&m(e)},in:a,timeout:h},g),function(e,t){return y(r,Wp({ref:x,style:Wp({visibility:"exited"!==e||a?void 0:"hidden"},u,{},r.props.style)},t))})});xm.displayName="Slide";var wm=function(e){return n.createElement("svg",Object.assign({viewBox:"0 0 24 24",focusable:"false",style:{fontSize:20,marginInlineEnd:8,userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:"currentColor",flexShrink:0}},e))},Am=function(){return n.createElement(wm,null,n.createElement("path",{d:"M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41\n 10.59L10 14.17L17.59 6.58L19 8L10 17Z"}))},Em=function(){return n.createElement(wm,null,n.createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},Tm=function(){return n.createElement(wm,null,n.createElement("path",{d:"M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,\n 6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,\n 13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z"}))},Sm=function(){return n.createElement(wm,null,n.createElement("path",{d:"M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,\n 0 22,12A10,10 0 0,0 12,2Z"}))},km={maxSnack:3,persist:!1,hideIconVariant:!1,disableWindowBlurListener:!1,variant:"default",autoHideDuration:5e3,iconVariant:{default:void 0,success:n.createElement(Am,null),warning:n.createElement(Em,null),error:n.createElement(Tm,null),info:n.createElement(Sm,null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:xm,transitionDuration:{enter:225,exit:195}},Om=function(e,t){return function(r,n){return void 0===n&&(n=!1),n?Wp({},km[r],{},t[r],{},e[r]):"autoHideDuration"===r?(i=e.autoHideDuration,s=t.autoHideDuration,(o=function(e){return"number"==typeof e||null===e})(i)?i:o(s)?s:km.autoHideDuration):"transitionDuration"===r?function(e,t){var r=function(e,t){return t.some(function(t){return typeof e===t})};return r(e,["string","number"])?e:r(e,["object"])?Wp({},km.transitionDuration,{},r(t,["object"])&&t,{},e):r(t,["string","number"])?t:r(t,["object"])?Wp({},km.transitionDuration,{},t):km.transitionDuration}(e.transitionDuration,t.transitionDuration):e[r]||t[r]||km[r];var i,s,o}};function Rm(e){return Object.entries(e).reduce(function(e,t){var r,n=t[0],i=t[1];return Wp({},e,((r={})[n]=$p(i),r))},{})}var Cm="notistack-SnackbarContainer",Nm="notistack-Snackbar",Pm="notistack-CollapseWrapper",Mm="notistack-MuiContent",Dm=function(e){return"notistack-MuiContent-"+e},zm=Rm({root:{height:0},entered:{height:"auto"}}),Im="0px",Fm=g(function(e,t){var r=e.children,n=e.in,i=e.onExited,s=o(null),a=o(null),l=hm(t,a),u=function(){return s.current?s.current.clientHeight:0};return _(lm,{in:n,unmountOnExit:!0,onEnter:function(e){e.style.height=Im},onEntered:function(e){e.style.height="auto"},onEntering:function(e){var t=u(),r=dm({timeout:175,mode:"enter"}),n=r.duration,i=r.easing;e.style.transitionDuration="string"==typeof n?n:n+"ms",e.style.height=t+"px",e.style.transitionTimingFunction=i||""},onExit:function(e){e.style.height=u()+"px"},onExited:i,onExiting:function(e){_m(e);var t=dm({timeout:175,mode:"exit"}),r=t.duration,n=t.easing;e.style.transitionDuration="string"==typeof r?r:r+"ms",e.style.height=Im,e.style.transitionTimingFunction=n||""},nodeRef:a,timeout:175},function(e,t){return _("div",Object.assign({ref:l,className:Dp(zm.root,"entered"===e&&zm.entered),style:Wp({pointerEvents:"all",overflow:"hidden",minHeight:Im,transition:ym("height")},"entered"===e&&{overflow:"visible"},{},"exited"===e&&!n&&{visibility:"hidden"})},t),_("div",{ref:s,className:Pm,style:{display:"flex",width:"100%"}},r))})});Fm.displayName="Collapse";var Lm={right:"left",left:"right",bottom:"up",top:"down"},jm=function(e){return"anchorOrigin"+tm(e)},Um=function(){};function Bm(e,t){return e.reduce(function(e,r){return null==r?e:function(){for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];var o=[].concat(i);t&&-1===o.indexOf(t)&&o.push(t),e.apply(this,o),r.apply(this,o)}},Um)}var Vm="undefined"!=typeof window?i:s;function Gm(e){var t=o(e);return Vm(function(){t.current=e}),l(function(){return t.current.apply(void 0,arguments)},[])}var $m,qm=g(function(e,t){var r=e.children,n=e.className,i=e.autoHideDuration,a=e.disableWindowBlurListener,u=void 0!==a&&a,c=e.onClose,h=e.id,d=e.open,f=e.SnackbarProps,p=void 0===f?{}:f,m=o(),g=Gm(function(){c&&c.apply(void 0,arguments)}),y=Gm(function(e){c&&null!=e&&(m.current&&clearTimeout(m.current),m.current=setTimeout(function(){g(null,"timeout",h)},e))});s(function(){return d&&y(i),function(){m.current&&clearTimeout(m.current)}},[d,i,y]);var v=function(){m.current&&clearTimeout(m.current)},b=l(function(){null!=i&&y(.5*i)},[i,y]);return s(function(){if(!u&&d)return window.addEventListener("focus",b),window.addEventListener("blur",v),function(){window.removeEventListener("focus",b),window.removeEventListener("blur",v)}},[u,b,d]),_("div",Object.assign({ref:t},p,{className:Dp(Nm,n),onMouseEnter:function(e){p.onMouseEnter&&p.onMouseEnter(e),v()},onMouseLeave:function(e){p.onMouseLeave&&p.onMouseLeave(e),b()}}),r)});qm.displayName="Snackbar";var Wm=Rm({root:($m={display:"flex",flexWrap:"wrap",flexGrow:1},$m[Jp]={flexGrow:"initial",minWidth:"288px"},$m)}),Hm=g(function(e,t){var r=e.className,i=Zp(e,["className"]);return n.createElement("div",Object.assign({ref:t,className:Dp(Wm.root,r)},i))});Hm.displayName="SnackbarContent";var Zm=Rm({root:{backgroundColor:"#313131",fontSize:"0.875rem",lineHeight:1.43,letterSpacing:"0.01071em",color:"#fff",alignItems:"center",padding:"6px 16px",borderRadius:"4px",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"},lessPadding:{paddingLeft:"20px"},default:{backgroundColor:"#313131"},success:{backgroundColor:"#43a047"},error:{backgroundColor:"#d32f2f"},warning:{backgroundColor:"#ff9800"},info:{backgroundColor:"#2196f3"},message:{display:"flex",alignItems:"center",padding:"8px 0"},action:{display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:"16px",marginRight:"-8px"}}),Km="notistack-snackbar",Xm=g(function(e,t){var r=e.id,i=e.message,s=e.action,o=e.iconVariant,a=e.variant,l=e.hideIconVariant,u=e.style,c=e.className,h=o[a],d=s;return"function"==typeof d&&(d=d(r)),n.createElement(Hm,{ref:t,role:"alert","aria-describedby":Km,style:u,className:Dp(Mm,Dm(a),Zm.root,Zm[a],c,!l&&h&&Zm.lessPadding)},n.createElement("div",{id:Km,className:Zm.message},l?null:h,i),d&&n.createElement("div",{className:Zm.action},d))});Xm.displayName="MaterialDesignContent";var Ym,Qm,Jm,e_,t_,r_=h(Xm),n_=Rm({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),i_=function(e){var t=o(),r=u(!0),i=r[0],c=r[1],h=Bm([e.snack.onClose,e.onClose]),d=l(function(){t.current=setTimeout(function(){c(function(e){return!e})},125)},[]);s(function(){return function(){t.current&&clearTimeout(t.current)}},[]);var f,p=e.snack,m=e.classes,_=e.Component,g=void 0===_?r_:_,y=a(function(){return function(e){void 0===e&&(e={});var t={containerRoot:!0,containerAnchorOriginTopCenter:!0,containerAnchorOriginBottomCenter:!0,containerAnchorOriginTopRight:!0,containerAnchorOriginBottomRight:!0,containerAnchorOriginTopLeft:!0,containerAnchorOriginBottomLeft:!0};return Object.keys(e).filter(function(e){return!t[e]}).reduce(function(t,r){var n;return Wp({},t,((n={})[r]=e[r],n))},{})}(m)},[m]),v=p.open,b=p.SnackbarProps,x=p.TransitionComponent,w=p.TransitionProps,A=p.transitionDuration,E=p.disableWindowBlurListener,T=p.content,S=Zp(p,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),k=Wp({direction:(f=S.anchorOrigin,"center"!==f.horizontal?Lm[f.horizontal]:Lm[f.vertical]),timeout:A},w),O=T;"function"==typeof O&&(O=O(S.id,S.message));var R=["onEnter","onEntered","onExit","onExited"].reduce(function(t,r){var n;return Wp({},t,((n={})[r]=Bm([e.snack[r],e[r]],S.id),n))},{});return n.createElement(Fm,{in:i,onExited:R.onExited},n.createElement(qm,{open:v,id:S.id,disableWindowBlurListener:E,autoHideDuration:S.autoHideDuration,className:Dp(n_.wrappedRoot,y.root,y[jm(S.anchorOrigin)]),SnackbarProps:b,onClose:h},n.createElement(x,Object.assign({},k,{appear:!0,in:v,onExit:R.onExit,onExited:d,onEnter:R.onEnter,onEntered:Bm([R.onEntered,function(){e.snack.requestClose&&h(null,"instructed",e.snack.id)}],S.id)}),O||n.createElement(g,Object.assign({},S)))))},s_={default:20},o_={default:6,dense:2},a_="."+Pm,l_=Rm({root:(Ym={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:ym(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"},Ym[a_]={padding:o_.default+"px 0px",transition:"padding 300ms ease 0ms"},Ym.maxWidth="calc(100% - "+2*s_.default+"px)",Ym[Qp]={width:"100%",maxWidth:"calc(100% - 32px)"},Ym),rootDense:(Qm={},Qm[a_]={padding:o_.dense+"px 0px"},Qm),top:{top:s_.default-o_.default+"px",flexDirection:"column"},bottom:{bottom:s_.default-o_.default+"px",flexDirection:"column-reverse"},left:(Jm={left:s_.default+"px"},Jm[Jp]={alignItems:"flex-start"},Jm[Qp]={left:"16px"},Jm),right:(e_={right:s_.default+"px"},e_[Jp]={alignItems:"flex-end"},e_[Qp]={right:"16px"},e_),center:(t_={left:"50%",transform:"translateX(-50%)"},t_[Jp]={alignItems:"center"},t_)}),u_=function(e){var t=e.classes,r=void 0===t?{}:t,i=e.anchorOrigin,s=e.dense,o=e.children,a=Dp(Cm,l_[i.vertical],l_[i.horizontal],l_.root,r.containerRoot,r["containerAnchorOrigin"+tm(i)],s&&l_.rootDense);return n.createElement("div",{className:a},o)},c_=h(u_),h_="production"!==process.env.NODE_ENV,d_={NO_PERSIST_ALL:"Reached maxSnack while all enqueued snackbars have 'persist' flag. Notistack will dismiss the oldest snackbar anyway to allow other ones in the queue to be presented."},f_=function(e){return!("string"==typeof e||v(e))},p_=function(e){function t(t){var r;return(r=e.call(this,t)||this).enqueueSnackbar=function(e,t){if(void 0===t&&(t={}),null==e)throw new Error("enqueueSnackbar called with invalid argument");var n=f_(e)?e:t,i=f_(e)?e.message:e,s=n.key,o=n.preventDuplicate,a=Zp(n,["key","preventDuplicate"]),l=rm(s),u=l?s:(new Date).getTime()+Math.random(),c=Om(a,r.props),h=Wp({id:u},a,{message:i,open:!0,entered:!1,requestClose:!1,persist:c("persist"),action:c("action"),content:c("content"),variant:c("variant"),anchorOrigin:c("anchorOrigin"),disableWindowBlurListener:c("disableWindowBlurListener"),autoHideDuration:c("autoHideDuration"),hideIconVariant:c("hideIconVariant"),TransitionComponent:c("TransitionComponent"),transitionDuration:c("transitionDuration"),TransitionProps:c("TransitionProps",!0),iconVariant:c("iconVariant",!0),style:c("style",!0),SnackbarProps:c("SnackbarProps",!0),className:Dp(r.props.className,a.className)});return h.persist&&(h.autoHideDuration=void 0),r.setState(function(e){if(void 0===o&&r.props.preventDuplicate||o){var t=function(e){return l?e.id===u:e.message===i},n=e.queue.findIndex(t)>-1,s=e.snacks.findIndex(t)>-1;if(n||s)return e}return r.handleDisplaySnack(Wp({},e,{queue:[].concat(e.queue,[h])}))}),u},r.handleDisplaySnack=function(e){return e.snacks.length>=r.maxSnack?r.handleDismissOldest(e):r.processQueue(e)},r.processQueue=function(e){var t=e.queue,r=e.snacks;return t.length>0?Wp({},e,{snacks:[].concat(r,[t[0]]),queue:t.slice(1,t.length)}):e},r.handleDismissOldest=function(e){if(e.snacks.some(function(e){return!e.open||e.requestClose}))return e;var t=!1,n=!1;e.snacks.reduce(function(e,t){return e+(t.open&&t.persist?1:0)},0)===r.maxSnack&&("production"!==process.env.NODE_ENV&&function(e){if(h_){var t=d_[e];"undefined"!=typeof console&&console.error("WARNING - notistack: "+t);try{throw new Error(t)}catch(e){}}}("NO_PERSIST_ALL"),n=!0);var i=e.snacks.map(function(e){return t||e.persist&&!n?Wp({},e):(t=!0,e.entered?(e.onClose&&e.onClose(null,"maxsnack",e.id),r.props.onClose&&r.props.onClose(null,"maxsnack",e.id),Wp({},e,{open:!1})):Wp({},e,{requestClose:!0}))});return Wp({},e,{snacks:i})},r.handleEnteredSnack=function(e,t,n){if(!rm(n))throw new Error("handleEnteredSnack Cannot be called with undefined key");r.setState(function(e){return{snacks:e.snacks.map(function(e){return e.id===n?Wp({},e,{entered:!0}):Wp({},e)})}})},r.handleCloseSnack=function(e,t,n){r.props.onClose&&r.props.onClose(e,t,n);var i=void 0===n;r.setState(function(e){var t=e.snacks,r=e.queue;return{snacks:t.map(function(e){return i||e.id===n?e.entered?Wp({},e,{open:!1}):Wp({},e,{requestClose:!0}):Wp({},e)}),queue:r.filter(function(e){return e.id!==n})}})},r.closeSnackbar=function(e){var t=r.state.snacks.find(function(t){return t.id===e});rm(e)&&t&&t.onClose&&t.onClose(null,"instructed",e),r.handleCloseSnack(null,"instructed",e)},r.handleExitedSnack=function(e,t){if(!rm(t))throw new Error("handleExitedSnack Cannot be called with undefined key");r.setState(function(e){var n=r.processQueue(Wp({},e,{snacks:e.snacks.filter(function(e){return e.id!==t})}));return 0===n.queue.length?n:r.handleDismissOldest(n)})},r.enqueueSnackbar,r.closeSnackbar,r.state={snacks:[],queue:[],contextValue:{enqueueSnackbar:r.enqueueSnackbar.bind(Kp(r)),closeSnackbar:r.closeSnackbar.bind(Kp(r))}},r}return Hp(t,e),t.prototype.render=function(){var e=this,t=this.state.contextValue,r=this.props,i=r.domRoot,s=r.children,o=r.dense,a=void 0!==o&&o,l=r.Components,u=void 0===l?{}:l,c=r.classes,h=this.state.snacks.reduce(function(e,t){var r,n=tm(t.anchorOrigin),i=e[n]||[];return Wp({},e,((r={})[n]=[].concat(i,[t]),r))},{}),d=Object.keys(h).map(function(t){var r=h[t],i=r[0];return n.createElement(c_,{key:t,dense:a,anchorOrigin:i.anchorOrigin,classes:c},r.map(function(t){return n.createElement(i_,{key:t.id,snack:t,classes:c,Component:u[t.variant],onClose:e.handleCloseSnack,onEnter:e.props.onEnter,onExit:e.props.onExit,onExited:Bm([e.handleExitedSnack,e.props.onExited],t.id),onEntered:Bm([e.handleEnteredSnack,e.props.onEntered],t.id)})}))});return n.createElement(Yp.Provider,{value:t},s,i?q(d,i):d)},qp(t,[{key:"maxSnack",get:function(){return this.props.maxSnack||km.maxSnack}}]),t}(m);const m_=({children:t,configOptions:n})=>{const[i,s]=r.useState(null),[o,a]=r.useState("");return r.useEffect(()=>(lh.initialize({...n,onCheck:e=>{const{valid:t,reason:r}=e;a(r),s(t),n.onCheck?.(e)}}),()=>{lh.deactivate()}),[n]),null===i?e(Od,{color:"primary"}):i?e(r.Fragment,{children:t}):e(b,{color:"error",children:o})},__=({children:t,themeOptions:r})=>{const n=U(r);return e(B,{theme:n,children:t})},g_=({children:t,configOptions:r,themeOptions:n})=>e(p_,{children:e(hp,{children:e(ih,{children:e(__,{themeOptions:n,children:e(Pp,{children:e(m_,{configOptions:r,children:t})})})})})}),y_={position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",bgcolor:"background.paper",border:"2px solid #000",boxShadow:24,p:4,maxHeight:"90vh",overflowX:"auto",overflowY:"auto"};var v_=Jd(({name:t,children:n,onClose:i,onOpen:s})=>{const o=r.useId(),{modalStore:a}=sh(),l=a.getIsVisible(t);return r.useEffect(()=>{l&&s?.({name:t})},[l]),e(H,{open:l,onClose:()=>{a.closeModal(t),i?.({name:t})},"aria-labelledby":`modal-${o}-title`,"aria-describedby":`modal-${o}-description`,children:e(W,{sx:({breakpoints:e})=>({...y_,[e.up("sm")]:{minWidth:400},[e.down("sm")]:{minWidth:"80vw"}}),children:n})})});function b_({name:t,label:n}){const{control:i}=Ie(),s=r.useId();return e(qe,{control:i,name:t,render:({field:t})=>e(X,{...t,id:s,label:n,slots:{field:Pt}})})}const x_=()=>{const{enqueueSnackbar:e}=f(Yp);return({variant:t,message:r})=>{e({variant:t,message:r,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:3e3,hideIconVariant:!0})}},w_=()=>{const e=x_();return t=>{const{response:r}=t;if(r){const{data:t}=r;if(t){const{detail:r}=t;r&&r.forEach(t=>{e({variant:"error",message:t})})}}}},A_=e=>{const t=(new Date).getUTCHours();return encodeURIComponent([...e].reduce((r,n,i)=>{const s=(e.charCodeAt(i)-32+t)%95+32;return r+String.fromCharCode(s)},""))},E_=e=>Object.keys(e).reduce((t,r,n)=>`${t}${0===n?"":"&"}${r}=${e[r]}`,""),T_=()=>up({mutationKey:["sign-in-mutation"],mutationFn:async({body:{username:e,password:t}})=>{const r=E_({username:e,password:A_(t)});return await lh.instance.apiService.post({url:"token",body:r,config:{headers:{"Content-Type":"application/x-www-form-urlencoded"}}})}}),S_=()=>up({mutationKey:["logout-mutation"],mutationFn:async e=>await lh.instance.apiService.post({url:"logout"}),onError:w_(),onSuccess:()=>{cp.invalidateQueries({queryKey:["user"]})}}),k_=()=>lp({queryKey:["user"],queryFn:async()=>await lh.instance.apiService.get({url:"user/",config:{baseURL:"http://89.108.118.23:2292"}}),staleTime:3e5},Gf),O_=(e,t,r)=>{if(e&&"reportValidity"in e){const n=_e(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},R_=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?O_(n.ref,r,e):n&&n.refs&&n.refs.forEach(t=>O_(t,r,e))}},C_=(e,t)=>{t.shouldUseNativeValidation&&R_(e,t);const r={};for(const n in e){const i=_e(t.fields,n),s=Object.assign(e[n]||{},{ref:i&&i.ref});if(N_(t.names||Object.keys(e),n)){const e=Object.assign({},_e(r,n));ve(e,"root",s),ve(r,n,e)}else ve(r,n,s)}return r},N_=(e,t)=>{const r=P_(t);return e.some(e=>P_(e).match(`^${r}\\.\\d+`))};function P_(e){return e.replace(/\]|\[/g,"")}function M_(e,t,r){return void 0===r&&(r={}),function(n,i,s){try{return Promise.resolve(function(o,a){try{var l=(null!=t&&t.context&&"development"===process.env.NODE_ENV&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(e["sync"===r.mode?"validateSync":"validate"](n,Object.assign({abortEarly:!1},t,{context:i}))).then(function(e){return s.shouldUseNativeValidation&&R_({},s),{values:r.raw?Object.assign({},n):e,errors:{}}}))}catch(e){return a(e)}return l&&l.then?l.then(void 0,a):l}(0,function(e){if(!e.inner)throw e;return{values:{},errors:C_((t=e,r=!s.shouldUseNativeValidation&&"all"===s.criteriaMode,(t.inner||[]).reduce(function(e,t){if(e[t.path]||(e[t.path]={message:t.message,type:t.type}),r){var n=e[t.path].types,i=n&&n[t.type];e[t.path]=We(t.path,r,e,t.type,i?[].concat(i,t.message):t.message)}return e},{})),s)};var t,r}))}catch(e){return Promise.reject(e)}}}const D_=({children:t})=>e(x,{sx:{display:"flex",alignItems:"center",height:"100vh",width:"100vw",overflow:"hidden"},children:e(x,{sx:{margin:"auto",maxWidth:"400px",width:"100%"},children:e(kd,{children:t})})});var z_,I_;var F_,L_,j_=function(){if(I_)return z_;function e(e){this._maxSize=e,this.clear()}I_=1,e.prototype.clear=function(){this._size=0,this._values=Object.create(null)},e.prototype.get=function(e){return this._values[e]},e.prototype.set=function(e,t){return this._size>=this._maxSize&&this.clear(),e in this._values||this._size++,this._values[e]=t};var t=/[^.^\]^[]+|(?=\[\]|\.\.)/g,r=/^\d+$/,n=/^\d/,i=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,s=/^\s*(['"]?)(.*?)(\1)\s*$/,o=new e(512),a=new e(512),l=new e(512);function u(e){return o.get(e)||o.set(e,c(e).map(function(e){return e.replace(s,"$2")}))}function c(e){return e.match(t)||[""]}function h(e){return"string"==typeof e&&e&&-1!==["'",'"'].indexOf(e.charAt(0))}function d(e){return!h(e)&&(function(e){return e.match(n)&&!e.match(r)}(e)||function(e){return i.test(e)}(e))}return z_={Cache:e,split:c,normalizePath:u,setter:function(e){var t=u(e);return a.get(e)||a.set(e,function(e,r){for(var n=0,i=t.length,s=e;n<i-1;){var o=t[n];if("__proto__"===o||"constructor"===o||"prototype"===o)return e;s=s[t[n++]]}s[t[n]]=r})},getter:function(e,t){var r=u(e);return l.get(e)||l.set(e,function(e){for(var n=0,i=r.length;n<i;){if(null==e&&t)return;e=e[r[n++]]}return e})},join:function(e){return e.reduce(function(e,t){return e+(h(t)||r.test(t)?"["+t+"]":(e?".":"")+t)},"")},forEach:function(e,t,r){!function(e,t,r){var n,i,s,o,a=e.length;for(i=0;i<a;i++)(n=e[i])&&(d(n)&&(n='"'+n+'"'),s=!(o=h(n))&&/^\d+$/.test(n),t.call(r,n,o,s,i,e))}(Array.isArray(e)?e:c(e),t,r)}},z_}();var U_,B_=function(){if(L_)return F_;L_=1;const e=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,t=t=>t.match(e)||[],r=e=>e[0].toUpperCase()+e.slice(1),n=(e,r)=>t(e).join(r).toLowerCase(),i=e=>t(e).reduce((e,t)=>`${e}${e?t[0].toUpperCase()+t.slice(1).toLowerCase():t.toLowerCase()}`,"");return F_={words:t,upperFirst:r,camelCase:i,pascalCase:e=>r(i(e)),snakeCase:e=>n(e,"_"),kebabCase:e=>n(e,"-"),sentenceCase:e=>r(n(e," ")),titleCase:e=>t(e).map(r).join(" ")}}(),V_={exports:{}};var G_=function(){if(U_)return V_.exports;function e(e,t){var r=e.length,n=new Array(r),i={},s=r,o=function(e){for(var t=new Map,r=0,n=e.length;r<n;r++){var i=e[r];t.has(i[0])||t.set(i[0],new Set),t.has(i[1])||t.set(i[1],new Set),t.get(i[0]).add(i[1])}return t}(t),a=function(e){for(var t=new Map,r=0,n=e.length;r<n;r++)t.set(e[r],r);return t}(e);for(t.forEach(function(e){if(!a.has(e[0])||!a.has(e[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});s--;)i[s]||l(e[s],s,new Set);return n;function l(e,t,s){if(s.has(e)){var u;try{u=", node was:"+JSON.stringify(e)}catch(e){u=""}throw new Error("Cyclic dependency"+u)}if(!a.has(e))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(e));if(!i[t]){i[t]=!0;var c=o.get(e)||new Set;if(t=(c=Array.from(c)).length){s.add(e);do{var h=c[--t];l(h,a.get(h),s)}while(t);s.delete(e)}n[--r]=e}}}return U_=1,V_.exports=function(t){return e(function(e){for(var t=new Set,r=0,n=e.length;r<n;r++){var i=e[r];t.add(i[0]),t.add(i[1])}return Array.from(t)}(t),t)},V_.exports.array=e,V_.exports}(),$_=si(G_);const q_=Object.prototype.toString,W_=Error.prototype.toString,H_=RegExp.prototype.toString,Z_="undefined"!=typeof Symbol?Symbol.prototype.toString:()=>"",K_=/^Symbol\((.*)\)(.*)$/;function X_(e,t=!1){if(null==e||!0===e||!1===e)return""+e;const r=typeof e;if("number"===r)return function(e){return e!=+e?"NaN":0===e&&1/e<0?"-0":""+e}(e);if("string"===r)return t?`"${e}"`:e;if("function"===r)return"[Function "+(e.name||"anonymous")+"]";if("symbol"===r)return Z_.call(e).replace(K_,"Symbol($1)");const n=q_.call(e).slice(8,-1);return"Date"===n?isNaN(e.getTime())?""+e:e.toISOString(e):"Error"===n||e instanceof Error?"["+W_.call(e)+"]":"RegExp"===n?H_.call(e):null}function Y_(e,t){let r=X_(e,t);return null!==r?r:JSON.stringify(e,function(e,r){let n=X_(this[e],t);return null!==n?n:r},2)}function Q_(e){return null==e?[]:[].concat(e)}let J_,eg,tg,rg=/\$\{\s*(\w+)\s*\}/g;J_=Symbol.toStringTag;class ng{constructor(e,t,r,n){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[J_]="Error",this.name="ValidationError",this.value=t,this.path=r,this.type=n,this.errors=[],this.inner=[],Q_(e).forEach(e=>{if(ig.isError(e)){this.errors.push(...e.errors);const t=e.inner.length?e.inner:[e];this.inner.push(...t)}else this.errors.push(e)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}eg=Symbol.hasInstance,tg=Symbol.toStringTag;class ig extends Error{static formatError(e,t){const r=t.label||t.path||"this";return t=Object.assign({},t,{path:r,originalPath:t.path}),"string"==typeof e?e.replace(rg,(e,r)=>Y_(t[r])):"function"==typeof e?e(t):e}static isError(e){return e&&"ValidationError"===e.name}constructor(e,t,r,n,i){const s=new ng(e,t,r,n);if(i)return s;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[tg]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,ig)}static[eg](e){return ng[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let sg={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:r,originalValue:n})=>{const i=null!=n&&n!==r?` (cast from the value \`${Y_(n,!0)}\`).`:".";return"mixed"!==t?`${e} must be a \`${t}\` type, but the final value was: \`${Y_(r,!0)}\``+i:`${e} must match the configured type. The validated value was: \`${Y_(r,!0)}\``+i}},og={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},ag={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},lg={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},ug={notType:e=>{const{path:t,value:r,spec:n}=e,i=n.types.length;if(Array.isArray(r)){if(r.length<i)return`${t} tuple value has too few items, expected a length of ${i} but got ${r.length} for value: \`${Y_(r,!0)}\``;if(r.length>i)return`${t} tuple value has too many items, expected a length of ${i} but got ${r.length} for value: \`${Y_(r,!0)}\``}return ig.formatError(sg.notType,e)}};Object.assign(Object.create(null),{mixed:sg,string:og,number:{min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},date:ag,object:lg,array:{min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},boolean:{isValue:"${path} field must be ${value}"},tuple:ug});const cg=e=>e&&e.__isYupSchema__;class hg{static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:n,otherwise:i}=t,s="function"==typeof r?r:(...e)=>e.every(e=>e===r);return new hg(e,(e,t)=>{var r;let o=s(...e)?n:i;return null!=(r=null==o?void 0:o(t))?r:t})}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let r=this.refs.map(e=>e.getValue(null==t?void 0:t.value,null==t?void 0:t.parent,null==t?void 0:t.context)),n=this.fn(r,e,t);if(void 0===n||n===e)return e;if(!cg(n))throw new TypeError("conditions must return a schema object");return n.resolve(t)}}const dg="$",fg=".";class pg{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,"string"!=typeof e)throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),""===e)throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===dg,this.isValue=this.key[0]===fg,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?dg:this.isValue?fg:"";this.path=this.key.slice(r.length),this.getter=this.path&&j_.getter(this.path,!0),this.map=t.map}getValue(e,t,r){let n=this.isContext?r:this.isValue?e:t;return this.getter&&(n=this.getter(n||{})),this.map&&(n=this.map(n)),n}cast(e,t){return this.getValue(e,null==t?void 0:t.parent,null==t?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}pg.prototype.__isYupRef=!0;const mg=e=>null==e;function _g(e){function t({value:t,path:r="",options:n,originalValue:i,schema:s},o,a){const{name:l,test:u,params:c,message:h,skipAbsent:d}=e;let{parent:f,context:p,abortEarly:m=s.spec.abortEarly,disableStackTrace:_=s.spec.disableStackTrace}=n;const g={value:t,parent:f,context:p};function y(e={}){const n=gg(Object.assign({value:t,originalValue:i,label:s.spec.label,path:e.path||r,spec:s.spec,disableStackTrace:e.disableStackTrace||_},c,e.params),g),o=new ig(ig.formatError(e.message||h,n),t,n.path,e.type||l,n.disableStackTrace);return o.params=n,o}const v=m?o:a;let b={path:r,parent:f,type:l,from:n.from,createError:y,resolve:e=>yg(e,g),options:n,originalValue:i,schema:s};const x=e=>{ig.isError(e)?v(e):e?a(null):v(y())},w=e=>{ig.isError(e)?v(e):o(e)};if(d&&mg(t))return x(!0);let A;try{var E;if(A=u.call(b,t,b),"function"==typeof(null==(E=A)?void 0:E.then)){if(n.sync)throw new Error(`Validation test of type: "${b.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(A).then(x,w)}}catch(e){return void w(e)}x(A)}return t.OPTIONS=e,t}function gg(e,t){if(!e)return e;for(const r of Object.keys(e))e[r]=yg(e[r],t);return e}function yg(e,t){return pg.isRef(e)?e.getValue(t.value,t.parent,t.context):e}function vg(e,t,r,n=r){let i,s,o;return t?(j_.forEach(t,(a,l,u)=>{let c=l?a.slice(1,a.length-1):a,h="tuple"===(e=e.resolve({context:n,parent:i,value:r})).type,d=u?parseInt(c,10):0;if(e.innerType||h){if(h&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${o}" must contain an index to the tuple element, e.g. "${o}[0]"`);if(r&&d>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${t}. because there is no value at that index. `);i=r,r=r&&r[d],e=h?e.spec.types[d]:e.innerType}if(!u){if(!e.fields||!e.fields[c])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${o} which is a type: "${e.type}")`);i=r,r=r&&r[c],e=e.fields[c]}s=c,o=l?"["+a+"]":"."+a}),{schema:e,parent:i,parentPath:s}):{parent:i,parentPath:t,schema:e}}class bg extends Set{describe(){const e=[];for(const t of this.values())e.push(pg.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const r of this.values())t.push(e(r));return t}clone(){return new bg(this.values())}merge(e,t){const r=this.clone();return e.forEach(e=>r.add(e)),t.forEach(e=>r.delete(e)),r}}function xg(e,t=new Map){if(cg(e)||!e||"object"!=typeof e)return e;if(t.has(e))return t.get(e);let r;if(e instanceof Date)r=new Date(e.getTime()),t.set(e,r);else if(e instanceof RegExp)r=new RegExp(e),t.set(e,r);else if(Array.isArray(e)){r=new Array(e.length),t.set(e,r);for(let n=0;n<e.length;n++)r[n]=xg(e[n],t)}else if(e instanceof Map){r=new Map,t.set(e,r);for(const[n,i]of e.entries())r.set(n,xg(i,t))}else if(e instanceof Set){r=new Set,t.set(e,r);for(const n of e)r.add(xg(n,t))}else{if(!(e instanceof Object))throw Error(`Unable to clone ${e}`);r={},t.set(e,r);for(const[n,i]of Object.entries(e))r[n]=xg(i,t)}return r}function wg(e){if(null==e||!e.length)return;const t=[];let r="",n=!1,i=!1;for(let s=0;s<e.length;s++){const o=e[s];"["!==o||i?"]"!==o||i?'"'!==o?"."!==o||n||i?r+=o:r&&(t.push(r),r=""):i=!i:(r&&(/^\d+$/.test(r)?t.push(r):t.push(r.replace(/^"|"$/g,"")),r=""),n=!1):(r&&(t.push(...r.split(".").filter(Boolean)),r=""),n=!0)}return r&&t.push(...r.split(".").filter(Boolean)),t}function Ag(e,t){var r;if((null==(r=e.inner)||!r.length)&&e.errors.length)return function(e,t){const r=t?`${t}.${e.path}`:e.path;return e.errors.map(e=>({message:e,path:wg(r)}))}(e,t);const n=t?`${t}.${e.path}`:e.path;return e.inner.flatMap(e=>Ag(e,n))}class Eg{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new bg,this._blacklist=new bg,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(sg.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},null==e?void 0:e.spec),this.withMutation(e=>{e.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=xg(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(0===e.length)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=t,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&"mixed"!==this.type)throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,r=e.clone();const n=Object.assign({},t.spec,r.spec);return r.spec=n,r.internalTests=Object.assign({},t.internalTests,r.internalTests),r._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),r.tests=t.tests,r.exclusiveTests=t.exclusiveTests,r.withMutation(t=>{e.tests.forEach(e=>{t.test(e.OPTIONS)})}),r.transforms=[...t.transforms,...r.transforms],r}isType(e){return null==e?!(!this.spec.nullable||null!==e)||!(!this.spec.optional||void 0!==e):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let r=t.conditions;t=t.clone(),t.conditions=[],t=r.reduce((t,r)=>r.resolve(t,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,r,n,i;return Object.assign({},e,{from:e.from||[],strict:null!=(t=e.strict)?t:this.spec.strict,abortEarly:null!=(r=e.abortEarly)?r:this.spec.abortEarly,recursive:null!=(n=e.recursive)?n:this.spec.recursive,disableStackTrace:null!=(i=e.disableStackTrace)?i:this.spec.disableStackTrace})}cast(e,t={}){let r=this.resolve(Object.assign({},t,{value:e})),n="ignore-optionality"===t.assert,i=r._cast(e,t);if(!1!==t.assert&&!r.isType(i)){if(n&&mg(i))return i;let s=Y_(e),o=Y_(i);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}". \n\nattempted value: ${s} \n`+(o!==s?`result of cast: ${o}`:""))}return i}_cast(e,t){let r=void 0===e?e:this.transforms.reduce((r,n)=>n.call(this,r,e,this,t),e);return void 0===r&&(r=this.getDefault(t)),r}_validate(e,t={},r,n){let{path:i,originalValue:s=e,strict:o=this.spec.strict}=t,a=e;o||(a=this._cast(a,Object.assign({assert:!1},t)));let l=[];for(let e of Object.values(this.internalTests))e&&l.push(e);this.runTests({path:i,value:a,originalValue:s,options:t,tests:l},r,e=>{if(e.length)return n(e,a);this.runTests({path:i,value:a,originalValue:s,options:t,tests:this.tests},r,n)})}runTests(e,t,r){let n=!1,{tests:i,value:s,originalValue:o,path:a,options:l}=e,u=e=>{n||(n=!0,t(e,s))},c=e=>{n||(n=!0,r(e,s))},h=i.length,d=[];if(!h)return c([]);let f={value:s,originalValue:o,path:a,options:l,schema:this};for(let e=0;e<i.length;e++){(0,i[e])(f,u,function(e){e&&(Array.isArray(e)?d.push(...e):d.push(e)),--h<=0&&c(d)})}}asNestedTest({key:e,index:t,parent:r,parentPath:n,originalParent:i,options:s}){const o=null!=e?e:t;if(null==o)throw TypeError("Must include `key` or `index` for nested validations");const a="number"==typeof o;let l=r[o];const u=Object.assign({},s,{strict:!0,parent:r,value:l,originalValue:i[o],key:void 0,[a?"index":"key"]:o,path:a||o.includes(".")?`${n||""}[${a?o:`"${o}"`}]`:(n?`${n}.`:"")+e});return(e,t,r)=>this.resolve(u)._validate(l,u,t,r)}validate(e,t){var r;let n=this.resolve(Object.assign({},t,{value:e})),i=null!=(r=null==t?void 0:t.disableStackTrace)?r:n.spec.disableStackTrace;return new Promise((r,s)=>n._validate(e,t,(e,t)=>{ig.isError(e)&&(e.value=t),s(e)},(e,t)=>{e.length?s(new ig(e,t,void 0,void 0,i)):r(t)}))}validateSync(e,t){var r;let n,i=this.resolve(Object.assign({},t,{value:e})),s=null!=(r=null==t?void 0:t.disableStackTrace)?r:i.spec.disableStackTrace;return i._validate(e,Object.assign({},t,{sync:!0}),(e,t)=>{throw ig.isError(e)&&(e.value=t),e},(t,r)=>{if(t.length)throw new ig(t,e,void 0,void 0,s);n=r}),n}isValid(e,t){return this.validate(e,t).then(()=>!0,e=>{if(ig.isError(e))return!1;throw e})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(e){if(ig.isError(e))return!1;throw e}}_getDefault(e){let t=this.spec.default;return null==t?t:"function"==typeof t?t.call(this,e):xg(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){if(0===arguments.length)return this._getDefault();return this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const r=this.clone({nullable:e});return r.internalTests.nullable=_g({message:t,name:"nullable",test(e){return null!==e||this.schema.spec.nullable}}),r}optionality(e,t){const r=this.clone({optional:e});return r.internalTests.optionality=_g({message:t,name:"optionality",test(e){return void 0!==e||this.schema.spec.optional}}),r}optional(){return this.optionality(!0)}defined(e=sg.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=sg.notNull){return this.nullability(!1,e)}required(e=sg.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(t=1===e.length?"function"==typeof e[0]?{test:e[0]}:e[0]:2===e.length?{name:e[0],test:e[1]}:{name:e[0],message:e[1],test:e[2]},void 0===t.message&&(t.message=sg.default),"function"!=typeof t.test)throw new TypeError("`test` is a required parameters");let r=this.clone(),n=_g(t),i=t.exclusive||t.name&&!0===r.exclusiveTests[t.name];if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(r.exclusiveTests[t.name]=!!t.exclusive),r.tests=r.tests.filter(e=>{if(e.OPTIONS.name===t.name){if(i)return!1;if(e.OPTIONS.test===n.OPTIONS.test)return!1}return!0}),r.tests.push(n),r}when(e,t){Array.isArray(e)||"string"==typeof e||(t=e,e=".");let r=this.clone(),n=Q_(e).map(e=>new pg(e));return n.forEach(e=>{e.isSibling&&r.deps.push(e.key)}),r.conditions.push("function"==typeof t?new hg(n,t):hg.fromOptions(n,t)),r}typeError(e){let t=this.clone();return t.internalTests.typeError=_g({message:e,name:"typeError",skipAbsent:!0,test(e){return!!this.schema._typeCheck(e)||this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=sg.oneOf){let r=this.clone();return e.forEach(e=>{r._whitelist.add(e),r._blacklist.delete(e)}),r.internalTests.whiteList=_g({message:t,name:"oneOf",skipAbsent:!0,test(e){let t=this.schema._whitelist,r=t.resolveAll(this.resolve);return!!r.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:r}})}}),r}notOneOf(e,t=sg.notOneOf){let r=this.clone();return e.forEach(e=>{r._blacklist.add(e),r._whitelist.delete(e)}),r.internalTests.blacklist=_g({message:t,name:"notOneOf",test(e){let t=this.schema._blacklist,r=t.resolveAll(this.resolve);return!r.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:r}})}}),r}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:r,meta:n,optional:i,nullable:s}=t.spec,o={meta:n,label:r,optional:i,nullable:s,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.filter((e,t,r)=>r.findIndex(t=>t.OPTIONS.name===e.OPTIONS.name)===t).map(t=>{const r=t.OPTIONS.params&&e?gg(Object.assign({},t.OPTIONS.params),e):t.OPTIONS.params;return{name:t.OPTIONS.name,params:r}})};return o}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(t){try{return{value:await e.validate(t,{abortEarly:!1})}}catch(e){if(e instanceof ig)return{issues:Ag(e)};throw e}}}}}Eg.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])Eg.prototype[`${e}At`]=function(t,r,n={}){const{parent:i,parentPath:s,schema:o}=vg(this,t,r,n.context);return o[e](i&&i[s],Object.assign({},n,{parent:i,path:t}))};for(const e of["equals","is"])Eg.prototype[e]=Eg.prototype.oneOf;for(const e of["not","nope"])Eg.prototype[e]=Eg.prototype.notOneOf;const Tg=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Sg(e){var t,r;const n=Tg.exec(e);return n?{year:kg(n[1]),month:kg(n[2],1)-1,day:kg(n[3],1),hour:kg(n[4]),minute:kg(n[5]),second:kg(n[6]),millisecond:n[7]?kg(n[7].substring(0,3)):0,precision:null!=(t=null==(r=n[7])?void 0:r.length)?t:void 0,z:n[8]||void 0,plusMinus:n[9]||void 0,hourOffset:kg(n[10]),minuteOffset:kg(n[11])}:null}function kg(e,t=0){return Number(e)||t}let Og=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Rg=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,Cg=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Ng=new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"),Pg=e=>mg(e)||e===e.trim(),Mg={}.toString();function Dg(){return new zg}class zg extends Eg{constructor(){super({type:"string",check:e=>(e instanceof String&&(e=e.valueOf()),"string"==typeof e)}),this.withMutation(()=>{this.transform((e,t)=>{if(!this.spec.coerce||this.isType(e))return e;if(Array.isArray(e))return e;const r=null!=e&&e.toString?e.toString():e;return r===Mg?e:r})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||sg.required,name:"required",skipAbsent:!0,test:e=>!!e.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(e=>"required"!==e.OPTIONS.name),e))}length(e,t=og.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(t){return t.length===this.resolve(e)}})}min(e,t=og.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t.length>=this.resolve(e)}})}max(e,t=og.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(t){return t.length<=this.resolve(e)}})}matches(e,t){let r,n,i=!1;return t&&("object"==typeof t?({excludeEmptyString:i=!1,message:r,name:n}=t):r=t),this.test({name:n||"matches",message:r||og.matches,params:{regex:e},skipAbsent:!0,test:t=>""===t&&i||-1!==t.search(e)})}email(e=og.email){return this.matches(Og,{name:"email",message:e,excludeEmptyString:!0})}url(e=og.url){return this.matches(Rg,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=og.uuid){return this.matches(Cg,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t,r,n="";return e&&("object"==typeof e?({message:n="",allowOffset:t=!1,precision:r}=e):n=e),this.matches(Ng,{name:"datetime",message:n||og.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||og.datetime_offset,params:{allowOffset:t},skipAbsent:!0,test:e=>{if(!e||t)return!0;const r=Sg(e);return!!r&&!!r.z}}).test({name:"datetime_precision",message:n||og.datetime_precision,params:{precision:r},skipAbsent:!0,test:e=>{if(!e||null==r)return!0;const t=Sg(e);return!!t&&t.precision===r}})}ensure(){return this.default("").transform(e=>null===e?"":e)}trim(e=og.trim){return this.transform(e=>null!=e?e.trim():e).test({message:e,name:"trim",test:Pg})}lowercase(e=og.lowercase){return this.transform(e=>mg(e)?e:e.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>mg(e)||e===e.toLowerCase()})}uppercase(e=og.uppercase){return this.transform(e=>mg(e)?e:e.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>mg(e)||e===e.toUpperCase()})}}Dg.prototype=zg.prototype;let Ig=new Date("");class Fg extends Eg{constructor(){super({type:"date",check(e){return t=e,"[object Date]"===Object.prototype.toString.call(t)&&!isNaN(e.getTime());var t}}),this.withMutation(()=>{this.transform((e,t)=>!this.spec.coerce||this.isType(e)||null===e?e:(e=function(e){const t=Sg(e);if(!t)return Date.parse?Date.parse(e):Number.NaN;if(void 0===t.z&&void 0===t.plusMinus)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let r=0;return"Z"!==t.z&&void 0!==t.plusMinus&&(r=60*t.hourOffset+t.minuteOffset,"+"===t.plusMinus&&(r=0-r)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+r,t.second,t.millisecond)}(e),isNaN(e)?Fg.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let r;if(pg.isRef(e))r=e;else{let n=this.cast(e);if(!this._typeCheck(n))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);r=n}return r}min(e,t=ag.min){let r=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(e){return e>=this.resolve(r)}})}max(e,t=ag.max){let r=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(e){return e<=this.resolve(r)}})}}function Lg(e,t){let r=1/0;return e.some((e,n)=>{var i;if(null!=(i=t.path)&&i.includes(e))return r=n,!0}),r}function jg(e){return(t,r)=>Lg(e,t)-Lg(e,r)}Fg.INVALID_DATE=Ig;const Ug=(e,t,r)=>{if("string"!=typeof e)return e;let n=e;try{n=JSON.parse(e)}catch(e){}return r.isType(n)?n:e};function Bg(e){if("fields"in e){const t={};for(const[r,n]of Object.entries(e.fields))t[r]=Bg(n);return e.setFields(t)}if("array"===e.type){const t=e.optional();return t.innerType&&(t.innerType=Bg(t.innerType)),t}return"tuple"===e.type?e.optional().clone({types:e.spec.types.map(Bg)}):"optional"in e?e.optional():e}let Vg=e=>"[object Object]"===Object.prototype.toString.call(e);function Gg(e,t){let r=Object.keys(e.fields);return Object.keys(t).filter(e=>-1===r.indexOf(e))}const $g=jg([]);function qg(e){return new Wg(e)}class Wg extends Eg{constructor(e){super({type:"object",check:e=>Vg(e)||"function"==typeof e}),this.fields=Object.create(null),this._sortErrors=$g,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var r;let n=super._cast(e,t);if(void 0===n)return this.getDefault(t);if(!this._typeCheck(n))return n;let i=this.fields,s=null!=(r=t.stripUnknown)?r:this.spec.noUnknown,o=[].concat(this._nodes,Object.keys(n).filter(e=>!this._nodes.includes(e))),a={},l=Object.assign({},t,{parent:a,__validating:t.__validating||!1}),u=!1;for(const e of o){let r=i[e],o=e in n,c=n[e];if(r){let i;l.path=(t.path?`${t.path}.`:"")+e,r=r.resolve({value:c,context:t.context,parent:a});let s=r instanceof Eg?r.spec:void 0,o=null==s?void 0:s.strict;if(null!=s&&s.strip){u=u||e in n;continue}i=t.__validating&&o?c:r.cast(c,l),void 0!==i&&(a[e]=i)}else o&&!s&&(a[e]=c);o===e in a&&a[e]===c||(u=!0)}return u?a:n}_validate(e,t={},r,n){let{from:i=[],originalValue:s=e,recursive:o=this.spec.recursive}=t;t.from=[{schema:this,value:s},...i],t.__validating=!0,t.originalValue=s,super._validate(e,t,r,(e,i)=>{if(!o||!Vg(i))return void n(e,i);s=s||i;let a=[];for(let e of this._nodes){let r=this.fields[e];r&&!pg.isRef(r)&&a.push(r.asNestedTest({options:t,key:e,parent:i,parentPath:t.path,originalParent:s}))}this.runTests({tests:a,value:i,originalValue:s,options:t},r,t=>{n(t.sort(this._sortErrors).concat(e),i)})})}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),r=t.fields;for(let[e,t]of Object.entries(this.fields)){const n=r[e];r[e]=void 0===n?t:n}return t.withMutation(t=>t.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach(r=>{var n;const i=this.fields[r];let s=e;null!=(n=s)&&n.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[r]})),t[r]=i&&"getDefault"in i?i.getDefault(s):void 0}),t}setFields(e,t){let r=this.clone();return r.fields=e,r._nodes=function(e,t=[]){let r=[],n=new Set,i=new Set(t.map(([e,t])=>`${e}-${t}`));function s(e,t){let s=j_.split(e)[0];n.add(s),i.has(`${t}-${s}`)||r.push([t,s])}for(const t of Object.keys(e)){let r=e[t];n.add(t),pg.isRef(r)&&r.isSibling?s(r.path,t):cg(r)&&"deps"in r&&r.deps.forEach(e=>s(e,t))}return $_.array(Array.from(n),r).reverse()}(e,t),r._sortErrors=jg(Object.keys(e)),t&&(r._excludedEdges=t),r}shape(e,t=[]){return this.clone().withMutation(r=>{let n=r._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),n=[...r._excludedEdges,...t]),r.setFields(Object.assign(r.fields,e),n)})}partial(){const e={};for(const[t,r]of Object.entries(this.fields))e[t]="optional"in r&&r.optional instanceof Function?r.optional():r;return this.setFields(e)}deepPartial(){return Bg(this)}pick(e){const t={};for(const r of e)this.fields[r]&&(t[r]=this.fields[r]);return this.setFields(t,this._excludedEdges.filter(([t,r])=>e.includes(t)&&e.includes(r)))}omit(e){const t=[];for(const r of Object.keys(this.fields))e.includes(r)||t.push(r);return this.pick(t)}from(e,t,r){let n=j_.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return((e,t)=>{const r=[...j_.normalizePath(t)];if(1===r.length)return r[0]in e;let n=r.pop(),i=j_.getter(j_.join(r),!0)(e);return!(!i||!(n in i))})(i,e)&&(s=Object.assign({},i),r||delete s[e],s[t]=n(i)),s})}json(){return this.transform(Ug)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||lg.exact,test(e){if(null==e)return!0;const t=Gg(this.schema,e);return 0===t.length||this.createError({params:{properties:t.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=lg.noUnknown){"boolean"!=typeof e&&(t=e,e=!0);let r=this.test({name:"noUnknown",exclusive:!0,message:t,test(t){if(null==t)return!0;const r=Gg(this.schema,t);return!e||0===r.length||this.createError({params:{unknown:r.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,t=lg.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;const r={};for(const n of Object.keys(t))r[e(n)]=t[n];return r})}camelCase(){return this.transformKeys(B_.camelCase)}snakeCase(){return this.transformKeys(B_.snakeCase)}constantCase(){return this.transformKeys(e=>B_.snakeCase(e).toUpperCase())}describe(e){const t=(e?this.resolve(e):this).clone(),r=super.describe(e);r.fields={};for(const[i,s]of Object.entries(t.fields)){var n;let t=e;null!=(n=t)&&n.value&&(t=Object.assign({},t,{parent:t.value,value:t.value[i]})),r.fields[i]=s.describe(t)}return r}}qg.prototype=Wg.prototype;const Hg=qg().shape({username:Dg().required(),password:Dg().required()}),Zg=({onSuccessSignIn:i})=>{const s=S_(),o=T_(),a=x_(),l=function(e={}){const t=n.useRef(void 0),r=n.useRef(void 0),[i,s]=n.useState({isDirty:!1,isValidating:!1,isLoading:ye(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:ye(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:i},e.defaultValues&&!ye(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:r,...n}=St(e);t.current={...n,formState:i}}const o=t.current.control;return o._options=e,je(()=>{const e=o._subscribe({formState:o._proxyFormState,callback:()=>s({...o._formState}),reRenderRoot:!0});return s(e=>({...e,isReady:!0})),o._formState.isReady=!0,e},[o]),n.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),n.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),n.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),n.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),n.useEffect(()=>{if(o._proxyFormState.isDirty){const e=o._getDirty();e!==i.isDirty&&o._subjects.state.next({isDirty:e})}},[o,i.isDirty]),n.useEffect(()=>{var t;e.values&&!Ge(e.values,r.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),(null===(t=o._options.resetOptions)||void 0===t?void 0:t.keepIsValid)||o._setValid(),r.current=e.values,s(e=>({...e}))):o._resetDefaultValues()},[o,e.values]),n.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=Le(i,o),t.current}({defaultValues:{username:"",password:""},resolver:M_(Hg)}),{register:u,formState:{isValid:c}}=l;return r.useEffect(()=>{s.mutate()},[]),r.useEffect(()=>{if(o.error){const{response:e}=o.error;if(e){const{data:{detail:t}}=e;a({message:t,variant:"error"})}}},[o.error]),r.useEffect(()=>{o.data&&i(o.data)},[o.data]),e(D_,{children:t(Ct,{form:l,onSubmit:e=>{o.mutate({body:e})},sx:{justifyContent:"center",justifyItems:"center",alignContent:"center",alignItems:"center"},children:[e(b,{variant:"h4",children:"Authorization"}),e(Dt,{...u("username"),label:"Login",placeholder:"Enter your login"}),e(Dt,{...u("password"),label:"Password",placeholder:"Enter your password",type:"password"}),e(re,{type:"submit",disabled:!c,children:"Sign in"})]})})};var Kg,Xg,Yg={};function Qg(e,t){if(Kg)if(Xg){var r="var shared_chunk = {}; ("+Kg+")(shared_chunk); ("+Xg+")(shared_chunk);",n={};Kg(n),(Yg=t(n)).workerURL=window.URL.createObjectURL(new Blob([r],{type:"text/javascript"}))}else Xg=t;else Kg=t}Qg(0,function(e){const t={};try{window instanceof Window&&window.document instanceof HTMLDocument&&(t.is_worker=!1,t.is_main=!0)}catch(e){t.is_worker=!0,t.is_main=!1,self.window={document:{}},self.document=self.window.document}function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function n(e){var t=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==r(t)?t:t+""}function i(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s,o="v0.22.0",a=s={},l=0,u={};function c(e){var t=[];"string"==typeof e&&(t=e.split("."),e=t.pop());var r=s.targets;for(let e=0;e<t.length;e++){if(!r[t[e]])return[];r=r[t[e]]}return[e,r]}function h(e,t=null,r=null,n=[]){if(!e)return n;if(Array.isArray(e))e.forEach((t,r)=>h(t,e,r,n));else if("object"==typeof e)if(e instanceof ArrayBuffer)n.push({object:e,parent:t,property:r});else if(e.buffer instanceof ArrayBuffer)n.push({object:e.buffer,parent:t,property:r});else for(let t in e)h(e[t],e,t,n);return n}function d(e){Array.isArray(e)&&e.filter(e=>e.parent&&e.property).forEach(e=>delete e.parent[e.property])}s.targets={},s.addTarget=function(e,t){s.targets[e]=t},s.removeTarget=function(e){e&&delete s.targets[e]},s.withTransferables=function(...e){if(!(this instanceof s.withTransferables))return new s.withTransferables(...e);this.value=e,this.transferables=h(this.value)},t.is_main&&(s.postMessage=function(e,t,...r){if(Array.isArray(e))return Promise.all(e.map(e=>s.postMessage(e,t,...r)));let n={};"object"==typeof t&&(n=t,t=t.method);var i=new Promise((e,n)=>{u[l]={method:t,message:r,resolve:e,reject:n}});let o,a=[];return r&&1===r.length&&r[0]instanceof s.withTransferables&&(a=r[0].transferables,r=r[0].value),o={type:"main_send",message_id:l,method:t,message:r},n.stringify&&(o=JSON.stringify(o)),e.postMessage(o,a.map(e=>e.object)),d(a),a.length>0&&_("trace",`'${t}' transferred ${a.length} objects to worker thread`),l++,i},s.addWorker=function(e){if(!(e instanceof Worker))throw Error("Worker broker could not add non-Worker object",e);e.addEventListener("message",function(t){let r="string"==typeof t.data?JSON.parse(t.data):t.data,n=r.message_id;if("worker_reply"===r.type)u[n]&&(r.error?u[n].reject(r.error):u[n].resolve(r.message),delete u[n]);else if("worker_send"===r.type&&null!=n){let t,i,o,a,l;try{if([a,o]=c(r.method),!o)throw Error(`Worker broker could not dispatch message type ${r.method} on target ${r.target} because no object with that name is registered on main thread`);if(l="function"==typeof o[a]&&o[a],!l)throw Error(`Worker broker could not dispatch message type ${r.method} on target ${r.target} because object has no method with that name`);t=l.apply(o,r.message)}catch(e){i=e}let u,h=[];t instanceof Promise?t.then(t=>{t instanceof s.withTransferables&&(h=t.transferables,t=t.value[0]),u={type:"main_reply",message_id:n,message:t},e.postMessage(u,h.map(e=>e.object)),d(h),h.length>0&&_("trace",`'${a}' transferred ${h.length} objects to worker thread`)},t=>{e.postMessage({type:"main_reply",message_id:n,error:t instanceof Error?`${t.message}: ${t.stack}`:t})}):(t instanceof s.withTransferables&&(h=t.transferables,t=t.value[0]),u={type:"main_reply",message_id:n,message:t,error:i instanceof Error?`${i.message}: ${i.stack}`:i},e.postMessage(u,h.map(e=>e.object)),d(h),h.length>0&&_("trace",`'${a}' transferred ${h.length} objects to worker thread`))}})},s.getMessages=function(){return u},s.getMessageId=function(){return l}),t.is_worker&&(s.postMessage=function(e,...t){let r={};"object"==typeof e&&(r=e,e=e.method);var n=new Promise((r,n)=>{u[l]={method:e,message:t,resolve:r,reject:n}});let i,o=[];return t&&1===t.length&&t[0]instanceof s.withTransferables&&(o=t[0].transferables,t=t[0].value),i={type:"worker_send",message_id:l,method:e,message:t},r.stringify&&(i=JSON.stringify(i)),self.postMessage(i,o.map(e=>e.object)),d(o),o.length>0&&_("trace",`'${e}' transferred ${o.length} objects to main thread`),l++,n},self.addEventListener("message",function(e){let t="string"==typeof e.data?JSON.parse(e.data):e.data,r=t.message_id;if("main_reply"===t.type)u[r]&&(t.error?u[r].reject(t.error):u[r].resolve(t.message),delete u[r]);else if("main_send"===t.type&&null!=r){let n,i,o,a,l;try{if([a,o]=c(t.method),!o)throw Error(`Worker broker could not dispatch message type ${t.method} on target ${t.target} because no object with that name is registered on main thread`);if(l="function"==typeof o[a]&&o[a],!l)throw Error(`Worker broker could not dispatch message type ${t.method} because worker has no method with that name`);n=l.apply(o,t.message)}catch(e){i=e}let u,h=[];n instanceof Promise?n.then(e=>{e instanceof s.withTransferables&&(h=e.transferables,e=e.value[0]),u={type:"worker_reply",message_id:r,message:e},self.postMessage(u,h.map(e=>e.object)),d(h),h.length>0&&_("trace",`'${a}' transferred ${h.length} objects to main thread`)},e=>{self.postMessage({type:"worker_reply",message_id:r,error:e instanceof Error?`${e.message}: ${e.stack}`:e})}):(n instanceof s.withTransferables&&(h=n.transferables,n=n.value[0]),u={type:"worker_reply",message_id:r,message:n,error:i instanceof Error?`${i.message}: ${i.stack}`:i},self.postMessage(u,h.map(e=>e.object)),d(h),h.length>0&&_("trace",`'${a}' transferred ${h.length} objects to main thread`))}}));const f={silent:-1,error:0,warn:1,info:2,debug:3,trace:4},p={};let m={};function _(e,...r){let n="object"==typeof e?e.level:e;if(f[n]<=f[_.level]){if(t.is_worker)return a.postMessage({method:"_logProxy",stringify:!0},e,...r);{if("object"==typeof e&&!0===e.once){if(m[JSON.stringify(r)])return Promise.resolve(!1);m[JSON.stringify(r)]=!0}let i=function(e){if(t.is_main)return p[e]=p[e]||(console[e]?console[e]:console.log).bind(console),p[e]}(n);r.length>1?i(`Tangram ${o} [${n}]: ${r[0]}`,...r.slice(1)):i(`Tangram ${o} [${n}]: ${r[0]}`)}return Promise.resolve(!0)}return Promise.resolve(!1)}_.level="info",_.workers=null,_.setLevel=function(e){_.level=e,t.is_main&&Array.isArray(_.workers)&&a.postMessage(_.workers,"_logSetLevelProxy",e)},t.is_main&&(_.setWorkers=function(e){_.workers=e},_.reset=function(){m={}}),a.addTarget("_logProxy",_),a.addTarget("_logSetLevelProxy",_.setLevel);const g={};let y;a.addTarget("Utils",g),g.isSafari=function(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)},g.isMicrosoft=function(){return/(Trident\/7.0|Edge[ /](\d+[.\d]+))/i.test(navigator.userAgent)},g._requests={},g._proxy_requests={},g.io=function(e,r=6e4,n="text",i="GET",s={},o=null,l=!1){if(t.is_worker&&g.isMicrosoft())return _("debug","Proxying request for URL to worker",e),o&&(g._proxy_requests[o]=!0),a.postMessage("Utils.io",e,r,n,i,s,o,!0);var u=new XMLHttpRequest,c=new Promise((t,o)=>{if(u.open(i,e,!0),u.timeout=r,u.responseType=n,s&&"object"==typeof s)for(let e in s)u.setRequestHeader(e,s[e]);u.onload=()=>{200===u.status?["text","json"].indexOf(u.responseType)>-1?t({body:u.responseText,status:u.status}):t({body:u.response,status:u.status}):204===u.status?t({body:null,status:u.status}):o(Error("Request error with a status of "+u.statusText))},u.onerror=e=>{o(Error("There was a network error"+e.toString()))},u.ontimeout=e=>{o(Error("timeout "+e.toString()))},u.send()});return c=c.then(e=>(o&&delete g._requests[o],l?a.withTransferables(e):e)),o&&(g._requests[o]=u),c},g.cancelRequest=function(e){if(t.is_worker&&g._proxy_requests[e])return a.postMessage("Utils.cancelRequest",e);g._requests[e]?(_("trace",`Cancelling network request key '${e}'`),g._requests[e].abort(),delete g._requests[e]):_("trace",`Could not find network request key '${e}'`)},g.serializeWithFunctions=function(e){return"function"==typeof e?e.toString():JSON.stringify(e,function(e,t){return"function"==typeof t?t.toString():t})},g.use_high_density_display=!0,g.updateDevicePixelRatio=function(){let e=g.device_pixel_ratio;return g.device_pixel_ratio=g.use_high_density_display&&window.devicePixelRatio||1,g.device_pixel_ratio!==e},t.is_main&&g.updateDevicePixelRatio(),g.isPowerOf2=function(e){return!(e&e-1)},g.interpolate=function(e,t,r){if(!Array.isArray(t)||!Array.isArray(t[0]))return t;if(t.length<1)return t;var n,i,s,o,a;if(e<=t[0][0])o=t[0][1],"function"==typeof r&&(o=r(o));else if(e>=t[t.length-1][0])o=t[t.length-1][1],"function"==typeof r&&(o=r(o));else for(var l=0;l<t.length-1;l++)if(e>=t[l][0]&&e<t[l+1][0]){if(n=t[l][0],i=t[l+1][0],Array.isArray(t[l][1])){o=[];for(var u=0;u<t[l][1].length;u++)"function"==typeof r?(a=r(t[l][1][u]),s=r(t[l+1][1][u])-a,o[u]=s*(e-n)/(i-n)+a):(s=t[l+1][1][u]-t[l][1][u],o[u]=s*(e-n)/(i-n)+t[l][1][u])}else"function"==typeof r?(a=r(t[l][1]),o=(s=r(t[l+1][1])-a)*(e-n)/(i-n)+a):o=(s=t[l+1][1]-t[l][1])*(e-n)/(i-n)+t[l][1];break}return o},g.toCSSColor=function(e){if(null!=e)return 1===e[3]?`rgb(${e.slice(0,3).map(e=>Math.round(255*e)).join(", ")})`:`rgba(${e.map((e,t)=>t<3&&Math.round(255*e)||e).join(", ")})`};var v=y={draw_label_collision_boxes:!1,draw_label_texture_boxes:!1,suppress_label_fade_in:!1,suppress_label_snap_animation:!1,show_hidden_labels:!1,layer_stats:!1,wireframe:!1};function b(e){if("string"==typeof e&&-1===e.search(/^(data|blob):/)){let t=e.indexOf("?");t>-1&&(e=e.substr(0,t));let r=e.indexOf("#");return r>-1&&(e=e.substr(0,r)),e.substr(0,e.lastIndexOf("/")+1)||""}return""}function x(e){if("string"==typeof e)return!(e.search(/^(http|https|data|blob):/)>-1||"//"===e.substr(0,2))}let w;function A(e,t){e=e.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var r=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===r?"":decodeURIComponent(r[1].replace(/\+/g," "))}const E={id:0,queue:[],max_time:20,start_time:null,state:{},add(e){e.id=E.id++,e.max_time=e.max_time||E.max_time,e.pause_factor=e.pause_factor||1;let t=new Promise((t,r)=>{e.resolve=t,e.reject=r});return e.promise=t,e.elapsed=0,e.total_elapsed=0,e.stats={calls:0},this.queue.push(e),this.start_time=this.start_time||performance.now(),this.elapsed=performance.now()-this.start_time,(this.elapsed<E.max_time||e.immediate)&&this.process(e),e.promise},remove(e){let t=this.queue.indexOf(e);t>-1&&this.queue.splice(t,1)},process(e){if(!this.state.user_moving_view||!1!==e.user_moving_view)return e.pause?(e.pause--,!0):(e.stats.calls++,e.start_time=performance.now(),e.run(e))},processAll(){this.start_time=this.start_time||performance.now();for(let e=0;e<this.queue.length;e++){let t=this.queue[e];if(!0!==this.process(t)&&(t.pause||(t.pause=t.elapsed>t.max_time?t.pause_factor:0),t.total_elapsed+=t.elapsed),this.elapsed=performance.now()-this.start_time,this.elapsed>=E.max_time){this.start_time=null;break}}},finish(e,t){return e.elapsed=performance.now()-e.start_time,e.total_elapsed+=e.elapsed,this.remove(e),e.resolve(t),e.promise},cancel(e){let t;e.cancel instanceof Function&&(t=e.cancel(e)),e.resolve(t)},shouldContinue(e){return e.elapsed=performance.now()-e.start_time,this.elapsed=performance.now()-this.start_time,e.elapsed<e.max_time&&this.elapsed<E.max_time},removeForTile(e){for(let t=this.queue.length-1;t>=0;t--)this.queue[t].tile_id===e&&(this.cancel(this.queue[t]),this.queue.splice(t,1))},setState(e){this.state=e}};function T(e){let t=[];return Object.assign(e,{subscribe(e){-1===t.indexOf(e)&&t.push(e)},unsubscribe(e){let r=t.indexOf(e);r>-1&&t.splice(r,1)},unsubscribeAll(){t=[]},trigger(e,...r){t.forEach(t=>{if("function"==typeof t[e])try{t[e](...r)}catch(t){_("warn",`Caught exception in listener for event '${e}':`,t)}})},hasSubscribersFor(e){let r=!1;return t.forEach(t=>{"function"==typeof t[e]&&(r=!0)}),r}})}function S(e,t){let r={};return t.forEach(t=>r[t]=e[t]),r}class k{constructor(e,t,r={}){r=k.sliceOptions(r),this.gl=e,this.texture=e.createTexture(),this.texture&&(this.valid=!0),this.bind(),this.name=t,this.retain_count=0,this.config_type=null,this.loading=null,this.loaded=!1,this.filtering=r.filtering,this.density=r.density||1,this.sprites=r.sprites,this.texcoords={},this.sizes={},this.css_sizes={},this.aspects={},this.setData(1,1,new Uint8Array([0,0,0,0]),{filtering:"nearest"}),this.loaded=!1,k.textures[this.name]&&(this.retain_count=k.textures[this.name].retain_count,k.textures[this.name].retain_count=0,k.textures[this.name].destroy()),k.textures[this.name]=this,k.texture_configs[this.name]=JSON.stringify(Object.assign({name:t},r)),this.load(r),_("trace",`creating Texture ${this.name}`)}destroy({force:e}={}){this.retain_count>0&&!e?_("error",`Texture '${this.name}': destroying texture with retain count of '${this.retain_count}'`):this.valid&&(this.gl.deleteTexture(this.texture),this.texture=null,k.textures[this.name]===this&&(delete k.textures[this.name],delete k.texture_configs[this.name]),this.valid=!1,_("trace",`destroying Texture ${this.name}`))}retain(){this.retain_count++}release(){this.retain_count<=0&&_("error",`Texture '${this.name}': releasing texture with retain count of '${this.retain_count}'`),this.retain_count--,this.retain_count<=0&&this.destroy()}bind(e=0){this.valid&&(k.activeUnit!==e&&(this.gl.activeTexture(this.gl.TEXTURE0+e),k.activeUnit=e,k.boundTexture=null),k.boundTexture!==this.texture&&(this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture),k.boundTexture=this.texture))}load(e){return e?(this.loading=null,"string"==typeof e.url?(this.config_type="url",this.setUrl(e.url,e)):e.element?(this.config_type="element",this.setElement(e.element,e)):e.data&&e.width&&e.height&&(this.config_type="data",this.setData(e.width,e.height,e.data,e)),this.loading=this.loading&&this.loading.then(()=>(this.calculateSprites(),this))||Promise.resolve(this),this.loading):this.loading||Promise.resolve(this)}setUrl(e,t={}){if(this.valid)return this.url=e,this.loading=new Promise(e=>{let r=new Image;r.onload=()=>{try{if("data:"===this.url.slice(0,5)){const e=document.createElement("canvas"),n=e.getContext("2d");e.width=r.width,e.height=r.height,n.drawImage(r,0,0),this.setElement(e,t)}else this.setElement(r,t)}catch(e){this.loaded=!1,_("warn",`Texture '${this.name}': failed to load url: '${this.url}'`,e,t),k.trigger("warning",{message:`Failed to load texture from ${this.url}`,error:e,texture:t})}this.loaded=!0,e(this)},r.onerror=r=>{this.loaded=!1,_("warn",`Texture '${this.name}': failed to load url: '${this.url}'`,r,t),k.trigger("warning",{message:`Failed to load texture from ${this.url}`,error:r,texture:t}),e(this)},g.isSafari()&&"data:"===this.url.slice(0,5)||(r.crossOrigin="anonymous"),r.src=this.url}),this.loading}setData(e,t,r,n={}){return this.width=e,this.height=t,Array.isArray(r)&&(r=new Uint8Array(r)),this.update(r,n),this.setFiltering(n),this.loaded=!0,this.loading=Promise.resolve(this),this.loading}setElement(e,t){let r=e;if("string"==typeof e&&(e=document.querySelector(e)),e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement)this.update(e,t),this.setFiltering(t);else{this.loaded=!1;let e=`the 'element' parameter (\`element: ${JSON.stringify(r)}\`) must be a CSS `;e+="selector string, or a <canvas>, <image> or <video> object",_("warn",`Texture '${this.name}': ${e}`,t),k.trigger("warning",{message:`Failed to load texture because ${e}`,texture:t})}return this.loaded=!0,this.loading=Promise.resolve(this),this.loading}update(e,t={}){this.valid&&(this.bind(),e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLImageElement&&e.complete?(this.width=e.width,this.height=e.height,this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1!==t.UNPACK_FLIP_Y_WEBGL),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.UNPACK_PREMULTIPLY_ALPHA_WEBGL||!1),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e)):(this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,null),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,null),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.width,this.height,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e)),k.trigger("update",this))}setFiltering(e={}){if(this.valid){e.filtering=e.filtering||"linear";var t=this.gl;this.bind(),g.isPowerOf2(this.width)&&g.isPowerOf2(this.height)?(this.power_of_2=!0,t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,e.TEXTURE_WRAP_S||e.repeat&&t.REPEAT||t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,e.TEXTURE_WRAP_T||e.repeat&&t.REPEAT||t.CLAMP_TO_EDGE),"mipmap"===e.filtering?(this.filtering="mipmap",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.generateMipmap(t.TEXTURE_2D)):"linear"===e.filtering?(this.filtering="linear",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):"nearest"===e.filtering&&(this.filtering="nearest",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST))):(this.power_of_2=!1,t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),"nearest"===e.filtering?(this.filtering="nearest",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)):(this.filtering="linear",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR))),k.trigger("update",this)}}calculateSprites(){if(this.sprites)for(let e in this.sprites){let t=this.sprites[e];this.texcoords[e]=k.getTexcoordsForSprite([t[0],t[1]],[t[2],t[3]],[this.width,this.height]),this.sizes[e]=[t[2],t[3]],this.css_sizes[e]=[t[2]/this.density,t[3]/this.density],this.aspects[e]=t[2]/t[3]}}byteSize(){return Math.round(this.width*this.height*4*("mipmap"==this.filtering?1.33:1))}}k.create=function(e,t,r){return new k(e,t,r)},k.retain=function(e){k.textures[e]&&k.textures[e].retain()},k.release=function(e){k.textures[e]&&k.textures[e].release()},k.destroy=function(e){Object.keys(k.textures).forEach(t=>{var r=k.textures[t];r.gl===e&&r.destroy({force:!0})})},k.getSpriteInfo=function(e,t){let r=k.textures[e];return r&&{size:r.sizes[t],css_size:r.css_sizes[t],aspect:r.aspects[t],texcoords:r.texcoords[t]}},k.getTexcoordsForSprite=function(e,t,r){var n=r[1]-e[1]-t[1];return[e[0]/r[0],n/r[1],(t[0]+e[0])/r[0],(t[1]+n)/r[1]]},k.createFromObject=function(e,t){let r=[];if(t)for(let n in t){let i=t[n];if(i.skip_create)continue;if(!k.changed(n,i))continue;let s=k.create(e,n,i);r.push(s.loading)}return Promise.all(r)},k.default="__default",k.createDefault=function(e){return k.create(e,k.default)},k.sliceOptions=function(e){return{filtering:e.filtering,sprites:e.sprites,url:e.url,element:e.element,data:e.data,width:e.width,height:e.height,density:e.density,repeat:e.repeat,TEXTURE_WRAP_S:e.TEXTURE_WRAP_S,TEXTURE_WRAP_T:e.TEXTURE_WRAP_T,UNPACK_FLIP_Y_WEBGL:e.UNPACK_FLIP_Y_WEBGL,UNPACK_PREMULTIPLY_ALPHA_WEBGL:e.UNPACK_PREMULTIPLY_ALPHA_WEBGL}},k.changed=function(e,t){let r=k.textures[e];if(r){if("element"===r.config_type||null!=t.element)return!0;if(t=k.sliceOptions(t),k.texture_configs[e]===JSON.stringify(Object.assign({name:e},t)))return!1}return!0},k.getInfo=function(e){if(e||(e=Object.keys(k.textures)),Array.isArray(e))return Promise.all(e.map(e=>k.getInfo(e)));var t=k.textures[e];return t?(t.loading||Promise.resolve(t)).then(()=>({name:t.name,width:t.width,height:t.height,density:t.density,css_size:[t.width/t.density,t.height/t.density],aspect:t.width/t.height,sprites:t.sprites,texcoords:t.texcoords,sizes:t.sizes,css_sizes:t.css_sizes,aspects:t.aspects,filtering:t.filtering,power_of_2:t.power_of_2,valid:t.valid})):Promise.resolve(null)},k.syncTexturesToWorker=function(e){return a.postMessage("Texture.getInfo",e).then(e=>(e&&e.filter(e=>e).forEach(e=>k.textures[e.name]=e),k.textures))},k.getMaxTextureSize=function(e){return e.getParameter(e.MAX_TEXTURE_SIZE)},k.textures={},k.texture_configs={},k.boundTexture=null,k.activeUnit=null,a.addTarget("Texture",k),T(k);var O={parseUniforms:function(e={}){var t=[];for(const[r,n]of Object.entries(e))if("number"==typeof n)t.push({type:"float",method:"1f",name:r,value:n,path:[r]});else if(Array.isArray(n)){if("number"==typeof n[0])n.length>=2&&n.length<=4?t.push({type:"vec"+n.length,method:n.length+"fv",name:r,value:n,path:[r]}):n.length>4&&t.push({type:"float[]",method:"1fv",name:r+"[0]",value:n,path:[r]});else if("string"==typeof n[0])for(let e=0;e<n.length;e++)t.push({type:"sampler2D",method:"1i",name:r+"["+e+"]",value:n[e],path:[r,e]});else if(Array.isArray(n[0])&&"number"==typeof n[0][0]&&n[0].length>=2&&n[0].length<=4)for(let e=0;e<n.length;e++)t.push({type:"vec"+n[0].length,method:n[0].length+"fv",name:r+"["+e+"]",value:n[e],path:[r,e]})}else"boolean"==typeof n?t.push({type:"bool",method:"1i",name:r,value:n,path:[r]}):"string"==typeof n&&t.push({type:"sampler2D",method:"1i",name:r,value:n,path:[r]});return t},defineVariable:function(e,t){var r,n;if("number"==typeof t)r="float";else if(Array.isArray(t))"number"==typeof t[0]?t.length>=2&&t.length<=4?r="vec"+t.length:(r="float",n=t.length):"string"==typeof t[0]?(r="sampler2D",n=t.length):Array.isArray(t[0])&&"number"==typeof t[0][0]&&t[0].length>=2&&t[0].length<=4&&(r="vec"+t[0].length,n=t.length);else if("boolean"==typeof t)r="bool";else{if("string"!=typeof t)return;r="sampler2D"}var i="";return i+=`${r} ${e}`,n&&(i+=`[${n}]`),i+";\n"},defineUniform:function(e,t){var r=O.defineVariable(e,t);if(r)return"uniform "+r},expandVec3:function(e,t=1){let r;if(Array.isArray(e)){if(2!==e.length)return e;r=[...e,t].map(parseFloat)}else r=[e,e,e].map(parseFloat);if(r&&r.every(e=>"number"==typeof e&&!isNaN(e)))return r},expandVec4:function(e,t=1){let r;if(Array.isArray(e)){if(3!==e.length)return e;r=[...e,t].map(parseFloat)}else r=[e,e,e,t].map(parseFloat);if(r&&r.every(e=>"number"==typeof e&&!isNaN(e)))return r}};let R=[];function C(e,t){let r=R.filter(t=>t[0]===e)[0];return r=r&&r[1],r||(R.push([e,{}]),r=R[R.length-1][1]),r[t]||(r[t]=e.getExtension(t)),r[t]}function N(e){var t,r,n=0;if(0===e.length)return n;for(t=0,r=e.length;t<r;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return n}function P(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var M,D,z=(D||(D=1,M=function(e){e=String(e);for(var t,r=[];t=e.match(/ERROR\:([^\n]+)/);){e=e.slice(t.index+1);var n=(o=t[1].trim()).split(":"),i=n.slice(2).join(":").trim(),s=parseInt(n[0],10),o=parseInt(n[1],10);r.push({message:i,file:s,line:o})}return r}),M),I=P(z);const F=/^\s*#pragma.*$/gm,L=/\\\s*\n/gm;class j{constructor(e,t,r,n){n=n||{},this.gl=e,this.program=null,this.compiled=!1,this.compiling=!1,this.error=null,this.defines=Object.assign({},n.defines||{}),this.blocks=Object.assign({},n.blocks||{}),this.block_scopes=Object.assign({},n.block_scopes||{}),this.extensions=n.extensions||[],this.dependent_uniforms=n.uniforms,this.uniforms={},this.attribs={},this.vertex_source=t,this.fragment_source=r,this.id=j.id++,this.name=n.name}destroy(){this.gl.useProgram(null),this.gl.deleteProgram(this.program),this.program=null,this.uniforms={},this.attribs={},this.compiled=!1}use(){this.compiled&&(j.current!==this&&this.gl.useProgram(this.program),j.current=this)}compile(){if(this.compiling)throw new Error(`ShaderProgram.compile(): skipping for ${this.id} (${this.name}) because already compiling`);this.compiling=!0,this.compiled=!1,this.error=null,this.computed_vertex_source=this.vertex_source,this.computed_fragment_source=this.fragment_source;let e=this.checkExtensions();var t,r=this.buildDefineList(),n=this.buildShaderBlockList();for(var i in n){var s=n[i];if(s&&(!Array.isArray(s)||0!==s.length)){t=new RegExp("^\\s*#pragma\\s+tangram:\\s+"+i+"\\s*$","m");var o=this.computed_vertex_source.match(t),a=this.computed_fragment_source.match(t);if(null!=o||null!=a){var l="";s.forEach(e=>{let t=`${e.scope}, ${e.key}, ${e.num}`;l+=`\n// tangram-block-start: ${t}\n`,l+=e.source,l+=`\n// tangram-block-end: ${t}\n`}),null!=o&&(this.computed_vertex_source=this.computed_vertex_source.replace(t,l)),null!=a&&(this.computed_fragment_source=this.computed_fragment_source.replace(t,l)),r["TANGRAM_BLOCK_"+i.replace(/[\s-]+/g,"_").toUpperCase()]=!0}}}this.computed_vertex_source=this.computed_vertex_source.replace(F,""),this.computed_fragment_source=this.computed_fragment_source.replace(F,""),this.ensureUniforms(this.dependent_uniforms);let u="",c=this.gl.getShaderPrecisionFormat(this.gl.FRAGMENT_SHADER,this.gl.HIGH_FLOAT);u=c&&c.precision>0?"precision highp float;\n":"precision mediump float;\n",r.TANGRAM_VERTEX_SHADER=!0,r.TANGRAM_FRAGMENT_SHADER=!1,this.computed_vertex_source=u+j.buildDefineString(r)+this.computed_vertex_source,r.TANGRAM_VERTEX_SHADER=!1,r.TANGRAM_FRAGMENT_SHADER=!0,this.computed_fragment_source=j.buildExtensionString(e)+u+j.buildDefineString(r)+this.computed_fragment_source,this.computed_vertex_source=this.computed_vertex_source.replace(L,""),this.computed_fragment_source=this.computed_fragment_source.replace(L,"");try{this.program=j.updateProgram(this.gl,this.program,this.computed_vertex_source,this.computed_fragment_source),this.compiled=!0,this.compiling=!1}catch(e){throw this.program=null,this.compiled=!1,this.compiling=!1,this.error=e,this.error.vertex_shader_source=this.computed_vertex_source,this.error.fragment_shader_source=this.computed_fragment_source,"vertex"!==e.type&&"fragment"!==e.type||(this.shader_errors=e.errors,this.shader_errors.forEach(t=>{t.type=e.type,t.block=this.block(e.type,t.line),t.line=this.block(e.type,t.line)}),this.error.shader_errors=this.shader_errors),e}this.computed_vertex_source=null,this.computed_fragment_source=null,this.use(),this.refreshUniforms(),this.refreshAttributes()}buildDefineList(){var e,t={};for(e in j.defines)t[e]=j.defines[e];for(e in this.defines)t[e]=this.defines[e];return t}buildShaderBlockList(){let e,t={};for(e in j.blocks)t[e]=[],Array.isArray(j.blocks[e])?t[e].push(...j.blocks[e].map((t,r)=>({key:e,source:t,num:r,scope:"ShaderProgram"}))):t[e]=[{key:e,source:j.blocks[e],num:0,scope:"ShaderProgram"}];for(e in this.blocks)if(t[e]=t[e]||[],Array.isArray(this.blocks[e])){let r=this.block_scopes&&this.block_scopes[e]||[],n=null,i=0;for(let s=0;s<this.blocks[e].length;s++)r[s]!==n&&(n=r[s],i=0),t[e].push({key:e,source:this.blocks[e][s],num:i,scope:n||this.name}),i++}else t[e].push({key:e,source:this.blocks[e],num:0,scope:this.name});return t}ensureUniforms(e){if(!e)return;const t=Object.entries(e).map(([e,t])=>O.defineUniform(e,t)).filter(e=>e);this.computed_vertex_source=t.join("\n")+this.computed_vertex_source,this.computed_fragment_source=t.join("\n")+this.computed_fragment_source}setUniforms(e,t=!0){this.compiled&&(t&&(this.texture_unit=0),O.parseUniforms(e).forEach(({name:e,type:t,value:r,method:n})=>{"sampler2D"===t?this.setTextureUniform(e,r):this.uniform(n,e,r)}))}saveUniforms(e){let t=e||this.uniforms;for(let e in t){let t=this.uniforms[e];t&&(t.saved_value=t.value)}this.saved_texture_unit=this.texture_unit||0}restoreUniforms(e){let t=e||this.uniforms;for(let e in t){let t=this.uniforms[e];t&&t.saved_value&&(t.value=t.saved_value,this.updateUniform(t))}this.texture_unit=this.saved_texture_unit||0}setTextureUniform(e,t){var r=k.textures[t];null!=r?(r.bind(this.texture_unit),this.uniform("1i",e,this.texture_unit),this.texture_unit++):_("warn",`Cannot find texture '${t}'`)}uniform(e,t,r){if(!this.compiled)return;this.uniforms[t]=this.uniforms[t]||{};let n=this.uniforms[t];n.name=t,void 0===n.location&&(n.location=this.gl.getUniformLocation(this.program,t)),n.method=e,n.value=r,this.updateUniform(n)}updateUniform(e){this.compiled&&e&&null!=e.location&&(this.use(),this.commitUniform(e))}commitUniform(e){let t=e.location,r=e.value;switch(e.method){case"1i":this.gl.uniform1i(t,r);break;case"1f":this.gl.uniform1f(t,r);break;case"2f":this.gl.uniform2f(t,r[0],r[1]);break;case"3f":this.gl.uniform3f(t,r[0],r[1],r[2]);break;case"4f":this.gl.uniform4f(t,r[0],r[1],r[2],r[3]);break;case"1iv":this.gl.uniform1iv(t,r);break;case"3iv":this.gl.uniform3iv(t,r);break;case"1fv":this.gl.uniform1fv(t,r);break;case"2fv":this.gl.uniform2fv(t,r);break;case"3fv":this.gl.uniform3fv(t,r);break;case"4fv":this.gl.uniform4fv(t,r);break;case"Matrix3fv":this.gl.uniformMatrix3fv(t,!1,r);break;case"Matrix4fv":this.gl.uniformMatrix4fv(t,!1,r)}}refreshUniforms(){if(this.compiled)for(var e in this.uniforms){let t=this.uniforms[e];t.location=this.gl.getUniformLocation(this.program,e),this.updateUniform(t)}}refreshAttributes(){this.attribs={}}attribute(e){if(this.compiled){var t=this.attribs[e]=this.attribs[e]||{};return null!=t.location||(t.name=e,t.location=this.gl.getAttribLocation(this.program,e)),t}}source(e){return"vertex"===e?this.computed_vertex_source:"fragment"===e?this.computed_fragment_source:void 0}lines(e){let t=this.source(e);return t?t.split("\n"):[]}line(e,t){let r=this.lines(e);if(r)return r[t]}block(e,t){let r,n=this.lines(e);for(let e=0;e<t&&e<n.length;e++){let t=n[e],i=t.match(/\/\/ tangram-block-start: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/);i&&i.length>1?r={scope:i[1],name:i[2],num:i[3]}:(i=t.match(/\/\/ tangram-block-end: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/),i&&i.length>1&&(r=null)),r&&(r.line=null==r.line?-1:r.line+1,r.source=t)}return r}checkExtensions(){let e=[];return this.extensions.forEach(t=>{let r=C(this.gl,t),n=`TANGRAM_EXTENSION_${t}`;this.defines[n]=null!=r,r?e.push(t):_("debug",`Could not enable extension '${t}'`)}),e}}j.id=0,j.current=null,j.defines={},j.blocks={},j.reset=function(){j.programs_by_source={},j.shaders_by_source={}},j.reset(),j.buildDefineString=function(e){var t="";for(var r in e)null!=e[r]&&!1!==e[r]&&("boolean"==typeof e[r]&&!0===e[r]?t+="#define "+r+"\n":"number"==typeof e[r]&&Math.floor(e[r])===e[r]?t+="#define "+r+" "+e[r].toFixed(1)+"\n":t+="#define "+r+" "+e[r]+"\n");return t},j.buildExtensionString=function(e){let t="";return(e=e||[]).forEach(e=>{t+=`#ifdef GL_${e}\n#extension GL_${e} : enable\n#endif\n`}),t},j.addBlock=function(e,...t){j.blocks[e]=j.blocks[e]||[],j.blocks[e].push(...t)},j.removeBlock=function(e){j.blocks[e]=[]},j.replaceBlock=function(e,...t){j.removeBlock(e),j.addBlock(e,...t)},j.updateProgram=function(e,t,r,n){let i=N(e._tangram_id+"::"+r+"::"+n);if(j.programs_by_source[i])return _("trace","Reusing identical source GL program object"),j.programs_by_source[i];var s=j.createShader(e,r,e.VERTEX_SHADER),o=j.createShader(e,n,e.FRAGMENT_SHADER);if(e.useProgram(null),null!=t)for(var a=e.getAttachedShaders(t),l=0;l<a.length;l++)e.detachShader(t,a[l]);else t=e.createProgram();if(null==s||null==o)return t;if(e.attachShader(t,s),e.attachShader(t,o),e.bindAttribLocation(t,0,"a_position"),e.linkProgram(t),!e.getProgramParameter(t,e.LINK_STATUS)){let i=new Error(`WebGL program error:\n VALIDATE_STATUS: ${e.getProgramParameter(t,e.VALIDATE_STATUS)}\n ERROR: ${e.getError()}\n --- Vertex Shader ---\n ${r}\n --- Fragment Shader ---\n ${n}`);throw Object.assign(new Error(i),{type:"program"})}return j.programs_by_source[i]=t,t},j.createShader=function(e,t,r){let n=N(e._tangram_id+"::"+t);if(j.shaders_by_source[n])return _("trace","Reusing identical source GL shader object"),j.shaders_by_source[n];let i=e.createShader(r);if(e.shaderSource(i,t),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)){let t=r===e.VERTEX_SHADER?"vertex":"fragment",n=e.getShaderInfoLog(i),s=I(n);throw Object.assign(new Error(n),{type:t,errors:s})}return j.shaders_by_source[n]=i,i};var U,B={disabled:!1,bound_vao:[],init(e){let t;!0!==this.disabled&&(t=C(e,"OES_vertex_array_object")),null!=t?_("info","Vertex Array Object extension available"):!0!==this.disabled?_("warn","Vertex Array Object extension NOT available"):_("warn","Vertex Array Object extension force disabled")},getExtension(e,t){if(!0!==this.disabled)return C(e,t)},create(e,t,r){let n={};n.setup=t,n.teardown=r;let i=this.getExtension(e,"OES_vertex_array_object");return null!=i&&(n._vao=i.createVertexArrayOES(),i.bindVertexArrayOES(n._vao)),n.setup(),n},getCurrentBinding(e){let t=this.bound_vao.filter(t=>t[0]===e)[0];return t&&t[1]},setCurrentBinding(e,t){let r=this.bound_vao,n=r.filter(t=>t[0]===e)[0];null==n?r.push([e,t]):n[1]=t},bind(e,t){let r=this.getExtension(e,"OES_vertex_array_object");if(null!=t)null!=r&&null!=t._vao?(r.bindVertexArrayOES(t._vao),this.setCurrentBinding(e,t)):t.setup();else{let t=this.getCurrentBinding(e);null!=r?r.bindVertexArrayOES(null):null!=t&&"function"==typeof t.teardown&&t.teardown(),this.setCurrentBinding(e,null)}},destroy(e,t){let r=this.getExtension(e,"OES_vertex_array_object");null!=r&&null!=t&&null!=t._vao&&(r.deleteVertexArrayOES(t._vao),t._vao=null)}};function V(e,...t){for(let r=0;r<t.length;r++){let n=t[r];if(n)for(let t in n){let r=n[t];null===r||"object"!=typeof r||Array.isArray(r)?void 0!==r&&(e[t]=r):null===e[t]||"object"!=typeof e[t]||Array.isArray(e[t])?e[t]=V({},r):e[t]=V(e[t],r)}}return e}var G=U={};U.default_source_max_zoom=18,U.default_view_max_zoom=20,U.max_style_zoom=25,U.tile_size=256,U.half_circumference_meters=20037508.342789244,U.circumference_meters=2*U.half_circumference_meters,U.min_zoom_meters_per_pixel=U.circumference_meters/U.tile_size;let $=[];U.metersPerPixel=function(e){return $[e]=$[e]||U.min_zoom_meters_per_pixel/Math.pow(2,e),$[e]};let q=[];U.metersPerTile=function(e){return q[e]=q[e]||U.circumference_meters/Math.pow(2,e),q[e]},U.tile_scale=4096,U.units_per_pixel=U.tile_scale/U.tile_size,U.height_scale=16;let W=[];U.unitsPerMeter=function(e){return W[e]=W[e]||U.tile_scale/(U.tile_size*U.metersPerPixel(e)),W[e]},U.metersForTile=function(e){return{x:e.x*U.circumference_meters/Math.pow(2,e.z)-U.half_circumference_meters,y:-(e.y*U.circumference_meters/Math.pow(2,e.z)-U.half_circumference_meters)}},U.tileForMeters=function([e,t],r){return{x:Math.floor((e+U.half_circumference_meters)/(U.circumference_meters/Math.pow(2,r))),y:Math.floor((-t+U.half_circumference_meters)/(U.circumference_meters/Math.pow(2,r))),z:r}},U.wrapTile=function({x:e,y:t,z:r},n={x:!0,y:!1}){var i=(1<<r)-1;return n.x&&(e&=i),n.y&&(t&=i),{x:e,y:t,z:r}},U.metersToLatLng=function(e){return e[0]/=U.half_circumference_meters,e[1]/=U.half_circumference_meters,e[1]=(2*Math.atan(Math.exp(e[1]*Math.PI))-Math.PI/2)/Math.PI,e[0]*=180,e[1]*=180,e},U.latLngToMeters=function(e){return e[1]=Math.log(Math.tan(e[1]*Math.PI/360+Math.PI/4))/Math.PI,e[1]*=U.half_circumference_meters,e[0]*=U.half_circumference_meters/180,e},U.tileSpaceToLatlng=function(e,t,r){const n=U.unitsPerMeter(t);return U.transformGeometry(e,e=>{e[0]=e[0]/n+r.x,e[1]=e[1]/n+r.y,U.metersToLatLng(e)}),e},U.copyGeometry=function(e){if(null==e)return;let t={type:e.type};return"Point"===e.type?t.coordinates=[e.coordinates[0],e.coordinates[1]]:"LineString"===e.type||"MultiPoint"===e.type?t.coordinates=e.coordinates.map(e=>[e[0],e[1]]):"Polygon"===e.type||"MultiLineString"===e.type?t.coordinates=e.coordinates.map(e=>e.map(e=>[e[0],e[1]])):"MultiPolygon"===e.type&&(t.coordinates=e.coordinates.map(e=>e.map(e=>e.map(e=>[e[0],e[1]])))),t},U.transformGeometry=function(e,t){null!=e&&("Point"===e.type?t(e.coordinates):"LineString"===e.type||"MultiPoint"===e.type?e.coordinates.forEach(t):"Polygon"===e.type||"MultiLineString"===e.type?e.coordinates.forEach(e=>e.forEach(t)):"MultiPolygon"===e.type&&e.coordinates.forEach(e=>{e.forEach(e=>e.forEach(t))}))},U.boxIntersect=function(e,t){return!(t.sw.x>e.ne.x||t.ne.x<e.sw.x||t.sw.y>e.ne.y||t.ne.y<e.sw.y)},U.findBoundingBox=function(e){for(var t=1/0,r=-1/0,n=1/0,i=-1/0,s=e[0].length,o=0;o<s;o++){var a=e[0][o];a[0]<t&&(t=a[0]),a[1]<n&&(n=a[1]),a[0]>r&&(r=a[0]),a[1]>i&&(i=a[1])}return[t,n,r,i]},U.geometryType=function(e){return"Polygon"===e||"MultiPolygon"===e?"polygon":"LineString"===e||"MultiLineString"===e?"line":"Point"===e||"MultiPoint"===e?"point":void 0},U.centroid=function(e,t=!0){if(!e||0===e.length)return;let r,n=0,i=0,s=0,o=e[0],a=o.length;t&&(r=o[0],o=o.map(e=>[e[0]-r[0],e[1]-r[1]]));for(let e=0,t=a-1;e<a;t=e,e++){let r=o[e],a=o[t],l=r[1]*a[0]-a[1]*r[0];n+=(r[0]+a[0])*l,i+=(r[1]+a[1])*l,s+=3*l}if(!s)return;let l=[n/s,i/s];return t&&(l[0]+=r[0],l[1]+=r[1]),l},U.multiCentroid=function(e){let t=0,r=null;for(let n=0;n<e.length;n++){let i=U.centroid(e[n]);i&&(r=r||[0,0],r[0]+=i[0],r[1]+=i[1],t++)}return t>0&&(r[0]/=t,r[1]/=t),r},U.signedPolygonRingAreaSum=function(e){let t=0,r=e.length;for(let n=0;n<r-1;n++){let r=e[n],i=e[n+1];t+=r[0]*i[1]-i[0]*r[1]}return t+=e[r-1][0]*e[0][1]-e[0][0]*e[r-1][1],t},U.polygonRingArea=function(e){return Math.abs(U.signedPolygonRingAreaSum(e))/2},U.polygonArea=function(e){if(e)return U.polygonRingArea(e[0])},U.multiPolygonArea=function(e){let t=0;for(let r=0;r<e.length;r++)t+=U.polygonArea(e[r]);return t},U.ringWinding=function(e){let t=U.signedPolygonRingAreaSum(e);return t>0?"CW":t<0?"CCW":void 0};const H={functions:{},num_functions:0,num_cached:0};function Z(e,t){if("string"==typeof e)e=K(e,t);else if(null!=e&&"object"==typeof e)for(let r in e)e[r]=Z(e[r],t);return e}function K(e,t){let r="string"==typeof e&&e.match(/^\s*function[^(]*\(([^)]*)\)\s*?\{([\s\S]*)\}$/m);if(r&&r.length>2)try{const e=r[2],n="function"==typeof t?t(e):e,i=N(n);if(void 0===H.functions[i]){let t=r[1].length>0&&r[1].split(",").map(e=>e.trim()).filter(e=>e);t=t.length>0?t:["context"],H.functions[i]=new Function(t.toString(),n),H.functions[i].source=e,H.num_functions++}else H.num_cached++;return H.functions[i]}catch(t){return e}return e}var X,Y={},Q=P(function(){if(X)return Y;X=1;var e={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function t(e){return(e=Math.round(e))<0?0:e>255?255:e}function r(e){return e<0?0:e>1?1:e}function n(e){return"%"===e[e.length-1]?t(parseFloat(e)/100*255):t(parseInt(e))}function i(e){return"%"===e[e.length-1]?r(parseFloat(e)/100):r(parseFloat(e))}function s(e,t,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?e+(t-e)*r*6:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e}try{Y.parseCSSColor=function(r){var o,a=r.replace(/ /g,"").toLowerCase();if(a in e)return e[a].slice();if("#"===a[0])return 4===a.length?(o=parseInt(a.substr(1),16))>=0&&o<=4095?[(3840&o)>>4|(3840&o)>>8,240&o|(240&o)>>4,15&o|(15&o)<<4,1]:null:7===a.length&&(o=parseInt(a.substr(1),16))>=0&&o<=16777215?[(16711680&o)>>16,(65280&o)>>8,255&o,1]:null;var l=a.indexOf("("),u=a.indexOf(")");if(-1!==l&&u+1===a.length){var c=a.substr(0,l),h=a.substr(l+1,u-(l+1)).split(","),d=1;switch(c){case"rgba":if(4!==h.length)return null;d=i(h.pop());case"rgb":return 3!==h.length?null:[n(h[0]),n(h[1]),n(h[2]),d];case"hsla":if(4!==h.length)return null;d=i(h.pop());case"hsl":if(3!==h.length)return null;var f=(parseFloat(h[0])%360+360)%360/360,p=i(h[1]),m=i(h[2]),_=m<=.5?m*(p+1):m+p-m*p,g=2*m-_;return[t(255*s(g,_,f+1/3)),t(255*s(g,_,f)),t(255*s(g,_,f-1/3)),d];default:return null}}return null}}catch(e){}return Y}());const J={},ee=e=>Math.max(e,0),te=e=>isNaN(e)?0:e,re=e=>Array.isArray(e)?e.map(parseFloat).map(te):te(parseFloat(e)),ne=e=>Array.isArray(e)?e.map(re).map(ee):ee(re(e));Object.assign(J,{clampPositive:ee,noNaN:te,parseNumber:re,parsePositiveNumber:ne}),J.wrapFunction=function(e){return`\n var feature = context.feature.properties;\n var global = context.global;\n var $zoom = context.zoom;\n var $layer = context.layer;\n var $source = context.source;\n var $geometry = context.geometry;\n var $meters_per_pixel = context.meters_per_pixel;\n var $id = context.id;\n\n var val = (function(){ ${e} }());\n\n if (typeof val === 'number' && isNaN(val)) {\n val = null; // convert NaNs to nulls\n }\n\n return val;\n `},J.zeroPair=Object.freeze([0,0]),J.defaults={color:[1,1,1,1],width:1,size:1,extrude:!1,height:20,min_height:0,order:0,z:0,outline:{color:[0,0,0,0],width:0},material:{ambient:1,diffuse:1}},J.macros={"Style.color.pseudoRandomColor":function(){return[parseInt(feature.id,16)/100%1*.7,parseInt(feature.id,16)/1e4%1*.7,parseInt(feature.id,16)/1e6%1*.7,1]},"Style.color.randomColor":function(){return[.7*Math.random(),.7*Math.random(),.7*Math.random(),1]}},J.getFeatureParseContext=function(e,t,r){return{feature:e,id:e.id,tile:t,global:r,zoom:t.style_z,geometry:G.geometryType(e.geometry.type),meters_per_pixel:t.meters_per_pixel,meters_per_pixel_sq:t.meters_per_pixel_sq,units_per_meter_overzoom:t.units_per_meter_overzoom}};const ie={STATIC:0,DYNAMIC:1,ZOOM:2};J.CACHE_TYPE=ie,J.createPropertyCache=function(e,t=null,r=null){if(null==e)return;if(e.value)return{value:e.value,zoom:e.zoom?{}:null,type:e.type};let n={value:e,type:ie.STATIC};return Array.isArray(n.value)&&Array.isArray(n.value[0])?(n.zoom={},n.type=ie.ZOOM):"function"==typeof n.value&&(n.type=ie.DYNAMIC,n.dynamic_transform="function"==typeof r?r:null),"function"==typeof t&&(n.zoom?n.value=n.value.map((e,r)=>[e[0],t(e[1],r)]):"function"!=typeof n.value&&(n.value=t(n.value,0))),n},J.createColorPropertyCache=function(e){return J.createPropertyCache(e,e=>"Style.color.pseudoRandomColor"===e?K(J.wrapFunction(J.macros["Style.color.pseudoRandomColor"])):"Style.color.randomColor"===e?J.macros["Style.color.randomColor"]:e)};const se=e=>"string"==typeof e&&"%"===e[e.length-1],oe=e=>"auto"===e,ae=e=>se(e)||oe(e),le="'size' can specify either width or height as derived from aspect ratio, but not both";function ue(e,t){return J.createPropertyCache(e.value,(r,n)=>(Array.isArray(r)?(r=r.map((t,r)=>e.has_ratio[n][r]?t:ne(t)).map((r,i)=>e.has_pct[n][i]?t.css_size[i]*r/100:r),e.has_ratio[n][0]?r[0]=r[1]*t.aspect:e.has_ratio[n][1]&&(r[1]=r[0]/t.aspect)):(r=ne(r),r=e.has_pct[n]?t.css_size.map(e=>e*r/100):[r,r]),r))}function ce(e,t){try{return e(t)}catch(r){_("warn",`Property function in layer '${t.layers[t.layers.length-1]}' failed with\n`,`error ${r.stack}\n`,`function '${e.source}'\n`,t.feature,t)}}J.createPointSizePropertyCache=function(e,t){let r=null,n=null;if(se(e))r=[!0];else if(Array.isArray(e)){if(Array.isArray(e[0])){if(e.some(e=>Array.isArray(e[1])?e[1].some(e=>ae(e)):se(e[1]))&&(r=e.map(e=>Array.isArray(e[1])?e[1].map(e=>se(e)):se(e[1])),n=e.map(e=>Array.isArray(e[1])&&e[1].map(e=>oe(e))),n.some(e=>Array.isArray(e)&&e.every(e=>e))))throw le}else if(e.some(ae)&&(r=[e.map(se)],n=[e.map(oe)],n[0].every(e=>e)))throw le}else if(oe(e))throw"this value only allowed as half of an array, eg [16px, auto]:";if(r||n){if(!t)throw"% or 'auto' keywords can only be used to specify point size when a texture is defined";(e={value:e}).has_pct=r,e.has_ratio=n,e.sprites={}}else e=J.createPropertyCache(e,ne);return e},J.evalCachedPointSizeProperty=function(e,t,r,n){if(null!=e)return e.has_pct||e.has_ratio?t?(e.sprites[t.sprite]||(e.sprites[t.sprite]=ue(e,t)),J.evalCachedProperty(e.sprites[t.sprite],n)):(e.texture=e.texture||ue(e,r),J.evalCachedProperty(e.texture,n)):J.evalCachedProperty(e,n)},J.evalCachedProperty=function(e,t){return null==e?void 0:e.dynamic?ce(e.dynamic,t):e.static?e.static:e.zoom&&e.zoom[t.zoom]?e.zoom[t.zoom]:"function"==typeof e.value?(e.dynamic_transform?e.dynamic=function(t){return e.dynamic_transform(e.value(t))}:e.dynamic=e.value,ce(e.dynamic,t)):Array.isArray(e.value)&&Array.isArray(e.value[0])?(e.zoom=e.zoom||{},e.zoom[t.zoom]=g.interpolate(t.zoom,e.value),e.zoom[t.zoom]):(e.static=e.value,e.static)},J.convertUnits=function(e,t){if(null!=e.value)return"px"===e.units?e.value*G.metersPerPixel(t.zoom):e.value;if("string"==typeof e)"px"===e.trim().slice(-2)?(e=re(e),e*=G.metersPerPixel(t.zoom)):e=re(e);else if(Array.isArray(e))return Array.isArray(e[0])?e.map(e=>[e[0],J.convertUnits(e[1],t)]):e.map(e=>J.convertUnits(e,t));return e},J.parseUnits=function(e){var t={value:re(e)};return 0!==t.value&&"string"==typeof e&&"px"===e.trim().slice(-2)&&(t.units="px"),t},J.evalCachedDistanceProperty=function(e,t){return null==e?void 0:e.dynamic?ce(e.dynamic,t):e.zoom&&e.zoom[t.zoom]?e.zoom[t.zoom]:"function"==typeof e.value?(e.dynamic=e.value,ce(e.dynamic,t)):e.zoom?(e.zoom[t.zoom]=g.interpolate(t.zoom,e.value,e=>J.convertUnits(e,t)),e.zoom[t.zoom]):J.convertUnits(e.value,t)},J.string_colors={},J.colorForString=function(e){if(J.string_colors[e])return J.string_colors[e];let t=Q.parseCSSColor(e);return t&&4===t.length?(t[0]/=255,t[1]/=255,t[2]/=255):t=J.defaults.color,J.string_colors[e]=t,t},J.evalCachedColorProperty=function(e,t={}){if(null!=e){if(e.dynamic){let r=ce(e.dynamic,t);return"string"==typeof r&&(r=J.colorForString(r)),r&&null==r[3]&&(r[3]=1),r}if(e.static)return e.static;if(e.zoom&&e.zoom[t.zoom])return e.zoom[t.zoom];if("function"==typeof e.value){e.dynamic=e.value;let r=ce(e.dynamic,t);return"string"==typeof r&&(r=J.colorForString(r)),r&&null==r[3]&&(r[3]=1),r}if("string"==typeof e.value)return e.static=J.colorForString(e.value),e.static;if(e.zoom){if(!e.zoom_preprocessed){for(let t=0;t<e.value.length;t++){let r=e.value[t];r&&"string"==typeof r[1]&&(r[1]=J.colorForString(r[1]))}e.zoom_preprocessed=!0}return e.zoom[t.zoom]=g.interpolate(t.zoom,e.value),e.zoom[t.zoom][3]=e.zoom[t.zoom][3]||1,e.zoom[t.zoom]}return e.static=e.value.map(e=>e),e.static&&null==e.static[3]&&(e.static[3]=1),e.static}},J.evalCachedColorPropertyWithAlpha=function(e,t,r){const n=J.evalCachedColorProperty(e,r);if(null!=n&&null!=t){const e=J.evalCachedProperty(t,r);if(null!=e)return[n[0],n[1],n[2],e]}return n},J.parseColor=function(e,t={}){if("function"==typeof e&&(e=ce(e,t)),"string"==typeof e)e=J.colorForString(e);else if(Array.isArray(e)&&Array.isArray(e[0])){for(let t=0;t<e.length;t++){let r=e[t];"string"==typeof r[1]&&(r[1]=J.colorForString(r[1]))}t.zoom&&(e=g.interpolate(t.zoom,e))}return Array.isArray(e)?null==(e=e.map(e=>e))[3]&&(e[3]=1):e=[0,0,0,1],e},J.calculateOrder=function(e,t){return"function"==typeof e?e=ce(e,t):"string"==typeof e&&(e=t.feature.properties[e]?t.feature.properties[e]:ne(e)),e},J.evalProperty=function(e,t){return"function"==typeof e?ce(e,t):e};class he{constructor(e,t,r){this.gl=e,this.workers=t,this._lock_fn="function"==typeof r&&r,this.init()}init(){this.requests={},this.feature=null,this.read_delay=0,this.read_delay_timer=null,this.pixels=null,this.fbo=this.gl.createFramebuffer(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.fbo_size={width:256,height:256};var e=k.create(this.gl,"__selection_fbo",{filtering:"nearest"});e.setData(this.fbo_size.width,this.fbo_size.height,null,{filtering:"nearest"}),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,e.texture,0);var t=this.gl.createRenderbuffer();this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,t),this.gl.renderbufferStorage(this.gl.RENDERBUFFER,this.gl.DEPTH_COMPONENT16,this.fbo_size.width,this.fbo_size.height),this.gl.framebufferRenderbuffer(this.gl.FRAMEBUFFER,this.gl.DEPTH_ATTACHMENT,this.gl.RENDERBUFFER,t),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null)}destroy(){this.gl&&this.fbo&&(this.gl.deleteFramebuffer(this.fbo),this.fbo=null,this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null))}get locked(){return this._lock_fn&&this._lock_fn()||!1}bind(){this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.gl.viewport(0,0,this.fbo_size.width,this.fbo_size.height),this.gl.clearColor(...he.defaultColor)}getFeatureAt(e,{radius:t}){return!e||e.x<0||e.y<0||e.x>1||e.y>1?Promise.resolve({feature:null,changed:!1}):new Promise((r,n)=>{this.selection_request_id=this.selection_request_id+1||0,this.requests[this.selection_request_id]={id:this.selection_request_id,point:e,radius:t,resolve:r,reject:n}})}pendingRequests(){return Object.keys(this.requests).length?this.requests:null}hasPendingRequests(){return null!=this.pendingRequests()}clearPendingRequests(){for(var e in this.requests){var t=this.requests[e];t.sent||(t.reject({request:t}),delete this.requests[e])}}read(){null!=this.read_delay_timer&&clearTimeout(this.read_delay_timer),this.read_delay_timer=setTimeout(()=>{if(!this.locked){var e=this.gl;for(var t in e.bindFramebuffer(e.FRAMEBUFFER,this.fbo),this.requests){var r=this.requests[t];if(r.sent)continue;let n,i,s=255,{point:o,radius:l}=r;if(l){let e=Math.min(this.fbo_size.width,this.fbo_size.height);i={x:Math.min(Math.ceil(2*l.x*this.fbo_size.width),e),y:Math.min(Math.ceil(2*l.y*this.fbo_size.height),e)}}else l={x:0,y:0},i={x:1,y:1};if((null==this.pixels||this.pixels.byteLength<i.x*i.y*4)&&(this.pixels=new Uint8Array(i.x*i.y*4)),this.pixels.fill instanceof Function)this.pixels.fill(0);else for(let e=0;e<this.pixels.length;e++)this.pixels[e]=0;e.readPixels(Math.round((o.x-l.x)*this.fbo_size.width),Math.round((1-o.y-l.y)*this.fbo_size.height),i.x,i.y,e.RGBA,e.UNSIGNED_BYTE,this.pixels);let u=4*(Math.round(i.y/2)*i.x+Math.round(i.x/2)),c=this.pixels[u]+(this.pixels[u+1]<<8)+(this.pixels[u+2]<<16);if(c>0)n=c+(this.pixels[u+3]<<24)>>>0,s=this.pixels[u+3];else{let e=-1>>>0;u=0;for(let t=0;t<i.y;t++)for(let r=0;r<i.x;r++,u+=4)if(c=this.pixels[u]+(this.pixels[u+1]<<8)+(this.pixels[u+2]<<16),c>0){let o=(r-i.x/2)*(r-i.x/2)+(t-i.y/2)*(t-i.y/2);o<=e&&(n=c+(this.pixels[u+3]<<24)>>>0,s=this.pixels[u+3],e=o)}}255!==s?null!=this.workers[s]&&a.postMessage(this.workers[s],"self.getFeatureSelection",{id:r.id,key:n}).then(e=>{this.finishRead(e)}):this.finishRead({id:r.id}),r.sent=!0}e.bindFramebuffer(e.FRAMEBUFFER,null)}},this.read_delay)}finishRead(e){var t=this.requests[e.id];if(t){var r=e.feature,n=!1;(null!=r&&null==this.feature||null==r&&null!=this.feature||null!=r&&null!=this.feature&&JSON.stringify(r)!==JSON.stringify(this.feature))&&(n=!0),this.feature=r,t.resolve({feature:r,changed:n,request:t}),delete this.requests[e.id]}else _("error","FeatureSelection.finishRead(): could not find message",e)}static makeEntry(e){this.map_entry++;var t=255&this.map_entry,r=this.map_entry>>8&255,n=this.map_entry>>16&255,i=this.map_prefix,s=t/255,o=r/255,a=n/255,l=i/255,u=t+(r<<8)+(n<<16)+(i<<24)>>>0;return this.map[u]={color:[s,o,a,l]},this.map_size++,this.tiles[e.key]||(this.tiles[e.key]={entries:[],tile:{key:e.key,coords:e.coords,style_z:e.style_z,source:e.source,generation:e.generation}}),this.tiles[e.key].entries.push(u),this.map[u]}static makeColor(e,t,r){var n=this.makeEntry(t);return n.feature={id:e.id,properties:e.properties,source_name:r.source,source_layer:r.layer,layers:r.layers,tile:this.tiles[t.key].tile},n.color}static reset(e){Array.isArray(e)?e.forEach(e=>this.clearSource(e)):(this.tiles={},this.map={},this.map_size=0,this.map_entry=0)}static clearSource(e){for(let t in this.tiles)this.tiles[t].tile.source===e&&this.clearTile(t)}static clearTile(e){this.tiles[e]&&(this.tiles[e].entries.forEach(e=>delete this.map[e]),this.map_size-=this.tiles[e].entries.length,delete this.tiles[e])}static getMapSize(){return this.map_size}static setPrefix(e){this.map_prefix=e}}var de;he.map={},he.tiles={},he.map_size=0,he.map_entry=0,he.map_prefix=0,he.defaultColor=[0,0,0,1];var fe=de={};de.BYTE=5120,de.UNSIGNED_BYTE=5121,de.SHORT=5122,de.UNSIGNED_SHORT=5123,de.INT=5124,de.UNSIGNED_INT=5125,de.FLOAT=5126;class pe{constructor(e,t,r,n,i){i=i||{},this.gl=e,this.vertex_data=t,this.element_data=r,this.vertex_layout=n,this.vertex_buffer=this.gl.createBuffer(),this.buffer_size=this.vertex_data.byteLength,this.draw_mode=i.draw_mode||this.gl.TRIANGLES,this.data_usage=i.data_usage||this.gl.STATIC_DRAW,this.vertices_per_geometry=3,this.uniforms=i.uniforms,this.textures=i.textures,this.retain=i.retain||!1,this.created_at=+new Date,this.fade_in_time=i.fade_in_time||0,this.vertex_count=this.vertex_data.byteLength/this.vertex_layout.stride,this.element_count=0,this.vaos={},this.toggle_element_array=!1,this.element_data?(this.toggle_element_array=!0,this.element_count=this.element_data.length,this.geometry_count=this.element_count/this.vertices_per_geometry,this.element_type=this.element_data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT,this.element_buffer=this.gl.createBuffer(),this.buffer_size+=this.element_data.byteLength,this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.element_buffer),this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER,this.element_data,this.data_usage)):this.geometry_count=this.vertex_count/this.vertices_per_geometry,this.upload(),this.retain||(delete this.vertex_data,delete this.element_data),this.valid=!0}render(e={}){if(!this.valid)return!1;var t=e.program||j.current;t.use(),this.uniforms&&(t.saveUniforms(this.uniforms),t.setUniforms(this.uniforms,!1));let r=(+new Date-this.created_at)/1e3;return t.uniform("1f","u_visible_time",r),this.bind(t),this.toggle_element_array?this.gl.drawElements(this.draw_mode,this.element_count,this.element_type,0):this.gl.drawArrays(this.draw_mode,0,this.vertex_count),B.bind(this.gl,null),this.uniforms&&t.restoreUniforms(this.uniforms),r<this.fade_in_time}bind(e){let t=this.vaos[e.id];t?B.bind(this.gl,t):this.vaos[e.id]=B.create(this.gl,()=>{this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.toggle_element_array&&this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.element_buffer),this.vertex_layout.enableDynamicAttributes(this.gl,e)}),this.vertex_layout.enableStaticAttributes(this.gl,e)}upload(){this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.vertex_data,this.data_usage)}destroy(){if(!this.valid)return!1;this.valid=!1;for(let e in this.vaos)B.destroy(this.gl,this.vaos[e]);return this.gl.deleteBuffer(this.vertex_buffer),this.vertex_buffer=null,this.element_buffer&&(this.gl.deleteBuffer(this.element_buffer),this.element_buffer=null),delete this.vertex_data,delete this.element_data,this.textures&&this.textures.forEach(e=>k.release(e)),!0}}const me=["emission","ambient","diffuse","specular"];class _e{constructor(e){e=e||{},me.forEach(t=>{const r=e[t];null!=r&&(r.texture?this[t]={texture:r.texture,mapping:r.mapping||"spheremap",scale:O.expandVec3(null!=r.scale?r.scale:1),amount:O.expandVec4(null!=r.amount?r.amount:1)}:"number"==typeof r||Array.isArray(r)?this[t]={amount:O.expandVec4(r)}:this[t]="string"==typeof r?{amount:J.parseColor(r)}:r)}),this.specular&&(this.specular.shininess=e.shininess?parseFloat(e.shininess):.2),null!=e.normal&&(this.normal={texture:e.normal.texture,mapping:e.normal.mapping||"triplanar",scale:O.expandVec3(null!=e.normal.scale?e.normal.scale:1),amount:null!=e.normal.amount?e.normal.amount:1})}static isValid(e){return null!=e&&(null!=e.emission||null!=e.ambient||null!=e.diffuse||null!=e.specular)}inject(e){me.forEach(t=>{let r=`TANGRAM_MATERIAL_${t.toUpperCase()}`,n=r+"_TEXTURE";e.defines[r]=null!=this[t],this[t]&&this[t].texture&&(e.defines[n]=!0,e.defines[n+"_"+this[t].mapping.toUpperCase()]=!0,e.defines[`TANGRAM_MATERIAL_TEXTURE_${this[t].mapping.toUpperCase()}`]=!0,e.texcoords=e.texcoords||"uv"===this[t].mapping)}),this.normal&&this.normal.texture&&(e.defines.TANGRAM_MATERIAL_NORMAL_TEXTURE=!0,e.defines["TANGRAM_MATERIAL_NORMAL_TEXTURE_"+this.normal.mapping.toUpperCase()]=!0,e.defines[`TANGRAM_MATERIAL_TEXTURE_${this.normal.mapping.toUpperCase()}`]=!0,e.texcoords=e.texcoords||"uv"===this.normal.mapping),e.replaceShaderBlock(_e.block,"/*\n\nDefines globals:\nmaterial\nlight_accumulator_*\n\n*/\n\n\n// MATERIALS\n//\nstruct Material {\n #ifdef TANGRAM_MATERIAL_EMISSION\n vec4 emission;\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\n vec3 emissionScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT\n vec4 ambient;\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\n vec3 ambientScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n vec4 diffuse;\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\n vec3 diffuseScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n vec4 specular;\n float shininess;\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\n vec3 specularScale;\n #endif\n #endif\n\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\n vec3 normalScale;\n float normalAmount;\n #endif\n};\n\n// Note: uniform is copied to a global instance to allow modification\nuniform Material u_material;\nMaterial material;\n\n#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\nuniform sampler2D u_material_emission_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\nuniform sampler2D u_material_ambient_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\nuniform sampler2D u_material_diffuse_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\nuniform sampler2D u_material_specular_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\nuniform sampler2D u_material_normal_texture;\n#endif\n\n// Global light accumulators for each property\nvec4 light_accumulator_ambient = vec4(vec3(0.0), 1.);\nvec4 light_accumulator_diffuse = vec4(vec3(0.0), 1.);\n#ifdef TANGRAM_MATERIAL_SPECULAR\n vec4 light_accumulator_specular = vec4(vec3(0.0), 1.);\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_SPHEREMAP\nvec4 getSphereMap (in sampler2D _tex, in vec3 _eyeToPoint, in vec3 _normal, in vec2 _skew) {\n // Normalized vector from camera to surface\n vec3 eye = normalize(_eyeToPoint);\n\n // Adjust for camera skew\n eye.xy -= _skew;\n eye = normalize(eye);\n\n // Reflection of eye off of surface normal\n vec3 r = reflect(eye, _normal);\n\n // Map reflected vector onto the surface of a sphere\n r.z += 1.0;\n float m = 2. * length(r);\n\n // Adjust xy to account for spherical shape, and center in middle of texture\n vec2 uv = r.xy / m + .5;\n\n // Sample the environment map\n return texture2D(_tex, uv);\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_TRIPLANAR\nvec3 getTriPlanarBlend (in vec3 _normal) {\n vec3 blending = abs(_normal);\n blending = normalize(max(blending, 0.00001));\n float b = (blending.x + blending.y + blending.z);\n return blending / b;\n}\n\nvec4 getTriPlanar (in sampler2D _tex, in vec3 _pos, in vec3 _normal, in vec3 _scale) {\n vec3 blending = getTriPlanarBlend(_normal);\n vec4 xaxis = texture2D(_tex, fract(_pos.yz * _scale.x));\n vec4 yaxis = texture2D(_tex, fract(_pos.xz * _scale.y));\n vec4 zaxis = texture2D(_tex, fract(_pos.xy * _scale.z));\n return xaxis * blending.x + yaxis * blending.y + zaxis * blending.z;\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_PLANAR\nvec4 getPlanar (in sampler2D _tex, in vec3 _pos, in vec2 _scale) {\n return texture2D( _tex, fract(_pos.xy * _scale.x) );\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\nvoid calculateNormal (inout vec3 _normal) {\n // Get NORMALMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_UV\n _normal += texture2D(u_material_normal_texture, fract(v_texcoord*material.normalScale.xy)).rgb*2.0-1.0;\n #endif\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_PLANAR\n vec3 normalTex = getPlanar(u_material_normal_texture, v_world_position.xyz, material.normalScale.xy).rgb*2.0-1.0;\n _normal += normalTex;\n #endif\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_TRIPLANAR\n vec3 normalTex = getTriPlanar(u_material_normal_texture, v_world_position.xyz, _normal, material.normalScale).rgb*2.0-1.0;\n _normal += normalTex;\n #endif\n\n _normal = normalize(_normal);\n}\n#endif\n\nvoid calculateMaterial (in vec3 _eyeToPoint, inout vec3 _normal) {\n // get EMISSION TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_UV\n material.emission *= texture2D(u_material_emission_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_PLANAR\n material.emission *= getPlanar(u_material_emission_texture, v_world_position.xyz, material.emissionScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_TRIPLANAR\n material.emission *= getTriPlanar(u_material_emission_texture, v_world_position.xyz, _normal, material.emissionScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_SPHEREMAP\n material.emission *= getSphereMap(u_material_emission_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get AMBIENT TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_UV\n material.ambient *= texture2D(u_material_ambient_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_PLANAR\n material.ambient *= getPlanar(u_material_ambient_texture, v_world_position.xyz, material.ambientScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_TRIPLANAR\n material.ambient *= getTriPlanar(u_material_ambient_texture, v_world_position.xyz, _normal, material.ambientScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_SPHEREMAP\n material.ambient *= getSphereMap(u_material_ambient_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get DIFFUSE TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_UV\n material.diffuse *= texture2D(u_material_diffuse_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_PLANAR\n material.diffuse *= getPlanar(u_material_diffuse_texture, v_world_position.xyz, material.diffuseScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_TRIPLANAR\n material.diffuse *= getTriPlanar(u_material_diffuse_texture, v_world_position.xyz, _normal, material.diffuseScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_SPHEREMAP\n material.diffuse *= getSphereMap(u_material_diffuse_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get SPECULAR TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_UV\n material.specular *= texture2D(u_material_specular_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_PLANAR\n material.specular *= getPlanar(u_material_specular_texture, v_world_position.xyz, material.specularScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_TRIPLANAR\n material.specular *= getTriPlanar(u_material_specular_texture, v_world_position.xyz, _normal, material.specularScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_SPHEREMAP\n material.specular *= getSphereMap(u_material_specular_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n}\n","Material"),e.addShaderBlock("setup","\nmaterial = u_material;\n","Material")}setupProgram(e){me.forEach(t=>{this[t]&&(this[t].texture?(e.setTextureUniform(`u_material_${t}_texture`,this[t].texture),e.uniform("3fv",`u_material.${t}Scale`,this[t].scale),e.uniform("4fv",`u_material.${t}`,this[t].amount)):this[t].amount&&e.uniform("4fv",`u_material.${t}`,this[t].amount))}),this.specular&&e.uniform("1f","u_material.shininess",this.specular.shininess),this.normal&&this.normal.texture&&(e.setTextureUniform("u_material_normal_texture",this.normal.texture),e.uniform("3fv","u_material.normalScale",this.normal.scale),e.uniform("1f","u_material.normalAmount",this.normal.amount))}}var ge;_e.block="material";var ye=ge={};ge.copy=function(e){for(var t=[],r=e.length,n=0;n<r;n++)t[n]=e[n];return t},ge.neg=function(e){for(var t=[],r=e.length,n=0;n<r;n++)t[n]=-e[n];return t},ge.add=function(e,t){for(var r=[],n=Math.min(e.length,t.length),i=0;i<n;i++)r[i]=e[i]+t[i];return r},ge.sub=function(e,t){for(var r=[],n=Math.min(e.length,t.length),i=0;i<n;i++)r[i]=e[i]-t[i];return r},ge.signed_area=function(e,t,r){return(t[0]-e[0])*(r[1]-e[1])-(r[0]-e[0])*(t[1]-e[1])},ge.mult=function(e,t){var r,n=[],i=e.length;if("number"==typeof t)for(r=0;r<i;r++)n[r]=e[r]*t;else for(i=Math.min(e.length,t.length),r=0;r<i;r++)n[r]=e[r]*t[r];return n},ge.div=function(e,t){var r,n=[];if("number"==typeof t)for(r=0;r<e.length;r++)n[r]=e[r]/t;else{var i=Math.min(e.length,t.length);for(r=0;r<i;r++)n[r]=e[r]/t[r]}return n},ge.perp=function(e,t){return[t[1]-e[1],e[0]-t[0]]},ge.rot=function(e,t){var r=Math.cos(t),n=Math.sin(t);return[e[0]*r-e[1]*n,e[0]*n+e[1]*r]},ge.angle=function([e,t]){return Math.atan2(t,e)},ge.angleBetween=function(e,t){var r=ge.dot(ge.normalize(ge.copy(e)),ge.normalize(ge.copy(t)));return r>1&&(r=1),Math.acos(r)},ge.isEqual=function(e,t){for(var r=e.length,n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0},ge.lengthSq=function(e){return 2===e.length?e[0]*e[0]+e[1]*e[1]:e.length>=3?e[0]*e[0]+e[1]*e[1]+e[2]*e[2]:0},ge.length=function(e){return Math.sqrt(ge.lengthSq(e))},ge.normalize=function(e){var t;if(2===e.length){if(1===(t=e[0]*e[0]+e[1]*e[1]))return e;0!==(t=Math.sqrt(t))?(e[0]/=t,e[1]/=t):(e[0]=0,e[1]=0)}else if(e.length>=3){if(1===(t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2]))return e;0!==(t=Math.sqrt(t))?(e[0]/=t,e[1]/=t,e[2]/=t):(e[0]=0,e[1]=0,e[2]=0)}return e},ge.cross=function(e,t){return 2===e.length?e[0]*t[1]-e[1]*t[0]:3===e.length?[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]:void 0},ge.dot=function(e,t){for(var r=0,n=Math.min(e.length,t.length),i=0;i<n;i++)r+=e[i]*t[i];return r};class ve{constructor(e,t){this.name=t.name,this.view=e,null==t.ambient||"number"==typeof t.ambient?this.ambient=O.expandVec3(t.ambient||0):this.ambient=J.parseColor(t.ambient).slice(0,3),null==t.diffuse||"number"==typeof t.diffuse?this.diffuse=O.expandVec3(null!=t.diffuse?t.diffuse:1):this.diffuse=J.parseColor(t.diffuse).slice(0,3),null==t.specular||"number"==typeof t.specular?this.specular=O.expandVec3(t.specular||0):this.specular=J.parseColor(t.specular).slice(0,3)}static create(e,t){if(ve.types[t.type])return new ve.types[t.type](e,t)}static setMode(e,t){!0===e&&(e="fragment"),e=ve.enabled&&(null!=e?e:"fragment"),t.defines.TANGRAM_LIGHTING_FRAGMENT="fragment"===e,t.defines.TANGRAM_LIGHTING_VERTEX="vertex"===e}static inject(e){if(j.removeBlock(ve.block),!ve.enabled)return;let t="";if(e&&Object.keys(e).length>0){let r={};for(let t in e)r[e[t].type]=!0;for(let e in r)ve.types[e].inject();for(let r in e)e[r].inject(),t+=`calculateLight(${r}, _eyeToPoint, _normal);\n`}let r=`\n vec4 calculateLighting(in vec3 _eyeToPoint, in vec3 _normal, in vec4 _color) {\n\n // Do initial material calculations over normal, emission, ambient, diffuse and specular values\n calculateMaterial(_eyeToPoint,_normal);\n\n // Un roll the loop of individual ligths to calculate\n ${t}\n\n // Final light intensity calculation\n vec4 color = vec4(vec3(0.), _color.a); // start with vertex color alpha\n\n #ifdef TANGRAM_MATERIAL_EMISSION\n color.rgb = material.emission.rgb;\n color.a *= material.emission.a;\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT\n color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.ambient.rgb;\n color.a *= material.ambient.a;\n #else\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.diffuse.rgb;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n color.rgb += light_accumulator_diffuse.rgb * _color.rgb * material.diffuse.rgb;\n color.a *= material.diffuse.a;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n color.rgb += light_accumulator_specular.rgb * material.specular.rgb;\n color.a *= material.specular.a;\n #endif\n\n // Clamp final color\n color = clamp(color, 0.0, 1.0);\n\n return color;\n }`;j.addBlock(ve.block,r)}inject(){let e=`\n uniform ${this.struct_name} u_${this.name};\n ${this.struct_name} ${this.name};\n `,t=`\n ${this.name} = u_${this.name};\n\n `;j.addBlock(ve.block,e),j.addBlock("setup",t)}update(){}setupProgram(e){e.uniform("3fv",`u_${this.name}.ambient`,this.ambient),e.uniform("3fv",`u_${this.name}.diffuse`,this.diffuse),e.uniform("3fv",`u_${this.name}.specular`,this.specular)}}ve.types={},ve.block="lighting",ve.enabled=!0,ve.types.ambient=class extends ve{constructor(e,t){super(e,t),this.type="ambient",this.struct_name="AmbientLight"}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nlight_accumulator_*\n\n*/\n\nstruct AmbientLight {\n vec3 ambient;\n};\n\nvoid calculateLight(in AmbientLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n light_accumulator_ambient.rgb += _light.ambient;\n}\n")}setupProgram(e){e.uniform("3fv",`u_${this.name}.ambient`,this.ambient)}},ve.types.directional=class extends ve{constructor(e,t){if(super(e,t),this.type="directional",this.struct_name="DirectionalLight",t.direction)this._direction=t.direction;else{let e=135,r=Math.sin(60*Math.PI/180);this._direction=[Math.cos(Math.PI*e/180)*r,Math.sin(Math.PI*e/180)*r,-.5],null==t.ambient&&(this.ambient=O.expandVec3(.5))}this.direction=this._direction.map(parseFloat)}get direction(){return this._direction}set direction(e){this._direction=ye.normalize(ye.copy(e))}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct DirectionalLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec3 direction;\n};\n\nvoid calculateLight(in DirectionalLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n light_accumulator_ambient.rgb += _light.ambient;\n\n float nDotVP = clamp(dot(_normal, -_light.direction), 0.0, 1.0);\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n float pf = 0.0;\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(_light.direction, _normal);\n float eyeDotR = max(dot(normalize(_eyeToPoint), reflectVector), 0.0);\n pf = pow(eyeDotR, material.shininess);\n }\n light_accumulator_specular.rgb += _light.specular * pf;\n #endif\n}\n")}setupProgram(e){super.setupProgram(e),e.uniform("3fv",`u_${this.name}.direction`,this.direction)}};class be extends ve{constructor(e,t){super(e,t),this.type="point",this.struct_name="PointLight",this.position=t.position||[0,0,"100px"],this.position_eye=[],this.origin=t.origin||"ground",this.attenuation=isNaN(parseFloat(t.attenuation))?0:parseFloat(t.attenuation),t.radius?Array.isArray(t.radius)&&2===t.radius.length?this.radius=t.radius:this.radius=[null,t.radius]:this.radius=null}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct PointLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec4 position;\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float attenuationExponent;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n float innerRadius;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float outerRadius;\n#endif\n};\n\nvoid calculateLight(in PointLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n float dist = length(_light.position.xyz - _eyeToPoint);\n\n // Compute vector from surface to light position\n vec3 VP = (_light.position.xyz - _eyeToPoint) / dist;\n\n // Normalize the vector from surface to light position\n float nDotVP = clamp(dot(VP, _normal), 0.0, 1.0);\n\n // Attenuation defaults\n float attenuation = 1.0;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float Rin = 1.0;\n float e = _light.attenuationExponent;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #endif\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-(pow(d,e));\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/(pow(d,e)), 0.0, 1.0);\n #endif\n #else\n float Rin = 0.0;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/d, 0.0, 1.0);\n #endif\n #else\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float d = clamp(dist/_light.outerRadius, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n attenuation = 1.0;\n #endif\n #endif\n #endif\n\n // Computer accumulators\n light_accumulator_ambient.rgb += _light.ambient * attenuation;\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP * attenuation;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n float pf = 0.0; // power factor for shiny speculars\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(-VP, _normal);\n float eyeDotR = max(0.0, dot(-normalize(_eyeToPoint), reflectVector));\n pf = pow(eyeDotR, material.shininess);\n }\n\n light_accumulator_specular.rgb += _light.specular * pf * attenuation;\n #endif\n}\n")}inject(){super.inject(),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT=0!==this.attenuation,j.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS=null!=this.radius&&null!=this.radius[0],j.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS=null!=this.radius}update(){this.updateEyePosition()}updateEyePosition(){if("world"===this.origin){const e=G.latLngToMeters([...this.position]);this.position_eye[0]=e[0]-this.view.camera.position_meters[0],this.position_eye[1]=e[1]-this.view.camera.position_meters[1],this.position_eye[2]=J.convertUnits(this.position[2],{zoom:this.view.zoom,meters_per_pixel:G.metersPerPixel(this.view.zoom)}),this.position_eye[2]=this.position_eye[2]-this.view.camera.position_meters[2]}else"ground"!==this.origin&&"camera"!==this.origin||(this.position_eye=J.convertUnits(this.position,{zoom:this.view.zoom,meters_per_pixel:G.metersPerPixel(this.view.zoom)}),"ground"===this.origin&&(this.position_eye[2]=this.position_eye[2]-this.view.camera.position_meters[2]));this.position_eye[3]=1}setupProgram(e){super.setupProgram(e),e.uniform("4fv",`u_${this.name}.position`,this.position_eye),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT&&e.uniform("1f",`u_${this.name}.attenuationExponent`,this.attenuation),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS&&e.uniform("1f",`u_${this.name}.innerRadius`,J.convertUnits(this.radius[0],{zoom:this.view.zoom,meters_per_pixel:G.metersPerPixel(this.view.zoom)})),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS&&e.uniform("1f",`u_${this.name}.outerRadius`,J.convertUnits(this.radius[1],{zoom:this.view.zoom,meters_per_pixel:G.metersPerPixel(this.view.zoom)}))}}ve.types.point=be,ve.types.spotlight=class extends be{constructor(e,t){super(e,t),this.type="spotlight",this.struct_name="SpotLight",this.direction=this._direction=(t.direction||[0,0,-1]).map(parseFloat),this.exponent=t.exponent?parseFloat(t.exponent):.2,this.angle=t.angle?parseFloat(t.angle):20}get direction(){return this._direction}set direction(e){this._direction=ye.normalize(ye.copy(e))}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct SpotLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec4 position;\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float attenuationExponent;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n float innerRadius;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float outerRadius;\n#endif\n\n vec3 direction;\n float spotCosCutoff;\n float spotExponent;\n};\n\nvoid calculateLight(in SpotLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n float dist = length(_light.position.xyz - _eyeToPoint);\n\n // Compute vector from surface to light position\n vec3 VP = (_light.position.xyz - _eyeToPoint) / dist;\n\n // normal . light direction\n float nDotVP = clamp(dot(_normal, VP), 0.0, 1.0);\n\n // Attenuation defaults\n float attenuation = 1.0;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float Rin = 1.0;\n float e = _light.attenuationExponent;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #endif\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-(pow(d,e));\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/(pow(d,e)), 0.0, 1.0);\n #endif\n #else\n float Rin = 0.0;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/d, 0.0, 1.0);\n #endif\n #else\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float d = clamp(dist/_light.outerRadius, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n attenuation = 1.0;\n #endif\n #endif\n #endif\n\n // spotlight attenuation factor\n float spotAttenuation = 0.0;\n\n // See if point on surface is inside cone of illumination\n float spotDot = clamp(dot(-VP, _light.direction), 0.0, 1.0);\n\n if (spotDot >= _light.spotCosCutoff) {\n spotAttenuation = pow(spotDot, _light.spotExponent);\n }\n\n light_accumulator_ambient.rgb += _light.ambient * attenuation * spotAttenuation;\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP * attenuation * spotAttenuation;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n // Power factor for shiny speculars\n float pf = 0.0;\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(-VP, _normal);\n float eyeDotR = max(dot(-normalize(_eyeToPoint), reflectVector), 0.0);\n pf = pow(eyeDotR, material.shininess);\n }\n light_accumulator_specular.rgb += _light.specular * pf * attenuation * spotAttenuation;\n #endif\n}\n")}setupProgram(e){super.setupProgram(e),e.uniform("3fv",`u_${this.name}.direction`,this.direction),e.uniform("1f",`u_${this.name}.spotCosCutoff`,Math.cos(3.14159*this.angle/180)),e.uniform("1f",`u_${this.name}.spotExponent`,this.exponent)}};class xe extends Error{constructor(e){super(),this.name="MethodNotImplemented",this.message="Method "+e+" must be implemented in subclass"}}class we{constructor(e,t){this.validate(e),this.config=e,this.sources=t,this.id=e.id,this.name=e.name,this.pad_scale=e.pad_scale||1e-5,this.default_winding=null,this.rasters=[],Array.isArray(e.rasters)&&e.rasters.forEach(e=>{-1===this.rasters.indexOf(e)&&this.rasters.push(e)}),this.preprocess=e.preprocess,"function"==typeof this.preprocess&&this.preprocess.bind(this),this.transform=e.transform,"function"==typeof this.transform&&this.transform.bind(this),this.extra_data=e.extra_data,this.scripts=e.scripts,this.setZooms(e),this.zoom_offset=null!=e.zoom_offset?e.zoom_offset:0,this.zoom_offset<0&&(_({level:"warn",once:!0},`Data source '${this.name}' zoom_offset must not be negative – setting to 0.`),this.zoom_offset=0),this.setTileSize(e.tile_size),this.min_display_zoom=Math.max(e.min_display_zoom||0,this.zooms[0]),this.max_display_zoom=null!=e.max_display_zoom?e.max_display_zoom:null}static register(e,t){e&&t&&(we.types[e]=t)}static create(e,t){if("function"==typeof we.types[e.type]){const r=we.types[e.type](e);if(r)return new r(e,t)}}static tileLayoutChanged(e,t){if(!e||!t)return!0;const r=["max_zoom","zooms","min_display_zoom","max_display_zoom","bounds","tile_size","zoom_offset"],n=S(e.config,r),i=S(t.config,r);return JSON.stringify(n)!==JSON.stringify(i)}static projectData(e){var t=+new Date;for(var r in e.layers)for(var n=e.layers[r].features.length,i=0;i<n;i++){var s=e.layers[r].features[i];G.transformGeometry(s.geometry,this.projectCoord)}void 0!==e.debug&&(e.debug.projection=+new Date-t)}static projectCoord(e){G.latLngToMeters(e)}static scaleData(e,{coords:{z:t},min:r}){let n=G.unitsPerMeter(t);for(var i in e.layers)for(var s=e.layers[i].features.length,o=0;o<s;o++){var a=e.layers[i].features[o];G.transformGeometry(a.geometry,e=>{e[0]=(e[0]-r.x)*n,e[1]=(e[1]-r.y)*n*-1})}}load(e){return e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=[...this.rasters],this._load(e).then(e=>{for(let t in e.source_data.layers){let r=e.source_data.layers[t];r&&r.features&&r.features.forEach(e=>{G.transformGeometry(e.geometry,e=>{e[1]=-e[1],this.pad_scale&&(e[0]=Math.round(e[0]*(1+this.pad_scale)-G.tile_scale*this.pad_scale/2),e[1]=Math.round(e[1]*(1+this.pad_scale)-G.tile_scale*this.pad_scale/2))}),this.updateDefaultWinding(e.geometry)})}return e.default_winding=this.default_winding||"CCW",e})}_load(){throw new xe("_load")}copyTileData(e,t){return _("trace",`Copy tile data from ${e.key} to ${t.key}`),t.source_data={layers:e.source_data.layers},t.rasters=[...e.rasters],t.pad_scale=e.pad_scale,t.default_winding=e.default_winding,t}setZooms({max_zoom:e,zooms:t}){if(this.max_zoom=null!=e?e:G.default_source_max_zoom,Array.isArray(t))this.zooms=t,this.max_zoom=this.zooms[this.zooms.length-1];else{this.zooms=[];for(let e=0;e<=this.max_zoom;e++)this.zooms[e]=e}}setTileSize(e){this.tile_size=e||256,("number"!=typeof this.tile_size||this.tile_size<256||!g.isPowerOf2(this.tile_size))&&(_({level:"warn",once:!0},`Data source '${this.name}': 'tile_size' parameter must be a number that is a power of 2 greater than or equal to 256, but was '${e}'`),this.tile_size=256),this.zoom_bias=Math.log2(this.tile_size)-8+this.zoom_offset}updateDefaultWinding(e){return null==this.default_winding&&("Polygon"===e.type?this.default_winding=G.ringWinding(e.coordinates[0]):"MultiPolygon"===e.type&&(this.default_winding=G.ringWinding(e.coordinates[0][0]))),this.default_winding}includesTile(e,t){if(e.z<this.min_display_zoom||null!=this.max_display_zoom&&t>this.max_display_zoom)return!1;for(let t=0;t<this.rasters.length;t++){const r=this.rasters[t];if(this.sources[r]&&this.sources[r]!==this&&!this.sources[r].includesTile(e,e.z))return!1}return!0}validate(){}}we.types={};let Ae=0;class Ee extends we{constructor(e,t){super(e,t),this.response_type="";let[r,n]=function(e,t){if(!t||0===Object.keys(t).length)return[e,[]];var r=e.indexOf("?"),n=e.indexOf("#"),i="";n>-1&&(i=e.slice(n),e=e.slice(0,n)),-1===r&&(r=e.length,e+="?"),r++;var s="",o=[];for(var a in t)""===A(a,e)?s+=`${a}=${t[a]}&`:o.push([a,t[a]]);return[e=e.slice(0,r)+s+e.slice(r)+i,o]}(e.url,e.url_params);this.url=r,n.forEach(([t,r])=>{_({level:"warn",once:!0},`Data source '${this.name}': parameter '${t}' already present in URL '${e.url}', skipping value '${t}=${r}' specified in 'url_params'`)}),e.request_headers&&"object"==typeof e.request_headers&&(this.request_headers=e.request_headers)}_load(e){let t=this.formatURL(this.url,e),r=e.source_data;return r.url=t,e.debug=e.debug||{},e.debug.network=+new Date,new Promise(n=>{let i=Ae+++"-"+t,s=g.io(t,6e4,this.response_type,"GET",this.request_headers,i);r.request_id=i,r.error=null,s.then(({body:t})=>{e.debug.response_size=t&&(t.length||t.byteLength),e.debug.network=+new Date-e.debug.network,e.debug.parsing=+new Date,null!=t&&"function"==typeof this.preprocess&&(t=this.preprocess(t)),(t=t instanceof Promise?t:Promise.resolve(t)).then(t=>{null!=t?this.parseSourceData(e,r,t):r.layers={},e.debug.parsing=+new Date-e.debug.parsing,n(e)})}).catch(t=>{r.error=t.stack,n(e)})})}validate(e){if("string"!=typeof e.url)throw Error("Network data source must provide a string `url` property")}formatURL(){throw new xe("formatURL")}parseSourceData(){throw new xe("parseSourceData")}}class Te extends Ee{constructor(e,t){super(e,t),this.tiled=!0,this.bounds=this.parseBounds(e),this.builds_geometry_tiles=!1,this.tms=!0===e.tms,this.url&&this.url.search("{s}")>-1&&(Array.isArray(e.url_subdomains)&&e.url_subdomains.length>0?(this.url_subdomains=e.url_subdomains,this.next_url_subdomain=0):_({level:"warn",once:!0},`Data source '${this.name}': source URL includes '{s}' subdomain marker ('${this.url}'), but no subdomains were specified in 'url_subdomains' parameter`)),this.url&&this.url.search("{r}")>-1&&(Array.isArray(e.url_density_scales)&&e.url_density_scales.length>0?this.url_density_scales=e.url_density_scales:this.url_density_scales=[1,2])}parseBounds(e){if(Array.isArray(e.bounds)&&4===e.bounds.length){const[t,r,n,i]=e.bounds;return{latlng:[...e.bounds],meters:{min:G.latLngToMeters([t,i]),max:G.latLngToMeters([n,r])},tiles:{min:{},max:{}}}}}checkBounds(e,t){if(t){e=G.wrapTile(e);let r=t.tiles.min[e.z];r||(r=t.tiles.min[e.z]=G.tileForMeters(t.meters.min,e.z));let n=t.tiles.max[e.z];if(n||(n=t.tiles.max[e.z]=G.tileForMeters(t.meters.max,e.z)),e.y<r.y||e.y>n.y)return!1;if(r.x<=n.x){if(e.x<r.x||e.x>n.x)return!1}else if(e.x>n.x&&e.x<r.x)return!1}return!0}includesTile(e,t){return!!super.includesTile(e,t)&&!!this.checkBounds(e,this.bounds)}formatURL(e,t){let r=G.wrapTile(t.coords,{x:!0});this.tms&&(r.y=Math.pow(2,r.z)-1-r.y);let n=e.replace("{x}",r.x).replace("{y}",r.y).replace("{z}",r.z).replace("{r}",this.getDensityModifier()).replace("{q}",this.toQuadKey(r));return null!=this.url_subdomains&&(n=n.replace("{s}",this.url_subdomains[this.next_url_subdomain]),this.next_url_subdomain=(this.next_url_subdomain+1)%this.url_subdomains.length),n}getDensityModifier(){if(this.url_density_scales){const e=g.device_pixel_ratio;let t=this.url_density_scales.filter(t=>e>=t).reverse()[0];if(t=null!=t?t:this.url_density_scales[0],t>1)return`@${t}x`}return""}toQuadKey({x:e,y:t,z:r}){let n="";for(let i=r;i>0;i--){let r=0,s=1<<i-1;e&s&&r++,t&s&&(r+=2),n+=r.toString()}return n}static urlHasTilePattern(e){return e&&(e.search("{x}")>-1&&e.search("{y}")>-1&&e.search("{z}")>-1||e.search("{q}")>-1)}}const Se={coord(e){return{x:e.x,y:e.y,z:e.z,key:this.coordKey(e)}},coordKey:({x:e,y:t,z:r})=>e+"/"+t+"/"+r,key(e,t,r){if(!(e.y<0||e.y>=1<<e.z||e.z<0))return[t.name,e.x,e.y,e.z,r].join("/")},normalizedKey(e,t,r){return this.key(this.normalizedCoord(e,t),t,r)},normalizedCoord(e,t){return t.zoom_bias&&(e=this.coordAtZoom(e,Math.max(e.z-t.zoom_bias,t.zooms[0]))),this.coordForTileZooms(e,t.zooms)},coordAtZoom({x:e,y:t,z:r},n){if(r!==(n=Math.max(0,n))){let i=Math.pow(2,r-n);e=Math.floor(e/i),t=Math.floor(t/i),r=n}return this.coord({x:e,y:t,z:r})},coordForTileZooms({x:e,y:t,z:r},n){const i=this.findZoomInRange(r,n);return i!==r?this.coordAtZoom({x:e,y:t,z:r},i):this.coord({x:e,y:t,z:r})},findZoomInRange:(e,t)=>t.filter(t=>e>=t).reverse()[0]||t[0],isDescendant(e,t){if(t.z>e.z){let{x:r,y:n}=this.coordAtZoom(t,e.z);return e.x===r&&e.y===n}return!1},parent({coords:e,source:t,style_z:r}){if(r>0){r--;const n=Math.max(r-t.zoom_bias,t.zooms[0]),i=this.coordForTileZooms(this.coordAtZoom(e,n),t.zooms);return i.z>r?null:{key:this.key(i,t,r),coords:i,style_z:r,source:t}}},children({coords:e,source:t,style_z:r},n={}){r++;const i=this.coordForTileZooms(this.coordAtZoom(e,r-t.zoom_bias),t.zooms);if(i.z===e.z)return[{key:this.key(i,t,r),coords:i,style_z:r,source:t}];{const s=this.key(i,t,r);if(n[t.id]=n[t.id]||{},null==n[t.id][s]){const o=Math.pow(2,i.z-e.z),a=e.x*o,l=e.y*o;let u=[];for(let e=a;e<a+o;e++)for(let n=l;n<l+o;n++){let s=this.coord({x:e,y:n,z:i.z});u.push({key:this.key(s,t,r),coords:s,style_z:r,source:t})}n[t.id][s]=u}return n[t.id][s]}}};class ke extends Te{constructor(e,t){super(e,t),-1===this.rasters.indexOf(this.name)&&this.rasters.unshift(this.name),this.filtering=e.filtering,this.textures={}}async load(e){e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=[...this.rasters];let t=G.tile_scale;return e.source_data.layers={_default:{type:"FeatureCollection",features:[{geometry:{type:"Polygon",coordinates:[[[0,0],[t,0],[t,-t],[0,-t],[0,0]]]},properties:{}}]}},e.default_winding="CW",e}async tileTexture(e){let t=this.adjustRasterTileZoom(e),r=t.key;if(!this.textures[r]){let e=this.formatURL(this.url,{coords:t});this.textures[r]={name:e,url:e,filtering:this.filtering,coords:t}}return this.textures[r]}adjustRasterTileZoom(e){let t=e.coords;const r=this.sources[e.source];if(r!==this){let n=this.zoom_bias-r.zoom_bias;n>0?t=Se.normalizedCoord(e.coords,{zoom_bias:n,zooms:this.zooms}):(n<0&&_({level:"warn",once:!0},`Raster source '${this.name}' supports higher zoom detail than source '${r.name}' it's attached to. Downsampling this source ${-n} extra zoom levels to match.`),t=Se.coordForTileZooms(t,this.zooms))}return t}}class Oe extends ke{constructor(e,t){super(e,t),this.load_image={},this.alpha=null!=e.alpha?Math.max(Math.min(e.alpha,1),0):null,this.mask_alpha=!0,this.preserve_tiles_within_zoom=0,this.max_display_density=e.max_display_density,Array.isArray(e.composite)?this.images=e.composite.map(e=>({url:e.url,bounds:this.parseBounds(e),alpha:null!=e.alpha?Math.max(Math.min(e.alpha,1),0):null})):this.images=[{url:this.url,bounds:this.bounds,alpha:this.alpha}]}async tileTexture(e,{blend:t,generation:r}){let n=this.adjustRasterTileZoom(e);const i="opaque"!==t,s=`raster-${this.name}-${n.key}-${i?"alpha":"opaque"}-${r}`;if(k.textures[s])return{name:s,coords:n,skip_create:!0};let o=g.device_pixel_ratio;this.max_display_density&&(o=Math.min(o,this.max_display_density)),o*=2;const a=document.createElement("canvas"),l=a.getContext("2d");a.width=this.tile_size*o,a.height=this.tile_size*o,l.imageSmoothingEnabled="nearest"!==this.filtering;const u=this.images.filter(t=>this.checkBounds(e.coords,t.bounds));return await Promise.all(u.map(t=>{const r=i?null!=t.alpha?t.alpha:this.alpha:1;return this.drawImage(t.url,t.bounds,r,e,o,l)})),{name:s,element:a,filtering:this.filtering,coords:n}}async drawImage(e,t,r,n,i,s){const o=N(e);this.load_image[o]=this.load_image[o]||this.loadImage(e);const a=await this.load_image[o],l=G.metersPerPixel(n.coords.z)/i/(this.tile_size/G.tile_size),u=(t.meters.min[0]-n.min.x)/l,c=-(t.meters.min[1]-n.min.y)/l,h=(t.meters.max[0]-t.meters.min[0])/l,d=-(t.meters.max[1]-t.meters.min[1])/l;s.globalAlpha=null!=r?r:1,s.drawImage(a,u,c,h,d)}loadImage(e){return new Promise(t=>{let r=new Image;r.onload=()=>t(r),r.onerror=r=>{_("warn",`Raster source '${this.name}': failed to load url: '${e}'`,r),t(null)},g.isSafari()&&"data:"===e.slice(0,5)||(r.crossOrigin="anonymous"),r.src=e})}includesTile(e,t){return!!we.prototype.includesTile.call(this,e,t)&&this.images.some(t=>this.checkBounds(e,t.bounds))}validate(e){let t="Raster data source must provide a string `url` parameter, or an array of `composite` raster ";t+="image objects that each have a `url` parameter";let r="Raster data source must provide a `bounds` parameter, or an array of `composite` raster ";if(r+="image objects that each have a `bounds` parameter",Array.isArray(e.composite)){if(e.composite.some(e=>"string"!=typeof e.url))throw Error(t);if(e.composite.some(e=>!(Array.isArray(e.bounds)&&4===e.bounds.length)))throw Error(r);if(null!=e.url||null!=e.bounds)throw Error("Raster data source must have *either* a single image specified as `url` and `bounds `parameters, or an array of `composite` raster image objects, each with `url` and `bounds`.")}else{if("string"!=typeof e.url)throw Error(t);if(!Array.isArray(e.bounds)||4!==e.bounds.length)throw Error(r)}}}function Re(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Ce(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Re(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Re(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}we.register("Raster",e=>ke.urlHasTilePattern(e.url)?ke:Oe);var Ne={init({generation:e,styles:t,sources:r={},introspection:n}={}){this.setGeneration(e),this.styles=t,this.sources=r,this.defines=Object.prototype.hasOwnProperty.call(this,"defines")&&this.defines||{},this.shaders=Object.prototype.hasOwnProperty.call(this,"shaders")&&this.shaders||{},this.introspection=n||!1,this.selection=this.selection||this.introspection||!1,this.compile_setup=!1,this.program=null,this.selection_program=null,this.feature_style={},this.vertex_template=[],this.tile_data={},this.stencil_proxy_tiles=!0,this.variants={},this.vertex_layouts={},this.defines.TANGRAM_WORLD_POSITION_WRAP=1e5,this.blend=this.blend||"opaque","opaque"!==this.blend?null==this.blend_order&&(this.blend_order=this.default_blend_orders[this.blend]):this.blend_order=this.default_blend_orders[this.blend],this.defines[`TANGRAM_BLEND_${this.blend.toUpperCase()}`]=!0,this.removeShaderBlock("setup"),this.material instanceof _e||(_e.isValid(this.material)||(this.material=J.defaults.material),this.material=new _e(this.material)),this.material.inject(this),ve.setMode(this.lighting,this),this.setupRasters(),this.setupCustomAttributes(),this.initialized=!0},destroy(){this.program&&(this.program.destroy(),this.program=null),this.selection_program&&(this.selection_program.destroy(),this.selection_program=null),a.removeTarget(this.main_thread_target),this.gl=null,this.initialized=!1},reset(){},baseStyle(){return this.base||this.name},setGeneration(e){this.generation=e,this.main_thread_target=["Style",this.name,this.generation].join("_"),t.is_main&&a.addTarget(this.main_thread_target,this)},startData(e){this.tile_data[e.id]=this.tile_data[e.id]||{meshes:{},uniforms:{},textures:[]}},async endData(e){var t=this.tile_data[e.id];if(this.tile_data[e.id]=null,t&&Object.keys(t.meshes).length>0){for(let e in t.meshes){let r=t.meshes[e];0!==r.vertex_data.vertex_count?(r.vertex_data.end(),r.vertex_elements=r.vertex_data.element_buffer,r.vertex_data=r.vertex_data.vertex_buffer):delete t.meshes[e]}return this.buildRasterTextures(e,t)}return null},hasDataForTile(e){return null!=this.tile_data[e.id]},getTileMesh(e,t){const r=this.tile_data[e.id].meshes;if(null==r[t.key]){const e=this.vertexLayoutForMeshVariant(t);r[t.key]={variant:t,vertex_data:e.createVertexData()}}return r[t.key]},vertexLayoutForMeshVariant(){},meshVariantTypeForDraw(){},addFeature(e,t,r){let n=r.tile;if(n.generation!==this.generation)return;this.tile_data[n.id]||this.startData(n);let i=this.parseFeature(e,t,r);i&&this.buildGeometry(e.geometry,i,r)>0&&(e.generation=this.generation)},buildGeometry(e,t,r){let n;if("Polygon"===e.type?n=this.buildPolygons([e.coordinates],t,r):"MultiPolygon"===e.type?n=this.buildPolygons(e.coordinates,t,r):"LineString"===e.type?n=this.buildLines([e.coordinates],t,r):"MultiLineString"===e.type?n=this.buildLines(e.coordinates,t,r):"Point"===e.type?n=this.buildPoints([e.coordinates],t,r):"MultiPoint"===e.type&&(n=this.buildPoints(e.coordinates,t,r)),n>0&&v.layer_stats){let e=r.tile;e.debug.layers=e.debug.layers||{list:{},tree:{}};let t=e.debug.layers.list,i=e.debug.layers.tree,s={};r.layers.forEach(e=>{Pe(t,e,1,n,{[this.name]:n},{[this.baseStyle()]:n});let r=i,o=s,a=e.split(":");for(let e=0;e<a.length;e++){let t=a[e];r[t]=r[t]||{features:0,geoms:0,styles:{},base:{}},null==o[t]&&(o[t]={},Pe(r,t,1,n,{[this.name]:n},{[this.baseStyle()]:n})),e<a.length-1&&(r[t].layers=r[t].layers||{}),r=r[t].layers,o=o[t]}})}return n},parseFeature(e,t,r){try{var n=this.feature_style;if(n.order=this.parseOrder(t.order,r),null==n.order&&"overlay"!==this.blend){let e=`Layer '${t.layers.join(", ")}', draw group '${t.group}': `;return e+="'order' parameter is required unless blend mode is 'overlay'",null!=t.order&&(e+="; 'order' was set to a dynamic value (e.g. string tied to feature property, ",e+="or JS function), but evaluated to null for one or more features"),void _({level:"warn",once:!0},e)}if(!(n=this._parseFeature(e,t,r)))return;if(this.shaders.attributes){n.attributes=n.attributes||{};for(const e in this.shaders.attributes)n.attributes[e]=J.evalCachedProperty(t.attributes&&t.attributes[e],r),"number"!=typeof n.attributes[e]&&(n.attributes[e]=0)}return this.selection?n.interactive=J.evalProperty(t.interactive,r):n.interactive=!1,!0===n.interactive?n.selection_color=he.makeColor(e,r.tile,r):n.selection_color=he.defaultColor,n}catch(t){_("error","Style.parseFeature: style parsing error",e,n,t.stack)}},_parseFeature(){return this.feature_style},preprocess(e){if(!e.preprocessed){if(this.draw)for(let t in this.draw){let r=this.draw[t];"object"!=typeof r||Array.isArray(r)?null==e[t]&&(e[t]=r):e[t]=V({},r,e[t])}if(this.selection?this.introspection&&(e.interactive=!0):e.interactive=!1,!(e=this._preprocess(e)))return;if(this.shaders.attributes){e.attributes=e.attributes||{};for(const t in this.shaders.attributes)e.attributes[t]=J.createPropertyCache(null!=e.attributes[t]?e.attributes[t]:0)}e.preprocessed=!0}return e},_preprocess:e=>e,parseOrder:(e,t)=>"number"!=typeof e?J.calculateOrder(e,t):e,scaleOrder:e=>2*e,parseColor(e,t){return e?J.evalCachedColorProperty(e,t):this.shaders.blocks.color||this.shaders.blocks.filter?J.defaults.color:void 0},buildPolygons:()=>0,buildLines:()=>0,buildPoints:()=>0,setGL(e){this.gl=e,this.max_texture_size=k.getMaxTextureSize(this.gl)},makeMesh(e,t,r={}){let n=this.vertexLayoutForMeshVariant(r.variant);return v.wireframe?(t=function(e){const t=new Uint16Array(2*e.length);for(let r=0;r<e.length;r+=3)t.set([e[r],e[r+1],e[r+1],e[r+2],e[r+2],e[r]],2*r);return t}(t),new pe(this.gl,e,t,n,Ce(Ce({},r),{},{draw_mode:this.gl.LINES}))):new pe(this.gl,e,t,n,r)},render:e=>e.render(),getProgram(e="program"){this.compileSetup();const t=this[e];if(t&&!t.error){if(!t.compiled){_("debug",`Compiling style '${this.name}', program key '${e}'`);try{t.compile()}catch(t){throw _("error",`Style: error compiling program for style '${this.name}' (program key '${e}')`,this,t.stack,t.type,t.shader_errors),t}}return t}},compileSetup(){if(!this.compile_setup){if(!this.gl)throw new Error(`style.compile(): skipping for ${this.name} because no GL context`);var e=this.buildDefineList();if(this.selection){var t=Object.assign({},e);t.TANGRAM_FEATURE_SELECTION=!0}var r=this.shaders&&this.shaders.blocks,n=this.shaders&&this.shaders.block_scopes,i=Object.assign({},this.shaders&&this.shaders.uniforms);for(let e in i)null==i[e]&&_({level:"warn",once:!0},`Style '${this.name}' has invalid uniform '${e}': uniform values must be non-null`);var s=this.shaders&&this.shaders.extensions;"string"==typeof s&&(s=[s]),this.program=new j(this.gl,this.vertex_shader_src,this.fragment_shader_src,{name:this.name,defines:e,uniforms:i,blocks:r,block_scopes:n,extensions:s}),this.selection?this.selection_program=new j(this.gl,this.vertex_shader_src,"// Fragment shader for feature selection passes\n// Renders in silhouette according to selection (picking) color, or black if none defined\n\n#ifdef TANGRAM_FEATURE_SELECTION\n varying vec4 v_selection_color;\n#endif\n\nvoid main (void) {\n #ifdef TANGRAM_FEATURE_SELECTION\n gl_FragColor = v_selection_color;\n #else\n gl_FragColor = vec4(0., 0., 0., 1.);\n #endif\n}\n",{name:this.name+" (selection)",defines:t,uniforms:i,blocks:r,block_scopes:n,extensions:s}):this.selection_program=null,this.compile_setup=!0}},addShaderBlock(e,t,r=null){this.shaders.blocks=this.shaders.blocks||{},this.shaders.blocks[e]=this.shaders.blocks[e]||[],this.shaders.blocks[e].push(t),this.shaders.block_scopes=this.shaders.block_scopes||{},this.shaders.block_scopes[e]=this.shaders.block_scopes[e]||[],this.shaders.block_scopes[e].push(r)},removeShaderBlock(e){this.shaders.blocks&&(this.shaders.blocks[e]=null),this.shaders.block_scopes&&(this.shaders.block_scopes[e]=null)},replaceShaderBlock(e,t,r=null){this.removeShaderBlock(e),this.addShaderBlock(e,t,r)},buildDefineList(){var e={};if(null!=this.defines)for(var t in this.defines)e[t]=this.defines[t];if(null!=this.shaders&&null!=this.shaders.defines)for(t in this.shaders.defines)e[t]=this.shaders.defines[t];return e},hasRasters(){return["color","normal","custom"].indexOf(this.raster)>-1},setupRasters(){if(!this.hasRasters())return;"color"===this.raster?this.defines.TANGRAM_RASTER_TEXTURE_COLOR=!0:"normal"===this.raster&&(this.defines.TANGRAM_RASTER_TEXTURE_NORMAL=!0);let e=Object.keys(this.sources).filter(e=>this.sources[e]instanceof ke).length;if(this.defines.TANGRAM_NUM_RASTER_SOURCES=`${e}`,e>0){const t=Object.keys(this.sources).filter(e=>this.sources[e].mask_alpha).length;this.defines.TANGRAM_HAS_MASKED_RASTERS=t>0,this.defines.TANGRAM_ALL_MASKED_RASTERS=t===e,this.defines.TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING=!0,this.replaceShaderBlock("raster","// Uniforms defining raster textures and macros for accessing them\n\n#ifdef TANGRAM_FRAGMENT_SHADER\nuniform sampler2D u_rasters[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture samplers\nuniform vec2 u_raster_sizes[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture sizes (width/height in pixels)\nuniform vec3 u_raster_offsets[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture UV starting offset for tile\n\n// Raster sources can optionally mask by the alpha channel (render with only full or no alpha, based on a threshold),\n// which is used for handling transparency outside the raster image when rendering with opaque blending\n#if defined(TANGRAM_HAS_MASKED_RASTERS) && !defined(TANGRAM_ALL_MASKED_RASTERS) // only add uniform if we need it\nuniform bool u_raster_mask_alpha;\n#endif\n\n// Note: the raster accessors below are #defines rather than functions to\n// avoid issues with constant integer expressions for array indices\n\n// Adjusts UVs in model space to account for raster tile texture overzooming\n// (applies scale and offset adjustments)\n#define adjustRasterUV(raster_index, uv) \\\n ((uv) * u_raster_offsets[raster_index].z + u_raster_offsets[raster_index].xy)\n\n// Returns the UVs of the current model position for a raster sampler\n#define currentRasterUV(raster_index) \\\n (adjustRasterUV(raster_index, v_modelpos_base_zoom.xy))\n\n// Returns pixel location in raster tile texture at current model position\n#define currentRasterPixel(raster_index) \\\n (currentRasterUV(raster_index) * rasterPixelSize(raster_index))\n\n// Samples a raster tile texture for the current model position\n#define sampleRaster(raster_index) \\\n (texture2D(u_rasters[raster_index], currentRasterUV(raster_index)))\n\n// Samples a raster tile texture for a given pixel\n#define sampleRasterAtPixel(raster_index, pixel) \\\n (texture2D(u_rasters[raster_index], (pixel) / rasterPixelSize(raster_index)))\n\n// Returns size of raster sampler in pixels\n#define rasterPixelSize(raster_index) \\\n (u_raster_sizes[raster_index])\n\n#endif\n","Raster")}},async buildRasterTextures(e,t){if(!this.hasRasters())return t;if(0===e.rasters.length)return t;let r;try{r=await a.postMessage(`${this.main_thread_target}.loadTextures`,{coords:e.coords,source:e.source,rasters:e.rasters,min:e.min,max:e.max})}catch(e){return t}if(!r||r.length<1)return t;if(r.some(e=>!e.loaded))return null;t.uniforms.u_raster_mask_alpha=!0===this.sources[e.rasters[0]].mask_alpha;const n=t.uniforms.u_rasters=[],i=t.uniforms.u_raster_sizes=[],s=t.uniforms.u_raster_offsets=[];return r.forEach(r=>{const o=r.index;if(n[o]=r.name,t.textures.push(r.name),i[o]=[r.width,r.height],e.coords.z>r.coords.z){let t=e.coords.z-r.coords.z,n=Math.pow(2,t);s[o]=[(e.coords.x%n+n)%n/n,(n-1-e.coords.y%n)/n,1/n]}else s[o]=[0,0,1]}),t},async loadTextures(e){let t={},r={},n=[];e.rasters.map(e=>this.sources[e]).filter(e=>e).forEach((i,s)=>{i instanceof ke&&n.push(i.tileTexture(e,this).then(e=>{t[e.name]=e,r[e.name]=s}))}),await Promise.all(n),await k.createFromObject(this.gl,t);let i=await Promise.all(Object.keys(t).map(e=>k.textures[e]&&k.textures[e].load()).filter(e=>e));return i.forEach(e=>e.retain()),i.map(e=>({name:e.name,width:e.width,height:e.height,loaded:e.loaded,index:r[e.name],coords:t[e.name].coords}))},setupCustomAttributes(){if(this.shaders.attributes)for(const[e,t]of Object.entries(this.shaders.attributes))"float"===t.type&&(!1!==t.varying?(this.addShaderBlock("attributes",`\n #ifdef TANGRAM_VERTEX_SHADER\n attribute float a_${e};\n varying float v_${e};\n #define ${e} a_${e}\n #else\n varying float v_${e};\n #define ${e} v_${e}\n #endif\n `),this.addShaderBlock("setup",`#ifdef TANGRAM_VERTEX_SHADER\nv_${e} = a_${e};\n#endif`)):this.addShaderBlock("attributes",`\n #ifdef TANGRAM_VERTEX_SHADER\n attribute float a_${e};\n #define ${e} a_${e}\n #endif\n `))},addCustomAttributesToAttributeList(e){if(this.shaders.attributes)for(const[t,r]of Object.entries(this.shaders.attributes))"float"===r.type&&e.push({name:`a_${t}`,size:1,type:fe.FLOAT,normalized:!1});return e},addCustomAttributesToVertexTemplate(e,t){if(this.shaders.attributes)for(let r in this.shaders.attributes)this.vertex_template[t++]=null!=e.attributes[r]?e.attributes[r]:0},setup(){this.setUniforms(),this.material.setupProgram(j.current)},setUniforms(){var e,t=j.current;t&&t.setUniforms(null===(e=this.shaders)||void 0===e?void 0:e.uniforms,!0)},render_states:{opaque:{depth_test:!0,depth_write:!0},translucent:{depth_test:!0,depth_write:!0},add:{depth_test:!0,depth_write:!1},multiply:{depth_test:!0,depth_write:!1},inlay:{depth_test:!0,depth_write:!1},overlay:{depth_test:!1,depth_write:!1}},default_blend_orders:{opaque:Number.MIN_SAFE_INTEGER,add:1,multiply:2,inlay:3,translucent:4,overlay:5},getBlendOrderForDraw(e){return"opaque"!==this.blend&&null!=e.blend_order?e.blend_order:this.blend_order}};function Pe(e,t,r,n,i,s){e[t]=e[t]||{features:0,geoms:0,styles:{},base:{}},e[t].features+=r,e[t].geoms+=n;for(let r in i)e[t].styles[r]=e[t].styles[r]||0,e[t].styles[r]+=i[r];for(let r in s)e[t].base[r]=e[t].base[r]||0,e[t].base[r]+=s[r]}let Me=Math.pow(2,16)-1,De=!1;class ze{constructor(){this.array=[],this.has_overflown=!1}push(e){this.has_overflown&&!De||e>Me&&(this.has_overflown=!0,!De)||this.array.push(e)}end(){if(this.array.length){let t=(e=this.array,new(this.has_overflown&&De?Uint32Array:Uint16Array)(e));return this.array=[],this.has_overflown=!1,t}return!1;var e}}ze.setElementIndexUint=function(e){De=e};let Ie={[fe.FLOAT]:Float32Array,[fe.BYTE]:Int8Array,[fe.UNSIGNED_BYTE]:Uint8Array,[fe.INT]:Int32Array,[fe.UNSIGNED_INT]:Uint32Array,[fe.SHORT]:Int16Array,[fe.UNSIGNED_SHORT]:Uint16Array};class Fe{constructor(e,{prealloc:t=500}={}){this.vertex_layout=e,this.vertex_elements=new ze,this.stride=this.vertex_layout.stride,Fe.array_pool.length>0?(this.vertex_buffer=Fe.array_pool.pop(),this.byte_length=this.vertex_buffer.byteLength,this.size=Math.floor(this.byte_length/this.stride),_("trace",`VertexData: reused buffer of bytes ${this.byte_length}, ${this.size} vertices`)):(this.size=t,this.byte_length=this.stride*this.size,this.vertex_buffer=new Uint8Array(this.byte_length)),this.offset=0,this.vertex_count=0,this.realloc_count=0,this.setBufferViews(),this.setAddVertexFunction()}setBufferViews(){this.views={},this.views[fe.UNSIGNED_BYTE]=this.vertex_buffer,this.vertex_layout.dynamic_attribs.forEach(e=>{if(null==this.views[e.type]){var t=Ie[e.type];this.views[e.type]=new t(this.vertex_buffer.buffer)}})}checkBufferSize(){if(this.offset+this.stride>this.byte_length){this.size=Math.floor(1.5*this.size),this.size-=this.size%4,this.byte_length=this.stride*this.size;var e=new Uint8Array(this.byte_length);e.set(this.vertex_buffer),Fe.array_pool.push(this.vertex_buffer),this.vertex_buffer=e,this.setBufferViews(),this.realloc_count++}}setAddVertexFunction(){this.vertexLayoutAddVertex=this.vertex_layout.getAddVertexFunction()}addVertex(e){this.checkBufferSize(),this.vertexLayoutAddVertex(e,this.views,this.offset),this.offset+=this.stride,this.vertex_count++}end(){return this.vertex_buffer=this.vertex_buffer.subarray(0,this.offset),this.element_buffer=this.vertex_elements.end(),_("trace",`VertexData: ${this.size} vertices total, realloc count ${this.realloc_count}`),this}}Fe.array_pool=[];class Le{constructor(e){this.attribs=e,this.dynamic_attribs=this.attribs.filter(e=>null==e.static),this.static_attribs=this.attribs.filter(e=>null!=e.static),this.components=[],this.index={},this.offset={},this.stride=0;let t=0,r=0;for(let e=0;e<this.attribs.length;e++){let n=this.attribs[e];if(null==n.static){n.offset=this.stride,n.byte_size=n.size;let e=0;switch(n.type){case fe.FLOAT:case fe.INT:case fe.UNSIGNED_INT:n.byte_size*=4,e=2;break;case fe.SHORT:case fe.UNSIGNED_SHORT:n.byte_size*=2,e=1}3&n.byte_size&&(n.byte_size+=4-(3&n.byte_size)),this.stride+=n.byte_size;let i=n.offset>>e;for(let t=0;t<n.size;t++)this.components.push({type:n.type,shift:e,offset:i++,index:r++});this.index[n.name]=t,t+=n.size,this.offset[n.name]=n.offset}else n.static=Array.isArray(n.static)?n.static:[n.static],n.method=`vertexAttrib${n.static.length}fv`}}enableDynamicAttributes(e,t){for(const t in Le.enabled_attribs)e.disableVertexAttribArray(t);Le.enabled_attribs={},this.dynamic_attribs.forEach(r=>{const n=t.attribute(r.name).location;-1!==n&&(e.enableVertexAttribArray(n),e.vertexAttribPointer(n,r.size,r.type,r.normalized,this.stride,r.offset),Le.enabled_attribs[n]=t)})}enableStaticAttributes(e,t){this.static_attribs.forEach(r=>{const n=t.attribute(r.name).location;-1!==n&&e[r.method]instanceof Function&&(e.enableVertexAttribArray(n),e[r.method](n,r.static),e.disableVertexAttribArray(n))})}createVertexData(){return new Fe(this)}getAddVertexFunction(){return null==this.addVertex&&this.createAddVertexFunction(),this.addVertex}createAddVertexFunction(){let e=N(JSON.stringify(this.attribs));if(null==Le.add_vertex_funcs[e]){let t,r=["var t, o;"],n=[...this.components];n.sort((e,t)=>e.type!==t.type?e.type-t.type:e.index-t.index);for(let e=0;e<n.length;e++){let i=n[e];t!==i.type&&(r.push(`t = vs[${i.type}];`),r.push(`o = off${i.shift?" >> "+i.shift:""};`),t=i.type),r.push(`t[o + ${i.offset}] = v[${i.index}];`)}r=r.join("\n");let i=new Function("v","vs","off",r);Le.add_vertex_funcs[e]=i}this.addVertex=Le.add_vertex_funcs[e]}}Le.enabled_attribs={},Le.add_vertex_funcs={};const je=[{x:0,y:0},{x:G.tile_scale,y:-G.tile_scale}],Ue=[0,0,1,1];function Be(e,t,r){let n=je[0],i=je[1];return e[0]<=n.x+r&&t[0]<=n.x+r||e[0]>=i.x-r&&t[0]>=i.x-r||e[1]>=n.y-r&&t[1]>=n.y-r||e[1]<=i.y+r&&t[1]<=i.y+r}function Ve(e,t){t=t||0;let r=je[0],n=je[1];return e[0]<=r.x+t||e[0]>=n.x-t||e[1]>=r.y-t||e[1]<=n.y+t}var Ge,$e={exports:{}},qe=function(){if(Ge)return $e.exports;function e(e,i,s){s=s||2;var o,a,c,h,f,p,m,_=i&&i.length,g=_?i[0]*s:e.length,y=t(e,0,g,s,!0),v=[];if(!y||y.next===y.prev)return v;if(_&&(y=function(e,n,i,s){var o,a,c,h=[];for(o=0,a=n.length;o<a;o++)(c=t(e,n[o]*s,o<a-1?n[o+1]*s:e.length,s,!1))===c.next&&(c.steiner=!0),h.push(d(c));for(h.sort(l),o=0;o<h.length;o++)u(h[o],i),i=r(i,i.next);return i}(e,i,y,s)),e.length>80*s){o=c=e[0],a=h=e[1];for(var b=s;b<g;b+=s)(f=e[b])<o&&(o=f),(p=e[b+1])<a&&(a=p),f>c&&(c=f),p>h&&(h=p);m=0!==(m=Math.max(c-o,h-a))?1/m:0}return n(y,v,s,o,a,m),v}function t(e,t,r,n,i){var s,o;if(i===T(e,t,r,n)>0)for(s=t;s<r;s+=n)o=w(s,e[s],e[s+1],o);else for(s=r-n;s>=t;s-=n)o=w(s,e[s],e[s+1],o);return o&&_(o,o.next)&&(A(o),o=o.next),o}function r(e,t){if(!e)return e;t||(t=e);var r,n=e;do{if(r=!1,n.steiner||!_(n,n.next)&&0!==m(n.prev,n,n.next))n=n.next;else{if(A(n),(n=t=n.prev)===n.next)break;r=!0}}while(r||n!==t);return t}function n(e,t,l,u,c,d,f){if(e){!f&&d&&function(e,t,r,n){var i=e;do{null===i.z&&(i.z=h(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,r,n,i,s,o,a,l,u=1;do{for(r=e,e=null,s=null,o=0;r;){for(o++,n=r,a=0,t=0;t<u&&(a++,n=n.nextZ);t++);for(l=u;a>0||l>0&&n;)0!==a&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,a--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:e=i,i.prevZ=s,s=i;r=n}s.nextZ=null,u*=2}while(o>1)}(i)}(e,u,c,d);for(var p,m,_=e;e.prev!==e.next;)if(p=e.prev,m=e.next,d?s(e,u,c,d):i(e))t.push(p.i/l),t.push(e.i/l),t.push(m.i/l),A(e),e=m.next,_=m.next;else if((e=m)===_){f?1===f?n(e=o(r(e),t,l),t,l,u,c,d,2):2===f&&a(e,t,l,u,c,d):n(r(e),t,l,u,c,d,1);break}}}function i(e){var t=e.prev,r=e,n=e.next;if(m(t,r,n)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(f(t.x,t.y,r.x,r.y,n.x,n.y,i.x,i.y)&&m(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function s(e,t,r,n){var i=e.prev,s=e,o=e.next;if(m(i,s,o)>=0)return!1;for(var a=i.x<s.x?i.x<o.x?i.x:o.x:s.x<o.x?s.x:o.x,l=i.y<s.y?i.y<o.y?i.y:o.y:s.y<o.y?s.y:o.y,u=i.x>s.x?i.x>o.x?i.x:o.x:s.x>o.x?s.x:o.x,c=i.y>s.y?i.y>o.y?i.y:o.y:s.y>o.y?s.y:o.y,d=h(a,l,t,r,n),p=h(u,c,t,r,n),_=e.prevZ,g=e.nextZ;_&&_.z>=d&&g&&g.z<=p;){if(_!==e.prev&&_!==e.next&&f(i.x,i.y,s.x,s.y,o.x,o.y,_.x,_.y)&&m(_.prev,_,_.next)>=0)return!1;if(_=_.prevZ,g!==e.prev&&g!==e.next&&f(i.x,i.y,s.x,s.y,o.x,o.y,g.x,g.y)&&m(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;_&&_.z>=d;){if(_!==e.prev&&_!==e.next&&f(i.x,i.y,s.x,s.y,o.x,o.y,_.x,_.y)&&m(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;g&&g.z<=p;){if(g!==e.prev&&g!==e.next&&f(i.x,i.y,s.x,s.y,o.x,o.y,g.x,g.y)&&m(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function o(e,t,n){var i=e;do{var s=i.prev,o=i.next.next;!_(s,o)&&g(s,i,i.next,o)&&b(s,o)&&b(o,s)&&(t.push(s.i/n),t.push(i.i/n),t.push(o.i/n),A(i),A(i.next),i=e=o),i=i.next}while(i!==e);return r(i)}function a(e,t,i,s,o,a){var l=e;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&p(l,u)){var c=x(l,u);return l=r(l,l.next),c=r(c,c.next),n(l,t,i,s,o,a),void n(c,t,i,s,o,a)}u=u.next}l=l.next}while(l!==e)}function l(e,t){return e.x-t.x}function u(e,t){if(t=function(e,t){var r,n=t,i=e.x,s=e.y,o=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){var a=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>o){if(o=a,a===i){if(s===n.y)return n;if(s===n.next.y)return n.next}r=n.x<n.next.x?n:n.next}}n=n.next}while(n!==t);if(!r)return null;if(i===o)return r;var l,u=r,h=r.x,d=r.y,p=1/0;n=r;do{i>=n.x&&n.x>=h&&i!==n.x&&f(s<d?i:o,s,h,d,s<d?o:i,s,n.x,n.y)&&(l=Math.abs(s-n.y)/(i-n.x),b(n,e)&&(l<p||l===p&&(n.x>r.x||n.x===r.x&&c(r,n)))&&(r=n,p=l)),n=n.next}while(n!==u);return r}(e,t),t){var n=x(t,e);r(t,t.next),r(n,n.next)}}function c(e,t){return m(e.prev,e,t.prev)<0&&m(t.next,e,e.next)<0}function h(e,t,r,n,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function d(e){var t=e,r=e;do{(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next}while(t!==e);return r}function f(e,t,r,n,i,s,o,a){return(i-o)*(t-a)-(e-o)*(s-a)>=0&&(e-o)*(n-a)-(r-o)*(t-a)>=0&&(r-o)*(s-a)-(i-o)*(n-a)>=0}function p(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&g(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&(b(e,t)&&b(t,e)&&function(e,t){var r=e,n=!1,i=(e.x+t.x)/2,s=(e.y+t.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&i<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==e);return n}(e,t)&&(m(e.prev,e,t.prev)||m(e,t.prev,t))||_(e,t)&&m(e.prev,e,e.next)>0&&m(t.prev,t,t.next)>0)}function m(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function _(e,t){return e.x===t.x&&e.y===t.y}function g(e,t,r,n){var i=v(m(e,t,r)),s=v(m(e,t,n)),o=v(m(r,n,e)),a=v(m(r,n,t));return i!==s&&o!==a||!(0!==i||!y(e,r,t))||!(0!==s||!y(e,n,t))||!(0!==o||!y(r,e,n))||!(0!==a||!y(r,t,n))}function y(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function v(e){return e>0?1:e<0?-1:0}function b(e,t){return m(e.prev,e,e.next)<0?m(e,t,e.next)>=0&&m(e,e.prev,t)>=0:m(e,t,e.prev)<0||m(e,e.next,t)<0}function x(e,t){var r=new E(e.i,e.x,e.y),n=new E(t.i,t.x,t.y),i=e.next,s=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,s.next=n,n.prev=s,n}function w(e,t,r,n){var i=new E(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function A(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function E(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function T(e,t,r,n){for(var i=0,s=t,o=r-n;s<r;s+=n)i+=(e[o]-e[s])*(e[s+1]+e[o+1]),o=s;return i}return Ge=1,$e.exports=e,$e.exports.default=e,e.deviation=function(e,t,r,n){var i=t&&t.length,s=i?t[0]*r:e.length,o=Math.abs(T(e,0,s,r));if(i)for(var a=0,l=t.length;a<l;a++){var u=t[a]*r,c=a<l-1?t[a+1]*r:e.length;o-=Math.abs(T(e,u,c,r))}var h=0;for(a=0;a<n.length;a+=3){var d=n[a]*r,f=n[a+1]*r,p=n[a+2]*r;h+=Math.abs((e[d]-e[p])*(e[f+1]-e[d+1])-(e[d]-e[f])*(e[p+1]-e[d+1]))}return 0===o&&0===h?0:Math.abs((h-o)/o)},e.flatten=function(e){for(var t=e[0][0].length,r={vertices:[],holes:[],dimensions:t},n=0,i=0;i<e.length;i++){for(var s=0;s<e[i].length;s++)for(var o=0;o<t;o++)r.vertices.push(e[i][s][o]);i>0&&(n+=e[i-1].length,r.holes.push(n))}return r},$e.exports}(),We=P(qe);function He(e,t,r=0,n=e.length-1,i=Ke){for(;n>r;){if(n-r>600){const s=n-r+1,o=t-r+1,a=Math.log(s),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);He(e,t,Math.max(r,Math.floor(t-o*l/s+u)),Math.min(n,Math.floor(t+(s-o)*l/s+u)),i)}const s=e[t];let o=r,a=n;for(Ze(e,r,t),i(e[n],s)>0&&Ze(e,r,n);o<a;){for(Ze(e,o,a),o++,a--;i(e[o],s)<0;)o++;for(;i(e[a],s)>0;)a--}0===i(e[r],s)?Ze(e,r,a):(a++,Ze(e,a,n)),a<=t&&(r=a+1),t<=a&&(n=a-1)}}function Ze(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function Ke(e,t){return e<t?-1:e>t?1:0}const Xe=[0,0,1];function Ye(e,t,r,{texcoord_index:n,texcoord_scale:i,texcoord_normalize:s}){let o,a,l,u,c,h,d,f,p,m,_,g,y=t.vertex_elements,v=e.length,b=0;n&&(s=s||1,[o,a,l,u]=i||Ue);for(let i=0;i<v;i++){const v=500;let w=e[i];w.length>v&&(w=[...w],He(w,v,1,w.length-1,(e,t)=>t.area-e.area),w=w.slice(0,v));const A=(x=We.flatten(w),We(x.vertices,x.holes,x.dimensions)),E=A.length,T=t.vertex_count;if(E){n&&([c,h,d,f]=G.findBoundingBox(w),p=d-c,m=f-h,_=(l-o)/p,g=(u-a)/m);for(let e=0;e<w.length;e++){let i=w[e];for(let e=0;e<i.length;e++){let l=i[e];r[0]=l[0],r[1]=l[1],n&&(r[n+0]=((l[0]-c)*_+o)*s,r[n+1]=((l[1]-h)*g+a)*s),t.addVertex(r)}}for(let e=0;e<E;e++)y.push(T+A[e]);b+=E/3}}var x;return b}var Qe='uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_tile_proxy_order_offset;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\n\nuniform mat4 u_model;\nuniform mat4 u_modelView;\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nattribute vec4 a_position;\nattribute vec4 a_color;\n\n// Optional normal attribute, otherwise default to up\n#ifdef TANGRAM_NORMAL_ATTRIBUTE\n attribute vec3 a_normal;\n #define TANGRAM_NORMAL a_normal\n#else\n #define TANGRAM_NORMAL vec3(0., 0., 1.)\n#endif\n\n// Optional dynamic line extrusion\n#ifdef TANGRAM_EXTRUDE_LINES\n attribute vec2 a_extrude; // extrusion direction in xy plane\n attribute vec2 a_offset; // offset direction in xy plane\n\n // Polygon and line styles have slightly different VBO layouts, saving memory by optimizing vertex packing.\n // All lines have a width scaling factor, but only some have a height (position.z) or offset.\n // The vertex height is stored in different attributes to account for this.\n attribute vec2 a_z_and_offset_scale; // stores vertex height in x, and offset scaling factor in y\n #define TANGRAM_POSITION_Z a_z_and_offset_scale.x // vertex height is stored in separate line-specific attrib\n #define TANGRAM_OFFSET_SCALING a_z_and_offset_scale.y // zoom scaling factor for line offset\n #define TANGRAM_WIDTH_SCALING a_position.z // zoom scaling factor for line width (stored in position attrib)\n\n uniform float u_v_scale_adjust; // scales texture UVs for line dash patterns w/fractional pixel width\n#else\n #define TANGRAM_POSITION_Z a_position.z // vertex height\n#endif\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n// Optional texture UVs\n#if defined(TANGRAM_TEXTURE_COORDS) || defined(TANGRAM_EXTRUDE_LINES)\n attribute vec2 a_texcoord;\n varying vec2 v_texcoord;\n#endif\n\n// Optional model position varying for tile coordinate zoom\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(TANGRAM_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#define TANGRAM_UNPACK_SCALING(x) (x / 1024.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main() {\n // Initialize globals\n #pragma tangram: setup\n\n // Texture UVs\n #ifdef TANGRAM_TEXTURE_COORDS\n v_texcoord = a_texcoord;\n #ifdef TANGRAM_EXTRUDE_LINES\n v_texcoord.y *= u_v_scale_adjust;\n #endif\n #endif\n\n // Pass model position to fragment shader\n #ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n v_modelpos_base_zoom = modelPositionBaseZoom();\n #endif\n\n // Position\n vec4 position = vec4(a_position.xy, TANGRAM_POSITION_Z / TANGRAM_HEIGHT_SCALE, 1.); // convert height back to meters\n\n #ifdef TANGRAM_EXTRUDE_LINES\n vec2 _extrude = a_extrude.xy;\n vec2 _offset = a_offset.xy;\n\n // Adjust line width based on zoom level, to prevent proxied lines\n // from being either too small or too big.\n // "Flattens" the zoom between 1-2 to peg it to 1 (keeps lines from\n // prematurely shrinking), then interpolate and clamp to 4 (keeps lines\n // from becoming too small when far away).\n float _dz = clamp(u_map_position.z - u_tile_origin.z, 0., 4.);\n _dz += step(1., _dz) * (1. - _dz) + mix(0., 2., clamp((_dz - 2.) / 2., 0., 1.));\n\n // Interpolate line width between zooms\n float _mdz = (_dz - 0.5) * 2.; // zoom from mid-point\n _extrude -= _extrude * TANGRAM_UNPACK_SCALING(TANGRAM_WIDTH_SCALING) * _mdz;\n\n // Interpolate line offset between zooms\n // Scales from the larger value to the smaller one\n float _dwdz = TANGRAM_UNPACK_SCALING(TANGRAM_OFFSET_SCALING);\n float _sdwdz = sign(step(0., _dwdz) - 0.5); // sign indicates "direction" of scaling\n _offset -= _offset * abs(_dwdz) * ((1.-step(0., _sdwdz)) - (_dz * -_sdwdz)); // scale "up" or "down"\n\n // Scale line width and offset to be consistent in screen space\n float _ssz = exp2(-_dz - (u_tile_origin.z - u_tile_origin.w));\n _extrude *= _ssz;\n _offset *= _ssz;\n\n // Modify line width before extrusion\n #ifdef TANGRAM_BLOCK_WIDTH\n float width = 1.;\n #pragma tangram: width\n _extrude *= width;\n #endif\n\n position.xy += _extrude + _offset;\n #endif\n\n // World coordinates for 3d procedural textures\n v_world_position = wrapWorldPosition(u_model * position);\n\n // Adjust for tile and view position\n position = u_modelView * position;\n\n // Modify position before camera projection\n #pragma tangram: position\n\n // Setup varyings\n v_position = position;\n v_normal = normalize(u_normalMatrix * TANGRAM_NORMAL);\n v_color = a_color;\n\n #if defined(TANGRAM_LIGHTING_VERTEX)\n // Vertex lighting\n vec3 normal = v_normal;\n\n // Modify normal before lighting\n #pragma tangram: normal\n\n // Pass lighting intensity to fragment shader\n v_lighting = calculateLighting(position.xyz - u_eye, normal, vec4(1.));\n #endif\n\n // Camera\n cameraProjection(position);\n\n // +1 is to keep all layers including proxies > 0\n applyLayerOrder(a_position.w + u_tile_proxy_order_offset + 1., position);\n\n gl_Position = position;\n}\n',Je="uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n#ifdef TANGRAM_EXTRUDE_LINES\n uniform bool u_has_line_texture;\n uniform sampler2D u_texture;\n uniform float u_texture_ratio;\n uniform vec4 u_dash_background_color;\n uniform float u_has_dash;\n#endif\n\n#define TANGRAM_NORMAL v_normal\n\n#if defined(TANGRAM_TEXTURE_COORDS) || defined(TANGRAM_EXTRUDE_LINES)\n varying vec2 v_texcoord;\n#endif\n\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(TANGRAM_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n vec3 normal = TANGRAM_NORMAL;\n\n // Apply raster to vertex color\n #ifdef TANGRAM_RASTER_TEXTURE_COLOR\n vec4 _raster_color = sampleRaster(0);\n\n #if defined(TANGRAM_BLEND_OPAQUE) || defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n // Raster sources can optionally mask by the alpha channel, which will render with only full or no alpha.\n // This is used for handling transparency outside the raster image in some blend modes,\n // which either don't support alpha, or would cause transparent pixels to write to the depth buffer,\n // obscuring geometry underneath.\n #ifdef TANGRAM_HAS_MASKED_RASTERS // skip masking logic if no masked raster sources\n #ifndef TANGRAM_ALL_MASKED_RASTERS // skip source check for masking if *all* raster sources are masked\n if (u_raster_mask_alpha) {\n #else\n {\n #endif\n #if defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n if (_raster_color.a < TANGRAM_EPSILON) {\n discard;\n }\n #else // TANGRAM_BLEND_OPAQUE\n if (_raster_color.a < 1. - TANGRAM_EPSILON) {\n discard;\n }\n // only allow full alpha in opaque blend mode (avoids artifacts blending w/canvas tile background)\n _raster_color.a = 1.;\n #endif\n }\n #endif\n #endif\n\n color *= _raster_color; // multiplied to tint texture color\n #endif\n\n // Apply line texture\n #ifdef TANGRAM_EXTRUDE_LINES\n { // enclose in scope to avoid leakage of internal variables\n if (u_has_line_texture) {\n vec2 _line_st = vec2(v_texcoord.x, fract(v_texcoord.y / u_texture_ratio));\n vec4 _line_color = texture2D(u_texture, _line_st);\n\n // If the line has a dash pattern, the line texture indicates if the current fragment should be\n // the dash foreground or background color. If the line doesn't have a dash pattern,\n // the line texture color is used directly (but also tinted by the vertex color).\n color = mix(\n color * _line_color, // no dash: tint the line texture with the vertex color\n mix(u_dash_background_color, color, _line_color.a), // choose dash foreground or background color\n u_has_dash // 0 if no dash, 1 if has dash\n );\n\n // Use alpha discard test as a lower-quality substitute for blending\n #if defined(TANGRAM_BLEND_OPAQUE)\n if (color.a < TANGRAM_ALPHA_TEST) {\n discard;\n }\n #endif\n }\n }\n #endif\n\n // First, get normal from raster tile (if applicable)\n #ifdef TANGRAM_RASTER_TEXTURE_NORMAL\n normal = normalize(sampleRaster(0).rgb * 2. - 1.);\n #endif\n\n // Second, alter normal with normal map texture (if applicable)\n #if defined(TANGRAM_LIGHTING_FRAGMENT) && defined(TANGRAM_MATERIAL_NORMAL_TEXTURE)\n calculateNormal(normal);\n #endif\n\n // Normal modification applied here for fragment lighting or no lighting,\n // and in vertex shader for vertex lighting\n #if !defined(TANGRAM_LIGHTING_VERTEX)\n #pragma tangram: normal\n #endif\n\n // Color modification before lighting is applied\n #pragma tangram: color\n\n #if defined(TANGRAM_LIGHTING_FRAGMENT)\n // Calculate per-fragment lighting\n color = calculateLighting(v_position.xyz - u_eye, normal, color);\n #elif defined(TANGRAM_LIGHTING_VERTEX)\n // Apply lighting intensity interpolated from vertex shader\n color *= v_lighting;\n #endif\n\n // Post-processing effects (modify color after lighting)\n #pragma tangram: filter\n\n gl_FragColor = color;\n}\n";const et=Object.create(Ne);Object.assign(et,{name:"polygons",built_in:!0,vertex_shader_src:Qe,fragment_shader_src:Je,selection:!0,init(){Ne.init.apply(this,arguments),this.defines.TANGRAM_NORMAL_ATTRIBUTE=!0,this.defines.TANGRAM_TEXTURE_COORDS=this.texcoords},_parseFeature(e,t,r){var n=this.feature_style;return n.color=this.parseColor(t.color,r),n.color?(n.alpha=J.evalCachedProperty(t.alpha,r),n.variant=t.variant,n.z=J.evalCachedDistanceProperty(t.z,r)||J.defaults.z,n.z*=G.height_scale,n.extrude=J.evalProperty(t.extrude,r),n.extrude&&(!0===n.extrude?(n.height=e.properties.height||J.defaults.height,n.min_height=e.properties.min_height||J.defaults.min_height):"number"==typeof n.extrude?(n.height=n.extrude,n.min_height=0):Array.isArray(n.extrude)&&(n.min_height=n.extrude[0],n.height=n.extrude[1]),n.height*=G.height_scale,n.min_height*=G.height_scale),n.tile_edges=t.tile_edges,n):null},_preprocess(e){return e.color=J.createColorPropertyCache(e.color),e.alpha=J.createPropertyCache(e.alpha),e.z=J.createPropertyCache(e.z,J.parseUnits),this.computeVariant(e),e},computeVariant(e){const t=e.interactive?1:0,r=null!=e.extrude?1:0,n=this.texcoords?1:0,i=this.getBlendOrderForDraw(e),s=[t,r,n,i].join("/");e.variant=s,null==this.variants[s]&&(this.variants[s]={key:s,blend_order:i,mesh_order:0,selection:t,normal:r,texcoords:n})},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.key]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_normal",size:3,type:fe.BYTE,normalized:!0,static:e.normal?null:[0,0,1]},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0,static:e.texcoords?null:[0,0]}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.key]=new Le(t)}return this.vertex_layouts[e.key]},meshVariantTypeForDraw(e){return this.variants[e.variant]},makeVertexTemplate(e,t){let r=0;return this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=e.z||0,this.vertex_template[r++]=this.scaleOrder(e.order),t.variant.normal&&(this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=127),this.vertex_template[r++]=255*e.color[0],this.vertex_template[r++]=255*e.color[1],this.vertex_template[r++]=255*e.color[2],this.vertex_template[r++]=255*(null!=e.alpha?e.alpha:e.color[3]),t.variant.selection&&(this.vertex_template[r++]=255*e.selection_color[0],this.vertex_template[r++]=255*e.selection_color[1],this.vertex_template[r++]=255*e.selection_color[2],this.vertex_template[r++]=255*e.selection_color[3]),t.variant.texcoords&&(this.vertex_template[r++]=0,this.vertex_template[r++]=0),this.addCustomAttributesToVertexTemplate(e,r),this.vertex_template},buildPolygons(e,t,r){let n=this.getTileMesh(r.tile,this.meshVariantTypeForDraw(t)),i=n.vertex_data,s=i.vertex_layout,o=this.makeVertexTemplate(t,n),a={texcoord_index:s.index.a_texcoord,texcoord_normalize:65535,remove_tile_edges:!t.tile_edges,tile_edge_tolerance:G.tile_scale*r.tile.pad_scale*4,winding:r.winding};return t.extrude&&t.height?function(e,t,r,n,i,s,o,a,{remove_tile_edges:l,tile_edge_tolerance:u,texcoord_index:c,texcoord_scale:h,texcoord_normalize:d,winding:f}){var p=t+(n||0),m=t+r;s[2]=m;var _=Ye(e,i,s,{texcoord_index:c,texcoord_scale:h,texcoord_normalize:d}),g=i.vertex_elements,y=i.vertex_count;if(c){d=d||1;var[v,b,x,w]=h||Ue,A=[[v,w],[v,b],[x,b],[x,w]]}for(var E=e.length,T=0;T<E;T++)for(var S=e[T],k=0;k<S.length;k++)for(var O=S[k],R=0;R<O.length-1;R++){if(l&&Be(O[R],O[R+1],u))continue;let e,t;"CCW"===f?(e=R,t=R+1):(e=R+1,t=R);var C=[[O[t][0],O[t][1],m],[O[t][0],O[t][1],p],[O[e][0],O[e][1],p],[O[e][0],O[e][1],m]];let r=ye.normalize([O[t][0]-O[e][0],O[t][1]-O[e][1],0]),n=ye.cross(Xe,r);s[o+0]=n[0]*a,s[o+1]=n[1]*a,s[o+2]=n[2]*a;for(var N=0;N<C.length;N++)s[0]=C[N][0],s[1]=C[N][1],s[2]=C[N][2],c&&(s[c+0]=A[N][0]*d,s[c+1]=A[N][1]*d),i.addVertex(s);g.push(y+0),g.push(y+1),g.push(y+2),g.push(y+2),g.push(y+3),g.push(y+0),y+=4,_+=2}return _}(e,t.z,t.height,t.min_height,i,o,s.index.a_normal,127,a):Ye(e,i,o,a)}});const tt=[0,0],rt={butt:0,square:1,round:2},nt={miter:0,bevel:1,round:2},it=G.tile_scale,st=[0,0],ot=[1,0],at=[.5,0];function lt(e,t){if(!(e.length<2)){var r,n,i,s,{join_type:o,cap_type:a,closed_polygon:l,remove_tile_edges:u,tile_edge_tolerance:c,v_scale:h,miter_len_sq:d}=t,f=null!=t.texcoord_index,p=0;if(l&&o===nt.miter){var m=function(e){if(Ve(e[0]))return 0;for(var t=0;t<e.length;t++)if(Ve(e[e.length-1-t]))return e.length-1-t;return 0}(e);if(0!==m){var _=function(e,t){var r=[];for(let i=0;i<e.length;i++){var n=(i+t)%e.length;0!==n&&r.push(e[n])}return r.push(r[0]),r}(e,m);return t.extra_lines=t.extra_lines||[],void t.extra_lines.push(_)}}var g=0,y=e.length-1,v=0;for(r=e[g],n=e[g+1];ye.isEqual(r,n);)if(r=n,n=e[1+ ++g],v++,g===e.length-1)return;for(;ye.isEqual(e[y],e[y-1]);)if(v++,0===--y)return;if(!(e.length<2+v))if(s=ye.normalize(ye.perp(r,n)),u&&Be(r,n,c)){var b=ut(e,g,c);b&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(b))}else{l?function(e,t,r,n,i){if(void 0===n||Ve(e))pt(e,r,r,1,0,i,1),pt(e,r,r,0,0,i,-1);else{n===nt.miter?ht(0,e,t,r,i.miter_len_sq,!0,i):dt(n,0,e,t,r,!0,i)}}(r,i=ye.normalize(ye.perp(e[y-1],r)),s,o,t):(Ve(r)||(gt(r,p,s,a,!0,t),f&&a!==rt.butt&&(p+=.5*h*t.texcoord_width)),pt(r,s,s,1,p,t,1),pt(r,s,s,0,p,t,-1)),f&&(p+=h*ye.length(ye.sub(n,r)));for(var x=g+1;x<y;x++){var w=x,A=x+1;if(r=e[w],n=e[A],!ye.isEqual(r,n)){if(u&&Be(r,n,c)){pt(r,s,s,1,p,t,1),pt(r,s,s,0,p,t,-1),ft(1,t);var E=ut(e,w+1,c);return void(E&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(E)))}i=s,s=ye.normalize(ye.perp(r,n)),o===nt.miter?ht(p,r,i,s,d,!1,t):dt(o,p,r,i,s,!1,t),f&&(p+=h*ye.length(ye.sub(n,r)))}}r=n,i=s,l?function(e,t,r,n,i,s){if(Ve(e))pt(e,t,t,1,i,s,1),pt(e,t,t,0,i,s,-1),ft(1,s);else{var o=ct(t,r);n===nt.miter&&ye.lengthSq(o)>s.miter_len_sq&&(n=nt.bevel),n===nt.miter?(pt(e,o,t,1,i,s,1),pt(e,o,t,0,i,s,-1),ft(1,s)):(pt(e,t,t,1,i,s,1),pt(e,t,t,0,i,s,-1),ft(1,s))}}(r,i,s=ye.normalize(ye.perp(r,e[1])),o,p,t):(pt(r,i,s,1,p,t,1),pt(r,i,s,0,p,t,-1),ft(1,t),Ve(r)||gt(r,p,i,a,!1,t))}}}function ut(e,t,r){for(var n=t;e[n+1]&&Be(e[n],e[n+1],r);)n++;return e.length-n>=2&&e.slice(n)}function ct(e,t){var r=ye.normalize(ye.add(e,t)),n=2/(1+Math.abs(ye.dot(e,r)));return ye.mult(r,n*n)}function ht(e,t,r,n,i,s,o){var a=ct(r,n);ye.lengthSq(a)>i?dt(nt.bevel,e,t,r,n,s,o):(pt(t,a,a,1,e,o,1),pt(t,a,a,0,e,o,-1),s||ft(1,o))}function dt(e,t,r,n,i,s,o){var a=ct(n,i),l=i[0]*n[1]-i[1]*n[0]>0;null!=o.texcoord_index&&(st[1]=t,ot[1]=t),l?(pt(r,a,a,1,t,o,1),pt(r,n,a,0,t,o,-1),s||ft(1,o),_t(r,ye.neg(n),a,ye.neg(i),a,st,ot,st,!1,e===nt.bevel,o),pt(r,a,a,1,t,o,1),pt(r,i,a,0,t,o,-1)):(pt(r,n,a,1,t,o,1),pt(r,a,a,0,t,o,-1),s||ft(1,o),_t(r,n,ye.neg(a),i,a,ot,st,ot,!1,e===nt.bevel,o),pt(r,i,a,1,t,o,1),pt(r,a,a,0,t,o,-1))}function ft(e,t){for(var r=t.vertex_data.vertex_elements,n=t.vertex_data.vertex_count-2*e-2,i=0;i<e;i++)r.push(n+2*i+2),r.push(n+2*i+1),r.push(n+2*i+0),r.push(n+2*i+2),r.push(n+2*i+3),r.push(n+2*i+1),t.geom_count+=2}function pt(e,t,r,n,i,s,o){var a=s.vertex_template,l=s.vertex_data;a[0]=e[0],a[1]=e[1];let u=s.half_width*o;a[s.extrude_index+0]=t[0]*u,a[s.extrude_index+1]=t[1]*u,s.offset&&(a[s.offset_index+0]=r[0]*s.offset,a[s.offset_index+1]=r[1]*s.offset),null!=s.texcoord_index&&(a[s.texcoord_index+0]=65535*n,a[s.texcoord_index+1]=65535*i),l.addVertex(a)}var mt=[0,0];function _t(e,t,r,n,i,s,o,a,l,u,c){for(var h=t[0]*n[1]-t[1]*n[0],d=ye.dot(t,n),f=Math.atan2(h,d);f>=Math.PI;)f-=2*Math.PI;if(u)p=1;else{var p=function(e,t){e<0&&(e=-e);var r=t>10?Math.log2(t/5):1;return Math.ceil(e/Math.PI*r)}(f,c.half_width);if(p<1)return}var m=c.vertex_data.vertex_count,_=c.vertex_data.vertex_elements;pt(e,r,i,o[0],o[1],c,1),pt(e,t,i,s[0],s[1],c,1);var g=t,y=null!=c.texcoord_index;if(y)if(l)var v=ye.sub(s,o);else{mt=ye.copy(s);var b=ye.div(ye.sub(a,s),p)}var x=f/p;let w,A,E=f<0?-1:1;h>0?(w=2,A=1):(w=1,A=2);for(var T=0;T<p;T++)0===T&&f<0&&(g=ye.neg(g)),g=ye.rot(g,x),y&&(l?(v=ye.rot(v,x),mt[0]=v[0]+o[0],mt[1]=v[1]*c.texcoord_width*c.v_scale+o[1]):mt=ye.add(mt,b)),pt(e,g,i,mt[0],mt[1],c,E),_.push(m+T+w),_.push(m),_.push(m+T+A)}function gt(e,t,r,n,i,s){var o=ye.neg(r),a=null!=s.texcoord_index;switch(n){case rt.square:var l;i?(l=[r[1],-r[0]],pt(e,ye.add(r,l),r,1,t,s,1),pt(e,ye.add(o,l),r,0,t,s,1),a&&(t+=.5*s.texcoord_width*s.v_scale),pt(e,r,r,1,t,s,1),pt(e,o,r,0,t,s,1)):(l=[-r[1],r[0]],pt(e,r,r,1,t,s,1),pt(e,o,r,0,t,s,1),a&&(t+=.5*s.texcoord_width*s.v_scale),pt(e,ye.add(r,l),r,1,t,s,1),pt(e,ye.add(o,l),r,0,t,s,1)),ft(1,s);break;case rt.round:var u,c,h=st,d=ot,f=at;i?(u=r,c=o,a&&(t+=.5*s.texcoord_width*s.v_scale,h=ot,d=st,f=at)):(u=o,c=r),a&&(st[1]=t,ot[1]=t,at[1]=t),_t(e,u,tt,c,r,h,f,d,!0,!1,s);break;case rt.butt:return}}const yt=[255,255,255,255],vt=[0,0,0,0],bt=Object.create(Ne);Object.assign(bt,{name:"lines",built_in:!0,vertex_shader_src:Qe,fragment_shader_src:Je,selection:!0,init(){Ne.init.apply(this,arguments),this.defines.TANGRAM_EXTRUDE_LINES=!0,this.defines.TANGRAM_TEXTURE_COORDS=!0,this.outline_feature_style={},this.inline_feature_style=this.feature_style,this.dash_textures={}},calcDistance:(e,t)=>J.evalCachedDistanceProperty(e,t)||0,calcDistanceNextZoom(e,t){t.zoom++;let r=this.calcDistance(e,t);return t.zoom--,r},calcWidth(e,t,r){let n,i=this.calcDistance(e.width,r);if(!(i<0)){if(n=e.next_width?this.calcDistanceNextZoom(e.next_width,r):i/2,0===i&&0===n||n<0)return!1;if(t.width_unscaled=i,t.next_width_unscaled=n,e.next_width){n*=2;let e=.5*(i+n);t.width=e*r.units_per_meter_overzoom,t.width_scale=1-n/e}else t.width=i*r.units_per_meter_overzoom,t.width_scale=0;return e.texcoords&&(e.inline_texcoord_width?t.texcoord_width=e.inline_texcoord_width:t.texcoord_width=(t.width_unscaled||t.next_width_unscaled)*r.units_per_meter_overzoom/r.tile.overzoom2),!0}},calcOffset(e,t,r){if(e.offset_precalc)t.offset=e.offset_precalc,t.offset_scale=e.offset_scale_precalc;else if(e.offset){let n=this.calcDistance(e.offset,r);if(e.next_offset){let i=2*this.calcDistanceNextZoom(e.next_offset,r);Math.abs(n)>=Math.abs(i)?(t.offset=n*r.units_per_meter_overzoom,t.offset_scale=0!==n?1-i/n:0):(t.offset=i*r.units_per_meter_overzoom,t.offset_scale=0!==i?-1*(1-n/i):0)}else t.offset=n*r.units_per_meter_overzoom,t.offset_scale=0}else t.offset=0,t.offset_scale=0},_parseFeature(e,t,r){var n=this.feature_style;if(!1!==this.calcWidth(t,n,r)&&(this.calcOffset(t,n,r),n.color=this.parseColor(t.color,r),n.color)){if(n.alpha=J.evalCachedProperty(t.alpha,r),n.variant=t.variant,n.z=J.evalCachedDistanceProperty(t.z,r)||J.defaults.z,n.height=e.properties.height||J.defaults.height,n.extrude=J.evalProperty(t.extrude,r),n.extrude&&("number"==typeof n.extrude?n.height=n.extrude:Array.isArray(n.extrude)&&(n.height=n.extrude[1])),n.extrude&&n.height&&(n.z+=n.height),n.z*=G.height_scale,n.cap=t.cap,n.join=t.join,n.miter_limit=t.miter_limit,n.tile_edges=t.tile_edges,n.outline=n.outline||{width:{},next_width:{},preprocessed:!0},t.outline&&!1!==t.outline.visible&&t.outline.color&&t.outline.width){let e=2*this.calcDistance(t.outline.width,r),i=2*this.calcDistanceNextZoom(t.outline.next_width,r);0===e&&0===i||e<0||i<0?(n.outline.width.value=null,n.outline.next_width.value=null,n.outline.color=null,n.outline.inline_texcoord_width=null,n.outline.texcoords=!1):(n.outline.width.value=e+n.width_unscaled,n.outline.next_width.value=i+n.next_width_unscaled,n.outline.inline_texcoord_width=n.texcoord_width,n.outline.offset_precalc=n.offset,n.outline.offset_scale_precalc=n.offset_scale,n.outline.color=t.outline.color,n.outline.alpha=t.outline.alpha,n.outline.interactive=t.outline.interactive,n.outline.cap=t.outline.cap,n.outline.join=t.outline.join,n.outline.miter_limit=t.outline.miter_limit,n.outline.texcoords=t.outline.texcoords,n.outline.extrude=t.outline.extrude,n.outline.z=t.outline.z,n.outline.style=t.outline.style,n.outline.variant=t.outline.variant,t.outline.order?n.outline.order=this.parseOrder(t.outline.order,r):n.outline.order=n.order,n.outline.order>n.order&&(n.outline.order=n.order),n.outline.order-=.5)}else n.outline.width.value=null,n.outline.next_width.value=null,n.outline.color=null,n.outline.inline_texcoord_width=null;return n}},_preprocess(e){if(e.color=J.createColorPropertyCache(e.color),e.alpha=J.createPropertyCache(e.alpha),e.width=J.createPropertyCache(e.width,J.parseUnits),e.width&&e.width.type!==J.CACHE_TYPE.STATIC&&(e.next_width=J.createPropertyCache(e.width,J.parseUnits)),e.offset=e.offset&&J.createPropertyCache(e.offset,J.parseUnits),e.offset&&e.offset.type!==J.CACHE_TYPE.STATIC&&(e.next_offset=J.createPropertyCache(e.offset,J.parseUnits)),e.z=J.createPropertyCache(e.z,J.parseUnits),e.dash=void 0!==e.dash?e.dash:this.dash,e.dash_key=e.dash&&this.dashTextureKey(e.dash),e.dash_background_color=void 0!==e.dash_background_color?e.dash_background_color:this.dash_background_color,e.dash_background_color=e.dash_background_color&&J.parseColor(e.dash_background_color),e.texture_merged=e.dash_key||(void 0!==e.texture?e.texture:this.texture),e.texcoords=this.texcoords||e.texture_merged?1:0,this.computeVariant(e),e.outline){e.outline.is_outline=!0,e.outline.style=e.outline.style||this.name,e.outline.color=J.createColorPropertyCache(e.outline.color),e.outline.alpha=J.createPropertyCache(e.outline.alpha),e.outline.width=J.createPropertyCache(e.outline.width,J.parseUnits),e.outline.next_width=J.createPropertyCache(e.outline.width,J.parseUnits),e.outline.interactive=null!=e.outline.interactive?e.outline.interactive:e.interactive,e.outline.cap=e.outline.cap||e.cap,e.outline.join=e.outline.join||e.join,e.outline.miter_limit=null!=e.outline.miter_limit?e.outline.miter_limit:e.miter_limit,e.outline.offset=e.offset,e.outline.extrude=e.extrude,e.outline.z=e.z;let t=this.styles[e.outline.style];t?(e.outline.dash=void 0!==e.outline.dash?e.outline.dash:t.dash,e.outline.texture=void 0!==e.outline.texture?e.outline.texture:t.texture,null!=e.outline.dash?(e.outline.dash_key=e.outline.dash&&this.dashTextureKey(e.outline.dash),e.outline.texture_merged=e.outline.dash_key):null===e.outline.dash||null!=e.outline.texture?(e.outline.dash_key=null,e.outline.texture_merged=e.outline.texture):(e.outline.dash=e.dash,e.outline.dash_key=e.outline.dash&&this.dashTextureKey(e.outline.dash),e.outline.texture_merged=e.outline.dash_key),e.outline.dash_background_color=void 0!==e.outline.dash_background_color?e.outline.dash_background_color:t.dash_background_color,e.outline.dash_background_color=void 0!==e.outline.dash_background_color?e.outline.dash_background_color:e.dash_background_color,e.outline.dash_background_color=e.outline.dash_background_color&&J.parseColor(e.outline.dash_background_color),e.outline.texcoords=t.texcoords||e.outline.texture_merged?1:0,void 0===e.outline.blend_order&&null!=e.blend_order&&(e.outline.blend_order=e.blend_order),t.computeVariant(e.outline)):(_({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': line 'outline' specifies non-existent draw style '${e.outline.style}' (or maybe the style is defined but is missing a 'base' or has another error), skipping outlines for features matching this layer group`),e.outline=null)}return e},dashTextureKey:e=>"__dash_"+JSON.stringify(e),getDashTexture(e){let t=this.dashTextureKey(e);if(null==this.dash_textures[t]){this.dash_textures[t]=!0;const r=function(e,t={}){const r=t.dash_color||yt,n=t.background_color||vt,i=e,s=t.scale||1;i.length%2==1&&Array.prototype.push.apply(i,i);let o=!0,a=[];for(let e=0;e<i.length;e++){let t=Math.floor(i[e]*s);for(let e=0;e<t;e++)Array.prototype.push.apply(a,o?r:n);o=!o}return a.reverse(),a=new Uint8Array(a),{pixels:a,length:a.length/4}}(e,{scale:20});k.create(this.gl,t,{data:r.pixels,height:r.length,width:1,filtering:"nearest"})}},async endData(e){const t=await Ne.endData.call(this,e);if(t){t.uniforms.u_has_line_texture=!1,t.uniforms.u_texture=k.default,t.uniforms.u_v_scale_adjust=G.tile_scale;let r=[];for(let n in t.meshes){let i=t.meshes[n].variant;if(i.texture){let s=t.meshes[n].uniforms=t.meshes[n].uniforms||{};if(s.u_has_line_texture=!0,s.u_texture=i.texture,s.u_texture_ratio=1,i.dash&&(s.u_v_scale_adjust=20*G.tile_scale,s.u_has_dash=null!=i.dash_background_color?1:0,s.u_dash_background_color=i.dash_background_color||[0,0,0,0]),i.dash_key&&null==this.dash_textures[i.dash_key]){this.dash_textures[i.dash_key]=!0;try{await a.postMessage(this.main_thread_target+".getDashTexture",i.dash)}catch(e){_("trace",`${this.name}: line dash texture create failed because style no longer on main thread`)}}if(null==k.textures[i.texture])r.push(k.syncTexturesToWorker([i.texture]).then(e=>{let t=e[i.texture];t&&(s.u_texture_ratio=t.height/t.width)}));else{let e=k.textures[i.texture];s.u_texture_ratio=e.height/e.width}}}await Promise.all(r)}return t},computeVariant(e){let t=e.offset?1:0;t+="/"+e.texcoords,t+="/"+(e.interactive?1:0),t+="/"+(e.extrude||e.z?1:0),t+="/"+e.is_outline,e.dash_key&&(t+=e.dash_key,e.dash_background_color&&(t+=e.dash_background_color)),e.texture_merged&&(t+=e.texture_merged);const r=this.getBlendOrderForDraw(e);t+="/"+r,t=N(t),e.variant=t,null==this.variants[t]&&(this.variants[t]={key:t,blend_order:r,mesh_order:e.is_outline?0:1,selection:e.interactive?1:0,offset:e.offset?1:0,z_or_offset:e.offset||e.extrude||e.z?1:0,texcoords:e.texcoords,texture:e.texture_merged,dash:e.dash,dash_key:e.dash_key,dash_background_color:e.dash_background_color})},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.key]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_extrude",size:2,type:fe.SHORT,normalized:!1},{name:"a_offset",size:2,type:fe.SHORT,normalized:!1,static:e.offset?null:[0,0]},{name:"a_z_and_offset_scale",size:2,type:fe.SHORT,normalized:!1,static:e.z_or_offset?null:[0,0]},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0,static:e.texcoords?null:[0,0]},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.key]=new Le(t)}return this.vertex_layouts[e.key]},meshVariantTypeForDraw(e){return this.variants[e.variant]},makeVertexTemplate(e,t){let r=0;return this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=1024*e.width_scale,this.vertex_template[r++]=this.scaleOrder(e.order),this.vertex_template[r++]=0,this.vertex_template[r++]=0,t.variant.offset&&(this.vertex_template[r++]=0,this.vertex_template[r++]=0),t.variant.z_or_offset&&(this.vertex_template[r++]=e.z||0,this.vertex_template[r++]=1024*e.offset_scale),t.variant.texcoords&&(this.vertex_template[r++]=0,this.vertex_template[r++]=0),this.vertex_template[r++]=255*e.color[0],this.vertex_template[r++]=255*e.color[1],this.vertex_template[r++]=255*e.color[2],this.vertex_template[r++]=255*(null!=e.alpha?e.alpha:e.color[3]),t.variant.selection&&(this.vertex_template[r++]=255*e.selection_color[0],this.vertex_template[r++]=255*e.selection_color[1],this.vertex_template[r++]=255*e.selection_color[2],this.vertex_template[r++]=255*e.selection_color[3]),this.addCustomAttributesToVertexTemplate(e,r),this.vertex_template},buildLines(e,t,r,n){if(this.feature_style=this.outline_feature_style,t.outline&&null!=t.outline.color&&null!=t.outline.width.value){var i=this.styles[t.outline.style];i&&i.addFeature(r.feature,t.outline,r)}this.feature_style=this.inline_feature_style;let s=this.getTileMesh(r.tile,this.meshVariantTypeForDraw(t)),o=s.vertex_data,a=o.vertex_layout;return function(e,t,r,n,i,s,o,a){var l,u=t.cap?rt[t.cap]:rt.butt,c=t.join?nt[t.join]:nt.miter;if(c===nt.miter){const e=t.miter_limit||3;var h=e*e}i.a_texcoord&&(l=1/(t.texcoord_width*it));var d={closed_polygon:s,remove_tile_edges:o,tile_edge_tolerance:a,miter_len_sq:h,join_type:c,cap_type:u,vertex_data:r,vertex_template:n,half_width:t.width/2,extrude_index:i.a_extrude,offset_index:i.a_offset,v_scale:l,texcoord_index:i.a_texcoord,texcoord_width:t.texcoord_width,offset:t.offset,geom_count:0};for(let t=0;t<e.length;t++)lt(e[t],d);if(d.extra_lines)for(let e=0;e<d.extra_lines.length;e++)lt(d.extra_lines[e],d);return d.geom_count}(e,t,o,this.makeVertexTemplate(t,s),a.index,n&&n.closed_polygon,!t.tile_edges&&n&&n.remove_tile_edges,G.tile_scale*r.tile.pad_scale*2)},buildPolygons(e,t,r){let n=0;for(let i=0;i<e.length;i++)n+=this.buildLines(e[i],t,r,{closed_polygon:!0,remove_tile_edges:!0});return n}});const xt=128/Math.PI,wt=16384/Math.PI,At=[0,2,2,0],Et=[1,1,3,3],Tt=new Array(4),St=["left","top-left","bottom-left"],kt=["right","top-right","bottom-right"],Ot=["top","top-left","top-right"],Rt=["bottom","bottom-left","bottom-right"],Ct={computeOffset(e,t,r,n=null){if(!r||"center"===r)return e;let i=[e[0],e[1]];return n=n||this.default_buffer,this.isLeftAnchor(r)?(i[0]-=t[0]/2,"left"===r&&(i[0]-=n[0])):this.isRightAnchor(r)&&(i[0]+=t[0]/2,"right"===r&&(i[0]+=n[1])),this.isTopAnchor(r)?(i[1]-=t[1]/2,"top"===r&&(i[1]-=n[2])):this.isBottomAnchor(r)&&(i[1]+=t[1]/2,"bottom"===r&&(i[1]+=n[3])),i},alignForAnchor(e){if(e&&"center"!==e){if(this.isLeftAnchor(e))return"right";if(this.isRightAnchor(e))return"left"}return"center"},isLeftAnchor:e=>St.indexOf(e)>-1,isRightAnchor:e=>kt.indexOf(e)>-1,isTopAnchor:e=>Ot.indexOf(e)>-1,isBottomAnchor:e=>Rt.indexOf(e)>-1,default_buffer:[2.5,2.5,1.5,.75],zero_buffer:[0,0,0,0]};function Nt(e,t){return!(e[2]<t[0]||e[0]>t[2]||e[3]<t[1]||e[1]>t[3])}const Pt=[[1,0],[0,1]],Mt=[],Dt=[];let zt,It,Ft,Lt;class jt{constructor(e,t,r,n,i){this.dimension=[n/2,i/2],this.angle=r,this.centroid=[e,t],this.quad=null,this.axis_0=null,this.axis_1=null,this.update()}toJSON(){return{x:this.centroid[0],y:this.centroid[1],a:this.angle,w:this.dimension[0],h:this.dimension[1]}}getExtent(){return 0===this.angle?[this.quad[0],this.quad[1],this.quad[4],this.quad[5]]:[Math.min(this.quad[0],this.quad[2],this.quad[4],this.quad[6]),Math.min(this.quad[1],this.quad[3],this.quad[5],this.quad[7]),Math.max(this.quad[0],this.quad[2],this.quad[4],this.quad[6]),Math.max(this.quad[1],this.quad[3],this.quad[5],this.quad[7])]}updateAxes(){this.axis_0=ye.normalize([this.quad[4]-this.quad[6],this.quad[5]-this.quad[7]]),this.axis_1=ye.normalize([this.quad[4]-this.quad[2],this.quad[5]-this.quad[3]])}update(){const e=this.centroid,t=this.dimension[0],r=this.dimension[1];if(0===this.angle)this.quad=[e[0]-t,e[1]-r,e[0]+t,e[1]-r,e[0]+t,e[1]+r,e[0]-t,e[1]+r],this.axis_0=Pt[0],this.axis_1=Pt[1];else{let n=Math.cos(this.angle)*t,i=Math.sin(this.angle)*t,s=-Math.sin(this.angle)*r,o=Math.cos(this.angle)*r;this.quad=[e[0]-n-s,e[1]-i-o,e[0]+n-s,e[1]+i-o,e[0]+n+s,e[1]+i+o,e[0]-n+s,e[1]-i+o],this.updateAxes()}}static projectToAxis(e,t,r){let n=e.quad;return zt=n[0]*t[0]+n[1]*t[1],It=n[2]*t[0]+n[3]*t[1],Ft=n[4]*t[0]+n[5]*t[1],Lt=n[6]*t[0]+n[7]*t[1],r[0]=Math.min(zt,It,Ft,Lt),r[1]=Math.max(zt,It,Ft,Lt),r}static axisCollide(e,t,r,n){return jt.projectToAxis(e,r,Mt),jt.projectToAxis(t,r,Dt),!(Dt[0]>Mt[1]||Dt[1]<Mt[0]||(jt.projectToAxis(e,n,Mt),jt.projectToAxis(t,n,Dt),Dt[0]>Mt[1]||Dt[1]<Mt[0]))}static intersect(e,t){return jt.axisCollide(e,t,e.axis_0,e.axis_1)&&jt.axisCollide(e,t,t.axis_0,t.axis_1)}}class Ut{constructor(e,t={}){this.id=Ut.nextLabelId(),this.type="",this.size=e,this.layout=t,this.position=null,this.angle=0,this.anchor=Array.isArray(this.layout.anchor)?this.layout.anchor[0]:this.layout.anchor,this.placed=null,this.offset=t.offset,this.unit_scale=this.layout.units_per_pixel,this.aabb=null,this.obb=null,this.align="center",this.throw_away=!1}toJSON(){return{id:this.id,type:this.type,obb:this.obb.toJSON(),position:this.position,angle:this.angle,size:this.size,offset:this.offset,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Bt(this.layout)}}update(){this.align=this.layout.align||Ct.alignForAnchor(this.anchor)}occluded(e,t=null){let r=!1,n=e.aabb,i=e.obb;return n.length>0&&function(e,t,r){for(let n=0;n<t.length&&(!Nt(e,t[n])||null==r(n));n++);}(this.aabb,n,e=>{if(!t||n[e]!==t.aabb)return 0===this.obb.angle&&0===i[e].angle||jt.intersect(this.obb,i[e])?(r=!0,!0):void 0}),r}inTileBounds(){return this.aabb[0]>=0&&this.aabb[1]>-G.tile_scale&&this.aabb[0]<G.tile_scale&&this.aabb[1]<=0||this.aabb[2]>=0&&this.aabb[3]>-G.tile_scale&&this.aabb[2]<G.tile_scale&&this.aabb[3]<=0}mayRepeatAcrossTiles(){if(this.layout.collide)return!0;const e=this.layout.repeat_distance;return 0!==e&&(Math.abs(this.position[0])<e||Math.abs(this.position[0]-G.tile_scale)<e||Math.abs(this.position[1])<e||Math.abs(-(this.position[1]-G.tile_scale))<e)}discard(e,t=null){return!!this.throw_away||this.occluded(e,t)}}function Bt(e){return{priority:e.priority,collide:e.collide,repeat_distance:e.repeat_distance,repeat_group:e.repeat_group,buffer:e.buffer,italic:e.italic}}Ut.add=function(e,t){if(e.placed=!0,e.aabb&&(t.aabb.push(e.aabb),t.obb.push(e.obb)),e.aabbs)for(let r=0;r<e.aabbs.length;r++)t.aabb.push(e.aabbs[r]),t.obb.push(e.obbs[r])},Ut.id=0,Ut.id_prefix=0,Ut.id_multiplier=0,Ut.nextLabelId=function(){return Ut.id_prefix+Ut.id++*Ut.id_multiplier},Ut.epsilon=.9999;class Vt{constructor(e,t){this.key=e,this.repeat_dist=t,this.repeat_dist_sq=this.repeat_dist*this.repeat_dist,this.positions=[]}check(e){let t=e.position;for(let e=0;e<this.positions.length;e++){let r=this.positions[e],n=t[0]-r[0],i=t[1]-r[1];if(n*n+i*i<this.repeat_dist_sq)return!0}}add(e){e&&e.position&&this.positions.push(e.position)}static clear(e){this.groups[e]={}}static check(e,t,r){if(t.repeat_distance&&t.repeat_group&&this.groups[r][t.repeat_group])return this.groups[r][t.repeat_group].check(e)}static add(e,t,r){t.repeat_distance&&t.repeat_group&&(null==this.groups[r][t.repeat_group]&&(this.groups[r][t.repeat_group]=new Vt(t.repeat_group,t.repeat_distance*t.repeat_scale)),this.groups[r][t.repeat_group].add(e))}}Vt.groups={};class Gt{constructor(e,t){this.anchor=e,this.span=t,this.cells={}}addLabel(e){e.aabb&&this.addLabelBboxes(e,e.aabb),e.aabbs&&e.aabbs.forEach(t=>this.addLabelBboxes(e,t))}addLabelBboxes(e,t){const r=[Math.max(Math.floor((t[0]-this.anchor.x)/this.span),0),Math.max(Math.floor(-(t[1]-this.anchor.y)/this.span),0),Math.max(Math.floor((t[2]-this.anchor.x)/this.span),0),Math.max(Math.floor(-(t[3]-this.anchor.y)/this.span),0)];e.cells=[];for(let t=r[1];t<=r[3];t++){this.cells[t]=this.cells[t]||{};for(let n=r[0];n<=r[2];n++)this.cells[t][n]=this.cells[t][n]||{aabb:[],obb:[]},e.cells.push(this.cells[t][n])}}}const $t={tiles:{},grid:null,initGrid(e){this.grid=null==e?null:new Gt(e.anchor,e.span)},startTile(e,{apply_repeat_groups:t=!0,return_hidden:r=!1}={}){let n=this.tiles[e]={bboxes:{aabb:[],obb:[]},objects:{},labels:{},styles:{},repeat:t,return_hidden:r};null==n.complete&&(n.complete=new Promise((e,t)=>{n.resolve=e,n.reject=t}))},resetTile(e){delete this.tiles[e]},abortTile(e){this.tiles[e]&&this.tiles[e].resolve&&this.tiles[e].resolve([]),this.resetTile(e)},addStyle(e,t){this.tiles[t].styles[e]=!0},collide(e,t,r){let n=this.tiles[r];if(!n)return _("trace","Collision.collide() called with null tile",r,this.tiles,t,e),Promise.resolve([]);let i=n.objects;for(let r=0;r<e.length;r++){let n=e[r],s=n.label.layout.priority;i[s]=i[s]||{},i[s][t]=i[s][t]||[],i[s][t].push(n)}return delete n.styles[t],0===Object.keys(n.styles).length&&this.endTile(r),n.complete.then(()=>(n.resolve=null,n.labels[t]||[]))},endTile(e){let t=this.tiles[e],r=t.labels;this.grid&&this.addLabelsToGrid(e),t.repeat&&Vt.clear(e);let n=Object.keys(t.objects).sort((e,t)=>e-t);for(let i=0;i<n.length;i++){let s=t.objects[n[i]];if(s)for(let n in s){let i=s[n];r[n]=r[n]||[];for(let s=0;s<i.length;s++){let o=i[s];this.canBePlaced(o,e,o.linked,t)?o.linked?this.canBePlaced(o.linked,e,o,t)?(o.show=!0,(o.label.breach||o.linked.label.breach)&&(o.label.breach=!0,o.linked.label.breach=!0),(o.label.may_repeat_across_tiles||o.linked.label.may_repeat_across_tiles)&&(o.label.may_repeat_across_tiles=!0,o.linked.label.may_repeat_across_tiles=!0),r[n].push(o),this.place(o,e,t),this.place(o.linked,e,t)):t.return_hidden&&(o.show=!1,r[n].push(o)):(o.show=!0,r[n].push(o),this.place(o,e,t)):t.return_hidden&&(o.show=!1,r[n].push(o))}}}delete this.tiles[e],t.resolve()},addLabelsToGrid(e){const t=this.tiles[e];for(const e in t.objects){const r=t.objects[e];if(r)for(const e in r)r[e].forEach(e=>this.grid.addLabel(e.label))}},canBePlaced(e,t,r=null,{repeat:n=!0}={}){let i=e.label,s=e.label.layout;if(null!=i.placed)return i.placed;let o=!s.collide;if(o||(o=this.grid&&i.cells?i.cells.reduce((e,t)=>(e&&i.discard(t,r&&r.label)&&(e=!1),e),!0):!i.discard(this.tiles[t].bboxes,r&&r.label)),o){if(!n||!Vt.check(i,s,t))return!0;i.placed=!1}else s.collide&&(i.placed=!1);return i.placed},place({label:e},t,{repeat:r=!0}){null==e.placed&&(r&&Vt.add(e,e.layout,t),this.grid&&e.cells?e.cells.forEach(t=>Ut.add(e,t)):Ut.add(e,this.tiles[t].bboxes))}};class qt extends Ut{constructor(e,t,r,n=0){super(t,r),this.type="point",this.position=[e[0],e[1]],this.angle=n,this.parent=this.layout.parent,this.update(),this.start_anchor_index=1,this.degenerate=!(this.size[0]||this.size[1]||this.layout.buffer[0]||this.layout.buffer[1]),this.throw_away=!1}update(){super.update(),this.computeOffset(),this.updateBBoxes()}computeOffset(){if(this.offset=[this.layout.offset[0],this.layout.offset[1]],this.parent){let e=this.parent;this.offset=Ct.computeOffset(this.offset,e.size,e.anchor,Ct.zero_buffer),this.offset=Ct.computeOffset(this.offset,e.size,this.anchor,Ct.zero_buffer),e.offset!==J.zeroPair&&(this.offset===J.zeroPair?this.offset=e.offset:(this.offset[0]+=e.offset[0],this.offset[1]+=e.offset[1]))}this.offset=Ct.computeOffset(this.offset,this.size,this.anchor)}updateBBoxes(){let e=(this.size[0]+2*this.layout.buffer[0])*this.unit_scale*Ut.epsilon,t=(this.size[1]+2*this.layout.buffer[1])*this.unit_scale*Ut.epsilon;this.layout.italic&&(e+=5*this.unit_scale),this.obb=new jt(this.position[0]+this.offset[0]*this.unit_scale,this.position[1]-this.offset[1]*this.unit_scale,-this.angle,e,t),this.aabb=this.obb.getExtent(),this.inTileBounds&&(this.breach=!this.inTileBounds()),this.mayRepeatAcrossTiles&&(this.may_repeat_across_tiles=this.mayRepeatAcrossTiles())}discard(e,t=null){if(this.degenerate)return!1;if(super.discard(e,t)){if(Array.isArray(this.layout.anchor))for(let r=this.start_anchor_index;r<this.layout.anchor.length;r++)if(this.anchor=this.layout.anchor[r],this.update(),!super.discard(e,t))return!1;return!0}return!1}}qt.PLACEMENT={VERTEX:0,MIDPOINT:1,SPACED:2,CENTROID:3};const Wt=qt.PLACEMENT;function Ht(e,t,r){const n=[],i=r.placement,s=Math.max(t[0],t[1])*r.placement_min_length_ratio*r.units_per_pixel;if(i===Wt.SPACED){let i=function(e,t,r){let n=r.units_per_pixel,i=(r.placement_spacing||80)*n,s=function(e){let t=0;for(let r=0;r<e.length-1;r++)t+=Kt(e[r],e[r+1]);return t}(e);if(s<=t)return!1;let o=Math.max(Math.floor(s/i),1),a=[],l=[],u=.5*(s-(o-1)*i);for(let n=0;n<o;n++){let{position:n,angle:s}=Xt(e,u,t,r);null!=n&&null!=s&&(a.push(n),l.push(s)),u+=i}return{positions:a,angles:l}}(e,s,r);if(!i)return[];let o=i.positions,a=i.angles;for(let e=0;e<o.length;e++){let i=o[e],s=a[e];!0!==r.tile_edges&&Ve(i)||n.push(new qt(i,t,r,s))}}else if(i===Wt.VERTEX){let i,s;for(let o=0;o<e.length-1;o++)if(i=e[o],s=e[o+1],!0===r.tile_edges||!Ve(i)){const e=Zt(i,s,r.angle);n.push(new qt(i,t,r,e))}const o=Zt(i,s,r.angle);n.push(new qt(s,t,r,o))}else if(i===Wt.MIDPOINT)for(let i=0;i<e.length-1;i++){let o=e[i],a=e[i+1],l=[.5*(o[0]+a[0]),.5*(o[1]+a[1])];if((!0===r.tile_edges||!Ve(l))&&(!s||Kt(o,a)>s)){const e=Zt(o,a,r.angle);n.push(new qt(l,t,r,e))}}return n}function Zt(e,t,r=0){return"auto"===r?Math.atan2(t[0]-e[0],t[1]-e[1]):r}function Kt(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))}function Xt(e,t,r,n){let i,s,o=0;for(let a=0;a<e.length-1;a++){let l=e[a],u=e[a+1];const c=Kt(l,u);if(!(c<=r)&&(o+=c,o>t)){i=Yt(l,u,o-t),s=Zt(l,u,n.angle);break}}return{position:i,angle:s}}function Yt(e,t,r){let n=r/Kt(e,t);return[n*e[0]+(1-n)*t[0],n*e[1]+(1-n)*t[1]]}const Qt={key:e=>[e.style,e.weight,e.family,e.px_size,e.fill,e.stroke,e.stroke_width,e.underline_width,e.background_color,e.background_width,e.background_stroke_color,e.background_stroke_width,e.transform,e.text_wrap,e.max_lines,e.supersample,g.device_pixel_ratio].join("/"),defaults:{style:"normal",weight:"normal",size:"12px",px_size:12,family:"Helvetica",fill:[1,1,1,1],text_wrap:15,max_lines:5,align:"center"},compute(e,t){const r={};e.font=e.font||this.defaults,r.supersample=e.supersample_text?1.5:1,r.can_articulate=e.can_articulate,r.fill=J.evalCachedColorPropertyWithAlpha(e.font.fill,e.font.alpha,t),r.fill=g.toCSSColor(r.fill),e.font.stroke&&e.font.stroke.color&&(r.stroke=J.evalCachedColorPropertyWithAlpha(e.font.stroke.color,e.font.stroke.alpha,t),r.stroke=g.toCSSColor(r.stroke),r.stroke_width=J.evalCachedProperty(e.font.stroke.width,t)),!0!==e.font.underline||r.can_articulate||(r.underline_width=1.5*r.supersample),e.font.background&&!r.can_articulate&&(r.background_color=J.evalCachedColorPropertyWithAlpha(e.font.background.color,e.font.background.alpha,t),r.background_color=g.toCSSColor(r.background_color),r.background_color&&(r.background_width=J.evalCachedProperty(e.font.background.width,t)),r.background_stroke_color=e.font.background.stroke&&e.font.background.stroke.color&&J.evalCachedColorPropertyWithAlpha(e.font.background.stroke.color,e.font.background.stroke.alpha,t),r.background_stroke_color&&(r.background_stroke_color=g.toCSSColor(r.background_stroke_color),r.background_stroke_width=null!=e.font.background.stroke.width?J.evalCachedProperty(e.font.background.stroke.width,t):1)),r.weight=J.evalCachedProperty(e.font.weight,t)||this.defaults.weight,"number"==typeof r.weight&&(r.weight=Math.min(Math.max(r.weight,1),1e3)),e.font.family?(r.family=e.font.family,r.family!==this.defaults.family&&(r.family+=", "+this.defaults.family)):r.family=this.defaults.family,r.style=e.font.style||this.defaults.style,r.transform=e.font.transform,r.px_size=J.evalCachedProperty(e.font.px_size,t)*r.supersample,r.font_css=this.fontCSS(r);let n=e.text_wrap;return null!=n||r.can_articulate||(n=!0),!0===n&&(n=this.defaults.text_wrap),r.text_wrap=n,r.max_lines=e.max_lines||this.defaults.max_lines,r},fontCSS:({style:e,weight:t,px_size:r,family:n})=>[e,t,r+"px",n].filter(e=>e).join(" ")};var Jt,er,tr={exports:{}},rr=P((Jt||(Jt=1,er=tr,function(){function e(e,t){document.addEventListener?e.addEventListener("scroll",t,!1):e.attachEvent("scroll",t)}function t(e){this.a=document.createElement("div"),this.a.setAttribute("aria-hidden","true"),this.a.appendChild(document.createTextNode(e)),this.b=document.createElement("span"),this.c=document.createElement("span"),this.h=document.createElement("span"),this.f=document.createElement("span"),this.g=-1,this.b.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.c.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.f.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.h.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.b.appendChild(this.h),this.c.appendChild(this.f),this.a.appendChild(this.b),this.a.appendChild(this.c)}function r(e,t){e.a.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;left:-999px;white-space:nowrap;font:"+t+";"}function n(e){var t=e.a.offsetWidth,r=t+100;return e.f.style.width=r+"px",e.c.scrollLeft=r,e.b.scrollLeft=e.b.scrollWidth+100,e.g!==t&&(e.g=t,!0)}function i(t,r){function i(){var e=s;n(e)&&e.a.parentNode&&r(e.g)}var s=t;e(t.b,i),e(t.c,i),n(t)}function s(e,t){var r=t||{};this.family=e,this.style=r.style||"normal",this.weight=r.weight||"normal",this.stretch=r.stretch||"normal"}var o=null,a=null,l=null,u=null;function c(){if(null===l){var e=document.createElement("div");try{e.style.font="condensed 100px sans-serif"}catch(e){}l=""!==e.style.font}return l}function h(e,t){return[e.style,e.weight,c()?e.stretch:"","100px",t].join(" ")}s.prototype.load=function(e,n){var s=this,l=e||"BESbswy",c=0,d=n||3e3,f=(new Date).getTime();return new Promise(function(e,n){var p;if(null===u&&(u=!!document.fonts),(p=u)&&(null===a&&(a=/OS X.*Version\/10\..*Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor)),p=!a),p){p=new Promise(function(e,t){!function r(){(new Date).getTime()-f>=d?t():document.fonts.load(h(s,'"'+s.family+'"'),l).then(function(t){1<=t.length?e():setTimeout(r,25)},function(){t()})}()});var m=new Promise(function(e,t){c=setTimeout(t,d)});Promise.race([m,p]).then(function(){clearTimeout(c),e(s)},function(){n(s)})}else!function(e){document.body?e():document.addEventListener?document.addEventListener("DOMContentLoaded",function t(){document.removeEventListener("DOMContentLoaded",t),e()}):document.attachEvent("onreadystatechange",function t(){"interactive"!=document.readyState&&"complete"!=document.readyState||(document.detachEvent("onreadystatechange",t),e())})}(function(){function a(){var t;(t=-1!=_&&-1!=g||-1!=_&&-1!=y||-1!=g&&-1!=y)&&((t=_!=g&&_!=y&&g!=y)||(null===o&&(t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),o=!!t&&(536>parseInt(t[1],10)||536===parseInt(t[1],10)&&11>=parseInt(t[2],10))),t=o&&(_==v&&g==v&&y==v||_==b&&g==b&&y==b||_==x&&g==x&&y==x)),t=!t),t&&(w.parentNode&&w.parentNode.removeChild(w),clearTimeout(c),e(s))}var u=new t(l),p=new t(l),m=new t(l),_=-1,g=-1,y=-1,v=-1,b=-1,x=-1,w=document.createElement("div");w.dir="ltr",r(u,h(s,"sans-serif")),r(p,h(s,"serif")),r(m,h(s,"monospace")),w.appendChild(u.a),w.appendChild(p.a),w.appendChild(m.a),document.body.appendChild(w),v=u.a.offsetWidth,b=p.a.offsetWidth,x=m.a.offsetWidth,function e(){if((new Date).getTime()-f>=d)w.parentNode&&w.parentNode.removeChild(w),n(s);else{var t=document.hidden;!0!==t&&void 0!==t||(_=u.a.offsetWidth,g=p.a.offsetWidth,y=m.a.offsetWidth,a()),c=setTimeout(e,50)}}(),i(u,function(e){_=e,a()}),r(u,h(s,'"'+s.family+'",sans-serif')),i(p,function(e){g=e,a()}),r(p,h(s,'"'+s.family+'",serif')),i(m,function(e){y=e,a()}),r(m,h(s,'"'+s.family+'",monospace'))})})},er.exports=s}()),tr.exports));const nr={fonts_loaded:Promise.resolve(),last_loaded:null,loadFonts(e){const t=JSON.stringify(e)===this.last_loaded;if(e&&!t){const t=[];for(const r in e)Array.isArray(e[r])?e[r].forEach(e=>t.push(this.loadFontFace(r,e))):t.push(this.loadFontFace(r,e[r]));this.last_loaded=JSON.stringify(e),this.fonts_loaded=Promise.all(t.filter(e=>e))}return this.fonts_loaded},async loadFontFace(e,t){if(null==t||"object"!=typeof t&&"external"!==t)return;const r={family:e};"object"==typeof t&&(Object.assign(r,t),"string"==typeof t.url&&await this.injectFontFace(r));try{r.weight="string"==typeof r.weight?r.weight.split(" ")[0]:r.weight;const t=new rr(e,r);await t.load(),_("debug",`Font face '${e}' is available`,r)}catch(t){_("warn",`Font face '${e}' is NOT available`,r,t)}},async injectFontFace({family:e,url:t,weight:r,style:n}){void 0===this.supports_native_font_loading&&(this.supports_native_font_loading=void 0!==window.FontFace);let i=t;if("blob:"===t.slice(0,5)){i=(await g.io(t,6e4,"arraybuffer")).body;let e=new Uint8Array(i);if(this.supports_native_font_loading)i=e;else{let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);i="data:font/opentype;base64,"+btoa(t)}}if(this.supports_native_font_loading){let t;"string"==typeof i?t=new FontFace(e,`url(${encodeURI(i)})`,{weight:r,style:n}):i instanceof Uint8Array&&(t=new FontFace(e,i,{weight:r,style:n})),document.fonts.add(t),_("trace","Adding FontFace to document.fonts:",t)}else{let t=`\n @font-face {\n font-family: '${e}';\n font-weight: ${r||"normal"};\n font-style: ${n||"normal"};\n src: url(${encodeURI(i)});\n }`,s=document.createElement("style");s.appendChild(document.createTextNode("")),document.head.appendChild(s),s.sheet.insertRule(t,0),_("trace","Injecting CSS font face:",t)}}},ir=new RegExp("[֑-߿יִ-﷽ﹰ-ﻼ]");function sr(e){return ir.test(e)}const or="\0-/:-@[-`{-¿×÷ʹ-˿ -⯿‐-\u2029 -⯿",ar=new RegExp("["+or+"]+");function lr(e){return ar.test(e)}const ur=new RegExp("^["+or+"-ۿ]+"),cr=new RegExp("["+or+"آ-إاد-زوٱ-ٷڈ-ڙۄ-ۋۏےۓۮۯ]"),hr=new RegExp("^[ؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ۭ]+"),dr="[̀-֑ͯ-ׇֽֿׁׂׅׄަ-ްऀ-ःऺ-ौॎॏ॑-ॗॢॣঁ-ঃ়া-ৌৗৢৣਁ-ਃ਼-ੌੑઁ-ઃ઼ા-ૌૢૣଁ-ଃ଼ା-ୌୖୗୢୣஂா-்ௗఀ-ఃా-ౌౕౖౢౣಁ-ಃ಼ಾ-ೌೕೖೢೣഁ-ഃാ-ൌൎൗൢൣංඃ්-ෟෲෳัิ-ฺ็-๎ັິ-ຼ່-ໍ༹༘༙༵༷༾༿ཱ-ྃ྆྇ྍ-ྼ࿆ါ-း်-ှၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏႚ-ႝ឴-៑៓ᩕ-ᩞᩡ-᩼᷀-᷿⃐-]",fr=new RegExp(`^.(?:${dr}+)?([्্੍્୍్್്྄္្᩠᩿]\\W(?:${dr}+)?)*`),pr={Mongolian:"᠀-"},mr=Object.keys(pr).map(e=>pr[e]).join(""),_r=new RegExp("["+mr+"]");function gr(e,t,r){const n=t?1:2;if(e.length<n)return[e];let i=e;if(r.segment[i])return r.stats.segment_hits++,r.segment[i];let s=[];if(ur.exec(e)){s=e.split(cr);let t=-1;for(var o=0;o<s.length-1;o++){if(o>0){let e=hr.exec(s[o]);e&&(s[o]=s[o].substring(e[0].length),s[o-1]+=e[0],t+=e[0].length)}t+=1+s[o].length,s[o]+=e.slice(t,t+1)}e=""}for(;e.length;){let t="",r=e,i=0;for(;i<n&&r.length;i++){let e=(fr.exec(r)||r)[0];t+=e,r=r.substring(e.length)}s.push(t),e=e.substring(t.length)}return t&&s.reverse(),r.stats.segment_misses++,r.segment[i]=s,s}class yr{constructor(e,t=1/0,r=1/0){this.width=0,this.height=0,this.lines=[],this.max_lines=t,this.text_wrap=r,this.context=e}createLine(e){return this.lines.length<this.max_lines&&new vr(e,this.text_wrap)}push(e){if(this.lines.length<this.max_lines){let t=this.context.measureText(e.text).width;return e.width=t,t>this.width&&(this.width=Math.ceil(t)),this.lines.push(e),this.height+=e.height,!0}return this.addEllipsis(),!1}advance(e,t){return!!this.push(e)&&this.createLine(t)}addEllipsis(){let e=this.lines[this.lines.length-1],t=Math.ceil(this.context.measureText(yr.ellipsis).width);e.append(yr.ellipsis),e.width+=t,e.width>this.width&&(this.width=e.width)}finish(e){e?this.push(e):this.addEllipsis()}static parse(e,t,r,n,i){let s;s="number"==typeof t?e.split(" "):[e];let o=new yr(i,r,t),a=o.createLine(n);for(let e=0;e<s.length;e++){let r=s[e].split("\n"),i=0===e;for(let s=0;s<r.length&&a;s++){let l=r[s];sr(l)&&lr(l[l.length-1])&&(l+="");let u=i?l:" "+l;if(t&&e>0&&a.exceedsTextwrap(u)){if(a=o.advance(a,n),!a)break;a.append(l),i=!0}else a.append(u);s<r.length-1&&(a=o.advance(a,n),i=!0)}e===s.length-1&&o.finish(a)}return o}}yr.ellipsis="...";class vr{constructor(e=0,t=0){this.chars=0,this.text="",this.height=Math.ceil(e),this.text_wrap=t}append(e){this.chars+=e.length,this.text+=e}exceedsTextwrap(e){return e.length+this.chars>this.text_wrap}}function br(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function xr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?br(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):br(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}class wr{constructor(){this.createCanvas(),this.vertical_text_buffer=8,this.horizontal_text_buffer=4,this.background_size=4}createCanvas(){this.canvas=document.createElement("canvas"),this.canvas.style.backgroundColor="transparent",this.context=this.canvas.getContext("2d")}resize(e,t){this.canvas.width=e,this.canvas.height=t,this.context.clearRect(0,0,e,t)}setFont({font_css:e,fill:t,stroke:r,stroke_width:n,px_size:i,supersample:s}){this.px_size=i;let o=this.context,a=g.device_pixel_ratio*s;r&&n>0&&(o.strokeStyle=r,o.lineWidth=n*a),o.fillStyle=t,o.font=e,o.miterLimit=2}async textSizes(e,t){return await nr.loadFonts(),E.add({type:"textSizes",run:this.processTextSizesTask.bind(this),texts:t,tile_id:e,cursor:{styles:Object.keys(t),texts:null,style_idx:null,text_idx:null}})}processTextSizesTask(e){let{cursor:t,texts:r}=e;for(t.style_idx=t.style_idx||0;t.style_idx<t.styles.length;){let i=t.styles[t.style_idx];null==t.text_idx&&(t.text_idx=0,t.texts=Object.keys(r[i]));let s=r[i],o=!0;for(;t.text_idx<t.texts.length;){let r=t.texts[t.text_idx],a=s[r],l=a.text_settings;if(o&&(this.setFont(l),o=!1),a.size=this.textSize(i,r,l).size,l.can_articulate){let e=!1,t=!1;if(sr(r)&&(lr(r)?e=!0:t=!0),a.isRTL=e,a.no_curving=t||(n=r,_r.test(n)),a.vertical_buffer=this.vertical_text_buffer,a.segment_sizes=[],!a.no_curving){let t=gr(r,e,wr.cache);a.segments=t;for(let e=0;e<t.length;e++)a.segment_sizes.push(this.textSize(i,t[e],l).size)}}if(t.text_idx++,!E.shouldContinue(e))return!1}t.text_idx=null,t.style_idx++}var n;return E.finish(e,r),!0}textSize(e,t,{transform:r,text_wrap:n,max_lines:i,stroke_width:s=0,background_color:o,background_stroke_width:a=0,background_width:l,underline_width:u=0,supersample:c}){if(wr.cache.text[e]=wr.cache.text[e]||{},wr.cache.text[e][t])return wr.cache.stats.text_hits++,wr.cache.text[e][t];wr.cache.stats.text_misses++,wr.cache.text_count++;const h=g.device_pixel_ratio*c,d=this.applyTextTransform(t,r),f=this.context,p=this.vertical_text_buffer*h,m=(s+this.horizontal_text_buffer)*h;l=null!=l?l:this.background_size;const _=o||a?(l+a)*h:0,y=(2+u+(u?s+1:0))*h,v=this.px_size+y;let{width:b,height:x,lines:w}=yr.parse(d,n,i,v,f);b+=2*_,x+=2*_;let A=[b/h,x/h],E=[b+2*m,x+2*p],T=[E[0]/h,E[1]/h];return wr.cache.text[e][t]={lines:w,size:{collision_size:A,texture_size:E,logical_size:T,horizontal_buffer:m,vertical_buffer:p,dpr:h,line_height:v,background_size:_}},wr.cache.text[e][t]}drawTextMultiLine(e,[t,r],n,i,s){const{dpr:o,collision_size:a,texture_size:l,line_height:u,horizontal_buffer:c,vertical_buffer:h}=n;if(i.background_color||i.background_stroke_color){const e=i.background_stroke_color,n=(i.background_stroke_width||0)*o;this.context.save(),i.background_color&&(this.context.fillStyle=i.background_color,this.context.fillRect(t+c+("curved"===s?l[0]:0)+n,r+h+n,o*a[0]-2*n,o*a[1]-2*n)),e&&n&&(this.context.strokeStyle=e,this.context.lineWidth=n,this.context.strokeRect(t+c+("curved"===s?l[0]:0)+.5*n,r+h+.5*n,o*a[0]-n,o*a[1]-n)),this.context.restore()}const d=i.underline_width||0,f=i.stroke_width||0;let p=r-(d?.5*(d+f+1)*o:0);for(let r=0;r<e.length;r++){let o=e[r];this.drawTextLine(o,[t,p],n,i,s),p+=u}this.drawTextDebug([t,r],n,s)}drawTextLine(e,[t,r],n,i,s){const{stroke:o,stroke_width:a,transform:l,align:u="center"}=i,{horizontal_buffer:c,vertical_buffer:h,texture_size:d,background_size:f,line_height:p,dpr:m}=n,_=(i.underline_width||0)*m,g=this.applyTextTransform(e.text,l);let y;"left"===u?y=t+c+f:"center"===u?y=t+d[0]/2-e.width/2:"right"===u&&(y=t+d[0]-e.width-c-f);const v=r+.75*h+p+f-.5*_,b=o&&a>0&&"curved"===s?d[0]:0;if(_){this.context.save(),this.context.strokeStyle=this.context.fillStyle,this.context.lineWidth=_;const t=v+(.5*a+2)*m+.5*this.context.lineWidth;this.context.beginPath(),this.context.moveTo(y+b,t),this.context.lineTo(y+b+e.width,t),this.context.stroke(),this.context.restore()}o&&a>0&&this.context.strokeText(g,y+b,v),this.context.fillText(g,y,v)}drawTextDebug([e,t],r,n){const{dpr:i,horizontal_buffer:s,vertical_buffer:o,texture_size:a,collision_size:l}=r;v.draw_label_collision_boxes&&(this.context.save(),this.context.strokeStyle="blue",this.context.lineWidth=2,this.context.strokeRect(e+s,t+o,i*l[0],i*l[1]),"curved"===n&&this.context.strokeRect(e+a[0]+s,t+o,i*l[0],i*l[1]),this.context.restore()),v.draw_label_texture_boxes&&(this.context.save(),this.context.strokeStyle="green",this.context.lineWidth=2,this.context.strokeRect(e+2,t+2,a[0]-4,a[1]-4),"curved"===n&&this.context.strokeRect(e+2+a[0],t+2,a[0]-4,a[1]-4),this.context.restore())}rasterize(e,t,r,n,i){return E.add({type:"rasterizeLabels",run:this.processRasterizeTask.bind(this),cancel:this.cancelRasterizeTask.bind(this),pause_factor:2,user_moving_view:!1,texts:e,textures:t,texture_prefix:n,gl:i,tile_id:r,cursor:{styles:Object.keys(e),texts:null,style_idx:0,text_idx:null,texture_idx:0,texture_resize:!0,texture_names:[]}})}processRasterizeTask(e){let t,{cursor:r,texts:n,textures:i}=e;for(;r.texture_idx<e.textures.length;){for(t=i[r.texture_idx],r.texture_resize&&(r.texture_resize=!1,this.resize(...t.texture_size));r.style_idx<r.styles.length;){let i=r.styles[r.style_idx];null==r.text_idx&&(r.text_idx=0,r.texts=Object.keys(n[i]));let s=n[i],o=!0;for(;r.text_idx<r.texts.length;){let n=r.texts[r.text_idx],a=s[n],l=a.text_settings;if(o&&(this.setFont(l),o=!1),l.can_articulate){a.texcoords=a.texcoords||{};for(let e=0;e<a.type.length;e++){let s=a.type[e];if("straight"===s){if(a.textures[e]!==r.texture_idx)continue;let o,u=a.isRTL?n.split().reverse().join():n,c=t.texcoord_cache[i][u];if(c.texcoord)o=c.texcoord;else{let e=c.texture_position,{size:r,lines:n}=this.textSize(i,u,l);this.drawTextMultiLine(n,e,r,l,s),o=k.getTexcoordsForSprite(e,r.texture_size,t.texture_size),c.texcoord=o}a.texcoords[s]={texcoord:o,texture_id:c.texture_id}}else if("curved"===s){let n=a.segments;a.texcoords.curved=a.texcoords.curved||[],a.texcoords_stroke=a.texcoords_stroke||[];for(let o=0;o<n.length;o++){if(a.textures[e][o]!==r.texture_idx)continue;let u,c,h=n[o],d=t.texcoord_cache[i][h];if(d.texcoord)u=d.texcoord,c=d.texcoord_stroke,a.texcoords_stroke.push(c);else{let e=d.texture_position,{size:r,lines:n}=this.textSize(i,h,l);this.drawTextMultiLine(n,e,r,l,s),u=k.getTexcoordsForSprite(e,r.texture_size,t.texture_size);let o=[e[0]+r.texture_size[0],e[1]];c=k.getTexcoordsForSprite(o,r.texture_size,t.texture_size),d.texcoord=u,d.texcoord_stroke=c,a.texcoords_stroke.push(c)}a.texcoords.curved.push({texcoord:u,texture_id:d.texture_id})}}}}else{let e=this.textSize(i,n,l).lines;const s=xr({},l);for(let n in a.align)a.align[n].texture_id===r.texture_idx&&(s.align=n,this.drawTextMultiLine(e,a.align[n].texture_position,a.size,s),a.align[n].texcoords=k.getTexcoordsForSprite(a.align[n].texture_position,a.size.texture_size,t.texture_size))}if(r.text_idx++,!E.shouldContinue(e))return!1}r.text_idx=null,r.style_idx++}let s=e.texture_prefix+r.texture_idx;k.create(e.gl,s,{element:this.canvas,filtering:"linear",UNPACK_PREMULTIPLY_ALPHA_WEBGL:!0}),k.retain(s),r.texture_names.push(s),r.texture_idx++,r.texture_resize=!0,r.style_idx=0}return E.finish(e,r.texture_names),!0}cancelRasterizeTask(e){_("trace",`RasterizeTask: release textures [${e.cursor.texture_names.join(", ")}]`),e.cursor.texture_names.forEach(e=>k.release(e))}setTextureTextPositions(e,t){let r={cx:0,cy:0,width:0,height:0,column_width:0,texture_id:0,texcoord_cache:{}},n=[];for(let i in e){let s=e[i];for(let e in s){let o,a=s[e];if(a.text_settings.can_articulate){a.textures=[],r.texcoord_cache[i]=r.texcoord_cache[i]||{};for(let s=0;s<a.type.length;s++){let l=a.type[s];if("straight"===l){let l=a.isRTL?e.split().reverse().join():e;if(!r.texcoord_cache[i][l]){let e=a.size.texture_size;o=this.placeText(e[0],e[1],i,r,n,t),r.texcoord_cache[i][l]={texture_id:r.texture_id,texture_position:o}}a.textures[s]=r.texture_id}else if("curved"===l){a.textures[s]=[];for(let e=0;e<a.segment_sizes.length;e++){let l=a.segments[e];if(!r.texcoord_cache[i][l]){let s=a.segment_sizes[e].texture_size,u=2*s[0];o=this.placeText(u,s[1],i,r,n,t),r.texcoord_cache[i][l]={texture_id:r.texture_id,texture_position:o}}a.textures[s].push(r.texture_id)}}}}else{let e=a.size.texture_size;for(let s in a.align)o=this.placeText(e[0],e[1],i,r,n,t),a.align[s].texture_id=r.texture_id,a.align[s].texture_position=o}}}return r.column_width>0&&r.height>0&&(n[r.texture_id]={texture_size:[r.width,r.height],texcoord_cache:r.texcoord_cache}),n}placeText(e,t,r,n,i,s){let o;return n.cy+t>s?(n.cx+=n.column_width,n.cy=0,n.column_width=e):n.column_width=Math.max(n.column_width,e),n.cx+n.column_width<=s?(o=[n.cx,n.cy],n.cy+=t,n.height=Math.max(n.height,n.cy),n.width=Math.max(n.width,n.cx+n.column_width)):(i[n.texture_id]={texture_size:[n.width,n.height],texcoord_cache:n.texcoord_cache},n.texcoord_cache={},n.texcoord_cache[r]={},n.texture_id++,n.cx=0,n.cy=t,n.column_width=e,n.width=e,n.height=t,o=[0,0]),o}applyTextTransform(e,t){return"capitalize"===t?e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1)}):"uppercase"===t?e.toUpperCase():"lowercase"===t?e.toLowerCase():e}static fontPixelSize(e){if(null==e)return;e="string"==typeof e?e:String(e);let[,t,r]=e.match(wr.font_size_re)||[];return r=r||"px","em"===r?t*=16:"pt"===r?t/=.75:"%"===r&&(t/=6.25),t=J.parsePositiveNumber(t),t*=g.device_pixel_ratio,t}static pruneTextCache(){wr.cache.text_count>wr.cache.text_count_max&&(wr.cache.text={},wr.cache.text_count=0,_("debug","TextCanvas: pruning text cache")),Object.keys(wr.cache.segment).length>wr.cache.segment_count_max&&(wr.cache.segment={},_("debug","TextCanvas: pruning segment cache"))}}function Ar(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}wr.font_size_re=/((?:[0-9]*\.)?[0-9]+)\s*(px|pt|em|%)?/,wr.cache={text:{},text_count:0,text_count_max:2e3,segment:{},segment_count_max:2e3,stats:{text_hits:0,text_misses:0,segment_hits:0,segment_misses:0}};let Er=0;const Tr={resetText(){t.is_main?this.canvas=new wr:t.is_worker&&(this.texts={})},freeText(e){delete this.texts[e.id]},parseTextFeature(e,t,r,n){let i=this.parseTextSource(e,t,r);if(null==i||""===i)return;let s=Qt.compute(t,r),o=Qt.key(s);this.texts[n.id]=this.texts[n.id]||{};let a=this.texts[n.id][o]=this.texts[n.id][o]||{};if(i instanceof Object){let l=[],u=i.left+"-"+i.right;for(let c in i){let h=i[c];if(!h)continue;let d=this.computeTextLayout({},e,t,r,n,h,s,u,c);a[h]||(a[h]={text_settings:s,ref:0}),l.push({draw:t,text:h,text_settings_key:o,layout:d})}return l.length>0&&l}{let l=this.computeTextLayout({},e,t,r,n,i,s);return a[i]||(a[i]={text_settings:s,ref:0}),{draw:t,text:i,text_settings_key:o,layout:l}}},parseTextSource(e,t,r){let n,i=t.text_source||"name";if(null==i||Array.isArray(i)||"object"!=typeof i)n=this.parseTextSourceValue(i,e,r);else{n={};for(let t in i)n[t]=this.parseTextSourceValue(i[t],e,r)}return n},parseTextSourceValue(e,t,r){let n;if(Array.isArray(e)){for(let i=0;i<e.length;i++)if("string"==typeof e[i]?n=t.properties[e[i]]:"function"==typeof e[i]&&(n=e[i](r)),n)return n}else"string"==typeof e?n=t.properties[e]:e instanceof Function&&(n=e(r));return n},async prepareTextLabels(e,t){if(0===Object.keys(this.texts[e.id]||{}).length)return[];try{const r=await a.postMessage(this.main_thread_target+".calcTextSizes",e.id,this.texts[e.id]);return e.canceled?(_("trace",`Style ${this.name}: stop tile build because tile was canceled: ${e.key}, post-calcTextSizes()`),[]):(this.texts[e.id]=r||[],r?this.buildTextLabels(e,t):($t.abortTile(e.id),[]))}catch(t){return $t.abortTile(e.id),[]}},async collideAndRenderTextLabels(e,t,r){let n=await this.prepareTextLabels(e,r);if(0===n.length)return $t.collide([],t,e.id),{};if(n=await $t.collide(n,t,e.id),e.canceled)return _("trace",`stop tile build because tile was canceled: ${e.key}, post-collide()`),{};let s=this.texts[e.id];if(null==s||0===n.length)return{};this.cullTextStyles(s,n),n.forEach(e=>{let t=e.text_settings_key,r=s[t]&&s[t][e.text];r.text_settings.can_articulate?(r.type||(r.type=[]),-1===r.type.indexOf(e.label.type)&&r.type.push(e.label.type)):(r.align=r.align||{},r.align[e.label.align]={})});try{const t=await a.postMessage(this.main_thread_target+".rasterizeTexts",e.id,e.key,s);return e.canceled?(_("trace",`stop tile build because tile was canceled: ${e.key}, post-rasterizeTexts()`),{}):function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ar(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ar(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({labels:n},t)}catch(e){return{}}},cullTextStyles(e,t){for(let r=0;r<t.length;r++){let n=t[r];e[n.text_settings_key][n.text].ref++}for(let t in e)for(let r in e[t])e[t][r].ref<1&&delete e[t][r];for(let t in e)0===Object.keys(e[t]).length&&delete e[t]},calcTextSizes(e,t){return this.canvas.textSizes(e,t)},async rasterizeTexts(e,t,r){let n=new wr,i=Math.min(this.max_texture_size,2048),s=n.setTextureTextPositions(r,i),o=["labels",this.name,t,e,Er,""].join("-");return Er++,s=await n.rasterize(r,s,e,o,this.gl),s?{texts:r,textures:s}:{}},preprocessText(e){if(e&&e.font&&"object"==typeof e.font)return e.font.weight=J.createPropertyCache(e.font.weight),e.font.fill=J.createPropertyCache(e.font.fill||Qt.defaults.fill),e.font.alpha=J.createPropertyCache(e.font.alpha),e.font.stroke&&(e.font.stroke.color=J.createPropertyCache(e.font.stroke.color),e.font.stroke.alpha=J.createPropertyCache(e.font.stroke.alpha)),e.font.background&&(e.font.background.color=J.createPropertyCache(e.font.background.color),e.font.background.alpha=J.createPropertyCache(e.font.background.alpha),e.font.background.width=J.createPropertyCache(e.font.background.width,J.parsePositiveNumber),e.font.background.stroke&&(e.font.background.stroke.color=J.createPropertyCache(e.font.background.stroke.color),e.font.background.stroke.alpha=J.createPropertyCache(e.font.background.stroke.alpha))),e.font.px_size=J.createPropertyCache(e.font.size||Qt.defaults.size,wr.fontPixelSize,wr.fontPixelSize),e.font.stroke&&null!=e.font.stroke.width&&(e.font.stroke.width=J.createPropertyCache(e.font.stroke.width,J.parsePositiveNumber)),e.font.background&&e.font.background.stroke&&null!=e.font.background.stroke.width&&(e.font.background.stroke.width=J.createPropertyCache(e.font.background.stroke.width,J.parsePositiveNumber)),e.offset=J.createPropertyCache(e.offset,e=>Array.isArray(e)&&e.map(J.parseNumber)),e.buffer=J.createPropertyCache(e.buffer,e=>(Array.isArray(e)?e:[e,e]).map(J.parsePositiveNumber)),e.repeat_distance=J.createPropertyCache(e.repeat_distance,J.parsePositiveNumber),e},computeTextLayout(e,t,r,n,i,s,o,a,l){let u=e||{};return u=this.computeLayout(u,t,r,n,i),null==r.repeat_distance&&(u.repeat_distance="point"===n.geometry?0:G.tile_size,u.repeat_distance&&(u.repeat_distance*=u.units_per_pixel,u.repeat_scale=1,"function"==typeof r.repeat_group?u.repeat_group=r.repeat_group(n):u.repeat_group=r.repeat_group)),u.repeat_distance&&(a&&(u.repeat_group+="/"+a),u.repeat_group+="/"+s),u.subdiv=i.overzoom2,u.align=r.align,u.italic="normal"!==o.style,"right"===l?u.orientation=1:"left"===l&&(u.orientation=-1),u}};var Sr,kr,Or,Rr,Cr,Nr,Pr,Mr,Dr,zr,Ir,Fr,Lr,jr,Ur,Br,Vr=P(kr?Sr:(kr=1,Sr=function(e,t){var r=t[0],n=t[1],i=t[2],s=t[3],o=t[4],a=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],f=t[11],p=t[12],m=t[13],_=t[14],g=t[15],y=r*a-n*o,v=r*l-i*o,b=r*u-s*o,x=n*l-i*a,w=n*u-s*a,A=i*u-s*l,E=c*m-h*p,T=c*_-d*p,S=c*g-f*p,k=h*_-d*m,O=h*g-f*m,R=d*g-f*_,C=y*R-v*O+b*k+x*S-w*T+A*E;return C?(C=1/C,e[0]=(a*R-l*O+u*k)*C,e[1]=(l*S-o*R-u*T)*C,e[2]=(o*O-a*S+u*E)*C,e[3]=(i*O-n*R-s*k)*C,e[4]=(r*R-i*S+s*T)*C,e[5]=(n*S-r*O-s*E)*C,e[6]=(m*A-_*w+g*x)*C,e[7]=(_*b-p*A-g*v)*C,e[8]=(p*w-m*b+g*y)*C,e):null})),Gr=P(Rr?Or:(Rr=1,Or=function(e,t){var r=t[0],n=t[1],i=t[2],s=t[3],o=t[4],a=t[5],l=t[6],u=t[7],c=t[8],h=c*o-a*u,d=-c*s+a*l,f=u*s-o*l,p=r*h+n*d+i*f;return p?(p=1/p,e[0]=h*p,e[1]=(-c*n+i*u)*p,e[2]=(a*n-i*o)*p,e[3]=d*p,e[4]=(c*r-i*l)*p,e[5]=(-a*r+i*s)*p,e[6]=f*p,e[7]=(-u*r+n*l)*p,e[8]=(o*r-n*s)*p,e):null})),$r=P(Nr?Cr:(Nr=1,Cr=function(e,t,r){var n=t[0],i=t[1],s=t[2],o=t[3],a=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=t[9],f=t[10],p=t[11],m=t[12],_=t[13],g=t[14],y=t[15],v=r[0],b=r[1],x=r[2],w=r[3];return e[0]=v*n+b*a+x*h+w*m,e[1]=v*i+b*l+x*d+w*_,e[2]=v*s+b*u+x*f+w*g,e[3]=v*o+b*c+x*p+w*y,v=r[4],b=r[5],x=r[6],w=r[7],e[4]=v*n+b*a+x*h+w*m,e[5]=v*i+b*l+x*d+w*_,e[6]=v*s+b*u+x*f+w*g,e[7]=v*o+b*c+x*p+w*y,v=r[8],b=r[9],x=r[10],w=r[11],e[8]=v*n+b*a+x*h+w*m,e[9]=v*i+b*l+x*d+w*_,e[10]=v*s+b*u+x*f+w*g,e[11]=v*o+b*c+x*p+w*y,v=r[12],b=r[13],x=r[14],w=r[15],e[12]=v*n+b*a+x*h+w*m,e[13]=v*i+b*l+x*d+w*_,e[14]=v*s+b*u+x*f+w*g,e[15]=v*o+b*c+x*p+w*y,e})),qr=P(Mr?Pr:(Mr=1,Pr=function(e,t,r){var n,i,s,o,a,l,u,c,h,d,f,p,m=r[0],_=r[1],g=r[2];return t===e?(e[12]=t[0]*m+t[4]*_+t[8]*g+t[12],e[13]=t[1]*m+t[5]*_+t[9]*g+t[13],e[14]=t[2]*m+t[6]*_+t[10]*g+t[14],e[15]=t[3]*m+t[7]*_+t[11]*g+t[15]):(n=t[0],i=t[1],s=t[2],o=t[3],a=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=t[9],f=t[10],p=t[11],e[0]=n,e[1]=i,e[2]=s,e[3]=o,e[4]=a,e[5]=l,e[6]=u,e[7]=c,e[8]=h,e[9]=d,e[10]=f,e[11]=p,e[12]=n*m+a*_+h*g+t[12],e[13]=i*m+l*_+d*g+t[13],e[14]=s*m+u*_+f*g+t[14],e[15]=o*m+c*_+p*g+t[15]),e})),Wr=P(zr?Dr:(zr=1,Dr=function(e,t,r){var n=r[0],i=r[1],s=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*s,e[9]=t[9]*s,e[10]=t[10]*s,e[11]=t[11]*s,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e})),Hr=P(Fr?Ir:(Fr=1,Ir=function(e,t,r,n,i){var s=1/Math.tan(t/2),o=1/(n-i);return e[0]=s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=(i+n)*o,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*i*n*o,e[15]=0,e}));function Zr(){return jr?Lr:(jr=1,Lr=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e})}var Kr,Xr,Yr=function(){if(Br)return Ur;Br=1;var e=Zr();return Ur=function(t,r,n,i){var s,o,a,l,u,c,h,d,f,p,m=r[0],_=r[1],g=r[2],y=i[0],v=i[1],b=i[2],x=n[0],w=n[1],A=n[2];return Math.abs(m-x)<1e-6&&Math.abs(_-w)<1e-6&&Math.abs(g-A)<1e-6?e(t):(h=m-x,d=_-w,f=g-A,s=v*(f*=p=1/Math.sqrt(h*h+d*d+f*f))-b*(d*=p),o=b*(h*=p)-y*f,a=y*d-v*h,(p=Math.sqrt(s*s+o*o+a*a))?(s*=p=1/p,o*=p,a*=p):(s=0,o=0,a=0),l=d*a-f*o,u=f*s-h*a,c=h*o-d*s,(p=Math.sqrt(l*l+u*u+c*c))?(l*=p=1/p,u*=p,c*=p):(l=0,u=0,c=0),t[0]=s,t[1]=l,t[2]=h,t[3]=0,t[4]=o,t[5]=u,t[6]=d,t[7]=0,t[8]=a,t[9]=c,t[10]=f,t[11]=0,t[12]=-(s*m+o*_+a*g),t[13]=-(l*m+u*_+c*g),t[14]=-(h*m+d*_+f*g),t[15]=1,t)}}(),Qr=P(Yr),Jr=P(Zr()),en=P(Xr?Kr:(Xr=1,Kr=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}));const tn={fromValues(e,t,r){var n=new Float64Array(3);return n[0]=e,n[1]=t,n[2]=r,n}},rn={normalFromMat4:Vr,invert:Gr},nn={multiply:$r,translate:qr,scale:Wr,perspective:Hr,lookAt:Qr,identity:Jr,copy:en};class sn{constructor(e,t,r={}){this.view=t,this.position=r.position,this.zoom=r.zoom}static create(e,t,r){switch(r.type){case"isometric":return new an(e,t,r);case"flat":return new ln(e,t,r);default:return new on(e,t,r)}}update(){}setupProgram(){}updateView(){if(this.position||this.zoom){var e={};this.position&&(e={lng:this.position[0],lat:this.position[1],zoom:this.position[2]}),this.zoom&&(e.zoom=this.zoom),this.view.setView(e)}}setupMatrices(e,t){nn.multiply(e.model_view32,this.view_matrix,e.model),t.uniform("Matrix4fv","u_modelView",e.model_view32),rn.normalFromMat4(e.normal32,e.model_view32),rn.invert(e.inverse_normal32,e.normal32),t.uniform("Matrix3fv","u_normalMatrix",e.normal32),t.uniform("Matrix3fv","u_inverseNormalMatrix",e.inverse_normal32)}}class on extends sn{constructor(e,t,r={}){super(e,t,r),this.type="perspective",this.focal_length=r.focal_length,this.fov=r.fov,this.focal_length||this.fov||(this.focal_length=[[16,2],[17,2.5],[18,3],[19,4],[20,6]]),this.vanishing_point=r.vanishing_point||[0,0],this.vanishing_point=this.vanishing_point.map(parseFloat),this.vanishing_point_skew=[],this.position_meters=null,this.view_matrix=new Float64Array(16),this.projection_matrix=new Float32Array(16),j.replaceBlock("camera","\n uniform mat4 u_projection;\n uniform vec3 u_eye;\n uniform vec2 u_vanishing_point;\n\n void cameraProjection (inout vec4 position) {\n position = u_projection * position;\n }")}constrainCamera({view_height:e,height:t,focal_length:r,fov:n}){return t?(r=2*t/e,n=2*Math.atan(1/r)):(r?n=2*Math.atan(1/r):n&&(n=n*Math.PI/180,r=1/Math.tan(n/2)),t=e/2*r),{view_height:e,height:t,focal_length:r,fov:n}}updateMatrices(){var e=this.view.size.css.height*this.view.meters_per_pixel,{height:t,fov:r}=this.constrainCamera({view_height:e,focal_length:g.interpolate(this.view.zoom,this.focal_length),fov:g.interpolate(this.view.zoom,this.fov)}),n=[this.view.center.meters.x,this.view.center.meters.y,t];this.position_meters=n,nn.lookAt(this.view_matrix,tn.fromValues(n[0],n[1],0),tn.fromValues(n[0],n[1],-1),tn.fromValues(0,1,0)),nn.perspective(this.projection_matrix,r,this.view.aspect,1,2*t),this.vanishing_point_skew[0]=this.vanishing_point[0]/this.view.size.css.width,this.vanishing_point_skew[1]=this.vanishing_point[1]/this.view.size.css.height,this.projection_matrix[8]=2*-this.vanishing_point_skew[0],this.projection_matrix[9]=2*-this.vanishing_point_skew[1],nn.translate(this.projection_matrix,this.projection_matrix,tn.fromValues(e/2*this.view.aspect*(2*-this.vanishing_point_skew[0]),e/2*(2*-this.vanishing_point_skew[1]),0)),nn.translate(this.projection_matrix,this.projection_matrix,tn.fromValues(0,0,-t))}update(){super.update(),this.updateMatrices()}setupProgram(e){e.uniform("Matrix4fv","u_projection",this.projection_matrix),e.uniform("3f","u_eye",[0,0,this.position_meters[2]]),e.uniform("2fv","u_vanishing_point",this.vanishing_point_skew)}}class an extends sn{constructor(e,t,r={}){super(e,t,r),this.type="isometric",this.axis=r.axis||{x:0,y:1},2===this.axis.length&&(this.axis={x:this.axis[0],y:this.axis[1]}),this.position_meters=null,this.viewport_height=null,this.view_matrix=new Float64Array(16),this.projection_matrix=new Float32Array(16),j.replaceBlock("camera","\n uniform mat4 u_projection;\n uniform vec3 u_eye;\n uniform vec2 u_vanishing_point;\n\n void cameraProjection (inout vec4 position) {\n position = u_projection * position;\n // position.xy += position.z * u_isometric_axis;\n\n // Reverse z for depth buffer so up is negative,\n // and scale down values so objects higher than one screen height will not get clipped\n // pull forward slightly to avoid going past far clipping plane\n position.z = -position.z / 100. + 1. - 0.001;\n }")}update(){super.update(),this.viewport_height=this.view.size.css.height*this.view.meters_per_pixel;var e=[this.view.center.meters.x,this.view.center.meters.y,this.viewport_height];this.position_meters=e,nn.identity(this.view_matrix),nn.translate(this.view_matrix,this.view_matrix,tn.fromValues(-e[0],-e[1],0)),nn.identity(this.projection_matrix),this.projection_matrix[8]=this.axis.x/this.view.aspect,this.projection_matrix[9]=this.axis.y,nn.scale(this.projection_matrix,this.projection_matrix,tn.fromValues(2/this.view.size.meters.x,2/this.view.size.meters.y,2/this.view.size.meters.y))}setupProgram(e){e.uniform("Matrix4fv","u_projection",this.projection_matrix),e.uniform("3fv","u_eye",[0,0,this.viewport_height]),e.uniform("2fv","u_vanishing_point",[0,0])}}class ln extends an{constructor(e,t,r={}){super(e,t,r),this.type="flat"}update(){this.axis.x=0,this.axis.y=0,super.update()}}const un=qt.PLACEMENT,cn=Object.create(Ne),hn="__shader_point";Object.assign(cn,Tr),Object.assign(cn,{name:"points",built_in:!0,vertex_shader_src:"uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_tile_proxy_order_offset;\nuniform bool u_tile_fade_in;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\nuniform bool u_view_panning;\nuniform float u_view_pan_snap_timer;\n\nuniform mat4 u_model;\nuniform mat4 u_modelView;\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nattribute vec4 a_position;\nattribute vec4 a_shape;\nattribute vec4 a_color;\nattribute vec2 a_texcoord;\nattribute vec2 a_offset;\n\nuniform float u_point_type;\n\n#ifdef TANGRAM_CURVED_LABEL\n attribute vec4 a_offsets;\n attribute vec4 a_pre_angles;\n attribute vec4 a_angles;\n#endif\n\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying vec4 v_world_position;\nvarying float v_alpha_factor;\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n attribute float a_outline_edge;\n attribute vec4 a_outline_color;\n\n varying float v_outline_edge;\n varying vec4 v_outline_color;\n varying float v_aa_offset;\n#endif\n\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\n varying float v_label_hidden;\n#endif\n\n#define TANGRAM_PI 3.14159265359\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvec2 rotate2D(vec2 _st, float _angle) {\n return mat2(cos(_angle),-sin(_angle),\n sin(_angle),cos(_angle)) * _st;\n}\n\n#ifdef TANGRAM_CURVED_LABEL\n // Assumes stops are [0, 0.33, 0.66, 0.99];\n float mix4linear(vec4 v, float x) {\n x = clamp(x, 0., 1.);\n return mix(mix(v[0], v[1], 3. * x),\n mix(v[1],\n mix(v[2], v[3], 3. * (max(x, .66) - .66)),\n 3. * (clamp(x, .33, .66) - .33)),\n step(0.33, x)\n );\n }\n#endif\n\nvoid main() {\n // Initialize globals\n #pragma tangram: setup\n\n // discard hidden labels by collapsing into degenerate triangle\n #ifndef TANGRAM_SHOW_HIDDEN_LABELS\n if (a_shape.w == 0.) {\n gl_Position = vec4(0., 0., 0., 1.);\n return;\n }\n #else\n // highlight hidden label in fragment shader for debugging\n if (a_shape.w == 0.) {\n v_label_hidden = 1.; // label debug testing\n }\n else {\n v_label_hidden = 0.;\n }\n #endif\n\n v_alpha_factor = 1.0;\n v_color = a_color;\n v_texcoord = a_texcoord; // UV from vertex attribute\n\n #ifdef TANGRAM_HAS_SHADER_POINTS\n v_outline_color = a_outline_color;\n v_outline_edge = a_outline_edge;\n\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // use point dimensions for UVs instead (ignore attribute), add antialiasing info for fragment shader\n float _size = abs(a_shape.x / 128.); // radius in pixels\n v_texcoord = sign(a_shape.xy) * (_size + 1.) / _size;\n _size += 2.;\n v_aa_offset = 2. / _size;\n }\n #endif\n\n // Position\n vec4 position = u_modelView * vec4(a_position.xyz, 1.);\n\n // Apply positioning and scaling in screen space\n vec2 _shape = a_shape.xy / 256.; // values have an 8-bit fraction\n vec2 _offset = vec2(a_offset.x, -a_offset.y); // flip y to make it point down\n float _theta = a_shape.z / 4096.;\n\n #ifdef TANGRAM_CURVED_LABEL\n //TODO: potential bug? null is passed in for non-curved labels, otherwise the first offset will be 0\n if (a_offsets[0] != 0.){\n vec4 _angles_scaled = (TANGRAM_PI / 16384.) * a_angles;\n vec4 _pre_angles_scaled = (TANGRAM_PI / 128.) * a_pre_angles;\n vec4 _offsets_scaled = (1. / 64.) * a_offsets;\n\n float _zoom = clamp(u_map_position.z - u_tile_origin.z, 0., 1.); //fract(u_map_position.z);\n float _pre_angle = mix4linear(_pre_angles_scaled, _zoom);\n float _angle = mix4linear(_angles_scaled, _zoom);\n float _offset_curve = mix4linear(_offsets_scaled, _zoom);\n\n _shape = rotate2D(_shape, _pre_angle); // rotate in place\n _shape.x += _offset_curve; // offset for curved label segment\n _shape = rotate2D(_shape, _angle); // rotate relative to curved label anchor\n _shape += rotate2D(_offset, _theta); // offset if specified in the scene file\n }\n else {\n _shape = rotate2D(_shape + _offset, _theta);\n }\n #else\n _shape = rotate2D(_shape + _offset, _theta);\n #endif\n\n // Fade in (if requested) based on time mesh has been visible.\n // Value passed to fragment shader in the v_alpha_factor varying\n #ifdef TANGRAM_FADE_IN_RATE\n if (u_tile_fade_in) {\n v_alpha_factor *= clamp(u_visible_time * TANGRAM_FADE_IN_RATE, 0., 1.);\n }\n #endif\n\n // World coordinates for 3d procedural textures\n v_world_position = u_model * position;\n v_world_position.xy += _shape * u_meters_per_pixel;\n v_world_position = wrapWorldPosition(v_world_position);\n\n // Modify position before camera projection\n #pragma tangram: position\n\n cameraProjection(position);\n\n #ifdef TANGRAM_LAYER_ORDER\n // +1 is to keep all layers including proxies > 0\n applyLayerOrder(a_position.w + u_tile_proxy_order_offset + 1., position);\n #endif\n\n // Apply pixel offset in screen-space\n // Multiply by 2 is because screen is 2 units wide Normalized Device Coords (and u_resolution device pixels wide)\n // Device pixel ratio adjustment is because shape is in logical pixels\n position.xy += _shape * position.w * 2. * u_device_pixel_ratio / u_resolution;\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // enlarge by 1px to catch missed MSAA fragments\n position.xy += sign(_shape) * position.w * u_device_pixel_ratio / u_resolution;\n }\n #endif\n\n // Snap to pixel grid\n // Only applied to fully upright sprites/labels (not shader-drawn points), while panning is not active\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (!u_view_panning && (abs(_theta) < TANGRAM_EPSILON) && u_point_type != TANGRAM_POINT_TYPE_SHADER) {\n #else\n if (!u_view_panning && (abs(_theta) < TANGRAM_EPSILON)) {\n #endif\n vec2 _position_fract = fract((((position.xy / position.w) + 1.) * .5) * u_resolution);\n vec2 _position_snap = position.xy + ((step(0.5, _position_fract) - _position_fract) * position.w * 2. / u_resolution);\n\n // Animate the snapping to smooth the transition and make it less noticeable\n #ifdef TANGRAM_VIEW_PAN_SNAP_RATE\n position.xy = mix(position.xy, _position_snap, clamp(u_view_pan_snap_timer * TANGRAM_VIEW_PAN_SNAP_RATE, 0., 1.));\n #else\n position.xy = _position_snap;\n #endif\n }\n\n gl_Position = position;\n}\n",fragment_shader_src:"uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nuniform sampler2D u_texture;\nuniform float u_point_type;\nuniform bool u_apply_color_blocks;\n\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying vec4 v_world_position;\nvarying float v_alpha_factor;\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n varying vec4 v_outline_color;\n varying float v_outline_edge;\n varying float v_aa_offset;\n#endif\n\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\n varying float v_label_hidden;\n#endif\n\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n //l is the distance from the center to the fragment, R is the radius of the drawn point\n float _tangram_antialias(float l, float R){\n float low = R - v_aa_offset;\n float high = R + v_aa_offset;\n return 1. - smoothstep(low, high, l);\n }\n#endif\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n\n #ifdef TANGRAM_HAS_SHADER_POINTS\n // Only apply shader blocks to point, not to attached text (N.B.: for compatibility with ES)\n if (u_point_type == TANGRAM_POINT_TYPE_TEXTURE) { // sprite texture\n color *= texture2D(u_texture, v_texcoord);\n }\n else if (u_point_type == TANGRAM_POINT_TYPE_LABEL) { // label texture\n color = texture2D(u_texture, v_texcoord);\n color.rgb /= max(color.a, 0.001); // un-multiply canvas texture\n }\n else if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // Mask of outermost circle, either outline or point boundary\n float _d = length(v_texcoord); // distance to this fragment from the point center\n float _outer_alpha = _tangram_antialias(_d, 1.);\n float _fill_alpha = _tangram_antialias(_d, 1. - (v_outline_edge * 0.5)) * color.a;\n float _stroke_alpha = (_outer_alpha - _tangram_antialias(_d, 1. - v_outline_edge)) * v_outline_color.a;\n\n // Apply alpha compositing with stroke 'over' fill.\n #ifdef TANGRAM_BLEND_ADD\n color.a = _stroke_alpha + _fill_alpha;\n color.rgb = color.rgb * _fill_alpha + v_outline_color.rgb * _stroke_alpha;\n #else // TANGRAM_BLEND_OVERLAY (and fallback for not implemented blending modes)\n color.a = _stroke_alpha + _fill_alpha * (1. - _stroke_alpha);\n color.rgb = mix(color.rgb * _fill_alpha, v_outline_color.rgb, _stroke_alpha) / max(color.a, 0.001); // avoid divide by zero\n #endif\n }\n #else\n // If shader points not supported, assume label texture\n color = texture2D(u_texture, v_texcoord);\n color.rgb /= max(color.a, 0.001); // un-multiply canvas texture\n #endif\n\n // Shader blocks for color/filter are only applied for sprites, shader points, and standalone text,\n // NOT for text attached to a point (N.B.: for compatibility with ES)\n if (u_apply_color_blocks) {\n #pragma tangram: color\n #pragma tangram: filter\n }\n\n color.a *= v_alpha_factor;\n\n // highlight hidden label in fragment shader for debugging\n #ifdef TANGRAM_SHOW_HIDDEN_LABELS\n if (v_label_hidden > 0.) {\n color.a *= 0.5;\n color.rgb = vec3(1., 0., 0.);\n }\n #endif\n\n // Use alpha test as a lower-quality substitute\n // For opaque and translucent: avoid transparent pixels writing to depth buffer, obscuring geometry underneath\n // For multiply: avoid transparent pixels multiplying geometry underneath to zero/full black\n #if defined(TANGRAM_BLEND_OPAQUE) || defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n if (color.a < TANGRAM_ALPHA_TEST) {\n discard;\n }\n #endif\n\n // Make points more visible in wireframe debug mode\n #ifdef TANGRAM_WIREFRAME\n color = vec4(vec3(0.5), 1.); // use gray outline for textured points\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) {\n color = vec4(v_color.rgb, 1.); // use original vertex color outline for shader points\n }\n #endif\n #endif\n\n gl_FragColor = color;\n}\n",selection:!0,collision:!0,blend:"overlay",init(e={}){Ne.init.call(this,e),this.setupDefines(),this.defines.TANGRAM_HAS_SHADER_POINTS=!0,this.defines.TANGRAM_POINT_TYPE_TEXTURE=1,this.defines.TANGRAM_POINT_TYPE_LABEL=2,this.defines.TANGRAM_POINT_TYPE_SHADER=3,this.collision_group_points=this.name+"-points",this.collision_group_text=this.name+"-text",this.stencil_proxy_tiles=!1,this.reset()},setupDefines(){"overlay"!==this.blend&&(this.defines.TANGRAM_LAYER_ORDER=!0),!0===v.suppress_label_fade_in?(this.fade_in_time=0,this.defines.TANGRAM_FADE_IN_RATE=null):(this.fade_in_time=.15,this.defines.TANGRAM_FADE_IN_RATE=1/this.fade_in_time),!0!==v.suppress_label_snap_animation&&(this.defines.TANGRAM_VIEW_PAN_SNAP_RATE=2),!0===v.show_hidden_labels&&(this.defines.TANGRAM_SHOW_HIDDEN_LABELS=!0),!0===v.wireframe&&(this.defines.TANGRAM_WIREFRAME=!0)},reset(){this.queues={},this.resetText(),this.texture_missing_sprites={}},addFeature(e,t,r){let n=r.tile;if(n.generation!==this.generation)return;let i,s={};if(s.color=this.parseColor(t.color,r),s.texture=t.texture,s.label_texture=null,s.blend_order=t.blend_order,!s.color&&!s.texture)return;if(s.alpha=J.evalCachedProperty(t.alpha,r),this.hasSprites(s)){if(i=this.parseSprite(s,t,r),!i)return void _({level:"debug",once:!0},`Layer group '${t.layers.join(", ")}' uses a texture '${s.texture}', but doesn't specify which sprite to draw. Features that match this layer group won't be drawn without specifying the sprite with the 'sprite' or 'sprite_default' properties. The merged draw parameters for this layer group are:`,t).then(r=>{r&&_("debug",`Example feature for layer group '${t.layers.join(", ")}'`,e)});s.texcoords=i.texcoords}else if(t.sprite)return void _({level:"warn",once:!0},`Layer group '${t.layers.join(", ")}' specifies sprite '${t.sprite}', but the texture '${t.texture}' doesn't define any sprites. Features that match this layer group won't be drawn. The merged draw parameters for this layer group are:`,t);if(this.calcSize(t,s,i,r),t.outline&&(s.outline_width=J.evalCachedProperty(t.outline.width,r)||J.defaults.outline.width,s.outline_color=this.parseColor(t.outline.color,r)),s.outline_edge_pct=0,s.outline_width&&s.outline_color){let e=s.outline_width;s.size[0]+=e,s.size[1]+=e,s.outline_edge_pct=e/Math.min(s.size[0],s.size[1])*2,s.outline_alpha=J.evalCachedProperty(t.outline.alpha,r)}s.size[0]=Math.min(s.size[0],256),s.size[1]=Math.min(s.size[1],256),s.placement=t.placement,s.placement_min_length_ratio=J.evalCachedProperty(t.placement_min_length_ratio,r),s.placement===un.SPACED&&t.placement_spacing&&(s.placement_spacing=J.evalCachedProperty(t.placement_spacing,r)),s.angle=J.evalProperty(t.angle,r)||0,s.z=J.evalCachedDistanceProperty(t.z,r)||J.defaults.z,s.tile_edges=t.tile_edges,this.computeLayout(s,e,t,r,n);let o=t.text&&!1!==t.text.visible&&this.parseTextFeature(e,t.text,r,n);Array.isArray(o)&&(o=null,_({level:"warn",once:!0},`Layer group '${t.layers.join(", ")}': cannot use boundary labels (e.g. 'text_source: { left: ..., right: ... }') for 'text' labels attached to 'points'; provided 'text_source' value was ${JSON.stringify(t.text.text_source)}`)),o&&(o.layout.parent=s,o.layout.priority=t.text.priority?Math.max(o.layout.priority,s.priority+.5):s.priority+.5,$t.addStyle(this.collision_group_text,n.id)),this.queueFeature({feature:e,draw:t,context:r,style:s,text_feature:o},n),$t.addStyle(this.collision_group_points,n.id)},calcSize(e,t,r,n){if(t.size=e.size,t.size){if(t.size=J.evalCachedPointSizeProperty(e.size,r,k.textures[t.texture],n),null==t.size)return void _({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': 'size' (${JSON.stringify(e.size.value)}) couldn't be interpreted, features that match this layer group won't be drawn`);"number"==typeof t.size&&(t.size=[t.size,t.size])}else t.size=r&&r.css_size||[16,16]},hasSprites:e=>e.texture&&k.textures[e.texture]&&k.textures[e.texture].sprites,getSpriteInfo(e,t){let r=k.textures[e.texture].sprites[t]&&k.getSpriteInfo(e.texture,t);return t&&!r?(this.texture_missing_sprites[e.texture]=this.texture_missing_sprites[e.texture]||{},this.texture_missing_sprites[e.texture][t]||(_("debug",`Style: in style '${this.name}', could not find sprite '${t}' for texture '${e.texture}'`),this.texture_missing_sprites[e.texture][t]=!0)):r&&(r.sprite=t),r},parseSprite(e,t,r){let n=J.evalProperty(t.sprite,r);return this.getSpriteInfo(e,n)||this.getSpriteInfo(e,t.sprite_default)},queueFeature(e,t){this.tile_data[t.id]&&this.queues[t.id]||this.startData(t),this.queues[t.id]=this.queues[t.id]||[],this.queues[t.id].push(e)},async endData(e){if(e.canceled)return _("trace",`Style ${this.name}: stop tile build because tile was canceled: ${e.key}`),null;let t=this.queues[e.id];delete this.queues[e.id];let r=[],n=[];t.forEach(e=>{let t=e.style,i=e.feature,s=i.geometry,o=this.buildLabels(t.size,s,t);for(let s=0;s<o.length;s++){let a=o[s],l={feature:i,draw:e.draw,context:e.context,style:t,label:a};if(n.push(l),e.text_feature){let t={feature:i,draw:e.text_feature.draw,context:e.context,text:e.text_feature.text,text_settings_key:e.text_feature.text_settings_key,layout:e.text_feature.layout,point_label:a,linked:l};r.push(t),e.draw.text.optional||(l.linked=t)}}});const[,{labels:i,texts:s,textures:o}]=await Promise.all([$t.collide(n,this.collision_group_points,e.id).then(e=>{e.forEach(e=>{this.feature_style=e.style,this.feature_style.label=e.label,this.feature_style.linked=e.linked,Ne.addFeature.call(this,e.feature,e.draw,e.context)})}),this.collideAndRenderTextLabels(e,this.collision_group_text,r)]);i&&s&&i.forEach(e=>{let t=e.text_settings_key,r=s[t]&&s[t][e.text],n=this.feature_style;n.label=e.label,n.linked=e.linked,n.size=r.size.logical_size,n.texcoords=r.align[e.label.align].texcoords,n.label_texture=o[r.align[e.label.align].texture_id],n.blend_order=e.draw.blend_order,Ne.addFeature.call(this,e.feature,e.draw,e.context)}),this.freeText(e);const a=await Ne.endData.call(this,e);return a&&o&&o.length&&(a.textures=a.textures||[],a.textures.push(...o)),a},_preprocess(e){e.color=J.createColorPropertyCache(e.color),e.alpha=J.createPropertyCache(e.alpha),e.texture=void 0!==e.texture?e.texture:this.texture,e.blend_order=this.getBlendOrderForDraw(e),e.outline&&(e.outline.color=J.createColorPropertyCache(e.outline.color),e.outline.alpha=J.createPropertyCache(e.outline.alpha),e.outline.width=J.createPropertyCache(e.outline.width,J.parsePositiveNumber)),e.z=J.createPropertyCache(e.z,J.parseUnits);try{e.size=J.createPointSizePropertyCache(e.size,e.texture)}catch(t){return _({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': ${t} (${JSON.stringify(e.size)}), features that match this layer group won't be drawn.`),null}if(e.offset=J.createPropertyCache(e.offset,e=>Array.isArray(e)&&e.map(J.parseNumber)),e.buffer=J.createPropertyCache(e.buffer,e=>(Array.isArray(e)?e:[e,e]).map(J.parsePositiveNumber)),e.repeat_distance=J.createPropertyCache(e.repeat_distance,J.parseNumber),e.placement=un[e.placement&&e.placement.toUpperCase()],null==e.placement&&(e.placement=un.VERTEX),e.placement_spacing=null!=e.placement_spacing?e.placement_spacing:80,e.placement_spacing=J.createPropertyCache(e.placement_spacing,J.parsePositiveNumber),e.placement_min_length_ratio=null!=e.placement_min_length_ratio?e.placement_min_length_ratio:1,e.placement_min_length_ratio=J.createPropertyCache(e.placement_min_length_ratio,J.parsePositiveNumber),"number"==typeof e.angle)e.angle=e.angle*Math.PI/180;else if("function"==typeof e.angle){const t=e.angle;e.angle=e=>t(e)*Math.PI/180}else e.angle=e.angle||0;return e.text=this.preprocessText(e.text),e.text&&(e.text.key=e.key,e.text.group=e.group,e.text.layers=e.layers,e.text.order=e.order,e.text.blend_order=e.blend_order,e.text.repeat_group=null!=e.text.repeat_group?e.text.repeat_group:e.repeat_group,e.text.anchor=e.text.anchor||this.default_anchor,e.text.optional="boolean"==typeof e.text.optional&&e.text.optional,e.text.interactive=e.text.interactive||e.interactive),e},default_anchor:["bottom","top","right","left"],computeLayout(e,t,r,n,i){let s=e||{};s.id=t,s.units_per_pixel=i.units_per_pixel||1,s.collide=!1!==r.collide,s.anchor=r.anchor,s.offset=J.evalCachedProperty(r.offset,n)||J.zeroPair,s.buffer=J.evalCachedProperty(r.buffer,n)||J.zeroPair,s.repeat_distance=J.evalCachedProperty(r.repeat_distance,n),s.repeat_distance&&(s.repeat_distance*=s.units_per_pixel,s.repeat_scale=1,"function"==typeof r.repeat_group?s.repeat_group=r.repeat_group(n):s.repeat_group=r.repeat_group||n.layer);let o=r.priority;return null!=o?"function"==typeof o&&(o=o(n)):o=-1>>>0,s.priority=o,s},buildTextLabels(e,t){let r=[];for(let n=0;n<t.length;n++){let i=t[n],s=this.texts[e.id][i.text_settings_key][i.text].size.collision_size;i.label=new qt(i.point_label.position,s,i.layout),r.push(i)}return r},buildLabels(e,t,r){let n=[];if("Point"===t.type)n.push(new qt(t.coordinates,e,r,r.angle));else if("MultiPoint"===t.type){let i=t.coordinates;for(let t=0;t<i.length;++t){let s=i[t];n.push(new qt(s,e,r,r.angle))}}else if("LineString"===t.type){let i=Ht(t.coordinates,e,r);for(let e=0;e<i.length;++e)n.push(i[e])}else if("MultiLineString"===t.type){let i=t.coordinates;for(let t=0;t<i.length;t++){let s=Ht(i[t],e,r);for(let e=0;e<s.length;++e)n.push(s[e])}}else if("Polygon"===t.type)if(r.placement===un.CENTROID){let i=G.centroid(t.coordinates);i&&n.push(new qt(i,e,r,r.angle))}else{let i=t.coordinates;for(let t=0;t<i.length;t++){let s=Ht(i[t],e,r);for(let e=0;e<s.length;++e)n.push(s[e])}}else if("MultiPolygon"===t.type)if(r.placement===un.CENTROID){let i=G.multiCentroid(t.coordinates);i&&n.push(new qt(i,e,r,r.angle))}else{let i=t.coordinates;for(let t=0;t<i.length;t++){let s=i[t];for(let t=0;t<s.length;t++){let i=Ht(s[t],e,r);for(let e=0;e<i.length;++e)n.push(i[e])}}}return n},makeVertexTemplate(e,t,r=!0){let n=0;this.vertex_template[n++]=0,this.vertex_template[n++]=0,this.vertex_template[n++]=e.z||0,this.vertex_template[n++]=this.scaleOrder(e.order),this.vertex_template[n++]=0,this.vertex_template[n++]=0,this.vertex_template[n++]=0,this.vertex_template[n++]=e.label.layout.collide?0:1,t.variant.shader_point||(this.vertex_template[n++]=0,this.vertex_template[n++]=0),this.vertex_template[n++]=0,this.vertex_template[n++]=0;const i=e.color||J.defaults.color;if(this.vertex_template[n++]=255*i[0],this.vertex_template[n++]=255*i[1],this.vertex_template[n++]=255*i[2],this.vertex_template[n++]=255*(null!=e.alpha?e.alpha:i[3]),t.variant.selection&&(this.vertex_template[n++]=255*e.selection_color[0],this.vertex_template[n++]=255*e.selection_color[1],this.vertex_template[n++]=255*e.selection_color[2],this.vertex_template[n++]=255*e.selection_color[3]),t.variant.shader_point){const t=e.outline_color||J.defaults.outline.color;this.vertex_template[n++]=255*t[0],this.vertex_template[n++]=255*t[1],this.vertex_template[n++]=255*t[2],this.vertex_template[n++]=255*(null!=e.outline_alpha?e.outline_alpha:t[3]),this.vertex_template[n++]=e.outline_edge_pct||J.defaults.outline.width}return r&&this.addCustomAttributesToVertexTemplate(e,n),this.vertex_template},buildQuad:(e,t,r,n,i,s,o,a,l,u,c)=>t[0]<=0||t[1]<=0?0:function(e,t,r,n,i,s,o,a,l,u,c,h){const d=128*i[0],f=128*i[1];Tt[0]=-d,Tt[1]=-f,Tt[2]=d,Tt[3]=f;const p=c||Ue,m=t.vertex_elements;let _=t.vertex_count;for(let i=0;i<4;i++)r[n.a_position+0]=e[0],r[n.a_position+1]=e[1],r[n.a_shape+0]=Tt[At[i]],r[n.a_shape+1]=Tt[Et[i]],r[n.a_shape+2]=l,r[n.a_offset+0]=s[0],r[n.a_offset+1]=s[1],n.a_texcoord&&(r[n.a_texcoord+0]=65535*p[At[i]],r[n.a_texcoord+1]=65535*p[Et[i]]),h&&(r[n.a_pre_angles+0]=xt*a[0],r[n.a_pre_angles+1]=xt*a[1],r[n.a_pre_angles+2]=xt*a[2],r[n.a_pre_angles+3]=xt*a[3],r[n.a_angles+0]=wt*u[0],r[n.a_angles+1]=wt*u[1],r[n.a_angles+2]=wt*u[2],r[n.a_angles+3]=wt*u[3],r[n.a_offsets+0]=64*o[0],r[n.a_offsets+1]=64*o[1],r[n.a_offsets+2]=64*o[2],r[n.a_offsets+3]=64*o[3]),t.addVertex(r);return m.push(_+0),m.push(_+1),m.push(_+2),m.push(_+2),m.push(_+3),m.push(_+0),2}(e,u,c,u.vertex_layout.index,t,s,o,i,4096*r,n,a,l),build(e,t){let r=e.label;return"curved"===r.type?this.buildCurvedLabel(r,e,t):this.buildStraightLabel(r,e,t)},buildStraightLabel(e,t,r){let n,i,s=this.getTileMesh(r.tile,this.meshVariantTypeForDraw(t)),o=this.makeVertexTemplate(t,s);"point"!==e.type?(n=t.size[e.type],i=t.texcoords[e.type].texcoord):(n=t.size,i=t.texcoords),s.uniforms=s.uniforms||{},t.label_texture?(s.uniforms.u_texture=t.label_texture,s.uniforms.u_point_type=2,s.uniforms.u_apply_color_blocks=!1):t.texture?(s.uniforms.u_texture=t.texture,s.uniforms.u_point_type=1,s.uniforms.u_apply_color_blocks=!0):(s.uniforms.u_texture=k.default,s.uniforms.u_point_type=3,s.uniforms.u_apply_color_blocks=!0);let a=e.offset,l=this.buildQuad(e.position,n,e.angle,null,null,a,null,i,!1,s.vertex_data,o);const u=t.linked&&t.linked.label.id;return this.trackLabel(e,u,s,l,r),l},buildCurvedLabel(e,t,r){let n,i,s=0;for(let o=0;o<e.num_segments;o++){let a=t.size[e.type][o],l=t.texcoords_stroke[o];t.label_texture=t.label_textures[o],n=this.getTileMesh(r.tile,this.meshVariantTypeForDraw(t)),i=this.makeVertexTemplate(t,n),n.uniforms=n.uniforms||{},n.uniforms.u_texture=t.label_texture,n.uniforms.u_point_type=2,n.uniforms.u_apply_color_blocks=!1;let u=e.offset||[0,0],c=e.position,h=e.angles[o],d=e.offsets[o],f=e.pre_angles[o],p=this.buildQuad(c,a,e.angle,h,f,u,d,l,!0,n.vertex_data,i);s+=p;const m=t.linked&&t.linked.label.id;this.trackLabel(e,m,n,p,r)}for(let o=0;o<e.num_segments;o++){let a=t.size[e.type][o],l=t.texcoords[e.type][o].texcoord;t.label_texture=t.label_textures[o],n=this.getTileMesh(r.tile,this.meshVariantTypeForDraw(t)),i=this.makeVertexTemplate(t,n),n.uniforms=n.uniforms||{},n.uniforms.u_texture=t.label_texture,n.uniforms.u_point_type=2,n.uniforms.u_apply_color_blocks=!1;let u=e.offset||[0,0],c=e.position,h=e.angles[o],d=e.offsets[o],f=e.pre_angles[o],p=this.buildQuad(c,a,e.angle,h,f,u,d,l,!0,n.vertex_data,i);s+=p;const m=t.linked&&t.linked.label.id;this.trackLabel(e,m,n,p,r)}return s},trackLabel(e,t,r,n){if(e.layout.collide||e.may_repeat_across_tiles){r.labels=r.labels||{},r.labels[e.id]=r.labels[e.id]||{container:{label:e.toJSON(),linked:t},ranges:[]};const i=2*n,s=r.vertex_data.offset-r.vertex_data.stride*i;r.labels[e.id].ranges.push([s,i])}},buildLines(e,t,r){return this.build(t,r)},buildPoints(e,t,r){return this.build(t,r)},buildPolygons(e,t,r){return this.build(t,r)},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.shader_point]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_shape",size:4,type:fe.SHORT,normalized:!1},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0,static:e.shader_point?[0,0]:null},{name:"a_offset",size:2,type:fe.SHORT,normalized:!1},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_outline_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.shader_point?null:[0,0,0,0]},{name:"a_outline_edge",size:1,type:fe.FLOAT,normalized:!1,static:e.shader_point?null:0}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.shader_point]=new Le(t)}return this.vertex_layouts[e.shader_point]},meshVariantTypeForDraw(e){const t=e.label_texture||e.texture||hn,r=t+"/"+e.blend_order;return null==this.variants[r]&&(this.variants[r]={key:r,selection:1,shader_point:t===hn,blend_order:e.blend_order,mesh_order:e.label_texture?1:0}),this.variants[r]},makeMesh(e,t,r={}){return r=Object.assign({},r,{fade_in_time:this.fade_in_time}),Ne.makeMesh.call(this,e,t,r)}});const dn=[0,.33,.66,.99];let fn=function(e,t,r,n){const i=[{type:"straight",tolerance:n.no_curving?1.8:1.5},{type:"curved"},{type:"straight",tolerance:2.3}];for(let s=0;s<i.length;s++){let o,a=i[s];if("straight"===a.type?o=new mn(t,r,n,a.tolerance):"curved"===a.type&&!n.no_curving&&r.length>2&&(o=new _n(e,r,n)),o&&!o.throw_away)return o}return!1};class pn{constructor(e){this.id=Ut.nextLabelId(),this.layout=e,this.position=[],this.angle=0,this.offset=e.offset.slice(),this.unit_scale=this.layout.units_per_pixel,this.obbs=[],this.aabbs=[],this.type="",this.throw_away=!1}toJSON(){return{id:this.id,type:this.type,position:this.position,size:this.size,offset:this.offset,angle:this.angle,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Bt(this.layout)}}static splitLineByOrientation(e){let t=[e[0]],r=0,n=0,i=0,s=t,o=!1;for(let a=1;a<e.length;a++){let l=e[a],u=e[a-1],c=ye.length(ye.sub(l,u));l[0]>u[0]?1===i?(t.push(l),r+=c,r>n&&(s=t,n=r,o=!1)):(t=[u,l],r=c,r>n&&(s=t,n=r,o=!1),i=1):l[0]<u[0]?-1===i?(t.unshift(l),r+=c,r>n&&(s=t,n=r,o=!0)):(t=[l,u],r=c,r>n&&(s=t,n=r,o=!0),i=-1):(-1===i?t.unshift(l):(t.push(l),i=1),r+=c,r>n&&(s=t,n=r,o=-1===i))}return[s,o]}discard(e,t=null){if(this.throw_away)return!0;for(let r=0;r<this.obbs.length;r++){let n={aabb:this.aabbs[r],obb:this.obbs[r]};if(Ut.prototype.occluded.call(n,e,t))return!0}return!1}inTileBounds(){for(let e=0;e<this.aabbs.length;e++){let t={aabb:this.aabbs[e]};if(!Ut.prototype.inTileBounds.call(t))return!1}return!0}static createOBB(e,t,r,n,i,s,o){let a=e[0],l=e[1];return!s||0===s[0]&&0===s[1]||(a+=(s=ye.rot(s,i))[0]*o,l-=s[1]*o),new jt(a,l,-n,t,r)}}class mn extends pn{constructor(e,t,r,n){super(r),this.type="straight",this.size=e,this.throw_away=!this.fit(e,t,r,n)}fit(e,t,r,n){let i,s=this.unit_scale;[t,i]=pn.splitLineByOrientation(t),"number"==typeof r.orientation&&(this.offset[1]+=1.2*(e[1]-r.vertical_buffer),i&&(this.offset[1]*=-1),-1===r.orientation&&(this.offset[1]*=-1));let o=vn(t),a=e[0]*s;for(let i=0;i<t.length-1;i++){let s,l=t[i],u=0,c=0,h=i+1;for(;h<t.length;){let d=t[h-1],f=t[h],p=yn(d,f);if(h!==i+1&&(u+=bn(p,s)),Math.abs(u)>.1)break;if(c+=o[h-1],gn(c,a)<n){let t=ye.mult(ye.add(l,f),.5);return this.angle=-p,Math.abs(this.angle-Math.PI/2)<.01&&(this.angle=-Math.PI/2,"number"==typeof r.orientation&&(this.offset[1]*=-1)),this.position=t,this.updateBBoxes(this.position,e,this.angle,this.angle,this.offset),!0}s=p,h++}}return!1}updateBBoxes(e,t,r,n,i){let s=this.unit_scale;this.obbs=[],this.aabbs=[];let o=(t[0]+2*this.layout.buffer[0])*s*Ut.epsilon,a=(t[1]+2*this.layout.buffer[1])*s*Ut.epsilon,l=pn.createOBB(e,o,a,r,n,i,s),u=l.getExtent();this.obbs.push(l),this.aabbs.push(u),this.inTileBounds&&(this.breach=!this.inTileBounds()),this.mayRepeatAcrossTiles&&(this.may_repeat_across_tiles=this.mayRepeatAcrossTiles())}}class _n extends pn{constructor(e,t,r){super(r),this.type="curved",this.angles=[],this.pre_angles=[],this.offsets=[],this.num_segments=e.length,this.sizes=e,this.throw_away=!this.fit(this.sizes,t,r)}toJSON(){return{id:this.id,type:this.type,obbs:this.obbs.map(e=>e.toJSON()),position:this.position,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Bt(this.layout)}}fit(e,t,r){let n,i=this.unit_scale,s=Math.max(...e.map(e=>e[1])),o=s*i;[t,n]=pn.splitLineByOrientation(t),"number"==typeof r.orientation&&(this.offset[1]+=1.2*(s-r.vertical_buffer),n&&(this.offset[1]*=-1),-1===r.orientation&&(this.offset[1]*=-1));let a=vn(t),l=e.map(e=>e[0]*i),u=a.reduce((e,t)=>e+t,0),c=l.reduce((e,t)=>e+t,0);if(c>u)return!1;let h=t.length-1;if(h-0<2)return!1;let d=_n.curvaturePlacement(t,u,a,c,0,h),f=t[d];if(-1===d||h-d<2)return!1;this.position=f;for(var p=0;p<l.length;p++){this.offsets[p]=[],this.angles[p]=[],this.pre_angles[p]=[];for(var m=0;m<dn.length;m++){let e=dn[m],[r,n]=_n.scaleLine(e,t);f=r[d];let{positions:s,offsets:a,angles:u,pre_angles:c}=_n.placeAtIndex(d,r,n,l),h=a.map(e=>Math.sqrt(e[0]*e[0]+e[1]*e[1])/i);if(0===e){this.angle=1/u.length*u.reduce((e,t)=>e+t);for(let e=0;e<s.length;e++){let t=s[e],r=c[e],n=l[e],a=r+u[e],h=this.angle,d=pn.createOBB(t,n,o,a,h,this.offset,i),f=d.getExtent();this.obbs.push(d),this.aabbs.push(f)}}this.offsets[p].push(h[p]),this.angles[p].push(u[p]),this.pre_angles[p].push(c[p])}}return!0}static curvaturePlacement(e,t,r,n,i,s){i=i||0,s=s||e.length-1;var o=[];for(let t=i+1;t<s;t++){var a=e[t-1],l=e[t],u=e[t+1],c=ye.perp(l,a),h=ye.perp(u,l),d=ye.angleBetween(c,h);d>1&&(d=1/0),o.push(d)}o.push(1/0);var f=[],p=[],m=i,_=0;for(let e=0;e<i;e++)_+=r[e];for(;_+n<t;){for(var g=_+n,y=_,v=m,b=0;v<s&&y+r[v]<g&&(b+=o[v])!==1/0;)y+=r[v],v++;if(0===b)return m;var x=b/(v-m);f.push(b),p.push(x),_+=r[m],m++}if(0===f.length)return-1;var w=Math.min.apply(null,f),A=p[f.indexOf(w)];return w<1.3&&A<.4?f.indexOf(w):-1}static scaleLine(e,t){var r=[t[0]],n=[];return t.forEach((i,s)=>{if(s!==t.length-1){var o=ye.sub(t[s+1],t[s]),a=ye.mult(o,1+e);r.push(ye.add(r[s],a)),n.push(ye.length(a))}}),[r,n]}static placeAtIndex(e,t,r,n){let i=t[e],[s,o]=_n.getIndicesAndOffsets(e,r,n),a=_n.getPositionsFromIndicesAndOffsets(t,s,o),[l,u,c]=_n.getAnglesFromIndicesAndOffsets(i,s,t,a);return{positions:a,offsets:l,angles:u,pre_angles:c}}static getIndicesAndOffsets(e,t,r){let n=r.length,i=[],s=[],o=0,a=0,l=0;for(;o<n;){let u=r[o];for(;o<n&&a+.5*u<=l+t[e];){let t=a-l+.5*u;s.push(t),i.push(e),a+=u,o++,u=r[o]}l+=t[e],e++}return[i,s]}static getPositionsFromIndicesAndOffsets(e,t,r){let n=[];for(let i=0;i<t.length;i++){let s=t[i],o=r[i],a=yn(e[s],e[s+1]),l=ye.rot([o,0],a),u=ye.add(e[s],l);n.push(u)}return n}static getAnglesFromIndicesAndOffsets(e,t,r,n){let i=[],s=[],o=[];for(let a=0;a<n.length;a++){let l=n[a],u=t[a],c=ye.sub(l,e),h=-ye.angle(c),d=-yn(r[u],r[u+1])-h;if(a>0){let e=i[a-1],t=s[a-1];Math.abs(h-e)>Math.PI&&(h+=h>e?-2*Math.PI:2*Math.PI),Math.abs(t-d)>Math.PI&&(d+=d>t?-2*Math.PI:2*Math.PI)}i.push(h),s.push(d),o.push(c)}return[o,i,s]}}function gn(e,t){return t/e}function yn(e,t){let r=ye.sub(t,e);return ye.angle(r)}function vn(e){let t=[];for(let r=0;r<e.length-1;r++){let n=e[r],i=e[r+1],s=Math.hypot(n[0]-i[0],n[1]-i[1]);t.push(s)}return t}function bn(e,t){let r,n;for(e>t?(r=t,n=e):(r=e,n=t);n-r>Math.PI;)r+=2*Math.PI;return Math.abs(n-r)}let xn=Object.create(cn);Object.assign(xn,{name:"text",super:cn,built_in:!0,init(e={}){Ne.init.call(this,e),this.setupDefines(),this.defines.TANGRAM_HAS_SHADER_POINTS=!1,this.defines.TANGRAM_CURVED_LABEL=!0,this.reset()},makeVertexTemplate(e,t){this.super.makeVertexTemplate.call(this,e,t,!1);let r=t.vertex_data.vertex_layout.index.a_pre_angles;for(let e=0;e<12;e++)this.vertex_template[r++]=0;return this.addCustomAttributesToVertexTemplate(e,r),this.vertex_template},reset(){this.queues={},this.resetText()},addFeature(e,t,r){let n=r.tile;if(n.generation!==this.generation)return;let i=e.geometry.type;t.can_articulate="LineString"===i||"MultiLineString"===i,t.supersample_text="LineString"===i||"MultiLineString"===i;let s=this.parseTextFeature(e,t,r,n);s&&(s instanceof Array?s.forEach(t=>{t.feature=e,t.context=r,t.layout.vertex=!1,this.queueFeature(t,n)}):(s.feature=e,s.context=r,s.layout.vertex=!1,this.queueFeature(s,n)),$t.addStyle(this.name,n.id))},async endData(e){let t=this.queues[e.id];delete this.queues[e.id];const{labels:r,texts:n,textures:i}=await this.collideAndRenderTextLabels(e,this.name,t);r&&n&&(this.texts[e.id]=n,r.forEach(t=>{let r=t.text_settings_key,n=this.texts[e.id][r]&&this.texts[e.id][r][t.text],s=this.feature_style;s.label=t.label,n.text_settings.can_articulate?(s.size={},s.texcoords={},"straight"===t.label.type?(s.size.straight=n.size.logical_size,s.texcoords.straight=n.texcoords.straight,s.label_texture=i[n.texcoords.straight.texture_id]):(s.size.curved=n.segment_sizes.map(function(e){return e.logical_size}),s.texcoords_stroke=n.texcoords_stroke,s.texcoords.curved=n.texcoords.curved,s.label_textures=n.texcoords.curved.map(e=>i[e.texture_id]))):(s.size=n.size.logical_size,s.texcoords=n.align[t.label.align].texcoords,s.label_texture=i[n.align[t.label.align].texture_id]),s.blend_order=t.draw.blend_order,Ne.addFeature.call(this,t.feature,t.draw,t.context)})),this.freeText(e);const s=await Ne.endData.call(this,e);if(s){i&&i.length&&s.textures.push(...i);for(let e in s.meshes)s.meshes[e].uniforms.u_apply_color_blocks=!0}return s},_preprocess(e){return e.blend_order=this.getBlendOrderForDraw(e),this.preprocessText(e)},buildTextLabels(e,t){let r=[];for(let i=0;i<t.length;i++){let s,o=t[i],a=this.texts[e.id][o.text_settings_key][o.text];if(o.layout.vertical_buffer=a.vertical_buffer,a.text_settings.can_articulate){var n=a.segment_sizes.map(e=>e.collision_size);o.layout.no_curving=a.no_curving,s=this.buildLabels(n,o.feature.geometry,o.layout,a.size.collision_size)}else s=this.buildLabels(a.size.collision_size,o.feature.geometry,o.layout);for(let e=0;e<s.length;e++){let t=Object.create(o);t.label=s[e],r.push(t)}}return r},buildLabels(e,t,r,n){let i=[];if("LineString"===t.type)Array.prototype.push.apply(i,this.buildLineLabels(t.coordinates,e,r,n));else if("MultiLineString"===t.type){let s=t.coordinates;for(let t=0;t<s.length;++t)Array.prototype.push.apply(i,this.buildLineLabels(s[t],e,r,n))}else if("Point"===t.type)i.push(new qt(t.coordinates,e,r));else if("MultiPoint"===t.type){let n=t.coordinates;for(let t=0;t<n.length;++t)i.push(new qt(n[t],e,r))}else if("Polygon"===t.type){let n=G.centroid(t.coordinates);n&&i.push(new qt(n,e,r))}else if("MultiPolygon"===t.type){let n=G.multiCentroid(t.coordinates);n&&i.push(new qt(n,e,r))}return i},buildLineLabels(e,t,r,n){let i=[],s=Math.min(r.subdiv,e.length-1);if(s>1){let o=(e.length-1)/s;for(let a=0;a<s;a++){let s=Math.floor(a*o),l=Math.floor((a+1)*o)+1,u=e.slice(s,l),c=fn(t,n,u,r);c&&i.push(c)}}if(i.length<s){let s=fn(t,n,e,r);s&&i.push(s)}return i},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.shader_point]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_shape",size:4,type:fe.SHORT,normalized:!1},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0},{name:"a_offset",size:2,type:fe.SHORT,normalized:!1},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_pre_angles",size:4,type:fe.BYTE,normalized:!1},{name:"a_angles",size:4,type:fe.SHORT,normalized:!1},{name:"a_offsets",size:4,type:fe.UNSIGNED_SHORT,normalized:!1}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.shader_point]=new Le(t)}return this.vertex_layouts[e.shader_point]}}),xn.texture_id=0;let wn=Object.create(et);function An(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function En(e){return null!=e}function Tn(e){return"("+e+")"}function Sn(e){return"string"==typeof e?'"'+e+'"':e}function kn(e){return"$"===e[0]?"context['"+e.substring(1)+"']":e.indexOf(".")>-1?-1===e.indexOf("\\.")?`context.feature.properties${e.split(".").map(e=>"['"+e+"']").join("")}`:`context.feature.properties${e.replace(/\\\./g,"__TANGRAM_DELIMITER__").split(".").map(e=>e.replace(/__TANGRAM_DELIMITER__/g,".")).map(e=>"['"+e+"']").join("")}`:"context.feature.properties['"+e+"']"}function On(e,t){return Tn(Sn(t)+" === "+kn(e))}function Rn(e,t){return Tn(`${"["+t.map(Sn).join(",")+"]"}.indexOf(${kn(e)}) > -1`)}function Cn(e,t){return Tn(e.filter(En).map(function(e){return Tn(e.join(" && "))}).join(" "+t+" "))}function Nn(e,t,r){return t&&t.length>0?Cn(t.map(function(e){return Ln(e,r)}),"||"):"true"}function Pn(e,t,r){return t&&t.length>0?Cn(t.map(function(e){return Ln(e,r)}),"&&"):"true"}function Mn(e,t,r){return"!"+Tn(Ln(t,r).join(" && "))}function Dn(e,t,r){return"!"+Tn(Nn(0,t,r))}function zn(e,t){return Tn(kn(e)+(t?" != ":" == ")+"null")}function In(e,t,r){var n=[],i=r&&"function"==typeof r.rangeTransform&&r.rangeTransform;if(t.max){var s=i?i(t.max):t.max;n.push(kn(e)+" < "+s)}if(t.min){var o=i?o=i(t.min):t.min;n.push(kn(e)+" >= "+o)}return Tn(n.join(" && "))}function Fn(e,t){let r=[];if(t.includes_any){const n="["+(Array.isArray(t.includes_any)?t.includes_any:[t.includes_any]).map(Sn).join(",")+"]";r.push(`${kn(e)} != null && ${n}.some(function(v) { return ${kn(e)}.indexOf(v) > -1 })`)}if(t.includes_all){const n="["+(Array.isArray(t.includes_all)?t.includes_all:[t.includes_all]).map(Sn).join(",")+"]";r.push(`${kn(e)} != null && ${n}.every(function(v) { return ${kn(e)}.indexOf(v) > -1 })`)}return Tn(r.join(" && "))}function Ln(e,t){var r=[];if("function"==typeof e)return[Tn(e.toString()+"(context)")];if(Array.isArray(e))return[Nn(0,e,t)];if(null==e)return["true"];for(var n=Object.keys(e),i=0;i<n.length;i++){var s=n[i],o=e[s],a=typeof o;if("string"===a||"number"===a)r.push(On(s,o));else if("boolean"===a)r.push(zn(s,o));else if("not"===s)r.push(Mn(0,o,t));else if("any"===s)r.push(Nn(0,o,t));else if("all"===s)r.push(Pn(0,o,t));else if("none"===s)r.push(Dn(0,o,t));else if(Array.isArray(o))r.push(Rn(s,o));else if("object"===a&&null!=o)o.max||o.min?r.push(In(s,o,t)):(o.includes_any||o.includes_all)&&r.push(Fn(s,o));else{if(null!=o)throw new Error("Unknown Query syntax: "+o);r.push(" true ")}}return 0===n.length?["true"]:r}function jn(e,t){return null==e?function(){return!0}:new Function("context","return "+Tn(Ln(e,t).join(" && "))+";")}Object.assign(wn,{name:"raster",super:et,built_in:!0,init(){this.raster=this.raster||"color",this.super.init.apply(this,arguments),this.selection=!1},_preprocess(e){return e.color=e.color||J.defaults.color,this.super._preprocess.apply(this,arguments)}});const Un=["filter","draw","visible","enabled","data","exclusive","priority"];let Bn={};function Vn(e,t){let r,n=0;for(let t=0;t<e.length;t++)e[t].length>n&&(n=e[t].length);if(0===n)return null;let i={visible:!0};for(let s=0;s<n;s++)r=[],e.forEach(e=>{e[s]&&e[s][t]&&-1===r.indexOf(e[s][t])&&r.push(e[s][t])}),0!==r.length&&V(i,...r);return!1===i.visible?null:i}const Gn=["any","all","not","none"];class $n{constructor({layer:e,name:t,parent:r,draw:n,visible:i,enabled:s,filter:o,exclusive:a,priority:l,styles:u}){if(this.id=$n.id++,this.config_data=e.data,this.parent=r,this.name=t,this.full_name=this.parent?this.parent.full_name+":"+this.name:this.name,this.draw=n,this.filter=o,this.exclusive=!0===a,this.priority=null!=l?l:Number.MAX_SAFE_INTEGER,this.styles=u,this.is_built=!1,s=void 0===s?i:s,this.enabled=!1!==s,this.draw)for(let e in this.draw)if(this.draw[e]=null==this.draw[e]?{}:this.draw[e],"object"!=typeof this.draw[e]){let t=`Draw group '${e}' for layer ${this.full_name} is invalid, must be an object, `;t+=`but was set to \`${e}: ${this.draw[e]}\` instead`,_("warn",t),delete this.draw[e]}}build(){_("trace",`Building layer '${this.full_name}'`),this.buildFilter(),this.buildDraw(),this.is_built=!0}buildDraw(){this.draw=Z(this.draw,J.wrapFunction),this.calculatedDraw=function(e){let t=[];if(e.parent){let r=e.parent.calculatedDraw||[];t.push(...r)}return t.push(e.draw),t}(this)}buildFilter(){this.filter_original=this.filter,this.filter=Z(this.filter,J.wrapFunction);let e=typeof this.filter;if(null!=this.filter&&"object"!==e&&"function"!==e){let e=`Filter for layer ${this.full_name} is invalid, filter value must be an object or function, `;return e+=`but was set to \`filter: ${this.filter}\` instead`,void _("warn",e)}try{this.buildZooms(),this.buildPropMatches(),null!=this.filter&&("function"==typeof this.filter||Object.keys(this.filter).length>0)?this.filter=jn(this.filter,Hn):this.filter=null}catch(e){let t=`Filter for layer ${this.full_name} is invalid, \`filter: ${JSON.stringify(this.filter)}\` `;t+=`failed with error '${e.message}', stack trace: ${e.stack}`,_("warn",t)}}buildZooms(){let e=this.filter&&this.filter.$zoom,t=typeof e;if(null!=e){if(this.zooms={},"number"===t)this.zooms[e]=!0;else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.zooms[e[t]]=!0;else if("object"===t&&(null!=e.min||null!=e.max)){let t=e.min||0,r=e.max||G.max_style_zoom;for(let e=t;e<r;e++)this.zooms[e]=!0}delete this.filter.$zoom}}buildPropMatches(){this.filter&&!Array.isArray(this.filter)&&"function"!=typeof this.filter&&Object.keys(this.filter).forEach(e=>{if(-1===Gn.indexOf(e)){let t=this.filter[e],r=typeof t,n=Array.isArray(t);if(!n&&"string"!==r&&"number"!==r)return;"$"===e[0]?(this.context_prop_matches=this.context_prop_matches||[],this.context_prop_matches.push([e.substring(1),n?t:[t]]),delete this.filter[e]):-1===e.indexOf(".")&&(this.feature_prop_matches=this.feature_prop_matches||[],this.feature_prop_matches.push([e,n?t:[t]]),delete this.filter[e])}})}doPropMatches(e){if(this.feature_prop_matches)for(let t=0;t<this.feature_prop_matches.length;t++){let r=this.feature_prop_matches[t],n=e.feature.properties[r[0]];if(null==n||-1===r[1].indexOf(n))return!1}if(this.context_prop_matches)for(let t=0;t<this.context_prop_matches.length;t++){let r=this.context_prop_matches[t],n=e[r[0]];if(null==n||-1===r[1].indexOf(n))return!1}return!0}doesMatch(e){if(!this.enabled)return!1;if(this.is_built||this.build(),null!=this.zooms&&!this.zooms[e.zoom])return!1;if(!this.doPropMatches(e))return!1;let t;if(this.filter instanceof Function)try{t=this.filter(e)}catch(t){let r=`Filter for this ${this.full_name}: \`filter: ${this.filter_original}\` `;r+=`failed with error '${t.message}', stack trace: ${t.stack}`,_("error",r,e.feature)}else t=null==this.filter;return!!t&&(this.children_to_parse&&(function(e,t,r){for(let n in t){let i=t[n];if("object"!=typeof i||Array.isArray(i)){let t=`Layer value must be an object: cannot create layer '${n}: ${JSON.stringify(i)}'`;t+=`, under parent layer '${e.full_name}'.`,r[e.name]&&(t+=` The parent name '${e.name}' is also the name of a style, did you mean to create a 'draw' group`,e.parent&&(t+=` under '${e.parent.name}'`),t+=" instead?"),_("warn",t)}else Kn(n,i,e,r)}e.layers.sort((e,t)=>{if(e.exclusive<t.exclusive)return 1;if(e.exclusive>t.exclusive)return-1;const r=e.exclusive?1:-1;return e.priority>t.priority?r:e.priority<t.priority?-r:e.full_name<t.full_name?r:e.full_name>t.full_name?-r:void 0})}(this,this.children_to_parse,this.styles),delete this.children_to_parse),!0)}}$n.id=0;class qn extends $n{constructor(e){super(e),this.is_leaf=!0}}class Wn extends $n{constructor(e){super(e),this.is_tree=!0,this.layers=e.layers||[]}addLayer(e){this.layers.push(e)}buildDrawGroups(e){let t=[],r=[];if(Xn(e,[this],t,r),t.length>0){let e=function(e){if(e.length>1){for(var t=e[0],r=1;r<e.length;r++)t+="/"+e[r];return t}return e[0]}(r);if(void 0===Bn[e]){let r=t.map(e=>e&&!1!==e.visible&&e.calculatedDraw),n={};for(let e=0;e<r.length;e++){let t=r[e];if(t)for(let e=0;e<t.length;e++){let r=t[e];for(let e in r)n[e]=!0}}for(let i in n)Bn[e]=Bn[e]||{},Bn[e][i]=Vn(r,i),Bn[e][i]?(Bn[e][i].key=e+"/"+i,Bn[e][i].layers=t.map(e=>e&&e.full_name),Bn[e][i].group=i):delete Bn[e][i];Bn[e]&&0===Object.keys(Bn[e]).length&&(Bn[e]=null)}return Bn[e]}}}const Hn={rangeTransform:e=>"string"==typeof e&&"px2"===e.trim().slice(-3)?`${parseFloat(e)} * context.meters_per_pixel_sq`:e};function Zn(e){return Un.indexOf(e)>-1}function Kn(e,t,r,n){let i={name:e,layer:t=null==t?{}:t,parent:r,styles:n},[s,o]=function(e){let t={},r={};for(let n in e)Zn(n)?t[n]=e[n]:r[n]=e[n];return[t,r]}(t),a=(l=o,0===Object.keys(l).length);var l;let u;u=a&&null!=r?qn:Wn;let c=new u(Object.assign(i,s));return c.enabled&&(r&&r.addLayer(c),c.children_to_parse=a?null:o),c}function Xn(e,t,r,n){let i=!1,s=!1;if(0!==t.length){for(let o=0;o<t.length;o++){let a=t[o];if(a.is_leaf){if(a.doesMatch(e)&&(i=!0,r.push(a),n.push(a.id),a.exclusive))break}else if(a.is_tree&&a.doesMatch(e)&&(i=!0,s=Xn(e,a.layers,r,n),s||(r.push(a),n.push(a.id)),a.exclusive))break}return i}}function Yn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Qn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Yn(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yn(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}let Jn=0,ei=0;class ti{constructor({coords:e,style_z:t,source:r,workers:n,view:i}){this.id=Jn++,this.view=i,this.source=r,this.generation=null,this.valid=!0,this.visible=!1,this.proxy_for=null,this.proxied_as=null,this.proxy_level=0,this.proxy_order_offset=0,this.fade_in=!0,this.loading=!1,this.loaded=!1,this.built=!1,this.labeled=!1,this.error=null,this.debug={},this.style_z=t,this.coords=Se.normalizedCoord(e,this.source),this.key=Se.key(this.coords,this.source,this.style_z),this.overzoom=Math.max(this.style_z-this.coords.z,0),this.overzoom2=Math.pow(2,this.overzoom),this.min=G.metersForTile(this.coords),this.max=G.metersForTile({x:this.coords.x+1,y:this.coords.y+1,z:this.coords.z}),this.span={x:this.max.x-this.min.x,y:-(this.max.y-this.min.y)},this.bounds={sw:{x:this.min.x,y:this.max.y},ne:{x:this.max.x,y:this.min.y}},this.meters_per_pixel=G.metersPerPixel(this.style_z),this.meters_per_pixel_sq=this.meters_per_pixel*this.meters_per_pixel,this.units_per_pixel=G.units_per_pixel/this.overzoom2,this.units_per_meter_overzoom=G.unitsPerMeter(this.coords.z)*this.overzoom2,this.preserve_tiles_within_zoom=this.source.preserve_tiles_within_zoom,this.meshes={},this.new_mesh_styles=[],this.pending_label_meshes=null,this.setWorker(n)}freeResources(){for(let e in this.meshes)this.meshes[e].forEach(e=>e.destroy());if(this.meshes={},this.pending_label_meshes)for(let e in this.pending_label_meshes)this.pending_label_meshes[e].forEach(e=>e.destroy());this.pending_label_meshes=null}destroy(){E.removeForTile(this.id),this.workerMessage("self.removeTile",this.key),this.freeResources(),this.worker=null,this.valid=!1}buildAsMessage(){return{id:this.id,key:this.key,source:this.source.name,coords:this.coords,min:this.min,max:this.max,units_per_pixel:this.units_per_pixel,meters_per_pixel:this.meters_per_pixel,meters_per_pixel_sq:this.meters_per_pixel_sq,units_per_meter_overzoom:this.units_per_meter_overzoom,style_z:this.style_z,overzoom:this.overzoom,overzoom2:this.overzoom2,generation:this.generation,debug:this.debug}}setWorker(e){this.source.tiled?this.worker_id=Math.abs(this.coords.x+this.coords.y+this.coords.z)%e.length:this.worker_id=this.source.id%e.length,this.worker=e[this.worker_id]}workerMessage(...e){return a.postMessage(this.worker,...e)}build(e,{fade_in:t=!0}={}){return this.generation=e,this.fade_in=t,this.loaded||(this.loading=!0,this.built=!1,this.labeled=!1),this.workerMessage("self.buildTile",{tile:this.buildAsMessage()}).catch(e=>{throw e})}static cancel(e){e&&(e.canceled=!0,e.source_data&&e.source_data.request_id&&(g.cancelRequest(e.source_data.request_id),e.source_data.request_id=null),ti.abortBuild(e))}static buildGeometry(e,{scene_id:t,layers:r,styles:n,global:i}){let s=e.source_data;e.debug.building=+new Date,e.debug.feature_count=0,e.debug.layers=null,$t.startTile(e.id,{apply_repeat_groups:!0});for(let t in r){let o=r[t];if(!o||!o.config_data){_("warn",`Layer ${t} was defined without a geometry data source and will not be rendered.`);continue}if(o.config_data.source!==e.source)continue;let a=ti.getDataForSource(s,o.config_data,t);for(let r=0;r<a.length;r++){let s=a[r],l=s.geom;if(l)for(let r=0;r<l.features.length;r++){let a=l.features[r];if(null==a.geometry)continue;let u=J.getFeatureParseContext(a,e,i);u.winding=e.default_winding,u.source=e.source,u.layer=s.layer;let c=o.buildDrawGroups(u,!0);if(c){for(let e in c){let r=c[e],i=r.style||e,s=n[i];s?(r=s.preprocess(r),null!=r&&!1!==r.visible&&(u.layers=r.layers,s.addFeature(a,r,u))):_("warn",`Style '${i}' not found, skipping layer '${t}':`,r,a)}e.debug.feature_count++}}}}e.debug.building=+new Date-e.debug.building;let o=this.stylesForTile(e,n).map(e=>n[e]);ti.buildStyleGroups(e,o,t,e=>e.collision?"collision":"non-collision")}static stylesForTile(e,t){let r=[];for(let n in t)t[n].hasDataForTile(e)&&r.push(n);return r}static buildStyleGroups(e,t,r,n){const i=t.reduce((e,t)=>{const r=n(t);return e[r]=e[r]||[],e[r].push(t),e},{});if(0===Object.keys(i).length)return a.postMessage(`TileManager_${r}.buildTileStylesCompleted`,a.withTransferables({tile:ti.slice(e),progress:{start:!0,done:!0}})),void $t.resetTile(e.id);const s={};for(const t in i)ti.buildStyleGroup({group_name:t,groups:i,tile:e,progress:s,scene_id:r})}static async buildStyleGroup({group_name:e,groups:t,tile:r,progress:n,scene_id:i}){const s=t[e],o={};try{await Promise.all(s.map(async function(e){const t=await e.endData(r);t&&(o[e.name]=t)})),_("trace",`Finished style group '${e}' for tile ${r.key}`),t[e]=null,Object.keys(t).every(e=>null==t[e])&&(n.done=!0),a.postMessage(`TileManager_${i}.buildTileStylesCompleted`,a.withTransferables({tile:Qn(Qn({},ti.slice(r)),{},{mesh_data:o}),progress:n})),n.done&&$t.resetTile(r.id)}catch(t){_("error",`Error for style group '${e}' for tile ${r.key}`,t&&t.stack||t)}}static getDataForSource(e,t,r){var n=[];if(null!=t&&null!=e&&null!=e.layers)if(!0===t.all_layers){null!=t.layer&&_({level:"warn",once:!0},`Layer ${r} includes both 'all_layers: true' and an explicit 'layer' keyword in its 'data' block. 'all_layers: true' takes precedence, 'layer' will be ignored.`);for(const t in e.layers)n.push({layer:t,geom:e.layers[t]})}else!t.layer&&e.layers._default?n.push({geom:e.layers._default}):!t.layer&&r?n.push({layer:r,geom:e.layers[r]}):"string"==typeof t.layer?n.push({layer:t.layer,geom:e.layers[t.layer]}):Array.isArray(t.layer)&&t.layer.forEach(t=>{n.push({layer:t,geom:e.layers[t]})});return n}buildMeshes(e,t){if(this.error)return;this.build_id=ei++,t.start&&(this.debug.geometry_count=0,this.debug.buffer_size=0);let r={},n=this.mesh_data;if(n)for(let t in n){for(let i in n[t].meshes){let s=n[t].meshes[i];if(s.vertex_data){if(!e[t]){_("warn",`Could not create mesh because style '${t}' not found, for tile ${this.key}, aborting tile`);break}let i=Object.assign({},n[t]);i.uniforms=Object.assign({},i.uniforms,s.uniforms),i.variant=s.variant,s.labels&&(i.retain=!0);let o=e[t].makeMesh(s.vertex_data,s.vertex_elements,i);o.variant=i.variant,o.labels=s.labels,r[t]=r[t]||[],r[t].push(o),null==o.variant.mesh_order&&(o.variant.mesh_order=r[t].length-1),this.debug.buffer_size+=o.buffer_size,this.debug.geometry_count+=o.geometry_count}}r[t]&&r[t].sort((e,t)=>{let r=e.variant.mesh_order,n=t.variant.mesh_order;return null==r?1:null==n||r<n?-1:1})}delete this.mesh_data;for(let t in r)e[t].collision?(this.pending_label_meshes=this.pending_label_meshes||{},this.pending_label_meshes[t]=r[t]):(this.meshes[t]&&this.meshes[t].forEach(e=>e.destroy()),this.meshes[t]=r[t],this.new_mesh_styles.push(t));if(t.done){for(let e in this.meshes)-1!==this.new_mesh_styles.indexOf(e)||this.pending_label_meshes&&null!=this.pending_label_meshes[e]||(this.meshes[e].forEach(e=>e.destroy()),delete this.meshes[e]);this.new_mesh_styles=[],this.debug.geometry_ratio=(this.debug.geometry_count/this.debug.feature_count).toFixed(1)}this.printDebug(t)}pendingLabelStyleCount(){return this.pending_label_meshes?Object.keys(this.pending_label_meshes).length:0}swapPendingLabels(){if(this.labeled=!0,this.pending_label_meshes){for(let e in this.pending_label_meshes)this.meshes[e]&&this.meshes[e].forEach(e=>e.destroy()),this.meshes[e]=this.pending_label_meshes[e];this.pending_label_meshes=null}}static abortBuild(e){if(E.removeForTile(e.id),$t.abortTile(e.id),e.mesh_data)for(let t in e.mesh_data){let r=e.mesh_data[t].textures;r&&r.forEach(t=>{let r=k.textures[t];r&&(_("trace",`releasing texture ${t} for tile ${e.key}`),r.release())})}}setProxyFor(e){e?(this.visible=!0,this.proxy_for=this.proxy_for||[],this.proxy_for.push(e),this.proxy_order_offset=1,e.proxied_as=e.style_z>this.style_z?"child":"parent",this.proxy_level=Math.abs(e.style_z-this.style_z)):(this.proxy_for=null,this.proxy_order_offset=0,this.proxy_level=0)}isProxy(){return null!=this.proxy_for}shouldProxyForStyle(e){return!this.proxy_for||this.proxy_for.some(t=>null==t.meshes[e])}setupProgram({model:e,model32:t},r){r.uniform("4fv","u_tile_origin",[this.min.x,this.min.y,this.style_z,this.coords.z]),r.uniform("1f","u_tile_proxy_order_offset",this.proxy_order_offset),nn.identity(e),nn.translate(e,e,tn.fromValues(this.min.x,this.min.y,0)),nn.scale(e,e,tn.fromValues(this.span.x/G.tile_scale,this.span.y/G.tile_scale,1)),nn.copy(t,e),r.uniform("Matrix4fv","u_model",t),r.uniform("1i","u_tile_fade_in",this.fade_in&&"child"!==this.proxied_as)}static slice(e,t){let r=["id","key","loading","loaded","generation","error","debug"];Array.isArray(t)&&r.push(...t);var n={};for(let t=0;t<r.length;t++){const i=r[t];n[i]=e[i]}return n}merge(e){return this.loading=e.loading,this.loaded=e.loaded,this.generation=e.generation,this.error=e.error,this.mesh_data=e.mesh_data,this.debug=V(this.debug,e.debug),this}printDebug(e){const t=["layers"];let r={};for(let e in this.debug)-1===t.indexOf(e)&&(r[e]=this.debug[e]);_("debug",`Tile ${e.done?"(done)":""}: debug for ${this.key}: [ ${JSON.stringify(r)} ]`)}}function ri(e,t){for(let r in e){let n=e[r];Pe(t,r,n.features,n.geoms,n.styles,n.base),n.layers&&(t[r].layers=t[r].layers||{},ri(n.layers,t[r].layers))}}ti.coord_children={};var ni,ii,si,oi={};var ai,li,ui,ci,hi,di,fi,pi,mi,_i=function(){if(si)return ii;si=1,ii=t;var e=(ni||(ni=1,oi.read=function(e,t,r,n,i){var s,o,a=8*i-n-1,l=(1<<a)-1,u=l>>1,c=-7,h=r?i-1:0,d=r?-1:1,f=e[t+h];for(h+=d,s=f&(1<<-c)-1,f>>=-c,c+=a;c>0;s=256*s+e[t+h],h+=d,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+e[t+h],h+=d,c-=8);if(0===s)s=1-u;else{if(s===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),s-=u}return(f?-1:1)*o*Math.pow(2,s-n)},oi.write=function(e,t,r,n,i,s){var o,a,l,u=8*s-i-1,c=(1<<u)-1,h=c>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,p=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(o++,l/=2),o+h>=c?(a=0,o=c):o+h>=1?(a=(t*l-1)*Math.pow(2,i),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[r+f]=255&a,f+=p,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;e[r+f]=255&o,f+=p,o/=256,u-=8);e[r+f-p]|=128*m}),oi);function t(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var r=4294967296,n=1/r;function i(e){return e.type===t.Bytes?e.readVarint()+e.pos:e.pos+1}function s(e,t,r){return r?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function o(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.ceil(Math.log(t)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=e;i--)r.buf[i+n]=r.buf[i]}function a(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function l(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function u(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function c(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function h(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function d(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function f(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function p(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function m(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function _(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function g(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function y(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,s=this.pos;this.type=7&n,e(i,t,this),this.pos===s&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=_(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=y(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=_(this.buf,this.pos)+_(this.buf,this.pos+4)*r;return this.pos+=8,e},readSFixed64:function(){var e=_(this.buf,this.pos)+y(this.buf,this.pos+4)*r;return this.pos+=8,e},readFloat:function(){var t=e.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=e.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(e){var t,r,n=this.buf;return t=127&(r=n[this.pos++]),r<128?t:(t|=(127&(r=n[this.pos++]))<<7,r<128?t:(t|=(127&(r=n[this.pos++]))<<14,r<128?t:(t|=(127&(r=n[this.pos++]))<<21,r<128?t:function(e,t,r){var n,i,o=r.buf;if(n=(112&(i=o[r.pos++]))>>4,i<128)return s(e,n,t);if(n|=(127&(i=o[r.pos++]))<<3,i<128)return s(e,n,t);if(n|=(127&(i=o[r.pos++]))<<10,i<128)return s(e,n,t);if(n|=(127&(i=o[r.pos++]))<<17,i<128)return s(e,n,t);if(n|=(127&(i=o[r.pos++]))<<24,i<128)return s(e,n,t);if(n|=(1&(i=o[r.pos++]))<<31,i<128)return s(e,n,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(r=n[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=function(e,t,r){for(var n="",i=t;i<r;){var s,o,a,l=e[i],u=null,c=l>239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(s=e[i+1]))&&(u=(31&l)<<6|63&s)<=127&&(u=null):3===c?(s=e[i+1],o=e[i+2],128==(192&s)&&128==(192&o)&&((u=(15&l)<<12|(63&s)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(s=e[i+1],o=e[i+2],a=e[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&((u=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c}return n}(this.buf,this.pos,e);return this.pos=e,t},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){var r=i(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var r=7&e;if(r===t.Varint)for(;this.buf[this.pos++]>127;);else if(r===t.Bytes)this.pos=this.readVarint()+this.pos;else if(r===t.Fixed32)this.pos+=4;else{if(r!==t.Fixed64)throw new Error("Unimplemented type: "+r);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),g(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),g(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),g(this.buf,-1&e,this.pos),g(this.buf,Math.floor(e*n),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),g(this.buf,-1&e,this.pos),g(this.buf,Math.floor(e*n),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(n=~(-e/4294967296),4294967295^(r=~(-e%4294967296))?r=r+1|0:(r=0,n=n+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,r){r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos]=127&e}(r,0,t),function(e,t){var r=(7&e)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(n,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,r){for(var n,i,s=0;s<t.length;s++){if((n=t.charCodeAt(s))>55295&&n<57344){if(!i){n>56319||s+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):i=n;continue}if(n<56320){e[r++]=239,e[r++]=191,e[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(e[r++]=239,e[r++]=191,e[r++]=189,i=null);n<128?e[r++]=n:(n<2048?e[r++]=n>>6|192:(n<65536?e[r++]=n>>12|224:(e[r++]=n>>18|240,e[r++]=n>>12&63|128),e[r++]=n>>6&63|128),e[r++]=63&n|128)}return r}(this.buf,e,this.pos);var r=this.pos-t;r>=128&&o(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),e.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),e.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var n=this.pos-r;n>=128&&o(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,r,n){this.writeTag(e,t.Bytes),this.writeRawMessage(r,n)},writePackedVarint:function(e,t){this.writeMessage(e,a,t)},writePackedSVarint:function(e,t){this.writeMessage(e,l,t)},writePackedBoolean:function(e,t){this.writeMessage(e,h,t)},writePackedFloat:function(e,t){this.writeMessage(e,u,t)},writePackedDouble:function(e,t){this.writeMessage(e,c,t)},writePackedFixed32:function(e,t){this.writeMessage(e,d,t)},writePackedSFixed32:function(e,t){this.writeMessage(e,f,t)},writePackedFixed64:function(e,t){this.writeMessage(e,p,t)},writePackedSFixed64:function(e,t){this.writeMessage(e,m,t)},writeBytesField:function(e,r){this.writeTag(e,t.Bytes),this.writeBytes(r)},writeFixed32Field:function(e,r){this.writeTag(e,t.Fixed32),this.writeFixed32(r)},writeSFixed32Field:function(e,r){this.writeTag(e,t.Fixed32),this.writeSFixed32(r)},writeFixed64Field:function(e,r){this.writeTag(e,t.Fixed64),this.writeFixed64(r)},writeSFixed64Field:function(e,r){this.writeTag(e,t.Fixed64),this.writeSFixed64(r)},writeVarintField:function(e,r){this.writeTag(e,t.Varint),this.writeVarint(r)},writeSVarintField:function(e,r){this.writeTag(e,t.Varint),this.writeSVarint(r)},writeStringField:function(e,r){this.writeTag(e,t.Bytes),this.writeString(r)},writeFloatField:function(e,r){this.writeTag(e,t.Fixed32),this.writeFloat(r)},writeDoubleField:function(e,r){this.writeTag(e,t.Fixed64),this.writeDouble(r)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}},ii}(),gi=P(_i),yi={};function vi(){if(ci)return ui;ci=1;var e=function(){if(li)return ai;function e(e,t){this.x=e,this.y=t}return li=1,ai=e,e.prototype={clone:function(){return new e(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,r=e.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,r=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=r,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),r=Math.sin(e),n=t*this.x-r*this.y,i=r*this.x+t*this.y;return this.x=n,this.y=i,this},_rotateAround:function(e,t){var r=Math.cos(e),n=Math.sin(e),i=t.x+r*(this.x-t.x)-n*(this.y-t.y),s=t.y+n*(this.x-t.x)+r*(this.y-t.y);return this.x=i,this.y=s,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},e.convert=function(t){return t instanceof e?t:Array.isArray(t)?new e(t[0],t[1]):t},ai}();function t(e,t,n,i,s){this.properties={},this.extent=n,this.type=0,this._pbf=e,this._geometry=-1,this._keys=i,this._values=s,e.readFields(r,this,t)}function r(e,t,r){1==e?t.id=r.readVarint():2==e?function(e,t){for(var r=e.readVarint()+e.pos;e.pos<r;){var n=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[n]=i}}(r,t):3==e?t.type=r.readVarint():4==e&&(t._geometry=r.pos)}function n(e){for(var t,r,n=0,i=0,s=e.length,o=s-1;i<s;o=i++)t=e[i],n+=((r=e[o]).x-t.x)*(t.y+r.y);return n}return ui=t,t.types=["Unknown","Point","LineString","Polygon"],t.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var r,n=t.readVarint()+t.pos,i=1,s=0,o=0,a=0,l=[];t.pos<n;){if(!s){var u=t.readVarint();i=7&u,s=u>>3}if(s--,1===i||2===i)o+=t.readSVarint(),a+=t.readSVarint(),1===i&&(r&&l.push(r),r=[]),r.push(new e(o,a));else{if(7!==i)throw new Error("unknown command "+i);r&&r.push(r[0].clone())}}return r&&l.push(r),l},t.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,r=1,n=0,i=0,s=0,o=1/0,a=-1/0,l=1/0,u=-1/0;e.pos<t;){if(!n){var c=e.readVarint();r=7&c,n=c>>3}if(n--,1===r||2===r)(i+=e.readSVarint())<o&&(o=i),i>a&&(a=i),(s+=e.readSVarint())<l&&(l=s),s>u&&(u=s);else if(7!==r)throw new Error("unknown command "+r)}return[o,l,a,u]},t.prototype.toGeoJSON=function(e,r,i){var s,o,a=this.extent*Math.pow(2,i),l=this.extent*e,u=this.extent*r,c=this.loadGeometry(),h=t.types[this.type];function d(e){for(var t=0;t<e.length;t++){var r=e[t],n=180-360*(r.y+u)/a;e[t]=[360*(r.x+l)/a-180,360/Math.PI*Math.atan(Math.exp(n*Math.PI/180))-90]}}switch(this.type){case 1:var f=[];for(s=0;s<c.length;s++)f[s]=c[s][0];d(c=f);break;case 2:for(s=0;s<c.length;s++)d(c[s]);break;case 3:for(c=function(e){var t=e.length;if(t<=1)return[e];for(var r,i,s=[],o=0;o<t;o++){var a=n(e[o]);0!==a&&(void 0===i&&(i=a<0),i===a<0?(r&&s.push(r),r=[e[o]]):r.push(e[o]))}return r&&s.push(r),s}(c),s=0;s<c.length;s++)for(o=0;o<c[s].length;o++)d(c[s][o])}1===c.length?c=c[0]:h="Multi"+h;var p={type:"Feature",geometry:{type:h,coordinates:c},properties:this.properties};return"id"in this&&(p.id=this.id),p},ui}function bi(){if(di)return hi;di=1;var e=vi();function t(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(r,this,t),this.length=this._features.length}function r(e,t,r){15===e?t.version=r.readVarint():1===e?t.name=r.readString():5===e?t.extent=r.readVarint():2===e?t._features.push(r.pos):3===e?t._keys.push(r.readString()):4===e&&t._values.push(function(e){for(var t=null,r=e.readVarint()+e.pos;e.pos<r;){var n=e.readVarint()>>3;t=1===n?e.readString():2===n?e.readFloat():3===n?e.readDouble():4===n?e.readVarint64():5===n?e.readVarint():6===n?e.readSVarint():7===n?e.readBoolean():null}return t}(r))}return hi=t,t.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var r=this._pbf.readVarint()+this._pbf.pos;return new e(this._pbf,r,this.extent,this._keys,this._values)},hi}var xi=(mi||(mi=1,yi.VectorTile=function(){if(pi)return fi;pi=1;var e=bi();function t(t,r,n){if(3===t){var i=new e(n,n.readVarint()+n.pos);i.length&&(r[i.name]=i)}}return fi=function(e,r){this.layers=e.readFields(t,{},r)},fi}(),yi.VectorTileFeature=vi(),yi.VectorTileLayer=bi()),yi);const wi=["{","["];class Ai extends Te{constructor(e,t){super(e,t),this.response_type="arraybuffer",!0===e.parse_json?this.parse_json_type=1:Array.isArray(e.parse_json)?(this.parse_json_type=2,this.parse_json_prop_list=e.parse_json):(null!=e.parse_json&&_({level:"warn",once:!0},`Data source '${this.name}': 'parse_json' parameter should be 'true', or an array of property names (was '${JSON.stringify(e.parse_json)}')`),this.parse_json_type=0)}parseSourceData(e,t,r){var n=new Uint8Array(r),i=new gi(n);if(t.data=new xi.VectorTile(i),t.layers=this.toGeoJSON(t.data),"function"==typeof this.transform){const r={min:Object.assign({},e.min),max:Object.assign({},e.max),coords:Object.assign({},e.coords)};t.layers=this.transform(t.layers,this.extra_data,r)}delete t.data}toGeoJSON(e){var t={};for(var r in e.layers){for(var n=e.layers[r],i=G.tile_scale/n.extent,s={type:"FeatureCollection",features:[]},o=0;o<n.length;o++){var a=n.feature(o),l={type:"Feature",geometry:{},id:a.id,properties:a.properties};this.parseJSONProperties(l);for(var u=l.geometry,c=a.loadGeometry(),h=0;h<c.length;h++)for(var d=c[h],f=0;f<d.length;f++)d[f]=[d[f].x*i,d[f].y*i];u.coordinates=c,"Point"===xi.VectorTileFeature.types[a.type]?1===c.length?(u.type="Point",u.coordinates=u.coordinates[0][0]):(u.type="MultiPoint",u.coordinates=u.coordinates[0]):"LineString"===xi.VectorTileFeature.types[a.type]?1===c.length?(u.type="LineString",u.coordinates=u.coordinates[0]):u.type="MultiLineString":"Polygon"===xi.VectorTileFeature.types[a.type]&&(u=Ei(u)),s.features.push(l)}t[r]=s}return t}parseJSONProperties(e){if(0!==this.parse_json_type){const t=e.properties;if(2===this.parse_json_type)this.parse_json_prop_list.forEach(e=>{try{t[e]=JSON.parse(t[e])}catch(e){}});else for(const r in t)if(wi.indexOf(t[r][0])>-1)try{t[r]=JSON.parse(t[r])}catch(e){}}}}function Ei(e){let t,r=[],n=[];for(let i=0;i<e.coordinates.length;i++){let s=e.coordinates[i],o=G.ringWinding(s);null!=o&&(t=t||o,o===t&&n.length>0&&(r.push(n),n=[]),n.push(s))}return n.length>0&&r.push(n),1===r.length?(e.type="Polygon",e.coordinates=r[0]):r.length>1?(e.type="MultiPolygon",e.coordinates=r):e=null,e}function Ti(e,t,r,n){for(var i,s=n,o=r-t>>1,a=r-t,l=e[t],u=e[t+1],c=e[r],h=e[r+1],d=t+3;d<r;d+=3){var f=Si(e[d],e[d+1],l,u,c,h);if(f>s)i=d,s=f;else if(f===s){var p=Math.abs(d-o);p<a&&(i=d,a=p)}}s>n&&(i-t>3&&Ti(e,t,i,n),e[i+2]=s,r-i>3&&Ti(e,i,r,n))}function Si(e,t,r,n,i,s){var o=i-r,a=s-n;if(0!==o||0!==a){var l=((e-r)*o+(t-n)*a)/(o*o+a*a);l>1?(r=i,n=s):l>0&&(r+=o*l,n+=a*l)}return(o=e-r)*o+(a=t-n)*a}function ki(e,t,r,n){var i={id:void 0===e?null:e,type:t,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,r=e.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)Oi(e,t);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n<t.length;n++)Oi(e,t[n]);else if("MultiPolygon"===r)for(n=0;n<t.length;n++)for(var i=0;i<t[n].length;i++)Oi(e,t[n][i])}(i),i}function Oi(e,t){for(var r=0;r<t.length;r+=3)e.minX=Math.min(e.minX,t[r]),e.minY=Math.min(e.minY,t[r+1]),e.maxX=Math.max(e.maxX,t[r]),e.maxY=Math.max(e.maxY,t[r+1])}function Ri(e,t,r,n){if(t.geometry){var i=t.geometry.coordinates,s=t.geometry.type,o=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),a=[],l=t.id;if(r.promoteId?l=t.properties[r.promoteId]:r.generateId&&(l=n||0),"Point"===s)Ci(i,a);else if("MultiPoint"===s)for(var u=0;u<i.length;u++)Ci(i[u],a);else if("LineString"===s)Ni(i,a,o,!1);else if("MultiLineString"===s){if(r.lineMetrics){for(u=0;u<i.length;u++)a=[],Ni(i[u],a,o,!1),e.push(ki(l,"LineString",a,t.properties));return}Pi(i,a,o,!1)}else if("Polygon"===s)Pi(i,a,o,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<t.geometry.geometries.length;u++)Ri(e,{id:l,geometry:t.geometry.geometries[u],properties:t.properties},r,n);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<i.length;u++){var c=[];Pi(i[u],c,o,!0),a.push(c)}}e.push(ki(l,s,a,t.properties))}}function Ci(e,t){t.push(Mi(e[0])),t.push(Di(e[1])),t.push(0)}function Ni(e,t,r,n){for(var i,s,o=0,a=0;a<e.length;a++){var l=Mi(e[a][0]),u=Di(e[a][1]);t.push(l),t.push(u),t.push(0),a>0&&(o+=n?(i*u-l*s)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(u-s,2))),i=l,s=u}var c=t.length-3;t[2]=1,Ti(t,0,c,r),t[c+2]=1,t.size=Math.abs(o),t.start=0,t.end=t.size}function Pi(e,t,r,n){for(var i=0;i<e.length;i++){var s=[];Ni(e[i],s,r,n),t.push(s)}}function Mi(e){return e/360+.5}function Di(e){var t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function zi(e,t,r,n,i,s,o,a){if(n/=t,s>=(r/=t)&&o<n)return e;if(o<r||s>=n)return null;for(var l=[],u=0;u<e.length;u++){var c=e[u],h=c.geometry,d=c.type,f=0===i?c.minX:c.minY,p=0===i?c.maxX:c.maxY;if(f>=r&&p<n)l.push(c);else if(!(p<r||f>=n)){var m=[];if("Point"===d||"MultiPoint"===d)Ii(h,m,r,n,i);else if("LineString"===d)Fi(h,m,r,n,i,!1,a.lineMetrics);else if("MultiLineString"===d)ji(h,m,r,n,i,!1);else if("Polygon"===d)ji(h,m,r,n,i,!0);else if("MultiPolygon"===d)for(var _=0;_<h.length;_++){var g=[];ji(h[_],g,r,n,i,!0),g.length&&m.push(g)}if(m.length){if(a.lineMetrics&&"LineString"===d){for(_=0;_<m.length;_++)l.push(ki(c.id,d,m[_],c.tags));continue}"LineString"!==d&&"MultiLineString"!==d||(1===m.length?(d="LineString",m=m[0]):d="MultiLineString"),"Point"!==d&&"MultiPoint"!==d||(d=3===m.length?"Point":"MultiPoint"),l.push(ki(c.id,d,m,c.tags))}}}return l.length?l:null}function Ii(e,t,r,n,i){for(var s=0;s<e.length;s+=3){var o=e[s+i];o>=r&&o<=n&&(t.push(e[s]),t.push(e[s+1]),t.push(e[s+2]))}}function Fi(e,t,r,n,i,s,o){for(var a,l,u=Li(e),c=0===i?Bi:Vi,h=e.start,d=0;d<e.length-3;d+=3){var f=e[d],p=e[d+1],m=e[d+2],_=e[d+3],g=e[d+4],y=0===i?f:p,v=0===i?_:g,b=!1;o&&(a=Math.sqrt(Math.pow(f-_,2)+Math.pow(p-g,2))),y<r?v>r&&(l=c(u,f,p,_,g,r),o&&(u.start=h+a*l)):y>n?v<n&&(l=c(u,f,p,_,g,n),o&&(u.start=h+a*l)):Ui(u,f,p,m),v<r&&y>=r&&(l=c(u,f,p,_,g,r),b=!0),v>n&&y<=n&&(l=c(u,f,p,_,g,n),b=!0),!s&&b&&(o&&(u.end=h+a*l),t.push(u),u=Li(e)),o&&(h+=a)}var x=e.length-3;f=e[x],p=e[x+1],m=e[x+2],(y=0===i?f:p)>=r&&y<=n&&Ui(u,f,p,m),x=u.length-3,s&&x>=3&&(u[x]!==u[0]||u[x+1]!==u[1])&&Ui(u,u[0],u[1],u[2]),u.length&&t.push(u)}function Li(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function ji(e,t,r,n,i,s){for(var o=0;o<e.length;o++)Fi(e[o],t,r,n,i,s,!1)}function Ui(e,t,r,n){e.push(t),e.push(r),e.push(n)}function Bi(e,t,r,n,i,s){var o=(s-t)/(n-t);return e.push(s),e.push(r+(i-r)*o),e.push(1),o}function Vi(e,t,r,n,i,s){var o=(s-r)/(i-r);return e.push(t+(n-t)*o),e.push(s),e.push(1),o}function Gi(e,t){for(var r=[],n=0;n<e.length;n++){var i,s=e[n],o=s.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)i=$i(s.geometry,t);else if("MultiLineString"===o||"Polygon"===o){i=[];for(var a=0;a<s.geometry.length;a++)i.push($i(s.geometry[a],t))}else if("MultiPolygon"===o)for(i=[],a=0;a<s.geometry.length;a++){for(var l=[],u=0;u<s.geometry[a].length;u++)l.push($i(s.geometry[a][u],t));i.push(l)}r.push(ki(s.id,o,i,s.tags))}return r}function $i(e,t){var r=[];r.size=e.size,void 0!==e.start&&(r.start=e.start,r.end=e.end);for(var n=0;n<e.length;n+=3)r.push(e[n]+t,e[n+1],e[n+2]);return r}function qi(e,t){if(e.transformed)return e;var r,n,i,s=1<<e.z,o=e.x,a=e.y;for(r=0;r<e.features.length;r++){var l=e.features[r],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(n=0;n<u.length;n+=2)l.geometry.push(Wi(u[n],u[n+1],t,s,o,a));else for(n=0;n<u.length;n++){var h=[];for(i=0;i<u[n].length;i+=2)h.push(Wi(u[n][i],u[n][i+1],t,s,o,a));l.geometry.push(h)}}return e.transformed=!0,e}function Wi(e,t,r,n,i,s){return[Math.round(r*(e*n-i)),Math.round(r*(t*n-s))]}function Hi(e,t,r,n,i){for(var s=t===i.maxZoom?0:i.tolerance/((1<<t)*i.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<e.length;a++){o.numFeatures++,Zi(o,e[a],s,i);var l=e[a].minX,u=e[a].minY,c=e[a].maxX,h=e[a].maxY;l<o.minX&&(o.minX=l),u<o.minY&&(o.minY=u),c>o.maxX&&(o.maxX=c),h>o.maxY&&(o.maxY=h)}return o}function Zi(e,t,r,n){var i=t.geometry,s=t.type,o=[];if("Point"===s||"MultiPoint"===s)for(var a=0;a<i.length;a+=3)o.push(i[a]),o.push(i[a+1]),e.numPoints++,e.numSimplified++;else if("LineString"===s)Ki(o,i,e,r,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(a=0;a<i.length;a++)Ki(o,i[a],e,r,"Polygon"===s,0===a);else if("MultiPolygon"===s)for(var l=0;l<i.length;l++){var u=i[l];for(a=0;a<u.length;a++)Ki(o,u[a],e,r,!0,0===a)}if(o.length){var c=t.tags||null;if("LineString"===s&&n.lineMetrics){for(var h in c={},t.tags)c[h]=t.tags[h];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var d={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:c};null!==t.id&&(d.id=t.id),e.features.push(d)}}function Ki(e,t,r,n,i,s){var o=n*n;if(n>0&&t.size<(i?o:n))r.numPoints+=t.length/3;else{for(var a=[],l=0;l<t.length;l+=3)(0===n||t[l+2]>o)&&(r.numSimplified++,a.push(t[l]),a.push(t[l+1])),r.numPoints++;i&&function(e,t){for(var r=0,n=0,i=e.length,s=i-2;n<i;s=n,n+=2)r+=(e[n]-e[s])*(e[n+1]+e[s+1]);if(r>0===t)for(n=0,i=e.length;n<i/2;n+=2){var o=e[n],a=e[n+1];e[n]=e[i-2-n],e[n+1]=e[i-1-n],e[i-2-n]=o,e[i-1-n]=a}}(a,s),e.push(a)}}function Xi(e,t){return new Yi(e,t)}function Yi(e,t){var r=(t=this.options=function(e,t){for(var r in t)e[r]=t[r];return e}(Object.create(this.options),t)).debug;if(r&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(e,t){var r=[];if("FeatureCollection"===e.type)for(var n=0;n<e.features.length;n++)Ri(r,e.features[n],t,n);else"Feature"===e.type?Ri(r,e,t):Ri(r,{geometry:e},t);return r}(e,t);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=function(e,t){var r=t.buffer/t.extent,n=e,i=zi(e,1,-1-r,r,0,-1,2,t),s=zi(e,1,1-r,2+r,0,-1,2,t);return(i||s)&&(n=zi(e,1,-r,1+r,0,-1,2,t)||[],i&&(n=Gi(i,1).concat(n)),s&&(n=n.concat(Gi(s,-1)))),n}(n,t),n.length&&this.splitTile(n,0,0,0),r&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Qi(e,t,r){return 32*((1<<e)*r+t)+e}we.register("MVT",()=>Ai),Yi.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Yi.prototype.splitTile=function(e,t,r,n,i,s,o){for(var a=[e,t,r,n],l=this.options,u=l.debug;a.length;){n=a.pop(),r=a.pop(),t=a.pop(),e=a.pop();var c=1<<t,h=Qi(t,r,n),d=this.tiles[h];if(!d&&(u>1&&console.time("creation"),d=this.tiles[h]=Hi(e,t,r,n,l),this.tileCoords.push({z:t,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,r,n,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));var f="z"+t;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(d.source=e,i){if(t===l.maxZoom||t===i)continue;var p=1<<i-t;if(r!==Math.floor(s/p)||n!==Math.floor(o/p))continue}else if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue;if(d.source=null,0!==e.length){u>1&&console.time("clipping");var m,_,g,y,v,b,x=.5*l.buffer/l.extent,w=.5-x,A=.5+x,E=1+x;m=_=g=y=null,v=zi(e,c,r-x,r+A,0,d.minX,d.maxX,l),b=zi(e,c,r+w,r+E,0,d.minX,d.maxX,l),e=null,v&&(m=zi(v,c,n-x,n+A,1,d.minY,d.maxY,l),_=zi(v,c,n+w,n+E,1,d.minY,d.maxY,l),v=null),b&&(g=zi(b,c,n-x,n+A,1,d.minY,d.maxY,l),y=zi(b,c,n+w,n+E,1,d.minY,d.maxY,l),b=null),u>1&&console.timeEnd("clipping"),a.push(m||[],t+1,2*r,2*n),a.push(_||[],t+1,2*r,2*n+1),a.push(g||[],t+1,2*r+1,2*n),a.push(y||[],t+1,2*r+1,2*n+1)}}},Yi.prototype.getTile=function(e,t,r){var n=this.options,i=n.extent,s=n.debug;if(e<0||e>24)return null;var o=1<<e,a=Qi(e,t=(t%o+o)%o,r);if(this.tiles[a])return qi(this.tiles[a],i);s>1&&console.log("drilling down to z%d-%d-%d",e,t,r);for(var l,u=e,c=t,h=r;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[Qi(u,c,h)];return l&&l.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,c,h),s>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,e,t,r),s>1&&console.timeEnd("drilling down"),this.tiles[a]?qi(this.tiles[a],i):null):null};class Ji extends Ee{constructor(e,t){super(e,t),this.load_data=null,this.tile_indexes={},this.setTileSize(512),this.pad_scale=0}_load(e){return this.load_data||(this.load_data=super._load({source_data:{layers:{}}}).then(e=>{e.source_data.error&&_("warn",`data source load error(s) for source '${this.name}', URL '${this.url}': ${e.source_data.error}`);let t=e.source_data.layers;for(let e in t)this.tile_indexes[e]=Xi(t[e],{maxZoom:this.max_zoom,tolerance:1.5,extent:G.tile_scale,buffer:1e-4});return this.loaded=!0,e})),this.load_data.then(()=>{for(let t in this.tile_indexes)e.source_data.layers[t]=this.getTileFeatures(e,t);return e})}getTileFeatures(e,t){let r,n=G.wrapTile(e.coords,{x:!0}),i=this.tile_indexes[t].getTile(n.z,n.x,n.y);if(i&&i.features){r={type:"FeatureCollection",features:[]};for(let e=0;e<i.features.length;e++){const t=i.features[e];let n={type:"Feature",geometry:{},id:t.id,properties:t.tags};if(1===t.type)n.geometry.coordinates=t.geometry.map(e=>[e[0],e[1]]),n.geometry.type="MultiPoint";else{if(2!==t.type&&3!==t.type)continue;if(n.geometry.coordinates=t.geometry.map(e=>e.map(e=>[e[0],e[1]])),2===t.type)n.geometry.type="MultiLineString";else if(n.geometry=Ei(n.geometry),null==n.geometry)continue}r.features.push(n)}}return r}formatURL(){return this.url}parseSourceData(e,t,r){let n="string"==typeof r?JSON.parse(r):r,i=this.getLayers(n);t.layers=this.preprocessLayers(i,e)}preprocessLayers(e,t){for(let t in e){let r=e[t];r.features=this.preprocessFeatures(r.features)}if("function"==typeof this.transform){const r={min:Object.assign({},t.min),max:Object.assign({},t.max),coords:Object.assign({},t.coords)};1===Object.keys(e).length&&e._default?e._default=this.transform(e._default,this.extra_data,r):e=this.transform(e,this.extra_data,r)}return e}preprocessFeatures(e){if(e=e.filter(e=>null!=e.geometry),this.config.generate_label_centroids){let t=[],r={label_placement:!0};e.forEach(e=>{let n,i;if("Polygon"===e.geometry.type)n=e.geometry.coordinates,i=ts(n,e.id,e.properties,r),t.push(i);else if("MultiPolygon"===e.geometry.type){n=e.geometry.coordinates;let s=-1/0,o=0;for(let e=0;e<n.length;e++){let t=G.polygonArea(n[e]);t>s&&(s=t,o=e)}i=ts(n[o],e.id,e.properties,r),t.push(i)}}),t=t.filter(e=>e),Array.prototype.push.apply(e,t)}return e}getLayers(e){return"Feature"===e.type?{_default:{type:"FeatureCollection",features:[e]}}:"FeatureCollection"===e.type?{_default:e}:e}}class es extends Te{constructor(e,t){super(e,t)}parseSourceData(e,t,r){let n="string"==typeof r?JSON.parse(r):r;this.prepareGeoJSON(n,e,t)}prepareGeoJSON(e,t,r){if("function"==typeof this.transform){const r={min:Object.assign({},t.min),max:Object.assign({},t.max),coords:Object.assign({},t.coords)};e=this.transform(e,this.extra_data,r)}r.layers=Ji.prototype.getLayers(e);let n={coords:t.coords,min:G.metersForTile(G.wrapTile(t.coords,{x:!0}))};we.projectData(r),we.scaleData(r,n)}}function ts(e,t,r,n){let i=G.centroid(e);if(!i)return;let s={};return Object.assign(s,r,n),{type:"Feature",id:t,properties:s,geometry:{type:"Point",coordinates:i}}}function rs(e){return e}function ns(e,t){var r=t.id,n=t.bbox,i=null==t.properties?{}:t.properties,s=function(e,t){var r=function(e){if(null==(t=e.transform))return rs;var t,r,n,i=t.scale[0],s=t.scale[1],o=t.translate[0],a=t.translate[1];return function(e,t){return t||(r=n=0),e[0]=(r+=e[0])*i+o,e[1]=(n+=e[1])*s+a,e}}(e),n=e.arcs;function i(e,t){t.length&&t.pop();for(var i=n[e<0?~e:e],s=0,o=i.length;s<o;++s)t.push(r(i[s].slice(),s));e<0&&function(e,t){for(var r,n=e.length,i=n-t;i<--n;)r=e[i],e[i++]=e[n],e[n]=r}(t,o)}function s(e){return r(e.slice())}function o(e){for(var t=[],r=0,n=e.length;r<n;++r)i(e[r],t);return t.length<2&&t.push(t[0].slice()),t}function a(e){for(var t=o(e);t.length<4;)t.push(t[0].slice());return t}function l(e){return e.map(a)}return function e(t){var r,n=t.type;switch(n){case"GeometryCollection":return{type:n,geometries:t.geometries.map(e)};case"Point":r=s(t.coordinates);break;case"MultiPoint":r=t.coordinates.map(s);break;case"LineString":r=o(t.arcs);break;case"MultiLineString":r=t.arcs.map(o);break;case"Polygon":r=l(t.arcs);break;case"MultiPolygon":r=t.arcs.map(l);break;default:return null}return{type:n,coordinates:r}}(t)}(e,t);return null==r&&null==n?{type:"Feature",properties:i,geometry:s}:null==n?{type:"Feature",id:r,properties:i,geometry:s}:{type:"Feature",id:r,bbox:n,properties:i,geometry:s}}we.register("GeoJSON",e=>es.urlHasTilePattern(e.url)?es:Ji);class is extends Ji{parseSourceData(e,t,r){let n="string"==typeof r?JSON.parse(r):r;n=this.toGeoJSON(n);let i=this.getLayers(n);super.preprocessLayers(i,e),t.layers=i}toGeoJSON(e){if(e.objects&&1===Object.keys(e.objects).length){let t=Object.keys(e.objects)[0];e=ss(e,e.objects[t])}else{let t={};for(let r in e.objects)t[r]=ss(e,e.objects[r]);e=t}return e}}function ss(e,t){let r=function(e,t){return"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return ns(e,t)})}:ns(e,t)}(e,t);return"Feature"===r.type&&(r={type:"FeatureCollection",features:[r]}),r}class os extends es{constructor(e,t){super(e,t)}parseSourceData(e,t,r){let n="string"==typeof r?JSON.parse(r):r;n=is.prototype.toGeoJSON(n),this.prepareGeoJSON(n,e,t)}}we.register("TopoJSON",e=>os.urlHasTilePattern(e.url)?os:is),e.Collision=$t,e.DataSource=we,e.FeatureSelection=he,e.FilterOptions=Hn,e.FontManager=nr,e.GLSL=O,e.Geo=G,e.Label=Ut,e.LabelLineStraight=mn,e.LabelPoint=qt,e.Light=ve,e.Material=_e,e.OBB=jt,e.ShaderProgram=j,e.Style=Ne,e.StyleManager=class{constructor(){this.styles={},this.base_styles={},this.active_styles=[],this.active_blend_orders=[],this.register(Object.create(et)),this.register(Object.create(bt)),this.register(Object.create(cn)),this.register(Object.create(xn)),this.register(Object.create(wn))}init(){j.removeBlock("global"),j.removeBlock("setup"),j.addBlock("global","#ifdef TANGRAM_VERTEX_SHADER\n\n// Apply layer ordering to avoid z-fighting\nvoid applyLayerOrder (float layer, inout vec4 position) {\n position.z -= layer * TANGRAM_LAYER_DELTA * position.w;\n}\n\n// Vertex position in model space: [0, 1] range over the local tile\n// Note positions can be outside that range due to unclipped geometry, geometry higher than a unit cube, etc.\nvec4 modelPosition() {\n return\n vec4(\n a_position.xyz / TANGRAM_TILE_SCALE // scale coords to ~0-1 range\n * exp2(u_tile_origin.z - u_tile_origin.w), // adjust for tile overzooming\n 1.)\n + vec4(0., 1., 0., 0.);\n // NB: additional offset to account for unusual Tangram JS y coords,\n // should be refactored to remove\n}\n\n// Position in model space as above, but according to tile coordinate (as opposed to style) zoom\n// e.g. unadjusted for tile overzooming\nvec4 modelPositionBaseZoom() {\n return\n vec4(\n a_position.xyz / TANGRAM_TILE_SCALE, // scale coords to ~0-1 range\n 1.)\n + vec4(0., 1., 0., 0.); // see note on offset above\n}\n\n#endif\n\n// Vertex position in world coordinates, useful for 3d procedural textures, etc.\nvec4 worldPosition() {\n return v_world_position;\n}\n\n// Optionally wrap world coordinates (allows more precision at higher zooms)\n// e.g. at wrap 1000, the world space will wrap every 1000 meters\n#ifdef TANGRAM_VERTEX_SHADER\n\nvec4 wrapWorldPosition(vec4 world_position) {\n #if defined(TANGRAM_WORLD_POSITION_WRAP)\n vec2 anchor = u_tile_origin.xy - mod(u_tile_origin.xy, TANGRAM_WORLD_POSITION_WRAP);\n world_position.xy -= anchor;\n #endif\n return world_position;\n}\n\n#endif\n\n// Normal in world space\n#if defined(TANGRAM_VERTEX_SHADER)\n\nvec3 worldNormal() {\n return TANGRAM_NORMAL;\n}\n\n#elif defined(TANGRAM_FRAGMENT_SHADER)\n\nvec3 worldNormal() {\n return u_inverseNormalMatrix * TANGRAM_NORMAL;\n}\n\n#endif\n"),j.addBlock("global","// Vertex attribute + varying for feature selection\n#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)\n attribute vec4 a_selection_color;\n varying vec4 v_selection_color;\n#endif\n"),j.replaceBlock("setup","// Selection pass-specific rendering\n#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)\n if (a_selection_color.rgb == vec3(0.)) {\n // Discard by forcing invalid triangle if we're in the feature\n // selection pass but have no selection info\n // TODO: in some cases we may actually want non-selectable features to occlude selectable ones?\n gl_Position = vec4(0., 0., 0., 1.);\n return;\n }\n v_selection_color = a_selection_color;\n#endif\n"),j.defines.TANGRAM_EPSILON=1e-5,j.defines.TANGRAM_LAYER_DELTA=1/16384,j.defines.TANGRAM_TILE_SCALE=`vec3(${G.tile_scale}., ${G.tile_scale}., u_meters_per_pixel * ${G.tile_size}.)`,j.defines.TANGRAM_HEIGHT_SCALE=G.height_scale,j.defines.TANGRAM_ALPHA_TEST=.5}destroy(e){Object.keys(this.styles).forEach(t=>{let r=this.styles[t];r.gl===e&&(_("trace",`StyleManager.destroy: destroying render style ${r.name}`),r.base&&this.remove(r.name),r.destroy())})}register(e){this.styles[e.name]=e,this.base_styles[e.name]=e}remove(e){delete this.styles[e]}getActiveStyles(){return this.active_styles}updateActiveStyles(e){return this.active_styles=Object.keys(e.reduce((e,t)=>(Object.keys(t.meshes).forEach(t=>e[t]=!0),e),{})),this.active_styles}getActiveBlendOrders(){return this.active_blend_orders}updateActiveBlendOrders(e){const t=[];e.forEach(e=>{Object.entries(e.meshes).forEach(([e,r])=>{r.forEach(r=>{const n=r.variant.blend_order;let i=t.findIndex(e=>e.blend_order===n);i=i>-1?i:t.push({blend_order:n,styles:[]})-1,-1===t[i].styles.indexOf(e)&&t[i].styles.push(e)})})}),this.active_blend_orders=t.sort((e,t)=>e.blend_order-t.blend_order)}mix(e,t){if(e.mixed)return e;e.mixed={};let r=[];e.mix&&(Array.isArray(e.mix)?r.push(...e.mix):r.push(e.mix),r=r.map(e=>t[e]).filter(t=>t&&t!==e),r.forEach(t=>e.mixed[t.name]=!0)),r.push(e),e.animated=r.some(e=>e&&e.animated),e.texcoords=r.some(e=>e&&e.texcoords),e.base=r.map(e=>e.base).filter(e=>e).pop(),e.lighting=r.map(e=>e.lighting).filter(e=>null!=e).pop(),e.texture=r.map(e=>e.texture).filter(e=>e).pop(),e.raster=r.map(e=>e.raster).filter(e=>null!=e).pop(),e.dash=r.map(e=>e.dash).filter(e=>null!=e).pop(),e.dash_background_color=r.map(e=>e.dash_background_color).filter(e=>null!=e).pop(),r.some(e=>Object.prototype.hasOwnProperty.call(e,"blend")&&e.blend)&&(e.blend=r.map(e=>Object.prototype.hasOwnProperty.call(e,"blend")&&e.blend).filter(e=>e).pop()),e.blend_order=r.map(e=>e.blend_order).filter(e=>null!=e).pop(),e.defines=Object.assign({},...r.map(e=>e.defines).filter(e=>e)),e.material=Object.assign({},...r.map(e=>e.material).filter(e=>e));let n=r.map(e=>e.draw).filter(e=>e);return n.length>0&&(e.draw=V({},...n)),this.mixShaders(e,t,r),e}mixShaders(e,t,r){let n={},i=r.map(e=>e.shaders).filter(e=>e);if(n.defines=Object.assign({},...i.map(e=>e.defines).filter(e=>e)),n.attributes=Object.assign({},...i.map(e=>e.attributes).filter(e=>e)),n.uniforms={},n._uniforms=e.shaders&&e.shaders.uniforms||{},n._uniform_scopes={},r.filter(e=>e.shaders&&e.shaders.uniforms).forEach(e=>{for(let r in e.shaders.uniforms)n._uniform_scopes[r]=e.name,Object.defineProperty(n.uniforms,r,{enumerable:!0,configurable:!0,get:function(){return void 0!==n._uniforms[r]?n._uniforms[r]:t[n._uniform_scopes[r]].shaders.uniforms!==n.uniforms?t[n._uniform_scopes[r]].shaders.uniforms[r]:void 0},set:function(e){n._uniforms[r]=e}})}),n.extensions=Object.keys(i.map(e=>e.extensions).filter(e=>e).reduce((e,t)=>("string"==typeof t?e[t]=!0:t.forEach(t=>e[t]=!0),e),{})||{}),e.shaders&&e.shaders.blocks){e.shaders.block_scopes=e.shaders.block_scopes||{};for(let t in e.shaders.blocks){let r=e.shaders.blocks[t];e.shaders.block_scopes[t]=e.shaders.block_scopes[t]||[],Array.isArray(r)?e.shaders.block_scopes[t].push(...r.map(()=>e.name)):e.shaders.block_scopes[t].push(e.name)}}let s={};return i.forEach(e=>{if(!e.blocks)return;n.blocks=n.blocks||{},n.block_scopes=n.block_scopes||{};let t={};for(let r in e.blocks){let i=e.blocks[r],o=e.block_scopes[r];n.blocks[r]=n.blocks[r]||[],n.block_scopes[r]=n.block_scopes[r]||[],i=Array.isArray(i)?i:[i],o=Array.isArray(o)?o:[o];for(let e=0;e<i.length;e++)s[o[e]]||(t[o[e]]=!0,n.blocks[r].push(i[e]),n.block_scopes[r].push(o[e]))}Object.assign(s,t)}),Object.assign(e.mixed,s),e.shaders=n,e}create(e,t,r={}){let n=V({},t);return n.name=e,n=this.mix(n,r),n.base&&this.base_styles[n.base]?this.styles[e]=n=Object.assign(Object.create(this.base_styles[n.base]),n):n.base=null,n}build(e){const t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?An(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):An(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},e);this.styles&&Object.values(this.styles).forEach(e=>a.removeTarget(e.main_thread_target));const r=["opaque","add","multiply","overlay","inlay","translucent"],n=["polygons","lines","points","text","raster"];for(const e of r)for(const r of n){const n=e+"_"+r;null==t[n]&&(t[n]={base:r,blend:e})}let s=Object.keys(t).sort((e,r)=>this.inheritanceDepth(e,t)-this.inheritanceDepth(r,t));for(let e in this.styles)this.base_styles[e]?this.styles[e].reset():delete this.styles[e];let o={};return s.forEach(e=>{o[e]=this.create(e,t[e],o)}),this.styles}initStyles(e={}){for(let t in this.styles)this.styles[t].init(e)}inheritanceDepth(e,t){let r=0;for(;;){let n=t[e];if(!n)break;if(!n.mix)break;if(r++,Array.isArray(n.mix)){r+=Math.max(...n.mix.map(r=>{if(e!==r)return this.inheritanceDepth(r,t)}));break}if(e===n.mix)break;e=n.mix}return r}},e.StyleParser=J,e.Task=E,e.TextCanvas=wr,e.Texture=k,e.Thread=t,e.Tile=ti,e.TileID=Se,e.Utils=g,e.Vector=ye,e.VertexArrayObject=B,e.VertexData=Fe,e.VertexElements=ze,e.View=class{constructor(e,t){T(this),this.scene=e,this.createMatrices(),this.zoom=null,this.center=null,this.bounds=null,this.meters_per_pixel=null,this.panning=!1,this.panning_stop_at=0,this.pan_snap_timer=0,this.zoom_direction=0,this.user_input_at=0,this.user_input_timeout=50,this.user_input_active=!1,this.size={css:{},device:{},meters:{}},this.aspect=null,this.buffer=0,this.continuous_zoom="boolean"!=typeof t.continuousZoom||t.continuousZoom,this.wrap=!1!==t.wrapView,this.preserve_tiles_within_zoom=1,this.reset()}reset(){this.createCamera()}createCamera(){let e=this.getActiveCamera();e&&(this.camera=sn.create(e,this,this.scene.config.cameras[e]),this.camera.updateView())}getActiveCamera(){if(this.scene.config&&this.scene.config.cameras){for(let e in this.scene.config.cameras)if(this.scene.config.cameras[e].active)return e;let e=Object.keys(this.scene.config.cameras);return e.length&&e[0]}}setActiveCamera(e){let t=this.getActiveCamera();return t===e?e:(this.scene.config.cameras[e]&&(this.scene.config.cameras[e].active=!0,t&&this.scene.config.cameras[t]&&delete this.scene.config.cameras[t].active),this.scene.updateConfig({rebuild:!1,normalize:!1}),this.getActiveCamera())}update(){null!=this.camera&&this.ready()&&this.camera.update(),this.pan_snap_timer=(+new Date-this.panning_stop_at)/1e3,this.user_input_active=+new Date-this.user_input_at<this.user_input_timeout}setViewportSize(e,t){this.size.css={width:e,height:t},this.size.device={width:Math.round(this.size.css.width*g.device_pixel_ratio),height:Math.round(this.size.css.height*g.device_pixel_ratio)},this.aspect=this.size.css.width/this.size.css.height,this.updateBounds()}setView({lng:e,lat:t,zoom:r}={}){var n=!1;return"number"==typeof e&&"number"==typeof t&&(this.center&&e===this.center.lng&&t===this.center.lat||(n=!0,this.center={lng:e,lat:t})),"number"==typeof r&&r!==this.zoom&&(n=!0,this.setZoom(r)),n&&this.updateBounds(),n}setZoom(e){let t=this.tile_zoom,r=this.baseZoom(e);this.continuous_zoom||(e=r),r!==t&&(this.zoom_direction=r>t?1:-1),this.zoom=e,this.tile_zoom=r,this.updateBounds(),this.scene.requestRedraw()}baseZoom(e){return Math.floor(e)}setPanning(e){this.panning=e,this.panning||(this.panning_stop_at=+new Date)}markUserInput(){this.user_input_at=+new Date}ready(){return"number"==typeof this.size.css.width&&"number"==typeof this.size.css.height&&null!=this.center&&"number"==typeof this.zoom}updateBounds(){if(!this.ready())return;this.meters_per_pixel=G.metersPerPixel(this.zoom),this.size.meters={x:this.size.css.width*this.meters_per_pixel,y:this.size.css.height*this.meters_per_pixel};const e=G.latLngToMeters([this.center.lng,this.center.lat]);this.center.meters={x:e[0],y:e[1]},this.center.tile=G.tileForMeters([this.center.meters.x,this.center.meters.y],this.tile_zoom),this.bounds={sw:{x:this.center.meters.x-this.size.meters.x/2,y:this.center.meters.y-this.size.meters.y/2},ne:{x:this.center.meters.x+this.size.meters.x/2,y:this.center.meters.y+this.size.meters.y/2}},this.scene.tile_manager.updateTilesForView(),this.trigger("move"),this.scene.requestRedraw()}findVisibleTileCoordinates(){if(!this.bounds)return[];let e=this.tile_zoom,t=G.tileForMeters([this.bounds.sw.x,this.bounds.sw.y],e),r=G.tileForMeters([this.bounds.ne.x,this.bounds.ne.y],e),n=[t.x-this.buffer,r.x+this.buffer,r.y-this.buffer,t.y+this.buffer];if(!1===this.wrap){let t=(1<<e)-1;n=n.map(e=>Math.min(Math.max(0,e),t))}let i=[];for(let t=n[0];t<=n[1];t++)for(let r=n[2];r<=n[3];r++)i.push(Se.coord({x:t,y:r,z:e}));return i}pruneTilesForView(){this.ready()&&this.scene.tile_manager.removeTiles(e=>{if(e.visible||e.isProxy())return!1;if(e.loading&&e.style_z!==this.tile_zoom)return!0;if(Math.abs(e.style_z-this.tile_zoom)>(null!=e.preserve_tiles_within_zoom?e.preserve_tiles_within_zoom:this.preserve_tiles_within_zoom))return!0;const t=this.meters_per_pixel*G.tile_size,r=Se.coordAtZoom(G.tileForMeters([this.center.meters.x-this.size.meters.x/2-t,this.center.meters.y+this.size.meters.y/2+t],this.tile_zoom),e.coords.z),n=Se.coordAtZoom(G.tileForMeters([this.center.meters.x+this.size.meters.x/2+t,this.center.meters.y-this.size.meters.y/2-t],this.tile_zoom),e.coords.z);return(e.coords.x<r.x||e.coords.x>n.x||e.coords.y<r.y||e.coords.y>n.y)&&(_("trace",`View: remove tile ${e.key} (as ${e.coords.key}) for being too far out of visible area (${r.key}, ${n.key})`),!0)})}createMatrices(){this.matrices={},this.matrices.model=new Float64Array(16),this.matrices.model32=new Float32Array(16),this.matrices.model_view=new Float64Array(16),this.matrices.model_view32=new Float32Array(16),this.matrices.normal=new Float64Array(9),this.matrices.normal32=new Float32Array(9),this.matrices.inverse_normal32=new Float32Array(9)}setupTile(e,t){e.setupProgram(this.matrices,t),this.camera.setupMatrices(this.matrices,t)}setupProgram(e){e.uniform("2fv","u_resolution",[this.size.device.width,this.size.device.height]),e.uniform("3fv","u_map_position",[this.center.meters.x,this.center.meters.y,this.zoom]),e.uniform("1f","u_meters_per_pixel",this.meters_per_pixel),e.uniform("1f","u_device_pixel_ratio",g.device_pixel_ratio),e.uniform("1f","u_view_pan_snap_timer",this.pan_snap_timer),e.uniform("1i","u_view_panning",this.panning),this.camera.setupProgram(e)}isAnimating(){return this.pan_snap_timer<=.5}},e.WorkerBroker=a,e._defineProperty=i,e.addBaseURL=function(e,t){if(!e||!x(e))return e;var r,n="/"!==e[0];if(t?(r=document.createElement("a")).href=t:r=window.location,n)e=b(r.href)+e;else{let t=r.origin;t||(t=r.protocol+"//"+r.host),e=t+e}return e},e.buildFilter=jn,e.cache=H,e.clearFunctionStringCache=function(){H.functions={},H.num_functions=0,H.num_cached=0},e.compileFunctionStrings=Z,e.createObjectURL=function(e){return void 0===w&&(w=window.URL&&window.URL.createObjectURL||window.webkitURL&&window.webkitURL.createObjectURL,"function"!=typeof w&&(w=null,_("warn","window.URL.createObjectURL (or vendor prefix) not found, unable to create local blob URLs"))),w?w(e):e},e.debugSettings=v,e.debugSumLayerStats=function(e){let t={},r={};return e.filter(e=>e.debug.layers).forEach(e=>{Object.keys(e.debug.layers.list).forEach(r=>{let n=e.debug.layers.list[r];Pe(t,r,n.features,n.geoms,n.styles,n.base)}),ri(e.debug.layers.tree,r)}),{list:t,tree:r}},e.extensionForURL=function(e){let t=(e=e.split("/").pop()).lastIndexOf(".");if(t>-1)return e.substring(t+1)},e.flattenRelativeURL=function(e){let t=(e||"").split("/");for(let e=1;e<t.length;e++)"."===t[e]?(t.splice(e,1),e--):".."===t[e]&&(e+=0,t.splice(e-1,2),e--);return t.join("/")},e.getAugmentedNamespace=function(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r},e.getDefaultExportFromCjs=P,e.isLocalURL=function(e){if("string"==typeof e)return e.search(/^(data|blob):/)>-1},e.isRelativeURL=x,e.isReserved=Zn,e.layerCache=function(){return Bn},e.log=_,e.mergeDebugSettings=function(e){Object.assign(y,e)},e.mergeObjects=V,e.parseLayers=function(e,t){Bn={};let r={};for(let n in e){let i=e[n];i&&(r[n]=Kn(n,i,null,t))}return r},e.pathForURL=b,e.sliceObject=S,e.subscribeMixin=T,e.version=o}),Qg(0,function(e){const t=Object.assign(self,{FeatureSelection:e.FeatureSelection,sources:{},styles:{},layers:{},tiles:{},init(t,r,n,i,s,o,a){return this.scene_id=t,this._worker_id=r,this.num_workers=n,e.log.setLevel(i),e.Utils.device_pixel_ratio=s,e.VertexElements.setElementIndexUint(o),e.FeatureSelection.setPrefix(this._worker_id),this.style_manager=new e.StyleManager,this.importExternalScripts(a),e.Label.id_prefix=r,e.Label.id_multiplier=n,r},importExternalScripts(t){if(0===t.length)return;e.log("debug","loading custom data source scripts in worker:",t);let r=Object.getOwnPropertyNames(window);importScripts(...t),Object.getOwnPropertyNames(window).forEach(e=>{-1===r.indexOf(e)&&(this[e]=window[e])})},updateConfig({config:t,generation:r,introspection:n},i){return t=JSON.parse(t),e.mergeDebugSettings(i),this.generation=r,this.introspection=n,this.global=e.compileFunctionStrings(t.global),this.createDataSources(t),t.styles=e.compileFunctionStrings(t.styles,e.StyleParser.wrapFunction),this.styles=this.style_manager.build(t.styles),this.style_manager.initStyles({generation:this.generation,styles:this.styles,sources:this.sources,introspection:this.introspection}),this.layers=e.parseLayers(t.layers,this.style_manager.styles),this.syncing_textures=this.syncTextures(t.textures),this.configuring=this.syncing_textures.then(()=>{e.log("debug","updated config")}),this.configuring},createDataSources(t){this.last_config_sources=this.config_sources||{},this.config_sources=e.mergeObjects({},t.sources);let r=this.sources,n=[];this.sources={};for(let i in t.sources){if(JSON.stringify(this.last_config_sources[i])===JSON.stringify(t.sources[i])){this.sources[i]=r[i];continue}let s;t.sources[i]=e.compileFunctionStrings(t.sources[i]);try{s=e.DataSource.create(Object.assign({},t.sources[i],{name:i}),this.sources)}catch(e){continue}s&&(this.sources[i]=s,n.push(i))}n.forEach(e=>{for(let t in this.tiles)this.tiles[t].source===e&&delete this.tiles[t]})},awaitConfiguration(){return this.configuring},buildTile({tile:t}){if(null==this.getTile(t.key)||!0!==this.getTile(t.key).loading)return t=this.tiles[t.key]=Object.assign(this.getTile(t.key)||{},t),this.awaitConfiguration().then(()=>{if(!0!==t.loaded)t.loading=!0,t.loaded=!1,t.error=null,this.loadTileSourceData(t).then(()=>{this.getTile(t.key)?(t.source_data.error&&e.log("warn",`tile load error(s) for ${t.key}: ${t.source_data.error}`),t.loading=!1,t.loaded=!0,e.Tile.buildGeometry(t,this)):e.log("trace",`stop tile build after data source load because tile was removed: ${t.key}`)}).catch(r=>{t.loading=!1,t.loaded=!1,t.error=r.stack,e.log("error",`tile load error for ${t.key}: ${t.error}`),e.WorkerBroker.postMessage(`TileManager_${this.scene_id}.buildTileError`,e.Tile.slice(t))});else{e.log("trace",`used worker cache for tile ${t.key}`);try{e.Tile.buildGeometry(t,this)}catch(r){t.error=r.toString(),e.WorkerBroker.postMessage(`TileManager_${this.scene_id}.buildTileError`,e.Tile.slice(t))}}})},loadTileSourceData(e){const t=this.sources[e.source];if(t){for(const r in this.tiles){const n=this.tiles[r];if(n.source===e.source&&n.coords.key===e.coords.key&&n.loaded)return Promise.resolve(t.copyTileData(n,e))}return t.load(e)}return e.source_data={},Promise.resolve(e)},getTile(e){return this.tiles[e]},removeTile(t){var r=this.tiles[t];null!=r&&(!0===r.loading&&(e.log("trace",`cancel tile load for ${t}`),r.loading=!1,e.Tile.cancel(r)),e.FeatureSelection.clearTile(t),delete this.tiles[t],e.log("trace",`remove tile from cache for ${t}`))},queryFeatures({filter:t,visible:r,geometry:n,tile_keys:i}){let s=[],o=i.map(e=>this.tiles[e]).filter(e=>e&&e.loaded);return null!=t&&(t=["{","["].indexOf(t[0])>-1?JSON.parse(t):t,t=e.compileFunctionStrings(t,e.StyleParser.wrapFunction)),t=e.buildFilter(t,e.FilterOptions),o.forEach(i=>{for(let o in i.source_data.layers){let a=i.source_data.layers[o];if(null==a)return;a.features.forEach(a=>{const l=a.generation===this.generation;if(!0===r&&!l||!1===r&&l)return;let u=e.StyleParser.getFeatureParseContext(a,i,this.global);if(u.source=i.source,u.layer=o,u.id=a.id,!t(u))return;let c={type:a.type,id:a.id,properties:Object.assign({},a.properties,{$source:u.source,$layer:u.layer,$geometry:u.geometry,$visible:l})};!0===n&&(c.geometry=e.Geo.copyGeometry(a.geometry),e.Geo.tileSpaceToLatlng(c.geometry,i.coords.z,i.min)),s.push(c)})}}),s},getFeatureSelection({id:t,key:r}={}){var n=e.FeatureSelection.map[r];return{id:t,feature:n&&n.feature}},resetFeatureSelection(t=null){e.FeatureSelection.reset(t)},getFeatureSelectionMapSize:()=>e.FeatureSelection.getMapSize(),syncTextures(t){let r=[];return t&&r.push(...Object.keys(t)),e.log("trace","sync textures to worker:",r),r.length>0?e.Texture.syncTexturesToWorker(r):Promise.resolve()},updateDevicePixelRatio(t){e.Utils.device_pixel_ratio=t},clearFunctionStringCache(){e.clearFunctionStringCache()},profile(e){console.profile(`worker ${this._worker_id}: ${e}`)},profileEnd(e){console.profileEnd(`worker ${this._worker_id}: ${e}`)},debug:{debugSettings:e.debugSettings,layerCache:e.layerCache,functionStringCache:e.cache}});e.WorkerBroker.addTarget("self",t)}),Qg(0,function(e){var t,r=t={};let n=0;function i(e,t){var r;const n=t[t.length-1];return null===(r=o(e,t))||void 0===r?void 0:r[n]}function s(e,t,r){const n=t[t.length-1],i=o(e,t);i&&(i[n]=r)}function o(e,t){if(0===t.length)return;let r=e;for(let e=0;e<t.length-1;e++)if(r=r[t[e]],null==r)return;return r}t.getContext=function(e,r){var i=!1;null==e&&((e=document.createElement("canvas")).style.position="absolute",e.style.top=0,e.style.left=0,e.style.zIndex=-1,document.body.appendChild(e),i=!0),e.addEventListener("webglcontextlost",()=>{}),e.addEventListener("webglcontextrestored",()=>{});var s=e.getContext("webgl",r)||e.getContext("experimental-webgl",r);if(!s)throw new Error("Couldn't create WebGL context.");return s._tangram_id=n++,i?(t.resize(s,window.innerWidth,window.innerHeight,r.device_pixel_ratio),window.addEventListener("resize",function(){t.resize(s,window.innerWidth,window.innerHeight,r.device_pixel_ratio)})):t.resize(s,parseFloat(e.style.width),parseFloat(e.style.height),r.device_pixel_ratio),s},t.resize=function(e,t,r,n){n=n||window.devicePixelRatio||1,e.canvas.style.width=t+"px",e.canvas.style.height=r+"px",e.canvas.width=Math.round(t*n),e.canvas.height=Math.round(r*n),e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,e.canvas.width,e.canvas.height)};const a="global.",l="__global_prop";function u(e){return(null==e?void 0:e.slice(0,7))===a}function c(e,t){var r;const n=Array.isArray(t)?t:[t],i=o(e,n),s=n[n.length-1];return void 0!==(null==i||null===(r=i[l])||void 0===r?void 0:r[s])}function h(e,t=null,r={}){t=t?t+".":a;for(const n in e){const i=t+n,s=e[n];r[i]=s,"object"!=typeof s||Array.isArray(s)||h(s,i,r)}return r}function d(t,r,n,i){var s;let o;if(null!=n&&null!==(s=n[l])&&void 0!==s&&s[i]?o=n[l][i]:"string"==typeof r&&r.slice(0,7)===a&&(o=r),o){null==n[l]&&Object.defineProperty(n,l,{value:{}}),n[l][i]=o;let r,s=t[o];for(;"string"==typeof s&&s.slice(0,7)===a;){if(r=r||[o],r.indexOf(s)>-1){e.log({level:"warn",once:!0},"Global properties: cyclical reference detected",r),s=null;break}r.push(s),s=t[s]}Object.defineProperty(n,i,{enumerable:!0,get:function(){return s},set:function(e){delete n[l][i],delete n[i],n[i]=e}})}else if(Array.isArray(r))for(let e=0;e<r.length;e++)d(t,r[e],r,e);else if("object"==typeof r)for(const e in r)d(t,r[e],r,e);return r}var f="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},p=[],m=[],_="undefined"!=typeof Uint8Array?Uint8Array:Array,g=!1;function y(){g=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)p[t]=e[t],m[e.charCodeAt(t)]=t;m["-".charCodeAt(0)]=62,m["_".charCodeAt(0)]=63}function v(e,t,r){for(var n,i,s=[],o=t;o<r;o+=3)n=(e[o]<<16)+(e[o+1]<<8)+e[o+2],s.push(p[(i=n)>>18&63]+p[i>>12&63]+p[i>>6&63]+p[63&i]);return s.join("")}function b(e){var t;g||y();for(var r=e.length,n=r%3,i="",s=[],o=16383,a=0,l=r-n;a<l;a+=o)s.push(v(e,a,a+o>l?l:a+o));return 1===n?(t=e[r-1],i+=p[t>>2],i+=p[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=p[t>>10],i+=p[t>>4&63],i+=p[t<<2&63],i+="="),s.push(i),s.join("")}function x(e,t,r,n,i){var s,o,a=8*i-n-1,l=(1<<a)-1,u=l>>1,c=-7,h=r?i-1:0,d=r?-1:1,f=e[t+h];for(h+=d,s=f&(1<<-c)-1,f>>=-c,c+=a;c>0;s=256*s+e[t+h],h+=d,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+e[t+h],h+=d,c-=8);if(0===s)s=1-u;else{if(s===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),s-=u}return(f?-1:1)*o*Math.pow(2,s-n)}function w(e,t,r,n,i,s){var o,a,l,u=8*s-i-1,c=(1<<u)-1,h=c>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,p=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(o++,l/=2),o+h>=c?(a=0,o=c):o+h>=1?(a=(t*l-1)*Math.pow(2,i),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[r+f]=255&a,f+=p,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;e[r+f]=255&o,f+=p,o/=256,u-=8);e[r+f-p]|=128*m}var A={}.toString,E=Array.isArray||function(e){return"[object Array]"==A.call(e)};O.TYPED_ARRAY_SUPPORT=void 0===f.TYPED_ARRAY_SUPPORT||f.TYPED_ARRAY_SUPPORT;var T=S();function S(){return O.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function k(e,t){if(S()<t)throw new RangeError("Invalid typed array length");return O.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=O.prototype:(null===e&&(e=new O(t)),e.length=t),e}function O(e,t,r){if(!(O.TYPED_ARRAY_SUPPORT||this instanceof O))return new O(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return N(this,e)}return R(this,e,t,r)}function R(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),O.TYPED_ARRAY_SUPPORT?(e=t).__proto__=O.prototype:e=P(e,t),e}(e,t,r,n):"string"==typeof t?function(e,t,r){if("string"==typeof r&&""!==r||(r="utf8"),!O.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|z(t,r),i=(e=k(e,n)).write(t,r);return i!==n&&(e=e.slice(0,i)),e}(e,t,r):function(e,t){if(D(t)){var r=0|M(t.length);return 0===(e=k(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?k(e,0):P(e,t);if("Buffer"===t.type&&E(t.data))return P(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function C(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function N(e,t){if(C(t),e=k(e,t<0?0:0|M(t)),!O.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function P(e,t){var r=t.length<0?0:0|M(t.length);e=k(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function M(e){if(e>=S())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+S().toString(16)+" bytes");return 0|e}function D(e){return!(null==e||!e._isBuffer)}function z(e,t){if(D(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return le(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return ue(e).length;default:if(n)return le(e).length;t=(""+t).toLowerCase(),n=!0}}function I(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Y(this,t,r);case"utf8":case"utf-8":return H(this,t,r);case"ascii":return K(this,t,r);case"latin1":case"binary":return X(this,t,r);case"base64":return W(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function F(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function L(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=O.from(t,n)),D(t))return 0===t.length?-1:j(e,t,r,n,i);if("number"==typeof t)return t&=255,O.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):j(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function j(e,t,r,n,i){var s,o=1,a=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,a/=2,l/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(s=r;s<a;s++)if(u(e,s)===u(t,-1===c?0:s-c)){if(-1===c&&(c=s),s-c+1===l)return c*o}else-1!==c&&(s-=s-c),c=-1}else for(r+l>a&&(r=a-l),s=r;s>=0;s--){for(var h=!0,d=0;d<l;d++)if(u(e,s+d)!==u(t,d)){h=!1;break}if(h)return s}return-1}function U(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var o=0;o<n;++o){var a=parseInt(t.substr(2*o,2),16);if(isNaN(a))return o;e[r+o]=a}return o}function B(e,t,r,n){return ce(le(t,e.length-r),e,r,n)}function V(e,t,r,n){return ce(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function G(e,t,r,n){return V(e,t,r,n)}function $(e,t,r,n){return ce(ue(t),e,r,n)}function q(e,t,r,n){return ce(function(e,t){for(var r,n,i,s=[],o=0;o<e.length&&!((t-=2)<0);++o)n=(r=e.charCodeAt(o))>>8,i=r%256,s.push(i),s.push(n);return s}(t,e.length-r),e,r,n)}function W(e,t,r){return 0===t&&r===e.length?b(e):b(e.slice(t,r))}function H(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var s,o,a,l,u=e[i],c=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h<=r)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(s=e[i+1]))&&(l=(31&u)<<6|63&s)>127&&(c=l);break;case 3:s=e[i+1],o=e[i+2],128==(192&s)&&128==(192&o)&&(l=(15&u)<<12|(63&s)<<6|63&o)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:s=e[i+1],o=e[i+2],a=e[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&u)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=h}return function(e){var t=e.length;if(t<=Z)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Z));return r}(n)}O.poolSize=8192,O._augment=function(e){return e.__proto__=O.prototype,e},O.from=function(e,t,r){return R(null,e,t,r)},O.TYPED_ARRAY_SUPPORT&&(O.prototype.__proto__=Uint8Array.prototype,O.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&O[Symbol.species]),O.alloc=function(e,t,r){return function(e,t,r,n){return C(t),t<=0?k(e,t):void 0!==r?"string"==typeof n?k(e,t).fill(r,n):k(e,t).fill(r):k(e,t)}(null,e,t,r)},O.allocUnsafe=function(e){return N(null,e)},O.allocUnsafeSlow=function(e){return N(null,e)},O.isBuffer=he,O.compare=function(e,t){if(!D(e)||!D(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},O.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},O.concat=function(e,t){if(!E(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return O.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=O.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(!D(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},O.byteLength=z,O.prototype._isBuffer=!0,O.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)F(this,t,t+1);return this},O.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)F(this,t,t+3),F(this,t+1,t+2);return this},O.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)F(this,t,t+7),F(this,t+1,t+6),F(this,t+2,t+5),F(this,t+3,t+4);return this},O.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?H(this,0,e):I.apply(this,arguments)},O.prototype.equals=function(e){if(!D(e))throw new TypeError("Argument must be a Buffer");return this===e||0===O.compare(this,e)},O.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},O.prototype.compare=function(e,t,r,n,i){if(!D(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var s=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),a=Math.min(s,o),l=this.slice(n,i),u=e.slice(t,r),c=0;c<a;++c)if(l[c]!==u[c]){s=l[c],o=u[c];break}return s<o?-1:o<s?1:0},O.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},O.prototype.indexOf=function(e,t,r){return L(this,e,t,r,!0)},O.prototype.lastIndexOf=function(e,t,r){return L(this,e,t,r,!1)},O.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return U(this,e,t,r);case"utf8":case"utf-8":return B(this,e,t,r);case"ascii":return V(this,e,t,r);case"latin1":case"binary":return G(this,e,t,r);case"base64":return $(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},O.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;function K(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function X(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function Y(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",s=t;s<r;++s)i+=ae(e[s]);return i}function Q(e,t,r){for(var n=e.slice(t,r),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);return i}function J(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function ee(e,t,r,n,i,s){if(!D(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function te(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(e.length-r,2);i<s;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function re(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(e.length-r,4);i<s;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function ne(e,t,r,n,i,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function ie(e,t,r,n,i){return i||ne(e,0,r,4),w(e,t,r,n,23,4),r+4}function se(e,t,r,n,i){return i||ne(e,0,r,8),w(e,t,r,n,52,8),r+8}O.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),O.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=O.prototype;else{var i=t-e;r=new O(i,void 0);for(var s=0;s<i;++s)r[s]=this[s+e]}return r},O.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||J(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n},O.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||J(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},O.prototype.readUInt8=function(e,t){return t||J(e,1,this.length),this[e]},O.prototype.readUInt16LE=function(e,t){return t||J(e,2,this.length),this[e]|this[e+1]<<8},O.prototype.readUInt16BE=function(e,t){return t||J(e,2,this.length),this[e]<<8|this[e+1]},O.prototype.readUInt32LE=function(e,t){return t||J(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},O.prototype.readUInt32BE=function(e,t){return t||J(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},O.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||J(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},O.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||J(e,t,this.length);for(var n=t,i=1,s=this[e+--n];n>0&&(i*=256);)s+=this[e+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},O.prototype.readInt8=function(e,t){return t||J(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},O.prototype.readInt16LE=function(e,t){t||J(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},O.prototype.readInt16BE=function(e,t){t||J(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},O.prototype.readInt32LE=function(e,t){return t||J(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},O.prototype.readInt32BE=function(e,t){return t||J(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},O.prototype.readFloatLE=function(e,t){return t||J(e,4,this.length),x(this,e,!0,23,4)},O.prototype.readFloatBE=function(e,t){return t||J(e,4,this.length),x(this,e,!1,23,4)},O.prototype.readDoubleLE=function(e,t){return t||J(e,8,this.length),x(this,e,!0,52,8)},O.prototype.readDoubleBE=function(e,t){return t||J(e,8,this.length),x(this,e,!1,52,8)},O.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||ee(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,s=0;for(this[t]=255&e;++s<r&&(i*=256);)this[t+s]=e/i&255;return t+r},O.prototype.writeUIntBE=function(e,t,r,n){e=+e,t|=0,r|=0,n||ee(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},O.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,1,255,0),O.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},O.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,2,65535,0),O.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):te(this,e,t,!0),t+2},O.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,2,65535,0),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):te(this,e,t,!1),t+2},O.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,4,4294967295,0),O.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):re(this,e,t,!0),t+4},O.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,4,4294967295,0),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):re(this,e,t,!1),t+4},O.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);ee(this,e,t,r,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s<r&&(o*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+r},O.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);ee(this,e,t,r,i-1,-i)}var s=r-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+r},O.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,1,127,-128),O.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},O.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,2,32767,-32768),O.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):te(this,e,t,!0),t+2},O.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,2,32767,-32768),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):te(this,e,t,!1),t+2},O.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,4,2147483647,-2147483648),O.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):re(this,e,t,!0),t+4},O.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):re(this,e,t,!1),t+4},O.prototype.writeFloatLE=function(e,t,r){return ie(this,e,t,!0,r)},O.prototype.writeFloatBE=function(e,t,r){return ie(this,e,t,!1,r)},O.prototype.writeDoubleLE=function(e,t,r){return se(this,e,t,!0,r)},O.prototype.writeDoubleBE=function(e,t,r){return se(this,e,t,!1,r)},O.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,s=n-r;if(this===e&&r<t&&t<n)for(i=s-1;i>=0;--i)e[i+t]=this[i+r];else if(s<1e3||!O.TYPED_ARRAY_SUPPORT)for(i=0;i<s;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+s),t);return s},O.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!O.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var s;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s<r;++s)this[s]=e;else{var o=D(e)?e:le(new O(e,n).toString()),a=o.length;for(s=0;s<r-t;++s)this[s+t]=o[s%a]}return this};var oe=/[^+\/0-9A-Za-z-_]/g;function ae(e){return e<16?"0"+e.toString(16):e.toString(16)}function le(e,t){var r;t=t||1/0;for(var n=e.length,i=null,s=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function ue(e){return function(e){var t,r,n,i,s,o;g||y();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s="="===e[a-2]?2:"="===e[a-1]?1:0,o=new _(3*a/4-s),n=s>0?a-4:a;var l=0;for(t=0,r=0;t<n;t+=4,r+=3)i=m[e.charCodeAt(t)]<<18|m[e.charCodeAt(t+1)]<<12|m[e.charCodeAt(t+2)]<<6|m[e.charCodeAt(t+3)],o[l++]=i>>16&255,o[l++]=i>>8&255,o[l++]=255&i;return 2===s?(i=m[e.charCodeAt(t)]<<2|m[e.charCodeAt(t+1)]>>4,o[l++]=255&i):1===s&&(i=m[e.charCodeAt(t)]<<10|m[e.charCodeAt(t+1)]<<4|m[e.charCodeAt(t+2)]>>2,o[l++]=i>>8&255,o[l++]=255&i),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(oe,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ce(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function he(e){return null!=e&&(!!e._isBuffer||de(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&de(e.slice(0,0))}(e))}function de(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var fe=Object.freeze({__proto__:null,Buffer:O,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),O.alloc(+e)},isBuffer:he,kMaxLength:T});function pe(){throw new Error("setTimeout has not been defined")}function me(){throw new Error("clearTimeout has not been defined")}var _e=pe,ge=me;function ye(e){if(_e===setTimeout)return setTimeout(e,0);if((_e===pe||!_e)&&setTimeout)return _e=setTimeout,setTimeout(e,0);try{return _e(e,0)}catch(t){try{return _e.call(null,e,0)}catch(t){return _e.call(this,e,0)}}}"function"==typeof f.setTimeout&&(_e=setTimeout),"function"==typeof f.clearTimeout&&(ge=clearTimeout);var ve,be=[],xe=!1,we=-1;function Ae(){xe&&ve&&(xe=!1,ve.length?be=ve.concat(be):we=-1,be.length&&Ee())}function Ee(){if(!xe){var e=ye(Ae);xe=!0;for(var t=be.length;t;){for(ve=be,be=[];++we<t;)ve&&ve[we].run();we=-1,t=be.length}ve=null,xe=!1,function(e){if(ge===clearTimeout)return clearTimeout(e);if((ge===me||!ge)&&clearTimeout)return ge=clearTimeout,clearTimeout(e);try{return ge(e)}catch(t){try{return ge.call(null,e)}catch(t){return ge.call(this,e)}}}(e)}}function Te(e,t){this.fun=e,this.array=t}Te.prototype.run=function(){this.fun.apply(null,this.array)};var Se=f.performance||{};function ke(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}Se.now||Se.mozNow||Se.msNow||Se.oNow||Se.webkitNow;var Oe,Re,Ce,Ne,Pe,Me,De,ze,Ie,Fe,Le,je,Ue,Be,Ve,Ge,$e,qe,We,He,Ze,Ke,Xe,Ye,Qe,Je,et,tt,rt,nt,it,st,ot,at,lt={exports:{}},ut=(Oe||(Oe=1,lt.exports=function e(t,r,n){function i(o,a){if(!r[o]){if(!t[o]){if(!a&&ke)return ke(o);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var u=r[o]={exports:{}};t[o][0].call(u.exports,function(e){return i(t[o][1][e]||e)},u,u.exports,e,t,r,n)}return r[o].exports}for(var s=ke,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,t,r){var n=e("./utils"),i=e("./support"),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(e){for(var t,r,i,o,a,l,u,c=[],h=0,d=e.length,f=d,p="string"!==n.getTypeOf(e);h<e.length;)f=d-h,i=p?(t=e[h++],r=h<d?e[h++]:0,h<d?e[h++]:0):(t=e.charCodeAt(h++),r=h<d?e.charCodeAt(h++):0,h<d?e.charCodeAt(h++):0),o=t>>2,a=(3&t)<<4|r>>4,l=1<f?(15&r)<<2|i>>6:64,u=2<f?63&i:64,c.push(s.charAt(o)+s.charAt(a)+s.charAt(l)+s.charAt(u));return c.join("")},r.decode=function(e){var t,r,n,o,a,l,u=0,c=0,h="data:";if(e.substr(0,5)===h)throw new Error("Invalid base64 input, it looks like a data url.");var d,f=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===s.charAt(64)&&f--,e.charAt(e.length-2)===s.charAt(64)&&f--,f%1!=0)throw new Error("Invalid base64 input, bad content length.");for(d=i.uint8array?new Uint8Array(0|f):new Array(0|f);u<e.length;)t=s.indexOf(e.charAt(u++))<<2|(o=s.indexOf(e.charAt(u++)))>>4,r=(15&o)<<4|(a=s.indexOf(e.charAt(u++)))>>2,n=(3&a)<<6|(l=s.indexOf(e.charAt(u++))),d[c++]=t,64!==a&&(d[c++]=r),64!==l&&(d[c++]=n);return d}},{"./support":30,"./utils":32}],2:[function(e,t,r){var n=e("./external"),i=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function a(e,t,r,n,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=n,this.compressedContent=i}a.prototype={getContentWorker:function(){var e=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,r){return e.pipe(new s).pipe(new o("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){var n=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){var n=e("./utils"),i=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==n.getTypeOf(e)?function(e,t,r){var n=i,s=0+r;e^=-1;for(var o=0;o<s;o++)e=e>>>8^n[255&(e^t[o])];return~e}(0|t,e,e.length):function(e,t,r){var n=i,s=0+r;e^=-1;for(var o=0;o<s;o++)e=e>>>8^n[255&(e^t.charCodeAt(o))];return~e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,r){r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){var n;n="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:n}},{lie:37}],7:[function(e,t,r){var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=e("pako"),s=e("./utils"),o=e("./stream/GenericWorker"),a=n?"uint8array":"array";function l(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}r.magic="\b\0",s.inherits(l,o),l.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(a,e.data),!1)},l.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},r.compressWorker=function(e){return new l("Deflate",e)},r.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){function n(e,t){var r,n="";for(r=0;r<t;r++)n+=String.fromCharCode(255&e),e>>>=8;return n}function i(e,t,r,i,o,c){var h,d,f=e.file,p=e.compression,m=c!==a.utf8encode,_=s.transformTo("string",c(f.name)),g=s.transformTo("string",a.utf8encode(f.name)),y=f.comment,v=s.transformTo("string",c(y)),b=s.transformTo("string",a.utf8encode(y)),x=g.length!==f.name.length,w=b.length!==y.length,A="",E="",T="",S=f.dir,k=f.date,O={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(O.crc32=e.crc32,O.compressedSize=e.compressedSize,O.uncompressedSize=e.uncompressedSize);var R=0;t&&(R|=8),m||!x&&!w||(R|=2048);var C=0,N=0;S&&(C|=16),"UNIX"===o?(N=798,C|=function(e,t){var r=e;return e||(r=t?16893:33204),(65535&r)<<16}(f.unixPermissions,S)):(N=20,C|=function(e){return 63&(e||0)}(f.dosPermissions)),h=k.getUTCHours(),h<<=6,h|=k.getUTCMinutes(),h<<=5,h|=k.getUTCSeconds()/2,d=k.getUTCFullYear()-1980,d<<=4,d|=k.getUTCMonth()+1,d<<=5,d|=k.getUTCDate(),x&&(E=n(1,1)+n(l(_),4)+g,A+="up"+n(E.length,2)+E),w&&(T=n(1,1)+n(l(v),4)+b,A+="uc"+n(T.length,2)+T);var P="";return P+="\n\0",P+=n(R,2),P+=p.magic,P+=n(h,2),P+=n(d,2),P+=n(O.crc32,4),P+=n(O.compressedSize,4),P+=n(O.uncompressedSize,4),P+=n(_.length,2),P+=n(A.length,2),{fileRecord:u.LOCAL_FILE_HEADER+P+_+A,dirRecord:u.CENTRAL_FILE_HEADER+n(N,2)+P+n(v.length,2)+"\0\0\0\0"+n(C,4)+n(i,4)+_+A+v}}var s=e("../utils"),o=e("../stream/GenericWorker"),a=e("../utf8"),l=e("../crc32"),u=e("../signature");function c(e,t,r,n){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=n,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(c,o),c.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-n-1))/r:100}}))},c.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},c.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:function(e){return u.DATA_DESCRIPTOR+n(e.crc32,4)+n(e.compressedSize,4)+n(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},c.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var r=this.bytesWritten-e,i=function(e,t,r,i,o){var a=s.transformTo("string",o(i));return u.CENTRAL_DIRECTORY_END+"\0\0\0\0"+n(e,2)+n(e,2)+n(t,4)+n(r,4)+n(a.length,2)+a}(this.dirRecords.length,r,e,this.zipComment,this.encodeFileName);this.push({data:i,meta:{percent:100}})},c.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},c.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(e){t.error(e)}),this},c.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},c.prototype.error=function(e){var t=this._sources;if(!o.prototype.error.call(this,e))return!1;for(var r=0;r<t.length;r++)try{t[r].error(e)}catch(e){}return!0},c.prototype.lock=function(){o.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=c},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,r){var n=e("../compressions"),i=e("./ZipFileWorker");r.generateWorker=function(e,t,r){var s=new i(t.streamFiles,r,t.platform,t.encodeFileName),o=0;try{e.forEach(function(e,r){o++;var i=function(e,t){var r=e||t,i=n[r];if(!i)throw new Error(r+" is not a valid compression method !");return i}(r.options.compression,t.compression),a=r.options.compressionOptions||t.compressionOptions||{},l=r.dir,u=r.date;r._compressWorker(i,a).withStreamInfo("file",{name:e,dir:l,date:u,comment:r.comment||"",unixPermissions:r.unixPermissions,dosPermissions:r.dosPermissions}).pipe(s)}),s.entriesCount=o}catch(e){s.error(e)}return s}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,r){function n(){if(!(this instanceof n))return new n;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new n;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(n.prototype=e("./object")).loadAsync=e("./load"),n.support=e("./support"),n.defaults=e("./defaults"),n.version="3.10.1",n.loadAsync=function(e,t){return(new n).loadAsync(e,t)},n.external=e("./external"),t.exports=n},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,r){var n=e("./utils"),i=e("./external"),s=e("./utf8"),o=e("./zipEntries"),a=e("./stream/Crc32Probe"),l=e("./nodejsUtils");function u(e){return new i.Promise(function(t,r){var n=e.decompressed.getContentWorker().pipe(new a);n.on("error",function(e){r(e)}).on("end",function(){n.streamInfo.crc32!==e.decompressed.crc32?r(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}t.exports=function(e,t){var r=this;return t=n.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:s.utf8decode}),l.isNode&&l.isStream(e)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(e){var r=new o(t);return r.load(e),r}).then(function(e){var r=[i.Promise.resolve(e)],n=e.files;if(t.checkCRC32)for(var s=0;s<n.length;s++)r.push(u(n[s]));return i.Promise.all(r)}).then(function(e){for(var i=e.shift(),s=i.files,o=0;o<s.length;o++){var a=s[o],l=a.fileNameStr,u=n.resolve(a.fileNameStr);r.file(u,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:t.createFolders}),a.dir||(r.file(u).unsafeOriginalName=l)}return i.zipComment.length&&(r.comment=i.zipComment),r})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,r){var n=e("../utils"),i=e("../stream/GenericWorker");function s(e,t){i.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}n.inherits(s,i),s.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},s.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=s},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,r){var n=e("readable-stream").Readable;function i(e,t,r){n.call(this,t),this._helper=e;var i=this;e.on("data",function(e,t){i.push(e)||i._helper.pause(),r&&r(t)}).on("error",function(e){i.emit("error",e)}).on("end",function(){i.push(null)})}e("../utils").inherits(i,n),i.prototype._read=function(){this._helper.resume()},t.exports=i},{"../utils":32,"readable-stream":16}],14:[function(e,t,r){t.exports={isNode:void 0!==O,newBufferFrom:function(e,t){if(O.from&&O.from!==Uint8Array.from)return O.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new O(e,t)},allocBuffer:function(e){if(O.alloc)return O.alloc(e);var t=new O(e);return t.fill(0),t},isBuffer:function(e){return he(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,r){function n(e,t,r){var n,i=s.getTypeOf(t),a=s.extend(r||{},l);a.date=a.date||new Date,null!==a.compression&&(a.compression=a.compression.toUpperCase()),"string"==typeof a.unixPermissions&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&16384&a.unixPermissions&&(a.dir=!0),a.dosPermissions&&16&a.dosPermissions&&(a.dir=!0),a.dir&&(e=m(e)),a.createFolders&&(n=p(e))&&_.call(this,n,!0);var h="string"===i&&!1===a.binary&&!1===a.base64;r&&void 0!==r.binary||(a.binary=!h),(t instanceof u&&0===t.uncompressedSize||a.dir||!t||0===t.length)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",i="string");var g;g=t instanceof u||t instanceof o?t:d.isNode&&d.isStream(t)?new f(e,t):s.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var y=new c(e,g,a);this.files[e]=y}var i=e("./utf8"),s=e("./utils"),o=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),l=e("./defaults"),u=e("./compressedObject"),c=e("./zipObject"),h=e("./generate"),d=e("./nodejsUtils"),f=e("./nodejs/NodejsStreamInputAdapter"),p=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},m=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},_=function(e,t){return t=void 0!==t?t:l.createFolders,e=m(e),this.files[e]||n.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function g(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var y={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,r,n;for(t in this.files)n=this.files[t],(r=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(r,n)},filter:function(e){var t=[];return this.forEach(function(r,n){e(r,n)&&t.push(n)}),t},file:function(e,t,r){if(1!==arguments.length)return e=this.root+e,n.call(this,e,t,r),this;if(g(e)){var i=e;return this.filter(function(e,t){return!t.dir&&i.test(e)})}var s=this.files[this.root+e];return s&&!s.dir?s:null},folder:function(e){if(!e)return this;if(g(e))return this.filter(function(t,r){return r.dir&&e.test(t)});var t=this.root+e,r=_.call(this,t),n=this.clone();return n.root=r.name,n},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var r=this.filter(function(t,r){return r.name.slice(0,e.length)===e}),n=0;n<r.length;n++)delete this.files[r[n].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,r={};try{if((r=s.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),"binarystring"===r.type&&(r.type="string"),!r.type)throw new Error("No output type specified.");s.checkSupport(r.type),"darwin"!==r.platform&&"freebsd"!==r.platform&&"linux"!==r.platform&&"sunos"!==r.platform||(r.platform="UNIX"),"win32"===r.platform&&(r.platform="DOS");var n=r.comment||this.comment||"";t=h.generateWorker(this,r,n)}catch(e){(t=new o("error")).error(e)}return new a(t,r.type||"string",r.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=y},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,r){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,r){var n=e("./DataReader");function i(e){n.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(i,n),i.prototype.byteAt=function(e){return this.data[this.zero+e]},i.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),i=e.charCodeAt(3),s=this.length-4;0<=s;--s)if(this.data[s]===t&&this.data[s+1]===r&&this.data[s+2]===n&&this.data[s+3]===i)return s-this.zero;return-1},i.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),i=e.charCodeAt(3),s=this.readData(4);return t===s[0]&&r===s[1]&&n===s[2]&&i===s[3]},i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],18:[function(e,t,r){var n=e("../utils");function i(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,r=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return n.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,r){var n=e("./Uint8ArrayReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){var n=e("./DataReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){var n=e("./ArrayReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){var n=e("../utils"),i=e("../support"),s=e("./ArrayReader"),o=e("./StringReader"),a=e("./NodeBufferReader"),l=e("./Uint8ArrayReader");t.exports=function(e){var t=n.getTypeOf(e);return n.checkSupport(t),"string"!==t||i.uint8array?"nodebuffer"===t?new a(e):i.uint8array?new l(n.transformTo("uint8array",e)):new s(n.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,r){var n=e("./GenericWorker"),i=e("../utils");function s(e){n.call(this,"ConvertWorker to "+e),this.destType=e}i.inherits(s,n),s.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){var n=e("./GenericWorker"),i=e("../crc32");function s(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(s,n),s.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){var n=e("../utils"),i=e("./GenericWorker");function s(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}n.inherits(s,i),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){var n=e("../utils"),i=e("./GenericWorker");function s(e){i.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=n.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}n.inherits(s,i),s.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){function n(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r<this._listeners[e].length;r++)this._listeners[e][r].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=n},{}],29:[function(e,t,r){var n=e("../utils"),i=e("./ConvertWorker"),s=e("./GenericWorker"),o=e("../base64"),a=e("../support"),l=e("../external"),u=null;if(a.nodestream)try{u=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function c(e,t,r){var o=t;switch(t){case"blob":case"arraybuffer":o="uint8array";break;case"base64":o="string"}try{this._internalType=o,this._outputType=t,this._mimeType=r,n.checkSupport(o),this._worker=e.pipe(new i(o)),e.lock()}catch(e){this._worker=new s("error"),this._worker.error(e)}}c.prototype={accumulate:function(e){return function(e,t){return new l.Promise(function(r,i){var s=[],a=e._internalType,l=e._outputType,u=e._mimeType;e.on("data",function(e,r){s.push(e),t&&t(r)}).on("error",function(e){s=[],i(e)}).on("end",function(){try{var e=function(e,t,r){switch(e){case"blob":return n.newBlob(n.transformTo("arraybuffer",t),r);case"base64":return o.encode(t);default:return n.transformTo(e,t)}}(l,function(e,t){var r,n=0,i=null,s=0;for(r=0;r<t.length;r++)s+=t[r].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(i=new Uint8Array(s),r=0;r<t.length;r++)i.set(t[r],n),n+=t[r].length;return i;case"nodebuffer":return O.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(a,s),u);r(e)}catch(e){i(e)}s=[]}).resume()})}(this,e)},on:function(e,t){var r=this;return"data"===e?this._worker.on(e,function(e){t.call(r,e.data,e.meta)}):this._worker.on(e,function(){n.delay(t,arguments,r)}),this},resume:function(){return n.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(n.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new u(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=c},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,r){if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,r.nodebuffer=void 0!==O,r.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)r.blob=!1;else{var n=new ArrayBuffer(0);try{r.blob=0===new Blob([n],{type:"application/zip"}).size}catch(e){try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(n),r.blob=0===i.getBlob("application/zip").size}catch(e){r.blob=!1}}}try{r.nodestream=!!e("readable-stream").Readable}catch(e){r.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,r){for(var n=e("./utils"),i=e("./support"),s=e("./nodejsUtils"),o=e("./stream/GenericWorker"),a=new Array(256),l=0;l<256;l++)a[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function u(){o.call(this,"utf-8 decode"),this.leftOver=null}function c(){o.call(this,"utf-8 encode")}a[254]=a[254]=1,r.utf8encode=function(e){return i.nodebuffer?s.newBufferFrom(e,"utf-8"):function(e){var t,r,n,s,o,a=e.length,l=0;for(s=0;s<a;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(n-56320),s++),l+=r<128?1:r<2048?2:r<65536?3:4;for(t=i.uint8array?new Uint8Array(l):new Array(l),s=o=0;o<l;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(n-56320),s++),r<128?t[o++]=r:(r<2048?t[o++]=192|r>>>6:(r<65536?t[o++]=224|r>>>12:(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63),t[o++]=128|r>>>6&63),t[o++]=128|63&r);return t}(e)},r.utf8decode=function(e){return i.nodebuffer?n.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,r,i,s,o=e.length,l=new Array(2*o);for(t=r=0;t<o;)if((i=e[t++])<128)l[r++]=i;else if(4<(s=a[i]))l[r++]=65533,t+=s-1;else{for(i&=2===s?31:3===s?15:7;1<s&&t<o;)i=i<<6|63&e[t++],s--;1<s?l[r++]=65533:i<65536?l[r++]=i:(i-=65536,l[r++]=55296|i>>10&1023,l[r++]=56320|1023&i)}return l.length!==r&&(l.subarray?l=l.subarray(0,r):l.length=r),n.applyFromCharCode(l)}(e=n.transformTo(i.uint8array?"uint8array":"array",e))},n.inherits(u,o),u.prototype.processChunk=function(e){var t=n.transformTo(i.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var s=t;(t=new Uint8Array(s.length+this.leftOver.length)).set(this.leftOver,0),t.set(s,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0||0===r?t:r+a[e[r]]>t?r:t}(t),l=t;o!==t.length&&(i.uint8array?(l=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(l=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:r.utf8decode(l),meta:e.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=u,n.inherits(c,o),c.prototype.processChunk=function(e){this.push({data:r.utf8encode(e.data),meta:e.meta})},r.Utf8EncodeWorker=c},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,r){var n=e("./support"),i=e("./base64"),s=e("./nodejsUtils"),o=e("./external");function a(e){return e}function l(e,t){for(var r=0;r<e.length;++r)t[r]=255&e.charCodeAt(r);return t}e("setimmediate"),r.newBlob=function(e,t){r.checkSupport("blob");try{return new Blob([e],{type:t})}catch(r){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return n.append(e),n.getBlob(t)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var u={stringifyByChunk:function(e,t,r){var n=[],i=0,s=e.length;if(s<=r)return String.fromCharCode.apply(null,e);for(;i<s;)"array"===t||"nodebuffer"===t?n.push(String.fromCharCode.apply(null,e.slice(i,Math.min(i+r,s)))):n.push(String.fromCharCode.apply(null,e.subarray(i,Math.min(i+r,s)))),i+=r;return n.join("")},stringifyByChar:function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},applyCanBeUsed:{uint8array:function(){try{return n.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return n.nodebuffer&&1===String.fromCharCode.apply(null,s.allocBuffer(1)).length}catch(e){return!1}}()}};function c(e){var t=65536,n=r.getTypeOf(e),i=!0;if("uint8array"===n?i=u.applyCanBeUsed.uint8array:"nodebuffer"===n&&(i=u.applyCanBeUsed.nodebuffer),i)for(;1<t;)try{return u.stringifyByChunk(e,n,t)}catch(e){t=Math.floor(t/2)}return u.stringifyByChar(e)}function h(e,t){for(var r=0;r<e.length;r++)t[r]=e[r];return t}r.applyFromCharCode=c;var d={};d.string={string:a,array:function(e){return l(e,new Array(e.length))},arraybuffer:function(e){return d.string.uint8array(e).buffer},uint8array:function(e){return l(e,new Uint8Array(e.length))},nodebuffer:function(e){return l(e,s.allocBuffer(e.length))}},d.array={string:c,array:a,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return s.newBufferFrom(e)}},d.arraybuffer={string:function(e){return c(new Uint8Array(e))},array:function(e){return h(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:a,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return s.newBufferFrom(new Uint8Array(e))}},d.uint8array={string:c,array:function(e){return h(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:a,nodebuffer:function(e){return s.newBufferFrom(e)}},d.nodebuffer={string:c,array:function(e){return h(e,new Array(e.length))},arraybuffer:function(e){return d.nodebuffer.uint8array(e).buffer},uint8array:function(e){return h(e,new Uint8Array(e.length))},nodebuffer:a},r.transformTo=function(e,t){if(t=t||"",!e)return t;r.checkSupport(e);var n=r.getTypeOf(t);return d[n][e](t)},r.resolve=function(e){for(var t=e.split("/"),r=[],n=0;n<t.length;n++){var i=t[n];"."===i||""===i&&0!==n&&n!==t.length-1||(".."===i?r.pop():r.push(i))}return r.join("/")},r.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":n.nodebuffer&&s.isBuffer(e)?"nodebuffer":n.uint8array&&e instanceof Uint8Array?"uint8array":n.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},r.checkSupport=function(e){if(!n[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(e){var t,r,n="";for(r=0;r<(e||"").length;r++)n+="\\x"+((t=e.charCodeAt(r))<16?"0":"")+t.toString(16).toUpperCase();return n},r.delay=function(e,t,r){setImmediate(function(){e.apply(r||null,t||[])})},r.inherits=function(e,t){function r(){}r.prototype=t.prototype,e.prototype=new r},r.extend=function(){var e,t,r={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===r[t]&&(r[t]=arguments[e][t]);return r},r.prepareContent=function(e,t,s,a,u){return o.Promise.resolve(t).then(function(e){return n.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new o.Promise(function(t,r){var n=new FileReader;n.onload=function(e){t(e.target.result)},n.onerror=function(e){r(e.target.error)},n.readAsArrayBuffer(e)}):e}).then(function(t){var c=r.getTypeOf(t);return c?("arraybuffer"===c?t=r.transformTo("uint8array",t):"string"===c&&(u?t=i.decode(t):s&&!0!==a&&(t=function(e){return l(e,n.uint8array?new Uint8Array(e.length):new Array(e.length))}(t))),t):o.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,r){var n=e("./reader/readerFor"),i=e("./utils"),s=e("./signature"),o=e("./zipEntry"),a=e("./support");function l(e){this.files=[],this.loadOptions=e}l.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(t)+", expected "+i.pretty(e)+")")}},isSignature:function(e,t){var r=this.reader.index;this.reader.setIndex(e);var n=this.reader.readString(4)===t;return this.reader.setIndex(r),n},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=a.uint8array?"uint8array":"array",r=i.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(r)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,r,n=this.zip64EndOfCentralSize-44;0<n;)e=this.reader.readInt(2),t=this.reader.readInt(4),r=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:r}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER);)(e=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,s.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(e);var t=e;if(this.checkSignature(s.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,s.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var r=this.centralDirOffset+this.centralDirSize;this.zip64&&(r+=20,r+=12+this.zip64EndOfCentralSize);var n=t-r;if(0<n)this.isSignature(t,s.CENTRAL_FILE_HEADER)||(this.reader.zero=n);else if(n<0)throw new Error("Corrupted zip: missing "+Math.abs(n)+" bytes.")},prepareReader:function(e){this.reader=n(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=l},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,r){var n=e("./reader/readerFor"),i=e("./utils"),s=e("./compressedObject"),o=e("./crc32"),a=e("./utf8"),l=e("./compressions"),u=e("./support");function c(e,t){this.options=e,this.loadOptions=t}c.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(e){var t,r;if(e.skip(22),this.fileNameLength=e.readInt(2),r=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(r),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in l)if(Object.prototype.hasOwnProperty.call(l,t)&&l[t].magic===e)return l[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new s(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=n(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,r,n,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<i;)t=e.readInt(2),r=e.readInt(2),n=e.readData(r),this.extraFields[t]={id:t,length:r,value:n};e.setIndex(i)},handleUTF8:function(){var e=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var r=i.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var n=this.findExtraFieldUnicodeComment();if(null!==n)this.fileCommentStr=n;else{var s=i.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(s)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=n(e.value);return 1!==t.readInt(1)||o(this.fileName)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=n(e.value);return 1!==t.readInt(1)||o(this.fileComment)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null}},t.exports=c},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,r){function n(e,t,r){this.name=e,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=t,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}}var i=e("./stream/StreamHelper"),s=e("./stream/DataWorker"),o=e("./utf8"),a=e("./compressedObject"),l=e("./stream/GenericWorker");n.prototype={internalStream:function(e){var t=null,r="string";try{if(!e)throw new Error("No output type specified.");var n="string"===(r=e.toLowerCase())||"text"===r;"binarystring"!==r&&"text"!==r||(r="string"),t=this._decompressWorker();var s=!this._dataBinary;s&&!n&&(t=t.pipe(new o.Utf8EncodeWorker)),!s&&n&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(e){(t=new l("error")).error(e)}return new i(t,r,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof a&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new o.Utf8EncodeWorker)),a.createWorkerFrom(r,e,t)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof l?this._data:new s(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],c=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},h=0;h<u.length;h++)n.prototype[u[h]]=c;t.exports=n},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,r){(function(e){var r,n,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var s=0,o=new i(c),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),r=function(){a.data=s=++s%2}}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){c(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(c,0)};else{var l=new e.MessageChannel;l.port1.onmessage=c,r=function(){l.port2.postMessage(0)}}var u=[];function c(){var e,t;n=!0;for(var r=u.length;r;){for(t=u,u=[],e=-1;++e<r;)t[e]();r=u.length}n=!1}t.exports=function(e){1!==u.push(e)||n||r()}}).call(this,void 0!==f?f:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,r){var n=e("immediate");function i(){}var s={},o=["REJECTED"],a=["FULFILLED"],l=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==i&&f(this,e)}function c(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function h(e,t,r){n(function(){var n;try{n=t(r)}catch(n){return s.reject(e,n)}n===e?s.reject(e,new TypeError("Cannot resolve promise with itself")):s.resolve(e,n)})}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function f(e,t){var r=!1;function n(t){r||(r=!0,s.reject(e,t))}function i(t){r||(r=!0,s.resolve(e,t))}var o=p(function(){t(i,n)});"error"===o.status&&n(o.value)}function p(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}(t.exports=u).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then(function(r){return t.resolve(e()).then(function(){return r})},function(r){return t.resolve(e()).then(function(){throw r})})},u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var r=new this.constructor(i);return this.state!==l?h(r,this.state===a?e:t,this.outcome):this.queue.push(new c(r,e,t)),r},c.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},c.prototype.otherCallFulfilled=function(e){h(this.promise,this.onFulfilled,e)},c.prototype.callRejected=function(e){s.reject(this.promise,e)},c.prototype.otherCallRejected=function(e){h(this.promise,this.onRejected,e)},s.resolve=function(e,t){var r=p(d,t);if("error"===r.status)return s.reject(e,r.value);var n=r.value;if(n)f(e,n);else{e.state=a,e.outcome=t;for(var i=-1,o=e.queue.length;++i<o;)e.queue[i].callFulfilled(t)}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},u.resolve=function(e){return e instanceof this?e:s.resolve(new this(i),e)},u.reject=function(e){var t=new this(i);return s.reject(t,e)},u.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var o=new Array(r),a=0,l=-1,u=new this(i);++l<r;)c(e[l],l);return u;function c(e,i){t.resolve(e).then(function(e){o[i]=e,++a!==r||n||(n=!0,s.resolve(u,o))},function(e){n||(n=!0,s.reject(u,e))})}},u.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,r=!1;if(!t)return this.resolve([]);for(var n,o=-1,a=new this(i);++o<t;)n=e[o],this.resolve(n).then(function(e){r||(r=!0,s.resolve(a,e))},function(e){r||(r=!0,s.reject(a,e))});return a}},{immediate:36}],38:[function(e,t,r){var n={};(0,e("./lib/utils/common").assign)(n,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=n},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,r){var n=e("./zlib/deflate"),i=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/messages"),a=e("./zlib/zstream"),l=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=i.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var r=n.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(o[r]);if(t.header&&n.deflateSetHeader(this.strm,t.header),t.dictionary){var c;if(c="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=n.deflateSetDictionary(this.strm,c)))throw new Error(o[r]);this._dict_set=!0}}function c(e,t){var r=new u(t);if(r.push(e,!0),r.err)throw r.msg||o[r.err];return r.result}u.prototype.push=function(e,t){var r,o,a=this.strm,u=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=s.string2buf(e):"[object ArrayBuffer]"===l.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new i.Buf8(u),a.next_out=0,a.avail_out=u),1!==(r=n.deflate(a,o))&&0!==r)return this.onEnd(r),!(this.ended=!0);0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(s.buf2binstring(i.shrinkBuf(a.output,a.next_out))):this.onData(i.shrinkBuf(a.output,a.next_out)))}while((0<a.avail_in||0===a.avail_out)&&1!==r);return 4===o?(r=n.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==o||(this.onEnd(0),!(a.avail_out=0))},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Deflate=u,r.deflate=c,r.deflateRaw=function(e,t){return(t=t||{}).raw=!0,c(e,t)},r.gzip=function(e,t){return(t=t||{}).gzip=!0,c(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,r){var n=e("./zlib/inflate"),i=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/constants"),a=e("./zlib/messages"),l=e("./zlib/zstream"),u=e("./zlib/gzheader"),c=Object.prototype.toString;function h(e){if(!(this instanceof h))return new h(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var r=n.inflateInit2(this.strm,t.windowBits);if(r!==o.Z_OK)throw new Error(a[r]);this.header=new u,n.inflateGetHeader(this.strm,this.header)}function d(e,t){var r=new h(t);if(r.push(e,!0),r.err)throw r.msg||a[r.err];return r.result}h.prototype.push=function(e,t){var r,a,l,u,h,d,f=this.strm,p=this.options.chunkSize,m=this.options.dictionary,_=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?f.input=s.binstring2buf(e):"[object ArrayBuffer]"===c.call(e)?f.input=new Uint8Array(e):f.input=e,f.next_in=0,f.avail_in=f.input.length;do{if(0===f.avail_out&&(f.output=new i.Buf8(p),f.next_out=0,f.avail_out=p),(r=n.inflate(f,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&m&&(d="string"==typeof m?s.string2buf(m):"[object ArrayBuffer]"===c.call(m)?new Uint8Array(m):m,r=n.inflateSetDictionary(this.strm,d)),r===o.Z_BUF_ERROR&&!0===_&&(r=o.Z_OK,_=!1),r!==o.Z_STREAM_END&&r!==o.Z_OK)return this.onEnd(r),!(this.ended=!0);f.next_out&&(0!==f.avail_out&&r!==o.Z_STREAM_END&&(0!==f.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(l=s.utf8border(f.output,f.next_out),u=f.next_out-l,h=s.buf2string(f.output,l),f.next_out=u,f.avail_out=p-u,u&&i.arraySet(f.output,f.output,l,u,0),this.onData(h)):this.onData(i.shrinkBuf(f.output,f.next_out)))),0===f.avail_in&&0===f.avail_out&&(_=!0)}while((0<f.avail_in||0===f.avail_out)&&r!==o.Z_STREAM_END);return r===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(r=n.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(f.avail_out=0))},h.prototype.onData=function(e){this.chunks.push(e)},h.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Inflate=h,r.inflate=d,r.inflateRaw=function(e,t){return(t=t||{}).raw=!0,d(e,t)},r.ungzip=d},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,r){var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;r.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])}}return e},r.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var s=0;s<n;s++)e[i+s]=t[r+s]},flattenChunks:function(e){var t,r,n,i,s,o;for(t=n=0,r=e.length;t<r;t++)n+=e[t].length;for(o=new Uint8Array(n),t=i=0,r=e.length;t<r;t++)s=e[t],o.set(s,i),i+=s.length;return o}},s={arraySet:function(e,t,r,n,i){for(var s=0;s<n;s++)e[i+s]=t[r+s]},flattenChunks:function(e){return[].concat.apply([],e)}};r.setTyped=function(e){e?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,i)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,s))},r.setTyped(n)},{}],42:[function(e,t,r){var n=e("./common"),i=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var o=new n.Buf8(256),a=0;a<256;a++)o[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function l(e,t){if(t<65537&&(e.subarray&&s||!e.subarray&&i))return String.fromCharCode.apply(null,n.shrinkBuf(e,t));for(var r="",o=0;o<t;o++)r+=String.fromCharCode(e[o]);return r}o[254]=o[254]=1,r.string2buf=function(e){var t,r,i,s,o,a=e.length,l=0;for(s=0;s<a;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(i-56320),s++),l+=r<128?1:r<2048?2:r<65536?3:4;for(t=new n.Buf8(l),s=o=0;o<l;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(i-56320),s++),r<128?t[o++]=r:(r<2048?t[o++]=192|r>>>6:(r<65536?t[o++]=224|r>>>12:(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63),t[o++]=128|r>>>6&63),t[o++]=128|63&r);return t},r.buf2binstring=function(e){return l(e,e.length)},r.binstring2buf=function(e){for(var t=new n.Buf8(e.length),r=0,i=t.length;r<i;r++)t[r]=e.charCodeAt(r);return t},r.buf2string=function(e,t){var r,n,i,s,a=t||e.length,u=new Array(2*a);for(r=n=0;r<a;)if((i=e[r++])<128)u[n++]=i;else if(4<(s=o[i]))u[n++]=65533,r+=s-1;else{for(i&=2===s?31:3===s?15:7;1<s&&r<a;)i=i<<6|63&e[r++],s--;1<s?u[n++]=65533:i<65536?u[n++]=i:(i-=65536,u[n++]=55296|i>>10&1023,u[n++]=56320|1023&i)}return l(u,n)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0||0===r?t:r+o[e[r]]>t?r:t}},{"./common":41}],43:[function(e,t,r){t.exports=function(e,t,r,n){for(var i=65535&e,s=e>>>16&65535,o=0;0!==r;){for(r-=o=2e3<r?2e3:r;s=s+(i=i+t[n++]|0)|0,--o;);i%=65521,s%=65521}return i|s<<16}},{}],44:[function(e,t,r){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,r){var n=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t,r,i){var s=n,o=i+r;e^=-1;for(var a=i;a<o;a++)e=e>>>8^s[255&(e^t[a])];return~e}},{}],46:[function(e,t,r){var n,i=e("../utils/common"),s=e("./trees"),o=e("./adler32"),a=e("./crc32"),l=e("./messages"),u=-2,c=258,h=262,d=113;function f(e,t){return e.msg=l[t],t}function p(e){return(e<<1)-(4<e?9:0)}function m(e){for(var t=e.length;0<=--t;)e[t]=0}function _(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(i.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function g(e,t){s._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,_(e.strm)}function y(e,t){e.pending_buf[e.pending++]=t}function v(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function b(e,t){var r,n,i=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-h?e.strstart-(e.w_size-h):0,u=e.window,d=e.w_mask,f=e.prev,p=e.strstart+c,m=u[s+o-1],_=u[s+o];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+o]===_&&u[r+o-1]===m&&u[r]===u[s]&&u[++r]===u[s+1]){s+=2,r++;do{}while(u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&s<p);if(n=c-(p-s),s=p-c,o<n){if(e.match_start=t,a<=(o=n))break;m=u[s+o-1],_=u[s+o]}}}while((t=f[t&d])>l&&0!=--i);return o<=e.lookahead?o:e.lookahead}function x(e){var t,r,n,s,l,u,c,d,f,p,m=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-h)){for(i.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=r=e.hash_size;n=e.head[--t],e.head[t]=m<=n?n-m:0,--r;);for(t=r=m;n=e.prev[--t],e.prev[t]=m<=n?n-m:0,--r;);s+=m}if(0===e.strm.avail_in)break;if(u=e.strm,c=e.window,d=e.strstart+e.lookahead,p=void 0,(f=s)<(p=u.avail_in)&&(p=f),r=0===p?0:(u.avail_in-=p,i.arraySet(c,u.input,u.next_in,p,d),1===u.state.wrap?u.adler=o(u.adler,c,p,d):2===u.state.wrap&&(u.adler=a(u.adler,c,p,d)),u.next_in+=p,u.total_in+=p,p),e.lookahead+=r,e.lookahead+e.insert>=3)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+3-1])&e.hash_mask,e.prev[l&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=l,l++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<h&&0!==e.strm.avail_in)}function w(e,t){for(var r,n;;){if(e.lookahead<h){if(x(e),e.lookahead<h&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-h&&(e.match_length=b(e,r)),e.match_length>=3)if(n=s._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}function A(e,t){for(var r,n,i;;){if(e.lookahead<h){if(x(e),e.lookahead<h&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-h&&(e.match_length=b(e,r),e.match_length<=5&&(1===e.strategy||3===e.match_length&&4096<e.strstart-e.match_start)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-3,n=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(g(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=s._tr_tally(e,0,e.window[e.strstart-1]))&&g(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=s._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}function E(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function T(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(1146),this.dyn_dtree=new i.Buf16(122),this.bl_tree=new i.Buf16(78),m(this.dyn_ltree),m(this.dyn_dtree),m(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(16),this.heap=new i.Buf16(573),m(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(573),m(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function S(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:d,e.adler=2===t.wrap?0:1,t.last_flush=0,s._tr_init(t),0):f(e,u)}function k(e){var t=S(e);return 0===t&&function(e){e.window_size=2*e.w_size,m(e.head),e.max_lazy_match=n[e.level].max_lazy,e.good_match=n[e.level].good_length,e.nice_match=n[e.level].nice_length,e.max_chain_length=n[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0}(e.state),t}function O(e,t,r,n,s,o){if(!e)return u;var a=1;if(-1===t&&(t=6),n<0?(a=0,n=-n):15<n&&(a=2,n-=16),s<1||9<s||8!==r||n<8||15<n||t<0||9<t||o<0||4<o)return f(e,u);8===n&&(n=9);var l=new T;return(e.state=l).strm=e,l.wrap=a,l.gzhead=null,l.w_bits=n,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=s+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+3-1)/3),l.window=new i.Buf8(2*l.w_size),l.head=new i.Buf16(l.hash_size),l.prev=new i.Buf16(l.w_size),l.lit_bufsize=1<<s+6,l.pending_buf_size=4*l.lit_bufsize,l.pending_buf=new i.Buf8(l.pending_buf_size),l.d_buf=1*l.lit_bufsize,l.l_buf=3*l.lit_bufsize,l.level=t,l.strategy=o,l.method=r,k(e)}n=[new E(0,0,0,0,function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(x(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,g(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-h&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(g(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(g(e,!1),e.strm.avail_out),1)}),new E(4,4,8,4,w),new E(4,5,16,8,w),new E(4,6,32,32,w),new E(4,4,16,16,A),new E(8,16,32,32,A),new E(8,16,128,128,A),new E(8,32,128,256,A),new E(32,128,258,1024,A),new E(32,258,258,4096,A)],r.deflateInit=function(e,t){return O(e,t,8,15,8,0)},r.deflateInit2=O,r.deflateReset=k,r.deflateResetKeep=S,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?u:(e.state.gzhead=t,0):u},r.deflate=function(e,t){var r,i,o,l;if(!e||!e.state||5<t||t<0)return e?f(e,u):u;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||666===i.status&&4!==t)return f(e,0===e.avail_out?-5:u);if(i.strm=e,r=i.last_flush,i.last_flush=t,42===i.status)if(2===i.wrap)e.adler=0,y(i,31),y(i,139),y(i,8),i.gzhead?(y(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),y(i,255&i.gzhead.time),y(i,i.gzhead.time>>8&255),y(i,i.gzhead.time>>16&255),y(i,i.gzhead.time>>24&255),y(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),y(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(y(i,255&i.gzhead.extra.length),y(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=a(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(y(i,0),y(i,0),y(i,0),y(i,0),y(i,0),y(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),y(i,3),i.status=d);else{var h=8+(i.w_bits-8<<4)<<8;h|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(h|=32),h+=31-h%31,i.status=d,v(i,h),0!==i.strstart&&(v(i,e.adler>>>16),v(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),_(e),o=i.pending,i.pending!==i.pending_buf_size));)y(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),_(e),o=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,y(i,l)}while(0!==l);i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),0===l&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),_(e),o=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,y(i,l)}while(0!==l);i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),0===l&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&_(e),i.pending+2<=i.pending_buf_size&&(y(i,255&e.adler),y(i,e.adler>>8&255),e.adler=0,i.status=d)):i.status=d),0!==i.pending){if(_(e),0===e.avail_out)return i.last_flush=-1,0}else if(0===e.avail_in&&p(t)<=p(r)&&4!==t)return f(e,-5);if(666===i.status&&0!==e.avail_in)return f(e,-5);if(0!==e.avail_in||0!==i.lookahead||0!==t&&666!==i.status){var b=2===i.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(x(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}(i,t):3===i.strategy?function(e,t){for(var r,n,i,o,a=e.window;;){if(e.lookahead<=c){if(x(e),e.lookahead<=c&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&0<e.strstart&&(n=a[i=e.strstart-1])===a[++i]&&n===a[++i]&&n===a[++i]){o=e.strstart+c;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=c-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=s._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}(i,t):n[i.level].func(i,t);if(3!==b&&4!==b||(i.status=666),1===b||3===b)return 0===e.avail_out&&(i.last_flush=-1),0;if(2===b&&(1===t?s._tr_align(i):5!==t&&(s._tr_stored_block(i,0,0,!1),3===t&&(m(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),_(e),0===e.avail_out))return i.last_flush=-1,0}return 4!==t?0:i.wrap<=0?1:(2===i.wrap?(y(i,255&e.adler),y(i,e.adler>>8&255),y(i,e.adler>>16&255),y(i,e.adler>>24&255),y(i,255&e.total_in),y(i,e.total_in>>8&255),y(i,e.total_in>>16&255),y(i,e.total_in>>24&255)):(v(i,e.adler>>>16),v(i,65535&e.adler)),_(e),0<i.wrap&&(i.wrap=-i.wrap),0!==i.pending?0:1)},r.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&t!==d&&666!==t?f(e,u):(e.state=null,t===d?f(e,-3):0):u},r.deflateSetDictionary=function(e,t){var r,n,s,a,l,c,h,d,f=t.length;if(!e||!e.state)return u;if(2===(a=(r=e.state).wrap)||1===a&&42!==r.status||r.lookahead)return u;for(1===a&&(e.adler=o(e.adler,t,f,0)),r.wrap=0,f>=r.w_size&&(0===a&&(m(r.head),r.strstart=0,r.block_start=0,r.insert=0),d=new i.Buf8(r.w_size),i.arraySet(d,t,f-r.w_size,r.w_size,0),t=d,f=r.w_size),l=e.avail_in,c=e.next_in,h=e.input,e.avail_in=f,e.next_in=0,e.input=t,x(r);r.lookahead>=3;){for(n=r.strstart,s=r.lookahead-2;r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++,--s;);r.strstart=n,r.lookahead=2,x(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=c,e.input=h,e.avail_in=l,r.wrap=a,0},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,r){t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,r){t.exports=function(e,t){var r,n,i,s,o,a,l,u,c,h,d,f,p,m,_,g,y,v,b,x,w,A,E,T,S;r=e.state,n=e.next_in,T=e.input,i=n+(e.avail_in-5),s=e.next_out,S=e.output,o=s-(t-e.avail_out),a=s+(e.avail_out-257),l=r.dmax,u=r.wsize,c=r.whave,h=r.wnext,d=r.window,f=r.hold,p=r.bits,m=r.lencode,_=r.distcode,g=(1<<r.lenbits)-1,y=(1<<r.distbits)-1;e:do{p<15&&(f+=T[n++]<<p,p+=8,f+=T[n++]<<p,p+=8),v=m[f&g];t:for(;;){if(f>>>=b=v>>>24,p-=b,0==(b=v>>>16&255))S[s++]=65535&v;else{if(!(16&b)){if(!(64&b)){v=m[(65535&v)+(f&(1<<b)-1)];continue t}if(32&b){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}x=65535&v,(b&=15)&&(p<b&&(f+=T[n++]<<p,p+=8),x+=f&(1<<b)-1,f>>>=b,p-=b),p<15&&(f+=T[n++]<<p,p+=8,f+=T[n++]<<p,p+=8),v=_[f&y];r:for(;;){if(f>>>=b=v>>>24,p-=b,!(16&(b=v>>>16&255))){if(!(64&b)){v=_[(65535&v)+(f&(1<<b)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(w=65535&v,p<(b&=15)&&(f+=T[n++]<<p,(p+=8)<b&&(f+=T[n++]<<p,p+=8)),l<(w+=f&(1<<b)-1)){e.msg="invalid distance too far back",r.mode=30;break e}if(f>>>=b,p-=b,(b=s-o)<w){if(c<(b=w-b)&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(E=d,(A=0)===h){if(A+=u-b,b<x){for(x-=b;S[s++]=d[A++],--b;);A=s-w,E=S}}else if(h<b){if(A+=u+h-b,(b-=h)<x){for(x-=b;S[s++]=d[A++],--b;);if(A=0,h<x){for(x-=b=h;S[s++]=d[A++],--b;);A=s-w,E=S}}}else if(A+=h-b,b<x){for(x-=b;S[s++]=d[A++],--b;);A=s-w,E=S}for(;2<x;)S[s++]=E[A++],S[s++]=E[A++],S[s++]=E[A++],x-=3;x&&(S[s++]=E[A++],1<x&&(S[s++]=E[A++]))}else{for(A=s-w;S[s++]=S[A++],S[s++]=S[A++],S[s++]=S[A++],2<(x-=3););x&&(S[s++]=S[A++],1<x&&(S[s++]=S[A++]))}break}}break}}while(n<i&&s<a);n-=x=p>>3,f&=(1<<(p-=x<<3))-1,e.next_in=n,e.next_out=s,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=s<a?a-s+257:257-(s-a),r.hold=f,r.bits=p}},{}],49:[function(e,t,r){var n=e("../utils/common"),i=e("./adler32"),s=e("./crc32"),o=e("./inffast"),a=e("./inftrees"),l=-2;function u(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function c(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function h(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new n.Buf32(852),t.distcode=t.distdyn=new n.Buf32(592),t.sane=1,t.back=-1,0):l}function d(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,h(e)):l}function f(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?l:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,d(e))):l}function p(e,t){var r,n;return e?(n=new c,(e.state=n).window=null,0!==(r=f(e,t))&&(e.state=null),r):l}var m,_,g=!0;function y(e){if(g){var t;for(m=new n.Buf32(512),_=new n.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(1,e.lens,0,288,m,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(2,e.lens,0,32,_,0,e.work,{bits:5}),g=!1}e.lencode=m,e.lenbits=9,e.distcode=_,e.distbits=5}function v(e,t,r,i){var s,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new n.Buf8(o.wsize)),i>=o.wsize?(n.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i<(s=o.wsize-o.wnext)&&(s=i),n.arraySet(o.window,t,r-i,s,o.wnext),(i-=s)?(n.arraySet(o.window,t,r-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=s))),0}r.inflateReset=d,r.inflateReset2=f,r.inflateResetKeep=h,r.inflateInit=function(e){return p(e,15)},r.inflateInit2=p,r.inflate=function(e,t){var r,c,h,d,f,p,m,_,g,b,x,w,A,E,T,S,k,O,R,C,N,P,M,D,z=0,I=new n.Buf8(4),F=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return l;12===(r=e.state).mode&&(r.mode=13),f=e.next_out,h=e.output,m=e.avail_out,d=e.next_in,c=e.input,p=e.avail_in,_=r.hold,g=r.bits,b=p,x=m,P=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;g<16;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(2&r.wrap&&35615===_){I[r.check=0]=255&_,I[1]=_>>>8&255,r.check=s(r.check,I,2,0),g=_=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&_)<<8)+(_>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&_)){e.msg="unknown compression method",r.mode=30;break}if(g-=4,N=8+(15&(_>>>=4)),0===r.wbits)r.wbits=N;else if(N>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<<N,e.adler=r.check=1,r.mode=512&_?10:12,g=_=0;break;case 2:for(;g<16;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(r.flags=_,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=_>>8&1),512&r.flags&&(I[0]=255&_,I[1]=_>>>8&255,r.check=s(r.check,I,2,0)),g=_=0,r.mode=3;case 3:for(;g<32;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}r.head&&(r.head.time=_),512&r.flags&&(I[0]=255&_,I[1]=_>>>8&255,I[2]=_>>>16&255,I[3]=_>>>24&255,r.check=s(r.check,I,4,0)),g=_=0,r.mode=4;case 4:for(;g<16;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}r.head&&(r.head.xflags=255&_,r.head.os=_>>8),512&r.flags&&(I[0]=255&_,I[1]=_>>>8&255,r.check=s(r.check,I,2,0)),g=_=0,r.mode=5;case 5:if(1024&r.flags){for(;g<16;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}r.length=_,r.head&&(r.head.extra_len=_),512&r.flags&&(I[0]=255&_,I[1]=_>>>8&255,r.check=s(r.check,I,2,0)),g=_=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(p<(w=r.length)&&(w=p),w&&(r.head&&(N=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),n.arraySet(r.head.extra,c,d,w,N)),512&r.flags&&(r.check=s(r.check,c,w,d)),p-=w,d+=w,r.length-=w),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===p)break e;for(w=0;N=c[d+w++],r.head&&N&&r.length<65536&&(r.head.name+=String.fromCharCode(N)),N&&w<p;);if(512&r.flags&&(r.check=s(r.check,c,w,d)),p-=w,d+=w,N)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===p)break e;for(w=0;N=c[d+w++],r.head&&N&&r.length<65536&&(r.head.comment+=String.fromCharCode(N)),N&&w<p;);if(512&r.flags&&(r.check=s(r.check,c,w,d)),p-=w,d+=w,N)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;g<16;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(_!==(65535&r.check)){e.msg="header crc mismatch",r.mode=30;break}g=_=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;g<32;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}e.adler=r.check=u(_),g=_=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=f,e.avail_out=m,e.next_in=d,e.avail_in=p,r.hold=_,r.bits=g,2;e.adler=r.check=1,r.mode=12;case 12:if(5===t||6===t)break e;case 13:if(r.last){_>>>=7&g,g-=7&g,r.mode=27;break}for(;g<3;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}switch(r.last=1&_,g-=1,3&(_>>>=1)){case 0:r.mode=14;break;case 1:if(y(r),r.mode=20,6!==t)break;_>>>=2,g-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}_>>>=2,g-=2;break;case 14:for(_>>>=7&g,g-=7&g;g<32;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if((65535&_)!=(_>>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&_,g=_=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(w=r.length){if(p<w&&(w=p),m<w&&(w=m),0===w)break e;n.arraySet(h,c,d,w,f),p-=w,d+=w,m-=w,f+=w,r.length-=w;break}r.mode=12;break;case 17:for(;g<14;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(r.nlen=257+(31&_),_>>>=5,g-=5,r.ndist=1+(31&_),_>>>=5,g-=5,r.ncode=4+(15&_),_>>>=4,g-=4,286<r.nlen||30<r.ndist){e.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;g<3;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}r.lens[F[r.have++]]=7&_,_>>>=3,g-=3}for(;r.have<19;)r.lens[F[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,M={bits:r.lenbits},P=a(0,r.lens,0,19,r.lencode,0,r.work,M),r.lenbits=M.bits,P){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;S=(z=r.lencode[_&(1<<r.lenbits)-1])>>>16&255,k=65535&z,!((T=z>>>24)<=g);){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(k<16)_>>>=T,g-=T,r.lens[r.have++]=k;else{if(16===k){for(D=T+2;g<D;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(_>>>=T,g-=T,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}N=r.lens[r.have-1],w=3+(3&_),_>>>=2,g-=2}else if(17===k){for(D=T+3;g<D;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}g-=T,N=0,w=3+(7&(_>>>=T)),_>>>=3,g-=3}else{for(D=T+7;g<D;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}g-=T,N=0,w=11+(127&(_>>>=T)),_>>>=7,g-=7}if(r.have+w>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;w--;)r.lens[r.have++]=N}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,M={bits:r.lenbits},P=a(1,r.lens,0,r.nlen,r.lencode,0,r.work,M),r.lenbits=M.bits,P){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,M={bits:r.distbits},P=a(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,M),r.distbits=M.bits,P){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=p&&258<=m){e.next_out=f,e.avail_out=m,e.next_in=d,e.avail_in=p,r.hold=_,r.bits=g,o(e,x),f=e.next_out,h=e.output,m=e.avail_out,d=e.next_in,c=e.input,p=e.avail_in,_=r.hold,g=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;S=(z=r.lencode[_&(1<<r.lenbits)-1])>>>16&255,k=65535&z,!((T=z>>>24)<=g);){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(S&&!(240&S)){for(O=T,R=S,C=k;S=(z=r.lencode[C+((_&(1<<O+R)-1)>>O)])>>>16&255,k=65535&z,!(O+(T=z>>>24)<=g);){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}_>>>=O,g-=O,r.back+=O}if(_>>>=T,g-=T,r.back+=T,r.length=k,0===S){r.mode=26;break}if(32&S){r.back=-1,r.mode=12;break}if(64&S){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&S,r.mode=22;case 22:if(r.extra){for(D=r.extra;g<D;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}r.length+=_&(1<<r.extra)-1,_>>>=r.extra,g-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;S=(z=r.distcode[_&(1<<r.distbits)-1])>>>16&255,k=65535&z,!((T=z>>>24)<=g);){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(!(240&S)){for(O=T,R=S,C=k;S=(z=r.distcode[C+((_&(1<<O+R)-1)>>O)])>>>16&255,k=65535&z,!(O+(T=z>>>24)<=g);){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}_>>>=O,g-=O,r.back+=O}if(_>>>=T,g-=T,r.back+=T,64&S){e.msg="invalid distance code",r.mode=30;break}r.offset=k,r.extra=15&S,r.mode=24;case 24:if(r.extra){for(D=r.extra;g<D;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}r.offset+=_&(1<<r.extra)-1,_>>>=r.extra,g-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===m)break e;if(w=x-m,r.offset>w){if((w=r.offset-w)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}A=w>r.wnext?(w-=r.wnext,r.wsize-w):r.wnext-w,w>r.length&&(w=r.length),E=r.window}else E=h,A=f-r.offset,w=r.length;for(m<w&&(w=m),m-=w,r.length-=w;h[f++]=E[A++],--w;);0===r.length&&(r.mode=21);break;case 26:if(0===m)break e;h[f++]=r.length,m--,r.mode=21;break;case 27:if(r.wrap){for(;g<32;){if(0===p)break e;p--,_|=c[d++]<<g,g+=8}if(x-=m,e.total_out+=x,r.total+=x,x&&(e.adler=r.check=r.flags?s(r.check,h,x,f-x):i(r.check,h,x,f-x)),x=m,(r.flags?_:u(_))!==r.check){e.msg="incorrect data check",r.mode=30;break}g=_=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;g<32;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(_!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=30;break}g=_=0}r.mode=29;case 29:P=1;break e;case 30:P=-3;break e;case 31:return-4;default:return l}return e.next_out=f,e.avail_out=m,e.next_in=d,e.avail_in=p,r.hold=_,r.bits=g,(r.wsize||x!==e.avail_out&&r.mode<30&&(r.mode<27||4!==t))&&v(e,e.output,e.next_out,x-e.avail_out)?(r.mode=31,-4):(b-=e.avail_in,x-=e.avail_out,e.total_in+=b,e.total_out+=x,r.total+=x,r.wrap&&x&&(e.adler=r.check=r.flags?s(r.check,h,x,e.next_out-x):i(r.check,h,x,e.next_out-x)),e.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0==b&&0===x||4===t)&&0===P&&(P=-5),P)},r.inflateEnd=function(e){if(!e||!e.state)return l;var t=e.state;return t.window&&(t.window=null),e.state=null,0},r.inflateGetHeader=function(e,t){var r;return e&&e.state&&2&(r=e.state).wrap?((r.head=t).done=!1,0):l},r.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?l:11===r.mode&&i(1,t,n,0)!==r.check?-3:v(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):l},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,r){var n=e("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],s=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],o=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,r,l,u,c,h,d){var f,p,m,_,g,y,v,b,x,w=d.bits,A=0,E=0,T=0,S=0,k=0,O=0,R=0,C=0,N=0,P=0,M=null,D=0,z=new n.Buf16(16),I=new n.Buf16(16),F=null,L=0;for(A=0;A<=15;A++)z[A]=0;for(E=0;E<l;E++)z[t[r+E]]++;for(k=w,S=15;1<=S&&0===z[S];S--);if(S<k&&(k=S),0===S)return u[c++]=20971520,u[c++]=20971520,d.bits=1,0;for(T=1;T<S&&0===z[T];T++);for(k<T&&(k=T),A=C=1;A<=15;A++)if(C<<=1,(C-=z[A])<0)return-1;if(0<C&&(0===e||1!==S))return-1;for(I[1]=0,A=1;A<15;A++)I[A+1]=I[A]+z[A];for(E=0;E<l;E++)0!==t[r+E]&&(h[I[t[r+E]]++]=E);if(y=0===e?(M=F=h,19):1===e?(M=i,D-=257,F=s,L-=257,256):(M=o,F=a,-1),A=T,g=c,R=E=P=0,m=-1,_=(N=1<<(O=k))-1,1===e&&852<N||2===e&&592<N)return 1;for(;;){for(v=A-R,x=h[E]<y?(b=0,h[E]):h[E]>y?(b=F[L+h[E]],M[D+h[E]]):(b=96,0),f=1<<A-R,T=p=1<<O;u[g+(P>>R)+(p-=f)]=v<<24|b<<16|x,0!==p;);for(f=1<<A-1;P&f;)f>>=1;if(0!==f?(P&=f-1,P+=f):P=0,E++,0==--z[A]){if(A===S)break;A=t[r+h[E]]}if(k<A&&(P&_)!==m){for(0===R&&(R=k),g+=T,C=1<<(O=A-R);O+R<S&&!((C-=z[O+R])<=0);)O++,C<<=1;if(N+=1<<O,1===e&&852<N||2===e&&592<N)return 1;u[m=P&_]=k<<24|O<<16|g-c}}return 0!==P&&(u[g+P]=A-R<<24|64<<16),d.bits=k,0}},{"../utils/common":41}],51:[function(e,t,r){t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,r){var n=e("../utils/common");function i(e){for(var t=e.length;0<=--t;)e[t]=0}var s=256,o=286,a=30,l=15,u=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],c=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],h=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],d=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],f=new Array(576);i(f);var p=new Array(60);i(p);var m=new Array(512);i(m);var _=new Array(256);i(_);var g=new Array(29);i(g);var y,v,b,x=new Array(a);function w(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function A(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function E(e){return e<256?m[e]:m[256+(e>>>7)]}function T(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function S(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,T(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function k(e,t,r){S(e,r[2*t],r[2*t+1])}function O(e,t){for(var r=0;r|=1&e,e>>>=1,r<<=1,0<--t;);return r>>>1}function R(e,t,r){var n,i,s=new Array(16),o=0;for(n=1;n<=l;n++)s[n]=o=o+r[n-1]<<1;for(i=0;i<=t;i++){var a=e[2*i+1];0!==a&&(e[2*i]=O(s[a]++,a))}}function C(e){var t;for(t=0;t<o;t++)e.dyn_ltree[2*t]=0;for(t=0;t<a;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function N(e){8<e.bi_valid?T(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function P(e,t,r,n){var i=2*t,s=2*r;return e[i]<e[s]||e[i]===e[s]&&n[t]<=n[r]}function M(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&P(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!P(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function D(e,t,r){var n,i,o,a,l=0;if(0!==e.last_lit)for(;n=e.pending_buf[e.d_buf+2*l]<<8|e.pending_buf[e.d_buf+2*l+1],i=e.pending_buf[e.l_buf+l],l++,0===n?k(e,i,t):(k(e,(o=_[i])+s+1,t),0!==(a=u[o])&&S(e,i-=g[o],a),k(e,o=E(--n),r),0!==(a=c[o])&&S(e,n-=x[o],a)),l<e.last_lit;);k(e,256,t)}function z(e,t){var r,n,i,s=t.dyn_tree,o=t.stat_desc.static_tree,a=t.stat_desc.has_stree,u=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<u;r++)0!==s[2*r]?(e.heap[++e.heap_len]=c=r,e.depth[r]=0):s[2*r+1]=0;for(;e.heap_len<2;)s[2*(i=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[i]=0,e.opt_len--,a&&(e.static_len-=o[2*i+1]);for(t.max_code=c,r=e.heap_len>>1;1<=r;r--)M(e,s,r);for(i=u;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],M(e,s,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,s[2*i]=s[2*r]+s[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,s[2*r+1]=s[2*n+1]=i,e.heap[1]=i++,M(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,s,o,a,u=t.dyn_tree,c=t.max_code,h=t.stat_desc.static_tree,d=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,m=t.stat_desc.max_length,_=0;for(s=0;s<=l;s++)e.bl_count[s]=0;for(u[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)m<(s=u[2*u[2*(n=e.heap[r])+1]+1]+1)&&(s=m,_++),u[2*n+1]=s,c<n||(e.bl_count[s]++,o=0,p<=n&&(o=f[n-p]),a=u[2*n],e.opt_len+=a*(s+o),d&&(e.static_len+=a*(h[2*n+1]+o)));if(0!==_){do{for(s=m-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[m]--,_-=2}while(0<_);for(s=m;0!==s;s--)for(n=e.bl_count[s];0!==n;)c<(i=e.heap[--r])||(u[2*i+1]!==s&&(e.opt_len+=(s-u[2*i+1])*u[2*i],u[2*i+1]=s),n--)}}(e,t),R(s,c,e.bl_count)}function I(e,t,r){var n,i,s=-1,o=t[1],a=0,l=7,u=4;for(0===o&&(l=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=o,o=t[2*(n+1)+1],++a<l&&i===o||(a<u?e.bl_tree[2*i]+=a:0!==i?(i!==s&&e.bl_tree[2*i]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=i,u=(a=0)===o?(l=138,3):i===o?(l=6,3):(l=7,4))}function F(e,t,r){var n,i,s=-1,o=t[1],a=0,l=7,u=4;for(0===o&&(l=138,u=3),n=0;n<=r;n++)if(i=o,o=t[2*(n+1)+1],!(++a<l&&i===o)){if(a<u)for(;k(e,i,e.bl_tree),0!=--a;);else 0!==i?(i!==s&&(k(e,i,e.bl_tree),a--),k(e,16,e.bl_tree),S(e,a-3,2)):a<=10?(k(e,17,e.bl_tree),S(e,a-3,3)):(k(e,18,e.bl_tree),S(e,a-11,7));s=i,u=(a=0)===o?(l=138,3):i===o?(l=6,3):(l=7,4)}}i(x);var L=!1;function j(e,t,r,i){S(e,0+(i?1:0),3),function(e,t,r){N(e),T(e,r),T(e,~r),n.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r)}r._tr_init=function(e){L||(function(){var e,t,r,n,i,s=new Array(16);for(n=r=0;n<28;n++)for(g[n]=r,e=0;e<1<<u[n];e++)_[r++]=n;for(_[r-1]=n,n=i=0;n<16;n++)for(x[n]=i,e=0;e<1<<c[n];e++)m[i++]=n;for(i>>=7;n<a;n++)for(x[n]=i<<7,e=0;e<1<<c[n]-7;e++)m[256+i++]=n;for(t=0;t<=l;t++)s[t]=0;for(e=0;e<=143;)f[2*e+1]=8,e++,s[8]++;for(;e<=255;)f[2*e+1]=9,e++,s[9]++;for(;e<=279;)f[2*e+1]=7,e++,s[7]++;for(;e<=287;)f[2*e+1]=8,e++,s[8]++;for(R(f,287,s),e=0;e<a;e++)p[2*e+1]=5,p[2*e]=O(e,5);y=new w(f,u,257,o,l),v=new w(p,c,0,a,l),b=new w(new Array(0),h,0,19,7)}(),L=!0),e.l_desc=new A(e.dyn_ltree,y),e.d_desc=new A(e.dyn_dtree,v),e.bl_desc=new A(e.bl_tree,b),e.bi_buf=0,e.bi_valid=0,C(e)},r._tr_stored_block=j,r._tr_flush_block=function(e,t,r,n){var i,o,a=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<s;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),z(e,e.l_desc),z(e,e.d_desc),a=function(e){var t;for(I(e,e.dyn_ltree,e.l_desc.max_code),I(e,e.dyn_dtree,e.d_desc.max_code),z(e,e.bl_desc),t=18;3<=t&&0===e.bl_tree[2*d[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?j(e,t,r,n):4===e.strategy||o===i?(S(e,2+(n?1:0),3),D(e,f,p)):(S(e,4+(n?1:0),3),function(e,t,r,n){var i;for(S(e,t-257,5),S(e,r-1,5),S(e,n-4,4),i=0;i<n;i++)S(e,e.bl_tree[2*d[i]+1],3);F(e,e.dyn_ltree,t-1),F(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),D(e,e.dyn_ltree,e.dyn_dtree)),C(e),n&&N(e)},r._tr_tally=function(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(_[r]+s+1)]++,e.dyn_dtree[2*E(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){S(e,2,3),k(e,256,f),function(e){16===e.bi_valid?(T(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,r){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){(function(e){!function(e){if(!e.setImmediate){var t,r,n,i,s=1,o={},a=!1,l=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,t="[object process]"==={}.toString.call(e.process)?function(e){!function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];be.push(new Te(e,t)),1!==be.length||xe||ye(Ee)}(function(){h(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?(i="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",d,!1):e.attachEvent("onmessage",d),function(t){e.postMessage(i+t,"*")}):e.MessageChannel?((n=new MessageChannel).port1.onmessage=function(e){h(e.data)},function(e){n.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(r=l.documentElement,function(e){var t=l.createElement("script");t.onreadystatechange=function(){h(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):function(e){setTimeout(h,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var r=new Array(arguments.length-1),n=0;n<r.length;n++)r[n]=arguments[n+1];var i={callback:e,args:r};return o[s]=i,t(s),s++},u.clearImmediate=c}function c(e){delete o[e]}function h(e){if(a)setTimeout(h,0,e);else{var t=o[e];if(t){a=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(undefined,r)}}(t)}finally{c(e),a=!1}}}}function d(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(i)&&h(+t.data.slice(i.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,void 0!==f?f:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)),lt.exports),ct=e.getDefaultExportFromCjs(ut),ht={},dt={},ft={};function pt(){if(Re)return ft;function e(e){return null==e}return Re=1,ft.isNothing=e,ft.isObject=function(e){return"object"==typeof e&&null!==e},ft.toArray=function(t){return Array.isArray(t)?t:e(t)?[]:[t]},ft.repeat=function(e,t){var r,n="";for(r=0;r<t;r+=1)n+=e;return n},ft.isNegativeZero=function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},ft.extend=function(e,t){var r,n,i,s;if(t)for(r=0,n=(s=Object.keys(t)).length;r<n;r+=1)e[i=s[r]]=t[i];return e},ft}function mt(){if(Ne)return Ce;function e(e,t){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||"",this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():"")}return Ne=1,e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t},Ce=e}function _t(){if(ze)return De;ze=1;var e=mt(),t=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],r=["scalar","sequence","mapping"];return De=function(n,i){if(i=i||{},Object.keys(i).forEach(function(r){if(-1===t.indexOf(r))throw new e('Unknown option "'+r+'" is met in definition of "'+n+'" YAML type.')}),this.tag=n,this.kind=i.kind||null,this.resolve=i.resolve||function(){return!0},this.construct=i.construct||function(e){return e},this.instanceOf=i.instanceOf||null,this.predicate=i.predicate||null,this.represent=i.represent||null,this.defaultStyle=i.defaultStyle||null,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach(function(r){e[r].forEach(function(e){t[String(e)]=r})}),t}(i.styleAliases||null),-1===r.indexOf(this.kind))throw new e('Unknown kind "'+this.kind+'" is specified for "'+n+'" YAML type.')},De}function gt(){if(Fe)return Ie;Fe=1;var e=pt(),t=mt(),r=_t();function n(e,t,r){var i=[];return e.include.forEach(function(e){r=n(e,t,r)}),e[t].forEach(function(e){r.forEach(function(t,r){t.tag===e.tag&&i.push(r)}),r.push(e)}),r.filter(function(e,t){return-1===i.indexOf(t)})}function i(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new t("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=n(this,"implicit",[]),this.compiledExplicit=n(this,"explicit",[]),this.compiledTypeMap=function(){var e,t,r={};function n(e){r[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(n);return r}(this.compiledImplicit,this.compiledExplicit)}return i.DEFAULT=null,i.create=function(){var n,s;switch(arguments.length){case 1:n=i.DEFAULT,s=arguments[0];break;case 2:n=arguments[0],s=arguments[1];break;default:throw new t("Wrong number of arguments for Schema.create function")}if(n=e.toArray(n),s=e.toArray(s),!n.every(function(e){return e instanceof i}))throw new t("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!s.every(function(e){return e instanceof r}))throw new t("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new i({include:n,explicit:s})},Ie=i}function yt(){if(je)return Le;je=1;var e=_t();return Le=new e("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})}function vt(){if(Be)return Ue;Be=1;var e=_t();return Ue=new e("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})}function bt(){if(Ge)return Ve;Ge=1;var e=_t();return Ve=new e("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})}function xt(){if(qe)return $e;qe=1;var e=gt();return $e=new e({explicit:[yt(),vt(),bt()]})}function wt(){if(He)return We;He=1;var e=_t();return We=new e("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})}function At(){if(Ke)return Ze;Ke=1;var e=_t();return Ze=new e("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})}function Et(){if(Ye)return Xe;Ye=1;var e=pt(),t=_t();function r(e){return 48<=e&&e<=55}function n(e){return 48<=e&&e<=57}return Xe=new t("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,i,s=e.length,o=0,a=!1;if(!s)return!1;if("-"!==(t=e[o])&&"+"!==t||(t=e[++o]),"0"===t){if(o+1===s)return!0;if("b"===(t=e[++o])){for(o++;o<s;o++)if("_"!==(t=e[o])){if("0"!==t&&"1"!==t)return!1;a=!0}return a}if("x"===t){for(o++;o<s;o++)if("_"!==(t=e[o])){if(!(48<=(i=e.charCodeAt(o))&&i<=57||65<=i&&i<=70||97<=i&&i<=102))return!1;a=!0}return a}for(;o<s;o++)if("_"!==(t=e[o])){if(!r(e.charCodeAt(o)))return!1;a=!0}return a}for(;o<s;o++)if("_"!==(t=e[o])){if(":"===t)break;if(!n(e.charCodeAt(o)))return!1;a=!0}return!!a&&(":"!==t||/^(:[0-5]?[0-9])+$/.test(e.slice(o)))},construct:function(e){var t,r,n=e,i=1,s=[];return-1!==n.indexOf("_")&&(n=n.replace(/_/g,"")),"-"!==(t=n[0])&&"+"!==t||("-"===t&&(i=-1),t=(n=n.slice(1))[0]),"0"===n?0:"0"===t?"b"===n[1]?i*parseInt(n.slice(2),2):"x"===n[1]?i*parseInt(n,16):i*parseInt(n,8):-1!==n.indexOf(":")?(n.split(":").forEach(function(e){s.unshift(parseInt(e,10))}),n=0,r=1,s.forEach(function(e){n+=e*r,r*=60}),i*n):i*parseInt(n,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&t%1==0&&!e.isNegativeZero(t)},represent:{binary:function(e){return"0b"+e.toString(2)},octal:function(e){return"0"+e.toString(8)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return"0x"+e.toString(16).toUpperCase()}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Xe}function Tt(){if(Je)return Qe;Je=1;var e=pt(),t=_t(),r=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?|\\.[0-9_]+(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),n=/^[-+]?[0-9]+e/;return Qe=new t("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!!r.test(e)},construct:function(e){var t,r,n,i;return r="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,i=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===r?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach(function(e){i.unshift(parseFloat(e,10))}),t=0,n=1,i.forEach(function(e){t+=e*n,n*=60}),r*t):r*parseFloat(t,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||e.isNegativeZero(t))},represent:function(t,r){var i;if(isNaN(t))switch(r){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(r){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(r){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(e.isNegativeZero(t))return"-0.0";return i=t.toString(10),n.test(i)?i.replace("e",".e"):i},defaultStyle:"lowercase"})}function St(){if(tt)return et;tt=1;var e=gt();return et=new e({include:[xt()],implicit:[wt(),At(),Et(),Tt()]})}function kt(){if(nt)return rt;nt=1;var e=gt();return rt=new e({include:[St()]})}function Ot(){if(st)return it;st=1;var e=_t(),t=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?)?$");return it=new e("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&null!==t.exec(e)},construct:function(e){var r,n,i,s,o,a,l,u,c=0,h=null;if(null===(r=t.exec(e)))throw new Error("Date resolve error");if(n=+r[1],i=+r[2]-1,s=+r[3],!r[4])return new Date(Date.UTC(n,i,s));if(o=+r[4],a=+r[5],l=+r[6],r[7]){for(c=r[7].slice(0,3);c.length<3;)c+="0";c=+c}return r[9]&&(h=6e4*(60*+r[10]+ +(r[11]||0)),"-"===r[9]&&(h=-h)),u=new Date(Date.UTC(n,i,s,o,a,l,c)),h&&u.setTime(u.getTime()-h),u},instanceOf:Date,represent:function(e){return e.toISOString()}})}function Rt(){if(at)return ot;at=1;var e=_t();return ot=new e("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})}var Ct,Nt,Pt,Mt,Dt,zt,It,Ft,Lt,jt,Ut,Bt,Vt,Gt,$t,qt,Wt,Ht,Zt,Kt,Xt,Yt,Qt=e.getAugmentedNamespace(fe);function Jt(){if(Nt)return Ct;Nt=1;var e=Qt.Buffer,t=_t(),r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";return Ct=new t("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i=0,s=e.length,o=r;for(n=0;n<s;n++)if(!((t=o.indexOf(e.charAt(n)))>64)){if(t<0)return!1;i+=6}return i%8==0},construct:function(t){var n,i,s=t.replace(/[\r\n=]/g,""),o=s.length,a=r,l=0,u=[];for(n=0;n<o;n++)n%4==0&&n&&(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)),l=l<<6|a.indexOf(s.charAt(n));return 0==(i=o%4*6)?(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)):18===i?(u.push(l>>10&255),u.push(l>>2&255)):12===i&&u.push(l>>4&255),e?new e(u):u},predicate:function(t){return e&&e.isBuffer(t)},represent:function(e){var t,n,i="",s=0,o=e.length,a=r;for(t=0;t<o;t++)t%3==0&&t&&(i+=a[s>>18&63],i+=a[s>>12&63],i+=a[s>>6&63],i+=a[63&s]),s=(s<<8)+e[t];return 0==(n=o%3)?(i+=a[s>>18&63],i+=a[s>>12&63],i+=a[s>>6&63],i+=a[63&s]):2===n?(i+=a[s>>10&63],i+=a[s>>4&63],i+=a[s<<2&63],i+=a[64]):1===n&&(i+=a[s>>2&63],i+=a[s<<4&63],i+=a[64],i+=a[64]),i}}),Ct}function er(){if(Mt)return Pt;Mt=1;var e=_t(),t=Object.prototype.hasOwnProperty,r=Object.prototype.toString;return Pt=new e("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var n,i,s,o,a,l=[],u=e;for(n=0,i=u.length;n<i;n+=1){if(s=u[n],a=!1,"[object Object]"!==r.call(s))return!1;for(o in s)if(t.call(s,o)){if(a)return!1;a=!0}if(!a)return!1;if(-1!==l.indexOf(o))return!1;l.push(o)}return!0},construct:function(e){return null!==e?e:[]}}),Pt}function tr(){if(zt)return Dt;zt=1;var e=_t(),t=Object.prototype.toString;return Dt=new e("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var r,n,i,s,o,a=e;for(o=new Array(a.length),r=0,n=a.length;r<n;r+=1){if(i=a[r],"[object Object]"!==t.call(i))return!1;if(1!==(s=Object.keys(i)).length)return!1;o[r]=[s[0],i[s[0]]]}return!0},construct:function(e){if(null===e)return[];var t,r,n,i,s,o=e;for(s=new Array(o.length),t=0,r=o.length;t<r;t+=1)n=o[t],i=Object.keys(n),s[t]=[i[0],n[i[0]]];return s}}),Dt}function rr(){if(Ft)return It;Ft=1;var e=_t(),t=Object.prototype.hasOwnProperty;return It=new e("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var r,n=e;for(r in n)if(t.call(n,r)&&null!==n[r])return!1;return!0},construct:function(e){return null!==e?e:{}}})}function nr(){if(jt)return Lt;jt=1;var e=gt();return Lt=new e({include:[kt()],implicit:[Ot(),Rt()],explicit:[Jt(),er(),tr(),rr()]})}function ir(){if(Bt)return Ut;Bt=1;var e=_t();return Ut=new e("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:function(){return!0},construct:function(){},predicate:function(e){return void 0===e},represent:function(){return""}})}function sr(){if(Gt)return Vt;Gt=1;var e=_t();return Vt=new e("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:function(e){if(null===e)return!1;if(0===e.length)return!1;var t=e,r=/\/([gim]*)$/.exec(e),n="";if("/"===t[0]){if(r&&(n=r[1]),n.length>3)return!1;if("/"!==t[t.length-n.length-1])return!1}return!0},construct:function(e){var t=e,r=/\/([gim]*)$/.exec(e),n="";return"/"===t[0]&&(r&&(n=r[1]),t=t.slice(1,t.length-n.length-1)),new RegExp(t,n)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})}function or(){if(qt)return $t;var e;qt=1;try{e=ke("esprima")}catch(t){"undefined"!=typeof window&&(e=window.esprima)}var t=_t();return $t=new t("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(t){if(null===t)return!1;try{var r="("+t+")",n=e.parse(r,{range:!0});return"Program"===n.type&&1===n.body.length&&"ExpressionStatement"===n.body[0].type&&"FunctionExpression"===n.body[0].expression.type}catch(e){return!1}},construct:function(t){var r,n="("+t+")",i=e.parse(n,{range:!0}),s=[];if("Program"!==i.type||1!==i.body.length||"ExpressionStatement"!==i.body[0].type||"FunctionExpression"!==i.body[0].expression.type)throw new Error("Failed to resolve function");return i.body[0].expression.params.forEach(function(e){s.push(e.name)}),r=i.body[0].expression.body.range,new Function(s,n.slice(r[0]+1,r[1]-1))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})}function ar(){if(Ht)return Wt;Ht=1;var e=gt();return Wt=e.DEFAULT=new e({include:[nr()],explicit:[ir(),sr(),or()]})}var lr=function(){if(Yt)return Xt;Yt=1;var e=function(){if(Kt)return ht;Kt=1;var e=function(){if(Zt)return dt;Zt=1;var e=pt(),t=mt(),r=function(){if(Me)return Pe;Me=1;var e=pt();function t(e,t,r,n,i){this.name=e,this.buffer=t,this.position=r,this.line=n,this.column=i}return t.prototype.getSnippet=function(t,r){var n,i,s,o,a;if(!this.buffer)return null;for(t=t||4,r=r||75,n="",i=this.position;i>0&&-1==="\0\r\n
\u2028\u2029".indexOf(this.buffer.charAt(i-1));)if(i-=1,this.position-i>r/2-1){n=" ... ",i+=5;break}for(s="",o=this.position;o<this.buffer.length&&-1==="\0\r\n
\u2028\u2029".indexOf(this.buffer.charAt(o));)if((o+=1)-this.position>r/2-1){s=" ... ",o-=5;break}return a=this.buffer.slice(i,o),e.repeat(" ",t)+n+a+s+"\n"+e.repeat(" ",t+this.position-i+n.length)+"^"},t.prototype.toString=function(e){var t,r="";return this.name&&(r+='in "'+this.name+'" '),r+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(r+=":\n"+t),r},Pe=t}(),n=nr(),i=ar(),s=Object.prototype.hasOwnProperty,o=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,a=/[\x85\u2028\u2029]/,l=/[,\[\]\{\}]/,u=/^(?:!|!!|![a-z\-]+!)$/i,c=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function h(e){return 10===e||13===e}function d(e){return 9===e||32===e}function f(e){return 9===e||32===e||10===e||13===e}function p(e){return 44===e||91===e||93===e||123===e||125===e}function m(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function _(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"
":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function g(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var y=new Array(256),v=new Array(256),b=0;b<256;b++)y[b]=_(b)?1:0,v[b]=_(b);function x(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||i,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function w(e,n){return new t(n,new r(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function A(e,t){throw w(e,t)}function E(e,t){e.onWarning&&e.onWarning.call(null,w(e,t))}var T={YAML:function(e,t,r){var n,i,s;null!==e.version&&A(e,"duplication of %YAML directive"),1!==r.length&&A(e,"YAML directive accepts exactly one argument"),null===(n=/^([0-9]+)\.([0-9]+)$/.exec(r[0]))&&A(e,"ill-formed argument of the YAML directive"),i=parseInt(n[1],10),s=parseInt(n[2],10),1!==i&&A(e,"unacceptable YAML version of the document"),e.version=r[0],e.checkLineBreaks=s<2,1!==s&&2!==s&&E(e,"unsupported YAML version of the document")},TAG:function(e,t,r){var n,i;2!==r.length&&A(e,"TAG directive accepts exactly two arguments"),n=r[0],i=r[1],u.test(n)||A(e,"ill-formed tag handle (first argument) of the TAG directive"),s.call(e.tagMap,n)&&A(e,'there is a previously declared suffix for "'+n+'" tag handle'),c.test(i)||A(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[n]=i}};function S(e,t,r,n){var i,s,a,l;if(t<r){if(l=e.input.slice(t,r),n)for(i=0,s=l.length;i<s;i+=1)9===(a=l.charCodeAt(i))||32<=a&&a<=1114111||A(e,"expected valid JSON character");else o.test(l)&&A(e,"the stream contains non-printable characters");e.result+=l}}function k(t,r,n,i){var o,a,l,u;for(e.isObject(n)||A(t,"cannot merge mappings; the provided source object is unacceptable"),l=0,u=(o=Object.keys(n)).length;l<u;l+=1)a=o[l],s.call(r,a)||(r[a]=n[a],i[a]=!0)}function O(e,t,r,n,i,o){var a,l;if(i=String(i),null===t&&(t={}),"tag:yaml.org,2002:merge"===n)if(Array.isArray(o))for(a=0,l=o.length;a<l;a+=1)k(e,t,o[a],r);else k(e,t,o,r);else e.json||s.call(r,i)||!s.call(t,i)||A(e,"duplicated mapping key"),t[i]=o,delete r[i];return t}function R(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):A(e,"a line break is expected"),e.line+=1,e.lineStart=e.position}function C(e,t,r){for(var n=0,i=e.input.charCodeAt(e.position);0!==i;){for(;d(i);)i=e.input.charCodeAt(++e.position);if(t&&35===i)do{i=e.input.charCodeAt(++e.position)}while(10!==i&&13!==i&&0!==i);if(!h(i))break;for(R(e),i=e.input.charCodeAt(e.position),n++,e.lineIndent=0;32===i;)e.lineIndent++,i=e.input.charCodeAt(++e.position)}return-1!==r&&0!==n&&e.lineIndent<r&&E(e,"deficient indentation"),n}function N(e){var t,r=e.position;return!(45!==(t=e.input.charCodeAt(r))&&46!==t||t!==e.input.charCodeAt(r+1)||t!==e.input.charCodeAt(r+2)||(r+=3,0!==(t=e.input.charCodeAt(r))&&!f(t)))}function P(t,r){1===r?t.result+=" ":r>1&&(t.result+=e.repeat("\n",r-1))}function M(e,t){var r,n,i=e.tag,s=e.anchor,o=[],a=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),n=e.input.charCodeAt(e.position);0!==n&&45===n&&f(e.input.charCodeAt(e.position+1));)if(a=!0,e.position++,C(e,!0,-1)&&e.lineIndent<=t)o.push(null),n=e.input.charCodeAt(e.position);else if(r=e.line,I(e,t,3,!1,!0),o.push(e.result),C(e,!0,-1),n=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&0!==n)A(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!a&&(e.tag=i,e.anchor=s,e.kind="sequence",e.result=o,!0)}function D(e){var t,r,n,i,o=!1,a=!1;if(33!==(i=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&A(e,"duplication of a tag property"),60===(i=e.input.charCodeAt(++e.position))?(o=!0,i=e.input.charCodeAt(++e.position)):33===i?(a=!0,r="!!",i=e.input.charCodeAt(++e.position)):r="!",t=e.position,o){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&62!==i);e.position<e.length?(n=e.input.slice(t,e.position),i=e.input.charCodeAt(++e.position)):A(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==i&&!f(i);)33===i&&(a?A(e,"tag suffix cannot contain exclamation marks"):(r=e.input.slice(t-1,e.position+1),u.test(r)||A(e,"named tag handle cannot contain such characters"),a=!0,t=e.position+1)),i=e.input.charCodeAt(++e.position);n=e.input.slice(t,e.position),l.test(n)&&A(e,"tag suffix cannot contain flow indicator characters")}return n&&!c.test(n)&&A(e,"tag name cannot contain such characters: "+n),o?e.tag=n:s.call(e.tagMap,r)?e.tag=e.tagMap[r]+n:"!"===r?e.tag="!"+n:"!!"===r?e.tag="tag:yaml.org,2002:"+n:A(e,'undeclared tag handle "'+r+'"'),!0}function z(e){var t,r;if(38!==(r=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&A(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!f(r)&&!p(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&A(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function I(t,r,n,i,o){var a,l,u,c,_,b,x,w,E=1,T=!1,k=!1;if(null!==t.listener&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,a=l=u=4===n||3===n,i&&C(t,!0,-1)&&(T=!0,t.lineIndent>r?E=1:t.lineIndent===r?E=0:t.lineIndent<r&&(E=-1)),1===E)for(;D(t)||z(t);)C(t,!0,-1)?(T=!0,u=a,t.lineIndent>r?E=1:t.lineIndent===r?E=0:t.lineIndent<r&&(E=-1)):u=!1;if(u&&(u=T||o),1!==E&&4!==n||(x=1===n||2===n?r:r+1,w=t.position-t.lineStart,1===E?u&&(M(t,w)||function(e,t,r){var n,i,s,o,a=e.tag,l=e.anchor,u={},c={},h=null,p=null,m=null,_=!1,g=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=u),o=e.input.charCodeAt(e.position);0!==o;){if(n=e.input.charCodeAt(e.position+1),s=e.line,63!==o&&58!==o||!f(n)){if(!I(e,r,2,!1,!0))break;if(e.line===s){for(o=e.input.charCodeAt(e.position);d(o);)o=e.input.charCodeAt(++e.position);if(58===o)f(o=e.input.charCodeAt(++e.position))||A(e,"a whitespace character is expected after the key-value separator within a block mapping"),_&&(O(e,u,c,h,p,null),h=p=m=null),g=!0,_=!1,i=!1,h=e.tag,p=e.result;else{if(!g)return e.tag=a,e.anchor=l,!0;A(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!g)return e.tag=a,e.anchor=l,!0;A(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===o?(_&&(O(e,u,c,h,p,null),h=p=m=null),g=!0,_=!0,i=!0):_?(_=!1,i=!0):A(e,"incomplete explicit mapping pair; a key node is missed"),e.position+=1,o=n;if((e.line===s||e.lineIndent>t)&&(I(e,t,4,!0,i)&&(_?p=e.result:m=e.result),_||(O(e,u,c,h,p,m),h=p=m=null),C(e,!0,-1),o=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==o)A(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return _&&O(e,u,c,h,p,null),g&&(e.tag=a,e.anchor=l,e.kind="mapping",e.result=u),g}(t,w,x))||function(e,t){var r,n,i,s,o,a,l,u,c,h,d=!0,p=e.tag,m=e.anchor,_={};if(91===(h=e.input.charCodeAt(e.position)))i=93,a=!1,n=[];else{if(123!==h)return!1;i=125,a=!0,n={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=n),h=e.input.charCodeAt(++e.position);0!==h;){if(C(e,!0,t),(h=e.input.charCodeAt(e.position))===i)return e.position++,e.tag=p,e.anchor=m,e.kind=a?"mapping":"sequence",e.result=n,!0;d||A(e,"missed comma between flow collection entries"),c=null,s=o=!1,63===h&&f(e.input.charCodeAt(e.position+1))&&(s=o=!0,e.position++,C(e,!0,t)),r=e.line,I(e,t,1,!1,!0),u=e.tag,l=e.result,C(e,!0,t),h=e.input.charCodeAt(e.position),!o&&e.line!==r||58!==h||(s=!0,h=e.input.charCodeAt(++e.position),C(e,!0,t),I(e,t,1,!1,!0),c=e.result),a?O(e,n,_,u,l,c):s?n.push(O(e,null,_,u,l,c)):n.push(l),C(e,!0,t),44===(h=e.input.charCodeAt(e.position))?(d=!0,h=e.input.charCodeAt(++e.position)):d=!1}A(e,"unexpected end of the stream within a flow collection")}(t,x)?k=!0:(l&&function(t,r){var n,i,s,o,a,l=1,u=!1,c=r,f=0,p=!1;if(124===(o=t.input.charCodeAt(t.position)))i=!1;else{if(62!==o)return!1;i=!0}for(t.kind="scalar",t.result="";0!==o;)if(43===(o=t.input.charCodeAt(++t.position))||45===o)1===l?l=43===o?3:2:A(t,"repeat of a chomping mode identifier");else{if(!((s=48<=(a=o)&&a<=57?a-48:-1)>=0))break;0===s?A(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?A(t,"repeat of an indentation width identifier"):(c=r+s-1,u=!0)}if(d(o)){do{o=t.input.charCodeAt(++t.position)}while(d(o));if(35===o)do{o=t.input.charCodeAt(++t.position)}while(!h(o)&&0!==o)}for(;0!==o;){for(R(t),t.lineIndent=0,o=t.input.charCodeAt(t.position);(!u||t.lineIndent<c)&&32===o;)t.lineIndent++,o=t.input.charCodeAt(++t.position);if(!u&&t.lineIndent>c&&(c=t.lineIndent),h(o))f++;else{if(t.lineIndent<c){3===l?t.result+=e.repeat("\n",f):1===l&&u&&(t.result+="\n");break}for(i?d(o)?(p=!0,t.result+=e.repeat("\n",f+1)):p?(p=!1,t.result+=e.repeat("\n",f+1)):0===f?u&&(t.result+=" "):t.result+=e.repeat("\n",f):t.result+=u?e.repeat("\n",f+1):e.repeat("\n",f),u=!0,f=0,n=t.position;!h(o)&&0!==o;)o=t.input.charCodeAt(++t.position);S(t,n,t.position,!1)}}return!0}(t,x)||function(e,t){var r,n,i;if(39!==(r=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;0!==(r=e.input.charCodeAt(e.position));)if(39===r){if(S(e,n,e.position,!0),39!==(r=e.input.charCodeAt(++e.position)))return!0;n=i=e.position,e.position++}else h(r)?(S(e,n,i,!0),P(e,C(e,!1,t)),n=i=e.position):e.position===e.lineStart&&N(e)?A(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);A(e,"unexpected end of the stream within a single quoted scalar")}(t,x)||function(e,t){var r,n,i,s,o,a,l;if(34!==(a=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;0!==(a=e.input.charCodeAt(e.position));){if(34===a)return S(e,r,e.position,!0),e.position++,!0;if(92===a){if(S(e,r,e.position,!0),h(a=e.input.charCodeAt(++e.position)))C(e,!1,t);else if(a<256&&y[a])e.result+=v[a],e.position++;else if((o=120===(l=a)?2:117===l?4:85===l?8:0)>0){for(i=o,s=0;i>0;i--)(o=m(a=e.input.charCodeAt(++e.position)))>=0?s=(s<<4)+o:A(e,"expected hexadecimal character");e.result+=g(s),e.position++}else A(e,"unknown escape sequence");r=n=e.position}else h(a)?(S(e,r,n,!0),P(e,C(e,!1,t)),r=n=e.position):e.position===e.lineStart&&N(e)?A(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}A(e,"unexpected end of the stream within a double quoted scalar")}(t,x)?k=!0:function(e){var t,r,n;if(42!==(n=e.input.charCodeAt(e.position)))return!1;for(n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!f(n)&&!p(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&A(e,"name of an alias node must contain at least one character"),r=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(r)||A(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],C(e,!0,-1),!0}(t)?(k=!0,null===t.tag&&null===t.anchor||A(t,"alias node should not have any properties")):function(e,t,r){var n,i,s,o,a,l,u,c,m=e.kind,_=e.result;if(f(c=e.input.charCodeAt(e.position))||p(c)||35===c||38===c||42===c||33===c||124===c||62===c||39===c||34===c||37===c||64===c||96===c)return!1;if((63===c||45===c)&&(f(n=e.input.charCodeAt(e.position+1))||r&&p(n)))return!1;for(e.kind="scalar",e.result="",i=s=e.position,o=!1;0!==c;){if(58===c){if(f(n=e.input.charCodeAt(e.position+1))||r&&p(n))break}else if(35===c){if(f(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&N(e)||r&&p(c))break;if(h(c)){if(a=e.line,l=e.lineStart,u=e.lineIndent,C(e,!1,-1),e.lineIndent>=t){o=!0,c=e.input.charCodeAt(e.position);continue}e.position=s,e.line=a,e.lineStart=l,e.lineIndent=u;break}}o&&(S(e,i,s,!1),P(e,e.line-a),i=s=e.position,o=!1),d(c)||(s=e.position+1),c=e.input.charCodeAt(++e.position)}return S(e,i,s,!1),!!e.result||(e.kind=m,e.result=_,!1)}(t,x,1===n)&&(k=!0,null===t.tag&&(t.tag="?")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===E&&(k=u&&M(t,w))),null!==t.tag&&"!"!==t.tag)if("?"===t.tag){for(c=0,_=t.implicitTypes.length;c<_;c+=1)if((b=t.implicitTypes[c]).resolve(t.result)){t.result=b.construct(t.result),t.tag=b.tag,null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);break}}else s.call(t.typeMap,t.tag)?(b=t.typeMap[t.tag],null!==t.result&&b.kind!==t.kind&&A(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+b.kind+'", not "'+t.kind+'"'),b.resolve(t.result)?(t.result=b.construct(t.result),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):A(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")):A(t,"unknown tag !<"+t.tag+">");return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||k}function F(e){var t,r,n,i,o=e.position,l=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(i=e.input.charCodeAt(e.position))&&(C(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(l=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!f(i);)i=e.input.charCodeAt(++e.position);for(n=[],(r=e.input.slice(t,e.position)).length<1&&A(e,"directive name must not be less than one character in length");0!==i;){for(;d(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!h(i));break}if(h(i))break;for(t=e.position;0!==i&&!f(i);)i=e.input.charCodeAt(++e.position);n.push(e.input.slice(t,e.position))}0!==i&&R(e),s.call(T,r)?T[r](e,r,n):E(e,'unknown document directive "'+r+'"')}C(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,C(e,!0,-1)):l&&A(e,"directives end mark is expected"),I(e,e.lineIndent-1,4,!1,!0),C(e,!0,-1),e.checkLineBreaks&&a.test(e.input.slice(o,e.position))&&E(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&N(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,C(e,!0,-1)):e.position<e.length-1&&A(e,"end of the stream or a document separator is expected")}function L(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var r=new x(e,t);for(r.input+="\0";32===r.input.charCodeAt(r.position);)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)F(r);return r.documents}function j(e,t,r){var n,i,s=L(e,r);for(n=0,i=s.length;n<i;n+=1)t(s[n])}function U(e,r){var n=L(e,r);if(0!==n.length){if(1===n.length)return n[0];throw new t("expected a single document in the stream, but found more")}}return dt.loadAll=j,dt.load=U,dt.safeLoadAll=function(t,r,i){j(t,r,e.extend({schema:n},i))},dt.safeLoad=function(t,r){return U(t,e.extend({schema:n},r))},dt}();function t(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}return ht.Type=_t(),ht.Schema=gt(),ht.FAILSAFE_SCHEMA=xt(),ht.JSON_SCHEMA=St(),ht.CORE_SCHEMA=kt(),ht.DEFAULT_SAFE_SCHEMA=nr(),ht.DEFAULT_FULL_SCHEMA=ar(),ht.load=e.load,ht.loadAll=e.loadAll,ht.safeLoad=e.safeLoad,ht.safeLoadAll=e.safeLoadAll,ht.YAMLException=mt(),ht.MINIMAL_SCHEMA=xt(),ht.SAFE_SCHEMA=nr(),ht.DEFAULT_SCHEMA=ar(),ht.scan=t("scan"),ht.parse=t("parse"),ht.compose=t("compose"),ht.addConstructor=t("addConstructor"),ht}();return Xt=e}(),ur=e.getDefaultExportFromCjs(lr);class cr{constructor(t,r,n=null){this.url=t,!r||e.isRelativeURL(r)&&!e.isRelativeURL(this.url)?this.path=e.pathForURL(this.url):this.path=r,this.path_for_parent=r||this.path,this.parent=n,this.container=null,this.parent&&(this.parent.container?this.container=this.parent.container:this.parent.isContainer()&&(this.container=this.parent))}load(){return dr(this.url)}resourceFor(e){return{url:this.urlFor(e),path:this.pathFor(e),type:this.typeFor(e)}}urlFor(t){return u(t)?t:e.isRelativeURL(t)&&this.container?this.parent.urlFor(this.path_for_parent+t):e.addBaseURL(t,this.path)}pathFor(t){return e.pathForURL(t)}typeFor(t){return e.extensionForURL(t)}isContainer(){return!1}}class hr extends cr{constructor(e,t,r){super(e,t,r),this.zip=null,this.files={},this.root=null,this.path=""}isContainer(){return!0}async load(){if(this.zip=new ct,"string"==typeof this.url){const{body:t}=await e.Utils.io(this.url,6e4,"arraybuffer");return await this.zip.loadAsync(t),await this.parseZipFiles(),this.loadRoot()}return this}urlFor(t){return u(t)?t:e.isRelativeURL(t)?this.urlForZipFile(e.flattenRelativeURL(t)):super.urlFor(t)}typeFor(t){return e.isRelativeURL(t)?this.typeForZipFile(t):super.typeFor(t)}loadRoot(){return this.findRoot(),dr(this.urlForZipFile(this.root))}findRoot(){const t=Object.keys(this.files).filter(e=>0===this.files[e].depth).filter(t=>"yaml"===e.extensionForURL(t));if(1===t.length&&(this.root=t[0]),!this.root){let e=`Could not find root scene for bundle '${this.url}': `;throw e+="The zip archive's root level must contain a single scene file with the '.yaml' extension. ",t.length>0?e+=`Found multiple YAML files at the root level: ${t.map(e=>"'"+e+"'").join(", ")}.`:e+="Found NO YAML files at the root level.",Error(e)}}async parseZipFiles(){let t=[],r=[];this.zip.forEach((e,n)=>{n.dir||(t.push(e),r.push(n.async("arraybuffer")))});const n=await Promise.all(r);for(let r=0;r<n.length;r++){let i=t[r],s=i.split("/").length-1;this.files[i]={data:n[r],type:e.extensionForURL(i),depth:s}}}urlForZipFile(t){if(this.files[t])return this.files[t].url||(this.files[t].url=e.createObjectURL(new Blob([this.files[t].data]))),this.files[t].url}typeForZipFile(e){return this.files[e]&&this.files[e].type}}function dr(t){return new Promise((r,n)=>{"string"==typeof t?e.Utils.io(t).then(({body:e})=>{try{r(function(e){return ur.safeLoad(e,{json:!0})}(e))}catch(e){n(e)}},n):(t=Object.assign({},t),r(t))})}const fr={async loadScene(t,{path:r,type:n}={}){const i=[],s={},o=await this.loadSceneRecursive({url:t,path:r,type:n},null,s,i),{config:a,bundle:l}=this.finalize(o);if(!a)throw i[0];return i.length>0&&i.forEach(t=>{const r=`Failed to import scene: ${t.url}`;e.log("error",r,t),this.trigger("error",{type:"scene_import",message:r,error:t,url:t.url})}),{config:a,bundle:l,texture_nodes:s}},async loadSceneRecursive({url:t,path:r,type:n},i,s={},o=[]){if(!t)return{};const a=function(t,r,n,i=null){return null!=i&&"zip"===i||"string"==typeof t&&!e.isLocalURL(t)&&"zip"===e.extensionForURL(t)?new hr(t,r,n):new cr(t,r,n)}(t,r,i,n);try{let t=await a.load();if(null==t.import)return this.normalize(t,a,s),{config:t,bundle:a};Array.isArray(t.import)||(t.import=[t.import]);const r=[];t.import.forEach(t=>{"object"==typeof t&&(t=e.createObjectURL(new Blob([JSON.stringify(t)]))),r.push(a.resourceFor(t))}),delete t.import;const n=r.map(e=>this.loadSceneRecursive(e,a,s,o)),i=(await Promise.all(n)).map(e=>this.normalize(e.config,e.bundle,s)).map(e=>e.config);return this.normalize(t,a,s),t=e.mergeObjects(...i,t),{config:t,bundle:a,texture_nodes:s}}catch(e){return e.url=t,o.push(e),{}}},normalize(e,t,r={}){return this.normalizeDataSources(e,t),this.normalizeFonts(e,t),this.normalizeTextures(e,t),this.collectTextures(e,t,r),{config:e,bundle:t,texture_nodes:r}},normalizeDataSources(e,t){e.sources=e.sources||{};for(const r in e.sources)this.normalizeDataSource(e.sources[r],t);return e},normalizeDataSource(e,t){if(e.url=t.urlFor(e.url),Array.isArray(e.composite)&&e.composite.forEach(e=>e.url=t.urlFor(e.url)),e.scripts){Array.isArray(e.scripts)&&(e.scripts=e.scripts.reduce((e,t)=>(e[t]=t,e),{}));for(const r in e.scripts)e.scripts[r]=t.urlFor(e.scripts[r])}return e},normalizeFonts(e,t){e.fonts=e.fonts||{};const r=Object.values(e.fonts).filter(e=>"external"!==e);for(const e of r)(Array.isArray(e)?e:[e]).forEach(e=>e.url=t.urlFor(e.url));return e},normalizeTextures(e,t){if(e.textures=e.textures||{},e.textures)for(const r in e.textures){const n=e.textures[r];n.url&&(n.url=t.urlFor(n.url))}},collectTextures(t,r,n){if(t.styles)for(const e in t.styles){const i=t.styles[e],s=i.texture;if("string"==typeof s&&!t.textures[s]){const t=["styles",e,"texture"];this.addTextureNode(t,r,n)}i.material&&["emission","ambient","diffuse","specular","normal"].forEach(s=>{const o=null!=i.material[s]&&i.material[s].texture;if("string"==typeof o&&!t.textures[o]){const t=["styles",e,"material",s,"texture"];this.addTextureNode(t,r,n)}})}if(t.styles)for(const i in t.styles){const s=t.styles[i];s.shaders&&s.shaders.uniforms&&e.GLSL.parseUniforms(s.shaders.uniforms).forEach(({type:e,value:s,path:o})=>{if("sampler2D"===e&&"string"==typeof s&&!t.textures[s]){const e=["styles",i,"shaders","uniforms",...o];this.addTextureNode(e,r,n)}})}if(t.layers){const i=[t.layers],s=[["layers"]];for(;i.length>0;){const o=i.pop(),a=s.pop();if("object"==typeof o&&!Array.isArray(o))for(const l in o)if("draw"===l){const e=o[l];for(const i in e){if(e[i].texture){const s=e[i].texture;if("string"==typeof s&&!t.textures[s]){const e=[...a,l,"draw",i,"texture"];this.addTextureNode(e,r,n)}}if(e[i].outline&&e[i].outline.texture){const s=e[i].outline.texture;if("string"==typeof s&&!t.textures[s]){const e=[...a,l,"draw",i,"outline","texture"];this.addTextureNode(e,r,n)}}}}else{if(e.isReserved(l))continue;i.push(o[l]),s.push([...a,l])}}}},addTextureNode(e,t,r){r[JSON.stringify(e)]={path:e,bundle:t}},hoistTextureNodes(e,t,r={}){for(const{path:n,bundle:o}of Object.values(r)){const r=i(e,n);if("string"==typeof r&&null==e.textures[r])if(c(e,n)){const n=t.urlFor(r);e.textures[r]={url:n}}else{const t=o.urlFor(r);e.textures[t]={url:t},s(e,n,t)}}},applyGlobalProperties:e=>e.global&&0!==Object.keys(e.global).length?d(h(e.global),e):e,finalize:({config:e,bundle:t})=>e?(e.global=e.global||{},e.scene=e.scene||{},e.cameras=e.cameras||{},e.lights=e.lights||{},e.styles=e.styles||{},e.layers=e.layers||{},e.camera&&(e.cameras.default=e.camera),0===Object.keys(e.cameras).length&&(e.cameras.default={}),(0===Object.keys(e.lights).length||Object.keys(e.lights).every(t=>!1===e.lights[t].visible))&&(e.lights.default_light={type:"directional"}),{config:e,bundle:t}):{}};e.subscribeMixin(fr);class pr{constructor(){this.tiles={},this.max_proxy_descendant_depth=6,this.max_proxy_ancestor_depth=7,this.children_cache={}}addTile(t){for(this.tiles[t.key]=this.tiles[t.key]||{descendants:0},this.tiles[t.key].tile=t;t.style_z>=0;){if(!(t=e.TileID.parent(t)))return;this.tiles[t.key]||(this.tiles[t.key]={descendants:0}),this.tiles[t.key].descendants++}}removeTile(t){for(this.tiles[t.key]&&(delete this.tiles[t.key].tile,0===this.tiles[t.key].descendants&&delete this.tiles[t.key]);t.style_z>=0;){if(!(t=e.TileID.parent(t)))return;this.tiles[t.key]&&this.tiles[t.key].descendants>0&&(this.tiles[t.key].descendants--,0!==this.tiles[t.key].descendants||this.tiles[t.key].tile||delete this.tiles[t.key])}}getAncestor(t){let r=0;for(;r<this.max_proxy_ancestor_depth;){if(!(t=e.TileID.parent(t)))return;if(this.tiles[t.key]&&this.tiles[t.key].tile&&this.tiles[t.key].tile.loaded)return this.tiles[t.key].tile;r++}}getDescendants(t,r=0){let n=[];if(r<this.max_proxy_descendant_depth){let i=e.TileID.children(t,this.children_cache);if(!i)return;i.forEach(e=>{this.tiles[e.key]&&(this.tiles[e.key].tile&&this.tiles[e.key].tile.loaded?n.push(this.tiles[e.key].tile):this.tiles[e.key].descendants>0&&n.push(...this.getDescendants(e,r+1)))})}return n}}let mr={},_r={};function gr(t,r=null){if(this.obb)return e.Label.prototype.occluded.call(this,t,r);if(this.obbs)for(let n=0;n<this.obbs.length;n++){let i={aabb:this.aabbs[n],obb:this.obbs[n]};if(e.Label.prototype.occluded.call(i,t,r))return!0}return!1}class yr{constructor({scene:t}){this.scene=t,this.tiles={},this.pyramid=new pr,this.visible_coords={},this.queued_coords=[],this.building_tiles=null,this.renderable_tiles=[],this.collision={tile_keys:null,mesh_set:null,zoom:null,zoom_steps:3},this.main_thread_target=["TileManager",this.scene.id].join("_"),e.WorkerBroker.addTarget(this.main_thread_target,this)}destroy(){this.forEachTile(e=>e.destroy()),this.tiles={},this.pyramid=null,this.visible_coords={},this.queued_coords=[],this.scene=null,e.WorkerBroker.removeTarget(this.main_thread_target)}get view(){return this.scene.view}get style_manager(){return this.scene.style_manager}keepTile(e){this.tiles[e.key]=e,this.pyramid.addTile(e)}hasTile(e){return void 0!==this.tiles[e]}forgetTile(e){if(this.hasTile(e)){let t=this.tiles[e];this.pyramid.removeTile(t)}delete this.tiles[e],this.tileBuildStop(e)}removeTile(t){e.log("trace",`tile unload for ${t}`);var r=this.tiles[t];null!=r&&r.destroy(),this.forgetTile(r.key),this.scene.requestRedraw()}forEachTile(e){for(let t in this.tiles)e(this.tiles[t])}removeTiles(e){let t=[];for(let r in this.tiles)e(this.tiles[r])&&t.push(r);for(let e=0;e<t.length;e++){let r=t[e];this.removeTile(r)}}updateTilesForView(){this.visible_coords={};let e=this.view.findVisibleTileCoordinates();for(let t=0;t<e.length;t++){const r=e[t];this.queueCoordinate(r),this.visible_coords[r.key]=r}this.updateTileStates()}updateTileStates(){return this.forEachTile(e=>{this.updateVisibility(e)}),this.loadQueuedCoordinates(),this.updateProxyTiles(),this.view.pruneTilesForView(),this.updateRenderableTiles(),this.style_manager.updateActiveStyles(this.renderable_tiles),this.style_manager.updateActiveBlendOrders(this.renderable_tiles),this.updateLabels()}updateLabels(){var t=this;if(this.scene.building&&!this.scene.building.initial)return Promise.resolve({});const r=this.renderable_tiles.filter(e=>e.valid).filter(e=>e.built);return 0===r.length?Promise.resolve({}):(r.sort((e,t)=>e.build_id<t.build_id?-1:e.build_id>t.build_id?1:0),this.collision.zoom===vr(this.view.zoom,this.collision.zoom_steps)&&this.collision.tile_keys===JSON.stringify(r.map(e=>e.key))&&this.collision.mesh_set===br(r)?Promise.resolve({}):(this.collision.task||(this.collision.zoom=vr(this.view.zoom,this.collision.zoom_steps),this.collision.tile_keys=JSON.stringify(r.map(e=>e.key)),this.collision.mesh_set=br(r),this.collision.task={type:"tileManagerUpdateLabels",run:async function(n){const i=await async function(t,r,n=!1){_r=mr,mr={};let i=function(t,r){let n={};t.forEach(t=>{const i=e.Geo.unitsPerMeter(t.coords.z),s=Math.pow(2,r-t.style_z),o=i*s,a=e.Geo.metersPerPixel(r),l=Object.assign({},t.meshes,t.pending_label_meshes);for(let r in l)l[r].forEach(r=>{if(r.labels)for(let s in r.labels){if(t.isProxy()&&!_r[s])continue;const l=r.labels[s].container.label,u=r.labels[s].container.linked,c=r.labels[s].ranges;let h={};if(h.discard=gr.bind(h),h.build_id=t.build_id,Object.assign(h,l),h.layout=Object.assign({},l.layout),h.layout.repeat_scale=.75,h.layout.repeat_distance=h.layout.repeat_distance||0,h.layout.repeat_distance/=o,h.position=[h.position[0]/i+t.min.x,h.position[1]/i+t.min.y],h.unit_scale=a,"point"===h.type)e.LabelPoint.prototype.updateBBoxes.call(h);else if("straight"===h.type)e.LabelLineStraight.prototype.updateBBoxes.call(h,h.position,h.size,h.angle,h.angle,h.offset);else if(l.obbs){const r=l.obbs.map(r=>{let{x:n,y:s,a:a,w:l,h:u}=r;return n=n/i+t.min.x,s=s/i+t.min.y,l/=o,u/=o,new e.OBB(n,s,a,l,u)});h.obbs=r,h.aabbs=r.map(e=>e.getExtent())}n[s]={label:h,linked:u,ranges:c,mesh:r}}})});for(let e in n){const t=n[e];t.linked&&(t.linked=n[t.linked])}return n=Object.keys(n).map(e=>n[e]),n}(t,r);e.Collision.startTile("main",{apply_repeat_groups:!0,return_hidden:!0}),e.Collision.addStyle("main","main");const s=Math.max(0,...Object.values(t).map(e=>Object.values(e.meshes)).flat().map(e=>Math.max(0,...e.map(e=>e.labels?Object.keys(e.labels).length:0)))),o=Math.floor(s/e.Geo.tile_size);o>0?e.Collision.initGrid({anchor:{x:Math.min(...t.map(e=>e.min.x)),y:Math.min(...t.map(e=>e.min.y))},span:t[0].span.x/o}):e.Collision.initGrid();const a=await e.Collision.collide(i,"main","main");let l=[];return a.forEach(e=>{let t=0;!0!==e.show||n&&e.label.breach&&!_r[e.label.id]||(t=1),t&&(mr[e.label.id]=!0);let r=!0;e.ranges.forEach(n=>{if(!r)return;let i=e.mesh;if(!i.valid)return;let s=i.vertex_layout.offset.a_shape,o=i.vertex_layout.stride;for(let e=0;e<n[1];e++){if(i.vertex_data[n[0]+e*o+s+6]===t)return void(r=!1);i.vertex_data[n[0]+e*o+s+6]=t}-1===l.indexOf(i)&&l.push(i)})}),l.forEach(e=>e.upload()),t.forEach(e=>e.swapPendingLabels()),{labels:a,containers:i}}(r,t.collision.zoom,t.isLoadingVisibleTiles());t.scene.requestRedraw(),t.collision.task=null,e.Task.finish(n,i),t.updateTileStates()},immediate:!0},e.Task.add(this.collision.task)),this.collision.task.promise))}updateProxyTiles(){if(0===this.view.zoom_direction)return;this.forEachTile(e=>e.setProxyFor(null));let e=!1;this.forEachTile(t=>{if(t.visible&&!t.labeled){const r=this.pyramid.getAncestor(t);if(r)r.setProxyFor(t),e=!0;else{const r=this.pyramid.getDescendants(t);for(let n=0;n<r.length;n++)r[n].setProxyFor(t),e=!0}}}),e||(this.view.zoom_direction=0)}updateVisibility(t){if(t.visible=!1,t.style_z===this.view.tile_zoom)if(this.visible_coords[t.coords.key])t.visible=!0;else for(let r in this.visible_coords)if(e.TileID.isDescendant(t.coords,this.visible_coords[r])){t.visible=!0;break}}pruneToVisibleTiles(){this.removeTiles(e=>!e.visible)}getRenderableTiles(){return this.renderable_tiles}updateRenderableTiles(){this.renderable_tiles=[];for(let e in this.tiles){let t=this.tiles[e];t.visible&&t.loaded&&this.renderable_tiles.push(t)}return this.renderable_tiles}isLoadingVisibleTiles(){return Object.keys(this.tiles).some(e=>this.tiles[e].visible&&!this.tiles[e].built)}allVisibleTilesLabeled(){return this.renderable_tiles.every(e=>e.labeled)}queueCoordinate(e){this.queued_coords[this.queued_coords.length]=e}loadQueuedCoordinates(){0!==this.queued_coords.length&&(this.queued_coords.sort((t,r)=>{let n=this.view.center.meters,i=e.Geo.metersPerTile(t.z)/2,s=e.Geo.metersForTile(t);s.x+=i,s.y-=i;let o=e.Geo.metersForTile(r);o.x+=i,o.y-=i;let a=Math.abs(n.x-s.x)+Math.abs(n.y-s.y),l=Math.abs(n.x-o.x)+Math.abs(n.y-o.y);return t.center_dist=a,r.center_dist=l,l>a?-1:l===a?0:1}),this.queued_coords.forEach(e=>this.loadCoordinate(e)),this.queued_coords=[])}loadCoordinate(t){if(t.z===this.view.center.tile.z)for(let r in this.scene.sources){let n=this.scene.sources[r];if(!n.builds_geometry_tiles||!n.includesTile(t,this.view.tile_zoom))continue;let i=e.TileID.normalizedKey(t,n,this.view.tile_zoom);if(i&&!this.hasTile(i)){e.log("trace",`load tile ${i}, distance from view center: ${t.center_dist}`);let r=new e.Tile({source:n,coords:t,workers:this.scene.workers,style_z:this.view.baseZoom(t.z),view:this.view});this.keepTile(r),this.buildTile(r)}}}buildTile(e,t){this.tileBuildStart(e.key),this.updateVisibility(e),e.build(this.scene.generation,t)}buildTileStylesCompleted({tile:t,progress:r}){if(null==this.tiles[t.key])e.log("trace",`discarded tile ${t.key} in TileManager.buildTileStylesCompleted because previously removed`),e.Tile.abortBuild(t),this.updateTileStates();else if(t.generation!==this.scene.generation)e.log("trace",`discarded tile ${t.key} in TileManager.buildTileStylesCompleted because built with scene config gen ${t.generation}, current ${this.scene.generation}`),e.Tile.abortBuild(t),this.updateTileStates();else{if(this.tiles[t.key]){if(t.id<this.tiles[t.key].id)return e.log("trace",`discarded tile ${t.key} for id ${t.id} in TileManager.buildTileStylesCompleted because built for discarded tile id`),void e.Tile.abortBuild(t);t=this.tiles[t.key].merge(t)}r.done&&(t.built=!0),t.buildMeshes(this.scene.styles,r),this.updateTileStates(),this.scene.requestRedraw()}r.done&&this.tileBuildStop(t.key)}buildTileError(t){e.log("error",`Error building tile ${t.key}:`,t.error),this.forgetTile(t.key),e.Tile.abortBuild(t)}tileBuildStart(t){this.building_tiles=this.building_tiles||{},this.building_tiles[t]=!0,e.log("trace",`tileBuildStart for ${t}: ${Object.keys(this.building_tiles).length}`)}tileBuildStop(t){this.building_tiles&&(e.log("trace",`tileBuildStop for ${t}: ${Object.keys(this.building_tiles).length}`),delete this.building_tiles[t],this.checkBuildQueue())}checkBuildQueue(){this.building_tiles&&0!==Object.keys(this.building_tiles).length||(this.building_tiles=null,this.scene.tileManagerBuildDone())}getDebugProp(e,t){var r=[];for(var n in this.tiles)null==this.tiles[n].debug[e]||"function"==typeof t&&!0!==t(this.tiles[n])||r.push(this.tiles[n].debug[e]);return r}getDebugSum(e,t){var r=0;for(var n in this.tiles)null==this.tiles[n].debug[e]||"function"==typeof t&&!0!==t(this.tiles[n])||(r+=this.tiles[n].debug[e]);return r}getDebugAverage(e,t){return this.getDebugSum(e,t)/Object.keys(this.tiles).length}}function vr(e,t,r=2){return(Math.floor(e*t)/t).toFixed(r)}function br(e){return JSON.stringify(Object.entries(e).map(([,e])=>Object.entries(e.meshes).map(([,e])=>e.map(e=>e.created_at))))}class xr{constructor(e,t){t(e),this.value=e,this.setup=t}set(e){JSON.stringify(this.value)!==JSON.stringify(e)&&(this.setup(e),this.value=e)}}class wr{constructor(e){this.defaults={},this.defaults.culling=!0,this.defaults.culling_face=e.BACK,this.defaults.blending=!1,this.defaults.blending_src=e.ONE_MINUS_SRC_ALPHA,this.defaults.blending_dst=e.ONE_MINUS_SRC_ALPHA,this.defaults.blending_src_alpha=e.ONE,this.defaults.blending_dst_alpha=e.ONE_MINUS_SRC_ALPHA,this.defaults.depth_write=!0,this.defaults.depth_test=!0,e.depthFunc(e.LESS),this.culling=new xr({cull:this.defaults.culling,face:this.defaults.culling_face},t=>{t.cull?(e.enable(e.CULL_FACE),e.cullFace(t.face)):e.disable(e.CULL_FACE)}),this.blending=new xr({blend:this.defaults.blending,src:this.defaults.blending_src,dst:this.defaults.blending_dst,src_alpha:this.defaults.blending_src_alpha,dst_alpha:this.defaults.blending_dst_alpha},t=>{t.blend?(e.enable(e.BLEND),t.src_alpha&&t.dst_alpha?e.blendFuncSeparate(t.src,t.dst,t.src_alpha,t.dst_alpha):e.blendFunc(t.src,t.dst)):e.disable(e.BLEND)}),this.depth_write=new xr({depth_write:this.defaults.depth_write},t=>{e.depthMask(t.depth_write)}),this.depth_test=new xr({depth_test:this.defaults.depth_test},t=>{t.depth_test?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST)})}}class Ar{constructor(){this.canvas=null,this.gl=null,this.screenshot_canvas=null,this.screenshot_context=null,this.queue_screenshot=null,this.video_capture=null}setCanvas(e,t){this.canvas=e,this.gl=t}screenshot({background:e}={}){return null!=this.queue_screenshot||(this.queue_screenshot={background:e},this.queue_screenshot.promise=new Promise((e,t)=>{this.queue_screenshot.resolve=e,this.queue_screenshot.reject=t})),this.queue_screenshot.promise}completeScreenshot(){if(null!=this.queue_screenshot){let t=this.canvas.width,r=this.canvas.height,n=new Uint8Array(t*r*4);this.gl.readPixels(0,0,t,r,this.gl.RGBA,this.gl.UNSIGNED_BYTE,n);let i=this.queue_screenshot.background;i=i&&"transparent"!==i?e.StyleParser.parseColor(i).slice(0,3).map(e=>255*e):null;let s=new Uint8ClampedArray(t*r*4);for(let e=0;e<r;e++)for(let o=0;o<t;o++){let a=4*((r-e-1)*t+o),l=4*(e*t+o),u=n[a+3];s[l+0]=255*n[a+0]/u,s[l+1]=255*n[a+1]/u,s[l+2]=255*n[a+2]/u,s[l+3]=u,i&&(u/=255,s[l+0]=s[l+0]*u+i[0]*(1-u),s[l+1]=s[l+1]*u+i[1]*(1-u),s[l+2]=s[l+2]*u+i[2]*(1-u),s[l+3]=255)}this.screenshot_canvas=this.screenshot_canvas||document.createElement("canvas");let o=this.screenshot_canvas;o.width=t,o.height=r,this.screenshot_context=this.screenshot_context||o.getContext("2d");let a=this.screenshot_context,l=new ImageData(s,t,r);a.putImageData(l,0,0);const u=o.toDataURL("image/png"),c=atob(u.slice(22)),h=new Uint8Array(c.length);for(let e=0;e<c.length;++e)h[e]=c.charCodeAt(e);const d=new Blob([h],{type:"image/png"});this.queue_screenshot.resolve({url:u,blob:d,type:"png"}),this.queue_screenshot=null}}startVideoCapture(){if("function"!=typeof window.MediaRecorder||!this.canvas||"function"!=typeof this.canvas.captureStream)return e.log("warn","Video capture (Canvas.captureStream and/or MediaRecorder APIs) not supported by browser"),!1;if(this.video_capture)return e.log("warn","Video capture already in progress, call Scene.stopVideoCapture() first"),!1;try{let t=this.video_capture={};t.chunks=[],t.stream=this.canvas.captureStream(),t.options={mimeType:"video/webm"},t.media_recorder=new MediaRecorder(t.stream,t.options),t.media_recorder.ondataavailable=r=>{if(r.data.size>0&&t.chunks.push(r.data),t.resolve){let r=new Blob(t.chunks,{type:t.options.mimeType}),n=e.createObjectURL(r);t.stream&&(t.stream.getTracks()||[]).forEach(e=>{e.stop(),t.stream.removeTrack(e)}),t.stream=null,t.media_recorder=null,this.video_capture=null,t.resolve({url:n,blob:r,type:"webm"})}},t.media_recorder.start()}catch(t){return this.video_capture=null,e.log("error","Scene video capture failed",t),!1}return!0}stopVideoCapture(){return this.video_capture?(this.video_capture.promise=new Promise((e,t)=>{this.video_capture.resolve=e,this.video_capture.reject=t}),this.video_capture.media_recorder.stop(),this.video_capture.promise):(e.log("warn","No scene video capture in progress, call Scene.startVideoCapture() first"),Promise.resolve({}))}}function Er(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Tr(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?Er(Object(n),!0).forEach(function(r){e._defineProperty(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Er(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}class Sr{constructor(t,r){var n;r=r||{},e.subscribeMixin(this),this.id=Sr.id++,this.initialized=!1,this.initializing=null,this.sources={},this.view=new e.View(this,r),this.tile_manager=new yr({scene:this}),this.num_workers=r.numWorkers||2,!0===r.disableVertexArrayObjects&&(e.VertexArrayObject.disabled=!0),e.Utils.use_high_density_display=void 0===r.highDensityDisplay||r.highDensityDisplay,e.Utils.updateDevicePixelRatio(),this.config=null,this.config_source=t,this.config_bundle=null,this.last_valid_config_source=null,this.styles=null,this.style_manager=new e.StyleManager,this.building=null,this.dirty=!0,r.preUpdate&&this.subscribe({pre_update:r.preUpdate}),r.postUpdate&&this.subscribe({post_update:r.postUpdate}),this.render_loop=!r.disableRenderLoop,this.render_loop_active=!1,this.render_loop_stop=!1,this.render_count=0,this.last_render_count=0,this.render_count_changed=!1,this.frame=0,this.last_main_render=-1,this.last_selection_render=-1,this.media_capture=new Ar,this.selection=null,this.selection_feature_count=0,this.fetching_selection_map=null,this.prev_textures=null,this.introspection=!0===r.introspection,this.times={},this.resetTime(),this.container=r.container,this.canvas=null,this.contextOptions=r.webGLContextOptions,this.lights=null,this.background=null,this.createListeners(),this.updating=0,this.generation=Sr.generation,this.last_complete_generation=Sr.generation,(n=this).debug={profile(t){console.profile(`main thread: ${t}`),e.WorkerBroker.postMessage(n.workers,"self.profile",t)},profileEnd(t){console.profileEnd(`main thread: ${t}`),e.WorkerBroker.postMessage(n.workers,"self.profileEnd",t)},timeRebuild(t=1,r={}){let i=[],s=()=>{let o=+new Date;n.rebuild(r).then(()=>{if(i.push(+new Date-o),i.length<t)s();else{let r=~~(i.reduce((e,t)=>e+t)/i.length);e.log("info",`Profiled rebuild ${t} times: ${r} avg (${Math.min(...i)} min, ${Math.max(...i)} max)`)}})};s()},geometryCountByStyle(){let e={};return n.tile_manager.getRenderableTiles().forEach(t=>{for(let r in t.meshes)e[r]=e[r]||0,t.meshes[r].forEach(t=>{e[r]+=t.geometry_count})}),e},geometryCountByBaseStyle(){let e=n.debug.geometryCountByStyle(),t={};for(let r in e){let i=n.styles[r].baseStyle();t[i]=t[i]||0,t[i]+=e[r]}return t},geometryCountTotal(){const e=n.debug.geometryCountByStyle();return Object.keys(e).reduce((t,r)=>e[r]+t,0)},geometrySizeByStyle(){let e={};return n.tile_manager.getRenderableTiles().forEach(t=>{for(let r in t.meshes)e[r]=e[r]||0,t.meshes[r].forEach(t=>{e[r]+=t.buffer_size})}),e},geometrySizeByBaseStyle(){let e=n.debug.geometrySizeByStyle(),t={};for(let r in e){let i=n.styles[r].baseStyle();t[i]=t[i]||0,t[i]+=e[r]}return t},geometrySizeTotal(){const e=n.debug.geometrySizeByStyle();return Object.keys(e).reduce((t,r)=>e[r]+t,0)},textureSizeTotal:()=>Object.values(e.Texture.textures).map(e=>e.byteSize()).reduce((e,t)=>e+t),layerStats:()=>e.debugSettings.layer_stats?e.debugSumLayerStats(n.tile_manager.getRenderableTiles()):(e.log("warn","Enable the 'layer_stats' debug setting to collect layer stats"),{}),renderableTilesCount:()=>n.tile_manager.getRenderableTiles().length},this.log_level=r.logLevel||"warn",e.log.setLevel(this.log_level),e.log.reset()}static create(e,t={}){return new Sr(e,t)}load(t=null,r={}){var n=this;return this.initializing||(e.log.reset(),this.updating++,this.initialized=!1,this.view_complete=!1,this.times.frame=null,this.times.build=null,(r="string"==typeof r?{base_path:r}:r).blocking=void 0===r.blocking||r.blocking,!1!==this.render_loop&&this.setupRenderLoop(),this.createCanvas(),this.prev_textures=this.config&&Object.keys(this.config.textures),this.initializing=this.loadScene(t,r).then(async function({texture_nodes:t}){await n.createWorkers(),n.destroyFeatureSelection(),e.WorkerBroker.postMessage(n.workers,"self.clearFunctionStringCache");const i="object"==typeof n.config_source||n.hasSubscribersFor("load"),s=n.updateConfig({texture_nodes:t,serialize_funcs:i,normalize:!1,loading:!0,fade_in:!0});!0===r.blocking&&await s,n.freePreviousTextures(),n.updating--,n.initializing=null,n.initialized=!0,n.last_valid_config_source=n.config_source,n.last_valid_options={base_path:r.base_path,file_type:r.file_type},n.requestRedraw()}).catch(t=>{let r,n;if(this.initializing=null,this.updating=0,"YAMLException"===t.name?(r="yaml",n="Error parsing scene YAML"):n="Error initializing scene",this.trigger("error",{type:r,message:n,error:t,url:this.config_source}),n=`Scene.load() failed to load ${JSON.stringify(this.config_source)}: ${t.message}`,this.last_valid_config_source)return e.log("warn",n,t),e.log("info","Scene.load() reverting to last valid configuration"),this.load(this.last_valid_config_source,this.last_valid_base_path);throw e.log("error",n,t),t})),this.initializing}destroy(){if(this.initialized=!1,this.render_loop_stop=!0,this.destroyListeners(),this.destroyFeatureSelection(),this.canvas&&this.canvas.parentNode&&(this.canvas.parentNode.removeChild(this.canvas),this.canvas=null),this.container=null,this.gl){e.Texture.destroy(this.gl),this.style_manager.destroy(this.gl),this.styles={},e.ShaderProgram.reset();let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.gl=null}this.sources={},this.destroyWorkers(),this.tile_manager.destroy(),this.tile_manager=null,e.log.reset()}createCanvas(){if(!this.canvas){this.container=this.container||document.body,this.canvas=document.createElement("canvas"),this.canvas.style.position="absolute",this.canvas.style.top=0,this.canvas.style.left=0,this.container.style.backgroundColor="transparent",this.container.appendChild(this.canvas);try{this.gl=r.getContext(this.canvas,Object.assign({alpha:!0,premultipliedAlpha:!0,stencil:!0,device_pixel_ratio:e.Utils.device_pixel_ratio,powerPreference:"high-performance"},this.contextOptions))}catch(e){throw new Error("Couldn't create WebGL context. Your browser may not support WebGL, or it's turned off? Visit http://webglreport.com/ for more info.")}this.resizeMap(this.container.clientWidth,this.container.clientHeight),e.VertexArrayObject.init(this.gl),this.render_states=new wr(this.gl),this.media_capture.setCanvas(this.canvas,this.gl)}}updateExternalScripts(){let e=[...this.external_scripts||[]],t=[];if(this.config.scene.scripts)for(let e in this.config.scene.scripts)-1===t.indexOf(this.config.scene.scripts[e])&&t.push(this.config.scene.scripts[e]);for(let e in this.config.sources){let r=this.config.sources[e];if(r.scripts)for(let e in r.scripts)-1===t.indexOf(r.scripts[e])&&t.push(r.scripts[e])}return this.external_scripts=t,!(this.external_scripts.length===e.length&&this.external_scripts.every((t,r)=>t===e[r]))}createWorkers(){return this.updateExternalScripts()&&this.destroyWorkers(),this.workers?Promise.resolve():this.makeWorkers()}makeWorkers(){let t=!!this.gl.getExtension("OES_element_index_uint"),r=[];this.workers=[];for(let n=0;n<this.num_workers;n++){let i=new Worker(Yg.workerURL);this.workers[n]=i,e.WorkerBroker.addWorker(i),e.log("debug",`Scene.makeWorkers: initializing worker ${n}`);let s=n;r.push(e.WorkerBroker.postMessage(i,"self.init",this.id,n,this.num_workers,this.log_level,e.Utils.device_pixel_ratio,t,this.external_scripts).then(t=>(e.log("debug",`Scene.makeWorkers: initialized worker ${t}`),t),t=>(e.log("error",`Scene.makeWorkers: failed to initialize worker ${s}:`,t),Promise.reject(t))))}return this.next_worker=0,Promise.all(r).then(()=>{e.log.setWorkers(this.workers)})}destroyWorkers(){this.selection=null,Array.isArray(this.workers)&&(e.log.setWorkers(null),this.workers.forEach(e=>{e.terminate()}),this.workers=null)}ready(){return!(!this.view.ready()||0===Object.keys(this.sources).length)}updateDevicePixelRatio(){e.Utils.updateDevicePixelRatio()&&e.WorkerBroker.postMessage(this.workers,"self.updateDevicePixelRatio",e.Utils.device_pixel_ratio).then(()=>this.rebuild()).then(()=>this.resizeMap(this.view.size.css.width,this.view.size.css.height))}resizeMap(t,n){0===t&&0===n||(this.dirty=!0,this.view.setViewportSize(t,n),this.gl&&r.resize(this.gl,t,n,e.Utils.device_pixel_ratio))}requestRedraw(){this.dirty=!0}immediateRedraw(){this.dirty=!0,this.update()}renderLoop(){this.render_loop_active=!0,this.update(),e.Task.setState({user_moving_view:this.view.user_input_active}),e.Task.processAll(),this.render_loop_stop?(this.render_loop_stop=!1,this.render_loop_active=!1):window.requestAnimationFrame(this.renderLoop.bind(this))}setupRenderLoop(){this.render_loop_active||setTimeout(()=>{this.renderLoop()},0)}update(){let t=this.dirty,r=!!this.selection&&this.selection.hasPendingRequests();var n=!(!1===t&&!1===r||!1===this.initialized||this.updating>0||!1===this.ready());return this.trigger("pre_update",n),this.view.update(),!!n&&(this.dirty=!1,this.updateDevicePixelRatio(),this.render({main:t,selection:r}),this.updateViewComplete(),this.media_capture.completeScreenshot(),this.trigger("post_update",n),(!0===this.animated||this.view.isAnimating())&&(this.dirty=!0),this.frame++,e.log("trace","Scene.render()"),!0)}render({main:t,selection:r}){var n=this.gl;if(this.updateBackground(),Object.keys(this.lights).forEach(e=>this.lights[e].update()),this.render_count_changed=!1,t&&(this.render_count=this.renderPass(),this.last_main_render=this.frame,this.render_count!==this.last_render_count&&(this.render_count_changed=!0,this.logFirstFrame(),this.getFeatureSelectionMapSize().then(t=>{this.selection_feature_count=t,e.log("info",`Scene: rendered ${this.render_count} primitives (${t} features in selection map)`)})),this.last_render_count=this.render_count),r){if(this.view.panning||this.view.user_input_active)return void this.selection.clearPendingRequests();!this.selection.locked&&this.last_selection_render<this.last_main_render&&(this.selection.bind(),this.renderPass("selection_program",{allow_blend:!1}),n.bindFramebuffer(n.FRAMEBUFFER,null),n.viewport(0,0,this.canvas.width,this.canvas.height),n.clearColor(...this.background.computed_color),this.last_selection_render=this.frame),this.selection.read()}return!0}renderPass(t="program",{allow_blend:r}={}){r=null==r||r,this.clearFrame();let n,i=0;const s=this.style_manager.getActiveBlendOrders();for(const{blend_order:o,styles:a}of s)for(let s=0;s<a.length;s++){let l=this.styles[a[s]];if(null==l)continue;if(l.blend!==n){let t=Object.assign({},e.Style.render_states[l.blend],{blend:r&&l.blend});this.setRenderState(t)}const u=r&&l.blend;if("translucent"===u)this.gl.colorMask(!1,!1,!1,!1),this.renderStyle(l.name,t,o),this.gl.colorMask(!0,!0,!0,!0),this.gl.depthFunc(this.gl.EQUAL),this.gl.enable(this.gl.STENCIL_TEST),this.gl.clearStencil(0),this.gl.clear(this.gl.STENCIL_BUFFER_BIT),this.gl.stencilFunc(this.gl.EQUAL,this.gl.ZERO,255),this.gl.stencilOp(this.gl.KEEP,this.gl.KEEP,this.gl.INCR),i+=this.renderStyle(l.name,t,o),this.gl.disable(this.gl.STENCIL_TEST),this.gl.depthFunc(this.gl.LESS);else if("opaque"!==u&&!0===l.stencil_proxy_tiles){const e=this.tile_manager.getRenderableTiles().filter(e=>e.meshes[l.name]).map(e=>e.proxy_level).reduce((e,t)=>(e.indexOf(t)>-1||e.push(t),e),[]).sort();if(e.length>1){this.gl.enable(this.gl.STENCIL_TEST),this.gl.clearStencil(0),this.gl.clear(this.gl.STENCIL_BUFFER_BIT),this.gl.stencilOp(this.gl.KEEP,this.gl.KEEP,this.gl.REPLACE);for(let r=0;r<e.length;r++)this.gl.stencilFunc(this.gl.GEQUAL,e.length-r,255),i+=this.renderStyle(l.name,t,o,e[r]);this.gl.disable(this.gl.STENCIL_TEST)}else i+=this.renderStyle(l.name,t,o)}else i+=this.renderStyle(l.name,t,o);n=l.blend}return i}renderStyle(e,t,r,n=null){let i,s=this.styles[e],o=!0,a=0,l=this.tile_manager.getRenderableTiles().filter(e=>"number"!=typeof n||e.proxy_level===n).map(t=>{if(t.meshes[e])return[t,t.meshes[e].filter(e=>e.variant.blend_order===r)]}).filter(e=>e),u=Math.max(...l.map(([,e])=>Math.max(...e.map(e=>e.variant.mesh_order))));for(let r=0;r<u+1;r++)for(let[n,u]of l){let l=!0;if(!n.shouldProxyForStyle(e))continue;const c=u.filter(e=>e.variant.mesh_order===r);if(0!==c.length){if(!0===o&&(o=!1,i=this.setupStyle(s,t),!i))return 0;c.forEach(e=>{!0===l&&(l=!1,this.view.setupTile(n,i)),s.render(e)&&this.requestRedraw(),a+=e.geometry_count})}}return a}setupStyle(e,t){let r;try{if(r=e.getProgram(t),!r)return}catch(t){return void this.trigger("warning",{type:"styles",message:`Error compiling style ${e.name}`,style:e,shader_errors:e.program&&e.program.shader_errors})}r.use(),e.setup(),r.uniform("1f","u_time",this.animated?(+new Date-this.start_time)/1e3:0),this.view.setupProgram(r);for(let e in this.lights)this.lights[e].setupProgram(r);return r}clearFrame(){this.initialized&&(this.render_states.depth_write.set({depth_write:!0}),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT|this.gl.STENCIL_BUFFER_BIT))}setRenderState({depth_test:e,depth_write:t,cull_face:r,blend:n}={}){if(!this.initialized)return;let i=this.render_states;e=!1!==e&&i.defaults.depth_test,t=!1!==t&&i.defaults.depth_write,r=!1!==r&&i.defaults.culling,n=null!=n?n:i.defaults.blending;let s=this.gl;i.depth_test.set({depth_test:e}),i.depth_write.set({depth_write:t}),i.culling.set({cull:r,face:i.defaults.culling_face}),n?"opaque"===n?i.blending.set({blend:!1}):"overlay"===n||"inlay"===n||"translucent"===n?i.blending.set({blend:!0,src:s.SRC_ALPHA,dst:s.ONE_MINUS_SRC_ALPHA,src_alpha:s.ONE,dst_alpha:s.ONE_MINUS_SRC_ALPHA}):"add"===n?i.blending.set({blend:!0,src:s.ONE,dst:s.ONE}):"multiply"===n&&i.blending.set({blend:!0,src:s.ZERO,dst:s.SRC_COLOR}):i.blending.set({blend:!1})}getFeatureAt(t,{radius:r}={}){if(!this.initialized)return e.log("debug","Scene.getFeatureAt() called before scene was initialized"),Promise.resolve();if(0===this.selection_feature_count)return Promise.resolve();this.selection||this.resetFeatureSelection();let n={x:t.x/this.view.size.css.width,y:t.y/this.view.size.css.height};return r=r>0?{x:r/this.view.size.css.width,y:r/this.view.size.css.height}:null,this.selection.getFeatureAt(n,{radius:r}).then(e=>Object.assign(e,{pixel:t})).catch(e=>Promise.resolve({error:e}))}async queryFeatures({filter:t,unique:r=!0,group_by:n=null,visible:i=null,geometry:s=!1}={}){if(!this.initialized)return[];t=e.Utils.serializeWithFunctions(t);const o=!0===(r="string"==typeof r?[r]:r)||Array.isArray(r)&&r.indexOf("$id")>-1,a=r&&(t=>{const n=Array.isArray(r)?e.sliceObject(t.properties,r):t.properties,i=o?t.id:null;return s?JSON.stringify({geometry:t.geometry,properties:n,id:i}):JSON.stringify({properties:n,id:i})}),l=(n=("string"==typeof n||Array.isArray(n))&&n)&&(t=>Array.isArray(n)?JSON.stringify(e.sliceObject(t,n)):t[n]),u=this.tile_manager.getRenderableTiles().map(e=>e.key),c=await e.WorkerBroker.postMessage(this.workers,"self.queryFeatures",{filter:t,visible:i,geometry:s,tile_keys:u}),h=[],d={},f={};return c.forEach(e=>e.forEach(e=>{if(a){const t=a(e);if(d[t])return;d[t]=!0}if(l){const t=l(e.properties);f[t]=f[t]||[],f[t].push(e)}else h.push(e)})),l?f:h}rebuild({initial:t=!1,new_generation:r=!0,sources:n=null,serialize_funcs:i,profile:s=!1,fade_in:o=!1}={}){return new Promise((a,l)=>{if(this.building){this.building.queued&&this.building.queued.reject&&(e.log("debug","Scene.rebuild: request superceded by a newer call"),this.building.queued.resolve(!1));let u={initial:t,new_generation:r,sources:n,serialize_funcs:i,profile:s,fade_in:o};return this.building.queued={resolve:a,reject:l,options:u},void e.log("trace","Scene.rebuild(): queuing request")}if(this.building={resolve:a,reject:l,initial:t},s&&this.debug.profile("Scene.rebuild"),r){this.generation=++Sr.generation;for(let e in this.styles)this.styles[e].setGeneration(this.generation)}this.syncConfigToWorker({serialize_funcs:i}),this.resetWorkerFeatureSelection(n),this.resetTime(),this.tile_manager.pruneToVisibleTiles(),this.tile_manager.forEachTile(e=>{(!n||n.indexOf(e.source.name)>-1)&&this.tile_manager.buildTile(e,{fade_in:o})}),this.tile_manager.updateTilesForView(),this.tile_manager.checkBuildQueue()}).then(()=>{s&&this.debug.profileEnd("Scene.rebuild")})}tileManagerBuildDone(){if(e.TextCanvas.pruneTextCache(),this.building){e.log("info","Scene: build geometry finished"),this.building.resolve&&(this.logFirstBuild(),this.building.resolve(!0));var t=this.building.queued;this.building=null,t?(e.log("debug","Scene: starting queued rebuild() request"),this.rebuild(t.options).then(t.resolve,t.reject)):this.tile_manager.updateLabels()}}async loadScene(t=null,{base_path:r,file_type:n}={}){this.config_source=t||this.config_source,"string"==typeof this.config_source?this.base_path=e.pathForURL(r||this.config_source):this.base_path=e.pathForURL(r),this.config_path=this.base_path;const{config:i,bundle:s,texture_nodes:o}=await fr.loadScene(this.config_source,{path:this.base_path,type:n});return this.config=i,this.config_bundle=s,{texture_nodes:o}}setDataSource(t,r){if(!t||!r||!r.type||!r.url&&!r.data)return void e.log("error","No name provided or not a valid config:",t,r);let n=null==this.config.sources[t],i=this.config.sources[t]=Object.assign({},r);return i.data&&"object"==typeof i.data&&(i.url=e.createObjectURL(new Blob([JSON.stringify(i.data)],{type:"application/json"})),delete i.data),n?this.updateConfig({rebuild:{sources:[t]}}):this.rebuild({sources:[t]})}createDataSources(t=!1){const r=[],n=Object.keys(this.sources);let i=0;for(var s in this.config.sources){const n=this.config.sources[s],o=this.sources[s];try{const t=Tr(Tr({},n),{},{name:s,id:i++});if(this.sources[s]=e.DataSource.create(t,this.sources),!this.sources[s])throw{}}catch(t){delete this.sources[s];const r=`Could not create data source: ${t.message}`;e.log("warn",`Scene: ${r}`,n),this.trigger("warning",{type:"sources",source:n,message:r})}(t||e.DataSource.tileLayoutChanged(this.sources[s],o))&&r.push(s)}n.forEach(e=>{this.config.sources[e]||(delete this.sources[e],r.push(e))}),r.length>0&&this.tile_manager.removeTiles(e=>r.indexOf(e.source.name)>-1);for(let e in this.config.layers){let t=this.config.layers[e];!1!==t.enabled&&t.data&&this.sources[t.data.source]&&(this.sources[t.data.source].builds_geometry_tiles=!0)}}loadTextures(){return e.Texture.createFromObject(this.gl,this.config.textures).then(()=>e.Texture.createDefault(this.gl))}freePreviousTextures(){this.prev_textures&&(this.prev_textures.forEach(t=>{!this.config.textures[t]&&e.Texture.textures[t]&&e.Texture.textures[t].destroy()}),this.prev_textures=null)}updateStyles(){if(!this.initialized&&!this.initializing)throw new Error("Scene.updateStyles() called before scene was initialized");this.styles=this.style_manager.build(this.config.styles),this.style_manager.initStyles(this);for(let e in this.styles)this.styles[e].setGL(this.gl);this.dirty=!0}get animated(){return!1!==this.config.scene.animated&&this.style_manager.getActiveStyles().some(e=>this.styles[e].animated)}getActiveCamera(){return this.view.getActiveCamera()}setActiveCamera(e){return this.view.setActiveCamera(e)}createLights(){this.lights={},e.debugSettings.wireframe&&(e.Light.enabled=!1);for(let t in this.config.lights){if(!this.config.lights[t]||"object"!=typeof this.config.lights[t])continue;let r=this.config.lights[t];r.name=t.replace("-","_"),r.visible=!1!==r.visible,r.visible&&(this.lights[r.name]=e.Light.create(this.view,r))}e.Light.inject(this.lights)}setBackground(){const t=this.config.scene.background;this.background={},t&&t.color&&(this.background.color=e.StyleParser.createColorPropertyCache(t.color)),this.background.color||(this.background.color=e.StyleParser.createColorPropertyCache([0,0,0,0]))}updateBackground(){const t=this.background.computed_color,r=this.background.computed_color=e.StyleParser.evalCachedColorProperty(this.background.color,{zoom:this.view.tile_zoom});t&&!r.some((e,r)=>t[r]!==e)||(1===r[3]?this.canvas.style.backgroundColor=`rgba(${r.map(e=>Math.floor(255*e)).join(", ")})`:this.canvas.style.backgroundColor="transparent",this.gl.clearColor(...r))}setIntrospection(e){return e!==this.introspection?(this.introspection=null!=e&&e,this.updating++,this.updateConfig({normalize:!1}).then(()=>this.updating--)):Promise.resolve()}updateConfig({loading:t=!1,rebuild:r=!0,serialize_funcs:n,texture_nodes:i={},normalize:s=!0,fade_in:o=!1}={}){this.generation=++Sr.generation,this.updating++,this.config=fr.applyGlobalProperties(this.config),s&&fr.normalize(this.config,this.config_bundle,i),fr.hoistTextureNodes(this.config,this.config_bundle,i),this.trigger(t?"load":"update",{config:this.config}),this.style_manager.init(),this.view.reset(),this.createLights(),this.createDataSources(t),this.loadTextures(),this.setBackground(),e.FontManager.loadFonts(this.config.fonts),this.updateStyles();let a=r?this.rebuild(Object.assign({initial:t,new_generation:!1,serialize_funcs:n,fade_in:o},"object"==typeof r&&r)):this.syncConfigToWorker({serialize_funcs:n});return this.updating--,this.view.updateBounds(),this.requestRedraw(),a.then(()=>{this.last_render_count=0,this.requestRedraw()})}syncConfigToWorker({serialize_funcs:t=!0}={}){let r=t?e.Utils.serializeWithFunctions(this.config):JSON.stringify(this.config);return e.WorkerBroker.postMessage(this.workers,"self.updateConfig",{config:r,generation:this.generation,introspection:this.introspection},e.debugSettings)}createListeners(){this.listeners={},this.listeners.view={move:()=>this.trigger("move")},this.view.subscribe(this.listeners.view),this.listeners.texture={update:()=>this.dirty=!0,warning:e=>this.trigger("warning",Object.assign({type:"textures"},e))},e.Texture.subscribe(this.listeners.texture),this.listeners.scene_loader={error:e=>this.trigger("error",Object.assign({type:"scene"},e))},fr.subscribe(this.listeners.scene_loader)}destroyListeners(){this.unsubscribeAll(),this.view.unsubscribe(this.listeners.view),e.Texture.unsubscribe(this.listeners.texture),fr.unsubscribe(this.listeners.scene_loader),this.listeners=null}destroyFeatureSelection(){this.selection&&(this.selection.destroy(),this.selection=null)}resetFeatureSelection(){this.selection=new e.FeatureSelection(this.gl,this.workers,()=>this.building),this.last_render_count=0}resetWorkerFeatureSelection(t=null){this.workers&&e.WorkerBroker.postMessage(this.workers,"self.resetFeatureSelection",t)}getFeatureSelectionMapSize(){return null==this.fetching_selection_map&&(this.fetching_selection_map=e.WorkerBroker.postMessage(this.workers,"self.getFeatureSelectionMapSize").then(e=>(this.fetching_selection_map=null,e.reduce((e,t)=>e+t)))),this.fetching_selection_map}resetTime(){this.start_time=+new Date}updateViewComplete(){!this.render_count_changed&&this.generation===this.last_complete_generation||this.building||this.tile_manager.isLoadingVisibleTiles()||!this.tile_manager.allVisibleTilesLabeled()||(this.tile_manager.updateLabels(),this.last_complete_generation=this.generation,this.trigger("view_complete",{first:!0!==this.view_complete}),this.view_complete=!0)}resetViewComplete(){this.last_complete_generation=null}screenshot({background:e="white"}={}){return this.requestRedraw(),this.media_capture.screenshot({background:e})}startVideoCapture(){return this.requestRedraw(),this.media_capture.startVideoCapture()}stopVideoCapture(){return this.media_capture.stopVideoCapture()}logFirstFrame(){0!==this.last_render_count||this.times.first_frame||(this.times.first_frame=+new Date-this.start_time,e.log("debug",`Scene: initial frame time: ${this.times.first_frame}`))}logFirstBuild(){null==this.times.first_build&&(this.times.first_build=+new Date-this.start_time,e.log("debug",`Scene: initial build time: ${this.times.first_build}`))}}var kr;Sr.id=0,Sr.generation=0;const Or={map:{},scrollWheelZoom:{},doubleClickZoom:{}};var Rr={leafletLayer:function(t){return function(t){if(void 0!==kr)return new kr(t);if(e.Thread.is_main){let r,n=t.leaflet||window.L,i=n.GridLayer?n.GridLayer:n.TileLayer,s=i===n.GridLayer?"1.x":"0.7.x",o={};return i===n.TileLayer&&(o._addTile=function(){},o._removeTile=function(){},o._reset=function(){i.prototype._reset.apply(this,arguments),this.scene&&this.scene.container&&this.scene.canvas&&this.scene.container.appendChild(this.scene.canvas)}),Object.assign(o,{initialize(e){e.showDebug=!!e.showDebug,n.setOptions(this,e),this.updateTangramDebugSettings(),this.createScene(),this.hooks={},this._updating_tangram=!1},createScene(){this.scene=Sr.create(this.options.scene,{numWorkers:this.options.numWorkers,preUpdate:this.options.preUpdate,postUpdate:this.options.postUpdate,continuousZoom:"1.x"===kr.leafletVersion,wrapView:!0!==this.options.noWrap,highDensityDisplay:this.options.highDensityDisplay,logLevel:this.options.logLevel,introspection:this.options.introspection,webGLContextOptions:this.options.webGLContextOptions,disableRenderLoop:this.options.disableRenderLoop})},onAdd(t){this.scene||this.createScene(),i.prototype.onAdd.apply(this,arguments),this.hooks.resize=()=>{this._updating_tangram=!0,this.updateSize(),this._updating_tangram=!1},t.on("resize",this.hooks.resize),this.hooks.move=()=>{if(!this._updating_tangram){this._updating_tangram=!0,this.scene.view.setPanning(!0);var r=t.getCenter();r.zoom=Math.max(Math.min(t.getZoom(),t.getMaxZoom()||e.Geo.default_view_max_zoom),t.getMinZoom()),this.scene.view.setView(r),this._mapLayerCount>1&&this.scene.immediateRedraw(),this._updating_tangram=!1}},t.on("move",this.hooks.move),this.hooks.moveend=()=>{this.scene.view.setPanning(!1),this.scene.requestRedraw()},t.on("moveend",this.hooks.moveend),this.hooks.drag=()=>{this.scene.view.markUserInput()},t.on("drag",this.hooks.drag),this._map_pane_observer=new MutationObserver(e=>{e.forEach(()=>this.reverseTransform())}),this._map_pane_observer.observe(t.getPanes().mapPane,{attributes:!0}),this.modifyScrollWheelBehavior(t),this.modifyZoomBehavior(t),this.trackMapLayerCounts(t),this.setupSelectionEventHandlers(t),this.setSelectionEvents(this.options.events,{radius:this.options.selectionRadius}),this.scene.container=this.getContainer(),this.updateSize(),this.updateView(),this.resizeOnFirstVisible(),this.scene.subscribe({move:this.onTangramViewUpdate.bind(this)}),this.scene.load(this.options.scene,{base_path:this.options.sceneBasePath,file_type:this.options.sceneFileType,blocking:!1}).then(()=>{if(!this.options.attribution)for(const[,e]of Object.entries(this.scene.config.sources))e.attribution&&t.attributionControl.addAttribution(e.attribution);this._updating_tangram=!0,this.updateSize(),this.updateView(),this.reverseTransform(),this._updating_tangram=!1,this.fire("init")}).catch(e=>{this.fire("error",e)})},onRemove(e){i.prototype.onRemove.apply(this,arguments),e.off("layeradd layerremove overlayadd overlayremove",this._updateMapLayerCount),e.off("resize",this.hooks.resize),e.off("move",this.hooks.move),e.off("moveend",this.hooks.moveend),e.off("drag",this.hooks.drag),e.off("click",this.hooks.click),e.off("mousemove",this.hooks.mousemove),e.off("mouseout",this.hooks.mouseout),document.removeEventListener("visibilitychange",this.hooks.visibilitychange),this.hooks={},this._map_pane_observer.disconnect(),this.scene&&(this.scene.destroy(),this.scene=null)},createTile(e){var t=e.x+"/"+e.y+"/"+e.z,r=document.createElement("div");if(r.setAttribute("data-tile-key",t),r.style.width="256px",r.style.height="256px",this.options.showDebug){var n=document.createElement("div");n.textContent=t,n.style.position="absolute",n.style.left=0,n.style.top=0,n.style.color="white",n.style.fontSize="16px",n.style.textOutline="1px #000000",n.style.padding="8px",r.appendChild(n),r.style.borderStyle="solid",r.style.borderColor="white",r.style.borderWidth="1px"}return r},modifyScrollWheelBehavior(e){if(this.scene.view.continuous_zoom&&e.scrollWheelZoom&&!1!==this.options.modifyScrollWheel){e.options.zoomSnap=0;const a=e.scrollWheelZoom.enabled();e.scrollWheelZoom.disable(),n.Browser.chrome||n.Browser.safari?e.scrollWheelZoom._onWheelScroll=function(e){var t=n.DomEvent.getWheelDelta(e);this._delta+=t,this._lastMousePos=this._map.mouseEventToContainerPoint(e),this._performZoom(),n.DomEvent.stop(e)}:e.options.wheelDebounceTime=20;const l=(i=function(e){e._moveEnd(!0),e.fire("viewreset")},s=2*e.options.wheelDebounceTime,function(){var e=this,t=arguments;clearTimeout(o),o=setTimeout(function(){o=null,i.apply(e,t)},s)});Or.scrollWheelZoom._performZoom||(Or.scrollWheelZoom._performZoom=e.scrollWheelZoom._performZoom);var t=this;e.scrollWheelZoom._performZoom=function(){if(this._map===t._map){var e=this._map,n=e.getZoom();e._stop();var i=this._delta/(4*this._map.options.wheelPxPerZoomLevel);this._delta=0,n+i>=this._map.getMaxZoom()?i=this._map.getMaxZoom()-n:n+i<=this._map.getMinZoom()&&(i=this._map.getMinZoom()-n),i&&("center"===e.options.scrollWheelZoom?r(t,e.getCenter(),n+i):r(t,this._lastMousePos,n+i),l(e))}else Or.scrollWheelZoom._performZoom.call(this)},a&&e.scrollWheelZoom.enable()}var i,s,o},modifyZoomBehavior(e){if(this.scene.view.continuous_zoom&&!1!==this.options.modifyZoomBehavior){var t=this;const i=function(t,i,s){e._stop();var o=e._zoom;i=n.latLng(i),s=void 0===s?o:s,s=Math.min(s,e.getMaxZoom());var a=Date.now();return e._moveStart(!0),function l(){var u=(Date.now()-a)/75;u<=1?(e._flyToFrame=n.Util.requestAnimFrame(l,e),r(t,i,o+(s-o)*u)):r(t,i,s)._moveEnd(!0)}.call(e),e};if(e.doubleClickZoom){const r=e.doubleClickZoom.enabled();e.doubleClickZoom.disable(),Or.doubleClickZoom._onDoubleClick||(Or.doubleClickZoom._onDoubleClick=e.doubleClickZoom._onDoubleClick),e.doubleClickZoom._onDoubleClick=function(e){if(this._map===t._map){var r=this._map,n=r.getZoom(),s=r.options.zoomDelta,o=e.originalEvent.shiftKey?n-s:n+s;"center"===r.options.doubleClickZoom?i(t,r.getCenter(),o):i(t,r.containerPointToLatLng(e.containerPoint),o)}else Or.doubleClickZoom._onDoubleClick.call(this,e)},r&&e.doubleClickZoom.enable()}e._zoomAnimated&&(Or.map._animateZoom||(Or.map._animateZoom=e._animateZoom),e._animateZoom=function(e,r,s,o){this===t._map?(s&&(this._animatingZoom=!0,this._animateToCenter=e,this._animateToZoom=r,i(t,e,r)),setTimeout(n.Util.bind(this._onZoomTransitionEnd,this),250)):Or.map._animateZoom.call(this,e,r,s,o)})}},updateView(){var t=this._map.getCenter();t.zoom=Math.max(Math.min(this._map.getZoom(),this._map.getMaxZoom()||e.Geo.default_view_max_zoom),this._map.getMinZoom()),this.scene.view.setView(t)},updateSize(){var e=this._map.getSize();this.scene.resizeMap(e.x,e.y)},resizeOnFirstVisible(){let e=!0;this.hooks.visibilitychange=()=>{e&&(e=!1,this.updateSize())},document.addEventListener("visibilitychange",this.hooks.visibilitychange)},onTangramViewUpdate(){if(!this._map||this._updating_tangram)return;let e=this._map.getCenter(),t=this.scene.view.center;e.lng===t.lng&&e.lat===t.lat&&this._map.getZoom()===this.scene.view.zoom||(this._updating_tangram=!0,this._map.setView([this.scene.view.center.lat,this.scene.view.center.lng],this.scene.view.zoom,{animate:!1}),this._updating_tangram=!1)},render(){this.scene&&this.scene.update()},reverseTransform(){if(this._map&&this.scene&&this.scene.container){var e=this._map.containerPointToLayerPoint([0,0]);n.DomUtil.setPosition(this.scene.container,e)}},setupSelectionEventHandlers(e){this._selection_events={},this._selection_radius=null,this.hooks.click=e=>{"function"==typeof this._selection_events.click&&this.scene.getFeatureAt(e.containerPoint,{radius:this._selection_radius}).then(t=>{let r=Object.assign({},t,{leaflet_event:e});this._selection_events.click(r)})},e.on("click",this.hooks.click),this.hooks.mousemove=e=>{"function"==typeof this._selection_events.hover&&this.scene.getFeatureAt(e.containerPoint,{radius:this._selection_radius}).then(t=>{let r=Object.assign({},t,{leaflet_event:e});this._selection_events.hover(r)})},e.on("mousemove",this.hooks.mousemove),this.hooks.mouseout=e=>{"function"==typeof this._selection_events.hover&&this._selection_events.hover({changed:!0,leaflet_event:e})},e.on("mouseout",this.hooks.mouseout)},setSelectionEvents(e,{radius:t}={}){this._selection_events=Object.assign(this._selection_events,e),this._selection_radius=void 0!==t?t:this._selection_radius},trackMapLayerCounts(e){this._updateMapLayerCount=()=>{let t=e.getPanes().mapPane.childNodes;this._mapLayerCount=0;for(let e=0;e<t.length;e++)this._mapLayerCount+=t[e].childNodes.length},e.on("layeradd layerremove overlayadd overlayremove",this._updateMapLayerCount),this._updateMapLayerCount()},updateTangramDebugSettings(){e.mergeDebugSettings(this.options.debug||{})}}),r=function(e,t,r){var i=e._map,s=e.scene,o=i.getZoomScale(r),a=i.getSize().divideBy(2),l=(t instanceof n.Point?t:i.latLngToContainerPoint(t)).subtract(a).multiplyBy(1-1/o),u=i.containerPointToLatLng(a.add(l));return s&&s.view.markUserInput(),i._move(u,r,{flyTo:!0})},"function"!=typeof(kr=i.extend(o)).remove&&(kr.prototype.remove=function(){this._map&&this._map.removeLayer(this),this.fire("remove")}),kr.layerBaseClass=i,kr.leafletVersion=s,new kr(t)}}(t)},debug:{log:e.log,yaml:ur,Utils:e.Utils,Geo:e.Geo,Vector:e.Vector,DataSource:e.DataSource,GLSL:e.GLSL,ShaderProgram:e.ShaderProgram,VertexData:e.VertexData,Texture:e.Texture,Material:e.Material,Light:e.Light,Scene:Sr,WorkerBroker:e.WorkerBroker,Task:e.Task,StyleManager:e.StyleManager,StyleParser:e.StyleParser,TileID:e.TileID,Collision:e.Collision,FeatureSelection:e.FeatureSelection,TextCanvas:e.TextCanvas,debugSettings:e.debugSettings},version:e.version};return Rr});try{Yg.debug.ESM=!0,Yg.debug.SHA="d0b887d09a3645aad91a18bd3bd0362d74627da3","object"==typeof window&&(window.Tangram=Yg)}catch(zp){}var Jg=Object.freeze({__proto__:null});export{dh as API_METHODS,oh as ApiService,Zg as AuthPage,th as AuthStore,re as Button,kd as Card,Rt as Checkbox,tf as DartcomAuthProvider,ih as DartcomMobxProvider,g_ as DartcomProviders,b_ as DateField,ee as DeleteButton,ni as DragList,te as EditButton,Md as ErrorBoundary,Ct as Form,lh as GlobalConfig,Dt as Input,Sd as LeafletLayer,Q as List,Od as Loader,Pp as LocalizationProvider,v_ as Modal,eh as ModalStore,Y as NoData,fh as PanelsNames,hp as QueryProvider,Mt as Select,gh as SourceLayers,nh as StoreContext,yh as TangramSourceNames,ed as TrafficSignStatus,_h as _backendUrl,uh as _testApiKeys,Ch as catIds,ah as createApiService,A_ as encodeString,Wh as getAdminAreaLayers,Ed as getAllLayers,Ad as getAllPointLayers,xd as getAllPolygonLayers,wd as getAllPolylineLayers,$h as getBuildingLayers,kh as getBuiltupAreaLayers,gd as getCameraLayers,zh as getCityPOILayers,Lh as getConditionLayers,Nh as getDefaultPOI,qh as getFacilityAreaLayers,Gh as getLanduseAreaLayers,Eh as getLaneMarkingLineLayers,Ah as getLaneMarkingPolyLayers,vd as getLayerName,Qh as getLinkLayers,Hh as getNatureFieldLayers,Jh as getNatureForestLayers,Vh as getOceanAreaLayers,Ih as getOneWayLayers,Dh as getPOILayers,Ph as getPOITypeLayer,Th as getParkingLineLayers,yd as getPillarLayers,Oh as getPointAddressLayers,jh as getRailroadLayers,wh as getRoadPolyLayers,fd as getTrafficSignImgSrc,dd as getTrafficSignLayers,md as getTrafficSignTitlesOptions,pd as getTrafficSignTypeByNumber,_d as getTrafficSignalLayers,E_ as getUrlencodedBody,bd as getValidLayer,Uh as getWaterAreaLayers,Bh as getWaterLinkLayers,bh as imagesPath,y_ as modalStyle,cp as queryClient,rh as rootStore,xh as sourceUrl,Rh as text_source,vh as tile_size,sd as trafficSignExtension,hd as trafficSignFieldsTitles,ad as trafficSignHeights,id as trafficSignLayerName,rd as trafficSignNumbers,td as trafficSignNumbersInformation,od as trafficSignNumbersSizes,cd as trafficSignStatusOptions,ld as trafficSignTypes,ud as trafficSignTypesOptions,nd as trafficSignWidths,Nt as useFormContext,Td as useGetLeafletLayer,k_ as useGetUser,S_ as useLogout,sh as useRootStore,w_ as useShowErrorSnackbar,x_ as useShowSnackbar,T_ as useSignIn};
|
|
11
11
|
//# sourceMappingURL=index.esm.js.map
|