create-caspian-app 0.2.0-beta.103 → 0.2.0-beta.104
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
var Ei=Object.defineProperty,wi=(e,t,n)=>t in e?Ei(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t,n)=>wi(e,"symbol"!=typeof t?t+"":t,n);class Nt{constructor(e,t="unknown"){d(this,"hooks",[]),d(this,"currentIndex",0),d(this,"onStateChange"),d(this,"componentLabel"),d(this,"pendingLayoutEffects",[]),d(this,"pendingEffects",[]),d(this,"currentEffectPhase",null),d(this,"pendingSynchronousRenderUpdate",!1),d(this,"pendingSynchronousLayoutUpdate",!1),d(this,"pendingUpdate",!1),d(this,"hasScheduledRender",!1),d(this,"batchedUpdates",new Set),d(this,"portalRegistrations",[]),d(this,"isRenderWindowOpen",!1),d(this,"warnedHookOutsideRender",!1),d(this,"warnedHookAfterDispose",!1),d(this,"currentHookTypes",[]),d(this,"committedHookTypes",null),d(this,"disposed",!1),this.onStateChange=e,this.componentLabel=t}static setStrictDiagnostics(e){this.strictDiagnostics=e}static getStrictDiagnostics(){return this.strictDiagnostics}loadState(e){this.hooks=[...e]}getHooks(){return this.hooks}prepareRender(){this.disposed||(this.currentIndex=0,this.isRenderWindowOpen=!0,this.warnedHookOutsideRender=!1,this.currentHookTypes=[],this.pendingLayoutEffects=[],this.pendingEffects=[],this.currentEffectPhase=null,this.portalRegistrations=[])}startRenderPhase(){this.disposed||(this.currentEffectPhase="render")}finishRenderPhase(){"render"===this.currentEffectPhase&&(this.currentEffectPhase=null),this.isRenderWindowOpen=!1;const e=this.pendingSynchronousRenderUpdate;return this.pendingSynchronousRenderUpdate=!1,e?(this.batchedUpdates.clear(),!0):(this.validateHookSignature(),!1)}recordHook(e){if(this.disposed)return this.warnedHookAfterDispose||(this.warnedHookAfterDispose=!0,this.emitDiagnostic(`[PP-WARN] ${e} hook for component "${this.componentLabel}" was called after the component was disposed. Hooks cannot be used after destroy.`)),this.currentIndex++;!this.isRenderWindowOpen&&!this.warnedHookOutsideRender&&(this.warnedHookOutsideRender=!0,this.emitDiagnostic(`[PP-WARN] ${e} hook for component "${this.componentLabel}" was called outside an active render. Hooks must be called while the component script is rendering.`));const t=this.currentIndex++;return this.currentHookTypes[t]=e,t}validateHookSignature(){if(null===this.committedHookTypes)return void(this.committedHookTypes=this.currentHookTypes.slice());const e=this.committedHookTypes,t=this.currentHookTypes;e.length===t.length&&e.every((e,n)=>e===t[n])||this.emitDiagnostic(`[PP-WARN] Hook order changed for component "${this.componentLabel}". Previous: [${e.join(", ")}]. Current: [${t.join(", ")}]. Hooks must be called in the same order on every render.`)}runLayoutEffects(){if(this.disposed)return this.pendingLayoutEffects=[],!1;const e=this.pendingLayoutEffects;this.pendingLayoutEffects=[],this.currentEffectPhase="layout";try{e.forEach(e=>{this.runEffectCleanup(e.previousCleanup,"layout cleanup")}),e.forEach(e=>{const t=this.runEffectCallback(e.callback,"layout effect");this.hooks[e.hookIndex]={deps:e.deps,cleanup:"function"==typeof t?t:void 0,effectType:"layout"}})}finally{this.currentEffectPhase=null}const t=this.pendingSynchronousLayoutUpdate;return this.pendingSynchronousLayoutUpdate=!1,t&&this.batchedUpdates.clear(),t}runEffects(){if(this.disposed)return void(this.pendingEffects=[]);const e=this.pendingEffects;this.pendingEffects=[],this.currentEffectPhase="effect";try{e.forEach(e=>{this.runEffectCleanup(e.previousCleanup,"effect cleanup")}),e.forEach(e=>{const t=this.runEffectCallback(e.callback,"effect");this.hooks[e.hookIndex]={deps:e.deps,cleanup:"function"==typeof t?t:void 0,effectType:"effect"}})}finally{this.currentEffectPhase=null}}runEffectCleanup(e,t){if(e)try{e()}catch(e){console.error(`[PP-ERROR] ${t} failed for component "${this.componentLabel}"`,e)}}runEffectCallback(e,t){try{return e()}catch(e){return void console.error(`[PP-ERROR] ${t} failed for component "${this.componentLabel}"`,e)}}dispose(){if(this.disposed)return;this.disposed=!0,this.pendingLayoutEffects=[],this.pendingEffects=[],this.pendingUpdate=!1,this.hasScheduledRender=!1,this.batchedUpdates.clear(),this.portalRegistrations=[];const e=e=>{const t=e.cleanup;if("function"==typeof t)try{t()}finally{e.cleanup=void 0}};this.hooks.forEach(t=>{!t||"object"!=typeof t||"layout"===t.effectType&&e(t)}),this.hooks.forEach(t=>{!t||"object"!=typeof t||"effect"===t.effectType&&e(t)}),this.hooks.forEach(t=>{!t||"object"!=typeof t||t.effectType||e(t)}),this.hooks=[],this.currentIndex=0}usePortal(e,t){const n=this.recordHook("portal");void 0===this.hooks[n]&&(this.hooks[n]={sourceParent:null});const s=this.hooks[n];return this.portalRegistrations.push({ref:e,target:t??null,info:s}),s}getPortalRegistrations(){return this.portalRegistrations}useState(e){const t=this.recordHook("state");void 0===this.hooks[t]&&(this.hooks[t]={__state:this.resolveInitialState(e),__setter:this.createStateSetter(t)});const n=this.hooks[t];("object"!=typeof n||null===n||!("__state"in n))&&(this.hooks[t]={__state:n,__setter:this.createStateSetter(t)});const s=this.hooks[t];return[s.__state,s.__setter]}resolveInitialState(e){return"function"==typeof e?e():e}createStateSetter(e){return t=>{const n=this.hooks[e];if(this.disposed||void 0===n)return;const s="function"==typeof t?t(n.__state):t;Object.is(n.__state,s)||(n.__state=s,this.batchedUpdates.add(e),this.scheduleUpdate())}}scheduleUpdate(){if(!this.disposed){if("render"===this.currentEffectPhase)return void(this.pendingSynchronousRenderUpdate=!0);if("layout"===this.currentEffectPhase)return void(this.pendingSynchronousLayoutUpdate=!0);this.hasScheduledRender=!0,this.pendingUpdate||(this.pendingUpdate=!0,queueMicrotask(()=>{if(this.pendingUpdate=!1,this.disposed)return this.hasScheduledRender=!1,void this.batchedUpdates.clear();this.hasScheduledRender&&(this.hasScheduledRender=!1,this.batchedUpdates.clear(),this.onStateChange())}))}}useRef(e=null){const t=this.recordHook("ref");return void 0===this.hooks[t]&&(this.hooks[t]={current:e}),this.hooks[t]}useMemo(e,t){const n=this.recordHook("memo"),s=this.hooks[n],i=this.normalizeDeps("memo",t);if(!s||!i||!s.deps||this.areDepsDifferent(s.deps,i)){const t=e();return this.hooks[n]={value:t,deps:i},t}return s.value}useCallback(e,t){const n=this.recordHook("callback"),s=this.hooks[n],i=this.normalizeDeps("callback",t);return s&&i&&s.deps&&!this.areDepsDifferent(s.deps,i)?s.callback:(this.hooks[n]={callback:e,deps:i},e)}useReducer(e,t,n){const s=this.recordHook("reducer");if(void 0===this.hooks[s]){const i={state:n?n(t):t,reducer:e,dispatch:null};i.dispatch=e=>{if(this.disposed)return;const t=i.reducer(i.state,e);Object.is(i.state,t)||(i.state=t,this.scheduleUpdate())},this.hooks[s]=i}const i=this.hooks[s];return i.reducer=e,[i.state,i.dispatch]}useEffect(e,t){const n=this.recordHook("effect"),s=this.hooks[n],i=this.normalizeDeps("effect",t);(!s||!i||!s.deps||this.areDepsDifferent(s.deps,i))&&this.pendingEffects.push({hookIndex:n,deps:i,callback:e,previousCleanup:"function"==typeof(null==s?void 0:s.cleanup)?s.cleanup:void 0})}useLayoutEffect(e,t){const n=this.recordHook("layoutEffect"),s=this.hooks[n],i=this.normalizeDeps("layoutEffect",t);(!s||!i||!s.deps||this.areDepsDifferent(s.deps,i))&&this.pendingLayoutEffects.push({hookIndex:n,deps:i,callback:e,previousCleanup:"function"==typeof(null==s?void 0:s.cleanup)?s.cleanup:void 0})}normalizeDeps(e,t){if(void 0!==t){if(Array.isArray(t))return t;this.emitDiagnostic(`[PP-WARN] ${e} dependencies for component "${this.componentLabel}" must be an array or omitted. Received ${this.describeDeps(t)}.`)}}describeDeps(e){var t;return null===e?"null":"object"==typeof e?(null==(t=e.constructor)?void 0:t.name)??"object":typeof e}emitDiagnostic(e){console.warn(e)}areDepsDifferent(e,t){return e.length!==t.length||t.some((t,n)=>!Object.is(t,e[n]))}}d(Nt,"strictDiagnostics",!1);class C{static saveState(e,t){e&&this.states.set(e,t)}static getState(e){return this.states.get(e)}static removeState(e){this.states.delete(e)}static saveScope(e,t){this.scopes.set(e,t)}static getScope(e){return this.scopes.get(e)}static getRootAncestor(e){let t=e;const n=new Set;for(;t&&!n.has(t);){n.add(t);const e=this.parents.get(t);if(!e)return t;t=e}return null}static resolveComponentId(e,t=null){if(!e)return null;if("app"!==e)return e;const n=new Set;let s=t,i=null;for(;s&&!n.has(s);){if(n.add(s),s.startsWith("page_"))return s;const e=this.parents.get(s)??null;if(!e){i=s;break}s=e}if(i)return i;for(const[e,t]of this.parents.entries())if(null===t&&this.scopes.has(e))return e;const r=this.scopes.keys().next().value;return"string"==typeof r?r:null}static getResolvedScope(e,t=null){const n=this.resolveComponentId(e,t);return n?this.scopes.get(n):void 0}static getResolvedScopeWithAncestors(e,t=null){const n=this.resolveComponentId(e,t);if(!n)return;const s=new Set,i=[];let r=n;for(;r&&!s.has(r);){s.add(r);const e=this.scopes.get(r);e&&i.push(e),r=this.parents.get(r)??null}return 0!==i.length?Object.assign({},...i.reverse()):void 0}static removeScope(e){this.scopes.delete(e)}static registerInstance(e,t){var n;const s=this.instances.get(e);s&&s!==t&&(null==(n=s.destroy)||n.call(s)),this.instances.set(e,t)}static getInstance(e){return this.instances.get(e)}static removeInstance(e){this.instances.delete(e)}static saveParent(e,t){e&&this.parents.set(e,t)}static getParent(e){return this.parents.get(e)}static removeParent(e){if(!this.parents.has(e))return;const t=this.parents.get(e)??null;this.parents.forEach((n,s)=>{n===e&&this.parents.set(s,t)}),this.parents.delete(e)}static getDescendantIds(e){const t=[];return this.parents.forEach((n,s)=>{s!==e&&this.isAncestor(e,s)&&t.push(s)}),t.sort((e,t)=>this.getAncestorDepth(t)-this.getAncestorDepth(e))}static saveContextValues(e,t){const n=this.contextValues.get(e)??new Map,s=new Set;return n.forEach((e,n)=>{t.has(n)||s.add(n)}),t.forEach((e,t)=>{n.has(t)&&Object.is(n.get(t),e)||s.add(t)}),t.size>0?this.contextValues.set(e,new Map(t)):this.contextValues.delete(e),Array.from(s)}static resolveContext(e,t){let n=e;for(;n;){const e=this.contextValues.get(n);if(null!=e&&e.has(t))return{providerId:n,value:e.get(t)};n=this.parents.get(n)??null}return{providerId:null,value:t.defaultValue}}static updateContextDependencies(e,t){const n=new Set(t),s=this.consumerContexts.get(e)??new Set;s.forEach(t=>{n.has(t)||this.removeContextConsumer(t,e)}),n.forEach(t=>{s.has(t)||this.addContextConsumer(t,e)}),n.size>0?this.consumerContexts.set(e,n):this.consumerContexts.delete(e)}static getConsumersForContextsInSubtree(e,t){const n=new Set;for(const s of t){const t=this.contextConsumers.get(s);t&&t.forEach(t=>{t!==e&&this.isAncestor(e,t)&&n.add(t)})}return n}static removeContextTracking(e){const t=this.contextValues.get(e),n=t?this.getConsumersForContextsInSubtree(e,t.keys()):new Set;this.contextValues.delete(e);const s=this.consumerContexts.get(e);return s&&(s.forEach(t=>{this.removeContextConsumer(t,e)}),this.consumerContexts.delete(e)),this.removeParent(e),n}static saveTemplate(e,t){this.templates.has(e)||this.templates.set(e,t)}static getTemplate(e){return this.templates.get(e)}static removeTemplate(e){this.templates.delete(e)}static saveOwnedTemplates(e,t){this.ownedTemplateData.has(e)||this.ownedTemplateData.set(e,t)}static getOwnedTemplates(e){return this.ownedTemplateData.get(e)}static removeOwnedTemplates(e){this.ownedTemplateData.delete(e)}static clear(){this.states.clear(),this.scopes.clear(),this.instances.clear(),this.parents.clear(),this.templates.clear(),this.ownedTemplateData.clear(),this.contextValues.clear(),this.consumerContexts.clear(),this.contextConsumers.clear()}static destroyAll(){var e;const t=Array.from(this.instances.values()),n=new Set;for(const s of t)if(s&&!n.has(s)){n.add(s);try{null==(e=s.destroy)||e.call(s)}catch(e){console.warn("[PP-WARN] Failed to destroy component instance",e)}}}static getStats(){return{states:this.states.size,scopes:this.scopes.size,instances:this.instances.size,parents:this.parents.size,templates:this.templates.size,ownedData:this.ownedTemplateData.size,contextValues:this.contextValues.size,contextConsumers:this.contextConsumers.size}}static addContextConsumer(e,t){const n=this.contextConsumers.get(e)??new Set;n.add(t),this.contextConsumers.set(e,n)}static removeContextConsumer(e,t){const n=this.contextConsumers.get(e);n&&(n.delete(t),0===n.size&&this.contextConsumers.delete(e))}static isAncestor(e,t){let n=this.parents.get(t)??null;for(;n;){if(n===e)return!0;n=this.parents.get(n)??null}return!1}static getAncestorDepth(e){let t=0,n=this.parents.get(e)??null;const s=new Set;for(;n&&!s.has(n);)s.add(n),t+=1,n=this.parents.get(n)??null;return t}}d(C,"states",new Map),d(C,"scopes",new Map),d(C,"instances",new Map),d(C,"parents",new Map),d(C,"templates",new Map),d(C,"ownedTemplateData",new Map),d(C,"contextValues",new Map),d(C,"consumerContexts",new Map),d(C,"contextConsumers",new Map);const pt=new Set(["class","for","while","if","else","return","function","var","let","const","import","export","this","debugger","delete","typeof","void","new","in","instanceof","do","try","catch","finally","switch","case","default","break","continue","yield","await","with","super","enum","extends","implements","interface","package","private","protected","public","static"]),ki=new Set(["Array","Object","String","Number","Boolean","Math","JSON","Date","RegExp","Error","Map","Set","WeakMap","WeakSet","Promise","Symbol","BigInt","parseInt","parseFloat","isNaN","isFinite","encodeURI","decodeURI","encodeURIComponent","decodeURIComponent","console","window","document","undefined","null","NaN","Infinity","pp","true","false","setTimeout","setInterval","clearTimeout","clearInterval","requestAnimationFrame","cancelAnimationFrame","fetch","alert","confirm","prompt"]),Lt=new Set(["hidden","disabled","checked","selected","readonly","required","open","autofocus","multiple","ismap","noValidate","defer","async","autoplay","controls","loop","muted","default","reversed","scoped","seamless","sortable","translate","draggable","contenteditable","spellcheck"]);function Vt(e){return e.includes("-")?e.replace(/-([a-z])/g,e=>e[1].toUpperCase()):e}const Ct=new WeakMap,Ai=/^[A-Za-z_$][\w$]*$/;function Ti(e){return Ai.test(e)&&!pt.has(e)}function ye(e){const t=Ct.get(e);if(t)return t;const n=Object.keys(e).filter(Ti),s={keys:n,keySig:n.join("\0")};return Ct.set(e,s),s}function be(e,t){const n=new Array(t.length);for(let s=0;s<t.length;s++)n[s]=e[t[s]];return n}const ve=new Map,Pi=500;let Ze=null,Oe=null;function Ii(e){Oe||(Oe=document.createElement("template")),Oe.innerHTML=e;const t=Array.from(Oe.content.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE?(e.textContent??"").trim().length>0:e.nodeType===Node.ELEMENT_NODE);if(1!==t.length)return null;const n=t[0];return n instanceof HTMLTemplateElement&&n.hasAttribute("pp-owner")?n.innerHTML:null}function Ri(e){let t=B(e),n=!1;for(;;){const e=Ii(t);if(null===e)break;t=e,n=!0}return n?t:null}function Mt(e){if(!e.includes("<textarea"))return e;const t=e.includes("pp-owner"),n=document.createElement("template");n.innerHTML=e;let s=!1;return n.content.querySelectorAll("textarea").forEach(e=>{const n=e;if(t){const e=Ri(n.value);if(null!==e)return n.textContent=e,void(s=!0)}n.value.length>0&&0===n.value.trim().length&&(n.textContent="",s=!0)}),s?n.innerHTML:e}function B(e){if(!e.includes("&"))return e;if(ve.has(e))return ve.get(e);Ze||(Ze=document.createElement("textarea"));const t=Ze;t.innerHTML=e;let n=t.value,s=0;for(;n.includes("&")&&s++<10;){t.innerHTML=n;const e=t.value;if(e===n)break;n=e}if(ve.size>=Pi){const e=ve.keys().next().value;void 0!==e&&ve.delete(e)}return ve.set(e,n),n}const V="data-pp-fragment-root";function Ni(e,t){let n=0,s=t-1;for(;s>=0&&"\\"===e[s];)n++,s--;return n%2!=0}function ft(e,t){if("{"!==e[t])return-1;let n=0,s=null;for(let i=t;i<e.length;i++){const t=e[i],r=Ni(e,i);if(s)t===s&&!r&&(s=null);else if(r||'"'!==t&&"'"!==t&&"`"!==t)if("{"!==t||r){if("}"===t&&!r&&(n--,0===n))return i}else n++;else s=t}return-1}function K(e){let t=0;for(;t<e.length&&/\s/.test(e[t]);)t++;if("{"!==e[t])return null;const n=ft(e,t);if(-1===n)return null;let s=n+1;for(;s<e.length&&/\s/.test(e[s]);)s++;return s!==e.length?null:{expression:e.slice(t+1,n).trim(),start:t,end:n}}function Li(e,t){let n="",s=0;for(;s<e.length;){if("{"!==e[s]){n+=e[s],s++;continue}const i=ft(e,s);if(-1===i){n+=e.slice(s);break}const r=e.slice(s+1,i);n+=t(r.trim(),r),s=i+1}return n}function Dt(e){const t=String(e??"").trim().toLowerCase();switch(t){case"table":return{prefix:`<table ${V}="">`,suffix:"</table>",rootSelector:`table[${V}]`};case"caption":return{prefix:`<table><caption ${V}="">`,suffix:"</caption></table>",rootSelector:`caption[${V}]`};case"thead":case"tbody":case"tfoot":return{prefix:`<table><${t} ${V}="">`,suffix:`</${t}></table>`,rootSelector:`${t}[${V}]`};case"tr":return{prefix:`<table><tbody><tr ${V}="">`,suffix:"</tr></tbody></table>",rootSelector:`tr[${V}]`};case"td":case"th":return{prefix:`<table><tbody><tr><${t} ${V}="">`,suffix:`</${t}></tr></tbody></table>`,rootSelector:`${t}[${V}]`};case"colgroup":return{prefix:`<table><colgroup ${V}="">`,suffix:"</colgroup></table>",rootSelector:`colgroup[${V}]`};case"select":return{prefix:`<select ${V}="">`,suffix:"</select>",rootSelector:`select[${V}]`};case"optgroup":return{prefix:`<select><optgroup ${V}="">`,suffix:"</optgroup></select>",rootSelector:`optgroup[${V}]`};case"option":return{prefix:`<select><option ${V}="">`,suffix:"</option></select>",rootSelector:`option[${V}]`};default:return{prefix:"",suffix:"",rootSelector:null}}}function Vi(e){const t=Dt(e);return{wrap:e=>`${t.prefix}${e}${t.suffix}`,unwrap:e=>{if(!t.prefix&&!t.suffix)return e;const n=document.createElement("template");if(n.innerHTML=e,t.rootSelector){const e=n.content.querySelector(t.rootSelector);if(e)return e.innerHTML}return e}}}function He(e,t){const n=Dt(t),s=document.createElement("template");if(s.innerHTML=Mt(`${n.prefix}${e}${n.suffix}`),!n.rootSelector)return{root:s.content,toHtml:()=>s.innerHTML};const i=s.content.querySelector(n.rootSelector);return i?(i.removeAttribute(V),{root:i,toHtml:()=>i.innerHTML}):{root:s.content,toHtml:()=>s.innerHTML}}function Mi(e,t){if(e===t)return!0;if(!e||!t||"object"!=typeof e||"object"!=typeof t)return!1;const n=Object.keys(e),s=n.length;let i=0;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&(i++,i>s))return!1;if(i!==s)return!1;for(let i=0;i<s;i++){const s=n[i];if(e[s]!==t[s])return!1}return!0}const We=class e{constructor(e,t,n){d(this,"root"),d(this,"getScope"),d(this,"canBindElement"),d(this,"handlerCache",new Map),this.root=e,this.getScope=t,this.canBindElement=n??(e=>this.isRootOwnedElement(e))}clearCache(){this.handlerCache.clear()}resolveEventOwnerScope(e){const t=this.root.getAttribute("pp-component");return C.getResolvedScopeWithAncestors(e,t)}bindEvents(e){(e||this.fallbackCollectEventElements()).forEach(e=>{this.canBindElement(e)&&this.bindElementEvents(e)})}isRootOwnedElement(e){var t;if(e===this.root)return!0;let n=e.closest("[pp-component]");return e===n&&(n=(null==(t=e.parentElement)?void 0:t.closest("[pp-component]"))??null),n===this.root}bindElementEvents(e){const t=e.getAttribute("pp-event-owner");t&&e.removeAttribute("pp-event-owner");const n=[];Array.from(e.attributes).forEach(s=>{if(s.name.startsWith("on")&&!s.name.includes("-")){const i=s.name.slice(2).toLowerCase();let r=s.value.trim();const a=r.match(/^\{([\s\S]*)\}$/);a&&(r=a[1].trim()),n.push(s.name),this.getNativeEventNames(e,i).forEach(n=>{const s=`__pp_bound_${n}`;if(e[s]===r)return;e[s]=r;const i=e[`__pp_handler_${n}`];i&&e.removeEventListener(n,i);const a=s=>{var i;if(this.shouldPreserveNativeSelection(e,n)){const t=e;t.__ppPreserveNativeSelectionOnNextRender=!0,queueMicrotask(()=>{t.__ppPreserveNativeSelectionOnNextRender&&delete t.__ppPreserveNativeSelectionOnNextRender})}if(t){const n=this.resolveEventOwnerScope(t);if(n)return void this.executeHandlerWithScope(r,s,n,e)}let a=e.closest("[pp-component]");a===e&&(a=(null==(i=e.parentElement)?void 0:i.closest("[pp-component]"))??null);const o=(null==a?void 0:a.getAttribute("pp-component"))||null;if(o){const t=this.resolveEventOwnerScope(o);if(t)return void this.executeHandlerWithScope(r,s,t,e)}this.executeHandler(r,s,e)};e[`__pp_handler_${n}`]=a,e.addEventListener(n,a)})}}),n.forEach(t=>{e.removeAttribute(t)})}getNativeEventNames(e,t){return"input"===t&&e instanceof HTMLInputElement&&this.isDateLikeInput(e)?["change","blur"]:[t]}isDateLikeInput(t){return e.DATE_LIKE_INPUT_TYPES.has(t.type)}shouldPreserveNativeSelection(e,t){return"input"===t&&(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&["text","search","url","tel","password"].includes(e.type))}fallbackCollectEventElements(){const e=new Set,t=this.root.attributes;for(let n=0;n<t.length;n++)if(t[n].name.startsWith("on")&&!t[n].name.includes("-")){e.add(this.root);break}const n=this.root.querySelectorAll("*");for(let t=0;t<n.length;t++){const s=n[t],i=s.attributes;for(let t=0;t<i.length;t++)if(i[t].name.startsWith("on")&&!i[t].name.includes("-")){e.add(s);break}}return e}executeHandler(e,t,n){const s=this.root.getAttribute("pp-component"),i=this.resolveEventOwnerScope(s)||this.getScope();this.executeHandlerWithScope(e,t,i,n)}executeHandlerWithScope(e,t,n,s){const i=ye(n),r=i.keys,a=be(n,r);try{const n=this.getCompiledHandler(e,r,i.keySig).call(s??t.currentTarget??null,...a,t);"function"==typeof n&&n(t)}catch(t){console.error("[PP-ERROR] Handler failed:",t),console.error("Code:",e)}}getCompiledHandler(e,t,n){const s=e+"|"+n;if(!this.handlerCache.has(s)){if(this.handlerCache.size>500){const e=this.handlerCache.keys().next().value;e&&this.handlerCache.delete(e)}const n="\n const e = event;\n const $event = event;\n const target = event?.target;\n const currentTarget = event?.currentTarget;\n const el = event?.currentTarget;\n ";let i;try{i=new Function(...t,"event",`"use strict";${n} return (${e})`)}catch{i=new Function(...t,"event",`"use strict";${n} ${e}`)}this.handlerCache.set(s,i)}return this.handlerCache.get(s)}};d(We,"DATE_LIKE_INPUT_TYPES",new Set(["date","datetime-local","month","time","week"]));let nt=We;var Di=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],Ot=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],Oi="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",Bt="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ꟑꟑꟓꟕ-ꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Je={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},et="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",Bi={5:et,"5module":et+" export import",6:et+" const class extends export import super"},Hi=/^in(stanceof)?$/,Fi=new RegExp("["+Bt+"]"),$i=new RegExp("["+Bt+Oi+"]");function at(e,t){for(var n=65536,s=0;s<t.length;s+=2){if((n+=t[s])>e)return!1;if((n+=t[s+1])>=e)return!0}return!1}function J(e,t){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&Fi.test(String.fromCharCode(e)):!1!==t&&at(e,Ot)))}function oe(e,t){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&$i.test(String.fromCharCode(e)):!1!==t&&(at(e,Ot)||at(e,Di)))))}var P=function(e,t){void 0===t&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function j(e,t){return new P(e,{beforeExpr:!0,binop:t})}var z={beforeExpr:!0},U={startsExpr:!0},dt={};function A(e,t){return void 0===t&&(t={}),t.keyword=e,dt[e]=new P(e,t)}var u={num:new P("num",U),regexp:new P("regexp",U),string:new P("string",U),name:new P("name",U),privateId:new P("privateId",U),eof:new P("eof"),bracketL:new P("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new P("]"),braceL:new P("{",{beforeExpr:!0,startsExpr:!0}),braceR:new P("}"),parenL:new P("(",{beforeExpr:!0,startsExpr:!0}),parenR:new P(")"),comma:new P(",",z),semi:new P(";",z),colon:new P(":",z),dot:new P("."),question:new P("?",z),questionDot:new P("?."),arrow:new P("=>",z),template:new P("template"),invalidTemplate:new P("invalidTemplate"),ellipsis:new P("...",z),backQuote:new P("`",U),dollarBraceL:new P("${",{beforeExpr:!0,startsExpr:!0}),eq:new P("=",{beforeExpr:!0,isAssign:!0}),assign:new P("_=",{beforeExpr:!0,isAssign:!0}),incDec:new P("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new P("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:j("||",1),logicalAND:j("&&",2),bitwiseOR:j("|",3),bitwiseXOR:j("^",4),bitwiseAND:j("&",5),equality:j("==/!=/===/!==",6),relational:j("</>/<=/>=",7),bitShift:j("<</>>/>>>",8),plusMin:new P("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:j("%",10),star:j("*",10),slash:j("/",10),starstar:new P("**",{beforeExpr:!0}),coalesce:j("??",1),_break:A("break"),_case:A("case",z),_catch:A("catch"),_continue:A("continue"),_debugger:A("debugger"),_default:A("default",z),_do:A("do",{isLoop:!0,beforeExpr:!0}),_else:A("else",z),_finally:A("finally"),_for:A("for",{isLoop:!0}),_function:A("function",U),_if:A("if"),_return:A("return",z),_switch:A("switch"),_throw:A("throw",z),_try:A("try"),_var:A("var"),_const:A("const"),_while:A("while",{isLoop:!0}),_with:A("with"),_new:A("new",{beforeExpr:!0,startsExpr:!0}),_this:A("this",U),_super:A("super",U),_class:A("class",U),_extends:A("extends",z),_export:A("export"),_import:A("import",U),_null:A("null",U),_true:A("true",U),_false:A("false",U),_in:A("in",{beforeExpr:!0,binop:7}),_instanceof:A("instanceof",{beforeExpr:!0,binop:7}),_typeof:A("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:A("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:A("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},q=/\r\n?|\n|\u2028|\u2029/,Ui=new RegExp(q.source,"g");function Ce(e){return 10===e||13===e||8232===e||8233===e}function Ht(e,t,n){void 0===n&&(n=e.length);for(var s=t;s<n;s++){var i=e.charCodeAt(s);if(Ce(i))return s<n-1&&13===i&&10===e.charCodeAt(s+1)?s+2:s+1}return-1}var Ft=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,H=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,$t=Object.prototype,qi=$t.hasOwnProperty,Wi=$t.toString,Se=Object.hasOwn||function(e,t){return qi.call(e,t)},St=Array.isArray||function(e){return"[object Array]"===Wi.call(e)},Et=Object.create(null);function ae(e){return Et[e]||(Et[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function ie(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}var ji=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Ne=function(e,t){this.line=e,this.column=t};Ne.prototype.offset=function(e){return new Ne(this.line,this.column+e)};var je=function(e,t,n){this.start=t,this.end=n,null!==e.sourceFile&&(this.source=e.sourceFile)};function Ut(e,t){for(var n=1,s=0;;){var i=Ht(e,s,t);if(i<0)return new Ne(n,t-s);++n,s=i}}var ot={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},wt=!1;function zi(e){var t={};for(var n in ot)t[n]=e&&Se(e,n)?e[n]:ot[n];if("latest"===t.ecmaVersion?t.ecmaVersion=1e8:null==t.ecmaVersion?(!wt&&"object"==typeof console&&console.warn&&(wt=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),null==t.allowReserved&&(t.allowReserved=t.ecmaVersion<5),(!e||null==e.allowHashBang)&&(t.allowHashBang=t.ecmaVersion>=14),St(t.onToken)){var s=t.onToken;t.onToken=function(e){return s.push(e)}}return St(t.onComment)&&(t.onComment=Ki(t,t.onComment)),t}function Ki(e,t){return function(n,s,i,r,a,o){var l={type:n?"Block":"Line",value:s,start:i,end:r};e.locations&&(l.loc=new je(this,a,o)),e.ranges&&(l.range=[i,r]),t.push(l)}}var Le=1,Ee=2,mt=4,qt=8,gt=16,Wt=32,ze=64,jt=128,pe=256,Ve=512,Ke=Le|Ee|pe;function vt(e,t){return Ee|(e?mt:0)|(t?qt:0)}var Fe=0,xt=1,se=2,zt=3,Kt=4,Gt=5,L=function(e,t,n){this.options=e=zi(e),this.sourceFile=e.sourceFile,this.keywords=ae(Bi[e.ecmaVersion>=6?6:"module"===e.sourceType?"5module":5]);var s="";!0!==e.allowReserved&&(s=Je[e.ecmaVersion>=6?6:5===e.ecmaVersion?5:3],"module"===e.sourceType&&(s+=" await")),this.reservedWords=ae(s);var i=(s?s+" ":"")+Je.strict;this.reservedWordsStrict=ae(i),this.reservedWordsStrictBind=ae(i+" "+Je.strictBind),this.input=String(t),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf("\n",n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(q).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=u.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===e.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(Le),this.regexpState=null,this.privateNameStack=[]},ee={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};L.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},ee.inFunction.get=function(){return(this.currentVarScope().flags&Ee)>0},ee.inGenerator.get=function(){return(this.currentVarScope().flags&qt)>0},ee.inAsync.get=function(){return(this.currentVarScope().flags&mt)>0},ee.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(pe|Ve))return!1;if(t&Ee)return(t&mt)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},ee.allowSuper.get=function(){return(this.currentThisScope().flags&ze)>0||this.options.allowSuperOutsideMethod},ee.allowDirectSuper.get=function(){return(this.currentThisScope().flags&jt)>0},ee.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},ee.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(pe|Ve)||t&Ee&&!(t>))return!0}return!1},ee.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&pe)>0},L.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,s=0;s<e.length;s++)n=e[s](n);return n},L.parse=function(e,t){return new this(t,e).parse()},L.parseExpressionAt=function(e,t,n){var s=new this(n,e,t);return s.nextToken(),s.parseExpression()},L.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(L.prototype,ee);var $=L.prototype,Gi=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;$.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){H.lastIndex=e,e+=H.exec(this.input)[0].length;var t=Gi.exec(this.input.slice(e));if(!t)return!1;if("use strict"===(t[1]||t[2])){H.lastIndex=e+t[0].length;var n=H.exec(this.input),s=n.index+n[0].length,i=this.input.charAt(s);return";"===i||"}"===i||q.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||"!"===i&&"="===this.input.charAt(s+1))}e+=t[0].length,H.lastIndex=e,e+=H.exec(this.input)[0].length,";"===this.input[e]&&e++}},$.eat=function(e){return this.type===e&&(this.next(),!0)},$.isContextual=function(e){return this.type===u.name&&this.value===e&&!this.containsEsc},$.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},$.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},$.canInsertSemicolon=function(){return this.type===u.eof||this.type===u.braceR||q.test(this.input.slice(this.lastTokEnd,this.start))},$.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},$.semicolon=function(){!this.eat(u.semi)&&!this.insertSemicolon()&&this.unexpected()},$.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},$.expect=function(e){this.eat(e)||this.unexpected()},$.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var Ge=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};$.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?"Assigning to rvalue":"Parenthesized pattern")}},$.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,s=e.doubleProto;if(!t)return n>=0||s>=0;n>=0&&this.raise(n,"Shorthand property assignments are valid only in destructuring patterns"),s>=0&&this.raiseRecoverable(s,"Redefinition of __proto__ property")},$.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},$.isSimpleAssignTarget=function(e){return"ParenthesizedExpression"===e.type?this.isSimpleAssignTarget(e.expression):"Identifier"===e.type||"MemberExpression"===e.type};var y=L.prototype;y.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==u.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var s=0,i=Object.keys(this.undefinedExports);s<i.length;s+=1){var r=i[s];this.raiseRecoverable(this.undefinedExports[r].start,"Export '"+r+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var yt={kind:"loop"},Xi={kind:"switch"};y.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;H.lastIndex=this.pos;var t=H.exec(this.input),n=this.pos+t[0].length,s=this.input.charCodeAt(n);if(91===s||92===s)return!0;if(e)return!1;if(123===s||s>55295&&s<56320)return!0;if(J(s,!0)){for(var i=n+1;oe(s=this.input.charCodeAt(i),!0);)++i;if(92===s||s>55295&&s<56320)return!0;var r=this.input.slice(n,i);if(!Hi.test(r))return!0}return!1},y.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;H.lastIndex=this.pos;var e,t=H.exec(this.input),n=this.pos+t[0].length;return!(q.test(this.input.slice(this.pos,n))||"function"!==this.input.slice(n,n+8)||n+8!==this.input.length&&(oe(e=this.input.charCodeAt(n+8))||e>55295&&e<56320))},y.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?"await":"using"))return!1;H.lastIndex=this.pos;var n=H.exec(this.input),s=this.pos+n[0].length;if(q.test(this.input.slice(this.pos,s)))return!1;if(e){var i,r=s+5;if("using"!==this.input.slice(s,r)||r===this.input.length||oe(i=this.input.charCodeAt(r))||i>55295&&i<56320)return!1;H.lastIndex=r;var a=H.exec(this.input);if(a&&q.test(this.input.slice(r,r+a[0].length)))return!1}if(t){var o,l=s+2;if(!("of"!==this.input.slice(s,l)||l!==this.input.length&&(oe(o=this.input.charCodeAt(l))||o>55295&&o<56320)))return!1}var c=this.input.charCodeAt(s);return J(c,!0)||92===c},y.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},y.isUsing=function(e){return this.isUsingKeyword(!1,e)},y.parseStatement=function(e,t,n){var s,i=this.type,r=this.startNode();switch(this.isLet(e)&&(i=u._var,s="let"),i){case u._break:case u._continue:return this.parseBreakContinueStatement(r,i.keyword);case u._debugger:return this.parseDebuggerStatement(r);case u._do:return this.parseDoStatement(r);case u._for:return this.parseForStatement(r);case u._function:return e&&(this.strict||"if"!==e&&"label"!==e)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(r,!1,!e);case u._class:return e&&this.unexpected(),this.parseClass(r,!0);case u._if:return this.parseIfStatement(r);case u._return:return this.parseReturnStatement(r);case u._switch:return this.parseSwitchStatement(r);case u._throw:return this.parseThrowStatement(r);case u._try:return this.parseTryStatement(r);case u._const:case u._var:return s=s||this.value,e&&"var"!==s&&this.unexpected(),this.parseVarStatement(r,s);case u._while:return this.parseWhileStatement(r);case u._with:return this.parseWithStatement(r);case u.braceL:return this.parseBlock(!0,r);case u.semi:return this.parseEmptyStatement(r);case u._export:case u._import:if(this.options.ecmaVersion>10&&i===u._import){H.lastIndex=this.pos;var a=H.exec(this.input),o=this.pos+a[0].length,l=this.input.charCodeAt(o);if(40===l||46===l)return this.parseExpressionStatement(r,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),i===u._import?this.parseImport(r):this.parseExport(r,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(r,!0,!e);var c=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(c)return t&&"script"===this.options.sourceType&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),"await using"===c&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(r,!1,c),this.semicolon(),this.finishNode(r,"VariableDeclaration");var h=this.value,p=this.parseExpression();return i===u.name&&"Identifier"===p.type&&this.eat(u.colon)?this.parseLabeledStatement(r,h,p,e):this.parseExpressionStatement(r,p)}},y.parseBreakContinueStatement=function(e,t){var n="break"===t;this.next(),this.eat(u.semi)||this.insertSemicolon()?e.label=null:this.type!==u.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var s=0;s<this.labels.length;++s){var i=this.labels[s];if((null==e.label||i.name===e.label.name)&&(null!=i.kind&&(n||"loop"===i.kind)||e.label&&n))break}return s===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,n?"BreakStatement":"ContinueStatement")},y.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},y.parseDoStatement=function(e){return this.next(),this.labels.push(yt),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(u._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(u.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},y.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(yt),this.enterScope(0),this.expect(u.parenL),this.type===u.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===u._var||this.type===u._const||n){var s=this.startNode(),i=n?"let":this.value;return this.next(),this.parseVar(s,!0,i),this.finishNode(s,"VariableDeclaration"),this.parseForAfterInit(e,s,t)}var r=this.isContextual("let"),a=!1,o=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(o){var l=this.startNode();return this.next(),"await using"===o&&this.next(),this.parseVar(l,!0,o),this.finishNode(l,"VariableDeclaration"),this.parseForAfterInit(e,l,t)}var c=this.containsEsc,h=new Ge,p=this.start,d=t>-1?this.parseExprSubscripts(h,"await"):this.parseExpression(!0,h);return this.type===u._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===u._in&&this.unexpected(t),e.await=!0):a&&this.options.ecmaVersion>=8&&(d.start!==p||c||"Identifier"!==d.type||"async"!==d.name?this.options.ecmaVersion>=9&&(e.await=!1):this.unexpected()),r&&a&&this.raise(d.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(d,!1,h),this.checkLValPattern(d),this.parseForIn(e,d)):(this.checkExpressionErrors(h,!0),t>-1&&this.unexpected(t),this.parseFor(e,d))},y.parseForAfterInit=function(e,t,n){return(this.type===u._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===t.declarations.length?(this.options.ecmaVersion>=9&&(this.type===u._in?n>-1&&this.unexpected(n):e.await=n>-1),this.parseForIn(e,t)):(n>-1&&this.unexpected(n),this.parseFor(e,t))},y.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,Ie|(n?0:ut),!1,t)},y.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(u._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},y.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(u.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},y.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(u.braceL),this.labels.push(Xi),this.enterScope(0);for(var t,n=!1;this.type!==u.braceR;)if(this.type===u._case||this.type===u._default){var s=this.type===u._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),s?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),n=!0,t.test=null),this.expect(u.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},y.parseThrowStatement=function(e){return this.next(),q.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var Yi=[];y.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t="Identifier"===e.type;return this.enterScope(t?Wt:0),this.checkLValPattern(e,t?Kt:se),this.expect(u.parenR),e},y.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===u._catch){var t=this.startNode();this.next(),this.eat(u.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(u._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},y.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,"VariableDeclaration")},y.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(yt),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},y.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")},y.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},y.parseLabeledStatement=function(e,t,n,s){for(var i=0,r=this.labels;i<r.length;i+=1){r[i].name===t&&this.raise(n.start,"Label '"+t+"' is already declared")}for(var a=this.type.isLoop?"loop":this.type===u._switch?"switch":null,o=this.labels.length-1;o>=0;o--){var l=this.labels[o];if(l.statementStart!==e.start)break;l.statementStart=this.start,l.kind=a}return this.labels.push({name:t,kind:a,statementStart:this.start}),e.body=this.parseStatement(s?-1===s.indexOf("label")?s+"label":s:"label"),this.labels.pop(),e.label=n,this.finishNode(e,"LabeledStatement")},y.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},y.parseBlock=function(e,t,n){for(void 0===e&&(e=!0),void 0===t&&(t=this.startNode()),t.body=[],this.expect(u.braceL),e&&this.enterScope(0);this.type!==u.braceR;){var s=this.parseStatement(null);t.body.push(s)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},y.parseFor=function(e,t){return e.init=t,this.expect(u.semi),e.test=this.type===u.semi?null:this.parseExpression(),this.expect(u.semi),e.update=this.type===u.parenR?null:this.parseExpression(),this.expect(u.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},y.parseForIn=function(e,t){var n=this.type===u._in;return this.next(),"VariableDeclaration"===t.type&&null!=t.declarations[0].init&&(!n||this.options.ecmaVersion<8||this.strict||"var"!==t.kind||"Identifier"!==t.declarations[0].id.type)&&this.raise(t.start,(n?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(u.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,n?"ForInStatement":"ForOfStatement")},y.parseVar=function(e,t,n,s){for(e.declarations=[],e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(u.eq)?i.init=this.parseMaybeAssign(t):s||"const"!==n||this.type===u._in||this.options.ecmaVersion>=6&&this.isContextual("of")?s||"using"!==n&&"await using"!==n||!(this.options.ecmaVersion>=17)||this.type===u._in||this.isContextual("of")?s||"Identifier"===i.id.type||t&&(this.type===u._in||this.isContextual("of"))?i.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.raise(this.lastTokEnd,"Missing initializer in "+n+" declaration"):this.unexpected(),e.declarations.push(this.finishNode(i,"VariableDeclarator")),!this.eat(u.comma))break}return e},y.parseVarId=function(e,t){e.id="using"===t||"await using"===t?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,"var"===t?xt:se,!1)};var Ie=1,ut=2,Xt=4;function Qi(e,t){var n=t.key.name,s=e[n],i="true";return"MethodDefinition"===t.type&&("get"===t.kind||"set"===t.kind)&&(i=(t.static?"s":"i")+t.kind),"iget"===s&&"iset"===i||"iset"===s&&"iget"===i||"sget"===s&&"sset"===i||"sset"===s&&"sget"===i?(e[n]="true",!1):!!s||(e[n]=i,!1)}function $e(e,t){var n=e.computed,s=e.key;return!n&&("Identifier"===s.type&&s.name===t||"Literal"===s.type&&s.value===t)}y.parseFunction=function(e,t,n,s,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!s)&&(this.type===u.star&&t&ut&&this.unexpected(),e.generator=this.eat(u.star)),this.options.ecmaVersion>=8&&(e.async=!!s),t&Ie&&(e.id=t&Xt&&this.type!==u.name?null:this.parseIdent(),e.id&&!(t&ut)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?xt:se:zt));var r=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(vt(e.async,e.generator)),t&Ie||(e.id=this.type===u.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=r,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,t&Ie?"FunctionDeclaration":"FunctionExpression")},y.parseFunctionParams=function(e){this.expect(u.parenL),e.params=this.parseBindingList(u.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},y.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var s=this.enterClassBody(),i=this.startNode(),r=!1;for(i.body=[],this.expect(u.braceL);this.type!==u.braceR;){var a=this.parseClassElement(null!==e.superClass);a&&(i.body.push(a),"MethodDefinition"===a.type&&"constructor"===a.kind?(r&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),r=!0):a.key&&"PrivateIdentifier"===a.key.type&&Qi(s,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=n,this.next(),e.body=this.finishNode(i,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},y.parseClassElement=function(e){if(this.eat(u.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),s="",i=!1,r=!1,a="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(u.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===u.star?o=!0:s="static"}if(n.static=o,!s&&t>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==u.star||this.canInsertSemicolon()?s="async":r=!0),!s&&(t>=9||!r)&&this.eat(u.star)&&(i=!0),!s&&!r&&!i){var l=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=l:s=l)}if(s?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=s,this.finishNode(n.key,"Identifier")):this.parseClassElementName(n),t<13||this.type===u.parenL||"method"!==a||i||r){var c=!n.static&&$e(n,"constructor"),h=c&&e;c&&"method"!==a&&this.raise(n.key.start,"Constructor can't have get/set modifier"),n.kind=c?"constructor":a,this.parseClassMethod(n,i,r,h)}else this.parseClassField(n);return n},y.isClassElementNameStart=function(){return this.type===u.name||this.type===u.privateId||this.type===u.num||this.type===u.string||this.type===u.bracketL||this.type.keyword},y.parseClassElementName=function(e){this.type===u.privateId?("constructor"===this.value&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},y.parseClassMethod=function(e,t,n,s){var i=e.key;"constructor"===e.kind?(t&&this.raise(i.start,"Constructor can't be a generator"),n&&this.raise(i.start,"Constructor can't be an async method")):e.static&&$e(e,"prototype")&&this.raise(i.start,"Classes may not have a static property named prototype");var r=e.value=this.parseMethod(t,n,s);return"get"===e.kind&&0!==r.params.length&&this.raiseRecoverable(r.start,"getter should have no params"),"set"===e.kind&&1!==r.params.length&&this.raiseRecoverable(r.start,"setter should have exactly one param"),"set"===e.kind&&"RestElement"===r.params[0].type&&this.raiseRecoverable(r.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},y.parseClassField=function(e){return $e(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&$e(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(u.eq)?(this.enterScope(Ve|ze),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,"PropertyDefinition")},y.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(pe|ze);this.type!==u.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},y.parseClassId=function(e,t){this.type===u.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,se,!1)):(!0===t&&this.unexpected(),e.id=null)},y.parseClassSuper=function(e){e.superClass=this.eat(u._extends)?this.parseExprSubscripts(null,!1):null},y.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},y.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var s=this.privateNameStack.length,i=0===s?null:this.privateNameStack[s-1],r=0;r<n.length;++r){var a=n[r];Se(t,a.name)||(i?i.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}},y.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==u.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},y.parseExport=function(e,t){if(this.next(),this.eat(u.star))return this.parseExportAllDeclaration(e,t);if(this.eat(u._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),"VariableDeclaration"===e.declaration.type?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==u.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var n=0,s=e.specifiers;n<s.length;n+=1){var i=s[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),"Literal"===i.local.type&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")},y.parseExportDeclaration=function(e){return this.parseStatement(null)},y.parseExportDefaultDeclaration=function(){var e;if(this.type===u._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,Ie|Xt,!1,e)}if(this.type===u._class){var n=this.startNode();return this.parseClass(n,"nullableID")}var s=this.parseMaybeAssign();return this.semicolon(),s},y.checkExport=function(e,t,n){e&&("string"!=typeof t&&(t="Identifier"===t.type?t.name:t.value),Se(e,t)&&this.raiseRecoverable(n,"Duplicate export '"+t+"'"),e[t]=!0)},y.checkPatternExport=function(e,t){var n=t.type;if("Identifier"===n)this.checkExport(e,t,t.start);else if("ObjectPattern"===n)for(var s=0,i=t.properties;s<i.length;s+=1){var r=i[s];this.checkPatternExport(e,r)}else if("ArrayPattern"===n)for(var a=0,o=t.elements;a<o.length;a+=1){var l=o[a];l&&this.checkPatternExport(e,l)}else"Property"===n?this.checkPatternExport(e,t.value):"AssignmentPattern"===n?this.checkPatternExport(e,t.left):"RestElement"===n&&this.checkPatternExport(e,t.argument)},y.checkVariableExport=function(e,t){if(e)for(var n=0,s=t;n<s.length;n+=1){var i=s[n];this.checkPatternExport(e,i.id)}},y.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},y.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual("as")?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,"ExportSpecifier")},y.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(u.braceL);!this.eat(u.braceR);){if(n)n=!1;else if(this.expect(u.comma),this.afterTrailingComma(u.braceR))break;t.push(this.parseExportSpecifier(e))}return t},y.parseImport=function(e){return this.next(),this.type===u.string?(e.specifiers=Yi,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===u.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},y.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual("as")?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,se),this.finishNode(e,"ImportSpecifier")},y.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,se),this.finishNode(e,"ImportDefaultSpecifier")},y.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,se),this.finishNode(e,"ImportNamespaceSpecifier")},y.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===u.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(u.comma)))return e;if(this.type===u.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(u.braceL);!this.eat(u.braceR);){if(t)t=!1;else if(this.expect(u.comma),this.afterTrailingComma(u.braceR))break;e.push(this.parseImportSpecifier())}return e},y.parseWithClause=function(){var e=[];if(!this.eat(u._with))return e;this.expect(u.braceL);for(var t={},n=!0;!this.eat(u.braceR);){if(n)n=!1;else if(this.expect(u.comma),this.afterTrailingComma(u.braceR))break;var s=this.parseImportAttribute(),i="Identifier"===s.key.type?s.key.name:s.key.value;Se(t,i)&&this.raiseRecoverable(s.key.start,"Duplicate attribute key '"+i+"'"),t[i]=!0,e.push(s)}return e},y.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===u.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved),this.expect(u.colon),this.type!==u.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},y.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===u.string){var e=this.parseLiteral(this.value);return ji.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},y.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},y.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"string"==typeof e.expression.value&&('"'===this.input[e.start]||"'"===this.input[e.start])};var X=L.prototype;X.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&"await"===e.name&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",n&&this.checkPatternErrors(n,!0);for(var s=0,i=e.properties;s<i.length;s+=1){var r=i[s];this.toAssignable(r,t),"RestElement"===r.type&&("ArrayPattern"===r.argument.type||"ObjectPattern"===r.argument.type)&&this.raise(r.argument.start,"Unexpected token")}break;case"Property":"init"!==e.kind&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),"AssignmentPattern"===e.argument.type&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==e.operator&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,n);break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}else n&&this.checkPatternErrors(n,!0);return e},X.toAssignableList=function(e,t){for(var n=e.length,s=0;s<n;s++){var i=e[s];i&&this.toAssignable(i,t)}if(n){var r=e[n-1];6===this.options.ecmaVersion&&t&&r&&"RestElement"===r.type&&"Identifier"!==r.argument.type&&this.unexpected(r.argument.start)}return e},X.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},X.parseRestBinding=function(){var e=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==u.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},X.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case u.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(u.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case u.braceL:return this.parseObj(!0)}return this.parseIdent()},X.parseBindingList=function(e,t,n,s){for(var i=[],r=!0;!this.eat(e);)if(r?r=!1:this.expect(u.comma),t&&this.type===u.comma)i.push(null);else{if(n&&this.afterTrailingComma(e))break;if(this.type===u.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),i.push(a),this.type===u.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}i.push(this.parseAssignableListItem(s))}return i},X.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},X.parseBindingListItem=function(e){return e},X.parseMaybeDefault=function(e,t,n){if(n=n||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(u.eq))return n;var s=this.startNodeAt(e,t);return s.left=n,s.right=this.parseMaybeAssign(),this.finishNode(s,"AssignmentPattern")},X.checkLValSimple=function(e,t,n){void 0===t&&(t=Fe);var s=t!==Fe;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(s?"Binding ":"Assigning to ")+e.name+" in strict mode"),s&&(t===se&&"let"===e.name&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),n&&(Se(n,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),n[e.name]=!0),t!==Gt&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":s&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return s&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(s?"Binding":"Assigning to")+" rvalue")}},X.checkLValPattern=function(e,t,n){switch(void 0===t&&(t=Fe),e.type){case"ObjectPattern":for(var s=0,i=e.properties;s<i.length;s+=1){var r=i[s];this.checkLValInnerPattern(r,t,n)}break;case"ArrayPattern":for(var a=0,o=e.elements;a<o.length;a+=1){var l=o[a];l&&this.checkLValInnerPattern(l,t,n)}break;default:this.checkLValSimple(e,t,n)}},X.checkLValInnerPattern=function(e,t,n){switch(void 0===t&&(t=Fe),e.type){case"Property":this.checkLValInnerPattern(e.value,t,n);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,n);break;case"RestElement":this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}};var Y=function(e,t,n,s,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=s,this.generator=!!i},I={b_stat:new Y("{",!1),b_expr:new Y("{",!0),b_tmpl:new Y("${",!1),p_stat:new Y("(",!1),p_expr:new Y("(",!0),q_tmpl:new Y("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new Y("function",!1),f_expr:new Y("function",!0),f_expr_gen:new Y("function",!0,!1,null,!0),f_gen:new Y("function",!1,!1,null,!0)},we=L.prototype;we.initialContext=function(){return[I.b_stat]},we.curContext=function(){return this.context[this.context.length-1]},we.braceIsBlock=function(e){var t=this.curContext();return t===I.f_expr||t===I.f_stat||(e!==u.colon||t!==I.b_stat&&t!==I.b_expr?e===u._return||e===u.name&&this.exprAllowed?q.test(this.input.slice(this.lastTokEnd,this.start)):e===u._else||e===u.semi||e===u.eof||e===u.parenR||e===u.arrow||(e===u.braceL?t===I.b_stat:e!==u._var&&e!==u._const&&e!==u.name&&!this.exprAllowed):!t.isExpr)},we.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if("function"===t.token)return t.generator}return!1},we.updateContext=function(e){var t,n=this.type;n.keyword&&e===u.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},we.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},u.parenR.updateContext=u.braceR.updateContext=function(){if(1!==this.context.length){var e=this.context.pop();e===I.b_stat&&"function"===this.curContext().token&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}else this.exprAllowed=!0},u.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?I.b_stat:I.b_expr),this.exprAllowed=!0},u.dollarBraceL.updateContext=function(){this.context.push(I.b_tmpl),this.exprAllowed=!0},u.parenL.updateContext=function(e){var t=e===u._if||e===u._for||e===u._with||e===u._while;this.context.push(t?I.p_stat:I.p_expr),this.exprAllowed=!0},u.incDec.updateContext=function(){},u._function.updateContext=u._class.updateContext=function(e){!e.beforeExpr||e===u._else||e===u.semi&&this.curContext()!==I.p_stat||e===u._return&&q.test(this.input.slice(this.lastTokEnd,this.start))||(e===u.colon||e===u.braceL)&&this.curContext()===I.b_stat?this.context.push(I.f_stat):this.context.push(I.f_expr),this.exprAllowed=!1},u.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},u.backQuote.updateContext=function(){this.curContext()===I.q_tmpl?this.context.pop():this.context.push(I.q_tmpl),this.exprAllowed=!1},u.star.updateContext=function(e){if(e===u._function){var t=this.context.length-1;this.context[t]===I.f_expr?this.context[t]=I.f_expr_gen:this.context[t]=I.f_gen}this.exprAllowed=!0},u.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==u.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var S=L.prototype;function Yt(e){return"Identifier"===e.type||"ParenthesizedExpression"===e.type&&Yt(e.expression)}function ct(e){return"MemberExpression"===e.type&&"PrivateIdentifier"===e.property.type||"ChainExpression"===e.type&&ct(e.expression)||"ParenthesizedExpression"===e.type&&ct(e.expression)}S.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===e.type||this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var s,i=e.key;switch(i.type){case"Identifier":s=i.name;break;case"Literal":s=String(i.value);break;default:return}var r=e.kind;if(this.options.ecmaVersion>=6)return void("__proto__"===s&&"init"===r&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=i.start):this.raiseRecoverable(i.start,"Redefinition of __proto__ property")),t.proto=!0));var a=t[s="$"+s];if(a)("init"===r?this.strict&&a.init||a.get||a.set:a.init||a[r])&&this.raiseRecoverable(i.start,"Redefinition of property");else a=t[s]={init:!1,get:!1,set:!1};a[r]=!0}},S.parseExpression=function(e,t){var n=this.start,s=this.startLoc,i=this.parseMaybeAssign(e,t);if(this.type===u.comma){var r=this.startNodeAt(n,s);for(r.expressions=[i];this.eat(u.comma);)r.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(r,"SequenceExpression")}return i},S.parseMaybeAssign=function(e,t,n){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var s=!1,i=-1,r=-1,a=-1;t?(i=t.parenthesizedAssign,r=t.trailingComma,a=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new Ge,s=!0);var o=this.start,l=this.startLoc;(this.type===u.parenL||this.type===u.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===e);var c=this.parseMaybeConditional(e,t);if(n&&(c=n.call(this,c,o,l)),this.type.isAssign){var h=this.startNodeAt(o,l);return h.operator=this.value,this.type===u.eq&&(c=this.toAssignable(c,!1,t)),s||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=c.start&&(t.shorthandAssign=-1),this.type===u.eq?this.checkLValPattern(c):this.checkLValSimple(c),h.left=c,this.next(),h.right=this.parseMaybeAssign(e),a>-1&&(t.doubleProto=a),this.finishNode(h,"AssignmentExpression")}return s&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),r>-1&&(t.trailingComma=r),c},S.parseMaybeConditional=function(e,t){var n=this.start,s=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(this.eat(u.question)){var r=this.startNodeAt(n,s);return r.test=i,r.consequent=this.parseMaybeAssign(),this.expect(u.colon),r.alternate=this.parseMaybeAssign(e),this.finishNode(r,"ConditionalExpression")}return i},S.parseExprOps=function(e,t){var n=this.start,s=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&"ArrowFunctionExpression"===i.type?i:this.parseExprOp(i,n,s,-1,e)},S.parseExprOp=function(e,t,n,s,i){var r=this.type.binop;if(null!=r&&(!i||this.type!==u._in)&&r>s){var a=this.type===u.logicalOR||this.type===u.logicalAND,o=this.type===u.coalesce;o&&(r=u.logicalAND.binop);var l=this.value;this.next();var c=this.start,h=this.startLoc,p=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),c,h,r,i),d=this.buildBinary(t,n,e,p,l,a||o);return(a&&this.type===u.coalesce||o&&(this.type===u.logicalOR||this.type===u.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(d,t,n,s,i)}return e},S.buildBinary=function(e,t,n,s,i,r){"PrivateIdentifier"===s.type&&this.raise(s.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(e,t);return a.left=n,a.operator=i,a.right=s,this.finishNode(a,r?"LogicalExpression":"BinaryExpression")},S.parseMaybeUnary=function(e,t,n,s){var i,r=this.start,a=this.startLoc;if(this.isContextual("await")&&this.canAwait)i=this.parseAwait(s),t=!0;else if(this.type.prefix){var o=this.startNode(),l=this.type===u.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,l,s),this.checkExpressionErrors(e,!0),l?this.checkLValSimple(o.argument):this.strict&&"delete"===o.operator&&Yt(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):"delete"===o.operator&&ct(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,i=this.finishNode(o,l?"UpdateExpression":"UnaryExpression")}else if(t||this.type!==u.privateId){if(i=this.parseExprSubscripts(e,s),this.checkExpressionErrors(e))return i;for(;this.type.postfix&&!this.canInsertSemicolon();){var c=this.startNodeAt(r,a);c.operator=this.value,c.prefix=!1,c.argument=i,this.checkLValSimple(i),this.next(),i=this.finishNode(c,"UpdateExpression")}}else(s||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),i=this.parsePrivateIdent(),this.type!==u._in&&this.unexpected();return n||!this.eat(u.starstar)?i:t?void this.unexpected(this.lastTokStart):this.buildBinary(r,a,i,this.parseMaybeUnary(null,!1,!1,s),"**",!1)},S.parseExprSubscripts=function(e,t){var n=this.start,s=this.startLoc,i=this.parseExprAtom(e,t);if("ArrowFunctionExpression"===i.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return i;var r=this.parseSubscripts(i,n,s,!1,t);return e&&"MemberExpression"===r.type&&(e.parenthesizedAssign>=r.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=r.start&&(e.parenthesizedBind=-1),e.trailingComma>=r.start&&(e.trailingComma=-1)),r},S.parseSubscripts=function(e,t,n,s,i){for(var r=this.options.ecmaVersion>=8&&"Identifier"===e.type&&"async"===e.name&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,a=!1;;){var o=this.parseSubscript(e,t,n,s,r,a,i);if(o.optional&&(a=!0),o===e||"ArrowFunctionExpression"===o.type){if(a){var l=this.startNodeAt(t,n);l.expression=o,o=this.finishNode(l,"ChainExpression")}return o}e=o}},S.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(u.arrow)},S.parseSubscriptAsyncArrow=function(e,t,n,s){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,s)},S.parseSubscript=function(e,t,n,s,i,r,a){var o=this.options.ecmaVersion>=11,l=o&&this.eat(u.questionDot);s&&l&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var c=this.eat(u.bracketL);if(c||l&&this.type!==u.parenL&&this.type!==u.backQuote||this.eat(u.dot)){var h=this.startNodeAt(t,n);h.object=e,c?(h.property=this.parseExpression(),this.expect(u.bracketR)):this.type===u.privateId&&"Super"!==e.type?h.property=this.parsePrivateIdent():h.property=this.parseIdent("never"!==this.options.allowReserved),h.computed=!!c,o&&(h.optional=l),e=this.finishNode(h,"MemberExpression")}else if(!s&&this.eat(u.parenL)){var p=new Ge,d=this.yieldPos,f=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var g=this.parseExprList(u.parenR,this.options.ecmaVersion>=8,!1,p);if(i&&!l&&this.shouldParseAsyncArrow())return this.checkPatternErrors(p,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=d,this.awaitPos=f,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(t,n,g,a);this.checkExpressionErrors(p,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=f||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var v=this.startNodeAt(t,n);v.callee=e,v.arguments=g,o&&(v.optional=l),e=this.finishNode(v,"CallExpression")}else if(this.type===u.backQuote){(l||r)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var y=this.startNodeAt(t,n);y.tag=e,y.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(y,"TaggedTemplateExpression")}return e},S.parseExprAtom=function(e,t,n){this.type===u.slash&&this.readRegexp();var s,i=this.potentialArrowAt===this.start;switch(this.type){case u._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),s=this.startNode(),this.next(),this.type===u.parenL&&!this.allowDirectSuper&&this.raise(s.start,"super() call outside constructor of a subclass"),this.type!==u.dot&&this.type!==u.bracketL&&this.type!==u.parenL&&this.unexpected(),this.finishNode(s,"Super");case u._this:return s=this.startNode(),this.next(),this.finishNode(s,"ThisExpression");case u.name:var r=this.start,a=this.startLoc,o=this.containsEsc,l=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&"async"===l.name&&!this.canInsertSemicolon()&&this.eat(u._function))return this.overrideContext(I.f_expr),this.parseFunction(this.startNodeAt(r,a),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(u.arrow))return this.parseArrowExpression(this.startNodeAt(r,a),[l],!1,t);if(this.options.ecmaVersion>=8&&"async"===l.name&&this.type===u.name&&!o&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return l=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(u.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(r,a),[l],!0,t)}return l;case u.regexp:var c=this.value;return(s=this.parseLiteral(c.value)).regex={pattern:c.pattern,flags:c.flags},s;case u.num:case u.string:return this.parseLiteral(this.value);case u._null:case u._true:case u._false:return(s=this.startNode()).value=this.type===u._null?null:this.type===u._true,s.raw=this.type.keyword,this.next(),this.finishNode(s,"Literal");case u.parenL:var h=this.start,p=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(p)&&(e.parenthesizedAssign=h),e.parenthesizedBind<0&&(e.parenthesizedBind=h)),p;case u.bracketL:return s=this.startNode(),this.next(),s.elements=this.parseExprList(u.bracketR,!0,!0,e),this.finishNode(s,"ArrayExpression");case u.braceL:return this.overrideContext(I.b_expr),this.parseObj(!1,e);case u._function:return s=this.startNode(),this.next(),this.parseFunction(s,0);case u._class:return this.parseClass(this.startNode(),!1);case u._new:return this.parseNew();case u.backQuote:return this.parseTemplate();case u._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},S.parseExprAtomDefault=function(){this.unexpected()},S.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===u.parenL&&!e)return this.parseDynamicImport(t);if(this.type===u.dot){var n=this.startNodeAt(t.start,t.loc&&t.loc.start);return n.name="import",t.meta=this.finishNode(n,"Identifier"),this.parseImportMeta(t)}this.unexpected()},S.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(u.parenR)?e.options=null:(this.expect(u.comma),this.afterTrailingComma(u.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(u.parenR)||(this.expect(u.comma),this.afterTrailingComma(u.parenR)||this.unexpected())));else if(!this.eat(u.parenR)){var t=this.start;this.eat(u.comma)&&this.eat(u.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},S.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),"meta"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),"module"!==this.options.sourceType&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")},S.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),110===t.raw.charCodeAt(t.raw.length-1)&&(t.bigint=null!=t.value?t.value.toString():t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")},S.parseParenExpression=function(){this.expect(u.parenL);var e=this.parseExpression();return this.expect(u.parenR),e},S.shouldParseArrow=function(e){return!this.canInsertSemicolon()},S.parseParenAndDistinguishExpression=function(e,t){var n,s=this.start,i=this.startLoc,r=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a,o=this.start,l=this.startLoc,c=[],h=!0,p=!1,d=new Ge,f=this.yieldPos,m=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==u.parenR;){if(h?h=!1:this.expect(u.comma),r&&this.afterTrailingComma(u.parenR,!0)){p=!0;break}if(this.type===u.ellipsis){a=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===u.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}c.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var g=this.lastTokEnd,v=this.lastTokEndLoc;if(this.expect(u.parenR),e&&this.shouldParseArrow(c)&&this.eat(u.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=m,this.parseParenArrowList(s,i,c,t);(!c.length||p)&&this.unexpected(this.lastTokStart),a&&this.unexpected(a),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=m||this.awaitPos,c.length>1?((n=this.startNodeAt(o,l)).expressions=c,this.finishNodeAt(n,"SequenceExpression",g,v)):n=c[0]}else n=this.parseParenExpression();if(this.options.preserveParens){var y=this.startNodeAt(s,i);return y.expression=n,this.finishNode(y,"ParenthesizedExpression")}return n},S.parseParenItem=function(e){return e},S.parseParenArrowList=function(e,t,n,s){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,s)};var Zi=[];S.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===u.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var n=this.containsEsc;return e.property=this.parseIdent(!0),"target"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),n&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var s=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),s,i,!0,!1),this.eat(u.parenL)?e.arguments=this.parseExprList(u.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Zi,this.finishNode(e,"NewExpression")},S.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===u.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),n.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),n.tail=this.type===u.backQuote,this.finishNode(n,"TemplateElement")},S.parseTemplate=function(e){void 0===e&&(e={});var t=e.isTagged;void 0===t&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var s=this.parseTemplateElement({isTagged:t});for(n.quasis=[s];!s.tail;)this.type===u.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(u.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(u.braceR),n.quasis.push(s=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,"TemplateLiteral")},S.isAsyncProp=function(e){return!e.computed&&"Identifier"===e.key.type&&"async"===e.key.name&&(this.type===u.name||this.type===u.num||this.type===u.string||this.type===u.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===u.star)&&!q.test(this.input.slice(this.lastTokEnd,this.start))},S.parseObj=function(e,t){var n=this.startNode(),s=!0,i={};for(n.properties=[],this.next();!this.eat(u.braceR);){if(s)s=!1;else if(this.expect(u.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(u.braceR))break;var r=this.parseProperty(e,t);e||this.checkPropClash(r,i,t),n.properties.push(r)}return this.finishNode(n,e?"ObjectPattern":"ObjectExpression")},S.parseProperty=function(e,t){var n,s,i,r,a=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(u.ellipsis))return e?(a.argument=this.parseIdent(!1),this.type===u.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(a,"RestElement")):(a.argument=this.parseMaybeAssign(!1,t),this.type===u.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(a,"SpreadElement"));this.options.ecmaVersion>=6&&(a.method=!1,a.shorthand=!1,(e||t)&&(i=this.start,r=this.startLoc),e||(n=this.eat(u.star)));var o=this.containsEsc;return this.parsePropertyName(a),!e&&!o&&this.options.ecmaVersion>=8&&!n&&this.isAsyncProp(a)?(s=!0,n=this.options.ecmaVersion>=9&&this.eat(u.star),this.parsePropertyName(a)):s=!1,this.parsePropertyValue(a,e,n,s,i,r,t,o),this.finishNode(a,"Property")},S.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var n="get"===e.kind?0:1;if(e.value.params.length!==n){var s=e.value.start;"get"===e.kind?this.raiseRecoverable(s,"getter should have no params"):this.raiseRecoverable(s,"setter should have exactly one param")}else"set"===e.kind&&"RestElement"===e.value.params[0].type&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")},S.parsePropertyValue=function(e,t,n,s,i,r,a,o){(n||s)&&this.type===u.colon&&this.unexpected(),this.eat(u.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),e.kind="init"):this.options.ecmaVersion>=6&&this.type===u.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(n,s),e.kind="init"):t||o||!(this.options.ecmaVersion>=5)||e.computed||"Identifier"!==e.key.type||"get"!==e.key.name&&"set"!==e.key.name||this.type===u.comma||this.type===u.braceR||this.type===u.eq?this.options.ecmaVersion>=6&&!e.computed&&"Identifier"===e.key.type?((n||s)&&this.unexpected(),this.checkUnreserved(e.key),"await"===e.key.name&&!this.awaitIdentPos&&(this.awaitIdentPos=i),t?e.value=this.parseMaybeDefault(i,r,this.copyNode(e.key)):this.type===u.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,r,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind="init",e.shorthand=!0):this.unexpected():((n||s)&&this.unexpected(),this.parseGetterSetter(e))},S.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(u.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(u.bracketR),e.key;e.computed=!1}return e.key=this.type===u.num||this.type===u.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},S.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},S.parseMethod=function(e,t,n){var s=this.startNode(),i=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(s),this.options.ecmaVersion>=6&&(s.generator=e),this.options.ecmaVersion>=8&&(s.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(vt(t,s.generator)|ze|(n?jt:0)),this.expect(u.parenL),s.params=this.parseBindingList(u.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(s,!1,!0,!1),this.yieldPos=i,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(s,"FunctionExpression")},S.parseArrowExpression=function(e,t,n,s){var i=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(vt(n,!1)|gt),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,s),this.yieldPos=i,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(e,"ArrowFunctionExpression")},S.parseFunctionBody=function(e,t,n,s){var i=t&&this.type!==u.braceL,r=this.strict,a=!1;if(i)e.body=this.parseMaybeAssign(s),e.expression=!0,this.checkParams(e,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!r||o)&&((a=this.strictDirective(this.end))&&o&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var l=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(e,!r&&!a&&!t&&!n&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,Gt),e.body=this.parseBlock(!1,void 0,a&&!r),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=l}this.exitScope()},S.isSimpleParamList=function(e){for(var t=0,n=e;t<n.length;t+=1){if("Identifier"!==n[t].type)return!1}return!0},S.checkParams=function(e,t){for(var n=Object.create(null),s=0,i=e.params;s<i.length;s+=1){var r=i[s];this.checkLValInnerPattern(r,xt,t?null:n)}},S.parseExprList=function(e,t,n,s){for(var i=[],r=!0;!this.eat(e);){if(r)r=!1;else if(this.expect(u.comma),t&&this.afterTrailingComma(e))break;var a=void 0;n&&this.type===u.comma?a=null:this.type===u.ellipsis?(a=this.parseSpread(s),s&&this.type===u.comma&&s.trailingComma<0&&(s.trailingComma=this.start)):a=this.parseMaybeAssign(!1,s),i.push(a)}return i},S.checkUnreserved=function(e){var t=e.start,n=e.end,s=e.name;(this.inGenerator&&"yield"===s&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===s&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&Ke)&&"arguments"===s&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&("arguments"===s||"await"===s)&&this.raise(t,"Cannot use "+s+" in class static initialization block"),this.keywords.test(s)&&this.raise(t,"Unexpected keyword '"+s+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(t,n).indexOf("\\"))||(this.strict?this.reservedWordsStrict:this.reservedWords).test(s)&&(!this.inAsync&&"await"===s&&this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+s+"' is reserved"))},S.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),"await"===t.name&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t},S.parseIdentNode=function(){var e=this.startNode();return this.type===u.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,("class"===e.name||"function"===e.name)&&(this.lastTokEnd!==this.lastTokStart+1||46!==this.input.charCodeAt(this.lastTokStart))&&this.context.pop(),this.type=u.name):this.unexpected(),e},S.parsePrivateIdent=function(){var e=this.startNode();return this.type===u.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.options.checkPrivateFields&&(0===this.privateNameStack.length?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},S.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===u.semi||this.canInsertSemicolon()||this.type!==u.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(u.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},S.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var Ue=L.prototype;Ue.raise=function(e,t){var n=Ut(this.input,e);t+=" ("+n.line+":"+n.column+")",this.sourceFile&&(t+=" in "+this.sourceFile);var s=new SyntaxError(t);throw s.pos=e,s.loc=n,s.raisedAt=this.pos,s},Ue.raiseRecoverable=Ue.raise,Ue.curPosition=function(){if(this.options.locations)return new Ne(this.curLine,this.pos-this.lineStart)};var ue=L.prototype,Ji=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};ue.enterScope=function(e){this.scopeStack.push(new Ji(e))},ue.exitScope=function(){this.scopeStack.pop()},ue.treatFunctionsAsVarInScope=function(e){return e.flags&Ee||!this.inModule&&e.flags&Le},ue.declareName=function(e,t,n){var s=!1;if(t===se){var i=this.currentScope();s=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&Le&&delete this.undefinedExports[e]}else if(t===Kt){this.currentScope().lexical.push(e)}else if(t===zt){var r=this.currentScope();s=this.treatFunctionsAsVar?r.lexical.indexOf(e)>-1:r.lexical.indexOf(e)>-1||r.var.indexOf(e)>-1,r.functions.push(e)}else for(var a=this.scopeStack.length-1;a>=0;--a){var o=this.scopeStack[a];if(o.lexical.indexOf(e)>-1&&!(o.flags&Wt&&o.lexical[0]===e)||!this.treatFunctionsAsVarInScope(o)&&o.functions.indexOf(e)>-1){s=!0;break}if(o.var.push(e),this.inModule&&o.flags&Le&&delete this.undefinedExports[e],o.flags&Ke)break}s&&this.raiseRecoverable(n,"Identifier '"+e+"' has already been declared")},ue.checkLocalExport=function(e){-1===this.scopeStack[0].lexical.indexOf(e.name)&&-1===this.scopeStack[0].var.indexOf(e.name)&&(this.undefinedExports[e.name]=e)},ue.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},ue.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Ke|Ve|pe))return t}},ue.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Ke|Ve|pe)&&!(t.flags>))return t}};var Xe=function(e,t,n){this.type="",this.start=t,this.end=0,e.options.locations&&(this.loc=new je(e,n)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},Me=L.prototype;function Qt(e,t,n,s){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=s),this.options.ranges&&(e.range[1]=n),e}Me.startNode=function(){return new Xe(this,this.start,this.startLoc)},Me.startNodeAt=function(e,t){return new Xe(this,e,t)},Me.finishNode=function(e,t){return Qt.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},Me.finishNodeAt=function(e,t,n,s){return Qt.call(this,e,t,n,s)},Me.copyNode=function(e){var t=new Xe(this,e.start,this.startLoc);for(var n in e)t[n]=e[n];return t};var er="Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz",Zt="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Jt=Zt+" Extended_Pictographic",ei=Jt,ti=Jt+" EBase EComp EMod EPres ExtPict",ii=ti,tr=ti,ir={9:Zt,10:Jt,11:Jt,12:ti,13:ti,14:tr},rr="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",sr={9:"",10:"",11:"",12:"",13:"",14:rr},kt="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",ri="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",si=ri+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",ni=si+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",ai=ni+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",oi=ai+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",nr=oi+" "+er,ar={9:ri,10:si,11:ni,12:ai,13:oi,14:nr},ui={};function or(e){var t=ui[e]={binary:ae(ir[e]+" "+kt),binaryOfStrings:ae(sr[e]),nonBinary:{General_Category:ae(kt),Script:ae(ar[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var tt=0,At=[9,10,11,12,13,14];tt<At.length;tt+=1){var ur=At[tt];or(ur)}var x=L.prototype,qe=function(e,t){this.parent=e,this.base=t||this};qe.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var n=e;n;n=n.parent)if(t.base===n.base&&t!==n)return!0;return!1},qe.prototype.sibling=function(){return new qe(this.parent,this.base)};var te=function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=ui[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};function cr(e){for(var t in e)return!0;return!1}function lr(e){return 105===e||109===e||115===e}function ci(e){return 36===e||e>=40&&e<=43||46===e||63===e||e>=91&&e<=94||e>=123&&e<=125}function hr(e){return J(e,!0)||36===e||95===e}function pr(e){return oe(e,!0)||36===e||95===e||8204===e||8205===e}function li(e){return e>=65&&e<=90||e>=97&&e<=122}function fr(e){return e>=0&&e<=1114111}te.prototype.reset=function(e,t,n){var s=-1!==n.indexOf("v"),i=-1!==n.indexOf("u");this.start=0|e,this.source=t+"",this.flags=n,s&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=i&&this.parser.options.ecmaVersion>=9)},te.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)},te.prototype.at=function(e,t){void 0===t&&(t=!1);var n=this.source,s=n.length;if(e>=s)return-1;var i=n.charCodeAt(e);if(!t&&!this.switchU||i<=55295||i>=57344||e+1>=s)return i;var r=n.charCodeAt(e+1);return r>=56320&&r<=57343?(i<<10)+r-56613888:i},te.prototype.nextIndex=function(e,t){void 0===t&&(t=!1);var n=this.source,s=n.length;if(e>=s)return s;var i,r=n.charCodeAt(e);return!t&&!this.switchU||r<=55295||r>=57344||e+1>=s||(i=n.charCodeAt(e+1))<56320||i>57343?e+1:e+2},te.prototype.current=function(e){return void 0===e&&(e=!1),this.at(this.pos,e)},te.prototype.lookahead=function(e){return void 0===e&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},te.prototype.advance=function(e){void 0===e&&(e=!1),this.pos=this.nextIndex(this.pos,e)},te.prototype.eat=function(e,t){return void 0===t&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},te.prototype.eatChars=function(e,t){void 0===t&&(t=!1);for(var n=this.pos,s=0,i=e;s<i.length;s+=1){var r=i[s],a=this.at(n,t);if(-1===a||a!==r)return!1;n=this.nextIndex(n,t)}return this.pos=n,!0},x.validateRegExpFlags=function(e){for(var t=e.validFlags,n=e.flags,s=!1,i=!1,r=0;r<n.length;r++){var a=n.charAt(r);-1===t.indexOf(a)&&this.raise(e.start,"Invalid regular expression flag"),n.indexOf(a,r+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),"u"===a&&(s=!0),"v"===a&&(i=!0)}this.options.ecmaVersion>=15&&s&&i&&this.raise(e.start,"Invalid regular expression flag")},x.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&cr(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},x.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,n=e.backReferenceNames;t<n.length;t+=1){var s=n[t];e.groupNames[s]||e.raise("Invalid named capture referenced")}},x.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new qe(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")},x.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},x.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise("Invalid quantifier"),!0):!!(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))&&(this.regexp_eatQuantifier(e),!0)},x.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!n,!0}return e.pos=t,!1},x.regexp_eatQuantifier=function(e,t){return void 0===t&&(t=!1),!!this.regexp_eatQuantifierPrefix(e,t)&&(e.eat(63),!0)},x.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},x.regexp_eatBracedQuantifier=function(e,t){var n=e.pos;if(e.eat(123)){var s=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(s=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return-1!==i&&i<s&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=n}return!1},x.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},x.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},x.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(e),s=e.eat(45);if(n||s){for(var i=0;i<n.length;i++){var r=n.charAt(i);n.indexOf(r,i+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(s){var a=this.regexp_eatModifiers(e);!n&&!a&&58===e.current()&&e.raise("Invalid regular expression modifiers");for(var o=0;o<a.length;o++){var l=a.charAt(o);(a.indexOf(l,o+1)>-1||n.indexOf(l)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise("Unterminated group")}}e.pos=t}return!1},x.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):63===e.current()&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1},x.regexp_eatModifiers=function(e){for(var t="",n=0;-1!==(n=e.current())&&lr(n);)t+=ie(n),e.advance();return t},x.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},x.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1},x.regexp_eatSyntaxCharacter=function(e){var t=e.current();return!!ci(t)&&(e.lastIntValue=t,e.advance(),!0)},x.regexp_eatPatternCharacters=function(e){for(var t=e.pos,n=0;-1!==(n=e.current())&&!ci(n);)e.advance();return e.pos!==t},x.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return!(-1===t||36===t||t>=40&&t<=43||46===t||63===t||91===t||94===t||124===t)&&(e.advance(),!0)},x.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,n=e.groupNames[e.lastStringValue];if(n)if(t)for(var s=0,i=n;s<i.length;s+=1){i[s].separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(n||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},x.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1},x.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=ie(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=ie(e.lastIntValue);return!0}return!1},x.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,s=e.current(n);return e.advance(n),92===s&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(s=e.lastIntValue),hr(s)?(e.lastIntValue=s,!0):(e.pos=t,!1)},x.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,s=e.current(n);return e.advance(n),92===s&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(s=e.lastIntValue),pr(s)?(e.lastIntValue=s,!0):(e.pos=t,!1)},x.regexp_eatAtomEscape=function(e){return!!(this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e))||(e.switchU&&(99===e.current()&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)},x.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var n=e.lastIntValue;if(e.switchU)return n>e.maxBackReference&&(e.maxBackReference=n),!0;if(n<=e.numCapturingParens)return!0;e.pos=t}return!1},x.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1},x.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},x.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},x.regexp_eatZero=function(e){return 48===e.current()&&!Ye(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},x.regexp_eatControlEscape=function(e){var t=e.current();return 116===t?(e.lastIntValue=9,e.advance(),!0):110===t?(e.lastIntValue=10,e.advance(),!0):118===t?(e.lastIntValue=11,e.advance(),!0):102===t?(e.lastIntValue=12,e.advance(),!0):114===t&&(e.lastIntValue=13,e.advance(),!0)},x.regexp_eatControlLetter=function(e){var t=e.current();return!!li(t)&&(e.lastIntValue=t%32,e.advance(),!0)},x.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){void 0===t&&(t=!1);var n=e.pos,s=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(s&&i>=55296&&i<=56319){var r=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var a=e.lastIntValue;if(a>=56320&&a<=57343)return e.lastIntValue=1024*(i-55296)+(a-56320)+65536,!0}e.pos=r,e.lastIntValue=i}return!0}if(s&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&fr(e.lastIntValue))return!0;s&&e.raise("Invalid unicode escape"),e.pos=n}return!1},x.regexp_eatIdentityEscape=function(e){if(e.switchU)return!!this.regexp_eatSyntaxCharacter(e)||!!e.eat(47)&&(e.lastIntValue=47,!0);var t=e.current();return!(99===t||e.switchN&&107===t)&&(e.lastIntValue=t,e.advance(),!0)},x.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do{e.lastIntValue=10*e.lastIntValue+(t-48),e.advance()}while((t=e.current())>=48&&t<=57);return!0}return!1};var hi=0,re=1,G=2;function dr(e){return 100===e||68===e||115===e||83===e||119===e||87===e}function pi(e){return li(e)||95===e}function mr(e){return pi(e)||Ye(e)}function gr(e){return 33===e||e>=35&&e<=38||e>=42&&e<=44||46===e||e>=58&&e<=64||94===e||96===e||126===e}function vr(e){return 40===e||41===e||45===e||47===e||e>=91&&e<=93||e>=123&&e<=125}function xr(e){return 33===e||35===e||37===e||38===e||44===e||45===e||e>=58&&e<=62||64===e||96===e||126===e}function Ye(e){return e>=48&&e<=57}function fi(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function di(e){return e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:e-48}function mi(e){return e>=48&&e<=55}x.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(dr(t))return e.lastIntValue=-1,e.advance(),re;var n=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((n=80===t)||112===t)){var s;if(e.lastIntValue=-1,e.advance(),e.eat(123)&&(s=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return n&&s===G&&e.raise("Invalid property name"),s;e.raise("Invalid property name")}return hi},x.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var n=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var s=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,n,s),re}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return hi},x.regexp_validateUnicodePropertyNameAndValue=function(e,t,n){Se(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(n)||e.raise("Invalid property value")},x.regexp_validateUnicodePropertyNameOrValue=function(e,t){return e.unicodeProperties.binary.test(t)?re:e.switchV&&e.unicodeProperties.binaryOfStrings.test(t)?G:void e.raise("Invalid property name")},x.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";pi(t=e.current());)e.lastStringValue+=ie(t),e.advance();return""!==e.lastStringValue},x.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";mr(t=e.current());)e.lastStringValue+=ie(t),e.advance();return""!==e.lastStringValue},x.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},x.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),n=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&n===G&&e.raise("Negated character class may contain strings"),!0}return!1},x.regexp_classContents=function(e){return 93===e.current()?re:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),re)},x.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var n=e.lastIntValue;e.switchU&&(-1===t||-1===n)&&e.raise("Invalid character class"),-1!==t&&-1!==n&&t>n&&e.raise("Range out of order in character class")}}},x.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var n=e.current();(99===n||mi(n))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var s=e.current();return 93!==s&&(e.lastIntValue=s,e.advance(),!0)},x.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},x.regexp_classSetExpression=function(e){var t,n=re;if(!this.regexp_eatClassSetRange(e))if(t=this.regexp_eatClassSetOperand(e)){t===G&&(n=G);for(var s=e.pos;e.eatChars([38,38]);)38!==e.current()&&(t=this.regexp_eatClassSetOperand(e))?t!==G&&(n=re):e.raise("Invalid character in character class");if(s!==e.pos)return n;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(s!==e.pos)return n}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(!(t=this.regexp_eatClassSetOperand(e)))return n;t===G&&(n=G)}},x.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var s=e.lastIntValue;return-1!==n&&-1!==s&&n>s&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1},x.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?re:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},x.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var n=e.eat(94),s=this.regexp_classContents(e);if(e.eat(93))return n&&s===G&&e.raise("Negated character class may contain strings"),s;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null},x.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var n=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return n}else e.raise("Invalid escape");e.pos=t}return null},x.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===G&&(t=G);return t},x.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return 1===t?re:G},x.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return!(!this.regexp_eatCharacterEscape(e)&&!this.regexp_eatClassSetReservedPunctuator(e))||(e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1));var n=e.current();return!(n<0||n===e.lookahead()&&gr(n)||vr(n))&&(e.advance(),e.lastIntValue=n,!0)},x.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return!!xr(t)&&(e.lastIntValue=t,e.advance(),!0)},x.regexp_eatClassControlLetter=function(e){var t=e.current();return!(!Ye(t)&&95!==t)&&(e.lastIntValue=t%32,e.advance(),!0)},x.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1},x.regexp_eatDecimalDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;Ye(n=e.current());)e.lastIntValue=10*e.lastIntValue+(n-48),e.advance();return e.pos!==t},x.regexp_eatHexDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;fi(n=e.current());)e.lastIntValue=16*e.lastIntValue+di(n),e.advance();return e.pos!==t},x.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var n=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=64*t+8*n+e.lastIntValue:e.lastIntValue=8*t+n}else e.lastIntValue=t;return!0}return!1},x.regexp_eatOctalDigit=function(e){var t=e.current();return mi(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)},x.regexp_eatFixedHexDigits=function(e,t){var n=e.pos;e.lastIntValue=0;for(var s=0;s<t;++s){var i=e.current();if(!fi(i))return e.pos=n,!1;e.lastIntValue=16*e.lastIntValue+di(i),e.advance()}return!0};var bt=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new je(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},k=L.prototype;function yr(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function gi(e){return"function"!=typeof BigInt?null:BigInt(e.replace(/_/g,""))}k.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new bt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},k.getToken=function(){return this.next(),new bt(this)},typeof Symbol<"u"&&(k[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===u.eof,value:t}}}}),k.nextToken=function(){var e=this.curContext();return(!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(u.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},k.readToken=function(e){return J(e,this.options.ecmaVersion>=6)||92===e?this.readWord():this.getTokenFromCode(e)},k.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888},k.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf("*/",this.pos+=2);if(-1===n&&this.raise(this.pos-2,"Unterminated comment"),this.pos=n+2,this.options.locations)for(var s=void 0,i=t;(s=Ht(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=s;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.curPosition())},k.skipLineComment=function(e){for(var t=this.pos,n=this.options.onComment&&this.curPosition(),s=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!Ce(s);)s=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,n,this.curPosition())},k.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(!(e>8&&e<14||e>=5760&&Ft.test(String.fromCharCode(e))))break e;++this.pos}}},k.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},k.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===e&&46===t?(this.pos+=3,this.finishToken(u.ellipsis)):(++this.pos,this.finishToken(u.dot))},k.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===e?this.finishOp(u.assign,2):this.finishOp(u.slash,1)},k.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,s=42===e?u.star:u.modulo;return this.options.ecmaVersion>=7&&42===e&&42===t&&(++n,s=u.starstar,t=this.input.charCodeAt(this.pos+2)),61===t?this.finishOp(u.assign,n+1):this.finishOp(s,n)},k.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(u.assign,3);return this.finishOp(124===e?u.logicalOR:u.logicalAND,2)}return 61===t?this.finishOp(u.assign,2):this.finishOp(124===e?u.bitwiseOR:u.bitwiseAND,1)},k.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(u.assign,2):this.finishOp(u.bitwiseXOR,1)},k.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?45!==t||this.inModule||62!==this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!q.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(u.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===t?this.finishOp(u.assign,2):this.finishOp(u.plusMin,1)},k.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=62===e&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+n)?this.finishOp(u.assign,n+1):this.finishOp(u.bitShift,n)):33!==t||60!==e||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===t&&(n=2),this.finishOp(u.relational,n)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},k.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return 61===t?this.finishOp(u.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===e&&62===t&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(u.arrow)):this.finishOp(61===e?u.eq:u.prefix,1)},k.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(46===t){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(u.questionDot,2)}if(63===t){if(e>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(u.assign,3);return this.finishOp(u.coalesce,2)}}return this.finishOp(u.question,1)},k.readToken_numberSign=function(){var e=35;if(this.options.ecmaVersion>=13&&(++this.pos,J(e=this.fullCharCodeAtPos(),!0)||92===e))return this.finishToken(u.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+ie(e)+"'")},k.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(u.parenL);case 41:return++this.pos,this.finishToken(u.parenR);case 59:return++this.pos,this.finishToken(u.semi);case 44:return++this.pos,this.finishToken(u.comma);case 91:return++this.pos,this.finishToken(u.bracketL);case 93:return++this.pos,this.finishToken(u.bracketR);case 123:return++this.pos,this.finishToken(u.braceL);case 125:return++this.pos,this.finishToken(u.braceR);case 58:return++this.pos,this.finishToken(u.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(u.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(u.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+ie(e)+"'")},k.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)},k.readRegexp=function(){for(var e,t,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,"Unterminated regular expression");var s=this.input.charAt(this.pos);if(q.test(s)&&this.raise(n,"Unterminated regular expression"),e)e=!1;else{if("["===s)t=!0;else if("]"===s&&t)t=!1;else if("/"===s&&!t)break;e="\\"===s}++this.pos}var i=this.input.slice(n,this.pos);++this.pos;var r=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(r);var o=this.regexpState||(this.regexpState=new te(this));o.reset(n,i,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var l=null;try{l=new RegExp(i,a)}catch{}return this.finishToken(u.regexp,{pattern:i,flags:a,value:l})},k.readInt=function(e,t,n){for(var s=this.options.ecmaVersion>=12&&void 0===t,i=n&&48===this.input.charCodeAt(this.pos),r=this.pos,a=0,o=0,l=0,c=t??1/0;l<c;++l,++this.pos){var h=this.input.charCodeAt(this.pos),p=void 0;if(s&&95===h)i&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),95===o&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),0===l&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=h;else{if((p=h>=97?h-97+10:h>=65?h-65+10:h>=48&&h<=57?h-48:1/0)>=e)break;o=h,a=a*e+p}}return s&&95===o&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===r||null!=t&&this.pos-r!==t?null:a},k.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var n=this.readInt(e);return null==n&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(n=gi(this.input.slice(t,this.pos)),++this.pos):J(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(u.num,n)},k.readNumber=function(e){var t=this.pos;!e&&null===this.readInt(10,void 0,!0)&&this.raise(t,"Invalid number");var n=this.pos-t>=2&&48===this.input.charCodeAt(t);n&&this.strict&&this.raise(t,"Invalid number");var s=this.input.charCodeAt(this.pos);if(!n&&!e&&this.options.ecmaVersion>=11&&110===s){var i=gi(this.input.slice(t,this.pos));return++this.pos,J(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(u.num,i)}n&&/[89]/.test(this.input.slice(t,this.pos))&&(n=!1),46===s&&!n&&(++this.pos,this.readInt(10),s=this.input.charCodeAt(this.pos)),(69===s||101===s)&&!n&&((43===(s=this.input.charCodeAt(++this.pos))||45===s)&&++this.pos,null===this.readInt(10)&&this.raise(t,"Invalid number")),J(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var r=yr(this.input.slice(t,this.pos),n);return this.finishToken(u.num,r)},k.readCodePoint=function(){var e;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var t=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(t,"Code point out of bounds")}else e=this.readHexChar(4);return e},k.readString=function(e){for(var t="",n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var s=this.input.charCodeAt(this.pos);if(s===e)break;92===s?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):8232===s||8233===s?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(Ce(s)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(u.string,t)};var vi={};k.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e!==vi)throw e;this.readInvalidTemplateToken()}this.inTemplateElement=!1},k.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw vi;this.raise(e,t)},k.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var n=this.input.charCodeAt(this.pos);if(96===n||36===n&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==u.template&&this.type!==u.invalidTemplate?(e+=this.input.slice(t,this.pos),this.finishToken(u.template,e)):36===n?(this.pos+=2,this.finishToken(u.dollarBraceL)):(++this.pos,this.finishToken(u.backQuote));if(92===n)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(Ce(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(n)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},k.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if("{"!==this.input[this.pos+1])break;case"`":return this.finishToken(u.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":"\n"===this.input[this.pos+1]&&++this.pos;case"\n":case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,"Unterminated template")},k.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return ie(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var n=this.pos-1;this.invalidStringToken(n,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var s=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(s,8);return i>255&&(s=s.slice(0,-1),i=parseInt(s,8)),this.pos+=s.length-1,t=this.input.charCodeAt(this.pos),("0"!==s||56===t||57===t)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-s.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(i)}return Ce(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},k.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return null===n&&this.invalidStringToken(t,"Bad character escape sequence"),n},k.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,n=this.pos,s=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(oe(i,s))this.pos+=i<=65535?1:2;else{if(92!==i)break;this.containsEsc=!0,e+=this.input.slice(n,this.pos);var r=this.pos;117!==this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(t?J:oe)(a,s)||this.invalidStringToken(r,"Invalid Unicode escape"),e+=ie(a),n=this.pos}t=!1}return e+this.input.slice(n,this.pos)},k.readWord=function(){var e=this.readWord1(),t=u.name;return this.keywords.test(e)&&(t=dt[e]),this.finishToken(t,e)};var br="8.15.0";function it(e,t){return L.parse(e,t)}function _r(e,t,n){return L.parseExpressionAt(e,t,n)}function rt(e,t,n,s,i){var r=[];n||(n=g),function e(s,i,a){var o=a||s.type,l=s!==r[r.length-1];l&&r.push(s),n[o](s,i,e),t[o]&&t[o](s,i||r,r),l&&r.pop()}(e,s,i)}function _t(e,t,n){n(e,t)}function fe(e,t,n){}L.acorn={Parser:L,version:br,defaultOptions:ot,Position:Ne,SourceLocation:je,getLineInfo:Ut,Node:Xe,TokenType:P,tokTypes:u,keywordTypes:dt,TokContext:Y,tokContexts:I,isIdentifierChar:oe,isIdentifierStart:J,Token:bt,isNewLine:Ce,lineBreak:q,lineBreakG:Ui,nonASCIIwhitespace:Ft};var g={};g.Program=g.BlockStatement=g.StaticBlock=function(e,t,n){for(var s=0,i=e.body;s<i.length;s+=1){n(i[s],t,"Statement")}},g.Statement=_t,g.EmptyStatement=fe,g.ExpressionStatement=g.ParenthesizedExpression=g.ChainExpression=function(e,t,n){return n(e.expression,t,"Expression")},g.IfStatement=function(e,t,n){n(e.test,t,"Expression"),n(e.consequent,t,"Statement"),e.alternate&&n(e.alternate,t,"Statement")},g.LabeledStatement=function(e,t,n){return n(e.body,t,"Statement")},g.BreakStatement=g.ContinueStatement=fe,g.WithStatement=function(e,t,n){n(e.object,t,"Expression"),n(e.body,t,"Statement")},g.SwitchStatement=function(e,t,n){n(e.discriminant,t,"Expression");for(var s=0,i=e.cases;s<i.length;s+=1){n(i[s],t)}},g.SwitchCase=function(e,t,n){e.test&&n(e.test,t,"Expression");for(var s=0,i=e.consequent;s<i.length;s+=1){n(i[s],t,"Statement")}},g.ReturnStatement=g.YieldExpression=g.AwaitExpression=function(e,t,n){e.argument&&n(e.argument,t,"Expression")},g.ThrowStatement=g.SpreadElement=function(e,t,n){return n(e.argument,t,"Expression")},g.TryStatement=function(e,t,n){n(e.block,t,"Statement"),e.handler&&n(e.handler,t),e.finalizer&&n(e.finalizer,t,"Statement")},g.CatchClause=function(e,t,n){e.param&&n(e.param,t,"Pattern"),n(e.body,t,"Statement")},g.WhileStatement=g.DoWhileStatement=function(e,t,n){n(e.test,t,"Expression"),n(e.body,t,"Statement")},g.ForStatement=function(e,t,n){e.init&&n(e.init,t,"ForInit"),e.test&&n(e.test,t,"Expression"),e.update&&n(e.update,t,"Expression"),n(e.body,t,"Statement")},g.ForInStatement=g.ForOfStatement=function(e,t,n){n(e.left,t,"ForInit"),n(e.right,t,"Expression"),n(e.body,t,"Statement")},g.ForInit=function(e,t,n){"VariableDeclaration"===e.type?n(e,t):n(e,t,"Expression")},g.DebuggerStatement=fe,g.FunctionDeclaration=function(e,t,n){return n(e,t,"Function")},g.VariableDeclaration=function(e,t,n){for(var s=0,i=e.declarations;s<i.length;s+=1){n(i[s],t)}},g.VariableDeclarator=function(e,t,n){n(e.id,t,"Pattern"),e.init&&n(e.init,t,"Expression")},g.Function=function(e,t,n){e.id&&n(e.id,t,"Pattern");for(var s=0,i=e.params;s<i.length;s+=1){n(i[s],t,"Pattern")}n(e.body,t,e.expression?"Expression":"Statement")},g.Pattern=function(e,t,n){"Identifier"===e.type?n(e,t,"VariablePattern"):"MemberExpression"===e.type?n(e,t,"MemberPattern"):n(e,t)},g.VariablePattern=fe,g.MemberPattern=_t,g.RestElement=function(e,t,n){return n(e.argument,t,"Pattern")},g.ArrayPattern=function(e,t,n){for(var s=0,i=e.elements;s<i.length;s+=1){var r=i[s];r&&n(r,t,"Pattern")}},g.ObjectPattern=function(e,t,n){for(var s=0,i=e.properties;s<i.length;s+=1){var r=i[s];"Property"===r.type?(r.computed&&n(r.key,t,"Expression"),n(r.value,t,"Pattern")):"RestElement"===r.type&&n(r.argument,t,"Pattern")}},g.Expression=_t,g.ThisExpression=g.Super=g.MetaProperty=fe,g.ArrayExpression=function(e,t,n){for(var s=0,i=e.elements;s<i.length;s+=1){var r=i[s];r&&n(r,t,"Expression")}},g.ObjectExpression=function(e,t,n){for(var s=0,i=e.properties;s<i.length;s+=1){n(i[s],t)}},g.FunctionExpression=g.ArrowFunctionExpression=g.FunctionDeclaration,g.SequenceExpression=function(e,t,n){for(var s=0,i=e.expressions;s<i.length;s+=1){n(i[s],t,"Expression")}},g.TemplateLiteral=function(e,t,n){for(var s=0,i=e.quasis;s<i.length;s+=1){n(i[s],t)}for(var r=0,a=e.expressions;r<a.length;r+=1){n(a[r],t,"Expression")}},g.TemplateElement=fe,g.UnaryExpression=g.UpdateExpression=function(e,t,n){n(e.argument,t,"Expression")},g.BinaryExpression=g.LogicalExpression=function(e,t,n){n(e.left,t,"Expression"),n(e.right,t,"Expression")},g.AssignmentExpression=g.AssignmentPattern=function(e,t,n){n(e.left,t,"Pattern"),n(e.right,t,"Expression")},g.ConditionalExpression=function(e,t,n){n(e.test,t,"Expression"),n(e.consequent,t,"Expression"),n(e.alternate,t,"Expression")},g.NewExpression=g.CallExpression=function(e,t,n){if(n(e.callee,t,"Expression"),e.arguments)for(var s=0,i=e.arguments;s<i.length;s+=1){n(i[s],t,"Expression")}},g.MemberExpression=function(e,t,n){n(e.object,t,"Expression"),e.computed&&n(e.property,t,"Expression")},g.ExportNamedDeclaration=g.ExportDefaultDeclaration=function(e,t,n){e.declaration&&n(e.declaration,t,"ExportNamedDeclaration"===e.type||e.declaration.id?"Statement":"Expression"),e.source&&n(e.source,t,"Expression")},g.ExportAllDeclaration=function(e,t,n){e.exported&&n(e.exported,t),n(e.source,t,"Expression")},g.ImportDeclaration=function(e,t,n){for(var s=0,i=e.specifiers;s<i.length;s+=1){n(i[s],t)}n(e.source,t,"Expression")},g.ImportExpression=function(e,t,n){n(e.source,t,"Expression")},g.ImportSpecifier=g.ImportDefaultSpecifier=g.ImportNamespaceSpecifier=g.Identifier=g.PrivateIdentifier=g.Literal=fe,g.TaggedTemplateExpression=function(e,t,n){n(e.tag,t,"Expression"),n(e.quasi,t,"Expression")},g.ClassDeclaration=g.ClassExpression=function(e,t,n){return n(e,t,"Class")},g.Class=function(e,t,n){e.id&&n(e.id,t,"Pattern"),e.superClass&&n(e.superClass,t,"Expression"),n(e.body,t)},g.ClassBody=function(e,t,n){for(var s=0,i=e.body;s<i.length;s+=1){n(i[s],t)}},g.MethodDefinition=g.PropertyDefinition=g.Property=function(e,t,n){e.computed&&n(e.key,t,"Expression"),e.value&&n(e.value,t,"Expression")};const ne=class e{static pruneCache(e){e.size>this.MAX_CACHE_SIZE&&Array.from(e.keys()).slice(0,e.size-this.MAX_CACHE_SIZE/2).forEach(t=>e.delete(t))}static clearCaches(){this.expressionCache.clear(),this.variableCache.clear(),this.bindingsCache.clear(),this.loopVariableCache.clear()}static addPatternBindings(e,t){if(e){if("Identifier"===e.type)return void t.add(e.name);if("AssignmentPattern"===e.type)return void this.addPatternBindings(e.left,t);if("RestElement"===e.type)return void this.addPatternBindings(e.argument,t);"ObjectPattern"===e.type&&e.properties.forEach(e=>{"Property"===e.type?this.addPatternBindings(e.value,t):"RestElement"===e.type&&this.addPatternBindings(e.argument,t)})}}static extractStateBindings(t){if(this.bindingsCache.has(t))return[...this.bindingsCache.get(t)];const n=new Set;try{rt(it(t,{ecmaVersion:2020}),{FunctionDeclaration(e,t){t.length<=2&&e.id&&e.id.name&&n.add(e.id.name)},VariableDeclaration(t,s){s.length>2||t.declarations.forEach(t=>{var s,i,r,a,o,l,c;"CallExpression"!==(null==(s=t.init)?void 0:s.type)||"pp"!==(null==(r=null==(i=t.init.callee)?void 0:i.object)?void 0:r.name)||"state"!==(null==(o=null==(a=t.init.callee)?void 0:a.property)?void 0:o.name)&&"reducer"!==(null==(c=null==(l=t.init.callee)?void 0:l.property)?void 0:c.name)?("Identifier"===t.id.type&&n.add(t.id.name),"ObjectPattern"===t.id.type&&e.addPatternBindings(t.id,n)):"ArrayPattern"===t.id.type&&t.id.elements.forEach(e=>{"Identifier"===(null==e?void 0:e.type)&&n.add(e.name)})})}})}catch(e){console.error("[PP-ERROR] AstParser Failed",e)}const s=Array.from(n);return this.pruneCache(this.bindingsCache),this.bindingsCache.set(t,s),s}static extractUsedVariables(e,t){const n=e+"|"+Array.from(t).sort().join(",");if(this.variableCache.has(n))return new Set(this.variableCache.get(n));const s=new Set;try{rt(it(`(${e})`,{ecmaVersion:2020}),{Identifier(e,n){if(!t.has(e.name)){if(n.length>1){const t=n[n.length-2];if("MemberExpression"===t.type&&t.property===e&&!t.computed||"Property"===t.type&&t.key===e&&!t.computed&&!t.shorthand)return}s.add(e.name)}}})}catch{}return this.pruneCache(this.variableCache),this.variableCache.set(n,s),new Set(s)}static isValidExpression(e){if(!e.trim())return!1;if(this.expressionCache.has(e))return this.expressionCache.get(e);let t=!1;try{_r(`(${e})`,0,{ecmaVersion:2020}),t=!0}catch{t=!1}return this.pruneCache(this.expressionCache),this.expressionCache.set(e,t),t}static analyzeLoopVariableUsage(e,t){const n=e+"|"+t;if(this.loopVariableCache.has(n))return[...this.loopVariableCache.get(n)];const s=[];try{rt(it(e,{ecmaVersion:2020}),{Identifier(e,n){if(e.name!==t)return;let i=!1,r=!1,a=e.start,o=e.end;if(n.length>=2){const t=n[n.length-2];if("MemberExpression"===t.type&&t.property===e&&!t.computed||"Property"===t.type&&t.key===e&&!t.computed&&!t.shorthand)return;if("Property"===t.type&&t.shorthand&&(i=!0,n.length>=3)){const e=n[n.length-3];"ObjectExpression"===e.type&&1===e.properties.length&&(r=!0,a=e.start,o=e.end)}}s.push({start:a,end:o,isShorthand:i,isUnwrap:r})}})}catch{}return this.pruneCache(this.loopVariableCache),this.loopVariableCache.set(n,s),[...s]}};d(ne,"expressionCache",new Map),d(ne,"variableCache",new Map),d(ne,"bindingsCache",new Map),d(ne,"loopVariableCache",new Map),d(ne,"MAX_CACHE_SIZE",1e3);let Q=ne;class _e{static escapeTemplateLiteralText(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}static getRuntimeEscaperSource(){return"\nconst __pp_escape_html = (value) => String(value)\n .split('&').join('&')\n .split('<').join('<')\n .split('>').join('>')\n .split('\"').join('"')\n .split(\"'\").join(''');\nconst __pp_raw_html = (value) => ({ __ppRawHtml: String(value) });\nconst __pp_render_value = (value) => {\n if (typeof value === 'boolean' || value == null) return '';\n if (value && typeof value === 'object' && Object.prototype.hasOwnProperty.call(value, '__ppRawHtml')) return value.__ppRawHtml;\n if (Array.isArray(value)) return value.map(__pp_render_value).join('');\n return __pp_escape_html(value);\n};\nconst __pp_decode_html_entities = (value) => String(value)\n .split('"').join('\"')\n .split('"').join('\"')\n .split(''').join(\"'\")\n .split('<').join('<')\n .split('>').join('>')\n .split('&').join('&');\nconst __pp_find_dynamic_closing_brace = (value, start) => {\n let depth = 0;\n let quote = null;\n let escaped = false;\n for (let index = start; index < value.length; index++) {\n const char = value[index];\n if (escaped) {\n escaped = false;\n continue;\n }\n if (char === String.fromCharCode(92)) {\n escaped = true;\n continue;\n }\n if (quote) {\n if (char === quote) quote = null;\n continue;\n }\n if (char === '\"' || char === \"'\" || char === String.fromCharCode(96)) {\n quote = char;\n continue;\n }\n if (char === '{') depth++;\n if (char === '}') {\n depth--;\n if (depth === 0) return index;\n }\n }\n return -1;\n};\nconst __pp_interpolate_dynamic_html = (value) => {\n const source = String(value);\n let result = '';\n let cursor = 0;\n while (cursor < source.length) {\n if (source[cursor] !== '{') {\n result += source[cursor++];\n continue;\n }\n const closing = __pp_find_dynamic_closing_brace(source, cursor);\n if (closing === -1) {\n result += source[cursor++];\n continue;\n }\n const expression = __pp_decode_html_entities(source.slice(cursor + 1, closing));\n try {\n result += __pp_render_value(eval(expression));\n } catch {\n result += source.slice(cursor, closing + 1);\n }\n cursor = closing + 1;\n }\n return result;\n};\nconst __pp_dynamic_component = (value) => {\n const renderOne = (entry) => {\n let resolved = entry;\n if (typeof resolved === 'function') resolved = resolved();\n if (typeof resolved === 'boolean' || resolved == null) return '';\n if (resolved && typeof resolved === 'object' && Object.prototype.hasOwnProperty.call(resolved, '__ppRawHtml')) {\n return __pp_interpolate_dynamic_html(resolved.__ppRawHtml);\n }\n return __pp_interpolate_dynamic_html(resolved);\n };\n return __pp_raw_html(Array.isArray(value) ? value.map(renderOne).join('') : renderOne(value));\n};\n"}static escapeTemplateLiteralTextPreservingInterpolations(e){let t="",n=0,s=0;for(;n<e.length;){if("$"===e[n]&&"{"===e[n+1]){const i=this.findClosingBrace(e,n+1);if(-1!==i){t+=this.escapeTemplateLiteralText(e.slice(s,n)),t+=e.slice(n,i+1),n=i+1,s=n;continue}}n++}return t+=this.escapeTemplateLiteralText(e.slice(s)),t}static clearCache(){this.cache.clear()}static pruneCache(){if(this.cache.size>this.MAX_CACHE_SIZE){const e=this.cache.size-Math.floor(this.MAX_CACHE_SIZE/2);let t=0;for(const n of this.cache.keys()){if(t>=e)break;this.cache.delete(n),t++}}}static transformSpreadAttributes(e){const t=new Map;let n=0;const s=document.createElement("template");s.innerHTML=e;const i=e=>{if(e.nodeType===Node.ELEMENT_NODE){const s=e;if(Array.from(s.childNodes).forEach(i),s.hasAttribute("pp-spread")){const e=s.getAttribute("pp-spread")||"";s.removeAttribute("pp-spread");const i=K(e),r=(null==i?void 0:i.expression.trim())??"";if(r.startsWith("...")){const e=B(r.slice(3).trim()),i=`___pp_spread_${n++}___`,a=`\${ (() => {\n const __obj = ${e};\n if (!__obj || typeof __obj !== 'object') return '';\n return Object.entries(__obj)\n .map(([k, v]) => {\n if (v == null) return '';\n const __attrName = String(k);\n if (!/^[^\\s"'<>/=]+$/.test(__attrName) || /^on/i.test(__attrName)) return '';\n const __escapedValue = String(v)\n .split('&').join('&')\n .split('"').join('"')\n .split("'").join(''')\n .split('<').join('<')\n .split('>').join('>');\n return __attrName + '="' + __escapedValue + '"';\n })\n .filter(Boolean)\n .join(' ');\n })() }`;t.set(i,a),s.setAttribute(i,"")}}}};return Array.from(s.content.childNodes).forEach(i),{html:s.innerHTML,spreadReplacements:t}}static expandSpreadPlaceholders(e,t){let n=e;return t.forEach((e,t)=>{n=n.split(`${t}=""`).join(e),n=n.split(t).join(e)}),n}static transformRefAttributes(e){if(!e.includes("pp-ref"))return e;const t=document.createElement("template");t.innerHTML=e;const n=document.createTreeWalker(t.content,NodeFilter.SHOW_ELEMENT);let s=n.nextNode();for(;s;){const e=s;if(e.hasAttribute("pp-ref")){const t=K(e.getAttribute("pp-ref")||"");if(t){const n=B(t.expression);e.removeAttribute("pp-ref"),e.setAttribute("data-pp-ref",`{ __pp_ref(${n}) }`)}}s=n.nextNode()}return t.innerHTML}static transformComponentTags(e){const t=document.createElement("template");t.innerHTML=e;const n=e=>{if(e.nodeType!==Node.ELEMENT_NODE)return;const t=e,s=t.tagName.toLowerCase();if(Array.from(t.childNodes).forEach(n),s.includes(".")&&!s.endsWith(".provider")){const e=document.createDocumentFragment();for(e.appendChild(document.createTextNode(`{__pp_dynamic_component(${s})}`));t.firstChild;)e.appendChild(t.firstChild);t.replaceWith(e)}};return Array.from(t.content.childNodes).forEach(n),t.innerHTML}static transformContextProviderTags(e){if(!/\.provider\b/i.test(e))return e;let t="",n=0;for(;n<e.length;){const s=e.slice(n).match(/^<([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*\.Provider)\b/i);if(!s){t+=e[n],n+=1;continue}const i=s[1],r=this.findOpeningTagEnd(e,n);if(-1===r){t+=e[n],n+=1;continue}const a=e.slice(n+s[0].length,r),o=r+1,l=this.findMatchingContextProviderClose(e,o);if(!l){t+=e[n],n+=1;continue}const c=this.transformContextProviderTags(e.slice(o,l.start));t+=`<pp-context-provider data-pp-context-token="{ __pp_context_token(__pp_context_lookup(${`'${i.replace(/\.Provider$/i,"").replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`})) }" data-pp-context-value="{ __pp_context_value(${this.extractContextProviderValueExpression(a)}) }">`+c+"</pp-context-provider>",n=l.end}return t}static findOpeningTagEnd(e,t){let n=null,s=0;for(let i=t;i<e.length;i++){const t=e[i],r=this.isEscaped(e,i);if(n){if("{"===t&&!r){s++;continue}if("}"===t&&!r&&s>0){s--;continue}t===n&&!r&&0===s&&(n=null)}else if(r||'"'!==t&&"'"!==t){if(">"===t)return i}else n=t,s=0}return-1}static findMatchingContextProviderClose(e,t){this.CONTEXT_PROVIDER_TAG_PATTERN.lastIndex=t;let n,s=1;for(;n=this.CONTEXT_PROVIDER_TAG_PATTERN.exec(e);){const e=n[0];if(s+=e.startsWith("</")?-1:1,0===s)return{start:n.index,end:n.index+e.length}}return null}static extractContextProviderValueExpression(e){const t=e.match(/\bvalue\s*=\s*(?:"([\s\S]*?)"|'([\s\S]*?)'|([^\s>]+))/i);if(!t)return"undefined";const n=t[1]??t[2]??t[3]??"",s=K(B(n.trim()));return s?s.expression:JSON.stringify(n)}static normalizeTextareaValueAttributes(e){if(!e.includes("<textarea")||!e.includes("value="))return e;const t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("textarea").forEach(e=>{const t=e,n=t.getAttribute("value");null!==n&&(t.textContent=n,t.removeAttribute("value"))}),t.innerHTML}static transformStyleAliasAttributes(e){if(!e.includes("pp-style"))return e;const t=document.createElement("template");t.innerHTML=e;const n=document.createTreeWalker(t.content,NodeFilter.SHOW_ELEMENT);let s=n.nextNode();for(;s;){const e=s;if(e.hasAttribute("pp-style")){const t=e.getAttribute("pp-style")??"",n=e.getAttribute("style")??"";e.removeAttribute("pp-style");const s=this.mergeStyleAttributeValues(n,t);s.length>0&&e.setAttribute("style",s)}s=n.nextNode()}return t.innerHTML}static mergeStyleAttributeValues(e,t){const n=e.trim(),s=t.trim().replace(/^;+\s*/,"");return n?s?`${n.endsWith(";")?n:`${n};`} ${s}`:n:s}static transformSelectValueAttributes(e){if(!e.includes("<select")||!e.includes("value="))return e;const t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("select").forEach(e=>{const t=e,n=t.getAttribute("value");if(null===n)return;const s=K(n);if(!s)return;const i=B(s.expression);t.removeAttribute("value"),t.setAttribute("data-pp-select-value",`{ __pp_select_value(${i}) }`)}),t.innerHTML}static transformInputValueAttributes(e){if(!e.includes("<input")||!e.includes("value="))return e;const t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("input").forEach(e=>{const t=e,n=t.getAttribute("value");if(null===n)return;const s=K(n);if(!s)return;const i=B(s.expression);t.removeAttribute("value"),t.setAttribute("data-pp-input-value",`{ __pp_input_value(${i}) }`)}),t.innerHTML}static transformCheckedValueAttributes(e){if(!e.includes("<input")||!e.includes("checked="))return e;const t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("input").forEach(e=>{const t=e,n=t.getAttribute("checked");if(null===n)return;const s=K(n);if(!s)return;const i=B(s.expression);t.removeAttribute("checked"),t.setAttribute("data-pp-checked-value",`{ __pp_checked_value(${i}) }`)}),t.innerHTML}static transformDefaultValueAttributes(e){if(!e.includes("default"))return e;const t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("input, textarea, select").forEach(e=>{const t=e,n=t.getAttribute("defaultvalue");if(null===n)return;const s=K(n);if(!s)return;const i=B(s.expression);t.removeAttribute("defaultvalue"),t.setAttribute("data-pp-default-value",`{ __pp_default_value(${i}) }`)}),t.innerHTML}static transformDefaultCheckedAttributes(e){if(!e.includes("default"))return e;const t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("input").forEach(e=>{const t=e,n=t.getAttribute("defaultchecked");if(null===n)return;const s=K(n);if(!s)return;const i=B(s.expression);t.removeAttribute("defaultchecked"),t.setAttribute("data-pp-default-checked",`{ __pp_default_checked(${i}) }`)}),t.innerHTML}static compile(e,t){const n=(e||"").replace(/\r\n/g,"\n").replace(/\r/g,"\n"),s=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t.toString(16).padStart(8,"0")},i=t.join("\0"),r=`t${s(n)}|k${s(i)}|n${t.length}`;if(this.cache.has(r))return this.cache.get(r);const a=this.transformContextProviderTags(n),{maskedHtml:o,placeholders:l}=this.maskLiteralHtmlTextNodes(a),{maskedTemplate:c,placeholders:h}=this.maskComplexComponents(o),{maskedHtml:p,placeholders:u}=this.maskLiteralElements(c,"style","STYLE"),{maskedHtml:d,placeholders:f}=this.maskLiteralElements(p,"code","CODE",e=>!this.isPureBindingLiteral(e.innerHTML)),{maskedHtml:m,placeholders:g}=this.maskLiteralElements(d,"script","SCRIPT"),v=this.transformComponentTags(m),y=this.transformStyleAliasAttributes(v),_=this.normalizeTextareaValueAttributes(Mt(y)),x=t.includes("__pp_input_value")?this.transformInputValueAttributes(_):_,C=t.includes("__pp_checked_value")?this.transformCheckedValueAttributes(x):x,S=this.transformSelectValueAttributes(C),b=this.transformDefaultValueAttributes(S),E=this.transformDefaultCheckedAttributes(b),{html:k,spreadReplacements:w}=this.transformSpreadAttributes(E),A=this.transformRefAttributes(k),{html:P,loopReplacements:T}=this.processStructuralDirectives(A);let I=this.transformBooleanAttributes(P);(()=>{let e=!0;for(;e;)e=!1,T.forEach((t,n)=>{const s=I;I=I.split("${"+n+"}").join("${"+t+"}"),I=I.split(n).join("{ __pp_raw_html("+t+") }"),I!==s&&(e=!0)})})();const R=new Set;let L=this.getRuntimeEscaperSource()+"return `",N=0,V="";for(;N<I.length;){const e=I[N];if("o"===e||"O"===e){const e=I.slice(N,N+20).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(e){const t=I.slice(N,N+e[0].length),n=t[t.length-1];let s=N+e[0].length;for(;s<I.length&&(I[s]!==n||"\\"===I[s-1]);)s++;V+=I.slice(N,s+1),N=s+1;continue}}if("{"===e){const e=this.findClosingBrace(I,N);if(-1!==e){const t=I.slice(N+1,e),n=B(t);if(Q.isValidExpression(n)){L+=this.escapeTemplateLiteralText(V),V="";const t=Q.extractUsedVariables(n,ki);for(const e of t)/^___PP_LOOP_\d+___$/.test(e)||R.add(e);const s=n.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g," ");L+=`\${ (() => {\n try {\n const __res = (${n});\n return __pp_render_value(__res);\n } catch(e) {\n console.error("[PP-ERROR] Template Expression Failed: \\"${s}\\"", e);\n return '';\n }\n })() }`,N=e+1;continue}t.trim().length>0&&console.warn(`[PP-WARN] Interpolation skipped. Invalid Syntax in: "{${n}}"`)}}V+=e,N++}L+=this.escapeTemplateLiteralText(V),L+="`;",L=this.expandSpreadPlaceholders(L,w);const M=t.slice();try{const e=new Function(...M,L),t=(...t)=>{let n=e(...t);return n=this.restorePlaceholders(n,g),n=this.restorePlaceholders(n,f),n=this.restorePlaceholders(n,u),h.forEach((e,t)=>{n=n.replace(t,e)}),n=this.restorePlaceholders(n,l),n};return this.pruneCache(),this.cache.set(r,t),t}catch(e){return console.error("[PP-ERROR] Compilation Failed",e),()=>"Error in Template"}}static maskLiteralElements(e,t,n,s=()=>!0){const i=document.createElement("template");i.innerHTML=e;const r=new Map;let a=0;return i.content.querySelectorAll(t).forEach(e=>{if(!s(e))return;const t=`__PP_${n}_${a++}__`;r.set(t,e.outerHTML),e.replaceWith(document.createTextNode(t))}),{maskedHtml:i.innerHTML,placeholders:r}}static maskLiteralHtmlTextNodes(e){const t=document.createElement("template");t.innerHTML=e;const n=new Map,s={value:0},i=document.createTreeWalker(t.content,NodeFilter.SHOW_TEXT),r=[];for(;i.nextNode();)r.push(i.currentNode);return r.forEach(e=>{if(this.isWithinLiteralTextContainer(e))return;const t=e.textContent??"";if(!t.includes("{")&&!t.includes("}"))return;const i=this.splitLiteralHtmlTextSegments(t);if(!i)return;let r="";i.forEach(e=>{r+=e.literalHtml?this.maskLiteralBraces(e.text,n,s):e.text}),e.textContent=r}),{maskedHtml:t.innerHTML,placeholders:n}}static isWithinLiteralTextContainer(e){let t=e.parentNode;for(;t;){if(t.nodeType===Node.ELEMENT_NODE){const e=t.tagName.toLowerCase();if("code"===e||"pre"===e||"script"===e||"style"===e)return!0}t=t.parentNode}return!1}static splitLiteralHtmlTextSegments(e){if(!e.includes("<")||!e.includes(">"))return null;const t=document.createElement("template");t.innerHTML=e;const n=Array.from(t.content.childNodes).map(e=>({text:e.nodeType===Node.TEXT_NODE?e.textContent??"":this.serializeNodeHtml(e),literalHtml:e.nodeType!==Node.TEXT_NODE}));return n.some(e=>e.literalHtml)?n:null}static serializeNodeHtml(e){if(e.nodeType===Node.TEXT_NODE)return e.textContent??"";const t=document.createElement("template");return t.content.appendChild(e.cloneNode(!0)),t.innerHTML}static maskLiteralBraces(e,t,n){let s="";for(const i of e){if("{"===i||"}"===i){const e=`__PP_LITERAL_HTML_BRACE_${n.value++}__`;t.set(e,i),s+=e;continue}s+=i}return s}static isPureBindingLiteral(e){return null!==K(e)}static restorePlaceholders(e,t){let n=e;return t.forEach((e,t)=>{n=n.replace(t,e)}),n}static transformBooleanAttributes(e){let t="",n=0;for(;n<e.length;){let s=!1;for(const i of Lt){const r=`${i}="{`,a=`${i}='{`;if(e.startsWith(r,n)){s=!0;const a=n+r.length-1,o=this.findClosingBrace(e,a);if(-1!==o&&'"'===e[o+1]){const s=B(e.slice(a+1,o)),r=s.replace(/\\/g,"\\\\").replace(/'/g,"\\'");t+=`{ (() => { const __ppAttr = (${s}); if (typeof __ppAttr === 'boolean') return __pp_raw_html(__ppAttr ? '${i}' : ''); if (__ppAttr == null) return ''; if (typeof __ppAttr === 'string' || typeof __ppAttr === 'number' || typeof __ppAttr === 'bigint') return __pp_raw_html('${i}="' + __pp_escape_html(__ppAttr) + '"'); return __pp_raw_html('${i}="{${r}}"'); })() }`,n=o+2;break}}else if(e.startsWith(a,n)){s=!0;const r=n+a.length-1,o=this.findClosingBrace(e,r);if(-1!==o&&"'"===e[o+1]){const s=B(e.slice(r+1,o)),a=s.replace(/\\/g,"\\\\").replace(/'/g,"\\'");t+=`{ (() => { const __ppAttr = (${s}); if (typeof __ppAttr === 'boolean') return __pp_raw_html(__ppAttr ? '${i}' : ''); if (__ppAttr == null) return ''; if (typeof __ppAttr === 'string' || typeof __ppAttr === 'number' || typeof __ppAttr === 'bigint') return __pp_raw_html('${i}="' + __pp_escape_html(__ppAttr) + '"'); return __pp_raw_html('${i}="{${a}}"'); })() }`,n=o+2;break}}}s||(t+=e[n],n++)}return t}static captureLoopVariablesInEventHandlers(e,t,n,s,i=!1,r=[]){let a="",o=0;for(;o<e.length;){const l=e.slice(o,o+40).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(l){const c=l[0].length,h=e.slice(o,o+c),p=h[h.length-1],u=o+c;let d=u;for(;d<e.length&&(e[d]!==p||"\\"===e[d-1]);)d++;const f=h.slice(0,-2).trim();let m=e.slice(u,d);m=this.rewriteLoopEventHandlerCode(m,t,n,s,i,r),a+=`${f}=${p}${m}${p}`,o=d+1;continue}a+=e[o],o++}return a}static rewriteLoopEventHandlerCode(e,t,n,s,i,r=[]){const a=K(e),o=a?a.expression:e;let l=n,c=o;r.forEach(e=>{l=this.applyLoopContextRewrites(l,e),c=this.applyLoopContextRewrites(c,e)});const h={iterator:t,collectionName:l,indexVar:s,userDefinedIndex:i};return c=this.applyLoopContextRewrites(c,h),[...r,h].forEach(e=>{const t=this.getLoopIndexToken(e.indexVar);c=c.split(t).join(`\${${e.indexVar}}`)}),a?`{${c}}`:c}static getLoopIndexToken(e){return`__PP_LOOP_IDX_${e}__`}static applyLoopContextRewrites(e,t){const n=this.getLoopIndexToken(t.indexVar);let s=e;return t.userDefinedIndex&&(s=this.replaceLoopIdentifierUsages(s,t.indexVar,n)),this.replaceLoopIdentifierUsages(s,t.iterator,`(${t.collectionName})[${n}]`)}static replaceLoopIdentifierUsages(e,t,n){const s=Q.analyzeLoopVariableUsage(e,t).slice().sort((e,t)=>t.start-e.start);if(0===s.length)return e;let i=e;return s.forEach(e=>{const s=e.isShorthand?this.buildShorthandReplacement(t,n,e.isUnwrap):n;i=i.slice(0,e.start)+s+i.slice(e.end)}),i}static buildShorthandReplacement(e,t,n){return n?`{ ${e}: ${t} }`:`${e}: ${t}`}static isIdentifier(e){return/^[A-Za-z_$][\w$]*$/.test(e)}static stripBalancedParens(e){const t=e.trim();return t.startsWith("(")&&this.findMatchingToken(t,0,"(",")")===t.length-1?t.slice(1,-1).trim():null}static parseLoopDirective(e){const t=this.findTopLevelInSeparator(e);if(-1===t)return null;const n=e.slice(0,t).trim(),s=e.slice(t+2).trim();if(!n||!s)return null;const i=this.stripBalancedParens(n);if(null!==i){const e=this.findTopLevelToken(i,",");if(-1===e)return null;const t=i.slice(0,e).trim(),n=i.slice(e+1).trim();return t&&n?{iterator:t,indexVar:n,collection:s}:null}return{iterator:n,indexVar:null,collection:s}}static findTopLevelInSeparator(e){const t={parenDepth:0,bracketDepth:0,braceDepth:0,quote:null};for(let n=0;n<e.length;n++){const s=e[n];if(!this.advanceScannerState(t,e,n)&&0===t.parenDepth&&0===t.bracketDepth&&0===t.braceDepth&&"i"===s&&"n"===e[n+1]&&/\s/.test(e[n-1]??"")&&/\s/.test(e[n+2]??""))return n}return-1}static findTopLevelToken(e,t){const n={parenDepth:0,bracketDepth:0,braceDepth:0,quote:null};for(let s=0;s<e.length;s++)if(!this.advanceScannerState(n,e,s)&&0===n.parenDepth&&0===n.bracketDepth&&0===n.braceDepth&&e[s]===t)return s;return-1}static findMatchingToken(e,t,n,s){let i=0,r=null;for(let a=t;a<e.length;a++){const t=e[a],o=this.isEscaped(e,a);if(r)t===r&&!o&&(r=null);else if(o||'"'!==t&&"'"!==t&&"`"!==t)if(t!==n||o){if(t===s&&!o&&(i--,0===i))return a}else i++;else r=t}return-1}static advanceScannerState(e,t,n){const s=t[n],i=this.isEscaped(t,n);return e.quote?(s===e.quote&&!i&&(e.quote=null),!0):i||'"'!==s&&"'"!==s&&"`"!==s?(i||("("===s?e.parenDepth++:")"===s?e.parenDepth--:"["===s?e.bracketDepth++:"]"===s?e.bracketDepth--:"{"===s?e.braceDepth++:"}"===s&&e.braceDepth--),!1):(e.quote=s,!0)}static isEscaped(e,t){let n=0,s=t-1;for(;s>=0&&"\\"===e[s];)n++,s--;return n%2!=0}static processStructuralDirectives(e){if(!e.includes("pp-for"))return{html:e,loopReplacements:new Map};const t=document.createElement("template");t.innerHTML=e;const n=new Map;let s=0,i=0;const r=(e,t=[])=>{const a=Array.from(e.childNodes);for(const e of a){if(e.nodeType!==Node.ELEMENT_NODE)continue;const a=e;if("TEMPLATE"===a.tagName){const e=a,o=e.getAttribute("pp-for")||"";let l=null;if(e.hasAttribute("pp-for")){const e=this.parseLoopDirective(o);let t,n,s,r=!1;if(!e){console.warn(`[PP-WARN] Invalid pp-for directive skipped: "${o}"`);continue}if(t=e.iterator,s=e.collection,n=e.indexVar??"__pp_idx_"+i++,r=null!==e.indexVar,!this.isIdentifier(t)||r&&!this.isIdentifier(n)){console.warn(`[PP-WARN] pp-for currently expects identifier loop variables: "${o}"`);continue}if(!Q.isValidExpression(s)){console.warn(`[PP-WARN] Invalid pp-for collection expression skipped: "${s}"`);continue}l={iterator:t,collectionName:s,indexVar:n,userDefinedIndex:r}}if(r(e.content,l?[...t,l]:t),l){const{iterator:i,collectionName:r,indexVar:a,userDefinedIndex:o}=l;let c=e.innerHTML;c=this.transformContextProviderTags(c),c=this.transformComponentTags(c),c=this.transformRefAttributes(c),c=this.transformStyleAliasAttributes(c),c=this.captureLoopVariablesInEventHandlers(c,i,r,a,o,t),c=c.replace(/___PP_LOOP_\d+___/g,e=>"${"+e+"}"),c=c.replace(/\r/g,""),c=this.transformBooleanAttributes(c),c=this.transformInterpolations(c),c=this.escapeTemplateLiteralTextPreservingInterpolations(c);const h=`(Array.isArray(${r}) ? ${r} : []).map(${`(${i}, ${a})`} => \`${c}\`).join('')`,p=`___PP_LOOP_${s++}___`;n.set(p,h),e.replaceWith(document.createTextNode(p));continue}continue}r(a,t)}};return r(t.content),{html:t.innerHTML,loopReplacements:n}}static transformInterpolations(e){let t="",n=0;for(;n<e.length;){if("o"===e[n]||"O"===e[n]){const s=e.slice(n,n+20).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(s){const i=e.slice(n,n+s[0].length),r=i[i.length-1];let a=n+s[0].length;for(;a<e.length&&(e[a]!==r||"\\"===e[a-1]);)a++;t+=e.slice(n,a+1),n=a+1;continue}}if("{"===e[n]){if(n>0&&"$"===e[n-1]){t+="{",n++;continue}const s=this.findClosingBrace(e,n);if(-1!==s){const i=B(e.slice(n+1,s));if(Q.isValidExpression(i)){t+="${__pp_render_value("+i+")}",n=s+1;continue}}}t+=e[n],n++}return t}static maskComplexComponents(e){if(!e.includes("pp-component="))return{maskedTemplate:e,placeholders:new Map};const t=document.createElement("template");t.innerHTML=e;const n=new Map;let s=0;const i=e=>{if(e instanceof Element&&e.hasAttribute("pp-component")){const t=!!e.querySelector("script"),i=!!e.querySelector("template[pp-owner]");if(t||i){const t=`__PP_CHILD_${s++}__`;return n.set(t,e.outerHTML),void e.replaceWith(document.createTextNode(t))}}Array.from(e.children).forEach(e=>i(e))};return i(t.content),{maskedTemplate:t.innerHTML,placeholders:n}}static findClosingBrace(e,t){return ft(e,t)}}d(_e,"cache",new Map),d(_e,"MAX_CACHE_SIZE",200),d(_e,"CONTEXT_PROVIDER_TAG_PATTERN",/<\/?([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*\.Provider)\b[^>]*>/gi);class Cr{constructor(e){d(this,"bindingSeq",0),d(this,"activeBindings",new Map),this.componentId=e}ensureBindingId(e,t){const n="captured"===t?"__ppCapturedRefBindingId":"__ppPlainRefBindingId";return e[n]||(e[n]=`pprefbind_${this.componentId}_${t}_${++this.bindingSeq}`),e[n]}commit(e){for(const[t,n]of this.activeBindings.entries()){const s=e.get(t);s?(n.value!==s.value||n.element!==s.element)&&this.clearValue(n.value,"[PP-WARN] Ref cleanup failed"):this.clearValue(n.value,"[PP-WARN] Ref cleanup failed")}for(const[t,n]of e.entries()){const e=this.activeBindings.get(t);e&&e.value===n.value&&e.element===n.element||this.attachValue(n.value,n.element,"[PP-WARN] Ref attachment failed")}this.activeBindings=e}clearAll(){for(const e of this.activeBindings.values())this.clearValue(e.value,"[PP-WARN] Ref cleanup failed");this.activeBindings.clear()}attachValue(e,t,n){this.updateValue(e,t,n)}clearValue(e,t){this.updateValue(e,null,t)}updateValue(e,t,n){try{"function"==typeof e?e(t):e&&"object"==typeof e&&"current"in e&&(e.current=t)}catch(e){console.warn(n,e)}}}class Sr{constructor(e){d(this,"trackedPortals",new Map),this.componentId=e}get size(){return this.trackedPortals.size}has(e){return this.trackedPortals.has(e)}get(e){return this.trackedPortals.get(e)}getPlaceholderText(e){const t=this.trackedPortals.get(e);return(null==t?void 0:t.placeholder.data)||`pp-portal:${this.componentId}`}apply(e){const t=new Set;let n=!1;for(const s of e){const e=s.ref.current;if(!e)continue;const i=s.target??document.body;t.add(e);const r=this.trackedPortals.get(e);if(null!=r&&r.placeholder.parentNode){r.target!==i&&(i.appendChild(e),r.target=i,n=!0);continue}null===s.info.sourceParent&&e.parentNode instanceof Element&&(s.info.sourceParent=e.parentNode);const a=document.createComment(`pp-portal:${this.componentId}`);e.parentNode&&e.parentNode.insertBefore(a,e),i.appendChild(e),this.trackedPortals.set(e,{element:e,placeholder:a,target:i}),n=!0}for(const[e,s]of this.trackedPortals)t.has(e)||(s.placeholder.parentNode?(s.placeholder.parentNode.insertBefore(e,s.placeholder),s.placeholder.remove()):e.parentNode&&e.remove(),this.trackedPortals.delete(e),n=!0);return n}replaceElement(e,t){const n=this.trackedPortals.get(e);n&&(this.trackedPortals.delete(e),this.trackedPortals.set(t,{...n,element:t}))}contains(e){for(const[t]of this.trackedPortals)if(t===e||t.contains(e))return!0;return!1}elements(){return Array.from(this.trackedPortals.keys())}values(){return Array.from(this.trackedPortals.values())}destroyAll(){for(const[,e]of this.trackedPortals)e.element.parentNode&&e.element.remove(),e.placeholder.parentNode&&e.placeholder.remove();this.trackedPortals.clear()}}class Er{constructor(){d(this,"registeredResetForms",new Set)}applyControlledSelectValue(e,t){if(e.multiple){const n=new Set(this.normalizeControlledSelectValues(t));for(let t=0;t<e.options.length;t++){const s=e.options[t],i=n.has(s.value);s.selected!==i&&(s.selected=i)}return}const n=null==t?"":String(t);e.value!==n&&(e.value=n)}applyControlledInputValue(e,t){const n=null==t?"":String(t);this.shouldDeferFocusedDateLikeInputValue(e,n)?this.deferFocusedControlledInputValue(e,t):this.shouldDeferActiveNativeTextInputValue(e,n)||e.value!==n&&(e.value=n)}bindControlledSelectValues(e,t){for(let n=0;n<e.length;n++){const s=e[n];if(!(s instanceof HTMLSelectElement))continue;const i=this.resolveControlledSelectCaptureId(s,t);i&&(this.trackValueControlMode(s,"controlled"),this.applyControlledSelectValue(s,t.get(i)))}}bindControlledInputValues(e,t){for(let n=0;n<e.length;n++){const s=e[n];if(!(s instanceof HTMLInputElement))continue;const i=this.resolveControlledInputValue(s,t);i.hasValue&&(this.trackValueControlMode(s,"controlled"),this.applyControlledInputValue(s,i.value))}}bindControlledCheckedValues(e,t){for(let n=0;n<e.length;n++){const s=e[n];if(!(s instanceof HTMLInputElement))continue;const i=this.resolveControlledCheckedValue(s,t);if(!i.hasValue)continue;this.trackCheckedControlMode(s,"controlled");const r=!!i.value;s.checked!==r&&(s.checked=r)}}applyUncontrolledDefaultValue(e,t){if(e instanceof HTMLSelectElement)return void this.applyUncontrolledDefaultSelectValue(e,t);const n=null==t?"":String(t);this.trackValueControlMode(e,"uncontrolled"),e.defaultValue!==n&&(e.defaultValue=n),e.value!==n&&(e.value=n),e.__ppHasUncontrolledDefaultValue=!0}applyUncontrolledDefaultChecked(e,t){const n=this.normalizeDefaultCheckedValue(t);this.trackCheckedControlMode(e,"uncontrolled"),e.defaultChecked!==n&&(e.defaultChecked=n),e.checked!==n&&(e.checked=n),e.__ppHasUncontrolledDefaultChecked=!0}restoreUncontrolledSelectState(e){const t=Array.from(e.options);if(e.multiple)return void t.forEach(e=>{e.selected=e.defaultSelected});const n=t.find(e=>e.defaultSelected);n?e.value=n.value:t.length>0&&(e.selectedIndex=0)}isUncontrolledResetManagedElement(e){const t=e;return!(!t.__ppHasUncontrolledDefaultValue&&!t.__ppHasUncontrolledDefaultChecked)||e instanceof HTMLSelectElement&&Array.from(e.options).some(e=>e.defaultSelected)}syncUncontrolledFormResets(e,t,n){const s=new Set;for(let i=0;i<t.length;i++){const r=t[i],a=r.closest("form");a instanceof HTMLFormElement&&this.isUncontrolledResetManagedElement(r)&&(s.add(a),this.registerResetHandler(a,e,()=>{this.restoreUncontrolledFormDefaults(a,n())}))}for(const t of this.registeredResetForms)s.has(t)||this.unregisterResetHandler(t,e);this.registeredResetForms=s}clearResetHandlers(e){for(const t of this.registeredResetForms)this.unregisterResetHandler(t,e);this.registeredResetForms.clear()}restoreUncontrolledFormDefaults(e,t){for(let n=0;n<t.length;n++){const s=t[n],i=s;if(s.closest("form")===e){if(s instanceof HTMLSelectElement){this.restoreUncontrolledSelectState(s);continue}(s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement)&&i.__ppHasUncontrolledDefaultValue&&(s.value=s.defaultValue),s instanceof HTMLInputElement&&i.__ppHasUncontrolledDefaultChecked&&(s.checked=s.defaultChecked)}}}resolveDefaultValueBinding(e,t){const n=e.getAttribute("data-pp-default-value");if(n){if(e.removeAttribute("data-pp-default-value"),e.__ppDefaultValueCaptureId=n,t.has(n))return t.get(n)}else if(e.__ppDefaultValueCaptureId){if(t.has(e.__ppDefaultValueCaptureId))return t.get(e.__ppDefaultValueCaptureId);delete e.__ppDefaultValueCaptureId}return"__ppResolvedDefaultValue"in e?e.__ppResolvedDefaultValue:e.hasAttribute("defaultvalue")?e.getAttribute("defaultvalue"):void 0}resolveDefaultCheckedBinding(e,t){const n=e.getAttribute("data-pp-default-checked");if(n){if(e.removeAttribute("data-pp-default-checked"),e.__ppDefaultCheckedCaptureId=n,t.has(n))return t.get(n)}else if(e.__ppDefaultCheckedCaptureId){if(t.has(e.__ppDefaultCheckedCaptureId))return t.get(e.__ppDefaultCheckedCaptureId);delete e.__ppDefaultCheckedCaptureId}return"__ppResolvedDefaultChecked"in e?e.__ppResolvedDefaultChecked:e.hasAttribute("defaultchecked")?e.getAttribute("defaultchecked"):void 0}materializeNestedBoundaryFormDefaults(e,t){const n=e.getAttribute("data-pp-input-value");n&&t.inputValueStore.has(n)&&(e.removeAttribute("data-pp-input-value"),e.__ppResolvedInputValue=t.inputValueStore.get(n));const s=e.getAttribute("data-pp-default-value");if(s&&t.defaultValueStore.has(s)&&(e.removeAttribute("data-pp-default-value"),e.__ppResolvedDefaultValue=t.defaultValueStore.get(s)),!(e instanceof HTMLInputElement))return;const i=e.getAttribute("data-pp-default-checked");i&&t.defaultCheckedStore.has(i)&&(e.removeAttribute("data-pp-default-checked"),e.__ppResolvedDefaultChecked=t.defaultCheckedStore.get(i))}normalizeControlledSelectValues(e){return null==e?[]:Array.isArray(e)?e.filter(e=>null!=e).map(e=>String(e)):[String(e)]}applyUncontrolledDefaultSelectValue(e,t){this.trackValueControlMode(e,"uncontrolled");const n=this.normalizeControlledSelectValues(t),s=e.multiple?new Set(n):new Set(n.length>0?[n[0]]:[]);for(let t=0;t<e.options.length;t++){const n=e.options[t],i=n,r=s.has(n.value);n.defaultSelected!==r&&(n.defaultSelected=r),n.selected!==r&&(n.selected=r),r?i.__ppHasUncontrolledDefaultSelected=!0:delete i.__ppHasUncontrolledDefaultSelected}if(!e.multiple){const t=n.length>0?n[0]:"";e.value!==t&&(e.value=t)}}resolveControlledSelectCaptureId(e,t){const n=e.getAttribute("data-pp-select-value");let s=null;return n?(e.removeAttribute("data-pp-select-value"),e.__ppSelectValueCaptureId=n,s=n):e.__ppSelectValueCaptureId&&t.has(e.__ppSelectValueCaptureId)?s=e.__ppSelectValueCaptureId:e.__ppSelectValueCaptureId&&delete e.__ppSelectValueCaptureId,s}resolveControlledInputValue(e,t){const n=e.getAttribute("data-pp-input-value");let s,i=!1;return n?(e.removeAttribute("data-pp-input-value"),e.__ppInputValueCaptureId=n,t.has(n)&&(s=t.get(n),i=!0)):e.__ppInputValueCaptureId&&t.has(e.__ppInputValueCaptureId)?(s=t.get(e.__ppInputValueCaptureId),i=!0):"__ppResolvedInputValue"in e?(s=e.__ppResolvedInputValue,i=!0):e.__ppInputValueCaptureId&&delete e.__ppInputValueCaptureId,{hasValue:i,value:s}}resolveControlledCheckedValue(e,t){const n=e.getAttribute("data-pp-checked-value");let s,i=!1;if(n)e.removeAttribute("data-pp-checked-value"),e.__ppCheckedValueCaptureId=n,t.has(n)&&(s=t.get(n),i=null!=s);else{const n=e.__ppCheckedValueCaptureId;n&&t.has(n)?(s=t.get(n),i=null!=s):n&&delete e.__ppCheckedValueCaptureId}return{hasValue:i,value:s}}trackValueControlMode(e,t){const n=e,s=n.__ppValueControlMode;s?s!==t&&(n.__ppWarnedValueControlModeSwitch||(n.__ppWarnedValueControlModeSwitch=!0,console.warn(`[PP-WARN] ${this.describeControl(e)} changed from ${s} to ${t}. Choose either a controlled value binding or an uncontrolled defaultValue for the lifetime of the element.`)),n.__ppValueControlMode=t):n.__ppValueControlMode=t}describeControl(e){const t=e.tagName.toLowerCase(),n=e.id?`#${e.id}`:"",s=e.getAttribute("name");return`${t}${n}${!n&&s?`[name="${s}"]`:""}`}trackCheckedControlMode(e,t){const n=e,s=n.__ppCheckedControlMode;s?s!==t&&(n.__ppWarnedCheckedControlModeSwitch||(n.__ppWarnedCheckedControlModeSwitch=!0,console.warn(`[PP-WARN] ${this.describeControl(e)} changed from ${s} to ${t}. Choose either a controlled checked binding or an uncontrolled defaultChecked for the lifetime of the element.`)),n.__ppCheckedControlMode=t):n.__ppCheckedControlMode=t}registerResetHandler(e,t,n){const s=e;s.__ppResetCallbacks||(s.__ppResetCallbacks=new Map),s.__ppResetCallbacks.set(t,n),!s.__ppOriginalReset&&(s.__ppOriginalReset=e.reset,e.reset=function(){var e,n;null==(e=s.__ppOriginalReset)||e.call(this),null==(n=s.__ppResetCallbacks)||n.forEach((e,n)=>{var i;C.getInstance(n)||n===t?e():null==(i=s.__ppResetCallbacks)||i.delete(n)})})}unregisterResetHandler(e,t){var n;const s=e;null==(n=s.__ppResetCallbacks)||n.delete(t),!(s.__ppResetCallbacks&&s.__ppResetCallbacks.size>0)&&(s.__ppOriginalReset&&(e.reset=s.__ppOriginalReset,delete s.__ppOriginalReset),delete s.__ppResetCallbacks)}normalizeDefaultCheckedValue(e){if("string"==typeof e){const t=e.trim().toLowerCase();if(""===t||"true"===t)return!0;if("false"===t||"0"===t||"off"===t||"no"===t)return!1}return!!e}isDateLikeInput(e){return new Set(["date","datetime-local","month","time","week"]).has(e.type)}shouldDeferFocusedDateLikeInputValue(e,t){return!(typeof document>"u"||document.activeElement!==e||!this.isDateLikeInput(e))&&e.value!==t}shouldDeferActiveNativeTextInputValue(e,t){return!(typeof document>"u"||document.activeElement!==e||!e.__ppPreserveNativeSelectionOnNextRender)&&(this.isTextSelectionControl(e)&&e.value!==t)}isTextSelectionControl(e){return["text","search","url","tel","password"].includes(e.type)}deferFocusedControlledInputValue(e,t){if(e.__ppDeferredControlledValue=t,e.__ppDeferredControlledBlurHandler)return;const n=()=>{const t=e.__ppDeferredControlledValue;if(delete e.__ppDeferredControlledValue,delete e.__ppDeferredControlledBlurHandler,!e.isConnected)return;const n=null==t?"":String(t);e.value!==n&&(e.value=n)};e.__ppDeferredControlledBlurHandler=n,e.addEventListener("blur",n,{once:!0})}}class wr{constructor(e,t,n,s,i){d(this,"pendingProvidedContexts",new Map),d(this,"pendingContextTokens",new Set),d(this,"activeProviderBoundaryIds",new Set),d(this,"refreshPending",!1),d(this,"warnedContextOutsideRender",!1),this.componentId=e,this.getParentId=t,this.isCurrentInstance=n,this.isRendering=s,this.forceUpdate=i}prepareRender(){this.pendingProvidedContexts=new Map,this.pendingContextTokens=new Set}consume(e){return!this.isRendering()&&!this.warnedContextOutsideRender&&(this.warnedContextOutsideRender=!0,console.warn(`[PP-WARN] pp.context(...) should be called while component "${this.componentId}" is rendering. Move context reads to the component script body and pass values to event handlers through closure state.`)),this.pendingContextTokens.add(e),C.resolveContext(this.getParentId(),e).value}provide(e,t){this.pendingProvidedContexts.set(e,t)}commitRenderContexts(){const e=C.saveContextValues(this.componentId,this.pendingProvidedContexts);return C.updateContextDependencies(this.componentId,this.pendingContextTokens),e.length>0?C.getConsumersForContextsInSubtree(this.componentId,e):null}syncProviderBoundary(e,t,n,s){C.saveParent(e,t);const i=C.saveContextValues(e,new Map([[n,s]]));return i.length>0?C.getConsumersForContextsInSubtree(e,i):new Set}replaceActiveProviderBoundaries(e){const t=new Set;return this.activeProviderBoundaryIds.forEach(n=>{e.has(n)||C.removeContextTracking(n).forEach(e=>t.add(e))}),this.activeProviderBoundaryIds=e,t}requestRefresh(){this.refreshPending||(this.refreshPending=!0,queueMicrotask(()=>{if(this.refreshPending=!1,this.isCurrentInstance()){if(this.isRendering())return void this.requestRefresh();this.forceUpdate()}}))}refreshConsumers(e){var t;for(const n of e){const e=C.getInstance(n);null==(t=null==e?void 0:e.requestContextRefresh)||t.call(e)}}destroy(){return this.activeProviderBoundaryIds.forEach(e=>{C.removeContextTracking(e)}),this.activeProviderBoundaryIds.clear(),C.removeContextTracking(this.componentId)}}class kr{constructor(e,t,n,s){this.getRoot=e,this.containsPortalElement=t,this.collectManagedInputs=n,this.isDateLikeInput=s}save(){const e=document.activeElement;if(!e)return null;const t=this.getRoot().contains(e),n=!t&&this.containsPortalElement(e);if(!t&&!n)return null;const s=this.collectManagedInputs().indexOf(e);if(-1===s)return null;const i=this.getTextSelectionState(e);return{element:e,index:s,selectionStart:i.selectionStart,selectionEnd:i.selectionEnd}}restore(e){if(!e)return;const t=e.element,n=this.getRoot(),s=t&&t.isConnected&&(n.contains(t)||this.containsPortalElement(t))?t:this.collectManagedInputs()[e.index];if(!s)return;const i=s===document.activeElement,r=s;if(!(i&&s instanceof HTMLInputElement&&this.isDateLikeInput(s))&&(i||s.focus(),null!==e.selectionStart&&null!==e.selectionEnd&&this.isTextSelectionControl(s))){if(i&&r.__ppPreserveNativeSelectionOnNextRender)return void delete r.__ppPreserveNativeSelectionOnNextRender;if(i&&s.selectionStart===e.selectionStart&&s.selectionEnd===e.selectionEnd)return;try{s.setSelectionRange(e.selectionStart,e.selectionEnd)}catch(e){console.warn("Could not restore cursor position",e)}}}isTextSelectionControl(e){return e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&["text","search","url","tel","password"].includes(e.type)}getTextSelectionState(e){if(!this.isTextSelectionControl(e))return{selectionStart:null,selectionEnd:null};try{return{selectionStart:e.selectionStart,selectionEnd:e.selectionEnd}}catch{return{selectionStart:null,selectionEnd:null}}}}class Ar{constructor(e){this.options=e}morphChildren(e,t){if(this.hasKeyedDirectChildren(e)||this.hasKeyedDirectChildren(t))return void this.morphKeyedChildren(e,t);let n=e.firstChild,s=t.firstChild;for(;n||s;){const t=(null==n?void 0:n.nextSibling)??null,i=(null==s?void 0:s.nextSibling)??null;if(s){if(!n){const t=s.cloneNode(!0);e.appendChild(t),t.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(t),s=i;continue}if(n.nodeType!==s.nodeType){const r=s.cloneNode(!0);e.replaceChild(r,n),r.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(r),n=t,s=i;continue}n.nodeType!==Node.TEXT_NODE?(n.nodeType===Node.ELEMENT_NODE&&this.morphCompatibleElement(e,n,s),n=t,s=i):(n.textContent!==s.textContent&&(n.textContent=s.textContent),n=t,s=i)}else n&&e.removeChild(n),n=t}}morphCompatibleElement(e,t,n){if(t.tagName!==n.tagName){const s=n.cloneNode(!0);return e.replaceChild(s,t),void(s.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(s))}if(t.hasAttribute("pp-component")&&t!==this.options.root){if(!this.options.syncNestedBoundaryAttributes(t,n)){const s=n.cloneNode(!0);return e.replaceChild(s,t),void(s.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(s))}this.options.hasEventAttributes(t)&&this.options.collectEventElements(t)}else this.options.syncAttributes(t,n),this.options.hasEventAttributes(t)&&this.options.collectEventElements(t),!(t instanceof HTMLTextAreaElement)&&this.morphChildren(t,n)}hasKeyedDirectChildren(e){const t=e.childNodes;for(let e=0;e<t.length;e++){const n=t[e];if(null!==this.getNodeKey(n))return!0}return!1}getNodeKey(e){if(e.nodeType!==Node.ELEMENT_NODE)return null;const t=e.getAttribute("key");return t&&t.length>0?t:null}areNodesCompatible(e,t){if(e.nodeType!==t.nodeType)return!1;if(e.nodeType!==Node.ELEMENT_NODE)return!0;const n=t;if(e.tagName!==n.tagName)return!1;const s=this.getNodeKey(e),i=this.getNodeKey(t);return null===s&&null===i||null!==s&&s===i}morphKeyedChildren(e,t){const n=Array.from(e.childNodes),s=Array.from(t.childNodes),i=this.collectDuplicateKeys(s),r=new Map,a=[];i.length>0&&console.warn(`[PP-WARN] Duplicate key values detected: ${i.join(", ")}`),n.forEach(e=>{const t=this.getNodeKey(e);if(null===t)return void a.push(e);const n=r.get(t);n?n.push(e):r.set(t,[e])});let o=e.firstChild;s.forEach(t=>{const n=this.getNodeKey(t);let s;if(null!==n){const e=r.get(n);for(;e&&e.length>0;){const n=e.shift();if(this.areNodesCompatible(n,t)){s=n;break}a.push(n)}}else{const e=a.findIndex(e=>this.areNodesCompatible(e,t));-1!==e&&(s=a.splice(e,1)[0])}if(s)s!==o&&e.insertBefore(s,o);else{const n=t.cloneNode(!0);e.insertBefore(n,o),n.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(n),s=n}this.morphNode(s,t),o=s.nextSibling}),a.forEach(t=>{t.parentNode===e&&e.removeChild(t)}),r.forEach(t=>{t.forEach(t=>{t.parentNode===e&&e.removeChild(t)})})}collectDuplicateKeys(e){const t=new Set,n=new Set;return e.forEach(e=>{const s=this.getNodeKey(e);if(null!==s){if(t.has(s))return void n.add(s);t.add(s)}}),Array.from(n.values())}morphNode(e,t){if(e.nodeType!==t.nodeType){const n=e.parentNode;if(!n)return;const s=t.cloneNode(!0);return n.replaceChild(s,e),void(s.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(s))}if(e.nodeType===Node.TEXT_NODE)return void(e.textContent!==t.textContent&&(e.textContent=t.textContent));if(e.nodeType!==Node.ELEMENT_NODE)return;const n=e,s=t,i=n.parentNode;i&&this.morphCompatibleElement(i,n,s)}}class Tr{constructor(e){this.componentId=e}extractOwnedTemplates(e){const t=new Map,n=e.querySelectorAll("template[pp-owner]");let s=0;return n.forEach(n=>{var i,r;if((null==(i=n.parentElement)?void 0:i.closest("[pp-component]"))!==e)return;const a=n.getAttribute("pp-owner");if(!a)return;const o=`__PP_OWNED_${this.componentId}_${s++}__`;t.set(o,{ownerId:a,content:n.innerHTML,contextTag:(null==(r=n.parentElement)?void 0:r.tagName.toLowerCase())??null}),n.replaceWith(document.createComment(o))}),t}resolveOwnedChildren(e,t){if(!e.includes("__PP_OWNED_"))return e;t.forEach((t,n)=>{const s=this.resolveOwnedTemplateOwner(t.ownerId);if(s){const i=this.renderOwnedContent(t,s.ownerId,s.scope);e=this.replaceOwnedPlaceholder(e,n,i)}else e=this.replaceOwnedPlaceholder(e,n,t.content)});const n=/__PP_OWNED_([^_]+(?:_[^_]+)*)_(\d+)__/g;let s;for(;null!==(s=n.exec(e));){const t=s[0],i=s[1],r=C.getOwnedTemplates(i);if(r&&r.has(t)){const s=r.get(t),a=this.resolveOwnedTemplateOwner(s.ownerId,i);if(a){const n=this.renderOwnedContent(s,a.ownerId,a.scope);e=this.replaceOwnedPlaceholder(e,t,n)}else e=this.replaceOwnedPlaceholder(e,t,s.content);n.lastIndex=0}}return e}maskNestedOwnedTemplates(e,t=null){const n=new Map,s=He(e,t);let i=0;const r=s.root.querySelectorAll("[pp-component] > template[pp-owner]");for(const e of Array.from(r)){const t=`__PP_NESTED_TPL_${i++}__`;n.set(t,e.outerHTML),e.replaceWith(document.createComment(t))}return{content:s.toHtml(),placeholders:n}}restoreMaskedOwnedTemplates(e,t){if(0===t.size)return;const n=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),s=[];let i=n.nextNode();for(;i;){const e=i,r=t.get(e.data||"");if(r){const t=document.createElement("template");t.innerHTML=r;const n=t.content.firstChild;n&&s.push({node:e,replacement:n})}i=n.nextNode()}s.forEach(({node:e,replacement:t})=>{e.replaceWith(t)})}materializeTemplateComponentBoundaries(e){const t=[];e instanceof HTMLTemplateElement&&e.hasAttribute("pp-component")&&t.push(e),e.querySelectorAll("template[pp-component]").forEach(e=>t.push(e)),t.forEach(e=>{const t=e.content.cloneNode(!0),n=t.firstElementChild;n?(Array.from(e.attributes).forEach(e=>{"pp-owner"!==e.name&&n.setAttribute(e.name,e.value)}),e.replaceWith(t)):e.replaceWith(document.createComment("pp-empty-template-component"))})}replaceOwnedPlaceholder(e,t,n){const s=`\x3c!--${t}--\x3e`;return e.includes(s)?e.replace(s,n):e.replace(t,n)}renderOwnedContent(e,t,n){const{content:s,placeholders:i}=this.maskNestedOwnedTemplates(e.content,e.contextTag),r=ye(n).keys,a=be(n,r),o=Vi(e.contextTag),l=_e.compile(o.wrap(s),r);let c=o.unwrap(l(...a));for(const[e,t]of i)c=this.replaceOwnedPlaceholder(c,e,t);return this.markOwnedBindings(c,t,e.contextTag)}resolveOwnedTemplateOwner(e,t=this.componentId){const n=C.resolveComponentId(e,t);if(!n)return null;const s=C.getResolvedScopeWithAncestors(e,t);return s?{ownerId:n,scope:s}:null}markOwnedBindings(e,t,n=null){const s=He(e,n),i=[...s.root instanceof DocumentFragment?Array.from(s.root.children):[s.root]].reverse();for(;i.length>0;){const e=i.pop();if(Array.from(e.attributes).some(e=>e.name.startsWith("on"))&&e.setAttribute("pp-event-owner",t),e.hasAttribute("data-pp-ref")&&e.setAttribute("pp-ref-owner",t),e.hasAttribute("pp-component"))continue;const n=Array.from(e.children);for(let e=n.length-1;e>=0;e-=1)i.push(n[e])}return s.toHtml()}}class Pr{constructor(e,t,n,s,i){this.componentId=e,this.interpolationCache=t,this.scopeEvalCache=n,this.propEvalCache=s,this.getCachedFunction=i}interpolateAttrString(e,t){const n=ye(t),s=n.keys,i=be(t,s),r=n.keySig;return Li(e,e=>{const t=B(e);try{const e=this.getCachedFunction(this.interpolationCache,t,s,r,300)(...i);return"boolean"==typeof e||null==e?"":Array.isArray(e)?e.join(""):String(e)}catch(e){return console.warn(`[PP-WARN] Failed attribute interpolation for {${t}}`,e),""}})}applyAttributeInterpolations(e,t){const n=ye(t),s=n.keys,i=be(t,s),r=n.keySig;for(const n of Array.from(e.attributes)){const a=n.name;if("pp-component"===a||a.startsWith("on"))continue;const o=n.value;if(!o.includes("{"))continue;const l=K(o);if(!l){const n=this.interpolateAttrString(o,t);n!==o&&e.setAttribute(a,n);continue}const c=B(l.expression);if(!Q.isValidExpression(c))continue;let h;try{h=this.getCachedFunction(this.scopeEvalCache,c,s,r,300)(...i)}catch(e){console.error(`[PP-ERROR] Failed to eval "${c}"`,e);continue}if(Lt.has(a.toLowerCase())&&"boolean"==typeof h){h?e.setAttribute(a,""):e.removeAttribute(a);continue}const p=typeof h;null==h?e.removeAttribute(a):("string"===p||"number"===p||"boolean"===p||"bigint"===p)&&e.setAttribute(a,String(h))}}computePropsFromAttributes(e,t){const n=t?C.getResolvedScopeWithAncestors(t,this.componentId):void 0,s=n?ye(n):null,i=(null==s?void 0:s.keys)??[],r=n?be(n,i):[],a=e.__ppRawBindings,o=new Set([...Array.from(e.attributes).map(e=>e.name),...a?Object.keys(a):[]]),l=(null==s?void 0:s.keySig)??"",c=e=>{if(n)try{return this.getCachedFunction(this.propEvalCache,e,i,l,200)(...r)}catch(t){return void console.warn(`[PP-WARN] Failed to evaluate prop expression "{${e}}" for component "${this.componentId}"`,t)}};return Array.from(o).reduce((t,s)=>{if(s.startsWith("on")&&!s.includes("-")||"pp-component"===s)return t;const i=Vt(s);if(pt.has(i))return t;const r=e.attributes.getNamedItem(s),o=(null==a?void 0:a[s])??(null==r?void 0:r.value);if(void 0===o)return t;if(""===o)return t[i]=!0,t;if(n){const e=K(o);if(e){const n=B(e.expression);if(Q.isValidExpression(n))return t[i]=c(n),t}if(o.includes("{"))return t[i]=this.interpolateAttrString(o,n),t}return t[i]=o,t},{})}}class Ir{constructor(e,t,n,s){d(this,"cache",null),this.getRoot=e,this.getPortalElements=t,this.refCaptureIdsByElement=n,this.refExprsByElement=s}invalidate(){this.cache=null}getCache(){if(this.cache)return this.cache;const e=this.getRoot(),t=[],n=[],s=[],i=[],r=new Set,a=[],o=(e,t)=>{a.push(e)};o(e);for(const e of this.getPortalElements())o(e);for(;a.length>0;){const o=a.pop();if(r.has(o))continue;r.add(o);const l=o,c=o!==e&&o.hasAttribute("pp-component");if(t.push(l),(o.hasAttribute("data-pp-ref")||o.hasAttribute("pp-ref")||this.refCaptureIdsByElement.has(l)||this.refExprsByElement.has(l))&&i.push(l),!c&&(o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement||o instanceof HTMLSelectElement)&&s.push(l),c)n.push(l);else for(let e=o.children.length-1;e>=0;e--)a.push(o.children[e])}return this.cache={ownedElements:t,childBoundaries:n,managedInputs:s,refElements:i},this.cache}collectManagedInputs(){return this.getCache().managedInputs}collectEventElements(e,t){if(e!==this.getRoot()&&e.hasAttribute("pp-component"))this.hasEventAttributes(e)&&t.add(e);else{this.hasEventAttributes(e)&&t.add(e);for(let n=0;n<e.children.length;n++)this.collectEventElements(e.children[n],t)}}hasEventAttributes(e){const t=e.attributes;for(let e=0;e<t.length;e++)if(t[e].name.startsWith("on")&&!t[e].name.includes("-"))return!0;return!1}isManagedEventElement(e){if(this.isElementOwnedByTree(e,this.getRoot()))return!0;for(const t of this.getPortalElements())if(this.isElementOwnedByTree(e,t))return!0;return!1}isElementOwnedByTree(e,t){if(e===t)return!0;if(!t.contains(e))return!1;let n=e,s=!0;for(;n&&n!==t;){if(!s&&n.hasAttribute("pp-component"))return!1;n=n.parentElement,s=!1}return n===t}}const Re=class e{constructor(e){this.options=e}bootstrap(){const e=new Set,t=new Set,n=(s,i)=>{const r=s.children;for(let s=0;s<r.length;s++){const a=r[s];if(a.hasAttribute("pp-component")){this.bootstrapComponentBoundary(a,i);continue}const o=this.syncContextProviderBoundary(a,i,e,t);n(a,o??i)}};n(this.options.getRoot(),this.options.componentId);for(const e of this.options.getPortalElements())n(e,this.options.componentId);this.options.contextManager.replaceActiveProviderBoundaries(e).forEach(e=>t.add(e)),t.size>0&&this.options.refreshContextConsumers(t)}syncNestedBoundaryAttributes(e,t){const n=t.getAttribute("pp-component"),s=this.getBoundaryBaseId(e);if(!n||s&&n!==s)return!1;this.options.syncAttributes(e,t,!1,!0);const i=e;return i.__ppRuntimeComponentId&&e.getAttribute("pp-component")!==i.__ppRuntimeComponentId&&e.setAttribute("pp-component",i.__ppRuntimeComponentId),!0}createBoundaryId(t){return e.boundarySequence+=1,`${t}__pp${e.boundarySequence.toString(36)}`}getBoundaryBaseId(e){const t=e,n=e.getAttribute("pp-component");return!t.__ppBaseComponentId&&n&&(t.__ppBaseComponentId=n),t.__ppBaseComponentId??n}ensureBoundaryIdentity(e){var t;const n=e,s=e.getAttribute("pp-component")||"";if(n.__ppRuntimeComponentId)return s!==n.__ppRuntimeComponentId&&e.setAttribute("pp-component",n.__ppRuntimeComponentId),n.__ppBaseComponentId||(n.__ppBaseComponentId=s||n.__ppRuntimeComponentId),n.__ppRuntimeComponentId;if(!s)return"";s.includes("{")&&!n.__ppWarnedDynamicComponentId&&(n.__ppWarnedDynamicComponentId=!0,console.warn(`[PP-WARN] Dynamic pp-component values are not supported. Component boundary ids are static; received "${s}". Use a stable pp-component id and pass dynamic values through props instead.`)),n.__ppBaseComponentId=s;const i=C.getInstance(s);if(i&&i.el&&i.el!==e){if(i.el.isConnected){const t=this.createBoundaryId(s);return n.__ppWarnedDuplicateComponentId||(n.__ppWarnedDuplicateComponentId=!0,console.warn(`[PP-WARN] Duplicate live pp-component id "${s}" detected. The runtime assigned "${t}" to keep component state isolated. Use stable unique ids for sibling component boundaries.`)),n.__ppRuntimeComponentId=t,e.setAttribute("pp-component",t),t}null==(t=i.destroy)||t.call(i)}return n.__ppRuntimeComponentId=s,s}bootstrapComponentBoundary(e,t){const n=e,s=this.ensureBoundaryIdentity(e);if(!s)return;if(n.__ppRawBindings){const t=this.options.isEffectManagedSurfaceElement(e),s=n.__ppRawBindings;for(const[n,i]of Object.entries(s))t&&this.options.shouldSkipEffectManagedAttr(n)||e.setAttribute(n,i)}else{const t={};for(const n of Array.from(e.attributes))n.value.includes("{")&&"pp-component"!==n.name&&!n.name.startsWith("on")&&(t[n.name]=n.value);n.__ppRawBindings=t}const i=C.getResolvedScopeWithAncestors(t,this.options.componentId)??this.options.getLatestScope();this.options.applyAttributeInterpolations(e,i),this.options.materializeFormDefaults(e);const r=C.getInstance(s);if(null!=r&&r.refreshPropsFromParent){const i=r.parentId!==t;if(r.parentId=t,C.saveParent(s,t),r.el!==e){const t=r.el;!n.__ppRawBindings&&t.__ppRawBindings&&(n.__ppRawBindings=t.__ppRawBindings),r.el=e}return void r.refreshPropsFromParent(i)}if(!C.getState(s)){n.__ppRuntimeParentId=t;try{this.options.createComponent(e)}finally{delete n.__ppRuntimeParentId}}}syncContextProviderBoundary(e,t,n,s){if("pp-context-provider"!==e.tagName.toLowerCase())return null;const i=this.resolveContextProviderBoundary(e);return i?(n.add(i.boundaryId),this.options.contextManager.syncProviderBoundary(i.boundaryId,t,i.context,i.value).forEach(e=>s.add(e)),i.boundaryId):null}resolveContextProviderBoundary(e){const t=e,n=e.getAttribute("data-pp-context-token")??t.__ppContextTokenCaptureId??null,s=e.getAttribute("data-pp-context-value")??t.__ppContextValueCaptureId??null;if(!n||!s)return null;t.__ppContextTokenCaptureId=n,t.__ppContextValueCaptureId=s,e.removeAttribute("data-pp-context-token"),e.removeAttribute("data-pp-context-value");const i=this.options.getContextTokenStore().get(n);return i?{boundaryId:this.ensureContextProviderBoundaryId(t),context:i,value:this.options.getContextValueStore().get(s)}:null}ensureContextProviderBoundaryId(e){return e.__ppContextBoundaryId||(e.__ppContextBoundaryId=`ppctx_${this.options.componentId}_${Math.random().toString(36).slice(2,10)}`),e.__ppContextBoundaryId}};d(Re,"boundarySequence",0);let lt=Re;const st=new Set(["data-state","data-open","style","aria-hidden","aria-checked","hidden","inert"]),Tt=new Set(["alert-dialog-content","alert-dialog-overlay","alert-dialog-portal","checkbox","dialog-content","dialog-overlay","dialog-portal","popover-content","sheet-content","sheet-overlay","sheet-portal","tooltip-content"]);class Rr{constructor(e,t){this.refCaptureIdsByElement=e,this.refExprsByElement=t}isEffectManagedAttr(e){return st.has(e)}isEffectManagedSurfaceElement(e,t){const n=e.getAttribute("data-slot");if(n&&Tt.has(n))return!0;const s=null==t?void 0:t.getAttribute("data-slot");return!!s&&Tt.has(s)}syncAttributes(e,t,n=!1,s=!1){const i=n||this.isEffectManagedSurfaceElement(e,t),r=e,a=e.attributes;for(let n=a.length-1;n>=0;n--){const o=a[n].name;if(!(s&&"pp-component"===o||t.hasAttribute(o))){if(i&&st.has(o)||"value"===o&&e instanceof HTMLInputElement&&r.__ppHasUncontrolledDefaultValue||"checked"===o&&e instanceof HTMLInputElement&&r.__ppHasUncontrolledDefaultChecked||"selected"===o&&e instanceof HTMLOptionElement&&r.__ppHasUncontrolledDefaultSelected)continue;e.removeAttribute(o),"data-pp-ref"===o&&this.refCaptureIdsByElement.delete(e),"pp-ref"===o&&this.refExprsByElement.delete(e)}}const o=t.attributes;for(let t=0;t<o.length;t++){const n=o[t];i&&st.has(n.name)||s&&"pp-component"===n.name||(e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value),"checked"===n.name&&e instanceof HTMLInputElement&&(this.trackCheckedControlMode(e,"controlled"),e.checked=!0),"value"===n.name&&(e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement)&&e.value!=n.value&&(e.value=n.value))}if(e instanceof HTMLTextAreaElement&&t instanceof HTMLTextAreaElement&&!r.__ppHasUncontrolledDefaultValue){const n=t.getAttribute("value"),s=n??t.value,i=n??t.defaultValue;e.value!==s&&(e.value=s),e.defaultValue!==i&&(e.defaultValue=i)}}trackCheckedControlMode(e,t){const n=e,s=n.__ppCheckedControlMode;if(s){if(s!==t){if(!n.__ppWarnedCheckedControlModeSwitch){n.__ppWarnedCheckedControlModeSwitch=!0;const i=e.id?`#${e.id}`:"",r=e.getAttribute("name"),a=!i&&r?`[name="${r}"]`:"";console.warn(`[PP-WARN] input${i}${a} changed from ${s} to ${t}. Choose either a controlled checked binding or an uncontrolled defaultChecked for the lifetime of the element.`)}n.__ppCheckedControlMode=t}}else n.__ppCheckedControlMode=t}}const Nr=Symbol.for("pp.context");let Be=null;function Lr(e){if(!e||"object"!=typeof e||!("value"in e))throw new Error("Context.Provider expects an object like { value, children? }.");return e}function Vr(e,t){const n=Be;Be=e;try{return t()}finally{Be=n}}function Mr(e){const t={$$typeof:Nr,defaultValue:e,Provider:e=>{const n=Lr(e),s=Be;if(!s)throw new Error("Context.Provider() can only be used while a component is rendering.");return s(t,n.value),n.children??null}};return t}const Dr=["script","domDiff","bindEvents","bindRefs","bootstrapNested","portals","restoreFocus","layoutEffects","effects","total"];function Pt(){return typeof performance<"u"&&"function"==typeof performance.now?performance.now():Date.now()}const D=class e{constructor(t){d(this,"el"),d(this,"id"),d(this,"rawTemplate"),d(this,"renderFunction"),d(this,"templateFn",null),d(this,"hooksSystem"),d(this,"eventManager"),d(this,"latestScope",{}),d(this,"__ppRefStore",new Map),d(this,"__ppRefSeq",0),d(this,"__ppRefCaptureIdsByElement",new WeakMap),d(this,"__ppRefExprsByElement",new WeakMap),d(this,"refBindingManager"),d(this,"__ppInputValueStore",new Map),d(this,"__ppInputValueSeq",0),d(this,"__ppSelectValueStore",new Map),d(this,"__ppSelectValueSeq",0),d(this,"__ppCheckedValueStore",new Map),d(this,"__ppCheckedValueSeq",0),d(this,"__ppContextTokenStore",new Map),d(this,"__ppContextTokenSeq",0),d(this,"__ppContextValueStore",new Map),d(this,"__ppContextValueSeq",0),d(this,"__ppDefaultValueStore",new Map),d(this,"__ppDefaultValueSeq",0),d(this,"__ppDefaultCheckedStore",new Map),d(this,"__ppDefaultCheckedSeq",0),d(this,"formControlManager",new Er),d(this,"passiveEffectsVersion",0),d(this,"isRendering",!1),d(this,"props",{}),d(this,"ownedChildren",new Map),d(this,"lastRenderedHtml",""),d(this,"renderCount",0),d(this,"portalManager"),d(this,"parentId",null),d(this,"initialChildrenHtml",""),d(this,"pendingEventElements",new Set),d(this,"traversalManager"),d(this,"contextManager"),d(this,"focusManager"),d(this,"domMorpher"),d(this,"ownedTemplateManager"),d(this,"propBindingManager"),d(this,"nestedBoundaryManager"),d(this,"attributeSyncManager"),d(this,"_lastRawScopeKeySig",""),d(this,"_lastSortedKeys",[]),d(this,"_lastSortedScopeKeySig",""),d(this,"_cachedHooksAPI",null),d(this,"_propFnCache",new Map),d(this,"_interpolationFnCache",new Map),d(this,"_scopeEvalFnCache",new Map),d(this,"_refEvalFnCache",new Map),this.el=t,this.id=this.el.getAttribute("pp-component")||"",this.id||(this.id="anon_"+Math.random().toString(36).substring(2,9),this.el.setAttribute("pp-component",this.id)),this.props=Array.from(this.el.attributes).reduce((e,t)=>{const n=t.name;if(n.startsWith("on")||"pp-component"===n)return e;const s=Vt(n);return pt.has(s)||(e[s]=t.value),e},{}),C.registerInstance(this.id,this),this.ownedTemplateManager=new Tr(this.id),this.propBindingManager=new Pr(this.id,this._interpolationFnCache,this._scopeEvalFnCache,this._propFnCache,(e,t,n,s,i)=>this.getCachedFunction(e,t,n,s,i)),this.refBindingManager=new Cr(this.id),this.portalManager=new Sr(this.id),this.attributeSyncManager=new Rr(this.__ppRefCaptureIdsByElement,this.__ppRefExprsByElement),this.traversalManager=new Ir(()=>this.el,()=>this.portalManager.elements(),this.__ppRefCaptureIdsByElement,this.__ppRefExprsByElement),this.contextManager=new wr(this.id,()=>this.parentId,()=>C.getInstance(this.id)===this,()=>this.isRendering,()=>this.forceUpdate()),this.nestedBoundaryManager=new lt({componentId:this.id,getRoot:()=>this.el,getPortalElements:()=>this.portalManager.elements(),getLatestScope:()=>this.latestScope,getContextTokenStore:()=>this.__ppContextTokenStore,getContextValueStore:()=>this.__ppContextValueStore,contextManager:this.contextManager,isEffectManagedSurfaceElement:e=>this.isEffectManagedSurfaceElement(e),shouldSkipEffectManagedAttr:e=>this.attributeSyncManager.isEffectManagedAttr(e),syncAttributes:(e,t,n,s)=>this.syncAttributes(e,t,n,s),applyAttributeInterpolations:(e,t)=>this.applyAttributeInterpolations(e,t),materializeFormDefaults:e=>this.materializeNestedBoundaryFormDefaults(e),createComponent:t=>{new e(t)},refreshContextConsumers:e=>this.refreshContextConsumers(e)}),this.focusManager=new kr(()=>this.el,e=>this.portalManager.contains(e),()=>this.collectManagedInputs(),e=>this.formControlManager.isDateLikeInput(e)),this.domMorpher=new Ar({root:this.el,collectEventElements:e=>this.collectEventElements(e),hasEventAttributes:e=>this.hasEventAttributes(e),isInsideTrackedPortal:e=>this.isInsideTrackedPortal(e),syncAttributes:(e,t,n,s)=>this.syncAttributes(e,t,n,s),syncNestedBoundaryAttributes:(e,t)=>this.nestedBoundaryManager.syncNestedBoundaryAttributes(e,t)}),this.syncParentId(),this.props=this.computePropsFromAttributes();let n=C.getTemplate(this.id);const s=C.getOwnedTemplates(this.id);n?s&&(this.ownedChildren=s):(this.ownedChildren=this.ownedTemplateManager.extractOwnedTemplates(this.el),n=this.el.innerHTML,C.saveTemplate(this.id,n),C.saveOwnedTemplates(this.id,this.ownedChildren)),this.initialChildrenHtml=n,this.props.children=this.initialChildrenHtml,this.hooksSystem=new Nt(()=>{this.isRendering||this.render()},this.id);const i=C.getState(this.id);i&&this.hooksSystem.loadState(i);const r=He(this.initialChildrenHtml,this.el.tagName.toLowerCase()),a=this.findOwnScript(r.root),o=(null==a?void 0:a.textContent)||"";a&&a.remove(),this.rawTemplate=r.toHtml(),this.renderFunction=this.createRenderFunction(o),this.eventManager=new nt(this.el,()=>this.latestScope,e=>this.traversalManager.isManagedEventElement(e)),this.render()}syncParentId(){var e;const t=this.el.__ppRuntimeParentId,n=null==(e=this.el.parentElement)?void 0:e.closest("[pp-component]");this.parentId=void 0!==t?t:n?n.getAttribute("pp-component"):null,C.saveParent(this.id,this.parentId)}static setPerfEnabled(e){this.perfEnabled=e}static getPerfEnabled(){return this.perfEnabled}static resetPerfStats(){this.perfStats.clear()}static getPerfStats(){return Object.fromEntries(this.perfStats.entries())}static createEmptyPerfEntry(){const e={};return Dr.forEach(t=>{e[t]={count:0,totalMs:0,maxMs:0}}),{renderCount:0,phases:e}}recordPerfPhase(t,n){if(!e.perfEnabled)return;let s=e.perfStats.get(this.id);s||(s=e.createEmptyPerfEntry(),e.perfStats.set(this.id,s));const i=s.phases[t];i.count++,i.totalMs+=n,i.maxMs=Math.max(i.maxMs,n)}startPerfTimer(){return e.perfEnabled?Pt():0}endPerfTimer(t,n){e.perfEnabled&&this.recordPerfPhase(t,Pt()-n)}findOwnScript(e){const t=Array.from(e.children);for(const e of t){if("script"===e.tagName.toLowerCase()&&(!e.hasAttribute("type")||"text/pp"===e.getAttribute("type")))return e;if(e.hasAttribute("pp-component"))continue;const t=this.findOwnScript(e);if(t)return t}return null}applyAttributeInterpolations(e,t){this.propBindingManager.applyAttributeInterpolations(e,t)}computePropsFromAttributes(){return this.propBindingManager.computePropsFromAttributes(this.el,this.parentId)}refreshPropsFromParent(e=!1){const t=this.computePropsFromAttributes();t.children=this.initialChildrenHtml,e||!Mi(this.props,t)||0!==this.ownedChildren.size?(this.props=t,this.isRendering||this.render()):this.bootstrapNestedComponents()}getCachedFunction(e,t,n,s,i){const r=t+"|"+s;let a=e.get(r);if(!a){if(a=new Function(...n,`"use strict"; return (${t});`),e.size>i){const t=e.keys().next().value;void 0!==t&&e.delete(t)}e.set(r,a)}return a}createRenderFunction(e){const t=Q.extractStateBindings(e);return new Function("pp",`\n "use strict";\n ${e}\n return { ${t.join(", ")} };\n `)}resolveCapturedRefValue(e,t){if(this.__ppRefStore.has(e))return this.__ppRefStore.get(e);if(!t||t===this.id)return;const n=C.getInstance(t);return n&&n.__ppRefStore.has(e)?n.__ppRefStore.get(e):void 0}resolvePlainRefValue(e,t,n,s){const i=this.latestScope[e];if("function"==typeof i||i&&"object"==typeof i&&"current"in i)return i;try{return this.getCachedFunction(this._refEvalFnCache,e,t,s,200)(...n)}catch{return}}createRefCaptureFunction(){return this.__ppRefStore=new Map,this.__ppRefSeq=0,e=>{const t=`ppref_${this.id}_${++this.__ppRefSeq}`;return this.__ppRefStore.set(t,e),t}}createSelectValueCaptureFunction(){return this.__ppSelectValueStore=new Map,this.__ppSelectValueSeq=0,e=>{const t=`ppselect_${this.id}_${++this.__ppSelectValueSeq}`;return this.__ppSelectValueStore.set(t,e),t}}createCheckedValueCaptureFunction(){return this.__ppCheckedValueStore=new Map,this.__ppCheckedValueSeq=0,e=>{const t=`ppchecked_${this.id}_${++this.__ppCheckedValueSeq}`;return this.__ppCheckedValueStore.set(t,e),t}}createInputValueCaptureFunction(){return this.__ppInputValueStore=new Map,this.__ppInputValueSeq=0,e=>{const t=`ppinput_${this.id}_${++this.__ppInputValueSeq}`;return this.__ppInputValueStore.set(t,e),t}}createContextTokenCaptureFunction(){return this.__ppContextTokenStore=new Map,this.__ppContextTokenSeq=0,e=>{const t=`ppcontexttoken_${this.id}_${++this.__ppContextTokenSeq}`;return this.__ppContextTokenStore.set(t,e),t}}createContextValueCaptureFunction(){return this.__ppContextValueStore=new Map,this.__ppContextValueSeq=0,e=>{const t=`ppcontextvalue_${this.id}_${++this.__ppContextValueSeq}`;return this.__ppContextValueStore.set(t,e),t}}createContextLookupFunction(){const e=(e,t)=>{if(null==e)return;if(Object.prototype.hasOwnProperty.call(e,t))return e[t];const n=Object.keys(Object(e)).find(e=>e.toLowerCase()===t.toLowerCase());return n?e[n]:void 0};return t=>{const n=String(t).split(".").map(e=>e.trim()).filter(Boolean);if(0===n.length)return;const[s,...i]=n;let r;"globalthis"===s.toLowerCase()?r=globalThis:"window"===s.toLowerCase()?r=typeof window<"u"?window:globalThis:(r=e(this.latestScope,s),void 0===r&&(r=e(globalThis,s)));for(const t of i)r=e(r,t);return r}}createDefaultValueCaptureFunction(){return this.__ppDefaultValueStore=new Map,this.__ppDefaultValueSeq=0,e=>{const t=`ppdefaultvalue_${this.id}_${++this.__ppDefaultValueSeq}`;return this.__ppDefaultValueStore.set(t,e),t}}createDefaultCheckedCaptureFunction(){return this.__ppDefaultCheckedStore=new Map,this.__ppDefaultCheckedSeq=0,e=>{const t=`ppdefaultchecked_${this.id}_${++this.__ppDefaultCheckedSeq}`;return this.__ppDefaultCheckedStore.set(t,e),t}}consumeContext(e){return this.contextManager.consume(e)}registerProvidedContext(e,t){this.contextManager.provide(e,t)}requestContextRefresh(){this.contextManager.requestRefresh()}refreshContextConsumers(e){this.contextManager.refreshConsumers(e)}makeHooksAPI(){return this._cachedHooksAPI?this._cachedHooksAPI.props=this.props:this._cachedHooksAPI={state:e=>this.hooksSystem.useState(e),effect:(e,t)=>this.hooksSystem.useEffect(e,t),layoutEffect:(e,t)=>this.hooksSystem.useLayoutEffect(e,t),ref:(e=null)=>this.hooksSystem.useRef(e),memo:(e,t)=>this.hooksSystem.useMemo(e,t),callback:(e,t)=>this.hooksSystem.useCallback(e,t),reducer:(e,t,n)=>n?this.hooksSystem.useReducer(e,t,n):this.hooksSystem.useReducer(e,t),context:e=>this.consumeContext(e),portal:(e,t)=>this.hooksSystem.usePortal(e,t),props:this.props},this._cachedHooksAPI}syncTrackedPortals(e){if(0===this.portalManager.size)return;const t=this.hooksSystem.getPortalRegistrations();if(0===t.length)return;const n=new Map,s=new Map;e.querySelectorAll("*").forEach(e=>{const t=e,i=t.getAttribute("data-pp-ref");if(i){const e=n.get(i);e?e.push(t):n.set(i,[t])}const r=t.getAttribute("pp-ref");if(r){const e=s.get(r);e?e.push(t):s.set(r,[t])}});const i=new Map;for(const[e,t]of this.__ppRefStore.entries()){if(!t||"object"!=typeof t||!("current"in t))continue;const n=t,s=i.get(n);s?s.push(e):i.set(n,[e])}const r=new Map;for(const[e,t]of Object.entries(this.latestScope)){if(!t||"object"!=typeof t||!("current"in t))continue;const n=t,s=r.get(n);s?s.push(e):r.set(n,[e])}const a=(e,t)=>{for(const n of t){const t=e.get(n);if(!t||0===t.length)continue;const s=t.shift()??null;if(0===t.length&&e.delete(n),s)return s}return null},o=[];for(const e of t){const t=e.ref.current;if(!t||!this.portalManager.has(t))continue;const l=i.get(e.ref)??[];let c=a(n,l);if(!c){const t=r.get(e.ref)??[];c=a(s,t)}c&&o.push({liveElement:t,sourceElement:c,placeholderText:this.portalManager.getPlaceholderText(t)})}0!==o.length&&(o.forEach(({sourceElement:e,placeholderText:t})=>{e.replaceWith(document.createComment(t))}),o.forEach(({liveElement:e,sourceElement:t})=>{this.morphTrackedPortalRoot(e,t)}))}morphTrackedPortalRoot(e,t){if(e.tagName!==t.tagName){const n=e.parentNode;if(!n)return;const s=t.cloneNode(!0);return n.replaceChild(s,e),this.collectEventElements(s),void this.portalManager.replaceElement(e,s)}this.syncAttributes(e,t,!0),this.hasEventAttributes(e)&&this.pendingEventElements.add(e),this.domMorpher.morphChildren(e,t)}applyPortals(){const e=this.hooksSystem.getPortalRegistrations();this.portalManager.apply(e)&&this.invalidateTraversalCache()}render(t=0){var n;if(t>e.MAX_SYNC_RERENDERS)return void console.warn(`[PP-WARN] Synchronous rerender limit exceeded for component "${this.id}". Check for state updates during render or layout effects.`);if(this.isRendering)return;this.isRendering=!0,this.renderCount++;const s=this.startPerfTimer();if(e.perfEnabled){let t=e.perfStats.get(this.id);t||(t=e.createEmptyPerfEntry(),e.perfStats.set(this.id,t)),t.renderCount++}try{this.contextManager.prepareRender();const e=this.focusManager.save();this.hooksSystem.prepareRender();const s=this.makeHooksAPI(),i=globalThis.pp,r=(null==(n=null==i?void 0:i.createComponentRuntime)?void 0:n.call(i,s))??s,a=this.startPerfTimer();this.hooksSystem.startRenderPhase();let o,l=!1;try{o=Vr((e,t)=>this.registerProvidedContext(e,t),()=>this.renderFunction(r))}finally{l=this.hooksSystem.finishRenderPhase()}if(this.endPerfTimer("script",a),l)return this.isRendering=!1,void this.render(t+1);C.saveState(this.id,this.hooksSystem.getHooks()),this.latestScope={...this.props,...o},this.latestScope.__pp_ref=this.createRefCaptureFunction(),this.latestScope.__pp_input_value=this.createInputValueCaptureFunction(),this.latestScope.__pp_select_value=this.createSelectValueCaptureFunction(),this.latestScope.__pp_checked_value=this.createCheckedValueCaptureFunction(),this.latestScope.__pp_context_token=this.createContextTokenCaptureFunction(),this.latestScope.__pp_context_value=this.createContextValueCaptureFunction(),this.latestScope.__pp_context_lookup=this.createContextLookupFunction(),this.latestScope.__pp_default_value=this.createDefaultValueCaptureFunction(),this.latestScope.__pp_default_checked=this.createDefaultCheckedCaptureFunction(),C.saveScope(this.id,this.latestScope);const c=ye(this.latestScope),h=c.keys,p=c.keySig;let u,d;p===this._lastRawScopeKeySig?(u=this._lastSortedKeys,d=this._lastSortedScopeKeySig):(u=h.length>1?[...h].sort():h.slice(),d=u.join("\0"),this._lastRawScopeKeySig=p,this._lastSortedKeys=u,this._lastSortedScopeKeySig=d);const f=be(this.latestScope,u);this.templateFn||(this.templateFn=_e.compile(this.rawTemplate,u));let m=this.templateFn(...f);if(m=this.ownedTemplateManager.resolveOwnedChildren(m,this.ownedChildren),this.lastRenderedHtml!==m){const e=this.startPerfTimer();this.applyDomDiff(m),this.endPerfTimer("domDiff",e),this.lastRenderedHtml=m}if(this.hasEventAttributes(this.el)&&this.pendingEventElements.add(this.el),this.pendingEventElements.size>0){const e=this.pendingEventElements;this.pendingEventElements=new Set;const t=this.startPerfTimer();this.eventManager.bindEvents(e),this.endPerfTimer("bindEvents",t)}const g=this.startPerfTimer();this.bindRefs(u,f,d),this.endPerfTimer("bindRefs",g);const v=this.contextManager.commitRenderContexts(),y=this.startPerfTimer();this.bootstrapNestedComponents(),this.endPerfTimer("bootstrapNested",y);const _=this.startPerfTimer();this.applyPortals(),this.endPerfTimer("portals",_),this.bindControlledInputValues(),this.bindUncontrolledInputDefaults(),this.bindUncontrolledFormResets(),this.bindControlledSelectValues(),this.bindControlledCheckedValues();const x=this.startPerfTimer();this.focusManager.restore(e),this.endPerfTimer("restoreFocus",x);const S=this.startPerfTimer(),b=this.hooksSystem.runLayoutEffects();if(this.endPerfTimer("layoutEffects",S),b)return this.isRendering=!1,void this.render(t+1);this.schedulePassiveEffects(),null!=v&&v.size&&this.refreshContextConsumers(v)}catch(e){console.error("[PP-ERROR] Render Cycle Failed",e)}finally{this.endPerfTimer("total",s),this.isRendering=!1}}schedulePassiveEffects(){const e=++this.passiveEffectsVersion;queueMicrotask(()=>{if(this.passiveEffectsVersion!==e||C.getInstance(this.id)!==this)return;const t=this.startPerfTimer();this.hooksSystem.runEffects(),this.endPerfTimer("effects",t)})}applyDomDiff(e){if(typeof SVGElement<"u"&&this.el instanceof SVGElement){const t=(new DOMParser).parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${e}</svg>`,"image/svg+xml").documentElement,n=document.createDocumentFragment();return Array.from(t.childNodes).forEach(e=>{n.appendChild(document.importNode(e,!0))}),this.domMorpher.morphChildren(this.el,n),void this.invalidateTraversalCache()}const{content:t,placeholders:n}=this.ownedTemplateManager.maskNestedOwnedTemplates(e,this.el.tagName.toLowerCase()),s=He(t,this.el.tagName.toLowerCase()).root;this.ownedTemplateManager.restoreMaskedOwnedTemplates(s,n),this.ownedTemplateManager.materializeTemplateComponentBoundaries(s),this.syncTrackedPortals(s),this.domMorpher.morphChildren(this.el,s),this.invalidateTraversalCache()}isInsideTrackedPortal(e){return this.portalManager.contains(e)}isEffectManagedSurfaceElement(e,t){return this.attributeSyncManager.isEffectManagedSurfaceElement(e,t)}collectEventElements(e){this.traversalManager.collectEventElements(e,this.pendingEventElements)}hasEventAttributes(e){return this.traversalManager.hasEventAttributes(e)}invalidateTraversalCache(){this.traversalManager.invalidate()}getTraversalCache(){return this.traversalManager.getCache()}collectManagedInputs(){return this.traversalManager.collectManagedInputs()}syncAttributes(e,t,n=!1,s=!1){this.attributeSyncManager.syncAttributes(e,t,n,s)}bindRefs(e,t,n){const s=this.getTraversalCache(),i=new Map;for(let r=0;r<s.refElements.length;r++){const a=s.refElements[r],o=a,l=a!==this.el&&a.hasAttribute("pp-component"),c=a.getAttribute("data-pp-ref"),h=a.getAttribute("pp-ref-owner");let p=null;if(c)this.__ppRefStore.has(c)?(a.removeAttribute("data-pp-ref"),this.__ppRefCaptureIdsByElement.set(a,c),p=c):l||(a.removeAttribute("data-pp-ref"),this.__ppRefCaptureIdsByElement.set(a,c),p=c);else{const e=this.__ppRefCaptureIdsByElement.get(a);e&&this.__ppRefStore.has(e)?p=e:e&&this.__ppRefCaptureIdsByElement.delete(a)}if(p){const e=this.resolveCapturedRefValue(p,h);if("function"==typeof e||e&&"object"==typeof e&&"current"in e){const t=this.refBindingManager.ensureBindingId(o,"captured");i.set(t,{element:a,value:e})}else c&&p.startsWith(`ppref_${this.id}_`)&&console.warn(`[PP-WARN] Missing captured ref for id="${p}"`)}const u=a.getAttribute("pp-ref");let d=u;if(d=u||(this.__ppRefExprsByElement.get(a)||null),!d)continue;const f=this.resolvePlainRefValue(d,e,t,n);if("function"==typeof f||f&&"object"==typeof f&&"current"in f){u&&a.removeAttribute("pp-ref"),this.__ppRefExprsByElement.set(a,d);const e=this.refBindingManager.ensureBindingId(o,"plain");i.set(e,{element:a,value:f});continue}u&&l||(u&&(a.removeAttribute("pp-ref"),this.__ppRefExprsByElement.set(a,d)),Object.prototype.hasOwnProperty.call(this.latestScope,d)||console.warn(`[PP-WARN] Could not resolve pp-ref="${d}"`))}this.refBindingManager.commit(i)}bindControlledSelectValues(){const e=this.collectManagedInputs();this.formControlManager.bindControlledSelectValues(e,this.__ppSelectValueStore)}bindControlledCheckedValues(){const e=this.collectManagedInputs();this.formControlManager.bindControlledCheckedValues(e,this.__ppCheckedValueStore)}bindControlledInputValues(){const e=this.collectManagedInputs();this.formControlManager.bindControlledInputValues(e,this.__ppInputValueStore)}bindUncontrolledInputDefaults(){const e=this.collectManagedInputs();for(let t=0;t<e.length;t++){const n=e[t];if(n.__ppManagedInputMounted)this.formControlManager.resolveDefaultValueBinding(n,this.__ppDefaultValueStore),n instanceof HTMLInputElement&&this.formControlManager.resolveDefaultCheckedBinding(n,this.__ppDefaultCheckedStore);else{const e=this.formControlManager.resolveDefaultValueBinding(n,this.__ppDefaultValueStore);if(void 0!==e&&this.formControlManager.applyUncontrolledDefaultValue(n,e),n instanceof HTMLInputElement){const e=this.formControlManager.resolveDefaultCheckedBinding(n,this.__ppDefaultCheckedStore);void 0!==e&&this.formControlManager.applyUncontrolledDefaultChecked(n,e)}}n.__ppManagedInputMounted=!0}}bindUncontrolledFormResets(){const e=this.collectManagedInputs();this.formControlManager.syncUncontrolledFormResets(this.id,e,()=>this.collectManagedInputs())}bootstrapNestedComponents(){this.nestedBoundaryManager.bootstrap()}materializeNestedBoundaryFormDefaults(e){this.formControlManager.materializeNestedBoundaryFormDefaults(e,{inputValueStore:this.__ppInputValueStore,defaultValueStore:this.__ppDefaultValueStore,defaultCheckedStore:this.__ppDefaultCheckedStore})}forceUpdate(){this.lastRenderedHtml="",this.render()}destroyNestedComponents(){const e=C.getDescendantIds(this.id),t=new Set;e.forEach(e=>{var n;if(t.has(e))return;t.add(e);const s=C.getInstance(e);s&&s!==this&&(null==(n=s.destroy)||n.call(s))})}destroy(){this.destroyNestedComponents(),this.formControlManager.clearResetHandlers(this.id),this.hooksSystem.dispose(),this.refBindingManager.clearAll(),this.portalManager.destroyAll();const e=this.contextManager.destroy();this.eventManager.clearCache(),C.removeState(this.id),C.removeScope(this.id),C.removeTemplate(this.id),C.removeOwnedTemplates(this.id),C.removeInstance(this.id),this.contextManager.refreshConsumers(e)}};d(D,"MAX_SYNC_RERENDERS",25),d(D,"perfEnabled",!1),d(D,"perfStats",new Map);let he=D;const Or="opacity 0.18s ease-out",It=15e3,Rt={bootstrap:()=>{Array.from(document.querySelectorAll("[pp-component]")).filter(e=>{var t;return!(null!=(t=e.parentElement)&&t.closest("[pp-component]"))}).forEach(e=>{new he(e)})}},xe=class e{constructor(){d(this,"activeAbortController",null),d(this,"navigationEnabled",!1),d(this,"boundHandleLinkClick",null),d(this,"boundHandlePopState",null),d(this,"boundHandleTrackedScroll",null),d(this,"isNavigating",!1),d(this,"pendingHistoryStateSaveTimer",null),d(this,"lastHistoryStateSaveAt",0),d(this,"pendingProgrammaticScrollPersistenceTimer",null),d(this,"RESET_SCROLL_ATTR","pp-reset-scroll"),d(this,"HISTORY_SCROLL_STATE_KEY","__ppScrollPositions"),d(this,"TRACKED_SCROLL_PERSISTENCE_INTERVAL_MS",150),d(this,"PROGRAMMATIC_SCROLL_SETTLE_MS",120),d(this,"mounted",!1),d(this,"suppressTrackedScrollPersistence",!1),d(this,"transitionLockCount",0),d(this,"pendingRevealFrame",null),d(this,"pendingTransitionUnlockFrame",null),d(this,"hydrationBodySnapshot",null),d(this,"previousHistoryScrollRestoration",null)}mount(){this.mounted||(this.mounted=!0,this.warnAboutOrphanPulsePointScripts(),this.disableTransitions(),this.hideBodyForHydration(!0),Rt.bootstrap(),this.scheduleHydrationReveal(),this.enableSPANavigation())}createComponentRuntime(t){const n={};for(const t of e.PUBLIC_METHODS){const e=this[t];"function"==typeof e?n[t]=e.bind(this):void 0!==e&&(n[t]=e)}return Object.assign({},n,t)}warnAboutOrphanPulsePointScripts(){const e=Array.from(document.querySelectorAll('script[type="text/pp"]')).filter(e=>!e.closest("[pp-component]"));0!==e.length&&console.warn(`[PP-WARN] Found ${e.length} PulsePoint script${1===e.length?"":"s"} outside a pp-component root. Keep component scripts inside the single component root so they can participate in render scope.`)}createContext(e){return Mr(e)}enablePerf(){he.setPerfEnabled(!0)}disablePerf(){he.setPerfEnabled(!1)}getPerfStats(){return he.getPerfStats()}resetPerfStats(){he.resetPerfStats()}getCsrfToken(){const e=window.location.port?[`pp_csrf_${window.location.port}`,"pp_csrf"]:["pp_csrf"];for(const t of e){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=document.cookie.match(new RegExp(`(?:^|;\\s*)${e}=([^;]*)`));if(n)return decodeURIComponent(n[1])}return""}resolveRpcUrl(e){const t=window.location.pathname.replace(/\/+$/,"")||"/";return new URL(e??t,window.location.origin)}resolveRpcCredentials(e,t){return t||(e.origin===window.location.origin?"same-origin":"include")}async ensureCsrfToken(e,t,n){let s=this.getCsrfToken();if(""!==s||"omit"===t)return s;const i=new URL(n??e.toString(),window.location.origin);return await fetch(i.toString(),{method:"GET",credentials:t,cache:"no-store",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"text/html, application/json, */*"}}),s=this.getCsrfToken(),s}disableTransitions(){if(this.transitionLockCount+=1,document.getElementById("pp-disable-transitions"))return;const e=document.createElement("style");e.id="pp-disable-transitions",e.textContent="\n *, *::before, *::after {\n transition: none !important;\n animation: none !important;\n }\n ",document.head.insertBefore(e,document.head.firstChild)}enableTransitions(e=!1){if(e?this.transitionLockCount=0:this.transitionLockCount>0&&(this.transitionLockCount-=1),this.transitionLockCount>0)return;const t=document.getElementById("pp-disable-transitions");t&&t.remove()}requestFrame(e){return"function"==typeof requestAnimationFrame?requestAnimationFrame(e):window.setTimeout(()=>e(performance.now()),16)}cancelFrame(e){"function"!=typeof cancelAnimationFrame?window.clearTimeout(e):cancelAnimationFrame(e)}cancelScheduledHydrationReveal(){null!==this.pendingRevealFrame&&(this.cancelFrame(this.pendingRevealFrame),this.pendingRevealFrame=null),null!==this.pendingTransitionUnlockFrame&&(this.cancelFrame(this.pendingTransitionUnlockFrame),this.pendingTransitionUnlockFrame=null)}cancelPendingProgrammaticScrollPersistence(){null!==this.pendingProgrammaticScrollPersistenceTimer&&(window.clearTimeout(this.pendingProgrammaticScrollPersistenceTimer),this.pendingProgrammaticScrollPersistenceTimer=null)}beginProgrammaticScrollPersistencePause(){this.suppressTrackedScrollPersistence=!0,this.cancelPendingHistoryStateSave(),this.cancelPendingProgrammaticScrollPersistence()}scheduleProgrammaticScrollPersistence(){this.suppressTrackedScrollPersistence&&(this.cancelPendingProgrammaticScrollPersistence(),this.pendingProgrammaticScrollPersistenceTimer=window.setTimeout(()=>{this.pendingProgrammaticScrollPersistenceTimer=null,this.suppressTrackedScrollPersistence=!1,this.persistCurrentHistoryScrollState()},this.PROGRAMMATIC_SCROLL_SETTLE_MS))}scrollElementIntoView(e){this.beginProgrammaticScrollPersistencePause(),e.scrollIntoView({behavior:"smooth"}),this.scheduleProgrammaticScrollPersistence()}normalizeHydrationBodySnapshotStyle(e){var t;if(null===e)return null;const n=document.createElement("div");n.setAttribute("style",e),"0"===n.style.opacity&&n.style.removeProperty("opacity"),"none"===n.style.pointerEvents&&n.style.removeProperty("pointer-events"),"none"===n.style.userSelect&&n.style.removeProperty("user-select"),n.style.transition.replace(/\s+/g," ").trim().toLowerCase()===Or&&n.style.removeProperty("transition");const s=(null==(t=n.getAttribute("style"))?void 0:t.trim())??"";return""===s?null:s}hideBodyForHydration(e=!1){if(!this.hydrationBodySnapshot){const t=document.body.getAttribute("style");this.hydrationBodySnapshot={style:e?this.normalizeHydrationBodySnapshotStyle(t):t,hadAriaBusy:document.body.hasAttribute("aria-busy"),ariaBusy:document.body.getAttribute("aria-busy"),hadInert:document.body.hasAttribute("inert"),inert:document.body.getAttribute("inert")}}document.body.style.opacity="0",document.body.style.pointerEvents="none",document.body.style.userSelect="none",document.body.setAttribute("aria-busy","true"),document.body.setAttribute("inert","")}scheduleHydrationReveal(e){this.cancelScheduledHydrationReveal(),this.pendingRevealFrame=this.requestFrame(()=>{this.pendingRevealFrame=null,this.restoreBodyAccessibility(),null==e||e(),this.pendingTransitionUnlockFrame=this.requestFrame(()=>{this.pendingTransitionUnlockFrame=null,this.enableTransitions(!0)})})}restoreBodyAccessibility(){const e=this.hydrationBodySnapshot;if(!e)return document.body.style.removeProperty("transition"),document.body.style.removeProperty("opacity"),document.body.style.removeProperty("pointer-events"),document.body.style.removeProperty("user-select"),document.body.removeAttribute("inert"),void document.body.removeAttribute("aria-busy");null===e.style?document.body.removeAttribute("style"):document.body.setAttribute("style",e.style),e.hadInert?document.body.setAttribute("inert",e.inert??""):document.body.removeAttribute("inert"),e.hadAriaBusy?document.body.setAttribute("aria-busy",e.ariaBusy??""):document.body.removeAttribute("aria-busy"),this.hydrationBodySnapshot=null}static resetInstance(){this.instance&&(this.instance.navigationEnabled&&this.instance.disableSPANavigation(),this.instance.cancelScheduledHydrationReveal(),this.instance.restoreBodyAccessibility(),this.instance.enableTransitions(!0),this.instance.mounted=!1,this.instance.activeAbortController&&(this.instance.activeAbortController.abort(),this.instance.activeAbortController=null),this.instance=null)}static getInstance(){return this.instance||(this.instance=new e),this.instance}enableSPANavigation(){this.navigationEnabled||(this.navigationEnabled=!0,this.boundHandleLinkClick=this.handleLinkClick.bind(this),this.boundHandlePopState=this.handlePopState.bind(this),this.boundHandleTrackedScroll=this.handleTrackedScroll.bind(this),"scrollRestoration"in history&&(this.previousHistoryScrollRestoration=history.scrollRestoration,history.scrollRestoration="manual"),document.addEventListener("click",this.boundHandleLinkClick),window.addEventListener("popstate",this.boundHandlePopState),document.addEventListener("scroll",this.boundHandleTrackedScroll,!0),window.addEventListener("scroll",this.boundHandleTrackedScroll,{passive:!0}),this.persistCurrentHistoryScrollState())}disableSPANavigation(){this.navigationEnabled=!1,this.suppressTrackedScrollPersistence=!1,this.boundHandleLinkClick&&(document.removeEventListener("click",this.boundHandleLinkClick),this.boundHandleLinkClick=null),this.boundHandlePopState&&(window.removeEventListener("popstate",this.boundHandlePopState),this.boundHandlePopState=null),this.boundHandleTrackedScroll&&(document.removeEventListener("scroll",this.boundHandleTrackedScroll,!0),window.removeEventListener("scroll",this.boundHandleTrackedScroll),this.boundHandleTrackedScroll=null),this.cancelPendingHistoryStateSave(),this.cancelPendingProgrammaticScrollPersistence(),null!==this.previousHistoryScrollRestoration&&"scrollRestoration"in history&&(history.scrollRestoration=this.previousHistoryScrollRestoration,this.previousHistoryScrollRestoration=null)}handleLinkClick(e){if(!this.navigationEnabled)return;const t=this.getNavigationTarget(e.target);if(!t)return;const n=t.closest("a");if(n&&n.href)try{const t=new URL(n.href),s=t.origin!==window.location.origin,i=t.pathname===window.location.pathname&&t.search===window.location.search,r="false"===n.getAttribute("pp-spa");if(s||"_blank"===n.target||n.hasAttribute("download")||r||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;if(e.preventDefault(),i){const n=t.hash;if(n){e.preventDefault(),this.persistCurrentHistoryScrollState(),history.pushState(this.buildHistoryState(),"",t.pathname+t.search+n);const s=document.querySelector(n);return void(s&&this.scrollElementIntoView(s))}}this.navigateTo(t.pathname+t.search+t.hash)}catch(e){console.error("Link click navigation error:",e)}}getNavigationTarget(e){return e instanceof Element?e:e instanceof Node?e.parentElement:null}handleTrackedScroll(){if(!this.navigationEnabled||this.isNavigating)return;if(this.suppressTrackedScrollPersistence)return void this.scheduleProgrammaticScrollPersistence();const e=Date.now()-this.lastHistoryStateSaveAt;if(e>=this.TRACKED_SCROLL_PERSISTENCE_INTERVAL_MS)return this.cancelPendingHistoryStateSave(),void this.persistCurrentHistoryScrollState();null===this.pendingHistoryStateSaveTimer&&(this.pendingHistoryStateSaveTimer=window.setTimeout(()=>{this.pendingHistoryStateSaveTimer=null,this.persistCurrentHistoryScrollState()},this.TRACKED_SCROLL_PERSISTENCE_INTERVAL_MS-e))}async handlePopState(e){const t=this.getCurrentUrl(),n=this.getScrollPositionsFromHistoryState(e.state);await this.navigateTo(t,!1,n)}async navigateTo(e,t=!0,n=null){this.cancelPendingHistoryStateSave(),this.cancelPendingProgrammaticScrollPersistence(),this.suppressTrackedScrollPersistence=!1,this.isNavigating=!0;try{this.dispatchNavigationEvent("start",e),await this.showLoadingTransition();const s=await this.fetchPageContent(e);if("hardReload"in s)return void(window.location.href=s.hardReload);if("redirect"in s)return void await this.navigateTo(s.redirect,t,n);const i=s,r=t?this.saveScrollPositions():null;this.updateBrowserHistory(e,t,r),this.disableTransitions(),this.hideBodyForHydration();const a=document.getElementById("loading-file-1B87E"),o="startViewTransition"in document,l=this.getResetScrollConfig(i);!a&&o?await this.updatePageContentWithViewTransition(i):await this.updatePageContent(i),this.resetGlobalCaches(),Rt.bootstrap(),this.handleScrollRestoration(t?r:n,l,t?"push":"history"),await this.handleNavigationCompletion(),this.dispatchNavigationEvent("complete",e)}catch(t){this.handleNavigationError(e,t)}finally{this.isNavigating=!1}}resetGlobalCaches(){C.clear(),Q.clearCaches(),_e.clearCache()}getResetScrollConfig(e){if("true"===e.body.getAttribute(this.RESET_SCROLL_ATTR))return{mode:"global",resetElementKeys:new Set,resetWindow:!1};const t=e.querySelectorAll(`[${this.RESET_SCROLL_ATTR}]`),n=new Set;let s=!1;if(t.length>0)for(const e of Array.from(t))if("true"===e.getAttribute(this.RESET_SCROLL_ATTR)){const t=this.getElementKeyFromElement(e);n.add(t),s=!0}return s||n.size>0?{mode:"none",resetElementKeys:n,resetWindow:s}:{mode:"none",resetElementKeys:new Set,resetWindow:!1}}getElementKeyFromElement(e){return e.id?e.id:e.className?e.className:e.tagName}handleScrollRestoration(e,t,n){requestAnimationFrame(()=>{if("global"===t.mode)return window.scrollTo(0,0),document.documentElement.scrollTop=0,document.documentElement.scrollLeft=0,void document.querySelectorAll("*").forEach(e=>{(e.scrollTop||e.scrollLeft)&&(e.scrollTop=0,e.scrollLeft=0)});if("history"!==n||t.resetWindow||null==e||!e.window)window.scrollTo(0,0),document.documentElement.scrollTop=0,document.documentElement.scrollLeft=0;else{const t=null==e?void 0:e.window;t&&window.scrollTo(t.scrollLeft,t.scrollTop)}document.querySelectorAll("*").forEach(s=>{const i=s.tagName.toLowerCase();if("html"===i||"body"===i)return;const r=this.getElementKey(s),a="history"===n||"push"===n&&!t.resetElementKeys.has(r)?null==e?void 0:e[r]:null;t.resetElementKeys.has(r)?(s.scrollTop=0,s.scrollLeft=0):a&&(s.scrollTop=a.scrollTop,s.scrollLeft=a.scrollLeft)})})}saveScrollPositions(){const e={window:{scrollTop:window.scrollY||document.documentElement.scrollTop,scrollLeft:window.scrollX||document.documentElement.scrollLeft}};return document.querySelectorAll("*").forEach(t=>{(t.scrollTop||t.scrollLeft)&&(e[this.getElementKey(t)]={scrollTop:t.scrollTop,scrollLeft:t.scrollLeft})}),e}getElementKey(e){return e.id||e.className||e.tagName}cancelPendingHistoryStateSave(){null!==this.pendingHistoryStateSaveTimer&&(window.clearTimeout(this.pendingHistoryStateSaveTimer),this.pendingHistoryStateSaveTimer=null)}buildHistoryState(e){const t=history.state,n=t&&"object"==typeof t&&!Array.isArray(t)?{...t}:{};return e?n[this.HISTORY_SCROLL_STATE_KEY]=e:delete n[this.HISTORY_SCROLL_STATE_KEY],n}getScrollPositionsFromHistoryState(e){if(!e||"object"!=typeof e||Array.isArray(e))return null;const t=e[this.HISTORY_SCROLL_STATE_KEY];return!t||"object"!=typeof t||Array.isArray(t)?null:t}persistCurrentHistoryScrollState(e=this.saveScrollPositions()){this.lastHistoryStateSaveAt=Date.now(),history.replaceState(this.buildHistoryState(e),"",this.getCurrentUrl())}getCurrentUrl(){return window.location.pathname+window.location.search+window.location.hash}teardownCurrentPageComponents(){C.destroyAll()}async updatePageContentWithViewTransition(e){e.title&&(document.title=e.title);const t=e.body.innerHTML;if(this.syncBodyAttributes(e.body),this.teardownCurrentPageComponents(),this.isNavigating||!document.startViewTransition)return void(document.body.innerHTML=t);const n=document.startViewTransition(()=>{document.body.innerHTML=t});try{await n.finished}catch(e){console.warn("View transition failed, continuing anyway:",e)}}dispatchNavigationEvent(e,t,n){const s=`pp:navigation:${e}`,i=n?{url:t,error:n}:{url:t};document.dispatchEvent(new CustomEvent(s,{detail:i}))}async showLoadingTransition(){const e=document.getElementById("loading-file-1B87E");if(e){const t=this.findLoadingElement(e,window.location.pathname);if(t)return void await this.updateContentWithTransition(t)}const t=document.querySelector("[pp-loading-content='true']")||document.body;t&&!("startViewTransition"in document)&&await this.fadeOut(t,250)}async fetchPageContent(e){const t=new URL(e,window.location.origin).hash,n=new AbortController,s=window.setTimeout(()=>{n.abort()},It);let i;try{i=await fetch(e,{signal:n.signal,headers:{"X-Requested-With":"XMLHttpRequest","X-PP-Navigation":"true","X-PulsePoint-Wire":"true",Accept:"text/html"}})}catch(t){throw t instanceof Error&&"AbortError"===t.name?new Error(`Navigation timed out after ${Math.round(15)}s: ${e}`):t}finally{window.clearTimeout(s)}if(!i.ok)throw new Error(`Navigation failed: ${i.status} ${i.statusText}`);const r=i.headers.get("X-PP-Root-Layout"),a=document.querySelector('meta[name="pp-root-layout"]'),o=a?a.getAttribute("content"):null;if(r&&o&&r!==o)return{hardReload:e};if(i.redirected){const n=this.normalizeServerRedirectTarget(i.url);if(!n)return{hardReload:e};const s=new URL(n,window.location.origin);if(t&&s.searchParams.has("next")){const e=s.searchParams.get("next");e&&!e.includes("#")&&s.searchParams.set("next",e+t)}return{redirect:s.pathname+s.search+s.hash}}const l=this.getRedirectUrlFromResponse(i);if(l)return{redirect:l};const c=await i.text();return(new DOMParser).parseFromString(c,"text/html")}normalizeServerRedirectTarget(e){if(!e)return null;try{const t=new URL(e,window.location.href);return t.origin!==window.location.origin?(console.warn("Ignoring cross-origin redirect target from server response:",e),null):t.pathname+t.search+t.hash}catch(t){return console.warn("Ignoring invalid redirect target from server response:",e,t),null}}getRedirectUrlFromResponse(e){const t=e.headers.get("X-PP-Redirect"),n=this.normalizeServerRedirectTarget(t);if(n)return n;const s=e.headers.get("Location"),i=e.status;return s&&i>=300&&i<400?this.normalizeServerRedirectTarget(s):null}updateBrowserHistory(e,t,n=null){t&&(this.persistCurrentHistoryScrollState(n??void 0),history.pushState(this.buildHistoryState(),"",e))}async updatePageContent(e){e.title&&(document.title=e.title);const t=e.body;this.syncBodyAttributes(t),this.teardownCurrentPageComponents(),document.body.innerHTML=t.innerHTML}syncBodyAttributes(e){e&&(Array.from(document.body.attributes).forEach(e=>{"style"!==e.name&&document.body.removeAttribute(e.name)}),Array.from(e.attributes).forEach(e=>{"style"!==e.name&&document.body.setAttribute(e.name,e.value)}))}async handleNavigationCompletion(){const e=document.querySelector("[pp-loading-content='true']")||document.body,t=window.location.hash;this.scheduleHydrationReveal(()=>{if(this.fadeIn(e,150),t){const e=document.querySelector(t);e&&this.scrollElementIntoView(e)}})}handleNavigationError(e,t){console.error("Navigation error:",t),this.restoreBodyAccessibility(),this.enableTransitions(!0),this.dispatchNavigationEvent("error",e,t),window.location.href=e}findLoadingElement(e,t){let n=t;for(;;){const t=e.querySelector(`div[pp-loading-url='${n}']`);if(t)return t;if("/"===n)break;const s=n.lastIndexOf("/");n=s<=0?"/":n.substring(0,s)}return e.querySelector("div[pp-loading-url='/' ]")}async updateContentWithTransition(e){const t=document.querySelector("[pp-loading-content='true']")||document.body;if(!t)return;const{fadeIn:n,fadeOut:s}=this.parseTransition(e);await this.fadeOut(t,s),t.innerHTML=e.innerHTML,this.fadeIn(t,n)}parseTransition(e){let t=250,n=250;const s=e.querySelector("[pp-loading-transition]"),i=null==s?void 0:s.getAttribute("pp-loading-transition");if(i){let e=JSON.parse(i);e&&"object"==typeof e?(t=this.parseTime(e.fadeIn??t),n=this.parseTime(e.fadeOut??n)):console.warn("pp-loading-transition is not valid JSON → default values (250 ms) will be used. String:",i)}return{fadeIn:t,fadeOut:n}}fadeOut(e,t){return new Promise(n=>{e.style.transition=`opacity ${t}ms ease-out`,setTimeout(()=>{e.style.transition="",n()},t)})}fadeIn(e,t){e.style.transition=`opacity ${t}ms ease-in`,setTimeout(()=>{e.style.transition=""},t)}parseTime(e){if("number"==typeof e)return e;const t=e.match(/^(\d+)(ms|s|m)?$/);if(t){const e=parseInt(t[1],10);switch(t[2]||"ms"){case"ms":default:return e;case"s":return 1e3*e;case"m":return 60*e*1e3}}return 0}async redirect(e){if(e)try{const t=new URL(e,window.location.origin);t.origin!==window.location.origin?window.location.href=e:this.navigationEnabled?await this.navigateTo(t.pathname+t.search+t.hash):window.location.href=e}catch(e){console.error("Redirect error:",e)}}async rpc(e,t={},n=!1){let s=null;const i="boolean"==typeof n?{abortPrevious:n}:n;try{i.abortPrevious&&this.activeAbortController&&(this.activeAbortController.abort(),this.activeAbortController=null),s=new AbortController,i.abortPrevious&&(this.activeAbortController=s);const n=this.resolveRpcUrl(i.url),r=this.resolveRpcCredentials(n,i.credentials),a={"X-CSRF-Token":await this.ensureCsrfToken(n,r,i.csrfUrl),"X-PP-RPC":"true","X-PulsePoint-Wire":"true","X-PP-Function":e,"X-Requested-With":"XMLHttpRequest",Accept:"application/json, text/event-stream"};let o;if(Object.values(t).some(e=>e instanceof File||e instanceof FileList&&e.length>0)){const e=new FormData;for(const[n,s]of Object.entries(t))s instanceof File?e.append(n,s):s instanceof FileList?Array.from(s).forEach(t=>e.append(n,t)):null!=s&&e.append(n,"object"==typeof s?JSON.stringify(s):String(s));if(i.onUploadProgress)return await this.xhrFunction({url:n.toString(),headers:a,body:e,controller:s,credentials:r,options:i});o={method:"POST",headers:a,body:e,credentials:r,signal:s.signal}}else o={method:"POST",headers:{...a,"Content-Type":"application/json"},body:JSON.stringify(t),credentials:r,signal:s.signal};const l=await fetch(n.toString(),o);if(401===l.status)throw new Error("Authentication required");if(403===l.status)throw new Error("Permission denied");if(!l.ok){const e=await l.json().catch(()=>null);throw e||415!==l.status?new Error((null==e?void 0:e.error)||`Request failed: ${l.status} ${l.statusText}`):new Error("Server rejected data format (415).")}const c=this.getRedirectUrlFromResponse(l);return c?(await this.redirect(c),{redirected:!0,to:c}):(this.activeAbortController===s&&(this.activeAbortController=null),(l.headers.get("Content-Type")||"").includes("text/event-stream")&&l.body?(i.onStream||console.warn("RPC returned a stream, but no onStream handler provided."),void await this.handleStream(l.body,i)):await l.json())}catch(e){if(this.activeAbortController===s&&(this.activeAbortController=null),e instanceof Error&&"AbortError"===e.name)return console.log("Request was cancelled"),{cancelled:!0};if(i.onStreamError)return void i.onStreamError(e);throw console.error("RPC error:",e),e}}xhrFunction(e){const{url:t,headers:n,body:s,controller:i,credentials:r,options:a}=e;return new Promise((e,o)=>{const l=new XMLHttpRequest;l.open("POST",t,!0),l.withCredentials="include"===r;for(const[e,t]of Object.entries(n))l.setRequestHeader(e,t);const c=()=>{try{l.abort()}catch{}};i.signal.addEventListener("abort",c,{once:!0}),l.upload&&a.onUploadProgress&&(l.upload.onprogress=e=>{var t;const n=e.lengthComputable?e.total:null,s=e.lengthComputable&&e.total>0?Math.min(100,Math.max(0,e.loaded/e.total*100)):null;null==(t=a.onUploadProgress)||t.call(a,{loaded:e.loaded,total:n,percent:s})}),l.onerror=()=>{i.signal.removeEventListener("abort",c),o(new Error("Network error (XHR upload)."))},l.onload=async()=>{var t,n;if(i.signal.removeEventListener("abort",c),401===l.status)return o(new Error("Authentication required"));if(403===l.status)return o(new Error("Permission denied"));if(l.status<200||l.status>=300){let e=`Request failed: ${l.status} ${l.statusText}`;try{const t=JSON.parse(l.responseText||"{}");e=(null==t?void 0:t.error)||(null==t?void 0:t.message)||e}catch{}return o(new Error(e))}const s=this.normalizeServerRedirectTarget(l.getResponseHeader("X-PP-Redirect")||(l.status>=300&&l.status<400?l.getResponseHeader("Location"):null));if(s)try{return await this.redirect(s),null==(t=a.onUploadComplete)||t.call(a),e({redirected:!0,to:s})}catch(e){return o(e)}const r=l.responseText??"";let h=r;try{h=JSON.parse(r)}catch{}null==(n=a.onUploadComplete)||n.call(a),e(h)};try{l.send(s)}catch(e){i.signal.removeEventListener("abort",c),o(e)}})}async handleStream(e,t){const n=e.getReader(),s=new TextDecoder;let i="";try{for(;;){const{done:e,value:r}=await n.read();if(e){t.onStreamComplete&&t.onStreamComplete();break}i+=s.decode(r,{stream:!0});const a=i.split("\n");i=a.pop()||"";for(const e of a)if(""!==e.trim()&&e.startsWith("data: ")){const n=e.slice(6);let s=n;try{("true"===n||"false"===n||"null"===n||!isNaN(Number(n))||n.startsWith("{")||n.startsWith("[")||n.startsWith('"'))&&(s=JSON.parse(n))}catch{}t.onStream&&t.onStream(s)}}}catch(e){if(!t.onStreamError)throw e;t.onStreamError(e)}finally{n.releaseLock()}}};d(xe,"instance",null),d(xe,"PUBLIC_METHODS",["createContext","mount","redirect","rpc","enablePerf","disablePerf","getPerfStats","resetPerfStats"]);let ht=xe;function Br(e,t,n=(typeof window<"u"?window:globalThis),s=!0){let i=null;if(Object.defineProperty(n,e,{get(){if(null!==i)return i;if(t&&"object"==typeof t&&!Array.isArray(t)&&"getInstance"in t&&"function"==typeof t.getInstance)return i=t.getInstance(),i;if("function"!=typeof t)return i=t,i;try{return i=t.getInstance(),i}catch{return i=t,i}},set(t){null===t?i=null:console.warn(`Cannot override global ${e}`)},configurable:!0,enumerable:!0}),s)try{n[e]}catch(t){console.error(`Failed to initialize ${e}:`,t)}}Br("pp",{getInstance:()=>ht.getInstance()});export{Rt as ComponentInit,ht as PPUtilities};
|
|
1
|
+
var Ci=Object.defineProperty,Si=(e,t,n)=>t in e?Ci(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t,n)=>Si(e,"symbol"!=typeof t?t+"":t,n);class It{constructor(e,t="unknown"){d(this,"hooks",[]),d(this,"currentIndex",0),d(this,"onStateChange"),d(this,"componentLabel"),d(this,"pendingLayoutEffects",[]),d(this,"pendingEffects",[]),d(this,"currentEffectPhase",null),d(this,"pendingSynchronousRenderUpdate",!1),d(this,"pendingSynchronousLayoutUpdate",!1),d(this,"pendingUpdate",!1),d(this,"hasScheduledRender",!1),d(this,"batchedUpdates",new Set),d(this,"portalRegistrations",[]),d(this,"isRenderWindowOpen",!1),d(this,"warnedHookOutsideRender",!1),d(this,"warnedHookAfterDispose",!1),d(this,"currentHookTypes",[]),d(this,"committedHookTypes",null),d(this,"disposed",!1),this.onStateChange=e,this.componentLabel=t}static setStrictDiagnostics(e){this.strictDiagnostics=e}static getStrictDiagnostics(){return this.strictDiagnostics}loadState(e){this.hooks=[...e]}getHooks(){return this.hooks}prepareRender(){this.disposed||(this.currentIndex=0,this.isRenderWindowOpen=!0,this.warnedHookOutsideRender=!1,this.currentHookTypes=[],this.pendingLayoutEffects=[],this.pendingEffects=[],this.currentEffectPhase=null,this.portalRegistrations=[])}startRenderPhase(){this.disposed||(this.currentEffectPhase="render")}finishRenderPhase(){"render"===this.currentEffectPhase&&(this.currentEffectPhase=null),this.isRenderWindowOpen=!1;const e=this.pendingSynchronousRenderUpdate;return this.pendingSynchronousRenderUpdate=!1,e?(this.batchedUpdates.clear(),!0):(this.validateHookSignature(),!1)}recordHook(e){if(this.disposed)return this.warnedHookAfterDispose||(this.warnedHookAfterDispose=!0,this.emitDiagnostic(`[PP-WARN] ${e} hook for component "${this.componentLabel}" was called after the component was disposed. Hooks cannot be used after destroy.`)),this.currentIndex++;!this.isRenderWindowOpen&&!this.warnedHookOutsideRender&&(this.warnedHookOutsideRender=!0,this.emitDiagnostic(`[PP-WARN] ${e} hook for component "${this.componentLabel}" was called outside an active render. Hooks must be called while the component script is rendering.`));const t=this.currentIndex++;return this.currentHookTypes[t]=e,t}validateHookSignature(){if(null===this.committedHookTypes)return void(this.committedHookTypes=this.currentHookTypes.slice());const e=this.committedHookTypes,t=this.currentHookTypes;e.length===t.length&&e.every((e,n)=>e===t[n])||this.emitDiagnostic(`[PP-WARN] Hook order changed for component "${this.componentLabel}". Previous: [${e.join(", ")}]. Current: [${t.join(", ")}]. Hooks must be called in the same order on every render.`)}runLayoutEffects(){if(this.disposed)return this.pendingLayoutEffects=[],!1;const e=this.pendingLayoutEffects;this.pendingLayoutEffects=[],this.currentEffectPhase="layout";try{e.forEach(e=>{this.runEffectCleanup(e.previousCleanup,"layout cleanup")}),e.forEach(e=>{const t=this.runEffectCallback(e.callback,"layout effect");this.hooks[e.hookIndex]={deps:e.deps,cleanup:"function"==typeof t?t:void 0,effectType:"layout"}})}finally{this.currentEffectPhase=null}const t=this.pendingSynchronousLayoutUpdate;return this.pendingSynchronousLayoutUpdate=!1,t&&this.batchedUpdates.clear(),t}runEffects(){if(this.disposed)return void(this.pendingEffects=[]);const e=this.pendingEffects;this.pendingEffects=[],this.currentEffectPhase="effect";try{e.forEach(e=>{this.runEffectCleanup(e.previousCleanup,"effect cleanup")}),e.forEach(e=>{const t=this.runEffectCallback(e.callback,"effect");this.hooks[e.hookIndex]={deps:e.deps,cleanup:"function"==typeof t?t:void 0,effectType:"effect"}})}finally{this.currentEffectPhase=null}}runEffectCleanup(e,t){if(e)try{e()}catch(e){console.error(`[PP-ERROR] ${t} failed for component "${this.componentLabel}"`,e)}}runEffectCallback(e,t){try{return e()}catch(e){return void console.error(`[PP-ERROR] ${t} failed for component "${this.componentLabel}"`,e)}}dispose(){if(this.disposed)return;this.disposed=!0,this.pendingLayoutEffects=[],this.pendingEffects=[],this.pendingUpdate=!1,this.hasScheduledRender=!1,this.batchedUpdates.clear(),this.portalRegistrations=[];const e=e=>{const t=e.cleanup;if("function"==typeof t)try{t()}finally{e.cleanup=void 0}};this.hooks.forEach(t=>{!t||"object"!=typeof t||"layout"===t.effectType&&e(t)}),this.hooks.forEach(t=>{!t||"object"!=typeof t||"effect"===t.effectType&&e(t)}),this.hooks.forEach(t=>{!t||"object"!=typeof t||t.effectType||e(t)}),this.hooks=[],this.currentIndex=0}usePortal(e,t){const n=this.recordHook("portal");void 0===this.hooks[n]&&(this.hooks[n]={sourceParent:null});const s=this.hooks[n];return this.portalRegistrations.push({ref:e,target:t??null,info:s}),s}getPortalRegistrations(){return this.portalRegistrations}useState(e){const t=this.recordHook("state");void 0===this.hooks[t]&&(this.hooks[t]={__state:this.resolveInitialState(e),__setter:this.createStateSetter(t)});const n=this.hooks[t];("object"!=typeof n||null===n||!("__state"in n))&&(this.hooks[t]={__state:n,__setter:this.createStateSetter(t)});const s=this.hooks[t];return[s.__state,s.__setter]}resolveInitialState(e){return"function"==typeof e?e():e}createStateSetter(e){return t=>{const n=this.hooks[e];if(this.disposed||void 0===n)return;const s="function"==typeof t?t(n.__state):t;Object.is(n.__state,s)||(n.__state=s,this.batchedUpdates.add(e),this.scheduleUpdate())}}scheduleUpdate(){if(!this.disposed){if("render"===this.currentEffectPhase)return void(this.pendingSynchronousRenderUpdate=!0);if("layout"===this.currentEffectPhase)return void(this.pendingSynchronousLayoutUpdate=!0);this.hasScheduledRender=!0,this.pendingUpdate||(this.pendingUpdate=!0,queueMicrotask(()=>{if(this.pendingUpdate=!1,this.disposed)return this.hasScheduledRender=!1,void this.batchedUpdates.clear();this.hasScheduledRender&&(this.hasScheduledRender=!1,this.batchedUpdates.clear(),this.onStateChange())}))}}useRef(e=null){const t=this.recordHook("ref");return void 0===this.hooks[t]&&(this.hooks[t]={current:e}),this.hooks[t]}useMemo(e,t){const n=this.recordHook("memo"),s=this.hooks[n],i=this.normalizeDeps("memo",t);if(!s||!i||!s.deps||this.areDepsDifferent(s.deps,i)){const t=e();return this.hooks[n]={value:t,deps:i},t}return s.value}useCallback(e,t){const n=this.recordHook("callback"),s=this.hooks[n],i=this.normalizeDeps("callback",t);return s&&i&&s.deps&&!this.areDepsDifferent(s.deps,i)?s.callback:(this.hooks[n]={callback:e,deps:i},e)}useReducer(e,t,n){const s=this.recordHook("reducer");if(void 0===this.hooks[s]){const i={state:n?n(t):t,reducer:e,dispatch:null};i.dispatch=e=>{if(this.disposed)return;const t=i.reducer(i.state,e);Object.is(i.state,t)||(i.state=t,this.scheduleUpdate())},this.hooks[s]=i}const i=this.hooks[s];return i.reducer=e,[i.state,i.dispatch]}useEffect(e,t){const n=this.recordHook("effect"),s=this.hooks[n],i=this.normalizeDeps("effect",t);(!s||!i||!s.deps||this.areDepsDifferent(s.deps,i))&&this.pendingEffects.push({hookIndex:n,deps:i,callback:e,previousCleanup:"function"==typeof(null==s?void 0:s.cleanup)?s.cleanup:void 0})}useLayoutEffect(e,t){const n=this.recordHook("layoutEffect"),s=this.hooks[n],i=this.normalizeDeps("layoutEffect",t);(!s||!i||!s.deps||this.areDepsDifferent(s.deps,i))&&this.pendingLayoutEffects.push({hookIndex:n,deps:i,callback:e,previousCleanup:"function"==typeof(null==s?void 0:s.cleanup)?s.cleanup:void 0})}normalizeDeps(e,t){if(void 0!==t){if(Array.isArray(t))return t;this.emitDiagnostic(`[PP-WARN] ${e} dependencies for component "${this.componentLabel}" must be an array or omitted. Received ${this.describeDeps(t)}.`)}}describeDeps(e){var t;return null===e?"null":"object"==typeof e?(null==(t=e.constructor)?void 0:t.name)??"object":typeof e}emitDiagnostic(e){console.warn(e)}areDepsDifferent(e,t){return e.length!==t.length||t.some((t,n)=>!Object.is(t,e[n]))}}d(It,"strictDiagnostics",!1);class C{static saveState(e,t){e&&this.states.set(e,t)}static getState(e){return this.states.get(e)}static removeState(e){this.states.delete(e)}static saveScope(e,t){this.scopes.set(e,t)}static getScope(e){return this.scopes.get(e)}static getRootAncestor(e){let t=e;const n=new Set;for(;t&&!n.has(t);){n.add(t);const e=this.parents.get(t);if(!e)return t;t=e}return null}static resolveComponentId(e,t=null){if(!e)return null;if("app"!==e)return e;const n=new Set;let s=t,i=null;for(;s&&!n.has(s);){if(n.add(s),s.startsWith("page_"))return s;const e=this.parents.get(s)??null;if(!e){i=s;break}s=e}if(i)return i;for(const[e,t]of this.parents.entries())if(null===t&&this.scopes.has(e))return e;const r=this.scopes.keys().next().value;return"string"==typeof r?r:null}static getResolvedScope(e,t=null){const n=this.resolveComponentId(e,t);return n?this.scopes.get(n):void 0}static getResolvedScopeWithAncestors(e,t=null){const n=this.resolveComponentId(e,t);if(!n)return;const s=new Set,i=[];let r=n;for(;r&&!s.has(r);){s.add(r);const e=this.scopes.get(r);e&&i.push(e),r=this.parents.get(r)??null}return 0!==i.length?Object.assign({},...i.reverse()):void 0}static removeScope(e){this.scopes.delete(e)}static registerInstance(e,t){var n;const s=this.instances.get(e);s&&s!==t&&(null==(n=s.destroy)||n.call(s)),this.instances.set(e,t)}static getInstance(e){return this.instances.get(e)}static removeInstance(e){this.instances.delete(e)}static saveParent(e,t){e&&this.parents.set(e,t)}static getParent(e){return this.parents.get(e)}static removeParent(e){if(!this.parents.has(e))return;const t=this.parents.get(e)??null;this.parents.forEach((n,s)=>{n===e&&this.parents.set(s,t)}),this.parents.delete(e)}static getDescendantIds(e){const t=[];return this.parents.forEach((n,s)=>{s!==e&&this.isAncestor(e,s)&&t.push(s)}),t.sort((e,t)=>this.getAncestorDepth(t)-this.getAncestorDepth(e))}static saveContextValues(e,t){const n=this.contextValues.get(e)??new Map,s=new Set;return n.forEach((e,n)=>{t.has(n)||s.add(n)}),t.forEach((e,t)=>{n.has(t)&&Object.is(n.get(t),e)||s.add(t)}),t.size>0?this.contextValues.set(e,new Map(t)):this.contextValues.delete(e),Array.from(s)}static resolveContext(e,t){let n=e;for(;n;){const e=this.contextValues.get(n);if(null!=e&&e.has(t))return{providerId:n,value:e.get(t)};n=this.parents.get(n)??null}return{providerId:null,value:t.defaultValue}}static updateContextDependencies(e,t){const n=new Set(t),s=this.consumerContexts.get(e)??new Set;s.forEach(t=>{n.has(t)||this.removeContextConsumer(t,e)}),n.forEach(t=>{s.has(t)||this.addContextConsumer(t,e)}),n.size>0?this.consumerContexts.set(e,n):this.consumerContexts.delete(e)}static getConsumersForContextsInSubtree(e,t){const n=new Set;for(const s of t){const t=this.contextConsumers.get(s);t&&t.forEach(t=>{t!==e&&this.isAncestor(e,t)&&n.add(t)})}return n}static removeContextTracking(e){const t=this.contextValues.get(e),n=t?this.getConsumersForContextsInSubtree(e,t.keys()):new Set;this.contextValues.delete(e);const s=this.consumerContexts.get(e);return s&&(s.forEach(t=>{this.removeContextConsumer(t,e)}),this.consumerContexts.delete(e)),this.removeParent(e),n}static saveTemplate(e,t){this.templates.has(e)||this.templates.set(e,t)}static getTemplate(e){return this.templates.get(e)}static removeTemplate(e){this.templates.delete(e)}static saveOwnedTemplates(e,t){this.ownedTemplateData.has(e)||this.ownedTemplateData.set(e,t)}static getOwnedTemplates(e){return this.ownedTemplateData.get(e)}static removeOwnedTemplates(e){this.ownedTemplateData.delete(e)}static clear(){this.states.clear(),this.scopes.clear(),this.instances.clear(),this.parents.clear(),this.templates.clear(),this.ownedTemplateData.clear(),this.contextValues.clear(),this.consumerContexts.clear(),this.contextConsumers.clear()}static destroyAll(){var e;const t=Array.from(this.instances.values()),n=new Set;for(const s of t)if(s&&!n.has(s)){n.add(s);try{null==(e=s.destroy)||e.call(s)}catch(e){console.warn("[PP-WARN] Failed to destroy component instance",e)}}}static getStats(){return{states:this.states.size,scopes:this.scopes.size,instances:this.instances.size,parents:this.parents.size,templates:this.templates.size,ownedData:this.ownedTemplateData.size,contextValues:this.contextValues.size,contextConsumers:this.contextConsumers.size}}static addContextConsumer(e,t){const n=this.contextConsumers.get(e)??new Set;n.add(t),this.contextConsumers.set(e,n)}static removeContextConsumer(e,t){const n=this.contextConsumers.get(e);n&&(n.delete(t),0===n.size&&this.contextConsumers.delete(e))}static isAncestor(e,t){let n=this.parents.get(t)??null;for(;n;){if(n===e)return!0;n=this.parents.get(n)??null}return!1}static getAncestorDepth(e){let t=0,n=this.parents.get(e)??null;const s=new Set;for(;n&&!s.has(n);)s.add(n),t+=1,n=this.parents.get(n)??null;return t}}d(C,"states",new Map),d(C,"scopes",new Map),d(C,"instances",new Map),d(C,"parents",new Map),d(C,"templates",new Map),d(C,"ownedTemplateData",new Map),d(C,"contextValues",new Map),d(C,"consumerContexts",new Map),d(C,"contextConsumers",new Map);const lt=new Set(["class","for","while","if","else","return","function","var","let","const","import","export","this","debugger","delete","typeof","void","new","in","instanceof","do","try","catch","finally","switch","case","default","break","continue","yield","await","with","super","enum","extends","implements","interface","package","private","protected","public","static"]),Ei=new Set(["Array","Object","String","Number","Boolean","Math","JSON","Date","RegExp","Error","Map","Set","WeakMap","WeakSet","Promise","Symbol","BigInt","parseInt","parseFloat","isNaN","isFinite","encodeURI","decodeURI","encodeURIComponent","decodeURIComponent","console","window","document","undefined","null","NaN","Infinity","pp","true","false","setTimeout","setInterval","clearTimeout","clearInterval","requestAnimationFrame","cancelAnimationFrame","fetch","alert","confirm","prompt"]),Rt=new Set(["hidden","disabled","checked","selected","readonly","required","open","autofocus","multiple","ismap","noValidate","defer","async","autoplay","controls","loop","muted","default","reversed","scoped","seamless","sortable","translate","draggable","contenteditable","spellcheck"]);function Nt(e){return e.includes("-")?e.replace(/-([a-z])/g,e=>e[1].toUpperCase()):e}const bt=new WeakMap,wi=/^[A-Za-z_$][\w$]*$/;function ki(e){return wi.test(e)&&!lt.has(e)}function ye(e){const t=bt.get(e);if(t)return t;const n=Object.keys(e).filter(ki),s={keys:n,keySig:n.join("\0")};return bt.set(e,s),s}function be(e,t){const n=new Array(t.length);for(let s=0;s<t.length;s++)n[s]=e[t[s]];return n}const ve=new Map,Ai=500;let Qe=null,De=null;function Pi(e){De||(De=document.createElement("template")),De.innerHTML=e;const t=Array.from(De.content.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE?(e.textContent??"").trim().length>0:e.nodeType===Node.ELEMENT_NODE);if(1!==t.length)return null;const n=t[0];return n instanceof HTMLTemplateElement&&n.hasAttribute("pp-owner")?n.innerHTML:null}function Ti(e){let t=B(e),n=!1;for(;;){const e=Pi(t);if(null===e)break;t=e,n=!0}return n?t:null}function Lt(e){if(!e.includes("<textarea"))return e;const t=e.includes("pp-owner"),n=document.createElement("template");n.innerHTML=e;let s=!1;return n.content.querySelectorAll("textarea").forEach(e=>{const n=e;if(t){const e=Ti(n.value);if(null!==e)return n.textContent=e,void(s=!0)}n.value.length>0&&0===n.value.trim().length&&(n.textContent="",s=!0)}),s?n.innerHTML:e}function B(e){if(!e.includes("&"))return e;if(ve.has(e))return ve.get(e);Qe||(Qe=document.createElement("textarea"));const t=Qe;t.innerHTML=e;let n=t.value,s=0;for(;n.includes("&")&&s++<10;){t.innerHTML=n;const e=t.value;if(e===n)break;n=e}if(ve.size>=Ai){const e=ve.keys().next().value;void 0!==e&&ve.delete(e)}return ve.set(e,n),n}const V="data-pp-fragment-root";function Ii(e,t){let n=0,s=t-1;for(;s>=0&&"\\"===e[s];)n++,s--;return n%2!=0}function ht(e,t){if("{"!==e[t])return-1;let n=0,s=null;for(let i=t;i<e.length;i++){const t=e[i],r=Ii(e,i);if(s)t===s&&!r&&(s=null);else if(r||'"'!==t&&"'"!==t&&"`"!==t)if("{"!==t||r){if("}"===t&&!r&&(n--,0===n))return i}else n++;else s=t}return-1}function K(e){let t=0;for(;t<e.length&&/\s/.test(e[t]);)t++;if("{"!==e[t])return null;const n=ht(e,t);if(-1===n)return null;let s=n+1;for(;s<e.length&&/\s/.test(e[s]);)s++;return s!==e.length?null:{expression:e.slice(t+1,n).trim(),start:t,end:n}}function Ri(e,t){let n="",s=0;for(;s<e.length;){if("{"!==e[s]){n+=e[s],s++;continue}const i=ht(e,s);if(-1===i){n+=e.slice(s);break}const r=e.slice(s+1,i);n+=t(r.trim(),r),s=i+1}return n}function Vt(e){const t=String(e??"").trim().toLowerCase();switch(t){case"table":return{prefix:`<table ${V}="">`,suffix:"</table>",rootSelector:`table[${V}]`};case"caption":return{prefix:`<table><caption ${V}="">`,suffix:"</caption></table>",rootSelector:`caption[${V}]`};case"thead":case"tbody":case"tfoot":return{prefix:`<table><${t} ${V}="">`,suffix:`</${t}></table>`,rootSelector:`${t}[${V}]`};case"tr":return{prefix:`<table><tbody><tr ${V}="">`,suffix:"</tr></tbody></table>",rootSelector:`tr[${V}]`};case"td":case"th":return{prefix:`<table><tbody><tr><${t} ${V}="">`,suffix:`</${t}></tr></tbody></table>`,rootSelector:`${t}[${V}]`};case"colgroup":return{prefix:`<table><colgroup ${V}="">`,suffix:"</colgroup></table>",rootSelector:`colgroup[${V}]`};case"select":return{prefix:`<select ${V}="">`,suffix:"</select>",rootSelector:`select[${V}]`};case"optgroup":return{prefix:`<select><optgroup ${V}="">`,suffix:"</optgroup></select>",rootSelector:`optgroup[${V}]`};case"option":return{prefix:`<select><option ${V}="">`,suffix:"</option></select>",rootSelector:`option[${V}]`};default:return{prefix:"",suffix:"",rootSelector:null}}}function Ni(e){const t=Vt(e);return{wrap:e=>`${t.prefix}${e}${t.suffix}`,unwrap:e=>{if(!t.prefix&&!t.suffix)return e;const n=document.createElement("template");if(n.innerHTML=e,t.rootSelector){const e=n.content.querySelector(t.rootSelector);if(e)return e.innerHTML}return e}}}function Be(e,t){const n=Vt(t),s=document.createElement("template");if(s.innerHTML=Lt(`${n.prefix}${e}${n.suffix}`),!n.rootSelector)return{root:s.content,toHtml:()=>s.innerHTML};const i=s.content.querySelector(n.rootSelector);return i?(i.removeAttribute(V),{root:i,toHtml:()=>i.innerHTML}):{root:s.content,toHtml:()=>s.innerHTML}}function Li(e,t){if(e===t)return!0;if(!e||!t||"object"!=typeof e||"object"!=typeof t)return!1;const n=Object.keys(e),s=n.length;let i=0;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&(i++,i>s))return!1;if(i!==s)return!1;for(let i=0;i<s;i++){const s=n[i];if(e[s]!==t[s])return!1}return!0}const qe=class e{constructor(e,t,n){d(this,"root"),d(this,"getScope"),d(this,"canBindElement"),d(this,"handlerCache",new Map),this.root=e,this.getScope=t,this.canBindElement=n??(e=>this.isRootOwnedElement(e))}clearCache(){this.handlerCache.clear()}resolveEventOwnerScope(e){const t=this.root.getAttribute("pp-component");return C.getResolvedScopeWithAncestors(e,t)}bindEvents(e){(e||this.fallbackCollectEventElements()).forEach(e=>{this.canBindElement(e)&&this.bindElementEvents(e)})}isRootOwnedElement(e){var t;if(e===this.root)return!0;let n=e.closest("[pp-component]");return e===n&&(n=(null==(t=e.parentElement)?void 0:t.closest("[pp-component]"))??null),n===this.root}bindElementEvents(e){const t=e.getAttribute("pp-event-owner");t&&e.removeAttribute("pp-event-owner");const n=[];Array.from(e.attributes).forEach(s=>{if(s.name.startsWith("on")&&!s.name.includes("-")){const i=s.name.slice(2).toLowerCase();let r=s.value.trim();const a=r.match(/^\{([\s\S]*)\}$/);a&&(r=a[1].trim()),n.push(s.name),this.getNativeEventNames(e,i).forEach(n=>{const s=`__pp_bound_${n}`;if(e[s]===r)return;e[s]=r;const i=e[`__pp_handler_${n}`];i&&e.removeEventListener(n,i);const a=s=>{var i;if(this.shouldPreserveNativeSelection(e,n)){const t=e;t.__ppPreserveNativeSelectionOnNextRender=!0,queueMicrotask(()=>{t.__ppPreserveNativeSelectionOnNextRender&&delete t.__ppPreserveNativeSelectionOnNextRender})}if(t){const n=this.resolveEventOwnerScope(t);if(n)return void this.executeHandlerWithScope(r,s,n,e)}let a=e.closest("[pp-component]");a===e&&(a=(null==(i=e.parentElement)?void 0:i.closest("[pp-component]"))??null);const o=(null==a?void 0:a.getAttribute("pp-component"))||null;if(o){const t=this.resolveEventOwnerScope(o);if(t)return void this.executeHandlerWithScope(r,s,t,e)}this.executeHandler(r,s,e)};e[`__pp_handler_${n}`]=a,e.addEventListener(n,a)})}}),n.forEach(t=>{e.removeAttribute(t)})}getNativeEventNames(e,t){return"input"===t&&e instanceof HTMLInputElement&&this.isDateLikeInput(e)?["change","blur"]:[t]}isDateLikeInput(t){return e.DATE_LIKE_INPUT_TYPES.has(t.type)}shouldPreserveNativeSelection(e,t){return"input"===t&&(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&["text","search","url","tel","password"].includes(e.type))}fallbackCollectEventElements(){const e=new Set,t=this.root.attributes;for(let n=0;n<t.length;n++)if(t[n].name.startsWith("on")&&!t[n].name.includes("-")){e.add(this.root);break}const n=this.root.querySelectorAll("*");for(let t=0;t<n.length;t++){const s=n[t],i=s.attributes;for(let t=0;t<i.length;t++)if(i[t].name.startsWith("on")&&!i[t].name.includes("-")){e.add(s);break}}return e}executeHandler(e,t,n){const s=this.root.getAttribute("pp-component"),i=this.resolveEventOwnerScope(s)||this.getScope();this.executeHandlerWithScope(e,t,i,n)}executeHandlerWithScope(e,t,n,s){const i=ye(n),r=i.keys,a=be(n,r);try{const n=this.getCompiledHandler(e,r,i.keySig).call(s??t.currentTarget??null,...a,t);"function"==typeof n&&n(t)}catch(t){console.error("[PP-ERROR] Handler failed:",t),console.error("Code:",e)}}getCompiledHandler(e,t,n){const s=e+"|"+n;if(!this.handlerCache.has(s)){if(this.handlerCache.size>500){const e=this.handlerCache.keys().next().value;e&&this.handlerCache.delete(e)}const n="\n const e = event;\n const $event = event;\n const target = event?.target;\n const currentTarget = event?.currentTarget;\n const el = event?.currentTarget;\n ";let i;try{i=new Function(...t,"event",`"use strict";${n} return (${e})`)}catch{i=new Function(...t,"event",`"use strict";${n} ${e}`)}this.handlerCache.set(s,i)}return this.handlerCache.get(s)}};d(qe,"DATE_LIKE_INPUT_TYPES",new Set(["date","datetime-local","month","time","week"]));let st=qe;var Vi=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],Mt=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],Mi="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",Dt="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ꟑꟑꟓꟕ-ꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Ze={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},Je="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",Di={5:Je,"5module":Je+" export import",6:Je+" const class extends export import super"},Oi=/^in(stanceof)?$/,Bi=new RegExp("["+Dt+"]"),Hi=new RegExp("["+Dt+Mi+"]");function nt(e,t){for(var n=65536,s=0;s<t.length;s+=2){if((n+=t[s])>e)return!1;if((n+=t[s+1])>=e)return!0}return!1}function J(e,t){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&Bi.test(String.fromCharCode(e)):!1!==t&&nt(e,Mt)))}function oe(e,t){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&Hi.test(String.fromCharCode(e)):!1!==t&&(nt(e,Mt)||nt(e,Vi)))))}var T=function(e,t){void 0===t&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function j(e,t){return new T(e,{beforeExpr:!0,binop:t})}var z={beforeExpr:!0},U={startsExpr:!0},pt={};function A(e,t){return void 0===t&&(t={}),t.keyword=e,pt[e]=new T(e,t)}var c={num:new T("num",U),regexp:new T("regexp",U),string:new T("string",U),name:new T("name",U),privateId:new T("privateId",U),eof:new T("eof"),bracketL:new T("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new T("]"),braceL:new T("{",{beforeExpr:!0,startsExpr:!0}),braceR:new T("}"),parenL:new T("(",{beforeExpr:!0,startsExpr:!0}),parenR:new T(")"),comma:new T(",",z),semi:new T(";",z),colon:new T(":",z),dot:new T("."),question:new T("?",z),questionDot:new T("?."),arrow:new T("=>",z),template:new T("template"),invalidTemplate:new T("invalidTemplate"),ellipsis:new T("...",z),backQuote:new T("`",U),dollarBraceL:new T("${",{beforeExpr:!0,startsExpr:!0}),eq:new T("=",{beforeExpr:!0,isAssign:!0}),assign:new T("_=",{beforeExpr:!0,isAssign:!0}),incDec:new T("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new T("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:j("||",1),logicalAND:j("&&",2),bitwiseOR:j("|",3),bitwiseXOR:j("^",4),bitwiseAND:j("&",5),equality:j("==/!=/===/!==",6),relational:j("</>/<=/>=",7),bitShift:j("<</>>/>>>",8),plusMin:new T("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:j("%",10),star:j("*",10),slash:j("/",10),starstar:new T("**",{beforeExpr:!0}),coalesce:j("??",1),_break:A("break"),_case:A("case",z),_catch:A("catch"),_continue:A("continue"),_debugger:A("debugger"),_default:A("default",z),_do:A("do",{isLoop:!0,beforeExpr:!0}),_else:A("else",z),_finally:A("finally"),_for:A("for",{isLoop:!0}),_function:A("function",U),_if:A("if"),_return:A("return",z),_switch:A("switch"),_throw:A("throw",z),_try:A("try"),_var:A("var"),_const:A("const"),_while:A("while",{isLoop:!0}),_with:A("with"),_new:A("new",{beforeExpr:!0,startsExpr:!0}),_this:A("this",U),_super:A("super",U),_class:A("class",U),_extends:A("extends",z),_export:A("export"),_import:A("import",U),_null:A("null",U),_true:A("true",U),_false:A("false",U),_in:A("in",{beforeExpr:!0,binop:7}),_instanceof:A("instanceof",{beforeExpr:!0,binop:7}),_typeof:A("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:A("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:A("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},q=/\r\n?|\n|\u2028|\u2029/,Fi=new RegExp(q.source,"g");function Ce(e){return 10===e||13===e||8232===e||8233===e}function Ot(e,t,n){void 0===n&&(n=e.length);for(var s=t;s<n;s++){var i=e.charCodeAt(s);if(Ce(i))return s<n-1&&13===i&&10===e.charCodeAt(s+1)?s+2:s+1}return-1}var Bt=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,H=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Ht=Object.prototype,$i=Ht.hasOwnProperty,Ui=Ht.toString,Se=Object.hasOwn||function(e,t){return $i.call(e,t)},_t=Array.isArray||function(e){return"[object Array]"===Ui.call(e)},Ct=Object.create(null);function ae(e){return Ct[e]||(Ct[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function ie(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}var qi=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Re=function(e,t){this.line=e,this.column=t};Re.prototype.offset=function(e){return new Re(this.line,this.column+e)};var We=function(e,t,n){this.start=t,this.end=n,null!==e.sourceFile&&(this.source=e.sourceFile)};function Ft(e,t){for(var n=1,s=0;;){var i=Ot(e,s,t);if(i<0)return new Re(n,t-s);++n,s=i}}var at={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},St=!1;function Wi(e){var t={};for(var n in at)t[n]=e&&Se(e,n)?e[n]:at[n];if("latest"===t.ecmaVersion?t.ecmaVersion=1e8:null==t.ecmaVersion?(!St&&"object"==typeof console&&console.warn&&(St=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),null==t.allowReserved&&(t.allowReserved=t.ecmaVersion<5),(!e||null==e.allowHashBang)&&(t.allowHashBang=t.ecmaVersion>=14),_t(t.onToken)){var s=t.onToken;t.onToken=function(e){return s.push(e)}}return _t(t.onComment)&&(t.onComment=ji(t,t.onComment)),t}function ji(e,t){return function(n,s,i,r,a,o){var c={type:n?"Block":"Line",value:s,start:i,end:r};e.locations&&(c.loc=new We(this,a,o)),e.ranges&&(c.range=[i,r]),t.push(c)}}var Ne=1,Ee=2,ft=4,$t=8,dt=16,Ut=32,je=64,qt=128,pe=256,Le=512,ze=Ne|Ee|pe;function mt(e,t){return Ee|(e?ft:0)|(t?$t:0)}var He=0,gt=1,se=2,Wt=3,jt=4,zt=5,L=function(e,t,n){this.options=e=Wi(e),this.sourceFile=e.sourceFile,this.keywords=ae(Di[e.ecmaVersion>=6?6:"module"===e.sourceType?"5module":5]);var s="";!0!==e.allowReserved&&(s=Ze[e.ecmaVersion>=6?6:5===e.ecmaVersion?5:3],"module"===e.sourceType&&(s+=" await")),this.reservedWords=ae(s);var i=(s?s+" ":"")+Ze.strict;this.reservedWordsStrict=ae(i),this.reservedWordsStrictBind=ae(i+" "+Ze.strictBind),this.input=String(t),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf("\n",n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(q).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=c.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===e.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(Ne),this.regexpState=null,this.privateNameStack=[]},ee={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};L.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},ee.inFunction.get=function(){return(this.currentVarScope().flags&Ee)>0},ee.inGenerator.get=function(){return(this.currentVarScope().flags&$t)>0},ee.inAsync.get=function(){return(this.currentVarScope().flags&ft)>0},ee.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(pe|Le))return!1;if(t&Ee)return(t&ft)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},ee.allowSuper.get=function(){return(this.currentThisScope().flags&je)>0||this.options.allowSuperOutsideMethod},ee.allowDirectSuper.get=function(){return(this.currentThisScope().flags&qt)>0},ee.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},ee.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(pe|Le)||t&Ee&&!(t&dt))return!0}return!1},ee.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&pe)>0},L.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,s=0;s<e.length;s++)n=e[s](n);return n},L.parse=function(e,t){return new this(t,e).parse()},L.parseExpressionAt=function(e,t,n){var s=new this(n,e,t);return s.nextToken(),s.parseExpression()},L.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(L.prototype,ee);var $=L.prototype,zi=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;$.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){H.lastIndex=e,e+=H.exec(this.input)[0].length;var t=zi.exec(this.input.slice(e));if(!t)return!1;if("use strict"===(t[1]||t[2])){H.lastIndex=e+t[0].length;var n=H.exec(this.input),s=n.index+n[0].length,i=this.input.charAt(s);return";"===i||"}"===i||q.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||"!"===i&&"="===this.input.charAt(s+1))}e+=t[0].length,H.lastIndex=e,e+=H.exec(this.input)[0].length,";"===this.input[e]&&e++}},$.eat=function(e){return this.type===e&&(this.next(),!0)},$.isContextual=function(e){return this.type===c.name&&this.value===e&&!this.containsEsc},$.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},$.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},$.canInsertSemicolon=function(){return this.type===c.eof||this.type===c.braceR||q.test(this.input.slice(this.lastTokEnd,this.start))},$.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},$.semicolon=function(){!this.eat(c.semi)&&!this.insertSemicolon()&&this.unexpected()},$.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},$.expect=function(e){this.eat(e)||this.unexpected()},$.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var Ke=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};$.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?"Assigning to rvalue":"Parenthesized pattern")}},$.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,s=e.doubleProto;if(!t)return n>=0||s>=0;n>=0&&this.raise(n,"Shorthand property assignments are valid only in destructuring patterns"),s>=0&&this.raiseRecoverable(s,"Redefinition of __proto__ property")},$.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},$.isSimpleAssignTarget=function(e){return"ParenthesizedExpression"===e.type?this.isSimpleAssignTarget(e.expression):"Identifier"===e.type||"MemberExpression"===e.type};var y=L.prototype;y.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==c.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var s=0,i=Object.keys(this.undefinedExports);s<i.length;s+=1){var r=i[s];this.raiseRecoverable(this.undefinedExports[r].start,"Export '"+r+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var vt={kind:"loop"},Ki={kind:"switch"};y.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;H.lastIndex=this.pos;var t=H.exec(this.input),n=this.pos+t[0].length,s=this.input.charCodeAt(n);if(91===s||92===s)return!0;if(e)return!1;if(123===s||s>55295&&s<56320)return!0;if(J(s,!0)){for(var i=n+1;oe(s=this.input.charCodeAt(i),!0);)++i;if(92===s||s>55295&&s<56320)return!0;var r=this.input.slice(n,i);if(!Oi.test(r))return!0}return!1},y.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;H.lastIndex=this.pos;var e,t=H.exec(this.input),n=this.pos+t[0].length;return!(q.test(this.input.slice(this.pos,n))||"function"!==this.input.slice(n,n+8)||n+8!==this.input.length&&(oe(e=this.input.charCodeAt(n+8))||e>55295&&e<56320))},y.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?"await":"using"))return!1;H.lastIndex=this.pos;var n=H.exec(this.input),s=this.pos+n[0].length;if(q.test(this.input.slice(this.pos,s)))return!1;if(e){var i,r=s+5;if("using"!==this.input.slice(s,r)||r===this.input.length||oe(i=this.input.charCodeAt(r))||i>55295&&i<56320)return!1;H.lastIndex=r;var a=H.exec(this.input);if(a&&q.test(this.input.slice(r,r+a[0].length)))return!1}if(t){var o,c=s+2;if(!("of"!==this.input.slice(s,c)||c!==this.input.length&&(oe(o=this.input.charCodeAt(c))||o>55295&&o<56320)))return!1}var l=this.input.charCodeAt(s);return J(l,!0)||92===l},y.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},y.isUsing=function(e){return this.isUsingKeyword(!1,e)},y.parseStatement=function(e,t,n){var s,i=this.type,r=this.startNode();switch(this.isLet(e)&&(i=c._var,s="let"),i){case c._break:case c._continue:return this.parseBreakContinueStatement(r,i.keyword);case c._debugger:return this.parseDebuggerStatement(r);case c._do:return this.parseDoStatement(r);case c._for:return this.parseForStatement(r);case c._function:return e&&(this.strict||"if"!==e&&"label"!==e)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(r,!1,!e);case c._class:return e&&this.unexpected(),this.parseClass(r,!0);case c._if:return this.parseIfStatement(r);case c._return:return this.parseReturnStatement(r);case c._switch:return this.parseSwitchStatement(r);case c._throw:return this.parseThrowStatement(r);case c._try:return this.parseTryStatement(r);case c._const:case c._var:return s=s||this.value,e&&"var"!==s&&this.unexpected(),this.parseVarStatement(r,s);case c._while:return this.parseWhileStatement(r);case c._with:return this.parseWithStatement(r);case c.braceL:return this.parseBlock(!0,r);case c.semi:return this.parseEmptyStatement(r);case c._export:case c._import:if(this.options.ecmaVersion>10&&i===c._import){H.lastIndex=this.pos;var a=H.exec(this.input),o=this.pos+a[0].length,l=this.input.charCodeAt(o);if(40===l||46===l)return this.parseExpressionStatement(r,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),i===c._import?this.parseImport(r):this.parseExport(r,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(r,!0,!e);var h=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(h)return t&&"script"===this.options.sourceType&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),"await using"===h&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(r,!1,h),this.semicolon(),this.finishNode(r,"VariableDeclaration");var p=this.value,u=this.parseExpression();return i===c.name&&"Identifier"===u.type&&this.eat(c.colon)?this.parseLabeledStatement(r,p,u,e):this.parseExpressionStatement(r,u)}},y.parseBreakContinueStatement=function(e,t){var n="break"===t;this.next(),this.eat(c.semi)||this.insertSemicolon()?e.label=null:this.type!==c.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var s=0;s<this.labels.length;++s){var i=this.labels[s];if((null==e.label||i.name===e.label.name)&&(null!=i.kind&&(n||"loop"===i.kind)||e.label&&n))break}return s===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,n?"BreakStatement":"ContinueStatement")},y.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},y.parseDoStatement=function(e){return this.next(),this.labels.push(vt),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(c._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(c.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},y.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(vt),this.enterScope(0),this.expect(c.parenL),this.type===c.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===c._var||this.type===c._const||n){var s=this.startNode(),i=n?"let":this.value;return this.next(),this.parseVar(s,!0,i),this.finishNode(s,"VariableDeclaration"),this.parseForAfterInit(e,s,t)}var r=this.isContextual("let"),a=!1,o=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(o){var l=this.startNode();return this.next(),"await using"===o&&this.next(),this.parseVar(l,!0,o),this.finishNode(l,"VariableDeclaration"),this.parseForAfterInit(e,l,t)}var h=this.containsEsc,p=new Ke,u=this.start,d=t>-1?this.parseExprSubscripts(p,"await"):this.parseExpression(!0,p);return this.type===c._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===c._in&&this.unexpected(t),e.await=!0):a&&this.options.ecmaVersion>=8&&(d.start!==u||h||"Identifier"!==d.type||"async"!==d.name?this.options.ecmaVersion>=9&&(e.await=!1):this.unexpected()),r&&a&&this.raise(d.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(d,!1,p),this.checkLValPattern(d),this.parseForIn(e,d)):(this.checkExpressionErrors(p,!0),t>-1&&this.unexpected(t),this.parseFor(e,d))},y.parseForAfterInit=function(e,t,n){return(this.type===c._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===t.declarations.length?(this.options.ecmaVersion>=9&&(this.type===c._in?n>-1&&this.unexpected(n):e.await=n>-1),this.parseForIn(e,t)):(n>-1&&this.unexpected(n),this.parseFor(e,t))},y.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,Ie|(n?0:ot),!1,t)},y.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(c._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},y.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(c.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},y.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(c.braceL),this.labels.push(Ki),this.enterScope(0);for(var t,n=!1;this.type!==c.braceR;)if(this.type===c._case||this.type===c._default){var s=this.type===c._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),s?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),n=!0,t.test=null),this.expect(c.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},y.parseThrowStatement=function(e){return this.next(),q.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var Gi=[];y.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t="Identifier"===e.type;return this.enterScope(t?Ut:0),this.checkLValPattern(e,t?jt:se),this.expect(c.parenR),e},y.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===c._catch){var t=this.startNode();this.next(),this.eat(c.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(c._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},y.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,"VariableDeclaration")},y.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(vt),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},y.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")},y.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},y.parseLabeledStatement=function(e,t,n,s){for(var i=0,r=this.labels;i<r.length;i+=1){r[i].name===t&&this.raise(n.start,"Label '"+t+"' is already declared")}for(var a=this.type.isLoop?"loop":this.type===c._switch?"switch":null,o=this.labels.length-1;o>=0;o--){var l=this.labels[o];if(l.statementStart!==e.start)break;l.statementStart=this.start,l.kind=a}return this.labels.push({name:t,kind:a,statementStart:this.start}),e.body=this.parseStatement(s?-1===s.indexOf("label")?s+"label":s:"label"),this.labels.pop(),e.label=n,this.finishNode(e,"LabeledStatement")},y.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},y.parseBlock=function(e,t,n){for(void 0===e&&(e=!0),void 0===t&&(t=this.startNode()),t.body=[],this.expect(c.braceL),e&&this.enterScope(0);this.type!==c.braceR;){var s=this.parseStatement(null);t.body.push(s)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},y.parseFor=function(e,t){return e.init=t,this.expect(c.semi),e.test=this.type===c.semi?null:this.parseExpression(),this.expect(c.semi),e.update=this.type===c.parenR?null:this.parseExpression(),this.expect(c.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},y.parseForIn=function(e,t){var n=this.type===c._in;return this.next(),"VariableDeclaration"===t.type&&null!=t.declarations[0].init&&(!n||this.options.ecmaVersion<8||this.strict||"var"!==t.kind||"Identifier"!==t.declarations[0].id.type)&&this.raise(t.start,(n?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(c.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,n?"ForInStatement":"ForOfStatement")},y.parseVar=function(e,t,n,s){for(e.declarations=[],e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(c.eq)?i.init=this.parseMaybeAssign(t):s||"const"!==n||this.type===c._in||this.options.ecmaVersion>=6&&this.isContextual("of")?s||"using"!==n&&"await using"!==n||!(this.options.ecmaVersion>=17)||this.type===c._in||this.isContextual("of")?s||"Identifier"===i.id.type||t&&(this.type===c._in||this.isContextual("of"))?i.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.raise(this.lastTokEnd,"Missing initializer in "+n+" declaration"):this.unexpected(),e.declarations.push(this.finishNode(i,"VariableDeclarator")),!this.eat(c.comma))break}return e},y.parseVarId=function(e,t){e.id="using"===t||"await using"===t?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,"var"===t?gt:se,!1)};var Ie=1,ot=2,Kt=4;function Xi(e,t){var n=t.key.name,s=e[n],i="true";return"MethodDefinition"===t.type&&("get"===t.kind||"set"===t.kind)&&(i=(t.static?"s":"i")+t.kind),"iget"===s&&"iset"===i||"iset"===s&&"iget"===i||"sget"===s&&"sset"===i||"sset"===s&&"sget"===i?(e[n]="true",!1):!!s||(e[n]=i,!1)}function Fe(e,t){var n=e.computed,s=e.key;return!n&&("Identifier"===s.type&&s.name===t||"Literal"===s.type&&s.value===t)}y.parseFunction=function(e,t,n,s,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!s)&&(this.type===c.star&&t&ot&&this.unexpected(),e.generator=this.eat(c.star)),this.options.ecmaVersion>=8&&(e.async=!!s),t&Ie&&(e.id=t&Kt&&this.type!==c.name?null:this.parseIdent(),e.id&&!(t&ot)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?gt:se:Wt));var r=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(mt(e.async,e.generator)),t&Ie||(e.id=this.type===c.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=r,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,t&Ie?"FunctionDeclaration":"FunctionExpression")},y.parseFunctionParams=function(e){this.expect(c.parenL),e.params=this.parseBindingList(c.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},y.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var s=this.enterClassBody(),i=this.startNode(),r=!1;for(i.body=[],this.expect(c.braceL);this.type!==c.braceR;){var a=this.parseClassElement(null!==e.superClass);a&&(i.body.push(a),"MethodDefinition"===a.type&&"constructor"===a.kind?(r&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),r=!0):a.key&&"PrivateIdentifier"===a.key.type&&Xi(s,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=n,this.next(),e.body=this.finishNode(i,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},y.parseClassElement=function(e){if(this.eat(c.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),s="",i=!1,r=!1,a="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(c.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===c.star?o=!0:s="static"}if(n.static=o,!s&&t>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==c.star||this.canInsertSemicolon()?s="async":r=!0),!s&&(t>=9||!r)&&this.eat(c.star)&&(i=!0),!s&&!r&&!i){var l=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=l:s=l)}if(s?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=s,this.finishNode(n.key,"Identifier")):this.parseClassElementName(n),t<13||this.type===c.parenL||"method"!==a||i||r){var h=!n.static&&Fe(n,"constructor"),p=h&&e;h&&"method"!==a&&this.raise(n.key.start,"Constructor can't have get/set modifier"),n.kind=h?"constructor":a,this.parseClassMethod(n,i,r,p)}else this.parseClassField(n);return n},y.isClassElementNameStart=function(){return this.type===c.name||this.type===c.privateId||this.type===c.num||this.type===c.string||this.type===c.bracketL||this.type.keyword},y.parseClassElementName=function(e){this.type===c.privateId?("constructor"===this.value&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},y.parseClassMethod=function(e,t,n,s){var i=e.key;"constructor"===e.kind?(t&&this.raise(i.start,"Constructor can't be a generator"),n&&this.raise(i.start,"Constructor can't be an async method")):e.static&&Fe(e,"prototype")&&this.raise(i.start,"Classes may not have a static property named prototype");var r=e.value=this.parseMethod(t,n,s);return"get"===e.kind&&0!==r.params.length&&this.raiseRecoverable(r.start,"getter should have no params"),"set"===e.kind&&1!==r.params.length&&this.raiseRecoverable(r.start,"setter should have exactly one param"),"set"===e.kind&&"RestElement"===r.params[0].type&&this.raiseRecoverable(r.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},y.parseClassField=function(e){return Fe(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&Fe(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(c.eq)?(this.enterScope(Le|je),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,"PropertyDefinition")},y.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(pe|je);this.type!==c.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},y.parseClassId=function(e,t){this.type===c.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,se,!1)):(!0===t&&this.unexpected(),e.id=null)},y.parseClassSuper=function(e){e.superClass=this.eat(c._extends)?this.parseExprSubscripts(null,!1):null},y.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},y.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var s=this.privateNameStack.length,i=0===s?null:this.privateNameStack[s-1],r=0;r<n.length;++r){var a=n[r];Se(t,a.name)||(i?i.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}},y.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==c.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},y.parseExport=function(e,t){if(this.next(),this.eat(c.star))return this.parseExportAllDeclaration(e,t);if(this.eat(c._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),"VariableDeclaration"===e.declaration.type?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==c.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var n=0,s=e.specifiers;n<s.length;n+=1){var i=s[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),"Literal"===i.local.type&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")},y.parseExportDeclaration=function(e){return this.parseStatement(null)},y.parseExportDefaultDeclaration=function(){var e;if(this.type===c._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,Ie|Kt,!1,e)}if(this.type===c._class){var n=this.startNode();return this.parseClass(n,"nullableID")}var s=this.parseMaybeAssign();return this.semicolon(),s},y.checkExport=function(e,t,n){e&&("string"!=typeof t&&(t="Identifier"===t.type?t.name:t.value),Se(e,t)&&this.raiseRecoverable(n,"Duplicate export '"+t+"'"),e[t]=!0)},y.checkPatternExport=function(e,t){var n=t.type;if("Identifier"===n)this.checkExport(e,t,t.start);else if("ObjectPattern"===n)for(var s=0,i=t.properties;s<i.length;s+=1){var r=i[s];this.checkPatternExport(e,r)}else if("ArrayPattern"===n)for(var a=0,o=t.elements;a<o.length;a+=1){var c=o[a];c&&this.checkPatternExport(e,c)}else"Property"===n?this.checkPatternExport(e,t.value):"AssignmentPattern"===n?this.checkPatternExport(e,t.left):"RestElement"===n&&this.checkPatternExport(e,t.argument)},y.checkVariableExport=function(e,t){if(e)for(var n=0,s=t;n<s.length;n+=1){var i=s[n];this.checkPatternExport(e,i.id)}},y.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},y.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual("as")?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,"ExportSpecifier")},y.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(c.braceL);!this.eat(c.braceR);){if(n)n=!1;else if(this.expect(c.comma),this.afterTrailingComma(c.braceR))break;t.push(this.parseExportSpecifier(e))}return t},y.parseImport=function(e){return this.next(),this.type===c.string?(e.specifiers=Gi,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===c.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},y.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual("as")?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,se),this.finishNode(e,"ImportSpecifier")},y.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,se),this.finishNode(e,"ImportDefaultSpecifier")},y.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,se),this.finishNode(e,"ImportNamespaceSpecifier")},y.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===c.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(c.comma)))return e;if(this.type===c.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(c.braceL);!this.eat(c.braceR);){if(t)t=!1;else if(this.expect(c.comma),this.afterTrailingComma(c.braceR))break;e.push(this.parseImportSpecifier())}return e},y.parseWithClause=function(){var e=[];if(!this.eat(c._with))return e;this.expect(c.braceL);for(var t={},n=!0;!this.eat(c.braceR);){if(n)n=!1;else if(this.expect(c.comma),this.afterTrailingComma(c.braceR))break;var s=this.parseImportAttribute(),i="Identifier"===s.key.type?s.key.name:s.key.value;Se(t,i)&&this.raiseRecoverable(s.key.start,"Duplicate attribute key '"+i+"'"),t[i]=!0,e.push(s)}return e},y.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===c.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved),this.expect(c.colon),this.type!==c.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},y.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===c.string){var e=this.parseLiteral(this.value);return qi.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},y.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},y.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"string"==typeof e.expression.value&&('"'===this.input[e.start]||"'"===this.input[e.start])};var X=L.prototype;X.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&"await"===e.name&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",n&&this.checkPatternErrors(n,!0);for(var s=0,i=e.properties;s<i.length;s+=1){var r=i[s];this.toAssignable(r,t),"RestElement"===r.type&&("ArrayPattern"===r.argument.type||"ObjectPattern"===r.argument.type)&&this.raise(r.argument.start,"Unexpected token")}break;case"Property":"init"!==e.kind&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),"AssignmentPattern"===e.argument.type&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==e.operator&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,n);break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}else n&&this.checkPatternErrors(n,!0);return e},X.toAssignableList=function(e,t){for(var n=e.length,s=0;s<n;s++){var i=e[s];i&&this.toAssignable(i,t)}if(n){var r=e[n-1];6===this.options.ecmaVersion&&t&&r&&"RestElement"===r.type&&"Identifier"!==r.argument.type&&this.unexpected(r.argument.start)}return e},X.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},X.parseRestBinding=function(){var e=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==c.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},X.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case c.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(c.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case c.braceL:return this.parseObj(!0)}return this.parseIdent()},X.parseBindingList=function(e,t,n,s){for(var i=[],r=!0;!this.eat(e);)if(r?r=!1:this.expect(c.comma),t&&this.type===c.comma)i.push(null);else{if(n&&this.afterTrailingComma(e))break;if(this.type===c.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),i.push(a),this.type===c.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}i.push(this.parseAssignableListItem(s))}return i},X.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},X.parseBindingListItem=function(e){return e},X.parseMaybeDefault=function(e,t,n){if(n=n||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(c.eq))return n;var s=this.startNodeAt(e,t);return s.left=n,s.right=this.parseMaybeAssign(),this.finishNode(s,"AssignmentPattern")},X.checkLValSimple=function(e,t,n){void 0===t&&(t=He);var s=t!==He;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(s?"Binding ":"Assigning to ")+e.name+" in strict mode"),s&&(t===se&&"let"===e.name&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),n&&(Se(n,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),n[e.name]=!0),t!==zt&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":s&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return s&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(s?"Binding":"Assigning to")+" rvalue")}},X.checkLValPattern=function(e,t,n){switch(void 0===t&&(t=He),e.type){case"ObjectPattern":for(var s=0,i=e.properties;s<i.length;s+=1){var r=i[s];this.checkLValInnerPattern(r,t,n)}break;case"ArrayPattern":for(var a=0,o=e.elements;a<o.length;a+=1){var c=o[a];c&&this.checkLValInnerPattern(c,t,n)}break;default:this.checkLValSimple(e,t,n)}},X.checkLValInnerPattern=function(e,t,n){switch(void 0===t&&(t=He),e.type){case"Property":this.checkLValInnerPattern(e.value,t,n);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,n);break;case"RestElement":this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}};var Y=function(e,t,n,s,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=s,this.generator=!!i},I={b_stat:new Y("{",!1),b_expr:new Y("{",!0),b_tmpl:new Y("${",!1),p_stat:new Y("(",!1),p_expr:new Y("(",!0),q_tmpl:new Y("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new Y("function",!1),f_expr:new Y("function",!0),f_expr_gen:new Y("function",!0,!1,null,!0),f_gen:new Y("function",!1,!1,null,!0)},we=L.prototype;we.initialContext=function(){return[I.b_stat]},we.curContext=function(){return this.context[this.context.length-1]},we.braceIsBlock=function(e){var t=this.curContext();return t===I.f_expr||t===I.f_stat||(e!==c.colon||t!==I.b_stat&&t!==I.b_expr?e===c._return||e===c.name&&this.exprAllowed?q.test(this.input.slice(this.lastTokEnd,this.start)):e===c._else||e===c.semi||e===c.eof||e===c.parenR||e===c.arrow||(e===c.braceL?t===I.b_stat:e!==c._var&&e!==c._const&&e!==c.name&&!this.exprAllowed):!t.isExpr)},we.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if("function"===t.token)return t.generator}return!1},we.updateContext=function(e){var t,n=this.type;n.keyword&&e===c.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},we.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},c.parenR.updateContext=c.braceR.updateContext=function(){if(1!==this.context.length){var e=this.context.pop();e===I.b_stat&&"function"===this.curContext().token&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}else this.exprAllowed=!0},c.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?I.b_stat:I.b_expr),this.exprAllowed=!0},c.dollarBraceL.updateContext=function(){this.context.push(I.b_tmpl),this.exprAllowed=!0},c.parenL.updateContext=function(e){var t=e===c._if||e===c._for||e===c._with||e===c._while;this.context.push(t?I.p_stat:I.p_expr),this.exprAllowed=!0},c.incDec.updateContext=function(){},c._function.updateContext=c._class.updateContext=function(e){!e.beforeExpr||e===c._else||e===c.semi&&this.curContext()!==I.p_stat||e===c._return&&q.test(this.input.slice(this.lastTokEnd,this.start))||(e===c.colon||e===c.braceL)&&this.curContext()===I.b_stat?this.context.push(I.f_stat):this.context.push(I.f_expr),this.exprAllowed=!1},c.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},c.backQuote.updateContext=function(){this.curContext()===I.q_tmpl?this.context.pop():this.context.push(I.q_tmpl),this.exprAllowed=!1},c.star.updateContext=function(e){if(e===c._function){var t=this.context.length-1;this.context[t]===I.f_expr?this.context[t]=I.f_expr_gen:this.context[t]=I.f_gen}this.exprAllowed=!0},c.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==c.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var S=L.prototype;function Gt(e){return"Identifier"===e.type||"ParenthesizedExpression"===e.type&&Gt(e.expression)}function ct(e){return"MemberExpression"===e.type&&"PrivateIdentifier"===e.property.type||"ChainExpression"===e.type&&ct(e.expression)||"ParenthesizedExpression"===e.type&&ct(e.expression)}S.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===e.type||this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var s,i=e.key;switch(i.type){case"Identifier":s=i.name;break;case"Literal":s=String(i.value);break;default:return}var r=e.kind;if(this.options.ecmaVersion>=6)return void("__proto__"===s&&"init"===r&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=i.start):this.raiseRecoverable(i.start,"Redefinition of __proto__ property")),t.proto=!0));var a=t[s="$"+s];if(a)("init"===r?this.strict&&a.init||a.get||a.set:a.init||a[r])&&this.raiseRecoverable(i.start,"Redefinition of property");else a=t[s]={init:!1,get:!1,set:!1};a[r]=!0}},S.parseExpression=function(e,t){var n=this.start,s=this.startLoc,i=this.parseMaybeAssign(e,t);if(this.type===c.comma){var r=this.startNodeAt(n,s);for(r.expressions=[i];this.eat(c.comma);)r.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(r,"SequenceExpression")}return i},S.parseMaybeAssign=function(e,t,n){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var s=!1,i=-1,r=-1,a=-1;t?(i=t.parenthesizedAssign,r=t.trailingComma,a=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new Ke,s=!0);var o=this.start,l=this.startLoc;(this.type===c.parenL||this.type===c.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===e);var h=this.parseMaybeConditional(e,t);if(n&&(h=n.call(this,h,o,l)),this.type.isAssign){var p=this.startNodeAt(o,l);return p.operator=this.value,this.type===c.eq&&(h=this.toAssignable(h,!1,t)),s||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=h.start&&(t.shorthandAssign=-1),this.type===c.eq?this.checkLValPattern(h):this.checkLValSimple(h),p.left=h,this.next(),p.right=this.parseMaybeAssign(e),a>-1&&(t.doubleProto=a),this.finishNode(p,"AssignmentExpression")}return s&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),r>-1&&(t.trailingComma=r),h},S.parseMaybeConditional=function(e,t){var n=this.start,s=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(this.eat(c.question)){var r=this.startNodeAt(n,s);return r.test=i,r.consequent=this.parseMaybeAssign(),this.expect(c.colon),r.alternate=this.parseMaybeAssign(e),this.finishNode(r,"ConditionalExpression")}return i},S.parseExprOps=function(e,t){var n=this.start,s=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&"ArrowFunctionExpression"===i.type?i:this.parseExprOp(i,n,s,-1,e)},S.parseExprOp=function(e,t,n,s,i){var r=this.type.binop;if(null!=r&&(!i||this.type!==c._in)&&r>s){var a=this.type===c.logicalOR||this.type===c.logicalAND,o=this.type===c.coalesce;o&&(r=c.logicalAND.binop);var l=this.value;this.next();var h=this.start,p=this.startLoc,u=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),h,p,r,i),d=this.buildBinary(t,n,e,u,l,a||o);return(a&&this.type===c.coalesce||o&&(this.type===c.logicalOR||this.type===c.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(d,t,n,s,i)}return e},S.buildBinary=function(e,t,n,s,i,r){"PrivateIdentifier"===s.type&&this.raise(s.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(e,t);return a.left=n,a.operator=i,a.right=s,this.finishNode(a,r?"LogicalExpression":"BinaryExpression")},S.parseMaybeUnary=function(e,t,n,s){var i,r=this.start,a=this.startLoc;if(this.isContextual("await")&&this.canAwait)i=this.parseAwait(s),t=!0;else if(this.type.prefix){var o=this.startNode(),l=this.type===c.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,l,s),this.checkExpressionErrors(e,!0),l?this.checkLValSimple(o.argument):this.strict&&"delete"===o.operator&&Gt(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):"delete"===o.operator&&ct(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,i=this.finishNode(o,l?"UpdateExpression":"UnaryExpression")}else if(t||this.type!==c.privateId){if(i=this.parseExprSubscripts(e,s),this.checkExpressionErrors(e))return i;for(;this.type.postfix&&!this.canInsertSemicolon();){var h=this.startNodeAt(r,a);h.operator=this.value,h.prefix=!1,h.argument=i,this.checkLValSimple(i),this.next(),i=this.finishNode(h,"UpdateExpression")}}else(s||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),i=this.parsePrivateIdent(),this.type!==c._in&&this.unexpected();return n||!this.eat(c.starstar)?i:t?void this.unexpected(this.lastTokStart):this.buildBinary(r,a,i,this.parseMaybeUnary(null,!1,!1,s),"**",!1)},S.parseExprSubscripts=function(e,t){var n=this.start,s=this.startLoc,i=this.parseExprAtom(e,t);if("ArrowFunctionExpression"===i.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return i;var r=this.parseSubscripts(i,n,s,!1,t);return e&&"MemberExpression"===r.type&&(e.parenthesizedAssign>=r.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=r.start&&(e.parenthesizedBind=-1),e.trailingComma>=r.start&&(e.trailingComma=-1)),r},S.parseSubscripts=function(e,t,n,s,i){for(var r=this.options.ecmaVersion>=8&&"Identifier"===e.type&&"async"===e.name&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,a=!1;;){var o=this.parseSubscript(e,t,n,s,r,a,i);if(o.optional&&(a=!0),o===e||"ArrowFunctionExpression"===o.type){if(a){var c=this.startNodeAt(t,n);c.expression=o,o=this.finishNode(c,"ChainExpression")}return o}e=o}},S.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(c.arrow)},S.parseSubscriptAsyncArrow=function(e,t,n,s){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,s)},S.parseSubscript=function(e,t,n,s,i,r,a){var o=this.options.ecmaVersion>=11,l=o&&this.eat(c.questionDot);s&&l&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var h=this.eat(c.bracketL);if(h||l&&this.type!==c.parenL&&this.type!==c.backQuote||this.eat(c.dot)){var p=this.startNodeAt(t,n);p.object=e,h?(p.property=this.parseExpression(),this.expect(c.bracketR)):this.type===c.privateId&&"Super"!==e.type?p.property=this.parsePrivateIdent():p.property=this.parseIdent("never"!==this.options.allowReserved),p.computed=!!h,o&&(p.optional=l),e=this.finishNode(p,"MemberExpression")}else if(!s&&this.eat(c.parenL)){var u=new Ke,d=this.yieldPos,f=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var g=this.parseExprList(c.parenR,this.options.ecmaVersion>=8,!1,u);if(i&&!l&&this.shouldParseAsyncArrow())return this.checkPatternErrors(u,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=d,this.awaitPos=f,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(t,n,g,a);this.checkExpressionErrors(u,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=f||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var v=this.startNodeAt(t,n);v.callee=e,v.arguments=g,o&&(v.optional=l),e=this.finishNode(v,"CallExpression")}else if(this.type===c.backQuote){(l||r)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var y=this.startNodeAt(t,n);y.tag=e,y.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(y,"TaggedTemplateExpression")}return e},S.parseExprAtom=function(e,t,n){this.type===c.slash&&this.readRegexp();var s,i=this.potentialArrowAt===this.start;switch(this.type){case c._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),s=this.startNode(),this.next(),this.type===c.parenL&&!this.allowDirectSuper&&this.raise(s.start,"super() call outside constructor of a subclass"),this.type!==c.dot&&this.type!==c.bracketL&&this.type!==c.parenL&&this.unexpected(),this.finishNode(s,"Super");case c._this:return s=this.startNode(),this.next(),this.finishNode(s,"ThisExpression");case c.name:var r=this.start,a=this.startLoc,o=this.containsEsc,l=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&"async"===l.name&&!this.canInsertSemicolon()&&this.eat(c._function))return this.overrideContext(I.f_expr),this.parseFunction(this.startNodeAt(r,a),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(c.arrow))return this.parseArrowExpression(this.startNodeAt(r,a),[l],!1,t);if(this.options.ecmaVersion>=8&&"async"===l.name&&this.type===c.name&&!o&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return l=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(c.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(r,a),[l],!0,t)}return l;case c.regexp:var h=this.value;return(s=this.parseLiteral(h.value)).regex={pattern:h.pattern,flags:h.flags},s;case c.num:case c.string:return this.parseLiteral(this.value);case c._null:case c._true:case c._false:return(s=this.startNode()).value=this.type===c._null?null:this.type===c._true,s.raw=this.type.keyword,this.next(),this.finishNode(s,"Literal");case c.parenL:var p=this.start,u=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(u)&&(e.parenthesizedAssign=p),e.parenthesizedBind<0&&(e.parenthesizedBind=p)),u;case c.bracketL:return s=this.startNode(),this.next(),s.elements=this.parseExprList(c.bracketR,!0,!0,e),this.finishNode(s,"ArrayExpression");case c.braceL:return this.overrideContext(I.b_expr),this.parseObj(!1,e);case c._function:return s=this.startNode(),this.next(),this.parseFunction(s,0);case c._class:return this.parseClass(this.startNode(),!1);case c._new:return this.parseNew();case c.backQuote:return this.parseTemplate();case c._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},S.parseExprAtomDefault=function(){this.unexpected()},S.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===c.parenL&&!e)return this.parseDynamicImport(t);if(this.type===c.dot){var n=this.startNodeAt(t.start,t.loc&&t.loc.start);return n.name="import",t.meta=this.finishNode(n,"Identifier"),this.parseImportMeta(t)}this.unexpected()},S.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(c.parenR)?e.options=null:(this.expect(c.comma),this.afterTrailingComma(c.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(c.parenR)||(this.expect(c.comma),this.afterTrailingComma(c.parenR)||this.unexpected())));else if(!this.eat(c.parenR)){var t=this.start;this.eat(c.comma)&&this.eat(c.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},S.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),"meta"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),"module"!==this.options.sourceType&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")},S.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),110===t.raw.charCodeAt(t.raw.length-1)&&(t.bigint=null!=t.value?t.value.toString():t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")},S.parseParenExpression=function(){this.expect(c.parenL);var e=this.parseExpression();return this.expect(c.parenR),e},S.shouldParseArrow=function(e){return!this.canInsertSemicolon()},S.parseParenAndDistinguishExpression=function(e,t){var n,s=this.start,i=this.startLoc,r=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a,o=this.start,l=this.startLoc,h=[],p=!0,u=!1,d=new Ke,f=this.yieldPos,m=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==c.parenR;){if(p?p=!1:this.expect(c.comma),r&&this.afterTrailingComma(c.parenR,!0)){u=!0;break}if(this.type===c.ellipsis){a=this.start,h.push(this.parseParenItem(this.parseRestBinding())),this.type===c.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}h.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var g=this.lastTokEnd,v=this.lastTokEndLoc;if(this.expect(c.parenR),e&&this.shouldParseArrow(h)&&this.eat(c.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=m,this.parseParenArrowList(s,i,h,t);(!h.length||u)&&this.unexpected(this.lastTokStart),a&&this.unexpected(a),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=m||this.awaitPos,h.length>1?((n=this.startNodeAt(o,l)).expressions=h,this.finishNodeAt(n,"SequenceExpression",g,v)):n=h[0]}else n=this.parseParenExpression();if(this.options.preserveParens){var y=this.startNodeAt(s,i);return y.expression=n,this.finishNode(y,"ParenthesizedExpression")}return n},S.parseParenItem=function(e){return e},S.parseParenArrowList=function(e,t,n,s){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,s)};var Yi=[];S.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===c.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var n=this.containsEsc;return e.property=this.parseIdent(!0),"target"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),n&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var s=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),s,i,!0,!1),this.eat(c.parenL)?e.arguments=this.parseExprList(c.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Yi,this.finishNode(e,"NewExpression")},S.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===c.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),n.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),n.tail=this.type===c.backQuote,this.finishNode(n,"TemplateElement")},S.parseTemplate=function(e){void 0===e&&(e={});var t=e.isTagged;void 0===t&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var s=this.parseTemplateElement({isTagged:t});for(n.quasis=[s];!s.tail;)this.type===c.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(c.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(c.braceR),n.quasis.push(s=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,"TemplateLiteral")},S.isAsyncProp=function(e){return!e.computed&&"Identifier"===e.key.type&&"async"===e.key.name&&(this.type===c.name||this.type===c.num||this.type===c.string||this.type===c.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===c.star)&&!q.test(this.input.slice(this.lastTokEnd,this.start))},S.parseObj=function(e,t){var n=this.startNode(),s=!0,i={};for(n.properties=[],this.next();!this.eat(c.braceR);){if(s)s=!1;else if(this.expect(c.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(c.braceR))break;var r=this.parseProperty(e,t);e||this.checkPropClash(r,i,t),n.properties.push(r)}return this.finishNode(n,e?"ObjectPattern":"ObjectExpression")},S.parseProperty=function(e,t){var n,s,i,r,a=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(c.ellipsis))return e?(a.argument=this.parseIdent(!1),this.type===c.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(a,"RestElement")):(a.argument=this.parseMaybeAssign(!1,t),this.type===c.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(a,"SpreadElement"));this.options.ecmaVersion>=6&&(a.method=!1,a.shorthand=!1,(e||t)&&(i=this.start,r=this.startLoc),e||(n=this.eat(c.star)));var o=this.containsEsc;return this.parsePropertyName(a),!e&&!o&&this.options.ecmaVersion>=8&&!n&&this.isAsyncProp(a)?(s=!0,n=this.options.ecmaVersion>=9&&this.eat(c.star),this.parsePropertyName(a)):s=!1,this.parsePropertyValue(a,e,n,s,i,r,t,o),this.finishNode(a,"Property")},S.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var n="get"===e.kind?0:1;if(e.value.params.length!==n){var s=e.value.start;"get"===e.kind?this.raiseRecoverable(s,"getter should have no params"):this.raiseRecoverable(s,"setter should have exactly one param")}else"set"===e.kind&&"RestElement"===e.value.params[0].type&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")},S.parsePropertyValue=function(e,t,n,s,i,r,a,o){(n||s)&&this.type===c.colon&&this.unexpected(),this.eat(c.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),e.kind="init"):this.options.ecmaVersion>=6&&this.type===c.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(n,s),e.kind="init"):t||o||!(this.options.ecmaVersion>=5)||e.computed||"Identifier"!==e.key.type||"get"!==e.key.name&&"set"!==e.key.name||this.type===c.comma||this.type===c.braceR||this.type===c.eq?this.options.ecmaVersion>=6&&!e.computed&&"Identifier"===e.key.type?((n||s)&&this.unexpected(),this.checkUnreserved(e.key),"await"===e.key.name&&!this.awaitIdentPos&&(this.awaitIdentPos=i),t?e.value=this.parseMaybeDefault(i,r,this.copyNode(e.key)):this.type===c.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,r,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind="init",e.shorthand=!0):this.unexpected():((n||s)&&this.unexpected(),this.parseGetterSetter(e))},S.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(c.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(c.bracketR),e.key;e.computed=!1}return e.key=this.type===c.num||this.type===c.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},S.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},S.parseMethod=function(e,t,n){var s=this.startNode(),i=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(s),this.options.ecmaVersion>=6&&(s.generator=e),this.options.ecmaVersion>=8&&(s.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(mt(t,s.generator)|je|(n?qt:0)),this.expect(c.parenL),s.params=this.parseBindingList(c.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(s,!1,!0,!1),this.yieldPos=i,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(s,"FunctionExpression")},S.parseArrowExpression=function(e,t,n,s){var i=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(mt(n,!1)|dt),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,s),this.yieldPos=i,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(e,"ArrowFunctionExpression")},S.parseFunctionBody=function(e,t,n,s){var i=t&&this.type!==c.braceL,r=this.strict,a=!1;if(i)e.body=this.parseMaybeAssign(s),e.expression=!0,this.checkParams(e,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!r||o)&&((a=this.strictDirective(this.end))&&o&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var l=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(e,!r&&!a&&!t&&!n&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,zt),e.body=this.parseBlock(!1,void 0,a&&!r),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=l}this.exitScope()},S.isSimpleParamList=function(e){for(var t=0,n=e;t<n.length;t+=1){if("Identifier"!==n[t].type)return!1}return!0},S.checkParams=function(e,t){for(var n=Object.create(null),s=0,i=e.params;s<i.length;s+=1){var r=i[s];this.checkLValInnerPattern(r,gt,t?null:n)}},S.parseExprList=function(e,t,n,s){for(var i=[],r=!0;!this.eat(e);){if(r)r=!1;else if(this.expect(c.comma),t&&this.afterTrailingComma(e))break;var a=void 0;n&&this.type===c.comma?a=null:this.type===c.ellipsis?(a=this.parseSpread(s),s&&this.type===c.comma&&s.trailingComma<0&&(s.trailingComma=this.start)):a=this.parseMaybeAssign(!1,s),i.push(a)}return i},S.checkUnreserved=function(e){var t=e.start,n=e.end,s=e.name;(this.inGenerator&&"yield"===s&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===s&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&ze)&&"arguments"===s&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&("arguments"===s||"await"===s)&&this.raise(t,"Cannot use "+s+" in class static initialization block"),this.keywords.test(s)&&this.raise(t,"Unexpected keyword '"+s+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(t,n).indexOf("\\"))||(this.strict?this.reservedWordsStrict:this.reservedWords).test(s)&&(!this.inAsync&&"await"===s&&this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+s+"' is reserved"))},S.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),"await"===t.name&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t},S.parseIdentNode=function(){var e=this.startNode();return this.type===c.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,("class"===e.name||"function"===e.name)&&(this.lastTokEnd!==this.lastTokStart+1||46!==this.input.charCodeAt(this.lastTokStart))&&this.context.pop(),this.type=c.name):this.unexpected(),e},S.parsePrivateIdent=function(){var e=this.startNode();return this.type===c.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.options.checkPrivateFields&&(0===this.privateNameStack.length?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},S.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===c.semi||this.canInsertSemicolon()||this.type!==c.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(c.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},S.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var $e=L.prototype;$e.raise=function(e,t){var n=Ft(this.input,e);t+=" ("+n.line+":"+n.column+")",this.sourceFile&&(t+=" in "+this.sourceFile);var s=new SyntaxError(t);throw s.pos=e,s.loc=n,s.raisedAt=this.pos,s},$e.raiseRecoverable=$e.raise,$e.curPosition=function(){if(this.options.locations)return new Re(this.curLine,this.pos-this.lineStart)};var ce=L.prototype,Qi=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};ce.enterScope=function(e){this.scopeStack.push(new Qi(e))},ce.exitScope=function(){this.scopeStack.pop()},ce.treatFunctionsAsVarInScope=function(e){return e.flags&Ee||!this.inModule&&e.flags&Ne},ce.declareName=function(e,t,n){var s=!1;if(t===se){var i=this.currentScope();s=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&Ne&&delete this.undefinedExports[e]}else if(t===jt){this.currentScope().lexical.push(e)}else if(t===Wt){var r=this.currentScope();s=this.treatFunctionsAsVar?r.lexical.indexOf(e)>-1:r.lexical.indexOf(e)>-1||r.var.indexOf(e)>-1,r.functions.push(e)}else for(var a=this.scopeStack.length-1;a>=0;--a){var o=this.scopeStack[a];if(o.lexical.indexOf(e)>-1&&!(o.flags&Ut&&o.lexical[0]===e)||!this.treatFunctionsAsVarInScope(o)&&o.functions.indexOf(e)>-1){s=!0;break}if(o.var.push(e),this.inModule&&o.flags&Ne&&delete this.undefinedExports[e],o.flags&ze)break}s&&this.raiseRecoverable(n,"Identifier '"+e+"' has already been declared")},ce.checkLocalExport=function(e){-1===this.scopeStack[0].lexical.indexOf(e.name)&&-1===this.scopeStack[0].var.indexOf(e.name)&&(this.undefinedExports[e.name]=e)},ce.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},ce.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(ze|Le|pe))return t}},ce.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(ze|Le|pe)&&!(t.flags&dt))return t}};var Ge=function(e,t,n){this.type="",this.start=t,this.end=0,e.options.locations&&(this.loc=new We(e,n)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},Ve=L.prototype;function Xt(e,t,n,s){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=s),this.options.ranges&&(e.range[1]=n),e}Ve.startNode=function(){return new Ge(this,this.start,this.startLoc)},Ve.startNodeAt=function(e,t){return new Ge(this,e,t)},Ve.finishNode=function(e,t){return Xt.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},Ve.finishNodeAt=function(e,t,n,s){return Xt.call(this,e,t,n,s)},Ve.copyNode=function(e){var t=new Ge(this,e.start,this.startLoc);for(var n in e)t[n]=e[n];return t};var Zi="Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz",Yt="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Qt=Yt+" Extended_Pictographic",Zt=Qt,Jt=Qt+" EBase EComp EMod EPres ExtPict",ei=Jt,Ji=Jt,er={9:Yt,10:Qt,11:Qt,12:Jt,13:Jt,14:Ji},tr="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",ir={9:"",10:"",11:"",12:"",13:"",14:tr},Et="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",ti="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",ii=ti+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",ri=ii+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",si=ri+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",ni=si+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",rr=ni+" "+Zi,sr={9:ti,10:ii,11:ri,12:si,13:ni,14:rr},ai={};function nr(e){var t=ai[e]={binary:ae(er[e]+" "+Et),binaryOfStrings:ae(ir[e]),nonBinary:{General_Category:ae(Et),Script:ae(sr[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var et=0,wt=[9,10,11,12,13,14];et<wt.length;et+=1){var ar=wt[et];nr(ar)}var x=L.prototype,Ue=function(e,t){this.parent=e,this.base=t||this};Ue.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var n=e;n;n=n.parent)if(t.base===n.base&&t!==n)return!0;return!1},Ue.prototype.sibling=function(){return new Ue(this.parent,this.base)};var te=function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=ai[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};function or(e){for(var t in e)return!0;return!1}function cr(e){return 105===e||109===e||115===e}function oi(e){return 36===e||e>=40&&e<=43||46===e||63===e||e>=91&&e<=94||e>=123&&e<=125}function ur(e){return J(e,!0)||36===e||95===e}function lr(e){return oe(e,!0)||36===e||95===e||8204===e||8205===e}function ci(e){return e>=65&&e<=90||e>=97&&e<=122}function hr(e){return e>=0&&e<=1114111}te.prototype.reset=function(e,t,n){var s=-1!==n.indexOf("v"),i=-1!==n.indexOf("u");this.start=0|e,this.source=t+"",this.flags=n,s&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=i&&this.parser.options.ecmaVersion>=9)},te.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)},te.prototype.at=function(e,t){void 0===t&&(t=!1);var n=this.source,s=n.length;if(e>=s)return-1;var i=n.charCodeAt(e);if(!t&&!this.switchU||i<=55295||i>=57344||e+1>=s)return i;var r=n.charCodeAt(e+1);return r>=56320&&r<=57343?(i<<10)+r-56613888:i},te.prototype.nextIndex=function(e,t){void 0===t&&(t=!1);var n=this.source,s=n.length;if(e>=s)return s;var i,r=n.charCodeAt(e);return!t&&!this.switchU||r<=55295||r>=57344||e+1>=s||(i=n.charCodeAt(e+1))<56320||i>57343?e+1:e+2},te.prototype.current=function(e){return void 0===e&&(e=!1),this.at(this.pos,e)},te.prototype.lookahead=function(e){return void 0===e&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},te.prototype.advance=function(e){void 0===e&&(e=!1),this.pos=this.nextIndex(this.pos,e)},te.prototype.eat=function(e,t){return void 0===t&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},te.prototype.eatChars=function(e,t){void 0===t&&(t=!1);for(var n=this.pos,s=0,i=e;s<i.length;s+=1){var r=i[s],a=this.at(n,t);if(-1===a||a!==r)return!1;n=this.nextIndex(n,t)}return this.pos=n,!0},x.validateRegExpFlags=function(e){for(var t=e.validFlags,n=e.flags,s=!1,i=!1,r=0;r<n.length;r++){var a=n.charAt(r);-1===t.indexOf(a)&&this.raise(e.start,"Invalid regular expression flag"),n.indexOf(a,r+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),"u"===a&&(s=!0),"v"===a&&(i=!0)}this.options.ecmaVersion>=15&&s&&i&&this.raise(e.start,"Invalid regular expression flag")},x.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&or(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},x.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,n=e.backReferenceNames;t<n.length;t+=1){var s=n[t];e.groupNames[s]||e.raise("Invalid named capture referenced")}},x.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Ue(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")},x.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},x.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise("Invalid quantifier"),!0):!!(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))&&(this.regexp_eatQuantifier(e),!0)},x.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!n,!0}return e.pos=t,!1},x.regexp_eatQuantifier=function(e,t){return void 0===t&&(t=!1),!!this.regexp_eatQuantifierPrefix(e,t)&&(e.eat(63),!0)},x.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},x.regexp_eatBracedQuantifier=function(e,t){var n=e.pos;if(e.eat(123)){var s=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(s=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return-1!==i&&i<s&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=n}return!1},x.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},x.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},x.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(e),s=e.eat(45);if(n||s){for(var i=0;i<n.length;i++){var r=n.charAt(i);n.indexOf(r,i+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(s){var a=this.regexp_eatModifiers(e);!n&&!a&&58===e.current()&&e.raise("Invalid regular expression modifiers");for(var o=0;o<a.length;o++){var c=a.charAt(o);(a.indexOf(c,o+1)>-1||n.indexOf(c)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise("Unterminated group")}}e.pos=t}return!1},x.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):63===e.current()&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1},x.regexp_eatModifiers=function(e){for(var t="",n=0;-1!==(n=e.current())&&cr(n);)t+=ie(n),e.advance();return t},x.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},x.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1},x.regexp_eatSyntaxCharacter=function(e){var t=e.current();return!!oi(t)&&(e.lastIntValue=t,e.advance(),!0)},x.regexp_eatPatternCharacters=function(e){for(var t=e.pos,n=0;-1!==(n=e.current())&&!oi(n);)e.advance();return e.pos!==t},x.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return!(-1===t||36===t||t>=40&&t<=43||46===t||63===t||91===t||94===t||124===t)&&(e.advance(),!0)},x.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,n=e.groupNames[e.lastStringValue];if(n)if(t)for(var s=0,i=n;s<i.length;s+=1){i[s].separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(n||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},x.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1},x.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=ie(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=ie(e.lastIntValue);return!0}return!1},x.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,s=e.current(n);return e.advance(n),92===s&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(s=e.lastIntValue),ur(s)?(e.lastIntValue=s,!0):(e.pos=t,!1)},x.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,s=e.current(n);return e.advance(n),92===s&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(s=e.lastIntValue),lr(s)?(e.lastIntValue=s,!0):(e.pos=t,!1)},x.regexp_eatAtomEscape=function(e){return!!(this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e))||(e.switchU&&(99===e.current()&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)},x.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var n=e.lastIntValue;if(e.switchU)return n>e.maxBackReference&&(e.maxBackReference=n),!0;if(n<=e.numCapturingParens)return!0;e.pos=t}return!1},x.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1},x.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},x.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},x.regexp_eatZero=function(e){return 48===e.current()&&!Xe(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},x.regexp_eatControlEscape=function(e){var t=e.current();return 116===t?(e.lastIntValue=9,e.advance(),!0):110===t?(e.lastIntValue=10,e.advance(),!0):118===t?(e.lastIntValue=11,e.advance(),!0):102===t?(e.lastIntValue=12,e.advance(),!0):114===t&&(e.lastIntValue=13,e.advance(),!0)},x.regexp_eatControlLetter=function(e){var t=e.current();return!!ci(t)&&(e.lastIntValue=t%32,e.advance(),!0)},x.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){void 0===t&&(t=!1);var n=e.pos,s=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(s&&i>=55296&&i<=56319){var r=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var a=e.lastIntValue;if(a>=56320&&a<=57343)return e.lastIntValue=1024*(i-55296)+(a-56320)+65536,!0}e.pos=r,e.lastIntValue=i}return!0}if(s&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&hr(e.lastIntValue))return!0;s&&e.raise("Invalid unicode escape"),e.pos=n}return!1},x.regexp_eatIdentityEscape=function(e){if(e.switchU)return!!this.regexp_eatSyntaxCharacter(e)||!!e.eat(47)&&(e.lastIntValue=47,!0);var t=e.current();return!(99===t||e.switchN&&107===t)&&(e.lastIntValue=t,e.advance(),!0)},x.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do{e.lastIntValue=10*e.lastIntValue+(t-48),e.advance()}while((t=e.current())>=48&&t<=57);return!0}return!1};var ui=0,re=1,G=2;function pr(e){return 100===e||68===e||115===e||83===e||119===e||87===e}function li(e){return ci(e)||95===e}function fr(e){return li(e)||Xe(e)}function dr(e){return 33===e||e>=35&&e<=38||e>=42&&e<=44||46===e||e>=58&&e<=64||94===e||96===e||126===e}function mr(e){return 40===e||41===e||45===e||47===e||e>=91&&e<=93||e>=123&&e<=125}function gr(e){return 33===e||35===e||37===e||38===e||44===e||45===e||e>=58&&e<=62||64===e||96===e||126===e}function Xe(e){return e>=48&&e<=57}function hi(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function pi(e){return e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:e-48}function fi(e){return e>=48&&e<=55}x.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(pr(t))return e.lastIntValue=-1,e.advance(),re;var n=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((n=80===t)||112===t)){var s;if(e.lastIntValue=-1,e.advance(),e.eat(123)&&(s=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return n&&s===G&&e.raise("Invalid property name"),s;e.raise("Invalid property name")}return ui},x.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var n=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var s=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,n,s),re}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return ui},x.regexp_validateUnicodePropertyNameAndValue=function(e,t,n){Se(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(n)||e.raise("Invalid property value")},x.regexp_validateUnicodePropertyNameOrValue=function(e,t){return e.unicodeProperties.binary.test(t)?re:e.switchV&&e.unicodeProperties.binaryOfStrings.test(t)?G:void e.raise("Invalid property name")},x.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";li(t=e.current());)e.lastStringValue+=ie(t),e.advance();return""!==e.lastStringValue},x.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";fr(t=e.current());)e.lastStringValue+=ie(t),e.advance();return""!==e.lastStringValue},x.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},x.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),n=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&n===G&&e.raise("Negated character class may contain strings"),!0}return!1},x.regexp_classContents=function(e){return 93===e.current()?re:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),re)},x.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var n=e.lastIntValue;e.switchU&&(-1===t||-1===n)&&e.raise("Invalid character class"),-1!==t&&-1!==n&&t>n&&e.raise("Range out of order in character class")}}},x.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var n=e.current();(99===n||fi(n))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var s=e.current();return 93!==s&&(e.lastIntValue=s,e.advance(),!0)},x.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},x.regexp_classSetExpression=function(e){var t,n=re;if(!this.regexp_eatClassSetRange(e))if(t=this.regexp_eatClassSetOperand(e)){t===G&&(n=G);for(var s=e.pos;e.eatChars([38,38]);)38!==e.current()&&(t=this.regexp_eatClassSetOperand(e))?t!==G&&(n=re):e.raise("Invalid character in character class");if(s!==e.pos)return n;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(s!==e.pos)return n}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(!(t=this.regexp_eatClassSetOperand(e)))return n;t===G&&(n=G)}},x.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var s=e.lastIntValue;return-1!==n&&-1!==s&&n>s&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1},x.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?re:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},x.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var n=e.eat(94),s=this.regexp_classContents(e);if(e.eat(93))return n&&s===G&&e.raise("Negated character class may contain strings"),s;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null},x.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var n=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return n}else e.raise("Invalid escape");e.pos=t}return null},x.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===G&&(t=G);return t},x.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return 1===t?re:G},x.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return!(!this.regexp_eatCharacterEscape(e)&&!this.regexp_eatClassSetReservedPunctuator(e))||(e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1));var n=e.current();return!(n<0||n===e.lookahead()&&dr(n)||mr(n))&&(e.advance(),e.lastIntValue=n,!0)},x.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return!!gr(t)&&(e.lastIntValue=t,e.advance(),!0)},x.regexp_eatClassControlLetter=function(e){var t=e.current();return!(!Xe(t)&&95!==t)&&(e.lastIntValue=t%32,e.advance(),!0)},x.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1},x.regexp_eatDecimalDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;Xe(n=e.current());)e.lastIntValue=10*e.lastIntValue+(n-48),e.advance();return e.pos!==t},x.regexp_eatHexDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;hi(n=e.current());)e.lastIntValue=16*e.lastIntValue+pi(n),e.advance();return e.pos!==t},x.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var n=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=64*t+8*n+e.lastIntValue:e.lastIntValue=8*t+n}else e.lastIntValue=t;return!0}return!1},x.regexp_eatOctalDigit=function(e){var t=e.current();return fi(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)},x.regexp_eatFixedHexDigits=function(e,t){var n=e.pos;e.lastIntValue=0;for(var s=0;s<t;++s){var i=e.current();if(!hi(i))return e.pos=n,!1;e.lastIntValue=16*e.lastIntValue+pi(i),e.advance()}return!0};var xt=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new We(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},k=L.prototype;function vr(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function di(e){return"function"!=typeof BigInt?null:BigInt(e.replace(/_/g,""))}k.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new xt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},k.getToken=function(){return this.next(),new xt(this)},typeof Symbol<"u"&&(k[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===c.eof,value:t}}}}),k.nextToken=function(){var e=this.curContext();return(!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(c.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},k.readToken=function(e){return J(e,this.options.ecmaVersion>=6)||92===e?this.readWord():this.getTokenFromCode(e)},k.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888},k.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf("*/",this.pos+=2);if(-1===n&&this.raise(this.pos-2,"Unterminated comment"),this.pos=n+2,this.options.locations)for(var s=void 0,i=t;(s=Ot(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=s;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.curPosition())},k.skipLineComment=function(e){for(var t=this.pos,n=this.options.onComment&&this.curPosition(),s=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!Ce(s);)s=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,n,this.curPosition())},k.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(!(e>8&&e<14||e>=5760&&Bt.test(String.fromCharCode(e))))break e;++this.pos}}},k.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},k.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===e&&46===t?(this.pos+=3,this.finishToken(c.ellipsis)):(++this.pos,this.finishToken(c.dot))},k.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===e?this.finishOp(c.assign,2):this.finishOp(c.slash,1)},k.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,s=42===e?c.star:c.modulo;return this.options.ecmaVersion>=7&&42===e&&42===t&&(++n,s=c.starstar,t=this.input.charCodeAt(this.pos+2)),61===t?this.finishOp(c.assign,n+1):this.finishOp(s,n)},k.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(c.assign,3);return this.finishOp(124===e?c.logicalOR:c.logicalAND,2)}return 61===t?this.finishOp(c.assign,2):this.finishOp(124===e?c.bitwiseOR:c.bitwiseAND,1)},k.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(c.assign,2):this.finishOp(c.bitwiseXOR,1)},k.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?45!==t||this.inModule||62!==this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!q.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(c.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===t?this.finishOp(c.assign,2):this.finishOp(c.plusMin,1)},k.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=62===e&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+n)?this.finishOp(c.assign,n+1):this.finishOp(c.bitShift,n)):33!==t||60!==e||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===t&&(n=2),this.finishOp(c.relational,n)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},k.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return 61===t?this.finishOp(c.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===e&&62===t&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(c.arrow)):this.finishOp(61===e?c.eq:c.prefix,1)},k.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(46===t){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(c.questionDot,2)}if(63===t){if(e>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(c.assign,3);return this.finishOp(c.coalesce,2)}}return this.finishOp(c.question,1)},k.readToken_numberSign=function(){var e=35;if(this.options.ecmaVersion>=13&&(++this.pos,J(e=this.fullCharCodeAtPos(),!0)||92===e))return this.finishToken(c.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+ie(e)+"'")},k.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(c.parenL);case 41:return++this.pos,this.finishToken(c.parenR);case 59:return++this.pos,this.finishToken(c.semi);case 44:return++this.pos,this.finishToken(c.comma);case 91:return++this.pos,this.finishToken(c.bracketL);case 93:return++this.pos,this.finishToken(c.bracketR);case 123:return++this.pos,this.finishToken(c.braceL);case 125:return++this.pos,this.finishToken(c.braceR);case 58:return++this.pos,this.finishToken(c.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(c.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(c.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+ie(e)+"'")},k.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)},k.readRegexp=function(){for(var e,t,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,"Unterminated regular expression");var s=this.input.charAt(this.pos);if(q.test(s)&&this.raise(n,"Unterminated regular expression"),e)e=!1;else{if("["===s)t=!0;else if("]"===s&&t)t=!1;else if("/"===s&&!t)break;e="\\"===s}++this.pos}var i=this.input.slice(n,this.pos);++this.pos;var r=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(r);var o=this.regexpState||(this.regexpState=new te(this));o.reset(n,i,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var l=null;try{l=new RegExp(i,a)}catch{}return this.finishToken(c.regexp,{pattern:i,flags:a,value:l})},k.readInt=function(e,t,n){for(var s=this.options.ecmaVersion>=12&&void 0===t,i=n&&48===this.input.charCodeAt(this.pos),r=this.pos,a=0,o=0,c=0,l=t??1/0;c<l;++c,++this.pos){var h=this.input.charCodeAt(this.pos),p=void 0;if(s&&95===h)i&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),95===o&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),0===c&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=h;else{if((p=h>=97?h-97+10:h>=65?h-65+10:h>=48&&h<=57?h-48:1/0)>=e)break;o=h,a=a*e+p}}return s&&95===o&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===r||null!=t&&this.pos-r!==t?null:a},k.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var n=this.readInt(e);return null==n&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(n=di(this.input.slice(t,this.pos)),++this.pos):J(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(c.num,n)},k.readNumber=function(e){var t=this.pos;!e&&null===this.readInt(10,void 0,!0)&&this.raise(t,"Invalid number");var n=this.pos-t>=2&&48===this.input.charCodeAt(t);n&&this.strict&&this.raise(t,"Invalid number");var s=this.input.charCodeAt(this.pos);if(!n&&!e&&this.options.ecmaVersion>=11&&110===s){var i=di(this.input.slice(t,this.pos));return++this.pos,J(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(c.num,i)}n&&/[89]/.test(this.input.slice(t,this.pos))&&(n=!1),46===s&&!n&&(++this.pos,this.readInt(10),s=this.input.charCodeAt(this.pos)),(69===s||101===s)&&!n&&((43===(s=this.input.charCodeAt(++this.pos))||45===s)&&++this.pos,null===this.readInt(10)&&this.raise(t,"Invalid number")),J(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var r=vr(this.input.slice(t,this.pos),n);return this.finishToken(c.num,r)},k.readCodePoint=function(){var e;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var t=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(t,"Code point out of bounds")}else e=this.readHexChar(4);return e},k.readString=function(e){for(var t="",n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var s=this.input.charCodeAt(this.pos);if(s===e)break;92===s?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):8232===s||8233===s?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(Ce(s)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(c.string,t)};var mi={};k.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e!==mi)throw e;this.readInvalidTemplateToken()}this.inTemplateElement=!1},k.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw mi;this.raise(e,t)},k.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var n=this.input.charCodeAt(this.pos);if(96===n||36===n&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==c.template&&this.type!==c.invalidTemplate?(e+=this.input.slice(t,this.pos),this.finishToken(c.template,e)):36===n?(this.pos+=2,this.finishToken(c.dollarBraceL)):(++this.pos,this.finishToken(c.backQuote));if(92===n)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(Ce(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(n)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},k.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if("{"!==this.input[this.pos+1])break;case"`":return this.finishToken(c.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":"\n"===this.input[this.pos+1]&&++this.pos;case"\n":case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,"Unterminated template")},k.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return ie(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var n=this.pos-1;this.invalidStringToken(n,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var s=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(s,8);return i>255&&(s=s.slice(0,-1),i=parseInt(s,8)),this.pos+=s.length-1,t=this.input.charCodeAt(this.pos),("0"!==s||56===t||57===t)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-s.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(i)}return Ce(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},k.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return null===n&&this.invalidStringToken(t,"Bad character escape sequence"),n},k.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,n=this.pos,s=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(oe(i,s))this.pos+=i<=65535?1:2;else{if(92!==i)break;this.containsEsc=!0,e+=this.input.slice(n,this.pos);var r=this.pos;117!==this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(t?J:oe)(a,s)||this.invalidStringToken(r,"Invalid Unicode escape"),e+=ie(a),n=this.pos}t=!1}return e+this.input.slice(n,this.pos)},k.readWord=function(){var e=this.readWord1(),t=c.name;return this.keywords.test(e)&&(t=pt[e]),this.finishToken(t,e)};var xr="8.15.0";function tt(e,t){return L.parse(e,t)}function yr(e,t,n){return L.parseExpressionAt(e,t,n)}function it(e,t,n,s,i){var r=[];n||(n=g),function e(s,i,a){var o=a||s.type,c=s!==r[r.length-1];c&&r.push(s),n[o](s,i,e),t[o]&&t[o](s,i||r,r),c&&r.pop()}(e,s,i)}function yt(e,t,n){n(e,t)}function fe(e,t,n){}L.acorn={Parser:L,version:xr,defaultOptions:at,Position:Re,SourceLocation:We,getLineInfo:Ft,Node:Ge,TokenType:T,tokTypes:c,keywordTypes:pt,TokContext:Y,tokContexts:I,isIdentifierChar:oe,isIdentifierStart:J,Token:xt,isNewLine:Ce,lineBreak:q,lineBreakG:Fi,nonASCIIwhitespace:Bt};var g={};g.Program=g.BlockStatement=g.StaticBlock=function(e,t,n){for(var s=0,i=e.body;s<i.length;s+=1){n(i[s],t,"Statement")}},g.Statement=yt,g.EmptyStatement=fe,g.ExpressionStatement=g.ParenthesizedExpression=g.ChainExpression=function(e,t,n){return n(e.expression,t,"Expression")},g.IfStatement=function(e,t,n){n(e.test,t,"Expression"),n(e.consequent,t,"Statement"),e.alternate&&n(e.alternate,t,"Statement")},g.LabeledStatement=function(e,t,n){return n(e.body,t,"Statement")},g.BreakStatement=g.ContinueStatement=fe,g.WithStatement=function(e,t,n){n(e.object,t,"Expression"),n(e.body,t,"Statement")},g.SwitchStatement=function(e,t,n){n(e.discriminant,t,"Expression");for(var s=0,i=e.cases;s<i.length;s+=1){n(i[s],t)}},g.SwitchCase=function(e,t,n){e.test&&n(e.test,t,"Expression");for(var s=0,i=e.consequent;s<i.length;s+=1){n(i[s],t,"Statement")}},g.ReturnStatement=g.YieldExpression=g.AwaitExpression=function(e,t,n){e.argument&&n(e.argument,t,"Expression")},g.ThrowStatement=g.SpreadElement=function(e,t,n){return n(e.argument,t,"Expression")},g.TryStatement=function(e,t,n){n(e.block,t,"Statement"),e.handler&&n(e.handler,t),e.finalizer&&n(e.finalizer,t,"Statement")},g.CatchClause=function(e,t,n){e.param&&n(e.param,t,"Pattern"),n(e.body,t,"Statement")},g.WhileStatement=g.DoWhileStatement=function(e,t,n){n(e.test,t,"Expression"),n(e.body,t,"Statement")},g.ForStatement=function(e,t,n){e.init&&n(e.init,t,"ForInit"),e.test&&n(e.test,t,"Expression"),e.update&&n(e.update,t,"Expression"),n(e.body,t,"Statement")},g.ForInStatement=g.ForOfStatement=function(e,t,n){n(e.left,t,"ForInit"),n(e.right,t,"Expression"),n(e.body,t,"Statement")},g.ForInit=function(e,t,n){"VariableDeclaration"===e.type?n(e,t):n(e,t,"Expression")},g.DebuggerStatement=fe,g.FunctionDeclaration=function(e,t,n){return n(e,t,"Function")},g.VariableDeclaration=function(e,t,n){for(var s=0,i=e.declarations;s<i.length;s+=1){n(i[s],t)}},g.VariableDeclarator=function(e,t,n){n(e.id,t,"Pattern"),e.init&&n(e.init,t,"Expression")},g.Function=function(e,t,n){e.id&&n(e.id,t,"Pattern");for(var s=0,i=e.params;s<i.length;s+=1){n(i[s],t,"Pattern")}n(e.body,t,e.expression?"Expression":"Statement")},g.Pattern=function(e,t,n){"Identifier"===e.type?n(e,t,"VariablePattern"):"MemberExpression"===e.type?n(e,t,"MemberPattern"):n(e,t)},g.VariablePattern=fe,g.MemberPattern=yt,g.RestElement=function(e,t,n){return n(e.argument,t,"Pattern")},g.ArrayPattern=function(e,t,n){for(var s=0,i=e.elements;s<i.length;s+=1){var r=i[s];r&&n(r,t,"Pattern")}},g.ObjectPattern=function(e,t,n){for(var s=0,i=e.properties;s<i.length;s+=1){var r=i[s];"Property"===r.type?(r.computed&&n(r.key,t,"Expression"),n(r.value,t,"Pattern")):"RestElement"===r.type&&n(r.argument,t,"Pattern")}},g.Expression=yt,g.ThisExpression=g.Super=g.MetaProperty=fe,g.ArrayExpression=function(e,t,n){for(var s=0,i=e.elements;s<i.length;s+=1){var r=i[s];r&&n(r,t,"Expression")}},g.ObjectExpression=function(e,t,n){for(var s=0,i=e.properties;s<i.length;s+=1){n(i[s],t)}},g.FunctionExpression=g.ArrowFunctionExpression=g.FunctionDeclaration,g.SequenceExpression=function(e,t,n){for(var s=0,i=e.expressions;s<i.length;s+=1){n(i[s],t,"Expression")}},g.TemplateLiteral=function(e,t,n){for(var s=0,i=e.quasis;s<i.length;s+=1){n(i[s],t)}for(var r=0,a=e.expressions;r<a.length;r+=1){n(a[r],t,"Expression")}},g.TemplateElement=fe,g.UnaryExpression=g.UpdateExpression=function(e,t,n){n(e.argument,t,"Expression")},g.BinaryExpression=g.LogicalExpression=function(e,t,n){n(e.left,t,"Expression"),n(e.right,t,"Expression")},g.AssignmentExpression=g.AssignmentPattern=function(e,t,n){n(e.left,t,"Pattern"),n(e.right,t,"Expression")},g.ConditionalExpression=function(e,t,n){n(e.test,t,"Expression"),n(e.consequent,t,"Expression"),n(e.alternate,t,"Expression")},g.NewExpression=g.CallExpression=function(e,t,n){if(n(e.callee,t,"Expression"),e.arguments)for(var s=0,i=e.arguments;s<i.length;s+=1){n(i[s],t,"Expression")}},g.MemberExpression=function(e,t,n){n(e.object,t,"Expression"),e.computed&&n(e.property,t,"Expression")},g.ExportNamedDeclaration=g.ExportDefaultDeclaration=function(e,t,n){e.declaration&&n(e.declaration,t,"ExportNamedDeclaration"===e.type||e.declaration.id?"Statement":"Expression"),e.source&&n(e.source,t,"Expression")},g.ExportAllDeclaration=function(e,t,n){e.exported&&n(e.exported,t),n(e.source,t,"Expression")},g.ImportDeclaration=function(e,t,n){for(var s=0,i=e.specifiers;s<i.length;s+=1){n(i[s],t)}n(e.source,t,"Expression")},g.ImportExpression=function(e,t,n){n(e.source,t,"Expression")},g.ImportSpecifier=g.ImportDefaultSpecifier=g.ImportNamespaceSpecifier=g.Identifier=g.PrivateIdentifier=g.Literal=fe,g.TaggedTemplateExpression=function(e,t,n){n(e.tag,t,"Expression"),n(e.quasi,t,"Expression")},g.ClassDeclaration=g.ClassExpression=function(e,t,n){return n(e,t,"Class")},g.Class=function(e,t,n){e.id&&n(e.id,t,"Pattern"),e.superClass&&n(e.superClass,t,"Expression"),n(e.body,t)},g.ClassBody=function(e,t,n){for(var s=0,i=e.body;s<i.length;s+=1){n(i[s],t)}},g.MethodDefinition=g.PropertyDefinition=g.Property=function(e,t,n){e.computed&&n(e.key,t,"Expression"),e.value&&n(e.value,t,"Expression")};const ne=class e{static pruneCache(e){e.size>this.MAX_CACHE_SIZE&&Array.from(e.keys()).slice(0,e.size-this.MAX_CACHE_SIZE/2).forEach(t=>e.delete(t))}static clearCaches(){this.expressionCache.clear(),this.variableCache.clear(),this.bindingsCache.clear(),this.loopVariableCache.clear()}static addPatternBindings(e,t){if(e){if("Identifier"===e.type)return void t.add(e.name);if("AssignmentPattern"===e.type)return void this.addPatternBindings(e.left,t);if("RestElement"===e.type)return void this.addPatternBindings(e.argument,t);"ObjectPattern"===e.type&&e.properties.forEach(e=>{"Property"===e.type?this.addPatternBindings(e.value,t):"RestElement"===e.type&&this.addPatternBindings(e.argument,t)})}}static extractStateBindings(t){if(this.bindingsCache.has(t))return[...this.bindingsCache.get(t)];const n=new Set;try{it(tt(t,{ecmaVersion:2020}),{FunctionDeclaration(e,t){t.length<=2&&e.id&&e.id.name&&n.add(e.id.name)},VariableDeclaration(t,s){s.length>2||t.declarations.forEach(t=>{var s,i,r,a,o,c,l;"CallExpression"!==(null==(s=t.init)?void 0:s.type)||"pp"!==(null==(r=null==(i=t.init.callee)?void 0:i.object)?void 0:r.name)||"state"!==(null==(o=null==(a=t.init.callee)?void 0:a.property)?void 0:o.name)&&"reducer"!==(null==(l=null==(c=t.init.callee)?void 0:c.property)?void 0:l.name)?("Identifier"===t.id.type&&n.add(t.id.name),"ObjectPattern"===t.id.type&&e.addPatternBindings(t.id,n)):"ArrayPattern"===t.id.type&&t.id.elements.forEach(e=>{"Identifier"===(null==e?void 0:e.type)&&n.add(e.name)})})}})}catch(e){console.error("[PP-ERROR] AstParser Failed",e)}const s=Array.from(n);return this.pruneCache(this.bindingsCache),this.bindingsCache.set(t,s),s}static extractUsedVariables(e,t){const n=e+"|"+Array.from(t).sort().join(",");if(this.variableCache.has(n))return new Set(this.variableCache.get(n));const s=new Set;try{it(tt(`(${e})`,{ecmaVersion:2020}),{Identifier(e,n){if(!t.has(e.name)){if(n.length>1){const t=n[n.length-2];if("MemberExpression"===t.type&&t.property===e&&!t.computed||"Property"===t.type&&t.key===e&&!t.computed&&!t.shorthand)return}s.add(e.name)}}})}catch{}return this.pruneCache(this.variableCache),this.variableCache.set(n,s),new Set(s)}static isValidExpression(e){if(!e.trim())return!1;if(this.expressionCache.has(e))return this.expressionCache.get(e);let t=!1;try{yr(`(${e})`,0,{ecmaVersion:2020}),t=!0}catch{t=!1}return this.pruneCache(this.expressionCache),this.expressionCache.set(e,t),t}static analyzeLoopVariableUsage(e,t){const n=e+"|"+t;if(this.loopVariableCache.has(n))return[...this.loopVariableCache.get(n)];const s=[];try{it(tt(e,{ecmaVersion:2020}),{Identifier(e,n){if(e.name!==t)return;let i=!1,r=!1,a=e.start,o=e.end;if(n.length>=2){const t=n[n.length-2];if("MemberExpression"===t.type&&t.property===e&&!t.computed||"Property"===t.type&&t.key===e&&!t.computed&&!t.shorthand)return;if("Property"===t.type&&t.shorthand&&(i=!0,n.length>=3)){const e=n[n.length-3];"ObjectExpression"===e.type&&1===e.properties.length&&(r=!0,a=e.start,o=e.end)}}s.push({start:a,end:o,isShorthand:i,isUnwrap:r})}})}catch{}return this.pruneCache(this.loopVariableCache),this.loopVariableCache.set(n,s),[...s]}};d(ne,"expressionCache",new Map),d(ne,"variableCache",new Map),d(ne,"bindingsCache",new Map),d(ne,"loopVariableCache",new Map),d(ne,"MAX_CACHE_SIZE",1e3);let Q=ne;class _e{static escapeTemplateLiteralText(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}static getRuntimeEscaperSource(){return"\nconst __pp_escape_html = (value) => String(value)\n .split('&').join('&')\n .split('<').join('<')\n .split('>').join('>')\n .split('\"').join('"')\n .split(\"'\").join(''');\nconst __pp_raw_html = (value) => ({ __ppRawHtml: String(value) });\nconst __pp_render_value = (value) => {\n if (typeof value === 'boolean' || value == null) return '';\n if (value && typeof value === 'object' && Object.prototype.hasOwnProperty.call(value, '__ppRawHtml')) return value.__ppRawHtml;\n if (Array.isArray(value)) return value.map(__pp_render_value).join('');\n return __pp_escape_html(value);\n};\nconst __pp_decode_html_entities = (value) => String(value)\n .split('"').join('\"')\n .split('"').join('\"')\n .split(''').join(\"'\")\n .split('<').join('<')\n .split('>').join('>')\n .split('&').join('&');\nconst __pp_find_dynamic_closing_brace = (value, start) => {\n let depth = 0;\n let quote = null;\n let escaped = false;\n for (let index = start; index < value.length; index++) {\n const char = value[index];\n if (escaped) {\n escaped = false;\n continue;\n }\n if (char === String.fromCharCode(92)) {\n escaped = true;\n continue;\n }\n if (quote) {\n if (char === quote) quote = null;\n continue;\n }\n if (char === '\"' || char === \"'\" || char === String.fromCharCode(96)) {\n quote = char;\n continue;\n }\n if (char === '{') depth++;\n if (char === '}') {\n depth--;\n if (depth === 0) return index;\n }\n }\n return -1;\n};\nconst __pp_interpolate_dynamic_html = (value) => {\n const source = String(value);\n let result = '';\n let cursor = 0;\n while (cursor < source.length) {\n if (source[cursor] !== '{') {\n result += source[cursor++];\n continue;\n }\n const closing = __pp_find_dynamic_closing_brace(source, cursor);\n if (closing === -1) {\n result += source[cursor++];\n continue;\n }\n const expression = __pp_decode_html_entities(source.slice(cursor + 1, closing));\n try {\n result += __pp_render_value(eval(expression));\n } catch {\n result += source.slice(cursor, closing + 1);\n }\n cursor = closing + 1;\n }\n return result;\n};\nconst __pp_dynamic_component = (value) => {\n const renderOne = (entry) => {\n let resolved = entry;\n if (typeof resolved === 'function') resolved = resolved();\n if (typeof resolved === 'boolean' || resolved == null) return '';\n if (resolved && typeof resolved === 'object' && Object.prototype.hasOwnProperty.call(resolved, '__ppRawHtml')) {\n return __pp_interpolate_dynamic_html(resolved.__ppRawHtml);\n }\n return __pp_interpolate_dynamic_html(resolved);\n };\n return __pp_raw_html(Array.isArray(value) ? value.map(renderOne).join('') : renderOne(value));\n};\n"}static escapeTemplateLiteralTextPreservingInterpolations(e){let t="",n=0,s=0;for(;n<e.length;){if("$"===e[n]&&"{"===e[n+1]){const i=this.findClosingBrace(e,n+1);if(-1!==i){t+=this.escapeTemplateLiteralText(e.slice(s,n)),t+=e.slice(n,i+1),n=i+1,s=n;continue}}n++}return t+=this.escapeTemplateLiteralText(e.slice(s)),t}static clearCache(){this.cache.clear()}static pruneCache(){if(this.cache.size>this.MAX_CACHE_SIZE){const e=this.cache.size-Math.floor(this.MAX_CACHE_SIZE/2);let t=0;for(const n of this.cache.keys()){if(t>=e)break;this.cache.delete(n),t++}}}static transformSpreadAttributes(e){const t=new Map;let n=0;const s=document.createElement("template");s.innerHTML=e;const i=e=>{if(e.nodeType===Node.ELEMENT_NODE){const s=e;if(Array.from(s.childNodes).forEach(i),s.hasAttribute("pp-spread")){const e=s.getAttribute("pp-spread")||"";s.removeAttribute("pp-spread");const i=K(e),r=(null==i?void 0:i.expression.trim())??"";if(r.startsWith("...")){const e=B(r.slice(3).trim()),i=`___pp_spread_${n++}___`,a=`\${ (() => {\n const __obj = ${e};\n if (!__obj || typeof __obj !== 'object') return '';\n return Object.entries(__obj)\n .map(([k, v]) => {\n if (v == null) return '';\n const __attrName = String(k);\n if (!/^[^\\s"'<>/=]+$/.test(__attrName) || /^on/i.test(__attrName)) return '';\n const __escapedValue = String(v)\n .split('&').join('&')\n .split('"').join('"')\n .split("'").join(''')\n .split('<').join('<')\n .split('>').join('>');\n return __attrName + '="' + __escapedValue + '"';\n })\n .filter(Boolean)\n .join(' ');\n })() }`;t.set(i,a),s.setAttribute(i,"")}}}};return Array.from(s.content.childNodes).forEach(i),{html:s.innerHTML,spreadReplacements:t}}static expandSpreadPlaceholders(e,t){let n=e;return t.forEach((e,t)=>{n=n.split(`${t}=""`).join(e),n=n.split(t).join(e)}),n}static transformRefAttributes(e){if(!e.includes("pp-ref"))return e;const t=document.createElement("template");t.innerHTML=e;const n=document.createTreeWalker(t.content,NodeFilter.SHOW_ELEMENT);let s=n.nextNode();for(;s;){const e=s;if(e.hasAttribute("pp-ref")){const t=K(e.getAttribute("pp-ref")||"");if(t){const n=B(t.expression);e.removeAttribute("pp-ref"),e.setAttribute("data-pp-ref",`{ __pp_ref(${n}) }`)}}s=n.nextNode()}return t.innerHTML}static transformComponentTags(e){const t=document.createElement("template");t.innerHTML=e;const n=e=>{if(e.nodeType!==Node.ELEMENT_NODE)return;const t=e,s=t.tagName.toLowerCase();if(Array.from(t.childNodes).forEach(n),s.includes(".")&&!s.endsWith(".provider")){const e=document.createDocumentFragment();for(e.appendChild(document.createTextNode(`{__pp_dynamic_component(${s})}`));t.firstChild;)e.appendChild(t.firstChild);t.replaceWith(e)}};return Array.from(t.content.childNodes).forEach(n),t.innerHTML}static transformContextProviderTags(e){if(!/\.provider\b/i.test(e))return e;let t="",n=0;for(;n<e.length;){const s=e.slice(n).match(/^<([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*\.Provider)\b/i);if(!s){t+=e[n],n+=1;continue}const i=s[1],r=this.findOpeningTagEnd(e,n);if(-1===r){t+=e[n],n+=1;continue}const a=e.slice(n+s[0].length,r),o=r+1,c=this.findMatchingContextProviderClose(e,o);if(!c){t+=e[n],n+=1;continue}const l=this.transformContextProviderTags(e.slice(o,c.start));t+=`<pp-context-provider data-pp-context-token="{ __pp_context_token(__pp_context_lookup(${`'${i.replace(/\.Provider$/i,"").replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`})) }" data-pp-context-value="{ __pp_context_value(${this.extractContextProviderValueExpression(a)}) }">`+l+"</pp-context-provider>",n=c.end}return t}static findOpeningTagEnd(e,t){let n=null,s=0;for(let i=t;i<e.length;i++){const t=e[i],r=this.isEscaped(e,i);if(n){if("{"===t&&!r){s++;continue}if("}"===t&&!r&&s>0){s--;continue}t===n&&!r&&0===s&&(n=null)}else if(r||'"'!==t&&"'"!==t){if(">"===t)return i}else n=t,s=0}return-1}static findMatchingContextProviderClose(e,t){this.CONTEXT_PROVIDER_TAG_PATTERN.lastIndex=t;let n,s=1;for(;n=this.CONTEXT_PROVIDER_TAG_PATTERN.exec(e);){const e=n[0];if(s+=e.startsWith("</")?-1:1,0===s)return{start:n.index,end:n.index+e.length}}return null}static extractContextProviderValueExpression(e){const t=e.match(/\bvalue\s*=\s*(?:"([\s\S]*?)"|'([\s\S]*?)'|([^\s>]+))/i);if(!t)return"undefined";const n=t[1]??t[2]??t[3]??"",s=K(B(n.trim()));return s?s.expression:JSON.stringify(n)}static normalizeTextareaValueAttributes(e){if(!e.includes("<textarea")||!e.includes("value="))return e;const t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("textarea").forEach(e=>{const t=e,n=t.getAttribute("value");null!==n&&(t.textContent=n,t.removeAttribute("value"))}),t.innerHTML}static transformStyleAliasAttributes(e){if(!e.includes("pp-style"))return e;const t=document.createElement("template");t.innerHTML=e;const n=document.createTreeWalker(t.content,NodeFilter.SHOW_ELEMENT);let s=n.nextNode();for(;s;){const e=s;if(e.hasAttribute("pp-style")){const t=e.getAttribute("pp-style")??"",n=e.getAttribute("style")??"";e.removeAttribute("pp-style");const s=this.mergeStyleAttributeValues(n,t);s.length>0&&e.setAttribute("style",s)}s=n.nextNode()}return t.innerHTML}static mergeStyleAttributeValues(e,t){const n=e.trim(),s=t.trim().replace(/^;+\s*/,"");return n?s?`${n.endsWith(";")?n:`${n};`} ${s}`:n:s}static transformSelectValueAttributes(e){if(!e.includes("<select")||!e.includes("value="))return e;const t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("select").forEach(e=>{const t=e,n=t.getAttribute("value");if(null===n)return;const s=K(n);if(!s)return;const i=B(s.expression);t.removeAttribute("value"),t.setAttribute("data-pp-select-value",`{ __pp_select_value(${i}) }`)}),t.innerHTML}static transformInputValueAttributes(e){if(!e.includes("<input")||!e.includes("value="))return e;const t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("input").forEach(e=>{const t=e,n=t.getAttribute("value");if(null===n)return;const s=K(n);if(!s)return;const i=B(s.expression);t.removeAttribute("value"),t.setAttribute("data-pp-input-value",`{ __pp_input_value(${i}) }`)}),t.innerHTML}static transformCheckedValueAttributes(e){if(!e.includes("<input")||!e.includes("checked="))return e;const t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("input").forEach(e=>{const t=e,n=t.getAttribute("checked");if(null===n)return;const s=K(n);if(!s)return;const i=B(s.expression);t.removeAttribute("checked"),t.setAttribute("data-pp-checked-value",`{ __pp_checked_value(${i}) }`)}),t.innerHTML}static transformDefaultValueAttributes(e){if(!e.includes("default"))return e;const t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("input, textarea, select").forEach(e=>{const t=e,n=t.getAttribute("defaultvalue");if(null===n)return;const s=K(n);if(!s)return;const i=B(s.expression);t.removeAttribute("defaultvalue"),t.setAttribute("data-pp-default-value",`{ __pp_default_value(${i}) }`)}),t.innerHTML}static transformDefaultCheckedAttributes(e){if(!e.includes("default"))return e;const t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("input").forEach(e=>{const t=e,n=t.getAttribute("defaultchecked");if(null===n)return;const s=K(n);if(!s)return;const i=B(s.expression);t.removeAttribute("defaultchecked"),t.setAttribute("data-pp-default-checked",`{ __pp_default_checked(${i}) }`)}),t.innerHTML}static compile(e,t){const n=(e||"").replace(/\r\n/g,"\n").replace(/\r/g,"\n"),s=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t.toString(16).padStart(8,"0")},i=t.join("\0"),r=`t${s(n)}|k${s(i)}|n${t.length}`;if(this.cache.has(r))return this.cache.get(r);const a=this.transformContextProviderTags(n),{maskedHtml:o,placeholders:c}=this.maskLiteralHtmlTextNodes(a),{maskedTemplate:l,placeholders:h}=this.maskComplexComponents(o),{maskedHtml:p,placeholders:u}=this.maskLiteralElements(l,"style","STYLE"),{maskedHtml:d,placeholders:f}=this.maskLiteralElements(p,"code","CODE",e=>!this.isPureBindingLiteral(e.innerHTML)),{maskedHtml:m,placeholders:g}=this.maskLiteralElements(d,"script","SCRIPT"),v=this.transformComponentTags(m),y=this.transformStyleAliasAttributes(v),_=this.normalizeTextareaValueAttributes(Lt(y)),x=t.includes("__pp_input_value")?this.transformInputValueAttributes(_):_,C=t.includes("__pp_checked_value")?this.transformCheckedValueAttributes(x):x,S=this.transformSelectValueAttributes(C),b=this.transformDefaultValueAttributes(S),E=this.transformDefaultCheckedAttributes(b),{html:k,spreadReplacements:w}=this.transformSpreadAttributes(E),A=this.transformRefAttributes(k),{html:T,loopReplacements:P}=this.processStructuralDirectives(A);let I=this.transformBooleanAttributes(T);(()=>{let e=!0;for(;e;)e=!1,P.forEach((t,n)=>{const s=I;I=I.split("${"+n+"}").join("${"+t+"}"),I=I.split(n).join("{ __pp_raw_html("+t+") }"),I!==s&&(e=!0)})})();const R=new Set;let L=this.getRuntimeEscaperSource()+"return `",N=0,V="";for(;N<I.length;){const e=I[N];if("o"===e||"O"===e){const e=I.slice(N,N+20).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(e){const t=I.slice(N,N+e[0].length),n=t[t.length-1];let s=N+e[0].length;for(;s<I.length&&(I[s]!==n||"\\"===I[s-1]);)s++;V+=I.slice(N,s+1),N=s+1;continue}}if("{"===e){const e=this.findClosingBrace(I,N);if(-1!==e){const t=I.slice(N+1,e),n=B(t);if(Q.isValidExpression(n)){L+=this.escapeTemplateLiteralText(V),V="";const t=Q.extractUsedVariables(n,Ei);for(const e of t)/^___PP_LOOP_\d+___$/.test(e)||R.add(e);const s=n.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g," ");L+=`\${ (() => {\n try {\n const __res = (${n});\n return __pp_render_value(__res);\n } catch(e) {\n console.error("[PP-ERROR] Template Expression Failed: \\"${s}\\"", e);\n return '';\n }\n })() }`,N=e+1;continue}t.trim().length>0&&console.warn(`[PP-WARN] Interpolation skipped. Invalid Syntax in: "{${n}}"`)}}V+=e,N++}L+=this.escapeTemplateLiteralText(V),L+="`;",L=this.expandSpreadPlaceholders(L,w);const M=t.slice();try{const e=new Function(...M,L),t=(...t)=>{let n=e(...t);return n=this.restorePlaceholders(n,g),n=this.restorePlaceholders(n,f),n=this.restorePlaceholders(n,u),h.forEach((e,t)=>{n=n.replace(t,e)}),n=this.restorePlaceholders(n,c),n};return this.pruneCache(),this.cache.set(r,t),t}catch(e){return console.error("[PP-ERROR] Compilation Failed",e),()=>"Error in Template"}}static maskLiteralElements(e,t,n,s=()=>!0){const i=document.createElement("template");i.innerHTML=e;const r=new Map;let a=0;return i.content.querySelectorAll(t).forEach(e=>{if(!s(e))return;const t=`__PP_${n}_${a++}__`;r.set(t,e.outerHTML),e.replaceWith(document.createTextNode(t))}),{maskedHtml:i.innerHTML,placeholders:r}}static maskLiteralHtmlTextNodes(e){const t=document.createElement("template");t.innerHTML=e;const n=new Map,s={value:0},i=document.createTreeWalker(t.content,NodeFilter.SHOW_TEXT),r=[];for(;i.nextNode();)r.push(i.currentNode);return r.forEach(e=>{if(this.isWithinLiteralTextContainer(e))return;const t=e.textContent??"";if(!t.includes("{")&&!t.includes("}"))return;const i=this.splitLiteralHtmlTextSegments(t);if(!i)return;let r="";i.forEach(e=>{r+=e.literalHtml?this.maskLiteralBraces(e.text,n,s):e.text}),e.textContent=r}),{maskedHtml:t.innerHTML,placeholders:n}}static isWithinLiteralTextContainer(e){let t=e.parentNode;for(;t;){if(t.nodeType===Node.ELEMENT_NODE){const e=t.tagName.toLowerCase();if("code"===e||"pre"===e||"script"===e||"style"===e)return!0}t=t.parentNode}return!1}static splitLiteralHtmlTextSegments(e){if(!e.includes("<")||!e.includes(">"))return null;const t=document.createElement("template");t.innerHTML=e;const n=Array.from(t.content.childNodes).map(e=>({text:e.nodeType===Node.TEXT_NODE?e.textContent??"":this.serializeNodeHtml(e),literalHtml:e.nodeType!==Node.TEXT_NODE}));return n.some(e=>e.literalHtml)?n:null}static serializeNodeHtml(e){if(e.nodeType===Node.TEXT_NODE)return e.textContent??"";const t=document.createElement("template");return t.content.appendChild(e.cloneNode(!0)),t.innerHTML}static maskLiteralBraces(e,t,n){let s="";for(const i of e){if("{"===i||"}"===i){const e=`__PP_LITERAL_HTML_BRACE_${n.value++}__`;t.set(e,i),s+=e;continue}s+=i}return s}static isPureBindingLiteral(e){return null!==K(e)}static restorePlaceholders(e,t){let n=e;return t.forEach((e,t)=>{n=n.replace(t,e)}),n}static transformBooleanAttributes(e){let t="",n=0;for(;n<e.length;){let s=!1;for(const i of Rt){const r=`${i}="{`,a=`${i}='{`;if(e.startsWith(r,n)){s=!0;const a=n+r.length-1,o=this.findClosingBrace(e,a);if(-1!==o&&'"'===e[o+1]){const s=B(e.slice(a+1,o)),r=s.replace(/\\/g,"\\\\").replace(/'/g,"\\'");t+=`{ (() => { const __ppAttr = (${s}); if (typeof __ppAttr === 'boolean') return __pp_raw_html(__ppAttr ? '${i}' : ''); if (__ppAttr == null) return ''; if (typeof __ppAttr === 'string' || typeof __ppAttr === 'number' || typeof __ppAttr === 'bigint') return __pp_raw_html('${i}="' + __pp_escape_html(__ppAttr) + '"'); return __pp_raw_html('${i}="{${r}}"'); })() }`,n=o+2;break}}else if(e.startsWith(a,n)){s=!0;const r=n+a.length-1,o=this.findClosingBrace(e,r);if(-1!==o&&"'"===e[o+1]){const s=B(e.slice(r+1,o)),a=s.replace(/\\/g,"\\\\").replace(/'/g,"\\'");t+=`{ (() => { const __ppAttr = (${s}); if (typeof __ppAttr === 'boolean') return __pp_raw_html(__ppAttr ? '${i}' : ''); if (__ppAttr == null) return ''; if (typeof __ppAttr === 'string' || typeof __ppAttr === 'number' || typeof __ppAttr === 'bigint') return __pp_raw_html('${i}="' + __pp_escape_html(__ppAttr) + '"'); return __pp_raw_html('${i}="{${a}}"'); })() }`,n=o+2;break}}}s||(t+=e[n],n++)}return t}static captureLoopVariablesInEventHandlers(e,t,n,s,i=!1,r=[]){let a="",o=0;for(;o<e.length;){const c=e.slice(o,o+40).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(c){const l=c[0].length,h=e.slice(o,o+l),p=h[h.length-1],u=o+l;let d=u;for(;d<e.length&&(e[d]!==p||"\\"===e[d-1]);)d++;const f=h.slice(0,-2).trim();let m=e.slice(u,d);m=this.rewriteLoopEventHandlerCode(m,t,n,s,i,r),a+=`${f}=${p}${m}${p}`,o=d+1;continue}a+=e[o],o++}return a}static rewriteLoopEventHandlerCode(e,t,n,s,i,r=[]){const a=K(e),o=a?a.expression:e;let c=n,l=o;r.forEach(e=>{c=this.applyLoopContextRewrites(c,e),l=this.applyLoopContextRewrites(l,e)});const h={iterator:t,collectionName:c,indexVar:s,userDefinedIndex:i};return l=this.applyLoopContextRewrites(l,h),[...r,h].forEach(e=>{const t=this.getLoopIndexToken(e.indexVar);l=l.split(t).join(`\${${e.indexVar}}`)}),a?`{${l}}`:l}static getLoopIndexToken(e){return`__PP_LOOP_IDX_${e}__`}static applyLoopContextRewrites(e,t){const n=this.getLoopIndexToken(t.indexVar);let s=e;return t.userDefinedIndex&&(s=this.replaceLoopIdentifierUsages(s,t.indexVar,n)),this.replaceLoopIdentifierUsages(s,t.iterator,`(${t.collectionName})[${n}]`)}static replaceLoopIdentifierUsages(e,t,n){const s=Q.analyzeLoopVariableUsage(e,t).slice().sort((e,t)=>t.start-e.start);if(0===s.length)return e;let i=e;return s.forEach(e=>{const s=e.isShorthand?this.buildShorthandReplacement(t,n,e.isUnwrap):n;i=i.slice(0,e.start)+s+i.slice(e.end)}),i}static buildShorthandReplacement(e,t,n){return n?`{ ${e}: ${t} }`:`${e}: ${t}`}static isIdentifier(e){return/^[A-Za-z_$][\w$]*$/.test(e)}static stripBalancedParens(e){const t=e.trim();return t.startsWith("(")&&this.findMatchingToken(t,0,"(",")")===t.length-1?t.slice(1,-1).trim():null}static parseLoopDirective(e){const t=this.findTopLevelInSeparator(e);if(-1===t)return null;const n=e.slice(0,t).trim(),s=e.slice(t+2).trim();if(!n||!s)return null;const i=this.stripBalancedParens(n);if(null!==i){const e=this.findTopLevelToken(i,",");if(-1===e)return null;const t=i.slice(0,e).trim(),n=i.slice(e+1).trim();return t&&n?{iterator:t,indexVar:n,collection:s}:null}return{iterator:n,indexVar:null,collection:s}}static findTopLevelInSeparator(e){const t={parenDepth:0,bracketDepth:0,braceDepth:0,quote:null};for(let n=0;n<e.length;n++){const s=e[n];if(!this.advanceScannerState(t,e,n)&&0===t.parenDepth&&0===t.bracketDepth&&0===t.braceDepth&&"i"===s&&"n"===e[n+1]&&/\s/.test(e[n-1]??"")&&/\s/.test(e[n+2]??""))return n}return-1}static findTopLevelToken(e,t){const n={parenDepth:0,bracketDepth:0,braceDepth:0,quote:null};for(let s=0;s<e.length;s++)if(!this.advanceScannerState(n,e,s)&&0===n.parenDepth&&0===n.bracketDepth&&0===n.braceDepth&&e[s]===t)return s;return-1}static findMatchingToken(e,t,n,s){let i=0,r=null;for(let a=t;a<e.length;a++){const t=e[a],o=this.isEscaped(e,a);if(r)t===r&&!o&&(r=null);else if(o||'"'!==t&&"'"!==t&&"`"!==t)if(t!==n||o){if(t===s&&!o&&(i--,0===i))return a}else i++;else r=t}return-1}static advanceScannerState(e,t,n){const s=t[n],i=this.isEscaped(t,n);return e.quote?(s===e.quote&&!i&&(e.quote=null),!0):i||'"'!==s&&"'"!==s&&"`"!==s?(i||("("===s?e.parenDepth++:")"===s?e.parenDepth--:"["===s?e.bracketDepth++:"]"===s?e.bracketDepth--:"{"===s?e.braceDepth++:"}"===s&&e.braceDepth--),!1):(e.quote=s,!0)}static isEscaped(e,t){let n=0,s=t-1;for(;s>=0&&"\\"===e[s];)n++,s--;return n%2!=0}static processStructuralDirectives(e){if(!e.includes("pp-for"))return{html:e,loopReplacements:new Map};const t=document.createElement("template");t.innerHTML=e;const n=new Map;let s=0,i=0;const r=(e,t=[])=>{const a=Array.from(e.childNodes);for(const e of a){if(e.nodeType!==Node.ELEMENT_NODE)continue;const a=e;if("TEMPLATE"===a.tagName){const e=a,o=e.getAttribute("pp-for")||"";let c=null;if(e.hasAttribute("pp-for")){const e=this.parseLoopDirective(o);let t,n,s,r=!1;if(!e){console.warn(`[PP-WARN] Invalid pp-for directive skipped: "${o}"`);continue}if(t=e.iterator,s=e.collection,n=e.indexVar??"__pp_idx_"+i++,r=null!==e.indexVar,!this.isIdentifier(t)||r&&!this.isIdentifier(n)){console.warn(`[PP-WARN] pp-for currently expects identifier loop variables: "${o}"`);continue}if(!Q.isValidExpression(s)){console.warn(`[PP-WARN] Invalid pp-for collection expression skipped: "${s}"`);continue}c={iterator:t,collectionName:s,indexVar:n,userDefinedIndex:r}}if(r(e.content,c?[...t,c]:t),c){const{iterator:i,collectionName:r,indexVar:a,userDefinedIndex:o}=c;let l=e.innerHTML;l=this.transformContextProviderTags(l),l=this.transformComponentTags(l),l=this.transformRefAttributes(l),l=this.transformStyleAliasAttributes(l),l=this.captureLoopVariablesInEventHandlers(l,i,r,a,o,t),l=l.replace(/___PP_LOOP_\d+___/g,e=>"${"+e+"}"),l=l.replace(/\r/g,""),l=this.transformBooleanAttributes(l),l=this.transformInterpolations(l),l=this.escapeTemplateLiteralTextPreservingInterpolations(l);const h=`(Array.isArray(${r}) ? ${r} : []).map(${`(${i}, ${a})`} => \`${l}\`).join('')`,p=`___PP_LOOP_${s++}___`;n.set(p,h),e.replaceWith(document.createTextNode(p));continue}continue}r(a,t)}};return r(t.content),{html:t.innerHTML,loopReplacements:n}}static transformInterpolations(e){let t="",n=0;for(;n<e.length;){if("o"===e[n]||"O"===e[n]){const s=e.slice(n,n+20).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(s){const i=e.slice(n,n+s[0].length),r=i[i.length-1];let a=n+s[0].length;for(;a<e.length&&(e[a]!==r||"\\"===e[a-1]);)a++;t+=e.slice(n,a+1),n=a+1;continue}}if("{"===e[n]){if(n>0&&"$"===e[n-1]){t+="{",n++;continue}const s=this.findClosingBrace(e,n);if(-1!==s){const i=B(e.slice(n+1,s));if(Q.isValidExpression(i)){t+="${__pp_render_value("+i+")}",n=s+1;continue}}}t+=e[n],n++}return t}static maskComplexComponents(e){if(!e.includes("pp-component="))return{maskedTemplate:e,placeholders:new Map};const t=document.createElement("template");t.innerHTML=e;const n=new Map;let s=0;const i=e=>{if(e instanceof Element&&e.hasAttribute("pp-component")){const t=!!e.querySelector("script"),i=!!e.querySelector("template[pp-owner]");if(t||i){const t=`__PP_CHILD_${s++}__`;return n.set(t,e.outerHTML),void e.replaceWith(document.createTextNode(t))}}Array.from(e.children).forEach(e=>i(e))};return i(t.content),{maskedTemplate:t.innerHTML,placeholders:n}}static findClosingBrace(e,t){return ht(e,t)}}d(_e,"cache",new Map),d(_e,"MAX_CACHE_SIZE",200),d(_e,"CONTEXT_PROVIDER_TAG_PATTERN",/<\/?([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*\.Provider)\b[^>]*>/gi);class br{constructor(e){d(this,"bindingSeq",0),d(this,"activeBindings",new Map),this.componentId=e}ensureBindingId(e,t){const n="captured"===t?"__ppCapturedRefBindingId":"__ppPlainRefBindingId";return e[n]||(e[n]=`pprefbind_${this.componentId}_${t}_${++this.bindingSeq}`),e[n]}commit(e){for(const[t,n]of this.activeBindings.entries()){const s=e.get(t);s?(n.value!==s.value||n.element!==s.element)&&this.clearValue(n.value,"[PP-WARN] Ref cleanup failed"):this.clearValue(n.value,"[PP-WARN] Ref cleanup failed")}for(const[t,n]of e.entries()){const e=this.activeBindings.get(t);e&&e.value===n.value&&e.element===n.element||this.attachValue(n.value,n.element,"[PP-WARN] Ref attachment failed")}this.activeBindings=e}clearAll(){for(const e of this.activeBindings.values())this.clearValue(e.value,"[PP-WARN] Ref cleanup failed");this.activeBindings.clear()}attachValue(e,t,n){this.updateValue(e,t,n)}clearValue(e,t){this.updateValue(e,null,t)}updateValue(e,t,n){try{"function"==typeof e?e(t):e&&"object"==typeof e&&"current"in e&&(e.current=t)}catch(e){console.warn(n,e)}}}class _r{constructor(e){d(this,"trackedPortals",new Map),this.componentId=e}get size(){return this.trackedPortals.size}has(e){return this.trackedPortals.has(e)}get(e){return this.trackedPortals.get(e)}getPlaceholderText(e){const t=this.trackedPortals.get(e);return(null==t?void 0:t.placeholder.data)||`pp-portal:${this.componentId}`}apply(e){const t=new Set;let n=!1;for(const s of e){const e=s.ref.current;if(!e)continue;const i=s.target??document.body;t.add(e);const r=this.trackedPortals.get(e);if(null!=r&&r.placeholder.parentNode){r.target!==i&&(i.appendChild(e),r.target=i,n=!0);continue}null===s.info.sourceParent&&e.parentNode instanceof Element&&(s.info.sourceParent=e.parentNode);const a=document.createComment(`pp-portal:${this.componentId}`);e.parentNode&&e.parentNode.insertBefore(a,e),i.appendChild(e),this.trackedPortals.set(e,{element:e,placeholder:a,target:i}),n=!0}for(const[e,s]of this.trackedPortals)t.has(e)||(s.placeholder.parentNode?(s.placeholder.parentNode.insertBefore(e,s.placeholder),s.placeholder.remove()):e.parentNode&&e.remove(),this.trackedPortals.delete(e),n=!0);return n}replaceElement(e,t){const n=this.trackedPortals.get(e);n&&(this.trackedPortals.delete(e),this.trackedPortals.set(t,{...n,element:t}))}contains(e){for(const[t]of this.trackedPortals)if(t===e||t.contains(e))return!0;return!1}elements(){return Array.from(this.trackedPortals.keys())}values(){return Array.from(this.trackedPortals.values())}destroyAll(){for(const[,e]of this.trackedPortals)e.element.parentNode&&e.element.remove(),e.placeholder.parentNode&&e.placeholder.remove();this.trackedPortals.clear()}}class Cr{constructor(){d(this,"registeredResetForms",new Set)}applyControlledSelectValue(e,t){if(e.multiple){const n=new Set(this.normalizeControlledSelectValues(t));for(let t=0;t<e.options.length;t++){const s=e.options[t],i=n.has(s.value);s.selected!==i&&(s.selected=i)}return}const n=null==t?"":String(t);e.value!==n&&(e.value=n)}applyControlledInputValue(e,t){const n=null==t?"":String(t);this.shouldDeferFocusedDateLikeInputValue(e,n)?this.deferFocusedControlledInputValue(e,t):this.shouldDeferActiveNativeTextInputValue(e,n)||e.value!==n&&(e.value=n)}bindControlledSelectValues(e,t){for(let n=0;n<e.length;n++){const s=e[n];if(!(s instanceof HTMLSelectElement))continue;const i=this.resolveControlledSelectCaptureId(s,t);i&&(this.trackValueControlMode(s,"controlled"),this.applyControlledSelectValue(s,t.get(i)))}}bindControlledInputValues(e,t){for(let n=0;n<e.length;n++){const s=e[n];if(!(s instanceof HTMLInputElement))continue;const i=this.resolveControlledInputValue(s,t);i.hasValue&&(this.trackValueControlMode(s,"controlled"),this.applyControlledInputValue(s,i.value))}}bindControlledCheckedValues(e,t){for(let n=0;n<e.length;n++){const s=e[n];if(!(s instanceof HTMLInputElement))continue;const i=this.resolveControlledCheckedValue(s,t);if(!i.hasValue)continue;this.trackCheckedControlMode(s,"controlled");const r=!!i.value;s.checked!==r&&(s.checked=r)}}applyUncontrolledDefaultValue(e,t){if(e instanceof HTMLSelectElement)return void this.applyUncontrolledDefaultSelectValue(e,t);const n=null==t?"":String(t);this.trackValueControlMode(e,"uncontrolled"),e.defaultValue!==n&&(e.defaultValue=n),e.value!==n&&(e.value=n),e.__ppHasUncontrolledDefaultValue=!0}applyUncontrolledDefaultChecked(e,t){const n=this.normalizeDefaultCheckedValue(t);this.trackCheckedControlMode(e,"uncontrolled"),e.defaultChecked!==n&&(e.defaultChecked=n),e.checked!==n&&(e.checked=n),e.__ppHasUncontrolledDefaultChecked=!0}restoreUncontrolledSelectState(e){const t=Array.from(e.options);if(e.multiple)return void t.forEach(e=>{e.selected=e.defaultSelected});const n=t.find(e=>e.defaultSelected);n?e.value=n.value:t.length>0&&(e.selectedIndex=0)}isUncontrolledResetManagedElement(e){const t=e;return!(!t.__ppHasUncontrolledDefaultValue&&!t.__ppHasUncontrolledDefaultChecked)||e instanceof HTMLSelectElement&&Array.from(e.options).some(e=>e.defaultSelected)}syncUncontrolledFormResets(e,t,n){const s=new Set;for(let i=0;i<t.length;i++){const r=t[i],a=r.closest("form");a instanceof HTMLFormElement&&this.isUncontrolledResetManagedElement(r)&&(s.add(a),this.registerResetHandler(a,e,()=>{this.restoreUncontrolledFormDefaults(a,n())}))}for(const t of this.registeredResetForms)s.has(t)||this.unregisterResetHandler(t,e);this.registeredResetForms=s}clearResetHandlers(e){for(const t of this.registeredResetForms)this.unregisterResetHandler(t,e);this.registeredResetForms.clear()}restoreUncontrolledFormDefaults(e,t){for(let n=0;n<t.length;n++){const s=t[n],i=s;if(s.closest("form")===e){if(s instanceof HTMLSelectElement){this.restoreUncontrolledSelectState(s);continue}(s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement)&&i.__ppHasUncontrolledDefaultValue&&(s.value=s.defaultValue),s instanceof HTMLInputElement&&i.__ppHasUncontrolledDefaultChecked&&(s.checked=s.defaultChecked)}}}resolveDefaultValueBinding(e,t){const n=e.getAttribute("data-pp-default-value");if(n){if(e.removeAttribute("data-pp-default-value"),e.__ppDefaultValueCaptureId=n,t.has(n))return t.get(n)}else if(e.__ppDefaultValueCaptureId){if(t.has(e.__ppDefaultValueCaptureId))return t.get(e.__ppDefaultValueCaptureId);delete e.__ppDefaultValueCaptureId}return"__ppResolvedDefaultValue"in e?e.__ppResolvedDefaultValue:e.hasAttribute("defaultvalue")?e.getAttribute("defaultvalue"):void 0}resolveDefaultCheckedBinding(e,t){const n=e.getAttribute("data-pp-default-checked");if(n){if(e.removeAttribute("data-pp-default-checked"),e.__ppDefaultCheckedCaptureId=n,t.has(n))return t.get(n)}else if(e.__ppDefaultCheckedCaptureId){if(t.has(e.__ppDefaultCheckedCaptureId))return t.get(e.__ppDefaultCheckedCaptureId);delete e.__ppDefaultCheckedCaptureId}return"__ppResolvedDefaultChecked"in e?e.__ppResolvedDefaultChecked:e.hasAttribute("defaultchecked")?e.getAttribute("defaultchecked"):void 0}materializeNestedBoundaryFormDefaults(e,t){const n=e.getAttribute("data-pp-input-value");n&&t.inputValueStore.has(n)&&(e.removeAttribute("data-pp-input-value"),e.__ppResolvedInputValue=t.inputValueStore.get(n));const s=e.getAttribute("data-pp-default-value");if(s&&t.defaultValueStore.has(s)&&(e.removeAttribute("data-pp-default-value"),e.__ppResolvedDefaultValue=t.defaultValueStore.get(s)),!(e instanceof HTMLInputElement))return;const i=e.getAttribute("data-pp-default-checked");i&&t.defaultCheckedStore.has(i)&&(e.removeAttribute("data-pp-default-checked"),e.__ppResolvedDefaultChecked=t.defaultCheckedStore.get(i))}normalizeControlledSelectValues(e){return null==e?[]:Array.isArray(e)?e.filter(e=>null!=e).map(e=>String(e)):[String(e)]}applyUncontrolledDefaultSelectValue(e,t){this.trackValueControlMode(e,"uncontrolled");const n=this.normalizeControlledSelectValues(t),s=e.multiple?new Set(n):new Set(n.length>0?[n[0]]:[]);for(let t=0;t<e.options.length;t++){const n=e.options[t],i=n,r=s.has(n.value);n.defaultSelected!==r&&(n.defaultSelected=r),n.selected!==r&&(n.selected=r),r?i.__ppHasUncontrolledDefaultSelected=!0:delete i.__ppHasUncontrolledDefaultSelected}if(!e.multiple){const t=n.length>0?n[0]:"";e.value!==t&&(e.value=t)}}resolveControlledSelectCaptureId(e,t){const n=e.getAttribute("data-pp-select-value");let s=null;return n?(e.removeAttribute("data-pp-select-value"),e.__ppSelectValueCaptureId=n,s=n):e.__ppSelectValueCaptureId&&t.has(e.__ppSelectValueCaptureId)?s=e.__ppSelectValueCaptureId:e.__ppSelectValueCaptureId&&delete e.__ppSelectValueCaptureId,s}resolveControlledInputValue(e,t){const n=e.getAttribute("data-pp-input-value");let s,i=!1;return n?(e.removeAttribute("data-pp-input-value"),e.__ppInputValueCaptureId=n,t.has(n)&&(s=t.get(n),i=!0)):e.__ppInputValueCaptureId&&t.has(e.__ppInputValueCaptureId)?(s=t.get(e.__ppInputValueCaptureId),i=!0):"__ppResolvedInputValue"in e?(s=e.__ppResolvedInputValue,i=!0):e.__ppInputValueCaptureId&&delete e.__ppInputValueCaptureId,{hasValue:i,value:s}}resolveControlledCheckedValue(e,t){const n=e.getAttribute("data-pp-checked-value");let s,i=!1;if(n)e.removeAttribute("data-pp-checked-value"),e.__ppCheckedValueCaptureId=n,t.has(n)&&(s=t.get(n),i=null!=s);else{const n=e.__ppCheckedValueCaptureId;n&&t.has(n)?(s=t.get(n),i=null!=s):n&&delete e.__ppCheckedValueCaptureId}return{hasValue:i,value:s}}trackValueControlMode(e,t){const n=e,s=n.__ppValueControlMode;s?s!==t&&(n.__ppWarnedValueControlModeSwitch||(n.__ppWarnedValueControlModeSwitch=!0,console.warn(`[PP-WARN] ${this.describeControl(e)} changed from ${s} to ${t}. Choose either a controlled value binding or an uncontrolled defaultValue for the lifetime of the element.`)),n.__ppValueControlMode=t):n.__ppValueControlMode=t}describeControl(e){const t=e.tagName.toLowerCase(),n=e.id?`#${e.id}`:"",s=e.getAttribute("name");return`${t}${n}${!n&&s?`[name="${s}"]`:""}`}trackCheckedControlMode(e,t){const n=e,s=n.__ppCheckedControlMode;s?s!==t&&(n.__ppWarnedCheckedControlModeSwitch||(n.__ppWarnedCheckedControlModeSwitch=!0,console.warn(`[PP-WARN] ${this.describeControl(e)} changed from ${s} to ${t}. Choose either a controlled checked binding or an uncontrolled defaultChecked for the lifetime of the element.`)),n.__ppCheckedControlMode=t):n.__ppCheckedControlMode=t}registerResetHandler(e,t,n){const s=e;s.__ppResetCallbacks||(s.__ppResetCallbacks=new Map),s.__ppResetCallbacks.set(t,n),!s.__ppOriginalReset&&(s.__ppOriginalReset=e.reset,e.reset=function(){var e,n;null==(e=s.__ppOriginalReset)||e.call(this),null==(n=s.__ppResetCallbacks)||n.forEach((e,n)=>{var i;C.getInstance(n)||n===t?e():null==(i=s.__ppResetCallbacks)||i.delete(n)})})}unregisterResetHandler(e,t){var n;const s=e;null==(n=s.__ppResetCallbacks)||n.delete(t),!(s.__ppResetCallbacks&&s.__ppResetCallbacks.size>0)&&(s.__ppOriginalReset&&(e.reset=s.__ppOriginalReset,delete s.__ppOriginalReset),delete s.__ppResetCallbacks)}normalizeDefaultCheckedValue(e){if("string"==typeof e){const t=e.trim().toLowerCase();if(""===t||"true"===t)return!0;if("false"===t||"0"===t||"off"===t||"no"===t)return!1}return!!e}isDateLikeInput(e){return new Set(["date","datetime-local","month","time","week"]).has(e.type)}shouldDeferFocusedDateLikeInputValue(e,t){return!(typeof document>"u"||document.activeElement!==e||!this.isDateLikeInput(e))&&e.value!==t}shouldDeferActiveNativeTextInputValue(e,t){return!(typeof document>"u"||document.activeElement!==e||!e.__ppPreserveNativeSelectionOnNextRender)&&(this.isTextSelectionControl(e)&&e.value!==t)}isTextSelectionControl(e){return["text","search","url","tel","password"].includes(e.type)}deferFocusedControlledInputValue(e,t){if(e.__ppDeferredControlledValue=t,e.__ppDeferredControlledBlurHandler)return;const n=()=>{const t=e.__ppDeferredControlledValue;if(delete e.__ppDeferredControlledValue,delete e.__ppDeferredControlledBlurHandler,!e.isConnected)return;const n=null==t?"":String(t);e.value!==n&&(e.value=n)};e.__ppDeferredControlledBlurHandler=n,e.addEventListener("blur",n,{once:!0})}}class Sr{constructor(e,t,n,s,i){d(this,"pendingProvidedContexts",new Map),d(this,"pendingContextTokens",new Set),d(this,"activeProviderBoundaryIds",new Set),d(this,"refreshPending",!1),d(this,"warnedContextOutsideRender",!1),this.componentId=e,this.getParentId=t,this.isCurrentInstance=n,this.isRendering=s,this.forceUpdate=i}prepareRender(){this.pendingProvidedContexts=new Map,this.pendingContextTokens=new Set}consume(e){return!this.isRendering()&&!this.warnedContextOutsideRender&&(this.warnedContextOutsideRender=!0,console.warn(`[PP-WARN] pp.context(...) should be called while component "${this.componentId}" is rendering. Move context reads to the component script body and pass values to event handlers through closure state.`)),this.pendingContextTokens.add(e),C.resolveContext(this.getParentId(),e).value}provide(e,t){this.pendingProvidedContexts.set(e,t)}commitRenderContexts(){const e=C.saveContextValues(this.componentId,this.pendingProvidedContexts);return C.updateContextDependencies(this.componentId,this.pendingContextTokens),e.length>0?C.getConsumersForContextsInSubtree(this.componentId,e):null}syncProviderBoundary(e,t,n,s){C.saveParent(e,t);const i=C.saveContextValues(e,new Map([[n,s]]));return i.length>0?C.getConsumersForContextsInSubtree(e,i):new Set}replaceActiveProviderBoundaries(e){const t=new Set;return this.activeProviderBoundaryIds.forEach(n=>{e.has(n)||C.removeContextTracking(n).forEach(e=>t.add(e))}),this.activeProviderBoundaryIds=e,t}requestRefresh(){this.refreshPending||(this.refreshPending=!0,queueMicrotask(()=>{if(this.refreshPending=!1,this.isCurrentInstance()){if(this.isRendering())return void this.requestRefresh();this.forceUpdate()}}))}refreshConsumers(e){var t;for(const n of e){const e=C.getInstance(n);null==(t=null==e?void 0:e.requestContextRefresh)||t.call(e)}}destroy(){return this.activeProviderBoundaryIds.forEach(e=>{C.removeContextTracking(e)}),this.activeProviderBoundaryIds.clear(),C.removeContextTracking(this.componentId)}}class Er{constructor(e,t,n,s){this.getRoot=e,this.containsPortalElement=t,this.collectManagedInputs=n,this.isDateLikeInput=s}save(){const e=document.activeElement;if(!e)return null;const t=this.getRoot().contains(e),n=!t&&this.containsPortalElement(e);if(!t&&!n)return null;const s=this.collectManagedInputs().indexOf(e);if(-1===s)return null;const i=this.getTextSelectionState(e);return{element:e,index:s,selectionStart:i.selectionStart,selectionEnd:i.selectionEnd}}restore(e){if(!e)return;const t=e.element,n=this.getRoot(),s=t&&t.isConnected&&(n.contains(t)||this.containsPortalElement(t))?t:this.collectManagedInputs()[e.index];if(!s)return;const i=s===document.activeElement,r=s;if(!(i&&s instanceof HTMLInputElement&&this.isDateLikeInput(s))&&(i||s.focus(),null!==e.selectionStart&&null!==e.selectionEnd&&this.isTextSelectionControl(s))){if(i&&r.__ppPreserveNativeSelectionOnNextRender)return void delete r.__ppPreserveNativeSelectionOnNextRender;if(i&&s.selectionStart===e.selectionStart&&s.selectionEnd===e.selectionEnd)return;try{s.setSelectionRange(e.selectionStart,e.selectionEnd)}catch(e){console.warn("Could not restore cursor position",e)}}}isTextSelectionControl(e){return e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&["text","search","url","tel","password"].includes(e.type)}getTextSelectionState(e){if(!this.isTextSelectionControl(e))return{selectionStart:null,selectionEnd:null};try{return{selectionStart:e.selectionStart,selectionEnd:e.selectionEnd}}catch{return{selectionStart:null,selectionEnd:null}}}}class wr{constructor(e){this.options=e}morphChildren(e,t){if(this.hasKeyedDirectChildren(e)||this.hasKeyedDirectChildren(t))return void this.morphKeyedChildren(e,t);let n=e.firstChild,s=t.firstChild;for(;n||s;){const t=(null==n?void 0:n.nextSibling)??null,i=(null==s?void 0:s.nextSibling)??null;if(s){if(!n){const t=s.cloneNode(!0);e.appendChild(t),t.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(t),s=i;continue}if(n.nodeType!==s.nodeType){const r=s.cloneNode(!0);e.replaceChild(r,n),r.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(r),n=t,s=i;continue}n.nodeType!==Node.TEXT_NODE?(n.nodeType===Node.ELEMENT_NODE&&this.morphCompatibleElement(e,n,s),n=t,s=i):(n.textContent!==s.textContent&&(n.textContent=s.textContent),n=t,s=i)}else n&&e.removeChild(n),n=t}}morphCompatibleElement(e,t,n){if(t.tagName!==n.tagName){const s=n.cloneNode(!0);return e.replaceChild(s,t),void(s.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(s))}if(t.hasAttribute("pp-component")&&t!==this.options.root){if(!this.options.syncNestedBoundaryAttributes(t,n)){const s=n.cloneNode(!0);return e.replaceChild(s,t),void(s.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(s))}this.options.hasEventAttributes(t)&&this.options.collectEventElements(t)}else this.options.syncAttributes(t,n),this.options.hasEventAttributes(t)&&this.options.collectEventElements(t),!(t instanceof HTMLTextAreaElement)&&this.morphChildren(t,n)}hasKeyedDirectChildren(e){const t=e.childNodes;for(let e=0;e<t.length;e++){const n=t[e];if(null!==this.getNodeKey(n))return!0}return!1}getNodeKey(e){if(e.nodeType!==Node.ELEMENT_NODE)return null;const t=e.getAttribute("key");return t&&t.length>0?t:null}areNodesCompatible(e,t){if(e.nodeType!==t.nodeType)return!1;if(e.nodeType!==Node.ELEMENT_NODE)return!0;const n=t;if(e.tagName!==n.tagName)return!1;const s=this.getNodeKey(e),i=this.getNodeKey(t);return null===s&&null===i||null!==s&&s===i}morphKeyedChildren(e,t){const n=Array.from(e.childNodes),s=Array.from(t.childNodes),i=this.collectDuplicateKeys(s),r=new Map,a=[];i.length>0&&console.warn(`[PP-WARN] Duplicate key values detected: ${i.join(", ")}`),n.forEach(e=>{const t=this.getNodeKey(e);if(null===t)return void a.push(e);const n=r.get(t);n?n.push(e):r.set(t,[e])});let o=e.firstChild;s.forEach(t=>{const n=this.getNodeKey(t);let s;if(null!==n){const e=r.get(n);for(;e&&e.length>0;){const n=e.shift();if(this.areNodesCompatible(n,t)){s=n;break}a.push(n)}}else{const e=a.findIndex(e=>this.areNodesCompatible(e,t));-1!==e&&(s=a.splice(e,1)[0])}if(s)s!==o&&e.insertBefore(s,o);else{const n=t.cloneNode(!0);e.insertBefore(n,o),n.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(n),s=n}this.morphNode(s,t),o=s.nextSibling}),a.forEach(t=>{t.parentNode===e&&e.removeChild(t)}),r.forEach(t=>{t.forEach(t=>{t.parentNode===e&&e.removeChild(t)})})}collectDuplicateKeys(e){const t=new Set,n=new Set;return e.forEach(e=>{const s=this.getNodeKey(e);if(null!==s){if(t.has(s))return void n.add(s);t.add(s)}}),Array.from(n.values())}morphNode(e,t){if(e.nodeType!==t.nodeType){const n=e.parentNode;if(!n)return;const s=t.cloneNode(!0);return n.replaceChild(s,e),void(s.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(s))}if(e.nodeType===Node.TEXT_NODE)return void(e.textContent!==t.textContent&&(e.textContent=t.textContent));if(e.nodeType!==Node.ELEMENT_NODE)return;const n=e,s=t,i=n.parentNode;i&&this.morphCompatibleElement(i,n,s)}}class kr{constructor(e){this.componentId=e}extractOwnedTemplates(e){const t=new Map,n=e.querySelectorAll("template[pp-owner]");let s=0;return n.forEach(n=>{var i,r;if((null==(i=n.parentElement)?void 0:i.closest("[pp-component]"))!==e)return;const a=n.getAttribute("pp-owner");if(!a)return;const o=`__PP_OWNED_${this.componentId}_${s++}__`;t.set(o,{ownerId:a,content:n.innerHTML,contextTag:(null==(r=n.parentElement)?void 0:r.tagName.toLowerCase())??null}),n.replaceWith(document.createComment(o))}),t}resolveOwnedChildren(e,t){if(!e.includes("__PP_OWNED_"))return e;t.forEach((t,n)=>{const s=this.resolveOwnedTemplateOwner(t.ownerId);if(s){const i=this.renderOwnedContent(t,s.ownerId,s.scope);e=this.replaceOwnedPlaceholder(e,n,i)}else e=this.replaceOwnedPlaceholder(e,n,t.content)});const n=/__PP_OWNED_([^_]+(?:_[^_]+)*)_(\d+)__/g;let s;for(;null!==(s=n.exec(e));){const t=s[0],i=s[1],r=C.getOwnedTemplates(i);if(r&&r.has(t)){const s=r.get(t),a=this.resolveOwnedTemplateOwner(s.ownerId,i);if(a){const n=this.renderOwnedContent(s,a.ownerId,a.scope);e=this.replaceOwnedPlaceholder(e,t,n)}else e=this.replaceOwnedPlaceholder(e,t,s.content);n.lastIndex=0}}return e}maskNestedOwnedTemplates(e,t=null){const n=new Map,s=Be(e,t);let i=0;const r=s.root.querySelectorAll("[pp-component] > template[pp-owner]");for(const e of Array.from(r)){const t=`__PP_NESTED_TPL_${i++}__`;n.set(t,e.outerHTML),e.replaceWith(document.createComment(t))}return{content:s.toHtml(),placeholders:n}}restoreMaskedOwnedTemplates(e,t){if(0===t.size)return;const n=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),s=[];let i=n.nextNode();for(;i;){const e=i,r=t.get(e.data||"");if(r){const t=document.createElement("template");t.innerHTML=r;const n=t.content.firstChild;n&&s.push({node:e,replacement:n})}i=n.nextNode()}s.forEach(({node:e,replacement:t})=>{e.replaceWith(t)})}materializeTemplateComponentBoundaries(e){const t=[];e instanceof HTMLTemplateElement&&e.hasAttribute("pp-component")&&t.push(e),e.querySelectorAll("template[pp-component]").forEach(e=>t.push(e)),t.forEach(e=>{const t=e.content.cloneNode(!0),n=t.firstElementChild;n?(Array.from(e.attributes).forEach(e=>{"pp-owner"!==e.name&&n.setAttribute(e.name,e.value)}),e.replaceWith(t)):e.replaceWith(document.createComment("pp-empty-template-component"))})}replaceOwnedPlaceholder(e,t,n){const s=`\x3c!--${t}--\x3e`;return e.includes(s)?e.replace(s,n):e.replace(t,n)}renderOwnedContent(e,t,n){const{content:s,placeholders:i}=this.maskNestedOwnedTemplates(e.content,e.contextTag),r=ye(n).keys,a=be(n,r),o=Ni(e.contextTag),c=_e.compile(o.wrap(s),r);let l=o.unwrap(c(...a));for(const[e,t]of i)l=this.replaceOwnedPlaceholder(l,e,t);return this.markOwnedBindings(l,t,e.contextTag)}resolveOwnedTemplateOwner(e,t=this.componentId){const n=C.resolveComponentId(e,t);if(!n)return null;const s=C.getResolvedScopeWithAncestors(e,t);return s?{ownerId:n,scope:s}:null}markOwnedBindings(e,t,n=null){const s=Be(e,n),i=[...s.root instanceof DocumentFragment?Array.from(s.root.children):[s.root]].reverse();for(;i.length>0;){const e=i.pop();if(Array.from(e.attributes).some(e=>e.name.startsWith("on"))&&e.setAttribute("pp-event-owner",t),e.hasAttribute("data-pp-ref")&&e.setAttribute("pp-ref-owner",t),e.hasAttribute("pp-component"))continue;const n=Array.from(e.children);for(let e=n.length-1;e>=0;e-=1)i.push(n[e])}return s.toHtml()}}class Ar{constructor(e,t,n,s,i){this.componentId=e,this.interpolationCache=t,this.scopeEvalCache=n,this.propEvalCache=s,this.getCachedFunction=i}interpolateAttrString(e,t){const n=ye(t),s=n.keys,i=be(t,s),r=n.keySig;return Ri(e,e=>{const t=B(e);try{const e=this.getCachedFunction(this.interpolationCache,t,s,r,300)(...i);return"boolean"==typeof e||null==e?"":Array.isArray(e)?e.join(""):String(e)}catch(e){return console.warn(`[PP-WARN] Failed attribute interpolation for {${t}}`,e),""}})}applyAttributeInterpolations(e,t){const n=ye(t),s=n.keys,i=be(t,s),r=n.keySig;for(const n of Array.from(e.attributes)){const a=n.name;if("pp-component"===a||a.startsWith("on"))continue;const o=n.value;if(!o.includes("{"))continue;const c=K(o);if(!c){const n=this.interpolateAttrString(o,t);n!==o&&e.setAttribute(a,n);continue}const l=B(c.expression);if(!Q.isValidExpression(l))continue;let h;try{h=this.getCachedFunction(this.scopeEvalCache,l,s,r,300)(...i)}catch(e){console.error(`[PP-ERROR] Failed to eval "${l}"`,e);continue}if(Rt.has(a.toLowerCase())&&"boolean"==typeof h){h?e.setAttribute(a,""):e.removeAttribute(a);continue}const p=typeof h;null==h?e.removeAttribute(a):("string"===p||"number"===p||"boolean"===p||"bigint"===p)&&e.setAttribute(a,String(h))}}computePropsFromAttributes(e,t){const n=t?C.getResolvedScopeWithAncestors(t,this.componentId):void 0,s=n?ye(n):null,i=(null==s?void 0:s.keys)??[],r=n?be(n,i):[],a=e.__ppRawBindings,o=new Set([...Array.from(e.attributes).map(e=>e.name),...a?Object.keys(a):[]]),c=(null==s?void 0:s.keySig)??"",l=e=>{if(n)try{return this.getCachedFunction(this.propEvalCache,e,i,c,200)(...r)}catch(t){return void console.warn(`[PP-WARN] Failed to evaluate prop expression "{${e}}" for component "${this.componentId}"`,t)}};return Array.from(o).reduce((t,s)=>{if(s.startsWith("on")&&!s.includes("-")||"pp-component"===s)return t;const i=Nt(s);if(lt.has(i))return t;const r=e.attributes.getNamedItem(s),o=(null==a?void 0:a[s])??(null==r?void 0:r.value);if(void 0===o)return t;if(""===o)return t[i]=!0,t;if(n){const e=K(o);if(e){const n=B(e.expression);if(Q.isValidExpression(n))return t[i]=l(n),t}if(o.includes("{"))return t[i]=this.interpolateAttrString(o,n),t}return t[i]=o,t},{})}}class Pr{constructor(e,t,n,s){d(this,"cache",null),this.getRoot=e,this.getPortalElements=t,this.refCaptureIdsByElement=n,this.refExprsByElement=s}invalidate(){this.cache=null}getCache(){if(this.cache)return this.cache;const e=this.getRoot(),t=[],n=[],s=[],i=[],r=new Set,a=[],o=(e,t)=>{a.push(e)};o(e);for(const e of this.getPortalElements())o(e);for(;a.length>0;){const o=a.pop();if(r.has(o))continue;r.add(o);const c=o,l=o!==e&&o.hasAttribute("pp-component");if(t.push(c),(o.hasAttribute("data-pp-ref")||o.hasAttribute("pp-ref")||this.refCaptureIdsByElement.has(c)||this.refExprsByElement.has(c))&&i.push(c),!l&&(o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement||o instanceof HTMLSelectElement)&&s.push(c),l)n.push(c);else for(let e=o.children.length-1;e>=0;e--)a.push(o.children[e])}return this.cache={ownedElements:t,childBoundaries:n,managedInputs:s,refElements:i},this.cache}collectManagedInputs(){return this.getCache().managedInputs}collectEventElements(e,t){if(e!==this.getRoot()&&e.hasAttribute("pp-component"))this.hasEventAttributes(e)&&t.add(e);else{this.hasEventAttributes(e)&&t.add(e);for(let n=0;n<e.children.length;n++)this.collectEventElements(e.children[n],t)}}hasEventAttributes(e){const t=e.attributes;for(let e=0;e<t.length;e++)if(t[e].name.startsWith("on")&&!t[e].name.includes("-"))return!0;return!1}isManagedEventElement(e){if(this.isElementOwnedByTree(e,this.getRoot()))return!0;for(const t of this.getPortalElements())if(this.isElementOwnedByTree(e,t))return!0;return!1}isElementOwnedByTree(e,t){if(e===t)return!0;if(!t.contains(e))return!1;let n=e,s=!0;for(;n&&n!==t;){if(!s&&n.hasAttribute("pp-component"))return!1;n=n.parentElement,s=!1}return n===t}}class Tr{constructor(e){d(this,"boundaryOccurrencesByBaseId",new Map),this.options=e}bootstrap(){this.boundaryOccurrencesByBaseId.clear();const e=new Set,t=new Set,n=(s,i)=>{const r=s.children;for(let s=0;s<r.length;s++){const a=r[s];if(a.hasAttribute("pp-component")){this.bootstrapComponentBoundary(a,i);continue}const o=this.syncContextProviderBoundary(a,i,e,t);n(a,o??i)}};n(this.options.getRoot(),this.options.componentId);for(const e of this.options.getPortalElements())n(e,this.options.componentId);this.options.contextManager.replaceActiveProviderBoundaries(e).forEach(e=>t.add(e)),t.size>0&&this.options.refreshContextConsumers(t)}syncNestedBoundaryAttributes(e,t){const n=t.getAttribute("pp-component"),s=this.getBoundaryBaseId(e);if(!n||s&&n!==s)return!1;this.options.syncAttributes(e,t,!1,!0);const i=e;return i.__ppRuntimeComponentId&&e.getAttribute("pp-component")!==i.__ppRuntimeComponentId&&e.setAttribute("pp-component",i.__ppRuntimeComponentId),!0}createBoundaryId(e,t,n){const s=(this.boundaryOccurrencesByBaseId.get(e)??0)+1;if(this.boundaryOccurrencesByBaseId.set(e,s),1===s)return{id:e,occurrence:s};return{id:`${e}__pp${this.hashScope(this.getBoundaryScopeSignature(t,n))}`,occurrence:s}}getBoundaryScopeSignature(e,t){const n=[];let s=e;for(;s;){const e=s.getAttribute("key");e&&e.length>0?n.unshift(`k:${e}`):n.unshift(`i:${this.getElementIndexWithinParent(s)}`);const t=s.parentElement;if(!t||t.hasAttribute("pp-component"))break;s=t}return`${t}|${n.join("/")}`}getElementIndexWithinParent(e){const t=e.parentElement;if(!t)return 0;const n=t.children;for(let t=0;t<n.length;t++)if(n[t]===e)return t;return 0}hashScope(e){let t=5381;for(let n=0;n<e.length;n++)t=33*t^e.charCodeAt(n);return(t>>>0).toString(36)}getBoundaryBaseId(e){const t=e,n=e.getAttribute("pp-component");return!t.__ppBaseComponentId&&n&&(t.__ppBaseComponentId=n),t.__ppBaseComponentId??n}ensureBoundaryIdentity(e,t){var n;const s=e,i=e.getAttribute("pp-component")||"",r=i?this.createBoundaryId(i,e,t):null,a=(null==r?void 0:r.id)??"";if(s.__ppRuntimeComponentId)return i!==s.__ppRuntimeComponentId&&e.setAttribute("pp-component",s.__ppRuntimeComponentId),s.__ppBaseComponentId||(s.__ppBaseComponentId=i||s.__ppRuntimeComponentId),s.__ppRuntimeComponentId;if(!i)return"";i.includes("{")&&!s.__ppWarnedDynamicComponentId&&(s.__ppWarnedDynamicComponentId=!0,console.warn(`[PP-WARN] Dynamic pp-component values are not supported. Component boundary ids are static; received "${i}". Use a stable pp-component id and pass dynamic values through props instead.`)),s.__ppBaseComponentId=i;const o=C.getInstance(a);if(o&&o.el&&o.el!==e){if(o.el.isConnected){const t=r?`${a}_${r.occurrence.toString(36)}`:`${i}__ppcollision`;return s.__ppRuntimeComponentId=t,e.setAttribute("pp-component",t),t}null==(n=o.destroy)||n.call(o)}return s.__ppRuntimeComponentId=a,i!==a&&e.setAttribute("pp-component",a),a}bootstrapComponentBoundary(e,t){const n=e,s=this.ensureBoundaryIdentity(e,t);if(!s)return;if(n.__ppRawBindings){const t=this.options.isEffectManagedSurfaceElement(e),s=n.__ppRawBindings;for(const[n,i]of Object.entries(s))t&&this.options.shouldSkipEffectManagedAttr(n)||e.setAttribute(n,i)}else{const t={};for(const n of Array.from(e.attributes))n.value.includes("{")&&"pp-component"!==n.name&&!n.name.startsWith("on")&&(t[n.name]=n.value);n.__ppRawBindings=t}const i=C.getResolvedScopeWithAncestors(t,this.options.componentId)??this.options.getLatestScope();this.options.applyAttributeInterpolations(e,i),this.options.materializeFormDefaults(e);const r=C.getInstance(s);if(null!=r&&r.refreshPropsFromParent){const i=r.parentId!==t;if(r.parentId=t,C.saveParent(s,t),r.el!==e){const t=r.el;!n.__ppRawBindings&&t.__ppRawBindings&&(n.__ppRawBindings=t.__ppRawBindings),r.el=e}return void r.refreshPropsFromParent(i)}if(!C.getState(s)){n.__ppRuntimeParentId=t;try{this.options.createComponent(e)}finally{delete n.__ppRuntimeParentId}}}syncContextProviderBoundary(e,t,n,s){if("pp-context-provider"!==e.tagName.toLowerCase())return null;const i=this.resolveContextProviderBoundary(e);return i?(n.add(i.boundaryId),this.options.contextManager.syncProviderBoundary(i.boundaryId,t,i.context,i.value).forEach(e=>s.add(e)),i.boundaryId):null}resolveContextProviderBoundary(e){const t=e,n=e.getAttribute("data-pp-context-token")??t.__ppContextTokenCaptureId??null,s=e.getAttribute("data-pp-context-value")??t.__ppContextValueCaptureId??null;if(!n||!s)return null;t.__ppContextTokenCaptureId=n,t.__ppContextValueCaptureId=s,e.removeAttribute("data-pp-context-token"),e.removeAttribute("data-pp-context-value");const i=this.options.getContextTokenStore().get(n);return i?{boundaryId:this.ensureContextProviderBoundaryId(t),context:i,value:this.options.getContextValueStore().get(s)}:null}ensureContextProviderBoundaryId(e){return e.__ppContextBoundaryId||(e.__ppContextBoundaryId=`ppctx_${this.options.componentId}_${Math.random().toString(36).slice(2,10)}`),e.__ppContextBoundaryId}}const rt=new Set(["data-state","data-open","style","aria-hidden","aria-checked","hidden","inert"]),kt=new Set(["alert-dialog-content","alert-dialog-overlay","alert-dialog-portal","checkbox","dialog-content","dialog-overlay","dialog-portal","popover-content","sheet-content","sheet-overlay","sheet-portal","tooltip-content"]);class Ir{constructor(e,t){this.refCaptureIdsByElement=e,this.refExprsByElement=t}isEffectManagedAttr(e){return rt.has(e)}isEffectManagedSurfaceElement(e,t){const n=e.getAttribute("data-slot");if(n&&kt.has(n))return!0;const s=null==t?void 0:t.getAttribute("data-slot");return!!s&&kt.has(s)}syncAttributes(e,t,n=!1,s=!1){const i=n||this.isEffectManagedSurfaceElement(e,t),r=e,a=e.attributes;for(let n=a.length-1;n>=0;n--){const o=a[n].name;if(!(s&&"pp-component"===o||t.hasAttribute(o))){if(i&&rt.has(o)||"value"===o&&e instanceof HTMLInputElement&&r.__ppHasUncontrolledDefaultValue||"checked"===o&&e instanceof HTMLInputElement&&r.__ppHasUncontrolledDefaultChecked||"selected"===o&&e instanceof HTMLOptionElement&&r.__ppHasUncontrolledDefaultSelected)continue;e.removeAttribute(o),"data-pp-ref"===o&&this.refCaptureIdsByElement.delete(e),"pp-ref"===o&&this.refExprsByElement.delete(e)}}const o=t.attributes;for(let t=0;t<o.length;t++){const n=o[t];i&&rt.has(n.name)||s&&"pp-component"===n.name||(e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value),"checked"===n.name&&e instanceof HTMLInputElement&&(this.trackCheckedControlMode(e,"controlled"),e.checked=!0),"value"===n.name&&(e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement)&&e.value!=n.value&&(e.value=n.value))}if(e instanceof HTMLTextAreaElement&&t instanceof HTMLTextAreaElement&&!r.__ppHasUncontrolledDefaultValue){const n=t.getAttribute("value"),s=n??t.value,i=n??t.defaultValue;e.value!==s&&(e.value=s),e.defaultValue!==i&&(e.defaultValue=i)}}trackCheckedControlMode(e,t){const n=e,s=n.__ppCheckedControlMode;if(s){if(s!==t){if(!n.__ppWarnedCheckedControlModeSwitch){n.__ppWarnedCheckedControlModeSwitch=!0;const i=e.id?`#${e.id}`:"",r=e.getAttribute("name"),a=!i&&r?`[name="${r}"]`:"";console.warn(`[PP-WARN] input${i}${a} changed from ${s} to ${t}. Choose either a controlled checked binding or an uncontrolled defaultChecked for the lifetime of the element.`)}n.__ppCheckedControlMode=t}}else n.__ppCheckedControlMode=t}}const Rr=Symbol.for("pp.context");let Oe=null;function Nr(e){if(!e||"object"!=typeof e||!("value"in e))throw new Error("Context.Provider expects an object like { value, children? }.");return e}function Lr(e,t){const n=Oe;Oe=e;try{return t()}finally{Oe=n}}function Vr(e){const t={$$typeof:Rr,defaultValue:e,Provider:e=>{const n=Nr(e),s=Oe;if(!s)throw new Error("Context.Provider() can only be used while a component is rendering.");return s(t,n.value),n.children??null}};return t}const Mr=["script","domDiff","bindEvents","bindRefs","bootstrapNested","portals","restoreFocus","layoutEffects","effects","total"];function At(){return typeof performance<"u"&&"function"==typeof performance.now?performance.now():Date.now()}const D=class e{constructor(t){d(this,"el"),d(this,"id"),d(this,"rawTemplate"),d(this,"renderFunction"),d(this,"templateFn",null),d(this,"hooksSystem"),d(this,"eventManager"),d(this,"latestScope",{}),d(this,"__ppRefStore",new Map),d(this,"__ppRefSeq",0),d(this,"__ppRefCaptureIdsByElement",new WeakMap),d(this,"__ppRefExprsByElement",new WeakMap),d(this,"refBindingManager"),d(this,"__ppInputValueStore",new Map),d(this,"__ppInputValueSeq",0),d(this,"__ppSelectValueStore",new Map),d(this,"__ppSelectValueSeq",0),d(this,"__ppCheckedValueStore",new Map),d(this,"__ppCheckedValueSeq",0),d(this,"__ppContextTokenStore",new Map),d(this,"__ppContextTokenSeq",0),d(this,"__ppContextValueStore",new Map),d(this,"__ppContextValueSeq",0),d(this,"__ppDefaultValueStore",new Map),d(this,"__ppDefaultValueSeq",0),d(this,"__ppDefaultCheckedStore",new Map),d(this,"__ppDefaultCheckedSeq",0),d(this,"formControlManager",new Cr),d(this,"passiveEffectsVersion",0),d(this,"isRendering",!1),d(this,"props",{}),d(this,"ownedChildren",new Map),d(this,"lastRenderedHtml",""),d(this,"renderCount",0),d(this,"portalManager"),d(this,"parentId",null),d(this,"initialChildrenHtml",""),d(this,"pendingEventElements",new Set),d(this,"traversalManager"),d(this,"contextManager"),d(this,"focusManager"),d(this,"domMorpher"),d(this,"ownedTemplateManager"),d(this,"propBindingManager"),d(this,"nestedBoundaryManager"),d(this,"attributeSyncManager"),d(this,"_lastRawScopeKeySig",""),d(this,"_lastSortedKeys",[]),d(this,"_lastSortedScopeKeySig",""),d(this,"_cachedHooksAPI",null),d(this,"_propFnCache",new Map),d(this,"_interpolationFnCache",new Map),d(this,"_scopeEvalFnCache",new Map),d(this,"_refEvalFnCache",new Map),this.el=t,this.id=this.el.getAttribute("pp-component")||"",this.id||(this.id="anon_"+Math.random().toString(36).substring(2,9),this.el.setAttribute("pp-component",this.id)),this.props=Array.from(this.el.attributes).reduce((e,t)=>{const n=t.name;if(n.startsWith("on")||"pp-component"===n)return e;const s=Nt(n);return lt.has(s)||(e[s]=t.value),e},{}),C.registerInstance(this.id,this),this.ownedTemplateManager=new kr(this.id),this.propBindingManager=new Ar(this.id,this._interpolationFnCache,this._scopeEvalFnCache,this._propFnCache,(e,t,n,s,i)=>this.getCachedFunction(e,t,n,s,i)),this.refBindingManager=new br(this.id),this.portalManager=new _r(this.id),this.attributeSyncManager=new Ir(this.__ppRefCaptureIdsByElement,this.__ppRefExprsByElement),this.traversalManager=new Pr(()=>this.el,()=>this.portalManager.elements(),this.__ppRefCaptureIdsByElement,this.__ppRefExprsByElement),this.contextManager=new Sr(this.id,()=>this.parentId,()=>C.getInstance(this.id)===this,()=>this.isRendering,()=>this.forceUpdate()),this.nestedBoundaryManager=new Tr({componentId:this.id,getRoot:()=>this.el,getPortalElements:()=>this.portalManager.elements(),getLatestScope:()=>this.latestScope,getContextTokenStore:()=>this.__ppContextTokenStore,getContextValueStore:()=>this.__ppContextValueStore,contextManager:this.contextManager,isEffectManagedSurfaceElement:e=>this.isEffectManagedSurfaceElement(e),shouldSkipEffectManagedAttr:e=>this.attributeSyncManager.isEffectManagedAttr(e),syncAttributes:(e,t,n,s)=>this.syncAttributes(e,t,n,s),applyAttributeInterpolations:(e,t)=>this.applyAttributeInterpolations(e,t),materializeFormDefaults:e=>this.materializeNestedBoundaryFormDefaults(e),createComponent:t=>{new e(t)},refreshContextConsumers:e=>this.refreshContextConsumers(e)}),this.focusManager=new Er(()=>this.el,e=>this.portalManager.contains(e),()=>this.collectManagedInputs(),e=>this.formControlManager.isDateLikeInput(e)),this.domMorpher=new wr({root:this.el,collectEventElements:e=>this.collectEventElements(e),hasEventAttributes:e=>this.hasEventAttributes(e),isInsideTrackedPortal:e=>this.isInsideTrackedPortal(e),syncAttributes:(e,t,n,s)=>this.syncAttributes(e,t,n,s),syncNestedBoundaryAttributes:(e,t)=>this.nestedBoundaryManager.syncNestedBoundaryAttributes(e,t)}),this.syncParentId(),this.props=this.computePropsFromAttributes();let n=C.getTemplate(this.id);const s=C.getOwnedTemplates(this.id);n?s&&(this.ownedChildren=s):(this.ownedChildren=this.ownedTemplateManager.extractOwnedTemplates(this.el),n=this.el.innerHTML,C.saveTemplate(this.id,n),C.saveOwnedTemplates(this.id,this.ownedChildren)),this.initialChildrenHtml=n,this.props.children=this.initialChildrenHtml,this.hooksSystem=new It(()=>{this.isRendering||this.render()},this.id);const i=C.getState(this.id);i&&this.hooksSystem.loadState(i);const r=Be(this.initialChildrenHtml,this.el.tagName.toLowerCase()),a=this.findOwnScript(r.root),o=(null==a?void 0:a.textContent)||"";a&&a.remove(),this.rawTemplate=r.toHtml(),this.renderFunction=this.createRenderFunction(o),this.eventManager=new st(this.el,()=>this.latestScope,e=>this.traversalManager.isManagedEventElement(e)),this.render()}syncParentId(){var e;const t=this.el.__ppRuntimeParentId,n=null==(e=this.el.parentElement)?void 0:e.closest("[pp-component]");this.parentId=void 0!==t?t:n?n.getAttribute("pp-component"):null,C.saveParent(this.id,this.parentId)}static setPerfEnabled(e){this.perfEnabled=e}static getPerfEnabled(){return this.perfEnabled}static resetPerfStats(){this.perfStats.clear()}static getPerfStats(){return Object.fromEntries(this.perfStats.entries())}static createEmptyPerfEntry(){const e={};return Mr.forEach(t=>{e[t]={count:0,totalMs:0,maxMs:0}}),{renderCount:0,phases:e}}recordPerfPhase(t,n){if(!e.perfEnabled)return;let s=e.perfStats.get(this.id);s||(s=e.createEmptyPerfEntry(),e.perfStats.set(this.id,s));const i=s.phases[t];i.count++,i.totalMs+=n,i.maxMs=Math.max(i.maxMs,n)}startPerfTimer(){return e.perfEnabled?At():0}endPerfTimer(t,n){e.perfEnabled&&this.recordPerfPhase(t,At()-n)}findOwnScript(e){const t=Array.from(e.children);for(const e of t){if("script"===e.tagName.toLowerCase()&&(!e.hasAttribute("type")||"text/pp"===e.getAttribute("type")))return e;if(e.hasAttribute("pp-component"))continue;const t=this.findOwnScript(e);if(t)return t}return null}applyAttributeInterpolations(e,t){this.propBindingManager.applyAttributeInterpolations(e,t)}computePropsFromAttributes(){return this.propBindingManager.computePropsFromAttributes(this.el,this.parentId)}refreshPropsFromParent(e=!1){const t=this.computePropsFromAttributes();t.children=this.initialChildrenHtml,e||!Li(this.props,t)||0!==this.ownedChildren.size?(this.props=t,this.isRendering||this.render()):this.bootstrapNestedComponents()}getCachedFunction(e,t,n,s,i){const r=t+"|"+s;let a=e.get(r);if(!a){if(a=new Function(...n,`"use strict"; return (${t});`),e.size>i){const t=e.keys().next().value;void 0!==t&&e.delete(t)}e.set(r,a)}return a}createRenderFunction(e){const t=Q.extractStateBindings(e);return new Function("pp",`\n "use strict";\n ${e}\n return { ${t.join(", ")} };\n `)}resolveCapturedRefValue(e,t){if(this.__ppRefStore.has(e))return this.__ppRefStore.get(e);if(!t||t===this.id)return;const n=C.getInstance(t);return n&&n.__ppRefStore.has(e)?n.__ppRefStore.get(e):void 0}resolvePlainRefValue(e,t,n,s){const i=this.latestScope[e];if("function"==typeof i||i&&"object"==typeof i&&"current"in i)return i;try{return this.getCachedFunction(this._refEvalFnCache,e,t,s,200)(...n)}catch{return}}createRefCaptureFunction(){return this.__ppRefStore=new Map,this.__ppRefSeq=0,e=>{const t=`ppref_${this.id}_${++this.__ppRefSeq}`;return this.__ppRefStore.set(t,e),t}}createSelectValueCaptureFunction(){return this.__ppSelectValueStore=new Map,this.__ppSelectValueSeq=0,e=>{const t=`ppselect_${this.id}_${++this.__ppSelectValueSeq}`;return this.__ppSelectValueStore.set(t,e),t}}createCheckedValueCaptureFunction(){return this.__ppCheckedValueStore=new Map,this.__ppCheckedValueSeq=0,e=>{const t=`ppchecked_${this.id}_${++this.__ppCheckedValueSeq}`;return this.__ppCheckedValueStore.set(t,e),t}}createInputValueCaptureFunction(){return this.__ppInputValueStore=new Map,this.__ppInputValueSeq=0,e=>{const t=`ppinput_${this.id}_${++this.__ppInputValueSeq}`;return this.__ppInputValueStore.set(t,e),t}}createContextTokenCaptureFunction(){return this.__ppContextTokenStore=new Map,this.__ppContextTokenSeq=0,e=>{const t=`ppcontexttoken_${this.id}_${++this.__ppContextTokenSeq}`;return this.__ppContextTokenStore.set(t,e),t}}createContextValueCaptureFunction(){return this.__ppContextValueStore=new Map,this.__ppContextValueSeq=0,e=>{const t=`ppcontextvalue_${this.id}_${++this.__ppContextValueSeq}`;return this.__ppContextValueStore.set(t,e),t}}createContextLookupFunction(){const e=(e,t)=>{if(null==e)return;if(Object.prototype.hasOwnProperty.call(e,t))return e[t];const n=Object.keys(Object(e)).find(e=>e.toLowerCase()===t.toLowerCase());return n?e[n]:void 0};return t=>{const n=String(t).split(".").map(e=>e.trim()).filter(Boolean);if(0===n.length)return;const[s,...i]=n;let r;"globalthis"===s.toLowerCase()?r=globalThis:"window"===s.toLowerCase()?r=typeof window<"u"?window:globalThis:(r=e(this.latestScope,s),void 0===r&&(r=e(globalThis,s)));for(const t of i)r=e(r,t);return r}}createDefaultValueCaptureFunction(){return this.__ppDefaultValueStore=new Map,this.__ppDefaultValueSeq=0,e=>{const t=`ppdefaultvalue_${this.id}_${++this.__ppDefaultValueSeq}`;return this.__ppDefaultValueStore.set(t,e),t}}createDefaultCheckedCaptureFunction(){return this.__ppDefaultCheckedStore=new Map,this.__ppDefaultCheckedSeq=0,e=>{const t=`ppdefaultchecked_${this.id}_${++this.__ppDefaultCheckedSeq}`;return this.__ppDefaultCheckedStore.set(t,e),t}}consumeContext(e){return this.contextManager.consume(e)}registerProvidedContext(e,t){this.contextManager.provide(e,t)}requestContextRefresh(){this.contextManager.requestRefresh()}refreshContextConsumers(e){this.contextManager.refreshConsumers(e)}makeHooksAPI(){return this._cachedHooksAPI?this._cachedHooksAPI.props=this.props:this._cachedHooksAPI={state:e=>this.hooksSystem.useState(e),effect:(e,t)=>this.hooksSystem.useEffect(e,t),layoutEffect:(e,t)=>this.hooksSystem.useLayoutEffect(e,t),ref:(e=null)=>this.hooksSystem.useRef(e),memo:(e,t)=>this.hooksSystem.useMemo(e,t),callback:(e,t)=>this.hooksSystem.useCallback(e,t),reducer:(e,t,n)=>n?this.hooksSystem.useReducer(e,t,n):this.hooksSystem.useReducer(e,t),context:e=>this.consumeContext(e),portal:(e,t)=>this.hooksSystem.usePortal(e,t),props:this.props},this._cachedHooksAPI}syncTrackedPortals(e){if(0===this.portalManager.size)return;const t=this.hooksSystem.getPortalRegistrations();if(0===t.length)return;const n=new Map,s=new Map;e.querySelectorAll("*").forEach(e=>{const t=e,i=t.getAttribute("data-pp-ref");if(i){const e=n.get(i);e?e.push(t):n.set(i,[t])}const r=t.getAttribute("pp-ref");if(r){const e=s.get(r);e?e.push(t):s.set(r,[t])}});const i=new Map;for(const[e,t]of this.__ppRefStore.entries()){if(!t||"object"!=typeof t||!("current"in t))continue;const n=t,s=i.get(n);s?s.push(e):i.set(n,[e])}const r=new Map;for(const[e,t]of Object.entries(this.latestScope)){if(!t||"object"!=typeof t||!("current"in t))continue;const n=t,s=r.get(n);s?s.push(e):r.set(n,[e])}const a=(e,t)=>{for(const n of t){const t=e.get(n);if(!t||0===t.length)continue;const s=t.shift()??null;if(0===t.length&&e.delete(n),s)return s}return null},o=[];for(const e of t){const t=e.ref.current;if(!t||!this.portalManager.has(t))continue;const c=i.get(e.ref)??[];let l=a(n,c);if(!l){const t=r.get(e.ref)??[];l=a(s,t)}l&&o.push({liveElement:t,sourceElement:l,placeholderText:this.portalManager.getPlaceholderText(t)})}0!==o.length&&(o.forEach(({sourceElement:e,placeholderText:t})=>{e.replaceWith(document.createComment(t))}),o.forEach(({liveElement:e,sourceElement:t})=>{this.morphTrackedPortalRoot(e,t)}))}morphTrackedPortalRoot(e,t){if(e.tagName!==t.tagName){const n=e.parentNode;if(!n)return;const s=t.cloneNode(!0);return n.replaceChild(s,e),this.collectEventElements(s),void this.portalManager.replaceElement(e,s)}this.syncAttributes(e,t,!0),this.hasEventAttributes(e)&&this.pendingEventElements.add(e),this.domMorpher.morphChildren(e,t)}applyPortals(){const e=this.hooksSystem.getPortalRegistrations();this.portalManager.apply(e)&&this.invalidateTraversalCache()}render(t=0){var n;if(t>e.MAX_SYNC_RERENDERS)return void console.warn(`[PP-WARN] Synchronous rerender limit exceeded for component "${this.id}". Check for state updates during render or layout effects.`);if(this.isRendering)return;this.isRendering=!0,this.renderCount++;const s=this.startPerfTimer();if(e.perfEnabled){let t=e.perfStats.get(this.id);t||(t=e.createEmptyPerfEntry(),e.perfStats.set(this.id,t)),t.renderCount++}try{this.contextManager.prepareRender();const e=this.focusManager.save();this.hooksSystem.prepareRender();const s=this.makeHooksAPI(),i=globalThis.pp,r=(null==(n=null==i?void 0:i.createComponentRuntime)?void 0:n.call(i,s))??s,a=this.startPerfTimer();this.hooksSystem.startRenderPhase();let o,c=!1;try{o=Lr((e,t)=>this.registerProvidedContext(e,t),()=>this.renderFunction(r))}finally{c=this.hooksSystem.finishRenderPhase()}if(this.endPerfTimer("script",a),c)return this.isRendering=!1,void this.render(t+1);C.saveState(this.id,this.hooksSystem.getHooks()),this.latestScope={...this.props,...o},this.latestScope.__pp_ref=this.createRefCaptureFunction(),this.latestScope.__pp_input_value=this.createInputValueCaptureFunction(),this.latestScope.__pp_select_value=this.createSelectValueCaptureFunction(),this.latestScope.__pp_checked_value=this.createCheckedValueCaptureFunction(),this.latestScope.__pp_context_token=this.createContextTokenCaptureFunction(),this.latestScope.__pp_context_value=this.createContextValueCaptureFunction(),this.latestScope.__pp_context_lookup=this.createContextLookupFunction(),this.latestScope.__pp_default_value=this.createDefaultValueCaptureFunction(),this.latestScope.__pp_default_checked=this.createDefaultCheckedCaptureFunction(),C.saveScope(this.id,this.latestScope);const l=ye(this.latestScope),h=l.keys,p=l.keySig;let u,d;p===this._lastRawScopeKeySig?(u=this._lastSortedKeys,d=this._lastSortedScopeKeySig):(u=h.length>1?[...h].sort():h.slice(),d=u.join("\0"),this._lastRawScopeKeySig=p,this._lastSortedKeys=u,this._lastSortedScopeKeySig=d);const f=be(this.latestScope,u);this.templateFn||(this.templateFn=_e.compile(this.rawTemplate,u));let m=this.templateFn(...f);if(m=this.ownedTemplateManager.resolveOwnedChildren(m,this.ownedChildren),this.lastRenderedHtml!==m){const e=this.startPerfTimer();this.applyDomDiff(m),this.endPerfTimer("domDiff",e),this.lastRenderedHtml=m}if(this.hasEventAttributes(this.el)&&this.pendingEventElements.add(this.el),this.pendingEventElements.size>0){const e=this.pendingEventElements;this.pendingEventElements=new Set;const t=this.startPerfTimer();this.eventManager.bindEvents(e),this.endPerfTimer("bindEvents",t)}const g=this.startPerfTimer();this.bindRefs(u,f,d),this.endPerfTimer("bindRefs",g);const v=this.contextManager.commitRenderContexts(),y=this.startPerfTimer();this.bootstrapNestedComponents(),this.endPerfTimer("bootstrapNested",y);const _=this.startPerfTimer();this.applyPortals(),this.endPerfTimer("portals",_),this.bindControlledInputValues(),this.bindUncontrolledInputDefaults(),this.bindUncontrolledFormResets(),this.bindControlledSelectValues(),this.bindControlledCheckedValues();const x=this.startPerfTimer();this.focusManager.restore(e),this.endPerfTimer("restoreFocus",x);const S=this.startPerfTimer(),b=this.hooksSystem.runLayoutEffects();if(this.endPerfTimer("layoutEffects",S),b)return this.isRendering=!1,void this.render(t+1);this.schedulePassiveEffects(),null!=v&&v.size&&this.refreshContextConsumers(v)}catch(e){console.error("[PP-ERROR] Render Cycle Failed",e)}finally{this.endPerfTimer("total",s),this.isRendering=!1}}schedulePassiveEffects(){const e=++this.passiveEffectsVersion;queueMicrotask(()=>{if(this.passiveEffectsVersion!==e||C.getInstance(this.id)!==this)return;const t=this.startPerfTimer();this.hooksSystem.runEffects(),this.endPerfTimer("effects",t)})}applyDomDiff(e){if(typeof SVGElement<"u"&&this.el instanceof SVGElement){const t=(new DOMParser).parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${e}</svg>`,"image/svg+xml").documentElement,n=document.createDocumentFragment();return Array.from(t.childNodes).forEach(e=>{n.appendChild(document.importNode(e,!0))}),this.domMorpher.morphChildren(this.el,n),void this.invalidateTraversalCache()}const{content:t,placeholders:n}=this.ownedTemplateManager.maskNestedOwnedTemplates(e,this.el.tagName.toLowerCase()),s=Be(t,this.el.tagName.toLowerCase()).root;this.ownedTemplateManager.restoreMaskedOwnedTemplates(s,n),this.ownedTemplateManager.materializeTemplateComponentBoundaries(s),this.syncTrackedPortals(s),this.domMorpher.morphChildren(this.el,s),this.invalidateTraversalCache()}isInsideTrackedPortal(e){return this.portalManager.contains(e)}isEffectManagedSurfaceElement(e,t){return this.attributeSyncManager.isEffectManagedSurfaceElement(e,t)}collectEventElements(e){this.traversalManager.collectEventElements(e,this.pendingEventElements)}hasEventAttributes(e){return this.traversalManager.hasEventAttributes(e)}invalidateTraversalCache(){this.traversalManager.invalidate()}getTraversalCache(){return this.traversalManager.getCache()}collectManagedInputs(){return this.traversalManager.collectManagedInputs()}syncAttributes(e,t,n=!1,s=!1){this.attributeSyncManager.syncAttributes(e,t,n,s)}bindRefs(e,t,n){const s=this.getTraversalCache(),i=new Map;for(let r=0;r<s.refElements.length;r++){const a=s.refElements[r],o=a,c=a!==this.el&&a.hasAttribute("pp-component"),l=a.getAttribute("data-pp-ref"),h=a.getAttribute("pp-ref-owner");let p=null;if(l)this.__ppRefStore.has(l)?(a.removeAttribute("data-pp-ref"),this.__ppRefCaptureIdsByElement.set(a,l),p=l):c||(a.removeAttribute("data-pp-ref"),this.__ppRefCaptureIdsByElement.set(a,l),p=l);else{const e=this.__ppRefCaptureIdsByElement.get(a);e&&this.__ppRefStore.has(e)?p=e:e&&this.__ppRefCaptureIdsByElement.delete(a)}if(p){const e=this.resolveCapturedRefValue(p,h);if("function"==typeof e||e&&"object"==typeof e&&"current"in e){const t=this.refBindingManager.ensureBindingId(o,"captured");i.set(t,{element:a,value:e})}else l&&p.startsWith(`ppref_${this.id}_`)&&console.warn(`[PP-WARN] Missing captured ref for id="${p}"`)}const u=a.getAttribute("pp-ref");let d=u;if(d=u||(this.__ppRefExprsByElement.get(a)||null),!d)continue;const f=this.resolvePlainRefValue(d,e,t,n);if("function"==typeof f||f&&"object"==typeof f&&"current"in f){u&&a.removeAttribute("pp-ref"),this.__ppRefExprsByElement.set(a,d);const e=this.refBindingManager.ensureBindingId(o,"plain");i.set(e,{element:a,value:f});continue}u&&c||(u&&(a.removeAttribute("pp-ref"),this.__ppRefExprsByElement.set(a,d)),Object.prototype.hasOwnProperty.call(this.latestScope,d)||console.warn(`[PP-WARN] Could not resolve pp-ref="${d}"`))}this.refBindingManager.commit(i)}bindControlledSelectValues(){const e=this.collectManagedInputs();this.formControlManager.bindControlledSelectValues(e,this.__ppSelectValueStore)}bindControlledCheckedValues(){const e=this.collectManagedInputs();this.formControlManager.bindControlledCheckedValues(e,this.__ppCheckedValueStore)}bindControlledInputValues(){const e=this.collectManagedInputs();this.formControlManager.bindControlledInputValues(e,this.__ppInputValueStore)}bindUncontrolledInputDefaults(){const e=this.collectManagedInputs();for(let t=0;t<e.length;t++){const n=e[t];if(n.__ppManagedInputMounted)this.formControlManager.resolveDefaultValueBinding(n,this.__ppDefaultValueStore),n instanceof HTMLInputElement&&this.formControlManager.resolveDefaultCheckedBinding(n,this.__ppDefaultCheckedStore);else{const e=this.formControlManager.resolveDefaultValueBinding(n,this.__ppDefaultValueStore);if(void 0!==e&&this.formControlManager.applyUncontrolledDefaultValue(n,e),n instanceof HTMLInputElement){const e=this.formControlManager.resolveDefaultCheckedBinding(n,this.__ppDefaultCheckedStore);void 0!==e&&this.formControlManager.applyUncontrolledDefaultChecked(n,e)}}n.__ppManagedInputMounted=!0}}bindUncontrolledFormResets(){const e=this.collectManagedInputs();this.formControlManager.syncUncontrolledFormResets(this.id,e,()=>this.collectManagedInputs())}bootstrapNestedComponents(){this.nestedBoundaryManager.bootstrap()}materializeNestedBoundaryFormDefaults(e){this.formControlManager.materializeNestedBoundaryFormDefaults(e,{inputValueStore:this.__ppInputValueStore,defaultValueStore:this.__ppDefaultValueStore,defaultCheckedStore:this.__ppDefaultCheckedStore})}forceUpdate(){this.lastRenderedHtml="",this.render()}destroyNestedComponents(){const e=C.getDescendantIds(this.id),t=new Set;e.forEach(e=>{var n;if(t.has(e))return;t.add(e);const s=C.getInstance(e);s&&s!==this&&(null==(n=s.destroy)||n.call(s))})}destroy(){this.destroyNestedComponents(),this.formControlManager.clearResetHandlers(this.id),this.hooksSystem.dispose(),this.refBindingManager.clearAll(),this.portalManager.destroyAll();const e=this.contextManager.destroy();this.eventManager.clearCache(),C.removeState(this.id),C.removeScope(this.id),C.removeTemplate(this.id),C.removeOwnedTemplates(this.id),C.removeInstance(this.id),this.contextManager.refreshConsumers(e)}};d(D,"MAX_SYNC_RERENDERS",25),d(D,"perfEnabled",!1),d(D,"perfStats",new Map);let he=D;const Dr="opacity 0.18s ease-out",Pt=15e3,Tt={bootstrap:()=>{Array.from(document.querySelectorAll("[pp-component]")).filter(e=>{var t;return!(null!=(t=e.parentElement)&&t.closest("[pp-component]"))}).forEach(e=>{new he(e)})}},xe=class e{constructor(){d(this,"activeAbortController",null),d(this,"navigationEnabled",!1),d(this,"boundHandleLinkClick",null),d(this,"boundHandlePopState",null),d(this,"boundHandleTrackedScroll",null),d(this,"isNavigating",!1),d(this,"pendingHistoryStateSaveTimer",null),d(this,"lastHistoryStateSaveAt",0),d(this,"pendingProgrammaticScrollPersistenceTimer",null),d(this,"RESET_SCROLL_ATTR","pp-reset-scroll"),d(this,"HISTORY_SCROLL_STATE_KEY","__ppScrollPositions"),d(this,"TRACKED_SCROLL_PERSISTENCE_INTERVAL_MS",150),d(this,"PROGRAMMATIC_SCROLL_SETTLE_MS",120),d(this,"mounted",!1),d(this,"suppressTrackedScrollPersistence",!1),d(this,"transitionLockCount",0),d(this,"pendingRevealFrame",null),d(this,"pendingTransitionUnlockFrame",null),d(this,"hydrationBodySnapshot",null),d(this,"previousHistoryScrollRestoration",null)}mount(){this.mounted||(this.mounted=!0,this.warnAboutOrphanPulsePointScripts(),this.disableTransitions(),this.hideBodyForHydration(!0),Tt.bootstrap(),this.scheduleHydrationReveal(),this.enableSPANavigation())}createComponentRuntime(t){const n={};for(const t of e.PUBLIC_METHODS){const e=this[t];"function"==typeof e?n[t]=e.bind(this):void 0!==e&&(n[t]=e)}return Object.assign({},n,t)}warnAboutOrphanPulsePointScripts(){const e=Array.from(document.querySelectorAll('script[type="text/pp"]')).filter(e=>!e.closest("[pp-component]"));0!==e.length&&console.warn(`[PP-WARN] Found ${e.length} PulsePoint script${1===e.length?"":"s"} outside a pp-component root. Keep component scripts inside the single component root so they can participate in render scope.`)}createContext(e){return Vr(e)}enablePerf(){he.setPerfEnabled(!0)}disablePerf(){he.setPerfEnabled(!1)}getPerfStats(){return he.getPerfStats()}resetPerfStats(){he.resetPerfStats()}getCsrfToken(){const e=window.location.port?[`pp_csrf_${window.location.port}`,"pp_csrf"]:["pp_csrf"];for(const t of e){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=document.cookie.match(new RegExp(`(?:^|;\\s*)${e}=([^;]*)`));if(n)return decodeURIComponent(n[1])}return""}resolveRpcUrl(e){const t=window.location.pathname.replace(/\/+$/,"")||"/";return new URL(e??t,window.location.origin)}resolveRpcCredentials(e,t){return t||(e.origin===window.location.origin?"same-origin":"include")}async ensureCsrfToken(e,t,n){let s=this.getCsrfToken();if(""!==s||"omit"===t)return s;const i=new URL(n??e.toString(),window.location.origin);return await fetch(i.toString(),{method:"GET",credentials:t,cache:"no-store",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"text/html, application/json, */*"}}),s=this.getCsrfToken(),s}disableTransitions(){if(this.transitionLockCount+=1,document.getElementById("pp-disable-transitions"))return;const e=document.createElement("style");e.id="pp-disable-transitions",e.textContent="\n *, *::before, *::after {\n transition: none !important;\n animation: none !important;\n }\n ",document.head.insertBefore(e,document.head.firstChild)}enableTransitions(e=!1){if(e?this.transitionLockCount=0:this.transitionLockCount>0&&(this.transitionLockCount-=1),this.transitionLockCount>0)return;const t=document.getElementById("pp-disable-transitions");t&&t.remove()}requestFrame(e){return"function"==typeof requestAnimationFrame?requestAnimationFrame(e):window.setTimeout(()=>e(performance.now()),16)}cancelFrame(e){"function"!=typeof cancelAnimationFrame?window.clearTimeout(e):cancelAnimationFrame(e)}cancelScheduledHydrationReveal(){null!==this.pendingRevealFrame&&(this.cancelFrame(this.pendingRevealFrame),this.pendingRevealFrame=null),null!==this.pendingTransitionUnlockFrame&&(this.cancelFrame(this.pendingTransitionUnlockFrame),this.pendingTransitionUnlockFrame=null)}cancelPendingProgrammaticScrollPersistence(){null!==this.pendingProgrammaticScrollPersistenceTimer&&(window.clearTimeout(this.pendingProgrammaticScrollPersistenceTimer),this.pendingProgrammaticScrollPersistenceTimer=null)}beginProgrammaticScrollPersistencePause(){this.suppressTrackedScrollPersistence=!0,this.cancelPendingHistoryStateSave(),this.cancelPendingProgrammaticScrollPersistence()}scheduleProgrammaticScrollPersistence(){this.suppressTrackedScrollPersistence&&(this.cancelPendingProgrammaticScrollPersistence(),this.pendingProgrammaticScrollPersistenceTimer=window.setTimeout(()=>{this.pendingProgrammaticScrollPersistenceTimer=null,this.suppressTrackedScrollPersistence=!1,this.persistCurrentHistoryScrollState()},this.PROGRAMMATIC_SCROLL_SETTLE_MS))}scrollElementIntoView(e){this.beginProgrammaticScrollPersistencePause(),e.scrollIntoView({behavior:"smooth"}),this.scheduleProgrammaticScrollPersistence()}normalizeHydrationBodySnapshotStyle(e){var t;if(null===e)return null;const n=document.createElement("div");n.setAttribute("style",e),"0"===n.style.opacity&&n.style.removeProperty("opacity"),"none"===n.style.pointerEvents&&n.style.removeProperty("pointer-events"),"none"===n.style.userSelect&&n.style.removeProperty("user-select"),n.style.transition.replace(/\s+/g," ").trim().toLowerCase()===Dr&&n.style.removeProperty("transition");const s=(null==(t=n.getAttribute("style"))?void 0:t.trim())??"";return""===s?null:s}hideBodyForHydration(e=!1){if(!this.hydrationBodySnapshot){const t=document.body.getAttribute("style");this.hydrationBodySnapshot={style:e?this.normalizeHydrationBodySnapshotStyle(t):t,hadAriaBusy:document.body.hasAttribute("aria-busy"),ariaBusy:document.body.getAttribute("aria-busy"),hadInert:document.body.hasAttribute("inert"),inert:document.body.getAttribute("inert")}}document.body.style.opacity="0",document.body.style.pointerEvents="none",document.body.style.userSelect="none",document.body.setAttribute("aria-busy","true"),document.body.setAttribute("inert","")}scheduleHydrationReveal(e){this.cancelScheduledHydrationReveal(),this.pendingRevealFrame=this.requestFrame(()=>{this.pendingRevealFrame=null,this.restoreBodyAccessibility(),null==e||e(),this.pendingTransitionUnlockFrame=this.requestFrame(()=>{this.pendingTransitionUnlockFrame=null,this.enableTransitions(!0)})})}restoreBodyAccessibility(){const e=this.hydrationBodySnapshot;if(!e)return document.body.style.removeProperty("transition"),document.body.style.removeProperty("opacity"),document.body.style.removeProperty("pointer-events"),document.body.style.removeProperty("user-select"),document.body.removeAttribute("inert"),void document.body.removeAttribute("aria-busy");null===e.style?document.body.removeAttribute("style"):document.body.setAttribute("style",e.style),e.hadInert?document.body.setAttribute("inert",e.inert??""):document.body.removeAttribute("inert"),e.hadAriaBusy?document.body.setAttribute("aria-busy",e.ariaBusy??""):document.body.removeAttribute("aria-busy"),this.hydrationBodySnapshot=null}static resetInstance(){this.instance&&(this.instance.navigationEnabled&&this.instance.disableSPANavigation(),this.instance.cancelScheduledHydrationReveal(),this.instance.restoreBodyAccessibility(),this.instance.enableTransitions(!0),this.instance.mounted=!1,this.instance.activeAbortController&&(this.instance.activeAbortController.abort(),this.instance.activeAbortController=null),this.instance=null)}static getInstance(){return this.instance||(this.instance=new e),this.instance}enableSPANavigation(){this.navigationEnabled||(this.navigationEnabled=!0,this.boundHandleLinkClick=this.handleLinkClick.bind(this),this.boundHandlePopState=this.handlePopState.bind(this),this.boundHandleTrackedScroll=this.handleTrackedScroll.bind(this),"scrollRestoration"in history&&(this.previousHistoryScrollRestoration=history.scrollRestoration,history.scrollRestoration="manual"),document.addEventListener("click",this.boundHandleLinkClick),window.addEventListener("popstate",this.boundHandlePopState),document.addEventListener("scroll",this.boundHandleTrackedScroll,!0),window.addEventListener("scroll",this.boundHandleTrackedScroll,{passive:!0}),this.persistCurrentHistoryScrollState())}disableSPANavigation(){this.navigationEnabled=!1,this.suppressTrackedScrollPersistence=!1,this.boundHandleLinkClick&&(document.removeEventListener("click",this.boundHandleLinkClick),this.boundHandleLinkClick=null),this.boundHandlePopState&&(window.removeEventListener("popstate",this.boundHandlePopState),this.boundHandlePopState=null),this.boundHandleTrackedScroll&&(document.removeEventListener("scroll",this.boundHandleTrackedScroll,!0),window.removeEventListener("scroll",this.boundHandleTrackedScroll),this.boundHandleTrackedScroll=null),this.cancelPendingHistoryStateSave(),this.cancelPendingProgrammaticScrollPersistence(),null!==this.previousHistoryScrollRestoration&&"scrollRestoration"in history&&(history.scrollRestoration=this.previousHistoryScrollRestoration,this.previousHistoryScrollRestoration=null)}handleLinkClick(e){if(!this.navigationEnabled)return;const t=this.getNavigationTarget(e.target);if(!t)return;const n=t.closest("a");if(n&&n.href)try{const t=new URL(n.href),s=t.origin!==window.location.origin,i=t.pathname===window.location.pathname&&t.search===window.location.search,r="false"===n.getAttribute("pp-spa");if(s||"_blank"===n.target||n.hasAttribute("download")||r||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;if(e.preventDefault(),i){const n=t.hash;if(n){e.preventDefault(),this.persistCurrentHistoryScrollState(),history.pushState(this.buildHistoryState(),"",t.pathname+t.search+n);const s=document.querySelector(n);return void(s&&this.scrollElementIntoView(s))}}this.navigateTo(t.pathname+t.search+t.hash)}catch(e){console.error("Link click navigation error:",e)}}getNavigationTarget(e){return e instanceof Element?e:e instanceof Node?e.parentElement:null}handleTrackedScroll(){if(!this.navigationEnabled||this.isNavigating)return;if(this.suppressTrackedScrollPersistence)return void this.scheduleProgrammaticScrollPersistence();const e=Date.now()-this.lastHistoryStateSaveAt;if(e>=this.TRACKED_SCROLL_PERSISTENCE_INTERVAL_MS)return this.cancelPendingHistoryStateSave(),void this.persistCurrentHistoryScrollState();null===this.pendingHistoryStateSaveTimer&&(this.pendingHistoryStateSaveTimer=window.setTimeout(()=>{this.pendingHistoryStateSaveTimer=null,this.persistCurrentHistoryScrollState()},this.TRACKED_SCROLL_PERSISTENCE_INTERVAL_MS-e))}async handlePopState(e){const t=this.getCurrentUrl(),n=this.getScrollPositionsFromHistoryState(e.state);await this.navigateTo(t,!1,n)}async navigateTo(e,t=!0,n=null){this.cancelPendingHistoryStateSave(),this.cancelPendingProgrammaticScrollPersistence(),this.suppressTrackedScrollPersistence=!1,this.isNavigating=!0;try{this.dispatchNavigationEvent("start",e),await this.showLoadingTransition();const s=await this.fetchPageContent(e);if("hardReload"in s)return void(window.location.href=s.hardReload);if("redirect"in s)return void await this.navigateTo(s.redirect,t,n);const i=s,r=t?this.saveScrollPositions():null;this.updateBrowserHistory(e,t,r),this.disableTransitions(),this.hideBodyForHydration();const a=document.getElementById("loading-file-1B87E"),o="startViewTransition"in document,c=this.getResetScrollConfig(i);!a&&o?await this.updatePageContentWithViewTransition(i):await this.updatePageContent(i),this.resetGlobalCaches(),Tt.bootstrap(),this.handleScrollRestoration(t?r:n,c,t?"push":"history"),await this.handleNavigationCompletion(),this.dispatchNavigationEvent("complete",e)}catch(t){this.handleNavigationError(e,t)}finally{this.isNavigating=!1}}resetGlobalCaches(){C.clear(),Q.clearCaches(),_e.clearCache()}getResetScrollConfig(e){if("true"===e.body.getAttribute(this.RESET_SCROLL_ATTR))return{mode:"global",resetElementKeys:new Set,resetWindow:!1};const t=e.querySelectorAll(`[${this.RESET_SCROLL_ATTR}]`),n=new Set;let s=!1;if(t.length>0)for(const e of Array.from(t))if("true"===e.getAttribute(this.RESET_SCROLL_ATTR)){const t=this.getElementKeyFromElement(e);n.add(t),s=!0}return s||n.size>0?{mode:"none",resetElementKeys:n,resetWindow:s}:{mode:"none",resetElementKeys:new Set,resetWindow:!1}}getElementKeyFromElement(e){return e.id?e.id:e.className?e.className:e.tagName}handleScrollRestoration(e,t,n){requestAnimationFrame(()=>{if("global"===t.mode)return window.scrollTo(0,0),document.documentElement.scrollTop=0,document.documentElement.scrollLeft=0,void document.querySelectorAll("*").forEach(e=>{(e.scrollTop||e.scrollLeft)&&(e.scrollTop=0,e.scrollLeft=0)});if("history"!==n||t.resetWindow||null==e||!e.window)window.scrollTo(0,0),document.documentElement.scrollTop=0,document.documentElement.scrollLeft=0;else{const t=null==e?void 0:e.window;t&&window.scrollTo(t.scrollLeft,t.scrollTop)}document.querySelectorAll("*").forEach(s=>{const i=s.tagName.toLowerCase();if("html"===i||"body"===i)return;const r=this.getElementKey(s),a="history"===n||"push"===n&&!t.resetElementKeys.has(r)?null==e?void 0:e[r]:null;t.resetElementKeys.has(r)?(s.scrollTop=0,s.scrollLeft=0):a&&(s.scrollTop=a.scrollTop,s.scrollLeft=a.scrollLeft)})})}saveScrollPositions(){const e={window:{scrollTop:window.scrollY||document.documentElement.scrollTop,scrollLeft:window.scrollX||document.documentElement.scrollLeft}};return document.querySelectorAll("*").forEach(t=>{(t.scrollTop||t.scrollLeft)&&(e[this.getElementKey(t)]={scrollTop:t.scrollTop,scrollLeft:t.scrollLeft})}),e}getElementKey(e){return e.id||e.className||e.tagName}cancelPendingHistoryStateSave(){null!==this.pendingHistoryStateSaveTimer&&(window.clearTimeout(this.pendingHistoryStateSaveTimer),this.pendingHistoryStateSaveTimer=null)}buildHistoryState(e){const t=history.state,n=t&&"object"==typeof t&&!Array.isArray(t)?{...t}:{};return e?n[this.HISTORY_SCROLL_STATE_KEY]=e:delete n[this.HISTORY_SCROLL_STATE_KEY],n}getScrollPositionsFromHistoryState(e){if(!e||"object"!=typeof e||Array.isArray(e))return null;const t=e[this.HISTORY_SCROLL_STATE_KEY];return!t||"object"!=typeof t||Array.isArray(t)?null:t}persistCurrentHistoryScrollState(e=this.saveScrollPositions()){this.lastHistoryStateSaveAt=Date.now(),history.replaceState(this.buildHistoryState(e),"",this.getCurrentUrl())}getCurrentUrl(){return window.location.pathname+window.location.search+window.location.hash}teardownCurrentPageComponents(){C.destroyAll()}async updatePageContentWithViewTransition(e){e.title&&(document.title=e.title);const t=e.body.innerHTML;if(this.syncBodyAttributes(e.body),this.teardownCurrentPageComponents(),this.isNavigating||!document.startViewTransition)return void(document.body.innerHTML=t);const n=document.startViewTransition(()=>{document.body.innerHTML=t});try{await n.finished}catch(e){console.warn("View transition failed, continuing anyway:",e)}}dispatchNavigationEvent(e,t,n){const s=`pp:navigation:${e}`,i=n?{url:t,error:n}:{url:t};document.dispatchEvent(new CustomEvent(s,{detail:i}))}async showLoadingTransition(){const e=document.getElementById("loading-file-1B87E");if(e){const t=this.findLoadingElement(e,window.location.pathname);if(t)return void await this.updateContentWithTransition(t)}const t=document.querySelector("[pp-loading-content='true']")||document.body;t&&!("startViewTransition"in document)&&await this.fadeOut(t,250)}async fetchPageContent(e){const t=new URL(e,window.location.origin).hash,n=new AbortController,s=window.setTimeout(()=>{n.abort()},Pt);let i;try{i=await fetch(e,{signal:n.signal,headers:{"X-Requested-With":"XMLHttpRequest","X-PP-Navigation":"true","X-PulsePoint-Wire":"true",Accept:"text/html"}})}catch(t){throw t instanceof Error&&"AbortError"===t.name?new Error(`Navigation timed out after ${Math.round(15)}s: ${e}`):t}finally{window.clearTimeout(s)}if(!i.ok)throw new Error(`Navigation failed: ${i.status} ${i.statusText}`);const r=i.headers.get("X-PP-Root-Layout"),a=document.querySelector('meta[name="pp-root-layout"]'),o=a?a.getAttribute("content"):null;if(r&&o&&r!==o)return{hardReload:e};if(i.redirected){const n=this.normalizeServerRedirectTarget(i.url);if(!n)return{hardReload:e};const s=new URL(n,window.location.origin);if(t&&s.searchParams.has("next")){const e=s.searchParams.get("next");e&&!e.includes("#")&&s.searchParams.set("next",e+t)}return{redirect:s.pathname+s.search+s.hash}}const c=this.getRedirectUrlFromResponse(i);if(c)return{redirect:c};const l=await i.text();return(new DOMParser).parseFromString(l,"text/html")}normalizeServerRedirectTarget(e){if(!e)return null;try{const t=new URL(e,window.location.href);return t.origin!==window.location.origin?(console.warn("Ignoring cross-origin redirect target from server response:",e),null):t.pathname+t.search+t.hash}catch(t){return console.warn("Ignoring invalid redirect target from server response:",e,t),null}}getRedirectUrlFromResponse(e){const t=e.headers.get("X-PP-Redirect"),n=this.normalizeServerRedirectTarget(t);if(n)return n;const s=e.headers.get("Location"),i=e.status;return s&&i>=300&&i<400?this.normalizeServerRedirectTarget(s):null}updateBrowserHistory(e,t,n=null){t&&(this.persistCurrentHistoryScrollState(n??void 0),history.pushState(this.buildHistoryState(),"",e))}async updatePageContent(e){e.title&&(document.title=e.title);const t=e.body;this.syncBodyAttributes(t),this.teardownCurrentPageComponents(),document.body.innerHTML=t.innerHTML}syncBodyAttributes(e){e&&(Array.from(document.body.attributes).forEach(e=>{"style"!==e.name&&document.body.removeAttribute(e.name)}),Array.from(e.attributes).forEach(e=>{"style"!==e.name&&document.body.setAttribute(e.name,e.value)}))}async handleNavigationCompletion(){const e=document.querySelector("[pp-loading-content='true']")||document.body,t=window.location.hash;this.scheduleHydrationReveal(()=>{if(this.fadeIn(e,150),t){const e=document.querySelector(t);e&&this.scrollElementIntoView(e)}})}handleNavigationError(e,t){console.error("Navigation error:",t),this.restoreBodyAccessibility(),this.enableTransitions(!0),this.dispatchNavigationEvent("error",e,t),window.location.href=e}findLoadingElement(e,t){let n=t;for(;;){const t=e.querySelector(`div[pp-loading-url='${n}']`);if(t)return t;if("/"===n)break;const s=n.lastIndexOf("/");n=s<=0?"/":n.substring(0,s)}return e.querySelector("div[pp-loading-url='/' ]")}async updateContentWithTransition(e){const t=document.querySelector("[pp-loading-content='true']")||document.body;if(!t)return;const{fadeIn:n,fadeOut:s}=this.parseTransition(e);await this.fadeOut(t,s),t.innerHTML=e.innerHTML,this.fadeIn(t,n)}parseTransition(e){let t=250,n=250;const s=e.querySelector("[pp-loading-transition]"),i=null==s?void 0:s.getAttribute("pp-loading-transition");if(i){let e=JSON.parse(i);e&&"object"==typeof e?(t=this.parseTime(e.fadeIn??t),n=this.parseTime(e.fadeOut??n)):console.warn("pp-loading-transition is not valid JSON → default values (250 ms) will be used. String:",i)}return{fadeIn:t,fadeOut:n}}fadeOut(e,t){return new Promise(n=>{e.style.transition=`opacity ${t}ms ease-out`,setTimeout(()=>{e.style.transition="",n()},t)})}fadeIn(e,t){e.style.transition=`opacity ${t}ms ease-in`,setTimeout(()=>{e.style.transition=""},t)}parseTime(e){if("number"==typeof e)return e;const t=e.match(/^(\d+)(ms|s|m)?$/);if(t){const e=parseInt(t[1],10);switch(t[2]||"ms"){case"ms":default:return e;case"s":return 1e3*e;case"m":return 60*e*1e3}}return 0}async redirect(e){if(e)try{const t=new URL(e,window.location.origin);t.origin!==window.location.origin?window.location.href=e:this.navigationEnabled?await this.navigateTo(t.pathname+t.search+t.hash):window.location.href=e}catch(e){console.error("Redirect error:",e)}}async rpc(e,t={},n=!1){let s=null;const i="boolean"==typeof n?{abortPrevious:n}:n;try{i.abortPrevious&&this.activeAbortController&&(this.activeAbortController.abort(),this.activeAbortController=null),s=new AbortController,i.abortPrevious&&(this.activeAbortController=s);const n=this.resolveRpcUrl(i.url),r=this.resolveRpcCredentials(n,i.credentials),a={"X-CSRF-Token":await this.ensureCsrfToken(n,r,i.csrfUrl),"X-PP-RPC":"true","X-PulsePoint-Wire":"true","X-PP-Function":e,"X-Requested-With":"XMLHttpRequest",Accept:"application/json, text/event-stream"};let o;if(Object.values(t).some(e=>e instanceof File||e instanceof FileList&&e.length>0)){const e=new FormData;for(const[n,s]of Object.entries(t))s instanceof File?e.append(n,s):s instanceof FileList?Array.from(s).forEach(t=>e.append(n,t)):null!=s&&e.append(n,"object"==typeof s?JSON.stringify(s):String(s));if(i.onUploadProgress)return await this.xhrFunction({url:n.toString(),headers:a,body:e,controller:s,credentials:r,options:i});o={method:"POST",headers:a,body:e,credentials:r,signal:s.signal}}else o={method:"POST",headers:{...a,"Content-Type":"application/json"},body:JSON.stringify(t),credentials:r,signal:s.signal};const c=await fetch(n.toString(),o);if(401===c.status)throw new Error("Authentication required");if(403===c.status)throw new Error("Permission denied");if(!c.ok){const e=await c.json().catch(()=>null);throw e||415!==c.status?new Error((null==e?void 0:e.error)||`Request failed: ${c.status} ${c.statusText}`):new Error("Server rejected data format (415).")}const l=this.getRedirectUrlFromResponse(c);return l?(await this.redirect(l),{redirected:!0,to:l}):(this.activeAbortController===s&&(this.activeAbortController=null),(c.headers.get("Content-Type")||"").includes("text/event-stream")&&c.body?(i.onStream||console.warn("RPC returned a stream, but no onStream handler provided."),void await this.handleStream(c.body,i)):await c.json())}catch(e){if(this.activeAbortController===s&&(this.activeAbortController=null),e instanceof Error&&"AbortError"===e.name)return console.log("Request was cancelled"),{cancelled:!0};if(i.onStreamError)return void i.onStreamError(e);throw console.error("RPC error:",e),e}}xhrFunction(e){const{url:t,headers:n,body:s,controller:i,credentials:r,options:a}=e;return new Promise((e,o)=>{const c=new XMLHttpRequest;c.open("POST",t,!0),c.withCredentials="include"===r;for(const[e,t]of Object.entries(n))c.setRequestHeader(e,t);const l=()=>{try{c.abort()}catch{}};i.signal.addEventListener("abort",l,{once:!0}),c.upload&&a.onUploadProgress&&(c.upload.onprogress=e=>{var t;const n=e.lengthComputable?e.total:null,s=e.lengthComputable&&e.total>0?Math.min(100,Math.max(0,e.loaded/e.total*100)):null;null==(t=a.onUploadProgress)||t.call(a,{loaded:e.loaded,total:n,percent:s})}),c.onerror=()=>{i.signal.removeEventListener("abort",l),o(new Error("Network error (XHR upload)."))},c.onload=async()=>{var t,n;if(i.signal.removeEventListener("abort",l),401===c.status)return o(new Error("Authentication required"));if(403===c.status)return o(new Error("Permission denied"));if(c.status<200||c.status>=300){let e=`Request failed: ${c.status} ${c.statusText}`;try{const t=JSON.parse(c.responseText||"{}");e=(null==t?void 0:t.error)||(null==t?void 0:t.message)||e}catch{}return o(new Error(e))}const s=this.normalizeServerRedirectTarget(c.getResponseHeader("X-PP-Redirect")||(c.status>=300&&c.status<400?c.getResponseHeader("Location"):null));if(s)try{return await this.redirect(s),null==(t=a.onUploadComplete)||t.call(a),e({redirected:!0,to:s})}catch(e){return o(e)}const r=c.responseText??"";let h=r;try{h=JSON.parse(r)}catch{}null==(n=a.onUploadComplete)||n.call(a),e(h)};try{c.send(s)}catch(e){i.signal.removeEventListener("abort",l),o(e)}})}async handleStream(e,t){const n=e.getReader(),s=new TextDecoder;let i="";try{for(;;){const{done:e,value:r}=await n.read();if(e){t.onStreamComplete&&t.onStreamComplete();break}i+=s.decode(r,{stream:!0});const a=i.split("\n");i=a.pop()||"";for(const e of a)if(""!==e.trim()&&e.startsWith("data: ")){const n=e.slice(6);let s=n;try{("true"===n||"false"===n||"null"===n||!isNaN(Number(n))||n.startsWith("{")||n.startsWith("[")||n.startsWith('"'))&&(s=JSON.parse(n))}catch{}t.onStream&&t.onStream(s)}}}catch(e){if(!t.onStreamError)throw e;t.onStreamError(e)}finally{n.releaseLock()}}};d(xe,"instance",null),d(xe,"PUBLIC_METHODS",["createContext","mount","redirect","rpc","enablePerf","disablePerf","getPerfStats","resetPerfStats"]);let ut=xe;function Or(e,t,n=(typeof window<"u"?window:globalThis),s=!0){let i=null;if(Object.defineProperty(n,e,{get(){if(null!==i)return i;if(t&&"object"==typeof t&&!Array.isArray(t)&&"getInstance"in t&&"function"==typeof t.getInstance)return i=t.getInstance(),i;if("function"!=typeof t)return i=t,i;try{return i=t.getInstance(),i}catch{return i=t,i}},set(t){null===t?i=null:console.warn(`Cannot override global ${e}`)},configurable:!0,enumerable:!0}),s)try{n[e]}catch(t){console.error(`Failed to initialize ${e}:`,t)}}Or("pp",{getInstance:()=>ut.getInstance()});export{Tt as ComponentInit,ut as PPUtilities};
|